Seite 1 von 1

agents Plugin

Verfasst: Mo 16. Jun 2008, 09:23
von yodatortenboxer
Hiho,

damit bei mir in der 4.8.4 das agents Plugin von http://forum.contenido.org/viewtopic.php?p=75263#75263 weiterhin funktionierte musste ich nur in dem Modul im Layout folgendes ändern(auskommentieren)

Code: Alles auswählen

$handle = opendir($cfg['path']['contenido'] . $cfg["path"]['plugins'] );

while ($plugin = readdir($handle)){
    $configfile = $cfg['path']['contenido'] . $cfg["path"]['plugins'] . $plugin . "/includes/config.plugin.php";

    if (@file_exists($configfile)){
        include($configfile);
    }
}
sonst gab es bei mir immer folgenden Fehler:

Code: Alles auswählen

Cannot redeclare prepareworkflowitems() (previously declared in...
ALT:

Code: Alles auswählen

<?php
//-----  cut  -----
/* Include the plugin configuration */
$handle = opendir($cfg['path']['contenido'] . $cfg["path"]['plugins'] );

while ($plugin = readdir($handle)){
    $configfile = $cfg['path']['contenido'] . $cfg["path"]['plugins'] . $plugin . "/includes/config.plugin.php";

    if (@file_exists($configfile)){
        include($configfile);
    }
}

if (isset($cfg['plugins']['agents'])){
    $plugin = true;
} 
else{
    $plugin = false;
}

// Agent maskieren und auf gültigen Wert prüfen,  bei Verletzung abbrechen
$agent = addslashes($HTTP_USER_AGENT);
$ip = $REMOTE_ADDR;


if ($plugin && (strlen(trim($agent))>0)){
    $db  = new DB_Contenido;
    $db2 = new DB_Contenido;

    // Filter prüfen

    $sqlq = 'SELECT filterid FROM '.$cfg["tab"]["filter"].' WHERE "'.$agent.'" LIKE value';
    $db->query($sqlq);
    if (!$db->next_record()){

        // Wenn Agent unbekannt => hinzufügen
        $sqlq = 'SELECT agentid FROM '.$cfg["tab"]["agent"].' WHERE name = "'.$agent.'"';
        $db->query($sqlq);

        if (!$db->next_record()){
            $nextid = $db2->nextid($cfg["tab"]["agent"]);
            
            $sqli="INSERT INTO ".$cfg["tab"]["agent"]." (agentid,name) VALUES ('".$nextid."','".$agent."')";
            $db->query($sqli);

            $db->query($sqlq);
            $db->next_record();
        }

        $agentid = $db->f("agentid");

        // Wenn IP unbekannt => hinzufügen
        $sqlq = 'SELECT hostid FROM '.$cfg["tab"]["host"].' WHERE ip = "'.$ip.'"';
        $db->query($sqlq);

        if (!$db->next_record()){
            $nextid = $db2->nextid($cfg["tab"]["host"]);
            
            $sqli="INSERT INTO ".$cfg["tab"]["host"]." (hostid,ip) VALUES ('".$nextid."','".$ip."')";
            $db->query($sqli);

            $db->query($sqlq);
            $db->next_record();
        }

        $hostid = $db->f("hostid");

        // Visit updaten / hinzufügen
        $sqlq = 'SELECT visitid, hits FROM '.$cfg["tab"]["visit"].' WHERE agentid = "'.$agentid.'" AND hostid = "'.$hostid.'" AND date = "'.date("Y-m-d").'"';
        $db->query($sqlq);
    
        if (!$db->next_record()){
            $nextid = $db2->nextid($cfg["tab"]["visit"]);
            
            $sqli="INSERT INTO ".$cfg["tab"]["visit"]." (visitid,agentid,hostid,date,hits) VALUES ('".$nextid."','".$agentid."','".$hostid."','".date("Y-m-d")."','1')";
            $db->query($sqli);

            $db->query($sqlq);
            $db->next_record();
        }
        else{
            $visitid = $db->f("visitid");
            $hits = $db->f("hits") + 1;
            $sqlu="UPDATE ".$cfg["tab"]["visit"]." SET hits='".$hits."', date='".date("Y-m-d")."' WHERE visitid='".$visitid."'";
            $db->query($sqlu);
        }
    }
}
//-----  cut  -----
?>
NEU:

Code: Alles auswählen

<?php
//-----  cut  -----
/* Include the plugin configuration */

/*

$handle = opendir($cfg['path']['contenido'] . $cfg["path"]['plugins'] );

while ($plugin = readdir($handle)){
    $configfile = $cfg['path']['contenido'] . $cfg["path"]['plugins'] . $plugin . "/includes/config.plugin.php";

    if (@file_exists($configfile)){
        include($configfile);
    }
}

*/

if (isset($cfg['plugins']['agents'])){
    $plugin = true;
} 
else{
    $plugin = false;
}

// Agent maskieren und auf gültigen Wert prüfen,  bei Verletzung abbrechen
$agent = addslashes($HTTP_USER_AGENT);
$ip = $REMOTE_ADDR;


if ($plugin && (strlen(trim($agent))>0)){
    $db  = new DB_Contenido;
    $db2 = new DB_Contenido;

    // Filter prüfen

    $sqlq = 'SELECT filterid FROM '.$cfg["tab"]["filter"].' WHERE "'.$agent.'" LIKE value';
    $db->query($sqlq);
    if (!$db->next_record()){

        // Wenn Agent unbekannt => hinzufügen
        $sqlq = 'SELECT agentid FROM '.$cfg["tab"]["agent"].' WHERE name = "'.$agent.'"';
        $db->query($sqlq);

        if (!$db->next_record()){
            $nextid = $db2->nextid($cfg["tab"]["agent"]);
            
            $sqli="INSERT INTO ".$cfg["tab"]["agent"]." (agentid,name) VALUES ('".$nextid."','".$agent."')";
            $db->query($sqli);

            $db->query($sqlq);
            $db->next_record();
        }

        $agentid = $db->f("agentid");

        // Wenn IP unbekannt => hinzufügen
        $sqlq = 'SELECT hostid FROM '.$cfg["tab"]["host"].' WHERE ip = "'.$ip.'"';
        $db->query($sqlq);

        if (!$db->next_record()){
            $nextid = $db2->nextid($cfg["tab"]["host"]);
            
            $sqli="INSERT INTO ".$cfg["tab"]["host"]." (hostid,ip) VALUES ('".$nextid."','".$ip."')";
            $db->query($sqli);

            $db->query($sqlq);
            $db->next_record();
        }

        $hostid = $db->f("hostid");

        // Visit updaten / hinzufügen
        $sqlq = 'SELECT visitid, hits FROM '.$cfg["tab"]["visit"].' WHERE agentid = "'.$agentid.'" AND hostid = "'.$hostid.'" AND date = "'.date("Y-m-d").'"';
        $db->query($sqlq);
    
        if (!$db->next_record()){
            $nextid = $db2->nextid($cfg["tab"]["visit"]);
            
            $sqli="INSERT INTO ".$cfg["tab"]["visit"]." (visitid,agentid,hostid,date,hits) VALUES ('".$nextid."','".$agentid."','".$hostid."','".date("Y-m-d")."','1')";
            $db->query($sqli);

            $db->query($sqlq);
            $db->next_record();
        }
        else{
            $visitid = $db->f("visitid");
            $hits = $db->f("hits") + 1;
            $sqlu="UPDATE ".$cfg["tab"]["visit"]." SET hits='".$hits."', date='".date("Y-m-d")."' WHERE visitid='".$visitid."'";
            $db->query($sqlu);
        }
    }
}
//-----  cut  -----
?>
Gruß yodatortenboxer

agents plugin download

Verfasst: So 6. Jul 2008, 23:32
von josh
Leider kann ich das Plugin nirgendwo mehr downloaden.

Kannst du es evtl. zur Verfügung stellen?

Danke

Josh

Verfasst: Mo 7. Jul 2008, 08:31
von yodatortenboxer
Kannst du es evtl. zur Verfügung stellen?
Logo 8)

