Ejemplo n.º 1
0
 public function doAction(Zend_Controller_Action $action)
 {
     $entryId = $action->getRequest()->getParam('entry-id');
     $xslt = $action->getRequest()->getParam('xslt');
     $this->client = Infra_ClientHelper::getClient();
     $xml = $this->client->media->getMrss($entryId);
     $xslParams = array();
     $xslParams['entryDistributionId'] = '';
     $xslParams['distributionProfileId'] = '';
     ob_start();
     $xmlDoc = new DOMDocument();
     $xmlDoc->loadXML($xml);
     $xsltDoc = new DOMDocument();
     $xsltDoc->loadXML($xslt);
     $xslt = new XSLTProcessor();
     $xslt->registerPHPFunctions();
     // it is safe to register all php fuctions here
     $xslt->setParameter('', $xslParams);
     $xslt->importStyleSheet($xsltDoc);
     $ob = ob_get_clean();
     ob_end_clean();
     if ($ob) {
         $action->getHelper('json')->direct(array('error' => $ob));
     }
     $obj = array('result' => $xslt->transformToXml($xmlDoc));
     $action->getHelper('json')->direct($obj);
 }
 public function doAction(Zend_Controller_Action $action)
 {
     $action->getHelper('viewRenderer')->setNoRender();
     $providerId = $this->_getParam('provider_id');
     $client = Kaltura_ClientHelper::getClient();
     try {
         $client->genericDistributionProvider->delete($providerId);
         echo $action->getHelper('json')->sendJson('ok', false);
     } catch (Exception $e) {
         KalturaLog::err($e->getMessage() . "\n" . $e->getTraceAsString());
         echo $action->getHelper('json')->sendJson($e->getMessage(), false);
     }
 }
Ejemplo n.º 3
0
 /**
  * @description render view
  * @param Zend_Controller_Action $controller
  * @param string $personal
  * @return void
  */
 public function render(Zend_Controller_Action $controller, $personal = 'payment/alfa.phtml')
 {
     if (!is_file(APPLICATION_PATH . '/views/scripts/' . $personal)) {
         $default = isset($this->_config['defaultViewName']) ? $this->_config['defaultViewName'] : 'index.phtml';
         $controller->getHelper('viewRenderer')->setNoRender();
         // turn off native (personal) view
         $controller->view->addScriptPath(__DIR__ . '/alfa/application/views/scripts/');
         // add current folder to the view path
         $controller->view->form = $this->getForm();
         $controller->getHelper('viewRenderer')->renderScript($default);
         // render
     }
 }
Ejemplo n.º 4
0
 public function doAction(Zend_Controller_Action $action)
 {
     $action->getHelper('layout')->disableLayout();
     $drmProfileId = $this->_getParam('drmProfileId');
     $client = Infra_ClientHelper::getClient();
     $drmPluginClient = Kaltura_Client_Drm_Plugin::get($client);
     try {
         $updatedDrmProfile = $drmPluginClient->drmProfile->delete($drmProfileId);
         echo $action->getHelper('json')->sendJson('ok', false);
     } catch (Exception $e) {
         KalturaLog::err($e->getMessage() . "\n" . $e->getTraceAsString());
         echo $action->getHelper('json')->sendJson($e->getMessage(), false);
     }
 }
 public function doAction(Zend_Controller_Action $action)
 {
     $action->getHelper('viewRenderer')->setNoRender();
     $profileId = $this->_getParam('profile_id');
     $status = $this->_getParam('status');
     $client = Kaltura_ClientHelper::getClient();
     try {
         $client->distributionProfile->updateStatus($profileId, $status);
         echo $action->getHelper('json')->sendJson('ok', false);
     } catch (Exception $e) {
         KalturaLog::err($e->getMessage() . "\n" . $e->getTraceAsString());
         echo $action->getHelper('json')->sendJson($e->getMessage(), false);
     }
 }
 public function doAction(Zend_Controller_Action $action)
 {
     $action->getHelper('viewRenderer')->setNoRender();
     $templateId = $this->_getParam('template_id');
     $status = $this->_getParam('status');
     $client = Infra_ClientHelper::getClient();
     $eventNotificationPlugin = Kaltura_Client_EventNotification_Plugin::get($client);
     try {
         $eventNotificationPlugin->eventNotificationTemplate->updateStatus($templateId, $status);
         echo $action->getHelper('json')->sendJson('ok', false);
     } catch (Exception $e) {
         KalturaLog::err($e->getMessage() . "\n" . $e->getTraceAsString());
         echo $action->getHelper('json')->sendJson($e->getMessage(), false);
     }
 }
 public function gen_afterPageBuild(X_Page_ItemList_PItem $items, Zend_Controller_Action $controller)
 {
     /*
     if ( !$this->_forceRendering ) { 
     	// even if forced.enabled, don't build the page if the device is wiimc
     	if ( $this->helpers()->devices()->isWiimc() || ( !((bool) $this->config('forced.enabled', false)) && !$this->helpers()->devices()->isAndroid() )) return;
     }
     */
     if (!$this->isDefaultRenderer()) {
         return;
     }
     X_Debug::i("Plugin triggered");
     $request = $controller->getRequest();
     $urlHelper = $controller->getHelper('url');
     /* @var $view Zend_Controller_Action_Helper_ViewRenderer */
     $view = $controller->getHelper('viewRenderer');
     /* @var $layout Zend_Layout_Controller_Action_Helper_Layout */
     $layout = $controller->getHelper('layout');
     $view->setViewSuffix('mobile.phtml');
     $layout->getLayoutInstance()->setLayout('mobile', true);
     if ($request instanceof Zend_Controller_Request_Http) {
         if ($request->isXmlHttpRequest()) {
             $layout->getLayoutInstance()->disableLayout();
         }
     }
     try {
         $providerObj = X_VlcShares_Plugins::broker()->getPlugins($request->getParam('p', ''));
         $view->view->providerName = strtolower($providerObj->getId());
         if ($providerObj instanceof X_VlcShares_Plugins_ResolverDisplayableInterface) {
             // location in request obj are X_Env::encoded
             $view->view->location = $providerObj->resolveLocation(X_Env::decode($request->getParam('l', '')));
         }
         if ($providerObj instanceof X_VlcShares_Plugins_ResolverInterface) {
             // location in request obj are X_Env::encoded
             $view->view->locationRaw = $providerObj->resolveLocation(X_Env::decode($request->getParam('l', '')));
             $view->view->parentLocation = $providerObj->getParentLocation(X_Env::decode($request->getParam('l', '')));
         }
     } catch (Exception $e) {
         //die('No provider');
         X_Debug::i('No provider O_o');
     }
     // set some vars for view
     $view->view->provider = $request->getParam('p', '');
     $view->view->items = $items;
     $view->view->actionName = $request->getActionName();
     $view->view->controllerName = $request->getControllerName();
     $view->view->coverflowEnabled = $this->config('coverflow.enabled', true);
 }
