diff options
-rw-r--r-- | pages/videolist/add.php (renamed from new.php) | 0 | ||||
-rw-r--r-- | pages/videolist/all.php (renamed from all.php) | 0 | ||||
-rw-r--r-- | pages/videolist/browse.php (renamed from browse.php) | 0 | ||||
-rw-r--r-- | pages/videolist/edit.php (renamed from edit.php) | 0 | ||||
-rw-r--r-- | pages/videolist/friends.php (renamed from friends.php) | 0 | ||||
-rw-r--r-- | pages/videolist/owner.php (renamed from index.php) | 0 | ||||
-rw-r--r-- | pages/videolist/watch.php (renamed from watch.php) | 0 | ||||
-rw-r--r-- | start.php | 87 |
8 files changed, 49 insertions, 38 deletions
diff --git a/new.php b/pages/videolist/add.php index 881fba6ff..881fba6ff 100644 --- a/new.php +++ b/pages/videolist/add.php diff --git a/all.php b/pages/videolist/all.php index caccd7c3e..caccd7c3e 100644 --- a/all.php +++ b/pages/videolist/all.php diff --git a/browse.php b/pages/videolist/browse.php index 2392ef19a..2392ef19a 100644 --- a/browse.php +++ b/pages/videolist/browse.php diff --git a/edit.php b/pages/videolist/edit.php index cc06dd9c4..cc06dd9c4 100644 --- a/edit.php +++ b/pages/videolist/edit.php diff --git a/friends.php b/pages/videolist/friends.php index 8d90ae1a3..8d90ae1a3 100644 --- a/friends.php +++ b/pages/videolist/friends.php diff --git a/index.php b/pages/videolist/owner.php index 4ca5495e1..4ca5495e1 100644 --- a/index.php +++ b/pages/videolist/owner.php diff --git a/watch.php b/pages/videolist/watch.php index 4c92cc63b..4c92cc63b 100644 --- a/watch.php +++ b/pages/videolist/watch.php @@ -71,49 +71,60 @@ function videolist_init() { } /** - * videolist page handler; allows the use of fancy URLs + * Dispatches blog pages. + * URLs take the form of + * All videos: videolist/all + * User's videos: videolist/owner/<username> + * Friends' videos: videolist/friends/<username> + * Video watch: videolist/watch/<guid>/<title> + * Video browse: videolist/browse + * New video: videolist/add/<guid> + * Edit video: videolist/edit/<guid>/<revision> + * Group videos: videolist/group/<guid>/all * - * @param array $page From the page_handler function - * @return true|false Depending on success + * Title is ignored + * + * @param array $page + * @return NULL */ function videolist_page_handler($page) { - if (isset($page[0])) { - switch($page[0]) { - case "owned": if (isset($page[1])) set_input('username',$page[1]); - @include(dirname(__FILE__) . "/index.php"); - break; - case "friends": @include(dirname(__FILE__) . "/friends.php"); - break; - case "search": @include(dirname(__FILE__) . "/all.php"); - break; - case "video": @include(dirname(__FILE__) . "/video.php"); - break; - case "new": if (isset($page[3])) set_input('add_videourl',$page[3]); - if (isset($page[5])) set_input('page',$page[5]); - if (isset($page[1])) set_input('container',$page[1]); - @include(dirname(__FILE__) . "/new.php"); - break; - case "watch": set_input('video_id',$page[1]); - @include(dirname(__FILE__) . "/watch.php"); - break; - case "browse": if (isset($page[1])) set_input('container',$page[1]); - @include(dirname(__FILE__) . "/browse.php"); - break; - default : if (isset($page[1])) set_input('username',$page[1]); - @include(dirname(__FILE__) . "/index.php"); - break; - } - // If the URL is just 'videolist/username', or just 'videolist/', load the standard index file - } else { - if (isset($page[1])) { - set_input('username',$page[1]); - } - - include(dirname(__FILE__) . "/index.php"); - return true; + + if (!isset($page[0])) { + $page[0] = 'all'; } - return false; + $videolist_dir = elgg_get_plugins_path() . 'videolist/pages/videolist'; + + $page_type = $page[0]; + switch ($page_type) { + case 'owner': + include "$videolist_dir/owner.php"; + break; + case 'friends': + include "$videolist_dir/friends.php"; + break; + case 'watch': + set_input('guid', $page[1]); + include "$videolist_dir/watch.php"; + break; + case 'add': + include "$videolist_dir/add.php"; + break; + case 'edit': + set_input('guid', $page[1]); + include "$videolist_dir/edit.php"; + break; + case 'browse': + include "$videolist_dir/browse.php"; + break; + case 'group': + include "$videolist_dir/owner.php"; + break; + case 'all': + default: + include "$videolist_dir/all.php"; + break; + } } |