コード例 #1
0
 public function set_trip_faqs()
 {
     $model = new Common_model();
     $records = $model->fetchSelectedData('faq_id, faq_question, faq_answer', TABLE_FAQ, array('faq_type' => 'trip', 'faq_status' => '1'), 'faq_order');
     $this->ci->redis->set('trip_faqs', json_encode($records));
     return $records;
 }
コード例 #2
0
ファイル: user.php プロジェクト: arp19690/newtravel
 public function changeProfilePicture()
 {
     if (isset($this->session->userdata['user_id']) && !empty($_FILES) && $_FILES['user_img']['size'] > 0 && $_FILES['user_img']['error'] == 0) {
         $model = new Common_model();
         $user_id = $this->session->userdata['user_id'];
         $user_record = $model->fetchSelectedData('user_profile_picture, user_username', TABLE_USERS, array('user_id' => $user_id));
         $user_record = $user_record[0];
         $redirect_url = base_url('my-account');
         if ($this->input->post('next')) {
             $redirect_url = $this->input->post('next');
         }
         $source = $_FILES['user_img']['tmp_name'];
         $destination = USER_IMG_PATH . "/" . getEncryptedString($user_id . time()) . ".jpg";
         $this->load->library('SimpleImage');
         $simpleImage = new SimpleImage();
         $simpleImage->uploadImage($source, $destination, USER_IMG_WIDTH, USER_IMG_HEIGHT);
         //            removing older picture
         @unlink($user_record['user_profile_picture']);
         $model->updateData(TABLE_USERS, array('user_profile_picture' => $destination), array('user_id' => $user_id));
         $this->session->set_flashdata('success', '<strong>Success!</strong> Your profile picture has been changed');
         // updating redis keys now
         $this->redis_functions->set_user_profile_data($user_record['user_username']);
         redirect($redirect_url);
     } else {
         redirect(base_url('login'));
     }
 }
コード例 #3
0
ファイル: index.php プロジェクト: arp19690/newtravel
 public function activate()
 {
     if (!isset($this->session->userdata['user_id']) && $this->input->get('code')) {
         $verification_code = $this->input->get('code');
         $model = new Common_model();
         $is_valid = $model->is_exists('user_status', TABLE_USERS, array('verification_code' => $verification_code));
         if (!empty($is_valid)) {
             // valid
             $user_status = $is_valid[0]['user_status'];
             if ($user_status == '1') {
                 // already activated
                 $this->session->set_flashdata('error', 'Your account is already activated.');
                 redirect(base_url('login'));
             } else {
                 $user_records = $model->fetchSelectedData('user_username', TABLE_USERS, array('verification_code' => $verification_code));
                 // activate now
                 $model->updateData(TABLE_USERS, array('user_status' => '1', 'verification_code' => ''), array('verification_code' => $verification_code));
                 // updating redis keys now
                 $this->redis_functions->set_user_profile_data($user_records[0]['user_username']);
                 $this->session->set_flashdata('success', '<strong>Welcome!</strong> Your account now active.');
                 redirect(base_url('login'));
             }
         } else {
             // invalid
             $this->session->set_flashdata('error', 'No such record found.');
             redirect(base_url('login'));
         }
     } else {
         redirect(base_url('login'));
     }
 }
コード例 #4
0
ファイル: payments.php プロジェクト: arp19690/newtravel
 public function add_post_to_featured($post_id, $pfm_id)
 {
     $model = new Common_model();
     $user_id = $this->session->userdata['user_id'];
     $is_valid = $model->fetchSelectedData('post_id', TABLE_POSTS, array('post_id' => $post_id, 'post_user_id' => $user_id));
     if (!empty($is_valid)) {
         $featured_plan_details = $model->fetchSelectedData('pfm_hours', TABLE_FEATURED_MASTER, array('pfm_id' => $pfm_id));
         $featured_hours = $featured_plan_details[0]['pfm_hours'];
         $start_timestamp = time();
         $end_timestamp = $start_timestamp + $featured_hours * 60 * 60;
         // disabling all the previous featured post for same post id
         $model->updateData(TABLE_POST_FEATURED, array('pf_status' => '0'), array('pf_post_id' => $post_id));
         $data_array = array('pf_post_id' => $post_id, 'pf_start_date' => date('Y-m-d H:i:s', $start_timestamp), 'pf_end_date' => date('Y-m-d H:i:s', $end_timestamp), 'pf_pfm_id' => $pfm_id, 'pf_created_on' => date('Y-m-d H:i:s'));
         return $model->insertData(TABLE_POST_FEATURED, $data_array);
     } else {
         return FALSE;
     }
 }