Ejemplo n.º 8
0
 /**
  * Get category/video list
  * @param unknown_type $provider
  * @param unknown_type $location
  * @param Zend_Controller_Action $controller
  */
 public function getShareItems($provider, $location, Zend_Controller_Action $controller)
 {
     // this plugin add items only if it is the provider
     if ($provider != $this->getId()) {
         return;
     }
     X_Debug::i("Plugin triggered");
     $urlHelper = $controller->getHelper('url');
     $items = new X_Page_ItemList_PItem();
     if ($location != '' && ($location == self::INDEX_NARUTO || $location == self::INDEX_ONEPIECE || $location == self::INDEX_BLEACH)) {
         $pageIndex = $this->config('index.url', 'http://www.dbforever.net/home.php') . "?page={$location}";
         $htmlString = $this->_loadPage($pageIndex);
         $dom = new Zend_Dom_Query($htmlString);
         $results = $dom->queryXpath('//div[@align="left"]/a');
         for ($i = 0; $i < $results->count(); $i++, $results->next()) {
             $node = $results->current();
             $href = $node->getAttribute('href');
             $label = $node->nodeValue;
             $item = new X_Page_Item_PItem($this->getId() . '-' . $label, $label);
             $item->setIcon('/images/icons/file_32.png')->setType(X_Page_Item_PItem::TYPE_ELEMENT)->setCustom(__CLASS__ . ':location', $href)->setLink(array('action' => 'mode', 'l' => X_Env::encode($href)), 'default', false);
             $items->append($item);
         }
     } else {
         $item = new X_Page_Item_PItem($this->getId() . '-' . self::INDEX_NARUTO, X_Env::_('p_dbforever_naruto_ep'));
         $item->setIcon('/images/icons/folder_32.png')->setType(X_Page_Item_PItem::TYPE_CONTAINER)->setCustom(__CLASS__ . ':location', self::INDEX_NARUTO)->setThumbnail('http://www.dbforever.net/img/banner/naruto_banner_grande.jpg')->setLink(array('l' => X_Env::encode(self::INDEX_NARUTO)), 'default', false);
         $items->append($item);
         $item = new X_Page_Item_PItem($this->getId() . '-' . self::INDEX_ONEPIECE, X_Env::_('p_dbforever_onepiece_ep'));
         $item->setIcon('/images/icons/folder_32.png')->setType(X_Page_Item_PItem::TYPE_CONTAINER)->setCustom(__CLASS__ . ':location', self::INDEX_ONEPIECE)->setThumbnail('http://www.dbforever.net/img/banner/onepiece_banner_grande.jpg')->setLink(array('l' => X_Env::encode(self::INDEX_ONEPIECE)), 'default', false);
         $items->append($item);
         $item = new X_Page_Item_PItem($this->getId() . '-' . self::INDEX_BLEACH, X_Env::_('p_dbforever_bleach_ep'));
         $item->setIcon('/images/icons/folder_32.png')->setType(X_Page_Item_PItem::TYPE_CONTAINER)->setCustom(__CLASS__ . ':location', self::INDEX_BLEACH)->setThumbnail('http://www.dbforever.net/img/banner/bleach_banner_grande.jpg')->setLink(array('l' => X_Env::encode(self::INDEX_BLEACH)), 'default', false);
         $items->append($item);
     }
     return $items;
 }
 public function doAction(Zend_Controller_Action $action)
 {
     $request = $action->getRequest();
     $field = $request->getParam('field', null);
     $id = $request->getParam('id', null);
     $type = $request->getParam('type', null);
     $reqponse = $this->query($type, array("{$field}Id" => array($id)), array("@timestamp" => "desc"), 100, array("sessionId"));
     $json = array();
     if (isset($reqponse->hits) && isset($reqponse->hits->hits)) {
         $sessions = array();
         foreach ($reqponse->hits->hits as $hit) {
             if (isset($hit->fields) && isset($hit->fields->sessionId)) {
                 foreach ($hit->fields->sessionId as $sessionId) {
                     if (!in_array("{$sessionId}", $sessions)) {
                         $sessions[] = "{$sessionId}";
                     }
                 }
             }
         }
         $reqponse = $this->query($type, array("sessionId" => $sessions), array("@timestamp" => "asc", "sessionIndex" => "asc"), 100000);
         if (isset($reqponse->hits) && isset($reqponse->hits->hits)) {
             $json = $reqponse->hits->hits;
         }
     }
     echo $action->getHelper('json')->sendJson($json, false);
 }
