diff --git a/plugins/GNUsocialVideo/GNUsocialVideo.php b/plugins/GNUsocialVideo/GNUsocialVideo.php deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/plugins/GNUsocialVideo/GNUsocialVideoPlugin.php b/plugins/GNUsocialVideo/GNUsocialVideoPlugin.php new file mode 100644 index 0000000000..5e9a6f85e9 --- /dev/null +++ b/plugins/GNUsocialVideo/GNUsocialVideoPlugin.php @@ -0,0 +1,54 @@ +. + * + * @category Widget + * @package GNU Social + * @author Ian Denhardt + * @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 0000000000..8ed664c588 --- /dev/null +++ b/plugins/GNUsocialVideo/actions/postvideo.php @@ -0,0 +1,80 @@ +. + * + * @category Widget + * @package GNU Social + * @author Ian Denhardt + * @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('', $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'); + } + } +}