Esempio n. 1
0
 /**
  * Given an event with slides, test generation of 
  * the correct format for $slides_list
  *
  */
 public function testValidSlidesList()
 {
     // find an event with slides
     $query = $this->ci->db->get_where('talks', array('slides_link !=' => ''), 1);
     $result = $query->result();
     $this->ci->load->model('event_model');
     $detail = $this->ci->event_model->getEventTalks($result[0]->event_id);
     $this->assertGreaterThan(0, buildSlidesList($detail));
 }
Esempio n. 2
0
 /**
  * Displays a detailed overview of a specific event.
  *
  * @param integer     $id     The ID of the event to show
  * @param string|null $opt    filtering type, may be 'track' (optional)
  * @param mixed       $opt_id filter text / id (optional)
  *
  * @return bool
  */
 function view($id, $opt = null, $opt_id = null)
 {
     $this->load->helper('form');
     $this->load->helper('reqkey');
     $this->load->helper('events');
     $this->load->helper('tabs');
     $this->load->library('validation');
     $this->load->library('spamcheckservice', array('api_key' => $this->config->item('akismet_key')));
     $this->load->library('spam');
     $this->load->library('timezone');
     $this->load->library('gravatar');
     $this->load->plugin('captcha');
     $this->load->model('event_model');
     $this->load->model('event_comments_model');
     $this->load->model('user_attend_model', 'uam');
     $this->load->model('talk_track_model', 'ttm');
     $this->load->model('event_track_model', 'etm');
     $this->load->model('talk_comments_model', 'tcm');
     $this->load->model('user_admin_model', 'uadm');
     $this->load->model('tags_events_model', 'eventTags');
     $this->load->model('talks_model');
     $this->load->model('Pending_talk_claims_model', 'pendingTalkClaims');
     // validate user input (id)
     if (!ctype_digit((string) $id)) {
         show_error('An invalid event id was provided');
     }
     $events = $this->event_model->getEventDetail($id);
     $evt_admins = $this->event_model->getEventAdmins($id);
     if ($events[0]->private == 'Y') {
         $this->load->model('invite_list_model', 'ilm');
         // Private event! Check to see if they're on the invite list!
         $is_auth = $this->user_model->isAuth();
         $priv_admin = $this->user_model->isSiteAdmin() || $this->user_model->isAdminEvent($id) ? true : false;
         if ($is_auth) {
             $udata = $this->user_model->getUserByUsername($is_auth);
             $is_invite = $this->ilm->isInvited($id, $udata[0]->ID);
             //If they're invited, accept if they haven't already
             if ($is_invite) {
                 $this->ilm->acceptInvite($id, $udata[0]->ID);
             }
             if (!$is_invite && !$priv_admin) {
                 $arr = array('detail' => $events, 'is_auth' => $is_auth, 'admins' => $evt_admins);
                 $this->template->write_view('content', 'event/private', $arr, true);
                 // Render the page
                 $this->template->render();
                 return true;
             }
         } else {
             $arr = array('detail' => $events, 'is_auth' => $is_auth, 'admins' => $evt_admins);
             $this->template->write_view('content', 'event/private', $arr, true);
             // Render the page
             $this->template->render();
             return true;
         }
     }
     $talks = $this->event_model->getEventTalks($id, false);
     $is_auth = $this->user_model->isAuth();
     foreach ($talks as $k => $v) {
         $talks[$k]->tracks = $this->ttm->getSessionTrackInfo($v->ID);
         // if we have a track filter, check it!
         if (strtolower($opt) == 'track' && isset($opt_id)) {
             $has_track = false;
             foreach ($talks[$k]->tracks as $track) {
                 if ($track->ID == $opt_id) {
                     $has_track = true;
                 }
             }
             if (!$has_track) {
                 unset($talks[$k]);
             }
         }
     }
     if ($is_auth) {
         $uid = $this->session->userdata('ID');
         $chk_attend = $this->uam->chkAttend($uid, $id) ? true : false;
     } else {
         $chk_attend = false;
     }
     if (empty($events)) {
         redirect('event');
     }
     if ($events[0]->pending == 1 && !$this->user_model->isSiteAdmin()) {
         $parr = array('detail' => $events);
         $this->template->write_view('content', 'event/pending', $parr, true);
         echo $this->template->render();
         return true;
     }
     $talk_stats = buildTalkStats($this->tcm->getEventComments($id));
     $reqkey = buildReqKey();
     $attend = $this->uam->getAttendUsers($id);
     $talks = $this->talks_model->setDisplayFields($talks);
     $claimed_talks = $this->event_model->getClaimedTalks($id, $talks);
     $event_related_sessions = $this->event_model->getEventRelatedSessions($id);
     $arr = array('event_detail' => $events[0], 'talks' => $talks, 'evt_sessions' => $event_related_sessions, 'slides_list' => buildSlidesList($talks), 'admin' => $this->user_model->isAdminEvent($id) ? true : false, 'claimed' => $claimed_talks, 'user_id' => $is_auth ? $this->session->userdata('ID') : '0', 'attend' => $chk_attend, 'attend_ct' => count($attend), 'reqkey' => $reqkey, 'seckey' => buildSecFile($reqkey), 'attending' => $attend, 'admins' => $evt_admins, 'tracks' => $this->etm->getEventTracks($id), 'talk_stats' => $talk_stats, 'tab' => '', 'tags' => $this->eventTags->getTags($id), 'prompt_event_comment' => false);
     $tabList = array('talks', 'comments', 'statistics', 'evt_related', 'slides', 'tracks', 'talk_comments');
     if ($opt == 'track') {
         $arr['track_filter'] = $opt_id;
         $arr['track_data'] = null;
         foreach ($arr['tracks'] as $tr) {
             if ($tr->ID == $opt_id) {
                 $arr['track_data'] = $tr;
             }
         }
     } elseif (in_array(strtolower($opt), $tabList)) {
         $arr['tab'] = strtolower($opt);
     }
     //our event comment form
     $rules = array('event_comment' => 'required', 'cinput' => 'required|callback_cinput_check');
     $fields = array('event_comment' => 'Event Comment', 'cinput' => 'Captcha');
     $this->validation->set_fields($fields);
     $this->validation->set_rules($rules);
     if ($this->validation->run() != false) {
         $ec = array('event_id' => $id, 'comment' => $this->input->post('event_comment'), 'date_made' => time(), 'active' => 1);
         if ($is_auth) {
             $ec['user_id'] = $this->session->userdata('ID');
             $ec['cname'] = $this->session->userdata('username');
         } else {
             $ec['user_id'] = 0;
         }
         // If they're logged in, dont bother with the spam check
         if (!$is_auth) {
             $acceptable_comment = $this->spamcheckservice->isCommentAcceptable(array('comment' => $ec['comment']));
         } else {
             $acceptable_comment = true;
         }
         if ($acceptable_comment) {
             $this->db->insert('event_comments', $ec);
             $arr['msg'] = 'Comment inserted successfully!';
             $this->event_model->cacheCommentCount($id);
             if (isset($def_ret)) {
                 $ec['def_resp_spamn'] = (string) $def_ret->spaminess;
                 $ec['def_resp_spamr'] = (string) $def_ret->spam;
             }
             // Create email subject and body
             $subject = 'Joind.in event feedback for ' . $events[0]->event_name;
             $content = 'A new ';
             if (!array_key_exists('cname', $ec)) {
                 $content .= 'anonymous ';
             }
             $content .= 'comment has been added to the ' . $events[0]->event_name . " event";
             if (array_key_exists('cname', $ec)) {
                 $content .= " by " . $ec['cname'];
             }
             if (array_key_exists('date_made', $ec)) {
                 $content .= ' on ' . date('jS M Y \\a\\t H:i', $ec['date_made']);
             }
             if (array_key_exists('comment', $ec)) {
                 $content .= ":\n\n" . $ec['comment'];
             }
             $content .= "\n\n\nView on website: " . $this->config->site_url() . "event/view/{$id}#comments\n\n";
             // Create list of email addresses to send feedback to
             $to = array();
             $admins = $this->event_model->getEventAdmins($id);
             foreach ($admins as $ak => $av) {
                 $to[] = $av->email;
             }
             // Send feedback email
             foreach ($to as $tk => $tv) {
                 $from = 'From: ' . $this->config->item('email_feedback');
                 @mail($tv, $subject, $content, $from);
             }
             $this->session->set_flashdata('msg', 'Comment inserted successfully!');
         }
         redirect('event/view/' . $events[0]->ID . '#comments', 'location', 302);
     }
     $arr['comments'] = $this->event_comments_model->getEventComments($id);
     $event = $events[0];
     $tz = "UTC";
     // default
     if (!empty($event->event_tz_cont) && !empty($event->event_tz_place)) {
         $tz = $event->event_tz_cont . '/' . $event->event_tz_place;
     }
     for ($i = 0; $i < count($arr['comments']); $i++) {
         if ($arr['comments'][$i]->user_id != 0) {
             $arr['comments'][$i]->user_comment_count = $this->event_comments_model->getUserCommentCount($arr['comments'][$i]->user_id) + $this->tcm->getUserCommentCount($arr['comments'][$i]->user_id);
         }
         // sort out timezones
         $comment_datetime = $this->timezone->getDateTimeFromUnixtime($arr['comments'][$i]->date_made, $tz);
         $arr['comments'][$i]->display_datetime = $comment_datetime->format('d.M.Y \\a\\t H:i');
     }
     if (!$is_auth) {
         $info = array('msg' => sprintf(' <h4 style="color:#3A74C5">New to ' . $this->config->item('site_name') . '?</h4> Find out how we can help you make connections ' . 'whether you\'re attending or putting on the show. ' . '<a href="/about">Click here</a> to learn more!'));
         $this->template->write_view('info_block', 'msg_info', $info, true);
     }
     $this->template->write('feedurl', '/feed/event/' . $id);
     // Add 20px gravatar info to $attend
     $this->gravatar->decorateUsers($attend, 20);
     if (count($attend) > 0) {
         $this->template->write_view('sidebar3', 'event/_event_attend_gravatar', array('attend_list' => $attend));
     }
     if ($arr['admin']) {
         $this->template->write_view('sidebar2', 'event/_sidebar-admin', array('eid' => $id, 'is_private' => $events[0]->private, 'evt_admin' => $this->event_model->getEventAdmins($id), 'claim_count' => count($this->pendingTalkClaims->getEventTalkClaims($id))));
     }
     // Get the start of the last day for prompting attending users
     // for event level feedback
     $last_day = strtotime(date('Y-m-d', $events[0]->event_end));
     // For single day events, we don't want to prompt for a comment
     // until the event is over
     if ($events[0]->event_start + 60 * 60 * 25 >= $last_day) {
         $last_day = $events[0]->event_end;
     }
     // Requirements for prompting for event comments
     // - logged in
     // - attending
     // - either last day of event, or no later than 3 months from last day
     // - haven't left feedback yet already
     $feedback_deadline = strtotime('+3 month', $last_day);
     if ($is_auth && $chk_attend && (time() > $last_day && time() < $feedback_deadline)) {
         // Check to see if they have left feedback yet.
         $has_commented_event = $this->event_model->hasUserCommentedEvent($id, $arr['user_id']);
         if (!$has_commented_event) {
             $this->template->write_view('sidebar3', 'event/_event_prompt_comment_sidebar', array());
             $arr['prompt_event_comment'] = true;
         }
     }
     $arr['captcha'] = create_captcha();
     $this->session->set_userdata(array('cinput' => $arr['captcha']['value']));
     $this->template->write_view('content', 'event/detail', $arr, true);
     // only show the contact button for logged in users
     if ($is_auth) {
         $this->template->write_view('sidebar2', 'event/_event_contact', array('eid' => $id));
     }
     $this->template->render();
     //$this->load->view('event/detail', $arr);
 }