Ejemplo n.º 10
0
 public function doAction(Zend_Controller_Action $action)
 {
     $entryId = $action->getRequest()->getParam('entry-id');
     $this->client = Infra_ClientHelper::getClient();
     $action->getHelper('layout')->setLayout('layout_empty');
     $action->view->entryId = $entryId;
     $action->view->xml = $this->client->media->getMrss($entryId);
 }
 public function doAction(Zend_Controller_Action $action)
 {
     $action->getHelper('layout')->disableLayout();
     $dropFolderId = $this->_getParam('dropFolderId');
     $newStatus = $this->_getParam('dropFolderStatus');
     $client = Infra_ClientHelper::getClient();
     $dropFolderPluginClient = Kaltura_Client_DropFolder_Plugin::get($client);
     $updatedDropFolder = new Kaltura_Client_DropFolder_Type_DropFolder();
     $updatedDropFolder->status = $newStatus;
     try {
         $updatedDropFolder = $dropFolderPluginClient->dropFolder->update($dropFolderId, $updatedDropFolder);
         echo $action->getHelper('json')->sendJson('ok', false);
     } catch (Exception $e) {
         KalturaLog::err($e->getMessage() . "\n" . $e->getTraceAsString());
         echo $action->getHelper('json')->sendJson($e->getMessage(), false);
     }
 }
 public function getSelectionItems($provider, $location, $pid, Zend_Controller_Action $controller)
 {
     // we want to expose items only if pid is this plugin
     if ($this->getId() != $pid) {
         return;
     }
     // check for resolvable $location
     // this plugin is useless if i haven't an access
     // to the real location (url for stream or path for file)
     $provider = X_VlcShares_Plugins::broker()->getPlugins($provider);
     if (!$provider instanceof X_VlcShares_Plugins_ResolverInterface) {
         return;
     }
     $providerClass = get_class($provider);
     X_Debug::i('Plugin triggered');
     $urlHelper = $controller->getHelper('url');
     // i try to mark current selected sub based on $this->getId() param
     // in $currentSub i get the name of the current profile
     $currentSub = $controller->getRequest()->getParam($this->getId(), false);
     if ($currentSub !== false) {
         $currentSub = X_Env::decode($currentSub);
     }
     $return = new X_Page_ItemList_PItem();
     $item = new X_Page_Item_PItem($this->getId() . '-none', X_Env::_('p_audioswitcher_selection_none'));
     $item->setType(X_Page_Item_PItem::TYPE_ELEMENT)->setLink(array('action' => 'mode', $this->getId() => null, 'pid' => null), 'default', false)->setHighlight($currentSub === false);
     $return->append($item);
     // i do the check for this on top
     // location param come in a plugin encoded way
     $location = $provider->resolveLocation($location);
     // check if infile support is enabled
     // by default infile.enabled is true
     if ($this->config('infile.enabled', true)) {
         // check for infile tracks
         $infileTracks = $this->helpers()->stream()->setLocation($location)->getAudiosInfo();
         //X_Debug::i(var_export($infileSubs, true));
         foreach ($infileTracks as $streamId => $track) {
             X_Debug::i("Valid infile-sub: [{$streamId}] {$track['language']} ({$track['format']})");
             $item = new X_Page_Item_PItem($this->getId() . '-stream-' . $streamId, X_Env::_("p_audioswitcher_subtype_" . self::STREAM) . " {$streamId} {$track['language']} {$track['format']}");
             $item->setType(X_Page_Item_PItem::TYPE_ELEMENT)->setCustom(__CLASS__ . ':sub', self::STREAM . ":{$streamId}")->setLink(array('action' => 'mode', 'pid' => null, $this->getId() => X_Env::encode(self::STREAM . ":{$streamId}")), 'default', false)->setHighlight($currentSub == self::STREAM . ":{$streamId}");
             $return->append($item);
         }
     }
     // for file system source i will search for subs in filename notation
     // by default file.enabled is true
     if ($this->config('file.enabled', true) && is_a($provider, 'X_VlcShares_Plugins_FileSystem')) {
         $dirname = pathinfo($location, PATHINFO_DIRNAME);
         $filename = pathinfo($location, PATHINFO_FILENAME);
         $extTracks = $this->getFSTracks($dirname, $filename);
         foreach ($extTracks as $streamId => $track) {
             X_Debug::i("Valid extfile-sub: {$track['language']} ({$track['format']})");
             $item = new X_Page_Item_PItem($this->getId() . '-file-' . $streamId, X_Env::_("p_audioswitcher_subtype_" . self::FILE) . " {$track['language']} ({$track['format']})");
             $item->setType(X_Page_Item_PItem::TYPE_ELEMENT)->setCustom(__CLASS__ . ':sub', self::FILE . ":{$streamId}")->setLink(array('action' => 'mode', 'pid' => null, $this->getId() => X_Env::encode(self::FILE . ":{$streamId}")), 'default', false)->setHighlight($currentSub == self::FILE . ":{$streamId}");
             $return->append($item);
         }
     }
     // general profiles are in the bottom of array
     return $return;
 }
