Skip to content
admin_videos.php 14.5 KiB
Newer Older
Seblu's avatar
Seblu committed
<?
// include_once "admin/file_browser.php";


function dispAdminVideos () {

if ($_SESSION["user_right"] < $GLOBALS["EPTV"] )
{
	return("T'es ouf");
}

	get_time();


$result_prod = getVideosByType("eptvprod");
$result_bonus = getVideosByType("eptvbonus");
$result_adm = getVideosByType("eptv.adm");

$str = '
Seblu's avatar
Seblu committed

Seblu's avatar
Seblu committed
	<table width="100%" border="0" cellspacing="0" cellpadding="0">
		<tr>
		<td bgcolor="#000000">
		<table width="100%" border="0" cellspacing="1" cellpadding="2">
			<tr>
			<td>
				<b>
				<font color="#ffffff">
				&nbsp a l l &nbsp v i d e o s
				</font>
Seblu's avatar
Seblu committed
				</b>
Seblu's avatar
Seblu committed
			</td>
			</tr>
			<tr>
			   <td width=150>
Seblu's avatar
Seblu committed
				<FORM name="new_video" method="post" action="index.php?html=AdminHome&section_admin=AdminAddVideos&vid_id='.$vid_id.'">
Seblu's avatar
Seblu committed
				<INPUT class="button" TYPE="submit" NAME="action" VALUE="  NOUVELLE VIDEO  "><BR> </TD>
				</FORM>
			   </td>
			   <td>
Seblu's avatar
Seblu committed
				<FORM name="new_video" method="post" action="index.php?html=AdminHome&section_admin=AdminVideosSolos&vid_id='.$vid_id.'">
Seblu's avatar
Seblu committed
				<INPUT class="button" TYPE="submit" NAME="action" VALUE="LISTE VIDEOS SOLOS"><BR> </TD>
				</FORM>
			   </td>

			</tr>
		</table>
		</td>
		</tr>
	</table>
	<BR>';


	if (mysql_num_rows($result_prod)) {
Seblu's avatar
Seblu committed
		$str .= dispAdminVideosByType($result_prod, "&nbsp;e p t v &nbsp; p r o d u c t i o n");
Seblu's avatar
Seblu committed
	}
Seblu's avatar
Seblu committed

Seblu's avatar
Seblu committed
	if (mysql_num_rows($result_bonus)) {
		$str .= dispAdminVideosByType($result_bonus, "&nbsp;e p t v &nbsp b o n u s");
	}

	if (mysql_num_rows($result_adm)) {
		$str .= dispAdminVideosByType($result_adm, "&nbsp;e p t v . a d m");
	}

return $str;

}




