コード例 #1
0
    /**
     * Outputs frontpage HTML
     *
     * @param string $option  the joomla component name
     * @param array  $rows  array of video data
     * @param array  $rowsfeatured  array of featured video data
     * @param object $pageNav  page navigation object
     * @param int    $total  the total video count
     * @return       Nothing
     */
	function initiate($override) {

		global $mainframe;

		// set cache variables
		$cachedir = JPATH_SITE.'/administrator/cache/'; // Directory to cache files in (keep outside web root)
		$cachetime = 86400; // Seconds to cache files for
		$cacheext = 'cache'; // Extension to give cached files (usually cache, htm, txt)
		$page = 'http://recountfile'; // Requested page
		$cachefile = $cachedir . md5($page) . '.' . $cacheext; // Cache file to either load or create

		$cachefile_created = (@file_exists($cachefile)) ? @filemtime($cachefile) : 0;
		@clearstatcache();

		if ($override == 2) {
			// Show file from cache if still valid
			if (time() - $cachetime < $cachefile_created) {
				$mainframe->enqueueMessage(_HWDVIDS_M_COUNT_RUN);
				return;
			}
		}

		// Now the script has run, generate a new cache file
		$fp = @fopen($cachefile, 'w');

		// save the contents of output buffer to the file
		@fwrite($fp, ob_get_contents());
		@fclose($fp);

		hwd_vs_recount::recountVideosInCategory();
		hwd_vs_recount::recountSubcatsInCategory();
		hwd_vs_recount::recountMembersInGroup();
		hwd_vs_recount::recountVideosInGroup();
		hwd_vs_recount::recountVideoViews();
		hwd_vs_recount::recountRatings();
		hwd_vs_recount::recountNumberOfComments();

		return true;
	}