Ejemplo n.º 13
0
 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);
     }
 }
 protected function dispatchRequest(Zend_Controller_Request_Http $request, X_Page_ItemList_PItem $items, Zend_Controller_Action $controller)
 {
     /* @var $view Zend_Controller_Action_Helper_ViewRenderer */
     $view = $controller->getHelper('viewRenderer');
     /* @var $layout Zend_Layout_Controller_Action_Helper_Layout */
     $layout = $controller->getHelper('layout');
     try {
         $view->setNoRender(true);
         $layout->disableLayout();
     } catch (Exception $e) {
         X_Debug::e("Layout or View not enabled: " . $e->getMessage());
     }
     $result = array();
     $actionName = $request->getActionName();
     $controllerName = $request->getControllerName();
     $result['controller'] = $controllerName;
     $result['action'] = $actionName;
     $result['success'] = true;
     $result['items'] = array();
     /* @var $urlHelper Zend_Controller_Action_Helper_Url */
     $urlHelper = $controller->getHelper('url');
     $skipMethod = array('getCustom', 'getLinkParam', 'getLinkAction', 'getLinkController');
     foreach ($items->getItems() as $itemId => $item) {
         /* @var $item X_Page_Item_PItem */
         $aItem = array();
         $methods = get_class_methods(get_class($item));
         foreach ($methods as $method) {
             if (array_search($method, $skipMethod) !== false) {
                 continue;
             }
             if ($method == "getIcon") {
                 $aItem['icon'] = $request->getBaseUrl() . $item->getIcon();
             } elseif (X_Env::startWith($method, 'get')) {
                 $aItem[lcfirst(substr($method, 3))] = $item->{$method}();
             } elseif (X_Env::startWith($method, 'is')) {
                 $aItem[lcfirst(substr($method, 2))] = $item->{$method}();
             }
         }
         $result['items'][] = $aItem;
     }
     /* @var $jsonHelper Zend_Controller_Action_Helper_Json */
     $jsonHelper = $controller->getHelper('Json');
     $jsonHelper->direct($result, true, false);
 }
 public function gen_afterPageBuild(X_Page_ItemList_PItem $items, Zend_Controller_Action $controller)
 {
     if ($this->helpers()->devices()->isWiimc() && $this->helpers()->devices()->isWiimcBeforeVersion('1.0.9')) {
         if (count($items->getItems()) === 1) {
             X_Debug::i("Plugin triggered");
             $item = new X_Page_Item_PItem('workaroundwiimcplaylistitemsbug', '-- Workaround for bug in Wiimc <= 1.0.9 --');
             $item->setType(X_Page_Item_PItem::TYPE_ELEMENT)->setLink(X_Env::completeUrl($controller->getHelper('url')->url()));
             $items->append($item);
         }
     }
 }
 public function doAction(Zend_Controller_Action $action)
 {
     $action->getHelper('viewRenderer')->setNoRender();
     $serverId = $this->_getParam('server_id');
     $client = Infra_ClientHelper::getClient();
     $businessProcessNotificationPlugin = Kaltura_Client_BusinessProcessNotification_Plugin::get($client);
     $partnerId = $this->_getParam('partner_id');
     if ($partnerId) {
         Infra_ClientHelper::impersonate($partnerId);
     }
     try {
         $server = $businessProcessNotificationPlugin->businessProcessServer->get($serverId);
         /* @var $server Kaltura_Client_BusinessProcessNotification_Type_BusinessProcessServer */
         $businessProcessProvider = kBusinessProcessProvider::get($server);
         $processes = $businessProcessProvider->listBusinessProcesses();
         asort($processes);
     } catch (Exception $e) {
         KalturaLog::err($e->getMessage() . "\n" . $e->getTraceAsString());
         echo $action->getHelper('json')->sendJson($e->getMessage(), false);
     }
     echo $action->getHelper('json')->sendJson($processes, false);
 }
Ejemplo n.º 17
0
 public function doAction(Zend_Controller_Action $action)
 {
     $action->getHelper('layout')->disableLayout();
     $request = $action->getRequest();
     $drmProfileId = $this->_getParam('drm_profile_id');
     $partnerId = $this->_getParam('new_partner_id');
     $drmProfileProvider = $this->_getParam('new_drm_profile_provider');
     $drmProfileForm = null;
     $action->view->formValid = false;
     try {
         if ($request->isPost()) {
             $partnerId = $this->_getParam('partnerId');
             $drmProfileProvider = $this->_getParam('provider');
             $drmProfileForm = new Form_DrmProfileConfigure($partnerId, $drmProfileProvider);
             $action->view->formValid = $this->processForm($drmProfileForm, $request->getPost(), $partnerId, $drmProfileId);
             if (!is_null($drmProfileId)) {
                 $drmProfile = $drmProfileForm->getObject("Kaltura_Client_Drm_Type_DrmProfile", $request->getPost(), false, true);
             }
         } else {
             if (!is_null($drmProfileId)) {
                 $client = Infra_ClientHelper::getClient();
                 $drmPluginClient = Kaltura_Client_Drm_Plugin::get($client);
                 $drmProfile = $drmPluginClient->drmProfile->get($drmProfileId);
                 $partnerId = $drmProfile->partnerId;
                 $drmProfileProvider = $drmProfile->provider;
                 $drmProfileForm = new Form_DrmProfileConfigure($partnerId, $drmProfileProvider);
                 $drmProfileForm->populateFromObject($drmProfile, false);
             } else {
                 $drmProfileForm = new Form_DrmProfileConfigure($partnerId, $drmProfileProvider);
                 $drmProfileForm->getElement('partnerId')->setValue($partnerId);
             }
         }
     } catch (Exception $e) {
         $action->view->formValid = false;
         KalturaLog::err($e->getMessage() . "\n" . $e->getTraceAsString());
         $action->view->errMessage = $e->getMessage();
     }
     $action->view->form = $drmProfileForm;
     $pluginInstances = KalturaPluginManager::getPluginInstances('IKalturaApplicationPartialView');
     KalturaLog::debug("plugin instances [" . count($pluginInstances) . "]");
     foreach ($pluginInstances as $pluginInstance) {
         $drmProfilePlugins = $pluginInstance->getApplicationPartialViews('plugin', get_class($this));
         if (!$drmProfilePlugins) {
             continue;
         }
         foreach ($drmProfilePlugins as $plugin) {
             /* @var $plugin Kaltura_View_Helper_PartialViewPlugin */
             $plugin->plug($action->view);
         }
     }
 }
