Exemplo n.º 1
0
 /**
  * update
  * This takes a key'd array of data as input and updates a personal video entry
  */
 public function update(array $data)
 {
     parent::update($data);
     $sql = "UPDATE `personal_video` SET `location` = ?, `summary` = ? WHERE `id` = ?";
     Dba::write($sql, array($data['location'], $data['summary'], $this->id));
     return $this->id;
 }
Exemplo n.º 2
0
 /**
  * update
  * This takes a key'd array of data as input and updates a movie entry
  */
 public function update(array $data)
 {
     parent::update($data);
     if (isset($data['original_name'])) {
         $trimmed = Catalog::trim_prefix(trim($data['original_name']));
         $name = $trimmed['string'];
         $prefix = $trimmed['prefix'];
     } else {
         $name = $this->original_name;
         $prefix = $this->prefix;
     }
     $summary = isset($data['summary']) ? $data['summary'] : $this->summary;
     $year = isset($data['year']) ? $data['summary'] : $this->year;
     $sql = "UPDATE `movie` SET `original_name` = ?, `prefix` = ?, `summary` = ?, `year` = ? WHERE `id` = ?";
     Dba::write($sql, array($name, $prefix, $summary, $year, $this->id));
     $this->original_name = $name;
     $this->prefix = $prefix;
     $this->summary = $summary;
     $this->year = $year;
     return $this->id;
 }
Exemplo n.º 3
0
     }
     if (isset($_FILES['vVideoPath']['name']) && $_FILES['vVideoPath']['name'] != "") {
         $audio_name = date('Ymdhis') . $_FILES['vVideoPath']['name'];
         if (copy($_FILES['vVideoPath']['tmp_name'], $CFG->datadirroot . "/video/" . $audio_name)) {
             if ($audio_name != '') {
                 $videoObj->setvVideoPath($audio_name);
                 @unlink($CFG->datadirroot . "/video/" . $_POST['vOldImage']);
             }
         }
     } else {
         if ($_POST['vOldImage'] != "") {
             $videoObj->setvVideoPath($_POST['vOldImage']);
         }
     }
     //$videoObj->setiSGroupId($iSGroupId);
     $videoObj->update($iVideoId);
     $msg = MSG_UPDATE;
     $url = 'index.php?file=Video&AX=Yes&var_msg=' . $msg . '&iVideoCategoryId=' . $iVideoCategoryId . $qs;
     header("Location:" . $url);
     exit;
 } else {
     if ($mode == "Delete") {
         if (file_exists($CFG->datadirroot . "/video/" . $_POST['vOldImage'])) {
             @unlink($CFG->datadirroot . "/video/" . $_POST['vOldImage']);
         }
         $sql_update = "UPDATE Video SET vVideoPath = '' WHERE iVideoId = '" . $iVideoId . "'";
         $obj->sql_query($sql_update);
         $msg = "Image successfuly deleted.";
         header("Location:index.php?file=m-videoadd&iVideoCategoryId=" . $iVideoCategoryId . "&mode=Update&iVideoId=" . $iVideoId . $qs);
         exit;
     }
Exemplo n.º 4
0
 /**
  * update
  * This takes a key'd array of data as input and updates a tv show episode entry
  */
 public function update(array $data)
 {
     parent::update($data);
     $original_name = isset($data['original_name']) ? $data['original_name'] : $this->original_name;
     $tvshow_season = isset($data['tvshow_season']) ? $data['tvshow_season'] : $this->season;
     $tvshow_episode = isset($data['tvshow_episode']) ? $data['tvshow_episode'] : $this->episode_number;
     $summary = isset($data['summary']) ? $data['summary'] : $this->summary;
     $sql = "UPDATE `tvshow_episode` SET `original_name` = ?, `season` = ?, `episode_number` = ?, `summary` = ? WHERE `id` = ?";
     Dba::write($sql, array($original_name, $tvshow_season, $tvshow_episode, $summary, $this->id));
     $this->original_name = $original_name;
     $this->season = $tvshow_season;
     $this->episode_number = $tvshow_episode;
     $this->summary = $summary;
     return $this->id;
 }
Exemplo n.º 5
0
 $uploadOk = 1;
 $msg = '';
 $videoFileType = pathinfo($targetVideo, PATHINFO_EXTENSION);
 if ($videoFileType != 'mp4' && $videoFileType != '') {
     $msg .= " Video is not an MP4 file. Please upload .mp4 files only.";
     $uploadOk = 0;
 }
 if ($uploadOk == 1) {
     if ($newMedia != "") {
         if (move_uploaded_file($_FILES["video"]["tmp_name"], $targetVideo)) {
             $msg .= "The file " . basename($_FILES["video"]["name"]) . " has been uploaded.";
             $status = 'ok';
             if (file_exists(MEDIA_FILES_PATH . "video/" . $oldMedia) && $oldMedia != '') {
                 unlink(MEDIA_FILES_PATH . "video/" . $oldMedia);
             }
             echo $videoObj->update();
         } else {
             $msg = " Sorry, there was an error uploading your video media. ERROR: " . $msg;
             $json = array("status" => 0, "msg" => $msg);
             $dbObj->close();
             //Close Database Connection
             header('Content-type: application/json');
             echo json_encode($json);
         }
     } else {
         echo $videoObj->update();
     }
 } else {
     $msg = " Sorry, there was an error uploading your video media. ERROR: " . $msg;
     $json = array("status" => 0, "msg" => $msg);
     $dbObj->close();
                 $date_week_operand = new DateTime($date_input_query);
                 //assign variable
                 //that corresponds to a string
                 //with a particular date format
                 $string_date_pub = $date_week_operand->format('F j, Y');
                 //get the difference of days
                 //between the two dates using
                 //the diff() DateTime object method
                 $interval = $date_week_start->diff($date_week_operand);
                 // Output the difference in days, and convert to int
                 $days = (int) $interval->format('%a');
                 // Get number of full weeks by dividing days by seven,
                 // rounding it up with ceil function
                 $weeks = ceil($days / 7);
                 try {
                     $video_entry->update(['date_published' => $date_input_query, 'string_date_pub' => $string_date_pub, 'week_number' => $weeks, 'video_id' => Input::get('video_id'), 'video_title' => Input::get('video_title'), 'video_desc' => Input::get('video_desc'), 'video_uploader' => Input::get('video_uploader'), 'tag' => Input::get('tag')], $video_entry_index);
                     Session::flash('edit_video_entry', 'You have updated the video details!');
                     Redirect::to('../admin/edit_video_entry.php?id=' . $video_entry_index);
                 } catch (Exception $e) {
                     die($e->getMessage());
                 }
             } else {
                 Redirect::to('../admin/edit_video_entry.php?id=' . $video_entry_index);
             }
         } else {
             Redirect::to('../index.php');
         }
     } else {
         Redirect::to('../index.php');
     }
 }