当前位置: 首页>>代码示例>>PHP>>正文


PHP buildSecFile函数代码示例

本文整理汇总了PHP中buildSecFile函数的典型用法代码示例。如果您正苦于以下问题:PHP buildSecFile函数的具体用法?PHP buildSecFile怎么用?PHP buildSecFile使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了buildSecFile函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: index

 function index()
 {
     $this->load->helper('form');
     $this->load->model('talks_model');
     $this->load->model('event_model');
     $this->load->model('user_attend_model');
     $this->load->model('blog_posts_model', 'bpm');
     $this->load->helper('reqkey');
     $reqkey = buildReqKey();
     $arr = array('talks' => $this->talks_model->getPopularTalks(), 'hot_events' => $this->event_model->getHotEvents(3), 'upcoming_events' => $this->event_model->getUpcomingEvents(3, false), 'logged' => $this->user_model->isAuth(), 'latest_blog' => $this->bpm->getLatestPost(), 'reqkey' => $reqkey, 'seckey' => buildSecFile($reqkey));
     // now add the attendance data for the events
     $uid = $this->user_model->getID();
     foreach ($arr['hot_events'] as $e) {
         if ($uid) {
             $e->user_attending = $this->user_attend_model->chkAttend($uid, $e->ID);
         } else {
             $e->user_attending = false;
         }
     }
     foreach ($arr['upcoming_events'] as $e) {
         if ($uid) {
             $e->user_attending = $this->user_attend_model->chkAttend($uid, $e->ID);
         } else {
             $e->user_attending = false;
         }
     }
     $this->template->write_view('content', 'main/index', $arr, TRUE);
     $this->template->render();
 }
开发者ID:bradley-holt,项目名称:joind.in,代码行数:29,代码来源:main.php

示例2: index

 /**
  * Displays the frontpage with the hot events, upcoming events,
  * latest blog post and more.
  *
  * @return void
  */
 function index()
 {
     $this->load->helper('form');
     $this->load->model('talks_model');
     $this->load->model('event_model');
     $this->load->model('user_attend_model');
     $this->load->helper('reqkey');
     $reqkey = buildReqKey();
     $arr = array('talks' => $this->talks_model->getPopularTalks(), 'hot_events' => $this->event_model->getHotEvents(7), 'logged' => $this->user_model->isAuth(), 'reqkey' => $reqkey, 'seckey' => buildSecFile($reqkey));
     // now add the attendance data for the hot events
     $uid = $this->user_model->getID();
     foreach ($arr['hot_events'] as $e) {
         $e->user_attending = $uid ? $this->user_attend_model->chkAttend($uid, $e->ID) : false;
     }
     $events = $this->event_model->getCurrentCfp();
     $this->template->parse_view('sidebar2', 'event/_event-cfp-sidebar', array('events' => $events));
     $this->template->write_view('content', 'main/index', $arr, true);
     $this->template->render();
 }
开发者ID:JustinCarmony,项目名称:joind.in,代码行数:25,代码来源:main.php

示例3: admin

 /**
  * User management page for Site admins.
  *
  * View users listing, enable/disable, etc.
  *
  * @param integer $page Number of the page to handle
  *
  * @return void
  */
 function admin($page = null)
 {
     $this->load->helper('reqkey');
     $this->load->library('validation');
     $reqkey = buildReqKey();
     $page = !$page ? 1 : $page;
     $rows_in_pg = 10;
     $offset = $page == 1 ? 1 : $page * 10;
     $all_users = $this->user_model->getAllUsers();
     $all_user_ct = count($all_users);
     $page_ct = ceil($all_user_ct / $rows_in_pg);
     $users = array_slice($all_users, $offset, $rows_in_pg);
     $fields = array('user_search' => 'Search Term');
     $rules = array('user_search' => 'required');
     $this->validation->set_rules($rules);
     $this->validation->set_fields($fields);
     if ($this->validation->run() != false) {
         $users = $this->user_model->search($this->input->post('user_search'));
     }
     $arr = array('users' => $users, 'all_user_ct' => $all_user_ct, 'page_ct' => $page_ct, 'page' => $page, 'reqkey' => $reqkey, 'seckey' => buildSecFile($reqkey));
     $this->template->write_view('content', 'user/admin', $arr);
     $this->template->render();
 }
开发者ID:Bittarman,项目名称:joind.in,代码行数:32,代码来源:user.php

示例4: view