Ejemplo n.º 18
0
 public function doAction(Zend_Controller_Action $action)
 {
     $action->getHelper('layout')->disableLayout();
     $profileId = $this->_getParam('profileId');
     $status = $this->_getParam('status');
     $client = Infra_ClientHelper::getClient();
     $virusScanPlugin = Kaltura_Client_VirusScan_Plugin::get($client);
     $newVirusScanProfile = new Kaltura_Client_VirusScan_Type_VirusScanProfile();
     if ($status == 'enable') {
         $newVirusScanProfile->status = Kaltura_Client_VirusScan_Enum_VirusScanProfileStatus::ENABLED;
     } elseif ($status == 'disable') {
         $newVirusScanProfile->status = Kaltura_Client_VirusScan_Enum_VirusScanProfileStatus::DISABLED;
     } elseif ($status == 'delete') {
         $newVirusScanProfile->status = Kaltura_Client_VirusScan_Enum_VirusScanProfileStatus::DELETED;
     }
     try {
         $virusScanPlugin->virusScanProfile->update($profileId, $newVirusScanProfile);
         echo $action->getHelper('json')->sendJson('ok', false);
     } catch (Exception $e) {
         KalturaLog::err($e->getMessage() . "\n" . $e->getTraceAsString());
         echo $action->getHelper('json')->sendJson($e->getMessage(), false);
     }
 }
Ejemplo n.º 19
0
 /**
  * Get category/video list
  * @param unknown_type $provider
  * @param unknown_type $location
  * @param Zend_Controller_Action $controller
  */
 public function getShareItems($provider, $location, Zend_Controller_Action $controller)
 {
     // this plugin add items only if it is the provider
     if ($provider != $this->getId()) {
         return;
     }
     X_Debug::i("Plugin triggered");
     // try to disable SortItems plugin, so link are listed as in html page
     X_VlcShares_Plugins::broker()->unregisterPluginClass('X_VlcShares_Plugins_SortItems');
     $urlHelper = $controller->getHelper('url');
     $items = new X_Page_ItemList_PItem();
     if ($location != '' && array_key_exists((int) $location, $this->seasons)) {
         // episodes list
         $url = $this->seasons[(int) $location];
         $html = $this->_loadPage($url);
         $dom = new Zend_Dom_Query($html);
         $results = $dom->queryXpath('//div[@id="randomVideos"]//div[@class="randomTab"]//a[@class="previewDescriptionTitle"]');
         $resultsImages = $dom->queryXpath('//div[@id="randomVideos"]//div[@class="randomTab"]//img[1]/attribute::src');
         for ($i = 0; $i < $results->count(); $i++, $results->next()) {
             $node = $results->current();
             $href = $node->getAttribute('href');
             $label = $node->nodeValue;
             $id = explode('id=', $href, 2);
             $id = @$id[1];
             $thumb = null;
             try {
                 if ($resultsImages->valid()) {
                     $thumb = $resultsImages->current()->nodeValue;
                     $resultsImages->next();
                 }
             } catch (Exception $e) {
                 $thumb = null;
             }
             $item = new X_Page_Item_PItem($this->getId() . '-' . $label, $label);
             $item->setIcon('/images/icons/file_32.png')->setType(X_Page_Item_PItem::TYPE_ELEMENT)->setCustom(__CLASS__ . ':location', $id)->setLink(array('action' => 'mode', 'l' => X_Env::encode($id)), 'default', false);
             if ($thumb !== null) {
                 $item->setThumbnail($thumb);
             }
             $items->append($item);
         }
     } else {
         foreach ($this->seasons as $key => $seasons) {
             $item = new X_Page_Item_PItem($this->getId() . '-' . $key, X_Env::_('p_allsp_season_n') . ": {$key}");
             $item->setIcon('/images/icons/folder_32.png')->setType(X_Page_Item_PItem::TYPE_CONTAINER)->setCustom(__CLASS__ . ':location', $key)->setLink(array('action' => 'share', 'l' => X_Env::encode($key)), 'default', false);
             $items->append($item);
         }
     }
     return $items;
 }
