diff --git a/classes/class_file_checker.php b/classes/class_file_checker.php new file mode 100644 index 00000000..886b6697 --- /dev/null +++ b/classes/class_file_checker.php @@ -0,0 +1,86 @@ + diff --git a/classes/class_image_tools.php b/classes/class_image_tools.php new file mode 100644 index 00000000..95dc27c2 --- /dev/null +++ b/classes/class_image_tools.php @@ -0,0 +1,56 @@ + diff --git a/classes/script_start.php b/classes/script_start.php index 1ed14090..d8eba3c7 100644 --- a/classes/script_start.php +++ b/classes/script_start.php @@ -1669,14 +1669,12 @@ function create_thread($ForumID, $AuthorID, $Title, $PostBody) { 'ID' => $TopicID, 'Title' => $Title, 'AuthorID' => $AuthorID, - 'AuthorUsername' => $AuthorName, 'IsLocked' => $IsLocked, 'IsSticky' => $IsSticky, 'NumPosts' => $NumPosts, 'LastPostID' => $PostID, 'LastPostTime' => sqltime(), 'LastPostAuthorID' => $AuthorID, - 'LastPostUsername' => $AuthorName ) ); //Bumped thread $Part3 = array_slice($Forum,$Stickies,TOPICS_PER_PAGE,true); //Rest of page @@ -1697,9 +1695,9 @@ function create_thread($ForumID, $AuthorID, $Title, $PostBody) { $Cache->begin_transaction('forums_list'); $UpdateArray = array( 'NumPosts'=>'+1', + 'NumTopics'=>'+1', 'LastPostID'=>$PostID, 'LastPostAuthorID'=>$AuthorID, - 'Username'=>$AuthorName, 'LastPostTopicID'=>$TopicID, 'LastPostTime'=>sqltime(), 'Title'=>$Title, diff --git a/sections/artist/artist.php b/sections/artist/artist.php index db0345e1..6fc77c29 100644 --- a/sections/artist/artist.php +++ b/sections/artist/artist.php @@ -16,6 +16,8 @@ function compare($X, $Y){ include(SERVER_ROOT.'/classes/class_artist.php'); include(SERVER_ROOT.'/classes/class_artists_similar.php'); +include(SERVER_ROOT.'/classes/class_image_tools.php'); + $ArtistID = $_GET['id']; if(!is_number($ArtistID)) { error(0); } diff --git a/sections/bookmarks/torrents.php b/sections/bookmarks/torrents.php index 25edb470..21adab51 100644 --- a/sections/bookmarks/torrents.php +++ b/sections/bookmarks/torrents.php @@ -1,5 +1,7 @@ time()) { // If the user has requested a password change, and his key has not expired - $Validate->SetFields('password','1','string','You entered an invalid password.',array('maxlength'=>'40','minlength'=>'6')); + $Validate->SetFields('password','1','string','You entered an invalid password.',array('minlength'=>'8','maxlength'=>'150')); $Validate->SetFields('verifypassword','1','compare','Your passwords did not match.',array('comparefield'=>'password')); if (!empty($_REQUEST['password'])) { @@ -164,7 +164,7 @@ // Normal login else { $Validate->SetFields('username',true,'regex','You did not enter a valid username.',array('regex'=>'/^[a-z0-9_?]{1,20}$/i')); - $Validate->SetFields('password','1','string','You entered an invalid password.',array('maxlength'=>'40','minlength'=>'6')); + $Validate->SetFields('password','1','string','You entered an invalid password.',array('minlength'=>'6','maxlength'=>'150')); $DB->query("SELECT ID, Attempts, Bans, BannedUntil FROM login_attempts WHERE IP='".db_string($_SERVER['REMOTE_ADDR'])."'"); list($AttemptID,$Attempts,$Bans,$BannedUntil)=$DB->next_record(); diff --git a/sections/login/recover_step2.php b/sections/login/recover_step2.php index 155f1877..c6f8dc6d 100644 --- a/sections/login/recover_step2.php +++ b/sections/login/recover_step2.php @@ -2,9 +2,11 @@ show_header('Recover Password','validate'); echo $Validate->GenerateJS('recoverform'); ?> + +
-
+
Reset your password - Final Step