Esempio n. 3
0
 /**
  * Displays a detailed overview of a specific event.
  *
  * @param integer     $id     The ID of the event to show
  * @param string|null $opt    filtering type, may be 'track' (optional)
  * @param mixed       $opt_id filter text / id (optional)
  *
  * @return bool
  */
 function view($id, $opt = null, $opt_id = null)
 {
     $this->load->helper('form');
     $this->load->helper('reqkey');
     $this->load->helper('events');
     $this->load->helper('tabs');
     $this->load->library('validation');
     $this->load->library('defensio');
     $this->load->library('spam');
     $this->load->library('timezone');
     $this->load->library('gravatar');
     $this->load->model('event_model');
     $this->load->model('event_comments_model');
     $this->load->model('user_attend_model', 'uam');
     $this->load->model('talk_track_model', 'ttm');
     $this->load->model('event_track_model', 'etm');
     $this->load->model('talk_comments_model', 'tcm');
     $this->load->model('user_admin_model', 'uadm');
     $this->load->model('tags_events_model', 'eventTags');
     $this->load->model('talks_model');
     $this->load->model('Pending_talk_claims_model', 'pendingTalkClaims');
     // validate user input (id)
     if (!ctype_digit((string) $id)) {
         show_error('An invalid event id was provided');
     }
     $events = $this->event_model->getEventDetail($id);
     $evt_admins = $this->event_model->getEventAdmins($id);
     if ($events[0]->private == 'Y') {
         $this->load->model('invite_list_model', 'ilm');
         // Private event! Check to see if they're on the invite list!
         $is_auth = $this->user_model->isAuth();
         $priv_admin = $this->user_model->isSiteAdmin() || $this->user_model->isAdminEvent($id) ? true : false;
         if ($is_auth) {
             $udata = $this->user_model->getUser($is_auth);
             $is_invite = $this->ilm->isInvited($id, $udata[0]->ID);
             //If they're invited, accept if they haven't already
             if ($is_invite) {
                 $this->ilm->acceptInvite($id, $udata[0]->ID);
             }
             if (!$is_invite && !$priv_admin) {
                 $arr = array('detail' => $events, 'is_auth' => $is_auth, 'admins' => $evt_admins);
                 $this->template->write_view('content', 'event/private', $arr, true);
                 // Render the page
                 $this->template->render();
                 return true;
             }
         } else {
             $arr = array('detail' => $events, 'is_auth' => $is_auth, 'admins' => $evt_admins);
             $this->template->write_view('content', 'event/private', $arr, true);
             // Render the page
             $this->template->render();
             return true;
         }
     }
     $talks = $this->event_model->getEventTalks($id, false);
     $is_auth = $this->user_model->isAuth();
     foreach ($talks as $k => $v) {
         $talks[$k]->tracks = $this->ttm->getSessionTrackInfo($v->ID);
         // if we have a track filter, check it!
         if (strtolower($opt) == 'track' && isset($opt_id)) {
             $has_track = false;
             foreach ($talks[$k]->tracks as $track) {
                 if ($track->ID == $opt_id) {
                     $has_track = true;
                 }
             }
             if (!$has_track) {
                 unset($talks[$k]);
             }
         }
     }
     if ($is_auth) {
         $uid = $this->session->userdata('ID');
         $chk_attend = $this->uam->chkAttend($uid, $id) ? true : false;
     } else {
         $chk_attend = false;
     }
     if (empty($events)) {
         redirect('event');
     }
     if ($events[0]->pending == 1 && !$this->user_model->isSiteAdmin()) {
         $parr = array('detail' => $events);
         $this->template->write_view('content', 'event/pending', $parr, true);
         echo $this->template->render();
         return true;
     }
     $talk_stats = buildTalkStats($this->tcm->getEventComments($id));
     $reqkey = buildReqKey();
     $attend = $this->uam->getAttendUsers($id);
     $talks = $this->talks_model->setDisplayFields($talks);
     $claimed_talks = $this->event_model->getClaimedTalks($id, $talks);
     $event_related_sessions = $this->event_model->getEventRelatedSessions($id);
     $arr = array('event_detail' => $events[0], 'talks' => $talks, 'evt_sessions' => $event_related_sessions, 'slides_list' => buildSlidesList($talks), 'admin' => $this->user_model->isAdminEvent($id) ? true : false, 'claimed' => $claimed_talks, 'user_id' => $is_auth ? $this->session->userdata('ID') : '0', 'attend' => $chk_attend, 'attend_ct' => count($attend), 'reqkey' => $reqkey, 'seckey' => buildSecFile($reqkey), 'attending' => $attend, 'latest_comment' => $this->event_model->getLatestComment($id), 'admins' => $evt_admins, 'tracks' => $this->etm->getEventTracks($id), 'talk_stats' => $talk_stats, 'tab' => '', 'tags' => $this->eventTags->getTags($id));
     $tabList = array('talks', 'comments', 'statistics', 'evt_related', 'slides', 'tracks');
     if ($opt == 'track') {
         $arr['track_filter'] = $opt_id;
         $arr['track_data'] = null;
         foreach ($arr['tracks'] as $tr) {
             if ($tr->ID == $opt_id) {
                 $arr['track_data'] = $tr;
             }
         }
     } elseif (in_array(strtolower($opt), $tabList)) {
         $arr['tab'] = strtolower($opt);
     }
     //our event comment form
     $rules = array('event_comment' => 'required');
     $fields = array('event_comment' => 'Event Comment');
     $this->validation->set_fields($fields);
     $this->validation->set_rules($rules);
     if ($this->validation->run() != false) {
         $ec = array('event_id' => $id, 'comment' => $this->input->post('event_comment'), 'date_made' => time(), 'active' => 1);
         if ($is_auth) {
             $ec['user_id'] = $this->session->userdata('ID');
             $ec['cname'] = $this->session->userdata('username');
         } else {
             $ec['user_id'] = 0;
         }
         // If they're logged in, dont bother with the spam check
         if (!$is_auth) {
             $def_ret = $this->defensio->check('Anonymous', $ec['comment'], $is_auth, '/event/view/' . $id);
             $is_spam = (string) $def_ret->spam;
         } else {
             $is_spam = 'false';
         }
         // $this->spam->check('regex',$ec['comment']);
         if ($is_spam == 'false') {
             $this->db->insert('event_comments', $ec);
             $arr['msg'] = 'Comment inserted successfully!';
             if (isset($def_ret)) {
                 $ec['def_resp_spamn'] = (string) $def_ret->spaminess;
                 $ec['def_resp_spamr'] = (string) $def_ret->spam;
             }
             $to = array();
             $admin_emails = $this->user_model->getSiteAdminEmail();
             foreach ($admin_emails as $user) {
                 $to[] = $user->email;
             }
             // get whatever email addresses there are for the event
             $admins = $this->event_model->getEventAdmins($id);
             foreach ($admins as $ak => $av) {
                 $to[] = $av->email;
             }
             $content = '';
             $subj = $this->config->site_url() . ': Event feedback - ' . $id;
             foreach ($ec as $k => $v) {
                 $content .= '[' . $k . '] => ' . $v . "\n\n";
             }
             foreach ($to as $tk => $tv) {
                 $from = 'From: ' . $this->config->item('email_feedback');
                 @mail($tv, $subj, $content, $from);
             }
             $this->session->set_flashdata('msg', 'Comment inserted successfully!');
         }
         redirect('event/view/' . $events[0]->ID . '#comments', 'location', 302);
     }
     $arr['comments'] = $this->event_comments_model->getEventComments($id);
     if (!$is_auth) {
         $info = array('msg' => sprintf(' <h4 style="color:#3A74C5">New to ' . $this->config->item('site_name') . '?</h4> Find out how we can help you make connections ' . 'whether you\'re attending or putting on the show. ' . '<a href="/about">Click here</a> to learn more!'));
         $this->template->write_view('info_block', 'msg_info', $info, true);
     }
     $this->template->write('feedurl', '/feed/event/' . $id);
     $this->gravatar->decorateUsers($attend, 20);
     // Add 20px gravatar info to $attend
     if (count($attend) > 0) {
         $this->template->write_view('sidebar3', 'event/_event_attend_gravatar', array('attend_list' => $attend));
     }
     if ($arr['admin']) {
         $this->template->write_view('sidebar2', 'event/_sidebar-admin', array('eid' => $id, 'is_private' => $events[0]->private, 'evt_admin' => $this->event_model->getEventAdmins($id), 'claim_count' => count($this->pendingTalkClaims->getEventTalkClaims($id))));
     }
     $this->template->write_view('content', 'event/detail', $arr, true);
     // only show the contact button for logged in users
     if ($is_auth) {
         $this->template->write_view('sidebar2', 'event/_event_contact', array('eid' => $id));
     }
     $this->template->render();
     //$this->load->view('event/detail',$arr);
 }
