f12aba6daa6e2848a8ed60ea57b26874d6675f52
bernd Ein paar neue Klassen

bernd authored 17 years ago

class/domains.php   1) <?php
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 12 years ago

class/domain.php    2) /*
class/domain.php    3) This file belongs to the Webinterface of schokokeks.org Hosting
class/domain.php    4) 
Bernd Wurst Updated copyright notice (2...

Bernd Wurst authored 11 years ago

class/domain.php    5) Written 2008-2013 by schokokeks.org Hosting, namely
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 12 years ago

class/domain.php    6)   Bernd Wurst <bernd@schokokeks.org>
class/domain.php    7)   Hanno Böck <hanno@schokokeks.org>
class/domain.php    8) 
class/domain.php    9) To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty.
class/domain.php   10) 
class/domain.php   11) You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see 
class/domain.php   12) http://creativecommons.org/publicdomain/zero/1.0/
class/domain.php   13) 
class/domain.php   14) Nevertheless, in case you use a significant part of this code, we ask (but not require, see the license) that you keep the authors' names in place and return your changes to the public. We would be especially happy if you tell us what you're going to do with this code.
class/domain.php   15) */
bernd Ein paar neue Klassen

bernd authored 17 years ago

class/domains.php  16) 
class/domains.php  17) require_once('inc/db_connect.php');
class/domains.php  18) require_once('inc/base.php');
class/domains.php  19) require_once('inc/debug.php');
class/domains.php  20) 
class/domains.php  21) require_once('class/keksdata.php');
class/domains.php  22) 
class/domains.php  23) 
class/domains.php  24) class Domain extends KeksData
class/domains.php  25) {
class/domains.php  26)   function __construct($init = NULL)
class/domains.php  27)   {
class/domains.php  28)     $this->default_table = 'kundendaten.domains';
class/domains.php  29)     $this->setup();
class/domains.php  30)     switch (gettype($init))
class/domains.php  31)     {
class/domains.php  32)       case 'string':
class/domains.php  33)         $this->loadByName($init);
class/domains.php  34)         break;
class/domains.php  35)       case 'integer':
class/domains.php  36)         $this->loadByID($init);
class/domains.php  37)         break;
class/domains.php  38)       case 'NULL':
class/domains.php  39)         break;
class/domains.php  40)     }
class/domains.php  41)   }
class/domains.php  42) 
class/domains.php  43)   function loadByName($name)
class/domains.php  44)   {
class/domains.php  45)     $name = mysql_real_escape_string($name);
class/domains.php  46)     $res = $this->getData("*", "CONCAT_WS('.', domainname, tld)='{$name}' LIMIT 1");
bernd Domain-Klasse benutzen

bernd authored 17 years ago

class/domain.php   47)     if (count($res) < 1)
class/domain.php   48)       return false;
bernd Ein paar neue Klassen

bernd authored 17 years ago

class/domains.php  49)     $this->parse($res[0]);
class/domains.php  50)   }
class/domains.php  51) 
bernd Mehr config-optionen und co...

bernd authored 15 years ago

class/domain.php   52)   function ensure_customerdomain()
class/domain.php   53)   {
class/domain.php   54)     if (! $this->is_customerdomain() )
bernd Schreibe auch hin, welche D...

bernd authored 14 years ago

class/domain.php   55)       system_failure('Die Domain »'.$this->data['fqdn'].'« gehört nicht Ihrem Kundenaccount.');
bernd Mehr config-optionen und co...

bernd authored 15 years ago

class/domain.php   56)   }
class/domain.php   57) 
class/domain.php   58)   function ensure_userdomain()
class/domain.php   59)   {
class/domain.php   60)     if (! $this->is_userdomain() )
bernd Schreibe auch hin, welche D...

bernd authored 14 years ago

class/domain.php   61)       system_failure('Die Domain »'.$this->data['fqdn'].'« gehört nicht Ihrem Benutzeraccount.');
bernd Mehr config-optionen und co...

bernd authored 15 years ago