Please choose a password between 8 and 40 characters long

- +
- - + + - + diff --git a/sections/register/index.php b/sections/register/index.php index a5474a91..ae80ec1e 100644 --- a/sections/register/index.php +++ b/sections/register/index.php @@ -25,7 +25,7 @@ } elseif(OPEN_REGISTRATION || !empty($_REQUEST['invite'])) { $Val->SetFields('username',true,'regex', 'You did not enter a valid username.',array('regex'=>'/^[a-z0-9_?]{1,20}$/iD')); $Val->SetFields('email',true,'email', 'You did not enter a valid email address.'); - $Val->SetFields('password',true,'string', 'You did not enter a valid password (6 - 40 characters).',array('minlength'=>6,'maxlength'=>40)); + $Val->SetFields('password',true,'string', 'You did not enter a valid password, must be at least 8 characters long.',array('minlength'=>8,'maxlength'=>150)); $Val->SetFields('confirm_password',true,'compare', 'Your passwords do not match.',array('comparefield'=>'password')); $Val->SetFields('readrules',true,'checkbox', 'You did not check the box that says you will read the rules.'); $Val->SetFields('readwiki',true,'checkbox', 'You did not check the box that says you will read the wiki.'); diff --git a/sections/tools/managers/login_watch.php b/sections/tools/managers/login_watch.php index 25f11d0c..adcf47c6 100644 --- a/sections/tools/managers/login_watch.php +++ b/sections/tools/managers/login_watch.php @@ -6,6 +6,8 @@ $DB->query('DELETE FROM login_attempts WHERE ID='.$_POST['id']); } +show_header('Login Watch'); + $DB->query('SELECT l.ID, l.IP, @@ -17,9 +19,6 @@ FROM login_attempts AS l WHERE l.BannedUntil > "'.sqltime().'" ORDER BY l.BannedUntil ASC'); - - -show_header('Login Watch'); ?>

Login Watch Management

