Beispiel #1
0
 private static function _setStar($input, $star)
 {
     $id = $input['id'];
     $albumId = $input['albumId'];
     $artistId = $input['artistId'];
     // Normalize all in one array
     $ids = array();
     $r = Subsonic_XML_Data::createSuccessResponse();
     if ($id) {
         if (!is_array($id)) {
             $id = array($id);
         }
         foreach ($id as $i) {
             $aid = Subsonic_XML_Data::getAmpacheId($i);
             if (Subsonic_XML_Data::isArtist($i)) {
                 $type = 'artist';
             } else {
                 if (Subsonic_XML_Data::isAlbum($i)) {
                     $type = 'album';
                 } else {
                     if (Subsonic_XML_Data::isSong($i)) {
                         $type = 'song';
                     } else {
                         $type = "";
                     }
                 }
             }
             $ids[] = array('id' => $aid, 'type' => $type);
         }
     } else {
         if ($albumId) {
             if (!is_array($albumId)) {
                 $albumId = array($albumId);
             }
             foreach ($albumId as $i) {
                 $aid = Subsonic_XML_Data::getAmpacheId($i);
                 $ids[] = array('id' => $aid, 'album');
             }
         } else {
             if ($artistId) {
                 if (!is_array($artistId)) {
                     $artistId = array($artistId);
                 }
                 foreach ($artistId as $i) {
                     $aid = Subsonic_XML_Data::getAmpacheId($i);
                     $ids[] = array('id' => $aid, 'artist');
                 }
             } else {
                 $r = Subsonic_XML_Data::createError(Subsonic_XML_Data::SSERROR_MISSINGPARAM);
             }
         }
     }
     foreach ($ids as $i) {
         $flag = new Userflag($i['id'], $i['type']);
         $flag->set_flag($star);
     }
     self::apiOutput($input, $r);
 }
Beispiel #2
0
         $rating->set_rating($_GET['rating']);
         Rating::show($_GET['object_id'], $_GET['rating_type']);
         $key = "rating_" . $_GET['object_id'] . "_" . $_GET['rating_type'];
         $results[$key] = ob_get_contents();
         ob_end_clean();
     } else {
         $results['rfc3514'] = '0x1';
     }
     break;
     /* Setting userflags */
 /* Setting userflags */
 case 'set_userflag':
     if (User::is_registered()) {
         ob_start();
         $userflag = new Userflag($_GET['object_id'], $_GET['userflag_type']);
         $userflag->set_flag($_GET['userflag']);
         Userflag::show($_GET['object_id'], $_GET['userflag_type']);
         $key = "userflag_" . $_GET['object_id'] . "_" . $_GET['userflag_type'];
         $results[$key] = ob_get_contents();
         ob_end_clean();
     } else {
         $results['rfc3514'] = '0x1';
     }
     break;
 case 'action_buttons':
     ob_start();
     if (AmpConfig::get('ratings')) {
         echo " <div id='rating_" . $_GET['object_id'] . "_" . $_GET['object_type'] . "'>";
         Rating::show($_GET['object_id'], $_GET['object_type']);
         echo "</div> |";
     }