import legacy codebase

This commit is contained in:
Aleksei Miheev
2024-11-23 15:09:46 +07:00
parent c42e3b9ceb
commit 73917dc5dd
14 changed files with 83 additions and 69 deletions

View File

@@ -27,21 +27,24 @@ $mmessage = 'Мы тут шаманим немного. Скоро всё буд
########## Forum Info ########## ########## Forum Info ##########
$mbname = 'www.rock.ru'; # The name of your forum. $mbname = 'www.rock.ru'; # The name of your forum.
$language = 'russian'; # The default language file set for the 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'; $boarddir = '/var/www/rock/forum';
$sourcedir = '/var/www/rock/forum/Sources'; $sourcedir = '/var/www/rock/forum/Sources';
$webmaster_email = 'noreply@rock.ru'; # Email address to send emails from. (like noreply@yourdomain.com.) $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. $cookiename = 'SMFCookie10'; # Name of the cookie to set for authentication.
$mongo_server = "mongodb://rock.home:27017"; //$mongo_server = "mongodb://10.152.69.6:27017/?replicaSet=rock0";
$memcached_host = "127.0.0.1"; $memcached_host = 'memcached';
$memcached_port = 11211; $memcached_port = 11211;
$recaptcha_secret = '6LfbSRUUAAAAAM4goUyXz9gB21cfIHL0ZhiQ6doM';
$recaptcha_site_key = '6LfbSRUUAAAAAN1TtRVmVsHw8NKWe5w50fzjyK3U';
########## Database Info ########## ########## Database Info ##########
#$db_server = '127.0.0.1:3306'; #$db_server = '127.0.0.1:3306';
$db_server = 'localhost'; $db_server = 'mysql';
$db_name = 'rock'; $db_name = 'rock';
$db_user = 'rock'; $db_user = 'root';
$db_passwd = 'nla3YjQ0pL'; $db_passwd = '';
$db_prefix = 'smf_'; $db_prefix = 'smf_';
$db_persist = 0; $db_persist = 0;
$db_error_send = 1; $db_error_send = 1;

View File

@@ -76,7 +76,8 @@ function Display()
else else
loadTemplate('Display'); 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']; $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. // Find the previous or next topic. Make a fuss if there are no more.

View File

@@ -148,13 +148,14 @@ function loadUserSettings()
explode(',', $user_settings['additionalGroups']) explode(',', $user_settings['additionalGroups'])
) )
); );
if(0) { // skip mongo
$__uid = str_replace("uid=","",$_SERVER['USERID']); $__uid = str_replace("uid=","",$_SERVER['USERID']);
$mongodb->rock->memberUids->update( $mongodb->rock->memberUids->update(
array('member' => $ID_MEMBER), array('member' => $ID_MEMBER),
array('$addToSet' => array('uids' => $__uid)), array('$addToSet' => array('uids' => $__uid)),
array('upsert' => true) array('upsert' => true)
); );
} // end skip mongo
} }
// If the user is a guest, initialize all the critial user settings. // If the user is a guest, initialize all the critial user settings.

View File

@@ -31,7 +31,7 @@ if (!defined('SMF'))
// Begin the registration process. // Begin the registration process.
function Register() 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. // Check if the administrator has it disabled.
if (!empty($modSettings['registration_method']) && $modSettings['registration_method'] == 3) if (!empty($modSettings['registration_method']) && $modSettings['registration_method'] == 3)
@@ -51,6 +51,7 @@ function Register()
$context['sub_template'] = 'before'; $context['sub_template'] = 'before';
$context['allow_hide_email'] = !empty($modSettings['allow_hideEmail']); $context['allow_hide_email'] = !empty($modSettings['allow_hideEmail']);
$context['require_agreement'] = !empty($modSettings['requireAgreement']); $context['require_agreement'] = !empty($modSettings['requireAgreement']);
$context['recaptcha_site_key'] = $recaptcha_site_key;
$context['page_title'] = $txt[97]; $context['page_title'] = $txt[97];
//Begin CAPTCHA Mod 0.1 //Begin CAPTCHA Mod 0.1
@@ -66,7 +67,7 @@ function Register()
// Actually register the member. // Actually register the member.
function Register2() 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); # print_r($_SESSION);
# Engine supports posting extra fields upon registration, but it will never happen in real life # 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 //Begin CAPTCHA Mod 0.1
//Check if the CAPTCHA was entered properly... //Check if the CAPTCHA was entered properly...
global $boarddir; 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()) { if (!$resp->isSuccess())
//Entered incorrectly! fatal_error($txt['captchaWrong']);
case 2:
fatal_error($txt['captchaWrong']);
case 3:
fatal_error($txt['captchaMaxTries']);
}
//End CAPTCHA Mod //End CAPTCHA Mod

View File

