*/ session_name('LetterBox2'); session_start(); if(file_exists($_SESSION['config']['lang'].'.php')) { include($_SESSION['config']['lang'].'.php'); } else { $_SESSION['error'] = "Language file missing...
"; } require("class_functions.php"); require_once("class_db.php"); require_once("test_page.php"); $function = new functions(); if(isset($_GET['id'])) { $s_id = $_GET['id']; } else { $s_id = ""; } $s_id = $function->wash($_GET['id'], "num", _THE_DOC); if(!empty($_SESSION['error'])) { header("location: index.php"); exit; } else { $connexion = new dbquery(); $connexion->connect(); $table =""; if(isset($_SESSION['tablechoice']) && !empty($_SESSION['tablechoice'])) { $table = $_SESSION['tablechoice']; } else { $table = $_SESSION['ressources'][0]['tablename']; } $where2 = ""; $connexion->query("SELECT IDENTIFIER from ".$table." where RES_ID = ".$s_id); if($connexion->nb_result() < 1) { $_SESSION['error'] = _DOC_NOT_FOUND; header("location: index.php"); exit; } else if( $connexion->nb_result() > 1) { $_SESSION['error'] = _DOUBLED_DOC; header("location: index.php"); exit; } $where2 =''; //if($_SESSION['origin'] == "validation") //{ $res = $connexion->fetch_object(); $connexion->query("SELECT USER_ID from ".$_SESSION['tablename']['listinstance']." where RES_TABLE = '".$table."' and RES_ID = ".$s_id." and USER_ID = '".$_SESSION['user']['UserId']."'"); //$connexion->show(); //exit(); if($connexion->nb_result() < 1) { $par_disp = false; for($i=0; $i < count($_SESSION['user']['security']); $i++) { if($_SESSION['tablechoice'] == $_SESSION['user']['security'][$i]['table']) { $where2 = " and ( ".$_SESSION['user']['security'][$i]['where']." "; } } if (eregi( '\(' , $where2)) { $par_disp = true; } $where2 .= " or DESTINATION = ''"; if ($par_disp == true) $where2 .= ")"; } //} $connexion->query("SELECT RES_ID, DOCSERVER_ID, PATH, FILENAME, FORMAT, CUSTOM_T1 as DEPARTMENT, SOURCE, STATUS, RELATION FROM ".$table." where RES_ID = ".$s_id." ".$where2); if($connexion->nb_result() == 0) { $_SESSION['error'] = _NO_DOC_OR_NO_RIGHTS."..."; header("location: index.php"); exit; } else { $line = $connexion->fetch_object(); $department = $line->DEPARTMENT; $docserver = $line->DOCSERVER_ID; $path = $line->PATH; $filename = $line->FILENAME; $format = $line->FORMAT; $source = $line->SOURCE; $status = $line->STATUS; $filesize = $line->FILESIZE; $relation = $line->RELATION; $docserver_id = $line->DOCSERVER_ID; $rel_status = ''; if($status == 'REP' && $source == 'Editor') { $connexion->query('select STATUS from res_x where RES_ID = '.$relation); $res = $connexion->fetch_object(); $rel_status = $res->STATUS; } $connexion->query("select PATH_TEMPLATE from ".$_SESSION['tablename']['docservers']." where DOCSERVER_ID = '".$docserver."'"); //$connexion->show(); $line_doc = $connexion->fetch_object(); $docserver = $line_doc->PATH_TEMPLATE; if ($docserver_id == 'aidocserver') { $file = $docserver.$path.strtoupper($filename); } else { $file = $docserver.$path.strtolower($filename); } if ($_SESSION['config']['system'] == "true") { $file = str_replace("#","/",$file); } else { $file = str_replace("#","\\",$file); } //Begin writing headers //echo $file; if($format == "MAARCH") { if(file_exists($file)) { $myfile = fopen($file, "r"); $data = fread($myfile, filesize($file)); fclose($myfile); $content = stripslashes($data); ?>
<? echo $title;?>