<?php


// To select correct option by default
function get_selected_option($option, $right)
{
	if ($option == $right)
	{
		return "selected";
	}
}

// Test if checkbox selected
function get_mailing_checkbox($checked)
{
	if ($checked == 1)
	{
		return "checked";
	}
}



function get_right_name($right)
{
	if ($right == 1)
		return "Basic";
	else if ($right == 2)
		return "Guest";	
	else if ($right == 3)
		return "";	
	else if ($right == 4)
		return "EpiReg";	
	else if ($right == 5)
		return "Reporter";	
	else if ($right == 6)
		return "Priv Guest";	
	else if ($right == 7)
		return "EPTV";	
	else if ($right == 8)
		return "Root EPTV";
}




function get_date(){ // récupère la date

  $date = "";
  if (strlen($date_court) < 2) {
    $date = $date_court;
  }
  $date .= date("Y/m/d");

  return ($date);
}


function get_filesize($path)
{
   $size = round(filesize($path)/1000000);
   return ($size);
}


function get_time(){ // récupère l'heure

  $time = date("h:i");

  return($time);
}

//Try PHP header redirect, then Java redirect, then try http redirect.:
function redirect($url) {
  if (!headers_sent()) {
    //If headers not sent yet... then do php redirect
    header('Location: '.$url);
    exit;
  }
  else {
    //If headers are sent... do java redirect... if java disabled, do html redirect.
    echo '<script type="text/javascript">';
    echo 'window.location.href="'.$url.'";';
    echo '</script>';
    echo '<noscript>';
    echo '<meta http-equiv="refresh" content="0;url='.$url.'" />';
    echo '</noscript>';
    exit;
  }
}

?>