Platform  3.1
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
Class.DomainAlias.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
5  * @package FDL
6 */
7 /**
8  * Domain Alias
9  *
10  * @author Anakeen 2000
11  * @version $Id: Class.DomainAlias.php,v 1.4 2005/10/05 16:28:42 eric Exp $
12  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
13  * @package FDL
14  * @subpackage CORE
15  */
16 /**
17  */
18 
19 include_once ('Class.DbObj.php');
20 include_once ('Class.QueryDb.php');
21 include_once ('Class.Pop.php');
22 
23 class DomainAlias extends DbObj
24 {
25 
26  var $Class = '$Id: Class.DomainAlias.php,v 1.4 2005/10/05 16:28:42 eric Exp $';
27 
28  var $fields = array(
29  "iddomainalias",
30  "iddomain",
31  "name",
32  "removed",
33  "uptime"
34  );
35 
36  var $id_fields = array(
37  "iddomainalias"
38  );
39 
40  var $dbtable = "domainalias";
41 
42  var $sqlcreate = "
43 create table domainalias(
44  iddomainalias int not null,
45  iddomain int not null,
46  primary key (iddomainalias),
47  name varchar(100) unique,
48  removed int,
49  uptime int );
50 create index domainalias_idx on domainalias(iddomainalias);
51 create sequence seq_iddomainalias start 10;
52 ";
53 
54  function PreInsert()
55  {
56  if ($this->iddomainalias == "") {
57  $res = $this->exec_query("select nextval ('seq_iddomainalias')");
58  $arr = $this->fetch_array(0);
59  $this->iddomainalias = $arr["nextval"];
60  }
61  $this->name = strtolower($this->name);
62  $this->removed = '0';
63  $this->uptime = time();
64  $this->log->info("Adding domain alias {$this->name} [alias:{$this->iddomainalias}|domain:{$this->iddomain}]");
65  }
66 
67  function PreUpdate()
68  {
69  if ($this->removed != 1) $this->log->info("Modifying domain alias {$this->name} [alias:{$this->iddomainalias}|domain:{$this->iddomain}]");
70  $this->name = strtolower($this->name);
71  $this->uptime = time();
72  }
73 
74  function ListAll($domain = - 1)
75  {
76  $this->qcount = 0;
77  $this->qlist = NULL;
78  if ($domain != - 1) {
79  $query = new QueryDb($this->dbaccess, "DomainAlias");
80  $query->basic_elem->sup_where = array(
81  "iddomain={$domain}",
82  "removed='0'"
83  );
84  $this->qlist = $query->Query();
85  $this->qcount = $query->nb;
86  }
87  return;
88  }
89 
90  function Remove()
91  {
92  $this->removed = '1';
93  $this->log->info("Deleting domain alias {$this->name} [alias:{$this->iddomainalias}|domain:{$this->iddomain}]");
94  $this->Modify();
95  }
96 }
97 ?>
← centre documentaire © anakeen - published under CC License - Dynacase