Ich hab es einmal hier http://www.xtended-cooperation.de/werbe ... gents.html zum Download zur Verfügung gestellt.

Es ist die Version 0.0.8 vom 01.04.2006 die für Contenido V 4.6.x angepasst wurde siehe http://forum.contenido.org/viewtopic.php?p=75263#75263.

Leider habe ich keine neuere Version obwohl zwerg schreibt das er an einer neueren Version arbeitet. Vieleicht findet sich ja noch jemand der die/eine aktuellere Version hat. Ich würde mich auch bereit erklären diese dann auch zum Download anzubieten.

gruß yodatortenboxer

Verfasst: Mo 7. Jul 2008, 10:56
von josh
Ich hab es einmal hier http://www.xtended-cooperation.de/werbe ... gents.html zum Download zur Verfügung gestellt.
Danke dafür

josh

Verfasst: Sa 13. Sep 2008, 17:20
von Freddy
Hallo,
hab mal versucht das Plugin unter Contenido 4.8.8 zu installieren. Sobald ich aber die Install.php aufrufe kommt die Fehlermeldung: Illegal call
Mache ich was falsch oder geht funktioniert es einfach mit 4.8.8 nicht.

Verfasst: Sa 13. Sep 2008, 17:26
von BagHira

Verfasst: Sa 13. Sep 2008, 18:47
von Freddy
Vielen Dank für die schnelle Hilfestellung. Jetzt klappt das Installieren.
Leider funktioniert aber bei mir Darstellung des Diagrammes nicht. Es wird kein Bild erstellt nur ein Versuch. Gibts vielleicht dafür auch noch ein Trick das es funktioniert.

Verfasst: Sa 13. Sep 2008, 19:31
von Freddy
Hab es schon selbst gelöst bekommen. Musste halt im diagram.php auch das gleiche wie bei install.php ändern.

Re: agents Plugin

Verfasst: Di 3. Nov 2009, 16:33
von Fips
Hallo Freddy,
könntest du die Änderung des Agent-Plugins posten?

Vielen dank für deine Bemühungen.

Fips