';
echo "\n\n";
$screen_width = $_SESSION['screen_width'];
$screen_height= $_SESSION['screen_height'];
} else if(isset($_REQUEST['width']) AND isset($_REQUEST['height'])) {
$_SESSION['screen_width'] = $_REQUEST['width'];
$_SESSION['screen_height'] = $_REQUEST['height'];
header('Location: ' . $_SERVER['PHP_SELF']);
} else {
if (strpos($_SERVER['PHP_SELF'],'?') === false) {
# echo '';
} else {
# echo '';
}
}
// ==================
class bubble {
var $include_title = true;
var $title;
var $year;
var $genre;
var $imdb_title_id;
var $poster;
var $include_plot = true; // Show the plot section
var $include_cancel = true; // Show cancels - this is sub section of plot if plot=false, this is ignored.
var $plot;
var $type;
var $include_footer = true; // Include the footer
var $include_imdb = true; // Subset of footer - show IMDB if title bubble
var $include_counter = true; // Subset of footer - shows if title bubble.
var $footer_msg;
var $runtime;
var $facebook;
var $twitter;
}
function last_index_of($sub_str,$instr) {
if(strstr($instr,$sub_str)!="") {
return(strlen($instr)-strpos(strrev($instr),$sub_str));
}
return(-1);
}
function trunc_str( $data, $nochar, $elipseflag, $tospaceflag ) {
$pos = -1;
if (strlen($data) > $nochar) {
$data = substr($data, 0, $nochar);
if ($tospaceflag) {
$pos =last_index_of(' ',$data);
if ($pos > -1) $data = substr($data,0,($pos-1));
}
if ($elipseflag) $data .= '...';
}
return $data;
}
function shorter_title ( $title, $maxsize=20 ) {
$title = trim($title);
if (strlen($title) > $maxsize) {
// Take off anything having 'with xxxxx' in it e.g. Tonight Show with... Late Show with ...
$tmp = strpos($title, " with ", 0);
if ($tmp > 0) $title = substr($title,0,$tmp);
}
if (strlen($title) > $maxsize) {
if (strtolower(substr($title, 0, 4))=='the ') {
$title = substr($title,4);
}
}
return $title;
}
function lookup_cancel( $id ) {
global $conn, $guestStatusTbl, $event_id;
$ans = '2000-01-01 00:00:01';
$sql = "SELECT removed ";
$sql .= "FROM ".$guestStatusTbl."_".$event_id." "; // 2018 TODO
$sql .= "WHERE ";
$sql .= " event_idx='".$event_id."' AND ";
$sql .= " imdb_name_id = '".$id."' "; // 2019 TODO added verify=1
$result = $conn->query($sql);
if ($result === FALSE) {
die("BAD SQL in lookup cancel: $sql: " . $conn->_error);
} else {
$result = $conn->query($sql);
foreach ($result as $row) $ans = $row['removed'];
}
return $ans;
}
function get_pos_by_name_id( $id ) {
global $conn, $event_id;
$pos = "";
$sql = "SELECT table_id \n";
$sql .= "FROM dc_wof_".$event_id." \n";
$sql .= "WHERE imdb_name_id='$id' \n";
$sql .= "LIMIT 1 ";
$result = $conn->query($sql);
if ($result === FALSE) {
die("BAD SQL in get_pos_by_name_id: $sql: " . $conn->_error);
} else {
if ($result->num_rows==1) {
$row = $result->fetch_row();
$pos = $row[0];
# print "\n\n";
}
}
return $pos;
}
function guests_ids_by_title_id( $id ) {
global $conn, $titlebyguestTbl, $event_id;
$data = "";
$sql = "SELECT imdb_name_id \n";
$sql .= "FROM ". $titlebyguestTbl ."_".$event_id." \n";
$sql .= "WHERE imdb_title_id='$id' \n";
$result = $conn->query($sql);
if ($result === FALSE) {
die("BAD SQL in Guests ids by title id: $sql: " . $conn->_error);
} else {
// $row = $result->fetch_row();
$result = $conn->query($sql);
foreach ($result as $row) {
if ($data == "") {
$data = $row['imdb_name_id'];
} else {
$data .= ','.$row['imdb_name_id'];
}
}
}
return $data;
}
# 2019-08-23
function guests_one_degree ( $id ) {
global $conn, $titlebyguestTbl, $event_id;
$l = "";
/*-- Version 1 include talk shows and proceedurals
$sql = "SELECT GROUP_CONCAT(distinct imdb_name_id) as name_list ";
$sql .= "FROM dc_title_by_guest_201909 AS C ";
$sql .= "WHERE imdb_name_id != '".$id."' AND ";
$sql .= " C.imdb_title_id IN ";
$sql .= "( SELECT A.imdb_title_id ";
$sql .= "FROM dc_title_by_guest_201909 AS A ";
$sql .= "INNER JOIN dc_title_201909 AS B ";
$sql .= "ON (A.imdb_title_id = B.imdb_title_id) ";
$sql .= "WHERE B.no_guests > 1 AND ";
$sql .= "A.imdb_name_id = '".$id."') ";
*/
$sql = "SELECT GROUP_CONCAT(distinct imdb_name_id) as name_list ";
# $sql .= "SELECT imdb_name_id ";
$sql .= "FROM dc_title_by_guest_201909 AS C ";
$sql .= "WHERE ";
$sql .= "imdb_name_id != '".$id."' AND ";
$sql .= " C.imdb_title_id IN ( ";
$sql .= " SELECT tmp ";
$sql .= " FROM ( ";
$sql .= " SELECT tmp ";
$sql .= " FROM ( ";
$sql .= " SELECT A.imdb_title_id AS tmp, id ";
$sql .= " FROM dc_title_by_guest_201909 AS A ";
$sql .= " LEFT JOIN dc_verse_details as D ";
$sql .= " ON (A.imdb_title_id = D.imdb_title_id) ";
$sql .= " WHERE A.imdb_name_id = '".$id."' ";
$sql .= " ) AS AA ";
$sql .= " WHERE ";
$sql .= " id IS NULL OR (id <> 11 AND id <> 15) ";
$sql .= " ) AS AB ";
$sql .= " INNER JOIN dc_title_201909 AS B ";
$sql .= " ON (AB.tmp = B.imdb_title_id) ";
$sql .= " WHERE B.no_guests > 1 ";
$sql .= " ) ";
print "\n\n\n\n";
$result = $conn->query($sql);
if ($result === FALSE) {
die("BAD SQL in title_id_by_guest_id: $sql: " . $conn->_error);
} else {
$result = $conn->query($sql);
$row=mysqli_fetch_assoc($result);
# print "\n";
$l = $row['name_list'];
mysqli_free_result($result);
}
# print "\n\n\n\n";
return $l;
}
function guests_by_title_id( $id ) {
global $magicSEP, $conn, $guestTbl, $titlebyguestTbl, $event_id;
$data = array();
$sql = "SELECT full_name, G.imdb_name_id as imdb_name_id, ";
$sql .= " dc_page, no_image, wof, photo_ops,panels, infodays, ";
$sql .= " chars as char_name, G.image_url as image_url, "; // 2019 TODO
// 2018 $sql .= " jobs as jobs_role, ";
$sql .= " no_epis as no_episodes, verify ";
$sql .= "FROM ".$guestTbl ."_".$event_id." as G "; // 2018 TODO
$sql .= "INNER JOIN (";
$sql .= " SELECT imdb_title_id,imdb_name_id, ";
$sql .= " group_concat(char_name SEPARATOR '".$magicSEP."') as chars, ";
// 2018 $sql .= " group_concat(job_role SEPARATOR '".$magicSEP."') as jobs, ";
$sql .= " group_concat(no_episodes SEPARATOR '".$magicSEP."') as no_epis ";
$sql .= " FROM ".$titlebyguestTbl."_".$event_id." ";
$sql .= " WHERE imdb_title_id = '".$id."' ";
$sql .= " GROUP BY imdb_title_id, imdb_name_id ";
$sql .= " ORDER BY imdb_title_id ";
$sql .= " ) AS T ";
$sql .= " ON (G.imdb_name_id = T.imdb_name_id) ";
// $sql .= "WHERE T.imdb_title_id = '".$id."' ";
// $sql .= "ORDER BY (no_episodes+0) DESC, surname ";
$sql .= "ORDER BY surname ";
# print "\n\n\n\n";
$result = $conn->query($sql);
if ($result === FALSE) {
die("BAD SQL in Guest by Status: $sql: " . $conn->_error);
} else {
// $row = $result->fetch_row();
$result = $conn->query($sql);
foreach ($result as $row) {
$fullname = $row['full_name'];
$imdb_id = $row['imdb_name_id'];
$charname = $row['char_name'];
$numepi = $row['no_episodes'];
$cancelflag = lookup_cancel($imdb_id);
$data[] = array(
'full_name' => $fullname,
'imdb_name_id' => $imdb_id,
// 'jobs_role' => $row['jobs_role'],
'char_name' => $charname,
'no_episodes' => $numepi,
'dc_page' => $row['dc_page'],
'no_image' => $row['no_image'],
'image_url' => $row['image_url'], // 2019 TO DO
'wof' => $row['wof'],
'photo_ops' => $row['photo_ops'],
'panels' => $row['panels'],
'infodays' => $row['infodays'],
'cancel' => $cancelflag,
'verify' => $row['verify']
);
}
}
return $data;
}
function numGuests() {
global $conn, $guestTbl, $guestStatusTbl, $event_id;
$noGuests = 0;
$sql = 'SELECT count(*) ';
$sql .= 'FROM '.$guestTbl."_".$event_id.' as G '; // 2019 CHANGE
$sql .= 'LEFT JOIN '.$guestStatusTbl."_".$event_id.' as S '; // 2019 CHANGE
$sql .= 'ON (G.imdb_name_id = S.imdb_name_id) '; // 2019 CHANGE
$sql .= 'WHERE ';
$sql .= " G.event_idx='".$event_id."' ";
$sql .= " AND G.verify=1 "; // 2019 CHANGE
$sql .= " AND S.removed<='2000-01-02'; "; // 2019 CHANGE - exclude cancelled.
$result = $conn->query($sql);
if ($result === FALSE) {
die("BAD SQL in num Guests: $sql: " . $conn->_error);
} else {
$row = $result->fetch_row();
$noGuests = $row[0];
}
return $noGuests;
}
/* TO DO 2018 - This would total all shows - not just current event */
function numTitles() {
global $conn, $titleTbl, $event_id;
$noTitles = 0;
$sql = "SELECT count(*) ";
$sql .= "FROM ".$titleTbl."_".$event_id." ";
$sql .= "WHERE 1";
// $sql .= " event_idx='".$event_id."' ";
$result = $conn->query($sql);
if ($result === FALSE) {
die("BAD SQL in num Title: $sql: " . $conn->_error);
} else {
$row = $result->fetch_row();
//$numTitle = mysqli_num_rows($result);
$noTitles = $row[0];
}
return $noTitles;
}
function TitleBarStatus() {
global $conn, $statusDate, $statusTbl;
// Check tables status
$sql = "SELECT status_code, status_msg, status_dt ";
$sql .= "FROM ".$statusTbl." ";
$result = $conn->query($sql);
if ($result === FALSE) {
print "BAD SQL in TitleBarStatus
";
print $sql;
} else {
$row = $result->fetch_row();
$statusDate = explode( ' ', $row[2] )[0];
if ($row[0] != 0) {
if ($row[0] == 1) {
echo "Is updating: ";
echo $row[2]."\n ";
} else {
echo "";
echo $row[1].": ";
echo $row[2]."\n ";
}
} else {
echo "Last Updated: ";
echo explode(' ',$row[2])[0]."\n ";
}
}
}
function composeMsg( $thecase, $id ) {
global $conn, $guestTbl, $titleTbl, $verseTbl, $event_id;
$msg = '';
if ($thecase == 'name') {
// print "\n\n\n\n";
if (substr($id,0,2) != 'nm') $id = substr(substr($id,9),-1);
$id = "(imdb_name_id='".str_replace(",","') or (imdb_name_id='",$id)."')";
$sql = "SELECT full_name ";
$sql .= "FROM ".$guestTbl."_".$event_id." ";
$sql .= "WHERE ".$id;
} elseif ($thecase == 'title') {
// print "\n\n\n\n";
if (substr($id,0,2) != 'tt') $id = substr(substr($id,10),-1);
$id = "(imdb_title_id='".str_replace(",","') or (imdb_title_id='",$id)."')";
$sql = "SELECT title ";
$sql .= "FROM ".$titleTbl."_".$event_id." ";
$sql .= "WHERE ".$id;
} elseif ($thecase == 'verse') {
// print "\n\n\n\n";
if (substr($id,0,3) == '(id') $id = substr(substr($id,5),0,-2);
$id = "(id='".str_replace(",","') or (id='",$id)."')";
$sql = "SELECT verse_title ";
$sql .= "FROM ".$verseTbl." ";
$sql .= "WHERE ".$id;
} else {
$sql = '';
}
if ($sql != '') {
$msg .= 'Check out what the Guests Info Portal has on ';
$result = $conn->query($sql);
if ($result === FALSE) {
die("BAD SQL statement
: $sql". $conn->error);
}
$row = $result->fetch_row();
$msg .= $row[0];
}
return $msg;
}
/* TO DO 2018: Change menu table to use idx vs id */
function dropdown_SortedBySurnameV3( $id ) {
global $conn, $guestTbl, $guestStatusTbl, $titlebyguest, $event_id;
$sql = "SELECT menu_html ";
$sql .= "FROM menu_by_event_id "; // 2018 TODO
$sql .= "WHERE ";
$sql .= " event_id='".$event_id."' AND ";
$sql .= " menu_case = 'guests_menu' ";
$result = $conn->query($sql);
if ($result === FALSE) {
die("BAD SQL statement
: $sql". $conn->error);
} else {
foreach ($result as $row) {
print $row['menu_html'];
}
}
}
/* TO DO 2018: Change menu table to use idx vs id */
function dropdown_SortedByTitleV3($id ) {
global $conn, $event_id;
$sql = "SELECT menu_html ";
$sql .= "FROM menu_by_event_id ";
$sql .= "WHERE ";
$sql .= " event_id='".$event_id."' AND ";
$sql .= " menu_case = 'titles_menu' ";
$result = $conn->query($sql);
if ($result === FALSE) {
die("BAD SQL statement
: $sql". $conn->error);
} else {
foreach ($result as $row) {
print $row['menu_html'];
}
}
}
/* TO DO 2018: Change menu table to use idx vs id */
function dropdown_SortedByVerseV3( $id ) {
global $conn, $verse, $event_id;
$sql = "SELECT menu_html ";
$sql .= "FROM menu_by_event_id ";
$sql .= "WHERE ";
$sql .= " event_id='".$event_id."' AND ";
$sql .= " menu_case = 'verses_menu' ";
$result = $conn->query($sql);
if ($result === FALSE) {
die("BAD SQL statement
: $sql". $conn->error);
} else {
foreach ($result as $row) {
print $row['menu_html'];
}
}
}
function getIMDBid( $index ) {
global $conn, $titleTbl, $event_id;
$sql = "SELECT imdb_title_id ";
$sql .= "FROM ".$titleTbl."_".$event_id." ";
$sql .= "WHERE id = '$index' ";
$result = $conn->query($sql);
if ($result === FALSE) {
die("BAD SQL statement
: $sql". $conn->error);
} else {
$row = $result->fetch_row();
return $row[0];
}
}
function list_names( $ppl, $options ) {
$list = '';
foreach ($ppl as $pers) {
$tmp = '';
// CHANGE index.php
$list .= '';
if ($pers['cancel'] > '2000-01-01 00:00:01') {
$list .= "".$pers['full_name']."";
} else {
$list .= $pers['full_name'];
}
$list .= hover_content( $pers, TRUE );
$list .= "";
if ($options != 'NamesOnly') {
// 2018 $list .= " ".credits_full($pers['jobs_role'],$pers['char_name'],$pers['no_episodes'],$options)."";
$list .= " ".credits_full("",$pers['char_name'],$pers['no_episodes'],$options)."";
}
$list .= ", ";
}
if ($options == 'NamesOnly') {
echo substr($list, 0, -2);
} else {
echo str_replace(', ','
',substr($list, 0, -2));
}
}
function get_no1_titleid( $html ) {
/*
$id = "";
$id = substr( $html, 0, (strpos( $html, '>')-1) );
$id = substr( $id , strrpos( $id, 'title_id=')+9);
return $id;
*/
// Updated for 2019
$id = "";
# find #nbsp;1) first
$id = strpos( $html, ' 1)' ); // Offset value
$id = substr( $html, 0, (strpos( $html, '>', $id)-1) );
$id = substr( $id , strrpos( $id, 'title_id=')+9);
print "\n\n";
return $id;
}
function get_poster($id) { // TO DO - FIX GLOBAL TABLES
global $conn, $titleTbl, $event_id;
$poster = "";
$sql = "SELECT poster ";
$sql .= "FROM ".$titleTbl."_".$event_id." ";
$sql .= "WHERE imdb_title_id='".$id."' ";
// print "\n\n";
$result = $conn->query($sql);
if ($result === FALSE) {
die("BAD SQL statement:
$sql
" . $conn->connect_error);
} else {
$row = $result->fetch_object();
$poster = $row->poster;
}
// print "\n\n";
return $poster;
}
function topNo_list() { // TO DO - FIX GLOBAL TABLES
global $conn, $TopNoCount, $titleTbl, $guestStatusTbl, $event_id;
$names = "";
$sql = "SELECT replace(title_search,',',',') as sh, no_guests as num, imdb_title_id as tid \n";
$sql .= "FROM ".$titleTbl."_".$event_id." \n";
$sql .= "WHERE imdb_title_id not in \n";
$sql .= " (SELECT imdb_title_id \n";
$sql .= " FROM dc_verse_details \n";
$sql .= " WHERE (id='11' or id='15' or id='90') ) \n"; # 90 - For duplicate shows.
$sql .= "ORDER BY no_guests DESC, genre desc \n";
$sql .= "LIMIT ".$TopNoCount." \n";
$result = $conn->query($sql);
if ($result === FALSE) {
die("BAD SQL statement:
$sql
" . $conn->connect_error);
} else {
#SMC2018_TOP12
$c = 1;
while($row = $result->fetch_object()) {
$ind = -5;
$names .= "';
if ($c < 10) { $names .= " $c) "; } else { $names .= "$c) "; }
$names .= 'sh,10),25,true,true); // TO DO MAGIC VALUE
$ind = 15;
$names .= "
';
$names .= "with ". $row->num . " guest";
# 2018-08-21 $names .= " with ". $row->num . " guest";
if ($row->num > 1) $name .= "s";
$names .= ".
";
$c++;
}
}
return $names;
}
function my_shorten( $name ) {
$nm = $name;
# For Cancellation Section
if ($nm == 'Alexandra Breckenridge') { $nm = 'A.Breckenridge'; }
if ($nm == 'Breckenridge, Alexandra') { $nm = 'Breckenridge, A'; }
if ($nm == 'Christopher Golden') { $nm = 'C.Golden'; }
# For Not all Weekend
if ($nm == 'Adams, Christine') { $nm = 'Adams, C'; }
if ($nm == 'Aghdashloo, Shohreh') { $nm = 'Aghdashloo, S'; }
if ($nm == 'Shohreh Aghdashloo') { $nm = 'S. Aghdashloo'; }
if ($nm == 'Ashmore, Aaron') { $nm = 'Ashmore, A'; }
if ($nm == 'Cavanagh, Tom') { $nm = 'Cavanagh, T'; }
if ($nm == 'Henstridge, Elizabeth') { $nm = 'Henstridge, E'; }
if ($nm == 'Elizabeth Henstridge') { $nm = 'E. Henstridge'; }
if ($nm == 'Klementieff, Pom') { $nm = 'Klementieff, P'; }
if ($nm == 'Lilly, Evangeline') { $nm = 'Lilly, E'; }
if ($nm == 'Evangeline Lilly') { $nm = 'E. Lilly'; }
if ($nm == 'Matarazzo, Gaten') { $nm = 'Matarazzo, G'; }
if ($nm == 'Gaten Matarazzo') { $nm = 'G. Matarazzo'; }
if ($nm == 'McLaughlin, Caleb') { $nm = 'McLaughlin, C'; }
if ($nm == 'Caleb McLaughlin') { $nm = 'C. McLaughlin'; }
if ($nm == 'Mitchell, Kenneth') { $nm = 'Mitchekk, K'; }
if ($nm == 'Morrison, Jennifer') { $nm = 'Morrison, J'; }
if ($nm == 'Jennifer Morrison') { $nm = 'Jen. Morrison'; }
if ($nm == 'Tipper, Dominique') { $nm = 'Tipper, D'; }
if ($nm == 'Dominique Tipper') { $nm = 'D. Tipper'; }
if ($nm == 'Williams, Nafessa') { $nm = 'Williams, N'; }
return $nm;
}
function GuestsNotAllWknd_list() { // NEED to add not cancelled
global $conn, $guestTbl, $guestStatusTbl, $event_id;
$names = "";
$sql = "SELECT concat(G.surname,', ',G.given_name) as thename, G.infodays, G.imdb_name_id "; // MAGIC VALUE for COMMA
$sql .= "FROM ".$guestTbl."_".$event_id. " as G ";
$sql .= "INNER JOIN ".$guestStatusTbl."_".$event_id." as S ";
$sql .= "ON (G.imdb_name_id=S.imdb_name_id) ";
$sql .= "WHERE ";
$sql .= " (G.infodays is not null and G.infodays != 'Fr-Mo' and G.infodays != '') AND ";
// $sql .= " ((S.removed='0000-00-00 00:00:00') OR (S.removed='2000-01-01 00:00:01')) AND ";
// $sql .= ' (G.event_idx=3) AND ';
$sql .= " (G.event_idx='".$event_id."') AND ";
$sql .= " (S.removed <= '2000-01-01 00:00:02') ";
$sql .= "ORDER BY G.Surname, G.given_name ";
$result = $conn->query($sql);
if ($result === FALSE) {
die("BAD SQL statement:
$sql
" . $conn->connect_error);
} else {
$c = 1;
$row_cnt = $result->num_rows;
$names = '';
if ($row_cnt > 20) { $names .= "\n\n"; }
$ind = -9;
while($row = $result->fetch_object()) {
if ($row_cnt > 20) {
if ($c == 1) {
$names .= " \n";
}
if ($c == 20) {
$names .= " \n";
$names .= " | \n";
$names .= "\n";
$names .= "\n |
\n";
}
}
return $names;
}
function guest_favs() {
global $conn, $guestTbl, $event_id;
// 2018-AUG-13
$names = '';
$ckievar = 'GIP_'.$event_id.'_myFavs'; # 2019 TO DO
# $myFavs = isset($_COOKIE["GIP_2_myFavs"]) ? $_COOKIE["GIP_2_myFavs"] : "";
$myFavs = isset($_COOKIE[$ckievar]) ? $_COOKIE[$ckievar] : ""; # 2019 TO DO
# $gotFavs= isset($_COOKIE["GIP_2_gotFavs"] ? $_COOKIE["GIP_2_myFavs"] : "";
print "\n\n";
if ($myFavs != '') {
$id = str_replace(",", "' or imdb_name_id='", $myFavs );
$sql = "SELECT * ";
$sql .= "FROM ".$guestTbl."_".$event_id." ";
$sql .= "WHERE imdb_name_id = '".$id."' ";
print "\n\n";
$result = $conn->query($sql);
if ($result === FALSE) {
die("BAD SQL in Guest fav:
$sql
" . $conn->connect_error);
} else {
$c = 1;
$row_cnt = $result->num_rows;
if ($row_cnt > 20) { $names .= "\n\n"; }
$ind = -10;
while($row = $result->fetch_object()) {
if ($row_cnt > 20) {
if ($c == 1) {
$names .= " \n";
}
if ($c > 1) $names .= ','; # MAGIC VALUE
if ($c == 20) {
$names .= " \n";
$names .= " | \n";
$names .= "\n";
$names .= "\n |
\n";
}
}
}
if ($names=='') { $names = 'No Favourites Selected.'; }
return $names;
}
function guest_new() {
global $conn, $ShowLastNewGuests, $guestTbl, $guestStatusTbl, $event_id;
$c = 0;
$names = '';
$sql = 'SELECT ';
$sql .= ' S.imdb_name_id, ';
$sql .= ' S.full_name, ';
$sql .= " date_format(S.created,'%b-%d') as cr ";
$sql .= 'FROM '.$guestStatusTbl."_".$event_id.' as S ';
$sql .= 'INNER JOIN '.$guestTbl."_".$event_id.' as G ';
$sql .= 'ON (S.imdb_name_id=G.imdb_name_id) ';
$sql .= "WHERE (S.removed < '2000-01-01 00:00:02') AND ";
$sql .= ' G.verify=1 AND '; // 2019 from >0 to =1
// $sql .= ' G.event_idx=3 ';
$sql .= " G.event_idx='".$event_id."' ";
$sql .= 'ORDER BY S.created DESC ';
# print "\n\n\n";
$result = $conn->query($sql);
if ($result === FALSE) {
die("BAD SQL statement:
$sql
" . $conn->connect_error);
} else {
$names = '';
while($row = $result->fetch_object()) {
if ($c <= $ShowLastNewGuests) { // MAGIC VALUE make GLOBAL
if ($names != '') { $names .= ','; } else { $names = "\n";
}
return $names;
}
function guest_cancel() {
global $conn, $guestStatusTbl, $event_id;
$c = 0;
$names = '';
$sql = 'SELECT ';
$sql .= ' imdb_name_id, ';
$sql .= ' full_name, ';
$sql .= ' dc_page, ';
$sql .= " date_format(removed,' %m-%d') as re ";
$sql .= 'FROM '.$guestStatusTbl."_".$event_id.' ';
$sql .= "WHERE removed > '2000-01-01 00:00:01' AND ";
// $sql .= ' event_idx=3 ';
$sql .= " event_idx='".$event_id."' "; // 2019 TODO set verify=1
$sql .= 'ORDER BY removed DESC ';
$result = $conn->query($sql);
if ($result === FALSE) {
die("BAD SQL statement:
$sql
" . $conn->connect_error);
} else {
while($row = $result->fetch_object()) {
if ($c <= 9) {
if ($names != '') $names .= ',';
$names .= 'full_name);
// 2019 the following line was uncommented
$names .= hover_content( $row->imdb_name_id, FALSE ); // 20190601
$names .= "";
//$names .= ' ('. explode(' ',$row->removed)[0] . ')';
$names .= ' ('.str_replace('-0','-',str_replace(' 0','',$row->re)).')';
}
$c++;
}
}
if ($c > 10) { $names .= " ..."; }
return $names;
}
/* TO DO 2018 */
function hover_content( $pers, $have_details) {
global $conn, $guestTbl, $event_id, $WOFURL, $WOFTxt, $PhotoOpsMethod, $PhotoOpsURL, $PhotoOpsTxt;
global $comingsoon_path, $comingsoon_icon, $inc_wof_map_link, $inc_photo_ops_link;
$sql = '';
$html = '';
if ( !$have_details ) {
$sql .= 'SELECT imdb_name_id, full_name, given_name, surname, ';
$sql .= ' dc_page, no_image, wof, photo_ops, panels, ';
$sql .= ' verify, infodays, image_url ';
$sql .= 'FROM '.$guestTbl."_".$event_id.' ';
$sql .= 'WHERE imdb_name_id="'.$pers.'"';
# print "\n\n";
$result = $conn->query($sql);
if ($result === FALSE) {
die("BAD SQL in hover_content: $sql: " . $conn->_error);
} else {
foreach ($result as $pers) { }
}
//$pers = $result->fetch_row();
}
if ( is_array($pers) ) {
$html .= ''.$pers['full_name'];
# $html .= "\n";
if ($pers['cancel'] > '2000-01-01 00:00:01') {
$html .= ' CANCELLED';
}
$html .= '
';
$html .= '';
// Table - with Image and details
// FULL_NAME CANCELLED
// +------------------+-----+------+
// | |Bio | 2 opt | 1 - add option if verify <>1 then hide imdb link
// | +-----+------+
// | |Fav |( )(X)| 2
// | +-----+------+
// | |char | | 3
// | +-----+------+
// | |#eps | | 4
// | +-----+------+
// | | WOF | | 5
// | +-----+------+
// | |Panel| | 6
// +------------------+-----+------+
// | Day Limits |P.ops| | 7
// +------------------+-----+------+
$html .= '';
$html .= '
';
// Image
if ($pers['no_image'] == 1) {
if ($pers['image_url']=='NF') {
$tmp = $comingsoon_path . $comingsoon_icon;
} else {
$tmp = $pers['image_url'];
}
} else {
$tmp = "http://dragoncon.org/images/guest-photos/fg".$pers['dc_page'].".jpg";
}
$html .= ' ';
$html .= ' | ';
$html .= ' Bio.s: | ';
if ($pers['verify']==1) { # Added 2019
$html .= ' IMDB';
$html .= ' · ';
}
# 20190724 $html .= ' DC';
$html .= ' DC';
$html .= ' |
';
// ==================================================================
// 2017-AUG-09: Favourites and Cookies
// 2019-JUN-24: Favourite on new line.
$html .= ' Favs. | ';
$html .= ' ';
$ckievar = 'GIP_'.$event_id.'_myFavs'; # 2019 TODP
# 2019 if (isset($_COOKIE['GIP_2_myFavs'])) {
if (isset($_COOKIE[$ckievar])) { # 2019 TODP
# $html .= '';
# 2019 if ( strpos($_COOKIE["GIP_2_myFavs"], $pers['imdb_name_id']) === false ) {
if ( strpos($_COOKIE[$ckievar], $pers['imdb_name_id']) === false ) { # 2019 TODP
// SAME AS OUTSIDE ELSE BELOW - look at making common
# 2019 $html .= ' · ';
$html .= ' |
';
if ($pers['no_episodes'] == 0) {
$html .= ' | |
'; // Movie or video game or something with no count.
} else {
$html .= '# eps.: | ';
$html .= $pers['no_episodes']." |
";
}
} else {
$html .= ' |
';
$html .= ' |
';
}
if ($inc_wof_map_link) {
$wofpos = get_pos_by_name_id($pers['imdb_name_id']);
if ($wofpos == "") {
if ($pers['wof']=='') {
$html .= 'auto: | - |
';
} else {
$html .= 'auto: | '.$pers['wof'].' |
';
}
} else {
$html .= 'auto: | ';
if ($pers['wof']=='') {
$html .= 'Pos. #'.$wofpos.'';
} else {
$html .= ' | Pos. #'.$wofpos.' '.$pers['wof'];
}
# if ($pers['wof']=='') {
# $html .= ''.$WOFTxt.'';
# } else {
# $html .= ''.$pers['wof'].'';
# }
$html .= ' |
';
}
} else {
if (($pers['wof'] != '') && ($pers['wof'] != 'TBD') && ($pers['wof'] != 'TBA') && ($pers['wof'] != 'N/A')) {
$html .= 'auto: | '.$pers['wof'].' |
'; # Special Note
} else {
$html .= 'auto: | |
';
}
}
if ($pers['panels']!='') {
$html .= 'panels: | '.$pers['panels'].' |
';
} else {
$html .= 'panels: | |
';
}
if ($inc_photo_ops_link) {
if ($PhotoOpsMethod == '1') {
$html .= ''.$pers['infodays'].' | P.Ops: | ';
if ($pers['photo_ops']=='') {
$html .= ''.$PhotoOpsTxt.' ';
} else {
$html .= $pers['photo_ops'];
$html .= ': '.$PhotoOpsTxt.' ';
}
$html .= ' |
';
} else {
$html .= '
|
';
$html .= 'P.Ops: ';
if ($pers['photo_ops']=='') {
$html .= ' '.$PhotoOpsTxt.' ';
} else {
$html .= $pers['photo_ops'];
// $html .= ': ';
}
$html .= ' |
';
}
} else {
$html .= ''.$pers['infodays'].' | photos: | |
';
}
$html .= ' Unofficial: All info. subject to change. |
';
$html .= '
';
$html .= '';
$html .= '';
}
return $html;
}
function credits_as_actor($j,$c,$e,$options) {
$res = '';
$s = count($j);
// $res .= " [$s]-- ";
for($i=0;$i<$s;$i++) {
$job = trim(strtolower($j[$i]));
// $res .= " job=[$job]-- ";
if (($job=='actor') || ($job=='actress')) {
$char = trim($c[$i]);
$no = trim($e[$i])+0;
// $res .= "char=[$char],no=[$no]";
if ( strpos($options, 'EpisodeOnly') === false) { // [anything]EpisodeOnly
if (($char=='') || ($char=='NF')) {
// No character info found
} else {
$res .= " as ".$char;
}
}
if ($no>1) { // Don't want 0 episodes or 1 episode
if (strpos($options,'ShortEpisode') === false) { // ShortEpisode[anything]
$res .= " in $no episodes. ";
} else {
$res .= " - $no eps.";
}
}
}
}
return trim($res);
}
function credits_other($j, $c, $e, $cs) {
$res = '';
$s = count($j);
for($i=0;$i<$s;$i++) {
$job = trim(strtolower($j[$i]));
//print "\n";
if (($job!='actor') && ($job!='actress')) { // Ignore the Actor Section
if ($res != "") {
$res .= ", ".trim($job); // 44 is a comma - avoid explode.
} else {
$res .= trim($job);
}
}
}
// print "\n";
return trim($res);
}
function credits_full($jobs,$chars,$eps,$options) {
global $magicSEP; //SMC
//print "\n\n\n";
$j = explode($magicSEP, $jobs);
$c = explode($magicSEP, $chars);
$e = explode($magicSEP, $eps);
$r = "";
$s = count($j);
if (($options != 'NoCharInfo') && ($options != 'NamesOnly')) {
// ShortEpisode[anything] - episode info will be '- ## eps.'
// [anything]EpisodeOnly - only include episode details no character
$r .= credits_as_actor($j,$c,$e,"ShortEpisode");
$tmp = credits_other($j,$c,$e,"NothingAtThisTime");
if (($r != "") && ($tmp != "")) {
$r .= " and ".$tmp."";
} else {
if (($r == "") && ($tmp != "")) {
$r .= " as ".$tmp."";
}
}
} else {
if ($options == 'NoCharInfo') {
// $r = credits_other($j,$c,$e,"NothingAtThisTime");
$r = credits_as_actor($j,$c,$e,"ShortEpisodeOnly");
}
}
return trim($r);
}
function myFavs_bubble( $r ) {
global $statusDate, $DC_Logo, $event_id;
$row = new bubble();
$row->title = 'Your Favourites';
$row->year = '';
$row->genre = 'Guests you\'ve selected:';
$row->imdb_title_id = guest_favs();
$row->poster = $DC_Logo;
$row->include_plot = false;
$row->plot = '';
$row->type = 'info';
$row->runtime = '';
$ckievar = 'GIP_'.$event_id.'_myFavs'; # 2019 TODO
# 2019 $myFavs = $_COOKIE["GIP_2_myFavs"];
$myFavs = $_COOKIE[$ckievar]; # 2019 TODO
if ($myFavs == '') {
$row->footer_msg='';
} else {
$row->footer_msg='Show FAVS on WOF';
}
return $row;
}
function guest_update_bubble( ) {
global $statusDate, $DC_Logo, $event_fullname;
$row = new bubble();
$row->title = ''.$event_fullname.' Guests Status';
$row->year = '';
$row->genre = 'Recently Added';
// if ($statusDate != 'Not Set') $row->genre .= " as of ".$statusDate;
$row->imdb_title_id = guest_new();
// $row->poster = 'http://froggysphotos.com/logos/Dragoncon2015a.jpg'; // TO DO - FIX ME 2017
$row->poster = $DC_Logo;
$row->plot = guest_cancel();
$row->type = 'info';
$row->runtime = '';
return $row;
}
function TopNo_bubble() {
global $statusDate, $TopNoCount;
$row = new bubble();
$row->title = 'Top '.$TopNoCount.'*';
$row->year = '';
$row->genre = ' Shows by # of Guests';
$list = topNo_list();
$row->imdb_title_id = $list;
$row->poster = get_poster(get_no1_titleid($list));
$row->include_plot = false;
$row->plot = '';
$row->type = 'info';
$row->runtime = '';
$row->footer_msg='* list excludes talk shows.';
return $row;
}
function GuestsNotAllWknd_bubble () {
global $DC_Logo, $calendar_path, $calendar_icon;
$row = new bubble();
$row->title = 'Guests NOT expected all Wknd**';
$row->year = '';
$row->genre = ' Guest & days expected:';
$list = GuestsNotAllWknd_list();
$row->imdb_title_id = $list;
// TO DO 2019
$row->poster = $calendar_path . $calendar_icon; // TO DO 2018 - another paramter
# print "
\n\n\n\n
";
$row->include_plot = false;
$row->plot = '';
$row->type = 'info';
$row->runtime = '';
$row->footer_msg='** This may NOT be a FULL list.';
return $row;
}
function include_javascript() {
echo ''; echo "\n";
}
function news_bubble() {
echo 'DC: GIP - UPDATES
';
echo '';
}
function populate_guests_bubbles( $row, $countno=0, $max=0 ) {
global $noGuests, $noTitles, $DC_url_GuestByDate,
$event_id, $inc_wof_map_link,
$comingsoon_path, $comingsoon_icon;
# echo "\n\n';
# 2019 if ( strpos($_COOKIE["GIP_2_myFavs"], $row->imdb_name_id) === false ) {
if ( strpos($_COOKIE[$ckievar], $row->imdb_name_id) === false ) { # 2019 TODO
// SAME AS OUTSIDE ELSE BELOW - look at making common
$html .= '';
} else {
$html .= '';
}
} else {
// SAME AS ELSE ABOVE - look to make common
$html .= '';
}
// END 2018-AUG-29: Favourites and Cookies
// ==================================================================
# echo "[$html] --> \n\n";
// TITLE (optional year)
# echo $html."\n";
echo '';
// Poster
echo '';
# echo '\n\n';
if ((substr($row->image_url,0,4) != 'http') || ($row->use_dc_image == 1)) {
if ($row->no_image == 0) {
# echo '
';
echo "\n";
} else {
echo '
';
# 2019 echo ' src="http://www.vex.net/~schrist/dcgip/images/posterPlaceholder.jpg">';
# if (substr($row->image_url,0,4) == 'http') { # 2019 New
# echo ' src="'.$row->image_url.'">'; # 2019 New
# } else { # 2019 New
echo ' src="'.$comingsoon_path.$comingsoon_icon.'">';
# } # 2019 New
}
} else {
# 201907f list($wi, $he, $ty, $at) = getimagesize( $row->image_url );
# $alt = "[$wi]x[$he] [$ty]";
echo '
';
}
echo '
';
$outp = "";
echo '';
if (($row->knownFor != '') || ($row->manual_knownFor != '')) {
$outp .= '
Known for:
';
if ($row->knownFor != '') {
$outp .= $row->knownFor;
}
if ($row->manual_knownFor != "") {
if ($row->knownFor != '') {
$outp .= ",
\n";
}
$outp .= $row->manual_knownFor;
}
} else {
$outp .= " ";
}
$outp = inject_guest_count( $outp );
echo $outp;
echo '
';
// Footer
echo '';
echo '
';
$needcomma = FALSE;
$notes = "";
if (($row->infodays != '') && ($row->infodays != 'Fr-Mo')) {
$notes .= "Note: ".$row->infodays."";
}
# if ($show_one_degree) {
# $tmp_1 = "";
$tmp_1 = guests_one_degree( $row->imdb_name_id );
if ($tmp_1 != '') {
if ($notes != "") { $notes .= " "; }
$notes .= "Map 1 degree on WOF";
}
# }
if ($notes == "") { $notes = " "; }
echo $notes;
// This shows <10 / 200>
if ($countno != 0) {
echo '
<'.$countno.'/'.$max.'>
';
}
echo '
';
#---
}
function populate_bubble( $row, $countno=0, $max=0 ) {
global $noGuests, $noTitles, $DC_url_GuestByDate, $inc_wof_map_link,$event_fullname;
// iF called without using the bubble class then set defaults
if (isset($row->include_title)) {} else { $row->include_title = true; }
if (isset($row->include_plot)) {} else { $row->include_plot = true; }
if (isset($row->include_cancel)) {} else { $row->include_cancel = true; }
if (isset($row->include_footer)) {} else { $row->include_footer = true; }
if (isset($row->include_imdb)) {} else { $row->include_imdb = true; }
if (isset($row->include_counter)) {} else { $row->include_counter = true; }
// TITLE (optional year)
echo ''.trunc_str($row->title,42,TRUE,TRUE); // MAGIC VALUE add to Globales
if ($row->year != '') {
echo ' ('.$row->year.')
';
} else {
echo '';
}
// Genre Section.- Removed 2017
// echo '';
// $genres = explode(', ',$row->genre);
// $genresOut = '';
// foreach ($genres as $g) {
// $genresOut .= $g.', ';
// }
// echo substr($genresOut, 0, -2);
// echo '
';
// Poster
echo '';
if ( ($row->poster == "N/A") ||
($row->poster == 'NA') ||
($row->poster == '') ||
(substr($row->poster,-2)=='NF') ) {
echo '
';
echo ' src="http://www.vex.net/~schrist/dcgip/images/posterPlaceholder.jpg">';
} else {
echo '
';
}
echo '
';
// CAST or Body
echo '';
if ($row->type != 'info') {
echo '
Cast/Guest Star @ '.$event_fullname.'
';
$ppl = array();
$ppl = guests_by_title_id($row->imdb_title_id);
$list = '';
$noPPL = count( $ppl );
if ($noPPL > 12) // MAGIC VALUE make GLOBAL
list_names( $ppl, 'NamesOnly' );
else
if ( ($noPPL >= 8) && ($noPPL <= 12) ) // MAGIC VALUE make GLOBAL
list_names( $ppl, 'NoCharInfo' );
else
list_names( $ppl, '');
} else {
// echo '
Recently Added
';
echo '
'.$row->genre.'
';
$l = '';
if ($row->imdb_title_id == '') {
echo 'None to date.';
} else {
// If $imdb_title_id is seperated by commas, then we listed.
// If recently added we add a dot dot dot to end... Need to make a working linke
// Otherwise just put out the value passed.
$adds = explode(',',$row->imdb_title_id);
foreach ($adds as $a) {
$l .= $a.'
';
}
if (strtolower($row->genre)=='recently added') {
$l .= '
···'; // NEW 2017
}
echo $l;
}
}
echo '
';
if ($row->include_plot) {
echo '';
if ($row->type != 'info') {
echo '
Plot
';
if (($row->plot != 'NF') && ($row->plot != '')) {
echo '
'.trunc_str($row->plot,225,TRUE,TRUE).'
';
} else {
echo '
N/A.
';
}
} else {
$l = '';
if ($row->include_cancel) {
echo '
CANCELLATIONS
';
if ($row->plot == '') {
echo 'None to date.';
} else {
$n = 0;
$cancel = explode(',',$row->plot);
$noCancel = count( $cancel );
foreach ($cancel as $c) {
$l .= $c;
$n++;
if ($noCancel > 5) {
if ($n % 2 == 0) $l .= '
';
else $l .= ', ';
} else {
$l .= '
';
}
}
echo $l;
}
}
}
echo '
';
} else {
// Set aside the space - just empty.
echo '';
echo '
';
}
// Footer
if ($row->include_footer) {
echo '';
echo '
';
# echo '
';
$needcomma = FALSE;
// This adds an IMDB link if title ID
if (($row->type != 'info') && ($row->include_imdb)) {
if ($needcomma == TRUE) echo ', ';
echo 'IMDB';
if ($inc_wof_map_link == TRUE) {
echo " · ";
# 2018 echo 'Show cast on WOF';
echo 'Show cast on WOF';
}
} else {
if ($row->footer_msg!='') {
echo $row->footer_msg;
} else {
echo $noGuests." guests with ".$noTitles." IMDB entries. ";
}
}
if (($row->type != 'info') && ($row->include_counter)) {
// This shows <10 / 200>
if ($countno != 0)
echo '<'.$countno.'/'.$max.'>
';
}
echo '
';
echo '
';
} else {
echo '';
echo '
';
echo "
NOT IN USE AT THIS TIME
";
echo '
';
}
}
# New and simplier now that we have a field.
function count_guest_per_show ( $id ) {
global $conn, $titleTbl, $event_id;
$num = 0;
$sql = "SELECT no_guests as nmbr \n";
$sql .= "FROM ".$titleTbl."_".$event_id." \n";
$sql .= "WHERE imdb_title_id='".$id."' \n";
$result = $conn->query($sql);
if ($result === FALSE) {
die("BAD SQL COUNT guests per show statement:
$sql
" . $conn->connect_error);
} else {
$row = $result->fetch_object();
$num = $row->nmbr;
}
return $num;
}
function inject_guest_count( $htm ) {
$bgnFind = "title_id=";
$endFind = "";
$pos = strpos($htm, "title_id=");
if ($pos === FALSE) {
# echo"\n\n";
} else {
$c = 0;
$tmp = explode('title_id=',$htm);
foreach( $tmp as $t) {
if ($c > 0) {
$t1 = explode('"',$t);
$t1 = $t1[0];
if (substr($t1,0,2) == 'tt') {
$no = 0;
$no = count_guest_per_show( $t1 );
if ($no >=2) {
$beg = strpos($htm, $bgnFind.$t1);
$end = strpos($htm, $endFind,$beg+1);
$fnd = substr($htm, $beg, ($end-$beg+strlen($endFind)) );
$aft = str_replace( $endFind, " ($no guests)", $fnd );
$htm = str_replace( $fnd, $aft, $htm );
# echo "\n\n";
}
}
}
$c++;
}
}
return $htm;
}
// ----------------------------------------------------------------
// Globals
$advert = FALSE;
$host = $_SERVER['SERVER_NAME'];
if (array_key_exists('SCRIPT_URI', $_SERVER)) $doc_uri = $_SERVER['SCRIPT_URI']; else $doc_uri = '';
if (array_key_exists('HTTP_REFERER', $_SERVER)) $doc_ref = $_SERVER['HTTP_REFERER']; else $doc_ref = '';
$their_ip =$_SERVER['REMOTE_ADDR'];
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
echo ' ';
die("Connection failed: System Message=(" . $conn->connect_error.") ");
} else {
// MAIN CODE - After we connected to Database
// -----------------------------------------------------------
// Start Layout.
echo ' ';
echo "\n";
$FLAG_BYNAME = '';
$FLAG_BYTTLE = '';
$FLAG_BYVERS = '';
$BY = '';
$id = '';
$case = '';
$statusDate = 'Not Set';
$noGuests = numGuests();
$noTitles = numTitles();
if (array_key_exists('submit_title',$_POST)) $case = "ByTitle";
elseif (array_key_exists('submit_name',$_POST)) $case = "ByName";
elseif (array_key_exists('submit_verse',$_POST)) $case = "ByVerse";
elseif (isset($_GET['showallguests'])) $case = "AllGuests";
elseif (isset($_GET['showtitles'])) $case = "ShowTitles";
else $case = '';
$passed = $_SERVER["QUERY_STRING"];
$procedural = $_POST["procedural"];
# print "\n";
//if (isset($_POST["imdb_title_id"])) {
if ($case != '') {
# print "\n";
if ($case == 'ByTitle') {
$BY = 'TITLE';
$keyfield = 'imdb_title_id';
$id = ($_POST['imdb_title_id']);
$sql = "SELECT * ";
$sql .= "FROM ".$titleTbl."_".$event_id." ";
$sql .= "WHERE imdb_title_id = '$id' ";
$sql .= "ORDER BY year DESC";
$FLAG_BYTTLE = 'title_id='.$id;
} elseif ($case == 'ByName') {
$BY = 'GUEST';
$keyfield = 'imdb_name_id';
$id = ($_POST['imdb_name_id']);
$sql = "SELECT * ";
$sql .= "FROM ".$titleTbl."_".$event_id." as T ";
$sql .= "JOIN ( ";
$sql .= " SELECT imdb_title_id,imdb_name_id, ";
$sql .= " group_concat(char_name SEPARATOR '||') as chars, ";
$sql .= " group_concat(no_episodes SEPARATOR '||') as no_epis ";
$sql .= " FROM ".$titlebyguestTbl."_".$event_id." ";
$sql .= " GROUP BY imdb_title_id, imdb_name_id ";
$sql .= ") AS G ";
$sql .= " ON ( T.imdb_title_id = G.imdb_title_id ) ";
$sql .= "WHERE imdb_name_id = '$id' ";
$sql .= "ORDER BY year DESC";
$FLAG_BYNAME = 'name_id='.$id;
} elseif ($case == 'ByVerse') {
$BY = 'TITLE';
$keyfield = 'imdb_title_id';
$id = ($_POST['verse_id']);
$sql = "SELECT * ";
$sql .= "FROM ".$verseDetailsTbl." ";
$sql .= "WHERE id = '$id' ";
$tmp = '';
$result = $conn->query($sql);
if ($result === FALSE) {
die("BAD SQL in Main: $sql: " . $conn->_error);
} else {
foreach ($result as $row) {
$tmp .= " (imdb_title_id='".$row['imdb_title_id']."') or";
}
}
$tmp = substr($tmp, 0, -3);
$sql = "SELECT * ";
$sql .= "FROM ".$titleTbl."_".$event_id." ";
$sql .= "WHERE (". $tmp .") ";
$sql .= "ORDER BY year DESC";
$FLAG_BYVERS = 'verse_id='.$id;
} elseif ($case == 'AllGuests') {
# $BY = 'GUEST';
$sql = "SELECT \n";
$sql .= " G.full_name as full_name, G.given_name as given_name, G.surname as surname, \n";
$sql .= " G.imdb_name_id as imdb_name_id, \n";
$sql .= " G.infodays as infodays, G.use_dc_image as use_dc_image, \n";
$sql .= " G.dc_page as dc_page, G.image_url as image_url, G.no_image as no_image, \n";
$sql .= " G.knownFor as knownFor, G.manual_knownFor, G.verify as verify \n";
$sql .= "FROM ".$guestTbl."_".$event_id." as G \n";
$sql .= "LEFT JOIN ".$guestStatusTbl."_".$event_id." as ST \n";
$sql .= "on (G.imdb_name_id=ST.imdb_name_id) \n";
$sql .= "WHERE ";
$sql .= " G.event_idx='".$event_id."' AND ";
$sql .= " G.flag='1' AND G.verify='1' AND G.knownFor is NOT NULL AND \n";
$sql .= " ST.removed <= '2011-01-01' \n ";
$sql .= "ORDER BY G.surname \n";
# print "\n";
$result = $conn->query($sql);
if ($result === FALSE) {
die("BAD SQL in Main-All Guests: $sql: " . $conn->_error);
}
$id = explode('=',$passed);
$id = $id[1]+0;
$keyfield = 'imdb_title_id';
} elseif ($case == 'ShowTitles') {
# $BY = 'TITLE';
$id = explode('=',$passed);
$id = $id[1]+0;
$keyfield = 'imdb_title_id';
# TIP source: https://stackoverflow.com/questions/11433852/order-by-sorting-characters-before-numbers
$sql = "SELECT * \n";
$sql .= "FROM ".$titleTbl."_".$event_id." \n";
$sql .= "WHERE no_guests >= $id \n";
$sql .= "ORDER BY \n";
$sql .= " IF (title_search REGEXP '^[A-Z,0-9]+', \n";
$sql .= " IF(title_search regexp '^[A-Z]', \n";
$sql .= " title_search, \n";
$sql .= " concat('ZZX_',title_search) \n";
$sql .= " ), \n";
$sql .= " CONCAT('ZZZ_',title_search) \n";
$sql .= " ) \n";
# print "\n";
$result = $conn->query($sql);
if ($result === FALSE) {
die("BAD SQL in Main-All Guests: $sql: " . $conn->_error);
}
}
} else { # ELSE IF case IS blank - did we pass a value? (name_id= or title_id=)
# print "\n";
if ($passed != '') {
$tmp = array();
$tmp = explode( '=', $passed );
if (count($tmp) == 2) {
$case = $tmp[0];
$id = $tmp[1];
}
# print "passed = [$passed], case = [$case], id=[$id]
\n";
if ($case == 'name_id') {
$BY = 'GUEST';
$keyfield = 'imdb_name_id';
if (strpos($id,'status') === FALSE) {
# Do Nothing
} else {
$advert = TRUE;
$id = str_replace('status','',$id);
}
$FLAG_BYNAME = 'name_id='.$id;
$sql = "SELECT * ";
$sql .= "FROM ".$titleTbl."_".$event_id." as T ";
$sql .= "JOIN ( ";
$sql .= " SELECT imdb_title_id,imdb_name_id, ";
$sql .= " group_concat(char_name SEPARATOR '||') as chars, ";
$sql .= " group_concat(no_episodes SEPARATOR '||') as no_epis ";
$sql .= " FROM ".$titlebyguestTbl."_".$event_id." ";
$sql .= " GROUP BY imdb_title_id, imdb_name_id ";
$sql .= ") AS G ";
$sql .= " ON ( T.imdb_title_id = G.imdb_title_id ) ";
$sql .= "WHERE imdb_name_id = '$id' ";
$sql .= "ORDER BY year DESC";
} else if ($case == 'title_id') {
# Handle http://localhost/xampp/dcgip/index.php?title_id=tt0076984,tt0407362
# TEST: http://localhost/xampp/dcgip/index.php?title_id=tt0076984,tt0407362,tt2661044
$BY = 'TITLE';
$keyfield = 'imdb_title_id';
if (strpos($id,'status') === FALSE) {
# Do Nothing
} else {
$advert = TRUE;
$id = str_replace('status','',$id);
}
$FLAG_BYTTLE = 'title_id='.$id;
$id = "(imdb_title_id='".str_replace(",","') or (imdb_title_id='",$id)."')";
$sql = "SELECT * ";
$sql .= "FROM ".$titleTbl."_".$event_id." ";
$sql .= "WHERE $id ";
$sql .= "ORDER BY year DESC";
# print "\n\n\n\n";
} else if ($case == 'verse_id') {
$BY = 'TITLE';
$keyfield = 'imdb_title_id';
if (strpos($id,'status') === FALSE) {
# Do Nothing
} else {
$advert = TRUE;
$id = str_replace('status','',$id);
}
$FLAG_BYVERS = 'verse_id='.$id;
$id = "(id='".str_replace(",","') or (id='",$id)."')";
$sql = "SELECT * ";
$sql .= "FROM ".$verseDetailsTbl." ";
$sql .= "WHERE $id ";
$tmp = '';
$result = $conn->query($sql);
if ($result === FALSE) {
die("BAD SQL in Main verse: $sql: " . $conn->_error);
} else {
foreach ($result as $row) {
$tmp .= " (imdb_title_id='".$row['imdb_title_id']."') or";
}
}
$tmp = substr($tmp, 0, -3);
$sql = "SELECT * ";
$sql .= "FROM ".$titleTbl."_".$event_id." ";
$sql .= "WHERE (". $tmp .") ";
$sql .= "ORDER BY year DESC";
# print "\n\n\n\n";
} else if ($case == 'option') {
# print "\n\n";
# 2017-AUG-11 - NEW FAVOURITES
$ckievar = 'GIP_'.$event_id.'_myFavs'; # Unique to EventID
if ($id == 'myFavs') {
print "\n\n";
if (isset($_COOKIE[$ckievar]) ) {
$myFavs = $_COOKIE[$ckievar]; # Show the Favourites that exist
print "\n\n";
if ($myFavs != '') {
$BY = 'XGUEST';
$keyfield = "favs";
$id = str_replace(",", "' or imdb_name_id='", $myFavs );
$sql = "SELECT * FROM ".$guestTbl."_".$event_id." WHERE imdb_name_id = '".$id."' ";
print "\n\n";
} else {
print "\n\n";
$BY = 'COOKIE';
$keyfield = "favs";
$id = "NOCOOKIE";
$sql = "SELECT * FROM ".$guestTbl."_".$event_id." WHERE imdb_name_id = '' ";
print "\n\n";
}
} else {
print "\n\n"; # No favourites - show a message to set favourite
$BY = 'COOKIE';
$keyfield = "favs";
$id = "NOCOOKIE";
$sql = "SELECT * FROM ".$guestTbl."_".$event_id." WHERE imdb_name_id = '' ";
print "\n\n";
}
} else {
print "\n\n"; # Other - something else - not defined yet
$id = '';
}
} else {
$id = '';
} # End of passed value - name_id, title_id, verse_id or favourites
} # Passed is NOT BLANK
}
if ($id == '') { # No values set - therefore default set of bubbles
$BY = "TITLE";
$advert = TRUE;
$id = mt_rand ( 0 , $noTitles );
$sql = "SELECT * ";
$sql .= "FROM ".$titleTbl."_".$event_id." ";
$sql .= "WHERE id = '$id' and id='123'; "; # SHOW NOTHING
$id = getIMDBid( $id );
}
# print "\n\n\n\n";
$r = $conn->query($sql);
if ($r === FALSE) {
die("BAD SQL in Main Default: $sql: " . $conn->_error);
}
echo '
\n";
# SMC 2019-06-25 TO BE CONTINUED INDENTS
$max = mysqli_num_rows($r);
#print "\n\n";
if (($max) || ($id=='NOCOOKIE')) {
if ($keyfield != 'favs') {
# STANDARD BUBBLE DISPLAY SECTION
$counter = 0;
print "\n\n\n\n";
if ( (strtolower(substr($passed,0,13))=="showallguests") ) {
#SMC2018 -- NEW
if ($id==1) {
print "\n\n\n\n";
while($row = $r->fetch_object()) {
echo '';
populate_guests_bubbles( $row, ($counter+1), $max );
echo "\n";
$counter++;
}
} else {
$table_width=940;
if ($screen_width >= 940) {
$per_col = round($max/4)+1;
} else {
$per_col = $max;
$table_width=240;
}
$c = 0;
print "\n\n\n\n";
$lstl = "";
print "\n\n\n";
while($row = $r->fetch_object()) {
if ($c >= $per_col) {
print " | ";
$c = 0;
}
if (strtoupper(substr($row->surname,0,1)) != $lstl) {
$lstl = strtoupper(substr($row->surname,0,1));
print ' · '.$lstl.' · ';
}
// ==================================================================
// 2018-AUG-29: Favourites and Cookies
$html = "";
$ckievar = 'GIP_'.$event_id.'_myFavs'; # 2019 TODO
# 2019 if (isset($_COOKIE['GIP_2_myFavs'])) {
if (isset($_COOKIE[$ckievar])) {
#$html .= '';
# 2019 if ( strpos($_COOKIE["GIP_2_myFavs"], $row->imdb_name_id) === false ) {
if ( strpos($_COOKIE[$ckievar], $row->imdb_name_id) === false ) { # 2019 TODO
// SAME AS OUTSIDE ELSE BELOW - look at making common
$html .= '';
} else {
$html .= '';
}
} else {
// SAME AS ELSE ABOVE - look to make common
$html .= '';
}
// END 2018-AUG-29: Favourites and Cookies
// ==================================================================
$tmp=hover_content( $row->imdb_name_id, FALSE );
print $html.' '.$row->full_name.$tmp;
print " \n";
# print "\n";
$c++;
}
print " |
\n\n";
}
} elseif ( (strtolower(substr($passed,0,10))=="showtitles") ) {
# List the shows by number of guests specified
$table_width=940;
if ($screen_width >= 940) {
$per_col = round($max/4)+1;
} else {
$per_col = $max;
$table_width=240;
}
$c = 0;
print "\n\n\n\n";
$lstl = "";
print "\n\n\n";
while($row = $r->fetch_object()) {
if ($c >= $per_col) {
print " | ";
$c = 0;
}
if (strtoupper(substr($row->title_search,0,1)) != $lstl) {
$lstl = strtoupper(substr($row->title_search,0,1));
print ' · '.$lstl.' · ';
}
print ''.$row->title_search;
print " ";
if ($row->no_guests > 1) {
print "($row->no_guests guests) ";
}
print " \n";
$c++;
}
print " |
\n\n";
} else {
while($row = $r->fetch_object()) {
echo '';
populate_bubble( $row, ($counter+1), $max );
echo "\n";
$counter++;
}
}
if ($advert) {
echo '';
populate_bubble( guest_update_bubble() );
echo "\n";
$counter++;
}
} else {
# MY FACOURITES BUBLLE
echo "\n\n";
echo '';
populate_bubble( myFavs_bubble($r) );
echo "\n";
}
} else {
# DEFAULT HOME SCREEN
echo '';
populate_bubble( guest_update_bubble() );
echo "\n";
echo '';
populate_bubble( TopNo_bubble() );
echo "\n";
echo '';
populate_bubble( GuestsNotAllWknd_bubble() );
echo "\n";
}
echo "\n \n";
//print $sql;
//print " ".$row['title']." · (".$row['char_name'].")
\n";
//print " ".$row['title']." · (".$row['num'].")
\n";
$conn->close();
if ($host != 'localhost') {
echo ' ';
}
} // END NEW IF 2017-08-02 -- No MySQL Table
?>