示例#1
0
 /**
  * clean_to_existing
  * Clean label list to existing label list only
  * @param array|string $labels
  * @return array|string
  */
 public static function clean_to_existing($labels)
 {
     if (is_array($labels)) {
         $ar = $labels;
     } else {
         $ar = explode(",", $labels);
     }
     $ret = array();
     foreach ($ar as $label) {
         $label = trim($label);
         if (!empty($label)) {
             if (Label::lookup(array('name' => $label)) > 0) {
                 $ret[] = $label;
             }
         }
     }
     return is_array($labels) ? $ret : implode(",", $ret);
 }
示例#2
0
         unset($_POST['creation_date']);
     }
     $label_id = Label::create($_POST);
     if (!$label_id) {
         require_once AmpConfig::get('prefix') . UI::find_template('show_add_label.inc.php');
     } else {
         $body = T_('Label Added');
         $title = '';
         show_confirmation($title, $body, AmpConfig::get('web_path') . '/browse.php?action=label');
     }
     break;
 case 'show':
     $label_id = intval($_REQUEST['label']);
     if (!$label_id) {
         if (!empty($_REQUEST['name'])) {
             $label_id = Label::lookup($_REQUEST);
         }
     }
     if ($label_id > 0) {
         $label = new Label($label_id);
         $label->format();
         $object_ids = $label->get_artists();
         $object_type = 'artist';
         require_once AmpConfig::get('prefix') . UI::find_template('show_label.inc.php');
         UI::show_footer();
         exit;
     }
 case 'show_add_label':
     if (Access::check('interface', '50') || AmpConfig::get('upload_allow_edit')) {
         require_once AmpConfig::get('prefix') . UI::find_template('show_add_label.inc.php');
     } else {