function postcalendar_userapi_eventDetail($args, $admin = false) { if (!(bool) PC_ACCESS_READ) { return _POSTCALENDARNOAUTH; } // get the theme globals :: is there a better way to do this? pnThemeLoad(pnUserGetTheme()); global $bgcolor1, $bgcolor2, $bgcolor3, $bgcolor4, $bgcolor5; global $textcolor1, $textcolor2; $popup = pnVarCleanFromInput('popup'); extract($args); unset($args); if (!isset($cacheid)) { $cacheid = null; } if (!isset($eid)) { return false; } if (!isset($nopop)) { $nopop = false; } $uid = pnUserGetVar('uid'); //================================================================= // Find out what Template we're using //================================================================= $template_name = _SETTING_TEMPLATE; if (!isset($template_name)) { $template_name = 'default'; } //================================================================= // Setup Smarty Template Engine //================================================================= $tpl = new pcSmarty(); if ($admin) { $template = $template_name . '/admin/details.html'; $args['cacheid'] = ''; $print = 0; $Date =& postcalendar_getDate(); $tpl->caching = false; } else { $template = $template_name . '/user/details.html'; } if (!$tpl->is_cached($template, $cacheid)) { // let's get the DB information list($dbconn) = pnDBGetConn(); $pntable = pnDBGetTables(); // get the event's information $event =& postcalendar_userapi_pcGetEventDetails($eid); // if the above is false, it's a private event for another user // we should not diplay this - so we just exit gracefully if ($event === false) { return false; } //================================================================= // get event's topic information //================================================================= $topics_table = $pntable['topics']; $topics_column = $pntable['topics_column']; $topicsql = "SELECT {$topics_column['topictext']},{$topics_column['topicimage']}\n FROM {$topics_table}\n WHERE {$topics_column['topicid']} = {$event['topic']}\n LIMIT 1"; $topic_result = $dbconn->Execute($topicsql); list($event['topictext'], $event['topicimg']) = $topic_result->fields; $location = unserialize($event['location']); $event['location'] = $location['event_location']; $event['street1'] = $location['event_street1']; $event['street2'] = $location['event_street2']; $event['city'] = $location['event_city']; $event['state'] = $location['event_state']; $event['postal'] = $location['event_postal']; $event['date'] = str_replace('-', '', $Date); //================================================================= // populate the template //================================================================= if (!empty($event['location']) || !empty($event['street1']) || !empty($event['street2']) || !empty($event['city']) || !empty($event['state']) || !empty($event['postal'])) { $tpl->assign('LOCATION_INFO', true); } else { $tpl->assign('LOCATION_INFO', false); } if (!empty($event['contname']) || !empty($event['contemail']) || !empty($event['conttel']) || !empty($event['website'])) { $tpl->assign('CONTACT_INFO', true); } else { $tpl->assign('CONTACT_INFO', false); } $display_type = substr($event['hometext'], 0, 6); if ($display_type == ':text:') { $prepFunction = 'pcVarPrepForDisplay'; $event['hometext'] = substr($event['hometext'], 6); } elseif ($display_type == ':html:') { $prepFunction = 'pcVarPrepHTMLDisplay'; $event['hometext'] = substr($event['hometext'], 6); } else { $prepFunction = 'pcVarPrepHTMLDisplay'; } unset($display_type); // prep the vars for output $event['title'] =& $prepFunction($event['title']); $event['hometext'] =& $prepFunction($event['hometext']); $event['desc'] =& $event['hometext']; $event['conttel'] =& $prepFunction($event['conttel']); $event['contname'] =& $prepFunction($event['contname']); $event['contemail'] =& $prepFunction($event['contemail']); $event['website'] =& $prepFunction(postcalendar_makeValidURL($event['website'])); $event['fee'] =& $prepFunction($event['fee']); $event['location'] =& $prepFunction($event['location']); $event['street1'] =& $prepFunction($event['street1']); $event['street2'] =& $prepFunction($event['street2']); $event['city'] =& $prepFunction($event['city']); $event['state'] =& $prepFunction($event['state']); $event['postal'] =& $prepFunction($event['postal']); $tpl->assign_by_ref('A_EVENT', $event); //================================================================= // populate the template $ADMIN_OPTIONS //================================================================= $target = ''; if (_SETTING_OPEN_NEW_WINDOW) { $target = 'target="csCalendar"'; } $admin_edit_url = $admin_delete_url = ''; if (pnSecAuthAction(0, 'PostCalendar::', '::', ACCESS_ADMIN)) { $admin_edit_url = pnModURL(__POSTCALENDAR__, 'admin', 'submit', array('pc_event_id' => $eid)); $admin_delete_url = pnModURL(__POSTCALENDAR__, 'admin', 'adminevents', array('action' => _ACTION_DELETE, 'pc_event_id' => $eid)); } $user_edit_url = $user_delete_url = ''; if (pnUserLoggedIn()) { $logged_in_uname = $_SESSION['authUser']; } else { $logged_in_uname = ''; } $can_edit = false; if (pnSecAuthAction(0, 'PostCalendar::', '::', ACCESS_ADD) && validateGroupStatus($logged_in_uname, getUsername($event['uname']))) { $user_edit_url = pnModURL(__POSTCALENDAR__, 'user', 'submit', array('pc_event_id' => $eid)); $user_delete_url = pnModURL(__POSTCALENDAR__, 'user', 'delete', array('pc_event_id' => $eid)); $can_edit = true; } $tpl->assign('STYLE', $GLOBALS['style']); $tpl->assign_by_ref('ADMIN_TARGET', $target); $tpl->assign_by_ref('ADMIN_EDIT', $admin_edit_url); $tpl->assign_by_ref('ADMIN_DELETE', $admin_delete_url); $tpl->assign_by_ref('USER_TARGET', $target); $tpl->assign_by_ref('USER_EDIT', $user_edit_url); $tpl->assign_by_ref('USER_DELETE', $user_delete_url); $tpl->assign_by_ref('USER_CAN_EDIT', $can_edit); } //================================================================= // Parse the template //================================================================= if ($popup != 1 && $print != 1) { $output = "\n\n<!-- START POSTCALENDAR OUTPUT [-: HTTP://POSTCALENDAR.TV :-] -->\n\n"; $output .= $tpl->fetch($template, $cacheid); $output .= "\n\n<!-- END POSTCALENDAR OUTPUT [-: HTTP://POSTCALENDAR.TV :-] -->\n\n"; } else { $theme = pnUserGetTheme(); echo "<html><head>"; echo "<LINK REL=\"StyleSheet\" HREF=\"themes/{$theme}/style/styleNN.css\" TYPE=\"text/css\">\n\n\n"; echo "<style type=\"text/css\">\n"; echo "@import url(\"themes/{$theme}/style/style.css\"); "; echo "</style>\n"; echo "</head><body>\n"; $tpl->display($template, $cacheid); echo postcalendar_footer(); echo "\n</body></html>"; session_write_close(); exit; } return $output; }