Exemple #1
0
 /**
  * createPodcastChannel
  * Add a new podcast channel.
  * Takes the podcast url in parameter.
  */
 public static function createpodcastchannel($input)
 {
     self::check_version($input, "1.9.0");
     $url = self::check_parameter($input, 'url');
     if (AmpConfig::get('podcast') && Access::check('interface', 75)) {
         $catalogs = Catalog::get_catalogs('podcast');
         if (count($catalogs) > 0) {
             $data = array();
             $data['feed'] = $url;
             $data['catalog'] = $catalogs[0];
             if (Podcast::create($data)) {
                 $r = Subsonic_XML_Data::createSuccessResponse();
             } else {
                 $r = Subsonic_XML_Data::createError(Subsonic_XML_Data::SSERROR_GENERIC);
             }
         } else {
             $r = Subsonic_XML_Data::createError(Subsonic_XML_Data::SSERROR_UNAUTHORIZED);
         }
     } else {
         $r = Subsonic_XML_Data::createError(Subsonic_XML_Data::SSERROR_UNAUTHORIZED);
     }
     self::apiOutput($input, $r);
 }
Exemple #2
0
         UI::access_denied();
         exit;
     }
     require_once AmpConfig::get('prefix') . UI::find_template('show_add_podcast.inc.php');
     break;
 case 'create':
     if (!Access::check('interface', 75) || AmpConfig::get('demo_mode')) {
         UI::access_denied();
         exit;
     }
     if (!Core::form_verify('add_podcast', 'post')) {
         UI::access_denied();
         exit;
     }
     // Try to create the sucker
     $results = Podcast::create($_POST);
     if (!$results) {
         require_once AmpConfig::get('prefix') . UI::find_template('show_add_podcast.inc.php');
     } else {
         $title = T_('Subscribed to Podcast');
         $body = '';
         show_confirmation($title, $body, AmpConfig::get('web_path') . '/browse.php?action=podcast');
     }
     break;
 case 'delete':
     if (!Access::check('interface', 75) || AmpConfig::get('demo_mode')) {
         UI::access_denied();
         exit;
     }
     $podcast_id = scrub_in($_REQUEST['podcast_id']);
     show_confirmation(T_('Podcast Deletion'), T_('Are you sure you want to delete this podcast?'), AmpConfig::get('web_path') . "/podcast.php?action=confirm_delete&podcast_id=" . $podcast_id, 1, 'delete_podcast');