//.........这里部分代码省略.........
            $is_auth = $this->user_model->isAuth();
            $arr = array('comment_type' => 'comment', 'comment_content' => $this->input->post('your_com'));
            $priv = $this->input->post('private');
            $priv = empty($priv) ? 0 : 1;
            $anonymous = $this->input->post('anonymous');
            $anonymous = empty($anonymous) ? 0 : 1;
            if (!$is_auth) {
                $sp_ret = $this->spam->check('regex', $this->input->post('comment'));
                error_log('sp: ' . $sp_ret);
                if ($is_auth) {
                    $ec['user_id'] = $this->session->userdata('ID');
                    $ec['cname'] = $this->session->userdata('username');
                } else {
                    $ec['user_id'] = 0;
                    $ec['cname'] = $this->input->post('cname');
                }
                $ec['comment'] = $this->input->post('comment');
                $def_ret = $this->defensio->check($ec['cname'], $ec['comment'], $is_auth, '/talk/view/' . $id);
                $is_spam = (string) $def_ret->spam;
            } else {
                // They're logged in, let their comments through
                $is_spam = false;
                $sp_ret = true;
            }
            if ($is_spam != 'true' && $sp_ret == true) {
                $arr = array('talk_id' => $id, 'rating' => $this->input->post('rating'), 'comment' => $this->input->post('comment'), 'date_made' => time(), 'private' => $priv, 'active' => 1, 'user_id' => $this->user_model->isAuth() && !$anonymous ? $this->session->userdata('ID') : '0');
                $out = '';
                if ($this->input->post('edit_comment')) {
                    $cid = $this->input->post('edit_comment');
                    $uid = $this->session->userdata('ID');
                    // be sure they have the right to update the comment
                    $com_detail = $this->tcm->getCommentDetail($cid);
                    if (isset($com_detail[0]) && $com_detail[0]->user_id == $uid) {
                        $this->db->where('ID', $cid);
                        $this->db->update('talk_comments', $arr);
                        $out = 'Comment updated!';
                    } else {
                        $out = 'Error on updating comment!';
                    }
                } else {
                    $this->db->insert('talk_comments', $arr);
                    $out = 'Comment added!';
                }
                //send an email when a comment's made
                $msg = '';
                $arr['spam'] = $is_spam == 'false' ? 'spam' : 'not spam';
                foreach ($arr as $ak => $av) {
                    $msg .= '[' . $ak . '] => ' . $av . "\n";
                }
                //if its claimed, be sure to send an email to the person to tell them
                if ($cl) {
                    $this->sendemail->sendTalkComment($id, $cl[0]->email, $talk_detail, $arr);
                }
                $this->session->set_flashdata('msg', $out);
            }
            redirect('talk/view/' . $talk_detail[0]->tid . '#comments', 'location', 302);
        }
        $captcha = create_captcha();
        $this->session->set_userdata(array('cinput' => $captcha['value']));
        $reqkey = buildReqKey();
        $talk_detail = $this->talks_model->setDisplayFields($talk_detail);
        // catch this early...if it's not a valid session...
        if (empty($talk_detail)) {
            redirect('talk');
        }
        $is_talk_admin = $this->user_model->isAdminTalk($id);
        // Retrieve ALL comments, then Reformat and filter out private comments
        $all_talk_comments = $this->talks_model->getTalkComments($id, null, true);
        $talk_comments = splitCommentTypes($all_talk_comments, $is_talk_admin, $this->session->userdata('ID'));
        // also given only makes sense if there's a speaker set
        if (!empty($talk_detail[0]->speaker)) {
            $also_given = $this->talks_model->talkAlsoGiven($id, $talk_detail[0]->event_id);
            $also_given = array('talks' => $also_given, 'title' => 'Talk Also Given At...');
        }
        $user_id = $this->user_model->isAuth() ? $this->session->userdata('ID') : null;
        $speakers = $this->talkSpeakers->getSpeakerByTalkId($id);
        // check if current user is one of the approved speakers
        $is_claim_approved = false;
        foreach ($speakers as $speaker) {
            if ($speaker->speaker_id && $speaker->speaker_id == $user_id) {
                $is_claim_approved = true;
            }
        }
        $arr = array('detail' => $talk_detail[0], 'comments' => isset($talk_comments['comment']) ? $talk_comments['comment'] : array(), 'admin' => $is_talk_admin ? true : false, 'site_admin' => $this->user_model->isSiteAdmin() ? true : false, 'auth' => $this->auth, 'claimed' => $this->talks_model->talkClaimDetail($id), 'claim_status' => $claim_status, 'claim_msg' => $claim_msg, 'is_claimed' => $this->talks_model->hasUserClaimed($id) || $is_claim_approved, 'speakers' => $speakers, 'reqkey' => $reqkey, 'seckey' => buildSecFile($reqkey), 'user_attending' => $this->user_attend_model->chkAttend($currentUserId, $talk_detail[0]->event_id) ? true : false, 'msg' => $msg, 'track_info' => $this->talkTracks->getSessionTrackInfo($id), 'user_id' => $this->user_model->isAuth() ? $this->session->userdata('ID') : null, 'captcha' => $captcha);
        $this->template->write('feedurl', '/feed/talk/' . $id);
        if (!empty($also_given['talks'])) {
            $this->template->write_view('sidebar2', 'talk/_also_given', $also_given, true);
        }
        if (!isTalkClaimFull($arr['speakers'])) {
            $this->template->write_view('sidebar3', 'main/_sidebar-block', array('title' => 'Claiming Talks', 'content' => '<p>Claiming a talk you let us know that you were the speaker 
					for it. When you claim it (and it\'s approved by the event admins) it will 
					be linked to your account.</p><p>You\'ll also receive emails when new comments 
					are posted to 	it.</p>'));
        }
        if ($is_talk_admin) {
            $this->template->write_view('sidebar3', 'talk/modules/_talk_howto', $arr);
        }
        $this->template->write_view('content', 'talk/detail', $arr, true);
        $this->template->render();
    }
开发者ID:rickogden,项目名称:joind.in,代码行数:101,代码来源:talk.php

示例5: view

 /**
  * Displays the details of a specific blog post.
  *
  * @param integer $id ID of the blog post to display
  *
  * @return void
  */
 function view($id)
 {
     $this->load->helper('form');
     $this->load->library('validation');
     $this->load->library('akismet');
     $this->load->library('defensio');
     $this->load->library('spam');
     $this->load->helper('reqkey');
     $this->load->model('blog_posts_model', 'blogPostsModel');
     $this->blogPostsModel->updatePostViews($id);
     $reqkey = buildReqKey();
     $arr = array('details' => $this->blogPostsModel->getPostDetail($id), 'is_admin' => $this->user_model->isSiteAdmin(), 'reqkey' => $reqkey, 'seckey' => buildSecFile($reqkey));
     $other_data = array('title' => 'Popular Blog Posts', 'posts' => $this->blogPostsModel->getPostDetail(), 'curr_id' => $id);
     if ($this->user_model->isAuth()) {
         $udata = $this->user_model->getUser($this->session->userdata('ID'));
         $arr['full_name'] = !empty($udata[0]->full_name) ? $udata[0]->full_name : $udata[0]->username;
     }
     $this->template->write('feedurl', '/feed/blog');
     $this->template->write_view('sidebar2', 'blog/_other-posts', $other_data);
     $this->template->write_view('content', 'blog/view', $arr);
     $this->template->render();
 }
开发者ID:jeremykendall,项目名称:joind.in,代码行数:29,代码来源:blog.php

示例6: callforpapers

 /**
  * Call for Papers method
  *
  * @param null $eventId [optional] Event ID
  *
  * @return void
  */
 public function callforpapers($eventId = null)
 {
     $this->load->model('event_model', 'eventModel');
     $this->load->model('user_attend_model');
     $this->load->helper('reqkey');
     $reqkey = buildReqKey();
     $arr = array('current_cfp' => $this->eventModel->getCurrentCfp(), 'reqkey' => $reqkey, 'seckey' => buildSecFile($reqkey));
     // now add the attendance data
     $uid = $this->user_model->getID();
     foreach ($arr['current_cfp'] as $e) {
         $e->user_attending = $uid ? $this->user_attend_model->chkAttend($uid, $e->ID) : false;
     }
     $this->template->write_view('content', 'event/callforpapers', $arr);
     $this->template->render();
 }
开发者ID:asgrim,项目名称:joind.in,代码行数:22,代码来源:event.php

示例7: view

 /**
  * Displays the details of a user.
  *
  * @param string|integer $uid Either the username or id of the user
  *
  * @return void
  */
 function view($uid)
 {
     $this->load->model('talks_model');
     $this->load->model('pending_talk_claims_model');
     $this->load->model('user_attend_model', 'uam');
     $this->load->model('user_admin_model', 'uadmin');
     $this->load->helper('reqkey');
     $this->load->helper('url');
     $this->load->library('gravatar');
     $reqkey = buildReqKey();
     // see if we have a sort type and apply it
     $p = explode('/', uri_string());
     $sort_type = isset($p[4]) ? $p[4] : null;
     $details = $this->user_model->getUserById($uid);
     // sf the user doesn't exist, redirect!
     if (!isset($details[0])) {
         redirect();
     }
     $imgStr = $this->gravatar->displayUserImage($uid, $details[0]->email, 80);
     if (empty($details[0])) {
         redirect();
     }
     // reset our UID based on what we found...
     $uid = $details[0]->ID;
     $curr_user = $this->session->userdata('ID');
     $arr = array('details' => $details, 'comments' => $this->talks_model->getUserComments($uid), 'talks' => $this->talks_model->getUserTalks($uid), 'is_admin' => $this->user_model->isSiteAdmin(), 'is_attending' => $this->uam->getUserAttending($uid), 'my_attend' => $this->uam->getUserAttending($curr_user), 'uadmin' => array('events' => $this->uadmin->getUserTypes($uid, array('event')), 'talks' => $this->talks_model->getSpeakerTalks($uid, true), 'pending_talks' => $this->pending_talk_claims_model->getTalkClaimsForUser($uid)), 'reqkey' => $reqkey, 'seckey' => buildSecFile($reqkey), 'sort_type' => $sort_type, 'gravatar' => $imgStr);
     if ($curr_user) {
         $arr['pending_evt'] = $this->uadmin->getUserTypes($curr_user, array('event'), true);
     } else {
         $arr['pending_evt'] = array();
     }
     $this->template->write_view('content', 'user/view', $arr);
     $this->template->render();
 }
开发者ID:richsage,项目名称:joind.in,代码行数:41,代码来源:user.php

示例8: view


//.........这里部分代码省略.........
             $sp_ret = true;
         }
         if ($acceptable_comment && $sp_ret == true) {
             $arr = array('talk_id' => $id, 'rating' => $this->input->post('rating'), 'comment' => $this->input->post('comment'), 'date_made' => time(), 'private' => $priv, 'active' => 1, 'user_id' => $this->user_model->isAuth() && !$anonymous ? $this->session->userdata('ID') : '0');
             $out = '';
             if ($this->input->post('edit_comment')) {
                 $cid = $this->input->post('edit_comment');
                 $uid = $this->session->userdata('ID');
                 // be sure they have the right to update the comment
                 $com_detail = $this->tcm->getCommentDetail($cid);
                 if (isset($com_detail[0]) && $com_detail[0]->user_id == $uid) {
                     // if the user has already rated and we're not editing that comment,
                     // then the rating for this comment is zero
                     if ($already_rated && $already_rated != $cid) {
                         $arr['rating'] = 0;
                     }
                     $commentEditTime = $com_detail[0]->date_made + $this->config->item('comment_edit_time');
                     if (time() >= $commentEditTime) {
                         $out = 'This comment has passed its edit-time.' . ' You cannot edit this comment anymore.';
                     } else {
                         $this->db->where('ID', $cid);
                         // unset date made.
                         unset($arr['date_made']);
                         if ($com_detail[0]->rating == 0) {
                             $arr['rating'] = 0;
                         }
                         $this->db->update('talk_comments', $arr);
                         $out = 'Comment updated!';
                     }
                 } else {
                     $out = 'Error on updating comment!';
                 }
             } else {
                 $this->db->insert('talk_comments', $arr);
                 $out = 'Comment added!';
             }
             //send an email when a comment's made
             $msg = '';
             $arr['spam'] = $is_spam == 'false' ? 'spam' : 'not spam';
             foreach ($arr as $ak => $av) {
                 $msg .= '[' . $ak . '] => ' . $av . "\n";
             }
             //if its claimed, be sure to send an email to the person to tell them
             if ($cl) {
                 $this->sendemail->sendTalkComment($id, $cl[0]->email, $talk_detail, $arr);
             }
             $this->session->set_flashdata('msg', $out);
         }
         redirect('talk/view/' . $talk_detail[0]->tid . '#comments', 'location', 302);
     }
     $captcha = create_captcha();
     $this->session->set_userdata(array('cinput' => $captcha['value']));
     $reqkey = buildReqKey();
     $talk_detail = $this->talks_model->setDisplayFields($talk_detail);
     // catch this early...if it's not a valid session...
     if (empty($talk_detail)) {
         redirect('talk');
     }
     $is_talk_admin = $this->user_model->isAdminTalk($id);
     // Retrieve ALL comments, then Reformat and filter out private comments
     $all_talk_comments = $this->talks_model->getTalkComments($id, null, true);
     $talk_comments = splitCommentTypes($all_talk_comments, $is_talk_admin, $this->session->userdata('ID'));
     // also given only makes sense if there's a speaker set
     if (!empty($talk_detail[0]->speaker)) {
         $also_given = $this->talks_model->talkAlsoGiven($id, $talk_detail[0]->event_id);
         $also_given = array('talks' => $also_given, 'title' => 'Talk Also Given At...');
     }
     $user_id = $this->user_model->isAuth() ? $this->session->userdata('ID') : null;
     $speakers = $this->talkSpeakers->getSpeakerByTalkId($id);
     // check if current user is one of the approved speakers
     $is_claim_approved = false;
     foreach ($speakers as $speaker) {
         if ($speaker->speaker_id && $speaker->speaker_id == $user_id) {
             $is_claim_approved = true;
         }
     }
     if (isset($talk_comments['comment'])) {
         for ($i = 0; $i < count($talk_comments['comment']); $i++) {
             if ($talk_comments['comment'][$i]->user_id != 0) {
                 $talk_comments['comment'][$i]->user_comment_count = $this->event_comments_model->getUserCommentCount($talk_comments['comment'][$i]->user_id) + $this->tcm->getUserCommentCount($talk_comments['comment'][$i]->user_id);
             }
         }
     }
     $arr = array('detail' => $talk_detail[0], 'comments' => isset($talk_comments['comment']) ? $talk_comments['comment'] : array(), 'admin' => $is_talk_admin ? true : false, 'site_admin' => $this->user_model->isSiteAdmin() ? true : false, 'auth' => $this->auth, 'claimed' => $this->talks_model->talkClaimDetail($id), 'claim_status' => $claim_status, 'claim_msg' => $claim_msg, 'is_claimed' => $this->talks_model->hasUserClaimed($id) || $is_claim_approved, 'speakers' => $speakers, 'reqkey' => $reqkey, 'seckey' => buildSecFile($reqkey), 'user_attending' => $this->user_attend_model->chkAttend($currentUserId, $talk_detail[0]->event_id) ? true : false, 'msg' => $msg, 'track_info' => $this->talkTracks->getSessionTrackInfo($id), 'user_id' => $this->user_model->isAuth() ? $this->session->userdata('ID') : null, 'captcha' => $captcha, 'alreadyRated' => $already_rated);
     $this->template->write('feedurl', '/feed/talk/' . $id);
     if (!empty($also_given['talks'])) {
         $this->template->write_view('sidebar2', 'talk/_also_given', $also_given, true);
     }
     if (!isTalkClaimFull($arr['speakers'])) {
         $this->template->write_view('sidebar3', 'main/_sidebar-block', array('title' => 'Claiming Talks', 'content' => '<p>Is this your talk? Claim it! By doing so it
                 lets us know you are the speaker. Once your claim is
                 verified by event administration it will be linked to your
                 account.</p>'));
     }
     if ($is_talk_admin) {
         $this->template->write_view('sidebar3', 'talk/modules/_talk_howto', $arr);
     }
     $this->template->write_view('content', 'talk/detail', $arr, true);
     $this->template->render();
 }
开发者ID:nbalmer,项目名称:joind.in,代码行数:101,代码来源:talk.php

示例9: tracks

 /**
  * Displays a list of tracks for the given event id.
  *
  * @param integer $id The id of the event
  *
  * @return void
  */
 function tracks($id)
 {
     if (!$this->user_model->isSiteAdmin() && !$this->user_model->isAdminEvent($id)) {
         redirect();
     }
     $this->load->model('event_track_model', 'etm');
     $this->load->model('event_model');
     $this->load->helper('reqkey');
     $reqkey = buildReqKey();
     $arr = array('detail' => $this->event_model->getEventDetail($id), 'tracks' => $this->etm->getEventTracks($id), 'admin' => $this->user_model->isAdminEvent($id) ? true : false, 'reqkey' => $reqkey, 'seckey' => buildSecFile($reqkey));
     $this->template->write_view('content', 'event/tracks', $arr);
     $this->template->render();
 }
开发者ID:jeremykendall,项目名称:joind.in,代码行数:20,代码来源:event.php

示例10: index

 /**
  * Displays the search page and results when used.
  *
  * @return void
  */
 function index()
 {
     $this->load->helper('form');
     $this->load->library('validation');
     $this->load->model('talks_model');
     $this->load->model('event_model');
     $this->load->helper('reqkey');
     $results = array();
     $rules = array('search_term' => 'required');
     $fields = array('search_term' => 'Search Term', 'start_mo' => 'Start Month', 'start_day' => 'Start Day', 'start_yr' => 'Start Year', 'end_mo' => 'End Month', 'end_day' => 'End Day', 'end_yr' => 'End Year');
     $this->validation->set_rules($rules);
     $this->validation->set_fields($fields);
     //success! search the talks and events
     if ($this->validation->run() == true) {
         $query = 'q:' . urlencode($this->input->post('search_term'));
         $start = 0;
         $end = 0;
         $start_mo = $this->input->post('start_mo');
         $end_mo = $this->input->post('end_mo');
         if (!empty($start_mo)) {
             $start = sprintf('%04d-%02d-%02d', $this->input->post('start_yr'), $this->input->post('start_mo'), $this->input->post('start_day'));
             $query .= '/start:' . $start;
         }
         if (!empty($end_mo)) {
             $end = sprintf('%04d-%02d-%02d', $this->input->post('end_yr'), $this->input->post('end_mo'), $this->input->post('end_day'));
             $query .= '/end:' . $end;
         }
         redirect('search/' . $query, 'location', 302);
     }
     $results = null;
     $rsegments = $this->uri->rsegments;
     array_shift($rsegments);
     // Remove controller
     array_shift($rsegments);
     // Remove action
     if (count($rsegments) > 0) {
         $rsegments = array_slice($rsegments, 0, 3);
         $search_term = null;
         $start = null;
         $end = null;
         foreach ($rsegments as $val) {
             if (false !== ($pos = strpos($val, 'q:'))) {
                 $search_term = substr($val, 2);
                 continue;
             }
             if (false !== ($pos = strpos($val, 'start:'))) {
                 $start = substr($val, 6);
                 continue;
             }
             if (false !== ($pos = strpos($val, 'end:'))) {
                 $end = substr($val, 4);
                 continue;
             }
         }
         if (!empty($search_term)) {
             $this->validation->search_term = urldecode($search_term);
             if (null !== $start) {
                 $start = max(0, @strtotime($start));
                 $this->validation->start_mo = date('m', $start);
                 $this->validation->start_day = date('d', $start);
                 $this->validation->start_yr = date('Y', $start);
             }
             if (null !== $end) {
                 $end = max(0, @strtotime($end));
                 $this->validation->end_mo = date('m', $end);
                 $this->validation->end_day = date('d', $end);
                 $this->validation->end_yr = date('Y', $end);
             }
             //check to see if they entered a date and set that first
             $search_term = urldecode($search_term);
             $results = array('talks' => $this->talks_model->search($search_term, $start, $end), 'events' => $this->event_model->search($search_term, $start, $end), 'users' => $this->user_model->search($search_term, $start, $end));
         }
     }
     $reqkey = buildReqKey();
     $arr = array('results' => $results, 'reqkey' => $reqkey, 'seckey' => buildSecFile($reqkey));
     $this->template->write_view('content', 'search/main', $arr, true);
     $this->template->render();
 }
开发者ID:Bittarman,项目名称:joind.in,代码行数:83,代码来源:search.php

示例11: view


//.........这里部分代码省略.........
     $fields = array('comment' => 'Comment', 'rating' => 'Rating');
     // if it's past time for the talk, they're required
     // All other times they're not required...
     if (time() >= $talk_detail[0]->date_given) {
         $rules['comment'] = 'required';
     }
     // This is for the CAPTACHA - it was disabled for authenticatied users
     //if(!$this->user_model->isAuth()){
     //	$rules['cinput']	= 'required|callback_cinput_check';
     //	$fields['cinput']	= 'Captcha';
     //}
     $this->validation->set_rules($rules);
     $this->validation->set_fields($fields);
     if ($this->validation->run() == FALSE) {
         // vote processing code removed
     } else {
         $is_auth = $this->user_model->isAuth();
         $arr = array('comment_type' => 'comment', 'comment_content' => $this->input->post('your_com'));
         $ret = $this->akismet->send('/1.1/comment-check', $arr);
         $priv = $this->input->post('private');
         $priv = empty($priv) ? 0 : 1;
         if (!$is_auth) {
             $sp_ret = $this->spam->check('regex', $this->input->post('comment'));
             error_log('sp: ' . $sp_ret);
             if ($is_auth) {
                 $ec['user_id'] = $this->session->userdata('ID');
                 $ec['cname'] = $this->session->userdata('username');
             } else {
                 $ec['user_id'] = 0;
                 $ec['cname'] = $this->input->post('cname');
             }
             $ec['comment'] = $this->input->post('comment');
             $def_ret = $this->defensio->check($ec['cname'], $ec['comment'], $is_auth, '/talk/view/' . $id);
             $is_spam = (string) $def_ret->spam;
             if (strtolower($ec['cname']) == 'dynom') {
                 $is_spam = 'false';
             }
             //hack to allow comments for now
         } else {
             // They're logged in, let their comments through
             $is_spam = false;
             $sp_ret = true;
         }
         if ($is_spam != 'true' && $sp_ret == true) {
             $arr = array('talk_id' => $id, 'rating' => $this->input->post('rating'), 'comment' => $this->input->post('comment'), 'date_made' => time(), 'private' => $priv, 'active' => 1, 'user_id' => $this->user_model->isAuth() ? $this->session->userdata('ID') : '0');
             $out = '';
             if ($this->input->post('edit_comment')) {
                 $cid = $this->input->post('edit_comment');
                 $uid = $this->session->userdata('ID');
                 // Be sure they have the right to update the comment
                 $com_detail = $this->tcm->getCommentDetail($cid);
                 if (isset($com_detail[0]) && $com_detail[0]->user_id == $uid) {
                     $this->db->where('ID', $cid);
                     $this->db->update('talk_comments', $arr);
                     $out = 'Comment updated!';
                 } else {
                     $out = 'Error on updating comment!';
                 }
             } else {
                 $this->db->insert('talk_comments', $arr);
                 $out = 'Comment added!';
             }
             //send an email when a comment's made
             $msg = '';
             $arr['spam'] = $ret == 'false' ? 'spam' : 'not spam';
             foreach ($arr as $ak => $av) {
                 $msg .= '[' . $ak . '] => ' . $av . "\n";
             }
             @mail($this->config->item('email_admin'), 'Comment on talk ' . $id, $msg, 'From: ' . $this->config->item('email_comments'));
             //if its claimed, be sure to send an email to the person to tell them
             if ($cl) {
                 $this->sendemail->sendTalkComment($id, $cl[0]->email, $talk_detail, $arr);
             }
             $this->session->set_flashdata('msg', $out);
         }
         redirect('talk/view/' . $talk_detail[0]->tid . '#comments', 'location', 302);
     }
     //$cap = create_captcha($cap_arr);
     //$this->session->set_userdata(array('cinput'=>$cap['word']));
     $reqkey = buildReqKey();
     $talk_detail = $this->talks_model->setDisplayFields($talk_detail);
     // catch this early...if it's not a valid session...
     if (empty($talk_detail)) {
         redirect('talk');
     }
     $is_talk_admin = $this->user_model->isAdminTalk($id);
     // Check to see if they can view private comments....
     $view_private = $this->user_model->canViewPrivateComments($talk_detail[0]->eid, $id) ? true : false;
     $event_claims = $this->event_model->getClaimedTalks($talk_detail[0]->eid);
     $talk_comments = splitCommentTypes($this->talks_model->getTalkComments($id, null, $view_private));
     $also_given = $this->talks_model->talkAlsoGiven($id, $talk_detail[0]->event_id);
     $also_given = array('talks' => $also_given, 'title' => 'Talk Also Given At...');
     $arr = array('detail' => $talk_detail[0], 'comments' => isset($talk_comments['comment']) ? $talk_comments['comment'] : array(), 'admin' => $is_talk_admin ? true : false, 'site_admin' => $this->user_model->isSiteAdmin() ? true : false, 'auth' => $this->auth, 'claimed' => $this->talks_model->isTalkClaimed($id), 'claims' => $event_claims, 'claim_status' => $claim_status, 'claim_msg' => $claim_msg, 'claim_details' => $this->uam->getTalkClaims($id), 'speakers' => $this->tsm->getSpeakerByTalkId($id), 'reqkey' => $reqkey, 'seckey' => buildSecFile($reqkey), 'user_attending' => $this->user_attend_model->chkAttend($currentUserId, $talk_detail[0]->event_id) ? true : false, 'msg' => $msg, 'track_info' => $this->ttm->getSessionTrackInfo($id), 'user_id' => $this->user_model->isAuth() ? $this->session->userdata('ID') : null);
     $this->template->write('feedurl', '/feed/talk/' . $id);
     if (!empty($also_given['talks'])) {
         $this->template->write_view('sidebar2', 'talk/_also_given', $also_given, TRUE);
     }
     $this->template->write_view('content', 'talk/detail', $arr, TRUE);
     $this->template->render();
 }
