forked from Bigjoos/U-232-V1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
reputation_settings.php
290 lines (218 loc) · 10.7 KB
/
reputation_settings.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
<?php
/**
* http://btdev.net:1337/svn/test/Installer09_Beta
* Licence Info: GPL
* Copyright (C) 2010 BTDev Installer v.1
* A bittorrent tracker source based on TBDev.net/tbsource/bytemonsoon.
* Project Leaders: Mindless,putyn.
**/
require_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'include'.DIRECTORY_SEPARATOR.'bittorrent.php');
require_once(INCL_DIR.'user_functions.php');
dbconn( false );
loggedinorreturn();
$lang = load_language('global');
/** new way **/
if (!min_class(UC_SYSOP)) // or just simply: if (!min_class(UC_STAFF))
header( "Location: {$TBDEV['baseurl']}/index.php");
$rep_set_cache = "cache/rep_settings_cache.php";
if ( 'POST' == $_SERVER['REQUEST_METHOD'] )
{
unset($_POST['submit']);
//print_r($_POST);
rep_cache();
exit;
}
/////////////////////////////
// cache rep function
/////////////////////////////
function rep_cache()
{
global $rep_set_cache;
$rep_out = "<"."?php\n\n\$GVARS = array(\n";
foreach( $_POST as $k => $v)
{
$rep_out .= ($k == 'rep_undefined') ? "\t'{$k}' => '".htmlentities($v, ENT_QUOTES)."',\n" : "\t'{$k}' => ".intval($v).",\n";
}
$rep_out .= "\t'g_rep_negative' => TRUE,\n";
$rep_out .= "\t'g_rep_seeown' => TRUE,\n";
$rep_out .= "\t'g_rep_use' => \$CURUSER['class'] > UC_USER ? TRUE : FALSE\n";
$rep_out .= "\n);\n\n?".">";
if( file_exists( $rep_set_cache ) && is_writable( pathinfo($rep_set_cache, PATHINFO_DIRNAME) ) )
{
$filenum = fopen ( $rep_set_cache, 'w' );
ftruncate( $filenum, 0 );
fwrite( $filenum, $rep_out );
fclose( $filenum );
//print '<pre>'.$rep_out.'</pre>';exit;
}
redirect('reputation_settings.php', 'Reputation Settings Have Been Updated!', 3);
}
function get_cache_array()
{
return array( 'rep_is_online' => 1,
'rep_adminpower' => 5,
'rep_minpost' => 50,
'rep_default' => 10,
'rep_userrates' => 5,
'rep_rdpower' => 365,
'rep_pcpower' => 1000,
'rep_kppower' => 100,
'rep_minrep' => 10,
'rep_minpost' => 50,
'rep_maxperday' => 10,
'rep_repeat' => 20,
'rep_undefined' => 'is off the scale',
/*'g_rep_negative' => TRUE,
'g_rep_seeown' => TRUE,
'g_rep_use' => $CURUSER['class'] > UC_USER ? TRUE : FALSE*/
);
}
if ( ! file_exists( $rep_set_cache ) )
{
$GVARS = get_cache_array();
}
else
{
require_once $rep_set_cache;
if( ! is_array($GVARS) || ( count($GVARS) < 15 ) )
{
$GVARS = get_cache_array();
}
}
$HTMLOUT = '<div>
<table width="100%" border="0" cellpadding="5" cellspacing="0">
<tr>
<td style="font-size: 12px; vertical-align: middle; font-weight: bold; color: rgb(0, 0, 0);" align="center">Reputation System Settings</td></tr>
<tr><td>This section allows you to configure the User Reputation system.</td>
</tr>
</table>
</div>
<br />
<div style="border: 1px solid rgb(131, 148, 178); padding: 5px;">
<form action="reputation_settings.php" name="repoptions" method="post">
<div>Reputation On/Off</div>
<div style="padding: 5px; background-color: rgb(238, 242, 247);">
<div style="border: 1px solid rgb(131, 148, 178);">
<table width="100%" border="0" cellpadding="5" cellspacing="0">
<tr>
<td width="30%"><b>Enable User Reputation system?</b><div style="color: gray;">Set this option to \'Yes\' if you want to enable the User Reputation system.</div></td>
<td width="55%"><div style="width: auto;" align="left"><#rep_is_online#></div></td>
</tr>
</table>
</div></div>
<div>Default Reputation Level</div>
<div style="padding: 5px; background-color: rgb(238, 242, 247);">
<div>
<table width="100%" border="0" cellpadding="5" cellspacing="0">
<tr>
<td width="30%"><b>Default Reputation</b><div style="color: gray;">What reputation level shall new users receive upon registration? Make sure that you have a reputation level that is at least equal to or less than this value.</div></td>
<td width="55%"><div style="width: auto;" align="left"><input name="rep_default" value="<#rep_default#>" size="30" type="text"></div></td>
</tr>
</table>
<table width="100%" border="0" cellpadding="5" cellspacing="0">
<tr>
<td width="30%"><b>Default Reputation Phrase</b><div style="color: gray;">If you have any user gain a reputation that exceeds your lowest negative level, then this phrase will be used for them. If you do not wish to use this phrase, make sure you set a negative reputation that is larger than the largest score (negative) that a user on your forum has.</div></td>
<td width="55%"><div style="width: auto;" align="left"><input name="rep_undefined" value="<#rep_undefined#>" size="30" type="text"></div></td>
</tr>
</table>
<table width="100%" border="0" cellpadding="5" cellspacing="0">
<tr>
<td width="30%"><b>Number of Reputation Ratings to Display</b><div style="color: gray;">Controls how many ratings to display in the user's profile (userdeatails).</div></td>
<td width="55%"><div style="width: auto;" align="left"><input name="rep_userrates" value="<#rep_userrates#>" size="30" type="text"></div></td>
</tr>
</table>
</div></div>
<div>Reputation Powers</div>
<div style="padding: 5px; background-color: rgb(238, 242, 247);">
<div style="border: 1px solid rgb(131, 148, 178);">
<table width="100%" border="0" cellpadding="5" cellspacing="0">
<tr>
<td width="30%"><b>Administrator's Reputation Power</b><div style="color: gray;">How many reputation points does an administrator give or take away with each click?<br />Set to 0 to have administrators follow the same rules as everyone else.</div></td>
<td class="tablerow2" width="55%"><div style="width: auto;" align="left"><input name="rep_adminpower" value="<#rep_adminpower#>" size="30" type="text"></div></td>
</tr>
</table>
<table width="100%" border="0" cellpadding="5" cellspacing="0">
<tr>
<td width="30%"><b>Register Date Factor</b><div style="color: gray;">For every X number of days, users gain 1 point of reputation-altering power.</div></td>
<td width="55%"><div style="width: auto;" align="left"><input name="rep_rdpower" value="<#rep_rdpower#>" size="30" type="text">
</div></td>
</tr>
</table>
<table width="100%" border="0" cellpadding="5" cellspacing="0">
<tr>
<td width="30%"><b>Post Count Factor</b><div style="color: gray;">For every X number of posts, users gain 1 point of reputation-altering power.</div></td>
<td width="55%"><div style="width: auto;" align="left"><input name="rep_pcpower" value="<#rep_pcpower#>" size="30" type="text"></div></td>
</tr>
</table>
<table width="100%" border="0" cellpadding="5" cellspacing="0">
<tr>
<td width="30%"><b>Reputation Point Factor</b><div style="color: gray;">For every X points of reputation, users gain 1 point of reputation-altering power.</div></td>
<td width="55%"><div style="width: auto;" align="left"><input name="rep_kppower" value="<#rep_kppower#>" size="30" type="text"></div></td>
</tr>
</table>
</div></div>
<div>User Reputation Settings</div>
<div style="padding: 5px; background-color: rgb(238, 242, 247);">
<div>
<table width="100%" border="0" cellpadding="5" cellspacing="0">
<tr>
<td width="30%"><b>Minimum Post Count</b><div style="color: gray;">How many posts must a user have before his reputation hits count on others?</div></td>
<td width="55%"><div style="width: auto;" align="left"><input name="rep_minpost" value="<#rep_minpost#>" size="30" type="text"></div></td>
</tr>
</table>
<table width="100%" border="0" cellpadding="5" cellspacing="0">
<tr>
<td width="30%"><b>Minimum Reputation Count</b><div style="color: gray;">How much reputation must a user have before his reputation hits count on others?</div></td>
<td width="55%"><div style="width: auto;" align="left"><input name="rep_minrep" value="<#rep_minrep#>" size="30" type="text"></div></td>
</tr>
</table>
<table width="100%" border="0" cellpadding="5" cellspacing="0">
<tr>
<td width="30%"><b>Daily Reputation Clicks Limit</b><div style="color: gray;">How many reputation clicks can a user give over each 24 hour period? Administrators are exempt from this limit.</div></td>
<td width="55%"><div style="width: auto;" align="left"><input name="rep_maxperday" value="<#rep_maxperday#>" size="30" type="text"></div></td>
</tr>
</table>
<table width="100%" border="0" cellpadding="5" cellspacing="0">
<tr>
<td width="30%"><b>Reputation User Spread</b><div style="color: gray;">How many different users must you give reputation to before you can hit the same person again? Administrators are exempt from this limit.</div></td>
<td width="55%"><div style="width: auto;" align="left"><input name="rep_repeat" value="<#rep_repeat#>" size="30" type="text"></div></td>
</tr>
</table>
</div></div>
<input type="submit" name="submit" value="Add Reply" class="btn" tabindex="2" accesskey="s" />
</form>
</div>';
$HTMLOUT = preg_replace_callback( "|<#(.*?)#>|", "template_out", $HTMLOUT);
echo stdhead("Reputation Settings") . $HTMLOUT . stdfoot();
function template_out($matches)
{
global $GVARS;
if ( $matches[1] == 'rep_is_online' )
{
return 'Yes <input name="rep_is_online" value="1" '.($GVARS['rep_is_online'] == 1 ? 'checked="checked"' : "").' type="radio"> <input name="rep_is_online" value="0" '.($GVARS['rep_is_online'] == 1 ? "" : 'checked="checked"').' type="radio"> No';
}
else
{
return $GVARS[ $matches[1] ];
}
}
function redirect($url, $text, $time=2)
{
global $TBDEV;
$page_title = "Admin Rep Redirection";
$page_detail = "<em>Redirecting...</em>";
$html = "<meta http-equiv='refresh' content=\"{$time}; url={$TBDEV['baseurl']}/{$url}\">
<div>
<div>Redirecting</div>
<div style='padding:8px'>
<div style='font-size:12px'>$text
<br />
<br />
<center><a href='{$TBDEV['baseurl']}/{$url}'>Click here if not redirected...</a></center>
</div>
</div>
</div>";
print $html;
exit;
}
?>