Example #1
0
   /**
    * List Groups Created by User
    */
    function approvevideo()
	{
		global $mainframe, $option, $isModerator;
  		$db =& JFactory::getDBO();
		$my = & JFactory::getUser();

		if (!$isModerator)
		{
			$msg = "Only moderators can access this page";
			$mainframe->enqueueMessage($msg);
			$mainframe->redirect( JURI::root( true ) . '/index.php?option=com_hwdvideoshare&task=frontpage&Itemid='.$hwdvsItemid );
		}

		$video_id = JRequest::getInt( "videoid", "" );

		$db->setQuery("UPDATE #__hwdvidsvideos SET approved = 'yes', published = 1 WHERE id = $video_id");
		if (!$db->query()) {
			echo "<script> alert('".$db->getErrorMsg()."'); window.history.go(-1); </script>\n";
			exit();
		}

		include_once(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_hwdvideoshare'.DS.'helpers'.DS.'events.php');
		$row = new hwdvids_video($db);
		$row->load( $cids );
		$params->title = $row->title;
		$params->id = $row->id;
		$params->category_id = $row->category_id;
		$params->type = $row->video_type;
		$params->user_id = $row->user_id;
		hwdvsEvent::onAfterVideoApproval($params);

		$msg = $total ._HWDVIDS_ALERT_ADMIN_VIDAPP." ";
		$mainframe->enqueueMessage($msg);
		$mainframe->redirect( JURI::root( true ) . '/index.php?option=com_hwdvideoshare&task=pending' );
	}
Example #2
0
   /**
	* approve (& publish) videos
	*/
	function approve($cid=null, $publish=1)
	{
		global $option;
  		$db =& JFactory::getDBO();
		$my = & JFactory::getUser();
		$app = & JFactory::getApplication();

		if (count( $cid ) < 1) {
			$action = $publish == 1 ? 'approve' : ($publish == -1 ? 'unapprove' : 'unpublishg');
			echo "<script> alert('Select an item to $action'); window.history.go(-1);</script>\n";
			exit;
		}

		$total = count ( $cid );
		$cids = implode( ',', $cid );

		$db->setQuery( "UPDATE #__hwdvidsvideos"
						. "\nSET approved = 'yes', published = 1"
						. "\n WHERE id IN ( $cids )"
						. "\n AND ( checked_out = 0 OR ( checked_out = $my->id ) )"
						);
		if (!$db->query()) {
			echo "<script> alert('".$db->getErrorMsg()."'); window.history.go(-1); </script>\n";
			exit();
		}

		if (count($cid) > 1)
		{
			include_once(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_hwdvideoshare'.DS.'helpers'.DS.'events.php');
			for ($i=0, $n=count($cid); $i < $n; $i++)
			{
				$row = new hwdvids_video($db);
				$row->load( $cid[$i] );
				$params->title = $row->title;
				$params->id = $row->id;
				$params->category_id = $row->category_id;
				$params->type = $row->video_type;
				$params->user_id = $row->user_id;
				hwdvsEvent::onAfterVideoApproval($params);
			}
		}
		else
		{
			include_once(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_hwdvideoshare'.DS.'helpers'.DS.'events.php');
			$row = new hwdvids_video($db);
			$row->load( $cids );
			$params->title = $row->title;
			$params->id = $row->id;
			$params->category_id = $row->category_id;
			$params->type = $row->video_type;
			$params->user_id = $row->user_id;
			hwdvsEvent::onAfterVideoApproval($params);
		}

		$msg = $total ._HWDVIDS_ALERT_ADMIN_VIDAPP." ";
		$app->enqueueMessage($msg);
		$app->redirect( JURI::root( true ) . '/administrator/index.php?option='.$option.'&task=approvals' );
	}
Example #3
0
    function onAfterVideoUpload($params)
    {
		global $mosConfig_mailfrom, $mosConfig_fromname, $mosConfig_live_site, $Itemid, $mosConfig_sitename, $mainframe;
		$c = hwd_vs_Config::get_instance();

		$my = & JFactory::getUser();

		// send upload to converter if required
		if ($c->requiredins == 1 && ($params->type == "local" || $params->type == "mp4" || $params->type == "swf")) {

			$s = hwd_vs_SConfig::get_instance();

			if ($c->autoconvert == "direct") {
				if(substr(PHP_OS, 0, 3) != "WIN") {
					@exec("env -i $s->phppath ".JPATH_SITE.DS."components".DS."com_hwdvideoshare".DS."converters".DS."converter.php &>/dev/null &");
				} else {
					pclose(popen("start \"bla\" \"" . $s->phppath . "\" " . escapeshellarg("\"".JPATH_SITE.DS."components".DS."com_hwdvideoshare".DS."converters".DS."converter.php\""), "r"));
					//@exec("$s->phppath \"".JPATH_SITE.DS."components".DS."com_hwdvideoshare".DS."converters".DS."converter.php\" >nul");
				}
			} else if ($c->autoconvert == "wget1") {
				if(substr(PHP_OS, 0, 3) != "WIN") {
					@exec("env -i $s->wgetpath -O - -q ".JURI::root()."components/com_hwdvideoshare/converters/converter.php &>/dev/null &");
				} else {
					@exec("$s->wgetpath \"".JURI::root()."components/com_hwdvideoshare/converters/converter.php\" NUL");
				}
			} else if ($c->autoconvert == "wget2") {
				if(substr(PHP_OS, 0, 3) != "WIN") {
					@exec("env -i $s->wgetpath -O - -q ".JURI::root()."components/com_hwdvideoshare/converters/converter.php >/dev/null &");
				} else {
					@exec("$s->wgetpath \"".JURI::root()."components/com_hwdvideoshare/converters/converter.php\" NUL");
				}
			}

		}

		// mail admin notification
		if ($c->mailvideonotification == 1) {
			$jconfig = new jconfig();

			$mailbody = ""._HWDVIDS_MAIL_BODY0.$jconfig->sitename.".\n";
			$mailbody .= ""._HWDVIDS_MAIL_BODY1."\"".$params->title."\".\n";
			$mailbody .= "".JURI::root()."index.php?option=com_hwdvideoshare&Itemid=".$Itemid."&task=viewvideo&video_id=".$params->id."\n\n";
			$mailbody .= ""._HWDVIDS_MAIL_BODY2."\n";
			$mailbody .= JURI::root()."administrator";

			JUtility::sendMail( $jconfig->mailfrom, $jconfig->fromname, $c->mailnotifyaddress, _HWDVIDS_MAIL_SUBJECT1.$jconfig->sitename.' ', $mailbody );
		}

		if ($params->type == "local" || $params->type == "mp4" || $params->type == "swf") {

			if ($c->aav == 1) {

				hwdvsEvent::onAfterVideoApproval($params);

			}

		} else {

			if ($c->aa3v == 1) {

				hwdvsEvent::onAfterVideoApproval($params);

			}

		}

    }