Révision d072e29c src/headers.php

b/src/headers.php
78 78
    <li id="wwwblast"><a href="wwwblast.php"> wwwBlast </a></li>
79 79
    <li id="antibodies"><a href="antibodies.php"> Antibodies </a></li>
80 80
    <li id="collections"><a href="collections.php"> Collections </a></li>
81
    <li id="pipethistory"><a href="pipethistory.php"> Pipet History </a></li>
81
    <li id="pip_stock"><a href="pip_stock.php"> Pipets </a></li>
82
    <li id="pip_history"><a href="pip_history.php"> Pipet History </a></li>
82 83
    <li id="notebooks"><a href="notebooks.php"> Lab's Notebooks </a></li>
83 84
    <li id="logout"><a href="logout.php"> Logout </a></li>
84 85
    <li id="admin"><a href="admin.php"> Admin </a></li>
......
95 96
</script>
96 97

  
97 98

  
99

  
98 100
<?php
99 101

  
100
$tb = split(".",array_reverse(split("/",$_SERVER["SCRIPT_FILENAME"]))[0])[0]
102
$to_be_post_list_content = "";
103
$to_be_pre_list_content = "";
104
// print($_SERVER["SCRIPT_FILENAME"]);
105

  
106

  
107
$tb = array_shift(split("\.php", array_pop(split("/", $_SERVER["SCRIPT_FILENAME"]))));
101 108
/*************************/
102 109
//
103 110
// Connect to DB and 
......
106 113
/*************************/
107 114

  
108 115
require_once ("connect_entry.php");
109
require_once ("session.php");
116
require_once ("lib/session.lib.php");
110 117
// connect to DB
111 118
$connexion = mysql_pconnect (SERVEUR, NOM, PASSE);
112 119
if (!$connexion)
......
119 126
 echo "Sorry, connexion to database " . BASE . " failed\n";
120 127
 exit;
