示例#1
0
 function deleteMedia($id)
 {
     $media = getMediaById($id);
     if ($media['id']) {
         if (!(bool) $media['status']) {
             if ($media['media_type'] == 1) {
                 $file = array(getMediaPathById($id), getThumbPathById($id));
                 array_walk($file, create_function('$item', 'unlink($item);'));
             }
             $texto = $media['media_type'] == 1 ? "Imagem excluída" : "Vídeo excluído";
             if ($this->user->deleteImg($id)) {
                 $this->messages->add($texto . ' com sucesso!', 'success');
                 // ser user message
             }
         } else {
             $this->messages->add('Esta imagem não pode ser excluída!<br />Ela já foi aprovada e está participando da votação.', 'warning');
             // ser user message
         }
     }
     redirect('usuario');
     die;
 }
示例#2
0
 function reprovar($id)
 {
     if (!$this->auth->logged() or !isAdmin()) {
         redirect('home');
         die;
     }
     $media = getMediaById($id);
     if ($media['id']) {
         $tipo = $media['media_type'] == 1 ? "Imagem" : "Vídeo";
         if ($this->user->reprovaImg($id)) {
             $texto = sprintf("%s <strong>%s</strong> de <strong>%s</strong> foi reprovado(a).", $tipo, $media['nome_img'], $media['nome_autor']);
             $this->messages->add($texto, 'success');
             // ser user message
         }
     }
     redirect('admin');
     die;
 }