示例#1
0
 public function upload()
 {
     $user_id = $this->session->userdata('user_id');
     // Action not possible if an user is not logged in.
     if (!$user_id) {
         $this->load->helper('message');
         show_error_msg_page($this, $this->lang->line('ui_msg_login_restriction'));
         return;
     }
     $this->load->library('form_validation');
     $this->form_validation->set_error_delimiters('<span class="error">', '</span>');
     if ($this->form_validation->run('upload') === FALSE) {
         $params = array('title' => $this->lang->line('ui_nav_menu_upload') . ' &ndash; ' . $this->config->item('site_name'));
         $this->load->library('html_head_params', $params);
         // **
         // ** LOADING VIEWS
         // **
         $this->load->view('html_begin', $this->html_head_params);
         $this->load->view('header', array('selected_menu' => 'upload'));
         $main_params['content'] = $this->load->view('video/upload_view', array(), TRUE);
         $main_params['side'] = $this->load->view('side_default', NULL, TRUE);
         $this->load->view('main', $main_params);
         $this->load->view('footer');
         $this->load->view('html_end');
     } else {
         $this->load->model('videos_model');
         $this->load->helper('video');
         $this->config->load('content_ingestion');
         $name = urlencode(str_replace(' ', '-', $this->input->post('video-title')));
         $category_id = $this->input->post('video-category');
         // Prepare formats
         $formats = $this->config->item('formats');
         $prepared_formats = prepare_formats($formats, $this->av_info, $this->config->item('elim_dupl_res'));
         // Add video to DB.
         $activation_code = $this->videos_model->add_video($name, $this->input->post('video-title'), $this->input->post('video-description'), $this->input->post('video-tags'), $this->av_info['duration'], $prepared_formats['db_formats'], $category_id, $user_id, $this->uploaded_file);
         if ($activation_code == FALSE) {
             $this->load->helper('message');
             show_error_msg_page($this, $this->lang->line('video_msg_add_video_db_error'));
             return;
         }
         // Send a content ingestion request to
         // CIS (Content Ingestion Server).
         $r = $this->videos_model->send_content_ingestion($activation_code, $this->uploaded_file, $name, $this->av_info['size'], $prepared_formats['transcode_configs']);
         if ($r == FALSE) {
             $this->videos_model->set_cis_response($activation_code, CIS_RESP_UNREACHABLE);
             $this->load->helper('message');
             show_error_msg_page($this, $this->lang->line('video_msg_send_content_ingestion_error'));
             return;
         }
         $this->load->helper('message');
         show_info_msg_page($this, $this->lang->line('video_msg_video_uploaded'));
     }
 }
示例#2
0
文件: user.php 项目: istrwei/P2P-Tube
 public function recover_password()
 {
     $this->load->library('form_validation');
     $this->form_validation->set_error_delimiters('<span class="error">', '</span>');
     if ($this->form_validation->run('recover_password') === FALSE) {
         $params = array('title' => $this->lang->line('user_title_password_recovery') . ' &ndash; ' . $this->config->item('site_name'));
         $this->load->library('html_head_params', $params);
         // **
         // ** LOADING VIEWS
         // **
         $this->load->view('html_begin', $this->html_head_params);
         $this->load->view('header', array('selected_menu' => 'recover_password'));
         $main_params['content'] = $this->load->view('user/recover_password_view', array(), TRUE);
         $main_params['side'] = $this->load->view('side_default', NULL, TRUE);
         $this->load->view('main', $main_params);
         $this->load->view('footer');
         $this->load->view('html_end');
     } else {
         // Resent message
         $this->load->helper('message');
         show_info_msg_page($this, sprintf($this->lang->line('user_msg_password_recovery_email_sent'), $this->input->post('username'), $this->input->post('email')));
         return;
     }
 }