121 128
}
122
// authentification
123
CleanOldSessions($connexion);
124
$session = ControleAcces ("antibodies.php", $_POST, session_id(), $connexion);
125
if (!is_object($session)) {
126
	exit;
129

  
130
if (!(in_array($tb, array("home", "")))) {
131
  // authentification
132
  CleanOldSessions($connexion);
133
  $session = control_access ($tb.".php", $_POST, session_id(), $connexion);
134
  if (!is_object($session)) {
135
  	exit;
136
  }
137

  
138
  // According to login:
139
  // Define priviledge options
140
  // to pass to phpMyEdit
141
  //
142
  //check that visitor is allowed to use this table
143
  if ($tb == "admin" && $session->mode != "super") {
144
    echo "<p>Sorry, your session is not granted access to admin panel. Please logout and try again with appropriate login...</p>";
145
    exit;
146
  } else if ($session->target_table != $tb && $session->target_table != "all") {
147
    echo "<p>Sorry, your session is not granted access to table <B> $tb </B> in <B>$session->mode</B> mode (login must be <b>$session->mode$tb</b>). Please logout and try again with appropriate login...</p>";
148
    exit;
149
  }
150
  //define priv options and display warning accordingly
151
  if ($session->login == "superuser"){
152
  	$privopt = 'ACPVDF';
153
  	$colorband = "red";
154
  	$messageband = '<blink>WARNING</bink>: You are in <I><B> SUPERUSER </I></B> mode, at your own risk.';
155
  } else if ($session->mode == "view"){
156
  	$privopt = 'VF';
157
  	$colorband = "#00ff00";
158
  	$messageband = "You are safely in VIEW mode";
159
  } else if ($session->mode == "add"){
160
  	$privopt = 'APVF';
161
  	$colorband = "orange";
162
  	$messageband = 'You are in <I><B> ADD </I></B> mode, please logout after you additions';
163
  } else if ($session->mode == "edit"){
164
  	$privopt = 'ACPVDF';
165
  	$colorband = "rgb(250,0,255)";
166
  	$messageband = 'IMPORTANT: You are in <I><B> EDIT </I></B> mode, please logout after editing.';
167
  } else{
168
  	$privopt = '';
169
  	$colorband = "grey";
170
  }
171
  echo '<style type="text/css"> ';
172
  echo	"h4 {background-color: $colorband }";
173
  echo '</style>';
174
  echo "<h4> $messageband </h4>";
175
  echo "<HR>";
127 176
}
177
// Fix a problem displaying
178
// symbols (such as delta)
179
mysql_query("SET NAMES 'UTF8'", $connexion);
180

  
181
// // Include My own MVC (FCh.)
182
// $mvc_filename = $tb . ".MVC.php";
183
// if (file_exists($mvc_filename)) {
184
//   require($mvc_filename);
185
// } 
186

  
187
// Number of records to display on the screen
188
// Value of -1 lists all records in a table
189
$opts['inc'] = 15;
190

  
191
// Number of lines to display on multiple selection filters
192
$opts['multiple'] = '4';
193

  
194
// Navigation style: B - buttons (default), T - text links, G - graphic links
195
// Buttons position: U - up, D - down (default)
196
$opts['navigation'] = 'UDBG';
197

  
198
// Display special page elements
199
$opts['display'] = array(
200
	'form'  => true,
201
	'query' => true,
202
	'sort'  => true,
203
	'time'  => true,
204
	'tabs'  => true
205
);
206

  
207
// Set default prefixes for variables
208
$opts['js']['prefix']               = 'PME_js_';
209
$opts['dhtml']['prefix']            = 'PME_dhtml_';
210
$opts['cgi']['prefix']['operation'] = 'PME_op_';
211
$opts['cgi']['prefix']['sys']       = 'PME_sys_';
212
$opts['cgi']['prefix']['data']      = 'PME_data_';
213

  
214
/* Get the user's default language and use it if possible or you can
215
   specify particular one you want to use. Refer to official documentation
216
   for list of available languages. */
217
$opts['language'] = $_SERVER['HTTP_ACCEPT_LANGUAGE'] . '-UTF8';
128 218

  
129
/*************************/
130
//
131
// According to login:
132
// Define priviledge options
133
// to pass to phpMyEdit
134
//
135
/*************************/
219
?>
136 220

  
137
//check that visitor is allowed to use this table
138
if ($session->target_table != $tb && $session->target_table != "all") {
139
   echo "Sorry, your session is not granted access to table <B> $tb </B><p>";
140
   echo "Please logout and try again with appropriate login<P>";
141
   exit;
142
}
143 221

  
144
//define priv options and display warning accordingly
145
if ($session->mode == "view"){
146
	$privopt = 'VF';
147
	$colorband = "#00ff00";
148
	$messageband = "You are safely in VIEW mode";
149
}
150
else if ($session->mode == "add"){
151
	$privopt = 'APVF';
152
	$colorband = "orange";
153
	$messageband = 'You are in <I><B> ADD </I></B> mode, please logout after you additions';
154
}
155
else if ($session->mode == "edit"){
156
	$privopt = 'ACPVDF';
157
	$colorband = "rgb(250,0,255)";
158
	$messageband = 'IMPORTANT: You are in <I><B> EDIT </I></B> mode, please logout after editing.';
159
}
160
else{
161
	$privopt = '';
162
	$colorband = "grey";
222
<div id="pre_list"></div>
223

  
224
<?php
225

  
226
// MVC for ADV_SEARCH
227
if (array_key_exists("action", $_REQUEST)) {
228
  if ($_REQUEST["action"] == "ADV_SEARCH") {
229
    $fltr = "";
230
    $cols = preg_filter("/col_/","", array_keys($_REQUEST));
231
    foreach ($cols as $index) {
232
      if ($index != 0) {
233
        $fltr .= " " . $_REQUEST["op_$index"];
234
      }
235
      if ($_REQUEST["col_$index"] == "Genotype") {
236
        $k = $_REQUEST["input_$index"];
237
        $fltr .= " (`locus1` LIKE '%$k%' OR `locus2` LIKE '%$k%' OR `locus3` LIKE '%$k%' OR `locus4` LIKE '%$k%' OR `locus5` LIKE '%$k%' OR `ADE2` LIKE '%$k%' OR `HIS3` LIKE '%$k%' OR `LEU2` LIKE '%$k%' OR `LYS2` LIKE '%$k%' OR `MET15` LIKE '%$k%' OR `TRP1` LIKE '%$k%' OR `URA3` LIKE '%$k%' OR `HO_` LIKE '%$k%' OR `Cytoplasmic_Character` LIKE '%$k%' OR `extrachromosomal_plasmid` LIKE '%$k%')";
238
      } else {
239
        $fltr .= " " . $_REQUEST["col_$index"];
240
        $fltr .= " " . $_REQUEST["cond_$index"];
241
        if ($_REQUEST["cond_$index"] == "LIKE") {
242
          $fltr .= " '%" . $_REQUEST["input_$index"] . "%'";                    
243
        } else {
244
          $fltr .= " '" . $_REQUEST["input_$index"] . "'";          
245
        }
246
      }
247
    }
248
    $opts["filters"] = $fltr;
249
  }
163 250
}
164
echo '<style type="text/css"> ';
165
echo	"h4 {background-color: $colorband }";
166
echo '</style>';
167
echo "<h4> $messageband </h4>";
168
echo "<HR>";
169
?>
170 251

  
252
?>

Formats disponibles : Unified diff