diff --git a/sections/torrents/details.php b/sections/torrents/details.php index 0971c310..a41fa829 100644 --- a/sections/torrents/details.php +++ b/sections/torrents/details.php @@ -8,6 +8,8 @@ function compare($X, $Y){ include(SERVER_ROOT.'/sections/bookmarks/functions.php'); // has_bookmarked() include(SERVER_ROOT.'/classes/class_text.php'); +include(SERVER_ROOT.'/classes/class_image_tools.php'); + $Text = NEW TEXT; $GroupID=ceil($_GET['id']); diff --git a/sections/upload/upload_handle.php b/sections/upload/upload_handle.php index dcedc552..c1b7dcd5 100644 --- a/sections/upload/upload_handle.php +++ b/sections/upload/upload_handle.php @@ -15,6 +15,8 @@ include(SERVER_ROOT.'/classes/class_text.php'); include(SERVER_ROOT.'/sections/torrents/functions.php'); +include(SERVER_ROOT.'/classes/class_file_checker.php'); + enforce_login(); authorize(); @@ -372,22 +374,9 @@ $HasCue = "'1'"; } - // Forbidden files - if($Type == 'Music' && preg_match('/\.(mov|avi|mpg|exe|zip|rar|mkv|bat|iso|dat|torrent|!ut|nzb|wav)$/i', $Name)) { - $Err = 'The torrent contained one or more invalid files ('.$Name.').'; - } - if($Type == 'Music' && preg_match('/demonoid.*\.txt$/i', $Name)) { - $Err = 'The torrent contained one or more forbidden files ('.$Name.').'; - } - if(preg_match('/INCOMPLETE~\*/i', $Name)) { - $Err = 'The torrent contained one or more forbidden files ('.$Name.').'; - } - if(preg_match('/\?/i', $Name)) { - $Err = 'The torrent contains one or more files with a ?, which is a forbidden character. Please rename the files as necessary and recreate the .torrent file.'; - } - if(preg_match('/\:/i', $Name)) { - $Err = 'The torrent contains one or more files with a :, which is a forbidden character. Please rename the files as necessary and recreate the .torrent file.'; - } + check_file($Type, $Name); + + // Make sure the filename is not too long if(mb_strlen($Name, 'UTF-8') + mb_strlen($DirName, 'UTF-8') + 1 > MAX_FILENAME_LENGTH) { $Err = 'The torrent contained one or more files with too long a name ('.$Name.')'; diff --git a/sections/user/takeedit.php b/sections/user/takeedit.php index edb478d5..aac519db 100644 --- a/sections/user/takeedit.php +++ b/sections/user/takeedit.php @@ -31,8 +31,8 @@ $Val->SetFields('avatar',0,"regex","You did not enter a valid avatar url.",array('regex'=>"/^".IMAGE_REGEX."$/i")); $Val->SetFields('email',1,"email","You did not enter a valid email address."); $Val->SetFields('irckey',0,"string","You did not enter a valid IRCKey, must be between 6 and 32 characters long.",array('minlength'=>6,'maxlength'=>32)); -$Val->SetFields('cur_pass',0,"string","You did not enter a valid password, must be between 6 and 40 characters long.",array('minlength'=>6,'maxlength'=>40)); -$Val->SetFields('new_pass_1',0,"string","You did not enter a valid password, must be between 6 and 40 characters long.",array('minlength'=>6,'maxlength'=>40)); +$Val->SetFields('cur_pass',0,"string","You did not enter a valid password, must be at least 6 characters long.",array('minlength'=>6,'maxlength'=>150)); +$Val->SetFields('new_pass_1',0,"string","You did not enter a valid password, must be at least 8 characters long.",array('minlength'=>8,'maxlength'=>150)); $Val->SetFields('new_pass_2',1,"compare","Your passwords do not match.",array('comparefield'=>'new_pass_1')); if (check_perms('site_advanced_search')) { $Val->SetFields('searchtype',1,"number","You forgot to select your default search preference.",array('minlength'=>0,'maxlength'=>1)); diff --git a/sections/user/user.php b/sections/user/user.php index 8a7d5203..9917ce1c 100644 --- a/sections/user/user.php +++ b/sections/user/user.php @@ -4,6 +4,7 @@ $Text = new TEXT; include(SERVER_ROOT.'/sections/requests/functions.php'); +include(SERVER_ROOT.'/classes/class_image_tools.php'); if (empty($_GET['id']) || !is_numeric($_GET['id'])) { error(0); } $UserID = $_GET['id']; diff --git a/sections/wiki/search.php b/sections/wiki/search.php index f1d68bfd..5244d4f4 100644 --- a/sections/wiki/search.php +++ b/sections/wiki/search.php @@ -49,9 +49,9 @@ $RS = $DB->query($SQL); $DB->query("SELECT FOUND_ROWS()"); list($NumResults) = $DB->next_record(); -$DB->set_query_id($RS); show_header('Search articles'); +$DB->set_query_id($RS); ?>

Search articles

diff --git a/static/functions/global.js b/static/functions/global.js index 9d4e67f6..18f7bf9a 100644 --- a/static/functions/global.js +++ b/static/functions/global.js @@ -10,6 +10,11 @@ function toggleChecks(formElem,masterElem) { //Lightbox stuff var lightbox = { init: function (image, size) { + if(typeof(image)=='string') { + var src = image; + image = new Image(); + image.src = src; + } if (image.naturalWidth === undefined) { var tmp = document.createElement('img'); tmp.style.visibility = 'hidden'; @@ -18,11 +23,15 @@ var lightbox = { delete tmp; } if (image.naturalWidth > size) { - lightbox.box(image); + lightbox.box(image); } }, box: function (image) { - if(image.parentNode.tagName.toUpperCase() != 'A') { + var hasA = false; + if(image.parentNode != null && image.parentNode.tagName.toUpperCase() == 'A') { + hasA = true; + } + if(!hasA) { $('#lightbox').show().listen('click',lightbox.unbox).raw().innerHTML = ''; $('#curtain').show().listen('click',lightbox.unbox); } diff --git a/static/functions/password_validate.js b/static/functions/password_validate.js index 5127572c..07d6ad06 100644 --- a/static/functions/password_validate.js +++ b/static/functions/password_validate.js @@ -93,7 +93,7 @@ function calculateComplexity(password) { username = $(".username").text(); } else { - username = $("#username").val(); + username = $("#username").val() || ''; } var irckey;
Password Password 
Confirm Password