예제 #1
0
 public function edit($param)
 {
     $edit_id = $param[0];
     $user_model = new User();
     if (isset($_POST) && !empty($_POST)) {
         $artistArray = array('user_firstname' => $_POST['firstname'], 'user_stagename' => $_POST['stagename'], 'user_bio' => $_POST['bio'], 'twitter_handle' => $_POST['twitter_handle'], 'user_modified' => time());
         $artistArray = Gump::xss_clean($artistArray);
         $artistArray = Gump::sanitize($artistArray);
         $update_id = $user_model->updateId($artistArray, $edit_id);
         //UPLOAD ATTACHMENT
         if ($_FILES["image"]["tmp_name"] != '') {
             //upload image into uploads folder
             Upload::setName($slug . time());
             Upload::resizeUpload($_FILES["image"], UPLOAD_PATH, '450px');
             $update_data = array('user_image' => Upload::getFileName('images'));
             if ($this->user_model->updateId($update_data, $edit_id)) {
                 Session::set('success', 'Artist record edited');
             } else {
                 Session::set('error', 'operation fails');
             }
         }
         if ($update_id > 0) {
             Session::set('success', 'Artist record edited');
             Url::redirect('artist');
         } else {
             Session::set('error', 'operation fails');
         }
     }
     $this->data['user_data'] = $user_model->find($edit_id);
     View::rendertemplate('header', $this->data);
     View::rendertemplate('sidebar', $this->data);
     View::render('artist/artist.add', $this->data);
     View::rendertemplate('footer', $this->data);
 }
예제 #2
0
 public function edit($param)
 {
     $song_id = $param[0];
     $songModel = new \Models\Song();
     $this->data['title'] = 'Edit Song';
     $this->data['albums'] = $this->albumModel->all();
     $this->data['artist'] = User::artist();
     $this->data['genre'] = $this->categoryModel->get(array('category_slug' => 'genre'));
     $this->data['tags'] = $this->categoryModel->get(array('category_slug' => 'tag'));
     $this->data['status'] = $this->status_model->get(array('status_slug' => 'album'));
     if (isset($_POST) && !empty($_POST)) {
         $songArray = array('song_album_id' => $_POST['album_id'], 'song_user_id' => Session::get('user_id'), 'song_artist_id' => $_POST['artist_id'], 'song_genre_id' => $_POST['genre_id'], 'song_status_id' => $_POST['status_id'], 'song_title' => $_POST['title'], 'song_description' => $_POST['description'], 'song_modified' => time(), 'song_slug' => Url::generateSafeSlug($_POST['title']));
         $songArray = Gump::xss_clean($songArray);
         $songArray = Gump::sanitize($songArray);
         $update = $songModel->updateId($songArray, $song_id);
         if ($update > 0) {
             $message = 'ok';
         } else {
             $message = 'no';
         }
         if ($_FILES["mp3"]["tmp_name"] != '') {
             //resize youtube image into uploads folder
             Upload::setName(time());
             Upload::upload_file($_FILES["mp3"], UPLOAD_PATH);
             $filepath = UPLOAD_PATH . Upload::getName();
             $outputMp3 = UPLOAD_PATH . 'encoded_' . Upload::getName();
             //check bitrate
             $bitRate = Audio::bitRateSampleRate($filepath, 'bitrate');
             $duration = Audio::duration($filepath);
             if ($bitRate > 128) {
                 $convertMp3 = Audio::convertMp3($filepath, 128, $outputMp3);
             }
             if (is_file($outputMp3)) {
                 $updateArray = array('song_file' => 'images/encoded_' . Upload::getName(), 'song_duration' => $duration);
                 unlink($filepath);
             } else {
                 $updateArray = array('song_file' => Upload::getFileName('images'), 'song_duration' => $duration);
             }
             $saveMp3 = $songModel->updateId($updateArray, $song_id);
         }
         //UPLOAD SONG COVER
         if ($_FILES["image"]["tmp_name"] != '') {
             //upload file into uploads folder
             Upload::setName(time());
             Upload::resizeUpload($_FILES["image"], UPLOAD_PATH, '450px');
             $update_data = array('song_image' => Upload::getFileName('images'));
             $songModel->updateId($update_data, $song_id);
         }
     }
     if ($message == 'ok') {
         Session::set('success', 'record edited');
         Url::redirect('song/item/' . $_POST['album_id']);
     } else {
         if ($message == 'no') {
             $this->data['error'] = 'Operation Fails!';
         }
     }
     $this->data['song'] = \Models\Song::item($song_id);
     View::rendertemplate('header', $this->data);
     View::rendertemplate('sidebar', $this->data);
     View::render('song/song.edit', $this->data);
     View::rendertemplate('footer', $this->data);
 }
