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 @@ + +/** + * This class determines the thumbnail equivalent of an image's url after being passed the original + * +**/ + + +function to_thumbnail($url) { + $thumb = $url; + $extension = pathinfo($url, PATHINFO_EXTENSION); + if(contains('whatimg', $url)) { + if($extension == 'jpeg' || $extension == 'jpg') { + $thumb = replace_extension($url, '_thumb.jpg'); + } + if($extension == 'png') { + $thumb = replace_extension($url, '_thumb.png'); + } + if($extension == 'gif') { + $thumb = replace_extension($url, '_thumb.gif'); + } + } + elseif(contains('imgur', $url)) { + if($extension == 'jpeg') { + $thumb = replace_extension($url, 'm.jpeg'); + } + if($extension == 'jpg') { + $thumb = replace_extension($url, 'm.jpg'); + } + if($extension == 'png') { + $thumb = replace_extension($url, 'm.png'); + } + if($extension == 'gif') { + $thumb = replace_extension($url, 'm.gif'); + } + } + return $thumb; +} + + +function replace_extension($string, $extension) { + $string = preg_replace('/\.[^.]*$/', '', $string); + $string = $string . $extension; + return $string; +} + +function contains($substring, $string) { + $pos = strpos($string, $substring); + if($pos === false) { + return false; + } + else { + return true; + } + +} +?> 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 @@ +include(SERVER_ROOT.'/classes/class_image_tools.php'); set_time_limit(0); + //~~~~~~~~~~~ Main bookmarks page ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// function compare($X, $Y){ diff --git a/sections/collages/collage.php b/sections/collages/collage.php index 757233f1..267886c4 100644 --- a/sections/collages/collage.php +++ b/sections/collages/collage.php @@ -7,6 +7,8 @@ function compare($X, $Y){ include(SERVER_ROOT.'/sections/bookmarks/functions.php'); // has_bookmarked() include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class +include(SERVER_ROOT.'/classes/class_image_tools.php'); + $Text = new TEXT; $CollageID = $_GET['id']; diff --git a/sections/login/index.php b/sections/login/index.php index 1727bc42..7935b05d 100644 --- a/sections/login/index.php +++ b/sections/login/index.php @@ -43,7 +43,7 @@ if ($UserID && strtotime($Expires)>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'); ?> + +