开发者ID:bradley-holt,项目名称:joind.in,代码行数:101,代码来源:talk.php

示例12: view

 function view($id)
 {
     $this->load->helper('form');
     $this->load->library('validation');
     $this->load->library('akismet');
     $this->load->library('defensio');
     $this->load->library('spam');
     $this->load->helper('reqkey');
     $this->load->model('blog_posts_model', 'bpm');
     $this->load->model('blog_comments_model', 'bcm');
     $this->bpm->updatePostViews($id);
     $reqkey = buildReqKey();
     $fields = array('title' => 'Title', 'comment' => 'Comment', 'name' => 'Name');
     $rules = array('title' => 'required', 'comment' => 'required', 'name' => 'required');
     $this->validation->set_rules($rules);
     $this->validation->set_fields($fields);
     if ($this->validation->run() != FALSE) {
         $arr = array('comment_type' => 'comment', 'comment_content' => $this->input->post('comment'));
         $ret = $this->akismet->send('/1.1/comment-check', $arr);
         //check with defensio
         $ec = array();
         $ec['comment'] = $this->input->post('comment');
         $def_ret = $this->defensio->check('anonymous', $ec['comment'], false, '/blog/view/' . $id);
         $is_spam = (string) $def_ret->spam;
         //check with our local filters
         $sp_ret = $this->spam->check('regex', $this->input->post('comment'));
         //passed...;
         $arr = array('title' => $this->input->post('title'), 'author_id' => (int) $this->session->userdata('ID'), 'author_name' => $this->input->post('name'), 'content' => $this->input->post('comment'), 'blog_post_id' => $id);
         //print_r($arr);
         if ($is_spam != 'true' && $sp_ret == true) {
             $this->db->insert('blog_comments', $arr);
             $subj = 'Blog comment on entry ' . $id . ' from ' . $this->config->item('site_name');
             $cont = 'Title: ' . $this->input->post('title') . "\n\n";
             $cont .= 'Content: ' . $this->input->post('comment') . "\n\n";
             $cont .= 'Post: ' . $this->config->site_url() . 'blog/view/' . $id . "\n\n";
             $cont .= 'Spam check: ' . ($ret == 'false') ? 'not spam' : 'spam caught';
             $admin_emails = $this->user_model->getSiteAdminEmail();
             foreach ($admin_emails as $user) {
                 mail($user->email, $subj, $cont, 'From: ' . $this->config->item('email_feedback'));
             }
             //redirect('blog/view/'.$id . '#comments', 'location', 302);
         }
     } else {
         //failed...
     }
     $arr = array('details' => $this->bpm->getPostDetail($id), 'is_admin' => $this->user_model->isSiteAdmin(), 'comments' => $this->bcm->getPostComments($id), 'pid' => $id, 'reqkey' => $reqkey, 'seckey' => buildSecFile($reqkey));
     $other_data = array('title' => 'Popular Blog Posts', 'posts' => $this->bpm->getPostDetail(), 'curr_id' => $id);
     if ($this->user_model->isAuth()) {
         $udata = $this->user_model->getUser($this->session->userdata('ID'));
         //print_r($udata);
         $arr['full_name'] = !empty($udata[0]->full_name) ? $udata[0]->full_name : $udata[0]->username;
     }
     $this->template->write('feedurl', '/feed/blog');
     $this->template->write_view('sidebar2', 'blog/_other-posts', $other_data);
     $this->template->write_view('content', 'blog/view', $arr);
     $this->template->render();
 }
