diff options
author | Ian Denhardt <ian@zenhack.net> | 2010-08-11 14:27:42 -0400 |
---|---|---|
committer | Ian Denhardt <ian@zenhack.net> | 2010-08-11 14:27:42 -0400 |
commit | 8f37b432f82ffa5381d670ede65d6e63c8aea574 (patch) | |
tree | 6f1d2690f24909cca82a9aa864519cd898bdb3c5 /plugins/GNUsocialVideo | |
parent | 769d6089de4b2025b33145f4c30269dc083d2596 (diff) |
Rudementary video support.
Diffstat (limited to 'plugins/GNUsocialVideo')
-rw-r--r-- | plugins/GNUsocialVideo/GNUsocialVideo.php | 0 | ||||
-rw-r--r-- | plugins/GNUsocialVideo/GNUsocialVideoPlugin.php | 54 | ||||
-rw-r--r-- | plugins/GNUsocialVideo/actions/postvideo.php | 80 |
3 files changed, 134 insertions, 0 deletions
diff --git a/plugins/GNUsocialVideo/GNUsocialVideo.php b/plugins/GNUsocialVideo/GNUsocialVideo.php deleted file mode 100644 index e69de29bb..000000000 --- a/plugins/GNUsocialVideo/GNUsocialVideo.php +++ /dev/null diff --git a/plugins/GNUsocialVideo/GNUsocialVideoPlugin.php b/plugins/GNUsocialVideo/GNUsocialVideoPlugin.php new file mode 100644 index 000000000..5e9a6f85e --- /dev/null +++ b/plugins/GNUsocialVideo/GNUsocialVideoPlugin.php @@ -0,0 +1,54 @@ +<?php +/** + * GNU Social + * Copyright (C) 2010, Free Software Foundation, Inc. + * + * PHP version 5 + * + * LICENCE: + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * @category Widget + * @package GNU Social + * @author Ian Denhardt <ian@zenhack.net> + * @copyright 2010 Free Software Foundation, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 + */ + +if (!defined('STATUSNET')) { + exit(1); +} + +class GNUsocialVideoPlugin extends Plugin +{ + function onAutoload($cls) + { + $dir = dirname(__FILE__); + switch($cls) + { + case 'PostvideoAction': + include_once $dir . '/actions/postvideo.php'; + break; + default: + break; + } + return true; + } + + function onRouterInitialized($m) + { + $m->connect('main/postvideo', array('action' => 'postvideo')); + return true; + } +} diff --git a/plugins/GNUsocialVideo/actions/postvideo.php b/plugins/GNUsocialVideo/actions/postvideo.php new file mode 100644 index 000000000..8ed664c58 --- /dev/null +++ b/plugins/GNUsocialVideo/actions/postvideo.php @@ -0,0 +1,80 @@ +<?php +/** + * GNU Social + * Copyright (C) 2010, Free Software Foundation, Inc. + * + * PHP version 5 + * + * LICENCE: + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * @category Widget + * @package GNU Social + * @author Ian Denhardt <ian@zenhack.net> + * @copyright 2010 Free Software Foundation, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 + */ + +if (!defined('STATUSNET')) { + exit(1); +} + +class PostvideoAction extends Action { + var $user = null; + + function prepare($args) + { + parent::prepare($args); + $this->user = common_current_user(); + return true; + } + + function handle($args) + { + parent::handle($args); + if ($_SERVER['REQUEST_METHOD'] == 'POST') { + $this->handlePost($args); + } + $this->showPage(); + } + + function handlePost($args) + { + if (!$this->arg('post')) { + return; + } + if (empty($_POST['video_uri'])) { + return; + } + $uri = $_POST['video_uri']; + // XXX: validate your inputs, dummy. + $rend = sprintf('<video src="%s", controls="controls">Sorry, your browser doesn\'t support the video tag.</video>', $uri); + Notice::saveNew($this->user->id, 'video : ' . $uri, 'web', array('rendered' => $rend)); + } + + function showContent() + { + if(empty($this->user)) { + $this->element('p', array(), 'You are not logged in.'); + } else { + $this->elementStart('form', array('method' => 'post', + 'action' => common_local_url('postvideo'))); + $this->element('input', array('name' => 'video_uri', + 'type' => 'text', + 'id' => 'video_uri')); + $this->submit('post', _('Post')); + $this->elementEnd('form'); + } + } +} |