. * * @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']; $uri = filter_var($uri, FILTER_SANITIZE_URL); $uri = filter_var($uri, FILTER_VALIDATE_URL); if($uri) { $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'); } } }