function dispAdminVideosByType($result, $video_type) {
Seblu's avatar
Seblu committed

	$str = '
Seblu's avatar
Seblu committed
	<table width="100%" border="0" cellspacing="0" cellpadding="0">
		<tr>
		<td bgcolor="#000000">
		<table width="100%" border="0" cellspacing="1" cellpadding="2">
			<tr>
			<td>
				<b>
				<font color="#ffffff">
				'.$video_type.'
				</font>
Seblu's avatar
Seblu committed
				</b>
Seblu's avatar
Seblu committed
			</td>
			</tr>
Seblu's avatar
Seblu committed

Seblu's avatar
Seblu committed
			<tr>
Seblu's avatar
Seblu committed
			<td bgcolor="#1d1d1d">
Seblu's avatar
Seblu committed
			<table cellpadding="0" cellspacing="0" width="100%">
				<tr>
				<td>
				<table width="100%" border="0" cellspacing="0" cellpadding="4">

		';

		while ($video = mysql_fetch_array($result)) {
Seblu's avatar
Seblu committed

Seblu's avatar
Seblu committed
			$vid_id = $video["video_id"];

			$str .= dispWhenTendu($video["video_tendu"]);

			$str .= '
Seblu's avatar
Seblu committed

Seblu's avatar
Seblu committed
				<a href="
					'.$video["video_path"].'
					" class="texte_link">
					'.$video["video_name"].'
				</TD><TD>';
			if ($video["video_path_daily"]) {
Seblu's avatar
Seblu committed
			$str .= '<a href=\'http://www.eptv.fr/dailymotion.php?q='.$video["video_path_daily"].'\' onclick="return popitup(this, \'EPTV\')" ><img src=\'http://www.dailymotion.com/favicon.ico\' height=15></a>';
Seblu's avatar
Seblu committed
			}
Seblu's avatar
Seblu committed
			$str .= '</TD>
				<TD>
					'.$video["video_date"].'
				</TD>
				<TD align=center>
					'.$video["video_size"].' Mo
				</TD>
			';

				if ($video["video_user_id"] == $_SESSION["user_id"] || $_SESSION["user_right"] == $GLOBALS["ROOT"]){
					$str .= '
						<TD width=10% align=right>
Seblu's avatar
Seblu committed
							<FORM name="update_video" method="post" action="index.php?html=AdminHome&section_admin=AdminModifVideos&vid_id='.$vid_id.'">
Seblu's avatar
Seblu committed
							<INPUT class="small_button" TYPE="submit" NAME="action" VALUE=" MODIF ">
Seblu's avatar
Seblu committed
							</FORM>
						</TD>
						<TD width=10% align=right>
Seblu's avatar
Seblu committed
							<FORM name="supp_video" method="post" action="index.php?html=AdminHome&section_admin=AdminDelVideos&vid_id='.$vid_id.'">
Seblu's avatar
Seblu committed
							<INPUT class="small_button" TYPE="submit" NAME="action" VALUE=" SUPP ">
Seblu's avatar
Seblu committed
							</FORM>
Seblu's avatar
Seblu committed
						</TD>
					';
				}


			$str .= '</TR>';
		}

$str .= '
					</table>
					</td>
					</tr>
				</table>
				</td>
				</tr>
			</table>
			</td>
			</tr>
		</table>
		<br>
	';

	return ($str);

}


function find_reccur_file($rep_def)
{

   $rep = opendir($rep_def);

   while( $file = readdir($rep))
   {
	if($file !='..' && $file !='.' && $file !='')
       	{
		if (is_dir($rep_def.$file))
		{
			$tab_temp = find_reccur_file($rep_def.$file.'/');
			$tab = array_merge($tab, $tab_temp);

		}
		else if (is_file($rep_def.$file))
		{
			$tab[] = $rep_def.$file;
		}
	}

   }

closedir($rep);
return $tab;
}






function dispAdminVideosSolos () {

   $rep_def = "videos/";

   if ($_SESSION["user_right"] < $GLOBALS["REPORTER"] )
   {
	return("T'es ouf");
   }


   // Files on BDD

   $result = getAllVideos();

   while ($video = mysql_fetch_array($result)) {
	$tab_path_bdd[] = $video["video_path"];
   }


   // Files on Serveur

   $tab_path_local = find_reccur_file($rep_def);



   for ($cpt_local = 0; $tab_path_local[$cpt_local]; $cpt_local++)
   {
	for ($cpt_bdd = 0; $tab_path_bdd[$cpt_bdd] && $tab_path_bdd[$cpt_bdd] != $tab_path_local[$cpt_local]; $cpt_bdd++)
	{
		;
	}
	if (!$tab_path_bdd[$cpt_bdd])
	{
		$tab_solo[] = $tab_path_local[$cpt_local];
	}

   }




   $str = '
Seblu's avatar
Seblu committed

Seblu's avatar
Seblu committed
	<table width="100%" border="0" cellspacing="0" cellpadding="0">
		<tr>
		<td bgcolor="#000000">
		<table width="100%" border="0" cellspacing="1" cellpadding="2">
			<tr>
			<td>
				<b>
				<font color="#ffffff">
				&nbsp v i d e o s &nbsp; s o l o s
				</font>
Seblu's avatar
Seblu committed
				</b>
Seblu's avatar
Seblu committed
			</td>
			</tr>
Seblu's avatar
Seblu committed

Seblu's avatar
Seblu committed
			<tr>
Seblu's avatar
Seblu committed
			<td bgcolor="#303030">
Seblu's avatar
Seblu committed
			<table cellpadding="0" cellspacing="0" width="100%">
				<tr>
				<td>
				<table width="100%" border="0" cellspacing="0" cellpadding="4">
				';


				for ($i = 0; $tab_solo[$i]; $i++)
				{
Seblu's avatar
Seblu committed

Seblu's avatar
Seblu committed
			$str .= '

				<TR>

				<TD width = 380>
					'.$tab_solo[$i].'
			 	</TD>

				<TD  align=left>
Seblu's avatar
Seblu committed
					<FORM name="update_video" method="post" action="index.php?html=AdminHome&section_admin=AdminAddVideos&vid_path='.$tab_solo[$i].'">
Seblu's avatar
Seblu committed
					<INPUT class="small_button" TYPE="submit" NAME="action" VALUE=" Ajouter ">
Seblu's avatar
Seblu committed
					</FORM>
				</TD>

				</TR>
			';

				}

			$str .= '

				</table>
				</td>
				</tr>
			</table>
			</td>
			</tr>
		</table>
		</td>
		</tr>
	</table>
Seblu's avatar
Seblu committed

Seblu's avatar
Seblu committed
   ';




   return $str;

}