Esempio n. 4
0
    function view($id, $opt = null, $opt_id = null)
    {
        $this->load->helper('form');
        $this->load->helper('reqkey');
        $this->load->helper('events');
        $this->load->library('validation');
        $this->load->library('defensio');
        $this->load->library('spam');
        $this->load->library('twitter');
        $this->load->library('timezone');
        $this->load->model('event_model');
        $this->load->model('event_comments_model');
        $this->load->model('user_attend_model', 'uam');
        $this->load->model('event_blog_posts_model', 'ebp');
        $this->load->model('talk_track_model', 'ttm');
        $this->load->model('event_track_model', 'etm');
        $this->load->model('talk_comments_model', 'tcm');
        $this->load->model('talks_model');
        $events = $this->event_model->getEventDetail($id);
        $evt_admins = $this->event_model->getEventAdmins($id);
        if ($events[0]->private == 'Y') {
            $this->load->model('invite_list_model', 'ilm');
            // Private event! Check to see if they're on the invite list!
            $is_auth = $this->user_model->isAuth();
            $priv_admin = $this->user_model->isSiteAdmin() || $this->user_model->isAdminEvent($id) ? true : false;
            if ($is_auth) {
                $udata = $this->user_model->getUser($is_auth);
                $is_invite = $this->ilm->isInvited($id, $udata[0]->ID);
                //If they're invited, accept if they haven't already
                if ($is_invite) {
                    $this->ilm->acceptInvite($id, $udata[0]->ID);
                }
                if (!$is_invite && !$priv_admin) {
                    $arr = array('detail' => $events, 'is_auth' => $is_auth, 'admins' => $evt_admins);
                    $this->template->write_view('content', 'event/private', $arr, TRUE);
                    // Render the page
                    $this->template->render();
                    return true;
                }
            } else {
                $arr = array('detail' => $events, 'is_auth' => $is_auth, 'admins' => $evt_admins);
                $this->template->write_view('content', 'event/private', $arr, TRUE);
                // Render the page
                $this->template->render();
                return true;
            }
        }
        $talks = $this->event_model->getEventTalks($id, false);
        $is_auth = $this->user_model->isAuth();
        foreach ($talks as $k => $v) {
            $codes = array();
            /*
            $p=explode(',',$v->speaker);
            foreach($p as $ik=>$iv){
            	$val=trim($iv);
            	$talks[$k]->codes[$val]=buildCode($v->ID,$v->event_id,$v->talk_title,$val);
            }
            */
            $talks[$k]->tracks = $this->ttm->getSessionTrackInfo($v->ID);
            //If we have a track filter, check it!
            if (strtolower($opt) == 'track' && isset($opt_id)) {
                $has_track = false;
                foreach ($talks[$k]->tracks as $track) {
                    if ($track->ID == $opt_id) {
                        $has_track = true;
                    }
                }
                if (!$has_track) {
                    unset($talks[$k]);
                }
            }
        }
        if ($is_auth) {
            $uid = $this->session->userdata('ID');
            $chk_attend = $this->uam->chkAttend($uid, $id) ? true : false;
        } else {
            $chk_attend = false;
        }
        if (empty($events)) {
            redirect('event');
        }
        if ($events[0]->pending == 1 && !$this->user_model->isSiteAdmin()) {
            $parr = array('detail' => $events);
            $this->template->write_view('content', 'event/pending', $parr, true);
            echo $this->template->render();
            return true;
        }
        //echo '<pre>'; print_r($talks); echo '</pre>';
        $talk_stats = buildTalkStats($this->tcm->getEventComments($id));
        $reqkey = buildReqKey();
        $attend = $this->uam->getAttendUsers($id);
        $talks = $this->talks_model->setDisplayFields($talks);
        $claimed_talks = $this->event_model->getClaimedTalks($id);
        $claim_detail = buildClaimDetail($claimed_talks);
        $event_related_sessions = $this->event_model->getEventRelatedSessions($id);
        $arr = array('event_detail' => $events[0], 'talks' => $talks, 'evt_sessions' => $event_related_sessions, 'slides_list' => buildSlidesList($talks), 'admin' => $this->user_model->isAdminEvent($id) ? true : false, 'claimed' => $claimed_talks, 'user_id' => $is_auth ? $this->session->userdata('ID') : '0', 'attend' => $chk_attend, 'attend_ct' => count($attend), 'reqkey' => $reqkey, 'seckey' => buildSecFile($reqkey), 'attending' => $attend, 'latest_comment' => $this->event_model->getLatestComment($id), 'admins' => $evt_admins, 'tracks' => $this->etm->getEventTracks($id), 'times_claimed' => $claim_detail['claim_count'], 'claimed_uids' => $claim_detail['uids'], 'claims' => buildClaims($this->event_model->getEventClaims($id)), 'talk_stats' => $talk_stats);
        if ($opt == 'track') {
            $arr['track_filter'] = $opt_id;
            $arr['track_data'] = null;
            foreach ($arr['tracks'] as $tr) {
                if ($tr->ID == $opt_id) {
                    $arr['track_data'] = $tr;
                }
            }
        }
        //our event comment form
        $rules = array('event_comment' => 'required');
        $fields = array('event_comment' => 'Event Comment');
        $this->validation->set_fields($fields);
        $this->validation->set_rules($rules);
        if ($this->validation->run() != FALSE) {
            $ec = array('event_id' => $id, 'comment' => $this->input->post('event_comment'), 'date_made' => time(), 'active' => 1);
            if ($is_auth) {
                $ec['user_id'] = $this->session->userdata('ID');
                $ec['cname'] = $this->session->userdata('username');
            } else {
                $ec['user_id'] = 0;
            }
            // If they're logged in, dont bother with the spam check
            if (!$is_auth) {
                $def_ret = $this->defensio->check('Anonymous', $ec['comment'], $is_auth, '/event/view/' . $id);
                $is_spam = (string) $def_ret->spam;
            } else {
                $is_spam = 'false';
            }
            //$this->spam->check('regex',$ec['comment']);
            if ($is_spam == 'false') {
                $this->db->insert('event_comments', $ec);
                $arr['msg'] = 'Comment inserted successfully!';
                if (isset($def_ret)) {
                    $ec['def_resp_spamn'] = (string) $def_ret->spaminess;
                    $ec['def_resp_spamr'] = (string) $def_ret->spam;
                }
                //print_r($ec);
                $to = array();
                $admin_emails = $this->user_model->getSiteAdminEmail();
                foreach ($admin_emails as $user) {
                    $to[] = $user->email;
                }
                // Get whatever email addresses there are for the event
                $admins = $this->event_model->getEventAdmins($id);
                foreach ($admins as $ak => $av) {
                    $to[] = $av->email;
                }
                $subj = $this->config->site_url() . ': Event feedback - ' . $id;
                $content = '';
                foreach ($ec as $k => $v) {
                    $content .= '[' . $k . '] => ' . $v . "\n\n";
                }
                foreach ($to as $tk => $tv) {
                    @mail($tv, $subj, $content, 'From: ' . $this->config->item('email_feedback'));
                }
                $this->session->set_flashdata('msg', 'Comment inserted successfully!');
            }
            redirect('event/view/' . $events[0]->ID . '#comments', 'location', 302);
        }
        $arr['comments'] = $this->event_comments_model->getEventComments($id);
        //$t=$this->twitter->querySearchAPI(explode(',',$arr['events'][0]->event_hashtag));
        // @tood for testing
        $t = array();
        $other_data = array('title' => 'Tagged on Twitter');
        if (!empty($t)) {
            $other_data = array('title' => 'Tagged on Twitter', 'results' => $t);
        }
        if (!$is_auth) {
            $info = array('msg' => sprintf('
				<h4 style="color:#3A74C5">New to ' . $this->config->item('site_name') . '?</h4> Find out how we can help you make connections
				whether you\'re attending or putting on the show. <a href="/about">Click here</a> to learn more!
			'));
            $this->template->write_view('info_block', 'msg_info', $info, TRUE);
        }
        $this->template->write('feedurl', '/feed/event/' . $id);
        // Only show if they're an admin...
        $this->template->write_view('sidebar3', 'event/_event_blog', array('entries' => $this->ebp->getPosts($id, true), 'eid' => $id));
        if ($arr['admin']) {
            $this->template->write_view('sidebar2', 'event/_sidebar-admin', array('eid' => $id, 'is_private' => $events[0]->private, 'evt_admin' => $this->event_model->getEventAdmins($id)));
        }
        $this->template->write_view('content', 'event/detail', $arr, TRUE);
        if (!empty($t)) {
            // If there's no twitter results, don't show this sidebar
            $this->template->write_view('sidebar2', 'event/_twitter-search', $other_data);
        }
        $this->template->write_view('sidebar2', 'event/_event_contact', array('eid' => $id));
        $this->template->render();
        //$this->load->view('event/detail',$arr);
    }