* @author Loic Vinet
"; if($previous <> '' || $next <> '') { if(empty($previous)) { $previous = " "; } if(empty($next)) { $next = " "; } $page_list1 .= $previous." ".$next.'
'));" > |
'));" > |
"prop" && $mode <> "add") { echo $func->show($_SESSION['m_admin']['services']['ID']); ?> *
*
"; include_once($_SESSION['config']['includedir']."/addon_collectivities.php"); show_entities_list_in_formservice($entities,$selected_entities); echo ""; } ?>
*
*
'));" > |
*
';
$allowedTags.='
";
}
$_SESSION['m_admin']['model']['LABEL'] = $func->wash($_REQUEST['model_name'], "no", _THE_WORDING);
$_SESSION['m_admin']['model']['LABEL'] = trim(stripslashes($_SESSION['m_admin']['model']['LABEL']));
$_SESSION['m_admin']['model']['COMMENT'] = "";
if(!empty($_REQUEST['model_comment']) && isset($_REQUEST['model_comment']))
{
$_SESSION['m_admin']['model']['COMMENT'] = trim(stripslashes($_REQUEST['model_comment']));
}
if($_REQUEST['mode'] == "up")
{
$_SESSION['m_admin']['model']['ID'] = $func->wash($_REQUEST['model_id'], "no", _ID);
}
//if(count($_SESSION['m_admin']['model']['SERVICES']) < 1)
//{
// $_SESSION['error'] .= _ATTACH_MODEL_TO_DEP.".
";
//}
}
/**
* Update the database with the model data
*
*/
public function upmodel()
{
$this->modelinfo();
if(!empty($_SESSION['error']))
{
if($_REQUEST['mode'] == "up")
{
if(!empty($_SESSION['m_admin']['model']['ID']))
{
header("location: index.php?page=model_up&id=".$_SESSION['m_admin']['label']['ID']);
exit;
}
else
{
header("location: index.php?page=models");
exit;
}
}
elseif($_REQUEST['mode'] == "add" )
{
header("location: index.php?page=model_add");
exit;
}
}
else
{
$this->connect();
if( $_REQUEST['mode'] <> "add")
{
$this->query("update `".$_SESSION['tablename']['models']."` set LABEL = '".addslashes($_SESSION['m_admin']['model']['LABEL'])."' , COMMENT = '".addslashes($_SESSION['m_admin']['model']['COMMENT'])."', CONTENT = '".$_SESSION['m_admin']['model']['CONTENT']."' where ID = '".$_SESSION['m_admin']['model']['ID']."'");
$this->query("Delete from ".$_SESSION['tablename']['model_service']." where ID_MODEL = '".$_SESSION['m_admin']['model']['ID']."'");
for($i=0; $i < count($_SESSION['m_admin']['model']['SERVICES']);$i++)
{
$this->query("insert into ".$_SESSION['tablename']['model_service']." ( ID_SERVICE, ID_MODEL ) VALUES ( '".$_SESSION['m_admin']['model']['SERVICES'][$i]['ID']."', ".$_SESSION['m_admin']['model']['ID'].")");
}
if($_REQUEST['mode'] == "up")
{
$_SESSION['error'] = _MODEL_MODIFICATION;
if($_SESSION['history']['modelsup'] == "true")
{
require("class_history.php");
$users = new history();
$users->add($_SESSION['tablename']['models'], $_SESSION['m_admin']['model']['ID'],"UP",_MODEL_MODIFICATION." : ".$_SESSION['m_admin']['model']['LABEL']);
}
}
$this->clearmodelinfos();
header("location: index.php?page=models");
exit;
}
else
{
$this->query("select LABEL from ".$_SESSION['tablename']['models']." where LABEL = '".addslashes($_SESSION['m_admin']['model']['LABEL'])."'");
if($this->nb_result() > 0)
{
$_SESSION['error'] = _THE_MODEL.' '.$_SESSION['m_admin']['model']['LABEL'].' '._ALREADY_EXISTS;
header("location: index.php?page=model_add");
exit;
}
else
{
require("class_history.php");
$users = new history();
if( $_REQUEST['mode'] == "add")
{
$this->query("INSERT INTO ".$_SESSION['tablename']['models']." ( LABEL, CREATION_DATE, COMMENT, CONTENT ) VALUES ( '".addslashes($_SESSION['m_admin']['model']['LABEL'])."', now(),'".addslashes($_SESSION['m_admin']['model']['COMMENT'])."', '".$_SESSION['m_admin']['model']['CONTENT']."')");
$this->query("select ID from ".$_SESSION['tablename']['models']." where LABEL = '".addslashes($_SESSION['m_admin']['model']['LABEL'])."' and COMMENT = '".addslashes($_SESSION['m_admin']['model']['COMMENT'])."' and CONTENT = '".$_SESSION['m_admin']['model']['CONTENT']."'");
$res = $this->fetch_object();
$_SESSION['m_admin']['model']['ID'] = $res->ID;
if($_SESSION['history']['modelsadd'] == "true")
{
$users->add($_SESSION['tablename']['models'], $_SESSION['m_admin']['model']['ID'],"ADD", _MODEL_ADDED." : ".$_SESSION['m_admin']['model']['LABEL']);
}
}
// $this->query("Delete from ".$_SESSION['tablename']['model_service']." where ID = ".$_SESSION['m_admin']['model']['ID']);
for($i=0; $i < count($_SESSION['m_admin']['model']['SERVICES']);$i++)
{
$this->query("insert into ".$_SESSION['tablename']['model_service']." (ID_MODEL, ID_SERVICE ) VALUES (".$_SESSION['m_admin']['model']['ID'].", '".$_SESSION['m_admin']['model']['SERVICES'][$i]['ID']."' )");
}
$_SESSION['error'] = _MODEL_ADDED;
}
$_SESSION['error'] = "";
}
if ($_REQUEST['mode'] == "add")
{
$url = "index.php?page=models";
}
$this->clearmodelinfos();
header("location: ".$url);
exit;
}
}
/**
* replace the defined fields in the instance of the model
*
* @param string $content model content
*/
public function fields_replace($content)
{
$content = str_replace("[REF_COURRIER]", $_SESSION['courrier']['identifier'], $content);
$content = str_replace("[NO_AFFAIRE]", $_SESSION['courrier']['res_id'], $content);
$content = str_replace("[CIV_EMETTEUR]", $_SESSION['courrier']['civ'], $content);
$content = str_replace("[NOM_EMETTEUR]", $_SESSION['courrier']['author'], $content);
$content = str_replace("[PRENOM_EMETTEUR]", $_SESSION['courrier']['prenom'], $content);
$content = str_replace("[SOCIETE_EMETTEUR]", $_SESSION['courrier']['societe'], $content);
$content = str_replace("[OBJET]", $_SESSION['courrier']['description'], $content);
$content = str_replace("[TYPE]", $_SESSION['courrier']['type_id'], $content);
$content = str_replace("[DATE_LIM]", $_SESSION['courrier']['date_limite'], $content);
$content = str_replace("[DATE_ARRIVEE]", $_SESSION['courrier']['date_arrivee'], $content);
$content = str_replace("[NATURE]", $_SESSION['courrier']['nature'], $content);
$this->query("select SERVICE from ".$_SESSION['tablename']['services']." where ID = '".$_SESSION['courrier']['service']."'");
$res = $this->fetch_object();
$content = str_replace("[SERVICE]", $res->SERVICE, $content);
$content = str_replace("[NEW_EMETTEUR]", $_SESSION['user']['FirstName'].' '.$_SESSION['user']['LastName'], $content);
$content = str_replace("[PHONE_EMETTEUR]", $_SESSION['user']['Phone'], $content);
$content = str_replace("[MAIL_EMETTEUR]", $_SESSION['user']['Mail'], $content);
$content = str_replace("[DEP_EMETTEUR]", $_SESSION['user']['department'], $content);
$content = str_replace("[REP_COURRIER_SIMPLE]", $_SESSION['courrier']['rep_courrier_simple'], $content);
$content = str_replace("[REP_DIRECT]", $_SESSION['courrier']['rep_direct'], $content);
$content = str_replace("[REP_MAIL]", $_SESSION['courrier']['rep_mail'], $content);
$content = str_replace("[REP_AR]", $_SESSION['courrier']['rep_AR'], $content);
$content = str_replace("[REP_FAX]", $_SESSION['courrier']['rep_fax'], $content);
$content = str_replace("[REP_AUTRE]", $_SESSION['courrier']['rep_autre'], $content);
$content = str_replace("[NOTES_TRAIT]", $_SESSION['courrier']['notes'], $content);
$content = str_replace("[QUALITE]", $_SESSION['courrier']['qualite'], $content);
$content = str_replace("[NUM_RUE]", $_SESSION['courrier']['num_rue'], $content);
$content = str_replace("[RUE]", $_SESSION['courrier']['rue'], $content);
$content = str_replace("[VILLE]", $_SESSION['courrier']['ville'], $content);
$content = str_replace("[CODE_POSTAL]", $_SESSION['courrier']['code'], $content);
$content = str_replace("[DATE_TODAY]", date("d-m-Y"), $content);
return $content;
}
/**
* delete a model in the database
*
* @param string $id model identifier
*/
public function delmodel($id)
{
if(!empty($_SESSION['error']))
{
header("location: index.php?page=models");
exit;
}
else
{
$this->connect();
$this->query("select ID, LABEL from ".$_SESSION['tablename']['models']." where ID = ".$id);
if($this->nb_result() == 0)
{
$_SESSION['error'] = _MODEL.' '._UNKNOWN;
header("location: index.php?page=models");
exit;
}
else
{
$res = $this->fetch_object();
$label = $res->LABEL;
$this->query("delete from ".$_SESSION['tablename']['models']." where ID = ".$id);
$this->query("delete from ".$_SESSION['tablename']['model_service']." where ID_MODEL = ".$id);
if($_SESSION['history']['modelsdel'])
{
require("class_history.php");
$users = new history();
$users->add($_SESSION['tablename']['models'], $id,"DEL",_MODEL_DELETION." : ".$label);
}
$_SESSION['error'] = _DELETED_MODEL;
header("location: index.php?page=models");
exit;
}
}
}
/**
* delete a model in the database
*
* @param string $id model identifier
*/
public function delemet($id)
{
if(!empty($_SESSION['error']))
{
header("location: index.php?page=emet");
exit;
}
else
{
$this->connect();
$this->query("select ID from ".$_SESSION['tablename']['senders']." where ID = ".$id);
if($this->nb_result() == 0)
{
$_SESSION['error'] = _SHIPPER.' '._UNKNOWN;
header("location: index.php?page=emet");
exit;
}
else
{
$res = $this->fetch_object();
$label = $res->LABEL;
$this->query("delete from ".$_SESSION['tablename']['senders']." where ID = ".$id);
$_SESSION['error'] = _SHIPPER." ".strtolower(_DELETED);
header("location: index.php?page=emet");
exit;
}
}
}
/**
* delete a model in the database
*
* @param string $id model identifier
*/
public function delsender($id)
{
if(!empty($_SESSION['error']))
{
header("location: index.php?page=sender");
exit;
}
else
{
$this->connect();
$this->query("select ID from ".$_SESSION['tablename']['senders']." where ID = ".$id);
if($this->nb_result() == 0)
{
$_SESSION['error'] = _SENDER.' '._UNKNOWN;
header("location: index.php?page=sender");
exit;
}
else
{
$res = $this->fetch_object();
$label = $res->LABEL;
$this->query("delete from ".$_SESSION['tablename']['senders']." where ID = ".$id);
$_SESSION['error'] = _SENDER." ".strtolower(_DELETED);
header("location: index.php?page=sender");
exit;
}
}
}
/**
* List of the out mail basket
*
* @param array $listarr contains the document index of the out basket
* @param int $nb_total number of document
* @param string $title title
* @param string $name page name
*/
public function mail_out($listarr, $nb_total, $title, $name)
{
$_SESSION['diff'] = array();
$_SESSION['error'] = '';
// show the document list in result of the search
$page_list1 = "";
$page_list2 = "";
$func = new functions();
if(isset($_REQUEST['start']))
{
$start = strip_tags($_REQUEST['start']);
}
else
{
$start = 0;
}
if(isset($_GET['order']))
{
$orderby = strip_tags($_GET['order']);
}
else
{
$orderby = 0;
}
$link = "index.php?page=".$name;
// define the defaults values
$nb_show = $_SESSION['config']['nblinetoshow'];
$nb_pages = ceil($nb_total/$nb_show);
// if they are more than 1 page we do pagination with 2 forms
if($nb_pages > 1)
{
$next_start = 0;
$page_list1 = '
query("select * from ".$_SESSION['tablename']['listinstance']." where res_id = ".$res_id);
if($this->nb_result() < 1)
{
$this->query("insert into ".$_SESSION['tablename']['listinstance']." (res_table, res_id, sequence, user_id, by_user_id) values ('res_x', ".$res_id.", 1, '".$user_id."','".$_SESSION['user']['UserId']."')");
//$this->show();
}
else
{
$this->query("update ".$_SESSION['tablename']['listinstance']." set user_id = '".$user_id."', by_user_id = '".$_SESSION['user']['UserId']."' where res_id = ".$res_id." and res_table = 'res_x' and sequence = 1");
//$this->show();
}
//exit();
}
/**
* delete a note in the database
*
* @param string $id note identifier
*/
public function delnote($id, $resid)
{
if(!empty($_SESSION['error']))
{
?>
connect();
$this->query("select ID from ".$_SESSION['tablename']['notes']." where ID = ".$id." and USER_ID = '".$_SESSION['user']['UserId']."'");
if($this->nb_result() == 0)
{
$_SESSION['error'] = _CANT_DELETE_NOTE;
header("location: index.php?page=details&id=".$resid);
exit;
}
else
{
$res = $this->fetch_object();
$label = $res->LABEL;
$this->query("delete from ".$_SESSION['tablename']['notes']." where ID = ".$id);
//Mise � jour de l'historique
if($_SESSION['history']['notesdel'])
{
require_once("class_history.php");
$hist = new history();
$hist->add($_SESSION['tablechoice'], $resid ,"DEL", _DELETION_NOTE);
}
header("location: notes_courrier.php?id=".$resid);
exit;
}
}
}
public function increment_viewed_var($res_table, $res_id, $user_id)
{
if(!empty($res_table) && !empty($res_id) && !empty($user_id))
{
$this->connect();
$this->query("select viewed from ".$_SESSION['tablename']['listinstance']." where res_table ='".$res_table."' and res_id = ".$res_id." and user_id = '".$user_id."'");
if($this->nb_result() == 0)
{
return false;
}
else
{
$res = $this->fetch_object();
$viewed = $res->viewed;
$viewed ++;
$this->query("update ".$_SESSION['tablename']['listinstance']." set viewed = ".$viewed." where res_table ='".$res_table."' and res_id = ".$res_id." and user_id = '".$user_id."'");
//$this->show();
return true;
}
}
else
{
return false;
}
}
public function access_locked($res_id, $res_table)
{
$access = false;
$this->connect();
$this->query("select reserved, dest_user from ".$res_table." where res_id = ".$res_id );
$res = $this->fetch_object();
$reserved = $res->reserved;
$dest_user = $res->dest_user;
if($reserved == 'Y')
{
if($dest_user == $_SESSION['user']['UserId'])
{
$access = true;
}
}
else
{
$access = true;
}
return $access;
}
public function is_locked($res_id, $res_table, $time, $update_listinstance='false')
{
$nextime = time() + ($time * 60);
$this->connect();
$this->query("select reserved, dest_user from ".$res_table." where res_id = ".$res_id );
$res = $this->fetch_object();
$reserved = $res->reserved;
$dest_user = $res->dest_user;
$locked = false;
if($reserved == 'Y')
{
if($dest_user == $_SESSION['user']['UserId'])
{
$this->query("update ".$_SESSION['tablename']['param']." set value = '".$nextime."' where key1 = '".$res_table."' and key2 = '".$res_id."' and id = 'affaire_reservee'");
$this->query("update ". $res_table." set reserved = 'Y', dest_user = '".$_SESSION['user']['UserId']."' where res_id = ".$res_id );
//$this->show();
}
else
{
$locked = true;
}
}
else
{
$this->query("update ". $res_table." set reserved = 'Y', dest_user = '".$_SESSION['user']['UserId']."' where res_id = ".$res_id );
//We need to update list_instance too
if($update_listinstance =='true')
{
$tagged = false;
$tagged_value = '';
for($j=1;$j < (count($_SESSION['diff_locked']) + 1); $j++)
{
if ($_SESSION['diff_locked'][$j-1]['UserID'] == $_SESSION['user']['UserId'])
{
$tagged=true;
$tagged_value = $j-1;
}
}
$new_value=false;
//If tagged is true, we need to switch dest_user
if ($tagged == true)
{
$rang = $tagged_value;
$temp = $_SESSION['diff_locked'][$rang];
$_SESSION['diff_locked'][$rang] = $_SESSION['diff_locked'][0];
$_SESSION['diff_locked'][0] = $temp;
}
else
//Else, we need to add a new occur in first position
{
if (count($_SESSION['diff_locked'])>0)
{
$temp = $_SESSION['diff_locked'][0];
$new_value=true;
}
$_SESSION['diff_locked'][0]['UserID'] = $_SESSION['user']['UserId'];
$_SESSION['diff_locked'][0]['LastName'] = $_SESSION['user']['LastName'];
$_SESSION['diff_locked'][0]['FirstName'] = $_SESSION['user']['FirstName'];
$_SESSION['diff_locked'][0]['Service'] = $_SESSION['user']['department'];
if ($new_value==true)
{
array_push($_SESSION['diff_locked'], $temp);
}
}
// Finally we can launch the standard diffusion process
//Store the old viewed and by_user_id values
$mem_by_user_id = array();
$mem_viewed = array();
for($j=1;$j < (count($_SESSION['diff_locked']) + 1); $j++)
{
$this->query("SELECT USER_ID, BY_USER_ID, VIEWED
FROM ".$_SESSION['tablename']['listinstance']."
WHERE res_id = ".$res_id." and user_id = '".$_SESSION['diff_locked'][$j-1]['UserID']."'");
if($result = $this->fetch_object())
{
$mem_viewed[$result->USER_ID] = $result->VIEWED;
$mem_by_user_id[$result->USER_ID] = $result->BY_USER_ID;
}
}
//Delete listInstance
$this->query("DELETE from ".$_SESSION['tablename']['listinstance']." where res_id = ".$res_id);
//Insert into listinstance the new mailing list with the values of viewed and by_user_id saved before
for($j=1; $j < ( count($_SESSION['diff_locked']) + 1 ); $j++ )
{
$viewed = 0;
$by_user_id = $_SESSION['user']['UserId'];
if( isset($mem_viewed[$_SESSION['diff_locked'][$j-1]['UserID']] ) )
{
$viewed = $mem_viewed[$_SESSION['diff_locked'][$j-1]['UserID']];
$by_user_id = $mem_by_user_id[$_SESSION['diff_locked'][$j-1]['UserID']];
}
$this->query("INSERT INTO ".$_SESSION['tablename']['listinstance']."
( RES_TABLE, RES_ID, SEQUENCE, USER_ID, VIEWED, BY_USER_ID )
VALUES ('res_x',".$res_id.",".$j.",'".$_SESSION['diff_locked'][$j-1]['UserID']."',".$viewed.",'".$by_user_id."')");
}
}
//$this->show();
$this->query("insert into ".$_SESSION['tablename']['param']." (key1, key2, id, value) values ( '".$res_table."', '".$res_id."', 'affaire_reservee', '".$nextime."')");
//$this->show();
}
return $locked;
}
public function test_reserved_time($res_id, $res_table)
{
$reserved = false;
$this->connect();
$this->query("select value from ".$_SESSION['tablename']['param']." where key1 = '".$res_table."' and key2 = '".$res_id."' and id = 'affaire_reservee'");
$res = $this->fetch_object();
$timestamp = $res->value;
// Reserved time expired
if( ($timestamp - mktime( date("H") , date("i") , date("s") , date("m") , date("d") , date("Y"))) < 0 )
{
$this->query("update ".$res_table." set reserved = 'N' where res_id = ".$res_id);
$this->query("delete from ".$_SESSION['tablename']['param']." where key1 = '".$res_table."' and key2 = '".$res_id."' and id = 'affaire_reservee'");
}
// Reserved time not yet expired
else
{
$reserved = true;
}
return $reserved;
}
public function mail_attachement($to,
$cc='',
$cci='',
$subject,
$message,
$tabDocJoin ,
$reply ='',
$from = '',
$fromName = ''
)
{
require_once($_SESSION['config']['path_to_php_mailer']."/class.phpmailer.php");
require_once($_SESSION['config']['path_to_php_mailer']."/class.smtp.php");
$mail = new PHPMailer(true); // defaults to using php "mail()"
//Mail Is SMTP
if($_SESSION['config']['mail_is_smtp'] == "true")
{
$mail->IsSMTP();
$mail->Host = $_SESSION['config']['mail_host'];
if($_SESSION['config']['mail_smtp_auth'] == "true")
{
$mail->SMTPAuth = true;
$mail->Username = $_SESSION['config']['mail_user'];
$mail->Password = $_SESSION['config']['mail_password'];
}
else
{
$mail->SMTPAuth = false;
}
}
//$body = eregi_replace("[\]",'',$message);
$mail->AddReplyTo($reply);
$mail->CharSet = "utf-8";
$mail->From = $from;
$mail->FromName = $fromName;
$mail->AddAddress($to);
if (!empty($cc))
{
$mail->AddCC($cc);
}
if (!empty($cci))
{
$mail->AddBCC($cci);
}
$mail->Subject = $subject;
$mail->Body = $message;
//$mail->MsgHTML($body);
if (count($tabDocJoin) >0)
{
foreach ($tabDocJoin as $fichier)
{
$mail->AddAttachment($fichier['PATH'],$fichier['NAME'],'base64',$fichier['TYPEMIME']);
}
}
if (!$mail->Send())
{
return $mail->ErrorInfo;
}
else
{
return true;
}
}
public function getCountLetter($service_id)
{
$this->connect();
$this->query("SELECT COUNT(*) AS NBR_LETTER FROM res_x WHERE DESTINATION = '$service_id' AND (STATUS <> 'END' AND STATUS <> 'DEL' AND STATUS <> 'ATT' AND STATUS <> 'VAL') AND IS_FOLDER = 'Y' ");
$res = $this->fetch_object();
return $res->NBR_LETTER;
}
public function getBoroughLabel($borough_id)
{
$this->connect();
$this->query("SELECT BOROUGH_LABEL FROM ".$_SESSION['tablename']['borough']." WHERE BOROUGH_ID = '".$borough_id."' ");
$res = $this->fetch_object();
return $res->BOROUGH_LABEL;
}
public function getCantonLabel($canton_id)
{
$this->connect();
$this->query("SELECT CANTON_LABEL FROM ".$_SESSION['tablename']['cantons']." WHERE CANTON_ID = '".$canton_id."' ");
$res = $this->fetch_object();
return $res->CANTON_LABEL;
}
public function getEpciLabel($epci_id)
{
$this->connect();
$this->query("SELECT EPCI_LABEL FROM ".$_SESSION['tablename']['epci']." WHERE EPCI_ID = '".$epci_id."' ");
$res = $this->fetch_object();
return $res->EPCI_LABEL;
}
public function getCommuneLabel($commune_id)
{
$this->connect();
$this->query("SELECT COMMUNE_LABEL FROM ".$_SESSION['tablename']['communes']." WHERE COMMUNE_ID = '".$commune_id."' ");
$res = $this->fetch_object();
return $res->COMMUNE_LABEL;
}
public function get_file($res_id, $table)
{
$this->connect();
$this->query("SELECT IDENTIFIER from ".$table." where RES_ID = ".$res_id);
if($this->nb_result() < 1)
{
$_SESSION['error'] .= _DOC_NOT_FOUND.'
';
$the_file = false;
}
else
{
if($this->nb_result() > 1)
{
$_SESSION['error'] .= _DOUBLED_DOC.'
';
$the_file = false;
}
else
{
$this->query("SELECT RES_ID, DOCSERVER_ID, PATH, FILENAME, FORMAT FROM ".$table." where RES_ID = ".$res_id);
//$this->show();
$line = $this->fetch_object();
$docserver_id = $line->DOCSERVER_ID;
$path = $line->PATH;
$filename = $line->FILENAME;
$format = $line->FORMAT;
$this->query("select PATH_TEMPLATE from ".$_SESSION['tablename']['docservers']." where DOCSERVER_ID = '".$docserver_id."'");
//$this->show();
$line_doc = $this->fetch_object();
$docserver = $line_doc->PATH_TEMPLATE;
if ($docserver_id == 'aidocserver')
{
$file = $docserver.$path.strtoupper($filename);
}
else
{
$file = $docserver.$path.strtolower($filename);
}
$file = str_replace("#",DIRECTORY_SEPARATOR,$file);
//echo $file;
if(file_exists($file))
{
require("load_extensions.php");
$mime_type = '';
for($i=0;$i