开发者ID:bradley-holt,项目名称:joind.in,代码行数:57,代码来源:blog.php

示例13: index

 /**
  * Displays the search page and results when used.
  *
  * @return void
  */
 function index()
 {
     $this->load->helper('form');
     $this->load->library('validation');
     $this->load->model('talks_model');
     $this->load->model('event_model');
     $this->load->helper('reqkey');
     $results = array();
     $rules = array('search_term' => 'required');
     $fields = array('search_term' => 'Search Term', 'start_mo' => 'Start Month', 'start_day' => 'Start Day', 'start_yr' => 'Start Year', 'end_mo' => 'End Month', 'end_day' => 'End Day', 'end_yr' => 'End Year');
     $this->validation->set_rules($rules);
     $this->validation->set_fields($fields);
     //success! search the talks and events
     if ($this->validation->run() == true) {
         $query = 'q:' . urlencode($this->input->post('search_term'));
         // Replace urlencoded / (%2F) with something that's URL safe and not
         // likely to ever really be searched on: _|_. Apache does not allow
         // URLs with encoded /'s for security reasons. It doesn't even get
         // to mod_rewrite. Which is why searches with / got a 404 previously.
         $query = str_replace('%2F', self::SLASH_REPLACEMENT, $query);
         $start = 0;
         $end = 0;
         $start_mo = $this->input->post('start_mo');
         $end_mo = $this->input->post('end_mo');
         if (!empty($start_mo)) {
             $start = sprintf('%04d-%02d-%02d', $this->input->post('start_yr'), $this->input->post('start_mo'), $this->input->post('start_day'));
             $query .= '/start:' . $start;
         }
         if (!empty($end_mo)) {
             $end = sprintf('%04d-%02d-%02d', $this->input->post('end_yr'), $this->input->post('end_mo'), $this->input->post('end_day'));
             $query .= '/end:' . $end;
         }
         redirect('search/' . $query, 'location', 302);
     }
     $results = null;
     $rsegments = $this->uri->rsegments;
     array_shift($rsegments);
     // Remove controller
     array_shift($rsegments);
     // Remove action
     if (count($rsegments) > 0) {
         $rsegments = array_slice($rsegments, 0, 3);
         $search_term = null;
         $start = null;
         $end = null;
         foreach ($rsegments as $val) {
             if (false !== ($pos = strpos($val, 'q:'))) {
                 $search_term = substr($val, 2);
                 continue;
             }
             if (false !== ($pos = strpos($val, 'start:'))) {
                 $start = substr($val, 6);
                 continue;
             }
             if (false !== ($pos = strpos($val, 'end:'))) {
                 $end = substr($val, 4);
                 continue;
             }
         }
         if (!empty($search_term)) {
             // Put the /'s back. If there's a _|_ in the search term, assume
             // it was originally a /
             $search_term = str_replace(self::SLASH_REPLACEMENT, '%2F', $search_term);
             $this->validation->search_term = urldecode($search_term);
             if (null !== $start) {
                 $start = max(0, @strtotime($start));
                 $this->validation->start_mo = date('m', $start);
                 $this->validation->start_day = date('d', $start);
                 $this->validation->start_yr = date('Y', $start);
             }
             if (null !== $end) {
                 $end = max(0, @strtotime($end));
                 $this->validation->end_mo = date('m', $end);
                 $this->validation->end_day = date('d', $end);
                 $this->validation->end_yr = date('Y', $end);
             }
             //check to see if they entered a date and set that first
             $search_term = urldecode($search_term);
             $results = array('talks' => $this->talks_model->search($search_term, $start, $end), 'events' => $this->event_model->search($search_term, $start, $end), 'users' => $this->user_model->search($search_term, $start, $end));
         }
     }
     $reqkey = buildReqKey();
     $arr = array('results' => $results, 'reqkey' => $reqkey, 'seckey' => buildSecFile($reqkey));
     $this->template->write_view('content', 'search/main', $arr, true);
     $this->template->render();
 }
开发者ID:asgrim,项目名称:joind.in,代码行数:91,代码来源:search.php


注:本文中的buildSecFile函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。