function dispAdminAddVideos () {

   $date = get_date();
   $vid_path = "";

   if (isset($_GET['vid_path']))
   {
	$vid_path = $_GET['vid_path'];
   }


Seblu's avatar
Seblu committed
 $str = '
Seblu's avatar
Seblu committed
<table width="80%" border="0" cellspacing="0" cellpadding="0">
	<tr>
	<td bgcolor="#000000">
	<table width="100%" border="0" cellspacing="1" cellpadding="2">
		<tr>
		<td>
			<b>
			<font color="#ffffff">
			&nbsp a d d &nbsp v i d e o &nbsp t o &nbsp d a t a b a s e
			</font>
Seblu's avatar
Seblu committed
			</b>
Seblu's avatar
Seblu committed
		</td>
Seblu's avatar
Seblu committed
		</tr>
Seblu's avatar
Seblu committed
	<tr>
Seblu's avatar
Seblu committed
	<td bgcolor="#303030">
Seblu's avatar
Seblu committed
	<table cellpadding="0" cellspacing="0" width="100%">
Seblu's avatar
Seblu committed
		<tr>
Seblu's avatar
Seblu committed
		    <form name="saisie" method="post" action="index.php?html=AdminHome&section_admin=AddVideo&vid_id='.$vid_id.'">
Seblu's avatar
Seblu committed
		    <TABLE CELLSPACING="0" CELLPADDING="10" BORDER="0">


 			    <TR>
			    <TD> Path de la Vid&eacute;o: </TD>
			    <TD>
		';

			if (isset($_REQUEST['file']))
			{
				$str .= '<INPUT TYPE="text" NAME="video_get_path" VALUE="'.$_REQUEST['file'].'" SIZE="50" MAXLENGTH="150">';
			}
			else
			{
				$str .= '<INPUT TYPE="text" NAME="video_get_path" VALUE="'.$vid_path.'" SIZE="50" MAXLENGTH="150">';
			}


		$str .= "
<a href=\"#\" onClick=\"window.open('admin/file_browser.php','_blank','toolbar=0,location=0,directories=0,status=0,scrollbars=1,resizable=0,copyhistory=0,menuBar=0,width=600,height=300');\"> Browser... </a>";

		$str .= '
			    <TR><TD> Path Dailymotion: </TD>
			    <TD> <INPUT TYPE="text" NAME="video_path_daily" VALUE="'.$video_path_daily.'" SIZE="50"> </TD>
			    </TR>
Seblu's avatar
Seblu committed

Seblu's avatar
Seblu committed
			    <TR>
			    <TD> Nom de la Vid&eacute;o: </TD>
			    <TD> <INPUT TYPE="text" NAME="video_get_name" VALUE="" SIZE="50" MAXLENGTH="52"> </TD>
			    </TR>
Seblu's avatar
Seblu committed

Seblu's avatar
Seblu committed
			';

Seblu's avatar
Seblu committed
$str .='
			    </TD>
			    </TR>
Seblu's avatar
Seblu committed

Seblu's avatar
Seblu committed
			    <TR><TD> Date de d&eacute;pot: </TD>
			    <TD> <INPUT TYPE="text" NAME="video_get_date" VALUE="'.$date.'" SIZE="8" MAXLENGTH="10"> </TD>
			    </TR>
Seblu's avatar
Seblu committed

Seblu's avatar
Seblu committed
			    <TR><TD>Cat&eacute;gorie</TD>
			    <TD>
			    <TABLE CELLSPACING"0" CELLPADDING="1" BORDER="0">
			   	 <TR> <TD>
				    <select name="video_type">
				    <option value="eptvprod">EPTv Production</option>
				    <option value="eptv.adm">EPTv.Adm</option>
				    <option value="eptvbonus">EPTv Bonus</option>
				    </TD></TR>
			    </TABLE>
			    </TD>
			    </TR>

			    <TR><TD>Commentaire: </TD>
			    <TD>
			    <TEXTAREA rows="3" cols="38" name="video_comment" ONFOCUS=""></textarea>
			    </TD>
			    </TR>
Seblu's avatar
Seblu committed

Seblu's avatar
Seblu committed
			    <TR><TD>Groupe Vid&eacute;o</TD>
			    <TD>
			    <TABLE CELLSPACING"0" CELLPADDING="1" BORDER="0">
				<TR> <TD>
				    <select name="video_tendu">
				    <option value=0>Public</option>
				    <option value=1>Tendu</option>
				    <option value=2>Priv&eacute;e</option>
				</TD></TR>
			    </TABLE>
			    </TD>
			    </TR>

			    <TR>
				    <TD>News</TD>
				    <TD>
				    <INPUT TYPE="checkbox" NAME="auto_www_news" VALUE = 1 checked> Poster une news automatique sur le site. (nom de la vid&eacute;o + date + commentaire + groupe)
				    </TD>
			    </TR>

			    <TR>
				    <TD> </TD>
				    <TD> <INPUT class="button" TYPE="submit" NAME="action" VALUE="  UPLOADER  "> </TD>
			    </TR>
			    <TR>
			 	   <TD> </TD>
				   <TD> <INPUT class="button" TYPE="reset" NAME="action" VALUE=" RESET "> </TD>
			    </TR>
		    </TABLE>
		</FORM>
		</TR>
	</TABLE>
	</TD>
	</TR>
</TABLE>
';


return $str;
}


