summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/admin/config/app.yml50
-rw-r--r--apps/admin/config/cache.yml4
-rw-r--r--apps/admin/config/config.php8
-rw-r--r--apps/admin/config/factories.yml35
-rw-r--r--apps/admin/config/filters.yml10
-rw-r--r--apps/admin/config/i18n.yml7
-rw-r--r--apps/admin/config/logging.yml22
-rw-r--r--apps/admin/config/routing.yml23
-rw-r--r--apps/admin/config/security.yml3
-rw-r--r--apps/admin/config/settings.yml117
-rw-r--r--apps/admin/config/view.yml15
-rw-r--r--apps/admin/lib/imap/FakeIMAPClient.php9
-rw-r--r--apps/admin/lib/imap/IMAPClient.php498
-rw-r--r--apps/admin/lib/imap/IMAPManager.php48
-rw-r--r--apps/admin/lib/imap/IMAPServerInformation.php63
-rw-r--r--apps/admin/lib/myChangeNicknameValidator.php43
-rw-r--r--apps/admin/lib/myDenyStringValidator.php38
-rw-r--r--apps/admin/lib/myLoginValidator.php45
-rw-r--r--apps/admin/lib/myUser.class.php83
-rw-r--r--apps/admin/modules/address/actions/actions.class.php165
-rw-r--r--apps/admin/modules/address/config/generator.yml48
-rw-r--r--apps/admin/modules/address/templates/_alias.php9
-rw-r--r--apps/admin/modules/address/templates/_destination.php23
-rw-r--r--apps/admin/modules/address/templates/_domain_id.php1
-rw-r--r--apps/admin/modules/address/templates/_localpart.php1
-rw-r--r--apps/admin/modules/address/templates/_mailbox_id.php1
-rw-r--r--apps/admin/modules/address/validate/create.yml10
-rw-r--r--apps/admin/modules/address/validate/edit.yml10
-rw-r--r--apps/admin/modules/content/actions/actions.class.php18
-rw-r--r--apps/admin/modules/domain/actions/actions.class.php47
-rw-r--r--apps/admin/modules/domain/config/generator.yml53
-rw-r--r--apps/admin/modules/domain/config/security.yml11
-rw-r--r--apps/admin/modules/domain/templates/_default_mailbox_quota.php1
-rw-r--r--apps/admin/modules/domain/templates/_edit_header.php13
-rw-r--r--apps/admin/modules/domain/templates/_max_mailbox_count.php1
-rw-r--r--apps/admin/modules/domain/templates/_quota.php1
-rw-r--r--apps/admin/modules/domain/validate/create.yml46
-rw-r--r--apps/admin/modules/domain/validate/edit.yml46
-rw-r--r--apps/admin/modules/log/actions/actions.class.php46
-rw-r--r--apps/admin/modules/log/config/generator.yml30
-rw-r--r--apps/admin/modules/log/config/security.yml2
-rw-r--r--apps/admin/modules/log/templates/_priority.php1
-rw-r--r--apps/admin/modules/log/templates/_user_id.php1
-rw-r--r--apps/admin/modules/log/templates/clearSuccess.php12
-rw-r--r--apps/admin/modules/mailbox/actions/actions.class.php56
-rw-r--r--apps/admin/modules/mailbox/config/generator.yml56
-rw-r--r--apps/admin/modules/mailbox/templates/_domain_id.php1
-rw-r--r--apps/admin/modules/mailbox/templates/_last_login.php1
-rw-r--r--apps/admin/modules/mailbox/templates/_max_address_count.php1
-rw-r--r--apps/admin/modules/mailbox/templates/_max_quota.php1
-rw-r--r--apps/admin/modules/mailbox/templates/_new_password.php1
-rw-r--r--apps/admin/modules/mailbox/templates/_password.php1
-rw-r--r--apps/admin/modules/mailbox/validate/create.yml50
-rw-r--r--apps/admin/modules/mailbox/validate/edit.yml48
-rw-r--r--apps/admin/modules/server/actions/actions.class.php29
-rw-r--r--apps/admin/modules/server/templates/imapSuccess.php57
-rw-r--r--apps/admin/modules/user/actions/actions.class.php115
-rw-r--r--apps/admin/modules/user/config/generator.yml55
-rw-r--r--apps/admin/modules/user/config/security.yml13
-rw-r--r--apps/admin/modules/user/templates/_domain_permissions.php27
-rw-r--r--apps/admin/modules/user/templates/_last_login.php1
-rw-r--r--apps/admin/modules/user/templates/_password.php3
-rw-r--r--apps/admin/modules/user/templates/_password1.php3
-rw-r--r--apps/admin/modules/user/templates/_password2.php3
-rw-r--r--apps/admin/modules/user/templates/_role_id.php1
-rw-r--r--apps/admin/modules/user/templates/loginSuccess.php12
-rw-r--r--apps/admin/modules/user/templates/settingsSuccess.php22
-rw-r--r--apps/admin/modules/user/validate/create.yml37
-rw-r--r--apps/admin/modules/user/validate/edit.yml40
-rw-r--r--apps/admin/modules/user/validate/login.yml24
-rw-r--r--apps/admin/modules/user/validate/settings.yml43
-rw-r--r--apps/admin/templates/_branding.php4
-rw-r--r--apps/admin/templates/_navigation.php53
-rw-r--r--apps/admin/templates/_notes.php9
-rw-r--r--apps/admin/templates/layout.php35
-rw-r--r--config/config.php5
-rw-r--r--config/databases.yml5
-rw-r--r--config/generated-schema-transformed.xml2
-rw-r--r--config/propel.ini44
-rw-r--r--config/properties.ini2
-rw-r--r--config/rsync_exclude.txt4
-rw-r--r--config/schema-transformed.xml2
-rw-r--r--config/schema.yml68
-rw-r--r--data/fixtures/10-common_data.yml21
-rw-r--r--data/generator/sfPropelAdmin/mailadmin/template/actions/actions.class.php435
-rw-r--r--data/generator/sfPropelAdmin/mailadmin/template/templates/_edit_actions.php13
-rw-r--r--data/generator/sfPropelAdmin/mailadmin/template/templates/_edit_footer.php0
-rw-r--r--data/generator/sfPropelAdmin/mailadmin/template/templates/_edit_form.php93
-rw-r--r--data/generator/sfPropelAdmin/mailadmin/template/templates/_edit_header.php0
-rw-r--r--data/generator/sfPropelAdmin/mailadmin/template/templates/_edit_messages.php5
-rw-r--r--data/generator/sfPropelAdmin/mailadmin/template/templates/_filters.php36
-rw-r--r--data/generator/sfPropelAdmin/mailadmin/template/templates/_list.php18
-rw-r--r--data/generator/sfPropelAdmin/mailadmin/template/templates/_list_actions.php10
-rw-r--r--data/generator/sfPropelAdmin/mailadmin/template/templates/_list_footer.php0
-rw-r--r--data/generator/sfPropelAdmin/mailadmin/template/templates/_list_header.php0
-rw-r--r--data/generator/sfPropelAdmin/mailadmin/template/templates/_list_messages.php13
-rw-r--r--data/generator/sfPropelAdmin/mailadmin/template/templates/_list_td_actions.php5
-rw-r--r--data/generator/sfPropelAdmin/mailadmin/template/templates/_list_td_stacked.php16
-rw-r--r--data/generator/sfPropelAdmin/mailadmin/template/templates/_list_td_tabular.php30
-rw-r--r--data/generator/sfPropelAdmin/mailadmin/template/templates/_list_th_stacked.php1
-rw-r--r--data/generator/sfPropelAdmin/mailadmin/template/templates/_list_th_tabular.php28
-rw-r--r--data/generator/sfPropelAdmin/mailadmin/template/templates/_pager.php13
-rw-r--r--data/generator/sfPropelAdmin/mailadmin/template/templates/editSuccess.php20
-rw-r--r--data/generator/sfPropelAdmin/mailadmin/template/templates/listSuccess.php38
-rw-r--r--data/sql/lib.model.schema.sql181
-rw-r--r--data/sql/sqldb.map2
-rw-r--r--lib/helper/FilesHelper.php27
-rw-r--r--lib/helper/SortHeaderHelper.php21
-rw-r--r--lib/model/Address.php124
-rw-r--r--lib/model/AddressPeer.php30
-rw-r--r--lib/model/Domain.php49
-rw-r--r--lib/model/DomainPeer.php37
-rw-r--r--lib/model/DomainPermission.php12
-rw-r--r--lib/model/DomainPermissionPeer.php22
-rw-r--r--lib/model/LogEntry.php38
-rw-r--r--lib/model/LogEntryPeer.php23
-rw-r--r--lib/model/Mailbox.php187
-rw-r--r--lib/model/MailboxPeer.php30
-rw-r--r--lib/model/Role.php20
-rw-r--r--lib/model/RolePeer.php12
-rw-r--r--lib/model/User.php36
-rw-r--r--lib/model/UserPeer.php12
-rw-r--r--lib/model/map/AddressMapBuilder.php52
-rw-r--r--lib/model/map/DomainMapBuilder.php50
-rw-r--r--lib/model/map/DomainPermissionMapBuilder.php42
-rw-r--r--lib/model/map/LogEntryMapBuilder.php48
-rw-r--r--lib/model/map/MailboxMapBuilder.php52
-rw-r--r--lib/model/map/RoleMapBuilder.php42
-rw-r--r--lib/model/map/UserMapBuilder.php58
-rw-r--r--lib/model/om/BaseAddress.php643
-rw-r--r--lib/model/om/BaseAddressPeer.php834
-rw-r--r--lib/model/om/BaseDomain.php926
-rw-r--r--lib/model/om/BaseDomainPeer.php591
-rw-r--r--lib/model/om/BaseDomainPermission.php461
-rw-r--r--lib/model/om/BaseDomainPermissionPeer.php809
-rw-r--r--lib/model/om/BaseLogEntry.php548
-rw-r--r--lib/model/om/BaseLogEntryPeer.php549
-rw-r--r--lib/model/om/BaseMailbox.php751
-rw-r--r--lib/model/om/BaseMailboxPeer.php579
-rw-r--r--lib/model/om/BaseRole.php493
-rw-r--r--lib/model/om/BaseRolePeer.php373
-rw-r--r--lib/model/om/BaseUser.php1261
-rw-r--r--lib/model/om/BaseUserPeer.php758
-rwxr-xr-xsymfony14
-rw-r--r--test/bootstrap/functional.php29
-rw-r--r--test/bootstrap/unit.php17
-rw-r--r--test/functional/admin/addressActionsTest.php15
-rw-r--r--test/functional/admin/administratorActionsTest.php15
-rw-r--r--test/functional/admin/contentActionsTest.php15
-rw-r--r--test/functional/admin/domainActionsTest.php15
-rw-r--r--test/functional/admin/domaintestActionsTest.php15
-rw-r--r--test/functional/admin/logActionsTest.php15
-rw-r--r--test/functional/admin/mailboxActionsTest.php15
-rw-r--r--test/functional/admin/serverActionsTest.php15
-rw-r--r--test/functional/admin/userActionsTest.php15
-rw-r--r--web/.htaccess25
-rw-r--r--web/admin_dev.php10
-rw-r--r--web/css/main.css405
-rw-r--r--web/images/add.gifbin0 -> 94 bytes
-rw-r--r--web/images/address-new.gifbin0 -> 688 bytes
-rw-r--r--web/images/address.gifbin0 -> 1187 bytes
-rw-r--r--web/images/background-branding.pngbin0 -> 326 bytes
-rw-r--r--web/images/background-navigation.pngbin0 -> 243 bytes
-rw-r--r--web/images/background-notes-start.pngbin0 -> 270 bytes
-rw-r--r--web/images/bottom.gifbin0 -> 690 bytes
-rw-r--r--web/images/down.gifbin0 -> 633 bytes
-rw-r--r--web/images/edit.gifbin0 -> 434 bytes
-rw-r--r--web/images/error.gifbin0 -> 403 bytes
-rw-r--r--web/images/favicon.icobin0 -> 1406 bytes
-rw-r--r--web/images/first.gifbin0 -> 706 bytes
-rw-r--r--web/images/information.gifbin0 -> 666 bytes
-rw-r--r--web/images/last.gifbin0 -> 699 bytes
-rw-r--r--web/images/list.gifbin0 -> 333 bytes
-rw-r--r--web/images/load.gifbin0 -> 825 bytes
-rw-r--r--web/images/logo.pngbin0 -> 1506 bytes
-rw-r--r--web/images/mail-new.gifbin0 -> 443 bytes
-rw-r--r--web/images/mail.gifbin0 -> 1186 bytes
-rw-r--r--web/images/network-server.gifbin0 -> 195 bytes
-rw-r--r--web/images/next.gifbin0 -> 623 bytes
-rw-r--r--web/images/ok.gifbin0 -> 382 bytes
-rw-r--r--web/images/previous.gifbin0 -> 616 bytes
-rw-r--r--web/images/remove.gifbin0 -> 76 bytes
-rw-r--r--web/images/search.gifbin0 -> 587 bytes
-rw-r--r--web/images/shred.gifbin0 -> 380 bytes
-rw-r--r--web/images/sort-asc.gifbin0 -> 328 bytes
-rw-r--r--web/images/sort-desc.gifbin0 -> 323 bytes
-rw-r--r--web/images/top.gifbin0 -> 701 bytes
-rw-r--r--web/images/trash.gifbin0 -> 1199 bytes
-rw-r--r--web/images/up.gifbin0 -> 631 bytes
-rw-r--r--web/images/warning.gifbin0 -> 636 bytes
-rw-r--r--web/index.php10
-rw-r--r--web/robots.txt2
192 files changed, 14877 insertions, 0 deletions
diff --git a/apps/admin/config/app.yml b/apps/admin/config/app.yml
new file mode 100644
index 0000000..1380235
--- /dev/null
+++ b/apps/admin/config/app.yml
@@ -0,0 +1,50 @@
+# default values
+prod:
+ server:
+ default:
+ imap:
+ # Client Backend to use for IMAP server communication
+ # FakeIMAPClient: Returns pseudo data for testing purposes
+ # IMAPClient: Operates on a standards compliant IMAP server
+ client: IMAPClient
+ host: localhost
+ port: 143
+ admin: cyrus
+ pass: secret
+
+all:
+ info:
+ version: 1.0.0
+ pager:
+ max_per_page_options: [10,25,50,100]
+ max_per_page: 25
+ domain:
+ quota: 150000
+ max_mailbox_count: 300
+ default_mailbox_quota: 20000
+ mailbox:
+ deny_names: [cyrus, postmaster]
+ max_address_count: 300
+ address:
+ dest_collapse_count: 1
+ user:
+ domain_perm_collapse_count: 3
+ server:
+ default:
+ pam:
+ # Method to encrypt Mailbox passwords (should match your pam setting)
+ # 0: plain = Passwords stored in plaintext
+ # 1: crypt = Use shadow-compatible crypt(3) function
+ # 2: md5 = Use md5 function
+ # 3: sha1 = Use sha1 function
+ crypt: 1
+ imap:
+ # Client Backend to use for IMAP server communication
+ # FakeIMAPClient: Returns pseudo data for testing purposes
+ # IMAPClient: Operates on a standards compliant IMAP server
+ client: IMAPClient
+ host: mirell.de
+ port: 143
+ admin: cyrus
+ pass: secret
+
diff --git a/apps/admin/config/cache.yml b/apps/admin/config/cache.yml
new file mode 100644
index 0000000..9a80ccb
--- /dev/null
+++ b/apps/admin/config/cache.yml
@@ -0,0 +1,4 @@
+default:
+ enabled: off
+ with_layout: false
+ lifetime: 86400
diff --git a/apps/admin/config/config.php b/apps/admin/config/config.php
new file mode 100644
index 0000000..4038d49
--- /dev/null
+++ b/apps/admin/config/config.php
@@ -0,0 +1,8 @@
+<?php
+
+// include project configuration
+include(SF_ROOT_DIR.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.php');
+
+// symfony bootstraping
+require_once($sf_symfony_lib_dir.'/util/sfCore.class.php');
+sfCore::bootstrap($sf_symfony_lib_dir, $sf_symfony_data_dir);
diff --git a/apps/admin/config/factories.yml b/apps/admin/config/factories.yml
new file mode 100644
index 0000000..5566c36
--- /dev/null
+++ b/apps/admin/config/factories.yml
@@ -0,0 +1,35 @@
+cli:
+ controller:
+ class: sfConsoleController
+ request:
+ class: sfConsoleRequest
+ response:
+ class: sfConsoleResponse
+
+test:
+ storage:
+ class: sfSessionTestStorage
+
+#all:
+# controller:
+# class: sfFrontWebController
+#
+# request:
+# class: sfWebRequest
+#
+# response:
+# class: sfWebResponse
+#
+# user:
+# class: myUser
+#
+# storage:
+# class: sfSessionStorage
+# param:
+# session_name: symfony
+#
+# view_cache:
+# class: sfFileCache
+# param:
+# automaticCleaningFactor: 0
+# cacheDir: %SF_TEMPLATE_CACHE_DIR%
diff --git a/apps/admin/config/filters.yml b/apps/admin/config/filters.yml
new file mode 100644
index 0000000..4850f6f
--- /dev/null
+++ b/apps/admin/config/filters.yml
@@ -0,0 +1,10 @@
+rendering: ~
+web_debug: ~
+security: ~
+
+# generally, you will want to insert your own filters here
+
+cache: ~
+common: ~
+flash: ~
+execution: ~
diff --git a/apps/admin/config/i18n.yml b/apps/admin/config/i18n.yml
new file mode 100644
index 0000000..b849457
--- /dev/null
+++ b/apps/admin/config/i18n.yml
@@ -0,0 +1,7 @@
+all:
+ default_culture: en
+ source: XLIFF
+ debug: off
+ cache: on
+ untranslated_prefix: "[T]"
+ untranslated_suffix: "[/T]"
diff --git a/apps/admin/config/logging.yml b/apps/admin/config/logging.yml
new file mode 100644
index 0000000..df51180
--- /dev/null
+++ b/apps/admin/config/logging.yml
@@ -0,0 +1,22 @@
+prod:
+ enabled: off
+ level: err
+ rotate: on
+ purge: off
+
+#all:
+# enabled: on
+# level: debug
+# rotate: off
+# period: 7
+# history: 10
+# purge: on
+# loggers:
+# sf_web_debug:
+# class: sfWebDebugLogger
+# param:
+# condition: %SF_WEB_DEBUG%
+# sf_file_debug:
+# class: sfFileLogger
+# param:
+# file: %SF_LOG_DIR%/%SF_APP%_%SF_ENVIRONMENT%.log
diff --git a/apps/admin/config/routing.yml b/apps/admin/config/routing.yml
new file mode 100644
index 0000000..a3e29c3
--- /dev/null
+++ b/apps/admin/config/routing.yml
@@ -0,0 +1,23 @@
+# default rules
+homepage:
+ url: /
+ param: { module: domain, action: index }
+
+login:
+ url: /login
+ param: { module: user, action: login }
+
+logout:
+ url: /logout
+ param: { module: user, action: logout }
+
+default_symfony:
+ url: /symfony/:action/*
+ param: { module: default }
+
+default_index:
+ url: /:module
+ param: { action: index }
+
+default:
+ url: /:module/:action/*
diff --git a/apps/admin/config/security.yml b/apps/admin/config/security.yml
new file mode 100644
index 0000000..87ef379
--- /dev/null
+++ b/apps/admin/config/security.yml
@@ -0,0 +1,3 @@
+all:
+ is_secure: on
+
diff --git a/apps/admin/config/settings.yml b/apps/admin/config/settings.yml
new file mode 100644
index 0000000..c4d36e5
--- /dev/null
+++ b/apps/admin/config/settings.yml
@@ -0,0 +1,117 @@
+prod:
+ .settings:
+ no_script_name: on
+
+dev:
+ .settings:
+ # E_ALL | E_STRICT = 4095
+ error_reporting: 4095
+ web_debug: on
+ cache: off
+ no_script_name: off
+ etag: off
+
+test:
+ .settings:
+ # E_ALL | E_STRICT & ~E_NOTICE = 2047
+ error_reporting: 2047
+ cache: off
+ web_debug: off
+ no_script_name: off
+ etag: off
+
+all:
+ .settings:
+ validation_error_prefix: ''
+ validation_error_suffix: ''
+
+ i18n: on
+
+ .actions:
+ login_module: user
+ login_action: login
+
+ secure_module: content
+ secure_action: secure
+
+#all:
+# .actions:
+# default_module: default # Default module and action to be called when
+# default_action: index # A routing rule doesn't set it
+#
+# error_404_module: default # To be called when a 404 error is raised
+# error_404_action: error404 # Or when the requested URL doesn't match any route
+#
+# login_module: default # To be called when a non-authenticated user
+# login_action: login # Tries to access a secure page
+#
+# secure_module: default # To be called when a user doesn't have
+# secure_action: secure # The credentials required for an action
+#
+# module_disabled_module: default # To be called when a user requests
+# module_disabled_action: disabled # A module disabled in the module.yml
+#
+# unavailable_module: default # To be called when a user requests a page
+# unavailable_action: unavailable # From an application disabled via the available setting below
+#
+# .settings:
+# available: on # Enable the whole application. Switch to off to redirect all requests to the unavailable module and action.
+#
+# # Optional features. Deactivating unused features boots performance a bit.
+# use_database: on # Enable database manager. Set to off if you don't use a database.
+# use_security: on # Enable security features (login and credentials). Set to off for public applications.
+# use_flash: on # Enable flash parameter feature. Set to off if you never use the set_flash() method in actions.
+# i18n: off # Enable interface translation. Set to off if your application should not be translated.
+# check_symfony_version: off # Enable check of symfony version for every request. Set to on to have symfony clear the cache automatically when the framework is upgraded. Set to off if you always clear the cache after an upgrade.
+# use_process_cache: on # Enable symfony optimizations based on PHP accelerators. Set to off for tests or when you have enabled a PHP accelerator in your server but don't want symfony to use it internally.
+# compressed: off # Enable PHP response compression. Set to on to compress the outgoing HTML via the PHP handler.
+# check_lock: off # Enable the application lock system triggered by the clear-cache and disable tasks. Set to on to have all requests to disabled applications redirected to the $sf_symfony_data_dir/web/arrors/unavailable.php page.
+#
+# # Output escaping settings
+# escaping_strategy: bc # Determines how variables are made available to templates. Accepted values: bc, both, on, off. The value off deactivates escaping completely and gives a slight boost.
+# escaping_method: ESC_ENTITIES # Function or helper used for escaping. Accepted values: ESC_RAW, ESC_ENTITIES, ESC_JS, ESC_JS_NO_ENTITIES.
+#
+# # Routing settings
+# suffix: . # Default suffix for generated URLs. If set to a single dot (.), no suffix is added. Possible values: .html, .php, and so on.
+# no_script_name: off # Enable the front controller name in generated URLs
+#
+# # Validation settings, used for error generation by the Validation helper
+# validation_error_prefix: ' &darr;&nbsp;'
+# validation_error_suffix: ' &nbsp;&darr;'
+# validation_error_class: form_error
+# validation_error_id_prefix: error_for_
+#
+# # Cache settings
+# cache: off # Enable the template cache
+# etag: on # Enable etag handling
+#
+# # Logging and debugging settings
+# web_debug: off # Enable the web debug toolbar
+# error_reporting: 341 # Determines which events are logged. The default value is E_PARSE | E_COMPILE_ERROR | E_ERROR | E_CORE_ERROR | E_USER_ERROR = 341
+#
+# # Assets paths
+# rich_text_js_dir: js/tiny_mce
+# prototype_web_dir: /sf/prototype
+# admin_web_dir: /sf/sf_admin
+# web_debug_web_dir: /sf/sf_web_debug
+#
+# # Helpers included in all templates by default
+# standard_helpers: [Partial, Cache, Form]
+#
+# # Activated modules from plugins or from the symfony core
+# enabled_modules: [default]
+#
+# # Charset used for the response
+# charset: utf-8
+#
+# # Miscellaneous
+# strip_comments: on # Remove comments in core framework classes as defined in the core_compile.yml
+# autoloading_functions: ~ # Functions called when a class is requested and this it is not already loaded. Expects an array of callables. Used by the framework bridges.
+# timeout: 1800 # Session timeout, in seconds
+# max_forwards: 5
+# path_info_array: SERVER
+# path_info_key: PATH_INFO
+# url_format: PATH
+#
+# # ORM
+# orm: propel
diff --git a/apps/admin/config/view.yml b/apps/admin/config/view.yml
new file mode 100644
index 0000000..c7e566f
--- /dev/null
+++ b/apps/admin/config/view.yml
@@ -0,0 +1,15 @@
+default:
+ http_metas:
+ content-type: text/html
+
+ metas:
+ title: Mailadmin
+ robots: noindex, nofollow
+ description: IMAP Server Mailadministration
+
+ stylesheets: [main]
+
+ javascripts: []
+
+ has_layout: on
+ layout: layout
diff --git a/apps/admin/lib/imap/FakeIMAPClient.php b/apps/admin/lib/imap/FakeIMAPClient.php
new file mode 100644
index 0000000..aad0207
--- /dev/null
+++ b/apps/admin/lib/imap/FakeIMAPClient.php
@@ -0,0 +1,9 @@
+<?php
+
+class FakeIMAPClient implements IMAPClient
+{
+
+}
+
+
+?>
diff --git a/apps/admin/lib/imap/IMAPClient.php b/apps/admin/lib/imap/IMAPClient.php
new file mode 100644
index 0000000..2271cc9
--- /dev/null
+++ b/apps/admin/lib/imap/IMAPClient.php
@@ -0,0 +1,498 @@
+<?php
+
+// Hello. Let's re-implement as we only need basic stuff...
+// Could not find a suitable OO IMAP client class library either.
+
+class IMAPClient
+{
+ const RESULT_OK = 'OK';
+ const RESULT_NO = 'NO';
+ const RESULT_BAD = 'BAD';
+
+ const STATE_DISCONNECTED = 0;
+ const STATE_GREETING = 1;
+ const STATE_UNAUTH = 2;
+ const STATE_AUTH = 3;
+ const STATE_SELECTED = 4;
+
+ // connection
+ protected $state = self::STATE_DISCONNECTED;
+
+ private $socket = null;
+ public function __destruct()
+ {
+ // connection vanishes with instance
+ if($this->socket)
+ $this->closeConnection();
+ }
+
+ // FIXME: Extract server name and version; should probably be moved to own library (?)
+ /*
+ Couple of banners:
+ * OK mail.mirapoint.com Mirapoint IMAP4 3.7.4-GA server ready
+ * OK [CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA IDLE ACL ACL2=UNION STARTTLS] Courier-IMAP ready. Copyright 1998-2004 Double Precision, Inc. See COPYING for distribution information.
+ * OK mail8.hotbox.ru Cyrus IMAP4 v2.2.3 server ready
+ * OK dovecot ready.
+ * OK Microsoft Exchange IMAP4rev1 server version 5.5.2654.50 (wlvexc00.diginsite.com) ready
+ * OK Microsoft Exchange Server 2003 IMAP4rev1 server version 6.5.6944.0 (stbowa02.stb.sun.ac.za) ready.
+ * OK [x.x.x.x] IMAP4rev1 Mercury/32 v4.01a server ready.
+ * OK Messaging Multiplexor (iPlanet Messaging Server 5.2 HotFix 1.26 (built Mar 31 2004))
+ * OK [CAPABILITY IMAP4REV1 LOGIN-REFERRALS STARTTLS AUTH=LOGIN] leto IMAP4rev1 2001.315rh at Mon, 31 May 2004 11:06:55 +0200 (CEST)
+ * OK mail1 Cyrus IMAP4 v2.0.16 server ready
+ * OK Microsoft Exchange IMAP4rev1 server version Exchange 2000.4208.3 (EX2000.com) ready.
+ * OK mcis.com Microsoft IMAP4Rev1 Server ready at Thu, 16 Mar 2000 19:03:15 -0800 Version: 5.5.1877.377.37
+ */
+
+ // list of (name, version) regex pairs, first match has to be the value
+ protected static $servers = array(
+ array("/(Cyrus\sIMAP)4/", "/Cyrus\sIMAP4\sv((\d+)\.(\d+).(\d+))/"),
+ array("/(Courier.IMAP)/", null),
+ );
+
+ public function getServerName()
+ {
+ foreach(self::$servers as $server)
+ {
+ if(preg_match($server[0], $this->greeting, $matches))
+ {
+ return $matches[1];
+ }
+ }
+
+ return false;
+ }
+
+ public function getServerVersion()
+ {
+ foreach(self::$servers as $server)
+ {
+ if(preg_match($server[0], $this->greeting, $matches))
+ {
+ if($server[1] == null)
+ return "Unknown";
+
+ if(preg_match($server[1], $this->greeting, $matches))
+ {
+ return $matches[1];
+ }
+ }
+ }
+
+ return false;
+ }
+
+ protected $greeting = null;
+ public function getGreeting()
+ {
+ return $this->greeting;
+ }
+
+ protected $uri = null;
+ public function getURI()
+ {
+ return $this->uri;
+ }
+
+ public function openConnection($uri, $timeout = 10)
+ {
+ $this->resetClient();
+ $this->socket = $this->socket = fsockopen($this->uri = $uri, null, $errno, $errstr);
+ if(!$this->socket)
+ throw new Exception('Could not open Socket for IMAP connection: "'.$errstr.'"', $errno);
+ $this->state = self::STATE_GREETING;
+ $this->greeting = fgets($this->socket, 1024);
+
+ if (sfConfig::get('sf_logging_enabled'))
+ {
+ sfContext::getInstance()->getLogger()->info("{IMAPClient} Greeting: ".trim($this->greeting));
+ }
+
+ $this->state = self::STATE_UNAUTH;
+
+ return true;
+ }
+
+ public function closeConnection()
+ {
+ if($this->socket)
+ {
+ if(!$this->logout())
+ throw new Exception("Logout error.");
+ fclose($this->socket);
+ }
+ $this->resetClient();
+ return true;
+ }
+
+ protected function resetClient()
+ {
+ $this->state = self::STATE_GREETING;
+ $this->capabilities = null;
+ $this->hierarchydelimiter = null;
+ }
+
+ protected function sendCommand($tag, $cmd, $args = "")
+ {
+ // check if we got a connection
+ if(!$this->socket)
+ throw new Exception('Unable to execute "'.$cmd.'" command: Not connected to a server.');
+
+ if(is_array($args))
+ {
+ $args = " \"" . implode("\" \"", $args) . "\"";
+ }
+
+ if (sfConfig::get('sf_logging_enabled'))
+ {
+ sfContext::getInstance()->getLogger()->info("{IMAPClient} Command: ".$tag." ".$cmd.$args);
+ }
+
+ //LogEntryPeer::log("{IMAPClient} Command: ".$tag." ".$cmd.$args, LogEntry::PRIO_DEBUG);
+
+ // send command
+ fputs($this->socket, $tag." ".$cmd.$args."\n");
+
+ // read response
+ $response = array();
+ do
+ {
+ $line = fgets($this->socket, 1024);
+ $response[] = $line;
+
+ if (sfConfig::get('sf_logging_enabled'))
+ {
+ sfContext::getInstance()->getLogger()->info("{IMAPClient} Line: \"".trim($line)."\"");
+ }
+ //LogEntryPeer::log("{IMAPClient} Line: \"".trim($line)."\"", LogEntry::PRIO_DEBUG);
+ }
+ while(self::getTag($line) != $tag && !feof($this->socket));
+
+ return $response;
+ }
+
+ // PARSER API
+ protected static $tagcounter = 0;
+ protected static function generateTag()
+ {
+ $pattern = "0123456789".
+ "abcdefghij".
+ "klmnopqrst".
+ "uvwxyz";
+
+ if(self::$tagcounter==0)
+ self::$tagcounter = rand(0,999999);
+
+ $s = "";
+ $r = self::$tagcounter++;
+ do
+ {
+ $m = $r % 36;
+ $s = $pattern{$m} . $s;
+ }
+ while(($r = ($r-$m) / 36) > 0);
+ return sprintf("%04s", $s);
+ }
+
+ protected static function getTag($line)
+ {
+ return self::getResponseData($line, 0);
+ }
+
+ protected static function getResponseData($line, $index = 0)
+ {
+ $tokens = explode(" ", $line);
+ return $tokens[$index];
+ }
+
+ protected static function getResultStatus($tag, $response)
+ {
+ if(is_array($response))
+ {
+ foreach($response as $line)
+ {
+ if(self::getTag($line) == $tag)
+ {
+ return self::getResponseData($line, 1);
+ }
+ }
+ }
+
+ return null;
+ }
+
+ protected function runCommandAndGetResult($command, $arguments = "")
+ {
+ $tag = self::generateTag();
+ $response = $this->sendCommand($tag, $command, $arguments);
+ return self::getResultStatus($tag, $response);
+ }
+
+ // IMAP API
+
+ // RFC 3501 - IMAP4rev1
+ // RFC 1730 - IMAP4
+ public function login($user, $password)
+ {
+ $result = $this->runCommandAndGetResult("login", array($user, $password));
+ if($result == self::RESULT_OK)
+ $this->state = self::STATE_AUTH;
+
+ return ($result == self::RESULT_OK);
+ }
+
+ public function logout()
+ {
+ $result = $this->runCommandAndGetResult("logout");
+ if($result == self::RESULT_OK)
+ $this->state = self::STATE_UNAUTH;
+
+ return ($result == self::RESULT_OK);
+ }
+
+ public function noop()
+ {
+ $result = $this->runCommandAndGetResult("noop");
+ return ($result == self::RESULT_OK);
+ }
+
+ protected $hierarchydelimiter = null;
+
+ public function getHierarchyDelimiter()
+ {
+ if($this->hierarchydelimiter != null)
+ return $this->hierarchydelimiter;
+
+ if($info = $this->getlist('', ''))
+ {
+ $this->hierarchydelimiter = $info[0]['delimiter'];
+ return $this->hierarchydelimiter;
+ }
+
+ return $info;
+ }
+
+ // API break as "list" is PHP keyword...
+ public function getlist($reference = '', $mailboxname = '*')
+ {
+ $tag = self::generateTag();
+ $response = $this->sendCommand($tag, "list", array($reference, $mailboxname));
+ $result = self::getResultStatus($tag, $response);
+
+ if($result == self::RESULT_OK)
+ {
+ // unserialize response
+ $list = array();
+
+ foreach($response as $line)
+ {
+ if(preg_match('/\*\sLIST\s\((.*)\)\s\"(.*?)\"\s\"(.*?)\"/', $line, $matches))
+ {
+ $list[] = array('attributes' => $matches[1],
+ 'delimiter' => $matches[2],
+ 'name' => $matches[3]
+ );
+ }
+ }
+
+ return $list;
+ }
+
+ return false;
+ }
+
+ protected $capabilities = null;
+
+ public function hasCapability($id)
+ {
+ if($this->capabilities == null)
+ $this->capability();
+
+ foreach($this->capabilities as $capability)
+ {
+ if($id == $capability)
+ return true;
+ }
+ return false;
+ }
+
+ public function capability()
+ {
+ // cache this call
+ if($this->capabilities)
+ return $this->capabilities;
+
+ $tag = self::generateTag();
+ $response = $this->sendCommand($tag, "capability");
+ $result = self::getResultStatus($tag, $response);
+
+ if($result == self::RESULT_OK)
+ {
+ foreach($response as $line)
+ {
+ if(preg_match('/\*\sCAPABILITY\s(.*?)$/i', $line, $matches))
+ {
+ $this->capabilities = explode(" ", $matches[1]);
+ return $this->capabilities;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ public function create($name)
+ {
+ $result = $this->runCommandAndGetResult("create", array($name));
+ return ($result == self::RESULT_OK);
+ }
+
+ public function delete($name)
+ {
+ $result = $this->runCommandAndGetResult("delete", array($name));
+ return ($result == self::RESULT_OK);
+ }
+
+ public function rename($name, $newname)
+ {
+ $result = $this->runCommandAndGetResult("rename", array($name, $newname));
+ return ($result == self::RESULT_OK);
+ }
+
+ // RFC 2087 - QUOTA (Extension)
+ const QUOTA_TYPE_STORAGE = "STORAGE";
+ const QUOTA_TYPE_MESSAGE = "MESSAGE";
+
+ public function getquota($quotaroot)
+ {
+ $tag = self::generateTag();
+ $response = $this->sendCommand($tag, "getquota", array($quotaroot));
+ $result = self::getResultStatus($tag, $response);
+
+ if($result == self::RESULT_OK)
+ {
+ foreach($response as $line)
+ {
+ if(preg_match('/\*\sQUOTA\s'.$quotaroot.'\s\((\w)*\s(\d+)\s(\d+)\)/i', $line, $matches))
+ {
+ return array(
+ 'resource' => $matches[1],
+ 'current' => $matches[2],
+ 'max' => $matches[3],
+ );
+ }
+ }
+ }
+
+ // OK -> not set, NO -> not set
+ if($result != self::RESULT_BAD)
+ {
+ return array(
+ 'resource' => null,
+ 'current' => null,
+ 'max' => null
+ );
+ }
+
+ return false;
+ }
+
+ public function setquota($quotaroot, $quota = null, $resource = self::QUOTA_TYPE_STORAGE)
+ {
+ $tag = self::generateTag();
+ $args = ' "'.$quotaroot.'" (';
+ if($quota == 0 || $quota == null)
+ $args .= ')';
+ else
+ $args .= $resource.' '.intval($quota).')';
+ $response = $this->sendCommand($tag, "setquota", $args);
+ $result = self::getResultStatus($tag, $response);
+
+ return ($result == self::RESULT_OK);
+ }
+
+ // RFC 4314 - ACL (Extension)
+ const ACL_NONE = '';
+ const ACL_LOOKUP = 'l';
+ const ACL_READ = 'r';
+ const ACL_SEEN = 's';
+ const ACL_WRITE = 'w';
+ const ACL_INSERT = 'i';
+ const ACL_POST = 'p';
+
+ const ACL_CREATE = 'c'; // obsolete/depreciated
+ const ACL_DELETE = 'd'; // obsolete/depreciated
+
+ const ACL_ADMIN = 'a';
+
+ const ACL_CREATEMB = 'k';
+ const ACL_DELETEMB = 'x';
+ const ACL_EXPUNGE = 'e';
+ const ACL_DELETEMSGS = 't';
+
+ public function getAvailableACL()
+ {
+ $result = self::ACL_LOOKUP.
+ self::ACL_READ.
+ self::ACL_SEEN.
+ self::ACL_WRITE.
+ self::ACL_INSERT.
+ self::ACL_POST.
+ self::ACL_CREATE.
+ self::ACL_DELETE.
+ self::ACL_ADMIN;
+
+ // add additional rights set in the capabilities
+ if($this->capabilities == null)
+ $this->capability();
+
+ foreach($this->capabilities as $capability)
+ {
+ if(preg_match('/RIGHTS=([kxte]*)/i', $capability, $matches))
+ {
+ $result .= $matches[1];
+ break;
+ }
+ }
+
+ return $result;
+ }
+
+ public function getacl($mailboxname)
+ {
+ $tag = self::generateTag();
+ $response = $this->sendCommand($tag, "getacl", array($mailboxname));
+ $result = self::getResultStatus($tag, $response);
+
+ if($result == self::RESULT_OK)
+ {
+ foreach($response as $line)
+ {
+ // grab acl list
+ if(preg_match('/\*\sACL\s[^\s]*\s(.*)/', $line, $matches))
+ {
+ // grab all acls
+ if(preg_match_all('/([^\s]*)\s(['.$this->getAvailableACL().']*)/', $matches[1], $matches))
+ {
+ return array_combine($matches[1], $matches[2]);
+ }
+ }
+ }
+ }
+
+ return false;
+ }
+
+ public function setacl($mailboxname, $identifier, $aclmodification)
+ {
+ $result = $this->runCommandAndGetResult("setacl", array($mailboxname, $identifier, $aclmodification));
+ return ($result == self::RESULT_OK);
+ }
+
+ public function deleteacl($mailboxname, $identifier)
+ {
+ $result = $this->runCommandAndGetResult("deleteacl", array($mailboxname, $identifier));
+ return ($result == self::RESULT_OK);
+ }
+}
+
+?>
diff --git a/apps/admin/lib/imap/IMAPManager.php b/apps/admin/lib/imap/IMAPManager.php
new file mode 100644
index 0000000..0cac78a
--- /dev/null
+++ b/apps/admin/lib/imap/IMAPManager.php
@@ -0,0 +1,48 @@
+<?php
+
+class IMAPManager
+{
+ protected static $adminclient = null;
+ public static function getAdminConnection()
+ {
+ // exists
+ if(self::$adminclient != null)
+ return self::$adminclient;
+
+ // create new instance
+ $server_settings = sfConfig::get('app_server_default');
+ $imap_settings = $server_settings['imap'];
+ self::$adminclient = new $imap_settings['client'];
+
+ // login
+ try
+ {
+ self::$adminclient->openConnection(
+ $imap_settings['host'].":".
+ $imap_settings['port']
+ );
+
+ $success = self::$adminclient->login(
+ $imap_settings['admin'],
+ $imap_settings['pass']
+ );
+
+ if(!$success)
+ throw new Exception("Failed to authenticate on IMAP server.");
+
+ } catch (Exception $e) {
+ LogEntryPeer::log($e->getMessage(), LogEntry::PRIO_ALERT);
+ }
+
+ return self::$adminclient;
+ }
+
+ public static function getAdminUsername()
+ {
+ $server_settings = sfConfig::get('app_server_default');
+ $imap_settings = $server_settings['imap'];
+ return $imap_settings['admin'];
+ }
+}
+
+?>
diff --git a/apps/admin/lib/imap/IMAPServerInformation.php b/apps/admin/lib/imap/IMAPServerInformation.php
new file mode 100644
index 0000000..e185bae
--- /dev/null
+++ b/apps/admin/lib/imap/IMAPServerInformation.php
@@ -0,0 +1,63 @@
+<?php
+
+class IMAPServerInformation
+{
+ protected $imap = null;
+
+ public function __construct()
+ {
+ $this->imap = IMAPManager::getAdminConnection();
+ }
+
+ public function getGreeting()
+ {
+ return substr($this->imap->getGreeting(), 5);
+ }
+
+ public function getServerName()
+ {
+ return $this->imap->getServerName();
+ }
+
+ public function getServerVersion()
+ {
+ return $this->imap->getServerVersion();
+ }
+
+ public function hasCapability($name)
+ {
+ return $this->imap->hasCapability($name);
+ }
+
+ public function getCapabilties()
+ {
+ if(!($c = $this->imap->capability()))
+ $c = array();
+ return $c;
+ }
+
+ public function getHierarchyDelimiter()
+ {
+ return $this->imap->getHierarchyDelimiter();
+ }
+
+ public function getAvailableACL()
+ {
+ if(!$this->imap->hasCapability('ACL'))
+ return false;
+
+ return $this->imap->getAvailableACL();
+ }
+
+ public function getHost()
+ {
+ return substr($this->imap->getURI(), 0, strpos($this->imap->getURI(), ":"));
+ }
+
+ public function getPort()
+ {
+ return substr($this->imap->getURI(), strpos($this->imap->getURI(), ":")+1);
+ }
+}
+
+?>
diff --git a/apps/admin/lib/myChangeNicknameValidator.php b/apps/admin/lib/myChangeNicknameValidator.php
new file mode 100644
index 0000000..e8dfdb1
--- /dev/null
+++ b/apps/admin/lib/myChangeNicknameValidator.php
@@ -0,0 +1,43 @@
+<?php
+
+class myChangeNicknameValidator extends sfValidator
+{
+ public function initialize($context, $parameters = null)
+ {
+ // initialize parent
+ parent::initialize($context);
+
+ // set defaults
+ $this->setParameter('change_error', 'Invalid input');
+
+ $this->getParameterHolder()->add($parameters);
+
+ return true;
+ }
+
+ public function execute(&$value, &$error)
+ {
+ $current_nickname = $this->getContext()->getUser()->getNickname();
+
+ $new_nickname = $value;
+
+ // changed the nickname?
+ if($new_nickname == $current_nickname)
+ return true;
+
+ $c = new Criteria();
+ $c->add(UserPeer::NICKNAME, $new_nickname);
+ $user = UserPeer::doSelectOne($c);
+
+ // nickname exists?
+ if($user)
+ {
+ $error = $this->getParameter('change_error');
+ return false;
+ }
+
+ return true;
+ }
+}
+
+?>
diff --git a/apps/admin/lib/myDenyStringValidator.php b/apps/admin/lib/myDenyStringValidator.php
new file mode 100644
index 0000000..d817ea9
--- /dev/null
+++ b/apps/admin/lib/myDenyStringValidator.php
@@ -0,0 +1,38 @@
+<?php
+
+class myDenyStringValidator extends sfValidator
+{
+ public function initialize($context, $parameters = null)
+ {
+ // initialize parent
+ parent::initialize($context);
+
+ // set defaults
+ $this->setParameter('values_error', 'Invalid input');
+
+ $this->getParameterHolder()->add($parameters);
+
+ return true;
+ }
+
+ public function execute(&$value, &$error)
+ {
+ $values = $this->getParameter('values');
+
+ if(!is_array($values))
+ return true;
+
+ foreach($values as $check)
+ {
+ if($check==$value)
+ {
+ $error = $this->getParameter('values_error');
+ return false;
+ }
+ }
+
+ return true;
+ }
+}
+
+?>
diff --git a/apps/admin/lib/myLoginValidator.php b/apps/admin/lib/myLoginValidator.php
new file mode 100644
index 0000000..03890aa
--- /dev/null
+++ b/apps/admin/lib/myLoginValidator.php
@@ -0,0 +1,45 @@
+<?php
+
+class myLoginValidator extends sfValidator
+{
+ public function initialize($context, $parameters = null)
+ {
+ // initialize parent
+ parent::initialize($context);
+
+ // set defaults
+ $this->setParameter('login_error', 'Invalid input');
+
+ $this->getParameterHolder()->add($parameters);
+
+ return true;
+ }
+
+ public function execute(&$value, &$error)
+ {
+ $password_param = $this->getParameter('password');
+ $password = $this->getContext()->getRequest()->getParameter($password_param);
+
+ $login = $value;
+
+ $c = new Criteria();
+ $c->add(UserPeer::NICKNAME, $login);
+ $user = UserPeer::doSelectOne($c);
+
+ // nickname exists?
+ if ($user)
+ {
+ // password is OK?
+ if (sha1($user->getSalt().$password) == $user->getSha1Password())
+ {
+ $this->getContext()->getUser()->signIn($user);
+ return true;
+ }
+ }
+
+ $error = $this->getParameter('login_error');
+ return false;
+ }
+}
+
+?>
diff --git a/apps/admin/lib/myUser.class.php b/apps/admin/lib/myUser.class.php
new file mode 100644
index 0000000..2f67e51
--- /dev/null
+++ b/apps/admin/lib/myUser.class.php
@@ -0,0 +1,83 @@
+<?php
+
+class myUser extends sfBasicSecurityUser
+{
+ public function signIn($user)
+ {
+ $this->setAuthenticated(true);
+
+ // TODO: set credentials
+ $this->addCredential($user->getRole()->getCredentials());
+
+ // set session attributes
+ $this->updateUserAttributes($user);
+
+ $this->setResultsPerPage(sfConfig::get("app_pagination_results_per_page"));
+
+ LogEntryPeer::log("User logged in.", LogEntry::PRIO_INFO);
+
+ $user->setLastlogin(time());
+ $user->save();
+ }
+
+ public function updateUserAttributes($user)
+ {
+ $this->setAttribute("nickname", $user->getNickname(), "user");
+ $this->setAttribute("role", $user->getRole()->getName(), "user");
+ $this->setAttribute("role_id", $user->getRole()->getId(), "user");
+ $this->setAttribute("user_id", $user->getId(), "user");
+ $this->setAttribute("lastlogin", $user->getLastLogin(), "user");
+ }
+
+ public function signOut($user)
+ {
+ LogEntryPeer::log("User logged out.", LogEntry::PRIO_INFO);
+
+ $this->setAuthenticated(false);
+ $this->clearCredentials();
+ $this->getAttributeHolder()->removeNamespace("user");
+ $this->getAttributeHolder()->removeNamespace("pager");
+ }
+
+ public function getResultsPerPage()
+ {
+ return $this->getAttribute("max_per_page", sfConfig::get("app_pager_max_per_page"), "pager");
+ }
+
+
+ public function setResultsPerPage($count)
+ {
+ $this->setAttribute("max_per_page", $count, "pager");
+ }
+
+ public function getDomainPermissions($c = null)
+ {
+ $user = UserPeer::retrieveByPK($this->getId());
+ return $user->getDomainPermissions($c);
+ }
+
+ public function getId()
+ {
+ return $this->getAttribute("user_id", '', "user");
+ }
+
+ public function getLastLogin()
+ {
+ return $this->getAttribute("lastlogin", '', "user");
+ }
+
+ public function getRoleId()
+ {
+ return $this->getAttribute("role_id", '', "user");
+ }
+
+ public function getRoleName()
+ {
+ return $this->getAttribute("role", '', "user");
+ }
+
+ public function getNickname()
+ {
+ return $this->getAttribute("nickname", '', "user");
+ }
+}
diff --git a/apps/admin/modules/address/actions/actions.class.php b/apps/admin/modules/address/actions/actions.class.php
new file mode 100644
index 0000000..d042fbf
--- /dev/null
+++ b/apps/admin/modules/address/actions/actions.class.php
@@ -0,0 +1,165 @@
+<?php
+
+/**
+ * address actions.
+ *
+ * @package mailadmin
+ * @subpackage address
+ * @author Your name here
+ * @version SVN: $Id: actions.class.php 2288 2006-10-02 15:22:13Z fabien $
+ */
+class addressActions extends autoaddressActions
+{
+ public function executeList()
+ {
+ // pageination
+ if($this->hasRequestParameter("max_per_page"))
+ $this->getUser()->setResultsPerPage($this->getRequestParameter("max_per_page"));
+
+ return parent::executeList();
+ }
+
+ public function executeCreate()
+ {
+ $this->setTemplate("edit");
+ $result = $this->executeEdit();
+
+ if($this->getRequest()->getMethod() == sfRequest::GET)
+ {
+ if(!$this->hasRequestParameter("id"))
+ {
+ $this->updateAddressFromRequest();
+ }
+ $this->address->setActive(true);
+ $this->address->setSaveInMailbox(true);
+ }
+
+ return $result;
+ }
+
+ public function handleErrorCreate()
+ {
+ $this->setTemplate("edit");
+ return $this->handleErrorEdit();
+ }
+
+ public function validateCreate()
+ {
+ return $this->validateEdit();
+ }
+
+ public function validateEdit()
+ {
+ $i18n = sfI18N::getInstance();
+
+ if($this->getRequest()->getMethod() == sfRequest::GET)
+ return true;
+
+ $newaddress = $this->getRequestParameter('address');
+ if($newaddress["domain_id"]=='')
+ {
+ $this->getRequest()->setError('address{alias}', 'A domain must be selected');
+ return false;
+ }
+
+ $address = new Address();
+
+ if($this->getRequest()->hasParameter('id'))
+ $address = AddressPeer::retrieveByPk($this->getRequestParameter('id'));
+
+ // if we got different values than the current record already has
+ if($this->getActionName()=="create" ||
+ $address->getLocalpart() != $newaddress["localpart"] ||
+ $address->getDomainId() != $newaddress["domain_id"]
+ )
+ {
+ // check if localpart@domain is already used
+ $c = new Criteria();
+ $c->add(AddressPeer::LOCALPART, $newaddress["localpart"]);
+ $c->add(AddressPeer::DOMAIN_ID, $newaddress["domain_id"]);
+ $checkaddress = AddressPeer::doSelectOne($c);
+ if($checkaddress)
+ {
+ $this->getRequest()->setError('address{alias}', $i18n->__('The address "%1%" already exists', array("%1%"=>$checkaddress)));
+ return false;
+ }
+ }
+
+ // check if either save to mailbox option or destination is set to satisfy message routing
+ if(!isset($newaddress["save_in_mailbox"]) && $newaddress["destination"]=='')
+ {
+ $this->getRequest()->setError('address{save_in_mailbox}', 'If messages are not saved in the mailbox, the forward destination has to be set');
+ $this->getRequest()->setError('address{destination}', 'Destination can not be empty if the message is not saved in the mailbox');
+ return false;
+
+ }
+
+ // verify destination list
+ $ev = new sfEmailValidator();
+ $destinations = Address::getDestinationAsArray($newaddress["destination"]);
+ foreach($destinations as $dest)
+ {
+ if($dest=='')
+ continue;
+
+ // check email
+ if(strpos($dest, "@") !== false)
+ {
+ $error = '';
+ $ev->initialize($this->getContext(), array(
+ 'email_error' => $i18n->__('Invalid E-Mail address "%1%"', array("%1%" => $dest))
+ ));
+
+ if(!$ev->execute($dest, $error))
+ {
+ $this->getRequest()->setError('address{destination}', $error);
+ return false;
+ }
+ }
+ else // check if mailbox name is valid
+ {
+ // superadmin has all freedom
+ if($this->getUser()->hasCredential("superadmin"))
+ continue;
+
+ $c = new Criteria();
+ $c->add(MailboxPeer::NAME, $dest);
+ $mailbox = MailboxPeer::doSelectOne($c);
+ if(!$mailbox)
+ {
+ // no such target
+ $this->getRequest()->setError('address{destination}', $i18n->__('Mailbox "%1%" does not exist', array("%1%" => $dest)));
+ return false;
+ }
+
+ // check permissions
+ $c = new Criteria();
+ $c->add(DomainPermissionPeer::DOMAIN_ID, $mailbox->getDomainId());
+ $permissions = $this->getUser()->getDomainPermissions($c);
+ if(!$permissions)
+ {
+ $this->getRequest()->setError('address{destination}', $i18n->__('No permissions to use Mailbox "%1%" as destination', array("%1%" => $dest)));
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
+ protected function updateAddressFromRequest()
+ {
+ $address = $this->getRequestParameter('address');
+
+ if (isset($address['localpart']))
+ {
+ $this->address->setLocalpart($address['localpart']);
+ }
+ if (isset($address['domain_id']))
+ {
+ $this->address->setDomainId($address['domain_id']);
+ }
+
+ return parent::updateAddressFromRequest();
+ }
+}
diff --git a/apps/admin/modules/address/config/generator.yml b/apps/admin/modules/address/config/generator.yml
new file mode 100644
index 0000000..2bd2e44
--- /dev/null
+++ b/apps/admin/modules/address/config/generator.yml
@@ -0,0 +1,48 @@
+generator:
+ class: sfPropelAdminGenerator
+ param:
+ model_class: Address
+ theme: mailadmin
+
+ fields:
+ destination: { name: Destination }
+ mailbox_id: { name: Mailbox }
+ active: { name: Active }
+
+ list:
+ peer_method: doSelectJoinAll
+ title: List of Addresses
+ display: [=_localpart, _domain_id, _destination, active, _mailbox_id]
+ filters: [alias, domain_id, active, mailbox_id, destination]
+ max_per_page: '$this->getUser()->getResultsPerPage("pager")'
+ sort: [mailbox_id, asc]
+ fields:
+ localpart: { name: Address, params: align=right }
+ domain_id: { params: align=left }
+ alias: { params: align=left }
+ destination: { params: align=left }
+ active: { params: align=center width=1% }
+ mailbox_id: { params: align=right }
+ object_actions:
+ edit: { name: Edit Address, action: edit, icon: edit.gif }
+ delete: { name: Delete Address, action: delete, icon: trash.gif, params: confirm=Are you sure? }
+ actions: {}
+
+ create:
+ title: Create New Address
+
+ edit:
+ title: 'Editing Address %%alias%%'
+ display:
+ 'Address': [_alias, active, mailbox_id]
+ 'Destination': [save_in_mailbox, destination]
+ fields:
+ mailbox_id: { name: For Mailbox, help: 'The primary mailbox for this address' }
+ alias: { name: Address, help: 'Leave blank if this is a catch all address' }
+ save_in_mailbox: { name: Save to Mailbox, type: checkbox_tag, help: 'Incoming messages are saved, then forwarded' }
+ destination: { name: Forward to these Destinations, params: size=51x8, help: 'E-Mail addresses and/or mailbox names, one per line or comma-seperated' }
+ active: { name: Active, help: Inactive addresses are not routed }
+ actions:
+ _save_and_list: { name: Save }
+ _save_and_add: { name: 'Save, then create new one' }
+ _list: { name: Cancel }
diff --git a/apps/admin/modules/address/templates/_alias.php b/apps/admin/modules/address/templates/_alias.php
new file mode 100644
index 0000000..e6550c1
--- /dev/null
+++ b/apps/admin/modules/address/templates/_alias.php
@@ -0,0 +1,9 @@
+<?php use_helper("Object") ?><?php $value = object_input_tag($address, 'getLocalpart', array (
+ 'size' => 25,
+ 'control_name' => 'address[localpart]',
+ 'style' => 'text-align:right',
+)); echo $value ? $value : '&nbsp;' ?> @ <?php $value = object_select_tag($address, 'getDomainId', array (
+ 'related_class' => 'Domain',
+ 'control_name' => 'address[domain_id]',
+ 'include_blank' => true,
+)); echo $value ? $value : '&nbsp;' ?>
diff --git a/apps/admin/modules/address/templates/_destination.php b/apps/admin/modules/address/templates/_destination.php
new file mode 100644
index 0000000..f01676c
--- /dev/null
+++ b/apps/admin/modules/address/templates/_destination.php
@@ -0,0 +1,23 @@
+<?php use_helper('I18N','Javascript'); ?>
+<?php $list = Address::getDestinationAsArray($address->getDestination());
+ if($address->getSaveInMailbox())
+ $list = array_merge(array($address->getMailbox()->getName()), $list);
+?>
+<div class="slidelist">
+<?php if(count($list) > sfConfig::get('app_address_dest_collapse_count')): ?>
+
+<?php echo link_to_function(__("Multiple (%1% entries)", array('%1%' => count($list))), visual_effect(
+'toggle_slide', 'addresslist_'.$address->getId())) ?>
+<div id="addresslist_<?php echo $address->getId() ?>" style="display:none">
+<?php endif; ?>
+
+<ul>
+<?php foreach($list as $destination): ?>
+<li><?php echo ($destination==$address->getMailbox()->getName()? __("Mailbox"): $destination) ?></li>
+<?php endforeach; ?>
+</ul>
+
+<?php if(count($list) > 1): ?>
+</div>
+<?php endif; ?>
+</div>
diff --git a/apps/admin/modules/address/templates/_domain_id.php b/apps/admin/modules/address/templates/_domain_id.php
new file mode 100644
index 0000000..bb51b3d
--- /dev/null
+++ b/apps/admin/modules/address/templates/_domain_id.php
@@ -0,0 +1 @@
+@<?php echo $address->getDomain() ?>
diff --git a/apps/admin/modules/address/templates/_localpart.php b/apps/admin/modules/address/templates/_localpart.php
new file mode 100644
index 0000000..e01fe5d
--- /dev/null
+++ b/apps/admin/modules/address/templates/_localpart.php
@@ -0,0 +1 @@
+<?php echo ($address->isCatchAll() ? "*": $address->getLocalpart() ) ?>
diff --git a/apps/admin/modules/address/templates/_mailbox_id.php b/apps/admin/modules/address/templates/_mailbox_id.php
new file mode 100644
index 0000000..0ab885b
--- /dev/null
+++ b/apps/admin/modules/address/templates/_mailbox_id.php
@@ -0,0 +1 @@
+<?php echo $address->getMailbox() ?>
diff --git a/apps/admin/modules/address/validate/create.yml b/apps/admin/modules/address/validate/create.yml
new file mode 100644
index 0000000..a55efed
--- /dev/null
+++ b/apps/admin/modules/address/validate/create.yml
@@ -0,0 +1,10 @@
+fillin:
+ enabled: true
+
+fields:
+ address{domain_id}:
+ required:
+ msg: A domain has to be selected
+ address{mailbox_id}:
+ required:
+ msg: A primary mailbox has to be selected
diff --git a/apps/admin/modules/address/validate/edit.yml b/apps/admin/modules/address/validate/edit.yml
new file mode 100644
index 0000000..a55efed
--- /dev/null
+++ b/apps/admin/modules/address/validate/edit.yml
@@ -0,0 +1,10 @@
+fillin:
+ enabled: true
+
+fields:
+ address{domain_id}:
+ required:
+ msg: A domain has to be selected
+ address{mailbox_id}:
+ required:
+ msg: A primary mailbox has to be selected
diff --git a/apps/admin/modules/content/actions/actions.class.php b/apps/admin/modules/content/actions/actions.class.php
new file mode 100644
index 0000000..bbc9d08
--- /dev/null
+++ b/apps/admin/modules/content/actions/actions.class.php
@@ -0,0 +1,18 @@
+<?php
+
+/**
+ * content actions.
+ *
+ * @package mailadmin
+ * @subpackage content
+ * @author Your name here
+ * @version SVN: $Id: actions.class.php 2692 2006-11-15 21:03:55Z fabien $
+ */
+class contentActions extends sfActions
+{
+ public function executeSecure()
+ {
+ LogEntryPeer::log("Attempt to access a secured action without proper credentials.", LogEntry::PRIO_WARNING);
+ $this->redirect($this->getRequest()->getReferer(), '@homepage');
+ }
+}
diff --git a/apps/admin/modules/domain/actions/actions.class.php b/apps/admin/modules/domain/actions/actions.class.php
new file mode 100644
index 0000000..badbf03
--- /dev/null
+++ b/apps/admin/modules/domain/actions/actions.class.php
@@ -0,0 +1,47 @@
+<?php
+
+/**
+ * domain actions.
+ *
+ * @package mailadmin
+ * @subpackage domain
+ * @author Your name here
+ * @version SVN: $Id: actions.class.php 2288 2006-10-02 15:22:13Z fabien $
+ */
+class domainActions extends autodomainActions
+{
+ public function executeList()
+ {
+ // pageination
+ if($this->hasRequestParameter("max_per_page"))
+ $this->getUser()->setResultsPerPage($this->getRequestParameter("max_per_page"));
+
+ return parent::executeList();
+ }
+
+ public function executeCreate()
+ {
+ // populate preset values
+ $this->getRequest()->setParameter('domain[creator_id]', $this->getUser()->getId());
+
+ $this->setTemplate("edit");
+ return $this->executeEdit();
+ }
+
+ public function handleErrorCreate()
+ {
+ $this->setTemplate("edit");
+ return $this->handleErrorEdit();
+ }
+
+ public function executeCreateMailbox()
+ {
+ $domain = DomainPeer::retrieveByPk($this->getRequestParameter('id'));
+ $this->redirect("mailbox/create?mailbox[domain_id]=".$domain->getId()."&mailbox[name]=".sprintf("%s%d", $domain->getMailboxPrefix(), $domain->getMailboxCount()+1)."&mailbox[max_quota]=".$domain->getDefaultMailboxQuota() );
+ }
+
+ public function executeViewMailboxes()
+ {
+ $this->redirect("mailbox/list?filter=filter&filters[domain_id]=".$this->getRequestParameter('id'));
+ }
+}
diff --git a/apps/admin/modules/domain/config/generator.yml b/apps/admin/modules/domain/config/generator.yml
new file mode 100644
index 0000000..df971b3
--- /dev/null
+++ b/apps/admin/modules/domain/config/generator.yml
@@ -0,0 +1,53 @@
+generator:
+ class: sfPropelAdminGenerator
+ param:
+ model_class: Domain
+ theme: mailadmin
+
+ fields:
+ name: { name: Domain }
+ mailbox_prefix: { name: Mailbox Prefix }
+ max_mailbox_count: { name: Max Mailbox Count }
+ quota: { name: Quota }
+ creator: { name: Created by }
+
+ list:
+ title: List of Domains
+ display: [=name, user, mailbox_prefix, _max_mailbox_count, _quota, _default_mailbox_quota]
+ filters: [name, mailbox_prefix, max_mailbox_count, quota, default_mailbox_quota]
+ max_per_page: '$this->getUser()->getResultsPerPage("pager")'
+ sort: [name, asc]
+ fields:
+ name: { params: align=left }
+ mailbox_prefix: { params: align=left }
+ user: { name: Created By, credentials: [[superadmin]] }
+ max_mailbox_count: { params: align=right }
+ mailbox_count: { params: align=right }
+ quota: { params: align=right }
+ default_mailbox_quota: { name: Default Mailbox Quota, params: align=right }
+ object_actions:
+ viewmailboxes: { name: View Mailboxes, action: viewMailboxes, icon: mail.gif }
+ createmailbox: { name: Create New Mailbox, action: createMailbox, icon: mail-new.gif }
+ edit: { name: Edit Domain, action: edit, icon: edit.gif, credentials: [[superadmin, domainmaster]] }
+ delete: { name: Delete Domain, action: delete, icon: trash.gif, credentials: [[superadmin, domainmaster]], params: confirm=Are you sure? }
+ actions: {}
+
+ create:
+ title: Create New Domain
+
+ edit:
+ title: 'Editing Domain %%name%%'
+ display:
+ 'General Settings': [name, mailbox_prefix]
+ 'Limits': [max_mailbox_count, quota, default_mailbox_quota]
+ fields:
+ name: { name: Domain Name, params: size=50 }
+ mailbox_prefix: { name: Prefix for new Mailboxes, params: size=50 onfocus='updatePrefixFromDomainName(this);' }
+ max_mailbox_count: { name: Maximum Number of Mailboxes, help: '0 = No Limit', params: size=50 }
+ quota: { name: Default Quota in kb, help: '0 = No Limit', params: size=50 }
+ default_mailbox_quota: { name: Quota for Domain in kb, help: '0 = No Limit', params: size=50 }
+ actions:
+ _save_and_list: { name: Save }
+ _save_and_add: { name: 'Save, then create new one' }
+ _list: { name: Cancel }
+
diff --git a/apps/admin/modules/domain/config/security.yml b/apps/admin/modules/domain/config/security.yml
new file mode 100644
index 0000000..2431ebf
--- /dev/null
+++ b/apps/admin/modules/domain/config/security.yml
@@ -0,0 +1,11 @@
+create:
+ is_secure: on
+ credentials: [[superadmin, domainmaster]]
+
+edit:
+ is_secure: on
+ credentials: [[superadmin, domainmaster]]
+
+all:
+ is_secure: on
+
diff --git a/apps/admin/modules/domain/templates/_default_mailbox_quota.php b/apps/admin/modules/domain/templates/_default_mailbox_quota.php
new file mode 100644
index 0000000..272ad83
--- /dev/null
+++ b/apps/admin/modules/domain/templates/_default_mailbox_quota.php
@@ -0,0 +1 @@
+<?php use_helper("Files") ?><?php echo ($domain->getDefaultMailboxQuota()==0 ? "Unlimited" : format_bytes($domain->getDefaultMailboxQuota()*1000)) ?>
diff --git a/apps/admin/modules/domain/templates/_edit_header.php b/apps/admin/modules/domain/templates/_edit_header.php
new file mode 100644
index 0000000..fed004a
--- /dev/null
+++ b/apps/admin/modules/domain/templates/_edit_header.php
@@ -0,0 +1,13 @@
+<?php use_helper("Javascript") ?>
+
+<?php
+ use_javascript(sfConfig::get('sf_prototype_web_dir').'/js/prototype');
+
+ echo javascript_tag("
+ function updatePrefixFromDomainName(field) {
+ v = $('domain_name').value;
+ if(field.value!='') return true;
+ field.value = v.substring(0, v.indexOf('.'));
+ return true;
+ }");
+?>
diff --git a/apps/admin/modules/domain/templates/_max_mailbox_count.php b/apps/admin/modules/domain/templates/_max_mailbox_count.php
new file mode 100644
index 0000000..8b7a70b
--- /dev/null
+++ b/apps/admin/modules/domain/templates/_max_mailbox_count.php
@@ -0,0 +1 @@
+<?php echo $domain->getMailboxCount() ?> / <?php echo ($domain->getMaxMailboxCount()==0 ? "Unlimited": $domain->getMaxMailboxCount()) ?>
diff --git a/apps/admin/modules/domain/templates/_quota.php b/apps/admin/modules/domain/templates/_quota.php
new file mode 100644
index 0000000..0b36b22
--- /dev/null
+++ b/apps/admin/modules/domain/templates/_quota.php
@@ -0,0 +1 @@
+<?php use_helper("Files") ?><?php echo format_bytes($domain->getUsedQuota()*1000) ?> / <?php echo ($domain->getQuota()==0 ? "Unlimited" : format_bytes($domain->getQuota()*1000)) ?>
diff --git a/apps/admin/modules/domain/validate/create.yml b/apps/admin/modules/domain/validate/create.yml
new file mode 100644
index 0000000..c8183c2
--- /dev/null
+++ b/apps/admin/modules/domain/validate/create.yml
@@ -0,0 +1,46 @@
+fillin:
+ enabled: true
+
+validators:
+ myStringValidator:
+ class: sfStringValidator
+ param:
+ min: 2
+ min_error: This field is too short (2 characters minimum)
+ max: 100
+ max_error: This field is too long (100 characters maximum)
+
+fields:
+ domain{name}:
+ required:
+ msg: The Domain Name is required
+ myStringValidator:
+ sfRegexValidator:
+ match:..........Yes
+ match_error: 'The name must be in the form: example.org'
+ pattern: /[^.]+\.[^.]+$/si
+ sfPropelUniqueValidator:
+ class: Domain
+ column: name
+ unique_error: This domain already exists
+ domain{mailbox_prefix}:
+ required:
+ msg: The Mailbox Prefix is required
+ myStringValidator:
+ sfRegexValidator:
+ match: Yes
+ match_error: The prefix must only consist out of alphanumeric characters
+ pattern: /[A-z0-9]/si
+ sfPropelUniqueValidator:
+ class: Domain
+ column: mailbox_prefix
+ unique_error: This prefix already exists
+ domain{max_mailbox_count}:
+ required:
+ msg: The Mailbox Count is required
+ domain{quota}:
+ required:
+ msg: The Domain Quota is required
+ domain{default_mailbox_quota}:
+ required:
+ msg: The Mailbox Quota is required
diff --git a/apps/admin/modules/domain/validate/edit.yml b/apps/admin/modules/domain/validate/edit.yml
new file mode 100644
index 0000000..c8183c2
--- /dev/null
+++ b/apps/admin/modules/domain/validate/edit.yml
@@ -0,0 +1,46 @@
+fillin:
+ enabled: true
+
+validators:
+ myStringValidator:
+ class: sfStringValidator
+ param:
+ min: 2
+ min_error: This field is too short (2 characters minimum)
+ max: 100
+ max_error: This field is too long (100 characters maximum)
+
+fields:
+ domain{name}:
+ required:
+ msg: The Domain Name is required
+ myStringValidator:
+ sfRegexValidator:
+ match:..........Yes
+ match_error: 'The name must be in the form: example.org'
+ pattern: /[^.]+\.[^.]+$/si
+ sfPropelUniqueValidator:
+ class: Domain
+ column: name
+ unique_error: This domain already exists
+ domain{mailbox_prefix}:
+ required:
+ msg: The Mailbox Prefix is required
+ myStringValidator:
+ sfRegexValidator:
+ match: Yes
+ match_error: The prefix must only consist out of alphanumeric characters
+ pattern: /[A-z0-9]/si
+ sfPropelUniqueValidator:
+ class: Domain
+ column: mailbox_prefix
+ unique_error: This prefix already exists
+ domain{max_mailbox_count}:
+ required:
+ msg: The Mailbox Count is required
+ domain{quota}:
+ required:
+ msg: The Domain Quota is required
+ domain{default_mailbox_quota}:
+ required:
+ msg: The Mailbox Quota is required
diff --git a/apps/admin/modules/log/actions/actions.class.php b/apps/admin/modules/log/actions/actions.class.php
new file mode 100644
index 0000000..9eed7c7
--- /dev/null
+++ b/apps/admin/modules/log/actions/actions.class.php
@@ -0,0 +1,46 @@
+<?php
+
+/**
+ * log actions.
+ *
+ * @package mailadmin
+ * @subpackage log
+ * @author Your name here
+ * @version SVN: $Id: actions.class.php 2288 2006-10-02 15:22:13Z fabien $
+ */
+class logActions extends autologActions
+{
+ public function executeList()
+ {
+ // pageination
+ if($this->hasRequestParameter("max_per_page"))
+ $this->getUser()->setResultsPerPage($this->getRequestParameter("max_per_page"));
+
+ return parent::executeList();
+ }
+
+ public function executeClear()
+ {
+ if($this->getRequest()->getMethod() == sfRequest::POST)
+ {
+ if($this->getRequestParameter("commit")=="Yes")
+ {
+ LogEntryPeer::doDeleteAll();
+ return $this->redirect("log", "list");
+ }
+
+ }
+
+ return sfView::SUCCESS;
+ }
+
+ public function executeCreate()
+ {
+ return $this->forward404();
+ }
+
+ public function executeEdit()
+ {
+ return $this->forward404();
+ }
+}
diff --git a/apps/admin/modules/log/config/generator.yml b/apps/admin/modules/log/config/generator.yml
new file mode 100644
index 0000000..553b1c2
--- /dev/null
+++ b/apps/admin/modules/log/config/generator.yml
@@ -0,0 +1,30 @@
+generator:
+ class: sfPropelAdminGenerator
+ param:
+ model_class: LogEntry
+ theme: mailadmin
+
+ fields:
+ created_at: { name: Time }
+ user_id: { name: User }
+ host: { name: Host }
+ priority: { name: Type }
+
+ list:
+ peer_method: doSelectJoinUser
+ title: Logs
+ display: [created_at, _priority, message, _user_id, host]
+ filters: [created_at, priority, message, user_id, host]
+ max_per_page: '$this->getUser()->getResultsPerPage("pager")'
+ sort: [created_at, desc]
+ fields:
+ created_at: { params: align=left center }
+ user_id: { params: align=left }
+ message: { params: align=left }
+ host: { params: align=left }
+ priority: { params: align=left }
+ object_actions:
+ delete: { name: Delete, action: delete, icon: trash.gif, params: confirm=Are you sure? }
+ actions: {}
+
+ edit: {}
diff --git a/apps/admin/modules/log/config/security.yml b/apps/admin/modules/log/config/security.yml
new file mode 100644
index 0000000..60868c9
--- /dev/null
+++ b/apps/admin/modules/log/config/security.yml
@@ -0,0 +1,2 @@
+all:
+ credentials: [superadmin]
diff --git a/apps/admin/modules/log/templates/_priority.php b/apps/admin/modules/log/templates/_priority.php
new file mode 100644
index 0000000..2427ac7
--- /dev/null
+++ b/apps/admin/modules/log/templates/_priority.php
@@ -0,0 +1 @@
+<?php echo image_tag(($log_entry->getPriority()<3?"information.gif":($log_entry->getPriority()<4?"warning.gif":"error.gif")),"alt=[!] border=0") ?><?php echo $log_entry->getLevel() ?>
diff --git a/apps/admin/modules/log/templates/_user_id.php b/apps/admin/modules/log/templates/_user_id.php
new file mode 100644
index 0000000..737a1c7
--- /dev/null
+++ b/apps/admin/modules/log/templates/_user_id.php
@@ -0,0 +1 @@
+<?php echo ($log_entry->getUser() ? $log_entry->getUser(): "Anonymous") ?>
diff --git a/apps/admin/modules/log/templates/clearSuccess.php b/apps/admin/modules/log/templates/clearSuccess.php
new file mode 100644
index 0000000..83508eb
--- /dev/null
+++ b/apps/admin/modules/log/templates/clearSuccess.php
@@ -0,0 +1,12 @@
+ <div id="context">
+ <?php echo use_helper("Asset", "Form", "Object", "Validation") ?>
+ &nbsp; <?php echo form_tag("log/clear")?>
+ <h1>Clear Log</h1>
+
+ <hr size="1" />
+
+ <h2>Do you really want to remove all log entries?</h2>
+
+ <div class="formaction"><?php echo submit_tag("Yes") ?><?php echo button_to("Cancel", "log/list") ?></div>
+ </form>
+ </div>
diff --git a/apps/admin/modules/mailbox/actions/actions.class.php b/apps/admin/modules/mailbox/actions/actions.class.php
new file mode 100644
index 0000000..566c69f
--- /dev/null
+++ b/apps/admin/modules/mailbox/actions/actions.class.php
@@ -0,0 +1,56 @@
+<?php
+
+/**
+ * mailbox actions.
+ *
+ * @package mailadmin
+ * @subpackage mailbox
+ * @author Your name here
+ * @version SVN: $Id: actions.class.php 2288 2006-10-02 15:22:13Z fabien $
+ */
+class mailboxActions extends automailboxActions
+{
+ public function executeList()
+ {
+ // pageination
+ if($this->hasRequestParameter("max_per_page"))
+ $this->getUser()->setResultsPerPage($this->getRequestParameter("max_per_page"));
+
+ return parent::executeList();
+ }
+
+ public function executeCreate()
+ {
+ $this->setTemplate("edit");
+ $result = $this->executeEdit();
+
+ if($this->getRequest()->getMethod() == sfRequest::GET)
+ {
+ if(!$this->hasRequestParameter("id"))
+ {
+ $this->updateMailboxFromRequest();
+ }
+
+ // reset is needed as updateMailboxFromRequest() deactivates
+ $this->mailbox->setActive(true);
+ }
+ return $result;
+ }
+
+ public function handleErrorCreate()
+ {
+ $this->setTemplate("edit");
+ return $this->handleErrorEdit();
+ }
+
+ public function executeCreateAddress()
+ {
+ $mailbox = MailboxPeer::retrieveByPk($this->getRequestParameter('id'));
+ $this->redirect("address/create?address[mailbox_id]=".$this->getRequestParameter('id')."&address[domain_id]=".$mailbox->getDomainId());
+ }
+
+ public function executeViewAddresses()
+ {
+ $this->redirect("address/list?filter=filter&filters[mailbox_id]=".$this->getRequestParameter('id'));
+ }
+}
diff --git a/apps/admin/modules/mailbox/config/generator.yml b/apps/admin/modules/mailbox/config/generator.yml
new file mode 100644
index 0000000..9c119ea
--- /dev/null
+++ b/apps/admin/modules/mailbox/config/generator.yml
@@ -0,0 +1,56 @@
+generator:
+ class: sfPropelAdminGenerator
+ param:
+ model_class: Mailbox
+ theme: mailadmin
+
+ fields:
+ domain: { name: Domain }
+ domain_id: { name: Domain }
+ name { name: Username }
+ max_quota: { name: Quota }
+ max_address_count: { name: Maximum Addresses }
+ last_login: { name: Last Login }
+
+ list:
+ peer_method: doSelectJoinDomain
+ title: List of Mailboxes
+ display: [=name, _domain_id, _max_quota, _max_address_count, active, _last_login]
+ filters: [name, domain_id, max_quota, max_address_count, active, last_login]
+ max_per_page: '$this->getUser()->getResultsPerPage("pager")'
+ sort: [domain_id, asc]
+ fields:
+ name: { params: align=right }
+ domain_id: { params: align=left }
+ max_quota: { params: align=right }
+ max_address_count: { params: align=right }
+ active: { params: align=center width=1% }
+ last_login: { params: align=right }
+ object_actions:
+ viewaddresses: { name: View Addresses, action: viewAddresses, icon: address.gif }
+ createaddress: { name: Create New Address, action: createAddress, icon: address-new.gif }
+ edit: { name: Edit Mailbox, action: edit, icon: edit.gif }
+ delete: { name: Delete Mailbox, action: delete, icon: trash.gif, params: confirm=This will also remove all addresses for this mailbox. Are you sure? }
+ actions: {}
+
+ create:
+ title: Create New Mailbox
+
+ edit:
+ title: Editing Mailbox %%name%%
+ display:
+ 'General Settings': [name, _password, _new_password, domain_id, active]
+ 'Limits': [max_quota, max_address_count]
+ fields:
+ name: { name: Username, params: size=50 }
+ password: { name: Password, params: size=50, only_for: create }
+ new_password: { name: New Password, help: 'Enter a password to change it, leave the field blank to keep the current one', params: size=50, only_for: edit }
+ domain_id: { name: For Domain }
+ active: { name: Enable Login, help: 'Inactive mailboxes receive mail, however users are unable to login' }
+ max_quota: { name: Maximum Storage Space in kb, help: '0 = No Limit', params: size=50 }
+ max_address_count: { name: Maximum Number of Addresses, help: '0 = No Limit', params: size=50 }
+ actions:
+ _save_and_list: { name: Save }
+ _save_and_add: { name: 'Save, then create new one' }
+ _list: { name: Cancel }
+
diff --git a/apps/admin/modules/mailbox/templates/_domain_id.php b/apps/admin/modules/mailbox/templates/_domain_id.php
new file mode 100644
index 0000000..4e93b4b
--- /dev/null
+++ b/apps/admin/modules/mailbox/templates/_domain_id.php
@@ -0,0 +1 @@
+<?php echo $mailbox->getDomain()->getName() ?>
diff --git a/apps/admin/modules/mailbox/templates/_last_login.php b/apps/admin/modules/mailbox/templates/_last_login.php
new file mode 100644
index 0000000..6e0583a
--- /dev/null
+++ b/apps/admin/modules/mailbox/templates/_last_login.php
@@ -0,0 +1 @@
+<?php echo ($mailbox->getLastLogin()==""? "Never":$mailbox->getLastLogin()) ?>
diff --git a/apps/admin/modules/mailbox/templates/_max_address_count.php b/apps/admin/modules/mailbox/templates/_max_address_count.php
new file mode 100644
index 0000000..66cc68f
--- /dev/null
+++ b/apps/admin/modules/mailbox/templates/_max_address_count.php
@@ -0,0 +1 @@
+<?php use_helper("Files") ?><?php echo $mailbox->getAddressCount() ?> / <?php echo ($mailbox->getMaxAddressCount()==0 ? "Unlimited": $mailbox->getMaxAddressCount()) ?>
diff --git a/apps/admin/modules/mailbox/templates/_max_quota.php b/apps/admin/modules/mailbox/templates/_max_quota.php
new file mode 100644
index 0000000..3bf8c47
--- /dev/null
+++ b/apps/admin/modules/mailbox/templates/_max_quota.php
@@ -0,0 +1 @@
+<?php use_helper("Files") ?><?php $q = $mailbox->getQuota(); $qmax = ($q["max"] != null ? $q["max"]: $mailbox->getMaxQuota()); ?><?php if($q["resource"] != null): ?><?php echo format_bytes($q["current"]*1000) ?> / <?php endif; ?><?php echo ($qmax==0 ? "Unlimited" : format_bytes($qmax*1000)) ?>
diff --git a/apps/admin/modules/mailbox/templates/_new_password.php b/apps/admin/modules/mailbox/templates/_new_password.php
new file mode 100644
index 0000000..1c28ee6
--- /dev/null
+++ b/apps/admin/modules/mailbox/templates/_new_password.php
@@ -0,0 +1 @@
+<?php echo input_password_tag('mailbox[new_password]', '', 'size=50') ?>
diff --git a/apps/admin/modules/mailbox/templates/_password.php b/apps/admin/modules/mailbox/templates/_password.php
new file mode 100644
index 0000000..412f824
--- /dev/null
+++ b/apps/admin/modules/mailbox/templates/_password.php
@@ -0,0 +1 @@
+<?php echo input_password_tag('mailbox[password]', '', 'size=50') ?>
diff --git a/apps/admin/modules/mailbox/validate/create.yml b/apps/admin/modules/mailbox/validate/create.yml
new file mode 100644
index 0000000..3668321
--- /dev/null
+++ b/apps/admin/modules/mailbox/validate/create.yml
@@ -0,0 +1,50 @@
+fillin:
+ enabled: true
+ param:
+ exclude_types: [password]
+
+validators:
+ myStringValidator:
+ class: sfStringValidator
+ param:
+ min: 2
+ min_error: This field is too short (2 characters minimum)
+ max: 100
+ max_error: This field is too long (100 characters maximum)
+ myPasswordValidator:
+ class: sfStringValidator
+ param:
+ min: 5
+ min_error: The password is too short (5 characters minimum)
+ max: 100
+ max_error: The password is too long (100 characters maximum)
+
+fields:
+ mailbox{name}:
+ required:
+ msg: The Username is required
+ myStringValidator:
+ sfRegexValidator:
+ match:..........Yes
+ match_error: 'The characters ".,;/" are not allowed'
+ pattern: '/[^.,;\/]$/i'
+ myDenyStringValidator:
+ values: [<?php echo implode(', ',sfConfig::get('app_mailbox_deny_names')) ?>]
+ values_error: This Username is not allowed
+ sfPropelUniqueValidator:
+ class: Mailbox
+ column: name
+ unique_error: This Username already exists
+ mailbox{password}:
+ required:
+ msg: The Password is required
+ myPasswordValidator:
+ mailbox{domain_id}:
+ required:
+ msg: A Domain has to be specified
+ mailbox{max_quota}:
+ required:
+ msg: The Mailbox Quota is required
+ mailbox{max_address_count}:
+ required:
+ msg: The Maximum Address Count is required
diff --git a/apps/admin/modules/mailbox/validate/edit.yml b/apps/admin/modules/mailbox/validate/edit.yml
new file mode 100644
index 0000000..1629a9d
--- /dev/null
+++ b/apps/admin/modules/mailbox/validate/edit.yml
@@ -0,0 +1,48 @@
+fillin:
+ enabled: true
+ param:
+ exclude_types: [password]
+
+validators:
+ myStringValidator:
+ class: sfStringValidator
+ param:
+ min: 2
+ min_error: This field is too short (2 characters minimum)
+ max: 100
+ max_error: This field is too long (100 characters maximum)
+ myPasswordValidator:
+ class: sfStringValidator
+ param:
+ min: 5
+ min_error: The password is too short (5 characters minimum)
+ max: 100
+ max_error: The password is too long (100 characters maximum)
+
+fields:
+ mailbox{name}:
+ required:
+ msg: The Username is required
+ myStringValidator:
+ sfRegexValidator:
+ match:..........Yes
+ match_error: 'The characters ".,;/" are not allowed'
+ pattern: '/[^.,;\/]$/i'
+ myDenyStringValidator:
+ values: [<?php echo implode(', ',sfConfig::get('app_mailbox_deny_names')) ?>]
+ values_error: This Username is not allowed
+ sfPropelUniqueValidator:
+ class: Mailbox
+ column: name
+ unique_error: This Username already exists
+ mailbox{new_password}:
+ myPasswordValidator:
+ mailbox{domain_id}:
+ required:
+ msg: A Domain has to be specified
+ mailbox{max_quota}:
+ required:
+ msg: The Mailbox Quota is required
+ mailbox{max_address_count}:
+ required:
+ msg: The Maximum Address Count is required
diff --git a/apps/admin/modules/server/actions/actions.class.php b/apps/admin/modules/server/actions/actions.class.php
new file mode 100644
index 0000000..a83d9b9
--- /dev/null
+++ b/apps/admin/modules/server/actions/actions.class.php
@@ -0,0 +1,29 @@
+<?php
+
+/**
+ * server actions.
+ *
+ * @package mailadmin
+ * @subpackage server
+ * @author Your name here
+ * @version SVN: $Id: actions.class.php 2692 2006-11-15 21:03:55Z fabien $
+ */
+class serverActions extends sfActions
+{
+ /**
+ * Executes index action
+ *
+ */
+ public function executeIndex()
+ {
+ $this->forward('server', 'imap');
+ }
+
+ public function executeImap()
+ {
+ $serverinfo = new IMAPServerInformation();
+ $this->serverinfo = $serverinfo;
+
+ return sfView::SUCCESS;
+ }
+}
diff --git a/apps/admin/modules/server/templates/imapSuccess.php b/apps/admin/modules/server/templates/imapSuccess.php
new file mode 100644
index 0000000..57569ad
--- /dev/null
+++ b/apps/admin/modules/server/templates/imapSuccess.php
@@ -0,0 +1,57 @@
+ <div id="context">
+ <?php echo use_helper("Asset", "Form") ?>
+ <h1>IMAP Server Information</h1>
+
+ <hr size="1" />
+
+ <table>
+ <tr>
+ <th colspan="2" align="left">Connection:</th>
+ </tr>
+ <tr>
+ <td>Host:</td>
+ <td><?php echo $serverinfo->getHost() ?></td>
+ </tr>
+ <tr>
+ <td>Port:</td>
+ <td><?php echo $serverinfo->getPort() ?></td>
+ </tr>
+ <tr>
+ <th colspan="2" align="left">General:</th>
+ </tr>
+ <tr>
+ <td>Greeting:</td>
+ <td><?php echo $serverinfo->getGreeting() ?></td>
+ </tr>
+ <?php if(($servername = $serverinfo->getServerName()) !== false): ?>
+ <tr>
+ <td>Server:</td>
+ <td><?php echo $serverinfo->getServerName() ?></td>
+ </tr>
+ <tr>
+ <td>Version:</td>
+ <td><?php echo $serverinfo->getServerVersion() ?></td>
+ </tr>
+ <?php endif; ?>
+ <tr>
+ <td>Hierarchy Delimiter:</td>
+ <td><?php echo $serverinfo->getHierarchyDelimiter() ?></td>
+ </tr>
+ <tr>
+ <td valign="top">Capabilities:</td>
+ <td><?php echo implode("<br />", $serverinfo->getCapabilties()) ?></td>
+ </tr>
+ <?php if($serverinfo->hasCapability('ACL')): ?>
+ <tr>
+ <th colspan="2" align="left">Extension: Access Control List (ACL)</th>
+ </tr>
+ <tr>
+ <td>Available ACL:</td>
+ <td><?php echo $serverinfo->getAvailableACL() ?></td>
+ </tr>
+ <?php endif; ?>
+ </table>
+
+ <hr size="1" />
+
+ </div>
diff --git a/apps/admin/modules/user/actions/actions.class.php b/apps/admin/modules/user/actions/actions.class.php
new file mode 100644
index 0000000..1af2445
--- /dev/null
+++ b/apps/admin/modules/user/actions/actions.class.php
@@ -0,0 +1,115 @@
+<?php
+
+/**
+ * user actions.
+ *
+ * @package mailadmin
+ * @subpackage user
+ * @author Your name here
+ * @version SVN: $Id: actions.class.php 2692 2006-11-15 21:03:55Z fabien $
+ */
+class userActions extends autouserActions
+{
+ public function executeList()
+ {
+ // pageination
+ if($this->hasRequestParameter("max_per_page"))
+ $this->getUser()->setResultsPerPage($this->getRequestParameter("max_per_page"));
+
+ return parent::executeList();
+ }
+
+ public function executeCreate()
+ {
+ // populate preset values
+ $user = $this->getRequestParameter('user');
+ $user["parent_user_id"] = $this->getUser()->getId();
+ $this->getRequest()->setParameter('user', $user);
+
+ $this->setTemplate("edit");
+ return $this->executeEdit();
+ }
+
+ public function handleErrorCreate()
+ {
+ // populate preset values
+ $user = $this->getRequestParameter('user');
+ $user["parent_user_id"] = $this->getUser()->getId();
+ $this->getRequest()->setParameter('user', $user);
+
+ $this->setTemplate("edit");
+ return $this->handleErrorEdit();
+ }
+
+ public function executeLogin()
+ {
+ if($this->getRequest()->getMethod() != sfRequest::POST)
+ {
+ $this->getRequest()->setAttribute('referer', $this->getRequest()->getReferer());
+
+ return sfView::SUCCESS;
+ }
+ else
+ {
+ return $this->redirect($this->getRequestParameter('referer', '@homepage'));
+ }
+ }
+
+ public function handleErrorLogin()
+ {
+ return sfView::SUCCESS;
+ }
+
+ public function executeSettings()
+ {
+ $user = UserPeer::retrieveByPK($this->getUser()->getId());
+ $this->user = $user;
+
+ if($this->getRequest()->getMethod() != sfRequest::POST)
+ {
+ $this->getRequest()->setAttribute('referer', $this->getRequest()->getReferer());
+ }
+ else
+ {
+ if($this->getRequest()->getParameter("commit") == "Cancel")
+ return $this->redirect($this->getRequestParameter('referer', '@homepage'));
+
+ // update record
+ $user->setNickname($this->getRequestParameter("nickname"));
+ $user->setFirstName($this->getRequestParameter("first_name"));
+ $user->setLastName($this->getRequestParameter("last_name"));
+ $user->setEmail($this->getRequestParameter("email"));
+
+ // set new password
+ $password = $this->getRequestParameter("password2");
+ if($password != "")
+ $user->setPassword($password);
+
+ $user->save();
+
+ // update session
+ $this->getUser()->updateUserAttributes($user);
+
+ return $this->redirect($this->getRequestParameter('referer', '@homepage'));
+ }
+
+ return sfView::SUCCESS;
+ }
+
+ public function handleErrorSettings()
+ {
+ $user = UserPeer::retrieveByPK($this->getUser()->getId());
+ $this->user = $user;
+
+ if($this->getRequest()->getParameter("commit") == "Cancel")
+ return $this->redirect($this->getRequestParameter('referer', '@homepage'));
+
+ return sfView::SUCCESS;
+ }
+
+ public function executeLogout()
+ {
+ $this->getUser()->signOut($user);
+ $this->redirect("@homepage");
+ }
+}
diff --git a/apps/admin/modules/user/config/generator.yml b/apps/admin/modules/user/config/generator.yml
new file mode 100644
index 0000000..4764f5b
--- /dev/null
+++ b/apps/admin/modules/user/config/generator.yml
@@ -0,0 +1,55 @@
+generator:
+ class: sfPropelAdminGenerator
+ param:
+ model_class: User
+ theme: mailadmin
+
+ fields:
+ nickname: { name: Nickname }
+ full_name: { name: Name }
+ email: { name: E-Mail }
+ last_login: { name: Last Login }
+
+ list:
+ peer_method: doSelectJoinRole
+ title: List of Administrators
+ display: [=nickname, _role_id, _domain_permissions, full_name, email, _last_login]
+ filters: [nickname, role_id, email, parent_user_id, last_login, created_at]
+ max_per_page: '$this->getUser()->getResultsPerPage("pager")'
+ sort: [nickname, asc]
+ fields:
+ domain_permissions: { name: Associated Domains, params: align=left }
+ nickname: { params: align=left }
+ role_id: { params: align=left }
+ full_name: { params: align=left }
+ email: { params: align=left }
+ last_login: { params: align=right }
+ object_actions:
+ edit: { name: Edit, action: edit, icon: edit.gif }
+ delete: { name: Delete, action: delete, icon: trash.gif, params: confirm=Are you sure? }
+ actions: {}
+
+ create:
+ title: Create New Administrator
+
+ edit:
+ title: 'Editing Administrator %%nickname%%'
+ display:
+ 'General Settings': [nickname, first_name, last_name, email, parent_user_id]
+ 'Password Settings': [_password, _password2]
+ 'Permissions': [role_id, domain_permission]
+ fields:
+ domain_permission: { name: Assign Domains, type: admin_double_list, params: through_class=DomainPermission, help: Assign which domains the user is allowed to see (Ignored for superadmins) }
+ parent_user_id: { name: Parent User, only_for: edit }
+ nickname: { name: Nickname, params: size=50 }
+ first_name: { name: First Name, params: size=50 }
+ last_name: { name: Last Name, params: size=50 }
+ email: { name: E-Mail, params: size=50, help: Used for password requests or notifications }
+ role_id: { name: Role }
+ password: { name: Desired Password }
+ password2: { name: Re-Type New Password, only_for: edit, help: Leave blank if you do not want to change the password }
+ actions:
+ _save_and_list: { name: Save }
+ _save_and_add: { name: 'Save, then create new one' }
+ _list: { name: Cancel }
+
diff --git a/apps/admin/modules/user/config/security.yml b/apps/admin/modules/user/config/security.yml
new file mode 100644
index 0000000..dbe3ebb
--- /dev/null
+++ b/apps/admin/modules/user/config/security.yml
@@ -0,0 +1,13 @@
+settings:
+ is_secure: on
+ credentials: []
+
+login:
+ is_secure: off
+
+logout:
+ is_secure: off
+
+all:
+ is_secure: on
+ credentials: [superadmin]
diff --git a/apps/admin/modules/user/templates/_domain_permissions.php b/apps/admin/modules/user/templates/_domain_permissions.php
new file mode 100644
index 0000000..0d3e19d
--- /dev/null
+++ b/apps/admin/modules/user/templates/_domain_permissions.php
@@ -0,0 +1,27 @@
+<?php use_helper('I18N','Javascript'); ?>
+<?php if($user->getRoleId() == Role::SUPERADMIN): ?>
+<?php echo "All Domains" ?>
+<?php else: ?>
+<?php $list = $user->getDomainPermissionsJoinDomain() ?>
+<?php if(count($list) == 0): ?>
+<?php echo "None" ?>
+<?php else: ?>
+<div class="slidelist">
+<?php if(count($list) > sfConfig::get('app_user_domain_perm_collapse_count')): ?>
+<?php echo link_to_function(__("Multiple (%1% entries)", array('%1%' => count($list))), visual_effect(
+'toggle_slide', 'domain_permissionlist_'.$user->getId())) ?>
+<div id="domain_permissionlist_<?php echo $user->getId() ?>" style="display:none">
+<?php endif; ?>
+
+<ul>
+<?php foreach($list as $permission): ?>
+<li><?php echo ($permission->getDomain()) ?></li>
+<?php endforeach; ?>
+</ul>
+
+<?php if(count($list) > 1): ?>
+</div>
+<?php endif; ?>
+</div>
+<?php endif; ?>
+<?php endif; ?>
diff --git a/apps/admin/modules/user/templates/_last_login.php b/apps/admin/modules/user/templates/_last_login.php
new file mode 100644
index 0000000..f15439a
--- /dev/null
+++ b/apps/admin/modules/user/templates/_last_login.php
@@ -0,0 +1 @@
+<?php echo ($user->getLastLogin() ? $user->getLastLogin(): "Never") ?>
diff --git a/apps/admin/modules/user/templates/_password.php b/apps/admin/modules/user/templates/_password.php
new file mode 100644
index 0000000..e32e4ab
--- /dev/null
+++ b/apps/admin/modules/user/templates/_password.php
@@ -0,0 +1,3 @@
+<?php $value = input_password_tag("user[password]", '', array (
+ 'size' => 50,
+)); echo $value ? $value : '&nbsp;' ?>
diff --git a/apps/admin/modules/user/templates/_password1.php b/apps/admin/modules/user/templates/_password1.php
new file mode 100644
index 0000000..e32e4ab
--- /dev/null
+++ b/apps/admin/modules/user/templates/_password1.php
@@ -0,0 +1,3 @@
+<?php $value = input_password_tag("user[password]", '', array (
+ 'size' => 50,
+)); echo $value ? $value : '&nbsp;' ?>
diff --git a/apps/admin/modules/user/templates/_password2.php b/apps/admin/modules/user/templates/_password2.php
new file mode 100644
index 0000000..eab912d
--- /dev/null
+++ b/apps/admin/modules/user/templates/_password2.php
@@ -0,0 +1,3 @@
+<?php $value = input_password_tag("user[password2]", '', array (
+ 'size' => 50,
+)); echo $value ? $value : '&nbsp;' ?>
diff --git a/apps/admin/modules/user/templates/_role_id.php b/apps/admin/modules/user/templates/_role_id.php
new file mode 100644
index 0000000..bfaf818
--- /dev/null
+++ b/apps/admin/modules/user/templates/_role_id.php
@@ -0,0 +1 @@
+<?php echo $user->getRole() ?>
diff --git a/apps/admin/modules/user/templates/loginSuccess.php b/apps/admin/modules/user/templates/loginSuccess.php
new file mode 100644
index 0000000..f41a809
--- /dev/null
+++ b/apps/admin/modules/user/templates/loginSuccess.php
@@ -0,0 +1,12 @@
+ <div id="context">
+ <?php echo use_helper("I18N","Asset", "Form", "Validation") ?>
+ &nbsp; <?php echo form_tag("user/login")?>
+ <h1><?php echo __("Please authenticate yourself") ?>:</h1>
+ <hr size="1" />
+ <label for="nickname">Username: </label><?php echo input_tag("nickname", $sf_params->get("nickname"), "size=50") ?><?php echo form_error('nickname') ?><br />
+ <label for="password">Password: </label><?php echo input_password_tag("password", "", "size=50") ?><?php echo form_error('password') ?><br />
+ <?php echo input_hidden_tag("referer", $sf_request->getAttribute('referer')) ?>
+ <div class="formaction"><?php echo submit_tag("Login") ?></div>
+
+ </form>
+ </div>
diff --git a/apps/admin/modules/user/templates/settingsSuccess.php b/apps/admin/modules/user/templates/settingsSuccess.php
new file mode 100644
index 0000000..f1c49d7
--- /dev/null
+++ b/apps/admin/modules/user/templates/settingsSuccess.php
@@ -0,0 +1,22 @@
+ <div id="context">
+ <?php echo use_helper("Asset", "Form", "Object", "Validation") ?>
+ <?php echo form_tag("user/settings")?>
+ <h1>Update Settings:</h1>
+
+ <hr size="1" />
+
+ <h2>General Settings:</h2>
+
+ <label for="nickname">Username: </label><?php echo object_input_tag($user, "getNickname","size=50") ?><br /><?php echo form_error('nickname') ?>
+ <label for="first_name">First Name: </label><?php echo object_input_tag($user, "getFirstName","size=50") ?><br /><?php echo form_error('first_name') ?>
+ <label for="last_name">Last Name: </label><?php echo object_input_tag($user, "getLastName", "size=50") ?><br /><?php echo form_error('last_name') ?>
+ <label for="email">E-Mail: </label><?php echo object_input_tag($user, "getEmail", "size=50") ?><div class="sf_admin_edit_help">Used to retrieve your password or to send critical notifications</div><br /><?php echo form_error('email') ?><br />
+
+ <h2>Change Password:</h2>
+ <label for="password1">New Password: </label><?php echo input_password_tag("password1", "", "size=50") ?><br />
+ <label for="password2">Re-Type New Password: </label><?php echo input_password_tag("password2", "", "size=50") ?><br /><?php echo form_error('password2') ?>
+ <?php echo input_hidden_tag("referer", $sf_request->getAttribute('referer')) ?>
+
+ <div class="formaction"><?php echo submit_tag("Update") ?><?php echo submit_tag("Cancel") ?></div>
+ </form>
+ </div>
diff --git a/apps/admin/modules/user/validate/create.yml b/apps/admin/modules/user/validate/create.yml
new file mode 100644
index 0000000..7686c7b
--- /dev/null
+++ b/apps/admin/modules/user/validate/create.yml
@@ -0,0 +1,37 @@
+fillin:
+ enabled: true
+ param:
+ exclude_types: [password]
+
+validators:
+ myStringValidator:
+ class: sfStringValidator
+ param:
+ min: 2
+ min_error: This field is too short (2 characters minimum)
+ max: 100
+ max_error: This field is too long (100 characters maximum)
+
+fields:
+ user{nickname}:
+ required:
+ msg: The Username is required
+ sfStringValidator:
+ min: 5
+ min_error: Username must be 5 or more characters
+ sfPropelUniqueValidator:
+ class: User
+ column: nickname
+ unique_error: This Username does already exist
+ user{email}:
+ myStringValidator:
+ sfEmailValidator:
+ email_error: This E-Mail Address is invalid
+ user{password}:
+ required:
+ msg: You must define a password
+ myStringValidator:
+ user{role_id}:
+ required:
+ msg: You must set a role for this user
+
diff --git a/apps/admin/modules/user/validate/edit.yml b/apps/admin/modules/user/validate/edit.yml
new file mode 100644
index 0000000..6480b37
--- /dev/null
+++ b/apps/admin/modules/user/validate/edit.yml
@@ -0,0 +1,40 @@
+fillin:
+ enabled: true
+ param:
+ exclude_types: [password]
+
+validators:
+ myStringValidator:
+ class: sfStringValidator
+ param:
+ min: 2
+ min_error: This field is too short (2 characters minimum)
+ max: 100
+ max_error: This field is too long (100 characters maximum)
+
+fields:
+ user{nickname}:
+ required:
+ msg: The Username is required
+ sfStringValidator:
+ min: 5
+ min_error: Username must be 5 or more characters
+ sfPropelUniqueValidator:
+ class: User
+ column: nickname
+ unique_error: This Username does already exist
+ user{email}:
+ myStringValidator:
+ sfEmailValidator:
+ email_error: This E-Mail Address is invalid
+ user{role_id}:
+ required:
+ msg: You must set a role for this user
+ user{password}:
+ group: password_group
+ user{password2}:
+ group: password_group
+ sfCompareValidator:
+ check: "user[password]"
+ compare_error: The two passwords do not match
+
diff --git a/apps/admin/modules/user/validate/login.yml b/apps/admin/modules/user/validate/login.yml
new file mode 100644
index 0000000..d6ea563
--- /dev/null
+++ b/apps/admin/modules/user/validate/login.yml
@@ -0,0 +1,24 @@
+methods:
+ post: [nickname, password]
+
+names:
+ nickname:
+ required: true
+ required_msg: Your Username is required
+ validators: [nicknameValidator, userValidator]
+
+ password:
+ required: true
+ required_msg: Your password is required
+
+nicknameValidator:
+ class: sfStringValidator
+ param:
+ min: 5
+ min_error: Username must be 5 or more characters
+
+userValidator:
+ class: myLoginValidator
+ param:
+ password: password
+ login_error: This Username does not exist or you entered a wrong password
diff --git a/apps/admin/modules/user/validate/settings.yml b/apps/admin/modules/user/validate/settings.yml
new file mode 100644
index 0000000..0706d53
--- /dev/null
+++ b/apps/admin/modules/user/validate/settings.yml
@@ -0,0 +1,43 @@
+fillin:
+ enabled: true
+ param:
+ exclude_types: [password]
+
+validators:
+ myStringValidator:
+ class: sfStringValidator
+ param:
+ min: 2
+ min_error: This field is too short (2 characters minimum)
+ max: 100
+ max_error: This field is too long (100 characters maximum)
+
+fields:
+ nickname:
+ required:
+ msg: Your Username is required
+ sfStringValidator:
+ min: 5
+ min_error: Username must be 5 or more characters
+ myChangeNicknameValidator:
+ change_error: This Username does already exist
+
+ first_name:
+ myStringValidator:
+ last_name:
+ myStringValidator:
+
+ email:
+ required:
+ msg: Your must provide an E-Mail Address
+ myStringValidator:
+ sfEmailValidator:
+ email_error: This E-Mail Address is invalid
+
+ password1:
+ group: password_group
+ password2:
+ group: password_group
+ sfCompareValidator:
+ check: password1
+ compare_error: The two passwords do not match
diff --git a/apps/admin/templates/_branding.php b/apps/admin/templates/_branding.php
new file mode 100644
index 0000000..c035a54
--- /dev/null
+++ b/apps/admin/templates/_branding.php
@@ -0,0 +1,4 @@
+ <?php echo use_helper("Asset") ?>
+ <div class="branding">
+ <div class="logo"><?php echo image_tag("logo","alt=Title")?></div>
+ </div>
diff --git a/apps/admin/templates/_navigation.php b/apps/admin/templates/_navigation.php
new file mode 100644
index 0000000..b991247
--- /dev/null
+++ b/apps/admin/templates/_navigation.php
@@ -0,0 +1,53 @@
+ <?php use_helper("Asset","Javascript") ?>
+ <div class="navigation">
+ <ul><? if($sf_user->hasCredential(array('superadmin','domainmaster', 'mailboxmaster'), false)): ?><li<?php echo ($module=="domain"?" class=\"active\"":"") ?>><?php echo link_to("Domains","domain/list") ?></li><li<?php echo ($module=="mailbox"?" class=\"active\"":"") ?>><?php echo link_to("Mailboxes","mailbox/list") ?></li><?php endif; ?><li<?php echo ($module=="address"?" class=\"active\"":"") ?>><?php echo link_to("Addresses","address/list") ?></li><? if($sf_user->hasCredential('superadmin')): ?><li<?php echo ($module=="user"?" class=\"active\"":"") ?>><?php echo link_to("Administrators","user/list") ?></li><li<?php echo ($module=="log"?" class=\"active\"":"") ?>><?php echo link_to("Logs","log/list") ?></li><li<?php echo ($module=="server"?" class=\"active\"":"") ?>><?php echo link_to("Server","server/index") ?></li><?php endif; ?></ul>
+ </div>
+ <?php if($module=="domain"): ?>
+ <div class="subnavigation">
+ <ul>
+ <li <?php echo ($action=="list"?"class=\"active\"":"") ?>><?php echo link_to(image_tag("list.gif","alt=[...] border=0") . " Browse Domains", $module."/list")?></li>
+ <? if($sf_user->hasCredential(array('superadmin','domainmaster'), false)): ?><li <?php echo ($action=="create"?"class=\"active\"":"") ?>><?php echo link_to(image_tag("add.gif","alt=[+] border=0") . " Add New Domain", $module."/create")?></li><?php endif; ?>
+ </ul>
+ </div>
+ <?php endif; ?>
+ <?php if($module=="mailbox"): ?>
+ <div class="subnavigation">
+ <ul>
+ <li <?php echo ($action=="list"?"class=\"active\"":"") ?>><?php echo link_to(image_tag("list.gif","alt=[...] border=0") . " Browse Mailboxes", $module."/list")?></li>
+ <li <?php echo ($action=="create"?"class=\"active\"":"") ?>><?php echo link_to(image_tag("add.gif","alt=[+] border=0") . " Add New Mailbox", $module."/create")?></li>
+ </ul>
+ </div>
+ <?php endif; ?>
+ <?php if($module=="address"): ?>
+ <div class="subnavigation">
+ <ul>
+ <li <?php echo ($action=="list"?"class=\"active\"":"") ?>><?php echo link_to(image_tag("list.gif","alt=[...] border=0") . " Browse Addresses", $module."/list")?></li>
+ <li <?php echo ($action=="create"?"class=\"active\"":"") ?>><?php echo link_to(image_tag("add.gif","alt=[+] border=0") . " Add New Address", $module."/create")?></li>
+ </ul>
+ </div>
+ <?php endif; ?>
+ <? if($sf_user->hasCredential('superadmin')): ?>
+ <?php if($module=="user"): ?>
+ <div class="subnavigation">
+ <ul>
+ <li <?php echo ($action=="list"?"class=\"active\"":"") ?>><?php echo link_to(image_tag("list.gif","alt=[...] border=0") . " Browse Administrators", $module."/list")?></li>
+ <li <?php echo ($action=="create"?"class=\"active\"":"") ?>><?php echo link_to(image_tag("add.gif","alt=[+] border=0") . " Add New Administrator", $module."/create")?></li>
+ </ul>
+ </div>
+ <?php endif; ?>
+ <?php if($module=="log"): ?>
+ <div class="subnavigation">
+ <ul>
+ <li <?php echo ($action=="list"?"class=\"active\"":"") ?>><?php echo link_to(image_tag("list.gif","alt=[...] border=0") . " Browse Logs", $module."/list")?></li>
+ <li <?php echo ($action=="clear"?"class=\"active\"":"") ?>><?php echo link_to(image_tag("shred.gif","alt=[-] border=0") . " Clear Logs", $module."/clear")?></li>
+ </ul>
+ </div>
+ <?php endif; ?>
+ <?php if($module=="server"): ?>
+ <div class="subnavigation">
+ <ul>
+ <li <?php echo ($action=="imap"?"class=\"active\"":"") ?>><?php echo link_to(image_tag("network-server.gif","alt=[...] border=0") . " IMAP Summary", $module."/imap")?></li>
+ </ul>
+ </div>
+ <?php endif; ?>
+ <?php endif; ?>
diff --git a/apps/admin/templates/_notes.php b/apps/admin/templates/_notes.php
new file mode 100644
index 0000000..e994a50
--- /dev/null
+++ b/apps/admin/templates/_notes.php
@@ -0,0 +1,9 @@
+ <?php echo use_helper("I18N","Asset","Date") ?>
+ <div class="notes">
+ <ul>
+ <li><?php echo link_to("Mailadmin ".sfConfig::get("app_info_version"), "http://wiki.sukimashita.com/Mailadmin") ?></li>
+ <li><?php echo image_tag("ok.gif","alt=[x] border=0")?> <?php echo link_to("XHTML 1.0", "http://validator.w3.org/check/referer") ?></li>
+ <li><?php echo image_tag("ok.gif","alt=[x] border=0")?> <?php echo link_to("CSS", "http://jigsaw.w3.org/css-validator/check/referer") ?></li>
+ </ul>
+ <span class="legal">&copy; <?php echo format_date(time(), "yyyy") ?> <?php echo link_to("Mirell Development", "http://mirell.de") ?> - <?php echo __('This web application is licensed under the terms of the GNU General Public License') ?></span>
+ </div>
diff --git a/apps/admin/templates/layout.php b/apps/admin/templates/layout.php
new file mode 100644
index 0000000..d10d047
--- /dev/null
+++ b/apps/admin/templates/layout.php
@@ -0,0 +1,35 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+<head>
+ <?php include_http_metas() ?>
+ <?php include_metas() ?>
+ <?php include_title() ?>
+ <link rel="icon" href="/images/favicon.ico" /><link rel="SHORTCUT ICON" href="/images/favicon.ico" />
+</head>
+<body>
+<div class="base">
+ <?php include_partial('global/branding') ?>
+ <?php echo use_helper("Asset","Date") ?>
+ <div class="session">
+ <?php if($sf_user->isAuthenticated()): ?>
+ <ul>
+ <li><?php echo image_tag("information.gif","alt=[?]")?><b>Logged in as:</b> <span class="adminname"><?php echo $sf_user->getNickname() ?></span> (<span class="adminrole"><?php echo $sf_user->getRoleName() ?></span>) | <?php echo link_to("Settings","user/settings") ?> | <?php echo link_to("Logout","user/logout") ?></li>
+ <li><b>Last Login:</b> <?php if($sf_user->getLastLogin()!=""): ?>
+ <?php echo format_date($sf_user->getLastLogin(),array('P','t')) ?>
+ <?php else: ?>
+ <?php echo "Never" ?>
+ <?php endif; ?></li>
+ <li id="indicator"><?php echo image_tag("load.gif", "alt=[...] border=0") ?> loading</li>
+ </ul>
+ <?php else: ?>
+ <ul><li><?php echo image_tag("warning.gif","alt=[!]")?><b>You are not authenticated.</b> | <?php echo link_to("Login","user/login") ?></li></ul>
+ <?php endif; ?>
+ </div>
+ <?php if($sf_user->isAuthenticated()): ?>
+ <?php include_partial("global/navigation", array("module" => $sf_context->getModuleName(), "action" => $sf_context->getActionName())) ?>
+ <?php endif; ?>
+ <?php echo $sf_data->getRaw('sf_content') ?>
+ <?php include_partial('global/notes') ?>
+</div>
+</body>
+</html>
diff --git a/config/config.php b/config/config.php
new file mode 100644
index 0000000..381af2c
--- /dev/null
+++ b/config/config.php
@@ -0,0 +1,5 @@
+<?php
+
+// symfony directories
+$sf_symfony_lib_dir = '/usr/share/php5/PEAR/symfony';
+$sf_symfony_data_dir = '/usr/share/php5/PEAR/data/symfony';
diff --git a/config/databases.yml b/config/databases.yml
new file mode 100644
index 0000000..023d652
--- /dev/null
+++ b/config/databases.yml
@@ -0,0 +1,5 @@
+all:
+ propel:
+ class: sfPropelDatabase
+ param:
+ dsn: mysql://user:password@localhost/mailadmin
diff --git a/config/generated-schema-transformed.xml b/config/generated-schema-transformed.xml
new file mode 100644
index 0000000..28b9c86
--- /dev/null
+++ b/config/generated-schema-transformed.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<database defaultPhpNamingMethod="underscore" heavyIndexing="false" name="propel" defaultIdMethod="native" noXsd="true" package="lib.model"><table skipSql="false" abstract="false" name="role" phpName="Role"><column autoIncrement="false" lazyLoad="false" name="id" type="integer" required="true" primaryKey="true" autoincrement="true"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="name" type="varchar" size="255"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="credentials" type="varchar" size="255"/></table><table skipSql="false" abstract="false" name="user" phpName="User"><column autoIncrement="false" lazyLoad="false" name="id" type="integer" required="true" primaryKey="true" autoincrement="true"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="parent_user_id" type="integer" default="-1"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="nickname" type="varchar" size="50"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="first_name" type="varchar" size="100"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="last_name" type="varchar" size="100"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="email" type="varchar" size="255"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="sha1_password" type="varchar" size="40"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="salt" type="varchar" size="32"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="role_id" type="integer"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="last_login" type="timestamp"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="created_at" type="timestamp"/><foreign-key onUpdate="none" foreignTable="user" onDelete="setnull"><reference local="parent_user_id" foreign="id"/></foreign-key><foreign-key onDelete="none" onUpdate="none" foreignTable="role"><reference local="role_id" foreign="id"/></foreign-key></table><table skipSql="false" abstract="false" name="domain_permission" phpName="DomainPermission"><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="user_id" type="integer"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="domain_id" type="integer"/><column autoIncrement="false" lazyLoad="false" name="id" type="integer" required="true" primaryKey="true" autoincrement="true"/><foreign-key onUpdate="none" foreignTable="user" onDelete="cascade"><reference local="user_id" foreign="id"/></foreign-key><foreign-key onUpdate="none" foreignTable="domain" onDelete="cascade"><reference local="domain_id" foreign="id"/></foreign-key></table><table skipSql="false" abstract="false" name="domain" phpName="Domain"><column autoIncrement="false" lazyLoad="false" name="id" type="integer" required="true" primaryKey="true" autoincrement="true"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="name" type="varchar" size="255"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="creator_id" type="integer"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="mailbox_prefix" type="varchar" size="255"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="max_mailbox_count" type="integer"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="quota" type="integer"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="default_mailbox_quota" type="integer"/><foreign-key onUpdate="none" foreignTable="user" onDelete="setnull"><reference local="creator_id" foreign="id"/></foreign-key><unique name="i2"><unique-column name="name"/></unique></table><table skipSql="false" abstract="false" name="mailbox" phpName="Mailbox"><column autoIncrement="false" lazyLoad="false" name="id" type="integer" required="true" primaryKey="true" autoincrement="true"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="domain_id" type="integer"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="name" type="varchar" size="30"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="password" type="varchar" size="40"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="max_quota" type="integer"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="max_address_count" type="integer"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="last_login" type="timestamp"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="active" type="boolean" default="1"/><foreign-key onUpdate="none" foreignTable="domain" onDelete="setnull"><reference local="domain_id" foreign="id"/></foreign-key></table><table skipSql="false" abstract="false" name="address" phpName="Address"><column autoIncrement="false" lazyLoad="false" name="id" type="integer" required="true" primaryKey="true" autoincrement="true"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="mailbox_id" type="integer"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="localpart" type="varchar" size="255"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="domain_id" type="integer"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="alias" type="varchar" size="255"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="destination" type="longvarchar"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="active" type="boolean" default="1"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="save_in_mailbox" type="boolean" default="1"/><foreign-key onUpdate="none" foreignTable="mailbox" onDelete="cascade"><reference local="mailbox_id" foreign="id"/></foreign-key><foreign-key onDelete="none" onUpdate="none" foreignTable="domain"><reference local="domain_id" foreign="id"/></foreign-key></table><table skipSql="false" abstract="false" name="log" phpName="LogEntry"><column autoIncrement="false" lazyLoad="false" name="id" type="integer" required="true" primaryKey="true" autoincrement="true"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="user_id" type="integer" default="null"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="created_at" type="timestamp"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="message" type="longvarchar"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="host" type="varchar" size="255"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="priority" type="integer"/><foreign-key onUpdate="none" foreignTable="user" onDelete="setnull"><reference local="user_id" foreign="id"/></foreign-key></table></database>
diff --git a/config/propel.ini b/config/propel.ini
new file mode 100644
index 0000000..92b813f
--- /dev/null
+++ b/config/propel.ini
@@ -0,0 +1,44 @@
+propel.targetPackage = lib.model
+propel.packageObjectModel = true
+propel.project = mailadmin
+propel.database = mysql
+propel.database.createUrl = mysql://user:password@localhost/
+propel.database.url = mysql://ruser:password@localhost/mailadmin
+
+propel.addGenericAccessors = true
+propel.addGenericMutators = true
+propel.addTimeStamp = false
+
+propel.schema.validate = false
+
+; directories
+propel.home = .
+propel.output.dir = /home/mszulecki/projects/mailadmin
+propel.schema.dir = ${propel.output.dir}/config
+propel.conf.dir = ${propel.output.dir}/config
+propel.phpconf.dir = ${propel.output.dir}/config
+propel.sql.dir = ${propel.output.dir}/data/sql
+propel.runtime.conf.file = runtime-conf.xml
+propel.php.dir = ${propel.output.dir}
+propel.default.schema.basename = schema
+propel.datadump.mapper.from = *schema.xml
+propel.datadump.mapper.to = *data.xml
+
+; builder settings
+propel.builder.peer.class = addon.propel.builder.SfPeerBuilder
+propel.builder.object.class = addon.propel.builder.SfObjectBuilder
+
+propel.builder.objectstub.class = addon.propel.builder.SfExtensionObjectBuilder
+propel.builder.peerstub.class = addon.propel.builder.SfExtensionPeerBuilder
+propel.builder.objectmultiextend.class = addon.propel.builder.SfMultiExtendObjectBuilder
+propel.builder.mapbuilder.class = addon.propel.builder.SfMapBuilderBuilder
+propel.builder.interface.class = propel.engine.builder.om.php5.PHP5InterfaceBuilder
+propel.builder.node.class = propel.engine.builder.om.php5.PHP5NodeBuilder
+propel.builder.nodepeer.class = propel.engine.builder.om.php5.PHP5NodePeerBuilder
+propel.builder.nodestub.class = propel.engine.builder.om.php5.PHP5ExtensionNodeBuilder
+propel.builder.nodepeerstub.class = propel.engine.builder.om.php5.PHP5ExtensionNodePeerBuilder
+
+propel.builder.addIncludes = false
+propel.builder.addComments = false
+
+propel.builder.addBehaviors = false
diff --git a/config/properties.ini b/config/properties.ini
new file mode 100644
index 0000000..be28321
--- /dev/null
+++ b/config/properties.ini
@@ -0,0 +1,2 @@
+[symfony]
+ name=mailadmin
diff --git a/config/rsync_exclude.txt b/config/rsync_exclude.txt
new file mode 100644
index 0000000..4b76ea8
--- /dev/null
+++ b/config/rsync_exclude.txt
@@ -0,0 +1,4 @@
+.svn
+/web/uploads/*
+/cache/*
+/log/*
diff --git a/config/schema-transformed.xml b/config/schema-transformed.xml
new file mode 100644
index 0000000..ea51a55
--- /dev/null
+++ b/config/schema-transformed.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<database defaultPhpNamingMethod="underscore" heavyIndexing="false" name="propel" defaultIdMethod="native" noXsd="true" package="lib.model"><table skipSql="false" abstract="false" name="role" phpName="Role"><column autoIncrement="false" lazyLoad="false" name="id" type="integer" required="true" primaryKey="true" autoincrement="true"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="name" type="varchar" size="255"/></table><table skipSql="false" abstract="false" name="user" phpName="User"><column autoIncrement="false" lazyLoad="false" name="id" type="integer" required="true" primaryKey="true" autoincrement="true"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="parent_user_id" type="integer" default="-1"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="nickname" type="varchar" size="50"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="first_name" type="varchar" size="100"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="last_name" type="varchar" size="100"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="email" type="varchar" size="255"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="sha1_password" type="varchar" size="40"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="salt" type="varchar" size="32"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="role_id" type="integer"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="lastlogin" type="timestamp"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="created_at" type="timestamp"/><foreign-key onDelete="none" onUpdate="none" foreignTable="role"><reference local="role_id" foreign="id"/></foreign-key></table><table skipSql="false" abstract="false" name="domain" phpName="Domain"><column autoIncrement="false" lazyLoad="false" name="id" type="integer" required="true" primaryKey="true" autoincrement="true"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="name" type="longvarchar"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="creator_user_id" type="integer"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="mailbox_prefix" type="varchar" size="255"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="max_mailbox_count" type="integer"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="quota" type="integer"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="max_mailbox_quota" type="integer"/><foreign-key onDelete="none" onUpdate="none" foreignTable="user" name="creator"><reference local="creator_user_id" foreign="id"/></foreign-key></table><table skipSql="false" abstract="false" name="mailbox" phpName="Mailbox"><column autoIncrement="false" lazyLoad="false" name="id" type="integer" required="true" primaryKey="true" autoincrement="true"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="domain_id" type="integer"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="name" type="varchar" size="255"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="password" type="varchar" size="255"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="last_login" type="timestamp"/><foreign-key onDelete="none" onUpdate="none" foreignTable="domain"><reference local="domain_id" foreign="id"/></foreign-key></table><table skipSql="false" abstract="false" name="address" phpName="Address"><column autoIncrement="false" lazyLoad="false" name="id" type="integer" required="true" primaryKey="true" autoincrement="true"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="mailbox_id" type="integer"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="alias" type="varchar" size="255"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="destination" type="varchar" size="255"/><foreign-key onDelete="none" onUpdate="none" foreignTable="mailbox"><reference local="mailbox_id" foreign="id"/></foreign-key></table><table skipSql="false" abstract="false" name="log" phpName="LogEntry"><column autoIncrement="false" lazyLoad="false" name="id" type="integer" required="true" primaryKey="true" autoincrement="true"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="created_at" type="timestamp"/><column primaryKey="false" required="false" autoIncrement="false" lazyLoad="false" name="message" type="longvarchar"/></table></database>
diff --git a/config/schema.yml b/config/schema.yml
new file mode 100644
index 0000000..58f0f72
--- /dev/null
+++ b/config/schema.yml
@@ -0,0 +1,68 @@
+propel:
+ role:
+ _attributes: { phpName: Role }
+ id:
+ name: varchar(255)
+ credentials: varchar(255)
+
+ user:
+ _attributes: { phpName: User }
+ id:
+ parent_user_id: { type: integer, default: -1, foreignTable: user, foreignReference: id, onDelete: setnull }
+ nickname: varchar(50)
+ first_name: varchar(100)
+ last_name: varchar(100)
+ email: varchar(255)
+ sha1_password: varchar(40)
+ salt: varchar(32)
+ role_id:
+ last_login: timestamp
+ created_at:
+
+ domain_permission:
+ _attributes: { phpName: DomainPermission }
+ user_id: { type: integer, foreignTable: user, foreignReference: id, onDelete: cascade }
+ domain_id: { type: integer, foreignTable: domain, foreignReference: id, onDelete: cascade }
+
+ domain:
+ _attributes: { phpName: Domain }
+ id:
+ name: varchar(255)
+ creator_id: { type: integer, foreignTable: user, foreignReference: id, onDelete: setnull }
+ mailbox_prefix: varchar(255)
+ max_mailbox_count: integer
+ quota: integer
+ default_mailbox_quota: integer
+ _uniques:
+ i2: [name]
+
+ mailbox:
+ _attributes: { phpName: Mailbox }
+ id:
+ domain_id: { type: integer, foreignTable: domain, foreignReference: id, onDelete: setnull }
+ name: varchar(30)
+ password: varchar(40)
+ max_quota: integer
+ max_address_count: integer
+ last_login: timestamp
+ active: { type: boolean, default: true }
+
+ address:
+ _attributes: { phpName: Address }
+ id:
+ mailbox_id: { type: integer, foreignTable: mailbox, foreignReference: id, onDelete: cascade }
+ localpart: varchar(255)
+ domain_id:
+ alias: varchar(255)
+ destination: longvarchar
+ active: { type: boolean, default: true }
+ save_in_mailbox: { type: boolean, default: true }
+
+ log:
+ _attributes: { phpName: LogEntry }
+ id:
+ user_id: { type: integer, default: null, foreignTable: user, foreignReference: id, onDelete: setnull }
+ created_at:
+ message: longvarchar
+ host: varchar(255)
+ priority: integer
diff --git a/data/fixtures/10-common_data.yml b/data/fixtures/10-common_data.yml
new file mode 100644
index 0000000..f435ccc
--- /dev/null
+++ b/data/fixtures/10-common_data.yml
@@ -0,0 +1,21 @@
+Role:
+ superadmin:
+ name: Superadmin
+ credentials: 'superadmin'
+ domainmaster:
+ name: Domain Master
+ credentials: 'domainmaster'
+ mailboxmaster:
+ name: Mailbox Master
+ credentials: 'mailboxmaster'
+
+User:
+ admin:
+ nickname: admin
+ first_name:
+ last_name:
+ email:
+ password: admin
+ role_id: superadmin
+ created_at:
+
diff --git a/data/generator/sfPropelAdmin/mailadmin/template/actions/actions.class.php b/data/generator/sfPropelAdmin/mailadmin/template/actions/actions.class.php
new file mode 100644
index 0000000..70f94f0
--- /dev/null
+++ b/data/generator/sfPropelAdmin/mailadmin/template/actions/actions.class.php
@@ -0,0 +1,435 @@
+[?php
+
+/**
+ * <?php echo $this->getGeneratedModuleName() ?> actions.
+ *
+ * @package ##PROJECT_NAME##
+ * @subpackage <?php echo $this->getGeneratedModuleName() ?>
+
+ * @author Fabien Potencier <fabien.potencier@symfony-project.com>
+ * @version SVN: $Id: actions.class.php 3501 2007-02-18 10:28:17Z fabien $
+ */
+class <?php echo $this->getGeneratedModuleName() ?>Actions extends sfActions
+{
+ public function executeIndex()
+ {
+ return $this->forward('<?php echo $this->getModuleName() ?>', 'list');
+ }
+
+ public function executeList()
+ {
+ $this->processSort();
+
+ $this->processFilters();
+
+<?php if ($this->getParameterValue('list.filters')): ?>
+ $this->filters = $this->getUser()->getAttributeHolder()->getAll('sf_admin/<?php echo $this->getSingularName() ?>/filters');
+<?php endif ?>
+
+ // pager
+ $this->pager = new sfPropelPager('<?php echo $this->getClassName() ?>', <?php echo $this->getParameterValue('list.max_per_page', 20) ?>);
+ $c = new Criteria();
+ $this->addSortCriteria($c);
+ $this->addFiltersCriteria($c);
+ $this->pager->setCriteria($c);
+ $this->pager->setPage($this->getRequestParameter('page', 1));
+<?php if ($this->getParameterValue('list.peer_method')): ?>
+ $this->pager->setPeerMethod('<?php echo $this->getParameterValue('list.peer_method') ?>');
+<?php endif ?>
+<?php if ($this->getParameterValue('list.peer_count_method')): ?>
+ $this->pager->setPeerCountMethod('<?php echo $this->getParameterValue('list.peer_count_method') ?>');
+<?php endif ?>
+ $this->pager->init();
+ }
+
+ public function executeCreate()
+ {
+ return $this->forward('<?php echo $this->getModuleName() ?>', 'edit');
+ }
+
+ public function executeSave()
+ {
+ return $this->forward('<?php echo $this->getModuleName() ?>', 'edit');
+ }
+
+ public function executeEdit()
+ {
+ $this-><?php echo $this->getSingularName() ?> = $this->get<?php echo $this->getClassName() ?>OrCreate();
+
+ if ($this->getRequest()->getMethod() == sfRequest::POST)
+ {
+ $this->update<?php echo $this->getClassName() ?>FromRequest();
+
+ $this->save<?php echo $this->getClassName() ?>($this-><?php echo $this->getSingularName() ?>);
+
+ $this->setFlash('notice', 'Your modifications have been saved');
+
+ if ($this->getRequestParameter('save_and_add'))
+ {
+ return $this->redirect('<?php echo $this->getModuleName() ?>/create');
+ }
+ else if ($this->getRequestParameter('save_and_list'))
+ {
+ return $this->redirect('<?php echo $this->getModuleName() ?>/list');
+ }
+ else
+ {
+ return $this->redirect('<?php echo $this->getModuleName() ?>/edit?<?php echo $this->getPrimaryKeyUrlParams('this->') ?>);
+ }
+ }
+ else
+ {
+ $this->labels = $this->getLabels();
+ }
+ }
+
+ public function executeDelete()
+ {
+ $this-><?php echo $this->getSingularName() ?> = <?php echo $this->getClassName() ?>Peer::retrieveByPk(<?php echo $this->getRetrieveByPkParamsForAction(40) ?>);
+ $this->forward404Unless($this-><?php echo $this->getSingularName() ?>);
+
+ try
+ {
+ $this->delete<?php echo $this->getClassName() ?>($this-><?php echo $this->getSingularName() ?>);
+ }
+ catch (PropelException $e)
+ {
+ $this->getRequest()->setError('delete', 'Could not delete the selected <?php echo sfInflector::humanize($this->getSingularName()) ?>. Make sure it does not have any associated items.');
+ return $this->forward('<?php echo $this->getModuleName() ?>', 'list');
+ }
+
+<?php foreach ($this->getColumnCategories('edit.display') as $category): ?>
+<?php foreach ($this->getColumns('edit.display', $category) as $name => $column): ?>
+<?php $input_type = $this->getParameterValue('edit.fields.'.$column->getName().'.type') ?>
+<?php if ($input_type == 'admin_input_file_tag'): ?>
+<?php $upload_dir = $this->replaceConstants($this->getParameterValue('edit.fields.'.$column->getName().'.upload_dir')) ?>
+ $currentFile = sfConfig::get('sf_upload_dir')."/<?php echo $upload_dir ?>/".$this-><?php echo $this->getSingularName() ?>->get<?php echo $column->getPhpName() ?>();
+ if (is_file($currentFile))
+ {
+ unlink($currentFile);
+ }
+
+<?php endif; ?>
+<?php endforeach; ?>
+<?php endforeach; ?>
+ return $this->redirect('<?php echo $this->getModuleName() ?>/list');
+ }
+
+ public function handleErrorEdit()
+ {
+ $this->preExecute();
+ $this-><?php echo $this->getSingularName() ?> = $this->get<?php echo $this->getClassName() ?>OrCreate();
+ $this->update<?php echo $this->getClassName() ?>FromRequest();
+
+ $this->labels = $this->getLabels();
+
+ return sfView::SUCCESS;
+ }
+
+ protected function save<?php echo $this->getClassName() ?>($<?php echo $this->getSingularName() ?>)
+ {
+ $<?php echo $this->getSingularName() ?>->save();
+
+<?php foreach ($this->getColumnCategories('edit.display') as $category): ?>
+<?php foreach ($this->getColumns('edit.display', $category) as $name => $column): $type = $column->getCreoleType(); ?>
+<?php $name = $column->getName() ?>
+<?php if ($column->isPrimaryKey()) continue ?>
+<?php $credentials = $this->getParameterValue('edit.fields.'.$column->getName().'.credentials') ?>
+<?php $input_type = $this->getParameterValue('edit.fields.'.$column->getName().'.type') ?>
+<?php
+
+$user_params = $this->getParameterValue('edit.fields.'.$column->getName().'.params');
+$user_params = is_array($user_params) ? $user_params : sfToolkit::stringToArray($user_params);
+$through_class = isset($user_params['through_class']) ? $user_params['through_class'] : '';
+
+?>
+<?php if ($through_class): ?>
+<?php
+
+$class = $this->getClassName();
+$related_class = sfPropelManyToMany::getRelatedClass($class, $through_class);
+$related_table = constant($related_class.'Peer::TABLE_NAME');
+$middle_table = constant($through_class.'Peer::TABLE_NAME');
+$this_table = constant($class.'Peer::TABLE_NAME');
+
+$related_column = sfPropelManyToMany::getRelatedColumn($class, $through_class);
+$column = sfPropelManyToMany::getColumn($class, $through_class);
+
+?>
+<?php if ($input_type == 'admin_double_list' || $input_type == 'admin_check_list' || $input_type == 'admin_select_list'): ?>
+<?php if ($credentials): $credentials = str_replace("\n", ' ', var_export($credentials, true)) ?>
+ if ($this->getUser()->hasCredential(<?php echo $credentials ?>))
+ {
+<?php endif; ?>
+ // Update many-to-many for "<?php echo $name ?>"
+ $c = new Criteria();
+ $c->add(<?php echo $through_class ?>Peer::<?php echo strtoupper($column->getColumnName()) ?>, $<?php echo $this->getSingularName() ?>->getPrimaryKey());
+ <?php echo $through_class ?>Peer::doDelete($c);
+
+ $ids = $this->getRequestParameter('associated_<?php echo $name ?>');
+ if (is_array($ids))
+ {
+ foreach ($ids as $id)
+ {
+ $<?php echo ucfirst($through_class) ?> = new <?php echo $through_class ?>();
+ $<?php echo ucfirst($through_class) ?>->set<?php echo $column->getPhpName() ?>($<?php echo $this->getSingularName() ?>->getPrimaryKey());
+ $<?php echo ucfirst($through_class) ?>->set<?php echo $related_column->getPhpName() ?>($id);
+ $<?php echo ucfirst($through_class) ?>->save();
+ }
+ }
+
+<?php if ($credentials): ?>
+ }
+<?php endif; ?>
+<?php endif; ?>
+<?php endif; ?>
+<?php endforeach; ?>
+<?php endforeach; ?>
+ }
+
+ protected function delete<?php echo $this->getClassName() ?>($<?php echo $this->getSingularName() ?>)
+ {
+ $<?php echo $this->getSingularName() ?>->delete();
+ }
+
+ protected function update<?php echo $this->getClassName() ?>FromRequest()
+ {
+ $<?php echo $this->getSingularName() ?> = $this->getRequestParameter('<?php echo $this->getSingularName() ?>');
+
+<?php foreach ($this->getColumnCategories('edit.display') as $category): ?>
+<?php foreach ($this->getColumns('edit.display', $category) as $name => $column): $type = $column->getCreoleType(); ?>
+<?php $name = $column->getName() ?>
+<?php if ($column->isPrimaryKey()) continue ?>
+<?php $credentials = $this->getParameterValue('edit.fields.'.$column->getName().'.credentials') ?>
+<?php $input_type = $this->getParameterValue('edit.fields.'.$column->getName().'.type') ?>
+<?php if ($credentials): $credentials = str_replace("\n", ' ', var_export($credentials, true)) ?>
+ if ($this->getUser()->hasCredential(<?php echo $credentials ?>))
+ {
+<?php endif; ?>
+<?php if ($input_type == 'admin_input_file_tag'): ?>
+<?php $upload_dir = $this->replaceConstants($this->getParameterValue('edit.fields.'.$column->getName().'.upload_dir')) ?>
+ $currentFile = sfConfig::get('sf_upload_dir')."/<?php echo $upload_dir ?>/".$this-><?php echo $this->getSingularName() ?>->get<?php echo $column->getPhpName() ?>();
+ if (!$this->getRequest()->hasErrors() && isset($<?php echo $this->getSingularName() ?>['<?php echo $name ?>_remove']))
+ {
+ $this-><?php echo $this->getSingularName() ?>->set<?php echo $column->getPhpName() ?>('');
+ if (is_file($currentFile))
+ {
+ unlink($currentFile);
+ }
+ }
+
+ if (!$this->getRequest()->hasErrors() && $this->getRequest()->getFileSize('<?php echo $this->getSingularName() ?>[<?php echo $name ?>]'))
+ {
+<?php elseif ($type != CreoleTypes::BOOLEAN): ?>
+ if (isset($<?php echo $this->getSingularName() ?>['<?php echo $name ?>']))
+ {
+<?php endif; ?>
+<?php if ($input_type == 'admin_input_file_tag'): ?>
+<?php if ($this->getParameterValue('edit.fields.'.$column->getName().'.filename')): ?>
+ $fileName = "<?php echo str_replace('"', '\\"', $this->replaceConstants($this->getParameterValue('edit.fields.'.$column->getName().'.filename'))) ?>";
+<?php else: ?>
+ $fileName = md5($this->getRequest()->getFileName('<?php echo $this->getSingularName() ?>[<?php echo $name ?>]').time().rand(0, 99999));
+<?php endif ?>
+ $ext = $this->getRequest()->getFileExtension('<?php echo $this->getSingularName() ?>[<?php echo $name ?>]');
+ if (is_file($currentFile))
+ {
+ unlink($currentFile);
+ }
+ $this->getRequest()->moveFile('<?php echo $this->getSingularName() ?>[<?php echo $name ?>]', sfConfig::get('sf_upload_dir')."/<?php echo $upload_dir ?>/".$fileName.$ext);
+ $this-><?php echo $this->getSingularName() ?>->set<?php echo $column->getPhpName() ?>($fileName.$ext);
+<?php elseif ($type == CreoleTypes::DATE || $type == CreoleTypes::TIMESTAMP): ?>
+ if ($<?php echo $this->getSingularName() ?>['<?php echo $name ?>'])
+ {
+ try
+ {
+ $dateFormat = new sfDateFormat($this->getUser()->getCulture());
+ <?php $inputPattern = $type == CreoleTypes::DATE ? 'd' : 'g'; ?>
+ <?php $outputPattern = $type == CreoleTypes::DATE ? 'i' : 'I'; ?>
+ if (!is_array($<?php echo $this->getSingularName() ?>['<?php echo $name ?>']))
+ {
+ $value = $dateFormat->format($<?php echo $this->getSingularName() ?>['<?php echo $name ?>'], '<?php echo $outputPattern ?>', $dateFormat->getInputPattern('<?php echo $inputPattern ?>'));
+ }
+ else
+ {
+ $value_array = $<?php echo $this->getSingularName() ?>['<?php echo $name ?>'];
+ $value = $value_array['year'].'-'.$value_array['month'].'-'.$value_array['day'].(isset($value_array['hour']) ? ' '.$value_array['hour'].':'.$value_array['minute'].(isset($value_array['second']) ? ':'.$value_array['second'] : '') : '');
+ }
+ $this-><?php echo $this->getSingularName() ?>->set<?php echo $column->getPhpName() ?>($value);
+ }
+ catch (sfException $e)
+ {
+ // not a date
+ }
+ }
+ else
+ {
+ $this-><?php echo $this->getSingularName() ?>->set<?php echo $column->getPhpName() ?>(null);
+ }
+<?php elseif ($type == CreoleTypes::BOOLEAN): ?>
+ $this-><?php echo $this->getSingularName() ?>->set<?php echo $column->getPhpName() ?>(isset($<?php echo $this->getSingularName() ?>['<?php echo $name ?>']) ? $<?php echo $this->getSingularName() ?>['<?php echo $name ?>'] : 0);
+<?php elseif ($column->isForeignKey()): ?>
+ $this-><?php echo $this->getSingularName() ?>->set<?php echo $column->getPhpName() ?>($<?php echo $this->getSingularName() ?>['<?php echo $name ?>'] ? $<?php echo $this->getSingularName() ?>['<?php echo $name ?>'] : null);
+<?php else: ?>
+ $this-><?php echo $this->getSingularName() ?>->set<?php echo $column->getPhpName() ?>($<?php echo $this->getSingularName() ?>['<?php echo $name ?>']);
+<?php endif; ?>
+<?php if ($type != CreoleTypes::BOOLEAN): ?>
+ }
+<?php endif; ?>
+<?php if ($credentials): ?>
+ }
+<?php endif; ?>
+<?php endforeach; ?>
+<?php endforeach; ?>
+ }
+
+ protected function get<?php echo $this->getClassName() ?>OrCreate(<?php echo $this->getMethodParamsForGetOrCreate() ?>)
+ {
+ if (<?php echo $this->getTestPksForGetOrCreate() ?>)
+ {
+ $<?php echo $this->getSingularName() ?> = new <?php echo $this->getClassName() ?>();
+ }
+ else
+ {
+ $<?php echo $this->getSingularName() ?> = <?php echo $this->getClassName() ?>Peer::retrieveByPk(<?php echo $this->getRetrieveByPkParamsForGetOrCreate() ?>);
+
+ $this->forward404Unless($<?php echo $this->getSingularName() ?>);
+ }
+
+ return $<?php echo $this->getSingularName() ?>;
+ }
+
+ protected function processFilters()
+ {
+<?php if ($this->getParameterValue('list.filters')): ?>
+ if ($this->getRequest()->hasParameter('filter'))
+ {
+ $filters = $this->getRequestParameter('filters');
+<?php foreach ($this->getColumns('list.filters') as $column): $type = $column->getCreoleType() ?>
+<?php if ($type == CreoleTypes::DATE || $type == CreoleTypes::TIMESTAMP): ?>
+ if (isset($filters['<?php echo $column->getName() ?>']['from']) && $filters['<?php echo $column->getName() ?>']['from'] !== '')
+ {
+ $filters['<?php echo $column->getName() ?>']['from'] = sfI18N::getTimestampForCulture($filters['<?php echo $column->getName() ?>']['from'], $this->getUser()->getCulture());
+ }
+ if (isset($filters['<?php echo $column->getName() ?>']['to']) && $filters['<?php echo $column->getName() ?>']['to'] !== '')
+ {
+ $filters['<?php echo $column->getName() ?>']['to'] = sfI18N::getTimestampForCulture($filters['<?php echo $column->getName() ?>']['to'], $this->getUser()->getCulture());
+ }
+<?php endif; ?>
+<?php endforeach; ?>
+
+ $this->getUser()->getAttributeHolder()->removeNamespace('sf_admin/<?php echo $this->getSingularName() ?>/filters');
+ $this->getUser()->getAttributeHolder()->add($filters, 'sf_admin/<?php echo $this->getSingularName() ?>/filters');
+ }
+<?php endif; ?>
+ }
+
+ protected function processSort()
+ {
+ if ($this->getRequestParameter('sort'))
+ {
+ $this->getUser()->setAttribute('sort', $this->getRequestParameter('sort'), 'sf_admin/<?php echo $this->getSingularName() ?>/sort');
+ $this->getUser()->setAttribute('type', $this->getRequestParameter('type', 'asc'), 'sf_admin/<?php echo $this->getSingularName() ?>/sort');
+ }
+
+ if (!$this->getUser()->getAttribute('sort', null, 'sf_admin/<?php echo $this->getSingularName() ?>/sort'))
+ {
+<?php if ($sort = $this->getParameterValue('list.sort')): ?>
+<?php if (is_array($sort)): ?>
+ $this->getUser()->setAttribute('sort', '<?php echo $sort[0] ?>', 'sf_admin/<?php echo $this->getSingularName() ?>/sort');
+ $this->getUser()->setAttribute('type', '<?php echo $sort[1] ?>', 'sf_admin/<?php echo $this->getSingularName() ?>/sort');
+<?php else: ?>
+ $this->getUser()->setAttribute('sort', '<?php echo $sort ?>', 'sf_admin/<?php echo $this->getSingularName() ?>/sort');
+ $this->getUser()->setAttribute('type', 'asc', 'sf_admin/<?php echo $this->getSingularName() ?>/sort');
+<?php endif; ?>
+<?php endif; ?>
+ }
+ }
+
+ protected function addFiltersCriteria($c)
+ {
+<?php if ($this->getParameterValue('list.filters')): ?>
+<?php foreach ($this->getColumns('list.filters') as $column): $type = $column->getCreoleType() ?>
+<?php if (($column->isPartial() || $column->isComponent()) && $this->getParameterValue('list.fields.'.$column->getName().'.filter_criteria_disabled')) continue ?>
+ if (isset($this->filters['<?php echo $column->getName() ?>_is_empty']))
+ {
+ $criterion = $c->getNewCriterion(<?php echo $this->getPeerClassName() ?>::<?php echo strtoupper($column->getName()) ?>, '');
+ $criterion->addOr($c->getNewCriterion(<?php echo $this->getPeerClassName() ?>::<?php echo strtoupper($column->getName()) ?>, null, Criteria::ISNULL));
+ $c->add($criterion);
+ }
+<?php if ($type == CreoleTypes::DATE || $type == CreoleTypes::TIMESTAMP): ?>
+ else if (isset($this->filters['<?php echo $column->getName() ?>']))
+ {
+ if (isset($this->filters['<?php echo $column->getName() ?>']['from']) && $this->filters['<?php echo $column->getName() ?>']['from'] !== '')
+ {
+<?php if ($type == CreoleTypes::DATE): ?>
+ $criterion = $c->getNewCriterion(<?php echo $this->getPeerClassName() ?>::<?php echo strtoupper($column->getName()) ?>, date('Y-m-d', $this->filters['<?php echo $column->getName() ?>']['from']), Criteria::GREATER_EQUAL);
+<?php else: ?>
+ $criterion = $c->getNewCriterion(<?php echo $this->getPeerClassName() ?>::<?php echo strtoupper($column->getName()) ?>, $this->filters['<?php echo $column->getName() ?>']['from'], Criteria::GREATER_EQUAL);
+<?php endif; ?>
+ }
+ if (isset($this->filters['<?php echo $column->getName() ?>']['to']) && $this->filters['<?php echo $column->getName() ?>']['to'] !== '')
+ {
+ if (isset($criterion))
+ {
+<?php if ($type == CreoleTypes::DATE): ?>
+ $criterion->addAnd($c->getNewCriterion(<?php echo $this->getPeerClassName() ?>::<?php echo strtoupper($column->getName()) ?>, date('Y-m-d', $this->filters['<?php echo $column->getName() ?>']['to']), Criteria::LESS_EQUAL));
+<?php else: ?>
+ $criterion->addAnd($c->getNewCriterion(<?php echo $this->getPeerClassName() ?>::<?php echo strtoupper($column->getName()) ?>, $this->filters['<?php echo $column->getName() ?>']['to'], Criteria::LESS_EQUAL));
+<?php endif; ?>
+ }
+ else
+ {
+<?php if ($type == CreoleTypes::DATE): ?>
+ $criterion = $c->getNewCriterion(<?php echo $this->getPeerClassName() ?>::<?php echo strtoupper($column->getName()) ?>, date('Y-m-d', $this->filters['<?php echo $column->getName() ?>']['to']), Criteria::LESS_EQUAL);
+<?php else: ?>
+ $criterion = $c->getNewCriterion(<?php echo $this->getPeerClassName() ?>::<?php echo strtoupper($column->getName()) ?>, $this->filters['<?php echo $column->getName() ?>']['to'], Criteria::LESS_EQUAL);
+<?php endif; ?>
+ }
+ }
+
+ if (isset($criterion))
+ {
+ $c->add($criterion);
+ }
+ }
+<?php else: ?>
+ else if (isset($this->filters['<?php echo $column->getName() ?>']) && $this->filters['<?php echo $column->getName() ?>'] !== '')
+ {
+<?php if ($type == CreoleTypes::CHAR || $type == CreoleTypes::VARCHAR || $type == CreoleTypes::LONGVARCHAR): ?>
+ $c->add(<?php echo $this->getPeerClassName() ?>::<?php echo strtoupper($column->getName()) ?>, strtr($this->filters['<?php echo $column->getName() ?>'], '*', '%'), Criteria::LIKE);
+<?php else: ?>
+ $c->add(<?php echo $this->getPeerClassName() ?>::<?php echo strtoupper($column->getName()) ?>, $this->filters['<?php echo $column->getName() ?>']);
+<?php endif; ?>
+ }
+<?php endif; ?>
+<?php endforeach; ?>
+<?php endif; ?>
+ }
+
+ protected function addSortCriteria($c)
+ {
+ if ($sort_column = $this->getUser()->getAttribute('sort', null, 'sf_admin/<?php echo $this->getSingularName() ?>/sort'))
+ {
+ $sort_column = <?php echo $this->getClassName() ?>Peer::translateFieldName($sort_column, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_COLNAME);
+ if ($this->getUser()->getAttribute('type', null, 'sf_admin/<?php echo $this->getSingularName() ?>/sort') == 'asc')
+ {
+ $c->addAscendingOrderByColumn($sort_column);
+ }
+ else
+ {
+ $c->addDescendingOrderByColumn($sort_column);
+ }
+ }
+ }
+
+ protected function getLabels()
+ {
+ return array(
+<?php foreach ($this->getColumnCategories('edit.display') as $category): ?>
+<?php foreach ($this->getColumns('edit.display', $category) as $name => $column): ?>
+ '<?php echo $this->getSingularName() ?>{<?php echo $column->getName() ?>}' => '<?php $label_name = str_replace("'", "\\'", $this->getParameterValue('edit.fields.'.$column->getName().'.name')); echo $label_name ?><?php if ($label_name): ?>:<?php endif ?>',
+<?php endforeach; ?>
+<?php endforeach; ?>
+ );
+ }
+}
diff --git a/data/generator/sfPropelAdmin/mailadmin/template/templates/_edit_actions.php b/data/generator/sfPropelAdmin/mailadmin/template/templates/_edit_actions.php
new file mode 100644
index 0000000..1d0d720
--- /dev/null
+++ b/data/generator/sfPropelAdmin/mailadmin/template/templates/_edit_actions.php
@@ -0,0 +1,13 @@
+<ul class="sf_admin_actions">
+<?php $editActions = $this->getParameterValue('edit.actions') ?>
+<?php if (null !== $editActions): ?>
+<?php foreach ((array) $editActions as $actionName => $params): ?>
+ <?php if ($actionName == '_delete') continue ?>
+ <?php echo $this->addCredentialCondition($this->getButtonToAction($actionName, $params, true), $params) ?>
+<?php endforeach; ?>
+<?php else: ?>
+ <?php echo $this->getButtonToAction('_list', array(), true) ?>
+ <?php echo $this->getButtonToAction('_save', array(), true) ?>
+ <?php echo $this->getButtonToAction('_save_and_add', array(), true) ?>
+<?php endif; ?>
+</ul>
diff --git a/data/generator/sfPropelAdmin/mailadmin/template/templates/_edit_footer.php b/data/generator/sfPropelAdmin/mailadmin/template/templates/_edit_footer.php
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/data/generator/sfPropelAdmin/mailadmin/template/templates/_edit_footer.php
diff --git a/data/generator/sfPropelAdmin/mailadmin/template/templates/_edit_form.php b/data/generator/sfPropelAdmin/mailadmin/template/templates/_edit_form.php
new file mode 100644
index 0000000..47c385e
--- /dev/null
+++ b/data/generator/sfPropelAdmin/mailadmin/template/templates/_edit_form.php
@@ -0,0 +1,93 @@
+[?php echo form_tag('<?php echo $this->getModuleName() ?>/'.$sf_context->getActionName(), array(
+ 'id' => 'sf_admin_edit_form',
+ 'name' => 'sf_admin_edit_form',
+ 'multipart' => true,
+<?php foreach ($this->getColumnCategories('edit.display') as $category): ?>
+<?php foreach ($this->getColumns('edit.display', $category) as $name => $column): ?>
+<?php if ('admin_double_list' == $this->getParameterValue('edit.fields.'.$column->getName().'.type')): ?>
+ 'onsubmit' => 'double_list_submit(); return true;'
+<?php break 2; ?>
+<?php endif; ?>
+<?php endforeach; ?>
+<?php endforeach; ?>
+)) ?]
+
+<?php foreach ($this->getPrimaryKey() as $pk): ?>
+[?php echo object_input_hidden_tag($<?php echo $this->getSingularName() ?>, 'get<?php echo $pk->getPhpName() ?>') ?]
+<?php endforeach; ?>
+
+<?php $first = true ?>
+<?php foreach ($this->getColumnCategories('edit.display') as $category): ?>
+<?php
+ if ($category[0] == '-')
+ {
+ $category_name = substr($category, 1);
+ $collapse = true;
+
+ if ($first)
+ {
+ $first = false;
+ echo "[?php use_javascript(sfConfig::get('sf_prototype_web_dir').'/js/prototype') ?]\n";
+ echo "[?php use_javascript(sfConfig::get('sf_admin_web_dir').'/js/collapse') ?]\n";
+ }
+ }
+ else
+ {
+ $category_name = $category;
+ $collapse = false;
+ }
+?>
+<fieldset id="sf_fieldset_<?php echo preg_replace('/[^a-z0-9_]/', '_', strtolower($category_name)) ?>" class="<?php if ($collapse): ?> collapse<?php endif; ?>">
+<?php if ($category != 'NONE'): ?><h2>[?php echo __('<?php echo $category_name ?>') ?]</h2>
+
+<?php endif; ?>
+
+<?php $hides = $this->getParameterValue('edit.hide', array()) ?>
+<?php foreach ($this->getColumns('edit.display', $category) as $name => $column): ?>
+<?php if (in_array($column->getName(), $hides)) continue ?>
+<?php if ($column->isPrimaryKey()) continue ?>
+<?php $credentials = $this->getParameterValue('edit.fields.'.$column->getName().'.credentials') ?>
+<?php if ($credentials): $credentials = str_replace("\n", ' ', var_export($credentials, true)) ?>
+ [?php if ($sf_user->hasCredential(<?php echo $credentials ?>)): ?]
+<?php endif; ?>
+<?php $only_for = $this->getParameterValue('edit.fields.'.$column->getName().'.only_for'); if($only_for): ?>
+[?php if($sf_context->getActionName()=='<?php echo $only_for ?>'): ?]
+<?php endif; ?>
+<div class="form-row">
+ [?php echo label_for('<?php echo $this->getParameterValue("edit.fields.".$column->getName().".label_for", $this->getSingularName()."[".$column->getName()."]") ?>', __($labels['<?php echo $this->getSingularName() ?>{<?php echo $column->getName() ?>}']), '<?php if ($column->isNotNull()): ?>class="required" <?php endif; ?>') ?]
+ <div class="content[?php if ($sf_request->hasError('<?php echo $this->getSingularName() ?>{<?php echo $column->getName() ?>}')): ?] form-error[?php endif; ?]">
+ [?php if ($sf_request->hasError('<?php echo $this->getSingularName() ?>{<?php echo $column->getName() ?>}')): ?]
+ [?php echo form_error('<?php echo $this->getSingularName() ?>{<?php echo $column->getName() ?>}', array('class' => 'form-error-msg')) ?]
+ [?php endif; ?]
+ [?php $value = <?php echo $this->getColumnEditTag($column); ?>; echo $value ? $value : '&nbsp;' ?]
+ <?php echo $this->getHelp($column, 'edit') ?>
+ </div>
+</div>
+
+<?php if($only_for): ?>
+[?php endif; ?]
+<?php endif; ?>
+
+<?php if ($credentials): ?>
+ [?php endif; ?]
+<?php endif; ?>
+
+<?php endforeach; ?>
+</fieldset>
+<?php endforeach; ?>
+
+[?php include_partial('edit_actions', array('<?php echo $this->getSingularName() ?>' => $<?php echo $this->getSingularName() ?>)) ?]
+
+</form>
+
+<ul class="sf_admin_actions">
+<?php
+/*
+ * WARNING: delete is a form, it must be outside the main form
+ */
+ $editActions = $this->getParameterValue('edit.actions');
+?>
+ <?php if (null === $editActions || (null !== $editActions && array_key_exists('_delete', $editActions))): ?>
+ <?php echo $this->addCredentialCondition($this->getButtonToAction('_delete', $editActions['_delete'], true), $editActions['_delete']) ?>
+ <?php endif; ?>
+</ul>
diff --git a/data/generator/sfPropelAdmin/mailadmin/template/templates/_edit_header.php b/data/generator/sfPropelAdmin/mailadmin/template/templates/_edit_header.php
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/data/generator/sfPropelAdmin/mailadmin/template/templates/_edit_header.php
diff --git a/data/generator/sfPropelAdmin/mailadmin/template/templates/_edit_messages.php b/data/generator/sfPropelAdmin/mailadmin/template/templates/_edit_messages.php
new file mode 100644
index 0000000..2306f05
--- /dev/null
+++ b/data/generator/sfPropelAdmin/mailadmin/template/templates/_edit_messages.php
@@ -0,0 +1,5 @@
+[?php if ($sf_flash->has('notice')): ?]
+<div class="save-ok">
+<h2>[?php echo __($sf_flash->get('notice')) ?]</h2>
+</div>
+[?php endif; ?]
diff --git a/data/generator/sfPropelAdmin/mailadmin/template/templates/_filters.php b/data/generator/sfPropelAdmin/mailadmin/template/templates/_filters.php
new file mode 100644
index 0000000..76be382
--- /dev/null
+++ b/data/generator/sfPropelAdmin/mailadmin/template/templates/_filters.php
@@ -0,0 +1,36 @@
+[?php use_helper('Object') ?]
+
+<?php if ($this->getParameterValue('list.filters')): ?>
+<div id="sf_admin_filters" style="display:none">
+[?php echo form_tag('<?php echo $this->getModuleName() ?>/list', array('method' => 'get')) ?]
+
+ <hr size="1" />
+ <h2>[?php echo __('Filters') ?]</h2>
+<?php foreach ($this->getColumns('list.filters') as $column): $type = $column->getCreoleType() ?>
+<?php $credentials = $this->getParameterValue('list.fields.'.$column->getName().'.credentials') ?>
+<?php if ($credentials): $credentials = str_replace("\n", ' ', var_export($credentials, true)) ?>
+ [?php if ($sf_user->hasCredential(<?php echo $credentials ?>)): ?]
+<?php endif; ?>
+ <div class="form-row">
+ <label for="<?php echo $column->getName() ?>">[?php echo __('<?php echo str_replace("'", "\\'", $this->getParameterValue('list.fields.'.$column->getName().'.name')) ?>:') ?]</label>
+ <div class="content">
+ [?php echo <?php echo $this->getColumnFilterTag($column) ?> ?]
+<?php if ($this->getParameterValue('list.fields.'.$column->getName().'.filter_is_empty')): ?>
+ <div>[?php echo checkbox_tag('filters[<?php echo $column->getName() ?>_is_empty]', 1, isset($filters['<?php echo $column->getName() ?>_is_empty']) ? $filters['<?php echo $column->getName() ?>_is_empty'] : null) ?]&nbsp;<label for="filters[<?php echo $column->getName() ?>_is_empty]">[?php echo __('is empty') ?]</label></div>
+<?php endif; ?>
+ </div>
+ </div>
+<?php if ($credentials): ?>
+ [?php endif; ?]
+<?php endif; ?>
+
+ <?php endforeach; ?>
+
+ <div class="formaction">
+ [?php echo submit_tag(__('filter'), 'name=filter class=sf_admin_action_filter') ?]
+ [?php echo button_to(__('reset'), '<?php echo $this->getModuleName() ?>/list?filter=filter', 'class=sf_admin_action_reset_filter') ?]
+ </div>
+
+</form>
+</div>
+<?php endif; ?>
diff --git a/data/generator/sfPropelAdmin/mailadmin/template/templates/_list.php b/data/generator/sfPropelAdmin/mailadmin/template/templates/_list.php
new file mode 100644
index 0000000..cc85625
--- /dev/null
+++ b/data/generator/sfPropelAdmin/mailadmin/template/templates/_list.php
@@ -0,0 +1,18 @@
+<table>
+<tr>
+<?php if ($this->getParameterValue('list.object_actions')): ?>
+[?php $c = 0; ?]
+<?php foreach ($this->getParameterValue('list.object_actions') as $actionName => $params): ?>
+ <?php echo $this->addCredentialCondition('[?php $c++; ?]', $params) ?>
+<?php endforeach; ?>
+ <th width="1%" colspan="[?php echo $c ?]" id="sf_admin_list_th_sf_actions">[?php echo __('Actions') ?]</th>
+<?php endif; ?>
+[?php include_partial('list_th_<?php echo $this->getParameterValue('list.layout', 'tabular') ?>') ?]
+</tr>
+[?php $i = 1; foreach ($pager->getResults() as $<?php echo $this->getSingularName() ?>): $odd = fmod(++$i, 2) ?]
+<tr class="sf_admin_row_[?php echo $odd ?]">
+[?php include_partial('list_td_actions', array('<?php echo $this->getSingularName() ?>' => $<?php echo $this->getSingularName() ?>)) ?]
+[?php include_partial('list_td_<?php echo $this->getParameterValue('list.layout', 'tabular') ?>', array('<?php echo $this->getSingularName() ?>' => $<?php echo $this->getSingularName() ?>)) ?]
+</tr>
+[?php endforeach; ?]
+</table>
diff --git a/data/generator/sfPropelAdmin/mailadmin/template/templates/_list_actions.php b/data/generator/sfPropelAdmin/mailadmin/template/templates/_list_actions.php
new file mode 100644
index 0000000..a13263c
--- /dev/null
+++ b/data/generator/sfPropelAdmin/mailadmin/template/templates/_list_actions.php
@@ -0,0 +1,10 @@
+<ul class="sf_admin_actions">
+<?php $listActions = $this->getParameterValue('list.actions') ?>
+<?php if (null !== $listActions): ?>
+ <?php foreach ((array) $listActions as $actionName => $params): ?>
+ <?php echo $this->addCredentialCondition($this->getButtonToAction($actionName, $params, false), $params) ?>
+ <?php endforeach; ?>
+<?php else: ?>
+ <?php echo $this->getButtonToAction('_create', array(), false) ?>
+<?php endif; ?>
+</ul>
diff --git a/data/generator/sfPropelAdmin/mailadmin/template/templates/_list_footer.php b/data/generator/sfPropelAdmin/mailadmin/template/templates/_list_footer.php
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/data/generator/sfPropelAdmin/mailadmin/template/templates/_list_footer.php
diff --git a/data/generator/sfPropelAdmin/mailadmin/template/templates/_list_header.php b/data/generator/sfPropelAdmin/mailadmin/template/templates/_list_header.php
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/data/generator/sfPropelAdmin/mailadmin/template/templates/_list_header.php
diff --git a/data/generator/sfPropelAdmin/mailadmin/template/templates/_list_messages.php b/data/generator/sfPropelAdmin/mailadmin/template/templates/_list_messages.php
new file mode 100644
index 0000000..c2eb7c7
--- /dev/null
+++ b/data/generator/sfPropelAdmin/mailadmin/template/templates/_list_messages.php
@@ -0,0 +1,13 @@
+[?php if ($sf_request->getError('delete')): ?]
+<div class="form-errors">
+ <h2>Could not delete the selected <?php echo sfInflector::humanize($this->getSingularName()) ?></h2>
+ <ul>
+ <li>[?php echo $sf_request->getError('delete') ?]</li>
+ </ul>
+</div>
+[?php endif; ?]
+[?php if ($sf_flash->has('notice')): ?]
+<div class="save-ok">
+<h2>[?php echo image_tag("information.gif","alt=[?]")?] [?php echo __($sf_flash->get('notice')) ?]</h2>
+</div>
+[?php endif; ?]
diff --git a/data/generator/sfPropelAdmin/mailadmin/template/templates/_list_td_actions.php b/data/generator/sfPropelAdmin/mailadmin/template/templates/_list_td_actions.php
new file mode 100644
index 0000000..fcaca78
--- /dev/null
+++ b/data/generator/sfPropelAdmin/mailadmin/template/templates/_list_td_actions.php
@@ -0,0 +1,5 @@
+<?php if ($this->getParameterValue('list.object_actions')): ?>
+<?php foreach ($this->getParameterValue('list.object_actions') as $actionName => $params): ?>
+ <?php echo $this->addCredentialCondition("<td><ul class=\"sf_admin_td_actions\">".$this->getLinkToAction($actionName, $params, true)."</ul></td>", $params) ?>
+<?php endforeach; ?>
+<?php endif; ?>
diff --git a/data/generator/sfPropelAdmin/mailadmin/template/templates/_list_td_stacked.php b/data/generator/sfPropelAdmin/mailadmin/template/templates/_list_td_stacked.php
new file mode 100644
index 0000000..0d9e274
--- /dev/null
+++ b/data/generator/sfPropelAdmin/mailadmin/template/templates/_list_td_stacked.php
@@ -0,0 +1,16 @@
+<td colspan="<?php echo count($this->getColumns('list.display')) ?>">
+<?php if ($this->getParameterValue('list.params')): ?>
+ <?php echo $this->getI18NString('list.params') ?>
+<?php else: ?>
+<?php $hides = $this->getParameterValue('list.hide', array()) ?>
+<?php foreach ($this->getColumns('list.display') as $column): ?>
+<?php if (in_array($column->getName(), $hides)) continue ?>
+ <?php if ($column->isLink()): ?>
+ [?php echo link_to(<?php echo $this->getColumnListTag($column) ?> ? <?php echo $this->getColumnListTag($column) ?> : __('-'), '<?php echo $this->getModuleName() ?>/edit?<?php echo $this->getPrimaryKeyUrlParams() ?>) ?]
+ <?php else: ?>
+ [?php echo <?php echo $this->getColumnListTag($column) ?> ?]
+ <?php endif; ?>
+ -
+<?php endforeach; ?>
+<?php endif; ?>
+</td> \ No newline at end of file
diff --git a/data/generator/sfPropelAdmin/mailadmin/template/templates/_list_td_tabular.php b/data/generator/sfPropelAdmin/mailadmin/template/templates/_list_td_tabular.php
new file mode 100644
index 0000000..e4e50bb
--- /dev/null
+++ b/data/generator/sfPropelAdmin/mailadmin/template/templates/_list_td_tabular.php
@@ -0,0 +1,30 @@
+<?php $hs = $this->getParameterValue('list.hide', array()) ?>
+<?php foreach ($this->getColumns('list.display') as $column): ?>
+<?php if (in_array($column->getName(), $hs)) continue ?>
+<?php $credentials = $this->getParameterValue('list.fields.'.$column->getName().'.credentials') ?>
+<?php if ($credentials): $credentials = str_replace("\n", ' ', var_export($credentials, true)) ?>
+ [?php if ($sf_user->hasCredential(<?php echo $credentials ?>)): ?]
+<?php endif; ?>
+ <?php
+ $user_params = $this->getParameterValue('list.fields.'.$column->getName().'.params');
+ $user_params = is_array($user_params) ? sfToolkit::stringToArray($user_params) : $user_params;
+ ?>
+ <?php if ($column->isLink()): ?>
+
+ <?php $editcredentials = $this->getParameterValue('list.object_actions.edit.credentials'); ?>
+ <?php if($editcredentials): $editcredentials = str_replace("\n", ' ', var_export($editcredentials, true)); ?>
+ [?php if ($sf_user->hasCredential(<?php echo $editcredentials ?>)): ?]
+ <?php endif; ?>
+ [?php echo tag('td', <?php echo var_export($user_params, true) ?>, true) ?][?php echo link_to(<?php echo $this->getColumnListTag($column) ?> ? <?php echo $this->getColumnListTag($column) ?> : __('-'), '<?php echo $this->getModuleName() ?>/edit?<?php echo $this->getPrimaryKeyUrlParams() ?>) ?]</td>
+<?php if ($editcredentials): ?>
+ [?php else: ?]
+ [?php echo tag('td', <?php echo var_export($user_params, true) ?>, true) ?][?php echo <?php echo $this->getColumnListTag($column) ?> ?]</td>
+ [?php endif; ?]
+<?php endif; ?>
+<?php else: ?>
+ [?php echo tag('td', <?php echo var_export($user_params, true) ?>, true) ?][?php echo <?php echo $this->getColumnListTag($column) ?> ?]</td>
+ <?php endif; ?>
+<?php if ($credentials): ?>
+ [?php endif; ?]
+<?php endif; ?>
+<?php endforeach; ?>
diff --git a/data/generator/sfPropelAdmin/mailadmin/template/templates/_list_th_stacked.php b/data/generator/sfPropelAdmin/mailadmin/template/templates/_list_th_stacked.php
new file mode 100644
index 0000000..305bdcf
--- /dev/null
+++ b/data/generator/sfPropelAdmin/mailadmin/template/templates/_list_th_stacked.php
@@ -0,0 +1 @@
+[?php include_partial('list_th_tabular') ?]
diff --git a/data/generator/sfPropelAdmin/mailadmin/template/templates/_list_th_tabular.php b/data/generator/sfPropelAdmin/mailadmin/template/templates/_list_th_tabular.php
new file mode 100644
index 0000000..4a48eca
--- /dev/null
+++ b/data/generator/sfPropelAdmin/mailadmin/template/templates/_list_th_tabular.php
@@ -0,0 +1,28 @@
+<?php $hides = $this->getParameterValue('list.hide', array()) ?>
+<?php foreach ($this->getColumns('list.display') as $column): ?>
+<?php if (in_array($column->getName(), $hides)) continue ?>
+<?php $credentials = $this->getParameterValue('list.fields.'.$column->getName().'.credentials') ?>
+<?php if ($credentials): $credentials = str_replace("\n", ' ', var_export($credentials, true)) ?>
+ [?php if ($sf_user->hasCredential(<?php echo $credentials ?>)): ?]
+<?php endif; ?>
+ <?php
+ $user_params = $this->getParameterValue('list.fields.'.$column->getName().'.params');
+ $user_params = is_array($user_params) ? $user_params : sfToolkit::stringToArray($user_params);
+ $user_params['id'] = "sf_admin_list_th_".$column->getName();
+ ?>
+ [?php echo tag('th', <?php echo var_export($user_params, true) ?>, true) ?]
+ <?php if ($column->isReal()): ?>
+ [?php if ($sf_user->getAttribute('sort', null, 'sf_admin/<?php echo $this->getSingularName() ?>/sort') == '<?php echo $column->getName() ?>'): ?]
+ [?php echo link_to(__('<?php echo str_replace("'", "\\'", $this->getParameterValue('list.fields.'.$column->getName().'.name')) ?>'), '<?php echo $this->getModuleName() ?>/list?sort=<?php echo $column->getName() ?>&type='.($sf_user->getAttribute('type', 'asc', 'sf_admin/<?php echo $this->getSingularName() ?>/sort') == 'asc' ? 'desc' : 'asc')) ?][?php $sorttype = $sf_user->getAttribute('type', 'asc','sf_admin/<?php echo$this->getSingularName() ?>/sort'); if($sorttype=='images') $sorttype = 'desc'; ?][?php echo image_tag('sort-'.$sorttype.'.gif', array('alt' => __($sorttype), 'border' => 0)) ?]
+ [?php else: ?]
+ [?php echo link_to(__('<?php echo str_replace("'", "\\'", $this->getParameterValue('list.fields.'.$column->getName().'.name')) ?>'), '<?php echo $this->getModuleName() ?>/list?sort=<?php echo $column->getName() ?>&type=asc') ?]
+ [?php endif; ?]
+ <?php else: ?>
+ [?php echo __('<?php echo str_replace("'", "\\'", $this->getParameterValue('list.fields.'.$column->getName().'.name')) ?>') ?]
+ <?php endif; ?>
+ <?php echo $this->getHelpAsIcon($column, 'list') ?>
+ </th>
+<?php if ($credentials): ?>
+ [?php endif; ?]
+<?php endif; ?>
+<?php endforeach; ?>
diff --git a/data/generator/sfPropelAdmin/mailadmin/template/templates/_pager.php b/data/generator/sfPropelAdmin/mailadmin/template/templates/_pager.php
new file mode 100644
index 0000000..818d925
--- /dev/null
+++ b/data/generator/sfPropelAdmin/mailadmin/template/templates/_pager.php
@@ -0,0 +1,13 @@
+[?php if($pager->getNbResults() > 25 || $pager->haveToPaginate()): ?]
+<div class="tablenavigation">
+<ul>
+[?php if($pager->haveToPaginate()): ?]
+<li><span class="pageinfo">Page <span class="pageindex">[?php echo $pager->getPage() ?]</span> of <span class="pageindex">[?php echo $pager->getLastPage() ?]</span></span></li>
+<li>[?php if($pager->getPage()!=$pager->getFirstPage()): ?][?php echo link_to(image_tag("first.gif", array('border' => 0, 'alt' => __('First'), 'title' => __('First'))), '<?php echo $this->getModuleName() ?>/list?page='.$pager->getFirstPage()) ?]</a>
+[?php echo link_to(image_tag("previous.gif", array('border' => 0, 'alt' => __('Previous'), 'title' => __('Previous'))), '<?php echo $this->getModuleName() ?>/list?page='.$pager->getPreviousPage()) ?]</a>[?php endif; ?]
+[?php if($pager->getPage()!=$pager->getLastPage()): ?][?php echo link_to(image_tag("next.gif", array('border' => 0, 'alt' => __('Next'), 'title' => __('Next'))), '<?php echo $this->getModuleName() ?>/list?page='.$pager->getNextPage()) ?]
+[?php echo link_to(image_tag("last.gif", array('border' => 0, 'alt' => __('Last'), 'title' => __('Last'))), '<?php echo $this->getModuleName() ?>/list?page='.$pager->getLastPage()) ?][?php endif; ?]</li>
+[?php endif; ?]
+</ul>
+</div>
+[?php endif; ?]
diff --git a/data/generator/sfPropelAdmin/mailadmin/template/templates/editSuccess.php b/data/generator/sfPropelAdmin/mailadmin/template/templates/editSuccess.php
new file mode 100644
index 0000000..2727a2c
--- /dev/null
+++ b/data/generator/sfPropelAdmin/mailadmin/template/templates/editSuccess.php
@@ -0,0 +1,20 @@
+[?php use_helper('Object', 'Validation', 'ObjectAdmin', 'I18N', 'Date') ?]
+
+<div id="context">
+
+<h1>[?php echo ($sf_context->getActionName()=='create' ? <?php echo $this->getI18NString('create.title', 'create '.$this->getModuleName(), false) ?>: <?php echo $this->getI18NString('edit.title', 'edit '.$this->getModuleName(), false) ?>) ?]</h1>
+
+<div id="sf_admin_header">
+[?php include_partial('<?php echo $this->getModuleName() ?>/edit_header', array('<?php echo $this->getSingularName() ?>' => $<?php echo $this->getSingularName() ?>)) ?]
+</div>
+
+<div id="sf_admin_content">
+[?php include_partial('<?php echo $this->getModuleName() ?>/edit_messages', array('<?php echo $this->getSingularName() ?>' => $<?php echo $this->getSingularName() ?>, 'labels' => $labels)) ?]
+[?php include_partial('<?php echo $this->getModuleName() ?>/edit_form', array('<?php echo $this->getSingularName() ?>' => $<?php echo $this->getSingularName() ?>, 'labels' => $labels)) ?]
+</div>
+
+<div id="sf_admin_footer">
+[?php include_partial('<?php echo $this->getModuleName() ?>/edit_footer', array('<?php echo $this->getSingularName() ?>' => $<?php echo $this->getSingularName() ?>)) ?]
+</div>
+
+</div>
diff --git a/data/generator/sfPropelAdmin/mailadmin/template/templates/listSuccess.php b/data/generator/sfPropelAdmin/mailadmin/template/templates/listSuccess.php
new file mode 100644
index 0000000..c92aaf4
--- /dev/null
+++ b/data/generator/sfPropelAdmin/mailadmin/template/templates/listSuccess.php
@@ -0,0 +1,38 @@
+[?php use_helper('I18N', 'Date', 'Tag', 'Javascript') ?]
+
+<div id="context">
+
+<h1><?php echo $this->getI18NString('list.title', $this->getModuleName().' list') ?></h1>
+
+<div id="sf_admin_header">
+[?php include_partial('<?php echo $this->getModuleName() ?>/list_header', array('pager' => $pager)) ?]
+[?php include_partial('<?php echo $this->getModuleName() ?>/list_messages', array('pager' => $pager)) ?]
+</div>
+
+<div id="sf_admin_content">
+<span class="summary"><b>[?php echo __('Results') ?]:</b> [?php echo $pager->getNbResults() ?]</span><span class="summary"><b>Entries per Page:</b> [?php echo select_tag("resultsperpage", options_for_select(<?php $opt = $this->getParameterValue('list.max_per_page_options', array(10,25,50,100)); var_export(@array_combine($opt,$opt)); ?>, $pager->getMaxPerPage()), array("onchange" => "document.location.href = '".url_for('<?php echo $this->getModuleName() ?>/list')."?max_per_page='+this.value")) ?]</span><?php if ($this->getParameterValue('list.filters')): ?><span class="summary toggle">[?php echo link_to_function(__('Toggle Filter Settings'), visual_effect('toggle_blind', 'sf_admin_filters' )) ?]</span>
+<?php endif; ?>
+
+<?php if ($this->getParameterValue('list.filters')): ?>
+<div id="sf_admin_bar">
+[?php include_partial('filters', array('filters' => $filters)) ?]
+</div>
+<?php endif; ?>
+
+[?php include_partial('pager', array('pager' => $pager, 'location' => 'top')) ?]
+<hr size="1" />
+[?php if (!$pager->getNbResults()): ?]
+[?php echo __('no result') ?]
+[?php else: ?]
+[?php include_partial('<?php echo $this->getModuleName() ?>/list', array('pager' => $pager)) ?]
+[?php endif; ?]
+<hr size="1" />
+[?php include_partial('pager', array('pager' => $pager, 'location' => 'bottom')) ?]
+[?php include_partial('list_actions') ?]
+</div>
+
+<div id="sf_admin_footer">
+[?php include_partial('<?php echo $this->getModuleName() ?>/list_footer', array('pager' => $pager)) ?]
+</div>
+
+</div>
diff --git a/data/sql/lib.model.schema.sql b/data/sql/lib.model.schema.sql
new file mode 100644
index 0000000..ffbe542
--- /dev/null
+++ b/data/sql/lib.model.schema.sql
@@ -0,0 +1,181 @@
+
+# This is a fix for InnoDB in MySQL >= 4.1.x
+# It "suspends judgement" for fkey relationships until are tables are set.
+SET FOREIGN_KEY_CHECKS = 0;
+
+#-----------------------------------------------------------------------------
+#-- role
+#-----------------------------------------------------------------------------
+
+DROP TABLE IF EXISTS `role`;
+
+
+CREATE TABLE `role`
+(
+ `id` INTEGER NOT NULL AUTO_INCREMENT,
+ `name` VARCHAR(255),
+ `credentials` VARCHAR(255),
+ PRIMARY KEY (`id`)
+)Type=MyISAM;
+
+#-----------------------------------------------------------------------------
+#-- user
+#-----------------------------------------------------------------------------
+
+DROP TABLE IF EXISTS `user`;
+
+
+CREATE TABLE `user`
+(
+ `id` INTEGER NOT NULL AUTO_INCREMENT,
+ `parent_user_id` INTEGER default -1,
+ `nickname` VARCHAR(50),
+ `first_name` VARCHAR(100),
+ `last_name` VARCHAR(100),
+ `email` VARCHAR(255),
+ `sha1_password` VARCHAR(40),
+ `salt` VARCHAR(32),
+ `role_id` INTEGER,
+ `last_login` DATETIME,
+ `created_at` DATETIME,
+ PRIMARY KEY (`id`),
+ INDEX `user_FI_1` (`parent_user_id`),
+ CONSTRAINT `user_FK_1`
+ FOREIGN KEY (`parent_user_id`)
+ REFERENCES `user` (`id`)
+ ON DELETE SET NULL,
+ INDEX `user_FI_2` (`role_id`),
+ CONSTRAINT `user_FK_2`
+ FOREIGN KEY (`role_id`)
+ REFERENCES `role` (`id`)
+)Type=MyISAM;
+
+#-----------------------------------------------------------------------------
+#-- domain_permission
+#-----------------------------------------------------------------------------
+
+DROP TABLE IF EXISTS `domain_permission`;
+
+
+CREATE TABLE `domain_permission`
+(
+ `user_id` INTEGER,
+ `domain_id` INTEGER,
+ `id` INTEGER NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`id`),
+ INDEX `domain_permission_FI_1` (`user_id`),
+ CONSTRAINT `domain_permission_FK_1`
+ FOREIGN KEY (`user_id`)
+ REFERENCES `user` (`id`)
+ ON DELETE CASCADE,
+ INDEX `domain_permission_FI_2` (`domain_id`),
+ CONSTRAINT `domain_permission_FK_2`
+ FOREIGN KEY (`domain_id`)
+ REFERENCES `domain` (`id`)
+ ON DELETE CASCADE
+)Type=MyISAM;
+
+#-----------------------------------------------------------------------------
+#-- domain
+#-----------------------------------------------------------------------------
+
+DROP TABLE IF EXISTS `domain`;
+
+
+CREATE TABLE `domain`
+(
+ `id` INTEGER NOT NULL AUTO_INCREMENT,
+ `name` VARCHAR(255),
+ `creator_id` INTEGER,
+ `mailbox_prefix` VARCHAR(255),
+ `max_mailbox_count` INTEGER,
+ `quota` INTEGER,
+ `default_mailbox_quota` INTEGER,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `i2` (`name`),
+ INDEX `domain_FI_1` (`creator_id`),
+ CONSTRAINT `domain_FK_1`
+ FOREIGN KEY (`creator_id`)
+ REFERENCES `user` (`id`)
+ ON DELETE SET NULL
+)Type=MyISAM;
+
+#-----------------------------------------------------------------------------
+#-- mailbox
+#-----------------------------------------------------------------------------
+
+DROP TABLE IF EXISTS `mailbox`;
+
+
+CREATE TABLE `mailbox`
+(
+ `id` INTEGER NOT NULL AUTO_INCREMENT,
+ `domain_id` INTEGER,
+ `name` VARCHAR(30),
+ `password` VARCHAR(40),
+ `max_quota` INTEGER,
+ `max_address_count` INTEGER,
+ `last_login` DATETIME,
+ `active` INTEGER default 1,
+ PRIMARY KEY (`id`),
+ INDEX `mailbox_FI_1` (`domain_id`),
+ CONSTRAINT `mailbox_FK_1`
+ FOREIGN KEY (`domain_id`)
+ REFERENCES `domain` (`id`)
+ ON DELETE SET NULL
+)Type=MyISAM;
+
+#-----------------------------------------------------------------------------
+#-- address
+#-----------------------------------------------------------------------------
+
+DROP TABLE IF EXISTS `address`;
+
+
+CREATE TABLE `address`
+(
+ `id` INTEGER NOT NULL AUTO_INCREMENT,
+ `mailbox_id` INTEGER,
+ `localpart` VARCHAR(255),
+ `domain_id` INTEGER,
+ `alias` VARCHAR(255),
+ `destination` TEXT,
+ `active` INTEGER default 1,
+ `save_in_mailbox` INTEGER default 1,
+ PRIMARY KEY (`id`),
+ INDEX `address_FI_1` (`mailbox_id`),
+ CONSTRAINT `address_FK_1`
+ FOREIGN KEY (`mailbox_id`)
+ REFERENCES `mailbox` (`id`)
+ ON DELETE CASCADE,
+ INDEX `address_FI_2` (`domain_id`),
+ CONSTRAINT `address_FK_2`
+ FOREIGN KEY (`domain_id`)
+ REFERENCES `domain` (`id`)
+)Type=MyISAM;
+
+#-----------------------------------------------------------------------------
+#-- log
+#-----------------------------------------------------------------------------
+
+DROP TABLE IF EXISTS `log`;
+
+
+CREATE TABLE `log`
+(
+ `id` INTEGER NOT NULL AUTO_INCREMENT,
+ `user_id` INTEGER default null,
+ `created_at` DATETIME,
+ `message` TEXT,
+ `host` VARCHAR(255),
+ `priority` INTEGER,
+ PRIMARY KEY (`id`),
+ INDEX `log_FI_1` (`user_id`),
+ CONSTRAINT `log_FK_1`
+ FOREIGN KEY (`user_id`)
+ REFERENCES `user` (`id`)
+ ON DELETE SET NULL
+)Type=MyISAM;
+
+# This restores the fkey checks, after having unset them earlier
+SET FOREIGN_KEY_CHECKS = 1;
diff --git a/data/sql/sqldb.map b/data/sql/sqldb.map
new file mode 100644
index 0000000..83d47c5
--- /dev/null
+++ b/data/sql/sqldb.map
@@ -0,0 +1,2 @@
+# Sqlfile -> Database map
+lib.model.schema.sql=propel
diff --git a/lib/helper/FilesHelper.php b/lib/helper/FilesHelper.php
new file mode 100644
index 0000000..ff290d6
--- /dev/null
+++ b/lib/helper/FilesHelper.php
@@ -0,0 +1,27 @@
+<?php
+
+function format_bytes($val, $digits = 3, $mode = "SI", $bB = "B")
+{
+ $si = array("", "k", "M", "G", "T", "P", "E", "Z", "Y");
+ $iec = array("", "Ki", "Mi", "Gi", "Ti", "Pi", "Ei", "Zi", "Yi");
+
+ switch(strtoupper($mode))
+ {
+ case "SI" : $factor = 1000; $symbols = $si; break;
+ case "IEC" : $factor = 1024; $symbols = $iec; break;
+ default : $factor = 1000; $symbols = $si; break;
+ }
+ switch($bB)
+ {
+ case "b" : $val *= 8; break;
+ default : $bB = "B"; break;
+ }
+ for($i=0;$i<count($symbols)-1 && $val>=$factor;$i++)
+ $val /= $factor;
+ $p = strpos($val, ".");
+ if($p !== false && $p > $digits) $val = round($val);
+ elseif($p !== false) $val = round($val, $digits-$p);
+ return round($val, $digits) . " " . $symbols[$i] . $bB;
+}
+
+?>
diff --git a/lib/helper/SortHeaderHelper.php b/lib/helper/SortHeaderHelper.php
new file mode 100644
index 0000000..ef16eb1
--- /dev/null
+++ b/lib/helper/SortHeaderHelper.php
@@ -0,0 +1,21 @@
+<?php
+
+use_helper("Asset");
+
+function sortheader_link_to($caption, $targetURI, $column, $headers)
+{
+ $uri = $targetURI."?sort=".$column;
+ if($headers[$column])
+ $uri .= "&type=".($headers[$column]=="asc" ? "desc": "asc");
+ return link_to($caption, $uri);
+}
+
+function sortheader_type_if($column, $headers, $asc, $desc)
+{
+ if($headers[$column])
+ {
+ return ($headers[$column]=="asc" ? $asc: $desc);
+ }
+}
+
+?>
diff --git a/lib/model/Address.php b/lib/model/Address.php
new file mode 100644
index 0000000..b6b9cf8
--- /dev/null
+++ b/lib/model/Address.php
@@ -0,0 +1,124 @@
+<?php
+
+/**
+ * Subclass for representing a row from the 'address' table.
+ *
+ *
+ *
+ * @package lib.model
+ */
+class Address extends BaseAddress
+{
+ protected function splitEmail($v)
+ {
+ return explode("@", $v);
+ }
+
+ public function setLocalpart($v)
+ {
+ // sync alias
+ $alias = $this->splitEmail($this->getAlias());
+ if(is_array($alias))
+ {
+ if($alias[0]!=$v)
+ {
+ parent::setAlias($v."@".$alias[1]);
+ }
+ }
+
+ return parent::setLocalpart($v);
+ }
+
+ public function setDomainId($v)
+ {
+ // sync alias
+ $alias = $this->splitEmail($this->getAlias());
+ if(is_array($alias))
+ {
+ $domain = DomainPeer::retrieveByPk($v);
+ if($domain)
+ {
+ if($alias[(count($alias)>1?1:0)] != $domain)
+ {
+ parent::setAlias((count($alias)>1?$alias[0]:"")."@".$domain->getName());
+ }
+ }
+ }
+
+ return parent::setDomainId($v);
+ }
+
+ public function setAlias($v)
+ {
+ $alias = $this->splitEmail($v);
+
+ // sync localpart
+ parent::setLocalpart($alias[0]);
+
+ // sync domain_id
+ $c = new Criteria();
+ $c->add(DomainPeer::NAME, $alias[1]);
+ $domain = DomainPeer::doSelectOne($c);
+
+ if($domain)
+ parent::setDomainId($domain->getId());
+ else
+ parent::setDomainId(null);
+
+ return parent::setAlias($v);
+ }
+
+ public function setDestination($dest)
+ {
+ // make sure we are a comma seperated string
+ $destarray = self::getDestinationAsArray($dest);
+
+ // if a mailbox is set, make sure it is first in the list
+ if($this->getSaveInMailbox())
+ {
+ $mailbox = $this->getMailbox();
+ if($mailbox)
+ {
+ if(array_search($mailbox->getName(), $destarray) == false)
+ {
+ $destarray = array_merge(array($this->getMailbox()->getName()), $destarray);
+ }
+ }
+
+ }
+
+ parent::setDestination(implode(",", $destarray));
+ }
+
+ public function getDestination($delimiter = '\n')
+ {
+ // if a mailbox is set, strip it out of the list
+ $destarray = self::getDestinationAsArray(parent::getDestination());
+ $destarray2 = array();
+ if($this->getSaveInMailbox())
+ {
+ foreach($destarray as $dest)
+ {
+ if($dest != $this->getMailbox()->getName())
+ $destarray2[] = $dest;
+ }
+ }
+ else $destarray2 = $destarray;
+ return implode("\n", $destarray2);
+ }
+
+ public static function getDestinationAsArray($d)
+ {
+ return preg_split("/[\s\n,;]+/", $d, -1, PREG_SPLIT_NO_EMPTY);
+ }
+
+ public function isCatchAll()
+ {
+ return ($this->getLocalpart()=="");
+ }
+
+ public function __toString()
+ {
+ return $this->getAlias();
+ }
+}
diff --git a/lib/model/AddressPeer.php b/lib/model/AddressPeer.php
new file mode 100644
index 0000000..62ba476
--- /dev/null
+++ b/lib/model/AddressPeer.php
@@ -0,0 +1,30 @@
+<?php
+
+/**
+ * Subclass for performing query and update operations on the 'address' table.
+ *
+ *
+ *
+ * @package lib.model
+ */
+class AddressPeer extends BaseAddressPeer
+{
+ // only return results according to domain permissions
+ public static function doCount(Criteria $criteria, $distinct = false, $con = null)
+ {
+ DomainPermissionPeer::addDomainPermissionCriteria($criteria, AddressPeer::DOMAIN_ID);
+ return parent::doCount($criteria, $distinct, $con);
+ }
+
+ public static function doSelect(Criteria $criteria, $con = null)
+ {
+ DomainPermissionPeer::addDomainPermissionCriteria($criteria, AddressPeer::DOMAIN_ID);
+ return parent::doSelect($criteria, $con);
+ }
+
+ public static function doSelectJoinAll(Criteria $criteria, $con = null)
+ {
+ DomainPermissionPeer::addDomainPermissionCriteria($criteria, AddressPeer::DOMAIN_ID);
+ return parent::doSelectJoinAll($criteria, $con);
+ }
+}
diff --git a/lib/model/Domain.php b/lib/model/Domain.php
new file mode 100644
index 0000000..0d34108
--- /dev/null
+++ b/lib/model/Domain.php
@@ -0,0 +1,49 @@
+<?php
+
+/**
+ * Subclass for representing a row from the 'domain' table.
+ *
+ *
+ *
+ * @package lib.model
+ */
+class Domain extends BaseDomain
+{
+ public function __construct()
+ {
+ // set defaults
+ $this->setMaxMailboxCount(sfConfig::get('app_domain_max_mailbox_count'));
+ $this->setQuota(sfConfig::get('app_domain_quota'));
+ $this->setDefaultMailboxQuota(sfConfig::get('app_domain_default_mailbox_quota'));
+ }
+
+ public function getMailboxCount()
+ {
+ return $this->countMailboxs();
+ }
+
+ public function getUsedQuota()
+ {
+ $used = 0;
+
+ $c = new Criteria();
+ $c->add(MailboxPeer::DOMAIN_ID, $this->getId());
+ $c->addSelectColumn('SUM('.MailboxPeer::MAX_QUOTA.')');
+ $rs = MailboxPeer::doSelectRS($c);
+ if($rs->next())
+ return $rs->getInt(1);
+
+ /*
+ foreach($this->getMailboxs() as $mbox)
+ {
+ $used += $mbox->getQuota();
+ }
+ */
+ return $used;
+ }
+
+ public function __toString()
+ {
+ return $this->getName();
+ }
+}
diff --git a/lib/model/DomainPeer.php b/lib/model/DomainPeer.php
new file mode 100644
index 0000000..f52c6ca
--- /dev/null
+++ b/lib/model/DomainPeer.php
@@ -0,0 +1,37 @@
+<?php
+
+/**
+ * Subclass for performing query and update operations on the 'domain' table.
+ *
+ *
+ *
+ * @package lib.model
+ */
+class DomainPeer extends BaseDomainPeer
+{
+ // only return results according to domain permissions
+ public static function doCount(Criteria $criteria, $distinct = false, $con = null)
+ {
+ DomainPermissionPeer::addDomainPermissionCriteria($criteria, DomainPeer::ID);
+ return parent::doCount($criteria, $distinct, $con);
+ }
+
+ public static function doSelect(Criteria $criteria, $con = null)
+ {
+ DomainPermissionPeer::addDomainPermissionCriteria($criteria, DomainPeer::ID);
+ return parent::doSelect($criteria, $con);
+ }
+
+ public static function doSelectJoinUser(Criteria $criteria, $con = null)
+ {
+ DomainPermissionPeer::addDomainPermissionCriteria($criteria, DomainPeer::ID);
+ return parent::doSelectJoinUser($criteria, $con);
+ }
+
+ public static function getDomainByName($name)
+ {
+ $c = new Criteria();
+ $c->add(self::NAME, $name);
+ return self::doSelect($c);
+ }
+}
diff --git a/lib/model/DomainPermission.php b/lib/model/DomainPermission.php
new file mode 100644
index 0000000..3a4c40b
--- /dev/null
+++ b/lib/model/DomainPermission.php
@@ -0,0 +1,12 @@
+<?php
+
+/**
+ * Subclass for representing a row from the 'domain_permission' table.
+ *
+ *
+ *
+ * @package lib.model
+ */
+class DomainPermission extends BaseDomainPermission
+{
+}
diff --git a/lib/model/DomainPermissionPeer.php b/lib/model/DomainPermissionPeer.php
new file mode 100644
index 0000000..c79e0e3
--- /dev/null
+++ b/lib/model/DomainPermissionPeer.php
@@ -0,0 +1,22 @@
+<?php
+
+/**
+ * Subclass for performing query and update operations on the 'domain_permission' table.
+ *
+ *
+ *
+ * @package lib.model
+ */
+class DomainPermissionPeer extends BaseDomainPermissionPeer
+{
+ // inject domain permissions criteria
+ public static function addDomainPermissionCriteria(Criteria $criteria, $domain_id = DomainPeer::DOMAIN_ID)
+ {
+ if(sfContext::getInstance()->getUser()->hasCredential("superadmin"))
+ return;
+
+ // set domain permissions
+ $criteria->addJoin(DomainPermissionPeer::DOMAIN_ID, $domain_id);
+ $criteria->add(DomainPermissionPeer::USER_ID, sfContext::getInstance()->getUser()->getId());
+ }
+}
diff --git a/lib/model/LogEntry.php b/lib/model/LogEntry.php
new file mode 100644
index 0000000..5b7fbb5
--- /dev/null
+++ b/lib/model/LogEntry.php
@@ -0,0 +1,38 @@
+<?php
+
+/**
+ * Subclass for representing a row from the 'log' table.
+ *
+ *
+ *
+ * @package lib.model
+ */
+class LogEntry extends BaseLogEntry
+{
+ const PRIO_DEBUG = 0;
+ const PRIO_INFO = 1;
+ const PRIO_NOTICE = 2;
+ const PRIO_WARNING = 3;
+ const PRIO_ERROR = 4;
+ const PRIO_CRITICAL = 5;
+ const PRIO_ALERT = 6;
+ const PRIO_EMERGENCY = 7;
+
+ public function getLevel()
+ {
+ // emerg, alert, crit, err, warning, notice, info, and debug
+ switch($this->getPriority())
+ {
+ case 0: return "Debug";
+ case 1: return "Info";
+ case 2: return "Notice";
+ case 3: return "Warning";
+ case 4: return "Error";
+ case 5: return "Critical";
+ case 6: return "Alert";
+ case 7: return "Emergency";
+ default:
+ return "Unknown";
+ }
+ }
+}
diff --git a/lib/model/LogEntryPeer.php b/lib/model/LogEntryPeer.php
new file mode 100644
index 0000000..53501da
--- /dev/null
+++ b/lib/model/LogEntryPeer.php
@@ -0,0 +1,23 @@
+<?php
+
+/**
+ * Subclass for performing query and update operations on the 'log' table.
+ *
+ *
+ *
+ * @package lib.model
+ */
+class LogEntryPeer extends BaseLogEntryPeer
+{
+ public static function log($message, $priority = LogEntry::PRIO_DEBUG)
+ {
+ $e = new LogEntry();
+ $e->setMessage($message);
+ $e->setPriority($priority);
+ $e->setHost(gethostbyaddr($_SERVER["REMOTE_ADDR"]));
+ $user = sfContext::getInstance()->getUser();
+ if($user)
+ $e->setUserId($user->getId());
+ $e->save();
+ }
+}
diff --git a/lib/model/Mailbox.php b/lib/model/Mailbox.php
new file mode 100644
index 0000000..c29e1db
--- /dev/null
+++ b/lib/model/Mailbox.php
@@ -0,0 +1,187 @@
+<?php
+
+/**
+ * Subclass for representing a row from the 'mailbox' table.
+ *
+ *
+ *
+ * @package lib.model
+ */
+class Mailbox extends BaseMailbox
+{
+ protected $imap = null;
+
+ public function __construct()
+ {
+ // set defaults
+ $this->setMaxQuota(sfConfig::get('app_domain_default_mailbox_quota'));
+ $this->setMaxAddressCount(sfConfig::get('app_mailbox_max_address_count'));
+ }
+
+ public function getImapName()
+ {
+ return "user.".$this->getName();
+ }
+
+ public function getExistsOnImapServer()
+ {
+ $this->requireIMAPAdminConnection();
+ $exists = $this->imap->getlist($this->getImapName(), '%');
+ if(is_array($exists) && (count($exists)!=0))
+ {
+ return true;
+ }
+ return false;
+ }
+
+ protected function requireIMAPAdminConnection()
+ {
+ if(!$this->imap)
+ $this->imap = IMAPManager::getAdminConnection();
+ }
+
+ protected $quota = null;
+ protected function updateIMAPQuota()
+ {
+ $this->requireIMAPAdminConnection();
+ $quota = $this->imap->getquota("user.".$this->getName());
+ if($quota)
+ $this->quota = $quota;
+ }
+
+ public function getQuota()
+ {
+ if($this->quota == null)
+ $this->updateIMAPQuota();
+
+ return $this->quota;
+ }
+
+ public function save($con = null)
+ {
+ // create or update resources on IMAP server
+ if($this->isNew())
+ {
+ $this->requireIMAPAdminConnection();
+
+ // mailbox
+ $this->imap->create($this->getImapName());
+
+ // acl
+ $this->imap->setacl($this->getImapName(), IMAPManager::getAdminUsername(), $this->imap->getAvailableACL());
+
+ // quota
+ $this->imap->setquota($this->getImapName(), $this->getMaxQuota());
+
+ // default folders
+
+ }
+ else // update
+ {
+ // mailbox name changed?
+ if($this->isColumnModified(MailboxPeer::NAME))
+ {
+ $this->requireIMAPAdminConnection();
+
+ $oldmailbox = MailboxPeer::retrieveByPk($this->getId());
+ if($oldmailbox->getName() != $this->getName())
+ {
+ // requires "allowusermoves: 1" in /etc/imapd.conf
+ // mailbox
+ $this->imap->rename($oldmailbox->getImapName(), $this->getImapName());
+ }
+ }
+
+ // quota changed?
+ if($this->isColumnModified(MailboxPeer::MAX_QUOTA))
+ {
+ $this->requireIMAPAdminConnection();
+
+ $this->imap->setquota($this->getImapName(), $this->getMaxQuota());
+ }
+ }
+
+ return parent::save($con);
+ }
+
+ public function delete($con = null)
+ {
+ // remove resources on IMAP server
+ if(!$this->isNew())
+ {
+ $this->requireIMAPAdminConnection();
+
+ // grant all rights to admin to be able to delete mailbox
+ $this->imap->setacl($this->getImapName(), IMAPManager::getAdminUsername(), $this->imap->getAvailableACL());
+
+ // mailbox
+ $this->imap->delete($this->getImapName());
+ }
+
+ return parent::delete($con);
+ }
+
+ // TODO: extract password logic into own library
+ public function isPasswordEqual($password)
+ {
+ // check crypt type
+ $server_settings = sfConfig::get('app_server_default');
+ $crypt_type = $server_settings['pam']['crypt'];
+
+ switch($crypt_type)
+ {
+ case 0: // plain
+ return ($password == $this->getPassword());
+ case 1: // crypt
+ return (crypt($password, substr($this->getPassword(), 0, 2)) == $this->getPassword());
+ case 2: // md5
+ return (md5($password) == $this->getPassword());
+ case 3: // sha1
+ return (sha1($password) == $this->getPassword());
+ break;
+ }
+
+ return false;
+ }
+
+ public function setPassword($password)
+ {
+ if($password=='')
+ return false;
+ // check crypt type
+ $server_settings = sfConfig::get('app_server_default');
+ $crypt_type = $server_settings['pam']['crypt'];
+
+ switch($crypt_type)
+ {
+ case 0: // plain
+ break;
+ case 1: // crypt
+ $password = crypt($password, substr($password, 0, 8));
+ break;
+ case 2: // md5
+ $password = md5($password);
+ break;
+ case 3: // sha1
+ $password = sha1($password);
+ break;
+ }
+
+ return parent::setPassword($password);
+ }
+
+ public function setNewPassword($password)
+ {
+ return $this->setPassword($password);
+ }
+
+ public function getAddressCount()
+ {
+ return $this->countAddresss();
+ }
+
+ public function __toString()
+ {
+ return $this->getName();
+ }
+}
diff --git a/lib/model/MailboxPeer.php b/lib/model/MailboxPeer.php
new file mode 100644
index 0000000..46170c3
--- /dev/null
+++ b/lib/model/MailboxPeer.php
@@ -0,0 +1,30 @@
+<?php
+
+/**
+ * Subclass for performing query and update operations on the 'mailbox' table.
+ *
+ *
+ *
+ * @package lib.model
+ */
+class MailboxPeer extends BaseMailboxPeer
+{
+ // only return results according to domain permissions
+ public static function doCount(Criteria $criteria, $distinct = false, $con = null)
+ {
+ DomainPermissionPeer::addDomainPermissionCriteria($criteria, MailboxPeer::DOMAIN_ID);
+ return parent::doCount($criteria, $distinct, $con);
+ }
+
+ public static function doSelect(Criteria $criteria, $con = null)
+ {
+ DomainPermissionPeer::addDomainPermissionCriteria($criteria, MailboxPeer::DOMAIN_ID);
+ return parent::doSelect($criteria, $con);
+ }
+
+ public static function doSelectJoinDomain(Criteria $criteria, $con = null)
+ {
+ DomainPermissionPeer::addDomainPermissionCriteria($criteria, MailboxPeer::DOMAIN_ID);
+ return parent::doSelectJoinDomain($criteria, $con);
+ }
+}
diff --git a/lib/model/Role.php b/lib/model/Role.php
new file mode 100644
index 0000000..c63fa75
--- /dev/null
+++ b/lib/model/Role.php
@@ -0,0 +1,20 @@
+<?php
+
+/**
+ * Subclass for representing a row from the 'role' table.
+ *
+ *
+ *
+ * @package lib.model
+ */
+class Role extends BaseRole
+{
+ const SUPERADMIN = 1;
+ const DOMAINMASTER = 2;
+ const MAILBOXMASTER = 3;
+
+ public function __toString()
+ {
+ return $this->getName();
+ }
+}
diff --git a/lib/model/RolePeer.php b/lib/model/RolePeer.php
new file mode 100644
index 0000000..db848d5
--- /dev/null
+++ b/lib/model/RolePeer.php
@@ -0,0 +1,12 @@
+<?php
+
+/**
+ * Subclass for performing query and update operations on the 'role' table.
+ *
+ *
+ *
+ * @package lib.model
+ */
+class RolePeer extends BaseRolePeer
+{
+}
diff --git a/lib/model/User.php b/lib/model/User.php
new file mode 100644
index 0000000..693aeb7
--- /dev/null
+++ b/lib/model/User.php
@@ -0,0 +1,36 @@
+<?php
+
+/**
+ * Subclass for representing a row from the 'user' table.
+ *
+ *
+ *
+ * @package lib.model
+ */
+class User extends BaseUser
+{
+ public function setPassword($password)
+ {
+ if($password=='')
+ return false;
+ $salt = md5(rand(100000, 999999).$this->getNickname().$this->getFirstName());
+ $this->setSalt($salt);
+ $this->setSha1Password(sha1($salt.$password));
+ }
+
+ public function setPassword2($password)
+ {
+ if($password!='')
+ $this->setPassword($password);
+ }
+
+ public function getFullName()
+ {
+ return $this->getFirstName()." ".$this->getLastName();
+ }
+
+ public function __toString()
+ {
+ return $this->getNickname();
+ }
+}
diff --git a/lib/model/UserPeer.php b/lib/model/UserPeer.php
new file mode 100644
index 0000000..72c3ef1
--- /dev/null
+++ b/lib/model/UserPeer.php
@@ -0,0 +1,12 @@
+<?php
+
+/**
+ * Subclass for performing query and update operations on the 'user' table.
+ *
+ *
+ *
+ * @package lib.model
+ */
+class UserPeer extends BaseUserPeer
+{
+}
diff --git a/lib/model/map/AddressMapBuilder.php b/lib/model/map/AddressMapBuilder.php
new file mode 100644
index 0000000..8993460
--- /dev/null
+++ b/lib/model/map/AddressMapBuilder.php
@@ -0,0 +1,52 @@
+<?php
+
+
+
+class AddressMapBuilder {
+
+
+ const CLASS_NAME = 'lib.model.map.AddressMapBuilder';
+
+
+ private $dbMap;
+
+
+ public function isBuilt()
+ {
+ return ($this->dbMap !== null);
+ }
+
+
+ public function getDatabaseMap()
+ {
+ return $this->dbMap;
+ }
+
+
+ public function doBuild()
+ {
+ $this->dbMap = Propel::getDatabaseMap('propel');
+
+ $tMap = $this->dbMap->addTable('address');
+ $tMap->setPhpName('Address');
+
+ $tMap->setUseIdGenerator(true);
+
+ $tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null);
+
+ $tMap->addForeignKey('MAILBOX_ID', 'MailboxId', 'int', CreoleTypes::INTEGER, 'mailbox', 'ID', false, null);
+
+ $tMap->addColumn('LOCALPART', 'Localpart', 'string', CreoleTypes::VARCHAR, false, 255);
+
+ $tMap->addForeignKey('DOMAIN_ID', 'DomainId', 'int', CreoleTypes::INTEGER, 'domain', 'ID', false, null);
+
+ $tMap->addColumn('ALIAS', 'Alias', 'string', CreoleTypes::VARCHAR, false, 255);
+
+ $tMap->addColumn('DESTINATION', 'Destination', 'string', CreoleTypes::LONGVARCHAR, false, null);
+
+ $tMap->addColumn('ACTIVE', 'Active', 'boolean', CreoleTypes::BOOLEAN, false, null);
+
+ $tMap->addColumn('SAVE_IN_MAILBOX', 'SaveInMailbox', 'boolean', CreoleTypes::BOOLEAN, false, null);
+
+ }
+} \ No newline at end of file
diff --git a/lib/model/map/DomainMapBuilder.php b/lib/model/map/DomainMapBuilder.php
new file mode 100644
index 0000000..36e0d83
--- /dev/null
+++ b/lib/model/map/DomainMapBuilder.php
@@ -0,0 +1,50 @@
+<?php
+
+
+
+class DomainMapBuilder {
+
+
+ const CLASS_NAME = 'lib.model.map.DomainMapBuilder';
+
+
+ private $dbMap;
+
+
+ public function isBuilt()
+ {
+ return ($this->dbMap !== null);
+ }
+
+
+ public function getDatabaseMap()
+ {
+ return $this->dbMap;
+ }
+
+
+ public function doBuild()
+ {
+ $this->dbMap = Propel::getDatabaseMap('propel');
+
+ $tMap = $this->dbMap->addTable('domain');
+ $tMap->setPhpName('Domain');
+
+ $tMap->setUseIdGenerator(true);
+
+ $tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null);
+
+ $tMap->addColumn('NAME', 'Name', 'string', CreoleTypes::VARCHAR, false, 255);
+
+ $tMap->addForeignKey('CREATOR_ID', 'CreatorId', 'int', CreoleTypes::INTEGER, 'user', 'ID', false, null);
+
+ $tMap->addColumn('MAILBOX_PREFIX', 'MailboxPrefix', 'string', CreoleTypes::VARCHAR, false, 255);
+
+ $tMap->addColumn('MAX_MAILBOX_COUNT', 'MaxMailboxCount', 'int', CreoleTypes::INTEGER, false, null);
+
+ $tMap->addColumn('QUOTA', 'Quota', 'int', CreoleTypes::INTEGER, false, null);
+
+ $tMap->addColumn('DEFAULT_MAILBOX_QUOTA', 'DefaultMailboxQuota', 'int', CreoleTypes::INTEGER, false, null);
+
+ }
+} \ No newline at end of file
diff --git a/lib/model/map/DomainPermissionMapBuilder.php b/lib/model/map/DomainPermissionMapBuilder.php
new file mode 100644
index 0000000..380be1c
--- /dev/null
+++ b/lib/model/map/DomainPermissionMapBuilder.php
@@ -0,0 +1,42 @@
+<?php
+
+
+
+class DomainPermissionMapBuilder {
+
+
+ const CLASS_NAME = 'lib.model.map.DomainPermissionMapBuilder';
+
+
+ private $dbMap;
+
+
+ public function isBuilt()
+ {
+ return ($this->dbMap !== null);
+ }
+
+
+ public function getDatabaseMap()
+ {
+ return $this->dbMap;
+ }
+
+
+ public function doBuild()
+ {
+ $this->dbMap = Propel::getDatabaseMap('propel');
+
+ $tMap = $this->dbMap->addTable('domain_permission');
+ $tMap->setPhpName('DomainPermission');
+
+ $tMap->setUseIdGenerator(true);
+
+ $tMap->addForeignKey('USER_ID', 'UserId', 'int', CreoleTypes::INTEGER, 'user', 'ID', false, null);
+
+ $tMap->addForeignKey('DOMAIN_ID', 'DomainId', 'int', CreoleTypes::INTEGER, 'domain', 'ID', false, null);
+
+ $tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null);
+
+ }
+} \ No newline at end of file
diff --git a/lib/model/map/LogEntryMapBuilder.php b/lib/model/map/LogEntryMapBuilder.php
new file mode 100644
index 0000000..737ea21
--- /dev/null
+++ b/lib/model/map/LogEntryMapBuilder.php
@@ -0,0 +1,48 @@
+<?php
+
+
+
+class LogEntryMapBuilder {
+
+
+ const CLASS_NAME = 'lib.model.map.LogEntryMapBuilder';
+
+
+ private $dbMap;
+
+
+ public function isBuilt()
+ {
+ return ($this->dbMap !== null);
+ }
+
+
+ public function getDatabaseMap()
+ {
+ return $this->dbMap;
+ }
+
+
+ public function doBuild()
+ {
+ $this->dbMap = Propel::getDatabaseMap('propel');
+
+ $tMap = $this->dbMap->addTable('log');
+ $tMap->setPhpName('LogEntry');
+
+ $tMap->setUseIdGenerator(true);
+
+ $tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null);
+
+ $tMap->addForeignKey('USER_ID', 'UserId', 'int', CreoleTypes::INTEGER, 'user', 'ID', false, null);
+
+ $tMap->addColumn('CREATED_AT', 'CreatedAt', 'int', CreoleTypes::TIMESTAMP, false, null);
+
+ $tMap->addColumn('MESSAGE', 'Message', 'string', CreoleTypes::LONGVARCHAR, false, null);
+
+ $tMap->addColumn('HOST', 'Host', 'string', CreoleTypes::VARCHAR, false, 255);
+
+ $tMap->addColumn('PRIORITY', 'Priority', 'int', CreoleTypes::INTEGER, false, null);
+
+ }
+} \ No newline at end of file
diff --git a/lib/model/map/MailboxMapBuilder.php b/lib/model/map/MailboxMapBuilder.php
new file mode 100644
index 0000000..54bbe40
--- /dev/null
+++ b/lib/model/map/MailboxMapBuilder.php
@@ -0,0 +1,52 @@
+<?php
+
+
+
+class MailboxMapBuilder {
+
+
+ const CLASS_NAME = 'lib.model.map.MailboxMapBuilder';
+
+
+ private $dbMap;
+
+
+ public function isBuilt()
+ {
+ return ($this->dbMap !== null);
+ }
+
+
+ public function getDatabaseMap()
+ {
+ return $this->dbMap;
+ }
+
+
+ public function doBuild()
+ {
+ $this->dbMap = Propel::getDatabaseMap('propel');
+
+ $tMap = $this->dbMap->addTable('mailbox');
+ $tMap->setPhpName('Mailbox');
+
+ $tMap->setUseIdGenerator(true);
+
+ $tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null);
+
+ $tMap->addForeignKey('DOMAIN_ID', 'DomainId', 'int', CreoleTypes::INTEGER, 'domain', 'ID', false, null);
+
+ $tMap->addColumn('NAME', 'Name', 'string', CreoleTypes::VARCHAR, false, 30);
+
+ $tMap->addColumn('PASSWORD', 'Password', 'string', CreoleTypes::VARCHAR, false, 40);
+
+ $tMap->addColumn('MAX_QUOTA', 'MaxQuota', 'int', CreoleTypes::INTEGER, false, null);
+
+ $tMap->addColumn('MAX_ADDRESS_COUNT', 'MaxAddressCount', 'int', CreoleTypes::INTEGER, false, null);
+
+ $tMap->addColumn('LAST_LOGIN', 'LastLogin', 'int', CreoleTypes::TIMESTAMP, false, null);
+
+ $tMap->addColumn('ACTIVE', 'Active', 'boolean', CreoleTypes::BOOLEAN, false, null);
+
+ }
+} \ No newline at end of file
diff --git a/lib/model/map/RoleMapBuilder.php b/lib/model/map/RoleMapBuilder.php
new file mode 100644
index 0000000..44aeb93
--- /dev/null
+++ b/lib/model/map/RoleMapBuilder.php
@@ -0,0 +1,42 @@
+<?php
+
+
+
+class RoleMapBuilder {
+
+
+ const CLASS_NAME = 'lib.model.map.RoleMapBuilder';
+
+
+ private $dbMap;
+
+
+ public function isBuilt()
+ {
+ return ($this->dbMap !== null);
+ }
+
+
+ public function getDatabaseMap()
+ {
+ return $this->dbMap;
+ }
+
+
+ public function doBuild()
+ {
+ $this->dbMap = Propel::getDatabaseMap('propel');
+
+ $tMap = $this->dbMap->addTable('role');
+ $tMap->setPhpName('Role');
+
+ $tMap->setUseIdGenerator(true);
+
+ $tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null);
+
+ $tMap->addColumn('NAME', 'Name', 'string', CreoleTypes::VARCHAR, false, 255);
+
+ $tMap->addColumn('CREDENTIALS', 'Credentials', 'string', CreoleTypes::VARCHAR, false, 255);
+
+ }
+} \ No newline at end of file
diff --git a/lib/model/map/UserMapBuilder.php b/lib/model/map/UserMapBuilder.php
new file mode 100644
index 0000000..3ee3252
--- /dev/null
+++ b/lib/model/map/UserMapBuilder.php
@@ -0,0 +1,58 @@
+<?php
+
+
+
+class UserMapBuilder {
+
+
+ const CLASS_NAME = 'lib.model.map.UserMapBuilder';
+
+
+ private $dbMap;
+
+
+ public function isBuilt()
+ {
+ return ($this->dbMap !== null);
+ }
+
+
+ public function getDatabaseMap()
+ {
+ return $this->dbMap;
+ }
+
+
+ public function doBuild()
+ {
+ $this->dbMap = Propel::getDatabaseMap('propel');
+
+ $tMap = $this->dbMap->addTable('user');
+ $tMap->setPhpName('User');
+
+ $tMap->setUseIdGenerator(true);
+
+ $tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null);
+
+ $tMap->addForeignKey('PARENT_USER_ID', 'ParentUserId', 'int', CreoleTypes::INTEGER, 'user', 'ID', false, null);
+
+ $tMap->addColumn('NICKNAME', 'Nickname', 'string', CreoleTypes::VARCHAR, false, 50);
+
+ $tMap->addColumn('FIRST_NAME', 'FirstName', 'string', CreoleTypes::VARCHAR, false, 100);
+
+ $tMap->addColumn('LAST_NAME', 'LastName', 'string', CreoleTypes::VARCHAR, false, 100);
+
+ $tMap->addColumn('EMAIL', 'Email', 'string', CreoleTypes::VARCHAR, false, 255);
+
+ $tMap->addColumn('SHA1_PASSWORD', 'Sha1Password', 'string', CreoleTypes::VARCHAR, false, 40);
+
+ $tMap->addColumn('SALT', 'Salt', 'string', CreoleTypes::VARCHAR, false, 32);
+
+ $tMap->addForeignKey('ROLE_ID', 'RoleId', 'int', CreoleTypes::INTEGER, 'role', 'ID', false, null);
+
+ $tMap->addColumn('LAST_LOGIN', 'LastLogin', 'int', CreoleTypes::TIMESTAMP, false, null);
+
+ $tMap->addColumn('CREATED_AT', 'CreatedAt', 'int', CreoleTypes::TIMESTAMP, false, null);
+
+ }
+} \ No newline at end of file
diff --git a/lib/model/om/BaseAddress.php b/lib/model/om/BaseAddress.php
new file mode 100644
index 0000000..8e9c258
--- /dev/null
+++ b/lib/model/om/BaseAddress.php
@@ -0,0 +1,643 @@
+<?php
+
+
+abstract class BaseAddress extends BaseObject implements Persistent {
+
+
+
+ protected static $peer;
+
+
+
+ protected $id;
+
+
+
+ protected $mailbox_id;
+
+
+
+ protected $localpart;
+
+
+
+ protected $domain_id;
+
+
+
+ protected $alias;
+
+
+
+ protected $destination;
+
+
+
+ protected $active = true;
+
+
+
+ protected $save_in_mailbox = true;
+
+
+ protected $aMailbox;
+
+
+ protected $aDomain;
+
+
+ protected $alreadyInSave = false;
+
+
+ protected $alreadyInValidation = false;
+
+
+ public function getId()
+ {
+
+ return $this->id;
+ }
+
+
+ public function getMailboxId()
+ {
+
+ return $this->mailbox_id;
+ }
+
+
+ public function getLocalpart()
+ {
+
+ return $this->localpart;
+ }
+
+
+ public function getDomainId()
+ {
+
+ return $this->domain_id;
+ }
+
+
+ public function getAlias()
+ {
+
+ return $this->alias;
+ }
+
+
+ public function getDestination()
+ {
+
+ return $this->destination;
+ }
+
+
+ public function getActive()
+ {
+
+ return $this->active;
+ }
+
+
+ public function getSaveInMailbox()
+ {
+
+ return $this->save_in_mailbox;
+ }
+
+
+ public function setId($v)
+ {
+
+ if ($v !== null && !is_int($v) && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = AddressPeer::ID;
+ }
+
+ }
+
+ public function setMailboxId($v)
+ {
+
+ if ($v !== null && !is_int($v) && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->mailbox_id !== $v) {
+ $this->mailbox_id = $v;
+ $this->modifiedColumns[] = AddressPeer::MAILBOX_ID;
+ }
+
+ if ($this->aMailbox !== null && $this->aMailbox->getId() !== $v) {
+ $this->aMailbox = null;
+ }
+
+ }
+
+ public function setLocalpart($v)
+ {
+
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->localpart !== $v) {
+ $this->localpart = $v;
+ $this->modifiedColumns[] = AddressPeer::LOCALPART;
+ }
+
+ }
+
+ public function setDomainId($v)
+ {
+
+ if ($v !== null && !is_int($v) && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->domain_id !== $v) {
+ $this->domain_id = $v;
+ $this->modifiedColumns[] = AddressPeer::DOMAIN_ID;
+ }
+
+ if ($this->aDomain !== null && $this->aDomain->getId() !== $v) {
+ $this->aDomain = null;
+ }
+
+ }
+
+ public function setAlias($v)
+ {
+
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->alias !== $v) {
+ $this->alias = $v;
+ $this->modifiedColumns[] = AddressPeer::ALIAS;
+ }
+
+ }
+
+ public function setDestination($v)
+ {
+
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->destination !== $v) {
+ $this->destination = $v;
+ $this->modifiedColumns[] = AddressPeer::DESTINATION;
+ }
+
+ }
+
+ public function setActive($v)
+ {
+
+ if ($this->active !== $v || $v === true) {
+ $this->active = $v;
+ $this->modifiedColumns[] = AddressPeer::ACTIVE;
+ }
+
+ }
+
+ public function setSaveInMailbox($v)
+ {
+
+ if ($this->save_in_mailbox !== $v || $v === true) {
+ $this->save_in_mailbox = $v;
+ $this->modifiedColumns[] = AddressPeer::SAVE_IN_MAILBOX;
+ }
+
+ }
+
+ public function hydrate(ResultSet $rs, $startcol = 1)
+ {
+ try {
+
+ $this->id = $rs->getInt($startcol + 0);
+
+ $this->mailbox_id = $rs->getInt($startcol + 1);
+
+ $this->localpart = $rs->getString($startcol + 2);
+
+ $this->domain_id = $rs->getInt($startcol + 3);
+
+ $this->alias = $rs->getString($startcol + 4);
+
+ $this->destination = $rs->getString($startcol + 5);
+
+ $this->active = $rs->getBoolean($startcol + 6);
+
+ $this->save_in_mailbox = $rs->getBoolean($startcol + 7);
+
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ return $startcol + 8;
+ } catch (Exception $e) {
+ throw new PropelException("Error populating Address object", $e);
+ }
+ }
+
+
+ public function delete($con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("This object has already been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(AddressPeer::DATABASE_NAME);
+ }
+
+ try {
+ $con->begin();
+ AddressPeer::doDelete($this, $con);
+ $this->setDeleted(true);
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+
+ public function save($con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("You cannot save an object that has been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(AddressPeer::DATABASE_NAME);
+ }
+
+ try {
+ $con->begin();
+ $affectedRows = $this->doSave($con);
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+
+ protected function doSave($con)
+ {
+ $affectedRows = 0; if (!$this->alreadyInSave) {
+ $this->alreadyInSave = true;
+
+
+
+ if ($this->aMailbox !== null) {
+ if ($this->aMailbox->isModified()) {
+ $affectedRows += $this->aMailbox->save($con);
+ }
+ $this->setMailbox($this->aMailbox);
+ }
+
+ if ($this->aDomain !== null) {
+ if ($this->aDomain->isModified()) {
+ $affectedRows += $this->aDomain->save($con);
+ }
+ $this->setDomain($this->aDomain);
+ }
+
+
+ if ($this->isModified()) {
+ if ($this->isNew()) {
+ $pk = AddressPeer::doInsert($this, $con);
+ $affectedRows += 1;
+ $this->setId($pk);
+ $this->setNew(false);
+ } else {
+ $affectedRows += AddressPeer::doUpdate($this, $con);
+ }
+ $this->resetModified(); }
+
+ $this->alreadyInSave = false;
+ }
+ return $affectedRows;
+ }
+
+ protected $validationFailures = array();
+
+
+ public function getValidationFailures()
+ {
+ return $this->validationFailures;
+ }
+
+
+ public function validate($columns = null)
+ {
+ $res = $this->doValidate($columns);
+ if ($res === true) {
+ $this->validationFailures = array();
+ return true;
+ } else {
+ $this->validationFailures = $res;
+ return false;
+ }
+ }
+
+
+ protected function doValidate($columns = null)
+ {
+ if (!$this->alreadyInValidation) {
+ $this->alreadyInValidation = true;
+ $retval = null;
+
+ $failureMap = array();
+
+
+
+ if ($this->aMailbox !== null) {
+ if (!$this->aMailbox->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aMailbox->getValidationFailures());
+ }
+ }
+
+ if ($this->aDomain !== null) {
+ if (!$this->aDomain->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aDomain->getValidationFailures());
+ }
+ }
+
+
+ if (($retval = AddressPeer::doValidate($this, $columns)) !== true) {
+ $failureMap = array_merge($failureMap, $retval);
+ }
+
+
+
+ $this->alreadyInValidation = false;
+ }
+
+ return (!empty($failureMap) ? $failureMap : true);
+ }
+
+
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = AddressPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ return $this->getByPosition($pos);
+ }
+
+
+ public function getByPosition($pos)
+ {
+ switch($pos) {
+ case 0:
+ return $this->getId();
+ break;
+ case 1:
+ return $this->getMailboxId();
+ break;
+ case 2:
+ return $this->getLocalpart();
+ break;
+ case 3:
+ return $this->getDomainId();
+ break;
+ case 4:
+ return $this->getAlias();
+ break;
+ case 5:
+ return $this->getDestination();
+ break;
+ case 6:
+ return $this->getActive();
+ break;
+ case 7:
+ return $this->getSaveInMailbox();
+ break;
+ default:
+ return null;
+ break;
+ } }
+
+
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = AddressPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getMailboxId(),
+ $keys[2] => $this->getLocalpart(),
+ $keys[3] => $this->getDomainId(),
+ $keys[4] => $this->getAlias(),
+ $keys[5] => $this->getDestination(),
+ $keys[6] => $this->getActive(),
+ $keys[7] => $this->getSaveInMailbox(),
+ );
+ return $result;
+ }
+
+
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = AddressPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ return $this->setByPosition($pos, $value);
+ }
+
+
+ public function setByPosition($pos, $value)
+ {
+ switch($pos) {
+ case 0:
+ $this->setId($value);
+ break;
+ case 1:
+ $this->setMailboxId($value);
+ break;
+ case 2:
+ $this->setLocalpart($value);
+ break;
+ case 3:
+ $this->setDomainId($value);
+ break;
+ case 4:
+ $this->setAlias($value);
+ break;
+ case 5:
+ $this->setDestination($value);
+ break;
+ case 6:
+ $this->setActive($value);
+ break;
+ case 7:
+ $this->setSaveInMailbox($value);
+ break;
+ } }
+
+
+ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = AddressPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setMailboxId($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setLocalpart($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setDomainId($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setAlias($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setDestination($arr[$keys[5]]);
+ if (array_key_exists($keys[6], $arr)) $this->setActive($arr[$keys[6]]);
+ if (array_key_exists($keys[7], $arr)) $this->setSaveInMailbox($arr[$keys[7]]);
+ }
+
+
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(AddressPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(AddressPeer::ID)) $criteria->add(AddressPeer::ID, $this->id);
+ if ($this->isColumnModified(AddressPeer::MAILBOX_ID)) $criteria->add(AddressPeer::MAILBOX_ID, $this->mailbox_id);
+ if ($this->isColumnModified(AddressPeer::LOCALPART)) $criteria->add(AddressPeer::LOCALPART, $this->localpart);
+ if ($this->isColumnModified(AddressPeer::DOMAIN_ID)) $criteria->add(AddressPeer::DOMAIN_ID, $this->domain_id);
+ if ($this->isColumnModified(AddressPeer::ALIAS)) $criteria->add(AddressPeer::ALIAS, $this->alias);
+ if ($this->isColumnModified(AddressPeer::DESTINATION)) $criteria->add(AddressPeer::DESTINATION, $this->destination);
+ if ($this->isColumnModified(AddressPeer::ACTIVE)) $criteria->add(AddressPeer::ACTIVE, $this->active);
+ if ($this->isColumnModified(AddressPeer::SAVE_IN_MAILBOX)) $criteria->add(AddressPeer::SAVE_IN_MAILBOX, $this->save_in_mailbox);
+
+ return $criteria;
+ }
+
+
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(AddressPeer::DATABASE_NAME);
+
+ $criteria->add(AddressPeer::ID, $this->id);
+
+ return $criteria;
+ }
+
+
+ public function getPrimaryKey()
+ {
+ return $this->getId();
+ }
+
+
+ public function setPrimaryKey($key)
+ {
+ $this->setId($key);
+ }
+
+
+ public function copyInto($copyObj, $deepCopy = false)
+ {
+
+ $copyObj->setMailboxId($this->mailbox_id);
+
+ $copyObj->setLocalpart($this->localpart);
+
+ $copyObj->setDomainId($this->domain_id);
+
+ $copyObj->setAlias($this->alias);
+
+ $copyObj->setDestination($this->destination);
+
+ $copyObj->setActive($this->active);
+
+ $copyObj->setSaveInMailbox($this->save_in_mailbox);
+
+
+ $copyObj->setNew(true);
+
+ $copyObj->setId(NULL);
+ }
+
+
+ public function copy($deepCopy = false)
+ {
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+ return $copyObj;
+ }
+
+
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new AddressPeer();
+ }
+ return self::$peer;
+ }
+
+
+ public function setMailbox($v)
+ {
+
+
+ if ($v === null) {
+ $this->setMailboxId(NULL);
+ } else {
+ $this->setMailboxId($v->getId());
+ }
+
+
+ $this->aMailbox = $v;
+ }
+
+
+
+ public function getMailbox($con = null)
+ {
+ include_once 'lib/model/om/BaseMailboxPeer.php';
+
+ if ($this->aMailbox === null && ($this->mailbox_id !== null)) {
+
+ $this->aMailbox = MailboxPeer::retrieveByPK($this->mailbox_id, $con);
+
+
+ }
+ return $this->aMailbox;
+ }
+
+
+ public function setDomain($v)
+ {
+
+
+ if ($v === null) {
+ $this->setDomainId(NULL);
+ } else {
+ $this->setDomainId($v->getId());
+ }
+
+
+ $this->aDomain = $v;
+ }
+
+
+
+ public function getDomain($con = null)
+ {
+ include_once 'lib/model/om/BaseDomainPeer.php';
+
+ if ($this->aDomain === null && ($this->domain_id !== null)) {
+
+ $this->aDomain = DomainPeer::retrieveByPK($this->domain_id, $con);
+
+
+ }
+ return $this->aDomain;
+ }
+
+} \ No newline at end of file
diff --git a/lib/model/om/BaseAddressPeer.php b/lib/model/om/BaseAddressPeer.php
new file mode 100644
index 0000000..acc23cb
--- /dev/null
+++ b/lib/model/om/BaseAddressPeer.php
@@ -0,0 +1,834 @@
+<?php
+
+
+abstract class BaseAddressPeer {
+
+
+ const DATABASE_NAME = 'propel';
+
+
+ const TABLE_NAME = 'address';
+
+
+ const CLASS_DEFAULT = 'lib.model.Address';
+
+
+ const NUM_COLUMNS = 8;
+
+
+ const NUM_LAZY_LOAD_COLUMNS = 0;
+
+
+
+ const ID = 'address.ID';
+
+
+ const MAILBOX_ID = 'address.MAILBOX_ID';
+
+
+ const LOCALPART = 'address.LOCALPART';
+
+
+ const DOMAIN_ID = 'address.DOMAIN_ID';
+
+
+ const ALIAS = 'address.ALIAS';
+
+
+ const DESTINATION = 'address.DESTINATION';
+
+
+ const ACTIVE = 'address.ACTIVE';
+
+
+ const SAVE_IN_MAILBOX = 'address.SAVE_IN_MAILBOX';
+
+
+ private static $phpNameMap = null;
+
+
+
+ private static $fieldNames = array (
+ BasePeer::TYPE_PHPNAME => array ('Id', 'MailboxId', 'Localpart', 'DomainId', 'Alias', 'Destination', 'Active', 'SaveInMailbox', ),
+ BasePeer::TYPE_COLNAME => array (AddressPeer::ID, AddressPeer::MAILBOX_ID, AddressPeer::LOCALPART, AddressPeer::DOMAIN_ID, AddressPeer::ALIAS, AddressPeer::DESTINATION, AddressPeer::ACTIVE, AddressPeer::SAVE_IN_MAILBOX, ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'mailbox_id', 'localpart', 'domain_id', 'alias', 'destination', 'active', 'save_in_mailbox', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, )
+ );
+
+
+ private static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'MailboxId' => 1, 'Localpart' => 2, 'DomainId' => 3, 'Alias' => 4, 'Destination' => 5, 'Active' => 6, 'SaveInMailbox' => 7, ),
+ BasePeer::TYPE_COLNAME => array (AddressPeer::ID => 0, AddressPeer::MAILBOX_ID => 1, AddressPeer::LOCALPART => 2, AddressPeer::DOMAIN_ID => 3, AddressPeer::ALIAS => 4, AddressPeer::DESTINATION => 5, AddressPeer::ACTIVE => 6, AddressPeer::SAVE_IN_MAILBOX => 7, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'mailbox_id' => 1, 'localpart' => 2, 'domain_id' => 3, 'alias' => 4, 'destination' => 5, 'active' => 6, 'save_in_mailbox' => 7, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, )
+ );
+
+
+ public static function getMapBuilder()
+ {
+ include_once 'lib/model/map/AddressMapBuilder.php';
+ return BasePeer::getMapBuilder('lib.model.map.AddressMapBuilder');
+ }
+
+ public static function getPhpNameMap()
+ {
+ if (self::$phpNameMap === null) {
+ $map = AddressPeer::getTableMap();
+ $columns = $map->getColumns();
+ $nameMap = array();
+ foreach ($columns as $column) {
+ $nameMap[$column->getPhpName()] = $column->getColumnName();
+ }
+ self::$phpNameMap = $nameMap;
+ }
+ return self::$phpNameMap;
+ }
+
+ static public function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = self::getFieldNames($toType);
+ $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
+ if ($key === null) {
+ throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
+ }
+ return $toNames[$key];
+ }
+
+
+
+ static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, self::$fieldNames)) {
+ throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.');
+ }
+ return self::$fieldNames[$type];
+ }
+
+
+ public static function alias($alias, $column)
+ {
+ return str_replace(AddressPeer::TABLE_NAME.'.', $alias.'.', $column);
+ }
+
+
+ public static function addSelectColumns(Criteria $criteria)
+ {
+
+ $criteria->addSelectColumn(AddressPeer::ID);
+
+ $criteria->addSelectColumn(AddressPeer::MAILBOX_ID);
+
+ $criteria->addSelectColumn(AddressPeer::LOCALPART);
+
+ $criteria->addSelectColumn(AddressPeer::DOMAIN_ID);
+
+ $criteria->addSelectColumn(AddressPeer::ALIAS);
+
+ $criteria->addSelectColumn(AddressPeer::DESTINATION);
+
+ $criteria->addSelectColumn(AddressPeer::ACTIVE);
+
+ $criteria->addSelectColumn(AddressPeer::SAVE_IN_MAILBOX);
+
+ }
+
+ const COUNT = 'COUNT(address.ID)';
+ const COUNT_DISTINCT = 'COUNT(DISTINCT address.ID)';
+
+
+ public static function doCount(Criteria $criteria, $distinct = false, $con = null)
+ {
+ $criteria = clone $criteria;
+
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(AddressPeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(AddressPeer::COUNT);
+ }
+
+ foreach($criteria->getGroupByColumns() as $column)
+ {
+ $criteria->addSelectColumn($column);
+ }
+
+ $rs = AddressPeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ return 0;
+ }
+ }
+
+ public static function doSelectOne(Criteria $criteria, $con = null)
+ {
+ $critcopy = clone $criteria;
+ $critcopy->setLimit(1);
+ $objects = AddressPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+ return null;
+ }
+
+ public static function doSelect(Criteria $criteria, $con = null)
+ {
+ return AddressPeer::populateObjects(AddressPeer::doSelectRS($criteria, $con));
+ }
+
+ public static function doSelectRS(Criteria $criteria, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ if (!$criteria->getSelectColumns()) {
+ $criteria = clone $criteria;
+ AddressPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ return BasePeer::doSelect($criteria, $con);
+ }
+
+ public static function populateObjects(ResultSet $rs)
+ {
+ $results = array();
+
+ $cls = AddressPeer::getOMClass();
+ $cls = Propel::import($cls);
+ while($rs->next()) {
+
+ $obj = new $cls();
+ $obj->hydrate($rs);
+ $results[] = $obj;
+
+ }
+ return $results;
+ }
+
+
+ public static function doCountJoinMailbox(Criteria $criteria, $distinct = false, $con = null)
+ {
+ $criteria = clone $criteria;
+
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(AddressPeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(AddressPeer::COUNT);
+ }
+
+ foreach($criteria->getGroupByColumns() as $column)
+ {
+ $criteria->addSelectColumn($column);
+ }
+
+ $criteria->addJoin(AddressPeer::MAILBOX_ID, MailboxPeer::ID);
+
+ $rs = AddressPeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ return 0;
+ }
+ }
+
+
+
+ public static function doCountJoinDomain(Criteria $criteria, $distinct = false, $con = null)
+ {
+ $criteria = clone $criteria;
+
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(AddressPeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(AddressPeer::COUNT);
+ }
+
+ foreach($criteria->getGroupByColumns() as $column)
+ {
+ $criteria->addSelectColumn($column);
+ }
+
+ $criteria->addJoin(AddressPeer::DOMAIN_ID, DomainPeer::ID);
+
+ $rs = AddressPeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ return 0;
+ }
+ }
+
+
+
+ public static function doSelectJoinMailbox(Criteria $c, $con = null)
+ {
+ $c = clone $c;
+
+ if ($c->getDbName() == Propel::getDefaultDB()) {
+ $c->setDbName(self::DATABASE_NAME);
+ }
+
+ AddressPeer::addSelectColumns($c);
+ $startcol = (AddressPeer::NUM_COLUMNS - AddressPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
+ MailboxPeer::addSelectColumns($c);
+
+ $c->addJoin(AddressPeer::MAILBOX_ID, MailboxPeer::ID);
+ $rs = BasePeer::doSelect($c, $con);
+ $results = array();
+
+ while($rs->next()) {
+
+ $omClass = AddressPeer::getOMClass();
+
+ $cls = Propel::import($omClass);
+ $obj1 = new $cls();
+ $obj1->hydrate($rs);
+
+ $omClass = MailboxPeer::getOMClass();
+
+ $cls = Propel::import($omClass);
+ $obj2 = new $cls();
+ $obj2->hydrate($rs, $startcol);
+
+ $newObject = true;
+ foreach($results as $temp_obj1) {
+ $temp_obj2 = $temp_obj1->getMailbox(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
+ $newObject = false;
+ $temp_obj2->addAddress($obj1); break;
+ }
+ }
+ if ($newObject) {
+ $obj2->initAddresss();
+ $obj2->addAddress($obj1); }
+ $results[] = $obj1;
+ }
+ return $results;
+ }
+
+
+
+ public static function doSelectJoinDomain(Criteria $c, $con = null)
+ {
+ $c = clone $c;
+
+ if ($c->getDbName() == Propel::getDefaultDB()) {
+ $c->setDbName(self::DATABASE_NAME);
+ }
+
+ AddressPeer::addSelectColumns($c);
+ $startcol = (AddressPeer::NUM_COLUMNS - AddressPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
+ DomainPeer::addSelectColumns($c);
+
+ $c->addJoin(AddressPeer::DOMAIN_ID, DomainPeer::ID);
+ $rs = BasePeer::doSelect($c, $con);
+ $results = array();
+
+ while($rs->next()) {
+
+ $omClass = AddressPeer::getOMClass();
+
+ $cls = Propel::import($omClass);
+ $obj1 = new $cls();
+ $obj1->hydrate($rs);
+
+ $omClass = DomainPeer::getOMClass();
+
+ $cls = Propel::import($omClass);
+ $obj2 = new $cls();
+ $obj2->hydrate($rs, $startcol);
+
+ $newObject = true;
+ foreach($results as $temp_obj1) {
+ $temp_obj2 = $temp_obj1->getDomain(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
+ $newObject = false;
+ $temp_obj2->addAddress($obj1); break;
+ }
+ }
+ if ($newObject) {
+ $obj2->initAddresss();
+ $obj2->addAddress($obj1); }
+ $results[] = $obj1;
+ }
+ return $results;
+ }
+
+
+
+ public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null)
+ {
+ $criteria = clone $criteria;
+
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(AddressPeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(AddressPeer::COUNT);
+ }
+
+ foreach($criteria->getGroupByColumns() as $column)
+ {
+ $criteria->addSelectColumn($column);
+ }
+
+ $criteria->addJoin(AddressPeer::MAILBOX_ID, MailboxPeer::ID);
+
+ $criteria->addJoin(AddressPeer::DOMAIN_ID, DomainPeer::ID);
+
+ $rs = AddressPeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ return 0;
+ }
+ }
+
+
+
+ public static function doSelectJoinAll(Criteria $c, $con = null)
+ {
+ $c = clone $c;
+
+ if ($c->getDbName() == Propel::getDefaultDB()) {
+ $c->setDbName(self::DATABASE_NAME);
+ }
+
+ AddressPeer::addSelectColumns($c);
+ $startcol2 = (AddressPeer::NUM_COLUMNS - AddressPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
+
+ MailboxPeer::addSelectColumns($c);
+ $startcol3 = $startcol2 + MailboxPeer::NUM_COLUMNS;
+
+ DomainPeer::addSelectColumns($c);
+ $startcol4 = $startcol3 + DomainPeer::NUM_COLUMNS;
+
+ $c->addJoin(AddressPeer::MAILBOX_ID, MailboxPeer::ID);
+
+ $c->addJoin(AddressPeer::DOMAIN_ID, DomainPeer::ID);
+
+ $rs = BasePeer::doSelect($c, $con);
+ $results = array();
+
+ while($rs->next()) {
+
+ $omClass = AddressPeer::getOMClass();
+
+
+ $cls = Propel::import($omClass);
+ $obj1 = new $cls();
+ $obj1->hydrate($rs);
+
+
+
+ $omClass = MailboxPeer::getOMClass();
+
+
+ $cls = Propel::import($omClass);
+ $obj2 = new $cls();
+ $obj2->hydrate($rs, $startcol2);
+
+ $newObject = true;
+ for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
+ $temp_obj1 = $results[$j];
+ $temp_obj2 = $temp_obj1->getMailbox(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
+ $newObject = false;
+ $temp_obj2->addAddress($obj1); break;
+ }
+ }
+
+ if ($newObject) {
+ $obj2->initAddresss();
+ $obj2->addAddress($obj1);
+ }
+
+
+
+ $omClass = DomainPeer::getOMClass();
+
+
+ $cls = Propel::import($omClass);
+ $obj3 = new $cls();
+ $obj3->hydrate($rs, $startcol3);
+
+ $newObject = true;
+ for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
+ $temp_obj1 = $results[$j];
+ $temp_obj3 = $temp_obj1->getDomain(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) {
+ $newObject = false;
+ $temp_obj3->addAddress($obj1); break;
+ }
+ }
+
+ if ($newObject) {
+ $obj3->initAddresss();
+ $obj3->addAddress($obj1);
+ }
+
+ $results[] = $obj1;
+ }
+ return $results;
+ }
+
+
+
+ public static function doCountJoinAllExceptMailbox(Criteria $criteria, $distinct = false, $con = null)
+ {
+ $criteria = clone $criteria;
+
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(AddressPeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(AddressPeer::COUNT);
+ }
+
+ foreach($criteria->getGroupByColumns() as $column)
+ {
+ $criteria->addSelectColumn($column);
+ }
+
+ $criteria->addJoin(AddressPeer::DOMAIN_ID, DomainPeer::ID);
+
+ $rs = AddressPeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ return 0;
+ }
+ }
+
+
+
+ public static function doCountJoinAllExceptDomain(Criteria $criteria, $distinct = false, $con = null)
+ {
+ $criteria = clone $criteria;
+
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(AddressPeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(AddressPeer::COUNT);
+ }
+
+ foreach($criteria->getGroupByColumns() as $column)
+ {
+ $criteria->addSelectColumn($column);
+ }
+
+ $criteria->addJoin(AddressPeer::MAILBOX_ID, MailboxPeer::ID);
+
+ $rs = AddressPeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ return 0;
+ }
+ }
+
+
+
+ public static function doSelectJoinAllExceptMailbox(Criteria $c, $con = null)
+ {
+ $c = clone $c;
+
+ if ($c->getDbName() == Propel::getDefaultDB()) {
+ $c->setDbName(self::DATABASE_NAME);
+ }
+
+ AddressPeer::addSelectColumns($c);
+ $startcol2 = (AddressPeer::NUM_COLUMNS - AddressPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
+
+ DomainPeer::addSelectColumns($c);
+ $startcol3 = $startcol2 + DomainPeer::NUM_COLUMNS;
+
+ $c->addJoin(AddressPeer::DOMAIN_ID, DomainPeer::ID);
+
+
+ $rs = BasePeer::doSelect($c, $con);
+ $results = array();
+
+ while($rs->next()) {
+
+ $omClass = AddressPeer::getOMClass();
+
+ $cls = Propel::import($omClass);
+ $obj1 = new $cls();
+ $obj1->hydrate($rs);
+
+ $omClass = DomainPeer::getOMClass();
+
+
+ $cls = Propel::import($omClass);
+ $obj2 = new $cls();
+ $obj2->hydrate($rs, $startcol2);
+
+ $newObject = true;
+ for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
+ $temp_obj1 = $results[$j];
+ $temp_obj2 = $temp_obj1->getDomain(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
+ $newObject = false;
+ $temp_obj2->addAddress($obj1);
+ break;
+ }
+ }
+
+ if ($newObject) {
+ $obj2->initAddresss();
+ $obj2->addAddress($obj1);
+ }
+
+ $results[] = $obj1;
+ }
+ return $results;
+ }
+
+
+
+ public static function doSelectJoinAllExceptDomain(Criteria $c, $con = null)
+ {
+ $c = clone $c;
+
+ if ($c->getDbName() == Propel::getDefaultDB()) {
+ $c->setDbName(self::DATABASE_NAME);
+ }
+
+ AddressPeer::addSelectColumns($c);
+ $startcol2 = (AddressPeer::NUM_COLUMNS - AddressPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
+
+ MailboxPeer::addSelectColumns($c);
+ $startcol3 = $startcol2 + MailboxPeer::NUM_COLUMNS;
+
+ $c->addJoin(AddressPeer::MAILBOX_ID, MailboxPeer::ID);
+
+
+ $rs = BasePeer::doSelect($c, $con);
+ $results = array();
+
+ while($rs->next()) {
+
+ $omClass = AddressPeer::getOMClass();
+
+ $cls = Propel::import($omClass);
+ $obj1 = new $cls();
+ $obj1->hydrate($rs);
+
+ $omClass = MailboxPeer::getOMClass();
+
+
+ $cls = Propel::import($omClass);
+ $obj2 = new $cls();
+ $obj2->hydrate($rs, $startcol2);
+
+ $newObject = true;
+ for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
+ $temp_obj1 = $results[$j];
+ $temp_obj2 = $temp_obj1->getMailbox(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
+ $newObject = false;
+ $temp_obj2->addAddress($obj1);
+ break;
+ }
+ }
+
+ if ($newObject) {
+ $obj2->initAddresss();
+ $obj2->addAddress($obj1);
+ }
+
+ $results[] = $obj1;
+ }
+ return $results;
+ }
+
+
+ public static function getTableMap()
+ {
+ return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
+ }
+
+
+ public static function getOMClass()
+ {
+ return AddressPeer::CLASS_DEFAULT;
+ }
+
+
+ public static function doInsert($values, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; } else {
+ $criteria = $values->buildCriteria(); }
+
+ $criteria->remove(AddressPeer::ID);
+
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ try {
+ $con->begin();
+ $pk = BasePeer::doInsert($criteria, $con);
+ $con->commit();
+ } catch(PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+
+ public static function doUpdate($values, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ $selectCriteria = new Criteria(self::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values;
+ $comparison = $criteria->getComparison(AddressPeer::ID);
+ $selectCriteria->add(AddressPeer::ID, $criteria->remove(AddressPeer::ID), $comparison);
+
+ } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); }
+
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+
+ public static function doDeleteAll($con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+ $affectedRows = 0; try {
+ $con->begin();
+ $affectedRows += BasePeer::doDeleteAll(AddressPeer::TABLE_NAME, $con);
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+
+ public static function doDelete($values, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(AddressPeer::DATABASE_NAME);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; } elseif ($values instanceof Address) {
+
+ $criteria = $values->buildPkeyCriteria();
+ } else {
+ $criteria = new Criteria(self::DATABASE_NAME);
+ $criteria->add(AddressPeer::ID, (array) $values, Criteria::IN);
+ }
+
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ $affectedRows = 0;
+ try {
+ $con->begin();
+
+ $affectedRows += BasePeer::doDelete($criteria, $con);
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+
+ public static function doValidate(Address $obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(AddressPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(AddressPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach($cols as $colName) {
+ if ($tableMap->containsColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ $res = BasePeer::doValidate(AddressPeer::DATABASE_NAME, AddressPeer::TABLE_NAME, $columns);
+ if ($res !== true) {
+ $request = sfContext::getInstance()->getRequest();
+ foreach ($res as $failed) {
+ $col = AddressPeer::translateFieldname($failed->getColumn(), BasePeer::TYPE_COLNAME, BasePeer::TYPE_PHPNAME);
+ $request->setError($col, $failed->getMessage());
+ }
+ }
+
+ return $res;
+ }
+
+
+ public static function retrieveByPK($pk, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ $criteria = new Criteria(AddressPeer::DATABASE_NAME);
+
+ $criteria->add(AddressPeer::ID, $pk);
+
+
+ $v = AddressPeer::doSelect($criteria, $con);
+
+ return !empty($v) > 0 ? $v[0] : null;
+ }
+
+
+ public static function retrieveByPKs($pks, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ $objs = null;
+ if (empty($pks)) {
+ $objs = array();
+ } else {
+ $criteria = new Criteria();
+ $criteria->add(AddressPeer::ID, $pks, Criteria::IN);
+ $objs = AddressPeer::doSelect($criteria, $con);
+ }
+ return $objs;
+ }
+
+}
+if (Propel::isInit()) {
+ try {
+ BaseAddressPeer::getMapBuilder();
+ } catch (Exception $e) {
+ Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR);
+ }
+} else {
+ require_once 'lib/model/map/AddressMapBuilder.php';
+ Propel::registerMapBuilder('lib.model.map.AddressMapBuilder');
+}
diff --git a/lib/model/om/BaseDomain.php b/lib/model/om/BaseDomain.php
new file mode 100644
index 0000000..0c8317c
--- /dev/null
+++ b/lib/model/om/BaseDomain.php
@@ -0,0 +1,926 @@
+<?php
+
+
+abstract class BaseDomain extends BaseObject implements Persistent {
+
+
+
+ protected static $peer;
+
+
+
+ protected $id;
+
+
+
+ protected $name;
+
+
+
+ protected $creator_id;
+
+
+
+ protected $mailbox_prefix;
+
+
+
+ protected $max_mailbox_count;
+
+
+
+ protected $quota;
+
+
+
+ protected $default_mailbox_quota;
+
+
+ protected $aUser;
+
+
+ protected $collDomainPermissions;
+
+
+ protected $lastDomainPermissionCriteria = null;
+
+
+ protected $collMailboxs;
+
+
+ protected $lastMailboxCriteria = null;
+
+
+ protected $collAddresss;
+
+
+ protected $lastAddressCriteria = null;
+
+
+ protected $alreadyInSave = false;
+
+
+ protected $alreadyInValidation = false;
+
+
+ public function getId()
+ {
+
+ return $this->id;
+ }
+
+
+ public function getName()
+ {
+
+ return $this->name;
+ }
+
+
+ public function getCreatorId()
+ {
+
+ return $this->creator_id;
+ }
+
+
+ public function getMailboxPrefix()
+ {
+
+ return $this->mailbox_prefix;
+ }
+
+
+ public function getMaxMailboxCount()
+ {
+
+ return $this->max_mailbox_count;
+ }
+
+
+ public function getQuota()
+ {
+
+ return $this->quota;
+ }
+
+
+ public function getDefaultMailboxQuota()
+ {
+
+ return $this->default_mailbox_quota;
+ }
+
+
+ public function setId($v)
+ {
+
+ if ($v !== null && !is_int($v) && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = DomainPeer::ID;
+ }
+
+ }
+
+ public function setName($v)
+ {
+
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->name !== $v) {
+ $this->name = $v;
+ $this->modifiedColumns[] = DomainPeer::NAME;
+ }
+
+ }
+
+ public function setCreatorId($v)
+ {
+
+ if ($v !== null && !is_int($v) && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->creator_id !== $v) {
+ $this->creator_id = $v;
+ $this->modifiedColumns[] = DomainPeer::CREATOR_ID;
+ }
+
+ if ($this->aUser !== null && $this->aUser->getId() !== $v) {
+ $this->aUser = null;
+ }
+
+ }
+
+ public function setMailboxPrefix($v)
+ {
+
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->mailbox_prefix !== $v) {
+ $this->mailbox_prefix = $v;
+ $this->modifiedColumns[] = DomainPeer::MAILBOX_PREFIX;
+ }
+
+ }
+
+ public function setMaxMailboxCount($v)
+ {
+
+ if ($v !== null && !is_int($v) && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->max_mailbox_count !== $v) {
+ $this->max_mailbox_count = $v;
+ $this->modifiedColumns[] = DomainPeer::MAX_MAILBOX_COUNT;
+ }
+
+ }
+
+ public function setQuota($v)
+ {
+
+ if ($v !== null && !is_int($v) && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->quota !== $v) {
+ $this->quota = $v;
+ $this->modifiedColumns[] = DomainPeer::QUOTA;
+ }
+
+ }
+
+ public function setDefaultMailboxQuota($v)
+ {
+
+ if ($v !== null && !is_int($v) && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->default_mailbox_quota !== $v) {
+ $this->default_mailbox_quota = $v;
+ $this->modifiedColumns[] = DomainPeer::DEFAULT_MAILBOX_QUOTA;
+ }
+
+ }
+
+ public function hydrate(ResultSet $rs, $startcol = 1)
+ {
+ try {
+
+ $this->id = $rs->getInt($startcol + 0);
+
+ $this->name = $rs->getString($startcol + 1);
+
+ $this->creator_id = $rs->getInt($startcol + 2);
+
+ $this->mailbox_prefix = $rs->getString($startcol + 3);
+
+ $this->max_mailbox_count = $rs->getInt($startcol + 4);
+
+ $this->quota = $rs->getInt($startcol + 5);
+
+ $this->default_mailbox_quota = $rs->getInt($startcol + 6);
+
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ return $startcol + 7;
+ } catch (Exception $e) {
+ throw new PropelException("Error populating Domain object", $e);
+ }
+ }
+
+
+ public function delete($con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("This object has already been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(DomainPeer::DATABASE_NAME);
+ }
+
+ try {
+ $con->begin();
+ DomainPeer::doDelete($this, $con);
+ $this->setDeleted(true);
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+
+ public function save($con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("You cannot save an object that has been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(DomainPeer::DATABASE_NAME);
+ }
+
+ try {
+ $con->begin();
+ $affectedRows = $this->doSave($con);
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+
+ protected function doSave($con)
+ {
+ $affectedRows = 0; if (!$this->alreadyInSave) {
+ $this->alreadyInSave = true;
+
+
+
+ if ($this->aUser !== null) {
+ if ($this->aUser->isModified()) {
+ $affectedRows += $this->aUser->save($con);
+ }
+ $this->setUser($this->aUser);
+ }
+
+
+ if ($this->isModified()) {
+ if ($this->isNew()) {
+ $pk = DomainPeer::doInsert($this, $con);
+ $affectedRows += 1;
+ $this->setId($pk);
+ $this->setNew(false);
+ } else {
+ $affectedRows += DomainPeer::doUpdate($this, $con);
+ }
+ $this->resetModified(); }
+
+ if ($this->collDomainPermissions !== null) {
+ foreach($this->collDomainPermissions as $referrerFK) {
+ if (!$referrerFK->isDeleted()) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ if ($this->collMailboxs !== null) {
+ foreach($this->collMailboxs as $referrerFK) {
+ if (!$referrerFK->isDeleted()) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ if ($this->collAddresss !== null) {
+ foreach($this->collAddresss as $referrerFK) {
+ if (!$referrerFK->isDeleted()) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ $this->alreadyInSave = false;
+ }
+ return $affectedRows;
+ }
+
+ protected $validationFailures = array();
+
+
+ public function getValidationFailures()
+ {
+ return $this->validationFailures;
+ }
+
+
+ public function validate($columns = null)
+ {
+ $res = $this->doValidate($columns);
+ if ($res === true) {
+ $this->validationFailures = array();
+ return true;
+ } else {
+ $this->validationFailures = $res;
+ return false;
+ }
+ }
+
+
+ protected function doValidate($columns = null)
+ {
+ if (!$this->alreadyInValidation) {
+ $this->alreadyInValidation = true;
+ $retval = null;
+
+ $failureMap = array();
+
+
+
+ if ($this->aUser !== null) {
+ if (!$this->aUser->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aUser->getValidationFailures());
+ }
+ }
+
+
+ if (($retval = DomainPeer::doValidate($this, $columns)) !== true) {
+ $failureMap = array_merge($failureMap, $retval);
+ }
+
+
+ if ($this->collDomainPermissions !== null) {
+ foreach($this->collDomainPermissions as $referrerFK) {
+ if (!$referrerFK->validate($columns)) {
+ $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
+ }
+ }
+ }
+
+ if ($this->collMailboxs !== null) {
+ foreach($this->collMailboxs as $referrerFK) {
+ if (!$referrerFK->validate($columns)) {
+ $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
+ }
+ }
+ }
+
+ if ($this->collAddresss !== null) {
+ foreach($this->collAddresss as $referrerFK) {
+ if (!$referrerFK->validate($columns)) {
+ $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
+ }
+ }
+ }
+
+
+ $this->alreadyInValidation = false;
+ }
+
+ return (!empty($failureMap) ? $failureMap : true);
+ }
+
+
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = DomainPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ return $this->getByPosition($pos);
+ }
+
+
+ public function getByPosition($pos)
+ {
+ switch($pos) {
+ case 0:
+ return $this->getId();
+ break;
+ case 1:
+ return $this->getName();
+ break;
+ case 2:
+ return $this->getCreatorId();
+ break;
+ case 3:
+ return $this->getMailboxPrefix();
+ break;
+ case 4:
+ return $this->getMaxMailboxCount();
+ break;
+ case 5:
+ return $this->getQuota();
+ break;
+ case 6:
+ return $this->getDefaultMailboxQuota();
+ break;
+ default:
+ return null;
+ break;
+ } }
+
+
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = DomainPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getName(),
+ $keys[2] => $this->getCreatorId(),
+ $keys[3] => $this->getMailboxPrefix(),
+ $keys[4] => $this->getMaxMailboxCount(),
+ $keys[5] => $this->getQuota(),
+ $keys[6] => $this->getDefaultMailboxQuota(),
+ );
+ return $result;
+ }
+
+
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = DomainPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ return $this->setByPosition($pos, $value);
+ }
+
+
+ public function setByPosition($pos, $value)
+ {
+ switch($pos) {
+ case 0:
+ $this->setId($value);
+ break;
+ case 1:
+ $this->setName($value);
+ break;
+ case 2:
+ $this->setCreatorId($value);
+ break;
+ case 3:
+ $this->setMailboxPrefix($value);
+ break;
+ case 4:
+ $this->setMaxMailboxCount($value);
+ break;
+ case 5:
+ $this->setQuota($value);
+ break;
+ case 6:
+ $this->setDefaultMailboxQuota($value);
+ break;
+ } }
+
+
+ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = DomainPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setName($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setCreatorId($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setMailboxPrefix($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setMaxMailboxCount($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setQuota($arr[$keys[5]]);
+ if (array_key_exists($keys[6], $arr)) $this->setDefaultMailboxQuota($arr[$keys[6]]);
+ }
+
+
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(DomainPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(DomainPeer::ID)) $criteria->add(DomainPeer::ID, $this->id);
+ if ($this->isColumnModified(DomainPeer::NAME)) $criteria->add(DomainPeer::NAME, $this->name);
+ if ($this->isColumnModified(DomainPeer::CREATOR_ID)) $criteria->add(DomainPeer::CREATOR_ID, $this->creator_id);
+ if ($this->isColumnModified(DomainPeer::MAILBOX_PREFIX)) $criteria->add(DomainPeer::MAILBOX_PREFIX, $this->mailbox_prefix);
+ if ($this->isColumnModified(DomainPeer::MAX_MAILBOX_COUNT)) $criteria->add(DomainPeer::MAX_MAILBOX_COUNT, $this->max_mailbox_count);
+ if ($this->isColumnModified(DomainPeer::QUOTA)) $criteria->add(DomainPeer::QUOTA, $this->quota);
+ if ($this->isColumnModified(DomainPeer::DEFAULT_MAILBOX_QUOTA)) $criteria->add(DomainPeer::DEFAULT_MAILBOX_QUOTA, $this->default_mailbox_quota);
+
+ return $criteria;
+ }
+
+
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(DomainPeer::DATABASE_NAME);
+
+ $criteria->add(DomainPeer::ID, $this->id);
+
+ return $criteria;
+ }
+
+
+ public function getPrimaryKey()
+ {
+ return $this->getId();
+ }
+
+
+ public function setPrimaryKey($key)
+ {
+ $this->setId($key);
+ }
+
+
+ public function copyInto($copyObj, $deepCopy = false)
+ {
+
+ $copyObj->setName($this->name);
+
+ $copyObj->setCreatorId($this->creator_id);
+
+ $copyObj->setMailboxPrefix($this->mailbox_prefix);
+
+ $copyObj->setMaxMailboxCount($this->max_mailbox_count);
+
+ $copyObj->setQuota($this->quota);
+
+ $copyObj->setDefaultMailboxQuota($this->default_mailbox_quota);
+
+
+ if ($deepCopy) {
+ $copyObj->setNew(false);
+
+ foreach($this->getDomainPermissions() as $relObj) {
+ $copyObj->addDomainPermission($relObj->copy($deepCopy));
+ }
+
+ foreach($this->getMailboxs() as $relObj) {
+ $copyObj->addMailbox($relObj->copy($deepCopy));
+ }
+
+ foreach($this->getAddresss() as $relObj) {
+ $copyObj->addAddress($relObj->copy($deepCopy));
+ }
+
+ }
+
+ $copyObj->setNew(true);
+
+ $copyObj->setId(NULL);
+ }
+
+
+ public function copy($deepCopy = false)
+ {
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+ return $copyObj;
+ }
+
+
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new DomainPeer();
+ }
+ return self::$peer;
+ }
+
+
+ public function setUser($v)
+ {
+
+
+ if ($v === null) {
+ $this->setCreatorId(NULL);
+ } else {
+ $this->setCreatorId($v->getId());
+ }
+
+
+ $this->aUser = $v;
+ }
+
+
+
+ public function getUser($con = null)
+ {
+ include_once 'lib/model/om/BaseUserPeer.php';
+
+ if ($this->aUser === null && ($this->creator_id !== null)) {
+
+ $this->aUser = UserPeer::retrieveByPK($this->creator_id, $con);
+
+
+ }
+ return $this->aUser;
+ }
+
+
+ public function initDomainPermissions()
+ {
+ if ($this->collDomainPermissions === null) {
+ $this->collDomainPermissions = array();
+ }
+ }
+
+
+ public function getDomainPermissions($criteria = null, $con = null)
+ {
+ include_once 'lib/model/om/BaseDomainPermissionPeer.php';
+ if ($criteria === null) {
+ $criteria = new Criteria();
+ }
+ elseif ($criteria instanceof Criteria)
+ {
+ $criteria = clone $criteria;
+ }
+
+ if ($this->collDomainPermissions === null) {
+ if ($this->isNew()) {
+ $this->collDomainPermissions = array();
+ } else {
+
+ $criteria->add(DomainPermissionPeer::DOMAIN_ID, $this->getId());
+
+ DomainPermissionPeer::addSelectColumns($criteria);
+ $this->collDomainPermissions = DomainPermissionPeer::doSelect($criteria, $con);
+ }
+ } else {
+ if (!$this->isNew()) {
+
+
+ $criteria->add(DomainPermissionPeer::DOMAIN_ID, $this->getId());
+
+ DomainPermissionPeer::addSelectColumns($criteria);
+ if (!isset($this->lastDomainPermissionCriteria) || !$this->lastDomainPermissionCriteria->equals($criteria)) {
+ $this->collDomainPermissions = DomainPermissionPeer::doSelect($criteria, $con);
+ }
+ }
+ }
+ $this->lastDomainPermissionCriteria = $criteria;
+ return $this->collDomainPermissions;
+ }
+
+
+ public function countDomainPermissions($criteria = null, $distinct = false, $con = null)
+ {
+ include_once 'lib/model/om/BaseDomainPermissionPeer.php';
+ if ($criteria === null) {
+ $criteria = new Criteria();
+ }
+ elseif ($criteria instanceof Criteria)
+ {
+ $criteria = clone $criteria;
+ }
+
+ $criteria->add(DomainPermissionPeer::DOMAIN_ID, $this->getId());
+
+ return DomainPermissionPeer::doCount($criteria, $distinct, $con);
+ }
+
+
+ public function addDomainPermission(DomainPermission $l)
+ {
+ $this->collDomainPermissions[] = $l;
+ $l->setDomain($this);
+ }
+
+
+
+ public function getDomainPermissionsJoinUser($criteria = null, $con = null)
+ {
+ include_once 'lib/model/om/BaseDomainPermissionPeer.php';
+ if ($criteria === null) {
+ $criteria = new Criteria();
+ }
+ elseif ($criteria instanceof Criteria)
+ {
+ $criteria = clone $criteria;
+ }
+
+ if ($this->collDomainPermissions === null) {
+ if ($this->isNew()) {
+ $this->collDomainPermissions = array();
+ } else {
+
+ $criteria->add(DomainPermissionPeer::DOMAIN_ID, $this->getId());
+
+ $this->collDomainPermissions = DomainPermissionPeer::doSelectJoinUser($criteria, $con);
+ }
+ } else {
+
+ $criteria->add(DomainPermissionPeer::DOMAIN_ID, $this->getId());
+
+ if (!isset($this->lastDomainPermissionCriteria) || !$this->lastDomainPermissionCriteria->equals($criteria)) {
+ $this->collDomainPermissions = DomainPermissionPeer::doSelectJoinUser($criteria, $con);
+ }
+ }
+ $this->lastDomainPermissionCriteria = $criteria;
+
+ return $this->collDomainPermissions;
+ }
+
+
+ public function initMailboxs()
+ {
+ if ($this->collMailboxs === null) {
+ $this->collMailboxs = array();
+ }
+ }
+
+
+ public function getMailboxs($criteria = null, $con = null)
+ {
+ include_once 'lib/model/om/BaseMailboxPeer.php';
+ if ($criteria === null) {
+ $criteria = new Criteria();
+ }
+ elseif ($criteria instanceof Criteria)
+ {
+ $criteria = clone $criteria;
+ }
+
+ if ($this->collMailboxs === null) {
+ if ($this->isNew()) {
+ $this->collMailboxs = array();
+ } else {
+
+ $criteria->add(MailboxPeer::DOMAIN_ID, $this->getId());
+
+ MailboxPeer::addSelectColumns($criteria);
+ $this->collMailboxs = MailboxPeer::doSelect($criteria, $con);
+ }
+ } else {
+ if (!$this->isNew()) {
+
+
+ $criteria->add(MailboxPeer::DOMAIN_ID, $this->getId());
+
+ MailboxPeer::addSelectColumns($criteria);
+ if (!isset($this->lastMailboxCriteria) || !$this->lastMailboxCriteria->equals($criteria)) {
+ $this->collMailboxs = MailboxPeer::doSelect($criteria, $con);
+ }
+ }
+ }
+ $this->lastMailboxCriteria = $criteria;
+ return $this->collMailboxs;
+ }
+
+
+ public function countMailboxs($criteria = null, $distinct = false, $con = null)
+ {
+ include_once 'lib/model/om/BaseMailboxPeer.php';
+ if ($criteria === null) {
+ $criteria = new Criteria();
+ }
+ elseif ($criteria instanceof Criteria)
+ {
+ $criteria = clone $criteria;
+ }
+
+ $criteria->add(MailboxPeer::DOMAIN_ID, $this->getId());
+
+ return MailboxPeer::doCount($criteria, $distinct, $con);
+ }
+
+
+ public function addMailbox(Mailbox $l)
+ {
+ $this->collMailboxs[] = $l;
+ $l->setDomain($this);
+ }
+
+
+ public function initAddresss()
+ {
+ if ($this->collAddresss === null) {
+ $this->collAddresss = array();
+ }
+ }
+
+
+ public function getAddresss($criteria = null, $con = null)
+ {
+ include_once 'lib/model/om/BaseAddressPeer.php';
+ if ($criteria === null) {
+ $criteria = new Criteria();
+ }
+ elseif ($criteria instanceof Criteria)
+ {
+ $criteria = clone $criteria;
+ }
+
+ if ($this->collAddresss === null) {
+ if ($this->isNew()) {
+ $this->collAddresss = array();
+ } else {
+
+ $criteria->add(AddressPeer::DOMAIN_ID, $this->getId());
+
+ AddressPeer::addSelectColumns($criteria);
+ $this->collAddresss = AddressPeer::doSelect($criteria, $con);
+ }
+ } else {
+ if (!$this->isNew()) {
+
+
+ $criteria->add(AddressPeer::DOMAIN_ID, $this->getId());
+
+ AddressPeer::addSelectColumns($criteria);
+ if (!isset($this->lastAddressCriteria) || !$this->lastAddressCriteria->equals($criteria)) {
+ $this->collAddresss = AddressPeer::doSelect($criteria, $con);
+ }
+ }
+ }
+ $this->lastAddressCriteria = $criteria;
+ return $this->collAddresss;
+ }
+
+
+ public function countAddresss($criteria = null, $distinct = false, $con = null)
+ {
+ include_once 'lib/model/om/BaseAddressPeer.php';
+ if ($criteria === null) {
+ $criteria = new Criteria();
+ }
+ elseif ($criteria instanceof Criteria)
+ {
+ $criteria = clone $criteria;
+ }
+
+ $criteria->add(AddressPeer::DOMAIN_ID, $this->getId());
+
+ return AddressPeer::doCount($criteria, $distinct, $con);
+ }
+
+
+ public function addAddress(Address $l)
+ {
+ $this->collAddresss[] = $l;
+ $l->setDomain($this);
+ }
+
+
+
+ public function getAddresssJoinMailbox($criteria = null, $con = null)
+ {
+ include_once 'lib/model/om/BaseAddressPeer.php';
+ if ($criteria === null) {
+ $criteria = new Criteria();
+ }
+ elseif ($criteria instanceof Criteria)
+ {
+ $criteria = clone $criteria;
+ }
+
+ if ($this->collAddresss === null) {
+ if ($this->isNew()) {
+ $this->collAddresss = array();
+ } else {
+
+ $criteria->add(AddressPeer::DOMAIN_ID, $this->getId());
+
+ $this->collAddresss = AddressPeer::doSelectJoinMailbox($criteria, $con);
+ }
+ } else {
+
+ $criteria->add(AddressPeer::DOMAIN_ID, $this->getId());
+
+ if (!isset($this->lastAddressCriteria) || !$this->lastAddressCriteria->equals($criteria)) {
+ $this->collAddresss = AddressPeer::doSelectJoinMailbox($criteria, $con);
+ }
+ }
+ $this->lastAddressCriteria = $criteria;
+
+ return $this->collAddresss;
+ }
+
+} \ No newline at end of file
diff --git a/lib/model/om/BaseDomainPeer.php b/lib/model/om/BaseDomainPeer.php
new file mode 100644
index 0000000..93ee281
--- /dev/null
+++ b/lib/model/om/BaseDomainPeer.php
@@ -0,0 +1,591 @@
+<?php
+
+
+abstract class BaseDomainPeer {
+
+
+ const DATABASE_NAME = 'propel';
+
+
+ const TABLE_NAME = 'domain';
+
+
+ const CLASS_DEFAULT = 'lib.model.Domain';
+
+
+ const NUM_COLUMNS = 7;
+
+
+ const NUM_LAZY_LOAD_COLUMNS = 0;
+
+
+
+ const ID = 'domain.ID';
+
+
+ const NAME = 'domain.NAME';
+
+
+ const CREATOR_ID = 'domain.CREATOR_ID';
+
+
+ const MAILBOX_PREFIX = 'domain.MAILBOX_PREFIX';
+
+
+ const MAX_MAILBOX_COUNT = 'domain.MAX_MAILBOX_COUNT';
+
+
+ const QUOTA = 'domain.QUOTA';
+
+
+ const DEFAULT_MAILBOX_QUOTA = 'domain.DEFAULT_MAILBOX_QUOTA';
+
+
+ private static $phpNameMap = null;
+
+
+
+ private static $fieldNames = array (
+ BasePeer::TYPE_PHPNAME => array ('Id', 'Name', 'CreatorId', 'MailboxPrefix', 'MaxMailboxCount', 'Quota', 'DefaultMailboxQuota', ),
+ BasePeer::TYPE_COLNAME => array (DomainPeer::ID, DomainPeer::NAME, DomainPeer::CREATOR_ID, DomainPeer::MAILBOX_PREFIX, DomainPeer::MAX_MAILBOX_COUNT, DomainPeer::QUOTA, DomainPeer::DEFAULT_MAILBOX_QUOTA, ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'creator_id', 'mailbox_prefix', 'max_mailbox_count', 'quota', 'default_mailbox_quota', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, )
+ );
+
+
+ private static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Name' => 1, 'CreatorId' => 2, 'MailboxPrefix' => 3, 'MaxMailboxCount' => 4, 'Quota' => 5, 'DefaultMailboxQuota' => 6, ),
+ BasePeer::TYPE_COLNAME => array (DomainPeer::ID => 0, DomainPeer::NAME => 1, DomainPeer::CREATOR_ID => 2, DomainPeer::MAILBOX_PREFIX => 3, DomainPeer::MAX_MAILBOX_COUNT => 4, DomainPeer::QUOTA => 5, DomainPeer::DEFAULT_MAILBOX_QUOTA => 6, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'creator_id' => 2, 'mailbox_prefix' => 3, 'max_mailbox_count' => 4, 'quota' => 5, 'default_mailbox_quota' => 6, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, )
+ );
+
+
+ public static function getMapBuilder()
+ {
+ include_once 'lib/model/map/DomainMapBuilder.php';
+ return BasePeer::getMapBuilder('lib.model.map.DomainMapBuilder');
+ }
+
+ public static function getPhpNameMap()
+ {
+ if (self::$phpNameMap === null) {
+ $map = DomainPeer::getTableMap();
+ $columns = $map->getColumns();
+ $nameMap = array();
+ foreach ($columns as $column) {
+ $nameMap[$column->getPhpName()] = $column->getColumnName();
+ }
+ self::$phpNameMap = $nameMap;
+ }
+ return self::$phpNameMap;
+ }
+
+ static public function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = self::getFieldNames($toType);
+ $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
+ if ($key === null) {
+ throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
+ }
+ return $toNames[$key];
+ }
+
+
+
+ static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, self::$fieldNames)) {
+ throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.');
+ }
+ return self::$fieldNames[$type];
+ }
+
+
+ public static function alias($alias, $column)
+ {
+ return str_replace(DomainPeer::TABLE_NAME.'.', $alias.'.', $column);
+ }
+
+
+ public static function addSelectColumns(Criteria $criteria)
+ {
+
+ $criteria->addSelectColumn(DomainPeer::ID);
+
+ $criteria->addSelectColumn(DomainPeer::NAME);
+
+ $criteria->addSelectColumn(DomainPeer::CREATOR_ID);
+
+ $criteria->addSelectColumn(DomainPeer::MAILBOX_PREFIX);
+
+ $criteria->addSelectColumn(DomainPeer::MAX_MAILBOX_COUNT);
+
+ $criteria->addSelectColumn(DomainPeer::QUOTA);
+
+ $criteria->addSelectColumn(DomainPeer::DEFAULT_MAILBOX_QUOTA);
+
+ }
+
+ const COUNT = 'COUNT(domain.ID)';
+ const COUNT_DISTINCT = 'COUNT(DISTINCT domain.ID)';
+
+
+ public static function doCount(Criteria $criteria, $distinct = false, $con = null)
+ {
+ $criteria = clone $criteria;
+
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(DomainPeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(DomainPeer::COUNT);
+ }
+
+ foreach($criteria->getGroupByColumns() as $column)
+ {
+ $criteria->addSelectColumn($column);
+ }
+
+ $rs = DomainPeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ return 0;
+ }
+ }
+
+ public static function doSelectOne(Criteria $criteria, $con = null)
+ {
+ $critcopy = clone $criteria;
+ $critcopy->setLimit(1);
+ $objects = DomainPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+ return null;
+ }
+
+ public static function doSelect(Criteria $criteria, $con = null)
+ {
+ return DomainPeer::populateObjects(DomainPeer::doSelectRS($criteria, $con));
+ }
+
+ public static function doSelectRS(Criteria $criteria, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ if (!$criteria->getSelectColumns()) {
+ $criteria = clone $criteria;
+ DomainPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ return BasePeer::doSelect($criteria, $con);
+ }
+
+ public static function populateObjects(ResultSet $rs)
+ {
+ $results = array();
+
+ $cls = DomainPeer::getOMClass();
+ $cls = Propel::import($cls);
+ while($rs->next()) {
+
+ $obj = new $cls();
+ $obj->hydrate($rs);
+ $results[] = $obj;
+
+ }
+ return $results;
+ }
+
+
+ public static function doCountJoinUser(Criteria $criteria, $distinct = false, $con = null)
+ {
+ $criteria = clone $criteria;
+
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(DomainPeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(DomainPeer::COUNT);
+ }
+
+ foreach($criteria->getGroupByColumns() as $column)
+ {
+ $criteria->addSelectColumn($column);
+ }
+
+ $criteria->addJoin(DomainPeer::CREATOR_ID, UserPeer::ID);
+
+ $rs = DomainPeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ return 0;
+ }
+ }
+
+
+
+ public static function doSelectJoinUser(Criteria $c, $con = null)
+ {
+ $c = clone $c;
+
+ if ($c->getDbName() == Propel::getDefaultDB()) {
+ $c->setDbName(self::DATABASE_NAME);
+ }
+
+ DomainPeer::addSelectColumns($c);
+ $startcol = (DomainPeer::NUM_COLUMNS - DomainPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
+ UserPeer::addSelectColumns($c);
+
+ $c->addJoin(DomainPeer::CREATOR_ID, UserPeer::ID);
+ $rs = BasePeer::doSelect($c, $con);
+ $results = array();
+
+ while($rs->next()) {
+
+ $omClass = DomainPeer::getOMClass();
+
+ $cls = Propel::import($omClass);
+ $obj1 = new $cls();
+ $obj1->hydrate($rs);
+
+ $omClass = UserPeer::getOMClass();
+
+ $cls = Propel::import($omClass);
+ $obj2 = new $cls();
+ $obj2->hydrate($rs, $startcol);
+
+ $newObject = true;
+ foreach($results as $temp_obj1) {
+ $temp_obj2 = $temp_obj1->getUser(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
+ $newObject = false;
+ $temp_obj2->addDomain($obj1); break;
+ }
+ }
+ if ($newObject) {
+ $obj2->initDomains();
+ $obj2->addDomain($obj1); }
+ $results[] = $obj1;
+ }
+ return $results;
+ }
+
+
+
+ public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null)
+ {
+ $criteria = clone $criteria;
+
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(DomainPeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(DomainPeer::COUNT);
+ }
+
+ foreach($criteria->getGroupByColumns() as $column)
+ {
+ $criteria->addSelectColumn($column);
+ }
+
+ $criteria->addJoin(DomainPeer::CREATOR_ID, UserPeer::ID);
+
+ $rs = DomainPeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ return 0;
+ }
+ }
+
+
+
+ public static function doSelectJoinAll(Criteria $c, $con = null)
+ {
+ $c = clone $c;
+
+ if ($c->getDbName() == Propel::getDefaultDB()) {
+ $c->setDbName(self::DATABASE_NAME);
+ }
+
+ DomainPeer::addSelectColumns($c);
+ $startcol2 = (DomainPeer::NUM_COLUMNS - DomainPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
+
+ UserPeer::addSelectColumns($c);
+ $startcol3 = $startcol2 + UserPeer::NUM_COLUMNS;
+
+ $c->addJoin(DomainPeer::CREATOR_ID, UserPeer::ID);
+
+ $rs = BasePeer::doSelect($c, $con);
+ $results = array();
+
+ while($rs->next()) {
+
+ $omClass = DomainPeer::getOMClass();
+
+
+ $cls = Propel::import($omClass);
+ $obj1 = new $cls();
+ $obj1->hydrate($rs);
+
+
+
+ $omClass = UserPeer::getOMClass();
+
+
+ $cls = Propel::import($omClass);
+ $obj2 = new $cls();
+ $obj2->hydrate($rs, $startcol2);
+
+ $newObject = true;
+ for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
+ $temp_obj1 = $results[$j];
+ $temp_obj2 = $temp_obj1->getUser(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
+ $newObject = false;
+ $temp_obj2->addDomain($obj1); break;
+ }
+ }
+
+ if ($newObject) {
+ $obj2->initDomains();
+ $obj2->addDomain($obj1);
+ }
+
+ $results[] = $obj1;
+ }
+ return $results;
+ }
+
+
+ public static function getTableMap()
+ {
+ return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
+ }
+
+
+ public static function getOMClass()
+ {
+ return DomainPeer::CLASS_DEFAULT;
+ }
+
+
+ public static function doInsert($values, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; } else {
+ $criteria = $values->buildCriteria(); }
+
+ $criteria->remove(DomainPeer::ID);
+
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ try {
+ $con->begin();
+ $pk = BasePeer::doInsert($criteria, $con);
+ $con->commit();
+ } catch(PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+
+ public static function doUpdate($values, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ $selectCriteria = new Criteria(self::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values;
+ $comparison = $criteria->getComparison(DomainPeer::ID);
+ $selectCriteria->add(DomainPeer::ID, $criteria->remove(DomainPeer::ID), $comparison);
+
+ } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); }
+
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+
+ public static function doDeleteAll($con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+ $affectedRows = 0; try {
+ $con->begin();
+ $affectedRows += DomainPeer::doOnDeleteCascade(new Criteria(), $con);
+ DomainPeer::doOnDeleteSetNull(new Criteria(), $con);
+ $affectedRows += BasePeer::doDeleteAll(DomainPeer::TABLE_NAME, $con);
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+
+ public static function doDelete($values, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(DomainPeer::DATABASE_NAME);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; } elseif ($values instanceof Domain) {
+
+ $criteria = $values->buildPkeyCriteria();
+ } else {
+ $criteria = new Criteria(self::DATABASE_NAME);
+ $criteria->add(DomainPeer::ID, (array) $values, Criteria::IN);
+ }
+
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ $affectedRows = 0;
+ try {
+ $con->begin();
+ $affectedRows += DomainPeer::doOnDeleteCascade($criteria, $con);DomainPeer::doOnDeleteSetNull($criteria, $con);
+ $affectedRows += BasePeer::doDelete($criteria, $con);
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+
+ protected static function doOnDeleteCascade(Criteria $criteria, Connection $con)
+ {
+ $affectedRows = 0;
+
+ $objects = DomainPeer::doSelect($criteria, $con);
+ foreach($objects as $obj) {
+
+
+ include_once 'lib/model/DomainPermission.php';
+
+ $c = new Criteria();
+
+ $c->add(DomainPermissionPeer::DOMAIN_ID, $obj->getId());
+ $affectedRows += DomainPermissionPeer::doDelete($c, $con);
+ }
+ return $affectedRows;
+ }
+
+
+ protected static function doOnDeleteSetNull(Criteria $criteria, Connection $con)
+ {
+
+ $objects = DomainPeer::doSelect($criteria, $con);
+ foreach($objects as $obj) {
+
+ $selectCriteria = new Criteria(DomainPeer::DATABASE_NAME);
+ $updateValues = new Criteria(DomainPeer::DATABASE_NAME);
+ $selectCriteria->add(MailboxPeer::DOMAIN_ID, $obj->getId());
+ $updateValues->add(MailboxPeer::DOMAIN_ID, null);
+
+ BasePeer::doUpdate($selectCriteria, $updateValues, $con);
+ }
+ }
+
+
+ public static function doValidate(Domain $obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(DomainPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(DomainPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach($cols as $colName) {
+ if ($tableMap->containsColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ $res = BasePeer::doValidate(DomainPeer::DATABASE_NAME, DomainPeer::TABLE_NAME, $columns);
+ if ($res !== true) {
+ $request = sfContext::getInstance()->getRequest();
+ foreach ($res as $failed) {
+ $col = DomainPeer::translateFieldname($failed->getColumn(), BasePeer::TYPE_COLNAME, BasePeer::TYPE_PHPNAME);
+ $request->setError($col, $failed->getMessage());
+ }
+ }
+
+ return $res;
+ }
+
+
+ public static function retrieveByPK($pk, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ $criteria = new Criteria(DomainPeer::DATABASE_NAME);
+
+ $criteria->add(DomainPeer::ID, $pk);
+
+
+ $v = DomainPeer::doSelect($criteria, $con);
+
+ return !empty($v) > 0 ? $v[0] : null;
+ }
+
+
+ public static function retrieveByPKs($pks, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ $objs = null;
+ if (empty($pks)) {
+ $objs = array();
+ } else {
+ $criteria = new Criteria();
+ $criteria->add(DomainPeer::ID, $pks, Criteria::IN);
+ $objs = DomainPeer::doSelect($criteria, $con);
+ }
+ return $objs;
+ }
+
+}
+if (Propel::isInit()) {
+ try {
+ BaseDomainPeer::getMapBuilder();
+ } catch (Exception $e) {
+ Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR);
+ }
+} else {
+ require_once 'lib/model/map/DomainMapBuilder.php';
+ Propel::registerMapBuilder('lib.model.map.DomainMapBuilder');
+}
diff --git a/lib/model/om/BaseDomainPermission.php b/lib/model/om/BaseDomainPermission.php
new file mode 100644
index 0000000..48a6e89
--- /dev/null
+++ b/lib/model/om/BaseDomainPermission.php
@@ -0,0 +1,461 @@
+<?php
+
+
+abstract class BaseDomainPermission extends BaseObject implements Persistent {
+
+
+
+ protected static $peer;
+
+
+
+ protected $user_id;
+
+
+
+ protected $domain_id;
+
+
+
+ protected $id;
+
+
+ protected $aUser;
+
+
+ protected $aDomain;
+
+
+ protected $alreadyInSave = false;
+
+
+ protected $alreadyInValidation = false;
+
+
+ public function getUserId()
+ {
+
+ return $this->user_id;
+ }
+
+
+ public function getDomainId()
+ {
+
+ return $this->domain_id;
+ }
+
+
+ public function getId()
+ {
+
+ return $this->id;
+ }
+
+
+ public function setUserId($v)
+ {
+
+ if ($v !== null && !is_int($v) && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->user_id !== $v) {
+ $this->user_id = $v;
+ $this->modifiedColumns[] = DomainPermissionPeer::USER_ID;
+ }
+
+ if ($this->aUser !== null && $this->aUser->getId() !== $v) {
+ $this->aUser = null;
+ }
+
+ }
+
+ public function setDomainId($v)
+ {
+
+ if ($v !== null && !is_int($v) && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->domain_id !== $v) {
+ $this->domain_id = $v;
+ $this->modifiedColumns[] = DomainPermissionPeer::DOMAIN_ID;
+ }
+
+ if ($this->aDomain !== null && $this->aDomain->getId() !== $v) {
+ $this->aDomain = null;
+ }
+
+ }
+
+ public function setId($v)
+ {
+
+ if ($v !== null && !is_int($v) && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = DomainPermissionPeer::ID;
+ }
+
+ }
+
+ public function hydrate(ResultSet $rs, $startcol = 1)
+ {
+ try {
+
+ $this->user_id = $rs->getInt($startcol + 0);
+
+ $this->domain_id = $rs->getInt($startcol + 1);
+
+ $this->id = $rs->getInt($startcol + 2);
+
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ return $startcol + 3;
+ } catch (Exception $e) {
+ throw new PropelException("Error populating DomainPermission object", $e);
+ }
+ }
+
+
+ public function delete($con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("This object has already been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(DomainPermissionPeer::DATABASE_NAME);
+ }
+
+ try {
+ $con->begin();
+ DomainPermissionPeer::doDelete($this, $con);
+ $this->setDeleted(true);
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+
+ public function save($con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("You cannot save an object that has been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(DomainPermissionPeer::DATABASE_NAME);
+ }
+
+ try {
+ $con->begin();
+ $affectedRows = $this->doSave($con);
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+
+ protected function doSave($con)
+ {
+ $affectedRows = 0; if (!$this->alreadyInSave) {
+ $this->alreadyInSave = true;
+
+
+
+ if ($this->aUser !== null) {
+ if ($this->aUser->isModified()) {
+ $affectedRows += $this->aUser->save($con);
+ }
+ $this->setUser($this->aUser);
+ }
+
+ if ($this->aDomain !== null) {
+ if ($this->aDomain->isModified()) {
+ $affectedRows += $this->aDomain->save($con);
+ }
+ $this->setDomain($this->aDomain);
+ }
+
+
+ if ($this->isModified()) {
+ if ($this->isNew()) {
+ $pk = DomainPermissionPeer::doInsert($this, $con);
+ $affectedRows += 1;
+ $this->setId($pk);
+ $this->setNew(false);
+ } else {
+ $affectedRows += DomainPermissionPeer::doUpdate($this, $con);
+ }
+ $this->resetModified(); }
+
+ $this->alreadyInSave = false;
+ }
+ return $affectedRows;
+ }
+
+ protected $validationFailures = array();
+
+
+ public function getValidationFailures()
+ {
+ return $this->validationFailures;
+ }
+
+
+ public function validate($columns = null)
+ {
+ $res = $this->doValidate($columns);
+ if ($res === true) {
+ $this->validationFailures = array();
+ return true;
+ } else {
+ $this->validationFailures = $res;
+ return false;
+ }
+ }
+
+
+ protected function doValidate($columns = null)
+ {
+ if (!$this->alreadyInValidation) {
+ $this->alreadyInValidation = true;
+ $retval = null;
+
+ $failureMap = array();
+
+
+
+ if ($this->aUser !== null) {
+ if (!$this->aUser->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aUser->getValidationFailures());
+ }
+ }
+
+ if ($this->aDomain !== null) {
+ if (!$this->aDomain->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aDomain->getValidationFailures());
+ }
+ }
+
+
+ if (($retval = DomainPermissionPeer::doValidate($this, $columns)) !== true) {
+ $failureMap = array_merge($failureMap, $retval);
+ }
+
+
+
+ $this->alreadyInValidation = false;
+ }
+
+ return (!empty($failureMap) ? $failureMap : true);
+ }
+
+
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = DomainPermissionPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ return $this->getByPosition($pos);
+ }
+
+
+ public function getByPosition($pos)
+ {
+ switch($pos) {
+ case 0:
+ return $this->getUserId();
+ break;
+ case 1:
+ return $this->getDomainId();
+ break;
+ case 2:
+ return $this->getId();
+ break;
+ default:
+ return null;
+ break;
+ } }
+
+
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = DomainPermissionPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getUserId(),
+ $keys[1] => $this->getDomainId(),
+ $keys[2] => $this->getId(),
+ );
+ return $result;
+ }
+
+
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = DomainPermissionPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ return $this->setByPosition($pos, $value);
+ }
+
+
+ public function setByPosition($pos, $value)
+ {
+ switch($pos) {
+ case 0:
+ $this->setUserId($value);
+ break;
+ case 1:
+ $this->setDomainId($value);
+ break;
+ case 2:
+ $this->setId($value);
+ break;
+ } }
+
+
+ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = DomainPermissionPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setUserId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setDomainId($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setId($arr[$keys[2]]);
+ }
+
+
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(DomainPermissionPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(DomainPermissionPeer::USER_ID)) $criteria->add(DomainPermissionPeer::USER_ID, $this->user_id);
+ if ($this->isColumnModified(DomainPermissionPeer::DOMAIN_ID)) $criteria->add(DomainPermissionPeer::DOMAIN_ID, $this->domain_id);
+ if ($this->isColumnModified(DomainPermissionPeer::ID)) $criteria->add(DomainPermissionPeer::ID, $this->id);
+
+ return $criteria;
+ }
+
+
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(DomainPermissionPeer::DATABASE_NAME);
+
+ $criteria->add(DomainPermissionPeer::ID, $this->id);
+
+ return $criteria;
+ }
+
+
+ public function getPrimaryKey()
+ {
+ return $this->getId();
+ }
+
+
+ public function setPrimaryKey($key)
+ {
+ $this->setId($key);
+ }
+
+
+ public function copyInto($copyObj, $deepCopy = false)
+ {
+
+ $copyObj->setUserId($this->user_id);
+
+ $copyObj->setDomainId($this->domain_id);
+
+
+ $copyObj->setNew(true);
+
+ $copyObj->setId(NULL);
+ }
+
+
+ public function copy($deepCopy = false)
+ {
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+ return $copyObj;
+ }
+
+
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new DomainPermissionPeer();
+ }
+ return self::$peer;
+ }
+
+
+ public function setUser($v)
+ {
+
+
+ if ($v === null) {
+ $this->setUserId(NULL);
+ } else {
+ $this->setUserId($v->getId());
+ }
+
+
+ $this->aUser = $v;
+ }
+
+
+
+ public function getUser($con = null)
+ {
+ include_once 'lib/model/om/BaseUserPeer.php';
+
+ if ($this->aUser === null && ($this->user_id !== null)) {
+
+ $this->aUser = UserPeer::retrieveByPK($this->user_id, $con);
+
+
+ }
+ return $this->aUser;
+ }
+
+
+ public function setDomain($v)
+ {
+
+
+ if ($v === null) {
+ $this->setDomainId(NULL);
+ } else {
+ $this->setDomainId($v->getId());
+ }
+
+
+ $this->aDomain = $v;
+ }
+
+
+
+ public function getDomain($con = null)
+ {
+ include_once 'lib/model/om/BaseDomainPeer.php';
+
+ if ($this->aDomain === null && ($this->domain_id !== null)) {
+
+ $this->aDomain = DomainPeer::retrieveByPK($this->domain_id, $con);
+
+
+ }
+ return $this->aDomain;
+ }
+
+} \ No newline at end of file
diff --git a/lib/model/om/BaseDomainPermissionPeer.php b/lib/model/om/BaseDomainPermissionPeer.php
new file mode 100644
index 0000000..747cea0
--- /dev/null
+++ b/lib/model/om/BaseDomainPermissionPeer.php
@@ -0,0 +1,809 @@
+<?php
+
+
+abstract class BaseDomainPermissionPeer {
+
+
+ const DATABASE_NAME = 'propel';
+
+
+ const TABLE_NAME = 'domain_permission';
+
+
+ const CLASS_DEFAULT = 'lib.model.DomainPermission';
+
+
+ const NUM_COLUMNS = 3;
+
+
+ const NUM_LAZY_LOAD_COLUMNS = 0;
+
+
+
+ const USER_ID = 'domain_permission.USER_ID';
+
+
+ const DOMAIN_ID = 'domain_permission.DOMAIN_ID';
+
+
+ const ID = 'domain_permission.ID';
+
+
+ private static $phpNameMap = null;
+
+
+
+ private static $fieldNames = array (
+ BasePeer::TYPE_PHPNAME => array ('UserId', 'DomainId', 'Id', ),
+ BasePeer::TYPE_COLNAME => array (DomainPermissionPeer::USER_ID, DomainPermissionPeer::DOMAIN_ID, DomainPermissionPeer::ID, ),
+ BasePeer::TYPE_FIELDNAME => array ('user_id', 'domain_id', 'id', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, )
+ );
+
+
+ private static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('UserId' => 0, 'DomainId' => 1, 'Id' => 2, ),
+ BasePeer::TYPE_COLNAME => array (DomainPermissionPeer::USER_ID => 0, DomainPermissionPeer::DOMAIN_ID => 1, DomainPermissionPeer::ID => 2, ),
+ BasePeer::TYPE_FIELDNAME => array ('user_id' => 0, 'domain_id' => 1, 'id' => 2, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, )
+ );
+
+
+ public static function getMapBuilder()
+ {
+ include_once 'lib/model/map/DomainPermissionMapBuilder.php';
+ return BasePeer::getMapBuilder('lib.model.map.DomainPermissionMapBuilder');
+ }
+
+ public static function getPhpNameMap()
+ {
+ if (self::$phpNameMap === null) {
+ $map = DomainPermissionPeer::getTableMap();
+ $columns = $map->getColumns();
+ $nameMap = array();
+ foreach ($columns as $column) {
+ $nameMap[$column->getPhpName()] = $column->getColumnName();
+ }
+ self::$phpNameMap = $nameMap;
+ }
+ return self::$phpNameMap;
+ }
+
+ static public function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = self::getFieldNames($toType);
+ $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
+ if ($key === null) {
+ throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
+ }
+ return $toNames[$key];
+ }
+
+
+
+ static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, self::$fieldNames)) {
+ throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.');
+ }
+ return self::$fieldNames[$type];
+ }
+
+
+ public static function alias($alias, $column)
+ {
+ return str_replace(DomainPermissionPeer::TABLE_NAME.'.', $alias.'.', $column);
+ }
+
+
+ public static function addSelectColumns(Criteria $criteria)
+ {
+
+ $criteria->addSelectColumn(DomainPermissionPeer::USER_ID);
+
+ $criteria->addSelectColumn(DomainPermissionPeer::DOMAIN_ID);
+
+ $criteria->addSelectColumn(DomainPermissionPeer::ID);
+
+ }
+
+ const COUNT = 'COUNT(domain_permission.ID)';
+ const COUNT_DISTINCT = 'COUNT(DISTINCT domain_permission.ID)';
+
+
+ public static function doCount(Criteria $criteria, $distinct = false, $con = null)
+ {
+ $criteria = clone $criteria;
+
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(DomainPermissionPeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(DomainPermissionPeer::COUNT);
+ }
+
+ foreach($criteria->getGroupByColumns() as $column)
+ {
+ $criteria->addSelectColumn($column);
+ }
+
+ $rs = DomainPermissionPeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ return 0;
+ }
+ }
+
+ public static function doSelectOne(Criteria $criteria, $con = null)
+ {
+ $critcopy = clone $criteria;
+ $critcopy->setLimit(1);
+ $objects = DomainPermissionPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+ return null;
+ }
+
+ public static function doSelect(Criteria $criteria, $con = null)
+ {
+ return DomainPermissionPeer::populateObjects(DomainPermissionPeer::doSelectRS($criteria, $con));
+ }
+
+ public static function doSelectRS(Criteria $criteria, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ if (!$criteria->getSelectColumns()) {
+ $criteria = clone $criteria;
+ DomainPermissionPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ return BasePeer::doSelect($criteria, $con);
+ }
+
+ public static function populateObjects(ResultSet $rs)
+ {
+ $results = array();
+
+ $cls = DomainPermissionPeer::getOMClass();
+ $cls = Propel::import($cls);
+ while($rs->next()) {
+
+ $obj = new $cls();
+ $obj->hydrate($rs);
+ $results[] = $obj;
+
+ }
+ return $results;
+ }
+
+
+ public static function doCountJoinUser(Criteria $criteria, $distinct = false, $con = null)
+ {
+ $criteria = clone $criteria;
+
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(DomainPermissionPeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(DomainPermissionPeer::COUNT);
+ }
+
+ foreach($criteria->getGroupByColumns() as $column)
+ {
+ $criteria->addSelectColumn($column);
+ }
+
+ $criteria->addJoin(DomainPermissionPeer::USER_ID, UserPeer::ID);
+
+ $rs = DomainPermissionPeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ return 0;
+ }
+ }
+
+
+
+ public static function doCountJoinDomain(Criteria $criteria, $distinct = false, $con = null)
+ {
+ $criteria = clone $criteria;
+
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(DomainPermissionPeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(DomainPermissionPeer::COUNT);
+ }
+
+ foreach($criteria->getGroupByColumns() as $column)
+ {
+ $criteria->addSelectColumn($column);
+ }
+
+ $criteria->addJoin(DomainPermissionPeer::DOMAIN_ID, DomainPeer::ID);
+
+ $rs = DomainPermissionPeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ return 0;
+ }
+ }
+
+
+
+ public static function doSelectJoinUser(Criteria $c, $con = null)
+ {
+ $c = clone $c;
+
+ if ($c->getDbName() == Propel::getDefaultDB()) {
+ $c->setDbName(self::DATABASE_NAME);
+ }
+
+ DomainPermissionPeer::addSelectColumns($c);
+ $startcol = (DomainPermissionPeer::NUM_COLUMNS - DomainPermissionPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
+ UserPeer::addSelectColumns($c);
+
+ $c->addJoin(DomainPermissionPeer::USER_ID, UserPeer::ID);
+ $rs = BasePeer::doSelect($c, $con);
+ $results = array();
+
+ while($rs->next()) {
+
+ $omClass = DomainPermissionPeer::getOMClass();
+
+ $cls = Propel::import($omClass);
+ $obj1 = new $cls();
+ $obj1->hydrate($rs);
+
+ $omClass = UserPeer::getOMClass();
+
+ $cls = Propel::import($omClass);
+ $obj2 = new $cls();
+ $obj2->hydrate($rs, $startcol);
+
+ $newObject = true;
+ foreach($results as $temp_obj1) {
+ $temp_obj2 = $temp_obj1->getUser(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
+ $newObject = false;
+ $temp_obj2->addDomainPermission($obj1); break;
+ }
+ }
+ if ($newObject) {
+ $obj2->initDomainPermissions();
+ $obj2->addDomainPermission($obj1); }
+ $results[] = $obj1;
+ }
+ return $results;
+ }
+
+
+
+ public static function doSelectJoinDomain(Criteria $c, $con = null)
+ {
+ $c = clone $c;
+
+ if ($c->getDbName() == Propel::getDefaultDB()) {
+ $c->setDbName(self::DATABASE_NAME);
+ }
+
+ DomainPermissionPeer::addSelectColumns($c);
+ $startcol = (DomainPermissionPeer::NUM_COLUMNS - DomainPermissionPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
+ DomainPeer::addSelectColumns($c);
+
+ $c->addJoin(DomainPermissionPeer::DOMAIN_ID, DomainPeer::ID);
+ $rs = BasePeer::doSelect($c, $con);
+ $results = array();
+
+ while($rs->next()) {
+
+ $omClass = DomainPermissionPeer::getOMClass();
+
+ $cls = Propel::import($omClass);
+ $obj1 = new $cls();
+ $obj1->hydrate($rs);
+
+ $omClass = DomainPeer::getOMClass();
+
+ $cls = Propel::import($omClass);
+ $obj2 = new $cls();
+ $obj2->hydrate($rs, $startcol);
+
+ $newObject = true;
+ foreach($results as $temp_obj1) {
+ $temp_obj2 = $temp_obj1->getDomain(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
+ $newObject = false;
+ $temp_obj2->addDomainPermission($obj1); break;
+ }
+ }
+ if ($newObject) {
+ $obj2->initDomainPermissions();
+ $obj2->addDomainPermission($obj1); }
+ $results[] = $obj1;
+ }
+ return $results;
+ }
+
+
+
+ public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null)
+ {
+ $criteria = clone $criteria;
+
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(DomainPermissionPeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(DomainPermissionPeer::COUNT);
+ }
+
+ foreach($criteria->getGroupByColumns() as $column)
+ {
+ $criteria->addSelectColumn($column);
+ }
+
+ $criteria->addJoin(DomainPermissionPeer::USER_ID, UserPeer::ID);
+
+ $criteria->addJoin(DomainPermissionPeer::DOMAIN_ID, DomainPeer::ID);
+
+ $rs = DomainPermissionPeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ return 0;
+ }
+ }
+
+
+
+ public static function doSelectJoinAll(Criteria $c, $con = null)
+ {
+ $c = clone $c;
+
+ if ($c->getDbName() == Propel::getDefaultDB()) {
+ $c->setDbName(self::DATABASE_NAME);
+ }
+
+ DomainPermissionPeer::addSelectColumns($c);
+ $startcol2 = (DomainPermissionPeer::NUM_COLUMNS - DomainPermissionPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
+
+ UserPeer::addSelectColumns($c);
+ $startcol3 = $startcol2 + UserPeer::NUM_COLUMNS;
+
+ DomainPeer::addSelectColumns($c);
+ $startcol4 = $startcol3 + DomainPeer::NUM_COLUMNS;
+
+ $c->addJoin(DomainPermissionPeer::USER_ID, UserPeer::ID);
+
+ $c->addJoin(DomainPermissionPeer::DOMAIN_ID, DomainPeer::ID);
+
+ $rs = BasePeer::doSelect($c, $con);
+ $results = array();
+
+ while($rs->next()) {
+
+ $omClass = DomainPermissionPeer::getOMClass();
+
+
+ $cls = Propel::import($omClass);
+ $obj1 = new $cls();
+ $obj1->hydrate($rs);
+
+
+
+ $omClass = UserPeer::getOMClass();
+
+
+ $cls = Propel::import($omClass);
+ $obj2 = new $cls();
+ $obj2->hydrate($rs, $startcol2);
+
+ $newObject = true;
+ for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
+ $temp_obj1 = $results[$j];
+ $temp_obj2 = $temp_obj1->getUser(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
+ $newObject = false;
+ $temp_obj2->addDomainPermission($obj1); break;
+ }
+ }
+
+ if ($newObject) {
+ $obj2->initDomainPermissions();
+ $obj2->addDomainPermission($obj1);
+ }
+
+
+
+ $omClass = DomainPeer::getOMClass();
+
+
+ $cls = Propel::import($omClass);
+ $obj3 = new $cls();
+ $obj3->hydrate($rs, $startcol3);
+
+ $newObject = true;
+ for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
+ $temp_obj1 = $results[$j];
+ $temp_obj3 = $temp_obj1->getDomain(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) {
+ $newObject = false;
+ $temp_obj3->addDomainPermission($obj1); break;
+ }
+ }
+
+ if ($newObject) {
+ $obj3->initDomainPermissions();
+ $obj3->addDomainPermission($obj1);
+ }
+
+ $results[] = $obj1;
+ }
+ return $results;
+ }
+
+
+
+ public static function doCountJoinAllExceptUser(Criteria $criteria, $distinct = false, $con = null)
+ {
+ $criteria = clone $criteria;
+
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(DomainPermissionPeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(DomainPermissionPeer::COUNT);
+ }
+
+ foreach($criteria->getGroupByColumns() as $column)
+ {
+ $criteria->addSelectColumn($column);
+ }
+
+ $criteria->addJoin(DomainPermissionPeer::DOMAIN_ID, DomainPeer::ID);
+
+ $rs = DomainPermissionPeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ return 0;
+ }
+ }
+
+
+
+ public static function doCountJoinAllExceptDomain(Criteria $criteria, $distinct = false, $con = null)
+ {
+ $criteria = clone $criteria;
+
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(DomainPermissionPeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(DomainPermissionPeer::COUNT);
+ }
+
+ foreach($criteria->getGroupByColumns() as $column)
+ {
+ $criteria->addSelectColumn($column);
+ }
+
+ $criteria->addJoin(DomainPermissionPeer::USER_ID, UserPeer::ID);
+
+ $rs = DomainPermissionPeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ return 0;
+ }
+ }
+
+
+
+ public static function doSelectJoinAllExceptUser(Criteria $c, $con = null)
+ {
+ $c = clone $c;
+
+ if ($c->getDbName() == Propel::getDefaultDB()) {
+ $c->setDbName(self::DATABASE_NAME);
+ }
+
+ DomainPermissionPeer::addSelectColumns($c);
+ $startcol2 = (DomainPermissionPeer::NUM_COLUMNS - DomainPermissionPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
+
+ DomainPeer::addSelectColumns($c);
+ $startcol3 = $startcol2 + DomainPeer::NUM_COLUMNS;
+
+ $c->addJoin(DomainPermissionPeer::DOMAIN_ID, DomainPeer::ID);
+
+
+ $rs = BasePeer::doSelect($c, $con);
+ $results = array();
+
+ while($rs->next()) {
+
+ $omClass = DomainPermissionPeer::getOMClass();
+
+ $cls = Propel::import($omClass);
+ $obj1 = new $cls();
+ $obj1->hydrate($rs);
+
+ $omClass = DomainPeer::getOMClass();
+
+
+ $cls = Propel::import($omClass);
+ $obj2 = new $cls();
+ $obj2->hydrate($rs, $startcol2);
+
+ $newObject = true;
+ for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
+ $temp_obj1 = $results[$j];
+ $temp_obj2 = $temp_obj1->getDomain(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
+ $newObject = false;
+ $temp_obj2->addDomainPermission($obj1);
+ break;
+ }
+ }
+
+ if ($newObject) {
+ $obj2->initDomainPermissions();
+ $obj2->addDomainPermission($obj1);
+ }
+
+ $results[] = $obj1;
+ }
+ return $results;
+ }
+
+
+
+ public static function doSelectJoinAllExceptDomain(Criteria $c, $con = null)
+ {
+ $c = clone $c;
+
+ if ($c->getDbName() == Propel::getDefaultDB()) {
+ $c->setDbName(self::DATABASE_NAME);
+ }
+
+ DomainPermissionPeer::addSelectColumns($c);
+ $startcol2 = (DomainPermissionPeer::NUM_COLUMNS - DomainPermissionPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
+
+ UserPeer::addSelectColumns($c);
+ $startcol3 = $startcol2 + UserPeer::NUM_COLUMNS;
+
+ $c->addJoin(DomainPermissionPeer::USER_ID, UserPeer::ID);
+
+
+ $rs = BasePeer::doSelect($c, $con);
+ $results = array();
+
+ while($rs->next()) {
+
+ $omClass = DomainPermissionPeer::getOMClass();
+
+ $cls = Propel::import($omClass);
+ $obj1 = new $cls();
+ $obj1->hydrate($rs);
+
+ $omClass = UserPeer::getOMClass();
+
+
+ $cls = Propel::import($omClass);
+ $obj2 = new $cls();
+ $obj2->hydrate($rs, $startcol2);
+
+ $newObject = true;
+ for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
+ $temp_obj1 = $results[$j];
+ $temp_obj2 = $temp_obj1->getUser(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
+ $newObject = false;
+ $temp_obj2->addDomainPermission($obj1);
+ break;
+ }
+ }
+
+ if ($newObject) {
+ $obj2->initDomainPermissions();
+ $obj2->addDomainPermission($obj1);
+ }
+
+ $results[] = $obj1;
+ }
+ return $results;
+ }
+
+
+ public static function getTableMap()
+ {
+ return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
+ }
+
+
+ public static function getOMClass()
+ {
+ return DomainPermissionPeer::CLASS_DEFAULT;
+ }
+
+
+ public static function doInsert($values, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; } else {
+ $criteria = $values->buildCriteria(); }
+
+ $criteria->remove(DomainPermissionPeer::ID);
+
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ try {
+ $con->begin();
+ $pk = BasePeer::doInsert($criteria, $con);
+ $con->commit();
+ } catch(PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+
+ public static function doUpdate($values, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ $selectCriteria = new Criteria(self::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values;
+ $comparison = $criteria->getComparison(DomainPermissionPeer::ID);
+ $selectCriteria->add(DomainPermissionPeer::ID, $criteria->remove(DomainPermissionPeer::ID), $comparison);
+
+ } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); }
+
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+
+ public static function doDeleteAll($con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+ $affectedRows = 0; try {
+ $con->begin();
+ $affectedRows += BasePeer::doDeleteAll(DomainPermissionPeer::TABLE_NAME, $con);
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+
+ public static function doDelete($values, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(DomainPermissionPeer::DATABASE_NAME);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; } elseif ($values instanceof DomainPermission) {
+
+ $criteria = $values->buildPkeyCriteria();
+ } else {
+ $criteria = new Criteria(self::DATABASE_NAME);
+ $criteria->add(DomainPermissionPeer::ID, (array) $values, Criteria::IN);
+ }
+
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ $affectedRows = 0;
+ try {
+ $con->begin();
+
+ $affectedRows += BasePeer::doDelete($criteria, $con);
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+
+ public static function doValidate(DomainPermission $obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(DomainPermissionPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(DomainPermissionPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach($cols as $colName) {
+ if ($tableMap->containsColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ $res = BasePeer::doValidate(DomainPermissionPeer::DATABASE_NAME, DomainPermissionPeer::TABLE_NAME, $columns);
+ if ($res !== true) {
+ $request = sfContext::getInstance()->getRequest();
+ foreach ($res as $failed) {
+ $col = DomainPermissionPeer::translateFieldname($failed->getColumn(), BasePeer::TYPE_COLNAME, BasePeer::TYPE_PHPNAME);
+ $request->setError($col, $failed->getMessage());
+ }
+ }
+
+ return $res;
+ }
+
+
+ public static function retrieveByPK($pk, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ $criteria = new Criteria(DomainPermissionPeer::DATABASE_NAME);
+
+ $criteria->add(DomainPermissionPeer::ID, $pk);
+
+
+ $v = DomainPermissionPeer::doSelect($criteria, $con);
+
+ return !empty($v) > 0 ? $v[0] : null;
+ }
+
+
+ public static function retrieveByPKs($pks, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ $objs = null;
+ if (empty($pks)) {
+ $objs = array();
+ } else {
+ $criteria = new Criteria();
+ $criteria->add(DomainPermissionPeer::ID, $pks, Criteria::IN);
+ $objs = DomainPermissionPeer::doSelect($criteria, $con);
+ }
+ return $objs;
+ }
+
+}
+if (Propel::isInit()) {
+ try {
+ BaseDomainPermissionPeer::getMapBuilder();
+ } catch (Exception $e) {
+ Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR);
+ }
+} else {
+ require_once 'lib/model/map/DomainPermissionMapBuilder.php';
+ Propel::registerMapBuilder('lib.model.map.DomainPermissionMapBuilder');
+}
diff --git a/lib/model/om/BaseLogEntry.php b/lib/model/om/BaseLogEntry.php
new file mode 100644
index 0000000..5bf1f41
--- /dev/null
+++ b/lib/model/om/BaseLogEntry.php
@@ -0,0 +1,548 @@
+<?php
+
+
+abstract class BaseLogEntry extends BaseObject implements Persistent {
+
+
+
+ protected static $peer;
+
+
+
+ protected $id;
+
+
+
+ protected $user_id = 0;
+
+
+
+ protected $created_at;
+
+
+
+ protected $message;
+
+
+
+ protected $host;
+
+
+
+ protected $priority;
+
+
+ protected $aUser;
+
+
+ protected $alreadyInSave = false;
+
+
+ protected $alreadyInValidation = false;
+
+
+ public function getId()
+ {
+
+ return $this->id;
+ }
+
+
+ public function getUserId()
+ {
+
+ return $this->user_id;
+ }
+
+
+ public function getCreatedAt($format = 'Y-m-d H:i:s')
+ {
+
+ if ($this->created_at === null || $this->created_at === '') {
+ return null;
+ } elseif (!is_int($this->created_at)) {
+ $ts = strtotime($this->created_at);
+ if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse value of [created_at] as date/time value: " . var_export($this->created_at, true));
+ }
+ } else {
+ $ts = $this->created_at;
+ }
+ if ($format === null) {
+ return $ts;
+ } elseif (strpos($format, '%') !== false) {
+ return strftime($format, $ts);
+ } else {
+ return date($format, $ts);
+ }
+ }
+
+
+ public function getMessage()
+ {
+
+ return $this->message;
+ }
+
+
+ public function getHost()
+ {
+
+ return $this->host;
+ }
+
+
+ public function getPriority()
+ {
+
+ return $this->priority;
+ }
+
+
+ public function setId($v)
+ {
+
+ if ($v !== null && !is_int($v) && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = LogEntryPeer::ID;
+ }
+
+ }
+
+ public function setUserId($v)
+ {
+
+ if ($v !== null && !is_int($v) && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->user_id !== $v || $v === 0) {
+ $this->user_id = $v;
+ $this->modifiedColumns[] = LogEntryPeer::USER_ID;
+ }
+
+ if ($this->aUser !== null && $this->aUser->getId() !== $v) {
+ $this->aUser = null;
+ }
+
+ }
+
+ public function setCreatedAt($v)
+ {
+
+ if ($v !== null && !is_int($v)) {
+ $ts = strtotime($v);
+ if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse date/time value for [created_at] from input: " . var_export($v, true));
+ }
+ } else {
+ $ts = $v;
+ }
+ if ($this->created_at !== $ts) {
+ $this->created_at = $ts;
+ $this->modifiedColumns[] = LogEntryPeer::CREATED_AT;
+ }
+
+ }
+
+ public function setMessage($v)
+ {
+
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->message !== $v) {
+ $this->message = $v;
+ $this->modifiedColumns[] = LogEntryPeer::MESSAGE;
+ }
+
+ }
+
+ public function setHost($v)
+ {
+
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->host !== $v) {
+ $this->host = $v;
+ $this->modifiedColumns[] = LogEntryPeer::HOST;
+ }
+
+ }
+
+ public function setPriority($v)
+ {
+
+ if ($v !== null && !is_int($v) && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->priority !== $v) {
+ $this->priority = $v;
+ $this->modifiedColumns[] = LogEntryPeer::PRIORITY;
+ }
+
+ }
+
+ public function hydrate(ResultSet $rs, $startcol = 1)
+ {
+ try {
+
+ $this->id = $rs->getInt($startcol + 0);
+
+ $this->user_id = $rs->getInt($startcol + 1);
+
+ $this->created_at = $rs->getTimestamp($startcol + 2, null);
+
+ $this->message = $rs->getString($startcol + 3);
+
+ $this->host = $rs->getString($startcol + 4);
+
+ $this->priority = $rs->getInt($startcol + 5);
+
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ return $startcol + 6;
+ } catch (Exception $e) {
+ throw new PropelException("Error populating LogEntry object", $e);
+ }
+ }
+
+
+ public function delete($con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("This object has already been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(LogEntryPeer::DATABASE_NAME);
+ }
+
+ try {
+ $con->begin();
+ LogEntryPeer::doDelete($this, $con);
+ $this->setDeleted(true);
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+
+ public function save($con = null)
+ {
+ if ($this->isNew() && !$this->isColumnModified(LogEntryPeer::CREATED_AT))
+ {
+ $this->setCreatedAt(time());
+ }
+
+ if ($this->isDeleted()) {
+ throw new PropelException("You cannot save an object that has been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(LogEntryPeer::DATABASE_NAME);
+ }
+
+ try {
+ $con->begin();
+ $affectedRows = $this->doSave($con);
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+
+ protected function doSave($con)
+ {
+ $affectedRows = 0; if (!$this->alreadyInSave) {
+ $this->alreadyInSave = true;
+
+
+
+ if ($this->aUser !== null) {
+ if ($this->aUser->isModified()) {
+ $affectedRows += $this->aUser->save($con);
+ }
+ $this->setUser($this->aUser);
+ }
+
+
+ if ($this->isModified()) {
+ if ($this->isNew()) {
+ $pk = LogEntryPeer::doInsert($this, $con);
+ $affectedRows += 1;
+ $this->setId($pk);
+ $this->setNew(false);
+ } else {
+ $affectedRows += LogEntryPeer::doUpdate($this, $con);
+ }
+ $this->resetModified(); }
+
+ $this->alreadyInSave = false;
+ }
+ return $affectedRows;
+ }
+
+ protected $validationFailures = array();
+
+
+ public function getValidationFailures()
+ {
+ return $this->validationFailures;
+ }
+
+
+ public function validate($columns = null)
+ {
+ $res = $this->doValidate($columns);
+ if ($res === true) {
+ $this->validationFailures = array();
+ return true;
+ } else {
+ $this->validationFailures = $res;
+ return false;
+ }
+ }
+
+
+ protected function doValidate($columns = null)
+ {
+ if (!$this->alreadyInValidation) {
+ $this->alreadyInValidation = true;
+ $retval = null;
+
+ $failureMap = array();
+
+
+
+ if ($this->aUser !== null) {
+ if (!$this->aUser->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aUser->getValidationFailures());
+ }
+ }
+
+
+ if (($retval = LogEntryPeer::doValidate($this, $columns)) !== true) {
+ $failureMap = array_merge($failureMap, $retval);
+ }
+
+
+
+ $this->alreadyInValidation = false;
+ }
+
+ return (!empty($failureMap) ? $failureMap : true);
+ }
+
+
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = LogEntryPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ return $this->getByPosition($pos);
+ }
+
+
+ public function getByPosition($pos)
+ {
+ switch($pos) {
+ case 0:
+ return $this->getId();
+ break;
+ case 1:
+ return $this->getUserId();
+ break;
+ case 2:
+ return $this->getCreatedAt();
+ break;
+ case 3:
+ return $this->getMessage();
+ break;
+ case 4:
+ return $this->getHost();
+ break;
+ case 5:
+ return $this->getPriority();
+ break;
+ default:
+ return null;
+ break;
+ } }
+
+
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = LogEntryPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getUserId(),
+ $keys[2] => $this->getCreatedAt(),
+ $keys[3] => $this->getMessage(),
+ $keys[4] => $this->getHost(),
+ $keys[5] => $this->getPriority(),
+ );
+ return $result;
+ }
+
+
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = LogEntryPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ return $this->setByPosition($pos, $value);
+ }
+
+
+ public function setByPosition($pos, $value)
+ {
+ switch($pos) {
+ case 0:
+ $this->setId($value);
+ break;
+ case 1:
+ $this->setUserId($value);
+ break;
+ case 2:
+ $this->setCreatedAt($value);
+ break;
+ case 3:
+ $this->setMessage($value);
+ break;
+ case 4:
+ $this->setHost($value);
+ break;
+ case 5:
+ $this->setPriority($value);
+ break;
+ } }
+
+
+ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = LogEntryPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setUserId($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setCreatedAt($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setMessage($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setHost($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setPriority($arr[$keys[5]]);
+ }
+
+
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(LogEntryPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(LogEntryPeer::ID)) $criteria->add(LogEntryPeer::ID, $this->id);
+ if ($this->isColumnModified(LogEntryPeer::USER_ID)) $criteria->add(LogEntryPeer::USER_ID, $this->user_id);
+ if ($this->isColumnModified(LogEntryPeer::CREATED_AT)) $criteria->add(LogEntryPeer::CREATED_AT, $this->created_at);
+ if ($this->isColumnModified(LogEntryPeer::MESSAGE)) $criteria->add(LogEntryPeer::MESSAGE, $this->message);
+ if ($this->isColumnModified(LogEntryPeer::HOST)) $criteria->add(LogEntryPeer::HOST, $this->host);
+ if ($this->isColumnModified(LogEntryPeer::PRIORITY)) $criteria->add(LogEntryPeer::PRIORITY, $this->priority);
+
+ return $criteria;
+ }
+
+
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(LogEntryPeer::DATABASE_NAME);
+
+ $criteria->add(LogEntryPeer::ID, $this->id);
+
+ return $criteria;
+ }
+
+
+ public function getPrimaryKey()
+ {
+ return $this->getId();
+ }
+
+
+ public function setPrimaryKey($key)
+ {
+ $this->setId($key);
+ }
+
+
+ public function copyInto($copyObj, $deepCopy = false)
+ {
+
+ $copyObj->setUserId($this->user_id);
+
+ $copyObj->setCreatedAt($this->created_at);
+
+ $copyObj->setMessage($this->message);
+
+ $copyObj->setHost($this->host);
+
+ $copyObj->setPriority($this->priority);
+
+
+ $copyObj->setNew(true);
+
+ $copyObj->setId(NULL);
+ }
+
+
+ public function copy($deepCopy = false)
+ {
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+ return $copyObj;
+ }
+
+
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new LogEntryPeer();
+ }
+ return self::$peer;
+ }
+
+
+ public function setUser($v)
+ {
+
+
+ if ($v === null) {
+ $this->setUserId('null');
+ } else {
+ $this->setUserId($v->getId());
+ }
+
+
+ $this->aUser = $v;
+ }
+
+
+
+ public function getUser($con = null)
+ {
+ include_once 'lib/model/om/BaseUserPeer.php';
+
+ if ($this->aUser === null && ($this->user_id !== null)) {
+
+ $this->aUser = UserPeer::retrieveByPK($this->user_id, $con);
+
+
+ }
+ return $this->aUser;
+ }
+
+} \ No newline at end of file
diff --git a/lib/model/om/BaseLogEntryPeer.php b/lib/model/om/BaseLogEntryPeer.php
new file mode 100644
index 0000000..2b3d8ec
--- /dev/null
+++ b/lib/model/om/BaseLogEntryPeer.php
@@ -0,0 +1,549 @@
+<?php
+
+
+abstract class BaseLogEntryPeer {
+
+
+ const DATABASE_NAME = 'propel';
+
+
+ const TABLE_NAME = 'log';
+
+
+ const CLASS_DEFAULT = 'lib.model.LogEntry';
+
+
+ const NUM_COLUMNS = 6;
+
+
+ const NUM_LAZY_LOAD_COLUMNS = 0;
+
+
+
+ const ID = 'log.ID';
+
+
+ const USER_ID = 'log.USER_ID';
+
+
+ const CREATED_AT = 'log.CREATED_AT';
+
+
+ const MESSAGE = 'log.MESSAGE';
+
+
+ const HOST = 'log.HOST';
+
+
+ const PRIORITY = 'log.PRIORITY';
+
+
+ private static $phpNameMap = null;
+
+
+
+ private static $fieldNames = array (
+ BasePeer::TYPE_PHPNAME => array ('Id', 'UserId', 'CreatedAt', 'Message', 'Host', 'Priority', ),
+ BasePeer::TYPE_COLNAME => array (LogEntryPeer::ID, LogEntryPeer::USER_ID, LogEntryPeer::CREATED_AT, LogEntryPeer::MESSAGE, LogEntryPeer::HOST, LogEntryPeer::PRIORITY, ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'user_id', 'created_at', 'message', 'host', 'priority', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
+ );
+
+
+ private static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'UserId' => 1, 'CreatedAt' => 2, 'Message' => 3, 'Host' => 4, 'Priority' => 5, ),
+ BasePeer::TYPE_COLNAME => array (LogEntryPeer::ID => 0, LogEntryPeer::USER_ID => 1, LogEntryPeer::CREATED_AT => 2, LogEntryPeer::MESSAGE => 3, LogEntryPeer::HOST => 4, LogEntryPeer::PRIORITY => 5, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'user_id' => 1, 'created_at' => 2, 'message' => 3, 'host' => 4, 'priority' => 5, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
+ );
+
+
+ public static function getMapBuilder()
+ {
+ include_once 'lib/model/map/LogEntryMapBuilder.php';
+ return BasePeer::getMapBuilder('lib.model.map.LogEntryMapBuilder');
+ }
+
+ public static function getPhpNameMap()
+ {
+ if (self::$phpNameMap === null) {
+ $map = LogEntryPeer::getTableMap();
+ $columns = $map->getColumns();
+ $nameMap = array();
+ foreach ($columns as $column) {
+ $nameMap[$column->getPhpName()] = $column->getColumnName();
+ }
+ self::$phpNameMap = $nameMap;
+ }
+ return self::$phpNameMap;
+ }
+
+ static public function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = self::getFieldNames($toType);
+ $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
+ if ($key === null) {
+ throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
+ }
+ return $toNames[$key];
+ }
+
+
+
+ static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, self::$fieldNames)) {
+ throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.');
+ }
+ return self::$fieldNames[$type];
+ }
+
+
+ public static function alias($alias, $column)
+ {
+ return str_replace(LogEntryPeer::TABLE_NAME.'.', $alias.'.', $column);
+ }
+
+
+ public static function addSelectColumns(Criteria $criteria)
+ {
+
+ $criteria->addSelectColumn(LogEntryPeer::ID);
+
+ $criteria->addSelectColumn(LogEntryPeer::USER_ID);
+
+ $criteria->addSelectColumn(LogEntryPeer::CREATED_AT);
+
+ $criteria->addSelectColumn(LogEntryPeer::MESSAGE);
+
+ $criteria->addSelectColumn(LogEntryPeer::HOST);
+
+ $criteria->addSelectColumn(LogEntryPeer::PRIORITY);
+
+ }
+
+ const COUNT = 'COUNT(log.ID)';
+ const COUNT_DISTINCT = 'COUNT(DISTINCT log.ID)';
+
+
+ public static function doCount(Criteria $criteria, $distinct = false, $con = null)
+ {
+ $criteria = clone $criteria;
+
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(LogEntryPeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(LogEntryPeer::COUNT);
+ }
+
+ foreach($criteria->getGroupByColumns() as $column)
+ {
+ $criteria->addSelectColumn($column);
+ }
+
+ $rs = LogEntryPeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ return 0;
+ }
+ }
+
+ public static function doSelectOne(Criteria $criteria, $con = null)
+ {
+ $critcopy = clone $criteria;
+ $critcopy->setLimit(1);
+ $objects = LogEntryPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+ return null;
+ }
+
+ public static function doSelect(Criteria $criteria, $con = null)
+ {
+ return LogEntryPeer::populateObjects(LogEntryPeer::doSelectRS($criteria, $con));
+ }
+
+ public static function doSelectRS(Criteria $criteria, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ if (!$criteria->getSelectColumns()) {
+ $criteria = clone $criteria;
+ LogEntryPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ return BasePeer::doSelect($criteria, $con);
+ }
+
+ public static function populateObjects(ResultSet $rs)
+ {
+ $results = array();
+
+ $cls = LogEntryPeer::getOMClass();
+ $cls = Propel::import($cls);
+ while($rs->next()) {
+
+ $obj = new $cls();
+ $obj->hydrate($rs);
+ $results[] = $obj;
+
+ }
+ return $results;
+ }
+
+
+ public static function doCountJoinUser(Criteria $criteria, $distinct = false, $con = null)
+ {
+ $criteria = clone $criteria;
+
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(LogEntryPeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(LogEntryPeer::COUNT);
+ }
+
+ foreach($criteria->getGroupByColumns() as $column)
+ {
+ $criteria->addSelectColumn($column);
+ }
+
+ $criteria->addJoin(LogEntryPeer::USER_ID, UserPeer::ID);
+
+ $rs = LogEntryPeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ return 0;
+ }
+ }
+
+
+
+ public static function doSelectJoinUser(Criteria $c, $con = null)
+ {
+ $c = clone $c;
+
+ if ($c->getDbName() == Propel::getDefaultDB()) {
+ $c->setDbName(self::DATABASE_NAME);
+ }
+
+ LogEntryPeer::addSelectColumns($c);
+ $startcol = (LogEntryPeer::NUM_COLUMNS - LogEntryPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
+ UserPeer::addSelectColumns($c);
+
+ $c->addJoin(LogEntryPeer::USER_ID, UserPeer::ID);
+ $rs = BasePeer::doSelect($c, $con);
+ $results = array();
+
+ while($rs->next()) {
+
+ $omClass = LogEntryPeer::getOMClass();
+
+ $cls = Propel::import($omClass);
+ $obj1 = new $cls();
+ $obj1->hydrate($rs);
+
+ $omClass = UserPeer::getOMClass();
+
+ $cls = Propel::import($omClass);
+ $obj2 = new $cls();
+ $obj2->hydrate($rs, $startcol);
+
+ $newObject = true;
+ foreach($results as $temp_obj1) {
+ $temp_obj2 = $temp_obj1->getUser(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
+ $newObject = false;
+ $temp_obj2->addLogEntry($obj1); break;
+ }
+ }
+ if ($newObject) {
+ $obj2->initLogEntrys();
+ $obj2->addLogEntry($obj1); }
+ $results[] = $obj1;
+ }
+ return $results;
+ }
+
+
+
+ public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null)
+ {
+ $criteria = clone $criteria;
+
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(LogEntryPeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(LogEntryPeer::COUNT);
+ }
+
+ foreach($criteria->getGroupByColumns() as $column)
+ {
+ $criteria->addSelectColumn($column);
+ }
+
+ $criteria->addJoin(LogEntryPeer::USER_ID, UserPeer::ID);
+
+ $rs = LogEntryPeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ return 0;
+ }
+ }
+
+
+
+ public static function doSelectJoinAll(Criteria $c, $con = null)
+ {
+ $c = clone $c;
+
+ if ($c->getDbName() == Propel::getDefaultDB()) {
+ $c->setDbName(self::DATABASE_NAME);
+ }
+
+ LogEntryPeer::addSelectColumns($c);
+ $startcol2 = (LogEntryPeer::NUM_COLUMNS - LogEntryPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
+
+ UserPeer::addSelectColumns($c);
+ $startcol3 = $startcol2 + UserPeer::NUM_COLUMNS;
+
+ $c->addJoin(LogEntryPeer::USER_ID, UserPeer::ID);
+
+ $rs = BasePeer::doSelect($c, $con);
+ $results = array();
+
+ while($rs->next()) {
+
+ $omClass = LogEntryPeer::getOMClass();
+
+
+ $cls = Propel::import($omClass);
+ $obj1 = new $cls();
+ $obj1->hydrate($rs);
+
+
+
+ $omClass = UserPeer::getOMClass();
+
+
+ $cls = Propel::import($omClass);
+ $obj2 = new $cls();
+ $obj2->hydrate($rs, $startcol2);
+
+ $newObject = true;
+ for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
+ $temp_obj1 = $results[$j];
+ $temp_obj2 = $temp_obj1->getUser(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
+ $newObject = false;
+ $temp_obj2->addLogEntry($obj1); break;
+ }
+ }
+
+ if ($newObject) {
+ $obj2->initLogEntrys();
+ $obj2->addLogEntry($obj1);
+ }
+
+ $results[] = $obj1;
+ }
+ return $results;
+ }
+
+
+ public static function getTableMap()
+ {
+ return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
+ }
+
+
+ public static function getOMClass()
+ {
+ return LogEntryPeer::CLASS_DEFAULT;
+ }
+
+
+ public static function doInsert($values, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; } else {
+ $criteria = $values->buildCriteria(); }
+
+ $criteria->remove(LogEntryPeer::ID);
+
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ try {
+ $con->begin();
+ $pk = BasePeer::doInsert($criteria, $con);
+ $con->commit();
+ } catch(PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+
+ public static function doUpdate($values, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ $selectCriteria = new Criteria(self::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values;
+ $comparison = $criteria->getComparison(LogEntryPeer::ID);
+ $selectCriteria->add(LogEntryPeer::ID, $criteria->remove(LogEntryPeer::ID), $comparison);
+
+ } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); }
+
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+
+ public static function doDeleteAll($con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+ $affectedRows = 0; try {
+ $con->begin();
+ $affectedRows += BasePeer::doDeleteAll(LogEntryPeer::TABLE_NAME, $con);
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+
+ public static function doDelete($values, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(LogEntryPeer::DATABASE_NAME);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; } elseif ($values instanceof LogEntry) {
+
+ $criteria = $values->buildPkeyCriteria();
+ } else {
+ $criteria = new Criteria(self::DATABASE_NAME);
+ $criteria->add(LogEntryPeer::ID, (array) $values, Criteria::IN);
+ }
+
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ $affectedRows = 0;
+ try {
+ $con->begin();
+
+ $affectedRows += BasePeer::doDelete($criteria, $con);
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+
+ public static function doValidate(LogEntry $obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(LogEntryPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(LogEntryPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach($cols as $colName) {
+ if ($tableMap->containsColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ $res = BasePeer::doValidate(LogEntryPeer::DATABASE_NAME, LogEntryPeer::TABLE_NAME, $columns);
+ if ($res !== true) {
+ $request = sfContext::getInstance()->getRequest();
+ foreach ($res as $failed) {
+ $col = LogEntryPeer::translateFieldname($failed->getColumn(), BasePeer::TYPE_COLNAME, BasePeer::TYPE_PHPNAME);
+ $request->setError($col, $failed->getMessage());
+ }
+ }
+
+ return $res;
+ }
+
+
+ public static function retrieveByPK($pk, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ $criteria = new Criteria(LogEntryPeer::DATABASE_NAME);
+
+ $criteria->add(LogEntryPeer::ID, $pk);
+
+
+ $v = LogEntryPeer::doSelect($criteria, $con);
+
+ return !empty($v) > 0 ? $v[0] : null;
+ }
+
+
+ public static function retrieveByPKs($pks, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ $objs = null;
+ if (empty($pks)) {
+ $objs = array();
+ } else {
+ $criteria = new Criteria();
+ $criteria->add(LogEntryPeer::ID, $pks, Criteria::IN);
+ $objs = LogEntryPeer::doSelect($criteria, $con);
+ }
+ return $objs;
+ }
+
+}
+if (Propel::isInit()) {
+ try {
+ BaseLogEntryPeer::getMapBuilder();
+ } catch (Exception $e) {
+ Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR);
+ }
+} else {
+ require_once 'lib/model/map/LogEntryMapBuilder.php';
+ Propel::registerMapBuilder('lib.model.map.LogEntryMapBuilder');
+}
diff --git a/lib/model/om/BaseMailbox.php b/lib/model/om/BaseMailbox.php
new file mode 100644
index 0000000..cda4d2f
--- /dev/null
+++ b/lib/model/om/BaseMailbox.php
@@ -0,0 +1,751 @@
+<?php
+
+
+abstract class BaseMailbox extends BaseObject implements Persistent {
+
+
+
+ protected static $peer;
+
+
+
+ protected $id;
+
+
+
+ protected $domain_id;
+
+
+
+ protected $name;
+
+
+
+ protected $password;
+
+
+
+ protected $max_quota;
+
+
+
+ protected $max_address_count;
+
+
+
+ protected $last_login;
+
+
+
+ protected $active = true;
+
+
+ protected $aDomain;
+
+
+ protected $collAddresss;
+
+
+ protected $lastAddressCriteria = null;
+
+
+ protected $alreadyInSave = false;
+
+
+ protected $alreadyInValidation = false;
+
+
+ public function getId()
+ {
+
+ return $this->id;
+ }
+
+
+ public function getDomainId()
+ {
+
+ return $this->domain_id;
+ }
+
+
+ public function getName()
+ {
+
+ return $this->name;
+ }
+
+
+ public function getPassword()
+ {
+
+ return $this->password;
+ }
+
+
+ public function getMaxQuota()
+ {
+
+ return $this->max_quota;
+ }
+
+
+ public function getMaxAddressCount()
+ {
+
+ return $this->max_address_count;
+ }
+
+
+ public function getLastLogin($format = 'Y-m-d H:i:s')
+ {
+
+ if ($this->last_login === null || $this->last_login === '') {
+ return null;
+ } elseif (!is_int($this->last_login)) {
+ $ts = strtotime($this->last_login);
+ if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse value of [last_login] as date/time value: " . var_export($this->last_login, true));
+ }
+ } else {
+ $ts = $this->last_login;
+ }
+ if ($format === null) {
+ return $ts;
+ } elseif (strpos($format, '%') !== false) {
+ return strftime($format, $ts);
+ } else {
+ return date($format, $ts);
+ }
+ }
+
+
+ public function getActive()
+ {
+
+ return $this->active;
+ }
+
+
+ public function setId($v)
+ {
+
+ if ($v !== null && !is_int($v) && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = MailboxPeer::ID;
+ }
+
+ }
+
+ public function setDomainId($v)
+ {
+
+ if ($v !== null && !is_int($v) && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->domain_id !== $v) {
+ $this->domain_id = $v;
+ $this->modifiedColumns[] = MailboxPeer::DOMAIN_ID;
+ }
+
+ if ($this->aDomain !== null && $this->aDomain->getId() !== $v) {
+ $this->aDomain = null;
+ }
+
+ }
+
+ public function setName($v)
+ {
+
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->name !== $v) {
+ $this->name = $v;
+ $this->modifiedColumns[] = MailboxPeer::NAME;
+ }
+
+ }
+
+ public function setPassword($v)
+ {
+
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->password !== $v) {
+ $this->password = $v;
+ $this->modifiedColumns[] = MailboxPeer::PASSWORD;
+ }
+
+ }
+
+ public function setMaxQuota($v)
+ {
+
+ if ($v !== null && !is_int($v) && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->max_quota !== $v) {
+ $this->max_quota = $v;
+ $this->modifiedColumns[] = MailboxPeer::MAX_QUOTA;
+ }
+
+ }
+
+ public function setMaxAddressCount($v)
+ {
+
+ if ($v !== null && !is_int($v) && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->max_address_count !== $v) {
+ $this->max_address_count = $v;
+ $this->modifiedColumns[] = MailboxPeer::MAX_ADDRESS_COUNT;
+ }
+
+ }
+
+ public function setLastLogin($v)
+ {
+
+ if ($v !== null && !is_int($v)) {
+ $ts = strtotime($v);
+ if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse date/time value for [last_login] from input: " . var_export($v, true));
+ }
+ } else {
+ $ts = $v;
+ }
+ if ($this->last_login !== $ts) {
+ $this->last_login = $ts;
+ $this->modifiedColumns[] = MailboxPeer::LAST_LOGIN;
+ }
+
+ }
+
+ public function setActive($v)
+ {
+
+ if ($this->active !== $v || $v === true) {
+ $this->active = $v;
+ $this->modifiedColumns[] = MailboxPeer::ACTIVE;
+ }
+
+ }
+
+ public function hydrate(ResultSet $rs, $startcol = 1)
+ {
+ try {
+
+ $this->id = $rs->getInt($startcol + 0);
+
+ $this->domain_id = $rs->getInt($startcol + 1);
+
+ $this->name = $rs->getString($startcol + 2);
+
+ $this->password = $rs->getString($startcol + 3);
+
+ $this->max_quota = $rs->getInt($startcol + 4);
+
+ $this->max_address_count = $rs->getInt($startcol + 5);
+
+ $this->last_login = $rs->getTimestamp($startcol + 6, null);
+
+ $this->active = $rs->getBoolean($startcol + 7);
+
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ return $startcol + 8;
+ } catch (Exception $e) {
+ throw new PropelException("Error populating Mailbox object", $e);
+ }
+ }
+
+
+ public function delete($con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("This object has already been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(MailboxPeer::DATABASE_NAME);
+ }
+
+ try {
+ $con->begin();
+ MailboxPeer::doDelete($this, $con);
+ $this->setDeleted(true);
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+
+ public function save($con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("You cannot save an object that has been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(MailboxPeer::DATABASE_NAME);
+ }
+
+ try {
+ $con->begin();
+ $affectedRows = $this->doSave($con);
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+
+ protected function doSave($con)
+ {
+ $affectedRows = 0; if (!$this->alreadyInSave) {
+ $this->alreadyInSave = true;
+
+
+
+ if ($this->aDomain !== null) {
+ if ($this->aDomain->isModified()) {
+ $affectedRows += $this->aDomain->save($con);
+ }
+ $this->setDomain($this->aDomain);
+ }
+
+
+ if ($this->isModified()) {
+ if ($this->isNew()) {
+ $pk = MailboxPeer::doInsert($this, $con);
+ $affectedRows += 1;
+ $this->setId($pk);
+ $this->setNew(false);
+ } else {
+ $affectedRows += MailboxPeer::doUpdate($this, $con);
+ }
+ $this->resetModified(); }
+
+ if ($this->collAddresss !== null) {
+ foreach($this->collAddresss as $referrerFK) {
+ if (!$referrerFK->isDeleted()) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ $this->alreadyInSave = false;
+ }
+ return $affectedRows;
+ }
+
+ protected $validationFailures = array();
+
+
+ public function getValidationFailures()
+ {
+ return $this->validationFailures;
+ }
+
+
+ public function validate($columns = null)
+ {
+ $res = $this->doValidate($columns);
+ if ($res === true) {
+ $this->validationFailures = array();
+ return true;
+ } else {
+ $this->validationFailures = $res;
+ return false;
+ }
+ }
+
+
+ protected function doValidate($columns = null)
+ {
+ if (!$this->alreadyInValidation) {
+ $this->alreadyInValidation = true;
+ $retval = null;
+
+ $failureMap = array();
+
+
+
+ if ($this->aDomain !== null) {
+ if (!$this->aDomain->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aDomain->getValidationFailures());
+ }
+ }
+
+
+ if (($retval = MailboxPeer::doValidate($this, $columns)) !== true) {
+ $failureMap = array_merge($failureMap, $retval);
+ }
+
+
+ if ($this->collAddresss !== null) {
+ foreach($this->collAddresss as $referrerFK) {
+ if (!$referrerFK->validate($columns)) {
+ $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
+ }
+ }
+ }
+
+
+ $this->alreadyInValidation = false;
+ }
+
+ return (!empty($failureMap) ? $failureMap : true);
+ }
+
+
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = MailboxPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ return $this->getByPosition($pos);
+ }
+
+
+ public function getByPosition($pos)
+ {
+ switch($pos) {
+ case 0:
+ return $this->getId();
+ break;
+ case 1:
+ return $this->getDomainId();
+ break;
+ case 2:
+ return $this->getName();
+ break;
+ case 3:
+ return $this->getPassword();
+ break;
+ case 4:
+ return $this->getMaxQuota();
+ break;
+ case 5:
+ return $this->getMaxAddressCount();
+ break;
+ case 6:
+ return $this->getLastLogin();
+ break;
+ case 7:
+ return $this->getActive();
+ break;
+ default:
+ return null;
+ break;
+ } }
+
+
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = MailboxPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getDomainId(),
+ $keys[2] => $this->getName(),
+ $keys[3] => $this->getPassword(),
+ $keys[4] => $this->getMaxQuota(),
+ $keys[5] => $this->getMaxAddressCount(),
+ $keys[6] => $this->getLastLogin(),
+ $keys[7] => $this->getActive(),
+ );
+ return $result;
+ }
+
+
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = MailboxPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ return $this->setByPosition($pos, $value);
+ }
+
+
+ public function setByPosition($pos, $value)
+ {
+ switch($pos) {
+ case 0:
+ $this->setId($value);
+ break;
+ case 1:
+ $this->setDomainId($value);
+ break;
+ case 2:
+ $this->setName($value);
+ break;
+ case 3:
+ $this->setPassword($value);
+ break;
+ case 4:
+ $this->setMaxQuota($value);
+ break;
+ case 5:
+ $this->setMaxAddressCount($value);
+ break;
+ case 6:
+ $this->setLastLogin($value);
+ break;
+ case 7:
+ $this->setActive($value);
+ break;
+ } }
+
+
+ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = MailboxPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setDomainId($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setName($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setPassword($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setMaxQuota($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setMaxAddressCount($arr[$keys[5]]);
+ if (array_key_exists($keys[6], $arr)) $this->setLastLogin($arr[$keys[6]]);
+ if (array_key_exists($keys[7], $arr)) $this->setActive($arr[$keys[7]]);
+ }
+
+
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(MailboxPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(MailboxPeer::ID)) $criteria->add(MailboxPeer::ID, $this->id);
+ if ($this->isColumnModified(MailboxPeer::DOMAIN_ID)) $criteria->add(MailboxPeer::DOMAIN_ID, $this->domain_id);
+ if ($this->isColumnModified(MailboxPeer::NAME)) $criteria->add(MailboxPeer::NAME, $this->name);
+ if ($this->isColumnModified(MailboxPeer::PASSWORD)) $criteria->add(MailboxPeer::PASSWORD, $this->password);
+ if ($this->isColumnModified(MailboxPeer::MAX_QUOTA)) $criteria->add(MailboxPeer::MAX_QUOTA, $this->max_quota);
+ if ($this->isColumnModified(MailboxPeer::MAX_ADDRESS_COUNT)) $criteria->add(MailboxPeer::MAX_ADDRESS_COUNT, $this->max_address_count);
+ if ($this->isColumnModified(MailboxPeer::LAST_LOGIN)) $criteria->add(MailboxPeer::LAST_LOGIN, $this->last_login);
+ if ($this->isColumnModified(MailboxPeer::ACTIVE)) $criteria->add(MailboxPeer::ACTIVE, $this->active);
+
+ return $criteria;
+ }
+
+
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(MailboxPeer::DATABASE_NAME);
+
+ $criteria->add(MailboxPeer::ID, $this->id);
+
+ return $criteria;
+ }
+
+
+ public function getPrimaryKey()
+ {
+ return $this->getId();
+ }
+
+
+ public function setPrimaryKey($key)
+ {
+ $this->setId($key);
+ }
+
+
+ public function copyInto($copyObj, $deepCopy = false)
+ {
+
+ $copyObj->setDomainId($this->domain_id);
+
+ $copyObj->setName($this->name);
+
+ $copyObj->setPassword($this->password);
+
+ $copyObj->setMaxQuota($this->max_quota);
+
+ $copyObj->setMaxAddressCount($this->max_address_count);
+
+ $copyObj->setLastLogin($this->last_login);
+
+ $copyObj->setActive($this->active);
+
+
+ if ($deepCopy) {
+ $copyObj->setNew(false);
+
+ foreach($this->getAddresss() as $relObj) {
+ $copyObj->addAddress($relObj->copy($deepCopy));
+ }
+
+ }
+
+ $copyObj->setNew(true);
+
+ $copyObj->setId(NULL);
+ }
+
+
+ public function copy($deepCopy = false)
+ {
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+ return $copyObj;
+ }
+
+
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new MailboxPeer();
+ }
+ return self::$peer;
+ }
+
+
+ public function setDomain($v)
+ {
+
+
+ if ($v === null) {
+ $this->setDomainId(NULL);
+ } else {
+ $this->setDomainId($v->getId());
+ }
+
+
+ $this->aDomain = $v;
+ }
+
+
+
+ public function getDomain($con = null)
+ {
+ include_once 'lib/model/om/BaseDomainPeer.php';
+
+ if ($this->aDomain === null && ($this->domain_id !== null)) {
+
+ $this->aDomain = DomainPeer::retrieveByPK($this->domain_id, $con);
+
+
+ }
+ return $this->aDomain;
+ }
+
+
+ public function initAddresss()
+ {
+ if ($this->collAddresss === null) {
+ $this->collAddresss = array();
+ }
+ }
+
+
+ public function getAddresss($criteria = null, $con = null)
+ {
+ include_once 'lib/model/om/BaseAddressPeer.php';
+ if ($criteria === null) {
+ $criteria = new Criteria();
+ }
+ elseif ($criteria instanceof Criteria)
+ {
+ $criteria = clone $criteria;
+ }
+
+ if ($this->collAddresss === null) {
+ if ($this->isNew()) {
+ $this->collAddresss = array();
+ } else {
+
+ $criteria->add(AddressPeer::MAILBOX_ID, $this->getId());
+
+ AddressPeer::addSelectColumns($criteria);
+ $this->collAddresss = AddressPeer::doSelect($criteria, $con);
+ }
+ } else {
+ if (!$this->isNew()) {
+
+
+ $criteria->add(AddressPeer::MAILBOX_ID, $this->getId());
+
+ AddressPeer::addSelectColumns($criteria);
+ if (!isset($this->lastAddressCriteria) || !$this->lastAddressCriteria->equals($criteria)) {
+ $this->collAddresss = AddressPeer::doSelect($criteria, $con);
+ }
+ }
+ }
+ $this->lastAddressCriteria = $criteria;
+ return $this->collAddresss;
+ }
+
+
+ public function countAddresss($criteria = null, $distinct = false, $con = null)
+ {
+ include_once 'lib/model/om/BaseAddressPeer.php';
+ if ($criteria === null) {
+ $criteria = new Criteria();
+ }
+ elseif ($criteria instanceof Criteria)
+ {
+ $criteria = clone $criteria;
+ }
+
+ $criteria->add(AddressPeer::MAILBOX_ID, $this->getId());
+
+ return AddressPeer::doCount($criteria, $distinct, $con);
+ }
+
+
+ public function addAddress(Address $l)
+ {
+ $this->collAddresss[] = $l;
+ $l->setMailbox($this);
+ }
+
+
+
+ public function getAddresssJoinDomain($criteria = null, $con = null)
+ {
+ include_once 'lib/model/om/BaseAddressPeer.php';
+ if ($criteria === null) {
+ $criteria = new Criteria();
+ }
+ elseif ($criteria instanceof Criteria)
+ {
+ $criteria = clone $criteria;
+ }
+
+ if ($this->collAddresss === null) {
+ if ($this->isNew()) {
+ $this->collAddresss = array();
+ } else {
+
+ $criteria->add(AddressPeer::MAILBOX_ID, $this->getId());
+
+ $this->collAddresss = AddressPeer::doSelectJoinDomain($criteria, $con);
+ }
+ } else {
+
+ $criteria->add(AddressPeer::MAILBOX_ID, $this->getId());
+
+ if (!isset($this->lastAddressCriteria) || !$this->lastAddressCriteria->equals($criteria)) {
+ $this->collAddresss = AddressPeer::doSelectJoinDomain($criteria, $con);
+ }
+ }
+ $this->lastAddressCriteria = $criteria;
+
+ return $this->collAddresss;
+ }
+
+} \ No newline at end of file
diff --git a/lib/model/om/BaseMailboxPeer.php b/lib/model/om/BaseMailboxPeer.php
new file mode 100644
index 0000000..4a7fd36
--- /dev/null
+++ b/lib/model/om/BaseMailboxPeer.php
@@ -0,0 +1,579 @@
+<?php
+
+
+abstract class BaseMailboxPeer {
+
+
+ const DATABASE_NAME = 'propel';
+
+
+ const TABLE_NAME = 'mailbox';
+
+
+ const CLASS_DEFAULT = 'lib.model.Mailbox';
+
+
+ const NUM_COLUMNS = 8;
+
+
+ const NUM_LAZY_LOAD_COLUMNS = 0;
+
+
+
+ const ID = 'mailbox.ID';
+
+
+ const DOMAIN_ID = 'mailbox.DOMAIN_ID';
+
+
+ const NAME = 'mailbox.NAME';
+
+
+ const PASSWORD = 'mailbox.PASSWORD';
+
+
+ const MAX_QUOTA = 'mailbox.MAX_QUOTA';
+
+
+ const MAX_ADDRESS_COUNT = 'mailbox.MAX_ADDRESS_COUNT';
+
+
+ const LAST_LOGIN = 'mailbox.LAST_LOGIN';
+
+
+ const ACTIVE = 'mailbox.ACTIVE';
+
+
+ private static $phpNameMap = null;
+
+
+
+ private static $fieldNames = array (
+ BasePeer::TYPE_PHPNAME => array ('Id', 'DomainId', 'Name', 'Password', 'MaxQuota', 'MaxAddressCount', 'LastLogin', 'Active', ),
+ BasePeer::TYPE_COLNAME => array (MailboxPeer::ID, MailboxPeer::DOMAIN_ID, MailboxPeer::NAME, MailboxPeer::PASSWORD, MailboxPeer::MAX_QUOTA, MailboxPeer::MAX_ADDRESS_COUNT, MailboxPeer::LAST_LOGIN, MailboxPeer::ACTIVE, ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'domain_id', 'name', 'password', 'max_quota', 'max_address_count', 'last_login', 'active', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, )
+ );
+
+
+ private static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'DomainId' => 1, 'Name' => 2, 'Password' => 3, 'MaxQuota' => 4, 'MaxAddressCount' => 5, 'LastLogin' => 6, 'Active' => 7, ),
+ BasePeer::TYPE_COLNAME => array (MailboxPeer::ID => 0, MailboxPeer::DOMAIN_ID => 1, MailboxPeer::NAME => 2, MailboxPeer::PASSWORD => 3, MailboxPeer::MAX_QUOTA => 4, MailboxPeer::MAX_ADDRESS_COUNT => 5, MailboxPeer::LAST_LOGIN => 6, MailboxPeer::ACTIVE => 7, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'domain_id' => 1, 'name' => 2, 'password' => 3, 'max_quota' => 4, 'max_address_count' => 5, 'last_login' => 6, 'active' => 7, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, )
+ );
+
+
+ public static function getMapBuilder()
+ {
+ include_once 'lib/model/map/MailboxMapBuilder.php';
+ return BasePeer::getMapBuilder('lib.model.map.MailboxMapBuilder');
+ }
+
+ public static function getPhpNameMap()
+ {
+ if (self::$phpNameMap === null) {
+ $map = MailboxPeer::getTableMap();
+ $columns = $map->getColumns();
+ $nameMap = array();
+ foreach ($columns as $column) {
+ $nameMap[$column->getPhpName()] = $column->getColumnName();
+ }
+ self::$phpNameMap = $nameMap;
+ }
+ return self::$phpNameMap;
+ }
+
+ static public function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = self::getFieldNames($toType);
+ $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
+ if ($key === null) {
+ throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
+ }
+ return $toNames[$key];
+ }
+
+
+
+ static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, self::$fieldNames)) {
+ throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.');
+ }
+ return self::$fieldNames[$type];
+ }
+
+
+ public static function alias($alias, $column)
+ {
+ return str_replace(MailboxPeer::TABLE_NAME.'.', $alias.'.', $column);
+ }
+
+
+ public static function addSelectColumns(Criteria $criteria)
+ {
+
+ $criteria->addSelectColumn(MailboxPeer::ID);
+
+ $criteria->addSelectColumn(MailboxPeer::DOMAIN_ID);
+
+ $criteria->addSelectColumn(MailboxPeer::NAME);
+
+ $criteria->addSelectColumn(MailboxPeer::PASSWORD);
+
+ $criteria->addSelectColumn(MailboxPeer::MAX_QUOTA);
+
+ $criteria->addSelectColumn(MailboxPeer::MAX_ADDRESS_COUNT);
+
+ $criteria->addSelectColumn(MailboxPeer::LAST_LOGIN);
+
+ $criteria->addSelectColumn(MailboxPeer::ACTIVE);
+
+ }
+
+ const COUNT = 'COUNT(mailbox.ID)';
+ const COUNT_DISTINCT = 'COUNT(DISTINCT mailbox.ID)';
+
+
+ public static function doCount(Criteria $criteria, $distinct = false, $con = null)
+ {
+ $criteria = clone $criteria;
+
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(MailboxPeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(MailboxPeer::COUNT);
+ }
+
+ foreach($criteria->getGroupByColumns() as $column)
+ {
+ $criteria->addSelectColumn($column);
+ }
+
+ $rs = MailboxPeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ return 0;
+ }
+ }
+
+ public static function doSelectOne(Criteria $criteria, $con = null)
+ {
+ $critcopy = clone $criteria;
+ $critcopy->setLimit(1);
+ $objects = MailboxPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+ return null;
+ }
+
+ public static function doSelect(Criteria $criteria, $con = null)
+ {
+ return MailboxPeer::populateObjects(MailboxPeer::doSelectRS($criteria, $con));
+ }
+
+ public static function doSelectRS(Criteria $criteria, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ if (!$criteria->getSelectColumns()) {
+ $criteria = clone $criteria;
+ MailboxPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ return BasePeer::doSelect($criteria, $con);
+ }
+
+ public static function populateObjects(ResultSet $rs)
+ {
+ $results = array();
+
+ $cls = MailboxPeer::getOMClass();
+ $cls = Propel::import($cls);
+ while($rs->next()) {
+
+ $obj = new $cls();
+ $obj->hydrate($rs);
+ $results[] = $obj;
+
+ }
+ return $results;
+ }
+
+
+ public static function doCountJoinDomain(Criteria $criteria, $distinct = false, $con = null)
+ {
+ $criteria = clone $criteria;
+
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(MailboxPeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(MailboxPeer::COUNT);
+ }
+
+ foreach($criteria->getGroupByColumns() as $column)
+ {
+ $criteria->addSelectColumn($column);
+ }
+
+ $criteria->addJoin(MailboxPeer::DOMAIN_ID, DomainPeer::ID);
+
+ $rs = MailboxPeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ return 0;
+ }
+ }
+
+
+
+ public static function doSelectJoinDomain(Criteria $c, $con = null)
+ {
+ $c = clone $c;
+
+ if ($c->getDbName() == Propel::getDefaultDB()) {
+ $c->setDbName(self::DATABASE_NAME);
+ }
+
+ MailboxPeer::addSelectColumns($c);
+ $startcol = (MailboxPeer::NUM_COLUMNS - MailboxPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
+ DomainPeer::addSelectColumns($c);
+
+ $c->addJoin(MailboxPeer::DOMAIN_ID, DomainPeer::ID);
+ $rs = BasePeer::doSelect($c, $con);
+ $results = array();
+
+ while($rs->next()) {
+
+ $omClass = MailboxPeer::getOMClass();
+
+ $cls = Propel::import($omClass);
+ $obj1 = new $cls();
+ $obj1->hydrate($rs);
+
+ $omClass = DomainPeer::getOMClass();
+
+ $cls = Propel::import($omClass);
+ $obj2 = new $cls();
+ $obj2->hydrate($rs, $startcol);
+
+ $newObject = true;
+ foreach($results as $temp_obj1) {
+ $temp_obj2 = $temp_obj1->getDomain(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
+ $newObject = false;
+ $temp_obj2->addMailbox($obj1); break;
+ }
+ }
+ if ($newObject) {
+ $obj2->initMailboxs();
+ $obj2->addMailbox($obj1); }
+ $results[] = $obj1;
+ }
+ return $results;
+ }
+
+
+
+ public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null)
+ {
+ $criteria = clone $criteria;
+
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(MailboxPeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(MailboxPeer::COUNT);
+ }
+
+ foreach($criteria->getGroupByColumns() as $column)
+ {
+ $criteria->addSelectColumn($column);
+ }
+
+ $criteria->addJoin(MailboxPeer::DOMAIN_ID, DomainPeer::ID);
+
+ $rs = MailboxPeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ return 0;
+ }
+ }
+
+
+
+ public static function doSelectJoinAll(Criteria $c, $con = null)
+ {
+ $c = clone $c;
+
+ if ($c->getDbName() == Propel::getDefaultDB()) {
+ $c->setDbName(self::DATABASE_NAME);
+ }
+
+ MailboxPeer::addSelectColumns($c);
+ $startcol2 = (MailboxPeer::NUM_COLUMNS - MailboxPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
+
+ DomainPeer::addSelectColumns($c);
+ $startcol3 = $startcol2 + DomainPeer::NUM_COLUMNS;
+
+ $c->addJoin(MailboxPeer::DOMAIN_ID, DomainPeer::ID);
+
+ $rs = BasePeer::doSelect($c, $con);
+ $results = array();
+
+ while($rs->next()) {
+
+ $omClass = MailboxPeer::getOMClass();
+
+
+ $cls = Propel::import($omClass);
+ $obj1 = new $cls();
+ $obj1->hydrate($rs);
+
+
+
+ $omClass = DomainPeer::getOMClass();
+
+
+ $cls = Propel::import($omClass);
+ $obj2 = new $cls();
+ $obj2->hydrate($rs, $startcol2);
+
+ $newObject = true;
+ for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
+ $temp_obj1 = $results[$j];
+ $temp_obj2 = $temp_obj1->getDomain(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
+ $newObject = false;
+ $temp_obj2->addMailbox($obj1); break;
+ }
+ }
+
+ if ($newObject) {
+ $obj2->initMailboxs();
+ $obj2->addMailbox($obj1);
+ }
+
+ $results[] = $obj1;
+ }
+ return $results;
+ }
+
+
+ public static function getTableMap()
+ {
+ return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
+ }
+
+
+ public static function getOMClass()
+ {
+ return MailboxPeer::CLASS_DEFAULT;
+ }
+
+
+ public static function doInsert($values, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; } else {
+ $criteria = $values->buildCriteria(); }
+
+ $criteria->remove(MailboxPeer::ID);
+
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ try {
+ $con->begin();
+ $pk = BasePeer::doInsert($criteria, $con);
+ $con->commit();
+ } catch(PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+
+ public static function doUpdate($values, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ $selectCriteria = new Criteria(self::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values;
+ $comparison = $criteria->getComparison(MailboxPeer::ID);
+ $selectCriteria->add(MailboxPeer::ID, $criteria->remove(MailboxPeer::ID), $comparison);
+
+ } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); }
+
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+
+ public static function doDeleteAll($con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+ $affectedRows = 0; try {
+ $con->begin();
+ $affectedRows += MailboxPeer::doOnDeleteCascade(new Criteria(), $con);
+ $affectedRows += BasePeer::doDeleteAll(MailboxPeer::TABLE_NAME, $con);
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+
+ public static function doDelete($values, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(MailboxPeer::DATABASE_NAME);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; } elseif ($values instanceof Mailbox) {
+
+ $criteria = $values->buildPkeyCriteria();
+ } else {
+ $criteria = new Criteria(self::DATABASE_NAME);
+ $criteria->add(MailboxPeer::ID, (array) $values, Criteria::IN);
+ }
+
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ $affectedRows = 0;
+ try {
+ $con->begin();
+ $affectedRows += MailboxPeer::doOnDeleteCascade($criteria, $con);
+ $affectedRows += BasePeer::doDelete($criteria, $con);
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+
+ protected static function doOnDeleteCascade(Criteria $criteria, Connection $con)
+ {
+ $affectedRows = 0;
+
+ $objects = MailboxPeer::doSelect($criteria, $con);
+ foreach($objects as $obj) {
+
+
+ include_once 'lib/model/Address.php';
+
+ $c = new Criteria();
+
+ $c->add(AddressPeer::MAILBOX_ID, $obj->getId());
+ $affectedRows += AddressPeer::doDelete($c, $con);
+ }
+ return $affectedRows;
+ }
+
+
+ public static function doValidate(Mailbox $obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(MailboxPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(MailboxPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach($cols as $colName) {
+ if ($tableMap->containsColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ $res = BasePeer::doValidate(MailboxPeer::DATABASE_NAME, MailboxPeer::TABLE_NAME, $columns);
+ if ($res !== true) {
+ $request = sfContext::getInstance()->getRequest();
+ foreach ($res as $failed) {
+ $col = MailboxPeer::translateFieldname($failed->getColumn(), BasePeer::TYPE_COLNAME, BasePeer::TYPE_PHPNAME);
+ $request->setError($col, $failed->getMessage());
+ }
+ }
+
+ return $res;
+ }
+
+
+ public static function retrieveByPK($pk, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ $criteria = new Criteria(MailboxPeer::DATABASE_NAME);
+
+ $criteria->add(MailboxPeer::ID, $pk);
+
+
+ $v = MailboxPeer::doSelect($criteria, $con);
+
+ return !empty($v) > 0 ? $v[0] : null;
+ }
+
+
+ public static function retrieveByPKs($pks, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ $objs = null;
+ if (empty($pks)) {
+ $objs = array();
+ } else {
+ $criteria = new Criteria();
+ $criteria->add(MailboxPeer::ID, $pks, Criteria::IN);
+ $objs = MailboxPeer::doSelect($criteria, $con);
+ }
+ return $objs;
+ }
+
+}
+if (Propel::isInit()) {
+ try {
+ BaseMailboxPeer::getMapBuilder();
+ } catch (Exception $e) {
+ Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR);
+ }
+} else {
+ require_once 'lib/model/map/MailboxMapBuilder.php';
+ Propel::registerMapBuilder('lib.model.map.MailboxMapBuilder');
+}
diff --git a/lib/model/om/BaseRole.php b/lib/model/om/BaseRole.php
new file mode 100644
index 0000000..7936e1e
--- /dev/null
+++ b/lib/model/om/BaseRole.php
@@ -0,0 +1,493 @@
+<?php
+
+
+abstract class BaseRole extends BaseObject implements Persistent {
+
+
+
+ protected static $peer;
+
+
+
+ protected $id;
+
+
+
+ protected $name;
+
+
+
+ protected $credentials;
+
+
+ protected $collUsers;
+
+
+ protected $lastUserCriteria = null;
+
+
+ protected $alreadyInSave = false;
+
+
+ protected $alreadyInValidation = false;
+
+
+ public function getId()
+ {
+
+ return $this->id;
+ }
+
+
+ public function getName()
+ {
+
+ return $this->name;
+ }
+
+
+ public function getCredentials()
+ {
+
+ return $this->credentials;
+ }
+
+
+ public function setId($v)
+ {
+
+ if ($v !== null && !is_int($v) && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = RolePeer::ID;
+ }
+
+ }
+
+ public function setName($v)
+ {
+
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->name !== $v) {
+ $this->name = $v;
+ $this->modifiedColumns[] = RolePeer::NAME;
+ }
+
+ }
+
+ public function setCredentials($v)
+ {
+
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->credentials !== $v) {
+ $this->credentials = $v;
+ $this->modifiedColumns[] = RolePeer::CREDENTIALS;
+ }
+
+ }
+
+ public function hydrate(ResultSet $rs, $startcol = 1)
+ {
+ try {
+
+ $this->id = $rs->getInt($startcol + 0);
+
+ $this->name = $rs->getString($startcol + 1);
+
+ $this->credentials = $rs->getString($startcol + 2);
+
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ return $startcol + 3;
+ } catch (Exception $e) {
+ throw new PropelException("Error populating Role object", $e);
+ }
+ }
+
+
+ public function delete($con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("This object has already been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(RolePeer::DATABASE_NAME);
+ }
+
+ try {
+ $con->begin();
+ RolePeer::doDelete($this, $con);
+ $this->setDeleted(true);
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+
+ public function save($con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("You cannot save an object that has been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(RolePeer::DATABASE_NAME);
+ }
+
+ try {
+ $con->begin();
+ $affectedRows = $this->doSave($con);
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+
+ protected function doSave($con)
+ {
+ $affectedRows = 0; if (!$this->alreadyInSave) {
+ $this->alreadyInSave = true;
+
+
+ if ($this->isModified()) {
+ if ($this->isNew()) {
+ $pk = RolePeer::doInsert($this, $con);
+ $affectedRows += 1;
+ $this->setId($pk);
+ $this->setNew(false);
+ } else {
+ $affectedRows += RolePeer::doUpdate($this, $con);
+ }
+ $this->resetModified(); }
+
+ if ($this->collUsers !== null) {
+ foreach($this->collUsers as $referrerFK) {
+ if (!$referrerFK->isDeleted()) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ $this->alreadyInSave = false;
+ }
+ return $affectedRows;
+ }
+
+ protected $validationFailures = array();
+
+
+ public function getValidationFailures()
+ {
+ return $this->validationFailures;
+ }
+
+
+ public function validate($columns = null)
+ {
+ $res = $this->doValidate($columns);
+ if ($res === true) {
+ $this->validationFailures = array();
+ return true;
+ } else {
+ $this->validationFailures = $res;
+ return false;
+ }
+ }
+
+
+ protected function doValidate($columns = null)
+ {
+ if (!$this->alreadyInValidation) {
+ $this->alreadyInValidation = true;
+ $retval = null;
+
+ $failureMap = array();
+
+
+ if (($retval = RolePeer::doValidate($this, $columns)) !== true) {
+ $failureMap = array_merge($failureMap, $retval);
+ }
+
+
+ if ($this->collUsers !== null) {
+ foreach($this->collUsers as $referrerFK) {
+ if (!$referrerFK->validate($columns)) {
+ $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
+ }
+ }
+ }
+
+
+ $this->alreadyInValidation = false;
+ }
+
+ return (!empty($failureMap) ? $failureMap : true);
+ }
+
+
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = RolePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ return $this->getByPosition($pos);
+ }
+
+
+ public function getByPosition($pos)
+ {
+ switch($pos) {
+ case 0:
+ return $this->getId();
+ break;
+ case 1:
+ return $this->getName();
+ break;
+ case 2:
+ return $this->getCredentials();
+ break;
+ default:
+ return null;
+ break;
+ } }
+
+
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = RolePeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getName(),
+ $keys[2] => $this->getCredentials(),
+ );
+ return $result;
+ }
+
+
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = RolePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ return $this->setByPosition($pos, $value);
+ }
+
+
+ public function setByPosition($pos, $value)
+ {
+ switch($pos) {
+ case 0:
+ $this->setId($value);
+ break;
+ case 1:
+ $this->setName($value);
+ break;
+ case 2:
+ $this->setCredentials($value);
+ break;
+ } }
+
+
+ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = RolePeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setName($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setCredentials($arr[$keys[2]]);
+ }
+
+
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(RolePeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(RolePeer::ID)) $criteria->add(RolePeer::ID, $this->id);
+ if ($this->isColumnModified(RolePeer::NAME)) $criteria->add(RolePeer::NAME, $this->name);
+ if ($this->isColumnModified(RolePeer::CREDENTIALS)) $criteria->add(RolePeer::CREDENTIALS, $this->credentials);
+
+ return $criteria;
+ }
+
+
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(RolePeer::DATABASE_NAME);
+
+ $criteria->add(RolePeer::ID, $this->id);
+
+ return $criteria;
+ }
+
+
+ public function getPrimaryKey()
+ {
+ return $this->getId();
+ }
+
+
+ public function setPrimaryKey($key)
+ {
+ $this->setId($key);
+ }
+
+
+ public function copyInto($copyObj, $deepCopy = false)
+ {
+
+ $copyObj->setName($this->name);
+
+ $copyObj->setCredentials($this->credentials);
+
+
+ if ($deepCopy) {
+ $copyObj->setNew(false);
+
+ foreach($this->getUsers() as $relObj) {
+ $copyObj->addUser($relObj->copy($deepCopy));
+ }
+
+ }
+
+ $copyObj->setNew(true);
+
+ $copyObj->setId(NULL);
+ }
+
+
+ public function copy($deepCopy = false)
+ {
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+ return $copyObj;
+ }
+
+
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new RolePeer();
+ }
+ return self::$peer;
+ }
+
+
+ public function initUsers()
+ {
+ if ($this->collUsers === null) {
+ $this->collUsers = array();
+ }
+ }
+
+
+ public function getUsers($criteria = null, $con = null)
+ {
+ include_once 'lib/model/om/BaseUserPeer.php';
+ if ($criteria === null) {
+ $criteria = new Criteria();
+ }
+ elseif ($criteria instanceof Criteria)
+ {
+ $criteria = clone $criteria;
+ }
+
+ if ($this->collUsers === null) {
+ if ($this->isNew()) {
+ $this->collUsers = array();
+ } else {
+
+ $criteria->add(UserPeer::ROLE_ID, $this->getId());
+
+ UserPeer::addSelectColumns($criteria);
+ $this->collUsers = UserPeer::doSelect($criteria, $con);
+ }
+ } else {
+ if (!$this->isNew()) {
+
+
+ $criteria->add(UserPeer::ROLE_ID, $this->getId());
+
+ UserPeer::addSelectColumns($criteria);
+ if (!isset($this->lastUserCriteria) || !$this->lastUserCriteria->equals($criteria)) {
+ $this->collUsers = UserPeer::doSelect($criteria, $con);
+ }
+ }
+ }
+ $this->lastUserCriteria = $criteria;
+ return $this->collUsers;
+ }
+
+
+ public function countUsers($criteria = null, $distinct = false, $con = null)
+ {
+ include_once 'lib/model/om/BaseUserPeer.php';
+ if ($criteria === null) {
+ $criteria = new Criteria();
+ }
+ elseif ($criteria instanceof Criteria)
+ {
+ $criteria = clone $criteria;
+ }
+
+ $criteria->add(UserPeer::ROLE_ID, $this->getId());
+
+ return UserPeer::doCount($criteria, $distinct, $con);
+ }
+
+
+ public function addUser(User $l)
+ {
+ $this->collUsers[] = $l;
+ $l->setRole($this);
+ }
+
+
+
+ public function getUsersJoinUserRelatedByParentUserId($criteria = null, $con = null)
+ {
+ include_once 'lib/model/om/BaseUserPeer.php';
+ if ($criteria === null) {
+ $criteria = new Criteria();
+ }
+ elseif ($criteria instanceof Criteria)
+ {
+ $criteria = clone $criteria;
+ }
+
+ if ($this->collUsers === null) {
+ if ($this->isNew()) {
+ $this->collUsers = array();
+ } else {
+
+ $criteria->add(UserPeer::ROLE_ID, $this->getId());
+
+ $this->collUsers = UserPeer::doSelectJoinUserRelatedByParentUserId($criteria, $con);
+ }
+ } else {
+
+ $criteria->add(UserPeer::ROLE_ID, $this->getId());
+
+ if (!isset($this->lastUserCriteria) || !$this->lastUserCriteria->equals($criteria)) {
+ $this->collUsers = UserPeer::doSelectJoinUserRelatedByParentUserId($criteria, $con);
+ }
+ }
+ $this->lastUserCriteria = $criteria;
+
+ return $this->collUsers;
+ }
+
+} \ No newline at end of file
diff --git a/lib/model/om/BaseRolePeer.php b/lib/model/om/BaseRolePeer.php
new file mode 100644
index 0000000..85130fb
--- /dev/null
+++ b/lib/model/om/BaseRolePeer.php
@@ -0,0 +1,373 @@
+<?php
+
+
+abstract class BaseRolePeer {
+
+
+ const DATABASE_NAME = 'propel';
+
+
+ const TABLE_NAME = 'role';
+
+
+ const CLASS_DEFAULT = 'lib.model.Role';
+
+
+ const NUM_COLUMNS = 3;
+
+
+ const NUM_LAZY_LOAD_COLUMNS = 0;
+
+
+
+ const ID = 'role.ID';
+
+
+ const NAME = 'role.NAME';
+
+
+ const CREDENTIALS = 'role.CREDENTIALS';
+
+
+ private static $phpNameMap = null;
+
+
+
+ private static $fieldNames = array (
+ BasePeer::TYPE_PHPNAME => array ('Id', 'Name', 'Credentials', ),
+ BasePeer::TYPE_COLNAME => array (RolePeer::ID, RolePeer::NAME, RolePeer::CREDENTIALS, ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'credentials', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, )
+ );
+
+
+ private static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Name' => 1, 'Credentials' => 2, ),
+ BasePeer::TYPE_COLNAME => array (RolePeer::ID => 0, RolePeer::NAME => 1, RolePeer::CREDENTIALS => 2, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'credentials' => 2, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, )
+ );
+
+
+ public static function getMapBuilder()
+ {
+ include_once 'lib/model/map/RoleMapBuilder.php';
+ return BasePeer::getMapBuilder('lib.model.map.RoleMapBuilder');
+ }
+
+ public static function getPhpNameMap()
+ {
+ if (self::$phpNameMap === null) {
+ $map = RolePeer::getTableMap();
+ $columns = $map->getColumns();
+ $nameMap = array();
+ foreach ($columns as $column) {
+ $nameMap[$column->getPhpName()] = $column->getColumnName();
+ }
+ self::$phpNameMap = $nameMap;
+ }
+ return self::$phpNameMap;
+ }
+
+ static public function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = self::getFieldNames($toType);
+ $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
+ if ($key === null) {
+ throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
+ }
+ return $toNames[$key];
+ }
+
+
+
+ static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, self::$fieldNames)) {
+ throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.');
+ }
+ return self::$fieldNames[$type];
+ }
+
+
+ public static function alias($alias, $column)
+ {
+ return str_replace(RolePeer::TABLE_NAME.'.', $alias.'.', $column);
+ }
+
+
+ public static function addSelectColumns(Criteria $criteria)
+ {
+
+ $criteria->addSelectColumn(RolePeer::ID);
+
+ $criteria->addSelectColumn(RolePeer::NAME);
+
+ $criteria->addSelectColumn(RolePeer::CREDENTIALS);
+
+ }
+
+ const COUNT = 'COUNT(role.ID)';
+ const COUNT_DISTINCT = 'COUNT(DISTINCT role.ID)';
+
+
+ public static function doCount(Criteria $criteria, $distinct = false, $con = null)
+ {
+ $criteria = clone $criteria;
+
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(RolePeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(RolePeer::COUNT);
+ }
+
+ foreach($criteria->getGroupByColumns() as $column)
+ {
+ $criteria->addSelectColumn($column);
+ }
+
+ $rs = RolePeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ return 0;
+ }
+ }
+
+ public static function doSelectOne(Criteria $criteria, $con = null)
+ {
+ $critcopy = clone $criteria;
+ $critcopy->setLimit(1);
+ $objects = RolePeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+ return null;
+ }
+
+ public static function doSelect(Criteria $criteria, $con = null)
+ {
+ return RolePeer::populateObjects(RolePeer::doSelectRS($criteria, $con));
+ }
+
+ public static function doSelectRS(Criteria $criteria, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ if (!$criteria->getSelectColumns()) {
+ $criteria = clone $criteria;
+ RolePeer::addSelectColumns($criteria);
+ }
+
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ return BasePeer::doSelect($criteria, $con);
+ }
+
+ public static function populateObjects(ResultSet $rs)
+ {
+ $results = array();
+
+ $cls = RolePeer::getOMClass();
+ $cls = Propel::import($cls);
+ while($rs->next()) {
+
+ $obj = new $cls();
+ $obj->hydrate($rs);
+ $results[] = $obj;
+
+ }
+ return $results;
+ }
+
+ public static function getTableMap()
+ {
+ return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
+ }
+
+
+ public static function getOMClass()
+ {
+ return RolePeer::CLASS_DEFAULT;
+ }
+
+
+ public static function doInsert($values, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; } else {
+ $criteria = $values->buildCriteria(); }
+
+ $criteria->remove(RolePeer::ID);
+
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ try {
+ $con->begin();
+ $pk = BasePeer::doInsert($criteria, $con);
+ $con->commit();
+ } catch(PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+
+ public static function doUpdate($values, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ $selectCriteria = new Criteria(self::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values;
+ $comparison = $criteria->getComparison(RolePeer::ID);
+ $selectCriteria->add(RolePeer::ID, $criteria->remove(RolePeer::ID), $comparison);
+
+ } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); }
+
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+
+ public static function doDeleteAll($con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+ $affectedRows = 0; try {
+ $con->begin();
+ $affectedRows += BasePeer::doDeleteAll(RolePeer::TABLE_NAME, $con);
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+
+ public static function doDelete($values, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(RolePeer::DATABASE_NAME);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; } elseif ($values instanceof Role) {
+
+ $criteria = $values->buildPkeyCriteria();
+ } else {
+ $criteria = new Criteria(self::DATABASE_NAME);
+ $criteria->add(RolePeer::ID, (array) $values, Criteria::IN);
+ }
+
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ $affectedRows = 0;
+ try {
+ $con->begin();
+
+ $affectedRows += BasePeer::doDelete($criteria, $con);
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+
+ public static function doValidate(Role $obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(RolePeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(RolePeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach($cols as $colName) {
+ if ($tableMap->containsColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ $res = BasePeer::doValidate(RolePeer::DATABASE_NAME, RolePeer::TABLE_NAME, $columns);
+ if ($res !== true) {
+ $request = sfContext::getInstance()->getRequest();
+ foreach ($res as $failed) {
+ $col = RolePeer::translateFieldname($failed->getColumn(), BasePeer::TYPE_COLNAME, BasePeer::TYPE_PHPNAME);
+ $request->setError($col, $failed->getMessage());
+ }
+ }
+
+ return $res;
+ }
+
+
+ public static function retrieveByPK($pk, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ $criteria = new Criteria(RolePeer::DATABASE_NAME);
+
+ $criteria->add(RolePeer::ID, $pk);
+
+
+ $v = RolePeer::doSelect($criteria, $con);
+
+ return !empty($v) > 0 ? $v[0] : null;
+ }
+
+
+ public static function retrieveByPKs($pks, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ $objs = null;
+ if (empty($pks)) {
+ $objs = array();
+ } else {
+ $criteria = new Criteria();
+ $criteria->add(RolePeer::ID, $pks, Criteria::IN);
+ $objs = RolePeer::doSelect($criteria, $con);
+ }
+ return $objs;
+ }
+
+}
+if (Propel::isInit()) {
+ try {
+ BaseRolePeer::getMapBuilder();
+ } catch (Exception $e) {
+ Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR);
+ }
+} else {
+ require_once 'lib/model/map/RoleMapBuilder.php';
+ Propel::registerMapBuilder('lib.model.map.RoleMapBuilder');
+}
diff --git a/lib/model/om/BaseUser.php b/lib/model/om/BaseUser.php
new file mode 100644
index 0000000..c9588be
--- /dev/null
+++ b/lib/model/om/BaseUser.php
@@ -0,0 +1,1261 @@
+<?php
+
+
+abstract class BaseUser extends BaseObject implements Persistent {
+
+
+
+ protected static $peer;
+
+
+
+ protected $id;
+
+
+
+ protected $parent_user_id = -1;
+
+
+
+ protected $nickname;
+
+
+
+ protected $first_name;
+
+
+
+ protected $last_name;
+
+
+
+ protected $email;
+
+
+
+ protected $sha1_password;
+
+
+
+ protected $salt;
+
+
+
+ protected $role_id;
+
+
+
+ protected $last_login;
+
+
+
+ protected $created_at;
+
+
+ protected $aUserRelatedByParentUserId;
+
+
+ protected $aRole;
+
+
+ protected $collUsersRelatedByParentUserId;
+
+
+ protected $lastUserRelatedByParentUserIdCriteria = null;
+
+
+ protected $collDomainPermissions;
+
+
+ protected $lastDomainPermissionCriteria = null;
+
+
+ protected $collDomains;
+
+
+ protected $lastDomainCriteria = null;
+
+
+ protected $collLogEntrys;
+
+
+ protected $lastLogEntryCriteria = null;
+
+
+ protected $alreadyInSave = false;
+
+
+ protected $alreadyInValidation = false;
+
+
+ public function getId()
+ {
+
+ return $this->id;
+ }
+
+
+ public function getParentUserId()
+ {
+
+ return $this->parent_user_id;
+ }
+
+
+ public function getNickname()
+ {
+
+ return $this->nickname;
+ }
+
+
+ public function getFirstName()
+ {
+
+ return $this->first_name;
+ }
+
+
+ public function getLastName()
+ {
+
+ return $this->last_name;
+ }
+
+
+ public function getEmail()
+ {
+
+ return $this->email;
+ }
+
+
+ public function getSha1Password()
+ {
+
+ return $this->sha1_password;
+ }
+
+
+ public function getSalt()
+ {
+
+ return $this->salt;
+ }
+
+
+ public function getRoleId()
+ {
+
+ return $this->role_id;
+ }
+
+
+ public function getLastLogin($format = 'Y-m-d H:i:s')
+ {
+
+ if ($this->last_login === null || $this->last_login === '') {
+ return null;
+ } elseif (!is_int($this->last_login)) {
+ $ts = strtotime($this->last_login);
+ if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse value of [last_login] as date/time value: " . var_export($this->last_login, true));
+ }
+ } else {
+ $ts = $this->last_login;
+ }
+ if ($format === null) {
+ return $ts;
+ } elseif (strpos($format, '%') !== false) {
+ return strftime($format, $ts);
+ } else {
+ return date($format, $ts);
+ }
+ }
+
+
+ public function getCreatedAt($format = 'Y-m-d H:i:s')
+ {
+
+ if ($this->created_at === null || $this->created_at === '') {
+ return null;
+ } elseif (!is_int($this->created_at)) {
+ $ts = strtotime($this->created_at);
+ if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse value of [created_at] as date/time value: " . var_export($this->created_at, true));
+ }
+ } else {
+ $ts = $this->created_at;
+ }
+ if ($format === null) {
+ return $ts;
+ } elseif (strpos($format, '%') !== false) {
+ return strftime($format, $ts);
+ } else {
+ return date($format, $ts);
+ }
+ }
+
+
+ public function setId($v)
+ {
+
+ if ($v !== null && !is_int($v) && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = UserPeer::ID;
+ }
+
+ }
+
+ public function setParentUserId($v)
+ {
+
+ if ($v !== null && !is_int($v) && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->parent_user_id !== $v || $v === -1) {
+ $this->parent_user_id = $v;
+ $this->modifiedColumns[] = UserPeer::PARENT_USER_ID;
+ }
+
+ if ($this->aUserRelatedByParentUserId !== null && $this->aUserRelatedByParentUserId->getId() !== $v) {
+ $this->aUserRelatedByParentUserId = null;
+ }
+
+ }
+
+ public function setNickname($v)
+ {
+
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->nickname !== $v) {
+ $this->nickname = $v;
+ $this->modifiedColumns[] = UserPeer::NICKNAME;
+ }
+
+ }
+
+ public function setFirstName($v)
+ {
+
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->first_name !== $v) {
+ $this->first_name = $v;
+ $this->modifiedColumns[] = UserPeer::FIRST_NAME;
+ }
+
+ }
+
+ public function setLastName($v)
+ {
+
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->last_name !== $v) {
+ $this->last_name = $v;
+ $this->modifiedColumns[] = UserPeer::LAST_NAME;
+ }
+
+ }
+
+ public function setEmail($v)
+ {
+
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->email !== $v) {
+ $this->email = $v;
+ $this->modifiedColumns[] = UserPeer::EMAIL;
+ }
+
+ }
+
+ public function setSha1Password($v)
+ {
+
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->sha1_password !== $v) {
+ $this->sha1_password = $v;
+ $this->modifiedColumns[] = UserPeer::SHA1_PASSWORD;
+ }
+
+ }
+
+ public function setSalt($v)
+ {
+
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->salt !== $v) {
+ $this->salt = $v;
+ $this->modifiedColumns[] = UserPeer::SALT;
+ }
+
+ }
+
+ public function setRoleId($v)
+ {
+
+ if ($v !== null && !is_int($v) && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->role_id !== $v) {
+ $this->role_id = $v;
+ $this->modifiedColumns[] = UserPeer::ROLE_ID;
+ }
+
+ if ($this->aRole !== null && $this->aRole->getId() !== $v) {
+ $this->aRole = null;
+ }
+
+ }
+
+ public function setLastLogin($v)
+ {
+
+ if ($v !== null && !is_int($v)) {
+ $ts = strtotime($v);
+ if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse date/time value for [last_login] from input: " . var_export($v, true));
+ }
+ } else {
+ $ts = $v;
+ }
+ if ($this->last_login !== $ts) {
+ $this->last_login = $ts;
+ $this->modifiedColumns[] = UserPeer::LAST_LOGIN;
+ }
+
+ }
+
+ public function setCreatedAt($v)
+ {
+
+ if ($v !== null && !is_int($v)) {
+ $ts = strtotime($v);
+ if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse date/time value for [created_at] from input: " . var_export($v, true));
+ }
+ } else {
+ $ts = $v;
+ }
+ if ($this->created_at !== $ts) {
+ $this->created_at = $ts;
+ $this->modifiedColumns[] = UserPeer::CREATED_AT;
+ }
+
+ }
+
+ public function hydrate(ResultSet $rs, $startcol = 1)
+ {
+ try {
+
+ $this->id = $rs->getInt($startcol + 0);
+
+ $this->parent_user_id = $rs->getInt($startcol + 1);
+
+ $this->nickname = $rs->getString($startcol + 2);
+
+ $this->first_name = $rs->getString($startcol + 3);
+
+ $this->last_name = $rs->getString($startcol + 4);
+
+ $this->email = $rs->getString($startcol + 5);
+
+ $this->sha1_password = $rs->getString($startcol + 6);
+
+ $this->salt = $rs->getString($startcol + 7);
+
+ $this->role_id = $rs->getInt($startcol + 8);
+
+ $this->last_login = $rs->getTimestamp($startcol + 9, null);
+
+ $this->created_at = $rs->getTimestamp($startcol + 10, null);
+
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ return $startcol + 11;
+ } catch (Exception $e) {
+ throw new PropelException("Error populating User object", $e);
+ }
+ }
+
+
+ public function delete($con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("This object has already been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(UserPeer::DATABASE_NAME);
+ }
+
+ try {
+ $con->begin();
+ UserPeer::doDelete($this, $con);
+ $this->setDeleted(true);
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+
+ public function save($con = null)
+ {
+ if ($this->isNew() && !$this->isColumnModified(UserPeer::CREATED_AT))
+ {
+ $this->setCreatedAt(time());
+ }
+
+ if ($this->isDeleted()) {
+ throw new PropelException("You cannot save an object that has been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(UserPeer::DATABASE_NAME);
+ }
+
+ try {
+ $con->begin();
+ $affectedRows = $this->doSave($con);
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+
+ protected function doSave($con)
+ {
+ $affectedRows = 0; if (!$this->alreadyInSave) {
+ $this->alreadyInSave = true;
+
+
+
+ if ($this->aUserRelatedByParentUserId !== null) {
+ if ($this->aUserRelatedByParentUserId->isModified()) {
+ $affectedRows += $this->aUserRelatedByParentUserId->save($con);
+ }
+ $this->setUserRelatedByParentUserId($this->aUserRelatedByParentUserId);
+ }
+
+ if ($this->aRole !== null) {
+ if ($this->aRole->isModified()) {
+ $affectedRows += $this->aRole->save($con);
+ }
+ $this->setRole($this->aRole);
+ }
+
+
+ if ($this->isModified()) {
+ if ($this->isNew()) {
+ $pk = UserPeer::doInsert($this, $con);
+ $affectedRows += 1;
+ $this->setId($pk);
+ $this->setNew(false);
+ } else {
+ $affectedRows += UserPeer::doUpdate($this, $con);
+ }
+ $this->resetModified(); }
+
+ if ($this->collUsersRelatedByParentUserId !== null) {
+ foreach($this->collUsersRelatedByParentUserId as $referrerFK) {
+ if (!$referrerFK->isDeleted()) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ if ($this->collDomainPermissions !== null) {
+ foreach($this->collDomainPermissions as $referrerFK) {
+ if (!$referrerFK->isDeleted()) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ if ($this->collDomains !== null) {
+ foreach($this->collDomains as $referrerFK) {
+ if (!$referrerFK->isDeleted()) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ if ($this->collLogEntrys !== null) {
+ foreach($this->collLogEntrys as $referrerFK) {
+ if (!$referrerFK->isDeleted()) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ $this->alreadyInSave = false;
+ }
+ return $affectedRows;
+ }
+
+ protected $validationFailures = array();
+
+
+ public function getValidationFailures()
+ {
+ return $this->validationFailures;
+ }
+
+
+ public function validate($columns = null)
+ {
+ $res = $this->doValidate($columns);
+ if ($res === true) {
+ $this->validationFailures = array();
+ return true;
+ } else {
+ $this->validationFailures = $res;
+ return false;
+ }
+ }
+
+
+ protected function doValidate($columns = null)
+ {
+ if (!$this->alreadyInValidation) {
+ $this->alreadyInValidation = true;
+ $retval = null;
+
+ $failureMap = array();
+
+
+
+ if ($this->aUserRelatedByParentUserId !== null) {
+ if (!$this->aUserRelatedByParentUserId->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aUserRelatedByParentUserId->getValidationFailures());
+ }
+ }
+
+ if ($this->aRole !== null) {
+ if (!$this->aRole->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aRole->getValidationFailures());
+ }
+ }
+
+
+ if (($retval = UserPeer::doValidate($this, $columns)) !== true) {
+ $failureMap = array_merge($failureMap, $retval);
+ }
+
+
+ if ($this->collDomainPermissions !== null) {
+ foreach($this->collDomainPermissions as $referrerFK) {
+ if (!$referrerFK->validate($columns)) {
+ $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
+ }
+ }
+ }
+
+ if ($this->collDomains !== null) {
+ foreach($this->collDomains as $referrerFK) {
+ if (!$referrerFK->validate($columns)) {
+ $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
+ }
+ }
+ }
+
+ if ($this->collLogEntrys !== null) {
+ foreach($this->collLogEntrys as $referrerFK) {
+ if (!$referrerFK->validate($columns)) {
+ $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
+ }
+ }
+ }
+
+
+ $this->alreadyInValidation = false;
+ }
+
+ return (!empty($failureMap) ? $failureMap : true);
+ }
+
+
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = UserPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ return $this->getByPosition($pos);
+ }
+
+
+ public function getByPosition($pos)
+ {
+ switch($pos) {
+ case 0:
+ return $this->getId();
+ break;
+ case 1:
+ return $this->getParentUserId();
+ break;
+ case 2:
+ return $this->getNickname();
+ break;
+ case 3:
+ return $this->getFirstName();
+ break;
+ case 4:
+ return $this->getLastName();
+ break;
+ case 5:
+ return $this->getEmail();
+ break;
+ case 6:
+ return $this->getSha1Password();
+ break;
+ case 7:
+ return $this->getSalt();
+ break;
+ case 8:
+ return $this->getRoleId();
+ break;
+ case 9:
+ return $this->getLastLogin();
+ break;
+ case 10:
+ return $this->getCreatedAt();
+ break;
+ default:
+ return null;
+ break;
+ } }
+
+
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = UserPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getParentUserId(),
+ $keys[2] => $this->getNickname(),
+ $keys[3] => $this->getFirstName(),
+ $keys[4] => $this->getLastName(),
+ $keys[5] => $this->getEmail(),
+ $keys[6] => $this->getSha1Password(),
+ $keys[7] => $this->getSalt(),
+ $keys[8] => $this->getRoleId(),
+ $keys[9] => $this->getLastLogin(),
+ $keys[10] => $this->getCreatedAt(),
+ );
+ return $result;
+ }
+
+
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = UserPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ return $this->setByPosition($pos, $value);
+ }
+
+
+ public function setByPosition($pos, $value)
+ {
+ switch($pos) {
+ case 0:
+ $this->setId($value);
+ break;
+ case 1:
+ $this->setParentUserId($value);
+ break;
+ case 2:
+ $this->setNickname($value);
+ break;
+ case 3:
+ $this->setFirstName($value);
+ break;
+ case 4:
+ $this->setLastName($value);
+ break;
+ case 5:
+ $this->setEmail($value);
+ break;
+ case 6:
+ $this->setSha1Password($value);
+ break;
+ case 7:
+ $this->setSalt($value);
+ break;
+ case 8:
+ $this->setRoleId($value);
+ break;
+ case 9:
+ $this->setLastLogin($value);
+ break;
+ case 10:
+ $this->setCreatedAt($value);
+ break;
+ } }
+
+
+ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = UserPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setParentUserId($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setNickname($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setFirstName($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setLastName($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setEmail($arr[$keys[5]]);
+ if (array_key_exists($keys[6], $arr)) $this->setSha1Password($arr[$keys[6]]);
+ if (array_key_exists($keys[7], $arr)) $this->setSalt($arr[$keys[7]]);
+ if (array_key_exists($keys[8], $arr)) $this->setRoleId($arr[$keys[8]]);
+ if (array_key_exists($keys[9], $arr)) $this->setLastLogin($arr[$keys[9]]);
+ if (array_key_exists($keys[10], $arr)) $this->setCreatedAt($arr[$keys[10]]);
+ }
+
+
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(UserPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(UserPeer::ID)) $criteria->add(UserPeer::ID, $this->id);
+ if ($this->isColumnModified(UserPeer::PARENT_USER_ID)) $criteria->add(UserPeer::PARENT_USER_ID, $this->parent_user_id);
+ if ($this->isColumnModified(UserPeer::NICKNAME)) $criteria->add(UserPeer::NICKNAME, $this->nickname);
+ if ($this->isColumnModified(UserPeer::FIRST_NAME)) $criteria->add(UserPeer::FIRST_NAME, $this->first_name);
+ if ($this->isColumnModified(UserPeer::LAST_NAME)) $criteria->add(UserPeer::LAST_NAME, $this->last_name);
+ if ($this->isColumnModified(UserPeer::EMAIL)) $criteria->add(UserPeer::EMAIL, $this->email);
+ if ($this->isColumnModified(UserPeer::SHA1_PASSWORD)) $criteria->add(UserPeer::SHA1_PASSWORD, $this->sha1_password);
+ if ($this->isColumnModified(UserPeer::SALT)) $criteria->add(UserPeer::SALT, $this->salt);
+ if ($this->isColumnModified(UserPeer::ROLE_ID)) $criteria->add(UserPeer::ROLE_ID, $this->role_id);
+ if ($this->isColumnModified(UserPeer::LAST_LOGIN)) $criteria->add(UserPeer::LAST_LOGIN, $this->last_login);
+ if ($this->isColumnModified(UserPeer::CREATED_AT)) $criteria->add(UserPeer::CREATED_AT, $this->created_at);
+
+ return $criteria;
+ }
+
+
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(UserPeer::DATABASE_NAME);
+
+ $criteria->add(UserPeer::ID, $this->id);
+
+ return $criteria;
+ }
+
+
+ public function getPrimaryKey()
+ {
+ return $this->getId();
+ }
+
+
+ public function setPrimaryKey($key)
+ {
+ $this->setId($key);
+ }
+
+
+ public function copyInto($copyObj, $deepCopy = false)
+ {
+
+ $copyObj->setParentUserId($this->parent_user_id);
+
+ $copyObj->setNickname($this->nickname);
+
+ $copyObj->setFirstName($this->first_name);
+
+ $copyObj->setLastName($this->last_name);
+
+ $copyObj->setEmail($this->email);
+
+ $copyObj->setSha1Password($this->sha1_password);
+
+ $copyObj->setSalt($this->salt);
+
+ $copyObj->setRoleId($this->role_id);
+
+ $copyObj->setLastLogin($this->last_login);
+
+ $copyObj->setCreatedAt($this->created_at);
+
+
+ if ($deepCopy) {
+ $copyObj->setNew(false);
+
+ foreach($this->getUsersRelatedByParentUserId() as $relObj) {
+ if($this->getPrimaryKey() === $relObj->getPrimaryKey()) {
+ continue;
+ }
+
+ $copyObj->addUserRelatedByParentUserId($relObj->copy($deepCopy));
+ }
+
+ foreach($this->getDomainPermissions() as $relObj) {
+ $copyObj->addDomainPermission($relObj->copy($deepCopy));
+ }
+
+ foreach($this->getDomains() as $relObj) {
+ $copyObj->addDomain($relObj->copy($deepCopy));
+ }
+
+ foreach($this->getLogEntrys() as $relObj) {
+ $copyObj->addLogEntry($relObj->copy($deepCopy));
+ }
+
+ }
+
+ $copyObj->setNew(true);
+
+ $copyObj->setId(NULL);
+ }
+
+
+ public function copy($deepCopy = false)
+ {
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+ return $copyObj;
+ }
+
+
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new UserPeer();
+ }
+ return self::$peer;
+ }
+
+
+ public function setUserRelatedByParentUserId($v)
+ {
+
+
+ if ($v === null) {
+ $this->setParentUserId('-1');
+ } else {
+ $this->setParentUserId($v->getId());
+ }
+
+
+ $this->aUserRelatedByParentUserId = $v;
+ }
+
+
+
+ public function getUserRelatedByParentUserId($con = null)
+ {
+ include_once 'lib/model/om/BaseUserPeer.php';
+
+ if ($this->aUserRelatedByParentUserId === null && ($this->parent_user_id !== null)) {
+
+ $this->aUserRelatedByParentUserId = UserPeer::retrieveByPK($this->parent_user_id, $con);
+
+
+ }
+ return $this->aUserRelatedByParentUserId;
+ }
+
+
+ public function setRole($v)
+ {
+
+
+ if ($v === null) {
+ $this->setRoleId(NULL);
+ } else {
+ $this->setRoleId($v->getId());
+ }
+
+
+ $this->aRole = $v;
+ }
+
+
+
+ public function getRole($con = null)
+ {
+ include_once 'lib/model/om/BaseRolePeer.php';
+
+ if ($this->aRole === null && ($this->role_id !== null)) {
+
+ $this->aRole = RolePeer::retrieveByPK($this->role_id, $con);
+
+
+ }
+ return $this->aRole;
+ }
+
+
+ public function initUsersRelatedByParentUserId()
+ {
+ if ($this->collUsersRelatedByParentUserId === null) {
+ $this->collUsersRelatedByParentUserId = array();
+ }
+ }
+
+
+ public function getUsersRelatedByParentUserId($criteria = null, $con = null)
+ {
+ include_once 'lib/model/om/BaseUserPeer.php';
+ if ($criteria === null) {
+ $criteria = new Criteria();
+ }
+ elseif ($criteria instanceof Criteria)
+ {
+ $criteria = clone $criteria;
+ }
+
+ if ($this->collUsersRelatedByParentUserId === null) {
+ if ($this->isNew()) {
+ $this->collUsersRelatedByParentUserId = array();
+ } else {
+
+ $criteria->add(UserPeer::PARENT_USER_ID, $this->getId());
+
+ UserPeer::addSelectColumns($criteria);
+ $this->collUsersRelatedByParentUserId = UserPeer::doSelect($criteria, $con);
+ }
+ } else {
+ if (!$this->isNew()) {
+
+
+ $criteria->add(UserPeer::PARENT_USER_ID, $this->getId());
+
+ UserPeer::addSelectColumns($criteria);
+ if (!isset($this->lastUserRelatedByParentUserIdCriteria) || !$this->lastUserRelatedByParentUserIdCriteria->equals($criteria)) {
+ $this->collUsersRelatedByParentUserId = UserPeer::doSelect($criteria, $con);
+ }
+ }
+ }
+ $this->lastUserRelatedByParentUserIdCriteria = $criteria;
+ return $this->collUsersRelatedByParentUserId;
+ }
+
+
+ public function countUsersRelatedByParentUserId($criteria = null, $distinct = false, $con = null)
+ {
+ include_once 'lib/model/om/BaseUserPeer.php';
+ if ($criteria === null) {
+ $criteria = new Criteria();
+ }
+ elseif ($criteria instanceof Criteria)
+ {
+ $criteria = clone $criteria;
+ }
+
+ $criteria->add(UserPeer::PARENT_USER_ID, $this->getId());
+
+ return UserPeer::doCount($criteria, $distinct, $con);
+ }
+
+
+ public function addUserRelatedByParentUserId(User $l)
+ {
+ $this->collUsersRelatedByParentUserId[] = $l;
+ $l->setUserRelatedByParentUserId($this);
+ }
+
+
+
+ public function getUsersRelatedByParentUserIdJoinRole($criteria = null, $con = null)
+ {
+ include_once 'lib/model/om/BaseUserPeer.php';
+ if ($criteria === null) {
+ $criteria = new Criteria();
+ }
+ elseif ($criteria instanceof Criteria)
+ {
+ $criteria = clone $criteria;
+ }
+
+ if ($this->collUsersRelatedByParentUserId === null) {
+ if ($this->isNew()) {
+ $this->collUsersRelatedByParentUserId = array();
+ } else {
+
+ $criteria->add(UserPeer::PARENT_USER_ID, $this->getId());
+
+ $this->collUsersRelatedByParentUserId = UserPeer::doSelectJoinRole($criteria, $con);
+ }
+ } else {
+
+ $criteria->add(UserPeer::PARENT_USER_ID, $this->getId());
+
+ if (!isset($this->lastUserRelatedByParentUserIdCriteria) || !$this->lastUserRelatedByParentUserIdCriteria->equals($criteria)) {
+ $this->collUsersRelatedByParentUserId = UserPeer::doSelectJoinRole($criteria, $con);
+ }
+ }
+ $this->lastUserRelatedByParentUserIdCriteria = $criteria;
+
+ return $this->collUsersRelatedByParentUserId;
+ }
+
+
+ public function initDomainPermissions()
+ {
+ if ($this->collDomainPermissions === null) {
+ $this->collDomainPermissions = array();
+ }
+ }
+
+
+ public function getDomainPermissions($criteria = null, $con = null)
+ {
+ include_once 'lib/model/om/BaseDomainPermissionPeer.php';
+ if ($criteria === null) {
+ $criteria = new Criteria();
+ }
+ elseif ($criteria instanceof Criteria)
+ {
+ $criteria = clone $criteria;
+ }
+
+ if ($this->collDomainPermissions === null) {
+ if ($this->isNew()) {
+ $this->collDomainPermissions = array();
+ } else {
+
+ $criteria->add(DomainPermissionPeer::USER_ID, $this->getId());
+
+ DomainPermissionPeer::addSelectColumns($criteria);
+ $this->collDomainPermissions = DomainPermissionPeer::doSelect($criteria, $con);
+ }
+ } else {
+ if (!$this->isNew()) {
+
+
+ $criteria->add(DomainPermissionPeer::USER_ID, $this->getId());
+
+ DomainPermissionPeer::addSelectColumns($criteria);
+ if (!isset($this->lastDomainPermissionCriteria) || !$this->lastDomainPermissionCriteria->equals($criteria)) {
+ $this->collDomainPermissions = DomainPermissionPeer::doSelect($criteria, $con);
+ }
+ }
+ }
+ $this->lastDomainPermissionCriteria = $criteria;
+ return $this->collDomainPermissions;
+ }
+
+
+ public function countDomainPermissions($criteria = null, $distinct = false, $con = null)
+ {
+ include_once 'lib/model/om/BaseDomainPermissionPeer.php';
+ if ($criteria === null) {
+ $criteria = new Criteria();
+ }
+ elseif ($criteria instanceof Criteria)
+ {
+ $criteria = clone $criteria;
+ }
+
+ $criteria->add(DomainPermissionPeer::USER_ID, $this->getId());
+
+ return DomainPermissionPeer::doCount($criteria, $distinct, $con);
+ }
+
+
+ public function addDomainPermission(DomainPermission $l)
+ {
+ $this->collDomainPermissions[] = $l;
+ $l->setUser($this);
+ }
+
+
+
+ public function getDomainPermissionsJoinDomain($criteria = null, $con = null)
+ {
+ include_once 'lib/model/om/BaseDomainPermissionPeer.php';
+ if ($criteria === null) {
+ $criteria = new Criteria();
+ }
+ elseif ($criteria instanceof Criteria)
+ {
+ $criteria = clone $criteria;
+ }
+
+ if ($this->collDomainPermissions === null) {
+ if ($this->isNew()) {
+ $this->collDomainPermissions = array();
+ } else {
+
+ $criteria->add(DomainPermissionPeer::USER_ID, $this->getId());
+
+ $this->collDomainPermissions = DomainPermissionPeer::doSelectJoinDomain($criteria, $con);
+ }
+ } else {
+
+ $criteria->add(DomainPermissionPeer::USER_ID, $this->getId());
+
+ if (!isset($this->lastDomainPermissionCriteria) || !$this->lastDomainPermissionCriteria->equals($criteria)) {
+ $this->collDomainPermissions = DomainPermissionPeer::doSelectJoinDomain($criteria, $con);
+ }
+ }
+ $this->lastDomainPermissionCriteria = $criteria;
+
+ return $this->collDomainPermissions;
+ }
+
+
+ public function initDomains()
+ {
+ if ($this->collDomains === null) {
+ $this->collDomains = array();
+ }
+ }
+
+
+ public function getDomains($criteria = null, $con = null)
+ {
+ include_once 'lib/model/om/BaseDomainPeer.php';
+ if ($criteria === null) {
+ $criteria = new Criteria();
+ }
+ elseif ($criteria instanceof Criteria)
+ {
+ $criteria = clone $criteria;
+ }
+
+ if ($this->collDomains === null) {
+ if ($this->isNew()) {
+ $this->collDomains = array();
+ } else {
+
+ $criteria->add(DomainPeer::CREATOR_ID, $this->getId());
+
+ DomainPeer::addSelectColumns($criteria);
+ $this->collDomains = DomainPeer::doSelect($criteria, $con);
+ }
+ } else {
+ if (!$this->isNew()) {
+
+
+ $criteria->add(DomainPeer::CREATOR_ID, $this->getId());
+
+ DomainPeer::addSelectColumns($criteria);
+ if (!isset($this->lastDomainCriteria) || !$this->lastDomainCriteria->equals($criteria)) {
+ $this->collDomains = DomainPeer::doSelect($criteria, $con);
+ }
+ }
+ }
+ $this->lastDomainCriteria = $criteria;
+ return $this->collDomains;
+ }
+
+
+ public function countDomains($criteria = null, $distinct = false, $con = null)
+ {
+ include_once 'lib/model/om/BaseDomainPeer.php';
+ if ($criteria === null) {
+ $criteria = new Criteria();
+ }
+ elseif ($criteria instanceof Criteria)
+ {
+ $criteria = clone $criteria;
+ }
+
+ $criteria->add(DomainPeer::CREATOR_ID, $this->getId());
+
+ return DomainPeer::doCount($criteria, $distinct, $con);
+ }
+
+
+ public function addDomain(Domain $l)
+ {
+ $this->collDomains[] = $l;
+ $l->setUser($this);
+ }
+
+
+ public function initLogEntrys()
+ {
+ if ($this->collLogEntrys === null) {
+ $this->collLogEntrys = array();
+ }
+ }
+
+
+ public function getLogEntrys($criteria = null, $con = null)
+ {
+ include_once 'lib/model/om/BaseLogEntryPeer.php';
+ if ($criteria === null) {
+ $criteria = new Criteria();
+ }
+ elseif ($criteria instanceof Criteria)
+ {
+ $criteria = clone $criteria;
+ }
+
+ if ($this->collLogEntrys === null) {
+ if ($this->isNew()) {
+ $this->collLogEntrys = array();
+ } else {
+
+ $criteria->add(LogEntryPeer::USER_ID, $this->getId());
+
+ LogEntryPeer::addSelectColumns($criteria);
+ $this->collLogEntrys = LogEntryPeer::doSelect($criteria, $con);
+ }
+ } else {
+ if (!$this->isNew()) {
+
+
+ $criteria->add(LogEntryPeer::USER_ID, $this->getId());
+
+ LogEntryPeer::addSelectColumns($criteria);
+ if (!isset($this->lastLogEntryCriteria) || !$this->lastLogEntryCriteria->equals($criteria)) {
+ $this->collLogEntrys = LogEntryPeer::doSelect($criteria, $con);
+ }
+ }
+ }
+ $this->lastLogEntryCriteria = $criteria;
+ return $this->collLogEntrys;
+ }
+
+
+ public function countLogEntrys($criteria = null, $distinct = false, $con = null)
+ {
+ include_once 'lib/model/om/BaseLogEntryPeer.php';
+ if ($criteria === null) {
+ $criteria = new Criteria();
+ }
+ elseif ($criteria instanceof Criteria)
+ {
+ $criteria = clone $criteria;
+ }
+
+ $criteria->add(LogEntryPeer::USER_ID, $this->getId());
+
+ return LogEntryPeer::doCount($criteria, $distinct, $con);
+ }
+
+
+ public function addLogEntry(LogEntry $l)
+ {
+ $this->collLogEntrys[] = $l;
+ $l->setUser($this);
+ }
+
+} \ No newline at end of file
diff --git a/lib/model/om/BaseUserPeer.php b/lib/model/om/BaseUserPeer.php
new file mode 100644
index 0000000..605ff27
--- /dev/null
+++ b/lib/model/om/BaseUserPeer.php
@@ -0,0 +1,758 @@
+<?php
+
+
+abstract class BaseUserPeer {
+
+
+ const DATABASE_NAME = 'propel';
+
+
+ const TABLE_NAME = 'user';
+
+
+ const CLASS_DEFAULT = 'lib.model.User';
+
+
+ const NUM_COLUMNS = 11;
+
+
+ const NUM_LAZY_LOAD_COLUMNS = 0;
+
+
+
+ const ID = 'user.ID';
+
+
+ const PARENT_USER_ID = 'user.PARENT_USER_ID';
+
+
+ const NICKNAME = 'user.NICKNAME';
+
+
+ const FIRST_NAME = 'user.FIRST_NAME';
+
+
+ const LAST_NAME = 'user.LAST_NAME';
+
+
+ const EMAIL = 'user.EMAIL';
+
+
+ const SHA1_PASSWORD = 'user.SHA1_PASSWORD';
+
+
+ const SALT = 'user.SALT';
+
+
+ const ROLE_ID = 'user.ROLE_ID';
+
+
+ const LAST_LOGIN = 'user.LAST_LOGIN';
+
+
+ const CREATED_AT = 'user.CREATED_AT';
+
+
+ private static $phpNameMap = null;
+
+
+
+ private static $fieldNames = array (
+ BasePeer::TYPE_PHPNAME => array ('Id', 'ParentUserId', 'Nickname', 'FirstName', 'LastName', 'Email', 'Sha1Password', 'Salt', 'RoleId', 'LastLogin', 'CreatedAt', ),
+ BasePeer::TYPE_COLNAME => array (UserPeer::ID, UserPeer::PARENT_USER_ID, UserPeer::NICKNAME, UserPeer::FIRST_NAME, UserPeer::LAST_NAME, UserPeer::EMAIL, UserPeer::SHA1_PASSWORD, UserPeer::SALT, UserPeer::ROLE_ID, UserPeer::LAST_LOGIN, UserPeer::CREATED_AT, ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'parent_user_id', 'nickname', 'first_name', 'last_name', 'email', 'sha1_password', 'salt', 'role_id', 'last_login', 'created_at', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
+ );
+
+
+ private static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'ParentUserId' => 1, 'Nickname' => 2, 'FirstName' => 3, 'LastName' => 4, 'Email' => 5, 'Sha1Password' => 6, 'Salt' => 7, 'RoleId' => 8, 'LastLogin' => 9, 'CreatedAt' => 10, ),
+ BasePeer::TYPE_COLNAME => array (UserPeer::ID => 0, UserPeer::PARENT_USER_ID => 1, UserPeer::NICKNAME => 2, UserPeer::FIRST_NAME => 3, UserPeer::LAST_NAME => 4, UserPeer::EMAIL => 5, UserPeer::SHA1_PASSWORD => 6, UserPeer::SALT => 7, UserPeer::ROLE_ID => 8, UserPeer::LAST_LOGIN => 9, UserPeer::CREATED_AT => 10, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'parent_user_id' => 1, 'nickname' => 2, 'first_name' => 3, 'last_name' => 4, 'email' => 5, 'sha1_password' => 6, 'salt' => 7, 'role_id' => 8, 'last_login' => 9, 'created_at' => 10, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
+ );
+
+
+ public static function getMapBuilder()
+ {
+ include_once 'lib/model/map/UserMapBuilder.php';
+ return BasePeer::getMapBuilder('lib.model.map.UserMapBuilder');
+ }
+
+ public static function getPhpNameMap()
+ {
+ if (self::$phpNameMap === null) {
+ $map = UserPeer::getTableMap();
+ $columns = $map->getColumns();
+ $nameMap = array();
+ foreach ($columns as $column) {
+ $nameMap[$column->getPhpName()] = $column->getColumnName();
+ }
+ self::$phpNameMap = $nameMap;
+ }
+ return self::$phpNameMap;
+ }
+
+ static public function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = self::getFieldNames($toType);
+ $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
+ if ($key === null) {
+ throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
+ }
+ return $toNames[$key];
+ }
+
+
+
+ static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, self::$fieldNames)) {
+ throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.');
+ }
+ return self::$fieldNames[$type];
+ }
+
+
+ public static function alias($alias, $column)
+ {
+ return str_replace(UserPeer::TABLE_NAME.'.', $alias.'.', $column);
+ }
+
+
+ public static function addSelectColumns(Criteria $criteria)
+ {
+
+ $criteria->addSelectColumn(UserPeer::ID);
+
+ $criteria->addSelectColumn(UserPeer::PARENT_USER_ID);
+
+ $criteria->addSelectColumn(UserPeer::NICKNAME);
+
+ $criteria->addSelectColumn(UserPeer::FIRST_NAME);
+
+ $criteria->addSelectColumn(UserPeer::LAST_NAME);
+
+ $criteria->addSelectColumn(UserPeer::EMAIL);
+
+ $criteria->addSelectColumn(UserPeer::SHA1_PASSWORD);
+
+ $criteria->addSelectColumn(UserPeer::SALT);
+
+ $criteria->addSelectColumn(UserPeer::ROLE_ID);
+
+ $criteria->addSelectColumn(UserPeer::LAST_LOGIN);
+
+ $criteria->addSelectColumn(UserPeer::CREATED_AT);
+
+ }
+
+ const COUNT = 'COUNT(user.ID)';
+ const COUNT_DISTINCT = 'COUNT(DISTINCT user.ID)';
+
+
+ public static function doCount(Criteria $criteria, $distinct = false, $con = null)
+ {
+ $criteria = clone $criteria;
+
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(UserPeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(UserPeer::COUNT);
+ }
+
+ foreach($criteria->getGroupByColumns() as $column)
+ {
+ $criteria->addSelectColumn($column);
+ }
+
+ $rs = UserPeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ return 0;
+ }
+ }
+
+ public static function doSelectOne(Criteria $criteria, $con = null)
+ {
+ $critcopy = clone $criteria;
+ $critcopy->setLimit(1);
+ $objects = UserPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+ return null;
+ }
+
+ public static function doSelect(Criteria $criteria, $con = null)
+ {
+ return UserPeer::populateObjects(UserPeer::doSelectRS($criteria, $con));
+ }
+
+ public static function doSelectRS(Criteria $criteria, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ if (!$criteria->getSelectColumns()) {
+ $criteria = clone $criteria;
+ UserPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ return BasePeer::doSelect($criteria, $con);
+ }
+
+ public static function populateObjects(ResultSet $rs)
+ {
+ $results = array();
+
+ $cls = UserPeer::getOMClass();
+ $cls = Propel::import($cls);
+ while($rs->next()) {
+
+ $obj = new $cls();
+ $obj->hydrate($rs);
+ $results[] = $obj;
+
+ }
+ return $results;
+ }
+
+
+ public static function doCountJoinRole(Criteria $criteria, $distinct = false, $con = null)
+ {
+ $criteria = clone $criteria;
+
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(UserPeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(UserPeer::COUNT);
+ }
+
+ foreach($criteria->getGroupByColumns() as $column)
+ {
+ $criteria->addSelectColumn($column);
+ }
+
+ $criteria->addJoin(UserPeer::ROLE_ID, RolePeer::ID);
+
+ $rs = UserPeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ return 0;
+ }
+ }
+
+
+
+ public static function doSelectJoinRole(Criteria $c, $con = null)
+ {
+ $c = clone $c;
+
+ if ($c->getDbName() == Propel::getDefaultDB()) {
+ $c->setDbName(self::DATABASE_NAME);
+ }
+
+ UserPeer::addSelectColumns($c);
+ $startcol = (UserPeer::NUM_COLUMNS - UserPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
+ RolePeer::addSelectColumns($c);
+
+ $c->addJoin(UserPeer::ROLE_ID, RolePeer::ID);
+ $rs = BasePeer::doSelect($c, $con);
+ $results = array();
+
+ while($rs->next()) {
+
+ $omClass = UserPeer::getOMClass();
+
+ $cls = Propel::import($omClass);
+ $obj1 = new $cls();
+ $obj1->hydrate($rs);
+
+ $omClass = RolePeer::getOMClass();
+
+ $cls = Propel::import($omClass);
+ $obj2 = new $cls();
+ $obj2->hydrate($rs, $startcol);
+
+ $newObject = true;
+ foreach($results as $temp_obj1) {
+ $temp_obj2 = $temp_obj1->getRole(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
+ $newObject = false;
+ $temp_obj2->addUser($obj1); break;
+ }
+ }
+ if ($newObject) {
+ $obj2->initUsers();
+ $obj2->addUser($obj1); }
+ $results[] = $obj1;
+ }
+ return $results;
+ }
+
+
+
+ public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null)
+ {
+ $criteria = clone $criteria;
+
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(UserPeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(UserPeer::COUNT);
+ }
+
+ foreach($criteria->getGroupByColumns() as $column)
+ {
+ $criteria->addSelectColumn($column);
+ }
+
+ $criteria->addJoin(UserPeer::ROLE_ID, RolePeer::ID);
+
+ $rs = UserPeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ return 0;
+ }
+ }
+
+
+
+ public static function doSelectJoinAll(Criteria $c, $con = null)
+ {
+ $c = clone $c;
+
+ if ($c->getDbName() == Propel::getDefaultDB()) {
+ $c->setDbName(self::DATABASE_NAME);
+ }
+
+ UserPeer::addSelectColumns($c);
+ $startcol2 = (UserPeer::NUM_COLUMNS - UserPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
+
+ RolePeer::addSelectColumns($c);
+ $startcol3 = $startcol2 + RolePeer::NUM_COLUMNS;
+
+ $c->addJoin(UserPeer::ROLE_ID, RolePeer::ID);
+
+ $rs = BasePeer::doSelect($c, $con);
+ $results = array();
+
+ while($rs->next()) {
+
+ $omClass = UserPeer::getOMClass();
+
+
+ $cls = Propel::import($omClass);
+ $obj1 = new $cls();
+ $obj1->hydrate($rs);
+
+
+
+ $omClass = RolePeer::getOMClass();
+
+
+ $cls = Propel::import($omClass);
+ $obj2 = new $cls();
+ $obj2->hydrate($rs, $startcol2);
+
+ $newObject = true;
+ for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
+ $temp_obj1 = $results[$j];
+ $temp_obj2 = $temp_obj1->getRole(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
+ $newObject = false;
+ $temp_obj2->addUser($obj1); break;
+ }
+ }
+
+ if ($newObject) {
+ $obj2->initUsers();
+ $obj2->addUser($obj1);
+ }
+
+ $results[] = $obj1;
+ }
+ return $results;
+ }
+
+
+
+ public static function doCountJoinAllExceptUserRelatedByParentUserId(Criteria $criteria, $distinct = false, $con = null)
+ {
+ $criteria = clone $criteria;
+
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(UserPeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(UserPeer::COUNT);
+ }
+
+ foreach($criteria->getGroupByColumns() as $column)
+ {
+ $criteria->addSelectColumn($column);
+ }
+
+ $criteria->addJoin(UserPeer::ROLE_ID, RolePeer::ID);
+
+ $rs = UserPeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ return 0;
+ }
+ }
+
+
+
+ public static function doCountJoinAllExceptRole(Criteria $criteria, $distinct = false, $con = null)
+ {
+ $criteria = clone $criteria;
+
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(UserPeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(UserPeer::COUNT);
+ }
+
+ foreach($criteria->getGroupByColumns() as $column)
+ {
+ $criteria->addSelectColumn($column);
+ }
+
+ $rs = UserPeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ return 0;
+ }
+ }
+
+
+
+ public static function doSelectJoinAllExceptUserRelatedByParentUserId(Criteria $c, $con = null)
+ {
+ $c = clone $c;
+
+ if ($c->getDbName() == Propel::getDefaultDB()) {
+ $c->setDbName(self::DATABASE_NAME);
+ }
+
+ UserPeer::addSelectColumns($c);
+ $startcol2 = (UserPeer::NUM_COLUMNS - UserPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
+
+ RolePeer::addSelectColumns($c);
+ $startcol3 = $startcol2 + RolePeer::NUM_COLUMNS;
+
+ $c->addJoin(UserPeer::ROLE_ID, RolePeer::ID);
+
+
+ $rs = BasePeer::doSelect($c, $con);
+ $results = array();
+
+ while($rs->next()) {
+
+ $omClass = UserPeer::getOMClass();
+
+ $cls = Propel::import($omClass);
+ $obj1 = new $cls();
+ $obj1->hydrate($rs);
+
+ $omClass = RolePeer::getOMClass();
+
+
+ $cls = Propel::import($omClass);
+ $obj2 = new $cls();
+ $obj2->hydrate($rs, $startcol2);
+
+ $newObject = true;
+ for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
+ $temp_obj1 = $results[$j];
+ $temp_obj2 = $temp_obj1->getRole(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
+ $newObject = false;
+ $temp_obj2->addUser($obj1);
+ break;
+ }
+ }
+
+ if ($newObject) {
+ $obj2->initUsers();
+ $obj2->addUser($obj1);
+ }
+
+ $results[] = $obj1;
+ }
+ return $results;
+ }
+
+
+
+ public static function doSelectJoinAllExceptRole(Criteria $c, $con = null)
+ {
+ $c = clone $c;
+
+ if ($c->getDbName() == Propel::getDefaultDB()) {
+ $c->setDbName(self::DATABASE_NAME);
+ }
+
+ UserPeer::addSelectColumns($c);
+ $startcol2 = (UserPeer::NUM_COLUMNS - UserPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
+
+
+ $rs = BasePeer::doSelect($c, $con);
+ $results = array();
+
+ while($rs->next()) {
+
+ $omClass = UserPeer::getOMClass();
+
+ $cls = Propel::import($omClass);
+ $obj1 = new $cls();
+ $obj1->hydrate($rs);
+
+ $results[] = $obj1;
+ }
+ return $results;
+ }
+
+
+ public static function getTableMap()
+ {
+ return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
+ }
+
+
+ public static function getOMClass()
+ {
+ return UserPeer::CLASS_DEFAULT;
+ }
+
+
+ public static function doInsert($values, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; } else {
+ $criteria = $values->buildCriteria(); }
+
+ $criteria->remove(UserPeer::ID);
+
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ try {
+ $con->begin();
+ $pk = BasePeer::doInsert($criteria, $con);
+ $con->commit();
+ } catch(PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+
+ public static function doUpdate($values, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ $selectCriteria = new Criteria(self::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values;
+ $comparison = $criteria->getComparison(UserPeer::ID);
+ $selectCriteria->add(UserPeer::ID, $criteria->remove(UserPeer::ID), $comparison);
+
+ } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); }
+
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+
+ public static function doDeleteAll($con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+ $affectedRows = 0; try {
+ $con->begin();
+ $affectedRows += UserPeer::doOnDeleteCascade(new Criteria(), $con);
+ UserPeer::doOnDeleteSetNull(new Criteria(), $con);
+ $affectedRows += BasePeer::doDeleteAll(UserPeer::TABLE_NAME, $con);
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+
+ public static function doDelete($values, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(UserPeer::DATABASE_NAME);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; } elseif ($values instanceof User) {
+
+ $criteria = $values->buildPkeyCriteria();
+ } else {
+ $criteria = new Criteria(self::DATABASE_NAME);
+ $criteria->add(UserPeer::ID, (array) $values, Criteria::IN);
+ }
+
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ $affectedRows = 0;
+ try {
+ $con->begin();
+ $affectedRows += UserPeer::doOnDeleteCascade($criteria, $con);UserPeer::doOnDeleteSetNull($criteria, $con);
+ $affectedRows += BasePeer::doDelete($criteria, $con);
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+
+ protected static function doOnDeleteCascade(Criteria $criteria, Connection $con)
+ {
+ $affectedRows = 0;
+
+ $objects = UserPeer::doSelect($criteria, $con);
+ foreach($objects as $obj) {
+
+
+ include_once 'lib/model/DomainPermission.php';
+
+ $c = new Criteria();
+
+ $c->add(DomainPermissionPeer::USER_ID, $obj->getId());
+ $affectedRows += DomainPermissionPeer::doDelete($c, $con);
+ }
+ return $affectedRows;
+ }
+
+
+ protected static function doOnDeleteSetNull(Criteria $criteria, Connection $con)
+ {
+
+ $objects = UserPeer::doSelect($criteria, $con);
+ foreach($objects as $obj) {
+
+ $selectCriteria = new Criteria(UserPeer::DATABASE_NAME);
+ $updateValues = new Criteria(UserPeer::DATABASE_NAME);
+ $selectCriteria->add(DomainPeer::CREATOR_ID, $obj->getId());
+ $updateValues->add(DomainPeer::CREATOR_ID, null);
+
+ BasePeer::doUpdate($selectCriteria, $updateValues, $con);
+ $selectCriteria = new Criteria(UserPeer::DATABASE_NAME);
+ $updateValues = new Criteria(UserPeer::DATABASE_NAME);
+ $selectCriteria->add(LogEntryPeer::USER_ID, $obj->getId());
+ $updateValues->add(LogEntryPeer::USER_ID, null);
+
+ BasePeer::doUpdate($selectCriteria, $updateValues, $con);
+ }
+ }
+
+
+ public static function doValidate(User $obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(UserPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(UserPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach($cols as $colName) {
+ if ($tableMap->containsColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ $res = BasePeer::doValidate(UserPeer::DATABASE_NAME, UserPeer::TABLE_NAME, $columns);
+ if ($res !== true) {
+ $request = sfContext::getInstance()->getRequest();
+ foreach ($res as $failed) {
+ $col = UserPeer::translateFieldname($failed->getColumn(), BasePeer::TYPE_COLNAME, BasePeer::TYPE_PHPNAME);
+ $request->setError($col, $failed->getMessage());
+ }
+ }
+
+ return $res;
+ }
+
+
+ public static function retrieveByPK($pk, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ $criteria = new Criteria(UserPeer::DATABASE_NAME);
+
+ $criteria->add(UserPeer::ID, $pk);
+
+
+ $v = UserPeer::doSelect($criteria, $con);
+
+ return !empty($v) > 0 ? $v[0] : null;
+ }
+
+
+ public static function retrieveByPKs($pks, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ $objs = null;
+ if (empty($pks)) {
+ $objs = array();
+ } else {
+ $criteria = new Criteria();
+ $criteria->add(UserPeer::ID, $pks, Criteria::IN);
+ $objs = UserPeer::doSelect($criteria, $con);
+ }
+ return $objs;
+ }
+
+}
+if (Propel::isInit()) {
+ try {
+ BaseUserPeer::getMapBuilder();
+ } catch (Exception $e) {
+ Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR);
+ }
+} else {
+ require_once 'lib/model/map/UserMapBuilder.php';
+ Propel::registerMapBuilder('lib.model.map.UserMapBuilder');
+}
diff --git a/symfony b/symfony
new file mode 100755
index 0000000..b540da2
--- /dev/null
+++ b/symfony
@@ -0,0 +1,14 @@
+#!/usr/bin/env php
+<?php
+
+/*
+ * This file is part of the symfony package.
+ * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+chdir(dirname(__FILE__));
+include('config/config.php');
+include($sf_symfony_data_dir.'/bin/symfony.php');
diff --git a/test/bootstrap/functional.php b/test/bootstrap/functional.php
new file mode 100644
index 0000000..05ea38c
--- /dev/null
+++ b/test/bootstrap/functional.php
@@ -0,0 +1,29 @@
+<?php
+
+/*
+ * This file is part of the symfony package.
+ * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+// guess current application
+if (!isset($app))
+{
+ $traces = debug_backtrace();
+ $caller = $traces[0];
+ $app = array_pop(explode(DIRECTORY_SEPARATOR, dirname($caller['file'])));
+}
+
+// define symfony constant
+define('SF_ROOT_DIR', realpath(dirname(__FILE__).'/../..'));
+define('SF_APP', $app);
+define('SF_ENVIRONMENT', 'test');
+define('SF_DEBUG', true);
+
+// initialize symfony
+require_once(SF_ROOT_DIR.DIRECTORY_SEPARATOR.'apps'.DIRECTORY_SEPARATOR.SF_APP.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.php');
+
+// remove all cache
+sfToolkit::clearDirectory(sfConfig::get('sf_cache_dir'));
diff --git a/test/bootstrap/unit.php b/test/bootstrap/unit.php
new file mode 100644
index 0000000..fccb9eb
--- /dev/null
+++ b/test/bootstrap/unit.php
@@ -0,0 +1,17 @@
+<?php
+
+/*
+ * This file is part of the symfony package.
+ * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+$_test_dir = realpath(dirname(__FILE__).'/..');
+define('SF_ROOT_DIR', realpath($_test_dir.'/..'));
+
+// symfony directories
+include(SF_ROOT_DIR.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.php');
+
+require_once($sf_symfony_lib_dir.'/vendor/lime/lime.php');
diff --git a/test/functional/admin/addressActionsTest.php b/test/functional/admin/addressActionsTest.php
new file mode 100644
index 0000000..853c9c4
--- /dev/null
+++ b/test/functional/admin/addressActionsTest.php
@@ -0,0 +1,15 @@
+<?php
+
+include(dirname(__FILE__).'/../../bootstrap/functional.php');
+
+// create a new test browser
+$browser = new sfTestBrowser();
+$browser->initialize();
+
+$browser->
+ get('/address/index')->
+ isStatusCode(200)->
+ isRequestParameter('module', 'address')->
+ isRequestParameter('action', 'index')->
+ checkResponseElement('body', '!/This is a temporary page/')
+;
diff --git a/test/functional/admin/administratorActionsTest.php b/test/functional/admin/administratorActionsTest.php
new file mode 100644
index 0000000..3084fb3
--- /dev/null
+++ b/test/functional/admin/administratorActionsTest.php
@@ -0,0 +1,15 @@
+<?php
+
+include(dirname(__FILE__).'/../../bootstrap/functional.php');
+
+// create a new test browser
+$browser = new sfTestBrowser();
+$browser->initialize();
+
+$browser->
+ get('/administrator/index')->
+ isStatusCode(200)->
+ isRequestParameter('module', 'administrator')->
+ isRequestParameter('action', 'index')->
+ checkResponseElement('body', '!/This is a temporary page/')
+;
diff --git a/test/functional/admin/contentActionsTest.php b/test/functional/admin/contentActionsTest.php
new file mode 100644
index 0000000..94650a4
--- /dev/null
+++ b/test/functional/admin/contentActionsTest.php
@@ -0,0 +1,15 @@
+<?php
+
+include(dirname(__FILE__).'/../../bootstrap/functional.php');
+
+// create a new test browser
+$browser = new sfTestBrowser();
+$browser->initialize();
+
+$browser->
+ get('/content/index')->
+ isStatusCode(200)->
+ isRequestParameter('module', 'content')->
+ isRequestParameter('action', 'index')->
+ checkResponseElement('body', '!/This is a temporary page/')
+;
diff --git a/test/functional/admin/domainActionsTest.php b/test/functional/admin/domainActionsTest.php
new file mode 100644
index 0000000..955fed1
--- /dev/null
+++ b/test/functional/admin/domainActionsTest.php
@@ -0,0 +1,15 @@
+<?php
+
+include(dirname(__FILE__).'/../../bootstrap/functional.php');
+
+// create a new test browser
+$browser = new sfTestBrowser();
+$browser->initialize();
+
+$browser->
+ get('/domain/index')->
+ isStatusCode(200)->
+ isRequestParameter('module', 'domain')->
+ isRequestParameter('action', 'index')->
+ checkResponseElement('body', '!/This is a temporary page/')
+;
diff --git a/test/functional/admin/domaintestActionsTest.php b/test/functional/admin/domaintestActionsTest.php
new file mode 100644
index 0000000..dba9ffa
--- /dev/null
+++ b/test/functional/admin/domaintestActionsTest.php
@@ -0,0 +1,15 @@
+<?php
+
+include(dirname(__FILE__).'/../../bootstrap/functional.php');
+
+// create a new test browser
+$browser = new sfTestBrowser();
+$browser->initialize();
+
+$browser->
+ get('/domaintest/index')->
+ isStatusCode(200)->
+ isRequestParameter('module', 'domaintest')->
+ isRequestParameter('action', 'index')->
+ checkResponseElement('body', '!/This is a temporary page/')
+;
diff --git a/test/functional/admin/logActionsTest.php b/test/functional/admin/logActionsTest.php
new file mode 100644
index 0000000..8e10f64
--- /dev/null
+++ b/test/functional/admin/logActionsTest.php
@@ -0,0 +1,15 @@
+<?php
+
+include(dirname(__FILE__).'/../../bootstrap/functional.php');
+
+// create a new test browser
+$browser = new sfTestBrowser();
+$browser->initialize();
+
+$browser->
+ get('/log/index')->
+ isStatusCode(200)->
+ isRequestParameter('module', 'log')->
+ isRequestParameter('action', 'index')->
+ checkResponseElement('body', '!/This is a temporary page/')
+;
diff --git a/test/functional/admin/mailboxActionsTest.php b/test/functional/admin/mailboxActionsTest.php
new file mode 100644
index 0000000..42bf697
--- /dev/null
+++ b/test/functional/admin/mailboxActionsTest.php
@@ -0,0 +1,15 @@
+<?php
+
+include(dirname(__FILE__).'/../../bootstrap/functional.php');
+
+// create a new test browser
+$browser = new sfTestBrowser();
+$browser->initialize();
+
+$browser->
+ get('/mailbox/index')->
+ isStatusCode(200)->
+ isRequestParameter('module', 'mailbox')->
+ isRequestParameter('action', 'index')->
+ checkResponseElement('body', '!/This is a temporary page/')
+;
diff --git a/test/functional/admin/serverActionsTest.php b/test/functional/admin/serverActionsTest.php
new file mode 100644
index 0000000..3ea4a37
--- /dev/null
+++ b/test/functional/admin/serverActionsTest.php
@@ -0,0 +1,15 @@
+<?php
+
+include(dirname(__FILE__).'/../../bootstrap/functional.php');
+
+// create a new test browser
+$browser = new sfTestBrowser();
+$browser->initialize();
+
+$browser->
+ get('/server/index')->
+ isStatusCode(200)->
+ isRequestParameter('module', 'server')->
+ isRequestParameter('action', 'index')->
+ checkResponseElement('body', '!/This is a temporary page/')
+;
diff --git a/test/functional/admin/userActionsTest.php b/test/functional/admin/userActionsTest.php
new file mode 100644
index 0000000..fca0dd1
--- /dev/null
+++ b/test/functional/admin/userActionsTest.php
@@ -0,0 +1,15 @@
+<?php
+
+include(dirname(__FILE__).'/../../bootstrap/functional.php');
+
+// create a new test browser
+$browser = new sfTestBrowser();
+$browser->initialize();
+
+$browser->
+ get('/user/index')->
+ isStatusCode(200)->
+ isRequestParameter('module', 'user')->
+ isRequestParameter('action', 'index')->
+ checkResponseElement('body', '!/This is a temporary page/')
+;
diff --git a/web/.htaccess b/web/.htaccess
new file mode 100644
index 0000000..2c0a59f
--- /dev/null
+++ b/web/.htaccess
@@ -0,0 +1,25 @@
+Options +FollowSymLinks +ExecCGI
+
+<IfModule mod_rewrite.c>
+ RewriteEngine On
+
+ # uncomment the following line, if you are having trouble
+ # getting no_script_name to work
+ #RewriteBase /
+
+ # we skip all files with .something
+ RewriteCond %{REQUEST_URI} \..+$
+ RewriteCond %{REQUEST_URI} !\.html$
+ RewriteRule .* - [L]
+
+ # we check if the .html version is here (caching)
+ RewriteRule ^$ index.html [QSA]
+ RewriteRule ^([^.]+)$ $1.html [QSA]
+ RewriteCond %{REQUEST_FILENAME} !-f
+
+ # no, so we redirect to our front web controller
+ RewriteRule ^(.*)$ index.php [QSA,L]
+</IfModule>
+
+# big crash from our front web controller
+ErrorDocument 500 "<h2>Application error</h2>symfony application failed to start properly"
diff --git a/web/admin_dev.php b/web/admin_dev.php
new file mode 100644
index 0000000..931e0a7
--- /dev/null
+++ b/web/admin_dev.php
@@ -0,0 +1,10 @@
+<?php
+
+define('SF_ROOT_DIR', realpath(dirname(__FILE__).'/..'));
+define('SF_APP', 'admin');
+define('SF_ENVIRONMENT', 'dev');
+define('SF_DEBUG', true);
+
+require_once(SF_ROOT_DIR.DIRECTORY_SEPARATOR.'apps'.DIRECTORY_SEPARATOR.SF_APP.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.php');
+
+sfContext::getInstance()->getController()->dispatch();
diff --git a/web/css/main.css b/web/css/main.css
new file mode 100644
index 0000000..2a66410
--- /dev/null
+++ b/web/css/main.css
@@ -0,0 +1,405 @@
+/* -------------------------------------------------------------------------- */
+/* Common */
+/* -------------------------------------------------------------------------- */
+
+html body {
+ background-color:#ece9d8;
+ height:100%;
+ margin:0;
+ font-size:x-small;
+ voice-family:"\"}\"";
+ voice-family:inherit;
+ font-size:small;
+}
+
+/* !IE */
+html>/**/body {
+ font-size:small;
+}
+
+.base {
+ font-family:Verdana, Helvetica, Sans-Serif;
+ line-height:1.4em;
+ font-size:96%;
+ background-color:transparent;
+ padding:0;
+ margin:0;
+}
+
+/* -------------------------------------------------------------------------- */
+/* Structure */
+/* -------------------------------------------------------------------------- */
+
+.base div.branding {
+ margin:0;
+ padding:20px;
+ height:40px;
+ background-image: url("../images/background-branding.png");
+ background-repeat: repeat-x;
+}
+
+.base div.branding div.logo {
+ float:left;
+ padding-top:4px;
+}
+
+.base div.session {
+ margin:0;
+ padding:5px 20px 5px 20px;
+ background-color:#fff3dc;
+}
+
+.base div.session ul {
+ padding:0;
+ margin:0;
+}
+
+.base div.session li {
+ padding:0;
+ margin-right:20px;
+ display:inline;
+}
+
+.base div.session a {
+ text-decoration:none;
+ border-bottom:1px dotted;
+ color:#006699;
+ font-weight:bold;
+}
+
+.base div.navigation {
+ margin:0;
+ padding:10px 20px 9px 20px;
+ background-image: url("../images/background-navigation.png");
+ background-position:top left;
+}
+
+.base div.navigation ul {
+ padding:0;
+ margin:0;
+}
+
+.base div.navigation li {
+ margin:0;
+ height:1%; /* IE <= 5.5 */
+ padding-right:10px;
+ display:inline;
+}
+
+.base div.navigation li a {
+ margin:0;
+ padding:2px 10px 9px 10px;
+ text-decoration:none;
+ font-size:16px;
+ font-weight:bold;
+ color:#fff;
+}
+
+.base div.navigation li.active a {
+ margin:0;
+ background-color:#485659;
+}
+
+.base div.subnavigation {
+ margin:0;
+ padding:6px 20px 5px 20px;
+ background-color:#485659;
+}
+
+.base div.subnavigation ul {
+ padding:0;
+ margin:0;
+}
+
+.base div.subnavigation li {
+ padding-right:10px;
+ margin:0;
+ height:1%; /* IE <= 5.5 */
+ display:inline;
+}
+
+.base div.subnavigation li a {
+ padding:3px 6px 6px 6px;
+ text-decoration:none;
+ color:#fff;
+}
+
+.base div.subnavigation li.active a {
+ background-color:white;
+ color:black;
+}
+
+.base div#context {
+ margin:0;
+ height:1%; /* IE <= 5.5 */
+ padding:20px;
+ background-color:white;
+}
+
+.base div#context div.tablenavigation {
+ text-align:right;
+}
+
+.base div#context div.tablenavigation a {
+ text-decoration:none;
+ color:#006699;
+}
+
+.base div#context div.tablenavigation ul {
+ margin:0;
+ padding:0;
+}
+
+.base div#context div.tablenavigation li {
+ margin:0;
+ padding-left:20px;
+ display:inline;
+}
+
+.base div#context hr {
+ height:1px;
+ border-top:1px dotted #999999;
+}
+
+.base div#context table {
+ width:100%;
+ border-spacing:5px;
+}
+
+.base div#context table tr.sf_admin_row_0 td {
+ background-color:#f5f4eb;
+}
+
+.base div#context table th {
+ padding:5px;
+ background-color:#ece9d8;
+}
+
+.base div#context table th a {
+ text-decoration: none;
+ color:#000;
+ font-weight:bold;
+ border-bottom:1px dotted;
+}
+
+.base div#context table td {
+ padding:5px;
+ background-color:#ece9d8;
+}
+
+.base div#context table td a {
+ text-decoration:none;
+ color:#006699;
+}
+
+.base div#context table td ul.sf_admin_td_actions {
+ margin:0;
+ padding:0;
+}
+
+.base div#context table td ul.sf_admin_td_actions li {
+ margin:0;
+ padding:0;
+ display:inline;
+}
+
+.base div#context table th#sf_admin_list_th_sf_actions {
+ text-align:left;
+}
+
+.base div#context div#sf_admin_content {
+ padding-top:10px;
+}
+
+.base div#context ul.sf_admin_actions {
+ margin:0;
+ padding:0;
+}
+
+.base div#context ul.sf_admin_actions li {
+ margin:0;
+ padding:0;
+ display:inline;
+}
+
+.base div#context div.sf_admin_edit_help {
+ color:#888a85;
+}
+
+.base div.notes {
+ margin:0;
+ padding:20px;
+ color:#999;
+ text-align:center;
+ background-image: url("../images/background-notes-start.png");
+ background-repeat: repeat-x;
+ background-position:top;
+}
+
+.base div.notes ul {
+ margin:0;
+ padding:0;
+}
+
+.base div.notes li {
+ margin:0;
+ padding:0;
+ padding-right:20px;
+ display:inline;
+}
+
+.base div.notes a {
+ color:#999;
+ text-decoration:none;
+ border-bottom:1px dotted;
+ font-weight:bold;
+}
+
+/* -------------------------------------------------------------------------- */
+/* Standard Tags */
+/* -------------------------------------------------------------------------- */
+
+.base img {
+ vertical-align:middle;
+ border:0;
+}
+
+.base h1 {
+ font-weight:normal;
+ font-size:24px;
+ color:#006699;
+ padding-bottom:10px;
+}
+
+.base h2 {
+ font-size:16px;
+ font-weight:bold;
+ color:#485659;
+}
+
+.base form {
+ margin:0;
+ padding:0;
+}
+
+.base form select {
+ color:#333;
+ font-size:small;
+ border:1px solid;
+}
+
+.base form input {
+ border:1px solid #485659;
+ font-size:small;
+ padding:2px;
+ vertical-align:middle;
+}
+
+.base form textarea {
+ border:1px solid #485659;
+ padding:2px;
+ font-size:small;
+}
+
+.base form label {
+ display:block;
+ color:#006699;
+ font-weight:bold;
+ padding-top:5px;
+}
+
+.base form fieldset {
+ border:0;
+ border-top:1px dotted #999999;
+ padding-left:0;
+ padding-right:0;
+ padding-bottom:20px;
+}
+
+.base form div.formaction, .base form div.sf_admin_actions {
+ display:block;
+ margin-top:10px;
+ padding-bottom:20px;
+}
+
+.base form div.formaction input {
+ margin-right:10px;
+}
+
+/* -------------------------------------------------------------------------- */
+/* Additional Formatting */
+/* -------------------------------------------------------------------------- */
+
+.base #indicator {
+ display:none;
+}
+
+.base div.slidelist ul {
+ margin:0;
+ padding:0;
+ list-style-type:none;
+}
+
+.base div.slidelist a {
+ border-bottom:1px dotted;
+}
+
+.base ul.linklist {
+ margin:0;
+ padding:0;
+ list-style-type:none;
+}
+
+.base ul.linklist li {
+ display:inline;
+ height:1%; /* IE == 5 */
+ padding-left:5px;
+ padding-right:5px;
+}
+
+.base ul.linklist li.label {
+ border:none;
+ padding-left:20px;
+}
+
+.base ul.linklist li a {
+ text-decoration:none;
+ color:#006699;
+}
+
+.base span.adminname {
+ font-style:italic;
+}
+
+.base span.adminrole {
+ color:#ff9900;
+}
+
+.base .form_error, .base .form-error-msg {
+ color:#ef2929;
+}
+
+.base .form_help {
+ padding-left:10px;
+ color:#999;
+}
+
+.base span.legal, .base span.legal a {
+}
+
+.base span.toggle a {
+ text-decoration:none;
+ color:#006699;
+ border-bottom:1px dotted;
+}
+
+.base span.pageinfo {
+}
+
+.base span.pageindex {
+ font-weight:bold;
+}
+
+.base span.summary {
+ padding-right:20px;
+}
diff --git a/web/images/add.gif b/web/images/add.gif
new file mode 100644
index 0000000..f7ab24a
--- /dev/null
+++ b/web/images/add.gif
Binary files differ
diff --git a/web/images/address-new.gif b/web/images/address-new.gif
new file mode 100644
index 0000000..98d6a9f
--- /dev/null
+++ b/web/images/address-new.gif
Binary files differ
diff --git a/web/images/address.gif b/web/images/address.gif
new file mode 100644
index 0000000..15842df
--- /dev/null
+++ b/web/images/address.gif
Binary files differ
diff --git a/web/images/background-branding.png b/web/images/background-branding.png
new file mode 100644
index 0000000..faeb260
--- /dev/null
+++ b/web/images/background-branding.png
Binary files differ
diff --git a/web/images/background-navigation.png b/web/images/background-navigation.png
new file mode 100644
index 0000000..0358ad3
--- /dev/null
+++ b/web/images/background-navigation.png
Binary files differ
diff --git a/web/images/background-notes-start.png b/web/images/background-notes-start.png
new file mode 100644
index 0000000..d0de8f3
--- /dev/null
+++ b/web/images/background-notes-start.png
Binary files differ
diff --git a/web/images/bottom.gif b/web/images/bottom.gif
new file mode 100644
index 0000000..a7a0730
--- /dev/null
+++ b/web/images/bottom.gif
Binary files differ
diff --git a/web/images/down.gif b/web/images/down.gif
new file mode 100644
index 0000000..7751dae
--- /dev/null
+++ b/web/images/down.gif
Binary files differ
diff --git a/web/images/edit.gif b/web/images/edit.gif
new file mode 100644
index 0000000..8b21080
--- /dev/null
+++ b/web/images/edit.gif
Binary files differ
diff --git a/web/images/error.gif b/web/images/error.gif
new file mode 100644
index 0000000..79c53a1
--- /dev/null
+++ b/web/images/error.gif
Binary files differ
diff --git a/web/images/favicon.ico b/web/images/favicon.ico
new file mode 100644
index 0000000..410daf6
--- /dev/null
+++ b/web/images/favicon.ico
Binary files differ
diff --git a/web/images/first.gif b/web/images/first.gif
new file mode 100644
index 0000000..99a2a74
--- /dev/null
+++ b/web/images/first.gif
Binary files differ
diff --git a/web/images/information.gif b/web/images/information.gif
new file mode 100644
index 0000000..0e89c99
--- /dev/null
+++ b/web/images/information.gif
Binary files differ
diff --git a/web/images/last.gif b/web/images/last.gif
new file mode 100644
index 0000000..35219f8
--- /dev/null
+++ b/web/images/last.gif
Binary files differ
diff --git a/web/images/list.gif b/web/images/list.gif
new file mode 100644
index 0000000..667ef38
--- /dev/null
+++ b/web/images/list.gif
Binary files differ
diff --git a/web/images/load.gif b/web/images/load.gif
new file mode 100644
index 0000000..cce32f2
--- /dev/null
+++ b/web/images/load.gif
Binary files differ
diff --git a/web/images/logo.png b/web/images/logo.png
new file mode 100644
index 0000000..0f2131c
--- /dev/null
+++ b/web/images/logo.png
Binary files differ
diff --git a/web/images/mail-new.gif b/web/images/mail-new.gif
new file mode 100644
index 0000000..b766324
--- /dev/null
+++ b/web/images/mail-new.gif
Binary files differ
diff --git a/web/images/mail.gif b/web/images/mail.gif
new file mode 100644
index 0000000..c14447b
--- /dev/null
+++ b/web/images/mail.gif
Binary files differ
diff --git a/web/images/network-server.gif b/web/images/network-server.gif
new file mode 100644
index 0000000..9fc4dd2
--- /dev/null
+++ b/web/images/network-server.gif
Binary files differ
diff --git a/web/images/next.gif b/web/images/next.gif
new file mode 100644
index 0000000..0dabbfc
--- /dev/null
+++ b/web/images/next.gif
Binary files differ
diff --git a/web/images/ok.gif b/web/images/ok.gif
new file mode 100644
index 0000000..c03f738
--- /dev/null
+++ b/web/images/ok.gif
Binary files differ
diff --git a/web/images/previous.gif b/web/images/previous.gif
new file mode 100644
index 0000000..57e200f
--- /dev/null
+++ b/web/images/previous.gif
Binary files differ
diff --git a/web/images/remove.gif b/web/images/remove.gif
new file mode 100644
index 0000000..2905ce5
--- /dev/null
+++ b/web/images/remove.gif
Binary files differ
diff --git a/web/images/search.gif b/web/images/search.gif
new file mode 100644
index 0000000..790843c
--- /dev/null
+++ b/web/images/search.gif
Binary files differ
diff --git a/web/images/shred.gif b/web/images/shred.gif
new file mode 100644
index 0000000..2c81d3b
--- /dev/null
+++ b/web/images/shred.gif
Binary files differ
diff --git a/web/images/sort-asc.gif b/web/images/sort-asc.gif
new file mode 100644
index 0000000..29fee1d
--- /dev/null
+++ b/web/images/sort-asc.gif
Binary files differ
diff --git a/web/images/sort-desc.gif b/web/images/sort-desc.gif
new file mode 100644
index 0000000..d049aa0
--- /dev/null
+++ b/web/images/sort-desc.gif
Binary files differ
diff --git a/web/images/top.gif b/web/images/top.gif
new file mode 100644
index 0000000..13502e4
--- /dev/null
+++ b/web/images/top.gif
Binary files differ
diff --git a/web/images/trash.gif b/web/images/trash.gif
new file mode 100644
index 0000000..73fa119
--- /dev/null
+++ b/web/images/trash.gif
Binary files differ
diff --git a/web/images/up.gif b/web/images/up.gif
new file mode 100644
index 0000000..1165d2e
--- /dev/null
+++ b/web/images/up.gif
Binary files differ
diff --git a/web/images/warning.gif b/web/images/warning.gif
new file mode 100644
index 0000000..76d93ee
--- /dev/null
+++ b/web/images/warning.gif
Binary files differ
diff --git a/web/index.php b/web/index.php
new file mode 100644
index 0000000..5e4fa7a
--- /dev/null
+++ b/web/index.php
@@ -0,0 +1,10 @@
+<?php
+
+define('SF_ROOT_DIR', realpath(dirname(__FILE__).'/..'));
+define('SF_APP', 'admin');
+define('SF_ENVIRONMENT', 'prod');
+define('SF_DEBUG', false);
+
+require_once(SF_ROOT_DIR.DIRECTORY_SEPARATOR.'apps'.DIRECTORY_SEPARATOR.SF_APP.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.php');
+
+sfContext::getInstance()->getController()->dispatch();
diff --git a/web/robots.txt b/web/robots.txt
new file mode 100644
index 0000000..0827227
--- /dev/null
+++ b/web/robots.txt
@@ -0,0 +1,2 @@
+#User-agent: *
+#Disallow: