From 14e7756f231b2517a4c2f5a28a80057dcc0a416e Mon Sep 17 00:00:00 2001 From: Git Date: Fri, 31 Aug 2012 08:00:22 +0000 Subject: [PATCH] Empty commit --- classes/class_file_checker.php | 4 +-- classes/class_sphinxql.php | 2 +- design/publicheader.php | 1 - sections/artist/autocomplete.php | 2 +- sections/forums/warn.php | 7 +++-- sections/log/sphinx.php | 49 ++++++++++++++++++++++++++++++++ sections/login/index.php | 4 +-- sections/torrents/warn.php | 16 ++++++----- 8 files changed, 68 insertions(+), 17 deletions(-) create mode 100644 sections/log/sphinx.php diff --git a/classes/class_file_checker.php b/classes/class_file_checker.php index adeb9793..a45a8091 100644 --- a/classes/class_file_checker.php +++ b/classes/class_file_checker.php @@ -58,13 +58,13 @@ function get_file_extension($file_name) { function invalid_error($Name) { 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) { 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() { diff --git a/classes/class_sphinxql.php b/classes/class_sphinxql.php index ea96cf91..cff0d530 100644 --- a/classes/class_sphinxql.php +++ b/classes/class_sphinxql.php @@ -89,7 +89,7 @@ public function connect() { public function error($Msg, $Halt = false) { global $Debug; $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'))) { echo '
'.display_str($ErrorMsg).'
'; die(); diff --git a/design/publicheader.php b/design/publicheader.php index 9bf84aac..5de6becf 100644 --- a/design/publicheader.php +++ b/design/publicheader.php @@ -31,7 +31,6 @@ diff --git a/sections/artist/autocomplete.php b/sections/artist/autocomplete.php index b42cbc29..b25a7bb7 100644 --- a/sections/artist/autocomplete.php +++ b/sections/artist/autocomplete.php @@ -50,4 +50,4 @@ } } } -echo json_encode(array($FullName,$Suggestions,$Snatches,$ArtistIDs)); +echo json_encode(array(display_str($FullName),$Suggestions,$Snatches,$ArtistIDs)); diff --git a/sections/forums/warn.php b/sections/forums/warn.php index bc161478..e23f3737 100644 --- a/sections/forums/warn.php +++ b/sections/forums/warn.php @@ -45,18 +45,19 @@ - -
Private Message: + +
Edit Post:
- +
+ diff --git a/sections/log/sphinx.php b/sections/log/sphinx.php new file mode 100644 index 00000000..9210c6d1 --- /dev/null +++ b/sections/log/sphinx.php @@ -0,0 +1,49 @@ +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"); + } +} diff --git a/sections/login/index.php b/sections/login/index.php index 7e8700c2..728d31f4 100644 --- a/sections/login/index.php +++ b/sections/login/index.php @@ -244,10 +244,10 @@ function log_attempt($UserID) { if(isset($_POST['keeplogged']) && $_POST['keeplogged']) { $KeepLogged = 1; - setcookie('session', $Cookie,time()+60*60*24*365,'/','',false); + setcookie('session', $Cookie, time()+60*60*24*365, '/', '', $SSL, true); } else { $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 diff --git a/sections/torrents/warn.php b/sections/torrents/warn.php index 64d7931f..0cf55b62 100644 --- a/sections/torrents/warn.php +++ b/sections/torrents/warn.php @@ -43,24 +43,26 @@ - + - + Private Message: - + + Edit Post: - -
- + + +
+ +