function dispAdminModifVideos () {
Seblu's avatar
Seblu committed

Seblu's avatar
Seblu committed
$vid_id =$_GET['vid_id'];

$result = getOneVideo($vid_id);

Seblu's avatar
Seblu committed
$str = '
Seblu's avatar
Seblu committed
<table width="80%" border="0" cellspacing="0" cellpadding="0">
	<tr>
	<td bgcolor="#000000">
	<table width="100%" border="0" cellspacing="1" cellpadding="2">
		<tr>
		<td>
			<b>
			<font color="#ffffff">
			&nbsp m o d i f y &nbsp v i d e o
			</font>
Seblu's avatar
Seblu committed
			</b>
Seblu's avatar
Seblu committed
		</td>
Seblu's avatar
Seblu committed
		</tr>
Seblu's avatar
Seblu committed
	<tr>
Seblu's avatar
Seblu committed
	<td bgcolor="#303030">
Seblu's avatar
Seblu committed
	<table cellpadding="0" cellspacing="0" width="100%">
Seblu's avatar
Seblu committed
		<tr>
Seblu's avatar
Seblu committed
	';

  if (mysql_num_rows($result)){
Seblu's avatar
Seblu committed
    $video = mysql_fetch_array($result);
Seblu's avatar
Seblu committed
  }

  $str .= '
Seblu's avatar
Seblu committed
    <form name="saisie" method="post" action="index.php?html=AdminHome&section_admin=ModifVideo&vid_id='.$vid_id.'">
Seblu's avatar
Seblu committed
	    <TABLE CELLSPACING="0" CELLPADDING="10" BORDER="0">
Seblu's avatar
Seblu committed

Seblu's avatar
Seblu committed

			    <TR>
			    <TD> Path de la Vid&eacute;o: </TD>
			    <TD>
		';

			if (isset($_REQUEST['file']))
			{
				$str .= '<INPUT TYPE="text" NAME="video_get_path" VALUE="'.$_REQUEST['file'].'" SIZE="50" MAXLENGTH="150">';
			}
			else
			{
				$str .= '<INPUT TYPE="text" NAME="video_get_path" VALUE="'.$video["video_path"].'" SIZE="50" MAXLENGTH="150">';
			}


		$str .= "
<a href=\"#\" onClick=\"window.open('admin/file_browser.php','_blank','toolbar=0,location=0,directories=0,status=0,scrollbars=1,resizable=0,copyhistory=0,menuBar=0,width=600,height=300');\"> Browser... </a>";
Seblu's avatar
Seblu committed

Seblu's avatar
Seblu committed
$str .= '
			    <TR><TD> Path Dailymotion: </TD>
			    <TD> <INPUT TYPE="text" NAME="video_path_daily" VALUE="'.$video["video_path_daily"].'" SIZE="50"> </TD>
			    </TR>

 		   <TR><TD> Nom de la Vid&eacute;o: </TD>
		    <TD> <INPUT TYPE="text" NAME="video_get_upname" VALUE="'.$video["video_name"].'" SIZE="50" MAXLENGTH="52"> </TD>
		    </TR>
Seblu's avatar
Seblu committed

Seblu's avatar
Seblu committed
		    <TR><TD> Date de d&eacute;pot: </TD>
		    <TD> <INPUT TYPE="text" NAME="video_get_date" VALUE="'.$video["video_date"].'" SIZE="8" MAXLENGTH="10"> </TD>
		    </TR>
Seblu's avatar
Seblu committed

Seblu's avatar
Seblu committed
		    <TR><TD>Cat&eacute;gorie</TD>
		    <TD>
		    <TABLE CELLSPACING"0" CELLPADDING="1" BORDER="0">
			    <TR> <TD>
			    <select name="video_get_type">
			    <option value="eptvprod" '.get_selected_option("eptvprod",$video["video_type"]).' >EPTv Production</option>
			    <option value="eptv.adm" '.get_selected_option("eptv.adm",$video["video_type"]).' >EPTv.Adm</option>
			    <option value="eptvbonus" '.get_selected_option("eptvbonus",$video["video_type"]).' >EPTv Bonus</option>
			    </TD></TR>
		    </TABLE>
		    </TD>
		    </TR>

		    <TR><TD>Commentaire: </TD>
		    <TD>
		    <TEXTAREA rows="3" cols="38" name="video_get_comment" ONFOCUS="">'.$video["video_comment"].'</textarea>
		    </TD>
		    </TR>
Seblu's avatar
Seblu committed

Seblu's avatar
Seblu committed
		    <TR><TD>Groupe Vid&eacute;o</TD>
		    <TD>
		    <TABLE CELLSPACING"0" CELLPADDING="1" BORDER="0">
			    <TR> <TD>
				    <select name="video_get_tendu">
				    <option value="0" '.get_selected_option(0, $video["video_tendu"]).' >Public</option>
				    <option value="1" '.get_selected_option(1, $video["video_tendu"]).' >Tendu</option>
				    <option value="2" '.get_selected_option(2, $video["video_tendu"]).' >Priv&eacute;e</option>
			    </TD></TR>
	    	    </TABLE>
	    	    </TD>
	    	    </TR>
	';


Seblu's avatar
Seblu committed
	$str .= '
Seblu's avatar
Seblu committed
		    <TR><TD>Post&eacute;e par: </TD>
		    <TD>
		    ';

		$id_user = getOneUserById($video["video_user_id"]);

		if (mysql_num_rows($id_user)){
Seblu's avatar
Seblu committed
		    $id_user = mysql_fetch_array($id_user);
Seblu's avatar
Seblu committed
		}

		$str .= $id_user["user_pseudo"].'</TD></TR>


	    <TR>
	    <TD> </TD>
	    <TD> <INPUT class="button" TYPE="submit" NAME="action" VALUE="  UPDATE  "> </TD>
	    </TR>
	    <TR>
	    <TD> </TD>
	    <TD> <INPUT class="button" TYPE="reset" NAME="action" VALUE=" RESET "> </TD>
	    </TR>
Seblu's avatar
Seblu committed

Seblu's avatar
Seblu committed
    	</TABLE>
	</FORM>
	</TR>
   </TABLE>
   </TD>
   </TR>
</TABLE>
Seblu's avatar
Seblu committed

Seblu's avatar
Seblu committed
';

return $str;
}


