Empty commit

This commit is contained in:
Git 2012-09-19 08:00:35 +00:00
parent 1f6020cd8a
commit a28f3d6df7
23 changed files with 104 additions and 489 deletions

View File

@ -347,7 +347,7 @@ function show() {
<div id="remaster_true"<? if(!$IsRemaster) { echo ' class="hidden"';}?>>
<? if(check_perms('edit_unknowns') || $LoggedUser['ID'] == $Torrent['UserID']) { ?>
<br />
<input type="checkbox" id="unknown" name="unknown"<? if($UnknownRelease) { echo " checked='checked' ";}?> onclick="<?if($this->NewTorrent) {?> CheckYear();<? } ?>ToggleUnknown();"/> Unknown Release
<input type="checkbox" id="unknown" name="unknown"<? if($UnknownRelease) { echo " checked='checked'";}?> onclick="<?if($this->NewTorrent) {?> CheckYear();<? } ?>ToggleUnknown();" /> Unknown Release
<? } ?>
<br /><br />
<? if(!empty($GroupRemasters)) { ?>
@ -376,7 +376,7 @@ function show() {
<input type="text" id="remaster_year" name="remaster_year" size="5" value="<? if($Torrent['RemasterYear']) { echo display_str($Torrent['RemasterYear']);} ?>"<? if($UnknownRelease) { echo " disabled";}?> /> <br />
<strong>Title:</strong>
<input type="text" id="remaster_title" name="remaster_title" size="50" value="<?=display_str($Torrent['RemasterTitle']) ?>"<? if($UnknownRelease) { echo " disabled";}?> />
<p class="min_padding">Title of the release, eg. <i>'Deluxe Edition' or 'Remastered'</i>.</p>
<p class="min_padding">Title of the release (e.g. <span style="font-style: italic;">'Deluxe Edition' or 'Remastered'</span>).</p>
<strong>Record Label:</strong>
<input type="text" id="remaster_record_label" name="remaster_record_label" size="50" value="<?=display_str($Torrent['RemasterRecordLabel']) ?>"<? if($UnknownRelease) { echo " disabled";}?> />
<p class="min_padding">This is for the record label of the <strong>release</strong> (It may differ from the original).</p>
@ -412,7 +412,7 @@ function show() {
</td>
</tr>
<tr>
<td class="label">Bit Rate</td>
<td class="label">Bitrate</td>
<td>
<select id="bitrate" name="bitrate" onchange="Bitrate()">
<option value="">---</option>

View File

@ -45,7 +45,7 @@
<link href="<?=STATIC_SERVER?>styles/global.css?v=<?=filemtime(SERVER_ROOT.'/static/styles/global.css')?>" rel="stylesheet" type="text/css" />
<? if ($Mobile) { ?>
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0, user-scalable=no;"/>
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0, user-scalable=no;" />
<link href="<?=STATIC_SERVER ?>styles/mobile/style.css" rel="stylesheet" type="text/css" />
<? } else { ?>
<? if (empty($LoggedUser['StyleURL'])) { ?>

View File

@ -12,7 +12,7 @@
<link rel="shortcut icon" href="favicon.ico" />
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
<? if ($Mobile) { ?>
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0, user-scalable=no;"/>
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0, user-scalable=no;" />
<link href="<?=STATIC_SERVER ?>styles/mobile/style.css?v=<?=filemtime(SERVER_ROOT.'/static/mobile/style.css')?>" rel="stylesheet" type="text/css" />
<? } else { ?>
<link href="<?=STATIC_SERVER ?>styles/public/style.css?v=<?=filemtime(SERVER_ROOT.'/static/styles/public/style.css')?>" rel="stylesheet" type="text/css" />

View File

@ -1,28 +1,38 @@
<?php
if(empty($_GET['id']) || !is_number($_GET['id']) || empty($_GET['limit']) || !is_number($_GET['limit'])) {
print
json_encode(
array(
'status' => 'failure'
)
);
die();
}
$artist_id = $_GET["id"];
$artist_limit = $_GET["limit"];
$DB->query("
SELECT
s2.ArtistID,
ag.Name,
ass.Score
FROM artists_similar AS s1
JOIN artists_similar AS s2 ON s1.SimilarID=s2.SimilarID AND s1.ArtistID!=s2.ArtistID
JOIN artists_similar_scores AS ass ON ass.SimilarID=s1.SimilarID
JOIN artists_group AS ag ON ag.ArtistID=s2.ArtistID
WHERE s1.ArtistID=".$artist_id."
ORDER BY ass.Score DESC
LIMIT $artist_limit");
SELECT
s2.ArtistID,
ag.Name,
ass.Score
FROM artists_similar AS s1
JOIN artists_similar AS s2 ON s1.SimilarID=s2.SimilarID AND s1.ArtistID!=s2.ArtistID
JOIN artists_similar_scores AS ass ON ass.SimilarID=s1.SimilarID
JOIN artists_group AS ag ON ag.ArtistID=s2.ArtistID
WHERE s1.ArtistID=".$artist_id."
ORDER BY ass.Score DESC
LIMIT $artist_limit");
while(list($ArtistID, $Name, $Score) = $DB->next_record(MYSQLI_NUM, false)){
if($Score<0){
continue;
}
if($Score<0){
continue;
}
$results[] = array('id' => (int) $ArtistID, 'name' => $Name, 'score' => (int) $Score);
}
}
print json_encode($results);
exit();

View File

@ -528,18 +528,18 @@ function compare($X, $Y){
<? } ?>
<div class="box box_search">
<div class="head"><strong>Search File Lists</strong></div>
<ul class="nobullet">
<li>
<form cass="search_form" name="filelists" action="torrents.php">
<input type="hidden" name="artistname" value="<?=$Name?>" />
<input type="hidden" name="action" value="advanced" />
<input type="text" autocomplete="off" id="filelist" name="filelist" size="20" />
<input type="submit" value=">"/>
</form>
</li>
</ul>
</div>
<div class="head"><strong>Search File Lists</strong></div>
<ul class="nobullet">
<li>
<form cass="search_form" name="filelists" action="torrents.php">
<input type="hidden" name="artistname" value="<?=$Name?>" />
<input type="hidden" name="action" value="advanced" />
<input type="text" autocomplete="off" id="filelist" name="filelist" size="20" />
<input type="submit" value=">" />
</form>
</li>
</ul>
</div>
<?
if(check_perms('zip_downloader')){

View File

@ -143,7 +143,7 @@ function RemoveAnswerField() {
<input id="subscribeboxpreview" type="checkbox" name="subscribe"<?=!empty($HeavyInfo['AutoSubscribe'])?' checked="checked"':''?> />
<label for="subscribebox">Subscribe to topic</label>
</div>
<input type="button" value="Preview" onclick="Newthread_Preview(1);" id="newthreadpreviewbutton"/>
<input type="button" value="Preview" onclick="Newthread_Preview(1);" id="newthreadpreviewbutton" />
<input type="button" value="Editor" onclick="Newthread_Preview(0);" id="newthreadeditbutton" class="hidden" />
<input type="submit" id="submit_button" value="Create thread" />
</form>

View File

@ -69,9 +69,9 @@
?>
<span class="error">Please select an option.</span><br />
<form class="vote_form" name="poll" id="poll">
<input type="hidden" name="action" value="poll"/>
<input type="hidden" name="action" value="poll" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="large" value="<?=display_str($_POST['large'])?>"/>
<input type="hidden" name="large" value="<?=display_str($_POST['large'])?>" />
<input type="hidden" name="topicid" value="<?=$TopicID?>" />
<? for ($i = 1, $il = count($Answers); $i <= $il; $i++) { ?>
<input type="radio" name="vote" id="answer_<?=$i?>" value="<?=$i?>" />

View File

@ -19,10 +19,10 @@
</div>
<div class="thin box pad">
<form class="send_form" name="warning" action="" onsubmit="quickpostform.submit_button.disabled=true;" method="post">
<input type="hidden" name="postid" value="<?=$PostID?>"/>
<input type="hidden" name="userid" value="<?=$UserID?>"/>
<input type="hidden" name="key" value="<?=$Key?>"/>
<input type="hidden" name="action" value="take_warn"/>
<input type="hidden" name="postid" value="<?=$PostID?>" />
<input type="hidden" name="userid" value="<?=$UserID?>" />
<input type="hidden" name="key" value="<?=$Key?>" />
<input type="hidden" name="action" value="take_warn" />
<table class="layout" align="center">
<tr>
<td class="label">Reason:</td>
@ -36,10 +36,10 @@
<select name="length">
<option value="verbal">Verbal</option>
<option value="1">1 week</option>
<option value="2">2 week</option>
<option value="4">4 week</option>
<option value="2">2 weeks</option>
<option value="4">4 weeks</option>
<? if(check_perms("users_mod")) { ?>
<option value="8">8 week</option>
<option value="8">8 weeks</option>
<? } ?>
</select></td>
</tr>

View File

@ -30,7 +30,7 @@
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<div id="quickpost">
<h3>Subject</h3>
<input type="text" name="subject" size="95" value="<?=(!empty($Subject) ? $Subject : '')?>"/><br />
<input type="text" name="subject" size="95" value="<?=(!empty($Subject) ? $Subject : '')?>" /><br />
<h3>Body</h3>
<textarea id="body" name="body" cols="95" rows="10"><?=(!empty($Body) ? $Body : '')?></textarea>
</div>

View File

@ -309,8 +309,8 @@
<? } else { ?>
<div id="poll_container">
<form class="vote_form" name="poll" id="poll" action="">
<input type="hidden" name="action" value="poll"/>
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>"/>
<input type="hidden" name="action" value="poll" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="topicid" value="<?=$TopicID?>" />
<? for ($i = 1, $il = count($Answers); $i <= $il; $i++) { ?>
<input type="radio" name="vote" id="answer_<?=$i?>" value="<?=$i?>" />

View File

@ -17,18 +17,18 @@
<table class="layout" cellpadding="2" cellspacing="1" border="0" align="center" width="100%">
<tr valign="top">
<td align="right" style="width:100px;">Password&nbsp;</td>
<td align="left"><input type="password" name="password" id="new_pass_1" class="inputtext" /> <b id="pass_strength"/></td>
<td align="left"><input type="password" name="password" id="new_pass_1" class="inputtext" /> <b id="pass_strength" /></td>
</tr>
<tr valign="top">
<td align="right">Confirm Password&nbsp;</td>
<td align="left"><input type="password" name="verifypassword" id="new_pass_2" class="inputtext" /> <b id="pass_match"/></td>
<td align="left"><input type="password" name="verifypassword" id="new_pass_2" class="inputtext" /> <b id="pass_match" /></td>
</tr>
<tr>
<td colspan="2" align="right"><input type="submit" name="reset" value="Reset!" class="submit" /></td>
</tr>
</table>
<? } else { ?>
Your password has been succesfully reset.<br />
Your password has been successfully reset.<br />
Please <a href="login.php">click here</a> to log in using your new password.
<? } ?>
</div>

View File

@ -31,11 +31,11 @@
</tr>
<tr valign="top">
<td align="right">Password&nbsp;</td>
<td align="left"><input type="password" name="password" id="new_pass_1" class="inputtext" /> <b id="pass_strength"/> </td>
<td align="left"><input type="password" name="password" id="new_pass_1" class="inputtext" /> <b id="pass_strength" /> </td>
</tr>
<tr valign="top">
<td align="right">Verify Password&nbsp;</td>
<td align="left"><input type="password" name="confirm_password" id="new_pass_2" class="inputtext" /> <b id="pass_match"/>
<td align="left"><input type="password" name="confirm_password" id="new_pass_2" class="inputtext" /> <b id="pass_match" />
<p>A strong password is 8 characters or longer, contains at least 1 lowercase and uppercase letter, and contains at least a number or a symbol.</p>
</td>

View File

@ -29,7 +29,7 @@ function Taste(torrent_id, report_id, taste) {
</div>
<div class="buttonbox thin center">
<input type="button" onclick="AddMore();" value="Add More" /><input type="text" name="repop_amount" id="repop_amount" size="2" value="10" />
| <span title="Changes whether to automatically replace resolved ones with new ones"><input type="checkbox" checked="checked" id="dynamic"/> <label for="dynamic">Dynamic</label></span>
| <span title="Changes whether to automatically replace resolved ones with new ones"><input type="checkbox" checked="checked" id="dynamic" /> <label for="dynamic">Dynamic</label></span>
| <span title="Resolves *all* checked reports with their respective resolutions"><input type="button" onclick="MultiResolve();" value="Multi-Resolve" /></span>
| <span title="Un-In Progress all the reports currently displayed"><input type="button" onclick="GiveBack();" value="Give back all" /></span>
</div>

View File

@ -281,8 +281,7 @@
<? foreach ($Formats as $Key => $Val) {
if($Key % 8 == 0) echo "<br />";?>
<input type="checkbox" name="formats[]" value="<?=$Key?>" onchange="ToggleLogCue(); if(!this.checked) { $('#toggle_formats').raw().checked = false; }" id="format_<?=$Key?>"
<?=(!empty($FormatArray) && in_array($Key, $FormatArray) ? ' checked="checked" ' : '')?>
/><label for="format_<?=$Key?>"> <?=$Val?></label>
<?=(!empty($FormatArray) && in_array($Key, $FormatArray) ? ' checked="checked"' : '')?> /><label for="format_<?=$Key?>"> <?=$Val?></label>
<? }?>
</td>
</tr>
@ -294,7 +293,7 @@
if($Key % 8 == 0) echo "<br />";?>
<input type="checkbox" name="bitrates[]" value="<?=$Key?>" id="bitrate_<?=$Key?>"
<?=(!empty($BitrateArray) && in_array($Key, $BitrateArray) ? ' checked="checked" ' : '')?>
onchange="if(!this.checked) { $('#toggle_bitrates').raw().checked = false; }"/><label for="bitrate_<?=$Key?>"> <?=$Val?></label>
onchange="if(!this.checked) { $('#toggle_bitrates').raw().checked = false; }" /><label for="bitrate_<?=$Key?>"> <?=$Val?></label>
<? }?>
</td>
</tr>
@ -306,7 +305,7 @@
if($Key % 8 == 0) echo "<br />";?>
<input type="checkbox" name="media[]" value="<?=$Key?>" id="media_<?=$Key?>"
<?=(!empty($MediaArray) && in_array($Key, $MediaArray) ? ' checked="checked" ' : '')?>
onchange="if(!this.checked) { $('#toggle_media').raw().checked = false; }"/><label for="media_<?=$Key?>"> <?=$Val?></label>
onchange="if(!this.checked) { $('#toggle_media').raw().checked = false; }" /><label for="media_<?=$Key?>"> <?=$Val?></label>
<? }?>
</td>
</tr>
@ -314,7 +313,7 @@
<td class="label">Log / Cue (FLAC only)</td>
<td>
<input type="checkbox" id="needlog" name="needlog" onchange="ToggleLogScore()" <?=(!empty($NeedLog) ? 'checked="checked" ' : '')?>/><label for="needlog"> Require Log</label>
<span id="minlogscore_span" class="hidden">&nbsp;<input type="text" name="minlogscore" id="minlogscore" size="4" value="<?=(!empty($MinLogScore) ? $MinLogScore : '')?>"/> Minimum Log Score</span>
<span id="minlogscore_span" class="hidden">&nbsp;<input type="text" name="minlogscore" id="minlogscore" size="4" value="<?=(!empty($MinLogScore) ? $MinLogScore : '')?>" /> Minimum Log Score</span>
<br />
<input type="checkbox" id="needcue" name="needcue" <?=(!empty($NeedCue) ? 'checked="checked" ' : '')?>/><label for="needcue"> Require Cue</label>
<br />
@ -331,7 +330,7 @@
<tr>
<td class="label">Torrent Group</td>
<td>
https://what.cd/torrents.php?id=<input type="text" name="groupid" value="<?=$GroupID?>" size="15"><br />
https://what.cd/torrents.php?id=<input type="text" name="groupid" value="<?=$GroupID?>" size="15" /><br />
If this request matches a torrent group <span style="font-weight: bold;">already existing</span> on the site, please indicate that here.
</td>
</tr>
@ -358,7 +357,7 @@
<option value='mb'<?=(!empty($_POST['unit']) && $_POST['unit'] == 'mb' ? ' selected="selected"' : '') ?>>MB</option>
<option value='gb'<?=(!empty($_POST['unit']) && $_POST['unit'] == 'gb' ? ' selected="selected"' : '') ?>>GB</option>
</select>
<input type="button" value="Preview" onclick="Calculate();"/>
<input type="button" value="Preview" onclick="Calculate();" />
<strong><?=($RequestTax * 100)?>% of this is deducted as tax by the system.</strong>
</td>
</tr>

View File

@ -389,7 +389,7 @@
<option value='mb'>MB</option>
<option value='gb'>GB</option>
</select>
<input type="button" value="Preview" onclick="Calculate();"/>
<input type="button" value="Preview" onclick="Calculate();" />
<strong><?=($RequestTax * 100)?>% of this is deducted as tax by the system.</strong>
</td>
</tr>
@ -402,7 +402,7 @@
<input type="hidden" id="request_tax" value="<?=$RequestTax?>" />
<input type="hidden" id="requestid" name="id" value="<?=$RequestID?>" />
<input type="hidden" id="auth" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" id="amount" name="amount" value="0">
<input type="hidden" id="amount" name="amount" value="0" />
<input type="hidden" id="current_uploaded" value="<?=$LoggedUser['BytesUploaded']?>" />
<input type="hidden" id="current_downloaded" value="<?=$LoggedUser['BytesDownloaded']?>" />
<input type="hidden" id="current_rr" value="<?=(float)$LoggedUser['RequiredRatio']?>" />
@ -410,7 +410,7 @@
If you add the entered <strong><span id="new_bounty">0.00 MB</span></strong> of bounty, your new stats will be: <br/>
Uploaded: <span id="new_uploaded"><?=get_size($LoggedUser['BytesUploaded'])?></span>
Ratio: <span id="new_ratio"><?=ratio($LoggedUser['BytesUploaded'],$LoggedUser['BytesDownloaded'])?></span>
<input type="button" id="button" value="Vote!" disabled="disabled" onclick="Vote();"/>
<input type="button" id="button" value="Vote!" disabled="disabled" onclick="Vote();" />
</form>
</td>
</tr>

View File

@ -20,16 +20,16 @@
<form class="manage_form" name="common_snatches" method="post">
<input type="hidden" name="compare" value="1" />
<td>
<input type="text" name="userida"/>
<input type="text" name="userida" />
</td>
<td>
<input type="text" name="useridb"/>
<input type="text" name="useridb" />
</td>
<td>
<input type="text" name="limit" value="50"/>
<input type="text" name="limit" value="50" />
</td>
<td>
<input type="submit" value="Compare"/>
<input type="submit" value="Compare" />
</td>
</form>
</tr>

View File

@ -40,7 +40,7 @@
<? }?>
<h3>Title</h3>
<input type="text" name="title" size="95" <? if(!empty($Title)) { echo 'value="'.display_str($Title).'"'; } ?> />
<!-- Why did someone add this? <input type="datetime" name="datetime" value="<?=sqltime()?>"/> -->
<!-- Why did someone add this? <input type="datetime" name="datetime" value="<?=sqltime()?>" /> -->
<br />
<h3>Body</h3>
<textarea name="body" cols="95" rows="15"><? if(!empty($Body)) { echo display_str($Body); } ?></textarea> <br /><br />

View File

@ -45,13 +45,13 @@
<form class="add_form" name="aliases" action="" method="post">
<input type="hidden" name="newalias" value="1" />
<td>
<input type="text" name="aliastag"/>
<input type="text" name="aliastag" />
</td>
<td>
<input type="text" name="badtag"/>
<input type="text" name="badtag" />
</td>
<td>
<input type="submit" value="Add Alias"/>
<input type="submit" value="Add Alias" />
</td>
</form>
</tr>
@ -64,14 +64,14 @@
<input type="hidden" name="changealias" value="1" />
<input type="hidden" name="aliasid" value="<?=$ID?>" />
<td>
<input type="text" name="aliastag" value="<?=$AliasTag?>"/>
<input type="text" name="aliastag" value="<?=$AliasTag?>" />
</td>
<td>
<input type="text" name="badtag" value="<?=$BadTag?>"/>
<input type="text" name="badtag" value="<?=$BadTag?>" />
</td>
<td>
<input type="submit" name="save" value="Save Alias"/>
<input type="submit" name="delete" value="Delete Alias"/>
<input type="submit" name="save" value="Save Alias" />
<input type="submit" name="delete" value="Delete Alias" />
</td>
</form>
</tr>

View File

@ -23,16 +23,16 @@
</div>
<div class="thin box pad">
<form class="create_form" name="warning" action="" onsubmit="quickpostform.submit_button.disabled=true;" method="post">
<input type="hidden" name="groupid" value="<?=$GroupID?>"/>
<input type="hidden" name="postid" value="<?=$PostID?>"/>
<input type="hidden" name="userid" value="<?=$UserID?>"/>
<input type="hidden" name="key" value="<?=$Key?>"/>
<input type="hidden" name="action" value="take_warn"/>
<input type="hidden" name="groupid" value="<?=$GroupID?>" />
<input type="hidden" name="postid" value="<?=$PostID?>" />
<input type="hidden" name="userid" value="<?=$UserID?>" />
<input type="hidden" name="key" value="<?=$Key?>" />
<input type="hidden" name="action" value="take_warn" />
<table class="layout" align="center">
<tr>
<td class="label">Reason:</td>
<td>
<input type="text" name="reason" size="30" />
<input type="text" name="reason" size="30" />
</td>
</tr>
<tr>
@ -41,10 +41,10 @@
<select name="length">
<option value="verbal">Verbal</option>
<option value="1">1 week</option>
<option value="2">2 week</option>
<option value="4">4 week</option>
<option value="2">2 weeks</option>
<option value="4">4 weeks</option>
<? if(check_perms("users_mod")) { ?>
<option value="8">8 week</option>
<option value="8">8 weeks</option>
<? } ?>
</select></td>
</tr>

View File

@ -441,11 +441,11 @@ function checked($Checked) {
</tr>
<tr>
<td class="label"><strong>New password</strong></td>
<td><input type="password" size="40" name="new_pass_1" id="new_pass_1" value="" maxlength="40" /> <b id="pass_strength"/></td>
<td><input type="password" size="40" name="new_pass_1" id="new_pass_1" value="" maxlength="40" /> <b id="pass_strength" /></td>
</tr>
<tr>
<td class="label"><strong>Re-type new password</strong></td>
<td><input type="password" size="40" name="new_pass_2" id="new_pass_2" value="" maxlength="40" /> <b id="pass_match"/></td>
<td><input type="password" size="40" name="new_pass_2" id="new_pass_2" value="" maxlength="40" /> <b id="pass_match" /></td>
</tr>
<tr>
<td colspan="2" class="right">

View File

@ -1,395 +0,0 @@
<?
/**********************************************************************
*>>>>>>>>>>>>>>>>>>>>>>>>>>> User search <<<<<<<<<<<<<<<<<<<<<<<<<<<<*
* Best viewed with a wide screen monitor *
**********************************************************************/
if (!empty($_GET['search'])) {
if (preg_match("/^".IP_REGEX."$/", $_GET['search'])) {
$_GET['ip'] = $_GET['search'];
} elseif (preg_match("/^".EMAIL_REGEX."$/i", $_GET['search'])) {
$_GET['email'] = $_GET['search'];
} elseif (preg_match('/^[a-z0-9_?]{1,20}$/iD',$_GET['search'])) {
$DB->query("SELECT ID FROM users_main WHERE Username='".db_string($_GET['search'])."'");
if (list($ID) = $DB->next_record()) {
header('Location: user.php?id='.$ID);
die();
}
$_GET['username'] = $_GET['search'];
} else {
$_GET['comment'] = $_GET['search'];
}
}
define('USERS_PER_PAGE', 30);
if(!check_perms("tc_advanced_user_search")) { error(403); }
function wrap($String, $ForceMatch = '', $IPSearch = false){
if(!$ForceMatch){
global $Match;
} else {
$Match = $ForceMatch;
}
if($Match == ' REGEXP '){
if(strpos($String, '\'') !== false || preg_match('/^.*\\\\$/i', $String)){
error('Regex contains illegal characters.');
}
} else {
$String = db_string($String);
}
if($Match == ' LIKE '){
// Fuzzy search
// Stick in wildcards at beginning and end of string unless string starts or ends with |
if (($String[0] != '|') && !$IPSearch) {
$String = '%'.$String;
} elseif ($String[0] == '|') {
$String = substr($String, 1, strlen($String));
}
if(substr($String, -1, 1) != '|'){
$String = $String.'%';
} else {
$String = substr($String, 0, -1);
}
}
$String="'$String'";
return $String;
}
function date_compare($Field, $Operand, $Date1, $Date2 = ''){
$Date1 = db_string($Date1);
$Date2 = db_string($Date2);
$Return = array();
switch($Operand){
case 'on':
$Return []= " $Field>='$Date1 00:00:00' ";
$Return []= " $Field<='$Date1 23:59:59' ";
break;
case 'before':
$Return []= " $Field<'$Date1 00:00:00' ";
break;
case 'after':
$Return []= " $Field>'$Date1 23:59:59' ";
break;
case 'between':
$Return []= " $Field>='$Date1 00:00:00' ";
$Return []= " $Field<='$Date2 00:00:00' ";
break;
}
return $Return;
}
function num_compare($Field, $Operand, $Num1, $Num2 = ''){
if($Num1!=0){
$Num1 = db_string($Num1);
}
if($Num2!=0){
$Num2 = db_string($Num2);
}
$Return = array();
switch($Operand){
case 'equal':
$Return []= " $Field='$Num1' ";
break;
case 'above':
$Return []= " $Field>'$Num1' ";
break;
case 'below':
$Return []= " $Field<'$Num1' ";
break;
case 'between':
$Return []= " $Field>'$Num1' ";
$Return []= " $Field<'$Num2' ";
break;
default:
print_r($Return);
die();
}
return $Return;
}
// Arrays, regexes, and all that fun stuff we can use for validation, form generation, etc
$DateChoices = array('inarray'=>array('on', 'before', 'after', 'between'));
$SingleDateChoices = array('inarray'=>array('on', 'before', 'after'));
$NumberChoices = array('inarray'=>array('equal', 'above', 'below', 'between', 'buffer'));
$YesNo = array('inarray'=>array('any', 'yes', 'no'));
$OrderVals = array('inarray'=>array('Username', 'Ratio', 'IP', 'Email', 'Joined', 'Last Seen', 'Uploaded', 'Downloaded', 'Invites', 'Snatches'));
$WayVals = array('inarray'=>array('Ascending', 'Descending'));
if(count($_GET)){
$DateRegex = array('regex'=>'/\d{4}-\d{2}-\d{2}/');
$ClassIDs = array();
$SecClassIDs = array();
foreach ($Classes as $ClassID => $Value) {
if ($Value['Secondary']) {
$SecClassIDs[]=$ClassID;
} else {
$ClassIDs[]=$ClassID;
}
}
$Val->SetFields('comment','0','string','Comment is too long.', array('maxlength'=>512));
$Val->SetFields('disabled_invites', '0', 'inarray', 'Invalid disabled_invites field', $YesNo);
$Val->SetFields('joined', '0', 'inarray', 'Invalid joined field', $DateChoices);
$Val->SetFields('join1', '0', 'regex', 'Invalid join1 field', $DateRegex);
$Val->SetFields('join2', '0', 'regex', 'Invalid join2 field', $DateRegex);
$Val->SetFields('lastactive', '0', 'inarray', 'Invalid lastactive field', $DateChoices);
$Val->SetFields('lastactive1', '0', 'regex', 'Invalid lastactive1 field', $DateRegex);
$Val->SetFields('lastactive2', '0', 'regex', 'Invalid lastactive2 field', $DateRegex);
$Val->SetFields('ratio', '0', 'inarray', 'Invalid ratio field', $NumberChoices);
$Val->SetFields('uploaded', '0', 'inarray', 'Invalid uploaded field', $NumberChoices);
$Val->SetFields('downloaded', '0', 'inarray', 'Invalid downloaded field', $NumberChoices);
//$Val->SetFields('snatched', '0', 'inarray', 'Invalid snatched field', $NumberChoices);
$Val->SetFields('matchtype', '0', 'inarray', 'Invalid matchtype field', array('inarray'=>array('strict', 'fuzzy', 'regex')));
$Val->SetFields('enabled', '0', 'inarray', 'Invalid enabled field', array('inarray'=>array('', 0, 1, 2)));
$Val->SetFields('class', '0', 'inarray', 'Invalid class', array('inarray'=>$ClassIDs));
$Val->SetFields('secclass', '0', 'inarray', 'Invalid class', array('inarray'=>$SecClassIDs));
$Val->SetFields('donor', '0', 'inarray', 'Invalid donor field', $YesNo);
$Val->SetFields('warned', '0', 'inarray', 'Invalid warned field', $YesNo);
$Val->SetFields('disabled_uploads', '0', 'inarray', 'Invalid disabled_uploads field', $YesNo);
$Val->SetFields('order', '0', 'inarray', 'Invalid ordering', $OrderVals);
$Val->SetFields('way', '0', 'inarray', 'Invalid way', $WayVals);
$Val->SetFields('passkey', '0', 'string', 'Invalid passkey', array('maxlength'=>32));
$Val->SetFields('avatar', '0', 'string', 'Avatar URL too long', array('maxlength'=>512));
$Val->SetFields('stylesheet', '0', 'inarray', 'Invalid stylesheet', array_unique(array_keys($Stylesheets)));
$Val->SetFields('cc', '0', 'inarray', 'Invalid Country Code', array('maxlength'=>2));
$Err = $Val->ValidateForm($_GET);
if(!$Err){
// Passed validation. Let's rock.
$RunQuery = false; // if we should run the search
if(isset($_GET['matchtype']) && $_GET['matchtype'] == 'strict'){
$Match = ' = ';
} elseif(isset($_GET['matchtype']) && $_GET['matchtype'] == 'regex') {
$Match = ' REGEXP ';
} else {
$Match = ' LIKE ';
}
$OrderTable = array('Username'=>'um1.Username', 'Joined'=>'ui1.JoinDate', 'Email'=>'um1.Email', 'IP'=>'um1.IP', 'Last Seen'=>'um1.LastAccess');
$WayTable = array('Ascending'=>'ASC', 'Descending'=>'DESC');
$Where = array();
$Having = array();
$Join = array();
$Group = array();
$Distinct = '';
$Order = '';
$SQL = 'SQL_CALC_FOUND_ROWS
um1.ID,
um1.Username,
um1.Email,
um1.IP,
ui1.JoinDate,
um1.LastAccess
FROM users_main AS um1 JOIN users_info AS ui1 ON ui1.UserID=um1.ID ';
if(!empty($_GET['username'])){
$Where[]='um1.Username'.$Match.wrap($_GET['username']);
}
if(!empty($_GET['email'])){
if(isset($_GET['email_history'])){
$Distinct = 'DISTINCT ';
$Join['he']=' JOIN users_history_emails AS he ON he.UserID=um1.ID ';
$Where[]= ' he.Email '.$Match.wrap($_GET['email']);
$Where[] = " he.Email NOT LIKE '%what.cd'";
} else {
$Where[]='um1.Email'.$Match.wrap($_GET['email']);
}
}
$Where[] = " um1.Email NOT LIKE '%what.cd'";
if (!empty($_GET['email_cnt'])) {
$Query = "SELECT UserID FROM users_history_emails GROUP BY UserID HAVING COUNT(DISTINCT Email) ";
if ($_GET['emails_opt'] === 'equal') {
$operator = '=';
}
if ($_GET['emails_opt'] === 'above') {
$operator = '>';
}
if ($_GET['emails_opt'] === 'below') {
$operator = '<';
}
$Query .= $operator." ".$_GET['email_cnt'];
$DB->query($Query);
$Users = implode(',', $DB->collect('UserID'));
if (!empty($Users)) {
$Where[] = "um1.ID IN (".$Users.")";
}
}
if(!empty($_GET['ip'])){
if(isset($_GET['ip_history'])){
$Distinct = 'DISTINCT ';
$Join['hi']=' JOIN users_history_ips AS hi ON hi.UserID=um1.ID ';
$Where[]= ' hi.IP '.$Match.wrap($_GET['ip'], '', true);
$Where[] = " hi.IP <> '127.0.0.1'";
$Where[] = " hi.IP <> '0.0.0.0'";
} else {
$Where[]='um1.IP'.$Match.wrap($_GET['ip'], '', true);
}
}
//Search for only user to torrent master classes.
$Where[] = " um1.IP <> '127.0.0.1'";
$Where[] = " um1.IP <> '0.0.0.0'";
$Where[]=" um1.PermissionID BETWEEN 2 AND 5 OR um1.PermissionID = 7";
if($OrderTable[$_GET['order']] && $WayTable[$_GET['way']]){
$Order = ' ORDER BY '.$OrderTable[$_GET['order']].' '.$WayTable[$_GET['way']].' ';
}
//---------- Finish generating the search string
$SQL = 'SELECT '.$Distinct.$SQL;
$SQL .= implode(' ', $Join);
if(count($Where)){
$SQL .= ' WHERE '.implode(' AND ', $Where);
}
if(count($Having)){
$SQL .= ' HAVING '.implode(' AND ', $Having);
}
$SQL .= $Order;
if(count($Where)>0 || count($Join)>0 || count($Having)>0){
$RunQuery = true;
}
list($Page,$Limit) = page_limit(USERS_PER_PAGE);
$SQL.=" LIMIT $Limit";
} else { error($Err); }
}
show_header('User search');
?>
<div class="thin">
<form action="user.php" method="get">
<input type="hidden" name="action" value="search" />
<table class="layout">
<tr>
<td class="label nobr">Username:</td>
<td width="24%">
<input type="text" name="username" size="20" value="<?=display_str($_GET['username'])?>" />
</td>
</tr>
<tr>
<td class="label nobr">Email:</td>
<td>
<input type="text" name="email" size="20" value="<?=display_str($_GET['email'])?>" />
</td>
</tr>
<tr>
<td class="label nobr">IP:</td>
<td>
<input type="text" name="ip" size="20" value="<?=display_str($_GET['ip'])?>" />
</td>
<tr>
<td class="label nobr">Extra:</td>
<td>
<input type="checkbox" name="ip_history" id="ip_history"<? if($_GET['ip_history']){ echo ' checked="checked"'; }?> />
<label for="ip_history">IP History</label>
<input type="checkbox" name="email_history" id="email_history"<? if($_GET['email_history']){ echo ' checked="checked"'; }?> />
<label for="email_history">Email History</label>
</td>
</tr>
<tr>
<td class="label nobr">Type</td>
<td>
Strict <input type="radio" name="matchtype" value="strict"<? if($_GET['matchtype'] == 'strict' || !$_GET['matchtype']){ echo ' checked="checked"'; } ?> /> |
Fuzzy <input type="radio" name="matchtype" value="fuzzy"<? if($_GET['matchtype'] == 'fuzzy' || !$_GET['matchtype']){ echo ' checked="checked"'; } ?> /> |
Regex <input type="radio" name="matchtype" value="regex"<? if($_GET['matchtype'] == 'regex'){ echo ' checked="checked"'; } ?> />
</td>
<td class="label nobr">Order:</td>
<td class="nobr">
<select name="order">
<?
foreach(array_shift($OrderVals) as $Cur){ ?>
<option value="<?=$Cur?>"<? if(isset($_GET['order']) && $_GET['order'] == $Cur || (!isset($_GET['order']) && $Cur == 'Joined')) { echo ' selected="selected"'; } ?>><?=$Cur?></option>
<? }?>
</select>
<select name="way">
<? foreach(array_shift($WayVals) as $Cur){ ?>
<option value="<?=$Cur?>"<? if(isset($_GET['way']) && $_GET['way'] == $Cur || (!isset($_GET['way']) && $Cur == 'Descending')) { echo ' selected="selected"'; } ?>><?=$Cur?></option>
<? }?>
</select>
</td>
</tr>
<tr>
<td colspan="6" class="center">
<input type="submit" value="Search users" />
</td>
</tr>
</table>
</form>
</div>
<?
if($RunQuery){
$Results = $DB->query($SQL);
$DB->query('SELECT FOUND_ROWS();');
list($NumResults) = $DB->next_record();
$DB->set_query_id($Results);
}
$Pages=get_pages($Page,$NumResults,USERS_PER_PAGE,11);
if ($Pages) { ?>
<div class="linkbox pager"><?=$Pages?></div>
<? } ?>
<div class="box pad center">
<table width="100%">
<tr class="colhead">
<td>Username</td>
<td>IP</td>
<td>Email</td>
<td>Joined</td>
<td>Last Seen</td>
</tr>
<?
while(list($UserID, $Username, $Email, $IP, $JoinDate, $LastAccess) = $DB->next_record()){ ?>
<tr>
<td><?=format_username($UserID, true, true, true, true)?></td>
<td><?=display_str($IP)?> (<?=get_cc($IP)?>)</td>
<td><?=display_str($Email)?></td>
<td><?=time_diff($JoinDate)?></td>
<td><?=time_diff($LastAccess)?></td>
</tr>
<?
}
?>
</table>
<? if ($Pages) { ?>
<div class="linkbox pager"><?=$Pages?></div>
<? } ?>
</div>
<?
show_footer();
?>

View File

@ -144,8 +144,9 @@ function UnBan(ip, id, elemID) {
<tr><td>
<form class="search_form" name="ip_log" method="post" action="">
<input type="text" name="ip"/>
<input type="submit" value="Search"/>
<input type="text" name="ip" />
<input type="submit" value="Search" />
</form>
</td></tr>
</table>

View File

@ -69,7 +69,7 @@
/>
<input value="Search" type="submit" class="hidden" />
</form>
<br style="line-height:10px;"/>
<br style="line-height:10px;" />
<strong><a href="wiki.php?action=browse">Browse articles</a></strong>
</div>
<div class="box box_info pad">