/**
     *
     */
    function editPlaylist($row, $pl_videos)
    {
    	global $mainframe, $Itemid, $smartyvs, $Itemid;
        $c = hwd_vs_Config::get_instance();

		// load the menu name
		jimport( 'joomla.application.menu' );
		$menu   = &JMenu::getInstance('site');
		$mparams = &$menu->getParams($Itemid);
		$mparams_pt	= $mparams->get( 'page_title', '');

		jimport( 'joomla.document.document' );
		$doc = & JFactory::getDocument();

		$active = &$menu->getActive();

		if (!empty($mparams_pt)) {
			$metatitle = $mparams_pt;
		} else if (!empty($active->name)) {
			$metatitle = $active->name;
		} else {
			$metatitle = _HWDVIDS_META_DEFAULT;
		}

        // decode
        $meta_title = html_entity_decode($row->playlist_name);
        // set the page/meta title
        $doc->setTitle( $metatitle." - "._HWDVIDS_META_EPL." - ".$meta_title );
        $doc->setMetaData( 'title' , $metatitle." - "._HWDVIDS_META_EPL." - ".$meta_title );
		hwd_vs_tools::generateActiveLink(1);
		hwd_vs_javascript::confirmdelete();
		hwd_vs_tools::generateBreadcrumbs();

		$smartyvs->assign("playlist_name", stripslashes($row->playlist_name));
		$smartyvs->assign("playlist_description", stripslashes($row->playlist_description));
		$smartyvs->assign("playlist_id", $row->id);

		if (count($pl_videos) > 0) {
			$smartyvs->assign("print_pl_videos", 1);

			for ($i=0, $n=count($pl_videos); $i < $n; $i++) {
				$row = $pl_videos[$i];

				$pl_video_list[$i]->thumbnail_url = hwd_vs_tools::generateThumbnailURL( $row->id, $row->video_id, $row->video_type, $row->thumbnail );
				$pl_video_list[$i]->title = hwd_vs_tools::truncateText(strip_tags(stripslashes($row->title)), $c->truntitle);
				$pl_video_list[$i]->vid = $row->id;
				$pl_video_list[$i]->counter = $i+1;

			}

			$smartyvs->assign("pl_video_list", $pl_video_list);
		}

		$smartyvs->assign("form_edit_playlist", JURI::root(true)."/index.php?option=com_hwdvideoshare&task=updatePlaylist");

		$smartyvs->display('playlist_edit.tpl');
		return;
    }
