public function addAction() { $request = $this->getRequest(); $form = new Application_Form_Bookmark(); $form->setAction($this->_helper->url('add')); if ($this->getRequest()->isPost()) { if ($form->isValid($request->getPost())) { $bookmark = new Application_Model_Bookmark(); $id = $request->getParam('id', false); if ($id !== false && !is_null($id)) { Application_Model_BookmarksMapper::i()->find($id, $bookmark); if ($bookmark->isNew() || $bookmark->getId() != $id) { throw new Exception(X_Env::_('p_bookmarks_err_invalidid')); } } $url = $form->getValue('url'); $title = $form->getValue('title'); $description = $form->getValue('description'); $thumbnail = $form->getValue('thumbnail'); $bookmark->setUrl($url); $bookmark->setTitle($title); $bookmark->setThumbnail($thumbnail); $bookmark->setDescription($description); Application_Model_BookmarksMapper::i()->save($bookmark); //return $this->_helper->redirector('index'); $this->_helper->redirector('index', 'bookmarks'); } } $this->view->form = $form; }
function proxyAction() { // time to get params from get /* @var $request Zend_Controller_Request_Http */ $request = $this->getRequest(); if (!$this->plugin->config('proxy.enabled', true) && !X_VlcShares_Plugins::helpers()->devices()->isWiimc()) { throw new Exception(X_Env::_('p_animeftw_err_proxydisabled')); } // this action is so special.... no layout or viewRenderer $this->_helper->viewRenderer->setNoRender(); $this->_helper->layout->disableLayout(); $videoUrl = $request->getParam('v', false); // video file url $refererUrl = $request->getParam('r', false); // referer page needed if ($videoUrl === false || $refererUrl === false) { // invalid request throw new Exception(X_Env::_('p_animeftw_err_invalidrequest')); return; } $videoUrl = X_Env::decode($videoUrl); $refererUrl = X_Env::decode($refererUrl); // if user abort request (vlc/wii stop playing, this process ends ignore_user_abort(false); // close and clean the output buffer, everything will be read and send to device ob_end_clean(); //$userAgent = $this->plugin->config('hide.useragent', true) ? 'User-Agent: vlc-shares/'.X_VlcShares::VERSION : 'User-Agent: Mozilla/5.0 (X11; Linux i686; rv:2.0.1) Gecko/20101019 Firefox/4.0.1'; $userAgent = 'User-Agent: vlc-shares/' . X_VlcShares::VERSION . ' animeftw/' . X_VlcShares_Plugins_AnimeFTW::VERSION; $opts = array('http' => array('header' => array("Referer: {$refererUrl}", "User-Agent: {$userAgent}"))); $context = stream_context_create($opts); // readfile open a file and send it directly to output buffer readfile($videoUrl, false, $context); }
public function init() { parent::init(); if (!X_VlcShares_Plugins::broker()->isRegistered('bookmarklets')) { throw new Exception(X_Env::_('err_pluginnotregistered') . ": bookmarklets"); } }
public function init() { // Set the method for the display form to POST $this->setMethod('post'); $this->addElement('select', 'hoster', array('label' => X_Env::_('p_onlinelibrary_form_hoster_name'), 'description' => X_Env::_('p_onlinelibrary_form_hoster_description'), 'required' => true, 'filters' => array('StringTrim'))); $this->addElement('text', 'idVideo', array('label' => X_Env::_('p_onlinelibrary_form_idvideo_name'), 'description' => X_Env::_('p_onlinelibrary_form_idvideo_description'), 'required' => true, 'filters' => array('StringTrim'))); $this->addElement('text', 'category', array('label' => X_Env::_('p_onlinelibrary_form_category_name'), 'description' => X_Env::_('p_onlinelibrary_form_category_description'), 'required' => true, 'validators' => array(array('validator' => 'StringLength', 'options' => array(0, 50))))); $this->addElement('checkbox', 'check', array('label' => X_Env::_('p_onlinelibrary_form_check_name'), 'description' => X_Env::_('p_onlinelibrary_form_check_description'), 'required' => false)); // Add the comment element $this->addElement('text', 'title', array('label' => X_Env::_('p_onlinelibrary_form_title_name'), 'description' => X_Env::_('p_onlinelibrary_form_title_description'), 'required' => false, 'validators' => array(array('validator' => 'StringLength', 'options' => array(0, 50))))); $this->addElement('textarea', 'description', array('label' => X_Env::_('p_onlinelibrary_form_description_name'), 'description' => X_Env::_('p_onlinelibrary_form_description_description'), 'rows' => '5', 'filters' => array('StripTags'), 'required' => false)); // Add the comment element $this->addElement('text', 'thumbnail', array('label' => X_Env::_('p_onlinelibrary_form_thumbnail_name'), 'description' => X_Env::_('p_onlinelibrary_form_thumbnail_description'), 'required' => false)); // Add the submit button $this->addElement('submit', 'submit', array('ignore' => true, 'label' => X_Env::_('p_onlinelibrary_form_submit'))); // Add the submit button $this->addElement('button', 'abort', array('onClick' => 'javascript:history.back();', 'ignore' => true, 'label' => X_Env::_('p_onlinelibrary_form_abort'))); $this->addDisplayGroup(array('submit', 'abort'), 'buttons', array('decorators' => $this->getDefaultButtonsDisplayGroupDecorators())); /* // And finally add some CSRF protection $this->addElement('hash', 'csrf', array( 'ignore' => true, )); */ }
public function init() { parent::init(); if (!X_VlcShares_Plugins::broker()->isRegistered('upnprenderer')) { throw new Exception(X_Env::_('err_pluginnotregistered') . ": upnprenderer"); } else { $this->plugin = X_VlcShares_Plugins::broker()->getPlugins('upnprenderer'); } }
public function gen_afterPageBuild(X_Page_ItemList_PItem $items, Zend_Controller_Action $controller) { if (count($items->getItems()) == 0) { X_Debug::i("Plugin triggered"); $item = new X_Page_Item_PItem('emptylists', X_Env::_('p_emptylists_moveaway')); $item->setType(X_Page_Item_PItem::TYPE_ELEMENT)->setLink(X_Env::completeUrl($controller->getHelper('url')->url())); $items->append($item); } }
public function init() { // Set the method for the display form to POST $this->setMethod('post')->setAttrib('enctype', 'multipart/form-data'); $this->addElement('file', 'file', array('label' => X_Env::_('plugin_install_label'), 'description' => X_Env::_('plugin_install_desc'), 'required' => true, 'filters' => array('StringTrim'), 'destination' => APPLICATION_PATH . '/../data/plugin/', 'validators' => array(array('validator' => 'Count', 'options' => array(false, 1)), array('validator' => 'Size', 'options' => array(false, ini_get('upload_max_filesize'))), array('validator' => 'Extension', 'options' => array(false, 'zip,xegg'))), 'decorators' => array('CompositeFile'))); // Add the submit button $this->addElement('submit', 'submit', array('ignore' => true, 'label' => X_Env::_('plugin_installsubmit'))); // And finally add some CSRF protection $this->addElement('hash', 'csrf', array('ignore' => true, 'salt' => 'plugin_install_salt')); $this->addDisplayGroup(array('submit', 'csrf'), 'buttons', array('decorators' => $this->getDefaultButtonsDisplayGroupDecorators())); }
public function init() { // Set the method for the display form to POST $this->setMethod('post')->setAttrib('enctype', 'multipart/form-data'); $this->addElement('hidden', 'key', array('ignore' => false, 'decorators' => array('ViewHelper'), 'required' => true)); // Add the submit button $this->addElement('submit', 'submit', array('ignore' => true, 'label' => X_Env::_('plugin_action_uninstall'), 'decorators' => array('ViewHelper'))); // And finally add some CSRF protection $this->addElement('hash', 'csrf', array('ignore' => true, 'salt' => 'plugin_uconfirm_salt', 'decorators' => array('ViewHelper'))); $this->addDisplayGroup(array('submit', 'csrf', 'key'), 'buttons', array('decorators' => $this->getDefaultButtonsDisplayGroupDecorators())); }
/** * Add the button BackToStream in controls page * * @param X_Streamer_Engine $engine * @param Zend_Controller_Action $controller the controller who handle the request * @return array */ public function preGetControlItems(X_Streamer_Engine $engine, Zend_Controller_Action $controller) { // ignore if the streamer is not vlc if (!$engine instanceof X_Streamer_Engine_RtmpDump) { return; } $outputLink = "http://{%SERVER_NAME%}:{$this->helpers()->rtmpdump()->getStreamPort()}/"; $outputLink = str_replace(array('{%SERVER_IP%}', '{%SERVER_NAME%}'), array($_SERVER['SERVER_ADDR'], strstr($_SERVER['HTTP_HOST'], ':') ? strstr($_SERVER['HTTP_HOST'], ':') : $_SERVER['HTTP_HOST']), $outputLink); $item = new X_Page_Item_PItem($this->getId(), X_Env::_('p_profiles_backstream')); $item->setType(X_Page_Item_PItem::TYPE_PLAYABLE)->setIcon('/images/icons/play.png')->setLink($outputLink); return new X_Page_ItemList_PItem(array($item)); }
public function init() { $this->setName('aclclass'); // Set the method for the display form to POST $this->setMethod('post'); $this->addElement('text', 'name', array('label' => X_Env::_('p_auth_form_acl_class_name_label'), 'required' => true, 'filters' => array('StringTrim'))); $this->addElement('text', 'description', array('label' => X_Env::_('p_auth_form_acl_class_description_label'), 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('validator' => 'StringLength', 'options' => array(0, 255))))); // Add the submit button $this->addElement('submit', 'submit', array('ignore' => true, 'label' => X_Env::_('submit'), 'decorators' => array('ViewHelper'))); // And finally add some CSRF protection $this->addElement('hash', 'csrf', array('ignore' => true, 'salt' => __CLASS__)); $this->addDisplayGroup(array('submit', 'csrf'), 'buttons', array('decorators' => $this->getDefaultButtonsDisplayGroupDecorators())); }
/** * Show the dashboard */ public function indexAction() { /* @var $messages X_Page_ItemList_Message */ $messages = new X_Page_ItemList_Message(); $messages->merge(X_VlcShares_Plugins::broker()->getIndexMessages($this)); $fm = $this->_helper->flashMessenger->getMessages(); foreach ($fm as $i => $m) { $_m = new X_Page_Item_Message("fm-{$i}", ''); if (is_array($m)) { if (array_key_exists('type', $m)) { $_m->setType($m['type']); } if (array_key_exists('text', $m)) { $_m->setLabel($m['text']); } } else { $_m->setType(X_Page_Item_Message::TYPE_WARNING)->setLabel((string) $m); } $messages->append($_m); } $news = X_VlcShares_Plugins::broker()->getIndexNews($this); $manageLinks = new X_Page_ItemList_ManageLink(); $item = new X_Page_Item_ManageLink('core-manage-browse', X_Env::_('manage_goto_browsetitle')); $item->setTitle(X_Env::_('manage_goto_browse'))->setIcon('/images/manage/browse.png')->setLink(array('controller' => 'index', 'action' => 'collections'), 'default', true); $manageLinks->append($item); $item = new X_Page_Item_ManageLink('core-manage-test', X_Env::_('manage_goto_testtitle')); $item->setTitle(X_Env::_('manage_goto_test'))->setIcon('/images/manage/test.png')->setLink(array('controller' => 'test', 'action' => 'index'), 'default', true); $manageLinks->append($item); $item = new X_Page_Item_ManageLink('core-manage-configs', X_Env::_('manage_goto_configstitle')); $item->setTitle(X_Env::_('manage_goto_configs'))->setIcon('/images/manage/configs.png')->setLink(array('controller' => 'gconfigs', 'action' => 'index'), 'default', true); $manageLinks->append($item); $item = new X_Page_Item_ManageLink('core-manage-threads', X_Env::_('manage_goto_threadstitle')); $item->setTitle(X_Env::_('manage_goto_threads'))->setIcon('/images/manage/threads.png')->setLink(array('controller' => 'tmanager', 'action' => 'index'), 'default', true); $manageLinks->append($item); $manageLinks->merge(X_VlcShares_Plugins::broker()->getIndexManageLinks($this)); // fetch links from plugins $actionLinks = X_VlcShares_Plugins::broker()->getIndexActionLinks($this); $statistics = X_VlcShares_Plugins::broker()->getIndexStatistics($this); $this->view->version = X_VlcShares::VERSION; //$this->view->configPath = X_VlcShares::config(); //$this->view->test = $this->_helper->url('index', 'test'); //$this->view->pcstream = $this->_helper->url('pcstream', 'index'); //$this->view->pcstream_enabled = ($this->options->pcstream->get('commanderEnabled', false) && $this->vlc->isRunning()); $this->view->actionLinks = $actionLinks; $this->view->manageLinks = $manageLinks; $this->view->statistics = $statistics; $this->view->news = $news; $this->view->messages = $messages; // i need to get first class links }
public function init() { $this->setName('aclresource'); // Set the method for the display form to POST $this->setMethod('post'); $this->addElement('text', 'key', array('label' => X_Env::_('p_auth_form_acl_resource_key_label'), 'description' => X_Env::_('p_auth_form_acl_resource_key_desc'), 'required' => true, 'filters' => array('StringTrim'))); $this->addElement('select', 'class', array('label' => X_Env::_('p_auth_form_acl_resource_class_label'), 'description' => X_Env::_('p_auth_form_acl_resource_class_desc'), 'required' => true)); $this->addElement('select', 'generator', array('label' => X_Env::_('p_auth_form_acl_resource_generator_label'), 'description' => X_Env::_('p_auth_form_acl_resource_generator_desc'), 'required' => true)); // Add the submit button $this->addElement('submit', 'submit', array('ignore' => true, 'label' => X_Env::_('submit'), 'decorators' => array('ViewHelper'))); // And finally add some CSRF protection $this->addElement('hash', 'csrf', array('ignore' => true, 'salt' => __CLASS__)); $this->addDisplayGroup(array('submit', 'csrf'), 'buttons', array('decorators' => $this->getDefaultButtonsDisplayGroupDecorators())); }
public function init() { // Set the method for the display form to POST $this->setMethod('post'); $decorators = array(array('ViewHelper'), array('Errors'), array('Description', array('tag' => 'p', 'class' => 'description'))); $this->addElement('text', 'label', array('label' => X_Env::_('p_youtube_form_account_label'), 'description' => X_Env::_('p_youtube_form_account_label_desc'), 'required' => true, 'filters' => array('StringTrim'))); // Add the submit button $this->addElement('submit', 'submit', array('ignore' => true, 'label' => X_Env::_('submit'))); // Add the submit button $this->addElement('reset', 'abort', array('ignore' => true, 'label' => X_Env::_('abort'))); // And finally add some CSRF protection $this->addElement('hash', 'csrf', array('ignore' => true, 'salt' => 'p_youtube_account_new_salt')); $this->addElement('hidden', 'id', array('ignore' => true, 'required' => false)); $this->addDisplayGroup(array('submit', 'abort', 'csrf', 'id'), 'buttons', array('decorators' => $this->getDefaultButtonsDisplayGroupDecorators())); }
/** * Retrieve news from plugins * @param Zend_Controller_Action $this * @return X_Page_ItemList_News */ public function getIndexNews(Zend_Controller_Action $controller) { try { $view = $controller->getHelper('viewRenderer'); $view->view->headScript()->appendFile('http://www.google.com/jsapi'); $view->view->headScript()->appendFile($view->view->baseUrl("/js/widgetdevnews/script.js")); $view->view->headLink()->appendStylesheet($view->view->baseUrl('/css/widgetdevnews/style.css')); $text = (include dirname(__FILE__) . '/WidgetDevNews.commits.phtml'); $item = new X_Page_Item_News($this->getId(), ''); $item->setTab(X_Env::_('p_widgetdevnews_commits_tab'))->setContent($text); return new X_Page_ItemList_News(array($item)); } catch (Exception $e) { X_Debug::e('No view O_o'); } }
public function init() { // Set the method for the display form to POST $this->setMethod('post'); $this->addElement('text', 'label', array('label' => X_Env::_('p_filesystem_share_label_label'), 'description' => X_Env::_('p_filesystem_share_label_desc'), 'required' => true, 'filters' => array('StringTrim'))); $this->addElement('text', 'path', array('label' => X_Env::_('p_filesystem_share_path_label'), 'description' => X_Env::_('p_filesystem_share_path_desc'), 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('validator' => 'StringLength', 'options' => array(0, 255))))); // Add the submit button $this->addElement('submit', 'submit', array('ignore' => true, 'label' => X_Env::_('submit'))); // Add the submit button $this->addElement('reset', 'abort', array('ignore' => true, 'label' => X_Env::_('abort'))); // And finally add some CSRF protection $this->addElement('hash', 'csrf', array('ignore' => true, 'salt' => __CLASS__)); $this->addElement('hidden', 'id', array('ignore' => true, 'required' => false)); $this->addDisplayGroup(array('submit', 'csrf', 'id', 'abort'), 'buttons', array('decorators' => $this->getDefaultButtonsDisplayGroupDecorators())); }
/** * get an array with standard information about the playable * @param string $url the hoster page or resource ID * @param boolean $isId * @return array format: * array( * 'title' => TITLE * 'description' => DESCRIPTION * 'length' => LENGTH * ... * ) */ function getPlayableInfos($url, $isId = true) { if (!$isId) { $url = $this->getResourceId($url); } // use cached values if (array_key_exists($url, $this->info_cache)) { return $this->info_cache[$url]; } // use the api $http = new Zend_Http_Client("http://www.4shared.com/video/" . $url, array('headers' => array('User-Agent' => "vlc-shares/" . X_VlcShares::VERSION . " 4shared/" . X_VlcShares_Plugins_4Shared::VERSION))); $xml = $http->request()->getBody(); if (preg_match('/<!--\\/\\/ ref\\:null-->/', $xml)) { throw new Exception("Invalid ID {{$url}}", self::E_ID_INVALID); } $matches = array(); if (!preg_match('/<h1 id\\=\\"fileNameText\\">(?P<title>[^\\<]+)<\\/h1>/', $xml, $matches)) { $title = X_Env::_('p_4shared_title_not_setted'); } $title = $matches['title']; $matches = array(); if (!preg_match('/<h2 id\\=\\"fileDescriptionText\\">(?P<description>[^\\<]+)<\\/h2>/', $xml, $matches)) { $description = ''; } $description = $matches['description']; /* $matches = array(); if ( !preg_match('/length\=\"(?P<length>[^\"]+)\"/', $xml, $matches) ) { $length = ''; } $length = $matches['length']; */ $length = 0; $matches = array(); if (!preg_match('/image: \\"(?P<thumbnail>[^\\"]+)\\",/', $xml, $matches)) { $thumbnail = ''; } $thumbnail = $matches['thumbnail']; $matches = array(); if (!preg_match('/file: \\"(?P<video>[^\\"]+)\\"/', $xml, $matches)) { $video = ''; } $video = $matches['video']; $infos = array('title' => $title, 'description' => $description, 'length' => $length, 'thumbnail' => $thumbnail, 'url' => $video); // add in cache $this->info_cache[$url] = $infos; return $infos; }
public function getModeItems($provider, $location, Zend_Controller_Action $controller) { $list = new X_Page_ItemList_PItem(); $urlHelper = $controller->getHelper('url'); if ($this->countdown > 0) { $countdown = new X_Page_Item_PItem('core-countdown', X_Env::_('core_countdown', $this->countdown)); $countdown->setType(X_Page_Item_PItem::TYPE_ELEMENT)->setIcon("/images/{$this->getId()}/logo.png")->setLink(X_Env::completeUrl($urlHelper->url())); $list->append($countdown); } if ($this->error_message) { $error = new X_Page_Item_PItem('core-error', X_Env::_($this->error_message)); $error->setType(X_Page_Item_PItem::TYPE_ELEMENT)->setIcon("/images/{$this->getId()}/logo.png")->setLink(X_Env::completeUrl($urlHelper->url())); $list->append($error); } return $list; }
public function init() { $this->setName('auth_account'); // Set the method for the display form to POST $this->setMethod('post'); $this->addElement('text', 'username', array('label' => X_Env::_('p_auth_form_account_username_label'), 'required' => true, 'filters' => array('StringTrim'))); $this->addElement('password', 'password', array('label' => X_Env::_('p_auth_form_account_password_label'), 'description' => X_Env::_('p_auth_form_account_password_desc'), 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('validator' => 'StringLength', 'options' => array(5, 32))))); $this->addElement('radio', 'enabled', array('label' => X_Env::_('p_auth_form_account_enabled_label'), 'required' => true, 'multiOptions' => array(1 => X_Env::_('enabled'), 0 => X_Env::_('disabled')))); $this->addElement('radio', 'altallowed', array('label' => X_Env::_('p_auth_form_account_altallowed_label'), 'description' => X_Env::_('p_auth_form_account_altallowed_desc'), 'required' => true, 'multiOptions' => array(1 => X_Env::_('enabled'), 0 => X_Env::_('disabled')))); $this->addElement('multiCheckbox', 'permissions', array('label' => X_Env::_('p_auth_form_account_permissions_label'), 'description' => X_Env::_('p_auth_form_account_permissions_desc'), 'required' => true, 'escape' => false)); // Add the submit button $this->addElement('submit', 'submit', array('ignore' => true, 'label' => X_Env::_('p_auth_form_account_save'), 'decorators' => array('ViewHelper'))); // And finally add some CSRF protection $this->addElement('hash', 'csrf', array('ignore' => true, 'salt' => __CLASS__)); $this->addElement('hidden', 'id', array('ignore' => true, 'required' => false)); $this->addDisplayGroup(array('submit', 'csrf', 'id'), 'buttons', array('decorators' => $this->getDefaultButtonsDisplayGroupDecorators())); }
public function init() { // Set the method for the display form to POST $this->setMethod('post'); $this->setName('installer'); $this->addElement('select', 'lang', array('required' => true, 'label' => X_Env::_('installer_selectlanguage'), 'multiOptions' => array())); $this->addElement('radio', 'auth', array('label' => X_Env::_('installer_authrequired_label'), 'description' => X_Env::_('installer_authrequired_desc'), 'required' => true, 'filters' => array('StringTrim'), 'multiOptions' => array(1 => X_Env::_('configs_options_yes'), 0 => X_Env::_('configs_options_no')))); $this->addElement('text', 'username', array('label' => X_Env::_('p_auth_form_account_username_label'), 'required' => true, 'filters' => array('StringTrim'))); $this->addElement('password', 'password', array('label' => X_Env::_('p_auth_form_account_password_label'), 'description' => X_Env::_('p_auth_form_account_password_desc2'), 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('validator' => 'StringLength', 'options' => array(5, 32))))); $this->addElement('text', 'threads', array('label' => X_Env::_('config_general_threads_forker_label'), 'description' => X_Env::_('config_general_threads_forker_desc'), 'required' => true, 'class' => 'hidden')); $this->addElement('multiCheckbox', 'plugins', array('required' => false, 'label' => X_Env::_('installer_optionalplugins'), 'description' => X_Env::_('installer_optionalplugins_desc'), 'escape' => false, 'decorators' => array('PluginsMultiCheckBox'))); // Add the submit button $this->addElement('submit', 'submit', array('ignore' => true, 'label' => X_Env::_('installer_startbutton'))); // And finally add some CSRF protection $this->addElement('hash', 'csrf', array('salt' => __CLASS__, 'ignore' => true)); $this->addDisplayGroup(array('submit', 'csrf'), 'buttons', array('decorators' => $this->getDefaultButtonsDisplayGroupDecorators())); }
public function init() { $this->setName('profiles'); // Set the method for the display form to POST $this->setMethod('post'); $this->addElement('text', 'label', array('label' => X_Env::_('p_profiles_form_label_label'), 'description' => X_Env::_('p_profiles_form_label_desc'), 'required' => true, 'filters' => array('StringTrim'))); $this->addElement('textarea', 'arg', array('label' => X_Env::_('p_profiles_form_arg_label'), 'description' => X_Env::_('p_profiles_form_arg_desc'), 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('validator' => 'StringLength', 'options' => array(0, 1000))))); $this->addElement('text', 'link', array('label' => X_Env::_('p_profiles_form_link_label'), 'description' => X_Env::_('p_profiles_form_link_desc'), 'required' => true, 'filters' => array('StringTrim'))); // Add the submit button $this->addElement('submit', 'submit', array('ignore' => true, 'label' => X_Env::_('submit'), 'decorators' => array('ViewHelper'))); // Add the submit button $this->addElement('reset', 'abort', array('ignore' => true, 'label' => X_Env::_('abort'))); // And finally add some CSRF protection $this->addElement('hash', 'csrf', array('ignore' => true, 'salt' => 'p_profiles_salt')); $this->addElement('hidden', 'id', array('ignore' => true, 'required' => false)); $this->addDisplayGroup(array('submit', 'csrf', 'id', 'abort'), 'buttons', array('decorators' => $this->getDefaultButtonsDisplayGroupDecorators())); }
/** * Retrieve statistic from plugins * @param Zend_Controller_Action $this * @return X_Page_ItemList_Message */ public function getIndexMessages(Zend_Controller_Action $controller) { $version = X_VlcShares::VERSION; X_Debug::i('Plugin triggered'); $showError = false; $type = 'warning'; if (strpos($version, 'alpha') !== false || strpos($version, 'beta') !== false || strpos($version, 'dev') !== false || strpos($version, 'unstable') !== false) { $showError = true; } elseif (strpos($version, 'rc') !== false || strpos($version, 'release_candidate') !== false) { $showError = true; $type = 'info'; } if ($showError) { $m = new X_Page_Item_Message($this->getId(), X_Env::_('p_widgetdevalert_warningmessage')); $m->setType($type); return new X_Page_ItemList_Message(array($m)); } }
/** * Retrieve statistic from plugins * @param Zend_Controller_Action $this * @return X_Page_ItemList_Message */ public function getIndexMessages(Zend_Controller_Action $controller) { $updates = $this->checkUpdates(); $list = new X_Page_ItemList_Message(); if ($updates['core'] !== false) { $m = new X_Page_Item_Message("{$this->getId()}-core", X_Env::_('p_updatenotifier_coreupdate', $updates['core']['version'], $updates['core']['type'], trim($updates['core']['changelog']), $updates['core']['download'], $updates['core']['update'])); $m->setType(X_Page_Item_Message::TYPE_INFO); $list->append($m); } if (count($updates['plugins'])) { foreach ($updates['plugins'] as $key => $infos) { $m = new X_Page_Item_Message("{$this->getId()}-plugin", X_Env::_('p_updatenotifier_pluginupdate', $key, $infos['version'], $infos['type'], trim($infos['changelog']), $infos['download'], $infos['update'])); $m->setType(X_Page_Item_Message::TYPE_INFO); $list->append($m); } } return count($list->getItems()) ? $list : null; }
function proxyAction() { // time to get params from get /* @var $request Zend_Controller_Request_Http */ $request = $this->getRequest(); // this action is so special.... no layout or viewRenderer $this->_helper->viewRenderer->setNoRender(); $this->_helper->layout->disableLayout(); $videoUrl = $request->getParam('v', false); // video file url //$refererUrl = $request->getParam('r', false); // referer page needed if ($videoUrl === false) { // invalid request throw new Exception(X_Env::_('p_spainradio_err_invalidrequest')); } $videoUrl = X_Env::decode($videoUrl); //$refererUrl = X_Env::decode($refererUrl); if (!defined("X_VlcShares_Plugins_Spainradio::C_{$videoUrl}")) { throw new Exception(X_Env::_('p_spainradio_err_invalidchannel')); } $videoUrl = constant("X_VlcShares_Plugins_Spainradio::C_{$videoUrl}"); //$userAgent = $this->plugin->config('hide.useragent', true) ? 'User-Agent: vlc-shares/'.X_VlcShares::VERSION.' spainradio/'.X_VlcShares_Plugins_Spainradio::VERSION : 'User-Agent: Mozilla/5.0 (X11; Linux i686; rv:2.0.1) Gecko/20101019 Firefox/4.0.1'; //$userAgent = 'User-Agent: vlc-shares/'.X_VlcShares::VERSION.' spainradio/'.X_VlcShares_Plugins_Spainradio::VERSION; $opts = array('http' => array('header' => array())); $context = stream_context_create($opts); /* redirect support in wiimc exists only from 1.1.0 if ( X_VlcShares_Plugins::helpers()->devices()->isWiimc() && !X_VlcShares_Plugins::helpers()->devices()->isWiimcBeforeVersion('1.0.9') && $this->plugin->config('direct.enabled', true) ) { $match = array(); $xml = file_get_contents($videoUrl, false, $context); if ( preg_match('/<REF HREF=\"([^\"]*)\"\/>/', $xml, $match ) ) { $this->_helper->redirector->gotoUrlAndExit($match[1]); } else { throw new Exception(X_Env::_('p_spainradio_err_invalidchannel')); } } else {*/ // if user abort request (vlc/wii stop playing, this process ends) ignore_user_abort(false); // close and clean the output buffer, everything will be read and send to device ob_end_clean(); // readfile open a file and send it directly to output buffer readfile($videoUrl, false, $context); //} }
public function init() { $this->setName('outputs'); // Set the method for the display form to POST $this->setMethod('post'); $this->addElement('text', 'label', array('label' => X_Env::_('p_outputs_form_label_label'), 'description' => X_Env::_('p_outputs_form_label_desc'), 'required' => true, 'filters' => array('StringTrim'))); $this->addElement('text', 'link', array('label' => X_Env::_('p_outputs_form_link_label'), 'description' => X_Env::_('p_outputs_form_link_desc'), 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('validator' => 'StringLength', 'options' => array(0, 1000))))); $this->addElement('text', 'arg', array('label' => X_Env::_('p_outputs_form_arg_label'), 'description' => X_Env::_('p_outputs_form_arg_desc'), 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('validator' => 'StringLength', 'options' => array(0, 1000))))); $this->addElement('text', 'weight', array('label' => X_Env::_('p_outputs_form_weight_label'), 'description' => X_Env::_('p_outputs_form_weight_desc'), 'required' => false, 'filters' => array('Int'), 'validators' => array('Int'))); $devices = array('-1' => X_Env::_('p_outputs_devicetype_generic'), X_VlcShares_Plugins_Helper_Devices::DEVICE_WIIMC => 'WiiMC', X_VlcShares_Plugins_Helper_Devices::DEVICE_ANDROID => X_Env::_('p_outputs_devicetype_android'), X_VlcShares_Plugins_Helper_Devices::DEVICE_PC => 'Pc'); $this->addElement('select', 'cond_devices', array('label' => X_Env::_('p_outputs_form_conddevices_label'), 'description' => X_Env::_('p_outputs_form_conddevices_desc'), 'required' => true, 'multiOptions' => $devices)); // Add the submit button $this->addElement('submit', 'submit', array('ignore' => true, 'label' => X_Env::_('submit'))); // Add the submit button $this->addElement('button', 'abort', array('ignore' => true, 'label' => X_Env::_('abort'))); // And finally add some CSRF protection $this->addElement('hash', 'csrf', array('ignore' => true, 'salt' => 'p_outputs_salt')); $this->addElement('hidden', 'id', array('ignore' => true, 'required' => false)); $this->addDisplayGroup(array('submit', 'csrf', 'id', 'abort'), 'buttons', array('decorators' => $this->getDefaultButtonsDisplayGroupDecorators())); }
public function init() { // Set the method for the display form to POST $this->setMethod('post'); $decorators = array(array('ViewHelper'), array('Errors'), array('Description', array('tag' => 'p', 'class' => 'description'))); $this->addElement('text', 'idYoutube', array('label' => X_Env::_('p_youtube_form_video_label'), 'description' => X_Env::_('p_youtube_form_video_label_desc'), 'required' => true, 'filters' => array('StringTrim'))); $categories = array(); foreach (Application_Model_YoutubeCategoriesMapper::i()->fetchAll() as $category) { /* @var $category Application_Model_YoutubeCategory */ $categories[$category->getId()] = $category->getLabel(); } $this->addElement('select', 'idCategory', array('label' => X_Env::_('p_youtube_form_video_idCategory'), 'description' => X_Env::_('p_youtube_form_video_idCategory_desc'), 'required' => true, 'multiOptions' => $categories)); // Add the submit button $this->addElement('submit', 'submit', array('ignore' => true, 'required' => false, 'label' => X_Env::_('submit'))); // Add the submit button $this->addElement('reset', 'abort', array('ignore' => true, 'label' => X_Env::_('abort'))); // And finally add some CSRF protection $this->addElement('hash', 'csrf', array('salt' => 'p_youtube_video_new_salt')); $this->addDisplayGroup(array('submit', 'abort', 'csrf'), 'buttons', array('decorators' => $this->getDefaultButtonsDisplayGroupDecorators())); }
public function init() { $this->setName('devices'); // Set the method for the display form to POST $this->setMethod('post'); $this->addElement('text', 'label', array('label' => X_Env::_('p_devices_form_label_label'), 'description' => X_Env::_('p_devices_form_label_desc'), 'required' => true, 'filters' => array('StringTrim'))); $this->addElement('text', 'pattern', array('label' => X_Env::_('p_devices_form_pattern_label'), 'description' => X_Env::_('p_devices_form_pattern_desc', "http://www.php.net/manual/en/pcre.pattern.php"), 'required' => true, 'filters' => array('StringTrim'))); $this->addElement('radio', 'exact', array('label' => X_Env::_('p_devices_form_exact_label'), 'description' => X_Env::_('p_devices_form_exact_desc'), 'required' => true, 'value' => '', 'multiOptions' => array(0 => X_Env::_('configs_options_no'), 1 => X_Env::_('configs_options_yes')))); $this->addElement('select', 'gui', array('label' => X_Env::_('p_devices_form_gui_label'), 'description' => X_Env::_('p_devices_form_gui_desc'), 'required' => true)); $this->addElement('select', 'profile', array('label' => X_Env::_('p_devices_form_profile_label'), 'description' => X_Env::_('p_devices_form_profile_desc'), 'required' => true)); $this->addElement('multiCheckbox', 'profiles', array('label' => X_Env::_('p_devices_form_profiles_label'), 'description' => X_Env::_('p_devices_form_profiles_desc'), 'required' => false)); // Add the submit button $this->addElement('submit', 'submit', array('ignore' => true, 'label' => X_Env::_('submit'))); // Add the submit button $this->addElement('reset', 'abort', array('ignore' => true, 'label' => X_Env::_('reset'))); // And finally add some CSRF protection $this->addElement('hash', 'csrf', array('ignore' => true, 'salt' => 'p_devices_salt')); $this->addElement('hidden', 'id', array('ignore' => true, 'required' => false)); $this->addDisplayGroup(array('submit', 'csrf', 'id', 'abort'), 'buttons', array('decorators' => $this->getDefaultButtonsDisplayGroupDecorators())); }
/** * Retrieve core statistics * @param Zend_Controller_Action $this * @return X_Page_ItemList_Statistic */ public function getIndexStatistics(Zend_Controller_Action $controller) { $plugins = count(X_VlcShares_Plugins::broker()->getPlugins()); $helpers = count(X_VlcShares_Plugins::helpers()->getHelpers()); $pluginsList = '<div class="scrollable" style="max-height: 75px;"><ol>'; foreach (X_VlcShares_Plugins::broker()->getPlugins() as $pluginName => $pluginObj) { $explodedClass = explode('_', get_class($pluginObj)); $formattedPluginClass = array_pop($explodedClass); $pluginsList .= "<li style=\"font-weight: normal;\">{$formattedPluginClass}</li>\n"; } $pluginsList .= "</ol></div>"; $helpersList = '<div class="scrollable" style="max-height: 75px;"><ol>'; foreach (X_VlcShares_Plugins::helpers()->getHelpers() as $pluginName => $pluginObj) { $explodedClass = explode('_', get_class($pluginObj)); $formattedPluginClass = array_pop($explodedClass); $helpersList .= "<li style=\"font-weight: normal;\">{$formattedPluginClass}</li>\n"; } $helpersList .= "</ol></div>"; $vlc = X_Vlc::getLastInstance()->isRunning() ? X_Env::_('p_corestats_vlcrunning_yes') : X_Env::_('p_corestats_vlcrunning_no'); $stat = new X_Page_Item_Statistic($this->getId(), X_Env::_('p_corestats_statstitle')); $stat->setTitle(X_Env::_('p_corestats_statstitle'))->appendStat(X_Env::_('p_corestats_vlcrunning') . ": {$vlc}")->appendStat(X_Env::_('p_corestats_pluginnumber') . ": {$plugins}")->appendStat(X_Env::_('p_corestats_helpernumber') . ": {$helpers}")->appendStat(X_Env::_('p_corestats_pluginslist') . ": {$pluginsList}")->appendStat(X_Env::_('p_corestats_helperlist') . ": {$helpersList}"); return new X_Page_ItemList_Statistic(array($stat)); }
public function init() { // Set the method for the display form to POST $this->setMethod('post'); $this->addElement('text', 'rtmp', array('label' => X_Env::_('p_onlinelibrary_form_rtmp_rtmp_name'), 'description' => X_Env::_('p_onlinelibrary_form_rtmp_rtmp_description'), 'required' => true, 'filters' => array('StringTrim'))); $this->addElement('radio', 'live', array('label' => X_Env::_('p_onlinelibrary_form_live_name'), 'description' => X_Env::_('p_onlinelibrary_form_live_description'), 'required' => false, 'value' => '', 'multiOptions' => array('' => X_Env::_('configs_options_no'), 'true' => X_Env::_('configs_options_yes')))); $this->addElement('text', 'host', array('label' => X_Env::_('p_onlinelibrary_form_rtmp_host_name'), 'description' => X_Env::_('p_onlinelibrary_form_rtmp_host_description'), 'required' => false, 'filters' => array('StringTrim'))); $this->addElement('text', 'port', array('label' => X_Env::_('p_onlinelibrary_form_rtmp_port_name'), 'description' => X_Env::_('p_onlinelibrary_form_rtmp_port_description'), 'required' => false, 'filters' => array('StringTrim'))); $this->addElement('text', 'socks', array('label' => X_Env::_('p_onlinelibrary_form_rtmp_protocol_name'), 'description' => X_Env::_('p_onlinelibrary_form_rtmp_protocol_description'), 'required' => false, 'filters' => array('StringTrim'))); $this->addElement('text', 'playpath', array('label' => X_Env::_('p_onlinelibrary_form_rtmp_playpath_name'), 'description' => X_Env::_('p_onlinelibrary_form_rtmp_playpath_description'), 'required' => false, 'filters' => array('StringTrim'))); $this->addElement('text', 'swfUrl', array('label' => X_Env::_('p_onlinelibrary_form_rtmp_swfUrl_name'), 'description' => X_Env::_('p_onlinelibrary_form_rtmp_swfUrl_description'), 'required' => false, 'filters' => array('StringTrim'))); $this->addElement('text', 'tcUrl', array('label' => X_Env::_('p_onlinelibrary_form_rtmp_tcUrl_name'), 'description' => X_Env::_('p_onlinelibrary_form_rtmp_tcUrl_description'), 'required' => false, 'filters' => array('StringTrim'))); $this->addElement('text', 'pageUrl', array('label' => X_Env::_('p_onlinelibrary_form_rtmp_pageUrl_name'), 'description' => X_Env::_('p_onlinelibrary_form_rtmp_pageUrl_description'), 'required' => false, 'filters' => array('StringTrim'))); $this->addElement('text', 'app', array('label' => X_Env::_('p_onlinelibrary_form_rtmp_app_name'), 'description' => X_Env::_('p_onlinelibrary_form_rtmp_app_description'), 'required' => false, 'filters' => array('StringTrim'))); $this->addElement('text', 'swfhash', array('label' => X_Env::_('p_onlinelibrary_form_rtmp_swfhash_name'), 'description' => X_Env::_('p_onlinelibrary_form_rtmp_swfhash_description'), 'required' => false, 'filters' => array('StringTrim'))); $this->addElement('text', 'swfsize', array('label' => X_Env::_('p_onlinelibrary_form_rtmp_swfsize_name'), 'description' => X_Env::_('p_onlinelibrary_form_rtmp_swfsize_description'), 'required' => false, 'filters' => array('StringTrim'))); $this->addElement('text', 'swfVfy', array('label' => X_Env::_('p_onlinelibrary_form_rtmp_swfVfy_name'), 'description' => X_Env::_('p_onlinelibrary_form_rtmp_swfVfy_description'), 'required' => false, 'filters' => array('StringTrim'))); $this->addElement('text', 'swfAge', array('label' => X_Env::_('p_onlinelibrary_form_rtmp_swfAge_name'), 'description' => X_Env::_('p_onlinelibrary_form_rtmp_swfAge_description'), 'required' => false, 'filters' => array('StringTrim'))); $this->addElement('text', 'auth', array('label' => X_Env::_('p_onlinelibrary_form_rtmp_auth_name'), 'description' => X_Env::_('p_onlinelibrary_form_rtmp_auth_description'), 'required' => false, 'filters' => array('StringTrim'))); $this->addElement('text', 'conn', array('label' => X_Env::_('p_onlinelibrary_form_rtmp_conn_name'), 'description' => X_Env::_('p_onlinelibrary_form_rtmp_conn_description'), 'required' => false, 'filters' => array('StringTrim'))); // Add the comment element $this->addElement('text', 'flashVer', array('label' => X_Env::_('p_onlinelibrary_form_flashVer_name'), 'description' => X_Env::_('p_onlinelibrary_form_flashVer_description'), 'required' => false, 'validators' => array(array('validator' => 'StringLength', 'options' => array(0, 50))))); $this->addElement('text', 'token', array('label' => X_Env::_('p_onlinelibrary_form_rtmp_token_name'), 'description' => X_Env::_('p_onlinelibrary_form_rtmp_token_description'), 'required' => false, 'filters' => array('StringTrim'))); // Add the submit button $this->addElement('submit', 'submit', array('ignore' => true, 'label' => X_Env::_('p_onlinelibrary_form_rtmpsubmit'))); // Add the submit button $this->addElement('hidden', 'quiet', array('value' => 'true')); // Add the submit button $this->addElement('button', 'abort', array('onClick' => 'javascript:history.back();', 'ignore' => true, 'label' => X_Env::_('p_onlinelibrary_form_abort'))); $this->addDisplayGroup(array('submit', 'abort', 'quiet'), 'buttons', array('decorators' => $this->getDefaultButtonsDisplayGroupDecorators())); /* // And finally add some CSRF protection $this->addElement('hash', 'csrf', array( 'ignore' => true, )); */ }
public function init() { // Set the method for the display form to POST $this->setMethod('post'); $decorators = array(array('ViewHelper'), array('Errors'), array('Description', array('tag' => 'p', 'class' => 'description'))); $this->addElement('text', 'label', array('label' => X_Env::_('p_youtube_form_category_label'), 'description' => X_Env::_('p_youtube_form_category_label_desc'), 'required' => true, 'filters' => array('StringTrim'))); $files = array('upload' => X_Env::_('p_youtube_form_category_thumbselect_otheroption')); foreach (new DirectoryIterator(APPLICATION_PATH . '/../public/images/youtube/uploads/') as $file) { /* @var $file DirectoryIterator */ if (!$file->isDot() && $file->isFile() && $file->isReadable() && in_array(pathinfo($file->getFilename(), PATHINFO_EXTENSION), array('jpg', 'png', 'gif'))) { $files[$file->getFilename()] = $file->getFilename(); } } $this->addElement('select', 'thumbselect', array('label' => X_Env::_('p_youtube_form_category_thumbselect'), 'description' => X_Env::_('p_youtube_form_category_thumbselect_desc'), 'required' => true, 'multiOptions' => $files)); $this->addElement('file', 'thumbnail', array('label' => X_Env::_('p_youtube_form_category_thumbnail'), 'description' => X_Env::_('p_youtube_form_category_thumbnail_desc'), 'required' => false, 'ignore' => true, 'ignoreNoFile' => true, 'destination' => APPLICATION_PATH . '/../public/images/youtube/uploads/', 'validators' => array(array('validator' => 'Count', 'options' => array(false, 1)), array('validator' => 'Size', 'options' => array(false, ini_get('upload_max_filesize'))), array('validator' => 'Extension', 'options' => array(false, 'png,jpg,gif'))), 'decorators' => array('CompositeFile'))); // Add the submit button $this->addElement('submit', 'submit', array('ignore' => true, 'label' => X_Env::_('submit'))); // Add the submit button $this->addElement('reset', 'abort', array('ignore' => true, 'label' => X_Env::_('abort'))); // And finally add some CSRF protection $this->addElement('hash', 'csrf', array('ignore' => true, 'salt' => 'p_youtube_category_new_salt')); $this->addElement('hidden', 'id', array('ignore' => true, 'required' => false)); $this->addDisplayGroup(array('submit', 'abort', 'csrf', 'id'), 'buttons', array('decorators' => $this->getDefaultButtonsDisplayGroupDecorators())); }
function daccountAction() { $accountId = $this->getRequest()->getParam('idAccount', false); if ($accountId != false && $accountId != null && $accountId != '') { $account = new Application_Model_YoutubeAccount(); Application_Model_YoutubeAccountsMapper::i()->find($accountId, $account); if ($accountId == $account->getId()) { try { Application_Model_YoutubeAccountsMapper::i()->delete($account); $this->_helper->flashMessenger(array('text' => X_Env::_('p_youtube_delete_completed_account'), 'type' => 'info')); } catch (Exception $e) { $this->_helper->flashMessenger(array('text' => X_Env::_('p_youtube_delete_err_dberror') . ": {$e->getMessage()}", 'type' => 'error')); } } else { $this->_helper->flashMessenger(array('text' => X_Env::_('p_youtube_delete_invaliddata'), 'type' => 'error')); } } $this->_helper->redirector('index', 'youtube'); }