Ejemplo n.º 20
0
 /**
  * Retrieve core statistics
  * @param Zend_Controller_Action $this
  * @return X_Page_ItemList_Statistic
  */
 public function getIndexStatistics(Zend_Controller_Action $controller)
 {
     $entries = Application_Model_CacheMapper::i()->getCount();
     $stat = new X_Page_Item_Statistic($this->getId(), X_Env::_('p_cache_statstitle'));
     $stat->setTitle(X_Env::_('p_cache_statstitle'))->appendStat(X_Env::_('p_cache_stats_storedentries') . ": {$entries}");
     if ($entries) {
         $urlHelper = $controller->getHelper('url');
         $clearOldHref = $urlHelper->url(array('controller' => 'cache', 'action' => 'clearold'), 'default', true);
         $clearAllHref = $urlHelper->url(array('controller' => 'cache', 'action' => 'clearall'), 'default', true);
         $clearOldLink = '<a href="' . $clearOldHref . '">' . X_Env::_('p_cache_stats_clearold') . '</a>';
         $clearAllLink = '<a href="' . $clearAllHref . '">' . X_Env::_('p_cache_stats_clearall') . '</a>';
         $stat->appendStat($clearOldLink)->appendStat($clearAllLink);
     }
     return new X_Page_ItemList_Statistic(array($stat));
 }
 /**
  * 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');
     }
 }
Ejemplo n.º 22
0
 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;
 }
Ejemplo n.º 23
0
 /**
  * Get category/video list
  * @param unknown_type $provider
  * @param unknown_type $location
  * @param Zend_Controller_Action $controller
  */
 public function getShareItems($provider, $location, Zend_Controller_Action $controller)
 {
     // this plugin add items only if it is the provider
     if ($provider != $this->getId()) {
         return;
     }
     X_Debug::i("Plugin triggered");
     $urlHelper = $controller->getHelper('url');
     $items = new X_Page_ItemList_PItem();
     if ($location != '') {
         // try to disable SortItems plugin, so link are listed as in html page
         X_VlcShares_Plugins::broker()->unregisterPluginClass('X_VlcShares_Plugins_SortItems');
         $pageIndex = rtrim($this->config('base.url', 'http://www.animeland.it/'), '/') . "/{$location}";
         $htmlString = $this->_loadPage($pageIndex);
         $dom = new Zend_Dom_Query($htmlString);
         $results = $dom->queryXpath('//a[@href!="menu_streaming.html"]');
         for ($i = 0; $i < $results->count(); $i++, $results->next()) {
             $node = $results->current();
             $href = $node->getAttribute('href');
             $label = $node->nodeValue;
             $item = new X_Page_Item_PItem($this->getId() . '-' . $label, $label);
             $item->setIcon('/images/icons/file_32.png')->setType(X_Page_Item_PItem::TYPE_ELEMENT)->setCustom(__CLASS__ . ':location', $href)->setLink(array('action' => 'mode', 'l' => X_Env::encode($href)), 'default', false);
             $items->append($item);
         }
     } else {
         $pageIndex = rtrim($this->config('base.url', 'http://www.animeland.it/'), '/') . "/" . $this->config('index.page', 'menu_streaming.html');
         $htmlString = $this->_loadPage($pageIndex);
         $dom = new Zend_Dom_Query($htmlString);
         $results = $dom->queryXpath('//a[@href!="menu_streaming.html"]');
         for ($i = 0; $i < $results->count(); $i++, $results->next()) {
             $node = $results->current();
             $href = $node->getAttribute('href');
             $label = $node->nodeValue;
             $target = $node->getAttribute('target');
             if ($target == '_blank') {
                 $item = new X_Page_Item_PItem($this->getId() . '-' . $label, $label);
                 $item->setIcon('/images/icons/file_32.png')->setType(X_Page_Item_PItem::TYPE_ELEMENT)->setCustom(__CLASS__ . ':location', $href)->setLink(array('action' => 'mode', 'l' => X_Env::encode($href)), 'default', false);
                 $items->append($item);
             } else {
                 $item = new X_Page_Item_PItem($this->getId() . '-' . $label, $label);
                 $item->setIcon('/images/icons/folder_32.png')->setType(X_Page_Item_PItem::TYPE_CONTAINER)->setCustom(__CLASS__ . ':location', $href)->setLink(array('action' => 'share', 'l' => X_Env::encode($href)), 'default', false);
                 $items->append($item);
             }
         }
     }
     return $items;
 }