Beispiel #2
0
    /**
     * Make xml playlist datafile
     *
     * @return       True
     */
    function XMLDataFile($rows, $filename)
    {
		$db =& JFactory::getDBO();
		$c = hwd_vs_Config::get_instance();
    	jimport('joomla.filesystem.file');

		$config = null;
		$config .= "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
		$config .= "<playlist version=\"1\">\n";
		$config .= "<title>hwdVideoShare ".$filename." Playlist</title>\n";
		$config .= "<info>http:/xspf.org/xspf-v1.html</info>\n";
		$config .= "<date>".date('Y-m-d H:i:s')."</date>\n";
		$config .= "<trackList>\n";
		$config .= "\n";

		for ($i=0, $n=count($rows); $i < $n; $i++)
		{
			$row = $rows[$i];

			$row->title = hwdEncoding::charset_decode_utf_8($row->title);
			$row->title = hwdEncoding::XMLEntities($row->title);

			$row->description = hwdEncoding::charset_decode_utf_8($row->description);
			$row->description = hwdEncoding::XMLEntities($row->description);
			$row->description = hwd_vs_tools::truncateText($row->description, 1000);

			$video_code = explode(",", $row->video_id);
			if (empty($video_code[1]))
			{
				$row->video_id = hwdEncoding::XMLEntities($row->video_id);
			}
			else
			{
				$video_code[0] = hwdEncoding::XMLEntities($video_code[0]);
				$video_code[1] = urlencode($video_code[1]);
				$row->video_id = implode(",", $video_code);
			}

			if (empty($row->video_length))
			{
				$row->video_length = "0:00:00";
			}
			if (!isset($row->username) || empty($row->username))
			{
				$row->username = "******";
			}
			if (!isset($row->name) || empty($row->name))
			{
				$row->name = "_HWDVIDS_INFO_GUEST";
			}
			if ($row->user_id == 0 || !isset($row->username) || !isset($row->name))
			{
				$row->username = "******";
				$row->name = "_HWDVIDS_INFO_GUEST";
			}

			$config .= "  <track>\n";
			$config .= "    <id><![CDATA[".$row->id."]]></id>\n";
			$config .= "    <videotitle><![CDATA[".$row->title."]]></videotitle>\n";
			$config .= "    <videocode><![CDATA[".$row->video_id."]]></videocode>\n";
			$config .= "    <videotype><![CDATA[".$row->video_type."]]></videotype>\n";
			$config .= "    <thumbnail><![CDATA[".$row->thumbnail."]]></thumbnail>\n";
			$config .= "    <category><![CDATA[]]></category>\n";
			$config .= "    <category_id><![CDATA[".$row->category_id."]]></category_id>\n";
			$config .= "    <description><![CDATA[".$row->description."]]></description>\n";
			$config .= "    <views><![CDATA[".$row->number_of_views."]]></views>\n";
			$config .= "    <date><![CDATA[".$row->date_uploaded."]]></date>\n";
			$config .= "    <duration><![CDATA[".$row->video_length."]]></duration>\n";
			$config .= "    <rating><![CDATA[".$row->updated_rating."]]></rating>\n";
			if ($c->userdisplay == 1) {
				$config .= "    <uploader><![CDATA[".$row->username."]]></uploader>\n";
			} else {
				$config .= "    <uploader><![CDATA[".$row->name."]]></uploader>\n";
			}
			$config .= "    <uploader_id><![CDATA[".$row->user_id."]]></uploader_id>\n";
			if ($c->cbint !== "0" && !empty($row->avatar)) {
				$avatar = $row->avatar;
			} else {
				$avatar = "";
			}
			$config .= "    <avatar><![CDATA[".$avatar."]]></avatar>\n";
			$config .= "    <comments><![CDATA[".$row->number_of_comments."]]></comments>\n";
			$config .= "    <tags><![CDATA[".addslashes($row->tags)."]]></tags>\n";
			$config .= "  </track>\n";
			$config .= "\n";
		}
		$config .= "</trackList>\n";
		$config .= "</playlist>\n";

		$configFile = JPATH_SITE.DS.'components'.DS.'com_hwdvideoshare'.DS.'xml'.DS.$filename.'.xml';
		if (!JFile::write($configFile, $config)) {
			return false;
		}

		return true;
    }
    /**
     * Generates the human readable allowed video formats string
     *
     * @return       $code
     */
	function generateVideoDetails($row, $player_width=null, $player_height=null, $thumb_width=null, $hwdvsItemid=null, $tooltip=null, $lightbox=null, $autoplay=null)
	{
		global $hwdvsItemid, $option, $mainframe, $smartyvs;
		$c = hwd_vs_Config::get_instance();
		$my = & JFactory::getUser();

		if (!isset($row->username)) { $row->username = ""; }
		if (!isset($row->name)) { $row->name = ""; }
		if (!isset($row->avatar)) { $row->avatar = null; }
		if ($c->cbint == 3) { $row->avatar = $row->username; }

		$quality = JRequest::getWord( 'quality', '' );
		if (empty($quality))
		{
			if ($c->usehq == "1" || $c->usehq == "3")
			{
				$quality = "hd";
			}
			else if ($c->usehq == "0" || $c->usehq == "2")
			{
				$quality = "sd";
			}
		}

		$details->id = intval($row->id);
		$details->titleText = stripslashes($row->title);
		$details->title = hwd_vs_tools::generateVideoLink( $row->id, $row->title, $hwdvsItemid, null, 10000 );
		$details->player = hwd_vs_tools::generateVideoPlayer($row, $player_width, $player_height, $autoplay, $quality);
		$details->videourl = hwd_vs_tools::generateVideoUrl($row);
		$details->embedcode = hwd_vs_tools::generateEmbedCode($row);
		$details->socialbmlinks = hwd_vs_tools::generateSocialBookmarks();
		$details->duration = $row->video_length;
		$details->ratingsystem = hwd_vs_tools::generateRatingSystem($row);
		$details->favouritebutton = hwd_vs_tools::generateFavouriteButton($row);
		$details->thumbnail = hwd_vs_tools::generateVideoThumbnailLink($row->id, $row->video_id, $row->video_type, $row->thumbnail, 0, $thumb_width, null, null, null, $hwdvsItemid, null, $tooltip, $lightbox);
		$details->avatar = hwd_vs_tools::generateAvatar($row->user_id, $row->avatar, 0);
		$details->category = hwd_vs_tools::generateCategoryLink($row->category_id);
		$details->description_truncated = hwd_vs_tools::truncateText($row->description, $c->trunvdesc);
		$details->rating = hwd_vs_tools::generateRatingImg($row->updated_rating);
		$details->deletevideo = hwd_vs_tools::generateDeleteVideoLink($row);
		$details->editvideo = hwd_vs_tools::generateEditVideoLink($row);
		$details->publishvideo = hwd_vs_tools::generatePublishVideoLink($row);
		$details->approvevideo = hwd_vs_tools::generateApproveVideoLink($row);
		$details->views = intval($row->number_of_views);
		$details->upload_date = strftime("%l%P - %b %e, %Y", strtotime($row->date_uploaded));
		$details->sendToFriend = hwd_vs_tools::sendToFriend($row);
		$details->uploader = hwd_vs_tools::generateUserFromID($row->user_id, $row->username, $row->name);
		$details->k = 0;

		$details->addtogroup = hwd_vs_tools::generateAddToGroupButton($row);
		$details->nextprev = hwd_vs_tools::generateNextPrevLinks($row);
		$details->switchquality = hwd_vs_tools::generateSwitchQuality($row);
		$details->downloadoriginal = hwd_vs_tools::generateDownloadVideoLink($row);
		$details->vieworiginal = hwd_vs_tools::generateViewOriginalLink($row);
		$details->reportmedia = hwd_vs_tools::generateReportMediaButton($row);
		$details->tags = hwd_vs_tools::generateTagListString($row->tags);
		$details->favourties = hwd_vs_tools::generateFavouriteButton($row);
		$details->addtoplaylist = hwd_vs_tools::generateAddToPlaylistButton($row);

		if ($option == "com_hwdvideoshare")
		{
			$details->comments = hwd_vs_tools::generateVideoComments($row);
		}

		if ($c->showdesc == "1")
		{
			$smartyvs->assign("print_description", 1);
			$details->description = stripslashes($row->description);

			//$item                 = JTable::getInstance('content');
			//$dispatcher           = JDispatcher::getInstance();
			//$params               = new JParameter('');
			//JPluginHelper::importPlugin('content');
			//$item->parameters     = new JParameter('');
			//$item->text           = $details->description;
			//// Apply content plugins to custom text
			//$results              = $dispatcher->trigger('onPrepareContent', array ($item, $params, 0));
			//$details->description = $item->text;
		}
		return $details;
    }