import legacy codebase
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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:
|
||||
if (!$resp->isSuccess())
|
||||
fatal_error($txt['captchaWrong']);
|
||||
case 3:
|
||||
fatal_error($txt['captchaMaxTries']);
|
||||
|
||||
}
|
||||
|
||||
//End CAPTCHA Mod
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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 '<tr class="titlebg"><td colspan="7">
|
||||
<div align="center">
|
||||
<script type="text/javascript"><!--
|
||||
google_ad_client = "pub-7163001599713810";
|
||||
google_ad_width = 728;
|
||||
google_ad_height = 15;
|
||||
google_ad_format = "728x15_0ads_al";
|
||||
//2006-11-21: forum_links_under_sticky_posts
|
||||
google_ad_channel = "1044131930";
|
||||
google_color_border = "384658";
|
||||
google_color_bg = "313131";
|
||||
google_color_link = "FFFFFF";
|
||||
google_color_text = "dddddd";
|
||||
google_color_url = "FFC246";
|
||||
//--></script>
|
||||
<script type="text/javascript"
|
||||
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
|
||||
</script>
|
||||
</div></td></tr>';
|
||||
else echo '<tr class="titlebg"><td colspan="7"> '/*, $txt['non_sticky_topics']*/, '</td></tr>';
|
||||
}
|
||||
# if ($first_topic['is_sticky'] && !$topic['is_sticky']) {
|
||||
# $first_topic['is_sticky'] = 0;
|
||||
# // Display separator
|
||||
# if($context['user']['is_guest']) {
|
||||
# echo '<tr class="titlebg"><td colspan="7">
|
||||
#<div align="center">
|
||||
#<script type="text/javascript"><!--
|
||||
#google_ad_client = "pub-7163001599713810";
|
||||
#google_ad_width = 728;
|
||||
#google_ad_height = 15;
|
||||
#google_ad_format = "728x15_0ads_al";
|
||||
#//2006-11-21: forum_links_under_sticky_posts
|
||||
#google_ad_channel = "1044131930";
|
||||
#google_color_border = "384658";
|
||||
#google_color_bg = "313131";
|
||||
#google_color_link = "FFFFFF";
|
||||
#google_color_text = "dddddd";
|
||||
#google_color_url = "FFC246";
|
||||
#//--></script>
|
||||
#<script type="text/javascript"
|
||||
# src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
|
||||
#</script>
|
||||
#</div></td></tr>';
|
||||
# } else {
|
||||
# echo '<tr class="titlebg"><td colspan="7"> '/*, $txt['non_sticky_topics']*/, '</td></tr>';
|
||||
# }
|
||||
# }
|
||||
|
||||
if ($first_topic['is_sticky'] && !$topic['is_sticky']) {
|
||||
$first_topic['is_sticky'] = 0;
|
||||
|
||||
@@ -9,6 +9,7 @@ function template_before()
|
||||
// Make sure they've agreed to the terms and conditions.
|
||||
echo '
|
||||
<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"><!--
|
||||
function agreesubmit(el)
|
||||
{
|
||||
@@ -30,8 +31,9 @@ function template_before()
|
||||
echo '
|
||||
return true;
|
||||
}
|
||||
function onSubmit() {document.getElementById("register_form").submit();}
|
||||
// --></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">
|
||||
<tr class="titlebg">
|
||||
<td>', $txt[97], ' - ', $txt[517], '</td>
|
||||
@@ -75,17 +77,6 @@ function template_before()
|
||||
<td>
|
||||
<input type="password" name="passwrd2" size="30" />
|
||||
</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>
|
||||
</table>
|
||||
</td>
|
||||
@@ -110,7 +101,7 @@ function template_before()
|
||||
echo '
|
||||
<br />
|
||||
<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>
|
||||
</form>';
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
/var/www/img.rock.ru/forum/Themes/default/images
|
||||
../../../../img.rock.ru/forum/Themes/default/images
|
||||
@@ -73,13 +73,14 @@ else
|
||||
if (!$db_connection || !@mysql_select_db($db_name, $db_connection))
|
||||
db_fatal_error();
|
||||
|
||||
$mongodb = new MongoClient();
|
||||
/*$mongodb = new MongoClient($mongo_server);*/
|
||||
|
||||
$memcached = new Memcached();
|
||||
$memcached->addServer($memcached_host, $memcached_port);
|
||||
/*$memcached = new Memcached();*/
|
||||
/*$memcached->addServer($memcached_host, $memcached_port);*/
|
||||
|
||||
//
|
||||
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");
|
||||
mb_internal_encoding("UTF-8");
|
||||
mb_regex_encoding("UTF-8");
|
||||
|
||||
@@ -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']) .') ';
|
||||
}
|
||||
file_put_contents('/tmp/request', var_export($context['mod_request'], true));
|
||||
// Allright, method passed...call it
|
||||
call_user_func('method_' . $context['mob_request']['method']);
|
||||
|
||||
|
||||
1
forum/recaptcha
Submodule
1
forum/recaptcha
Submodule
Submodule forum/recaptcha added at d3274db7c0
@@ -104,6 +104,9 @@ require_once($sourcedir . '/Security.php');
|
||||
if (@version_compare(PHP_VERSION, '4.2.3') != 1)
|
||||
require_once($sourcedir . '/Subs-Compat.php');
|
||||
|
||||
$memcached = new Memcached();
|
||||
$memcached->addServer($memcached_host, $memcached_port);
|
||||
|
||||
// Connect to the MySQL database.
|
||||
if (empty($db_persist))
|
||||
$db_connection = @mysql_connect($db_server, $db_user, $db_passwd);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?
|
||||
# Yeah, that sucks, but it's pretty much all we need here
|
||||
mysql_connect("localhost", "rock", "nla3YjQ0pL");
|
||||
mysql_select_db("rock");
|
||||
mysql_connect('mysql', 'root');
|
||||
mysql_select_db('rock');
|
||||
mysql_query("SET NAMES 'utf8';");
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
|
||||
Reference in New Issue
Block a user