예제 #3
0
 public function edit($parameter)
 {
     $item_id = $parameter[0];
     $this->data['title'] = 'Edit Post';
     $category_model = new \Models\Category();
     $post_model = new \Models\Post();
     $album_model = new \models\album();
     $this->data['post'] = $post_model->getItem($item_id);
     $this->data['album_group'] = $album_model->all();
     $this->data['post_category_groups'] = $category_model->groupByCol('category_slug');
     if (isset($_POST) && !empty($_POST)) {
         $post_category_id = $_POST['post_category_id'];
         $post_album_id = $_POST['post_album_id'];
         $post_title = $_POST['post_title'];
         $post_body = $_POST['post_body'];
         $post_link = $_POST['post_link'];
         $post_excerpt = $_POST['post_excerpt'];
         $post_slug = Url::generateSafeSlug($post_title);
         $post_modified = time();
         $update_array = array('post_category_id' => $post_category_id, 'post_album_id' => $post_album_id, 'post_title' => $post_title, 'post_body' => $post_body, 'post_link' => $post_link, 'post_excerpt' => $post_excerpt, 'post_slug' => $post_slug, 'post_modified' => $post_modified);
         $update_array = Gump::xss_clean($update_array);
         $update_array = Gump::sanitize($update_array);
         $update_id = $post_model->updateId($update_array, $item_id);
         //UPLOAD IMAGE
         if ($_FILES["image"]["tmp_name"] != '') {
             Upload::setName(uniqid());
             Upload::upload_file($_FILES["image"], UPLOAD_PATH);
             $image_name = Upload::getFileName('images');
             $update_data = array('post_image' => $image_name);
             $update = $post_model->updateId($update_data, $update_id);
         }
         if ($update_id > 0) {
             Session::set('success', 'post edited');
             Url::redirect('post');
         }
     }
     View::rendertemplate('header', $this->data);
     View::rendertemplate('sidebar', $this->data);
     View::render('post/post.add', $this->data);
     View::rendertemplate('footer', $this->data);
 }
예제 #4
0
 public function allpagesedit($param)
 {
     $page_rowid = $param[0];
     $this->data['title'] = 'Edit Content';
     if (isset($_POST) && !empty($_POST)) {
         $subto = $_POST['subto'];
         $plugin = $_POST['plugin'];
         $content = $_POST['content'];
         $homepage = $_POST['homepage'];
         $header_menu = $_POST['header_menu'];
         $footer_menu = $_POST['footer_menu'];
         $redirecturl = $_POST['redirecturl'];
         $album = $_POST['album'];
         $meta_keywords = $_POST['meta_keywords'];
         $meta_title = $_POST['meta_title'];
         $meta_description = $_POST['meta_description'];
         $sort_order = $_POST['sort_order'];
         //$slug = Url::generateSafeSlug($pagename);
         $update_array = array('content_plugin' => $plugin, 'content_subto' => $subto, 'content_excerpt' => $_POST['excerpt'], 'content_body' => $_POST['content'], 'content_homepage' => $homepage, 'content_header_menu' => $header_menu, 'content_footer_menu' => $footer_menu, 'content_redirecturl' => $redirecturl, 'content_album' => $album, 'content_meta_keywords' => $meta_keywords, 'content_meta_title' => $meta_title, 'content_meta_description' => $meta_description, 'content_sort_order' => $sort_order);
         $where_array = array('content_id' => $page_rowid);
         // $update_array = Gump::xss_clean($update_array);
         // $update_array = Gump::sanitize($update_array);
         $update = $this->contentModel->update($update_array, $where_array);
         if ($_FILES["image1_extra"]["tmp_name"] != '') {
             //upload image into uploads folder
             Upload::setName($slug . uniqid());
             Upload::upload_file($_FILES["image1_extra"], UPLOAD_PATH);
             $image_name = Upload::getFileName('images');
             $update_data = array('content_banner' => $image_name);
             $update = $this->contentModel->update($update_data, $where_array);
         }
         if ($_FILES["image2_extra"]["tmp_name"] != '') {
             //upload image into uploads folder
             Upload::setName($slug . uniqid());
             Upload::upload_file($_FILES["image2_extra"], UPLOAD_PATH);
             $image_name = Upload::getFileName('images');
             $update_data = array('content_thumbnail' => $image_name);
             $update = $this->contentModel->update($update_data, $where_array);
         }
         if ($update > 0) {
             $message = 'ok';
         } else {
             $message = 'no';
         }
     }
     if ($message == 'ok') {
         Session::set('success', ' Content Saved!');
     } else {
         if ($message == 'no') {
             Session::set('error', 'Operation Fails!');
         }
     }
     $this->data['pages'] = $this->pageModel->all();
     $this->data['page_data'] = $this->contentModel->detail($page_rowid);
     // $this->data['pagecontent_data'] = $this->contentModel->find($insert_id);
     View::rendertemplate('header', $this->data);
     View::rendertemplate('sidebar', $this->data);
     View::render('pages/editcontent', $this->data);
     View::rendertemplate('footer', $this->data);
 }
