[Mapbender-commits] r2000 - in branches/2.5/http: classes
javascripts php
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Mon Jan 21 04:19:44 EST 2008
Author: nimix
Date: 2008-01-21 04:19:43 -0500 (Mon, 21 Jan 2008)
New Revision: 2000
Modified:
branches/2.5/http/classes/class_log.php
branches/2.5/http/javascripts/mod_log.php
branches/2.5/http/php/mod_log.php
Log:
reenable access logging
Modified: branches/2.5/http/classes/class_log.php
===================================================================
--- branches/2.5/http/classes/class_log.php 2008-01-21 09:07:57 UTC (rev 1999)
+++ branches/2.5/http/classes/class_log.php 2008-01-21 09:19:43 UTC (rev 2000)
@@ -32,12 +32,14 @@
* {'file' || 'db'}
*/
var $logtype = 'db';
+
+ function log($module,$req,$time_client,$type = ""){
- function log($module,$req,$time_client){
-
$this->url = $req;
+ if($type == "")
+ $type = $this->logtype;
- if($this->logtype == "file"){
+ if($type == "file"){
if(is_dir($this->dir)){
$logfile = $this->dir . "mb_access_" . date("Y_m_d") . ".log";
if(!$h = @fopen($logfile,"a")){
@@ -65,7 +67,7 @@
}
}
}
- else if($this->logtype == 'db'){
+ else if($type == 'db'){
include_once(dirname(__FILE__)."/../../conf/mapbender.conf");
@@ -75,10 +77,10 @@
$sql = "INSERT INTO mb_log (";
$sql .= "time_client, time_server, time_readable, mb_session, ";
$sql .= "gui, module, ip, username, userid, request";
- $sql .= ") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)";
+ $sql .= ") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)";
- $v = array($time_client, strtotime("now"), "[".date("d/M/Y:H:i:s O")."]", SID, $_SESSION["mb_user_gui"], $_SESSION["mb_user_ip"], $_SESSION["mb_user_name"], $_SESSION["mb_user_id"], $this->url[$i]);
- $t = array("s", "s", "s", "s", "s", "s", "s", "s", "s");
+ $v = array($time_client, strtotime("now"), "[".date("d/M/Y:H:i:s O")."]", SID, $_SESSION["mb_user_gui"], $module, $_SESSION["mb_user_ip"], $_SESSION["mb_user_name"], $_SESSION["mb_user_id"], $this->url[$i]);
+ $t = array("s", "s", "s", "s", "s", "s", "s", "s", "s", "s");
$res = db_prep_query($sql, $v, $t)or die(db_error());
if(!$res){
Modified: branches/2.5/http/javascripts/mod_log.php
===================================================================
--- branches/2.5/http/javascripts/mod_log.php 2008-01-21 09:07:57 UTC (rev 1999)
+++ branches/2.5/http/javascripts/mod_log.php 2008-01-21 09:19:43 UTC (rev 2000)
@@ -1,18 +1,9 @@
mb_registerInitFunctions("mb_log_init()");
function mb_log_init(){
mb_log = "mb_log_set";
- var logdisplay = document.createElement("div");
- var tmp = document.getElementById("log").appendChild(logdisplay);
- tmp.setAttribute("id","logdisplay");
}
+try{if(logtype){}}catch(e){logtype="";}
function mb_log_set(req, time_client){
- var my = "../php/mod_log.php" + "?<?php echo SID; ?>&req=" + escape(req);
- my += "&time_client=" + time_client;
-
- var newdiv = document.createElement("div");
- newdiv.innerHTML = "<img src='"+my+"'>";
- document.getElementById("log").appendChild(newdiv);
- var cnt = parseInt(document.getElementById("log").childNodes.length) - 2;
- writeTag("","logdisplay", cnt);
+ mb_ajax_post('../php/mod_log.php'+"?<?php echo SID; ?>&gui_id=<?php echo $gui_id;?>&elementID=<?php echo $e_id;?>&req=" + escape(req)+ "&time_client=" + time_client, {req:req, time:time_client});
return true;
}
\ No newline at end of file
Modified: branches/2.5/http/php/mod_log.php
===================================================================
--- branches/2.5/http/php/mod_log.php 2008-01-21 09:07:57 UTC (rev 1999)
+++ branches/2.5/http/php/mod_log.php 2008-01-21 09:19:43 UTC (rev 2000)
@@ -18,9 +18,13 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
include_once(dirname(__FILE__)."/../../conf/mapbender.conf");
$con = db_connect(DBSERVER,OWNER,PW);
-db_select_db(DB,$con);
+db_select_db(DB,$con);
+$gui_id = $_REQUEST['gui_id'];
+$e_id = $_REQUEST['elementID'];
+session_start();
+
+include(dirname(__FILE__)."/../include/dyn_php.php");
if($_REQUEST['req']){
- session_start();
ignore_user_abort();
$req = array();
$req[0] = urldecode($_REQUEST['req']);
@@ -28,13 +32,7 @@
if(empty($req)){$req = "init";}
include(dirname(__FILE__)."/../classes/class_log.php");
- $log = new log("default", $req, $time_client);
-}
-
-header ("Content-type: image/png");
-$im = imagecreate(1,1);
-$col = ImageColorAllocate ($im, 0, 0, 0);
-imagesetpixel ( $im, 1, 1, $col);
-
-ImagePNG ($im);
+ $log = new log("default", $req, $time_client, $logtype);
+}
+echo "log into $logtype successful!";
?>
More information about the Mapbender_commits
mailing list