Ejemplo n.º 24
0
 public function doAction(Zend_Controller_Action $action)
 {
     $action->getHelper('layout')->disableLayout();
     $request = $action->getRequest();
     $dropFolderId = $this->_getParam('drop_folder_id');
     $partnerId = $this->_getParam('new_partner_id');
     $dropFolderType = $this->_getParam('new_drop_folder_type');
     $dropFolderForm = null;
     $action->view->formValid = false;
     try {
         if ($request->isPost()) {
             $partnerId = $this->_getParam('partnerId');
             $dropFolderType = $this->_getParam('type');
             $dropFolderForm = new Form_DropFolderConfigure($partnerId, $dropFolderType);
             $action->view->formValid = $this->processForm($dropFolderForm, $request->getPost(), $dropFolderId);
             if (!is_null($dropFolderId)) {
                 $dropFolder = $dropFolderForm->getObject("Kaltura_Client_DropFolder_Type_DropFolder", $request->getPost(), false, true);
                 $this->disableFileHandlerType($dropFolderForm, $dropFolder->fileHandlerType);
             }
         } else {
             if (!is_null($dropFolderId)) {
                 $client = Infra_ClientHelper::getClient();
                 $dropFolderPluginClient = Kaltura_Client_DropFolder_Plugin::get($client);
                 $dropFolder = $dropFolderPluginClient->dropFolder->get($dropFolderId);
                 $partnerId = $dropFolder->partnerId;
                 $dropFolderType = $dropFolder->type;
                 $dropFolderForm = new Form_DropFolderConfigure($partnerId, $dropFolderType);
                 $dropFolderForm->populateFromObject($dropFolder, false);
                 $this->disableFileHandlerType($dropFolderForm, $dropFolder->fileHandlerType);
             } else {
                 $dropFolderForm = new Form_DropFolderConfigure($partnerId, $dropFolderType);
                 $dropFolderForm->getElement('partnerId')->setValue($partnerId);
                 $settings = Zend_Registry::get('config')->dropFolder;
                 if ($dropFolderType === Kaltura_Client_DropFolder_Enum_DropFolderType::LOCAL) {
                     $dropFolderForm->getElement('fileSizeCheckInterval')->setValue($settings->fileSizeCheckIntervalLocal);
                 } else {
                     $dropFolderForm->getElement('fileSizeCheckInterval')->setValue($settings->fileSizeCheckIntervalRemote);
                 }
             }
         }
     } catch (Exception $e) {
         $action->view->formValid = false;
         KalturaLog::err($e->getMessage() . "\n" . $e->getTraceAsString());
         $action->view->errMessage = $e->getMessage();
     }
     $action->view->form = $dropFolderForm;
 }
 /**
  * Get category/video list
  * @param string $provider
  * @param string $location
  * @param Zend_Controller_Action $controller
  * @return X_Page_ItemList_PItem
  */
 public function getShareItems($provider, $location, Zend_Controller_Action $controller)
 {
     // this plugin add items only if it is the provider
     if ($provider != $this->getId()) {
         return;
     }
     X_Debug::i("Plugin triggered");
     // disabling cache plugin
     try {
         $cachePlugin = X_VlcShares_Plugins::broker()->getPlugins('cache');
         if (method_exists($cachePlugin, 'setDoNotCache')) {
             $cachePlugin->setDoNotCache();
         }
     } catch (Exception $e) {
         // cache plugin not registered, no problem
     }
     $urlHelper = $controller->getHelper('url');
     X_VlcShares_Plugins::broker()->unregisterPluginClass('X_VlcShares_Plugins_SortItems');
     $items = new X_Page_ItemList_PItem();
     // location format:
     // $catPage/X_Env::encode($category)/$itemPage/$item
     $locParts = $location != '' ? explode('/', $location, 4) : array();
     @(list($catPage, $category, $itemPage, $item) = $locParts);
     $locCount = count($locParts);
     // category is double encoded so we need an extra decode
     $category = X_Env::decode($category);
     switch ($locCount) {
         case 2:
             $itemPage = 1;
         case 4:
             // we shouldn't be here, $locCount = 4 means that we have a
             // selected video in location. We should be in browse/mode
         // we shouldn't be here, $locCount = 4 means that we have a
         // selected video in location. We should be in browse/mode
         case 3:
             $this->fetchVideos($items, $catPage, $category, $itemPage);
             break;
         default:
         case 0:
             $catPage = 1;
         case 1:
             $this->fetchCategories($items, $catPage);
             break;
     }
     return $items;
 }
 /**
  * Return the -shared-folders- link
  * for the collection index
  * @param Zend_Controller_Action $controller
  * @return X_Page_ItemList_PItem
  */
 public function preGetCollectionsItems(Zend_Controller_Action $controller)
 {
     X_Debug::i("Plugin triggered");
     $updates = $this->checkUpdates();
     /* @var $urlHelper Zend_Controller_Action_Helper_Url */
     $urlHelper = $controller->getHelper('url');
     $list = new X_Page_ItemList_PItem();
     if ($updates['core'] !== false) {
         $link = new X_Page_Item_PItem("{$this->getId()}-coreupdate", X_Env::_('p_updatenotifier_collectionindex_core'));
         $link->setIcon('/images/updatenotifier/logo.png')->setDescription(X_Env::_('p_updatenotifier_collectionindex_core_desc'))->setType(X_Page_Item_PItem::TYPE_ELEMENT)->setLink($urlHelper->url());
         $list->append($link);
     }
     if (count($updates['plugins'])) {
         $link = new X_Page_Item_PItem("{$this->getId()}-pluginsupdate", X_Env::_('p_updatenotifier_collectionindex_plugins', count($updates['plugins'])));
         $link->setIcon('/images/updatenotifier/logo.png')->setDescription(X_Env::_('p_updatenotifier_collectionindex_plugins_desc'))->setType(X_Page_Item_PItem::TYPE_ELEMENT)->setLink($urlHelper->url());
         $list->append($link);
     }
     return count($list->getItems()) ? $list : null;
 }
Ejemplo n.º 27
0
 /**
  * Get category/video list
  * @param unknown_type $provider
  * @param unknown_type $location
  * @param Zend_Controller_Action $controller
  */
 public function getShareItems($provider, $location, Zend_Controller_Action $controller)
 {
     // this plugin add items only if it is the provider
     if ($provider != $this->getId()) {
         return;
     }
     X_Debug::i("Plugin triggered");
     $urlHelper = $controller->getHelper('url');
     $items = new X_Page_ItemList_PItem();
     //try to disable SortItems plugin, so link are listed as in html page
     X_VlcShares_Plugins::broker()->unregisterPluginClass('X_VlcShares_Plugins_SortItems');
     X_Debug::i("Requested location: {$location}");
     $split = $location != '' ? @explode('/', $location, 4) : array();
     X_Debug::i("Exploded location: " . var_export($split, true));
     switch (count($split)) {
         // i should not be here, so i fallback to video case
         case 4:
             // show the list of video in the page
             // here authentication is required if it's possibile
         // show the list of video in the page
         // here authentication is required if it's possibile
         case 3:
             $this->_fetchVideos($items, $split[0], $split[1], $split[2]);
             break;
             // show the list of thread in category by letter
         // show the list of thread in category by letter
         case 2:
             $this->_fetchThreads($items, $split[0], $split[1]);
             break;
             // show the list of A-B-C.... if an area is selected
         // show the list of A-B-C.... if an area is selected
         case 1:
             $this->_fetchClassification($items, $split[0]);
             break;
         default:
             $this->_fetchLists($items);
     }
     return $items;
 }
