Empty commit

This commit is contained in:
Git 2012-08-31 08:00:22 +00:00
parent a66eae15d6
commit 14e7756f23
8 changed files with 68 additions and 17 deletions

View File

@ -58,13 +58,13 @@ function get_file_extension($file_name) {
function invalid_error($Name) { function invalid_error($Name) {
global $Err; global $Err;
$Err = 'The torrent contained one or more invalid files ('.$Name.')'; $Err = 'The torrent contained one or more invalid files ('.display_str($Name).')';
} }
function forbidden_error($Name) { function forbidden_error($Name) {
global $Err; global $Err;
$Err = 'The torrent contained one or more forbidden files ('.$Name.')'; $Err = 'The torrent contained one or more forbidden files ('.display_str($Name).')';
} }
function character_error() { function character_error() {

View File

@ -89,7 +89,7 @@ public function connect() {
public function error($Msg, $Halt = false) { public function error($Msg, $Halt = false) {
global $Debug; global $Debug;
$ErrorMsg = 'SphinxQL ('.$this->Ident.'): '.strval($Msg); $ErrorMsg = 'SphinxQL ('.$this->Ident.'): '.strval($Msg);
$Debug->analysis('!dev SphinxQL Error', $ErrorMsg, 3600*24); $Debug->analysis('SphinxQL Error', $ErrorMsg, 3600*24);
if($Halt === true && (DEBUG_MODE || check_perms('site_debug'))) { if($Halt === true && (DEBUG_MODE || check_perms('site_debug'))) {
echo '<pre>'.display_str($ErrorMsg).'</pre>'; echo '<pre>'.display_str($ErrorMsg).'</pre>';
die(); die();

View File

@ -31,7 +31,6 @@
</head> </head>
<body> <body>
<div id="head"> <div id="head">
<?=($SSL)?'<span>SSL</span>':''?>
</div> </div>
<table id="maincontent"> <table id="maincontent">
<tr> <tr>

View File

@ -50,4 +50,4 @@
} }
} }
} }
echo json_encode(array($FullName,$Suggestions,$Snatches,$ArtistIDs)); echo json_encode(array(display_str($FullName),$Suggestions,$Snatches,$ArtistIDs));

View File

@ -45,18 +45,19 @@
</tr> </tr>
<tr> <tr>
<td class="label">Private Message:</td> <td class="label">Private Message:</td>
<td/> <td>
<textarea id="message" style="width: 95%;" tabindex="1" onkeyup="resize('message');" name="privatemessage" cols="90" rows="4"></textarea> <textarea id="message" style="width: 95%;" tabindex="1" onkeyup="resize('message');" name="privatemessage" cols="90" rows="4"></textarea>
</td>
</tr> </tr>
<tr> <tr>
<td class="label">Edit Post:</td> <td class="label">Edit Post:</td>
<td> <td>
<textarea id="body" style="width: 95%;" tabindex="1" onkeyup="resize('body');" name="body" cols="90" rows="8"><?=$PostBody?></textarea> <textarea id="body" style="width: 95%;" tabindex="1" onkeyup="resize('body');" name="body" cols="90" rows="8"><?=$PostBody?></textarea>
<br /> <br />
<input type="submit" id="submit_button" value="Warn User" tabindex="1" /> <input type="submit" id="submit_button" value="Warn User" tabindex="1" />
</td> </td>
</tr> </tr>
</table> </table>
</form> </form>
</div> </div>
<? show_footer(); ?>

49
sections/log/sphinx.php Normal file
View File

@ -0,0 +1,49 @@
<?
require(SERVER_ROOT.'/classes/class_sphinxql.php');
if(!empty($_GET['page']) && is_number($_GET['page'])) {
$Page = min(SPHINX_MAX_MATCHES/LOG_ENTRIES_PER_PAGE, $_GET['page']);
$Offset = ($Page-1)*LOG_ENTRIES_PER_PAGE;
} else {
$Page = 1;
$Offset = 0;
}
if(empty($_GET['search']) || trim($_GET['search']) == '') {
$Log = $DB->query("SELECT ID, Message, Time FROM log ORDER BY ID DESC LIMIT $Offset, ".LOG_ENTRIES_PER_PAGE);
$NumResults = $DB->record_count();
if(!$NumResults) {
$TotalMatches = 0;
} elseif($NumResults == LOG_ENTRIES_PER_PAGE) {
// This is a lot faster than SQL_CALC_FOUND_ROWS
$SphQL = new SPHINXQL_QUERY();
$Result = $SphQL->select('id')->from('log, log_delta')->limit(0, 1, 1)->query();
$Debug->log_var($Result, '$Result');
$TotalMatches = min(SPHINX_MAX_MATCHES, $Result->get_meta('total_found'));
} else {
$TotalMatches = $NumResults + $Offset;
}
$QueryStatus = 0;
} else {
$Page = min(SPHINX_MAX_MATCHES/TORRENTS_PER_PAGE, $Page);
$SphQL = new SPHINXQL_QUERY();
$SphQL->select('id')
->from('log, log_delta')
->where_match($_GET['search'], 'message')
->order_by('time', 'DESC')
->limit($Offset, LOG_ENTRIES_PER_PAGE, $Offset+LOG_ENTRIES_PER_PAGE);
$Result = $SphQL->query();
$Debug->log_var($Result, '$Result');
$Debug->set_flag('Finished SphQL query');
if($QueryStatus = $Result->Errno) {
$QueryError = $Result->Error;
}
$NumResults = $Result->get_result_info('num_rows');
$TotalMatches = min(SPHINX_MAX_MATCHES, $Result->get_meta('total_found'));
if($NumResults > 0) {
$LogIDs = $Result->collect('id');
$Log = $DB->query("SELECT ID, Message, Time FROM log WHERE ID IN (".implode(',', $LogIDs).") ORDER BY ID DESC");
} else {
$Log = $DB->query("SET @nothing = 0");
}
}

View File

@ -244,10 +244,10 @@ function log_attempt($UserID) {
if(isset($_POST['keeplogged']) && $_POST['keeplogged']) { if(isset($_POST['keeplogged']) && $_POST['keeplogged']) {
$KeepLogged = 1; $KeepLogged = 1;
setcookie('session', $Cookie,time()+60*60*24*365,'/','',false); setcookie('session', $Cookie, time()+60*60*24*365, '/', '', $SSL, true);
} else { } else {
$KeepLogged = 0; $KeepLogged = 0;
setcookie('session', $Cookie,0,'/','',false); setcookie('session', $Cookie, 0, '/', '', $SSL, true);
} }
//TODO: another tracker might enable this for donors, I think it's too stupid to bother adding that //TODO: another tracker might enable this for donors, I think it's too stupid to bother adding that

View File

@ -43,24 +43,26 @@
<option value="1">1 week</option> <option value="1">1 week</option>
<option value="2">2 week</option> <option value="2">2 week</option>
<option value="4">4 week</option> <option value="4">4 week</option>
<? if(check_perms("users_mod")) { <? if(check_perms("users_mod")) { ?>
?>
<option value="8">8 week</option> <option value="8">8 week</option>
<? }?> <? } ?>
</select></td> </select></td>
</tr> </tr>
<tr> <tr>
<td class="label">Private Message:</td> <td class="label">Private Message:</td>
<td/> <td>
<textarea id="message" style="width: 95%;" tabindex="1" onkeyup="resize('message');" name="privatemessage" cols="90" rows="4"></textarea> <textarea id="message" style="width: 95%;" tabindex="1" onkeyup="resize('message');" name="privatemessage" cols="90" rows="4"></textarea>
</td>
</tr> </tr>
<tr> <tr>
<td class="label">Edit Post:</td> <td class="label">Edit Post:</td>
<td> <textarea id="body" style="width: 95%;" tabindex="1" onkeyup="resize('body');" name="body" cols="90" rows="8"><?=$PostBody?></textarea> <td>
<br /> <textarea id="body" style="width: 95%;" tabindex="1" onkeyup="resize('body');" name="body" cols="90" rows="8"><?=$PostBody?></textarea>
<input type="submit" id="submit_button" value="Warn User" tabindex="1" /> <br />
<input type="submit" id="submit_button" value="Warn User" tabindex="1" />
</td> </td>
</tr> </tr>
</table> </table>
</form> </form>
</div> </div>
<? show_footer(); ?>