class/domain.php   62)   }
class/domain.php   63) 
class/domain.php   64)   function is_customerdomain()
class/domain.php   65)   {
class/domain.php   66)     if (! isset($_SESSION['customerinfo']) )
class/domain.php   67)       return false;
class/domain.php   68)     $customerno = (int) $_SESSION['customerinfo']['customerno'];
class/domain.php   69)     return ($this->kunde == $customerno);
class/domain.php   70)   }
class/domain.php   71) 
class/domain.php   72)   function is_userdomain()
class/domain.php   73)   {
class/domain.php   74)     if (! isset($_SESSION['userinfo']) )
class/domain.php   75)       return false;
class/domain.php   76)     $uid = (int) $_SESSION['userinfo']['uid'];
class/domain.php   77)     return ($this->useraccount == $uid);
class/domain.php   78)   }
class/domain.php   79) 
bernd Ein paar neue Klassen

bernd authored 17 years ago

class/domains.php  80)   function parse($data)
class/domains.php  81)   {
bernd some updates

bernd authored 16 years ago

class/domain.php   82)     DEBUG($data);
bernd Ein paar neue Klassen

bernd authored 17 years ago

class/domains.php  83)     foreach (array_keys($this->data) as $key)
class/domains.php  84)       if (array_key_exists($key, $data))
class/domains.php  85)         $this->data[$key] = $data[$key];
class/domains.php  86)     $this->data['fqdn'] = $data['domainname'].'.'.$data['tld'];
class/domains.php  87)     $this->data['reg_date'] = $data['registrierungsdatum'];
class/domains.php  88)     $this->data['cancel_date'] = $data['kuendigungsdatum'];
class/domains.php  89)   }
class/domains.php  90) 
class/domains.php  91) }
class/domains.php  92) 
class/domains.php  93) 
class/domains.php  94) 
class/domains.php  95) 
class/domains.php  96) 
class/domains.php  97) 
class/domains.php  98) 
class/domains.php  99) function get_domain_list($customerno, $uid = NULL)
class/domains.php 100) {
class/domains.php 101)   $customerno = (int) $customerno;
class/domains.php 102)   $query = "SELECT id FROM kundendaten.domains WHERE";
class/domains.php 103)   if ($uid !== NULL)
class/domains.php 104)   {
class/domains.php 105)     $uid = (int) $uid;
bernd Domains alphabetisch sortieren

bernd authored 17 years ago

class/domain.php  106)     $query .= " useraccount={$uid}";
bernd Ein paar neue Klassen

bernd authored 17 years ago

class/domains.php 107)   }
class/domains.php 108)   else
class/domains.php 109)   {
bernd Domains alphabetisch sortieren

bernd authored 17 years ago

class/domain.php  110)     $query .= " kunde={$customerno}";
bernd Ein paar neue Klassen

bernd authored 17 years ago

class/domains.php 111)   }
bernd Domains alphabetisch sortieren

bernd authored 17 years ago

class/domain.php  112)   $query .= " ORDER BY domainname,tld";
bernd Ein paar neue Klassen

bernd authored 17 years ago

class/domains.php 113)   $result = db_query($query);
class/domains.php 114)   $domains = array();
class/domains.php 115)   DEBUG('Result set is '.mysql_num_rows($result)." rows.<br />\n");
class/domains.php 116)   if (mysql_num_rows($result) > 0)
bernd neue Bilder, mehr SSL-Zerti...

bernd authored 15 years ago

class/domain.php  117)     while ($domain = mysql_fetch_object($result))
class/domain.php  118)       array_push($domains, new Domain((int) $domain->id));
bernd Ein paar neue Klassen

bernd authored 17 years ago

class/domains.php 119)   DEBUG($domains);
class/domains.php 120) 	return $domains;	
class/domains.php 121) }
class/domains.php 122) 
class/domains.php 123) 
class/domains.php 124) 
class/domains.php 125) function get_jabberable_domains()
class/domains.php 126) {
class/domains.php 127)   require_role(ROLE_CUSTOMER);
class/domains.php 128)   $customerno = (int) $_SESSION['customerinfo']['customerno'];
class/domains.php 129) 
class/domains.php 130)   $domains = get_domain_list($customerno);
class/domains.php 131)   DEBUG($domains);
class/domains.php 132)   $result = array( new Domain() );
class/domains.php 133)   $result[0]->id = 0;
bernd Mehr config-optionen und co...

bernd authored 15 years ago

class/domain.php  134)   $result[0]->fqdn = config('masterdomain');