function dispAdminDelVideos () {

  $vid_id =$_GET['vid_id'];

  $result = getOneVideo($vid_id);


Seblu's avatar
Seblu committed
$str = '
Seblu's avatar
Seblu committed
<table width="80%" border="0" cellspacing="0" cellpadding="0">
	<tr>
	<td bgcolor="#000000">
	<table width="100%" border="0" cellspacing="1" cellpadding="2">
		<tr>
		<td>
			<b>
			<font color="#ffffff">
			&nbsp d e l e t e &nbsp v i d e o
			</font>
Seblu's avatar
Seblu committed
			</b>
Seblu's avatar
Seblu committed
		</td>
Seblu's avatar
Seblu committed
		</tr>
Seblu's avatar
Seblu committed
	<tr>
Seblu's avatar
Seblu committed
	<td bgcolor="#303030">
Seblu's avatar
Seblu committed
	<table cellpadding="0" cellspacing="0" width="100%">
Seblu's avatar
Seblu committed
		<tr>
Seblu's avatar
Seblu committed
	';

	  if (mysql_num_rows($result)){
Seblu's avatar
Seblu committed
	    $video = mysql_fetch_array($result);
Seblu's avatar
Seblu committed
	  }

	  $str .= '
Seblu's avatar
Seblu committed
	    <form name="saisie" method="post" action="index.php?html=AdminHome&section_admin=DelVideo&vid_id='.$vid_id.'">
Seblu's avatar
Seblu committed
	    <TABLE CELLSPACING="0" CELLPADDING="10" BORDER="0">
Seblu's avatar
Seblu committed

Seblu's avatar
Seblu committed
		    <TR><TD> Nom de la Vid&eacute;o: </TD>
		    <TD>'.$video["video_name"].'</TD>
		    </TR>
Seblu's avatar
Seblu committed

Seblu's avatar
Seblu committed
		    <TR>
		    <TD> Path de la Vid&eacute;o: </TD>
		    <TD>
Seblu's avatar
Seblu committed

Seblu's avatar
Seblu committed
		     ' .$video["video_path"].'
Seblu's avatar
Seblu committed

Seblu's avatar
Seblu committed
		    </TD>
		    </TR>
Seblu's avatar
Seblu committed

Seblu's avatar
Seblu committed
		    <TR><TD> Date de d&eacute;pot: </TD>
		    <TD> '.$video["video_date"].'   '.$video["video_time"] .' </TD>
		    </TR>

		    <TR><TD>Cat&eacute;gorie: </TD>
		    <TD>
Seblu's avatar
Seblu committed
		    '.$video["video_type"].'
Seblu's avatar
Seblu committed

		    </TD>
		    </TR>

		    <TR><TD>Commentaire: </TD>
		    <TD>
		    '.$video["video_comment"].'
		    </TD>
		    </TR>
Seblu's avatar
Seblu committed

Seblu's avatar
Seblu committed
		    <TR><TD>Groupe Vid&eacute;o: </TD>
		    <TD>';

		  if ($video["video_tendu"] == 0){
		    $str .= 'Public</TD></TR>';
		  }
		  else if ($video["video_tendu"] == 1){
		    $str .= 'Tendu</TD></TR>';
		  }
		  else if ($video["video_tendu"] == 2){
		    $str .= 'Priv&eacute;e</TD></TR>';
		  }

Seblu's avatar
Seblu committed
		$str .= '
Seblu's avatar
Seblu committed
		    <TR><TD>Post&eacute;e par: </TD>
		    <TD>
		    ';

		$id_user = getOneUserById($video["video_user_id"]);

		if (mysql_num_rows($id_user)){
Seblu's avatar
Seblu committed
		    $id_user = mysql_fetch_array($id_user);
Seblu's avatar
Seblu committed
		}

		$str .= $id_user["user_pseudo"].'</TD></TR>';

		$str .= '
		    <TR>
		    <TD> </TD>
		    <TD> <INPUT class="button" TYPE="submit" NAME="action" VALUE="  SUPPRIMER  "> </TD>
Seblu's avatar
Seblu committed
		    </TR>
Seblu's avatar
Seblu committed
    	</TABLE>
	</FORM>
	</TR>
   </TABLE>
   </TD>
   </TR>
</TABLE>

';

return $str;
}


Seblu's avatar
Seblu committed
?>