From 641ed97fddba27e8eaa29d907f6ee25adc56a323 Mon Sep 17 00:00:00 2001 From: Serghey Rodin Date: Tue, 14 Jun 2011 00:22:25 +0300 Subject: [PATCH] export from svn --- bin/v_add_db_base | 90 + bin/v_add_db_host | 83 + bin/v_add_dns_domain | 109 + bin/v_add_dns_domain_record | 90 + bin/v_add_ssl_certificate | 57 + bin/v_add_sys_cron | 82 + bin/v_add_sys_ip | 100 + bin/v_add_sys_user | 191 ++ bin/v_add_sys_user_ip | 67 + bin/v_add_sys_user_reports | 59 + bin/v_add_web_domain | 187 ++ bin/v_add_web_domain_alias | 119 + bin/v_add_web_domain_cgi | 122 + bin/v_add_web_domain_elog | 98 + bin/v_add_web_domain_nginx | 112 + bin/v_add_web_domain_ssl | 120 + bin/v_add_web_domain_stat | 89 + bin/v_add_web_domain_stat_auth | 99 + bin/v_change_db_password | 71 + bin/v_change_dns_domain_exp | 65 + bin/v_change_dns_domain_ip | 73 + bin/v_change_dns_domain_record | 87 + bin/v_change_dns_domain_soa | 70 + bin/v_change_dns_domain_tpl | 84 + bin/v_change_dns_domain_ttl | 71 + bin/v_change_sys_cron_job | 82 + bin/v_change_sys_ip_name | 47 + bin/v_change_sys_ip_owner | 71 + bin/v_change_sys_ip_status | 67 + bin/v_change_sys_user_contact | 57 + bin/v_change_sys_user_ns | 56 + bin/v_change_sys_user_package | 58 + bin/v_change_sys_user_password | 52 + bin/v_change_sys_user_shell | 55 + bin/v_change_web_domain_ip | 96 + bin/v_change_web_domain_sslcert | 108 + bin/v_change_web_domain_sslhome | 109 + bin/v_change_web_domain_tpl | 137 + bin/v_check_sys_user_password | Bin 0 -> 7413 bytes bin/v_del_db_base | 76 + bin/v_del_db_host | 56 + bin/v_del_dns_domain | 78 + bin/v_del_dns_domain_record | 73 + bin/v_del_ssl_certificate | 57 + bin/v_del_sys_cron | 62 + bin/v_del_sys_ip | 90 + bin/v_del_sys_user_ip | 65 + bin/v_del_sys_user_reports | 59 + bin/v_del_web_domain | 127 + bin/v_del_web_domain_alias | 117 + bin/v_del_web_domain_cgi | 122 + bin/v_del_web_domain_elog | 98 + bin/v_del_web_domain_ssl | 93 + bin/v_del_web_domain_stat | 84 + bin/v_del_web_domain_stat_auth | 105 + bin/v_get_dns_domain_value | 57 + bin/v_get_sys_user_value | 52 + bin/v_get_web_domain_value | 60 + bin/v_list_db_base | 61 + bin/v_list_db_bases | 58 + bin/v_list_db_host | 61 + bin/v_list_db_hosts | 60 + bin/v_list_dns_domain | 64 + bin/v_list_dns_domains | 60 + bin/v_list_dns_templates | 44 + bin/v_list_ssl_certificates | 52 + bin/v_list_sys_cron | 61 + bin/v_list_sys_interfaces | 46 + bin/v_list_sys_ip | 54 + bin/v_list_sys_ips | 51 + bin/v_list_sys_user | 60 + bin/v_list_sys_user_ips | 58 + bin/v_list_sys_user_ns | 50 + bin/v_list_sys_user_packages | 50 + bin/v_list_sys_users | 52 + bin/v_list_web_domain | 59 + bin/v_list_web_domains | 61 + bin/v_list_web_domains_alias | 58 + bin/v_list_web_domains_elog | 58 + bin/v_list_web_domains_nginx | 58 + bin/v_list_web_domains_ssl | 58 + bin/v_list_web_domains_stats | 58 + bin/v_list_web_templates | 56 + bin/v_rebuild_web_domain | 164 ++ bin/v_suspend_db_base | 67 + bin/v_suspend_db_bases | 74 + bin/v_suspend_dns_domain | 67 + bin/v_suspend_dns_domains | 73 + bin/v_suspend_sys_cron_job | 59 + bin/v_suspend_sys_cron_jobs | 60 + bin/v_suspend_web_domain | 94 + bin/v_suspend_web_domains | 104 + bin/v_unsuspend_db_base | 67 + bin/v_unsuspend_db_bases | 74 + bin/v_unsuspend_dns_domain | 65 + bin/v_unsuspend_dns_domains | 77 + bin/v_unsuspend_sys_cron_job | 59 + bin/v_unsuspend_sys_cron_jobs | 60 + bin/v_unsuspend_web_domain | 98 + bin/v_unsuspend_web_domains | 107 + bin/v_upd_db_base_disk | 71 + bin/v_upd_db_bases_disk | 78 + bin/v_upd_sys_ip | 106 + bin/v_upd_sys_queue | 79 + bin/v_upd_sys_user_bill | 147 ++ bin/v_upd_sys_user_disk | 67 + bin/v_upd_sys_vesta | 111 + bin/v_upd_web_domain_disk | 68 + bin/v_upd_web_domain_traff | 83 + bin/v_upd_web_domains_disk | 77 + bin/v_upd_web_domains_traff | 95 + conf/vars.conf | 144 ++ conf/vesta.conf | 20 + data/dbservers/mysql.conf | 0 data/packages/default.pkg | 16 + data/packages/palegreen.pkg | 16 + data/queue/backup.pipe | 0 data/queue/disk.pipe | 0 data/queue/restart.pipe | 0 data/queue/stats.pipe | 0 data/queue/traffic.pipe | 0 data/templates/apache_default.descr | 3 + data/templates/apache_default.stpl | 40 + data/templates/apache_default.tpl | 34 + data/templates/apache_phpcgi.descr | 3 + data/templates/apache_phpcgi.sh | 17 + data/templates/apache_phpcgi.stpl | 40 + data/templates/apache_phpcgi.tpl | 30 + data/templates/apache_unlim.descr | 2 + data/templates/apache_unlim.stpl | 40 + data/templates/apache_unlim.tpl | 34 + data/templates/awstats.tpl | 131 + data/templates/dns/default.descr | 1 + data/templates/dns/default.tpl | 9 + data/templates/dns/gmail.descr | 1 + data/templates/dns/gmail.tpl | 16 + data/templates/ngingx_ip.tpl | 11 + data/templates/ngingx_vhost-default.descr | 2 + data/templates/ngingx_vhost-default.tpl | 30 + data/templates/skel/document_errors/403.html | 18 + data/templates/skel/document_errors/404.html | 18 + data/templates/skel/document_errors/50x.html | 18 + data/templates/skel/public_html/index.html | 21 + data/templates/skel/public_html/robots.txt | 3 + data/templates/skel/public_shtml/index.html | 21 + data/templates/skel/public_shtml/robots.txt | 3 + data/templates/webalizer.tpl | 110 + func/cert_func.sh | 128 + func/cron_func.sh | 237 ++ func/db_func.sh | 965 +++++++ func/domain_func.sh | 918 +++++++ func/ip_func.sh | 593 +++++ func/restart_cron | 24 + func/restart_dns | 23 + func/restart_web | 39 + func/shared_func.sh | 1336 ++++++++++ log/admin_error.log | 1 + log/auth.log | 1 + log/debug.log | 1 + log/system.log | 1 + src/v_check_sys_user_password.c | 86 + web/INSTALL.txt | 14 + web/LICENSE.txt | 27 + web/README.txt | 22 + web/css/main.css | 2264 +++++++++++++++++ web/css/reset2.css | 45 + web/dispatch.php | 49 + web/images/add-entry-plus.gif | Bin 0 -> 62 bytes .../autocomplete-field-arrows-sprite.png | Bin 0 -> 249 bytes web/images/check-row-sprite_.png | Bin 0 -> 377 bytes web/images/console-bg.png | Bin 0 -> 121 bytes web/images/console-box-bg.png | Bin 0 -> 161 bytes web/images/content-separator.png | Bin 0 -> 175 bytes web/images/delete-ico-off.png | Bin 0 -> 175 bytes web/images/delete-ico.png | Bin 0 -> 175 bytes web/images/enabled-ico-hover.png | Bin 0 -> 216 bytes web/images/enabled-ico_.png | Bin 0 -> 198 bytes web/images/error-bullet.png | Bin 0 -> 359 bytes web/images/footer-bg.gif | Bin 0 -> 75 bytes web/images/form-bottom-bg.png | Bin 0 -> 218 bytes web/images/hide-records-ico.png | Bin 0 -> 232 bytes web/images/long-dotted-bg.gif | Bin 0 -> 68 bytes web/images/more-info-btn.png | Bin 0 -> 1401 bytes web/images/nav-devider-2.png | Bin 0 -> 893 bytes web/images/primarary-collapsed.gif | Bin 0 -> 346 bytes web/images/section-status-sprite-5.gif | Bin 0 -> 136 bytes web/images/select-arrow.png | Bin 0 -> 208 bytes web/images/show-records-ico.png | Bin 0 -> 216 bytes web/images/suspended-ico.png | Bin 0 -> 235 bytes web/images/thin-grey-line-2.gif | Bin 0 -> 46 bytes web/images/vesta-logo.png | Bin 0 -> 1946 bytes web/index.html | 229 ++ web/index.php | 18 + web/js/__init__.js | 19 + web/js/_settings.js | 62 + web/js/actions.js | 163 ++ web/js/app.js | 216 ++ web/js/bash.js | 4 + web/js/console.js | 7 + web/js/core.js | 78 + web/js/date_format.js | 126 + web/js/helpers.js | 192 ++ web/js/html.js | 226 ++ web/js/lib/.svn/entries | 132 + web/js/lib/.svn/text-base/browser.js.svn-base | 396 +++ .../custom-form-elements.js.svn-base | 153 ++ .../text-base/jquery-1.4.4.min.js.svn-base | 167 ++ .../jquery-ui-1.8.13.custom.min.js.svn-base | 285 +++ web/js/lib/.svn/text-base/popup.js.svn-base | 209 ++ web/js/lib/browser.js | 396 +++ web/js/lib/custom-form-elements.js | 153 ++ web/js/lib/jquery-1.4.4.min.js | 167 ++ web/js/lib/jquery-ui-1.8.13.custom.min.js | 285 +++ web/js/lib/popup.js | 209 ++ web/js/model.js | 65 + web/js/old/.svn/entries | 572 +++++ .../old/.svn/text-base/__init__.js.svn-base | 18 + .../old/.svn/text-base/_settings.js.svn-base | 22 + web/js/old/.svn/text-base/actions.js.svn-base | 68 + web/js/old/.svn/text-base/app.js.svn-base | 116 + web/js/old/.svn/text-base/bash.js.svn-base | 4 + web/js/old/.svn/text-base/console.js.svn-base | 7 + web/js/old/.svn/text-base/core.js.svn-base | 79 + web/js/old/.svn/text-base/helpers.js.svn-base | 122 + web/js/old/.svn/text-base/html.js.svn-base | 186 ++ web/js/old/.svn/text-base/model.js.svn-base | 52 + web/js/old/.svn/text-base/pages.js.svn-base | 103 + .../old/.svn/text-base/parsers.js.js.svn-base | 0 web/js/old/.svn/text-base/ref.js.svn-base | 4 + .../old/.svn/text-base/templates.js.svn-base | 295 +++ .../old/.svn/text-base/validators.js.svn-base | 13 + web/js/old/.svn/text-base/view.js.svn-base | 80 + web/js/old/__init__.js | 18 + web/js/old/_settings.js | 22 + web/js/old/actions.js | 68 + web/js/old/app.js | 116 + web/js/old/bash.js | 4 + web/js/old/console.js | 7 + web/js/old/core.js | 79 + web/js/old/helpers.js | 122 + web/js/old/html.js | 186 ++ web/js/old/model.js | 52 + web/js/old/pages.js | 103 + web/js/old/parsers.js.js | 0 web/js/old/ref.js | 4 + web/js/old/templates.js | 295 +++ web/js/old/validators.js | 13 + web/js/old/view.js | 80 + web/js/pages.js | 134 + web/js/parsers.js.js | 0 web/js/ref.js | 4 + web/js/templates.js | 347 +++ web/js/validators.js | 33 + web/js/view.js | 93 + web/static-templates/css/ie.css | 16 + web/static-templates/css/reset2.css | 45 + web/static-templates/css/vesta.css | 1752 +++++++++++++ web/static-templates/dns.html | 450 ++++ web/static-templates/i/Thumbs.db | Bin 0 -> 46080 bytes web/static-templates/i/add-entry-plus.gif | Bin 0 -> 62 bytes web/static-templates/i/auth-plus.png | Bin 0 -> 252 bytes .../i/autocomplete-field-arrow.png | Bin 0 -> 874 bytes web/static-templates/i/bg-left.gif | Bin 0 -> 205 bytes web/static-templates/i/bg-right.gif | Bin 0 -> 205 bytes web/static-templates/i/check-row-sprite.png | Bin 0 -> 365 bytes web/static-templates/i/checkbox.png | Bin 0 -> 483 bytes web/static-templates/i/console-bg.png | Bin 0 -> 121 bytes web/static-templates/i/console-box-bg.png | Bin 0 -> 161 bytes web/static-templates/i/content-separator.png | Bin 0 -> 175 bytes web/static-templates/i/custom-checkbox.gif | Bin 0 -> 267 bytes web/static-templates/i/delete-ico-off.png | Bin 0 -> 175 bytes web/static-templates/i/delete-ico.png | Bin 0 -> 175 bytes web/static-templates/i/delete.gif | Bin 0 -> 778 bytes web/static-templates/i/dotted.gif | Bin 0 -> 44 bytes web/static-templates/i/enabled-ico-hover.png | Bin 0 -> 216 bytes web/static-templates/i/enabled-ico.png | Bin 0 -> 421 bytes web/static-templates/i/enabled-ico_.png | Bin 0 -> 198 bytes web/static-templates/i/error-bullet.png | Bin 0 -> 359 bytes web/static-templates/i/fone-tr.png | Bin 0 -> 100 bytes web/static-templates/i/footer-bg.gif | Bin 0 -> 75 bytes web/static-templates/i/form-bottom-bg.png | Bin 0 -> 218 bytes .../i/form-group-collapsed.png | Bin 0 -> 288 bytes .../i/form-group-expanded.png | Bin 0 -> 268 bytes web/static-templates/i/hide-records-ico.png | Bin 0 -> 232 bytes .../i/logging-status-sprite.png | Bin 0 -> 323 bytes web/static-templates/i/long-dotted-bg.gif | Bin 0 -> 68 bytes web/static-templates/i/more-info-btn.png | Bin 0 -> 1401 bytes web/static-templates/i/nav-devider-2.png | Bin 0 -> 893 bytes web/static-templates/i/nav-devider.png | Bin 0 -> 131 bytes web/static-templates/i/old-delete-ico-off.png | Bin 0 -> 254 bytes web/static-templates/i/old-delete-ico.png | Bin 0 -> 356 bytes .../i/primarary-collapsed.gif | Bin 0 -> 346 bytes .../i/section-status-sprite-2.gif | Bin 0 -> 55 bytes .../i/section-status-sprite-3.gif | Bin 0 -> 104 bytes .../i/section-status-sprite-4.gif | Bin 0 -> 111 bytes .../i/section-status-sprite-5.gif | Bin 0 -> 136 bytes .../i/section-status-sprite.gif | Bin 0 -> 59 bytes web/static-templates/i/select-arrow.png | Bin 0 -> 208 bytes web/static-templates/i/show-records-ico.png | Bin 0 -> 216 bytes web/static-templates/i/sprite.png | Bin 0 -> 1200 bytes web/static-templates/i/status-arrow.png | Bin 0 -> 293 bytes web/static-templates/i/suspended-ico.png | Bin 0 -> 235 bytes web/static-templates/i/thin-grey-line-2.gif | Bin 0 -> 46 bytes web/static-templates/i/thin-grey-line.gif | Bin 0 -> 48 bytes web/static-templates/i/vesta-logo.png | Bin 0 -> 1946 bytes web/static-templates/ip.html | 435 ++++ .../js/custom-form-elements.js | 144 ++ web/static-templates/js/form.css | 26 + web/static-templates/web-domain.html | 556 ++++ web/test.php | 3 + web/vesta/README | 82 + web/vesta/TODO | 3 + web/vesta/api/AjaxHandler.php | 87 + web/vesta/api/AjaxHandler.php~ | 82 + web/vesta/api/CRON.class.php | 221 ++ web/vesta/api/CRON.class.php~ | 229 ++ web/vesta/api/DB.class.php | 196 ++ web/vesta/api/DB.class.php~ | 215 ++ web/vesta/api/DNS.class.php | 310 +++ web/vesta/api/DNS.class.php~ | 339 +++ web/vesta/api/IP.class.php | 161 ++ web/vesta/api/IP.class.php~ | 185 ++ web/vesta/api/MAIN.class.php | 110 + web/vesta/api/MAIN.class.php~ | 25 + web/vesta/api/PARAMS.class.php | 94 + web/vesta/api/PARAMS.class.php~ | 533 ++++ web/vesta/api/USER.class.php | 244 ++ web/vesta/api/USER.class.php~ | 270 ++ web/vesta/api/WEB_DOMAIN.class.php | 510 ++++ web/vesta/api/WEB_DOMAIN.class.php~ | 533 ++++ web/vesta/app.init.php | 36 + web/vesta/config/Config.class.php | 31 + web/vesta/config/vesta_config.ini | 11 + web/vesta/core/Request.class.php | 86 + web/vesta/core/Request.class.php~ | 86 + web/vesta/core/Vesta.class.php | 220 ++ web/vesta/core/Vesta.class.php~ | 221 ++ .../exceptions/ProtectionException.class.php | 24 + .../core/exceptions/SystemException.class.php | 26 + web/vesta/core/utils/Message.class.php | 23 + 340 files changed, 32404 insertions(+) create mode 100755 bin/v_add_db_base create mode 100755 bin/v_add_db_host create mode 100755 bin/v_add_dns_domain create mode 100755 bin/v_add_dns_domain_record create mode 100755 bin/v_add_ssl_certificate create mode 100755 bin/v_add_sys_cron create mode 100755 bin/v_add_sys_ip create mode 100755 bin/v_add_sys_user create mode 100755 bin/v_add_sys_user_ip create mode 100755 bin/v_add_sys_user_reports create mode 100755 bin/v_add_web_domain create mode 100755 bin/v_add_web_domain_alias create mode 100755 bin/v_add_web_domain_cgi create mode 100755 bin/v_add_web_domain_elog create mode 100755 bin/v_add_web_domain_nginx create mode 100755 bin/v_add_web_domain_ssl create mode 100755 bin/v_add_web_domain_stat create mode 100755 bin/v_add_web_domain_stat_auth create mode 100755 bin/v_change_db_password create mode 100755 bin/v_change_dns_domain_exp create mode 100755 bin/v_change_dns_domain_ip create mode 100755 bin/v_change_dns_domain_record create mode 100755 bin/v_change_dns_domain_soa create mode 100755 bin/v_change_dns_domain_tpl create mode 100755 bin/v_change_dns_domain_ttl create mode 100755 bin/v_change_sys_cron_job create mode 100755 bin/v_change_sys_ip_name create mode 100755 bin/v_change_sys_ip_owner create mode 100755 bin/v_change_sys_ip_status create mode 100755 bin/v_change_sys_user_contact create mode 100755 bin/v_change_sys_user_ns create mode 100755 bin/v_change_sys_user_package create mode 100755 bin/v_change_sys_user_password create mode 100755 bin/v_change_sys_user_shell create mode 100755 bin/v_change_web_domain_ip create mode 100755 bin/v_change_web_domain_sslcert create mode 100755 bin/v_change_web_domain_sslhome create mode 100755 bin/v_change_web_domain_tpl create mode 100755 bin/v_check_sys_user_password create mode 100755 bin/v_del_db_base create mode 100755 bin/v_del_db_host create mode 100755 bin/v_del_dns_domain create mode 100755 bin/v_del_dns_domain_record create mode 100755 bin/v_del_ssl_certificate create mode 100755 bin/v_del_sys_cron create mode 100755 bin/v_del_sys_ip create mode 100755 bin/v_del_sys_user_ip create mode 100755 bin/v_del_sys_user_reports create mode 100755 bin/v_del_web_domain create mode 100755 bin/v_del_web_domain_alias create mode 100755 bin/v_del_web_domain_cgi create mode 100755 bin/v_del_web_domain_elog create mode 100755 bin/v_del_web_domain_ssl create mode 100755 bin/v_del_web_domain_stat create mode 100755 bin/v_del_web_domain_stat_auth create mode 100755 bin/v_get_dns_domain_value create mode 100755 bin/v_get_sys_user_value create mode 100755 bin/v_get_web_domain_value create mode 100755 bin/v_list_db_base create mode 100755 bin/v_list_db_bases create mode 100755 bin/v_list_db_host create mode 100755 bin/v_list_db_hosts create mode 100755 bin/v_list_dns_domain create mode 100755 bin/v_list_dns_domains create mode 100755 bin/v_list_dns_templates create mode 100755 bin/v_list_ssl_certificates create mode 100755 bin/v_list_sys_cron create mode 100755 bin/v_list_sys_interfaces create mode 100755 bin/v_list_sys_ip create mode 100755 bin/v_list_sys_ips create mode 100755 bin/v_list_sys_user create mode 100755 bin/v_list_sys_user_ips create mode 100755 bin/v_list_sys_user_ns create mode 100755 bin/v_list_sys_user_packages create mode 100755 bin/v_list_sys_users create mode 100755 bin/v_list_web_domain create mode 100755 bin/v_list_web_domains create mode 100755 bin/v_list_web_domains_alias create mode 100755 bin/v_list_web_domains_elog create mode 100755 bin/v_list_web_domains_nginx create mode 100755 bin/v_list_web_domains_ssl create mode 100755 bin/v_list_web_domains_stats create mode 100755 bin/v_list_web_templates create mode 100755 bin/v_rebuild_web_domain create mode 100755 bin/v_suspend_db_base create mode 100755 bin/v_suspend_db_bases create mode 100755 bin/v_suspend_dns_domain create mode 100755 bin/v_suspend_dns_domains create mode 100755 bin/v_suspend_sys_cron_job create mode 100755 bin/v_suspend_sys_cron_jobs create mode 100755 bin/v_suspend_web_domain create mode 100755 bin/v_suspend_web_domains create mode 100755 bin/v_unsuspend_db_base create mode 100755 bin/v_unsuspend_db_bases create mode 100755 bin/v_unsuspend_dns_domain create mode 100755 bin/v_unsuspend_dns_domains create mode 100755 bin/v_unsuspend_sys_cron_job create mode 100755 bin/v_unsuspend_sys_cron_jobs create mode 100755 bin/v_unsuspend_web_domain create mode 100755 bin/v_unsuspend_web_domains create mode 100755 bin/v_upd_db_base_disk create mode 100755 bin/v_upd_db_bases_disk create mode 100755 bin/v_upd_sys_ip create mode 100755 bin/v_upd_sys_queue create mode 100755 bin/v_upd_sys_user_bill create mode 100755 bin/v_upd_sys_user_disk create mode 100755 bin/v_upd_sys_vesta create mode 100755 bin/v_upd_web_domain_disk create mode 100755 bin/v_upd_web_domain_traff create mode 100755 bin/v_upd_web_domains_disk create mode 100755 bin/v_upd_web_domains_traff create mode 100644 conf/vars.conf create mode 100644 conf/vesta.conf create mode 100644 data/dbservers/mysql.conf create mode 100644 data/packages/default.pkg create mode 100644 data/packages/palegreen.pkg create mode 100644 data/queue/backup.pipe create mode 100644 data/queue/disk.pipe create mode 100644 data/queue/restart.pipe create mode 100644 data/queue/stats.pipe create mode 100644 data/queue/traffic.pipe create mode 100644 data/templates/apache_default.descr create mode 100644 data/templates/apache_default.stpl create mode 100644 data/templates/apache_default.tpl create mode 100644 data/templates/apache_phpcgi.descr create mode 100755 data/templates/apache_phpcgi.sh create mode 100644 data/templates/apache_phpcgi.stpl create mode 100644 data/templates/apache_phpcgi.tpl create mode 100644 data/templates/apache_unlim.descr create mode 100644 data/templates/apache_unlim.stpl create mode 100644 data/templates/apache_unlim.tpl create mode 100644 data/templates/awstats.tpl create mode 100644 data/templates/dns/default.descr create mode 100644 data/templates/dns/default.tpl create mode 100644 data/templates/dns/gmail.descr create mode 100644 data/templates/dns/gmail.tpl create mode 100644 data/templates/ngingx_ip.tpl create mode 100644 data/templates/ngingx_vhost-default.descr create mode 100644 data/templates/ngingx_vhost-default.tpl create mode 100644 data/templates/skel/document_errors/403.html create mode 100644 data/templates/skel/document_errors/404.html create mode 100644 data/templates/skel/document_errors/50x.html create mode 100644 data/templates/skel/public_html/index.html create mode 100644 data/templates/skel/public_html/robots.txt create mode 100644 data/templates/skel/public_shtml/index.html create mode 100644 data/templates/skel/public_shtml/robots.txt create mode 100644 data/templates/webalizer.tpl create mode 100644 func/cert_func.sh create mode 100644 func/cron_func.sh create mode 100644 func/db_func.sh create mode 100644 func/domain_func.sh create mode 100644 func/ip_func.sh create mode 100755 func/restart_cron create mode 100755 func/restart_dns create mode 100755 func/restart_web create mode 100644 func/shared_func.sh create mode 100644 log/admin_error.log create mode 100644 log/auth.log create mode 100644 log/debug.log create mode 100644 log/system.log create mode 100755 src/v_check_sys_user_password.c create mode 100644 web/INSTALL.txt create mode 100644 web/LICENSE.txt create mode 100644 web/README.txt create mode 100644 web/css/main.css create mode 100644 web/css/reset2.css create mode 100644 web/dispatch.php create mode 100644 web/images/add-entry-plus.gif create mode 100644 web/images/autocomplete-field-arrows-sprite.png create mode 100644 web/images/check-row-sprite_.png create mode 100644 web/images/console-bg.png create mode 100644 web/images/console-box-bg.png create mode 100644 web/images/content-separator.png create mode 100644 web/images/delete-ico-off.png create mode 100644 web/images/delete-ico.png create mode 100644 web/images/enabled-ico-hover.png create mode 100644 web/images/enabled-ico_.png create mode 100644 web/images/error-bullet.png create mode 100644 web/images/footer-bg.gif create mode 100644 web/images/form-bottom-bg.png create mode 100644 web/images/hide-records-ico.png create mode 100644 web/images/long-dotted-bg.gif create mode 100644 web/images/more-info-btn.png create mode 100644 web/images/nav-devider-2.png create mode 100644 web/images/primarary-collapsed.gif create mode 100644 web/images/section-status-sprite-5.gif create mode 100644 web/images/select-arrow.png create mode 100644 web/images/show-records-ico.png create mode 100644 web/images/suspended-ico.png create mode 100644 web/images/thin-grey-line-2.gif create mode 100644 web/images/vesta-logo.png create mode 100644 web/index.html create mode 100644 web/index.php create mode 100644 web/js/__init__.js create mode 100644 web/js/_settings.js create mode 100644 web/js/actions.js create mode 100644 web/js/app.js create mode 100644 web/js/bash.js create mode 100644 web/js/console.js create mode 100644 web/js/core.js create mode 100644 web/js/date_format.js create mode 100644 web/js/helpers.js create mode 100644 web/js/html.js create mode 100644 web/js/lib/.svn/entries create mode 100644 web/js/lib/.svn/text-base/browser.js.svn-base create mode 100644 web/js/lib/.svn/text-base/custom-form-elements.js.svn-base create mode 100644 web/js/lib/.svn/text-base/jquery-1.4.4.min.js.svn-base create mode 100644 web/js/lib/.svn/text-base/jquery-ui-1.8.13.custom.min.js.svn-base create mode 100644 web/js/lib/.svn/text-base/popup.js.svn-base create mode 100644 web/js/lib/browser.js create mode 100644 web/js/lib/custom-form-elements.js create mode 100644 web/js/lib/jquery-1.4.4.min.js create mode 100644 web/js/lib/jquery-ui-1.8.13.custom.min.js create mode 100644 web/js/lib/popup.js create mode 100644 web/js/model.js create mode 100644 web/js/old/.svn/entries create mode 100644 web/js/old/.svn/text-base/__init__.js.svn-base create mode 100644 web/js/old/.svn/text-base/_settings.js.svn-base create mode 100644 web/js/old/.svn/text-base/actions.js.svn-base create mode 100644 web/js/old/.svn/text-base/app.js.svn-base create mode 100644 web/js/old/.svn/text-base/bash.js.svn-base create mode 100644 web/js/old/.svn/text-base/console.js.svn-base create mode 100644 web/js/old/.svn/text-base/core.js.svn-base create mode 100644 web/js/old/.svn/text-base/helpers.js.svn-base create mode 100644 web/js/old/.svn/text-base/html.js.svn-base create mode 100644 web/js/old/.svn/text-base/model.js.svn-base create mode 100644 web/js/old/.svn/text-base/pages.js.svn-base create mode 100644 web/js/old/.svn/text-base/parsers.js.js.svn-base create mode 100644 web/js/old/.svn/text-base/ref.js.svn-base create mode 100644 web/js/old/.svn/text-base/templates.js.svn-base create mode 100644 web/js/old/.svn/text-base/validators.js.svn-base create mode 100644 web/js/old/.svn/text-base/view.js.svn-base create mode 100644 web/js/old/__init__.js create mode 100644 web/js/old/_settings.js create mode 100644 web/js/old/actions.js create mode 100644 web/js/old/app.js create mode 100644 web/js/old/bash.js create mode 100644 web/js/old/console.js create mode 100644 web/js/old/core.js create mode 100644 web/js/old/helpers.js create mode 100644 web/js/old/html.js create mode 100644 web/js/old/model.js create mode 100644 web/js/old/pages.js create mode 100644 web/js/old/parsers.js.js create mode 100644 web/js/old/ref.js create mode 100644 web/js/old/templates.js create mode 100644 web/js/old/validators.js create mode 100644 web/js/old/view.js create mode 100644 web/js/pages.js create mode 100644 web/js/parsers.js.js create mode 100644 web/js/ref.js create mode 100644 web/js/templates.js create mode 100644 web/js/validators.js create mode 100644 web/js/view.js create mode 100644 web/static-templates/css/ie.css create mode 100644 web/static-templates/css/reset2.css create mode 100644 web/static-templates/css/vesta.css create mode 100644 web/static-templates/dns.html create mode 100644 web/static-templates/i/Thumbs.db create mode 100644 web/static-templates/i/add-entry-plus.gif create mode 100644 web/static-templates/i/auth-plus.png create mode 100644 web/static-templates/i/autocomplete-field-arrow.png create mode 100644 web/static-templates/i/bg-left.gif create mode 100644 web/static-templates/i/bg-right.gif create mode 100644 web/static-templates/i/check-row-sprite.png create mode 100644 web/static-templates/i/checkbox.png create mode 100644 web/static-templates/i/console-bg.png create mode 100644 web/static-templates/i/console-box-bg.png create mode 100644 web/static-templates/i/content-separator.png create mode 100644 web/static-templates/i/custom-checkbox.gif create mode 100644 web/static-templates/i/delete-ico-off.png create mode 100644 web/static-templates/i/delete-ico.png create mode 100644 web/static-templates/i/delete.gif create mode 100644 web/static-templates/i/dotted.gif create mode 100644 web/static-templates/i/enabled-ico-hover.png create mode 100644 web/static-templates/i/enabled-ico.png create mode 100644 web/static-templates/i/enabled-ico_.png create mode 100644 web/static-templates/i/error-bullet.png create mode 100644 web/static-templates/i/fone-tr.png create mode 100644 web/static-templates/i/footer-bg.gif create mode 100644 web/static-templates/i/form-bottom-bg.png create mode 100644 web/static-templates/i/form-group-collapsed.png create mode 100644 web/static-templates/i/form-group-expanded.png create mode 100644 web/static-templates/i/hide-records-ico.png create mode 100644 web/static-templates/i/logging-status-sprite.png create mode 100644 web/static-templates/i/long-dotted-bg.gif create mode 100644 web/static-templates/i/more-info-btn.png create mode 100644 web/static-templates/i/nav-devider-2.png create mode 100644 web/static-templates/i/nav-devider.png create mode 100644 web/static-templates/i/old-delete-ico-off.png create mode 100644 web/static-templates/i/old-delete-ico.png create mode 100644 web/static-templates/i/primarary-collapsed.gif create mode 100644 web/static-templates/i/section-status-sprite-2.gif create mode 100644 web/static-templates/i/section-status-sprite-3.gif create mode 100644 web/static-templates/i/section-status-sprite-4.gif create mode 100644 web/static-templates/i/section-status-sprite-5.gif create mode 100644 web/static-templates/i/section-status-sprite.gif create mode 100644 web/static-templates/i/select-arrow.png create mode 100644 web/static-templates/i/show-records-ico.png create mode 100644 web/static-templates/i/sprite.png create mode 100644 web/static-templates/i/status-arrow.png create mode 100644 web/static-templates/i/suspended-ico.png create mode 100644 web/static-templates/i/thin-grey-line-2.gif create mode 100644 web/static-templates/i/thin-grey-line.gif create mode 100644 web/static-templates/i/vesta-logo.png create mode 100644 web/static-templates/ip.html create mode 100644 web/static-templates/js/custom-form-elements.js create mode 100644 web/static-templates/js/form.css create mode 100644 web/static-templates/web-domain.html create mode 100644 web/test.php create mode 100644 web/vesta/README create mode 100644 web/vesta/TODO create mode 100644 web/vesta/api/AjaxHandler.php create mode 100644 web/vesta/api/AjaxHandler.php~ create mode 100644 web/vesta/api/CRON.class.php create mode 100644 web/vesta/api/CRON.class.php~ create mode 100644 web/vesta/api/DB.class.php create mode 100644 web/vesta/api/DB.class.php~ create mode 100644 web/vesta/api/DNS.class.php create mode 100644 web/vesta/api/DNS.class.php~ create mode 100644 web/vesta/api/IP.class.php create mode 100644 web/vesta/api/IP.class.php~ create mode 100644 web/vesta/api/MAIN.class.php create mode 100644 web/vesta/api/MAIN.class.php~ create mode 100644 web/vesta/api/PARAMS.class.php create mode 100644 web/vesta/api/PARAMS.class.php~ create mode 100644 web/vesta/api/USER.class.php create mode 100644 web/vesta/api/USER.class.php~ create mode 100644 web/vesta/api/WEB_DOMAIN.class.php create mode 100644 web/vesta/api/WEB_DOMAIN.class.php~ create mode 100644 web/vesta/app.init.php create mode 100644 web/vesta/config/Config.class.php create mode 100644 web/vesta/config/vesta_config.ini create mode 100644 web/vesta/core/Request.class.php create mode 100644 web/vesta/core/Request.class.php~ create mode 100644 web/vesta/core/Vesta.class.php create mode 100644 web/vesta/core/Vesta.class.php~ create mode 100644 web/vesta/core/exceptions/ProtectionException.class.php create mode 100644 web/vesta/core/exceptions/SystemException.class.php create mode 100644 web/vesta/core/utils/Message.class.php diff --git a/bin/v_add_db_base b/bin/v_add_db_base new file mode 100755 index 00000000..ca24eefa --- /dev/null +++ b/bin/v_add_db_base @@ -0,0 +1,90 @@ +#!/bin/bash +# info: adding data base + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +database="$user"_"$2" +db_user="$user"_"$3" +db_password="$4" +type="$5" +host=$6 + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/db_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '5' "$#" 'user db db_user db_password type [host]' + +# Checking argument format +format_validation 'user' 'database' 'db_user' 'db_password' + +# Checking db system is enabled +is_system_enabled 'db' + +# Checking db type +is_type_valid 'db' "$type" + +# Checking user +is_user_valid + +# Checking user is active +is_user_suspended + +# Checking db existance +is_db_new + +# Checking db host +if [ -z "$host" ]; then + host=$(get_next_db_host) +fi +is_db_host_valid + +# Checking package +is_package_full 'db_base' + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Switching on db type +case $type in + mysql) create_db_mysql ;; + pgsql) create_db_pgsql ;; +esac + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Increasing db value +increase_db_value + +# Increasing domain value +increase_user_value "$user" '$U_DATABASES' + +# Adding db to db conf +v_str="DB='$database' USER='$db_user' HOST='$host' TYPE='$type'" +v_str="$v_str U_DISK='0' SUSPEND='no' DATE='$V_DATE'" +echo "$v_str">>$V_USERS/$user/db.conf + +# Hiding password +V_EVENT=$(echo $V_EVENT | sed -e "s/$db_password/xxxxxx/g") + +# Logging +log_history "$V_EVENT" "v_del_db_base $user $database" +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_add_db_host b/bin/v_add_db_host new file mode 100755 index 00000000..dd4cac63 --- /dev/null +++ b/bin/v_add_db_host @@ -0,0 +1,83 @@ +#!/bin/bash +# info: adding data base server + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +type="$1" +host="$2" +port="$3" +db_user="$4" +db_password="$5" +max_usr="${6-300}" +max_db="${7-300}" +template="${8-template1}" + + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/db_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +args_usage='type host port db_user db_password [max_usr] [max_db] [tpl]' +check_args '5' "$#" "$args_usage" + +# Checking argument format +format_validation 'host' 'port' 'db_user' 'db_password' 'max_usr' 'max_db' +format_validation 'template' + +# Checking db system is enabled +is_system_enabled 'db' + +# Checking db type +is_type_valid 'db' "$type" + +# Checking host existance +is_db_host_new + +# Checking host connection +case $type in + mysql) is_mysql_host_alive ;; + pgsql) is_pgsql_host_alive ;; +esac + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Concatentating db host string +case $type in + mysql) new_str="HOST='$host' USER='$db_user' PASSWORD='$db_password'"; + new_str="$new_str PORT='$port' MAX_USERS='$max_usr'"; + new_str="$new_str MAX_DB='$max_db' U_SYS_USERS=''"; + new_str="$new_str U_DB_BASES='0' ACTIVE='yes' DATE='$V_DATE'";; + pgsql) new_str="HOST='$host' USER='$db_user' PASSWORD='$db_password'"; + new_str="$new_str PORT='$port' TPL='$tpl'"; + new_str="$new_str MAX_USERS='$max_usr' MAX_DB='$max_db'"; + new_str="$new_str U_SYS_USERS=''"; + new_str="$new_str U_DB_BASES='0' ACTIVE='yes' DATE='$V_DATE'";; +esac + +# Adding host to conf +echo "$new_str" >> $V_DB/$type.conf + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Hidding db pass +V_EVENT=$(echo $V_EVENT | sed -e "s/$db_password/xxxxxx/g") + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_add_dns_domain b/bin/v_add_dns_domain new file mode 100755 index 00000000..db6c3f79 --- /dev/null +++ b/bin/v_add_dns_domain @@ -0,0 +1,109 @@ +#!/bin/bash +# info: adding dns domain + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +domain=$(idn -t --quiet -u "$2" ) +domain_idn=$(idn -t --quiet -a "$domain") +ip="$3" +template="${4-default}" +next_year=$(date +%d-%m-%y -d "+ 1 year") +exp="${5-$next_year}" +soa="$6" +ttl="${7-14400}" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/domain_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '3' "$#" 'user domain ip [template] [exp] [soa] [ttl]' + +# Checking argument format +format_validation 'user' 'domain' 'ip' 'template' 'exp' 'ttl' + +# Checking dns system is enabled +is_system_enabled 'dns' + +# Checking user +is_user_valid + +# Checking user is active +is_user_suspended + +# Checking domain +is_domain_new 'quiet' +if [ $? -ne $OK ]; then + + # Checking domain owner + is_domain_owner + + # Checking domain service + is_dns_domain_free +fi + +# Checking package +is_package_full 'dns' + +# Checking template +is_template_valid 'dns' + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Defining variables +ns1=$(get_user_value '$NS1') +ns2=$(get_user_value '$NS2') +if [ -z "$soa" ]; then + soa="$ns1" +fi + +# Adding zone to zones dir +cat $V_DNSTPL/$template.tpl |\ + sed -e "s/%ip%/$ip/g" \ + -e "s/%domain_idn%/$domain_idn/g" \ + -e "s/%domain%/$domain/g" \ + -e "s/%ns1%/$ns1/g" \ + -e "s/%ns2%/$ns2/g" \ + -e "s/%date%/$V_DATE/g" > $V_USERS/$user/zones/$domain + +# Adding dns.conf record +dns_rec="DOMAIN='$domain' IP='$ip' TPL='$template' TTL='$ttl' EXP='$exp'" +dns_rec="$dns_rec SOA='$soa' SUSPEND='no' DATE='$V_DATE'" +echo "$dns_rec" >> $V_USERS/$user/dns.conf + +# Adding zone in named.conf +named="zone \"$domain_idn\" {type master; file \"/etc/namedb/$domain.db\";};" +echo "$named" >> /etc/named.conf + +# Updating domain dns zone +update_domain_zone + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Increasing domain value +increase_user_value "$user" '$U_DNS_DOMAINS' + +# Adding task to the vesta pipe +restart_schedule 'dns' + +# Logging +log_history "$V_EVENT" "v_del_dns_domain $user $domain" +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_add_dns_domain_record b/bin/v_add_dns_domain_record new file mode 100755 index 00000000..cb3023a7 --- /dev/null +++ b/bin/v_add_dns_domain_record @@ -0,0 +1,90 @@ +#!/bin/bash +# info: adding dns domain record + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +domain=$(idn -t --quiet -u "$2" ) +domain_idn=$(idn -t --quiet -a "$domain") +record=$(idn -t --quiet -u "$3" ) +rtype=$(echo "$4"| tr '[:lower:]' '[:upper:]') +value=$(idn -t --quiet -u "$5" ) +id="$6" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/domain_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '5' "$#" 'user domain record type value [id]' + +# Checking argument format +format_validation 'user' 'domain' 'record' 'rtype' + +# Checking web system is enabled +is_system_enabled 'dns' + +# Checking user +is_user_valid + +# Checking user is active +is_user_suspended + +# Checking domain exist +is_dns_domain_valid + +# Checking domain is active +is_domain_suspended 'dns' + +# Defining if emtpy +if [ -z "$id"] ; then + id=$(get_next_dns_record) +fi + +# Checking id format +format_validation 'id' + +# Checking id +is_dns_record_free + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Defining zone path +zone="$V_USERS/$user/zones/$domain" + +# Adding record +dns_rec="ID='$id' RECORD='$record' TYPE='$rtype' VALUE='$value'" +dns_rec="$dns_rec SUSPEND='no' DATE='$V_DATE'" +echo "$dns_rec" >> $zone + +# Sorting records +sort_dns_records + +# Updating zone +update_domain_zone + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Adding task to the vesta pipe +restart_schedule 'dns' + +# Logging +log_history "$V_EVENT" "v_del_dns_domain_record $user $domain $id" +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_add_ssl_certificate b/bin/v_add_ssl_certificate new file mode 100755 index 00000000..bc28fa39 --- /dev/null +++ b/bin/v_add_ssl_certificate @@ -0,0 +1,57 @@ +#!/bin/bash +# info: adding ssl certificate + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +cert="$2" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/cert_func.sh + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '2' "$#" 'user certificate' + +# Checking argument format +format_validation 'user' 'certificate' + +# Checking user +is_user_valid + +# Checking user is active +is_user_suspended + +# Checking certificate name +is_cert_free + +# Checking template +is_cert_valid "$V_TMP" + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Adding certificate to user dir +cp $V_TMP/$cert.crt $V_USERS/$user/cert/ +cp $V_TMP/$cert.key $V_USERS/$user/cert/ + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Logging +log_history "$V_EVENT" "v_del_ssl_certificate $user $cert" +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_add_sys_cron b/bin/v_add_sys_cron new file mode 100755 index 00000000..495a2149 --- /dev/null +++ b/bin/v_add_sys_cron @@ -0,0 +1,82 @@ +#!/bin/bash +# info: adding cron job + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +min="$2" +hour="$3" +day="$4" +month="$5" +wday="$6" +command="$7" +job="$8" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/cron_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '7' "$#" 'user min hour day month wday command [job]' + +# Checking argument format +format_validation 'user' 'min' 'hour' 'day' 'month' 'wday' 'command' + +# Checking cron system +is_system_enabled 'cron' + +# Checking user +is_user_valid + +# Get str position +if [ -z "$job" ]; then + job=$(get_next_cron_string) +fi + +# Checking id format +format_validation 'job' + +# Checking job id +is_cron_job_free + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Concatenating cron string +command=$(echo $command|sed -e "s/'/%quote%/g" -e "s/:/%dots%/g") +v_str="JOB='$job' MIN='$min' HOUR='$hour' DAY='$day' MONTH='$month" +v_str="$v_str' WDAY='$wday' CMD='$command' SUSPEND='no' DATE='$V_DATE'" + +# Adding to crontab +echo "$v_str">>$V_USERS/$user/crontab.conf + +# Sorting jobs by id +sort_cron_jobs + +# Sync system cron with user +sync_cron_jobs + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Adding task to the vesta pipe +restart_schedule 'cron' + +# Logging +log_history "$V_EVENT" "v_del_sys_cron $user $job" +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_add_sys_ip b/bin/v_add_sys_ip new file mode 100755 index 00000000..28bb6175 --- /dev/null +++ b/bin/v_add_sys_ip @@ -0,0 +1,100 @@ +#!/bin/bash +# info: adding system ip + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +ip="$1" +mask="$2" +interface="${3-eth0}" +owner="${4-vesta}" +ip_status="${5-shared}" +ip_name="$6" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/ip_func.sh +source $V_FUNC/domain_func.sh # for namehosting + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '2' "$#" 'ip mask [interface] [owner] [ip_status] [ip_name]' + +# Checking argument format +format_validation 'ip' 'mask' 'interface' + +# Checking system ip +is_sys_ip_free + +# Checking owner +if [ ! -z "$owner" ]; then + format_validation 'user' + is_user_valid "$owner" +fi + +# Checking ip_status +if [ ! -z "$ip_status" ]; then + format_validation 'ip_status' +fi + +# Checking ip_name +if [ ! -z "$ip_name" ] ; then + format_validation 'ip_name' +fi + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Get interface number +i_number=$(get_next_interface_number) +iface="$interface$i_number" + +# Defining config paths +conf='/etc/httpd/conf.d/vesta.conf' +nconf='/etc/nginx/conf.d/vesta_ip.conf' +iconf='/etc/sysconfig/network-scripts/ifcfg' +rconf='/etc/httpd/conf.d/rpaf.conf' + +# Adding ip +ifconfig "$iface" "$ip" netmask "$mask" + +# Adding startup script +ip_add_startup + +# Adding vesta ip +ip_add_vesta + +# Importing main config +source $V_CONF/vesta.conf + +# Adding namehosting support +namehost_ip_support + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Updating user conf +if [ ! -z "$owner" ]; then + user="$owner" + increase_user_value "$user" '$IP_OWNED' +fi + +# Adding task to the vesta pipe +if [ "$web_restart" = 'yes' ]; then + restart_schedule 'web' +fi + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_add_sys_user b/bin/v_add_sys_user new file mode 100755 index 00000000..b5a57c5e --- /dev/null +++ b/bin/v_add_sys_user @@ -0,0 +1,191 @@ +#!/bin/bash +# info: adding system user + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +password="$2" +email="$3" +role="$4" +owner="${5-vesta}" +package="${6-default}" +ns1=$7 +ns2=$8 + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '5' "$#" 'user password email role owner [package] [ns1] [ns2]' + +# Checking argument format +format_validation 'user' 'password' 'email' 'role' 'owner' 'package' +format_validation 'ns1' 'ns2' + +# Checking user +is_user_free "$user" + +# Checking 'vesta' user creation +if [ "$user" != 'vesta' ]; then + # Checking owner + is_user_valid "$owner" + + # Checking owner role + is_user_privileged "$owner" + + # Checking owner permission + is_user_privileged "$owner" "$role" + + # Checking package + is_package_valid "$package" +fi + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Importing main config +source $V_CONF/vesta.conf + +# Parsing package data +package_data=$(cat $V_PKG/$package.pkg) + +# Checking shell +shell_conf=$(echo "$package_data"|grep 'SHELL'|cut -f 2 -d \') +case $shell_conf in + nologin) shell='/sbin/nologin' ;; + bash) shell='/bin/bash' ;; + *) shell='/sbin/nologin' ;; +esac + +# Adding user +/usr/sbin/adduser "$user" -s "$shell" -c "$email" -m -d "$V_HOME/$user" + +# Adding password +echo "$password" | /usr/bin/passwd "$user" --stdin >/dev/null 2>&1 + +# Building directory tree +if [ ! -z "$BACKUP_SYSTEM" ] && [ "$BACKUP_SYSTEM" != 'no' ]; then + mkdir $V_HOME/$user/backup + chmod 751 $V_HOME/$user/backup +fi + +if [ ! -z "$WEB_SYSTEM" ] && [ "$WEB_SYSTEM" != 'no' ]; then + mkdir $V_HOME/$user/conf + mkdir $V_HOME/$user/domains + mkdir $V_HOME/$user/tmp + chmod 751 $V_HOME/$user/conf + chmod 751 $V_HOME/$user/domains + chmod 777 $V_HOME/$user/tmp + chown $user:$user $V_HOME/$user/domains +fi + +if [ ! -z "$MAIL_SYSTEM" ] && [ "$MAIL_SYSTEM" != 'no' ]; then + mkdir $V_HOME/$user/mail + chmod 751 $V_HOME/$user/mail +fi + +# Set permissions +chmod -R a+x $V_HOME/$user + +# Checking quota +if [ ! -z "$DISK_QUOTA" ] && [ "$DISK_QUOTA" != 'off' ]; then + DISK_QUOTA=$(echo "$package_data"|grep 'DISK_QUOTA' | cut -f 2 -d \') + set_quota "$user" "$DISK_QUOTA" +fi + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Adding user dir +mkdir $V_USERS/$user + +# Creating configuration files and pipes +touch $V_USERS/$user/user.conf +echo "v_upd_sys_user_disk $user" >> $V_QUEUE/disk.pipe + +if [ ! -z "$WEB_SYSTEM" ] && [ "$WEB_SYSTEM" != 'no' ]; then + mkdir $V_USERS/$user/cert + touch $V_USERS/$user/web_domains.conf + echo "v_upd_web_domains_traff $user" >> $V_QUEUE/traffic.pipe + echo "v_upd_web_domains_disk $user" >> $V_QUEUE/disk.pipe +fi + +if [ ! -z "$DNS_SYSTEM" ] && [ "$DNS_SYSTEM" != 'no' ]; then + touch $V_USERS/$user/dns.conf + mkdir $V_USERS/$user/zones +fi + +if [ ! -z "$MAIL_SYSTEM" ] && [ "$MAIL_SYSTEM" != 'no' ]; then + touch $V_USERS/$user/mail_domains.conf + touch $V_USERS/$user/mail_boxes.conf + echo "v_upd_mail_domains_disk $user" >> $V_QUEUE/disk.pipe +fi + +if [ ! -z "$DB_SYSTEM" ] && [ "$DB_SYSTEM" != 'no' ]; then + touch $V_USERS/$user/db.conf + echo "v_upd_db_bases_disk $user" >> $V_QUEUE/disk.pipe +fi + +if [ ! -z "$CRON_SYSTEM" ] && [ "$CRON_SYSTEM" != 'no' ]; then + touch $V_USERS/$user/crontab.conf +fi + +if [ ! -z "$BACKUP_SYSTEM" ] && [ "$BACKUP_SYSTEM" != 'no' ]; then + echo "v_backup_sys_user $user" >> $V_QUEUE/backup.pipe +fi + +# Rewriting nameservers +if [ ! -z "$ns1" ]; then + package_data=$(echo "$package_data" | sed -e "s/NS1=.*$/NS1='$ns1'/g") +fi +if [ ! -z "$ns2" ]; then + package_data=$(echo "$package_data" | sed -e "s/NS2=.*$/NS2='$ns2'/g") +fi + + +# Filling user config +echo "PACKAGE='$package' +$package_data +SUSPENDED='no' +OWNER='$owner' +ROLE='$role' +CONTACT='$email' +REPORTS='yes' +IP_OWNED='0' +U_CHILDS='0' +U_DISK='0' +U_BANDWIDTH='0' +U_WEB_DOMAINS='0' +U_WEB_SSL='0' +U_DNS_DOMAINS='0' +U_DATABASES='0' +U_MAIL_DOMAINS='0' +DATE='$V_DATE'" > $V_USERS/$user/user.conf + +# Filling owner config +ROLE=$(echo "$role" | tr "[:lower:]" "[:upper:]") +if [ "$user" != 'vesta' ]; then + echo "$ROLE='$user'" >> $V_USERS/$owner/reseller.conf + increase_user_value "$owner" 'U_CHILDS' +fi + +# Hiding password +V_EVENT=$(echo $V_EVENT | sed -e "s/$password/xxxxxx/g") + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_add_sys_user_ip b/bin/v_add_sys_user_ip new file mode 100755 index 00000000..487292af --- /dev/null +++ b/bin/v_add_sys_user_ip @@ -0,0 +1,67 @@ +#!/bin/bash +# info: addding ip to user + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +ip="$2" +ip_status="${3-exclusive}" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/ip_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '2' "$#" 'user ip [ip_status]' + +# Checking argument format +format_validation 'user' 'ip' 'ip_status' + +# Checking user +is_user_valid + +# Checking user is active +is_user_suspended + +# Checking system ip +is_sys_ip_valid + +# Checking webdomains on ip +is_ip_key_empty '$U_WEB_DOMAINS' + +# Checking users on ip +is_ip_key_empty '$U_SYS_USERS' + +# Checking ip owner +is_ip_key_empty '$OWNER' + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Adding ip to user +update_sys_ip_value '$OWNER' "$user" +update_sys_ip_value '$STATUS' "$ip_status" + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Updating user conf +increase_user_value "$user" '$IP_OWNED' + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_add_sys_user_reports b/bin/v_add_sys_user_reports new file mode 100755 index 00000000..d1a25bc0 --- /dev/null +++ b/bin/v_add_sys_user_reports @@ -0,0 +1,59 @@ +#!/bin/bash +# info: adding user reports + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/cron_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '1' "$#" 'user' + +# Checking argument format +format_validation 'user' + +# Checking user +is_user_valid + +# Checking user is active +is_user_suspended + +# Checking reports existance +is_user_key_empty '$REPORTS' + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Changing user report value +update_user_value "$user" '$REPORTS' 'yes' + +# Sync system cron with user +sync_cron_jobs + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Adding task to the vesta pipe +restart_schedule 'cron' + +# Logging +log_history "$V_EVENT" "v_del_sys_user_reports $user" +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_add_web_domain b/bin/v_add_web_domain new file mode 100755 index 00000000..f7ef8c95 --- /dev/null +++ b/bin/v_add_web_domain @@ -0,0 +1,187 @@ +#!/bin/bash +# info: adding web domain + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +domain=$(idn -t --quiet -u "$2" ) +domain_idn=$(idn -t --quiet -a "$domain") +ip="$3" +template=${4-default} + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/domain_func.sh +source $V_FUNC/ip_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '3' "$#" 'user domain ip [template]' + +# Checking argument format +format_validation 'user' 'domain' 'ip' 'template' + +# Checking web system is enabled +is_system_enabled 'web' + +# Checking user +is_user_valid + +# Checking user is active +is_user_suspended + +# Checking domain +is_domain_new 'quiet' +if [ $? -ne $OK ]; then + + # Checking domain owner + is_domain_owner + + # Checking domain service + is_web_domain_free + +fi + +# Checking ip +is_ip_avalable + +# Checking package +is_package_full 'web_domain' + +# Checking template +templates=$(get_user_value '$TEMPLATES') +is_template_valid "web" + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Defining domain aliases +ip_name=$(get_ip_name) +ip_name_idn=$(idn -t --quiet -a "$ip_name") +domain_alias="www.$domain" +domain_alias_idn="www.$domain_idn" +if [ ! -z "$ip_name" ]; then + domain_alias_dash="${domain//./-}.$ip_name" + domain_alias_dash_idn="${domain_idn//./-}.$ip_name_idn" + aliases="$domain_alias,$domain_alias_dash" + aliases_idn="$domain_alias_idn,$domain_alias_dash_idn" +else + aliases="$domain_alias" + aliases_idn="$domain_alias_idn" +fi + +# Defining vars for httpd_add_config function +port=$(get_web_port) +group="$user" +email="$user@$domain" +docroot="$V_HOME/$user/domains/$domain/public_html" +conf="$V_HOME/$user/conf/httpd.conf" +tpl_file="$V_WEBTPL/apache_$template.tpl" + +# Adding domain to the httpd.conf +httpd_add_config + +# Building directory tree +mkdir $V_HOME/$user/domains/$domain \ + $V_HOME/$user/domains/$domain/public_html \ + $V_HOME/$user/domains/$domain/public_shtml \ + $V_HOME/$user/domains/$domain/document_errors \ + $V_HOME/$user/domains/$domain/cgi-bin \ + $V_HOME/$user/domains/$domain/private \ + $V_HOME/$user/domains/$domain/stats \ + $V_HOME/$user/domains/$domain/logs + +# Adding domain logs +touch /var/log/httpd/domains/$domain.bytes \ + /var/log/httpd/domains/$domain.log \ + /var/log/httpd/domains/$domain.error_log + +# Adding symlink for logs +ln -s /var/log/httpd/domains/$domain.*log $V_HOME/$user/domains/$domain/logs/ + +# Adding domain skeleton +cp -r $V_WEBTPL/skel/public_html/ $V_HOME/$user/domains/$domain/ +cp -r $V_WEBTPL/skel/public_shtml/ $V_HOME/$user/domains/$domain/ +cp -r $V_WEBTPL/skel/document_errors/ $V_HOME/$user/domains/$domain/ +cp -r $V_WEBTPL/skel/cgi-bin/ $V_HOME/$user/domains/$domain/ + +# Changing tpl values +for file in $(find "$V_HOME/$user/domains/$domain/" -type f); do + sed -i "s/%domain%/$domain/g" $file +done + +# Changing file owner +chown -R $user:$user $V_HOME/$user/domains/$domain +chown root:$user /var/log/httpd/domains/$domain.* + +# Changing file permissions +chmod 551 $V_HOME/$user/domains/$domain +chmod 751 $V_HOME/$user/domains/$domain/private +chmod 751 $V_HOME/$user/domains/$domain/cgi-bin +chmod 751 $V_HOME/$user/domains/$domain/public_html +chmod 751 $V_HOME/$user/domains/$domain/public_shtml +chmod 751 $V_HOME/$user/domains/$domain/document_errors +chmod -f -R 775 $V_HOME/$user/domains/$domain/cgi-bin/* +chmod -f -R 775 $V_HOME/$user/domains/$domain/public_html/* +chmod -f -R 775 $V_HOME/$user/domains/$domain/document_errors/* +chmod 551 $V_HOME/$user/domains/$domain/stats +chmod 551 $V_HOME/$user/domains/$domain/logs +chmod 640 /var/log/httpd/domains/$domain.* + +# Running template post setup file +if [ -e $V_WEBTPL/apache_$template.sh ]; then + $V_WEBTPL/apache_$template.sh $user $domain $ip $V_HOME $docroot $port +fi + +# Checking main vesta httpd config +main_conf='/etc/httpd/conf.d/vesta.conf' +main_conf_check=$(grep "$conf" $main_conf ) +if [ -z "$main_conf_check" ]; then + echo "Include $conf" >>$main_conf +fi + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Increasing ip value +increase_ip_value + +# Increasing domain value +increase_user_value "$user" '$U_WEB_DOMAINS' + +# Defining domain variables +template_data=$(cat $V_WEBTPL/apache_$template.descr|grep -v '#') +v_str="DOMAIN='$domain'" +v_str="$v_str IP='$ip'" +v_str="$v_str U_DISK='0'" +v_str="$v_str U_BANDWIDTH='0'" +v_str="$v_str TPL='$template'" +v_str="$v_str ALIAS='$aliases'" +v_str="$v_str $template_data" # Inserting PHP,CGI and ELOG keys +v_str="$v_str STATS='' STATS_AUTH=''" +v_str="$v_str SSL='no' SSL_HOME='' SSL_CERT=''" +v_str="$v_str NGINX='' NGINX_EXT='' SUSPEND='no' DATE='$V_DATE'" + +# Registering domain +echo "$v_str" >>$V_USERS/$user/web_domains.conf + +# Adding task to the vesta pipe +restart_schedule 'web' + +# Logging +log_history "$V_EVENT" "v_del_web_domain $user $domain" +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_add_web_domain_alias b/bin/v_add_web_domain_alias new file mode 100755 index 00000000..68966b16 --- /dev/null +++ b/bin/v_add_web_domain_alias @@ -0,0 +1,119 @@ +#!/bin/bash +# info: adding web domain alias + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +domain=$(idn -t --quiet -u "$2" ) +domain_idn=$(idn -t --quiet -a "$domain") +dom_alias=$(idn -t --quiet -u "$3" ) +dom_alias_idn=$(idn -t --quiet -a "$dom_alias" ) + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/domain_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '3' "$#" 'user domain dom_alias' + +# Checking argument format +format_validation 'user' 'domain' 'dom_alias' + +# Checking web system is enabled +is_system_enabled 'web' + +# Checking user +is_user_valid + +# Checking user is active +is_user_suspended + +# Checking domain exist +is_web_domain_valid + +# Checking domain is not suspened +is_domain_suspended 'web_domains' + +# Checking alias on the server +is_domain_new 'quiet' "$dom_alias" +if [ $? -ne $OK ]; then + + # Checking alias owner + is_domain_owner "$dom_alias" + + # Checking alias service + is_web_domain_free "$dom_alias" +fi + +# Checking package +is_package_full 'web_alias' + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Get template name +tpl_name=$(get_web_domain_value '$TPL') +tpl_file="$V_WEBTPL/apache_$tpl_name.tpl" + +# Defining config +conf="$V_HOME/$user/conf/httpd.conf" + +# Defining search phrase +search_phrase='ServerAlias' + +# Defining new alias string +curr_alias=$(get_web_domain_value '$ALIAS') +if [ -z "$curr_alias" ]; then + new_alias="$dom_alias" + new_alias_idn="$dom_alias_idn" +else + new_alias="$curr_alias,$dom_alias" + new_alias_idn=$(idn -t --quiet -a "$curr_alias,$dom_alias") +fi + +# Defining replace string +str_repl=" ServerAlias ${new_alias_idn//,/ }" + +# Adding alias +httpd_change_config + +# Checking ssl domain +ssl=$(get_web_domain_value '$SSL') +if [ "$ssl" = 'yes' ]; then + + # Defining ssl template + tpl_file="$V_WEBTPL/apache_$tpl_name.stpl" + + # Defining ssl config + conf="$V_HOME/$user/conf/shttpd.conf" + + # Adding alias + httpd_change_config +fi + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Adding new alias +update_web_domain_value '$ALIAS' "$new_alias" + +# Adding task to the vesta pipe +restart_schedule 'web' + +log_history "$V_EVENT" "v_del_web_domain_alias $user $domain $dom_alias" +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_add_web_domain_cgi b/bin/v_add_web_domain_cgi new file mode 100755 index 00000000..477bda13 --- /dev/null +++ b/bin/v_add_web_domain_cgi @@ -0,0 +1,122 @@ +#!/bin/bash +# info: adding cgi for domain + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +domain=$(idn -t --quiet -u "$2" ) +domain_idn=$(idn -t --quiet -a "$domain") + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/domain_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '2' "$#" 'user domain' + +# Checking argument format +format_validation 'user' 'domain' + +# Checking web system is enabled +is_system_enabled 'web' + +# Checking user +is_user_valid + +# Checking user is active +is_user_suspended + +# Checking domain exist +is_web_domain_valid + +# Checking domain is not suspened +is_domain_suspended 'web_domains' + +# Checking cgi is not added +is_web_domain_key_empty '$CGI' + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Get template name +tpl_name=$(get_web_domain_value '$TPL') +tpl_file="$V_WEBTPL/apache_$tpl_name.tpl" + +# Defining config +conf="$V_HOME/$user/conf/httpd.conf" + +# Defining search phrase +search_phrase='ScriptAlias ' + +# Defining replace string +str_repl=" ScriptAlias /cgi-bin/ $V_HOME/$user/domains/$domain/cgi-bin/" + +# Adding cgi-bin support +httpd_change_config + +# Defining search phrase +search_phrase='Options ' + +# Defining replace string +str_repl=' Options +Includes -Indexes +ExecCGI' + +# Adding execscgi support +httpd_change_config + +# Checking ssl +ssl=$(get_web_domain_value '$SSL') +if [ "$ssl" = 'yes' ]; then + + # Get ssl template name + tpl_file="$V_WEBTPL/apache_$tpl_name.stpl" + + # Defining ssl config + conf="$V_HOME/$user/conf/shttpd.conf" + + # Defining search phrase + search_phrase='ScriptAlias ' + + # Defining replace string + str_repl=" ScriptAlias /cgi-bin/ $V_HOME/$user/domains/$domain/cgi-bin/" + + # Adding cgi-bin support + httpd_change_config + + # Defining search phrase + search_phrase='Options ' + + # Defining replace string + str_repl=' Options +Includes -Indexes +ExecCGI' + + # Adding execscgi support + httpd_change_config + +fi + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Adding elog in config +update_web_domain_value '$CGI' 'yes' + +# Adding task to the vesta pipe +restart_schedule 'web' + +# Logging +log_history "$V_EVENT" "v_del_web_domain_cgi $user $domain" +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_add_web_domain_elog b/bin/v_add_web_domain_elog new file mode 100755 index 00000000..830aa8cb --- /dev/null +++ b/bin/v_add_web_domain_elog @@ -0,0 +1,98 @@ +#!/bin/bash +# info: adding error log for domain + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +domain=$(idn -t --quiet -u "$2" ) +domain_idn=$(idn -t --quiet -a "$domain") + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/domain_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '2' "$#" 'user domain' + +# Checking argument format +format_validation 'user' 'domain' + +# Checking web system is enabled +is_system_enabled 'web' + +# Checking user +is_user_valid + +# Checking user is active +is_user_suspended + +# Checking domain exist +is_web_domain_valid + +# Checking domain is not suspened +is_domain_suspended 'web_domains' + +# Checking errorlog is not added +is_web_domain_key_empty '$ELOG' + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Get template name +tpl_name=$(get_web_domain_value '$TPL') +tpl_file="$V_WEBTPL/apache_$tpl_name.tpl" + +# Defining config +conf="$V_HOME/$user/conf/httpd.conf" + +# Defining search phrase +search_phrase='ErrorLog ' + +# Defining replace string +str_repl=" ErrorLog /var/log/httpd/domains/$domain.error.log" + +# Adding errolog support +httpd_change_config + +# Checking ssl +ssl=$(get_web_domain_value '$SSL') +if [ "$ssl" = 'yes' ]; then + + # Get ssl template name + tpl_file="$V_WEBTPL/apache_$tpl_name.stpl" + + # Defining ssl config + conf="$V_HOME/$user/conf/shttpd.conf" + + # Adding errolog support + httpd_change_config + +fi + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Adding elog in config +update_web_domain_value '$ELOG' 'yes' + +# Adding task to the vesta pipe +restart_schedule 'web' + +# Logging +log_history "$V_EVENT" "v_del_web_domain_elog $user $domain" +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_add_web_domain_nginx b/bin/v_add_web_domain_nginx new file mode 100755 index 00000000..38965a2c --- /dev/null +++ b/bin/v_add_web_domain_nginx @@ -0,0 +1,112 @@ +#!/bin/bash +# info: adding web domain nginx integration + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +domain="$2" +template="${3-default}" +default_extentions="jpg jpeg gif png ico css zip tgz gz rar bz2 doc xls exe\ + pdf ppt txt tar wav bmp rtf js mp3 avi mpeg" +extentions="${4-$default_extentions}" +extentions=${extentions// /|} # replacing spaces with pipe char + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/domain_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '2' "$#" 'user domain [template] [extentions] [conn]' + +# Checking argument format +format_validation 'user' 'domain' 'template' 'extentions' + +# Checking web system is enabled +is_system_enabled 'proxy' + +# Checking user +is_user_valid + +# Checking user is active +is_user_suspended + +# Checking domain exist +is_web_domain_valid + +# Checking domain is not suspened +is_domain_suspended 'web_domains' + +# Check nginx is not added +is_web_domain_key_empty '$NGINX' + +# Checking template +is_template_valid "proxy" + + +exit +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Get template name +tpl_name=$(get_web_domain_value '$TPL') +tpl_file="$V_WEBTPL/$package-$tpl_name.tpl" + +# Defining config +conf="$V_HOME/$user/conf/httpd.conf" + +# Defining search phrase +search_phrase='ServerAlias' + +# Defining new alias string +curr_alias=$(get_web_domain_value '$ALIAS') +if [ -z "$curr_alias" ]; then + new_alias="$dom_alias" +else + new_alias="$curr_alias,$dom_alias" +fi + +# Defining replace string +str_repl=" ServerAlias ${new_alias//,/ }" + +# Adding alias +httpd_change_config + +# Checking ssl domain +ssl=$(get_web_domain_value '$SSL') +if [ "$ssl" = 'yes' ]; then + + # Defining ssl template + tpl_file="$V_WEBTPL/$package-$tpl_name.ssl.tpl" + + # Defining ssl config + conf="$V_HOME/$user/conf/shttpd.conf" + + # Adding alias + httpd_change_config +fi + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Adding new alias +update_web_domain_value '$ALIAS' "$new_alias" + +# Adding task to the vesta pipe +restart_schedule 'web' + +log_history "$V_EVENT" "v_del_web_domain_alias $user $domain $dom_alias" +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_add_web_domain_ssl b/bin/v_add_web_domain_ssl new file mode 100755 index 00000000..debf0d4d --- /dev/null +++ b/bin/v_add_web_domain_ssl @@ -0,0 +1,120 @@ +#!/bin/bash +# info: adding ssl for domain + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +domain=$(idn -t --quiet -u "$2" ) +domain_idn=$(idn -t --quiet -a "$domain") +cert="$3" +tpl_option="${4-single}" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/domain_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '3' "$#" 'user domain certificate [sslhome]' + +# Checking argument format +format_validation 'user' 'domain' 'certificate' + +# Checking web system is enabled +is_system_enabled 'web' + +# Checking user +is_user_valid + +# Checking user is active +is_user_suspended + +# Checking domain exist +is_web_domain_valid + +# Checking domain is not suspened +is_domain_suspended 'web_domains' + +# Checking package +is_package_full 'web_ssl' + +# Check ssl is not added +is_web_domain_key_empty '$SSL' + +# Checking ssl certificate +is_web_domain_cert_valid + +# Checking template +templates=$(get_user_value '$TEMPLATES') +template=$(get_web_domain_value '$TPL') +is_template_valid 'web' + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Defining variables for template replace +port=$(get_web_port_ssl) +ip=$(get_web_domain_value '$IP') +aliases=$(get_web_domain_value '$ALIAS') +aliases_idn=$(idn -t --quiet -a "$aliases") +email="$user@$domain" +ssl_cert="$V_HOME/$user/conf/$cert.crt" +ssl_key="$V_HOME/$user/conf/$cert.key" +case $tpl_option in + single) docroot="$V_HOME/$user/domains/$domain/public_shtml" ;; + same) docroot="$V_HOME/$user/domains/$domain/public_html" ;; + *) check_args '3' "$#" 'user domain certificate [sslhome]' +esac +group="$user" +conf="$V_HOME/$user/conf/shttpd.conf" +tpl_file="$V_WEBTPL/apache_$template.stpl" + +# Adding domain to the httpd.conf +httpd_add_config + +# Adding certificate to user dir +if [ ! -e "$ssl_cert" ]; then + cp -f $V_USERS/$user/cert/$cert.crt $ssl_cert + cp -f $V_USERS/$user/cert/$cert.key $ssl_key +fi + +# Running template post setup file +if [ -e $V_WEBTPL/apache_$template.sh ]; then + $V_WEBTPL/apache_$template.sh $user $domain $ip $V_HOME $docroot $port +fi + +# Checking main vesta httpd config +main_conf='/etc/httpd/conf.d/vesta.conf' +main_conf_check=$(grep "$conf" $main_conf ) +if [ -z "$main_conf_check" ]; then + echo "Include $conf" >>$main_conf +fi + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Increasing domain value +increase_user_value "$user" '$U_WEB_SSL' + +# Adding ssl values +update_web_domain_value '$SSL' 'yes' +update_web_domain_value '$SSL_HOME' "$tpl_option" +update_web_domain_value '$SSL_CERT' "$cert" + +# Logging +log_history "$V_EVENT" "v_del_web_domain_ssl $user $domain" +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_add_web_domain_stat b/bin/v_add_web_domain_stat new file mode 100755 index 00000000..21404909 --- /dev/null +++ b/bin/v_add_web_domain_stat @@ -0,0 +1,89 @@ +#!/bin/bash +# info: adding stats for domain + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +domain=$(idn -t --quiet -u "$2" ) +domain_idn=$(idn -t --quiet -a "$domain") +type="$3" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/domain_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '3' "$#" 'user domain type' + +# Checking argument format +format_validation 'user' 'domain' + +# Checking web system is enabled +is_system_enabled 'web' +check_func_result $? + +# Checking user +is_user_valid "$user" + +# Checking user is active +is_user_suspended + +# Checking domain exist +is_web_domain_valid + +# Checking domain is not suspened +is_domain_suspended 'web_domains' + +# Checking statistic type +is_type_valid 'stat' "$type" + +# Check statistic is not added +is_web_domain_key_empty '$STATS' + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Adding statistic config +cat $V_WEBTPL/$type.tpl |\ + sed -e "s/%ip%/$ip/g" | \ + sed -e "s/%port%/$port/g" | \ + sed -e "s/%domain_idn%/$domain_idn/g" | \ + sed -e "s/%domain%/$domain/g" | \ + sed -e "s/%user%/$user/g" | \ + sed -e "s/%home%/${V_HOME////\/}/g" | \ + sed -e "s/%alias%/$domain_aliases/g" \ +>$V_HOME/$user/conf/$type.$domain.conf + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Switching on command string for pipe +case $type in + webalizer) command="webalizer -c $V_HOME/$user/conf/$type.$domain.conf";; + awstats ) command="" # FIXME awstats command;; +esac + +# Adding command to pipe +echo "$command" >> $V_QUEUE/stats.pipe + +# Adding stats in config +update_web_domain_value '$STATS' "$type" + +# Logging +log_history "$V_EVENT" "v_del_web_domain_stat $user $domain" +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_add_web_domain_stat_auth b/bin/v_add_web_domain_stat_auth new file mode 100755 index 00000000..8d8c3272 --- /dev/null +++ b/bin/v_add_web_domain_stat_auth @@ -0,0 +1,99 @@ +#!/bin/bash +# info: adding web domain + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +domain=$(idn -t --quiet -u "$2" ) +auth_user="$3" +auth_pass="$4" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/domain_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '4' "$#" 'user domain auth_user auth_password' + +# Checking argument format +format_validation 'user' 'domain' 'auth_user' 'auth_pass' + +# Checking web system is enabled +is_system_enabled 'web' + +# Checking user +is_user_valid + +# Checking user is active +is_user_suspended + +# Checking domain exist +is_web_domain_valid + +# Checking domain is not suspened +is_domain_suspended 'web_domains' + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Definining statistic dir +stat_dir="$V_HOME/$user/domains/$domain/stats" + +# Adding htaccess file +if [ ! -e "$stat_dir/.htaccess" ]; then + echo "AuthUserFile $stat_dir/.htpasswd" > $stat_dir/.htaccess + echo "AuthName \"Only for admins\"" >> $stat_dir/.htaccess + echo "AuthType Basic" >> $stat_dir/.htaccess + echo "Require valid-user" >> $stat_dir/.htaccess + echo "" >> $stat_dir/.htaccess +fi + +# Generating htaccess user and password +if [ ! -e "$stat_dir/.htpasswd" ]; then + htpasswd -bc $stat_dir/.htpasswd "$auth_user" "$auth_pass" >/dev/null 2>&1 +else + htpasswd -b $stat_dir/.htpasswd "$auth_user" "$auth_pass" >/dev/null 2>&1 +fi + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Get current value +curr_val=$(get_web_domain_value '$STATS_AUTH') +check_uniq=$(echo "$curr_val" | grep -w "$auth_user") + +# Checking current users +if [ -z "$curr_val" ] || [ "$curr_val" = 'no' ]; then + a_users="$auth_user" +else + if [ -z "$check_uniq" ]; then + a_users="$curr_val,$auth_user" + else + a_users="$curr_val" + fi +fi + +# Adding stats user in config +update_web_domain_value '$STATS_AUTH' "$a_users" + +# Hiding password +V_EVENT=$(echo $V_EVENT | sed -e "s/$auth_pass/xxxxxx/g") + +# Logging +log_history "$V_EVENT" "v_del_web_domain_stat_auth $user $domain $auth_user" +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_change_db_password b/bin/v_change_db_password new file mode 100755 index 00000000..554f9d26 --- /dev/null +++ b/bin/v_change_db_password @@ -0,0 +1,71 @@ +#!/bin/bash +# info: changing userdb password + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +database="$2" +db_password="$3" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/db_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '3' "$#" 'user db_name db_password' + +# Checking argument format +format_validation 'user' 'database' 'db_password' + +# Checking db system is enabled +is_system_enabled 'db' + +# Checking user +is_user_valid + +# Checking user is active +is_user_suspended + +# Checking db existance +is_db_valid + +# Checking db is active +is_db_suspended + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Define database variables +db_user=$(get_db_value '$USER') +host=$(get_db_value '$HOST') +type=$(get_db_value '$TYPE') + +# Switching on db type +case $type in + mysql) change_db_mysql_password ;; + pgsql) change_db_pgsql_password ;; +esac + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Hiding password +V_EVENT=$(echo $V_EVENT | sed -e "s/$db_password/xxxxxx/g") + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_change_dns_domain_exp b/bin/v_change_dns_domain_exp new file mode 100755 index 00000000..2be703b8 --- /dev/null +++ b/bin/v_change_dns_domain_exp @@ -0,0 +1,65 @@ +#!/bin/bash +# info: changing dns domain exp date + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +domain=$(idn -t --quiet -u "$2" ) +domain_idn=$(idn -t --quiet -a "$domain") +exp="$3" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/domain_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '3' "$#" 'user domain exp' + +# Checking argument format +format_validation 'user' 'domain' 'exp' + +# Checking web system is enabled +is_system_enabled 'dns' + +# Checking user +is_user_valid + +# Checking user is active +is_user_suspended + +# Checking domain exist +is_dns_domain_valid + +# Checking domain is not suspened +is_domain_suspended 'dns' + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Get old expiriation date +old_exp=$(get_dns_domain_value '$EXP') + +# Changing exp +update_dns_domain_value '$EXP' "$exp" + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Logging +log_history "$V_EVENT" "$V_SCRIPT $user $domain $old_exp" +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_change_dns_domain_ip b/bin/v_change_dns_domain_ip new file mode 100755 index 00000000..f5e912fb --- /dev/null +++ b/bin/v_change_dns_domain_ip @@ -0,0 +1,73 @@ +#!/bin/bash +# info: changing dns domain ip + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +domain=$(idn -t --quiet -u "$2" ) +domain_idn=$(idn -t --quiet -a "$domain") +ip="$3" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/domain_func.sh + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '3' "$#" 'user domain ip' + +# Checking argument format +format_validation 'user' 'domain' 'ip' + +# Checking web system is enabled +is_system_enabled 'dns' + +# Checking user +is_user_valid + +# Checking user is active +is_user_suspended + +# Checking domain exist +is_dns_domain_valid + +# Checking domain is not suspened +is_domain_suspended 'dns' + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Get old ip +old_ip=$(get_dns_domain_value '$IP') + +# Changing ip +update_dns_domain_value '$IP' "$ip" + +# Changing records +sed -i "s/$old_ip/$ip/g" $V_USERS/$user/zones/$domain + +# Updating zone +update_domain_zone + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Adding task to the vesta pipe +restart_schedule 'dns' + +# Logging +log_history "$V_EVENT" "$V_SCRIPT $user $domain $old_ip" +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_change_dns_domain_record b/bin/v_change_dns_domain_record new file mode 100755 index 00000000..04e4c6e4 --- /dev/null +++ b/bin/v_change_dns_domain_record @@ -0,0 +1,87 @@ +#!/bin/bash +# info: changing dns domain record + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +domain=$(idn -t --quiet -u "$2" ) +domain_idn=$(idn -t --quiet -a "$domain") +id="$3" +record=$(idn -t --quiet -u "$4" ) +rtype=$(echo "$5"| tr '[:lower:]' '[:upper:]') +value=$(idn -t --quiet -u "$6" ) + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/domain_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '5' "$#" 'user domain id record type value' + +# Checking argument format +format_validation 'user' 'domain' 'id' 'record' 'rtype' + +# Checking web system is enabled +is_system_enabled 'dns' + +# Checking user +is_user_valid + +# Checking user is active +is_user_suspended + +# Checking domain exist +is_dns_domain_valid + +# Checking domain is not suspened +is_domain_suspended 'dns' + +# Checking record valid +is_dns_record_valid + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Defining zone path +zone="$V_USERS/$user/zones/$domain" + +# Deleting old record +rm_string=$(grep -n "^ID='$id'" $zone|cut -d : -f 1) +if [ ! -z "$rm_string" ]; then + sed -i "$rm_string d" $zone +fi + +# Adding record +dns_rec="ID='$id' RECORD='$record' TYPE='$rtype' VALUE='$value'" +dns_rec="$dns_rec SUSPEND='no' DATE='$V_DATE'" +echo "$dns_rec" >> $zone + +# Sorting records +sort_dns_records + +# Updating zone +update_domain_zone + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Adding task to the vesta pipe +restart_schedule 'dns' + +# Logging +log_history "$V_EVENT" +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_change_dns_domain_soa b/bin/v_change_dns_domain_soa new file mode 100755 index 00000000..99dbab3c --- /dev/null +++ b/bin/v_change_dns_domain_soa @@ -0,0 +1,70 @@ +#!/bin/bash +# info: changing dns domain soa + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +domain=$(idn -t --quiet -u "$2" ) +domain_idn=$(idn -t --quiet -a "$domain") +soa="$3" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/domain_func.sh + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '3' "$#" 'user domain soa' + +# Checking argument format +format_validation 'user' 'domain' 'soa' + +# Checking web system is enabled +is_system_enabled 'dns' + +# Checking user +is_user_valid + +# Checking user is active +is_user_suspended + +# Checking domain exist +is_dns_domain_valid + +# Checking domain is not suspened +is_domain_suspended 'dns' + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Get old soa +old_soa=$(get_dns_domain_value '$SOA') + +# Changing soa +update_dns_domain_value '$SOA' "$soa" + +# Updating zone +update_domain_zone + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Adding task to the vesta pipe +restart_schedule 'dns' + +# Logging +log_history "$V_EVENT" "$V_SCRIPT $user $domain $old_soa" +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_change_dns_domain_tpl b/bin/v_change_dns_domain_tpl new file mode 100755 index 00000000..dccd202e --- /dev/null +++ b/bin/v_change_dns_domain_tpl @@ -0,0 +1,84 @@ +#!/bin/bash +# info: changing dns domain template + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +domain=$(idn -t --quiet -u "$2" ) +domain_idn=$(idn -t --quiet -a "$domain") +template="$3" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/domain_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '3' "$#" 'user domain template' + +# Checking argument format +format_validation 'user' 'domain' 'template' + +# Checking web system is enabled +is_system_enabled 'dns' + +# Checking user +is_user_valid + +# Checking user is active +is_user_suspended + +# Checking domain exist +is_dns_domain_valid + +# Checking domain is not suspened +is_domain_suspended 'dns' + +# Checking template +is_template_valid 'dns' + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Get vals +old_tpl=$(get_dns_domain_value '$TPL') +ip=$(get_dns_domain_value '$IP') +ns1=$(get_user_value '$NS1') +ns2=$(get_user_value '$NS2') + +# Changing tpl +update_dns_domain_value '$TPL' "$template" + +cat $V_DNSTPL/$template.tpl |\ + sed -e "s/%ip%/$ip/g" \ + -e "s/%domain_idn%/$domain_idn/g" \ + -e "s/%domain%/$domain/g" \ + -e "s/%ns1%/$ns1/g" \ + -e "s/%ns2%/$ns2/g" > $V_USERS/$user/zones/$domain + +# Updating zone +update_domain_zone + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Adding task to the vesta pipe +restart_schedule 'dns' + +# Logging +log_history "$V_EVENT" "$V_SCRIPT $user $domain $old_tpl" +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_change_dns_domain_ttl b/bin/v_change_dns_domain_ttl new file mode 100755 index 00000000..920b26fb --- /dev/null +++ b/bin/v_change_dns_domain_ttl @@ -0,0 +1,71 @@ +#!/bin/bash +# info: changing dns domain ttl + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +domain=$(idn -t --quiet -u "$2" ) +domain_idn=$(idn -t --quiet -a "$domain") +ttl="$3" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/domain_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '3' "$#" 'user domain ttl' + +# Checking argument format +format_validation 'user' 'domain' 'ttl' + +# Checking web system is enabled +is_system_enabled 'dns' + +# Checking user +is_user_valid + +# Checking user is active +is_user_suspended + +# Checking domain exist +is_dns_domain_valid + +# Checking domain is not suspened +is_domain_suspended 'dns' + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Get old ttl +old_ttl=$(get_dns_domain_value '$TTL') + +# Changing ttl +update_dns_domain_value '$TTL' "$ttl" + +# Updating zone +update_domain_zone + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Adding task to the vesta pipe +restart_schedule 'dns' + +# Logging +log_history "$V_EVENT" "$V_SCRIPT $user $domain $old_ttl" +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_change_sys_cron_job b/bin/v_change_sys_cron_job new file mode 100755 index 00000000..f0db5f12 --- /dev/null +++ b/bin/v_change_sys_cron_job @@ -0,0 +1,82 @@ +#!/bin/bash +# info: changing cron job + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +job="$2" +min="$3" +hour="$4" +day="$5" +month="$6" +wday="$7" +command="$8" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/cron_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '7' "$#" 'user job min hour day month wday command' + +# Checking argument format +format_validation 'user' 'job' 'min' 'hour' 'day' 'month' 'wday' 'command' + +# Checking cron system +is_system_enabled 'cron' + +# Checking user +is_user_valid + +# Checking user is active +is_user_suspended + +# Checking cron job +is_job_valid + +# Checking job is active +# is_job_suspended + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Concatenating cron string +command=$(echo $command|sed -e "s/'/%quote%/g" -e "s/:/%dots%/g") +v_str="JOB='$job' MIN='$min' HOUR='$hour' WDAY='$wday'" +v_str="$v_str MONTH='$month' DAY='$day' CMD='$command' SUSPEND='no'" + +# Deleting job +del_cron_job + +# Adding to crontab +echo "$v_str">>$V_USERS/$user/crontab.conf + +# Sorting jobs by id +sort_cron_jobs + +# Sync system cron with user +sync_cron_jobs + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Adding task to the vesta pipe +restart_schedule 'cron' + +# Logging +log_history "$V_EVENT" +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_change_sys_ip_name b/bin/v_change_sys_ip_name new file mode 100755 index 00000000..f01f8232 --- /dev/null +++ b/bin/v_change_sys_ip_name @@ -0,0 +1,47 @@ +#!/bin/bash +# info: changing ip name + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +ip="$1" +ip_name="$2" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/ip_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '2' "$#" 'ip ip_name' + +# Checking argument format +format_validation 'ip' 'ip_name' + +# Checking system ip +is_sys_ip_valid + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Changing ip name +update_sys_ip_value '$NAME' "$ip_name" + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_change_sys_ip_owner b/bin/v_change_sys_ip_owner new file mode 100755 index 00000000..7fd47b1d --- /dev/null +++ b/bin/v_change_sys_ip_owner @@ -0,0 +1,71 @@ +#!/bin/bash +# info: changing ip owner + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +ip="$2" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/ip_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '2' "$#" 'user ip' + +# Checking argument format +format_validation 'user' 'ip' + +# Checking user +is_user_valid + +# Checking user is active +is_user_suspended + +# Checking system ip +is_sys_ip_valid + +# Checking webdomains on ip +is_ip_key_empty '$U_WEB_DOMAINS' + +# Checking users on ip +is_ip_key_empty '$U_SYS_USERS' + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Get ip and user owner +ip_owner=$(get_sys_ip_value '$OWNER') +user_owner=$(get_user_value '$OWNER') +owner_role=$(get_user_value '$ROLE') + +# Checking permissions +if [ "$owner_role" != 'admin' ] || [ "$ip_owner" != "$user_owner" ]; then + echo "Error: ip owner is not admin" + log_event 'debug' "$E_PERMS_REQUEIURED $V_EVENT" + exit $E_PERMS_REQUEIURED +fi + +# Changing ip owner +update_sys_ip_value '$OWNER' "$user" + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_change_sys_ip_status b/bin/v_change_sys_ip_status new file mode 100755 index 00000000..1febe0f9 --- /dev/null +++ b/bin/v_change_sys_ip_status @@ -0,0 +1,67 @@ +#!/bin/bash +# info: changing ip status + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +ip="$1" +ip_status="$2" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/ip_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '2' "$#" 'ip ip_status' + +# Checking argument format +format_validation 'ip' 'ip_status' + +# Checking system ip +is_sys_ip_valid + +# Checking current status +current_status=$(get_sys_ip_value '$STATUS') +if [ "$ip_status" = "$current_status" ]; then + echo "Error: status is already set" + log_event 'debug' "$E_VALUE_EXIST $V_EVENT" + exit $E_VALUE_EXIST +fi + +# Parsing current ip usage +web_domains=$(get_sys_ip_value '$U_WEB_DOMAINS') +sys_user=$(get_sys_ip_value '$U_SYS_USERS') +ip_owner=$(get_sys_ip_value '$OWNER') + +# Checking condition +if [ "$web_domains" -ne '0' ] && [ "$sys_user" != "$ip_owner" ]; then + echo "Error: ip is used" + log_event 'debug' "$E_IP_USED $V_EVENT" + exit $E_IP_USED +fi + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Changing ip name +update_sys_ip_value '$STATUS' "$ip_status" + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_change_sys_user_contact b/bin/v_change_sys_user_contact new file mode 100755 index 00000000..b3b52f41 --- /dev/null +++ b/bin/v_change_sys_user_contact @@ -0,0 +1,57 @@ +#!/bin/bash +# info: changing user contact email + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +email="$2" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '2' "$#" 'user email' + +# Checking argument format +format_validation 'user' 'email' + +# Checking user +is_user_valid + +# Checking user is active +is_user_suspended + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Get old value +old_email=$(get_user_value '$CONTACT') + +# Changing user contact email +update_user_value "$user" '$CONTACT' "$email" + +# Changing passwd file +pw_str=$(grep -n "^$user:" /etc/passwd) +str=$(echo "$pw_str" | cut -f 1 -d :) +sed -i "$str s/$old_email/$email/g" /etc/passwd + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Logging +log_history "$V_EVENT" "$V_SCRIPT $user $old_email" +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_change_sys_user_ns b/bin/v_change_sys_user_ns new file mode 100755 index 00000000..03fcf0e6 --- /dev/null +++ b/bin/v_change_sys_user_ns @@ -0,0 +1,56 @@ +#!/bin/bash +# info: changing user nameservers + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +ns1="$2" +ns2="$3" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking args +check_args '3' "$#" 'user ns1 ns2' + +# Checking argument format +format_validation 'user' 'ns1' 'ns2' + +# Checking user +is_user_valid + +# Checking user is active +is_user_suspended + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Get old values +old_ns1=$(get_user_value '$NS1') +old_ns2=$(get_user_value '$NS2') + +# Changing ns values +update_user_value "$user" '$NS1' "$ns1" +update_user_value "$user" '$NS2' "$ns2" + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Logging +log_history "$V_EVENT" "$V_SCRIPT $user $old_ns1 $old_ns2" +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_change_sys_user_package b/bin/v_change_sys_user_package new file mode 100755 index 00000000..9b7d8d50 --- /dev/null +++ b/bin/v_change_sys_user_package @@ -0,0 +1,58 @@ +#!/bin/bash +# info: changing user package + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +package="$2" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '2' "$#" 'user package' + +# Checking argument format +format_validation 'user' 'package' + +# Checking user +is_user_valid + +# Checking user is active +is_user_suspended + +# Checking package +is_package_valid + +# Checking current data +is_package_avalable + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Get old package value +old_package=$(get_user_value '$PACKAGE') + +# Changing user package +change_user_package + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_change_sys_user_password b/bin/v_change_sys_user_password new file mode 100755 index 00000000..2e46ec00 --- /dev/null +++ b/bin/v_change_sys_user_password @@ -0,0 +1,52 @@ +#!/bin/bash +# info: changing user password + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +password="$2" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '2' "$#" 'user password' + +# Checking argument format +format_validation 'user' 'password' + +# Checking user +is_user_valid + +# Checking user is active +is_user_suspended + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Changing user password +echo "$password" | /usr/bin/passwd "$user" --stdin >/dev/null 2>&1 + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Hiding password +V_EVENT=$(echo $V_EVENT | sed -e "s/$password/xxxxxx/g") + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_change_sys_user_shell b/bin/v_change_sys_user_shell new file mode 100755 index 00000000..dbaf3a6f --- /dev/null +++ b/bin/v_change_sys_user_shell @@ -0,0 +1,55 @@ +#!/bin/bash +# info: changing user shell + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +shell="$2" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '2' "$#" 'user shell' + +# Checking argument format +format_validation 'user' 'shell' + +# Checking user +is_user_valid + +# Checking user is active +is_user_suspended + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Changing user shell +update_user_value "$user" '$SHELL' "$shell" + +# Get shell full path +shell_path=$(get_shell_path) + +# Changing passwd file +/usr/bin/chsh -s "$shell_path" "$user" >/dev/null 2>&1 + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_change_web_domain_ip b/bin/v_change_web_domain_ip new file mode 100755 index 00000000..a771b58f --- /dev/null +++ b/bin/v_change_web_domain_ip @@ -0,0 +1,96 @@ +#!/bin/bash +# info: changing domain ip + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +domain="$2" +ip="$3" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/domain_func.sh +source $V_FUNC/ip_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '3' "$#" 'user domain ip' + +# Checking argument format +format_validation 'user' 'domain' 'ip' + +# Checking web system is enabled +is_system_enabled 'web' + +# Checking user +is_user_valid + +# Checking user is active +is_user_suspended + +# Checking domain exist +is_web_domain_valid + +# Checking domain is not suspened +is_domain_suspended 'web_domains' + +# Checking ip +is_ip_avalable + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Get tpl +tpl_name=$(get_web_domain_value '$TPL') +tpl_file="$V_WEBTPL/apache_$tpl_name.tpl" + +conf="$V_HOME/$user/conf/httpd.conf" +old_ip=$(get_web_domain_value '$IP') + +# Changing ip +change_domain_ip "$conf" "$domain" "$ip" "$old_ip" "$tpl_file" + +# Checking ssl +ssl=$(get_web_domain_value '$SSL') +if [ "$ssl" = 'yes' ]; then + + # Get tpl + tpl_file="$V_WEBTPL/apache_$tpl_name.stpl" + conf="$V_HOME/$user/conf/shttpd.conf" + + # Adding elog + change_domain_ip "$conf" "$domain" "$ip" "$old_ip" "$tpl_file" +fi + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Increasing ip value +increase_ip_value + +# Decreasing old ip value +decrease_ip_value "$old_ip" + +# Adding ip in config +update_web_domain_value '$IP' "$ip" + +# Adding task to the vesta pipe +restart_schedule 'web' + +# Logging +log_history "$V_EVENT" "$V_SCRIPT $user $domain $old_ip" +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_change_web_domain_sslcert b/bin/v_change_web_domain_sslcert new file mode 100755 index 00000000..b03f7333 --- /dev/null +++ b/bin/v_change_web_domain_sslcert @@ -0,0 +1,108 @@ +#!/bin/bash +# info: changing domain ssl certificate + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +domain="$2" +certificate="$3" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/domain_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '3' "$#" 'user domain certificate' + +# Checking argument format +format_validation 'user' 'domain' 'certificate' + +# Checking web system is enabled +is_system_enabled 'web' + +# Checking user +is_user_valid + +# Checking user is active +is_user_suspended + +# Checking domain exist +is_web_domain_valid + +# Checking domain is not suspened +is_domain_suspended 'web_domains' + +# Check SSL is added +is_web_domain_value_exist '$SSL' + +# Checking ssl certificate +is_web_domain_cert_valid + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Get template name +tpl_name=$(get_web_domain_value '$TPL') +tpl_file="$V_WEBTPL/apache_$tpl_name.stpl" + +# Defininig config +conf="$V_HOME/$user/conf/shttpd.conf" + +# Defining ssl key and certificate +ssl_cert="$V_HOME/$user/conf/$certificate.crt" +ssl_key="$V_HOME/$user/conf/$certificate.key" + +# Defining search phrase +search_phrase='SSLCertificateFile' + +# Defining replace string +str_repl=" SSLCertificateFile $ssl_cert" + +# Changing sslhome +httpd_change_config + +# Defining search phrase +search_phrase='SSLCertificateKeyFile' + +# Defining replace string +str_repl=" SSLCertificateKeyFile $ssl_key" + +# Changing sslhome +httpd_change_config + +# Adding certificate to user dir +if [ ! -e "$ssl_cert" ]; then + cp -f $V_USERS/$user/cert/$certificate.crt $ssl_cert + cp -f $V_USERS/$user/cert/$certificate.key $ssl_key +fi + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Get old sslhome value +old_ssl_cert=$(get_web_domain_value '$SSL_CERT') + +# Adding sslcert in config +update_web_domain_value '$SSL_CERT' "$certificate" + +# Adding task to the vesta pipe +restart_schedule 'web' + +# Logging +log_history "$V_EVENT" "$V_SCRIPT $user $domain $old_ssl_cert" +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_change_web_domain_sslhome b/bin/v_change_web_domain_sslhome new file mode 100755 index 00000000..771d4601 --- /dev/null +++ b/bin/v_change_web_domain_sslhome @@ -0,0 +1,109 @@ +#!/bin/bash +# info: changing domain ssl home + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +domain="$2" +tpl_option="$3" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/domain_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '3' "$#" 'user domain sslhome' + +# Checking argument format +format_validation 'user' 'domain' + +# Checking web system is enabled +is_system_enabled 'web' + +# Checking user +is_user_valid + +# Checking user is active +is_user_suspended + +# Checking domain exist +is_web_domain_valid + +# Checking domain is not suspened +is_domain_suspended 'web_domains' + +# Check SSL is added +is_web_domain_value_exist '$SSL' + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Get template name +tpl_name=$(get_web_domain_value '$TPL') +tpl_file="$V_WEBTPL/apache_$tpl_name.stpl" + +# Defininig config +conf="$V_HOME/$user/conf/shttpd.conf" + +# Defining search phrase +search_phrase='DocumentRoot' + +# Parsing tpl_option +case $tpl_option in + single) docroot="$V_HOME/$user/domains/$domain/public_shtml" ;; + same) docroot="$V_HOME/$user/domains/$domain/public_html" ;; + *) check_args '3' "2" 'user domain sslhome' +esac + +# Defining replace string +str_repl=" DocumentRoot $docroot" + +# Changing sslhome +httpd_change_config + +# Get old sslhome value +ssl_home=$(get_web_domain_value '$SSL_HOME') + +# Parsing old sslhome +case $ssl_home in + single) dirroot="$V_HOME/$user/domains/$domain/public_shtml" ;; + same) dirroot="$V_HOME/$user/domains/$domain/public_html" ;; + *) check_args '3' "2" 'user domain sslhome' +esac + +# Defining search phrase +search_phrase="" + +# Defining replace string +str_repl=" " + +# Changing sslhome directory tag +httpd_change_config + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Adding sslhome in config +update_web_domain_value '$SSL_HOME' "$tpl_option" + +# Adding task to the vesta pipe +restart_schedule 'web' + +# Logging +log_history "$V_EVENT" "$V_SCRIPT $user $domain $ssl_home" +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_change_web_domain_tpl b/bin/v_change_web_domain_tpl new file mode 100755 index 00000000..18362ef0 --- /dev/null +++ b/bin/v_change_web_domain_tpl @@ -0,0 +1,137 @@ +#!/bin/bash +# info: changing domain template + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +domain="$2" +template="$3" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/domain_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '3' "$#" 'user domain template' + +# Checking argument format +format_validation 'user' 'domain' 'template' + +# Checking web system is enabled +is_system_enabled 'web' + +# Checking user +is_user_valid + +# Checking user is active +is_user_suspended + +# Checking domain exist +is_web_domain_valid + +# Checking domain is not suspened +is_domain_suspended 'web_domains' + +# Checking template +templates=$(get_user_value '$TEMPLATES') +is_template_valid "web" + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Get template name +tpl_name=$(get_web_domain_value '$TPL') +tpl_file="$V_WEBTPL/apache_$tpl_name.tpl" +conf="$V_HOME/$user/conf/httpd.conf" + +# Deleting domain +httpd_del_config + +# Checking ssl +ssl=$(get_web_domain_value '$SSL') +if [ "$ssl" = 'yes' ]; then + + # Get tpl + tpl_file="$V_WEBTPL/apache_$tpl_name.stpl" + conf="$V_HOME/$user/conf/shttpd.conf" + + # Deleting domain + httpd_del_config +fi + +# Defining variables for template replace +ip=$(get_web_domain_value '$IP') +aliases=$(get_web_domain_value '$ALIAS') +port=$(get_web_port) +email="$user@$domain" +docroot="$V_HOME/$user/domains/$domain/public_html" +conf="$V_HOME/$user/conf/httpd.conf" +tpl_file="$V_WEBTPL/apache_$template.tpl" +group="$user" + +# Adding domain to the httpd.conf +httpd_add_config + +# Running template post setup file +if [ -e $V_WEBTPL/apache_$template.sh ]; then + $V_WEBTPL/apache_$template.sh $user $domain $ip $V_HOME $docroot $port +fi + +# Checking ssl +if [ "$ssl" = 'yes' ]; then + # Defining variables for ssl template replace + port=$(get_web_port_ssl) + tpl_option=$(get_web_domain_value '$SSL_HOME') + cert=$(get_web_domain_value '$SSL_CERT') + ssl_cert="$V_HOME/$user/conf/$cert.crt" + ssl_key="$V_HOME/$user/conf/$cert.key" + case $tpl_option in + single) docroot="$V_HOME/$user/domains/$domain/public_shtml" ;; + *) docroot="$V_HOME/$user/domains/$domain/public_html" ;; + esac + conf="$V_HOME/$user/conf/shttpd.conf" + tpl_file="$V_WEBTPL/apache_$template.stpl" + + # Adding domain to the httpd.conf + httpd_add_config + + # Running template post setup file + if [ -e $V_WEBTPL/apache_$template.sh ]; then + $V_WEBTPL/apache_$template.sh \ + "$user" "$domain" "$ip" "$V_HOME" "$docroot" "$port" + fi +fi + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Changing tpl in config +update_web_domain_value '$TPL' "$template" + +# Updating db keys +for keys in $(cat $V_WEBTPL/apache_$template.descr|grep -v '#'); do + key=$(echo "$keys"| cut -f 1 -d '=' |sed -e "s/^/\$/g") + value=$(echo "$keys" |cut -f 2 -d \') + update_web_domain_value "$key" "$value" +done + +# Adding task to the vesta pipe +restart_schedule 'web' + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_check_sys_user_password b/bin/v_check_sys_user_password new file mode 100755 index 0000000000000000000000000000000000000000..8affd6b9d54d0fe7fa7a537e8f2651874c3321eb GIT binary patch literal 7413 zcmd^EdvIJ;9X`9+!cqgIwL*akcQAqS=r$=Sv}M#hx_v;QX_}TYrM=zkZgN-lM7>g5{43$x5Dl;lGRIOTcGejq1(W-^@`_3b|NpaM_ zJv+bso$vg<^E>Zz&pr3P@P;)$pHGUe=R&E`Tt;0D@|%c3QGZGVPnU|84}yGs0et)+57w z#Pu-9R15!C%9#2ieq2Sxa%l3uqw!-p{}(l0qVWNZ%Np;{7)_D+H)(ve#z~D=YTT`{ zrSYJ~quSpgji1rDPvg&O%yJlxKv>@>0YVr;oF_mq^?gP`Q3p-?HjPhf+yWiMSaJ;K ziHn557)5ivS(oF}AZ)ukl}X!qHswmwWuf}1SOXi)nZ$qo zs_;`W^&gl*=w{3{{^XJo7Ih+VA!q6+;tW2pS3q;#GR%|qD)AGM2$tihQh9=Ze?TQ(9Tk=3_kdBU+l7C& zuTsaFJB*H>tRU2}1rBZF$0cS<95#J?L}IqcSx7uAFaH@~jOU#~eb`e_=vxgiuXuL*Z z_LP$)780|^oF3xI_mEJ>o^$pQpOlzA=o}CaEc_3==FTa99i(mBUmZOpgXZr0=<_H_ z6h8jKUToM)dhqx18UN6>%Hd(8uN>Wd)zI_T&|h)H_cbO}77UQ2&3nqP%%KBcaV)TX z$LNrIjTky|E%|Ef5AOqaV8osO0@Dz=;8>uRX_e!s$k2w`0Gd?!>CW!me0HkO8Df= zjI2m0e3JI3U`JtWX8DNZo)`+Bpygu{ohpS-fnI%Vb!~7xY6l(Q!)$0^3`LRmb9zAP zJ+uaDZ8o7r<}DZd%A#=Xxy|e&hyKCGdKTrQh^uCn)&`0r>=1Z5Y6EmrC*7Pbg(XFHrYyxn@so0tjHZCe zb|umVMlK%cM+H^EXykOWzl|!e*))bdQ~)Bj}tGOPV3 zM9s)NK@Wl2@3G(3$b9UG8HHS>3z=D;3nY0~eNNLeGXHc&eSW2jp5gVf>H6$c^;yXA znh&>f$_)-Yk7@AM^`7}PJ)2Llx_7B;A7ZvQ=uPI>KgKn4x4mO1a#pYGsr5a3J>Io- zb9pDS?;m{^n{;tvQF;46DwUz)LeBp1q>5Y@o_x7)(qGy#iB02%hRWb8L*GRnj9g9e zm=9eQEQPDtW2JBqy<54Y_)1`9-(=y}#j!=(ciKBfON(k*5$-SF=OGar(qXC3RNU&~ zTY<{)QdRLxrEt0^w+y`xnLR6pnw58zW-kfCAOEunh+8bmmk%j8yBospOo z$#v)FiY@s_cYKvqm$z^r$XQt&8}?*!F>8AwyJN1XOD(C3Evf6Z>ej8QORcKgY>CJX zVre0tTPmOROLxa{`aryUX{6vfAw*0O(MZ}#XIzV?3acxTjI)fn!V*@#5RJz3`L04T z*=r$3cRXe#(y-~uP1PZl$mdfLH|hwhD*_KO%gr!@mz>VfpCfCJr!U%kMb)jG9&Gt) zObedrJD~Xh;#rl!_o;T_+Z*&fMAIP0E}o;-LY}ypzzw zz=;0Of$t?I)7vP^KY;QeS3{OTS|II^PDl=N0P+yz3CMGhqmb7izlFRF@#Fa`{jF_n zU1crCE5>zJW2hmt%vx4ozoPz@`bKMUJBEE-#8v4_8dqE=#Qz67lSl6z6sOcDqAhV{-F1QvQ%`KtNBZL$<(|<7;o60goEqp>2-hijT+^>3!nJGyxeT{M z%zETn97d+=k!H$ee#$lo*DvE-!zaMwKE`sHX87HR;}t}vaSyl=1}-dPrzXxq43B$8 zBMjV2XlMHjuNQIFm3tERtT7n4&zL|S0|(FWPJnj;hI-RT*vO;Y=i%`VrUs5*H%?$< z-!Tk8j6d#?Wo(Are@!r1N=P72_5q&n0aX4SLxMKEhdn%bF9P2C`8(|4EqpK#T!_t@ zeQ$#C_YEYlT#hjx%e>E-+7OXuc+YuwJn;AY8{Uf^9uM~Wz%xEznu`AbagGJcmG?v7 z9Y>t=fPr~fk7E#1zYaVrI^>%%5_KSt@?(hM@tLv>ybjHwGQ6L8c+Z0O?ECm5{|yMs zXZ`q|GYsDQ^~*`vS*{7>E$}3mD4%8YWx^QVo5u}+Hau$10TWi>q1c2@;TUsmvmKmU zobz6PJ(mg5=SeXBKszUJpJAf9K~(#R!m4EM8wx9j+#eKX>1rQPSdEr>_EyOeRqI;W zxnrqkxWcLjxlR>kE7W>aSRQu-*PX(c+z4D>3S*KWa2+X(&PE7ey(o-MMc}$nSlz~P z{wu6jCFi-q92MMuOktihgy6iTuF^ZPIU`i*(-!BUva6E}=bOTpPzlZ}h1Cwj`J?bc zs;N*VE|cTlsN3hqiAvQ-Q3B%66^^^9uMbx4siwX@+_3Q+X6oxheZ#;kk0a&7DR48i zd?VMm6MC1YydK~Y51w6qKkTmV50?Kq;H2(PA7%v26KP=05I=U zIJ4)Y{(L<)^N;wj<};548J>m5fH@!8|GeM)k+v@f=IlBNZ07HLaiRFVwwwFkD!us4 zed?va-uu#PfKB~tQ2(1WzYIV0AJ%x8E^jMvwO$YN{1=I+wqLF71z=wF0E&73`QiXD zuaXkdUM(Kdd~=`tq{f!CV{QSP`CWtY9np4kzx2D+_v%EVKoorv{>mfy1SCV^98 zHW_#0F+yH>$1-+zGSeAJ+VZ$*M+!Yc9ZF+`RI1mM6TWk`EM`r6^BrN^AQofd(~jiv zRXW;jN1b@|UOV5L=LLDrHt(Xc0oh!fXJb2(%SC$Cr8bJ=5m_h2(=lPM-LSExd4s)i z&6>^O4!fhdWkZE8KYlT=yRx>kXZk9ChFAGIaL%Q^mtwvJc++Nmbif#TYA!!0OtTx*cL;9+ z`1y?OMAETjTz|2cHrJ!i?oppLyjFh4h`8Pq zo5R9yA>Ks!nZ=uceDX7jH_eXAw;%IG#cN_QsjN4JpJcokGvnqJH;0hf&PHw5DWvZW Ob@t#x48EzTrv3|bSH6J& literal 0 HcmV?d00001 diff --git a/bin/v_del_db_base b/bin/v_del_db_base new file mode 100755 index 00000000..5d2a9579 --- /dev/null +++ b/bin/v_del_db_base @@ -0,0 +1,76 @@ +#!/bin/bash +# info: Deleting data base + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +database="$2" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/db_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '2' "$#" 'user db_name' + +# Checking argument format +format_validation 'user' 'database' + +# Checking db system is enabled +is_system_enabled 'db' + +# Checking user +is_user_valid + +# Checking user is active +is_user_suspended + +# Checking db existance +is_db_valid + +# Checking db is active +is_db_suspended + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Get some variables we do not have now +db_user=$(get_db_value '$USER') +host=$(get_db_value '$HOST') +type=$(get_db_value '$TYPE') + +# Switching on db type +case $type in + mysql) del_db_mysql ;; + pgsql) del_db_pgsql ;; +esac + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Decreasing db value +decrease_db_value + +# Decreasing domain value +decrease_user_value "$user" '$U_DATABASES' + +# Deleting vesta db record +del_db_vesta + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_del_db_host b/bin/v_del_db_host new file mode 100755 index 00000000..77c1557e --- /dev/null +++ b/bin/v_del_db_host @@ -0,0 +1,56 @@ +#!/bin/bash +# info: adding data base server + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +type="$1" +host="$2" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/db_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '2' "$#" 'type host' + +# Checking argument format +format_validation 'host' + +# Checking db system is enabled +is_system_enabled 'db' + +# Checking db type +is_type_valid 'db' "$type" + +# Checking host existance +is_db_host_valid + +# Checking db host users +is_db_host_free + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Deleting host from conf +del_dbhost_vesta + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_del_dns_domain b/bin/v_del_dns_domain new file mode 100755 index 00000000..409dd2b9 --- /dev/null +++ b/bin/v_del_dns_domain @@ -0,0 +1,78 @@ +#!/bin/bash +# info: deliting dns domain + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +domain=$(idn -t --quiet -u "$2" ) +named_conf=/etc/named.conf + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/domain_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '2' "$#" 'user domain' + +# Checking argument format +format_validation 'user' 'domain' + +# Checking web system is enabled +is_system_enabled 'dns' + +# Checking user +is_user_valid + +# Checking user is active +is_user_suspended + +# Checking domain exist +is_dns_domain_valid + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Get template name +tpl_name=$(get_dns_domain_value '$TPL') +old_ip=$(get_dns_domain_value '$IP') + +# Deleting domain in named.conf +rm_string=$(grep -n /etc/namedb/$domain.db $named_conf|cut -d : -f 1) +if [ ! -z "$rm_string" ]; then + sed -i "$rm_string d" $named_conf +fi + +if [ -e "/etc/namedb/$domain.db" ]; then + rm -f /etc/namedb/$domain.db +fi + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Decreasing domain value +decrease_user_value "$user" '$U_DNS_DOMAINS' + +# Deleting domain +del_dns_domain + +# Adding task to the vesta pipe +restart_schedule 'dns' + +# Logging +log_history "$V_EVENT" +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_del_dns_domain_record b/bin/v_del_dns_domain_record new file mode 100755 index 00000000..f5114461 --- /dev/null +++ b/bin/v_del_dns_domain_record @@ -0,0 +1,73 @@ +#!/bin/bash +# info: deleting dns record + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +domain=$(idn -t --quiet -u "$2" ) +id="$3" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/domain_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '3' "$#" 'user domain id' + +# Checking argument format +format_validation 'user' 'domain' 'id' + +# Checking user +is_user_valid + +# Checking user is active +is_user_suspended + +# Checking domain exist +is_dns_domain_valid + +# Checking domain is not suspened +is_domain_suspended 'dns' + +# Checking record valid +is_dns_record_valid + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Deleting record +conf="$V_USERS/$user/zones/$domain" +rm_string=$(grep -n "^ID='$id'" $conf|cut -d : -f 1) +if [ ! -z "$rm_string" ]; then + sed -i "$rm_string d" $conf +fi + +# Sorting records +sort_dns_records + +# Updating zone +update_domain_zone + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Adding task to the vesta pipe +restart_schedule 'dns' + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_del_ssl_certificate b/bin/v_del_ssl_certificate new file mode 100755 index 00000000..419cdeaf --- /dev/null +++ b/bin/v_del_ssl_certificate @@ -0,0 +1,57 @@ +#!/bin/bash +# info: adding ssl certificate + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +cert="$2" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/cert_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '2' "$#" 'user certificate' + +# Checking argument format +format_validation 'user' 'certificate' + +# Checking user +is_user_valid + +# Checking user is active +is_user_suspended + +# Checking ssl ceritificate +is_cert_valid "$V_USERS/$user/cert" + +# Checking certificate +is_cert_used + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Deleting certificate +rm -f $V_USERS/$user/cert/$cert.* + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Logging +log_history "$V_EVENT" +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_del_sys_cron b/bin/v_del_sys_cron new file mode 100755 index 00000000..e4654a0c --- /dev/null +++ b/bin/v_del_sys_cron @@ -0,0 +1,62 @@ +#!/bin/bash +# info: deleting sys cron + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +job="$2" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/cron_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '2' "$#" 'user job' + +# Checking argument format +format_validation 'user' 'job' + +# Checking user +is_user_valid + +# Checking user is active +is_user_suspended + +# Checking cron job +is_job_valid + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Deleting job +del_cron_job + +# Sorting jobs by id +sort_cron_jobs + +# Sync system cron with user +sync_cron_jobs + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Adding task to the vesta pipe +restart_schedule 'cron' + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_del_sys_ip b/bin/v_del_sys_ip new file mode 100755 index 00000000..f1e97e6d --- /dev/null +++ b/bin/v_del_sys_ip @@ -0,0 +1,90 @@ +#!/bin/bash +# info: deleting system ip + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +ip="$1" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/ip_func.sh +source $V_FUNC/domain_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '1' "$#" 'ip' + +# Checking argument format +format_validation 'ip' + +# Checking system ip +is_sys_ip_valid "$ip" + +# Checking webdomains on ip +is_ip_key_empty '$U_WEB_DOMAINS' + +# Checking users on ip +is_ip_key_empty '$U_SYS_USERS' + +# We do not check ownership if +# no one actualy use this ip + +# Checking interface +interface=$(get_current_interface) + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Defining config paths +conf='/etc/httpd/conf.d/vesta.conf' +nconf='/etc/nginx/conf.d/vesta_ip.conf' +iconf='/etc/sysconfig/network-scripts/ifcfg' +rconf='/etc/httpd/conf.d/rpaf.conf' + +# Get ip owner +user="$(get_sys_ip_value '$OWNER')" + +# Deleting interface +ifconfig "$interface" down + +# Deleting startup script +rm -f $iconf-$interface + +# Deleting vesta ip +rm -f $V_IPS/$ip + +# Importing main config +source $V_CONF/vesta.conf + +# Deleting namehosting support +namehost_ip_disable + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Updating user conf +if [ ! -z "$user" ]; then + decrease_user_value "$user" '$IP_OWNED' +fi + +# Adding task to the vesta pipe +if [ "$web_restart" = 'yes' ]; then + restart_schedule 'web' +fi + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_del_sys_user_ip b/bin/v_del_sys_user_ip new file mode 100755 index 00000000..d8ddb749 --- /dev/null +++ b/bin/v_del_sys_user_ip @@ -0,0 +1,65 @@ +#!/bin/bash +# info: deleting user ip + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +ip="$2" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/ip_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '2' "$#" 'user ip' + +# Checking argument format +format_validation 'user' 'ip' + +# Checking user +is_user_valid + +# Checking user is active +is_user_suspended + +# Checking user ip +is_sys_ip_valid + +# Checking ownership +is_sys_ip_owner + +# Checking webdomains on ip +is_ip_key_empty '$U_WEB_DOMAINS' + +# Checking users on ip +is_ip_key_empty '$U_SYS_USERS' + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Deleting owner +update_sys_ip_value '$OWNER' '' + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Updating user conf +decrease_user_value '$IP_OWNED' + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_del_sys_user_reports b/bin/v_del_sys_user_reports new file mode 100755 index 00000000..0c35e1c3 --- /dev/null +++ b/bin/v_del_sys_user_reports @@ -0,0 +1,59 @@ +#!/bin/bash +# info: adding user reports + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/cron_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '1' "$#" 'user' + +# Checking argument format +format_validation 'user' + +# Checking user +is_user_valid + +# Checking user is active +is_user_suspended + +# Checking reports existance +is_user_value_exist '$REPORTS' + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Changing user report value +update_user_value "$user" '$REPORTS' 'no' + +# Sync system cron with user +sync_cron_jobs + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Adding task to the vesta pipe +restart_schedule 'cron' + +# Logging +log_history "$V_EVENT" "v_add_sys_user_reports $user" +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_del_web_domain b/bin/v_del_web_domain new file mode 100755 index 00000000..80173b46 --- /dev/null +++ b/bin/v_del_web_domain @@ -0,0 +1,127 @@ +#!/bin/bash +# info: deliting web domain + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +domain=$(idn -t --quiet -u "$2" ) +domain_idn=$(idn -t --quiet -a "$domain") + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/domain_func.sh +source $V_FUNC/ip_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '2' "$#" 'user domain' + +# Checking argument format +format_validation 'user' 'domain' + +# Checking web system is enabled +is_system_enabled 'web' + +# Checking user +is_user_valid + +# Checking user is active +is_user_suspended + +# Checking domain exist +is_web_domain_valid + +# Checking domain is not suspened +is_domain_suspended 'web_domains' + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Get template name +tpl_name=$(get_web_domain_value '$TPL') +old_ip=$(get_web_domain_value '$IP') +tpl_file="$V_WEBTPL/apache_$tpl_name.tpl" +conf="$V_HOME/$user/conf/httpd.conf" + +# Deleting domain +httpd_del_config + +# Checking ssl +ssl=$(get_web_domain_value '$SSL') +if [ "$ssl" = 'yes' ]; then + + # Get tpl + tpl_file="$V_WEBTPL/apache_$tpl_name.stpl" + conf="$V_HOME/$user/conf/shttpd.conf" + + # Deleting domain + httpd_del_config +fi + +# Checking stats +stats_type=$(get_web_domain_value '$STATS') +if [ ! -z "$stats_type" ] && [ "$stats_type" != 'no' ]; then + # Parsing pipe line + line=$(grep -n "$type.$domain.conf" $V_QUEUE/stats.pipe | \ + cut -f 1 -d : | head -n 1 ) + + # Deleting pipe command + if [ ! -z "$line" ]; then + sed -i "$line d" $V_QUEUE/stats.pipe + fi + + # Deleteing config + rm -f $V_HOME/$user/conf/$type.$domain.conf +fi + +# Deleting directory +rm -rf $V_HOME/$user/domains/$domain + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Deleting domain +del_web_domain + +# Checking last ssl domain +ssl_dom=$(grep "SSL='yes'" $V_USERS/$user/web_domains.conf | wc -l) +if [ "$ssl_dom" -eq '0' ]; then + sed -i "s/ Include /#Include /" $V_HOME/$user/conf/httpd.conf +fi + +# Checking last domain +domains=$(wc -l $V_USERS/$user/web_domains.conf|cut -f 1 -d ' ') +if [ "$domains" -eq '0' ]; then + conf='/etc/httpd/conf.d/vesta.conf' + line=$(grep -n "$V_HOME/$user/conf/httpd.conf" $conf | cut -f 1 -d : ) + if [ ! -z "$line" ]; then + sed -i "$line d" $conf + fi +fi + +# Decreasing ip value +decrease_ip_value "$old_ip" + +# Decreasing domain value +decrease_user_value "$user" '$U_WEB_DOMAINS' + +# Adding task to the vesta pipe +restart_schedule 'web' + +# Logging +log_history "$V_EVENT" +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_del_web_domain_alias b/bin/v_del_web_domain_alias new file mode 100755 index 00000000..fe364e68 --- /dev/null +++ b/bin/v_del_web_domain_alias @@ -0,0 +1,117 @@ +#!/bin/bash +# info: deliting web domain alias + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +domain=$(idn -t --quiet -u "$2" ) +dom_alias=$(idn -t --quiet -u "$3" ) +dom_alias_idn=$(idn -t --quiet -a "$dom_alias" ) + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/domain_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '3' "$#" 'user domain dom_alias' + +# Checking argument format +format_validation 'user' 'domain' 'dom_alias' + +# Checking web system is enabled +is_system_enabled 'web' + +# Checking user +is_user_valid + +# Checking user is active +is_user_suspended + +# Checking domain exist +is_web_domain_valid + +# Checking domain is not suspened +is_domain_suspended 'web_domains' + +# Checking alias is added +cur_alias=$(get_web_domain_value '$ALIAS') +check_alias=$(echo $cur_alias|grep -w "$dom_alias") +if [ -z "$check_alias" ]; then + echo "Error: alias not exist" + log_event 'debug' "$E_DOM_NOTEXIST $V_EVENT" + exit $E_DOM_NOTEXIST +fi + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Defining new alias string +new_alias=$(echo "$cur_alias" |\ + sed -e "s/,/\n/g"|\ + sed -e "s/^$dom_alias$//g"|\ + sed -e "/^$/d"|\ + sed -e ':a;N;$!ba;s/\n/,/g') + +new_alias_idn=$(idn -t --quiet -a "$cur_alias" |\ + sed -e "s/,/\n/g"|\ + sed -e "s/^$dom_alias$//g"|\ + sed -e "/^$/d"|\ + sed -e ':a;N;$!ba;s/\n/,/g') + +# Get template name +tpl_name=$(get_web_domain_value '$TPL') +tpl_file="$V_WEBTPL/apache_$tpl_name.tpl" + +# Defining config +conf="$V_HOME/$user/conf/httpd.conf" + +# Defining search phrase +search_phrase='ServerAlias' + +# Defining replace string +str_repl=" ServerAlias ${new_alias_idn//,/ }" + +# Deleting alias +httpd_change_config + +# Checking ssl domain +ssl=$(get_web_domain_value '$SSL') +if [ "$ssl" = 'yes' ]; then + + # Defining ssl template + tpl_file="$V_WEBTPL/apache_$tpl_name.stpl" + + # Defining ssl config + conf="$V_HOME/$user/conf/shttpd.conf" + + # Deleting ssl alias + httpd_change_config +fi + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Deleting alias +update_web_domain_value '$ALIAS' "$new_alias" + +# Adding task to the vesta pipe +restart_schedule 'web' + +# Logging +log_history "$V_EVENT" "v_add_web_domain_alias $user $domain $dom_alias" +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_del_web_domain_cgi b/bin/v_del_web_domain_cgi new file mode 100755 index 00000000..aaf7d26a --- /dev/null +++ b/bin/v_del_web_domain_cgi @@ -0,0 +1,122 @@ +#!/bin/bash +# info: deliting cgi for domain + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +domain=$(idn -t --quiet -u "$2" ) +domain_idn=$(idn -t --quiet -a "$domain") + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/domain_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '2' "$#" 'user domain' + +# Checking argument format +format_validation 'user' 'domain' + +# Checking web system is enabled +is_system_enabled 'web' + +# Checking user +is_user_valid + +# Checking user is active +is_user_suspended + +# Checking domain exist +is_web_domain_valid + +# Checking domain is not suspened +is_domain_suspended 'web_domains' + +# Checking cgi is added +is_web_domain_value_exist '$CGI' + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Get template name +tpl_name=$(get_web_domain_value '$TPL') +tpl_file="$V_WEBTPL/apache_$tpl_name.tpl" + +# Defining config +conf="$V_HOME/$user/conf/httpd.conf" + +# Defining search phrase +search_phrase='ScriptAlias ' + +# Defining replace string +str_repl=" #ScriptAlias /cgi-bin/ $V_HOME/$user/domains/$domain/cgi-bin" + +# Deleting cgi-bin support +httpd_change_config + +# Defining search phrase +search_phrase='Options ' + +# Defining replace string +str_repl=' Options +Includes -Indexes -ExecCGI' + +# Deleting execscgi support +httpd_change_config + +# Checking ssl +ssl=$(get_web_domain_value '$SSL') +if [ "$ssl" = 'yes' ]; then + + # Get ssl template name + tpl_file="$V_WEBTPL/apache_$tpl_name.stpl" + + # Defining ssl config + conf="$V_HOME/$user/conf/shttpd.conf" + + # Defining search phrase + search_phrase='ScriptAlias ' + + # Defining replace string + str_repl=" #ScriptAlias /cgi-bin/ $V_HOME/$user/domains/$domain/cgi-bin" + + # Deleting cgi-bin support + httpd_change_config + + # Defining search phrase + search_phrase='Options ' + + # Defining replace string + str_repl=' Options +Includes -Indexes -ExecCGI' + + # Deleting execscgi support + httpd_change_config + +fi + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Deleting cgi in config +update_web_domain_value '$CGI' 'no' + +# Adding task to the vesta pipe +restart_schedule 'web' + +# Logging +log_history "$V_EVENT" "v_add_web_domain_cgi $user $domain" +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_del_web_domain_elog b/bin/v_del_web_domain_elog new file mode 100755 index 00000000..555de34c --- /dev/null +++ b/bin/v_del_web_domain_elog @@ -0,0 +1,98 @@ +#!/bin/bash +# info: deleting error log for domain + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +domain=$(idn -t --quiet -u "$2" ) +domain_idn=$(idn -t --quiet -a "$domain") + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/domain_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '2' "$#" 'user domain' + +# Checking argument format +format_validation 'user' 'domain' + +# Checking web system is enabled +is_system_enabled 'web' + +# Checking user +is_user_valid "$user" + +# Checking user is active +is_user_suspended + +# Checking domain exist +is_web_domain_valid + +# Checking domain is not suspened +is_domain_suspended 'web_domains' + +# Check errorlog is added +is_web_domain_value_exist '$ELOG' + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Get template name +tpl_name=$(get_web_domain_value '$TPL') +tpl_file="$V_WEBTPL/apache_$tpl_name.tpl" + +# Defining config +conf="$V_HOME/$user/conf/httpd.conf" + +# Defining search phrase +search_phrase='ErrorLog ' + +# Defining replace string +str_repl=" #ErrorLog /var/log/httpd/domains/$domain.error.log" + +# Deleting errolog support +httpd_change_config + +# Checking ssl +ssl=$(get_web_domain_value '$SSL') +if [ "$ssl" = 'yes' ]; then + + # Get ssl template name + tpl_file="$V_WEBTPL/apache_$tpl_name.stpl" + + # Defining ssl config + conf="$V_HOME/$user/conf/shttpd.conf" + + # Deleting errolog support + httpd_change_config + +fi + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Deleting elog in config +update_web_domain_value '$ELOG' 'no' + +# Adding task to the vesta pipe +restart_schedule 'web' + +# Logging +log_history "$V_EVENT" "v_add_web_domain_elog $user $domain" +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_del_web_domain_ssl b/bin/v_del_web_domain_ssl new file mode 100755 index 00000000..2638708e --- /dev/null +++ b/bin/v_del_web_domain_ssl @@ -0,0 +1,93 @@ +#!/bin/bash +# info: deliting web domain ssl + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +domain=$(idn -t --quiet -u "$2" ) +domain_idn=$(idn -t --quiet -a "$domain") + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/domain_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '2' "$#" 'user domain' + +# Checking argument format +format_validation 'user' 'domain' + +# Checking web system is enabled +is_system_enabled 'web' + +# Checking user +is_user_valid + +# Checking user is active +is_user_suspended + +# Checking domain exist +is_web_domain_valid + +# Checking domain is not suspened +is_domain_suspended 'web_domains' + +# Checking ssl is added +is_web_domain_value_exist '$SSL' + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Get template name +tpl_name=$(get_web_domain_value '$TPL') +tpl_file="$V_WEBTPL/apache_$tpl_name.stpl" +conf="$V_HOME/$user/conf/shttpd.conf" + +# Deleting domain +httpd_del_config + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Get old values +cert=$(get_web_domain_value '$SSL_CERT' ) +tpl_option=$(get_web_domain_value '$SSL_HOME' ) + +# Deleting ssl in config +update_web_domain_value '$SSL' 'no' +update_web_domain_value '$SSL_HOME' '' +update_web_domain_value '$SSL_CERT' '' + +# Checking last ssl domain +ssl_dom=$(grep "SSL='yes'" $V_USERS/$user/web_domains.conf | wc -l) +main_conf='/etc/httpd/conf.d/vesta.conf' +conf="$V_HOME/$user/conf/shttpd.conf" +if [ "$ssl_dom" -eq '0' ]; then + sed -i "/Include ${conf////\/}/d" $main_conf + rm -f $conf +fi + +# Decreasing domain value +decrease_user_value "$user" '$U_WEB_SSL' + +# Adding task to the vesta pipe +restart_schedule 'web' + +# Logging +log_history "$V_EVENT" "v_add_web_domain_ssl $user $domain $cert $tpl_option" +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_del_web_domain_stat b/bin/v_del_web_domain_stat new file mode 100755 index 00000000..78f0fe18 --- /dev/null +++ b/bin/v_del_web_domain_stat @@ -0,0 +1,84 @@ +#!/bin/bash +# info: adding web domain + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +domain=$(idn -t --quiet -u "$2" ) + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/domain_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '2' "$#" 'user domain' + +# Checking argument format +format_validation 'user' 'domain' + +# Checking web system is enabled +is_system_enabled 'web' + +# Checking user +is_user_valid + +# Checking user is active +is_user_suspended + +# Checking domain exist +is_web_domain_valid + +# Checking domain is not suspened +is_domain_suspended 'web_domains' + +# Checking stats enabled +is_web_domain_value_exist '$STATS' + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Defining statistic type +type=$(get_web_domain_value '$STATS') + +# Defining statistic dir +stat_dir="$V_HOME/$user/domains/$domain/stats" + +# Deleting dir content +rm -rf $stat_dir/* + +# Deleting config +rm -f $V_HOME/$user/conf/$type.$domain.conf + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Parsing pipe line +line=$(grep -n "$type.$domain.conf" $V_QUEUE/stats.pipe | \ + cut -f 1 -d : | head -n 1 ) + +# Deleting pipe command +if [ ! -z "$line" ]; then + sed -i "$line d" $V_QUEUE/stats.pipe +fi + +# Deleting stats +update_web_domain_value '$STATS' '' + +# Logging +log_history "$V_EVENT" "v_add_web_domain_stat $user $doman $type" +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_del_web_domain_stat_auth b/bin/v_del_web_domain_stat_auth new file mode 100755 index 00000000..ccc7d827 --- /dev/null +++ b/bin/v_del_web_domain_stat_auth @@ -0,0 +1,105 @@ +#!/bin/bash +# info: adding web domain + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +domain=$(idn -t --quiet -u "$2" ) +auth_user="$3" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/domain_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '2' "$#" 'user domain [auth_user]' + +# Checking argument format +format_validation 'user' 'domain' + +# Checking web system is enabled +is_system_enabled 'web' + +# Checking user +is_user_valid + +# Checking user is active +is_user_suspended + +# Checking domain exist +is_web_domain_valid + +# Checking domain is not suspened +is_domain_suspended 'web_domains' + +# Checking stats auth enabled +is_web_domain_value_exist '$STATS_AUTH' + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Definining statistic dir +stat_dir="$V_HOME/$user/domains/$domain/stats" + +# Checking auth_user +if [ ! -z "$auth_user" ]; then + + # Checking argument format + format_validation 'auth_user' + + htpasswd -D $stat_dir/.htpasswd "$auth_user" >/dev/null 2>&1 +fi + +# Checking htpasswd current users +lines=$(wc -l $stat_dir/.htpasswd |cut -f 1 -d ' ') +if [ -z "$auth_user" ] || [ "$lines" -eq '0' ]; then + rm -f $stat_dir/.htpasswd + rm -f $stat_dir/.htaccess +fi + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Checking auth_user +if [ ! -z "$auth_user" ]; then + # Get current value + curr_val=$(get_web_domain_value '$STATS_AUTH') + + # Deleteting auth_user + new_val=$(echo "$curr_val" |\ + sed -e "s/,/\n/g"|\ + sed -e "s/^$auth_user$//g"|\ + sed -e "/^$/d"|\ + sed -e ':a;N;$!ba;s/\n/,/g') + + # Checking it was last user + if [ -z "$new_val" ]; then + new_val='' + fi + +else + # User empty, deleting all + new_val='' +fi + +# Deleting stats auth_user +update_web_domain_value '$STATS_AUTH' "$new_val" + +# Logging +log_history "$V_EVENT" +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_get_dns_domain_value b/bin/v_get_dns_domain_value new file mode 100755 index 00000000..7c1c0cac --- /dev/null +++ b/bin/v_get_dns_domain_value @@ -0,0 +1,57 @@ +#!/bin/bash +# info: Getting dns domain value + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +domain="$2" +key=$(echo "$3"| tr '[:lower:]' '[:upper:]'|sed -e "s/^/$/") + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/domain_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking args +check_args '3' "$#" 'user domain key' + +# Checking argument format +format_validation 'user' 'domain' + +# Checking user +is_user_valid + +# Checking domain exist +is_dns_domain_valid + +# Checking domain is not suspened +is_domain_suspended 'dns' + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Checking key +value=$(get_dns_domain_value "$key") + +# Printing value +echo "$value" + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_get_sys_user_value b/bin/v_get_sys_user_value new file mode 100755 index 00000000..d583545f --- /dev/null +++ b/bin/v_get_sys_user_value @@ -0,0 +1,52 @@ +#!/bin/bash +# info: Getting system user value + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +key=$(echo "$2"| tr '[:lower:]' '[:upper:]'|sed -e "s/^/$/") + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking args +check_args '2' "$#" 'user key' + +# Checking argument format +format_validation 'user' + +# Checking user +is_user_valid + +# Checking domain is not suspened +is_user_suspended + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Checking key +value=$(get_user_value "$key") + +# Printing value +echo "$value" + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_get_web_domain_value b/bin/v_get_web_domain_value new file mode 100755 index 00000000..03216638 --- /dev/null +++ b/bin/v_get_web_domain_value @@ -0,0 +1,60 @@ +#!/bin/bash +# info: Getting web domain value + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +domain="$2" +key=$(echo "$3"| tr '[:lower:]' '[:upper:]'|sed -e "s/^/$/") + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/domain_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking args +check_args '3' "$#" 'user domain key' + +# Checking argument format +format_validation 'user' 'domain' + +# Checking user +is_user_valid + +# Checking user is active +is_user_suspended + +# Checking domain exist +is_web_domain_valid + +# Checking domain is not suspened +is_domain_suspended 'web_domains' + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Checking key +value=$(get_web_domain_value "$key") + +# Printing value +echo "$value" + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_list_db_base b/bin/v_list_db_base new file mode 100755 index 00000000..7bc1c6c3 --- /dev/null +++ b/bin/v_list_db_base @@ -0,0 +1,61 @@ +#!/bin/bash +# info: listing data base + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +database="$2" +format="${3-shell}" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/db_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking args +check_args '2' "$#" 'user db_name [format]' + +# Checking argument format +format_validation 'user' 'database' + +# Checking user +is_user_valid + +# Checking database exist +is_db_valid + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Defining config +conf="$V_USERS/$user/db.conf" + +# Defining fileds to select +fields='$DB $USER $HOST $TYPE $U_DISK $SUSPEND $DATE' + +# Listing database +case $format in + json) db_json_single_list ;; + shell) db_shell_single_list | column -t ;; + *) check_args '2' "0" 'user database [format]' +esac + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_list_db_bases b/bin/v_list_db_bases new file mode 100755 index 00000000..24e84c3d --- /dev/null +++ b/bin/v_list_db_bases @@ -0,0 +1,58 @@ +#!/bin/bash +# info: listing data bases + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +format="${2-shell}" +limit="${3-1000}" +offset="${4-1}" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking args +check_args '1' "$#" 'user [format] [limit] [offset]' + +# Checking argument format +format_validation 'user' 'limit' 'offset' + +# Checking user +is_user_valid + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Defining config +conf="$V_USERS/$user/db.conf" + +# Defining fileds to select +fields='$DB $USER $HOST $TYPE $U_DISK $SUSPEND $DATE' + +# Listing databases +case $format in + json) v_json_list ;; + shell) v_shell_list| column -t ;; + *) check_args '1' "0" 'user [format] [limit] [offset]' +esac + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_list_db_host b/bin/v_list_db_host new file mode 100755 index 00000000..74f83741 --- /dev/null +++ b/bin/v_list_db_host @@ -0,0 +1,61 @@ +#!/bin/bash +# info: listing data base servers + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +type="$1" +host="$2" +format="${3-shell}" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/db_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking args +check_args '2' "$#" 'type host [format]' + +# Checking argument format +format_validation 'host' + +# Checking db type +is_type_valid 'db' "$type" + +# Checking db host +is_db_host_valid + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Defining config type +conf="$V_DB/$type.conf" + +# Defining fileds to select +fields='$HOST $PORT $MAX_USERS $MAX_DB $U_SYS_USERS $U_DB_BASES $ACTIVE $DATE' + +# Listing database +case $format in + json) dbhost_json_single_list ;; + shell) dbhost_shell_single_list | column -t;; + *) check_args '2' "0" 'type host [format]' +esac + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_list_db_hosts b/bin/v_list_db_hosts new file mode 100755 index 00000000..b8253e32 --- /dev/null +++ b/bin/v_list_db_hosts @@ -0,0 +1,60 @@ +#!/bin/bash +# info: listing data base servers + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +type="$1" +format="${2-shell}" +limit="${3-1000}" +offset="${4-1}" + + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking args +check_args '1' "$#" 'type [format] [limit] [offset]' + +# Checking argument format +format_validation 'limit' 'offset' + +# Checking db type +is_type_valid 'db' "$type" + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Defining config type +conf="$V_DB/$type.conf" + +# Defining fileds to select +fields='$HOST $PORT $MAX_USERS $MAX_DB $U_SYS_USERS $U_DB_BASES $ACTIVE $DATE' + +# Listing database +case $format in + json) v_json_list ;; + shell) fields='$HOST $PORT $MAX_USERS $MAX_DB $U_DB_BASES $ACTIVE $DATE'; + v_shell_list | column -t ;; + *) check_args '2' "0" 'type [format] [limit] [offset]' +esac + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_list_dns_domain b/bin/v_list_dns_domain new file mode 100755 index 00000000..648b167c --- /dev/null +++ b/bin/v_list_dns_domain @@ -0,0 +1,64 @@ +#!/bin/bash +# info: listing dns domain + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +domain="$2" +format="${3-shell}" +limit="${4-1000}" +offset="${5-1}" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/domain_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking args +check_args '2' "$#" 'user domain [format]' + +# Checking argument format +format_validation 'user' 'domain' 'limit' 'offset' + +# Checking user +is_user_valid + +# Checking domain exist +is_dns_domain_valid + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Defining config +conf="$V_USERS/$user/zones/$domain" + +# Defining fileds to select +fields='$ID $RECORD $TYPE $VALUE $SUSPEND $DATE' + +# Listing domains +case $format in + json) dns_json_list ;; + shell) fields='$ID $RECORD $TYPE $VALUE'; + dns_shell_list | column -t ;; + *) check_args '2' "0" 'user domain [format]' +esac + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_list_dns_domains b/bin/v_list_dns_domains new file mode 100755 index 00000000..ae2d8d3b --- /dev/null +++ b/bin/v_list_dns_domains @@ -0,0 +1,60 @@ +#!/bin/bash +# info: listing dns domains + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +format="${2-shell}" +limit="${3-1000}" +offset="${4-1}" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking args +check_args '1' "$#" 'user [format] [limit] [offset]' + +# Checking argument format +format_validation 'user' 'limit' 'offset' + +# Checking user +is_user_valid + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Defining config +conf="$V_USERS/$user/dns.conf" + +# Defining fileds to select +fields='$DOMAIN $IP $TPL $TTL $EXP $SOA $SUSPEND $DATE' + + +# Listing domains +case $format in + json) v_json_list ;; + shell) fields='$DOMAIN $IP $TPL $TTL $EXP $SUSPEND'; + v_shell_list| column -t ;; + *) check_args '1' "0" 'user [format] [limit] [offset]' +esac + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_list_dns_templates b/bin/v_list_dns_templates new file mode 100755 index 00000000..bc5d7e41 --- /dev/null +++ b/bin/v_list_dns_templates @@ -0,0 +1,44 @@ +#!/bin/bash +# info: listing dns templates + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +format="${1-shell}" +limit="${2-1000}" +offset="${3-1}" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/domain_func.sh + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking argument format +format_validation 'limit' 'offset' + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Listing domains +case $format in + json) dnstpl_json_list ;; + shell) dnstpl_shell_list ;; + *) check_args '1' "0" '[format] [limit] [offset]' +esac + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_list_ssl_certificates b/bin/v_list_ssl_certificates new file mode 100755 index 00000000..f03fe5c2 --- /dev/null +++ b/bin/v_list_ssl_certificates @@ -0,0 +1,52 @@ +#!/bin/bash +# info: listing ssl certificates + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +format="${2-shell}" +limit="${3-1000}" +offset="${4-1}" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/cert_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking args +check_args '1' "$#" 'user [format] [limit] [offset]' + +# Checking argument format +format_validation 'user' 'limit' 'offset' + +# Checking user +is_user_valid + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Listing domains +case $format in + json) cert_json_list ;; + shell) cert_shell_list | column -t ;; + *) check_args '1' "0" 'user [format] [limit] [offset]' +esac + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_list_sys_cron b/bin/v_list_sys_cron new file mode 100755 index 00000000..ec1f69a5 --- /dev/null +++ b/bin/v_list_sys_cron @@ -0,0 +1,61 @@ +#!/bin/bash +# info: listing user cron + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +format="${2-shell}" +limit="${3-1000}" +offset="${4-1}" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/cron_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking args +check_args '1' "$#" 'user [format] [limit] [offset]' + +# Checking argument format +format_validation 'user' 'limit' 'offset' + +# Checking user +is_user_valid + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Defining config +conf="$V_USERS/$user/crontab.conf" + +# Defining fileds to select +fields='$JOB $MIN $HOUR $DAY $MONTH $WDAY $CMD $SUSPEND $DATE' + + +# Listing domains +case $format in + json) crn_json_list ;; + shell) fields='$JOB~$SUSPEND~$MIN~$HOUR~$DAY~$MONTH~$WDAY~$CMD'; + crn_shell_list |column -t -s '~';; + *) check_args '1' '0' 'user [format] [limit] [offset]' ;; +esac + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_list_sys_interfaces b/bin/v_list_sys_interfaces new file mode 100755 index 00000000..55dada74 --- /dev/null +++ b/bin/v_list_sys_interfaces @@ -0,0 +1,46 @@ +#!/bin/bash +# info: listing system interfaces + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +format="${1-shell}" +limit="${2-1000}" +offset="${3-1}" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/ip_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking argument format +format_validation 'limit' 'offset' + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Listing domains +case $format in + json) ipint_json_list ;; + shell) ipint_shell_list ;; + *) check_args '1' '0' '[format] [limit] [offset]' +esac + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_list_sys_ip b/bin/v_list_sys_ip new file mode 100755 index 00000000..227a5793 --- /dev/null +++ b/bin/v_list_sys_ip @@ -0,0 +1,54 @@ +#!/bin/bash +# info: listing system ip + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +ip="$1" +format="${2-shell}" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/ip_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking args +check_args '1' "$#" 'ip [format]' + +# Checking argument format +format_validation 'ip' + +# Checking ip +is_sys_ip_valid + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Defining fileds to select +fields='$IP $OWNER $STATUS $NAME $U_SYS_USERS $U_WEB_DOMAINS + $INTERFACE $NETMASK $DATE' + +# Listing ip +case $format in + json) ip_json_single_list ;; + shell) ip_shell_single_list | column -t ;; + *) check_args '1' "0" 'ip [format]' +esac + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_list_sys_ips b/bin/v_list_sys_ips new file mode 100755 index 00000000..f5a1d1cb --- /dev/null +++ b/bin/v_list_sys_ips @@ -0,0 +1,51 @@ +#!/bin/bash +# info: listing system users + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +format="${1-shell}" +limit="${2-1000}" +offset="${3-1}" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/ip_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking argument format +format_validation 'limit' 'offset' + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Defining fileds to select +fields='$IP $OWNER $STATUS $NAME $U_SYS_USERS $U_WEB_DOMAINS + $INTERFACE $NETMASK $DATE' + +# Listing domains +case $format in + json) ip_json_list ;; + shell) fields='$IP $NETMASK $OWNER $STATUS $U_WEB_DOMAINS'; + ip_shell_list | column -t ;; + *) check_args '1' '0' '[format] [limit] [offset]' +esac + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_list_sys_user b/bin/v_list_sys_user new file mode 100755 index 00000000..7f92d342 --- /dev/null +++ b/bin/v_list_sys_user @@ -0,0 +1,60 @@ +#!/bin/bash +# info: listing system user + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +format="${2-shell}" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking args +check_args '1' "$#" 'user [format]' + +# Checking argument format +format_validation 'user' + +# Checking user +is_user_valid + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Defining config +conf="$V_USERS/$user/user.conf" + +# Defining fileds to select +fields='$USER $PACKAGE $WEB_DOMAINS $WEB_SSL $WEB_ALIASES $DATABASES + $MAIL_DOMAINS $MAIL_BOXES $MAIL_FORWARDERS $DNS_DOMAINS $DISK_QUOTA + $BANDWIDTH $NS1 $NS2 $SHELL $BACKUPS $TEMPLATES $MAX_CHILDS $SUSPENDED + $OWNER $ROLE $IP_OWNED $U_CHILDS $U_DISK $U_BANDWIDTH $U_WEB_DOMAINS + $U_WEB_SSL $U_DNS_DOMAINS $U_DATABASES $U_MAIL_DOMAINS $CONTACT $DATE' + +# Listing user +case $format in + json) usr_json_single_list ;; + shell) usr_shell_single_list | column -t ;; + *) check_args '1' "0" 'user [format]' +esac + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_list_sys_user_ips b/bin/v_list_sys_user_ips new file mode 100755 index 00000000..bad744f3 --- /dev/null +++ b/bin/v_list_sys_user_ips @@ -0,0 +1,58 @@ +#!/bin/bash +# info: listing user ips + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +format="${2-shell}" +limit="${3-1000}" +offset="${4-1}" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/ip_func.sh + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '1' "$#" 'user [format] [limit] [offset]' + +# Checking argument format +format_validation 'user' 'limit' 'offset' + +# Checking user +is_user_valid + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Get user owner +owner=$(get_user_value '$OWNER') + +# Defining fileds to select +fields='$IP $OWNER $STATUS $NAME' + +# Listing domains +case $format in + json) ip_user_json_list ;; + shell) ip_user_shell_list | column -t ;; + *) check_args '1' '0' 'user [format] [limit] [offset]' +esac + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_list_sys_user_ns b/bin/v_list_sys_user_ns new file mode 100755 index 00000000..20619855 --- /dev/null +++ b/bin/v_list_sys_user_ns @@ -0,0 +1,50 @@ +#!/bin/bash +# info: listing user nameservers + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +format="${2-shell}" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking args +check_args '1' "$#" 'user [format]' + +# Checking argument format +format_validation 'user' + +# Checking user +is_user_valid + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Listing nameservers +case $format in + json) usrns_json_list ;; + shell) usrns_shell_list ;; + *) check_args '1' '0' 'user [format]' +esac + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_list_sys_user_packages b/bin/v_list_sys_user_packages new file mode 100755 index 00000000..ce532ea8 --- /dev/null +++ b/bin/v_list_sys_user_packages @@ -0,0 +1,50 @@ +#!/bin/bash +# info: listing sys user packages + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +format="${1-shell}" +limit="${2-1000}" +offset="${3-1}" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking argument format +format_validation 'limit' 'offset' + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Defining fields +fields='$PACKAGE $WEB_DOMAINS $WEB_SSL $WEB_ALIASES $DATABASES $MAIL_DOMAINS + $MAIL_BOXES $MAIL_FORWARDERS $DNS_DOMAINS $DISK_QUOTA $BANDWIDTH $NS1 $NS2 + $SHELL $BACKUPS $TEMPLATES $MAX_CHILDS' + +# Listing domains +case $format in + json) pkg_json_list ;; + shell) pkg_shell_list | column -t ;; + *) check_args '1' "0" '[format] [limit] [offset]' +esac + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_list_sys_users b/bin/v_list_sys_users new file mode 100755 index 00000000..6f6d18e1 --- /dev/null +++ b/bin/v_list_sys_users @@ -0,0 +1,52 @@ +#!/bin/bash +# info: listing system users + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +format="${1-shell}" +limit="${2-1000}" +offset="${3-1}" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking argument format +format_validation 'limit' 'offset' + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Defining fileds to select +fields='$USER $PACKAGE $WEB_DOMAINS $WEB_SSL $WEB_ALIASES $DATABASES + $MAIL_DOMAINS $MAIL_BOXES $MAIL_FORWARDERS $DNS_DOMAINS $DISK_QUOTA + $BANDWIDTH $NS1 $NS2 $SHELL $BACKUPS $TEMPLATES $MAX_CHILDS $SUSPENDED + $OWNER $ROLE $IP_OWNED $U_CHILDS $U_DISK $U_BANDWIDTH $U_WEB_DOMAINS + $U_WEB_SSL $U_DNS_DOMAINS $U_DATABASES $U_MAIL_DOMAINS $CONTACT $DATE' + +# Listing domains +case $format in + json) usr_json_list ;; + shell) fields='$USER $PACKAGE $U_DISK $U_BANDWIDTH $SUSPENDED $DATE'; + usr_shell_list | column -t ;; + *) check_args '1' '0' '[format] [limit] [offset]' +esac + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_list_web_domain b/bin/v_list_web_domain new file mode 100755 index 00000000..4fb1415d --- /dev/null +++ b/bin/v_list_web_domain @@ -0,0 +1,59 @@ +#!/bin/bash +# info: listing web domain + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +domain="$2" +format="${3-shell}" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/domain_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking args +check_args '2' "$#" 'user domain [format]' + +# Checking user +is_user_valid + +# Checking domain exist +is_web_domain_valid + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Defining config +conf="$V_USERS/$user/web_domains.conf" + +# Defining fileds to select +fields='$DOMAIN $IP $U_DISK $U_BANDWIDTH $TPL $ALIAS $PHP $CGI $ELOG $STATS + $STATS_AUTH $SSL $SSL_HOME $SSL_CERT $NGINX $NGINX_EXT $SUSPEND $DATE' + +# Listing domains +case $format in + json) dom_json_single_list ;; + shell) dom_shell_single_list | column -t ;; + *) check_args '2' "0" 'user domain [format]' +esac + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_list_web_domains b/bin/v_list_web_domains new file mode 100755 index 00000000..363106f1 --- /dev/null +++ b/bin/v_list_web_domains @@ -0,0 +1,61 @@ +#!/bin/bash +# info: listing web domains + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +format="${2-shell}" +limit="${3-1000}" +offset="${4-1}" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking args +check_args '1' "$#" 'user [format] [limit] [offset]' + +# Checking argument format +format_validation 'user' 'limit' 'offset' + +# Checking user +is_user_valid + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Defining config +conf="$V_USERS/$user/web_domains.conf" + +# Defining fileds to select +fields='$DOMAIN $IP $U_DISK $U_BANDWIDTH $TPL $ALIAS $PHP $CGI $ELOG $STATS + $STATS_AUTH $SSL $SSL_HOME $SSL_CERT $NGINX $NGINX_EXT $SUSPEND $DATE' + + +# Listing domains +case $format in + json) v_json_list ;; + shell) fields='$DOMAIN $IP $U_DISK $U_BANDWIDTH $TPL $DATE'; + v_shell_list | column -t ;; + *) check_args '1' "0" 'user [format] [limit] [offset]' +esac + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_list_web_domains_alias b/bin/v_list_web_domains_alias new file mode 100755 index 00000000..85c1733f --- /dev/null +++ b/bin/v_list_web_domains_alias @@ -0,0 +1,58 @@ +#!/bin/bash +# info: listing web domains + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +format="${2-shell}" +limit="${3-1000}" +offset="${4-1}" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking args +check_args '1' "$#" 'user [format] [limit] [offset]' + +# Checking argument format +format_validation 'user' 'limit' 'offset' + +# Checking user +is_user_valid + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Defining config +conf="$V_USERS/$user/web_domains.conf" + +# Defining fileds to select +fields='$DOMAIN $ALIAS' + +# Listing domains +case $format in + json) v_json_list ;; + shell) v_shell_list | column -t ;; + *) check_args '1' "0" 'user [format] [limit] [offset]' +esac + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_list_web_domains_elog b/bin/v_list_web_domains_elog new file mode 100755 index 00000000..31cadbbf --- /dev/null +++ b/bin/v_list_web_domains_elog @@ -0,0 +1,58 @@ +#!/bin/bash +# info: listing web domain + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +format="${2-shell}" +limit="${3-1000}" +offset="${4-1}" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking args +check_args '1' "$#" 'user [format] [limit] [offset]' + +# Checking argument format +format_validation 'user' 'limit' 'offset' + +# Checking user +is_user_valid + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Defining config +conf="$V_USERS/$user/web_domains.conf" + +# Defining fileds to select +fields='$DOMAIN $ELOG' + +# Listing domains +case $format in + json) v_json_list ;; + shell) v_shell_list | column -t ;; + *) check_args '1' "0" 'user [format] [limit] [offset]' +esac + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_list_web_domains_nginx b/bin/v_list_web_domains_nginx new file mode 100755 index 00000000..98b4eca7 --- /dev/null +++ b/bin/v_list_web_domains_nginx @@ -0,0 +1,58 @@ +#!/bin/bash +# info: listing web domains + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +format="${2-shell}" +limit="${3-1000}" +offset="${4-1}" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking args +check_args '1' "$#" 'user [format] [limit] [offset]' + +# Checking argument format +format_validation 'user' 'limit' 'offset' + +# Checking user +is_user_valid + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Defining config +conf="$V_USERS/$user/web_domains.conf" + +# Defining fileds to select +fields='$DOMAIN $NGINX' + +# Listing domains +case $format in + json) v_json_list ;; + shell) v_shell_list | column -t ;; + *) check_args '1' "0" 'user [format] [limit] [offset]' +esac + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_list_web_domains_ssl b/bin/v_list_web_domains_ssl new file mode 100755 index 00000000..69484e38 --- /dev/null +++ b/bin/v_list_web_domains_ssl @@ -0,0 +1,58 @@ +#!/bin/bash +# info: listing web domain + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +format="${2-shell}" +limit="${3-1000}" +offset="${4-1}" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking args +check_args '1' "$#" 'user [format] [limit] [offset]' + +# Checking argument format +format_validation 'user' 'limit' 'offset' + +# Checking user +is_user_valid + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Defining config +conf="$V_USERS/$user/web_domains.conf" + +# Defining fileds to select +fields='$DOMAIN $SSL $SSL_HOME $SSL_CERT' + +# Listing domains +case $format in + json) v_json_list ;; + shell) v_shell_list | column -t ;; + *) check_args '1' "0" 'user [format] [limit] [offset]' +esac + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_list_web_domains_stats b/bin/v_list_web_domains_stats new file mode 100755 index 00000000..08135ee5 --- /dev/null +++ b/bin/v_list_web_domains_stats @@ -0,0 +1,58 @@ +#!/bin/bash +# info: listing web domain + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +format="${2-shell}" +limit="${3-1000}" +offset="${4-1}" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking args +check_args '1' "$#" 'user [format] [limit] [offset]' + +# Checking argument format +format_validation 'user' 'limit' 'offset' + +# Checking user +is_user_valid + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Defining config +conf="$V_USERS/$user/web_domains.conf" + +# Defining fileds to select +fields='$DOMAIN $STATS $STATS_AUTH' + +# Listing domains +case $format in + json) v_json_list ;; + shell) v_shell_list | column -t ;; + *) check_args '1' "0" 'user [format] [limit] [offset]' +esac + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_list_web_templates b/bin/v_list_web_templates new file mode 100755 index 00000000..5dc30352 --- /dev/null +++ b/bin/v_list_web_templates @@ -0,0 +1,56 @@ +#!/bin/bash +# info: listing web templates + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +format="${2-shell}" +limit="${3-1000}" +offset="${4-1}" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/domain_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '1' "$#" 'user' + +# Checking argument format +format_validation 'user' 'limit' 'offset' + +# Checking user +is_user_valid + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Get user package package +templates=$(get_user_value '$TEMPLATES') + +# Listing domains +case $format in + json) webtpl_json_list ;; + shell) webtpl_shell_list ;; + *) check_args '1' "0" '[format] [limit] [offset]' +esac + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_rebuild_web_domain b/bin/v_rebuild_web_domain new file mode 100755 index 00000000..0ec7c704 --- /dev/null +++ b/bin/v_rebuild_web_domain @@ -0,0 +1,164 @@ +#!/bin/bash +# info: rebuilding web domain + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +domain=$(idn -t --quiet -u "$2" ) +domain_idn=$(idn -t --quiet -a "$domain") +ip="$3" +template=$4 + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/domain_func.sh +source $V_FUNC/ip_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '2' "$#" 'user domain [ip] [template]' + +# Checking argument format +format_validation 'user' 'domain' + +# Checking web system is enabled +is_system_enabled 'web' + +# Checking user +is_user_valid + +# Checking user is active +is_user_suspended + +# Checking domain exist +is_web_domain_valid + +# Checking domain is not suspened +is_domain_suspended 'web_domains' + +# Checking ip +if [ -n "$ip" ]; then + format_validation 'ip' + is_ip_avalable +fi + +# Checking template +if [ -n "$template" ]; then + format_validation 'template' + templates=$(get_user_value '$TEMPLATES') + is_template_valid "web" +fi + +exit + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Defining domain aliases +ip_name=$(get_ip_name) +ip_name_idn=$(idn -t --quiet -a "$ip_name") +domain_alias="www.$domain" +domain_alias_idn="www.$domain_idn" +if [ ! -z "$ip_name" ]; then + domain_alias_dash="${domain//./-}.$ip_name" + domain_alias_dash_idn="${domain_idn//./-}.$ip_name_idn" + aliases="$domain_alias,$domain_alias_dash" + aliases_idn="$domain_alias_idn,$domain_alias_dash_idn" +else + aliases="$domain_alias" + aliases_idn="$domain_alias_idn" +fi + +# Defining vars for httpd_add_config function +port=$(get_web_port) +group="$user" +email="$user@$domain" +docroot="$V_HOME/$user/domains/$domain/public_html" +conf="$V_HOME/$user/conf/httpd.conf" +tpl_file="$V_WEBTPL/apache_$template.tpl" + +# Adding domain to the httpd.conf +httpd_add_config + +# Building directory tree +if [ ! -e $V_HOME/$user/domains/$domain ]; then + mkdir $V_HOME/$user/domains/$domain \ + $V_HOME/$user/domains/$domain/public_html \ + $V_HOME/$user/domains/$domain/public_shtml \ + $V_HOME/$user/domains/$domain/document_errors \ + $V_HOME/$user/domains/$domain/cgi-bin \ + $V_HOME/$user/domains/$domain/private \ + $V_HOME/$user/domains/$domain/stats \ + $V_HOME/$user/domains/$domain/logs + + # Adding domain skeleton + cp -r $V_WEBTPL/skel/public_html/ $V_HOME/$user/domains/$domain/ + cp -r $V_WEBTPL/skel/public_shtml/ $V_HOME/$user/domains/$domain/ + cp -r $V_WEBTPL/skel/document_errors/ $V_HOME/$user/domains/$domain/ + cp -r $V_WEBTPL/skel/cgi-bin/ $V_HOME/$user/domains/$domain/ + + # Changing tpl values + for file in $(find "$V_HOME/$user/domains/$domain/" -type f); do + sed -i "s/%domain%/$domain/g" $file + done +fi + +# Adding domain logs +touch /var/log/httpd/domains/$domain.bytes \ + /var/log/httpd/domains/$domain.log \ + /var/log/httpd/domains/$domain.error_log + +# Adding symlink for logs +ln -s /var/log/httpd/domains/$domain.*log $V_HOME/$user/domains/$domain/logs/ + +# Changing file owner +chown -R $user:$user $V_HOME/$user/domains/$domain +chown root:$user /var/log/httpd/domains/$domain.* + +# Changing file permissions +chmod 551 $V_HOME/$user/domains/$domain +chmod 751 $V_HOME/$user/domains/$domain/private +chmod 751 $V_HOME/$user/domains/$domain/cgi-bin +chmod 751 $V_HOME/$user/domains/$domain/public_html +chmod 751 $V_HOME/$user/domains/$domain/public_shtml +chmod 751 $V_HOME/$user/domains/$domain/document_errors +chmod -f -R 775 $V_HOME/$user/domains/$domain/cgi-bin/* +chmod -f -R 775 $V_HOME/$user/domains/$domain/public_html/* +chmod -f -R 775 $V_HOME/$user/domains/$domain/document_errors/* +chmod 551 $V_HOME/$user/domains/$domain/stats +chmod 551 $V_HOME/$user/domains/$domain/logs +chmod 640 /var/log/httpd/domains/$domain.* + +# Running template post setup file +if [ -e $V_WEBTPL/apache_$template.sh ]; then + $V_WEBTPL/apache_$template.sh $user $domain $ip $V_HOME $docroot $port +fi + +# Checking main vesta httpd config +main_conf='/etc/httpd/conf.d/vesta.conf' +main_conf_check=$(grep "$conf" $main_conf ) +if [ -z "$main_conf_check" ]; then + echo "Include $conf" >>$main_conf +fi + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Adding task to the vesta piped +restart_schedule 'web' + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_suspend_db_base b/bin/v_suspend_db_base new file mode 100755 index 00000000..7f4e8641 --- /dev/null +++ b/bin/v_suspend_db_base @@ -0,0 +1,67 @@ +#!/bin/bash +# info: Suspending databse + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +database="$2" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/db_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '2' "$#" 'user db_name' + +# Checking argument format +format_validation 'user' 'database' + +# Checking db system is enabled +is_system_enabled 'db' + +# Checking user +is_user_valid + +# Checking db existance +is_db_valid + +# Checking db is active +is_db_suspended + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Define database variables +db_user=$(get_db_value '$USER') +host=$(get_db_value '$HOST') +type=$(get_db_value '$TYPE') + +# Switching on db type +case $type in + mysql) suspend_db_mysql ;; + pgsql) suspend_db_pgsql ;; +esac + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Updating db value +update_db_base_value '$SUSPEND' 'yes' + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_suspend_db_bases b/bin/v_suspend_db_bases new file mode 100755 index 00000000..3b1878fd --- /dev/null +++ b/bin/v_suspend_db_bases @@ -0,0 +1,74 @@ +#!/bin/bash +# info: Suspending databses + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/db_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '1' "$#" 'user' + +# Checking argument format +format_validation 'user' + +# Checking db system is enabled +is_system_enabled 'db' + +# Checking user +is_user_valid + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Defining config +conf="$V_USERS/$user/db.conf" + +# Defining fileds to select +field='$DB' + +# Defining search string +search_string="SUSPEND='no'" + +# Parsing unsuspeneded domains +databases=$(db_clear_search) + +for database in $databases; do + # Define database variables + db_user=$(get_db_value '$USER') + host=$(get_db_value '$HOST') + type=$(get_db_value '$TYPE') + + # Switching on db type + case $type in + mysql) suspend_db_mysql ;; + pgsql) suspend_db_pgsql ;; + esac + + # Updating db value + update_db_base_value '$SUSPEND' 'yes' +done + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_suspend_dns_domain b/bin/v_suspend_dns_domain new file mode 100755 index 00000000..2d36a3fc --- /dev/null +++ b/bin/v_suspend_dns_domain @@ -0,0 +1,67 @@ +#!/bin/bash +# info: suspening dns domain + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +domain="$2" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/domain_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '2' "$#" 'user domain' + +# Checking argument format +format_validation 'user' 'domain' + +# Checking web system is enabled +is_system_enabled 'dns' + +# Checking user +is_user_valid + +# Checking domain exist +is_dns_domain_valid + +# Checking domain is not suspened +is_domain_suspended 'dns' + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Defining config +conf="/etc/named.conf" + +rm_string=$(grep -n /etc/namedb/$domain.db $conf|cut -d : -f 1) +if [ ! -z "$rm_string" ]; then + sed -i "$rm_string d" $conf +fi + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Adding suspend in config +update_dns_domain_value '$SUSPEND' 'yes' + +# Adding task to the vesta pipe +restart_schedule 'dns' + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_suspend_dns_domains b/bin/v_suspend_dns_domains new file mode 100755 index 00000000..d1f65de9 --- /dev/null +++ b/bin/v_suspend_dns_domains @@ -0,0 +1,73 @@ +#!/bin/bash +# info: suspening dns domains + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/domain_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '1' "$#" 'user' + +# Checking argument format +format_validation 'user' + +# Checking dns system is enabled +is_system_enabled 'dns' + +# Checking user +is_user_valid + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Defining config +conf="$V_USERS/$user/dns.conf" + +# Defining fileds to select +field='$DOMAIN' + +# Defining search string +search_string="SUSPEND='no'" + +# Parsing unsuspeneded domains +domains=$(dom_clear_search) + +# Starting suspend loop +for domain in $domains; do + # Defining named config + conf="/etc/named.conf" + rm_string=$(grep -n /etc/namedb/$domain.db $conf|cut -d : -f 1) + if [ ! -z "$rm_string" ]; then + sed -i "$rm_string d" $conf + fi + # Adding suspend in config + update_dns_domain_value '$SUSPEND' 'yes' +done + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Adding task to the vesta pipe +restart_schedule 'dns' + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_suspend_sys_cron_job b/bin/v_suspend_sys_cron_job new file mode 100755 index 00000000..ca9e4135 --- /dev/null +++ b/bin/v_suspend_sys_cron_job @@ -0,0 +1,59 @@ +#!/bin/bash +# info: Suspending sys cron + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +job="$2" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/cron_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '2' "$#" 'user job' + +# Checking argument format +format_validation 'user' 'job' + +# Checking user +is_user_valid + +# Checking cron job +is_job_valid + +# Checking suspend status +is_job_suspended + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Suspending job +update_cron_job_value '$SUSPEND' 'yes' + +# Sync system cron with user +sync_cron_jobs + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Adding task to the vesta pipe +restart_schedule 'cron' + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_suspend_sys_cron_jobs b/bin/v_suspend_sys_cron_jobs new file mode 100755 index 00000000..323bb62f --- /dev/null +++ b/bin/v_suspend_sys_cron_jobs @@ -0,0 +1,60 @@ +#!/bin/bash +# info: Suspending sys cron jobs + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/cron_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '1' "$#" 'user' + +# Checking argument format +format_validation 'user' + +# Checking user +is_user_valid + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Searching jobs +conf="$V_USERS/$user/crontab.conf" +field='$JOB' +search_string="SUSPEND='no'" +jobs=$(cron_clear_search) + +# Suspendning +for job in $jobs; do + update_cron_job_value '$SUSPEND' 'yes' +done + +# Sync system cron with user +sync_cron_jobs "$user" + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Adding task to the vesta pipe +restart_schedule 'cron' + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_suspend_web_domain b/bin/v_suspend_web_domain new file mode 100755 index 00000000..9377ba17 --- /dev/null +++ b/bin/v_suspend_web_domain @@ -0,0 +1,94 @@ +#!/bin/bash +# info: suspening web domain (with ssl) + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +domain="$2" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/domain_func.sh + +# Defining url +url="${3-$V_SUSPEND_URL}" + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '2' "$#" 'user domain [suspend_url]' + +# Checking argument format +format_validation 'user' 'domain' 'url' + +# Checking web system is enabled +is_system_enabled 'web' + +# Checking user +is_user_valid + +# Checking domain exist +is_web_domain_valid + +# Checking domain is not suspened +is_domain_suspended 'web_domains' + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Get template name +tpl_name=$(get_web_domain_value '$TPL') +tpl_file="$V_WEBTPL/apache_$tpl_name.tpl" + +# Defining config +conf="$V_HOME/$user/conf/httpd.conf" + +# Defining search phrase +search_phrase='DocumentRoot ' + +# Defining replace string +str_repl=" Redirect / http://$url/" + +# Suspending vhost +httpd_change_config + +# Check ssl vhost +ssl=$(get_web_domain_value '$SSL') +if [ "$ssl" = 'yes' ]; then + # Defining teplate name + tpl_file="$V_WEBTPL/apache_$tpl_name.stpl" + + # Defining config + conf="$V_HOME/$user/conf/shttpd.conf" + + # Reefining replace string - old str_repl contains escaped chars + str_repl=" Redirect / http://$url/" + + # Suspending vhost + httpd_change_config +fi + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Adding suspend in config +update_web_domain_value '$SUSPEND' 'yes' + +# Adding task to the vesta pipe +restart_schedule 'web' + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_suspend_web_domains b/bin/v_suspend_web_domains new file mode 100755 index 00000000..80199c5a --- /dev/null +++ b/bin/v_suspend_web_domains @@ -0,0 +1,104 @@ +#!/bin/bash +# info: suspening web domains (with ssl) + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/domain_func.sh + +# Defining url +url="${2-$V_SUSPEND_URL}" + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '1' "$#" 'user [suspend_url]' + +# Checking argument format +format_validation 'user' 'url' + +# Checking web system is enabled +is_system_enabled 'web' + +# Checking user +is_user_valid + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Defining config +conf="$V_USERS/$user/web_domains.conf" + +# Defining fileds to select +field='$DOMAIN' + +# Defining search string +search_string="SUSPEND='no'" + +# Parsing unsuspeneded domains +domains=$(dom_clear_search) + +# Starting suspend loop +for domain in $domains; do + + # Get template name + tpl_name=$(get_web_domain_value '$TPL') + tpl_file="$V_WEBTPL/apache_$tpl_name.tpl" + + # Defining config + conf="$V_HOME/$user/conf/httpd.conf" + + # Defining search phrase + search_phrase='DocumentRoot ' + + # Defining replace string + str_repl=" Redirect / http://$url/" + + # Suspending vhost + httpd_change_config + + # Check ssl vhost + ssl=$(get_web_domain_value '$SSL') + if [ "$ssl" = 'yes' ]; then + # Defining teplate name + tpl_file="$V_WEBTPL/apache_$tpl_name.stpl" + + # Defining config + conf="$V_HOME/$user/conf/shttpd.conf" + + # Reefining replace string - old str_repl contains escaped chars + str_repl=" Redirect / http://$url/" + + # Suspending vhost + httpd_change_config + fi + + # Adding suspend in config + update_web_domain_value '$SUSPEND' 'yes' + +done + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Adding task to the vesta pipe +restart_schedule 'web' + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_unsuspend_db_base b/bin/v_unsuspend_db_base new file mode 100755 index 00000000..91e9b29c --- /dev/null +++ b/bin/v_unsuspend_db_base @@ -0,0 +1,67 @@ +#!/bin/bash +# info: Unsuspending databse + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +database="$2" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/db_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '2' "$#" 'user db_name' + +# Checking argument format +format_validation 'user' 'database' + +# Checking db system is enabled +is_system_enabled 'db' + +# Checking user +is_user_valid + +# Checking db existance +is_db_valid + +# Checking db is active +is_db_unsuspended + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Define database variables +db_user=$(get_db_value '$USER') +host=$(get_db_value '$HOST') +type=$(get_db_value '$TYPE') + +# Switching on db type +case $type in + mysql) unsuspend_db_mysql ;; + pgsql) unsuspend_db_pgsql ;; +esac + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Updating db value +update_db_base_value '$SUSPEND' 'no' + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_unsuspend_db_bases b/bin/v_unsuspend_db_bases new file mode 100755 index 00000000..b9e041db --- /dev/null +++ b/bin/v_unsuspend_db_bases @@ -0,0 +1,74 @@ +#!/bin/bash +# info: Unsuspending databses + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/db_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '1' "$#" 'user' + +# Checking argument format +format_validation 'user' + +# Checking db system is enabled +is_system_enabled 'db' + +# Checking user +is_user_valid + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Defining config +conf="$V_USERS/$user/db.conf" + +# Defining fileds to select +field='$DB' + +# Defining search string +search_string="SUSPEND='yes'" + +# Parsing unsuspeneded domains +databases=$(db_clear_search) + +for database in $databases; do + # Define database variables + db_user=$(get_db_value '$USER') + host=$(get_db_value '$HOST') + type=$(get_db_value '$TYPE') + + # Switching on db type + case $type in + mysql) unsuspend_db_mysql ;; + pgsql) unsuspend_db_pgsql ;; + esac + + # Updating db value + update_db_base_value '$SUSPEND' 'no' +done + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_unsuspend_dns_domain b/bin/v_unsuspend_dns_domain new file mode 100755 index 00000000..0bfb0ba6 --- /dev/null +++ b/bin/v_unsuspend_dns_domain @@ -0,0 +1,65 @@ +#!/bin/bash +# info: unsuspening dns domain + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +domain="$2" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/domain_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '2' "$#" 'user domain' + +# Checking argument format +format_validation 'user' 'domain' + +# Checking web system is enabled +is_system_enabled 'dns' + +# Checking user +is_user_valid + +# Checking domain exist +is_dns_domain_valid + +# Check domain is suspened +is_domain_unsuspended 'dns' + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Defining config +conf="/etc/named.conf" + +# Adding zone in named.conf +nmd_rec="zone \"$domain\" { type master; file \"/etc/namedb/$domain.db\"; };" +echo "$nmd_rec" >> $conf + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Unsuspending domain in config +update_dns_domain_value '$SUSPEND' 'no' + +# Adding task to the vesta pipe +restart_schedule 'dns' + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_unsuspend_dns_domains b/bin/v_unsuspend_dns_domains new file mode 100755 index 00000000..f427868a --- /dev/null +++ b/bin/v_unsuspend_dns_domains @@ -0,0 +1,77 @@ +#!/bin/bash +# info: unsuspening dns domains + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/domain_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '1' "$#" 'user' + +# Checking argument format +format_validation 'user' + +# Checking dns system is enabled +is_system_enabled 'dns' + +# Checking user +is_user_valid + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Defining config +conf="$V_USERS/$user/dns.conf" + +# Defining fileds to select +field='$DOMAIN' + +# Defining search string +search_string="SUSPEND='yes'" + +# Parsing suspeneded domains +domains=$(dom_clear_search) + + +# Starting unsuspend loop +for domain in $domains; do + + # Defining named config + conf="/etc/named.conf" + + # Adding zone in named.conf + rec="zone \"$domain\" { type master; file \"/etc/namedb/$domain.db\"; };" + echo "$rec" >> $conf + + # Unsuspendin in config + update_dns_domain_value '$SUSPEND' 'no' + +done + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Adding task to the vesta pipe +restart_schedule 'dns' + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_unsuspend_sys_cron_job b/bin/v_unsuspend_sys_cron_job new file mode 100755 index 00000000..387a2dc0 --- /dev/null +++ b/bin/v_unsuspend_sys_cron_job @@ -0,0 +1,59 @@ +#!/bin/bash +# info: Unuspending sys cron + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +job="$2" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/cron_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '2' "$#" 'user job' + +# Checking argument format +format_validation 'user' 'job' + +# Checking user +is_user_valid + +# Checking cron job +is_job_valid + +# Check job is suspened +is_job_unsuspended + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Unsuspending job +update_cron_job_value '$SUSPEND' 'no' + +# Sync system cron with user +sync_cron_jobs + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Adding task to the vesta pipe +restart_schedule 'cron' + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_unsuspend_sys_cron_jobs b/bin/v_unsuspend_sys_cron_jobs new file mode 100755 index 00000000..0046a181 --- /dev/null +++ b/bin/v_unsuspend_sys_cron_jobs @@ -0,0 +1,60 @@ +#!/bin/bash +# info: Unuspending sys cron + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/cron_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '1' "$#" 'user' + +# Checking argument format +format_validation 'user' + +# Checking user +is_user_valid + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Searching jobs +conf="$V_USERS/$user/crontab.conf" +field='$JOB' +search_string="SUSPEND='yes'" +jobs=$(cron_clear_search) + +# Unsuspendning jobs +for job in $jobs; do + update_cron_job_value '$SUSPEND' 'no' +done + +# Sync system cron with user +sync_cron_jobs + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Adding task to the vesta pipe +restart_schedule 'cron' + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_unsuspend_web_domain b/bin/v_unsuspend_web_domain new file mode 100755 index 00000000..bb3dbc71 --- /dev/null +++ b/bin/v_unsuspend_web_domain @@ -0,0 +1,98 @@ +#!/bin/bash +# info: unsuspening web domain (with ssl) + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +domain="$2" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/domain_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '2' "$#" 'user domain' + +# Checking argument format +format_validation 'user' 'domain' + +# Checking web system is enabled +is_system_enabled 'web' + +# Checking user +is_user_valid + +# Checking domain exist +is_web_domain_valid + +# Check domain is suspened +is_domain_unsuspended 'web_domains' + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Get template name +tpl_name=$(get_web_domain_value '$TPL') +tpl_file="$V_WEBTPL/apache_$tpl_name.stpl" + +# Defining config +conf="$V_HOME/$user/conf/httpd.conf" + +# Defining search phrase +search_phrase='Redirect / ' + +# Defining replace string +str_repl=" DocumentRoot $V_HOME/$user/domains/$domain/public_html" + +# Unsuspending vhost +httpd_change_config + +# Check ssl vhost +ssl=$(get_web_domain_value '$SSL') +if [ "$ssl" = 'yes' ]; then + # Defining teplate name and ssl documentroot option + tpl_file="$V_WEBTPL/apache_$tpl_name.stpl" + tpl_option=$(get_web_domain_value '$SSL_HOME') + + # Defining config + conf="$V_HOME/$user/conf/shttpd.conf" + + # Switching on option + case $tpl_option in + single) docroot="$V_HOME/$user/domains/$domain/public_shtml" ;; + *) docroot="$V_HOME/$user/domains/$domain/public_html" ;; + esac + + # Defining replace string + str_repl=" DocumentRoot $docroot" + + # Unsuspending vhost + httpd_change_config +fi + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Adding suspend in config +update_web_domain_value '$SUSPEND' 'no' + +# Adding task to the vesta pipe +restart_schedule 'web' + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_unsuspend_web_domains b/bin/v_unsuspend_web_domains new file mode 100755 index 00000000..7c68d9cf --- /dev/null +++ b/bin/v_unsuspend_web_domains @@ -0,0 +1,107 @@ +#!/bin/bash +# info: unsuspening web domain (with ssl) + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/domain_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '1' "$#" 'user' + +# Checking argument format +format_validation 'user' + +# Checking web system is enabled +is_system_enabled 'web' + +# Checking user +is_user_valid + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Defining config +conf="$V_USERS/$user/web_domains.conf" + +# Defining fileds to select +field='$DOMAIN' + +# Defining search string +search_string="SUSPEND='yes'" + +# Parsing suspeneded domains +domains=$(dom_clear_search) + +# Starting unsuspend loop +for domain in $domains; do + + # Get template name + tpl_name=$(get_web_domain_value '$TPL') + tpl_file="$V_WEBTPL/apache_$tpl_name.tpl" + + # Defining config + conf="$V_HOME/$user/conf/httpd.conf" + + # Defining search phrase + search_phrase='Redirect / ' + + # Defining replace string + str_repl=" DocumentRoot $V_HOME/$user/domains/$domain/public_html" + + # Unsuspending vhost + httpd_change_config + + # Check ssl vhost + ssl=$(get_web_domain_value '$SSL') + if [ "$ssl" = 'yes' ]; then + # Defining teplate name and ssl documentroot option + tpl_file="$V_WEBTPL/apache_$tpl_name.stpl" + tpl_opt=$(get_web_domain_value '$SSL_HOME') + + # Defining config + conf="$V_HOME/$user/conf/shttpd.conf" + + # Switching on option + case $tpl_opt in + single) docroot="$V_HOME/$user/domains/$domain/public_shtml" ;; + *) docroot="$V_HOME/$user/domains/$domain/public_html" ;; + esac + + # Defining replace string + str_repl=" DocumentRoot $docroot" + + # Unsuspending vhost + httpd_change_config + fi + + # Adding unsuspend in config + update_web_domain_value '$SUSPEND' 'no' +done + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Adding task to the vesta pipe +restart_schedule 'web' + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_upd_db_base_disk b/bin/v_upd_db_base_disk new file mode 100755 index 00000000..466b12d8 --- /dev/null +++ b/bin/v_upd_db_base_disk @@ -0,0 +1,71 @@ +#!/bin/bash +# info: updating disk usage for databae + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +database="$2" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/db_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '2' "$#" 'user db_name' + +# Checking argument format +format_validation 'user' 'database' + +# Checking web system is enabled +is_system_enabled 'db' + +# Checking user +is_user_valid + +# Checking db existance +is_db_valid + +# Checking db is active +is_db_suspended + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Get some variables we do not have now +db_user=$(get_db_value '$USER') +host=$(get_db_value '$HOST') +type=$(get_db_value '$TYPE') + +# Switching on db type +case $type in + mysql) disk_usage=$(get_disk_db_mysql) ;; + pgsql) disk_usage=$(get_disk_db_pgsql) ;; +esac + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Updating disk value in config +update_db_base_value '$U_DISK' "$disk_usage" + +# Recalculating user disk space +disk_size=$(get_usr_disk) +update_user_value "$user" '$U_DISK' "$disk_size" + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_upd_db_bases_disk b/bin/v_upd_db_bases_disk new file mode 100755 index 00000000..6cda01ec --- /dev/null +++ b/bin/v_upd_db_bases_disk @@ -0,0 +1,78 @@ +#!/bin/bash +# info: updating disk usage for all databaes + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/db_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '1' "$#" 'user' + +# Checking argument format +format_validation 'user' + +# Checking web system is enabled +is_system_enabled 'db' + +# Checking user +is_user_valid + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Defining config +conf="$V_USERS/$user/db.conf" + +# Defining fileds to select +field='$DB' + +# Defining search string +search_string="SUSPEND='no'" + +# Parsing unsuspeneded domains +databases=$(db_clear_search) + +for database in $databases; do + # Define database variables + db_user=$(get_db_value '$USER') + host=$(get_db_value '$HOST') + type=$(get_db_value '$TYPE') + + # Switching on db type + case $type in + mysql) disk_usage=$(get_disk_db_mysql) ;; + pgsql) disk_usage=$(get_disk_db_pgsql) ;; + esac + + # Updating disk value in config + update_db_base_value '$U_DISK' "$disk_usage" +done + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Recalculating user disk space +disk_size=$(get_usr_disk) +update_user_value "$user" '$U_DISK' "$disk_size" + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_upd_sys_ip b/bin/v_upd_sys_ip new file mode 100755 index 00000000..b5b608ae --- /dev/null +++ b/bin/v_upd_sys_ip @@ -0,0 +1,106 @@ +#!/bin/bash +# info: adding system ip + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +owner="$1" +ip_status="$2" +owner="${3-vesta}" +ip_status="${4-shared}" + +# Importing variables +source $VESTA/conf/vars.conf # include for internal func +source $V_FUNC/shared_func.sh +source $V_FUNC/ip_func.sh +source $V_FUNC/domain_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '0' "$#" '[owner] [ip_status]' + +# Checking owner +if [ ! -z "$owner" ]; then + format_validation 'owner' + is_user_valid "$owner" +fi + +# Checking ip_status +if [ ! -z "$ip_status" ]; then + format_validation 'ip_status' +fi + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Get ip list +ip_list=$(/sbin/ifconfig |grep 'inet addr:'|cut -f 2 -d :|\ + cut -f 1 -d ' '| grep -v 127.0.0.1) + +# Get vesta registered ip list +vesta_ip_list=$(ls $V_IPS/) + +# Importing main config +source $V_CONF/vesta.conf + +# Defining config paths +conf='/etc/httpd/conf.d/vesta.conf' +nconf='/etc/nginx/conf.d/vesta_ip.conf' +iconf='/etc/sysconfig/network-scripts/ifcfg' +rconf='/etc/httpd/conf.d/rpaf.conf' + +# Comparing each ip +for ip in $ip_list; do + check_ip=$(echo $vesta_ip_list|grep -w "$ip") + + # Checking ip registered + if [ -z "$check_ip" ]; then + + # Parsing additional params + iface=$(/sbin/ifconfig|grep -B1 -w "$ip"|head -n 1|cut -f 1 -d ' '|\ + cut -f 1 -d :) + mask=$(/sbin/ifconfig |grep -w "$ip"|awk -F "Mask:" '{print $2}') + + # Adding vesta ip + ip_add_vesta + + # Adding namehosting support + namehost_ip_support + + # Creating startup script + if [ ! -e "$iconf-$iface" ]; then + ip_add_startup + fi + fi + + # NOTE: later we'll make revers comparation +done + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Updating user conf +if [ ! -z "$owner" ]; then + user="$owner" + increase_user_value "$user" '$IP_OWNED' +fi + +# Adding task to the vesta pipe +if [ "$web_restart" = 'yes' ]; then + restart_schedule 'web' +fi + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_upd_sys_queue b/bin/v_upd_sys_queue new file mode 100755 index 00000000..d3e11d0d --- /dev/null +++ b/bin/v_upd_sys_queue @@ -0,0 +1,79 @@ +#!/bin/bash +# info: updating system queue + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# +# Argument defenition +pipe="$1" + +# Importing system enviroment as we run this script +# mostly by cron wich not read it by itself +source /etc/profile.d/vesta.sh + + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh + +# Another workaround for cron enviroment +PATH="$PATH:$V_BIN" +export PATH + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '1' "$#" 'pipe' + +# Checking argument format +format_validation 'pipe' + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Defining pipe functions +restart_pipe() { + for service in $(cat $V_QUEUE/restart.pipe |sort |uniq); do + $V_FUNC/restart_$service + done + echo >$V_QUEUE/restart.pipe +} + +stats_pipe() { + bash $V_QUEUE/stats.pipe +} + +backup_pipe() { + bash $V_QUEUE/backup.pipe +} + +disk_pipe() { + bash $V_QUEUE/disk.pipe +} + +traff_pipe() { + bash $V_QUEUE/traffic.pipe +} + +case $pipe in + restart) restart_pipe ;; + stats) stats_pipe ;; + backup) backup_pipe ;; + disk) disk_pipe ;; + traffic) traff_pipe ;; + *) check_args '1' '0' 'pipe' +esac + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_upd_sys_user_bill b/bin/v_upd_sys_user_bill new file mode 100755 index 00000000..5c15c84b --- /dev/null +++ b/bin/v_upd_sys_user_bill @@ -0,0 +1,147 @@ +#!/bin/bash +# info: updating montly billing user report + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" + +# Importing system enviroment as we run this script +# mostly by cron wich not read it by itself +source /etc/profile.d/vesta.sh + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/domain_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '0' "$#" 'user' + +# If user specified +if [ ! -z "$user" ]; then + # Checking argument format + format_validation 'user' + + # Checking user + is_user_valid +fi + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Importing main config +source $V_CONF/vesta.conf + +# Creating user_list +if [ -z "$user" ]; then + user_list=$(ls $V_USERS/) +else + user_list="$user" +fi + +# Updating user billing +for user in $user_list; do + + # Checking web system + if [ ! -z "$WEB_SYSTEM" ] && [ "$WEB_SYSTEM" != 'no' ]; then + # Cleaning value + U_DISK_WEB_DOMAINS='' + + # Defining config + conf="$V_USERS/$user/web_domains.conf" + + # Defining fileds to select + field='$DOMAIN' + + # Defining search string + search_string="DOMAIN='" + + # Receiving user domain list + domains=$(dom_clear_search) + + # Starting domain loop + i='1'; for domain in $domains; do + + # Assigning domain values + u_disk=$(get_web_domain_value '$U_DISK') + u_band=$(get_web_domain_value '$U_BANDWIDTH') + disk="$domain:$u_disk" + band="$domain:$u_band" + + if [ "$i" -eq '1' ]; then + U_DISK_WEB_DOMAINS="$disk" + U_BANDWIDTH_WEB_DOMAINS="$band" + else + U_DISK_WEB_DOMAINS="$U_DISK_WEB_DOMAINS,$disk" + U_BANDWIDTH_WEB_DOMAINS="$U_BANDWIDTH_WEB_DOMAINS,$band" + fi + + # Itterating + i=$((i + 1)) + done + + fi + + # Checking mail system + if [ ! -z "$MAIL_SYSTEM" ] && [ "$MAIL_SYSTEM" != 'no' ]; then + #FIXME + ok='ok' + fi + + # Checking db system + if [ ! -z "$DB_SYSTEM" ] && [ "$DB_SYSTEM" != 'no' ]; then + #FIXME + ok='ok' + fi + + # Importing user values + source $V_USERS/$user/user.conf + + # Redefining date + DATE=$(date -d "$(date +'%m/01') -1day" +%m-%d-%y) + + # Compiling report string + v_str="DATE='$DATE' PACKAGE='$PACKAGE' U_CHILDS='$U_CHILDS'" + v_str="$v_str U_DISK='$U_DISK' U_BANDWIDTH='$U_BANDWIDTH'" + v_str="$v_str U_WEB_DOMAINS='$U_WEB_DOMAINS' U_WEB_SSL='$U_WEB_SSL'" + v_str="$v_str U_DNS_DOMAINS='$U_DNS_DOMAINS' U_DATABASES='$U_DATABASES'" + v_str="$v_str U_MAIL_DOMAINS='$U_MAIL_DOMAINS' IP_OWNED='$IP_OWNED'" + v_str="$v_str U_DISK_WEB_DOMAINS='$U_DISK_WEB_DOMAINS'" + v_str="$v_str U_BANDWIDTH_WEB_DOMAINS='$U_BANDWIDTH_WEB_DOMAINS'" + + # Updating user billing log + billing="$V_USERS/$user/billing.log" + if [ -e "$billing" ]; then + # Checking dublicates + check_month=$(grep -n "DATE='$DATE'" $billing|cut -f 1 -d :) + if [ -z "$check_month" ]; then + # Updating as there no dublicates + echo "$v_str" >>$billing + else + # Replacing string with new data + sed -i "$check_month s/.*/$v_str/" $billing + fi + else + # Creating billing log + echo "$v_str" >$billing + fi +done + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_upd_sys_user_disk b/bin/v_upd_sys_user_disk new file mode 100755 index 00000000..e3808382 --- /dev/null +++ b/bin/v_upd_sys_user_disk @@ -0,0 +1,67 @@ +#!/bin/bash +# info: updating disk usage for user directories + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '1' "$#" 'user' + +# Checking argument format +format_validation 'user' + +# Checking user +is_user_valid + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Saving old IFS +OLDIFS=$IFS +IFS=$(echo -en "\n\b") + +# Defining directory list +dir_list=$(ls $V_HOME/$user/ |grep -v '^domains$' | grep -v '^backup$' |\ + grep -v '^conf$') + +# Starting update disk loop +disk_usage='0' +for dir in $dir_list; do + dir_disk=$(du -shm "$V_HOME/$user/$dir"|cut -f 1 ) + disk_usage=$((disk_usage + dir_disk)) +done + +# Restoring old IFS +IFS=$OLDIFS + +# Updating disk value in config +update_user_value "$user" '$U_DIR_DISK' "$disk_usage" + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Recalculating user disk space +disk_size=$(get_usr_disk) +update_user_value "$user" '$U_DISK' "$disk_size" + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_upd_sys_vesta b/bin/v_upd_sys_vesta new file mode 100755 index 00000000..ab2933ef --- /dev/null +++ b/bin/v_upd_sys_vesta @@ -0,0 +1,111 @@ +#!/bin/bash +# info: updating vesta after rpm update + +# warn: please note that this scritp should be runned +# by yum or rpm only + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +version="$1" +updates='' + +# Importing system enviroment +source /etc/profile.d/vesta.sh + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_CONF/vesta.conf + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '1' "$#" 'version' + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Compare versions +if [ "$version" != "$VERSION" ]; then + # Downloading version tree + upd_host="yum.vestacp.com" + wget -O "/tmp/versions" http://$V_UPD_HOST/upd_scripts/version_tree.txt \ + >/dev/null 2>&1 + + # Checking download result + if [ "$?" -ne "0" ]; then + echo "Error: version tree update failed" + log_event 'debug' "$E_UPD_FAILED $V_EVENT" + exit $E_UPD_FAILED + fi + + # Deviding version + v1=$(echo "$version" |cut -f 1 -d '.') + v2=$(echo "$version" |cut -f 2 -d '.') + v3=$(echo "$version" |cut -f 3 -d '.') + V1=$(echo "$VERSION" |cut -f 1 -d '.') + V2=$(echo "$VERSION" |cut -f 2 -d '.') + V3=$(echo "$VERSION" |cut -f 3 -d '.') + + + # Checking difference between versions + # Too nested tests, sory about complexity + if [ "$V1" -lt "$v1" ]; then + for ver in $(seq $V1 $v1); do + updates="$updates $(grep "^$ver." /tmp/versions|grep ":1$"|\ + cut -f 1 -d :)" + done + else + if [ "$V2" -lt "$v2" ]; then + for ver in $(seq $V2 $v2); do + updates="$updates $(grep "^$v1.$ver." /tmp/versions |\ + grep ":1$"|cut -f 1 -d :)" + done + else + for ver in $(seq $V3 $v3); do + updates="$updates $(grep "^$v1.$v2.$ver" /tmp/versions |\ + grep ":1$"|cut -f 1 -d :)" + done + fi + fi + + # Executing update scripts + if [ ! -z "$updates" ]; then + mkdir $V_BIN/updates >/dev/null 2>&1 + + for update in $updates; do + wget -O $V_BIN/updates/$update.sh \ + http://$V_UPD_HOST/upd_scripts/$update.sh >/dev/null 2>&1 + + # Checking download result + if [ "$?" -ne "0" ]; then + echo "Error: version tree update failed" + log_event 'debug' "$E_UPD_FAILED $V_EVENT" + exit $E_UPD_FAILED + fi + bash $V_BIN/updates/$update.sh + done + rm -rf $V_BIN/updates + fi + + # Updating config version + sed -i "s/VERSION='$VERSION'/VERSION='$version'/g" $V_CONF/vesta.conf +fi + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_upd_web_domain_disk b/bin/v_upd_web_domain_disk new file mode 100755 index 00000000..7e93f1ce --- /dev/null +++ b/bin/v_upd_web_domain_disk @@ -0,0 +1,68 @@ +#!/bin/bash +# info: updating disk usage for domain + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +domain="$2" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/domain_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '2' "$#" 'user domain' + +# Checking argument format +format_validation 'user' 'domain' + +# Checking web system is enabled +is_system_enabled 'web' + +# Checking user +is_user_valid + +# Checking domain exist +is_web_domain_valid + +# Checking domain is not suspened +is_domain_suspended 'web_domains' + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Defining home directory +home_dir="$V_HOME/$user/domains/$domain/" + +# Checking home directory exist +if [ -e "$home_dir" ]; then + disk_usage=$(nice -n 19 du -shm $home_dir | cut -f 1 ) +fi + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Updating disk value in config +update_web_domain_value '$U_DISK' "$disk_usage" + +# Recalculating user disk space +disk_size=$(get_usr_disk) +update_user_value "$user" '$U_DISK' "$disk_size" + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_upd_web_domain_traff b/bin/v_upd_web_domain_traff new file mode 100755 index 00000000..f4f3b393 --- /dev/null +++ b/bin/v_upd_web_domain_traff @@ -0,0 +1,83 @@ +#!/bin/bash +# info: updating traffic usage for domain + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" +domain="$2" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/domain_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '2' "$#" 'user domain' + +# Checking argument format +format_validation 'user' 'domain' + +# Checking web system is enabled +is_system_enabled 'web' + +# Checking user +is_user_valid + +# Checking domain exist +is_web_domain_valid + +# Checking domain is not suspened +is_domain_suspended 'web_domains' + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Defining log file +log_file="/var/log/httpd/domains/$domain.bytes" + +# Defining bytes +bytes=0 + +# Parsing log +while read line +do + if [[ '-' != "$line" ]] && [[ 0 -lt "$line" ]] + then + bytes=$(($bytes + $line)) + fi +done < $log_file + +# Converting to Mb +mb=$(echo "$bytes / 1024 / 1024"|bc) + +# Nulling log +echo > $log_file + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Parsing old value +old_val=$(get_web_domain_value '$U_BANDWIDTH') + +# Defining new value +bandwidth=$((old_val + mb)) + +# Updating bandwidth value in config +update_web_domain_value '$U_BANDWIDTH' "$bandwidth" + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_upd_web_domains_disk b/bin/v_upd_web_domains_disk new file mode 100755 index 00000000..31d51358 --- /dev/null +++ b/bin/v_upd_web_domains_disk @@ -0,0 +1,77 @@ +#!/bin/bash +# info: updating disk usage for all user domains + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/domain_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '1' "$#" 'user' + +# Checking argument format +format_validation 'user' + +# Checking web system is enabled +is_system_enabled 'web' + +# Checking user +is_user_valid + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Defining config +conf="$V_USERS/$user/web_domains.conf" + +# Defining fileds to select +field='$DOMAIN' + +# Defining search string +search_string="SUSPEND='no'" + +# Parsing unsuspeneded domains +domains=$(dom_clear_search) + +# Starting update disk loop +for domain in $domains; do + + # Defining home directory + home_dir="$V_HOME/$user/domains/$domain/" + + # Checking home directory exist + if [ -e "$home_dir" ]; then + disk_usage=$(nice -n 19 du -shm $home_dir | cut -f 1 ) + fi + + # Updating disk value in config + update_web_domain_value '$U_DISK' "$disk_usage" +done + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Recalculating user disk space +disk_size=$(get_usr_disk) +update_user_value "$user" '$U_DISK' "$disk_size" + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/bin/v_upd_web_domains_traff b/bin/v_upd_web_domains_traff new file mode 100755 index 00000000..30bb9929 --- /dev/null +++ b/bin/v_upd_web_domains_traff @@ -0,0 +1,95 @@ +#!/bin/bash +# info: updating traffic usage for domains + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +# Argument defenition +user="$1" + +# Importing variables +source $VESTA/conf/vars.conf +source $V_FUNC/shared_func.sh +source $V_FUNC/domain_func.sh + + +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# + +# Checking arg number +check_args '1' "$#" 'user' + +# Checking argument format +format_validation 'user' + +# Checking web system is enabled +is_system_enabled 'web' + +# Checking user +is_user_valid "$user" + + +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + +# Defining config +conf="$V_USERS/$user/web_domains.conf" + +# Defining fileds to select +field='$DOMAIN' + +# Defining search string +search_string="SUSPEND='no'" + +# Parsing unsuspeneded domains +domains=$(dom_clear_search) + +# Starting suspend loop +for domain in $domains; do + + # Defining log file + log_file="/var/log/httpd/domains/$domain.bytes" + + # Defining bytes + bytes=0 + + # Parsing log + while read line; do + if [[ '-' != "$line" ]] && [[ 0 -lt "$line" ]]; then + bytes=$(($bytes + $line)) + fi + done < $log_file + + # Converting to Mb + mb=$(echo "$bytes / 1024 / 1024"|bc) + + # Nulling log + echo > $log_file + + # Parsing old value + old_val=$(get_web_domain_value '$U_BANDWIDTH') + + # Defining new value + bandwidth=$((old_val + mb)) + + # Updating bandwidth value in config + update_web_domain_value '$U_BANDWIDTH' "$bandwidth" + +done + + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Recalculating user bandwidth +traff_size=$(get_usr_traff) +update_user_value "$user" '$U_BANDWIDTH' "$traff_size" + +# Logging +log_event 'system' "$V_EVENT" + +exit $OK diff --git a/conf/vars.conf b/conf/vars.conf new file mode 100644 index 00000000..1dda6be0 --- /dev/null +++ b/conf/vars.conf @@ -0,0 +1,144 @@ +############################################################# +# # +# This file contains vesta global variable defenitions # +# # +############################################################# + +# Paths +VESTA='/usr/local/vesta' +V_BIN="$VESTA/bin" +V_FUNC="$VESTA/func" +V_CONF="$VESTA/conf" +V_DATA="$VESTA/data" +V_LOG="$VESTA/log" +V_SRC="$VESTA/src" +V_PKG="$V_DATA/packages" +V_USERS="$V_DATA/users" +V_DB="$V_DATA/dbservers" +V_QUEUE="$V_DATA/queue" +V_IPS="$V_DATA/ips" +V_WEBTPL="$V_DATA/templates" +V_DNSTPL="$V_WEBTPL/dns" +V_LOCK=/var/lock/vesta +V_EXE="$VESTA_BIN/vesta" +V_HOME='/home' +V_TMP='/tmp' + +# Other vars +V_SUSPEND_URL='vestacp.com/faq/acc_suspended/' +V_SCRIPT=$(basename $0) +V_EVENT="$(date +%m-%d-%y" "%H:%m:%S) $V_SCRIPT $*" +V_DATE=$(date +%m-%d-%y) +V_UPD_HOST=yum.vestacp.com + +# Return codes +OK=0 +ERROR=1 +E_BAD_CMD=2 +E_BAD_ARGS=3 +E_BAD_STATUS=4 +E_BAD_TYPE=5 +E_BAD_FORMAT=6 +E_PARSE_ERROR=7 +E_STR_NOTFOUND=8 +E_OUTOFRANGE=9 +E_WEB_ENABLED=10 +E_WEB_DISABLED=11 +E_MAIL_ENABLED=12 +E_MAIL_DISABLED=13 +E_DNS_ENABLED=14 +E_DNS_DISABLED=15 +E_DB_ENABLED=16 +E_DB_DISABLED=17 +E_IM_ENABLED=18 +E_IM_DISABLED=19 +E_USER_EXIST=20 +E_USER_NOTEXIST=21 +E_USER_BADSTATUS=22 +E_USER_SUSPENDED=23 +E_USER_UNSUSPENDED=24 +E_USER_UNKNOWN=25 +E_DOM_EXIST=30 +E_DOM_NOTEXIST=31 +E_DOM_ADDED=32 +E_DOM_NOTADDED=33 +E_DOM_SUSPENDED=34 +E_DOM_UNSUSPENDED=35 +E_DOM_OWNED=36 +E_DOM_NOTOWNED=37 +E_DOM_ISALIAS=38 +E_DOM_NOTALIAS=39 +E_IP_EXIST=40 +E_IP_NOTEXIST=41 +E_IP_USED=42 +E_IP_UNUSED=33 +E_IP_OWNED=34 +E_IP_NOTOWNED=35 +E_QUOTA_ENABLED=1 +E_QUOTA_DISABLED=6 +E_LOG_EXIST=36 +E_LOG_NOTEXIST=37 +E_LOG_ENABLED=38 +E_LOG_DISABLED=39 +E_PKG_EXIST=7 +E_PKG_NOTEXIST=7 +E_PKG_UPGRADE=20 +E_PASSWORD_SHORT=23 +E_PASSWORD_WRONG=24 +E_FWD_EXISTS=25 +E_FWD_NOTFOUND=29 +E_CONF_EXISTS=30 +E_CONF_NOTEXIST=31 +E_PID_EXIST=32 +E_PID_NOTEXIST=32 +E_FILE_BROKEN=33 +E_LIMIT_NOTFOUND=34 +E_BACKUP_ENABLED=40 +E_BACKUP_DISABLED=41 +E_LOCK_EXIST=42 +E_DIR_NOTEXIST=43 +E_DIR_EXIST=44 +E_EMAIL_INVALID=45 +E_HOST_NOTFOUND=47 +E_HOST_EXIST=48 +E_HOST_USED=53 +E_CONN_FAILED=49 +E_PERMS_REQUEIURED=50 +E_TPL_EXIST=51 +E_TPL_NOTEXIST=52 +E_AUTH_ENABLED=55 +E_AUTH_DISABLED=56 +E_STATS_ENABLED=57 +E_STATS_DISABLED=58 +E_CERT_EXIST=59 +E_CERT_NOTEXIST=60 +E_CERT_INVALID=61 +E_KEY_INVALID=62 +E_CERTKEY_INVALID=63 +E_CERT_USED=64 +E_VALUE_EMPTY=65 +E_VALUE_EXIST=66 +E_ALIAS_NOTEXIST=67 +E_ALIAS_EXIST=68 +E_SHELL_INVALID=69 +E_INTERFACE_NOTEXIST=70 +E_IP_FIRST=71 +E_JOB_NOTEXIST=72 +E_JOB_EXIST=73 +E_ID_NOTEXIST=74 +E_ID_EXIST=75 +E_DB_NOTEXIST=76 +E_DB_EXIST=77 +E_DBHOST_NOTEXIST=78 +E_DBHOST_EXIST=79 +E_DBHOST_UNAVAILABLE=80 +E_JOB_SUSPENDED=81 +E_JOB_UNSUSPENDED=82 +E_DB_SUSPENDED=83 +E_DB_UNSUSPENDED=84 +E_DBUSER_NOTEXIST=85 +E_DBUSER_EXIST=86 +E_DBHOST_BUSY=87 +E_DBHOST_FREE=88 +E_UPD_FAILED=89 +E_PROXY_DISABLED='90' diff --git a/conf/vesta.conf b/conf/vesta.conf new file mode 100644 index 00000000..84e9ad93 --- /dev/null +++ b/conf/vesta.conf @@ -0,0 +1,20 @@ +WEB_SYSTEM='apache' +WEB_SSL='mod_ssl' +PROXY_SYSTEM='nginx' +FTP_SYSTEM='vsftpd' +MAIL_SYSTEM='' +DB_SYSTEM='mysql' +DB_BALANCE='first' +DNS_SYSTEM='bind' +STATS_SYSTEM='webalizer' +PHP_SYSTEM='module,cgi' +BACKUP_SYSTEM='yes' +CRON_SYSTEM='crond' +DISK_QUOTA='off' +ADMIN_EMAIL='root@localhost' +LOG_SYSTEM='on' +LOG_LEVEL='system,debug,auth' +LOG_HISTORY='on' +LOG_HISTORY_LENGTH='50' +RESTART_PERIOD='15' +VERSION='0.9.3' diff --git a/data/dbservers/mysql.conf b/data/dbservers/mysql.conf new file mode 100644 index 00000000..e69de29b diff --git a/data/packages/default.pkg b/data/packages/default.pkg new file mode 100644 index 00000000..24bb3763 --- /dev/null +++ b/data/packages/default.pkg @@ -0,0 +1,16 @@ +WEB_DOMAINS='10' +WEB_SSL='10' +WEB_ALIASES='10' +DATABASES='10' +MAIL_DOMAINS='10' +MAIL_BOXES='30' +MAIL_FORWARDERS='30' +DNS_DOMAINS='10' +DISK_QUOTA='10000' +BANDWIDTH='10000' +NS1='ns1.localhost' +NS2='ns2.localhost' +SHELL='nologin' +BACKUPS='3' +TEMPLATES='default,phpcgi,unlim' +MAX_CHILDS='300' diff --git a/data/packages/palegreen.pkg b/data/packages/palegreen.pkg new file mode 100644 index 00000000..e9e25984 --- /dev/null +++ b/data/packages/palegreen.pkg @@ -0,0 +1,16 @@ +WEB_DOMAINS='30' +WEB_SSL='30' +WEB_ALIASES='50' +DATABASES='30' +MAIL_DOMAINS='30' +MAIL_BOXES='50' +MAIL_FORWARDERS='50' +DNS_DOMAINS='30' +DISK_QUOTA='50000' +BANDWIDTH='50000' +NS1='ns1.localhost' +NS2='ns2.localhost' +SHELL='nologin' +BACKUPS='5' +TEMPLATES='default,phpcgi,unlim' +MAX_CHILDS='300' diff --git a/data/queue/backup.pipe b/data/queue/backup.pipe new file mode 100644 index 00000000..e69de29b diff --git a/data/queue/disk.pipe b/data/queue/disk.pipe new file mode 100644 index 00000000..e69de29b diff --git a/data/queue/restart.pipe b/data/queue/restart.pipe new file mode 100644 index 00000000..e69de29b diff --git a/data/queue/stats.pipe b/data/queue/stats.pipe new file mode 100644 index 00000000..e69de29b diff --git a/data/queue/traffic.pipe b/data/queue/traffic.pipe new file mode 100644 index 00000000..e69de29b diff --git a/data/templates/apache_default.descr b/data/templates/apache_default.descr new file mode 100644 index 00000000..90284fc8 --- /dev/null +++ b/data/templates/apache_default.descr @@ -0,0 +1,3 @@ +# Default template with basic php module restrictions. +# This is recomended config for basic sites. +PHP='module' CGI='yes' ELOG='no' diff --git a/data/templates/apache_default.stpl b/data/templates/apache_default.stpl new file mode 100644 index 00000000..0f665231 --- /dev/null +++ b/data/templates/apache_default.stpl @@ -0,0 +1,40 @@ + + + ServerName %domain_idn% + ServerAlias %alias_ind% + ServerAdmin %email% + DocumentRoot %docroot% + ScriptAlias /cgi-bin/ %home%/%user%/domains/%domain%/cgi-bin/ + Alias /vstats/ %home%/%user%/domains/%domain%/stats/ + Alias /error/ %home%/%user%/domains/%domain%/document_errors/ + SuexecUserGroup %user% %group% + CustomLog /var/log/httpd/domains/%domain%.bytes bytes + CustomLog /var/log/httpd/domains/%domain%.log combined + #ErrorLog /var/log/httpd/domains/%domain%.error.log + + AllowOverride AuthConfig FileInfo Indexes Limit + SSLRequireSSL + Options +Includes -Indexes +ExecCGI + php_admin_value upload_tmp_dir %home%/%user%/tmp + php_admin_value upload_max_filesize 10M + php_admin_value max_execution_time 20 + php_admin_value post_max_size 8M + php_admin_value memory_limit 32M + php_admin_flag mysql.allow_persistent off + php_admin_flag safe_mode off + php_admin_value session.save_path %home%/%user%/tmp + php_admin_value sendmail_path '/usr/sbin/sendmail -t -i -f %email%' + + + + AllowOverride All + + php_admin_value open_basedir %home%/%user%/domains:%home%/%user%/tmp:/bin:/usr/bin:/usr/local/bin:/var/www/html:/tmp + + SSLEngine on + SSLVerifyClient none + SSLCertificateFile %ssl_cert% + SSLCertificateKeyFile %ssl_key% + + + diff --git a/data/templates/apache_default.tpl b/data/templates/apache_default.tpl new file mode 100644 index 00000000..e468a3ef --- /dev/null +++ b/data/templates/apache_default.tpl @@ -0,0 +1,34 @@ + + + ServerName %domain_idn% + ServerAlias %alias_idn% + ServerAdmin %email% + DocumentRoot %docroot% + ScriptAlias /cgi-bin/ %home%/%user%/domains/%domain%/cgi-bin/ + Alias /vstats/ %home%/%user%/domains/%domain%/stats/ + Alias /error/ %home%/%user%/domains/%domain%/document_errors/ + SuexecUserGroup %user% %group% + CustomLog /var/log/httpd/domains/%domain%.bytes bytes + CustomLog /var/log/httpd/domains/%domain%.log combined + #ErrorLog /var/log/httpd/domains/%domain%.error.log + + AllowOverride AuthConfig FileInfo Indexes Limit + Options +Includes -Indexes +ExecCGI + php_admin_value upload_tmp_dir %home%/%user%/tmp + php_admin_value upload_max_filesize 10M + php_admin_value max_execution_time 20 + php_admin_value post_max_size 8M + php_admin_value memory_limit 32M + php_admin_flag mysql.allow_persistent off + php_admin_flag safe_mode off + php_admin_value session.save_path %home%/%user%/tmp + php_admin_value sendmail_path '/usr/sbin/sendmail -t -i -f %email%' + + + + AllowOverride All + + php_admin_value open_basedir %home%/%user%/domains:%home%/%user%/tmp:/bin:/usr/bin:/usr/local/bin:/var/www/html:/tmp + + + diff --git a/data/templates/apache_phpcgi.descr b/data/templates/apache_phpcgi.descr new file mode 100644 index 00000000..cd536635 --- /dev/null +++ b/data/templates/apache_phpcgi.descr @@ -0,0 +1,3 @@ +# Template with php as cgi for better security. +# (it uses post instal script) +PHP='cgi' CGI='yes' ELOG='no' diff --git a/data/templates/apache_phpcgi.sh b/data/templates/apache_phpcgi.sh new file mode 100755 index 00000000..d4b9c92b --- /dev/null +++ b/data/templates/apache_phpcgi.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# Adding php wrapper +user="$1" +domain="$2" +ip="$3" +home_dir="$4" +docroot="$5" +port="$6" + +wrapper_script='#!/usr/bin/php-cgi -cphp5-cgi.ini' +wrapper_file="$home_dir/$user/domains/$domain/cgi-bin/php" + +echo "$wrapper_script" > $wrapper_file +chown $user:$user $wrapper_file +chmod -f 751 $wrapper_file + +exit 0 diff --git a/data/templates/apache_phpcgi.stpl b/data/templates/apache_phpcgi.stpl new file mode 100644 index 00000000..27b83989 --- /dev/null +++ b/data/templates/apache_phpcgi.stpl @@ -0,0 +1,40 @@ + + + ServerName %domain_idn% + ServerAlias %alias_idn% + ServerAdmin %email% + DocumentRoot %docroot% + ScriptAlias /cgi-bin/ %home%/%user%/domains/%domain%/cgi-bin/ + Alias /vstats/ %home%/%user%/domains/%domain%/stats/ + Alias /error/ %home%/%user%/domains/%domain%/document_errors/ + SuexecUserGroup %user% %group% + CustomLog /var/log/httpd/domains/%domain%.bytes bytes + CustomLog /var/log/httpd/domains/%domain%.log combined + #ErrorLog /var/log/httpd/domains/%domain%.error.log + + AllowOverride AuthConfig FileInfo Indexes Limit + SSLRequireSSL + Options +Includes -Indexes +ExecCGI + php_admin_value upload_tmp_dir %home%/%user%/tmp + php_admin_value upload_max_filesize 10M + php_admin_value max_execution_time 20 + php_admin_value post_max_size 8M + php_admin_value memory_limit 32M + php_admin_flag mysql.allow_persistent off + php_admin_flag safe_mode off + php_admin_value session.save_path %home%/%user%/tmp + php_admin_value sendmail_path '/usr/sbin/sendmail -t -i -f %email%' + + + + AllowOverride All + + php_admin_value open_basedir %home%/%user%/domains:%home%/%user%/tmp:/bin:/usr/bin:/usr/local/bin:/var/www/html:/tmp + + SSLEngine on + SSLVerifyClient none + SSLCertificateFile %ssl_cert% + SSLCertificateKeyFile %ssl_key% + + + diff --git a/data/templates/apache_phpcgi.tpl b/data/templates/apache_phpcgi.tpl new file mode 100644 index 00000000..153e1d46 --- /dev/null +++ b/data/templates/apache_phpcgi.tpl @@ -0,0 +1,30 @@ + + + ServerName %domain_idn% + ServerAlias %alias_idn% + ServerAdmin %email% + DocumentRoot %docroot% + ScriptAlias /cgi-bin/ %home%/%user%/domains/%domain%/cgi-bin/ + Alias /vstats/ %home%/%user%/domains/%domain%/stats/ + Alias /error/ %home%/%user%/domains/%domain%/document_errors/ + SuexecUserGroup %user% %group% + CustomLog /var/log/httpd/domains/%domain%.bytes bytes + CustomLog /var/log/httpd/domains/%domain%.log combined + #ErrorLog /var/log/httpd/domains/%domain%.error.log + + AllowOverride AuthConfig FileInfo Indexes Limit + Options +Includes -Indexes +ExecCGI + + php_admin_flag engine off + + Action phpcgi-script /cgi-bin/php + AddHandler phpcgi-script .php + + + + + AllowOverride All + + + + diff --git a/data/templates/apache_unlim.descr b/data/templates/apache_unlim.descr new file mode 100644 index 00000000..95a96802 --- /dev/null +++ b/data/templates/apache_unlim.descr @@ -0,0 +1,2 @@ +# Almost unlimited php options and vhost configuration. +PHP='module' CGI='yes' ELOG='yes' diff --git a/data/templates/apache_unlim.stpl b/data/templates/apache_unlim.stpl new file mode 100644 index 00000000..326ac228 --- /dev/null +++ b/data/templates/apache_unlim.stpl @@ -0,0 +1,40 @@ + + + ServerName %domain_idn% + ServerAlias %alias_idn% + ServerAdmin %email% + DocumentRoot %docroot% + ScriptAlias /cgi-bin/ %home%/%user%/domains/%domain%/cgi-bin/ + Alias /vstats/ %home%/%user%/domains/%domain%/stats/ + Alias /error/ %home%/%user%/domains/%domain%/document_errors/ + SuexecUserGroup %user% %group% + CustomLog /var/log/httpd/domains/%domain%.bytes bytes + CustomLog /var/log/httpd/domains/%domain%.log combined + ErrorLog /var/log/httpd/domains/%domain%.error.log + + AllowOverride All + SSLRequireSSL + Options +Includes -Indexes +ExecCGI + php_admin_value upload_tmp_dir %home%/%user%/tmp + php_admin_value upload_max_filesize 60M + php_admin_value max_execution_time 60 + php_admin_value post_max_size 60M + php_admin_value memory_limit 60M + php_admin_flag mysql.allow_persistent off + php_admin_flag safe_mode off + php_admin_value session.save_path %home%/%user%/tmp + php_admin_value sendmail_path '/usr/sbin/sendmail -t -i -f %email%' + + + + AllowOverride All + + php_admin_value open_basedir none + + SSLEngine on + SSLVerifyClient none + SSLCertificateFile %ssl_cert% + SSLCertificateKeyFile %ssl_key% + + + diff --git a/data/templates/apache_unlim.tpl b/data/templates/apache_unlim.tpl new file mode 100644 index 00000000..b08f254b --- /dev/null +++ b/data/templates/apache_unlim.tpl @@ -0,0 +1,34 @@ + + + ServerName %domain_idn% + ServerAlias %alias_idn% + ServerAdmin %email% + DocumentRoot %docroot% + ScriptAlias /cgi-bin/ %home%/%user%/domains/%domain%/cgi-bin/ + Alias /vstats/ %home%/%user%/domains/%domain%/stats/ + Alias /error/ %home%/%user%/domains/%domain%/document_errors/ + SuexecUserGroup %user% %group% + CustomLog /var/log/httpd/domains/%domain%.bytes bytes + CustomLog /var/log/httpd/domains/%domain%.log combined + ErrorLog /var/log/httpd/domains/%domain%.error.log + + AllowOverride All + Options +Includes -Indexes +ExecCGI + php_admin_value upload_tmp_dir %home%/%user%/tmp + php_admin_value upload_max_filesize 60M + php_admin_value max_execution_time 60 + php_admin_value post_max_size 60M + php_admin_value memory_limit 60M + php_admin_flag mysql.allow_persistent off + php_admin_flag safe_mode off + php_admin_value session.save_path %home%/%user%/tmp + php_admin_value sendmail_path '/usr/sbin/sendmail -t -i -f %email%' + + + + AllowOverride All + + php_admin_value open_basedir none + + + diff --git a/data/templates/awstats.tpl b/data/templates/awstats.tpl new file mode 100644 index 00000000..6152863a --- /dev/null +++ b/data/templates/awstats.tpl @@ -0,0 +1,131 @@ +LogFile="/var/log/httpd/domains/%domain%.log" +LogType="W" +LogFormat="1" +LogSeparator=" " +SiteDomain="%domain%" +HostAliases="%alias%" +DNSLookup="2" +DirData="%home%/%user%/domains/%domain%/stats/" +DirCgi="/awstats" +DirIcons="/awstatsicons" +AllowToUpdateStatsFromBrowser="0" +AllowFullYearView="3" +EnableLockForUpdate=0 +DNSStaticCacheFile="dnscache.txt" +DNSLastUpdateCacheFile="dnscachelastupdate.txt" +SkipDNSLookupFor="" +AllowAccessFromWebToAuthenticatedUsersOnly=0 +AllowAccessFromWebToFollowingAuthenticatedUsers="" +AllowAccessFromWebToFollowingIPAddresses="" +CreateDirDataIfNotExists=0 +BuildHistoryFormat=text +BuildReportFormat=html +SaveDatabaseFilesWithPermissionsForEveryone=0 +PurgeLogFile=0 +ArchiveLogRecords=0 +KeepBackupOfHistoricFiles=0 +DefaultFile="index.html" +SkipHosts="" +SkipUserAgents="" +SkipFiles="" +SkipReferrersBlackList="" +OnlyHosts="" +OnlyUserAgents="" +OnlyFiles="" +NotPageList="css js class gif jpg jpeg png bmp ico swf" +ValidHTTPCodes="200 304" +ValidSMTPCodes="1 250" +AuthenticatedUsersNotCaseSensitive=0 +URLNotCaseSensitive=0 +URLWithAnchor=0 +URLQuerySeparators="?;" +URLWithQuery=0 +URLWithQueryWithOnlyFollowingParameters="" +URLWithQueryWithoutFollowingParameters="" +URLReferrerWithQuery=0 +WarningMessages=1 +ErrorMessages="" +DebugMessages=0 +NbOfLinesForCorruptedLog=50 +WrapperScript="" +DecodeUA=0 +MiscTrackerUrl="/js/awstats_misc_tracker.js" +UseFramesWhenCGI=1 +DetailedReportsOnNewWindows=1 +Expires=0 +MaxRowsInHTMLOutput=1000 +Lang="auto" +DirLang="./lang" +ShowMenu=1 +ShowSummary=UVPHB +ShowMonthStats=UVPHB +ShowDaysOfMonthStats=VPHB +ShowDaysOfWeekStats=PHB +ShowHoursStats=PHB +ShowDomainsStats=PHB +ShowHostsStats=PHBL +ShowAuthenticatedUsers=0 +ShowRobotsStats=HBL +ShowWormsStats=0 +ShowEMailSenders=0 +ShowEMailReceivers=0 +ShowSessionsStats=1 +ShowPagesStats=PBEX +ShowFileTypesStats=HB +ShowFileSizesStats=0 +ShowOSStats=1 +ShowBrowsersStats=1 +ShowScreenSizeStats=0 +ShowOriginStats=PH +ShowKeyphrasesStats=1 +ShowKeywordsStats=1 +ShowMiscStats=a +ShowHTTPErrorsStats=1 +ShowSMTPErrorsStats=0 +ShowClusterStats=0 +AddDataArrayMonthStats=1 +AddDataArrayShowDaysOfMonthStats=1 +AddDataArrayShowDaysOfWeekStats=1 +AddDataArrayShowHoursStats=1 +IncludeInternalLinksInOriginSection=0 +MaxNbOfDomain = 10 +MinHitDomain = 1 +MaxNbOfHostsShown = 10 +MinHitHost = 1 +MaxNbOfLoginShown = 10 +MinHitLogin = 1 +MaxNbOfRobotShown = 10 +MinHitRobot = 1 +MaxNbOfPageShown = 10 +MinHitFile = 1 +MaxNbOfOsShown = 10 +MinHitOs = 1 +MaxNbOfBrowsersShown = 10 +MinHitBrowser = 1 +MaxNbOfScreenSizesShown = 5 +MinHitScreenSize = 1 +MaxNbOfWindowSizesShown = 5 +MinHitWindowSize = 1 +MaxNbOfRefererShown = 10 +MinHitRefer = 1 +MaxNbOfKeyphrasesShown = 10 +MinHitKeyphrase = 1 +MaxNbOfKeywordsShown = 10 +MinHitKeyword = 1 +MaxNbOfEMailsShown = 20 +MinHitEMail = 1 +FirstDayOfWeek=1 +ShowFlagLinks="" +ShowLinksOnUrl=1 +UseHTTPSLinkForUrl="" +MaxLengthOfShownURL=64 +HTMLHeadSection="" +HTMLEndSection="" +Logo="awstats_logo6.png" +LogoLink="http://awstats.sourceforge.net" +BarWidth = 260 +BarHeight = 90 +StyleSheet="" +ExtraTrackedRowsLimit=500 +create_mode="from_scratch" +file_to_copy="" diff --git a/data/templates/dns/default.descr b/data/templates/dns/default.descr new file mode 100644 index 00000000..ba485544 --- /dev/null +++ b/data/templates/dns/default.descr @@ -0,0 +1 @@ +# Default template with common records such as www, mail, ftp, etc.. diff --git a/data/templates/dns/default.tpl b/data/templates/dns/default.tpl new file mode 100644 index 00000000..00d9517d --- /dev/null +++ b/data/templates/dns/default.tpl @@ -0,0 +1,9 @@ +ID='1' RECORD='@' TYPE='NS' VALUE='%ns1%.' SUSPEND='no' DATE='%date%' +ID='2' RECORD='@' TYPE='NS' VALUE='%ns2%.' SUSPEND='no' DATE='%date%' +ID='3' RECORD='@' TYPE='A' VALUE='%ip%' SUSPEND='no' DATE='%date%' +ID='4' RECORD='mail' TYPE='A' VALUE='%ip%' SUSPEND='no' DATE='%date%' +ID='5' RECORD='www' TYPE='A' VALUE='%ip%' SUSPEND='no' DATE='%date%' +ID='6' RECORD='pop' TYPE='A' VALUE='%ip%' SUSPEND='no' DATE='%date%' +ID='7' RECORD='ftp' TYPE='A' VALUE='%ip%' SUSPEND='no' DATE='%date%' +ID='8' RECORD='@' TYPE='MX' VALUE='10 mail' SUSPEND='no' DATE='%date%' +ID='9' RECORD='@' TYPE='TXT' VALUE='"v=spf1 a mx ip4:%ip% ?all"' SUSPEND='no' DATE='%date%' diff --git a/data/templates/dns/gmail.descr b/data/templates/dns/gmail.descr new file mode 100644 index 00000000..68ae2783 --- /dev/null +++ b/data/templates/dns/gmail.descr @@ -0,0 +1 @@ +# Template with MX redirected to google gmail diff --git a/data/templates/dns/gmail.tpl b/data/templates/dns/gmail.tpl new file mode 100644 index 00000000..bd3fe3ab --- /dev/null +++ b/data/templates/dns/gmail.tpl @@ -0,0 +1,16 @@ +ID='1' RECORD='@' TYPE='NS' VALUE='%ns1%.' SUSPEND='no' DATE='%date%' +ID='2' RECORD='@' TYPE='NS' VALUE='%ns2%.' SUSPEND='no' DATE='%date%' +ID='3' RECORD='@' TYPE='A' VALUE='%ip%' SUSPEND='no' DATE='%date%' +ID='4' RECORD='ftp' TYPE='A' VALUE='%ip%' SUSPEND='no' DATE='%date%' +ID='5' RECORD='localhost' TYPE='A' VALUE='127.0.0.1' SUSPEND='no' DATE='%date%' +ID='6' RECORD='mail' TYPE='CNAME' VALUE='ghs.google.com.' SUSPEND='no' DATE='%date%' +ID='7' RECORD='pop' TYPE='A' VALUE='%ip%' SUSPEND='no' DATE='%date%' +ID='8' RECORD='www' TYPE='A' VALUE='%ip%' SUSPEND='no' DATE='%date%' +ID='9' RECORD='@' TYPE='MX' VALUE='1 ASPMX.L.GOOGLE.COM.' SUSPEND='no' DATE='%date%' +ID='10' RECORD='@' TYPE='MX' VALUE='5 ALT1.ASPMX.L.GOOGLE.COM.' SUSPEND='no' DATE='%date%' +ID='11' RECORD='@' TYPE='MX' VALUE='5 ALT2.ASPMX.L.GOOGLE.COM.' SUSPEND='no' DATE='%date%' +ID='12' RECORD='@' TYPE='MX' VALUE='10 ASPMX2.GOOGLEMAIL.COM.' SUSPEND='no' DATE='%date%' +ID='13' RECORD='@' TYPE='MX' VALUE='10 ASPMX3.GOOGLEMAIL.COM.' SUSPEND='no' DATE='%date%' +ID='14' RECORD='@' TYPE='MX' VALUE='10 ASPMX4.GOOGLEMAIL.COM.' SUSPEND='no' DATE='%date%' +ID='15' RECORD='@' TYPE='MX' VALUE='10 ASPMX5.GOOGLEMAIL.COM.' SUSPEND='no' DATE='%date%' +ID='16' RECORD='@' TYPE='TXT' VALUE='"v=spf1 a mx ip4:%ip% ?all"' SUSPEND='no' DATE='%date%' diff --git a/data/templates/ngingx_ip.tpl b/data/templates/ngingx_ip.tpl new file mode 100644 index 00000000..96fcc845 --- /dev/null +++ b/data/templates/ngingx_ip.tpl @@ -0,0 +1,11 @@ +server { + listen %ip%:%proxy_port% default; + server_name _; + server_name_in_redirect off; + #access_log /var/log/nginx/%ip%.log main; + + location / { + proxy_pass http://%ip%:%web_port%; + } +} + diff --git a/data/templates/ngingx_vhost-default.descr b/data/templates/ngingx_vhost-default.descr new file mode 100644 index 00000000..806cbce7 --- /dev/null +++ b/data/templates/ngingx_vhost-default.descr @@ -0,0 +1,2 @@ +# Default template for static content speed optimization. +# Best in most cases. diff --git a/data/templates/ngingx_vhost-default.tpl b/data/templates/ngingx_vhost-default.tpl new file mode 100644 index 00000000..ecc21114 --- /dev/null +++ b/data/templates/ngingx_vhost-default.tpl @@ -0,0 +1,30 @@ +server { + listen %ip%:80; + server_name %domain_idn% %alias%; + server_name_in_redirect off; + #error_log /var/log/httpd/domains/%domain%.error.log error; + + location / { + proxy_pass http://%ip%:%port%; + + location ~* ^.+\.(%extentions%)$ { + root %docroot%; + access_log /var/log/httpd/domains/%domain%.log combined; + access_log /var/log/httpd/domains/%domain%.bytes bytes; + expires max; + try_files $uri @fallback; + } + } + + location = /error/ { + root %error_docroot%; + try_files $uri @fallback; + } + + location @fallback { + proxy_pass http://%ip%:%port%; + } + + location ~ /\.ht {deny all;} + location ~ /.svn/ {deny all;} +} diff --git a/data/templates/skel/document_errors/403.html b/data/templates/skel/document_errors/403.html new file mode 100644 index 00000000..68bd5f2f --- /dev/null +++ b/data/templates/skel/document_errors/403.html @@ -0,0 +1,18 @@ + + + + 403 — Forbidden + + + + + +
+
+ http://%domain% +

Forbidden
403

+

Unfortunately, you do not have permission to view this.

+
+ + + diff --git a/data/templates/skel/document_errors/404.html b/data/templates/skel/document_errors/404.html new file mode 100644 index 00000000..6fc5eccc --- /dev/null +++ b/data/templates/skel/document_errors/404.html @@ -0,0 +1,18 @@ + + + + 404 — Not Found + + + + + +
+
+ http://%domain% +

Page Not Found
404

+

It seems that the page you were trying to reach does not exist anymore, or maybe it has just moved. You can start again from the home or go back to previous page.

+
+ + + diff --git a/data/templates/skel/document_errors/50x.html b/data/templates/skel/document_errors/50x.html new file mode 100644 index 00000000..1fee5157 --- /dev/null +++ b/data/templates/skel/document_errors/50x.html @@ -0,0 +1,18 @@ + + + + 500 — Internal Sever Error + + + + + +
+
+ http://%domain% +

Internal Sever Error
500

+

Sorry, something went wrong :(

+
+ + + diff --git a/data/templates/skel/public_html/index.html b/data/templates/skel/public_html/index.html new file mode 100644 index 00000000..f757746f --- /dev/null +++ b/data/templates/skel/public_html/index.html @@ -0,0 +1,21 @@ + + + + %domain% — coming soon + + + + + +
+

%domain%

+

+ apache + + nginx + + percona + + vesta +

+
+ + + diff --git a/data/templates/skel/public_html/robots.txt b/data/templates/skel/public_html/robots.txt new file mode 100644 index 00000000..00ee83dc --- /dev/null +++ b/data/templates/skel/public_html/robots.txt @@ -0,0 +1,3 @@ +# vestacp autogenerated robots.txt +User-agent: * +Crawl-delay: 10 diff --git a/data/templates/skel/public_shtml/index.html b/data/templates/skel/public_shtml/index.html new file mode 100644 index 00000000..f757746f --- /dev/null +++ b/data/templates/skel/public_shtml/index.html @@ -0,0 +1,21 @@ + + + + %domain% — coming soon + + + + + +
+

%domain%

+

+ apache + + nginx + + percona + + vesta +

+
+ + + diff --git a/data/templates/skel/public_shtml/robots.txt b/data/templates/skel/public_shtml/robots.txt new file mode 100644 index 00000000..00ee83dc --- /dev/null +++ b/data/templates/skel/public_shtml/robots.txt @@ -0,0 +1,3 @@ +# vestacp autogenerated robots.txt +User-agent: * +Crawl-delay: 10 diff --git a/data/templates/webalizer.tpl b/data/templates/webalizer.tpl new file mode 100644 index 00000000..6442ce08 --- /dev/null +++ b/data/templates/webalizer.tpl @@ -0,0 +1,110 @@ +HostName %domain_idn% +LogFile /var/log/httpd/domains/%domain%.log +OutputDir %home%/%user%/domains/%domain%/stats +HistoryName %home%/%user%/domains/%domain%/stats/%domain%.hist +Incremental yes +IncrementalName %home%/%user%/domains/%domain%/stats/%domain%.current +PageType htm* +PageType cgi +PageType php +PageType shtml +DNSCache /var/lib/webalizer/dns_cache.db +DNSChildren 10 +Quiet yes +FoldSeqErr yes +IndexAlias index.php +HideURL *.gif +HideURL *.GIF +HideURL *.jpg +HideURL *.JPG +HideURL *.png +HideURL *.PNG +HideURL *.ra +SearchEngine abcsearch. terms= +SearchEngine alexa. q= +SearchEngine alltheweb. q= +SearchEngine alltheweb. query= +SearchEngine alot. q= +SearchEngine altavista. q= +SearchEngine aolsearch. query= +SearchEngine aport.ru r= +SearchEngine ask. q= +SearchEngine atlas.cz q= +SearchEngine bbc. q= +SearchEngine bing. q= +SearchEngine blingo. q= +SearchEngine blogs.yandex.ru text= +SearchEngine btopenworld query= +SearchEngine buscador.ya.com q= +SearchEngine busca. q= +SearchEngine business. query= +SearchEngine centrum.cz q= +SearchEngine chiff. q= +SearchEngine clusty. query= +SearchEngine comcast. q= +SearchEngine crawler. q= +SearchEngine cuil. q= +SearchEngine dmoz. search= +SearchEngine dogpile.com q= +SearchEngine dpxml qkw= +SearchEngine eureka. searchword= +SearchEngine euroseek. string= +SearchEngine exalead. q= +SearchEngine excite search= +SearchEngine ezilon. q= +SearchEngine fastbrowsersearch. q= +SearchEngine feedster.com q= +SearchEngine fireball.de q= +SearchEngine fireball. keyword= +SearchEngine freeserve. q= +SearchEngine gigablast. q= +SearchEngine gogo.ru q= +SearchEngine go.mail.ru q= +SearchEngine google. q= +SearchEngine hakia. q= +SearchEngine hotbot. query= +SearchEngine infoseek. qt= +SearchEngine iwon searchfor= +SearchEngine ixquick.com query= +SearchEngine joeant. keywords= +SearchEngine jyxo.cz s= +SearchEngine looksmart. key= +SearchEngine lycos. query= +SearchEngine mamma. q= +SearchEngine metacrawler q= +SearchEngine msn. MT= +SearchEngine msxml qkw= +SearchEngine mysearch. searchfor= +SearchEngine mywebsearch. searchfor= +SearchEngine netscape. q= +SearchEngine nigma.ru q= +SearchEngine northernlight. qr= +SearchEngine ntlworld. q= +SearchEngine orange. q= +SearchEngine overture. Keywords= +SearchEngine punto.ru text= +SearchEngine rambler. keyword= +SearchEngine search.aol. q= +SearchEngine search.babylon. q= +SearchEngine search.centrum. phrase= +SearchEngine search.conduit. q= +SearchEngine search.earthlink q= +SearchEngine search.icq. q= +SearchEngine search.live.com q= +SearchEngine search.rambler.ru words= +SearchEngine search.winamp. q= +SearchEngine searchy. q= +SearchEngine seznam.cz w= +SearchEngine snap. query= +SearchEngine teoma. q= +SearchEngine teradex.com q= +SearchEngine ukplus key= +SearchEngine verizon. q= +SearchEngine virginmedia. q= +SearchEngine voila. rdata= +SearchEngine webcrawler searchText= +SearchEngine web.search.naver. query= +SearchEngine wisenut q= +SearchEngine yahoo. p= +SearchEngine yandex. text= +SearchEngine yodao. q= diff --git a/func/cert_func.sh b/func/cert_func.sh new file mode 100644 index 00000000..2c71504c --- /dev/null +++ b/func/cert_func.sh @@ -0,0 +1,128 @@ +is_cert_free() { + # Defining path + user_cert="$V_USERS/$user/cert/$cert" + + # Checking file existance + if [ -e "$user_cert.crt" ] || [ -e "$user_cert.key" ]; then + echo "Error: certificate exist" + log_event 'debug' "$E_CERT_EXIST $V_EVENT" + exit $E_CERT_EXIST + fi +} + +is_cert_valid() { + path="$1" + + # Checking file existance + if [ ! -e "$path/$cert.crt" ] || [ ! -e "$path/$cert.key" ]; then + echo "Error: certificate not exist" + log_event 'debug' "$E_CERT_NOTEXIST $V_EVENT" + exit $E_CERT_NOTEXIST + fi + + # Checking crt file + crt=$(openssl verify "$path/$cert.crt" 2>/dev/null|tail -n 1|grep -w 'OK') + if [ -z "$crt" ]; then + echo "Error: certificate invalid" + log_event 'debug' "$E_CERT_INVALID $V_EVENT" + exit $E_CERT_INVALID + fi + + # Checking key file + key=$(openssl rsa -in "$path/$cert.key" -check 2>/dev/null|\ + head -n1|grep -w 'ok') + if [ -z "$key" ]; then + echo "Error: key invalid" + log_event 'debug' "$E_KEY_INVALID $V_EVENT" + exit $E_KEY_INVALID + fi + + # FIXME we should run server on free port + # Checking server + cmd="openssl s_server -quiet -cert $path/$cert.crt -key $path/$cert.key" + $cmd & + + # Defining pid + pid=$! + + # Sleep 1 second + sleep 1 + + # Disown background process + disown > /dev/null 2>&1 + + # Killing ssl server + kill $pid > /dev/null 2>&1 + + # Checking result + result=$? + if [ "$result" -ne '0' ]; then + echo "Error: certificate key pair invalid" + log_event 'debug' "$E_CERTKEY_INVALID $V_EVENT" + exit $E_CERTKEY_INVALID + fi +} + +is_cert_used() { + # Parsing config + check_cert=$(grep "SSL_CERT='$cert'" $V_USERS/$user/web_domains.conf) + + # Checking result + if [ ! -z "$check_cert" ]; then + echo "Error: certificate used" + log_event 'debug' "$E_CERT_USED $V_EVENT" + exit $E_CERT_USED + fi +} + +cert_json_list() { + + # Definigng variables + i='1' # iterator + j='1' # iterator + end=$(($limit + $offset)) # last string + + # Print top bracket + echo '[' + + # Checking certificates number + last=$(ls $V_USERS/$user/cert/|grep '.crt' | wc -l) + + # Listing files by mask + for cert in $(ls $V_USERS/$user/cert/|grep '.crt'); do + # Checking offset and limit + if [ "$i" -ge "$offset" ] && [ "$i" -lt "$end" ] && [ "$offset" -gt 0 ] + then + if [ "$i" -ne "$last" ] && [ "$j" -ne "$limit" ]; then + echo -e "\t\"${cert//.crt/}\"," + else + echo -e "\t\"${cert//.crt/}\"" + fi + j=$(($j + 1)) + fi + i=$(($i + 1)) + done + + # Printing bottom bracket + echo -e "]" +} + +cert_shell_list() { + i='1' # iterator + end=$(($limit + $offset)) # last string + + # Print brief info + echo "Certificate" + echo "----------" + + # Listing files by mask + for cert in $(ls $V_USERS/$user/cert/|grep '.crt'); do + # Checking offset and limit + if [ "$i" -ge "$offset" ] && [ "$i" -lt "$end" ] && [ "$offset" -gt 0 ] + then + # Print result + echo "${cert//.crt/}" + fi + i=$(($i + 1)) + done +} diff --git a/func/cron_func.sh b/func/cron_func.sh new file mode 100644 index 00000000..0b78796a --- /dev/null +++ b/func/cron_func.sh @@ -0,0 +1,237 @@ +get_next_cron_string() { + # Parsing config + curr_str=$(grep "JOB=" $V_USERS/$user/crontab.conf|cut -f 2 -d \'|\ + sort -n|tail -n1) + + # Print result + echo "$((curr_str +1))" +} + +is_cron_job_free() { + # Checking record id + check_job=$(grep "JOB='$job'" $V_USERS/$user/crontab.conf) + + if [ ! -z "$check_job" ]; then + echo "Error: job exist" + log_event 'debug' "$E_JOB_EXIST $V_EVENT" + exit $E_JOB_EXIST + fi +} + +sort_cron_jobs() { + # Defining conf + conf="$V_USERS/$user/crontab.conf" + cat $conf |sort -n -k 2 -t \' >$conf.tmp + mv -f $conf.tmp $conf +} + +sync_cron_jobs() { + conf="/var/spool/cron/$user" + + # Deleting old data + rm -f $conf + + # Checking reporting system + rep=$(grep 'REPORTS=' $V_USERS/$user/user.conf | cut -f 2 -d \') + if [ "$rep" = 'yes' ]; then + email=$(grep 'CONTACT=' $V_USERS/$user/user.conf | cut -f 2 -d \') + echo "MAILTO=$email" >$conf + fi + + # Reading user crontab.conf + while read line ; do + # Defining new delimeter + IFS=$'\n' + + # Parsing key=value + for key in $(echo $line|sed -e "s/' /'\n/g"); do + eval ${key%%=*}="${key#*=}" + done + + if [ "$SUSPEND" = 'no' ] ; then + # Adding line to system cron + echo "$MIN $HOUR $DAY $MONTH $WDAY $CMD" |\ + sed -e "s/%quote%/'/g" -e "s/%dots%/:/g" >> $conf + fi + done <$V_USERS/$user/crontab.conf +} + + +is_job_valid() { + result=$(grep "JOB='$job'" $V_USERS/$user/crontab.conf) + + if [ -z "$result" ]; then + echo "Error: job not exists" + log_event 'debug' "$E_JOB_NOTEXIST $V_EVENT" + exit $E_JOB_NOTEXIST + fi +} + +del_cron_job() { + str=$(grep -n "JOB='$job'" $V_USERS/$user/crontab.conf|cut -f 1 -d :) + sed -i "$str d" $V_USERS/$user/crontab.conf +} + +crn_json_list() { + i='1' # iterator + end=$(($limit + $offset)) # last string + + # Print top bracket + echo '{' + + # Reading file line by line + while read line ; do + # Checking offset and limit + if [ "$i" -ge "$offset" ] && [ "$i" -lt "$end" ] && [ "$offset" -gt 0 ] + then + # Defining new delimeter + IFS=$'\n' + # Parsing key=value + for key in $(echo $line|sed -e "s/' /'\n/g"); do + eval ${key%%=*}="${key#*=}" + done + + # Checking !first line to print bracket + if [ "$i" -ne "$offset" ]; then + echo -e "\t}," + fi + + j=1 # local loop iterator + last_word=$(echo "$fields" | wc -w) + + # Restoring old delimeter + IFS=' ' + # Print data + for field in $fields; do + eval value=\"$field\" + value=$(echo "$value"|sed -e 's/"/\\"/g' -e "s/%quote%/'/g") + + # Checking parrent key + if [ "$j" -eq 1 ]; then + echo -e "\t\"$value\": {" + else + if [ "$j" -eq "$last_word" ]; then + echo -e "\t\t\"${field//$/}\": \"${value//,/, }\"" + else + echo -e "\t\t\"${field//$/}\": \"${value//,/, }\"," + fi + fi + j=$(($j + 1)) + done + fi + i=$(($i + 1)) + done < $conf + + # If there was any output + if [ -n "$value" ]; then + echo -e "\t}" + fi + + # Printing bottom json bracket + echo -e "}" +} + +crn_shell_list() { + i='1' # iterator + end=$(($limit + $offset)) # last string + + # Print brief info + echo "${fields//$/}" + for a in $(echo ${fields//\~/ /}); do + echo -e "-----~\c" + done + echo + + + # Reading file line by line + while read line ; do + # Checking offset and limit + if [ "$i" -ge "$offset" ] && [ "$i" -lt "$end" ] && [ "$offset" -gt 0 ] + then + # Defining new delimeter + IFS=$'\n' + # Parsing key=value + for key in $(echo $line|sed -e "s/' /'\n/g"); do + eval ${key%%=*}="${key#*=}" + done + # Print result line + eval echo "\"$fields\""|sed -e "s/%quote%/'/g" + fi + i=$(($i + 1)) + done < $conf +} + +is_job_suspended() { + # Parsing jobs + str=$(grep "JOB='$job'" $V_USERS/$user/crontab.conf|grep "SUSPEND='yes'" ) + + # Checkng key + if [ ! -z "$str" ]; then + echo "Error: job suspended" + log_event 'debug' "$E_JOB_SUSPENDED $V_EVENT" + exit $E_JOB_SUSPENDED + fi +} + +is_job_unsuspended() { + # Parsing jobs + str=$(grep "JOB='$job'" $V_USERS/$user/crontab.conf|grep "SUSPEND='no'" ) + + # Checkng key + if [ ! -z "$str" ]; then + echo "Error: job unsuspended" + log_event 'debug' "$E_JOB_UNSUSPENDED $V_EVENT" + exit $E_JOB_UNSUSPENDED + fi +} + +update_cron_job_value() { + key="$1" + value="$2" + + # Defining conf + conf="$V_USERS/$user/crontab.conf" + + # Parsing conf + job_str=$(grep -n "JOB='$job'" $conf) + str_number=$(echo $job_str | cut -f 1 -d ':') + str=$(echo $job_str | cut -f 2 -d ':') + + # Parsing key=value + IFS=$'\n' + for keys in $(echo $str|sed -e "s/' /'\n/g"); do + eval ${keys%%=*}=${keys#*=} + done + + # Defining clean key + c_key=$(echo "${key//$/}") + + eval old="${key}" + + # Escaping slashes + old=$(echo "$old" | sed -e 's/\\/\\\\/g' -e 's/&/\\&/g' -e 's/\//\\\//g') + new=$(echo "$value" | sed -e 's/\\/\\\\/g' -e 's/&/\\&/g' -e 's/\//\\\//g') + + # Updating conf + sed -i "$str_number s/$c_key='${old//\*/\\*}'/$c_key='${new//\*/\\*}'/g" \ + $conf +} + +cron_clear_search() { + # Defining delimeter + IFS=$'\n' + + # Reading file line by line + for line in $(grep $search_string $conf); do + + # Defining new delimeter + IFS=$'\n' + # Parsing key=value + for key in $(echo $line|sed -e "s/' /'\n/g"); do + eval ${key%%=*}=${key#*=} + done + + # Print result line + eval echo "$field" + done +} diff --git a/func/db_func.sh b/func/db_func.sh new file mode 100644 index 00000000..9603e4db --- /dev/null +++ b/func/db_func.sh @@ -0,0 +1,965 @@ +is_db_valid() { + config="$V_USERS/$user/db.conf" + check_db=$(grep "DB='$database'" $config) + + # Checking result + if [ -z "$check_db" ]; then + echo "Error: db not added" + log_event 'debug' "$E_DB_NOTEXIST $V_EVENT" + exit $E_DB_NOTEXIST + fi +} + +is_db_new() { + # Parsing domain values + check_db=$(grep -F "DB='$database'" $V_USERS/$user/db.conf) + + # Checking result + if [ ! -z "$check_db" ]; then + echo "Error: db exist" + log_event 'debug' "$E_DB_EXIST $V_EVENT" + exit $E_DB_EXIST + fi +} + +# Shell list for single database +db_shell_single_list() { + + # Reading file line by line + line=$(grep "DB='$database'" $conf) + + # Parsing key=value + for key in $line; do + eval ${key%%=*}=${key#*=} + done + + # Print result line + for field in $fields; do + eval key="$field" + echo "${field//$/}: $key " + done +} + +# Json single list +db_json_single_list() { + i=1 + + # Define words number + last_word=$(echo "$fields" | wc -w) + + # Reading file line by line + line=$(grep "DB='$database'" $conf) + + # Print top bracket + echo '{' + + # Parsing key=value + for key in $line; do + eval ${key%%=*}=${key#*=} + done + + # Starting output loop + for field in $fields; do + + # Parsing key=value + eval value=$field + + # Checking first field + if [ "$i" -eq 1 ]; then + echo -e "\t\"$value\": {" + else + if [ "$last_word" -eq "$i" ]; then + echo -e "\t\t\"${field//$/}\": \"${value//,/, }\"" + else + echo -e "\t\t\"${field//$/}\": \"${value//,/, }\"," + fi + fi + + # Updating iterator + i=$(( i + 1)) + done + + # If there was any output + if [ -n "$value" ]; then + echo -e "\t}" + fi + + # Printing bottom json bracket + echo -e "}" +} + +# Shell list for single database host +dbhost_shell_single_list() { + + # Reading file line by line + line=$(grep "HOST='$host'" $conf) + + # Parsing key=value + for key in $line; do + eval ${key%%=*}=${key#*=} + done + + # Print result line + for field in $fields; do + eval key="$field" + echo "${field//$/}: $key" + done +} + +# Json list for single db host +dbhost_json_single_list() { + + # Definigng variables + i=1 # iterator + + # Define words number + last_word=$(echo "$fields" | wc -w) + + # Reading file line by line + line=$(grep "HOST='$host'" $conf) + + # Print top bracket + echo '{' + + # Parsing key=value + for key in $line; do + eval ${key%%=*}=${key#*=} + done + + # Starting output loop + for field in $fields; do + + # Parsing key=value + eval value=$field + + # Checking first field + if [ "$i" -eq 1 ]; then + echo -e "\t\"$value\": {" + else + if [ "$last_word" -eq "$i" ]; then + echo -e "\t\t\"${field//$/}\": \"${value//,/, }\"" + else + echo -e "\t\t\"${field//$/}\": \"${value//,/, }\"," + fi + fi + + # Updating iterator + i=$(( i + 1)) + done + # If there was any output + if [ -n "$value" ]; then + echo -e "\t}" + fi + + # Printing bottom json bracket + echo -e "}" +} + +# Checking database host existance +is_db_host_valid() { + config="$V_DB/$type.conf" + check_db=$(grep "HOST='$host'" $config) + + # Checking result + if [ -z "$check_db" ]; then + echo "Error: host not added" + log_event 'debug' "$E_DBHOST_NOTEXIST $V_EVENT" + exit $E_DBHOST_NOTEXIST + fi +} + +get_next_db_host() { + # Defining vars + config="$V_DB/$type.conf" + host="empty" + host_str=$(grep "ACTIVE='yes'" $config) + + # Checking rows count + check_row=$(echo "$host_str"|wc -l) + + # Checking empty result + if [ 0 -eq "$check_row" ]; then + echo "$host" + exit + fi + + # Checking one host + if [ 1 -eq "$check_row" ]; then + for key in $host_str; do + eval ${key%%=*}="${key#*=}" + done + users=$(echo -e "${U_SYS_USERS//,/\n}"|wc -l) + if [ "$MAX_DB" -gt "$U_DB_BASES" ] && [ $MAX_USERS -gt "$users" ];then + host=$HOST + fi + + echo "$host" + exit + fi + + # Defining balancing function + weight_balance() { + ow='100' # old_weght + IFS=$'\n' + for db in $host_str; do + for key in $(echo $db|sed -e "s/' /'\n/g"); do + eval ${key%%=*}="${key#*=}" + done + weight=$(echo "$U_DB_BASES * 100 / $MAX_DB"|bc) + users=$(echo -e "${U_SYS_USERS//,/\n}"|wc -l) + + if [ "$ow" -gt "$weight" ] && [ $MAX_USERS -gt "$users" ]; then + host="$HOST" + ow="$weight" + fi + done + } + + # Defining random balancing function + random_balance() { + # Parsing host pool + HOST_LIST='' + IFS=$'\n' + for db in $host_str; do + for key in $(echo $db|sed -e "s/' /'\n/g"); do + eval ${key%%=*}="${key#*=}" + done + + users=$(echo -e "${U_SYS_USERS//,/\n}"|wc -l) + + if [ "$MAX_DB" -gt "$U_DB_BASES" ] && [ $MAX_USERS -gt "$users" ] + then + HOST_LIST="$HOST_LIST$HOST " + fi + done + + # Checking one host + if [ 2 -eq $(echo -e "${HOST_LIST// /\n}"|wc -l) ]; then + host="${HOST_LIST// /\n}"# should test with disabled host + else + # Selecting all hosts + HOSTS=($(echo -e "${HOST_LIST// /\n}")) + num=${#HOSTS[*]} + host="${HOSTS[$((RANDOM%num))]}" + fi + } + + # Defining first balancing function + first_balance() { + # Parsing host pool + IFS=$'\n' + for db in $host_str; do + for key in $(echo $db|sed -e "s/' /'\n/g"); do + eval ${key%%=*}="${key#*=}" + done + + users=$(echo -e "${U_SYS_USERS//,/\n}"|wc -l) + if [ "$MAX_DB" -gt "$U_DB_BASES" ] && [ $MAX_USERS -gt "$users" ] + then + host="$HOST" + break + fi + done + } + + # Parsing domain values + db_balance=$(grep "DB_BALANCE='" $V_CONF/vesta.conf|cut -f 2 -d \') + + case $db_balance in + weight) weight_balance "$config" ;; + random) random_balance "$config" ;; + first) first_balance "$config" ;; + *) random_balance "$config" ;; + esac + echo "$host" +} + +increase_db_value() { + # Defining vars + conf="$V_DB/$type.conf" + host_str=$(grep "HOST='$host'" $conf) + + for key in $host_str; do + eval ${key%%=*}=${key#*=} + done + + # Increasing db_bases usage value + U_DB_BASES=$((U_DB_BASES + 1)) + # Adding user to SYS_USERS pool + if [ -z "$U_SYS_USERS" ]; then + U_SYS_USERS="$user" + else + check_users=$(echo $U_SYS_USERS|sed -e "s/,/\n/g"|grep -w "$user") + if [ -z "$check_users" ]; then + U_SYS_USERS="$U_SYS_USERS,$user" + fi + fi + + # Concatenating db string + case $type in + mysql) new_str="HOST='$HOST' USER='$USER' PASSWORD='$PASSWORD'"; + new_str="$new_str PORT='$PORT' MAX_USERS='$MAX_USERS'"; + new_str="$new_str MAX_DB='$MAX_DB' U_SYS_USERS='$U_SYS_USERS'"; + new_str="$new_str U_DB_BASES='$U_DB_BASES' ACTIVE='$ACTIVE'"; + new_str="$new_str DATE='$DATE'";; + pgsql) new_str="HOST='$HOST' USER='$USER' PASSWORD='$PASSWORD'"; + new_str="$new_str PORT='$PORT' TPL='$TPL'"; + new_str="$new_str MAX_USERS='$MAX_USERS' MAX_DB='$MAX_DB'"; + new_str="$new_str U_SYS_USERS='$U_SYS_USERS'"; + new_str="$new_str U_DB_BASES='$U_DB_BASES' ACTIVE='$ACTIVE'"; + new_str="$new_str DATE='$DATE'";; + esac + + # Changing config + sed -i "s/$host_str/$new_str/g" $conf +} + +decrease_db_value() { + # Defining vars + conf="$V_DB/$type.conf" + host_str=$(grep "HOST='$host'" $conf) + + for key in $host_str; do + eval ${key%%=*}=${key#*=} + done + + # Decreasing db_bases usage value + U_DB_BASES=$((U_DB_BASES - 1)) + + # Checking user databases on that host + udb=$(grep "TYPE='$type'" $V_USERS/$user/db.conf|grep "HOST='$host'"|wc -l) + if [ 2 -gt "$udb" ]; then + U_SYS_USERS=$(echo "$U_SYS_USERS" | sed -e "s/,/\n/g" |\ + sed -e "/^$user$/d" | sed -e :a -e '$!N;s/\n/,/;ta') + fi + + # Concatenating db string + case $type in + mysql) new_str="HOST='$HOST' USER='$USER' PASSWORD='$PASSWORD'"; + new_str="$new_str PORT='$PORT' MAX_USERS='$MAX_USERS'"; + new_str="$new_str MAX_DB='$MAX_DB' U_SYS_USERS='$U_SYS_USERS'"; + new_str="$new_str U_DB_BASES='$U_DB_BASES' ACTIVE='$ACTIVE'"; + new_str="$new_str DATE='$DATE'";; + pgsql) new_str="HOST='$HOST' USER='$USER' PASSWORD='$PASSWORD'"; + new_str="$new_str PORT='$PORT' TPL='$TPL'"; + new_str="$new_str MAX_USERS='$MAX_USERS' MAX_DB='$MAX_DB'"; + new_str="$new_str U_SYS_USERS='$U_SYS_USERS'"; + new_str="$new_str U_DB_BASES='$U_DB_BASES' ACTIVE='$ACTIVE'"; + new_str="$new_str DATE='$DATE'";; + esac + + # Changing config + sed -i "s/$host_str/$new_str/g" $conf +} + +create_db_mysql() { + # Defining vars + host_str=$(grep "HOST='$host'" $V_DB/mysql.conf) + for key in $host_str; do + eval ${key%%=*}=${key#*=} + done + sql="mysql -h $HOST -u $USER -p$PASSWORD -P$PORT -e" + + # Checking empty vars + if [ -z $HOST ] || [ -z $USER ] || [ -z $PASSWORD ] || [ -z $PORT ]; then + echo "Error: config is broken" + log_event 'debug' "$E_PARSE_ERROR $V_EVENT" + exit $E_PARSE_ERROR + fi + + # Checking connection + $sql "SELECT VERSION()" >/dev/null 2>&1; code="$?" + if [ '0' -ne "$code" ]; then + echo "Error: Connect failed" + log_event 'debug' "$E_DBHOST_UNAVAILABLE $V_EVENT" + exit $E_DBHOST_UNAVAILABLE + fi + + # Adding database & checking result + $sql "CREATE DATABASE $database" >/dev/null 2>&1;code="$?" + if [ '0' -ne "$code" ]; then + echo "Error: Connect failed" + log_event 'debug' "$E_DBHOST_UNAVAILABLE $V_EVENT" + exit $E_DBHOST_UNAVAILABLE + fi + + # Adding user with password (% will give access to db from any ip) + $sql "GRANT ALL ON $database.* TO '$db_user'@'%' \ + IDENTIFIED BY '$db_password'" + + # Adding grant for localhost (% doesn't do that ) + if [ "$host" = 'localhost' ]; then + $sql "GRANT ALL ON $database.* TO '$db_user'@'localhost' \ + IDENTIFIED BY '$db_password'" + fi + + # Flushing priveleges + $sql "FLUSH PRIVILEGES" +} + +create_db_pgsql() { + # Defining vars + host_str=$(grep "HOST='$host'" $V_DB/pgsql.conf) + for key in $host_str; do + eval ${key%%=*}=${key#*=} + done + + export PGPASSWORD="$PASSWORD" + sql="psql -h $HOST -U $USER -d $TPL -p $PORT -c" + + # Checking empty vars + if [ -z $HOST ] || [ -z $USER ] || [ -z $PASSWORD ] || [ -z $TPL ]; then + echo "Error: config is broken" + log_event 'debug' "$E_PARSE_ERROR $V_EVENT" + exit $E_PARSE_ERROR + fi + + # Checking connection + $sql "SELECT VERSION()" >/dev/null 2>&1;code="$?" + if [ '0' -ne "$code" ]; then + echo "Error: Connect failed" + log_event 'debug' "$E_DBHOST_UNAVAILABLE $V_EVENT" + exit $E_DBHOST_UNAVAILABLE + fi + + # Adding database & checking result + $sql "CREATE DATABASE $database" >/dev/null 2>&1;code="$?" + if [ '0' -ne "$code" ]; then + echo "Error: Connect failed" + log_event 'debug' "$E_DBHOST_UNAVAILABLE $V_EVENT" + exit $E_DBHOST_UNAVAILABLE + fi + + $sql "CREATE ROLE $db_user WITH LOGIN PASSWORD '$db_password'" + $sql "GRANT ALL PRIVILEGES ON DATABASE $database TO $db_user" + export PGPASSWORD='pgsqk' +} + +is_db_host_new() { + if [ -e "$V_DB/$type.conf" ]; then + check_host=$(grep "HOST='$host'" $V_DB/$type.conf) + if [ ! -z "$check_host" ]; then + echo "Error: db host exist" + log_event 'debug' "$E_DBHOST_EXIST $V_EVENT" + exit $E_DBHOST_EXIST + fi + fi +} + +is_mysql_host_alive() { + # Checking connection + sql="mysql -h $host -u $db_user -p$db_password -P$port -e" + $sql "SELECT VERSION()" >/dev/null 2>&1; code="$?" + if [ '0' -ne "$code" ]; then + echo "Error: Connect failed" + log_event 'debug' "$E_DBHOST_UNAVAILABLE $V_EVENT" + exit $E_DBHOST_UNAVAILABLE + fi +} + +is_pgsql_host_alive() { + # Checking connection + export PGPASSWORD="$db_password" + sql="psql -h $host -U $db_user -d $template -p $port -c" + $sql "SELECT VERSION()" >/dev/null 2>&1;code="$?" + if [ '0' -ne "$code" ]; then + echo "Error: Connect failed" + log_event 'debug' "$E_DBHOST_UNAVAILABLE $V_EVENT" + exit $E_DBHOST_UNAVAILABLE + fi +} + +is_db_suspended() { + config="$V_USERS/$user/db.conf" + check_db=$(grep "DB='$database'" $config|grep "SUSPEND='yes'") + + # Checking result + if [ ! -z "$check_db" ]; then + echo "Error: db suspended" + log_event 'debug' "$E_DB_SUSPENDED $V_EVENT" + exit $E_DB_SUSPENDED + fi +} + +is_db_unsuspended() { + config="$V_USERS/$user/db.conf" + check_db=$(grep "DB='$database'" $config|grep "SUSPEND='yes'") + + # Checking result + if [ -z "$check_db" ]; then + echo "Error: db unsuspended" + log_event 'debug' "$E_DB_UNSUSPENDED $V_EVENT" + exit $E_DB_UNSUSPENDED + fi +} + +is_db_user_valid() { + config="$V_USERS/$user/db.conf" + check_db=$(grep "DB='$database'" $config|grep "USER='$db_user'") + + # Checking result + if [ -z "$check_db" ]; then + echo "Error: dbuser not exist" + log_event 'debug' "$E_DBUSER_NOTEXIST $V_EVENT" + exit $E_DBUSER_NOTEXIST + fi +} + +change_db_mysql_password() { + # Defining vars + host_str=$(grep "HOST='$host'" $V_DB/mysql.conf) + for key in $host_str; do + eval ${key%%=*}=${key#*=} + done + sql="mysql -h $HOST -u $USER -p$PASSWORD -P$PORT -e" + + # Checking empty vars + if [ -z $HOST ] || [ -z $USER ] || [ -z $PASSWORD ] || [ -z $PORT ]; then + echo "Error: config is broken" + log_event 'debug' "$E_PARSE_ERROR $V_EVENT" + exit $E_PARSE_ERROR + fi + + # Checking connection + $sql "SELECT VERSION()" >/dev/null 2>&1; code="$?" + if [ '0' -ne "$code" ]; then + echo "Error: Connect failed" + log_event 'debug' "$E_DBHOST_UNAVAILABLE $V_EVENT" + exit $E_DBHOST_UNAVAILABLE + fi + + # Changing user password + $sql "GRANT ALL ON $database.* TO '$db_user'@'%' \ + IDENTIFIED BY '$db_password'" + #$sql "SET PASSWORD FOR '$db_user'@'%' = PASSWORD('$db_password');" + $sql "FLUSH PRIVILEGES" +} + +change_db_pgsql_password() { + # Defining vars + host_str=$(grep "HOST='$host'" $V_DB/pgsql.conf) + for key in $host_str; do + eval ${key%%=*}=${key#*=} + done + + export PGPASSWORD="$PASSWORD" + sql="psql -h $HOST -U $USER -d $TPL -p $PORT -c" + + # Checking empty vars + if [ -z $HOST ] || [ -z $USER ] || [ -z $PASSWORD ] || [ -z $TPL ]; then + echo "Error: config is broken" + log_event 'debug' "$E_PARSE_ERROR $V_EVENT" + exit $E_PARSE_ERROR + fi + + # Checking connection + $sql "SELECT VERSION()" >/dev/null 2>&1;code="$?" + if [ '0' -ne "$code" ]; then + echo "Error: Connect failed" + log_event 'debug' "$E_DBHOST_UNAVAILABLE $V_EVENT" + exit $E_DBHOST_UNAVAILABLE + fi + + $sql "ALTER ROLE $db_user WITH LOGIN PASSWORD '$db_password'" >/dev/null + export PGPASSWORD='pgsqk' +} + +get_db_value() { + # Defining vars + key="$1" + db_str=$(grep "DB='$database'" $V_USERS/$user/db.conf) + + # Parsing key=value + for keys in $db_str; do + eval ${keys%%=*}=${keys#*=} + done + + # Self reference + eval value="$key" + + # Print value + echo "$value" +} + +del_db_mysql() { + # Defining vars + host_str=$(grep "HOST='$host'" $V_DB/mysql.conf) + for key in $host_str; do + eval ${key%%=*}=${key#*=} + done + sql="mysql -h $HOST -u $USER -p$PASSWORD -P$PORT -e" + + # Checking empty vars + if [ -z $HOST ] || [ -z $USER ] || [ -z $PASSWORD ] || [ -z $PORT ]; then + echo "Error: config is broken" + log_event 'debug' "$E_PARSE_ERROR $V_EVENT" + exit $E_PARSE_ERROR + fi + + # Checking connection + $sql "SELECT VERSION()" >/dev/null 2>&1; code="$?" + if [ '0' -ne "$code" ]; then + echo "Error: Connect failed" + log_event 'debug' "$E_DBHOST_UNAVAILABLE $V_EVENT" + exit $E_DBHOST_UNAVAILABLE + fi + + # Deleting database & checking result + $sql "DROP DATABASE $database" >/dev/null 2>&1;code="$?" + if [ '0' -ne "$code" ]; then + echo "Error: Connect failed" + log_event 'debug' "$E_DBHOST_UNAVAILABLE $V_EVENT" + exit $E_DBHOST_UNAVAILABLE + fi + + # Deleting user + check_users=$(grep "USER='$db_user'" $V_USERS/$user/db.conf |wc -l) + if [ 1 -ge "$check_users" ]; then + $sql "DROP USER '$db_user'@'%'" + if [ "$host" = 'localhost' ]; then + $sql "DROP USER '$db_user'@'localhost'" + fi + else + $sql "REVOKE ALL ON $database.* from '$db_user'@'%'" + if [ "$host" = 'localhost' ]; then + $sql "REVOKE ALL ON $database.* from '$db_user'@'localhost'" + fi + fi + $sql "FLUSH PRIVILEGES" +} + +del_db_pgsql() { + # Defining vars + host_str=$(grep "HOST='$host'" $V_DB/pgsql.conf) + for key in $host_str; do + eval ${key%%=*}=${key#*=} + done + + export PGPASSWORD="$PASSWORD" + sql="psql -h $HOST -U $USER -d $TPL -p $PORT -c" + + # Checking empty vars + if [ -z $HOST ] || [ -z $USER ] || [ -z $PASSWORD ] || [ -z $TPL ]; then + echo "Error: config is broken" + log_event 'debug' "$E_PARSE_ERROR $V_EVENT" + exit $E_PARSE_ERROR + fi + + # Checking connection + $sql "SELECT VERSION()" >/dev/null 2>&1;code="$?" + if [ '0' -ne "$code" ]; then + echo "Error: Connect failed" + log_event 'debug' "$E_DBHOST_UNAVAILABLE $V_EVENT" + exit $E_DBHOST_UNAVAILABLE + fi + + # Deleting database & checking result + $sql "DROP DATABASE $database" >/dev/null 2>&1;code="$?" + if [ '0' -ne "$code" ]; then + echo "Error: Connect failed" + log_event 'debug' "$E_DBHOST_UNAVAILABLE $V_EVENT" + exit $E_DBHOST_UNAVAILABLE + fi + + # Deleting user + check_users=$(grep "USER='$db_user'" $V_USERS/$user/db.conf |wc -l) + if [ 1 -ge "$check_users" ]; then + $sql "DROP ROLE $db_user" >/dev/null 2>&1 + else + $sql "REVOKE ALL PRIVILEGES ON $database FROM $db_user">/dev/null + fi + export PGPASSWORD='pgsqk' +} + + +del_db_vesta() { + conf="$V_USERS/$user/db.conf" + + # Parsing domains + string=$( grep -n "DB='$database'" $conf | cut -f 1 -d : ) + if [ -z "$string" ]; then + echo "Error: parse error" + log_event 'debug' "$E_PARSE_ERROR $V_EVENT" + exit $E_PARSE_ERROR + fi + sed -i "$string d" $conf +} + +is_db_host_free() { + # Defining vars + host_str=$(grep "HOST='$host'" $V_DB/$type.conf) + for key in $host_str; do + eval ${key%%=*}=${key#*=} + done + + # Checking U_DB_BASES + if [ 0 -ne "$U_DB_BASES" ]; then + echo "Error: host is used" + log_event 'debug' "$E_DBHOST_BUSY $V_EVENT" + exit $E_DBHOST_BUSY + fi +} + +del_dbhost_vesta() { + conf="$V_DB/$type.conf" + + # Parsing domains + string=$( grep -n "HOST='$host'" $conf | cut -f 1 -d : ) + if [ -z "$string" ]; then + echo "Error: parse error" + log_event 'debug' "$E_PARSE_ERROR $V_EVENT" + exit $E_PARSE_ERROR + fi + sed -i "$string d" $conf +} + +update_db_base_value() { + key="$1" + value="$2" + + # Defining conf + conf="$V_USERS/$user/db.conf" + + # Parsing conf + db_str=$(grep -n "DB='$database'" $conf) + str_number=$(echo $db_str | cut -f 1 -d ':') + str=$(echo $db_str | cut -f 2 -d ':') + + # Reading key=values + for keys in $str; do + eval ${keys%%=*}=${keys#*=} + done + + # Defining clean key + c_key=$(echo "${key//$/}") + + eval old="${key}" + + # Escaping slashes + old=$(echo "$old" | sed -e 's/\\/\\\\/g' -e 's/&/\\&/g' -e 's/\//\\\//g') + new=$(echo "$value" | sed -e 's/\\/\\\\/g' -e 's/&/\\&/g' -e 's/\//\\\//g') + + # Updating conf + sed -i "$str_number s/$c_key='${old//\*/\\*}'/$c_key='${new//\*/\\*}'/g"\ + $conf +} + +suspend_db_mysql() { + # Defining vars + host_str=$(grep "HOST='$host'" $V_DB/mysql.conf) + for key in $host_str; do + eval ${key%%=*}=${key#*=} + done + sql="mysql -h $HOST -u $USER -p$PASSWORD -P$PORT -e" + + # Checking empty vars + if [ -z $HOST ] || [ -z $USER ] || [ -z $PASSWORD ] || [ -z $PORT ]; then + echo "Error: config is broken" + log_event 'debug' "$E_PARSE_ERROR $V_EVENT" + exit $E_PARSE_ERROR + fi + + # Checking connection + $sql "SELECT VERSION()" >/dev/null 2>&1; code="$?" + if [ '0' -ne "$code" ]; then + echo "Error: Connect failed" + log_event 'debug' "$E_DBHOST_UNAVAILABLE $V_EVENT" + exit $E_DBHOST_UNAVAILABLE + fi + + # Suspending user + $sql "REVOKE ALL ON $database.* FROM '$db_user'@'%'" + $sql "FLUSH PRIVILEGES" +} + +suspend_db_pgsql() { + # Defining vars + host_str=$(grep "HOST='$host'" $V_DB/pgsql.conf) + for key in $host_str; do + eval ${key%%=*}=${key#*=} + done + + export PGPASSWORD="$PASSWORD" + sql="psql -h $HOST -U $USER -d $TPL -p $PORT -c" + + # Checking empty vars + if [ -z $HOST ] || [ -z $USER ] || [ -z $PASSWORD ] || [ -z $TPL ]; then + echo "Error: config is broken" + log_event 'debug' "$E_PARSE_ERROR $V_EVENT" + exit $E_PARSE_ERROR + fi + + # Checking connection + $sql "SELECT VERSION()" >/dev/null 2>&1;code="$?" + if [ '0' -ne "$code" ]; then + echo "Error: Connect failed" + log_event 'debug' "$E_DBHOST_UNAVAILABLE $V_EVENT" + exit $E_DBHOST_UNAVAILABLE + fi + + # Suspending user + $sql "REVOKE ALL PRIVILEGES ON $database FROM $db_user">/dev/null + export PGPASSWORD='pgsqk' +} + +unsuspend_db_mysql() { + # Defining vars + host_str=$(grep "HOST='$host'" $V_DB/mysql.conf) + for key in $host_str; do + eval ${key%%=*}=${key#*=} + done + sql="mysql -h $HOST -u $USER -p$PASSWORD -P$PORT -e" + + # Checking empty vars + if [ -z $HOST ] || [ -z $USER ] || [ -z $PASSWORD ] || [ -z $PORT ]; then + echo "Error: config is broken" + log_event 'debug' "$E_PARSE_ERROR $V_EVENT" + exit $E_PARSE_ERROR + fi + + # Checking connection + $sql "SELECT VERSION()" >/dev/null 2>&1; code="$?" + if [ '0' -ne "$code" ]; then + echo "Error: Connect failed" + log_event 'debug' "$E_DBHOST_UNAVAILABLE $V_EVENT" + exit $E_DBHOST_UNAVAILABLE + fi + + # Unsuspending user + $sql "GRANT ALL ON $database.* to '$db_user'@'%'" + $sql "FLUSH PRIVILEGES" +} + +unsuspend_db_pgsql() { + # Defining vars + host_str=$(grep "HOST='$host'" $V_DB/pgsql.conf) + for key in $host_str; do + eval ${key%%=*}=${key#*=} + done + + export PGPASSWORD="$PASSWORD" + sql="psql -h $HOST -U $USER -d $TPL -p $PORT -c" + + # Checking empty vars + if [ -z $HOST ] || [ -z $USER ] || [ -z $PASSWORD ] || [ -z $TPL ]; then + echo "Error: config is broken" + log_event 'debug' "$E_PARSE_ERROR $V_EVENT" + exit $E_PARSE_ERROR + fi + + # Checking connection + $sql "SELECT VERSION()" >/dev/null 2>&1;code="$?" + if [ '0' -ne "$code" ]; then + echo "Error: Connect failed" + log_event 'debug' "$E_DBHOST_UNAVAILABLE $V_EVENT" + exit $E_DBHOST_UNAVAILABLE + fi + + # Unsuspending user + $sql "GRANT ALL PRIVILEGES ON DATABASE $database TO $db_user" >/dev/null + export PGPASSWORD='pgsqk' +} + +db_clear_search() { + # Defining delimeter + IFS=$'\n' + + # Reading file line by line + for line in $(grep $search_string $conf); do + # Parsing key=val + for key in $line; do + eval ${key%%=*}=${key#*=} + done + # Print result line + eval echo "$field" + done +} + +get_disk_db_mysql() { + # Defining vars + host_str=$(grep "HOST='$host'" $V_DB/mysql.conf) + for key in $host_str; do + eval ${key%%=*}=${key#*=} + done + sql="mysql -h $HOST -u $USER -p$PASSWORD -P$PORT -e" + + # Checking empty vars + if [ -z $HOST ] || [ -z $USER ] || [ -z $PASSWORD ] || [ -z $PORT ]; then + echo "Error: config is broken" + log_event 'debug' "$E_PARSE_ERROR $V_EVENT" + exit $E_PARSE_ERROR + fi + + # Checking connection + $sql "SELECT VERSION()" >/dev/null 2>&1; code="$?" + if [ '0' -ne "$code" ]; then + echo "Error: Connect failed" + log_event 'debug' "$E_DBHOST_UNAVAILABLE $V_EVENT" + exit $E_DBHOST_UNAVAILABLE + fi + + # Deleting database & checking result + query="SELECT sum( data_length + index_length ) / 1024 / 1024 \"Size\" + FROM information_schema.TABLES WHERE table_schema='$database'" + raw_size=$($sql "$query" |tail -n 1) + + # Checking null output (this means error btw) + if [ "$raw_size" == 'NULL' ]; then + raw_size='0' + fi + + # Rounding zero size + if [ "${raw_size:0:1}" -eq '0' ]; then + raw_size='1' + fi + + # Printing round size in mb + printf "%0.f\n" $raw_size + +} + +get_disk_db_pgsql() { + # Defining vars + host_str=$(grep "HOST='$host'" $V_DB/pgsql.conf) + for key in $host_str; do + eval ${key%%=*}=${key#*=} + done + + export PGPASSWORD="$PASSWORD" + sql="psql -h $HOST -U $USER -d $TPL -p $PORT -c" + + # Checking empty vars + if [ -z $HOST ] || [ -z $USER ] || [ -z $PASSWORD ] || [ -z $TPL ]; then + echo "Error: config is broken" + log_event 'debug' "$E_PARSE_ERROR $V_EVENT" + exit $E_PARSE_ERROR + fi + + # Checking connection + $sql "SELECT VERSION()" >/dev/null 2>&1;code="$?" + if [ '0' -ne "$code" ]; then + echo "Error: Connect failed" + log_event 'debug' "$E_DBHOST_UNAVAILABLE $V_EVENT" + exit $E_DBHOST_UNAVAILABLE + fi + + # Raw query + raq_query=$($sql "SELECT pg_database_size('$database');") + raw_size=$(echo raq_query | grep -v "-" | grep -v 'row' | sed -e "/^$/d"|\ + awk '{print $1}') + + # Checking null output (this means error btw) + if [ -z "$raw_size" ]; then + raw_size='0' + fi + + # Converting to MB + size=$(expr $raw_size \ 1048576) + + # Rounding zero size + if [ "$size" -eq '0' ]; then + echo '1' + else + echo "$size" + fi +} diff --git a/func/domain_func.sh b/func/domain_func.sh new file mode 100644 index 00000000..386bd4f8 --- /dev/null +++ b/func/domain_func.sh @@ -0,0 +1,918 @@ +# Checking domain existance +is_domain_new() { + output_mode="$1" + search_dom=${2-$domain} + + # Parsing domain values + check_domain=$(grep -F "DOMAIN='$search_dom'" $V_USERS/*/*.conf| \ + grep -v crontab.conf) + + # Parsing alias values + check_alias=$(grep -F 'ALIAS=' $V_USERS/*/*.conf | \ + grep -v crontab.conf | \ + awk -F "ALIAS=" '{print $2}' | \ + cut -f 2 -d \' | \ + sed -e "s/,/\n/g" | \ + grep "^$search_dom$" ) + + # Checking result + if [ ! -z "$check_domain" ] || [ ! -z "$check_alias" ]; then + if [ "$output_mode" != 'quiet' ]; then + echo "Error: domain exist" + log_event 'debug' "$E_DOM_EXIST $V_EVENT" + exit $E_DOM_EXIST + fi + return $E_DOM_EXIST + fi + +} + +is_domain_owner() { + search_dom=${1-$domain} + + # Parsing domain values + check_domain=$(grep "DOMAIN='$search_dom'" $V_USERS/$user/*.conf) + + # Parsing alias values + check_alias=$(grep 'ALIAS=' $V_USERS/$user/*.conf | \ + awk -F "ALIAS=" '{print $2}' | \ + cut -f 2 -d \' | \ + sed -e "s/,/\n/g" | \ + grep "^$search_dom$" ) + + # Checking result + if [ -z "$check_domain" ] && [ -z "$check_alias" ]; then + echo "Error: domain not owned" + log_event 'debug' "$E_DOM_NOTOWNED $V_EVENT" + exit $E_DOM_NOTOWNED + fi +} + +is_dns_domain_free() { + # Parsing domain values + check_domain=$(grep -F "DOMAIN='$domain'" $V_USERS/$user/dns.conf) + + # Checking result + if [ ! -z "$check_domain" ]; then + echo "Error: domain exist" + log_event 'debug' "$E_DOM_EXIST $V_EVENT" + exit $E_DOM_EXIST + fi +} + +is_web_domain_free() { + search_dom=${1-$domain} + # Parsing domain values + check_domain=$(grep -F "IN='$search_dom'" $V_USERS/$user/web_domains.conf) + + # Parsing alias values + check_alias=$(grep -F 'ALIAS=' $V_USERS/$user/web_domains.conf | \ + awk -F "ALIAS=" '{print $2}' | \ + cut -f 2 -d \' | \ + sed -e "s/,/\n/g" | \ + grep "^$check_domain$" ) + + # Checking result + if [ ! -z "$check_domain" ] || [ ! -z "$check_alias" ]; then + echo "Error: domain exist" + log_event 'debug' "$E_DOM_EXIST $V_EVENT" + exit $E_DOM_EXIST + fi +} + +is_dns_domain_valid() { + # Parsing domain values + check_domain=$(grep -F "DOMAIN='$domain'" $V_USERS/$user/dns.conf) + + # Checking result + if [ -z "$check_domain" ]; then + echo "Error: domain not exist" + log_event 'debug' "$E_DOM_NOTEXIST $V_EVENT" + exit $E_DOM_NOTEXIST + fi +} + +is_web_domain_valid() { + # Parsing domain values + check_domain=$(grep -F "DOMAIN='$domain'" $V_USERS/$user/web_domains.conf) + + # Checking result + if [ -z "$check_domain" ]; then + echo "Error: domain not exist" + log_event 'debug' "$E_DOM_NOTEXIST $V_EVENT" + exit $E_DOM_NOTEXIST + fi +} + +is_domain_suspended() { + config_type="$1" + # Parsing domain values + check_domain=$(grep "DOMAIN='$domain'" $V_USERS/$user/$config_type.conf|\ + grep "SUSPEND='yes'") + + # Checking result + if [ ! -z "$check_domain" ]; then + echo "Error: domain suspended" + log_event 'debug' "$E_DOM_SUSPENDED $V_EVENT" + exit $E_DOM_SUSPENDED + fi +} + +is_domain_unsuspended() { + config_type="$1" + # Parsing domain values + check_domain=$(grep "DOMAIN='$domain'" $V_USERS/$user/$config_type.conf|\ + grep "SUSPEND='no'") + + # Checking result + if [ ! -z "$check_domain" ]; then + echo "Error: domain unsuspended" + log_event 'debug' "$E_DOM_UNSUSPENDED $V_EVENT" + exit $E_DOM_UNSUSPENDED + fi +} + +update_domain_zone() { + # Definigng variables + line=$(grep "DOMAIN='$domain'" $V_USERS/$user/dns.conf) + fields='$RECORD\t$TTL\tIN\t$TYPE\t$VALUE' + conf="/etc/namedb/$domain.db" + + # Checking serial + if [ -e $conf ]; then + zn_serial=$(head $conf|grep 'SOA' -A1|tail -n 1|sed -e "s/ //g") + s_date=$(echo ${zn_serial:0:8}) + c_date=$(date +'%Y%m%d') + if [ "$s_date" == "$c_date" ]; then + cur_value=$(echo ${zn_serial:8} ) + new_value=$(expr $cur_value + 1 ) + len_value=$(expr length $new_value) + if [ 1 -eq "$len_value" ]; then + new_value='0'$new_value + fi + serial="$c_date""$new_value" + else + serial="$(date +'%Y%m%d01')" + fi + else + serial="$(date +'%Y%m%d01')" + fi + + # Parsing dns domains conf + for key in $line; do + eval ${key%%=*}=${key#*=} + done + + # Converting SOA to ascii + SOA=$(idn --quiet -a -t "$SOA") + # Adding zone header + echo "\$TTL $TTL +@ IN SOA $SOA. root.$domain_idn. ( + $serial + 7200 + 3600 + 1209600 + 180 ) +" > $conf + + # Adding zone records + while read line ; do + # Defining new delimeter + IFS=$'\n' + # Parsing key=value + for key in $(echo $line|sed -e "s/' /'\n/g"); do + eval ${key%%=*}="${key#*=}" + done + + # Converting utf records to ascii + RECORD=$(idn --quiet -a -t "$RECORD") + VALUE=$(idn --quiet -a -t "$VALUE") + eval echo -e "\"$fields\""|sed -e "s/%quote%/'/g" >> $conf + done < $V_USERS/$user/zones/$domain + +} + +get_next_dns_record() { + # Parsing config + curr_str=$(grep "ID=" $V_USERS/$user/zones/$domain|cut -f 2 -d \'|\ + sort -n|tail -n1) + + # Print result + echo "$((curr_str +1))" +} + +is_dns_record_free() { + # Checking record id + check_id=$(grep "ID='$id'" $V_USERS/$user/zones/$domain) + + if [ ! -z "$check_id" ]; then + echo "Error: ID exist" + log_event 'debug' "$E_ID_EXIST $V_EVENT" + exit $E_ID_EXIST + fi +} + +sort_dns_records() { + # Defining conf + conf="$V_USERS/$user/zones/$domain" + cat $conf |sort -n -k 2 -t \' >$conf.tmp + mv -f $conf.tmp $conf +} + +get_web_port() { + proxy_disabled='80' + proxy_enabled='8080' + + # Parsing conf + proxy=$(grep 'PROXY_SYSTEM=' $V_CONF/vesta.conf|cut -f 2 -d \') + + # Checking result + if [ -z "$proxy" ] || [ "$proxy" = 'off' ]; then + echo "$proxy_disabled" + else + echo "$proxy_enabled" + fi +} + +get_web_port_ssl() { + proxy_disabled='443' + proxy_enabled='8443' + + # Parsing conf + proxy=$(grep 'PROXY_SYSTEM=' $V_CONF/vesta.conf|cut -f 2 -d \') + + # Checking result + if [ -z "$proxy" ] || [ "$proxy" = 'off' ]; then + echo "$proxy_disabled" + else + echo "$proxy_enabled" + fi +} + + +httpd_add_config() { + # Adding template to config + cat $tpl_file | \ + sed -e "s/%ip%/$ip/g" \ + -e "s/%port%/$port/g" \ + -e "s/%domain_idn%/$domain_idn/g" \ + -e "s/%domain%/$domain/g" \ + -e "s/%user%/$user/g" \ + -e "s/%group%/$group/g" \ + -e "s/%home%/${V_HOME////\/}/g" \ + -e "s/%docroot%/${docroot////\/}/g" \ + -e "s/%email%/$email/g" \ + -e "s/%alias_idn%/${aliases_idn//,/ }/g" \ + -e "s/%alias%/${aliases//,/ }/g" \ + -e "s/%ssl_cert%/${ssl_cert////\/}/g" \ + -e "s/%ssl_key%/${ssl_key////\/}/g" \ + >> $conf +} + +httpd_change_config() { + # Get ServerName line + serv_line=$(grep -n 'ServerName %domain_idn%' "$tpl_file" | cut -f 1 -d :) + + # Get tpl_file last line + last_line=$(wc -l $tpl_file | cut -f 1 -d ' ') + + # Get before line + bfr_line=$((serv_line - 1)) + + # Get after line + aftr_line=$((last_line - serv_line - 1)) + + # Parsing httpd.conf + vhost=$(grep -A $aftr_line -B $bfr_line -n "ServerName $domain_idn" $conf) + + # Searching prhase + str=$(echo "$vhost" | grep -F "$search_phrase" | head -n 1) + + # Checking parsing result + if [ -z "$str" ] || [ -z "$serv_line" ] || [ -z "$aftr_line" ]; then + echo "Error: httpd parsing error" + log_event 'debug' "$E_PARSE_ERROR $V_EVENT" + exit $E_PARSE_ERROR + fi + + # Parsing string position and content + str_numb=$(echo "$str" | sed -e "s/-/=/" | cut -f 1 -d '=') + str_cont=$(echo "$str" | sed -e "s/-/=/" | cut -f 2 -d '=') + + # Escaping chars + str_repl=$(echo "$str_repl" | sed \ + -e 's/\\/\\\\/g' \ + -e 's/&/\\&/g' \ + -e 's/\//\\\//g') + + # Changing config + sed -i "$str_numb s/.*/$str_repl/" $conf +} + +get_web_domain_value() { + key="$1" + + # Parsing domains + string=$( grep "DOMAIN='$domain'" $V_USERS/$user/web_domains.conf ) + + # Parsing key=value + for keys in $string; do + eval ${keys%%=*}=${keys#*=} + done + + # Self reference + eval value="$key" + + # Print value + echo "$value" +} + +get_dns_domain_value() { + key="$1" + + # Parsing domains + string=$( grep "DOMAIN='$domain'" $V_USERS/$user/dns.conf ) + + # Parsing key=value + for keys in $string; do + eval ${keys%%=*}=${keys#*=} + done + + # Self reference + eval value="$key" + + # Print value + echo "$value" +} + +update_web_domain_value() { + key="$1" + value="$2" + + # Defining conf + conf="$V_USERS/$user/web_domains.conf" + + # Parsing conf + domain_str=$(grep -n "DOMAIN='$domain'" $conf) + str_number=$(echo $domain_str | cut -f 1 -d ':') + str=$(echo $domain_str | cut -f 2 -d ':') + + # Reading key=values + for keys in $str; do + eval ${keys%%=*}=${keys#*=} + done + + # Defining clean key + c_key=$(echo "${key//$/}") + + eval old="${key}" + + # Escaping slashes + old=$(echo "$old" | sed -e 's/\\/\\\\/g' -e 's/&/\\&/g' -e 's/\//\\\//g') + new=$(echo "$value" | sed -e 's/\\/\\\\/g' -e 's/&/\\&/g' -e 's/\//\\\//g') + + # Updating conf + sed -i "$str_number s/$c_key='${old//\*/\\*}'/$c_key='${new//\*/\\*}'/g"\ + $conf +} + +update_dns_domain_value() { + key="$1" + value="$2" + + # Defining conf + conf="$V_USERS/$user/dns.conf" + + # Parsing conf + domain_str=$(grep -n "DOMAIN='$domain'" $conf) + str_number=$(echo $domain_str | cut -f 1 -d ':') + str=$(echo $domain_str | cut -f 2 -d ':') + + # Reading key=values + for keys in $str; do + eval ${keys%%=*}=${keys#*=} + done + + # Defining clean key + c_key=$(echo "${key//$/}") + + eval old="${key}" + + # Escaping slashes + old=$(echo "$old" | sed -e 's/\\/\\\\/g' -e 's/&/\\&/g' -e 's/\//\\\//g') + new=$(echo "$value" | sed -e 's/\\/\\\\/g' -e 's/&/\\&/g' -e 's/\//\\\//g') + + # Updating conf + sed -i "$str_number s/$c_key='${old//\*/\\*}'/$c_key='${new//\*/\\*}'/g"\ + $conf +} + +is_web_domain_key_empty() { + key="$1" + + # Parsing domains + string=$( grep "DOMAIN='$domain'" $V_USERS/$user/web_domains.conf ) + + # Parsing key=value + for keys in $string; do + eval ${keys%%=*}=${keys#*=} + done + + # Self reference + eval value="$key" + + # Checkng key + if [ ! -z "$value" ] && [ "$value" != 'no' ]; then + echo "Error: value is not empty = $value" + log_event 'debug' "$E_VALUE_EXIST $V_EVENT" + exit $E_VALUE_EXIST + fi +} + +is_dns_record_valid() { + # Checking record id + check_id=$(grep "^ID='$id'" $V_USERS/$user/zones/$domain) + + if [ -z "$check_id" ]; then + echo "Error: ID not exist" + log_event 'debug' "$E_ID_NOTEXIST $V_EVENT" + exit $E_ID_NOTEXIST + fi +} + +is_web_domain_value_exist() { + key="$1" + + # Parsing domains + string=$( grep "DOMAIN='$domain'" $V_USERS/$user/web_domains.conf ) + + # Parsing key=value + for keys in $string; do + eval ${keys%%=*}=${keys#*=} + done + + # Self reference + eval value="$key" + + # Checking result + if [ -z "$value" ] || [ "$value" = 'no' ]; then + echo "Error: ${key//$/} is empty" + log_event 'debug' "$E_VALUE_EMPTY $V_EVENT" + exit $E_VALUE_EMPTY + fi +} + +is_dns_domain_value_exist() { + key="$1" + + # Parsing domains + string=$( grep "DOMAIN='$domain'" $V_USERS/$user/dns.conf ) + + # Parsing key=value + for keys in $string; do + eval ${keys%%=*}=${keys#*=} + done + + # Self reference + eval value="$key" + + # Checking result + if [ -z "$value" ] || [ "$value" = 'no' ]; then + echo "Error: ${key//$/} is empty" + log_event 'debug' "$E_VALUE_EMPTY $V_EVENT" + exit $E_VALUE_EXIST + fi +} + + +httpd_del_config() { + # Get ServerName line + serv_line=$(grep -n 'ServerName %domain_idn%' "$tpl_file" |cut -f 1 -d :) + + # Get tpl_file last line + last_line=$(wc -l $tpl_file|cut -f 1 -d ' ') + + # Get before line + bfr_line=$((serv_line - 1)) + + # Parsing httpd.conf + str=$(grep -B $bfr_line -n "ServerName $domain_idn" $conf |\ + grep '>$nconf + + # Adding to rpaf ip pool as well + ips=$(grep 'RPAFproxy_ips' $rconf) + sed -i "s/$ips/$ips $ip/g" $rconf + fi + + # Scheduling restart + web_restart='yes' + fi +} + +namehost_ip_disable() { + #Checking web system + if [ "$WEB_SYSTEM" = 'apache' ]; then + sed -i "/NameVirtualHost $ip:/d" $conf + + # Checking proxy support + if [ "$PROXY_SYSTEM" = 'nginx' ]; then + tpl_ln=$(wc -l $V_WEBTPL/ngingx_ip.tpl | cut -f 1 -d ' ') + ip_line=$(grep -n "%ip%" $V_WEBTPL/ngingx_ip.tpl |head -n1 |\ + cut -f 1 -d :) + + conf_line=$(grep -n -w $ip $nconf|head -n1|cut -f 1 -d :) + + # Checking parsed lines + if [ -z "$tpl_ln" ] || [ -z "$ip_line" ] || [ -z "$conf_line" ] + then + echo "Error: nginx config paring error" + log_event 'debug' "$E_PARSE_ERROR $V_EVENT" + exit $E_PARSE_ERROR + fi + + up_line=$((ip_line - 1)) + first_line=$((conf_line - up_line)) + last_line=$((conf_line - ip_line + tpl_ln)) + + # Checking parsed lines + if [ -z "$first_line" ] || [ -z "$last_line" ]; then + echo "Error: nginx config paring error" + log_event 'debug' "$E_PARSE_ERROR $V_EVENT" + exit $E_PARSE_ERROR + fi + sed -i "$first_line,$last_line d" $nconf + + # Deleting from rpaf ip pool as well + ips=$(grep 'RPAFproxy_ips' $rconf) + new_ips=$(echo "$ips"|sed -e "s/$ip//") + sed -i "s/$ips/$new_ips/g" $rconf + fi + + # Scheduling restart + web_restart='yes' + fi +} diff --git a/func/ip_func.sh b/func/ip_func.sh new file mode 100644 index 00000000..4f1952e5 --- /dev/null +++ b/func/ip_func.sh @@ -0,0 +1,593 @@ +is_sys_ip_free() { + # Parsing system ips + ip_list=$(ifconfig|grep 'inet addr:'|cut -f 2 -d ':'|cut -f 1 -d " ") + + # Checking ip existance + ip_check=$(echo "$ip_list"|grep -w "$ip") + if [ -n "$ip_check" ] || [ -e "$V_IPS/$ip" ]; then + echo "Error: IP exist" + log_event 'debug' "$E_IP_EXIST $V_EVENT" + exit $E_IP_EXIST + fi +} + +get_next_interface_number() { + # Parsing ifconfig + i=$(ifconfig -a |grep -w "$interface"|cut -f1 -d ' '|\ + tail -n 1|cut -f 2 -d :) + + # Checking result + if [ "$i" = "$interface" ]; then + n=0 + else + n=$((i + 1)) + fi + echo ":$n" +} + +is_sys_ip_valid() { + # Parsing ifconfig + check_ifc=$(/sbin/ifconfig |grep "inet addr:$ip") + + # Checking ip existance + if [ ! -e "$V_IPS/$ip" ] || [ -z "$check_ifc" ]; then + echo "Error: IP not exist" + log_event 'debug' "$E_IP_NOTEXIST $V_EVENT" + exit $E_IP_NOTEXIST + fi +} + +is_ip_key_empty() { + key="$1" + + # Parsing ip + string=$(cat $V_IPS/$ip ) + + # Parsing key=value + for keys in $string; do + eval ${keys%%=*}=${keys#*=} + done + + # Self reference + eval value="$key" + + # Checkng key + if [ ! -z "$value" ] && [ "$value" != '0' ]; then + echo "Error: value is not empty = $value " + log_event 'debug' "$E_VALUE_EXIST $V_EVENT" + exit $E_VALUE_EXIST + fi +} + +update_sys_ip_value() { + key="$1" + value="$2" + + # Defining conf + conf="$V_IPS/$ip" + + # Parsing conf + str=$(cat $conf) + + # Reading key=values + for keys in $str; do + eval ${keys%%=*}=${keys#*=} + done + + # Define clean key + c_key=$(echo "${key//$/}") + + eval old="${key}" + + # Escaping slashes + old=$(echo "$old" | sed -e 's/\\/\\\\/g' -e 's/&/\\&/g' -e 's/\//\\\//g') + new=$(echo "$value" | sed -e 's/\\/\\\\/g' -e 's/&/\\&/g' -e 's/\//\\\//g') + + # Updating conf + sed -i "$str_number s/$c_key='${old//\*/\\*}'/$c_key='${new//\*/\\*}'/g"\ + $conf +} + +is_ip_avalable() { + # Checking ip existance + if [ ! -e "$V_IPS/$ip" ]; then + echo "Error: IP not exist" + log_event 'debug' "$E_IP_NOTEXIST $V_EVENT" + exit $E_IP_NOTEXIST + fi + + # Parsing ip data + ip_data=$(cat $V_IPS/$ip) + ip_owner=$(echo "$ip_data" | grep 'OWNER=' | cut -f 2 -d \' ) + ip_status=$(echo "$ip_data" | grep 'STATUS=' | cut -f 2 -d \' ) + + # Parsing user data + user_owner=$(grep 'OWNER=' $V_USERS/$user/user.conf | cut -f 2 -d \') + if [ "$user_owner" = "$ip_owner" ] && [ "$ip_status" = 'shared' ]; then + ip_shared='yes' + else + ip_shared='no' + fi + + if [ "$ip_owner" != "$user" ] && [ "$ip_shared" != 'yes' ]; then + echo "Error: ip not owned by user" + log_event 'debug' "$E_IP_NOTOWNED $V_EVENT" + exit $E_IP_NOTOWNED + fi +} + +is_sys_ip_owner() { + # Parsing ip + ip_owner=$(grep 'OWNER=' $V_IPS/$ip|cut -f 2 -d \') + if [ "$ip_owner" != "$user" ]; then + echo "Error: IP not owned" + log_event 'debug' "$E_IP_NOTOWNED $V_EVENT" + exit $E_IP_NOTOWNED + fi +} + +get_ip_name() { + # Prinitng name + grep "NAME=" $V_IPS/$ip |cut -f 2 -d \' +} + +increase_ip_value() { + USER=$user + web_key='U_WEB_DOMAINS' + usr_key='U_SYS_USERS' + + # Parsing values + current_web=$(grep "$web_key=" $V_IPS/$ip |cut -f 2 -d \') + current_usr=$(grep "$usr_key=" $V_IPS/$ip |cut -f 2 -d \') + + # Checking result + if [ -z "$current_web" ]; then + echo "Error: Parsing error" + log_event 'debug' "$E_PARSE_ERROR $V_EVENT" + exit $E_PARSE_ERROR + fi + + # +1 webdomain + new_web=$((current_web + 1)) + + # +1 user + if [ -z "$current_usr" ]; then + new_usr="$USER" + else + check_usr=$(echo -e "${current_usr//,/\n}" |grep -w $USER) + if [ -z "$check_usr" ]; then + new_usr="$current_usr,$USER" + else + new_usr="$current_usr" + fi + fi + + # Changing config + sed -i "s/$web_key='$current_web'/$web_key='$new_web'/g" $V_IPS/$ip + sed -i "s/$usr_key='$current_usr'/$usr_key='$new_usr'/g" $V_IPS/$ip +} + +decrease_ip_value() { + sip=${1-ip} + USER=$user + web_key='U_WEB_DOMAINS' + usr_key='U_SYS_USERS' + + # Parsing values + current_web=$(grep "$web_key=" $V_IPS/$sip |cut -f 2 -d \') + current_usr=$(grep "$usr_key=" $V_IPS/$sip |cut -f 2 -d \') + + # Checking result + if [ -z "$current_web" ]; then + echo "Error: Parsing error" + log_event 'debug' "$E_PARSE_ERROR $V_EVENT" + exit $E_PARSE_ERROR + fi + + # -1 webdomain + new_web=$((current_web - 1)) + + # -1 user + check_ip=$(grep $sip $V_USERS/$user/web_domains.conf |wc -l) + if [ "$check_ip" -lt 2 ]; then + new_usr=$(echo "$current_usr" |\ + sed -e "s/,/\n/g"|\ + sed -e "s/^$user$//g"|\ + sed -e "/^$/d"|\ + sed -e ':a;N;$!ba;s/\n/,/g') + else + new_usr="$current_usr" + fi + + # Changing config + sed -i "s/$web_key='$current_web'/$web_key='$new_web'/g" $V_IPS/$sip + sed -i "s/$usr_key='$current_usr'/$usr_key='$new_usr'/g" $V_IPS/$sip +} + +get_sys_ip_value() { + key="$1" + + # Parsing domains + string=$( cat $V_IPS/$ip ) + + # Parsing key=value + for keys in $string; do + eval ${keys%%=*}=${keys#*=} + done + + # Self reference + eval value="$key" + + # Print value + echo "$value" +} + +change_domain_ip() { + # Defining vars + conf="$1" + domain="$2" + ip="$3" + old_ip="$4" + tpl_file="$5" + + # Get ServerName line + serv_line=$(grep -n 'ServerName %domain%' "$tpl_file" |cut -f 1 -d :) + + # Get tpl_file last line + last_line=$(wc -l $tpl_file|cut -f 1 -d ' ') + + # Get before line + bfr_line=$((serv_line - 1)) + + # Parsing httpd.conf + str=$(grep -B $bfr_line -n "ServerName $domain" $conf|grep '$V_IPS/$ip +} + +ip_add_startup() { + # Filling ip values + ip_data="# Added by vesta $V_SCRIPT" + ip_data="$ip_data\nDEVICE=$iface" + ip_data="$ip_data\nBOOTPROTO=static\nONBOOT=yes" + ip_data="$ip_data\nIPADDR=$ip" + ip_data="$ip_data\nNETMASK=$mask" + + # Adding ip + echo -e "$ip_data" >$iconf-$iface +} + +ipint_json_list() { + interfaces=$(cat /proc/net/dev|grep :|cut -f 1 -d :|sed -e "s/ //g") + int_counter=$(echo "$interfaces"|wc -l) + i=1 + # Print top bracket + echo '[' + # Listing servers + for interface in $interfaces; do + if [ "$i" -lt "$int_counter" ]; then + echo -e "\t\"$interface\"," + else + echo -e "\t\"$interface\"" + fi + i=$((i + 1)) + done + echo "]" +} + +ipint_shell_list() { + interfaces=$(cat /proc/net/dev|grep :|cut -f 1 -d :|sed -e "s/ //g") + # Print result + echo "INTERFACES" + echo "----------" + for interface in $interfaces; do + echo "$interface" + done +} diff --git a/func/restart_cron b/func/restart_cron new file mode 100755 index 00000000..f9c7a51b --- /dev/null +++ b/func/restart_cron @@ -0,0 +1,24 @@ +#!/bin/bash +# Internal vesta function +# cron system restart + +# Importing variables +source $VESTA/conf/vars.conf + +crond() { + /etc/init.d/crond 'reload' >/dev/null 2>&1 + if [ $? -ne 0 ]; then + #$V_FUNC/report_issue 'sys' 'cron' + echo "$E_RESTART_FAILED $V_EVENT" + fi +} + +# Parsing config / or just source config +cron_system=$(grep 'CRON_SYSTEM=' $V_CONF/vesta.conf | cut -f 2 -d \' ) + +if [ "$cron_system" = 'crond' ]; then + crond +fi + +# Logging +exit $OK diff --git a/func/restart_dns b/func/restart_dns new file mode 100755 index 00000000..2833e557 --- /dev/null +++ b/func/restart_dns @@ -0,0 +1,23 @@ +#!/bin/bash +# Internal vesta function +# dns system restart + +# Importing variables +source $VESTA/conf/vars.conf + +bind() { + /etc/init.d/named 'reload' >/dev/null 2>&1 + if [ $? -ne 0 ]; then + #$V_FUNC/report_issue 'sys' 'cron' + echo "$E_RESTART_FAILED $V_EVENT" + fi +} + +# Parsing config / or just source config +dns_system=$(grep 'DNS_SYSTEM=' $V_CONF/vesta.conf | cut -f 2 -d \' ) + +if [ "$dns_system" = 'bind' ]; then + bind +fi + +exit $OK diff --git a/func/restart_web b/func/restart_web new file mode 100755 index 00000000..4ac60018 --- /dev/null +++ b/func/restart_web @@ -0,0 +1,39 @@ +#!/bin/bash +# Internal vesta function +# web system restart + +# Importing variables +source $VESTA/conf/vars.conf + +# Restart functions +apache() { + /etc/init.d/httpd 'graceful' >/dev/null 2>&1 + if [ $? -ne 0 ]; then + #$V_FUNC/report_issue 'web' 'apache' + echo "$E_RESTART_FAILED $V_EVENT" + fi +} + +nginx() { + /etc/init.d/nginx 'restart' >/dev/null 2>&1 + if [ $? -ne 0 ]; then + #$V_FUNC/report_issue 'web' 'nginx' + echo "$E_RESTART_FAILED $V_EVENT" + fi +} + +# Parsing config +web_system=$(grep 'WEB_SYSTEM=' $V_CONF/vesta.conf | cut -f 2 -d \' ) +proxy_system=$(grep 'PROXY_SYSTEM=' $V_CONF/vesta.conf | cut -f 2 -d \' ) + +# Checking values +if [ "$web_system" = 'apache' ]; then + apache +fi + +if [ "$proxy_system" = 'nginx' ]; then + nginx +fi + +# Logging +exit $OK diff --git a/func/shared_func.sh b/func/shared_func.sh new file mode 100644 index 00000000..3c36bab6 --- /dev/null +++ b/func/shared_func.sh @@ -0,0 +1,1336 @@ +# Log event function +log_event() { + # Argument defenition + level="$1" + event="$2" + + # Checking logging system + log_system=$(grep 'LOG_SYSTEM=' $V_CONF/vesta.conf | cut -f 2 -d \' ) + + if [ "$log_system" = 'on' ]; then + # Checking logging level + log=$(grep 'LOG_LEVEL=' $V_CONF/vesta.conf|\ + cut -f 2 -d \'|grep -w "$level" ) + if [ ! -z "$log" ]; then + echo "$event" >> $V_LOG/$level.log + fi + fi + +} + +# Log user history +log_history() { + event="$1" + undo="$2" + + # Checking logging system + log_history=$(grep 'LOG_HISTORY=' $V_CONF/vesta.conf | cut -f 2 -d \' ) + if [ "$log_history" = 'on' ]; then + echo "$event [$undo]" >> $V_USERS/$user/history.log + fi +} + +# External function result checker +check_func_result() { + + return_code="$1" + + if [[ "$return_code" -ne "$OK" ]]; then + log_event 'debug' "$return_code $V_EVENT" + exit $return_code + fi +} + +# Argument list checker +check_args() { + + sys_args="$1" + user_args="$2" + usage="$3" + + if [ "$user_args" -lt "$sys_args" ]; then + echo "Error: bad args" + echo "Usage: $V_SCRIPT $usage" + log_event 'debug' "$E_BAD_ARGS $V_EVENT" + exit $E_BAD_ARGS + fi +} + +# Format validator +format_validation() { + + # Defining url function + format_url() { + val="$1" + + # Checking url + check_http=$( echo "$val" |grep "^https://" ) + needed_chars=$(echo "$val" | cut -s -f 2 -d '.') + if [ -z "$check_http" ] || [ -z "$needed_chars" ]; then + echo "Error: shell not found" + log_event 'debug' "$E_SHELL_INVALID $V_EVENT" + exit $E_SHELL_INVALID + fi + } + + # Defining shell function + format_sh() { + val="$1" + + # Checking shell + check_shell=$(/usr/bin/chsh --list-shells | grep -w "$val" ) + if [ -z "$check_shell" ]; then + echo "Error: shell not found" + log_event 'debug' "$E_SHELL_INVALID $V_EVENT" + exit $E_SHELL_INVALID + fi + } + + # Defining password function + format_pwd() { + val="$1" + + # Checking password lenght + if [ "${#val}" -lt '6' ]; then + echo "Error: password is shorter than 6 chars" + log_event 'debug' "$E_PASSWORD_SHORT $V_EVENT" + exit $E_PASSWORD_SHORT + fi + } + + # Defining integer function + format_int() { + val="$1" + + # Defining exlude mask + special_chars=$(echo "$val" | \ + grep -c "[!|@|#|$|^|&|*|(|)|-|+|=|{|}|:|_|,|.|<|>|?|/|\|\"|'|;|%]" ) + + if [[ 0 -ne "$special_chars" ]]; then + echo "Error: $var out of range" + log_event 'debug' "$E_OUTOFRANGE $V_EVENT" + exit $E_OUTOFRANGE + fi + + # Checking letters + letters=$(echo "$val" | grep -c "[a-Z]") + if [ 0 -ne "$letters" ]; then + echo "Error: $var out of range" + log_event 'debug' "$E_OUTOFRANGE $V_EVENT" + exit $E_OUTOFRANGE + fi + + # Checking -zero + if [[ 0 -ne "$val" ]] && [[ 0 -gt "$val" ]]; then + echo "Error: $var out of range" + log_event 'debug' "$E_OUTOFRANGE $V_EVENT" + exit $E_OUTOFRANGE + fi + } + + # Defining ip function + format_ip() { + val="$1" + + oc1=$(echo $val | cut -s -f 1 -d . ) + oc2=$(echo $val | cut -s -f 2 -d . ) + oc3=$(echo $val | cut -s -f 3 -d . ) + oc4=$(echo $val | cut -s -f 4 -d . ) + + # Checking octets + if [ -z "$oc1" ] || [ -z "$oc2" ] || [ -z "$oc3" ] || [ -z "$oc4" ] + then + echo "Error: $var out of range" + log_event 'debug' "$E_OUTOFRANGE $V_EVENT" + exit $E_OUTOFRANGE + fi + } + + # Defining ip_status function + format_ips() { + val="$1" + + check_status=$(echo "shared, exclusive" | grep -w "$val" ) + + # Checking status + if [ -z "$check_status" ]; then + echo "Error: $var out of range" + log_event 'debug' "$E_OUTOFRANGE $V_EVENT" + exit $E_OUTOFRANGE + fi + } + + # Defining email function + format_eml() { + val="$1" + + check_at=$(echo "$val" | cut -s -f 1 -d @) + check_dt=$(echo "$val" | cut -s -f 2 -d @|cut -s -f 2 -d .) + + # Checking format + if [ -z "$check_at" ] ||\ + [ -z "$check_dt" ] ||\ + [ "${#check_dt}" -lt 2 ] &&\ + [ "$val" != 'vesta@localhost' ]; then + echo "Error: email format is wrong" + log_event 'debug' "$E_EMAIL_INVALID $V_EVENT" + exit $E_EMAIL_INVALID + fi + } + + # Defining interface function + format_ifc() { + val="$1" + + # Parsing ifconfig + /sbin/ifconfig "$val" > /dev/null 2>&1 + return_val="$?" + + if [ "$return_val" -ne 0 ]; then + echo "Error: intreface not exist" + log_event 'debug' "$E_INTERFACE_NOTEXIST" + exit $E_INTERFACE_NOTEXIST + fi + } + + # Defining user function + format_usr() { + val="$1" + + # Defining exlude mask + special_chars=$(echo "$val" | \ + grep -c "[!|@|#|$|^|&|*|(|)|+|=|{|}|:| |,|<|>|?|/|\|\"|'|;|%]" ) + + # Checking result + if [[ 0 -ne "$special_chars" ]]; then + echo "Error: $var is out of range" + log_event 'debug' "$E_OUTOFRANGE $V_EVENT" + exit $E_OUTOFRANGE + fi + } + + # Defining domain function + format_dom() { + val="$1" + + # Defining exlude mask + special_chars=$(echo "$val" | \ + grep -c "[!|@|#|$|^|&|*|(|)|+|=|{|}|:|,|<|>|?|_|/|\|\"|'|;|%]" ) + needed_chars=$(echo "$val" | cut -s -f 2 -d '.') + + # Checking result + if [[ 0 -ne "$special_chars" ]] || [ -z "$needed_chars" ]; then + echo "Error: $var is out of range" + log_event 'debug' "$E_OUTOFRANGE $V_EVENT" + exit $E_OUTOFRANGE + fi + } + + # Defining format_db function + format_db() { + val="$1" + + # Defining exlude mask + special_chars=$(echo "$val" | \ + grep -c "[!|@|#|$|^|&|*|(|)|+|=|{|}|:|,|.|<|>|?|/|\|\"|'|;|%]" ) + + # Checking result + if [[ 0 -ne "$special_chars" ]] || [ 17 -le ${#val} ]; then + echo "Error: $var is out of range" + log_event 'debug' "$E_OUTOFRANGE $V_EVENT" + exit $E_OUTOFRANGE + fi + } + + # Defining format_db function + format_dbu() { + val="$1" + + # Checking result + if [ 17 -le ${#val} ]; then + echo "Error: $var is out of range" + log_event 'debug' "$E_OUTOFRANGE $V_EVENT" + exit $E_OUTOFRANGE + fi + } + + # Defining dns record function + format_rcd() { + val="$1" + + case $val in + A) known='yes';; + NS) known='yes';; + CNAME) known='yes';; + AAAA) known='yes';; + MX) known='yes';; + TXT) known='yes';; + SRV) known='yes';; + *) known='no';; + esac + + if [[ "$known" != 'yes' ]]; then + echo "Error: $var is out of range" + log_event 'debug' "$E_OUTOFRANGE $V_EVENT" + exit $E_OUTOFRANGE + fi + } + + # Defining format_ext function + format_ext() { + val="$1" + + # Checking result + if [ 200 -le ${#val} ]; then + echo "Error: $var is out of range" + log_event 'debug' "$E_OUTOFRANGE $V_EVENT" + exit $E_OUTOFRANGE + fi + } + + # Lopp on all variables + for var in $*; do + # Parsing reference + eval v=\$$var + + # Checking variable format + case $var in + dom_alias) format_dom "$v" ;; + auth_pass) format_pwd "$v" ;; + auth_user) format_usr "$v" ;; + certificate) format_usr "$v" ;; + domain) format_dom "$v" ;; + database) format_db "$v" ;; + db_user) format_dbu "$v" ;; + ns1) format_dom "$v" ;; + ns2) format_dom "$v" ;; + email) format_eml "$v" ;; + extentions) format_ext "$v" ;; + host) format_usr "$v" ;; + interface) format_ifc "$v" ;; + ip) format_ip "$v" ;; + ip_status) format_ips "$v" ;; + ip_name) format_dom "$v" ;; + id) format_int "$v" ;; + mask) format_ip "$v" ;; + max_usr) format_int "$v" ;; + max_db) format_int "$v" ;; + limit) format_int "$v" ;; + offset) format_int "$v" ;; + owner) format_usr "$v" ;; + package) format_usr "$v" ;; + password) format_pwd "$v" ;; + port) format_int "$v" ;; + rtype) format_rcd "$v" ;; + shell) format_sh "$v" ;; + soa) format_dom "$v" ;; + suspend_url) format_url "$v" ;; + template) format_usr "$v" ;; + ttl) format_int "$v" ;; + user) format_usr "$v" ;; + esac + done +} + +# Sub system checker +is_system_enabled() { + + stype="$1" + + web_function() { + # Parsing config + web_system=$(grep "WEB_SYSTEM=" $V_CONF/vesta.conf|cut -f 2 -d \' ) + + # Checking result + if [ -z "$web_system" ] || [ "$web_system" = "off" ]; then + echo "Error: web hosting support disabled" + log_event 'debug' "$E_WEB_DISABLED $V_EVENT" + exit $E_WEB_DISABLED + fi + } + + proxy_function() { + # Parsing config + proxy_system=$(grep "PROXY_SYSTEM=" $V_CONF/vesta.conf|cut -f 2 -d \' ) + + # Checking result + if [ "$proxy_system" != 'nginx' ]; then # only nginx + echo "Error: proxy hosting support disabled" # support for + log_event 'debug' "$E_PROXY_DISABLED $V_EVENT" # now + exit $E_PROXY_DISABLED + fi + } + + dns_function() { + # Parsing config + dns_system=$(grep "DNS_SYSTEM=" $V_CONF/vesta.conf|cut -f 2 -d \' ) + + # Checking result + if [ -z "$dns_system" ] || [ "$cron_system" = "off" ]; then + echo "Error: dns support disabled" + log_event 'debug' "$E_DNS_DISABLED $V_EVENT" + exit $E_DNS_DISABLED + fi + } + + cron_function() { + # Parsing config + cron_system=$(grep "CRON_SYSTEM=" $V_CONF/vesta.conf|cut -f 2 -d \' ) + + # Checking result + if [ -z "$cron_system" ] || [ "$cron_system" = "off" ]; then + echo "Error: crond support disabled" + log_event 'debug' "$E_CRON_DISABLED $V_EVENT" + exit $E_CRON_DISABLED + fi + } + + db_function() { + # Parsing config + db_system=$(grep "DB_SYSTEM=" $V_CONF/vesta.conf|cut -f 2 -d \' ) + + # Checking result + if [ -z "$db_system" ] || [ "$db_system" = "off" ]; then + echo "Error: db support disabled" + log_event 'debug' "$E_DB_DISABLED $V_EVENT" + exit $E_DB_DISABLED + fi + } + + case $stype in + web) web_function ;; + proxy) proxy_function ;; + dns) dns_function ;; + cron) cron_function ;; + db) db_function ;; + *) check_args '1' '0' 'system' + esac +} + +# System user check +is_user_valid() { + search_user="${1-$user}" + check_user=$(cut -f 1 -d : /etc/passwd | grep -w "$search_user" ) + if [ -z "$check_user" ]; then + echo "Error: user not found" + log_event 'debug' "$E_USER_NOTEXIST $V_EVENT" + exit $E_USER_NOTEXIST + fi + + if [ ! -d "$V_USERS/$search_user" ]; then + echo "Error: unknown user" + log_event 'debug' "$E_USER_UNKNOWN $V_EVENT" + exit $E_USER_UNKNOWN + fi +} + +# Specific key check +is_user_suspended() { + check_suspend=$(grep "SUSPENDED='yes'" $V_USERS/$user/user.conf) + if [ ! -z "$check_suspend" ]; then + echo "Error: User is suspended" + log_event 'debug' "$E_USER_SUSPENDED $V_EVENT" + exit $E_USER_SUSPENDED + fi +} + +# User package check +is_package_full() { + stype="$1" + + web_domain() { + # Checking zero domains + domain_number=$(wc -l $V_USERS/$user/web_domains.conf|cut -f 1 -d ' ') + + # Comparing current val with conf + val=$(grep '^WEB_DOMAINS=' $V_USERS/$user/user.conf|cut -f 2 -d \' ) + if [ "$domain_number" -ge "$val" ]; then + echo "Error: Upgrade package" + log_event 'debug' "$E_PKG_UPGRADE $v_log" + exit $E_PKG_UPGRADE + fi + } + + web_alias() { + # Parsing aliases + alias_nmb=$(grep "DOMAIN='$domain'" $V_USERS/$user/web_domains.conf|\ + awk -F "ALIAS=" '{print $2}' | cut -f 2 -d \' |\ + sed -e "s/,/\n/g" | wc -l ) + + # Parsing config + val=$(grep 'WEB_ALIASES=' $V_USERS/$user/user.conf | cut -f 2 -d \' ) + if [ "$alias_nmb" -ge "$val" ]; then + echo "Error: Upgrade package" + log_event 'debug' "$E_PKG_UPGRADE $v_log" + exit $E_PKG_UPGRADE + fi + } + + web_ssl() { + # Parsing config + val=$(grep '^WEB_SSL=' $V_USERS/$user/user.conf | cut -f 2 -d \' ) + if [ "$val" -eq '0' ]; then + echo "Error: Upgrade package" + log_event 'debug' "$E_PKG_UPGRADE $v_log" + exit $E_PKG_UPGRADE + fi + + # Checking domains + domain_nmb=$(grep "SSL='yes'" $V_USERS/$user/web_domains.conf | wc -l) + # Comparing current val with conf + if [ "$domain_nmb" -ge "$val" ]; then + echo "Error: Upgrade package" + log_event 'debug' "$E_PKG_UPGRADE $v_log" + exit $E_PKG_UPGRADE + fi + } + + dns_domain() { + # Checking zero domains + domain_number=$(wc -l $V_USERS/$user/dns.conf | cut -f 1 -d " ") + + # Comparing current val with conf + val=$(grep '^DNS_DOMAINS=' $V_USERS/$user/user.conf | cut -f 2 -d \' ) + if [ "$domain_number" -ge "$val" ]; then + echo "Error: Upgrade package" + log_event 'debug' "$E_PKG_UPGRADE $v_log" + exit $E_PKG_UPGRADE + fi + } + + db_base() { + # Checking zero domains + db_number=$(wc -l $V_USERS/$user/db.conf | cut -f 1 -d " ") + + # Comparing current val with conf + val=$(grep '^DATABASES=' $V_USERS/$user/user.conf | cut -f 2 -d \' ) + if [ "$db_number" -ge "$val" ]; then + echo "Error: Upgrade package" + log_event 'debug' "$E_PKG_UPGRADE $v_log" + exit $E_PKG_UPGRADE + fi + } + + # FIXME - should finish other functions + + # Switching + case "$stype" in + web_domain) web_domain "$user" ;; + web_alias) web_alias "$user" "$domain" ;; + web_ssl) web_ssl "$user" ;; + dns) dns_domain "$user" ;; + db_base) db_base "$user" ;; + mail_domain) mail_domain "$user" ;; + mail_box) mail_box "$user" "$domain";; + mail_forwarder) mail_forwarder "$user" "$domain";; + *) + echo "Error: bad type" + log_event 'debug' "$E_BAD_TYPE $V_EVENT" + exit $E_BAD_TYPE + ;; + esac +} + +is_package_avalable() { + # Parsing user data + usr_data=$(cat $V_USERS/$user/user.conf) + for key in $usr_data; do + eval ${key%%=*}=${key#*=} + done + + # Clearing vars + WEB_DOMAINS='0' + WEB_SSL='0' + DATABASES='0' + MAIL_DOMAINS='0' + MAIL_BOXES='0' + MAIL_FORWARDERS='0' + DNS_DOMAINS='0' + DISK_QUOTA='0' + BANDWIDTH='0' + MAX_CHILDS='0' + + # Parsing package + pkg_data=$(cat $V_PKG/$package.pkg) + for key in $pkg_data; do + eval ${key%%=*}=${key#*=} + done + + # Comparing user data with package + if [ "$WEB_DOMAINS" -lt "$U_WEB_DOMAINS" ] ||\ + [ "$WEB_SSL" -lt "$U_WEB_SSL" ] ||\ + [ "$DATABASES" -lt "$U_DATABASES" ] ||\ + [ "$MAIL_DOMAINS" -lt "$U_MAIL_DOMAINS" ] ||\ + [ "$DNS_DOMAINS" -lt "$U_DNS_DOMAINS" ] ||\ + [ "$DISK_QUOTA" -lt "$U_DISK" ] ||\ + [ "$BANDWIDTH" -lt "$U_BANDWIDTH" ] ||\ + [ "$MAX_CHILDS" -lt "$U_CHILDS" ]; then + echo "Error: Upgrade package" + log_event 'debug' "$E_PKG_UPGRADE $v_log" + exit $E_PKG_UPGRADE + fi +} + +is_template_valid() { + stype="$1" + + web_template() { + check_tpl=$(echo "$templates"|sed -e "s/,/\n/g"|grep "^$template$") + + tpl="$V_WEBTPL/apache_$template.tpl" + descr="$V_WEBTPL/apache_$template.descr" + ssl="$V_WEBTPL/apache_$template.stpl" + + if [ -z "$check_tpl" ] || [ ! -e $tpl ] || \ + [ ! -e $descr ] || [ ! -e $ssl ]; then + echo "Error: template not found" + log_event 'debug' "$E_TPL_NOTEXIST" + exit $E_TPL_NOTEXIST + fi + } + + proxy_template() { + tpl="$V_WEBTPL/ngingx_vhost-$template.tpl" + descr="$V_WEBTPL/ngingx_vhost-$template.descr" + ssl="$V_WEBTPL/ngingx_vhost-$template.ssl.tpl" + + if [ ! -e $tpl ] || [ ! -e $descr ] || [ ! -e $ssl ]; then + echo "Error: template not found" + log_event 'debug' "$E_TPL_NOTEXIST" + exit $E_TPL_NOTEXIST + fi + } + + dns_template() { + tpl="$V_DNSTPL/$template.tpl" + descr="$V_DNSTPL/$template.descr" + + if [ ! -e $tpl ] || [ ! -e $descr ]; then + echo "Error: template not found" + log_event 'debug' "$E_TPL_NOTEXIST" + exit $E_TPL_NOTEXIST + fi + } + + # Switching config + case $stype in + web) web_template "$template" ;; + proxy) proxy_template "$template" ;; + dns) dns_template "$template" ;; + esac +} + + +get_user_value() { + key="$1" + USER="$user" + + # Parsing domains + string=$( cat $V_USERS/$user/user.conf ) + + # Parsing key=value + for keys in $string; do + eval ${keys%%=*}=${keys#*=} + done + + # Self reference + eval value="$key" + + # Print value + echo "$value" +} + +restart_schedule() { + type="$1" + period="$2" + + # Checking period + if [ -z "$period" ]; then + period=$(grep 'RESTART_PERIOD=' $V_CONF/vesta.conf | cut -f 2 -d \') + fi + + if [ "$period" -le 0 ]; then + $V_FUNC/restart_"$type" + else + echo "$type" >> $V_QUEUE/restart.pipe + fi +} + +is_user_free() { + # Parsing domain values + check_sysuser=$(cut -f 1 -d : /etc/passwd | grep -w "$user" ) + + # Checking result + if [ ! -z "$check_sysuser" ] || [ -e "$V_USERS/$user" ]; then + echo "Error: user $user exist" + log_event 'debug' "$E_USER_EXIST $V_EVENT" + exit $E_USER_EXIST + fi +} + +is_user_privileged() { + search_user="${1-$user}" + + # Parsing domain values + user_role=$(grep 'ROLE=' $V_USERS/$search_user/user.conf|cut -f 2 -d \' ) + + # Checking role + if [ "$user_role" != 'reseller' ] && [ "$user_role" != 'admin' ]; then + echo "Error: user role is $user_role" + log_event 'debug' "$E_PERMS_REQUEIURED $V_EVENT" + exit $E_PERMS_REQUEIURED + fi + + # Checking role permissions + if [ -n "$role" ]; then + case "$user_role" in + admin) rights='reseller, user' ;; + reseller) rights='user' ;; + *) rights='no_create' ;; + esac + + # Comparing rights with role + check_perms=$(echo "$rights"|grep -w "$role") + if [ -z "$check_perms" ]; then + echo "Error: user rights are '$rights'" + log_event 'debug' "$E_PERMS_REQUEIURED $V_EVENT" + exit $E_PERMS_REQUEIURED + fi + fi +} + +is_package_valid() { + if [ ! -e "$V_PKG/$package.pkg" ]; then + echo "Error: package is not exist" + log_event 'debug' "$E_PKG_NOTEXIST $v_log" + exit $E_PKG_NOTEXIST + fi +} + +is_user_key_empty() { + key="$1" + + # Parsing ip + string=$(cat $V_USERS/$user/user.conf ) + + # Parsing key=value + for keys in $string; do + eval ${keys%%=*}=${keys#*=} + done + + # Self reference + eval value="$key" + + # Checkng key + if [ ! -z "$value" ] && [ "$value" != 'no' ] && [ "$value" != '0' ]; then + echo "Error: value is not empty = $value " + log_event 'debug' "$E_VALUE_EXIST $V_EVENT" + exit $E_VALUE_EXIST + fi +} + +update_user_value() { + USER="$1" + key="$2" + value="$3" + + # Defining conf + conf="$V_USERS/$USER/user.conf" + + # Parsing conf + str=$(cat $conf) + + # Reading key=values + for keys in $str; do + eval ${keys%%=*}=${keys#*=} + done + + # Define clean key + c_key=$(echo "${key//$/}") + + eval old="${key}" + + # Escaping slashes + old=$(echo "$old" | sed -e 's/\\/\\\\/g' -e 's/&/\\&/g' -e 's/\//\\\//g') + new=$(echo "$value" | sed -e 's/\\/\\\\/g' -e 's/&/\\&/g' -e 's/\//\\\//g') + + # Updating conf + sed -i "s/$c_key='${old//\*/\\*}'/$c_key='${new//\*/\\*}'/g" $conf +} + +increase_user_value() { + USER="$1" + key="$2" + + # Defining conf + conf="$V_USERS/$USER/user.conf" + + # Deleting $ + key=$(echo "${key//$/}") + + # Parsing current value + current_value=$(grep "$key=" $conf |cut -f 2 -d \') + + # Checking result + if [ -z "$current_value" ]; then + echo "Error: Parsing error" + log_event 'debug' "$E_PARSE_ERROR $V_EVENT" + exit $E_PARSE_ERROR + fi + + # Plus one + new_value=$(expr $current_value + 1 ) + + # Changing config + sed -i "s/$key='$current_value'/$key='$new_value'/g" $conf +} + +is_web_domain_cert_valid() { + # Checking file existance + path="$V_USERS/$user/cert" + if [ ! -e "$path/$cert.crt" ] || [ ! -e "$path/$cert.key" ]; then + echo "Error: certificate not exist" + log_event 'debug' "$E_CERT_NOTEXIST $V_EVENT" + exit $E_CERT_NOTEXIST + fi +} + +is_type_valid() { + # Argument defenition + sys="$1" + stype="$2" + + # Switching config + case $sys in + stat) skey='STATS_SYSTEM=';; + db) skey='DB_SYSTEM=' ;; + *) skey='UNKNOWN' ;; + esac + + # Parsing domain values + check_type=$(grep "$skey" $V_CONF/vesta.conf|grep -w $stype) + + # Checking result + if [ -z "$check_type" ]; then + echo "Error: unknown type" + log_event 'debug' "$E_BAD_TYPE $V_EVENT" + exit $E_BAD_TYPE + fi +} + +change_user_package() { + # Parsing user data + usr_data=$(cat $V_USERS/$user/user.conf) + for key in $usr_data; do + eval ${key%%=*}=${key#*=} + done + + # Parsing package + pkg_data=$(cat $V_PKG/$package.pkg) + for key in $pkg_data; do + eval ${key%%=*}=${key#*=} + done + + echo "PACKAGE='$package' +WEB_DOMAINS='$WEB_DOMAINS' +WEB_SSL='$WEB_SSL' +WEB_ALIASES='$WEB_ALIASES' +DATABASES='$DATABASES' +MAIL_DOMAINS='$MAIL_DOMAINS' +MAIL_BOXES='$MAIL_BOXES' +MAIL_FORWARDERS='$MAIL_FORWARDERS' +DNS_DOMAINS='$DNS_DOMAINS' +DISK_QUOTA='$DISK_QUOTA' +BANDWIDTH='$BANDWIDTH' +NS1='$NS1' +NS2='$NS2' +SHELL='$SHELL' +BACKUPS='$BACKUPS' +TEMPLATES='$TEMPLATES' +MAX_CHILDS='$MAX_CHILDS' +SUSPENDED='$SUSPENDED' +OWNER='$OWNER' +ROLE='$ROLE' +IP_OWNED='$IP_OWNED' +U_CHILDS='$U_CHILDS' +U_DISK='$U_DISK' +U_BANDWIDTH='$U_BANDWIDTH' +U_WEB_DOMAINS='$U_WEB_DOMAINS' +U_WEB_SSL='$U_WEB_SSL' +U_DNS_DOMAINS='$U_DNS_DOMAINS' +U_DATABASES='$U_DATABASES' +U_MAIL_DOMAINS='$U_MAIL_DOMAINS' +DATE='$DATE'" > $V_USERS/$user/user.conf +} + +get_shell_path() { + check_shell=$(/usr/bin/chsh --list-shells | grep -w "$shell" ) + echo "$check_shell" +} + +is_user_value_exist() { + key="$1" + string=$(cat $V_USERS/$user/user.conf ) + + # Parsing key=value + for keys in $string; do + eval ${keys%%=*}=${keys#*=} + done + + # Self reference + eval value="$key" + + # Checking result + if [ -z "$value" ] || [ "$value" = 'no' ]; then + echo "Error: ${key//$/} is empty" + log_event 'debug' "$E_VALUE_EMPTY $V_EVENT" + exit $E_VALUE_EMPTY + fi +} + +decrease_user_value() { + USER="$1" + key="$2" + conf="$V_USERS/$USER/user.conf" + + # Deleting $ + key=$(echo "${key//$/}") + + # Parsing current value + current_value=$(grep "$key=" $conf |cut -f 2 -d \') + + # Checking result + if [ -z "$current_value" ]; then + echo "Error: Parsing error" + log_event 'debug' "$E_PARSE_ERROR $V_EVENT" + exit $E_PARSE_ERROR + fi + + # Checking zero val + if [ "$current_value" -gt 0 ]; then + # Minus one + new_value=$(expr $current_value - 1 ) + # Changing config + sed -i "s/$key='$current_value'/$key='$new_value'/g" $conf + fi +} + +# Json listing function +v_json_list() { + # Definigng variables + i='1' # iterator + end=$(($limit + $offset)) # last string + value='' # clean start value + + # Print top bracket + echo '{' + + # Reading file line by line + while read line ; do + # Checking offset and limit + if [ "$i" -ge "$offset" ] && [ "$i" -lt "$end" ] && [ "$offset" -gt 0 ] + then + # Parsing key=value + for key in $line; do + eval ${key%%=*}=${key#*=} + done + + # Checking !first line to print bracket + if [ "$i" -ne "$offset" ]; then + echo -e "\t}," + fi + + j=1 # local loop iterator + last_word=$(echo "$fields" | wc -w) + + # Print data + for field in $fields; do + eval value=$field + + # Checking parrent key + if [ "$j" -eq 1 ]; then + echo -e "\t\"$value\": {" + else + if [ "$j" -eq "$last_word" ]; then + echo -e "\t\t\"${field//$/}\": \"${value//,/, }\"" + else + echo -e "\t\t\"${field//$/}\": \"${value//,/, }\"," + fi + fi + j=$(($j + 1)) + done + fi + i=$(($i + 1)) + done < $conf + + # If there was any output + if [ -n "$value" ]; then + echo -e "\t}" + fi + + # Printing bottom json bracket + echo -e "}" +} + +# Shell listing function +v_shell_list() { + + # Definigng variables + i='1' # iterator + end=$(($limit + $offset)) # last string + # Print brief info + echo "${fields//$/}" + for a in $fields; do + echo -e "------ \c" + done + echo # new line + + # Reading file line by line + while read line ; do + # Checking offset and limit + if [ "$i" -ge "$offset" ] && [ "$i" -lt "$end" ] && [ "$offset" -gt 0 ] + then + # Parsing key=value + for key in $line; do + eval ${key%%=*}=${key#*=} + done + # Print result line + eval echo "$fields" + fi + i=$(($i + 1)) + done < $conf +} + +usr_json_single_list() { + # Definigng variables + USER="$user" # user + i=1 # iterator + + # Define words number + last_word=$(echo "$fields" | wc -w) + + # Reading file line by line + line=$(cat $V_USERS/$USER/user.conf) + + # Print top bracket + echo '{' + + # Parsing key=value + for key in $line; do + eval ${key%%=*}=${key#*=} + done + + # Starting output loop + for field in $fields; do + # Parsing key=value + eval value=$field + + # Checking first field + if [ "$i" -eq 1 ]; then + echo -e "\t\"$value\": {" + else + if [ "$last_word" -eq "$i" ]; then + echo -e "\t\t\"${field//$/}\": \"${value//,/, }\"" + else + echo -e "\t\t\"${field//$/}\": \"${value//,/, }\"," + fi + fi + # Updating iterator + i=$(( i + 1)) + done + + # If there was any output + if [ -n "$value" ]; then + echo -e "\t}" + fi + # Printing bottom json bracket + echo -e "}" +} + +usr_shell_single_list() { + # Definigng variables + USER="$user" # user + + # Reading file line by line + line=$(cat $V_USERS/$USER/user.conf) + + # Parsing key=value + for key in $line; do + eval ${key%%=*}=${key#*=} + done + + # Print result line + for field in $fields; do + eval key="$field" + echo "${field//$/}: $key " + done +} + +usr_json_list() { + i='1' # iterator + end=$(($limit + $offset)) # last string + + # Definining user list + #user_list=$(find $V_USERS/ -maxdepth 1 -mindepth 1 -type d -printf %P\\n ) + user_list=$(ls $V_USERS/) + + # Print top bracket + echo '{' + + # Starting main loop + for USER in $user_list; do + # Checking offset and limit + if [ "$i" -ge "$offset" ] && [ "$i" -lt "$end" ] && [ "$offset" -gt 0 ] + then + # Reading user data + user_data=$(cat $V_USERS/$USER/user.conf) + + # Parsing key/value config + for key in $user_data; do + eval ${key%%=*}=${key#*=} + done + + # Checking !first line to print bracket with coma + if [ "$i" -ne "$offset" ]; then + echo -e "\t}," + fi + + # Defining local iterator and words count + j='1' + last_word=$(echo "$fields" | wc -w) + + # Print data + for field in $fields; do + eval value=$field + # Checking parrent key + if [ "$j" -eq 1 ]; then + echo -e "\t\"$value\": {" + else + if [ "$j" -eq "$last_word" ]; then + echo -e "\t\t\"${field//$/}\": \"${value//,/, }\"" + else + echo -e "\t\t\"${field//$/}\": \"${value//,/, }\"," + fi + fi + j=$(($j + 1)) + done + fi + i=$(($i + 1)) + done + + # If there was any output + if [ -n "$value" ]; then + echo -e "\t}" + fi + + # Printing bottom json bracket + echo '}' +} + +usr_shell_list() { + i='1' # iterator + end=$(($limit + $offset)) # last string + + # Definining user list + #user_list=$(find $V_USERS/ -maxdepth 1 -mindepth 1 -type d -printf %P\\n ) + user_list=$(ls $V_USERS/) + + # Print brief info + echo "${fields//$/}" + for a in $fields; do + echo -e "--------- \c" + done + echo # new line + + # Starting main loop + for USER in $user_list; do + # Checking offset and limit + if [ "$i" -ge "$offset" ] && [ "$i" -lt "$end" ] && [ "$offset" -gt 0 ] + then + # Reading user data + user_data=$(cat $V_USERS/$USER/user.conf) + + # Parsing key/value config + for key in $user_data; do + eval ${key%%=*}=${key#*=} + done + # Print result line + eval echo "$fields" + fi + i=$(($i + 1)) + done +} + +usrns_json_list() { + ns=$(grep "NS[1|2]=" $V_USERS/$user/user.conf |cut -f 2 -d \') + # Print top bracket + echo '[' + i=1 + # Listing servers + for nameserver in $ns;do + if [ "$i" -eq 1 ]; then + echo -e "\t\"$nameserver\"," + else + echo -e "\t\"$nameserver\"" + fi + i=$((i + 1)) + done + + echo "]" +} + +usrns_shell_list() { + ns=$(grep "NS[1|2]=" $V_USERS/$user/user.conf |cut -f 2 -d \') + # Print result + echo "NAMESERVER" + echo "----------" + for nameserver in $ns;do + echo "$nameserver" + done +} + +get_usr_disk() { + size='0' + + # Using tricky way to parse configs + dir_usage=$(grep 'U_DIR_DISK=' $V_USERS/$user/user.conf |\ + cut -f 2 -d "'") + size=$((size + dir_usage)) + + # Checking web + if [ -f "$V_USERS/$user/web_domains.conf" ]; then + # Using tricky way to parse configs + disk_usage=$(grep 'U_DISK=' $V_USERS/$user/web_domains.conf |\ + awk -F "U_DISK='" '{print $2}'|cut -f 1 -d "'") + for disk in $disk_usage; do + size=$((size + disk)) + done + fi + + # Checking db + if [ -f "$V_USERS/$user/db.conf" ]; then + # Using tricky way to parse configs + disk_usage=$(grep 'U_DISK=' $V_USERS/$user/db.conf |\ + awk -F "U_DISK='" '{print $2}'|cut -f 1 -d "'") + for disk in $disk_usage; do + size=$((size + disk)) + done + fi + + # Checking mail + if [ -f "$V_USERS/$user/mail_domains.conf" ]; then + # Using tricky way to parse configs + disk_usage=$(grep 'U_DISK=' $V_USERS/$user/mail_domains.conf |\ + awk -F "U_DISK='" '{print $2}'|cut -f 1 -d "'") + for disk in $disk_usage; do + size=$((size + disk)) + done + fi + + echo "$size" +} + +get_usr_traff() { + size='0' + conf='web_domains.conf' + + # Checking web + if [ -f "$V_USERS/$user/$conf" ]; then + # Using tricky way to parse configs + bandwidth_usage=$(grep 'U_BANDWIDTH=' $V_USERS/$user/$conf|\ + awk -F "U_BANDWIDTH='" '{print $2}'|cut -f 1 -d "'") + for bandwidth in $bandwidth_usage; do + size=$((size + bandwidth)) + done + fi + + echo "$size" +} + +pkg_json_list() { + i='1' # iterator + end=$(($limit + $offset)) # last string + + # Print top bracket + echo '{' + + # Starting main loop + for package in $(ls $V_DATA/packages); do + PACKAGE=${package/.pkg/} + + # Checking offset and limit + if [ "$i" -ge "$offset" ] && [ "$i" -lt "$end" ] && [ "$offset" -gt 0 ] + then + # Parsing key/value config + pkg_descr=$(cat $V_DATA/packages/$package) + for key in $pkg_descr; do + eval ${key%%=*}=${key#*=} + done + + # Checking !first line to print bracket with coma + if [ "$i" -ne "$offset" ]; then + echo -e "\t}," + fi + + # Defining local iterator and words count + j='1' + last_word=$(echo "$fields" | wc -w) + + # Print data + for field in $fields; do + eval value=$field + # Checking parrent key + if [ "$j" -eq 1 ]; then + echo -e "\t\"$value\": {" + else + if [ "$j" -eq "$last_word" ]; then + echo -e "\t\t\"${field//$/}\": \"${value//,/, }\"" + else + echo -e "\t\t\"${field//$/}\": \"${value//,/, }\"," + fi + fi + j=$(($j + 1)) + done + fi + i=$(($i + 1)) + done + + # If there was any output + if [ -n "$value" ]; then + echo -e "\t}" + fi + + # Printing bottom json bracket + echo '}' +} + +pkg_shell_list() { + i='1' # iterator + end=$(($limit + $offset)) # last string + + # Listing pkg files + for package in $(ls $V_DATA/packages); do + PACKAGE=${package/.pkg/} + + # Checking offset and limit + if [ "$i" -ge "$offset" ] && [ "$i" -lt "$end" ] && [ "$offset" -gt 0 ] + then + # Parsing key=value + pkg_descr=$(cat $V_DATA/packages/$package) + for key in $pkg_descr; do + eval ${key%%=*}=${key#*=} + done + + echo "----------" + + # Starting output loop + for field in $fields; do + # Parsing key=value + eval value=$field + # Checking first field + echo -e "${field//$/}: $value" + done + fi + i=$(($i + 1)) + done +} diff --git a/log/admin_error.log b/log/admin_error.log new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/log/admin_error.log @@ -0,0 +1 @@ + diff --git a/log/auth.log b/log/auth.log new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/log/auth.log @@ -0,0 +1 @@ + diff --git a/log/debug.log b/log/debug.log new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/log/debug.log @@ -0,0 +1 @@ + diff --git a/log/system.log b/log/system.log new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/log/system.log @@ -0,0 +1 @@ + diff --git a/src/v_check_sys_user_password.c b/src/v_check_sys_user_password.c new file mode 100755 index 00000000..74105edb --- /dev/null +++ b/src/v_check_sys_user_password.c @@ -0,0 +1,86 @@ +/***************************************************************************/ +/* v_check_passwd.c */ +/* */ +/* This program compare user pasword from input with /etc/shadow */ +/* To compile run: */ +/* "gcc -lcrypt v_check_sys_user_password.c -o v_check_sys_user_password" */ +/* */ +/* Thanks to: bogolt, richie and burus */ +/* */ +/***************************************************************************/ + +#define _XOPEN_SOURCE +#include +#include +#include +#include +#include +#include +#include +#include + + +int main (int argc, char** argv) { + // defining ip + char *ip = "127.0.0.1"; + + // checking argument list + if (3 > argc) { + printf("Error: bad args\n",argv[0]); + printf("Usage: %s user password [ip]\n",argv[0]); + exit(3); + }; + + // checking ip + if (4 <= argc) { + ip = (char*)malloc(strlen(argv[3])); + strcpy(ip, argv[3]); + } + + // formating current time + time_t lt = time(NULL); + struct tm* ptr = localtime(<); + char str[280]; + strftime(str, 100, "%m-%d-%y %H:%m:%S ", ptr); + + // openning log file + FILE* pFile = fopen ("/usr/local/vesta/log/auth.log","a+"); + if (NULL == pFile) { + printf("Error: can not open file %s \n", argv[0]); + exit(7); + } + + // parsing user argument + struct passwd* userinfo = getpwnam(argv[1]); + if (NULL != userinfo) { + struct spwd* passw = getspnam(userinfo->pw_name); + if (NULL != passw) { + char* cryptedPasswrd = (char*)crypt(argv[2], passw->sp_pwdp); + if (strcmp(passw->sp_pwdp,crypt(argv[2],passw->sp_pwdp))==0) { + // concatinating time with user and ip + strcat(str, userinfo->pw_name); + strcat(str, " "); + strcat(str, ip); + strcat(str, " successfully logged in \n"); + fputs (str,pFile); // writing + fclose (pFile); // closing + exit(EXIT_SUCCESS); // exiting + } else { + // concatinating time with user string + printf ("Error: password missmatch\n"); + strcat(str, userinfo->pw_name); + strcat(str, " "); + strcat(str, ip); + strcat(str, " failed to login \n"); + fputs (str,pFile); // writing + fclose (pFile); // closing + exit(24); // exiting + }; + } + } else { + printf("Error: no such user\n",argv[1]); + exit(21); + }; + + return EXIT_SUCCESS; +}; diff --git a/web/INSTALL.txt b/web/INSTALL.txt new file mode 100644 index 00000000..ea3ad0d0 --- /dev/null +++ b/web/INSTALL.txt @@ -0,0 +1,14 @@ +INSTALLATION +------------ + +SYSTEM REQUIREMENTS +------------------- + +DEVELOPMENT VERSIONS +-------------------- + +CONFIGURING THE INCLUDE PATH +---------------------------- + +GETTING STARTED +--------------- diff --git a/web/LICENSE.txt b/web/LICENSE.txt new file mode 100644 index 00000000..c77cede3 --- /dev/null +++ b/web/LICENSE.txt @@ -0,0 +1,27 @@ +Copyright (c) 2005-2010, http://vestacp.com +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + * Neither the name of XXX xxx USA, Inc. nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/web/README.txt b/web/README.txt new file mode 100644 index 00000000..960888e2 --- /dev/null +++ b/web/README.txt @@ -0,0 +1,22 @@ +RELEASE INFORMATION +--------------- + +NEW FEATURES +------------ + +SYSTEM REQUIREMENTS +------------------- + +INSTALLATION +------------ +Please see INSTALL.txt. + +QUESTIONS AND FEEDBACK +---------------------- + +LICENSE +------- +You can find a copy of this license in LICENSE.txt. + +ACKNOWLEDGEMENTS +---------------- diff --git a/web/css/main.css b/web/css/main.css new file mode 100644 index 00000000..7ac06a0a --- /dev/null +++ b/web/css/main.css @@ -0,0 +1,2264 @@ +/*- - - - - - - - - - - - - - - - - - - +Title : Vesta +Author : Eugen Lobicov, eugen.lobicov@gmail.com + +created : November 27, 2009 +last updated : March 14, 2011 +- - - - - - - - - - - - - - - - - - */ + +html{ + font-size:100.01%; /* prevent IE's extreme font-resizing bug*/ +} + +body{ + position:relative; + font:normal 62.5%/1.5 Helvetica, Arial, sans-serif; + background:#F0F0EE url(../images/thin-grey-line-2.gif) repeat-x; + color:#333; +} +#page{ + width:965px; + width:955px; + margin:5px auto 0; + border:1px solid red; + border:solid #a9aa98; + border-width:0 2px; +/* padding:0 0 0 10px; + background:url(../images/bg-left.gif) repeat-y;*/ +} +.outer{ +/* padding:0 10px 0 0; + background:url(../images/bg-right.gif) repeat-y 100% 0;*/ + padding-bottom:58px; + background:#fff url(../images/footer-bg.gif) repeat-x 0 100%; +} +#header{ + overflow:hidden; + padding:0 10px; + height:26px; + border-bottom:2px solid #333527; + background-color:#484439; +} +.logo-box{ + float:left; +} +.logo, +.logo a, +.logo a span{ + display:block; + width:80px; + height:26px; +} +.logo a{ + position:relative; + overflow:hidden; + font-size:1.2em; /*12px */ + text-decoration:none; + color:#fff; +} +.logo a span{ + position:absolute; + top:0; + left:0; + z-index:1; + background:url(../images/vesta-logo.png) no-repeat; +} +.settings{ + float:right; +} +.settings li{ + float:left; + display:block; + margin:0 10px 0 0; + font-size:1.2em; /*12px*/ + line-height:2.084; /* 25px*/ +} +.settings li a{ + color:#c6d2d2; +} +.settings li a:hover{ + color:#fefda0; + text-decoration:none; +} +.settings li a:active{ + color:#E16734; + text-decoration:none; +} + +/*Remove button padding in FF*/ +input::-moz-focus-inner{ + border: 0; + padding: 0; +} +.cc:after{ + content: "."; + display: block; + height: 0; + clear: both; + visibility: hidden; +} +.hidden{ + display:none !important; +} + +/* Navigation +- - - - - - - - - - - - - - - - - - - - */ +#primary-nav-box{ + clear:both; + height:115px; + background-color:#ecf3d2; +} +.primary-nav{} + +.primary-nav .section{ + position:relative; + float:left; + display:block; + padding-right:1px; +/* border-bottom:4px solid #616a57;*/ +/* background:url(../images/nav-devider-2.png) no-repeat 100% 50%;*/ + background:url(../images/nav-devider-2.png) no-repeat 100% 50%; +} +.primary-nav .last-section{ + background:none; + padding:0; +} +.section .section-inner{ + width:130px; + min-height:100px; + height:auto !important; + height:100px; + padding:15px 0 3px 6px; + background:url(../images/section-status-sprite-5.gif) no-repeat -420px 115px; + } +.primary-nav .last-section .section-inner{ + width:133px; + width:127px; +} +.section .section-title{ + position:absolute; + left:7px; + bottom:9px; + font-family:Arial, Helvetica, sans-serif; + font-size:15px; + line-height:1.2; + font-weight:bold; + text-transform:uppercase; + color:#393939; + color:#33342e; + } + .section .section-title .to-section{ + float:left; + margin-right:4px; + } + .section .section-title .add-entry{ + position:relative; + top:2px; + float:left; + display:block; + width:13px; + height:13px; + background:url(../images/primarary-collapsed.gif) no-repeat; + font-size:0; + line-height:0; + } + .section .section-title .add-entry:hover{ + background:#B5C968; + } + +.dnstpl-nav-item .section-title{ + background-position:100% 85%; +} +.section .def{ + display:block; + font-family:Arial, Helvetica, sans-serif; + font-size:12px; + color:#8c9c91; +} +.section:hover .section-inner{ + background-position:0 115px; + background-color:#F1F7D6; + color:#000; + cursor:pointer; + } + .section:hover .section-title{ + color:#000; + } +.primary-nav .active .section-inner{ + background-position:-140px 115px; + cursor:default; + } + .primary-nav .active .def{ + color:#8c9c91; + } + .primary-nav .active .section-title{ + color:#393939; + } + +#console{ + position:relative; + clear:both; + height:70px; + background-color:#a09d98; + background:#535049 url(../images/console-box-bg.png) repeat-x; + border-bottom:1px solid #7a7967; +} + +.b-console{ + position:absolute; + left:50%; +} + +.b-console-wrap{ + position:relative; + right:50%; + width:655px; + padding:10px 15px 16px 25px; + background:url(../images/console-bg.png) repeat; + + border-radius: 0 0 5px 5px; + -moz-border-radius: 0 0 5px 5px; + -webkit-border-top-right-radius: 0; + -webkit-border-top-left-radius: 0; + -webkit-border-bottom-right-radius: 5px; + -webkit-border-bottom-left-radius: 5px; +} + .b-console-form{} + + .b-console-field{ + float:left; + width:548px; + margin-right:15px; + padding:5px 10px; + border:2px solid #42647f; + font-family:Arial, Helvetica, sans-serif; + font-size:18px; + font-style:italic; + font-weight:bold; + color:#aaa; + } + .b-console-field:focus{ + -moz-box-shadow:0 0 8px rgba(82, 168, 236, 0.5); + -webkit-box-shadow:0 0 8px rgba(82, 168, 236, 0.5); + border-color:rgba(82, 168, 236, 0.75) !important; + color:#333; + } + .b-console-btn{ + float:left; + overflow:visible; + height:30px; + margin:4px 0 0; + padding:0 20px; + -webkit-border-radius:4px; + -moz-border-radius:4px; + border-radius:4px; + border:0 none; + background-color:#fdcd00; + color:#4b3600; + + font-size:13px; + font-family:Arial, Helvetica, sans-serif; + font-weight:bold; + line-height:30px; + text-transform:uppercase; + cursor:pointer; + + /* a little animation effect on hover for -webkit- */ + -webkit-transition-property: background; + -webkit-transition-duration: 150ms; + -webkit-transition-timing-function: ease-in-out; + } + .b-console-btn:focus{ + position:relative; + top:1px; + } + .b-console-btn:hover{ + background-color:#ffe84c; + color:#39351c; + } + .b-console-btn:active{ + background-color:#333; + color:#fff; + } + +.b-console-statuses{ + margin-top:15px; +} + + .b-console-status{ + position:relative; + padding:5px 80px 5px 10px; + border:2px dashed #999; + background-color:#feff99; + color:#666; + font-size:12px; + } + .b-console-status-message{ + float:left; + color:#666; + } + .b-console-status-action{ + float:right; + margin-right:-36px; + text-decoration:underline; + } + .b-console-status-message b{ + font-weight:bold; + color:#333; + } + .b-console-status-arrow{ + position:absolute; + top:10px; + right:12px; + display:block; + width:14px; + height:8px; + background:url(../images/status-arrow.png) no-repeat; + } + + + +#actions-toolbar{ + clear:both; + position:relative; + padding:15px 20px 15px 280px; + background-color:#f3f3d9; + border-bottom:1px solid #c9cbc8; +} +.add-domain, +.add-btn{ + position:relative; + top:2px; + float:left; + margin:0 0 0 -260px; + border-bottom:1px solid #b5c968; + font-family:Georgia, "Times New Roman", Times, serif; + font-size:16px; +/* line-height:18px;*/ + line-height:1; + text-transform:uppercase; + color:#66685d; + text-decoration:none; +} +.add-domain .icon, +.add-btn-icon{ + float:left; + display:block; + width:11px; + height:11px; + margin:4px 5px 0 0; + background:url(../images/add-entry-plus.gif) no-repeat; + font-size:0; + line-height:0; +} +.select-all{ + padding:0 40px 0 0; + font-size:13px; + color:#7f7e6c; + text-decoration:underline; + cursor:pointer; + } + .select-all:hover{ + text-decoration:none; + } +.clear-selected{ + font-size:11px; + line-height:10px; + text-transform:uppercase; + color:#bcb6a6; + cursor:pointer; + letter-spacing:0.2px; + border-bottom:1px solid #bcb6a6; + } + .clear-selected:hover{ + color:#000; + border-bottom-color:#b85152; + } + .clear-selected:active{ + color:#b85152; + border-bottom-color:#000; + } + +.db-manager{ + float:right; + margin:5px 0 0 25px; + font-size:11px; + line-height:1.273; /*14px*/ + text-transform:uppercase; + letter-spacing:0.2px; + border-bottom:1px solid #bcb6a6; + text-decoration:none; + color:#9b9b8f; + } + .db-manager .highlighted{ + font-style:normal; + font-weight:bold; + color:#4097b3; + } + .db-manager:hover{ + color:#4097b3; + border-bottom-color:#b85152; + } + .db-manager:active{ + color:#b85152; + border-bottom-color:#4097b3; + } + .db-manager:active .highlighted{ + color:#b85152; + } + +#content{ + padding:8px 0 50px; + background:#fff url(../images/content-separator.png) repeat-x; +} +.b-ext-info-wrap{ + position:relative; + min-height:40px; + } + .b-ext-info{ + margin:0 0 6px; + padding:10px 25px 15px; + background:#ddd; + font-size:12px; + color:#000; + text-shadow: 0px 1px 1px #fff; + } + .b-ext-info-btn{ + position:relative; + left:-1px; + width:102px; + height:15px; + margin-left:-50px; + margin:-6px auto 0; + background-color:#fff; + cursor:pointer; + } + .b-ext-info-wrap_collapsed .b-ext-info-btn{ + background:url(../images/more-info-btn.png) no-repeat; + } +.content-inner{ + background-color:#fff; + padding:0 15px 15px; +} +/* +.domains{ + border-bottom:1px solid #333; + background-color:#fff; +} +.domains .item{ + position:relative; + padding:0 20px; + background:url(../images/long-dotted-bg.gif) repeat-x; +} +.domains .first{ + margin:0; + background:none; +} +.item .view{ + padding:15px 0 10px; +} +.item .ip-box{ + float:left; + width:150px; + padding-top:12px; +} +.ip-box .ip{ + font-size:1.1em; /*11px* + line-height:21px; + font-weight:normal; + letter-spacing:.175em; +} +.ip-box .owner{ + display:block; + font-size:1.2em; + color:#999; +} +.details .names .primary{ + font-size:20px; + font-family:Georgia, "Times New Roman", Times, serif; + font-weight:normal; + font-style:normal; + color:#000; /* radikal'no cherniy, da! * +} +.names .divider{ + font-size:12px; + line-height:2; + text-transform:uppercase; + color:#999; +} +.names .domain-name{ + padding:0 10px; + font-size:12px; + line-height:2; + font-style:italic; + color:#999; + white-space:nowrap; +} +.item .details{ + margin-left:150px; +} +.item .details .status{ + float:right; + width:60%; + margin:5px 20px 0 0; + color:#999; +} +.details .status .logging{ + float:left; +} +.logging .err-log, +.logging .log, +.logging .stats{ + float:left; + display:inline; + margin:0 20px 0 0; + padding-right:25px; + background:url(../images/logging-status-sprite.png) no-repeat -100% -100%; +} +.logging .off{ + background-position:100% 0; +} +.logging .on{ + background-position:100% 100%; +} +.logging .stats{ + margin-right:10px; +} +.logging .stat-auth{ + float:left; + display:inline; + margin:0 10px 0 0; + border-bottom:1px solid #9bcad0; + color:#999; + cursor:pointer; +} +.details .status .params{ + float:right; +} +.params .memory, +.params .t, +.params .max-weight, +.params .upload-weight{ + float:left; + display:inline; + margin-right:25px; +} +.memory{} + +.memory dl{ + overflow:hidden; + margin-bottom:2px; +} + +.memory dt{ + float:left; + width:15px; +} +.memory dd{ + float:left; +} +.memory .usage{} + +.memory .usage .value{ + float:left; + width:30px; +} +.memory .usage .divider{ + padding-right:2px; +} +.memory .usage .max{ + font-weight:bold; + border-bottom:1px solid #9bcad0; + cursor:pointer; +} +.memory .graph{ + clear:both; + position:relative; + border:1px solid #ccc; + font-size:0; + line-height:0; +} +.memory .graph .bar{ + position:relative; + display:block; + height:2px; +} +.critical .bar{ + background-color:#f00; +} +.middle .bar{ + background-color:#ff9934; +} +.low .bar{ + background-color:#acd45a; +} +.params .upload-weight{ + margin:0; +} +.t .value, +.max-weight .value, +.upload-weight .value{ + border-bottom:1px solid #9bcad0; + cursor:pointer; +} +.item .close{ + position:absolute; + top:30px; + right:20px; + display:block; + width:16px; + height:16px; + background:url(../images/sprite.png) no-repeat; + cursor:pointer; +} +.item .close:hover{ + background-position:-16px 0; +} +*/ +/* row hover effect +- - - - - - - - - - - - - - - - - - - */ +/* +.domains .item:hover{ + background-color:#ffffcb; +} +.item:hover .names .primary{ + cursor:pointer; + border-bottom:1px dotted #ccc; +} +.item:hover .logging .err-log, +.item:hover .logging .log, +.item:hover .logging .stats, +.item:hover .memory dt, +.item:hover .memory .divider, +.item:hover .params .title{ + color:#98bc65; +} +.item:hover .logging .stat-auth, +.item:hover .memory .max, +.item:hover .t .value, +.item:hover .max-weight .value, +.item:hover .upload-weight .value{ + color:#333; +} +*/ +/* Edit +- - - - - - - - - - - - - - - - - - - */ +/* +.edit{ + position:relative; + clear:both; + margin:0 -20px; + padding:15px 20px 10px; + border-top:2px solid #999; + background-color:#ffffcb; +} +.change-ip-box{ + margin:0 0 20px; +} +.edit .ip-details{ + float:left; + margin-right:20px; +} +.change-ip{ + width:140px; + padding:3px 5px; + border:2px solid #9bcad0; + font-size:16px; +} +.ip-details .created{ + display:block; + margin:5px 0 0; + font-size:12px; +} +.change-domain-name{ + width:360px; + padding:3px 5px; + border:2px solid #9bcad0; + font-size:16px; + font-weight:bold; +} +.edit .domain-name{ + font-size:20px; + font-family:Georgia, "Times New Roman", Times, serif; + font-weight:normal; + font-style:normal; + color:#000; /* radikal'no cherniy, da! * + white-space:nowrap; + line-height:2; +} +.change-logs-box{ + float:left; + width:170px; + margin-right:50px; + padding-left:180px; +} +.ownership{ + display:inline; + float:left; + width:160px; + margin:0 0 0 -180px; + font-size:12px; +} +.ownership .owner{ + display:block; + font-size:16px; + font-weight:bold; + font-style:italic; +} +.change-logs{ + padding-top:5px; +} +.change-logs label{ + display:block; + margin:0 0 9px; +} +.change-logs .last{ + margin:0; +} +.change-logs .title{ + display:block; + float:left; + width:70px; + font-size:14px; +} +.change-logs .title b{ + font-weight:bold; +} +.change-logs .checkbox{ + margin:3px 0 0; + border:2px solid #9bcad0; +} +.change-logs .stat-auth{ + position:relative; + top:-3px; + left:10px; + border-bottom:1px solid #9BCAD0; + cursor:pointer; +} +.change-memory{ + float:left; + width:150px; + padding-top:5px; + font-size:14px; +} +.change-memory dl{ + margin-bottom:13px; +} +.change-memory .value{ + padding:0 5px; + font-style:italic; + font-weight:bold; + color:#6b930f; +} +.change-memory .amount{ + margin-top:7px; +} +.change-memory .amount .max{ + width:50px; + margin-left:10px; + padding:2px 5px; + border:2px solid #9bcad0; + text-align:right; +} +.change-memory .graph{ + clear:both; + position:relative; + border:1px solid #9c9c82; + font-size:0; + line-height:0; +} +.change-memory .graph .bar{ + position:relative; + display:block; + height:2px; +} +.change-params{ + float:right; + font-size:14px; +} +.change-params li{ + margin-top:5px; + overflow:hidden; +} +.change-params .title{ + float:left; + width:165px; +} +.change-params .param-value{ + width:30px; + margin-right:5px; + padding:1px 5px; + border:2px solid #9bcad0; + text-align:right; + +} +.aliases{ + position:relative; + padding-top:20px; + margin-bottom:20px; +} +.aliases .title{ + float:left; + display:block; + margin-right:20px; + padding-top:3px; + font-size:17px; +} +.aliases .hint{ + position:absolute; + top:-15px; + left:78px; + font-style:italic; + color:#999; +} +.aliases-list{ + width:90%; + padding:3px 5px; + border:2px solid #9bcad0; + font-size:16px; +} +.buttons{} + +.buttons .apply{ + width:auto; + overflow:visible; + padding:4px 20px 3px 17px; + background-color:#feff99; + border:1px solid #728b25; + + font-family:"Lucida Grande", Tahoma, Arial, Verdana, sans-serif; + font-size:120%; + font-weight:bold; + text-transform:uppercase; + + line-height:130%; + color:#6b9e05; + cursor:pointer; + + float:right; +} +.buttons .devider{ + text-transform:uppercase; + float:right; + display:block; + line-height:24px; + margin:0 10px; +} +.buttons .cancel{ + float:right; + width:auto; + height:20px; + padding:0; + border:0 none; + background:none; + color:#e09462; + text-decoration:underline; + cursor:pointer; +} +.hidden{ + display:none; +} +.edit .iSelected{ /* descendant selector for more specific style context * + border-color:#59B4FF; /* blue border on focused input * + font-weight:bold; +} +.edit .not-valid{ /* descendant selector for more specific style context * + border-color:#f00; /* RED border on error field * +} + +.edit .edit-help{ + padding-bottom:1px; + font-family:Arial, Helvetica, sans-serif; + font-size:14px; + color:#a0a094; + text-decoration:none; + text-transform:uppercase; + border-bottom:1px solid #b5b59b; +} +.edit .delete{ + position:absolute; + top:15px; + right:25px; + padding:3px 25px 3px 2px; + font-family:Arial, Helvetica, sans-serif; + font-size:14px; + color:#a0a094; + text-transform:uppercase; + background:url(../images/delete.gif) no-repeat 100% 50%; + cursor:pointer; +} +.edit .delete .title{ + padding-bottom:1px; + border-bottom:1px solid #b5b59b; +} +*/ + +/* IP list +- - - - - - - - - - - - - - - - - - - - */ +#content{ + padding-bottom:0; +} +.ip-list{} + + .row{ + padding-top:10px; + padding:10px 10px 15px 10px; +/* min-height:125px; + min-height:110px;*/ + background:url(../images/long-dotted-bg.gif) repeat-x; + } + .first-row{ + background-image:none; + } + .row-meta{ + float:left; + width:150px; + } + .row-details{ + margin-left:150px; +/* background:#e0e0e0;*/ + } + .row-actions-box{ +/* margin:0 0 5px;*/ + } + + .row-actions-box .check-this, + .row-actions-box .check-control{ + float:left; + width:10px; + height:10px; + margin-top:4px; +/* background:url(../images/logging-status-sprite.png) no-repeat;*/ + background:url(../images/check-row-sprite.png) no-repeat; + background:url(../images/check-row-sprite_.png) no-repeat; + } + .row-actions-box .check-control:hover{ + cursor:pointer; + background-position:0 -89px; + } + .row-actions-box .row-operations{ + float:right; + } + .ip-status-info{ + position:relative; + display:block; + float:left; + margin-right:25px; + padding-right:15px; + font-size:12px; + } + .ip-status-info .ip-status-text{ + visibility:hidden; + } + .row .ip-suspended-status{ + margin-right:78px; + background:url(../images/suspended-ico.png) no-repeat 100% 65%; + } + .row .ip-suspended-status .ip-status-text{ + text-transform:uppercase; + color:#333; + font-size:10px; + visibility:visible; + } + .delete-entry{ + position:relative; + top:2px; + display:block; + float:left; + padding-right:15px; + font-size:11px; + text-transform:uppercase; + } + .delete-entry .delete-entry-text{ + visibility:hidden; + } + .entry-created{ + padding-top:7px; + font-size:11px; + color:#6f6f6f; + } + .props-main{ + float:left; + width:425px; +/* background:#eee;*/ + } + .props-main .prop-box{ + margin-bottom:15px; + } + + .props-additional{ + float:left; + width:200px; + padding:5px 10px 0 0; +/* background:#ccc;*/ + } + .props-ext{ + float:right; + width:120px; + padding-top:5px; +/* background:#d5d5d5;*/ + } + .ip-adr-box, + .user-wrap{ + margin:0 0 5px; + } + .ip-adr{ + display:-moz-inline-stack; + display:inline-block; + vertical-align:top; + + font-size:22px; + line-height:1; + font-weight:normal; + letter-spacing:0.5px; + } + .ip-adr:active, + .ip-adr:focus{ + color:#9fb749; + } + .ip-adr .dot{ + padding:0 3px; + } + .ip-list .ip-adr{ + border-bottom:1px solid #fff; + } + .username-box .user{ + display:-moz-inline-stack; + display:inline-block; + vertical-align:top; + + margin-right:10px; + } + .username-box .nickname{ + display:-moz-inline-stack; + display:inline-block; + vertical-align:top; + margin-right:5px; + + font-size:20px; + line-height:25px; + font-family:Arial, Helvetica, sans-serif; + color:#000; + + } + .username-box .role{ + display:-moz-inline-stack; + display:inline-block; + vertical-align:top; + + position:relative; + top:2px; + + font-size:12px; + line-height:25px; + color:#777; + } + + .prop-box{ + display:-moz-inline-stack; + display:inline-block; + vertical-align:top; + + min-width:40%; + width:auto !important; + width:40%; + margin:0 0 3px; + font-size:10px; + } + .prop-title{ + text-transform:uppercase; + color:#9c9c9c; + font-size:9px; + line-height:15px; + } + .prop-value{ + padding-left:3px; + font-size:12px; + color:#777; + } + .show-records{ + display:inline-block; + padding-right:15px; + border-bottom:1px solid #c9cabc; + background:url(../images/show-records-ico.png) no-repeat 100% 50%; + text-transform:uppercase; + line-height:13px; + cursor:pointer; + } + .hide-records{ + display:inline-block; + padding-right:15px; + border-bottom:1px solid #c9cabc; + background:url(../images/hide-records-ico.png) no-repeat 100% 50%; + text-transform:uppercase; + line-height:13px; + cursor:pointer; + } + + .props-additional .owner-box{ + padding-left:45px; + } + .props-additional .owner-box .prop-title{ + float:left; + display:inline; + margin:2px 0 0 -45px; + } + .props-additional .owner-box .prop-value{ + padding:0; + } + + .ip-list .ip-name-box{ + margin:0 0 3px; + } + + +/* Entry adding form +- - - - - - - - - - - - - - - - - - - */ +.b-new-entry{ + margin-top:25px; + border-style:solid; + border-width:2px 1px 1px; + border-color:#999 #ccc #ccc #ccc; + + background-color:#ffffcb; + } + .b-new-entry .entry-header{ + margin:0 0 10px; + padding:8px 15px 9px; + border-bottom:1px solid #dcdbab; + font-size:16px; + font-family:Georgia, "Times New Roman", Times, serif; + text-transform:uppercase; + color:#747668; + } + .b-new-entry .form-row{ + position:relative; + padding:10px 15px; + } + .b-new-entry .field-label, + .b-new-entry .row-header{ + float:left; + width:180px; + font-size:15px; + line-height:2; + color:#3d504a; + } + .b-new-entry .text-field{ + width:265px; + margin:0; + padding:6px 7px; + border:2px solid #b8c2c3; + color:#555; + font-family:Arial, Helvetica, sans-serif; + font-size:14px; + font-weight:bold; + } + .b-new-entry .field-label .remark{ + position:relative; + top:-14px; + display:block; + font-style:italic; + font-size:14px; + color:#a3a590; + } + + .b-new-entry .custom-select{} + + .b-new-entry .textarea{ + width:685px; + height:100px; + padding:6px 7px; + border:2px solid #b8c2c3; + color:#555; + font-family:Arial, Helvetica, sans-serif; + font-size:14px; + font-weight:bold; + } + .b-new-entry .text-field:focus, + .b-new-entry .textarea:focus{ + -moz-box-shadow:0 0 8px rgba(82, 168, 236, 0.5); + -webkit-box-shadow:0 0 8px rgba(82, 168, 236, 0.5); + border-color:rgba(82, 168, 236, 0.75) !important; + color:#333; + } + + .b-new-entry .ssl-crtfct-box .textarea{ + margin:10px 0 0; + } + .b-new-entry .select{ + position: absolute; + top:auto; + left:195px; + width: 195px; + height: 28px; + padding: 0 24px 0 8px; + color: #333; + font:bold 14px/28px arial,sans-serif; + background:#fff url(../images/select-arrow.png) no-repeat 100% 50%; + overflow: hidden; + border:2px solid #b8c2c3; + } + .b-new-entry select.styled{ + top:10px; + } + .b-new-entry option{ + font:14px arial,sans-serif; + } + .b-new-entry .form-options-group{} + + .b-new-entry .group-header{ + margin:12px 25px 12px 60px; + text-transform:uppercase; + color:#9c9c9c; + font-size:11px; + line-height:15px; + height:16px; + background:url(../images/dotted.gif) repeat-x 0 50%; + } + .b-new-entry .group-title-outer{ + padding:0 15px 0 0; + line-height:16px; + background:#ffffcb; + } + .b-new-entry .group-title{ + padding:2px 15px 2px 0; + } + .b-new-entry .expanded .group-title{ + background:#ffffcb url(../images/form-group-expanded.png) no-repeat 100% 50%; + } + .b-new-entry .collapsed .group-title{ + background:#ffffcb url(../images/form-group-collapsed.png) no-repeat 100% 50%; + } + + .b-new-entry .checkbox{ + display:block; + float:left; + width:18px; + height:18px; + margin:6px 0 0; + background:url(../images/checkbox-1.png) no-repeat; + } + .b-new-entry .checkbox:hover{ + background-position:0 -98px; + } + .b-new-entry .stats-settings{ + padding-left:40px; + } + .b-new-entry .db-credentials .field-label{ + text-indent:40px; + } + .b-new-entry .pwd-box .text-field{ + float:left; + margin:0 15px 0 0; + } + .b-new-entry_dns .dns-template-box .styled{ + float:left; + margin:0 40px 0 0; + margin:0 20px 0 0; + width:230px; + cursor:pointer; + } + .generate-pwd, + .context-settings{ + position:relative; + top:10px; + float:left; + display:block; + color:#5ea2a1; + border-bottom:1px solid #cdcea6; + text-transform:uppercase; + cursor:pointer; + + font-size:11px; + line-height:1; + letter-spacing:0.5px; + } + .generate-pwd:hover, + .context-settings:hover{ + color:#575757; + border-bottom-color:#b4c775; + } + .generate-pwd:active, + .context-settings:active{ + color:#b4c775; + } + .b-new-entry .buttons-row{ + position:relative; + margin-top:10px; + padding:8px 15px 8px 195px; + border-top:1px solid #dcdbad; + background:url(../images/form-bottom-bg.png) repeat-x; + } + .b-new-entry .help-btn{ + position:absolute; + top:13px; + left:16px; + font-size:11px; + line-height:12px; + color:#b4b39f; + text-transform:uppercase; + cursor:pointer; + border-bottom:1px solid #b4b39f; + } + .b-new-entry .help-btn:hover{ + color:#000; + border-bottom-color:#9fb35a; + } + .b-new-entry .help-btn:active{ + color:#4B9427; + } + .b-new-entry .cancel-btn{ + position:absolute; + top:15px; + right:20px; + font-size:12px; + line-height:1; + text-transform:uppercase; + color:#cc7c4b; + cursor:pointer; + border-bottom:1px solid #cc7c4b; + } + .b-new-entry .cancel-btn:hover{ + color:#000; + border-bottom-color:#c5795f; + } + .b-new-entry .cancel-btn:active{ + color:#CC7C4B; + } + .b-new-entry .add-entry-btn{ + overflow:visible; + height:28px; + padding:0 50px; + -webkit-border-radius:9px; + -moz-border-radius:9px; + border-radius:9px; + border:2px solid #c8c09c; + background-color:#feff99; + color:#444428; + font-size:14px; + font-family:Arial, Helvetica, sans-serif; + font-weight:bold; + line-height:25px; + text-transform:uppercase; + cursor:pointer; + } + .b-new-entry .add-entry-btn:focus{ + position:relative; + top:1px; + } + .b-new-entry .add-entry-btn:hover{ + background-color:#feff77; + color:#464322; + border-color:#9e977b; + } + .b-new-entry .add-entry-btn:active{ + background-color:#928d7a; + color:#fefe9e; + border-color:#87826e; + } + .b-new-entry .autocomplete-box{ + position:relative; + float:left; + padding-right:35px; + background:#fff; + } + .b-new-entry .autocomplete-box .text-field{ + width:213px; + } + .b-new-entry .autocomplete-box .arrow{ + position:absolute; + top:0; + right:0; + display:block; + width:32px; + height:32px; + font-size:0; + line-height:0; +/* background:#fff url(../images/select-arrow.png) no-repeat 100% 50%;*/ + background:#fff url(../images/autocomplete-field-arrows-sprite.png) no-repeat; + cursor:pointer; + } + .b-new-entry .autocomplete-box .arrow:hover, + .b-new-entry .autocomplete-box .arrow:active, + .b-new-entry .autocomplete-box .arrow:focus{ + background-position:0 -32px; + } + + .b-new-entry .form-error{ + position:relative; + margin:-5px 5px 5px; + padding:8px 15px; + border:1px solid #dcdbad; + background:url(../images/form-bottom-bg.png) repeat-x; + } + .form-error .error-box{ + padding-left:18px; + background:url(../images/error-bullet.png) no-repeat 0 50%; + } + .form-error .error-box .error-message{ + color:#9a32ff; + font-size:16px; + line-height:22px; + } + .form-error .error-box .help-tip-url{ + position:relative; + top:-1px; + font-size:12px; + line-height:15px; + color:#b4b39f; + text-transform:uppercase; + text-decoration:none; + cursor:pointer; + border-bottom:1px solid #b4b39f; + } + .b-new-entry .help-tip-url:hover{ + color:#000; + border-bottom-color:#9fb35a; + } + + .b-new-entry_cron{} + + .b-new-entry_cron .form-row{ + padding-top:7px; + padding-bottom:5px; + } + .b-new-entry_cron .run-at-box{ + padding-bottom:7px; + } + .b-new-entry_cron .run-at-box .row-header{ + margin-top:35px; + } + .b-new-entry_cron .form-row-line .field-box{ + margin-right:14px; + } + .b-new-entry_cron .form-row-line .cron-week-box{ + margin:0; + } + .b-new-entry_cron .form-row-line .field-label{ + display:block; + float:none; + width:auto; + line-height:1; + padding:0 0 8px; + color:#7d7d7d; + + font-size:13px; + } + .b-new-entry_cron .form-row-line .text-field{ + width:112px; + } + .b-new-entry_cron .form-row-line .cron-week-box .text-field{ + width:109px; + } + + .b-new-entry_cron .textarea{ + height:60px; + } + +/* Show/edit dns records form +- - - - - - - - - - - - - - - - - - - */ +.b-records-list{ + margin-left:160px; + } + .b-records-list .entry-header{ + padding-top:6px; + padding-bottom:11px; + } + .b-records-list .hide-records{ + font-size:10px; + font-family:Arial, Helvetica, sans-serif; + line-height:13px; + } + .b-records-list .add-btn{ + margin:0; + float:none; + } + .b-records-list .form-row{ + padding-top:5px; + padding-bottom:5px; + } + .b-records-list .add-box{ + padding-bottom:15px; + } + .b-records-list .buttons-row{ + margin-top:20px; + } + .form-row-line{ + position:relative; + } + .form-row-line .field-box{ + float:left; + } + .form-row-line .field-devider{ + float:left; + display:block; + min-height:30px; + margin:0 15px; + font-size:15px; + line-height:2; + } + .b-records-list .form-row-line .field-label{ + float:none; + display:block; + width:auto; + line-height:20px; + } + .b-records-list .dns-record-box .text-field{ + width:147px; + float:left; + } + .b-records-list .dns-type-box{ + margin-right:15px; + } + .b-records-list .dns-type-box .select{ + width:51px; + left:221px; + } + .b-records-list .dns-type-box select.styled{ + width:87px; + cursor:pointer; + } + .b-records-list .dns-value-box .text-field{ + width:390px; + } + .b-records-list .delete-record{ + position:relative; +/* top:31px; + left:10px;*/ + position:absolute; + bottom:15px; + right:11px; + display:block; + float:left; + width:11px; + height:11px; + background:url(../images/delete-ico-off.png) no-repeat; + } + .b-records-list .delete-record:hover{ + cursor:pointer; + background-image:url(../images/delete-ico.png); + } + .b-records-list .delete-record:active{ + cursor:pointer; + background-image:url(../images/delete-ico-active.png); + } + + +/* Web-domains list +- - - - - - - - - - - - - - - - - - - */ +.domains-list{} + + .domains-list .entry-created{ + padding-top:9px; + } + .names{ + margin:0 0 6px; + color:#acacac; + } + .names .alias-title{ + position:relative; + top:-1px; + padding-right:3px; + padding:0 3px 0 25px; + font-size:10px; + line-height:1.8; + text-transform:uppercase; + } + .names .domain-name{ + position:relative; + top:-1px; + padding:0 3px 0 0; + font-size:12px; + line-height:1.5; + color:#acacac; + white-space:nowrap; + } + .row-details .names .primary{ + top:0; +/* padding:0 25px 0 0;*/ + font-size:20px; + font-family:Arial, Helvetica, sans-serif; + font-weight:normal; + font-style:normal; + color:#000; /* radikal'no cherniy, da! */ + } + .names .primary:active{ + color:#9fb749; + } + .domains-list .names .primary, + .dns-list .names .primary{ + border-bottom:1px solid #fff; + } + + .domains-list .props-main{ + width:345px; + } + .domains-list .ip-adr{ + font-size:16px; + color:#888; + } + .domains-list .ip-adr-box .prop-box{ + margin-left:20px; + } +/* .domains-list .ip-adr-box .prop-value{ + padding:0; + cursor:pointer; + border-bottom:1px solid #cbcbbf; + } */ + .domains-list .props-additional{ + width:230px; + padding-top:0; +/* background:#bbb;*/ + } + .domains-list .props-ext{ + width:170px; + padding-top:0; +/* background:#ddd;*/ + } + +.b-usage-box{ + display:block; +} + + .b-usage-box .prop-title{ + float:left; + margin:2px 15px 0 0; + } + .b-usage-box .usage-box{ + float:left; + width:136px; + } + .b-usage-box .usage-box{ + + } + .b-usage-box .value-box{ + float:left; + width:75px; + } + .b-usage-box .max-size{ + float:right; + } + .b-usage-box .value{ + display:block; + font-size:11px; + line-height:1; + color:#999; + } + .b-usage-box .max-size{ + position:relative; + top:2px; + font-size:14px; + line-height:1; + color:#ababab; + } + .b-usage-box .max-size .units{ + font-size:12px; + color:#797979; + } + .graph{ + position:relative; + border:1px solid #b7b7b9; + font-size:0; + line-height:0; + } + .graph .bar{ + position:relative; + display:block; + height:2px; + } + .critical .bar{ + background-color:#f00; + } + .middle .bar{ + background-color:#ff9934; + } + .low .bar{ + background-color:#9fec00; + } + +.domains-list .disk-usage{ + margin:0 0 6px; +} +.domains-list .props-additional .prop-box, +.domains-list .props-ext .prop-box{ + display:block; + margin:0; + } + .stats-box{} + + .stats-box .stats-auth{ + position:relative; + top:3px; + display:-moz-inline-stack; + display:inline-block; + vertical-align:top; + + margin:0 0 0 5px; + padding:0 0 0 10px; + font-size:12px; + line-height:1.5; + color:#777; + cursor:pointer; + } + .stats-box .stats-auth-on{ + background:url(../images/auth-plus.png) no-repeat 0 60%; + } + .stats-box .stats-auth-text{ + display:block; + line-height:11px; + border-bottom:1px solid #cacbbd; + } + + .nginx-box{} + + .nginx-box .nginx-ext-list{ + position:relative; + top:3px; + display:-moz-inline-stack; + display:inline-block; + vertical-align:top; + + margin:0 0 0 5px; + border-bottom:1px solid #cacbbd; + font-size:12px; + line-height:1; + color:#777; + cursor:pointer; + } + .template-box{} + + .template-box .prop-value{ + padding:0; + cursor:pointer; + border-bottom:1px solid #cbcbbf; + } + +/* DNS list +- - - - - - - - - - - - - - - - - - - */ +.dns-list{} + + .dns-list .row-details{ + padding-bottom:8px; + } + .dns-list .entry-created{ + padding-top:9px; + } + .dns-list .props-main{ + width:295px; + } + .dns-list .props-additional{ + width:200px; + } + .dns-list .props-ext{ + width:250px; + } +.dns-list .props-additional .prop-box, +.dns-list .props-ext .prop-box{ + display:block; + margin:0; + } +.dns-list .ip-adr-box{ + margin:0; + } + .dns-list .ip-adr{ + font-size:12px; + line-height:1.5; + color:#777; + } + +/* Cron list +- - - - - - - - - - - - - - - - - - - */ +.cron-list{} + + .cron-list .entry-created{ + padding-top:18px; + } + .cron-list .cron-meta{ + margin:0 0 9px; + } + .cron-meta .prop-box{ + min-width:0; + } + .cron-meta .prop-title{ + display:block; + text-transform:none; + font-size:10px; + } + .cron-meta .prop-value{ + padding:0; + font-size:16px; + color:#7c7c7c; + } + .cron-meta .cron-min, + .cron-meta .cron-hour, + .cron-meta .cron-day, + .cron-meta .cron-week, + .cron-meta .cron-month{ + min-width:45px; + padding-right:20px; + } + + .cron-command-box{ + margin:0 0 5px; + } + .cron-command-line{ + position:relative; + padding:0 3px 0 0; + font-family:Arial, Helvetica, sans-serif; + font-size:20px; + line-height:1.5; + font-weight:normal; + font-style:normal; + color:#000; + + } + .cron-command-line:active{ + color:#9fb749; + } + .cron-list .cron-command-line{ + border-bottom:1px solid #fff; + } + + .cron-reported-to{ + margin:0 0 3px; + } + .cron-reported-to .prop-title{ + padding-right:3px; + } + .cron-reported-to .prop-value{ + padding:0 3px 0 0; + } + +/* Cron list +- - - - - - - - - - - - - - - - - - - */ +.users-list{} + + .users-list .entry-created{ + padding-top:10px; + } + .users-list .user-wrap{ + margin:0 0 19px; + } + .users-list .props-main{ + width:345px; + } + .users-list .username-box{ + padding-top:6px; + } + .users-list .username-box .user{ + position:relative; + top:-6px; + } + .users-list .username-box .nickname{ + border-bottom:1px solid #fff; + } + + .user-backups-box{ + margin-top:5px; + } + .user-backups-box .prop-title{ + border-bottom:1px solid #CBCBBF; + font-size:12px; + text-transform:capitalize; + cursor:pointer; + color:#777; + } + + .users-list .props-additional{ + width:200px; + } + .users-list .props-additional .prop-box, + .users-list .props-ext .prop-box{ + display:block; + } + .users-list .props-additional .ns1-box, + .users-list .props-additional .ns2-box{ + padding-left:27px; + } + .users-list .props-additional .ns1-box .prop-title, + .users-list .props-additional .ns2-box .prop-title{ + display: inline; + float: left; + margin: 2px 0 0 -27px; + } + .users-list .props-additional .ns1-box .prop-value, + .users-list .props-additional .ns2-box .prop-value{ + padding:0; + } + + .users-list .props-ext{ + width:200px; + } + .username-box .prop-box{ + position:relative; +/* top:6px;*/ + margin:0; + } + .user-details{ + font-size:12px; + } + .user-details .user-email{ + color:#777; + padding-right:5px; + } + .user-details .user-reports{ + color:#9c9c9c; + } + +/* DB list +- - - - - - - - - - - - - - - - - - - */ +.db-list{} + + .db-list .row-details{ + padding-bottom:8px; + } + .db-list .db-devider{ + margin-top:25px; + position:relative; + display:block; + border-bottom:1px solid #e0e0e0; + } + .db-list .db-devider-title{ + display:block; + position:absolute; + top:-8px; + left:-50%; + width:200%; + } + .db-list .db-devider-outer{ + display:block; + position:absolute; + left:50%; + } + .db-list .db-devider-inner{ + background:#fff; + position:relative; + left:-50%; + padding:0 10px; + + font-size:11px; + font-weight:bold; + text-transform:uppercase; + color:#4097B3; + } + + .db-list .props-main{ + width:210px; + padding-right:10px; + } + .db-list .props-additional{ + width:340px; + padding-top:6px; + } + .db-list .props-ext{ + width:185px; + padding-top:6px; + } + .db-name{ + position:relative; + margin:0 0 6px; + padding:0 3px 0 0; + } + .db-name-box .db-name{ + font-size:20px; + font-family:Arial, Helvetica, sans-serif; + font-weight:normal; + font-style:normal; + line-height:27px; + } + .db-name:active{ + color:#9fb749; + } + .db-list .db-name{ + border-bottom:1px solid #fff; + } + + .db-list .ownership .prop-box{ + margin:5px 0 0; + } + .db-list .ownership .prop-value{ + padding:0; + font-size:11px; + font-style:italic; + } + .db-list .entry-created{ + padding:0; + } + .db-user-box{ + margin:0 0 10px; + } + .db-user-box .db-user{ + position:relative; + display:block; + float:left; + margin-right:25px; + padding-right:20px; + + font-size:12px; + line-height:1.25; /*15px*/ + font-style:italic; + color:#999; + } + .db-user-box .db-user:hover{ + color:#f00; + } + .db-user-box .change-pwd{ + position:relative; + top:1px; + display:inline-block; + border-bottom:1px solid #c9cabc; + text-transform:uppercase; + line-height:13px; + cursor:pointer; + visibility:hidden; + } + .add-db-user{ + border-bottom:1px solid #c9cabc; + text-transform:uppercase; + line-height:13px; + padding-left:10px; + background:url(../images/auth-plus.png) no-repeat 0 50%; + color:#555; + cursor:pointer; + } + .backup-db{ + float:left; + position:relative; + top:2px; + display:-moz-inline-stack; + display:inline-block; + vertical-align:top; + + border-bottom:1px solid #cacbbd; + font-size:12px; + line-height:13px; + color:#777; + cursor:pointer; + } + .db-list .b-usage-box{ + float:right; + position:relative; + top:1px; + } + .db-list .b-usage-box .usage-box{ + width:auto; + } + .db-list .b-usage-box .value, + .db-list .b-usage-box .max-size{ + color:#797979; + } + .db-list .b-usage-box .value-box{ + width:60px; + margin-right:5px; + } + .db-list .b-usage-box .max-size{ + float:left; + } + .db-list .b-usage-box .max-size .units{ + color:#ABABAB; + } + + +/* row hover effect +- - - - - - - - - - - - - - - - - - - */ +.row:hover{ + background-color:#ffffcb; +} +.ip-list .row:hover .ip-adr, +.domains-list .row:hover .names .primary, +.dns-list .row:hover .names .primary, +.cron-list .row:hover .cron-command-line, +.users-list .row:hover .username-box .nickname, +.db-list .row:hover .db-name{ + border-bottom-style:dashed; + border-bottom-color:#e5e5e5; + border-bottom-color:#bbb; +} +.ip-list .row:hover .ip-adr:hover, +.domains-list .row:hover .names .primary:hover, +.dns-list .row:hover .names .primary:hover, +.cron-list .row:hover .cron-command-line:hover, +.users-list .row:hover .username-box .nickname:hover, +.db-list .row:hover .db-name:hover{ + cursor:pointer; + border-bottom-style:solid; + border-bottom-color:#b4c775; +} +.ip-list .ip-details-suspended:hover .ip-adr, +.ip-list .ip-details-suspended:hover .ip-adr:hover{ + border:none; + cursor:default; +} +.row:hover .ip-status-info{ + background:url(../images/enabled-ico_.png) no-repeat 100% 50%; +} +.row:hover .delete-entry, +.row:hover .db-user-box .db-user{ + background:url(../images/delete-ico-off.png) no-repeat 100% 4px; +} +.row:hover .ip-suspended-status{ + background:url(../images/suspended-ico.png) no-repeat 100% 65%; +} +.ip-status-info:hover .ip-status-text, +.delete-entry:hover .delete-entry-text, +.row:hover .db-user-box .change-pwd{ + visibility:visible; +} +.row .ip-status-info:hover{ + background-image:url(../images/enabled-ico-hover.png); +} +.row .delete-entry:hover, +.row .db-user-box .db-user:hover{ + background-image:url(../images/delete-ico.png); + cursor:pointer; +} +.row .delete-entry:active{ + background-image:url(../images/delete-ico-active.png); + cursor:pointer; +} +.delete-entry:hover .delete-entry-text{ + color:#333; +} +.delete-entry .delete-entry-text:hover{ + cursor:pointer; +} +.delete-entry .delete-entry-text:active{ + color:#f00; +} +.row:hover .show-records, +.row:hover .hide-records, +.row:hover .template-box .prop-value, +.domains-list .row:hover .stats-box .stats-auth-text, +.domains-list .row:hover .nginx-box .nginx-ext-list, +.row:hover .db-user-box .change-pwd, +.row:hover .add-db-user, +.row:hover .backup-db, +.row:hover .user-backups-box .prop-title{ + color:#6aa0ac; + border-bottom-color:#cacbbd; +} +.row:hover .template-box .prop-value:hover, +.row:hover .show-records:hover, +.hide-records:hover, +.domains-list .row:hover .stats-box .stats-auth-text:hover, +.domains-list .row:hover .nginx-box .nginx-ext-list:hover, +.row .db-user-box .change-pwd:hover, +.row .add-db-user:hover, +.row .backup-db:hover, +.row .user-backups-box:hover .prop-title{ + color:#575757; + border-bottom-color:#b4c775; +} +.row .template-box .prop-value:active, +.row .show-records:active, +.hide-records:active, +.domains-list .row:hover .stats-box .stats-auth-text:active, +.domains-list .row:hover .nginx-box .nginx-ext-list:active, +.users-list .username-box .nickname:active, +.users-list .user-backups-box .prop-title:active, +.row .db-user-box .change-pwd:active, +.row .add-db-user:active, +.row .backup-db:active, +.row .user-backups-box .prop-title:active{ + color:#b4c775; +} + +/* Checked row +- - - - - - - - - - - - - - - - - - - */ +.checked-row{ + background-color:#e4f7bf; +} + .checked-row .row-actions-box .check-control{ + background-position:0 -30px; + } + + .domains-list .checked-row .names .primary, + .dns-list .checked-row .names .primary, + .cron-list .checked-row .cron-command-line, + .users-list .checked-row .username-box .nickname, + .db-list .checked-row .db-name{ + border-bottom:1px solid #e4f7bf; + } + +/* Suspended row +- - - - - - - - - - - - - - - - - - - */ +.ip-details-suspended, +.suspended-row{} + +.ip-details-suspended:hover, +.suspended-row:hover{ + background-color:#fff; +} + .ip-details-suspended .entry-created, + .suspended-row .entry-created, + .suspended-row .username-box .role{ + color:#ccc; + } + .ip-details-suspended .ip-adr, + .suspended-row .ip-adr, + .suspended-row .cron-command-line, + .suspended-row .username-box, + .suspended-row .username-box .nickname, + .suspended-row .user-backups-box .prop-title, + .suspended-row .user-details .user-email, + .suspended-row .user-details .user-reports, + .suspended-row .template-box .prop-value{ + color:#ccc; + border:none; + } + .ip-details-suspended:hover .ip-adr, + .suspended-row:hover .ip-adr, + .cron-list .suspended-row:hover .cron-command-line, + .users-list .suspended-row:hover .username-box .nickname, + .users-list .suspended-row:hover .user-backups-box .prop-title{ + border:none; + } + .ip-details-suspended:hover .ip-adr:hover, + .suspended-row:hover .ip-adr:hover, + .cron-list .suspended-row:hover .cron-command-line:hover, + .users-list .suspended-row:hover .username-box .nickname:hover, + .users-list .suspended-row:hover .user-backups-box .prop-title:hover{ + border:none; + cursor:default; + } + .users-list .suspended-row .username-box .nickname:active, + .users-list .suspended-row .user-backups-box .prop-title:active{ + color:#ccc; + } + +.ip-details-suspended .prop-title, +.ip-details-suspended .prop-value, +.suspended-row .prop-title, +.suspended-row .prop-value, +.suspended-row .b-usage-box .value, +.suspended-row .b-usage-box .max-size, +.suspended-row .b-usage-box .max-size .units{ + color:#ccc; +} +.suspended-row .b-usage-box .bar{ + background-color:#ccc; +} +.suspended-row:hover .show-records, +.suspended-row:hover .hide-records, +.suspended-row:hover .template-box .prop-value, +.domains-list .suspended-row:hover .stats-box .stats-auth-text, +.domains-list .suspended-row:hover .nginx-box .nginx-ext-list, +.suspended-row:hover .user-backups-box .prop-title, +.suspended-row:hover .template-box .prop-value:hover, +.suspended-row:hover .show-records:hover, +.suspended-row .hide-records:hover, +.domains-list .suspended-row:hover .stats-box .stats-auth-text:hover, +.domains-list .suspended-row:hover .nginx-box .nginx-ext-list:hover{ + color:#ccc; + border:none; + cursor:default; +} +.suspended-row:hover .template-box .prop-value:active, +.suspended-row:hover .show-records:active, +.suspended-row .hide-records:active, +.domains-list .suspended-row:hover .stats-box .stats-auth-text:active, +.domains-list .suspended-row:hover .nginx-box .nginx-ext-list:active, +.users-list .suspended-row .username-box .nickname:active, +.users-list .suspended-row .user-backups-box .prop-title:active{ + color:#ccc; +} \ No newline at end of file diff --git a/web/css/reset2.css b/web/css/reset2.css new file mode 100644 index 00000000..b2056d65 --- /dev/null +++ b/web/css/reset2.css @@ -0,0 +1,45 @@ +html, body, div, span, applet, object, iframe, +h1, h2, h3, h4, h5, h6, p, blockquote, pre, +a, abbr, acronym, address, big, cite, code, +del, dfn, em, font, img, ins, kbd, q, s, samp, +small, strike, strong, sub, sup, tt, var, +b, u, i, center, +dl, dt, dd, ol, ul, li, +fieldset, form, label, legend, +table, caption, tbody, tfoot, thead, tr, th, td { +margin: 0; +padding: 0; +border: 0; +outline: 0; +font-size: 100%; +vertical-align: baseline; +background: transparent; +} +body { +line-height: 1; +} +ol, ul { +list-style: none; +} +blockquote, q { +quotes: none; +} + +/* remember to define focus styles! */ +:focus { +outline: 0; +} + +/* remember to highlight inserts somehow! */ +ins { +text-decoration: none; +} +del { +text-decoration: line-through; +} + +/* tables still need 'cellspacing="0"' in the markup */ +table { +border-collapse: collapse; +border-spacing: 0; +} \ No newline at end of file diff --git a/web/dispatch.php b/web/dispatch.php new file mode 100644 index 00000000..76338d65 --- /dev/null +++ b/web/dispatch.php @@ -0,0 +1,49 @@ + \ No newline at end of file diff --git a/web/images/add-entry-plus.gif b/web/images/add-entry-plus.gif new file mode 100644 index 0000000000000000000000000000000000000000..f4d45b9b8c38ad5cfe187008e790883f9e6aa8d3 GIT binary patch literal 62 zcmZ?wbhEHbDSr z1<%~X^wgl##FWaylc_d9MM42SA+DP@Z}#!=F)=aOdUV%+FnG1$mn2Y@tt7}V7%afB zdH<6AK#^=u7srr_TW_Wu{( zJaZG%Q-e|yQz{EjrrLmX1o(uwZrQrQ+uK`BO|7^jPenyVSy_4I>ZR9jT-DUnT(WGz z^cj=y-n(sJU~upLotw9=Gcq!=v$G#Kw70pXaohGyx9{9~{`}d3MRRW5zM-$LUr>}i zXa3a8?Bt*oZ#HjV3AEuq7(AYBy%fk%ED7=phKS%M8Rj3npa@i4@9E+gQgQ3aBu~Bu z1s;aN`$ucHfA}9B#kBV0JJ07P>>4jw3XL9x^lkrI=VW|8II4&{^QX@{zvK@aoQ*WD zGWV?Tp1ggczRz4G)`pX2tGzfh;_sfd*F7mTDXplqOZB6JQAV!UqFs}o&C<_MLtwR6+ literal 0 HcmV?d00001 diff --git a/web/images/console-bg.png b/web/images/console-bg.png new file mode 100644 index 0000000000000000000000000000000000000000..62139cce8861a872dfc198b9db21c3df05a81f09 GIT binary patch literal 121 zcmeAS@N?(olHy`uVBq!ia0vp^AT}2V8<6ZZI=>f4NtU=qlmzFem6RtIr7}3CiO|&Y7lq RE&(cI@O1TaS?83{1ONxTAvgd4 literal 0 HcmV?d00001 diff --git a/web/images/console-box-bg.png b/web/images/console-box-bg.png new file mode 100644 index 0000000000000000000000000000000000000000..2998ec1d27a1739fad416f6da7076cb7bab278eb GIT binary patch literal 161 zcmeAS@N?(olHy`uVBq!ia0vp^oIvc#!3-qVU$rp>Qj#UE5hcO-X(i=}MX3yqDfvmM z3ZA)%>8U}fi7AzZCsS>JibMl^LR>4$3MOFEist4j0PvJ^~!3Y0uu z978H@B_*V#q$DP!Bqbyyq$W2n2)w3|ePQE+mm&%W7!(qCi?)|P%m=Dw@O1TaS?83{ F1ON}tGb#W8 literal 0 HcmV?d00001 diff --git a/web/images/content-separator.png b/web/images/content-separator.png new file mode 100644 index 0000000000000000000000000000000000000000..6c4e860d62186f505ff0932f0fb601d5dae724aa GIT binary patch literal 175 zcmeAS@N?(olHy`uVBq!ia0vp^%s|Y+0V25#xB3Ao$r9IylHmNblJdl&R0hYC{G?O` z&)mfH)S%SFl*+=BsWw1GiUB?$u2-*I`1kMM*RNl{ef{|M{hKRS&+p!U;MIpWSFfJ^ z^B)8_3`6;Wid8&a978H@B_*V%Cnh{eN_+4qi6M#4;MtRu)P&?@)=e`Rn0OetN*Gp8 Tn{gutsGh;o)z4*}Q$iB}M=wQ| literal 0 HcmV?d00001 diff --git a/web/images/delete-ico-off.png b/web/images/delete-ico-off.png new file mode 100644 index 0000000000000000000000000000000000000000..0b6109653cd1a3c45f6715a3f8d7b4c7634da904 GIT binary patch literal 175 zcmeAS@N?(olHy`uVBq!ia0vp^93afW3?x5a^xFxfBuiW)N`mv#O3D+9QW+dm@{>{( zJaZG%Q-e|yQz{EjrrH1%@dWsUxXzn5udlCf#*7*N|Nq~^bZ!AqoTVhlFBr&WaL`)$ z1<2R*ba4!+xRsQUki^EM#>S@RroioC(7++k&Ul2CQ^_zPsNkr{( zJaZG%Q-e|yQz{EjrrH1%@dWsUxW13}d~R>{I@sy||Nm#5I1+&3EG0pH!9Xs9gVxF~ zK)$A@i(^Q|t)zs6BsL~BHa0ak1#S<61`dIC#v`npN`?tR1xF3uGBC0+2;E?4FVdQ&MBb@0Ot2ILjV8( literal 0 HcmV?d00001 diff --git a/web/images/enabled-ico-hover.png b/web/images/enabled-ico-hover.png new file mode 100644 index 0000000000000000000000000000000000000000..9396360e50dd616b401327ef04744884bc8f724c GIT binary patch literal 216 zcmeAS@N?(olHy`uVBq!ia0vp^AT}2VGmzZ%#=aj&NtU=qlmzFem6RtIr7}3C4zkh%2Jte&(WxV4=X6-Orx3h1QVbd9%^FUE6PZ!6Kid#Ot+j$ubcn&|&`~Sb7LFC9Bixmq3 z^PaV~d8y1)?BdE>^q|s2_E@*CY-8YS`)j}SrZF%xH2!8vV*T)*4`>R5r>mdKI;Vst E0QOW%Y;O(J?*&W poS^+M%wM)K@U;Bv?o(n343Tpf=SOeUj0Eau@O1TaS?83{1OR)zO2PmD literal 0 HcmV?d00001 diff --git a/web/images/error-bullet.png b/web/images/error-bullet.png new file mode 100644 index 0000000000000000000000000000000000000000..a114a2e694a4134e731dd18affc3e9e4bf51fe16 GIT binary patch literal 359 zcmV-t0hs=YP)csQ^ z_U)K6`HV`o?8f)>wEo$f{+crX<Fn6q^~(R1HTan_ z|Cl!ajaRFOO0nJ9wClw4j7hrW(#VKPwg2<=jaj7Y#`5R1|C%xXhDyAONx_*i{hvPl zhhUBE#`3^t|CT!CmNxJH*!`L{`*sV-V0+v5+v8U1S&9zmf`HDYTzydlT5+u*SBy%OL;^b?t=$cKJtT$h+ V_{~@Jh@JIW=Q8yJ+j1EhtO2J&7ApV% literal 0 HcmV?d00001 diff --git a/web/images/form-bottom-bg.png b/web/images/form-bottom-bg.png new file mode 100644 index 0000000000000000000000000000000000000000..eb9be9030115815f536795137c91848088a82cdf GIT binary patch literal 218 zcmeAS@N?(olHy`uVBq!ia0vp^Y(T8T!3-n|RV}rElw^r(L`iUdT1k0gQ7VIDN`6wR zf@f}GdTLN=VoGJ<$y6JlBI5v`5ZC|zF8u#@|6H_V+Po~-c6?J*KIEGZ*GV$BU%d9BC{XcWUzxD+UY||1L*?t&GG92M5 zQQ*?DveM$}n5vV?%LXk7V+fd)aHh*Uk^}Vv)EQmE3Fit=rJ=!=X9Bnyn1hFB+43 frd;Z0U}k8r4F2@$aOD}Gs~9|8{an^LB{Ts5Is{hT literal 0 HcmV?d00001 diff --git a/web/images/long-dotted-bg.gif b/web/images/long-dotted-bg.gif new file mode 100644 index 0000000000000000000000000000000000000000..2b2747067d03c473649443e1c31e1e5c67dd4583 GIT binary patch literal 68 zcmZ?wbhEHb)L~>~XkcJCbLPzd|Nj+#vM_*v4wwMSFfd8GBvqVz%@tj<>5}#4s};Zb SiXNG_J;_}5v}+wJgEau#G8icU literal 0 HcmV?d00001 diff --git a/web/images/more-info-btn.png b/web/images/more-info-btn.png new file mode 100644 index 0000000000000000000000000000000000000000..790695b33382aa81f9a4da9a493ea8f9284b7962 GIT binary patch literal 1401 zcmV-<1%~>GP)g!NM@L6jS64wnLH_^$|Nr`skdSO_Y;A3ALPA1LPEKNC zVoy&`O-)T_XJ=bmTU1n3i;Ii<`};&hMECdid3kx%)YONEhjVjt;^N}Z&(Csla=yO4 zV`F2ludkDnlh)SG?(XjV{QOKzOl4(dUS3{*e}6kWJ4i@KU|?X|+uO#*#&>sjmzS6N z`ug_v_Hl7>%F4>u*U$L)_+(^cJv}|z+S;F=pYQMQ|Nr)`uCCM5)62`tiHV8l=jU#2 zZg6mLS65Z%=igRVR(g7RdwYA;)zx2LUq(hojg5_TbaXQ_Gf+@aYHDhfl$4Q?k(rs9 zn3$N@*w{-;OZoZv!otGU)yw+%_u1LmSXfv}N=obN>s3`%)zr^*b#=3|v+?oqwY9a) z&CU4u@U5+_g@uLVguDTqvhq< z)YQ`Y`trQIyq%q$T3T9YXlU~C@@s2rQc_ak-q%SCdp=H|b@ zzo@9Ffq{X3etwRQj_vK`)YZ`D=i=n#;^pSy)YQ!G@ax*y)YR3_+}zal^z!=r`(|cl z{{H^e)y@C^`2YX^6q>Sh0008CNklkIxYf z?{;e9)bJBUF&@d;rFBgT_iXZF8Twuza~RV%gZsxYDNa4V!{z!%)^@%(Sup4x>(4X_J)LXa91E<4*Bv;>(W`R)yH3Q zr=o>p?h5M{J29I%>AJHv)0FV#2cRMq3$?+3wf7z$pn@27lIE(J&nLVW^}_~W)_ z=iH$oyFJPN@8$E38_REV27g2K`pQbje-XW2qY?H4KLr>7bP%q8$O{0D=aK5EiElBE-o)GFEB7LF)=YRGBPtWGc+_bH8nLhHa0gmH#j&rIXO8x zIyyT$J3Kr*Jv}`>K0ZG`KR`f0K|w)6LPA4BLqtSGMMXtMMn*?RM@UFWNl8gcN=i#h zOH52mO-)TsPEJoxPf$=$QBhG+Qc_b>Q&dz`RaI41R#sP6S6EnBSy@?HT3TCMTU=aR zU0q#XUS3~cUtnNhVPRonVq#-sV`OAxWo2b%W@cw+XJ}|>X=!O{YHDk1Yiw+6ZEbCC zZf7mzbECnVFfInwp!No1C1Sot>SYo}QndpP-Ll?si~=|s;aB2tE{Z7t*x!DuCA}IuduMNv9YnTva++Y zv$V9dwY9ajwzjvox45{txw*Nzy1Ki&yS%)-y}iA@zP`V|zreu2!NI}8!otJD!^FhI z#l^+O#>U6T$H>UY$;rve%F4^j%goHo&CSiu&d$%z&(P4&(b3V;($dq@)6~?|)z#J3 z*4Ee8*Vx$D+1c6J+S=RO+uYpT-QC^Z-rnEe-{9cj;o;%p;^O1ulq(=H}<; z=jiC@>FMd}>gwz3>+J08?d|RE?(XmJ@9^;O@$vEU^78ZZ^Yrxe_4W1k_V)Mp_xSku z`T6GM T4yq!u00000NkvXXu0mjf96O`y literal 0 HcmV?d00001 diff --git a/web/images/primarary-collapsed.gif b/web/images/primarary-collapsed.gif new file mode 100644 index 0000000000000000000000000000000000000000..bf607fcee51b0092e406ead436b151d34f3b3421 GIT binary patch literal 346 zcmZ?wbhEHb5Hr1e7^Yh)0MZME}gls zx~wqn)t5_slS|)zzIgQL+BaX$fB10Y*pc;bKVCa=c*ChnYfFk^&tBYi>EfQ+rj**6 z^!K07ow~Sw(xj?)UoK4Puc@y}KX-NWyDyh2Ym+8UtSl~$-nnz(n@{I1UEOu<*4EP( z*Wb9eXUU@83s-i&`+T*zJ?FyZ9j7mCJau8s+b@@DYEmv;+QonuDE?#t%j+gn n)z`MOS=;aEed6ZpKK^9W&mOHC2DdU!A*JfwgkoYS3(Srm=Ps4>TlGEBe z7kMnaas0@kE}hm_>}q1)6lL7MOioToNI25S$i&0Iu}Z?~_alE}pqUJwu6{1-oD!M< DdrnNo literal 0 HcmV?d00001 diff --git a/web/images/show-records-ico.png b/web/images/show-records-ico.png new file mode 100644 index 0000000000000000000000000000000000000000..a33a483b984bb65eb31af1fdcaae7eb23262abac GIT binary patch literal 216 zcmeAS@N?(olHy`uVBq!ia0vp^oIuRR!2~4dEmfWbq$EpRBT9nv(@M${i&7aJQ}UBi z6+Ckj(^G>|6H_V+Po~-c6;*kB=34?Q% zU93xzdN_*CU5`?@7Nx1`%z0jR54(v&f?QDxe_7UAFHOZGt@|068InGS?md4-^C-|2 N44$rjF6*2UngCRJOp5>j literal 0 HcmV?d00001 diff --git a/web/images/suspended-ico.png b/web/images/suspended-ico.png new file mode 100644 index 0000000000000000000000000000000000000000..ed2842d61bfee44ac55f2e0adb18f655171b5c4a GIT binary patch literal 235 zcmVC)2D*4EbS z?CjOm)y>V#{{H^U%gfl<*!lVS;^N}Z&(GP}+4J-B|NsBY%*-^wT$}&^07ywhK~#9! zG|Wj303i?pKwM_G+lK!?b~I5gR5$>#^;btB!Sm8gc@SC&-zW;aPiF-k=*+}XCOSX9nxXnA!r{rS1HX=F=A zDYv#-pqzbOTqJaHTK@XA{{EWM(Rcm)snXGV@b0lkML2eLGu_*vN=GIA`>{+(6~AI# z<>IwsT_s9GIs5vz-Q0n)vQ?sQvN#+1gz zYm$>i(b96Lq>5Wt9$i~3`}(F0|_L^WMmGq+=2zH)7iiE3*!Eml)Q zb#hJF)~|vuE5Bu7axpCX|DcVILRwfIW@IG0xot~FA%cNIrKC|)O)2NJTVAMK(!AIsN;tN<=pE^OODkqx<}>Nku&U{-OT=nf?Es-Q0gkLp4%AH|Xeu zb#YYs`n>x3zO8O)|NNm?QbOI`ec#`I)z*r=YGzeZDevx_o}F6B#cII6V)yo%Qcpfi zNgSG)NA&cN$b5JH`>M{&k9a{k=;gX;L_DplUSM4|+}e<_u4z(GC$O+!Syv~ru5pBe zOR%(6etc!5qH);QdZ?#&sHb`T`=s33seyk^(9d$4n0dOmkEy3!`uEJ~=dSMRt-QNl zNJctILo@sL(Vv}ckB~%HRuhqrU-Iy^c6B{_MnHLZHGO( zd|SA*k*=+EOiB>i*?isId0$IHf`Kp5&5vkhRHSEOnUi^cD<)l8O-o4`Syejo@|W`Q zpYQIt^z@#bacW^+PneZxiiTl`glUY3W5vR8_w>ia!gu}m!k5WyQQcTupXYvf(>Hq))FiAu~RCwBAr~m_P?FwXI++0~fCSa(p zs74rAU11C{u#$WOD=L(fDk}I@Z;FVBC@U-9wC0D1P-tNB^?Xqo8Hd10X57UT8(2|c zx~}b~sHF!GSc=LnVHB^ZpwPfKGPSZU-TE^=FznT0|F1^8-fbJD-M$;ru;Wt59& z*S4+U2YcFh<3@4*rZ8Urii*Z8fB%#e|BavsH1bz=HWja^49iLZ15jj&JMyZ7V-pn1 z0-Cj+>2V!A_4V!Tf!yMb(`(}(23BmdapG@!ZEglMP%<~Sp&{1`Bx-0L82AzBi{JWo z4GqkbCxgVq1#K=HLtSWW+mc^;q((7ET3Xtvu7*WbM5e*0qFU*wlD3rjnVXAPb>;$n z!QQcfjg5`9x+09F=GI#_wY3!$c@O<|*3Q`B2XvNks(ezCKp)i0X)QO-*3@KJ^YaU+ z>eX?nTFKli2gS6Kw)&3-=kk?0r@#jKr~*M{MWb}x_E_r!u0R6?#5dN?cp?Bw$eZN1 zBwc9*8(3L6L6*-%Ee#q1YMMrw^6dN|US%c!!#X{C<^pkGu&~$E)Gt$G1c~of>*=|w zr46!jT8%D9q>;a-CY4!5y{Zaq;CIAbIC53vHg%H^ff#7apH;WOwc)fl$b~hY z-XA_~28loU;@iV>7;0cINTg|N&HM{y4SdGHU}R9z?(Q~%7zoU8nezIoa`hAQz}XN8 zX6_2DX{rDj*z!eOTvZjArwpIp6&If%`we7e49Gy^3ZvybJPr;u5@0Wb4Kz`61?g{o z?1nH93{LK<*$XvrwZ1+pE6~6Y`8iShWM#wP23Az8Z+K~IWz|&&jTGJb*!Q(<45dc1 z^}5>Sg9YU3V)?-V3baG~_`wixC`mRnOq$ei2*loRuA^fU1-387Tm@9DoUrk0t*G?+ z{H_&jU|Bu4_4HZ?bCX|PUAl|;`E~0g`JrV`g?M;?5!gV-LJ*Jw6+%WS=arwRf>K>& zvy>Fbz<>a8pi#V1Py4{d*B()KdzS1MqVn=_EJj*eo=u&qe+=SbL?K}eCm^7z6Q%;h zs%+NQ21bz*G+{rv*TN|-t}f!XA$^TWZc<(7JjXmpoIsQqqnZUVunJ-i(7-BC0z)>i zqVm3beXVbDskkZwkGzbDG_vOC$OIt>tAEwfLIfsdAILk$$RaAAUE(};*yFayzQJR$%-9b_3u gunHK|1_A^a0DP8Tet*5`NB{r;07*qoM6N<$f> + + + + Vesta | IP + + + + + + + + + + + + + +
+
+ +
+
    +
  • +
    +
    +
    + Users +   +
    +
    + 0 users + 0 blocked +
    +
    +
    +
  • + + +
  • +
    +
    +
    + Web Domain +   +
    +
    + 0 users + 0 blocked + 3 waiting +
    +
    +
    +
  • +
  • +
    +
    +
    + Mail +   +
    +
    + 0 users + 0 blocked + 3 waiting +
    +
    +
    +
  • +
  • +
    +
    +
    + DB +   +
    +
    + 0 users + 0 blocked + 3 waiting +
    +
    +
    +
  • +
  • +
    +
    +
    + DNS +   +
    +
    + 0 total records +
    +
    +
    +
  • +
  • +
    +
    +
    + IP +   +
    +
    + 0 users + 0 blocked + 3 waiting +
    +
    +
    +
  • +
  • +
    +
    +
    + Cron +   +
    +
    + 0 users + 0 blocked + 3 waiting +
    +
    +
    +
  • +
+
+
+
+ +
+
+
+ + +
+
+ +
+ +
+
+
+ + +
+ + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/web/index.php b/web/index.php new file mode 100644 index 00000000..207d6880 --- /dev/null +++ b/web/index.php @@ -0,0 +1,18 @@ +Testing Vesta Control Panel\n"; +echo "
\n";
+$cmd='/usr/bin/sudo /usr/local/vesta/bin/v_list_sys_users json';
+echo "Command: $cmd\n\n";
+exec ($cmd,$output,$return);
+if ($return > 0) {
+    echo "Error $return: something is wrong\n";
+    foreach ($output as $row) {
+        echo "$row\n";
+    }
+} else {
+    foreach ($output as $row) {
+        echo "$row\n";
+    }
+}
+echo "
\n"; +?> diff --git a/web/js/__init__.js b/web/js/__init__.js new file mode 100644 index 00000000..4c859fa9 --- /dev/null +++ b/web/js/__init__.js @@ -0,0 +1,19 @@ +$(document).ready(function(){ + try{ + App.Utils.detectBrowser(); + + App.Env.world = 'DNS'; + App.Pages.init(); + + App.Ref.init(); + + //App.View.start(); + App.Core.listen(); + App.Core.initMenu(); + App.Helpers.liveValidate(); + + }catch(e){ + fb.error(e); + } +}); + diff --git a/web/js/_settings.js b/web/js/_settings.js new file mode 100644 index 00000000..d84fb1f4 --- /dev/null +++ b/web/js/_settings.js @@ -0,0 +1,62 @@ +App.Env.lang = 'EN'; +App.i18n.EN = {}; +App.i18n.EN.incorrect_ip = 'Incorrect ip'; +App.i18n.EN.confirm = 'Are you sure?'; +App.i18n.getMessage = function(key) +{ + return 'undefined' != typeof App.i18n[App.Env.lang][key] ? App.i18n[App.Env.lang][key] : ''; +} + + + +// Constants +App.Constants.IP_FORM_ID = 'ip-form'; +App.Constants.DNS_FORM_ID = 'dns-form'; + +App.Settings.ajax_url = 1; +App.Settings.uri = location.href.replace('index.html', ''); +App.Settings.popup_conf = { 'centered' : true, 'bgcolor' : '#FF0000', 'lightboxSpeed' : 'fast', 'destroyOnClose': true }; + +App.Constants.SUSPENDED_YES = 'yes'; + +App.Constants.IP = 'IP'; +App.Constants.DNS = 'DNS'; + +App.Constants.DNS_TEMPLATES = {'default': 'Default'}; + +App.Messages.total_dns_records = {single: 'total record', plural: 'total records'}; + +App.Messages.get = function(key, plural) { + if ('undefined' != typeof App.Messages[key]) { + return plural ? App.Messages[key].plural : App.Messages[key].single; + } +} + + +App.Settings.getMethodName = function(action) +{ + var type = ''; + var method = ''; + // TYPE NAME + switch (App.Env.world) + { + case App.Constants.DNS: + type = 'DNS' + break; + default: + type = App.Env.world; + break; + } + // METHOD NAME + switch (action) + { + case 'update': + method = 'change'; + break; + default: + method = action; + break; + } + + return type + '.' + method; +} \ No newline at end of file diff --git a/web/js/actions.js b/web/js/actions.js new file mode 100644 index 00000000..37de9f00 --- /dev/null +++ b/web/js/actions.js @@ -0,0 +1,163 @@ +/*App.Actions.cancel_ip_form = function(){ + alert(1); +}*/ + +App.Actions.show_subform = function(evt) +{ + var elm = $(evt.target); + var ref = elm.hasClass('row') ? elm : elm.parents('.row'); + var ref_subform = ref.next('.subform'); + if (ref_subform.length > 0) { + ref_subform.remove(); + } + + if ('undefined' != typeof App.Pages[App.Env.world].showSubform) { + App.Pages[App.Env.world].showSubform(ref); + } + // TODO: probably general way to embed subforms +} + +App.Actions.close_subform = function(evt) +{ + var elm = $(evt.target); + var ref = elm.hasClass('subform') ? elm : elm.parents('.subform'); + var parent_ref = ref.prev('.row'); + if (parent_ref.length > 0) { + parent_ref.find('.show-records').removeClass('hidden'); + } + ref.remove(); +} + +App.Actions.view_template_settings = function(evt) +{ + alert('TODO'); +} + +App.Actions.add_subrecord_dns = function(evt) +{ + var elm = $(evt.target); + var ref = elm.hasClass('subform') ? elm : elm.parents('.subform'); + if (ref.length > 0) { + var tpl = App.HTML.Build.dns_subrecord({}); + ref.find('.add-box').after(tpl.finalize()); + App.Helpers.updateScreen(); + } +} + +App.Actions.delete_subentry = function(evt) +{ + var sure = confirm(App.i18n.getMessage('confirm')); + if (!sure) { + return; + } + var elm = $(evt.target); + var ref = elm.hasClass('subrow') ? elm : elm.parents('.subrow'); + ref.effect('puff', {}, 300, function(){ref.remove();}) +} + +/** + * Embeds new item form + * if exits custom method (App.Pages[ENVIRONMENT_NAME].newForm) + * custom method will be executes instead of default one + */ +App.Actions.new_entry = function() { + if ('undefined' != typeof App.Pages[App.Env.world].new_entry) { + App.Pages[App.Env.world].new_entry(); + } else { + var form_id = App.Constants[App.Env.world + '_FORM_ID']; + $('#'+form_id).remove(); + var build_method = App.Env.getWorldName() + '_form'; + var tpl = App.HTML.Build[build_method]({}, form_id); + App.Ref.CONTENT.prepend(tpl); + App.Helpers.updateScreen(); + } +} + +// do_action_save +App.Actions.save_form = function(evt) { + var elm = $(evt.target); + elm = elm.parents('.b-new-entry'); + + var elm_id = App.Env.world + '_FORM_ID'; + var build_method = App.Env.getWorldName() + '_entry'; + + if (elm.attr('id') == App.Constants[elm_id]) { // NEW ITEM + var values = App.Helpers.getFormValues(elm); + if(App.Validate.form(values, $('#'+elm_id))) { + App.Model.add(values, source); + var tpl = App.HTML.Build[build_method](values, 'new'); + $('#' + App.Constants[elm_id]).replaceWith(tpl); + } + } + else { // OLD ITEM, UPDATING IT + var source = $(elm).find('.source').val(); + var values = App.Helpers.getFormValues(elm); + if(App.Validate.form(values, $('#'+elm_id))) { + App.Model.update(values, source); + var tpl = App.HTML.Build[build_method](values); + elm.replaceWith(tpl); + } + } + App.Helpers.updateScreen(); +} + +// do_action_edit +App.Actions.edit = function(evt) { + var elm = $(evt.target); + elm = elm.hasClass('row') ? elm : elm.parents('.row'); + App.Pages[App.Env.world].edit(elm); + App.Helpers.updateScreen(); +} + +// do_cancel_form +App.Actions.cancel_form = function(evt, params) { + var elm = $(evt.target); + elm = elm.parents('.b-new-entry'); + var form_id = App.Constants[App.Env.world + '_FORM_ID']; + if (elm.attr('id') == form_id) { + $('#' + form_id).remove(); + } + else { + var options = App.Helpers.evalJSON(elm.find('.source').val()); + var entry_name = App.Env.world.toLowerCase() + '_entry'; + var tpl = App.HTML.Build[entry_name](options); + elm.replaceWith(tpl); + } + App.Helpers.updateScreen(); +} + +// do_action_form_help +App.Actions.showFormHelp = function(evt) { + var tpl_name = App.Env.world + '_form'; + var tpl = App.Templates.get(tpl_name, 'help'); + App.View.popup(tpl.finalize()); +} + +// do_action_entry_help +App.Actions.showEntryHelp = function(evt) { + var tpl_name = App.Env.world + '_entry'; + var tpl = App.Templates.get(tpl_name, 'help'); + App.View.popup(tpl.finalize()); +} + +App.Actions.embedSubform = function(evt) { + var tpl = App.Templates.get('subform', App.Env.getWorldName()); +} + +App.Actions.close_popup = function() +{ + App.View.closePopup(); +} + +App.Actions.save_dns_subrecords = function(evt) +{ + var elm = $(evt.target); + var ref = elm.hasClass('subform') ? elm : elm.parents('.subform'); + + var records = []; + ref.find('.subrow').each(function(i, o){ + records[records.length++] = App.Helpers.getFormValuesFromElement(o); + }); + + fb.warn($.toJSON(records)); +} \ No newline at end of file diff --git a/web/js/app.js b/web/js/app.js new file mode 100644 index 00000000..cd7b7e68 --- /dev/null +++ b/web/js/app.js @@ -0,0 +1,216 @@ +var _DEBUG = true; + + +(function($){$.toJSON=function(o) +{if(typeof(JSON)=='object'&&JSON.stringify) +return JSON.stringify(o);var type=typeof(o);if(o===null) +return"null";if(type=="undefined") +return undefined;if(type=="number"||type=="boolean") +return o+"";if(type=="string") +return $.quoteString(o);if(type=='object') +{if(typeof o.toJSON=="function") +return $.toJSON(o.toJSON());if(o.constructor===Date) +{var month=o.getUTCMonth()+1;if(month<10)month='0'+month;var day=o.getUTCDate();if(day<10)day='0'+day;var year=o.getUTCFullYear();var hours=o.getUTCHours();if(hours<10)hours='0'+hours;var minutes=o.getUTCMinutes();if(minutes<10)minutes='0'+minutes;var seconds=o.getUTCSeconds();if(seconds<10)seconds='0'+seconds;var milli=o.getUTCMilliseconds();if(milli<100)milli='0'+milli;if(milli<10)milli='0'+milli;return'"'+year+'-'+month+'-'+day+'T'+ +hours+':'+minutes+':'+seconds+'.'+milli+'Z"';} +if(o.constructor===Array) +{var ret=[];for(var i=0;i + * MIT license + * + * Includes enhancements by Scott Trenda + * and Kris Kowal + * + * Accepts a date, a mask, or a date and a mask. + * Returns a formatted version of the given date. + * The date defaults to the current date/time. + * The mask defaults to dateFormat.masks.default. + */ + +var dateFormat = function () { + var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g, + timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g, + timezoneClip = /[^-+\dA-Z]/g, + pad = function (val, len) { + val = String(val); + len = len || 2; + while (val.length < len) val = "0" + val; + return val; + }; + + // Regexes and supporting functions are cached through closure + return function (date, mask, utc) { + var dF = dateFormat; + + // You can't provide utc if you skip other args (use the "UTC:" mask prefix) + if (arguments.length == 1 && Object.prototype.toString.call(date) == "[object String]" && !/\d/.test(date)) { + mask = date; + date = undefined; + } + + // Passing date through Date applies Date.parse, if necessary + date = date ? new Date(date) : new Date; + if (isNaN(date)) throw SyntaxError("invalid date"); + + mask = String(dF.masks[mask] || mask || dF.masks["default"]); + + // Allow setting the utc argument via the mask + if (mask.slice(0, 4) == "UTC:") { + mask = mask.slice(4); + utc = true; + } + + var _ = utc ? "getUTC" : "get", + d = date[_ + "Date"](), + D = date[_ + "Day"](), + m = date[_ + "Month"](), + y = date[_ + "FullYear"](), + H = date[_ + "Hours"](), + M = date[_ + "Minutes"](), + s = date[_ + "Seconds"](), + L = date[_ + "Milliseconds"](), + o = utc ? 0 : date.getTimezoneOffset(), + flags = { + d: d, + dd: pad(d), + ddd: dF.i18n.dayNames[D], + dddd: dF.i18n.dayNames[D + 7], + m: m + 1, + mm: pad(m + 1), + mmm: dF.i18n.monthNames[m], + mmmm: dF.i18n.monthNames[m + 12], + yy: String(y).slice(2), + yyyy: y, + h: H % 12 || 12, + hh: pad(H % 12 || 12), + H: H, + HH: pad(H), + M: M, + MM: pad(M), + s: s, + ss: pad(s), + l: pad(L, 3), + L: pad(L > 99 ? Math.round(L / 10) : L), + t: H < 12 ? "a" : "p", + tt: H < 12 ? "am" : "pm", + T: H < 12 ? "A" : "P", + TT: H < 12 ? "AM" : "PM", + Z: utc ? "UTC" : (String(date).match(timezone) || [""]).pop().replace(timezoneClip, ""), + o: (o > 0 ? "-" : "+") + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4), + S: ["th", "st", "nd", "rd"][d % 10 > 3 ? 0 : (d % 100 - d % 10 != 10) * d % 10] + }; + + return mask.replace(token, function ($0) { + return $0 in flags ? flags[$0] : $0.slice(1, $0.length - 1); + }); + }; +}(); + +// Some common format strings +dateFormat.masks = { + "default": "ddd mmm dd yyyy HH:MM:ss", + shortDate: "m/d/yy", + mediumDate: "mmm d, yyyy", + longDate: "mmmm d, yyyy", + fullDate: "dddd, mmmm d, yyyy", + shortTime: "h:MM TT", + mediumTime: "h:MM:ss TT", + longTime: "h:MM:ss TT Z", + isoDate: "yyyy-mm-dd", + isoTime: "HH:MM:ss", + isoDateTime: "yyyy-mm-dd'T'HH:MM:ss", + isoUtcDateTime: "UTC:yyyy-mm-dd'T'HH:MM:ss'Z'" +}; + +// Internationalization strings +dateFormat.i18n = { + dayNames: [ + "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", + "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" + ], + monthNames: [ + "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", + "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" + ] +}; + +// For convenience... +Date.prototype.format = function (mask, utc) { + return dateFormat(this, mask, utc); +}; + diff --git a/web/js/helpers.js b/web/js/helpers.js new file mode 100644 index 00000000..489e1c4c --- /dev/null +++ b/web/js/helpers.js @@ -0,0 +1,192 @@ +App.Helpers.getFirst = function(obj) +{ + try{ // TODO: remove try / catch + var first = {}; + var key = App.Helpers.getFirstKey(obj); + first[key] = obj[key]; + return first; + } + catch(e){ + fb.error(e); + } + + return false; +} + +App.Helpers.getFirstKey = function(obj) +{ + try{ // TODO: remove try / catch + for (key in obj) break; + return key; + } + catch(e){ + fb.error(e); + } + + return false; +} + +App.Helpers.updateInitial = function() +{ + // TODO: need api method + $.each(App.Env.initialParams, function(key) { + var item = App.Env.initialParams[key]; + $.each(item, function (i, o) { + if (i.indexOf('total_') != -1) { + App.View.updateInitialInfo(i, o); + } + }); + }); +} + +App.Helpers.beforeAjax = function(jedi_method) +{ + switch(jedi_method) { + case 'DNS.getList': + App.Helpers.showLoading(); + break; + default: + break; + } +} + +App.Helpers.afterAjax = function() +{ + App.Helpers.removeLoading(); +} + +App.Helpers.removeLoading = function() +{ + var ref = $('#loading'); + if (ref.length > 0) { + ref.remove(); + } +} + +App.Helpers.showLoading = function() +{ + App.Helpers.removeLoading(); + var tpl = App.Templates.get('loading', 'general'); + $(document.body).append(tpl.finalize()); +} + +// todo: no iteration here +App.Helpers.getFirstValue = function(obj) +{ + var first = ''; + $.each(obj, function(key, i){ + return first = obj[key]; + }); + + return first; +} + +App.Helpers.evalJSON = function(string) +{ + return $.parseJSON(string); +} + +App.Helpers.toJSON = function(object) +{ + return ($.toJSON(object).replace(/'/gi, '')); +} + + +// +// Hints +// +App.Helpers.showConsoleHint = function() +{ + // TODO: +} + + +// UTILS +App.Utils.generatePasswordHash = function(length) +{ + var length = length || 11; + var chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!~."; + var pass = ""; + for(var x=0;x'+initial[key]+''; + }); + return opts.join(''); +} + +App.HTML.Build.ip_entry = function(o){ + var tpl = App.Templates.get('ENTRY', 'ip'); + tpl.set(':source',$.toJSON(o)); + tpl.set(':NETMASK', o.NETMASK); + tpl.set(':IP_ADDRESS', o.IP_ADDRESS); + tpl.set(':SYS_USERS', o.U_SYS_USERS); + tpl.set(':WEB_DOMAINS', o.U_WEB_DOMAINS); + tpl.set(':DATE', o.DATE); + tpl.set(':INTERFACE', o.INTERFACE); + tpl.set(':NAME', o.NAME); + tpl.set(':OWNER', o.OWNER); + tpl.set(':STATUS', o.STATUS); + tpl.set(':U_SYS_USERS', o.U_SYS_USERS); + tpl.set(':U_WEB_DOMAINS', o.U_WEB_DOMAINS); + + if (App.Constants.SUSPENDED_YES == o.SUSPENDED) { + var sub_tpl = App.Templates.get('SUSPENDED_TPL_ENABLED', 'ip'); + } + else { + var sub_tpl = App.Templates.get('SUSPENDED_TPL_DISABLED', 'ip'); + } + + tpl.set(':SUSPENDED_TPL', sub_tpl.finalize()); + + return tpl.finalize(); +} + +App.HTML.Build.dns_entry = function(o, is_new){ + var tpl = App.Templates.get('ENTRY', 'dns'); + tpl.set(':source', App.Helpers.toJSON(o)); + tpl.set(':DNS_DOMAIN', o.DNS_DOMAIN); + var ip = o.IP.split('.'); + tpl.set(':IP', ip.join('.')); + tpl.set(':TTL', o.TTL); + tpl.set(':TPL', o.TPL); + tpl.set(':SOA', o.SOA); + tpl.set(':TTL', o.TTL); + tpl.set(':DATE', o.DATE); + tpl.set(':CHECKED', ''); + if (is_new) { + var now = new Date(); + tpl.set(':DATE', now.format("d.mm.yyyy")); + } + /*tpl.set(':NETMASK', o.NETMASK); + tpl.set(':IP_ADDRESS', o.IP_ADDRESS); + tpl.set(':SYS_USERS', o.U_SYS_USERS); + tpl.set(':WEB_DOMAINS', o.U_WEB_DOMAINS); + tpl.set(':DATE', o.DATE); + tpl.set(':INTERFACE', o.INTERFACE); + tpl.set(':NAME', o.NAME); + tpl.set(':OWNER', o.OWNER); + tpl.set(':STATUS', o.STATUS); + tpl.set(':U_SYS_USERS', o.U_SYS_USERS); + tpl.set(':U_WEB_DOMAINS', o.U_WEB_DOMAINS); + */ + if (App.Constants.SUSPENDED_YES == o.SUSPEND) { + var sub_tpl = App.Templates.get('SUSPENDED_TPL_ENABLED', 'dns'); + } + else { + var sub_tpl = App.Templates.get('SUSPENDED_TPL_DISABLED', 'dns'); + } + + tpl.set(':SUSPENDED_TPL', sub_tpl.finalize()); + + return tpl.finalize(); +} + +App.HTML.Build.dns_records = function(records) +{ + var acc = []; + $.each(records, function(i, record) + { + var record = records[i]; + var tpl = App.HTML.Build.dns_subrecord(record); + acc[acc.length] = tpl.finalize(); + }); + + return acc.done(); +} + +App.HTML.Build.dns_subrecord = function(record) +{ + var tpl = App.Templates.get('SUBENTRY', 'dns'); + tpl.set(':RECORD', record.RECORD || ''); + tpl.set(':RECORD_VALUE', record.RECORD_VALUE || ''); + tpl.set(':RECORD_ID', record.RECORD_ID || ''); + //tpl.set(':RECORD_TYPE_VALUE', ''); + tpl.set(':RECORD_TYPE', App.HTML.Build.options(App.Env.initialParams.DNS.record.RECORD_TYPE, (record.RECORD_TYPE || -1))); + + return tpl; +} + diff --git a/web/js/lib/.svn/entries b/web/js/lib/.svn/entries new file mode 100644 index 00000000..c20324f9 --- /dev/null +++ b/web/js/lib/.svn/entries @@ -0,0 +1,132 @@ +10 + +dir +86 +svn://svn.vestacp.com/vesta/trunk/web/js/lib +svn://svn.vestacp.com/vesta + + + +2011-05-21T18:39:29.042444Z +76 +twi + + + + + + + + + + + + + + +32c52990-e6da-4f1f-8224-85171b9c7084 + +custom-form-elements.js +file + + + + +2011-05-21T16:20:27.000000Z +c32b7ce65d7f5916a3a7ad767bbeeac8 +2011-05-21T17:53:21.905711Z +75 +twi + + + + + + + + + + + + + + + + + + + + + +5866 + +jquery-ui-1.8.13.custom.min.js +file + + + + +2011-05-21T17:06:36.000000Z +305afec5286e0380016fda3c0afa88f3 +2011-05-21T18:39:29.042444Z +76 +twi + + + + + + + + + + + + + + + + + + + + + +41841 + +jquery-1.4.4.min.js +file + + + + +2011-01-12T10:13:30.000000Z +73a9c334c5ca71d70d092b42064f6476 +2011-01-12T11:14:22.700688Z +11 +twi + +popup.js +file + + + + +2011-01-12T10:13:30.000000Z +03b53e40755b05328a0c2cfe7174c0e0 +2011-01-12T11:14:22.700688Z +11 +twi + +browser.js +file + + + + +2011-01-12T11:32:02.000000Z +99d606a8337f5ba58bcee7729fa08676 +2011-01-12T12:31:57.745881Z +21 +twi + diff --git a/web/js/lib/.svn/text-base/browser.js.svn-base b/web/js/lib/.svn/text-base/browser.js.svn-base new file mode 100644 index 00000000..9d27b37c --- /dev/null +++ b/web/js/lib/.svn/text-base/browser.js.svn-base @@ -0,0 +1,396 @@ +/** + * jQBrowser v0.2 - Extend jQuery's browser detection capabilities + * * http://davecardwell.co.uk/javascript/jquery/plugins/jquery-browserdetect/0.2/ + * + * Dave Cardwell + * + * Built on the shoulders of giants: + * * John Resig + * * Peter-Paul Koch + * + * + * Copyright (c) 2006 Dave Cardwell, dual licensed under the MIT and GPL + * licenses: + * * http://www.opensource.org/licenses/mit-license.php + * * http://www.gnu.org/licenses/gpl.txt + */ + + +/** + * For the latest version of this plugin, and a discussion of its usage and + * implementation, visit: + * * http://davecardwell.co.uk/javascript/jquery/plugins/jquery-browserdetect/ + */ + +new function() { + /** + * The following functions and attributes form the Public interface of the + * jQBrowser plugin, accessed externally through the $.browser object. + * See the relevant function definition later in the source for further + * information. + * + * $.browser.browser() + * $.browser.version.number() + * $.browser.version.string() + * $.browser.OS() + * + * $.browser.aol() + * $.browser.camino() + * $.browser.firefox() + * $.browser.flock() + * $.browser.icab() + * $.browser.konqueror() + * $.browser.mozilla() + * $.browser.msie() + * $.browser.netscape() + * $.browser.opera() + * $.browser.safari() + * + * $.browser.linux() + * $.browser.mac() + * $.browser.win() + */ + var Public = { + // The current browser, its version as a number or a string, and the + // operating system its running on. + 'browser': function() { + return Private.browser; + }, + 'version': { + 'number': function() { + return Math.floor(Private.version.number); + }, + 'string': function() { + return Private.version.string; + } + }, + 'OS': function() { + return Private.OS; + }, + + // A boolean value indicating whether or not the given browser was + // detected. + 'chrome': function() { + return Private.chrome; + }, + 'aol': function() { + return Private.aol; + }, + 'camino': function() { + return Private.camino; + }, + 'firefox': function() { + return Private.firefox; + }, + 'flock': function() { + return Private.flock; + }, + 'icab': function() { + return Private.icab; + }, + 'konqueror': function() { + return Private.konqueror; + }, + 'mozilla': function() { + return Private.mozilla; + }, + 'msie': function() { + return Private.msie; + }, + 'netscape': function() { + return Private.netscape; + }, + 'opera': function() { + return Private.opera; + }, + 'safari': function() { + return Private.safari; + }, + + // A boolean value indicating whether or not the given OS was + // detected. + 'linux': function() { + return Private.linux; + }, + 'mac': function() { + return Private.mac; + }, + 'win': function() { + return Private.win; + } + }; + + // Allow external access to the 'Public' interface through the $.browser + // object. + $.browser = Public; + + + + /** + * The following functions and attributes form the internal methods and + * state of the jQBrowser plugin. See the relevant function definition + * later in the source for further information. + * + * Private.browser + * Private.version + * Private.OS + * + * Private.aol + * Private.camino + * Private.firefox + * Private.flock + * Private.icab + * Private.konqueror + * Private.mozilla + * Private.msie + * Private.netscape + * Private.opera + * Private.safari + * + * Private.linux + * Private.mac + * Private.win + */ + var Private = { + // Initially set to 'Unknown', if detected each of these properties will + // be updated. + 'browser': 'Unknown', + 'version': { + 'number': undefined, + 'string': 'Unknown' + }, + 'OS': 'Unknown', + + // Initially set to false, if detected one of the following browsers + // will be updated. + 'chrome': false, + 'aol': false, + 'camino': false, + 'firefox': false, + 'flock': false, + 'icab': false, + 'konqueror': false, + 'mozilla': false, + 'msie': false, + 'netscape': false, + 'opera': false, + 'safari': false, + + // Initially set to false, if detected one of the following operating + // systems will be updated. + 'linux': false, + 'mac': false, + 'win': false + }; + + + + /** + * Loop over the items in 'data' trying to find a browser match with the + * test in data[i].browser(). Once found, attempt to determine the + * browser version. + * + * 'name': A string containing the full name of the browser. + * 'identifier': By default this is a lowercase version of 'name', but + * this can be overwritten by explicitly defining an + * 'identifier'. + * 'browser': A function that returns a boolean value indicating + * whether or not the given browser is detected. + * 'version': An optional function that overwrites the default version + * testing. Must return the result of a .match(). + * + * Please note that the order of the data array is important, as some + * browsers contain details of others in their navigator.userAgent string. + * For example, Flock's contains 'Firefox' so much come before Firefox's + * test to avoid false positives. + */ + for( var i = 0, // counter + ua = navigator.userAgent, // the navigator's user agent string + ve = navigator.vendor, // the navigator's vendor string + data = [ // browser tests and data + { // Safari + 'name': 'Chrome', + 'browser': function() { + return /Google/.test(ve) + } + }, + { // Safari + 'name': 'Safari', + 'browser': function() { + return /Apple/.test(ve) + } + }, + { // Opera + 'name': 'Opera', + 'browser': function() { + return window.opera != undefined + } + }, + { // iCab + 'name': 'iCab', + 'browser': function() { + return /iCab/.test(ve) + } + }, + { // Konqueror + 'name': 'Konqueror', + 'browser': function() { + return /KDE/.test(ve) + } + }, + { // AOL Explorer + 'identifier': 'aol', + 'name': 'AOL Explorer', + 'browser': function() { + return /America Online Browser/.test(ua) + }, + 'version': function() { + return ua.match(/rev(\d+(?:\.\d+)+)/) + } + }, + { // Flock + 'name': 'Flock', + 'browser': function() { + return /Flock/.test(ua) + } + }, + { // Camino + 'name': 'Camino', + 'browser': function() { + return /Camino/.test(ve) + } + }, + { // Firefox + 'name': 'Firefox', + 'browser': function() { + return /Firefox/.test(ua) + } + }, + { // Netscape + 'name': 'Netscape', + 'browser': function() { + return /Netscape/.test(ua) + } + }, + { // Internet Explorer + // + 'identifier': 'msie', + 'name': 'Internet Explorer', + 'browser': function() { + return /MSIE/.test(ua) + }, + 'version': function() { + return ua.match( + /MSIE (\d+(?:\.\d+)+(?:b\d*)?)/ + ) + } + }, + { // Mozilla + 'name': 'Mozilla', + 'browser': function() { + return /Gecko|Mozilla/.test(ua) + }, + 'version': function() { + return ua.match(/rv:(\d+(?:\.\d+)+)/); + } + } + ]; + i < data.length; + i++ + ) { + if( data[i].browser() ) { // we have a match + // If the identifier is not explicitly set, use a lowercase + // version of the given name. + var identifier = data[i].identifier ? data[i].identifier + : data[i].name.toLowerCase(); + + // Make a note that this browser was detected. + Private[ identifier ] = true; + + // $.browser.browser() will now return the correct browser. + Private.browser = data[i].name; + + var result; + if( data[i].version != undefined && (result = data[i].version()) ) { + // Use the explicitly set test for browser version. + Private.version.string = result[1]; + Private.version.number = parseFloat( result[1] ); + } else { + // Otherwise use the default test which searches for the + // version number after the browser name in the user agent + // string. + var re = new RegExp( + data[i].name + '(?:\\s|\\/)(\\d+(?:\\.\\d+)+(?:(?:a|b)\\d*)?)' + ); + + result = ua.match(re); + if( result != undefined ) { + Private.version.string = result[1]; + Private.version.number = parseFloat( result[1] ); + } + } + + // Once we've detected the browser there is no need to check the + // others. + break; + } + }; + + + + /** + * Loop over the items in 'data' trying to find a operating system match + * with the test in data[i].os(). + * + * 'name': A string containing the full name of the operating + * system. + * 'identifier': By default this is a lowercase version of 'name', but + * this can be overwritten by explicitly defining an + * 'identifier'. + * 'OS': A function that returns a boolean value indicating + * whether or not the given operating system is detected. + */ + for( var i = 0, // counter + pl = navigator.platform, // the navigator's platform string + data = [ // OS data and tests + { // Microsoft Windows + 'identifier': 'win', + 'name': 'Windows', + 'OS': function() { + return /Win/.test(pl) + } + }, + { // Apple Mac OS + 'name': 'Mac', + 'OS': function() { + return /Mac/.test(pl) + } + }, + { // Linux + 'name': 'Linux', + 'OS': function() { + return /Linux/.test(pl) + } + } + ]; + i < data.length; + i++ + ) { + if( data[i].OS() ) { // we have a match + // If the identifier is not explicitly set, use a lowercase + // version of the given name. + var identifier = data[i].identifier ? data[i].identifier + : data[i].name.toLowerCase(); + + // Make a note that the OS was detected. + Private[ identifier ] = true; + + // $.browser.OS() will now return the correct OS. + Private.OS = data[i].name; + + // Once we've detected the browser there is no need to check the + // others. + break; + } + }; +}(); diff --git a/web/js/lib/.svn/text-base/custom-form-elements.js.svn-base b/web/js/lib/.svn/text-base/custom-form-elements.js.svn-base new file mode 100644 index 00000000..27954f2d --- /dev/null +++ b/web/js/lib/.svn/text-base/custom-form-elements.js.svn-base @@ -0,0 +1,153 @@ +/* + +CUSTOM FORM ELEMENTS + +Created by Ryan Fait +www.ryanfait.com + +The only things you may need to change in this file are the following +variables: checkboxHeight, radioHeight and selectWidth (lines 24, 25, 26) + +The numbers you set for checkboxHeight and radioHeight should be one quarter +of the total height of the image want to use for checkboxes and radio +buttons. Both images should contain the four stages of both inputs stacked +on top of each other in this order: unchecked, unchecked-clicked, checked, +checked-clicked. + +You may need to adjust your images a bit if there is a slight vertical +movement during the different stages of the button activation. + +The value of selectWidth should be the width of your select list image. + +Visit http://ryanfait.com/ for more information. + +*/ + +var checkboxHeight = "25"; +var radioHeight = "25"; +var selectWidth = "210"; + + +/* No need to change anything after this */ + + +document.write(''); + +var Custom = { + init: function() { + var inputs = document.getElementsByTagName("input"), span = Array(), textnode, option, active; + for(a = 0; a < inputs.length; a++) { + if((inputs[a].type == "checkbox" || inputs[a].type == "radio") && inputs[a].className == "styled") { + span[a] = document.createElement("span"); + span[a].className = inputs[a].type; + + if(inputs[a].checked == true) { + if(inputs[a].type == "checkbox") { + position = "0 -" + (checkboxHeight*2) + "px"; + span[a].style.backgroundPosition = position; + } else { + position = "0 -" + (radioHeight*2) + "px"; + span[a].style.backgroundPosition = position; + } + } + inputs[a].parentNode.insertBefore(span[a], inputs[a]); + inputs[a].onchange = Custom.clear; + if(!inputs[a].getAttribute("disabled")) { + span[a].onmousedown = Custom.pushed; + span[a].onmouseup = Custom.check; + } else { + span[a].className = span[a].className += " disabled"; + } + } + } + inputs = document.getElementsByTagName("select"); + for(a = 0; a < inputs.length; a++) { + try{ + fb.log($(inputs[a]).hasClass("styled")); + if($(inputs[a]).hasClass("styled")) { + option = inputs[a].getElementsByTagName("option"); + active = option[0].childNodes[0].nodeValue; + textnode = document.createTextNode(active); + for(b = 0; b < option.length; b++) { + if(option[b].selected == true) { + textnode = document.createTextNode(option[b].childNodes[0].nodeValue); + } + } + span[a] = document.createElement("span"); + span[a].className = "select"; + span[a].id = "select-" + inputs[a].name + a; + span[a].appendChild(textnode); + inputs[a].parentNode.insertBefore(span[a], inputs[a]); + inputs[a].id = inputs[a].name + a; + if(!inputs[a].getAttribute("disabled")) { + inputs[a].onchange = Custom.choose; + } else { + inputs[a].previousSibling.className = inputs[a].previousSibling.className += " disabled"; + } + } + }catch(e){fb.error(e);} + } + document.onmouseup = Custom.clear; + }, + pushed: function() { + element = this.nextSibling; + if(element.checked == true && element.type == "checkbox") { + this.style.backgroundPosition = "0 -" + checkboxHeight*3 + "px"; + } else if(element.checked == true && element.type == "radio") { + this.style.backgroundPosition = "0 -" + radioHeight*3 + "px"; + } else if(element.checked != true && element.type == "checkbox") { + this.style.backgroundPosition = "0 -" + checkboxHeight + "px"; + } else { + this.style.backgroundPosition = "0 -" + radioHeight + "px"; + } + }, + check: function() { + element = this.nextSibling; + if(element.checked == true && element.type == "checkbox") { + this.style.backgroundPosition = "0 0"; + element.checked = false; + } else { + if(element.type == "checkbox") { + this.style.backgroundPosition = "0 -" + checkboxHeight*2 + "px"; + } else { + this.style.backgroundPosition = "0 -" + radioHeight*2 + "px"; + group = this.nextSibling.name; + inputs = document.getElementsByTagName("input"); + for(a = 0; a < inputs.length; a++) { + if(inputs[a].name == group && inputs[a] != this.nextSibling) { + inputs[a].previousSibling.style.backgroundPosition = "0 0"; + } + } + } + element.checked = true; + } + }, + clear: function() { + inputs = document.getElementsByTagName("input"); + for(var b = 0; b < inputs.length; b++) { + if(inputs[b].type == "checkbox" && inputs[b].checked == true && inputs[b].className == "styled") { + inputs[b].previousSibling.style.backgroundPosition = "0 -" + checkboxHeight*2 + "px"; + } else if(inputs[b].type == "checkbox" && inputs[b].className == "styled") { + inputs[b].previousSibling.style.backgroundPosition = "0 0"; + } else if(inputs[b].type == "radio" && inputs[b].checked == true && inputs[b].className == "styled") { + inputs[b].previousSibling.style.backgroundPosition = "0 -" + radioHeight*2 + "px"; + } else if(inputs[b].type == "radio" && inputs[b].className == "styled") { + inputs[b].previousSibling.style.backgroundPosition = "0 0"; + } + } + }, + choose: function() { + option = this.getElementsByTagName("option"); + for(d = 0; d < option.length; d++) { + if(option[d].selected == true) { + // + var expr = '#select-' + this.id; + fb.log(expr); + $(expr).text(option[d].childNodes[0].nodeValue); + // bad! + //document.getElementById("select" + this.name).childNodes[0].nodeValue = option[d].childNodes[0].nodeValue; + } + } + } +} +window.onload = Custom.init; \ No newline at end of file diff --git a/web/js/lib/.svn/text-base/jquery-1.4.4.min.js.svn-base b/web/js/lib/.svn/text-base/jquery-1.4.4.min.js.svn-base new file mode 100644 index 00000000..8f3ca2e2 --- /dev/null +++ b/web/js/lib/.svn/text-base/jquery-1.4.4.min.js.svn-base @@ -0,0 +1,167 @@ +/*! + * jQuery JavaScript Library v1.4.4 + * http://jquery.com/ + * + * Copyright 2010, John Resig + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * Includes Sizzle.js + * http://sizzlejs.com/ + * Copyright 2010, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * + * Date: Thu Nov 11 19:04:53 2010 -0500 + */ +(function(E,B){function ka(a,b,d){if(d===B&&a.nodeType===1){d=a.getAttribute("data-"+b);if(typeof d==="string"){try{d=d==="true"?true:d==="false"?false:d==="null"?null:!c.isNaN(d)?parseFloat(d):Ja.test(d)?c.parseJSON(d):d}catch(e){}c.data(a,b,d)}else d=B}return d}function U(){return false}function ca(){return true}function la(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function Ka(a){var b,d,e,f,h,l,k,o,x,r,A,C=[];f=[];h=c.data(this,this.nodeType?"events":"__events__");if(typeof h==="function")h= +h.events;if(!(a.liveFired===this||!h||!h.live||a.button&&a.type==="click")){if(a.namespace)A=RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)");a.liveFired=this;var J=h.live.slice(0);for(k=0;kd)break;a.currentTarget=f.elem;a.data=f.handleObj.data;a.handleObj=f.handleObj;A=f.handleObj.origHandler.apply(f.elem,arguments);if(A===false||a.isPropagationStopped()){d=f.level;if(A===false)b=false;if(a.isImmediatePropagationStopped())break}}return b}}function Y(a,b){return(a&&a!=="*"?a+".":"")+b.replace(La, +"`").replace(Ma,"&")}function ma(a,b,d){if(c.isFunction(b))return c.grep(a,function(f,h){return!!b.call(f,h,f)===d});else if(b.nodeType)return c.grep(a,function(f){return f===b===d});else if(typeof b==="string"){var e=c.grep(a,function(f){return f.nodeType===1});if(Na.test(b))return c.filter(b,e,!d);else b=c.filter(b,e)}return c.grep(a,function(f){return c.inArray(f,b)>=0===d})}function na(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var e=c.data(a[d++]),f=c.data(this, +e);if(e=e&&e.events){delete f.handle;f.events={};for(var h in e)for(var l in e[h])c.event.add(this,h,e[h][l],e[h][l].data)}}})}function Oa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function oa(a,b,d){var e=b==="width"?a.offsetWidth:a.offsetHeight;if(d==="border")return e;c.each(b==="width"?Pa:Qa,function(){d||(e-=parseFloat(c.css(a,"padding"+this))||0);if(d==="margin")e+=parseFloat(c.css(a, +"margin"+this))||0;else e-=parseFloat(c.css(a,"border"+this+"Width"))||0});return e}function da(a,b,d,e){if(c.isArray(b)&&b.length)c.each(b,function(f,h){d||Ra.test(a)?e(a,h):da(a+"["+(typeof h==="object"||c.isArray(h)?f:"")+"]",h,d,e)});else if(!d&&b!=null&&typeof b==="object")c.isEmptyObject(b)?e(a,""):c.each(b,function(f,h){da(a+"["+f+"]",h,d,e)});else e(a,b)}function S(a,b){var d={};c.each(pa.concat.apply([],pa.slice(0,b)),function(){d[this]=a});return d}function qa(a){if(!ea[a]){var b=c("<"+ +a+">").appendTo("body"),d=b.css("display");b.remove();if(d==="none"||d==="")d="block";ea[a]=d}return ea[a]}function fa(a){return c.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var t=E.document,c=function(){function a(){if(!b.isReady){try{t.documentElement.doScroll("left")}catch(j){setTimeout(a,1);return}b.ready()}}var b=function(j,s){return new b.fn.init(j,s)},d=E.jQuery,e=E.$,f,h=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,l=/\S/,k=/^\s+/,o=/\s+$/,x=/\W/,r=/\d/,A=/^<(\w+)\s*\/?>(?:<\/\1>)?$/, +C=/^[\],:{}\s]*$/,J=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,w=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,I=/(?:^|:|,)(?:\s*\[)+/g,L=/(webkit)[ \/]([\w.]+)/,g=/(opera)(?:.*version)?[ \/]([\w.]+)/,i=/(msie) ([\w.]+)/,n=/(mozilla)(?:.*? rv:([\w.]+))?/,m=navigator.userAgent,p=false,q=[],u,y=Object.prototype.toString,F=Object.prototype.hasOwnProperty,M=Array.prototype.push,N=Array.prototype.slice,O=String.prototype.trim,D=Array.prototype.indexOf,R={};b.fn=b.prototype={init:function(j, +s){var v,z,H;if(!j)return this;if(j.nodeType){this.context=this[0]=j;this.length=1;return this}if(j==="body"&&!s&&t.body){this.context=t;this[0]=t.body;this.selector="body";this.length=1;return this}if(typeof j==="string")if((v=h.exec(j))&&(v[1]||!s))if(v[1]){H=s?s.ownerDocument||s:t;if(z=A.exec(j))if(b.isPlainObject(s)){j=[t.createElement(z[1])];b.fn.attr.call(j,s,true)}else j=[H.createElement(z[1])];else{z=b.buildFragment([v[1]],[H]);j=(z.cacheable?z.fragment.cloneNode(true):z.fragment).childNodes}return b.merge(this, +j)}else{if((z=t.getElementById(v[2]))&&z.parentNode){if(z.id!==v[2])return f.find(j);this.length=1;this[0]=z}this.context=t;this.selector=j;return this}else if(!s&&!x.test(j)){this.selector=j;this.context=t;j=t.getElementsByTagName(j);return b.merge(this,j)}else return!s||s.jquery?(s||f).find(j):b(s).find(j);else if(b.isFunction(j))return f.ready(j);if(j.selector!==B){this.selector=j.selector;this.context=j.context}return b.makeArray(j,this)},selector:"",jquery:"1.4.4",length:0,size:function(){return this.length}, +toArray:function(){return N.call(this,0)},get:function(j){return j==null?this.toArray():j<0?this.slice(j)[0]:this[j]},pushStack:function(j,s,v){var z=b();b.isArray(j)?M.apply(z,j):b.merge(z,j);z.prevObject=this;z.context=this.context;if(s==="find")z.selector=this.selector+(this.selector?" ":"")+v;else if(s)z.selector=this.selector+"."+s+"("+v+")";return z},each:function(j,s){return b.each(this,j,s)},ready:function(j){b.bindReady();if(b.isReady)j.call(t,b);else q&&q.push(j);return this},eq:function(j){return j=== +-1?this.slice(j):this.slice(j,+j+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(N.apply(this,arguments),"slice",N.call(arguments).join(","))},map:function(j){return this.pushStack(b.map(this,function(s,v){return j.call(s,v,s)}))},end:function(){return this.prevObject||b(null)},push:M,sort:[].sort,splice:[].splice};b.fn.init.prototype=b.fn;b.extend=b.fn.extend=function(){var j,s,v,z,H,G=arguments[0]||{},K=1,Q=arguments.length,ga=false; +if(typeof G==="boolean"){ga=G;G=arguments[1]||{};K=2}if(typeof G!=="object"&&!b.isFunction(G))G={};if(Q===K){G=this;--K}for(;K0))if(q){var s=0,v=q;for(q=null;j=v[s++];)j.call(t,b);b.fn.trigger&&b(t).trigger("ready").unbind("ready")}}},bindReady:function(){if(!p){p=true;if(t.readyState==="complete")return setTimeout(b.ready,1);if(t.addEventListener){t.addEventListener("DOMContentLoaded",u,false);E.addEventListener("load",b.ready,false)}else if(t.attachEvent){t.attachEvent("onreadystatechange",u);E.attachEvent("onload", +b.ready);var j=false;try{j=E.frameElement==null}catch(s){}t.documentElement.doScroll&&j&&a()}}},isFunction:function(j){return b.type(j)==="function"},isArray:Array.isArray||function(j){return b.type(j)==="array"},isWindow:function(j){return j&&typeof j==="object"&&"setInterval"in j},isNaN:function(j){return j==null||!r.test(j)||isNaN(j)},type:function(j){return j==null?String(j):R[y.call(j)]||"object"},isPlainObject:function(j){if(!j||b.type(j)!=="object"||j.nodeType||b.isWindow(j))return false;if(j.constructor&& +!F.call(j,"constructor")&&!F.call(j.constructor.prototype,"isPrototypeOf"))return false;for(var s in j);return s===B||F.call(j,s)},isEmptyObject:function(j){for(var s in j)return false;return true},error:function(j){throw j;},parseJSON:function(j){if(typeof j!=="string"||!j)return null;j=b.trim(j);if(C.test(j.replace(J,"@").replace(w,"]").replace(I,"")))return E.JSON&&E.JSON.parse?E.JSON.parse(j):(new Function("return "+j))();else b.error("Invalid JSON: "+j)},noop:function(){},globalEval:function(j){if(j&& +l.test(j)){var s=t.getElementsByTagName("head")[0]||t.documentElement,v=t.createElement("script");v.type="text/javascript";if(b.support.scriptEval)v.appendChild(t.createTextNode(j));else v.text=j;s.insertBefore(v,s.firstChild);s.removeChild(v)}},nodeName:function(j,s){return j.nodeName&&j.nodeName.toUpperCase()===s.toUpperCase()},each:function(j,s,v){var z,H=0,G=j.length,K=G===B||b.isFunction(j);if(v)if(K)for(z in j){if(s.apply(j[z],v)===false)break}else for(;H
a";var f=d.getElementsByTagName("*"),h=d.getElementsByTagName("a")[0],l=t.createElement("select"), +k=l.appendChild(t.createElement("option"));if(!(!f||!f.length||!h)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(h.getAttribute("style")),hrefNormalized:h.getAttribute("href")==="/a",opacity:/^0.55$/.test(h.style.opacity),cssFloat:!!h.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:k.selected,deleteExpando:true,optDisabled:false,checkClone:false, +scriptEval:false,noCloneEvent:true,boxModel:null,inlineBlockNeedsLayout:false,shrinkWrapBlocks:false,reliableHiddenOffsets:true};l.disabled=true;c.support.optDisabled=!k.disabled;b.type="text/javascript";try{b.appendChild(t.createTextNode("window."+e+"=1;"))}catch(o){}a.insertBefore(b,a.firstChild);if(E[e]){c.support.scriptEval=true;delete E[e]}try{delete b.test}catch(x){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function r(){c.support.noCloneEvent= +false;d.detachEvent("onclick",r)});d.cloneNode(true).fireEvent("onclick")}d=t.createElement("div");d.innerHTML="";a=t.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var r=t.createElement("div");r.style.width=r.style.paddingLeft="1px";t.body.appendChild(r);c.boxModel=c.support.boxModel=r.offsetWidth===2;if("zoom"in r.style){r.style.display="inline";r.style.zoom= +1;c.support.inlineBlockNeedsLayout=r.offsetWidth===2;r.style.display="";r.innerHTML="
";c.support.shrinkWrapBlocks=r.offsetWidth!==2}r.innerHTML="
t
";var A=r.getElementsByTagName("td");c.support.reliableHiddenOffsets=A[0].offsetHeight===0;A[0].style.display="";A[1].style.display="none";c.support.reliableHiddenOffsets=c.support.reliableHiddenOffsets&&A[0].offsetHeight===0;r.innerHTML="";t.body.removeChild(r).style.display= +"none"});a=function(r){var A=t.createElement("div");r="on"+r;var C=r in A;if(!C){A.setAttribute(r,"return;");C=typeof A[r]==="function"}return C};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=f=h=null}})();var ra={},Ja=/^(?:\{.*\}|\[.*\])$/;c.extend({cache:{},uuid:0,expando:"jQuery"+c.now(),noData:{embed:true,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:true},data:function(a,b,d){if(c.acceptData(a)){a=a==E?ra:a;var e=a.nodeType,f=e?a[c.expando]:null,h= +c.cache;if(!(e&&!f&&typeof b==="string"&&d===B)){if(e)f||(a[c.expando]=f=++c.uuid);else h=a;if(typeof b==="object")if(e)h[f]=c.extend(h[f],b);else c.extend(h,b);else if(e&&!h[f])h[f]={};a=e?h[f]:h;if(d!==B)a[b]=d;return typeof b==="string"?a[b]:a}}},removeData:function(a,b){if(c.acceptData(a)){a=a==E?ra:a;var d=a.nodeType,e=d?a[c.expando]:a,f=c.cache,h=d?f[e]:e;if(b){if(h){delete h[b];d&&c.isEmptyObject(h)&&c.removeData(a)}}else if(d&&c.support.deleteExpando)delete a[c.expando];else if(a.removeAttribute)a.removeAttribute(c.expando); +else if(d)delete f[e];else for(var l in a)delete a[l]}},acceptData:function(a){if(a.nodeName){var b=c.noData[a.nodeName.toLowerCase()];if(b)return!(b===true||a.getAttribute("classid")!==b)}return true}});c.fn.extend({data:function(a,b){var d=null;if(typeof a==="undefined"){if(this.length){var e=this[0].attributes,f;d=c.data(this[0]);for(var h=0,l=e.length;h-1)return true;return false},val:function(a){if(!arguments.length){var b=this[0];if(b){if(c.nodeName(b,"option")){var d=b.attributes.value;return!d||d.specified?b.value:b.text}if(c.nodeName(b,"select")){var e=b.selectedIndex;d=[];var f=b.options;b=b.type==="select-one"; +if(e<0)return null;var h=b?e:0;for(e=b?e+1:f.length;h=0;else if(c.nodeName(this,"select")){var A=c.makeArray(r);c("option",this).each(function(){this.selected=c.inArray(c(this).val(),A)>=0});if(!A.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true}, +attr:function(a,b,d,e){if(!a||a.nodeType===3||a.nodeType===8)return B;if(e&&b in c.attrFn)return c(a)[b](d);e=a.nodeType!==1||!c.isXMLDoc(a);var f=d!==B;b=e&&c.props[b]||b;var h=Ta.test(b);if((b in a||a[b]!==B)&&e&&!h){if(f){b==="type"&&Ua.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed");if(d===null)a.nodeType===1&&a.removeAttribute(b);else a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&& +b.specified?b.value:Va.test(a.nodeName)||Wa.test(a.nodeName)&&a.href?0:B;return a[b]}if(!c.support.style&&e&&b==="style"){if(f)a.style.cssText=""+d;return a.style.cssText}f&&a.setAttribute(b,""+d);if(!a.attributes[b]&&a.hasAttribute&&!a.hasAttribute(b))return B;a=!c.support.hrefNormalized&&e&&h?a.getAttribute(b,2):a.getAttribute(b);return a===null?B:a}});var X=/\.(.*)$/,ia=/^(?:textarea|input|select)$/i,La=/\./g,Ma=/ /g,Xa=/[^\w\s.|`]/g,Ya=function(a){return a.replace(Xa,"\\$&")},ua={focusin:0,focusout:0}; +c.event={add:function(a,b,d,e){if(!(a.nodeType===3||a.nodeType===8)){if(c.isWindow(a)&&a!==E&&!a.frameElement)a=E;if(d===false)d=U;else if(!d)return;var f,h;if(d.handler){f=d;d=f.handler}if(!d.guid)d.guid=c.guid++;if(h=c.data(a)){var l=a.nodeType?"events":"__events__",k=h[l],o=h.handle;if(typeof k==="function"){o=k.handle;k=k.events}else if(!k){a.nodeType||(h[l]=h=function(){});h.events=k={}}if(!o)h.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem, +arguments):B};o.elem=a;b=b.split(" ");for(var x=0,r;l=b[x++];){h=f?c.extend({},f):{handler:d,data:e};if(l.indexOf(".")>-1){r=l.split(".");l=r.shift();h.namespace=r.slice(0).sort().join(".")}else{r=[];h.namespace=""}h.type=l;if(!h.guid)h.guid=d.guid;var A=k[l],C=c.event.special[l]||{};if(!A){A=k[l]=[];if(!C.setup||C.setup.call(a,e,r,o)===false)if(a.addEventListener)a.addEventListener(l,o,false);else a.attachEvent&&a.attachEvent("on"+l,o)}if(C.add){C.add.call(a,h);if(!h.handler.guid)h.handler.guid= +d.guid}A.push(h);c.event.global[l]=true}a=null}}},global:{},remove:function(a,b,d,e){if(!(a.nodeType===3||a.nodeType===8)){if(d===false)d=U;var f,h,l=0,k,o,x,r,A,C,J=a.nodeType?"events":"__events__",w=c.data(a),I=w&&w[J];if(w&&I){if(typeof I==="function"){w=I;I=I.events}if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(f in I)c.event.remove(a,f+b)}else{for(b=b.split(" ");f=b[l++];){r=f;k=f.indexOf(".")<0;o=[];if(!k){o=f.split(".");f=o.shift();x=RegExp("(^|\\.)"+ +c.map(o.slice(0).sort(),Ya).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(A=I[f])if(d){r=c.event.special[f]||{};for(h=e||0;h=0){a.type=f=f.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[f]&&c.each(c.cache,function(){this.events&&this.events[f]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType=== +8)return B;a.result=B;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(e=d.nodeType?c.data(d,"handle"):(c.data(d,"__events__")||{}).handle)&&e.apply(d,b);e=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+f]&&d["on"+f].apply(d,b)===false){a.result=false;a.preventDefault()}}catch(h){}if(!a.isPropagationStopped()&&e)c.event.trigger(a,b,e,true);else if(!a.isDefaultPrevented()){var l;e=a.target;var k=f.replace(X,""),o=c.nodeName(e,"a")&&k=== +"click",x=c.event.special[k]||{};if((!x._default||x._default.call(d,a)===false)&&!o&&!(e&&e.nodeName&&c.noData[e.nodeName.toLowerCase()])){try{if(e[k]){if(l=e["on"+k])e["on"+k]=null;c.event.triggered=true;e[k]()}}catch(r){}if(l)e["on"+k]=l;c.event.triggered=false}}},handle:function(a){var b,d,e,f;d=[];var h=c.makeArray(arguments);a=h[0]=c.event.fix(a||E.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive;if(!b){e=a.type.split(".");a.type=e.shift();d=e.slice(0).sort();e=RegExp("(^|\\.)"+ +d.join("\\.(?:.*\\.)?")+"(\\.|$)")}a.namespace=a.namespace||d.join(".");f=c.data(this,this.nodeType?"events":"__events__");if(typeof f==="function")f=f.events;d=(f||{})[a.type];if(f&&d){d=d.slice(0);f=0;for(var l=d.length;f-1?c.map(a.options,function(e){return e.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},Z=function(a,b){var d=a.target,e,f;if(!(!ia.test(d.nodeName)||d.readOnly)){e=c.data(d,"_change_data");f=xa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data",f);if(!(e===B||f===e))if(e!=null||f){a.type="change";a.liveFired= +B;return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:Z,beforedeactivate:Z,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return Z.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return Z.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a,"_change_data",xa(a))}},setup:function(){if(this.type=== +"file")return false;for(var a in V)c.event.add(this,a+".specialChange",V[a]);return ia.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return ia.test(this.nodeName)}};V=c.event.special.change.filters;V.focus=V.beforeactivate}t.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(e){e=c.event.fix(e);e.type=b;return c.event.trigger(e,null,e.target)}c.event.special[b]={setup:function(){ua[b]++===0&&t.addEventListener(a,d,true)},teardown:function(){--ua[b]=== +0&&t.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,e,f){if(typeof d==="object"){for(var h in d)this[b](h,e,d[h],f);return this}if(c.isFunction(e)||e===false){f=e;e=B}var l=b==="one"?c.proxy(f,function(o){c(this).unbind(o,l);return f.apply(this,arguments)}):f;if(d==="unload"&&b!=="one")this.one(d,e,f);else{h=0;for(var k=this.length;h0?this.bind(b,d,e):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});E.attachEvent&&!E.addEventListener&&c(E).bind("unload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}}); +(function(){function a(g,i,n,m,p,q){p=0;for(var u=m.length;p0){F=y;break}}y=y[g]}m[p]=F}}}var d=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e=0,f=Object.prototype.toString,h=false,l=true;[0,0].sort(function(){l=false;return 0});var k=function(g,i,n,m){n=n||[];var p=i=i||t;if(i.nodeType!==1&&i.nodeType!==9)return[];if(!g||typeof g!=="string")return n;var q,u,y,F,M,N=true,O=k.isXML(i),D=[],R=g;do{d.exec("");if(q=d.exec(R)){R=q[3];D.push(q[1]);if(q[2]){F=q[3]; +break}}}while(q);if(D.length>1&&x.exec(g))if(D.length===2&&o.relative[D[0]])u=L(D[0]+D[1],i);else for(u=o.relative[D[0]]?[i]:k(D.shift(),i);D.length;){g=D.shift();if(o.relative[g])g+=D.shift();u=L(g,u)}else{if(!m&&D.length>1&&i.nodeType===9&&!O&&o.match.ID.test(D[0])&&!o.match.ID.test(D[D.length-1])){q=k.find(D.shift(),i,O);i=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]}if(i){q=m?{expr:D.pop(),set:C(m)}:k.find(D.pop(),D.length===1&&(D[0]==="~"||D[0]==="+")&&i.parentNode?i.parentNode:i,O);u=q.expr?k.filter(q.expr, +q.set):q.set;if(D.length>0)y=C(u);else N=false;for(;D.length;){q=M=D.pop();if(o.relative[M])q=D.pop();else M="";if(q==null)q=i;o.relative[M](y,q,O)}}else y=[]}y||(y=u);y||k.error(M||g);if(f.call(y)==="[object Array]")if(N)if(i&&i.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&k.contains(i,y[g])))n.push(u[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&n.push(u[g]);else n.push.apply(n,y);else C(y,n);if(F){k(F,p,n,m);k.uniqueSort(n)}return n};k.uniqueSort=function(g){if(w){h= +l;g.sort(w);if(h)for(var i=1;i0};k.find=function(g,i,n){var m;if(!g)return[];for(var p=0,q=o.order.length;p":function(g,i){var n,m=typeof i==="string",p=0,q=g.length;if(m&&!/\W/.test(i))for(i=i.toLowerCase();p=0))n||m.push(u);else if(n)i[q]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()},CHILD:function(g){if(g[1]==="nth"){var i=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=i[1]+(i[2]||1)-0;g[3]=i[3]-0}g[0]=e++;return g},ATTR:function(g,i,n, +m,p,q){i=g[1].replace(/\\/g,"");if(!q&&o.attrMap[i])g[1]=o.attrMap[i];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,i,n,m,p){if(g[1]==="not")if((d.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,i);else{g=k.filter(g[3],i,n,true^p);n||m.push.apply(m,g);return false}else if(o.match.POS.test(g[0])||o.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled=== +true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,i,n){return!!k(n[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)},text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"=== +g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}},setFilters:{first:function(g,i){return i===0},last:function(g,i,n,m){return i===m.length-1},even:function(g,i){return i%2===0},odd:function(g,i){return i%2===1},lt:function(g,i,n){return in[3]-0},nth:function(g,i,n){return n[3]- +0===i},eq:function(g,i,n){return n[3]-0===i}},filter:{PSEUDO:function(g,i,n,m){var p=i[1],q=o.filters[p];if(q)return q(g,n,i,m);else if(p==="contains")return(g.textContent||g.innerText||k.getText([g])||"").indexOf(i[3])>=0;else if(p==="not"){i=i[3];n=0;for(m=i.length;n=0}},ID:function(g,i){return g.nodeType===1&&g.getAttribute("id")===i},TAG:function(g,i){return i==="*"&&g.nodeType===1||g.nodeName.toLowerCase()=== +i},CLASS:function(g,i){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(i)>-1},ATTR:function(g,i){var n=i[1];n=o.attrHandle[n]?o.attrHandle[n](g):g[n]!=null?g[n]:g.getAttribute(n);var m=n+"",p=i[2],q=i[4];return n==null?p==="!=":p==="="?m===q:p==="*="?m.indexOf(q)>=0:p==="~="?(" "+m+" ").indexOf(q)>=0:!q?m&&n!==false:p==="!="?m!==q:p==="^="?m.indexOf(q)===0:p==="$="?m.substr(m.length-q.length)===q:p==="|="?m===q||m.substr(0,q.length+1)===q+"-":false},POS:function(g,i,n,m){var p=o.setFilters[i[2]]; +if(p)return p(g,n,i,m)}}},x=o.match.POS,r=function(g,i){return"\\"+(i-0+1)},A;for(A in o.match){o.match[A]=RegExp(o.match[A].source+/(?![^\[]*\])(?![^\(]*\))/.source);o.leftMatch[A]=RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[A].source.replace(/\\(\d+)/g,r))}var C=function(g,i){g=Array.prototype.slice.call(g,0);if(i){i.push.apply(i,g);return i}return g};try{Array.prototype.slice.call(t.documentElement.childNodes,0)}catch(J){C=function(g,i){var n=0,m=i||[];if(f.call(g)==="[object Array]")Array.prototype.push.apply(m, +g);else if(typeof g.length==="number")for(var p=g.length;n";n.insertBefore(g,n.firstChild);if(t.getElementById(i)){o.find.ID=function(m,p,q){if(typeof p.getElementById!=="undefined"&&!q)return(p=p.getElementById(m[1]))?p.id===m[1]||typeof p.getAttributeNode!=="undefined"&&p.getAttributeNode("id").nodeValue===m[1]?[p]:B:[]};o.filter.ID=function(m,p){var q=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&q&&q.nodeValue===p}}n.removeChild(g); +n=g=null})();(function(){var g=t.createElement("div");g.appendChild(t.createComment(""));if(g.getElementsByTagName("*").length>0)o.find.TAG=function(i,n){var m=n.getElementsByTagName(i[1]);if(i[1]==="*"){for(var p=[],q=0;m[q];q++)m[q].nodeType===1&&p.push(m[q]);m=p}return m};g.innerHTML="";if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")o.attrHandle.href=function(i){return i.getAttribute("href",2)};g=null})();t.querySelectorAll&& +function(){var g=k,i=t.createElement("div");i.innerHTML="

";if(!(i.querySelectorAll&&i.querySelectorAll(".TEST").length===0)){k=function(m,p,q,u){p=p||t;m=m.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!u&&!k.isXML(p))if(p.nodeType===9)try{return C(p.querySelectorAll(m),q)}catch(y){}else if(p.nodeType===1&&p.nodeName.toLowerCase()!=="object"){var F=p.getAttribute("id"),M=F||"__sizzle__";F||p.setAttribute("id",M);try{return C(p.querySelectorAll("#"+M+" "+m),q)}catch(N){}finally{F|| +p.removeAttribute("id")}}return g(m,p,q,u)};for(var n in g)k[n]=g[n];i=null}}();(function(){var g=t.documentElement,i=g.matchesSelector||g.mozMatchesSelector||g.webkitMatchesSelector||g.msMatchesSelector,n=false;try{i.call(t.documentElement,"[test!='']:sizzle")}catch(m){n=true}if(i)k.matchesSelector=function(p,q){q=q.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(p))try{if(n||!o.match.PSEUDO.test(q)&&!/!=/.test(q))return i.call(p,q)}catch(u){}return k(q,null,null,[p]).length>0}})();(function(){var g= +t.createElement("div");g.innerHTML="
";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){o.order.splice(1,0,"CLASS");o.find.CLASS=function(i,n,m){if(typeof n.getElementsByClassName!=="undefined"&&!m)return n.getElementsByClassName(i[1])};g=null}}})();k.contains=t.documentElement.contains?function(g,i){return g!==i&&(g.contains?g.contains(i):true)}:t.documentElement.compareDocumentPosition? +function(g,i){return!!(g.compareDocumentPosition(i)&16)}:function(){return false};k.isXML=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false};var L=function(g,i){for(var n,m=[],p="",q=i.nodeType?[i]:i;n=o.match.PSEUDO.exec(g);){p+=n[0];g=g.replace(o.match.PSEUDO,"")}g=o.relative[g]?g+"*":g;n=0;for(var u=q.length;n0)for(var h=d;h0},closest:function(a,b){var d=[],e,f,h=this[0];if(c.isArray(a)){var l,k={},o=1;if(h&&a.length){e=0;for(f=a.length;e-1:c(h).is(e))d.push({selector:l,elem:h,level:o})}h= +h.parentNode;o++}}return d}l=cb.test(a)?c(a,b||this.context):null;e=0;for(f=this.length;e-1:c.find.matchesSelector(h,a)){d.push(h);break}else{h=h.parentNode;if(!h||!h.ownerDocument||h===b)break}d=d.length>1?c.unique(d):d;return this.pushStack(d,"closest",a)},index:function(a){if(!a||typeof a==="string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var d=typeof a==="string"?c(a,b||this.context): +c.makeArray(a),e=c.merge(this.get(),d);return this.pushStack(!d[0]||!d[0].parentNode||d[0].parentNode.nodeType===11||!e[0]||!e[0].parentNode||e[0].parentNode.nodeType===11?e:c.unique(e))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a, +2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a, +b){c.fn[a]=function(d,e){var f=c.map(this,b,d);Za.test(a)||(e=d);if(e&&typeof e==="string")f=c.filter(e,f);f=this.length>1?c.unique(f):f;if((this.length>1||ab.test(e))&&$a.test(a))f=f.reverse();return this.pushStack(f,a,bb.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return b.length===1?c.find.matchesSelector(b[0],a)?[b[0]]:[]:c.find.matches(a,b)},dir:function(a,b,d){var e=[];for(a=a[b];a&&a.nodeType!==9&&(d===B||a.nodeType!==1||!c(a).is(d));){a.nodeType===1&& +e.push(a);a=a[b]}return e},nth:function(a,b,d){b=b||1;for(var e=0;a;a=a[d])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var za=/ jQuery\d+="(?:\d+|null)"/g,$=/^\s+/,Aa=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Ba=/<([\w:]+)/,db=/\s]+\/)>/g,P={option:[1, +""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]};P.optgroup=P.option;P.tbody=P.tfoot=P.colgroup=P.caption=P.thead;P.th=P.td;if(!c.support.htmlSerialize)P._default=[1,"div
","
"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d= +c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==B)return this.empty().append((this[0]&&this[0].ownerDocument||t).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this}, +wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})}, +prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b, +this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,e;(e=this[d])!=null;d++)if(!a||c.filter(a,[e]).length){if(!b&&e.nodeType===1){c.cleanData(e.getElementsByTagName("*"));c.cleanData([e])}e.parentNode&&e.parentNode.removeChild(e)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild); +return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,e=this.ownerDocument;if(!d){d=e.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(za,"").replace(fb,'="$1">').replace($,"")],e)[0]}else return this.cloneNode(true)});if(a===true){na(this,b);na(this.find("*"),b.find("*"))}return b},html:function(a){if(a===B)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(za,""):null; +else if(typeof a==="string"&&!Ca.test(a)&&(c.support.leadingWhitespace||!$.test(a))&&!P[(Ba.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Aa,"<$1>");try{for(var b=0,d=this.length;b0||e.cacheable||this.length>1?h.cloneNode(true):h)}k.length&&c.each(k,Oa)}return this}});c.buildFragment=function(a,b,d){var e,f,h;b=b&&b[0]?b[0].ownerDocument||b[0]:t;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===t&&!Ca.test(a[0])&&(c.support.checkClone||!Da.test(a[0]))){f=true;if(h=c.fragments[a[0]])if(h!==1)e=h}if(!e){e=b.createDocumentFragment();c.clean(a,b,e,d)}if(f)c.fragments[a[0]]=h?e:1;return{fragment:e,cacheable:f}};c.fragments={};c.each({appendTo:"append", +prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var e=[];d=c(d);var f=this.length===1&&this[0].parentNode;if(f&&f.nodeType===11&&f.childNodes.length===1&&d.length===1){d[b](this[0]);return this}else{f=0;for(var h=d.length;f0?this.clone(true):this).get();c(d[f])[b](l);e=e.concat(l)}return this.pushStack(e,a,d.selector)}}});c.extend({clean:function(a,b,d,e){b=b||t;if(typeof b.createElement==="undefined")b=b.ownerDocument|| +b[0]&&b[0].ownerDocument||t;for(var f=[],h=0,l;(l=a[h])!=null;h++){if(typeof l==="number")l+="";if(l){if(typeof l==="string"&&!eb.test(l))l=b.createTextNode(l);else if(typeof l==="string"){l=l.replace(Aa,"<$1>");var k=(Ba.exec(l)||["",""])[1].toLowerCase(),o=P[k]||P._default,x=o[0],r=b.createElement("div");for(r.innerHTML=o[1]+l+o[2];x--;)r=r.lastChild;if(!c.support.tbody){x=db.test(l);k=k==="table"&&!x?r.firstChild&&r.firstChild.childNodes:o[1]===""&&!x?r.childNodes:[];for(o=k.length- +1;o>=0;--o)c.nodeName(k[o],"tbody")&&!k[o].childNodes.length&&k[o].parentNode.removeChild(k[o])}!c.support.leadingWhitespace&&$.test(l)&&r.insertBefore(b.createTextNode($.exec(l)[0]),r.firstChild);l=r.childNodes}if(l.nodeType)f.push(l);else f=c.merge(f,l)}}if(d)for(h=0;f[h];h++)if(e&&c.nodeName(f[h],"script")&&(!f[h].type||f[h].type.toLowerCase()==="text/javascript"))e.push(f[h].parentNode?f[h].parentNode.removeChild(f[h]):f[h]);else{f[h].nodeType===1&&f.splice.apply(f,[h+1,0].concat(c.makeArray(f[h].getElementsByTagName("script")))); +d.appendChild(f[h])}return f},cleanData:function(a){for(var b,d,e=c.cache,f=c.event.special,h=c.support.deleteExpando,l=0,k;(k=a[l])!=null;l++)if(!(k.nodeName&&c.noData[k.nodeName.toLowerCase()]))if(d=k[c.expando]){if((b=e[d])&&b.events)for(var o in b.events)f[o]?c.event.remove(k,o):c.removeEvent(k,o,b.handle);if(h)delete k[c.expando];else k.removeAttribute&&k.removeAttribute(c.expando);delete e[d]}}});var Ea=/alpha\([^)]*\)/i,gb=/opacity=([^)]*)/,hb=/-([a-z])/ig,ib=/([A-Z])/g,Fa=/^-?\d+(?:px)?$/i, +jb=/^-?\d/,kb={position:"absolute",visibility:"hidden",display:"block"},Pa=["Left","Right"],Qa=["Top","Bottom"],W,Ga,aa,lb=function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){if(arguments.length===2&&b===B)return this;return c.access(this,a,b,true,function(d,e,f){return f!==B?c.style(d,e,f):c.css(d,e)})};c.extend({cssHooks:{opacity:{get:function(a,b){if(b){var d=W(a,"opacity","opacity");return d===""?"1":d}else return a.style.opacity}}},cssNumber:{zIndex:true,fontWeight:true,opacity:true, +zoom:true,lineHeight:true},cssProps:{"float":c.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,d,e){if(!(!a||a.nodeType===3||a.nodeType===8||!a.style)){var f,h=c.camelCase(b),l=a.style,k=c.cssHooks[h];b=c.cssProps[h]||h;if(d!==B){if(!(typeof d==="number"&&isNaN(d)||d==null)){if(typeof d==="number"&&!c.cssNumber[h])d+="px";if(!k||!("set"in k)||(d=k.set(a,d))!==B)try{l[b]=d}catch(o){}}}else{if(k&&"get"in k&&(f=k.get(a,false,e))!==B)return f;return l[b]}}},css:function(a,b,d){var e,f=c.camelCase(b), +h=c.cssHooks[f];b=c.cssProps[f]||f;if(h&&"get"in h&&(e=h.get(a,true,d))!==B)return e;else if(W)return W(a,b,f)},swap:function(a,b,d){var e={},f;for(f in b){e[f]=a.style[f];a.style[f]=b[f]}d.call(a);for(f in b)a.style[f]=e[f]},camelCase:function(a){return a.replace(hb,lb)}});c.curCSS=c.css;c.each(["height","width"],function(a,b){c.cssHooks[b]={get:function(d,e,f){var h;if(e){if(d.offsetWidth!==0)h=oa(d,b,f);else c.swap(d,kb,function(){h=oa(d,b,f)});if(h<=0){h=W(d,b,b);if(h==="0px"&&aa)h=aa(d,b,b); +if(h!=null)return h===""||h==="auto"?"0px":h}if(h<0||h==null){h=d.style[b];return h===""||h==="auto"?"0px":h}return typeof h==="string"?h:h+"px"}},set:function(d,e){if(Fa.test(e)){e=parseFloat(e);if(e>=0)return e+"px"}else return e}}});if(!c.support.opacity)c.cssHooks.opacity={get:function(a,b){return gb.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var d=a.style;d.zoom=1;var e=c.isNaN(b)?"":"alpha(opacity="+b*100+")",f= +d.filter||"";d.filter=Ea.test(f)?f.replace(Ea,e):d.filter+" "+e}};if(t.defaultView&&t.defaultView.getComputedStyle)Ga=function(a,b,d){var e;d=d.replace(ib,"-$1").toLowerCase();if(!(b=a.ownerDocument.defaultView))return B;if(b=b.getComputedStyle(a,null)){e=b.getPropertyValue(d);if(e===""&&!c.contains(a.ownerDocument.documentElement,a))e=c.style(a,d)}return e};if(t.documentElement.currentStyle)aa=function(a,b){var d,e,f=a.currentStyle&&a.currentStyle[b],h=a.style;if(!Fa.test(f)&&jb.test(f)){d=h.left; +e=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;h.left=b==="fontSize"?"1em":f||0;f=h.pixelLeft+"px";h.left=d;a.runtimeStyle.left=e}return f===""?"auto":f};W=Ga||aa;if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=a.offsetHeight;return a.offsetWidth===0&&b===0||!c.support.reliableHiddenOffsets&&(a.style.display||c.css(a,"display"))==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var mb=c.now(),nb=/)<[^<]*)*<\/script>/gi, +ob=/^(?:select|textarea)/i,pb=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,qb=/^(?:GET|HEAD)$/,Ra=/\[\]$/,T=/\=\?(&|$)/,ja=/\?/,rb=/([?&])_=[^&]*/,sb=/^(\w+:)?\/\/([^\/?#]+)/,tb=/%20/g,ub=/#.*$/,Ha=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!=="string"&&Ha)return Ha.apply(this,arguments);else if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var f=a.slice(e,a.length);a=a.slice(0,e)}e="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b=== +"object"){b=c.param(b,c.ajaxSettings.traditional);e="POST"}var h=this;c.ajax({url:a,type:e,dataType:"html",data:b,complete:function(l,k){if(k==="success"||k==="notmodified")h.html(f?c("
").append(l.responseText.replace(nb,"")).find(f):l.responseText);d&&h.each(d,[l.responseText,k,l])}});return this},serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&& +!this.disabled&&(this.checked||ob.test(this.nodeName)||pb.test(this.type))}).map(function(a,b){var d=c(this).val();return d==null?null:c.isArray(d)?c.map(d,function(e){return{name:b.name,value:e}}):{name:b.name,value:d}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,e){if(c.isFunction(b)){e=e||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:e})}, +getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,e){if(c.isFunction(b)){e=e||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:e})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return new E.XMLHttpRequest},accepts:{xml:"application/xml, text/xml",html:"text/html", +script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},ajax:function(a){var b=c.extend(true,{},c.ajaxSettings,a),d,e,f,h=b.type.toUpperCase(),l=qb.test(h);b.url=b.url.replace(ub,"");b.context=a&&a.context!=null?a.context:b;if(b.data&&b.processData&&typeof b.data!=="string")b.data=c.param(b.data,b.traditional);if(b.dataType==="jsonp"){if(h==="GET")T.test(b.url)||(b.url+=(ja.test(b.url)?"&":"?")+(b.jsonp||"callback")+"=?");else if(!b.data|| +!T.test(b.data))b.data=(b.data?b.data+"&":"")+(b.jsonp||"callback")+"=?";b.dataType="json"}if(b.dataType==="json"&&(b.data&&T.test(b.data)||T.test(b.url))){d=b.jsonpCallback||"jsonp"+mb++;if(b.data)b.data=(b.data+"").replace(T,"="+d+"$1");b.url=b.url.replace(T,"="+d+"$1");b.dataType="script";var k=E[d];E[d]=function(m){if(c.isFunction(k))k(m);else{E[d]=B;try{delete E[d]}catch(p){}}f=m;c.handleSuccess(b,w,e,f);c.handleComplete(b,w,e,f);r&&r.removeChild(A)}}if(b.dataType==="script"&&b.cache===null)b.cache= +false;if(b.cache===false&&l){var o=c.now(),x=b.url.replace(rb,"$1_="+o);b.url=x+(x===b.url?(ja.test(b.url)?"&":"?")+"_="+o:"")}if(b.data&&l)b.url+=(ja.test(b.url)?"&":"?")+b.data;b.global&&c.active++===0&&c.event.trigger("ajaxStart");o=(o=sb.exec(b.url))&&(o[1]&&o[1].toLowerCase()!==location.protocol||o[2].toLowerCase()!==location.host);if(b.dataType==="script"&&h==="GET"&&o){var r=t.getElementsByTagName("head")[0]||t.documentElement,A=t.createElement("script");if(b.scriptCharset)A.charset=b.scriptCharset; +A.src=b.url;if(!d){var C=false;A.onload=A.onreadystatechange=function(){if(!C&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){C=true;c.handleSuccess(b,w,e,f);c.handleComplete(b,w,e,f);A.onload=A.onreadystatechange=null;r&&A.parentNode&&r.removeChild(A)}}}r.insertBefore(A,r.firstChild);return B}var J=false,w=b.xhr();if(w){b.username?w.open(h,b.url,b.async,b.username,b.password):w.open(h,b.url,b.async);try{if(b.data!=null&&!l||a&&a.contentType)w.setRequestHeader("Content-Type", +b.contentType);if(b.ifModified){c.lastModified[b.url]&&w.setRequestHeader("If-Modified-Since",c.lastModified[b.url]);c.etag[b.url]&&w.setRequestHeader("If-None-Match",c.etag[b.url])}o||w.setRequestHeader("X-Requested-With","XMLHttpRequest");w.setRequestHeader("Accept",b.dataType&&b.accepts[b.dataType]?b.accepts[b.dataType]+", */*; q=0.01":b.accepts._default)}catch(I){}if(b.beforeSend&&b.beforeSend.call(b.context,w,b)===false){b.global&&c.active--===1&&c.event.trigger("ajaxStop");w.abort();return false}b.global&& +c.triggerGlobal(b,"ajaxSend",[w,b]);var L=w.onreadystatechange=function(m){if(!w||w.readyState===0||m==="abort"){J||c.handleComplete(b,w,e,f);J=true;if(w)w.onreadystatechange=c.noop}else if(!J&&w&&(w.readyState===4||m==="timeout")){J=true;w.onreadystatechange=c.noop;e=m==="timeout"?"timeout":!c.httpSuccess(w)?"error":b.ifModified&&c.httpNotModified(w,b.url)?"notmodified":"success";var p;if(e==="success")try{f=c.httpData(w,b.dataType,b)}catch(q){e="parsererror";p=q}if(e==="success"||e==="notmodified")d|| +c.handleSuccess(b,w,e,f);else c.handleError(b,w,e,p);d||c.handleComplete(b,w,e,f);m==="timeout"&&w.abort();if(b.async)w=null}};try{var g=w.abort;w.abort=function(){w&&Function.prototype.call.call(g,w);L("abort")}}catch(i){}b.async&&b.timeout>0&&setTimeout(function(){w&&!J&&L("timeout")},b.timeout);try{w.send(l||b.data==null?null:b.data)}catch(n){c.handleError(b,w,null,n);c.handleComplete(b,w,e,f)}b.async||L();return w}},param:function(a,b){var d=[],e=function(h,l){l=c.isFunction(l)?l():l;d[d.length]= +encodeURIComponent(h)+"="+encodeURIComponent(l)};if(b===B)b=c.ajaxSettings.traditional;if(c.isArray(a)||a.jquery)c.each(a,function(){e(this.name,this.value)});else for(var f in a)da(f,a[f],b,e);return d.join("&").replace(tb,"+")}});c.extend({active:0,lastModified:{},etag:{},handleError:function(a,b,d,e){a.error&&a.error.call(a.context,b,d,e);a.global&&c.triggerGlobal(a,"ajaxError",[b,a,e])},handleSuccess:function(a,b,d,e){a.success&&a.success.call(a.context,e,d,b);a.global&&c.triggerGlobal(a,"ajaxSuccess", +[b,a])},handleComplete:function(a,b,d){a.complete&&a.complete.call(a.context,b,d);a.global&&c.triggerGlobal(a,"ajaxComplete",[b,a]);a.global&&c.active--===1&&c.event.trigger("ajaxStop")},triggerGlobal:function(a,b,d){(a.context&&a.context.url==null?c(a.context):c.event).trigger(b,d)},httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status===1223}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"), +e=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(e)c.etag[b]=e;return a.status===304},httpData:function(a,b,d){var e=a.getResponseHeader("content-type")||"",f=b==="xml"||!b&&e.indexOf("xml")>=0;a=f?a.responseXML:a.responseText;f&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b==="json"||!b&&e.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&e.indexOf("javascript")>=0)c.globalEval(a);return a}}); +if(E.ActiveXObject)c.ajaxSettings.xhr=function(){if(E.location.protocol!=="file:")try{return new E.XMLHttpRequest}catch(a){}try{return new E.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}};c.support.ajax=!!c.ajaxSettings.xhr();var ea={},vb=/^(?:toggle|show|hide)$/,wb=/^([+\-]=)?([\d+.\-]+)(.*)$/,ba,pa=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b,d){if(a||a===0)return this.animate(S("show", +3),a,b,d);else{d=0;for(var e=this.length;d=0;e--)if(d[e].elem===this){b&&d[e](true);d.splice(e,1)}});b||this.dequeue();return this}});c.each({slideDown:S("show",1),slideUp:S("hide",1),slideToggle:S("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){c.fn[a]=function(d,e,f){return this.animate(b, +d,e,f)}});c.extend({speed:function(a,b,d){var e=a&&typeof a==="object"?c.extend({},a):{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};e.duration=c.fx.off?0:typeof e.duration==="number"?e.duration:e.duration in c.fx.speeds?c.fx.speeds[e.duration]:c.fx.speeds._default;e.old=e.complete;e.complete=function(){e.queue!==false&&c(this).dequeue();c.isFunction(e.old)&&e.old.call(this)};return e},easing:{linear:function(a,b,d,e){return d+e*a},swing:function(a,b,d,e){return(-Math.cos(a* +Math.PI)/2+0.5)*e+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]||c.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a=parseFloat(c.css(this.elem,this.prop));return a&&a>-1E4?a:0},custom:function(a,b,d){function e(l){return f.step(l)} +var f=this,h=c.fx;this.startTime=c.now();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start;this.pos=this.state=0;e.elem=this.elem;if(e()&&c.timers.push(e)&&!ba)ba=setInterval(h.tick,h.interval)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true; +this.custom(this.cur(),0)},step:function(a){var b=c.now(),d=true;if(a||b>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var e in this.options.curAnim)if(this.options.curAnim[e]!==true)d=false;if(d){if(this.options.overflow!=null&&!c.support.shrinkWrapBlocks){var f=this.elem,h=this.options;c.each(["","X","Y"],function(k,o){f.style["overflow"+o]=h.overflow[k]})}this.options.hide&&c(this.elem).hide();if(this.options.hide|| +this.options.show)for(var l in this.options.curAnim)c.style(this.elem,l,this.options.orig[l]);this.options.complete.call(this.elem)}return false}else{a=b-this.startTime;this.state=a/this.options.duration;b=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||b](this.state,a,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a= +c.timers,b=0;b-1;e={};var x={};if(o)x=f.position();l=o?x.top:parseInt(l,10)||0;k=o?x.left:parseInt(k,10)||0;if(c.isFunction(b))b=b.call(a,d,h);if(b.top!=null)e.top=b.top-h.top+l;if(b.left!=null)e.left=b.left-h.left+k;"using"in b?b.using.call(a, +e):f.css(e)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),e=Ia.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.css(a,"marginTop"))||0;d.left-=parseFloat(c.css(a,"marginLeft"))||0;e.top+=parseFloat(c.css(b[0],"borderTopWidth"))||0;e.left+=parseFloat(c.css(b[0],"borderLeftWidth"))||0;return{top:d.top-e.top,left:d.left-e.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||t.body;a&&!Ia.test(a.nodeName)&& +c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(e){var f=this[0],h;if(!f)return null;if(e!==B)return this.each(function(){if(h=fa(this))h.scrollTo(!a?e:c(h).scrollLeft(),a?e:c(h).scrollTop());else this[d]=e});else return(h=fa(f))?"pageXOffset"in h?h[a?"pageYOffset":"pageXOffset"]:c.support.boxModel&&h.document.documentElement[d]||h.document.body[d]:f[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase(); +c.fn["inner"+b]=function(){return this[0]?parseFloat(c.css(this[0],d,"padding")):null};c.fn["outer"+b]=function(e){return this[0]?parseFloat(c.css(this[0],d,e?"margin":"border")):null};c.fn[d]=function(e){var f=this[0];if(!f)return e==null?null:this;if(c.isFunction(e))return this.each(function(l){var k=c(this);k[d](e.call(this,l,k[d]()))});if(c.isWindow(f))return f.document.compatMode==="CSS1Compat"&&f.document.documentElement["client"+b]||f.document.body["client"+b];else if(f.nodeType===9)return Math.max(f.documentElement["client"+ +b],f.body["scroll"+b],f.documentElement["scroll"+b],f.body["offset"+b],f.documentElement["offset"+b]);else if(e===B){f=c.css(f,d);var h=parseFloat(f);return c.isNaN(h)?f:h}else return this.css(d,typeof e==="string"?e:e+"px")}})})(window); diff --git a/web/js/lib/.svn/text-base/jquery-ui-1.8.13.custom.min.js.svn-base b/web/js/lib/.svn/text-base/jquery-ui-1.8.13.custom.min.js.svn-base new file mode 100644 index 00000000..3dc0b334 --- /dev/null +++ b/web/js/lib/.svn/text-base/jquery-ui-1.8.13.custom.min.js.svn-base @@ -0,0 +1,285 @@ +/*! + * jQuery UI 1.8.13 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI + */ +(function(c,j){function k(a,b){var d=a.nodeName.toLowerCase();if("area"===d){b=a.parentNode;d=b.name;if(!a.href||!d||b.nodeName.toLowerCase()!=="map")return false;a=c("img[usemap=#"+d+"]")[0];return!!a&&l(a)}return(/input|select|textarea|button|object/.test(d)?!a.disabled:"a"==d?a.href||b:b)&&l(a)}function l(a){return!c(a).parents().andSelf().filter(function(){return c.curCSS(this,"visibility")==="hidden"||c.expr.filters.hidden(this)}).length}c.ui=c.ui||{};if(!c.ui.version){c.extend(c.ui,{version:"1.8.13", +keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});c.fn.extend({_focus:c.fn.focus,focus:function(a,b){return typeof a==="number"?this.each(function(){var d=this;setTimeout(function(){c(d).focus(); +b&&b.call(d)},a)}):this._focus.apply(this,arguments)},scrollParent:function(){var a;a=c.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(c.curCSS(this,"position",1))&&/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this, +"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!a.length?c(document):a},zIndex:function(a){if(a!==j)return this.css("zIndex",a);if(this.length){a=c(this[0]);for(var b;a.length&&a[0]!==document;){b=a.css("position");if(b==="absolute"||b==="relative"||b==="fixed"){b=parseInt(a.css("zIndex"),10);if(!isNaN(b)&&b!==0)return b}a=a.parent()}}return 0},disableSelection:function(){return this.bind((c.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection", +function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});c.each(["Width","Height"],function(a,b){function d(f,g,m,n){c.each(e,function(){g-=parseFloat(c.curCSS(f,"padding"+this,true))||0;if(m)g-=parseFloat(c.curCSS(f,"border"+this+"Width",true))||0;if(n)g-=parseFloat(c.curCSS(f,"margin"+this,true))||0});return g}var e=b==="Width"?["Left","Right"]:["Top","Bottom"],h=b.toLowerCase(),i={innerWidth:c.fn.innerWidth,innerHeight:c.fn.innerHeight,outerWidth:c.fn.outerWidth, +outerHeight:c.fn.outerHeight};c.fn["inner"+b]=function(f){if(f===j)return i["inner"+b].call(this);return this.each(function(){c(this).css(h,d(this,f)+"px")})};c.fn["outer"+b]=function(f,g){if(typeof f!=="number")return i["outer"+b].call(this,f);return this.each(function(){c(this).css(h,d(this,f,true,g)+"px")})}});c.extend(c.expr[":"],{data:function(a,b,d){return!!c.data(a,d[3])},focusable:function(a){return k(a,!isNaN(c.attr(a,"tabindex")))},tabbable:function(a){var b=c.attr(a,"tabindex"),d=isNaN(b); +return(d||b>=0)&&k(a,!d)}});c(function(){var a=document.body,b=a.appendChild(b=document.createElement("div"));c.extend(b.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});c.support.minHeight=b.offsetHeight===100;c.support.selectstart="onselectstart"in b;a.removeChild(b).style.display="none"});c.extend(c.ui,{plugin:{add:function(a,b,d){a=c.ui[a].prototype;for(var e in d){a.plugins[e]=a.plugins[e]||[];a.plugins[e].push([b,d[e]])}},call:function(a,b,d){if((b=a.plugins[b])&&a.element[0].parentNode)for(var e= +0;e0)return true;a[b]=1;d=a[b]>0;a[b]=0;return d},isOverAxis:function(a,b,d){return a>b&&a=9)&&!a.button)return this._mouseUp(a);if(this._mouseStarted){this._mouseDrag(a);return a.preventDefault()}if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a))(this._mouseStarted=this._mouseStart(this._mouseDownEvent,a)!==false)?this._mouseDrag(a):this._mouseUp(a);return!this._mouseStarted},_mouseUp:function(a){b(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted= +false;a.target==this._mouseDownEvent.target&&b.data(a.target,this.widgetName+".preventClickEvent",true);this._mouseStop(a)}return false},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return true}})})(jQuery); +;/* + * jQuery UI Position 1.8.13 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Position + */ +(function(c){c.ui=c.ui||{};var n=/left|center|right/,o=/top|center|bottom/,t=c.fn.position,u=c.fn.offset;c.fn.position=function(b){if(!b||!b.of)return t.apply(this,arguments);b=c.extend({},b);var a=c(b.of),d=a[0],g=(b.collision||"flip").split(" "),e=b.offset?b.offset.split(" "):[0,0],h,k,j;if(d.nodeType===9){h=a.width();k=a.height();j={top:0,left:0}}else if(d.setTimeout){h=a.width();k=a.height();j={top:a.scrollTop(),left:a.scrollLeft()}}else if(d.preventDefault){b.at="left top";h=k=0;j={top:b.of.pageY, +left:b.of.pageX}}else{h=a.outerWidth();k=a.outerHeight();j=a.offset()}c.each(["my","at"],function(){var f=(b[this]||"").split(" ");if(f.length===1)f=n.test(f[0])?f.concat(["center"]):o.test(f[0])?["center"].concat(f):["center","center"];f[0]=n.test(f[0])?f[0]:"center";f[1]=o.test(f[1])?f[1]:"center";b[this]=f});if(g.length===1)g[1]=g[0];e[0]=parseInt(e[0],10)||0;if(e.length===1)e[1]=e[0];e[1]=parseInt(e[1],10)||0;if(b.at[0]==="right")j.left+=h;else if(b.at[0]==="center")j.left+=h/2;if(b.at[1]==="bottom")j.top+= +k;else if(b.at[1]==="center")j.top+=k/2;j.left+=e[0];j.top+=e[1];return this.each(function(){var f=c(this),l=f.outerWidth(),m=f.outerHeight(),p=parseInt(c.curCSS(this,"marginLeft",true))||0,q=parseInt(c.curCSS(this,"marginTop",true))||0,v=l+p+(parseInt(c.curCSS(this,"marginRight",true))||0),w=m+q+(parseInt(c.curCSS(this,"marginBottom",true))||0),i=c.extend({},j),r;if(b.my[0]==="right")i.left-=l;else if(b.my[0]==="center")i.left-=l/2;if(b.my[1]==="bottom")i.top-=m;else if(b.my[1]==="center")i.top-= +m/2;i.left=Math.round(i.left);i.top=Math.round(i.top);r={left:i.left-p,top:i.top-q};c.each(["left","top"],function(s,x){c.ui.position[g[s]]&&c.ui.position[g[s]][x](i,{targetWidth:h,targetHeight:k,elemWidth:l,elemHeight:m,collisionPosition:r,collisionWidth:v,collisionHeight:w,offset:e,my:b.my,at:b.at})});c.fn.bgiframe&&f.bgiframe();f.offset(c.extend(i,{using:b.using}))})};c.ui.position={fit:{left:function(b,a){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();b.left= +d>0?b.left-d:Math.max(b.left-a.collisionPosition.left,b.left)},top:function(b,a){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();b.top=d>0?b.top-d:Math.max(b.top-a.collisionPosition.top,b.top)}},flip:{left:function(b,a){if(a.at[0]!=="center"){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();var g=a.my[0]==="left"?-a.elemWidth:a.my[0]==="right"?a.elemWidth:0,e=a.at[0]==="left"?a.targetWidth:-a.targetWidth,h=-2*a.offset[0];b.left+= +a.collisionPosition.left<0?g+e+h:d>0?g+e+h:0}},top:function(b,a){if(a.at[1]!=="center"){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();var g=a.my[1]==="top"?-a.elemHeight:a.my[1]==="bottom"?a.elemHeight:0,e=a.at[1]==="top"?a.targetHeight:-a.targetHeight,h=-2*a.offset[1];b.top+=a.collisionPosition.top<0?g+e+h:d>0?g+e+h:0}}}};if(!c.offset.setOffset){c.offset.setOffset=function(b,a){if(/static/.test(c.curCSS(b,"position")))b.style.position="relative";var d=c(b), +g=d.offset(),e=parseInt(c.curCSS(b,"top",true),10)||0,h=parseInt(c.curCSS(b,"left",true),10)||0;g={top:a.top-g.top+e,left:a.left-g.left+h};"using"in a?a.using.call(b,g):d.css(g)};c.fn.offset=function(b){var a=this[0];if(!a||!a.ownerDocument)return null;if(b)return this.each(function(){c.offset.setOffset(this,b)});return u.call(this)}}})(jQuery); +;/* + * jQuery UI Effects 1.8.13 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Effects/ + */ +jQuery.effects||function(f,j){function m(c){var a;if(c&&c.constructor==Array&&c.length==3)return c;if(a=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(c))return[parseInt(a[1],10),parseInt(a[2],10),parseInt(a[3],10)];if(a=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(c))return[parseFloat(a[1])*2.55,parseFloat(a[2])*2.55,parseFloat(a[3])*2.55];if(a=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(c))return[parseInt(a[1], +16),parseInt(a[2],16),parseInt(a[3],16)];if(a=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(c))return[parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16),parseInt(a[3]+a[3],16)];if(/rgba\(0, 0, 0, 0\)/.exec(c))return n.transparent;return n[f.trim(c).toLowerCase()]}function s(c,a){var b;do{b=f.curCSS(c,a);if(b!=""&&b!="transparent"||f.nodeName(c,"body"))break;a="backgroundColor"}while(c=c.parentNode);return m(b)}function o(){var c=document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle, +a={},b,d;if(c&&c.length&&c[0]&&c[c[0]])for(var e=c.length;e--;){b=c[e];if(typeof c[b]=="string"){d=b.replace(/\-(\w)/g,function(g,h){return h.toUpperCase()});a[d]=c[b]}}else for(b in c)if(typeof c[b]==="string")a[b]=c[b];return a}function p(c){var a,b;for(a in c){b=c[a];if(b==null||f.isFunction(b)||a in t||/scrollbar/.test(a)||!/color/i.test(a)&&isNaN(parseFloat(b)))delete c[a]}return c}function u(c,a){var b={_:0},d;for(d in a)if(c[d]!=a[d])b[d]=a[d];return b}function k(c,a,b,d){if(typeof c=="object"){d= +a;b=null;a=c;c=a.effect}if(f.isFunction(a)){d=a;b=null;a={}}if(typeof a=="number"||f.fx.speeds[a]){d=b;b=a;a={}}if(f.isFunction(b)){d=b;b=null}a=a||{};b=b||a.duration;b=f.fx.off?0:typeof b=="number"?b:b in f.fx.speeds?f.fx.speeds[b]:f.fx.speeds._default;d=d||a.complete;return[c,a,b,d]}function l(c){if(!c||typeof c==="number"||f.fx.speeds[c])return true;if(typeof c==="string"&&!f.effects[c])return true;return false}f.effects={};f.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor", +"borderTopColor","borderColor","color","outlineColor"],function(c,a){f.fx.step[a]=function(b){if(!b.colorInit){b.start=s(b.elem,a);b.end=m(b.end);b.colorInit=true}b.elem.style[a]="rgb("+Math.max(Math.min(parseInt(b.pos*(b.end[0]-b.start[0])+b.start[0],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[1]-b.start[1])+b.start[1],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[2]-b.start[2])+b.start[2],10),255),0)+")"}});var n={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0, +0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211, +211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]},q=["add","remove","toggle"],t={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};f.effects.animateClass=function(c,a,b, +d){if(f.isFunction(b)){d=b;b=null}return this.queue(function(){var e=f(this),g=e.attr("style")||" ",h=p(o.call(this)),r,v=e.attr("class");f.each(q,function(w,i){c[i]&&e[i+"Class"](c[i])});r=p(o.call(this));e.attr("class",v);e.animate(u(h,r),{queue:false,duration:a,easding:b,complete:function(){f.each(q,function(w,i){c[i]&&e[i+"Class"](c[i])});if(typeof e.attr("style")=="object"){e.attr("style").cssText="";e.attr("style").cssText=g}else e.attr("style",g);d&&d.apply(this,arguments);f.dequeue(this)}})})}; +f.fn.extend({_addClass:f.fn.addClass,addClass:function(c,a,b,d){return a?f.effects.animateClass.apply(this,[{add:c},a,b,d]):this._addClass(c)},_removeClass:f.fn.removeClass,removeClass:function(c,a,b,d){return a?f.effects.animateClass.apply(this,[{remove:c},a,b,d]):this._removeClass(c)},_toggleClass:f.fn.toggleClass,toggleClass:function(c,a,b,d,e){return typeof a=="boolean"||a===j?b?f.effects.animateClass.apply(this,[a?{add:c}:{remove:c},b,d,e]):this._toggleClass(c,a):f.effects.animateClass.apply(this, +[{toggle:c},a,b,d])},switchClass:function(c,a,b,d,e){return f.effects.animateClass.apply(this,[{add:a,remove:c},b,d,e])}});f.extend(f.effects,{version:"1.8.13",save:function(c,a){for(var b=0;b
").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}); +c.wrap(b);b=c.parent();if(c.css("position")=="static"){b.css({position:"relative"});c.css({position:"relative"})}else{f.extend(a,{position:c.css("position"),zIndex:c.css("z-index")});f.each(["top","left","bottom","right"],function(d,e){a[e]=c.css(e);if(isNaN(parseInt(a[e],10)))a[e]="auto"});c.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})}return b.css(a).show()},removeWrapper:function(c){if(c.parent().is(".ui-effects-wrapper"))return c.parent().replaceWith(c);return c},setTransition:function(c, +a,b,d){d=d||{};f.each(a,function(e,g){unit=c.cssUnit(g);if(unit[0]>0)d[g]=unit[0]*b+unit[1]});return d}});f.fn.extend({effect:function(c){var a=k.apply(this,arguments),b={options:a[1],duration:a[2],callback:a[3]};a=b.options.mode;var d=f.effects[c];if(f.fx.off||!d)return a?this[a](b.duration,b.callback):this.each(function(){b.callback&&b.callback.call(this)});return d.call(this,b)},_show:f.fn.show,show:function(c){if(l(c))return this._show.apply(this,arguments);else{var a=k.apply(this,arguments); +a[1].mode="show";return this.effect.apply(this,a)}},_hide:f.fn.hide,hide:function(c){if(l(c))return this._hide.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="hide";return this.effect.apply(this,a)}},__toggle:f.fn.toggle,toggle:function(c){if(l(c)||typeof c==="boolean"||f.isFunction(c))return this.__toggle.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="toggle";return this.effect.apply(this,a)}},cssUnit:function(c){var a=this.css(c),b=[];f.each(["em","px","%", +"pt"],function(d,e){if(a.indexOf(e)>0)b=[parseFloat(a),e]});return b}});f.easing.jswing=f.easing.swing;f.extend(f.easing,{def:"easeOutQuad",swing:function(c,a,b,d,e){return f.easing[f.easing.def](c,a,b,d,e)},easeInQuad:function(c,a,b,d,e){return d*(a/=e)*a+b},easeOutQuad:function(c,a,b,d,e){return-d*(a/=e)*(a-2)+b},easeInOutQuad:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a+b;return-d/2*(--a*(a-2)-1)+b},easeInCubic:function(c,a,b,d,e){return d*(a/=e)*a*a+b},easeOutCubic:function(c,a,b,d,e){return d* +((a=a/e-1)*a*a+1)+b},easeInOutCubic:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a+b;return d/2*((a-=2)*a*a+2)+b},easeInQuart:function(c,a,b,d,e){return d*(a/=e)*a*a*a+b},easeOutQuart:function(c,a,b,d,e){return-d*((a=a/e-1)*a*a*a-1)+b},easeInOutQuart:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a*a+b;return-d/2*((a-=2)*a*a*a-2)+b},easeInQuint:function(c,a,b,d,e){return d*(a/=e)*a*a*a*a+b},easeOutQuint:function(c,a,b,d,e){return d*((a=a/e-1)*a*a*a*a+1)+b},easeInOutQuint:function(c,a,b,d,e){if((a/= +e/2)<1)return d/2*a*a*a*a*a+b;return d/2*((a-=2)*a*a*a*a+2)+b},easeInSine:function(c,a,b,d,e){return-d*Math.cos(a/e*(Math.PI/2))+d+b},easeOutSine:function(c,a,b,d,e){return d*Math.sin(a/e*(Math.PI/2))+b},easeInOutSine:function(c,a,b,d,e){return-d/2*(Math.cos(Math.PI*a/e)-1)+b},easeInExpo:function(c,a,b,d,e){return a==0?b:d*Math.pow(2,10*(a/e-1))+b},easeOutExpo:function(c,a,b,d,e){return a==e?b+d:d*(-Math.pow(2,-10*a/e)+1)+b},easeInOutExpo:function(c,a,b,d,e){if(a==0)return b;if(a==e)return b+d;if((a/= +e/2)<1)return d/2*Math.pow(2,10*(a-1))+b;return d/2*(-Math.pow(2,-10*--a)+2)+b},easeInCirc:function(c,a,b,d,e){return-d*(Math.sqrt(1-(a/=e)*a)-1)+b},easeOutCirc:function(c,a,b,d,e){return d*Math.sqrt(1-(a=a/e-1)*a)+b},easeInOutCirc:function(c,a,b,d,e){if((a/=e/2)<1)return-d/2*(Math.sqrt(1-a*a)-1)+b;return d/2*(Math.sqrt(1-(a-=2)*a)+1)+b},easeInElastic:function(c,a,b,d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e)==1)return b+d;g||(g=e*0.3);if(h").css({position:"absolute",visibility:"visible",left:-f*(h/d),top:-e*(i/c)}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:h/d,height:i/c,left:g.left+f*(h/d)+(a.options.mode=="show"?(f-Math.floor(d/2))*(h/d):0),top:g.top+e*(i/c)+(a.options.mode=="show"?(e-Math.floor(c/2))*(i/c):0),opacity:a.options.mode=="show"?0:1}).animate({left:g.left+f*(h/d)+(a.options.mode=="show"?0:(f-Math.floor(d/2))*(h/d)),top:g.top+ +e*(i/c)+(a.options.mode=="show"?0:(e-Math.floor(c/2))*(i/c)),opacity:a.options.mode=="show"?1:0},a.duration||500);setTimeout(function(){a.options.mode=="show"?b.css({visibility:"visible"}):b.css({visibility:"visible"}).hide();a.callback&&a.callback.apply(b[0]);b.dequeue();j("div.ui-effects-explode").remove()},a.duration||500)})}})(jQuery); +;/* + * jQuery UI Effects Fade 1.8.13 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Effects/Fade + * + * Depends: + * jquery.effects.core.js + */ +(function(b){b.effects.fade=function(a){return this.queue(function(){var c=b(this),d=b.effects.setMode(c,a.options.mode||"hide");c.animate({opacity:d},{queue:false,duration:a.duration,easing:a.options.easing,complete:function(){a.callback&&a.callback.apply(this,arguments);c.dequeue()}})})}})(jQuery); +;/* + * jQuery UI Effects Fold 1.8.13 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Effects/Fold + * + * Depends: + * jquery.effects.core.js + */ +(function(c){c.effects.fold=function(a){return this.queue(function(){var b=c(this),j=["position","top","bottom","left","right"],d=c.effects.setMode(b,a.options.mode||"hide"),g=a.options.size||15,h=!!a.options.horizFirst,k=a.duration?a.duration/2:c.fx.speeds._default/2;c.effects.save(b,j);b.show();var e=c.effects.createWrapper(b).css({overflow:"hidden"}),f=d=="show"!=h,l=f?["width","height"]:["height","width"];f=f?[e.width(),e.height()]:[e.height(),e.width()];var i=/([0-9]+)%/.exec(g);if(i)g=parseInt(i[1], +10)/100*f[d=="hide"?0:1];if(d=="show")e.css(h?{height:0,width:g}:{height:g,width:0});h={};i={};h[l[0]]=d=="show"?f[0]:g;i[l[1]]=d=="show"?f[1]:0;e.animate(h,k,a.options.easing).animate(i,k,a.options.easing,function(){d=="hide"&&b.hide();c.effects.restore(b,j);c.effects.removeWrapper(b);a.callback&&a.callback.apply(b[0],arguments);b.dequeue()})})}})(jQuery); +;/* + * jQuery UI Effects Highlight 1.8.13 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Effects/Highlight + * + * Depends: + * jquery.effects.core.js + */ +(function(b){b.effects.highlight=function(c){return this.queue(function(){var a=b(this),e=["backgroundImage","backgroundColor","opacity"],d=b.effects.setMode(a,c.options.mode||"show"),f={backgroundColor:a.css("backgroundColor")};if(d=="hide")f.opacity=0;b.effects.save(a,e);a.show().css({backgroundImage:"none",backgroundColor:c.options.color||"#ffff99"}).animate(f,{queue:false,duration:c.duration,easing:c.options.easing,complete:function(){d=="hide"&&a.hide();b.effects.restore(a,e);d=="show"&&!b.support.opacity&& +this.style.removeAttribute("filter");c.callback&&c.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery); +;/* + * jQuery UI Effects Pulsate 1.8.13 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Effects/Pulsate + * + * Depends: + * jquery.effects.core.js + */ +(function(d){d.effects.pulsate=function(a){return this.queue(function(){var b=d(this),c=d.effects.setMode(b,a.options.mode||"show");times=(a.options.times||5)*2-1;duration=a.duration?a.duration/2:d.fx.speeds._default/2;isVisible=b.is(":visible");animateTo=0;if(!isVisible){b.css("opacity",0).show();animateTo=1}if(c=="hide"&&isVisible||c=="show"&&!isVisible)times--;for(c=0;c').appendTo(document.body).addClass(a.options.className).css({top:d.top,left:d.left,height:b.innerHeight(),width:b.innerWidth(),position:"absolute"}).animate(c,a.duration,a.options.easing,function(){f.remove();a.callback&&a.callback.apply(b[0],arguments); +b.dequeue()})})}})(jQuery); +; \ No newline at end of file diff --git a/web/js/lib/.svn/text-base/popup.js.svn-base b/web/js/lib/.svn/text-base/popup.js.svn-base new file mode 100644 index 00000000..728a3e84 --- /dev/null +++ b/web/js/lib/.svn/text-base/popup.js.svn-base @@ -0,0 +1,209 @@ +/* + * $Revision$ + * $Date$ + * + * Copyright (C) 1999-2009 Jive Software. All rights reserved. + * + * This software is the proprietary information of Jive Software. Use is subject to license terms. + */ + +/* +* $ lightbox_me +* By: Buck Wilson +* Version : 2.0 +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +(function($) { + + $.fn.lightbox_me = function(options) { + + + + return this.each(function() { + + var + opts = $.extend({}, $.fn.lightbox_me.defaults, options), + $overlay = $('
'), + $self = $(this), + + $iframe = $('