예제 #5
0
 public function edit($param)
 {
     $media_id = $param[0];
     //get album detail
     $albumitem_detail = $this->mediaModel->find($media_id);
     $this->data['title'] = 'Edit Item';
     $this->data['album_categories'] = $this->categoryModel->get(array('category_slug' => 'album'));
     $this->data['status'] = $this->status_model->get(array('status_slug' => 'album'));
     if (isset($_POST) && !empty($_POST)) {
         $slug = Url::generateSafeSlug($_POST['title']);
         $mediaArray = array('media_category_id' => $_POST['category'], 'media_user_id' => Session::get('user_id'), 'media_title' => $_POST['title'], 'media_description' => $_POST['description'], 'media_youtubelink' => $_POST['youtubelink'], 'media_slug' => $slug, 'media_modified' => time());
         $update = $this->mediaModel->updateId($mediaArray, $media_id);
         if ($update > 0) {
             $message = 'ok';
         } else {
             $message = 'no';
         }
         //check if item is a video
         $category_type = $this->categoryModel->find($_POST['category']);
         if ($category_type->category_title == 'video' && isset($_POST['youtubelink']) && $_POST['youtubelink'] != '') {
             //item is a video
             $youtube_url = "https://i.ytimg.com/vi/" . $_POST['youtubelink'] . "/maxresdefault.jpg";
             if (!file_exists($youtube_url)) {
                 $youtube_url = "https://i.ytimg.com/vi/" . $_POST['youtubelink'] . "/hqdefault.jpg";
             }
             //resize youtube image into uploads folder
             Upload::setName(time());
             Upload::resizeUrl($youtube_url, UPLOAD_PATH, '480px');
             $update_data = array('media_file' => Upload::getFileName('images'));
             $this->mediaModel->updateId($update_data, $media_id);
         }
         if ($_FILES["image"]["tmp_name"] != '' && $category_type->category_title == 'audio') {
             //resize youtube image into uploads folder
             Upload::setName(time());
             Upload::upload_file($_FILES["image"], UPLOAD_PATH);
             $filepath = UPLOAD_PATH . Upload::getName();
             $outputMp3 = UPLOAD_PATH . 'encoded_' . Upload::getName();
             //check bitrate
             $bitRate = Audio::bitRateSampleRate($filepath, 'bitrate');
             if ($bitRate > 128) {
                 $convertMp3 = Audio::convertMp3($filepath, 128, $outputMp3);
             }
             if (is_file($outputMp3)) {
                 $updateArray = array('media_file' => 'images/encoded_' . Upload::getName());
                 unlink($filepath);
             } else {
                 $updateArray = array('media_file' => Upload::getFileName('images'));
             }
             $saveMp3 = $this->mediaModel->updateId($updateArray, $media_id);
         }
         //UPLOAD ATTACHMENT
         if ($_FILES["image"]["tmp_name"] != '' && $category_type->category_title == 'image') {
             //upload image into uploads folder
             Upload::setName(time());
             Upload::resizeUpload($_FILES["image"], UPLOAD_PATH, '480px');
             $update_data = array('media_file' => Upload::getFileName('images'));
             $update_img = $this->mediaModel->updateId($update_data, $media_id);
             if ($update_img > 0) {
                 Session::set('success', 'record edited');
                 Url::redirect('album/media/' . $albumitem_detail->media_album_id);
             } else {
                 if ($message == 'no') {
                     $this->data['error'] = 'Operation Fails!';
                 }
             }
         }
     }
     if ($message == 'ok') {
         Session::set('success', 'record edited');
         Url::redirect('album/media/' . $albumitem_detail->media_album_id);
     } else {
         if ($message == 'no') {
             $this->data['error'] = 'Operation Fails!';
         }
     }
     $this->data['media'] = Media::row('media_id', $media_id);
     View::rendertemplate('header', $this->data);
     View::rendertemplate('sidebar', $this->data);
     View::render('album/album.edit_item', $this->data);
     View::rendertemplate('footer', $this->data);
 }