SF.net SVN: postfixadmin:[925] trunk
Brought to you by:
christian_boltz,
gingerdog
From: <chr...@us...> - 2010-12-30 22:35:05
|
Revision: 925 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=925&view=rev Author: christian_boltz Date: 2010-12-30 22:34:59 +0000 (Thu, 30 Dec 2010) Log Message: ----------- moved scripts/models-ext/* to model/ - moved scripts/models-ext/DomainHandler.php to model/ - deleted redirect scripts in scripts/models-ext/ (UserHandler.php, AliasHandler.php) - changed scripts/common.php to include the files from ../model/ Modified Paths: -------------- trunk/scripts/common.php Added Paths: ----------- trunk/model/DomainHandler.php Removed Paths: ------------- trunk/scripts/models-ext/AliasHandler.php trunk/scripts/models-ext/DomainHandler.php trunk/scripts/models-ext/UserHandler.php Copied: trunk/model/DomainHandler.php (from rev 922, trunk/scripts/models-ext/DomainHandler.php) =================================================================== --- trunk/model/DomainHandler.php (rev 0) +++ trunk/model/DomainHandler.php 2010-12-30 22:34:59 UTC (rev 925) @@ -0,0 +1,90 @@ +<?php + +/** + * Handlers User level alias actions - e.g. add alias, get aliases, update etc. + */ +class DomainHandler { + + private $username = null; + + + public $errormsg = array(); + /** + * @param string $username + */ + public function __construct($username) { + $this->username = $username; + } + + public function getTransports() { + return Config::read('transport_options'); + } + + public function getTransport($id) { + $transports = Config::read('transport_options'); + return $transports[$id-1]; + } + + public function add($domain, $desc, $a, $m, $t, $q, $default, $backup){ + + ($backup == true) ? $backup = db_get_boolean(true) : $backup = db_get_boolean(false); + + $arr = array( + 'domain' => $domain, + 'description' => $desc, + 'aliases' => $a, + 'mailboxes' => $m, + 'maxquota' => $q, + 'transport' => $this->getTransport($t), + 'backupmx' => $backup, + ); + + $result = db_insert('domain', $arr, array('created', 'modified') ); + if ($result != 1) + { + $this->errormsg[] = Lang::read('pAdminCreate_domain_result_error') . "\n($domain)\n"; + return 1; + } + else + { + if ($default) + { + foreach (Config::read('default_aliases') as $address=>$goto) + { + $address = $address . "@" . $domain; + $arr = array( + 'address' => $address, + 'goto' => $goto, + 'domain' => $domain, + ); + $result = db_insert ('alias', $arr, array('created', 'modified') ); + } + } + $tMessage = Lang::read('pAdminCreate_domain_result_success') . "<br />($domain)</br />"; + } + if (!domain_postcreation($domain)) + { + $tMessage = Lang::read('pAdminCreate_domain_error'); + } + db_log($this->username, $domain, 'create_domain', ""); + return 0; + } + + public function view ($domain) { + global $config; + + + + $table_domain = table_by_key('domain'); + + $result = db_query("SELECT domain, description, aliases, mailboxes, maxquota, quota, transport, backupmx, DATE_FORMAT(created, '%d.%m.%y') AS created, DATE_FORMAT(modified, '%d.%m.%y') AS modified, active FROM $table_domain WHERE domain='$domain'"); + if ($result['rows'] != 0) { + $this->return = db_array($result['result']); + return 0; + } + $this->errormsg = $result['error']; + return 1; + } +} + +/* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */ Modified: trunk/scripts/common.php =================================================================== --- trunk/scripts/common.php 2010-12-30 22:26:17 UTC (rev 924) +++ trunk/scripts/common.php 2010-12-30 22:34:59 UTC (rev 925) @@ -49,7 +49,7 @@ * __autoload implementation, for use with spl_autoload_register(). */ function postfixadmin_autoload2($class) { - $PATH = CORE_INCLUDE_PATH.'/models-ext/' . $class . '.php'; + $PATH = CORE_INCLUDE_PATH.'/../model/' . $class . '.php'; if(is_file($PATH)) { require_once($PATH); Deleted: trunk/scripts/models-ext/AliasHandler.php =================================================================== --- trunk/scripts/models-ext/AliasHandler.php 2010-12-30 22:26:17 UTC (rev 924) +++ trunk/scripts/models-ext/AliasHandler.php 2010-12-30 22:34:59 UTC (rev 925) @@ -1,2 +0,0 @@ -<?php -require('../model/AliasHandler.php'); Deleted: trunk/scripts/models-ext/DomainHandler.php =================================================================== --- trunk/scripts/models-ext/DomainHandler.php 2010-12-30 22:26:17 UTC (rev 924) +++ trunk/scripts/models-ext/DomainHandler.php 2010-12-30 22:34:59 UTC (rev 925) @@ -1,90 +0,0 @@ -<?php - -/** - * Handlers User level alias actions - e.g. add alias, get aliases, update etc. - */ -class DomainHandler { - - private $username = null; - - - public $errormsg = array(); - /** - * @param string $username - */ - public function __construct($username) { - $this->username = $username; - } - - public function getTransports() { - return Config::read('transport_options'); - } - - public function getTransport($id) { - $transports = Config::read('transport_options'); - return $transports[$id-1]; - } - - public function add($domain, $desc, $a, $m, $t, $q, $default, $backup){ - - ($backup == true) ? $backup = db_get_boolean(true) : $backup = db_get_boolean(false); - - $arr = array( - 'domain' => $domain, - 'description' => $desc, - 'aliases' => $a, - 'mailboxes' => $m, - 'maxquota' => $q, - 'transport' => $this->getTransport($t), - 'backupmx' => $backup, - ); - - $result = db_insert('domain', $arr, array('created', 'modified') ); - if ($result != 1) - { - $this->errormsg[] = Lang::read('pAdminCreate_domain_result_error') . "\n($domain)\n"; - return 1; - } - else - { - if ($default) - { - foreach (Config::read('default_aliases') as $address=>$goto) - { - $address = $address . "@" . $domain; - $arr = array( - 'address' => $address, - 'goto' => $goto, - 'domain' => $domain, - ); - $result = db_insert ('alias', $arr, array('created', 'modified') ); - } - } - $tMessage = Lang::read('pAdminCreate_domain_result_success') . "<br />($domain)</br />"; - } - if (!domain_postcreation($domain)) - { - $tMessage = Lang::read('pAdminCreate_domain_error'); - } - db_log($this->username, $domain, 'create_domain', ""); - return 0; - } - - public function view ($domain) { - global $config; - - - - $table_domain = table_by_key('domain'); - - $result = db_query("SELECT domain, description, aliases, mailboxes, maxquota, quota, transport, backupmx, DATE_FORMAT(created, '%d.%m.%y') AS created, DATE_FORMAT(modified, '%d.%m.%y') AS modified, active FROM $table_domain WHERE domain='$domain'"); - if ($result['rows'] != 0) { - $this->return = db_array($result['result']); - return 0; - } - $this->errormsg = $result['error']; - return 1; - } -} - -/* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */ Deleted: trunk/scripts/models-ext/UserHandler.php =================================================================== --- trunk/scripts/models-ext/UserHandler.php 2010-12-30 22:26:17 UTC (rev 924) +++ trunk/scripts/models-ext/UserHandler.php 2010-12-30 22:34:59 UTC (rev 925) @@ -1,2 +0,0 @@ -<?php -require('../model/UserHandler.php'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |