pdadmin-forum

pdadmin-forum » Information » Add-Ons » [Fertiggestellt] AddOn: (Co)Domain-Auflistung » Hallo Gast [Anmelden|Registrieren]
Letzter Beitrag | Erster ungelesener Beitrag Druckvorschau | An Freund senden | Thema zu Favoriten hinzufügen
Neues Thema erstellen Antwort erstellen
Zum Ende der Seite springen AddOn: (Co)Domain-Auflistung
Autor
Beitrag « Vorheriges Thema | Nächstes Thema »
miko93
Moderator


images/avatars/avatar-2.gif

Dabei seit: 08.09.2004
Beiträge: 998
Herkunft: Regensburg, Germany

AddOn: (Co)Domain-Auflistung Antworten | Zitieren | Editieren | Melden       Zum Anfang der Seite springen

Diskussion: AddOn: (Co)Domain-Auflistung

Funktion: Anzeige der Zuordnung Domain->Account->Reseller / CoDomains->Domains in einer Übersichtsliste.

Abgeleitet vom viewprefs-AddOn. Was (noch) fehlt: Variable Sortierung. Aktuell fix nach Domainname.



Installation

- Erzeuge Directory /opt/pdadmin/www/addons (drwxr-xr-x root root), falls noch nicht vorhanden.
- Erzeuge addons.viewdomains.main.html (-rw-r--r-- root root) im addons-Verzeichnis mit folgendem Inhalt:

Zitat:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>

<title>pd-admin v3.x - Mainframe</title>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">

<link rel="stylesheet" href="/administrator/css/$$color_scheme/styles.css" type="text/css">
</head>

<body>

<table width="90%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td align="right">
<table width="300" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="22"><img src="/administrator/images/$$color_scheme/left_top.gif" alt=""
width="22" height="27"></td>

<td width="22" background="/administrator/images/$$color_scheme/middle_top.gif">
<img src="/administrator/images/$$color_scheme/pfeil.gif" alt="" width="20"
height="22"></td>

<td background="/administrator/images/$$color_scheme/middle_top.gif" align="left"
valign="middle" class="header">AddOn: viewdomains</td>

<td align="right" width="22"><img src=
"/administrator/images/$$color_scheme/right_top.gif" alt="" width="22" height=
"27"></td>
</tr>
</table>
</td>
</tr>
</table>

<table width="90%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td width="25" height="25"><img src="/administrator/images/$$color_scheme/top_left.gif" alt=""
width="25" height="25"></td>

<td background="/administrator/images/$$color_scheme/top_middle.gif" align="center"><img src=
"/administrator/images/$$color_scheme/top_middle.gif" alt="" width="25" height="25"></td>

<td width="25" height="25" align="right"><img src=
"/administrator/images/$$color_scheme/top_right.gif" alt="" width="25" height="25"></td>
</tr>

<tr>
<td bgcolor="#FFFFFF" width="25">&nbsp;</td>

<td bgcolor="#FFFFFF" align="center" valign="top">

<table border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td bgcolor="#FFFFFF" align="left">
$$addon_data1
</td>
</tr>
</table>

</td>

<td bgcolor="#FFFFFF" width="25" rowspan="2">&nbsp;</td>
</tr>
</table>
</body>
</html>


Erzeuge /opt/pdadmin/www/administrator/addon_viewdomains.cgi (-rwsr-xr-x root root - man beachte das suid-Bit !) mit folgendem Inhalt:

Zitat:

#!/usr/local/bin/perl -w

####
#### PD-Admin Add-On: Show (Co)Domains
#### miko 4/2006
####

use CGI ':standard';
use DBI;
use strict;

use vars qw($dsn $user $password $color_scheme $color_scheme_administrator);
do "/opt/pdadmin/etc/pdadmin.conf" or die "Can't read configuration: $!";

####
#### Korrekte Session ueberpruefen
####

unless (defined $ENV{REQUEST_URI}) {die "no request url available!"};

$ENV{REQUEST_URI} =~ m/\S*\/(\w*)\/addon_viewdomains.cgi$/;
my $SessionID = $1;

my $dbh = DBI->connect($dsn,$user,$password) or die "can't connect!";

my $query = "select time from sessions where session='$SessionID' limit 1";
my $sth = $dbh->prepare($query) or die "cannot prepare query '$query'";
my $rv = $sth->execute or die "cannot execute query '$query'";
my $myTime = $sth->fetchrow;

