diff --git a/Settings.php b/Settings.php index d64e651..00d562d 100644 --- a/Settings.php +++ b/Settings.php @@ -27,21 +27,24 @@ $mmessage = 'Мы тут шаманим немного. Скоро всё буд ########## Forum Info ########## $mbname = 'www.rock.ru'; # The name of your forum. $language = 'russian'; # The default language file set for the forum. -$boardurl = 'http://rock.ru/forum'; # URL to your forum's folder. (without the trailing /!) +$boardurl = 'http://192.168.201.100/forum'; # URL to your forum's folder. (without the trailing /!) $boarddir = '/var/www/rock/forum'; $sourcedir = '/var/www/rock/forum/Sources'; $webmaster_email = 'noreply@rock.ru'; # Email address to send emails from. (like noreply@yourdomain.com.) $cookiename = 'SMFCookie10'; # Name of the cookie to set for authentication. -$mongo_server = "mongodb://rock.home:27017"; -$memcached_host = "127.0.0.1"; +//$mongo_server = "mongodb://10.152.69.6:27017/?replicaSet=rock0"; +$memcached_host = 'memcached'; $memcached_port = 11211; + +$recaptcha_secret = '6LfbSRUUAAAAAM4goUyXz9gB21cfIHL0ZhiQ6doM'; +$recaptcha_site_key = '6LfbSRUUAAAAAN1TtRVmVsHw8NKWe5w50fzjyK3U'; ########## Database Info ########## #$db_server = '127.0.0.1:3306'; -$db_server = 'localhost'; +$db_server = 'mysql'; $db_name = 'rock'; -$db_user = 'rock'; -$db_passwd = 'nla3YjQ0pL'; +$db_user = 'root'; +$db_passwd = ''; $db_prefix = 'smf_'; $db_persist = 0; $db_error_send = 1; diff --git a/Sources/Display.php b/Sources/Display.php index c3ba0a9..b56f08f 100644 --- a/Sources/Display.php +++ b/Sources/Display.php @@ -76,7 +76,8 @@ function Display() else loadTemplate('Display'); - $ignores = $mongodb->rock->ignorelists->findOne(array('user' => (int) $ID_MEMBER), array ("ignores" => 1)); + /*$ignores = $mongodb->rock->ignorelists->findOne(array('user' => (int) $ID_MEMBER), array ("ignores" => 1));*/ + $ignores = NULL; $ignores == NULL ? $context['ignore_list'] = array() : $context['ignore_list'] = $ignores['ignores']; // Find the previous or next topic. Make a fuss if there are no more. diff --git a/Sources/Load.php b/Sources/Load.php index c184364..43b0ceb 100644 --- a/Sources/Load.php +++ b/Sources/Load.php @@ -148,13 +148,14 @@ function loadUserSettings() explode(',', $user_settings['additionalGroups']) ) ); - + if(0) { // skip mongo $__uid = str_replace("uid=","",$_SERVER['USERID']); $mongodb->rock->memberUids->update( array('member' => $ID_MEMBER), array('$addToSet' => array('uids' => $__uid)), array('upsert' => true) - ); + ); + } // end skip mongo } // If the user is a guest, initialize all the critial user settings. diff --git a/Sources/Register.php b/Sources/Register.php index 61e3e5b..935cbe2 100644 --- a/Sources/Register.php +++ b/Sources/Register.php @@ -31,7 +31,7 @@ if (!defined('SMF')) // Begin the registration process. function Register() { - global $txt, $boarddir, $context, $modSettings, $user_info, $db_prefix; + global $txt, $boarddir, $context, $modSettings, $user_info, $db_prefix, $recaptcha_site_key; // Check if the administrator has it disabled. if (!empty($modSettings['registration_method']) && $modSettings['registration_method'] == 3) @@ -51,6 +51,7 @@ function Register() $context['sub_template'] = 'before'; $context['allow_hide_email'] = !empty($modSettings['allow_hideEmail']); $context['require_agreement'] = !empty($modSettings['requireAgreement']); + $context['recaptcha_site_key'] = $recaptcha_site_key; $context['page_title'] = $txt[97]; //Begin CAPTCHA Mod 0.1 @@ -66,7 +67,7 @@ function Register() // Actually register the member. function Register2() { - global $scripturl, $txt, $modSettings, $db_prefix, $context, $sourcedir, $user_info, $options, $settings; + global $scripturl, $txt, $modSettings, $db_prefix, $context, $sourcedir, $user_info, $options, $settings, $recaptcha_secret; # print_r($_SESSION); # Engine supports posting extra fields upon registration, but it will never happen in real life @@ -88,16 +89,13 @@ function Register2() //Begin CAPTCHA Mod 0.1 //Check if the CAPTCHA was entered properly... global $boarddir; - require("$boarddir/captcha/captcha.php"); + require("$boarddir/recaptcha/src/autoload.php"); + $recaptcha = new \ReCaptcha\ReCaptcha($recaptcha_secret); + $resp = $recaptcha->verify($_POST['g-recaptcha-response'], $_SERVER['REMOTE_ADDR']); + #var_dump(array($_POST['g-recaptcha-response'], $resp)); - switch($context['captchaObj']->validate_submit()) { - //Entered incorrectly! - case 2: - fatal_error($txt['captchaWrong']); - case 3: - fatal_error($txt['captchaMaxTries']); - - } + if (!$resp->isSuccess()) + fatal_error($txt['captchaWrong']); //End CAPTCHA Mod diff --git a/Sources/Security.php b/Sources/Security.php index 879482c..4d0efd0 100644 --- a/Sources/Security.php +++ b/Sources/Security.php @@ -315,6 +315,15 @@ function is_not_banned() } } + # check Tor: disallow registration + $res = db_query( + "select * from tor_nodes where ip='${user_info['ip']}'", + __FILE__, __LINE__ + ); + if (mysql_num_rows($res) > 0) { + $_SESSION['ban']['cannot_register']['is_banned'] = true; + } + // If you're fully banned, it's end of the story for you. if ($_SESSION['ban']['full_ban']['is_banned']) { @@ -613,6 +622,7 @@ function allowedTo($permission, $boards = null) return true; // no more than 3 polls in 24 hours. moderators excluded + if (! isset($user_info['is_mod'])) $user_info['is_mod'] = false; if (! $user_info['is_mod'] && in_array($permission, array ('poll_post', 'poll_add_own'))) { $request = db_query(" SELECT COUNT(*) as recent_polls diff --git a/Sources/Subs.php b/Sources/Subs.php index 7b3f5b9..f2d508c 100644 --- a/Sources/Subs.php +++ b/Sources/Subs.php @@ -213,6 +213,7 @@ if (!defined('SMF')) */ // Find the earliest unread message in the topic. (the use of topics here is just for both tables.) function getFirstUnreadPostTimestamp($topic, $board, $user) { + global $db_prefix; $request = db_query(" SELECT IFNULL(lt.logTime, IFNULL(lmr.logTime, 0)) AS logTime FROM {$db_prefix}topics AS t @@ -1347,13 +1348,16 @@ function parseVideoDailymotion($url) { } function cache_get($param) { - global $memcached; - return $memcached->get($param); + /*global $memcached;*/ + /*return $memcached->get($param);*/ + return null; } function cache_set($param, $value, $ttl = 0) { - global $memcached; - return $memcached->set($param, $value, $ttl); + /*global $memcached;*/ + /*return $memcached->set($param, $value, $ttl);*/ + + return null; } function parseVideoYoutube($url) { diff --git a/Themes/default/MessageIndex.template.php b/Themes/default/MessageIndex.template.php index dbecda3..6869cff 100644 --- a/Themes/default/MessageIndex.template.php +++ b/Themes/default/MessageIndex.template.php @@ -158,31 +158,33 @@ function template_main() foreach ($context['topics'] as $topic) { - if ($first_topic['is_sticky'] && !$topic['is_sticky']) { - $first_topic['is_sticky'] = 0; - // Display separator - if($context['user']['is_guest']) - echo '