From f86bb1f066725f2d523516f0c2053dbba32d381b Mon Sep 17 00:00:00 2001 From: Git Date: Wed, 3 Jul 2013 08:01:01 +0000 Subject: [PATCH] Empty commit --- README.md | 1 + classes/script_start.php | 6 ++ classes/torrent_form.class.php | 10 +-- classes/users.class.php | 35 +++++++++ design/privateheader.php | 2 +- sections/artist/artist.php | 2 +- sections/collages/browse.php | 2 +- sections/requests/new_edit.php | 2 +- sections/requests/requests.php | 2 +- sections/tools/index.php | 105 +++++++++++++++++---------- sections/tools/misc/process_info.php | 41 +++++++++++ sections/tools/tools.php | 1 + sections/top10/torrents.php | 2 +- sections/torrents/details.php | 4 +- sections/user/edit.php | 10 +++ sections/user/takeedit.php | 1 + static/functions/autocomplete.js | 12 +-- static/functions/browse.js | 10 ++- static/functions/upload.js | 12 +-- static/styles/global.css | 11 +++ watchlist.php | 3 - 21 files changed, 203 insertions(+), 71 deletions(-) create mode 100644 README.md create mode 100644 sections/tools/misc/process_info.php delete mode 100644 watchlist.php diff --git a/README.md b/README.md new file mode 100644 index 00000000..080efce6 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +TODO fill me out diff --git a/classes/script_start.php b/classes/script_start.php index 66e1210a..3524da1a 100644 --- a/classes/script_start.php +++ b/classes/script_start.php @@ -482,6 +482,12 @@ function authorize($Ajax = false) { error(404); } +$Cache->cache_value('php_' . getmypid(), array( + 'start' => sqltime(), + 'document' => $Document, + 'query' => $_SERVER['QUERY_STRING'], + 'get' => $_GET, + 'post' => $_POST), 600); require(SERVER_ROOT.'/sections/'.$Document.'/index.php'); $Debug->set_flag('completed module execution'); diff --git a/classes/torrent_form.class.php b/classes/torrent_form.class.php index 9054670c..b5de0aa3 100644 --- a/classes/torrent_form.class.php +++ b/classes/torrent_form.class.php @@ -199,7 +199,7 @@ function music_form($GenreTags) { foreach ($Torrent['Artists'] as $Importance => $Artists) { foreach ($Artists as $Artist) { ?> - Disabled?> /> + Disabled?> /> Disabled?> /> + Disabled?> /> - Disabled?> /> + Disabled?> />
@@ -694,7 +694,7 @@ function audiobook_form() { Tags: - + /> @@ -736,7 +736,7 @@ function simple_form($CategoryID) { Tags: - + /> Image (optional): diff --git a/classes/users.class.php b/classes/users.class.php index 37a3df76..7ed83b99 100644 --- a/classes/users.class.php +++ b/classes/users.class.php @@ -620,4 +620,39 @@ public static function has_avatars_enabled() { global $HeavyInfo; return $HeavyInfo['DisableAvatars'] != 1; } + + /** + * Checks whether user has autocomplete enabled + * + * 0 - Enabled everywhere (default), 1 - Disabled, 2 - Searches only + * + * @param string $Type the type of the input. + * @param boolean $Output echo out html + * @return boolean + */ + public static function has_autocomplete_enabled($Type, $Output = true) { + global $LoggedUser; + $Enabled = false; + if (empty($LoggedUser['AutoComplete'])) { + $Enabled = true; + } + elseif ($LoggedUser['AutoComplete'] !== 1) { + switch($Type) { + case 'search': + if ($LoggedUser['AutoComplete'] == 2) { + $Enabled = true; + } + break; + case 'other': + if ($LoggedUser['AutoComplete'] != 2) { + $Enabled = true; + } + break; + } + } + if ($Enabled && $Output) { + echo 'data-gazelle-autocomplete="true"'; + } + return $Enabled; + } } diff --git a/design/privateheader.php b/design/privateheader.php index a17c392c..23b3dfbd 100644 --- a/design/privateheader.php +++ b/design/privateheader.php @@ -637,7 +637,7 @@ class="stat"
  • - accesskey="a" spellcheck="false" autocomplete="off" onfocus="if (this.value == 'Artists') this.value='';" diff --git a/sections/artist/artist.php b/sections/artist/artist.php index 40fbc543..cefc42d8 100644 --- a/sections/artist/artist.php +++ b/sections/artist/artist.php @@ -696,7 +696,7 @@ function compare($X, $Y) { - + />
  • diff --git a/sections/collages/browse.php b/sections/collages/browse.php index fcf7675c..cf481ea6 100644 --- a/sections/collages/browse.php +++ b/sections/collages/browse.php @@ -180,7 +180,7 @@ Tags (comma-separated): -   +   />   /> diff --git a/sections/requests/new_edit.php b/sections/requests/new_edit.php index d1277d68..e7762e98 100644 --- a/sections/requests/new_edit.php +++ b/sections/requests/new_edit.php @@ -260,7 +260,7 @@ - + />
    Tags should be comma-separated, and you should use a period (".") to separate words inside a tag — e.g. "hip.hop".

    diff --git a/sections/requests/requests.php b/sections/requests/requests.php index 2fc40b6a..eb94a1d1 100644 --- a/sections/requests/requests.php +++ b/sections/requests/requests.php @@ -389,7 +389,7 @@ Tags (comma-separated): -   + />  />   /> diff --git a/sections/tools/index.php b/sections/tools/index.php index 67b94148..f47d207d 100644 --- a/sections/tools/index.php +++ b/sections/tools/index.php @@ -132,10 +132,11 @@ error(403); } if (is_number($_POST['newsid'])) { - $DB->query("UPDATE news - SET Title='".db_string($_POST['title'])."', - Body='".db_string($_POST['body'])."' - WHERE ID='".db_string($_POST['newsid'])."'"); + $DB->query(" + UPDATE news + SET Title = '".db_string($_POST['title'])."', + Body = '".db_string($_POST['body'])."' + WHERE ID = '".db_string($_POST['newsid'])."'"); $Cache->delete_value('news'); $Cache->delete_value('feed_news'); } @@ -148,7 +149,9 @@ } if (is_number($_GET['id'])) { authorize(); - $DB->query("DELETE FROM news WHERE ID='".db_string($_GET['id'])."'"); + $DB->query(" + DELETE FROM news + WHERE ID = '".db_string($_GET['id'])."'"); $Cache->delete_value('news'); $Cache->delete_value('feed_news'); @@ -166,8 +169,9 @@ error(403); } - $DB->query("INSERT INTO news (UserID, Title, Body, Time) - VALUES ('$LoggedUser[ID]', '".db_string($_POST['title'])."', '".db_string($_POST['body'])."', '".sqltime()."')"); + $DB->query(" + INSERT INTO news (UserID, Title, Body, Time) + VALUES ('$LoggedUser[ID]', '".db_string($_POST['title'])."', '".db_string($_POST['body'])."', '".sqltime()."')"); @@ -202,18 +206,19 @@ } if (!empty($_REQUEST['id'])) { - $Val->SetFields('name',true,'string','You did not enter a valid name for this permission set.'); - $Val->SetFields('level',true,'number','You did not enter a valid level for this permission set.'); - $Val->SetFields('maxcollages',true,'number','You did not enter a valid number of personal collages.'); - //$Val->SetFields('test',true,'number','You did not enter a valid level for this permission set.'); + $Val->SetFields('name', true, 'string', 'You did not enter a valid name for this permission set.'); + $Val->SetFields('level', true, 'number', 'You did not enter a valid level for this permission set.'); + $Val->SetFields('maxcollages', true, 'number', 'You did not enter a valid number of personal collages.'); + //$Val->SetFields('test', true, 'number', 'You did not enter a valid level for this permission set.'); if (is_numeric($_REQUEST['id'])) { - $DB->query("SELECT p.ID, p.Name, p.Level, p.Secondary, p.PermittedForums, p.Values, p.DisplayStaff, COUNT(u.ID) - FROM permissions AS p - LEFT JOIN users_main AS u ON u.PermissionID=p.ID - WHERE p.ID='".db_string($_REQUEST['id'])."' - GROUP BY p.ID"); - list($ID,$Name,$Level,$Secondary,$Forums,$Values,$DisplayStaff,$UserCount)=$DB->next_record(MYSQLI_NUM, array(5)); + $DB->query(" + SELECT p.ID, p.Name, p.Level, p.Secondary, p.PermittedForums, p.Values, p.DisplayStaff, COUNT(u.ID) + FROM permissions AS p + LEFT JOIN users_main AS u ON u.PermissionID = p.ID + WHERE p.ID = '".db_string($_REQUEST['id'])."' + GROUP BY p.ID"); + list($ID, $Name, $Level, $Secondary, $Forums, $Values, $DisplayStaff, $UserCount) = $DB->next_record(MYSQLI_NUM, array(5)); if ($Level > $LoggedUser['EffectiveClass'] || $_REQUEST['level'] > $LoggedUser['EffectiveClass']) { error(403); @@ -225,7 +230,10 @@ $Err = $Val->ValidateForm($_POST); if (!is_numeric($_REQUEST['id'])) { - $DB->query("SELECT ID FROM permissions WHERE Level='".db_string($_REQUEST['level'])."'"); + $DB->query(" + SELECT ID + FROM permissions + WHERE Level = '".db_string($_REQUEST['level'])."'"); list($DupeCheck)=$DB->next_record(); if ($DupeCheck) { @@ -233,10 +241,10 @@ } } - $Values=array(); + $Values = array(); foreach ($_REQUEST as $Key => $Perms) { - if (substr($Key,0,5) == 'perm_') { - $Values[substr($Key,5)] = (int)$Perms; + if (substr($Key, 0, 5) == 'perm_') { + $Values[substr($Key, 5)] = (int)$Perms; } } @@ -250,7 +258,7 @@ if (!$Err) { if (!is_numeric($_REQUEST['id'])) { $DB->query(" - INSERT INTO permissions (Level,Name,Secondary,PermittedForums,`Values`,DisplayStaff) + INSERT INTO permissions (Level, Name, Secondary, PermittedForums, `Values`, DisplayStaff) VALUES ('".db_string($Level)."', '".db_string($Name)."', $Secondary, @@ -260,13 +268,13 @@ } else { $DB->query(" UPDATE permissions - SET Level='".db_string($Level)."', - Name='".db_string($Name)."', - Secondary=$Secondary, - PermittedForums='".db_string($Forums)."', - `Values`='".db_string(serialize($Values))."', - DisplayStaff='".db_string($DisplayStaff)."' - WHERE ID='".db_string($_REQUEST['id'])."'"); + SET Level = '".db_string($Level)."', + Name = '".db_string($Name)."', + Secondary = $Secondary, + PermittedForums = '".db_string($Forums)."', + `Values` = '".db_string(serialize($Values))."', + DisplayStaff = '".db_string($DisplayStaff)."' + WHERE ID = '".db_string($_REQUEST['id'])."'"); $Cache->delete_value('perm_'.$_REQUEST['id']); if ($Secondary) { $DB->query(" @@ -274,7 +282,7 @@ FROM users_levels WHERE PermissionID = ".db_string($_REQUEST['id'])); while ($UserID = $DB->next_record()) { - $Cache->delete_value('user_info_heavy_'.$UserID); + $Cache->delete_value("user_info_heavy_$UserID"); } } } @@ -288,19 +296,32 @@ } else { if (!empty($_REQUEST['removeid'])) { - $DB->query("DELETE FROM permissions WHERE ID='".db_string($_REQUEST['removeid'])."'"); - $DB->query("SELECT UserID FROM users_levels WHERE PermissionID='".db_string($_REQUEST['removeid'])."'"); + $DB->query(" + DELETE FROM permissions + WHERE ID = '".db_string($_REQUEST['removeid'])."'"); + $DB->query(" + SELECT UserID + FROM users_levels + WHERE PermissionID = '".db_string($_REQUEST['removeid'])."'"); while (list($UserID) = $DB->next_record()) { - $Cache->delete_value('user_info_'.$UserID); - $Cache->delete_value('user_info_heavy_'.$UserID); + $Cache->delete_value("user_info_$UserID"); + $Cache->delete_value("user_info_heavy_$UserID"); } - $DB->query("DELETE FROM users_levels WHERE PermissionID='".db_string($_REQUEST['removeid'])."'"); - $DB->query("SELECT ID FROM users_main WHERE PermissionID='".db_string($_REQUEST['removeid'])."'"); + $DB->query(" + DELETE FROM users_levels + WHERE PermissionID = '".db_string($_REQUEST['removeid'])."'"); + $DB->query(" + SELECT ID + FROM users_main + WHERE PermissionID = '".db_string($_REQUEST['removeid'])."'"); while (list($UserID) = $DB->next_record()) { - $Cache->delete_value('user_info_'.$UserID); - $Cache->delete_value('user_info_heavy_'.$UserID); + $Cache->delete_value("user_info_$UserID"); + $Cache->delete_value("user_info_heavy_$UserID"); } - $DB->query("UPDATE users_main SET PermissionID='".USER."' WHERE PermissionID='".db_string($_REQUEST['removeid'])."'"); + $DB->query(" + UPDATE users_main + SET PermissionID = '".USER."' + WHERE PermissionID = '".db_string($_REQUEST['removeid'])."'"); $Cache->delete_value('classes'); } @@ -311,7 +332,7 @@ break; case 'ip_ban': - //TODO: Clean up db table ip_bans. + //TODO: Clean up DB table ip_bans. include("managers/bans.php"); break; case 'quick_ban': @@ -397,6 +418,10 @@ include('misc/analysis.php'); break; + case 'process_info': + include('misc/process_info.php'); + break; + case 'rerender_gallery': include('misc/rerender_gallery.php'); break; diff --git a/sections/tools/misc/process_info.php b/sections/tools/misc/process_info.php new file mode 100644 index 00000000..82c1d009 --- /dev/null +++ b/sections/tools/misc/process_info.php @@ -0,0 +1,41 @@ +log_var($PIDList, 'PID list'); +$Debug->log_var($PIDs, 'PIDs'); +?> +
    + + + + + + + + +get_value("php_$PID")) { + continue; + } +?> + + + + + +
    + +
    + + +
    +
    +
    + Duplicate IP addresses + PHP processes Sandbox (1) Sandbox (2) Sandbox (3) diff --git a/sections/top10/torrents.php b/sections/top10/torrents.php index 5b75a1e4..91523bd0 100644 --- a/sections/top10/torrents.php +++ b/sections/top10/torrents.php @@ -68,7 +68,7 @@ Tags (comma-separated): -   + />  />   /> diff --git a/sections/torrents/details.php b/sections/torrents/details.php index f65b2bf1..393121c1 100644 --- a/sections/torrents/details.php +++ b/sections/torrents/details.php @@ -409,7 +409,7 @@ function compare($X, $Y) { - + /> - + />

    diff --git a/sections/user/edit.php b/sections/user/edit.php index 773499bd..6d7ba4c4 100644 --- a/sections/user/edit.php +++ b/sections/user/edit.php @@ -265,6 +265,16 @@ function checked($Checked) { + + Auto Complete + + + + Voting links diff --git a/sections/user/takeedit.php b/sections/user/takeedit.php index 89e960d0..811a069c 100644 --- a/sections/user/takeedit.php +++ b/sections/user/takeedit.php @@ -218,6 +218,7 @@ $Options['NoVoteLinks'] = (!empty($_POST['novotelinks']) ? 1 : 0); $Options['CoverArt'] = (int) !empty($_POST['coverart']); $Options['ShowExtraCovers'] = (int) !empty($_POST['show_extra_covers']); +$Options['AutoComplete'] = (int) $_POST['autocomplete']; if (isset($LoggedUser['DisableFreeTorrentTop10'])) { $Options['DisableFreeTorrentTop10'] = $LoggedUser['DisableFreeTorrentTop10']; diff --git a/static/functions/autocomplete.js b/static/functions/autocomplete.js index 2e810abc..d19affcc 100644 --- a/static/functions/autocomplete.js +++ b/static/functions/autocomplete.js @@ -1,10 +1,10 @@ var ARTIST_AUTOCOMPLETE_URL = 'artist.php?action=autocomplete'; var TAGS_AUTOCOMPLETE_URL = 'torrents.php?action=autocomplete_tags'; - +var SELECTOR = '[data-gazelle-autocomplete="true"]'; $(document).ready(function() { var url = new URL(); - $('#artistsearch').autocomplete({ + $('#artistsearch' + SELECTOR).autocomplete({ serviceUrl : ARTIST_AUTOCOMPLETE_URL, onSelect : function(suggestion) { window.location = 'artist.php?id=' + suggestion['data']; @@ -12,19 +12,19 @@ $(document).ready(function() { }); if (url.path == 'torrents' || url.path == 'upload' || url.path == 'artist') { - $("#artist").autocomplete({ + $("#artist" + SELECTOR).autocomplete({ serviceUrl : ARTIST_AUTOCOMPLETE_URL }); - $("#artistsimilar").autocomplete({ + $("#artistsimilar" + SELECTOR).autocomplete({ serviceUrl : ARTIST_AUTOCOMPLETE_URL }); } if (url.path == 'torrents' || url.path == 'upload' || url.path == 'collages' || url.path == 'requests' || url.path == 'top10' || (url.path == 'requests' && url.query['action'] == 'new')) { - $("#tags").autocomplete({ + $("#tags" + SELECTOR).autocomplete({ serviceUrl : TAGS_AUTOCOMPLETE_URL, delimiter: ',' }); - $("#tagname").autocomplete({ + $("#tagname" + SELECTOR).autocomplete({ serviceUrl : TAGS_AUTOCOMPLETE_URL, }); } diff --git a/static/functions/browse.js b/static/functions/browse.js index 37baadcc..2dfddf32 100644 --- a/static/functions/browse.js +++ b/static/functions/browse.js @@ -222,11 +222,13 @@ function AddArtistField() { Importance.name = "importance[]"; Importance.innerHTML = ''; x.appendChild(Importance); - $(ArtistField).live('focus', function() { - $(ArtistField).autocomplete({ - serviceUrl : 'artist.php?action=autocomplete' + if ($("#artist").data("gazelle-autocomplete")) { + $(ArtistField).live('focus', function() { + $(ArtistField).autocomplete({ + serviceUrl : 'artist.php?action=autocomplete' + }); }); - }); + } ArtistFieldCount++; } diff --git a/static/functions/upload.js b/static/functions/upload.js index aa017c47..b22cd629 100644 --- a/static/functions/upload.js +++ b/static/functions/upload.js @@ -234,12 +234,14 @@ function AddArtistField() { x.appendChild(ArtistField); x.appendChild(document.createTextNode('\n')); x.appendChild(ImportanceField); - - $(ArtistField).live('focus', function() { - $(ArtistField).autocomplete({ - serviceUrl : 'artist.php?action=autocomplete' + + if ($("#artist").data("gazelle-autocomplete")) { + $(ArtistField).live('focus', function() { + $(ArtistField).autocomplete({ + serviceUrl : 'artist.php?action=autocomplete' + }); }); - }); + } ArtistCount++; } diff --git a/static/styles/global.css b/static/styles/global.css index 5f4bee32..833ae274 100644 --- a/static/styles/global.css +++ b/static/styles/global.css @@ -520,3 +520,14 @@ tr.torrent .bookmark>a:after { font-weight: normal; color: #3399FF; } + +.process_info { + table-layout: fixed; + width: 100%; +} +.process_info_pid { + width: 70px; +} +.process_info_data { + overflow: auto; +} diff --git a/watchlist.php b/watchlist.php deleted file mode 100644 index 42ab904c..00000000 --- a/watchlist.php +++ /dev/null @@ -1,3 +0,0 @@ - \ No newline at end of file