"A", "\xC3\x81" => "A", "\xC3\x82" => "A", "\xC3\x83" => "A",
"\xC3\x84" => "A", "\xC3\x85" => "A", "\xC3\x86" => "AE", "\xC3\x87" => "C",
"\xC3\x88" => "E", "\xC3\x89" => "E", "\xC3\x8A" => "E", "\xC3\x8B" => "E",
"\xC3\x8C" => "I", "\xC3\x8D" => "I", "\xC3\x8E" => "I", "\xC3\x8F" => "I",
"\xC3\x90" => "D", "\xC3\x91" => "N", "\xC3\x92" => "O", "\xC3\x93" => "O",
"\xC3\x94" => "O", "\xC3\x95" => "O", "\xC3\x96" => "O", "\xC3\x98" => "O",
"\xC3\x99" => "U", "\xC3\x9A" => "U", "\xC3\x9B" => "U", "\xC3\x9C" => "U",
"\xC3\x9D" => "Y", "\xC3\x9E" => "P", "\xC3\x9F" => "ss",
"\xC3\xA0" => "a", "\xC3\xA1" => "a", "\xC3\xA2" => "a", "\xC3\xA3" => "a",
"\xC3\xA4" => "a", "\xC3\xA5" => "a", "\xC3\xA6" => "ae", "\xC3\xA7" => "c",
"\xC3\xA8" => "e", "\xC3\xA9" => "e", "\xC3\xAA" => "e", "\xC3\xAB" => "e",
"\xC3\xAC" => "i", "\xC3\xAD" => "i", "\xC3\xAE" => "i", "\xC3\xAF" => "i",
"\xC3\xB0" => "o", "\xC3\xB1" => "n", "\xC3\xB2" => "o", "\xC3\xB3" => "o",
"\xC3\xB4" => "o", "\xC3\xB5" => "o", "\xC3\xB6" => "o", "\xC3\xB8" => "o",
"\xC3\xB9" => "u", "\xC3\xBA" => "u", "\xC3\xBB" => "u", "\xC3\xBC" => "u",
"\xC3\xBD" => "y", "\xC3\xBE" => "p", "\xC3\xBF" => "y",
"\xC4\x80" => "A", "\xC4\x81" => "a", "\xC4\x82" => "A", "\xC4\x83" => "a",
"\xC4\x84" => "A", "\xC4\x85" => "a", "\xC4\x86" => "C", "\xC4\x87" => "c",
"\xC4\x88" => "C", "\xC4\x89" => "c", "\xC4\x8A" => "C", "\xC4\x8B" => "c",
"\xC4\x8C" => "C", "\xC4\x8D" => "c", "\xC4\x8E" => "D", "\xC4\x8F" => "d",
"\xC4\x90" => "D", "\xC4\x91" => "d", "\xC4\x92" => "E", "\xC4\x93" => "e",
"\xC4\x94" => "E", "\xC4\x95" => "e", "\xC4\x96" => "E", "\xC4\x97" => "e",
"\xC4\x98" => "E", "\xC4\x99" => "e", "\xC4\x9A" => "E", "\xC4\x9B" => "e",
"\xC4\x9C" => "G", "\xC4\x9D" => "g", "\xC4\x9E" => "G", "\xC4\x9F" => "g",
"\xC4\xA0" => "G", "\xC4\xA1" => "g", "\xC4\xA2" => "G", "\xC4\xA3" => "g",
"\xC4\xA4" => "H", "\xC4\xA5" => "h", "\xC4\xA6" => "H", "\xC4\xA7" => "h",
"\xC4\xA8" => "I", "\xC4\xA9" => "i", "\xC4\xAA" => "I", "\xC4\xAB" => "i",
"\xC4\xAC" => "I", "\xC4\xAD" => "i", "\xC4\xAE" => "I", "\xC4\xAF" => "i",
"\xC4\xB0" => "I", "\xC4\xB1" => "i", "\xC4\xB2" => "IJ", "\xC4\xB3" => "ij",
"\xC4\xB4" => "J", "\xC4\xB5" => "j", "\xC4\xB6" => "K", "\xC4\xB7" => "k",
"\xC4\xB8" => "k", "\xC4\xB9" => "L", "\xC4\xBA" => "l", "\xC4\xBB" => "L",
"\xC4\xBC" => "l", "\xC4\xBD" => "L", "\xC4\xBE" => "l", "\xC4\xBF" => "L",
"\xC5\x80" => "l", "\xC5\x81" => "L", "\xC5\x82" => "l", "\xC5\x83" => "N",
"\xC5\x84" => "n", "\xC5\x85" => "N", "\xC5\x86" => "n", "\xC5\x87" => "N",
"\xC5\x88" => "n", "\xC5\x89" => "n", "\xC5\x8A" => "N", "\xC5\x8B" => "n",
"\xC5\x8C" => "O", "\xC5\x8D" => "o", "\xC5\x8E" => "O", "\xC5\x8F" => "o",
"\xC5\x90" => "O", "\xC5\x91" => "o", "\xC5\x92" => "CE", "\xC5\x93" => "ce",
"\xC5\x94" => "R", "\xC5\x95" => "r", "\xC5\x96" => "R", "\xC5\x97" => "r",
"\xC5\x98" => "R", "\xC5\x99" => "r", "\xC5\x9A" => "S", "\xC5\x9B" => "s",
"\xC5\x9C" => "S", "\xC5\x9D" => "s", "\xC5\x9E" => "S", "\xC5\x9F" => "s",
"\xC5\xA0" => "S", "\xC5\xA1" => "s", "\xC5\xA2" => "T", "\xC5\xA3" => "t",
"\xC5\xA4" => "T", "\xC5\xA5" => "t", "\xC5\xA6" => "T", "\xC5\xA7" => "t",
"\xC5\xA8" => "U", "\xC5\xA9" => "u", "\xC5\xAA" => "U", "\xC5\xAB" => "u",
"\xC5\xAC" => "U", "\xC5\xAD" => "u", "\xC5\xAE" => "U", "\xC5\xAF" => "u",
"\xC5\xB0" => "U", "\xC5\xB1" => "u", "\xC5\xB2" => "U", "\xC5\xB3" => "u",
"\xC5\xB4" => "W", "\xC5\xB5" => "w", "\xC5\xB6" => "Y", "\xC5\xB7" => "y",
"\xC5\xB8" => "Y", "\xC5\xB9" => "Z", "\xC5\xBA" => "z", "\xC5\xBB" => "Z",
"\xC5\xBC" => "z", "\xC5\xBD" => "Z", "\xC5\xBE" => "z", "\xC6\x8F" => "E",
"\xC6\xA0" => "O", "\xC6\xA1" => "o", "\xC6\xAF" => "U", "\xC6\xB0" => "u",
"\xC7\x8D" => "A", "\xC7\x8E" => "a", "\xC7\x8F" => "I",
"\xC7\x90" => "i", "\xC7\x91" => "O", "\xC7\x92" => "o", "\xC7\x93" => "U",
"\xC7\x94" => "u", "\xC7\x95" => "U", "\xC7\x96" => "u", "\xC7\x97" => "U",
"\xC7\x98" => "u", "\xC7\x99" => "U", "\xC7\x9A" => "u", "\xC7\x9B" => "U",
"\xC7\x9C" => "u",
"\xC7\xBA" => "A", "\xC7\xBB" => "a", "\xC7\xBC" => "AE", "\xC7\xBD" => "ae",
"\xC7\xBE" => "O", "\xC7\xBF" => "o",
"\xC9\x99" => "e",
"\xC2\x82" => ",", // High code comma
"\xC2\x84" => ",,", // High code double comma
"\xC2\x85" => "...", // Tripple dot
"\xC2\x88" => "^", // High carat
"\xC2\x91" => "\x27", // Forward single quote
"\xC2\x92" => "\x27", // Reverse single quote
"\xC2\x93" => "\x22", // Forward double quote
"\xC2\x94" => "\x22", // Reverse double quote
"\xC2\x96" => "-", // High hyphen
"\xC2\x97" => "--", // Double hyphen
"\xC2\xA6" => "|", // Split vertical bar
"\xC2\xAB" => "<<", // Double less than
"\xC2\xBB" => ">>", // Double greater than
"\xC2\xBC" => "1/4", // one quarter
"\xC2\xBD" => "1/2", // one half
"\xC2\xBE" => "3/4", // three quarters
"\xCA\xBF" => "\x27", // c-single quote
"\xCC\xA8" => "", // modifier - under curve
"\xCC\xB1" => "" // modifier - under line
);
return strtr($instr, $tranmap);
}
////////////////////////////////////////////////////////////////////////////////
/////////////////////////// TRUNCATE LENGTH FUNCTION ///////////////////////////
////////////////////////////////////////////////////////////////////////////////
function truncateListing ($str, $length=60, $trailing='...') {
// take off chars for the trailing
$length-=strlen($trailing);
if (strlen($str) > $length){
// string is almost short enough, allow it
if (strlen($str) < $length+4) {
return $str;
}
else {
// string exceeded length, truncate
$shortstr = substr($str, 0, $length);
// strip spaces, commas, and colons from end
$shortstr = rtrim($shortstr, ' ,:');
// add trailing dots
return $shortstr.$trailing;
}
}
else {
// string was already short enough, return the string
$res = $str;
}
return $res;
}
////////////////////////////////////////////////////////////////////////////////
/////////////////////////// PRINT FILM LIST FUNCTION ///////////////////////////
////////////////////////////////////////////////////////////////////////////////
function printFilmList () {
global $userdata, $i, $iconAnimation, $iconComedy, $iconConspiracy, $iconFantasy, $iconHorror, $iconMind, $iconMusical, $iconObscure, $iconSciFi, $iconSexual, $iconSport, $iconSuperhero, $iconTrue, $iconTV, $iconDVD, $iconBest, $iconOscar, $iconIMDb;
global $count10, $count9, $count8, $count7, $count6, $count5, $countCRAP, $num10s, $num9s, $num8s, $num7s, $num6s, $num5s, $numCRAPs, $numReturned, $sumCount;
global $path_info, $path_stripped;
include("icons.php");
if ($userdata[$i]["rating"]=="10" && $count10=="0") { $count10++; echo "
MASTERPIECES
\n"; }
else if ($userdata[$i]["rating"]=="9" && $count9=="0") { $count9++; echo "
EXCELLENT
\n"; }
else if ($userdata[$i]["rating"]=="8" && $count8=="0") { $count8++; echo "
VERY GOOD
\n"; }
else if ($userdata[$i]["rating"]=="7" && $count7=="0") { $count7++; echo "
GOOD
\n"; }
else if ($userdata[$i]["rating"]=="6" && $count6=="0") { $count6++; echo "
FAIR
\n"; }
else if ($userdata[$i]["rating"]=="5" && $count5=="0") { $count5++; echo "
ADEQUATE
\n"; }
else if ($userdata[$i]["rating"]=="crap" && $countCRAP=="0") { $countCRAP++; echo "
FROM BAD TO WORSE
\n"; }
if (!$userdata[$i]["sum"]) { }
else { $sumCount++; }
if ($path_info == $path_stripped) {
if ((strstr($userdata[$i]["link"], 'http')) <> FALSE) {
echo "
";
echo "
";
echo " NULL) { echo " onmouseover=\"return overlib('".$userdata[$i]["sum"]."');\" onmouseout=\"return nd();\""; }
echo ">";
if ($userdata[$i]["lang"] == "foreign") { echo ""; }
echo truncateListing($userdata[$i]["title"])." (".$userdata[$i]["year"].")";
if ($userdata[$i]["lang"] == "foreign") { echo ""; }
echo "";
if ($userdata[$i]["rating"] == "crap") { echo ""; }
echo " ".strtoupper($userdata[$i]["rating"]);
if ($userdata[$i]["rating"] == "crap") { echo ""; }
echo " ";
if ($userdata[$i]["ani"] <> NULL) { echo $iconAnimation; }
if ($userdata[$i]["com"] <> NULL) { echo $iconComedy; }
if ($userdata[$i]["con"] <> NULL) { echo $iconConspiracy; }
if ($userdata[$i]["fan"] <> NULL) { echo $iconFantasy; }
if ($userdata[$i]["hor"] <> NULL) { echo $iconHorror; }
if ($userdata[$i]["mind"] <> NULL) { echo $iconMind; }
if ($userdata[$i]["mus"] <> NULL) { echo $iconMusical; }
if ($userdata[$i]["obs"] <> NULL) { echo $iconObscure; }
if ($userdata[$i]["sci"] <> NULL) { echo $iconSciFi; }
if ($userdata[$i]["sex"] <> NULL) { echo $iconSexual; }
if ($userdata[$i]["spo"] <> NULL) { echo $iconSport; }
if ($userdata[$i]["sup"] <> NULL) { echo $iconSuperhero; }
if ($userdata[$i]["true"] <> NULL) { echo $iconTrue; }
if ($userdata[$i]["tv"] <> NULL) { echo $iconTV; }
if ($userdata[$i]["dvd"] <> NULL) { echo $iconDVD; }
if ($userdata[$i]["best"] <> NULL) { echo $iconBest; }
if ($userdata[$i]["oscar"] <> NULL) { echo $iconOscar; }
if ($userdata[$i]["imdb"] <> NULL) { echo $iconIMDb; }
echo "
\n";
}
else {
if ((strstr($userdata[$i]["link"], 'http')) <> FALSE) {
echo "
";
echo "";
}
else {
if ((strstr($_SERVER['REQUEST_URI'], 'fulltext')) == TRUE) {
$urlFulltext = "/fulltext";
}
else {
$urlFulltext = "";
}
echo "
";
echo "";
}
if ($userdata[$i]["lang"] == "foreign") { echo ""; }
echo truncateListing($userdata[$i]["title"])." (".$userdata[$i]["year"].")";
if ($userdata[$i]["lang"] == "foreign") { echo ""; }
echo "";
if ($userdata[$i]["rating"] == "crap") { echo ""; }
echo " ".strtoupper($userdata[$i]["rating"]);
if ($userdata[$i]["rating"] == "crap") { echo ""; }
echo " ";
if ($userdata[$i]["ani"] <> NULL) { echo $iconAnimation; }
if ($userdata[$i]["com"] <> NULL) { echo $iconComedy; }
if ($userdata[$i]["con"] <> NULL) { echo $iconConspiracy; }
if ($userdata[$i]["fan"] <> NULL) { echo $iconFantasy; }
if ($userdata[$i]["hor"] <> NULL) { echo $iconHorror; }
if ($userdata[$i]["mind"] <> NULL) { echo $iconMind; }
if ($userdata[$i]["mus"] <> NULL) { echo $iconMusical; }
if ($userdata[$i]["obs"] <> NULL) { echo $iconObscure; }
if ($userdata[$i]["sci"] <> NULL) { echo $iconSciFi; }
if ($userdata[$i]["sex"] <> NULL) { echo $iconSexual; }
if ($userdata[$i]["spo"] <> NULL) { echo $iconSport; }
if ($userdata[$i]["sup"] <> NULL) { echo $iconSuperhero; }
if ($userdata[$i]["true"] <> NULL) { echo $iconTrue; }
if ($userdata[$i]["tv"] <> NULL) { echo $iconTV; }
if ($userdata[$i]["dvd"] <> NULL) { echo $iconDVD; }
if ($userdata[$i]["best"] <> NULL) { echo $iconBest; }
if ($userdata[$i]["oscar"] <> NULL) { echo $iconOscar; }
if ($userdata[$i]["imdb"] <> NULL) { echo $iconIMDb; }
echo "
\n";
if ($userdata[$i]["sum"] <> NULL) { echo "".stripslashes($userdata[$i]["sum"])."
"; }
echo "\n";
}
if ($userdata[$i]["rating"]=="10") { $num10s++; }
else if ($userdata[$i]["rating"]=="9") { $num9s++; }
else if ($userdata[$i]["rating"]=="8") { $num8s++; }
else if ($userdata[$i]["rating"]=="7") { $num7s++; }
else if ($userdata[$i]["rating"]=="6") { $num6s++; }
else if ($userdata[$i]["rating"]=="5") { $num5s++; }
else if ($userdata[$i]["rating"]=="crap") { $numCRAPs++; }
$numReturned++;
}
////////////////////////////////////////////////////////////////////////////////
/////////////////////////// PRINT DVD COVERS FUNCTION //////////////////////////
////////////////////////////////////////////////////////////////////////////////
function printDVDCovers () {
global $userdata, $i, $count10, $count9, $count8, $count7, $count6, $count5, $countCRAP;
if ($userdata[$i]["rating"]=="10" && $count10=="0") { $count10++; echo "
![[spirited away]](/filmometer/images/spiritedaway.jpg)

MASTERPIECES
\n"; }
else if ($userdata[$i]["rating"]=="9" && $count9=="0") { $count9++; echo "
![[donnie darko]](/filmometer/images/donniedarko.jpg)

EXCELLENT
\n"; }
else if ($userdata[$i]["rating"]=="8" && $count8=="0") { $count8++; echo "
![[storytelling]](/filmometer/images/storytelling.jpg)

VERY GOOD
\n"; }
else if ($userdata[$i]["rating"]=="7" && $count7=="0") { $count7++; echo "
![[animatrix]](/filmometer/images/animatrix.jpg)

GOOD
\n"; }
else if ($userdata[$i]["rating"]=="6" && $count6=="0") { $count6++; echo "
![[orange county]](/filmometer/images/orangecounty.jpg)

FAIR
\n"; }
else if ($userdata[$i]["rating"]=="5" && $count5=="0") { $count5++; echo "
![[resident evil]](/filmometer/images/residentevil.jpg)

ADEQUATE
\n"; }
else if ($userdata[$i]["rating"]=="crap" && $countCRAP=="0") { $countCRAP++; echo "
![[signs]](/filmometer/images/signs.jpg)

FROM BAD TO WORSE
\n"; }
}
////////////////////////////////////////////////////////////////////////////////
//////////////////////////// SORT REVIEWS FUNCTIONS ////////////////////////////
////////////////////////////////////////////////////////////////////////////////
function keywordSearch() {
global $keyword, $ASCIICode, $ASCIIText, $ISO88591Code, $ISO88591Text;
global $userdata, $usercount, $i, $iconAnimation, $iconComedy, $iconConspiracy, $iconFantasy, $iconHorror, $iconMind, $iconMusical, $iconObscure, $iconSciFi, $iconSexual, $iconSport, $iconSuperhero, $iconTrue, $iconTV, $iconDVD, $iconBest, $iconOscar, $iconIMDb, $count10, $count9, $count8, $count7, $count6, $count5, $countCRAP, $num10s, $num9s, $num8s, $num7s, $num6s, $num5s, $numCRAPs, $numReturned, $sumCount;
$count10=0; $count9=0; $count8=0; $count7=0; $count6=0; $count5=0; $countCRAP=0;
$num10s=0; $num9s=0; $num8s=0; $num7s=0; $num6s=0; $num5s=0; $numCRAPs=0; $numReturned=0;
$sumCount=0;
$titleClean=array(); $summaryClean=array();
echo "Keyword Search Result: \"".$keyword."\"
";
echo "Search returned all film titles and reviews that contain the keyword \"".$keyword."\" out of $usercount total films.
\n";
summaryFormat();
for ($i=0; $i<$usercount; $i++) {
//$titleClean[$i] = htmlentities($userdata[$i]["title"]);
$titleClean[$i] = $userdata[$i]["title"];
//$summaryClean[$i] = htmlentities($userdata[$i]["sum"]);
$summaryClean[$i] = $userdata[$i]["sum"];
}
$filmFound = "no";
for ($i=0; $i<$usercount; $i++) {
//$titleClean[$i] = str_replace($ISO88591Code, $ISO88591Text, $titleClean[$i]);
//$summaryClean[$i] = str_replace($ISO88591Code, $ISO88591Text, $summaryClean[$i]);
//echo $titleClean[$i]."
";
$titleClean[$i] = utf8_trans_unaccent($titleClean[$i]);
$summaryClean[$i] = utf8_trans_unaccent($summaryClean[$i]);
//echo $titleClean[$i]."
";
//if ((strpos(strtolower($titleClean[$i]), $keyword) > -1) || (strpos(strtolower(html_entity_decode($userdata[$i]["title"])), $keyword) > -1) || (strpos(strtolower($summary[$i]), $keyword) > -1) || (strpos(strtolower(html_entity_decode(stripslashes($userdata[$i]["sum"]))), $keyword) > -1)) {
if ((strpos(strtolower($titleClean[$i]), $keyword) > -1) || (strpos(strtolower($userdata[$i]["title"]), $keyword) > -1) || (strpos(strtolower($summaryClean[$i]), $keyword) > -1) || (strpos(strtolower(stripslashes($userdata[$i]["sum"])), $keyword) > -1)) {
printFilmList();
$filmFound = "yes";
}
}
if ($filmFound == "no") {
echo "Sorry, \"".$keyword."\" was not found in any film titles or 15-word reviews.
";
// closest keyword match of title by calculating Levenshtein distance between two strings
function wordMatch($words, $input, $sensitivity) {
$shortest = -1;
foreach ($words as $word) {
$lev = levenshtein(strtolower($input), $word);
if ($lev == 0) {
$closest = $word;
$shortest = 0;
$percent = 100; // percentage similarity between two strings
break;
}
if ($lev <= $shortest || $shortest < 0) {
$closest = $word;
$shortest = $lev;
// calculate the similarity in percent between two strings
similar_text($input, $closest, $percent);
}
}
if ($shortest <= $sensitivity) {
return array($closest, $percent);
}
else {
return 0;
}
}
// execute closest keyword match of title function
for ($i=0; $i<$usercount; $i++) {
$titleClean[$i] = utf8_trans_unaccent($titleClean[$i]);
list ($closestTitle, $percentMatch) = wordMatch($titleClean, strtolower($keyword), 10);
if (($closestTitle <> NULL) && ($closestTitle == $userdata[$i]["title"])) {
echo "The closest thing I can find is the movie below. Its title is a ".round($percentMatch, 0)."% match.
";
//echo $closestTitle;
printFilmList();
}
}
}
}
function reviewTitle() {
global $id;
global $userdata, $usercount, $i, $iconAnimationWhite, $iconComedyWhite, $iconConspiracyWhite, $iconFantasyWhite, $iconHorrorWhite, $iconMindWhite, $iconMusicalWhite, $iconObscureWhite, $iconSciFiWhite, $iconSexualWhite, $iconSportWhite, $iconSuperheroWhite, $iconTrueWhite, $iconTVWhite, $iconDVDWhite, $iconBestWhite, $iconOscarWhite, $iconIMDbWhite, $count10, $count9, $count8, $count7, $count6, $count5, $countCRAP, $num10s, $num9s, $num8s, $num7s, $num6s, $num5s, $numCRAPs, $numReturned, $sumCount;
// Opens the folder where the images are stored and then empties the array of images
$imgpath = "gallery";
$handle = opendir("$imgpath");
$imgArray = array();
function truncate ($str, $length=35, $trailing='...') {
// take off chars for the trailing
$length-=strlen($trailing);
if (strlen($str) > $length){
// string is almost short enough, allow it
if (strlen($str) < $length+4) {
return $str;
}
else {
// string exceeded length, truncate
$shortstr = substr($str, 0, $length);
// strip spaces, commas, and colons from end
$shortstr = rtrim($shortstr, ' ,:');
// add trailing dots
return $shortstr.$trailing;
}
}
else {
// string was already short enough, return the string
$res = $str;
}
return $res;
}
$alreadyPrinted = "false";
$enteredLoop = "false";
$enteredElseLoop = "false";
for ($i=0; $i<$usercount; $i++) {
if ($userdata[$i]["link"] == $id && $alreadyPrinted <> "true") {
$found = "false";
$alreadyPrinted = "true";
$enteredLoop = "true";
if (strpos($userdata[$i]["title"], ', The') > 0) {
$userdata[$i]["title"] = str_replace(", The", "", $userdata[$i]["title"]);
$userdata[$i]["title"] = "The ".$userdata[$i]["title"];
}
elseif (strpos($userdata[$i]["title"], ', An') > 0) {
$userdata[$i]["title"] = str_replace(", An", "", $userdata[$i]["title"]);
$userdata[$i]["title"] = "An ".$userdata[$i]["title"];
}
elseif ( (strpos($userdata[$i]["title"], ', A') > 0) && (strpos($userdata[$i]["title"], ', Ag') < 1) ) {
$userdata[$i]["title"] = str_replace(", A", "", $userdata[$i]["title"]);
$userdata[$i]["title"] = "A ".$userdata[$i]["title"];
}
elseif (strpos($userdata[$i]["title"], ', La') > 0) {
$userdata[$i]["title"] = str_replace(", La", "", $userdata[$i]["title"]);
$userdata[$i]["title"] = "La ".$userdata[$i]["title"];
}
echo "\n";
echo " |
\n";
echo "\n";
echo " | \n";
echo " \n";
echo "".truncate($userdata[$i]["title"])."
 | \n";
echo " | \n";
echo "
\n";
echo "\n";
echo " | \n";
echo "
\n";
echo "\n";
echo " | \n";
echo " \n";
// Start a loop, read folder contents, check if the file is not a folder
// Then a name of the file is stored in the array and folder is closed when the cycle ends
while($file = readdir($handle)) {
if($file == $userdata[$i]["link"].".jpg") {
echo ' '."\n";
$found = "true";
}
}
if ($found == "false") {
echo " \n";
}
closedir($handle);
if ($userdata[$i]["sum"] <> NULL) { echo stripslashes($userdata[$i]["sum"])." \n"; }
echo "Rating: ";
if ($userdata[$i]["rating"] == "crap") { echo ""; }
echo strtoupper($userdata[$i]["rating"]);
if ($userdata[$i]["rating"] == "crap") { echo ""; }
echo " \n";
echo " | \n";
echo " | \n";
echo "
\n";
echo "\n";
echo " | \n";
echo "
\n";
echo "\n";
echo " | \n";
echo " \n";
echo "".$userdata[$i]["year"]."
 | \n";
echo " | \n";
echo " \n";
echo "".ucfirst($userdata[$i]["lang"])."
 | \n";
echo " | \n";
echo " \n";
echo "IMDb Page
 | \n";
echo " | \n";
echo "
\n";
echo "\n";
echo " | \n";
echo "
\n";
echo "\n";
echo " | \n";
echo " \n";
echo "Genres/categories:\n";
if ($userdata[$i]["ani"] <> NULL) { echo $iconAnimationWhite; }
if ($userdata[$i]["com"] <> NULL) { echo $iconComedyWhite; }
if ($userdata[$i]["con"] <> NULL) { echo $iconConspiracyWhite; }
if ($userdata[$i]["fan"] <> NULL) { echo $iconFantasyWhite; }
if ($userdata[$i]["hor"] <> NULL) { echo $iconHorrorWhite; }
if ($userdata[$i]["mind"] <> NULL) { echo $iconMindWhite; }
if ($userdata[$i]["mus"] <> NULL) { echo $iconMusicalWhite; }
if ($userdata[$i]["obs"] <> NULL) { echo $iconObscureWhite; }
if ($userdata[$i]["sci"] <> NULL) { echo $iconSciFiWhite; }
if ($userdata[$i]["sex"] <> NULL) { echo $iconSexualWhite; }
if ($userdata[$i]["spo"] <> NULL) { echo $iconSportWhite; }
if ($userdata[$i]["sup"] <> NULL) { echo $iconSuperheroWhite; }
if ($userdata[$i]["true"] <> NULL) { echo $iconTrueWhite; }
if ($userdata[$i]["tv"] <> NULL) { echo $iconTVWhite; }
if ($userdata[$i]["dvd"] <> NULL) { echo $iconDVDWhite; }
if ($userdata[$i]["best"] <> NULL) { echo $iconBestWhite; }
if ($userdata[$i]["oscar"] <> NULL) { echo $iconOscarWhite; }
if ($userdata[$i]["imdb"] <> NULL) { echo $iconIMDbWhite; }
if ($userdata[$i]["ani"] == NULL && $userdata[$i]["com"] == NULL &&
$userdata[$i]["con"] == NULL && $userdata[$i]["fan"] == NULL &&
$userdata[$i]["hor"] == NULL && $userdata[$i]["mind"] == NULL &&
$userdata[$i]["mus"] == NULL && $userdata[$i]["obs"] == NULL &&
$userdata[$i]["sci"] == NULL && $userdata[$i]["sex"] == NULL &&
$userdata[$i]["spo"] == NULL && $userdata[$i]["sup"] == NULL &&
$userdata[$i]["true"] == NULL && $userdata[$i]["tv"] == NULL &&
$userdata[$i]["best"] == NULL && $userdata[$i]["oscar"] == NULL &&
$userdata[$i]["dvd"] == NULL ) { echo "None\n"; }
echo "
 | \n";
echo " | \n";
echo "
\n";
if ($userdata[$i]["review"] <> NULL) {
echo "\n";
echo " | \n";
echo "
\n";
echo "\n";
echo " | \n";
echo " \n";
if ((strstr($userdata[$i]["review"], 'spiralnotepad')) <> FALSE) {
echo "Expanded movie thoughts: ";
echo "spiral::notepad\n";
}
else {
echo "Watch movie online: ";
echo "".truncate($userdata[$i]["title"])."\n";
}
echo "
 | \n";
echo " | \n";
echo "
\n";
}
echo " |
\n";
echo "
\n\n";
}
}
if ($enteredLoop == "false" && $enteredElseLoop == "false") {
$enteredElseLoop = "true";
echo "Sorry, but the film you are looking for does not exist in the database.
";
}
}
function reviewsRelease() {
global $release;
global $userdata, $usercount, $i, $iconAnimation, $iconComedy, $iconConspiracy, $iconFantasy, $iconHorror, $iconMind, $iconMusical, $iconObscure, $iconSciFi, $iconSexual, $iconSport, $iconSuperhero, $iconTrue, $iconTV, $iconDVD, $iconBest, $iconOscar, $iconIMDb, $count10, $count9, $count8, $count7, $count6, $count5, $countCRAP, $num10s, $num9s, $num8s, $num7s, $num6s, $num5s, $numCRAPs, $numReturned, $sumCount;
$count10=0; $count9=0; $count8=0; $count7=0; $count6=0; $count5=0; $countCRAP=0;
$num10s=0; $num9s=0; $num8s=0; $num7s=0; $num6s=0; $num5s=0; $numCRAPs=0; $numReturned=0;
$sumCount=0;
if ($release=="all") {
echo "All Films
";
echo "Search returned all $usercount rated films.
\n";
}
else if ($release=="new") {
echo "New Releases
";
echo "Search returned all films since 2015 out of $usercount total rated films.
\n";
}
else if ($release=="recent") {
echo "Recent Releases
";
echo "Search returned all films from 2011-2014 out of $usercount total rated films.
\n";
}
else if ($release=="old") {
echo "Old Releases
";
echo "Search returned all films from 1996-2010 out of $usercount total rated films.
\n";
}
summaryFormat();
for ($i=0; $i<$usercount; $i++) {
if ($release=="all") {
printDVDCovers();
printFilmList();
}
else if ($release=="new" && $userdata[$i]["year"] >= 2015) {
printFilmList();
}
else if ($release=="recent" && $userdata[$i]["year"] >= 2011 && $userdata[$i]["year"] <= 2014) {
//printDVDCovers();
printFilmList();
}
else if ($release=="old" && $userdata[$i]["year"] >= 1996 && $userdata[$i]["year"] <= 2010) {
printDVDCovers();
printFilmList();
}
}
}
function reviewsDays() {
global $days;
global $userdata, $usercount, $i, $iconAnimation, $iconComedy, $iconConspiracy, $iconFantasy, $iconHorror, $iconMind, $iconMusical, $iconObscure, $iconSciFi, $iconSexual, $iconSport, $iconSuperhero, $iconTrue, $iconTV, $iconDVD, $iconBest, $iconOscar, $iconIMDb, $count10, $count9, $count8, $count7, $count6, $count5, $countCRAP, $num10s, $num9s, $num8s, $num7s, $num6s, $num5s, $numCRAPs, $numReturned, $sumCount;
$count10=0; $count9=0; $count8=0; $count7=0; $count6=0; $count5=0; $countCRAP=0;
$num10s=0; $num9s=0; $num8s=0; $num7s=0; $num6s=0; $num5s=0; $numCRAPs=0; $numReturned=0;
$sumCount=0;
$nowdate = strtotime(date("Y-m-d"));
$datediffmax = ($nowdate - strtotime("2011-12-31")); // get date difference between today and when date-recording began, on January 1, 2012
$daysbetweenmax = round($datediffmax / 86400); // get maximum number of days available (since recording began)
if ($daysbetweenmax<$days) { $days = $daysbetweenmax; } // reset requested number of days to maximum available days
echo "Watched in the Past ".$days." Days
";
echo "Search returned all films watched in the past ".$days." days.
\n";
summaryFormat();
for ($i=0; $i<$usercount; $i++) {
if ($userdata[$i]["update"] <> NULL) {
$thendate = strtotime($userdata[$i]["update"]);
$datediff = ($nowdate - $thendate);
$daysbetween = round($datediff / 86400);
if ($daysbetween<$days) { // only show films watched the past X days
/*
uasort($userdata[$i], function ($x, $y) {
$a=$x["update"];
$b=$y["update"];
if ($a == $b) return 0;
elseif ($a > $b) return 1;
else return -1;
});
*/
printFilmList();
}
}
}
}
function watchedInYear() {
global $yearwatched;
global $userdata, $usercount, $i, $iconAnimation, $iconComedy, $iconConspiracy, $iconFantasy, $iconHorror, $iconMind, $iconMusical, $iconObscure, $iconSciFi, $iconSexual, $iconSport, $iconSuperhero, $iconTrue, $iconTV, $iconDVD, $iconBest, $iconOscar, $iconIMDb, $count10, $count9, $count8, $count7, $count6, $count5, $countCRAP, $num10s, $num9s, $num8s, $num7s, $num6s, $num5s, $numCRAPs, $numReturned, $sumCount;
$count10=0; $count9=0; $count8=0; $count7=0; $count6=0; $count5=0; $countCRAP=0;
$num10s=0; $num9s=0; $num8s=0; $num7s=0; $num6s=0; $num5s=0; $numCRAPs=0; $numReturned=0;
$sumCount=0;
echo "Watched During ".$yearwatched."
";
echo "Search returned all films watched in ".$yearwatched."
\n";
summaryFormat();
if ($yearwatched >= 2012) {
for ($i=0; $i<$usercount; $i++) {
if ($userdata[$i]["update"] <> NULL) {
$parts = explode('-', $userdata[$i]["update"]);
if ($parts[0] == $yearwatched) {
printFilmList();
}
}
}
}
else {
echo "No data available.
";
}
}
function reviewsYear() {
global $year;
global $userdata, $usercount, $i, $iconAnimation, $iconComedy, $iconConspiracy, $iconFantasy, $iconHorror, $iconMind, $iconMusical, $iconObscure, $iconSciFi, $iconSexual, $iconSport, $iconSuperhero, $iconTrue, $iconTV, $iconDVD, $iconBest, $iconOscar, $iconIMDb, $count10, $count9, $count8, $count7, $count6, $count5, $countCRAP, $num10s, $num9s, $num8s, $num7s, $num6s, $num5s, $numCRAPs, $numReturned, $sumCount;
$count10=0; $count9=0; $count8=0; $count7=0; $count6=0; $count5=0; $countCRAP=0;
$num10s=0; $num9s=0; $num8s=0; $num7s=0; $num6s=0; $num5s=0; $numCRAPs=0; $numReturned=0;
$sumCount=0;
echo "".$year." Releases
";
echo "Search returned all films from $year out of $usercount total rated films.
\n";
summaryFormat();
for ($i=0; $i<$usercount; $i++) {
list($year1, $year2) = explode('-', $year);
if ($userdata[$i]["year"] == $year) {
printFilmList();
}
else if ($userdata[$i]["year"] >= $year1 && $userdata[$i]["year"] <= $year2) {
printFilmList();
}
}
if ($numReturned == 0) {
echo "
\n";
echo "No films are currently found in the database for $year.
Please select another release year (or span of years) above.
\n";
}
}
function reviewsRating() {
global $rating;
global $userdata, $usercount, $i, $iconAnimation, $iconComedy, $iconConspiracy, $iconFantasy, $iconHorror, $iconMind, $iconMusical, $iconObscure, $iconSciFi, $iconSexual, $iconSport, $iconSuperhero, $iconTrue, $iconTV, $iconDVD, $iconBest, $iconOscar, $iconIMDb, $count10, $count9, $count8, $count7, $count6, $count5, $countCRAP, $num10s, $num9s, $num8s, $num7s, $num6s, $num5s, $numCRAPs, $numReturned, $sumCount;
$count10=0; $count9=0; $count8=0; $count7=0; $count6=0; $count5=0; $countCRAP=0;
$num10s=0; $num9s=0; $num8s=0; $num7s=0; $num6s=0; $num5s=0; $numCRAPs=0; $numReturned=0;
$sumCount=0;
echo "Rated ".strtoupper($rating)." out of 10
";
echo "Search returned all films with a rating of ".strtoupper($rating)." out of $usercount total films.
\n";
summaryFormat();
for ($i=0; $i<$usercount; $i++) {
if ($userdata[$i]["rating"] == $rating) {
printFilmList();
}
}
}
function reviewsLanguage() {
global $lang;
global $userdata, $usercount, $i, $iconAnimation, $iconComedy, $iconConspiracy, $iconFantasy, $iconHorror, $iconMind, $iconMusical, $iconObscure, $iconSciFi, $iconSexual, $iconSport, $iconSuperhero, $iconTrue, $iconTV, $iconDVD, $iconBest, $iconOscar, $iconIMDb, $count10, $count9, $count8, $count7, $count6, $count5, $countCRAP, $num10s, $num9s, $num8s, $num7s, $num6s, $num5s, $numCRAPs, $numReturned, $sumCount;
$count10=0; $count9=0; $count8=0; $count7=0; $count6=0; $count5=0; $countCRAP=0;
$num10s=0; $num9s=0; $num8s=0; $num7s=0; $num6s=0; $num5s=0; $numCRAPs=0; $numReturned=0;
$sumCount=0;
echo "".ucfirst($lang)." Language
";
echo "Search returned all ".ucfirst($lang)." language films out of $usercount total rated films.
\n";
summaryFormat();
for ($i=0; $i<$usercount; $i++) {
if ($userdata[$i]["lang"] == $lang) {
printFilmList();
}
}
}
function reviewsGenre() {
global $show;
global $userdata, $usercount, $i, $iconAnimation, $iconComedy, $iconConspiracy, $iconFantasy, $iconHorror, $iconMind, $iconMusical, $iconObscure, $iconSciFi, $iconSexual, $iconSport, $iconSuperhero, $iconTrue, $iconTV, $iconDVD, $iconBest, $iconOscar, $iconIMDb, $count10, $count9, $count8, $count7, $count6, $count5, $countCRAP, $num10s, $num9s, $num8s, $num7s, $num6s, $num5s, $numCRAPs, $numReturned, $sumCount;
$count10=0; $count9=0; $count8=0; $count7=0; $count6=0; $count5=0; $countCRAP=0;
$num10s=0; $num9s=0; $num8s=0; $num7s=0; $num6s=0; $num5s=0; $numCRAPs=0; $numReturned=0;
$sumCount=0;
// SORT XML BY GET ANIMATION VALUE, IF DEFINED
if ($show == "animation") {
echo "Animated Films (1996-".date("Y").")
";
echo "Search returned all movies with animation out of $usercount total rated films.
\n";
summaryFormat();
for ($i=0; $i<$usercount; $i++) {
if ($userdata[$i]["ani"] <> NULL) {
printFilmList();
}
}
}
// SORT XML BY GET COMEDY VALUE, IF DEFINED
else if ($show == "comedy") {
echo "Comedy Films (1996-".date("Y").")
";
echo "Search returned all comedy movies out of $usercount total rated films.
\n";
echo "Some are hilarious. Others have that one slightly funny joke you saw in the trailer.
\n";
summaryFormat();
for ($i=0; $i<$usercount; $i++) {
if ($userdata[$i]["com"] <> NULL) {
printFilmList();
}
}
}
// SORT XML BY GET CONSPIRACY VALUE, IF DEFINED
else if ($show == "conspiracy") {
echo "Conspiracy Films (1996-".date("Y").")
";
echo "Search returned all conspiracy/corruption movies out of $usercount total rated films.
\n";
echo "Conspiracy theories: Big Brother, CIA, FBI, Illuminati, NWO, UFOs, aliens, 9/11, etc.
\n";
summaryFormat();
for ($i=0; $i<$usercount; $i++) {
if ($userdata[$i]["con"] <> NULL) {
printFilmList();
}
}
}
// SORT XML BY GET FANTASY VALUE, IF DEFINED
else if ($show == "fantasy") {
echo "Fantasy Films (1996-".date("Y").")
";
echo "Search returned all fantasy movies out of $usercount total rated films.
\n";
summaryFormat();
for ($i=0; $i<$usercount; $i++) {
if ($userdata[$i]["fan"] <> NULL) {
printFilmList();
}
}
}
// SORT XML BY GET HORROR VALUE, IF DEFINED
else if ($show == "horror") {
echo "Horror Films (1996-".date("Y").")
";
echo "Search returned all horror movies out of $usercount total rated films.
\n";
summaryFormat();
for ($i=0; $i<$usercount; $i++) {
if ($userdata[$i]["hor"] <> NULL) {
printFilmList();
}
}
}
// SORT XML BY GET MIND-BLOWING VALUE, IF DEFINED
else if ($show == "mind-blowing") {
echo "Mind-blowing Films (1996-".date("Y").")
";
echo "Search returned all potentially mind-blowing movies out of $usercount total rated films.
\n";
summaryFormat();
for ($i=0; $i<$usercount; $i++) {
if ($userdata[$i]["mind"] <> NULL) {
printFilmList();
}
}
}
// SORT XML BY GET MUSICAL VALUE, IF DEFINED
else if ($show == "musical") {
echo "Musicals and Music Films (1996-".date("Y").")
";
echo "Search returned all musicals and music films out of $usercount total rated films.
\n";
summaryFormat();
for ($i=0; $i<$usercount; $i++) {
if ($userdata[$i]["mus"] <> NULL) {
printFilmList();
}
}
}
// SORT XML BY GET OBSCURE VALUE, IF DEFINED
else if ($show == "obscure") {
echo "Obscure and Rare Films (1996-".date("Y").")
";
echo "Search returned all hard-to-find or underground movies out of $usercount total rated films.
\n";
echo "These aren't really \"cult classics\" yet because not enough people have seen them.
\n";
summaryFormat();
for ($i=0; $i<$usercount; $i++) {
if ($userdata[$i]["obs"] <> NULL) {
printFilmList();
}
}
}
// SORT XML BY GET SCI-FI VALUE, IF DEFINED
else if ($show == "sci-fi") {
echo "Sci-Fi Films (1996-".date("Y").")
";
echo "Search returned all science fiction movies out of $usercount total rated films.
\n";
summaryFormat();
for ($i=0; $i<$usercount; $i++) {
if ($userdata[$i]["sci"] <> NULL) {
printFilmList();
}
}
}
// SORT XML BY GET SEX VALUE, IF DEFINED
else if ($show == "sexual") {
echo "Films with Sexual Content/Nudity (1996-".date("Y").")
";
echo "Search returned all movies with sex/nudity out of $usercount total rated films.
\n";
summaryFormat();
for ($i=0; $i<$usercount; $i++) {
if ($userdata[$i]["sex"] <> NULL) {
printFilmList();
}
}
}
// SORT XML BY GET SPORT VALUE, IF DEFINED
else if ($show == "sport") {
echo "Sport and Gambling Films (1996-".date("Y").")
";
echo "Search returned all movies with sports and gambling out of $usercount total rated films.
\n";
echo "Includes boxing, cycling, horse racing, surfing, skateboarding, poker, etc.
\n";
summaryFormat();
for ($i=0; $i<$usercount; $i++) {
if ($userdata[$i]["spo"] <> NULL) {
printFilmList();
}
}
}
// SORT XML BY GET SUPERHERO VALUE, IF DEFINED
else if (($show == "comic") || ($show == "superhero")) {
echo "Comic Book and Superhero Films (1996-".date("Y").")
";
echo "Search returned all movies based on comic books and graphic novels (or that include superhero characters) out of $usercount total rated films.
\n";
summaryFormat();
for ($i=0; $i<$usercount; $i++) {
if ($userdata[$i]["sup"] <> NULL) {
printFilmList();
}
}
}
// SORT XML BY GET TRUE VALUE, IF DEFINED
else if ($show == "true") {
echo "Documentaries and \"True\" Films (1996-".date("Y").")
";
echo "Search returned all documentary/biography films out of $usercount total rated films.
\n";
echo "History films, war films and those \"Based on a True Story\" are also included.
\n";
summaryFormat();
for ($i=0; $i<$usercount; $i++) {
if ($userdata[$i]["true"] <> NULL) {
printFilmList();
}
}
}
// SORT XML BY GET TV VALUE, IF DEFINED
else if ($show == "tv") {
echo "TV Shows and Made-for-TV Films (1996-".date("Y").")
";
echo "Search returned all television shows and TV-related films out of $usercount total rated films.
\n";
summaryFormat();
for ($i=0; $i<$usercount; $i++) {
if ($userdata[$i]["tv"] <> NULL) {
printFilmList();
}
}
}
// SORT XML BY GET DVD VALUE, IF DEFINED
else if ($show == "dvd") {
echo "Films I own on DVD (since 1996)
";
echo "Search returned all DVDs I own out of $usercount total rated films. ";
echo "Show complete DVD list.
\n";
summaryFormat();
for ($i=0; $i<$usercount; $i++) {
if ($userdata[$i]["dvd"] <> NULL) {
printFilmList();
}
}
}
// SORT XML BY GET IMDB VALUE, IF DEFINED
else if ($show == "best") {
echo "Filmometer Best Films of the Year (1996-".date("Y").")
";
echo "Search returned all Filmometer.com best films of the year out of $usercount total rated films.
\n";
summaryFormat();
for ($i=0; $i<$usercount; $i++) {
if ($userdata[$i]["best"] <> NULL) {
printFilmList();
}
}
}
// SORT XML BY GET IMDB VALUE, IF DEFINED
else if ($show == "oscar") {
echo "Academy Awards Winners for Best Picture (1996-".date("Y").")
";
echo "Search returned all Oscar-winning films for Best Picture out of $usercount total rated films. ";
echo "Show complete Best Picture winners list.
\n";
summaryFormat();
for ($i=0; $i<$usercount; $i++) {
if ($userdata[$i]["oscar"] <> NULL) {
printFilmList();
}
}
}
// SORT XML BY GET IMDB VALUE, IF DEFINED
else if ($show == "imdb") {
echo "Film Reviews Listed by IMDb (1996-".date("Y").")
";
echo "Search returned all films submitted to IMDb out of $usercount total rated films.
\n";
summaryFormat();
for ($i=0; $i<$usercount; $i++) {
if ($userdata[$i]["imdb"] <> NULL) {
printFilmList();
}
}
}
// SORT XML BY GET (NOT) IMDB VALUE, IF DEFINED
else if ($show == "notimdb") {
echo "Film Reviews Not Listed by IMDb (1996-".date("Y").")
";
echo "Search returned all films not submitted to IMDb out of $usercount total rated films.
\n";
summaryFormat();
for ($i=0; $i<$usercount; $i++) {
if ($userdata[$i]["imdb"] == NULL) {
printFilmList();
}
}
}
// SORT XML BY GET BLOG VALUE, IF DEFINED
else if ($show == "blog") {
echo "Films with Expanded Reviews at spiral::notepad
";
echo "Search returned all films with more detailed reviews out of $usercount total rated films.
\n";
summaryFormat();
for ($i=0; $i<$usercount; $i++) {
if ($userdata[$i]["review"] <> NULL) {
printFilmList();
}
}
}
// NO DEFINED SHOW VALUE, SO DISPLAY ALL XML DATA SINCE 2007 (SAME AS BELOW)
else {
echo "2017-2020 Releases
";
echo "Search returned all films since 2017 out of $usercount total rated films.
\n";
summaryFormat();
for ($i=0; $i<$usercount; $i++) {
if ($userdata[$i]["year"] >= 2017) {
//printDVDCovers();
printFilmList();
}
}
//echo "This category will be populated with films soon.
";
}
}
function reviewsDefault() {
global $userdata, $usercount, $i, $iconAnimation, $iconComedy, $iconConspiracy, $iconFantasy, $iconHorror, $iconMind, $iconMusical, $iconObscure, $iconSciFi, $iconSexual, $iconSport, $iconSuperhero, $iconTrue, $iconTV, $iconDVD, $iconBest, $iconOscar, $iconIMDb, $count10, $count9, $count8, $count7, $count6, $count5, $countCRAP, $num10s, $num9s, $num8s, $num7s, $num6s, $num5s, $numCRAPs, $numReturned, $sumCount;
$count10=0; $count9=0; $count8=0; $count7=0; $count6=0; $count5=0; $countCRAP=0;
$num10s=0; $num9s=0; $num8s=0; $num7s=0; $num6s=0; $num5s=0; $numCRAPs=0; $numReturned=0;
$sumCount=0;
echo "2017-2020 Releases
";
echo "Search returned all films since 2017 out of $usercount total rated films.
\n";
summaryFormat();
for ($i=0; $i<$usercount; $i++) {
if ($userdata[$i]["year"] >= 2017) {
//printDVDCovers();
printFilmList();
}
}
}
////////////////////////////////////////////////////////////////////////////////
////////////////////// RATINGS DISTRIBUTION STATS FUNCTION /////////////////////
////////////////////////////////////////////////////////////////////////////////
function ratingsDistributionStats() {
global $userdata, $usercount, $i, $count10, $count9, $count8, $count7, $count6, $count5, $countCRAP, $num10s, $num9s, $num8s, $num7s, $num6s, $num5s, $numCRAPs, $numReturned, $sumCount;
// DISPLAY STATISTICAL RATINGS SUMMARY
$per10=0; $per9=0; $per8=0; $per7=0; $per6=0; $per5=0; $perCRAP=0; $perTotal=0; $avgRating=0;
if ($numReturned >= "1") {
$per10 = round((($num10s/$numReturned)*100),1);
$per9 = round((($num9s/$numReturned)*100),1);
$per8 = round((($num8s/$numReturned)*100),1);
$per7 = round((($num7s/$numReturned)*100),1);
$per6 = round((($num6s/$numReturned)*100),1);
$per5 = round((($num5s/$numReturned)*100),1);
$perCRAP = round((($numCRAPs/$numReturned)*100),1);
$perTotal = round((($numReturned/$usercount)*100),1);
$avgRating = round(((($num10s*10)+($num9s*9)+($num8s*8)+($num7s*7)+($num6s*6)+($num5s*5)+($numCRAPs*2.5))/$numReturned),1);
}
echo "
";
echo "
Statistical ratings distribution of these ".$numReturned." films (".$perTotal."% of total rated films):
\n";
echo "With enough films included, it usually approximates a bell curve with a mean near 6.5...
\n";
echo "(especially when considering that CRAP is 0-4 combined).
\n";
echo "Average rating for these ".$numReturned." films: $avgRating.
\n";
echo "
\n";
echo "
\n";
echo "
\n";
echo "
\n";
echo "
\n";
echo "
\n";
echo "
\n";
// DISPLAY DESCRIPTION STATS SUMMARY
if ($numReturned <> 0) { $sumPercentage = round((($sumCount/$numReturned)*100),1); }
else { $sumPercentage = 0; }
if (($sumPercentage <> 100) && ($sumCount > 0)) {
echo "
";
echo "Currently, ".$sumCount." films out of these ".$numReturned." films (".$sumPercentage."%) have 15 Word Reviews.
";
}
}
////////////////////////////////////////////////////////////////////////////////
/////////////////////////// WATCHED PER DAY FUNCTION ///////////////////////////
////////////////////////////////////////////////////////////////////////////////
function watchedPerDay() {
global $days, $numReturned;
// DISPLAY STATISTICAL QUANTITY/TIME SUMMARY
$watchedAverage=0;
$watchedHours=0;
$watchedPerWeek=0;
if (($numReturned >= 1) && ($days > 0)) {
$watchedAverage = round(($numReturned/$days),1);
$watchedHours = round(((($numReturned/$days)*1.80)*60),0); // average film is 1 hour, 48 minutes, or 108 minutes
$watchedPerWeek = round((($numReturned/$days)*7),1);
echo "
";
echo "
How much time was spent watching movies?
On average, Ian watched ".$watchedAverage." films per day during the past ".$days." days.
\n";
echo "That's a daily average of about ".$watchedHours." minutes of cinema. Or, about ".$watchedPerWeek." films per week.
\n";
}
}
////////////////////////////////////////////////////////////////////////////////
///////////////////////// PRINT REVIEWS HEADER FUNCTION ////////////////////////
////////////////////////////////////////////////////////////////////////////////
function printReviewsHeader() {
global $userdata, $usercount, $i, $path_info, $path_id, $display, $id, $title, $description, $release, $days, $year, $rating, $lang, $show, $keyword, $yearwatched;
global $iconAnimationWhite, $iconComedyWhite, $iconConspiracyWhite, $iconFantasyWhite, $iconHorrorWhite, $iconMindWhite, $iconMusicalWhite, $iconObscureWhite, $iconSciFiWhite, $iconSexualWhite, $iconSportWhite, $iconSuperheroWhite, $iconTrueWhite, $iconTVWhite, $iconDVDWhite, $iconBestWhite, $iconOscarWhite, $iconIMDbWhite;
$enteredLoop = "no";
$titleEnd = "Movie Ratings & Reviews -- Filmometer.com";
for ($i=0; $i<$usercount; $i++) {
if ($userdata[$i]["link"] == $id) {
if (strpos($userdata[$i]["title"], ', The') > 0) {
$userdata[$i]["title"] = str_replace(", The", "", $userdata[$i]["title"]);
$userdata[$i]["title"] = "The ".$userdata[$i]["title"];
}
elseif (strpos($userdata[$i]["title"], ', An') > 0) {
$userdata[$i]["title"] = str_replace(", An", "", $userdata[$i]["title"]);
$userdata[$i]["title"] = "An ".$userdata[$i]["title"];
}
elseif ( (strpos($userdata[$i]["title"], ', A') > 0) && (strpos($userdata[$i]["title"], ', Ag') < 1) ) {
$userdata[$i]["title"] = str_replace(", A", "", $userdata[$i]["title"]);
$userdata[$i]["title"] = "A ".$userdata[$i]["title"];
}
elseif (strpos($userdata[$i]["title"], ', La') > 0) {
$userdata[$i]["title"] = str_replace(", La", "", $userdata[$i]["title"]);
$userdata[$i]["title"] = "La ".$userdata[$i]["title"];
}
$title = $userdata[$i]["title"]." (".$userdata[$i]["year"].") -- $titleEnd";
$description = $userdata[$i]["title"]." (".$userdata[$i]["year"]."). ".stripslashes($userdata[$i]["sum"]);
$enteredLoop = "yes";
}
elseif ($release <> NULL) {
$title = ucfirst($release)." Releases -- $titleEnd";
$enteredLoop = "yes";
}
elseif ($yearwatched <> NULL) {
$title = "Watched During $yearwatched -- $titleEnd";
$enteredLoop = "yes";
}
elseif ($days <> NULL) {
$title = "Watched in the Past ".ucfirst($days)." Days -- $titleEnd";
$enteredLoop = "yes";
}
elseif ($year <> NULL) {
$title = $year." Releases -- $titleEnd";
$enteredLoop = "yes";
}
elseif ($rating <> NULL) {
$title = "Rated ".strtoupper($rating)." out of 10 -- $titleEnd";
$enteredLoop = "yes";
}
elseif ($lang <> NULL) {
$title = ucfirst($lang)." Language -- $titleEnd";
$enteredLoop = "yes";
}
elseif ($show <> NULL) {
if ($show == "animation") {
$title = "Animated Films -- $titleEnd";
}
elseif ($show == "comedy") {
$title = "Comedy Films -- $titleEnd";
}
elseif ($show == "conspiracy") {
$title = "Conspiracy Films -- $titleEnd";
}
elseif ($show == "dvd") {
$title = "Films I own on DVD (since 1996) -- $titleEnd";
}
elseif ($show == "best") {
$title = "Best Films of the Year (since 1996) -- $titleEnd";
}
elseif ($show == "oscar") {
$title = "Academy Awards Winners for Best Picture (since 1996) -- $titleEnd";
}
elseif ($show == "imdb") {
$title = "Film Reviews Listed by IMDb -- $titleEnd";
}
elseif ($show == "notimdb") {
$title = "Film Reviews Not Listed by IMDb -- $titleEnd";
}
elseif ($show == "blog") {
$title = "Films with Expanded Reviews at spiral::notepad -- $titleEnd";
}
elseif ($show == "musical") {
$title = "Musicals and Music Films -- $titleEnd";
}
elseif ($show == "obscure") {
$title = "Obscure and Rare Films -- $titleEnd";
}
elseif ($show == "sci-fi") {
$title = "Sci-Fi Films -- $titleEnd";
}
elseif ($show == "sexual") {
$title = "Films with Sexual Content/Nudity -- $titleEnd";
}
elseif ($show == "sport") {
$title = "Sport and Gambling Films -- $titleEnd";
}
elseif (($show == "comic") || ($show == "superhero")) {
$title = "Comic Book and Superhero Films -- $titleEnd";
}
elseif ($show == "true") {
$title = "Documentaries and \"True\" Films -- $titleEnd";
}
elseif ($show == "tv") {
$title = "TV Shows and Made-for-TV Films -- $titleEnd";
}
else {
$title = ucfirst($show)." Films -- $titleEnd";
}
$enteredLoop = "yes";
}
elseif ($keyword <> NULL) {
$title = "Search: ".$keyword." -- $titleEnd";
$enteredLoop = "yes";
}
}
if ($enteredLoop == "yes") {
include("header.php");
}
else {
$title = $titleEnd;
include("header.php");
}
include("display.php");
echo "\n\n\n";
echo "Movie Ratings & Reviews
\n";
echo "Last film added: ".$userdata[0]["date"].". ";
echo "There are currently ".$usercount." films in the database (since 1996).
";
echo "
\n";
include("icons.php");
include("ratings.php");
echo "\n";
echo '
';
echo "\n\n\n";
}
////////////////////////////////////////////////////////////////////////////////
//////////////////////// REDIRECT QUERY STRING FUNCTION ////////////////////////
////////////////////////////////////////////////////////////////////////////////
function redirectQueryString() {
global $redirect;
// Permanent redirection
header("HTTP/1.1 301 Moved Permanently");
header("Location: $redirect");
}
//****************************************************************************//
//** BEGIN IF-ELSE LOOP THAT CREATES HTML OUTPUT BY CALLING FUNCTIONS ABOVE **//
//****************************************************************************//
////////////////////////////////////////////////////////////////////////////////
///////////////// QUERY_STRING (FORMERLY PATH_INFO) OPERATIONS /////////////////
////////////////////////////////////////////////////////////////////////////////
if((isset($_SERVER['QUERY_STRING']) && (preg_match('/[a-zA-Z0-9 _\/\.\'\-]*/',$_SERVER['QUERY_STRING']) == TRUE))) {
function str_replace_once($needle, $replace, $haystack) {
// Looks for the first occurence of $needle in $haystack and replaces it with $replace.
$pos = strpos($haystack, $needle);
if ($pos === false) {
// Nothing found
return $haystack;
}
return substr_replace($haystack, $replace, $pos, strlen($needle));
}
$path_info = $_SERVER['QUERY_STRING']; // formerly $_SERVER['PATH_INFO']
// convert query string into path_info-like structure
$path_info = str_replace('=', '/', $path_info);
$path_info = str_replace('&', '/', $path_info);
$path_info = "/".$path_info;
// carry on
$first = $path_info[0];
if ($first == "/") {
$path_info = str_replace_once('/', '', $path_info);
}
$path_info = rtrim($path_info,'/');
$path_info = trim(strtolower($path_info));
$path_info = str_replace('_', ' ', $path_info);
$path_info = str_replace('/fulltext', '', $path_info);
$path_info = stripslashes($path_info);
if (strpos($path_info, 'title/') === 0) {
$path_id = str_replace('title/', '', $path_info);
$id = $path_id;
printReviewsHeader();
reviewTitle();
}
elseif (strpos($path_info, 'release/') === 0) {
$path_id = str_replace('release/', '', $path_info);
$release = $path_id;
printReviewsHeader();
reviewsRelease();
ratingsDistributionStats();
}
elseif (strpos($path_info, 'days/') === 0) {
$path_id = str_replace('days/', '', $path_info);
$days = $path_id;
printReviewsHeader();
reviewsDays();
watchedPerDay();
ratingsDistributionStats();
}
elseif (strpos($path_info, 'watched/') === 0) {
$path_id = str_replace('watched/', '', $path_info);
$yearwatched = $path_id;
$todaysdate = date("Y-m-d");
$parts = explode('-', $todaysdate);
if ($parts[0] == $yearwatched) {
$nowdate = strtotime(date("Y-m-d"));
$startdate = strtotime($parts[0]."-01-01");
$datediff = ($nowdate - $startdate);
$days = round($datediff / 86400);
}
else {
if ( ($yearwatched == "2012") || ($yearwatched == "2016") || ($yearwatched == "2020") || ($yearwatched == "2024") ) {
$days = 366;
}
else {
$days = 365;
}
}
printReviewsHeader();
watchedInYear();
watchedPerDay();
ratingsDistributionStats();
}
elseif (strpos($path_info, 'year/') === 0) {
$path_id = str_replace('year/', '', $path_info);
$year = $path_id;
printReviewsHeader();
reviewsYear();
ratingsDistributionStats();
}
elseif (strpos($path_info, 'rating/') === 0) {
$path_id = str_replace('rating/', '', $path_info);
$rating = $path_id;
printReviewsHeader();
reviewsRating();
ratingsDistributionStats();
}
elseif (strpos($path_info, 'language/') === 0) {
$path_id = str_replace('language/', '', $path_info);
$lang = $path_id;
printReviewsHeader();
reviewsLanguage();
ratingsDistributionStats();
}
elseif (strpos($path_info, 'genre/') === 0) {
$path_id = str_replace('genre/', '', $path_info);
$show = $path_id;
printReviewsHeader();
reviewsGenre();
ratingsDistributionStats();
}
elseif (strpos($path_info, 'search/') === 0) {
$path_id = str_replace('search/', '', $path_info);
$keyword = $path_id;
printReviewsHeader();
keywordSearch();
ratingsDistributionStats();
}
elseif ($path_info == "/") {
printReviewsHeader();
reviewsDefault();
ratingsDistributionStats();
}
elseif ($path_info == "fulltext") {
printReviewsHeader();
reviewsDefault();
ratingsDistributionStats();
}
/*elseif ($path_info <> NULL) {
$keyword = $path_info;
printReviewsHeader();
keywordSearch();
ratingsDistributionStats();
}*/
else {
printReviewsHeader();
reviewsDefault();
ratingsDistributionStats();
}
}
////////////////////////////////////////////////////////////////////////////////
/////////////////////////// GET AND POST OPERATIONS ////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// SHOW RESULTS OF A KEYWORD POST SEARCH, IF DEFINED
else if( (isset($_POST["keyword"]) && $_POST["keyword"] <> NULL && (preg_match('/[^\.0-9a-zA-Z _-]/',trim($_POST["keyword"])) == 0))
|| (isset($_GET['keyword']) && $_GET['keyword'] <> NULL)
) {
if(isset($_POST["keyword"])) {
$keyword=trim(strtolower($_POST["keyword"]));
}
else if(isset($_GET['keyword'])) {
// Define allowed characters
//if(preg_match("/^[0-9A-Za-z \&\\\'\,\.\/\:\_-]*$/", $_GET['keyword']) == TRUE) {
// Define disallowed characters
if(preg_match("/[^#%*+;<=>@^_`{|}~]/", $_GET['keyword']) == TRUE) {
//echo $keyword." ";
$keyword = trim(strtolower($_GET['keyword']));
$keyword = stripslashes($keyword);
//$keyword = str_replace($ISO88591Code, $ISO88591Text, $keyword);
$keyword = utf8_trans_unaccent($keyword);
$keyword = str_replace(" ", "_", $keyword);
//echo $keyword;
}
else {
$keyword = "oops";
}
}
$redirect = "https://iancavalier.com/filmometer/reviews/search/".$keyword;
redirectQueryString();
exit();
//printReviewsHeader();
//keywordSearch();
//ratingsDistributionStats();
}
// SHOW INDIVIDUAL FILM BASED ON GET ID VALUE, IF DEFINED
else if(isset($_GET['id']) && $_GET['id'] <> NULL && (preg_match('/[^0-9a-zA-Z_-]/',$_GET['id']) == 0)) {
$id=$_GET['id'];
$redirect = "https://iancavalier.com/filmometer/reviews/title/".$id;
redirectQueryString();
exit();
//printReviewsHeader();
//reviewTitle();
}
// SORT XML BY GET RATING VALUE, IF DEFINED
else if(isset($_GET['rating']) && $_GET['rating'] <> NULL && (preg_match('/[^0-9a-zA-Z_-]/',$_GET['rating']) == 0)) {
$rating=$_GET['rating'];
$redirect = "https://iancavalier.com/filmometer/reviews/rating/".$rating;
redirectQueryString();
exit();
//printReviewsHeader();
//reviewsRating();
//ratingsDistributionStats();
}
// SORT XML BY GET YEAR VALUE, IF DEFINED
else if(isset($_GET['year']) && $_GET['year'] <> NULL && (preg_match('/[^0-9a-zA-Z_-]/',$_GET['year']) == 0)) {
$year=$_GET['year'];
$redirect = "https://iancavalier.com/filmometer/reviews/year/".$year;
redirectQueryString();
exit();
//printReviewsHeader();
//reviewsYear();
//ratingsDistributionStats();
}
// SORT XML BY GET RELEASE VALUE (ALL, NEW, OR OLD), IF DEFINED
else if(isset($_GET['release']) && $_GET['release'] <> NULL && (preg_match('/[^0-9a-zA-Z_-]/',$_GET['release']) == 0)) {
$release=$_GET['release'];
$redirect = "https://iancavalier.com/filmometer/reviews/release/".$release;
redirectQueryString();
exit();
//printReviewsHeader();
//reviewsRelease();
//ratingsDistributionStats();
}
// SORT XML BY GET DAYS VALUE (#), IF DEFINED
else if(isset($_GET['days']) && $_GET['days'] <> NULL && (preg_match('/^[0-9]{1,3}$/D',$_GET['days']) == 0)) {
$days=$_GET['days'];
$redirect = "https://iancavalier.com/filmometer/reviews/days/".$days;
redirectQueryString();
exit();
//printReviewsHeader();
//reviewsDays();
//ratingsDistributionStats();
}
// SORT XML BY GET YEARWATCHED VALUE (#), IF DEFINED
else if(isset($_GET['watched']) && $_GET['watched'] <> NULL && (preg_match('/^[0-9]{1,3}$/D',$_GET['watched']) == 0)) {
$yearwatched=$_GET['watched'];
$redirect = "https://iancavalier.com/filmometer/reviews/watched/".$yearwatched;
redirectQueryString();
exit();
//printReviewsHeader();
//reviewsDays();
//ratingsDistributionStats();
}
// SORT XML BY GET LANGUAGE VALUE, IF DEFINED
else if(isset($_GET['lang']) && $_GET['lang'] <> NULL && (preg_match('/[^0-9a-zA-Z_-]/',$_GET['lang']) == 0)) {
$lang=$_GET['lang'];
$redirect = "https://iancavalier.com/filmometer/reviews/language/".$lang;
redirectQueryString();
exit();
//printReviewsHeader();
//reviewsLanguage();
//ratingsDistributionStats();
}
// SORT XML BY GET SHOW VALUE, IF DEFINED
else if(isset($_GET['show']) && $_GET['show'] <> NULL && (preg_match('/[^0-9a-zA-Z_-]/',$_GET['show']) == 0)) {
$show=$_GET['show'];
$redirect = "https://iancavalier.com/filmometer/reviews/genre/".$show;
redirectQueryString();
exit();
//printReviewsHeader();
//reviewsGenre();
//ratingsDistributionStats();
}
////////////////////////////////////////////////////////////////////////////////
////////////////////////////// CATCH-ALL OPERATION /////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// NO DEFINED GET VALUE, SO DISPLAY ALL XML DATA SINCE 2002
else {
printReviewsHeader();
reviewsDefault();
ratingsDistributionStats();
}
?>