Ejemplo n.º 28
0
 /**
  * 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)
 {
     $urlHelper = $controller->getHelper('url');
     $return = new X_Page_ItemList_PItem();
     if ($this->config('show.title', true)) {
         $onAirName = X_Env::_("p_streaminfo_unknown_source");
         if ($engine instanceof X_Streamer_Engine_Vlc) {
             $vlc = $engine->getVlcWrapper();
             $onAirName = $vlc->getCurrentName();
         } else {
             // try to find the name from the location (if any)
             $providerId = $controller->getRequest()->getParam('p', false);
             $location = $controller->getRequest()->getParam('l', false);
             if ($providerId && $location) {
                 $providerObj = X_VlcShares_Plugins::broker()->getPlugins($providerId);
                 $location = X_Env::decode($location);
                 if ($providerObj instanceof X_VlcShares_Plugins_ResolverInterface) {
                     $onAirName = $providerObj->resolveLocation($location);
                 }
             }
         }
         // show the title of the file
         $item = new X_Page_Item_PItem('streaminfo-onair', X_Env::_('p_streaminfo_onair') . ": {$onAirName}");
         $item->setType(X_Page_Item_PItem::TYPE_ELEMENT)->setLink(X_Env::completeUrl($urlHelper->url()));
         $return->append($item);
     }
     if ($engine instanceof X_Streamer_Engine_Vlc) {
         $vlc = $engine->getVlcWrapper();
         if ($this->config('show.time', false)) {
             $currentTime = X_Env::formatTime($vlc->getCurrentTime());
             $totalTime = X_Env::formatTime($vlc->getTotalTime());
             $item = new X_Page_Item_PItem('streaminfo-time', "{$currentTime}/{$totalTime}");
             $item->setType(X_Page_Item_PItem::TYPE_ELEMENT)->setLink(X_Env::completeUrl($urlHelper->url()));
             $return->append($item);
         }
     }
     return $return;
 }
Ejemplo n.º 29
0
 /**
  * Check the item in the collection should be filtered out
  * If return is false, the item will be discarded at 100%
  * If return is true, isn't sure that the item will be added
  * 'cause another plugin can prevent this
  * 
  * Plugins who check per-item acl or blacklist should hook here
  * 
  * @param X_Page_Item_PItem $item
  * @param string $provider
  * @param Zend_Controller_Action $controller
  * @return boolean true if item is ok, false if item should be discarded
  */
 public function filterShareItems(X_Page_Item_PItem $item, $provider, Zend_Controller_Action $controller)
 {
     $providerClass = X_VlcShares_Plugins::broker()->getPluginClass($provider);
     $providerObj = X_VlcShares_Plugins::broker()->getPlugins($provider);
     if (is_a($providerObj, 'X_VlcShares_Plugins_FileSystem')) {
         if ($item->getType() == X_Page_Item_PItem::TYPE_ELEMENT) {
             $itemLocation = $item->getCustom('X_VlcShares_Plugins_FileSystem:location');
             /* @var $urlHelper Zend_Controller_Action_Helper_Url */
             $urlHelper = $controller->getHelper('url');
             $path = $providerObj->resolveLocation($itemLocation);
             $thumb = new Application_Model_FsThumb();
             Application_Model_FsThumbsMapper::i()->fetchByPath($path, $thumb);
             if ($thumb->isNew()) {
                 $thumbUrl = X_Env::completeUrl($urlHelper->direct('thumb', 'fsthumbs', 'default', array('l' => X_Env::encode($itemLocation), 't' => 'dummy.jpg')));
             } else {
                 $thumbUrl = X_Env::completeUrl(Zend_Controller_Front::getInstance()->getBaseUrl() . $thumb->getUrl());
             }
             //$item->setDescription($itemLocation);
             $item->setThumbnail($thumbUrl);
         }
     }
     return true;
 }
 public function doAction(Zend_Controller_Action $action)
 {
     $action->getHelper('layout')->disableLayout();
     $request = $action->getRequest();
     $dropFolderId = $this->_getParam('drop_folder_id');
     $partnerId = $this->_getParam('new_partner_id');
     $dropFolderType = $this->_getParam('new_drop_folder_type');
     $dropFolderForm = null;
     $action->view->formValid = false;
     try {
         if ($request->isPost()) {
             $partnerId = $this->_getParam('partnerId');
             $dropFolderType = $this->_getParam('type');
             $dropFolderForm = new Form_DropFolderConfigure($partnerId, $dropFolderType);
             $action->view->formValid = $this->processForm($dropFolderForm, $request->getPost(), $dropFolderId);
         } else {
             if (!is_null($dropFolderId)) {
                 $client = Infra_ClientHelper::getClient();
                 $dropFolderPluginClient = Kaltura_Client_DropFolder_Plugin::get($client);
                 $dropFolder = $dropFolderPluginClient->dropFolder->get($dropFolderId);
                 $partnerId = $dropFolder->partnerId;
                 $dropFolderType = $dropFolder->type;
                 $dropFolderForm = new Form_DropFolderConfigure($partnerId, $dropFolderType);
                 $dropFolderForm->populateFromObject($dropFolder, false);
             } else {
                 $dropFolderForm = new Form_DropFolderConfigure($partnerId, $dropFolderType);
                 $dropFolderForm->getElement('partnerId')->setValue($partnerId);
             }
         }
     } catch (Exception $e) {
         $action->view->formValid = false;
         KalturaLog::err($e->getMessage() . "\n" . $e->getTraceAsString());
         $action->view->errMessage = $e->getMessage();
     }
     $action->view->form = $dropFolderForm;
 }