$d = preg_replace('/\\(.*\\),?\\s*\\b(and|or|but)\\b.*/', '$1.', $d); if ($d == $t) { break; } } if (strlen($t) > 120) { $t = 'See pwtc.com for a description.'; } $thisevent['printdescr'] = $t; print "\tprintdescr={$t}\n"; # Append each date to the caldaily array. Also get shared time preg_match_all('/date-display-single">([^<]*)/', $desc, $matches); foreach ($matches[1] as $date) { print "\t---date='{$date}' temporarily\n"; $date = explode(' - ', $date); $thisevent['eventtime'] = hhmmss($date[1]); $date = yyyymmdd($date[0]); $thisevent['caldaily'][] = array('eventdate' => $date, 'eventstatus' => 'A'); print "\teventdate={$date}\n"; } print "\ttime=" . $thisevent['eventtime'] . "\n"; # Get a string describing the dates as a whole. This does *NOT* need # to be parsable by the repeatdates() function since we already have a # list of specific dates. if (count($thisevent['caldaily']) == 1) { $d = explode(',', $date); $thisevent['dates'] = $d[0]; $thisevent['datestype'] = 'O'; # One day } else { $d = preg_replace('/.*<div>\\s*Repeats ([^<])<.*/', '$1', $desc);
function build_champ_profile($memID) { global $smcFunc, $context, $scripturl, $arcSettings; //setup some stuff we need..so its all zero if there is nothing to show $arcade_champg = array(); $arcade_champs = array(); $arcade_champb = array(); $stats = array(); $stats['total_plays'] = 0; $stats['timeplayed'] = 0; $stats['gold'] = 0; $stats['silver'] = 0; $stats['bronze'] = 0; $result = $smcFunc['db_query']('', ' SELECT g.id_game, g.internal_name, g.game_name,g.thumbnail, g.game_directory, g.id_member_first, g.id_member_second, g.id_member_third, b.score, b.my_plays, b.playing_time, b.time_gained FROM {db_prefix}arcade_personalbest AS b LEFT JOIN {db_prefix}arcade_games AS g ON (b.id_game = g.id_game) WHERE b.id_member = {int:mem}', array('mem' => $memID)); if ($result) { while ($row = $smcFunc['db_fetch_assoc']($result)) { $stats['total_plays'] += $row['my_plays']; $stats['timeplayed'] += $row['playing_time']; if ($row['id_member_first'] == $memID) { $arcade_champg[$row['internal_name']] = $row; $arcade_champg[$row['internal_name']]['linkurl'] = $scripturl . '?action=arcade;sa=play;game=' . $row['id_game']; $arcade_champg[$row['internal_name']]['time'] = timeformat($row['time_gained']); $arcade_champg[$row['internal_name']]['thumbnail'] = !$row['game_directory'] ? $arcSettings['gamesUrl'] . $row['thumbnail'] : $arcSettings['gamesUrl'] . $row['game_directory'] . "/" . $row['thumbnail']; $stats['gold']++; } elseif ($row['id_member_second'] == $memID) { $arcade_champs[$row['internal_name']] = $row; $arcade_champs[$row['internal_name']]['linkurl'] = $scripturl . '?action=arcade;sa=play;game=' . $row['id_game']; $arcade_champs[$row['internal_name']]['time'] = timeformat($row['time_gained']); $arcade_champs[$row['internal_name']]['thumbnail'] = !$row['game_directory'] ? $arcSettings['gamesUrl'] . $row['thumbnail'] : $arcSettings['gamesUrl'] . $row['game_directory'] . "/" . $row['thumbnail']; $stats['silver']++; } elseif ($row['id_member_third'] == $memID) { $arcade_champb[$row['internal_name']] = $row; $arcade_champb[$row['internal_name']]['linkurl'] = $scripturl . '?action=arcade;sa=play;game=' . $row['id_game']; $arcade_champb[$row['internal_name']]['time'] = timeformat($row['time_gained']); $arcade_champb[$row['internal_name']]['thumbnail'] = !$row['game_directory'] ? $arcSettings['gamesUrl'] . $row['thumbnail'] : $arcSettings['gamesUrl'] . $row['game_directory'] . "/" . $row['thumbnail']; $stats['bronze']++; } } } //format the time $stats['timeplayed'] = hhmmss($stats['timeplayed']); $context['arcade']['champ_pro_gold'] = $arcade_champg; $context['arcade']['champ_pro_silver'] = $arcade_champs; $context['arcade']['champ_pro_bronze'] = $arcade_champb; $context['arcade']['champ_stats'] = $stats; }