Example #1
0
 /**
  * Function for add videos from Youtube
  * 
  * @return void
  * @author Praveen Rajan
  */
 function add_youtube_videos()
 {
     // Videos must be an array
     $videoslist = array();
     // get selected gallery
     $galleryID = (int) $_POST['galleryselect_add'];
     if ($galleryID == 0) {
         CvgCore::show_video_error(__('No gallery selected !'));
         return;
     }
     if (ini_get('allow_url_fopen')) {
         // get the path to the gallery
         $gallery = videoDB::find_gallery($galleryID);
         if (empty($gallery->path)) {
             CvgCore::show_video_error(__('Failure in database, no gallery path set !'));
             return;
         }
         $videofiles = explode(",", trim($_POST['videourl']));
         if (is_array($videofiles)) {
             $videos_ids = CvgCore::process_youtube_videos($galleryID, $videofiles);
             CvgCore::xml_playlist($galleryID);
             if (count($videos_ids) != 0) {
                 CvgCore::show_video_message(count($videos_ids) . __(' Video(s) successfully added.'));
             }
         }
     } else {
         CvgCore::show_video_error(__('Please enable the PHP setting `allow_url_fopen`'));
     }
     return;
 }