コード例 #5
0
        <div class="checkout-coll">
            <div class="checkout-head">
                <div class="chk-left">
                    <div class="chk-lbl"><p>Increase your reach</p></div>
                    <div class="chk-lbl-a">Reach out to more audience. Choose a plan that suits you best.</div>
                </div>
                <div class="chk-right">

                </div>
                <div class="clear"></div>
            </div>
            <div class="chk-details">
                <div class="chk-detais-row">
                    <?php 
        $model = new Common_model();
        $featured_master_records = $model->fetchSelectedData('*', TABLE_FEATURED_MASTER, array('pfm_status' => '1'), 'pfm_amount');
        if (!empty($featured_master_records)) {
            foreach ($featured_master_records as $key => $value) {
                $get_featured_url = base_url('trip/get-featured?tkey=' . $post_details['post_url_key'] . '&amp;fkey=' . $value['pfm_key']);
                ?>
                            <div class="chk-line">
                                <span class="chk-l">
                                    <a href="<?php 
                echo $get_featured_url;
                ?>
" class="a-no-underline" target="_blank" style="color: #4a90a4;"><?php 
                echo stripslashes($value['pfm_title']);
                ?>
:</a>
                                </span>
                                <span class="chk-r"><a href="<?php 
コード例 #6
0
ファイル: trip.php プロジェクト: arp19690/newtravel
 public function add_to_wishlist($post_url_key)
 {
     if (isset($this->session->userdata['user_id'])) {
         $user_id = $this->session->userdata['user_id'];
         $model = new Common_model();
         $is_owner = $model->fetchSelectedData('post_id', TABLE_POSTS, array('post_user_id' => $user_id, 'post_url_key' => $post_url_key));
         if (!empty($is_owner)) {
             $this->session->set_flashdata('error', 'Sorry, you cannot add your own trip to your wishlist');
         } else {
             $redis_functions = new Redisfunctions();
             $post_details = $redis_functions->get_trip_details($post_url_key);
             $is_exists = $model->fetchSelectedData('wishlist_id', TABLE_WISHLIST, array('wishlist_post_id' => $post_details['post_id'], 'wishlist_user_id' => $user_id, 'wishlist_status' => '1'));
             if (!empty($is_exists)) {
                 $model->updateData(TABLE_WISHLIST, array('wishlist_status' => '0'), array('wishlist_id' => $is_exists[0]['wishlist_id']));
                 $this->session->set_flashdata('error', 'Trip removed from your wishlist');
             } else {
                 $data_array = array('wishlist_user_id' => $user_id, 'wishlist_post_id' => $post_details['post_id'], 'wishlist_created_on' => date('Y-m-d H:i:s'), 'wishlist_ipaddress' => USER_IP, 'wishlist_useragent' => USER_AGENT);
                 $model->insertData(TABLE_WISHLIST, $data_array);
                 $this->session->set_flashdata('success', 'Trip added to your wishlist');
             }
             // updating user redis key
             $redis_functions->set_user_profile_data($this->session->userdata['user_username']);
         }
         redirect(getTripUrl($post_url_key));
     } else {
         display_404_page();
     }
 }
コード例 #7
0
ファイル: staticpage.php プロジェクト: arp19690/newtravel
 public function updateSitemap()
 {
     $this->ci =& get_instance();
     $this->ci->load->database();
     $this->ci->load->model('Common_model');
     //            $model = $this->ci->Common_model;
     $model = new Common_model();
     $xml = '<?xml version = "1.0" encoding = "UTF-8"?>' . "\n";
     $xml .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">' . "\n";
     $xml .= '<url><loc>' . base_url() . '</loc><lastmod>' . date('Y-m-d') . 'T' . date('H:i:s') . '+00:00</lastmod><changefreq>weekly</changefreq><priority>1.00</priority></url>' . "\n";
     // all the static links
     $static_links_without_base_url = array('contact-us', 'about-us', 'how-it-works', 'privacy-policy', 'terms', 'login', 'register', 'forgot-password');
     foreach ($static_links_without_base_url as $slKey => $slValue) {
         $xml .= '<url><loc>' . base_url($slValue) . '</loc><lastmod>' . date('Y-m-d') . 'T' . date('H:i:s') . '+00:00</lastmod><changefreq>weekly</changefreq><priority>0.85</priority></url>' . "\n";
     }
     // all the active trips
     $trip_records = $model->fetchSelectedData('url_key', TABLE_TRIPS, array('trip_status' => '1'));
     foreach ($trip_records as $trKey => $trValue) {
         $trip_url = getTripUrl($trValue['url_key']);
         $xml .= '<url><loc>' . $trip_url . '</loc><lastmod>' . date('Y-m-d') . 'T' . date('H:i:s') . '+00:00</lastmod><changefreq>weekly</changefreq><priority>0.85</priority></url>' . "\n";
     }
     // all the active users
     $user_records = $model->fetchSelectedData('username', TABLE_USERS, array('user_status' => '1'));
     foreach ($user_records as $urKey => $urValue) {
         $public_profile_url = getPublicProfileUrl($urValue['username']);
         $xml .= '<url><loc>' . $public_profile_url . '</loc><lastmod>' . date('Y-m-d') . 'T' . date('H:i:s') . '+00:00</lastmod><changefreq>weekly</changefreq><priority>0.85</priority></url>' . "\n";
     }
     // all the active blogs
     $blog_records = $model->fetchSelectedData('blog_url_key', TABLE_BLOGS, array('blog_status' => '1'));
     foreach ($blog_records as $brKey => $brValue) {
         $blog_url = base_url('blog/read/' . $brValue['blog_url_key']);
         $xml .= '<url><loc>' . $blog_url . '</loc><lastmod>' . date('Y-m-d') . 'T' . date('H:i:s') . '+00:00</lastmod><changefreq>weekly</changefreq><priority>0.85</priority></url>' . "\n";
     }
     // all the view photo pages
     $photo_records = $model->fetchSelectedData('image_name', TABLE_PHOTOS, array('image_name !=' => '', 'album_key !=' => ''));
     foreach ($photo_records as $prKey => $prValue) {
         $photo_url = base_url('view/album/' . $prValue['image_name']);
         $xml .= '<url><loc>' . $photo_url . '</loc><lastmod>' . date('Y-m-d') . 'T' . date('H:i:s') . '+00:00</lastmod><changefreq>weekly</changefreq><priority>0.85</priority></url>' . "\n";
     }
     $xml .= '</urlset>';
     //            prd($xml);
     $file = fopen(APPPATH . '/../sitemap.xml', 'w');
     fwrite($file, $xml);
     fclose($file);
     die;
 }
コード例 #8
0
ファイル: custom_model.php プロジェクト: arp19690/newtravel
 public function get_user_profile_data($username, $user_fields = NULL)
 {
     if ($user_fields == NULL) {
         $user_fields = 'user_id, user_fullname, user_username, user_email, user_city, user_state, user_country, user_location, user_latitude, user_longitude, user_dob, user_gender, user_relationship_status, user_about, user_tagline, user_profile_picture, user_facebook_id, user_languages_known';
     }
     $model = new Common_model();
     $records = $model->fetchSelectedData($user_fields, TABLE_USERS, array('user_username' => $username));
     if (!empty($records)) {
         $records = $records[0];
     }
     // to fetch trips posted by the user
     $trips_posted_records = $model->fetchSelectedData('post_id, post_url_key, post_published', TABLE_POSTS, array('post_user_id' => $records['user_id']), 'post_id', 'DESC');
     $records['trips_posted'] = $trips_posted_records;
     // to fetch the trips owner has joined
     $records['trips_joined'] = $this->get_joined_trips($username);
     // to fetch user's wishlist
     $wishlist_records = $model->getAllDataFromJoin('post_url_key', TABLE_WISHLIST, array(TABLE_POSTS => 'post_id = wishlist_post_id'), 'LEFT', array('wishlist_status' => '1', 'post_published' => '1', 'wishlist_user_id' => $records['user_id']), 'wishlist_id', 'DESC');
     $records['my_wishlist'] = $wishlist_records;
     return $records;
 }