コード例 #2
0
ファイル: usrfunc.php プロジェクト: rkern21/videoeditor
   /**
    * Save editted video details
    */
	function saveVideoInfo()
	{
		global $Itemid, $mainframe;
		$db = & JFactory::getDBO();
		$my = & JFactory::getUser();
		$c = hwd_vs_Config::get_instance();
		$app = & JFactory::getApplication();

		$row = new hwdvids_video($db);

		$uid = JRequest::getInt( 'owner', 0, 'post' );
		$rowid = JRequest::getInt( 'id', 0, 'post' );
		$referrer = JRequest::getVar( 'referrer', JURI::root( true ) . '/index.php?option=com_hwdvideoshare&Itemid='.$Itemid );

		// check component access settings and deny those without privileges
		if (!hwd_vs_access::allowAccess( $c->gtree_mdrt, $c->gtree_mdrt_child, hwd_vs_access::userGID( $my->id ))) {
			if ($my->id == $uid) {
				if ($my->id == "0") {
					$app->enqueueMessage(_HWDVIDS_ALERT_NOPERM);
					$app->redirect( $referrer );
				}
				if ($c->allowvidedit == "0") {
					$app->enqueueMessage(_HWDVIDS_ALERT_NOPERM);
					$app->redirect( $referrer );
				}
				// continue
			} else {
				$app->enqueueMessage(_HWDVIDS_ALERT_NOPERM);
				$app->redirect( $referrer );
			}
		}

		$row->load( $rowid );
		$old_category = $row->category_id;

		$file_name_org   = $_FILES['thumbnail_file']['name'];
		$file_ext        = substr($file_name_org, strrpos($file_name_org, '.') + 1);

		$thumbnail = '';
		if ($_FILES['thumbnail_file']['tmp_name'] !== "") {

			if ($row->video_type == "local" || $row->video_type == "swf" || $row->video_type == "mp4")
			{
				$videocode = $row->video_id;
				$thumbnail = $file_ext;
			}
			else
			{
				$videocode = "tp-".$row->id;
				$thumbnail = "tp-".$row->id.".".$file_ext;
			}

			$base_Dir = JPATH_SITE.DS.'hwdvideos'.DS.'thumbs'.DS;
			$upload_result = hwd_vs_tools::uploadFile("thumbnail_file", $videocode, $base_Dir, 2, "jpg,jpeg", 1);

			if ($upload_result[0] == "0")
			{
				$msg = $upload_result[1];
				$app->enqueueMessage($msg);
				$app->redirect( JURI::root( true ) . '/index.php?option=com_hwdvideoshare&Itemid='.$Itemid.'&task=editvideo&video_id='.$row->id );
			}
			else
			{
				require_once(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_hwdvideoshare'.DS.'libraries'.DS.'thumbnail.inc.php');

				$thumb_path_s = JPATH_SITE.DS.'hwdvideos'.DS.'thumbs'.DS.$videocode.'.'.$file_ext;
				$thumb_path_l = JPATH_SITE.DS.'hwdvideos'.DS.'thumbs'.DS.'l_'.$videocode.'.'.$file_ext;

				$twidth_s = round($c->con_thumb_n);
				$theight_s = round($c->con_thumb_n*$c->tar_fb);
				$twidth_l = round($c->con_thumb_l);
				$theight_l = round($c->con_thumb_l*$c->tar_fb);

				list($width, $height, $type, $attr) = @getimagesize($thumb_path_s);
				$ratio = $width/$height;

				//echo $thumb_path_s."<br />".$ratio."<br />".$width."<br />".$height."<br />".$c->tar_fb."<br />".$twidth_s."<br />".$theight_s;

				if ($ratio > 1)
				{
					$resized_l = new Thumbnail($thumb_path_s);
					$resized_l->resize($twidth_l,$twidth_l);
					$resized_l->cropFromCenter($twidth_l, $theight_l);
					$resized_l->save($thumb_path_l);
					$resized_l->destruct();

					$resized_s = new Thumbnail($thumb_path_s);
					$resized_s->resize($twidth_s,$twidth_s);
					$resized_s->cropFromCenter($twidth_s, $theight_s);
					$resized_s->save($thumb_path_s);
					$resized_s->destruct();
				}
				else
				{
					$resized_l = new Thumbnail($thumb_path_s);
					$resized_l->resize($twidth_l,2000);
					$resized_l->cropFromCenter($twidth_l, $theight_l);
					$resized_l->save($thumb_path_l);
					$resized_l->destruct();

					$resized_s = new Thumbnail($thumb_path_s);
					$resized_s->resize($twidth_s,1000);
					$resized_s->cropFromCenter($twidth_s, $theight_s);
					$resized_s->save($thumb_path_s);
					$resized_s->destruct();
				}
			}
		}
		else
		{
			//echo "No thumbnail uploaded";
		}

		$title = hwd_vs_tools::generatePostTitle();
		$description = hwd_vs_tools::generatePostDescription();
		$tags = hwd_vs_tools::generatePostTags();

		$password = Jrequest::getVar( 'hwdvspassword', '' );
		if (!empty($password))
		{
			$password = md5($password);
			$_POST['password'] 		= $password;
		}

		$_POST['id'] 				= $rowid;
		$_POST['title'] 			= $title;
		$_POST['description'] 		= $description;
		$_POST['category_id'] 		= JRequest::getInt( 'category_id', 0 );
		$_POST['tags'] 				= $tags;
		if (!empty($thumbnail))
		{
			$_POST['thumbnail'] 	= $thumbnail;
		}

		// bind it to the table
		if (!$row->bind($_POST))
		{
			echo "<script type=\"text/javascript\">alert('".$row->getError()."');window.history.go(-1);</script>\n";
			exit();
		}

		// Make sure the record is valid
   		if (!$row->check())
   		{
        	$this->setError($this->_db->getErrorMsg());
			echo "<script type=\"text/javascript\">alert('".$row->getError()."');window.history.go(-1);</script>\n";
			exit();
    	}

		// store it in the db
		if (!$row->store())
		{
			echo "<script type=\"text/javascript\">alert('".$row->getError()."');window.history.go(-1);</script>\n";
			exit();
		}

		require_once(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_hwdvideoshare'.DS.'libraries'.DS.'maintenance_recount.class.php');
		hwd_vs_recount::recountVideosInCategory($row->category_id);
		hwd_vs_recount::recountVideosInCategory($old_category_id);

		$msg = _HWDVIDS_ALERT_VIDEDITSAVED;
		$app->enqueueMessage($msg);
		$app->redirect( $referrer );
	}
コード例 #3
0
ファイル: imports.php プロジェクト: rkern21/videoeditor
   /**
	* Import Data
	*/
	function rtmpupload()
	{
		global $Itemid, $option;
		$db = & JFactory::getDBO();
		$my = & JFactory::getUser();
		$app = & JFactory::getApplication();

		$rtmpurl = Jrequest::getVar( 'rtmpurl', '' );
		$validated_rtmpurl = hwd_vs_tools::validateUrl($rtmpurl);

		if (empty($validated_rtmpurl))
		{
			$msg = _HWDVIDS_ALERT_VURLWRONG;
			$app->enqueueMessage($msg);
			$app->redirect( JURI::root( true ) . '/administrator/index.php?option=com_hwdvideoshare&task=import' );
		}

		$thumbnailurl = Jrequest::getVar( 'thumbnailurl', '' );
		$validated_thumbnail_url = hwd_vs_tools::validateUrl($thumbnailurl);

		if (!empty($validated_thumbnail_url) && !hwd_vs_tools::is_valid_url($validated_thumbnail_url))
		{
			$app->enqueueMessage(_HWDVIDS_ALERT_TURLWRONG);
			$app->redirect( JURI::root( true ) . '/administrator/index.php?option=com_hwdvideoshare&task=import' );
		}

		$type  		        = Jrequest::getVar( 'type', 'rtmp' );
		$video_id 		    = $validated_rtmpurl;
		$title 				= Jrequest::getVar( 'title', 'no name supplied' );
		$description 		= Jrequest::getVar( 'description', 'no name supplied' );
		$category_id 		= JRequest::getInt( 'category_id', 0, 'post' );
		$tags 				= Jrequest::getVar( 'tags', 'no name supplied' );
		$duration			= Jrequest::getVar( 'duration', 'no name supplied' );
		$public_private 	= JRequest::getWord( 'public_private' );
		$allow_comments 	= JRequest::getInt( 'allow_comments', 0, 'post' );
		$allow_embedding 	= JRequest::getInt( 'allow_embedding', 0, 'post' );
		$allow_ratings 		= JRequest::getInt( 'allow_ratings', 0, 'post' );

		$checkform = hwd_vs_tools::checkFormComplete($title, $description, $category_id, $tags, $public_private, $allow_comments, $allow_embedding, $allow_ratings);
		if (!$checkform) { return; }

		$row = new hwdvids_video($db);

		$db->SetQuery('SELECT count(*) FROM #__hwdvidsvideos WHERE video_id = "'.$video_id.'"');
		$duplicatecount = $db->loadResult();
		if ($duplicatecount > 0)
		{
			echo "<script>alert('"._HWDVIDS_ALERT_DUPLICATE."'); window.history.go(-1);</script>\n";
			return;
		}

		if ($type == "smil")
		{
			$_POST['video_type'] 		= "smil";
		}
		else
		{
			$_POST['video_type'] 		= "rtmp";
		}
		$_POST['video_id'] 			= $video_id;
		$_POST['title'] 			= $title;
		$_POST['description'] 		= $description;
		$_POST['category_id'] 		= $category_id;
		$_POST['tags'] 				= $tags;
		$_POST['video_length'] 		= $duration;
		$_POST['public_private'] 	= $public_private;
		$_POST['allow_comments'] 	= $allow_comments;
		$_POST['allow_embedding'] 	= $allow_embedding;
		$_POST['allow_ratings'] 	= $allow_ratings;
		$_POST['date_uploaded'] 	= date('Y-m-d H:i:s');
		$_POST['user_id'] 			= $my->id;
		$_POST['published'] 		= "0";
		$_POST['approved'] 			= "yes";
		$_POST['thumbnail'] 		= $thumbnailurl;

		if(empty($_POST['video_id'])) {
			$app->enqueueMessage(_HWDVIDS_ALERT_ERRREM);
			$app->redirect( JURI::root( true ) . '/administrator/index.php?option='. $option .'&task=import');
			return;
		}

		// bind it to the table
		if (!$row->bind($_POST))
		{
			echo "<script type=\"text/javascript\">alert('".$row->getError()."');window.history.go(-1);</script>\n";
			exit();
		}

		// store it in the db
		if (!$row->store())
		{
			echo "<script type=\"text/javascript\">alert('".$row->getError()."');window.history.go(-1);</script>\n";
			exit();
		}

		// perform maintenance
		include(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_hwdvideoshare'.DS.'libraries'.DS.'maintenance_recount.class.php');
		hwd_vs_recount::recountVideosInCategory($row->category_id);

		include_once(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_hwdvideoshare'.DS.'helpers'.DS.'events.php');

		$params->title = $title;
		$params->id = $row->id;
		$params->category_id = $row->category_id;
		$params->type = $row->video_type;

		hwdvsEvent::onAfterVideoUpload($params);

		$app->enqueueMessage(_HWDVIDS_ALERT_SUCREM);
		$app->redirect( JURI::root( true ) . '/administrator/index.php?option='. $option .'&task=editvidsA&hidemainmenu=1&cid='.$row->id );

	}
コード例 #4
0
ファイル: categories.php プロジェクト: rkern21/videoeditor
	/**
	 * save categories
	 */
	function savecategories()
	{
		global $option;
		$db = & JFactory::getDBO();
		$app = & JFactory::getApplication();
		$c = hwd_vs_Config::get_instance();

		$access_lev_u = Jrequest::getVar( 'access_lev_u', '0' );
		$access_lev_v = Jrequest::getVar( 'access_lev_v', '0' );

		$row = new hwdvids_cats($db);

		if (isset($_FILES['thumbnail_file']['error'])) {

			$file_name_org   = $_FILES['thumbnail_file']['name'];
			$file_ext        = substr($file_name_org, strrpos($file_name_org, '.') + 1);

			$thumbnail_url = JURI::root( true ).'/hwdvideos/thumbs/category'.$_POST['id'].'.'.$file_ext;
			$base_Dir = JPATH_SITE.DS.'hwdvideos'.DS.'thumbs'.DS;
			$thumbnail_name = 'category'.$_POST['id'];

			$upload_result = hwd_vs_tools::uploadFile("thumbnail_file", $thumbnail_name, $base_Dir, 2, "jpg,jpeg", 1);

			if ($upload_result[0] == "0") {

				$msg = $upload_result[1];
				$app->enqueueMessage($msg);

			} else {

				include_once(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_hwdvideoshare'.DS.'libraries'.DS.'thumbnail.inc.php');
				$thumb_path_s = JPATH_SITE.DS.'hwdvideos'.DS.'thumbs'.DS.$thumbnail_name.'.'.$file_ext;
				$twidth_s = round($c->con_thumb_n);
				$theight_s = round($c->con_thumb_n*$c->tar_fb);

				list($width, $height, $type, $attr) = @getimagesize($thumb_path_s);
				$ratio = $height/$width;

				if ($ratio < $c->tar_fb) {

					$resized_s = new Thumbnail($thumb_path_s);
					$resized_s->resize(1000, $theight_s);
					$resized_s->cropFromCenter($twidth_s, $theight_s);
					$resized_s->save($thumb_path_s);
					$resized_s->destruct();

				} else {

					$resized_s = new Thumbnail($thumb_path_s);
					$resized_s->resize($twidth_s,1000);
					$resized_s->cropFromCenter($twidth_s, $theight_s);
					$resized_s->save($thumb_path_s);
					$resized_s->destruct();

				}
			}

			// update db with new thumbnail
			$db->SetQuery("UPDATE #__hwdvidscategories SET thumbnail = '$thumbnail_url' WHERE id = ".intval($_POST['id']));
			$db->Query();
			if ( !$db->query() ) {
				echo "<script> alert('".$db->getErrorMsg()."'); window.history.go(-1); </script>\n";
				exit();
			}

			$msg = "Thumbnail was successfully uploaded";
			$app->enqueueMessage($msg);
			$app->redirect( 'index.php?option=com_hwdvideoshare&Itemid='.$Itemid.'&task=editcatA&hidemainmenu=1&cid='.$_POST['id'] );

		} else {

			if (intval($_POST['id']) !== 0 && (intval($_POST['id']) == intval($_POST['parent']))) {
				$app->enqueueMessage(_HWDVIDS_ALERT_PARENTNOTSELF);
				$app->redirect( JURI::root( true ) . '/administrator/index.php?option='.$option.'&task=categories' );
			}

			$_POST['category_name'] = Jrequest::getVar( 'category_name', 'no name supplied' );
			$_POST['category_description'] = Jrequest::getVar( 'category_description', 'no name supplied' );
			$_POST['access_lev_u'] = @implode(",", $access_lev_u);
			$_POST['access_lev_v'] = @implode(",", $access_lev_v);

		}

		// bind it to the table
		if (!$row -> bind($_POST)) {
			echo "<script> alert('"
				.$row -> getError()
				."'); window.history.go(-1); </script>\n";
			exit();
		}

		if(empty($row->category_name)) {
			$app->enqueueMessage(_HWDVIDS_NOTITLE);
			$app->redirect( JURI::root( true ) . '/administrator/index.php?option='.$option.'&task=categories' );
		}

		// store it in the db
		if (!$row -> store()) {
			echo "<script> alert('"
				.$row -> getError()
				."'); window.history.go(-1); </script>\n";
			exit();
		}

		$row->checkin();

		// perform maintenance
		include(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_hwdvideoshare'.DS.'libraries'.DS.'maintenance_recount.class.php');
		hwd_vs_recount::recountSubcatsInCategory();

		$app->enqueueMessage(_HWDVIDS_ALERT_CATSAVED);
		$app->redirect( JURI::root( true ) . '/administrator/index.php?option='.$option.'&task=categories' );
	}
コード例 #5
0
ファイル: standardsuite.php プロジェクト: rkern21/videoeditor
    /**
     * Outputs frontpage HTML
     *
     * @return       Nothing
     */
    function addVideoToGroup()
	{
	global $database, $my, $acl, $mosConfig_absolute_path, $mosConfig_mailfrom, $mosConfig_fromname, $mosConfig_live_site, $Itemid, $mosConfig_sitename;
		$db = & JFactory::getDBO();
		$c = hwd_vs_Config::get_instance();
		$url = $db->getEscaped( strip_tags( trim( strtolower( mosGetParam( $_POST, 'url' ) ) ) ) );

		if (!$my->id) {
			hwd_vs_tools::infomessage(1, 0, _HWDVIDS_TITLE_UPLDFAIL, _HWDVIDS_ALERT_LOG2AV2G, "exclamation.png", 1);
			return;
		}

		$userid = $my->id;
		$videoid = intval ( mosGetParam($_POST, 'videoid') );
		$groupid = intval ( mosGetParam($_POST, 'groupid') );
		$date = date('Y-m-d H:i:s');
		$published = 1;

		if ($groupid == 0) {
			hwd_vs_tools::infomessage(1, 0, _HWDVIDS_TITLE_UPLDFAIL, _HWDVIDS_ALERTSELGROUP, "exclamation.png", 1);
			return;
		}

		$where = ' WHERE a.videoid = '.$videoid;
		$where .= ' AND a.groupid = '.$groupid;

		$db->SetQuery( 'SELECT count(*)'
							. ' FROM #__hwdvidsgroup_videos AS a'
							. $where
							);
  		$total = $db->loadResult();

		if ( $total>0 ) {
			hwd_vs_tools::infomessage(1, 0, _HWDVIDS_TITLE_UPLDFAIL, _HWDVIDS_ALERT_ALREADYAV2G, "exclamation.png", 1);
			return;
		}

		$row = new hwdvids_groupvideo($database);

		$_POST['videoid'] = $videoid;
		$_POST['groupid'] = $groupid;
		$_POST['memberid'] = $userid;
		$_POST['date'] = $date;

		// bind it to the table
		if (!$row -> bind($_POST)) {
			echo "<script> alert('"
				.$row -> getError()
				."'); window.history.go(-1); </script>\n";
			exit();
		}

		// store it in the db
		if (!$row -> store()) {
			echo "<script> alert('"
				.$row -> getError()
				."'); window.history.go(-1); </script>\n";
			exit();
		}

		// perform maintenance
		require_once(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_hwdvideoshare'.DS.'libraries'.DS.'maintenance_recount.class.php');
		hwd_vs_recount::recountVideosInGroup($groupid);

		hwd_vs_tools::infomessage(1, 0, _HWDVIDS_TITLE_UPLDFAIL, _HWDVIDS_ALERT_SUCAV2G, "exclamation.png", 1);
		return;
	}
コード例 #6
0
ファイル: maintenance.php プロジェクト: rkern21/videoeditor
   /**
	* system cleanup
	*/
	function runmaintenance()
	{
		global $limit, $limitstart;
  		$db =& JFactory::getDBO();

		$run_permdel = JRequest::getInt( 'run_permdel', 0 );
		$run_fixerrors = JRequest::getInt( 'run_fixerrors', 0 );
		$run_recount = JRequest::getInt( 'run_recount', 0 );
		$run_archivelogs = JRequest::getInt( 'run_archivelogs', 0 );

		$permdelete_report = null;
		$fixerrors_report = null;
		$recount_report = null;
		$archivelogs_report = null;

		if ($run_permdel == 1) {
			// permenantly delete
			$query = "SELECT a.*"
					. "\nFROM #__hwdvidsvideos AS a"
					. "\nWHERE a.approved = \"deleted\""
								;
			$db->SetQuery( $query );
			$rows = $db->loadObjectList();

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

				$files   = array();
				$files[] = JPATH_SITE."/hwdvideos/uploads/".$row->video_id.".flv";
				$files[] = JPATH_SITE."/hwdvideos/uploads/".$row->video_id.".mp4";
				$files[] = JPATH_SITE."/hwdvideos/thumbs/".$row->video_id.".jpg";
				$files[] = JPATH_SITE."/hwdvideos/thumbs/".$row->video_id.".gif";
				$files[] = JPATH_SITE."/hwdvideos/thumbs/l_".$row->video_id.".jpg";

				for($j=0, $m=count( $files ); $j < $m; $j++)
				{
					$file = &$files[$j];

					if (@file_exists($file))
					{
						@unlink($file);
					}
				}
			}

			$db->SetQuery("DELETE FROM #__hwdvidsvideos WHERE approved = \"deleted\"");
			$db->Query();
			if ( !$db->query() ) {
				echo "<script> alert('".$db->getErrorMsg()."'); window.history.go(-1); </script>\n";
				exit();
			}
			$permdelete_report = true;
		}

		if ($run_fixerrors !== 0) {
			// perform 'fix errors' maintenance
			require_once(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_hwdvideoshare'.DS.'libraries'.DS.'maintenance_fixerrors.class.php');
			$fixerrors_report = hwd_vs_fixerrors::initiate($run_fixerrors);
		}

		if ($run_recount !== 0) {
			// perform 'recount' maintenance
			require_once(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_hwdvideoshare'.DS.'libraries'.DS.'maintenance_recount.class.php');
			$recount_report = hwd_vs_recount::initiate($run_recount);
		}

		// set fixerror cache variables
		$cachedir = JPATH_SITE.'/administrator/cache/'; // Directory to cache files in (keep outside web root)
		$cacheext = 'cache'; // Extension to give cached files (usually cache, htm, txt)
		$page = 'http://fixerrorfile'; // Requested page
		$cachefile = $cachedir . md5($page) . '.' . $cacheext; // Cache file to either load or create
		$fixerror_cache = (@file_exists($cachefile)) ? @date ("F d Y H:i:s.", filemtime($cachefile)) : "Never";

		// set recount cache variables
		$cachedir = JPATH_SITE.'/administrator/cache/'; // Directory to cache files in (keep outside web root)
		$cacheext = 'cache'; // Extension to give cached files (usually cache, htm, txt)
		$page = 'http://recountfile'; // Requested page
		$cachefile = $cachedir . md5($page) . '.' . $cacheext; // Cache file to either load or create
		$recount_cache = (@file_exists($cachefile)) ? @date ("F d Y H:i:s.", filemtime($cachefile)) : "Never";

		// set archive cache variables
		$cachedir = JPATH_SITE.'/administrator/cache/'; // Directory to cache files in (keep outside web root)
		$cacheext = 'cache'; // Extension to give cached files (usually cache, htm, txt)
		$page = 'http://archivefile'; // Requested page
		$cachefile = $cachedir . md5($page) . '.' . $cacheext; // Cache file to either load or create
		$archive_cache = (@file_exists($cachefile)) ? @date ("F d Y H:i:s.", filemtime($cachefile)) : "Never";

		$db->SetQuery( "SELECT count(*)"
							. "\nFROM #__hwdvidsvideos AS a"
							. "\nWHERE a.approved = \"deleted\""
							);
		$total = $db->loadResult();
		echo $db->getErrorMsg();

		hwdvids_HTML::maintenance($permdelete_report, $total, $fixerrors_report, $recount_report, $archivelogs_report, $fixerror_cache, $recount_cache, $archive_cache);
	}
コード例 #7
0
ファイル: core.php プロジェクト: rkern21/videoeditor
    /**
     * Check video player access and cache settings and query SQL for video data
     *
     * @return       Nothing
     */
    function viewvideo()
    {
        global $hwdvs_joinv, $hwdvs_selectv, $smartyvs, $mainframe, $isModerator;
		$c = hwd_vs_Config::get_instance();
		$db = & JFactory::getDBO();
		$my = & JFactory::getUser();
		$acl= & JFactory::getACL();
		$usersConfig = &JComponentHelper::getParams( 'com_users' );

		// check component access settings and deny those without privileges
		if (!hwd_vs_access::allowAccess( $c->gtree_plyr, $c->gtree_plyr_child, hwd_vs_access::userGID( $my->id ))) {
			if ( ($my->id < 1) && (!$usersConfig->get( 'allowUserRegistration' ) == '0' && hwd_vs_access::allowAccess( $c->gtree_upld, 'RECURSE', $acl->get_group_id('Registered','ARO') ) ) ) {
				$smartyvs->assign("showconnectionbox", 1);
				hwd_vs_tools::infomessage(1, 0, _HWDVIDS_TITLE_NOACCESS, _HWDVIDS_ALERT_REGISTERFORPLYR, "exclamation.png", 1);
				return;
			} else {
				$smartyvs->assign("showconnectionbox", 1);
				hwd_vs_tools::infomessage(1, 0, _HWDVIDS_TITLE_NOACCESS, _HWDVIDS_ALERT_PLYR_NOT_AUTHORIZED, "exclamation.png", 1);
				return;
			}
		}

        // get video id from POST array
        $video_id = JRequest::getInt( 'video_id', 0 );

        // check video can be viewed by user
        $where = ' WHERE video.id = '.$video_id;

        $query = 'SELECT'.$hwdvs_selectv
                . ' FROM #__hwdvidsvideos AS video'
                . $hwdvs_joinv
                . $where
                . ' ORDER BY video.date_uploaded DESC'
                ;
        $db->SetQuery($query);
        $row = $db->loadObject();

		if (!hwd_vs_tools::validateVideoAccess($row))
		{
			return;
		}

        // get view count
        hwd_vs_tools::logViewing($video_id);
        require_once(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_hwdvideoshare'.DS.'libraries'.DS.'maintenance_recount.class.php');
        hwd_vs_recount::recountVideoViews($video_id);

		// get more videos from user
		if ($c->showuldr == "1") {
			$query = 'SELECT'.$hwdvs_selectv
                    . ' FROM #__hwdvidsvideos AS video'
                    . $hwdvs_joinv
					. ' WHERE video.user_id = '.$row->user_id
					. ' AND video.published = 1'
					. ' AND video.approved = "yes"'
					. ' AND video.id <> '.$row->id
					. ' ORDER BY video.date_uploaded DESC'
					. ' LIMIT 0, '.$c->mbtu_no
					;
			$db->SetQuery($query);
			$userrows = $db->loadObjectList();
		} else {
			$userrows = null;
		}

		// get related videos
		if ($c->showrevi == "1")
		{
			$searchterm = addslashes($row->title." ".$row->description." ".$row->tags);

			require_once(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_hwdvideoshare'.DS.'helpers'.DS.'search.php');
        	$whereVideos = hwd_vs_search::search_perform_videos("related",$searchterm);

			// get matching video data
			$query = 'SELECT'.$hwdvs_selectv
                    . ' FROM #__hwdvidsvideos AS video'
                    . $hwdvs_joinv
					. $whereVideos
					. ' AND video.published = 1'
					. ' AND video.approved = "yes"'
					. ' AND video.id <> '.$row->id
					//. ' ORDER BY video.date_uploaded DESC'
					. ' LIMIT 0, '.$c->revi_no
					;

			$db->SetQuery($query);
			$relatedrows = $db->loadObjectList();
		} else {
			$relatedrows = null;
		}

		// get more from category
		if ( $c->cvordering == "orderASC" ) {
			$order = ' ORDER BY video.ordering ASC';
		} else if ( $c->cvordering == "orderDESC" ) {
			$order = ' ORDER BY video.ordering DESC';
		} else if ( $c->cvordering == "dateASC" ) {
			$order = ' ORDER BY video.date_uploaded ASC';
		} else if ( $c->cvordering == "dateDESC" ) {
			$order = ' ORDER BY video.date_uploaded DESC';
		} else if ( $c->cvordering == "nameASC" ) {
			$order = ' ORDER BY video.title ASC';
		} else if ( $c->cvordering == "nameDESC" ) {
			$order = ' ORDER BY video.title DESC';
		} else if ( $c->cvordering == "hitsASC" ) {
			$order = ' ORDER BY video.number_of_views ASC';
		} else if ( $c->cvordering == "hitsDESC" ) {
			$order = ' ORDER BY video.number_of_views DESC';
		} else if ( $c->cvordering == "voteASC" ) {
			$order = ' ORDER BY video.updated_rating ASC';
		} else if ( $c->cvordering == "voteDESC" ) {
			$order = ' ORDER BY video.updated_rating DESC';
		} else {
			$order = ' ORDER BY video.date_uploaded DESC';
		}

		if ($c->showmftc == "1") {
			$query = 'SELECT'.$hwdvs_selectv
                    . ' FROM #__hwdvidsvideos AS video'
                    . $hwdvs_joinv
					. ' WHERE video.category_id = '.$row->category_id
					. ' AND video.published = 1'
					. ' AND video.approved = "yes"'
					. ' AND video.id <> '.$row->id
					. $order
					. ' LIMIT 0, '.$c->mftc_no
					;
			$db->SetQuery($query);
			$categoryrows = $db->loadObjectList();
		} else {
			$categoryrows = null;
		}

        // send out
        hwd_vs_html::viewVideo($row, $userrows, $relatedrows, $categoryrows);
    }
コード例 #8
0
ファイル: videos.php プロジェクト: rkern21/videoeditor
   /**
	* edit videos
	*/
	function updateVideoSource()
	{
		global $option;
  		$db =& JFactory::getDBO();
		$my = & JFactory::getUser();
		$app = & JFactory::getApplication();
		$c = hwd_vs_Config::get_instance();

		$video_type	= Jrequest::getVar( 'videotype', '0' );
		$video_id	= Jrequest::getVar( 'id', '0' );
		$updatedetails	= Jrequest::getVar( 'updatedetails', '0' );

		$admin_import = true;
		require_once(JPATH_SITE.DS.'components'.DS.'com_hwdvideoshare'.DS.'models'.DS.'uploads.php');

		$row = new hwdvids_video($db);
		$row->load( $video_id );

		if ($video_type == 1)
		{
			$requestarray = JRequest::get( 'default', 2 );
			$embeddump = $requestarray['embeddump'];
			$remote_verified = null;

			$parsedurl = parse_url($embeddump);
			if (empty($parsedurl['host'])) { $parsedurl['host'] = ''; }
			preg_match('/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.[a-z\.]{2,6})$/i', $parsedurl['host'], $regs);
			if (empty($regs['domain'])) { $regs['domain'] = ''; }

			if ($regs['domain'] == 'youtube.com' && file_exists(JPATH_SITE.'/plugins/hwdvs-thirdparty/youtube.php')) {
				require_once(JPATH_SITE.'/plugins/hwdvs-thirdparty/youtube.php');
			} else if ($regs['domain'] == 'google.com' && file_exists(JPATH_SITE.'/plugins/hwdvs-thirdparty/google.php')) {
				require_once(JPATH_SITE.'/plugins/hwdvs-thirdparty/google.php');
			} else if (file_exists(JPATH_SITE.'/plugins/hwdvs-thirdparty/'.$regs['domain'].'.php')) {
				require_once(JPATH_SITE.'/plugins/hwdvs-thirdparty/'.$regs['domain'].'.php');
			} else {

				$pos_flv = strpos($embeddump, ".flv");

				if ($pos_flv === false) {
					$remote_verified = 0;
				} else {
					$pos_flv = $pos_flv+4;
					$datadump = substr($embeddump, 0, $pos_flv);
					$pos_http = mb_strrpos($datadump, "http://");
					if ($pos_http === false) {
						$error_msg = _HWDVIDS_ERROR_UPLDERR11."<br /><br />"._HWDVIDS_INFO_SUPPTPW."<br />".hwd_vs_tools::generateSupportedWebsiteList();
						hwd_vs_tools::infomessage(4, 0, _HWDVIDS_TITLE_UPLDFAIL, $error_msg, "exclamation.png", 1);
						return;
					} else {
						$url = substr($datadump, $pos_http);
					}

					$pru = parse_url($url);
					$remoteurl = $pru['scheme']."://".$pru['host'].$pru['path'];

					if(!preg_match("/^[a-zA-Z]+[:\/\/]+[A-Za-z0-9\-_]+\\.+[A-Za-z0-9\.\/%&=\?\-_]+$/i",$remoteurl)) {
						$remote_verified = 0;
					} else {
						$filegrab = @file_get_contents($remoteurl, null, null, 0, 16);
						$filecheck = @strpos($remoteurl, "flv");
						if (isset($remoteurl) && !empty($remoteurl) && $filecheck !== false) {
							$remote_verified = 1;
						} else {
							$remote_verified = 0;
						}
					}
				}

			}

			$failures = "";
			if (!isset($remote_verified)) {
				$cn = 'hwd_vs_tp_'.preg_replace("/[^a-zA-Z0-9s_-]/", "", $regs['domain']);
				$f_processc = preg_replace("/[^a-zA-Z0-9s_-]/", "", $regs['domain']).'processCode';
				$f_processt = preg_replace("/[^a-zA-Z0-9s_-]/", "", $regs['domain']).'processTitle';
				$f_processd = preg_replace("/[^a-zA-Z0-9s_-]/", "", $regs['domain']).'processDescription';
				$f_processk = preg_replace("/[^a-zA-Z0-9s_-]/", "", $regs['domain']).'processKeywords';
				$f_processl = preg_replace("/[^a-zA-Z0-9s_-]/", "", $regs['domain']).'processDuration';

				$tp = new $cn();

				$ext_v_code  = $tp->$f_processc($embeddump);
				$ext_v_title = $tp->$f_processt($embeddump, @$ext_v_code[2]);
				$ext_v_descr = $tp->$f_processd($embeddump, @$ext_v_code[2]);
				$ext_v_keywo = $tp->$f_processk($embeddump, @$ext_v_code[2]);
				$ext_v_durat = $tp->$f_processl($embeddump, @$ext_v_code[2]);

				if ($ext_v_code[0] == "0") {
					hwd_vs_tools::infomessage(4, 0, _HWDVIDS_TITLE_UPLDFAIL, _HWDVIDS_INFO_TPPROCESSFAIL, "exclamation.png", 0);
					return;
				}

				if ($ext_v_title[0] == 0) {$failures.=_HWDVIDS_INFO_TPTITLEFAIL."<br />";}
				if ($ext_v_descr[0] == 0) {$failures.=_HWDVIDS_INFO_TPDESCFAIL."<br />";}
				if ($ext_v_keywo[0] == 0) {$failures.=_HWDVIDS_INFO_TPKWFAIL."<br />";}
				if ($ext_v_durat[0] == 0) {$failures.=_HWDVIDS_INFO_TPDRFAIL."<br />";}
			} else if ($remote_verified == 0) {
				$error_msg = _HWDVIDS_ERROR_UPLDERR11."<br /><br />"._HWDVIDS_INFO_SUPPTPW."<br />".hwd_vs_tools::generateSupportedWebsiteList();
				hwd_vs_tools::infomessage(4, 0, _HWDVIDS_TITLE_UPLDFAIL, $error_msg, "exclamation.png", 1);
				return;
			} else if ($remote_verified == 1) {
				$ext_v_code[1] = $remoteurl.",";
				$ext_v_title[1] = _HWDVIDS_UNKNOWN;
				$ext_v_descr[1] = _HWDVIDS_UNKNOWN;
				$ext_v_keywo[1] = _HWDVIDS_UNKNOWN;
				$ext_v_durat[1] = "0:00:00";
				$regs['domain'] = "remote";
			}

			//check if already exists
			$db->SetQuery( 'SELECT count(*) FROM #__hwdvidsvideos WHERE video_id = "'.$ext_v_code[1].'"' );
			$duplicatecount = $db->loadResult();

			$admin_import = false;

			if ($duplicatecount > 0 && $admin_import == false) {
				hwd_vs_tools::infomessage(4, 0, _HWDVIDS_TITLE_UPLDFAIL, _HWDVIDS_ALERT_DUPLICATE, "exclamation.png", 0);
				return;
			} else if ($duplicatecount > 0 && $admin_import == true) {
				return false;
			}

			$title = $ext_v_title[1];
			$title = stripslashes($title);
			$title = stripslashes($title);
			$title = hwdEncoding::charset_decode_utf_8($title);
			$title = hwdEncoding::charset_encode_utf_8($title);
			$title = htmlspecialchars_decode($title);
			$title = addslashes($title);

			$description = $ext_v_descr[1];
			$description = stripslashes($description);
			$description = stripslashes($description);
			$description = hwdEncoding::charset_decode_utf_8($description);
			$description = hwdEncoding::charset_encode_utf_8($description);
			$description = htmlspecialchars_decode($description);
			$description = addslashes($description);

			$raw_tags = $ext_v_keywo[1];
			$tags = '';
			$tag_arr_co = explode(",", $raw_tags);

			for ($j=0, $m=count($tag_arr_co); $j < $m; $j++) {

				$row_co = $tag_arr_co[$j];
				$tag_arr_sp = explode(" ", $row_co);

				for ($k=0, $p=count($tag_arr_sp); $k < $p; $k++) {

					$row_sp = $tag_arr_sp[$k];
					$row_sp = hwdEncoding::charset_decode_utf_8($row_sp);
					$row_sp = preg_replace("/[^a-zA-Z0-9s_&#;-]/", "", $row_sp);
					$row_sp = hwdEncoding::charset_encode_utf_8($row_sp);

					if (!empty($row_sp)) {
						$tags.= $row_sp.",";
					}

				}
			}
			if (substr($tags, -2) == ", ") {$tags = substr($tags, 0, -2);}

			if (empty($title)) { $title = _HWDVIDS_UNKNOWN;}
			if (empty($description)) { $description = _HWDVIDS_UNKNOWN;}
			if (empty($tags)) { $tags = _HWDVIDS_UNKNOWN;}

			$_POST['video_type'] 		= $regs['domain'];
			$_POST['video_id'] 			= $ext_v_code[1];

			if ($updatedetails == "on") {
				$_POST['title'] 			= $ext_v_title[1];
				$_POST['description'] 		= $ext_v_descr[1];
				$_POST['tags'] 				= $ext_v_keywo[1];
			}

			// bind it to the table
			if (!$row -> bind($_POST)) {
				echo "<script> alert('"
					.$row -> getError()
					."'); window.history.go(-1); </script>\n";
				exit();
			}

			// store it in the db
			if (!$row -> store()) {
				echo "<script> alert('"
					.$row -> getError()
					."'); window.history.go(-1); </script>\n";
				exit();
			}

			$row->checkin();

		}
		else if ($video_type == 2)
		{
			$data = explode(",", $row->video_id);
			$thumbnail = @$data[1];

			$requestarray = JRequest::get( 'default', 2 );
			$videourl = $requestarray['embeddump'];

			$validated_video_url = hwd_vs_tools::validateUrl($videourl);

			if (empty($validated_video_url))
			{
				$msg = _HWDVIDS_ALERT_VURLWRONG;
				$app->enqueueMessage($msg);
				$app->redirect(JURI::root( true )."/administrator/index.php?option=com_hwdvideoshare&task=editvidsA&hidemainmenu=1&cid=".$row->id);
			}

			$new_video_id = $validated_video_url.",".$thumbnail;

			$_POST['video_type'] 		= "remote";
			$_POST['video_id'] 			= $new_video_id;
			if (empty($row->thumbnail) && !empty($thumbnail))
			{
				$_POST['thumbnail'] 	= $thumbnail;
			}

			// bind it to the table
			if (!$row->bind($_POST))
			{
				echo "<script type=\"text/javascript\">alert('".$row->getError()."');window.history.go(-1);</script>\n";
				exit();
			}

			// store it in the db
			if (!$row->store())
			{
				echo "<script type=\"text/javascript\">alert('".$row->getError()."');window.history.go(-1);</script>\n";
				exit();
			}
			$row->checkin();
		}
		else if ($video_type == 3)
		{
			$data = explode(",", $row->video_id);
			$thumbnail = @$data[1];

			$requestarray = JRequest::get( 'default', 2 );
			$rtmpurl = $requestarray['embeddump'];
			$validated_rtmpurl = hwd_vs_tools::validateUrl($rtmpurl);

			if (empty($validated_rtmpurl))
			{
				$msg = _HWDVIDS_ALERT_VURLWRONG;
				$app->enqueueMessage($msg);
				$app->redirect(JURI::root( true )."/administrator/index.php?option=com_hwdvideoshare&task=editvidsA&hidemainmenu=1&cid=".$row->id);
			}

			$new_video_id = $validated_rtmpurl;

			$_POST['video_type'] 		= "rtmp";
			$_POST['video_id'] 			= $new_video_id;
			if (empty($row->thumbnail) && !empty($thumbnail))
			{
				$_POST['thumbnail'] 	= $thumbnail;
			}

			// bind it to the table
			if (!$row->bind($_POST))
			{
				echo "<script type=\"text/javascript\">alert('".$row->getError()."');window.history.go(-1);</script>\n";
				exit();
			}

			// store it in the db
			if (!$row->store())
			{
				echo "<script type=\"text/javascript\">alert('".$row->getError()."');window.history.go(-1);</script>\n";
				exit();
			}
			$row->checkin();
		}

		require_once(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_hwdvideoshare'.DS.'libraries'.DS.'maintenance_recount.class.php');
		hwd_vs_recount::recountVideosInCategory($row->category_id);

		$app->enqueueMessage(_HWDVIDS_ALERT_VIDSAVED);
		$app->redirect( JURI::root( true ) . '/administrator/index.php?option='.$option.'&task=editvidsA&hidemainmenu=1&cid='.$row->id );
	}
コード例 #9
0
ファイル: ajaxsuite.php プロジェクト: rkern21/videoeditor
    /**
     * Outputs frontpage HTML
     *
     * @return       Nothing
     */

    function addVideoToPlaylist()
	{
		header('Content-type: text/html; charset=utf-8');
		echo "<META NAME=\"ROBOTS\" CONTENT=\"NOINDEX, NOFOLLOW\">";

		$c = hwd_vs_Config::get_instance();
		$db = & JFactory::getDBO();
		$my = & JFactory::getUser();

		if (!$my->id) {
			echo _HWDVIDS_AJAX_LOG2ADD2PL;
			exit;
		}

		$user_id = $my->id;
		$videoid = JRequest::getInt( 'videoid', 0, 'request' );
		$playlistid = JRequest::getInt( 'playlistid', 0, 'request' );
		$date = date('Y-m-d H:i:s');
		$published = 1;

		if ($playlistid == 0) {
			echo _HWDVIDS_SELPL;
			exit;
		}

		$row = new hwdvids_playlist($db);
		$row->load( $playlistid );

		if (empty($row->playlist_data)) {
			$playlist_data = $videoid;
		} else {
			$playlist_data = $row->playlist_data.",".$videoid;
		}

		$_POST['id'] 	   			   = $playlistid;
		$_POST['playlist_data']        = $playlist_data;

		// bind it to the table
		if (!$row -> bind($_POST)) {
			echo "<script> alert('"
				.$row -> getError()
				."'); window.history.go(-1); </script>\n";
			exit();
		}

		// store it in the db
		if (!$row -> store()) {
			echo "<script> alert('"
				.$row -> getError()
				."'); window.history.go(-1); </script>\n";
			exit();
		}

		// perform maintenance
		require_once(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_hwdvideoshare'.DS.'libraries'.DS.'maintenance_recount.class.php');
		hwd_vs_recount::recountVideosInPlaylist($playlistid);

		$row = new hwdvids_playlist($db);
		$row->load( $playlistid );
		if (!empty($row->playlist_data))
		{
			$playlist = explode(",", $row->playlist_data);
			$playlist = preg_replace("/[^0-9]/", "", $playlist);

			$counter = 0;
			$pl_videos = array();
			for ($i=0, $n=count($playlist); $i < $n; $i++)
			{
				$db->SetQuery('SELECT * FROM #__hwdvidsvideos WHERE id = '.$playlist[$i]);
				$video = $db->loadObject();
				if (isset($video->id))
				{
					$pl_videos[$counter] = $video;
					$counter++;
				}
			}
		}

		require_once(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_hwdvideoshare'.DS.'helpers'.DS.'draw.php');
		hwdvsDrawFile::XMLDataFile($pl_videos, "pl_$playlistid");
		hwdvsDrawFile::XMLPlaylistFile($pl_videos, "pl_$playlistid");

		echo _HWDVIDS_ALERT_SUCAV2PL;
		exit;
	}
コード例 #10
0
ファイル: groups.php プロジェクト: rkern21/videoeditor
	/**
	 * save categories
	 */
	function savegroup()
	{
		global $option;
  		$db =& JFactory::getDBO();
		$app = & JFactory::getApplication();

  		$access_lev_u = Jrequest::getVar( 'access_lev_u', '0' );
		$access_lev_v = Jrequest::getVar( 'access_lev_v', '0' );

		$row = new hwdvids_group($db);

		$_POST['category_name'] = Jrequest::getVar( 'category_name', 'no name supplied' );
		$_POST['category_description'] = Jrequest::getVar( 'category_description', 'no name supplied' );
		$_POST['access_lev_u'] = @implode(",", $access_lev_u);
		$_POST['access_lev_v'] = @implode(",", $access_lev_v);

		// bind it to the table
		if (!$row -> bind($_POST)) {
			echo "<script> alert('"
				.$row -> getError()
				."'); window.history.go(-1); </script>\n";
			exit();
		}

		// store it in the db
		if (!$row -> store()) {
			echo "<script> alert('"
				.$row -> getError()
				."'); window.history.go(-1); </script>\n";
			exit();
		}

		$row->checkin();

		// perform maintenance
		include(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_hwdvideoshare'.DS.'libraries'.DS.'maintenance_recount.class.php');
		hwd_vs_recount::recountVideosInCategory();
		hwd_vs_recount::recountSubcatsInCategory();

		$msg = $total ._HWDVIDS_ALERT_GRPSAVED;
		$app->enqueueMessage($msg);
		$app->redirect( JURI::root( true ) . '/administrator/index.php?option='.$option.'&task=groups' );
	}
コード例 #11
0
ファイル: playlists.php プロジェクト: rkern21/videoeditor
   /**
	* Save editted video details
	*/
	function removeVideoFromPlaylist()
	  {
	    global $Itemid, $mainframe;
	    $db =& JFactory::getDBO();
	    $my = & JFactory::getUser();

	    $playlist_id  = JRequest::getInt( 'playlist_id', 0 );
	    $video_id  = JRequest::getInt( 'video_id', 0 );

		$row = new hwdvids_playlist($db);
		$row->load( $playlist_id );

		if ( $row->user_id !== $my->id )
		{
			$msg = "You do not have permission to remove videos from this playlist";
			$mainframe->enqueueMessage($msg);
			$mainframe->redirect( JURI::root( true ) . '/index.php?option=com_hwdvideoshare&task=editPlaylist&playlistid='.$playlist_id.'&Itemid='.$Itemid );
		}

		if (!empty($row->playlist_data))
		{
			$playlist = explode(",", $row->playlist_data);
			$playlist = preg_replace("/[^0-9]/", "", $playlist);

			$pl_videos = array();
			for ($i=0, $n=count($playlist); $i < $n; $i++)
			{
				if ($playlist[$i] !== $video_id)
				{
					$pl_videos[] = $playlist[$i];
				}
			}
		}

		$newData = implode(",", $pl_videos);

		$db->SetQuery("UPDATE #__hwdvidsplaylists SET playlist_data = \"$newData\" WHERE id = $playlist_id");
		if ( !$db->query() ) { echo "<script language=\"javascript\" type=\"text/javascript\"> alert('".addslashes($db->getErrorMsg())."'); window.history.go(-1); </script>\n"; exit(); }

		// perform maintenance
		require_once(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_hwdvideoshare'.DS.'libraries'.DS.'maintenance_recount.class.php');
		hwd_vs_recount::recountVideosInPlaylist($playlist_id);

		$row = new hwdvids_playlist($db);
		$row->load( $playlist_id );
		if (!empty($row->playlist_data))
		{
			$playlist = explode(",", $row->playlist_data);
			$playlist = preg_replace("/[^0-9]/", "", $playlist);

			$counter = 0;
			$pl_videos = array();
			for ($i=0, $n=count($playlist); $i < $n; $i++)
			{
				$db->SetQuery('SELECT * FROM #__hwdvidsvideos WHERE id = '.$playlist[$i]);
				$video = $db->loadObject();
				if (isset($video->id))
				{
					$pl_videos[$counter] = $video;
					$counter++;
				}
			}
		}

		require_once(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_hwdvideoshare'.DS.'helpers'.DS.'draw.php');
		hwdvsDrawFile::XMLDataFile($pl_videos, "pl_$playlist_id");
		hwdvsDrawFile::XMLPlaylistFile($pl_videos, "pl_$playlist_id");

	    $msg = _HWDPS_ALERT_AREORGANISED;
	    $mainframe->enqueueMessage($msg);
		$mainframe->redirect( JURI::root( true ) . '/index.php?option=com_hwdvideoshare&task=editPlaylist&playlistid='.$playlist_id.'&Itemid='.$Itemid );
	}
コード例 #12
0
ファイル: groups.php プロジェクト: rkern21/videoeditor
    /**
     * Outputs frontpage HTML
     *
     * @return       Nothing
     */
    function leavegroup()
	{
		global $Itemid, $mainframe;
		$c = hwd_vs_Config::get_instance();
		$db = & JFactory::getDBO();
		$my = & JFactory::getUser();
		$acl= & JFactory::getACL();

		if (!hwd_vs_access::checkAccess($c->gtree_grup, $c->gtree_grup_child, 4, 0, _HWDVIDS_TITLE_NOACCESS, _HWDVIDS_ALERT_REGISTERFORGRUP, _HWDVIDS_ALERT_GRUP_NOT_AUTHORIZED, "exclamation.png", 0, "core.frontend.group")) {return;}

		$url =  Jrequest::getVar( 'url', JURI::root() );

		if (!$my->id) {
			$mainframe->enqueueMessage(_HWDVIDS_ALERT_LOG2LEAVEG);
			$mainframe->redirect( $url );
		}

		$memberid = $my->id;
		$groupid = JRequest::getInt( 'groupid', 0 );

		$where = ' WHERE memberid = '.$memberid;
		$where .= ' AND groupid = '.$groupid;

		$db->SetQuery( 'DELETE FROM #__hwdvidsgroup_membership'
							. $where
							);

		if ( !$db->query() ) {
			echo "<script> alert('".$db->getErrorMsg()."'); window.history.go(-1); </script>\n";
			exit();
		}

		// perform maintenance
		require_once(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_hwdvideoshare'.DS.'libraries'.DS.'maintenance_recount.class.php');
		hwd_vs_recount::recountMembersInGroup($groupid);

		$api_AUP = JPATH_SITE.DS.'components'.DS.'com_alphauserpoints'.DS.'helper.php';
		if ( file_exists($api_AUP))
		{
			require_once ($api_AUP);
			AlphaUserPointsHelper::newpoints( 'plgaup_leaveVideoGroup_hwdvs' );
		}

		$mainframe->enqueueMessage(_HWDVIDS_ALERT_SUCLEAVE);
		$mainframe->redirect( $url );
  	}
コード例 #13
0
ファイル: events.php プロジェクト: rkern21/videoeditor
    function onAfterVideoApproval($params)
    {
		global $mosConfig_mailfrom, $mosConfig_fromname, $mosConfig_live_site, $Itemid, $mosConfig_sitename, $mainframe;
		$c = hwd_vs_Config::get_instance();
		$my = & JFactory::getUser();
  		$db =& JFactory::getDBO();

		JPluginHelper::importPlugin( 'system' );
		$dispatcher =& JDispatcher::getInstance();
		$results = $dispatcher->trigger( 'onAfterVideoApproval', array( $params ) );
		$results = $dispatcher->trigger( 'onAfterVideoUpload', array( $params ) );

		// perform maintenance
		include_once(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_hwdvideoshare'.DS.'libraries'.DS.'maintenance_recount.class.php');
		hwd_vs_recount::recountVideosInCategory($params->category_id);

		// AUP 'new video' points
		$api_AUP = JPATH_SITE.DS.'components'.DS.'com_alphauserpoints'.DS.'helper.php';
		if ( file_exists($api_AUP))
		{
			if (!isset($params->user_id))
			{
				$params->user_id = $my->id;
			}
			$db->SetQuery( 'SELECT referreid FROM #__alpha_userpoints WHERE userid = '.$params->user_id );
			$referreid = $db->loadResult();

			require_once ($api_AUP);
			AlphaUserPointsHelper::newpoints( 'plgaup_addVideo_hwdvs', $referreid );
		}

		// JomSocial activity stream
		if ($c->cbint == 2) {
			require_once( JPATH_SITE . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'core.php' );
			require_once( JPATH_SITE . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'error.php' );

			$act = new stdClass();
			$act->cmd 	= 'video.upload';
			$act->actor 	= $params->user_id;
			$act->target 	= 0; // no target
			$act->content 	= '';
			$act->app 	= 'hwdvideoshare';
			$act->cid 	= $params->id;

			$single_video = '{actor} '._HWDVIDS_JS_AS1.' '._HWDVIDS_JS_AS2.' {app} '._HWDVIDS_JS_AS3;
			$multiple_videos = '{actor} '._HWDVIDS_JS_AS1.' {count} '._HWDVIDS_JS_AS5.' {app} '._HWDVIDS_JS_AS4;

			$link = JRoute::_('index.php?option=com_hwdvideoshare&task=viewvideo&Itemid='.$Itemid.'&video_id='.$params->id);
			$title = stripslashes($params->title);

			//// Variation 1
			//$single_video    = '{actor} '._HWDVIDS_JS_AS1.' '._HWDVIDS_JS_AS2.' <a href="'.$link.'">'._HWDVIDS_JS_AS3.'</a>';
			//$multiple_videos = '{actor} '._HWDVIDS_JS_AS1.' '._HWDVIDS_JS_AS2.' {count} <a href="'.$link.'">'._HWDVIDS_JS_AS4.'</a>';

			//// Variation 2
			//$single_video    = '{actor} '._HWDVIDS_JS_AS1.' '._HWDVIDS_JS_AS2.' '._HWDVIDS_JS_AS3.' called <a href="'.$link.'">'.$title.'</a>';
			//$multiple_videos = '{actor} '._HWDVIDS_JS_AS1.' '._HWDVIDS_JS_AS2.' '._HWDVIDS_JS_AS3.' called <a href="'.$link.'">'.$title.'</a>';

			//// Variation 3
			//$single_video    = '{actor} has uploaded video <a href="'.$link.'">'.$title.'</a>';
			//$multiple_videos = '{actor} has uploaded video <a href="'.$link.'">'.$title.'</a>';

			// insert into activity stream
			$act->title 	= JText::_('{single}'.$single_video.'{/single}{multiple}'.$multiple_videos.'{/multiple}');
			$act->content 	= "{getActivityContentHTML}";

			CFactory::load('libraries', 'activities');
			CActivityStream::add($act);

			include_once( JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'userpoints.php');
			CuserPoints::assignPoint('com_hwdvideoshare.onAfterVideoApproval', $my->id);

		}
	}