@@ -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 you're fully banned, it's end of the story for you.
if ($_SESSION['ban']['full_ban']['is_banned']) if ($_SESSION['ban']['full_ban']['is_banned'])
{ {
@@ -613,6 +622,7 @@ function allowedTo($permission, $boards = null)
return true; return true;
// no more than 3 polls in 24 hours. moderators excluded // 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'))) { if (! $user_info['is_mod'] && in_array($permission, array ('poll_post', 'poll_add_own'))) {
$request = db_query(" $request = db_query("
SELECT COUNT(*) as recent_polls SELECT COUNT(*) as recent_polls

View File

@@ -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.) // Find the earliest unread message in the topic. (the use of topics here is just for both tables.)
function getFirstUnreadPostTimestamp($topic, $board, $user) { function getFirstUnreadPostTimestamp($topic, $board, $user) {
global $db_prefix;
$request = db_query(" $request = db_query("
SELECT IFNULL(lt.logTime, IFNULL(lmr.logTime, 0)) AS logTime SELECT IFNULL(lt.logTime, IFNULL(lmr.logTime, 0)) AS logTime
FROM {$db_prefix}topics AS t FROM {$db_prefix}topics AS t
@@ -1347,13 +1348,16 @@ function parseVideoDailymotion($url) {
} }
function cache_get($param) { function cache_get($param) {
global $memcached; /*global $memcached;*/
return $memcached->get($param); /*return $memcached->get($param);*/
return null;
} }
function cache_set($param, $value, $ttl = 0) { function cache_set($param, $value, $ttl = 0) {
global $memcached; /*global $memcached;*/
return $memcached->set($param, $value, $ttl); /*return $memcached->set($param, $value, $ttl);*/
return null;
} }
function parseVideoYoutube($url) function parseVideoYoutube($url)
{ {

View File

@@ -158,31 +158,33 @@ function template_main()
foreach ($context['topics'] as $topic) foreach ($context['topics'] as $topic)
{ {
if ($first_topic['is_sticky'] && !$topic['is_sticky']) { # if ($first_topic['is_sticky'] && !$topic['is_sticky']) {
$first_topic['is_sticky'] = 0; # $first_topic['is_sticky'] = 0;
// Display separator # // Display separator
if($context['user']['is_guest']) # if($context['user']['is_guest']) {
echo '<tr class="titlebg"><td colspan="7"> # echo '<tr class="titlebg"><td colspan="7">
<div align="center"> #<div align="center">
<script type="text/javascript"><!-- #<script type="text/javascript"><!--
google_ad_client = "pub-7163001599713810"; #google_ad_client = "pub-7163001599713810";
google_ad_width = 728; #google_ad_width = 728;
google_ad_height = 15; #google_ad_height = 15;
google_ad_format = "728x15_0ads_al"; #google_ad_format = "728x15_0ads_al";
//2006-11-21: forum_links_under_sticky_posts #//2006-11-21: forum_links_under_sticky_posts
google_ad_channel = "1044131930"; #google_ad_channel = "1044131930";
google_color_border = "384658"; #google_color_border = "384658";
google_color_bg = "313131"; #google_color_bg = "313131";
google_color_link = "FFFFFF"; #google_color_link = "FFFFFF";
google_color_text = "dddddd"; #google_color_text = "dddddd";
google_color_url = "FFC246"; #google_color_url = "FFC246";
//--></script> #//--></script>
<script type="text/javascript" #<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> # src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script> #</script>
</div></td></tr>'; #</div></td></tr>';
else echo '<tr class="titlebg"><td colspan="7">&nbsp;'/*, $txt['non_sticky_topics']*/, '</td></tr>'; # } else {
} # echo '<tr class="titlebg"><td colspan="7">&nbsp;'/*, $txt['non_sticky_topics']*/, '</td></tr>';
# }
# }
if ($first_topic['is_sticky'] && !$topic['is_sticky']) { if ($first_topic['is_sticky'] && !$topic['is_sticky']) {
$first_topic['is_sticky'] = 0; $first_topic['is_sticky'] = 0;

View File

@@ -9,6 +9,7 @@ function template_before()
// Make sure they've agreed to the terms and conditions. // Make sure they've agreed to the terms and conditions.
echo ' echo '
<script type="text/javascript" src="http://' , $_SERVER["HTTP_HOST"] , '/forum/Themes/default/bogus.php?' , md5(rand()) , '"></script> <script type="text/javascript" src="http://' , $_SERVER["HTTP_HOST"] , '/forum/Themes/default/bogus.php?' , md5(rand()) , '"></script>
<script src="https://www.google.com/recaptcha/api.js"></script>
<script language="JavaScript" type="text/javascript"><!-- <script language="JavaScript" type="text/javascript"><!--
function agreesubmit(el) function agreesubmit(el)
{ {
@@ -30,8 +31,9 @@ function template_before()
echo ' echo '
return true; return true;
} }
function onSubmit() {document.getElementById("register_form").submit();}
// --></script> // --></script>
<form action="', str_replace('http://','http://',$scripturl), '?action=register2" method="post" name="creator" onsubmit="return defaultagree();"> <form id="register_form" action="', str_replace('http://','http://',$scripturl), '?action=register2" method="post" name="creator" onsubmit="return defaultagree();">
<table border="0" width="100%" cellpadding="3" cellspacing="0" class="tborder"> <table border="0" width="100%" cellpadding="3" cellspacing="0" class="tborder">
<tr class="titlebg"> <tr class="titlebg">
<td>', $txt[97], ' - ', $txt[517], '</td> <td>', $txt[97], ' - ', $txt[517], '</td>
@@ -75,17 +77,6 @@ function template_before()
<td> <td>
<input type="password" name="passwrd2" size="30" /> <input type="password" name="passwrd2" size="30" />
</td> </td>
<tr>
<!-- Begin CAPTCHA Mod 0.1 -->
<td width="40%">
<b>', $txt['captchaEnter'], ':</b>
</td>
<td>
', $context['captcha_image'], '
<!--<input type="password" name="passwrd2" size="30" />-->
</td>
<!-- End CAPTCHA Mod -->
</tr>
</tr> </tr>
</table> </table>
</td> </td>
@@ -110,7 +101,7 @@ function template_before()
echo ' echo '
<br /> <br />
<div align="center"> <div align="center">
<input type="submit" name="regSubmit" value="', $txt[97], '" /> <button class="g-recaptcha" data-sitekey="', $context['recaptcha_site_key'], '" data-callback="onSubmit">', $txt[97], '</button>
</div> </div>
</form>'; </form>';

View File

@@ -1 +1 @@
/var/www/img.rock.ru/forum/Themes/default/images ../../../../img.rock.ru/forum/Themes/default/images

View File

@@ -73,13 +73,14 @@ else
if (!$db_connection || !@mysql_select_db($db_name, $db_connection)) if (!$db_connection || !@mysql_select_db($db_name, $db_connection))
db_fatal_error(); db_fatal_error();
$mongodb = new MongoClient(); /*$mongodb = new MongoClient($mongo_server);*/
$memcached = new Memcached(); /*$memcached = new Memcached();*/
$memcached->addServer($memcached_host, $memcached_port); /*$memcached->addServer($memcached_host, $memcached_port);*/
// //
mysql_query("SET NAMES 'utf8'"); mysql_query("SET NAMES 'utf8'");
mysql_query("set SESSION sql_mode='STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'");
setlocale(LC_ALL,"ru_RU.UTF-8"); setlocale(LC_ALL,"ru_RU.UTF-8");
mb_internal_encoding("UTF-8"); mb_internal_encoding("UTF-8");
mb_regex_encoding("UTF-8"); mb_regex_encoding("UTF-8");

View File

@@ -59,7 +59,6 @@ if (isset($mobiquo_config['hide_forum_id']) && count($mobiquo_config['hide_forum
{ {
$user_info['query_see_board'] .= ' AND b.ID_BOARD NOT IN ('. implode(',', $mobiquo_config['hide_forum_id']) .') '; $user_info['query_see_board'] .= ' AND b.ID_BOARD NOT IN ('. implode(',', $mobiquo_config['hide_forum_id']) .') ';
} }
file_put_contents('/tmp/request', var_export($context['mod_request'], true));
// Allright, method passed...call it // Allright, method passed...call it
call_user_func('method_' . $context['mob_request']['method']); call_user_func('method_' . $context['mob_request']['method']);

1
forum/recaptcha Submodule

Submodule forum/recaptcha added at d3274db7c0

View File

@@ -104,6 +104,9 @@ require_once($sourcedir . '/Security.php');
if (@version_compare(PHP_VERSION, '4.2.3') != 1) if (@version_compare(PHP_VERSION, '4.2.3') != 1)
require_once($sourcedir . '/Subs-Compat.php'); require_once($sourcedir . '/Subs-Compat.php');
$memcached = new Memcached();
$memcached->addServer($memcached_host, $memcached_port);
// Connect to the MySQL database. // Connect to the MySQL database.
if (empty($db_persist)) if (empty($db_persist))
$db_connection = @mysql_connect($db_server, $db_user, $db_passwd); $db_connection = @mysql_connect($db_server, $db_user, $db_passwd);

View File

@@ -1,7 +1,7 @@
<? <?
# Yeah, that sucks, but it's pretty much all we need here # Yeah, that sucks, but it's pretty much all we need here
mysql_connect("localhost", "rock", "nla3YjQ0pL"); mysql_connect('mysql', 'root');
mysql_select_db("rock"); mysql_select_db('rock');
mysql_query("SET NAMES 'utf8';"); mysql_query("SET NAMES 'utf8';");
?> ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"