require_once ("LANGUAGE_FILE.php"); $cookie_user_info_arr = determine_user_priv(); $google_ad = 'yes'; if ($_GET['type'] == 'member' || $_GET['type'] == 'memrec') { $lim = 40; } elseif ($_GET['type'] == 'memcritiques') { $lim = 20; } else { $lim = 18; } $user_name = $_GET['filter']; if (isset($_GET['pid'])){ //brendan $photo_id = intval($_GET['pid']); } if (empty($_GET['offset'])) { $offset = 0; } else { $offset = $_GET['offset'] * $lim - $lim; } if (!empty($photo_id)) { $mode = 'single'; $photo_info_arr = get_photo_info($photo_id); if (empty($photo_info_arr['photo_id'])) { header("HTTP/1.0 404 Not Found"); header("Location: /404.php"); exit; } } else { $mode = 'multi'; if (!empty($_GET['type'])) { switch ($_GET['type']) { case 'member': case 'memrec': case 'photo': $count_total_query = get_multi_query($_GET['filter']); $count_result = mysql_query($count_total_query) or die ('Invalid count_query4'); $count_total = mysql_num_rows($count_result); break; case 'memcritiques': $count_query = "SELECT LEAST(SUM(uaf.num_critiques), 500) AS tot_crits FROM user_favorites AS uf, users AS uuf, users AS uaf WHERE uuf.user_name = '$user_name' AND uuf.user_id = uf.user_id AND uaf.user_id = uf.favorite_user_id"; $count_result = mysql_query($count_query) or die ('Invalid count_query1'); $count_total = mysql_result($count_result, 0); $ufcount_query = "SELECT COUNT(*) FROM user_favorites AS uf, users AS u WHERE u.user_name = '$user_name' AND u.user_id = uf.user_id"; $ufcount_result = mysql_query($ufcount_query) or die ('Invalid ufcount_query'); $ufcount_total = mysql_result($ufcount_result, 0); if ($ufcount_total > 0 && $ufcount_total <= 5) { $uf2_query = "SELECT GROUP_CONCAT( favorite_user_id ) AS favorite_users FROM user_favorites AS uf, users AS u WHERE u.user_name = '$user_name' AND u.user_id = uf.user_id"; $uf2_result = mysql_query($uf2_query) or die ('Invalid uf2_query'); $uf2row = mysql_fetch_array($uf2_result); $favorite_users = $uf2row['favorite_users']; } if ($offset + 1 > $count_total && $count_total > 0 && $ufcount_total > 1) { header("HTTP/1.0 404 Not Found"); header("Location: /404.php"); exit; } break; case 'memphotos': $count_query = "SELECT COUNT(*) AS count FROM photos AS p, user_favorites AS uf, users AS u, users AS u2 WHERE u.user_id = p.user_id AND uf.user_id = u2.user_id AND uf.favorite_user_id = p.user_id AND u.acct_status = 'Enabled' AND p.latest_version = 'Y' AND p.cur_status = 'Active' AND u2.user_name = '$user_name'"; $count_result = mysql_query($count_query) or die ('Invalid count_query2'); $count_total = mysql_result($count_result, 0); break; case 'continent': $nice_continent_name = $_GET['filter']; $count_total = 180; if ($offset + 1 > $count_total && $count_total > 0) { header("HTTP/1.0 404 Not Found"); header("Location: /404.php"); exit; } break; case 'country': $nice_country_name = $_GET['filter']; $count_query = "SELECT LEAST(ctr.num_favorites, 1800) AS count FROM loc_countries AS ctr WHERE ctr.nice_country_name = '$nice_country_name'"; $count_result = mysql_query($count_query) or die ('Invalid count_query3'); $count_total = mysql_result($count_result, 0); if ($offset + 1 > $count_total && $count_total > 0) { header("HTTP/1.0 404 Not Found"); header("Location: /404.php"); exit; } break; case 'region': $nice_region_name = $_GET['filter']; $country_id = $_GET['id']; $count_query = "SELECT LEAST(r.num_favorites, 1800) AS count FROM loc_regions AS r WHERE r.nice_region_name = '$nice_region_name' AND r.country_id = $country_id AND r.lang_id = 0"; $count_result = mysql_query($count_query) or die ('Invalid count_query31'); $count_total = mysql_result($count_result, 0); if ($offset + 1 > $count_total && $count_total > 0) { header("HTTP/1.0 404 Not Found"); header("Location: /404.php"); exit; } break; case 'state': $state_name = str_replace('_', ' ', $_GET['filter']); $count_query = "SELECT LEAST(s.num_favorites, 1800) AS count FROM loc_states AS s WHERE s.state_name = '$state_name' AND s.lang_id = 0"; $count_result = mysql_query($count_query) or die ('Invalid count_query3'); $count_total = mysql_result($count_result, 0); if ($offset + 1 > $count_total && $count_total > 0) { header("HTTP/1.0 404 Not Found"); header("Location: /404.php"); exit; } break; default: echo 'Invalid type3'; exit; } } else { //all favorites $count_total = 5400; if ($offset + 1 > $count_total) //If go over page limit, give them a 404 { header("HTTP/1.0 404 Not Found"); header("Location: /404.php"); exit; } } } if ($count_total == 0 && $mode == 'multi' && empty($_GET['id'])) { header("HTTP/1.0 404 Not Found"); header("Location: /404.php"); exit; } $page_type = 'favorite'; $page_num = 'on'; html_begin($title='Favorites', $meta_keywords='', $meta_description='', $meta_robot='NOINDEX, FOLLOW'); if (($mode == 'multi' && $_GET['type'] == 'photo') || (empty($_GET['type']) && empty($_GET['pid']))) { display_multi($lim); } elseif ($mode == 'single') { display_fav_photo_stats($photo_id); } elseif ($_GET['type'] == 'member' || $_GET['type'] == 'memrec') { display_mem_thumbs(); } elseif($_GET['type'] == 'continent' || $_GET['type'] == 'country' || $_GET['type'] == 'region' || $_GET['type'] == 'state' || $_GET['type'] == 'memphotos') { display_multi($lim); } elseif ($_GET['type'] == 'memcritiques') { display_critiques($_GET['filter']); } else { echo 'bad query'; } html_end(); function get_multi_query($selection_criteria) { global $lang_id, $_GET, $_COOKIE, $user_id, $offset, $count_total, $country_id, $critique_date, $favorite_users, $ufcount_total; $user_name = $_GET['filter']; if (!empty($_GET['type'])) { switch ($_GET['type']) { case 'photo': $query_action = 'PHOTO'; break; case 'member': $query_action = 'MEMBER'; $user_id = is_user($selection_criteria); break; case 'memrec': $query_action = 'MEMREC'; $user_id = is_user($selection_criteria); break; case 'memphotos': $query_action = 'MEM_PHOTOS'; break; case 'memcritiques': $query_action = 'MEM_CRITIQUES'; break; case 'continent': $query_action = 'CONTINENT'; $nice_continent_name = $selection_criteria; $continent_info_arr = get_continent_info($nice_continent_name); $continent_id = $continent_info_arr['continent_id']; break; case 'country': $query_action = 'COUNTRY'; $nice_country_name = $selection_criteria; break; case 'region': $query_action = 'REGION'; $nice_region_name = $selection_criteria; break; case 'state': $query_action = 'STATE'; $state_name = str_replace('_', ' ', $selection_criteria); break; default: echo 'Invalid level'; } } else { $query_action = 'ALL_PHOTOS'; } switch ($query_action) { case 'MEMBER'; $query = "SELECT uf.favorite_user_id, u.user_name, u.user_score, u.user_critique_score, u.user_workshop_score, u.user_note_score, u.score_sym, ui.intro, CONCAT(ui.first_name, ' ', ui.last_name) AS full_name, u.user_name, u.acct_status FROM users AS u, user_favorites AS uf, user_intros AS ui WHERE uf.user_id = $user_id AND uf.favorite_user_id = u.user_id AND ui.user_id = uf.favorite_user_id AND ui.lang_id = 0 ORDER BY uf.add_date DESC"; break; case 'MEMREC'; $query = "SELECT uf.user_id AS favorite_user_id, u.user_name, u.user_score, u.user_critique_score, u.user_workshop_score, u.user_note_score, u.score_sym, ui.intro, u.acct_status, CONCAT(ui.first_name, ' ', ui.last_name) AS full_name FROM users AS u, user_favorites AS uf, user_intros AS ui WHERE uf.favorite_user_id = $user_id AND uf.user_id = u.user_id AND uf.user_id = ui.user_id AND ui.lang_id = 0 ORDER BY uf.add_date DESC"; break; case 'PHOTO'; // brendan $query = "SELECT p.score, p.photo_name, p.photo_id, p.sheight, p.swidth, p.user_id, u.user_name, p.num_favorites, u.user_score, u.user_critique_score, u.user_workshop_score, t.title_name, ctrl.country_name, ctr.country_id, ctr.continent_id, ctr.nice_country_name, p.num_critiques, tc.camera_name, u.acct_status, u.user_note_score, u.score_sym FROM (photos_favorites AS pf, photos AS p, users AS u, users AS u2, loc_countries AS ctr, loc_countries_lang AS ctrl, loc_regions AS r, loc_states AS s, photo_titles AS t) LEFT JOIN tech_cameras AS tc ON p.camera_id = tc.camera_id WHERE u2.user_name = '$user_name' AND p.photo_id = pf.photo_id AND pf.user_id = u2.user_id AND u.user_id = p.user_id AND p.cur_status = 'Active' AND r.region_id = s.region_id AND ctr.country_id = r.country_id AND p.latest_version = 'Y' AND u.acct_status = 'Enabled' AND ctr.country_id = ctrl.country_id AND s.state_id = p.state_id AND r.lang_id = 0 AND ctrl.lang_id = $lang_id AND s.lang_id = 0 AND p.photo_id = t.photo_id AND t.lang_id = 0 ORDER BY pf.add_date DESC"; break; case 'ALL_PHOTOS'; $query = "SELECT STRAIGHT_JOIN p.score, p.photo_name, p.photo_id, p.sheight, p.swidth, p.user_id, u.user_name, p.num_favorites, u.user_score, u.user_critique_score, t.title_name, u.user_workshop_score, ctrl.country_name, ctr.country_id, ctr.continent_id, ctr.nice_country_name, p.num_critiques, tc.camera_name, u.acct_status, u.user_note_score, u.score_sym FROM photos_favorites AS pf INNER JOIN photos AS p ON p.photo_id = pf.photo_id AND p.latest_version = 'Y' AND p.cur_status = 'Active' INNER JOIN loc_states AS s ON s.state_id = p.state_id AND s.lang_id = 0 INNER JOIN loc_regions AS r ON r.region_id = s.region_id AND r.lang_id = 0 INNER JOIN loc_countries AS ctr ON ctr.country_id = r.country_id INNER JOIN loc_countries_lang AS ctrl ON ctrl.country_id = ctr.country_id AND ctrl.lang_id = $lang_id INNER JOIN users AS u ON u.user_id = p.user_id AND u.acct_status = 'Enabled' INNER JOIN photo_titles AS t ON t.photo_id = p.photo_id AND t.lang_id = 0 LEFT JOIN tech_cameras AS tc ON tc.camera_id = p.camera_id ORDER BY pf.add_date DESC"; break; case 'MEM_PHOTOS'; $query = "SELECT STRAIGHT_JOIN p.score, p.photo_name, p.photo_id, p.sheight, p.swidth, p.user_id, u.user_name, p.num_favorites, u.user_score, u.user_critique_score, t.title_name, u.user_workshop_score, ctrl.country_name, ctr.country_id, ctr.continent_id, ctr.nice_country_name, p.num_critiques, tc.camera_name, u.acct_status, u.user_note_score, u.score_sym FROM user_favorites AS uf INNER JOIN photos AS p ON p.user_id = uf.favorite_user_id AND p.latest_version = 'Y' AND p.cur_status = 'Active' INNER JOIN users AS u ON u.user_id = p.user_id AND u.acct_status = 'Enabled' INNER JOIN users AS u2 ON u2.user_id = uf.user_id INNER JOIN loc_states AS s ON s.state_id = p.state_id AND s.lang_id = 0 INNER JOIN loc_regions AS r ON r.region_id = s.region_id AND r.lang_id = 0 INNER JOIN loc_countries AS ctr ON ctr.country_id = r.country_id INNER JOIN loc_countries_lang AS ctrl ON ctrl.country_id = ctr.country_id AND ctrl.lang_id = $lang_id INNER JOIN photo_titles AS t ON t.photo_id = p.photo_id AND t.lang_id = 0 LEFT JOIN tech_cameras AS tc ON p.camera_id = tc.camera_id WHERE u2.user_name = '$user_name' ORDER BY p.date_uploaded DESC"; break; case 'MEM_CRITIQUES'; if ($count_total >= 500) { $straight_join = ' STRAIGHT_JOIN'; } else { $straight_join = ''; } if ($ufcount_total <= 5) { $query = "SELECT $straight_join DATE_FORMAT(c.critique_date, '%Y-%m-%d %k:%i') AS critique_date, p.photo_name, p.photo_id, p.num_favorites, p.swidth, p.sheight, ctrl.country_name, ctrl.continent_id, t.title_name, p.score AS photo_score, ctrl.nice_country_name, p.num_critiques, ua.user_workshop_score AS artist_workshop_score, ua.user_note_score AS artist_note_score, u.user_name AS critiquer_user_name, CONCAT(ui.first_name, ' ', ui.last_name) AS critiquer_full_name, u.user_score AS critiquer_score, u.user_critique_score AS critiquer_critique_score, u.score_sym AS critiquer_score_sym, ua.user_id AS artist_user_id, ua.user_name AS artist_user_name, CONCAT(uia.first_name, ' ', uia.last_name) AS artist_full_name, u.user_workshop_score AS critiquer_workshop_score, u.user_note_score AS critiquer_note_score, ua.user_score AS artist_score, ua.user_critique_score AS artist_critique_score, tc.camera_name, c.num_usefuls, ua.acct_status, u.acct_status AS critiquer_acct_status, p.original_photo_id, c.crit_type, u.user_id AS critiquer_user_id, ua.score_sym AS artist_score_sym, c.reply_exists, c.ws_exists, c.score, c.critique, c.critique_id FROM critiques AS c INNER JOIN users AS u ON u.user_id = c.user_id INNER JOIN user_intros AS ui ON ui.user_id = u.user_id AND ui.lang_id = 0 INNER JOIN photos AS p ON p.photo_id = c.photo_id AND p.cur_status = 'Active' INNER JOIN loc_states AS s ON p.state_id = s.state_id AND s.lang_id = 0 INNER JOIN loc_regions AS r ON s.region_id = r.region_id AND r.lang_id = 0 INNER JOIN loc_countries_lang AS ctrl ON r.country_id = ctrl.country_id AND ctrl.lang_id = $lang_id INNER JOIN users AS ua ON ua.user_id = p.user_id INNER JOIN user_intros AS uia ON uia.user_id = ua.user_id AND uia.lang_id = 0 INNER JOIN photo_titles AS t ON t.photo_id = p.photo_id AND t.lang_id = 0 LEFT JOIN tech_cameras AS tc ON p.camera_id = tc.camera_id WHERE c.user_id IN ($favorite_users) AND c.cstatus = 'active' ORDER BY c.critique_date DESC"; } else { $query = "SELECT $straight_join DATE_FORMAT(c.critique_date, '%Y-%m-%d %k:%i') AS critique_date, p.photo_name, p.photo_id, p.num_favorites, p.swidth, p.sheight, ctrl.country_name, ctrl.continent_id, t.title_name, p.score AS photo_score, ctrl.nice_country_name, p.num_critiques, ua.user_workshop_score AS artist_workshop_score, ua.user_note_score AS artist_note_score, u.user_name AS critiquer_user_name, CONCAT(ui.first_name, ' ', ui.last_name) AS critiquer_full_name, u.user_score AS critiquer_score, u.user_critique_score AS critiquer_critique_score, u.score_sym AS critiquer_score_sym, ua.user_id AS artist_user_id, ua.user_name AS artist_user_name, CONCAT(uia.first_name, ' ', uia.last_name) AS artist_full_name, u.user_workshop_score AS critiquer_workshop_score, u.user_note_score AS critiquer_note_score, ua.user_score AS artist_score, ua.user_critique_score AS artist_critique_score, tc.camera_name, c.num_usefuls, ua.acct_status, u.acct_status AS critiquer_acct_status, p.original_photo_id, c.crit_type, u.user_id AS critiquer_user_id, ua.score_sym AS artist_score_sym, c.reply_exists, c.ws_exists, c.score, c.critique, c.critique_id FROM (critiques AS c, users AS uuf, user_favorites AS uf, users AS u, user_intros AS ui, photos AS p, loc_states AS s, loc_regions AS r, loc_countries_lang AS ctrl, users AS ua, user_intros AS uia, photo_titles AS t) LEFT JOIN tech_cameras AS tc ON p.camera_id = tc.camera_id WHERE uuf.user_name = '$user_name' AND uuf.user_id = uf.user_id AND u.user_id = c.user_id AND p.photo_id = c.photo_id AND ua.user_id = p.user_id AND uf.favorite_user_id = c.user_id AND p.state_id = s.state_id AND s.region_id = r.region_id AND r.country_id = ctrl.country_id AND ctrl.lang_id = $lang_id AND s.lang_id = 0 AND r.lang_id = 0 AND p.cur_status = 'Active' AND ui.user_id = u.user_id AND ui.lang_id = 0 AND uia.user_id = ua.user_id AND uia.lang_id = 0 AND t.photo_id = p.photo_id AND t.lang_id = 0 AND c.cstatus = 'active' ORDER BY c.critique_date DESC"; } break; case 'CONTINENT'; $query = "SELECT STRAIGHT_JOIN DISTINCT p.photo_id, p.score, p.photo_name, p.sheight, p.swidth, p.user_id, u.user_name, p.num_favorites, u.acct_status, u.user_score, u.user_critique_score, t.title_name, u.user_workshop_score, ctrl.country_name, ctr.country_id, ctr.continent_id, ctr.nice_country_name, p.num_critiques, tc.camera_name, u.user_note_score, u.score_sym FROM loc_countries AS ctr INNER JOIN loc_countries_lang AS ctrl ON ctr.country_id = ctrl.country_id AND ctrl.lang_id = $lang_id INNER JOIN loc_regions AS r ON ctr.country_id = r.country_id AND r.lang_id = 0 INNER JOIN loc_states AS s ON r.region_id = s.region_id AND s.lang_id = 0 INNER JOIN photos AS p ON s.state_id = p.state_id AND p.latest_version = 'Y'AND p.cur_status = 'Active' INNER JOIN photos_favorites AS pf ON p.photo_id = pf.photo_id INNER JOIN users AS u ON u.user_id = p.user_id AND u.acct_status = 'Enabled' INNER JOIN photo_titles AS t ON p.photo_id = t.photo_id AND t.lang_id = 0 LEFT JOIN tech_cameras AS tc ON p.camera_id = tc.camera_id WHERE ctr.continent_id = $continent_id AND pf.add_date > DATE_SUB(NOW(), INTERVAL 1 YEAR)"; break; case 'COUNTRY'; $query = "SELECT STRAIGHT_JOIN DISTINCT p.photo_id, p.score, p.photo_name, p.sheight, p.swidth, p.user_id, u.user_name, p.num_favorites, u.acct_status, u.user_score, u.user_critique_score, t.title_name, u.user_workshop_score, ctrl.country_name, ctr.country_id, ctr.continent_id, ctr.nice_country_name, p.num_critiques, tc.camera_name, u.user_note_score, u.score_sym FROM loc_countries AS ctr INNER JOIN loc_countries_lang AS ctrl ON ctr.country_id = ctrl.country_id AND ctrl.lang_id = $lang_id INNER JOIN loc_regions AS r ON ctr.country_id = r.country_id AND r.lang_id = 0 INNER JOIN loc_states AS s ON r.region_id = s.region_id AND s.lang_id = 0 INNER JOIN photos AS p ON s.state_id = p.state_id AND p.latest_version = 'Y'AND p.cur_status = 'Active' INNER JOIN photos_favorites AS pf ON p.photo_id = pf.photo_id INNER JOIN users AS u ON u.user_id = p.user_id AND u.acct_status = 'Enabled' INNER JOIN photo_titles AS t ON p.photo_id = t.photo_id AND t.lang_id = 0 LEFT JOIN tech_cameras AS tc ON p.camera_id = tc.camera_id WHERE ctr.nice_country_name = '$nice_country_name' ORDER BY pf.add_date DESC"; break; case 'REGION'; $query = "SELECT STRAIGHT_JOIN DISTINCT p.photo_id, p.score, p.photo_name, p.sheight, p.swidth, p.user_id, u.user_name, p.num_favorites, u.acct_status, u.user_score, u.user_critique_score, t.title_name, u.user_workshop_score, ctrl.country_name, ctr.country_id, ctr.continent_id, ctr.nice_country_name, p.num_critiques, tc.camera_name, u.user_note_score, u.score_sym FROM loc_regions AS r INNER JOIN loc_states AS s ON r.region_id = s.region_id AND s.lang_id = 0 INNER JOIN photos AS p ON s.state_id = p.state_id AND p.latest_version = 'Y' AND p.cur_status = 'Active' INNER JOIN loc_countries AS ctr ON ctr.country_id = r.country_id INNER JOIN loc_countries_lang AS ctrl ON ctr.country_id = ctrl.country_id AND ctrl.lang_id = $lang_id INNER JOIN photos_favorites AS pf ON p.photo_id = pf.photo_id INNER JOIN users AS u ON u.user_id = p.user_id AND u.acct_status = 'Enabled' INNER JOIN photo_titles AS t ON p.photo_id = t.photo_id AND t.lang_id = 0 LEFT JOIN tech_cameras AS tc ON p.camera_id = tc.camera_id WHERE r.country_id = $country_id AND r.nice_region_name = '$nice_region_name' AND r.lang_id = 0 ORDER BY pf.add_date DESC"; break; case 'STATE'; $query = "SELECT STRAIGHT_JOIN DISTINCT p.photo_id, p.score, p.photo_name, p.sheight, p.swidth, p.user_id, u.user_name, p.num_favorites, u.acct_status, u.user_score, u.user_critique_score, t.title_name, u.user_workshop_score, ctrl.country_name, ctr.country_id, ctr.continent_id, ctr.nice_country_name, p.num_critiques, tc.camera_name, u.user_note_score, u.score_sym FROM loc_states AS s INNER JOIN photos AS p ON s.state_id = p.state_id AND p.latest_version = 'Y' AND p.cur_status = 'Active' INNER JOIN loc_regions AS r ON r.region_id = s.region_id AND r.lang_id = 0 INNER JOIN loc_countries AS ctr ON ctr.country_id = r.country_id INNER JOIN loc_countries_lang AS ctrl ON ctr.country_id = ctrl.country_id AND ctrl.lang_id = $lang_id INNER JOIN photos_favorites AS pf ON p.photo_id = pf.photo_id INNER JOIN users AS u ON u.user_id = p.user_id AND u.acct_status = 'Enabled' INNER JOIN photo_titles AS t ON p.photo_id = t.photo_id AND t.lang_id = 0 LEFT JOIN tech_cameras AS tc ON p.camera_id = tc.camera_id WHERE s.state_name = '$state_name' AND s.lang_id = 0 ORDER BY pf.add_date DESC"; break; default; die("Unknown action code ($query_action)"); } //echo $query; return $query; } function display_members($user_name) { global $offset, $lim, $_SERVER; $member_query = get_multi_query($user_name) . ' LIMIT ' . $offset . ', ' . $lim; $result = mysql_query($member_query) or die ('Invalid multi member query'); echo '' . "\n"; echo ''; echo '
'; echo ''; if (mysql_num_rows($result) > 0) { while ($row = mysql_fetch_array ($result)) { $favorite_user_id = $row['favorite_user_id']; $intro = $row['intro']; $first_name = $row['first_name']; $last_name = $row['last_name']; $user_name = $row['user_name']; $user_score = $row['user_score']; $user_critique_score = $row['user_critique_score']; $user_workshop_score = $row['user_workshop_score']; $user_note_score = $row['user_note_score']; $score_sym = $row['score_sym']; $acct_status = $row['acct_status']; //NOT NEEDED!!! //$favorite_user_info_arr = get_user_info($favorite_user_id); if (!empty($intro)) { $favorite_intro = nl2br($intro); } else { $favorite_intro = '
No intro.
'; } $user_photo_path = $_SERVER['DOCUMENT_ROOT'] . '/images/photos/' . $favorite_user_id . '/misc/' . $user_name . '.jpg'; if (file_exists($user_photo_path) && $acct_status == 'Enabled') { $complete_user_photo = '' . $first_name . ' ' . $last_name . '
' . $user_name . '
' . $user_name . '
' . get_user_score_status($favorite_user_id, $user_score, $user_critique_score, $user_workshop_score, $user_note_score, $score_sym) . ''; } else { $complete_user_photo = '' . $first_name . ' ' . $last_name . '
[No Photo]
' . $user_name . '' . get_user_score_status($favorite_user_id, $user_score, $user_critique_score, $user_workshop_score, $user_note_score, $score_sym) . ''; } echo '' . "\n"; } } else { echo '' . "\n"; } echo '
' . $complete_user_photo . '' . $favorite_intro . '
No favorite members.
'; echo '
' . "\n"; } function display_fav_photo_stats ($fav_photo_id) { global $lang_id, $photo_info_arr, $continent_arr, $_COOKIE; $favorite_photo = display_fav_photo($photo_info_arr['num_favorites'], $photo_info_arr['photo_id']); if ($photo_info_arr['original_photo_id'] > 0) { $repost = 'RP'; } else { $repost = ''; } $continent_name = $photo_info_arr['continent_name']; $nice_continent_name = array_search($continent_name, $continent_arr); $bottom = '
' . $photo_info_arr['title_name'] . ' (' . $photo_info_arr['score'] . ') ' . $repost . $favorite_photo . '
' . $photo_info_arr['user_name'] . ' ' . get_user_score_status($photo_info_arr['user_id'], $photo_info_arr['user_score'], $photo_info_arr['user_critique_score'], $photo_info_arr['user_workshop_score'], $photo_info_arr['user_note_score'], $photo_info_arr['score_sym']) . ''; $query = "SELECT u.user_name, DATE_FORMAT(pf.add_date, '%Y-%m-%d') AS add_date, CONCAT(ui.first_name, ' ', ui.last_name) AS full_name, u.user_id, u.user_score, u.user_critique_score, u.user_workshop_score, u.user_note_score, u.score_sym FROM photos_favorites AS pf, users AS u, user_intros AS ui WHERE pf.photo_id = $fav_photo_id AND pf.user_id = u.user_id AND u.user_id = ui.user_id AND ui.lang_id = 0 ORDER BY pf.add_date DESC"; $result = mysql_query($query) or die ('Invalid query'); if (!empty($_GET['purl'])) { $photo_url = ''; } else { $photo_url = ''; } if (!empty($photo_info_arr['camera_name'])) { $camera = "\n" . 'Camera: ' . $photo_info_arr['camera_name']; } else { $camera = ''; } echo '' . "\n"; echo '' . "\n"; echo '
' . "\n"; echo '' . "\n"; echo ''; echo '' . "\n"; if (mysql_num_rows($result) > 0) { echo '' . "\n"; while ($row = mysql_fetch_array($result)) { $user_name = $row['user_name']; $add_date = $row['add_date']; $full_name = $row['full_name']; $user_score = $row['user_score']; $user_critique_score = $row['user_critique_score']; $user_workshop_score = $row['user_workshop_score']; $user_note_score = $row['user_note_score']; $score_sym = $row['score_sym']; $user_id = $row['user_id']; $bgcolor = altColor($alt); echo ''; echo '' . "\n"; $alt++; } } else { echo '' . "\n"; } echo '
' . "\n"; echo '' . $photo_info_arr['country_name'] . '
' . $photo_url . 'Title: ' . htmlentities($photo_info_arr['title_name']) . $camera . '' . $bottom; echo '
Added ByDate Added
' . $user_name . '' . ' ' . get_user_score_status($user_id, $user_score, $user_critique_score, $user_workshop_score, $user_note_score, $score_sym) . '' . $add_date . '
No members have added this photo to their Favorites list.
' . "\n"; echo '
' . "\n"; } function display_critiques($user_name) { global $lang_id, $offset, $lim, $cookie_user_info_arr; $membercrit_query = get_multi_query($user_name) . ' LIMIT ' . $offset . ', ' . $lim; $result = mysql_query($membercrit_query) or die ('Invalid membercrit_query'); echo '' . "\n"; echo ''; echo '
'; echo ''; if (mysql_num_rows($result) > 0) { echo '' . "\n"; $count = 1; while ($row = mysql_fetch_array($result)) { $score = $row['score']; $critique_date = $row['critique_date']; $critiquer_user_id = $row['critiquer_user_id']; $critiquer_user_name = $row['critiquer_user_name']; $critiquer_full_name = $row['critiquer_full_name']; $critiquer_score = $row['critiquer_score']; $critiquer_critique_score = $row['critiquer_critique_score']; $critiquer_workshop_score = $row['critiquer_workshop_score']; $critiquer_note_score = $row['critiquer_note_score']; $critiquer_score_sym = $row['critiquer_score_sym']; $ws_exists = $row['ws_exists']; $num_usefuls = $row['num_usefuls']; $reply_exists = $row['reply_exists']; $critique = $row['critique']; $critique_id = $row['critique_id']; $title_name = $row['title_name']; $continent_info_arr = get_continent_info($row['continent_id']); if ($score == 3 || $cookie_user_info_arr['site_type'] == 'noscore') { $score_image = ' '; } elseif ($score == 2) { $score_image = 'Great'; } elseif ($score == 1) { $score_image = 'Good'; } elseif ($score == 0) { $score_image = 'Needs Improvement'; } $thumb_info_arr['photo_name'] = $row['photo_name']; $thumb_info_arr['photo_id'] = $row['photo_id']; $thumb_info_arr['original_photo_id'] = $original_photo_id; $thumb_info_arr['swidth'] = $row['swidth']; $thumb_info_arr['sheight'] = $row['sheight']; $thumb_info_arr['user_id'] = $row['artist_user_id']; $thumb_info_arr['user_name'] = $row['artist_user_name']; $thumb_info_arr['country_name'] = $row['country_name']; $thumb_info_arr['nice_country_name'] = $row['nice_country_name']; $thumb_info_arr['nice_continent_name'] = $continent_info_arr['nice_continent_name']; $thumb_info_arr['num_critiques'] = $row['num_critiques']; $thumb_info_arr['num_favorites'] = $row['num_favorites']; $thumb_info_arr['user_score'] = $row['artist_score']; $thumb_info_arr['user_critique_score'] = $row['artist_critique_score']; $thumb_info_arr['user_workshop_score'] = $row['artist_workshop_score']; $thumb_info_arr['user_note_score'] = $row['artist_note_score']; $thumb_info_arr['score_sym'] = $row['artist_score_sym']; $thumb_info_arr['score'] = $row['photo_score']; $thumb_info_arr['title_name'] = $title_name; $thumb_info_arr['camera_name'] = $row['camera_name']; $thumb_info_arr['full_name'] = $row['artist_full_name']; $thumb_info_arr['acct_status'] = $row['acct_status']; if ($ws_exists == 'yes') { $workshop = '[workshop] [compare]'; } else { $workshop = ''; } if (!empty($cookie_user_info_arr['user_id'])) { $user_reply = ' [' . _REPLY . ']'; } else { $user_reply = ''; } if (!empty($workshop)) { $minus = ' - '; } else { $minus = ''; } if ($num_usefuls > 1) { $usefuls = ' [' . $num_usefuls . '] '; } else { $usefuls = ''; } if ($reply_exists == 'yes') { $msg = ' [+]'; } else { $msg = ''; } echo ''; echo '' . "\n"; echo ''; echo ''; echo ''; echo '' . "\n"; echo ''; $count++; } } else { echo '' . "\n"; } echo '
' . _PHOTO . ' ' . _CRITIQUE . '
'; echo display_thumbnail ($thumb_info_arr, $header='country-link'); echo '

' . $score_image . '

'; echo '
' . $critiquer_user_name . '' . ' ' . get_user_score_status($critiquer_user_id, $critiquer_score, $critiquer_critique_score, $critiquer_workshop_score, $critiquer_note_score, $critiquer_score_sym) . ' [' . $critique_date . ']' . $usefuls . $minus . ' ' . $workshop . $user_reply . $msg . '
'; echo nl2br($critique) . '

No critiques. [View all critiques]
'; echo '
' . "\n"; } function display_mem_thumbs($lim=40) { global $offset, $user_name, $count_total; $i = 1; echo '' . "\n"; $member_query = get_multi_query($user_name) . ' LIMIT ' . $offset . ', ' . $lim; $result = mysql_query($member_query) or die ('Invalid member_query'); if ($count_total > 0) { while ($row = mysql_fetch_array ($result)) { $user_name = $row['user_name']; $favorite_user_id = $row['favorite_user_id']; $full_name = $row['full_name']; $user_score = $row['user_score']; $user_critique_score = $row['user_critique_score']; $user_workshop_score = $row['user_workshop_score']; $user_note_score = $row['user_note_score']; $score_sym = $row['score_sym']; $acct_status = $row['acct_status']; $intro = htmlentities(substr(strip_tags($row['intro']), 0, 300)); if (!empty($intro)) { $nice_intro_arr = explode(' ', $intro); array_pop($nice_intro_arr); $nice_intro = implode(' ', $nice_intro_arr) . '...'; } else { $nice_intro = ''; } if ((($i+4) % 5) == 0) //If current photo is 1st one in row, add opening tag { echo ''; } echo ''; if (($i % 5) == 0 || $count_total == $i) //If current photo is 3rd one, or is last one, add a closing row break { echo '' . "\n"; } $i++; } } else { echo '' . "\n"; } echo '
'; $user_photo_path = $_SERVER['DOCUMENT_ROOT'] . '/images/photos/' . $favorite_user_id . '/misc/' . $user_name . '.jpg'; if (file_exists($user_photo_path) && $acct_status == 'Enabled') { $complete_user_photo = '' . $full_name . '

' . $user_name . '
' . get_user_score_status($favorite_user_id, $user_score, $user_critique_score, $user_workshop_score, $user_note_score, $score_sym) . ''; } else { $complete_user_photo = '' . $full_name . '
[No Photo]
' . $user_name . ' ' . get_user_score_status($favorite_user_id, $user_score, $user_critique_score, $user_workshop_score, $user_note_score, $score_sym) . ''; } echo $complete_user_photo; echo '
No members
' . "\n"; } ?>