aboutsummaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
authorSem <sembrestels@riseup.net>2011-11-12 01:25:31 +0100
committerSem <sembrestels@riseup.net>2011-11-12 01:25:31 +0100
commit4585e371857636c1dece9978fba65d978a3afc78 (patch)
treebff1912db02892344bd03d42be5f54dfcfbc547a /actions
parent9b176145bc10850e02b8602bb670d6832945ea83 (diff)
downloadelgg-4585e371857636c1dece9978fba65d978a3afc78.tar.gz
elgg-4585e371857636c1dece9978fba65d978a3afc78.tar.bz2
Refactored video savings to permit change title and description when editing and avoid to change url.
Diffstat (limited to 'actions')
-rw-r--r--actions/videolist/edit.php28
1 files changed, 18 insertions, 10 deletions
diff --git a/actions/videolist/edit.php b/actions/videolist/edit.php
index 72e1d2427..6670ceadb 100644
--- a/actions/videolist/edit.php
+++ b/actions/videolist/edit.php
@@ -25,16 +25,26 @@ elgg_make_sticky_form('videolist');
elgg_load_library('elgg:videolist');
-if (!$input['video_url']) {
- register_error(elgg_echo('videolist:error:no_url'));
- forward(REFERER);
-}
+// If new video, get data from video providers
+if(!$video_guid) {
+ if (!$input['video_url']) {
+ register_error(elgg_echo('videolist:error:no_url'));
+ forward(REFERER);
+ }
-$parsed_url = videolist_parseurl($input['video_url']);
+ $parsed_url = videolist_parseurl($input['video_url']);
-if(!$parsed_url) {
- register_error(elgg_echo('videolist:error:invalid_url'));
- forward(REFERER);
+ if(!$parsed_url) {
+ register_error(elgg_echo('videolist:error:invalid_url'));
+ forward(REFERER);
+ }
+
+ unset($input['title']);
+ unset($input['description']);
+ $input = array_merge(videolist_get_data($parsed_url), $input);
+
+} else {
+ unset($input['video_url']);
}
if ($video_guid) {
@@ -50,8 +60,6 @@ if ($video_guid) {
$new_video = true;
}
-$input = array_merge($input, videolist_get_data($parsed_url));
-
if (sizeof($input) > 0) {
foreach ($input as $name => $value) {
$video->$name = $value;