$sth->finish();
$dbh->disconnect();

$myTime or die "session not found!";

####
#### Daten aus vadmin->domains auslesen
####

$dbh = DBI->connect($dsn,$user,$password) or die "can't connect!";

# Domains
$query = "select domains.name, users.login, resellers.login from domains, users, resellers where users.ID=domains.owner and users.reseller=resellers.ID order by domains.name";

$sth = $dbh->prepare($query) or die "cannot prepare query '$query'";
$rv = $sth->execute or die "cannot execute query '$query'";

my $addon_data1 = "<table cellpadding=\"6\" cellspacing=\"0\" border=\"1\" class=\"maintable\">";
$addon_data1 .= "<tr class=\"tableheader\">";
$addon_data1 .= "<td nowrap>Domain</td>";
$addon_data1 .= "<td nowrap>Owner</td>";
$addon_data1 .= "<td nowrap>Reseller</td>";
$addon_data1 .= "</tr>";

while (my @row = $sth->fetchrow_array)
{
$addon_data1 .= "<tr class=\"lightrow\"><td align=\"left\">";
$addon_data1 .= $row[0]; #domain
$addon_data1 .= "</td><td>";
$addon_data1 .= $row[1]; #login
$addon_data1 .= "</td><td>";
$addon_data1 .= $row[2]; #reseller
$addon_data1 .= "</td></tr>";
}

# Co-Domains
$query = "select codomains.name, domains.name from codomains, domains where domains.ID=codomains.domain order by codomains.name";

$sth = $dbh->prepare($query) or die "cannot prepare query '$query'";
$rv = $sth->execute or die "cannot execute query '$query'";

$addon_data1 .= "<tr class=\"tableheader\">";
$addon_data1 .= "<td nowrap>Co-Domain</td>";
$addon_data1 .= "<td nowrap>Domain</td>";
$addon_data1 .= "<td nowrap>&nbsp;</td>";
$addon_data1 .= "</tr>";

while (my @row = $sth->fetchrow_array)
{
$addon_data1 .= "<tr class=\"lightrow\"><td align=\"left\">";
$addon_data1 .= $row[0]; #domain
$addon_data1 .= "</td><td>";
$addon_data1 .= $row[1]; #codomain
$addon_data1 .= "</td><td>&nbsp;";
$addon_data1 .= "</td></tr>";
}

$addon_data1 .= "</table>";

$sth->finish;
$dbh->disconnect();

####
#### Html-Template parsen und die eigentlichen Daten ausgeben
####

my $html_data = `cat /opt/pdadmin/www/addons/addons.viewdomains.main.html`;

my $Color = 'blue';

if (defined $color_scheme and length $color_scheme)
{$Color = $color_scheme;}
elsif (defined $color_scheme_administrator and length $color_scheme_administrator )
{$Color = $color_scheme_administrator};

$html_data =~ s/\$\$color_scheme/$Color/g;
$html_data =~ s/\$\$addon_data1/$addon_data1/g;

print header;
print $html_data;

exit


- Erzeuge (oder ändere) /opt/pdadmin/etc/administrator_menu_individual.conf (-rw-r--r-- root root) mit folgendem Inhalt:

Zitat:

$links{610}{sublinks}{150}{name}{de} = 'View Domains';
$links{610}{sublinks}{150}{name}{en} = 'View Domains';
$links{610}{sublinks}{150}{url} = 'addon_viewdomains.cgi';
$links{610}{sublinks}{150}{target} = 'mainFrame';


Fertig.

__________________
Frage beantwortet? Problem gelöst? Dann markiert euren Beitrag bitte als [erledigt].
15.04.2006 21:39 miko93 ist offline E-Mail an miko93 senden Homepage von miko93 Beiträge von miko93 suchen Nehme miko93 in Deine Freundesliste auf
Baumstruktur | Brettstruktur
Gehe zu:
Neues Thema erstellen Antwort erstellen
pdadmin-forum » Information » Add-Ons » [Fertiggestellt] AddOn: (Co)Domain-Auflistung

Impressum | Team | Hilfe

Forensoftware: Burning Board, entwickelt von WoltLab GmbH    |    Design entwickelt von You-Online.de