db_host = "neo.ctp.aas.dk"; // Database hostname $setup->db_name = "alarm"; // Database name $setup->db_user = "alarm"; // Database username $setup->db_pass = "alarm"; // Database password $setup->db_alarm_table = "alarm_testing"; $setup->db_sensor_table = "sensor_testing"; $setup->testing = 1; // Register in database. on/off $setup->prg_path = "http://neo.ctp.aas.dk/~nip/new/alarm/"; $setup->news_adr = "computerrum.test@neo.ctp.aas.dk"; // The news address to post alarms on $setup->styles = "http://neo.ctp.aas.dk/noxstyle.css"; // The stylesheet to use outside of twiki $setup->server = "http://twiki.stibo.dk/bin/view/"; $setup->mainweb = "DKCRoom"; $setup->mainpage = "AlarmOverview"; $setup->newalarm = "Register a new alarm."; $setup->footer = "Made by Nicky Precht for the Danish Datacenter"; $setup->post = $HTTP_POST_VARS; $setup->get = $HTTP_GET_VARS; $setup->ref = $HTTP_SERVER_VARS['HTTP_REFERER']; $setup->get_init_sql = "SELECT id,init from optaelling.operator where optaelling.operator.arkiv = 'nej' order by init"; // End important vars //##################################### // Basic HTML functions function html_start($title){ GLOBAL $setup; echo " ".$title." ".$setup->mainweb .".". $setup->mainpage."

".$title."

"; } function html_end($footer){ echo "
".$footer." "; } // End basic html functions //#################################### // Basic functions function twiki(){ GLOBAL $HTTP_USER_AGENT; if ($HTTP_USER_AGENT == "Twiki"){ return 1; } else { return 0; } } function twikitest(){ GLOBAL $setup; if (!Twiki()){ echo "Use Twiki (".$setup->mainpage.")"; die; } } function debug($data){ GLOBAL $setup; if ($setup->debug){ echo "
";
    if (is_array($data)){
      echo "\nArray: \n";
      foreach ($data as $line){
	echo $line . " ";
	echo "\n";
      }
      echo "End of array: \n";
    } else {
      echo "\nString: ".$data." End of string\n";
    }
    echo "
"; } } function ref(){ GLOBAL $HTTP_SERVER_VARS; $ref = $HTTP_SERVER_VARS['HTTP_REFERER']; $ref = split("\?",$ref); $ref = $ref[0]; return $ref; } // End basic functions //###################################### // Database connection function function db_connection($var){ GLOBAL $link; GLOBAL $setup; if ($var == "open"){ $link = mysql_connect("$setup->db_host", "$setup->db_user", "$setup->db_pass") or die("Could not connect to database host: $setup->db_host"); mysql_select_db("$setup->db_name") or die("Could not select database: $setup->db_name"); } if ($var == "close"){ mysql_close($link); } } // End database function // ##################################### // HTML table functions function twiki_form_table($sql) { $result = mysql_query($sql); $retval = 0; if (mysql_num_rows($result) > 0) mysql_data_seek($result, 0); print "%TABLE{cellpadding='2' sort='on' dataalign='left'}%\n"; /* Kolonne-overskrifter */ print "|* *"; for ($i=1; $i"; for ($j=1; $j 0) mysql_data_seek($result, 0); print "%TABLE{cellpadding='2' sort='on' dataalign='left'}%\n"; /* Kolonne-overskrifter */ for ($i=0; $i",$row[$j]); } print "|\n"; }; return $retval; }; function html_table($var){ if ($var=="start"){ echo "\n\n"; } if ($var =="stop"){ echo "\n\n
"; } } // End Table functions //################################ // HTML Form functions function form_start($script_link,$send){ echo "\n
\n"; } function form_end(){ echo "\n
\n"; } function form_input($type, $name, $value, $size){ echo "\n"; } function form_text($name, $cols, $rows, $colspan, $title, $value){ echo "".$title."
\n"; } function form_drop($name,$sql,$select){ $result = mysql_query($sql); $retval = 0; if (mysql_num_rows($result) > 0) mysql_data_seek($result, 0); if (mysql_num_fields($result) <> 2){ echo "Error! two columns must be used in this function"; return "false"; } /* Data'ene... */ echo ""; return $retval; }; // End HTML form functions //####################################### ?>