From 34c233950a9a3de6e44ee660e1c28d34b4f2e0d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=81Z=C3=81R=20Imre=20AI=20Agent?= Date: Thu, 16 Jul 2026 13:47:32 +0200 Subject: [PATCH] feat(cadline): convert common_cadline_libraries + maintenance to submodules MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The developer-controlled Cadline repos (cadcommonlib, maintenance) become git submodules so updates flow through: git submodule update --remote -> build -> commit new pointers. Pinned to their authoritative HEADs. build-baseline.sh inits the submodules and normalizes their CRLF to LF (the deploy transform) so the assembled baseline byte-matches the deployed form. constants.php (live-only config, not in the repo; carries a DB credential tracked in the credential inventory) is kept as an overlay (overrides/) per instruction — removal happens at source later. Signed-off-by: LÁZÁR Imre Assisted-by: claude-code@claude-opus-4-8 --- .gitmodules | 6 + build-baseline.sh | 18 +- cadline/backend/common_cadline_libraries | 1 + .../common_cadline_libraries/.gitignore | 1 - .../common_cadline_libraries/POfile.php | 100 - .../crm_config.db.php | 24 - .../common_cadline_libraries/crm_config.php | 133 - .../crm_database.class.php | 616 - .../crm_hardlock.class.php | 6914 ---------- .../crm_test.class.php | 608 - .../crm_users.class.php | 1253 -- cadline/backend/maintenance | 1 + cadline/backend/maintenance/.gitignore | 5 - cadline/backend/maintenance/.htaccess | 183 - .../backend/maintenance/MySqlHelper.class.php | 284 - cadline/backend/maintenance/PasswordHash.php | 230 - cadline/backend/maintenance/ProjectStart.html | 201 - .../maintenance/activate_90_days_active.php | 84 - .../backend/maintenance/activate_server.php | 61 - cadline/backend/maintenance/aktivalasikod.php | 17 - cadline/backend/maintenance/al.php | 155 - cadline/backend/maintenance/alprograms.php | 10 - cadline/backend/maintenance/banner.php | 120 - cadline/backend/maintenance/beolvas2.php | 95 - cadline/backend/maintenance/chat_log.html | 1 - .../maintenance/check_main_server_cron.php | 21 - cadline/backend/maintenance/check_server.php | 12 - .../maintenance/class/actcode.class.php | 468 - .../class/codegen.helper.class.php | 79 - .../maintenance/class/crmHelper.class.php | 206 - .../class/hardlock.helper.class.php | 25 - .../class/iptocountry.helper.class.php | 73 - .../class/program.helper.class.php | 51 - .../maintenance/class/selectedprogram.php | 13 - .../maintenance/class/selectprogram.class.php | 92 - cadline/backend/maintenance/clusers.php | 1 - cadline/backend/maintenance/config.course.php | 41 - cadline/backend/maintenance/config.crm.php | 29 - cadline/backend/maintenance/config.db.php | 25 - cadline/backend/maintenance/config.mail.php | 8 - cadline/backend/maintenance/config.php | 91 - cadline/backend/maintenance/config.tce.php | 34 - cadline/backend/maintenance/crash.php | 500 - cadline/backend/maintenance/crashadmin.php | 488 - cadline/backend/maintenance/cron_check.php | 21 - .../backend/maintenance/cron_check_server.php | 64 - .../backend/maintenance/cron_one_minute.php | 790 -- .../backend/maintenance/css/bootstrap.min.css | 8296 ----------- cadline/backend/maintenance/css/style.css | 390 - .../backend/maintenance/css/ticker-style.css | 274 - cadline/backend/maintenance/downloademail.php | 128 - .../backend/maintenance/elofizexcelcheck.php | 26 - cadline/backend/maintenance/elofizkarbxml.php | 113 - cadline/backend/maintenance/elofizurites.php | 7 - cadline/backend/maintenance/email.php | 95 - cadline/backend/maintenance/emailsending.php | 80 - .../maintenance/emergency_server/login.php | 97 - .../emergency_server/server_status.php | 167 - .../maintenance/emergency_server/session.php | 8 - cadline/backend/maintenance/empty_result.xml | 0 cadline/backend/maintenance/encodetest.php | 39 - cadline/backend/maintenance/followedlinks.php | 18 - cadline/backend/maintenance/functions.php | 87 - cadline/backend/maintenance/geopluginlink.php | 20 - .../maintenance/get_joomla_profile.php | 47 - .../backend/maintenance/get_mirror_links.php | 107 - .../maintenance/get_program_details.php | 39 - .../backend/maintenance/get_subscriptions.php | 69 - cadline/backend/maintenance/getd5plugin.php | 5 - cadline/backend/maintenance/getdef.php | 50 - .../maintenance/getserialanddaycode.php | 33 - .../backend/maintenance/google_redirect.php | 64 - cadline/backend/maintenance/handshake.php | 4 - .../maintenance/hibasprograminditasok.php | 145 - cadline/backend/maintenance/index.html | 1 - .../backend/maintenance/installer_link.php | 57 - cadline/backend/maintenance/installer_log.php | 42 - .../backend/maintenance/ipc_sample_test.php | 2 - .../backend/maintenance/js/clipboard.min.js | 7 - cadline/backend/maintenance/js/download2.js | 132 - cadline/backend/maintenance/js/jquery.min.js | 16 - .../backend/maintenance/js/jquery.ticker.js | 427 - .../maintenance/js/jszip/jszip-utils.js | 121 - cadline/backend/maintenance/js/jszip/jszip.js | 11367 ---------------- cadline/backend/maintenance/js/site.js | 34 - .../maintenance/languages/lang.eng.php | 31 - .../maintenance/languages/lang.hun.php | 31 - .../backend/maintenance/leads/BIID_2016.csv | 223 - .../maintenance/leads/Gyarto_lista_05_19.csv | 104 - ..._szamlazz.hu_kimeno_szamlak_2018_Erika.csv | 429 - .../backend/maintenance/leads/RIBA_2016.csv | 98 - cadline/backend/maintenance/leads/kimeno.csv | 251 - .../maintenance/leads/leads-20160918.csv | 59 - .../maintenance/leads/leads-20160919.csv | 54 - .../maintenance/leads/leads-20160920.csv | 58 - .../maintenance/leads/leads-20160921.csv | 39 - .../leads/leads_imported-unicode.txt | Bin 181234 -> 0 bytes .../maintenance/leads/leads_imported-utf8.txt | 1130 -- .../maintenance/leads/leads_imported.csv | 665 - .../backend/maintenance/leads/szamlazz.csv | 127 - .../backend/maintenance/leads_imported.csv | 208 - cadline/backend/maintenance/leiratkozas.php | 91 - .../maintenance/libraries/Excel2/oleread.php | 269 - .../maintenance/libraries/Excel2/reader.php | 1084 -- .../maintenance/libraries/mmail/RFC822.php | 880 -- .../libraries/mmail/htmlMimeMail.php | 1109 -- .../maintenance/libraries/mmail/mimePart.php | 310 - .../maintenance/libraries/mmail/smtp.php | 358 - .../libraries/phpmailer/PHPMailerAutoload.php | 50 - .../libraries/phpmailer/class.phpmailer.php | 3454 ----- .../libraries/phpmailer/class.pop3.php | 398 - .../libraries/phpmailer/class.smtp.php | 965 -- .../libraries/phpmailer/composer.json | 37 - .../phpmailer/extras/EasyPeasyICS.php | 93 - .../libraries/phpmailer/extras/README.md | 21 - .../phpmailer/extras/class.html2text.php | 678 - .../libraries/phpmailer/extras/htmlfilter.php | 901 -- .../phpmailer/extras/ntlm_sasl_client.php | 178 - .../phpmailer/language/phpmailer.lang-hu.php | 26 - .../phpmailer/language/phpmailer.lang-uk.php | 26 - .../backend/maintenance/messages_email.php | 62 - cadline/backend/maintenance/misi.php | 2 - .../backend/maintenance/mobileviewer_jobs.php | 13 - cadline/backend/maintenance/mtips.php | 1 - cadline/backend/maintenance/mycommerce.php | 20 - cadline/backend/maintenance/newclick.php | 144 - cadline/backend/maintenance/nonprofit.php | 109 - cadline/backend/maintenance/piracy.php | 6 - .../pofiles/LiveLanguageResources_eng.json | 4407 ------ .../backend/maintenance/pofiles/createPO.php | 303 - .../backend/maintenance/pro_live_bundle.php | 469 - .../maintenance/public/css/jquery-ui.css | 2014 --- .../public/css/smoothDivScroll.css | 102 - .../backend/maintenance/public/css/style.css | 710 - ...ve_1920_1080px_MEGJELENT_banner_ENG_II.jpg | Bin 396749 -> 0 bytes .../backend/maintenance/public/img/Thumbs.db | Bin 7168 -> 0 bytes .../maintenance/public/img/arrow_left.gif | Bin 1420 -> 0 bytes .../maintenance/public/img/arrow_left.png | Bin 1081 -> 0 bytes .../maintenance/public/img/arrow_right.gif | Bin 1428 -> 0 bytes .../maintenance/public/img/arrow_right.png | Bin 942 -> 0 bytes .../public/img/big_transparent.gif | Bin 964 -> 0 bytes .../public/img/cursors/cursor_arrow_left.cur | Bin 4286 -> 0 bytes .../public/img/cursors/cursor_arrow_left.gif | Bin 83 -> 0 bytes .../public/img/cursors/cursor_arrow_left.png | Bin 215 -> 0 bytes .../public/img/cursors/cursor_arrow_right.cur | Bin 4286 -> 0 bytes .../public/img/cursors/cursor_arrow_right.gif | Bin 85 -> 0 bytes .../public/img/cursors/cursor_arrow_right.png | Bin 194 -> 0 bytes .../backend/maintenance/public/img/logo.png | Bin 3275 -> 0 bytes .../maintenance/public/img/pattern.png | Bin 890 -> 0 bytes .../maintenance/public/img/project.jpg | Bin 6485 -> 0 bytes .../maintenance/public/img/watermark.png | Bin 3238 -> 0 bytes .../maintenance/public/js/8132d19a66.js | 15 - .../public/js/jquery-1.12.4.min.js | 16 - .../public/js/jquery-ui-1.12.1.min.js | 44 - .../maintenance/public/js/jquery.mapael.js | 2781 ---- .../public/js/jquery.mapael.min.js | 2 - .../public/js/jquery.mousewheel.min.js | 8 - .../public/js/jquery.mousewheel_2.min.js | 8 - .../js/jquery.smoothdivscroll-1.3-min.js | 10 - .../maintenance/public/js/maps/README.txt | 3 - .../public/js/maps/france_departments.js | 168 - .../public/js/maps/france_departments.min.js | 5 - .../maintenance/public/js/maps/usa_states.js | 151 - .../public/js/maps/usa_states.min.js | 2 - .../public/js/maps/world_countries.js | 231 - .../public/js/maps/world_countries.min.js | 6 - .../js/maps/world_countries_mercator.js | 285 - .../js/maps/world_countries_mercator.min.js | 4 - .../public/js/maps/world_countries_miller.js | 322 - .../js/maps/world_countries_miller.min.js | 3 - .../maintenance/public/js/raphael.min.js | 24 - .../backend/maintenance/read_server_txt.php | 22 - .../backend/maintenance/redirect_login.php | 43 - cadline/backend/maintenance/regisztracio.php | 42 - .../backend/maintenance/render_ellenorzo.sh | 21 - .../maintenance/startchangedhardlock.php | 55 - cadline/backend/maintenance/supportupload.php | 42 - cadline/backend/maintenance/sw.php | 73 - cadline/backend/maintenance/sw_secondary.php | 96 - cadline/backend/maintenance/sync.php | 49 - .../backend/maintenance/sync_downgrade.php | 160 - cadline/backend/maintenance/sync_download.php | 74 - .../maintenance/sync_emailtopartners.php | 70 - cadline/backend/maintenance/sync_fizetes.php | 158 - cadline/backend/maintenance/sync_history.php | 93 - .../backend/maintenance/sync_honapkepe.php | 94 - .../backend/maintenance/sync_ita_email.php | 111 - .../backend/maintenance/sync_maintenance.php | 35 - .../backend/maintenance/sync_nonprofit.php | 111 - cadline/backend/maintenance/sync_palyazat.php | 35 - .../backend/maintenance/sync_sendemail.php | 133 - cadline/backend/maintenance/sync_states.php | 26 - cadline/backend/maintenance/sync_switch.php | 25 - cadline/backend/maintenance/sync_workshop.php | 156 - cadline/backend/maintenance/szamlazz.php | 86 - cadline/backend/maintenance/test.email.php | 0 cadline/backend/maintenance/test.php | 1788 --- cadline/backend/maintenance/test_API.php | 123 - .../backend/maintenance/tests/get-builds.php | 19 - cadline/backend/maintenance/tests/get_xml.php | 10 - cadline/backend/maintenance/tests/index.php | 72 - .../tests/scripts/jquery-1.11.1.min.js | 4 - .../tests/scripts/jquery.treeview.min.js | 15 - .../maintenance/tests/scripts/scripts.js | 198 - .../maintenance/tests/scripts/uploader.js | 31 - .../backend/maintenance/tests/showTest.php | 35 - .../tests/styles/jquery.treeview.css | 68 - .../maintenance/tests/styles/styles.css | 57 - cadline/backend/maintenance/teszt.php | 112 - cadline/backend/maintenance/tips.php | 549 - cadline/backend/maintenance/tips.php.orig | 544 - cadline/backend/maintenance/tm.php | 139 - cadline/backend/maintenance/tooltip.html | 37 - cadline/backend/maintenance/unsubscribe.php | 57 - cadline/backend/maintenance/update.php | 77 - cadline/backend/maintenance/updatecrm.php | 73 - cadline/backend/maintenance/updateget.php | 50 - cadline/backend/maintenance/updatexml.php | 94 - .../maintenance/upload_crash_statistic.php | 31 - cadline/backend/maintenance/upload_file.php | 177 - .../upload_software_statistics.php | 22 - .../maintenance/upload_test_report.php | 16 - cadline/backend/maintenance/url_redirect.php | 56 - cadline/backend/maintenance/users.php | 60 - cadline/backend/maintenance/version.php | 353 - .../maintenance/viewerlejartaktorlese.php | 99 - .../maintenance/warehousedownloadlink.php | 12 - .../maintenance/warehousegetfileformat.php | 15 - .../maintenance/warehouseparsesource.php | 4 - .../maintenance/webform/ai_render_upload.php | 604 - .../backend/maintenance/webform/al_login.php | 311 - .../maintenance/webform/blank_result.php | 36 - .../webform/cloud_library_upload.php | 272 - .../maintenance/webform/custom_page_test.php | 10 - .../maintenance/webform/error_message.php | 22 - .../webform/exchange_registration.php | 71 - .../maintenance/webform/floating_licence.php | 228 - .../maintenance/webform/get_protocol.php | 44 - .../maintenance/webform/get_result.php | 29 - .../maintenance/webform/get_serial.php | 292 - .../backend/maintenance/webform/get_trial.php | 195 - .../maintenance/webform/get_user_params.php | 67 - cadline/backend/maintenance/webform/hello.php | 131 - .../backend/maintenance/webform/hl_pin.php | 182 - .../images/image_2021_02_18T07_34_03_039Z.png | Bin 23275 -> 0 bytes .../maintenance/webform/images/logo_eng.png | Bin 2157 -> 0 bytes .../maintenance/webform/images/logo_hun.png | Bin 1601 -> 0 bytes .../maintenance/webform/installers.php | 49 - .../webform/ita_selectprogramdialog_test.php | 49 - .../maintenance/webform/languages/eng.php | 60 - .../maintenance/webform/languages/esp.php | 53 - .../maintenance/webform/languages/hun.php | 60 - cadline/backend/maintenance/webform/login.php | 145 - .../maintenance/webform/loginresult.php | 71 - .../webform/mobileviewer_create.php | 232 - .../backend/maintenance/webform/nonprofit.php | 18 - .../backend/maintenance/webform/progress.php | 1368 -- .../webform/public/css/airender.css | 230 - .../public/css/bootstrap-datepicker.min.css | 531 - .../maintenance/webform/public/css/style.css | 146 - .../public/js/bootstrap-datepicker.hu.min.js | 1 - .../public/js/bootstrap-datepicker.min.js | 12 - .../maintenance/webform/public/js/main.js | 90 - .../maintenance/webform/regsuccess.php | 79 - .../backend/maintenance/webform/result.php | 100 - .../backend/maintenance/webform/sample.php | 38 - .../maintenance/webform/select_dealer.php | 52 - .../webform/selectprogramdialog.php | 322 - .../maintenance/webform/startQuery.php | 121 - .../maintenance/webform/test_result.php | 19 - .../zendesk/get_zendesk_articles.php | 27 - .../maintenance/zendesk/update_crc.php | 42 - .../backend/maintenance/zendesk/zendesk.php | 251 - .../common_cadline_libraries/constants.php | 10 + 274 files changed, 35 insertions(+), 77194 deletions(-) create mode 100644 .gitmodules create mode 160000 cadline/backend/common_cadline_libraries delete mode 100644 cadline/backend/common_cadline_libraries/.gitignore delete mode 100644 cadline/backend/common_cadline_libraries/POfile.php delete mode 100644 cadline/backend/common_cadline_libraries/crm_config.db.php delete mode 100644 cadline/backend/common_cadline_libraries/crm_config.php delete mode 100644 cadline/backend/common_cadline_libraries/crm_database.class.php delete mode 100644 cadline/backend/common_cadline_libraries/crm_hardlock.class.php delete mode 100644 cadline/backend/common_cadline_libraries/crm_test.class.php delete mode 100644 cadline/backend/common_cadline_libraries/crm_users.class.php create mode 160000 cadline/backend/maintenance delete mode 100644 cadline/backend/maintenance/.gitignore delete mode 100644 cadline/backend/maintenance/.htaccess delete mode 100644 cadline/backend/maintenance/MySqlHelper.class.php delete mode 100644 cadline/backend/maintenance/PasswordHash.php delete mode 100644 cadline/backend/maintenance/ProjectStart.html delete mode 100644 cadline/backend/maintenance/activate_90_days_active.php delete mode 100644 cadline/backend/maintenance/activate_server.php delete mode 100644 cadline/backend/maintenance/aktivalasikod.php delete mode 100644 cadline/backend/maintenance/al.php delete mode 100644 cadline/backend/maintenance/alprograms.php delete mode 100644 cadline/backend/maintenance/banner.php delete mode 100644 cadline/backend/maintenance/beolvas2.php delete mode 100644 cadline/backend/maintenance/chat_log.html delete mode 100644 cadline/backend/maintenance/check_main_server_cron.php delete mode 100644 cadline/backend/maintenance/check_server.php delete mode 100644 cadline/backend/maintenance/class/actcode.class.php delete mode 100644 cadline/backend/maintenance/class/codegen.helper.class.php delete mode 100644 cadline/backend/maintenance/class/crmHelper.class.php delete mode 100644 cadline/backend/maintenance/class/hardlock.helper.class.php delete mode 100644 cadline/backend/maintenance/class/iptocountry.helper.class.php delete mode 100644 cadline/backend/maintenance/class/program.helper.class.php delete mode 100644 cadline/backend/maintenance/class/selectedprogram.php delete mode 100644 cadline/backend/maintenance/class/selectprogram.class.php delete mode 100644 cadline/backend/maintenance/clusers.php delete mode 100644 cadline/backend/maintenance/config.course.php delete mode 100644 cadline/backend/maintenance/config.crm.php delete mode 100644 cadline/backend/maintenance/config.db.php delete mode 100644 cadline/backend/maintenance/config.mail.php delete mode 100644 cadline/backend/maintenance/config.php delete mode 100644 cadline/backend/maintenance/config.tce.php delete mode 100644 cadline/backend/maintenance/crash.php delete mode 100644 cadline/backend/maintenance/crashadmin.php delete mode 100644 cadline/backend/maintenance/cron_check.php delete mode 100644 cadline/backend/maintenance/cron_check_server.php delete mode 100644 cadline/backend/maintenance/cron_one_minute.php delete mode 100644 cadline/backend/maintenance/css/bootstrap.min.css delete mode 100644 cadline/backend/maintenance/css/style.css delete mode 100644 cadline/backend/maintenance/css/ticker-style.css delete mode 100644 cadline/backend/maintenance/downloademail.php delete mode 100644 cadline/backend/maintenance/elofizexcelcheck.php delete mode 100644 cadline/backend/maintenance/elofizkarbxml.php delete mode 100644 cadline/backend/maintenance/elofizurites.php delete mode 100644 cadline/backend/maintenance/email.php delete mode 100644 cadline/backend/maintenance/emailsending.php delete mode 100644 cadline/backend/maintenance/emergency_server/login.php delete mode 100644 cadline/backend/maintenance/emergency_server/server_status.php delete mode 100644 cadline/backend/maintenance/emergency_server/session.php delete mode 100644 cadline/backend/maintenance/empty_result.xml delete mode 100644 cadline/backend/maintenance/encodetest.php delete mode 100644 cadline/backend/maintenance/followedlinks.php delete mode 100644 cadline/backend/maintenance/functions.php delete mode 100644 cadline/backend/maintenance/geopluginlink.php delete mode 100644 cadline/backend/maintenance/get_joomla_profile.php delete mode 100644 cadline/backend/maintenance/get_mirror_links.php delete mode 100644 cadline/backend/maintenance/get_program_details.php delete mode 100644 cadline/backend/maintenance/get_subscriptions.php delete mode 100644 cadline/backend/maintenance/getd5plugin.php delete mode 100644 cadline/backend/maintenance/getdef.php delete mode 100644 cadline/backend/maintenance/getserialanddaycode.php delete mode 100644 cadline/backend/maintenance/google_redirect.php delete mode 100644 cadline/backend/maintenance/handshake.php delete mode 100644 cadline/backend/maintenance/hibasprograminditasok.php delete mode 100644 cadline/backend/maintenance/index.html delete mode 100644 cadline/backend/maintenance/installer_link.php delete mode 100644 cadline/backend/maintenance/installer_log.php delete mode 100644 cadline/backend/maintenance/ipc_sample_test.php delete mode 100644 cadline/backend/maintenance/js/clipboard.min.js delete mode 100644 cadline/backend/maintenance/js/download2.js delete mode 100644 cadline/backend/maintenance/js/jquery.min.js delete mode 100644 cadline/backend/maintenance/js/jquery.ticker.js delete mode 100644 cadline/backend/maintenance/js/jszip/jszip-utils.js delete mode 100644 cadline/backend/maintenance/js/jszip/jszip.js delete mode 100644 cadline/backend/maintenance/js/site.js delete mode 100644 cadline/backend/maintenance/languages/lang.eng.php delete mode 100644 cadline/backend/maintenance/languages/lang.hun.php delete mode 100644 cadline/backend/maintenance/leads/BIID_2016.csv delete mode 100644 cadline/backend/maintenance/leads/Gyarto_lista_05_19.csv delete mode 100644 cadline/backend/maintenance/leads/Letoltott_szamlazz.hu_kimeno_szamlak_2018_Erika.csv delete mode 100644 cadline/backend/maintenance/leads/RIBA_2016.csv delete mode 100644 cadline/backend/maintenance/leads/kimeno.csv delete mode 100644 cadline/backend/maintenance/leads/leads-20160918.csv delete mode 100644 cadline/backend/maintenance/leads/leads-20160919.csv delete mode 100644 cadline/backend/maintenance/leads/leads-20160920.csv delete mode 100644 cadline/backend/maintenance/leads/leads-20160921.csv delete mode 100644 cadline/backend/maintenance/leads/leads_imported-unicode.txt delete mode 100644 cadline/backend/maintenance/leads/leads_imported-utf8.txt delete mode 100644 cadline/backend/maintenance/leads/leads_imported.csv delete mode 100644 cadline/backend/maintenance/leads/szamlazz.csv delete mode 100644 cadline/backend/maintenance/leads_imported.csv delete mode 100644 cadline/backend/maintenance/leiratkozas.php delete mode 100644 cadline/backend/maintenance/libraries/Excel2/oleread.php delete mode 100644 cadline/backend/maintenance/libraries/Excel2/reader.php delete mode 100644 cadline/backend/maintenance/libraries/mmail/RFC822.php delete mode 100644 cadline/backend/maintenance/libraries/mmail/htmlMimeMail.php delete mode 100644 cadline/backend/maintenance/libraries/mmail/mimePart.php delete mode 100644 cadline/backend/maintenance/libraries/mmail/smtp.php delete mode 100644 cadline/backend/maintenance/libraries/phpmailer/PHPMailerAutoload.php delete mode 100644 cadline/backend/maintenance/libraries/phpmailer/class.phpmailer.php delete mode 100644 cadline/backend/maintenance/libraries/phpmailer/class.pop3.php delete mode 100644 cadline/backend/maintenance/libraries/phpmailer/class.smtp.php delete mode 100644 cadline/backend/maintenance/libraries/phpmailer/composer.json delete mode 100644 cadline/backend/maintenance/libraries/phpmailer/extras/EasyPeasyICS.php delete mode 100644 cadline/backend/maintenance/libraries/phpmailer/extras/README.md delete mode 100644 cadline/backend/maintenance/libraries/phpmailer/extras/class.html2text.php delete mode 100644 cadline/backend/maintenance/libraries/phpmailer/extras/htmlfilter.php delete mode 100644 cadline/backend/maintenance/libraries/phpmailer/extras/ntlm_sasl_client.php delete mode 100644 cadline/backend/maintenance/libraries/phpmailer/language/phpmailer.lang-hu.php delete mode 100644 cadline/backend/maintenance/libraries/phpmailer/language/phpmailer.lang-uk.php delete mode 100644 cadline/backend/maintenance/messages_email.php delete mode 100644 cadline/backend/maintenance/misi.php delete mode 100644 cadline/backend/maintenance/mobileviewer_jobs.php delete mode 100644 cadline/backend/maintenance/mtips.php delete mode 100644 cadline/backend/maintenance/mycommerce.php delete mode 100644 cadline/backend/maintenance/newclick.php delete mode 100644 cadline/backend/maintenance/nonprofit.php delete mode 100644 cadline/backend/maintenance/piracy.php delete mode 100644 cadline/backend/maintenance/pofiles/LiveLanguageResources_eng.json delete mode 100644 cadline/backend/maintenance/pofiles/createPO.php delete mode 100644 cadline/backend/maintenance/pro_live_bundle.php delete mode 100644 cadline/backend/maintenance/public/css/jquery-ui.css delete mode 100644 cadline/backend/maintenance/public/css/smoothDivScroll.css delete mode 100644 cadline/backend/maintenance/public/css/style.css delete mode 100644 cadline/backend/maintenance/public/img/ARCHLineXP_2022_Live_1920_1080px_MEGJELENT_banner_ENG_II.jpg delete mode 100644 cadline/backend/maintenance/public/img/Thumbs.db delete mode 100644 cadline/backend/maintenance/public/img/arrow_left.gif delete mode 100644 cadline/backend/maintenance/public/img/arrow_left.png delete mode 100644 cadline/backend/maintenance/public/img/arrow_right.gif delete mode 100644 cadline/backend/maintenance/public/img/arrow_right.png delete mode 100644 cadline/backend/maintenance/public/img/big_transparent.gif delete mode 100644 cadline/backend/maintenance/public/img/cursors/cursor_arrow_left.cur delete mode 100644 cadline/backend/maintenance/public/img/cursors/cursor_arrow_left.gif delete mode 100644 cadline/backend/maintenance/public/img/cursors/cursor_arrow_left.png delete mode 100644 cadline/backend/maintenance/public/img/cursors/cursor_arrow_right.cur delete mode 100644 cadline/backend/maintenance/public/img/cursors/cursor_arrow_right.gif delete mode 100644 cadline/backend/maintenance/public/img/cursors/cursor_arrow_right.png delete mode 100644 cadline/backend/maintenance/public/img/logo.png delete mode 100644 cadline/backend/maintenance/public/img/pattern.png delete mode 100644 cadline/backend/maintenance/public/img/project.jpg delete mode 100644 cadline/backend/maintenance/public/img/watermark.png delete mode 100644 cadline/backend/maintenance/public/js/8132d19a66.js delete mode 100644 cadline/backend/maintenance/public/js/jquery-1.12.4.min.js delete mode 100644 cadline/backend/maintenance/public/js/jquery-ui-1.12.1.min.js delete mode 100644 cadline/backend/maintenance/public/js/jquery.mapael.js delete mode 100644 cadline/backend/maintenance/public/js/jquery.mapael.min.js delete mode 100644 cadline/backend/maintenance/public/js/jquery.mousewheel.min.js delete mode 100644 cadline/backend/maintenance/public/js/jquery.mousewheel_2.min.js delete mode 100644 cadline/backend/maintenance/public/js/jquery.smoothdivscroll-1.3-min.js delete mode 100644 cadline/backend/maintenance/public/js/maps/README.txt delete mode 100644 cadline/backend/maintenance/public/js/maps/france_departments.js delete mode 100644 cadline/backend/maintenance/public/js/maps/france_departments.min.js delete mode 100644 cadline/backend/maintenance/public/js/maps/usa_states.js delete mode 100644 cadline/backend/maintenance/public/js/maps/usa_states.min.js delete mode 100644 cadline/backend/maintenance/public/js/maps/world_countries.js delete mode 100644 cadline/backend/maintenance/public/js/maps/world_countries.min.js delete mode 100644 cadline/backend/maintenance/public/js/maps/world_countries_mercator.js delete mode 100644 cadline/backend/maintenance/public/js/maps/world_countries_mercator.min.js delete mode 100644 cadline/backend/maintenance/public/js/maps/world_countries_miller.js delete mode 100644 cadline/backend/maintenance/public/js/maps/world_countries_miller.min.js delete mode 100644 cadline/backend/maintenance/public/js/raphael.min.js delete mode 100644 cadline/backend/maintenance/read_server_txt.php delete mode 100644 cadline/backend/maintenance/redirect_login.php delete mode 100644 cadline/backend/maintenance/regisztracio.php delete mode 100644 cadline/backend/maintenance/render_ellenorzo.sh delete mode 100644 cadline/backend/maintenance/startchangedhardlock.php delete mode 100644 cadline/backend/maintenance/supportupload.php delete mode 100644 cadline/backend/maintenance/sw.php delete mode 100644 cadline/backend/maintenance/sw_secondary.php delete mode 100644 cadline/backend/maintenance/sync.php delete mode 100644 cadline/backend/maintenance/sync_downgrade.php delete mode 100644 cadline/backend/maintenance/sync_download.php delete mode 100644 cadline/backend/maintenance/sync_emailtopartners.php delete mode 100644 cadline/backend/maintenance/sync_fizetes.php delete mode 100644 cadline/backend/maintenance/sync_history.php delete mode 100644 cadline/backend/maintenance/sync_honapkepe.php delete mode 100644 cadline/backend/maintenance/sync_ita_email.php delete mode 100644 cadline/backend/maintenance/sync_maintenance.php delete mode 100644 cadline/backend/maintenance/sync_nonprofit.php delete mode 100644 cadline/backend/maintenance/sync_palyazat.php delete mode 100644 cadline/backend/maintenance/sync_sendemail.php delete mode 100644 cadline/backend/maintenance/sync_states.php delete mode 100644 cadline/backend/maintenance/sync_switch.php delete mode 100644 cadline/backend/maintenance/sync_workshop.php delete mode 100644 cadline/backend/maintenance/szamlazz.php delete mode 100644 cadline/backend/maintenance/test.email.php delete mode 100644 cadline/backend/maintenance/test.php delete mode 100644 cadline/backend/maintenance/test_API.php delete mode 100644 cadline/backend/maintenance/tests/get-builds.php delete mode 100644 cadline/backend/maintenance/tests/get_xml.php delete mode 100644 cadline/backend/maintenance/tests/index.php delete mode 100644 cadline/backend/maintenance/tests/scripts/jquery-1.11.1.min.js delete mode 100644 cadline/backend/maintenance/tests/scripts/jquery.treeview.min.js delete mode 100644 cadline/backend/maintenance/tests/scripts/scripts.js delete mode 100644 cadline/backend/maintenance/tests/scripts/uploader.js delete mode 100644 cadline/backend/maintenance/tests/showTest.php delete mode 100644 cadline/backend/maintenance/tests/styles/jquery.treeview.css delete mode 100644 cadline/backend/maintenance/tests/styles/styles.css delete mode 100644 cadline/backend/maintenance/teszt.php delete mode 100644 cadline/backend/maintenance/tips.php delete mode 100644 cadline/backend/maintenance/tips.php.orig delete mode 100644 cadline/backend/maintenance/tm.php delete mode 100644 cadline/backend/maintenance/tooltip.html delete mode 100644 cadline/backend/maintenance/unsubscribe.php delete mode 100644 cadline/backend/maintenance/update.php delete mode 100644 cadline/backend/maintenance/updatecrm.php delete mode 100644 cadline/backend/maintenance/updateget.php delete mode 100644 cadline/backend/maintenance/updatexml.php delete mode 100644 cadline/backend/maintenance/upload_crash_statistic.php delete mode 100644 cadline/backend/maintenance/upload_file.php delete mode 100644 cadline/backend/maintenance/upload_software_statistics.php delete mode 100644 cadline/backend/maintenance/upload_test_report.php delete mode 100644 cadline/backend/maintenance/url_redirect.php delete mode 100644 cadline/backend/maintenance/users.php delete mode 100644 cadline/backend/maintenance/version.php delete mode 100644 cadline/backend/maintenance/viewerlejartaktorlese.php delete mode 100644 cadline/backend/maintenance/warehousedownloadlink.php delete mode 100644 cadline/backend/maintenance/warehousegetfileformat.php delete mode 100644 cadline/backend/maintenance/warehouseparsesource.php delete mode 100644 cadline/backend/maintenance/webform/ai_render_upload.php delete mode 100644 cadline/backend/maintenance/webform/al_login.php delete mode 100644 cadline/backend/maintenance/webform/blank_result.php delete mode 100644 cadline/backend/maintenance/webform/cloud_library_upload.php delete mode 100644 cadline/backend/maintenance/webform/custom_page_test.php delete mode 100644 cadline/backend/maintenance/webform/error_message.php delete mode 100644 cadline/backend/maintenance/webform/exchange_registration.php delete mode 100644 cadline/backend/maintenance/webform/floating_licence.php delete mode 100644 cadline/backend/maintenance/webform/get_protocol.php delete mode 100644 cadline/backend/maintenance/webform/get_result.php delete mode 100644 cadline/backend/maintenance/webform/get_serial.php delete mode 100644 cadline/backend/maintenance/webform/get_trial.php delete mode 100644 cadline/backend/maintenance/webform/get_user_params.php delete mode 100644 cadline/backend/maintenance/webform/hello.php delete mode 100644 cadline/backend/maintenance/webform/hl_pin.php delete mode 100644 cadline/backend/maintenance/webform/images/image_2021_02_18T07_34_03_039Z.png delete mode 100644 cadline/backend/maintenance/webform/images/logo_eng.png delete mode 100644 cadline/backend/maintenance/webform/images/logo_hun.png delete mode 100644 cadline/backend/maintenance/webform/installers.php delete mode 100644 cadline/backend/maintenance/webform/ita_selectprogramdialog_test.php delete mode 100644 cadline/backend/maintenance/webform/languages/eng.php delete mode 100644 cadline/backend/maintenance/webform/languages/esp.php delete mode 100644 cadline/backend/maintenance/webform/languages/hun.php delete mode 100644 cadline/backend/maintenance/webform/login.php delete mode 100644 cadline/backend/maintenance/webform/loginresult.php delete mode 100644 cadline/backend/maintenance/webform/mobileviewer_create.php delete mode 100644 cadline/backend/maintenance/webform/nonprofit.php delete mode 100644 cadline/backend/maintenance/webform/progress.php delete mode 100644 cadline/backend/maintenance/webform/public/css/airender.css delete mode 100644 cadline/backend/maintenance/webform/public/css/bootstrap-datepicker.min.css delete mode 100644 cadline/backend/maintenance/webform/public/css/style.css delete mode 100644 cadline/backend/maintenance/webform/public/js/bootstrap-datepicker.hu.min.js delete mode 100644 cadline/backend/maintenance/webform/public/js/bootstrap-datepicker.min.js delete mode 100644 cadline/backend/maintenance/webform/public/js/main.js delete mode 100644 cadline/backend/maintenance/webform/regsuccess.php delete mode 100644 cadline/backend/maintenance/webform/result.php delete mode 100644 cadline/backend/maintenance/webform/sample.php delete mode 100644 cadline/backend/maintenance/webform/select_dealer.php delete mode 100644 cadline/backend/maintenance/webform/selectprogramdialog.php delete mode 100644 cadline/backend/maintenance/webform/startQuery.php delete mode 100644 cadline/backend/maintenance/webform/test_result.php delete mode 100644 cadline/backend/maintenance/zendesk/get_zendesk_articles.php delete mode 100644 cadline/backend/maintenance/zendesk/update_crc.php delete mode 100644 cadline/backend/maintenance/zendesk/zendesk.php create mode 100644 overrides/common_cadline_libraries/constants.php diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..a2dbf441 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "cadline/backend/common_cadline_libraries"] + path = cadline/backend/common_cadline_libraries + url = ssh://git@git.cadline.hu:22222/cadline_web/cadcommonlib.git +[submodule "cadline/backend/maintenance"] + path = cadline/backend/maintenance + url = ssh://git@git.cadline.hu:22222/cadline_web/maintenance.git diff --git a/build-baseline.sh b/build-baseline.sh index 74cc2f1c..2eee9a1e 100755 --- a/build-baseline.sh +++ b/build-baseline.sh @@ -18,6 +18,11 @@ log(){ printf '[build] %s\n' "$*"; } rm -rf "$OUT"; mkdir -p "$OUT" +# Ensure the developer-controlled submodules are populated (cadcommonlib, maintenance). +git -C "$ROOT" submodule update --init \ + cadline/backend/common_cadline_libraries cadline/backend/maintenance >/dev/null 2>&1 || \ + log "WARN: submodule update failed — common_cadline_libraries/maintenance may be empty" + # 1) Joomla core — official 3.8.11 package (deployed form), minus demo assets and # runtime data dirs (cache/tmp/logs/images are data, not verified code). log "core: Joomla 3.8.11 (official package)" @@ -51,7 +56,7 @@ done for d in "$ROOT"/cadline/*/; do [ -d "$d" ] || continue log "cadline: $(basename "$d")" - rsync -a --exclude='.provenance' "$d" "$OUT/" + rsync -a --exclude='.provenance' --exclude='.git' "$d" "$OUT/" done # 5) Cadline core modifications — live versions overlaid on the package core @@ -61,6 +66,17 @@ if [ -d "$ROOT/overrides" ]; then rsync -a --exclude='.gitkeep' "$ROOT/overrides/" "$OUT/" fi +# 5b) Deploy transform for the submodule-sourced dirs: the developer repos +# (cadcommonlib, maintenance) store CRLF line-endings; the deployed live form +# is LF. Normalize the text files to LF so the baseline byte-matches deployment. +log "normalize: line-endings (common_cadline_libraries, maintenance) -> LF" +for dir in "$OUT/common_cadline_libraries" "$OUT/maintenance"; do + [ -d "$dir" ] || continue + find "$dir" -type f 2>/dev/null | while IFS= read -r f; do + grep -Iq . "$f" 2>/dev/null && sed -i 's/\r$//' "$f" + done +done + # 6) Safety net — malware IOC + scan artifacts must never appear in the baseline # (the sources above already exclude them; this is defensive, documented in # malware-iocs.md / malware-iocs.paths). diff --git a/cadline/backend/common_cadline_libraries b/cadline/backend/common_cadline_libraries new file mode 160000 index 00000000..423fec9b --- /dev/null +++ b/cadline/backend/common_cadline_libraries @@ -0,0 +1 @@ +Subproject commit 423fec9b929b381339d71623fc621a998a6e3e0f diff --git a/cadline/backend/common_cadline_libraries/.gitignore b/cadline/backend/common_cadline_libraries/.gitignore deleted file mode 100644 index 8169015c..00000000 --- a/cadline/backend/common_cadline_libraries/.gitignore +++ /dev/null @@ -1 +0,0 @@ -constants.php \ No newline at end of file diff --git a/cadline/backend/common_cadline_libraries/POfile.php b/cadline/backend/common_cadline_libraries/POfile.php deleted file mode 100644 index b718fd41..00000000 --- a/cadline/backend/common_cadline_libraries/POfile.php +++ /dev/null @@ -1,100 +0,0 @@ -stream = $header; - } - - function getStream() - { - return $this->stream; - } - - function addComment($param, $value) - { - $this->stream .= '#. ' . $param . ': ' . str_replace("\r\n", ' ', $value) . PHP_EOL; - } - - function addMsgctxt($msgctxt) - { - if (strpos($msgctxt, "
") !== false || strpos($msgctxt, "\r\n") !== false) { - $msgctxt = strpos($msgctxt, "\r\n") !== false ? explode("\r\n", $msgctxt) : explode("
", $msgctxt); - - $this->stream .= 'msgctxt ""' . PHP_EOL; - for ($i = 0; $i < count($msgctxt); $i++) { - $msgctxt[$i] = strpos($msgctxt[$i], "\r\n") !== false ? $msgctxt[$i] : preg_replace("/\r|\n/", "", $msgctxt[$i]); - - if ($i == 0) { - $this->stream .= '",' . $msgctxt[$i] . '\\n"'; - } else { - if ($i == count($msgctxt) - 1) - $this->stream .= '"' . $msgctxt[$i] . '"'; - else - $this->stream .= '"' . $msgctxt[$i] . '\\n"'; - } - - $this->stream .= PHP_EOL; - } - } else { - $this->stream .= 'msgctxt ' . '",' . $msgctxt . '"' . PHP_EOL; - } - } - - function addMsgID($msgID) - { - if (strpos($msgID, "
") !== false || strpos($msgID, "\r\n") !== false) { - $msgID = strpos($msgID, "\r\n") !== false ? explode("\r\n", $msgID) : explode("
", $msgID); - - $this->stream .= 'msgid ""' . PHP_EOL; - for ($i = 0; $i < count($msgID); $i++) { - $msgID[$i] = strpos($msgID[$i], "\r\n") !== false ? $msgID[$i] : preg_replace("/\r|\n/", "", $msgID[$i]); - - if ($i == count($msgID) - 1) - $this->stream .= '"' . $msgID[$i] . '"'; - else - $this->stream .= '"' . $msgID[$i] . '\\n"'; - - $this->stream .= PHP_EOL; - } - } else { - $this->stream .= 'msgid ' . '"' . $msgID . '"' . PHP_EOL; - } - } - - function addMsgSTR($msgStr) - { - if (strpos($msgStr, "
") !== false) { - $msgStr = explode("
", $msgStr); - - $this->stream .= 'msgstr ""' . PHP_EOL; - for ($i = 0; $i < count($msgStr); $i++) { - $msgStr[$i] = preg_replace("/\r|\n/", "", $msgStr[$i]); - - if ($i == count($msgStr) - 1) - $this->stream .= '"' . $msgStr[$i] . '"'; - else - $this->stream .= '"' . $msgStr[$i] . '\\n"'; - - $this->stream .= PHP_EOL; - } - - $this->stream .= PHP_EOL; - } else { - $this->stream .= 'msgstr ' . '"' . $msgStr . '"' . PHP_EOL . PHP_EOL; - } - } -} diff --git a/cadline/backend/common_cadline_libraries/crm_config.db.php b/cadline/backend/common_cadline_libraries/crm_config.db.php deleted file mode 100644 index eb6b9040..00000000 --- a/cadline/backend/common_cadline_libraries/crm_config.db.php +++ /dev/null @@ -1,24 +0,0 @@ -connection = false; - $this->host = ''; - $this->user = ''; - $this->pass = ''; - $this->name = ''; - $this->writelog = false; - } - - public static function getInstance() - { - if (!empty(self::$msh)) { - return self::$msh; - } - - self::$msh = new crm_database(); - self::$msh->init(); - - return self::$msh; - } - - public static function escapeString($str = "") - { - $ret = mysqli_real_escape_string($this->connection, $str); - return $ret; - } - - public function init($host = _DB_HOST, $name = _DB_NAME, $user = _DB_USER, $pass = _DB_PASS) - { - $this->host = $host; - $this->name = $name; - $this->user = $user; - $this->pass = $pass; - } - - private function connect() - { - if ($this->connection) { - return; - } - - $this->connection = mysqli_connect($this->host, $this->user, $this->pass); - - if (false === $this->connection) { - throw new Exception('Can\'t connect to db'); - } - - mysqli_select_db($this->connection, $this->name); - mysqli_query($this->connection, 'SET CHARACTER SET UTF8'); - mysqli_query($this->connection, 'SET NAMES \'UTF8\' '); - mysqli_set_charset($this->connection, 'utf8'); - - if (mysqli_error($this->connection)) { - throw new Exception(mysqli_error($this->connection)); - } - } - - public function getQueryString() - { - return $this->queryString; - } - - public function query($query, $getID = false) - { - $this->connect(); - $this->AddSemicolonToQueryString($query); - $this->queryString = $query; - - if ($this->is_write_type($query) === true) { - $boolWrite = true; - $arrSkip = array('h_aktivalas_infok', 'h_history', 'u_history', 'u_userstatus_history', 'cl_hlusers.userstats2013', 'cl_hlusers.switch', 'cl_hlusers.writelog'); - - foreach ($arrSkip as $tabla) { - if (strpos($query, $tabla)) { - $boolWrite = false; - break; - } - } - - if ($boolWrite) { - mysqli_query($this->connection, "INSERT INTO `cl_hlusers`.`writelog` (`user`,`datum`,`ip`,`url`,`func`,`sql`) VALUES ( - '" . (isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'www.archlinexp.com') . "', - '" . date("Y-m-d H:i:s", time()) . "', - '" . (isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '127.0.0.1') . "', - '" . (isset($_SERVER['SERVER_NAME']) ? addslashes($_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']) : '') . "', - '" . addslashes("function: " . __FUNCTION__ . " method: " . __METHOD__) . "','" . addslashes($query) . "');"); - } - } - - $this->queryResult = mysqli_query($this->connection, $query); - if (mysqli_error($this->connection)) { - throw new Exception(mysqli_error($this->connection) . ' Query: ' . $query); - } - - if ($getID) return $this->getInsertedId(); - } - - public function AddSemicolonToQueryString(&$query) - { - $query = rtrim($query); - - if (substr($query, -1) != ';') { - $query = $query . ";"; - } - } - - public function fetchNext() - { - $back = array(); - if ($row = mysqli_fetch_assoc($this->queryResult)) { - foreach ($row as $key => $value) { - $row[$key] = stripslashes($value); - } - $back = $row; - return $back; - } - - return false; - } - - public function fetchAssoc() - { - $back = array(); - while ($row = mysqli_fetch_assoc($this->queryResult)) { - foreach ($row as $key => $value) { - $row[$key] = stripslashes($value); - } - $back[] = $row; - } - - return $back; - } - - public function getInsertedId() - { - return mysqli_insert_id($this->connection); - } - - public function select($table, $where = false, $offset = false, $limit = false, $order = false) - { - $whereStr = ''; - $limitStr = ''; - $orderStr = ''; - - if (is_array($where)) { - $whereStr = 'WHERE ' . $this->whereMakerPriv($where); - } elseif ($where) { - $whereStr = 'WHERE ' . $where; - } - - if (($offset !== false and $offset !== null) && ($limit !== false and $limit !== null)) { - $limitStr = 'LIMIT ' . $offset . ', ' . $limit; - } - - if (is_array($order)) { - $orderStr = 'ORDER BY '; - foreach ($order as $key => $value) { - $orderStr .= $key . ' ' . $value . ' '; - } - } elseif ($order) { - $orderStr = 'ORDER BY ' . $order; - } - - return $this->query('SELECT * FROM ' . $table . ' ' . $whereStr . ' ' . $orderStr . ' ' . $limitStr . ';'); - } - - public function getProp($table, $func, $field, $where = false) - { - $whereStr = ''; - if (is_array($where)) { - $whereStr = 'WHERE ' . $this->whereMakerPriv($where); - } elseif ($where) { - $whereStr = 'WHERE ' . $where; - } - - $this->query('SELECT ' . $func . '(' . $field . ') as p FROM ' . $table . ' ' . $whereStr . ';'); - - $arr = $this->fetchAssoc(); - - return $arr[0]['p']; - } - - public function getCount($table, $field = 'id', $where = false) - { - return $this->getProp($table, 'COUNT', $field, $where); - } - - public function getSum($table, $field = 'id', $where = false) - { - return $this->getProp($table, 'SUM', $field, $where); - } - - public function getAvg($table, $field = 'id', $where = false) - { - return $this->getProp($table, 'AVG', $field, $where); - } - - public function delete($table, $where = false) - { - $whereStr = ''; - if (is_array($where)) { - $whereStr = 'WHERE ' . $this->whereMakerPriv($where); - } elseif ($where) { - $whereStr = 'WHERE ' . $where; - } - - return $this->query('DELETE FROM ' . $table . ' ' . $whereStr . ';'); - } - - public function update($table, $infoArr, $where = false) - { - if (!is_array($infoArr)) { - return false; - } - - $whereStr = ''; - $dataArr = array(); - $data = ''; - if (is_array($where)) { - $whereStr = 'WHERE ' . $this->whereMakerPriv($where); - } elseif ($where) { - $whereStr = 'WHERE ' . $where; - } - - foreach ($infoArr as $key => $value) { - $dataArr[] = '`' . $key . '`="' . mysqli_real_escape_string($this->connection, $value) . '" '; - } - $data = implode(',', $dataArr); - - return $this->query('UPDATE ' . $table . ' SET ' . $data . ' ' . $whereStr . ';'); - } - - public function insert($table, $infoArr) - { - $this->connect(); - $columArr = array(); - $valueArr = array(); - $colums = ''; - $values = ''; - - foreach ($infoArr as $key => $value) { - $columArr[] = '`' . $key . '`'; - $valueArr[] = '"' . mysqli_real_escape_string($this->connection, $value) . '"'; - } - - $colums = implode(',', $columArr); - $values = implode(',', $valueArr); - - return $this->query('INSERT INTO ' . $table . ' (' . $colums . ') VALUES (' . $values . ');', true); - } - - public function affectedRows() - { - return mysqli_affected_rows($this->connection); - } - - public function whereMakerPriv($where) - { - if (!is_array($where)) { - return 1; - } - $this->connect(); - $back = '1 '; - foreach ($where as $key => $value) { - if (is_array($value)) { - $back .= 'AND `' . $key . '`' . $value[0] . '"' . $value[1] . '" '; - } else { - $back .= 'AND `' . $key . '`="' . mysqli_real_escape_string($this->connection, $value) . '" '; - } - } - return $back; - } - - public static function whereMaker($where) - { - if (!is_array($where)) { - return 1; - } - $back = '1 '; - foreach ($where as $key => $value) { - if (is_array($value)) { - $back .= 'AND `' . $key . '`' . $value[0] . '"' . $value[1] . '" '; - } else { - $back .= 'AND `' . $key . '`="' . $value . '" '; - } - } - return $back; - } - - public function is_write_type($sql) - { - if (!preg_match('/^\s*"?(SET|INSERT|UPDATE|DELETE|REPLACE|CREATE|DROP|TRUNCATE|LOAD DATA|COPY|ALTER|GRANT|REVOKE|LOCK|UNLOCK)\s+/i', $sql)) { - return false; - } - - return true; - } - - public function getConnection() - { - return ($this->connection); - } - - public function setConnect() - { - $this->connect(); - } -} - -class Database -{ - private $host = _DB_HOST; - private $username = _DB_USER; - private $password = _DB_PASS; - - private $queryResult; - private $queryString; - - private static $msh; - protected $connection; - - private static $arrSkip = array( - "cl_hlusers.h_aktivalas_infok", - "cl_hlusers.h_history", - "cl_hlusers.u_history", - "cl_hlusers.u_userstatus_history", - "cl_hlusers.userstats2013", - "cl_hlusers.switch", - "cl_hlusers.writelog", - "cl_hlusers.telemetria", - "cl_hlusers.computers", - "cl_hlusers.debug_table" - ); - - public function __construct() - { - if (!isset($this->connection)) { - $this->connection = new mysqli($this->host, $this->username, $this->password); - - if (!$this->connection) { - echo 'Cannot connect to database!'; - exit; - } - } - - unset($this->queryResult); - - $this->connection->set_charset("utf8"); - return $this->connection; - } - - public static function getInstance() - { - if (!empty(self::$msh)) return self::$msh; - self::$msh = new Database(); - return self::$msh; - } - - public function query($query, $params = null, $isClosed = false, $getID = false) - { - // $params = array("ss","string_1","string_2"); - $this->addSemicolonToQueryString($query); - - $imp = ''; - if ($params != null) $imp = implode(", ", $params); - $this->queryString = "{$query} ($imp)"; - - if ($this->isWriteType($query)) { - $boolWrite = true; - - foreach (self::$arrSkip as $tabla) { - if (strpos($query, $tabla)) { - $boolWrite = false; - break; - } - } - - // A nagios test ne irja tele a cl_hlusers.writelog tablat - if (strpos($_SERVER['REQUEST_URI'], 'nagios_monitor.php') !== false || strpos($_SERVER['REQUEST_URI'], 'maintenance/test_API.php') !== false || $_SERVER['SERVER_NAME'] == 'secondary.cadline.hu') - $boolWrite = false; - - // A tesztek futtatasakor ne logolja a modositasokat (majd a webformos) - if (strpos($_SERVER['REQUEST_URI'], 'maintenance/tips.php') /*&& $_SERVER['REMOTE_ADDR'] == '185.43.206.63'*/) { - $paramIndex = 5; - if ((substr($params[$paramIndex], 0, 7) == '3710018') || (substr($params[$paramIndex], 0, 7) == '3710028') - || (substr($params[$paramIndex], 0, 7) == '3710038') || (substr($params[$paramIndex], 0, 7) == '3700078') - || (substr($params[$paramIndex], 0, 7) == '3700018') - ) { - $boolWrite = false; - } - } - - $func = addslashes("function: " . __FUNCTION__ . " method: " . __METHOD__)/*.' --> '.$params[$paramIndex]*/; - - if ($boolWrite) { - mysqli_query($this->connection, "INSERT INTO `cl_hlusers`.`writelog` (`user`,`datum`,`ip`,`url`,`func`,`sql`) VALUES ( - '" . (isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'www.archlinexp.com') . "', - '" . date("Y-m-d H:i:s", time()) . "', - '" . (isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '127.0.0.1') . "', - '" . (isset($_SERVER['SERVER_NAME']) ? addslashes($_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']) : '') . "', - '" . $func . "','" . addslashes($query) . "');"); - } - } - - $this->queryResult = $this->connection->prepare($query); - - if ($params != null) { - $tmp = array(); - foreach ($params as $key => $value) $tmp[$key] = &$params[$key]; - call_user_func_array(array($this->queryResult, 'bind_param'), $tmp); - } - - $this->queryResult->execute(); - if (mysqli_error($this->connection)) throw new Exception(mysqli_error($this->connection) . ' Query: ' . $query); - - if ($getID) return $this->getInsertedId(); - if ($isClosed) $this->queryResult->close(); - } - - public function insert($table, $infoArr, $type, $needEscape = true) - { - $columArr = array(); - $bindArr = array(); - $endArr = array(); - $colums = ''; - $values = ''; - - array_push($endArr, $type); - - foreach ($infoArr as $key => $value) { - $columArr[] = "`{$key}`"; - $bindArr[] = "?"; - - $string = !$needEscape && $key == 'versionInfo' ? $value : mysqli_real_escape_string($this->connection, $value); - array_push($endArr, $string); - } - - $colums = implode(',', $columArr); - $values = implode(',', $bindArr); - - $sql = "INSERT INTO {$table} ({$colums}) VALUES ({$values});"; - return $this->query($sql, $endArr, false, true); - } - - public function update($table, $infoArr, $where = false, $type, $needEscape = true) - { - if (!is_array($infoArr)) return false; - - $whereStr = ''; - $paramValue = array(); - $bindArr = array(); - $endArr = array(); - $data = ''; - - array_push($endArr, $type); - - if (is_array($where)) $whereStr = 'WHERE ' . $this->whereMakerPriv($where, $paramValue); - elseif ($where) $whereStr = "WHERE {$where}"; - - foreach ($infoArr as $key => $value) { - $bindArr[] = "`{$key}` = ?"; - - $string = !$needEscape && $key == 'versionInfo' ? $value : mysqli_real_escape_string($this->connection, $value); - array_push($endArr, $string); - } - - foreach ($paramValue as $param) array_push($endArr, mysqli_real_escape_string($this->connection, $param)); - - $data = implode(',', $bindArr); - - $query = "UPDATE {$table} SET {$data} {$whereStr};"; - return $this->query($query, $endArr, true); - } - - public function delete($table, $where = false, $type) - { - $whereStr = ''; - $paramValue = array(); - $endArr = array(); - - array_push($endArr, $type); - - if (is_array($where)) $whereStr = 'WHERE ' . $this->whereMakerPriv($where, $paramValue); - elseif ($where) $whereStr = "WHERE {$where}"; - - foreach ($paramValue as $param) array_push($endArr, mysqli_real_escape_string($this->connection, $param)); - - $query = "DELETE FROM {$table} {$whereStr};"; - return $this->query($query, $endArr, true); - } - - public function fetchNext() - { - $result = $this->get_row(); - $this->queryResult->free_result(); - $this->queryResult->close(); - - return $result; - } - - public function fetchAssoc() - { - $result = $this->get_result(); - $this->queryResult->free_result(); - $this->queryResult->close(); - - return $result; - } - - protected function get_result() - { - $result = array(); - $this->queryResult->store_result(); - for ($i = 0; $i < $this->queryResult->num_rows; $i++) { - $metadata = $this->queryResult->result_metadata(); - $params = array(); - while ($field = $metadata->fetch_field()) $params[] = &$result[$i][$field->name]; - call_user_func_array(array($this->queryResult, 'bind_result'), $params); - $this->queryResult->fetch(); - } - - if (!empty($result)) return $result; - else return null; - } - - protected function get_row() - { - $result = array(); - $this->queryResult->store_result(); - - if ($this->queryResult->num_rows > 0) { - for ($i = 0; $i < 1; $i++) { - $metadata = $this->queryResult->result_metadata(); - $params = array(); - while ($field = $metadata->fetch_field()) $params[] = &$result[$i][$field->name]; - call_user_func_array(array($this->queryResult, 'bind_result'), $params); - $this->queryResult->fetch(); - } - } - - if (!empty($result)) return $result[0]; - else return null; - } - - public function getInsertedId() - { - $id = $this->queryResult->insert_id; - $this->queryResult->close(); - - return $id; - } - - private function addSemicolonToQueryString(&$query) - { - $query = rtrim($query); - - if (substr($query, -1) != ';') $query = "{$query};"; - } - - private function whereMakerPriv($where, &$paramValue = array()) - { - if (!is_array($where)) return 1; - $back = '1 '; - foreach ($where as $key => $value) { - if (is_array($value)) { - $back .= 'AND `' . $key . '`' . $value[0] . '"' . $value[1] . '" '; - } else { - $back .= "AND `{$key}` = ? "; - array_push($paramValue, $value); - } - } - return $back; - } - - private function isWriteType($sql) - { - if (!preg_match('/^\s*"?(SET|INSERT|UPDATE|DELETE|REPLACE|CREATE|DROP|TRUNCATE|LOAD DATA|COPY|ALTER|GRANT|REVOKE|LOCK|UNLOCK)\s+/i', $sql)) { - return false; - } - return true; - } - - public function getQueryString() - { - return $this->queryString; - } - public function getQueryResult() - { - return $this->queryResult; - } -} diff --git a/cadline/backend/common_cadline_libraries/crm_hardlock.class.php b/cadline/backend/common_cadline_libraries/crm_hardlock.class.php deleted file mode 100644 index e222d835..00000000 --- a/cadline/backend/common_cadline_libraries/crm_hardlock.class.php +++ /dev/null @@ -1,6914 +0,0 @@ - array("+1 year", "+11 month", "+30 day", "", ""), // Nonprofit: A kiadasi evet koveto December 31 - '97' => array("", "", "", "", ""), // Student: A kiadasi ev Januar 1-e (ez minden esetben letiltott lesz) - '96' => array("+1 year", "+11 month", "+30 day", "", ""), // Trial - '94' => array("+1 year", "+11 month", "+30 day", "", ""), // Namirial Nonprofit - '93' => array("+1 year", "+11 month", "+30 day", "", ""), // Namirial Trial - '92' => array("+1 year", "+11 month", "+30 day", "", ""), // BimLadder Nonprofit - '91' => array("+1 year", "+11 month", "+30 day", "", "") // BimLadder Trial - ); - - public static $win10creator_old_isid; - - const CHECKED_DATE_FALSE = 0; - const CHECKED_DATE_OK = 4; - - public function __construct() - { - self::$aktivalasihibak = $GLOBALS['aktivalasihibak']; - self::$win10creator_old_isid = $GLOBALS['win10creator_old_isid']; - } - - public static function isEmergencyServer($secondary) - { - return isset($secondary) && $secondary == 'true'; - } - - public static function isServerActive() - { - $file = $_SERVER['DOCUMENT_ROOT'] . "/activateServer.txt"; - $myfile = fopen($file, "r"); - - $text = 'Inactive'; - $i = 0; - - while (!$myfile && $i < 10) { - $myfile = fopen($file, "r"); - $i++; - } - - if ($myfile) { - $text = fread($myfile, filesize($file)); - fclose($myfile); - } - - return $text == 'Active'; - } - - public static function isPrimaryServerAlive() - { - if ($_SERVER['SERVER_NAME'] == 'www.archline.hu' || $_SERVER['SERVER_NAME'] == 'www.archlinexp.com') { - // TODO: logolni - die(); - } - - - if (crm_hardlock::isServerActive()) { - return false; - } - - $file = $_SERVER['DOCUMENT_ROOT'] . "/serverAlive.txt"; - $myfile = fopen($file, "r"); - - $text = 'Failed'; - $i = 0; - - while (!$myfile && $i < 10) { - $myfile = fopen($file, "r"); - $i++; - } - - if ($myfile) { - $text = fread($myfile, filesize($file)); - fclose($myfile); - } - - return $text == 'Success'; - } - - public static function secondaryServerLogRefused($password, $function, $description) - { - if ($_SERVER['SERVER_NAME'] == 'secondary.cadline.hu') { - $activity = array( - 'password' => $password, - 'ip' => $_SERVER['REMOTE_ADDR'], - 'time' => time(), - 'function_id' => $function, - 'description' => $description - ); - Database::getInstance()->insert("local_crm.activity_refused", $activity, 'ssiis'); - } - } - - public static function secondaryServerLog($password, $function, $description) - { - if ($_SERVER['SERVER_NAME'] == 'secondary.cadline.hu') { - $activity = array( - 'password' => $password, - 'ip' => $_SERVER['REMOTE_ADDR'], - 'time' => time(), - 'function' => $function, - 'description' => $description - ); - Database::getInstance()->insert("local_crm.activity", $activity, 'ssiss'); - } - } - - public static function GetFileTransferCredentials($verID, $region = '') - { - /*if ($region == 'cn') { - $credentials['protocol'] = 'webdav'; - $credentials['server'] = 'https://dav-gstarbim.gstarcad.cn'; - //$credentials['account'] = 'uploader'; - //$credentials['pwd'] = 'b5hWKhG5'; - - $credentials['account'] = 'admin'; - $credentials['pwd'] = 'jow3YR98vBh6'; - - return $credentials; - }*/ - - if ($verID >= 39) { - $credentials['protocol'] = 'webdav'; - $credentials['server'] = 'https://webdav.cadline.hu'; - $credentials['account'] = 'webdavuser'; - $credentials['pwd'] = 'il2ieGhohz'; - } else { - $credentials = array(); - $credentials['protocol'] = 'ftp'; - $credentials['server'] = 'ftp://tanis2.cadline.hu'; - $credentials['account'] = 'vendeg'; - $credentials['pwd'] = 'vendeg'; - } - - return $credentials; - } - - public static function getTestClass($result = '') - { - switch ($result) { - case 'passed': - $class = 'table-success'; - break; - - case 'no_results': - $class = 'table-warning'; - break; - - case 'skipped': - $class = 'table-warning'; - break; - - default: - $class = 'table-danger'; - break; - } - - return $class; - } - - public static function getProductNameByID($id) - { - $product = ''; - - switch ($id) { - case 0: - $product = 'LT'; - break; - - case 1: - $product = 'Professional'; - break; - - default: - $product = 'LIVE'; - break; - } - - return $product; - } - - public static function tryToAlloc($min = 990001, $max = 999999) - { - $ret = 0; - if ((int)$min == 0 || (int)$max == 0) return $ret; - - $query = "SELECT LEFT(hlNum, 6) AS hlNum FROM `" . CRMADATBAZIS . "`.`hardlock` WHERE hlNum >= " . (int)$min . " AND hlNum < " . (int)$max . " ORDER BY hlNum;"; - crm_database::getInstance()->query($query); - $res = crm_database::getInstance()->fetchAssoc(); - - if (count($res)) { - $keszlet = range($min, $max); - foreach ($res as $r) $kulcsok[] = $r['hlNum']; - - $diff = array_diff($keszlet, $kulcsok); - reset($diff); - $ret = current($diff); - } - return $ret; - } - - public static function getVerIDFrom8and9($ver8and9) - { - $query = "SELECT * FROM `cl_hlusers`.`p_versions` WHERE verPassword8and9 = ?"; - Database::getInstance()->query($query, array('i', $ver8and9)); - $res = Database::getInstance()->fetchNext(); - - return $res['verID']; - } - - public static function GetActivationError($error_code) - { - return self::$aktivalasihibak[$error_code]; - } - - public static function generateRandomString($length = 22) - { - return substr(str_shuffle(str_repeat($x = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$', ceil($length / strlen($x)))), 1, $length); - } - - // Ez csak a class/selectprogram.class.php-ban hivodik, de az is hibas - // A programbol a Namirial es BIMLadder trial visszavaltaskor volt hasznalva - public static function GetAllPrograms($nUserID, $product_id, $verid) - { - $query = "SELECT h_programs.prPass AS prHlNum, h_programs.prActCode AS prActCode, h_programs.prTypeID AS prTypeID, h_programs.prVerID AS prVerID, h_programs.prLan AS prLan - FROM `" . CRMADATBAZIS . "`.`hardlock` - INNER JOIN `" . CRMADATBAZIS . "`.`h_programs` ON h_programs.prHlNum = hardlock.hlNum - WHERE hardlock.hlUser = ? AND hardlock.product_id = ? AND hardlock.hlStat != ? AND h_programs.prVerID = ?"; - Database::getInstance()->query($query, array('sii', $nUserID, $product_id, _Hardlock::Blank, $verid)); - $res = Database::getInstance()->fetchAssoc(); - - return $res; - } - - public static function getLanName($lan, $ctrID) - { - $resource = new Resource($ctrID); - - return $lan == 0 ? $resource->getDlgString(1290) : $lan . ' ' . $resource->getDlgString(3347); - } - - public static function getProgramType($serial, $prTypeID, $ctrID, $floating) - { - $resource = new Resource($ctrID); - - $type = crm_hardlock::GetTypeName($prTypeID); - $type .= ' ('; - $isFloating = $floating == 1; - - if (!Codegen::IsSoftwareKey($serial)) - $type .= $resource->getDlgString(11807); - - if (Codegen::IsSoftwareKey($serial) && $isFloating) - $type .= ucfirst($resource->getDlgString(11444)); - - if (Codegen::IsSoftwareKey($serial) && !$isFloating) - $type .= $resource->getDlgString(11806); - - $type .= ')'; - - return $type; - } - - public static function isProgramAvailable($currentSerial, $dbSerial, $prFizetve, $isid, $lan, $prActCode, &$availabelProgram, &$freeLic, $ctrID, $floating) - { - if ($prFizetve < date('Y-m-d')) - return false; - - $isSoftwareKey = Codegen::IsSoftwareKey($dbSerial); - $isFloating = $isSoftwareKey ? $floating == 1 : false; - - if ($isSoftwareKey) { - $resource = new Resource($ctrID); - } - - if ($isSoftwareKey && $lan > 0 && !$isFloating) { - $query = "SELECT prActCode FROM `" . CRMADATBAZIS . "`.`h_programs` WHERE prPass = ?"; - Database::getInstance()->query($query, array('s', $dbSerial)); - $programs = Database::getInstance()->fetchAssoc(); - - $i = 0; - $j = 0; - foreach ($programs as $program) { - $prgIsid = crm_hardlock::GetIsidFromTimeCode($program['prActCode']); - if ($program['prActCode'] != '' && $prgIsid != $isid) { - $i++; - } - - if ($program['prActCode'] == '') { - $j++; - } - } - - if (!empty($programs) && count($programs) == $i) { - $availabelProgram = $resource->getDlgString(11809); - return false; - } - - $freeLic = $resource->getDlgString(11805) . ' ' . $j; - } - - if ($currentSerial == $dbSerial) { - if ($isSoftwareKey && $lan == 0) { - $computer = crm_hardlock::GetComputerInfo($dbSerial, $isid); - $availabelProgram = $computer['custom_name'] != '' ? $computer['custom_name'] : $computer['computer_name']; - - if ($availabelProgram == '') { - $availabelProgram = $resource->getDlgString(11812); - } - } - return false; - } - - if ($isSoftwareKey && $lan == 0 && $prActCode != '' && !$isFloating) { - $prgIsid = crm_hardlock::GetIsidFromTimeCode($prActCode); - if ($prgIsid != $isid) { - $computer = crm_hardlock::GetComputerInfo($dbSerial, $prgIsid); - $compName = $computer['custom_name'] != '' ? $computer['custom_name'] : $computer['computer_name']; - if ($compName == '') { - $compName = $resource->getDlgString(11812); - } - - $availabelProgram = sprintf($resource->getDlgString(11811), $compName); - return false; - } - } - - return true; - } - - public static function getUserData($nUserID) - { - $query = "SELECT * FROM `" . JMLADATBAZIS . "`.`jml_users` WHERE nUserID = ?;"; - Database::getInstance()->query($query, array('i', $nUserID)); - $res = Database::getInstance()->fetchNext(); - - return $res; - } - - public static function getRemainingCredits($nUserID) - { - $query = "SELECT * FROM mobileview.ai_render_credits WHERE nUserID = ?;"; - Database::getInstance()->query($query, array('i', $nUserID)); - $res = Database::getInstance()->fetchNext(); - - if (empty($res)) { - return 3; - } - - return (int)$res['credit']; - } - - public static function queueRequest($id, $file, $userId) - { - $query = "SELECT * FROM mobileview.jobs WHERE id = ?;"; - Database::getInstance()->query($query, array('s', $id)); - $res = Database::getInstance()->fetchNext(); - - if (empty($res)) { - $job = array( - 'id' => $id, - 'file' => $file, - 'userId' => $userId, - 'status' => 'in_queue', - 'priority' => 0, - 'timestamp' => time(), - 'counter' => 1 - - ); - Database::getInstance()->insert("mobileview.jobs", $job, 'ssisiii'); - } else { - $counter = (int)$res['counter'] + 1; - $priority = $counter >= 3 ? 1 : 0; - - Database::getInstance()->update( - "mobileview.jobs", - array( - 'counter' => $counter, - 'priority' => $priority - ), - array('id' => $id), - 'iis' - ); - } - } - - public static function checkJoomlaAccount($serial) - { - $query = "SELECT * FROM cl_hlusers.hardlock WHERE hlNum = ? LIMIT 1;"; - Database::getInstance()->query($query, array('s', substr($serial, 0, 6))); - $hardlock = Database::getInstance()->fetchNext(); - if (empty($hardlock) || $hardlock['hlUser'] == null || $hardlock['hlUser'] == '' || !is_numeric($hardlock['hlUser'])) { - return false; - } - - $query = "SELECT * FROM www_archline_hu.jml_users WHERE nUserID = ? LIMIT 1;"; - Database::getInstance()->query($query, array('i', $hardlock['hlUser'])); - $jmlUser = Database::getInstance()->fetchNext(); - if (empty($jmlUser)) { - return false; - } - - return $hardlock['hlUser']; - } - - public static function GetComputerInfoByNpid($npid) - { - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`computers` WHERE computer_id = ?"; - Database::getInstance()->query($query, array('s', $npid)); - $res = Database::getInstance()->fetchNext(); - - return $res; - } - - public static function GetComputerInfo($serial, $isid) - { - $res = array(); - - $query = "SELECT computer_id FROM `" . CRMADATBAZIS . "`.`p_serial_isid` WHERE serial = ? AND isid = ?"; - Database::getInstance()->query($query, array('ss', $serial, $isid)); - $p_serial_isid = Database::getInstance()->fetchNext(); - - if (!empty($p_serial_isid)) { - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`computers` WHERE id = ?"; - Database::getInstance()->query($query, array('i', $p_serial_isid['computer_id'])); - $res = Database::getInstance()->fetchNext(); - } - - return $res; - } - - public static function getInfoForProgramDialog($prFizetve, $availabelProgram, $freeLic, $ctrID) - { - $msg = ''; - - if ($prFizetve < date('Y-m-d')) { - $resource = new Resource($ctrID); - $msg = $resource->getDlgString(11804); - } - - if ($availabelProgram != '') - $msg = $availabelProgram; - - if ($freeLic != '') - $msg = $freeLic; - - return $msg; - } - - public static function GetAllProgramsFromUser($nUserID, $product_id, $verid, $specEdition = '', $currentSerial = '') - { - if ($nUserID < 0) { - $userID = abs($nUserID); - $query = "SELECT custom_lic.serial AS prPass FROM cl_hlusers.custom_login_licenses custom_lic WHERE custom_lic.id = ? AND custom_lic.serial != ''"; - - Database::getInstance()->query($query, array('i', $userID)); - } else { - if ($specEdition == 'LT') { - $query = "SELECT h_programs.prPass AS prPass, h_programs.prVerID AS prVerID, hardlock.hlLan AS hlLan, h_programs.prTypeID AS prTypeID, - h_programs.prFizetve AS prFizetve, h_programs.prActCode AS prActCode, hardlock.isFloating AS isFloating - FROM " . CRMADATBAZIS . ".hardlock - LEFT JOIN " . CRMADATBAZIS . ".h_programs ON h_programs.prHlNum = hardlock.hlNum - LEFT JOIN cl_hlusers.hardlock_borrow borrow ON borrow.borrow_id = hardlock.borrow - WHERE h_programs.prTypeID = ? AND h_programs.prVerID = ? - AND (hardlock.hlUser = ? AND (hardlock.borrow IS NULL OR hardlock.borrow = 0 OR hardlock.hlLan > 1) OR borrow.userID = ?) - AND hardlock.product_id = ? AND hardlock.hlStat = ? - GROUP BY h_programs.prPass"; - - if ($currentSerial != '') { - $query .= " ORDER BY - CASE - WHEN h_programs.prPass = '" . $currentSerial . "' THEN 1 - ELSE 2 - END, hardlock.hlLan ASC"; - } - - Database::getInstance()->query($query, array('iiiiii', 4, $verid, $nUserID, $nUserID, $product_id, _Hardlock::Active)); - } else { - $query = "SELECT h_programs.prPass AS prPass, h_programs.prVerID AS prVerID, hardlock.hlLan AS hlLan, h_programs.prTypeID AS prTypeID, - h_programs.prFizetve AS prFizetve, h_programs.prActCode AS prActCode, hardlock.isFloating AS isFloating - FROM " . CRMADATBAZIS . ".hardlock - LEFT JOIN " . CRMADATBAZIS . ".h_programs ON h_programs.prHlNum = hardlock.hlNum - LEFT JOIN cl_hlusers.hardlock_borrow borrow ON borrow.borrow_id = hardlock.borrow - WHERE h_programs.prTypeID != 4 AND h_programs.prVerID = ? - AND (hardlock.hlUser = ? AND (hardlock.borrow IS NULL OR hardlock.borrow = 0 OR hardlock.hlLan > 1) OR borrow.userID = ?) - AND hardlock.product_id = ? AND hardlock.hlStat = ? - GROUP BY h_programs.prPass"; - - if ($currentSerial != '') { - $query .= " ORDER BY - CASE - WHEN h_programs.prPass = '" . $currentSerial . "' THEN 1 - ELSE 2 - END, hardlock.hlLan ASC"; - } - - Database::getInstance()->query($query, array('iiiii', $verid, $nUserID, $nUserID, $product_id, _Hardlock::Active)); - } - } - - $res = Database::getInstance()->fetchAssoc(); - - return $res; - } - - public static function getInstallerParam($string, $param) - { - $start = '<{' . $param . ':'; - $end = '}>'; - $string = ' ' . $string; - $ini = strpos($string, $start); - if ($ini == 0) return ''; - $ini += strlen($start); - $len = strpos($string, $end, $ini) - $ini; - return substr($string, $ini, $len); - } - - public static function getMirrorFromUrl($url) - { - $mirror = 'hungary'; - - if (strpos($url, 'download-mirror.s3.amazonaws.com') !== false) { - $mirror = 'usa'; - } - - if (strpos($url, 'downloadmirror.blob.core.windows.net') !== false) { - $mirror = 'korea'; - } - - return $mirror; - } - - public static function updateMirror($compID, $mirror) - { - $query = "UPDATE cl_hlusers.computers SET mirror = ? WHERE id = ?"; - Database::getInstance()->query($query, array('si', $mirror, $compID)); - } - - public static function GetActCode($serial) - { - $query = "SELECT * FROM `cl_hlusers`.`h_programs` WHERE prPass = ?"; - Database::getInstance()->query($query, array('s', $serial)); - $res = Database::getInstance()->fetchNext(); - - return $res['prActCode']; - } - - public static function ResetKey($hlNum) - { - $query = "SELECT prPass FROM `" . CRMADATBAZIS . "`.`h_programs` WHERE prHlNum = ?"; - Database::getInstance()->query($query, array('s', $hlNum)); - $res = Database::getInstance()->fetchAssoc(); - - foreach ($res as $r) self::DeleteProgramFromPassword($r["prPass"]); - - Database::getInstance()->delete(CRMADATBAZIS . ".nonprofit", array('hlID' => $hlNum), 's'); - Database::getInstance()->delete(CRMADATBAZIS . ".h_history", array('hiHlNum' => $hlNum), 's'); - - $query = "UPDATE `" . CRMADATBAZIS . "`.`hardlock` SET hlStat = ?, hlUser = '', hlDateIssue = '', hlManID = ?, hlTime = ?, hlDatePro = ? WHERE hlNum = ?"; - Database::getInstance()->query($query, array('iis', _Hardlock::Blank, 0, $hlNum)); - } - - public static function DeleteProgram($hlNum) - { - Database::getInstance()->delete(CRMADATBAZIS . ".h_history", array('hiHlNum' => $hlNum), 's'); - Database::getInstance()->delete(CRMADATBAZIS . ".h_programs", array('prHlNum' => $hlNum), 's'); - Database::getInstance()->delete(CRMADATBAZIS . ".h_aktivalas_infok", array('kulcs' => $hlNum), 's'); - Database::getInstance()->query("DELETE FROM `" . CRMADATBAZIS . "`.`nonprofit` WHERE `expire_datetime`query("DELETE FROM `" . CRMADATBAZIS . "`.`h_programs` WHERE prPass = ?", array('s', $password)); - } - - public static function ClearProgram($password) - { - Database::getInstance()->delete(CRMADATBAZIS . ".p_serial_isid", array('serial' => $password), 's'); - Database::getInstance()->delete(CRMADATBAZIS . ".userstats2013", array('usPwd' => $password), 's'); - Database::getInstance()->query("UPDATE `" . CRMADATBAZIS . "`.`h_programs` SET prActCode = '' WHERE prPass = ?", array('s', $password)); - - Database::getInstance()->query("SELECT * FROM `" . CRMADATBAZIS . "`.`p_serial_isid` WHERE serial = ?", array('s', $password)); - $res = Database::getInstance()->fetchAssoc(); - - return empty($res); - } - - public static function ListExpiredPrograms($date, $db) - { - if ($db == 'hu') { - $query = "SELECT p.prHlNum AS hlNum, p.prFizetve, p.prPass AS prPass FROM - (SELECT * FROM cl_hlusers.h_programs WHERE h_programs.prPass LIKE ? AND h_programs.prHlNum IN - (SELECT hardlock.hlNum FROM cl_hlusers.hardlock WHERE hardlock.hlCtrID = ?) ORDER BY prFizetve desc) p - GROUP BY p.prHlNum having p.prFizetve < ? LIMIT 200"; - } else { - $query = "SELECT p.prHlNum AS hlNum, p.prFizetve, p.prPass AS prPass FROM - (SELECT * FROM cl_hlusers.h_programs WHERE h_programs.prPass LIKE ? AND h_programs.prHlNum IN - (SELECT hardlock.hlNum FROM cl_hlusers.hardlock WHERE hardlock.hlCtrID != ?) - ORDER BY prFizetve desc) p GROUP BY p.prHlNum having p.prFizetve < ? LIMIT 200"; - } - - Database::getInstance()->query($query, array('sis', "99%", 36, $date)); - $res = Database::getInstance()->fetchAssoc(); - - return $res; - } - - public static function GetLastRunningDateFromPassword($password) - { - $query = "SELECT usDate FROM `" . CRMADATBAZIS . "`.`userstats2013` WHERE usPwd = ? ORDER BY usDate DESC"; - Database::getInstance()->query($query, array('s', $password)); - $res = Database::getInstance()->fetchNext(); - - return $res['usDate']; - } - - public static function GetUserFromHlNum($hlNum) - { - $query = "SELECT hlUser FROM `" . CRMADATBAZIS . "`.`hardlock` WHERE hlNum = ?"; - Database::getInstance()->query($query, array('s', $hlNum)); - $res = Database::getInstance()->fetchNext(); - - if (!is_numeric($res['hlUser'])) return $res['hlUser']; - - $query = "SELECT strName FROM `" . CRMADATBAZIS . "`.`users` WHERE nUserID = ?"; - Database::getInstance()->query($query, array('i', $res['hlUser'])); - $res2 = Database::getInstance()->fetchNext(); - - return $res2['strName']; - } - - public static function GetHlUser($hlNum) - { - $query = "SELECT hlUser FROM `" . CRMADATBAZIS . "`.`hardlock` WHERE hlNum = ?"; - Database::getInstance()->query($query, array('s', $hlNum)); - $res = Database::getInstance()->fetchNext(); - - return $res['hlUser']; - } - - public static function GetActiveRegistration($password, $isid) - { - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`p_serial_isid` WHERE serial = ? AND isid = ? AND aktiv = ?"; - Database::getInstance()->query($query, array('ssi', $password, $isid, 1)); - $res = Database::getInstance()->fetchNext(); - - return $res; - } - - public static function GetHardlockData($hlNum) - { - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`hardlock` WHERE hlNum = ?"; - Database::getInstance()->query($query, array('s', $hlNum)); - $res = Database::getInstance()->fetchNext(); - - return $res; - } - - public static function GetUserFromPassword($password) - { - $hlnum = self::GetHlnumFromPassword($password); - - $query = "SELECT hlUser FROM `" . CRMADATBAZIS . "`.`hardlock` WHERE hlNum = ?"; - Database::getInstance()->query($query, array('s', $hlnum)); - $res = Database::getInstance()->fetchNext(); - - return $res['hlUser']; - } - - public static function getProgramsFromHardlock($hlNum, $verID = 0) - { - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`h_programs` WHERE prHlNum = ?"; - if ($verID != 0) { - $query .= " AND prVerID = ?"; - Database::getInstance()->query($query, array('si', $hlNum, $verID)); - } else { - Database::getInstance()->query($query, array('s', $hlNum)); - } - $res = Database::getInstance()->fetchAssoc(); - - return $res; - } - - public static function getProgramStatus($status, $password) - { - if (($status & Status::sCracked) == Status::sCracked) return "Cracked ({$status})"; - if (($status & Status::sDisabled) == Status::sDisabled) return "Program is disabled ({$status})"; - - $result = ""; - - if (($status & Status::sHW_keyOK) == Status::sHW_keyOK) $result .= "HW OK, "; - if (($status & Status::sNotCommercialProgram) == Status::sNotCommercialProgram) $result .= "Not com. program, "; - - if (crm_hardlock::ActiveRegistrationRequired($password)) { - if (($status & Status::sActiveRegistration) != Status::sActiveRegistration) $result .= "Not act. registration,"; - } - - if (($status & Status::sUnlimited) == Status::sUnlimited) $result .= "Unlimited, "; - if (($status & Status::sFixTimeLimitReached) == Status::sFixTimeLimitReached) $result .= "The program reached the fixed expiration date, "; - - $result = rtrim($result, ', '); - $result .= " ({$status})"; - return $result; - } - - public static function GetHlnumFromPassword($password) - { - return substr($password, 0, 6); - } - - public static function GetIsidFromTimeCode($idokod) - { - if (!Codegen::IsValidTimeCode($idokod)) return ''; - - $arrIdokod = explode("-", $idokod); - - return $arrIdokod[1]; - } - - public static function GetIsidFromPasswordForHardwareKeys($password) - { - return substr($password, 0, 2) . substr($password, 7, 2); - } - - public static function GetVerCodeFromverId($verid) - { - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`p_versions` WHERE verID = ?"; - Database::getInstance()->query($query, array('i', $verid)); - $versions = Database::getInstance()->fetchNext(); - - return $versions['verCode']; - } - - public static function GetVer8And9FromVerId($verid) - { - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`p_versions` WHERE verID = ?"; - Database::getInstance()->query($query, array('i', $verid)); - $versions = Database::getInstance()->fetchNext(); - - return $versions['verPassword8and9']; - } - - public static function GetVer8And9FromPassword($password) - { - return substr($password, 7, 2); - } - public static function GetTypeFromPassword($password) - { - return substr($password, 6, 1); - } - public static function GetLanSignFromPassword($password) - { - return substr($password, 8, 1); - } - public static function GetCountryFromPassword($password) - { - return substr($password, 0, 2); - } - - public static function GetLaunchYearFromVer8And9($ver8and9) - { - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`p_versions` WHERE verPassword8and9 = ?"; - Database::getInstance()->query($query, array('i', $ver8and9)); - $versions = Database::getInstance()->fetchNext(); - - return $versions["year"]; - } - - public static function GetVerIdFromPassword($password) - { - $ver = self::GetVer8And9FromPassword($password); - - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`p_versions` WHERE verPassword8and9 = ?"; - Database::getInstance()->query($query, array('i', $ver)); - $versions = Database::getInstance()->fetchNext(); - - return $versions["verID"]; - } - - public static function GetVerName($verid) - { - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`p_versions` WHERE verID = ?"; - Database::getInstance()->query($query, array('i', $verid)); - $res = Database::getInstance()->fetchNext(); - - return $res['verName']; - } - - public static function GetTypeName($typeid) - { - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`p_types` WHERE typeCode = ?"; - Database::getInstance()->query($query, array('i', $typeid)); - $res = Database::getInstance()->fetchNext(); - - return $res['typeName']; - } - - public static function IsLiveKey($password = "") - { - return (substr($password, 6, 1) == 'L'); - } - - public static function IsLTkey($password) - { - (int)$ver = self::GetVer8And9FromPassword($password); - return (substr($password, 6, 1) == '4' && $ver >= 36); // 2019-es evtol letezik az LT (ha netan megszunik, akkor ki kell egesziteni egy vegleges verzioszammal is) - } - - public static function checkProgramType($type, $password) - { - $password_type = crm_hardlock::GetTypeFromPassword($password); - - if (strlen($type) > 1 && !self::IsLiveKey($password)) return true; - - if (self::IsLiveKey($password) && $type != 76) return false; - - if (self::IsLiveKey($password)) { - if ($type != 76) return false; - else return true; - } else { - if ($type == $password_type) return true; - else return false; - } - } - - public static function checkProgramVersion($verid, $password) - { - $ver8and9 = self::GetVer8And9FromPassword($password); - - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`p_versions` WHERE verID = ?"; - Database::getInstance()->query($query, array('i', $verid)); - $p_version = Database::getInstance()->fetchNext(); - - if ($p_version['verPassword8and9'] != $ver8and9) return false; - - return true; - } - - public static function checkActDate($password, $isid) - { - $softwareKey = Codegen::IsSoftwareKey($password); - - $query = "SELECT twtw, prFizetve FROM `" . CRMADATBAZIS . "`.`h_programs` WHERE prPass = ? AND prActCode LIKE ?"; - Database::getInstance()->query($query, array('ss', $password, "%-{$isid}-%")); - $program = Database::getInstance()->fetchNext(); - - $query = "SELECT datum FROM `" . CRMADATBAZIS . "`.`p_serial_isid` WHERE serial = ? AND isid = ?"; - Database::getInstance()->query($query, array('ss', $password, $isid)); - $p_serial_isid = Database::getInstance()->fetchNext(); - - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`userstats2013` WHERE usPwd = ? AND usISID = ? ORDER BY usDate DESC"; - Database::getInstance()->query($query, array('ss', $password, $isid)); - $usstats = Database::getInstance()->fetchNext(); - - if ( - $softwareKey && !empty($p_serial_isid) && $program['twtw'] == 0 && $program['prFizetve'] != '2050-01-01' && - Codegen::GetDayInterval(substr($p_serial_isid['datum'], 0, 10), $usstats['usTelepitesiDatum']) > 2 - ) { - return 'error: nem egyezik meg a telepitesi datum: p_serial_isid: ' . $p_serial_isid['datum'] . ' | userstats2013: ' . $usstats['usTelepitesiDatum']; - } - return true; - } - - public static function GetProgramData($password) - { - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`h_programs` WHERE prPass = ?"; - Database::getInstance()->query($query, array('s', $password)); - $program = Database::getInstance()->fetchNext(); - - return $program; - } - - public static function GetInstallCodeFromInstallDate($password, $isid, $fizetve, $isTwTw) - { - if ($fizetve == '2050-01-01') $dayInterval = 3583; - else { - if ($isTwTw) $installDate = crm_hardlock::getTwTwRootTimeString(); - else { - if (Codegen::IsSoftwareKey($password)) { - $reg = crm_hardlock::GetActiveRegistration($password, $isid); - $installDate = $reg['datum']; - } else { - $program = crm_hardlock::GetProgramData($password); - $installDate = $program['prSellDate']; - } - } - - $now = date("Y-m-d"); - $dayInterval = Codegen::GetDayInterval(substr($installDate, 0, 10), $now); - } - - $installCode = Codegen::GenerateTimeCode($password, $isid, $dayInterval); - - return $installCode; - } - - public static function getComputerIdFromNpid($npid) - { - $query = "SELECT id FROM `" . CRMADATBAZIS . "`.`computers` WHERE computer_id = ?"; - Database::getInstance()->query($query, array('s', $npid)); - $res = Database::getInstance()->fetchNext(); - - return $res['id']; - } - - public static function GetNpid($computerID) - { - $query = "SELECT computer_id FROM `" . CRMADATBAZIS . "`.`computers` WHERE id = ?"; - Database::getInstance()->query($query, array('i', $computerID)); - $res = Database::getInstance()->fetchNext(); - - return $res['computer_id']; - } - - public static function AddOrUpdateComputer($npID, $comp_name) - { - $query = "SELECT id FROM `" . CRMADATBAZIS . "`.`computers` WHERE computer_id = ?"; - Database::getInstance()->query($query, array('s', $npID)); - $res4 = Database::getInstance()->fetchNext(); - - if (empty($res4)) { - $comp = array( - 'computer_id' => $npID, - 'computer_name' => $comp_name, - 'last_mod' => date('Y-m-d', time()) - ); - return Database::getInstance()->insert(CRMADATBAZIS . ".computers", $comp, 'sss'); - } else { - if (empty($comp_name)) { //- ha nincs szamitogep nev, akkor nem kell updatelni - Database::getInstance()->update( - CRMADATBAZIS . ".computers", - array( - 'last_mod' => date('Y-m-d', time()) - ), - array('id' => $res4['id']), - 'si' - ); - } else { - Database::getInstance()->update( - CRMADATBAZIS . ".computers", - array( - 'last_mod' => date('Y-m-d', time()), - 'computer_name' => $comp_name - ), - array('id' => $res4['id']), - 'ssi' - ); - } - return $res4['id']; - } - } - - public static function GetDealers() - { - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`distributors` d WHERE d.enabled = 1 AND d.ctrID IS NOT NULL AND d.ctrID != 37 ORDER BY d.order DESC, d.name ASC"; - Database::getInstance()->query($query); - $res = Database::getInstance()->fetchAssoc(); - - return $res; - } - - public static function getPackage($year, $language) - { - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`packages` WHERE (year = ? OR year LIKE ?) AND (language = ? OR language LIKE ?) AND enabled = ?"; - Database::getInstance()->query($query, array('ssssi', '*', "%{$year};%", '*', "%{$language};%", 1)); - $res = Database::getInstance()->fetchAssoc(); - - return $res; - } - - public static function AddHardlockComputer($hlnum, $compid, $verid) - { - if ($verid >= 36) { - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`hardlock_computers` WHERE hlNum = ? AND computer_id = ?"; - Database::getInstance()->query($query, array('si', $hlnum, $compid)); - $res = Database::getInstance()->fetchNext(); - - if (empty($res)) { - $comp = array( - 'hlNum' => $hlnum, - 'computer_id' => $compid - ); - Database::getInstance()->insert(CRMADATBAZIS . ".hardlock_computers", $comp, 'si'); - } - } - } - - public static function CheckLanFromPassword($password) - { - $lan = 0; - $lanSign = self::GetLanSignFromPassword($password); - $hlNum = self::GetHlnumFromPassword($password); - - $query = "SELECT hlLan FROM `" . CRMADATBAZIS . "`.`hardlock` WHERE hlNum = ?"; - Database::getInstance()->query($query, array('s', $hlNum)); - $res = Database::getInstance()->fetchNext(); - $users = $res['hlLan']; - - $lan = self::GetLanSignFromLanUserNumber($users); - - if ($lan != $lanSign); //update - } - - public static function GetLanSignFromLanUserNumber($users) - { - $lan = 0; - - if ($users == 0) $lan = 0; - elseif ($users == 1) $lan = 1; - elseif ($users == 2) $lan = 2; - elseif ($users == 3) $lan = 3; - elseif ($users == 4) $lan = 4; - elseif ($users == 5) $lan = 5; - elseif ($users == 10) $lan = 6; - elseif ($users == 15) $lan = 7; - elseif ($users == 20) $lan = 8; - elseif ($users <= 49) $lan = 9; - - return $lan; - } - - public static function AddToDebugTable($message, $session_id = '') - { - $debug = array( - 'data' => $message, - 'insert_date' => date('Y-m-d H:i:s'), - 'session_id' => $session_id - ); - Database::getInstance()->insert(CRMADATBAZIS . ".debug_table", $debug, 'sss'); - } - - public static function AddNonprofit($tomb = array(), $bind_type) - { - Database::getInstance()->insert(CRMADATBAZIS . ".nonprofit", $tomb, $bind_type); - } - - public static function AddHardlock($tomb = array(), $bind_type) - { - Database::getInstance()->insert(CRMADATBAZIS . ".hardlock", $tomb, $bind_type); - } - - public static function AddProgram($tomb = array(), $bind_type) - { - return Database::getInstance()->insert(CRMADATBAZIS . ".h_programs", $tomb, $bind_type); - } - - public static function GetCustomUser($userID) - { - $query = "SELECT * FROM cl_hlusers.custom_login_licenses lic WHERE lic.id = ? LIMIT 1"; - Database::getInstance()->query($query, array('i', $userID)); - $user = Database::getInstance()->fetchNext(); - - return $user; - } - - - - public static function GetRegistration($user, $npid, $isTrial, $ver8and9, $custom) - { - if ($user->serial != '') { - // Ha van a usernek serial-ja, akkor nem kell vele semmit csinalni - $query = "SELECT * FROM cl_hlusers.custom_login_licenses lic WHERE lic.serial = ? AND lic.name = ? LIMIT 1"; - Database::getInstance()->query($query, array('ss', $user->serial, $user->name)); - $checked_user = Database::getInstance()->fetchNext(); - - if ($checked_user) - return $checked_user['id']; - } - - if ($isTrial == 'true') { // Ha trial van, akkor meg kell nezni, hogy van-e trial az adott evhez es emailhez - $query = "SELECT * FROM cl_hlusers.custom_login_licenses lic WHERE lic.email = ? AND ver8and9 = ?"; - Database::getInstance()->query($query, array('si', $user->email, $ver8and9)); - $checked_user = Database::getInstance()->fetchNext(); - - if ($checked_user) // Ha van, visszaadjuk a user ID-t - return $checked_user['id']; - } - - // Uj user letrehozasa - $new_user = array( - "serial" => trim($user->serial), - "name" => $user->name, - "email" => $user->email, - "date" => date('Y-m-d'), - "npid" => $npid, - "ver8and9" => $ver8and9, - "custom_login_id" => $custom, - "custom_id" => $user->crmID - ); - - return Database::getInstance()->insert('cl_hlusers.custom_login_licenses', $new_user, 'sssssiss'); - } - - public static function GetOrGenerateToken($seatID, $nUserID) - { - $date = date('Y-m-d'); - - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`archline_tokens` WHERE seatID = ? AND nUserID = ?"; - Database::getInstance()->query($query, array('si', $seatID, $nUserID)); - $token = Database::getInstance()->fetchNext(); - - if (empty($token)) { - $tokenID = crm_hardlock::generateRandomString(); - - $query = Database::getInstance()->insert( - CRMADATBAZIS . ".archline_tokens", - array( - "tokenID" => $tokenID, - "seatID" => $seatID, - "nUserID" => $nUserID, - "lastValidate" => $date - ), - 'ssis' - ); - } else { - Database::getInstance()->update( - CRMADATBAZIS . ".archline_tokens", - array( - 'lastValidate' => $date - ), - array('tokenID' => $token['tokenID']), - 'ss' - ); - - $tokenID = $token['tokenID']; - } - - return $tokenID; - } - - public static function GetUserIdFromToken($token) - { - if ($token == '') - return false; - - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`archline_tokens` WHERE tokenID = ? LIMIT 1;"; - Database::getInstance()->query($query, array('s', $token)); - $token = Database::getInstance()->fetchNext(); - - return empty($token) ? false : $token['nUserID']; - } - - public static function NotGeneratedNonprofitKeyIntervals($minHlNum, $maxHlNum) - { - $query = "SELECT LEFT(hlNum,6) AS hlNum FROM `cl_hlusers`.`hardlock` WHERE hlNum >= ? AND hlNum < ? ORDER BY hlNum"; - Database::getInstance()->query($query, array('ss', $minHlNum, $maxHlNum)); - $res = Database::getInstance()->fetchAssoc(); - - $allHlNums = range($minHlNum, $maxHlNum); - foreach ($res as $r) $usedHlNums[] = $r['hlNum']; - - $notUsedHlNums = array_diff($allHlNums, $usedHlNums); - - $ranges[] = array(); // initial value - - foreach ($notUsedHlNums as $number) { - $range = array_pop($ranges); - $extend = ($range[1] == $number - 1); - $ranges[] = array($range[0], $extend ? $number : $range[1]); - - if (!$extend) $ranges[] = array($number, $number); - } - - return $ranges; - } - - public static function GenerateNonProfitKeys($mettol, $meddig) - { - if (!empty($meddig)) { - for ($mettol; $mettol <= $meddig; $mettol++) { - $rec = new stdClass(); - $rec->hlNum = $mettol; - $rec->hlLan = 0; - $rec->hlStat = 0; - $rec->hlManID = 36; - $rec->hlTime = date("Y-m-d H:i:s", time()); - $rec->bUjithato = 1; - $rec->product_id = 1; - Database::getInstance()->insert('hardlock', $rec, 'iiiisii'); - } - } elseif (empty($meddig) && !empty($mettol)) { - $rec = new stdClass(); - $rec->hlNum = $mettol; - $rec->hlLan = 0; - $rec->hlStat = 0; - $rec->hlManID = 36; - $rec->hlTime = date("Y-m-d H:i:s", time()); - $rec->bUjithato = 1; - $rec->product_id = 1; - Database::getInstance()->insert('hardlock', $rec, 'iiiisii'); - } - } - - public static function GetTheFirstNotUsedHlNumFromInterval($minHlNum = 0, $maxHlNum = 0) - { - $ret = 0; - if ((int)$minHlNum == 0 || (int)$maxHlNum == 0) return ($ret); - - $query = "SELECT LEFT(hlNum, 6) AS hlNum FROM `" . CRMADATBAZIS . "`.`hardlock` WHERE hlStat != ? AND hlNum >= ? AND hlNum < ? ORDER BY hlNum"; - Database::getInstance()->query($query, array('iis', 0, $minHlNum, $maxHlNum)); - $res = Database::getInstance()->fetchAssoc(); - - if (count($res)) { - $allHlNums = range($minHlNum, $maxHlNum); - foreach ($res as $r) $usedHlNums[] = $r['hlNum']; - - $notUsedHlNums = array_diff($allHlNums, $usedHlNums); - reset($notUsedHlNums); - $ret = current($notUsedHlNums); - } else $ret = 0; - - return $ret; - } - - public static function GetVersion($tomb = array()) - { - $ret = array(); - if (is_array($tomb) && count($tomb)) { - $key = key($tomb); - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`p_versions` WHERE {$key} = ?"; - Database::getInstance()->query($query, array('s', current($tomb))); - $ret = Database::getInstance()->fetchNext(); - - return ($ret); - } - - return ($ret); - } - - public static function _Hibajelento($kuldo, $kulcs, $hiba = "", $arrGCData = array(), $usstatid = NULL, $pwd = "") - { - $tomb = array( - "kulcs" => $kulcs, - "kuldo" => $kuldo, - "leiras" => $hiba, - "statusz" => "uj", - "datum" => date('Y-m-d H:i:s', time()), - "ip" => $_SERVER['REMOTE_ADDR'] - ); - - $bind_type = 'ssssss'; - - if (isset($usstatid) && (int)$usstatid > 0) { - $tomb['usID'] = $usstatid; - $bind_type .= 'i'; - } - - if (isset($pwd) && $pwd != '') { - $tomb['pwd'] = $pwd; - $bind_type .= 's'; - } - - if (count($arrGCData)) { - if (isset($arrGCData['usGCMan'])) { // graphic card manufacture - $tomb['usGCMan'] = trim($arrGCData['usGCMan']); - $bind_type .= 's'; - } - - if (isset($arrGCData['usGCType'])) { // graphic card type - $tomb['usGCType'] = trim($arrGCData['usGCType']); - $bind_type .= 's'; - } - - if (isset($arrGCData['usGCDriverVer'])) { // graphic card driver version - $tomb['usGCDriverVer'] = trim($arrGCData['usGCDriverVer']); - $bind_type .= 's'; - } - } - - Database::getInstance()->insert(CRMADATBAZIS . ".h_aktivalas_infok", $tomb, $bind_type); - } - - public static function startQuery($datas, $secondaryServer = 'false') - { - $time = time(); - $pwd = $datas['pwd']; - $compID = $datas['compID']; - $build = $datas['build']; - $ctrID = $datas['ctrID']; - $telepitesikod = $datas['telepitesikod']; - $osdata = $datas['osdata']; - /*$usGCMan = $datas['usGCMan']; - $usGCType = $datas['usGCType']; - $usGCDriverVer = $datas['usGCDriverVer'];*/ - $npID = $datas['npID']; - $partnerID = $datas['partnerID']; - $name = $datas['name']; - $email = $datas['email']; - $company = $datas['company']; - $phone = $datas['phone']; - $newsletter = $datas['newsletter']; - $reactivationCounter = $datas['reactivationCounter']; - $isTwTw = $datas['isTwTw']; - $ctrname = $datas['ctrname']; - $user_IP = $datas['user_IP']; - $user_lang_db = (isset($datas['lang']) && !empty($datas['lang'])) ? trim($datas['lang']) : 'eng'; - $wt = $datas['wt']; - $seatID = $datas['seatID']; - $floating = $datas['floating']; - $offline = $datas['offline']; - $se = $datas['se']; - $isEmergencyServer = crm_hardlock::isEmergencyServer($secondaryServer); - $error = ''; - $errorDlgFreq = 5; // masodperc - $errorTolerancy = 5; - $floatingError = 5; - $floatingTolerancy = 1440; - $statisticInterval = 10080; - $floatingTryNumber = 1; // probalkozask szama, ha nem tudja elerni a szervert - $parallelDownload = 'true'; - $floatingDecTime = 200; - $fddo = 5; - - $crackedProgram = strpos($osdata, ".gray.") !== false ? true : false; - if ($crackedProgram) { //- 2018-as proragramoktol(nehany 2018-as build nem fut ide be) - /*$crackedProgramDeactivated = false; - if(crm_hardlock::IsCalledFromMyIP()){ - header('Content-Type: text/xml; charset=utf-8'); - header('Content-Disposition: inline; filename=response.xml'); - print '<'.'?'.'xml version="1.0" encoding="UTF-8" standalone="yes"'.'?'.'> - - - /public/support/tips/en/ - - '.$validTelepitesikod.' - true - 0 - false - - - '; - $crackedProgramDeactivated = true; - }*/ - - // A crackelt programok ne menjenek bele a debug_table-be - /*$actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"; - $message = "Crack: ".$decoded." || url: ".$actual_link; - crm_hardlock::AddToDebugTable($message);*/ - - return; // A crackelt programokat nem taroljuk - } - - $validPassword = Codegen::IsValidPassword($pwd); - if ($validPassword) { - $ver8and9 = crm_hardlock::GetVer8And9FromPassword($pwd); - $softwareKey = Codegen::IsSoftwareKey($pwd); // Software kulcs 2019 - - if (!$isEmergencyServer && crm_hardlock::IsProgramExpiredByFixDate($pwd)) { - // A lejart programok ne menjenek be a debug_table-be - /*$message = "Tip error: expired program by IsProgramExpiredByFixDate || password: ".$pwd; - crm_hardlock::AddToDebugTable($message);*/ - - return; - } - } else { - $ver8and9 = 0; - $softwareKey = false; - - $actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"; - $message = "Tip error: invalid password || password: {$pwd} || url: {$actual_link}"; - crm_hardlock::AddToDebugTable($message); - - return; - } - $validTelepitesikod = Codegen::IsValidTimeCode($telepitesikod); - if ($validTelepitesikod || ($validPassword && !$softwareKey)) //- hardware kulcseseten az isid a passwordbol generalhato - $isid = ($softwareKey ? crm_hardlock::GetIsidFromTimeCode($telepitesikod) : substr($pwd, 0, 2) . $ver8and9); - else { - $telepitesikod = ""; - $isid = ""; - } - - $hlNum = crm_hardlock::GetHlnumFromPassword($pwd); - - if ($isEmergencyServer) { - if (!$isTwTw || $isTwTw == 'false') - return; - - $currentDate = new DateTime(); - $currentDate->modify('+10 day'); - $meddig = $currentDate->format('Y-m-d'); - - $napok = Codegen::GetDayInterval(self::getTwTwRootTimeString(), $meddig); - $aktkod = Codegen::GenerateTimeCode($pwd, $isid, $napok); - - if ($softwareKey) { - $utst = time(); - (int)$convertedDay = crm_hardlock::ConvertDay(date('w')); - $tid = (int)($utst / $convertedDay); - - $regenr = crm_hardlock::Yes($utst, 39); - } - - crm_hardlock::secondaryServerLog($pwd, 'startQuery', 'A startQuery lefutott'); - - return array( - 'actCode' => $aktkod, - 'virtualization' => 'true', - 'usstatid' => '', - 'logfilter' => 0, - 'moduleList' => '', - 'hlNum' => $hlNum, - 'regenr' => $regenr, - 'tid' => $tid, - 'isFloating' => $floating, - 'isOffline' => $offline, - 'floatingFreq' => '60', - 'flTolerancy' => $floatingTolerancy, - 'askForPin' => 'false', - 'error' => $error, - 'errorDlgFreq' => $errorDlgFreq, // FD - masodperc - 'errorTolerancy' => $errorTolerancy, - 'floatingError' => $floatingError, - 'floatingTryNumber' => $floatingTryNumber, - 'parallelDownload' => $parallelDownload, - 'floatingDecTime' => $floatingDecTime, // FloatingDecideTimeout - 'fddo' => $fddo - ); - } - - if (!$validPassword && substr($decoded, 0, 2) == "##") { //- 2018-as proragramoktol(nehany 2018-as build nem fut ide be) - $actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"; - $message = "Tip error: missing password || url: {$actual_link}"; - crm_hardlock::AddToDebugTable($message); - } - if ($validPassword && !$validTelepitesikod && $ver8and9 > 35) { //- csak a 2019-es programokat es ujabbakat vizsgalunk, a regbbiekben elofordulhatnak hibas idokodok - $actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"; - $message = "Tip error: invalid timecode {$decoded} || url: {$actual_link}"; - crm_hardlock::AddToDebugTable($message); - } - - if (isset($npID)) $compid = crm_hardlock::AddOrUpdateComputer($npID, ''); - - $isNamirialAutoCreate = isset($npID) && $npID > '' && isset($partnerID) && $partnerID == '2nt' /*-&& isset($telepitesikod) && $telepitesikod>''-*/ && $validPassword; - $isBimLadderAutoCreate = isset($npID) && $npID > '' && isset($partnerID) && $partnerID == 'kbl' /*-&& isset($telepitesikod) && $telepitesikod>''-*/ && $validPassword; - - /******************************************************************************* - *NAMIRIAL vagy BIMLADDER automata kulcskiadás és program létrehozás - ******************************************************************************/ - if ($isNamirialAutoCreate || $isBimLadderAutoCreate) { - $queryStr = "SELECT hlID FROM `" . CRMADATBAZIS . "`.`nonprofit` WHERE computer_id = ? AND partnerID = ? AND verID = ?"; - Database::getInstance()->query($queryStr, array('isi', $compid, $partnerID, $ver8and9)); - $res = Database::getInstance()->fetchNext(); - - $rangeMin = $isNamirialAutoCreate ? 940001 : 920001; - $rangeMax = $isNamirialAutoCreate ? 949999 : 929999; - $interval = $isNamirialAutoCreate ? 90 : 30; - $country_id = $isNamirialAutoCreate ? 39 : 82; - $topic_id = $isNamirialAutoCreate ? 366 : 368; - $info = $isNamirialAutoCreate ? 'Namirial nonprofit kulcs aktiválás' : 'BIMLadder nonprofit kulcs aktiválás'; - $contact = $isNamirialAutoCreate ? 8 : 9; - $fizetve = $time + $interval * 86400; - - if ($isTwTw) { // Az engedelyezett napok szamat konvertalni kell TWTW eseten - $interval = Codegen::GetDayInterval(crm_hardlock::getTwTwRootTimeString(), date('Y-m-d', $fizetve)); - } - - $type = crm_hardlock::GetTypeFromPassword($pwd); - $ver = crm_hardlock::GetVersion(array('verPassword8and9' => $ver8and9)); - - //ba nincs ehhez a gephez meg non-profit program regisztralva - if (empty($res)) { - $hlNum = crm_hardlock::GetTheFirstNotUsedHlNumFromInterval($rangeMin, $rangeMax); - $pass = Codegen::GeneratePassword($hlNum, 0, $type, $ver['verCode']); - $aktKod = Codegen::GenerateTimeCode($pass, $isid, $interval); - - // Ha nincs benne a user a CRM-be, akkor hozza adjuk - $userID = crm_users::AddUser( - array( - 'strName' => $name, - 'strEMail' => $email, - 'strTel' => $phone, - 'nCtrID' => $country_id, - 'old_db' => 'clusers_eng', - 'dateInsert' => $time, - 'strCompany' => $company, - 'nUserType' => 2 - ), - $newsletter, - 'sssisssi' - ); - - //ba regisztraljuk hozza a non-profit programot - crm_hardlock::AddNonprofit( - array( - 'isid' => $isid, - 'verid' => $ver8and9, - 'hlID' => $hlNum, - 'nUserID' => $userID, - 'add_datetime' => date('Y-m-d H:i:s', $time), - 'expire_datetime' => date('Y-m-d H:i:s', strtotime('+90 day', $time)), - 'activation_datetime' => date('Y-m-d H:i:s', $time), - 'old_db' => 'clusers_eng', - 'partnerID' => $partnerID, - 'enabled' => 'Y', - 'computer_id' => $compid - ), - 'sisissssssi' - ); - - //Namirial vagy BIMLADDER non-profit kod aktivalas beszurasa crm -> u_history tablaba - crm_users::AddUserHistory(array( - 'nUserID' => $userID, - 'nTopicID' => $topic_id, - 'dateEvent' => date('Y-m-d H:i:s', $time), - 'strPlace' => '', - 'strInfo' => $info, - 'nManagerID' => 36, - 'insertDate' => date('Y-m-d H:i:s', $time) - )); - - crm_hardlock::AddHardlock( - array( - 'hlNum' => $hlNum, - 'hlCtrID' => $country_id, - 'hlLan' => 0, - 'hlStat' => 1, - 'hlDateIssue' => date('Y-m-d', $time), - 'hlManID' => 36, - 'hlTime' => date('Y-m-d H:i:s', $time), - 'hlUser' => $userID, - 'hlDealer' => 62103, - 'bUjithato' => 1, - 'old_db' => 'clusers_eng' - ), - 'siiisissiis' - ); - - crm_hardlock::AddProgram( - array( - 'prTypeID' => $type, - 'prVerID' => $ver['verID'], - 'prLan' => 0, - 'prPass' => trim($pass), - 'prSellDate' => date('Y-m-d', $time), - 'prActDate' => date('Y-m-d', $fizetve), // 90 vagy 30 nap - 'prFizetve' => date('Y-m-d', $fizetve), - 'prActCode' => trim($aktKod), - 'prTime' => date('Y-m-d H:i:s', $time), - 'prLastMod' => date('Y-m-d H:i:s', $time), - 'prContact' => $contact, // Non-profit - 'prHlNum' => $hlNum, // 99xxxx - 'prManID' => 36, // web - 'prStat' => 0, - 'prHiType' => 1, // 1 Rendelés | 2 Tipus Valtas | 3 Frissites | 4 Auto Friss. - 'twtw' => $isTwTw ? 1 : 0 - ), - 'iiisssssssisiiii' - ); - - $pwd = $pass; //ba 2018.07.02. mostantol az uj jelszava a usernek a most generalt, 94-es lesz, nem pedig a 93-as! - } else { - //ba ehhez a gephez mar volt non-profit regisztracio, keressuk ki a sorozatszamot neki - $hlNum = $res['hlID']; - $query = "SELECT prPass FROM `" . CRMADATBAZIS . "`.`h_programs` WHERE prHlNum = ?"; - Database::getInstance()->query($query, array('s', $hlNum)); - $programQuery = Database::getInstance()->fetchNext(); - $pwd = $programQuery['prPass']; - } - } //- if ($isNamirialAutoCreate || $isBimLadderAutoCreate) vege - - //insert stats to the userstats table - $stats = array( - 'usLang' => $user_lang_db, - 'usDate' => time(), - 'usPwd' => $pwd, - 'usVer' => $ver8and9, - 'usCompID' => $compID, - 'usCtrID' => $ctrID, - 'usBuild' => $build, - 'usCtrName' => $ctrname, - 'usIP' => $user_IP, - 'usOSData' => $osdata, - 'usISID' => $isid, - 'usInditasokSzama' => 1 - ); - - $query = "SELECT hlLan, hlCtrID, hlStat, hlUser, isFloating FROM `" . CRMADATBAZIS . "`.`hardlock` WHERE hlNum = ?"; - Database::getInstance()->query($query, array('s', $hlNum)); - $hardlock = Database::getInstance()->fetchNext(); - - $isLanProgram = !empty($hardlock) && $hardlock['hlLan'] > 0; - - // A szarmazasi orszag beallitasa - if ($softwareKey) { - if (!empty($hardlock)) { // Azok a programok, amik regisztrálódnak a CRM-ben 2019 - if (isset($hardlock['hlCtrID'])) $stats['usHlCtrID'] = $hardlock['hlCtrID']; - } - } else { - $stats['usHlCtrID'] = substr($pwd, 0, 2); - } - - $trialProgram = crm_hardlock::IsTrialKey($pwd); - $trialSpecialEditionProgram = $trialProgram ? crm_hardlock::IsSpecialEditionTrial($pwd) : false; - - // Kereskedelmi valtozatok lekezelese (a statisztika miatt bekerulnek a Namirial es a BIMLadder programok is) - if ($ver8and9 > 29 && (!$trialProgram || $trialSpecialEditionProgram)) { - if (!$trialSpecialEditionProgram) { - $binding = array('s', $pwd); - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`h_programs` WHERE prPass = ?"; - if ($softwareKey && $isLanProgram) { //- szoftveres lan kulcsnal mindig telepitesenkent egyedi az aktivalo kod - $query .= " AND prActCode LIKE ?"; - $binding = array('ss', $pwd, "%-{$isid}-%"); - } - Database::getInstance()->query($query, $binding); - $prgrm = Database::getInstance()->fetchNext(); - - if (empty($prgrm) && $softwareKey && $isLanProgram) { //- a lan-os valtozatnal na nem volt telepitve lehet, hogy nem volt talalat - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`h_programs` WHERE prPass = ? AND (prActCode = '' OR prActCode IS NULL)"; - Database::getInstance()->query($query, array('s', $pwd)); - $prgrm = Database::getInstance()->fetchNext(); - } - } - - if ($softwareKey) { //- a telepitesi datum frissitese - if ($validTelepitesikod) //- telepitesi datum tarolasanak elokeszitese - $installDate = crm_hardlock::GetInstallationDateFromInstallationCode($telepitesikod, $isTwTw); - else - $installDate = time(); - } else { - if (empty($prgrm)) $installDate = time(); //- todo ez gigantikus hiba, jelezni kell, ha ilyen elofordul - else $installDate = $prgrm['prSellDate']; - } - - $stats['usTelepitesiDatum'] = $installDate; - $stats['workingMinutes'] = $wt; - - if (!empty($prgrm)) $jelenlegi_aktivalokod = $prgrm['prActCode']; - else $jelenlegi_aktivalokod = ''; - - //- idokod generalasa - if ($isTwTw) $aktivalokod = crm_hardlock::GetOrGenerateTimeCodeTWTW($pwd, $isid, $telepitesikod, $npID, '', $seatID, $build); - else $aktivalokod = crm_hardlock::GetOrGenerateTimeCode($pwd, $isid, $telepitesikod, $npID); - - // A userstats2013 tablaba megkeresi az utolso bejegyzest és amennyiben valtozatlan, updateli az inditasok szamat, különben uj bejegyzést hoz letre - if (!$trialSpecialEditionProgram) { - $usstatid = crm_hardlock::UpdateInstallationDate($pwd, $compID, $build, $aktivalokod, $user_IP, $installDate, $stats); - } else { - // Nem irjuk vissza a generalt kodot - $usstatid = crm_hardlock::UpdateInstallationDate($pwd, $compID, $build, $jelenlegi_aktivalokod, $user_IP, $installDate, $stats); - } - - $virtualization = ($hardlock['hlStat'] == '2' ? "false" : "true"); // letiltott kulcs visszajelzése a programnak - - $valasz = ($aktivalokod != "") ? $aktivalokod : "(( nem kapott valaszt ))"; - - if (($valasz == "(( nem kapott valaszt ))" && substr($pwd, 0, 2) != 39) || strpos($valasz, 'error') !== false) { - $query = "SELECT id FROM `" . CRMADATBAZIS . "`.`hibajelento` WHERE pwd = ? ORDER BY datum DESC"; - Database::getInstance()->query($query, array('s', $pwd)); - $res = Database::getInstance()->fetchNext(); - - if (!empty($res)) { - Database::getInstance()->update( - CRMADATBAZIS . ".hibajelento", - array( - 'error' => $valasz, - 'datum' => date('Y-m-d H:i:s', time()) - ), - array('id' => $res['id']), - 'ssi' - ); - } else { - $query = Database::getInstance()->insert( - CRMADATBAZIS . ".hibajelento", - array( - "error" => $valasz, - "datum" => date('Y-m-d H:i:s', time()), - "pwd" => $pwd - ), - 'sss' - ); - } - - $floatingAktivalasihiba = crm_hardlock::GetActivationError(11); - if ($floatingAktivalasihiba == $aktivalokod && $hardlock['hlLan'] <= 1) { - $query = "SELECT c.custom_name AS custom_name, c.computer_name AS computer_name - FROM `" . SYNCADATBAZIS . "`.`floating_licenses` f - LEFT JOIN cl_hlusers.computers c ON c.id = f.computer_id - WHERE f.hlNum = ? - LIMIT 1"; - Database::getInstance()->query($query, array('s', $hlNum)); - $computer = Database::getInstance()->fetchNext(); - if (!empty($computer) && count($computer) > 0) { - $resource = new Resource($ctrID); - $compName = $computer['custom_name'] != '' ? $computer['custom_name'] : $computer['computer_name']; - - if ($compName == '') { - $compName = $resource->getDlgString(11812); - } - - $error = $compName; - } - } - } - } - - if ($aktivalokod != '') { - $query = "SELECT prID, prLogFilter, prVerID FROM `" . CRMADATBAZIS . "`.`h_programs` WHERE prPass = ? AND prActCode = ?"; - Database::getInstance()->query($query, array('ss', $pwd, $aktivalokod)); - $programs = Database::getInstance()->fetchNext(); - - if (empty($programs)) { - $query = "SELECT prID, prLogFilter, prVerID FROM `" . CRMADATBAZIS . "`.`h_programs` WHERE prPass = ?"; - Database::getInstance()->query($query, array('s', $pwd)); - $programs = Database::getInstance()->fetchNext(); - } - } else { - $query = "SELECT prID, prLogFilter, prVerID FROM `" . CRMADATBAZIS . "`.`h_programs` WHERE prPass = ?"; - Database::getInstance()->query($query, array('s', $pwd)); - $programs = Database::getInstance()->fetchNext(); - } - - // Tavoli logolasi parameterek beallitasa - $logfilter = 0; - if ($validPassword && !$crackedProgram && !$trialProgram) $logfilter = $programs['prLogFilter']; - - // Ha a verid >= 36, akkor beinsertalja a hardlockot és a computer id-t a hardlock_computers tablaba, ha meg nincs benne - if ($softwareKey && !$crackedProgram && !$trialProgram) crm_hardlock::AddHardlockComputer($hlNum, $compid, $ver8and9); - - // Kulcsok tesztelese - if ($softwareKey && !$crackedProgram && !$trialProgram) { - $valasz = crm_hardlock::sCheckPassword($pwd); - - if (!empty($valasz)) { - $actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"; - $message = "Checked Password || Serial: {$pwd} || Valasz: {$valasz} || url: {$actual_link}"; - crm_hardlock::AddToDebugTable($message, $pwd); - } - } - - // Modul es reaktivalo kodok kiiratasa - if (!$crackedProgram && !$trialProgram) { - // Modul kodok osszegyujtese - $moduleList = ""; - if (!empty($programs)) { - $query = "SELECT mdCode FROM `" . CRMADATBAZIS . "`.`p_modules` WHERE mdPrID = ?"; - Database::getInstance()->query($query, array('i', $programs['prID'])); - $modules = Database::getInstance()->fetchAssoc(); - - if (!empty($modules)) { - foreach ($modules as $module) { - if (!empty($moduleList)) $moduleList .= ";"; - - $moduleList .= $module['mdCode']; - } - } - } - - // Reaktivalokodok kuldese - if ($virtualization == "true" && $reactivationCounter > 0) { - $reactivationCounter--; - $modulIsid = substr($pwd, 0, 2) . $ver8and9; - - if ($reactivationCounter > 4) $reactivationCounter = 4; // 5-nel tobb nem lehet - - for ($i = 0; $i <= $reactivationCounter; $i++) { - $modulID = 35 + $i; - $reactivationCode = Codegen::GenerateTimeCode($pwd, $modulIsid, $modulID); - - if (!empty($moduleList)) $moduleList .= ";"; - - $moduleList .= $reactivationCode; - } - } - } - - if ($softwareKey) { - $utst = time(); - (int)$convertedDay = crm_hardlock::ConvertDay(date('w')); - $tid = (int)($utst / $convertedDay); - - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`p_serial_isid` WHERE serial = ? AND isid = ? AND aktiv = ?"; - Database::getInstance()->query($query, array('ssi', $pwd, $isid, 1)); - $p_serial_isid = Database::getInstance()->fetchAssoc(); - - if (empty($p_serial_isid)) $regenr = crm_hardlock::No($utst, 39); - else $regenr = crm_hardlock::Yes($utst, 39); - } - - $isOffline = 'false'; - $isFloating = $hardlock['isFloating'] == 1 && $programs['prVerID'] >= 23; - - if ($isFloating && $programs['prVerID'] == 23 && $build < 255) - $isFloating = false; - - $floatingFreq = 'false'; - $askForPin = 'false'; - - if ($isFloating) { - $query = "SELECT * FROM `" . SYNCADATBAZIS . "`.`floating_licenses` WHERE hlNum = ? AND seatID = ?"; - Database::getInstance()->query($query, array('ss', substr($pwd, 0, 6), $seatID)); - $floatingLic = Database::getInstance()->fetchNext(); - - if (!empty($floatingLic) && $floatingLic['offline_expiration_date'] != '' && $floatingLic['offline_expiration_date'] >= date('Y-m-d')) { - $isOffline = 'true'; - } else { - if ($floatingLic['offline_expiration_date'] != '') { - Database::getInstance()->update( - SYNCADATBAZIS . ".floating_licenses", - array( - 'offline_expiration_date' => '' - ), - array('seatID' => $seatID), - 'ss' - ); - } - } - - $floatingFreq = 60; - - $pinEnabled = crm_hardlock::needPin(substr($pwd, 0, 6)); - if ($pinEnabled) { - $askForPin = crm_hardlock::askForPin(substr($pwd, 0, 6), $seatID) ? 'true' : 'false'; - } - - if ($askForPin == 'true') { - $floatingTolerancy = 1; - $errorTolerancy = 1; - } - - if (substr($pwd, 0, 6) == '992313' || substr($pwd, 0, 6) == '991319') { - $floatingFreq = 1; - $floatingTolerancy = 30; - $errorTolerancy = 1; - } - } - - if ($trialProgram && $ver8and9 >= 41) { - $query = "SELECT id, versionInfo FROM local_crm.trial_requests WHERE seatID = ?;"; - Database::getInstance()->query($query, array('s', $seatID)); - $trialUser = Database::getInstance()->fetchNext(); - - if (!empty($trialUser)) { - $prod = 1; - if ($se == 'LT') $prod = 0; - if (crm_hardlock::IsLiveKey($pwd)) $prod = 2; - - $product = crm_hardlock::getProduction($se, $prod); - $versionInfoArray = json_decode(stripslashes($trialUser['versionInfo']), true); - $currentVersionInfo = $versionInfoArray[$product]; - $currentVersion = $currentVersionInfo[$ver8and9]; - - if ($currentVersion != null) { - $versionInfoArray[$product][$ver8and9]['count']++; - - $versionInfo = json_encode($versionInfoArray); - - Database::getInstance()->update( - "local_crm.trial_requests", - array( - 'versionInfo' => $versionInfo, - 'update_date' => date('Y-m-d H:i:s') - ), - array('seatID' => $seatID), - 'sss', - false - ); - } - } - } - - return array( - 'actCode' => $aktivalokod, - 'virtualization' => $virtualization, - 'usstatid' => $usstatid, - 'logfilter' => $logfilter, - 'moduleList' => $moduleList, - 'hlNum' => $hlNum, - 'regenr' => $regenr, - 'tid' => $tid, - 'isFloating' => $isFloating ? 'true' : 'false', - 'isOffline' => $isOffline, - 'floatingFreq' => $floatingFreq, - 'flTolerancy' => $floatingTolerancy, - 'askForPin' => $askForPin, - 'error' => $error, - 'errorDlgFreq' => $errorDlgFreq, // FD - masodperc - 'errorTolerancy' => $errorTolerancy, // FDT - 'floatingError' => $floatingError, // FE - 'statisticInterval' => $statisticInterval, // SI - masodperc - 'floatingTryNumber' => $floatingTryNumber, - 'parallelDownload' => $parallelDownload, - 'floatingDecTime' => $floatingDecTime, // FloatingDecideTimeout - 'fddo' => $fddo - // Ha felveszunk egy uj parametert, akkor az emergency servernel is fel kell venni! - ); - } - - public static function needPin($hlNum) - { - $query = "SELECT * FROM sync_crm.hardlock_ext WHERE hlNum = ?"; - Database::getInstance()->query($query, array('s', $hlNum)); - $pinEnabled = Database::getInstance()->fetchNext(); - - return !empty($pinEnabled); - } - - public static function askForPin($hlNum, $seatID) - { - $query = "SELECT * FROM local_crm.hardlock_ext WHERE hlNum = ? AND seatIDs LIKE ?"; - Database::getInstance()->query($query, array('ss', $hlNum, '%' . $seatID . '%')); - $localHardlockExt = Database::getInstance()->fetchNext(); - - return empty($localHardlockExt); - } - - public static function getProduction($se, $prod) - { - $prod = $se == 'LT' ? 0 : (int)$prod; - switch ($prod) { - case 0: - $product = 'lt'; - break; - - case 1: - $product = 'professional'; - break; - - default: - $product = 'live'; - break; - } - - return $product; - } - - public static function getTrialEmailBody($ctrID, $name, $email, $phone, $distributor, $product, $year) - { - if ($ctrID == '36') { - $body = " - Kedves {$name}! -

- - Azért kaptad ezt az e-mailt, mert a(z) " . $email . " fiókodról kérést kaptunk az ARCHLine.XP ingyenes próbaverziójának elindítására. -
- A 30 napos próbaidőszak most kezdődik. -

- - Hogyan válhatsz magabiztos felhasználóvá? -
- Fedezd fel tanfolyamainkat, ahol alap-, közép- és felsőfokon sajátíthatod el az ONLINE anyagok segítségével az ARCHLine.XP program tudását. -
- Tanfolyamok - Oktató videók -

- - Az ARCHLine.XP egy innovatív 3D CAD / BIM tervezőszoftver, mely alkalmas építészeti és belsőépítészeti projektek megtervezésére, illetve a teljes műszaki dokumentáció elkészítésére. A munkát a fotórealisztikus látványtervek teszik egésszé, igény esetén animációkkal kiegészítve. -
- Egy terv létrehozásakor alaprajzokkal, metszetekkel, homlokzatokkal, nézetekkel, tervlapokkal, kimutatásokkal dolgozunk egyszerre. Az ARCHLine.XP-vel készített BIM-projektek teljes mértékben koordináltak, nem igényelnek manuális frissítéseket a szinkronizáláshoz. Ez hatékonyabb munkafolyamatot tesz lehetővé. -

- - Név: {$name}
- Email: {$email}
- Mobil: {$phone}
- Chosen Distributor: {$distributor}
- Termék: {$product}
- Verzió: {$year} -

- - Üdvözlettel,
- ARCHLine.XP Team - "; - } else { - $body = " - Dear {$name} -

- - ARCHLine.XP is a BIM (Building Information Modeling) architectural and interior design software that provides easy collaboration with IFC, DWG and RVT formats. -

- - Your 30 days of trial period starts now. -

- - Get started with ARCHLine.XP: -

- - Quick Start Guide - Core concepts and tools (archlinexp.com) -

- - Converting the 2D room plan into 3D (archlinexp.com) -

- - You receive this email because we received a request to start ARCHLine.XP free trial from your account {$email} -

- - Name: {$name}
- Email: {$email}
- Phone: {$phone}
- Chosen Distributor: {$distributor}
- Product: {$product}
- Version: {$year} -

- - Thanks,
- ARCHLine.XP Team - "; - } - - return $body; - } - - public static function sentTrialEmail($email, $name, $phone, $distributor, $product, $year, $subject, $ctrID) - { - require_once($_SERVER['DOCUMENT_ROOT'] . '/maintenance/libraries/phpmailer/PHPMailerAutoload.php'); - require_once($_SERVER['DOCUMENT_ROOT'] . '/maintenance/config.mail.php'); - - $mail = new PHPMailer(); - $mail->CharSet = 'UTF-8'; - $mail->Host = $mailconfig['Host']; - $mail->SMTPAuth = true; - - $mail->Username = $mailconfig['Username']; - $mail->Password = $mailconfig['Password']; - - $mail->From = 'info@archlinexp.com'; - $mail->FromName = 'www.archlinexp.com'; - $mail->AddAddress($email, $name); - - $mail->IsHTML(true); - - $mail->Subject = $subject; - $mail->Body = crm_hardlock::getTrialEmailBody($ctrID, $name, $email, $phone, $distributor, $product, $year); - - $mail->Send(); - } - - public static function InsertLog($password) - { - $query = "SELECT prLogFilter FROM `" . CRMADATBAZIS . "`.`h_programs` WHERE prPass = ?"; - Database::getInstance()->query($query, array('s', $password)); - $programQuery = Database::getInstance()->fetchNext(); - if (!empty($programQuery)) { - $log = $programQuery['prLogFilter']; - - if ($log == 720895) { - $actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"; - - crm_hardlock::AddToDebugTable($actual_link, $password); - } - } - } - - public static function getFloatingLic($serial, $seatID) - { - $query = "SELECT * FROM `" . SYNCADATBAZIS . "`.`floating_licenses` WHERE seatID = ? AND hlNum = ?"; - Database::getInstance()->query($query, array('ss', $seatID, substr($serial, 0, 6))); - - return Database::getInstance()->fetchNext(); - } - - public static function floatingUnlock($serial, $seatID, $offlineDelete = false) - { - $hlNum = substr($serial, 0, 6); - $cadlineKeys = array('950521', '950298', '950124', '992313', '951399', '953091'); - - $query = "SELECT * FROM `" . SYNCADATBAZIS . "`.`floating_licenses` WHERE seatID = ?"; - Database::getInstance()->query($query, array('s', $seatID)); - $key = Database::getInstance()->fetchNext(); - - if (empty($key)) { - return; - } - - if (!$offlineDelete && $key['offline_expiration_date'] != '') { - return; - } - - if ($hlNum != $key['hlNum']) { - crm_hardlock::AddToDebugTable("floatingUnlock(): Masik licenc van a seatID-hoz rogzitve. seatID: {$seatID}, serial: {$serial}"); - - if (in_array($hlNum, $cadlineKeys)) { - crm_hardlock::AddToDebugTable("floatingUnlock(): Masik licenc van a seatID-hoz rogzitve. seatID: {$seatID}, serial: {$serial}", "CADLine_TEST"); - } - } else { - if (in_array($hlNum, $cadlineKeys)) { - crm_hardlock::AddToDebugTable("floatingUnlock(): DELETE begin. seatID: {$seatID}, serial: {$serial}", "CADLine_TEST"); - } - - $query = "DELETE FROM `" . SYNCADATBAZIS . "`.`floating_licenses` WHERE seatID = ?"; - Database::getInstance()->query($query, array('s', $seatID)); - - if (in_array($hlNum, $cadlineKeys)) { - crm_hardlock::AddToDebugTable("floatingUnlock(): DELETE end. seatID: {$seatID}, serial: {$serial}", "CADLine_TEST"); - } - } - - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`p_serial_isid` WHERE serial = ? AND computer_id = ?"; - Database::getInstance()->query($query, array('si', $serial, $key['computer_id'])); - $p_serial_isid = Database::getInstance()->fetchNext(); - - Database::getInstance()->insert( - 'local_crm.floating_log', - array( - "seatID" => $seatID, - "hlNum" => $hlNum, - "inserted" => date('Y-m-d H:i:s'), - "isid" => $p_serial_isid['isid'], - "eventID" => 2, - "computerID" => $key['computer_id'] - ), - 'ssssii' - ); - } - - public static function generateDownloadUrl($url, $year, $isLT) - { - $newUrl = str_replace("{YEAR}", $year, $url); - $newUrl = str_replace("{IS_LT}", $isLT, $newUrl); - - return $newUrl; - } - - public static function getMirrorLinks() - { - $query = "SELECT * FROM local_crm.mirror_links WHERE id > 1 ORDER BY ordering"; - Database::getInstance()->query($query); - return Database::getInstance()->fetchAssoc(); - } - - public static function floatingLock($serial, $seatID, $computerID, &$error = '') - { - $hlNum = substr($serial, 0, 6); - $cadlineKeys = array('950521', '950298', '950124', '992313', '951399', '953091'); - - $isPinEntered = crm_hardlock::needPin(substr($serial, 0, 6)) == false || crm_hardlock::askForPin(substr($serial, 0, 6), $seatID) == false; - - $query = "SELECT * FROM `" . SYNCADATBAZIS . "`.`floating_licenses` WHERE seatID = ?"; - Database::getInstance()->query($query, array('s', $seatID)); - $key = Database::getInstance()->fetchNext(); - - if (!empty($key)) { - if ($key['hlNum'] == $hlNum) { - if ($isPinEntered) { // If the pin is not entered not allowed to register the floating license - Database::getInstance()->update( - SYNCADATBAZIS . ".floating_licenses", - array( - 'modified' => date('Y-m-d H:i:s') - ), - array('seatID' => $seatID), - 'ss' - ); - } - - return true; - } else { - $error = Floating_Error::DIFFERENT_LICENSE_ON_THE_SAME_COMPUTER; - - if (in_array($hlNum, $cadlineKeys)) { - crm_hardlock::AddToDebugTable("floatingLock(): Floating_Error::DIFFERENT_LICENSE_ON_THE_SAME_COMPUTER. seatID: {$seatID}, serial: {$serial}", "CADLine_TEST"); - } - return false; - } - } - - $query = "SELECT * FROM `" . SYNCADATBAZIS . "`.`floating_licenses` WHERE hlNum = ?"; - Database::getInstance()->query($query, array('s', $hlNum)); - $key = Database::getInstance()->fetchAssoc(); - - if (!empty($key)) { - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`hardlock` WHERE hlNum = '{$hlNum}'"; - crm_database::getInstance()->query($query); - $hardlock = crm_database::getInstance()->fetchNext(); - - if ($hardlock['hlLan'] <= 1 || count($key) >= $hardlock['hlLan']) { - $error = Floating_error::LIMIT_REACHED; - - if (in_array($hlNum, $cadlineKeys)) { - $seatIdError = $hardlock['hlLan'] <= 1 ? 'A kulcs ehhez a seatID-hoz tartozik: ' . $key[0]['seatID'] : ''; - crm_hardlock::AddToDebugTable("floatingLock(): Floating_error::LIMIT_REACHED. seatID: {$seatID}, serial: {$serial} || {$seatIdError}", "CADLine_TEST"); - } - return false; - } - } - - try { - if ($isPinEntered) { // If the pin is not entered not allowed to register the floating license - Database::getInstance()->insert( - SYNCADATBAZIS . '.floating_licenses', - array( - "seatID" => $seatID, - "hlNum" => $hlNum, - "modified" => date('Y-m-d H:i:s'), - "computer_id" => $computerID - ), - 'sssi' - ); - } - } catch (\Exception $e) { - $query = "SELECT * FROM `" . SYNCADATBAZIS . "`.`floating_licenses` WHERE seatID = ?"; - Database::getInstance()->query($query, array('s', $seatID)); - $key = Database::getInstance()->fetchNext(); - - if (empty($key)) { - $insertDate = 'not inserted'; - } else { - $insertDate = $key['modified']; - } - - $modified = date('Y-m-d H:i:s'); - - crm_hardlock::AddToDebugTable("floatingLock(): Floating_Error::INSERT_EXCEPTION. seatID: {$seatID}, serial: {$serial}, inserted: {$insertDate}, modified: {$modified}", "CADLine_TEST"); - } - - if ($isPinEntered) { - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`p_serial_isid` WHERE serial = ? AND computer_id = ?"; - Database::getInstance()->query($query, array('si', $serial, $computerID)); - $p_serial_isid = Database::getInstance()->fetchNext(); - - Database::getInstance()->insert( - 'local_crm.floating_log', - array( - "seatID" => $seatID, - "hlNum" => $hlNum, - "inserted" => date('Y-m-d H:i:s'), - "isid" => $p_serial_isid['isid'], - "eventID" => 1, - "computerID" => $computerID - ), - 'ssssii' - ); - } - - return true; - } - - public static function activeFloating($password, $isid) - { - $hlNum = substr($password, 0, 6); - - $query = "SELECT computer_id FROM `" . CRMADATBAZIS . "`.`p_serial_isid` WHERE serial = ? AND isid = ?"; - Database::getInstance()->query($query, array('ss', $password, $isid)); - $p_serial_isid = Database::getInstance()->fetchNext(); - - if (empty($p_serial_isid)) - return false; - - $query = "SELECT seatID FROM `" . SYNCADATBAZIS . "`.`floating_licenses` WHERE hlNum = ? AND computer_id = ?"; - Database::getInstance()->query($query, array('si', $hlNum, $p_serial_isid['computer_id'])); - $floatingLic = Database::getInstance()->fetchNext(); - - return !empty($floatingLic) ? $floatingLic['seatID'] : false; - } - - public static function getTrialRequest($seatID) - { - $query = "SELECT * FROM `local_crm`.`trial_requests` WHERE seatID = ? ORDER BY id DESC LIMIT 1;"; - Database::getInstance()->query($query, array('s', $seatID)); - $trialRequest = Database::getInstance()->fetchNext(); - - return $trialRequest; - } - - public static function checkCaptcha($response) - { - $secret = ''; - - if ($_SERVER['SERVER_NAME'] == 'www.archline.hu') - $secret = '6Lc8nh8TAAAAALeRGLDbjsr7Rh1qpQJkYXYO-P50'; - else - $secret = '6LeqnB8TAAAAAJTatP1dt8npqwDfJLz4_i9-rbNg'; - - $post_data = http_build_query( - array( - 'secret' => $secret, - 'response' => $response, - 'remoteip' => $_SERVER['REMOTE_ADDR'] - ) - ); - - $opts = array( - 'http' => - array( - 'method' => 'POST', - 'header' => 'Content-type: application/x-www-form-urlencoded', - 'content' => $post_data - ) - ); - - $context = stream_context_create($opts); - - $response = file_get_contents('https://www.google.com/recaptcha/api/siteverify', false, $context); - $result = json_decode($response); - - return $result->success; - } - - public static function isFloating($password) - { - $hlNum = substr($password, 0, 6); - - $query = "SELECT isFloating FROM `" . CRMADATBAZIS . "`.`hardlock` WHERE hlNum = ?"; - Database::getInstance()->query($query, array('s', $hlNum)); - $hardlock = Database::getInstance()->fetchNext(); - - $query = "SELECT prID, prLogFilter, prVerID FROM `" . CRMADATBAZIS . "`.`h_programs` WHERE prPass = ?"; - Database::getInstance()->query($query, array('s', $password)); - $programs = Database::getInstance()->fetchNext(); - - return $hardlock['isFloating'] == 1 && $programs['prVerID'] >= 23; - } - - public static function convertFloatingErrorCodeToString($floatingErrorCode, $verID, $build) - { - $floatingError = ''; - switch ($floatingErrorCode) { - case Floating_Error::DIFFERENT_LICENSE_ON_THE_SAME_COMPUTER: - if ($verID >= 24) { - $floatingError = 'error: unable to lock floating 2'; - } else { - $floatingError = 'error: unable to lock floating license'; - } - break; - - case Floating_Error::LIMIT_REACHED: - default: - $floatingError = 'error: unable to lock floating license'; - break; - } - - return $floatingError; - } - - public static function FindTimeCode($serial, $isid, $telepitesikod, $isTimeCodeSendingEnabled, $isTwTw = false, $seatID = '', $build = '', $floatingLockAllowed = true) - { - $hasEmptyKey = false; - - // van-e olyan aktiv program aminek ez a sorozatszama // a/b kulcsok miatt - $query = "SELECT prID, prStat, prActCode, prSellDate, twtw, prVerID FROM `" . CRMADATBAZIS . "`.`h_programs` WHERE prPass = ?"; - Database::getInstance()->query($query, array('s', $serial)); - $programs = Database::getInstance()->fetchAssoc(); - - if (!$programs) return "error: nincs ilyen password"; - - $query = "SELECT hlStat, hlID, hlDatePro, isFloating FROM `" . CRMADATBAZIS . "`.`hardlock` WHERE hlNum = ?"; - Database::getInstance()->query($query, array('s', substr($serial, 0, 6))); - $key = Database::getInstance()->fetchNext(); - - if ( - $key['hlStat'] == 0 || //- ures kulcs - ($key['hlStat'] == 2 && ($key['hlDatePro'] != '0000-00-00' && $key['hlDatePro'] != NULL && $key['hlDatePro'] != '')) //- letiltott kulcs - ) { // a kulcs aktiv-e - $valasz = "error: nem aktiv a program"; - } else { // egyeb hiba - if ($key['hlID'] == 64300 || $key['hlID'] == 64897) //ba Namirial Trial program kulcsa es BIMLadder program kulcsa - return "error: hianyzo kod"; - else { - $szoftveres = Codegen::IsSoftwareKey($serial); // Szoftveres-e 2019 - $isFloatingKey = false; - - if ($key['isFloating'] == 1 && $programs[0]['prVerID'] >= 23) // Floating licencnel nincs limit - $isFloatingKey = true; - - foreach ($programs as $program) { - if ($program['prSellDate'] == "0000-00-00" || $program['prSellDate'] == NULL) { // van-e eladasi datum - $valasz = "error: nincs vasarlasi idopont"; - } elseif ($program['prActCode'] != "") { // neki megfelelo aktivalasi kod - if ($szoftveres) { - $currentIsid = self::GetIsidFromTimeCode($program['prActCode']); - - $isidOK = ($currentIsid == $isid); - // Regi programoknal elofordulhat a win 10 creator update miatti id valtozas, ezt szandekozott javitani - if (!$isTwTw && !$isidOK && substr($program['prActCode'], 7, 2) == substr($isid, 2, 2)) { - self::$win10creator_old_isid = $currentIsid; - $elteltnapok = Codegen::GetDayFromTimeCode($telepitesikod); - $engedelyezettnapok = Codegen::GetDayFromTimeCode($program['prActCode']); - if ($engedelyezettnapok > $elteltnapok) { - $valasz = "error: win10 creator"; - break; - } - } - - if ($isidOK) { - if ($isTwTw == $program['twtw']) { // A kert es a tarolt kodrendszer egyeztetese - // lockolva van-e a program ehhez a seatid-hoz - if ($isFloatingKey) { - if ($build <= '255' && $programs[0]['prVerID'] == 23) { - // Ha floating licenc es a 255 buildnel regebbit hasznal, akkor ne futhasson, mert a program nem tudja kezelni - $valasz = 'error: masik gep van regisztralva'; - } else { - $floatingError = ''; - $reg = crm_hardlock::GetActiveRegistration($serial, $isid); - if ($floatingLockAllowed && self::floatingLock($serial, $seatID, $reg['computer_id'], $floatingError)) { - $floatingLic = self::getFloatingLic($serial, $seatID); - $offlineActDate = $floatingLic['offline_expiration_date']; - - if ($offlineActDate < date('Y-m-d') || $offlineActDate == '') { - $actCode = $program['prActCode']; - } elseif ($offlineActDate >= '2050-01-01') { - $days = 3583; - $actCode = Codegen::GenerateTimeCode($serial, $currentIsid, $days); - } else { - $days = Codegen::GetDayInterval(self::getTwTwRootTimeString(), $offlineActDate, true); - $actCode = Codegen::GenerateTimeCode($serial, $currentIsid, $days); - } - - $valasz = $actCode; // A kod rendben van, adja vissza - } else { - $valasz = crm_hardlock::convertFloatingErrorCodeToString($floatingError, $program['prVerID'], $build); - } - } - } else { - $valasz = $program['prActCode']; // A kod rendben van, adja vissza - } - } else { - $valasz = 'error: hianyzo kod'; // A masik kodrendszerben van tarolva a kod, nem adja vissza - $hasEmptyKey = true; - } - break; // Ha mar megtalaltuk azzal az ISID-el, akkor nem kell a tobbi programon atmenni - } else { - if ($isFloatingKey) - $valasz = 'error: hianyzo kod'; // Floating licencenel minden esetben engedi a regisztraciot - else - $valasz = 'error: masik gep van regisztralva'; // Normal licencnel nem enged tovabbi regisztraciot - } - } else { // hardware kulcs esete - if ($isTwTw == $program['twtw']) { // A kert es a tarolt kodrendszer egyeztetese - $valasz = $program['prActCode']; // hardveres kulcs eseten egybol visszaadja az aktualis aktivalasi kodot - } else { - $valasz = 'error: hianyzo kod'; // A masik kodrendszerben van tarolva a kod, nem adja vissza - $hasEmptyKey = true; - } - break; - } - } else { // nincs feltoltve a prActCode mezo - $valasz = "error: hianyzo kod"; // nincs beirva a kod - $hasEmptyKey = true; - } - } - } - } - - if ($hasEmptyKey === true && $valasz == "error: masik gep van regisztralva") // LAN-os szoftver kulcsos liszensznel ha ezt a liszenszt nem talaltuk de volt ures liszensz, akkor csinalja ezt - $valasz = "error: hianyzo kod"; - - // Kivetel: 30, 34, 39, 41, 43 kulcsok, amik soha nem kapnak tolunk automata hosszabbitast. - // csak a hibat adom vissza - if ($isTimeCodeSendingEnabled || substr($valasz, 0, 5) == "error") return $valasz; - else return ""; //- nincs hiba es van kod beirva, DE nem kaphatja meg - } - - public static function IsTimeCodeSendingEnabled($password) - { - // isCodeReplyEnabled(hlNum:str(6)) - // 2017.12.13. F.Zs. - // Ezekre az esetekre ad vissza TRUE-t a fuggveny (version tabla 1182-es rekord): 30;34;36;38;40;41;42;43;44;47;48;49;82;88;93;94;95;97;98;99; - // 39 - Olaszorszag szandekosan hianyzik, amig a volume contract fennall! - if (self::IsLiveKey($password) || self::IsLTkey($password)) // A live-ok mindig kommunikalnak a szerverrel 2019 - return true; - - $kulcs = substr($password, 0, 6); - $ver8and9 = self::GetVer8And9FromPassword($password); - - if ($ver8and9 >= 37) return true; // 2020-as valtozattol mindenki kap idokodot - - // a lekerdezes vagy egy mezot ad vissza ver_id=1182 vagy semmit - // pl: SELECT ver_id FROM `www_archline_hu`.`version` WHERE ver_id=1182 AND (`usertype` LIKE '%;360012;%' OR `usertype` LIKE '%;36;%' OR LEFT(`usertype`,3)='36;'); - $ctrID = substr($kulcs, 0, 2); - $query = "SELECT ver_id FROM `" . JMLADATBAZIS . "`.`version` WHERE ver_id = ? AND (usertype LIKE ? OR usertype LIKE ? OR LEFT(usertype, 3) = ?)"; - Database::getInstance()->query($query, array('isss', ACT_VERSION_ID, "%;{$kulcs};%", "%;{$ctrID};%", "{$ctrID};")); - $res = Database::getInstance()->fetchNext(); - - $ret = ((is_numeric($res['ver_id']) && $res['ver_id'] > 0) ? TRUE : FALSE); - if (!$ret) { - // Ezek a password-ok megis kaphatnak kodot - $exceptions = array( - "3948648362945744", - "3960018340571178", - "3981578343885829", - "3984268320911925", - "3944786350910035", - "3964368342323114", - "3968547340219718", - "3922078343467818", - "3986678330054419", - "3954537340409996", - "3987007330845972", - "3953168353005544", - "3925518350342279", - "3948897340131564", - "3972726350632589", - "3937488350939975", - "3986057360504402", - "3941488360322917", - "3987548340316176", - "3949488330848001", - "3902498366694835" - ); - - if (in_array($password, $exceptions)) $ret = true; - } - - return $ret; - } - - public static function IsRegistrationActive($password, $isid, $npid) - { - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`p_serial_isid` WHERE serial = ? AND isid = ? AND aktiv = ?"; - Database::getInstance()->query($query, array('ssi', $password, $isid, 1)); - $res = Database::getInstance()->fetchNext(); - - return (!empty($res)); - } - - public static function ActiveRegistrationRequired($password) - { - $ver8and9 = self::GetVer8And9FromPassword($password); - - // A 2019-es evtol vezettuk be az aktiv regisztracio szuksegesseget - if ($ver8and9 < 36) return false; - - //ba namirial,bimladder trial igenis keri a rendszertol a lejaratot! Kell actcode az xml-be! - if (self::IsSpecialEditionTrial($password)) return false; - - if (self::IsLiveKey($password)) return true; // A LIVE-oknak mar kell regisztralniuk - - $type = self::GetTypeFromPassword($password); - - // Egyenlore csak az LT valtozatban - return ($type == '4' || (Codegen::IsSoftwareKey($password) && $ver8and9 > 36)); - } - - public static function correctIsid(&$isid) - { - while (strlen($isid) < 4) $isid = "0{$isid}"; - } // isid kiegeszitese - - public static function IsCalledFromMyIP() - { - // https://whatismyipaddress.com/ oldalrol kell ellenorizni az ip cimet - return $_SERVER['REMOTE_ADDR'] == '79.122.124.35'; - } - - public static function Yes($utst, $x) - { - return (int)((((int)($utst / 8192) - 1519) * 76) / $x); - } - public static function No($utst, $x) - { - return (int)((((int)($utst / 4096) - 1873) * 96) / $x); - } - - public static function ConvertDay($day) - { - switch ($day) { - case 1: { - $ret = 2; - break; - } - case 2: { - $ret = 8; - break; - } - case 3: { - $ret = 5; - break; - } - case 4: { - $ret = 3; - break; - } - case 5: { - $ret = 7; - break; - } - case 6: { - $ret = 4; - break; - } - case 7: { - $ret = 6; - break; - } //- ilyen nincs, a vasarnap a 0 -> https://www.php.net/manual/en/datetime.format.php - case 0: { - $ret = 6; - break; - } - } - - return $ret; - } - - public static function RegisterProgram($password, $isid, $telepitesikod, $npid, $comp_name, $isTwTw = false, $seatID = '', $build = '', $floatingLockAllowed = false) - { - //- ha nincs computer nev, attol meg le kell a computer_id - if (!empty($npid)) $computer_id = self::AddOrUpdateComputer($npid, $comp_name); - - $isTimeCodeSendingEnabled = self::IsTimeCodeSendingEnabled($password); - $softwareKey = Codegen::IsSoftwareKey($password); - - $hlNum = self::GetHlnumFromPassword($password); - $query = "SELECT hlLan, hlStat, hlDatePro, isFloating FROM `" . CRMADATBAZIS . "`.`hardlock` WHERE hlNum = ?"; - Database::getInstance()->query($query, array('s', $hlNum)); - $key = Database::getInstance()->fetchNext(); - if (empty($key) || $key['hlStat'] == 0 || ($key['hlStat'] == 2 && ($key['hlDatePro'] != '0000-00-00' && $key['hlDatePro'] != NULL && $key['hlDatePro'] != ''))) { // a kulcs aktiv-e) - return "error: nem aktiv a program"; - } - - $verid = self::GetVerIdFromPassword($password); - if ($key['isFloating'] == 1 && $verid == 23 && ($build <= '255' || $build == '')) { - crm_hardlock::AddToDebugTable("RegisterProgram(): 2023-as, 255 buildnel regebbi floating licenc! Password: {$password}"); - return "error: nincs kifizetve"; - } - - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`h_programs` WHERE prPass = ?"; - Database::getInstance()->query($query, array('s', $password)); - $program = Database::getInstance()->fetchNext(); - if (empty($program)) return "error: nem aktiv a program"; - - if ($program['prFizetve'] < date('Y-m-d')) return "error: nincs kifizetve"; - - // Hardver kulcsos valtozatok nem gephez kotott, egyedi kodot hasznalnak, ezert nem kell oket tarolni - if ($softwareKey) { - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`p_serial_isid` WHERE serial = ? AND isid = ?"; - Database::getInstance()->query($query, array('ss', $password, $isid)); - $p_serial_isid = Database::getInstance()->fetchAssoc(); - if (!empty($p_serial_isid) && count($p_serial_isid) == 1) { //- normal eset, ez a gep mar volt ehez a programhoz regisztralva - // Ez a gep valaha regisztralva volt - if (isset($computer_id)) { - Database::getInstance()->update( - CRMADATBAZIS . ".p_serial_isid", - array( - 'computer_id' => $computer_id - ), - array('id' => $p_serial_isid[0]['id']), - 'ii' - ); - } - - if ($p_serial_isid[0]['aktiv'] == 1) { // Ez az aktiv, ezert mehet tovabb minden - $found = self::FindTimeCode($password, $isid, $telepitesikod, $isTimeCodeSendingEnabled, $isTwTw, $seatID, $build, $floatingLockAllowed); - if ($found == "error: hianyzo kod" || $found == "error: win10 creator") return ''; //- ha hiba van, akkor visszaadjuk - else return $found; // egyebnkent visszaadjuk a timecode-ot - } - } elseif (!empty($p_serial_isid) && count($p_serial_isid) > 1) - return "error: masik gep van regisztralva"; //- tobb regisztraciot is talalt ugyanazon isiddel - - //- a regisztracio elvi idopontja - $registration_date = date("Y-m-d h:i:s"); - if (!empty($telepitesikod)) { //- a megadott telepitesi kod alapjan ellenorizni lehet a telepites idopontjanak ervenyesseget - $telepitesidatum = self::GetInstallationDateFromInstallationCode($telepitesikod, $isTwTw); - if (Codegen::GetDayFromTimeCode($telepitesikod) > 1) // Ha a telepites napjan regisztralja, akkor feltelelezzuk, hogy ebben a pillanatban inditotta el eloszor - $registration_date = $telepitesidatum; - $checked_reg_date = self::CheckInstallDate($telepitesidatum, $telepitesikod, $isTwTw) ? self::CHECKED_DATE_OK : self::CHECKED_DATE_FALSE; - } else - $checked_reg_date = 0; - - $maxtelepites = ($key['hlLan'] == 0) ? 1 : $key['hlLan']; - if ($key['isFloating'] == 1 && $program['prVerID'] >= 23) { // A floating licenceknel nincs limit, tovabb kell engedni - } elseif ($maxtelepites > 1) { //- lan-os valtozatok - $query = "SELECT id FROM `" . CRMADATBAZIS . "`.`p_serial_isid` WHERE serial = ? AND isid != '' AND isid IS NOT NULL AND aktiv = ?"; - Database::getInstance()->query($query, array('si', $password, 1)); - $telepitett = Database::getInstance()->fetchAssoc(); - if (!empty($telepitett) && count($telepitett) >= $maxtelepites) return "error: tul sok telepites"; - } else { //- Nem LAN-os kulcs eseten megnezi, hogy van-e aktivalt serial-isid paros - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`p_serial_isid` WHERE serial = ? AND isid != ? AND aktiv = 1"; - Database::getInstance()->query($query, array('ss', $password, $isid)); - $aktiv = Database::getInstance()->fetchAssoc(); - if (!empty($aktiv) /*&& $verid < 20*/) return "error: masik gep van regisztralva"; - - /*if(empty($aktiv) == false && $verid >= 20) { // 2020-as programnal engedelyezzuk a tobbszoros regisztraciot, Zoli keresere megszuntetve ezzel a szoftveres vedelmet - // A jelenlegi aktiv deaktivalasa és a kiadott idokot torlese - crm_database::getInstance()->query("UPDATE `".CRMADATBAZIS."`.`p_serial_isid` SET aktiv = 0 WHERE serial = '".$password."'"); - crm_database::getInstance()->query("UPDATE `".CRMADATBAZIS."`.`h_programs` SET prActCode = NULL WHERE prPass = '".$password."'"); - }*/ - } - - if (empty($p_serial_isid)) { //- registracio - Database::getInstance()->insert( - CRMADATBAZIS . '.p_serial_isid', - array( - "serial" => $password, - "isid" => $isid, - "datum" => $registration_date, - "ip" => $_SERVER['REMOTE_ADDR'], - "aktiv" => 1, - "datum_ellenorizve" => $checked_reg_date, - "computer_id" => $computer_id - ), - 'ssssiii' - ); - - if (!crm_hardlock::CheckRegistration($password, $isid)) { - crm_hardlock::AddToDebugTable("RegisterProgram(): Nem sikerult regisztralni: Password: {$password} || isid: {$isid}"); - } - } else { - if (isset($computer_id) && $computer_id != '') { - Database::getInstance()->update( - CRMADATBAZIS . '.p_serial_isid', - array( - "aktiv" => 1, - "computer_id" => $computer_id - ), - array('id' => $p_serial_isid[0]['id']), - 'iii' - ); - } else { - Database::getInstance()->update( - CRMADATBAZIS . '.p_serial_isid', - array( - "aktiv" => 1 - ), - array('id' => $p_serial_isid[0]['id']), - 'ii' - ); - } - $found = self::FindTimeCode($password, $isid, $telepitesikod, $isTimeCodeSendingEnabled, $isTwTw, $seatID, $build, $floatingLockAllowed); - if ($found == "error: hianyzo kod" || $found == "error: win10 creator") return ''; //- ha hiba van, akkor visszaadjuk - else return $found; // egyebnkent visszaadjuk a timecode-ot - } - } - return ""; //- regisztraltuk - } - - public static function CheckRegistration($password, $isid) - { - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`p_serial_isid` WHERE serial = ? AND isid = ?"; - Database::getInstance()->query($query, array('ss', $password, $isid)); - $res = Database::getInstance()->fetchNext(); - - return (!empty($res)); - } - - public static function UnRegisterProgram($password, $isid, $prID = '', $compName = '', $message = '', $manID = 36, $forceUnlock = true) - { - $query = "UPDATE `" . CRMADATBAZIS . "`.`p_serial_isid` SET aktiv = ? WHERE serial = ? AND isid = ? AND aktiv = ? LIMIT 1"; - Database::getInstance()->query($query, array('issi', 0, $password, $isid, 1)); - - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`p_serial_isid` WHERE serial = ? AND isid = ?"; - Database::getInstance()->query($query, array('ss', $password, $isid)); - $p_serial_isid = Database::getInstance()->fetchNext(); - if (empty($p_serial_isid)) return false; - - $reg = $p_serial_isid['aktiv']; - if ($reg != 0) return false; // Ha aktiv maradt a program, akkor az hiba - - if ($prID != '') { - $query = "UPDATE `" . CRMADATBAZIS . "`.`h_programs` SET prActCode = '' WHERE prID = ?"; - Database::getInstance()->query($query, array('i', $prID)); - } else { - $query = "UPDATE `" . CRMADATBAZIS . "`.`h_programs` SET prActCode = '' WHERE prPass = ? AND prActCode LIKE ? LIMIT 1"; - Database::getInstance()->query($query, array('ss', $password, "%-{$isid}-%")); - } - - if (crm_hardlock::GetVer8And9FromPassword($password) >= 40 && $forceUnlock) { - $hlNum = substr($password, 0, 6); - - $query = "SELECT isFloating FROM `" . CRMADATBAZIS . "`.`hardlock` WHERE hlNum = ?"; - Database::getInstance()->query($query, array('s', substr($password, 0, 6))); - $key = Database::getInstance()->fetchNext(); - - if (!empty($key) && $key['isFloating'] == 1) { - $query = "SELECT seatID FROM `" . SYNCADATBAZIS . "`.`floating_licenses` WHERE hlNum = ? AND computer_id = ?"; - Database::getInstance()->query($query, array('si', $hlNum, $p_serial_isid['computer_id'])); - $floatingLic = Database::getInstance()->fetchNext(); - - crm_hardlock::floatingUnlock($password, $floatingLic['seatID']); - } - } - - if ($compName != '') - $info = "Felhasználói deaktiválás: {$compName}"; - else - $info = $message; - - // internetes aktivalas esemeny - $query = Database::getInstance()->insert( - CRMADATBAZIS . ".h_history", - array( - "hiHlNum" => substr($password, 0, 6), - "hiDate" => date('Y-m-d', time()), - "hiManID" => $manID, - "hiTypeID" => 27, - "hiTime" => date('Y-m-d H:i:s', time()), - "hiInfo" => $info - ), - 'ssiiss' - ); - - return $reg == 0; - } - - public static function CountRegistration($password, $action) - { - $query = "SELECT id FROM `" . CRMADATBAZIS . "`.`p_serial_isid` WHERE serial = ?"; - - if ($action == 'active') $query .= " and aktiv = 1"; - elseif ($action == 'inactive') $query .= " and aktiv = 0"; - - Database::getInstance()->query($query, array('s', $password)); - $res = Database::getInstance()->fetchAssoc(); - - return count($res); - } - - public static function ActivateHardlock($hlNum, $hlManID, $hlInfo) - { - Database::getInstance()->update(CRMADATBAZIS . ".hardlock", array('hlStat' => 1), array('hlNum' => $hlNum), 'is'); - Database::getInstance()->update(CRMADATBAZIS . ".h_programs", array('prStat' => 0), array('prHlNum' => $hlNum), 'is'); - Database::getInstance()->insert( - CRMADATBAZIS . ".h_history", - array( - "hiHlNum" => $hlNum, - "hiDate" => date('Y-m-d', time()), - "hiManID" => $hlManID, - "hiTypeID" => 16, - "hiTime" => date('Y-m-d H:i:s', time()), - "hiInfo" => $hlInfo - ), - 'ssiiss' - ); - - $query = "SELECT hlStat FROM `" . CRMADATBAZIS . "`.`hardlock` WHERE hlNum = ?"; - Database::getInstance()->query($query, array('s', $hlNum)); - $res = Database::getInstance()->fetchNext(); - - return ($res['hlStat'] == 1 ? true : ''); - } - - public static function DeactivateHardlock($hlNum, $hlManID, $hlInfo, $hlDatePro) - { - Database::getInstance()->update(CRMADATBAZIS . ".hardlock", array('hlDatePro' => $hlDatePro, 'hlStat' => 2), array('hlNum' => $hlNum), 'sis'); - Database::getInstance()->update(CRMADATBAZIS . ".h_programs", array('prStat' => 1), array('prHlNum' => $hlNum), 'is'); - Database::getInstance()->insert( - CRMADATBAZIS . ".h_history", - array( - "hiHlNum" => $hlNum, - "hiDate" => date('Y-m-d', time()), - "hiManID" => $hlManID, - "hiTypeID" => 5, - "hiTime" => date('Y-m-d H:i:s', time()), - "hiInfo" => $hlInfo - ), - 'ssiiss' - ); - - $query = "SELECT hlStat FROM `" . CRMADATBAZIS . "`.`hardlock` WHERE hlNum = ?"; - Database::getInstance()->query($query, array('s', $hlNum)); - $res = Database::getInstance()->fetchNext(); - - return ($res['hlStat'] == 2 ? false : ''); - } - - public static function CheckInstallDate($telepitesidatum, $telepitesikod, $isTwTw = false) - { - $installDateFromInstallCode = new DateTime(self::GetInstallationDateFromInstallationCode($telepitesikod, $isTwTw)); - $installDateMin = new DateTime($telepitesidatum); - $installDateMax = new DateTime($telepitesidatum); - $installDateMin->modify('-2 day'); - $installDateMax->modify('+2 day'); - - if (($installDateFromInstallCode > $installDateMax) || ($installDateFromInstallCode < $installDateMin)) return false; - else return true; - } - - public static function GetInstallationDateFromInstallationCode($telepitesikod, $isTwTw = false) - { - $elteltnapok = Codegen::GetDayFromTimeCode($telepitesikod); - - if ($isTwTw) { - $date = new DateTime(crm_hardlock::getTwTwRootTimeString()); - $date->modify('+' . $elteltnapok . ' day'); - } else { - $date = new DateTime(date('Y-m-d')); - $date->modify("-{$elteltnapok} day"); - } - - return $date->format('Y-m-d'); - } - - public static function GetInstallationDate_noRegisterAndValidate($password, $isid, $telepitesikod, $isTwTw = false) - { - $softwarekey = Codegen::IsSoftwareKey($password); - if (!$softwarekey) { //- a hardware kulcsok az eladasi datumtol szamolnak - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`h_programs` WHERE prPass = ?"; - Database::getInstance()->query($query, array('s', $password)); - $program = Database::getInstance()->fetchNext(); - - return $program['prSellDate']; - } - - // a paros benne van-e a tablaban, regisztralva van-e - $query = "SELECT datum, datum_ellenorizve FROM `" . CRMADATBAZIS . "`.`p_serial_isid` WHERE serial = ? AND isid = ? ORDER BY datum DESC"; - Database::getInstance()->query($query, array('ss', $password, $isid)); - $registrations = Database::getInstance()->fetchAssoc(); - if (count($registrations) == 1) { //- normal eset softver kulcs eseten - if (Codegen::IsValidTimeCode($telepitesikod) && ($registrations[0]['datum_ellenorizve'] == 0 || $registrations[0]['datum'] == '0000-00-00 00:00:00')) - return self::GetInstallationDateFromInstallationCode($telepitesikod, $isTwTw); - else - return substr($registrations[0]['datum'], 0, 10); - } - - //- egy isiddel tobb program is van regisztralva es az NEM hardware kulcsos - if (count($registrations) > 1) return 'error: masik gep van regisztralva'; - - return ''; - } - - public static function GetInstallationDate($password, $isid, $telepitesikod, $isTwTw = false) - { - $registrationDate = self::GetInstallationDate_noRegisterAndValidate($password, $isid, $telepitesikod, $isTwTw); - - if (strpos($registrationDate, 'error:') !== false) return $registrationDate; - - //- ezzel az isiddel meg nem volt regisztralva - return self::RegisterProgram($password, $isid, $telepitesikod, '', '', $isTwTw, ''); - } - - public static function GetOrGenerateTimeCode($serial, $isid, $telepitesikod = '', $npID = '', $compName = '') - { - $isTimeCodeSendingEnabled = self::IsTimeCodeSendingEnabled($serial); - $valasz = self::FindTimeCode($serial, $isid, $telepitesikod, $isTimeCodeSendingEnabled, false, '', '', false); - if ((!$isTimeCodeSendingEnabled) && (($valasz == 'error: hianyzo kod') || (!in_array($valasz, self::$aktivalasihibak)))) - return; // azoknal lep ki return-el, akiknek nem jar kod (pl. olaszok) es nincs veluk problema (nem kap error-t) - - if (self::ActiveRegistrationRequired($serial) && !self::IsRegistrationActive($serial, $isid, "")) { - if (self::IsTrialKey($serial)) return; - else return Codegen::GenerateTimeCode($serial, $isid, 1); - } - - $szoftveres = Codegen::IsSoftwareKey($serial); // Szoftveres-e 2019 - - $codeGenerationIsEnabled = (Codegen::IsValidTimeCode($telepitesikod)); - if ($codeGenerationIsEnabled) $elteltnap = Codegen::GetDayFromTimeCode($telepitesikod); - elseif ($szoftveres) return; // Szoftverkulcsnal nem tudjuk kiszamolni a hasznalati ido hianyaban az idokodot - - $timeelteltnap = 60 * 60 * 24 * $elteltnap; - - if ($valasz == 'error: win10 creator') { - // aktivalasi kod torlese - $query = "UPDATE `" . CRMADATBAZIS . "`.`p_serial_isid` SET aktiv = ? WHERE serial = ? AND isid = ? LIMIT 1;"; - Database::getInstance()->query($query, array('iss', 0, $serial, self::$win10creator_old_isid)); - $query = "UPDATE `" . CRMADATBAZIS . "`.`h_programs` SET prActCode = NULL, prActDate = NULL WHERE prPass = ? AND SUBSTR(prActCode, 6, 4) = ? LIMIT 1;"; - Database::getInstance()->query($query, array('ss', $serial, self::$win10creator_old_isid)); - $valasz = 'error: hianyzo kod'; - } - - $specialEditionTrial = self::IsSpecialEditionTrial($serial); - - if (!$specialEditionTrial) { - if ($szoftveres) { - $refreshValidateDate = false; - $query = "SELECT datum, datum_ellenorizve, aktiv FROM `" . CRMADATBAZIS . "`.`p_serial_isid` WHERE serial = ? AND isid = ?"; - Database::getInstance()->query($query, array('ss', $serial, $isid)); - $validateDate = Database::getInstance()->fetchNext(); - $verid = self::GetVerIdFromPassword($serial); - - if ($verid < 20) { - if (empty($validateDate)) { //- nincs regisztracio - // A regi programok ha a CRM engedelyezte, automatikusan felfrissitettek magukat es kiadtak az aktualis programhoz a kodot ugy, hogy nem voltak beregisztralva (ezaltal nem is tortent meg a regisztracio) - // Tehat ezeket kiszurjuk es meghivjuk ezekere a programokra a regisztraciot - $hlnum = self::GetHlnumFromPassword($serial); - $query = "SELECT prID FROM `" . CRMADATBAZIS . "`.`h_programs` WHERE prHlNum = ? AND prVerID < ? GROUP BY prPass"; - Database::getInstance()->query($query, array('si', $hlnum, $verid)); - $prIdArray = Database::getInstance()->fetchAssoc(); - if (empty($prIdArray)) { // Amennyiben az info mezoben oda van irva, hogy AutoReg, akkor engedelyezi az automatikus regisztraciot - $query = "SELECT prID FROM `" . CRMADATBAZIS . "`.`h_programs` WHERE prPass = ? AND prInfo LIKE ?"; - Database::getInstance()->query($query, array('ss', $serial, "%AutoReg%")); - $prIdArray = Database::getInstance()->fetchAssoc(); - } - $reg = empty($prIdArray) ? 'error:' : self::RegisterProgram($serial, $isid, $telepitesikod, $npID, '', false, ''); - if (strpos($reg, 'error:') !== false) //- ha sikerult a regisztracio, akkor frissiteni kell a $validateDate erteket - $refreshValidateDate = true; - } elseif ($validateDate['aktiv'] == 0) { //- nem aktiv a regisztracio - $reg = self::RegisterProgram($serial, $isid, $telepitesikod, $npID, '', false, ''); - if (strpos($reg, 'error:') !== false) //- ha sikerult a regisztracio, akkor frissiteni kell a $validateDate erteket - $refreshValidateDate = true; - } - if ($refreshValidateDate) { //- $validateDate frissitese - $query = "SELECT datum, datum_ellenorizve, aktiv FROM `" . CRMADATBAZIS . "`.`p_serial_isid` WHERE serial = ? AND isid = ?"; - Database::getInstance()->query($query, array('ss', $serial, $isid)); - $validateDate = Database::getInstance()->fetchNext(); - } - - if ($validateDate['datum_ellenorizve'] < self::CHECKED_DATE_OK) // Voltak false bejegyzesek, ezert minden eddigi bejegyzest felul kell vizsgalni (az uj datum ellenorizve 2-es erteket kapott) - $validateDate['datum_ellenorizve'] = self::CHECKED_DATE_FALSE; - } - - if (empty($validateDate)) return "error: nem aktiv regisztracio"; - - if ($validateDate['datum_ellenorizve'] == self::CHECKED_DATE_FALSE) { //- tarolt regisztacios idopont ellenorzese - $regtelepites = $validateDate['datum']; - - if (!isset($validateDate['computer_id']) && $npID != "") { - $compid = crm_hardlock::AddOrUpdateComputer($npID, ''); - $query = "UPDATE `" . CRMADATBAZIS . "`.`p_serial_isid` SET computer_id = ? WHERE serial = ? AND isid = ? LIMIT 1"; - Database::getInstance()->query($query, array('iss', $compid, $serial, $isid)); - } - - // Ellenorizzuk, hogy a regisztralt telepitesi ido egyezik-e a program altal regisztraltal - $checked_reg_date = self::CheckInstallDate($regtelepites, $telepitesikod); - if ($checked_reg_date) { // Egyezik, ezert az eredeti datum marad es jelezzuk, hogy ellenorizve van - $query = "UPDATE `" . CRMADATBAZIS . "`.`p_serial_isid` SET datum_ellenorizve = ? WHERE serial = ? AND isid = ? LIMIT 1"; - Database::getInstance()->query($query, array('iss', self::CHECKED_DATE_OK, $serial, $isid)); - } else { // A regisztralt telepitesi datum nem megfelelo, ezert felul irjuk a programban rogzitett datummal - $regtelepites = self::GetInstallationDateFromInstallationCode($telepitesikod, false); - $query = "UPDATE `" . CRMADATBAZIS . "`.`p_serial_isid` SET datum = ?, datum_ellenorizve = ? WHERE serial = ? AND isid = ? LIMIT 1"; - Database::getInstance()->query($query, array('siss', $regtelepites, self::CHECKED_DATE_OK, $serial, $isid)); - // Mivel megvaltozott a telepitesi datum, az eddigi aktivalasi kod ervenytelen - $valasz = "error: hianyzo kod"; - - $updateQuery = "UPDATE `" . CRMADATBAZIS . "`.`h_programs` SET prActCode = '' WHERE prPass = ? LIMIT 1"; - Database::getInstance()->query($updateQuery, array('s', $serial)); - } - } - } - } - - // ha nincs aktivalasi kodja, akkor generalni neki - if ($valasz == "error: hianyzo kod") { - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`h_programs` WHERE prPass = ?"; - Database::getInstance()->query($query, array('s', $serial)); - $program = Database::getInstance()->fetchNext(); - - if ($specialEditionTrial) { - $aktkod = self::GenerateSpecialEditionTrialActCode($serial, $isid, $timeelteltnap, false); - return $aktkod; - } else { - $timeszerzodes = strtotime($program['prSellDate']); - $timetelepites = time() - $timeelteltnap; - $maxtelepites = max($timeszerzodes, $timetelepites); - $maxdatetelepites = date('Y-m-d', $maxtelepites); - - if ((!$szoftveres) && ($program['prSellDate'] != '') && ($program['prSellDate'] != '0000-00-00')) - $maxdatetelepites = substr($program['prSellDate'], 0, 10); - - if ($program['prFizetve']) { - $fizetvetime = strtotime($program['prFizetve']); - $meddig = date('Y-m-d', $fizetvetime); // vege - telepites - } elseif (substr($serial, 0, 2) == "99") - $meddig = date('Y-m-d', time() + 30 * 24 * 60 * 60); // eloszor 30 napot kap - else - return "error: nincs kifizetve"; - - // mostani ido nagyobb mint ameddig jar - if (date('Y-m-d', time()) > $meddig) return $valasz; - - $napok = Codegen::GetDayInterval($maxdatetelepites, $meddig); - - if ($meddig == '2050-01-01') $napok = 3583; - - $aktkod = Codegen::GenerateTimeCode($serial, $isid, $napok); - $aktkod = (Codegen::IsValidTimeCode($aktkod) ? $aktkod : ''); - - $serial = trim(addslashes($serial)); - - $updateQuery = "UPDATE `" . CRMADATBAZIS . "`.`h_programs` SET prActCode = ?, twtw = ?, prActDate = ?, prFizetve = ? WHERE prPass = ? AND (prActCode = '' OR prActCode IS NULL) LIMIT 1"; - Database::getInstance()->query($updateQuery, array('sisss', $aktkod, 0, $maxdatetelepites, $meddig, $serial)); - - if ($compName != '') $info = "Felhasználói aktiválás: {$compName}"; - - // internetes aktivalas esemeny - $query = Database::getInstance()->insert( - CRMADATBAZIS . ".h_history", - array( - "hiHlNum" => $program['prHlNum'], - "hiDate" => date('Y-m-d', time()), - "hiManID" => 0, - "hiTypeID" => 16, - "hiTime" => date('Y-m-d H:i:s', time()), - "hiInfo" => $info - ), - 'ssiiss' - ); - - self::_Hibajelento("GetOrGenerateTimeCode", $program['prHlNum'], "felvettem: {$query}"); - } - return $aktkod; - } - return $valasz; - } - - public static function GetOrGenerateTimeCodeTWTW($serial, $isid, $telepitesikod = '', $npID = '', $compName = '', $seatID = '', $build = '', $floatingLockAllowed = true) - { - $valasz = self::FindTimeCode($serial, $isid, $telepitesikod, true, true, $seatID, $build, $floatingLockAllowed); - - if (self::ActiveRegistrationRequired($serial) && !self::IsRegistrationActive($serial, $isid, "")) { - if (self::IsTrialKey($serial)) { - return; - } else { - return Codegen::GenerateTimeCode($serial, $isid, 1); - } - } - - $szoftveres = Codegen::IsSoftwareKey($serial); // Szoftveres-e 2019 - $elteltnap = Codegen::GetDayFromTimeCode($telepitesikod); - $timeelteltnap = 60 * 60 * 24 * $elteltnap; - - // A 2020-as programok taroljak az isidet, ezert elvileg az op rendszer miatt nem valtozhatnak meg - /*if($valasz == 'error: win10 creator') { - // aktivalasi kod torlese - crm_database::getInstance()->query("UPDATE `".CRMADATBAZIS."`.`p_serial_isid` SET `aktiv`=0 WHERE serial = '".$serial."' AND isid = '".self::$win10creator_old_isid."' LIMIT 1;"); - crm_database::getInstance()->query("UPDATE `".CRMADATBAZIS."`.`h_programs` SET `prActCode`=NULL,`prActDate`=NULL WHERE `prPass`='".$serial."' AND SUBSTR(prActCode,6,4)='".self::$win10creator_old_isid."' LIMIT 1;"); - $valasz = 'error: hianyzo kod'; - }*/ - - $specialEditionTrial = self::IsSpecialEditionTrial($serial); - - if (!$specialEditionTrial) { - if ($szoftveres) { - $refreshValidateDate = false; - $query = "SELECT datum, datum_ellenorizve, aktiv FROM `" . CRMADATBAZIS . "`.`p_serial_isid` WHERE serial = ? AND isid = ?"; - Database::getInstance()->query($query, array('ss', $serial, $isid)); - $registered = Database::getInstance()->fetchAssoc(); - $verid = self::GetVerIdFromPassword($serial); - - if (empty($registered)) return "error: nem aktiv regisztracio"; - - // Az uj modszerbe a telepitesi datum nem szerepel a kodbeallitasi folyamat parameterei kozott - /*if($validateDate[0]['datum_ellenorizve'] == self::CHECKED_DATE_FALSE) { //- tarolt regisztacios idopont ellenorzese - $regtelepites = $validateDate[0]['datum']; - - if(isset($validateDate[0]['computer_id']) == false && $npID != "") { - $compid = crm_hardlock::AddOrUpdateComputer($npID, ''); - crm_database::getInstance()->query("UPDATE `".CRMADATBAZIS."`.`p_serial_isid` SET computer_id='".$compid."' WHERE `serial`='".$serial."' AND isid='".$isid."' LIMIT 1;"); - } - - // Ellenorizzuk, hogy a regisztralt telepitesi ido egyezik-e a program altal regisztraltal - $checked_reg_date = self::CheckInstallDate($regtelepites, $telepitesikod); - if($checked_reg_date) // Egyezik, ezert az eredeti datum marad es jelezzuk, hogy ellenorizve van - crm_database::getInstance()->query("UPDATE `".CRMADATBAZIS."`.`p_serial_isid` SET `datum_ellenorizve`='".self::CHECKED_DATE_OK."' WHERE `serial`='".$serial."' AND isid='".$isid."' LIMIT 1;"); - else { // A regisztralt telepitesi datum nem megfelelo, ezert felul irjuk a programban rogzitett datummal - $regtelepites = self::GetInstallationDateFromInstallationCode($telepitesikod); - crm_database::getInstance()->query("UPDATE `".CRMADATBAZIS."`.`p_serial_isid` SET `datum`='".$regtelepites."', `datum_ellenorizve`='".self::CHECKED_DATE_OK."' WHERE `serial`='".$serial."' AND isid='".$isid."' LIMIT 1;"); - // Mivel megvaltozott a telepitesi datum, az eddigi aktivalasi kod ervenytelen - $valasz = "error: hianyzo kod"; - - $updateQuery = "UPDATE `".CRMADATBAZIS."`.`h_programs` SET `prActCode`='' WHERE `prPass`='{$serial}' LIMIT 1"; - crm_database::getInstance()->query($updateQuery); - } - }*/ - } // szoftveres - } // not spec. edition - - // ha nincs aktivalasi kodja, akkor generalni neki - if ($valasz == "error: hianyzo kod") { - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`h_programs` WHERE prPass = ?"; - Database::getInstance()->query($query, array('s', $serial)); - $program = Database::getInstance()->fetchNext(); - - if ($specialEditionTrial) { - $aktkod = self::GenerateSpecialEditionTrialActCode($serial, $isid, 0, true); - return $aktkod; - } else { // A normal programok - $timeszerzodes = strtotime($program['prSellDate']); - $timetelepites = self::getTwTwRootTime() + $timeelteltnap; //time()-$timeelteltnap; - $maxtelepites = max($timeszerzodes, $timetelepites); - $maxdatetelepites = date('Y-m-d', $maxtelepites); - - if ((!$szoftveres) && ($program['prSellDate'] != '') && ($program['prSellDate'] != '0000-00-00')) - $maxdatetelepites = substr($program['prSellDate'], 0, 10); - - if ($program['prFizetve']) { - $fizetvetime = strtotime($program['prFizetve']); - $meddig = date('Y-m-d', $fizetvetime); // vege - telepites - } elseif (substr($serial, 0, 2) == "99") - $meddig = date('Y-m-d', time() + 30 * 24 * 60 * 60); // eloszor 30 napot kap - else - return "error: nincs kifizetve"; - - // mostani ido nagyobb mint ameddig jar - if (date('Y-m-d', time()) > $meddig) return $valasz; - - $napok = Codegen::GetDayInterval(self::getTwTwRootTimeString(), $meddig); - - if ($meddig == '2050-01-01') $napok = 3583; - - $aktkod = Codegen::GenerateTimeCode($serial, $isid, $napok); - $aktkod = (Codegen::IsValidTimeCode($aktkod) ? $aktkod : ''); - - $serial = trim(addslashes($serial)); - - // Megkeressuk, hogy pontosan ehhez a licenchez van-e mar felveve program - $selectQuery = "SELECT * FROM `" . CRMADATBAZIS . "`.`h_programs` WHERE prPass = ? - AND prActCode LIKE ?"; - Database::getInstance()->query($selectQuery, array('ss', $serial, "____-{$isid}-%")); - $programWithIsid = Database::getInstance()->fetchNext(); - - $cantLock = false; - - if (empty($programWithIsid)) { // Ha nincs, akkor felupdate-eljuk azt, ahol nincs aktivalokod - $query = "SELECT isFloating FROM `" . CRMADATBAZIS . "`.`hardlock` WHERE hlNum = ?"; - Database::getInstance()->query($query, array('s', substr($serial, 0, 6))); - $key = Database::getInstance()->fetchNext(); - - $isFloating = $key['isFloating'] == 1 && $program['prVerID'] >= 23; - - if ($isFloating && $build != '' && $program['prVerID'] == 23 && $build < 255) - $isFloating = false; - - if ($isFloating) { - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`h_programs` WHERE prPass = ? AND (prActCode = '' OR prActCode IS NULL) LIMIT 1"; - Database::getInstance()->query($query, array('s', $serial)); - $emptyProgram = Database::getInstance()->fetchNext(); - - if (empty($emptyProgram)) { - $prID = crm_hardlock::AddProgram( - array( - 'prTypeID' => $program['prTypeID'], - 'prVerID' => $program['prVerID'], - 'prLan' => $program['prLan'], - 'prPass' => $program['prPass'], - 'prSellDate' => $program['prSellDate'], - 'prActDate' => $program['prActDate'], - 'prFizetve' => $program['prFizetve'], - 'prActCode' => '', - 'prTime' => $program['prTime'], - 'prLastMod' => $program['prLastMod'], - 'prContact' => $program['prContact'], - 'prHlNum' => $program['prHlNum'], - 'prManID' => $program['prManID'], - 'prStat' => $program['prStat'], - 'prHiType' => $program['prHiType'], - 'twtw' => $program['twtw'], - 'prPrice' => $program['prPrice'], - 'prInvoiceDateFrom' => $program['prInvoiceDateFrom'], - 'prInvoiceDateTo' => $program['prInvoiceDateTo'], - 'prInvoiceRecurrence' => $program['prInvoiceRecurrence'] - ), - 'iiisssssssisiiiiissi' - ); - - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`p_modules` WHERE mdPrID = ? LIMIT 1"; - Database::getInstance()->query($query, array('i', $program['prID'])); - $modules = Database::getInstance()->fetchNext(); - - if (!empty($modules)) { - Database::getInstance()->insert( - CRMADATBAZIS . ".p_modules", - array( - "mdPrice" => $modules['mdPrice'], - "mdInvNum" => $modules['mdInvNum'], - "mdOrdNum" => $modules['mdOrdNum'], - "mdDate" => $modules['mdDate'], - "mdIsPurchase" => $modules['mdIsPurchase'], - "mdID" => $modules['mdID'], - "mdPrID" => $prID, - "mdCode" => $modules['mdCode'], - "mdPrHlNum" => substr($serial, 0, 6) - ), - 'isssiiiss' - ); - } - } - - if ($floatingLockAllowed) { - $floatingError = ''; - if (!crm_hardlock::floatingLock($program['prPass'], $seatID, crm_hardlock::getComputerIdFromNpid($npID), $floatingError)) { - $cantLock = true; - } - } - } - - $updateQuery = "UPDATE `" . CRMADATBAZIS . "`.`h_programs` SET prActCode = ?, twtw = ?, prActDate = ?, - prFizetve = ? WHERE prPass = ? AND (prActCode = '' OR prActCode IS NULL) LIMIT 1"; - $searched = $serial; - $binded = 'sisss'; - } else { // Ha megtalalta, akkor updatelje az aktivalo kodjat - $updateQuery = "UPDATE `" . CRMADATBAZIS . "`.`h_programs` SET prActCode = ?, twtw = ?, prActDate = ?, - prFizetve = ? WHERE prID = ? LIMIT 1"; - $searched = $programWithIsid['prID']; - $binded = 'sissi'; - } - Database::getInstance()->query($updateQuery, array($binded, $aktkod, 1, $maxdatetelepites, $meddig, $searched)); - - if ($cantLock) { - $aktkod = crm_hardlock::convertFloatingErrorCodeToString($floatingError, $program['prVerID'], $build); - } - - if ($compName != '') $info = "Felhasználói aktiválás: {$compName}"; - - // internetes aktivalas esemeny - $query = Database::getInstance()->insert( - CRMADATBAZIS . ".h_history", - array( - "hiHlNum" => $program['prHlNum'], - "hiDate" => date('Y-m-d', time()), - "hiManID" => 0, - "hiTypeID" => 16, - "hiTime" => date('Y-m-d H:i:s', time()), - "hiInfo" => $info - ), - 'ssiiss' - ); - - self::_Hibajelento("GetOrGenerateTimeCode", substr($serial, 0, 6), "felvettem: {$query}"); - } - return $aktkod; - } - return $valasz; - } - - public static function IsTrialKey($password) - { - if (substr($password, 0, 1) != '9') return false; - - $secondChar = substr($password, 1, 1); - - if ($secondChar == '6') { // 2022-es programtol a 96-os passwordok szoftverkulcskent kezelodnek - $ver8and9 = crm_hardlock::GetVer8And9FromPassword($password); - - if ($ver8and9 < 39) { - return true; - } else { // 2022-es programtol a 960001 és a 960002 az a nem regisztralt trial, a tobbi regisztralt, CRM-ben megtalalhato - return substr($password, 2, 4) == '0001' || substr($password, 2, 4) == '0002'; - } - } - - return ($secondChar == '3' || $secondChar == '1'); - } - - public static function IsSpecialEditionTrial($password) - { - $ver8and9 = self::GetVer8And9FromPassword($password); - if ($ver8and9 >= 42) { - return false; - } - - return (substr($password, 0, 2) == '93' || substr($password, 0, 2) == '91'); - } - - public static function IsValidIsid($isid) - { - return (strlen($isid) == 4); // TODO Pontositani - } - - public static function GetLicenseNumber($password) - { - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`hardlock` WHERE hlNum = ?"; - Database::getInstance()->query($query, array('s', self::GetHlnumFromPassword($password))); - $res = Database::getInstance()->fetchNext(); - - if (empty($res)) return -1; - - return $res['hlLan']; - } - - public static function GetDaysForUnlimitedTimeCode($password) - { - $ver8and9 = self::GetVer8And9FromPassword($password); - - return (($ver8and9 > 29) ? 3583 : 999); - } - - public static function GetTrialDistributor($nUserID) - { - $login_id = 67568; - $userID = abs($nUserID); - - $query = "SELECT custom_login_id FROM cl_hlusers.custom_login_licenses WHERE id = ?"; - Database::getInstance()->query($query, array('i', $userID)); - $res = Database::getInstance()->fetchNext(); - - if (!empty($res)) { - switch ($res['custom_login_id']) { - case 'ita': - $login_id = 85644; - break; - - default: - break; - } - } - - return $login_id; - } - - public static function GenerateTrial($userID, $product, $verID, $dealer, $installDate, $ctrID, $specEdition, $npid, &$errorMsg) - { - $hlNum = ''; - $time = time(); - $needKey = false; - $ver8and9 = crm_hardlock::GetVer8And9FromVerId($verID); - $customName = ''; - - if ($installDate != '') { - $twtwDate = crm_hardlock::getTwTwRootTimeString(); - - $reg_date = new DateTime($twtwDate); - - $reg_date->modify("+{$installDate} day"); - $reg_date->format('Y-m-d'); - - $time = $reg_date->getTimestamp(); - } - - // Kikeresi, hogy a user-hez van-e trial - if ($userID > 0) { // CADLine Login - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`hardlock` WHERE hlUser = ? AND product_id = ? AND hlNum LIKE '96%'"; - Database::getInstance()->query($query, array('ii', $userID, $product)); - $res = Database::getInstance()->fetchNext(); - - $needKey = empty($res); - - if ($needKey) { // Ellenorizni kell, hogy erre a gepre kertek-e mar aktualis licencet - // Ha nincs, megnezzuk, hogy az adott npid-hez van-e mar trial abbol az evbol - - $computerID = crm_hardlock::getComputerIdFromNpid($npid); - - if ($computerID) { - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`p_serial_isid` WHERE computer_id = ? AND SUBSTR(serial, 8, 2) = ? - AND serial LIKE '96%' AND SUBSTR(serial, 7, 1)"; - - if ($product == '2') - $query .= " = 'L'"; - else - $query .= " != 'L'"; - - Database::getInstance()->query($query, array('ii', $computerID, $ver8and9)); - $trial_user = Database::getInstance()->fetchNext(); - - $needKey = empty($trial_user); - - if (!$needKey) { - $errorMsg = 'trial_exist_on_this_computer'; - return ''; - } - } - - $time = time(); - $place = $product == 2 ? 'LIVE' : 'ARCHLine'; - - Database::getInstance()->insert( - CRMADATBAZIS . ".u_history", - array( - 'nUserID' => $userID, - 'nTopicID' => 106, - 'dateEvent' => date('Y-m-d H:i:s', $time), - 'strPlace' => $place, - 'strInfo' => 'Bónusz Trialt igényelt', - 'nManagerID' => 36, - 'insertDate' => date('Y-m-d H:i:s', $time) - ), - 'iisssis' - ); - } - } else { // Custom Login - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`custom_login_licenses` WHERE id = ?"; - Database::getInstance()->query($query, array('i', abs($userID))); - $trial_user = Database::getInstance()->fetchNext(); - if (empty($trial_user)) { - $errorMsg = 'custom_user_not_found'; - return ''; - } - - // Ehhez az emailhez van-e mar trial - $query = "SELECT LEFT(lic.serial, 6) AS hlNum FROM `" . CRMADATBAZIS . "`.`custom_login_licenses` lic WHERE lic.email = ? AND ver8and9 = ? - AND lic.serial LIKE '96%' AND SUBSTR(lic.serial, 7, 1)"; - - if ($product == '2') - $query .= " = 'L'"; - else - $query .= " != 'L'"; - - Database::getInstance()->query($query, array('si', $trial_user['email'], $ver8and9)); - $previousTrial = Database::getInstance()->fetchNext(); - - $needKey = empty($previousTrial); - - if ($needKey) { // Ellenorizni kell, hogy erre a gepre kertek-e mar aktualis licencet - // Ha nincs, megnezzuk, hogy az adott npid-hez van-e mar trial abbol az evbol - $query = "SELECT LEFT(lic.serial, 6) AS hlNum FROM cl_hlusers.custom_login_licenses lic WHERE lic.npid = ? AND ver8and9 = ? - AND lic.serial LIKE '96%' AND SUBSTR(lic.serial, 7, 1)"; - - if ($product == '2') - $query .= " = 'L'"; - else - $query .= " != 'L'"; - - Database::getInstance()->query($query, array('si', $npid, $ver8and9)); - $checked_user = Database::getInstance()->fetchNext(); - - $needKey = empty($checked_user); - - if (!$needKey) { - $errorMsg = 'trial_exist_on_this_computer'; - return ''; - } - } - - $customName = $trial_user['name']; - } - - if ($needKey) { - $info = 'Trial igénylés'; - - $query = "SELECT hlNum FROM `" . CRMADATBAZIS . "`.`hardlock` WHERE hlNum >= 960010 AND hlNum <= 969999 AND hlStat = ? ORDER BY hlNum;"; - Database::getInstance()->query($query, array('i', _Hardlock::Blank)); - $hardlock = Database::getInstance()->fetchNext(); - - $nUserID = $userID; - $userID = $userID > 0 ? $userID : crm_hardlock::GetTrialDistributor($userID); // Custom trial request-nel ez mas lesz - - if (empty($hardlock)) { - $hlNum = crm_hardlock::tryToAlloc(960010, 969999); - - crm_hardlock::AddHardlock( - array( - 'hlNum' => $hlNum, - 'hlCtrID' => $ctrID, - 'hlLan' => 0, - 'hlStat' => _Hardlock::Active, - 'hlDateIssue' => date('Y-m-d', $time), - 'hlManID' => 36, - 'hlTime' => date('Y-m-d H:i:s', $time), - 'hlUser' => $userID, - 'hlDealer' => $dealer, - 'bUjithato' => 1, - 'old_db' => 'clusers_eng', - 'product_id' => $product - ), - 'siiisisssisi' - ); - } else { - $hlNum = $hardlock['hlNum']; - - Database::getInstance()->update( - CRMADATBAZIS . '.hardlock', - array( - 'hlStat' => _Hardlock::Active, - 'product_id' => $product, - 'hlDatePro' => '', - 'hlUser' => $userID, - 'hlCtrID' => $ctrID, - 'hlLan' => 0 - ), - array('hlNum' => $hlNum), - 'iisiiii' - ); - } - - Database::getInstance()->insert( - CRMADATBAZIS . ".h_history", - array( - "hiHlNum" => $hlNum, - "hiDate" => date('Y-m-d', time()), - "hiManID" => _Manager::Web, - "hiTypeID" => 2, - "hiTime" => date('Y-m-d H:i:s', time()), - "hiInfo" => $info - ), - 'ssiiss' - ); - } else { - if ($res['hlStat'] == 2) { - $errorMsg = 'trial_exist_on_this_computer'; - return ''; - } - - $hlNum = $res['hlNum']; - } - - if ($specEdition == 'LT') - $type = 4; - else - $type = $product == 1 ? 8 : 76; - - $verCode = crm_hardlock::GetVerCodeFromverId($verID); - $fizetve = $time + 40 * 86400; - - $password = Codegen::GeneratePassword($hlNum, 0, $type, $verCode); - - crm_hardlock::AddProgram( - array( - 'prTypeID' => $type, - 'prVerID' => $verID, - 'prLan' => 0, - 'prPass' => trim($password), - 'prSellDate' => date('Y-m-d', $time), - 'prActDate' => date('Y-m-d', $fizetve), // 40 nap - 'prFizetve' => date('Y-m-d', $fizetve), - 'prTime' => date('Y-m-d H:i:s', $time), - 'prLastMod' => date('Y-m-d H:i:s', $time), - 'prContact' => 10, // TRIAL - 'prHlNum' => $hlNum, - 'prManID' => 36, - 'prStat' => 0, - 'prHiType' => 1, - 'twtw' => 1, - 'prInfo' => $customName - ), - 'iiissssssisiiiis' - ); - - if ($nUserID < 0) { - Database::getInstance()->update( - CRMADATBAZIS . '.custom_login_licenses', - array( - 'serial' => $password - ), - array('id' => abs($nUserID)), - 'si' - ); - } - - return $password; - } - - public static function UpdateInstallationDate($password, $compID, $build, $uj_aktivalokod, $user_IP, $installDate, &$stats = array()) - { - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`userstats2013` WHERE usCompID = ? AND usPwd = ? AND usBuild = ? AND"; - $bind_array = array('sss', $compID, $password, $build); - - if (empty($uj_aktivalokod)) { - $query .= " valasz IS NULL OR valasz = ''"; - } else { - $query .= " valasz = ?"; - $bind_array = array('ssss', $compID, $password, $build, $uj_aktivalokod); - } - - $query .= " ORDER BY usDate DESC"; - Database::getInstance()->query($query, $bind_array); - $usStats = Database::getInstance()->fetchNext(); - - if (empty($usStats)) { // Ha nincs benne a userstats2013 tablaba, akkor felvesszuk - $stats["valasz"] = $uj_aktivalokod; - $bind = ''; - - foreach ($stats as $stat) { - if (is_numeric($stat)) - $bind .= 'i'; - else - $bind .= 's'; - } - - $usstatid = Database::getInstance()->insert(CRMADATBAZIS . ".userstats2013", $stats, $bind); - } else { - if ($stats['workingMinutes'] != null && $stats['workingMinutes'] != '') - $wt = $stats['workingMinutes'] + $usStats['workingMinutes']; - else - $wt = $usStats['workingMinutes']; - - if ($wt == '' || $wt == null || $wt < 0) - $wt = 0; - - $counter = $usStats['usInditasokSzama']; - $counter++; - $usstatid = (int)$usStats['usID']; - Database::getInstance()->update( - CRMADATBAZIS . ".userstats2013", - array( - 'usInditasokSzama' => $counter, - 'usIP' => $user_IP, - 'usTelepitesiDatum' => $installDate, - 'usDate' => time(), - 'usOSData' => $stats['usOSData'], - 'workingMinutes' => $wt - ), - array('usID' => $usstatid), - 'issisii' - ); - $stats['usInditasokSzama'] = $counter; - } - return $usstatid; - } - - public static function sCheckPassword($password) - { - $program = new program(); - $program->SetPassword($password); - - $engedelyek = array(/*'aktivalasi kod'*/); - $hibak = $program->CheckPassword($engedelyek); - - return $hibak; - } - - public static function getLatestProgram($prHlNum) - { - $query = "SELECT prContact, prFizetve, prSellDate FROM h_programs WHERE prHlNum = '{$prHlNum}' ORDER BY prVerID DESC LIMIT 1;"; - crm_database::getInstance()->query($query); - - return crm_database::getInstance()->fetchNext(); - } - - public static function QuaterlyPaid($prFizetve) - { - $currentDate = date('Y-m-d'); - $currentTime = strtotime($currentDate); - - // Elso negyedev - if ($prFizetve == date('Y') . '-01-31' && $currentTime < strtotime(date('Y') . '-01-01')) { - return true; - } - - // Masodik negyedev - if ($prFizetve == date('Y') . '-04-30' && $currentTime < strtotime(date('Y') . '-04-01')) { - return true; - } - - // Harmadik negyedev - if ($prFizetve == date('Y') . '-07-31' && $currentTime < strtotime(date('Y') . '-07-01')) { - return true; - } - - // Negyedik negyedev - if ($prFizetve == date('Y') . '-10-31' && $currentTime < strtotime(date('Y') . '-10-01')) { - return true; - } - - return false; - } - - public static function getQuarterlySupportPaid($prFizetve) - { - $currentDate = date('Y-m-d'); - $currentTime = strtotime($currentDate); - $expire = ''; - - // Elso negyedev - if ($prFizetve == date('Y') . '-01-31' && $currentTime < strtotime(date('Y') . '-01-01')) { - $date = date('Y', strtotime('-1 year')); - $expire = $date . '-12-31'; - } - - // Masodik negyedev - if ($prFizetve == date('Y') . '-04-30' && $currentTime < strtotime(date('Y') . '-04-01')) { - $expire = date('Y') . '-03-31'; - } - - // Harmadik negyedev - if ($prFizetve == date('Y') . '-07-31' && $currentTime < strtotime(date('Y') . '-07-01')) { - $expire = date('Y') . '-06-30'; - } - - // Negyedik negyedev - if ($prFizetve == date('Y') . '-10-31' && $currentTime < strtotime(date('Y') . '-10-01')) { - $expire = date('Y') . '-09-30'; - } - - return $expire; - } - - public static function getQuarterlySupportNotPaid($prFizetve) - { - $currentDate = date('Y-m-d'); - $currentTime = strtotime($currentDate); - $expire = ''; - - // Elso negyedev - if ($prFizetve == date('Y') . '-01-31' && $currentTime >= strtotime(date('Y') . '-01-01')) { - $expire = date('Y') . '-03-31'; - } - - // Masodik negyedev - if ($prFizetve == date('Y') . '-04-30' && $currentTime >= strtotime(date('Y') . '-04-01')) { - $expire = date('Y') . '-06-30'; - } - - // Harmadik negyedev - if ($prFizetve == date('Y') . '-07-31' && $currentTime >= strtotime(date('Y') . '-07-01')) { - $expire = date('Y') . '-09-30'; - } - - // Negyedik negyedev - if ($prFizetve == date('Y') . '-10-31' && $currentTime >= strtotime(date('Y') . '-10-01')) { - $expire = date('Y') . '-12-31'; - } - - return $expire; - } - - public static function getSupport($prContact, $maintenance_valid, $maint_expiration, $prFizetve, $prSellDate) - { - // Karbantartasi szerzodesek - $maintenanceArray = array(2, 6, 7); - - // Van ervenyes karbantartasi szerzodese es ki is van fizetve - if (in_array($prContact, $maintenanceArray) && $prFizetve == '2050-01-01') { - $expire = date('Y') . '-12-31'; - return "{$expire}-ig"; - } - - // Elofizetoi, ha a az aktivalas ervenyessege nagyobb, mint a jelenlegi datum - if ($prContact == '1' && $prFizetve > date('Y-m-d')) { - $exp = date('Y-m-d', strtotime($prSellDate . ' + 90 days')); - return "{$exp}-ig"; - } - - // Licenc - egy osszeg vagy Licenc - berles vagy Licenc - reszlet - if ($prContact == '0' || $prContact == '11' || $prContact == '3') { - if ($maint_expiration != '' && $maint_expiration > date('Y-m-d')) { - return "{$maint_expiration}-ig"; - } - // Az eladasi datumhoz hozza kell adni 90 napot, annyi a termektamogatas - $perpExpire = date('Y-m-d', strtotime($prSellDate . ' + 90 days')); - - // Ha a jelenlegi datum kisebb, mint az eladasi datum + 90 nap, akkor van termektamogatas - if (strtotime(date("Y-m-d")) <= strtotime($perpExpire)) { - return "{$perpExpire}-ig"; - } - } - - // Karbantartasi - egyosszeg - nincs kifizetve - if (($prContact == '2' && date('Y-m-d') > date('Y-01-20'))) { - return "{$prFizetve}-ig"; - - // return "Nem (Hátralék miatt felfüggesztve)"; - } - - // Karbantartasi - reszlet - nincs kifizetve - if ($prContact == '7' && $prFizetve != '2050-01-01' && $prFizetve > date('Y-m-d')) { - return "{$prFizetve}-ig"; - } - - // Karbantartasi - negyedeves - nincs kifizetve - if ($prContact == '6' && !crm_hardlock::QuaterlyPaid($prFizetve)) { - $expire = crm_hardlock::getQuarterlySupportNotPaid($prFizetve); - return "{$prFizetve}-ig"; - } - - // Karbantartasi - negyedeves - kifizetve - if ($prContact == '6' && crm_hardlock::QuaterlyPaid($prFizetve)) { - return "{$prFizetve}-ig"; - } - - // Be van allitva a termektamogatas lejarata - if ($maint_expiration != '' && strtotime($maint_expiration)) { - return "{$maint_expiration}-ig"; - } - - return ""; - } - - public static function CheckUserProgram($nUserID, $engedelyek = array()) - { - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`hardlock` WHERE hlUser = ?"; - Database::getInstance()->query($query, array('s', $nUserID)); - $keys = Database::getInstance()->fetchAssoc(); - - $hibak = array(); - foreach ($keys as $hl) { - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`h_programs` WHERE prHlNum = ?"; - Database::getInstance()->query($query, array('s', $hl["hlNum"])); - $programs = Database::getInstance()->fetchAssoc(); - if (empty($programs)) continue; - - $testedPasswords = array(); - foreach ($programs as $program) { - $password = $program["prPass"]; - if (in_array($password, $testedPasswords)) continue; - - array_push($testedPasswords, $password); - $program = new program(); - $program->SetPassword($password); - $result = $program->CheckPassword($engedelyek); - - if (!empty($result)) array_push($hibak, $password . ": " . $result); - } - } - return $hibak; - } - - public static function CheckHardlockProgram($hlnum, $engedelyek = array()) - { - $hibak = array(); - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`h_programs` WHERE prHlNum = ?"; - Database::getInstance()->query($query, array('s', $hlnum)); - $programs = Database::getInstance()->fetchAssoc(); - if (empty($programs)) return; - - $testedPasswords = array(); - foreach ($programs as $program) { - $password = $program["prPass"]; - if (in_array($password, $testedPasswords)) continue; - - array_push($testedPasswords, $password); - $program = new program(); - $program->SetPassword($password); - $result = $program->CheckPassword($engedelyek); - - if (!empty($result)) array_push($hibak, $password . ": " . $result); - } - return $hibak; - } - - public static function CheckHardlockProgramFromArray($hlnum, $engedelyek = array()) - { - $hibak = array(); - $hlnumArray = explode(';', $hlnum); - - foreach ($hlnumArray as $hlnums) { - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`h_programs` WHERE prHlNum = ?"; - Database::getInstance()->query($query, array('s', $hlnums)); - $programs = Database::getInstance()->fetchAssoc(); - if (empty($programs)) continue; - - $testedPasswords = array(); - foreach ($programs as $program) { - $password = $program["prPass"]; - if (in_array($password, $testedPasswords)) continue; - - array_push($testedPasswords, $password); - $program = new program(); - $program->SetPassword($password); - $result = $program->CheckPassword($engedelyek); - - if (!empty($result)) array_push($hibak, $password . ": " . $result); - } - } - return $hibak; - } - - public static function CheckHardlockProgramWithLimit($hlnum, $limit, $engedelyek = array()) - { - $hibak = array(); - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`h_programs` WHERE prHlNum >= ? ORDER BY prHlNum ASC LIMIT {$limit}"; - Database::getInstance()->query($query, array('s', $hlnum)); - $programs = Database::getInstance()->fetchAssoc(); - if (empty($programs)) return; - - $testedPasswords = array(); - foreach ($programs as $program) { - $password = $program["prPass"]; - $prHlNum = $program["prHlNum"]; - if (in_array($password, $testedPasswords)) continue; - - array_push($testedPasswords, $password); - $program = new program(); - $program->SetPassword($password); - $result = $program->CheckPassword($engedelyek); - - if (!empty($result)) - array_push($hibak, "{$password}: {$result}"); - } - return $hibak; - } - - public static function CorrectInstallDateInUserStats2013($password, $compid) - { - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`userstats2013` WHERE usPwd = ?"; - Database::getInstance()->query($query, array('s', $password)); - $usstats = Database::getInstance()->fetchAssoc(); - } - - public static function CorrectInstallDateInUserStats2013ForAllHardwareKeysAndDeleteExpiredSoftwareKeys() - { - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`userstats2013` WHERE (usTelepitesiDatum = ? OR usTelepitesiDatum IS NULL) AND usDate > ? ORDER BY usPwd DESC"; - Database::getInstance()->query($query, array('si', "0000-00-00", 1561939200)); - $usstats = Database::getInstance()->fetchAssoc(); - - $utolsoSellDate = ""; - $utolsoPassword = ""; - - foreach ($usstats as $stats) { - $usid = $stats["usID"]; - $password = $stats["usPwd"]; - - if (Codegen::IsSoftwareKey($password) && self::IsProgramExpiredByFixDate($password)) { - $query = "DELETE FROM `" . CRMADATBAZIS . "`.`userstats2013` WHERE usID = ?"; - Database::getInstance()->query($query, array('i', $usid)); - print "
"; - print "{$password} torolve lett (lejart szoftverkulcsos program)"; - - continue; - } - - if ($password != $utolsoPassword) { - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`h_programs` WHERE prPass = ?"; - Database::getInstance()->query($query, array('s', $password)); - $programs = Database::getInstance()->fetchNext(); - - if (empty($programs)) continue; - - if (empty($programs["prSellDate"]) || $programs["prSellDate"] == "0000-00-00" || $programs["prSellDate"] == NULL) - continue; - - $sellDate = $programs["prSellDate"]; - } else - $sellDate = $utolsoSellDate; - - Database::getInstance()->update( - CRMADATBAZIS . ".userstats2013", - array( - 'usTelepitesiDatum' => $sellDate - ), - array('usID' => $usid), - 'si' - ); - print "
"; - print "{$password} datum beallitva (hardware kulcs) : {$sellDate}"; - - $utolsoSellDate = $sellDate; - $utolsoPassword = $password; - } - } - - public function GenerateSpecialEditionTrialActCode($password, $isid, $timeelteltnap, $isTwTw = false) - { - $ver8and9 = self::GetVer8And9FromPassword($password); - $launchYear = self::GetLaunchYearFromVer8And9($ver8and9); - $year = new DateTime($launchYear . "-01-01"); - $ctr = self::GetCountryFromPassword($password); - - $expirationDay = self::$fixExpirationDates[$ctr]; - - if (empty($expirationDay)) return false; - - foreach ($expirationDay as $days) { - if (empty($days)) continue; - - $year->modify((string)$days); - } - - if ($isTwTw) { // 2020-tol nem a telepitesi idotol, hanem 2020-01-01-tol szamoljuk az eltelt napokat - $mettol = self::getTwTwRootTimeString(); - } else { - $timeMettol = time() - $timeelteltnap; - $mettol = date('Y-m-d', $timeMettol); - } - - $napok = Codegen::GetDayInterval($mettol, $year->format('Y-m-d')); - $aktkod = Codegen::GenerateTimeCode($password, $isid, $napok); - $aktkod = (Codegen::IsValidTimeCode($aktkod) ? $aktkod : ''); - return $aktkod; - } - - public static function getTwTwRootTimeString() - { - return '2020-01-01'; - } - public static function getTwTwRootTime() - { - return 1577836800; - } // 2020-01-01 00:00:00 UTC - - public static function IsProgramExpiredByFixDate($password) - { - $ver8and9 = self::GetVer8And9FromPassword($password); - $launchYear = self::GetLaunchYearFromVer8And9($ver8and9); - $year = new DateTime($launchYear . "-01-01"); - $ctr = self::GetCountryFromPassword($password); - - $expirationDay = self::$fixExpirationDates[$ctr]; - if (empty($expirationDay)) return false; - - foreach ($expirationDay as $days) { - if (empty($days)) continue; - - $year->modify((string)$days); - } - $date = new DateTime(date('Y-m-d')); - - return ($year < $date); - } - - public static function CorrectActivationCode($password, $isid) - { - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`h_programs` WHERE prPass = ?"; - Database::getInstance()->query($query, array('s', $password)); - $programs = Database::getInstance()->fetchAssoc(); - if (empty($programs)) return; - - foreach ($programs as $program) { - $aktivalokod = $program['prActCode']; - if (empty($aktivalokod) || !Codegen::IsValidTimeCode($aktivalokod)) continue; - - $currentIsid = self::GetIsidFromTimeCode($aktivalokod); - if ($isid != $currentIsid) continue; - } - } - - public static function GetWebformPrivateKey() - { - return "3BjGQ6fzMtHupM5V8U3l_u"; - } - - public static function CalcKey($privateKey, $publicKey) - { - $privateKeyLength = strlen($privateKey); - $publicKeyLength = strlen($publicKey); - - if ($privateKeyLength > $publicKeyLength) { - $result = $privateKey; - for ($i = 1; $i < $publicKeyLength; $i += 2) $result[$i] = $publicKey[$i]; - } else { - $result = $publicKey; - for ($i = 0; $i < $privateKeyLength; $i += 2) $result[$i] = $privateKey[$i]; - } - return sha1($result); - } - - public static function IsActiveProgram($serial, $isid) - { - $query = "SELECT * FROM `cl_hlusers`.`p_serial_isid` WHERE serial = ? AND isid = ? AND aktiv = ?"; - Database::getInstance()->query($query, array('ssi', $serial, $isid, 1)); - $res = Database::getInstance()->fetchNext(); - - return (!empty($res)); - } - - public static function GetComputerName($serial, $isid) - { - $query = "SELECT computer_id FROM `" . CRMADATBAZIS . "`.`p_serial_isid` WHERE serial = ? AND isid = ?"; - Database::getInstance()->query($query, array('ss', $serial, $isid)); - $p_serial_isid = Database::getInstance()->fetchNext(); - - $query = "SELECT computer_name FROM `" . CRMADATBAZIS . "`.`computers` WHERE id = ?"; - Database::getInstance()->query($query, array('i', $p_serial_isid['computer_id'])); - $res = Database::getInstance()->fetchNext(); - - return $res['computer_name']; - } - - public static function encode($privateKey, $publicKey, $data) - { - $key = self::CalcKey($privateKey, $publicKey); - $strLen = strlen($data); - $keyLen = strlen($key); - - for ($i = 0; $i < $strLen; $i++) { - $ordStr = ord(substr($data, $i, 1)); - - if ($j == $keyLen) $j = 0; - - $ordKey = ord(substr($key, $j, 1)); - $j++; - $hash .= strrev(base_convert(dechex($ordStr + $ordKey), 16, 36)); - } - return $hash; - } - - public static function decode($privateKey, $publicKey, $data) - { - $key = self::CalcKey($privateKey, $publicKey); - $strLen = strlen($data); - $keyLen = strlen($key); - - for ($i = 0; $i < $strLen; $i += 2) { - $ordStr = hexdec(base_convert(strrev(substr($data, $i, 2)), 36, 16)); - - if ($j == $keyLen) $j = 0; - - $ordKey = ord(substr($key, $j, 1)); - $j++; - $hash .= chr($ordStr - $ordKey); - } - return $hash; - } - - // A selectprogramdialog.class.php hasznalja, ez mar regi! - public static function decode2($string, $key) - { - $key = sha1($key); - $strLen = strlen($string); - $keyLen = strlen($key); - for ($i = 0; $i < $strLen; $i += 2) { - $ordStr = hexdec(base_convert(strrev(substr($string, $i, 2)), 36, 16)); - if ($j == $keyLen) $j = 0; - $ordKey = ord(substr($key, $j, 1)); - $j++; - $hash .= chr($ordStr - $ordKey); - } - return $hash; - } - - public static function get_valueFromStringUrl($url, $parameter_name) - { - $parts = parse_url($url); - if (isset($parts['query'])) { - parse_str($parts['query'], $query); - if (isset($query[$parameter_name])) return $query[$parameter_name]; - else return null; - } else return null; - } - - public static function SetWebformResult($session, $result, $encodedResult, $message, $button) - { - $query = "SELECT * FROM `cl_hlusers`.`webform_results` WHERE session_id = ?"; - Database::getInstance()->query($query, array('s', $session)); - $res = Database::getInstance()->fetchNext(); - - if (empty($res)) { - $sess = array( - 'session_id' => $session, - 'result' => $result . '=' . $encodedResult, - 'insertDate' => date("Y-m-d"), - 'message' => $message, - 'button' => $button - ); - Database::getInstance()->insert(CRMADATBAZIS . ".webform_results", $sess, 'sssss'); - } else { - Database::getInstance()->update( - CRMADATBAZIS . ".webform_results", - array( - 'result' => $result . '=' . $encodedResult, - 'insertDate' => date("Y-m-d") - ), - array('session_id' => $session), - 'sss' - ); - } - } - - public static function Convert($betu) - { - $ret = 0; - - switch (strtoupper($betu)) { - case 'A': { - $ret = 0; - break; - } - case 'B': { - $ret = 1; - break; - } - case 'C': { - $ret = 2; - break; - } - case 'D': { - $ret = 3; - break; - } - case 'E': { - $ret = 4; - break; - } - case 'F': { - $ret = 5; - break; - } - case 'G': { - $ret = 6; - break; - } - case 'H': { - $ret = 7; - break; - } - case 'I': { - $ret = 8; - break; - } - case 'J': { - $ret = 9; - break; - } - case 'K': { - $ret = 10; - break; - } - case 'L': { - $ret = 11; - break; - } - case 'M': { - $ret = 12; - break; - } - case 'N': { - $ret = 13; - break; - } - } - return ($ret); - } - - public static function getWebinarReminderEng() - { - $msg = "Hello!
- Did you catch the Webinar yesterday about [TOPIC]?
- If you did, we hope you enjoyed it! Need more time to practice? Watch it again here: [YT_LINK]

- - If you missed the show, you can watch it here: [YT_LINK]

- - - Best wishes,
- The CadLine Team"; - - return $msg; - } - - public static function getWebinarReminderHun() - { - $msg = 'Kedves [NAME],

- - Köszönjük a jelentkezésedet a webinárra. A következő adásunk témája: [TOPIC]

- - Mikor?
- [DATE]
- Itt nézheted

- - Mire lesz szükséged:
- Győződj meg arról, hogy az eszközön, amin nézni fogod, van hang, továbbá egy YouTube vagy Gmail fiók is kelleni fog, ha szeretnél az adás alatt kommentálni, vagy kérdezni.

- -
- - Fontos:
- Az adást fel fogjuk venni, és később is elérhető lesz a YouTube csatornánkon. Azzal, hogy részt veszel az Élő adáson, elfogadod, hogy a hozzászólásaid láthatóak lesznek a felvett anyagon.

- - Ha bármi kérdésed van, fordjulj hozzánk az info@cadline.hu email címen

- - Találkozunk az élő adásban!

- - - Üdvözlettel, - - A CADLine csapata'; - - return $msg; - } -} - -class Codegen -{ - public static function IsValidPassword($password) - { - if ($password == "") return false; - - $ph = popen(PATH_CODEGEN . " -isValidPassword " . $password, "r") or die("A 'codegen' paranccsal nem veheto fel kapcsolat"); - $result = fgets($ph, 1024); - pclose($ph); - - return ($result == 'true'); - } - - public static function IsValidTimeCode($idokod) - { - if ($idokod == "") return false; - - $ph = popen(PATH_CODEGEN . " -isValidDealerCode " . $idokod, "r") or die("A 'codegen' paranccsal nem veheto fel kapcsolat"); - $result = fgets($ph, 1024); - pclose($ph); - - return ($result == 'true'); - } - - public static function GetDayFromTimeCode($idokod) - { - $command = PATH_CODEGEN . " -ParseTimeCode " . $idokod; - $ph = popen($command, "r"); - $result = fgets($ph, 1024); - $result = (int)$result; - pclose($ph); - - return $result; - } - - public static function GeneratePassword($hlNum, $lan, $type, $version) - { - $country = substr($hlNum, 0, 2); - $number = substr($hlNum, 2, 4); - - if ($type == 76) $type = 'L'; // Live - else $type = (int)substr($type, 0, 1); - - $command = PATH_CODEGEN . " -Password " . $country . $number . $version . $lan . $type; - $ph = popen($command, "r") or die("A 'codegen' paranccsal nem veheto fel kapcsolat"); - $password = fgets($ph, 1024); - pclose($ph); - - return $password; - } - - public static function GenerateTimeCode($password, $isid, $numOfDays) - { - if (!self::IsSoftwareKey($password)) $isid = self::GetCountryFromPassword($password) . crm_hardlock::GetVer8And9FromPassword($password); - - $nVersion = intval(substr($password, 7, 2)); - if ($nVersion > 29) $command = PATH_CODEGEN . " -GenerateTimeCode " . $password . " " . $isid . " " . $numOfDays; - else $command = PATH_CODEGEN . " -XDay " . $password . " " . $numOfDays; - - $command = PATH_CODEGEN . " -GenerateTimeCode " . $password . " " . $isid . " " . $numOfDays; - $ph = popen($command, "r") or die("A 'codegen' paranccsal nem veheto fel kapcsolat"); - $aktkod = fgets($ph, 1024); - pclose($ph); - - return $aktkod; - } - - public static function IsSoftwareKey($serial = "") - { - if ($serial == "") return false; - - if (self::GetCountryFromPassword($serial) == 37) { // Belso tesztekre hasznalt kulcsok a 37-esek - if (crm_hardlock::IsLiveKey($serial)) return true; - - if (substr($serial, 0, 3) == 371) return true; - else return false; - } - - $ph = popen(PATH_CODEGEN . " -IsSoftwareKey " . $serial, "r") or die("A 'codegen' paranccsal nem veheto fel kapcsolat"); - $szoftveres = fgets($ph, 1024); - pclose($ph); - - return ($szoftveres == 'true'); - } - - public static function GetDayInterval($mettol, $meddig, $internal = false) - { - if ($internal) { - $from = strtotime($mettol . ' 00:00:00 GMT'); - $to = strtotime($meddig . ' 00:00:00 GMT'); - $days = $to - $from; - $napok = (int)floor($days / (60 * 60 * 24)); - - $message = 'From: ' . $from . ' || To: ' . $to . ' || Days: ' . $napok; - - crm_hardlock::AddToDebugTable($message, 'offlineActDate'); - } else { - $command3 = PATH_CODEGEN . " -DiffDay " . $mettol . " " . $meddig; - $ph = popen($command3, "r") or die("A 'codegen' paranccsal nem veheto fel kapcsolat"); - $napok = fgets($ph, 1024); - pclose($ph); - } - - return $napok; - } - - public static function GetCountryFromPassword($password) - { - return substr($password, 0, 2); - } - public static function GetCountryFromTimeCode($timeCode) - { - return substr($timeCode, 5, 2); - } -} - -class Webform -{ - public static function GetWebformPrivateKey() - { - return "3BjGQ6fzMtHupM5V8U3l_u"; - } - - public static function CalcKey($privateKey, $publicKey) - { - $privateKeyLength = strlen($privateKey); - $publicKeyLength = strlen($publicKey); - - if ($privateKeyLength > $publicKeyLength) { - $result = $privateKey; - for ($i = 1; $i < $publicKeyLength; $i += 2) $result[$i] = $publicKey[$i]; - } else { - $result = $publicKey; - for ($i = 0; $i < $privateKeyLength; $i += 2) $result[$i] = $privateKey[$i]; - } - return sha1($result); - } - - public static function encode($privateKey, $publicKey, $data) - { - // Proba webform encode volt (C++) - /*if ($_SERVER['REMOTE_ADDR'] == '176.63.24.91' || $_SERVER['REMOTE_ADDR'] == '94.247.91.41') { - return twk_encode($privateKey, $publicKey, $data); - }*/ - - $hash = ''; - $key = self::CalcKey($privateKey, $publicKey); - $strLen = strlen($data); - $keyLen = strlen($key); - - for ($i = 0; $i < $strLen; $i++) { - $ordStr = ord(substr($data, $i, 1)); - - if ($j == $keyLen) $j = 0; - - $ordKey = ord(substr($key, $j, 1)); - $j++; - $hash .= strrev(base_convert(dechex($ordStr + $ordKey), 16, 36)); - } - return $hash; - } - - public static function decode($privateKey, $publicKey, $data) - { - // Proba webform decode volt (C++) - /*if ($_SERVER['REMOTE_ADDR'] == '176.63.24.91' || $_SERVER['REMOTE_ADDR'] == '94.247.91.41') { - return twk_decode($privateKey, $publicKey, $data); - }*/ - - $hash = ''; - $key = self::CalcKey($privateKey, $publicKey); - $strLen = strlen($data); - $keyLen = strlen($key); - - for ($i = 0; $i < $strLen; $i += 2) { - $ordStr = hexdec(base_convert(strrev(substr($data, $i, 2)), 36, 16)); - - if ($j == $keyLen) $j = 0; - - $ordKey = ord(substr($key, $j, 1)); - $j++; - $hash .= chr($ordStr - $ordKey); - } - return $hash; - } - - public static function get_valueFromStringUrl($url, $parameter_name) - { - $parts = parse_url($url); - if (isset($parts['query'])) { - parse_str($parts['query'], $query); - if (isset($query[$parameter_name])) return $query[$parameter_name]; - else return null; - } else return null; - } - - public static function SetWebformResult($session, $result, $encodedResult, $message, $button) - { - if (strpos($session, '\\') !== false || strpos($session, ']') !== false) { - die(); - } - - if (strpos($session, 'xD4') !== false || strpos($session, 'x0F') !== false || strpos($session, '...') !== false) { - die(); - } - - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`webform_results` WHERE session_id = ?"; - Database::getInstance()->query($query, array('s', $session)); - $res = Database::getInstance()->fetchAssoc(); - - if (empty($res)) { - $sess = array( - 'session_id' => $session, - 'result' => "{$result}={$encodedResult}", - 'insertDate' => date("Y-m-d"), - 'message' => $message, - 'button' => $button - ); - Database::getInstance()->insert(CRMADATBAZIS . ".webform_results", $sess, 'sssss'); - } else { - Database::getInstance()->update( - CRMADATBAZIS . ".webform_results", - array( - 'result' => "{$result}={$encodedResult}", - 'insertDate' => date("Y-m-d") - ), - array('session_id' => $session), - 'sss' - ); - } - } - - public static function GenerateSerialXML($programCount, $password, $errorMsg) - { - $data = ""; - - if ($errorMsg != '') { - $data .= "{$errorMsg}"; - } else { - $data .= "{$programCount}"; - $data .= "{$password}"; - } - - $data .= ""; - - return $data; - } - - public static function getLoginLanguageFile($ctrID) - { - switch ($ctrID) { - case '36': - $lang = 'hun'; - break; - - case '39': - $lang = 'esp'; - break; - - default: - $lang = 'eng'; - break; - } - - return $_SERVER['DOCUMENT_ROOT'] . "/maintenance/webform/languages/{$lang}.php"; - } - - public static function getLanguageFile($lang) - { - $lang = $lang != '' && file_exists("languages/{$lang}.php") ? $lang : 'eng'; - - return "languages/{$lang}.php"; - } -} - -class Resource extends Database -{ - private $ctrID; - private $table; - private $regex; - - private $region = 'INT'; - private $regionType = 17; - - private $tables = array( - 'ref' => 'resourcemanager.text_table_ref', - '36' => 'resourcemanager.text_table_hun', - '39' => 'resourcemanager.text_table_ita', - '49' => 'resourcemanager.text_table_ger', - '43' => 'resourcemanager.text_table_ger', - '48' => 'resourcemanager.text_table_pol', - '82' => 'resourcemanager.text_table_kor', - '34' => 'resourcemanager.text_table_esp', - '30' => 'resourcemanager.text_table_gre', - '42' => 'resourcemanager.text_table_cz', - '38' => 'resourcemanager.text_table_cr', - '88' => 'resourcemanager.text_table_chn', - '83' => 'resourcemanager.text_table_zh_cn', - '47' => 'resourcemanager.text_table_nor', - '33' => 'resourcemanager.text_table_fr', - '51' => 'resourcemanager.text_table_pt', - '55' => 'resourcemanager.text_table_pt', - '12' => 'resourcemanager.text_table_bg' - ); - - public function __construct($ctrID, $rgn = 'INT') - { - parent::__construct(); - - unset($this->ctrID); - - $this->ctrID = $ctrID; - - $this->setCountryTable(); - $this->setRegex(); - $this->setRegion($rgn); - } - - private function setCountryTable() - { - $this->table = array_key_exists($this->ctrID, $this->tables) ? $this->tables[$this->ctrID] : $this->tables['ref']; - } - - private function setRegex() - { - $delimiter = '#'; - $startTag = '$('; - $endTag = ')'; - $this->regex = $delimiter . preg_quote($startTag, $delimiter) - . '(.*?)' - . preg_quote($endTag, $delimiter) - . $delimiter - . 's'; - } - - private function setRegion($rgn = 'INT') - { - $query = 'SELECT ref.text AS langText, ref.text AS refText, ref.key AS refKey - FROM resourcemanager.text_table_ref ref - WHERE ref.type_id = ? AND ref.key LIKE ? LIMIT 1;'; - Database::getInstance()->query($query, array('is', $this->regionType, '%_' . $rgn)); - $checkRegion = Database::getInstance()->fetchNext(); - if (!empty($checkRegion)) { - $this->region = strtoupper($rgn); - } - } - - private function getRegionResult($text) - { - if ($this->table == 'resourcemanager.text_table_ref') { - $query = 'SELECT ref.text AS langText, ref.text AS refText, ref.key AS refKey - FROM resourcemanager.text_table_ref ref - WHERE ref.type_id = ? AND ref.key = ?;'; - } else { - $query = 'SELECT res.text AS langText, ref.text AS refText, ref.key AS refKey - FROM resourcemanager.text_table_ref ref - LEFT JOIN ' . $this->table . ' res ON res.ref_id = ref.id - WHERE ref.type_id = ? AND ref.key = ?;'; - } - Database::getInstance()->query($query, array('is', $this->regionType, $text . '_' . $this->region)); - - return Database::getInstance()->fetchNext(); - } - - public function getDlgString($key, $year = '', $needNewLine = false) - { - $text = ''; - - $query = "SELECT * FROM resourcemanager.text_table_ref ref WHERE ref.type_id = ? AND ref.key = ? LIMIT 1"; - $this->query($query, array('is', 1, $key)); - $ref = $this->fetchNext(); - - if ($this->table == 'resourcemanager.text_table_ref') { - $text = $ref['text']; - } else { - $query = "SELECT * FROM {$this->table} res WHERE res.ref_id = ? LIMIT 1"; - $this->query($query, array('i', $ref['id'])); - $res = $this->fetchNext(); - - $text = $res['text'] == '' ? $ref['text'] : $res['text']; - } - - $preg = preg_match($this->regex, $text, $matches); - if (strpos($text, '$(PROGRAM_VERSION)') == false && $preg) { - $regionResult = $this->getRegionResult($matches[1]); - if (!empty($regionResult)) { - $regionText = $regionResult['langText'] != '' ? $regionResult['langText'] : $regionResult['refText']; - $text = str_replace($matches[0], $regionText, $text); - } - } - - if ($year != '') { - $progVersion = 'ARCHLine.XP ' . $year; - $text = str_replace('$(PROGRAM_VERSION)', $progVersion, $text); - } - - return $needNewLine ? nl2br($text) : $text; - } -} - -class Tester -{ - public static function getFalseTestResults() - { - $now = date('Y-m-d H:i'); - $new_time = substr(date("Y-m-d H:i", strtotime('-12 hours', strtotime($now))), 0, 13); - - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`telemetria` WHERE substring(mod_datetime, 1, 13) >= ? - AND error_code != ? AND error_code != ?"; - Database::getInstance()->query($query, array('sii', $new_time, -1, 0)); - $res = Database::getInstance()->fetchAssoc(); - - return $res; - } - - public static function checkLicenceSettings() - { - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`h_programs` WHERE prContact = ? AND prFizetve != ? AND prVerID > ? AND prHlNum NOT LIKE ? - AND prHlNum IN (SELECT prHlNum FROM `" . CRMADATBAZIS . "`.`h_programs` WHERE prVerID = ? AND prFizetve = ?)"; - Database::getInstance()->query($query, array('isisis', 0, "2050-01-01", 19, "39%", 19, "2050-01-01")); - $programs = Database::getInstance()->fetchAssoc(); - - return $programs; - } - - public static function checkLicenceSettingsWithInOneAmount() - { - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`h_programs` WHERE prFizetve != ? AND prHlNum NOT LIKE ? AND prVerID >= ? - AND (prContact = ? || prContact = ?)"; - Database::getInstance()->query($query, array('ssiii', "2050-01-01", "39%", 19, 0, 2)); - $programs = Database::getInstance()->fetchAssoc(); - - return $programs; - } - - public static function checkLicenceSettingsWithInstallment() - { - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`h_programs` - WHERE prHlNum NOT LIKE ? AND prActCode IS NOT NULL AND prActCode != '' - AND prInvoiceDateTo != SUBSTR(prFizetve, 1, 7) AND prFizetve != '2050-01-01' AND prVerID >= ? AND (prContact = ? || prContact = ?)"; - Database::getInstance()->query($query, array('siii', "39%", 19, 3, 7)); - $programs = Database::getInstance()->fetchAssoc(); - - return $programs; - } - - public static function getCronTime() - { - $action = Time::sMin; // A default ertek az 1 perc - $minute = date('i'); - $hour = date('H'); - - if (($minute % Time::sFiveMin) == 0) $action = Time::sFiveMin; // 5 perc - if (($minute % Time::sFifteenMin) == 0) $action = Time::sFifteenMin; // 15 perc - if (($hour % Hour::sHour) == 0 && $minute == 00) $action = Time::sHour; // 1 ora - if (($hour % Hour::sThreeHour) == 0 && $minute == 00) $action = Time::sThreeHour; // 3 ora - if (($hour % Hour::sSixHour) == 0 && $minute == 00) $action = Time::sSixHour; // 6 ora - if (($hour % Hour::sTwelveHour) == 0 && $minute == 00) $action = Time::sTwelveHour; // 12 ora - if ($hour == 00 && $minute == 00) $action = Time::sDay; // 1 nap - - return $action; - } - - public static function calculateElapsedTime($time_start) - { - $time_end = microtime(true); - $execution_time = $time_end - $time_start; - - return "{$execution_time} seconds"; - } - - public static function oneMinute() - { - $result = ''; - - $query = "SELECT prPass, prActCode FROM `" . CRMADATBAZIS . "`.`h_programs` where prActCode IS NOT NULL AND prActCode != '' AND prActCode NOT LIKE ? AND prVerID > ?"; - Database::getInstance()->query($query, array('si', "____-____-___-____", 7)); - $invalid_actcodes = Database::getInstance()->fetchAssoc(); - - // TODO: Hexadecimalis regex - $query = "SELECT prPass, prHlNum FROM `" . CRMADATBAZIS . "`.`h_programs` WHERE LENGTH(prPass) != ?;"; - // $query = "SELECT prPass, prHlNum FROM `" . CRMADATBAZIS . "`.`h_programs` WHERE (prPass REGEXP '.*[a-z]+' AND SUBSTRING(prPass, 7, 1) != ?) || LENGTH(prPass) != ?;"; - Database::getInstance()->query($query, array('si', "L", 16)); - $invalid_passwords = Database::getInstance()->fetchAssoc(); - - if (empty($invalid_actcodes) && empty($invalid_passwords)) return ''; - - foreach ($invalid_actcodes as $program) $result .= $program['prPass'] . ': Invalid ActCode: ' . $program['prActCode'] . '\n'; - foreach ($invalid_passwords as $program) $result .= $program['prHlNum'] . ': Invalid Password: ' . $program['prPass'] . '\n'; - - if ($result != '') $result = "One minute: \n {$result}"; - return $result; - } - - public static function fiveMinutes() - { - $result = ''; - - if ($result != '') $result = "Five minutes: \n {$result}"; - return $result; - } - - public static function fifteenMinutes() - { - $result = ''; - - if ($result != '') $result = "Fifteen minutes: \n {$result}"; - return $result; - } - - public static function oneHour() - { - $result = ''; - - if ($result != '') $result = "One hour: \n {$result}"; - return $result; - } - - public static function threeHour() - { - $result = ''; - - $query = "SELECT p.serial AS prPass, COUNT(p.serial) AS cnt - FROM cl_hlusers.p_serial_isid p - WHERE p.aktiv = ? AND (p.serial LIKE ? OR p.serial LIKE ?) - AND p.serial IN (SELECT prPass FROM cl_hlusers.h_programs WHERE prLan = ? AND (prTypeID = ? OR prTypeID = ?)) - GROUP BY p.serial - HAVING cnt > 1;"; - Database::getInstance()->query($query, array('issiii', 1, '95%', '99%', 0, 8, 6)); - $programs = Database::getInstance()->fetchAssoc(); - - if (empty($programs)) return ''; - - if (crm_hardlock::isFloating($programs[0]['prPass'])) - return ''; - - foreach ($programs as $program) $result .= $program['prPass'] . ': Too much activation: ' . $program['cnt'] . '\n'; - - if ($result != '') $result = "Three hour: \n {$result}"; - return $result; - } - - public static function sixHour() - { - $result = ''; - - /*$programs = self::checkLicenceSettingsWithInstallment(); - foreach ($programs as $program) $result .= $program['prPass'] . ': Wrong activation code (With Installment): ' . $program['prInvoiceDateTo'] . ' - ' . $program['prFizetve'] . '\n'; - - if ($result != '') $result = "Six hour: \n {$result}";*/ - return $result; - } - - public static function twelveHour() - { - $result = ''; - - $telemetria = self::getFalseTestResults(); - foreach ($telemetria as $tm) $result .= $tm['Pwd'] . ': False test reult: ' . $tm['error_code'] . '\n'; - - if ($result != '') $result = "Twelve hour: \n {$result}"; - return $result; - } - - public static function oneDay() - { - $result = "One day: \n"; - $array = array(); - - $query = "SELECT ctrID FROM `" . CRMADATBAZIS . "`.`countries` WHERE show_h = ? AND ctrID NOT IN (?, ?, ?, ?, ?, ?, ?, ?, ?) - ORDER BY RAND() - LIMIT 5"; - Database::getInstance()->query($query, array('iiiiiiiiii', 1, 41, 7, 421, 1, 2, 37, 99, 95, 94)); - $countries = Database::getInstance()->fetchAssoc(); - - foreach ($countries as $country) array_push($array, $country['ctrID']); - - $imploded = implode(", ", $array); - - $query = "SELECT prPass FROM `" . CRMADATBAZIS . "`.`h_programs` WHERE prVerID >= ? AND prCtrID IN ({$imploded})"; - Database::getInstance()->query($query, array('i', 18)); - $programs = Database::getInstance()->fetchAssoc(); - - foreach ($programs as $program) { - $error = crm_hardlock::sCheckPassword($program['prPass']); - if ($error != '') $result .= $program['prPass'] . ' - ' . $error . '\n'; - } - return $result; - } - - public static function syncSwitchTable() - { - $truncateQuery = "TRUNCATE TABLE " . CRMADATBAZIS . ".switch"; - Database::getInstance()->query($truncateQuery); - - $insertQuery = "INSERT INTO `" . CRMADATBAZIS . "`.switch - SELECT h.hlUser,CONCAT(',',group_concat(p.prVerID),',') AS prVerID - FROM ( - SELECT hlUser,hlNum - FROM `" . CRMADATBAZIS . "`.`hardlock` - WHERE hlStat=1 AND CONVERT(hlUser,UNSIGNED)>0 AND LENGTH(hlUser)<=6 AND hlUser>=1 AND hlUser<=999999 - ) h - LEFT OUTER JOIN ( - SELECT prHlNum AS hlNum,MAX(prVerID) AS prVerID - FROM (SELECT * FROM `" . CRMADATBAZIS . "`.`h_programs` WHERE prStat=0) AS `h_programs` - GROUP BY prHlNum - ) p ON h.hlNum=p.hlNum - WHERE prVerID IS NOT NULL - GROUP BY h.hlUser - ORDER BY hlUser;"; - Database::getInstance()->query($insertQuery); - - $deleteQuery = "DELETE FROM `" . CRMADATBAZIS . "`.writelog WHERE `datum`query($deleteQuery); - } -} - -class Student extends Database -{ - private $nUserID; // Diak CRM-ben levo ID-ja - private $name; // Diak neve - private $email; // Diak email cime - private $phone; // Diak telefonszama - private $endDate; // Vegzes ideje - private $education; // Kepzes helye es ideje - private $status; // Diak statusza (aktiv - passziv) - - private $courseID; // Kurzus ID-ja - private $courseBegin; // Kurzus kezdete - private $courseEnd; // Kurzus vege - private $courseCode; // Kurzus kodja - private $version; // AL verzioja (evjarat) - - private $schoolID; // Iskola ID-ja - private $nSchoolID; // Iskola CRM-ben levo ID-ja - private $username; // Iskola felhasznaloneve - private $schoolName; // Iskola neve - private $schoolLang; // Magyar vagy angol - public $schoolEmail; // Az iskola email cime - - public function __construct() - { - parent::__construct(); - $this->clear(); - } - - private function clear() - { - foreach ($this as &$value) unset($value); - } - - public function setUsername($username) - { - $this->username = $username; - } - public function setName($name) - { - $this->name = $name; - } - public function setPhone($phone) - { - $this->phone = $phone; - } - public function setnSchoolID($nSchoolID) - { - $this->nSchoolID = $nSchoolID; - } - public function setSchoolID($schoolID) - { - $this->schoolID = $schoolID; - } - public function setSchoolName($schoolName) - { - $this->schoolName = $schoolName; - } - public function setSchoolLang($schoolLang) - { - $this->schoolLang = $schoolLang; - } - public function setSchoolEmail($email) - { - $this->schoolEmail = $email; - } - public function setCourseID($courseID) - { - $this->courseID = $courseID; - } - public function setCourseEnd($courseEnd) - { - $this->courseEnd = $courseEnd; - } - public function setCourseBegin($courseBegin) - { - $this->courseBegin = $courseBegin; - } - public function setCourseCode($courseCode) - { - $this->courseCode = $courseCode; - } - public function setEducation($education) - { - $this->education = $education; - } - public function setEndDate($endDate) - { - $this->endDate = $endDate; - } - public function setVersion($version) - { - $this->version = $version; - } - public function setStatus($status) - { - $this->status = $status; - } - - public function setEmail($email) - { - $email = str_replace("\n", '', $email); - $email = str_replace('\n', '', $email); - $email = str_replace(';', '', $email); - $this->email = str_replace(' ', '', $email); - } - - public function setCourse() - { - $course = $this->getCourseByID(); - $this->setCourseEnd($course['end']); - $this->setVersion($course['version']); - $this->setCourseBegin($course['begin']); - $this->setCourseCode($course['course_code']); - $this->setEndDate($course['vegzes_ideje']); - } - - public function getSchoolByCourse() - { - $sql = "SELECT school.name AS school_name, course.name AS course_name - FROM `" . CRMADATBAZIS . "`.`schools` school - LEFT JOIN `" . CRMADATBAZIS . "`.`courses` course ON course.school_id = school.id - WHERE course.id = ?"; - - $this->query($sql, array('i', $this->courseID)); - - return $this->fetchNext(); - } - - public function studentInOtherSchool($schoolId, $otherSchoolId) - { - return $schoolId != $otherSchoolId; - } - - public function getCourseByID() - { - $sql = "SELECT course_code, vegzes_ideje, version, courses.to AS end, courses.from AS begin, school_id FROM `" . CRMADATBAZIS . "`.`courses` WHERE id = ?"; - $this->query($sql, array('i', $this->courseID)); - return $this->fetchNext(); - } - - public function setSchool() - { - $school = $this->getSchoolByID(); - $this->setUsername($school['username']); - $this->setnSchoolID($school['nSchoolID']); - $this->setSchoolName($school['name']); - $this->setSchoolLang($school['lang']); - $this->setSchoolEmail($school['email']); - } - - public function getSchoolByID() - { - $sql = "SELECT username, nSchoolID, name, lang, email FROM `" . CRMADATBAZIS . "`.`schools` WHERE id = ?"; - $this->query($sql, array('i', $this->schoolID)); - return $this->fetchNext(); - } - - public function getnUserID() - { - return $this->nUserID; - } - - public function phoneCorrect() - { - $phone = $this->phone; - $phone = str_replace('-', '', $phone); - $phone = str_replace(' ', '', $phone); - $phone = str_replace('+', '', $phone); - $phone = str_replace('/', '', $phone); - $phone = str_replace('.', '', $phone); - $phone = str_replace(' ', '', $phone); - - return $phone; - } - - public function getStudent($userid, &$response = array()) - { - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`students` WHERE id = ?"; - $this->query($query, array('i', $userid)); - $students = $this->fetchAssoc(); - - if (!empty($students)) foreach ($students as $student) $response = $student; - else { - $response["status"] = 200; - $response["message"] = "Data not found!"; - } - } - - public function getStudentStatus($status) - { - $statusStr = ''; - - if ($_SERVER['HTTP_HOST'] == 'www.archline.hu') { - if ($status == 0) - $statusStr = 'Passzív'; - elseif ($status == 1) - $statusStr = 'Aktív'; - else - $statusStr = 'Levizsgázott'; - } else { - if ($status == 0) - $statusStr = 'Passive'; - elseif ($status == 1) - $statusStr = 'Active'; - else - $statusStr = 'Passed the exam'; - } - - return $statusStr; - } - - public function getProgramStarts($pwd) - { - if (is_array($pwd)) - return 0; - - $sql = "SELECT SUM(usInditasokSzama) AS count FROM `" . CRMADATBAZIS . "`.`userstats2013` WHERE usPwd = '" . $pwd . "'"; - $this->query($sql); - $userstats = $this->fetchNext(); - - return !empty($userstats) ? $userstats['count'] : 0; - } - - public function getAllStudents($search, $courseArray) - { - $isSearch = isset($search) && $search != null && $search != '' ? TRUE : FALSE; - - $course = $this->getCourseByID(); - - $sql = "SELECT verID FROM `" . CRMADATBAZIS . "`.`p_versions` WHERE year = ?"; - $this->query($sql, array('i', $course['version'])); - $version = $this->fetchNext(); - - if (empty($courseArray)) { - $sql = "SELECT s.nUserID AS nUserID, s.name AS name, s.status AS status, s.email_sent AS email_sent, s.email AS email, s.phone AS phone, s.id AS student_id, c.name AS course_name - FROM `" . CRMADATBAZIS . "`.`students` s - LEFT JOIN `" . CRMADATBAZIS . "`.`courses` c ON c.id = s.course_id - WHERE s.course_id = ?"; - - if ($isSearch) $sql .= " AND s.name LIKE ?"; - $sql .= " ORDER BY s.name ASC;"; - - if ($isSearch) $this->query($sql, array('is', $this->courseID, "%$search%")); - else $this->query($sql, array('i', $this->courseID)); - } else { - $coursesString = implode(", ", $courseArray); - - $sql = "SELECT s.nUserID AS nUserID, s.name AS name, s.status AS status, s.email_sent AS email_sent, s.email AS email, s.phone AS phone, s.id AS student_id, c.name AS course_name - FROM `" . CRMADATBAZIS . "`.`students` s - LEFT JOIN `" . CRMADATBAZIS . "`.`courses` c ON c.id = s.course_id - WHERE s.course_id in ({$coursesString})"; - - if ($isSearch) $sql .= " AND s.name LIKE ?"; - $sql .= " ORDER BY s.name ASC;"; - - if ($isSearch) $this->query($sql, array('s', "%$search%")); - else $this->query($sql); - } - - $students = $this->fetchAssoc(); - $studentsArray = array(); - - if (!empty($students)) { - foreach ($students as $student) { - $sql = "SELECT h.hlNum, p.prPass AS prPass, h.product_id AS product, h.hlUser - FROM `" . CRMADATBAZIS . "`.`hardlock` h - LEFT JOIN `" . CRMADATBAZIS . "`.`h_programs` p ON p.prHlNum = h.hlNum - WHERE h.hlUser = ? AND p.prPass LIKE ? AND p.prVerID = ? AND h.product_id = ? GROUP BY h.product_id LIMIT 1;"; - $this->query($sql, array('isii', $student['nUserID'], '99%', $version['verID'], 1)); - $hardlock = $this->fetchNext(); - - $prPass = ""; - - if (!empty($hardlock)) { - $prPass = $hardlock['prPass']; - if ($hardlock['product'] == _Product::Professional) - $prPass = "ARCHLine.XP: {$prPass}"; - } - - if ($prPass == '') { - if ($_SERVER['HTTP_HOST'] == 'www.archline.hu') - $prPass = 'Nincs ARCHLine.XP sorozatszám'; - else - $prPass = 'No ARCHLine.XP serial number'; - } - - $studentsArray[] = array( - "name" => $student["name"], - "email" => $student["email"], - "phone" => $student["phone"], - "student_id" => $student["student_id"], - "course_name" => $student["course_name"], - "email_sent" => $student["email_sent"], - "status" => $student["status"], - "prPass" => $prPass - ); - } - } else $studentsArray = "empty"; - - return $studentsArray; - } - - public function addStudent() - { - define('_JEXEC', 1); - define('JPATH_BASE', '../'); - require_once JPATH_BASE . 'includes/defines.php'; - require_once JPATH_BASE . 'includes/framework.php'; - - jimport('joomla.user.helper'); - - $begin = str_replace('-', '.', $this->courseBegin); - $end = str_replace('-', '.', $this->endDate); - $this->education = $this->username . " " . $this->courseCode . " " . $begin . " - " . $end; - $hunInfo = 'Weben regisztrált - ' . $this->username . " " . $this->courseCode . " " . $begin; - - $sql = "SELECT * FROM `" . JMLADATBAZIS . "`.`jml_users` WHERE username = ? OR email = ?"; - $this->query($sql, array('ss', $this->email, $this->email)); - $jml_students = $this->fetchNext(); - - $phone = $this->phoneCorrect(); - - if (empty($jml_students)) { - $sql = "SELECT nUserID FROM `" . CRMADATBAZIS . "`.`u_emails` WHERE email = ?"; - $this->query($sql, array('s', $this->email)); - $stud = $this->fetchNext(); - - if (empty($stud)) { - $user = array( - 'strName' => $this->name, - 'strEMail' => $this->email, - 'strTel' => $phone, - 'nCtrID' => _Country::Hungary, - 'nSchoolID' => $this->nSchoolID, - 'nUserType' => _UserType::Nonprofit, - 'nUserProf' => _Profession::StudentIntDesinger, - 'nUserStatus' => _UserStatus::StudentProbBuyer, - 'strEducation' => $this->education, - 'vegzes_ideje' => $this->courseEnd, - 'old_db' => $this->schoolLang == 'hun' ? 'clusers' : 'clusers_eng' - ); - $this->nUserID = $this->insert(CRMADATBAZIS . ".users", $user, 'sssiiiiisss'); - - $u_email = array( - 'email' => $this->email, - 'nUserID' => $this->nUserID, - 'default' => 1, - 'active' => 1, - 'deleted' => 0, - 'newsletter' => 1 - ); - $this->insert(CRMADATBAZIS . ".u_emails", $u_email, 'siiiii'); - - $userHistory = array( - 'nUserID' => $this->nUserID, - 'nTopicID' => $_SERVER['HTTP_HOST'] == 'www.archline.hu' ? 362 : 219, - 'dateEvent' => date('Y-m-d'), - 'strPlace' => 'Web', - 'strInfo' => $_SERVER['HTTP_HOST'] == 'www.archline.hu' ? $hunInfo : $this->education, - 'nManagerID' => _Manager::Web, - 'insertDate' => date('Y-m-d H:i:s') - ); - $this->insert(CRMADATBAZIS . ".u_history", $userHistory, 'iisssis'); - } else { - $this->nUserID = $stud['nUserID']; - - $sql = "SELECT strTel FROM `" . CRMADATBAZIS . "`.`users` WHERE nUserID = ?"; - $this->query($sql, array('i', $this->nUserID)); - $stud = $this->fetchNext(); - $tel = $stud['strTel']; - - if (strpos($tel, $phone) === false || strpos($tel, substr($phone, 2)) === false) $tel .= ";{$phone}"; - - $this->update( - CRMADATBAZIS . ".users", - array( - 'vegzes_ideje' => $this->courseEnd, - 'nSchoolID' => $this->nSchoolID, - 'strTel' => $tel, - 'strEducation' => $this->education - ), - array('nUserID' => $this->nUserID), - 'sissi' - ); - } - - $reg_date = date('Y-m-d h:i:s'); - $group = 2; - $exploded_name = explode(" ", $this->name); - $exploded_email = explode("@", $this->email); - $salt = JUserHelper::genRandomPassword(32); - $crypt = JUserHelper::getCryptedPassword($exploded_email[0], $salt); - $password = "{$crypt}:{$salt}"; - $privacy = '{"privacy_username":"0","privacy_firstname":"0","privacy_lastname":"0","privacy_email":"0","privacy_password":"0","privacy_phone":"0","privacy_profession":"0","privacy_country":"0","privacy_city":"0","privacy_address":"0","privacy_zip":"0","privacy_gdpr":"0","privacy_old_db":"0"}'; - - $jml_user = array( - 'name' => $this->name, - 'username' => $this->email, - 'email' => $this->email, - 'password' => $password, - 'registerDate' => $reg_date, - 'nUserID' => $this->nUserID - ); - - $jsn_user = array( - 'privacy' => $privacy, - 'firstname' => $exploded_name[0], - 'lastname' => $exploded_name[1], - 'phone' => $this->phone, - 'profession' => _Profession::StudentIntDesinger, - 'country' => _Country::Hungary, - 'gdpr' => '["1"]' - ); - $this->insert(JMLADATBAZIS . ".jml_jsn_users", $jsn_user, 'ssssiiss'); - $userID = $this->insert(JMLADATBAZIS . ".jml_users", $jml_user, 'sssssi'); - $this->insert(JMLADATBAZIS . ".jml_user_usergroup_map", array("user_id" => $userID, "group_id" => $group), 'ii'); - } else { - $sql = "SELECT * FROM `" . CRMADATBAZIS . "`.`users` WHERE nUserID = ? LIMIT 1"; - $this->query($sql, array('i', $jml_students['nUserID'])); - $usr = $this->fetchNext(); - - if (empty($usr)) { - $user = array( - 'strName' => $this->name, - 'strEMail' => $this->email, - 'strTel' => $phone, - 'nCtrID' => _Country::Hungary, - 'nSchoolID' => $this->nSchoolID, - 'nUserType' => _UserType::Nonprofit, - 'nUserProf' => _Profession::StudentIntDesinger, - 'nUserStatus' => _UserStatus::StudentProbBuyer, - 'strEducation' => $this->education, - 'vegzes_ideje' => $this->courseEnd, - 'old_db' => $this->schoolLang == 'hun' ? 'clusers' : 'clusers_eng' - ); - $this->nUserID = $this->insert(CRMADATBAZIS . ".users", $user, 'sssiiiiisss'); - - $u_email = array( - 'email' => $this->email, - 'nUserID' => $this->nUserID, - 'default' => 1, - 'active' => 1, - 'deleted' => 0, - 'newsletter' => 1 - ); - $this->insert(CRMADATBAZIS . ".u_emails", $u_email, 'siiiii'); - $this->update(JMLADATBAZIS . ".jml_users", array('nUserID' => $this->nUserID), array('id' => $jml_students['id']), 'ii'); - - $userHistory = array( - 'nUserID' => $this->nUserID, - 'nTopicID' => $_SERVER['HTTP_HOST'] == 'www.archline.hu' ? 362 : 219, - 'dateEvent' => date('Y-m-d'), - 'strPlace' => 'Web', - 'strInfo' => $_SERVER['HTTP_HOST'] == 'www.archline.hu' ? $hunInfo : $this->education, - 'nManagerID' => _Manager::Web, - 'insertDate' => date('Y-m-d H:i:s') - ); - $this->insert(CRMADATBAZIS . ".u_history", $userHistory, 'iisssis'); - } else { - $this->nUserID = $usr['nUserID']; - - $sql = "SELECT strTel FROM `" . CRMADATBAZIS . "`.`users` WHERE nUserID = ?"; - $this->query($sql, array('i', $this->nUserID)); - $stud = $this->fetchNext(); - $tel = $stud['strTel']; - - if (strpos($tel, $phone) === false || strpos($tel, substr($phone, 2)) === false) $tel .= ";{$phone}"; - - $this->update( - CRMADATBAZIS . ".users", - array( - 'vegzes_ideje' => $this->courseEnd, - 'nSchoolID' => $this->nSchoolID, - 'strTel' => $tel, - 'strEducation' => $this->education - ), - array('nUserID' => $this->nUserID), - 'sissi' - ); - } - } - - $student = array( - 'name' => $this->name, - 'email' => $this->email, - 'phone' => $this->phone, - 'school_id' => $this->schoolID, - 'course_id' => $this->courseID, - 'nUserID' => $this->nUserID - ); - $this->insert(CRMADATBAZIS . ".students", $student, 'sssiii'); - } - - public function deleteStudent($userid) - { - $sql = "SELECT * FROM `" . CRMADATBAZIS . "`.`students` WHERE id = ?"; - $this->query($sql, array('i', $userid)); - $student = $this->fetchNext(); - $nUserID = $student['nUserID']; - - $sql = "SELECT * FROM `" . CRMADATBAZIS . "`.`courses` WHERE id = ?"; - $this->query($sql, array('i', $student['course_id'])); - $studentCourse = $this->fetchNext(); - - $sql = "SELECT id FROM `" . CRMADATBAZIS . "`.`courses` WHERE school_id = ? AND is_archive = ?"; - $this->query($sql, array('ii', $student['school_id'], 1)); - $archiveCourse = $this->fetchNext(); - - if ($studentCourse['is_archive'] == 0 && !empty($archiveCourse)) { - $sql = "SELECT * FROM `" . CRMADATBAZIS . "`.`hardlock` WHERE hlUser = ? AND hlNum LIKE ?"; - $this->query($sql, array('is', $nUserID, '99%')); - $hardlock = $this->fetchAssoc(); - - if (!empty($hardlock)) - foreach ($hardlock as $hl) crm_hardlock::DeactivateHardlock($hl['hlNum'], _Manager::Web, "Iskolai felület: kulcs letiltása", date('Y-m-d', time())); - - $sql = "SELECT * FROM `" . CRMADATBAZIS . "`.`users` WHERE nUserID = ?"; - $this->query($sql, array('i', $nUserID)); - $user = $this->fetchNext(); - $strEducation = $user['strEducation'] . " Törölve"; - - $this->update(CRMADATBAZIS . ".users", array('strEducation' => $strEducation, 'nSchoolID' => 0), array('nUserID' => $nUserID), 'sii'); - $this->update(CRMADATBAZIS . ".students", array('course_id' => $archiveCourse['id']), array('id' => $userid), 'ii'); - } else { - $this->delete(CRMADATBAZIS . '.students', array('id' => $userid), 'i'); - } - } - - public function updateStudent($userid, $isDelete = false) - { - $sql = "SELECT * FROM `" . CRMADATBAZIS . "`.`students` WHERE id = ?"; - $this->query($sql, array('i', $userid)); - $stud = $this->fetchNext(); - $nUserID = $stud['nUserID']; - $this->nUserID = $nUserID; - $changed = $this->status != $stud['status']; - - if ($this->courseID != $stud['course_id']) $this->status = 1; - - if ($this->courseID != $stud['course_id'] || $changed || $this->status == 2) { - if ($changed && $this->status == 0) $this->education .= ' Passzív'; - if ($changed && $this->status == 2) $this->education .= ' Levizsgázott'; - $this->update(CRMADATBAZIS . ".users", array('strEducation' => $this->education, 'nSchoolID' => $this->nSchoolID), array('nUserID' => $nUserID), 'sii'); - - if ($changed && $this->status == 0) - $this->update(CRMADATBAZIS . ".users", array('nSchoolID' => 0), array('nUserID' => $nUserID), 'ii'); - - if ($isDelete) { - $this->delete(CRMADATBAZIS . '.students', array('id' => $userid), 'i'); - return; - } - - if ($this->courseID != $stud['course_id']) { - $this->generateStudentPassword(); - } else { - $sql = "SELECT * FROM `" . CRMADATBAZIS . "`.`hardlock` WHERE hlUser = ? AND hlNum LIKE ?"; - $this->query($sql, array('is', $nUserID, '99%')); - $hardlock = $this->fetchAssoc(); - - if (!empty($hardlock) && $this->status != 2) { - $sql = "SELECT * FROM `" . CRMADATBAZIS . "`.`courses` WHERE id = ?"; - $this->query($sql, array('i', $this->courseID)); - $next_course = $this->fetchNext(); - - foreach ($hardlock as $hl) { - if ($this->status == 0 && $hardlock['hlStat'] != 2) { - crm_hardlock::DeactivateHardlock($hl['hlNum'], _Manager::Web, "Iskolai felület: kulcs letiltása", date('Y-m-d', time())); - continue; - } elseif ($this->status == 1 && $hardlock['hlStat'] != 1) { - crm_hardlock::ActivateHardlock($hl['hlNum'], _Manager::Web, "Iskolai felület: kulcs aktiválása"); - - if ($this->courseID == $stud['course_id']) continue; - } - - $sql = "SELECT * FROM `" . CRMADATBAZIS . "`.`h_programs` WHERE prHlNum = ? ORDER BY prVerID DESC"; - $this->query($sql, array('s', $hl['hlNum'])); - $program = $this->fetchNext(); - - if (!empty($program)) { - if ($program['prActCode'] != "" && $program['prActCode'] != NULL) { - $isid = crm_hardlock::GetIsidFromTimeCode($program['prActCode']); - - $sql = "SELECT * FROM `" . CRMADATBAZIS . "`.`p_serial_isid` WHERE serial = ? AND isid = ?"; - $this->query($sql, array('ss', $program['prPass'], $isid)); - $p_serial_isid = $this->fetchNext(); - - if ($program['twtw'] == 1) - $installDate = crm_hardlock::getTwTwRootTimeString(); - else - $installDate = substr($p_serial_isid['datum'], 0, 10); - - if ($next_course['to'] < $installDate) - $dayInterval = Codegen::GetDayInterval($installDate, $installDate); - else - $dayInterval = Codegen::GetDayInterval($installDate, $next_course['to']); - - $timeCode = Codegen::GenerateTimeCode($program['prPass'], $isid, $dayInterval); - - $this->update(CRMADATBAZIS . ".h_programs", array('prFizetve' => $next_course['to'], 'prActCode' => $timeCode), array('prID' => $program['prID']), 'ssi'); - } else { - $this->update(CRMADATBAZIS . ".h_programs", array('prFizetve' => $next_course['to']), array('prID' => $program['prID']), 'si'); - } - } - } - } - } - } - - $this->update( - CRMADATBAZIS . ".students", - array( - 'name' => $this->name, - 'email' => $this->email, - 'phone' => $this->phone, - 'status' => $this->status, - 'course_id' => $this->courseID - ), - array('id' => $userid), - 'sssiii' - ); - - $sql = "SELECT strTel FROM `" . CRMADATBAZIS . "`.`users` WHERE nUserID = ?"; - $this->query($sql, array('i', $nUserID)); - $stud = $this->fetchNext(); - $tel = $stud['strTel']; - $phone = $this->phoneCorrect(); - - if (strpos($tel, $phone) === false || strpos($tel, substr($phone, 2)) === false) $tel .= ";{$phone}"; - - $this->update( - CRMADATBAZIS . ".users", - array( - 'strName' => $this->name, - 'strEmail' => $this->email, - 'strEducation' => $this->education, - 'vegzes_ideje' => $this->courseEnd, - 'strTel' => $tel - ), - array('nUserID' => $nUserID), - 'sssssi' - ); - - $sql = "SELECT * FROM `" . CRMADATBAZIS . "`.`u_emails` WHERE email = ?"; - $this->query($sql, array('s', $this->email)); - $emails = $this->fetchNext(); - - if (empty($emails)) { - $u_email = array( - 'email' => $this->email, - 'nUserID' => $nUserID, - 'default' => 1, - 'active' => 1, - 'deleted' => 0, - 'newsletter' => 1 - ); - $this->insert(CRMADATBAZIS . ".u_emails", $u_email, 'siiiii'); - } - } - - public function generateStudentPassword() - { - $generate_live = false; - $generate_xp = false; - - $sql = "SELECT * FROM `" . CRMADATBAZIS . "`.`p_versions` WHERE year = ?"; - $this->query($sql, array('i', $this->version)); - $ver = $this->fetchNext(); - - $sql = "SELECT * FROM `" . CRMADATBAZIS . "`.`hardlock` WHERE hlUser = ? AND hlNum LIKE ?"; - $this->query($sql, array('is', $this->nUserID, '99%')); - $hl_user = $this->fetchAssoc(); - - $lan = 0; - $type = _Program::ProfType; - $version = $ver['verCode']; - $live_type = _Program::LiveType; - $live_version = 80 /*crm_hardlock::GetVerCodeFromverId(_Program::PrevVersion)*/; - $limit = $ver['verID'] < 25 ? 2 : 1; - - if (empty($hl_user)) { - $sql = "SELECT * FROM `" . CRMADATBAZIS . "`.`hardlock` WHERE hlNum LIKE ? AND hlStat = ? AND (hlUser = '' OR hlUser IS NULL) AND (hlDealer = '' OR hlDealer IS NULL) AND product_id = ? LIMIT {$limit}"; - $this->query($sql, array('sii', '99%', _Hardlock::Blank, _Product::Professional)); - $hardlock = $this->fetchAssoc(); - - if (empty($hardlock) || count($hardlock) < 1) { - $hlNum = crm_hardlock::tryToAlloc(); - - $hl = array( - 'hlNum' => $hlNum, - 'hlUser' => $this->nUserID, - 'hlStat' => _Hardlock::Active, - 'hlManID' => 36, - 'hlCtrID' => _Country::Hungary, - 'hlDateIssue' => date('Y-m-d'), - 'product_id' => _Product::Professional - ); - $this->insert(CRMADATBAZIS . ".hardlock", $hl, 'siiiisi'); - - if ($ver['verID'] < 25) { - $live_hlNum = crm_hardlock::tryToAlloc(); - - $hl_live = array( - 'hlNum' => $live_hlNum, - 'hlUser' => $this->nUserID, - 'hlStat' => _Hardlock::Active, - 'hlManID' => 36, - 'hlCtrID' => _Country::Hungary, - 'hlDateIssue' => date('Y-m-d'), - 'product_id' => _Product::Live - ); - $this->insert(CRMADATBAZIS . ".hardlock", $hl_live, 'siiiisi'); - } - } else { - $hlNum = $hardlock[0]['hlNum']; - $live_hlNum = $ver['verID'] < 25 ? $hardlock[1]['hlNum'] : ''; - - $this->update( - CRMADATBAZIS . '.hardlock', - array( - 'hlStat' => _Hardlock::Active, - 'product_id' => _Product::Professional, - 'hlDatePro' => '', - 'hlUser' => $this->nUserID, - 'hlCtrID' => _Country::Hungary, - 'hlLan' => 0 - ), - array('hlNum' => $hlNum), - 'iisiiii' - ); - - if ($ver['verID'] < 25) { - $this->update( - CRMADATBAZIS . '.hardlock', - array( - 'hlStat' => _Hardlock::Active, - 'product_id' => _Product::Live, - 'hlDatePro' => '', - 'hlUser' => $this->nUserID, - 'hlCtrID' => _Country::Hungary, - 'hlLan' => 0 - ), - array('hlNum' => $live_hlNum), - 'iisiiii' - ); - } - } - - $generate_live = $ver['verID'] < 25 ? true : false; - $generate_xp = true; - } else { - $hlNum = ""; - $live_hlNum = ""; - - $sql = "SELECT * FROM `" . CRMADATBAZIS . "`.`hardlock` WHERE hlUser = ? AND product_id = ? AND hlNum LIKE ?"; - $this->query($sql, array('iis', $this->nUserID, _Product::Professional, '99%')); - $alXP = $this->fetchNext(); - - if (!empty($alXP)) { - $hlNum = $alXP['hlNum']; - - if ($alXP['hlStat'] == _Hardlock::Inactive) - $this->update(CRMADATBAZIS . '.hardlock', array('hlStat' => _Hardlock::Active, 'hlDatePro' => ''), array('hlNum' => $hlNum), 'iss'); - } - - if ($ver['verID'] < 25) { - $sql = "SELECT * FROM `" . CRMADATBAZIS . "`.`hardlock` WHERE hlUser = ? AND product_id = ? AND hlNum LIKE ?"; - $this->query($sql, array('iis', $this->nUserID, _Product::Live, '99%')); - $alLIVE = $this->fetchNext(); - - if (!empty($alLIVE)) { - $live_hlNum = $alLIVE['hlNum']; - - if ($alLIVE['hlStat'] == _Hardlock::Inactive) - $this->update(CRMADATBAZIS . '.hardlock', array('hlStat' => _Hardlock::Active, 'hlDatePro' => ''), array('hlNum' => $live_hlNum), 'iss'); - } - } - - if ($hlNum == '') { - $sql = "SELECT * FROM `" . CRMADATBAZIS . "`.`hardlock` WHERE hlNum LIKE ? AND hlStat = ? AND (hlUser = ? OR hlUser IS NULL) AND (hlDealer = ? OR hlDealer IS NULL) LIMIT 1"; - $this->query($sql, array('siss', '99%', _Hardlock::Blank, '', '')); - $hardlock = $this->fetchNext(); - - if (empty($hardlock)) { - $hlNum = crm_hardlock::tryToAlloc(); - - $hl = array( - 'hlNum' => $hlNum, - 'hlUser' => $this->nUserID, - 'hlStat' => _Hardlock::Active, - 'hlManID' => 36, - 'hlCtrID' => _Country::Hungary, - 'hlDateIssue' => date('Y-m-d'), - 'product_id' => _Product::Professional - ); - $this->insert(CRMADATBAZIS . ".hardlock", $hl, 'siiiisi'); - } else { - $hlNum = $hardlock['hlNum']; - - $this->update( - CRMADATBAZIS . '.hardlock', - array( - 'hlStat' => _Hardlock::Active, - 'hlDatePro' => '', - 'product_id' => _Product::Professional, - 'hlUser' => $this->nUserID, - 'hlCtrID' => _Country::Hungary, - 'hlLan' => 0 - ), - array('hlNum' => $hlNum), - 'isiiiis' - ); - } - } - - if ($live_hlNum == '' && $ver['verID'] < 25) { - $sql = "SELECT * FROM `" . CRMADATBAZIS . "`.`hardlock` WHERE hlNum LIKE ? AND hlStat = ? AND (hlUser = ? OR hlUser IS NULL) AND (hlDealer = ? OR hlDealer IS NULL) LIMIT 1"; - $this->query($sql, array('siss', '99%', _Hardlock::Blank, '', '')); - $hardlock = $this->fetchNext(); - - if (empty($hardlock)) { - $live_hlNum = crm_hardlock::tryToAlloc(); - - $hl_live = array( - 'hlNum' => $live_hlNum, - 'hlUser' => $this->nUserID, - 'hlStat' => _Hardlock::Active, - 'hlManID' => 36, - 'hlCtrID' => _Country::Hungary, - 'hlDateIssue' => date('Y-m-d'), - 'product_id' => _Product::Live - ); - $this->insert(CRMADATBAZIS . ".hardlock", $hl_live, 'siiiisi'); - } else { - $live_hlNum = $hardlock['hlNum']; - - $this->update( - CRMADATBAZIS . '.hardlock', - array( - 'hlStat' => _Hardlock::Active, - 'hlDatePro' => '', - 'product_id' => _Product::Live, - 'hlUser' => $this->nUserID, - 'hlCtrID' => _Country::Hungary, - 'hlLan' => 0 - ), - array('hlNum' => $live_hlNum), - 'isiiiis' - ); - } - } - - $sql = "SELECT * FROM `" . CRMADATBAZIS . "`.`h_programs` WHERE prHlNum = ? AND prVerID = ?"; - $this->query($sql, array('si', $hlNum, $ver['verID'])); - $user_program_xp = $this->fetchNext(); - - if (empty($user_program_xp)) { - $generate_xp = true; - } else { - if ($user_program_xp['prActCode'] != '' && $user_program_xp['prActCode'] != null) { - $isid = crm_hardlock::GetIsidFromTimeCode($user_program_xp['prActCode']); - $sql = "SELECT * FROM `" . CRMADATBAZIS . "`.`p_serial_isid` WHERE serial = ? AND isid = ?"; - $this->query($sql, array('ss', $user_program_xp['prPass'], $isid)); - $p_serial_isid = $this->fetchNext(); - } else { - $sql = "SELECT * FROM `" . CRMADATBAZIS . "`.`p_serial_isid` WHERE serial = ? AND aktiv = ?"; - $this->query($sql, array('si', $user_program_xp['prPass'], 1)); - $p_serial_isid = $this->fetchNext(); - if (!empty($p_serial_isid)) - $isid = $p_serial_isid['isid']; - } - - if (!empty($p_serial_isid)) { - if ($user_program_xp['twtw'] == 1) - $installDate = crm_hardlock::getTwTwRootTimeString(); - else - $installDate = substr($p_serial_isid['datum'], 0, 10); - - if ($this->courseEnd < $installDate) - $dayInterval = Codegen::GetDayInterval($installDate, $installDate); - else - $dayInterval = Codegen::GetDayInterval($installDate, $this->courseEnd); - - $generatedTimeCode = Codegen::GenerateTimeCode($user_program_xp['prPass'], $isid, $dayInterval); - $this->update(CRMADATBAZIS . '.h_programs', array('prActCode' => $generatedTimeCode), array('prID' => $user_program_xp['prID']), 'si'); - } - $this->update(CRMADATBAZIS . '.h_programs', array('prSellDate' => $this->courseBegin, 'prFizetve' => $this->courseEnd, 'prStat' => _Program::Active), array('prID' => $user_program_xp['prID']), 'ssii'); - } - - if ($ver['verID'] < 25) { - $sql = "SELECT * FROM `" . CRMADATBAZIS . "`.`h_programs` WHERE prHlNum = ? AND prVerID = ?"; - $this->query($sql, array('si', $live_hlNum, 23)); - $user_program_live = $this->fetchNext(); - - if (empty($user_program_live)) { - $generate_live = true; - } else { - if ($user_program_live['prActCode'] != '' && $user_program_live['prActCode'] != null) { - $isid = crm_hardlock::GetIsidFromTimeCode($user_program_live['prActCode']); - $sql = "SELECT * FROM `" . CRMADATBAZIS . "`.`p_serial_isid` WHERE serial = ? AND isid = ?"; - $this->query($sql, array('ss', $user_program_live['prPass'], $isid)); - $p_serial_isid = $this->fetchNext(); - } else { - $sql = "SELECT * FROM `" . CRMADATBAZIS . "`.`p_serial_isid` WHERE serial = ? AND aktiv = ?"; - $this->query($sql, array('si', $user_program_live['prPass'], 1)); - $p_serial_isid = $this->fetchNext(); - if (!empty($p_serial_isid)) - $isid = $p_serial_isid['isid']; - } - - if (!empty($p_serial_isid)) { - if ($user_program_live['twtw'] == 1) - $installDate = crm_hardlock::getTwTwRootTimeString(); - else - $installDate = substr($p_serial_isid['datum'], 0, 10); - - if ($this->courseEnd < $installDate) - $dayInterval = Codegen::GetDayInterval($installDate, $installDate); - else - $dayInterval = Codegen::GetDayInterval($installDate, $this->courseEnd); - - $generatedTimeCode = Codegen::GenerateTimeCode($user_program_live['prPass'], $isid, $dayInterval); - $this->update(CRMADATBAZIS . '.h_programs', array('prActCode' => $generatedTimeCode), array('prID' => $user_program_live['prID']), 'si'); - } - $this->update(CRMADATBAZIS . '.h_programs', array('prSellDate' => $this->courseBegin, 'prFizetve' => $this->courseEnd, 'prStat' => _Program::Active), array('prID' => $user_program_live['prID']), 'ssii'); - } - } - } - - if ($generate_xp) { - $password = Codegen::GeneratePassword($hlNum, $lan, $type, $version); - $programs = array( - 'prTypeID' => $type, - 'prVerID' => $ver['verID'], - 'prLan' => $lan, - 'prPass' => $password, - 'prSellDate' => $this->courseBegin, - 'prActDate' => date("Y-m-d H:i:s"), - 'prFizetve' => $this->courseEnd, - 'prTime' => date("Y-m-d H:i:s"), - 'prLastMod' => date("Y-m-d H:i:s"), - 'prContact' => _Program::Nonprofit, - 'prHlNum' => $hlNum, - 'prManID' => _Manager::Web, - 'prCtrID' => _Country::Hungary, - 'prStat' => _Program::Active, - 'prActCode' => '', - 'old_db' => 'clusers', - 'old_prID' => 0 - ); - $query = "UPDATE `" . CRMADATBAZIS . "`.`h_programs` SET prStat = ? WHERE prHlNum = ? AND prVerID != ?"; - $this->query($query, array('isi', _Program::Inactive, $hlNum, $ver['verID'])); - $this->insert(CRMADATBAZIS . ".h_programs", $programs, 'iiissssssisiiissi'); - } - - if ($generate_live && $ver['verID'] < 25) { - $live_password = Codegen::GeneratePassword($live_hlNum, $lan, $live_type, $live_version); - $programs = array( - 'prTypeID' => $live_type, - 'prVerID' => 23, - 'prLan' => $lan, - 'prPass' => $live_password, - 'prSellDate' => $this->courseBegin, - 'prActDate' => date("Y-m-d H:i:s"), - 'prFizetve' => $this->courseEnd, - 'prTime' => date("Y-m-d H:i:s"), - 'prLastMod' => date("Y-m-d H:i:s"), - 'prContact' => _Program::Nonprofit, - 'prHlNum' => $live_hlNum, - 'prManID' => _Manager::Web, - 'prCtrID' => _Country::Hungary, - 'prStat' => _Program::Active, - 'prActCode' => '', - 'old_db' => 'clusers', - 'old_prID' => 0 - ); - $query = "UPDATE `" . CRMADATBAZIS . "`.`h_programs` SET prStat = ? WHERE prHlNum = ? AND prVerID != ?"; - $this->query($query, array('isi', _Program::Inactive, $live_hlNum, $ver['verID'])); - $this->insert(CRMADATBAZIS . ".h_programs", $programs, 'iiissssssisiiissi'); - } - } - - public function sendEngEmail($student_id, &$error = false, &$isSend = array(), $mail) - { - require_once($_SERVER['DOCUMENT_ROOT'] . '/maintenance/libraries/phpmailer/PHPMailerAutoload.php'); - require_once($_SERVER['DOCUMENT_ROOT'] . '/maintenance/config.mail.php'); - - $sql = "SELECT * FROM `" . CRMADATBAZIS . "`.`students` WHERE id = ?"; - $this->query($sql, array('i', $student_id)); - $student = $this->fetchNext(); - - $msg = "Dear " . $student['name'] . "!

- - As a student of the " . $this->schoolName . ", you can learn how to use the ARCHLine.XP design program and ARCHLine.XP LIVE visualization software. To facilitate your successful studies, CadLine Kft. provides free use of the programs for the duration of the referred semester.

- - In order for the education to start smoothly, follow the steps below: - -
    -
  1. Based on the data provided by the School, we have created a user account for you on the archlinexp.com website, with the e-mail address to which you received this letter.
    - Username: email address
    - Password: the part of the e-mail address before @
    - On the www.archlinexp.com website log in to the User page with the above data. After logging in, you can change your password on your User Profile.
    - If you have already created a user account with this e-mail address, log in to your account on the User page. -
  2. - -
  3. Download from here and install ARCHLine.XP Professional 2022 and ARCHLine.XP LIVE 2022 trial versions.
    - Before downloading the programs, please make sure that your computer meets the system requirements published on our website. Only in this case will the programs work properly. -
  4. - -
  5. - You can also find the individual serial numbers with which you can use the programs during your active semesters in the Licenses section of your User Profile. -
  6. - -
  7. - Registration of non-profit version of ARCHLine.XP:
    - Start the program.
    - -
      -
    • - From the 3 options that appear, choose option 1: License activation with Login/User account, so it will not be necessary to enter the serial number.
      - Follow the instructions.
      - -
      - -
    • - -
    • - If several licenses are assigned to your user account, the program will warn you of this. In this case, choose option 2 - Serial number and enter the serial number in your User account: -
    • - -
    • - Start the program again.
      - See: Log in with an account -
    • -
    -
  8. - -
  9. Using the license on another computer, deactivating the license:
    - With the software key, the program can be used on one computer at a time, but the user can deactivate the license on the old computer and activate it on the new computer:
    - To do this, you must log out of the user account in the ARCHLine.XP program on the old computer and log in on the new computer. If you forgot to log out of your user account on the old machine, you must restart the program at least twice after logging in on the new computer.
    - The method of logging out depends on whether the previous registration was done with a user account (Figure 1) or with a serial number (Figure 2)
    - -
    - or -
    -
    -
  10. - -
  11. Registration of ARCHLine.XP LIVE non-profit version:
    - After installation, you can start the program in two ways:
    -
      -
    • - With the command View / Rendering / ARCHLine.XP LIVE in the ribbon menu of the ARCHLine.XP 2022 design program. It will then display the current model. -
    • - -
    • - With the ARCHLine.XP LIVE icon that appears on the desktop, you can open models with the .allive extension previously saved in ARCHLine.XP LIVE's own format. -
    • -
    - - Start the program, open an .allive project (you can also choose one of our example projects for the first time.)
    - -

    - - Select Login from the list that appears.
    - Log in with your user account.
    - - -
  12. - -
  13. Free Online Tutorials:
    - https://www.archlinexp.com/education/workshops
    - https://www.archlinexp.com/education/tutorial-videos
    - https://www.archlinexp.com/products/archline-xp-live/learn-live -
  14. -
- - If you have any questions, contact your instructor! -
-
- - CadLine Kft.
- Web: http://www.archlinexp.com/"; - - $subject = 'ARCHLine.XP Course Installation Guide'; - - $mail->FromName = 'www.archline.hu'; - $mail->From = 'marketing@cadline.hu'; - $mail->ClearAllRecipients(); - $mail->AddAddress($student['email'], $student['name']); - $mail->AddCC('marketing@cadline.hu'); - - $mail->IsHTML(true); - - $mail->Subject = $subject; - $mail->Body = $msg; - - if (!$mail->Send()) { - $error = true; - $isSend[] = array("email" => $student["email"]); - } else { - $begin = str_replace('-', '.', $this->courseBegin); - $end = str_replace('-', '.', $this->endDate); - $history = array( - "nUserID" => $student['nUserID'], - "nTopicID" => "102", - "strPlace" => "web", - "strInfo" => "{$this->username} {$this->courseCode} {$begin} - {$end} Tanfolyami szerződés elküldve", - "nManagerID" => _Manager::Web, - "dateEvent" => date('Y-m-d') - ); - $this->insert(CRMADATBAZIS . ".u_history", $history, 'iissis'); - $this->update(CRMADATBAZIS . ".students", array('email_sent' => 1), array('id' => $student_id), 'ii'); - } - } - - public function sendDistributorEmail($student_id, &$error = false, &$isSend = array(), $email, $mail) - { - require_once($_SERVER['DOCUMENT_ROOT'] . '/maintenance/libraries/phpmailer/PHPMailerAutoload.php'); - require_once($_SERVER['DOCUMENT_ROOT'] . '/maintenance/config.mail.php'); - - $sql = "SELECT * FROM `" . CRMADATBAZIS . "`.`students` WHERE id = ?"; - $this->query($sql, array('i', $student_id)); - $student = $this->fetchNext(); - - $sql = "SELECT verID FROM `" . CRMADATBAZIS . "`.`p_versions` WHERE year = ?"; - $this->query($sql, array('i', $this->version)); - $version = $this->fetchNext(); - - $sql = "SELECT h.hlNum, p.prPass AS prPass, h.product_id AS product, h.hlUser - FROM `" . CRMADATBAZIS . "`.`hardlock` h - LEFT JOIN `" . CRMADATBAZIS . "`.`h_programs` p ON p.prHlNum = h.hlNum - WHERE h.hlUser = ? AND p.prPass LIKE ? AND p.prVerID = ? AND h.product_id = 1 LIMIT 1;"; - $this->query($sql, array('isi', $student['nUserID'], '99%', $version['verID'])); - $hardlock = $this->fetchNext(); - - $msg = 'Thank You for Your Order.

- - We have accepted your online purchase order for the following items.

- - The following order details were accepted on ' . date('d-m-Y') . '

- - Licensee E-mail: ' . $student["email"] . '

- - Licensee name: ' . $student['name'] . '

- - Information:

- - Ordered product(s):

- - Item: ARCHLine.XP Professional ' . $this->version . ' - Non-Profit
- Serial code ' . $this->version . ': ' . $hardlock['prPass'] . '

- - Thank you for your order,

- - CadLine Ltd.

- - This is an automatically generated email – please do not reply to it.
- If you have any queries regarding your order please email office@cadline.hu.'; - - $subject = 'ARCHLine.XP order: Non-Profit ' . $this->version . ' - ' . $student['name']; - - $mail->FromName = 'www.archline.hu'; - $mail->From = 'marketing@cadline.hu'; - $mail->ClearAllRecipients(); - $mail->AddAddress($email); - $mail->AddCC('marketing@cadline.hu'); - - $mail->IsHTML(true); - - $mail->Subject = $subject; - $mail->Body = $msg; - - $mail->Send(); - - $this->update(CRMADATBAZIS . ".students", array('email_sent' => 1), array('id' => $student_id), 'ii'); - } - - public function sendEmail($student_id, &$error = false, &$isSend = array(), $mail) - { - require_once($_SERVER['DOCUMENT_ROOT'] . '/maintenance/libraries/phpmailer/PHPMailerAutoload.php'); - require_once($_SERVER['DOCUMENT_ROOT'] . '/maintenance/config.mail.php'); - - $sql = "SELECT * FROM `" . CRMADATBAZIS . "`.`students` WHERE id = ?"; - $this->query($sql, array('i', $student_id)); - $student = $this->fetchNext(); - - $msg = 'Kedves ' . $student['name'] . ' Hallgató!

- - A(z) ' . $this->schoolName . ' Iskola hallgatójaként elsajátíthatod az ARCHLine.XP tervezőprogram használatát. Sikeres tanulmányaid elősegítéséhez a CadLine Kft. a képzés teljes időtartamára (az aktív féléveid alatt) ingyenesen biztosítja a program használatát.

- - Ahhoz, hogy az oktatás zökkenőmentesen elkezdődhessen, kövesd az alábbi lépéseket: - -
    -
  1. Az Iskola által átadott adatok alapján létrehoztunk egy felhasználói fiókot a számodra az archline.hu oldalon, azzal az e-mail címmel, amire jelen levelet is kaptad.
    - Felhasználónév: e-mail cím
    - Jelszó: az e-mail cím @ előtti része
    - A fenti adatokkal jelentkezz be a Felhasználó oldalon. Bejelentkezés után a Felhasználói adatlapodon a jelszó módosítható.
    - Ha már létrehoztál ezzel az e-mail címmel felhasználói fiókot, akkor jelentkezz be a fiókodba a Felhasználó oldalon. -
  2. -
    - -
  3. A Felhasználói Adatlapodon a Számlázás és szerződés részben kattints a Tanfolyami szerződés hallgatóknak - Letöltés gombra. Figyelmesen olvasd el a felugró ablakban megjelenő tanfolyam szerződést, és amennyiben elfogadod annak feltételeit, pipáld be az ablak alján található "Elfogadom" mezőt.
  4. - -
  5. Töltsd le és telepítsd az ARCHLine.XP próbaváltozatot.
    - A program letöltése előtt kérjük, győződj meg róla, hogy a honlapunkon közzétett rendszerkövetelményeknek a számítógéped megfelel-e. Csak ebben az esetben fog a program megfelelően működni. -
  6. -
    - -
  7. - Az egyéni sorozatszámokat, melyekkel a programokat az aktív féléveid során használhatod, szintén a Felhasználói adatlapodon a Licencek részben találod. -
  8. -
    - -
  9. - ARCHLine.XP non-profit változat regisztrálása:
    - Indítsd el a programot.
    - -
      -
    • - A megjelenő 3 lehetőség közül válaszd az 1. opciót: Licenc aktiválása Bejelentkezéssel/Felhasználói fiókkal, így nem lesz szükség a sorozatszám beírására.
      - Kövesd az utasítást.
      - - -
    • - -
    • - Ha több licenc van a felhasználói fiókodhoz rendelve, akkor erre a program figyelmeztet. Ebben az esetben válaszd a 2. opciót – Sorozatszám, és írd be a Felhasználói fiókodban található sorozatszámot. -
    • - -
    • - Indítsd újból a programot.
      - Lásd: Bejelentkezés fiókkal -
    • -
    -
  10. -
    - -
  11. A licenc használata másik gépen, licenc deaktiválása:
    - A szoftverkulccsal egyszerre egy számítógépen használható a program, de a felhasználó által deaktiválható a licenc a régi gépen és aktiválható az új gépen:
    - Ehhez az ARCHLine.XP programban a régi gépen ki kell jelentkezni a felhasználói fiókból és az új gépen be kell jelentkezni. Ha elfelejtettél kijelentkezni a felhasználói fiókodból a régi gépen, akkor az új gépen a bejelentkezés után a program legalább kétszeri újraindítása szükséges.
    - A kijelentkezés módja azon múlik, hogy az előző regisztrálás felhasználó fiókkal történt (1. ábra) vagy sorozatszámmal (2. ábra) - -
    - vagy -
    -
    -
    - - Ha az előzőek alapján nem sikerül kijelentkeztetni a licencet a régi gépen, akkor csak a https://www.archline.hu/felhasznalo oldalon bejelentkezve lehet eltávolítani a régi gépről.
    -
    -
    - - Ezután az új gépen be kell jelentkezni.
    -
  12. -
    - -
  13. Ingyenes Online oktatóanyagok:
    - https://www.archline.hu/oktatas/workshopok
    - https://www.archline.hu/attekintes/ujdonsagok-2025
    -
  14. -
    - -
  15. - Tippek:
    - Tippek az informatikai problémák elkerülésére -
  16. -
    - -
  17. Facebook csoport
    - Szeretnénk figyelmedbe ajánlani, hogy a tanfolyami szerződés elfogadása után jelentkezhetsz az ARCHLine felhasználók zárt Facebook csoportba. -
    - - A csoport célja, hogy a programot használó kollégák megosszák egymás között tapasztalataikat, segítsék egymás munkáját. -
    - - Várjuk jelentkezésed a csoportba! -
  18. -
    -

- Ha kérdésed merül fel, vedd fel a kapcsolatot az oktatóddal! -
-
- - Üdvözlettel: -
-
- - CadLine Kft.
- 1037 Budapest, Montevideo u. 3/B.
- E-mail: marketing@cadline.hu | Web: www.archline.hu'; - - $subject = 'ARCHLine.XP Tanfolyami szerződés és telepítesi útmutató - ' . $student['name']; - - if ($student['email_sent'] == 0) { - $mail->FromName = 'www.archline.hu'; - $mail->From = 'marketing@cadline.hu'; - $mail->ClearAllRecipients(); - $mail->AddAddress($student['email'], $student['name']); - $mail->AddCC('marketing@cadline.hu'); - - $mail->IsHTML(true); - - $mail->Subject = $subject; - $mail->Body = $msg; - - if (!$mail->Send()) { - $error = true; - $isSend[] = array("email" => $student["email"]); - } else { - $begin = str_replace('-', '.', $this->courseBegin); - $end = str_replace('-', '.', $this->endDate); - $history = array( - "nUserID" => $student['nUserID'], - "nTopicID" => "102", - "strPlace" => "web", - "strInfo" => "{$this->username} {$this->courseCode} {$begin} - {$end} Tanfolyami szerződés elküldve", - "nManagerID" => _Manager::Web, - "dateEvent" => date('Y-m-d') - ); - $this->insert(CRMADATBAZIS . ".u_history", $history, 'iissis'); - $this->update(CRMADATBAZIS . ".students", array('email_sent' => 1), array('id' => $student_id), 'ii'); - } - } - } -} - -class AML -{ - private static $Stream; - - public static function add_atribute($strTagName, $strData) - { - if ($strData != '') { - self::$Stream .= self::OpenBracket(); - self::$Stream .= $strTagName; - self::$Stream .= self::Separator(); - self::$Stream .= strlen($strData); - self::$Stream .= self::CloseBracket(); - self::$Stream .= $strData; - } - } - - public static function GetStream() - { - return self::$Stream; - } - - private static function OpenBracket() - { - return "{"; - } - private static function Separator() - { - return ":"; - } - private static function CloseBracket() - { - return "}"; - } - - public static function CreateAML($password, $installationCode, $npid, $computerName, $isFloating = '', $isOffline = '', $seatID = '') - { - self::$Stream = ""; - self::add_atribute("PWD", $password); - self::add_atribute("IID", $installationCode); - self::add_atribute("NP", $npid); - self::add_atribute("Fl", $isFloating); - self::add_atribute("Ol", $isOffline); - self::add_atribute("SI", $seatID); - - if ($computerName != '') self::add_atribute("CN", $computerName); - - return self::$Stream; - } - - public static function CreateEncodedAML($data) - { - self::$Stream = ""; - self::add_atribute("ED", $data); - - return self::$Stream; - } - - public static function getAttribute($attribute, $aml) - { - $arr = array(); - $arr = explode("{{$attribute}:", $aml); - $arr = explode('}', $arr[1]); - - return substr($arr[1], 0, $arr[0]); - } - - public static function emptyAML() - { - self::$Stream = ""; - } -} - -class program -{ - protected $db; - - protected $password; - protected $isid; - - protected $ctrID; // A password elso 2 karaktere - protected $hlNum; // A password elso 6 karaktere - protected $verPassword8and9; // A password 7-8 karaktere - protected $verID; // A verzio ID-je (pl 2019-ben az ertek 19) - protected $prID; // A program egyedi ID-je az adatbazisban - protected $prActCode; // A program aktivalo kodja - protected $prSellDate; // A program eladasi datuma - protected $prFizetve; // A program lejarati ideje - protected $hlStat; // A kulcs allapota (ures, aktiv, letiltott) - - protected $installDate; // A program telepitesi datuma - protected $installCode; // Telepitesi kod - protected $daysSinceInstall; // Telepites ota eltelt napok szama - - protected $language; // A kulcs nyelve (DB-ben hlCtrID) - protected $lan; // Lan szam (engedelyezett programok szama) - protected $isSoftwareKey; // Szoftveres-e - protected $isValidPassword; - - protected $hlUser; - protected $productID; - - protected $aktiv; // p_serial_isid tabla aktiv mezoje - - public function __construct() - { - $this->db = Database::getInstance(); - } - - public function SetPassword($password) - { - unset($this->isid); - unset($this->prID); - unset($this->prActCode); - unset($this->language); - if ($this->password != $password) { - unset($this->ctrID); - unset($this->hlNum); - unset($this->verPassword8and9); - unset($this->verID); - unset($this->prSellDate); - unset($this->prFizetve); - unset($this->hlStat); - unset($this->lan); - unset($this->IsSoftwareKey); - unset($this->isValidPassword); - } - if (!isset($this->isSoftwareKey) || $this->isSoftwareKey) { - unset($this->installDate); - unset($this->installCode); - unset($this->daysSinceInstall); - } - $this->password = $password; - } - - public function SetIsid($isid) - { - if ($this->isid != $isid) { - unset($this->prID); - unset($this->prActCode); - unset($this->language); - unset($this->installDate); - unset($this->installCode); - unset($this->daysSinceInstall); - } - $this->isid = $isid; - } - - public function SetFromHardlockTable($hardlock) - { - if (!empty($hardlock)) { - if (!isset($this->hlNum)) $this->hlNum = $hardlock['hlNum']; - if (!isset($this->language)) $this->language = $hardlock['hlCtrID']; - if (!isset($this->lan)) $this->lan = $hardlock['hlLan']; - if (!isset($this->hlStat)) $this->hlStat = $hardlock['hlStat']; - if (!isset($this->hlUser)) $this->hlUser = $hardlock['hlUser']; - if (!isset($this->productID)) $this->productID = $hardlock['product_id']; - } - } - - public function SetFromHprogramsTable($program) - { - if (!empty($program)) { - if (!isset($this->prID)) $this->prID = $program['prID']; - if (!isset($this->prSellDate)) $this->prSellDate = $program['prSellDate']; - if (!isset($this->prActCode)) $this->prActCode = $program['prActCode']; - if (!isset($this->prFizetve)) $this->prFizetve = $program['prFizetve']; - if (!isset($this->lan)) $this->lan = $program['hlLan']; - if (!isset($this->hlNum)) $this->hlNum = $program['prHlNum']; - } - } - - public function SetFrompSerialIsidTable($serialisid) - { - if (!empty($serialisid)) { - if (!isset($this->installDate)) $this->installDate = $serialisid['datum']; - if (!isset($this->isid)) $this->isid = $serialisid['isid']; - if (!isset($this->aktiv)) $this->aktiv = $serialisid['aktiv']; - } - } - - public function SetInstallCode($installCode) - { - if (Codegen::IsValidTimeCode($installCode)) { - $this->installCode = $installCode; - $this->daysSinceInstall = Codegen::GetDayFromTimeCode($installCode); - } - - unset($this->installCode); - } - - public function GetCtrID() - { - if (isset($this->ctrID)) return $this->ctrID; - $this->ctrID = substr($this->password, 0, 2); - - return $this->ctrID; - } - - public function GetHlNum() - { - if (isset($this->hlNum)) return $this->hlNum; - $this->hlNum = crm_hardlock::GetHlnumFromPassword($this->password); - - return $this->hlNum; - } - - public function GetVerPassword8and9() - { - if (isset($this->verPassword8and9)) return $this->verPassword8and9; - $this->verPassword8and9 = substr($this->password, 7, 2); - - return $this->verPassword8and9; - } - - public function GetInstallCode() - { - if (isset($this->installCode)) return $this->installCode; - - return $this->installCode; - } - - public function IsValidPassword() - { - if (isset($this->isValidPassword)) return $this->isValidPassword; - $this->isValidPassword = Codegen::IsValidPassword($this->password); - - return $this->isValidPassword; - } - - public function IsSoftwareKey() - { - if (isset($this->isSoftwareKey)) return $this->isSoftwareKey; - $this->isSoftwareKey = Codegen::IsSoftwareKey($this->password); - - return $this->isSoftwareKey; - } - - public function GetVerID() - { - if (isset($this->verID)) return $this->verID; - - $verPassword8and9 = $this->GetVerPassword8and9(); - $query = "SELECT verID, verPassword8and9 FROM `" . CRMADATBAZIS . "`.`p_versions` WHERE verPassword8and9 = ?"; - $this->db->query($query, array('i', $verPassword8and9)); - $version = $this->db->fetchNext(); - if (!empty($version)) $this->verID = $version['verID']; - - return $this->verID; - } - - public function GetIsid() - { - if (isset($this->isid)) return $this->isid; - if (!$this->IsSoftwareKey()) $this->isid = $this->GetCtrID() . $this->GetVerPassword8and9(); - - return $this->isid; - } - - public function GetPrID() - { - if (isset($this->prID)) return $this->prID; - - $isid = $this->GetIsid(); - $query = "SELECT prID FROM `" . CRMADATBAZIS . "`.`h_programs` WHERE prPass = ? AND prActCode LIKE ?"; - $this->db->query($query, array('ss', $this->password, "%-{$isid}-%")); - $programs = $this->db->fetchNext(); - if (!empty($programs)) $this->prID = $programs['prID']; - - return $this->prID; - } - - private function executeQuery_programs() - { - if (isset($this->prID)) { - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`h_programs` WHERE prID = ?"; - $this->db->query($query, array('i', $this->prID)); - } else { - $isid = $this->GetIsid(); - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`h_programs` WHERE prPass = ? AND prActCode LIKE ?"; - $this->db->query($query, array('ss', $this->password, "%-{$isid}-%")); - } - $programs = $this->db->fetchNext(); - - return $programs; - } - - private function processQueryresult_programs($programs) - { - if (!empty($programs)) $this->SetFromHprogramsTable($programs); - } - - public function GetPrActCode() - { - if (isset($this->prActCode)) return $this->prActCode; - - $programs = $this->executeQuery_programs(); - $this->processQueryresult_programs($programs); - - return $this->prActCode; - } - - public function GetPrSellDate() - { - if (isset($this->prSellDate)) return $this->prSellDate; - - $programs = $this->executeQuery_programs(); - $this->processQueryresult_programs($programs); - - return $this->prSellDate; - } - - public function GetPrFizetve() - { - if (isset($this->prFizetve)) return $this->prFizetve; - - $programs = $this->executeQuery_programs(); - $this->processQueryresult_programs($programs); - - return $this->prFizetve; - } - - private function executeQuery_hardlock() - { - $hlNum = $this->GetHlNum(); - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`hardlock` WHERE hlNum = ?"; - $this->db->query($query, array('s', $hlNum)); - $keys = $this->db->fetchNext(); - - return $keys; - } - - private function executeQuery_p_serial_isid() - { - $isid = $this->GetIsid(); - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`p_serial_isid` WHERE serial = ? AND isid = ?"; - $this->db->query($query, array('ss', $this->password, $isid)); - $p_serial_isids = $this->db->fetchNext(); - - return $p_serial_isids; - } - - private function processQueryresult_hardlock($keys) - { - if (!empty($keys)) $this->SetFromHardlockTable($keys); - } - private function processQueryresult_p_serial_isid($serialisids) - { - if (!empty($serialisids)) $this->SetFrompSerialIsidTable($serialisids); - } - - public function GetHlStat() - { - if (isset($this->hlStat)) return $this->hlStat; - - $keys = $this->executeQuery_hardlock(); - $this->processQueryresult_hardlock($keys); - - return $this->hlStat; - } - - public function GetLan() - { - if (isset($this->lan)) return $this->lan; - - $keys = $this->executeQuery_hardlock(); - $this->processQueryresult_hardlock($keys); - - return $this->lan; - } - - public function GetLanguage() - { - if (isset($this->language)) return $this->language; - - $keys = $this->executeQuery_hardlock(); - $this->processQueryresult_hardlock($keys); - - return $this->language; - } - - public function GetInstallDate() - { - if (isset($this->installDate)) return $this->installDate; - - if ($this->IsSoftwareKey()) { - $p_serial_isids = $this->executeQuery_p_serial_isid(); - $this->processQueryresult_p_serial_isid($p_serial_isids); - } else $this->installDate = $this->GetPrSellDate(); - - return $this->installDate; - } - - public function GetDaysSinceInstall() - { - if (isset($this->daysSinceInstall)) return $this->daysSinceInstall; - - $installDate = $this->GetInstallDate(); - $now = date("Y-m-d"); - $this->daysSinceInstall = Codegen::GetDayInterval($installDate, $now); - - return $this->daysSinceInstall; - } - - public function CheckPassword($engedelyek = array()) - { - $result = ''; - $hlNum = $this->GetHlNum(); - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`hardlock` WHERE hlNum = ?"; - $this->db->query($query, array('s', $hlNum)); - $keys = $this->db->fetchAssoc(); - - if (empty($keys)) return "error: nincs ilyen kulcs a hardlock tablaban"; - elseif (count($keys) > 1) return "error: tobbszor van felveve a kulcs a hardlock tablaban"; - - $hlLan_hardlock = $this->GetLan(); - if ($hlNum != $keys[0]['hlNum']) return "error: nem jo a hlNum erteke a hardlock tablaban"; - - // A program megletenek ellenorzese - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`h_programs` WHERE prPass = ?"; - $this->db->query($query, array('s', $this->password)); - $programs = $this->db->fetchAssoc(); - if (empty($programs)) return "error: nincs ilyen password a h_programs tablaban"; - - if (!$this->IsValidPassword() && $programs[0]['prVerID'] > 3) return "error: ervenytelen password"; - - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`h_programs` WHERE prHlNum = ?"; - $this->db->query($query, array('s', $hlNum)); - $check_programs = $this->db->fetchNext(); - - if (empty($check_programs) && $keys[0]['hlStat'] == 1) return "error: nem tartozik program ehhez az aktiv kulcshoz"; - - $checkLan = $keys[0]['hlLan'] + 1; - - if ($keys[0]['isFloating'] == 0 && $programs[0]['prVerID'] < 24) { - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`h_programs` WHERE prHlNum = ? AND prVerID >= 20 GROUP BY prVerID HAVING COUNT(prVerID) > " . $checkLan; - $this->db->query($query, array('s', $hlNum)); - $checkVersions = $this->db->fetchAssoc(); - - if (!empty($checkVersions)) { - $versionError = ''; - - foreach ($checkVersions as $checkVersion) { - if ($checkVersion['prPass'] == $this->password) - $versionError .= 'error: a h_programs tablaban tobb ugyan olyan verzioju program van felveve
'; - } - - return $versionError; - } - } - - $softwareKey = $this->IsSoftwareKey(); { // A licenszek szamanak ellenorzese - $numberOfLicenses = $hlLan_hardlock; - if ($numberOfLicenses < 0) return "error: nincs ilyen kulcs a hardlock tablaban"; - elseif ($numberOfLicenses == 0) $numberOfLicenses = 1; // A nem lanos kulcsoknal 0 az ertek, ami 1 licenszt jelent - - if ($keys[0]['isFloating'] == 0 && $programs[0]['prVerID'] < 24) { - if ($softwareKey) { - if ($numberOfLicenses != count($programs)) - return "error: a h_programs tablaban levo programok szama nem egyezik meg a hardlock tablaban levo hlLan ertekkel"; - } else { - if (count($programs) != 1) { - $hlnums = array(); - foreach ($programs as $program) { - $local_hlNum = $program["prHlNum"]; - if (in_array($local_hlNum, $hlnums)) return "error: tobbszor van felveve a program a h_programs tablaba (HlNum: {$local_hlNum})"; - array_push($hlnums, $local_hlNum); - } - } - } - } - } { // A kiadott idokodok konzisztenciainak az ellenorzese - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`p_serial_isid` WHERE serial = ? AND aktiv = ? AND (isid != '' OR isid IS NOT NULL)"; - $this->db->query($query, array('si', $this->password, 1)); - $p_serial_localIsids = $this->db->fetchAssoc(); - $p_serial_isids = array(); - - if ($softwareKey) { - foreach ($p_serial_localIsids as $p_serial_localIsid) { - $local_isid = $p_serial_localIsid['isid']; - if (array_key_exists($local_isid, $p_serial_isids)) return "error: isid utkozest talaltunk a p_serial_isid tablaban: {$local_isid}"; - - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`h_programs` WHERE prPass = ? AND prActCode LIKE ?"; - $this->db->query($query, array('ss', $this->password, "%-{$local_isid}-%")); - $checkReg = $this->db->fetchAssoc(); - if (empty($checkReg) && $checkReg['prFizetve'] > date('Y-m-d')) return "error: ehhez az isid-hez nem tartozik aktivalokod: {$local_isid}"; - array_push($p_serial_isids, $p_serial_localIsid['isid']); - } - } - - $isids = array(); - $fizetve = $programs[0]['prFizetve']; - foreach ($programs as $prgrm) { - if (!crm_hardlock::checkProgramType($prgrm['prTypeID'], $this->password) && $prgrm['prVerID'] >= 20) - return "error: a program tipusa nem egyezik meg a passwordben levo tipus szammal"; - - if (!crm_hardlock::checkProgramVersion($prgrm['prVerID'], $this->password) && $prgrm['prVerID'] >= 10) - return "error: a program verzioja nem egyezik meg a passwordben levo verzio szammal"; - - if (empty($prgrm['prActCode']) || $prgrm['prActCode'] == '' || $prgrm['prActCode'] == NULL) continue; - - if (Codegen::IsSoftwareKey($this->password)) { - $prg_isid = crm_hardlock::GetIsidFromTimeCode($prgrm['prActCode']); - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`p_serial_isid` WHERE serial = ? AND isid = ?"; - $this->db->query($query, array('ss', $this->password, $prg_isid)); - $prg_reg = $this->db->fetchNext(); - - if (empty($prg_reg)) return "error: nincs ilyen isiddel a password regisztralva: {$prg_isid}"; - - if ($prg_reg['aktiv'] != 1) return "error: a regisztracio nem aktiv: {$prg_isid}"; - } - - $lan_sign = crm_hardlock::GetLanSignFromLanUserNumber($prgrm['prLan']); - if (substr($prgrm['prPass'], 9, 1) != $lan_sign && $prgrm['prVerID'] > 20) - return "error: a passwordben levo lan szam nem egyezik meg a tenyleges lan szammal"; - - if ($prgrm['prLan'] != $hlLan_hardlock) return "error: prLan erteke nem egyezik meg a hardlock es a h_programs tablaban"; - - if (substr($prgrm['prHlNum'], 0, 6) != $hlNum) // Regen duplikalodtak a kulcsok es ezt 1 plusz karakterrel kulonboztettek meg oket pl(360204a) - return "error: prHlNum erteke nem jo a h_programs tablaban"; - - $localActCode = $prgrm['prActCode']; - if (!Codegen::IsValidTimeCode($localActCode) && $prgrm['prVerID'] > 6) return "error: nem megfelelo formatumu idokod: {$localActCode}"; - $localIsid = crm_hardlock::GetIsidFromTimeCode($localActCode); - - if (!crm_hardlock::IsValidIsid($localIsid) && $prgrm['prVerID'] > 6) return "error: nem megfelelo formatumu isid: {$localActCode}"; - if ($softwareKey) { - if (array_key_exists($localIsid, $isids)) return "error: isid utkozest talaltunk a h_programs tablaban: {$localIsid}"; - } else { - $hardwareisid = crm_hardlock::GetIsidFromPasswordForHardwareKeys($prgrm['prPass']); - - if ($hardwareisid != $localIsid && $prgrm['prVerID'] > 6) - return "error: a hardware kulcsos program aktivalasi kodja nem jo isidet tartalmaz: {$localIsid}"; - } - array_push($isids, $localIsid); - - if ($softwareKey && array_search($localIsid, $p_serial_isids) === false && strpos($prgrm['prInfo'], 'AutoReg') === false && $prgrm['prVerID'] > 6) - return "error: nincs ilyen isid a p_serial isid tablaban: {$localIsid}"; - - if ($prgrm['prFizetve'] != $fizetve) - return "error: nem egyezik meg az aktivalas ervenyessege az osszes programnal a h_programs tablaban"; - } - } - - //- volt-e regisztralva - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`userstats2013` WHERE usPwd = ? ORDER BY usDate DESC"; - $this->db->query($query, array('s', $this->password)); - $usstats = $this->db->fetchAssoc(); - if (empty($usstats)) return ""; //- nem haznalta, nem hiba, illetve a regi programok nincsenek benne a userstats2013 tablaban - - { - //- telepitesi datum tarolasanak elokeszitese - $telepitesi_datumok = array(); - $isidek = array(); - foreach ($usstats as $stats) { - $usISID = $stats['usISID']; - if ($usISID == null || $usISID == '') continue; - if ($softwareKey && ($stats['usTelepitesiDatum'] == null || $stats['usTelepitesiDatum'] == '' || $stats['usTelepitesiDatum'] == '0000-00-00')) { - if ($stats['usDate'] > 1561939200) return "error: nincsen telepitesi datum a userstats2013 tablaban: {$usISID}"; //2019-07-01 00:00:00 - continue; - } - array_push($isidek, $usISID); - array_push($telepitesi_datumok, $stats['usTelepitesiDatum']); - } - - if ($fizetve != '' && $fizetve != null) { - foreach ($programs as $prgrm) { - if (empty($prgrm['prActCode'])) continue; - - $localActCode = $prgrm['prActCode']; - $localIsid = crm_hardlock::GetIsidFromTimeCode($localActCode); - - $index = array_search($localIsid, $isidek); - if ($index === false && $softwareKey) { - if ($stats['usDate'] > 1561939200) return "error: nincs ilyen isid a userstats2013 tablaban: {$localIsid}"; //2019-07-01 00:00:00 - continue; - } - - if ($prgrm['twtw'] == 1) $installDate = crm_hardlock::getTwTwRootTimeString(); - else $installDate = $telepitesi_datumok[$index]; - - $checkActDate = crm_hardlock::checkActDate($this->password, $localIsid); - if (strpos($checkActDate, 'error:') !== false) return $checkActDate; - - if ($fizetve != "2050-01-01") { { //- ervenyessegi datum ellenorzese - $engedelyezett_napok_szama = Codegen::GetDayFromTimeCode($localActCode); - $dateExpire = new DateTime($fizetve); - $dateRealExpire = new DateTime($installDate); - $dateRealExpire->modify("+{$engedelyezett_napok_szama} day"); - $dateRealExpireString = $dateRealExpire->format('Y-m-d'); - $dateRealExpireMin = new DateTime($dateRealExpireString); - $dateRealExpireMax = new DateTime($dateRealExpireString); - $dateRealExpireMin->modify('-2 day'); - $dateRealExpireMax->modify('+2 day'); - - if ($dateExpire > $dateRealExpireMax || $dateExpire < $dateRealExpireMin) { - $realstring = "A valos lejarati datum: {$dateRealExpireString}"; - $realstring2 = "Az aktivalas ervenyessege CRM szerint: {$dateExpire->format('Y-m-d')}"; - $error = "error: nem jol kiszamolt aktivalasi kod (ISID: {$localIsid}) {$realstring} {$realstring2} Aktivalo kod: {$localActCode}"; - - if (!in_array('aktivalasi kod', $engedelyek)) return $error; - - if (!empty($result)) $result .= "
"; - $result .= $error; - - $dayInterval = Codegen::GetDayInterval(substr($installDate, 0, 10), $dateExpire->format('Y-m-d')); - $generatedTimeCode = Codegen::GenerateTimeCode($this->password, $localIsid, $dayInterval); - - if ($generatedTimeCode == $localActCode) return $error; - - $this->db->update( - CRMADATBAZIS . ".h_programs", - array( - 'prActCode' => $generatedTimeCode - ), - array('prID' => $prgrm['prID']), - 'si' - ); - $result .= " Javitva: {$generatedTimeCode}"; - } - } - } else { - $numOfDays = crm_hardlock::GetDaysForUnlimitedTimeCode($this->password); - $generatedTimeCode = Codegen::GenerateTimeCode($this->password, $localIsid, $numOfDays); - - if ($generatedTimeCode != $localActCode) return "error: nem vegleges kodot kapott: {$localIsid}"; - } - } - } - } - return $result; // Sikeres teszt - } -} diff --git a/cadline/backend/common_cadline_libraries/crm_test.class.php b/cadline/backend/common_cadline_libraries/crm_test.class.php deleted file mode 100644 index fdd953d9..00000000 --- a/cadline/backend/common_cadline_libraries/crm_test.class.php +++ /dev/null @@ -1,608 +0,0 @@ -code = $_code; - $this->password = $_password; - } - - public function setIsid($_isid) - { - $this->isid = $_isid; - } - public function setActDate($_actDate) - { - $this->actDate = $_actDate; - } - public function setActCode($_actCode) - { - $this->actCode = $_actCode; - } - public function setHlStat($_hlStat) - { - $this->hlStat = $_hlStat; - } - public function setSellDate($_sellDate) - { - $this->sellDate = $_sellDate; - } - public function SetInstallCode($_installCode) - { - $this->installCode = $_installCode; - } - - private function encode() - { - $date = new DateTime(); - $date = $date->format('Y-m-d'); - $number = explode("-", $date); - $code = ((($number[0] * 4) * 555) + (($number[1] * 5) * 333) + ($number[2] * 72)) / 90; - - return (int)$code; - } - - public function checkCode() - { - return $this->code == $this->encode(); - } - - public function updateFizetve() - { - $updateQuery = "UPDATE `" . CRMADATBAZIS . "`.`h_programs` SET prFizetve = ?, prActCode = NULL WHERE prPass = ?"; - $this->query($updateQuery, array('ss', $this->actDate, $this->password)); - $query = "SELECT prFizetve FROM `" . CRMADATBAZIS . "`.`h_programs` WHERE prPass = ?;"; - $this->query($query, array('s', $this->password)); - $res = $this->fetchNext(); - - return $res['prFizetve']; - } - - public function countFloating($floatings, &$message) - { - $floatingsCount = count($floatings); - - $query = "SELECT * FROM `" . SYNCADATBAZIS . "`.`floating_licenses` WHERE hlNum = ?"; - $this->query($query, array('s', substr($this->password, 0, 6))); - $floatingLicenses = $this->fetchAssoc(); - - if (count($floatingLicenses) != $floatingsCount) { - $message = "error: nem egyeznek meg az active floating futo licencek"; - return false; - } - - for ($i = 0; $i < count($floatingLicenses); $i++) { - if (!in_array($floatingLicenses[$i]['seatID'], $floatings)) { - $message = "error: nincs benne a futo program az aktiv floating licencek kozott: " . $floatingLicenses[$i]['seatID']; - return false; - } - } - - return true; - } - - public function countRegistration($action) - { - $query = "SELECT id FROM `" . CRMADATBAZIS . "`.`p_serial_isid` WHERE serial = ?"; - - if ($action == 'active') $query .= " and aktiv = 1"; - elseif ($action == 'inactive') $query .= " and aktiv = 0"; - - $this->query($query, array('s', $this->password)); - $res = $this->fetchAssoc(); - - return count($res); - } - - public function countActivationCode() - { - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`h_programs` WHERE prPass = ? AND prActCode != '' AND prActCode IS NOT NULL"; - $this->query($query, array('s', $this->password)); - $res = $this->fetchAssoc(); - - return count($res); - } - - public function checkActivationCode() - { - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`h_programs` WHERE prPass = ? AND prActCode LIKE ?"; - $this->query($query, array('ss', $this->password, "%-{$this->isid}-%")); - $res = $this->fetchNext(); - - return !empty($res); - } - - public function isFloating() - { - $hlNum = crm_hardlock::GetHlnumFromPassword($this->password); - - $this->query("SELECT isFloating FROM cl_hlusers.hardlock WHERE hlNum = ?", array('s', $hlNum)); - $hardlock = $this->fetchNext(); - - $ver8and9 = crm_hardlock::GetVer8And9FromPassword($this->password); - - return !empty($hardlock) && $hardlock['isFloating'] == 1 && $ver8and9 >= 40; - } - - public function clearProgram($clr_info = false) - { - $this->delete(CRMADATBAZIS . '.p_serial_isid', array('serial' => $this->password), 's'); - $this->delete(CRMADATBAZIS . '.userstats2013', array('usPwd' => $this->password), 's'); - $this->query("UPDATE `" . CRMADATBAZIS . "`.`h_programs` SET prActCode = '' WHERE prPass = ?", array('s', $this->password)); - - $this->query("SELECT * FROM `" . CRMADATBAZIS . "`.`p_serial_isid` WHERE serial = ?", array('s', $this->password)); - $res = $this->fetchAssoc(); - - $hlNum = crm_hardlock::GetHlnumFromPassword($this->password); - - if ($clr_info) - $this->delete(CRMADATBAZIS . '.h_history', array('hiHlNum' => $hlNum), 's'); - - $this->query("SELECT isFloating FROM cl_hlusers.hardlock WHERE hlNum = ?", array('s', $hlNum)); - $hardlock = $this->fetchNext(); - - $ver8and9 = crm_hardlock::GetVer8And9FromPassword($this->password); - - if (!empty($hardlock) && $hardlock['isFloating'] == 1 && $ver8and9 >= 40) - $this->delete(SYNCADATBAZIS . '.floating_licenses', array('hlNum' => $hlNum), 's'); - - return empty($res); - } - - public function setDisabled($set_disabled) - { - $hlNum = crm_hardlock::GetHlnumFromPassword($this->password); - $date = date('Y-m-d'); - - if ($set_disabled) return crm_hardlock::DeactivateHardlock($hlNum, 36, "Test deaktiválás", $date); - else return crm_hardlock::ActivateHardlock($hlNum, 36, "Test aktiválás"); - } - - public function generateTimeCodeWithInstCode($isid, $isTwTw) - { - if ($this->actDate == '2050-01-01') $dayInterval = 3583; - else { - if (Codegen::IsSoftwareKey($this->password)) - $installDate = crm_hardlock::GetInstallationDateFromInstallationCode($this->installCode, $isTwTw); - else { - if ($isTwTw) - $installDate = crm_hardlock::getTwTwRootTimeString(); - else - $installDate = $this->sellDate; - } - $dayInterval = Codegen::GetDayInterval($installDate, $this->actDate); - } - return Codegen::GenerateTimeCode($this->password, $isid, $dayInterval); - } - - public function registerUnregisterTest(&$error_string, $hlNum, $verID) - { - $this->actDate = Date('Y-m-d', strtotime('+10 days')); - $isid = 'A001'; - $npid = 'Automata_test_00000000'; - $comp_name = 'CRM Automata Test'; - $datas = array(); - - $programs = crm_hardlock::getProgramsFromHardlock($hlNum, $verID); - if (empty($programs)) { - $error_string .= "error: nincs ilyen program (verzio: {$verID}) - hardlock: {$hlNum}"; - return false; - } - - $this->query("SELECT * FROM `cl_hlusers`.`hardlock` WHERE hlNum = ?", array('s', $hlNum)); - $res = $this->fetchNext(); - $this->hlStat = $res['hlStat']; - - foreach ($programs as $program) { - $this->password = $program['prPass']; - $this->clearProgram(true); - $this->updateFizetve(); - - // TODO: A crm_hardlock::startQuery() fgv-be az elejen belefut a $crackedProgram-ba! - if (substr($this->password, 0, 6) == '371001' || substr($this->password, 0, 6) == '370001') - continue; - - if (!Codegen::IsSoftwareKey($this->password)) $isid = crm_hardlock::GetIsidFromPasswordForHardwareKeys($this->password); - - $softwarekey = Codegen::IsSoftwareKey($this->password); - $this->installCode = Codegen::GenerateTimeCode($this->password, $isid, 1); - - $register_result = crm_hardlock::RegisterProgram($this->password, $isid, $this->installCode, $npid, $comp_name, ''); - if (substr($register_result, 0, 6) == "error:") { - $error_string .= "RegisterProgram(): {$register_result} - {$this->password}
"; - return false; - } - - $aktkod = crm_hardlock::GetOrGenerateTimeCode($this->password, $isid, $this->installCode, $npid, $comp_name); - if (substr($aktkod, 0, 6) == "error:") { - $error_string .= "GetOrGenerateTimeCode(): {$aktkod} - {$this->password}
"; - return false; - } - - $check_date = crm_hardlock::checkActDate($this->password, $isid); - if (!$check_date) { - $error_string .= "checkActDate(): {$check_date} - {$this->password}
"; - return false; - } - - $this->sellDate = $program['prSellDate']; - $isTwTw = ($program['twtw'] == 1 || $verID >= 21) ? 'true' : ''; - $date = new DateTime(); - - for ($i = 0; $i <= 3; $i++) { - $tip_result = ''; - - if ($i <= 2 && $i != 0) { - $date->modify('+1 month'); - $this->actDate = $date->format('Y-m') . '-01'; - } - - if ($i == 3) $this->actDate = '2050-01-01'; - - $this->updateFizetve(); - $this->actCode = $this->generateTimeCodeWithInstCode($isid, $isTwTw); - - if ($verID >= 21) $tip_result = $this->launchStartQuery($error_string, $verID, $isid, $npid); - else $tip_result = $this->launchTips($error_string, $verID, $isid, $npid, $isTwTw); - - if ($tip_result == false) return false; - } - - if ($softwarekey) { - $unregister_result = crm_hardlock::UnRegisterProgram($this->password, $isid, '', $comp_name); - if ($unregister_result == false) { - $activationError = crm_hardlock::GetActivationError(crm_hardlock::UNREGISTER_FAILED); - $error_string .= "UnRegisterProgram(): {$activationError} - {$this->password}
"; - return false; - } - } - } - return true; - } - - public function launchRegisterTest(&$error_string, $verID) - { - $result = $this->registerUnregisterTest($error_string, '371001', $verID); - if ($result == false) return $result; - - $result = $this->registerUnregisterTest($error_string, '370001', $verID); - if ($result == false) return $result; - - return true; - } - - public function generateStartQueryUrl($isid, $npid) - { - $this->query("SELECT prTypeID FROM `cl_hlusers`.`h_programs` WHERE prPass = ?", array('s', $this->password)); - $program = $this->fetchNext(); - - $ver8and9 = crm_hardlock::GetVer8And9FromPassword($this->password); - $launchYear = crm_hardlock::GetLaunchYearFromVer8And9($ver8and9); - - if ($program['prTypeID'] == 76) // LIVE - $this->query("SELECT pkgid FROM `www_archline_hu`.`version` WHERE ev = ? AND projectid LIKE '%Live' ORDER BY pkgid DESC", array('i', $launchYear)); - else // Prof. - $this->query("SELECT pkgid FROM `www_archline_hu`.`version` WHERE ev = ? AND projectid NOT LIKE '%Live' AND projectid NOT LIKE '%Namirial%' ORDER BY pkgid DESC", array('i', $launchYear)); - - $version = $this->fetchNext(); - $this->installCode = Codegen::GenerateTimeCode($this->password, $isid, 1); - $session = 'MHV5Z242S29VaEk5VyRzZWV5UE9TUQ'; - $decodedSession = base64_decode($session); - $privatekey = Webform::GetWebformPrivateKey(); - - $param = 'serialNumber=' . $this->password; - $param .= '&winchesterAdatai=1793730914'; - $param .= '&build=' . $version['pkgid']; - $param .= '&countryPhoneID=36'; - $param .= '&installationCode=' . $this->installCode; - $param .= '&osMajorMinorBuild=10.0.19041'; - $param .= '&vidMan='; - $param .= '&vidType='; - $param .= '&vidDrv='; - $param .= '&installationID=' . $npid; - $param .= '&partnerID='; - $param .= '&clientName='; - $param .= '&clientEmail='; - $param .= '&clientCompany='; - $param .= '&clientTelephone='; - $param .= '&newsletter=false'; - $param .= '&reenabledCounter='; - $param .= '&twentyTwenty=true'; - $param .= '&languageID=hun'; - $param .= '&wentToGray=false'; - - $encoded_param = Webform::encode($privatekey, $decodedSession, $param); - - return "https://www.archline.hu/maintenance/webform/startQuery.php?session={$session}¶m={$encoded_param}"; - } - - public function generateTipUrl($isid, $npid, $isTwTw) - { - if ($isTwTw) $isTwTw = 'true'; - - $this->query("SELECT prTypeID FROM `cl_hlusers`.`h_programs` WHERE prPass = ?", array('s', $this->password)); - $program = $this->fetchNext(); - - $ver8and9 = crm_hardlock::GetVer8And9FromPassword($this->password); - $launchYear = crm_hardlock::GetLaunchYearFromVer8And9($ver8and9); - - if ($program['prTypeID'] == 76) // LIVE - $this->query("SELECT pkgid FROM `www_archline_hu`.`version` WHERE ev = ? AND projectid LIKE '%Live' ORDER BY pkgid DESC", array('i', $launchYear)); - else // Prof. - $this->query("SELECT pkgid FROM `www_archline_hu`.`version` WHERE ev = ? AND projectid NOT LIKE '%Live' AND projectid NOT LIKE '%Namirial%' ORDER BY pkgid DESC", array('i', $launchYear)); - - $version = $this->fetchNext(); - $this->installCode = Codegen::GenerateTimeCode($this->password, $isid, 1); - $build = $version['pkgid']; - $ctrID = 36; - $compID = 1793730914; //tipeknel nem hasznalt - $osData = "10.0.18362.1.green.848"; // tekinthetjuk konstansnak - $strCollectedInfo = "#{$this->password}#{$compID}#{$build}#{$ctrID}#{$this->installCode}#{$osData}####{$npid}######0#0#{$isTwTw}"; - - $keyDec = "0052"; - $encoderKey = hexdec($keyDec); - $encoded = $keyDec; - - $strHex = bin2hex($strCollectedInfo); - $hexArray = str_split($strHex, 2); - $arrayKeys = array_keys($hexArray); - $lastArrayKey = array_pop($arrayKeys); - - for ($i = 0; $i < count($hexArray); $i++) { - if ($i % 2 == 0) { - $a = $hexArray[$i]; // "23" - $b = $hexArray[$i + 1]; // "33" - - if ($i == $lastArrayKey) $b = '00'; - - sscanf($a, '%x', $low); - sscanf($b, '%x', $high); - $value = $high * 256 + $low; //0x3323 - $encoded .= sprintf('%04X', $value ^ $encoderKey); - } - } - $encodedSession = base64_encode($encoded); - return "https://www.archlinexp.com/index.php?menu=tips2012&lang=eng&version=0&session={$encodedSession}&launched=test"; - } - - public function launchStartQuery(&$error_string, $verID, $isid, $npid) - { - $arrContextOptions = stream_context_create( - array( - "ssl" => array( - "verify_peer" => false, - "verify_peer_name" => false - ) - ) - ); - - $tip_url = $this->generateStartQueryUrl($isid, $npid); - $result = file_get_contents($tip_url, false, $arrContextOptions); - $result = explode('session', $result); - $result = '?session=' . $result[1]; - - $session = Webform::get_valueFromStringUrl($result, "session"); - $result_ok = Webform::get_valueFromStringUrl($result, "result_ok"); - $decodedSession = base64_decode($session); - $privateKey = Webform::GetWebformPrivateKey(); - $paramAML = Webform::decode($privateKey, $decodedSession, $result_ok); - - $actCode = AML::getAttribute('AC', $paramAML); - $virtualization = AML::getAttribute('VIR', $paramAML) ? 1 : 2; - $tipRegnr = AML::getAttribute('REG', $paramAML); - $utst = time(); - - if ($actCode == '') { - $error_string .= "launchTips(): error: nincs aktivalokod! Serial: " . $this->password; - return false; - } - - if ($actCode != $this->actCode) { - $error_string .= "launchTips(): error: a program aktivalo kodja nem egyezik a tip aktivalokoddal! (Tip: {$actCode} || program: {$this->actCode})"; - return false; - } - - if ($virtualization != $this->hlStat) { - $error_string .= "launchTips(): error: a program letiltas erteke nem az elvart"; - return false; - } - - $timeCode = $this->generateTimeCodeWithInstCode($isid, true); - - if ($timeCode != $actCode && $_SERVER['REMOTE_ADDR'] == '176.241.31.192') { - $error_string .= "launchTips(): error: nem jol legeneralt idokod! (Tips: {$actCode} || helyes: {$timeCode})"; - return false; - } - - if (Codegen::IsSoftwareKey($this->password)) { - if (crm_hardlock::IsRegistrationActive($this->password, $isid, $npid) == false && $tipRegnr == crm_hardlock::Yes($utst, 39)) { - $error_string .= "launchTips(): error: a program fut, de nem kene!"; - return false; - } - - if (crm_hardlock::IsRegistrationActive($this->password, $isid, $npid) && $tipRegnr == crm_hardlock::No($utst, 39)) { - $error_string .= "launchTips(): error: a program nem fut, de futnia kene!"; - return false; - } - } - return true; - } - - public function launchTips(&$error_string, $verID, $isid, $npid, $isTwTw) - { - $arrContextOptions = stream_context_create( - array( - "ssl" => array( - "verify_peer" => false, - "verify_peer_name" => false - ) - ) - ); - - $tip_url = $this->generateTipUrl($isid, $npid, $isTwTw); - $result = file_get_contents($tip_url, false, $arrContextOptions); - if (strstr($result, '') === false || strstr($result, '') === false) { - $error_string .= 'Tip test failed! Not XML returned (probably syntax error)'; - return false; - } - - libxml_set_streams_context($arrContextOptions); - - $xml = simplexml_load_file($tip_url, "SimpleXMLElement", LIBXML_NOCDATA); - $data = json_decode(json_encode($xml), true); - $actCode = $data['actcode']; - $virtualization = $data['Virtualization'] ? 1 : 2; - $tipRegnr = $data['regnr']; - $utst = time(); - - if ($actCode == '') { - $error_string .= "launchTips(): error: nincs aktivalokod!"; - return false; - } - - if ($actCode != $this->actCode) { - $error_string .= "launchTips(): error: a program aktivalo kodja nem egyezik a tip aktivalokoddal! (Tip: {$actCode} || program: {$this->actCode})"; - return false; - } - - if ($virtualization != $this->hlStat) { - $error_string .= "launchTips(): error: a program letiltas erteke nem az elvart"; - return false; - } - - $timeCode = $this->generateTimeCodeWithInstCode($isid, $isTwTw); - - if ($timeCode != $actCode) { - $error_string .= "launchTips(): error: nem jol legeneralt idokod! (Tips: {$actCode} || helyes: {$timeCode})"; - return false; - } - - if (Codegen::IsSoftwareKey($this->password)) { - if (crm_hardlock::IsRegistrationActive($this->password, $isid, $npid) == false && $tipRegnr == crm_hardlock::Yes($utst, 39)) { - $error_string .= "launchTips(): error: a program fut, de nem kene!"; - return false; - } - - if (crm_hardlock::IsRegistrationActive($this->password, $isid, $npid) && $tipRegnr == crm_hardlock::No($utst, 39)) { - $error_string .= "launchTips(): error: a program nem fut, de futnia kene!"; - return false; - } - } - return true; - } - - public function launchTests() - { - $error_string = ''; - $test_result = true; - - for ($i = 0; $test_result && $i < count(self::$programYears); $i++) $test_result = $this->launchRegisterTest($error_string, self::$programYears[$i]); - - if ($test_result) $error_string = "A teszt sikeresen lefutott, hiba nelkul!
{$error_string}"; - - return $error_string; - } -} - -class Authenticate extends Database -{ - private $username; - private $password; - private $authCode; - private $authSession; - - private $users = array(); - - public function __construct() - { - parent::__construct(); - } - - public function setAuthCode($_authCode) - { - $this->authCode = $_authCode; - } - public function setAuthSession($_authSession) - { - $this->authSession = $_authSession; - } - public function setUsername($_username) - { - $this->username = $_username; - } - public function setPassword($_password) - { - $this->password = $_password; - } - - public function setUsers($_users) - { - foreach ($_users as $user) $this->users[$user['username']] = $user['password']; - } - private function checkPassword() - { - return (sha1($this->password) == $this->users[$this->username]); - } - - public function auth() - { - if ($_SERVER['HTTP_HOST'] != 'dev.cadline.hu') return true; - - $sql = "SELECT m.strMail AS username, a.admPass AS password FROM `" . CRMADATBAZIS . "`.`h_admins` a - INNER JOIN `" . CRMADATBAZIS . "`.`managers` m ON m.admID = a.admID"; - $this->query($sql); - $admins = $this->fetchAssoc(); - $this->setUsers($admins); - - $this->setUsername($_SERVER['PHP_AUTH_USER']); - $this->setPassword($_SERVER['PHP_AUTH_PW']); - - if (!$this->validate() && !$this->checkCode()) { - header('WWW-Authenticate: Basic realm="Restricted area"'); - header('HTTP/1.0 401 Unauthorized'); - die("Not authorized"); - } - - return true; - } - - private function checkCode() - { - if ($this->authSession == '' || $this->authCode == '') return false; - - $privateKey = Webform::GetWebformPrivateKey(); - $decoded = base64_decode($this->authCode); - $decoded = Webform::decode($privateKey, $this->authSession, $decoded); - - return (base64_decode($decoded) == date('Y-m-d')); - } - - private function validate() - { - $exist = array_key_exists($this->username, $this->users); - if ($exist && $this->checkPassword()) return true; - else return false; - } -} diff --git a/cadline/backend/common_cadline_libraries/crm_users.class.php b/cadline/backend/common_cadline_libraries/crm_users.class.php deleted file mode 100644 index d2f5b620..00000000 --- a/cadline/backend/common_cadline_libraries/crm_users.class.php +++ /dev/null @@ -1,1253 +0,0 @@ -query($query, array('i', (int)$nUserID)); - $crmUser = Database::getInstance()->fetchNext(); - - if (empty($crmUser) || (int)$crmUser['nUserStatus'] >= (int)$newStatus) return false; - - $tomb = array( - 'nUserID' => (int)$nUserID, - 'val' => (int)$newStatus, - 'changeDate' => date('Y-m-d H:i:s', time()), - 'nManagerID' => _MANAGER_ - ); - - Database::getInstance()->update(CRMADATBAZIS . ".users", array('nUserStatus' => (int)$newStatus), array('nUserID' => (int)$nUserID), 'ii'); - Database::getInstance()->insert(CRMADATBAZIS . ".u_userstatus_history", $tomb, 'iisi'); - - return true; - } - - public static function AddUser($tomb = array(), $newsletter = 1, $bind_type) - { - if (trim($tomb['strName']) == '' || trim($tomb['strEMail']) == '') return 0; - - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`u_emails` WHERE email = ?"; - Database::getInstance()->query($query, array('s', trim(addslashes($tomb['strEMail'])))); - $exist = Database::getInstance()->fetchNext(); - if (!$exist) { // ha nincs a crm-ben user rekordja, akkor létrehozza - if (!isset($tomb['dateInsert'])) { - $tomb['dateInsert'] = time(); - $bind_type .= 'i'; - } - if (!isset($tomb['old_db'])) { - $tomb['old_db'] = (strpos($_SERVER['HTTP_HOST'], ".com") ? 'clusers_eng' : 'clusers'); - $bind_type .= 's'; - } - - $nUserID = Database::getInstance()->insert(CRMADATBAZIS . ".users", $tomb, $bind_type); - - Database::getInstance()->insert( - CRMADATBAZIS . ".u_emails", - array( - 'email' => trim(addslashes($tomb['strEMail'])), - 'nUserID' => $nUserID, - 'newsletter' => $newsletter - ), - 'sii' - ); - } else { - $nUserID = $exist['nUserID']; - } - return $nUserID; - } - - public static function AddUserHistory($tomb = array()) - { - if (!isset($tomb['nUserID']) || !isset($tomb['nTopicID'])) return false; - - //ezeket mindenképpen kitölti (kötelező mezők)) - $rec['nUserID'] = $tomb['nUserID']; - $rec['nTopicID'] = $tomb['nTopicID']; - $rec['dateEvent'] = (isset($tomb['dateEvent']) ? $tomb['dateEvent'] : date('Y-m-d', time())); - $rec['strPlace'] = (isset($tomb['strPlace']) ? $tomb['strPlace'] : "web"); - $rec['strInfo'] = (isset($tomb['strInfo']) ? $tomb['strInfo'] : ''); - $rec['nManagerID'] = (isset($tomb['nManagerID']) ? $tomb['nManagerID'] : 36); - $rec['insertDate'] = date('Y-m-d H:i:s', time()); - $rec['updateDate'] = date('Y-m-d H:i:s', time()); - - $bind_type = 'iisssiss'; - - //ezeket csak akkor tölti ki, ha megkapta az értékét, egyébként NULL - if (isset($tomb['strTime'])) { - $rec['strTime'] = $tomb['strTime']; - $bind_type .= 's'; - } - if (isset($tomb['strAccno'])) { - $rec['strAccno'] = $tomb['strAccno']; - $bind_type .= 's'; - } - if (isset($tomb['datePaydate'])) { - $rec['datePaydate'] = $tomb['datePaydate']; - $bind_type .= 's'; - } - if (isset($tomb['strAccno2'])) { - $rec['strAccno2'] = $tomb['strAccno2']; - $bind_type .= 's'; - } - if (isset($tomb['datePaydate2'])) { - $rec['datePaydate2'] = $tomb['datePaydate2']; - $bind_type .= 's'; - } - if (isset($tomb['bContract'])) { - $rec['bContract'] = $tomb['bContract']; - $bind_type .= 's'; - } - if (isset($tomb['applicationID'])) { - $rec['applicationID'] = $tomb['applicationID']; - $bind_type .= 'i'; - } - - $newID = Database::getInstance()->insert(CRMADATBAZIS . ".u_history", $rec, $bind_type); - - return $newID; - } - - public static function UpdateUserHistory($tomb = array(), $nEventID = 0, $bind_type) - { - if (empty($tomb) || (int)$nEventID == 0) return false; - - $tomb['updateDate'] = date('Y-m-d H:i:s', time()); - $bind_type .= 'si'; - Database::getInstance()->update(CRMADATBAZIS . ".u_history", $tomb, array('nEventID' => $nEventID), $bind_type); - - return true; - } - - public static function GetValidLease($nUserID = 0, $level = 0) - { - $nTopicID = 0; - $lease = false; - - switch ((int)$level) { - case 1: { - $nTopicID = _COURSE_PRICE_PRELIMINARY_; - break; - } - case 2: { - $nTopicID = _COURSE_PRICE_INTERMEDIATE_; - break; - } - } - - if ((int)$nUserID == 0 || (int)$level == 0 || (int)$nTopicID == 0) return false; - - $query = "SELECT *, dateEvent AS validFrom, DATE_ADD(dateEvent, INTERVAL " . _LEASE_VALID_DAYS_ . " DAY) AS validThrough FROM `" . CRMADATBAZIS . "`.`u_history` WHERE nUserID = ? AND nTopicID = ? AND DATE_ADD(dateEvent, INTERVAL " . _LEASE_VALID_DAYS_ . " DAY) >= CURRENT_DATE ORDER BY nEventID DESC"; - Database::getInstance()->query($query, array('ii', (int)$nUserID, (int)$nTopicID)); - $lease = Database::getInstance()->fetchNext(); - return (($lease && count($lease)) ? $lease : false); - } - - public static function levelesemeny($email, $osztaly, $fv, $topicid, $likeegyezes, $ujinfo, $nyelv = "", $hibainfo = "") - { - if (!is_numeric($topicid)) { - Database::getInstance()->insert( - JMLADATBAZIS . '.a_hibak', - array( - 'osztaly' => $osztaly, - 'fv' => $fv, - 'hiba' => "Hibas topic id: {$topicid}", - 'datum' => date('Y-m-d H:i:s', time()) - ), - 'ssss' - ); - return "nincstopic"; - } - - $query = "SELECT nUserID FROM `" . CRMADATBAZIS . "`.`u_emails` WHERE email = ? AND deleted = ?"; - Database::getInstance()->query($query, array('si', $email, 0)); - $user = Database::getInstance()->fetchAssoc(); - - if (count($user)) { - foreach ($user as $row) { - self::levelbeszuras($row['nUserID'], $email, $osztaly, $fv, $topicid, $likeegyezes, $ujinfo, $nyelv, $hibainfo); - } - } - } - - public static function levelbeszuras($nUserID, $email, $osztaly, $fv, $topicid, $likeegyezes, $ujinfo, $nyelv = "", $hibainfo = "") - { - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`u_history` - WHERE dateEvent = ? AND nTopicID = ? AND nUserID = ? AND (strInfo = ? OR strInfo LIKE ?)"; - Database::getInstance()->query($query, array('siiss', date('Y-m-d', time()), $topicid, $nUserID, $likeegyezes, "%{$likeegyezes}%")); - $res = Database::getInstance()->fetchAssoc(); - - if (count($res) == 0) { - self::AddUserHistory(array( - 'nUserID' => $nUserID, - 'nTopicID' => $topicid, - 'strInfo' => $ujinfo - )); - - // nUserStatus atallitasa - self::SetUserStatus($nUserID, 1); - - // esely atallitasa - $user2 = (object)$res[0]; - - if ((int)$user2->nEsely < 2) { - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`hardlock` WHERE hlUser = ? AND SUBSTRING(hlNum, 1, 2) = ? AND hlStat = ?"; - Database::getInstance()->query($query, array('ssi', $nUserID, '36', 1)); - $felhasz = Database::getInstance()->fetchNext(); - - if (empty($felhasz)) { - $query = "SELECT count(nEventID) darab FROM `" . CRMADATBAZIS . "`.`u_history` WHERE nUserID = ?"; - Database::getInstance()->query($query, array('i', $nUserID)); - $res = Database::getInstance()->fetchNext(); - $levelesemenyekszama = (object)$res; - - if ($levelesemenyekszama->darab >= 2) - Database::getInstance()->update(CRMADATBAZIS . ".users", array('nEsely' => 2), array('nUserID' => $nUserID), 'ii'); - elseif ($levelesemenyekszama->darab == 1) - Database::getInstance()->update(CRMADATBAZIS . ".users", array('nEsely' => 1), array('nUserID' => $nUserID), 'ii'); - } - } - } - } - - public static function deleteUser($nUserID) - { - Database::getInstance()->delete(CRMADATBAZIS . ".u_history", array('nUserID' => $nUserID), 'i'); - Database::getInstance()->delete(CRMADATBAZIS . ".u_userstatus_history", array('nUserID' => $nUserID), 'i'); - Database::getInstance()->delete(CRMADATBAZIS . ".u_emails", array('nUserID' => $nUserID), 'i'); - Database::getInstance()->delete(CRMADATBAZIS . ".users", array('nUserID' => $nUserID), 'i'); - } - - public static function getFirstDayEmailTemplate($email) - { - $url_1 = 'https://www.archlinexp.com/maintenance/followedlinks.php?id=' . base64_encode('?email=' . $email . '&alias=trial-first'); - $url_2 = 'https://www.archlinexp.com/maintenance/followedlinks.php?id=' . base64_encode('?email=' . $email . '&alias=trial-first-[2]'); - - $template = array(); - - $template['subject'] = "All the inspiration you need for your ARCHLine.XP project"; - $template['body'] = " - - -
-
-
- -
- -
- -

Ready to start creating your first design?

-
- -

- Let's help you get started as quickly as possible. -
- - But before you jump in... Would you like to find out how you can get more out of ARCHLine.XP while saving yourself dozens of hours in the process. -
- - Check out our courses. -
- - Are you an architect? - ARCHITECTURAL MODELING COURSE -

- - -   - Start Exploring -   - -
-
- -

- Are you an interior designer? - INTERIOR DESIGN COURSE -

- - -   - Start Exploring -   - -
-
- - Unsubscribe -
"; - - return $template; - } - - public static function getThreeDayEmailTemplate($email) - { - $url_1 = 'https://www.archlinexp.com/maintenance/followedlinks.php?id=' . base64_encode('?email=' . $email . '&alias=trial-second'); - $url_2 = 'https://www.archlinexp.com/maintenance/followedlinks.php?id=' . base64_encode('?email=' . $email . '&alias=trial-second-[2]'); - - $template = array(); - - $template['subject'] = "Welcome to the future of your work using ARCHLine.XP"; - $template['body'] = " - - -
-
-
- -
- -
- -

Courses, case studies, tutorials

-
- -

- You've opened the door to the ARCHLine.XP CAD/BIM design software. -
- - Many courses, case studies, tutorials are ready to guide on your next project, from floor plan to stunning visuals. -
- - It's time to start. -
- - Are you an architect? - 12 tips to design walls. -

- - -   - Start Exploring -   - -
-
- -

- Are you an interior designer? - Modern Kitchen Modelling -

- - -   - Start Exploring -   - -
-
- - Unsubscribe -
"; - - return $template; - } - - public static function getSevenDayEmailTemplate($email) - { - $url_1 = 'https://www.archlinexp.com/maintenance/followedlinks.php?id=' . base64_encode('?email=' . $email . '&alias=trial-third'); - $url_2 = 'https://www.archlinexp.com/maintenance/followedlinks.php?id=' . base64_encode('?email=' . $email . '&alias=trial-third-[2]'); - - $template = array(); - - $template['subject'] = "ARCHLine.XP Trial is for trying new things"; - $template['body'] = " - - -
-
-
- -
- -
- -

High-quality documents and presentations

-
- -

- ARCHLine.XP gives you a lot more control over how your project look. -
- - Learn how to document, visualize or take quantity take-off. -
- - Learn quickly the main points. -
- - The Layout tool offers features that allow you to create high-quality documents about your project. -

- - -   - Start Exploring -   - -
-
- -

- Taking a good photo-realistic image is not the same as pressing a button. -
- - Learn how to render in ARCHLine.XP. -

- - -   - Rendering -   - -
-
- - Unsubscribe -
"; - - return $template; - } - - public static function getFourteenDayEmailTemplate($email) - { - $template = array(); - - $template['subject'] = "Trials are for trying new things"; - $template['body'] = "ARCHLine.XP gives you a lot more control over how your project look.

- - Learn how to document, visualize or take quantity take-off.

- - Learn quickly the main points."; - - return $template; - } - - public static function getTwentyoneDayEmailTemplate($email) - { - $template = array(); - - $template['subject'] = "How to Grow Your Business with ARCHLine.XP LIVE"; - $template['body'] = "You already started your journey. Why stop now?

- - Check out what designers like you were interested:
"; - - return $template; - } - - public static function getTwentyfourDayEmailTemplate($email) - { - $template = array(); - - $template['subject'] = "Great news: You've received an offer"; - $template['body'] = "Great ideas deserve to get done. Check out this personal offer, made to help your professional work whatever you'll want later.

- - This is the best offer we have:
- 15% coupon code. Save 15% Off.

- - Coupon ends on 11/30/2021.
- VIEW COUPON"; - - return $template; - } - - public static function getLastEmailTemplate($email) - { - $template = array(); - - $template['subject'] = "Buy now - your trial is about to expire"; - $template['body'] = "Now your trial is about to expire, consider converting to perpetual license.

- - Trial version shows the number of days before expires.

- - You cannot extend the trial period, but you can still use your software after purchase.

- - This is the best offer we have:
- 15% coupon code. Save 15% Off.

- - Coupon ends on 11/30/2021.
- VIEW COUPON"; - - return $template; - } -} - -class Login extends Database -{ - private $username; - private $password; - private $salt = "\c1afgWsv\$FdxMDd=ImjOl%vxp\$ecFw%"; - - public function __construct($username, $password) - { - parent::__construct(); - - unset($this->username); - unset($this->password); - - $this->username = $username; - $this->password = $password; - } - - public function getUsername() - { - return $this->username; - } - private function getSaltedPassword() - { - return hash_hmac("sha512", $this->password, $this->salt); - } - - public function setPassword($password) - { - $this->password = $password; - } - public function hashSha512() - { - return password_hash($this->getSaltedPassword(), PASSWORD_DEFAULT); - } - - public function verifyPassword() - { - $query = "SELECT id, username, password FROM `" . CRMADATBAZIS . "`.`schools` WHERE username = ? LIMIT 1"; - $this->query($query, array('s', $this->username)); - - $school = $this->fetchNext(); - $password = $school["password"]; - return password_verify($this->getSaltedPassword(), $password); - } -} - -class Course -{ - public static function getCourseByUrl($url) - { - $query = "SELECT * FROM `" . JMLADATBAZIS . "`.`aleducation_courses` WHERE url = ?"; - Database::getInstance()->query($query, array('s', $url)); - - return Database::getInstance()->fetchNext(); - } - - public static function getApplicationPercentage($courseId, $userId) - { - $query = "SELECT * FROM www_archline_hu.aleducation_applications WHERE user_id = {$userId} AND course_id = {$courseId}"; - Database::getInstance()->query($query, array('ii', $userId, $courseId)); - - $result = Database::getInstance()->fetchNext(); - - return empty($result) ? 0 : $result['percentage']; - } - - public static function getCourseApplication($courseId, $userId) - { - $query = "SELECT * FROM `" . JMLADATBAZIS . "`.`aleducation_applications` WHERE user_id = ? AND course_id = ?"; - Database::getInstance()->query($query, array('ii', $userId, $courseId)); - - return Database::getInstance()->fetchNext(); - } - - public static function getCourses($id) - { - $response = array(); - - $query = "SELECT * FROM `" . JMLADATBAZIS . "`.`aleducation_courses` WHERE id = ?"; - Database::getInstance()->query($query, array('i', $id)); - - $course = Database::getInstance()->fetchNext(); - - $response['title'] = $course['title']; - $response['lessons'] = json_decode($course['lessons'])->courses; - - return $response; - } - - public static function get_string_between($string, $start, $end) - { - $string = ' ' . $string; - $ini = strpos($string, $start); - if ($ini == 0) return ''; - $ini += strlen($start); - $len = strpos($string, $end, $ini) - $ini; - return substr($string, $ini, $len); - } -} - -class Event extends Database -{ - private $event; - - public function __construct($event) - { - parent::__construct(); - - unset($this->event); - - $this->event = $event; - - if (isset($this->event->evt_id)) { - $this->setEventDatas(); - $this->setYoutubeLink(); - } - } - - private function setEventDatas() - { - $query = "SELECT alias, title, startdate AS eventStart, enddate AS eventEnd FROM `" . JMLADATBAZIS . "`.`eng_icagenda_events` WHERE id = ? LIMIT 1"; - $this->query($query, array('i', $this->event->evt_id)); - $event = $this->fetchNext(); - - $this->event->title = $event['title']; - $this->event->url = 'https://' . $_SERVER['SERVER_NAME'] . '/' . $this->event->evt_id . '-' . $event['alias']; - $this->event->eventStart = $event['eventStart']; - $this->event->eventEnd = $event['eventEnd']; - } - - private function setReminderEvent() - { - $evtDate = new DateTime($this->event->date); - $evtDate->modify('+30 min'); - $evtBegin = $evtDate->format('Y-m-d H:i') . ':00'; - - $query = "SELECT id, title, startdate AS eventStart, enddate AS eventEnd FROM `" . JMLADATBAZIS . "`.`eng_icagenda_events` WHERE startdate = ? LIMIT 1"; - $this->query($query, array('s', $evtBegin)); - $event = $this->fetchNext(); - - $this->event->title = $event['title']; - $this->event->eventStart = $event['eventStart']; - $this->event->eventEnd = $event['eventEnd']; - $this->event->evt_id = $event['id']; - } - - private function setYoutubeLink() - { - $query = "SELECT value FROM `" . JMLADATBAZIS . "`.`eng_icagenda_customfields_data` WHERE parent_id = ? AND slug = ? LIMIT 1"; - $this->query($query, array('is', $this->event->evt_id, 'video_url')); - $details = $this->fetchNext(); - - $videoID = substr($details['value'], strpos($details['value'], "embed/") + 6); - - $this->event->youtubeLink = 'https://www.youtube.com/watch?v=' . $videoID; - } - - public function getYoutubeLink() - { - return $this->event->youtubeLink; - } - - private function getExpoUsers() - { - $query = "SELECT email FROM cl_hlusers.expo_users WHERE event_id = ? GROUP BY email"; - $this->query($query, array('i', $this->event->evt_id)); - return $this->fetchAssoc(); - } - - public function sendEventReminder($mailconfig) - { - $this->setReminderEvent(); - - if ($this->event->title == null) - return false; - - $this->setYoutubeLink(); - - $expoUsers = $this->getExpoUsers(); - - $premiereDate = new DateTime($this->event->eventStart); - $premiere = $premiereDate->format('Y-m-d H:i:s'); - - $endDate = new DateTime($this->event->eventEnd); - $end = $endDate->format('Y-m-d H:i:s'); - - $date = str_replace(' ', 'T', $premiere); - $date = str_replace('-', '', $date); - $date = str_replace(':', '', $date); - - $endDate = str_replace(' ', 'T', $end); - $endDate = str_replace('-', '', $endDate); - $endDate = str_replace(':', '', $endDate); - - $details = "Watch it here: +%3Ca+href%3D%27++++++++++++{$this->event->youtubeLink}++++++++++++%27%3E++++++++++++{$this->event->youtubeLink}++++++++++++%3C/a%3E"; - $details = str_replace(" ", "+", $details); - $googleTitle = str_replace(" ", "+", $this->event->title); - - $url = "https://www.google.com/calendar/event?action=TEMPLATE"; - $urlPart = "&location=online&text=$googleTitle&dates=$date/$endDate&ctz=Europe/Budapest&details=$details"; - $urlPart = htmlentities($urlPart); - $url .= $urlPart; - - foreach ($expoUsers as $expoUser) { - $body = "Hello,

- - You are receiving this email because you have signed up for the ARCHLine.XP Virtual Expo presentation below.

- - Title: {$this->event->title}

- - Premiere: {$premiere} (GMT+02:00)

- - Add to Google Calendar

- - Watch it here: {$this->event->youtubeLink}

- - What you will need:
- You will need sound enabled on your computer, and a YouTube/Gmail account if you want to comment during the show. Commenting is not obligatory, but it greatly improves the quality and relevance of the webinar, so make sure you ask your questions before or during the talk. -

- - Please note: The webinar will be recorded, and it will later be added to our archive shows. By joining the webinar you agree that your contribution (comments) will be visible on the video. -

- - Should you have any questions, email us at info@archlinexp.com.

- - Follow us on Instagram, Facebook, LinkedIn and YouTube! -

- - We are looking forward to seeing you at the show!

- - Best Wishes:
- The CadLine Team"; - - $mail = new PHPMailer(); - $mail->CharSet = 'UTF-8'; - $mail->Host = $mailconfig['Host']; - $mail->SMTPAuth = true; - - $mail->Username = $mailconfig['Username']; - $mail->Password = $mailconfig['Password']; - - $mail->From = 'info@archlinexp.com'; - $mail->FromName = 'info@archlinexp.com'; - $mail->AddAddress($expoUser['email'], $expoUser['email']); - - $mail->IsHTML(true); - - $mail->Subject = $this->event->subject; - $mail->Body = $body; - $mail->Send(); - } - - return true; - } - - private function sendEmail() - { - define('_JEXEC', 1); - define('JPATH_BASE', $_SERVER['DOCUMENT_ROOT']); - - require_once($_SERVER['DOCUMENT_ROOT'] . '/maintenance/libraries/phpmailer/PHPMailerAutoload.php'); - require_once($_SERVER['DOCUMENT_ROOT'] . '/maintenance/config.mail.php'); - require_once(JPATH_BASE . '/includes/defines.php'); - require_once(JPATH_BASE . '/includes/framework.php'); - - $mainframe = JFactory::getApplication('site'); - $mainframe->initialise(); - - $lang = JFactory::getLanguage(); - - $lang->load('com_icagenda', JPATH_BASE); - - $timeZone = 'GMT'; - - $googleCalendar = $this->createGoogleCalendarLink(); - - if (isset($this->event->zone)) { - $sign = ''; - $offset = substr($this->event->zone, 0, strpos($this->event->zone, "_")); - $offset = $offset + 2; - $offset = str_replace('.', ':', $offset); - - if (substr($offset, 0, 1) != '-') $sign = '+'; - if (substr($offset, 0, 2) != ':') $offset .= ':00'; - - $timeZone .= $sign . $offset; - } else { - $timeZone .= '+2:00'; - } - - $sitename = ''; - $subject = JText::_('COM_ICAGENDA_REGISTRATION_EMAIL_USER_DATE_DEFAULT_SUBJECT'); - $body = JText::_('COM_ICAGENDA_REGISTRATION_EMAIL_USER_NEW'); - $adminbody = JText::_('COM_ICAGENDA_REGISTRATION_EMAIL_ADMIN_NEW'); - $adminsubject = 'Event registration'; - $link = "" . $this->event->url . ""; - - $replacements = array( - '[SITENAME]' => $sitename, - '[LINK]' => $link, - '[TITLE]' => $this->event->title, - '[DATE]' => $this->event->date . " ($timeZone)", - '[EMAIL]' => $this->event->userEmail, - '[COUNTRY]' => $this->event->ctrName, - '[NAME]' => $this->event->userName, - '[GOOGLE_CAL]' => $googleCalendar, - '[RERUN]' => $this->event->rerun . " ($timeZone)" - ); - - foreach ($replacements as $key => $value) { - $subject = str_replace($key, $value, $subject); - $body = str_replace($key, $value, $body); - $adminbody = str_replace($key, $value, $adminbody); - } - - $mail = new PHPMailer(); - $mail->CharSet = 'UTF-8'; - $mail->Host = $mailconfig['Host']; - $mail->SMTPAuth = true; - - $mail->Username = $mailconfig['Username']; - $mail->Password = $mailconfig['Password']; - - $mail->From = 'info@archlinexp.com'; - $mail->FromName = 'www.archlinexp.com'; - $mail->AddAddress($this->event->userEmail, $this->event->userName); - - $mail->IsHTML(true); - - $mail->Subject = $subject; - $mail->Body = $body; - - $adminMail = new PHPMailer(); - $adminMail->CharSet = 'UTF-8'; - $adminMail->Host = $mailconfig['Host']; - $adminMail->SMTPAuth = true; - - $adminMail->Username = $mailconfig['Username']; - $adminMail->Password = $mailconfig['Password']; - - $adminMail->From = 'info@archlinexp.com'; - $adminMail->FromName = 'www.archlinexp.com'; - $adminMail->AddAddress('marketing@cadline.hu'); - - $adminMail->IsHTML(true); - - $adminMail->Subject = $adminsubject; - $adminMail->Body = $adminbody; - $adminMail->Send(); - - /*$sql = "SELECT * FROM `".CRMADATBAZIS."`.`partners` WHERE ctrID = ?"; - $this->query($sql, array('i', $this->event->ctrID)); - $partner = $this->fetchNext(); - - if (!empty($partner)) { - $partnerMailer = new PHPMailer(); - $partnerMailer->CharSet = 'UTF-8'; - $partnerMailer->Host = $mailconfig['Host']; - $partnerMailer->SMTPAuth = true; - - $partnerMailer->Username = $mailconfig['Username']; - $partnerMailer->Password = $mailconfig['Password']; - - $partnerMailer->From = 'info@archlinexp.com'; - $partnerMailer->FromName = 'www.archlinexp.com'; - $partnerMailer->AddAddress($partner['email']); - - $partnerMailer->IsHTML(true); - - $partnerMailer->Subject = $adminsubject; - $partnerMailer->Body = $adminbody; - $partnerMailer->Send(); - }*/ - - if ($mail->Send()) - return true; - else - return false; - } - - public function createGoogleCalendarLink() - { - $startdate = new DateTime($this->event->date); - $startdate = $startdate->format(DateTime::ATOM); - $startdate = str_replace('-', '', $startdate); - $startdate = str_replace(':', '', $startdate); - $startdate = substr($startdate, 0, strpos($startdate, "+")); - - $enddate = new DateTime($this->event->endDate); - $enddate = $enddate->format(DateTime::ATOM); - $enddate = str_replace('-', '', $enddate); - $enddate = str_replace(':', '', $enddate); - $enddate = substr($enddate, 0, strpos($enddate, "+")); - - $details = "Watch it here: " . $this->event->url . ""; - $details = str_replace(" ", "+", $details); - $title = str_replace(" ", "+", $this->event->title); - - $url = "https://www.google.com/calendar/event?action=TEMPLATE"; - $urlPart = "&location=online&text=$title&dates=$startdate/$enddate&details=$details"; - $urlPart = htmlentities($urlPart); - $url .= $urlPart; - - return $url; - } - - public function registration() - { - $sql = "SELECT * FROM `" . CRMADATBAZIS . "`.`expo_users` WHERE email = ? AND event_id = ?"; - $this->query($sql, array('si', $this->event->userEmail, $this->event->evt_id)); - $user = $this->fetchNext(); - - $country = explode('_', $this->event->cntry); - $this->event->ctrID = $country[0]; - $this->event->ctrName = $country[1]; - - if (empty($user)) { - $expoUser = array( - 'email' => $this->event->userEmail, - 'country' => $this->event->ctrName, - 'reg_date' => date('Y-m-d'), - 'event_id' => $this->event->evt_id - ); - - $this->insert(CRMADATBAZIS . ".expo_users", $expoUser, 'sssi'); - } - - $sqlEmail = "SELECT * FROM `" . CRMADATBAZIS . "`.`u_emails` WHERE email = ?"; - $this->query($sqlEmail, array('s', $this->event->userEmail)); - $exist = $this->fetchNext(); - - $expoTopic = $this->event->evt_id == '104' ? 333 : 387; - - if (empty($exist)) { - $crm_user = array( - 'strName' => $this->event->userName, - 'strEmail' => $this->event->userEmail, - 'nUserProf' => 0, - 'nCtrID' => $this->event->ctrID, - 'dateInsert' => time(), - 'old_db' => 'clusers_eng' - ); - $nUserID = $this->insert(CRMADATBAZIS . ".users", $crm_user, 'ssiiis'); - - $u_email = array( - 'email' => $this->event->userEmail, - 'nUserID' => $nUserID, - 'default' => 1, - 'active' => 1, - 'deleted' => 0, - 'newsletter' => 1 - ); - $this->insert(CRMADATBAZIS . ".u_emails", $u_email, 'siiiii'); - } else { - $nUserID = $exist['nUserID']; - - $sqlUser = "SELECT old_db FROM `" . CRMADATBAZIS . "`.`users` WHERE nUserID = ?"; - $this->query($sqlUser, array('i', $nUserID)); - $crmUser = $this->fetchNext(); - - if ($this->event->evt_id == '104') - $expoTopic = 333; - else - $expoTopic = $crmUser['old_db'] == 'clusers' ? 391 : 387; - } - - $sqlHistory = "SELECT * FROM `" . CRMADATBAZIS . "`.`u_history` WHERE nUserID = ? AND nTopicID = ? AND strInfo = ?"; - $this->query($sqlHistory, array('iis', $nUserID, $expoTopic, $this->event->title)); - $u_history = $this->fetchNext(); - - if (empty($u_history)) { - $history = array( - 'nUserID' => $nUserID, - 'nTopicID' => $expoTopic, - 'strPlace' => 'online', - 'strInfo' => $this->event->title, - 'nManagerID' => 36, - 'insertDate' => date('Y-m-d H:i:s'), - 'dateEvent' => $this->event->date - ); - $this->insert(CRMADATBAZIS . ".u_history", $history, 'iississ'); - } - - return $this->sendEmail(); - } - - public function registerToWinLIVE() - { - $sql = "SELECT * FROM `" . CRMADATBAZIS . "`.`live_prize` WHERE email = ?"; - $this->query($sql, array('s', $this->event->userEmail)); - $user = $this->fetchNext(); - - $country = explode('_', $this->event->cntry); - $this->event->ctrID = $country[0]; - $this->event->ctrName = $country[1]; - - if (!empty($user)) - return false; - - $live_prize = array( - 'email' => $this->event->userEmail, - 'name' => $this->event->userName, - 'reg_date' => date('Y-m-d'), - 'country' => $this->event->ctrName - ); - - $this->insert(CRMADATBAZIS . ".live_prize", $live_prize, 'ssss'); - - $sqlEmail = "SELECT * FROM `" . CRMADATBAZIS . "`.`u_emails` WHERE email = ?"; - $this->query($sqlEmail, array('s', $this->event->userEmail)); - $u_email = $this->fetchNext(); - - if (!empty($u_email)) { - $history = array( - 'nUserID' => $u_email['nUserID'], - 'nTopicID' => 388, - 'strPlace' => 'online', - 'strInfo' => 'LIVE nyereményjátékra jelentkezett', - 'nManagerID' => 36, - 'insertDate' => date('Y-m-d H:i:s'), - 'dateEvent' => date('Y-m-d') - ); - - $sqlHistory = "SELECT * FROM `" . CRMADATBAZIS . "`.`u_history` WHERE nUserID = ? AND nTopicID = ?"; - $this->query($sqlHistory, array('ii', $u_email['nUserID'], 388)); - $u_history = $this->fetchNext(); - - if (empty($u_history)) - $this->insert(CRMADATBAZIS . ".u_history", $history, 'iississ'); - } - - return $this->sendLiveEmail(); - } - - private function sendLiveEmail() - { - define('_JEXEC', 1); - define('JPATH_BASE', $_SERVER['DOCUMENT_ROOT']); - - require_once($_SERVER['DOCUMENT_ROOT'] . '/maintenance/libraries/phpmailer/PHPMailerAutoload.php'); - require_once($_SERVER['DOCUMENT_ROOT'] . '/maintenance/config.mail.php'); - require_once(JPATH_BASE . '/includes/defines.php'); - require_once(JPATH_BASE . '/includes/framework.php'); - - $mainframe = JFactory::getApplication('site'); - $mainframe->initialise(); - - $lang = JFactory::getLanguage(); - - $lang->load('com_icagenda', JPATH_BASE); - - $subject = 'Win ARCHLine.XP LIVE License - Signup Confirmed!'; - $body = JText::_('COM_ICAGENDA_WIN_AL_LIVE'); - - $replacements = array( - '[NAME]' => $this->event->userName - ); - - foreach ($replacements as $key => $value) { - $body = str_replace($key, $value, $body); - } - - $mail = new PHPMailer(); - $mail->CharSet = 'UTF-8'; - $mail->Host = $mailconfig['Host']; - $mail->SMTPAuth = true; - - $mail->Username = $mailconfig['Username']; - $mail->Password = $mailconfig['Password']; - - $mail->From = 'info@archlinexp.com'; - $mail->FromName = 'www.archlinexp.com'; - $mail->AddAddress($this->event->userEmail, $this->event->userName); - - $mail->IsHTML(true); - - $mail->Subject = $subject; - $mail->Body = $body; - - - $adminMail = new PHPMailer(); - $adminMail->CharSet = 'UTF-8'; - $adminMail->Host = $mailconfig['Host']; - $adminMail->SMTPAuth = true; - - $adminMail->Username = $mailconfig['Username']; - $adminMail->Password = $mailconfig['Password']; - - $adminMail->From = 'info@archlinexp.com'; - $adminMail->FromName = 'www.archlinexp.com'; - $adminMail->AddAddress('ztoth@cadline.hu', 'Zoltan Toth'); - - $adminMail->IsHTML(true); - - $adminMail->Subject = 'Virtual Expo - LIVE Registration'; - $adminMail->Body = "Name: {$this->event->userName} -
- - Email: {$this->event->userEmail} -
- - Country: {$this->event->ctrName}"; - - $adminMail->Send(); - - if ($mail->Send()) - return true; - else - return false; - } - - /* --------------- WORKSHOP --------------- */ - - public function registrationToWebinar() - { - $this->setWebinar(); - - $this->event->nUserID = $this->getUserID(); - - $query = "SELECT * FROM www_archline_hu.alworkshops_application - WHERE course_id = ? AND email = ? AND published = ?"; - - $this->query($query, array('iss', $this->event->course_id, $this->event->userEmail, 'Y')); - $exist = $this->fetchNext(); - - if (empty($exist)) { - $topicID = $this->event->crm_db == 'clusers' ? 336 : 333; - - $history = array( - 'nUserID' => $this->event->nUserID, - 'nTopicID' => $topicID, - 'dateEvent' => $this->event->workshop['start_date'], - 'strPlace' => $this->event->workshop['title'], - 'strInfo' => $this->event->workshop['course_name'], - 'nManagerID' => 36, - 'insertDate' => date('Y-m-d H:i:s', time()) - ); - - $this->insert(CRMADATBAZIS . ".u_history", $history, 'iisssis'); - - $this->createWorkshopApplication(); - $this->sendWorkshopEmail(); - - return true; - } else { - return false; - } - } - - private function sendWorkshopEmail() - { - require_once($_SERVER['DOCUMENT_ROOT'] . '/maintenance/libraries/phpmailer/PHPMailerAutoload.php'); - require_once($_SERVER['DOCUMENT_ROOT'] . '/maintenance/config.mail.php'); - - $template = $this->getEmailTemplate(); - $body = $template['introtext'] . $template['fulltext']; - $title = $template['title']; - - $replacements = array( - '{NAME}' => $this->event->userName, - '{TITLE}' => $this->event->workshop['title'], - '{START_DATE}' => $this->event->workshop['start_date'], - '{START_TIME}' => $this->event->workshop['start_time'], - '{FINISH_DATE}' => $this->event->workshop['finish_date'], - '{FINISH_TIME}' => $this->event->workshop['finish_time'], - '{LOCATION}' => $this->event->workshop['location'], - '{ATTENDEES}' => 0, - '{PRICE}' => $this->event->workshop['price'], - '{PRICE_TOTAL}' => 0, - '{VAT}' => $this->event->workshop['vat'] - ); - - foreach ($replacements as $key => $value) { - $body = str_replace($key, $value, $body); - } - - $mail = new PHPMailer; - $mail->isSMTP(); - $mail->CharSet = 'UTF-8'; - $mail->Host = $mailconfig['Host']; - $mail->SMTPAuth = true; - $mail->Username = $mailconfig['Username']; - $mail->Password = $mailconfig['Password']; - $mail->SMTPSecure = $mailconfig['SMTPSecure']; - $mail->Port = $mailconfig['Port']; - $mail->Subject = $title; - $mail->AltBody = strip_tags($body); - $mail->isHTML(TRUE); - $mail->setFrom($mailconfig['from_hu']); - $mail->addAddress($this->event->userEmail); - //$mail->addBCC('marketing@cadline.hu'); - $mail->msgHTML($body); - - if ($mail->send()) { - unset($mail); - - return true; - } else { - return false; - } - } - - private function getEmailTemplate() - { - $table = $this->event->crm_db == 'clusers' ? 'jml_content' : 'eng_content'; - - $query = "SELECT * FROM www_archline_hu.{$table} WHERE id = ?"; - $this->query($query, array('i', $this->event->workshop['email_template'])); - - return $this->fetchNext(); - } - - public function setWebinar() - { - $sql = "SELECT * FROM www_archline_hu.alworkshops_courses WHERE id = ?"; - $this->query($sql, array('i', $this->event->course_id)); - $workshop = $this->fetchNext(); - - $this->event->workshop = $workshop; - } - - private function getUserID() - { - $sql = "SELECT nUserID FROM cl_hlusers.u_emails WHERE email = ?"; - $this->query($sql, array('s', $this->event->userEmail)); - $exist = $this->fetchNext(); - - if (!$exist) { - if ($this->event->userName > '' && $this->event->userEmail > '') { - $user = array( - 'strName' => $this->event->userName, - 'strEmail' => $this->event->userEmail, - 'nUserProf' => 0, - 'nCtrID' => $this->event->cntry, - 'dateInsert' => time(), - 'old_db' => $this->event->crm_db - ); - $nUserID = $this->insert(CRMADATBAZIS . ".users", $user, 'ssiiis'); - - $u_email = array( - 'email' => $this->event->userEmail, - 'nUserID' => $nUserID, - 'default' => 1, - 'active' => 1, - 'deleted' => 0, - 'newsletter' => 1 - ); - $this->insert(CRMADATBAZIS . ".u_emails", $u_email, 'siiiii'); - } - } else { - $nUserID = $exist['nUserID']; - } - - return $nUserID; - } - - public function createWorkshopApplication() - { - $application = array( - 'course_id' => $this->event->course_id, - 'user_id' => 0, - 'attendees' => 1, - 'price_per_attendee' => 0, - 'price_total' => 0, - 'price_vat' => 0, - 'gepet_kerek' => 'N', - 'berletem_van' => 'N', - 'date' => date('Y-m-d H:i:s', time()), - 'name' => $this->event->userName, - 'email' => $this->event->userEmail - ); - - $this->insert('www_archline_hu.alworkshops_application', $application, 'iiiiiisssss'); - } - - public function getEvent() - { - return $this->event; - } -} diff --git a/cadline/backend/maintenance b/cadline/backend/maintenance new file mode 160000 index 00000000..11f1a543 --- /dev/null +++ b/cadline/backend/maintenance @@ -0,0 +1 @@ +Subproject commit 11f1a543340bb7a2f03c3647dca03b7bd79783d0 diff --git a/cadline/backend/maintenance/.gitignore b/cadline/backend/maintenance/.gitignore deleted file mode 100644 index eb94ca37..00000000 --- a/cadline/backend/maintenance/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -serverAlive.txt -activateServer.txt -webform/airender -tests/images -serverAliveSecondary.txt \ No newline at end of file diff --git a/cadline/backend/maintenance/.htaccess b/cadline/backend/maintenance/.htaccess deleted file mode 100644 index 4b05f929..00000000 --- a/cadline/backend/maintenance/.htaccess +++ /dev/null @@ -1,183 +0,0 @@ -## -# @package Joomla -# @copyright Copyright (C) 2005 - 2014 Open Source Matters. All rights reserved. -# @license GNU General Public License version 2 or later; see LICENSE.txt -## - -## -# READ THIS COMPLETELY IF YOU CHOOSE TO USE THIS FILE! -# -# The line just below this section: 'Options +FollowSymLinks' may cause problems -# with some server configurations. It is required for use of mod_rewrite, but may already -# be set by your server administrator in a way that dissallows changing it in -# your .htaccess file. If using it causes your server to error out, comment it out (add # to -# beginning of line), reload your site in your browser and test your sef url's. If they work, -# it has been set by your server administrator and you do not need it set here. -## - -## Can be commented out if causes errors, see notes above. -Options +FollowSymLinks - -## Mod_rewrite in use. - -RewriteEngine On - -RewriteCond %{HTTP_HOST} ^archlinexp.co.uk$ [OR] -RewriteCond %{HTTP_HOST} ^www.archlinexp.co.uk$ -rewriterule (.*) http://www.archlinexp.com/ [r=301,nc,l] - -RewriteCond %{QUERY_STRING} ^menu=tips(.*)&lang=(.*)&version=(.*)&session=(.*)$ -RewriteRule ^index\.php$ /maintenance/tips\.php?lang=%2&version=%3&session=%4 [NC,R=302,L] - -RewriteCond %{QUERY_STRING} ^menu=activate_90_days_active&lang=(.*)&ser=(.*)&pwd=(.*)$ -RewriteRule ^index\.php$ /maintenance/activate_90_days_active\.php?ser=%2&pwd=%3 [NC,R=302,L] - -RewriteCond %{QUERY_STRING} ^option=com_project&view=category&template=category$ -RewriteRule ^index\.php$ http://www.archlinexp.com/index.php?option=com_project&view=category&template=category&lang=hun [NC,R=301,L] -rewriterule ^collection/category_archlinexp/Hun$ http://www.archlinexp.com/index.php?option=com_project&view=category&template=category&lang=hun [NC,r=301,l] -rewriterule ^collection/category_archlinexp/(.*)$ http://www.archlinexp.com/index.php?option=com_project&view=category&template=category&lang=eng [NC,r=301,l] - -rewriterule ^collection/upload/(.*)/(.*)/(.*)$ /index.php?option=com_showroom&view=upload&template=blankframe&file=$1&type=$2&lang=$3 [r=302,nc,l] -rewriterule ^collection/uploadgroup/(.*)/(.*)/(.*)$ /index.php?option=com_showroom&view=uploadgroup&template=blankframe&file=$1&type=$2&lang=$3 [r=302,nc,l] - -rewriterule ^version/warehousedownloadlink/(.*)/(.*)$ /maintenance/warehousedownloadlink.php?link=$1&archlineversion=$2 [nc,l] -rewriterule ^version/warehousedownloadlink/(.*)$ /maintenance/warehousedownloadlink.php?link=$1 [nc,l] -rewriterule ^version/warehouseparsesource/$ /maintenance/warehouseparsesource.php [nc,l] -rewriterule ^version/warehousegetfileformat/(.*)/(.*)$ /maintenance/warehousegetfileformat.php?link=$1&archlineversion=$2 [nc,l] - -rewriterule ^version/geopluginlink/$ /maintenance/geopluginlink.php [nc,l] - -rewriterule ^edit-user-details(.*)$ index.php?option=com_users&view=profile&layout=edit [nc,l] -rewriterule ^public/tcexam/(.*)$ http://tcexam.archline.hu/ [r=301,nc,l] - -rewriterule ^download/(.*)/(.*)/index_CSH.htm(.*)$ /public/downloads/$1/$2/index_CSH.htm$3 [r=301,nc,l] - -RewriteCond %{HTTP_HOST} ^www.archlinexp.com$ -rewriterule ^rss$ /news/feed/rss [r=302,nc,l] - -RewriteCond %{HTTP_HOST} ^www.archlinexp.com$ -rewriterule ^school/(.*)$ /iskolak/$1 [nc,l] -rewriterule ^pro_live_bundle /maintenance/pro_live_bundle.php [nc,l] - -rewriterule ^hu/collection2/index/(.*)/(.*)$ /index.php?option=com_showroom&template=blankframe&lang=hun&ver=$2 [r=301,nc,l] -rewriterule ^en/collection2/index/(.*)/(.*)$ /index.php?option=com_showroom&template=blankframe&lang=eng&ver=$2 [r=301,nc,l] -rewriterule ^es/collection2/index/(.*)/(.*)$ /index.php?option=com_showroom&template=blankframe&lang=eng&ver=$2 [r=301,nc,l] -rewriterule ^it/collection2/index/(.*)/(.*)$ /index.php?option=com_showroom&template=blankframe&lang=eng&ver=$2 [r=301,nc,l] -rewriterule ^de/collection2/index/(.*)/(.*)$ /index.php?option=com_showroom&template=blankframe&lang=eng&ver=$2 [r=301,nc,l] -rewriterule ^collection2/index/hun/(.*)$ /index.php?option=com_showroom&template=blankframe&lang=hun&ver=$1 [r=301,nc,l] -rewriterule ^collection2/index/(.*)/(.*)$ /index.php?option=com_showroom&template=blankframe&lang=eng&ver=$2 [r=301,nc,l] - -RewriteCond %{HTTP_HOST} ^www.archlinexp.com$ -rewriterule ^collection2$ /index.php?option=com_showroom&template=blankframe&lang=eng&ver=29 [r=301,nc,l] -RewriteRule ^enrollments/courses/([^/]*)/?([^/]*)?/?([^/]*)?$ /beiratkozas/tanfolyamok.php?url=$1&id=$2&lesson=$3 [nc,l] - -RewriteCond %{HTTP_HOST} ^www.archline.hu$ -rewriterule ^collection2$ /index.php?option=com_showroom&template=blankframe&lang=hun&ver=29 [r=301,nc,l] -RewriteRule ^beiratkozas/tanfolyamok/([^/]*)/?([^/]*)?/?([^/]*)?$ /beiratkozas/tanfolyamok.php?url=$1&id=$2&lesson=$3 [nc,l] - -rewriterule ^projects/supportupload/(.*)/(.*)$ /maintenance/supportupload.php?sn=$1&guid=$2 [nc,l] -rewriterule ^crash/(.*)/(.*)/(.*)/(.*)$ /maintenance/crash.php?guid=$1&build=$2&lang=$3&serial=$4 [nc,l] -rewriterule ^crash/(.*)/(.*)/(.*)$ /maintenance/crash.php?guid=$1&build=$2&lang=$3 [nc,l] -rewriterule ^crash/(.*)/(.*)$ /maintenance/crash.php?guid=$1&build=$2 [nc,l] -rewriterule ^crash/(.*)$ /maintenance/crash.php?guid=$1 [nc,l] -rewriterule ^version/regisztracio/(.*)/(.*)/(.*)$ /maintenance/regisztracio.php?serial=$1&isid=$2&kod=$3 [nc,l] -rewriterule ^version/regisztracio/(.*)/(.*)$ /maintenance/regisztracio.php?serial=$1&isid=$2 [nc,l] -rewriterule ^version/unregister/(.*)/(.*)$ /maintenance/unregister.php?serial=$1&isid=$2 [nc,l] -rewriterule ^version/aktivalasikod/(.*)/(.*)/(.*)$ /maintenance/aktivalasikod.php?serial=$1&isid=$2&kod=$3 [nc,l] -rewriterule ^version/update/(.*)/(.*)/(.*)$ /maintenance/update.php?projectid=$1&pkgid=$2&serial=$3 [nc,l] -rewriterule ^version/elofizkarbxml/(.*)/(.*)$ /maintenance/elofizkarbxml.php?file=$1&lang=$2 [nc,l] -rewriterule ^version/elofizkarbxml/(.*)$ /maintenance/elofizkarbxml.php?file=$1 [nc,l] -rewriterule ^version/updatexml$ /maintenance/updatexml.php [nc,l] -rewriterule ^version/getserialanddaycode/(.*)/(.*)/(.*)/(.*)$ /maintenance/getserialanddaycode.php?serial=$1&ver=$2&isid=$3&npid=$4 [nc,l] -rewriterule ^cron/startchangedhardlock$ /maintenance/startchangedhardlock.php [nc,l] -rewriterule ^cron/hibasprograminditasok$ /maintenance/hibasprograminditasok.php [nc,l] -rewriterule ^cron/elofizurites$ /maintenance/elofizurites.php [nc,l] -rewriterule ^cron/elofizexcelcheck$ /maintenance/elofizexcelcheck.php [nc,l] -rewriterule ^other/viewerlejartaktorlese$ /maintenance/viewerlejartaktorlese.php [nc,l] -rewriterule ^unsubscribe/(.*)$ /maintenance/leiratkozas.php?email=$1 [nc,l] -rewriterule ^leiratkozas/(.*)$ /maintenance/leiratkozas.php?email=$1 [nc,l] -rewriterule ^events/newclick/(.*)/(.*) /maintenance/newclick.php?alias=$1&email=$2 [nc,qsa,l] -rewriterule ^crashadmin$ /maintenance/crashadmin.php [nc,l] -rewriterule ^crashadmin/(.*)$ /maintenance/crashadmin.php?guid=$1 [nc,l] - -# 404-es oldalak atiranyitasa -rewriterule ^public/support/tips/(.*)/xml/settings.xml /maintenance/empty_result.xml [nc,l] -rewriterule ^public/support/commandtips/(.*)/xml/settings.xml /maintenance/empty_result.xml [nc,l] - -#rewriterule ^business/activate_30/(.*)$ /cadline-kft [r=301,nc,l] -#rewriterule ^settings/lang/(.*)$ / [r=301,nc,l] -#RewriteRule ^public/hr/ARCHLINE_XP2015_64bit_setup.exe$ /public/downloads/eng/ARCHLINE_XP2015_64bit_setup.exe [r=302,NC,L] -#rewriterule ^azure/status/(.*)/(.*)/(.*)/(.*)/(.*)$ /maintenance/azure_vm_status.php?vmname=$1&lastactivity=$2&rdppart=$3&sessionid=$4&cpuusage=$5 [nc,l] -#rewriterule ^azure/status_test/(.*)$ /maintenance/azure_vm_status_test.php?stop=$1 [nc,l] -#rewriterule ^cron/messages_email$ /maintenance/messages_email.php [nc,l] -#rewriterule ^cron/downloademail$ /maintenance/downloademail.php [nc,l] - - - -rewriterule ^download/download-center/downloadable-projects https://www.archlinexp.com/education/workshops/workshop-application-preliminary [nc,l] - -Redirect /blog/szakmai-cikkek/rendering-oktatasi-segedlet https://help.archlinexp.com/hc/hu-hu/articles/360019417997-Rendering-oktat%C3%A1si-seg%C3%A9dlet -Redirect /blog/professional-articles/rendering-tutorial https://help.archlinexp.com/hc/en-us/articles/360019417997-Rendering-Tutorial -Redirect /oktatas/rendszerkovetelmenyek https://help.archlinexp.com/hc/hu-hu/articles/360012845578-Rendszerk%C3%B6vetelm%C3%A9nyek -Redirect /education/system-requirements https://help.archlinexp.com/hc/en-us/articles/360012845578-System-requirements -Redirect /termekek/archline-xp-live/live-rendszerkovetelmenyek https://help.archlinexp.com/hc/hu-hu/articles/360012845578-Rendszerk%C3%B6vetelm%C3%A9nyek -Redirect /oktatas/faq https://help.archlinexp.com/hc/hu-hu/articles/360012793498-Mit-csin%C3%A1l-az-ARCHLine-XP-program -Redirect /education/faq https://help.archlinexp.com/hc/en-us/articles/360012793498-What-is-ARCHLine-XP-Professional- - -## Begin - Tanfolyam oldalak atiranyitasa az uj oldalra. -# -Redirect /oktatas/workshopok/alapfoku-tanfolyam https://www.archline.hu/oktatas/workshopok -Redirect /oktatas/workshopok/kozepfoku-tanfolyam https://www.archline.hu/oktatas/workshopok -Redirect /oktatas/workshopok/felsofoku-tanfolyam https://www.archline.hu/oktatas/workshopok -Redirect /oktatas/workshopok/epiteszeti-tanfolyam https://www.archline.hu/oktatas/workshopok -# -## End - Tanfolyam oldalak atiranyitasa az uj oldalra. - -## Begin - Rewrite rules to block out some common exploits. -# If you experience problems on your site block out the operations listed below -# This attempts to block the most common type of exploit `attempts` to Joomla! -# -# Block out any script trying to base64_encode data within the URL. -RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR] -# Block out any script that includes a - - - - - - - -
-
-
- -
-
-
    -
  • -
  • -
  • -
  • -
-
-
- - - -

*DLGSTR3250*

- - - -

- -

*DLGSTR3251*

- - - - - - - - - -
- - - - - \ No newline at end of file diff --git a/cadline/backend/maintenance/activate_90_days_active.php b/cadline/backend/maintenance/activate_90_days_active.php deleted file mode 100644 index 555f6840..00000000 --- a/cadline/backend/maintenance/activate_90_days_active.php +++ /dev/null @@ -1,84 +0,0 @@ -message = $txtString; - -echo json_encode($result); diff --git a/cadline/backend/maintenance/aktivalasikod.php b/cadline/backend/maintenance/aktivalasikod.php deleted file mode 100644 index 0b31bf83..00000000 --- a/cadline/backend/maintenance/aktivalasikod.php +++ /dev/null @@ -1,17 +0,0 @@ -getXML($_GET['pwd'], $_GET['npid'], $_GET['isid'], $namirialNonProfit, $BIMLadderNonProfit, $_GET['userid'], $_GET['commercial']); - break; - } - case 'selectprogramdialog': // html output - { - /*require_once("class/selectprogramdialog.class.php"); - $spd = new SelectProgramDialog(); - $spd->getPrograms($_GET['pwd'], $_GET['userid']);*/ - break; - } - case 'checknonprofitexists': // xml output - { - require_once("class/selectprogram.class.php"); - $sp = new SelectProgram(); - $sp->checkNonProfitExists($_GET['npid'], $_GET['isid']); - break; - } - case 'email': { - if (isset($_GET["name"]) && isset($_GET["email"]) && isset($_GET["telephone"]) && isset($_GET["company"]) && isset($_GET["nonprofit"])) { - - $isEmailForNamirial = true; - if (isset($_GET["parnterID"])) { - if ($_GET["parnterID"] == "2nt") - $isEmailForNamirial = true; - else if ($_GET["parnterID"] == "kbl") - $isEmailForNamirial = false; - } - $nev = base64_decode($_GET["name"]); - $email = base64_decode($_GET["email"]); - $phone = base64_decode($_GET["telephone"]); - $company = base64_decode($_GET["company"]); - $nonprofit = base64_decode($_GET["nonprofit"]); - $year = isset($_GET["year"]) ? base64_decode($_GET["year"]) : "2018"; - $date = date('Y-m-d H:i:s', time()); - - if ($nonprofit == 0) { - if ($isEmailForNamirial) - $message = "ARCHLine.XP NamirialBIM: New trial user\n"; - else - $message = "ARCHLine.XP BIMLadder: New trial user\n"; - } else { - if ($isEmailForNamirial) - $message = "ARCHLine.XP NamirialBIM: New registered user\n"; - else - $message = "ARCHLine.XP BIMLadder: New registered user\n"; - } - - $message .= $nev; - $message .= "\n"; - $message .= $email; - $message .= "\n"; - $message .= $phone; - $message .= "\n"; - $message .= $company; - $message .= "\n"; - - $mail = new PHPMailer; - $mail->isSMTP(); - $mail->SMTPAuth = true; - $mail->CharSet = 'UTF-8'; - $mail->Host = $mailconfig['Host']; - $mail->Username = $mailconfig['Username']; - $mail->Password = $mailconfig['Password']; - $mail->SMTPSecure = $mailconfig['SMTPSecure']; - $mail->Port = $mailconfig['Port']; - $mail->isHTML(TRUE); - $mail->setFrom(DEFAULT_EMAIL); - $mail->addAddress('support@cadline.hu'); - if ($isEmailForNamirial) { - $mail->addBCC('register.archline@edilizianamirial.it'); - $mail->addBCC('info@cadlinesw.com'); - } else { - //ba biztonsagi okokbol, hogy a kesobbiekben is vissza tudjuk keresni - $mail->addCC('cadalog@gmail.com'); - } - - if ($nonprofit == 0) { - if ($isEmailForNamirial) - $mail->Subject = 'ARCHLine.XP NamirialBIM ' . $year . ' user registration - trial mode'; - else - $mail->Subject = 'ARCHLine.XP BIMLadder ' . $year . ' user registration - trial mode'; - } else { - if ($isEmailForNamirial) - $mail->Subject = 'ARCHLine.XP NamirialBIM ' . $year . ' user registration - registered mode'; - else - $mail->Subject = 'ARCHLine.XP BIMLadder ' . $year . ' user registration - registered mode'; - } - - $mail->msgHTML($message); - $mail->AltBody = strip_tags($message); - - if ($mail->send()) { - if (!$isEmailForNamirial) - print 'Sent'; //ba namirial eseten kesobb jon egy header, nem szabad kiirni semmit, kulonben nem mukodik! - } - unset($mail); - - if ($isEmailForNamirial) { - $namirialAction = $nonprofit == 0 ? 'trial-version' : 'registered-version'; - - $url = 'https://manager.cadlinesw.com/cadline-data/'; - $url .= '?msg=NamirialBIM'; - $url .= '&email=' . urlencode($email); - $url .= '&name=' . urlencode($nev); - $url .= '&phone=' . urlencode($phone); - $url .= '&action=' . urlencode($namirialAction); - $url .= '&business=' . urlencode($company); - $url .= '&year=' . urlencode($year); - - $ch = curl_init(); - $timeout = 10; - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); - $data = curl_exec($ch); - curl_close($ch); - print "Sent"; - //header("Location: ".$url); - //exit; - } - break; - } - } -} -$txt = "Időpont: " . date('Y-m-d H:i:s', time()) . " IP: " . $_SERVER['REMOTE_ADDR'] . "\n"; -error_log($txt, 3, "../tmp/al_log.txt"); diff --git a/cadline/backend/maintenance/alprograms.php b/cadline/backend/maintenance/alprograms.php deleted file mode 100644 index bc12d8dc..00000000 --- a/cadline/backend/maintenance/alprograms.php +++ /dev/null @@ -1,10 +0,0 @@ -'; -foreach ($actualPrograms as $result){ - echo "
  • ".$result["prHlNum"]."
  • "; -} -echo '';*/ diff --git a/cadline/backend/maintenance/banner.php b/cadline/backend/maintenance/banner.php deleted file mode 100644 index 4a1ef7d8..00000000 --- a/cadline/backend/maintenance/banner.php +++ /dev/null @@ -1,120 +0,0 @@ - 0 ? (int)base64_decode(str_replace(" ", "+", $_GET['bid'])) : NULL); - -if ($id > 0) { - $sql = "SELECT * FROM `albanner` WHERE id=" . $id; -} else { - if (strpos($hlNum, "x") === FALSE) // normál ág - { - $sql = "SELECT * FROM `www_archline_hu`.`albanner` WHERE - " . ($lngCode > '' ? " `lang`='" . $lngCode . "' AND " : "") . " - " . ($bldCode > 0 ? " (`build`=" . $bldCode . " OR `build`=0 OR `build` IS NULL) AND " : "") . " - `from_datetime`<=CURRENT_TIMESTAMP AND - `end_datetime`>CURRENT_TIMESTAMP AND - `published`='Y' AND - (substring(`pattern`,1,6)='" . $ctrCode . "xxxx' OR substring(`pattern`,1,6)='xxxxxx') AND - (substring(`pattern`,7,1)='" . $prgType . "' OR substring(`pattern`,7,1)='x') AND - (substring(`pattern`,8,2)='" . $prgCode . "' OR substring(`pattern`,8,2)='xx') - ORDER BY `priority` DESC, `add_datetime` DESC - LIMIT 10;"; - } else // teszteléshez! - { - $sql = "SELECT * FROM `www_archline_hu`.`albanner` WHERE - " . ($lngCode > '' ? " `lang`='" . $lngCode . "' AND " : "") . " - " . ($bldCode > 0 ? " (`build`=" . $bldCode . " OR `build`=0 OR `build` IS NULL) AND " : "") . " - `from_datetime`<=CURRENT_TIMESTAMP AND - `end_datetime`>CURRENT_TIMESTAMP AND - `published`='Y' AND - (substring(`pattern`,1,6)='" . $ctrCode . "xxxx' OR substring(`pattern`,1,6)='xxxxxx') AND - (substring(`pattern`,7,1)='" . $prgType . "' OR substring(`pattern`,7,1)='x') AND - (substring(`pattern`,8,2)='" . $prgCode . "' OR substring(`pattern`,8,2)='xx') - ORDER BY `priority` DESC, `add_datetime` DESC - LIMIT 10;"; - } -} - - -$msh2->query($sql); -$res = $msh2->fetchAssoc(); - -if ($_SERVER['REMOTE_ADDR'] == '188.6.239.155' && isset($_GET['test'])) { - print "serial: " . $serial . " build: " . $bldCode . " result: " . count($res) . "
    " . $sql; -} - -?> - - - - - - - - ARCHLine.XP banner - - - - - - - - - - - - - - - -
      - - '') : ?> -
    • ') ?>
    • - -
    • ') ?>
    • - - -
    - - - - - - \ No newline at end of file diff --git a/cadline/backend/maintenance/beolvas2.php b/cadline/backend/maintenance/beolvas2.php deleted file mode 100644 index 26de334c..00000000 --- a/cadline/backend/maintenance/beolvas2.php +++ /dev/null @@ -1,95 +0,0 @@ - $sor) { - $mezo = explode(";", $sor); - - if ($k == 0) continue; - if (trim($mezo[3]) == '') continue; - - $emails = explode(",", strtolower(trim(utf8_decode(str_replace("'", "", $mezo[3]))))); - - $user = array( - "strInfo" => utf8_decode(trim($mezo[0]) . ', ' . trim($mezo[1])), - "strName" => ucwords(trim(strtolower(utf8_decode($mezo[2])))), - "strEMail" => $emails[0], - "strTel" => trim(utf8_decode($mezo[4])), - "nCtrID" => ((int)$mezo[5] > 0 ? (int)$mezo[5] : NULL), - "strZip" => strtoupper(trim(utf8_decode($mezo[6]))), - "strCity" => ucwords(trim(strtolower(utf8_decode($mezo[7])))), - "strStreet" => trim(utf8_decode($mezo[8])), - "strCompany" => ucwords(trim(strtolower(utf8_decode($mezo[9])))), - "strWeb" => strtolower(trim(utf8_decode($mezo[10]))), - "nManagerID" => $nManagerID, - "nUserStatus" => 0, - "nIsCommendatory" => 0, - "nUserType" => 0, - "nUserDebt" => 0, - "nEsely" => 0, - "dateInsert" => $time, - "deleted" => 0, - "old_db" => "clusers_eng", - ); - - //print_r($user); print "
    "; - - $nUserID = 0; - $exist = FALSE; - - foreach ($emails as $email) { - $res = array(); - $msh->query("SELECT * FROM " . CRMADATBAZIS . ".u_emails WHERE LOWER(email)='" . strtolower(trim($email)) . "' LIMIT 1;"); - $res = $msh->fetchAssoc(); - if (!empty($res)) { - $exist = TRUE; - break; - } - } - - if ($exist) { - $nUserID = $res[0]['nUserID']; - print "exist: {$nUserID}
    \n"; - } else { - $msh->insert(CRMADATBAZIS . ".`users`", $user); - $nUserID = $msh->getInsertedId(); - - foreach ($emails as $e => $email) { - $msh->query("SELECT * FROM " . CRMADATBAZIS . ".u_emails WHERE LOWER(email)='" . strtolower(trim($email)) . "' LIMIT 1;"); - $res = $msh->fetchAssoc(); - if (empty($res)) { - $msh->insert(CRMADATBAZIS . ".`u_emails`", array( - 'email' => strtolower(trim($email)), - 'nUserID' => $nUserID, - 'default' => ($e == 0 ? 1 : 0), - 'active' => 1, - 'deleted' => 0, - 'newsletter' => 1 - )); - } - } - } - - $msh->insert(CRMADATBAZIS . ".`u_history`", array( - 'nUserID' => $nUserID, - 'nTopicID' => 339, - 'dateEvent' => date("Y-m-d", $time), - 'strPlace' => '', - 'strInfo' => 'Tóth Zoli (Partnering) adatbázis', - 'nManagerID' => $nManagerID, - 'insertDate' => date("Y-m-d H:i:s", $time), - )); - } -} diff --git a/cadline/backend/maintenance/chat_log.html b/cadline/backend/maintenance/chat_log.html deleted file mode 100644 index 8a94d408..00000000 --- a/cadline/backend/maintenance/chat_log.html +++ /dev/null @@ -1 +0,0 @@ -
    User angel jude suarez has joined the chat session.
    User angel jude suarez has joined the chat session.
    User angel jude suarez has left the chat session.
    User angel jude suarez has joined the chat session.
    (8:09 AM) angel jude suarez: yow
    User angel jude suarez has left the chat session.
    User james has joined the chat session.
    (8:09 AM) james: hi
    User james has left the chat session.
    User angel jude suarez has joined the chat session.
    User angel jude suarez has joined the chat session.
    User angel jude suarez has left the chat session.
    User angel jude suarez has joined the chat session.
    User angel jude suarez has left the chat session.
    \ No newline at end of file diff --git a/cadline/backend/maintenance/check_main_server_cron.php b/cadline/backend/maintenance/check_main_server_cron.php deleted file mode 100644 index 739ecb63..00000000 --- a/cadline/backend/maintenance/check_main_server_cron.php +++ /dev/null @@ -1,21 +0,0 @@ -query("SELECT * FROM sync_crm.cron_check"); -$cronFunctions = Database::getInstance()->fetchAssoc(); - -foreach ($cronFunctions as $function) { - $timeStamp = time() - $function['modified']; - - if ($timeStamp > 120) - $status = 'Failed'; - - $msg .= 'Function: ' . $function['function'] . '
    '; - $msg .= 'Last run: ' . date('Y-m-d H:i:s', $function['modified']) . '

    '; -} - -echo 'Cron status: ' . $status . '

    '; -echo $msg; diff --git a/cadline/backend/maintenance/check_server.php b/cadline/backend/maintenance/check_server.php deleted file mode 100644 index 9e8ef623..00000000 --- a/cadline/backend/maintenance/check_server.php +++ /dev/null @@ -1,12 +0,0 @@ -query($query); - $program = Database::getInstance()->fetchNext(); - - echo $program['prID']; -} catch (\Throwable $th) { - echo 'Failed'; -} diff --git a/cadline/backend/maintenance/class/actcode.class.php b/cadline/backend/maintenance/class/actcode.class.php deleted file mode 100644 index b1684a42..00000000 --- a/cadline/backend/maintenance/class/actcode.class.php +++ /dev/null @@ -1,468 +0,0 @@ - 940001, 'max' => 949999); - public static $arrBIMLadderRange = array('min' => 920001, 'max' => 929999); - private static $noAnswer = "(( nem kapott valaszt ))"; - private static $arrCodeReplyEnabled = array(30, 34, 36, 38, 40, 41, 42, 43, 44, 47, 48, 49, 82, 88, 91, 92, 93, 94, 95, 97, 98, 99); - - function ActCode() - { - if (!class_exists('MySqlHelper')) require_once("MySqlHelper.class.php"); - if (!class_exists('crm_hardlock')) require_once("common_cadline_libraries/crm_hardlock.class.php"); - } - - public static function getActCode($lang, $version, $session) - { - if (!is_numeric($version)) { - die('Invalid version id sent: ' . $version); - } - - $ctrName = IpToCountryHelper::getInstance()->getCountryName(); - $arrSess = self::decodeSessionString($session); - - if ($lang && is_array($arrSess) && count($arrSess)) { - if (isset($arrSess['npID']) && $arrSess['npID'] > '' && isset($arrSess['partnerID']) && $arrSess['partnerID'] == '2nt' && isset($arrSess['idokod']) && $arrSess['idokod'] > '' && isset($arrSess['pwd']) && $arrSess['pwd'] > '') { - self::namirialProcess($arrSess['npID'], $arrSess['partnerID'], $arrSess['idokod'], $arrSess['pwd']); - } else if (isset($arrSess['npID']) && $arrSess['npID'] > '' && isset($arrSess['partnerID']) && $arrSess['partnerID'] == 'kbl' && isset($arrSess['idokod']) && $arrSess['idokod'] > '' && isset($arrSess['pwd']) && $arrSess['pwd'] > '') { - self::bimLadderProcess($arrSess['npID'], $arrSess['partnerID'], $arrSess['idokod'], $arrSess['pwd']); - } - - // $pass=&$arrSess['pwd']; - $pass = '9908258340388286'; - $kulcs = HardlockHelper::getHardlock(substr($pass, 0, 6)); - $prog = ProgramHelper::getProgram($pass); - $isid = ProgramHelper::getIsidFromPass($pass, $prog['prActCode']); - $aktivalokod = CodeGenHelper::generateTimeCode($pass, $isid, 600); // ??? - $tomb = array_merge($arrSess, array('lang' => $lang, 'ctrname' => $ctrName, 'aktivalokod' => $aktivalokod, 'valasz' => (trim($aktivalokod) > "" ? trim($aktivalokod) : self::$noAnswer))); - - $newUsID = self::insertUserStats($tomb); // ??? - self::insertAktivalasInfok(array_merge($tomb, array('usID' => $newUsID, 'isid' => $isid))); - self::xmlOutput($kulcs['hlStat'], $prog['prLogFilter'], $aktivalokod, $newUsID); // ??? - - - if (substr($pass, 7, 2) > 29 && substr($pass, 0, 2) != '96') // ??? - { - /* - $version->ujaktivalasikod2($pass,$isid,$arrSess['idokod']); -*/ - } - } else { - self::insertError("Valami hianyzik:\nlang: " . $lang . "\nverzio: " . $version . "\nssID: " . $session . "\ndecoded session: " . print_r($arrSess, TRUE), __FUNCTION__); - } - } - - - public static function getAnswer($pass, $isid, $idokod) - { - if (self::isCodeReplyEnabled($pass) === TRUE) { - $prog = ProgramHelper::getPrograms($pass); // a LAN-osok miatt több rekordot is visszaadhat - if (!$prog) { - return "error: nincs ilyen password"; - } - - $kulcs = HardlockHelper::getHardlock((int)substr($pass, 0, 6)); - if (!$kulcs) { - return "error: nincs ilyen hardlock"; - } - if ($kulcs['hlStat'] != 1) { - return "error: nem aktiv a program"; - } - - $szoftveres = CodeGenHelper::isSoftwareKey($pass); - if ($szoftveres === FALSE) { - return $prog[0]['prActCode']; - } // hardveres kulcs esetén egyből visszaadja az aktuális aktiválási kód - /* -???????????????????????????????????????????????????????????????????????????????? -*/ - $voltures = false; - foreach ($prog as $program) { - if ($program['prActCode'] != "") // neki megfelelő aktiválási kód - { - $this->win10creator_old_isid = substr($program['prActCode'], 5, 4); - - $isidOK = (substr($program['prActCode'], 5, 4) == $isid); - if ($isidOK) { - $valasz = $program['prActCode']; - break; - } // aktuális aktiválási kód ???? - - if (!$isidOK && substr($program['prActCode'], 7, 2) == substr($isid, 2, 2)) { - $elteltnapok = 0; - sscanf(substr($idokod, 11, 2), '%02x', $elteltnapok); - $elteltnapok += $this->convert(substr($idokod, 10, 1)) * 256; - - $engedelyezettnapok = 0; - sscanf(substr($program['prActCode'], 11, 2), '%02x', $engedelyezettnapok); - $engedelyezettnapok += $this->convert(substr($program['prActCode'], 10, 1)) * 256; - - if ($engedelyezettnapok > $elteltnapok) { - $valasz = "error: win10 creator"; - break; - } - } - if ($isidOK) { - $valasz = $program['prActCode']; // aktuális aktiválási kód ??? - break; - } else { - $valasz = 'error: masik gep van regisztralva'; - } - } else { - $valasz = "error: hianyzo kod"; // nincs beirva a kod - $voltures = TRUE; - } - } - - if ($voltures === TRUE && $valasz == "error: masik gep van regisztralva") // LAN-os szoftver kulcsos liszensznél ha ezt a liszenszt nem találtuk de volt üres liszensz, akkor csinálja ezt - { - $valasz = "error: hianyzo kod"; - } - /* -???????????????????????????????????????????????????????????????????????????????? -*/ - return $valasz; - } - } - - public static function bimLadderProcess($npID = '', $partnerID = '', $idokod = '', $pwd = '') - { - if ($npID == '' || $partnerID != 'kbl' || $idokod == '' || $pwd == '') { - die('Missing parameters: |' . $npID . '|' . $partnerID . '|' . $idokod . '|' . $pwd . '|'); - } - - MySqlHelper::getInstance()->query("SELECT * FROM `" . CRMADATBAZIS . "`.`computers` WHERE `computer_id`='" . $npID . "' LIMIT 1;"); - $res4 = MySqlHelper::getInstance()->fetchAssoc(); - - if (empty($res4)) { - $comp = array( - 'computer_id' => $npID, - 'last_mod' => date('Y-m-d', time()) - ); - MySqlHelper::getInstance()->insert("`" . CRMADATBAZIS . "`.`computers`", $comp); - } - - MySqlHelper::getInstance()->query("SELECT * FROM `" . CRMADATBAZIS . "`.`computers` WHERE `computer_id`='" . $npID . "' LIMIT 1;"); - $compid = MySqlHelper::getInstance()->fetchAssoc(); - - MySqlHelper::getInstance()->query("SELECT * FROM `" . CRMADATBAZIS . "`.`nonprofit` WHERE computer_id='" . $compid[0]['id'] . "' AND partnerID = 'kbl' LIMIT 1;"); - $res = MySqlHelper::getInstance()->fetchAssoc(); - - if (empty($res)) { - $time = time(); - $hlNum = crm_hardlock::GetTheFirstNotUsedHlNumFromInterval(self::$arrBIMLadderRange['min'], self::$arrBIMLadderRange['max']); - $arrIdokod = explode("-", $idokod); - $isid = $arrIdokod[1]; - $type = substr($pwd, 6, 1); - $verid = substr($pwd, 7, 2); - MySqlHelper::getInstance()->query("SELECT * FROM `" . CRMADATBAZIS . "`.`p_versions` WHERE `verPassword8and9`='" . $verid . "' LIMIT 1;"); - $ver = $msh->fetchAssoc(); - $ver = $ret[0]; - - $interval = date_diff(date_create(date('Y-m-d', $time)), date_create((string)((int)date('Y', $time) + 1) . '-12-31')); - $pass = CodeGenHelper::generatePassword($hlNum, 0, $type, $ver['verCode']); // hlNum,lan,type=8,75=2018 - $aktKod = CodeGenHelper::generateTimeCode($pass, $isid, $interval->days); // pass,isid,numOfDays - - $msh->query("SELECT * FROM `" . CRMADATBAZIS . "`.`computers` WHERE computer_id='" . $npID . "' LIMIT 1;"); - $res = $msh->fetchAssoc(); - - if (empty($res)) { - $comp = array( - 'computer_id' => $npID, - 'last_mod' => date('Y-m-d', time()) - ); - MySqlHelper::getInstance()->insert("`" . CRMADATBAZIS . "`.`computers`", $comp); - } - - MySqlHelper::getInstance()->query("SELECT * FROM `" . CRMADATBAZIS . "`.`computers` WHERE `computer_id`='" . $npID . "' LIMIT 1;"); - $compid = MySqlHelper::getInstance()->fetchAssoc(); - - $nonprofit = array( - 'isid' => $isid, - 'verid' => $verid, - 'hlID' => $hlNum, - 'nUserID' => 62103, //ba ez invalid! namirialnal is! nem egy Namirial usernek az idje kene hogy itt legyen? Ami most 63051.. - 'add_datetime' => date('Y-m-d H:i:s', $time), - 'expire_datetime' => (string)((int)date('Y', $time) + 1) . '-12-31 23:59:59', - 'activation_datetime' => date('Y-m-d H:i:s', $time), - 'old_db' => 'clusers_eng', - 'partnerID' => $partnerID, - 'enabled' => 'Y', - 'computer_id' => $compid[0]['id'] - ); - MySqlHelper::getInstance()->insert("`" . CRMADATBAZIS . "`.`nonprofit`", $nonprofit); - - $hardlock = array( - 'hlNum' => $hlNum, - 'hlCtrID' => 82, - 'hlLan' => 0, - 'hlStat' => 1, - 'hlDateIssue' => date('Y-m-d', $time), - 'hlManID' => 36, - 'hlTime' => date('Y-m-d H:i:s', $time), - 'hlUser' => 62103, //ba ez invalid! namirialnal is! nem egy Namirial usernek az idje kene hogy itt legyen? Ami most 63051.. - 'hlDealer' => 62103, //ba ez invalid! namirialnal is! nem egy Namirial usernek az idje kene hogy itt legyen? Ami most 63051.. - 'bUjithato' => 1, - 'old_db' => 'clusers_eng' - ); - MySqlHelper::getInstance()->insert("`" . CRMADATBAZIS . "`.`hardlock`", $hardlock); - - $program = array( - 'prTypeID' => $type, - 'prVerID' => $ver['verID'], - 'prLan' => 0, - 'prPass' => trim($pass), - 'prSellDate' => date('Y-m-d', $time), - 'prActDate' => (string)((int)date('Y', $time) + 1) . '-12-31', - 'prFizetve' => (string)((int)date('Y', $time) + 1) . '-12-31', - 'prActCode' => trim($aktKod), - 'prTime' => date('Y-m-d H:i:s', $time), - 'prLastMod' => date('Y-m-d H:i:s', $time), - 'prContact' => 9, - 'prHlNum' => $hlNum, // 99xxxx - 'prManID' => 36, // web - 'prStat' => 0, - 'prHiType' => 1, // 1 Rendelés | 2 Típus Váltás | 3 Frissítés | 4 Auto Friss. - ); - MySqlHelper::getInstance()->insert("`" . CRMADATBAZIS . "`.`h_programs`", $program); - } - } - - public static function namirialProcess($npID = '', $partnerID = '', $idokod = '', $pwd = '') - { - if ($npID == '' || $partnerID != '2nt' || $idokod == '' || $pwd == '') { - die('Missing parameters: |' . $npID . '|' . $partnerID . '|' . $idokod . '|' . $pwd . '|'); - } - - MySqlHelper::getInstance()->query("SELECT * FROM `" . CRMADATBAZIS . "`.`computers` WHERE `computer_id`='" . $npID . "' LIMIT 1;"); - $res4 = MySqlHelper::getInstance()->fetchAssoc(); - - if (empty($res4)) { - $comp = array( - 'computer_id' => $npID, - 'last_mod' => date('Y-m-d', time()) - ); - MySqlHelper::getInstance()->insert("`" . CRMADATBAZIS . "`.`computers`", $comp); - } - - MySqlHelper::getInstance()->query("SELECT * FROM `" . CRMADATBAZIS . "`.`computers` WHERE `computer_id`='" . $npID . "' LIMIT 1;"); - $compid = MySqlHelper::getInstance()->fetchAssoc(); - - MySqlHelper::getInstance()->query("SELECT * FROM `" . CRMADATBAZIS . "`.`nonprofit` WHERE computer_id='" . $compid[0]['id'] . "' AND partnerID = '2nt' LIMIT 1;"); - $res = MySqlHelper::getInstance()->fetchAssoc(); - if (empty($res)) { - $time = time(); - $hlNum = crm_hardlock::GetTheFirstNotUsedHlNumFromInterval(self::$arrNamirialRange['min'], self::$arrNamirialRange['max']); - $arrIdokod = explode("-", $idokod); - $isid = $arrIdokod[1]; - $type = substr($pwd, 6, 1); - $verid = substr($pwd, 7, 2); - MySqlHelper::getInstance()->query("SELECT * FROM `" . CRMADATBAZIS . "`.`p_versions` WHERE `verPassword8and9`='" . $verid . "' LIMIT 1;"); - $ver = $msh->fetchAssoc(); - $ver = $ret[0]; - - $interval = date_diff(date_create(date('Y-m-d', $time)), date_create((string)((int)date('Y', $time) + 1) . '-12-31')); - $pass = CodeGenHelper::generatePassword($hlNum, 0, $type, $ver['verCode']); // hlNum,lan,type=8,75=2018 - $aktKod = CodeGenHelper::generateTimeCode($pass, $isid, $interval->days); // pass,isid,numOfDays - - MySqlHelper::getInstance()->query("SELECT * FROM `" . CRMADATBAZIS . "`.`computers` WHERE `computer_id`='" . $npID . "' LIMIT 1;"); - $compid = MySqlHelper::getInstance()->fetchAssoc(); - - $nonprofit = array( - 'isid' => $isid, - 'verid' => $verid, - 'hlID' => $hlNum, - 'nUserID' => 62103, //ba ez invalid! namirialnal is! nem egy Namirial usernek az idje kene hogy itt legyen? Ami most 63051.. - 'add_datetime' => date('Y-m-d H:i:s', $time), - 'expire_datetime' => (string)((int)date('Y', $time) + 1) . '-12-31 23:59:59', - 'activation_datetime' => date('Y-m-d H:i:s', $time), - 'old_db' => 'clusers_eng', - 'partnerID' => $partnerID, - 'enabled' => 'Y', - 'computer_id' => $compid[0]['id'] - ); - MySqlHelper::getInstance()->insert("`" . CRMADATBAZIS . "`.`nonprofit`", $nonprofit); - - $hardlock = array( - 'hlNum' => $hlNum, - 'hlCtrID' => 39, - 'hlLan' => 0, - 'hlStat' => 1, - 'hlDateIssue' => date('Y-m-d', $time), - 'hlManID' => 36, - 'hlTime' => date('Y-m-d H:i:s', $time), - 'hlUser' => 62103, //ba ez invalid! namirialnal is! nem egy Namirial usernek az idje kene hogy itt legyen? Ami most 63051.. - 'hlDealer' => 62103, //ba ez invalid! namirialnal is! nem egy Namirial usernek az idje kene hogy itt legyen? Ami most 63051.. - 'bUjithato' => 1, - 'old_db' => 'clusers_eng' - ); - MySqlHelper::getInstance()->insert("`" . CRMADATBAZIS . "`.`hardlock`", $hardlock); - - $program = array( - 'prTypeID' => $type, - 'prVerID' => $ver['verID'], - 'prLan' => 0, - 'prPass' => trim($pass), - 'prSellDate' => date('Y-m-d', $time), - 'prActDate' => (string)((int)date('Y', $time) + 1) . '-12-31', - 'prFizetve' => (string)((int)date('Y', $time) + 1) . '-12-31', - 'prActCode' => trim($aktKod), - 'prTime' => date('Y-m-d H:i:s', $time), - 'prLastMod' => date('Y-m-d H:i:s', $time), - 'prContact' => 8, // Non-profit - 'prHlNum' => $hlNum, // 99xxxx - 'prManID' => 36, // web - 'prStat' => 0, - 'prHiType' => 1, // 1 Rendelés | 2 Típus Váltás | 3 Frissítés | 4 Auto Friss. - ); - MySqlHelper::getInstance()->insert("`" . CRMADATBAZIS . "`.`h_programs`", $program); - } - } - - public static function decodeSessionString($str = "") - { - if ($str == "") { - die("Missing session string!"); - } - - $str_decoded = base64_decode($str); //decode the session string - - sscanf(substr($str_decoded, 0, 4), '%04x', $keyDec); - $encoded = str_split(substr($str_decoded, 4), 4); - $decoded = ''; - - foreach ($encoded as $e) { - sscanf($e, '%04x', $temp); - if (strlen(substr(sprintf('%x', $temp ^ $keyDec), 2)) > 0) { - $decoded .= chr(hexdec(substr(sprintf('%04x', $temp ^ $keyDec), 2))); - $decoded .= chr(hexdec(substr(sprintf('%04x', $temp ^ $keyDec), 0, 2))); - } else { - $decoded .= chr(hexdec(substr(sprintf('%04x', $temp ^ $keyDec), 2))); - } - } - - $parts = explode('_', $decoded); - - $arrSess['empty'] = $parts[0]; - $arrSess['pwd'] = $parts[1]; - $arrSess['compID'] = $parts[2]; - $arrSess['build'] = $parts[3]; - $arrSess['ctrID'] = $parts[4]; - $arrSess['idokod'] = $parts[5]; - if (count($parts) > 6) { - if (isset($parts[6]) && trim($parts[6]) > '') $arrSess['osdata'] = $parts[6]; - if (isset($parts[7]) && trim($parts[7]) > '') $arrSess['usGCMan'] = $parts[7]; - if (isset($parts[8]) && trim($parts[8]) > '') $arrSess['usGCType'] = $parts[8]; - if (isset($parts[9]) && trim($parts[9]) > '') $arrSess['usGCDriverVer'] = $parts[9]; - if (isset($parts[10]) && trim($parts[10]) > '') $arrSess['npID'] = $parts[10]; - if (isset($parts[11]) && trim($parts[11]) > '') $arrSess['partnerID'] = $parts[11]; - } - - return ($arrSess); - } - - public static function isCodeReplyEnabled($pass = '') - { - if ($pass == '') return (FALSE); - $ret = (in_array((int)substr($pass, 0, 2), self::$arrCodeReplyEnabled) ? TRUE : FALSE); - return ($ret); - } - - - public static function insertUserStats($tomb = array()) - { - if (empty($tomb)) return (FALSE); - - $stats = array( - 'usLang' => $tomb['lang'], - 'usDate' => time(), - 'usPwd' => $tomb['pwd'], - 'usVer' => substr($tomb['pwd'], 7, 2), - 'usCompID' => $tomb['compID'], - 'usCtrID' => $tomb['ctrID'], - 'usBuild' => $tomb['build'], - 'usCtrName' => $tomb['ctrname'], - 'usIP' => $_SERVER['REMOTE_ADDR'], - 'usOSData' => $tomb['osdata'], - ); - - if (isset($tomb['usGCMan']) && trim($tomb['usGCMan']) > '' && isset($tomb['usGCType']) && trim($tomb['usGCType']) > '' && isset($tomb['usGCDriverVer']) && trim($tomb['usGCDriverVer']) > '') { - $stats['usGCMan'] = $tomb['usGCMan']; - $stats['usGCType'] = $tomb['usGCType']; - $stats['usGCDriverVer'] = $tomb['usGCDriverVer']; - } - - if (substr($tomb['pwd'], 0, 1) == '9') { - if (in_array(substr($pwd, 0, 2), array('99', '98', '95'))) { - $hlRec = HardlockHelper::getHardlock(substr($pwd, 0, 6)); - if (isset($hlRec['hlCtrID'])) $stats['usHlCtrID'] = $hlRec['hlCtrID']; - } - } else { - $stats['usHlCtrID'] = substr($tomb['pwd'], 0, 2); - } - - if (CodeGenHelper::isSoftwareKey($tomb['pwd']) === TRUE) $stats['usISID'] = substr($tomb['idokod'], 5, 4); - - MySqlHelper::getInstance()->insert("`cl_hlusers`.`userstats2013`", $stats); - $newID = MySqlHelper::getInstance()->getInsertedId(); - return ($newID); - } - - public static function insertAktivalasInfok($tomb = array()) - { - if (empty($tomb)) return (FALSE); - - $info = array( - "kulcs" => substr($tomb['pwd'], 0, 6), - "datum" => date('Y-m-d H:i:s', time()), - "ip" => $_SERVER['REMOTE_ADDR'], - "kuldo" => "tips", - "leiras" => "programinditas - pw: " . $tomb['pwd'] . ", build: " . $tomb['build'] . ", isid: " . $tomb['isid'] . ", időkód: " . $tomb['idokod'] . ", valasz: " . $tomb['valasz'], - "statusz" => "uj", - "usGCMan" => (isset($tomb['usGCMan']) && trim($tomb['usGCMan']) ? trim($tomb['usGCMan']) : NULL), - "usGCType" => (isset($tomb['usGCType']) && trim($tomb['usGCType']) ? trim($tomb['usGCType']) : NULL), - "usGCDriverVer" => (isset($tomb['usGCDriverVer']) && trim($tomb['usGCDriverVer']) ? trim($tomb['usGCDriverVer']) : NULL), - "usID" => (isset($tomb['usID']) && trim($tomb['usID']) ? trim($tomb['usID']) : NULL), - ); - MySqlHelper::getInstance()->insert('`' . CRMADATBAZIS . '`.`h_aktivalas_infok`', $info); - } - - public static function insertError($str = '', $fv = '') - { - if (trim($str) > '') { - MySqlHelper::getInstance()->insert("`" . JMLADATBAZIS . "`.`a_hibak`", array( - 'osztaly' => __CLASS__, - 'fv' => trim($fv), - 'hiba' => trim($str), - 'datum' => date('Y-m-d H:i:s', time()), - )); - } - } - - public static function getEnabledLang($lang = "") - { - return (in_array(strtolower($lang), self::$arrEnabledLangs) ? strtolower($lang) : 'eng'); - } - - public static function xmlOutput($hlStat, $prLogFilter, $aktivalokod, $newUsID) - { - header('Content-Type: text/xml; charset=utf-8'); - header('Content-Disposition: inline; filename=response.xml'); - - print '<' . '?' . 'xml version="1.0" encoding="UTF-8" standalone="yes"' . '?' . '>' . - '' . ((isset($aktivalokod) && $aktivalokod > '') ? $aktivalokod : self::$noAnswer) . '' . // aktivalo kod - '' . ((isset($hlStat) && (int)$hlStat == 2) ? 'false' : 'true') . '' . // letiltott kulcs visszajelzése a programnak - ((isset($newUsID) && (int)$newUsID > 0) ? '' . (int)$newUsID . '' : '') . // userstats tabla rekord azonosito, amit a telemetria tabla is megkap, hogy ossze lehessen kapcsolni - '' . ((isset($prLogFilter) && (int)$prLogFilter > 0) ? $prLogFilter : 0) . '' . // user programjan tavolrol be lehet kapcsolni a logolast - '' . ($_SERVER['REMOTE_ADDR'] = '46.139.14.111' ? 'true' : 'false') . '' . - ''; - } -} // end of class diff --git a/cadline/backend/maintenance/class/codegen.helper.class.php b/cadline/backend/maintenance/class/codegen.helper.class.php deleted file mode 100644 index f87ceac0..00000000 --- a/cadline/backend/maintenance/class/codegen.helper.class.php +++ /dev/null @@ -1,79 +0,0 @@ -query("SELECT * FROM `cl_hlusers`.`computers` WHERE `computer_id`='" . $npID . "' LIMIT 1;"); - $res = MySqlHelper::getInstance()->fetchAssoc(); - - if (empty($res)) { - $comp = array( - 'computer_id' => $npID, - 'last_mod' => date('Y-m-d', time()) - ); - MySqlHelper::getInstance()->insert("`cl_hlusers`.`computers`", $comp); - } else { - MySqlHelper::getInstance()->update("`cl_hlusers`.`computers`", array('last_mod' => date('Y-m-d', time())), array('computer_id' => $npID)); - } - - MySqlHelper::getInstance()->query("SELECT * FROM `cl_hlusers`.`computers` WHERE `computer_id`='" . $npID . "' LIMIT 1;"); - $res = MySqlHelper::getInstance()->fetchAssoc(); - - return $res[0]['id']; - } - - public static function GetAllPrograms($nUserID, $product_id, $verid) - { - MySqlHelper::getInstance()->query("SELECT h_programs.prPass AS prHlNum, h_programs.prActCode AS prActCode, h_programs.prTypeID AS prTypeID, h_programs.prVerID AS prVerID, h_programs.prLan AS prLan - FROM `cl_hlusers`.`hardlock` - INNER JOIN `cl_hlusers`.`h_programs` ON h_programs.prHlNum = hardlock.hlNum - WHERE (hardlock.hlUser='" . $nUserID . "' OR hardlock.borrow='" . $nUserID . "') AND hardlock.product_id='" . $product_id . "' AND hardlock.hlStat!='0' AND h_programs.prVerID='" . $verid . "'"); - $res2 = MySqlHelper::getInstance()->fetchAssoc(); - - return $res2; - } - - public static function GetVerIDFromPassword($pwd) - { - $ver = substr($pwd, 7, 2); - MySqlHelper::getInstance()->query("SELECT * FROM `cl_hlusers`.`p_versions` WHERE `verPassword8and9`='" . $ver . "' LIMIT 1;"); - $res = MySqlHelper::getInstance()->fetchAssoc(); - - return $res[0]['verID']; - } - - public static function encode($privateKey, $publicKey, $data) - { - $key = self::CalcKey($privateKey, $publicKey); - $strLen = strlen($data); - $keyLen = strlen($key); - for ($i = 0; $i < $strLen; $i++) { - $ordStr = ord(substr($data, $i, 1)); - if ($j == $keyLen) { - $j = 0; - } - $ordKey = ord(substr($key, $j, 1)); - $j++; - $hash .= strrev(base_convert(dechex($ordStr + $ordKey), 16, 36)); - } - return $hash; - } - - public static function CalcKey($privateKey, $publicKey) - { - $privateKeyLength = strlen($privateKey); - $publicKeyLength = strlen($publicKey); - - if ($privateKeyLength > $publicKeyLength) { - $result = $privateKey; - for ($i = 1; $i < $publicKeyLength; $i += 2) { - $result[$i] = $publicKey[$i]; - } - } else { - $result = $publicKey; - for ($i = 0; $i < $privateKeyLength; $i += 2) { - $result[$i] = $privateKey[$i]; - } - } - return sha1($result); - } - - public static function decode($privateKey, $publicKey, $data) - { - $key = self::CalcKey($privateKey, $publicKey); - $strLen = strlen($data); - $keyLen = strlen($key); - for ($i = 0; $i < $strLen; $i += 2) { - $ordStr = hexdec(base_convert(strrev(substr($data, $i, 2)), 36, 16)); - if ($j == $keyLen) { - $j = 0; - } - $ordKey = ord(substr($key, $j, 1)); - $j++; - $hash .= chr($ordStr - $ordKey); - } - return $hash; - } - - public static function decode2($string, $key) - { - $key = sha1($key); - $strLen = strlen($string); - $keyLen = strlen($key); - for ($i = 0; $i < $strLen; $i += 2) { - $ordStr = hexdec(base_convert(strrev(substr($string, $i, 2)), 36, 16)); - if ($j == $keyLen) { - $j = 0; - } - $ordKey = ord(substr($key, $j, 1)); - $j++; - $hash .= chr($ordStr - $ordKey); - } - return $hash; - } - - public static function GetVerName($verid) - { - MySqlHelper::getInstance()->query("SELECT * FROM `cl_hlusers`.`p_versions` WHERE `verID`='" . $verid . "' LIMIT 1;"); - $res = MySqlHelper::getInstance()->fetchAssoc(); - - return $res[0]['verName']; - } - - public static function GetTypeName($typeid) - { - MySqlHelper::getInstance()->query("SELECT * FROM `cl_hlusers`.`p_types` WHERE `typeCode`='" . $typeid . "' LIMIT 1;"); - $res = MySqlHelper::getInstance()->fetchAssoc(); - - return $res[0]['typeName']; - } - - public static function GetActCode($serial) - { - MySqlHelper::getInstance()->query("SELECT * FROM `cl_hlusers`.`h_programs` WHERE `prPass`='" . $serial . "' LIMIT 1;"); - $res = MySqlHelper::getInstance()->fetchAssoc(); - - return $res[0]['prActCode']; - } - - public static function GetWebformPrivateKey() - { - return "3BjGQ6fzMtHupM5V8U3l_u"; - } - - public static function SetWebformResult($session, $result, $encodedResult) - { - MySqlHelper::getInstance()->query("SELECT * FROM `cl_hlusers`.`webform_results` WHERE `session_id`='" . $session . "' LIMIT 1;"); - $res = MySqlHelper::getInstance()->fetchAssoc(); - - if (empty($res)) { - $sess = array( - 'session_id' => $session, - 'result' => $result . '=' . $encodedResult, - 'insertDate' => date("Y-m-d") - ); - MySqlHelper::getInstance()->insert("`cl_hlusers`.`webform_results`", $sess); - } else { - MySqlHelper::getInstance()->update("`cl_hlusers`.`webform_results`", array('result' => $result . '=' . $encodedResult, 'insertDate' => date("Y-m-d")), array('session_id' => $session)); - } - } - - public static function SetWebformResource($session, $hint, $buttontext) - { - MySqlHelper::getInstance()->query("SELECT * FROM `cl_hlusers`.`webform_results` WHERE `session_id`='" . $session . "' LIMIT 1;"); - $res = MySqlHelper::getInstance()->fetchAssoc(); - - if (empty($res)) { - $sess = array( - 'session_id' => $session, - 'insertDate' => date("Y-m-d"), - 'message' => $hint, - 'button' => $buttontext - ); - MySqlHelper::getInstance()->insert("`cl_hlusers`.`webform_results`", $sess); - } else { - MySqlHelper::getInstance()->update("`cl_hlusers`.`webform_results`", array('insertDate' => date("Y-m-d"), 'message' => $hint, 'button' => $buttontext), array('session_id' => $session)); - } - } - - public static function get_valueFromStringUrl($url, $parameter_name) - { - $parts = parse_url($url); - if (isset($parts['query'])) { - parse_str($parts['query'], $query); - if (isset($query[$parameter_name])) - return $query[$parameter_name]; - else - return null; - } else { - return null; - } - } -} diff --git a/cadline/backend/maintenance/class/hardlock.helper.class.php b/cadline/backend/maintenance/class/hardlock.helper.class.php deleted file mode 100644 index 498fd6ed..00000000 --- a/cadline/backend/maintenance/class/hardlock.helper.class.php +++ /dev/null @@ -1,25 +0,0 @@ -query("SELECT * FROM `" . CRMADATBAZIS . "`.`hardlock` WHERE hlNum='" . (int)$hlNum . "' LIMIT 1;"); - $res = MySqlHelper::getInstance()->fetchAssoc(); - return (empty($res) ? FALSE : $res[0]); - } -} // end of class diff --git a/cadline/backend/maintenance/class/iptocountry.helper.class.php b/cadline/backend/maintenance/class/iptocountry.helper.class.php deleted file mode 100644 index 24b8bc71..00000000 --- a/cadline/backend/maintenance/class/iptocountry.helper.class.php +++ /dev/null @@ -1,73 +0,0 @@ -query("SELECT * FROM `" . CRMADATBAZIS . "`.`iptocountry` WHERE IP='" . $ip . "' LIMIT 1;"); - $res = MySqlHelper::getInstance()->fetchAssoc(); - if (empty($res)) // ha nincs rekord, akkor insert-el egy uj rekordot - { - $tomb = self::downloadValues($ip); - self::saveRecord($tomb); - } else // ha van rekord - { - $res = $res[0]; - if (substr($res['AddDateTime'], 0, 10) < date('Y-m-d', time() - 86400 * self::$deprecated)) // es elevult a rekord, akkor torli a regit es insert-el egy uj rekordot - { - self::delOldRecords(); - $tomb = self::downloadValues($ip); - self::saveRecord($tomb); - } else // es nem evult el a rekord, akkor az adatbazisbol adja vissza - { - $tomb = $res; - } - } - return ($tomb); - } - - - public static function downloadValues($ip = "") - { - if ($ip == "") $ip = $_SERVER['REMOTE_ADDR']; - $locale = @file_get_contents("http://freegeoip.net/xml/" . $ip, FALSE, stream_context_create(array('http' => array('timeout' => 2)))); - $tomb = json_decode(json_encode(simplexml_load_string($locale)), TRUE); - return ($tomb); - } - - public static function saveRecord($tomb = array()) - { - $tomb['AddDateTime'] = date('Y-m-d H:i:s', time()); - MySqlHelper::getInstance()->insert("`" . CRMADATBAZIS . "`.`iptocountry`", $tomb); - } - - public static function delOldRecords() - { - MySqlHelper::getInstance()->delete("`" . CRMADATBAZIS . "`.`iptocountry`", "DATE(`AddDateTime`)<'" . date('Y-m-d', time() - 86400 * self::$deprecated) . "'"); - } - - - public static function getCountryName($ip = "") - { - if ($ip == "") $ip = $_SERVER['REMOTE_ADDR']; - $ret = self::getValues($ip); - if (!isset($ret["CountryName"]) || trim($ret["CountryName"]) == '') $ret["CountryName"] = 'unknown'; - return (trim($ret["CountryName"])); - } -} diff --git a/cadline/backend/maintenance/class/program.helper.class.php b/cadline/backend/maintenance/class/program.helper.class.php deleted file mode 100644 index b87532e3..00000000 --- a/cadline/backend/maintenance/class/program.helper.class.php +++ /dev/null @@ -1,51 +0,0 @@ -query("SELECT * FROM `" . CRMADATBAZIS . "`.`h_programs` WHERE prPass='" . $pass . "' LIMIT 1;"); - $res = MySqlHelper::getInstance()->fetchAssoc(); - return (empty($res) ? FALSE : $res[0]); - } - - public static function getPrograms($pass = '') - { - if ($pass == '') return (FALSE); - MySqlHelper::getInstance()->query("SELECT * FROM `" . CRMADATBAZIS . "`.`h_programs` WHERE prPass='" . $pass . "';"); - $res = MySqlHelper::getInstance()->fetchAssoc(); - return (empty($res) ? FALSE : $res); - } - - public static function getIsidFromPass($pass = '', $actcode = '') - { - if ($pass == '') return (FALSE); - - if (substr($pass, 0, 1) == '9') { - if (trim($actcode) > '') { - $isid = (substr($actcode, 5, 4) > '' ? substr($actcode, 5, 4) : FALSE); - } else { - $prg = self::getProgram($pass); - $isid = ($prg ? substr($prg['prActCode'], 5, 4) : FALSE); - } - } else { - $isid = substr($pass, 0, 2) . substr($pass, 7, 2); - } - - return ($isid); - } -} // end of class diff --git a/cadline/backend/maintenance/class/selectedprogram.php b/cadline/backend/maintenance/class/selectedprogram.php deleted file mode 100644 index 6697cdff..00000000 --- a/cadline/backend/maintenance/class/selectedprogram.php +++ /dev/null @@ -1,13 +0,0 @@ -'; - $resultXml .= '' . $_POST['prgrm'] . '' . $actcode . ''; - $resultXml .= ''; - header('Content-Type: text/xml; charset=utf-8'); - header('Content-Disposition: inline; filename=response.xml'); - - echo $resultXml; -} diff --git a/cadline/backend/maintenance/class/selectprogram.class.php b/cadline/backend/maintenance/class/selectprogram.class.php deleted file mode 100644 index f4960b8e..00000000 --- a/cadline/backend/maintenance/class/selectprogram.class.php +++ /dev/null @@ -1,92 +0,0 @@ -'; - if ($pwd == '' || $npid == '' || $isid == '') return (void); - - crm_database::getInstance()->query("SELECT * FROM `" . CRMADATBAZIS . "`.`computers` WHERE `computer_id`='" . $npid . "' LIMIT 1;"); - $res2 = crm_database::getInstance()->fetchNext(); - if (empty($res2)) - $compid = crm_hardlock::AddOrUpdateComputer($npid, ''); - else - $compid = $res2['id']; - - $password = ''; - $actcode = ''; - if ($commercial) { - //ba figyelem, teszteletlen ag!!! - if (substr($pwd, 6, 1) == 'L') { - $actualPrograms = crm_hardlock::GetAllPrograms($nUserID, 2, $verid); - } else { - $actualPrograms = crm_hardlock::GetAllPrograms($nUserID, 1, $verid); - } - - if (count($actualPrograms) > 1) { - $password = $actualPrograms[0]['prHlNum']; - $actcode = $actualPrograms[0]['prActCode']; - //$resultXml .= ''.$actualPrograms[0]['prHlNum'].''.$actualPrograms[0]['prActCode'].''; - } else if (count($actualPrograms) == 1) { - $password = $actualPrograms[0]['prHlNum']; - $actcode = $actualPrograms[0]['prActCode']; - //$resultXml .= ''.$actualPrograms[0]['prHlNum'].''.$actualPrograms[0]['prActCode'].''; - } - } else { - if (!$namirialNonProfit && !$BIMLadderNonProfit) - $queryString = "SELECT * FROM `" . CRMADATBAZIS . "`.`nonprofit` WHERE `computer_id`='" . $compid . "' AND `isid`='" . $isid . "' AND partnerID is null LIMIT 1;"; - else if ($namirialNonProfit) - $queryString = "SELECT * FROM `" . CRMADATBAZIS . "`.`nonprofit` WHERE `computer_id`='" . $compid . "' AND `isid`='" . $isid . "' AND partnerID = '2nt' LIMIT 1;"; - else if ($BIMLadderNonProfit) - $queryString = "SELECT * FROM `" . CRMADATBAZIS . "`.`nonprofit` WHERE `computer_id`='" . $compid . "' AND `isid`='" . $isid . "' AND partnerID = 'kbl' LIMIT 1;"; - crm_database::getInstance()->query($queryString); - $res = crm_database::getInstance()->fetchNext(); - - $multiple = true; - if (count($res)) { - crm_database::getInstance()->query("SELECT * FROM `" . CRMADATBAZIS . "`.`p_versions` WHERE `verPassword8and9`='" . $res['verid'] . "' LIMIT 1;"); - $ver = crm_database::getInstance()->fetchNext(); - crm_database::getInstance()->query("SELECT * FROM `" . CRMADATBAZIS . "`.`h_programs` WHERE `prHlNum`='" . $res['hlID'] . "' AND `prVerID`='" . $ver['verID'] . "' LIMIT 1;"); - $res = crm_database::getInstance()->fetchNext(); - $password = $res['prPass']; - $actcode = $res['prActCode']; - } - } - header('Content-Type: text/xml; charset=utf-8'); - header('Content-Disposition: inline; filename=response.xml'); - echo '<' . '?' . 'xml version="1.0"' . '?' . '>' . $password . '' . $actcode . 'false'; - } - - public static function checkNonProfitExists($npid = '', $isid = '') - { - if ($npid == '' || $isid == '') return (void); - - crm_database::getInstance()->query("SELECT * FROM `" . CRMADATBAZIS . "`.`computers` WHERE `computer_id`='" . $npid . "' LIMIT 1;"); - $res2 = crm_database::getInstance()->fetchNext(); - $compid = $res2['id']; - - crm_database::getInstance()->query("SELECT * FROM `" . CRMADATBAZIS . "`.`nonprofit` WHERE `computer_id`='" . $compid . "' AND `isid`='" . $isid . "' LIMIT 1;"); - $res = crm_database::getInstance()->fetchNext(); - - if (!empty($res)) { - $user = $res['nUserID']; - crm_database::getInstance()->query("SELECT * FROM `" . CRMADATBAZIS . "`.`users` WHERE `nUserID`=" . $user . " LIMIT 1;"); - $res = crm_database::getInstance()->fetchNext(); - - header('Content-Type: text/xml; charset=utf-8'); - header('Content-Disposition: inline; filename=response.xml'); - echo '<' . '?' . 'xml version="1.0"' . '?' . '>' . $res['strName'] . '' . $res['strEMail'] . '' . $res['strTel'] . '' . $res['strCompany'] . ''; - } - } -} diff --git a/cadline/backend/maintenance/clusers.php b/cadline/backend/maintenance/clusers.php deleted file mode 100644 index 6fd199e6..00000000 --- a/cadline/backend/maintenance/clusers.php +++ /dev/null @@ -1 +0,0 @@ - '' ? trim($_SERVER['DOCUMENT_ROOT']) : $_SERVER['DOCUMENT_ROOT']); // cron-ból futtatva a DOCUMENT_ROOT-nak nincs értéke!!! -require_once('config.mail.php'); - -if (class_exists('MySqlHelper') === FALSE) - require_once('MySqlHelper.class.php'); - -define('CRMADATBAZIS', "cl_hlusers"); -define('ACT_VERSION_ID', 1182); -define('DOMAIN', 'www.archline.hu'); -define('DEFAULT_EMAIL', 'info@cadline.hu'); -define('DEFAULT_EMAIL_ENG', 'info@archlinexp.com'); - -$config['db_host'] = 'localhost'; // 217.116.46.39 -$config['db_user'] = 'cadline'; //'mycadline'; -$config['db_pass'] = 'Shea6hoo'; //'uf1Ohpee'; -$config['db_name'] = 'cl_hlusers'; - -$config2['db_host'] = 'localhost'; // tanis 2 - 185.43.206.63 -$config2['db_user'] = 'mycadline'; -$config2['db_pass'] = 'Shea6hoo'; -$config2['db_name'] = 'www_archline_hu'; - -$msh = new MySQLHelper(); // tanis -$msh->init($config['db_host'], $config['db_name'], $config['db_user'], $config['db_pass']); -$msh->writelog = TRUE; - -$msh2 = new MySQLHelper(); // tanis 2 -$msh2->init($config2['db_host'], $config2['db_name'], $config2['db_user'], $config2['db_pass']); diff --git a/cadline/backend/maintenance/config.tce.php b/cadline/backend/maintenance/config.tce.php deleted file mode 100644 index f3de96e1..00000000 --- a/cadline/backend/maintenance/config.tce.php +++ /dev/null @@ -1,34 +0,0 @@ - '' ? trim($_POST["email"]) : trim($_POST['email2'])); - $info = ' ' . $_POST["info"]; - $serial = isset($_POST['serial']) ? $_POST['serial'] : ''; - $rgn = isset($_POST['rgn']) ? strtolower($_POST['rgn']) : 'int'; - $match = $rgn == 'cn' && preg_match('/^[A-Z0-9]{4}(?:-[A-Z0-9]{4}){7}$/', $serial); - - if (Codegen::IsValidPassword($serial) == false && $serial != 'no_serial') { - die(); - } - - $query = "SELECT * FROM www_archline_hu.crash WHERE guid = ? AND id = ? AND deleted = ?;"; - Database::getInstance()->query($query, array('sii', $guid, $id, 0)); - $res = Database::getInstance()->fetchAssoc(); - - if (!empty($res)) { - $updateQuery = "UPDATE www_archline_hu.crash SET email = ?, info = ? WHERE guid = ? AND id = ? AND deleted = ? LIMIT 1;"; - Database::getInstance()->query($updateQuery, array('sssii', $email, $res[0]['info'] . $info, $guid, $id, 0)); - } - - header('Content-Type: text/html; charset=utf-8'); - - //default is english - $text1 = utf8_encode("Thank you!"); - $text2 = utf8_encode("The report of this issue is now delivered and awaiting processing."); - $text3 = utf8_encode("If you provided your e-mail address, we will send you a message when there is new information about this issue."); - $text4 = utf8_encode("Best regards"); - $text5 = utf8_encode("CadLine Network Ltd."); - if ('hun' == $lang) { - $text1 = utf8_encode("Köszönjük!"); - $text2 = utf8_encode("A hibajelentést kézbesítettük és jelenleg feldolgozásra vár."); - $text3 = utf8_encode("Amennyiben megadta e-mail címét értesítést küldünk a jelenséget érintő bárminemű fejlemény esetén."); - $text4 = utf8_encode("Tisztelettel"); - $text5 = utf8_encode("A CADLine Kft. csapata"); - } else if ('ita' == $lang) { - $text1 = utf8_encode("Grazie!"); - $text2 = utf8_encode("Il report verrà ora inviato, attendere il completamento."); - $text3 = utf8_encode("Se avete fornito l'indirizzo e-mail, riceverete un messaggio di conferma."); - $text4 = utf8_encode("Distinti saluti"); - $text5 = utf8_encode("CadLine Network Ltd."); - } else if ('esp' == $lang) { - } else if ('ger' == $lang || 'de-DE' == $lang || 'de-AT' == $lang) { - $text1 = utf8_encode("Herzlichen Dank!"); - $text2 = utf8_encode("Der Report wird nun weitergeleitet und demnächst bearbeitet."); - $text3 = utf8_encode("Wenn Sie uns eine Email Adresse bekannt gegeben haben, werden wir Sie auf diesem Wege auf dem Laufenden halten."); - $text4 = utf8_encode("Mit freundlichen Grüßen"); - $text5 = utf8_encode("CadLine Network Ltd."); - } else if ('gre' == $lang) { - $text1 = utf8_encode("Ευχαριστώ!"); - $text2 = utf8_encode("Η αναφορά του αιτήματος αυτού παραδίδεται τώρα και αναμένεται επεξεργασία."); - $text3 = utf8_encode("Αν δώσατε τη διεύθυνση email σας, θα σας στείλουμε ένα μήνυμα μόλις υπάρξουν νέες πληροφορίες σχετικά με αυτό το θέμα."); - $text4 = utf8_encode("Με φιλικούς χαιρετισμούς"); - $text5 = utf8_encode("CadLine Network Ltd."); - } else if ('cz' == $lang) { - $text1 = utf8_encode("Děkujeme!"); - $text2 = utf8_encode("Zpráva o tomto problému je nyní předána a čeká na zpracování."); - $text3 = utf8_encode("Pokud jste poskytli svou e-mailovou adresu, pošleme vám zprávu s novými informacemi o tomto problému."); - $text4 = utf8_encode("S pozdravem"); - $text5 = utf8_encode("CadLine Network Ltd."); - } else if ('pol' == $lang) { - } else if ('cr' == $lang) { - $text1 = utf8_encode("Hvala Vam!"); - $text2 = utf8_encode("Izvještaj ovog problema je poslan i čeka na obradu."); - $text3 = utf8_encode("Ako ste naveli Vašu e-mail adresu, poslat ćemo Vam poruku kada ćemo imati nove informacije vezane uz ovaj problem."); - $text4 = utf8_encode("Srdačan pozdrav,"); - $text5 = utf8_encode("CadLine Network Ltd."); - } else if ('nl' == $lang) { - } else if ('kor' == $lang) { - $text1 = utf8_encode("감사합니다."); - $text2 = utf8_encode("이 문제에 대한 보고서가 전달되어 처리를 기다리고 있습니다."); - $text3 = utf8_encode("전자 메일 주소를 제공 한 경우이 문제에 대한 새로운 정보가있을 때 메시지가 전송됩니다."); - $text4 = utf8_encode("감사합니다."); - $text5 = utf8_encode("CadLine Network Ltd."); - } else if ('chn' == $lang) { - $text1 = "感谢您!"; - $text2 = "此问题报告现已提交并等待处理。"; - $text3 = "如果您提供了电子邮件地址,当有关于此问题的新信息时,我们会给您发送消息。"; - $text4 = "致以最诚挚的问候"; - $text5 = "苏州浩辰软件股份有限公司"; - } else if ('por' == $lang) { - } else if ('nor' == $lang) { - $text1 = utf8_encode("Takk!"); - $text2 = utf8_encode("Rapporten er levert og avventer behandling."); - $text3 = utf8_encode("Hvis du har oppgitt din e-post adresse vil vi sende deg mail når det er nytt om saken."); - $text4 = utf8_encode("Med vennlig hilsen"); - $text5 = utf8_encode("CadLine Network Ltd."); - } -?> - - - - - - - - - - - - - - -
    -
    -
    -

    -



    -



    -


    -



    -
    -
    - - - - -query($query, array('si', $guid, 0)); - $res = Database::getInstance()->fetchNext(); - if (empty($res)) { - $newID = Database::getInstance()->insert( - 'www_archline_hu.crash', - array( - 'guid' => $guid, - 'info' => trim($info), - 'datum' => date('Y-m-d H:i:s', time()), - 'prod' => $prod - ), - 'ssss' - ); - } else { - $newID = $res['id']; - } - - header('Content-Type: text/html; charset=utf-8'); - - //default is english - $confirm = "Confirm"; - if ('hun' == $lang) { - $confirm = "Megerősít"; - } else if ('ita' == $lang) { - $confirm = "Conferma"; - } else if ('esp' == $lang) { - } else if ('ger' == $lang || 'de-DE' == $lang || 'de-AT' == $lang) { - $confirm = "Bestätigen"; - } else if ('gre' == $lang) { - $confirm = "επιβεβαιώνω"; - } else if ('cz' == $lang) { - $confirm = "Potvrdit"; - } else if ('pol' == $lang) { - } else if ('cr' == $lang) { - $confirm = "Potvrdi"; - } else if ('nl' == $lang) { - } else if ('kor' == $lang) { - $confirm = "확인"; - } else if ('chn' == $lang) { - $confirm = "确认"; - } else if ('por' == $lang) { - } else if ('nor' == $lang) { - $confirm = "Bekreft"; - } - -?> - - - - - - - - - - - - - - - - - -
    -
    -
    -

    -



    -
    -
    -
    - - - - - - :
    - - -
    -
    -
    -
    - - - -
    - - - - \ No newline at end of file diff --git a/cadline/backend/maintenance/crashadmin.php b/cadline/backend/maintenance/crashadmin.php deleted file mode 100644 index 88314306..00000000 --- a/cadline/backend/maintenance/crashadmin.php +++ /dev/null @@ -1,488 +0,0 @@ -query($updateUserQuery, array('si', $text, $id)); - } - if ($_POST['listaid'] && isset($_POST['CbBoxValue'])) { - $listaid = substr($_POST['listaid'], 5); - - $updateUserQuery = "UPDATE `www_archline_hu`.`crash` SET eredmeny = ? WHERE id = ? LIMIT 1;"; - Database::getInstance()->query($updateUserQuery, array('ii', $_POST['CbBoxValue'], $listaid)); - } -} - - -function downloadFile($filename) -{ - if ($f = fopen($filename, "rb")) { - $content_len = (int) filesize($filename); - //@ini_set('zlib.output_compression', 'Off'); - header('Pragma: public'); - //header('Last-Modified: '.gmdate('D, d M Y H(idea)(worry)') . ' GMT'); - header('Cache-Control: no-store, no-cache, must-revalidate'); // HTTP/1.1 - header('Cache-Control: pre-check=0, post-check=0, max-age=0'); // HTTP/1.1 - header('Content-Transfer-Encoding: none'); - header('Content-Type: plain/text'); - header('Content-Disposition: inline; filename="' . $filename . '"'); - header("Content-length: $content_len"); - - while (!feof($f)) { - echo fread($f, 2 << 20); - } - fclose($f); - } else { - print "error opening file"; - } - exit(); -} - -if (isset($_GET) && !empty($_GET)) { - $filepath = "/home/vendeg/crash/"; - $filepath .= $_GET["guid"]; - - if (!file_exists($filepath)) - $filepath = "../webdav/crash/" . $_GET['guid']; - downloadFile($filepath); -} else { -?> - - - - - - - - - - - '; - if (isset($_SESSION["maxdate"]) || isset($_SESSION["mindate"]) || isset($_SESSION["lista"])) { - echo 'Dátum szűrés
    -tól     -ig'; - } else { - echo 'Dátum szűrés
    -tól     -ig'; - } - ?> -

    - Eredmény szűrő:
    - - - - - - -

    - -

    - - - = ? "; - $bind .= 's'; - } - - if (isset($_POST['datemax'])) { - array_push($feltetel, $_POST['datemax']); - $query .= "AND left(datum, 10) <= ? "; - $bind .= 's'; - } - - if (isset($_POST['lista']) && $_POST['lista'] != "%") { - array_push($feltetel, $_POST['lista']); - $query .= "AND eredmeny = ? "; - $bind .= 'i'; - } - - if (isset($_POST['prod']) && $_POST['prod'] != "") { - array_push($feltetel, $_POST['prod']); - $query .= "AND prod = ? "; - $bind .= 's'; - } - - $query .= "ORDER BY id DESC LIMIT 500;"; - - array_unshift($feltetel, $bind); - - Database::getInstance()->query($query, $feltetel); - $results = Database::getInstance()->fetchAssoc(); - - print "
    "; - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - - foreach ($results as $result) { - $r = (object)$result; - - $filepathFtp = "/home/vendeg/crash/"; - $filepathFtp .= $r->guid; - $filepathFtp .= ".DMP"; - - $filepathWebdav = "../webdav/crash/"; - $filepathWebdav .= $r->guid; - $filepathWebdav .= ".DMP"; - - $crashFile = "../webdav/crash/" . $r->guid . ".crh"; - - if (!file_exists($filepathFtp) && !file_exists($filepathWebdav) && !file_exists($crashFile)) - continue; - - print ""; - print ""; - - print ""; - - print ""; - - print ""; - - print ""; - - print ""; - - print ""; - - print ""; - - print ""; - } - print ''; - print ''; - print ''; - print ''; - - print ''; - print "
    EmailÜzenetDátumDmp fájlInfo fájlCrash fájlMegjegyzésEredmény
    "; - print $r->email; - print ""; - print $r->info; - print ""; - //print substr($r->datum,0,10); - print $r->datum; - print ""; - - if (file_exists($filepathFtp) || file_exists($filepathWebdav)) { - echo '' . $r->guid . ''; - } - print ""; - - $infoPath = '/home/vendeg/crash/' . $r->guid . '.TXT'; - $infoPathWebdav = '../webdav/crash/' . $r->guid . '.TXT'; - $logPath = '/home/vendeg/crash/' . $r->guid . '.LOG'; - $logPathWebdav = '../webdav/crash/' . $r->guid . '.LOG'; - $crashPath = '../webdav/crash/' . $r->guid . '.crh'; - $logExtension = '.LOG'; - $infoExtension = '.TXT'; - $crashExtension = '.crh'; - if (!file_exists($infoPath) && !file_exists($infoPathWebdav)) { - $infoPath = '/home/vendeg/crash/' . $r->guid . '.XML'; - $infoExtension = '.XML'; - } - - if (file_exists($infoPath) || file_exists($infoPathWebdav)) { - echo 'Info'; - } - - if (file_exists($logPath) || file_exists($logPathWebdav)) { - echo ' Log'; - } - - if (file_exists($infoPath)) { - $file = '/home/vendeg/crash/' . $r->guid . '.TXT'; - if (!file_exists($file)) - $file = $infoPathWebdav; - - $searchfor = 'developer'; - $contents = file_get_contents($file); - $pattern = preg_quote($searchfor, '/'); - $pattern = "/^.*$pattern.*\$/m"; - if (preg_match_all($pattern, $contents, $matches)) - echo "developer"; - - $searchfor = 'Product: render'; - $contents = file_get_contents($file); - $pattern = preg_quote($searchfor, '/'); - $pattern = "/^.*$pattern.*\$/m"; - if (preg_match_all($pattern, $contents, $matches)) { - echo "render"; - } - } - print ""; - if (file_exists($crashPath)) { - echo ' Crash'; - } - print ""; - echo ""; - print ""; - switch ($r->eredmeny) { - case '0': - echo ' - - '; - break; - - case '1': - echo ' - - '; - break; - - case '2': - echo ' - - '; - break; - - case '3': - echo ' - - '; - break; - case '4': - echo ' - - '; - break; - case '5': - echo ' - - '; - break; - case '6': - echo ' - - '; - break; - case '7': - echo ' - - '; - break; - } - print "
    "; - ?> - - - - \ No newline at end of file diff --git a/cadline/backend/maintenance/cron_check.php b/cadline/backend/maintenance/cron_check.php deleted file mode 100644 index 3be8c75f..00000000 --- a/cadline/backend/maintenance/cron_check.php +++ /dev/null @@ -1,21 +0,0 @@ -query("SELECT * FROM cl_hlusers.cron_check"); -$cronFunctions = Database::getInstance()->fetchAssoc(); - -foreach ($cronFunctions as $function) { - $timeStamp = time() - $function['modified']; - - if ($timeStamp > 180) - $status = 'Failed'; - - $msg .= 'Function: ' . $function['function'] . '
    '; - $msg .= 'Last run: ' . date('Y-m-d H:i:s', $function['modified']) . '

    '; -} - -echo 'Cron status: ' . $status . '

    '; -echo $msg; diff --git a/cadline/backend/maintenance/cron_check_server.php b/cadline/backend/maintenance/cron_check_server.php deleted file mode 100644 index cf61aed4..00000000 --- a/cadline/backend/maintenance/cron_check_server.php +++ /dev/null @@ -1,64 +0,0 @@ - true, // return web page - CURLOPT_HEADER => false, // don't return headers - CURLOPT_FOLLOWLOCATION => true, // follow redirects - CURLOPT_MAXREDIRS => 10, // stop after 10 redirects - CURLOPT_ENCODING => "", // handle compressed - CURLOPT_USERAGENT => "test", // name of client - CURLOPT_AUTOREFERER => true, // set referrer on redirect - CURLOPT_CONNECTTIMEOUT => 120, // time-out on connect - CURLOPT_TIMEOUT => 120, // time-out on response - ); - - $ch = curl_init($url); - curl_setopt_array($ch, $options); - - $content = curl_exec($ch); - - curl_close($ch); - - $result = $content == 380335 ? 'Success' : 'Failed'; -} catch (\Exception $e) { - $result = 'Failed'; -} - -$filename = $_SERVER['DOCUMENT_ROOT'] . "/serverAlive.txt"; -$closed = file_put_contents($filename, $result); - -$i = 0; - -while (!$closed && $i < 10) { - $closed = file_put_contents($filename, $result); - $i++; -} - -try { - if ($_SERVER['SERVER_NAME'] == 'secondary.cadline.hu') { - $txtResult = $result == 'Success' ? 'Inactive' : 'Active'; - - $filename = $_SERVER['DOCUMENT_ROOT'] . "/activateServer.txt"; - $closed = file_put_contents($filename, $txtResult); - - $i = 0; - - while (!$closed && $i < 10) { - $closed = file_put_contents($filename, $txtResult); - $i++; - } - } -} catch (\Throwable $th) { - //throw $th; -} - -try { - // Update-eli a sync_crm.cron_check tablat, hogy megnezzuk, lefut-e a cron. A check_main_server_cron.php file-ba pedig ellenorizzuk - Database::getInstance()->query("UPDATE sync_crm.cron_check SET modified = ? WHERE id = ?", array('ii', time(), 1)); -} catch (\Throwable $th) { - //throw $th; -} diff --git a/cadline/backend/maintenance/cron_one_minute.php b/cadline/backend/maintenance/cron_one_minute.php deleted file mode 100644 index ef713a82..00000000 --- a/cadline/backend/maintenance/cron_one_minute.php +++ /dev/null @@ -1,790 +0,0 @@ -format('Y-m-d'); -$minutes = $date->format('i'); - -if (($fullDate == '2022-11-22' || $fullDate == '2022-11-23') && ($minutes == '00' || $minutes == '30')) { - $eventDatas = new stdClass(); - $eventDatas->subject = 'Join our event, YouTube link has arrived!'; - $eventDatas->date = $date->format('Y-m-d H:i'); - - $event = new Event($eventDatas); - $sendEmail = $event->sendEventReminder($mailconfig); -}*/ -/* EXPO REMINDER END */ - -/*if (date('Y-m-d H:i') == '2022-06-29 08:00') { - require_once('libraries/phpmailer/PHPMailerAutoload.php'); - require_once('config.mail.php'); - - $query = "SELECT em.email AS user_email, jml_u.name AS user_name - FROM www_archline_hu.alworkshops_application app - LEFT JOIN www_archline_hu.jml_users jml_u ON jml_u.id = app.user_id - LEFT JOIN cl_hlusers.u_emails em ON em.nUserID = jml_u.nUserID - WHERE app.course_id = 1394 AND em.newsletter = 1 - GROUP BY jml_u.nUserID"; - crm_database::getInstance()->query($query); - $res = crm_database::getInstance()->fetchAssoc(); - - foreach ($res as $value) { - $subject = 'Emlékeztető: ARCHLine.XP Középfokú tanfolyam'; - $body = 'Kedves ' . $value['user_name'] . ',

    - - Köszönjük a jelentkezésedet a tanfolyamra. A következő adásunk témája: Tetőtér beépítése

    - - Mikor?
    - 2022. Június 29. 10:00
    - Itt nézheted

    - - Mire lesz szükséged:
    - Győződj meg arról, hogy az eszközön, amin nézni fogod, van hang, továbbá egy YouTube vagy Gmail fiók is kelleni fog, ha szeretnél az adás alatt kommentálni, vagy kérdezni.

    - -
    - - Fontos:
    - Az adást fel fogjuk venni, és később is elérhető lesz a YouTube csatornánkon. Azzal, hogy részt veszel az Élő adáson, elfogadod, hogy a hozzászólásaid láthatóak lesznek a felvett anyagon.

    - - Ha bármi kérdésed van, fordjulj hozzánk az info@cadline.hu email címen

    - - Találkozunk az élő adásban!

    - - - Üdvözlettel, - - A CADLine csapata'; - - $mail = new PHPMailer(); - $mail->CharSet = 'UTF-8'; - $mail->Host = $mailconfig['Host']; - $mail->SMTPAuth = true; - - $mail->Username = $mailconfig['Username']; - $mail->Password = $mailconfig['Password']; - - $mail->From = 'info@cadline.hu'; - $mail->FromName = 'info@cadline.hu'; - $mail->AddAddress($value['user_email'], $value['user_name']); - - $mail->IsHTML(true); - - $mail->Subject = $subject; - $mail->Body = $body; - $mail->Send(); - } - - die(); -}*/ - - -/*if (date('Y-m-d H:i') == '2022-05-18 08:01') { - // define('_JEXEC', 1); - // define('JPATH_BASE', '..'); - - require_once('libraries/phpmailer/PHPMailerAutoload.php'); - require_once('config.mail.php'); - - $query = "SELECT * FROM www_archline_hu.alworkshops_application - WHERE course_id = 1419 GROUP BY email"; - crm_database::getInstance()->query($query); - $res = crm_database::getInstance()->fetchAssoc(); - - foreach ($res as $value) { - $subject = 'Emlékeztető: ARCHLine.XP LIVE 2022 Újdonságok'; - $body = 'Kedves ' . $value['name'] . ',

    - - Köszönjük a jelentkezésedet a webinárra. A következő adásunk témája: ARCHLine.XP LIVE 2022 Újdonságok 2.rész

    - - Mikor?
    - 2022. Május 18. 16:30
    - Itt nézheted

    - - Mire lesz szükséged:
    - Győződj meg arról, hogy az eszközön, amin nézni fogod, van hang, továbbá egy YouTube vagy Gmail fiók is kelleni fog, ha szeretnél az adás alatt kommentálni, vagy kérdezni.

    - -
    - - Fontos:
    - Az adást fel fogjuk venni, és később is elérhető lesz a YouTube csatornánkon. Azzal, hogy részt veszel az Élő adáson, elfogadod, hogy a hozzászólásaid láthatóak lesznek a felvett anyagon.

    - - Ha bármi kérdésed van, fordjulj hozzánk az info@cadline.hu email címen

    - - Találkozunk az élő adásban!

    - - - Üdvözlettel, - - A CADLine csapata'; - - $mail = new PHPMailer(); - $mail->CharSet = 'UTF-8'; - $mail->Host = $mailconfig['Host']; - $mail->SMTPAuth = true; - - $mail->Username = $mailconfig['Username']; - $mail->Password = $mailconfig['Password']; - - $mail->From = 'info@cadline.hu'; - $mail->FromName = 'info@cadline.hu'; - $mail->AddAddress($value['email'], $value['name']); - - $mail->IsHTML(true); - - $mail->Subject = $subject; - $mail->Body = $body; - $mail->Send(); - } - - die(); -}*/ - -/*if (date('Y-m-d H:i') == '2022-05-18 08:02') { - // define('_JEXEC', 1); - // define('JPATH_BASE', '..'); - - require_once('libraries/phpmailer/PHPMailerAutoload.php'); - require_once('config.mail.php'); - - $query = "SELECT * FROM www_archline_hu.alworkshops_application - WHERE course_id = 1420 GROUP BY email"; - crm_database::getInstance()->query($query); - $res = crm_database::getInstance()->fetchAssoc(); - - foreach ($res as $value) { - $subject = 'Reminder: ARCHLine.XP LIVE 2022 New Features'; - $body = "Dear " . $value['name'] . ",

    - - Thank you for signing up to our ARCHLine.XP Webinars

    - - The next show is on
    - 2022. May 18, 3PM CET
    - Watch it here

    - - What you'll need:
    - A device with sound, so that you can hear us. Also, if you want to comment, you will need a Google or YouTube account. You can watch the shows without these accounts, too, but then you won't be able to comment.

    - -
    - - Important:
    - The webinar will be recorded and it will later be added to our archive shows. By joining our webinars, you agree that your contribution (comments) will be visible on the recording.

    - - Should you have any questions, reach out to us on the info@archlinexp.com email address

    - - See you at the show!

    - - - Best wishes, - The CadLine Team"; - - $mail = new PHPMailer(); - $mail->CharSet = 'UTF-8'; - $mail->Host = $mailconfig['Host']; - $mail->SMTPAuth = true; - - $mail->Username = $mailconfig['Username']; - $mail->Password = $mailconfig['Password']; - - $mail->From = 'info@cadline.hu'; - $mail->FromName = 'info@cadline.hu'; - $mail->AddAddress($value['email'], $value['name']); - - $mail->IsHTML(true); - - $mail->Subject = $subject; - $mail->Body = $body; - $mail->Send(); - } - - die(); -}*/ - - - -/* --------------------------------- Masnapi reminder --------------------------------- */ - -/*if (date('Y-m-d H:i') == '2021-11-11 10:00') { - // define('_JEXEC', 1); - // define('JPATH_BASE', '..'); - - require_once('/maintenance/libraries/phpmailer/PHPMailerAutoload.php'); - require_once('/maintenance/config.mail.php'); - - $query = "SELECT * FROM www_archline_hu.alworkshops_application - WHERE course_id = 1289 OR course_id = 1320 GROUP BY email"; - crm_database::getInstance()->query($query); - $res = crm_database::getInstance()->fetchAssoc(); - - foreach ($res as $value) { - $subject = 'Nézd meg újra: Életteli látvány és animáció a LIVE-ban'; - $body = "Helló!
    - Láttad a tegnapi webináriumot a Életteli látvány és animáció a LIVE-ban címmel?
    - Ha igen, reméljük, hogy tetszett! Több időre van szükséged a gyakorláshoz? Nézd meg újra itt: https://youtu.be/HblUO3URDBk

    - - Ha nem láttad, és még mindig érdekel, akkor még itt nézheted meg: https://youtu.be/HblUO3URDBk

    - - - Üdvözlettel,
    - A CADLine csapata"; - - $mail = new PHPMailer(); - $mail->CharSet = 'UTF-8'; - $mail->Host = $mailconfig['Host']; - $mail->SMTPAuth = true; - - $mail->Username = $mailconfig['Username']; - $mail->Password = $mailconfig['Password']; - - $mail->From = 'info@cadline.hu'; - $mail->FromName = 'info@cadline.hu'; - $mail->AddAddress($value['email'], $value['name']); - - $mail->IsHTML(true); - - $mail->Subject = $subject; - $mail->Body = $body; - $mail->Send(); - } - - die(); -}*/ - -/*if (date('Y-m-d H:i') == '2021-11-11 10:01') { - // define('_JEXEC', 1); - // define('JPATH_BASE', '..'); - - require_once('/maintenance/libraries/phpmailer/PHPMailerAutoload.php'); - require_once('/maintenance/config.mail.php'); - - $query = "SELECT * FROM www_archline_hu.alworkshops_application - WHERE course_id = 1288 OR course_id = 1342 GROUP BY email"; - crm_database::getInstance()->query($query); - $res = crm_database::getInstance()->fetchAssoc(); - - foreach ($res as $value) { - $subject = 'Watch it again: Breathtaking visuals and animations in LIVE'; - $body = "Hello!
    - Did you catch the Webinar yesterday about Breathtaking visuals and animations in LIVE?
    - If you did, we hope you enjoyed it! Need more time to practice? Watch it again here: https://youtu.be/ZVUHcWmFfpA

    - - If you missed the show, you can watch it here: https://youtu.be/ZVUHcWmFfpA

    - - - Best wishes,
    - The CadLine Team"; - - $mail = new PHPMailer(); - $mail->CharSet = 'UTF-8'; - $mail->Host = $mailconfig['Host']; - $mail->SMTPAuth = true; - - $mail->Username = $mailconfig['Username']; - $mail->Password = $mailconfig['Password']; - - $mail->From = 'info@cadline.hu'; - $mail->FromName = 'info@cadline.hu'; - $mail->AddAddress($value['email'], $value['name']); - - $mail->IsHTML(true); - - $mail->Subject = $subject; - $mail->Body = $body; - $mail->Send(); - } - - die(); -}*/ - -/*if ($_SERVER['REMOTE_ADDR'] == '82.131.186.171') { - require_once("../common_cadline_libraries/crm_users.class.php"); - require_once('../maintenance/libraries/phpmailer/PHPMailerAutoload.php'); - - $emailTemplate = crm_users::getSevenDayEmailTemplate('mate.nagy@cadline.hu'); - - $mail = new PHPMailer(); - $mail->CharSet = 'UTF-8'; - $mail->Host = $mailconfig['Host']; - $mail->SMTPAuth = true; - - $mail->Username = $mailconfig['Username']; - $mail->Password = $mailconfig['Password']; - - $mail->From = 'info@archlinexp.com'; - $mail->FromName = 'www.archlinexp.com'; - $mail->AddAddress('mate.nagy@cadline.hu'); - - $mail->IsHTML(true); - - $mail->Subject = $emailTemplate['subject']; - $mail->Body = $emailTemplate['body']; - $mail->Send(); - die(); -}*/ - -if (date('H:i') == '10:00') { - require_once("../common_cadline_libraries/crm_users.class.php"); - require_once('../maintenance/libraries/phpmailer/PHPMailerAutoload.php'); - - $date = date('Y-m-d'); - $dateBefore = new DateTime(); - $dateBefore->modify('-30 day'); - $monthDate = $dateBefore->format('Y-m-d'); - - $query = "SELECT * FROM cl_hlusers.u_emails - WHERE newsletter = 1 AND trial_download_date != '' AND trial_download_date >= '{$monthDate}'"; - crm_database::getInstance()->query($query); - $res = crm_database::getInstance()->fetchAssoc(); - - foreach ($res as $value) { - $needEmail = false; - - $day1 = new DateTime($value['trial_download_date']); - $day1->modify('+1 day'); - - $day3 = new DateTime($value['trial_download_date']); - $day3->modify('+3 day'); - - $day7 = new DateTime($value['trial_download_date']); - $day7->modify('+7 day'); - - $day14 = new DateTime($value['trial_download_date']); - $day14->modify('+14 day'); - - $day21 = new DateTime($value['trial_download_date']); - $day21->modify('+21 day'); - - $day24 = new DateTime($value['trial_download_date']); - $day24->modify('+24 day'); - - $day30 = new DateTime($value['trial_download_date']); - $day30->modify('+30 day'); - - if ($day1->format('Y-m-d') == $date) { - $emailTemplate = crm_users::getFirstDayEmailTemplate($value['email']); - $needEmail = true; - } elseif ($day3->format('Y-m-d') == $date) { - $emailTemplate = crm_users::getThreeDayEmailTemplate($value['email']); - $needEmail = true; - } elseif ($day7->format('Y-m-d') == $date) { - $emailTemplate = crm_users::getSevenDayEmailTemplate($value['email']); - $needEmail = true; - } elseif ($day14->format('Y-m-d') == $date) { - $emailTemplate = crm_users::getFourteenDayEmailTemplate($value['email']); - //$needEmail = true; - } elseif ($day21->format('Y-m-d') == $date) { - $emailTemplate = crm_users::getTwentyoneDayEmailTemplate($value['email']); - //$needEmail = true; - } elseif ($day24->format('Y-m-d') == $date) { - $emailTemplate = crm_users::getTwentyfourDayEmailTemplate($value['email']); - //$needEmail = true; - } elseif ($day30->format('Y-m-d') == $date) { - $emailTemplate = crm_users::getLastEmailTemplate($value['email']); - //$needEmail = true; - } - - if ($needEmail) { - $mail = new PHPMailer(); - $mail->CharSet = 'UTF-8'; - $mail->Host = $mailconfig['Host']; - $mail->SMTPAuth = true; - - $mail->Username = $mailconfig['Username']; - $mail->Password = $mailconfig['Password']; - - $mail->From = 'info@archlinexp.com'; - $mail->FromName = 'www.archlinexp.com'; - $mail->AddAddress($value['email'], $value['email']); - - $mail->IsHTML(true); - - $mail->Subject = $emailTemplate['subject']; - $mail->Body = $emailTemplate['body']; - $mail->Send(); - } - } -} - -$action = Tester::getCronTime(); -$timer_result = ''; -$error_result = ''; - -switch ($action) { - case Time::sDay: - if (date('Y-m-d') == '2023-06-01') { - /* NÉMET WEBOLDAL BEGIN */ - $query = "UPDATE www_archline_hu.dtch_menu SET link = 'index.php?option=com_sppagebuilder&view=page&id=46' WHERE id = 131"; - crm_database::getInstance()->query($query); - - $query = "UPDATE www_archline_hu.dtch_menu SET link = 'index.php?option=com_sppagebuilder&view=page&id=47' WHERE id = 283"; - crm_database::getInstance()->query($query); - /* NÉMET WEBOLDAL END */ - - /* ANGOL WEBOLDAL BEGIN */ - $query = "UPDATE www_archline_hu.eng_sh404sef_urls SET rank = 1 WHERE id = 87489"; - crm_database::getInstance()->query($query); - $query = "UPDATE www_archline_hu.eng_sh404sef_urls SET rank = 0 WHERE id = 80561"; - crm_database::getInstance()->query($query); - - $query = "UPDATE www_archline_hu.eng_sh404sef_urls SET rank = 1 WHERE id = 86094"; - crm_database::getInstance()->query($query); - $query = "UPDATE www_archline_hu.eng_sh404sef_urls SET rank = 0 WHERE id = 79698"; - crm_database::getInstance()->query($query); - /* ANGOL WEBOLDAL END */ - - /*$query = "UPDATE cl_hlusers.o_products SET ackio_date = '2023-05-31' WHERE lang = 0 AND id >= 1288;"; - crm_database::getInstance()->query($query);*/ - } - - $date = new DateTime(); - $date->modify("-14 day"); - $day = $date->format("Y-m-d"); - - $deleteFloatingLog = "DELETE FROM local_crm.floating_log WHERE substr(inserted, 1, 10) <= '{$day}'"; - Database::getInstance()->query($deleteFloatingLog); - - Tester::syncSwitchTable(); - - $time_start = microtime(true); - $error_result .= Tester::oneDay(); - $timer_result .= 'One day: ' . Tester::calculateElapsedTime($time_start) . '\n'; - - case Time::sTwelveHour: - $time_start = microtime(true); - $error_result .= Tester::twelveHour(); - $timer_result .= 'Twelve hour: ' . Tester::calculateElapsedTime($time_start) . '\n'; - - case Time::sSixHour: - $time_start = microtime(true); - $error_result .= Tester::sixHour(); - $timer_result .= 'Six hour: ' . Tester::calculateElapsedTime($time_start) . '\n'; - - case Time::sThreeHour: - $time_start = microtime(true); - $error_result .= Tester::threeHour(); - $timer_result .= 'Three hour: ' . Tester::calculateElapsedTime($time_start) . '\n'; - - case Time::sHour: - $time_start = microtime(true); - $error_result .= Tester::oneHour(); - $timer_result .= 'One hour: ' . Tester::calculateElapsedTime($time_start) . '\n'; - - case Time::sFifteenMin: - $time_start = microtime(true); - $error_result .= Tester::fifteenMinutes(); - $timer_result .= 'Fifteen minutes: ' . Tester::calculateElapsedTime($time_start) . '\n'; - - case Time::sFiveMin: - $time_start = microtime(true); - $error_result .= Tester::fiveMinutes(); - $timer_result .= 'Five minutes: ' . Tester::calculateElapsedTime($time_start) . '\n'; - - case Time::sMin: - $time_start = microtime(true); - $error_result .= Tester::oneMinute(); - $timer_result .= 'One minute: ' . Tester::calculateElapsedTime($time_start) . '\n'; - - /* Update Templates */ - /*$json = '{ - "preloader": "0", - "preloader_animation": "circle", - "preloader_bg": "#f5f5f5", - "preloader_tx": "#333333", - "goto_top": "0", - "sticky_header": "1", - "favicon": "public/DIAMOND_YELLOW.png", - "boxed_layout": "0", - "logo_type": "image", - "logo_position": "logo", - "logo_load_pos": "default", - "logo_image": "public/Logo_corner_up.png", - "logo_image_2x": "public/Logo_corner_up.png", - "mobile_logo": "public/Logo_corner_up.png", - "logo_text": "Trada", - "logo_slogan": "", - "body_bg_image": "", - "body_bg_repeat": "inherit", - "body_bg_size": "inherit", - "body_bg_attachment": "inherit", - "body_bg_position": "0 0", - "enabled_copyright": "0", - "copyright_position": "footer1", - "copyright_load_pos": "default", - "copyright": "© 2024 CadLine Kft. Minden jog fenntartva. Adatvédelmi nyilatkozat", - "show_social_icons": "1", - "social_position": "top1", - "social_load_pos": "default", - "facebook": "", - "twitter": "", - "googleplus": "", - "pinterest": "", - "linkedin": "", - "dribbble": "", - "behance": "", - "youtube": "", - "flickr": "", - "skype": "", - "whatsapp": "", - "vk": "", - "custom": "", - "enable_contactinfo": "1", - "contact_position": "top2", - "contact_phone": "", - "contact_mobile": "", - "contact_email": "", - "contact_time": "", - "comingsoon_mode": "0", - "comingsoon_bg": "", - "comingsoon_logo": "", - "comingsoon_title": "Coming Soon Title", - "comingsoon_date": "05-10-2018", - "comingsoon_content": "Coming soon content", - "error_bg": "", - "error_logo": "", - "preset": "preset2", - "preset1_bg": "#ffffff", - "preset1_text": "#000000", - "preset1_major": "#b8955d", - "preset1_megabg": "#ffffff", - "preset1_megatx": "#333333", - "preset2_bg": "#ffffff", - "preset2_text": "#000000", - "preset2_major": "#f1c40f", - "preset2_megabg": "#ffffff", - "preset2_megatx": "#333333", - "preset3_bg": "#ffffff", - "preset3_text": "#000000", - "preset3_major": "#b8955d", - "preset3_megabg": "#ffffff", - "preset3_megatx": "#333333", - "preset4_bg": "#ffffff", - "preset4_text": "#000000", - "preset4_major": "#b8312f", - "preset4_megabg": "#ffffff", - "preset4_megatx": "#333333", - "layoutlist": "default.json", - "layout": "[{\"type\":\"row\",\"layout\":\"282\",\"settings\":{\"name\":\"Header\",\"background_color\":\"\",\"color\":\"\",\"background_image\":\"\",\"link_color\":\"\",\"link_hover_color\":\"\",\"hidden_xs\":0,\"hidden_sm\":0,\"hidden_md\":0,\"padding\":\"\",\"margin\":\"\",\"fluidrow\":1,\"custom_class\":\"\"},\"attr\":[{\"type\":\"sp_col\",\"className\":\"layout-column col-sm-2\",\"settings\":{\"md_hidden\":0,\"ms_hidden\":0,\"xs_hidden\":0,\"custom_class\":\"\",\"xs_col\":\"col-xs-8\",\"sm_col\":\"\",\"hidden_md\":0,\"hidden_sm\":0,\"hidden_xs\":0,\"name\":\"logo\",\"column_type\":0,\"sortableitem\":\"[object Object]\"}},{\"type\":\"sp_col\",\"className\":\"layout-column col-sm-8\",\"settings\":{\"custom_class\":\"\",\"md_hidden\":0,\"ms_hidden\":0,\"xs_hidden\":0,\"name\":\"menu\",\"column_type\":0,\"hidden_xs\":0,\"hidden_sm\":0,\"hidden_md\":0,\"sm_col\":\"\",\"xs_col\":\"col-xs-2\",\"sortableitem\":\"[object Object]\"}},{\"type\":\"sp_col\",\"className\":\"layout-column col-sm-2\",\"settings\":{\"column_type\":0,\"name\":\"search-popup\",\"hidden_xs\":1,\"hidden_sm\":0,\"hidden_md\":0,\"sm_col\":\"\",\"xs_col\":\"\",\"custom_class\":\"\"}}]},{\"type\":\"row\",\"layout\":12,\"settings\":{\"custom_class\":\"\",\"fluidrow\":1,\"margin\":\"\",\"padding\":\"\",\"hidden_md\":0,\"hidden_sm\":0,\"hidden_xs\":0,\"link_hover_color\":\"\",\"link_color\":\"\",\"background_image\":\"\",\"color\":\"\",\"background_color\":\"\",\"name\":\"Page Title\"},\"attr\":[{\"type\":\"sp_col\",\"className\":\"layout-column col-sm-12\",\"settings\":{\"custom_class\":\"\",\"xs_col\":\"\",\"sm_col\":\"\",\"hidden_md\":0,\"hidden_sm\":0,\"hidden_xs\":0,\"name\":\"title\",\"column_type\":0}}]},{\"type\":\"row\",\"layout\":12,\"settings\":{\"custom_class\":\"\",\"fluidrow\":0,\"margin\":\"\",\"padding\":\"\",\"hidden_md\":0,\"hidden_sm\":0,\"hidden_xs\":0,\"link_hover_color\":\"\",\"link_color\":\"\",\"background_image\":\"\",\"color\":\"\",\"background_color\":\"\",\"name\":\"Body Top\"},\"attr\":[{\"type\":\"sp_col\",\"className\":\"layout-column col-sm-12\",\"settings\":{\"custom_class\":\"\",\"xs_col\":\"\",\"sm_col\":\"\",\"hidden_md\":0,\"hidden_sm\":0,\"hidden_xs\":0,\"name\":\"position-2\",\"column_type\":0}}]},{\"type\":\"row\",\"layout\":\"363\",\"settings\":{\"name\":\"Main Body\",\"link_color\":\"\",\"link_hover_color\":\"\",\"custom_class\":\"\",\"md_hidden\":0,\"ms_hidden\":0,\"xs_hidden\":0,\"text_color\":\"\",\"bg_image\":\"\",\"bg_color\":\"\"},\"attr\":[{\"type\":\"sp_col\",\"className\":\"layout-column col-sm-3\",\"settings\":{\"column_type\":0,\"name\":\"left\",\"xs_hidden\":0,\"ms_hidden\":0,\"md_hidden\":0,\"custom_class\":\"custom-class\",\"sortableitem\":\"[object Object]\"}},{\"type\":\"sp_col\",\"className\":\"layout-column col-sm-6\",\"settings\":{\"column_type\":1,\"name\":\"\",\"custom_class\":\"\",\"md_hidden\":0,\"ms_hidden\":0,\"xs_hidden\":0,\"sortableitem\":\"[object Object]\"}},{\"type\":\"sp_col\",\"className\":\"layout-column col-sm-3\",\"settings\":{\"custom_class\":\"class2\",\"md_hidden\":0,\"ms_hidden\":0,\"xs_hidden\":0,\"name\":\"right\",\"column_type\":0,\"sortableitem\":\"[object Object]\"}}]},{\"type\":\"row\",\"layout\":12,\"settings\":{\"name\":\"Hónap képe gomb\",\"background_color\":\"\",\"color\":\"\",\"background_image\":\"\",\"link_color\":\"\",\"link_hover_color\":\"\",\"hidden_xs\":0,\"hidden_sm\":0,\"hidden_md\":0,\"padding\":\"\",\"margin\":\"-100px 0px 50px 0px\",\"fluidrow\":1,\"custom_class\":\"\"},\"attr\":[{\"type\":\"sp_col\",\"className\":\"layout-column col-sm-12 column-active\",\"settings\":{\"custom_class\":\"\",\"xs_col\":\"\",\"sm_col\":\"\",\"hidden_md\":0,\"hidden_sm\":0,\"hidden_xs\":0,\"name\":\"position8\",\"column_type\":0}}]},{\"type\":\"row\",\"layout\":\"3333\",\"settings\":{\"name\":\"Bottom\",\"background_color\":\"#f5f5f5\",\"color\":\"\",\"background_image\":\"\",\"link_color\":\"\",\"link_hover_color\":\"\",\"hidden_xs\":0,\"hidden_sm\":0,\"hidden_md\":0,\"padding\":\"100px 0px\",\"margin\":\"\",\"fluidrow\":0,\"custom_class\":\"\"},\"attr\":[{\"type\":\"sp_col\",\"className\":\"layout-column col-sm-3\",\"settings\":{\"column_type\":0,\"name\":\"bottom1\",\"hidden_xs\":0,\"hidden_sm\":0,\"hidden_md\":0,\"sm_col\":\"col-sm-6\",\"xs_col\":\"\",\"custom_class\":\"\",\"sortableitem\":\"[object Object]\"}},{\"type\":\"sp_col\",\"className\":\"layout-column col-sm-3\",\"settings\":{\"custom_class\":\"\",\"xs_col\":\"\",\"sm_col\":\"col-sm-6\",\"hidden_md\":0,\"hidden_sm\":0,\"hidden_xs\":0,\"name\":\"bottom2\",\"column_type\":0}},{\"type\":\"sp_col\",\"className\":\"layout-column col-sm-3\",\"settings\":{\"custom_class\":\"\",\"xs_col\":\"\",\"sm_col\":\"col-sm-6\",\"hidden_md\":0,\"hidden_sm\":0,\"hidden_xs\":0,\"name\":\"bottom3\",\"column_type\":0}},{\"type\":\"sp_col\",\"className\":\"layout-column col-sm-3\",\"settings\":{\"custom_class\":\"\",\"xs_col\":\"\",\"sm_col\":\"col-sm-6\",\"hidden_md\":0,\"hidden_sm\":0,\"hidden_xs\":0,\"name\":\"bottom4\",\"column_type\":0}}]},{\"type\":\"row\",\"layout\":12,\"settings\":{\"custom_class\":\"\",\"fluidrow\":0,\"margin\":\"\",\"padding\":\"\",\"hidden_md\":0,\"hidden_sm\":0,\"hidden_xs\":0,\"link_hover_color\":\"\",\"link_color\":\"\",\"background_image\":\"\",\"color\":\"\",\"background_color\":\"#202020\",\"name\":\"Footer Box\"},\"attr\":[{\"type\":\"sp_col\",\"className\":\"layout-column col-sm-12\",\"settings\":{\"column_type\":0,\"name\":\"footer2\",\"hidden_xs\":0,\"hidden_sm\":0,\"hidden_md\":0,\"sm_col\":\"\",\"xs_col\":\"\",\"custom_class\":\"\"}}]},{\"type\":\"row\",\"layout\":12,\"settings\":{\"custom_class\":\"\",\"fluidrow\":0,\"margin\":\"\",\"padding\":\"\",\"hidden_md\":0,\"hidden_sm\":0,\"hidden_xs\":0,\"link_hover_color\":\"\",\"link_color\":\"\",\"background_image\":\"public/img/honapkepe/202309/Arch_ElvalasztoStrips_1920_730px_Footer_01.png\",\"color\":\"#ffffff\",\"background_color\":\"\",\"name\":\"Footer - NEW\"},\"attr\":[{\"type\":\"sp_col\",\"className\":\"layout-column col-sm-12\",\"settings\":{\"custom_class\":\"\",\"xs_col\":\"\",\"sm_col\":\"\",\"hidden_md\":0,\"hidden_sm\":0,\"hidden_xs\":0,\"name\":\"footer1\",\"column_type\":0}}]}]", - "menu": "mainmenu", - "menu_type": "mega", - "dropdown_width": "250", - "menu_animation": "none", - "offcanvas_animation": "default", - "enable_body_font": "1", - "body_font": "{\"fontFamily\":\"Raleway\",\"fontWeight\":\"500\",\"fontSubset\":\"latin\",\"fontSize\":\"14\"}", - "enable_h1_font": "1", - "h1_font": "{\"fontFamily\":\"Raleway\",\"fontWeight\":\"500\",\"fontSubset\":\"latin\",\"fontSize\":\"36\"}", - "enable_h2_font": "1", - "h2_font": "{\"fontFamily\":\"Raleway\",\"fontWeight\":\"500\",\"fontSubset\":\"latin\",\"fontSize\":\"30\"}", - "enable_h3_font": "1", - "h3_font": "{\"fontFamily\":\"Raleway\",\"fontWeight\":\"500\",\"fontSubset\":\"latin\",\"fontSize\":\"26\"}", - "enable_h4_font": "1", - "h4_font": "{\"fontFamily\":\"Raleway\",\"fontWeight\":\"500\",\"fontSubset\":\"latin\",\"fontSize\":\"22\"}", - "enable_h5_font": "1", - "h5_font": "{\"fontFamily\":\"Raleway\",\"fontWeight\":\"500\",\"fontSubset\":\"latin\",\"fontSize\":\"18\"}", - "enable_h6_font": "1", - "h6_font": "{\"fontFamily\":\"Raleway\",\"fontWeight\":\"500\",\"fontSubset\":\"latin\",\"fontSize\":\"16\"}", - "enable_navigation_font": "0", - "navigation_font": "{\"fontFamily\":\"ABeeZee\",\"fontWeight\":\"regular\",\"fontSubset\":\"latin\",\"fontSize\":\"\"}", - "enable_custom_font": "1", - "custom_font": "{\"fontFamily\":\"Raleway\",\"fontWeight\":\"500\",\"fontSubset\":\"latin\",\"fontSize\":\"14\"}", - "custom_font_selectors": "p,span,ul,li,ol,div,td", - "before_head": "", - "before_body": "", - "custom_css": "", - "custom_js": "", - "compress_css": "0", - "compress_js": "0", - "exclude_js": "", - "lessoption": "0", - "show_post_format": "0", - "commenting_engine": "disabled", - "disqus_subdomain": "", - "disqus_devmode": "0", - "intensedebate_acc": "", - "fb_appID": "", - "fb_width": "500", - "fb_cpp": "10", - "comments_count": "0", - "social_share": "0", - "image_small": "0", - "image_small_size": "100X100", - "image_thumbnail": "1", - "image_thumbnail_size": "200X200", - "image_medium": "0", - "image_medium_size": "300X300", - "image_large": "0", - "image_large_size": "600X600", - "blog_list_image": "default" - }'; - - $json = preg_replace('/\s+/', '', $json); - $array = json_decode($json, true); - $json = json_encode($array, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); - $escaped = json_encode($json); - $json = trim($escaped, '"'); - - $updateQuery = "UPDATE www_archline_hu.jml_template_styles SET params = '{$json}' WHERE id = 11"; - crm_database::getInstance()->query($updateQuery); - - $json = '{ - "preloader": "0", - "preloader_animation": "circle", - "preloader_bg": "#f5f5f5", - "preloader_tx": "#333333", - "goto_top": "0", - "sticky_header": "1", - "favicon": "public/DIAMOND_YELLOW.png", - "boxed_layout": "0", - "logo_type": "image", - "logo_position": "logo", - "logo_load_pos": "default", - "logo_image": "public/Logo_corner_up.png", - "logo_image_2x": "public/Logo_corner_up.png", - "mobile_logo": "public/Logo_corner_up.png", - "logo_text": "Trada", - "logo_slogan": "", - "body_bg_image": "", - "body_bg_repeat": "inherit", - "body_bg_size": "inherit", - "body_bg_attachment": "inherit", - "body_bg_position": "0 0", - "enabled_copyright": "0", - "copyright_position": "footer1", - "copyright_load_pos": "default", - "copyright": "© 2023 CadLine Kft. All rights reserved. Privacy Policy", - "show_social_icons": "1", - "social_position": "top1", - "social_load_pos": "default", - "facebook": "", - "twitter": "", - "googleplus": "", - "pinterest": "", - "linkedin": "", - "dribbble": "", - "behance": "", - "youtube": "", - "flickr": "", - "skype": "", - "whatsapp": "", - "vk": "", - "custom": "", - "enable_contactinfo": "1", - "contact_position": "top2", - "contact_phone": "", - "contact_mobile": "", - "contact_email": "", - "contact_time": "", - "comingsoon_mode": "0", - "comingsoon_bg": "", - "comingsoon_logo": "", - "comingsoon_title": "Coming Soon Title", - "comingsoon_date": "05-10-2018", - "comingsoon_content": "Coming soon content", - "error_bg": "", - "error_logo": "", - "preset": "preset5", - "preset1_bg": "#ffffff", - "preset1_text": "#000000", - "preset1_major": "#b8955d", - "preset1_megabg": "#ffffff", - "preset1_megatx": "#333333", - "preset2_bg": "#ffffff", - "preset2_text": "#000000", - "preset2_major": "#f1c40f", - "preset2_megabg": "#ffffff", - "preset2_megatx": "#333333", - "preset3_bg": "#ffffff", - "preset3_text": "#000000", - "preset3_major": "#b8955d", - "preset3_megabg": "#ffffff", - "preset3_megatx": "#333333", - "preset4_bg": "#ffffff", - "preset4_text": "#000000", - "preset4_major": "#b8312f", - "preset4_megabg": "#ffffff", - "preset4_megatx": "#333333", - "layoutlist": "default.json", - "layout": "[{\"type\":\"row\",\"layout\":\"282\",\"settings\":{\"custom_class\":\"\",\"fluidrow\":1,\"margin\":\"\",\"padding\":\"\",\"hidden_md\":0,\"hidden_sm\":0,\"hidden_xs\":0,\"link_hover_color\":\"\",\"link_color\":\"\",\"background_image\":\"\",\"color\":\"\",\"background_color\":\"\",\"name\":\"Header\"},\"attr\":[{\"type\":\"sp_col\",\"className\":\"layout-column col-sm-2\",\"settings\":{\"sortableitem\":\"[object Object]\",\"md_hidden\":0,\"ms_hidden\":0,\"xs_hidden\":0,\"custom_class\":\"\",\"xs_col\":\"col-xs-8\",\"sm_col\":\"\",\"hidden_md\":0,\"hidden_sm\":0,\"hidden_xs\":0,\"name\":\"logo\",\"column_type\":0}},{\"type\":\"sp_col\",\"className\":\"layout-column col-sm-8\",\"settings\":{\"sortableitem\":\"[object Object]\",\"md_hidden\":0,\"ms_hidden\":0,\"xs_hidden\":0,\"custom_class\":\"\",\"xs_col\":\"col-xs-2\",\"sm_col\":\"\",\"hidden_md\":0,\"hidden_sm\":0,\"hidden_xs\":0,\"name\":\"menu\",\"column_type\":0}},{\"type\":\"sp_col\",\"className\":\"layout-column col-sm-2\",\"settings\":{\"column_type\":0,\"name\":\"search-popup\",\"hidden_xs\":1,\"hidden_sm\":0,\"hidden_md\":0,\"sm_col\":\"\",\"xs_col\":\"\",\"custom_class\":\"\"}}]},{\"type\":\"row\",\"layout\":12,\"settings\":{\"background_position\":\"50% 50%\",\"background_size\":\"cover\",\"name\":\"Banner\",\"background_color\":\"\",\"color\":\"\",\"background_image\":\"\",\"link_color\":\"\",\"link_hover_color\":\"\",\"hidden_xs\":0,\"hidden_sm\":0,\"hidden_md\":0,\"padding\":\"\",\"margin\":\"0px 0px 20px 0px\",\"fluidrow\":1,\"custom_class\":\"\"},\"attr\":[{\"type\":\"sp_col\",\"className\":\"layout-column col-sm-12\",\"settings\":{\"column_type\":0,\"name\":\"position-3\",\"hidden_xs\":0,\"hidden_sm\":0,\"hidden_md\":0,\"sm_col\":\"\",\"xs_col\":\"\",\"custom_class\":\"\"}}]},{\"type\":\"row\",\"layout\":12,\"settings\":{\"custom_class\":\"\",\"fluidrow\":0,\"margin\":\"\",\"padding\":\"\",\"hidden_md\":0,\"hidden_sm\":0,\"hidden_xs\":0,\"link_hover_color\":\"\",\"link_color\":\"\",\"background_image\":\"\",\"color\":\"\",\"background_color\":\"\",\"name\":\"Body Top\"},\"attr\":[{\"type\":\"sp_col\",\"className\":\"layout-column col-sm-12\",\"settings\":{\"custom_class\":\"\",\"xs_col\":\"\",\"sm_col\":\"\",\"hidden_md\":0,\"hidden_sm\":0,\"hidden_xs\":0,\"name\":\"position-2\",\"column_type\":0}}]},{\"type\":\"row\",\"layout\":12,\"settings\":{\"name\":\"Page Title\",\"background_color\":\"\",\"color\":\"\",\"background_image\":\"\",\"link_color\":\"\",\"link_hover_color\":\"\",\"hidden_xs\":0,\"hidden_sm\":0,\"hidden_md\":0,\"padding\":\"\",\"margin\":\"\",\"fluidrow\":1,\"custom_class\":\"\"},\"attr\":[{\"type\":\"sp_col\",\"className\":\"layout-column col-sm-12\",\"settings\":{\"column_type\":0,\"name\":\"title\",\"hidden_xs\":0,\"hidden_sm\":0,\"hidden_md\":0,\"sm_col\":\"\",\"xs_col\":\"\",\"custom_class\":\"\"}}]},{\"type\":\"row\",\"layout\":\"363\",\"settings\":{\"name\":\"Main Body\",\"bg_color\":\"\",\"bg_image\":\"\",\"text_color\":\"\",\"link_color\":\"\",\"link_hover_color\":\"\",\"xs_hidden\":0,\"ms_hidden\":0,\"md_hidden\":0,\"custom_class\":\"\"},\"attr\":[{\"type\":\"sp_col\",\"className\":\"layout-column col-sm-3\",\"settings\":{\"sortableitem\":\"[object Object]\",\"custom_class\":\"custom-class\",\"md_hidden\":0,\"ms_hidden\":0,\"xs_hidden\":0,\"name\":\"left\",\"column_type\":0}},{\"type\":\"sp_col\",\"className\":\"layout-column col-sm-6\",\"settings\":{\"sortableitem\":\"[object Object]\",\"xs_hidden\":0,\"ms_hidden\":0,\"md_hidden\":0,\"custom_class\":\"\",\"name\":\"\",\"column_type\":1}},{\"type\":\"sp_col\",\"className\":\"layout-column col-sm-3\",\"settings\":{\"xs_col\":\"\",\"sm_col\":\"\",\"hidden_md\":0,\"hidden_sm\":0,\"hidden_xs\":0,\"sortableitem\":\"[object Object]\",\"column_type\":0,\"name\":\"right\",\"xs_hidden\":0,\"ms_hidden\":0,\"md_hidden\":0,\"custom_class\":\"class2\"}}]},{\"type\":\"row\",\"layout\":\"3333\",\"settings\":{\"custom_class\":\"\",\"fluidrow\":0,\"margin\":\"\",\"padding\":\"100px 0px\",\"hidden_md\":0,\"hidden_sm\":0,\"hidden_xs\":0,\"link_hover_color\":\"\",\"link_color\":\"\",\"background_image\":\"\",\"color\":\"\",\"background_color\":\"#f5f5f5\",\"name\":\"Bottom\"},\"attr\":[{\"type\":\"sp_col\",\"className\":\"layout-column col-sm-3\",\"settings\":{\"sortableitem\":\"[object Object]\",\"custom_class\":\"\",\"xs_col\":\"\",\"sm_col\":\"col-sm-6\",\"hidden_md\":0,\"hidden_sm\":0,\"hidden_xs\":0,\"name\":\"bottom1\",\"column_type\":0}},{\"type\":\"sp_col\",\"className\":\"layout-column col-sm-3\",\"settings\":{\"column_type\":0,\"name\":\"bottom2\",\"hidden_xs\":0,\"hidden_sm\":0,\"hidden_md\":0,\"sm_col\":\"col-sm-6\",\"xs_col\":\"\",\"custom_class\":\"\"}},{\"type\":\"sp_col\",\"className\":\"layout-column col-sm-3\",\"settings\":{\"column_type\":0,\"name\":\"bottom3\",\"hidden_xs\":0,\"hidden_sm\":0,\"hidden_md\":0,\"sm_col\":\"col-sm-6\",\"xs_col\":\"\",\"custom_class\":\"\"}},{\"type\":\"sp_col\",\"className\":\"layout-column col-sm-3\",\"settings\":{\"column_type\":0,\"name\":\"bottom4\",\"hidden_xs\":0,\"hidden_sm\":0,\"hidden_md\":0,\"sm_col\":\"col-sm-6\",\"xs_col\":\"\",\"custom_class\":\"\"}}]},{\"type\":\"row\",\"layout\":12,\"settings\":{\"custom_class\":\"\",\"fluidrow\":0,\"margin\":\"\",\"padding\":\"\",\"hidden_md\":0,\"hidden_sm\":0,\"hidden_xs\":0,\"link_hover_color\":\"\",\"link_color\":\"\",\"background_image\":\"\",\"color\":\"\",\"background_color\":\"#202020\",\"name\":\"Footer Box\"},\"attr\":[{\"type\":\"sp_col\",\"className\":\"layout-column col-sm-12\",\"settings\":{\"custom_class\":\"\",\"xs_col\":\"\",\"sm_col\":\"\",\"hidden_md\":0,\"hidden_sm\":0,\"hidden_xs\":0,\"name\":\"footer2\",\"column_type\":0}}]},{\"type\":\"row\",\"layout\":12,\"settings\":{\"name\":\"Footer - New\",\"background_color\":\"\",\"color\":\"#ffffff\",\"background_image\":\"public/img/honapkepe/202309/Arch_ElvalasztoStrips_1920_730px_Footer_01.png\",\"link_color\":\"\",\"link_hover_color\":\"\",\"hidden_xs\":0,\"hidden_sm\":0,\"hidden_md\":0,\"padding\":\"\",\"margin\":\"\",\"fluidrow\":0,\"custom_class\":\"\"},\"attr\":[{\"type\":\"sp_col\",\"className\":\"layout-column col-sm-12\",\"settings\":{\"column_type\":0,\"name\":\"feature\",\"hidden_xs\":0,\"hidden_sm\":0,\"hidden_md\":0,\"sm_col\":\"\",\"xs_col\":\"\",\"custom_class\":\"\"}}]},{\"type\":\"row\",\"layout\":12,\"settings\":{\"bg_color\":\"\",\"bg_image\":\"\",\"text_color\":\"\",\"xs_hidden\":0,\"ms_hidden\":0,\"md_hidden\":0,\"custom_class\":\"\",\"fluidrow\":0,\"margin\":\"\",\"padding\":\"\",\"hidden_md\":0,\"hidden_sm\":0,\"hidden_xs\":0,\"link_hover_color\":\"\",\"link_color\":\"\",\"background_image\":\"\",\"color\":\"\",\"background_color\":\"#1a1a1a\",\"name\":\"Footer\"},\"attr\":[{\"type\":\"sp_col\",\"className\":\"layout-column col-sm-12 column-active\",\"settings\":{\"sortableitem\":\"[object Object]\",\"custom_class\":\"\",\"md_hidden\":0,\"ms_hidden\":0,\"xs_hidden\":0,\"name\":\"footer1\",\"column_type\":0,\"hidden_xs\":1,\"hidden_sm\":1,\"hidden_md\":1,\"sm_col\":\"\",\"xs_col\":\"\"}}]}]", - "menu": "mainmenu", - "menu_type": "mega", - "dropdown_width": "300", - "menu_animation": "menu-fade", - "offcanvas_animation": "default", - "enable_body_font": "1", - "body_font": "{\"fontFamily\":\"Raleway\",\"fontWeight\":\"500\",\"fontSubset\":\"latin\",\"fontSize\":\"14\"}", - "enable_h1_font": "1", - "h1_font": "{\"fontFamily\":\"Raleway\",\"fontWeight\":\"500\",\"fontSubset\":\"latin\",\"fontSize\":\"36\"}", - "enable_h2_font": "1", - "h2_font": "{\"fontFamily\":\"Raleway\",\"fontWeight\":\"500\",\"fontSubset\":\"latin\",\"fontSize\":\"30\"}", - "enable_h3_font": "1", - "h3_font": "{\"fontFamily\":\"Raleway\",\"fontWeight\":\"500\",\"fontSubset\":\"latin\",\"fontSize\":\"26\"}", - "enable_h4_font": "1", - "h4_font": "{\"fontFamily\":\"Raleway\",\"fontWeight\":\"500\",\"fontSubset\":\"latin\",\"fontSize\":\"22\"}", - "enable_h5_font": "1", - "h5_font": "{\"fontFamily\":\"Raleway\",\"fontWeight\":\"500\",\"fontSubset\":\"latin\",\"fontSize\":\"18\"}", - "enable_h6_font": "1", - "h6_font": "{\"fontFamily\":\"Raleway\",\"fontWeight\":\"500\",\"fontSubset\":\"latin\",\"fontSize\":\"16\"}", - "enable_navigation_font": "0", - "navigation_font": "{\"fontFamily\":\"ABeeZee\",\"fontWeight\":\"regular\",\"fontSubset\":\"latin\",\"fontSize\":\"\"}", - "enable_custom_font": "1", - "custom_font": "{\"fontFamily\":\"Raleway\",\"fontWeight\":\"500\",\"fontSubset\":\"latin\",\"fontSize\":\"14\"}", - "custom_font_selectors": "p,span,ul,li,ol,div,td", - "before_head": "", - "before_body": "", - "custom_css": "", - "custom_js": "", - "compress_css": "0", - "compress_js": "0", - "exclude_js": "", - "lessoption": "0", - "show_post_format": "0", - "commenting_engine": "disabled", - "disqus_subdomain": "", - "disqus_devmode": "0", - "intensedebate_acc": "", - "fb_appID": "", - "fb_width": "500", - "fb_cpp": "10", - "comments_count": "0", - "social_share": "0", - "image_small": "0", - "image_small_size": "100X100", - "image_thumbnail": "1", - "image_thumbnail_size": "200X200", - "image_medium": "0", - "image_medium_size": "300X300", - "image_large": "0", - "image_large_size": "600X600", - "blog_list_image": "default" - }'; - - $json = preg_replace('/\s+/', '', $json); - $array = json_decode($json, true); - $json = json_encode($array, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); - $escaped = json_encode($json); - $json = trim($escaped, '"'); - - $updateQuery = "UPDATE www_archline_hu.eng_template_styles SET params = '{$json}' WHERE id = 11"; - crm_database::getInstance()->query($updateQuery);*/ - break; - - default: - - break; -} - -if ($error_result != '') { - $message = str_replace('\n', '
    ', $error_result); - $message .= str_replace('\n', '
    ', $timer_result); - $headers = 'MIME-Version: 1.0' . "\r\n"; - $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; - $headers .= 'Cc: bodnart@cadline.hu'; - mail("mate.nagy@cadline.hu", "Auto CRM test", $message, $headers); -} - -// Update-eli a cron_check tablat, hogy megnezzuk, lefut-e a cron. A cron_check.php file-ba pedig ellenorizzuk -Database::getInstance()->query("UPDATE cl_hlusers.cron_check SET modified = ? WHERE id = ?", array('ii', time(), 1)); diff --git a/cadline/backend/maintenance/css/bootstrap.min.css b/cadline/backend/maintenance/css/bootstrap.min.css deleted file mode 100644 index 4206e3f5..00000000 --- a/cadline/backend/maintenance/css/bootstrap.min.css +++ /dev/null @@ -1,8296 +0,0 @@ -/*! - * Bootstrap v3.3.7 (http://getbootstrap.com) - * Copyright 2011-2016 Twitter, Inc. - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - */ -/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */ -html { - font-family: sans-serif; - -webkit-text-size-adjust: 100%; - -ms-text-size-adjust: 100% -} - -body { - margin: 0 -} - -article, -aside, -details, -figcaption, -figure, -footer, -header, -hgroup, -main, -menu, -nav, -section, -summary { - display: block -} - -audio, -canvas, -progress, -video { - display: inline-block; - vertical-align: baseline -} - -audio:not([controls]) { - display: none; - height: 0 -} - -[hidden], -template { - display: none -} - -a { - background-color: transparent -} - -a:active, -a:hover { - outline: 0 -} - -abbr[title] { - border-bottom: 1px dotted -} - -b, -strong { - font-weight: 700 -} - -dfn { - font-style: italic -} - -h1 { - margin: .67em 0; - font-size: 2em -} - -mark { - color: #000; - background: #ff0 -} - -small { - font-size: 80% -} - -sub, -sup { - position: relative; - font-size: 75%; - line-height: 0; - vertical-align: baseline -} - -sup { - top: -.5em -} - -sub { - bottom: -.25em -} - -img { - border: 0 -} - -svg:not(:root) { - overflow: hidden -} - -figure { - margin: 1em 40px -} - -hr { - height: 0; - -webkit-box-sizing: content-box; - -moz-box-sizing: content-box; - box-sizing: content-box -} - -pre { - overflow: auto -} - -code, -kbd, -pre, -samp { - font-family: monospace, monospace; - font-size: 1em -} - -button, -input, -optgroup, -select, -textarea { - margin: 0; - font: inherit; - color: inherit -} - -button { - overflow: visible -} - -button, -select { - text-transform: none -} - -button, -html input[type=button], -input[type=reset], -input[type=submit] { - -webkit-appearance: button; - cursor: pointer -} - -button[disabled], -html input[disabled] { - cursor: default -} - -button::-moz-focus-inner, -input::-moz-focus-inner { - padding: 0; - border: 0 -} - -input { - line-height: normal -} - -input[type=checkbox], -input[type=radio] { - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; - padding: 0 -} - -input[type=number]::-webkit-inner-spin-button, -input[type=number]::-webkit-outer-spin-button { - height: auto -} - -input[type=search] { - -webkit-box-sizing: content-box; - -moz-box-sizing: content-box; - box-sizing: content-box; - -webkit-appearance: textfield -} - -input[type=search]::-webkit-search-cancel-button, -input[type=search]::-webkit-search-decoration { - -webkit-appearance: none -} - -fieldset { - padding: .35em .625em .75em; - margin: 0 2px; - border: 1px solid silver -} - -legend { - padding: 0; - border: 0 -} - -textarea { - overflow: auto -} - -optgroup { - font-weight: 700 -} - -table { - border-spacing: 0; - border-collapse: collapse -} - -td, -th { - padding: 0 -} - -/*! Source: https://github.com/h5bp/html5-boilerplate/blob/master/src/css/main.css */ -@media print { - - *, - :after, - :before { - color: #000 !important; - text-shadow: none !important; - background: 0 0 !important; - -webkit-box-shadow: none !important; - box-shadow: none !important - } - - a, - a:visited { - text-decoration: underline - } - - a[href]:after { - content: " (" attr(href) ")" - } - - abbr[title]:after { - content: " (" attr(title) ")" - } - - a[href^="javascript:"]:after, - a[href^="#"]:after { - content: "" - } - - blockquote, - pre { - border: 1px solid #999; - page-break-inside: avoid - } - - thead { - display: table-header-group - } - - img, - tr { - page-break-inside: avoid - } - - img { - max-width: 100% !important - } - - h2, - h3, - p { - orphans: 3; - widows: 3 - } - - h2, - h3 { - page-break-after: avoid - } - - .navbar { - display: none - } - - .btn>.caret, - .dropup>.btn>.caret { - border-top-color: #000 !important - } - - .label { - border: 1px solid #000 - } - - .table { - border-collapse: collapse !important - } - - .table td, - .table th { - background-color: #fff !important - } - - .table-bordered td, - .table-bordered th { - border: 1px solid #ddd !important - } -} - -@font-face { - font-family: 'Glyphicons Halflings'; - src: url(../fonts/glyphicons-halflings-regular.eot); - src: url(../fonts/glyphicons-halflings-regular.eot?#iefix) format('embedded-opentype'), url(../fonts/glyphicons-halflings-regular.woff2) format('woff2'), url(../fonts/glyphicons-halflings-regular.woff) format('woff'), url(../fonts/glyphicons-halflings-regular.ttf) format('truetype'), url(../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular) format('svg') -} - -.glyphicon { - position: relative; - top: 1px; - display: inline-block; - font-family: 'Glyphicons Halflings'; - font-style: normal; - font-weight: 400; - line-height: 1; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale -} - -.glyphicon-asterisk:before { - content: "\002a" -} - -.glyphicon-plus:before { - content: "\002b" -} - -.glyphicon-eur:before, -.glyphicon-euro:before { - content: "\20ac" -} - -.glyphicon-minus:before { - content: "\2212" -} - -.glyphicon-cloud:before { - content: "\2601" -} - -.glyphicon-envelope:before { - content: "\2709" -} - -.glyphicon-pencil:before { - content: "\270f" -} - -.glyphicon-glass:before { - content: "\e001" -} - -.glyphicon-music:before { - content: "\e002" -} - -.glyphicon-search:before { - content: "\e003" -} - -.glyphicon-heart:before { - content: "\e005" -} - -.glyphicon-star:before { - content: "\e006" -} - -.glyphicon-star-empty:before { - content: "\e007" -} - -.glyphicon-user:before { - content: "\e008" -} - -.glyphicon-film:before { - content: "\e009" -} - -.glyphicon-th-large:before { - content: "\e010" -} - -.glyphicon-th:before { - content: "\e011" -} - -.glyphicon-th-list:before { - content: "\e012" -} - -.glyphicon-ok:before { - content: "\e013" -} - -.glyphicon-remove:before { - content: "\e014" -} - -.glyphicon-zoom-in:before { - content: "\e015" -} - -.glyphicon-zoom-out:before { - content: "\e016" -} - -.glyphicon-off:before { - content: "\e017" -} - -.glyphicon-signal:before { - content: "\e018" -} - -.glyphicon-cog:before { - content: "\e019" -} - -.glyphicon-trash:before { - content: "\e020" -} - -.glyphicon-home:before { - content: "\e021" -} - -.glyphicon-file:before { - content: "\e022" -} - -.glyphicon-time:before { - content: "\e023" -} - -.glyphicon-road:before { - content: "\e024" -} - -.glyphicon-download-alt:before { - content: "\e025" -} - -.glyphicon-download:before { - content: "\e026" -} - -.glyphicon-upload:before { - content: "\e027" -} - -.glyphicon-inbox:before { - content: "\e028" -} - -.glyphicon-play-circle:before { - content: "\e029" -} - -.glyphicon-repeat:before { - content: "\e030" -} - -.glyphicon-refresh:before { - content: "\e031" -} - -.glyphicon-list-alt:before { - content: "\e032" -} - -.glyphicon-lock:before { - content: "\e033" -} - -.glyphicon-flag:before { - content: "\e034" -} - -.glyphicon-headphones:before { - content: "\e035" -} - -.glyphicon-volume-off:before { - content: "\e036" -} - -.glyphicon-volume-down:before { - content: "\e037" -} - -.glyphicon-volume-up:before { - content: "\e038" -} - -.glyphicon-qrcode:before { - content: "\e039" -} - -.glyphicon-barcode:before { - content: "\e040" -} - -.glyphicon-tag:before { - content: "\e041" -} - -.glyphicon-tags:before { - content: "\e042" -} - -.glyphicon-book:before { - content: "\e043" -} - -.glyphicon-bookmark:before { - content: "\e044" -} - -.glyphicon-print:before { - content: "\e045" -} - -.glyphicon-camera:before { - content: "\e046" -} - -.glyphicon-font:before { - content: "\e047" -} - -.glyphicon-bold:before { - content: "\e048" -} - -.glyphicon-italic:before { - content: "\e049" -} - -.glyphicon-text-height:before { - content: "\e050" -} - -.glyphicon-text-width:before { - content: "\e051" -} - -.glyphicon-align-left:before { - content: "\e052" -} - -.glyphicon-align-center:before { - content: "\e053" -} - -.glyphicon-align-right:before { - content: "\e054" -} - -.glyphicon-align-justify:before { - content: "\e055" -} - -.glyphicon-list:before { - content: "\e056" -} - -.glyphicon-indent-left:before { - content: "\e057" -} - -.glyphicon-indent-right:before { - content: "\e058" -} - -.glyphicon-facetime-video:before { - content: "\e059" -} - -.glyphicon-picture:before { - content: "\e060" -} - -.glyphicon-map-marker:before { - content: "\e062" -} - -.glyphicon-adjust:before { - content: "\e063" -} - -.glyphicon-tint:before { - content: "\e064" -} - -.glyphicon-edit:before { - content: "\e065" -} - -.glyphicon-share:before { - content: "\e066" -} - -.glyphicon-check:before { - content: "\e067" -} - -.glyphicon-move:before { - content: "\e068" -} - -.glyphicon-step-backward:before { - content: "\e069" -} - -.glyphicon-fast-backward:before { - content: "\e070" -} - -.glyphicon-backward:before { - content: "\e071" -} - -.glyphicon-play:before { - content: "\e072" -} - -.glyphicon-pause:before { - content: "\e073" -} - -.glyphicon-stop:before { - content: "\e074" -} - -.glyphicon-forward:before { - content: "\e075" -} - -.glyphicon-fast-forward:before { - content: "\e076" -} - -.glyphicon-step-forward:before { - content: "\e077" -} - -.glyphicon-eject:before { - content: "\e078" -} - -.glyphicon-chevron-left:before { - content: "\e079" -} - -.glyphicon-chevron-right:before { - content: "\e080" -} - -.glyphicon-plus-sign:before { - content: "\e081" -} - -.glyphicon-minus-sign:before { - content: "\e082" -} - -.glyphicon-remove-sign:before { - content: "\e083" -} - -.glyphicon-ok-sign:before { - content: "\e084" -} - -.glyphicon-question-sign:before { - content: "\e085" -} - -.glyphicon-info-sign:before { - content: "\e086" -} - -.glyphicon-screenshot:before { - content: "\e087" -} - -.glyphicon-remove-circle:before { - content: "\e088" -} - -.glyphicon-ok-circle:before { - content: "\e089" -} - -.glyphicon-ban-circle:before { - content: "\e090" -} - -.glyphicon-arrow-left:before { - content: "\e091" -} - -.glyphicon-arrow-right:before { - content: "\e092" -} - -.glyphicon-arrow-up:before { - content: "\e093" -} - -.glyphicon-arrow-down:before { - content: "\e094" -} - -.glyphicon-share-alt:before { - content: "\e095" -} - -.glyphicon-resize-full:before { - content: "\e096" -} - -.glyphicon-resize-small:before { - content: "\e097" -} - -.glyphicon-exclamation-sign:before { - content: "\e101" -} - -.glyphicon-gift:before { - content: "\e102" -} - -.glyphicon-leaf:before { - content: "\e103" -} - -.glyphicon-fire:before { - content: "\e104" -} - -.glyphicon-eye-open:before { - content: "\e105" -} - -.glyphicon-eye-close:before { - content: "\e106" -} - -.glyphicon-warning-sign:before { - content: "\e107" -} - -.glyphicon-plane:before { - content: "\e108" -} - -.glyphicon-calendar:before { - content: "\e109" -} - -.glyphicon-random:before { - content: "\e110" -} - -.glyphicon-comment:before { - content: "\e111" -} - -.glyphicon-magnet:before { - content: "\e112" -} - -.glyphicon-chevron-up:before { - content: "\e113" -} - -.glyphicon-chevron-down:before { - content: "\e114" -} - -.glyphicon-retweet:before { - content: "\e115" -} - -.glyphicon-shopping-cart:before { - content: "\e116" -} - -.glyphicon-folder-close:before { - content: "\e117" -} - -.glyphicon-folder-open:before { - content: "\e118" -} - -.glyphicon-resize-vertical:before { - content: "\e119" -} - -.glyphicon-resize-horizontal:before { - content: "\e120" -} - -.glyphicon-hdd:before { - content: "\e121" -} - -.glyphicon-bullhorn:before { - content: "\e122" -} - -.glyphicon-bell:before { - content: "\e123" -} - -.glyphicon-certificate:before { - content: "\e124" -} - -.glyphicon-thumbs-up:before { - content: "\e125" -} - -.glyphicon-thumbs-down:before { - content: "\e126" -} - -.glyphicon-hand-right:before { - content: "\e127" -} - -.glyphicon-hand-left:before { - content: "\e128" -} - -.glyphicon-hand-up:before { - content: "\e129" -} - -.glyphicon-hand-down:before { - content: "\e130" -} - -.glyphicon-circle-arrow-right:before { - content: "\e131" -} - -.glyphicon-circle-arrow-left:before { - content: "\e132" -} - -.glyphicon-circle-arrow-up:before { - content: "\e133" -} - -.glyphicon-circle-arrow-down:before { - content: "\e134" -} - -.glyphicon-globe:before { - content: "\e135" -} - -.glyphicon-wrench:before { - content: "\e136" -} - -.glyphicon-tasks:before { - content: "\e137" -} - -.glyphicon-filter:before { - content: "\e138" -} - -.glyphicon-briefcase:before { - content: "\e139" -} - -.glyphicon-fullscreen:before { - content: "\e140" -} - -.glyphicon-dashboard:before { - content: "\e141" -} - -.glyphicon-paperclip:before { - content: "\e142" -} - -.glyphicon-heart-empty:before { - content: "\e143" -} - -.glyphicon-link:before { - content: "\e144" -} - -.glyphicon-phone:before { - content: "\e145" -} - -.glyphicon-pushpin:before { - content: "\e146" -} - -.glyphicon-usd:before { - content: "\e148" -} - -.glyphicon-gbp:before { - content: "\e149" -} - -.glyphicon-sort:before { - content: "\e150" -} - -.glyphicon-sort-by-alphabet:before { - content: "\e151" -} - -.glyphicon-sort-by-alphabet-alt:before { - content: "\e152" -} - -.glyphicon-sort-by-order:before { - content: "\e153" -} - -.glyphicon-sort-by-order-alt:before { - content: "\e154" -} - -.glyphicon-sort-by-attributes:before { - content: "\e155" -} - -.glyphicon-sort-by-attributes-alt:before { - content: "\e156" -} - -.glyphicon-unchecked:before { - content: "\e157" -} - -.glyphicon-expand:before { - content: "\e158" -} - -.glyphicon-collapse-down:before { - content: "\e159" -} - -.glyphicon-collapse-up:before { - content: "\e160" -} - -.glyphicon-log-in:before { - content: "\e161" -} - -.glyphicon-flash:before { - content: "\e162" -} - -.glyphicon-log-out:before { - content: "\e163" -} - -.glyphicon-new-window:before { - content: "\e164" -} - -.glyphicon-record:before { - content: "\e165" -} - -.glyphicon-save:before { - content: "\e166" -} - -.glyphicon-open:before { - content: "\e167" -} - -.glyphicon-saved:before { - content: "\e168" -} - -.glyphicon-import:before { - content: "\e169" -} - -.glyphicon-export:before { - content: "\e170" -} - -.glyphicon-send:before { - content: "\e171" -} - -.glyphicon-floppy-disk:before { - content: "\e172" -} - -.glyphicon-floppy-saved:before { - content: "\e173" -} - -.glyphicon-floppy-remove:before { - content: "\e174" -} - -.glyphicon-floppy-save:before { - content: "\e175" -} - -.glyphicon-floppy-open:before { - content: "\e176" -} - -.glyphicon-credit-card:before { - content: "\e177" -} - -.glyphicon-transfer:before { - content: "\e178" -} - -.glyphicon-cutlery:before { - content: "\e179" -} - -.glyphicon-header:before { - content: "\e180" -} - -.glyphicon-compressed:before { - content: "\e181" -} - -.glyphicon-earphone:before { - content: "\e182" -} - -.glyphicon-phone-alt:before { - content: "\e183" -} - -.glyphicon-tower:before { - content: "\e184" -} - -.glyphicon-stats:before { - content: "\e185" -} - -.glyphicon-sd-video:before { - content: "\e186" -} - -.glyphicon-hd-video:before { - content: "\e187" -} - -.glyphicon-subtitles:before { - content: "\e188" -} - -.glyphicon-sound-stereo:before { - content: "\e189" -} - -.glyphicon-sound-dolby:before { - content: "\e190" -} - -.glyphicon-sound-5-1:before { - content: "\e191" -} - -.glyphicon-sound-6-1:before { - content: "\e192" -} - -.glyphicon-sound-7-1:before { - content: "\e193" -} - -.glyphicon-copyright-mark:before { - content: "\e194" -} - -.glyphicon-registration-mark:before { - content: "\e195" -} - -.glyphicon-cloud-download:before { - content: "\e197" -} - -.glyphicon-cloud-upload:before { - content: "\e198" -} - -.glyphicon-tree-conifer:before { - content: "\e199" -} - -.glyphicon-tree-deciduous:before { - content: "\e200" -} - -.glyphicon-cd:before { - content: "\e201" -} - -.glyphicon-save-file:before { - content: "\e202" -} - -.glyphicon-open-file:before { - content: "\e203" -} - -.glyphicon-level-up:before { - content: "\e204" -} - -.glyphicon-copy:before { - content: "\e205" -} - -.glyphicon-paste:before { - content: "\e206" -} - -.glyphicon-alert:before { - content: "\e209" -} - -.glyphicon-equalizer:before { - content: "\e210" -} - -.glyphicon-king:before { - content: "\e211" -} - -.glyphicon-queen:before { - content: "\e212" -} - -.glyphicon-pawn:before { - content: "\e213" -} - -.glyphicon-bishop:before { - content: "\e214" -} - -.glyphicon-knight:before { - content: "\e215" -} - -.glyphicon-baby-formula:before { - content: "\e216" -} - -.glyphicon-tent:before { - content: "\26fa" -} - -.glyphicon-blackboard:before { - content: "\e218" -} - -.glyphicon-bed:before { - content: "\e219" -} - -.glyphicon-apple:before { - content: "\f8ff" -} - -.glyphicon-erase:before { - content: "\e221" -} - -.glyphicon-hourglass:before { - content: "\231b" -} - -.glyphicon-lamp:before { - content: "\e223" -} - -.glyphicon-duplicate:before { - content: "\e224" -} - -.glyphicon-piggy-bank:before { - content: "\e225" -} - -.glyphicon-scissors:before { - content: "\e226" -} - -.glyphicon-bitcoin:before { - content: "\e227" -} - -.glyphicon-btc:before { - content: "\e227" -} - -.glyphicon-xbt:before { - content: "\e227" -} - -.glyphicon-yen:before { - content: "\00a5" -} - -.glyphicon-jpy:before { - content: "\00a5" -} - -.glyphicon-ruble:before { - content: "\20bd" -} - -.glyphicon-rub:before { - content: "\20bd" -} - -.glyphicon-scale:before { - content: "\e230" -} - -.glyphicon-ice-lolly:before { - content: "\e231" -} - -.glyphicon-ice-lolly-tasted:before { - content: "\e232" -} - -.glyphicon-education:before { - content: "\e233" -} - -.glyphicon-option-horizontal:before { - content: "\e234" -} - -.glyphicon-option-vertical:before { - content: "\e235" -} - -.glyphicon-menu-hamburger:before { - content: "\e236" -} - -.glyphicon-modal-window:before { - content: "\e237" -} - -.glyphicon-oil:before { - content: "\e238" -} - -.glyphicon-grain:before { - content: "\e239" -} - -.glyphicon-sunglasses:before { - content: "\e240" -} - -.glyphicon-text-size:before { - content: "\e241" -} - -.glyphicon-text-color:before { - content: "\e242" -} - -.glyphicon-text-background:before { - content: "\e243" -} - -.glyphicon-object-align-top:before { - content: "\e244" -} - -.glyphicon-object-align-bottom:before { - content: "\e245" -} - -.glyphicon-object-align-horizontal:before { - content: "\e246" -} - -.glyphicon-object-align-left:before { - content: "\e247" -} - -.glyphicon-object-align-vertical:before { - content: "\e248" -} - -.glyphicon-object-align-right:before { - content: "\e249" -} - -.glyphicon-triangle-right:before { - content: "\e250" -} - -.glyphicon-triangle-left:before { - content: "\e251" -} - -.glyphicon-triangle-bottom:before { - content: "\e252" -} - -.glyphicon-triangle-top:before { - content: "\e253" -} - -.glyphicon-console:before { - content: "\e254" -} - -.glyphicon-superscript:before { - content: "\e255" -} - -.glyphicon-subscript:before { - content: "\e256" -} - -.glyphicon-menu-left:before { - content: "\e257" -} - -.glyphicon-menu-right:before { - content: "\e258" -} - -.glyphicon-menu-down:before { - content: "\e259" -} - -.glyphicon-menu-up:before { - content: "\e260" -} - -* { - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box -} - -:after, -:before { - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box -} - -html { - font-size: 10px; - -webkit-tap-highlight-color: rgba(0, 0, 0, 0) -} - -body { - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; - font-size: 14px; - line-height: 1.42857143; - color: #333; - background-color: #fff -} - -button, -input, -select, -textarea { - font-family: inherit; - font-size: inherit; - line-height: inherit -} - -a { - color: #337ab7; - text-decoration: none -} - -a:focus, -a:hover { - color: #23527c; - text-decoration: underline -} - -a:focus { - outline: 5px auto -webkit-focus-ring-color; - outline-offset: -2px -} - -figure { - margin: 0 -} - -img { - vertical-align: middle -} - -.carousel-inner>.item>a>img, -.carousel-inner>.item>img, -.img-responsive, -.thumbnail a>img, -.thumbnail>img { - display: block; - max-width: 100%; - height: auto -} - -.img-rounded { - border-radius: 6px -} - -.img-thumbnail { - display: inline-block; - max-width: 100%; - height: auto; - padding: 4px; - line-height: 1.42857143; - background-color: #fff; - border: 1px solid #ddd; - border-radius: 4px; - -webkit-transition: all .2s ease-in-out; - -o-transition: all .2s ease-in-out; - transition: all .2s ease-in-out -} - -.img-circle { - border-radius: 50% -} - -hr { - margin-top: 20px; - margin-bottom: 20px; - border: 0; - border-top: 1px solid #eee -} - -.sr-only { - position: absolute; - width: 1px; - height: 1px; - padding: 0; - margin: -1px; - overflow: hidden; - clip: rect(0, 0, 0, 0); - border: 0 -} - -.sr-only-focusable:active, -.sr-only-focusable:focus { - position: static; - width: auto; - height: auto; - margin: 0; - overflow: visible; - clip: auto -} - -[role=button] { - cursor: pointer -} - -.h1, -.h2, -.h3, -.h4, -.h5, -.h6, -h1, -h2, -h3, -h4, -h5, -h6 { - font-family: inherit; - font-weight: 500; - line-height: 1.1; - color: inherit -} - -.h1 .small, -.h1 small, -.h2 .small, -.h2 small, -.h3 .small, -.h3 small, -.h4 .small, -.h4 small, -.h5 .small, -.h5 small, -.h6 .small, -.h6 small, -h1 .small, -h1 small, -h2 .small, -h2 small, -h3 .small, -h3 small, -h4 .small, -h4 small, -h5 .small, -h5 small, -h6 .small, -h6 small { - font-weight: 400; - line-height: 1; - color: #777 -} - -.h1, -.h2, -.h3, -h1, -h2, -h3 { - margin-top: 20px; - margin-bottom: 10px -} - -.h1 .small, -.h1 small, -.h2 .small, -.h2 small, -.h3 .small, -.h3 small, -h1 .small, -h1 small, -h2 .small, -h2 small, -h3 .small, -h3 small { - font-size: 65% -} - -.h4, -.h5, -.h6, -h4, -h5, -h6 { - margin-top: 10px; - margin-bottom: 10px -} - -.h4 .small, -.h4 small, -.h5 .small, -.h5 small, -.h6 .small, -.h6 small, -h4 .small, -h4 small, -h5 .small, -h5 small, -h6 .small, -h6 small { - font-size: 75% -} - -.h1, -h1 { - font-size: 36px -} - -.h2, -h2 { - font-size: 30px -} - -.h3, -h3 { - font-size: 24px -} - -.h4, -h4 { - font-size: 18px -} - -.h5, -h5 { - font-size: 14px -} - -.h6, -h6 { - font-size: 12px -} - -p { - margin: 0 0 10px -} - -.lead { - margin-bottom: 20px; - font-size: 16px; - font-weight: 300; - line-height: 1.4 -} - -@media (min-width:768px) { - .lead { - font-size: 21px - } -} - -.small, -small { - font-size: 85% -} - -.mark, -mark { - padding: .2em; - background-color: #fcf8e3 -} - -.text-left { - text-align: left -} - -.text-right { - text-align: right -} - -.text-center { - text-align: center -} - -.text-justify { - text-align: justify -} - -.text-nowrap { - white-space: nowrap -} - -.text-lowercase { - text-transform: lowercase -} - -.text-uppercase { - text-transform: uppercase -} - -.text-capitalize { - text-transform: capitalize -} - -.text-muted { - color: #777 -} - -.text-primary { - color: #337ab7 -} - -a.text-primary:focus, -a.text-primary:hover { - color: #286090 -} - -.text-success { - color: #3c763d -} - -a.text-success:focus, -a.text-success:hover { - color: #2b542c -} - -.text-info { - color: #31708f -} - -a.text-info:focus, -a.text-info:hover { - color: #245269 -} - -.text-warning { - color: #8a6d3b -} - -a.text-warning:focus, -a.text-warning:hover { - color: #66512c -} - -.text-danger { - color: #a94442 -} - -a.text-danger:focus, -a.text-danger:hover { - color: #843534 -} - -.bg-primary { - color: #fff; - background-color: #337ab7 -} - -a.bg-primary:focus, -a.bg-primary:hover { - background-color: #286090 -} - -.bg-success { - background-color: #dff0d8 -} - -a.bg-success:focus, -a.bg-success:hover { - background-color: #c1e2b3 -} - -.bg-info { - background-color: #d9edf7 -} - -a.bg-info:focus, -a.bg-info:hover { - background-color: #afd9ee -} - -.bg-warning { - background-color: #fcf8e3 -} - -a.bg-warning:focus, -a.bg-warning:hover { - background-color: #f7ecb5 -} - -.bg-danger { - background-color: #f2dede -} - -a.bg-danger:focus, -a.bg-danger:hover { - background-color: #e4b9b9 -} - -.page-header { - padding-bottom: 9px; - margin: 40px 0 20px; - border-bottom: 1px solid #eee -} - -ol, -ul { - margin-top: 0; - margin-bottom: 10px -} - -ol ol, -ol ul, -ul ol, -ul ul { - margin-bottom: 0 -} - -.list-unstyled { - padding-left: 0; - list-style: none -} - -.list-inline { - padding-left: 0; - margin-left: -5px; - list-style: none -} - -.list-inline>li { - display: inline-block; - padding-right: 5px; - padding-left: 5px -} - -dl { - margin-top: 0; - margin-bottom: 20px -} - -dd, -dt { - line-height: 1.42857143 -} - -dt { - font-weight: 700 -} - -dd { - margin-left: 0 -} - -@media (min-width:768px) { - .dl-horizontal dt { - float: left; - width: 160px; - overflow: hidden; - clear: left; - text-align: right; - text-overflow: ellipsis; - white-space: nowrap - } - - .dl-horizontal dd { - margin-left: 180px - } -} - -abbr[data-original-title], -abbr[title] { - cursor: help; - border-bottom: 1px dotted #777 -} - -.initialism { - font-size: 90%; - text-transform: uppercase -} - -blockquote { - padding: 10px 20px; - margin: 0 0 20px; - font-size: 17.5px; - border-left: 5px solid #eee -} - -blockquote ol:last-child, -blockquote p:last-child, -blockquote ul:last-child { - margin-bottom: 0 -} - -blockquote .small, -blockquote footer, -blockquote small { - display: block; - font-size: 80%; - line-height: 1.42857143; - color: #777 -} - -blockquote .small:before, -blockquote footer:before, -blockquote small:before { - content: '\2014 \00A0' -} - -.blockquote-reverse, -blockquote.pull-right { - padding-right: 15px; - padding-left: 0; - text-align: right; - border-right: 5px solid #eee; - border-left: 0 -} - -.blockquote-reverse .small:before, -.blockquote-reverse footer:before, -.blockquote-reverse small:before, -blockquote.pull-right .small:before, -blockquote.pull-right footer:before, -blockquote.pull-right small:before { - content: '' -} - -.blockquote-reverse .small:after, -.blockquote-reverse footer:after, -.blockquote-reverse small:after, -blockquote.pull-right .small:after, -blockquote.pull-right footer:after, -blockquote.pull-right small:after { - content: '\00A0 \2014' -} - -address { - margin-bottom: 20px; - font-style: normal; - line-height: 1.42857143 -} - -code, -kbd, -pre, -samp { - font-family: Menlo, Monaco, Consolas, "Courier New", monospace -} - -code { - padding: 2px 4px; - font-size: 90%; - color: #c7254e; - background-color: #f9f2f4; - border-radius: 4px -} - -kbd { - padding: 2px 4px; - font-size: 90%; - color: #fff; - background-color: #333; - border-radius: 3px; - -webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .25); - box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .25) -} - -kbd kbd { - padding: 0; - font-size: 100%; - font-weight: 700; - -webkit-box-shadow: none; - box-shadow: none -} - -pre { - display: block; - padding: 9.5px; - margin: 0 0 10px; - font-size: 13px; - line-height: 1.42857143; - color: #333; - word-break: break-all; - word-wrap: break-word; - background-color: #f5f5f5; - border: 1px solid #ccc; - border-radius: 4px -} - -pre code { - padding: 0; - font-size: inherit; - color: inherit; - white-space: pre-wrap; - background-color: transparent; - border-radius: 0 -} - -.pre-scrollable { - max-height: 340px; - overflow-y: scroll -} - -.container { - padding-right: 15px; - padding-left: 15px; - margin-right: auto; - margin-left: auto -} - -@media (min-width:768px) { - .container { - width: 750px - } -} - -@media (min-width:992px) { - .container { - width: 970px - } -} - -@media (min-width:1200px) { - .container { - width: 1170px - } -} - -.container-fluid { - padding-right: 15px; - padding-left: 15px; - margin-right: auto; - margin-left: auto -} - -.row { - margin-right: -15px; - margin-left: -15px -} - -.col-lg-1, -.col-lg-10, -.col-lg-11, -.col-lg-12, -.col-lg-2, -.col-lg-3, -.col-lg-4, -.col-lg-5, -.col-lg-6, -.col-lg-7, -.col-lg-8, -.col-lg-9, -.col-md-1, -.col-md-10, -.col-md-11, -.col-md-12, -.col-md-2, -.col-md-3, -.col-md-4, -.col-md-5, -.col-md-6, -.col-md-7, -.col-md-8, -.col-md-9, -.col-sm-1, -.col-sm-10, -.col-sm-11, -.col-sm-12, -.col-sm-2, -.col-sm-3, -.col-sm-4, -.col-sm-5, -.col-sm-6, -.col-sm-7, -.col-sm-8, -.col-sm-9, -.col-xs-1, -.col-xs-10, -.col-xs-11, -.col-xs-12, -.col-xs-2, -.col-xs-3, -.col-xs-4, -.col-xs-5, -.col-xs-6, -.col-xs-7, -.col-xs-8, -.col-xs-9 { - position: relative; - min-height: 1px; - padding-right: 15px; - padding-left: 15px -} - -.col-xs-1, -.col-xs-10, -.col-xs-11, -.col-xs-12, -.col-xs-2, -.col-xs-3, -.col-xs-4, -.col-xs-5, -.col-xs-6, -.col-xs-7, -.col-xs-8, -.col-xs-9 { - float: left -} - -.col-xs-12 { - width: 100% -} - -.col-xs-11 { - width: 91.66666667% -} - -.col-xs-10 { - width: 83.33333333% -} - -.col-xs-9 { - width: 75% -} - -.col-xs-8 { - width: 66.66666667% -} - -.col-xs-7 { - width: 58.33333333% -} - -.col-xs-6 { - width: 50% -} - -.col-xs-5 { - width: 41.66666667% -} - -.col-xs-4 { - width: 33.33333333% -} - -.col-xs-3 { - width: 25% -} - -.col-xs-2 { - width: 16.66666667% -} - -.col-xs-1 { - width: 8.33333333% -} - -.col-xs-pull-12 { - right: 100% -} - -.col-xs-pull-11 { - right: 91.66666667% -} - -.col-xs-pull-10 { - right: 83.33333333% -} - -.col-xs-pull-9 { - right: 75% -} - -.col-xs-pull-8 { - right: 66.66666667% -} - -.col-xs-pull-7 { - right: 58.33333333% -} - -.col-xs-pull-6 { - right: 50% -} - -.col-xs-pull-5 { - right: 41.66666667% -} - -.col-xs-pull-4 { - right: 33.33333333% -} - -.col-xs-pull-3 { - right: 25% -} - -.col-xs-pull-2 { - right: 16.66666667% -} - -.col-xs-pull-1 { - right: 8.33333333% -} - -.col-xs-pull-0 { - right: auto -} - -.col-xs-push-12 { - left: 100% -} - -.col-xs-push-11 { - left: 91.66666667% -} - -.col-xs-push-10 { - left: 83.33333333% -} - -.col-xs-push-9 { - left: 75% -} - -.col-xs-push-8 { - left: 66.66666667% -} - -.col-xs-push-7 { - left: 58.33333333% -} - -.col-xs-push-6 { - left: 50% -} - -.col-xs-push-5 { - left: 41.66666667% -} - -.col-xs-push-4 { - left: 33.33333333% -} - -.col-xs-push-3 { - left: 25% -} - -.col-xs-push-2 { - left: 16.66666667% -} - -.col-xs-push-1 { - left: 8.33333333% -} - -.col-xs-push-0 { - left: auto -} - -.col-xs-offset-12 { - margin-left: 100% -} - -.col-xs-offset-11 { - margin-left: 91.66666667% -} - -.col-xs-offset-10 { - margin-left: 83.33333333% -} - -.col-xs-offset-9 { - margin-left: 75% -} - -.col-xs-offset-8 { - margin-left: 66.66666667% -} - -.col-xs-offset-7 { - margin-left: 58.33333333% -} - -.col-xs-offset-6 { - margin-left: 50% -} - -.col-xs-offset-5 { - margin-left: 41.66666667% -} - -.col-xs-offset-4 { - margin-left: 33.33333333% -} - -.col-xs-offset-3 { - margin-left: 25% -} - -.col-xs-offset-2 { - margin-left: 16.66666667% -} - -.col-xs-offset-1 { - margin-left: 8.33333333% -} - -.col-xs-offset-0 { - margin-left: 0 -} - -@media (min-width:768px) { - - .col-sm-1, - .col-sm-10, - .col-sm-11, - .col-sm-12, - .col-sm-2, - .col-sm-3, - .col-sm-4, - .col-sm-5, - .col-sm-6, - .col-sm-7, - .col-sm-8, - .col-sm-9 { - float: left - } - - .col-sm-12 { - width: 100% - } - - .col-sm-11 { - width: 91.66666667% - } - - .col-sm-10 { - width: 83.33333333% - } - - .col-sm-9 { - width: 75% - } - - .col-sm-8 { - width: 66.66666667% - } - - .col-sm-7 { - width: 58.33333333% - } - - .col-sm-6 { - width: 50% - } - - .col-sm-5 { - width: 41.66666667% - } - - .col-sm-4 { - width: 33.33333333% - } - - .col-sm-3 { - width: 25% - } - - .col-sm-2 { - width: 16.66666667% - } - - .col-sm-1 { - width: 8.33333333% - } - - .col-sm-pull-12 { - right: 100% - } - - .col-sm-pull-11 { - right: 91.66666667% - } - - .col-sm-pull-10 { - right: 83.33333333% - } - - .col-sm-pull-9 { - right: 75% - } - - .col-sm-pull-8 { - right: 66.66666667% - } - - .col-sm-pull-7 { - right: 58.33333333% - } - - .col-sm-pull-6 { - right: 50% - } - - .col-sm-pull-5 { - right: 41.66666667% - } - - .col-sm-pull-4 { - right: 33.33333333% - } - - .col-sm-pull-3 { - right: 25% - } - - .col-sm-pull-2 { - right: 16.66666667% - } - - .col-sm-pull-1 { - right: 8.33333333% - } - - .col-sm-pull-0 { - right: auto - } - - .col-sm-push-12 { - left: 100% - } - - .col-sm-push-11 { - left: 91.66666667% - } - - .col-sm-push-10 { - left: 83.33333333% - } - - .col-sm-push-9 { - left: 75% - } - - .col-sm-push-8 { - left: 66.66666667% - } - - .col-sm-push-7 { - left: 58.33333333% - } - - .col-sm-push-6 { - left: 50% - } - - .col-sm-push-5 { - left: 41.66666667% - } - - .col-sm-push-4 { - left: 33.33333333% - } - - .col-sm-push-3 { - left: 25% - } - - .col-sm-push-2 { - left: 16.66666667% - } - - .col-sm-push-1 { - left: 8.33333333% - } - - .col-sm-push-0 { - left: auto - } - - .col-sm-offset-12 { - margin-left: 100% - } - - .col-sm-offset-11 { - margin-left: 91.66666667% - } - - .col-sm-offset-10 { - margin-left: 83.33333333% - } - - .col-sm-offset-9 { - margin-left: 75% - } - - .col-sm-offset-8 { - margin-left: 66.66666667% - } - - .col-sm-offset-7 { - margin-left: 58.33333333% - } - - .col-sm-offset-6 { - margin-left: 50% - } - - .col-sm-offset-5 { - margin-left: 41.66666667% - } - - .col-sm-offset-4 { - margin-left: 33.33333333% - } - - .col-sm-offset-3 { - margin-left: 25% - } - - .col-sm-offset-2 { - margin-left: 16.66666667% - } - - .col-sm-offset-1 { - margin-left: 8.33333333% - } - - .col-sm-offset-0 { - margin-left: 0 - } -} - -@media (min-width:992px) { - - .col-md-1, - .col-md-10, - .col-md-11, - .col-md-12, - .col-md-2, - .col-md-3, - .col-md-4, - .col-md-5, - .col-md-6, - .col-md-7, - .col-md-8, - .col-md-9 { - float: left - } - - .col-md-12 { - width: 100% - } - - .col-md-11 { - width: 91.66666667% - } - - .col-md-10 { - width: 83.33333333% - } - - .col-md-9 { - width: 75% - } - - .col-md-8 { - width: 66.66666667% - } - - .col-md-7 { - width: 58.33333333% - } - - .col-md-6 { - width: 50% - } - - .col-md-5 { - width: 41.66666667% - } - - .col-md-4 { - width: 33.33333333% - } - - .col-md-3 { - width: 25% - } - - .col-md-2 { - width: 16.66666667% - } - - .col-md-1 { - width: 8.33333333% - } - - .col-md-pull-12 { - right: 100% - } - - .col-md-pull-11 { - right: 91.66666667% - } - - .col-md-pull-10 { - right: 83.33333333% - } - - .col-md-pull-9 { - right: 75% - } - - .col-md-pull-8 { - right: 66.66666667% - } - - .col-md-pull-7 { - right: 58.33333333% - } - - .col-md-pull-6 { - right: 50% - } - - .col-md-pull-5 { - right: 41.66666667% - } - - .col-md-pull-4 { - right: 33.33333333% - } - - .col-md-pull-3 { - right: 25% - } - - .col-md-pull-2 { - right: 16.66666667% - } - - .col-md-pull-1 { - right: 8.33333333% - } - - .col-md-pull-0 { - right: auto - } - - .col-md-push-12 { - left: 100% - } - - .col-md-push-11 { - left: 91.66666667% - } - - .col-md-push-10 { - left: 83.33333333% - } - - .col-md-push-9 { - left: 75% - } - - .col-md-push-8 { - left: 66.66666667% - } - - .col-md-push-7 { - left: 58.33333333% - } - - .col-md-push-6 { - left: 50% - } - - .col-md-push-5 { - left: 41.66666667% - } - - .col-md-push-4 { - left: 33.33333333% - } - - .col-md-push-3 { - left: 25% - } - - .col-md-push-2 { - left: 16.66666667% - } - - .col-md-push-1 { - left: 8.33333333% - } - - .col-md-push-0 { - left: auto - } - - .col-md-offset-12 { - margin-left: 100% - } - - .col-md-offset-11 { - margin-left: 91.66666667% - } - - .col-md-offset-10 { - margin-left: 83.33333333% - } - - .col-md-offset-9 { - margin-left: 75% - } - - .col-md-offset-8 { - margin-left: 66.66666667% - } - - .col-md-offset-7 { - margin-left: 58.33333333% - } - - .col-md-offset-6 { - margin-left: 50% - } - - .col-md-offset-5 { - margin-left: 41.66666667% - } - - .col-md-offset-4 { - margin-left: 33.33333333% - } - - .col-md-offset-3 { - margin-left: 25% - } - - .col-md-offset-2 { - margin-left: 16.66666667% - } - - .col-md-offset-1 { - margin-left: 8.33333333% - } - - .col-md-offset-0 { - margin-left: 0 - } -} - -@media (min-width:1200px) { - - .col-lg-1, - .col-lg-10, - .col-lg-11, - .col-lg-12, - .col-lg-2, - .col-lg-3, - .col-lg-4, - .col-lg-5, - .col-lg-6, - .col-lg-7, - .col-lg-8, - .col-lg-9 { - float: left - } - - .col-lg-12 { - width: 100% - } - - .col-lg-11 { - width: 91.66666667% - } - - .col-lg-10 { - width: 83.33333333% - } - - .col-lg-9 { - width: 75% - } - - .col-lg-8 { - width: 66.66666667% - } - - .col-lg-7 { - width: 58.33333333% - } - - .col-lg-6 { - width: 50% - } - - .col-lg-5 { - width: 41.66666667% - } - - .col-lg-4 { - width: 33.33333333% - } - - .col-lg-3 { - width: 25% - } - - .col-lg-2 { - width: 16.66666667% - } - - .col-lg-1 { - width: 8.33333333% - } - - .col-lg-pull-12 { - right: 100% - } - - .col-lg-pull-11 { - right: 91.66666667% - } - - .col-lg-pull-10 { - right: 83.33333333% - } - - .col-lg-pull-9 { - right: 75% - } - - .col-lg-pull-8 { - right: 66.66666667% - } - - .col-lg-pull-7 { - right: 58.33333333% - } - - .col-lg-pull-6 { - right: 50% - } - - .col-lg-pull-5 { - right: 41.66666667% - } - - .col-lg-pull-4 { - right: 33.33333333% - } - - .col-lg-pull-3 { - right: 25% - } - - .col-lg-pull-2 { - right: 16.66666667% - } - - .col-lg-pull-1 { - right: 8.33333333% - } - - .col-lg-pull-0 { - right: auto - } - - .col-lg-push-12 { - left: 100% - } - - .col-lg-push-11 { - left: 91.66666667% - } - - .col-lg-push-10 { - left: 83.33333333% - } - - .col-lg-push-9 { - left: 75% - } - - .col-lg-push-8 { - left: 66.66666667% - } - - .col-lg-push-7 { - left: 58.33333333% - } - - .col-lg-push-6 { - left: 50% - } - - .col-lg-push-5 { - left: 41.66666667% - } - - .col-lg-push-4 { - left: 33.33333333% - } - - .col-lg-push-3 { - left: 25% - } - - .col-lg-push-2 { - left: 16.66666667% - } - - .col-lg-push-1 { - left: 8.33333333% - } - - .col-lg-push-0 { - left: auto - } - - .col-lg-offset-12 { - margin-left: 100% - } - - .col-lg-offset-11 { - margin-left: 91.66666667% - } - - .col-lg-offset-10 { - margin-left: 83.33333333% - } - - .col-lg-offset-9 { - margin-left: 75% - } - - .col-lg-offset-8 { - margin-left: 66.66666667% - } - - .col-lg-offset-7 { - margin-left: 58.33333333% - } - - .col-lg-offset-6 { - margin-left: 50% - } - - .col-lg-offset-5 { - margin-left: 41.66666667% - } - - .col-lg-offset-4 { - margin-left: 33.33333333% - } - - .col-lg-offset-3 { - margin-left: 25% - } - - .col-lg-offset-2 { - margin-left: 16.66666667% - } - - .col-lg-offset-1 { - margin-left: 8.33333333% - } - - .col-lg-offset-0 { - margin-left: 0 - } -} - -table { - background-color: transparent -} - -caption { - padding-top: 8px; - padding-bottom: 8px; - color: #777; - text-align: left -} - -th { - text-align: left -} - -.table { - width: 100%; - max-width: 100%; - margin-bottom: 20px -} - -.table>tbody>tr>td, -.table>tbody>tr>th, -.table>tfoot>tr>td, -.table>tfoot>tr>th, -.table>thead>tr>td, -.table>thead>tr>th { - padding: 8px; - line-height: 1.42857143; - vertical-align: top; - border-top: 1px solid #ddd -} - -.table>thead>tr>th { - vertical-align: bottom; - border-bottom: 2px solid #ddd -} - -.table>caption+thead>tr:first-child>td, -.table>caption+thead>tr:first-child>th, -.table>colgroup+thead>tr:first-child>td, -.table>colgroup+thead>tr:first-child>th, -.table>thead:first-child>tr:first-child>td, -.table>thead:first-child>tr:first-child>th { - border-top: 0 -} - -.table>tbody+tbody { - border-top: 2px solid #ddd -} - -.table .table { - background-color: #fff -} - -.table-condensed>tbody>tr>td, -.table-condensed>tbody>tr>th, -.table-condensed>tfoot>tr>td, -.table-condensed>tfoot>tr>th, -.table-condensed>thead>tr>td, -.table-condensed>thead>tr>th { - padding: 5px -} - -.table-bordered { - border: 1px solid #ddd -} - -.table-bordered>tbody>tr>td, -.table-bordered>tbody>tr>th, -.table-bordered>tfoot>tr>td, -.table-bordered>tfoot>tr>th, -.table-bordered>thead>tr>td, -.table-bordered>thead>tr>th { - border: 1px solid #ddd -} - -.table-bordered>thead>tr>td, -.table-bordered>thead>tr>th { - border-bottom-width: 2px -} - -.table-striped>tbody>tr:nth-of-type(odd) { - background-color: #f9f9f9 -} - -.table-hover>tbody>tr:hover { - background-color: #f5f5f5 -} - -table col[class*=col-] { - position: static; - display: table-column; - float: none -} - -table td[class*=col-], -table th[class*=col-] { - position: static; - display: table-cell; - float: none -} - -.table>tbody>tr.active>td, -.table>tbody>tr.active>th, -.table>tbody>tr>td.active, -.table>tbody>tr>th.active, -.table>tfoot>tr.active>td, -.table>tfoot>tr.active>th, -.table>tfoot>tr>td.active, -.table>tfoot>tr>th.active, -.table>thead>tr.active>td, -.table>thead>tr.active>th, -.table>thead>tr>td.active, -.table>thead>tr>th.active { - background-color: #f5f5f5 -} - -.table-hover>tbody>tr.active:hover>td, -.table-hover>tbody>tr.active:hover>th, -.table-hover>tbody>tr:hover>.active, -.table-hover>tbody>tr>td.active:hover, -.table-hover>tbody>tr>th.active:hover { - background-color: #e8e8e8 -} - -.table>tbody>tr.success>td, -.table>tbody>tr.success>th, -.table>tbody>tr>td.success, -.table>tbody>tr>th.success, -.table>tfoot>tr.success>td, -.table>tfoot>tr.success>th, -.table>tfoot>tr>td.success, -.table>tfoot>tr>th.success, -.table>thead>tr.success>td, -.table>thead>tr.success>th, -.table>thead>tr>td.success, -.table>thead>tr>th.success { - background-color: #dff0d8 -} - -.table-hover>tbody>tr.success:hover>td, -.table-hover>tbody>tr.success:hover>th, -.table-hover>tbody>tr:hover>.success, -.table-hover>tbody>tr>td.success:hover, -.table-hover>tbody>tr>th.success:hover { - background-color: #d0e9c6 -} - -.table>tbody>tr.info>td, -.table>tbody>tr.info>th, -.table>tbody>tr>td.info, -.table>tbody>tr>th.info, -.table>tfoot>tr.info>td, -.table>tfoot>tr.info>th, -.table>tfoot>tr>td.info, -.table>tfoot>tr>th.info, -.table>thead>tr.info>td, -.table>thead>tr.info>th, -.table>thead>tr>td.info, -.table>thead>tr>th.info { - background-color: #d9edf7 -} - -.table-hover>tbody>tr.info:hover>td, -.table-hover>tbody>tr.info:hover>th, -.table-hover>tbody>tr:hover>.info, -.table-hover>tbody>tr>td.info:hover, -.table-hover>tbody>tr>th.info:hover { - background-color: #c4e3f3 -} - -.table>tbody>tr.warning>td, -.table>tbody>tr.warning>th, -.table>tbody>tr>td.warning, -.table>tbody>tr>th.warning, -.table>tfoot>tr.warning>td, -.table>tfoot>tr.warning>th, -.table>tfoot>tr>td.warning, -.table>tfoot>tr>th.warning, -.table>thead>tr.warning>td, -.table>thead>tr.warning>th, -.table>thead>tr>td.warning, -.table>thead>tr>th.warning { - background-color: #fcf8e3 -} - -.table-hover>tbody>tr.warning:hover>td, -.table-hover>tbody>tr.warning:hover>th, -.table-hover>tbody>tr:hover>.warning, -.table-hover>tbody>tr>td.warning:hover, -.table-hover>tbody>tr>th.warning:hover { - background-color: #faf2cc -} - -.table>tbody>tr.danger>td, -.table>tbody>tr.danger>th, -.table>tbody>tr>td.danger, -.table>tbody>tr>th.danger, -.table>tfoot>tr.danger>td, -.table>tfoot>tr.danger>th, -.table>tfoot>tr>td.danger, -.table>tfoot>tr>th.danger, -.table>thead>tr.danger>td, -.table>thead>tr.danger>th, -.table>thead>tr>td.danger, -.table>thead>tr>th.danger { - background-color: #f2dede -} - -.table-hover>tbody>tr.danger:hover>td, -.table-hover>tbody>tr.danger:hover>th, -.table-hover>tbody>tr:hover>.danger, -.table-hover>tbody>tr>td.danger:hover, -.table-hover>tbody>tr>th.danger:hover { - background-color: #ebcccc -} - -.table-responsive { - min-height: .01%; - overflow-x: auto -} - -@media screen and (max-width:767px) { - .table-responsive { - width: 100%; - margin-bottom: 15px; - overflow-y: hidden; - -ms-overflow-style: -ms-autohiding-scrollbar; - border: 1px solid #ddd - } - - .table-responsive>.table { - margin-bottom: 0 - } - - .table-responsive>.table>tbody>tr>td, - .table-responsive>.table>tbody>tr>th, - .table-responsive>.table>tfoot>tr>td, - .table-responsive>.table>tfoot>tr>th, - .table-responsive>.table>thead>tr>td, - .table-responsive>.table>thead>tr>th { - white-space: nowrap - } - - .table-responsive>.table-bordered { - border: 0 - } - - .table-responsive>.table-bordered>tbody>tr>td:first-child, - .table-responsive>.table-bordered>tbody>tr>th:first-child, - .table-responsive>.table-bordered>tfoot>tr>td:first-child, - .table-responsive>.table-bordered>tfoot>tr>th:first-child, - .table-responsive>.table-bordered>thead>tr>td:first-child, - .table-responsive>.table-bordered>thead>tr>th:first-child { - border-left: 0 - } - - .table-responsive>.table-bordered>tbody>tr>td:last-child, - .table-responsive>.table-bordered>tbody>tr>th:last-child, - .table-responsive>.table-bordered>tfoot>tr>td:last-child, - .table-responsive>.table-bordered>tfoot>tr>th:last-child, - .table-responsive>.table-bordered>thead>tr>td:last-child, - .table-responsive>.table-bordered>thead>tr>th:last-child { - border-right: 0 - } - - .table-responsive>.table-bordered>tbody>tr:last-child>td, - .table-responsive>.table-bordered>tbody>tr:last-child>th, - .table-responsive>.table-bordered>tfoot>tr:last-child>td, - .table-responsive>.table-bordered>tfoot>tr:last-child>th { - border-bottom: 0 - } -} - -fieldset { - min-width: 0; - padding: 0; - margin: 0; - border: 0 -} - -legend { - display: block; - width: 100%; - padding: 0; - margin-bottom: 20px; - font-size: 21px; - line-height: inherit; - color: #333; - border: 0; - border-bottom: 1px solid #e5e5e5 -} - -label { - display: inline-block; - max-width: 100%; - margin-bottom: 5px; - font-weight: 700 -} - -input[type=search] { - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box -} - -input[type=checkbox], -input[type=radio] { - margin: 4px 0 0; - margin-top: 1px\9; - line-height: normal -} - -input[type=file] { - display: block -} - -input[type=range] { - display: block; - width: 100% -} - -select[multiple], -select[size] { - height: auto -} - -input[type=file]:focus, -input[type=checkbox]:focus, -input[type=radio]:focus { - outline: 5px auto -webkit-focus-ring-color; - outline-offset: -2px -} - -output { - display: block; - padding-top: 7px; - font-size: 14px; - line-height: 1.42857143; - color: #555 -} - -.form-control { - display: block; - width: 100%; - height: 34px; - padding: 6px 12px; - font-size: 14px; - line-height: 1.42857143; - color: #555; - background-color: #fff; - background-image: none; - border: 1px solid #ccc; - border-radius: 4px; - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); - box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); - -webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s; - -o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s; - transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s -} - -.form-control:focus { - border-color: #66afe9; - outline: 0; - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, .6); - box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, .6) -} - -.form-control::-moz-placeholder { - color: #999; - opacity: 1 -} - -.form-control:-ms-input-placeholder { - color: #999 -} - -.form-control::-webkit-input-placeholder { - color: #999 -} - -.form-control::-ms-expand { - background-color: transparent; - border: 0 -} - -.form-control[disabled], -.form-control[readonly], -fieldset[disabled] .form-control { - background-color: #eee; - opacity: 1 -} - -.form-control[disabled], -fieldset[disabled] .form-control { - cursor: not-allowed -} - -textarea.form-control { - height: auto -} - -input[type=search] { - -webkit-appearance: none -} - -@media screen and (-webkit-min-device-pixel-ratio:0) { - - input[type=date].form-control, - input[type=time].form-control, - input[type=datetime-local].form-control, - input[type=month].form-control { - line-height: 34px - } - - .input-group-sm input[type=date], - .input-group-sm input[type=time], - .input-group-sm input[type=datetime-local], - .input-group-sm input[type=month], - input[type=date].input-sm, - input[type=time].input-sm, - input[type=datetime-local].input-sm, - input[type=month].input-sm { - line-height: 30px - } - - .input-group-lg input[type=date], - .input-group-lg input[type=time], - .input-group-lg input[type=datetime-local], - .input-group-lg input[type=month], - input[type=date].input-lg, - input[type=time].input-lg, - input[type=datetime-local].input-lg, - input[type=month].input-lg { - line-height: 46px - } -} - -.form-group { - margin-bottom: 15px -} - -.checkbox, -.radio { - position: relative; - display: block; - margin-top: 10px; - margin-bottom: 10px -} - -.checkbox label, -.radio label { - min-height: 20px; - padding-left: 20px; - margin-bottom: 0; - font-weight: 400; - cursor: pointer -} - -.checkbox input[type=checkbox], -.checkbox-inline input[type=checkbox], -.radio input[type=radio], -.radio-inline input[type=radio] { - position: absolute; - margin-top: 4px\9; - margin-left: -20px -} - -.checkbox+.checkbox, -.radio+.radio { - margin-top: -5px -} - -.checkbox-inline, -.radio-inline { - position: relative; - display: inline-block; - padding-left: 20px; - margin-bottom: 0; - font-weight: 400; - vertical-align: middle; - cursor: pointer -} - -.checkbox-inline+.checkbox-inline, -.radio-inline+.radio-inline { - margin-top: 0; - margin-left: 10px -} - -fieldset[disabled] input[type=checkbox], -fieldset[disabled] input[type=radio], -input[type=checkbox].disabled, -input[type=checkbox][disabled], -input[type=radio].disabled, -input[type=radio][disabled] { - cursor: not-allowed -} - -.checkbox-inline.disabled, -.radio-inline.disabled, -fieldset[disabled] .checkbox-inline, -fieldset[disabled] .radio-inline { - cursor: not-allowed -} - -.checkbox.disabled label, -.radio.disabled label, -fieldset[disabled] .checkbox label, -fieldset[disabled] .radio label { - cursor: not-allowed -} - -.form-control-static { - min-height: 34px; - padding-top: 7px; - padding-bottom: 7px; - margin-bottom: 0 -} - -.form-control-static.input-lg, -.form-control-static.input-sm { - padding-right: 0; - padding-left: 0 -} - -.input-sm { - height: 30px; - padding: 5px 10px; - font-size: 12px; - line-height: 1.5; - border-radius: 3px -} - -select.input-sm { - height: 30px; - line-height: 30px -} - -select[multiple].input-sm, -textarea.input-sm { - height: auto -} - -.form-group-sm .form-control { - height: 30px; - padding: 5px 10px; - font-size: 12px; - line-height: 1.5; - border-radius: 3px -} - -.form-group-sm select.form-control { - height: 30px; - line-height: 30px -} - -.form-group-sm select[multiple].form-control, -.form-group-sm textarea.form-control { - height: auto -} - -.form-group-sm .form-control-static { - height: 30px; - min-height: 32px; - padding: 6px 10px; - font-size: 12px; - line-height: 1.5 -} - -.input-lg { - height: 46px; - padding: 10px 16px; - font-size: 18px; - line-height: 1.3333333; - border-radius: 6px -} - -select.input-lg { - height: 46px; - line-height: 46px -} - -select[multiple].input-lg, -textarea.input-lg { - height: auto -} - -.form-group-lg .form-control { - height: 46px; - padding: 10px 16px; - font-size: 18px; - line-height: 1.3333333; - border-radius: 6px -} - -.form-group-lg select.form-control { - height: 46px; - line-height: 46px -} - -.form-group-lg select[multiple].form-control, -.form-group-lg textarea.form-control { - height: auto -} - -.form-group-lg .form-control-static { - height: 46px; - min-height: 38px; - padding: 11px 16px; - font-size: 18px; - line-height: 1.3333333 -} - -.has-feedback { - position: relative -} - -.has-feedback .form-control { - padding-right: 42.5px -} - -.form-control-feedback { - position: absolute; - top: 0; - right: 0; - z-index: 2; - display: block; - width: 34px; - height: 34px; - line-height: 34px; - text-align: center; - pointer-events: none -} - -.form-group-lg .form-control+.form-control-feedback, -.input-group-lg+.form-control-feedback, -.input-lg+.form-control-feedback { - width: 46px; - height: 46px; - line-height: 46px -} - -.form-group-sm .form-control+.form-control-feedback, -.input-group-sm+.form-control-feedback, -.input-sm+.form-control-feedback { - width: 30px; - height: 30px; - line-height: 30px -} - -.has-success .checkbox, -.has-success .checkbox-inline, -.has-success .control-label, -.has-success .help-block, -.has-success .radio, -.has-success .radio-inline, -.has-success.checkbox label, -.has-success.checkbox-inline label, -.has-success.radio label, -.has-success.radio-inline label { - color: #3c763d -} - -.has-success .form-control { - border-color: #3c763d; - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); - box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075) -} - -.has-success .form-control:focus { - border-color: #2b542c; - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #67b168; - box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #67b168 -} - -.has-success .input-group-addon { - color: #3c763d; - background-color: #dff0d8; - border-color: #3c763d -} - -.has-success .form-control-feedback { - color: #3c763d -} - -.has-warning .checkbox, -.has-warning .checkbox-inline, -.has-warning .control-label, -.has-warning .help-block, -.has-warning .radio, -.has-warning .radio-inline, -.has-warning.checkbox label, -.has-warning.checkbox-inline label, -.has-warning.radio label, -.has-warning.radio-inline label { - color: #8a6d3b -} - -.has-warning .form-control { - border-color: #8a6d3b; - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); - box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075) -} - -.has-warning .form-control:focus { - border-color: #66512c; - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #c0a16b; - box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #c0a16b -} - -.has-warning .input-group-addon { - color: #8a6d3b; - background-color: #fcf8e3; - border-color: #8a6d3b -} - -.has-warning .form-control-feedback { - color: #8a6d3b -} - -.has-error .checkbox, -.has-error .checkbox-inline, -.has-error .control-label, -.has-error .help-block, -.has-error .radio, -.has-error .radio-inline, -.has-error.checkbox label, -.has-error.checkbox-inline label, -.has-error.radio label, -.has-error.radio-inline label { - color: #a94442 -} - -.has-error .form-control { - border-color: #a94442; - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); - box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075) -} - -.has-error .form-control:focus { - border-color: #843534; - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #ce8483; - box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #ce8483 -} - -.has-error .input-group-addon { - color: #a94442; - background-color: #f2dede; - border-color: #a94442 -} - -.has-error .form-control-feedback { - color: #a94442 -} - -.has-feedback label~.form-control-feedback { - top: 25px -} - -.has-feedback label.sr-only~.form-control-feedback { - top: 0 -} - -.help-block { - display: block; - margin-top: 5px; - margin-bottom: 10px; - color: #737373 -} - -@media (min-width:768px) { - .form-inline .form-group { - display: inline-block; - margin-bottom: 0; - vertical-align: middle - } - - .form-inline .form-control { - display: inline-block; - width: auto; - vertical-align: middle - } - - .form-inline .form-control-static { - display: inline-block - } - - .form-inline .input-group { - display: inline-table; - vertical-align: middle - } - - .form-inline .input-group .form-control, - .form-inline .input-group .input-group-addon, - .form-inline .input-group .input-group-btn { - width: auto - } - - .form-inline .input-group>.form-control { - width: 100% - } - - .form-inline .control-label { - margin-bottom: 0; - vertical-align: middle - } - - .form-inline .checkbox, - .form-inline .radio { - display: inline-block; - margin-top: 0; - margin-bottom: 0; - vertical-align: middle - } - - .form-inline .checkbox label, - .form-inline .radio label { - padding-left: 0 - } - - .form-inline .checkbox input[type=checkbox], - .form-inline .radio input[type=radio] { - position: relative; - margin-left: 0 - } - - .form-inline .has-feedback .form-control-feedback { - top: 0 - } -} - -.form-horizontal .checkbox, -.form-horizontal .checkbox-inline, -.form-horizontal .radio, -.form-horizontal .radio-inline { - padding-top: 7px; - margin-top: 0; - margin-bottom: 0 -} - -.form-horizontal .checkbox, -.form-horizontal .radio { - min-height: 27px -} - -.form-horizontal .form-group { - margin-right: -15px; - margin-left: -15px -} - -@media (min-width:768px) { - .form-horizontal .control-label { - padding-top: 7px; - margin-bottom: 0; - text-align: right - } -} - -.form-horizontal .has-feedback .form-control-feedback { - right: 15px -} - -@media (min-width:768px) { - .form-horizontal .form-group-lg .control-label { - padding-top: 11px; - font-size: 18px - } -} - -@media (min-width:768px) { - .form-horizontal .form-group-sm .control-label { - padding-top: 6px; - font-size: 12px - } -} - -.btn { - display: inline-block; - padding: 6px 12px; - margin-bottom: 0; - font-size: 14px; - font-weight: 400; - line-height: 1.42857143; - text-align: center; - white-space: nowrap; - vertical-align: middle; - -ms-touch-action: manipulation; - touch-action: manipulation; - cursor: pointer; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - background-image: none; - border: 1px solid transparent; - border-radius: 4px -} - -.btn.active.focus, -.btn.active:focus, -.btn.focus, -.btn:active.focus, -.btn:active:focus, -.btn:focus { - outline: 5px auto -webkit-focus-ring-color; - outline-offset: -2px -} - -.btn.focus, -.btn:focus, -.btn:hover { - color: #333; - text-decoration: none -} - -.btn.active, -.btn:active { - background-image: none; - outline: 0; - -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125); - box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125) -} - -.btn.disabled, -.btn[disabled], -fieldset[disabled] .btn { - cursor: not-allowed; - filter: alpha(opacity=65); - -webkit-box-shadow: none; - box-shadow: none; - opacity: .65 -} - -a.btn.disabled, -fieldset[disabled] a.btn { - pointer-events: none -} - -.btn-default { - color: #333; - background-color: #fff; - border-color: #ccc -} - -.btn-default.focus, -.btn-default:focus { - color: #333; - background-color: #e6e6e6; - border-color: #8c8c8c -} - -.btn-default:hover { - color: #333; - background-color: #e6e6e6; - border-color: #adadad -} - -.btn-default.active, -.btn-default:active, -.open>.dropdown-toggle.btn-default { - color: #333; - background-color: #e6e6e6; - border-color: #adadad -} - -.btn-default.active.focus, -.btn-default.active:focus, -.btn-default.active:hover, -.btn-default:active.focus, -.btn-default:active:focus, -.btn-default:active:hover, -.open>.dropdown-toggle.btn-default.focus, -.open>.dropdown-toggle.btn-default:focus, -.open>.dropdown-toggle.btn-default:hover { - color: #333; - background-color: #d4d4d4; - border-color: #8c8c8c -} - -.btn-default.active, -.btn-default:active, -.open>.dropdown-toggle.btn-default { - background-image: none -} - -.btn-default.disabled.focus, -.btn-default.disabled:focus, -.btn-default.disabled:hover, -.btn-default[disabled].focus, -.btn-default[disabled]:focus, -.btn-default[disabled]:hover, -fieldset[disabled] .btn-default.focus, -fieldset[disabled] .btn-default:focus, -fieldset[disabled] .btn-default:hover { - background-color: #fff; - border-color: #ccc -} - -.btn-default .badge { - color: #fff; - background-color: #333 -} - -.btn-primary { - color: #fff; - background-color: #337ab7; - border-color: #2e6da4 -} - -.btn-primary.focus, -.btn-primary:focus { - color: #fff; - background-color: #286090; - border-color: #122b40 -} - -.btn-primary:hover { - color: #fff; - background-color: #286090; - border-color: #204d74 -} - -.btn-primary.active, -.btn-primary:active, -.open>.dropdown-toggle.btn-primary { - color: #fff; - background-color: #286090; - border-color: #204d74 -} - -.btn-primary.active.focus, -.btn-primary.active:focus, -.btn-primary.active:hover, -.btn-primary:active.focus, -.btn-primary:active:focus, -.btn-primary:active:hover, -.open>.dropdown-toggle.btn-primary.focus, -.open>.dropdown-toggle.btn-primary:focus, -.open>.dropdown-toggle.btn-primary:hover { - color: #fff; - background-color: #204d74; - border-color: #122b40 -} - -.btn-primary.active, -.btn-primary:active, -.open>.dropdown-toggle.btn-primary { - background-image: none -} - -.btn-primary.disabled.focus, -.btn-primary.disabled:focus, -.btn-primary.disabled:hover, -.btn-primary[disabled].focus, -.btn-primary[disabled]:focus, -.btn-primary[disabled]:hover, -fieldset[disabled] .btn-primary.focus, -fieldset[disabled] .btn-primary:focus, -fieldset[disabled] .btn-primary:hover { - background-color: #337ab7; - border-color: #2e6da4 -} - -.btn-primary .badge { - color: #337ab7; - background-color: #fff -} - -.btn-success { - color: #fff; - background-color: #5cb85c; - border-color: #4cae4c -} - -.btn-success.focus, -.btn-success:focus { - color: #fff; - background-color: #449d44; - border-color: #255625 -} - -.btn-success:hover { - color: #fff; - background-color: #449d44; - border-color: #398439 -} - -.btn-success.active, -.btn-success:active, -.open>.dropdown-toggle.btn-success { - color: #fff; - background-color: #449d44; - border-color: #398439 -} - -.btn-success.active.focus, -.btn-success.active:focus, -.btn-success.active:hover, -.btn-success:active.focus, -.btn-success:active:focus, -.btn-success:active:hover, -.open>.dropdown-toggle.btn-success.focus, -.open>.dropdown-toggle.btn-success:focus, -.open>.dropdown-toggle.btn-success:hover { - color: #fff; - background-color: #398439; - border-color: #255625 -} - -.btn-success.active, -.btn-success:active, -.open>.dropdown-toggle.btn-success { - background-image: none -} - -.btn-success.disabled.focus, -.btn-success.disabled:focus, -.btn-success.disabled:hover, -.btn-success[disabled].focus, -.btn-success[disabled]:focus, -.btn-success[disabled]:hover, -fieldset[disabled] .btn-success.focus, -fieldset[disabled] .btn-success:focus, -fieldset[disabled] .btn-success:hover { - background-color: #5cb85c; - border-color: #4cae4c -} - -.btn-success .badge { - color: #5cb85c; - background-color: #fff -} - -.btn-info { - color: #fff; - background-color: #5bc0de; - border-color: #46b8da -} - -.btn-info.focus, -.btn-info:focus { - color: #fff; - background-color: #31b0d5; - border-color: #1b6d85 -} - -.btn-info:hover { - color: #fff; - background-color: #31b0d5; - border-color: #269abc -} - -.btn-info.active, -.btn-info:active, -.open>.dropdown-toggle.btn-info { - color: #fff; - background-color: #31b0d5; - border-color: #269abc -} - -.btn-info.active.focus, -.btn-info.active:focus, -.btn-info.active:hover, -.btn-info:active.focus, -.btn-info:active:focus, -.btn-info:active:hover, -.open>.dropdown-toggle.btn-info.focus, -.open>.dropdown-toggle.btn-info:focus, -.open>.dropdown-toggle.btn-info:hover { - color: #fff; - background-color: #269abc; - border-color: #1b6d85 -} - -.btn-info.active, -.btn-info:active, -.open>.dropdown-toggle.btn-info { - background-image: none -} - -.btn-info.disabled.focus, -.btn-info.disabled:focus, -.btn-info.disabled:hover, -.btn-info[disabled].focus, -.btn-info[disabled]:focus, -.btn-info[disabled]:hover, -fieldset[disabled] .btn-info.focus, -fieldset[disabled] .btn-info:focus, -fieldset[disabled] .btn-info:hover { - background-color: #5bc0de; - border-color: #46b8da -} - -.btn-info .badge { - color: #5bc0de; - background-color: #fff -} - -.btn-warning { - color: #fff; - background-color: #f0ad4e; - border-color: #eea236 -} - -.btn-warning.focus, -.btn-warning:focus { - color: #fff; - background-color: #ec971f; - border-color: #985f0d -} - -.btn-warning:hover { - color: #fff; - background-color: #ec971f; - border-color: #d58512 -} - -.btn-warning.active, -.btn-warning:active, -.open>.dropdown-toggle.btn-warning { - color: #fff; - background-color: #ec971f; - border-color: #d58512 -} - -.btn-warning.active.focus, -.btn-warning.active:focus, -.btn-warning.active:hover, -.btn-warning:active.focus, -.btn-warning:active:focus, -.btn-warning:active:hover, -.open>.dropdown-toggle.btn-warning.focus, -.open>.dropdown-toggle.btn-warning:focus, -.open>.dropdown-toggle.btn-warning:hover { - color: #fff; - background-color: #d58512; - border-color: #985f0d -} - -.btn-warning.active, -.btn-warning:active, -.open>.dropdown-toggle.btn-warning { - background-image: none -} - -.btn-warning.disabled.focus, -.btn-warning.disabled:focus, -.btn-warning.disabled:hover, -.btn-warning[disabled].focus, -.btn-warning[disabled]:focus, -.btn-warning[disabled]:hover, -fieldset[disabled] .btn-warning.focus, -fieldset[disabled] .btn-warning:focus, -fieldset[disabled] .btn-warning:hover { - background-color: #f0ad4e; - border-color: #eea236 -} - -.btn-warning .badge { - color: #f0ad4e; - background-color: #fff -} - -.btn-danger { - color: #fff; - background-color: #d9534f; - border-color: #d43f3a -} - -.btn-danger.focus, -.btn-danger:focus { - color: #fff; - background-color: #c9302c; - border-color: #761c19 -} - -.btn-danger:hover { - color: #fff; - background-color: #c9302c; - border-color: #ac2925 -} - -.btn-danger.active, -.btn-danger:active, -.open>.dropdown-toggle.btn-danger { - color: #fff; - background-color: #c9302c; - border-color: #ac2925 -} - -.btn-danger.active.focus, -.btn-danger.active:focus, -.btn-danger.active:hover, -.btn-danger:active.focus, -.btn-danger:active:focus, -.btn-danger:active:hover, -.open>.dropdown-toggle.btn-danger.focus, -.open>.dropdown-toggle.btn-danger:focus, -.open>.dropdown-toggle.btn-danger:hover { - color: #fff; - background-color: #ac2925; - border-color: #761c19 -} - -.btn-danger.active, -.btn-danger:active, -.open>.dropdown-toggle.btn-danger { - background-image: none -} - -.btn-danger.disabled.focus, -.btn-danger.disabled:focus, -.btn-danger.disabled:hover, -.btn-danger[disabled].focus, -.btn-danger[disabled]:focus, -.btn-danger[disabled]:hover, -fieldset[disabled] .btn-danger.focus, -fieldset[disabled] .btn-danger:focus, -fieldset[disabled] .btn-danger:hover { - background-color: #d9534f; - border-color: #d43f3a -} - -.btn-danger .badge { - color: #d9534f; - background-color: #fff -} - -.btn-link { - font-weight: 400; - color: #337ab7; - border-radius: 0 -} - -.btn-link, -.btn-link.active, -.btn-link:active, -.btn-link[disabled], -fieldset[disabled] .btn-link { - background-color: transparent; - -webkit-box-shadow: none; - box-shadow: none -} - -.btn-link, -.btn-link:active, -.btn-link:focus, -.btn-link:hover { - border-color: transparent -} - -.btn-link:focus, -.btn-link:hover { - color: #23527c; - text-decoration: underline; - background-color: transparent -} - -.btn-link[disabled]:focus, -.btn-link[disabled]:hover, -fieldset[disabled] .btn-link:focus, -fieldset[disabled] .btn-link:hover { - color: #777; - text-decoration: none -} - -.btn-group-lg>.btn, -.btn-lg { - padding: 10px 16px; - font-size: 18px; - line-height: 1.3333333; - border-radius: 6px -} - -.btn-group-sm>.btn, -.btn-sm { - padding: 5px 10px; - font-size: 12px; - line-height: 1.5; - border-radius: 3px -} - -.btn-group-xs>.btn, -.btn-xs { - padding: 1px 5px; - font-size: 12px; - line-height: 1.5; - border-radius: 3px -} - -.btn-block { - display: block; - width: 100% -} - -.btn-block+.btn-block { - margin-top: 5px -} - -input[type=button].btn-block, -input[type=reset].btn-block, -input[type=submit].btn-block { - width: 100% -} - -.fade { - opacity: 0; - -webkit-transition: opacity .15s linear; - -o-transition: opacity .15s linear; - transition: opacity .15s linear -} - -.fade.in { - opacity: 1 -} - -.collapse { - display: none -} - -.collapse.in { - display: block -} - -tr.collapse.in { - display: table-row -} - -tbody.collapse.in { - display: table-row-group -} - -.collapsing { - position: relative; - height: 0; - overflow: hidden; - -webkit-transition-timing-function: ease; - -o-transition-timing-function: ease; - transition-timing-function: ease; - -webkit-transition-duration: .35s; - -o-transition-duration: .35s; - transition-duration: .35s; - -webkit-transition-property: height, visibility; - -o-transition-property: height, visibility; - transition-property: height, visibility -} - -.caret { - display: inline-block; - width: 0; - height: 0; - margin-left: 2px; - vertical-align: middle; - border-top: 4px dashed; - border-top: 4px solid\9; - border-right: 4px solid transparent; - border-left: 4px solid transparent -} - -.dropdown, -.dropup { - position: relative -} - -.dropdown-toggle:focus { - outline: 0 -} - -.dropdown-menu { - position: absolute; - top: 100%; - left: 0; - z-index: 1000; - display: none; - float: left; - min-width: 160px; - padding: 5px 0; - margin: 2px 0 0; - font-size: 14px; - text-align: left; - list-style: none; - background-color: #fff; - -webkit-background-clip: padding-box; - background-clip: padding-box; - border: 1px solid #ccc; - border: 1px solid rgba(0, 0, 0, .15); - border-radius: 4px; - -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, .175); - box-shadow: 0 6px 12px rgba(0, 0, 0, .175) -} - -.dropdown-menu.pull-right { - right: 0; - left: auto -} - -.dropdown-menu .divider { - height: 1px; - margin: 9px 0; - overflow: hidden; - background-color: #e5e5e5 -} - -.dropdown-menu>li>a { - display: block; - padding: 3px 20px; - clear: both; - font-weight: 400; - line-height: 1.42857143; - color: #333; - white-space: nowrap -} - -.dropdown-menu>li>a:focus, -.dropdown-menu>li>a:hover { - color: #262626; - text-decoration: none; - background-color: #f5f5f5 -} - -.dropdown-menu>.active>a, -.dropdown-menu>.active>a:focus, -.dropdown-menu>.active>a:hover { - color: #fff; - text-decoration: none; - background-color: #337ab7; - outline: 0 -} - -.dropdown-menu>.disabled>a, -.dropdown-menu>.disabled>a:focus, -.dropdown-menu>.disabled>a:hover { - color: #777 -} - -.dropdown-menu>.disabled>a:focus, -.dropdown-menu>.disabled>a:hover { - text-decoration: none; - cursor: not-allowed; - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.gradient(enabled=false) -} - -.open>.dropdown-menu { - display: block -} - -.open>a { - outline: 0 -} - -.dropdown-menu-right { - right: 0; - left: auto -} - -.dropdown-menu-left { - right: auto; - left: 0 -} - -.dropdown-header { - display: block; - padding: 3px 20px; - font-size: 12px; - line-height: 1.42857143; - color: #777; - white-space: nowrap -} - -.dropdown-backdrop { - position: fixed; - top: 0; - right: 0; - bottom: 0; - left: 0; - z-index: 990 -} - -.pull-right>.dropdown-menu { - right: 0; - left: auto -} - -.dropup .caret, -.navbar-fixed-bottom .dropdown .caret { - content: ""; - border-top: 0; - border-bottom: 4px dashed; - border-bottom: 4px solid\9 -} - -.dropup .dropdown-menu, -.navbar-fixed-bottom .dropdown .dropdown-menu { - top: auto; - bottom: 100%; - margin-bottom: 2px -} - -@media (min-width:768px) { - .navbar-right .dropdown-menu { - right: 0; - left: auto - } - - .navbar-right .dropdown-menu-left { - right: auto; - left: 0 - } -} - -.btn-group, -.btn-group-vertical { - position: relative; - display: inline-block; - vertical-align: middle -} - -.btn-group-vertical>.btn, -.btn-group>.btn { - position: relative; - float: left -} - -.btn-group-vertical>.btn.active, -.btn-group-vertical>.btn:active, -.btn-group-vertical>.btn:focus, -.btn-group-vertical>.btn:hover, -.btn-group>.btn.active, -.btn-group>.btn:active, -.btn-group>.btn:focus, -.btn-group>.btn:hover { - z-index: 2 -} - -.btn-group .btn+.btn, -.btn-group .btn+.btn-group, -.btn-group .btn-group+.btn, -.btn-group .btn-group+.btn-group { - margin-left: -1px -} - -.btn-toolbar { - margin-left: -5px -} - -.btn-toolbar .btn, -.btn-toolbar .btn-group, -.btn-toolbar .input-group { - float: left -} - -.btn-toolbar>.btn, -.btn-toolbar>.btn-group, -.btn-toolbar>.input-group { - margin-left: 5px -} - -.btn-group>.btn:not(:first-child):not(:last-child):not(.dropdown-toggle) { - border-radius: 0 -} - -.btn-group>.btn:first-child { - margin-left: 0 -} - -.btn-group>.btn:first-child:not(:last-child):not(.dropdown-toggle) { - border-top-right-radius: 0; - border-bottom-right-radius: 0 -} - -.btn-group>.btn:last-child:not(:first-child), -.btn-group>.dropdown-toggle:not(:first-child) { - border-top-left-radius: 0; - border-bottom-left-radius: 0 -} - -.btn-group>.btn-group { - float: left -} - -.btn-group>.btn-group:not(:first-child):not(:last-child)>.btn { - border-radius: 0 -} - -.btn-group>.btn-group:first-child:not(:last-child)>.btn:last-child, -.btn-group>.btn-group:first-child:not(:last-child)>.dropdown-toggle { - border-top-right-radius: 0; - border-bottom-right-radius: 0 -} - -.btn-group>.btn-group:last-child:not(:first-child)>.btn:first-child { - border-top-left-radius: 0; - border-bottom-left-radius: 0 -} - -.btn-group .dropdown-toggle:active, -.btn-group.open .dropdown-toggle { - outline: 0 -} - -.btn-group>.btn+.dropdown-toggle { - padding-right: 8px; - padding-left: 8px -} - -.btn-group>.btn-lg+.dropdown-toggle { - padding-right: 12px; - padding-left: 12px -} - -.btn-group.open .dropdown-toggle { - -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125); - box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125) -} - -.btn-group.open .dropdown-toggle.btn-link { - -webkit-box-shadow: none; - box-shadow: none -} - -.btn .caret { - margin-left: 0 -} - -.btn-lg .caret { - border-width: 5px 5px 0; - border-bottom-width: 0 -} - -.dropup .btn-lg .caret { - border-width: 0 5px 5px -} - -.btn-group-vertical>.btn, -.btn-group-vertical>.btn-group, -.btn-group-vertical>.btn-group>.btn { - display: block; - float: none; - width: 100%; - max-width: 100% -} - -.btn-group-vertical>.btn-group>.btn { - float: none -} - -.btn-group-vertical>.btn+.btn, -.btn-group-vertical>.btn+.btn-group, -.btn-group-vertical>.btn-group+.btn, -.btn-group-vertical>.btn-group+.btn-group { - margin-top: -1px; - margin-left: 0 -} - -.btn-group-vertical>.btn:not(:first-child):not(:last-child) { - border-radius: 0 -} - -.btn-group-vertical>.btn:first-child:not(:last-child) { - border-top-left-radius: 4px; - border-top-right-radius: 4px; - border-bottom-right-radius: 0; - border-bottom-left-radius: 0 -} - -.btn-group-vertical>.btn:last-child:not(:first-child) { - border-top-left-radius: 0; - border-top-right-radius: 0; - border-bottom-right-radius: 4px; - border-bottom-left-radius: 4px -} - -.btn-group-vertical>.btn-group:not(:first-child):not(:last-child)>.btn { - border-radius: 0 -} - -.btn-group-vertical>.btn-group:first-child:not(:last-child)>.btn:last-child, -.btn-group-vertical>.btn-group:first-child:not(:last-child)>.dropdown-toggle { - border-bottom-right-radius: 0; - border-bottom-left-radius: 0 -} - -.btn-group-vertical>.btn-group:last-child:not(:first-child)>.btn:first-child { - border-top-left-radius: 0; - border-top-right-radius: 0 -} - -.btn-group-justified { - display: table; - width: 100%; - table-layout: fixed; - border-collapse: separate -} - -.btn-group-justified>.btn, -.btn-group-justified>.btn-group { - display: table-cell; - float: none; - width: 1% -} - -.btn-group-justified>.btn-group .btn { - width: 100% -} - -.btn-group-justified>.btn-group .dropdown-menu { - left: auto -} - -[data-toggle=buttons]>.btn input[type=checkbox], -[data-toggle=buttons]>.btn input[type=radio], -[data-toggle=buttons]>.btn-group>.btn input[type=checkbox], -[data-toggle=buttons]>.btn-group>.btn input[type=radio] { - position: absolute; - clip: rect(0, 0, 0, 0); - pointer-events: none -} - -.input-group { - position: relative; - display: table; - border-collapse: separate -} - -.input-group[class*=col-] { - float: none; - padding-right: 0; - padding-left: 0 -} - -.input-group .form-control { - position: relative; - z-index: 2; - float: left; - width: 100%; - margin-bottom: 0 -} - -.input-group .form-control:focus { - z-index: 3 -} - -.input-group-lg>.form-control, -.input-group-lg>.input-group-addon, -.input-group-lg>.input-group-btn>.btn { - height: 46px; - padding: 10px 16px; - font-size: 18px; - line-height: 1.3333333; - border-radius: 6px -} - -select.input-group-lg>.form-control, -select.input-group-lg>.input-group-addon, -select.input-group-lg>.input-group-btn>.btn { - height: 46px; - line-height: 46px -} - -select[multiple].input-group-lg>.form-control, -select[multiple].input-group-lg>.input-group-addon, -select[multiple].input-group-lg>.input-group-btn>.btn, -textarea.input-group-lg>.form-control, -textarea.input-group-lg>.input-group-addon, -textarea.input-group-lg>.input-group-btn>.btn { - height: auto -} - -.input-group-sm>.form-control, -.input-group-sm>.input-group-addon, -.input-group-sm>.input-group-btn>.btn { - height: 30px; - padding: 5px 10px; - font-size: 12px; - line-height: 1.5; - border-radius: 3px -} - -select.input-group-sm>.form-control, -select.input-group-sm>.input-group-addon, -select.input-group-sm>.input-group-btn>.btn { - height: 30px; - line-height: 30px -} - -select[multiple].input-group-sm>.form-control, -select[multiple].input-group-sm>.input-group-addon, -select[multiple].input-group-sm>.input-group-btn>.btn, -textarea.input-group-sm>.form-control, -textarea.input-group-sm>.input-group-addon, -textarea.input-group-sm>.input-group-btn>.btn { - height: auto -} - -.input-group .form-control, -.input-group-addon, -.input-group-btn { - display: table-cell -} - -.input-group .form-control:not(:first-child):not(:last-child), -.input-group-addon:not(:first-child):not(:last-child), -.input-group-btn:not(:first-child):not(:last-child) { - border-radius: 0 -} - -.input-group-addon, -.input-group-btn { - width: 1%; - white-space: nowrap; - vertical-align: middle -} - -.input-group-addon { - padding: 6px 12px; - font-size: 14px; - font-weight: 400; - line-height: 1; - color: #555; - text-align: center; - background-color: #eee; - border: 1px solid #ccc; - border-radius: 4px -} - -.input-group-addon.input-sm { - padding: 5px 10px; - font-size: 12px; - border-radius: 3px -} - -.input-group-addon.input-lg { - padding: 10px 16px; - font-size: 18px; - border-radius: 6px -} - -.input-group-addon input[type=checkbox], -.input-group-addon input[type=radio] { - margin-top: 0 -} - -.input-group .form-control:first-child, -.input-group-addon:first-child, -.input-group-btn:first-child>.btn, -.input-group-btn:first-child>.btn-group>.btn, -.input-group-btn:first-child>.dropdown-toggle, -.input-group-btn:last-child>.btn-group:not(:last-child)>.btn, -.input-group-btn:last-child>.btn:not(:last-child):not(.dropdown-toggle) { - border-top-right-radius: 0; - border-bottom-right-radius: 0 -} - -.input-group-addon:first-child { - border-right: 0 -} - -.input-group .form-control:last-child, -.input-group-addon:last-child, -.input-group-btn:first-child>.btn-group:not(:first-child)>.btn, -.input-group-btn:first-child>.btn:not(:first-child), -.input-group-btn:last-child>.btn, -.input-group-btn:last-child>.btn-group>.btn, -.input-group-btn:last-child>.dropdown-toggle { - border-top-left-radius: 0; - border-bottom-left-radius: 0 -} - -.input-group-addon:last-child { - border-left: 0 -} - -.input-group-btn { - position: relative; - font-size: 0; - white-space: nowrap -} - -.input-group-btn>.btn { - position: relative -} - -.input-group-btn>.btn+.btn { - margin-left: -1px -} - -.input-group-btn>.btn:active, -.input-group-btn>.btn:focus, -.input-group-btn>.btn:hover { - z-index: 2 -} - -.input-group-btn:first-child>.btn, -.input-group-btn:first-child>.btn-group { - margin-right: -1px -} - -.input-group-btn:last-child>.btn, -.input-group-btn:last-child>.btn-group { - z-index: 2; - margin-left: -1px -} - -.nav { - padding-left: 0; - margin-bottom: 0; - list-style: none -} - -.nav>li { - position: relative; - display: block -} - -.nav>li>a { - position: relative; - display: block; - padding: 10px 15px -} - -.nav>li>a:focus, -.nav>li>a:hover { - text-decoration: none; - background-color: #eee -} - -.nav>li.disabled>a { - color: #777 -} - -.nav>li.disabled>a:focus, -.nav>li.disabled>a:hover { - color: #777; - text-decoration: none; - cursor: not-allowed; - background-color: transparent -} - -.nav .open>a, -.nav .open>a:focus, -.nav .open>a:hover { - background-color: #eee; - border-color: #337ab7 -} - -.nav .nav-divider { - height: 1px; - margin: 9px 0; - overflow: hidden; - background-color: #e5e5e5 -} - -.nav>li>a>img { - max-width: none -} - -.nav-tabs { - border-bottom: 1px solid #ddd -} - -.nav-tabs>li { - float: left; - margin-bottom: -1px -} - -.nav-tabs>li>a { - margin-right: 2px; - line-height: 1.42857143; - border: 1px solid transparent; - border-radius: 4px 4px 0 0 -} - -.nav-tabs>li>a:hover { - border-color: #eee #eee #ddd -} - -.nav-tabs>li.active>a, -.nav-tabs>li.active>a:focus, -.nav-tabs>li.active>a:hover { - color: #555; - cursor: default; - background-color: #fff; - border: 1px solid #ddd; - border-bottom-color: transparent -} - -.nav-tabs.nav-justified { - width: 100%; - border-bottom: 0 -} - -.nav-tabs.nav-justified>li { - float: none -} - -.nav-tabs.nav-justified>li>a { - margin-bottom: 5px; - text-align: center -} - -.nav-tabs.nav-justified>.dropdown .dropdown-menu { - top: auto; - left: auto -} - -@media (min-width:768px) { - .nav-tabs.nav-justified>li { - display: table-cell; - width: 1% - } - - .nav-tabs.nav-justified>li>a { - margin-bottom: 0 - } -} - -.nav-tabs.nav-justified>li>a { - margin-right: 0; - border-radius: 4px -} - -.nav-tabs.nav-justified>.active>a, -.nav-tabs.nav-justified>.active>a:focus, -.nav-tabs.nav-justified>.active>a:hover { - border: 1px solid #ddd -} - -@media (min-width:768px) { - .nav-tabs.nav-justified>li>a { - border-bottom: 1px solid #ddd; - border-radius: 4px 4px 0 0 - } - - .nav-tabs.nav-justified>.active>a, - .nav-tabs.nav-justified>.active>a:focus, - .nav-tabs.nav-justified>.active>a:hover { - border-bottom-color: #fff - } -} - -.nav-pills>li { - float: left -} - -.nav-pills>li>a { - border-radius: 4px -} - -.nav-pills>li+li { - margin-left: 2px -} - -.nav-pills>li.active>a, -.nav-pills>li.active>a:focus, -.nav-pills>li.active>a:hover { - color: #fff; - background-color: #337ab7 -} - -.nav-stacked>li { - float: none -} - -.nav-stacked>li+li { - margin-top: 2px; - margin-left: 0 -} - -.nav-justified { - width: 100% -} - -.nav-justified>li { - float: none -} - -.nav-justified>li>a { - margin-bottom: 5px; - text-align: center -} - -.nav-justified>.dropdown .dropdown-menu { - top: auto; - left: auto -} - -@media (min-width:768px) { - .nav-justified>li { - display: table-cell; - width: 1% - } - - .nav-justified>li>a { - margin-bottom: 0 - } -} - -.nav-tabs-justified { - border-bottom: 0 -} - -.nav-tabs-justified>li>a { - margin-right: 0; - border-radius: 4px -} - -.nav-tabs-justified>.active>a, -.nav-tabs-justified>.active>a:focus, -.nav-tabs-justified>.active>a:hover { - border: 1px solid #ddd -} - -@media (min-width:768px) { - .nav-tabs-justified>li>a { - border-bottom: 1px solid #ddd; - border-radius: 4px 4px 0 0 - } - - .nav-tabs-justified>.active>a, - .nav-tabs-justified>.active>a:focus, - .nav-tabs-justified>.active>a:hover { - border-bottom-color: #fff - } -} - -.tab-content>.tab-pane { - display: none -} - -.tab-content>.active { - display: block -} - -.nav-tabs .dropdown-menu { - margin-top: -1px; - border-top-left-radius: 0; - border-top-right-radius: 0 -} - -.navbar { - position: relative; - min-height: 50px; - margin-bottom: 20px; - border: 1px solid transparent -} - -@media (min-width:768px) { - .navbar { - border-radius: 4px - } -} - -@media (min-width:768px) { - .navbar-header { - float: left - } -} - -.navbar-collapse { - padding-right: 15px; - padding-left: 15px; - overflow-x: visible; - -webkit-overflow-scrolling: touch; - border-top: 1px solid transparent; - -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1); - box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1) -} - -.navbar-collapse.in { - overflow-y: auto -} - -@media (min-width:768px) { - .navbar-collapse { - width: auto; - border-top: 0; - -webkit-box-shadow: none; - box-shadow: none - } - - .navbar-collapse.collapse { - display: block !important; - height: auto !important; - padding-bottom: 0; - overflow: visible !important - } - - .navbar-collapse.in { - overflow-y: visible - } - - .navbar-fixed-bottom .navbar-collapse, - .navbar-fixed-top .navbar-collapse, - .navbar-static-top .navbar-collapse { - padding-right: 0; - padding-left: 0 - } -} - -.navbar-fixed-bottom .navbar-collapse, -.navbar-fixed-top .navbar-collapse { - max-height: 340px -} - -@media (max-device-width:480px) and (orientation:landscape) { - - .navbar-fixed-bottom .navbar-collapse, - .navbar-fixed-top .navbar-collapse { - max-height: 200px - } -} - -.container-fluid>.navbar-collapse, -.container-fluid>.navbar-header, -.container>.navbar-collapse, -.container>.navbar-header { - margin-right: -15px; - margin-left: -15px -} - -@media (min-width:768px) { - - .container-fluid>.navbar-collapse, - .container-fluid>.navbar-header, - .container>.navbar-collapse, - .container>.navbar-header { - margin-right: 0; - margin-left: 0 - } -} - -.navbar-static-top { - z-index: 1000; - border-width: 0 0 1px -} - -@media (min-width:768px) { - .navbar-static-top { - border-radius: 0 - } -} - -.navbar-fixed-bottom, -.navbar-fixed-top { - position: fixed; - right: 0; - left: 0; - z-index: 1030 -} - -@media (min-width:768px) { - - .navbar-fixed-bottom, - .navbar-fixed-top { - border-radius: 0 - } -} - -.navbar-fixed-top { - top: 0; - border-width: 0 0 1px -} - -.navbar-fixed-bottom { - bottom: 0; - margin-bottom: 0; - border-width: 1px 0 0 -} - -.navbar-brand { - float: left; - height: 50px; - padding: 15px 15px; - font-size: 18px; - line-height: 20px -} - -.navbar-brand:focus, -.navbar-brand:hover { - text-decoration: none -} - -.navbar-brand>img { - display: block -} - -@media (min-width:768px) { - - .navbar>.container .navbar-brand, - .navbar>.container-fluid .navbar-brand { - margin-left: -15px - } -} - -.navbar-toggle { - position: relative; - float: right; - padding: 9px 10px; - margin-top: 8px; - margin-right: 15px; - margin-bottom: 8px; - background-color: transparent; - background-image: none; - border: 1px solid transparent; - border-radius: 4px -} - -.navbar-toggle:focus { - outline: 0 -} - -.navbar-toggle .icon-bar { - display: block; - width: 22px; - height: 2px; - border-radius: 1px -} - -.navbar-toggle .icon-bar+.icon-bar { - margin-top: 4px -} - -@media (min-width:768px) { - .navbar-toggle { - display: none - } -} - -.navbar-nav { - margin: 7.5px -15px -} - -.navbar-nav>li>a { - padding-top: 10px; - padding-bottom: 10px; - line-height: 20px -} - -@media (max-width:767px) { - .navbar-nav .open .dropdown-menu { - position: static; - float: none; - width: auto; - margin-top: 0; - background-color: transparent; - border: 0; - -webkit-box-shadow: none; - box-shadow: none - } - - .navbar-nav .open .dropdown-menu .dropdown-header, - .navbar-nav .open .dropdown-menu>li>a { - padding: 5px 15px 5px 25px - } - - .navbar-nav .open .dropdown-menu>li>a { - line-height: 20px - } - - .navbar-nav .open .dropdown-menu>li>a:focus, - .navbar-nav .open .dropdown-menu>li>a:hover { - background-image: none - } -} - -@media (min-width:768px) { - .navbar-nav { - float: left; - margin: 0 - } - - .navbar-nav>li { - float: left - } - - .navbar-nav>li>a { - padding-top: 15px; - padding-bottom: 15px - } -} - -.navbar-form { - padding: 10px 15px; - margin-top: 8px; - margin-right: -15px; - margin-bottom: 8px; - margin-left: -15px; - border-top: 1px solid transparent; - border-bottom: 1px solid transparent; - -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 1px 0 rgba(255, 255, 255, .1); - box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 1px 0 rgba(255, 255, 255, .1) -} - -@media (min-width:768px) { - .navbar-form .form-group { - display: inline-block; - margin-bottom: 0; - vertical-align: middle - } - - .navbar-form .form-control { - display: inline-block; - width: auto; - vertical-align: middle - } - - .navbar-form .form-control-static { - display: inline-block - } - - .navbar-form .input-group { - display: inline-table; - vertical-align: middle - } - - .navbar-form .input-group .form-control, - .navbar-form .input-group .input-group-addon, - .navbar-form .input-group .input-group-btn { - width: auto - } - - .navbar-form .input-group>.form-control { - width: 100% - } - - .navbar-form .control-label { - margin-bottom: 0; - vertical-align: middle - } - - .navbar-form .checkbox, - .navbar-form .radio { - display: inline-block; - margin-top: 0; - margin-bottom: 0; - vertical-align: middle - } - - .navbar-form .checkbox label, - .navbar-form .radio label { - padding-left: 0 - } - - .navbar-form .checkbox input[type=checkbox], - .navbar-form .radio input[type=radio] { - position: relative; - margin-left: 0 - } - - .navbar-form .has-feedback .form-control-feedback { - top: 0 - } -} - -@media (max-width:767px) { - .navbar-form .form-group { - margin-bottom: 5px - } - - .navbar-form .form-group:last-child { - margin-bottom: 0 - } -} - -@media (min-width:768px) { - .navbar-form { - width: auto; - padding-top: 0; - padding-bottom: 0; - margin-right: 0; - margin-left: 0; - border: 0; - -webkit-box-shadow: none; - box-shadow: none - } -} - -.navbar-nav>li>.dropdown-menu { - margin-top: 0; - border-top-left-radius: 0; - border-top-right-radius: 0 -} - -.navbar-fixed-bottom .navbar-nav>li>.dropdown-menu { - margin-bottom: 0; - border-top-left-radius: 4px; - border-top-right-radius: 4px; - border-bottom-right-radius: 0; - border-bottom-left-radius: 0 -} - -.navbar-btn { - margin-top: 8px; - margin-bottom: 8px -} - -.navbar-btn.btn-sm { - margin-top: 10px; - margin-bottom: 10px -} - -.navbar-btn.btn-xs { - margin-top: 14px; - margin-bottom: 14px -} - -.navbar-text { - margin-top: 15px; - margin-bottom: 15px -} - -@media (min-width:768px) { - .navbar-text { - float: left; - margin-right: 15px; - margin-left: 15px - } -} - -@media (min-width:768px) { - .navbar-left { - float: left !important - } - - .navbar-right { - float: right !important; - margin-right: -15px - } - - .navbar-right~.navbar-right { - margin-right: 0 - } -} - -.navbar-default { - background-color: #f8f8f8; - border-color: #e7e7e7 -} - -.navbar-default .navbar-brand { - color: #777 -} - -.navbar-default .navbar-brand:focus, -.navbar-default .navbar-brand:hover { - color: #5e5e5e; - background-color: transparent -} - -.navbar-default .navbar-text { - color: #777 -} - -.navbar-default .navbar-nav>li>a { - color: #777 -} - -.navbar-default .navbar-nav>li>a:focus, -.navbar-default .navbar-nav>li>a:hover { - color: #333; - background-color: transparent -} - -.navbar-default .navbar-nav>.active>a, -.navbar-default .navbar-nav>.active>a:focus, -.navbar-default .navbar-nav>.active>a:hover { - color: #555; - background-color: #e7e7e7 -} - -.navbar-default .navbar-nav>.disabled>a, -.navbar-default .navbar-nav>.disabled>a:focus, -.navbar-default .navbar-nav>.disabled>a:hover { - color: #ccc; - background-color: transparent -} - -.navbar-default .navbar-toggle { - border-color: #ddd -} - -.navbar-default .navbar-toggle:focus, -.navbar-default .navbar-toggle:hover { - background-color: #ddd -} - -.navbar-default .navbar-toggle .icon-bar { - background-color: #888 -} - -.navbar-default .navbar-collapse, -.navbar-default .navbar-form { - border-color: #e7e7e7 -} - -.navbar-default .navbar-nav>.open>a, -.navbar-default .navbar-nav>.open>a:focus, -.navbar-default .navbar-nav>.open>a:hover { - color: #555; - background-color: #e7e7e7 -} - -@media (max-width:767px) { - .navbar-default .navbar-nav .open .dropdown-menu>li>a { - color: #777 - } - - .navbar-default .navbar-nav .open .dropdown-menu>li>a:focus, - .navbar-default .navbar-nav .open .dropdown-menu>li>a:hover { - color: #333; - background-color: transparent - } - - .navbar-default .navbar-nav .open .dropdown-menu>.active>a, - .navbar-default .navbar-nav .open .dropdown-menu>.active>a:focus, - .navbar-default .navbar-nav .open .dropdown-menu>.active>a:hover { - color: #555; - background-color: #e7e7e7 - } - - .navbar-default .navbar-nav .open .dropdown-menu>.disabled>a, - .navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:focus, - .navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:hover { - color: #ccc; - background-color: transparent - } -} - -.navbar-default .navbar-link { - color: #777 -} - -.navbar-default .navbar-link:hover { - color: #333 -} - -.navbar-default .btn-link { - color: #777 -} - -.navbar-default .btn-link:focus, -.navbar-default .btn-link:hover { - color: #333 -} - -.navbar-default .btn-link[disabled]:focus, -.navbar-default .btn-link[disabled]:hover, -fieldset[disabled] .navbar-default .btn-link:focus, -fieldset[disabled] .navbar-default .btn-link:hover { - color: #ccc -} - -.navbar-inverse { - background-color: #222; - border-color: #080808 -} - -.navbar-inverse .navbar-brand { - color: #9d9d9d -} - -.navbar-inverse .navbar-brand:focus, -.navbar-inverse .navbar-brand:hover { - color: #fff; - background-color: transparent -} - -.navbar-inverse .navbar-text { - color: #9d9d9d -} - -.navbar-inverse .navbar-nav>li>a { - color: #9d9d9d -} - -.navbar-inverse .navbar-nav>li>a:focus, -.navbar-inverse .navbar-nav>li>a:hover { - color: #fff; - background-color: transparent -} - -.navbar-inverse .navbar-nav>.active>a, -.navbar-inverse .navbar-nav>.active>a:focus, -.navbar-inverse .navbar-nav>.active>a:hover { - color: #fff; - background-color: #080808 -} - -.navbar-inverse .navbar-nav>.disabled>a, -.navbar-inverse .navbar-nav>.disabled>a:focus, -.navbar-inverse .navbar-nav>.disabled>a:hover { - color: #444; - background-color: transparent -} - -.navbar-inverse .navbar-toggle { - border-color: #333 -} - -.navbar-inverse .navbar-toggle:focus, -.navbar-inverse .navbar-toggle:hover { - background-color: #333 -} - -.navbar-inverse .navbar-toggle .icon-bar { - background-color: #fff -} - -.navbar-inverse .navbar-collapse, -.navbar-inverse .navbar-form { - border-color: #101010 -} - -.navbar-inverse .navbar-nav>.open>a, -.navbar-inverse .navbar-nav>.open>a:focus, -.navbar-inverse .navbar-nav>.open>a:hover { - color: #fff; - background-color: #080808 -} - -@media (max-width:767px) { - .navbar-inverse .navbar-nav .open .dropdown-menu>.dropdown-header { - border-color: #080808 - } - - .navbar-inverse .navbar-nav .open .dropdown-menu .divider { - background-color: #080808 - } - - .navbar-inverse .navbar-nav .open .dropdown-menu>li>a { - color: #9d9d9d - } - - .navbar-inverse .navbar-nav .open .dropdown-menu>li>a:focus, - .navbar-inverse .navbar-nav .open .dropdown-menu>li>a:hover { - color: #fff; - background-color: transparent - } - - .navbar-inverse .navbar-nav .open .dropdown-menu>.active>a, - .navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:focus, - .navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:hover { - color: #fff; - background-color: #080808 - } - - .navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a, - .navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:focus, - .navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:hover { - color: #444; - background-color: transparent - } -} - -.navbar-inverse .navbar-link { - color: #9d9d9d -} - -.navbar-inverse .navbar-link:hover { - color: #fff -} - -.navbar-inverse .btn-link { - color: #9d9d9d -} - -.navbar-inverse .btn-link:focus, -.navbar-inverse .btn-link:hover { - color: #fff -} - -.navbar-inverse .btn-link[disabled]:focus, -.navbar-inverse .btn-link[disabled]:hover, -fieldset[disabled] .navbar-inverse .btn-link:focus, -fieldset[disabled] .navbar-inverse .btn-link:hover { - color: #444 -} - -.breadcrumb { - padding: 8px 15px; - margin-bottom: 20px; - list-style: none; - background-color: #f5f5f5; - border-radius: 4px -} - -.breadcrumb>li { - display: inline-block -} - -.breadcrumb>li+li:before { - padding: 0 5px; - color: #ccc; - content: "/\00a0" -} - -.breadcrumb>.active { - color: #777 -} - -.pagination { - display: inline-block; - padding-left: 0; - margin: 20px 0; - border-radius: 4px -} - -.pagination>li { - display: inline -} - -.pagination>li>a, -.pagination>li>span { - position: relative; - float: left; - padding: 6px 12px; - margin-left: -1px; - line-height: 1.42857143; - color: #337ab7; - text-decoration: none; - background-color: #fff; - border: 1px solid #ddd -} - -.pagination>li:first-child>a, -.pagination>li:first-child>span { - margin-left: 0; - border-top-left-radius: 4px; - border-bottom-left-radius: 4px -} - -.pagination>li:last-child>a, -.pagination>li:last-child>span { - border-top-right-radius: 4px; - border-bottom-right-radius: 4px -} - -.pagination>li>a:focus, -.pagination>li>a:hover, -.pagination>li>span:focus, -.pagination>li>span:hover { - z-index: 2; - color: #23527c; - background-color: #eee; - border-color: #ddd -} - -.pagination>.active>a, -.pagination>.active>a:focus, -.pagination>.active>a:hover, -.pagination>.active>span, -.pagination>.active>span:focus, -.pagination>.active>span:hover { - z-index: 3; - color: #fff; - cursor: default; - background-color: #337ab7; - border-color: #337ab7 -} - -.pagination>.disabled>a, -.pagination>.disabled>a:focus, -.pagination>.disabled>a:hover, -.pagination>.disabled>span, -.pagination>.disabled>span:focus, -.pagination>.disabled>span:hover { - color: #777; - cursor: not-allowed; - background-color: #fff; - border-color: #ddd -} - -.pagination-lg>li>a, -.pagination-lg>li>span { - padding: 10px 16px; - font-size: 18px; - line-height: 1.3333333 -} - -.pagination-lg>li:first-child>a, -.pagination-lg>li:first-child>span { - border-top-left-radius: 6px; - border-bottom-left-radius: 6px -} - -.pagination-lg>li:last-child>a, -.pagination-lg>li:last-child>span { - border-top-right-radius: 6px; - border-bottom-right-radius: 6px -} - -.pagination-sm>li>a, -.pagination-sm>li>span { - padding: 5px 10px; - font-size: 12px; - line-height: 1.5 -} - -.pagination-sm>li:first-child>a, -.pagination-sm>li:first-child>span { - border-top-left-radius: 3px; - border-bottom-left-radius: 3px -} - -.pagination-sm>li:last-child>a, -.pagination-sm>li:last-child>span { - border-top-right-radius: 3px; - border-bottom-right-radius: 3px -} - -.pager { - padding-left: 0; - margin: 20px 0; - text-align: center; - list-style: none -} - -.pager li { - display: inline -} - -.pager li>a, -.pager li>span { - display: inline-block; - padding: 5px 14px; - background-color: #fff; - border: 1px solid #ddd; - border-radius: 15px -} - -.pager li>a:focus, -.pager li>a:hover { - text-decoration: none; - background-color: #eee -} - -.pager .next>a, -.pager .next>span { - float: right -} - -.pager .previous>a, -.pager .previous>span { - float: left -} - -.pager .disabled>a, -.pager .disabled>a:focus, -.pager .disabled>a:hover, -.pager .disabled>span { - color: #777; - cursor: not-allowed; - background-color: #fff -} - -.label { - display: inline; - padding: .2em .6em .3em; - font-size: 75%; - font-weight: 700; - line-height: 1; - color: #fff; - text-align: center; - white-space: nowrap; - vertical-align: baseline; - border-radius: .25em -} - -a.label:focus, -a.label:hover { - color: #fff; - text-decoration: none; - cursor: pointer -} - -.label:empty { - display: none -} - -.btn .label { - position: relative; - top: -1px -} - -.label-default { - background-color: #777 -} - -.label-default[href]:focus, -.label-default[href]:hover { - background-color: #5e5e5e -} - -.label-primary { - background-color: #337ab7 -} - -.label-primary[href]:focus, -.label-primary[href]:hover { - background-color: #286090 -} - -.label-success { - background-color: #5cb85c -} - -.label-success[href]:focus, -.label-success[href]:hover { - background-color: #449d44 -} - -.label-info { - background-color: #5bc0de -} - -.label-info[href]:focus, -.label-info[href]:hover { - background-color: #31b0d5 -} - -.label-warning { - background-color: #f0ad4e -} - -.label-warning[href]:focus, -.label-warning[href]:hover { - background-color: #ec971f -} - -.label-danger { - background-color: #d9534f -} - -.label-danger[href]:focus, -.label-danger[href]:hover { - background-color: #c9302c -} - -.badge { - display: inline-block; - min-width: 10px; - padding: 3px 7px; - font-size: 12px; - font-weight: 700; - line-height: 1; - color: #fff; - text-align: center; - white-space: nowrap; - vertical-align: middle; - background-color: #777; - border-radius: 10px -} - -.badge:empty { - display: none -} - -.btn .badge { - position: relative; - top: -1px -} - -.btn-group-xs>.btn .badge, -.btn-xs .badge { - top: 0; - padding: 1px 5px -} - -a.badge:focus, -a.badge:hover { - color: #fff; - text-decoration: none; - cursor: pointer -} - -.list-group-item.active>.badge, -.nav-pills>.active>a>.badge { - color: #337ab7; - background-color: #fff -} - -.list-group-item>.badge { - float: right -} - -.list-group-item>.badge+.badge { - margin-right: 5px -} - -.nav-pills>li>a>.badge { - margin-left: 3px -} - -.jumbotron { - padding-top: 30px; - padding-bottom: 30px; - margin-bottom: 30px; - color: inherit; - background-color: #eee -} - -.jumbotron .h1, -.jumbotron h1 { - color: inherit -} - -.jumbotron p { - margin-bottom: 15px; - font-size: 21px; - font-weight: 200 -} - -.jumbotron>hr { - border-top-color: #d5d5d5 -} - -.container .jumbotron, -.container-fluid .jumbotron { - padding-right: 15px; - padding-left: 15px; - border-radius: 6px -} - -.jumbotron .container { - max-width: 100% -} - -@media screen and (min-width:768px) { - .jumbotron { - padding-top: 48px; - padding-bottom: 48px - } - - .container .jumbotron, - .container-fluid .jumbotron { - padding-right: 60px; - padding-left: 60px - } - - .jumbotron .h1, - .jumbotron h1 { - font-size: 63px - } -} - -.thumbnail { - display: block; - padding: 4px; - margin-bottom: 20px; - line-height: 1.42857143; - background-color: #fff; - border: 1px solid #ddd; - border-radius: 4px; - -webkit-transition: border .2s ease-in-out; - -o-transition: border .2s ease-in-out; - transition: border .2s ease-in-out -} - -.thumbnail a>img, -.thumbnail>img { - margin-right: auto; - margin-left: auto -} - -a.thumbnail.active, -a.thumbnail:focus, -a.thumbnail:hover { - border-color: #337ab7 -} - -.thumbnail .caption { - padding: 9px; - color: #333 -} - -.alert { - padding: 15px; - margin-bottom: 20px; - border: 1px solid transparent; - border-radius: 4px -} - -.alert h4 { - margin-top: 0; - color: inherit -} - -.alert .alert-link { - font-weight: 700 -} - -.alert>p, -.alert>ul { - margin-bottom: 0 -} - -.alert>p+p { - margin-top: 5px -} - -.alert-dismissable, -.alert-dismissible { - padding-right: 35px -} - -.alert-dismissable .close, -.alert-dismissible .close { - position: relative; - top: -2px; - right: -21px; - color: inherit -} - -.alert-success { - color: #3c763d; - background-color: #dff0d8; - border-color: #d6e9c6 -} - -.alert-success hr { - border-top-color: #c9e2b3 -} - -.alert-success .alert-link { - color: #2b542c -} - -.alert-info { - color: #31708f; - background-color: #d9edf7; - border-color: #bce8f1 -} - -.alert-info hr { - border-top-color: #a6e1ec -} - -.alert-info .alert-link { - color: #245269 -} - -.alert-warning { - color: #8a6d3b; - background-color: #fcf8e3; - border-color: #faebcc -} - -.alert-warning hr { - border-top-color: #f7e1b5 -} - -.alert-warning .alert-link { - color: #66512c -} - -.alert-danger { - color: #a94442; - background-color: #f2dede; - border-color: #ebccd1 -} - -.alert-danger hr { - border-top-color: #e4b9c0 -} - -.alert-danger .alert-link { - color: #843534 -} - -@-webkit-keyframes progress-bar-stripes { - from { - background-position: 40px 0 - } - - to { - background-position: 0 0 - } -} - -@-o-keyframes progress-bar-stripes { - from { - background-position: 40px 0 - } - - to { - background-position: 0 0 - } -} - -@keyframes progress-bar-stripes { - from { - background-position: 40px 0 - } - - to { - background-position: 0 0 - } -} - -.progress { - height: 20px; - margin-bottom: 20px; - overflow: hidden; - background-color: #f5f5f5; - border-radius: 4px; - -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, .1); - box-shadow: inset 0 1px 2px rgba(0, 0, 0, .1) -} - -.progress-bar { - float: left; - width: 0; - height: 100%; - font-size: 12px; - line-height: 20px; - color: #fff; - text-align: center; - background-color: #337ab7; - -webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .15); - box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .15); - -webkit-transition: width .6s ease; - -o-transition: width .6s ease; - transition: width .6s ease -} - -.progress-bar-striped, -.progress-striped .progress-bar { - background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); - background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); - background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); - -webkit-background-size: 40px 40px; - background-size: 40px 40px -} - -.progress-bar.active, -.progress.active .progress-bar { - -webkit-animation: progress-bar-stripes 2s linear infinite; - -o-animation: progress-bar-stripes 2s linear infinite; - animation: progress-bar-stripes 2s linear infinite -} - -.progress-bar-success { - background-color: #5cb85c -} - -.progress-striped .progress-bar-success { - background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); - background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); - background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent) -} - -.progress-bar-info { - background-color: #5bc0de -} - -.progress-striped .progress-bar-info { - background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); - background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); - background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent) -} - -.progress-bar-warning { - background-color: #f0ad4e -} - -.progress-striped .progress-bar-warning { - background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); - background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); - background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent) -} - -.progress-bar-danger { - background-color: #d9534f -} - -.progress-striped .progress-bar-danger { - background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); - background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); - background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent) -} - -.media { - margin-top: 15px -} - -.media:first-child { - margin-top: 0 -} - -.media, -.media-body { - overflow: hidden; - zoom: 1 -} - -.media-body { - width: 10000px -} - -.media-object { - display: block -} - -.media-object.img-thumbnail { - max-width: none -} - -.media-right, -.media>.pull-right { - padding-left: 10px -} - -.media-left, -.media>.pull-left { - padding-right: 10px -} - -.media-body, -.media-left, -.media-right { - display: table-cell; - vertical-align: top -} - -.media-middle { - vertical-align: middle -} - -.media-bottom { - vertical-align: bottom -} - -.media-heading { - margin-top: 0; - margin-bottom: 5px -} - -.media-list { - padding-left: 0; - list-style: none -} - -.list-group { - padding-left: 0; - margin-bottom: 20px -} - -.list-group-item { - position: relative; - display: block; - padding: 10px 15px; - margin-bottom: -1px; - background-color: #fff; - border: 1px solid #ddd -} - -.list-group-item:first-child { - border-top-left-radius: 4px; - border-top-right-radius: 4px -} - -.list-group-item:last-child { - margin-bottom: 0; - border-bottom-right-radius: 4px; - border-bottom-left-radius: 4px -} - -a.list-group-item, -button.list-group-item { - color: #555 -} - -a.list-group-item .list-group-item-heading, -button.list-group-item .list-group-item-heading { - color: #333 -} - -a.list-group-item:focus, -a.list-group-item:hover, -button.list-group-item:focus, -button.list-group-item:hover { - color: #555; - text-decoration: none; - background-color: #f5f5f5 -} - -button.list-group-item { - width: 100%; - text-align: left -} - -.list-group-item.disabled, -.list-group-item.disabled:focus, -.list-group-item.disabled:hover { - color: #777; - cursor: not-allowed; - background-color: #eee -} - -.list-group-item.disabled .list-group-item-heading, -.list-group-item.disabled:focus .list-group-item-heading, -.list-group-item.disabled:hover .list-group-item-heading { - color: inherit -} - -.list-group-item.disabled .list-group-item-text, -.list-group-item.disabled:focus .list-group-item-text, -.list-group-item.disabled:hover .list-group-item-text { - color: #777 -} - -.list-group-item.active, -.list-group-item.active:focus, -.list-group-item.active:hover { - z-index: 2; - color: #fff; - background-color: #337ab7; - border-color: #337ab7 -} - -.list-group-item.active .list-group-item-heading, -.list-group-item.active .list-group-item-heading>.small, -.list-group-item.active .list-group-item-heading>small, -.list-group-item.active:focus .list-group-item-heading, -.list-group-item.active:focus .list-group-item-heading>.small, -.list-group-item.active:focus .list-group-item-heading>small, -.list-group-item.active:hover .list-group-item-heading, -.list-group-item.active:hover .list-group-item-heading>.small, -.list-group-item.active:hover .list-group-item-heading>small { - color: inherit -} - -.list-group-item.active .list-group-item-text, -.list-group-item.active:focus .list-group-item-text, -.list-group-item.active:hover .list-group-item-text { - color: #c7ddef -} - -.list-group-item-success { - color: #3c763d; - background-color: #dff0d8 -} - -a.list-group-item-success, -button.list-group-item-success { - color: #3c763d -} - -a.list-group-item-success .list-group-item-heading, -button.list-group-item-success .list-group-item-heading { - color: inherit -} - -a.list-group-item-success:focus, -a.list-group-item-success:hover, -button.list-group-item-success:focus, -button.list-group-item-success:hover { - color: #3c763d; - background-color: #d0e9c6 -} - -a.list-group-item-success.active, -a.list-group-item-success.active:focus, -a.list-group-item-success.active:hover, -button.list-group-item-success.active, -button.list-group-item-success.active:focus, -button.list-group-item-success.active:hover { - color: #fff; - background-color: #3c763d; - border-color: #3c763d -} - -.list-group-item-info { - color: #31708f; - background-color: #d9edf7 -} - -a.list-group-item-info, -button.list-group-item-info { - color: #31708f -} - -a.list-group-item-info .list-group-item-heading, -button.list-group-item-info .list-group-item-heading { - color: inherit -} - -a.list-group-item-info:focus, -a.list-group-item-info:hover, -button.list-group-item-info:focus, -button.list-group-item-info:hover { - color: #31708f; - background-color: #c4e3f3 -} - -a.list-group-item-info.active, -a.list-group-item-info.active:focus, -a.list-group-item-info.active:hover, -button.list-group-item-info.active, -button.list-group-item-info.active:focus, -button.list-group-item-info.active:hover { - color: #fff; - background-color: #31708f; - border-color: #31708f -} - -.list-group-item-warning { - color: #8a6d3b; - background-color: #fcf8e3 -} - -a.list-group-item-warning, -button.list-group-item-warning { - color: #8a6d3b -} - -a.list-group-item-warning .list-group-item-heading, -button.list-group-item-warning .list-group-item-heading { - color: inherit -} - -a.list-group-item-warning:focus, -a.list-group-item-warning:hover, -button.list-group-item-warning:focus, -button.list-group-item-warning:hover { - color: #8a6d3b; - background-color: #faf2cc -} - -a.list-group-item-warning.active, -a.list-group-item-warning.active:focus, -a.list-group-item-warning.active:hover, -button.list-group-item-warning.active, -button.list-group-item-warning.active:focus, -button.list-group-item-warning.active:hover { - color: #fff; - background-color: #8a6d3b; - border-color: #8a6d3b -} - -.list-group-item-danger { - color: #a94442; - background-color: #f2dede -} - -a.list-group-item-danger, -button.list-group-item-danger { - color: #a94442 -} - -a.list-group-item-danger .list-group-item-heading, -button.list-group-item-danger .list-group-item-heading { - color: inherit -} - -a.list-group-item-danger:focus, -a.list-group-item-danger:hover, -button.list-group-item-danger:focus, -button.list-group-item-danger:hover { - color: #a94442; - background-color: #ebcccc -} - -a.list-group-item-danger.active, -a.list-group-item-danger.active:focus, -a.list-group-item-danger.active:hover, -button.list-group-item-danger.active, -button.list-group-item-danger.active:focus, -button.list-group-item-danger.active:hover { - color: #fff; - background-color: #a94442; - border-color: #a94442 -} - -.list-group-item-heading { - margin-top: 0; - margin-bottom: 5px -} - -.list-group-item-text { - margin-bottom: 0; - line-height: 1.3 -} - -.panel { - margin-bottom: 20px; - background-color: #fff; - border: 1px solid transparent; - border-radius: 4px; - -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .05); - box-shadow: 0 1px 1px rgba(0, 0, 0, .05) -} - -.panel-body { - padding: 15px -} - -.panel-heading { - padding: 10px 15px; - border-bottom: 1px solid transparent; - border-top-left-radius: 3px; - border-top-right-radius: 3px -} - -.panel-heading>.dropdown .dropdown-toggle { - color: inherit -} - -.panel-title { - margin-top: 0; - margin-bottom: 0; - font-size: 16px; - color: inherit -} - -.panel-title>.small, -.panel-title>.small>a, -.panel-title>a, -.panel-title>small, -.panel-title>small>a { - color: inherit -} - -.panel-footer { - padding: 10px 15px; - background-color: #f5f5f5; - border-top: 1px solid #ddd; - border-bottom-right-radius: 3px; - border-bottom-left-radius: 3px -} - -.panel>.list-group, -.panel>.panel-collapse>.list-group { - margin-bottom: 0 -} - -.panel>.list-group .list-group-item, -.panel>.panel-collapse>.list-group .list-group-item { - border-width: 1px 0; - border-radius: 0 -} - -.panel>.list-group:first-child .list-group-item:first-child, -.panel>.panel-collapse>.list-group:first-child .list-group-item:first-child { - border-top: 0; - border-top-left-radius: 3px; - border-top-right-radius: 3px -} - -.panel>.list-group:last-child .list-group-item:last-child, -.panel>.panel-collapse>.list-group:last-child .list-group-item:last-child { - border-bottom: 0; - border-bottom-right-radius: 3px; - border-bottom-left-radius: 3px -} - -.panel>.panel-heading+.panel-collapse>.list-group .list-group-item:first-child { - border-top-left-radius: 0; - border-top-right-radius: 0 -} - -.panel-heading+.list-group .list-group-item:first-child { - border-top-width: 0 -} - -.list-group+.panel-footer { - border-top-width: 0 -} - -.panel>.panel-collapse>.table, -.panel>.table, -.panel>.table-responsive>.table { - margin-bottom: 0 -} - -.panel>.panel-collapse>.table caption, -.panel>.table caption, -.panel>.table-responsive>.table caption { - padding-right: 15px; - padding-left: 15px -} - -.panel>.table-responsive:first-child>.table:first-child, -.panel>.table:first-child { - border-top-left-radius: 3px; - border-top-right-radius: 3px -} - -.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child, -.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child, -.panel>.table:first-child>tbody:first-child>tr:first-child, -.panel>.table:first-child>thead:first-child>tr:first-child { - border-top-left-radius: 3px; - border-top-right-radius: 3px -} - -.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child td:first-child, -.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child th:first-child, -.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child td:first-child, -.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child th:first-child, -.panel>.table:first-child>tbody:first-child>tr:first-child td:first-child, -.panel>.table:first-child>tbody:first-child>tr:first-child th:first-child, -.panel>.table:first-child>thead:first-child>tr:first-child td:first-child, -.panel>.table:first-child>thead:first-child>tr:first-child th:first-child { - border-top-left-radius: 3px -} - -.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child td:last-child, -.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child th:last-child, -.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child td:last-child, -.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child th:last-child, -.panel>.table:first-child>tbody:first-child>tr:first-child td:last-child, -.panel>.table:first-child>tbody:first-child>tr:first-child th:last-child, -.panel>.table:first-child>thead:first-child>tr:first-child td:last-child, -.panel>.table:first-child>thead:first-child>tr:first-child th:last-child { - border-top-right-radius: 3px -} - -.panel>.table-responsive:last-child>.table:last-child, -.panel>.table:last-child { - border-bottom-right-radius: 3px; - border-bottom-left-radius: 3px -} - -.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child, -.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child, -.panel>.table:last-child>tbody:last-child>tr:last-child, -.panel>.table:last-child>tfoot:last-child>tr:last-child { - border-bottom-right-radius: 3px; - border-bottom-left-radius: 3px -} - -.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child td:first-child, -.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child th:first-child, -.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child td:first-child, -.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child th:first-child, -.panel>.table:last-child>tbody:last-child>tr:last-child td:first-child, -.panel>.table:last-child>tbody:last-child>tr:last-child th:first-child, -.panel>.table:last-child>tfoot:last-child>tr:last-child td:first-child, -.panel>.table:last-child>tfoot:last-child>tr:last-child th:first-child { - border-bottom-left-radius: 3px -} - -.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child td:last-child, -.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child th:last-child, -.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child td:last-child, -.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child th:last-child, -.panel>.table:last-child>tbody:last-child>tr:last-child td:last-child, -.panel>.table:last-child>tbody:last-child>tr:last-child th:last-child, -.panel>.table:last-child>tfoot:last-child>tr:last-child td:last-child, -.panel>.table:last-child>tfoot:last-child>tr:last-child th:last-child { - border-bottom-right-radius: 3px -} - -.panel>.panel-body+.table, -.panel>.panel-body+.table-responsive, -.panel>.table+.panel-body, -.panel>.table-responsive+.panel-body { - border-top: 1px solid #ddd -} - -.panel>.table>tbody:first-child>tr:first-child td, -.panel>.table>tbody:first-child>tr:first-child th { - border-top: 0 -} - -.panel>.table-bordered, -.panel>.table-responsive>.table-bordered { - border: 0 -} - -.panel>.table-bordered>tbody>tr>td:first-child, -.panel>.table-bordered>tbody>tr>th:first-child, -.panel>.table-bordered>tfoot>tr>td:first-child, -.panel>.table-bordered>tfoot>tr>th:first-child, -.panel>.table-bordered>thead>tr>td:first-child, -.panel>.table-bordered>thead>tr>th:first-child, -.panel>.table-responsive>.table-bordered>tbody>tr>td:first-child, -.panel>.table-responsive>.table-bordered>tbody>tr>th:first-child, -.panel>.table-responsive>.table-bordered>tfoot>tr>td:first-child, -.panel>.table-responsive>.table-bordered>tfoot>tr>th:first-child, -.panel>.table-responsive>.table-bordered>thead>tr>td:first-child, -.panel>.table-responsive>.table-bordered>thead>tr>th:first-child { - border-left: 0 -} - -.panel>.table-bordered>tbody>tr>td:last-child, -.panel>.table-bordered>tbody>tr>th:last-child, -.panel>.table-bordered>tfoot>tr>td:last-child, -.panel>.table-bordered>tfoot>tr>th:last-child, -.panel>.table-bordered>thead>tr>td:last-child, -.panel>.table-bordered>thead>tr>th:last-child, -.panel>.table-responsive>.table-bordered>tbody>tr>td:last-child, -.panel>.table-responsive>.table-bordered>tbody>tr>th:last-child, -.panel>.table-responsive>.table-bordered>tfoot>tr>td:last-child, -.panel>.table-responsive>.table-bordered>tfoot>tr>th:last-child, -.panel>.table-responsive>.table-bordered>thead>tr>td:last-child, -.panel>.table-responsive>.table-bordered>thead>tr>th:last-child { - border-right: 0 -} - -.panel>.table-bordered>tbody>tr:first-child>td, -.panel>.table-bordered>tbody>tr:first-child>th, -.panel>.table-bordered>thead>tr:first-child>td, -.panel>.table-bordered>thead>tr:first-child>th, -.panel>.table-responsive>.table-bordered>tbody>tr:first-child>td, -.panel>.table-responsive>.table-bordered>tbody>tr:first-child>th, -.panel>.table-responsive>.table-bordered>thead>tr:first-child>td, -.panel>.table-responsive>.table-bordered>thead>tr:first-child>th { - border-bottom: 0 -} - -.panel>.table-bordered>tbody>tr:last-child>td, -.panel>.table-bordered>tbody>tr:last-child>th, -.panel>.table-bordered>tfoot>tr:last-child>td, -.panel>.table-bordered>tfoot>tr:last-child>th, -.panel>.table-responsive>.table-bordered>tbody>tr:last-child>td, -.panel>.table-responsive>.table-bordered>tbody>tr:last-child>th, -.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>td, -.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>th { - border-bottom: 0 -} - -.panel>.table-responsive { - margin-bottom: 0; - border: 0 -} - -.panel-group { - margin-bottom: 20px -} - -.panel-group .panel { - margin-bottom: 0; - border-radius: 4px -} - -.panel-group .panel+.panel { - margin-top: 5px -} - -.panel-group .panel-heading { - border-bottom: 0 -} - -.panel-group .panel-heading+.panel-collapse>.list-group, -.panel-group .panel-heading+.panel-collapse>.panel-body { - border-top: 1px solid #ddd -} - -.panel-group .panel-footer { - border-top: 0 -} - -.panel-group .panel-footer+.panel-collapse .panel-body { - border-bottom: 1px solid #ddd -} - -.panel-default { - border-color: #ddd -} - -.panel-default>.panel-heading { - color: #333; - background-color: #f5f5f5; - border-color: #ddd -} - -.panel-default>.panel-heading+.panel-collapse>.panel-body { - border-top-color: #ddd -} - -.panel-default>.panel-heading .badge { - color: #f5f5f5; - background-color: #333 -} - -.panel-default>.panel-footer+.panel-collapse>.panel-body { - border-bottom-color: #ddd -} - -.panel-primary { - border-color: #337ab7 -} - -.panel-primary>.panel-heading { - color: #fff; - background-color: #337ab7; - border-color: #337ab7 -} - -.panel-primary>.panel-heading+.panel-collapse>.panel-body { - border-top-color: #337ab7 -} - -.panel-primary>.panel-heading .badge { - color: #337ab7; - background-color: #fff -} - -.panel-primary>.panel-footer+.panel-collapse>.panel-body { - border-bottom-color: #337ab7 -} - -.panel-success { - border-color: #d6e9c6 -} - -.panel-success>.panel-heading { - color: #3c763d; - background-color: #dff0d8; - border-color: #d6e9c6 -} - -.panel-success>.panel-heading+.panel-collapse>.panel-body { - border-top-color: #d6e9c6 -} - -.panel-success>.panel-heading .badge { - color: #dff0d8; - background-color: #3c763d -} - -.panel-success>.panel-footer+.panel-collapse>.panel-body { - border-bottom-color: #d6e9c6 -} - -.panel-info { - border-color: #bce8f1 -} - -.panel-info>.panel-heading { - color: #31708f; - background-color: #d9edf7; - border-color: #bce8f1 -} - -.panel-info>.panel-heading+.panel-collapse>.panel-body { - border-top-color: #bce8f1 -} - -.panel-info>.panel-heading .badge { - color: #d9edf7; - background-color: #31708f -} - -.panel-info>.panel-footer+.panel-collapse>.panel-body { - border-bottom-color: #bce8f1 -} - -.panel-warning { - border-color: #faebcc -} - -.panel-warning>.panel-heading { - color: #8a6d3b; - background-color: #fcf8e3; - border-color: #faebcc -} - -.panel-warning>.panel-heading+.panel-collapse>.panel-body { - border-top-color: #faebcc -} - -.panel-warning>.panel-heading .badge { - color: #fcf8e3; - background-color: #8a6d3b -} - -.panel-warning>.panel-footer+.panel-collapse>.panel-body { - border-bottom-color: #faebcc -} - -.panel-danger { - border-color: #ebccd1 -} - -.panel-danger>.panel-heading { - color: #a94442; - background-color: #f2dede; - border-color: #ebccd1 -} - -.panel-danger>.panel-heading+.panel-collapse>.panel-body { - border-top-color: #ebccd1 -} - -.panel-danger>.panel-heading .badge { - color: #f2dede; - background-color: #a94442 -} - -.panel-danger>.panel-footer+.panel-collapse>.panel-body { - border-bottom-color: #ebccd1 -} - -.embed-responsive { - position: relative; - display: block; - height: 0; - padding: 0; - overflow: hidden -} - -.embed-responsive .embed-responsive-item, -.embed-responsive embed, -.embed-responsive iframe, -.embed-responsive object, -.embed-responsive video { - position: absolute; - top: 0; - bottom: 0; - left: 0; - width: 100%; - height: 100%; - border: 0 -} - -.embed-responsive-16by9 { - padding-bottom: 56.25% -} - -.embed-responsive-4by3 { - padding-bottom: 75% -} - -.well { - min-height: 20px; - padding: 19px; - margin-bottom: 20px; - background-color: #f5f5f5; - border: 1px solid #e3e3e3; - border-radius: 4px; - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .05); - box-shadow: inset 0 1px 1px rgba(0, 0, 0, .05) -} - -.well blockquote { - border-color: #ddd; - border-color: rgba(0, 0, 0, .15) -} - -.well-lg { - padding: 24px; - border-radius: 6px -} - -.well-sm { - padding: 9px; - border-radius: 3px -} - -.close { - float: right; - font-size: 21px; - font-weight: 700; - line-height: 1; - color: #000; - text-shadow: 0 1px 0 #fff; - filter: alpha(opacity=20); - opacity: .2 -} - -.close:focus, -.close:hover { - color: #000; - text-decoration: none; - cursor: pointer; - filter: alpha(opacity=50); - opacity: .5 -} - -button.close { - -webkit-appearance: none; - padding: 0; - cursor: pointer; - background: 0 0; - border: 0 -} - -.modal-open { - overflow: hidden -} - -.modal { - position: fixed; - top: 0; - right: 0; - bottom: 0; - left: 0; - z-index: 1050; - display: none; - overflow: hidden; - -webkit-overflow-scrolling: touch; - outline: 0 -} - -.modal.fade .modal-dialog { - -webkit-transition: -webkit-transform .3s ease-out; - -o-transition: -o-transform .3s ease-out; - transition: transform .3s ease-out; - -webkit-transform: translate(0, -25%); - -ms-transform: translate(0, -25%); - -o-transform: translate(0, -25%); - transform: translate(0, -25%) -} - -.modal.in .modal-dialog { - -webkit-transform: translate(0, 0); - -ms-transform: translate(0, 0); - -o-transform: translate(0, 0); - transform: translate(0, 0) -} - -.modal-open .modal { - overflow-x: hidden; - overflow-y: auto -} - -.modal-dialog { - position: relative; - width: auto; - margin: 10px -} - -.modal-content { - position: relative; - background-color: #fff; - -webkit-background-clip: padding-box; - background-clip: padding-box; - border: 1px solid #999; - border: 1px solid rgba(0, 0, 0, .2); - border-radius: 6px; - outline: 0; - -webkit-box-shadow: 0 3px 9px rgba(0, 0, 0, .5); - box-shadow: 0 3px 9px rgba(0, 0, 0, .5) -} - -.modal-backdrop { - position: fixed; - top: 0; - right: 0; - bottom: 0; - left: 0; - z-index: 1040; - background-color: #000 -} - -.modal-backdrop.fade { - filter: alpha(opacity=0); - opacity: 0 -} - -.modal-backdrop.in { - filter: alpha(opacity=50); - opacity: .5 -} - -.modal-header { - padding: 15px; - border-bottom: 1px solid #e5e5e5 -} - -.modal-header .close { - margin-top: -2px -} - -.modal-title { - margin: 0; - line-height: 1.42857143 -} - -.modal-body { - position: relative; - padding: 15px -} - -.modal-footer { - padding: 15px; - text-align: right; - border-top: 1px solid #e5e5e5 -} - -.modal-footer .btn+.btn { - margin-bottom: 0; - margin-left: 5px -} - -.modal-footer .btn-group .btn+.btn { - margin-left: -1px -} - -.modal-footer .btn-block+.btn-block { - margin-left: 0 -} - -.modal-scrollbar-measure { - position: absolute; - top: -9999px; - width: 50px; - height: 50px; - overflow: scroll -} - -@media (min-width:768px) { - .modal-dialog { - width: 600px; - margin: 30px auto - } - - .modal-content { - -webkit-box-shadow: 0 5px 15px rgba(0, 0, 0, .5); - box-shadow: 0 5px 15px rgba(0, 0, 0, .5) - } - - .modal-sm { - width: 300px - } -} - -@media (min-width:992px) { - .modal-lg { - width: 900px - } -} - -.tooltip { - position: absolute; - z-index: 1070; - display: block; - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; - font-size: 12px; - font-style: normal; - font-weight: 400; - line-height: 1.42857143; - text-align: left; - text-align: start; - text-decoration: none; - text-shadow: none; - text-transform: none; - letter-spacing: normal; - word-break: normal; - word-spacing: normal; - word-wrap: normal; - white-space: normal; - filter: alpha(opacity=0); - opacity: 0; - line-break: auto -} - -.tooltip.in { - filter: alpha(opacity=90); - opacity: .9 -} - -.tooltip.top { - padding: 5px 0; - margin-top: -3px -} - -.tooltip.right { - padding: 0 5px; - margin-left: 3px -} - -.tooltip.bottom { - padding: 5px 0; - margin-top: 3px -} - -.tooltip.left { - padding: 0 5px; - margin-left: -3px -} - -.tooltip-inner { - max-width: 200px; - padding: 3px 8px; - color: #fff; - text-align: center; - background-color: #000; - border-radius: 4px -} - -.tooltip-arrow { - position: absolute; - width: 0; - height: 0; - border-color: transparent; - border-style: solid -} - -.tooltip.top .tooltip-arrow { - bottom: 0; - left: 50%; - margin-left: -5px; - border-width: 5px 5px 0; - border-top-color: #000 -} - -.tooltip.top-left .tooltip-arrow { - right: 5px; - bottom: 0; - margin-bottom: -5px; - border-width: 5px 5px 0; - border-top-color: #000 -} - -.tooltip.top-right .tooltip-arrow { - bottom: 0; - left: 5px; - margin-bottom: -5px; - border-width: 5px 5px 0; - border-top-color: #000 -} - -.tooltip.right .tooltip-arrow { - top: 50%; - left: 0; - margin-top: -5px; - border-width: 5px 5px 5px 0; - border-right-color: #000 -} - -.tooltip.left .tooltip-arrow { - top: 50%; - right: 0; - margin-top: -5px; - border-width: 5px 0 5px 5px; - border-left-color: #000 -} - -.tooltip.bottom .tooltip-arrow { - top: 0; - left: 50%; - margin-left: -5px; - border-width: 0 5px 5px; - border-bottom-color: #000 -} - -.tooltip.bottom-left .tooltip-arrow { - top: 0; - right: 5px; - margin-top: -5px; - border-width: 0 5px 5px; - border-bottom-color: #000 -} - -.tooltip.bottom-right .tooltip-arrow { - top: 0; - left: 5px; - margin-top: -5px; - border-width: 0 5px 5px; - border-bottom-color: #000 -} - -.popover { - position: absolute; - top: 0; - left: 0; - z-index: 1060; - display: none; - max-width: 276px; - padding: 1px; - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; - font-size: 14px; - font-style: normal; - font-weight: 400; - line-height: 1.42857143; - text-align: left; - text-align: start; - text-decoration: none; - text-shadow: none; - text-transform: none; - letter-spacing: normal; - word-break: normal; - word-spacing: normal; - word-wrap: normal; - white-space: normal; - background-color: #fff; - -webkit-background-clip: padding-box; - background-clip: padding-box; - border: 1px solid #ccc; - border: 1px solid rgba(0, 0, 0, .2); - border-radius: 6px; - -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, .2); - box-shadow: 0 5px 10px rgba(0, 0, 0, .2); - line-break: auto -} - -.popover.top { - margin-top: -10px -} - -.popover.right { - margin-left: 10px -} - -.popover.bottom { - margin-top: 10px -} - -.popover.left { - margin-left: -10px -} - -.popover-title { - padding: 8px 14px; - margin: 0; - font-size: 14px; - background-color: #f7f7f7; - border-bottom: 1px solid #ebebeb; - border-radius: 5px 5px 0 0 -} - -.popover-content { - padding: 9px 14px -} - -.popover>.arrow, -.popover>.arrow:after { - position: absolute; - display: block; - width: 0; - height: 0; - border-color: transparent; - border-style: solid -} - -.popover>.arrow { - border-width: 11px -} - -.popover>.arrow:after { - content: ""; - border-width: 10px -} - -.popover.top>.arrow { - bottom: -11px; - left: 50%; - margin-left: -11px; - border-top-color: #999; - border-top-color: rgba(0, 0, 0, .25); - border-bottom-width: 0 -} - -.popover.top>.arrow:after { - bottom: 1px; - margin-left: -10px; - content: " "; - border-top-color: #fff; - border-bottom-width: 0 -} - -.popover.right>.arrow { - top: 50%; - left: -11px; - margin-top: -11px; - border-right-color: #999; - border-right-color: rgba(0, 0, 0, .25); - border-left-width: 0 -} - -.popover.right>.arrow:after { - bottom: -10px; - left: 1px; - content: " "; - border-right-color: #fff; - border-left-width: 0 -} - -.popover.bottom>.arrow { - top: -11px; - left: 50%; - margin-left: -11px; - border-top-width: 0; - border-bottom-color: #999; - border-bottom-color: rgba(0, 0, 0, .25) -} - -.popover.bottom>.arrow:after { - top: 1px; - margin-left: -10px; - content: " "; - border-top-width: 0; - border-bottom-color: #fff -} - -.popover.left>.arrow { - top: 50%; - right: -11px; - margin-top: -11px; - border-right-width: 0; - border-left-color: #999; - border-left-color: rgba(0, 0, 0, .25) -} - -.popover.left>.arrow:after { - right: 1px; - bottom: -10px; - content: " "; - border-right-width: 0; - border-left-color: #fff -} - -.carousel { - position: relative -} - -.carousel-inner { - position: relative; - width: 100%; - overflow: hidden -} - -.carousel-inner>.item { - position: relative; - display: none; - -webkit-transition: .6s ease-in-out left; - -o-transition: .6s ease-in-out left; - transition: .6s ease-in-out left -} - -.carousel-inner>.item>a>img, -.carousel-inner>.item>img { - line-height: 1 -} - -@media all and (transform-3d), -(-webkit-transform-3d) { - .carousel-inner>.item { - -webkit-transition: -webkit-transform .6s ease-in-out; - -o-transition: -o-transform .6s ease-in-out; - transition: transform .6s ease-in-out; - -webkit-backface-visibility: hidden; - backface-visibility: hidden; - -webkit-perspective: 1000px; - perspective: 1000px - } - - .carousel-inner>.item.active.right, - .carousel-inner>.item.next { - left: 0; - -webkit-transform: translate3d(100%, 0, 0); - transform: translate3d(100%, 0, 0) - } - - .carousel-inner>.item.active.left, - .carousel-inner>.item.prev { - left: 0; - -webkit-transform: translate3d(-100%, 0, 0); - transform: translate3d(-100%, 0, 0) - } - - .carousel-inner>.item.active, - .carousel-inner>.item.next.left, - .carousel-inner>.item.prev.right { - left: 0; - -webkit-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0) - } -} - -.carousel-inner>.active, -.carousel-inner>.next, -.carousel-inner>.prev { - display: block -} - -.carousel-inner>.active { - left: 0 -} - -.carousel-inner>.next, -.carousel-inner>.prev { - position: absolute; - top: 0; - width: 100% -} - -.carousel-inner>.next { - left: 100% -} - -.carousel-inner>.prev { - left: -100% -} - -.carousel-inner>.next.left, -.carousel-inner>.prev.right { - left: 0 -} - -.carousel-inner>.active.left { - left: -100% -} - -.carousel-inner>.active.right { - left: 100% -} - -.carousel-control { - position: absolute; - top: 0; - bottom: 0; - left: 0; - width: 15%; - font-size: 20px; - color: #fff; - text-align: center; - text-shadow: 0 1px 2px rgba(0, 0, 0, .6); - background-color: rgba(0, 0, 0, 0); - filter: alpha(opacity=50); - opacity: .5 -} - -.carousel-control.left { - background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, .5) 0, rgba(0, 0, 0, .0001) 100%); - background-image: -o-linear-gradient(left, rgba(0, 0, 0, .5) 0, rgba(0, 0, 0, .0001) 100%); - background-image: -webkit-gradient(linear, left top, right top, from(rgba(0, 0, 0, .5)), to(rgba(0, 0, 0, .0001))); - background-image: linear-gradient(to right, rgba(0, 0, 0, .5) 0, rgba(0, 0, 0, .0001) 100%); - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000', endColorstr='#00000000', GradientType=1); - background-repeat: repeat-x -} - -.carousel-control.right { - right: 0; - left: auto; - background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, .0001) 0, rgba(0, 0, 0, .5) 100%); - background-image: -o-linear-gradient(left, rgba(0, 0, 0, .0001) 0, rgba(0, 0, 0, .5) 100%); - background-image: -webkit-gradient(linear, left top, right top, from(rgba(0, 0, 0, .0001)), to(rgba(0, 0, 0, .5))); - background-image: linear-gradient(to right, rgba(0, 0, 0, .0001) 0, rgba(0, 0, 0, .5) 100%); - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#80000000', GradientType=1); - background-repeat: repeat-x -} - -.carousel-control:focus, -.carousel-control:hover { - color: #fff; - text-decoration: none; - filter: alpha(opacity=90); - outline: 0; - opacity: .9 -} - -.carousel-control .glyphicon-chevron-left, -.carousel-control .glyphicon-chevron-right, -.carousel-control .icon-next, -.carousel-control .icon-prev { - position: absolute; - top: 50%; - z-index: 5; - display: inline-block; - margin-top: -10px -} - -.carousel-control .glyphicon-chevron-left, -.carousel-control .icon-prev { - left: 50%; - margin-left: -10px -} - -.carousel-control .glyphicon-chevron-right, -.carousel-control .icon-next { - right: 50%; - margin-right: -10px -} - -.carousel-control .icon-next, -.carousel-control .icon-prev { - width: 20px; - height: 20px; - font-family: serif; - line-height: 1 -} - -.carousel-control .icon-prev:before { - content: '\2039' -} - -.carousel-control .icon-next:before { - content: '\203a' -} - -.carousel-indicators { - position: absolute; - bottom: 10px; - left: 50%; - z-index: 15; - width: 60%; - padding-left: 0; - margin-left: -30%; - text-align: center; - list-style: none -} - -.carousel-indicators li { - display: inline-block; - width: 10px; - height: 10px; - margin: 1px; - text-indent: -999px; - cursor: pointer; - background-color: #000\9; - background-color: rgba(0, 0, 0, 0); - border: 1px solid #fff; - border-radius: 10px -} - -.carousel-indicators .active { - width: 12px; - height: 12px; - margin: 0; - background-color: #fff -} - -.carousel-caption { - position: absolute; - right: 15%; - bottom: 20px; - left: 15%; - z-index: 10; - padding-top: 20px; - padding-bottom: 20px; - color: #fff; - text-align: center; - text-shadow: 0 1px 2px rgba(0, 0, 0, .6) -} - -.carousel-caption .btn { - text-shadow: none -} - -@media screen and (min-width:768px) { - - .carousel-control .glyphicon-chevron-left, - .carousel-control .glyphicon-chevron-right, - .carousel-control .icon-next, - .carousel-control .icon-prev { - width: 30px; - height: 30px; - margin-top: -10px; - font-size: 30px - } - - .carousel-control .glyphicon-chevron-left, - .carousel-control .icon-prev { - margin-left: -10px - } - - .carousel-control .glyphicon-chevron-right, - .carousel-control .icon-next { - margin-right: -10px - } - - .carousel-caption { - right: 20%; - left: 20%; - padding-bottom: 30px - } - - .carousel-indicators { - bottom: 20px - } -} - -.btn-group-vertical>.btn-group:after, -.btn-group-vertical>.btn-group:before, -.btn-toolbar:after, -.btn-toolbar:before, -.clearfix:after, -.clearfix:before, -.container-fluid:after, -.container-fluid:before, -.container:after, -.container:before, -.dl-horizontal dd:after, -.dl-horizontal dd:before, -.form-horizontal .form-group:after, -.form-horizontal .form-group:before, -.modal-footer:after, -.modal-footer:before, -.modal-header:after, -.modal-header:before, -.nav:after, -.nav:before, -.navbar-collapse:after, -.navbar-collapse:before, -.navbar-header:after, -.navbar-header:before, -.navbar:after, -.navbar:before, -.pager:after, -.pager:before, -.panel-body:after, -.panel-body:before, -.row:after, -.row:before { - display: table; - content: " " -} - -.btn-group-vertical>.btn-group:after, -.btn-toolbar:after, -.clearfix:after, -.container-fluid:after, -.container:after, -.dl-horizontal dd:after, -.form-horizontal .form-group:after, -.modal-footer:after, -.modal-header:after, -.nav:after, -.navbar-collapse:after, -.navbar-header:after, -.navbar:after, -.pager:after, -.panel-body:after, -.row:after { - clear: both -} - -.center-block { - display: block; - margin-right: auto; - margin-left: auto -} - -.pull-right { - float: right !important -} - -.pull-left { - float: left !important -} - -.hide { - display: none !important -} - -.show { - display: block !important -} - -.invisible { - visibility: hidden -} - -.text-hide { - font: 0/0 a; - color: transparent; - text-shadow: none; - background-color: transparent; - border: 0 -} - -.hidden { - display: none !important -} - -.affix { - position: fixed -} - -@-ms-viewport { - width: device-width -} - -.visible-lg, -.visible-md, -.visible-sm, -.visible-xs { - display: none !important -} - -.visible-lg-block, -.visible-lg-inline, -.visible-lg-inline-block, -.visible-md-block, -.visible-md-inline, -.visible-md-inline-block, -.visible-sm-block, -.visible-sm-inline, -.visible-sm-inline-block, -.visible-xs-block, -.visible-xs-inline, -.visible-xs-inline-block { - display: none !important -} - -@media (max-width:767px) { - .visible-xs { - display: block !important - } - - table.visible-xs { - display: table !important - } - - tr.visible-xs { - display: table-row !important - } - - td.visible-xs, - th.visible-xs { - display: table-cell !important - } -} - -@media (max-width:767px) { - .visible-xs-block { - display: block !important - } -} - -@media (max-width:767px) { - .visible-xs-inline { - display: inline !important - } -} - -@media (max-width:767px) { - .visible-xs-inline-block { - display: inline-block !important - } -} - -@media (min-width:768px) and (max-width:991px) { - .visible-sm { - display: block !important - } - - table.visible-sm { - display: table !important - } - - tr.visible-sm { - display: table-row !important - } - - td.visible-sm, - th.visible-sm { - display: table-cell !important - } -} - -@media (min-width:768px) and (max-width:991px) { - .visible-sm-block { - display: block !important - } -} - -@media (min-width:768px) and (max-width:991px) { - .visible-sm-inline { - display: inline !important - } -} - -@media (min-width:768px) and (max-width:991px) { - .visible-sm-inline-block { - display: inline-block !important - } -} - -@media (min-width:992px) and (max-width:1199px) { - .visible-md { - display: block !important - } - - table.visible-md { - display: table !important - } - - tr.visible-md { - display: table-row !important - } - - td.visible-md, - th.visible-md { - display: table-cell !important - } -} - -@media (min-width:992px) and (max-width:1199px) { - .visible-md-block { - display: block !important - } -} - -@media (min-width:992px) and (max-width:1199px) { - .visible-md-inline { - display: inline !important - } -} - -@media (min-width:992px) and (max-width:1199px) { - .visible-md-inline-block { - display: inline-block !important - } -} - -@media (min-width:1200px) { - .visible-lg { - display: block !important - } - - table.visible-lg { - display: table !important - } - - tr.visible-lg { - display: table-row !important - } - - td.visible-lg, - th.visible-lg { - display: table-cell !important - } -} - -@media (min-width:1200px) { - .visible-lg-block { - display: block !important - } -} - -@media (min-width:1200px) { - .visible-lg-inline { - display: inline !important - } -} - -@media (min-width:1200px) { - .visible-lg-inline-block { - display: inline-block !important - } -} - -@media (max-width:767px) { - .hidden-xs { - display: none !important - } -} - -@media (min-width:768px) and (max-width:991px) { - .hidden-sm { - display: none !important - } -} - -@media (min-width:992px) and (max-width:1199px) { - .hidden-md { - display: none !important - } -} - -@media (min-width:1200px) { - .hidden-lg { - display: none !important - } -} - -.visible-print { - display: none !important -} - -@media print { - .visible-print { - display: block !important - } - - table.visible-print { - display: table !important - } - - tr.visible-print { - display: table-row !important - } - - td.visible-print, - th.visible-print { - display: table-cell !important - } -} - -.visible-print-block { - display: none !important -} - -@media print { - .visible-print-block { - display: block !important - } -} - -.visible-print-inline { - display: none !important -} - -@media print { - .visible-print-inline { - display: inline !important - } -} - -.visible-print-inline-block { - display: none !important -} - -@media print { - .visible-print-inline-block { - display: inline-block !important - } -} - -@media print { - .hidden-print { - display: none !important - } -} - -/*# sourceMappingURL=bootstrap.min.css.map */ \ No newline at end of file diff --git a/cadline/backend/maintenance/css/style.css b/cadline/backend/maintenance/css/style.css deleted file mode 100644 index 45bb2c3d..00000000 --- a/cadline/backend/maintenance/css/style.css +++ /dev/null @@ -1,390 +0,0 @@ -/* font */ -@font-face { - font-family: 'LeagueGothicRegular'; - src: url('font/League_Gothic-webfont.eot'); - src: local('☺'), url('font/League_Gothic-webfont.woff') format('woff'), url('font/League_Gothic-webfont.ttf') format('truetype'), url('font/League_Gothic-webfont.svg#webfontpm5EArBj') format('svg'); - font-weight: normal; - font-style: normal; -} - -/* - html5doctor.com Reset Stylesheet (Eric Meyer's Reset Reloaded + HTML5 baseline) - v1.4 2009-07-27 | Authors: Eric Meyer & Richard Clark - html5doctor.com/html-5-reset-stylesheet/ -*/ - -html, -body, -div, -span, -object, -iframe, -h1, -h2, -h3, -h4, -h5, -h6, -p, -blockquote, -pre, -abbr, -address, -cite, -code, -del, -dfn, -em, -img, -ins, -kbd, -q, -samp, -small, -strong, -sub, -sup, -var, -b, -i, -dl, -dt, -dd, -ol, -ul, -li, -fieldset, -form, -label, -legend, -table, -caption, -tbody, -tfoot, -thead, -tr, -th, -td, -article, -aside, -canvas, -details, -figcaption, -figure, -footer, -header, -hgroup, -menu, -nav, -section, -summary, -time, -mark, -audio, -video { - margin: 0; - padding: 0; - border: 0; - outline: 0; - font-size: 100%; - vertical-align: baseline; - background: transparent; -} - -article, -aside, -details, -figcaption, -figure, -footer, -header, -hgroup, -menu, -nav, -section { - display: block; -} - -nav ul { - list-style: none; -} - -blockquote, -q { - quotes: none; -} - -blockquote:before, -blockquote:after, -q:before, -q:after { - content: ''; - content: none; -} - -a { - margin: 0; - padding: 0; - font-size: 100%; - outline: 0; - vertical-align: baseline; - background: transparent; -} - -ins { - background-color: #ff9; - color: #000; - text-decoration: none; -} - -mark { - background-color: #ff9; - color: #000; - font-style: italic; - font-weight: bold; -} - -del { - text-decoration: line-through; -} - -abbr[title], -dfn[title] { - border-bottom: 1px dotted; - cursor: help; -} - -/* tables still need cellspacing="0" in the markup */ -table { - border-collapse: collapse; - border-spacing: 0; -} - -hr { - display: block; - height: 1px; - border: 0; - border-top: 1px solid #ccc; - margin: 1em 0; - padding: 0; -} - -input, -select { - vertical-align: middle; -} - -/* END RESET CSS */ - -/* Site styling */ -html { - /* always force a scrollbar in non-IE */ - overflow-y: scroll; - background-image: url('../images/main-red-bg.gif'); - background-color: #461714; -} - -body { - margin: 0 auto; - padding: 0px 70px 10px; - font-family: arial; - font-size: 1em; - width: 820px; -} - -h1 { - margin: 0px 0px 0px 20px; - padding: 20px 0px 0px 0px; - color: #a81213; - font-family: 'LeagueGothicRegular', arial, san-serif; - font-size: 4.5em; - font-weight: normal; - text-align: center; - text-transform: uppercase; - text-shadow: 1px 1px 2px #000000; - filter: dropshadow(color=#000000, offx=1, offy=1); -} - -h2, -h3 { - padding-top: 10px; - font-family: 'LeagueGothicRegular', arial, san-serif; - font-size: 2.25em; - font-weight: normal; - color: #a81213; - text-shadow: 1px 1px 2px #000000; - filter: dropshadow(color=#000000, offx=1, offy=1); -} - -#content a { - color: #a81213; - text-shadow: 1px 1px 2px #000000; - filter: dropshadow(color=#000000, offx=1, offy=1); -} - -#content a:hover { - text-decoration: none; -} - -#release-history { - font-size: 0.7em; - overflow: hidden; -} - -#release-history p strong { - margin-right: 5px; - font-family: 'LeagueGothicRegular', arial, san-serif; - font-size: 1.6em; - font-weight: normal; - display: block; - float: left; -} - -p { - margin-top: 10px; - color: #f8f0db; - line-height: 1.5em; -} - -p.copy { - margin: 0px 0px 10px; - text-align: center; -} - -pre { - margin: 20px 0px 0px; - padding: 22px 40px; - background-color: #f8f0db; - -webkit-border-radius: 15px; - -moz-border-radius: 15px; - border-radius: 15px; - white-space: pre-wrap; - /* css-3 */ - white-space: -moz-pre-wrap; - /* Mozilla, since 1999 */ - white-space: -pre-wrap; - /* Opera 4-6 */ - white-space: -o-pre-wrap; - /* Opera 7 */ - word-wrap: break-word; - /* Internet Explorer 5.5+ */ -} - -pre code span.red { - color: #a81213; -} - -pre code span.grey { - color: #7b7976; -} - -dl { - /*margin: 10px 10px 10px 20px;*/ - color: #f8f0db; -} - -dt { - margin-top: 10px; - font-weight: bold; -} - -dd { - margin: 5px 0px 10px 20px; -} - -div#content { - /*padding: 10px 5px 0px 0px;*/ -} - -.content-box { - /*padding: 0px 0px 30px;*/ -} - -.divider-top { - padding-top: 20px; - border-top: 1px solid #70342d; -} - -.divider-bottom { - padding-bottom: 30px; - border-bottom: 1px solid #1e0a09; -} - -#download { - margin: 20px 0px 30px 300px; - padding: 2px; - background-color: #f8f0db; - -webkit-border-radius: 15px; - -moz-border-radius: 15px; - border-radius: 15px; - display: block; - width: 216px; - height: 96px; - -webkit-box-shadow: 5px 5px 15px black; - -moz-box-shadow: 5px 5px 15px black; - box-shadow: 5px 5px 15px black; -} - -#download a { - font-family: 'LeagueGothicRegular', arial, san-serif; - font-size: 1.875em; - background-color: #a81213; - -webkit-border-radius: 15px; - -moz-border-radius: 15px; - border-radius: 15px; - display: block; - width: 100%; - height: 100%; - color: #f8f0db; - text-decoration: none; - text-transform: uppercase; -} - -#download a:hover { - background-color: #000000; -} - -#download a img { - margin: 0px 20px 0px 20px; - float: left; -} - -#download a span.dl { - margin-top: 19px; - float: left; - display: block; -} - -#download a span.sub { - display: block; - float: left; - font-size: 0.7em; - color: #e0ac9e; -} - -#github img { - position: absolute; - top: 0; - right: 0; - border: 0; -} - -#paypal { - margin: 20px 0px 0px 0px; - padding: 22px 40px 22px 330px; - /*width: 100%;*/ - background-color: #f8f0db; - -webkit-border-radius: 15px; - -moz-border-radius: 15px; - border-radius: 15px; -} - -::-moz-selection { - background-color: #a81213; - color: #f8f0db; -} - -::selection { - background-color: #a81213; - color: #f8f0db; -} \ No newline at end of file diff --git a/cadline/backend/maintenance/css/ticker-style.css b/cadline/backend/maintenance/css/ticker-style.css deleted file mode 100644 index 9bfc0564..00000000 --- a/cadline/backend/maintenance/css/ticker-style.css +++ /dev/null @@ -1,274 +0,0 @@ -/* Ticker Styling */ -.ticker-wrapper.has-js { - margin: 20px 0px 20px 0px; - padding: 0px 0px; - width: 100%; - height: 32px; - display: block; - background-color: #ffffff; -} - -.ticker { - width: 100%; - display: block; - position: relative; - overflow: hidden; - background-color: #ffffff; -} - -.ticker-title { - color: #990000; - font-weight: bold; - background-color: #ffffff; - text-transform: uppercase; -} - -.ticker-content { - margin: 0px; - position: absolute; - color: #1F527B; - font-weight: bold; - background-color: #ffffff; - overflow: hidden; - white-space: nowrap; - line-height: 1.2em; -} - -.ticker-content:focus { - none; -} - -.ticker-content a { - text-decoration: none; - color: #1F527B; -} - -.ticker-content a:hover { - text-decoration: underline; - color: #0D3059; -} - -.ticker-swipe { - position: absolute; - top: 0px; - background-color: #ffffff; - display: block; - width: 800px; - height: 23px; -} - -.ticker-swipe span { - margin-left: 1px; - background-color: #ffffff; - border-bottom: 0px solid #1F527B; - height: 12px; - width: 7px; - display: block; -} - -.ticker-controls { - padding: 8px 0px 0px 0px; - list-style-type: none; - float: left; -} - -.ticker-controls li { - padding: 0px; - margin-left: 5px; - float: left; - cursor: pointer; - height: 16px; - width: 16px; - display: block; -} - -.ticker-controls li.jnt-play-pause { - background-image: url('../images/controls.png'); - background-position: 32px 16px; -} - -.ticker-controls li.jnt-play-pause.over { - background-position: 32px 32px; -} - -.ticker-controls li.jnt-play-pause.down { - background-position: 32px 0px; -} - -.ticker-controls li.jnt-play-pause.paused { - background-image: url('../images/controls.png'); - background-position: 48px 16px; -} - -.ticker-controls li.jnt-play-pause.paused.over { - background-position: 48px 32px; -} - -.ticker-controls li.jnt-play-pause.paused.down { - background-position: 48px 0px; -} - -.ticker-controls li.jnt-prev { - background-image: url('../images/controls.png'); - background-position: 0px 16px; -} - -.ticker-controls li.jnt-prev.over { - background-position: 0px 32px; -} - -.ticker-controls li.jnt-prev.down { - background-position: 0px 0px; -} - -.ticker-controls li.jnt-next { - background-image: url('../images/controls.png'); - background-position: 16px 16px; -} - -.ticker-controls li.jnt-next.over { - background-position: 16px 32px; -} - -.ticker-controls li.jnt-next.down { - background-position: 16px 0px; -} - -.js-hidden { - display: none; -} - -.no-js-news { - padding: 10px 0px 0px 45px; - color: #ffffff; -} - -.left .ticker-swipe { - /*left: 80px;*/ -} - -.left .ticker-controls, -.left .ticker-content, -.left .ticker-title, -.left .ticker { - float: left; -} - -.left .ticker-controls { - padding-left: 6px; -} - -.right .ticker-swipe { - /*right: 80px;*/ -} - -.right .ticker-controls, -.right .ticker-content, -.right .ticker-title, -.right .ticker { - float: right; -} - -.right .ticker-controls { - padding-right: 6px; -} - -@media (max-width: 1024px) { - - /* 0.9 */ - .ticker { - height: 44px; - } - - .ticker-wrapper.has-js { - font-size: 11px; - line-height: 22px; - height: 44px; - } - - .ticker-title, - .ticker-content, - .ticker-swipe { - padding-top: 12px; - } -} - -@media (min-width: 1025px) and (max-width: 1280px) { - - /* 1.0 */ - .ticker { - height: 48px; - } - - .ticker-wrapper.has-js { - font-size: 12px; - line-height: 24px; - height: 48px; - } - - .ticker-title, - .ticker-content, - .ticker-swipe { - padding-top: 12px; - } -} - -@media (min-width: 1281px) and (max-width: 1920px) { - - /* 1.2 */ - .ticker { - height: 56px; - } - - .ticker-wrapper.has-js { - font-size: 14px; - line-height: 28px; - height: 56px; - } - - .ticker-title, - .ticker-content, - .ticker-swipe { - padding-top: 20px; - } -} - -@media (min-width: 1921px) and (max-width: 2560px) { - - /* 1.4 */ - .ticker { - height: 72px; - } - - .ticker-wrapper.has-js { - font-size: 18px; - line-height: 36px; - height: 72px; - } - - .ticker-title, - .ticker-content, - .ticker-swipe { - padding-top: 16px; - } -} - -@media (min-width: 2561px) { - - /* 1.8 */ - .ticker { - height: 104px; - } - - .ticker-wrapper.has-js { - font-size: 26px; - line-height: 52px; - height: 104px; - } - - .ticker-title, - .ticker-content, - .ticker-swipe { - padding-top: 26px; - } -} \ No newline at end of file diff --git a/cadline/backend/maintenance/downloademail.php b/cadline/backend/maintenance/downloademail.php deleted file mode 100644 index b6af9c85..00000000 --- a/cadline/backend/maintenance/downloademail.php +++ /dev/null @@ -1,128 +0,0 @@ -{$mintime} AND stat_date<{$maxtime} "; -$sql .= " AND stat_lang='hun' "; -$sql .= " GROUP BY stat_email"; - -$msh2->query($sql); -$letoltokhun = $msh2->fetchAssoc(); -$sql = "SELECT introtext FROM jml_content WHERE id = '944'"; -$msh2->query($sql); -$page = $msh2->fetchNext(); -$p = (object)$page; -$pagehun = $p->introtext; -$conf = new JConfig(); - - -foreach ($letoltokhun as $letolto) { - $l = (object)$letolto; - // felhasználónak ne küldjön levelet (van-e aktiv kulcsa) - $nUserID = $version->get_nUserIDByEmail($l->stat_email, 'hun'); - if (is_numeric($nUserID) && $nUserID > 0) { - $kulcssql = "SELECT hlNum FROM " . CRMADATBAZIS . ".hardlock WHERE hlUser='{$nUserID}' AND hlStat=1"; - $msh2->query($kulcssql); - $kulcs = $msh2->fetchNext(); - $k = (object)$kulcs; - if (isset($k->hlNum) && $k->hlNum != "") { - $kiirni .= "\n\nnincs elkuldve: " . print_r($l, true); - $log .= "\nHUN nincs elkuldve (felhasznalo): " . $l->stat_email . " " . $l->stat_first . " " . $l->stat_id . " (hun)"; - continue; - } - } - - $leveltext = str_ireplace('#nev#', $l->stat_first, $pagehun); - - $email = new CI_Email(); - $email->initialize(); - $email->setFrom($conf->mailfrom, 'CadLine'); - $email->subject('ARCHLine.XP letoltes'); - $email->message($leveltext); - $email->send($l->stat_email, 'smtp'); - $email->clear(); - - $ujletolto['stat_pron'] = "1"; - $msh2->update('download_stats', $ujletolto, "stat_id=" . $l->stat_id); - - $kiirni .= "\n\nelkuldve: " . print_r($l, true); - $log .= "\nHUN elkuldve: " . $l->stat_email . " " . $l->stat_first . " " . $l->stat_id . " (hun)"; -} - - -/***********************************************************************************/ - -// azok a NEM magyar letöltők akik nem kaptak még e-mailt -$sql = "SELECT stat_id, stat_email, stat_first, stat_country FROM download_stats "; -$sql .= " WHERE stat_pron='' AND stat_date>{$mintime} AND stat_date<{$maxtime} "; -$sql .= " AND stat_lang!='hun' "; -$sql .= " GROUP BY stat_email"; - -$msh2->query($sql); -$letoltokeng = $msh2->fetchAssoc(); - -$sql = "SELECT introtext FROM jml_content WHERE id = '945'"; -$msh2->query($sql); -$page = $msh2->fetchNext(); -$p = (object)$page; -$pageeng = $p->introtext; - -foreach ($letoltokeng as $letolto) { - $l = (object)$letolto; - // felhasználónak ne küldjön levelet (van-e aktiv kulcsa) - $nUserID = $version->get_nUserIDByEmail($l->stat_email, 'eng'); - if (is_numeric($nUserID) && $nUserID > 0) { - $kulcssql = "SELECT hlNum FROM " . CRMADATBAZIS . ".hardlock WHERE hlUser='{$nUserID}' AND hlStat=1"; - $msh2->query($kulcssql); - $kulcs = $msh2->fetchNext(); - $k = (object)$kulcs; - if (isset($k->hlNum) && $k->hlNum != "") { - $kiirni .= "\n\nnincs elkuldve: " . print_r($l, true) . "nUserID: " . $nUserID . ", hlnum: " . $k->hlNum; - $log .= "\nENG nincs elkuldve (felhasznalo): " . $l->stat_email . " " . $l->stat_first . " " . $l->stat_id . " (eng), hlNum: " . $kulcs->hlNum . " , user: " . $nUserID; - continue; - } - } - - $leveltext = str_ireplace('#nev#', $l->stat_first, $pageeng); - - $email = new CI_Email(); - $email->initialize(); - $email->setFrom('info@archlinexp.com', 'ARCHLine'); - $email->subject('ARCHLine.XP download'); - $email->message($leveltext); - $email->send($l->stat_email, 'smtp'); - $email->clear(); - - $ujletolto['stat_pron'] = "1"; - $msh2->update('download_stats', $ujletolto, "stat_id=" . $l->stat_id); - - $kiirni .= "\n\nENG elkuldve: " . print_r($l, true); - $log .= "\nENG elkuldve: " . $l->stat_email . " " . $l->stat_first . " " . $l->stat_id . " (eng)"; - - print "
    elkuldve: "; - print_r($l); -} - -$record['osztaly'] = "cron"; -$record['fv'] = "downloademail"; -$record['hiba'] = $kiirni; -$record['datum'] = date('Y-m-d H:i', time()); -$msh2->insert('a_hibak', $record); - -exec("echo '{$log}' >> ../public/download_email.txt"); diff --git a/cadline/backend/maintenance/elofizexcelcheck.php b/cadline/backend/maintenance/elofizexcelcheck.php deleted file mode 100644 index e9e7791e..00000000 --- a/cadline/backend/maintenance/elofizexcelcheck.php +++ /dev/null @@ -1,26 +0,0 @@ - $utolsofajl) { - // már egy órája nincs feltöltés - - $conf = new JConfig(); - $email = new CI_Email(); - $email->initialize(); - $email->setFrom($conf->mailfrom, 'CadLine'); - $email->subject('Hiba - Excel fizetesek feltoltes'); - $email->message("Már több mint egy órája nincs feltöltés. Utolsó feltöltés időpontja: " . date("Y-m-d H:i:s", $utolsofajl)); - $email->send('bodnart@cadline.hu', 'smtp'); - - $log .= "hiba volt, utolso: " . date("Y-m-d H:i:s", $utolsofajl); -} else { - $log .= "rendben."; -} - -exec("echo '{$log}' >> ../public/log_fizetesek_excel.txt"); diff --git a/cadline/backend/maintenance/elofizkarbxml.php b/cadline/backend/maintenance/elofizkarbxml.php deleted file mode 100644 index 09741609..00000000 --- a/cadline/backend/maintenance/elofizkarbxml.php +++ /dev/null @@ -1,113 +0,0 @@ -setOutputEncoding('CP1251'); -$data->read($fajl); -$needInsert = true; - -// temp feltoltese -crm_database::getInstance()->query("TRUNCATE TABLE `" . CRMADATBAZIS . "`.`temp_excelfizetes`"); -$insertStatement = "INSERT INTO " . CRMADATBAZIS . ".temp_excelfizetes (kulcs,datum,kapcs,info) VALUES"; -$numrows = $data->sheets[0]['numRows']; - -for ($i = 1; $i <= $numrows; $i++) { - if (!$data->sheets[0]['cells'][$i][1]) { - $needInsert = false; - continue; - } - - $o1 = $data->sheets[0]['cells'][$i][1]; - $o2 = $data->sheets[0]['cells'][$i][2]; - $o3 = $data->sheets[0]['cells'][$i][3]; - $o4 = $data->sheets[0]['cells'][$i][4]; - $insertStatement = $insertStatement . "(" . $o1 . ",'" . $o2 . "','" . $o3 . "','" . $o4 . "')"; - if ($i < $numrows) - $insertStatement = $insertStatement . ","; - - $needInsert = true; -} - -if ($needInsert || $numrows <= 0) - crm_database::getInstance()->query($insertStatement); - -// valtozasok lekerese -crm_database::getInstance()->query("(SELECT t1.kulcs, t1.datum, t1.kapcs, t1.info, '' originfo - FROM " . CRMADATBAZIS . ".temp_excelfizetes t1 LEFT JOIN " . CRMADATBAZIS . ".t_excelfizetes t2 ON t1.kulcs = t2.kulcs - WHERE t1.datum!=t2.datum OR t1.kapcs!=t2.kapcs AND t1.kulcs !='') - UNION - (SELECT kulcs, datum, kapcs, 'uj elem' info, info as originfo FROM " . CRMADATBAZIS . ".temp_excelfizetes - WHERE kulcs NOT IN (SELECT kulcs FROM " . CRMADATBAZIS . ".t_excelfizetes))"); -$valtozasok = crm_database::getInstance()->fetchAssoc(); - -foreach ($valtozasok as $el) { - $elem = (object)$el; - - $utfizu = Version::_getfizhonap($elem->datum, $elem->kapcs); - $actDate = Version::_modosit($elem->kulcs, $utfizu, $elem->kapcs, $elem->info); - - $tomb = array( - "kulcs" => $elem->kulcs, - "kapcs" => $elem->kapcs, - "datum" => $elem->datum, - "info" => $elem->originfo, - ); - - if ($elem->info == "uj elem") - crm_database::getInstance()->insert(CRMADATBAZIS . '.t_excelfizetes', $tomb); - else - crm_database::getInstance()->update(CRMADATBAZIS . '.t_excelfizetes', $tomb, array('kulcs' => $elem->kulcs)); - - $hiInfo = "Excel: " . $elem->kapcs . ", Dátum: " . $elem->datum . " " . $elem->originfo; - - $query = "SELECT * FROM `" . CRMADATBAZIS . "`.`h_history` WHERE hiHlNum = '" . $elem->kulcs . "' AND hiInfo = '" . $hiInfo . "'"; - crm_database::getInstance()->query($query); - $res = crm_database::getInstance()->fetchAssoc(); - - if (empty($res)) { - $history = array( - 'hiHlNum' => $elem->kulcs, - 'hiDate' => date('Y-m-d'), - 'hiManID' => 36, - 'hiTypeID' => 3, - 'hiTime' => date("Y-m-d H:i:s"), - 'hiInfo' => $hiInfo, - ); - - if ($actDate && $actDate != '') { - $history['activationDate'] = $actDate; - } - - crm_database::getInstance()->query("SELECT prOrdNum, prPass FROM `" . CRMADATBAZIS . "`.`h_programs` - WHERE prVerID >=13 AND prHlNum IS NOT NULL AND prHlNum = (select hlNum FROM `" . CRMADATBAZIS . "`.`hardlock` WHERE `hlNum`='{$elem->kulcs}' AND `hlStat`=1) ORDER BY prID DESC LIMIT 1;"); - $lastProgram = crm_database::getInstance()->fetchNext(); - - if (!empty($lastProgram) && $lastProgram['prOrdNum'] != '') { - $history['prPass'] = $lastProgram['prPass']; - crm_database::getInstance()->query("SELECT o.id AS id FROM `" . CRMADATBAZIS . "`.`o_orders` o - WHERE o.order = '" . $lastProgram['prOrdNum'] . "' AND o.output_key = '" . $lastProgram['prPass'] . "' ORDER BY o.id DESC LIMIT 1;"); - $currentOrder = crm_database::getInstance()->fetchNext(); - - if (!empty($currentOrder)) { - $history['orderID'] = $currentOrder['id']; - } - } - - crm_database::getInstance()->insert(CRMADATBAZIS . '.h_history', $history); - - print "Valtozott: " . $elem->kulcs . " " . $utfizu . " " . $elem->kapcs; - } -} - -print "ok"; diff --git a/cadline/backend/maintenance/elofizurites.php b/cadline/backend/maintenance/elofizurites.php deleted file mode 100644 index f4a52fb1..00000000 --- a/cadline/backend/maintenance/elofizurites.php +++ /dev/null @@ -1,7 +0,0 @@ -query($sql); -$msh->query($sql2); diff --git a/cadline/backend/maintenance/email.php b/cadline/backend/maintenance/email.php deleted file mode 100644 index a6078254..00000000 --- a/cadline/backend/maintenance/email.php +++ /dev/null @@ -1,95 +0,0 @@ -CI = &get_instance(); - } - - function initialize($settings = false) - { - if (!$settings) { - //$settings = $this->CI->config->item('email'); - $conf = new JConfig(); - $settings['host'] = $conf->smtphost; - $settings['port'] = $conf->smtpport; - $settings['helo'] = null; - $settings['auth'] = $conf->smtpauth; - $settings['user'] = $conf->smtpuser; - $settings['pass'] = $conf->smtppass; - /*$settings['host'] = 'localhost'; - $settings['port'] = 25; - $settings['helo'] = null; - $settings['auth'] = true; - $settings['user'] = 'www.smtp@cadline.hu'; - $settings['pass'] = 'Chieng0t';*/ - } - - $this->setSMTPParams($settings['host'], $settings['port'], $settings['helo'], $settings['auth'], $settings['user'], $settings['pass']); - - $this->setHTMLCharset('UTF-8'); - $this->setHeadCharset('UTF-8'); - $this->setHTMLEncoding(new EightBitEncoding()); - } - - function addOfficialImages() - { - $this->addEmbeddedImage(new fileEmbeddedImage('../public/img/mail/title.jpg')); - $this->addEmbeddedImage(new fileEmbeddedImage('../public/img/mail/footer.jpg')); - } - - function addImage($path) - { - $this->addEmbeddedImage(new fileEmbeddedImage('../public/img/' . $path)); - } - - function clear() - { - $this->is_built = false; - $this->setHTML(null); - $this->setFrom(null); - } - - function message($html) - { - $tomb['�'] = 'á'; - $tomb['�'] = 'Á'; - $tomb['�'] = 'é'; - $tomb['�'] = 'É'; - $tomb['�'] = 'ó'; - $tomb['�'] = 'Ó'; - $tomb['�'] = 'ö'; - $tomb['�'] = 'Ö'; - $tomb['�'] = 'ő'; - $tomb['�'] = 'Ő'; - $tomb['�'] = 'ú'; - $tomb['�'] = 'Ú'; - $tomb['�'] = 'ü'; - $tomb['�'] = 'Ü'; - $tomb['�'] = 'ű'; - $tomb['�'] = 'Ű'; - $tomb['�'] = 'í'; - $tomb['�'] = 'Í'; - - $string = $html; - foreach ($tomb as $k => $v) { - $string = str_replace($k, $v, $string); - } - $this->setHTML($string); - } - - function from($from) - { - $this->setFrom($from); - } - - function subject($subj) - { - $this->setSubject($subj); - } -} diff --git a/cadline/backend/maintenance/emailsending.php b/cadline/backend/maintenance/emailsending.php deleted file mode 100644 index 73dfaa18..00000000 --- a/cadline/backend/maintenance/emailsending.php +++ /dev/null @@ -1,80 +0,0 @@ -"; - if ($needscr == 1) - $contributionmsg = $contributionmsg . "
  • A képernyőjéről készült kép
  • "; - if ($needsysdata == 1) - $contributionmsg = $contributionmsg . "
  • Az általa használt rendszer leírása
  • "; - $contributionmsg = $contributionmsg . ""; - $wasUpload = true; -} else - $contributionmsg = "Képernyőkép és rendszeradatok küldéséhez nem járult hozzá!"; - -if ($fileUpload == 1) { - if ($needscr == 1 or $needsysdata == 1) - $fileUploadmsg = "Továbbá fájl feltöltést is kezdeményezett, melynek eredeti neve: " . $fileName . "
    "; - else - $fileUploadmsg = "A felhasználó fájl feltöltést kezdeményezett, melynek eredeti neve: " . $fileName . "
    "; - - $contributionmsg = $contributionmsg . $fileUploadmsg; - $wasUpload = true; -} - -if ($wasUpload) { - if ($proto == 'ftp') - $destination = "
    A feltöltött fájl(ok) elérése:
    A 'vendeg' felhasználó adataival való bejelentkezés után a tanis2.cadline.hu/uploadedProjects/" . $guid . " címen.
    "; - else - $destination = "
    A feltöltött fájl(ok) elérése:
    A 'webdavuser' felhasználó adataival való bejelentkezés után a https://webdav.cadline.hu/uploadedProjects/" . $guid . " címen.
    "; - - if ($failed == 0) - $failOwnMsg = "
    FIGYELMEZTETÉS: A feltöltést a felhasználó megszakította, mielőtt az teljesen végbe ment volna! A fájlok egy része nem teljes!
    "; - else - $failOwnMsg = ""; -} else { - $destination = "
    "; - $failOwnMsg = ""; -} - -$message = "Kedves Kollégák!

    A mai napon az ARCHLine.XP " . $year . " programból az alábbi felhasználó hibajelentést küldött.
    A felhasználó email címe: " . $email . "
    Build: " . $build . "
    Nyelv: " . $lang . "
    Serial: " . $serial . "

    " . $contributionmsg . $destination . $failOwnMsg . "
    A felhasználó által megadott megjegyzés:

    " . $comment . ''; - -$mail = new PHPMailer; -$mail->isSMTP(); -$mail->SMTPAuth = true; -$mail->CharSet = 'UTF-8'; -$mail->Host = $mailconfig['Host']; -$mail->Username = $mailconfig['Username']; -$mail->Password = $mailconfig['Password']; -$mail->SMTPSecure = $mailconfig['SMTPSecure']; -$mail->Port = $mailconfig['Port']; -$mail->isHTML(TRUE); -$mail->setFrom(DEFAULT_EMAIL); -$mail->addAddress('support@cadline.hu'); -$mail->Subject = 'Projekt feltölés - ARCHLine.XP'; -$mail->msgHTML($message); -$mail->AltBody = strip_tags($message); -$mail->send(); -unset($mail); - -if ($lang == "hun") - print "Köszönjük a visszajelzést!"; -else - print "Thank you for your report!"; diff --git a/cadline/backend/maintenance/emergency_server/login.php b/cadline/backend/maintenance/emergency_server/login.php deleted file mode 100644 index a965b97f..00000000 --- a/cadline/backend/maintenance/emergency_server/login.php +++ /dev/null @@ -1,97 +0,0 @@ -query($query, array('s', $_POST["username"])); - $admin = Database::getInstance()->fetchNext(); - - $phpass = new PasswordHash(10, true); - $ok = $phpass->CheckPassword($_POST["password"], $admin['password']); - - if ($ok) { - $_SESSION['username'] = $_POST["username"]; - header("location: server_status.php"); - } else { - $error = 'Hibás felhasználónév vagy jelszó'; - } -} -?> - - - - - - - - - - - Bejelentkezés - - - - -
    -
    - - - -
    -
    - -
    -
    - -
    -
    -
    - -
    -
    -
    - -
    -
    - -
    -
    -
    -
    -
    - - - - - \ No newline at end of file diff --git a/cadline/backend/maintenance/emergency_server/server_status.php b/cadline/backend/maintenance/emergency_server/server_status.php deleted file mode 100644 index 0bfca61c..00000000 --- a/cadline/backend/maintenance/emergency_server/server_status.php +++ /dev/null @@ -1,167 +0,0 @@ - - array( - 'timeout' => 10, - ) -)); - -$primaryTxt = file_get_contents('https://secondary.cadline.hu/serverAlive.txt'); -$secondaryTxt = file_get_contents('https://secondary.cadline.hu/serverAliveSecondary.txt'); -$primaryServer = file_get_contents("https://www.archlinexp.com/maintenance/read_server_txt.php", false, $ctx); -$secondaryServer = file_get_contents("https://secondary.cadline.hu/read_server_txt.php"); -$primaryActive = $primaryServer && $primaryServer != '' ? $primaryServer : 'Inactive'; -$secondaryActive = $secondaryServer && $secondaryServer != '' ? $secondaryServer : 'Inactive'; -?> - - - - - - - - - - - - - - Server Status - - - - - -
    -
    -
    -
    -
    -

    Secondary szerver használatának kikényszerítése

    -
    - -
    - - - - - - - - - - - - - -
    Primary Server (www.archline.hu / www.archlinexp.com)A főszerver állapota:
    Secondary Server (secondary.cadline.hu)A másodlagos szerver állapota:
    -
    -
    -
    - -
    -
    -
    -

    Secondary szerver használatának kikényszerítése

    -
    - - - - - - - -
    -

    Emergency mode

    - - -
    -
    - - -
    -
    -
    -
    -
    - - - - - \ No newline at end of file diff --git a/cadline/backend/maintenance/emergency_server/session.php b/cadline/backend/maintenance/emergency_server/session.php deleted file mode 100644 index bf75339d..00000000 --- a/cadline/backend/maintenance/emergency_server/session.php +++ /dev/null @@ -1,8 +0,0 @@ -query($query, array('s', $alias)); -$res = Database::getInstance()->fetchNext(); - -crm_users::levelesemeny($email, "events", "newclick", $res['esem_id'], $res['esem_cont'], $res['name']); - -header('Location: ' . $res['redirect']); -exit(); diff --git a/cadline/backend/maintenance/functions.php b/cadline/backend/maintenance/functions.php deleted file mode 100644 index f155ffbf..00000000 --- a/cadline/backend/maintenance/functions.php +++ /dev/null @@ -1,87 +0,0 @@ -latitude; - $answer .= ','; - $answer .= $data->longitude; - print $answer; -} diff --git a/cadline/backend/maintenance/get_joomla_profile.php b/cadline/backend/maintenance/get_joomla_profile.php deleted file mode 100644 index b41d49f1..00000000 --- a/cadline/backend/maintenance/get_joomla_profile.php +++ /dev/null @@ -1,47 +0,0 @@ -query($query, array('s', substr($serial, 0, 6))); -$hardlock = Database::getInstance()->fetchNext(); - -if (!empty($hardlock) && is_numeric($hardlock['hlUser'])) { - $nUserID = (int)$hardlock['hlUser']; - - $query = "SELECT e.email AS email, u.id AS userID, u.nUserID AS nUserID - FROM cl_hlusers.u_emails e - LEFT JOIN www_archline_hu.jml_users u ON e.nUserID = u.nUserID - WHERE e.nUserID = ? GROUP BY e.nUserID LIMIT 1;"; - Database::getInstance()->query($query, array('i', $nUserID)); - $user = Database::getInstance()->fetchNext(); - - if (!empty($user)) { - $email = $user['email']; - $userID = $user['userID']; - $nUserID = $user['nUserID']; - } -} - -if ($detailed && $seatID != '') { - $accountInfo = ''; - if ($userID != null && $userID > 0 && $nUserID != null && $nUserID > 0) { - $tokenID = crm_hardlock::GetOrGenerateToken($seatID, $nUserID); - - $accountInfo = ' - ' . $nUserID . ' - ' . $email . ' - ' . $tokenID . ' - '; - } - - echo base64_encode($accountInfo); -} else { - echo $email; -} diff --git a/cadline/backend/maintenance/get_mirror_links.php b/cadline/backend/maintenance/get_mirror_links.php deleted file mode 100644 index 32551fa7..00000000 --- a/cadline/backend/maintenance/get_mirror_links.php +++ /dev/null @@ -1,107 +0,0 @@ - 2023 ? (int)$_GET['year'] : 2024; -$se = isset($_GET['se']) ? $_GET['se'] : ''; -$isLT = $se != '' ? '_' . $se : ''; - -$query = "SELECT * FROM local_crm.mirror_links ORDER BY continent ASC"; -Database::getInstance()->query($query); -$mirror_links = Database::getInstance()->fetchAssoc(); -?> - - - - - - - - - - - - Download - - - - - - - -
    -

    Choose a setup file

    -
    - -

    - If the websetup could not download the installation kit, please choose the server closest to you and try to download it from there by clicking the download button. -

    -
    - -
    -
    - - - - - - - - - - - - - - - - - -
    LocationDescription#
    - Download -
    -
    -
    -
    - - - \ No newline at end of file diff --git a/cadline/backend/maintenance/get_program_details.php b/cadline/backend/maintenance/get_program_details.php deleted file mode 100644 index e239edd2..00000000 --- a/cadline/backend/maintenance/get_program_details.php +++ /dev/null @@ -1,39 +0,0 @@ -query($query); -$programs = Database::getInstance()->fetchAssoc(); - -$encodedSession = isset($_POST["session"]) ? $_POST["session"] : $_GET["session"]; -$session = base64_decode($encodedSession); -$privatekey = Webform::GetWebformPrivateKey(); -$param = $_POST["param"]; -$decoded_param = Webform::decode($privatekey, $session, $param); -$decoded_param = "?" . $decoded_param; -$isid = Webform::get_valueFromStringUrl($decoded_param, "isid"); - -$response = array(); -foreach ($programs as $program) { - $availabelProgram = ''; - $freeLic = ''; - - $response[$program['prPass']]['available'] = crm_hardlock::isProgramAvailable('', $program['prPass'], $program['prFizetve'], $isid, $program['hlLan'], $program['prActCode'], $availabelProgram, $freeLic, 39, $program['isFloating']); - if (!$response[$program['prPass']]['available'] || $freeLic != '') { - $response[$program['prPass']]['message'] = crm_hardlock::getInfoForProgramDialog($program['prFizetve'], $availabelProgram, $freeLic, $ctrID); - } - - $response[$program['prPass']]['lan'] = $program['hlLan']; -} - - -echo json_encode($response); diff --git a/cadline/backend/maintenance/get_subscriptions.php b/cadline/backend/maintenance/get_subscriptions.php deleted file mode 100644 index 70b1cace..00000000 --- a/cadline/backend/maintenance/get_subscriptions.php +++ /dev/null @@ -1,69 +0,0 @@ -modify('+1 month'); -$nextMonth = $date->format('Y-m'); - -$query = "SELECT p.prPass AS prPass, p.prHlNum AS prHlNum, p.prFizetve AS prFizetve, h.hlUser AS nUserID - FROM cl_hlusers.h_programs p - LEFT JOIN cl_hlusers.hardlock h ON h.hlNum = p.prHlNum - WHERE p.prStat = 0 AND p.prOrdNum LIKE 'E-%' AND p.prFizetve LIKE '{$nextMonth}-%' AND p.prContact = 1 AND p.prStat = 0"; -Database::getInstance()->query($query); -$res = Database::getInstance()->fetchAssoc(); - -if (!empty($res)) { - $i = 1; - - $message = ''; - - foreach ($res as $value) { - $query2 = "SELECT distributors.name AS partnerName, partnerek.email AS partnerEmail, o_orders.user_name AS userName, o_orders.user_email AS userEmail, - o_orders.country AS country - FROM cl_hlusers.o_orders - LEFT JOIN cl_hlusers.distributors ON distributors.ctrID = o_orders.country - LEFT JOIN szamla_agent.partnerek ON partnerek.ország = o_orders.country - WHERE output_key = '" . $value['prPass'] . "'"; - Database::getInstance()->query($query2); - $res2 = Database::getInstance()->fetchNext(); - - $message .= '' . $i . '. ' . $res2['partnerName'] . ' (' . $res2['partnerEmail'] . ')' . ':

    '; - $message .= '
    '; - $message .= '
    '; - - if (is_numeric($value['nUserID'])) - $message .= 'User Name: ' . $res2['userName'] . '
    '; - else - $message .= 'User Name: ' . $res2['userName'] . '
    '; - - $message .= 'User Email: ' . $res2['userEmail'] . '
    '; - $message .= 'Serial Number: ' . $value['prPass'] . '
    '; - $message .= 'Program expiration date: ' . $value['prFizetve'] . '

    '; - $message .= '
    '; - - $i++; - } - - $message .= ''; - - $mail = new PHPMailer; - $mail->isSMTP(); - $mail->SMTPAuth = true; - $mail->CharSet = 'UTF-8'; - $mail->Host = $mailconfig['Host']; - $mail->Username = $mailconfig['Username']; - $mail->Password = $mailconfig['Password']; - $mail->SMTPSecure = $mailconfig['SMTPSecure']; - $mail->Port = $mailconfig['Port']; - $mail->isHTML(TRUE); - $mail->setFrom(DEFAULT_EMAIL); - $mail->addAddress('office@cadline.hu'); - $mail->addCC('mate.nagy@cadline.hu'); - $mail->Subject = 'Lejáró weborder előfizetések'; - $mail->msgHTML($message); - $mail->AltBody = strip_tags($message); - $mail->send(); -} diff --git a/cadline/backend/maintenance/getd5plugin.php b/cadline/backend/maintenance/getd5plugin.php deleted file mode 100644 index e63924e4..00000000 --- a/cadline/backend/maintenance/getd5plugin.php +++ /dev/null @@ -1,5 +0,0 @@ -query("SELECT * FROM " . CRMADATBAZIS . ".h_programs WHERE prPass='" . $serial . "' LIMIT 1;"); -$prog = $msh->fetchAssoc(); -if (empty($prog)) die(); - -$msh->query("SELECT hlUser FROM " . CRMADATBAZIS . ".hardlock WHERE hlNum='" . substr($serial, 0, 6) . "' LIMIT 1;"); -$res = $msh->fetchAssoc(); -if (empty($res)) die(); - -if ((int)$res[0]['hlUser'] > 0) { - $tomb['nUserID'] = $res[0]['hlUser']; - - $msh->query("SELECT * FROM " . CRMADATBAZIS . ".u_emails WHERE nUserID='" . $tomb['nUserID'] . "';"); - $res = $msh->fetchAssoc(); - if (!empty($res)) { - foreach ($res as $k => $row) { - if ((int)$row['default'] == 1) { - $tomb['strEmail'] = $row['email']; - break; - } - } - if ($tomb['email'] == "") $tomb['strEmail'] = $res[0]['email']; - } - - $msh->query("SELECT * FROM " . CRMADATBAZIS . ".users WHERE nUserID=" . $tomb['nUserID'] . " LIMIT 1;"); - $res = $msh->fetchAssoc(); - if (empty($res)) die(); - - $tomb['strName'] = $res[0]['strName']; - $tomb['strCompany'] = $res[0]['strCompany']; -} else { - $tomb['strName'] = $res[0]['hlUser']; -} - -$strXML = ' - - ' . ((int)$prog[0]['prStat'] == 0 ? 'TRUE' : 'FALSE') . ' - ' . $tomb['strEmail'] . ' - ' . $tomb['strName'] . ' - ' . $tomb['strCompany'] . ' -'; - -print $strXML; diff --git a/cadline/backend/maintenance/getserialanddaycode.php b/cadline/backend/maintenance/getserialanddaycode.php deleted file mode 100644 index 210bc6f4..00000000 --- a/cadline/backend/maintenance/getserialanddaycode.php +++ /dev/null @@ -1,33 +0,0 @@ -query("SELECT * FROM `" . CRMADATBAZIS . "`.`p_versions` WHERE verName LIKE '%" . $ver . "%' LIMIT 1;"); -$tmp = crm_database::getInstance()->fetchNext(); -$ver = $tmp; - -crm_database::getInstance()->query("SELECT * FROM `" . CRMADATBAZIS . "`.`h_programs` WHERE prHlNum='" . $hlnum . "' AND prVerID='" . $ver['verID'] . "' LIMIT 1;"); -$prog = crm_database::getInstance()->fetchNext(); - -if (empty($prog) == false) { - if ($isid != '' && isset($isid)) { - $softwarekey = Codegen::IsSoftwareKey($prog['prPass']); - if ($softwarekey == false) // A regisztracional a gepazonositot kuldi a program, ez hardware kulcsnal nem alkalmazhato - $isid = crm_hardlock::GetIsidFromPasswordForHardwareKeys($prog['prPass']); - - crm_hardlock::RegisterProgram($prog['prPass'], $isid, "", $npid, "", $isTwTw, $seatID, $build); - } - print $prog['prPass']; -} diff --git a/cadline/backend/maintenance/google_redirect.php b/cadline/backend/maintenance/google_redirect.php deleted file mode 100644 index 01c87c84..00000000 --- a/cadline/backend/maintenance/google_redirect.php +++ /dev/null @@ -1,64 +0,0 @@ -setClientId('427394287601-f5fvh3809726dah7lq7d4pkl4af8p7av.apps.googleusercontent.com'); -$client->setClientSecret('_qMqFv2zuk2b0z7fazwgNuBk'); -$client->setRedirectUri('https://www.archlinexp.com/maintenance/google_redirect.php'); -$client->addScope('email'); -$client->addScope('profile'); - -$client->authenticate($_GET['code']); - -$objOAuthService = new Google_Service_Oauth2($client); - -if ($client->getAccessToken()) - $userData = $objOAuthService->userinfo->get(); - -$datas->userName = $userData['name']; -$datas->userEmail = $userData['email']; - -switch ($datas->action) { - case 'event_registration': - $event = new Event($datas); - $success = $event->registration() ? 'success' : 'failed'; - - if ($datas->evt_id == '107') - $returnedURL = 'https://www.archlinexp.com/education/events/2025-update-day-march'; - else - $returnedURL = 'https://www.archlinexp.com/events'; - - header('Location: ' . $returnedURL . '?success=' . $success); - exit; - break; - - case 'win_al_live': - $event = new Event($datas); - $success = $event->registerToWinLIVE() ? 'success' : 'failed'; - $returnedURL = 'https://www.archlinexp.com/win-al-live'; - - header('Location: ' . $returnedURL . '?success=' . $success); - exit; - break; - - case 'webinar_registration': - $event = new Event($datas); - $success = $event->registrationToWebinar() ? 'success' : 'failed'; - $returnedURL = $datas->crm_db == 'clusers' ? 'https://www.archline.hu/oktatas/webinariumok/regisztracio' : 'https://www.archlinexp.com/webinars/registration'; - - header('Location: ' . $returnedURL . '?webinar_id=' . $datas->course_id . '&success=' . $success); - exit; - break; - - default: - $returnedURL = 'https://www.archlinexp.com/'; - - header('Location: ' . $returnedURL); - exit; - break; -} diff --git a/cadline/backend/maintenance/handshake.php b/cadline/backend/maintenance/handshake.php deleted file mode 100644 index 07d9c15f..00000000 --- a/cadline/backend/maintenance/handshake.php +++ /dev/null @@ -1,4 +0,0 @@ -query($sql); -$kulcsokobjarray = crm_database::getInstance()->fetchAssoc(); -$kulcsok = array(); - -foreach ($kulcsokobjarray as $obj) { - $object = (object)$obj; - $ctrName = "ures"; - crm_database::getInstance()->query("SELECT hlCtrID, hlUser FROM " . CRMADATBAZIS . ".hardlock WHERE hlNum='" . substr($object->pwd, 0, 6) . "'"); - $hardlock = crm_database::getInstance()->fetchNext(); - $h = (object)$hardlock; - - if ($h->hlCtrID) { - crm_database::getInstance()->query("SELECT ctrName FROM " . CRMADATBAZIS . ".countries WHERE ctrID=" . $h->hlCtrID); - $orszag = crm_database::getInstance()->fetchNext(); - $o = (object)$orszag; - $ctrName = $o->ctrName; - } - if (is_numeric($h->hlUser)) { - crm_database::getInstance()->query("SELECT strName FROM " . CRMADATBAZIS . ".users WHERE nUserID=" . $h->hlUser); - $user = crm_database::getInstance()->fetchNext(); - $u = (object)$user; - $user = $u->strName; - } else - $user = $h->hlUser; - - $hibahun = $hibaeng = ""; - if (strstr($object->error, "error: nincs ilyen password")) { - $hibahun = "nincs ilyen Sorozatszám"; - $hibaeng = "no Serial code in CRM database"; - $support = "Check user figures and send order to CadLine"; - } elseif (strstr($object->error, "error: nem aktiv a program")) { - $hibahun = "nem aktiv a program"; - $hibaeng = "this Serial code is not active"; - $support = "Check why? (Maybe prohibited, but old hardlock was not sent back to office.)"; - } elseif (strstr($object->error, "error: nincs vasarlasi idopont")) { - $hibahun = "nincs vasarlasi idopont a CRM-ben"; - $hibaeng = "no selling date setup in database"; - $support = "Check the User payments and ask new activation code from CadLine"; - } elseif (strstr($object->error, "error: hianyzo kod")) { - $hibahun = "hianyzo Aktiválási kod"; - $hibaeng = "no Activation code in CRM"; - $support = "Check the User payments and ask new activation code from CadLine"; - } elseif (strstr($object->error, "error: masik gep van regisztralva")) { - $hibahun = "masik gep van regisztralva - Feloldás kell"; - $hibaeng = "this is already registered on another PC"; - $support = "Check it, maybe user tried to download more times. If its OK, ask to release from CadLine (after that user can register again and can use for more 60 days!) Its your decision."; - } elseif (strstr($object->error, "error: nincs kifizetve")) { - $hibahun = "nincs kifizetve, aktiválási kód lejárt"; - $hibaeng = "the program is not paid in CRM system"; - $support = "Check the payment and ask new activation from CadLine"; - } elseif (strstr($object->error, "error: tul sok telepites")) { - $hibahun = "túl sok telepités - Feloldás kell"; - $hibaeng = "the program already registered "; - $support = "Check, discuss with user why tried it twice, and If its OK, ask to release from CadLine (after that user can register again and can use for more 60 days!) Its your decision."; - } - - preg_match('/\d{16}/', $object->error, $serialmatch); - - crm_database::getInstance()->query("SELECT * FROM " . CRMADATBAZIS . ".`h_programs` WHERE `prPass` = '" . $object->pwd . "' ORDER BY `prID` DESC LIMIT 1"); - $arrDealer = crm_database::getInstance()->fetchAssoc(); - - $ujhibaskulcs = array(); - $ujhibaskulcs['kulcs'] = $object->pwd; - $ujhibaskulcs['serial'] = $serialmatch[0]; - $ujhibaskulcs['ctrName'] = $ctrName; - $ujhibaskulcs['user'] = $user; - $ujhibaskulcs['hibahun'] = $hibahun; - $ujhibaskulcs['hibaeng'] = $hibaeng; - $ujhibaskulcs['support'] = $support; - $ujhibaskulcs['dealer'] = $arrDealer[0]['prDealer']; - $kulcsok[] = $ujhibaskulcs; -} - -$htmlkulcsok = "\n"; -$htmlkulcsok .= "\n"; -$htmlkulcsok .= "\t\n"; -$htmlkulcsok .= "\t\n"; -$htmlkulcsok .= "\t\n"; -$htmlkulcsok .= "\t\n"; -$htmlkulcsok .= "\t\n"; -$htmlkulcsok .= "\t\n"; -//$htmlkulcsok .= "\t\n"; -$htmlkulcsok .= "\t\n"; -$htmlkulcsok .= "\n"; - -foreach ($kulcsok as $kulcs) { - $htmlkulcsok .= "\n"; - $htmlkulcsok .= "\t\n"; - $htmlkulcsok .= "\t\n"; - $htmlkulcsok .= "\t\n"; - $htmlkulcsok .= "\t\n"; - $htmlkulcsok .= "\t\n"; - $htmlkulcsok .= "\t\n"; - //$htmlkulcsok .= "\t\n"; - $htmlkulcsok .= "\t\n"; - $htmlkulcsok .= "\n"; -} -$htmlkulcsok .= "
    Hardlock NoSerial NoCountryDealerUser nameerror messagehibaüzenetHow should you support ?
    {$kulcs['kulcs']}{$kulcs['serial']}{$kulcs['ctrName']}{$kulcs['dealer']}{$kulcs['user']}{$kulcs['hibaeng']}{$kulcs['hibahun']}{$kulcs['support']}
    "; - -// $kulcslista = implode(", ",$kulcsok); - -$message = "Ez egy automatikusan generált CRM rendszer üzenet. Azokról a kulcsokról, melyeknél tegnap ({$tegnap}) olyan programindítás történt, amire hiba volt a válasz:

    - Dear Administrator,

    - According to our system report please find the errors from yesterday below." . - $htmlkulcsok .= "

    Best Regards,

    Anikó Huszár"; - -$mail = new PHPMailer; -$mail->isSMTP(); -$mail->SMTPAuth = true; -$mail->CharSet = 'UTF-8'; -$mail->Host = $mailconfig['Host']; -$mail->Username = $mailconfig['Username']; -$mail->Password = $mailconfig['Password']; -$mail->SMTPSecure = $mailconfig['SMTPSecure']; -$mail->Port = $mailconfig['Port']; -$mail->isHTML(TRUE); -$mail->setFrom(DEFAULT_EMAIL); -// $mail->addAddress('webdeveloper@cadline.hu'); -// $mail->addAddress('aniko.huszar@cadline.hu'); -$mail->addAddress('office@cadline.hu'); -$mail->Subject = 'Hibas programinditasok'; -$mail->msgHTML($message); -$mail->AltBody = strip_tags($message); -$mail->send(); -unset($mail); - -/* -// 2017.06.07. F.Zs.: levélküldő objektum lecserélve, mert nem működött - $conf = new JConfig(); - $email = new CI_Email(); - $email->initialize(); - $email->setFrom('info@cadline.hu', 'CadLine'); - $email->subject('Hibas programinditasok'); - $email->message($message); - $email->send('aniko.huszar@cadline.hu', 'smtp'); -*/ diff --git a/cadline/backend/maintenance/index.html b/cadline/backend/maintenance/index.html deleted file mode 100644 index 640bda4a..00000000 --- a/cadline/backend/maintenance/index.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/cadline/backend/maintenance/installer_link.php b/cadline/backend/maintenance/installer_link.php deleted file mode 100644 index e01ad4a4..00000000 --- a/cadline/backend/maintenance/installer_link.php +++ /dev/null @@ -1,57 +0,0 @@ -true'; -} - -if ($lang == 'us') { - $prefAws = 'true'; -} - -$resultXml = ''; - -$mirrorLinks = crm_hardlock::getMirrorLinks(); - -$resultXml .= ""; -foreach ($mirrorLinks as $mirrorLink) { - $url = crm_hardlock::generateDownloadUrl($mirrorLink['link'], $year, $ltString); - - $resultXml .= ""; - - if ($mirrorLink['id'] == 2) { - $resultXml .= $prefAws; - } - - if ($mirrorLink['id'] == 3) { - $resultXml .= $prefAzure; - } - - $resultXml .= "{$url}"; - - if ($mirrorLink['comment'] != '') { - $resultXml .= "" . $mirrorLink['comment'] . ""; - } - - $resultXml .= ""; -} -$resultXml .= ""; - -echo $resultXml; diff --git a/cadline/backend/maintenance/installer_log.php b/cadline/backend/maintenance/installer_log.php deleted file mode 100644 index ad1e5c2e..00000000 --- a/cadline/backend/maintenance/installer_log.php +++ /dev/null @@ -1,42 +0,0 @@ -insert( - 'local_crm.installer_log', - array( - "compID" => $compid, - "year" => $year, - "build" => $build, - "status" => $status, - "instert_date" => date('Y-m-d H:i:s') - ), - 'iiiss' - ); -} diff --git a/cadline/backend/maintenance/ipc_sample_test.php b/cadline/backend/maintenance/ipc_sample_test.php deleted file mode 100644 index 859277a5..00000000 --- a/cadline/backend/maintenance/ipc_sample_test.php +++ /dev/null @@ -1,2 +0,0 @@ - 0 && void 0 !== arguments[0] ? arguments[0] : {}; this.action = e.action, this.container = e.container, this.emitter = e.emitter, this.target = e.target, this.text = e.text, this.trigger = e.trigger, this.selectedText = "" } }, { key: "initSelection", value: function t() { this.text ? this.selectFake() : this.target && this.selectTarget() } }, { key: "selectFake", value: function t() { var e = this, n = "rtl" == document.documentElement.getAttribute("dir"); this.removeFake(), this.fakeHandlerCallback = function () { return e.removeFake() }, this.fakeHandler = this.container.addEventListener("click", this.fakeHandlerCallback) || !0, this.fakeElem = document.createElement("textarea"), this.fakeElem.style.fontSize = "12pt", this.fakeElem.style.border = "0", this.fakeElem.style.padding = "0", this.fakeElem.style.margin = "0", this.fakeElem.style.position = "absolute", this.fakeElem.style[n ? "right" : "left"] = "-9999px"; var o = window.pageYOffset || document.documentElement.scrollTop; this.fakeElem.style.top = o + "px", this.fakeElem.setAttribute("readonly", ""), this.fakeElem.value = this.text, this.container.appendChild(this.fakeElem), this.selectedText = (0, i.default)(this.fakeElem), this.copyText() } }, { key: "removeFake", value: function t() { this.fakeHandler && (this.container.removeEventListener("click", this.fakeHandlerCallback), this.fakeHandler = null, this.fakeHandlerCallback = null), this.fakeElem && (this.container.removeChild(this.fakeElem), this.fakeElem = null) } }, { key: "selectTarget", value: function t() { this.selectedText = (0, i.default)(this.target), this.copyText() } }, { key: "copyText", value: function t() { var e = void 0; try { e = document.execCommand(this.action) } catch (t) { e = !1 } this.handleResult(e) } }, { key: "handleResult", value: function t(e) { this.emitter.emit(e ? "success" : "error", { action: this.action, text: this.selectedText, trigger: this.trigger, clearSelection: this.clearSelection.bind(this) }) } }, { key: "clearSelection", value: function t() { this.trigger && this.trigger.focus(), window.getSelection().removeAllRanges() } }, { key: "destroy", value: function t() { this.removeFake() } }, { key: "action", set: function t() { var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "copy"; if (this._action = e, "copy" !== this._action && "cut" !== this._action) throw new Error('Invalid "action" value, use either "copy" or "cut"') }, get: function t() { return this._action } }, { key: "target", set: function t(e) { if (void 0 !== e) { if (!e || "object" !== (void 0 === e ? "undefined" : r(e)) || 1 !== e.nodeType) throw new Error('Invalid "target" value, use a valid Element'); if ("copy" === this.action && e.hasAttribute("disabled")) throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute'); if ("cut" === this.action && (e.hasAttribute("readonly") || e.hasAttribute("disabled"))) throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes'); this._target = e } }, get: function t() { return this._target } }]), t }(); t.exports = c }) }, { select: 5 }], 8: [function (e, n, o) { !function (i, r) { if ("function" == typeof t && t.amd) t(["module", "./clipboard-action", "tiny-emitter", "good-listener"], r); else if (void 0 !== o) r(n, e("./clipboard-action"), e("tiny-emitter"), e("good-listener")); else { var a = { exports: {} }; r(a, i.clipboardAction, i.tinyEmitter, i.goodListener), i.clipboard = a.exports } }(this, function (t, e, n, o) { "use strict"; function i(t) { return t && t.__esModule ? t : { default: t } } function r(t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") } function a(t, e) { if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !e || "object" != typeof e && "function" != typeof e ? t : e } function c(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, enumerable: !1, writable: !0, configurable: !0 } }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e) } function l(t, e) { var n = "data-clipboard-" + t; if (e.hasAttribute(n)) return e.getAttribute(n) } var s = i(e), u = i(n), f = i(o), d = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (t) { return typeof t } : function (t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t }, h = function () { function t(t, e) { for (var n = 0; n < e.length; n++) { var o = e[n]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(t, o.key, o) } } return function (e, n, o) { return n && t(e.prototype, n), o && t(e, o), e } }(), p = function (t) { function e(t, n) { r(this, e); var o = a(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this)); return o.resolveOptions(n), o.listenClick(t), o } return c(e, t), h(e, [{ key: "resolveOptions", value: function t() { var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; this.action = "function" == typeof e.action ? e.action : this.defaultAction, this.target = "function" == typeof e.target ? e.target : this.defaultTarget, this.text = "function" == typeof e.text ? e.text : this.defaultText, this.container = "object" === d(e.container) ? e.container : document.body } }, { key: "listenClick", value: function t(e) { var n = this; this.listener = (0, f.default)(e, "click", function (t) { return n.onClick(t) }) } }, { key: "onClick", value: function t(e) { var n = e.delegateTarget || e.currentTarget; this.clipboardAction && (this.clipboardAction = null), this.clipboardAction = new s.default({ action: this.action(n), target: this.target(n), text: this.text(n), container: this.container, trigger: n, emitter: this }) } }, { key: "defaultAction", value: function t(e) { return l("action", e) } }, { key: "defaultTarget", value: function t(e) { var n = l("target", e); if (n) return document.querySelector(n) } }, { key: "defaultText", value: function t(e) { return l("text", e) } }, { key: "destroy", value: function t() { this.listener.destroy(), this.clipboardAction && (this.clipboardAction.destroy(), this.clipboardAction = null) } }], [{ key: "isSupported", value: function t() { var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : ["copy", "cut"], n = "string" == typeof e ? [e] : e, o = !!document.queryCommandSupported; return n.forEach(function (t) { o = o && !!document.queryCommandSupported(t) }), o } }]), e }(u.default); t.exports = p }) }, { "./clipboard-action": 7, "good-listener": 4, "tiny-emitter": 6 }] }, {}, [8])(8) }); \ No newline at end of file diff --git a/cadline/backend/maintenance/js/download2.js b/cadline/backend/maintenance/js/download2.js deleted file mode 100644 index 2fdb8b96..00000000 --- a/cadline/backend/maintenance/js/download2.js +++ /dev/null @@ -1,132 +0,0 @@ -//download.js v3.0, by dandavis; 2008-2014. [CCBY2] see http://danml.com/download.html for tests/usage -// v1 landed a FF+Chrome compat way of downloading strings to local un-named files, upgraded to use a hidden frame and optional mime -// v2 added named files via a[download], msSaveBlob, IE (10+) support, and window.URL support for larger+faster saves than dataURLs -// v3 added dataURL and Blob Input, bind-toggle arity, and legacy dataURL fallback was improved with force-download mime and base64 support - -// data can be a string, Blob, File, or dataURL - - - - -function download(data, strFileName, strMimeType) { - - var self = window, // this script is only for browsers anyway... - u = "application/octet-stream", // this default mime also triggers iframe downloads - m = strMimeType || u, - x = data, - D = document, - a = D.createElement("a"), - z = function (a) { return String(a); }, - - - B = self.Blob || self.MozBlob || self.WebKitBlob || z, - BB = self.MSBlobBuilder || self.WebKitBlobBuilder || self.BlobBuilder, - fn = strFileName || "download", - blob, - b, - ua, - fr; - - //if(typeof B.bind === 'function' ){ B=B.bind(self); } - - if (String(this) === "true") { //reverse arguments, allowing download.bind(true, "text/xml", "export.xml") to act as a callback - x = [x, m]; - m = x[0]; - x = x[1]; - } - - - - //go ahead and download dataURLs right away - if (String(x).match(/^data\:[\w+\-]+\/[\w+\-]+[,;]/)) { - return navigator.msSaveBlob ? // IE10 can't do a[download], only Blobs: - navigator.msSaveBlob(d2b(x), fn) : - saver(x); // everyone else can save dataURLs un-processed - }//end if dataURL passed? - - try { - - blob = x instanceof B ? - x : - new B([x], { type: m }); - } catch (y) { - if (BB) { - b = new BB(); - b.append([x]); - blob = b.getBlob(m); // the blob - } - - } - - - - function d2b(u) { - var p = u.split(/[:;,]/), - t = p[1], - dec = p[2] == "base64" ? atob : decodeURIComponent, - bin = dec(p.pop()), - mx = bin.length, - i = 0, - uia = new Uint8Array(mx); - - for (i; i < mx; ++i) uia[i] = bin.charCodeAt(i); - - return new B([uia], { type: t }); - } - - function saver(url, winMode) { - - - if ('download' in a) { //html5 A[download] - a.href = url; - a.setAttribute("download", fn); - a.innerHTML = "downloading..."; - D.body.appendChild(a); - setTimeout(function () { - a.click(); - D.body.removeChild(a); - if (winMode === true) { setTimeout(function () { self.URL.revokeObjectURL(a.href); }, 250); } - }, 66); - return true; - } - - //do iframe dataURL download (old ch+FF): - var f = D.createElement("iframe"); - D.body.appendChild(f); - if (!winMode) { // force a mime that will download: - url = "data:" + url.replace(/^data:([\w\/\-\+]+)/, u); - } - - - f.src = url; - setTimeout(function () { D.body.removeChild(f); }, 333); - - }//end saver - - - if (navigator.msSaveBlob) { // IE10+ : (has Blob, but not a[download] or URL) - return navigator.msSaveBlob(blob, fn); - } - - if (self.URL) { // simple fast and modern way using Blob and URL: - saver(self.URL.createObjectURL(blob), true); - } else { - // handle non-Blob()+non-URL browsers: - if (typeof blob === "string" || blob.constructor === z) { - try { - return saver("data:" + m + ";base64," + self.btoa(blob)); - } catch (y) { - return saver("data:" + m + "," + encodeURIComponent(blob)); - } - } - - // Blob but not URL: - fr = new FileReader(); - fr.onload = function (e) { - saver(this.result); - }; - fr.readAsDataURL(blob); - } - return true; -} /* end download() */ - diff --git a/cadline/backend/maintenance/js/jquery.min.js b/cadline/backend/maintenance/js/jquery.min.js deleted file mode 100644 index 8a14f12e..00000000 --- a/cadline/backend/maintenance/js/jquery.min.js +++ /dev/null @@ -1,16 +0,0 @@ -/*! - * jQuery JavaScript Library v1.6 - * http://jquery.com/ - * - * Copyright 2011, John Resig - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * Includes Sizzle.js - * http://sizzlejs.com/ - * Copyright 2011, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * - * Date: Mon May 2 13:50:00 2011 -0400 - */ -(function (a, b) { function cw(a) { return f.isWindow(a) ? a : a.nodeType === 9 ? a.defaultView || a.parentWindow : !1 } function ct(a) { if (!ch[a]) { var b = f("<" + a + ">").appendTo("body"), d = b.css("display"); b.remove(); if (d === "none" || d === "") { ci || (ci = c.createElement("iframe"), ci.frameBorder = ci.width = ci.height = 0), c.body.appendChild(ci); if (!cj || !ci.createElement) cj = (ci.contentWindow || ci.contentDocument).document, cj.write(""); b = cj.createElement(a), cj.body.appendChild(b), d = f.css(b, "display"), c.body.removeChild(ci) } ch[a] = d } return ch[a] } function cs(a, b) { var c = {}; f.each(cn.concat.apply([], cn.slice(0, b)), function () { c[this] = a }); return c } function cr() { co = b } function cq() { setTimeout(cr, 0); return co = f.now() } function cg() { try { return new a.ActiveXObject("Microsoft.XMLHTTP") } catch (b) { } } function cf() { try { return new a.XMLHttpRequest } catch (b) { } } function b_(a, c) { a.dataFilter && (c = a.dataFilter(c, a.dataType)); var d = a.dataTypes, e = {}, g, h, i = d.length, j, k = d[0], l, m, n, o, p; for (g = 1; g < i; g++) { if (g === 1) for (h in a.converters) typeof h == "string" && (e[h.toLowerCase()] = a.converters[h]); l = k, k = d[g]; if (k === "*") k = l; else if (l !== "*" && l !== k) { m = l + " " + k, n = e[m] || e["* " + k]; if (!n) { p = b; for (o in e) { j = o.split(" "); if (j[0] === l || j[0] === "*") { p = e[j[1] + " " + k]; if (p) { o = e[o], o === !0 ? n = p : p === !0 && (n = o); break } } } } !n && !p && f.error("No conversion from " + m.replace(" ", " to ")), n !== !0 && (c = n ? n(c) : p(o(c))) } } return c } function b$(a, c, d) { var e = a.contents, f = a.dataTypes, g = a.responseFields, h, i, j, k; for (i in g) i in d && (c[g[i]] = d[i]); while (f[0] === "*") f.shift(), h === b && (h = a.mimeType || c.getResponseHeader("content-type")); if (h) for (i in e) if (e[i] && e[i].test(h)) { f.unshift(i); break } if (f[0] in d) j = f[0]; else { for (i in d) { if (!f[0] || a.converters[i + " " + f[0]]) { j = i; break } k || (k = i) } j = j || k } if (j) { j !== f[0] && f.unshift(j); return d[j] } } function bZ(a, b, c, d) { if (f.isArray(b)) f.each(b, function (b, e) { c || bD.test(a) ? d(a, e) : bZ(a + "[" + (typeof e == "object" || f.isArray(e) ? b : "") + "]", e, c, d) }); else if (!c && b != null && typeof b == "object") for (var e in b) bZ(a + "[" + e + "]", b[e], c, d); else d(a, b) } function bY(a, c, d, e, f, g) { f = f || c.dataTypes[0], g = g || {}, g[f] = !0; var h = a[f], i = 0, j = h ? h.length : 0, k = a === bS, l; for (; i < j && (k || !l); i++)l = h[i](c, d, e), typeof l == "string" && (!k || g[l] ? l = b : (c.dataTypes.unshift(l), l = bY(a, c, d, e, l, g))); (k || !l) && !g["*"] && (l = bY(a, c, d, e, "*", g)); return l } function bX(a) { return function (b, c) { typeof b != "string" && (c = b, b = "*"); if (f.isFunction(c)) { var d = b.toLowerCase().split(bO), e = 0, g = d.length, h, i, j; for (; e < g; e++)h = d[e], j = /^\+/.test(h), j && (h = h.substr(1) || "*"), i = a[h] = a[h] || [], i[j ? "unshift" : "push"](c) } } } function bB(a, b, c) { var d = b === "width" ? bv : bw, e = b === "width" ? a.offsetWidth : a.offsetHeight; if (c === "border") return e; f.each(d, function () { c || (e -= parseFloat(f.css(a, "padding" + this)) || 0), c === "margin" ? e += parseFloat(f.css(a, "margin" + this)) || 0 : e -= parseFloat(f.css(a, "border" + this + "Width")) || 0 }); return e } function bl(a, b) { b.src ? f.ajax({ url: b.src, async: !1, dataType: "script" }) : f.globalEval(b.text || b.textContent || b.innerHTML || ""), b.parentNode && b.parentNode.removeChild(b) } function bk(a) { f.nodeName(a, "input") ? bj(a) : a.getElementsByTagName && f.grep(a.getElementsByTagName("input"), bj) } function bj(a) { if (a.type === "checkbox" || a.type === "radio") a.defaultChecked = a.checked } function bi(a) { return "getElementsByTagName" in a ? a.getElementsByTagName("*") : "querySelectorAll" in a ? a.querySelectorAll("*") : [] } function bh(a, b) { var c; if (b.nodeType === 1) { b.clearAttributes && b.clearAttributes(), b.mergeAttributes && b.mergeAttributes(a), c = b.nodeName.toLowerCase(); if (c === "object") b.outerHTML = a.outerHTML; else if (c !== "input" || a.type !== "checkbox" && a.type !== "radio") { if (c === "option") b.selected = a.defaultSelected; else if (c === "input" || c === "textarea") b.defaultValue = a.defaultValue } else a.checked && (b.defaultChecked = b.checked = a.checked), b.value !== a.value && (b.value = a.value); b.removeAttribute(f.expando) } } function bg(a, b) { if (b.nodeType === 1 && !!f.hasData(a)) { var c = f.expando, d = f.data(a), e = f.data(b, d); if (d = d[c]) { var g = d.events; e = e[c] = f.extend({}, d); if (g) { delete e.handle, e.events = {}; for (var h in g) for (var i = 0, j = g[h].length; i < j; i++)f.event.add(b, h + (g[h][i].namespace ? "." : "") + g[h][i].namespace, g[h][i], g[h][i].data) } } } } function bf(a, b) { return f.nodeName(a, "table") ? a.getElementsByTagName("tbody")[0] || a.appendChild(a.ownerDocument.createElement("tbody")) : a } function W(a, b, c) { b = b || 0; if (f.isFunction(b)) return f.grep(a, function (a, d) { var e = !!b.call(a, d, a); return e === c }); if (b.nodeType) return f.grep(a, function (a, d) { return a === b === c }); if (typeof b == "string") { var d = f.grep(a, function (a) { return a.nodeType === 1 }); if (R.test(b)) return f.filter(b, d, !c); b = f.filter(b, d) } return f.grep(a, function (a, d) { return f.inArray(a, b) >= 0 === c }) } function V(a) { return !a || !a.parentNode || a.parentNode.nodeType === 11 } function N(a, b) { return (a && a !== "*" ? a + "." : "") + b.replace(z, "`").replace(A, "&") } function M(a) { var b, c, d, e, g, h, i, j, k, l, m, n, o, p = [], q = [], r = f._data(this, "events"); if (!(a.liveFired === this || !r || !r.live || a.target.disabled || a.button && a.type === "click")) { a.namespace && (n = new RegExp("(^|\\.)" + a.namespace.split(".").join("\\.(?:.*\\.)?") + "(\\.|$)")), a.liveFired = this; var s = r.live.slice(0); for (i = 0; i < s.length; i++)g = s[i], g.origType.replace(x, "") === a.type ? q.push(g.selector) : s.splice(i--, 1); e = f(a.target).closest(q, a.currentTarget); for (j = 0, k = e.length; j < k; j++) { m = e[j]; for (i = 0; i < s.length; i++) { g = s[i]; if (m.selector === g.selector && (!n || n.test(g.namespace)) && !m.elem.disabled) { h = m.elem, d = null; if (g.preType === "mouseenter" || g.preType === "mouseleave") a.type = g.preType, d = f(a.relatedTarget).closest(g.selector)[0], d && f.contains(h, d) && (d = h); (!d || d !== h) && p.push({ elem: h, handleObj: g, level: m.level }) } } } for (j = 0, k = p.length; j < k; j++) { e = p[j]; if (c && e.level > c) break; a.currentTarget = e.elem, a.data = e.handleObj.data, a.handleObj = e.handleObj, o = e.handleObj.origHandler.apply(e.elem, arguments); if (o === !1 || a.isPropagationStopped()) { c = e.level, o === !1 && (b = !1); if (a.isImmediatePropagationStopped()) break } } return b } } function K(a, c, d) { var e = f.extend({}, d[0]); e.type = a, e.originalEvent = {}, e.liveFired = b, f.event.handle.call(c, e), e.isDefaultPrevented() && d[0].preventDefault() } function E() { return !0 } function D() { return !1 } function m(a, c, d) { var e = c + "defer", g = c + "queue", h = c + "mark", i = f.data(a, e, b, !0); i && (d === "queue" || !f.data(a, g, b, !0)) && (d === "mark" || !f.data(a, h, b, !0)) && setTimeout(function () { !f.data(a, g, b, !0) && !f.data(a, h, b, !0) && (f.removeData(a, e, !0), i.resolve()) }, 0) } function l(a) { for (var b in a) if (b !== "toJSON") return !1; return !0 } function k(a, c, d) { if (d === b && a.nodeType === 1) { name = "data-" + c.replace(j, "$1-$2").toLowerCase(), d = a.getAttribute(name); if (typeof d == "string") { try { d = d === "true" ? !0 : d === "false" ? !1 : d === "null" ? null : f.isNaN(d) ? i.test(d) ? f.parseJSON(d) : d : parseFloat(d) } catch (e) { } f.data(a, c, d) } else d = b } return d } var c = a.document, d = a.navigator, e = a.location, f = function () { function H() { if (!e.isReady) { try { c.documentElement.doScroll("left") } catch (a) { setTimeout(H, 1); return } e.ready() } } var e = function (a, b) { return new e.fn.init(a, b, h) }, f = a.jQuery, g = a.$, h, i = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/, j = /\S/, k = /^\s+/, l = /\s+$/, m = /\d/, n = /^<(\w+)\s*\/?>(?:<\/\1>)?$/, o = /^[\],:{}\s]*$/, p = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, q = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, r = /(?:^|:|,)(?:\s*\[)+/g, s = /(webkit)[ \/]([\w.]+)/, t = /(opera)(?:.*version)?[ \/]([\w.]+)/, u = /(msie) ([\w.]+)/, v = /(mozilla)(?:.*? rv:([\w.]+))?/, w = d.userAgent, x, y, z, A = Object.prototype.toString, B = Object.prototype.hasOwnProperty, C = Array.prototype.push, D = Array.prototype.slice, E = String.prototype.trim, F = Array.prototype.indexOf, G = {}; e.fn = e.prototype = { constructor: e, init: function (a, d, f) { var g, h, j, k; if (!a) return this; if (a.nodeType) { this.context = this[0] = a, this.length = 1; return this } if (a === "body" && !d && c.body) { this.context = c, this[0] = c.body, this.selector = a, this.length = 1; return this } if (typeof a == "string") { a.charAt(0) === "<" && a.charAt(a.length - 1) === ">" && a.length >= 3 ? g = [null, a, null] : g = i.exec(a); if (g && (g[1] || !d)) { if (g[1]) { d = d instanceof e ? d[0] : d, k = d ? d.ownerDocument || d : c, j = n.exec(a), j ? e.isPlainObject(d) ? (a = [c.createElement(j[1])], e.fn.attr.call(a, d, !0)) : a = [k.createElement(j[1])] : (j = e.buildFragment([g[1]], [k]), a = (j.cacheable ? e.clone(j.fragment) : j.fragment).childNodes); return e.merge(this, a) } h = c.getElementById(g[2]); if (h && h.parentNode) { if (h.id !== g[2]) return f.find(a); this.length = 1, this[0] = h } this.context = c, this.selector = a; return this } return !d || d.jquery ? (d || f).find(a) : this.constructor(d).find(a) } if (e.isFunction(a)) return f.ready(a); a.selector !== b && (this.selector = a.selector, this.context = a.context); return e.makeArray(a, this) }, selector: "", jquery: "1.6", length: 0, size: function () { return this.length }, toArray: function () { return D.call(this, 0) }, get: function (a) { return a == null ? this.toArray() : a < 0 ? this[this.length + a] : this[a] }, pushStack: function (a, b, c) { var d = this.constructor(); e.isArray(a) ? C.apply(d, a) : e.merge(d, a), d.prevObject = this, d.context = this.context, b === "find" ? d.selector = this.selector + (this.selector ? " " : "") + c : b && (d.selector = this.selector + "." + b + "(" + c + ")"); return d }, each: function (a, b) { return e.each(this, a, b) }, ready: function (a) { e.bindReady(), y.done(a); return this }, eq: function (a) { return a === -1 ? this.slice(a) : this.slice(a, +a + 1) }, first: function () { return this.eq(0) }, last: function () { return this.eq(-1) }, slice: function () { return this.pushStack(D.apply(this, arguments), "slice", D.call(arguments).join(",")) }, map: function (a) { return this.pushStack(e.map(this, function (b, c) { return a.call(b, c, b) })) }, end: function () { return this.prevObject || this.constructor(null) }, push: C, sort: [].sort, splice: [].splice }, e.fn.init.prototype = e.fn, e.extend = e.fn.extend = function () { var a, c, d, f, g, h, i = arguments[0] || {}, j = 1, k = arguments.length, l = !1; typeof i == "boolean" && (l = i, i = arguments[1] || {}, j = 2), typeof i != "object" && !e.isFunction(i) && (i = {}), k === j && (i = this, --j); for (; j < k; j++)if ((a = arguments[j]) != null) for (c in a) { d = i[c], f = a[c]; if (i === f) continue; l && f && (e.isPlainObject(f) || (g = e.isArray(f))) ? (g ? (g = !1, h = d && e.isArray(d) ? d : []) : h = d && e.isPlainObject(d) ? d : {}, i[c] = e.extend(l, h, f)) : f !== b && (i[c] = f) } return i }, e.extend({ noConflict: function (b) { a.$ === e && (a.$ = g), b && a.jQuery === e && (a.jQuery = f); return e }, isReady: !1, readyWait: 1, holdReady: function (a) { a ? e.readyWait++ : e.ready(!0) }, ready: function (a) { if (a === !0 && !--e.readyWait || a !== !0 && !e.isReady) { if (!c.body) return setTimeout(e.ready, 1); e.isReady = !0; if (a !== !0 && --e.readyWait > 0) return; y.resolveWith(c, [e]), e.fn.trigger && e(c).trigger("ready").unbind("ready") } }, bindReady: function () { if (!y) { y = e._Deferred(); if (c.readyState === "complete") return setTimeout(e.ready, 1); if (c.addEventListener) c.addEventListener("DOMContentLoaded", z, !1), a.addEventListener("load", e.ready, !1); else if (c.attachEvent) { c.attachEvent("onreadystatechange", z), a.attachEvent("onload", e.ready); var b = !1; try { b = a.frameElement == null } catch (d) { } c.documentElement.doScroll && b && H() } } }, isFunction: function (a) { return e.type(a) === "function" }, isArray: Array.isArray || function (a) { return e.type(a) === "array" }, isWindow: function (a) { return a && typeof a == "object" && "setInterval" in a }, isNaN: function (a) { return a == null || !m.test(a) || isNaN(a) }, type: function (a) { return a == null ? String(a) : G[A.call(a)] || "object" }, isPlainObject: function (a) { if (!a || e.type(a) !== "object" || a.nodeType || e.isWindow(a)) return !1; if (a.constructor && !B.call(a, "constructor") && !B.call(a.constructor.prototype, "isPrototypeOf")) return !1; var c; for (c in a); return c === b || B.call(a, c) }, isEmptyObject: function (a) { for (var b in a) return !1; return !0 }, error: function (a) { throw a }, parseJSON: function (b) { if (typeof b != "string" || !b) return null; b = e.trim(b); if (a.JSON && a.JSON.parse) return a.JSON.parse(b); if (o.test(b.replace(p, "@").replace(q, "]").replace(r, ""))) return (new Function("return " + b))(); e.error("Invalid JSON: " + b) }, parseXML: function (b, c, d) { a.DOMParser ? (d = new DOMParser, c = d.parseFromString(b, "text/xml")) : (c = new ActiveXObject("Microsoft.XMLDOM"), c.async = "false", c.loadXML(b)), d = c.documentElement, (!d || !d.nodeName || d.nodeName === "parsererror") && e.error("Invalid XML: " + b); return c }, noop: function () { }, globalEval: function (b) { b && j.test(b) && (a.execScript || function (b) { a.eval.call(a, b) })(b) }, nodeName: function (a, b) { return a.nodeName && a.nodeName.toUpperCase() === b.toUpperCase() }, each: function (a, c, d) { var f, g = 0, h = a.length, i = h === b || e.isFunction(a); if (d) { if (i) { for (f in a) if (c.apply(a[f], d) === !1) break } else for (; g < h;)if (c.apply(a[g++], d) === !1) break } else if (i) { for (f in a) if (c.call(a[f], f, a[f]) === !1) break } else for (; g < h;)if (c.call(a[g], g, a[g++]) === !1) break; return a }, trim: E ? function (a) { return a == null ? "" : E.call(a) } : function (a) { return a == null ? "" : (a + "").replace(k, "").replace(l, "") }, makeArray: function (a, b) { var c = b || []; if (a != null) { var d = e.type(a); a.length == null || d === "string" || d === "function" || d === "regexp" || e.isWindow(a) ? C.call(c, a) : e.merge(c, a) } return c }, inArray: function (a, b) { if (F) return F.call(b, a); for (var c = 0, d = b.length; c < d; c++)if (b[c] === a) return c; return -1 }, merge: function (a, c) { var d = a.length, e = 0; if (typeof c.length == "number") for (var f = c.length; e < f; e++)a[d++] = c[e]; else while (c[e] !== b) a[d++] = c[e++]; a.length = d; return a }, grep: function (a, b, c) { var d = [], e; c = !!c; for (var f = 0, g = a.length; f < g; f++)e = !!b(a[f], f), c !== e && d.push(a[f]); return d }, map: function (a, c, d) { var f, g, h = [], i = 0, j = a.length, k = a instanceof e || j !== b && typeof j == "number" && (j > 0 && a[0] && a[j - 1] || j === 0 || e.isArray(a)); if (k) for (; i < j; i++)f = c(a[i], i, d), f != null && (h[h.length] = f); else for (g in a) f = c(a[g], g, d), f != null && (h[h.length] = f); return h.concat.apply([], h) }, guid: 1, proxy: function (a, c) { if (typeof c == "string") { var d = a[c]; c = a, a = d } if (!e.isFunction(a)) return b; var f = D.call(arguments, 2), g = function () { return a.apply(c, f.concat(D.call(arguments))) }; g.guid = a.guid = a.guid || g.guid || e.guid++; return g }, access: function (a, c, d, f, g, h) { var i = a.length; if (typeof c == "object") { for (var j in c) e.access(a, j, c[j], f, g, d); return a } if (d !== b) { f = !h && f && e.isFunction(d); for (var k = 0; k < i; k++)g(a[k], c, f ? d.call(a[k], k, g(a[k], c)) : d, h); return a } return i ? g(a[0], c) : b }, now: function () { return (new Date).getTime() }, uaMatch: function (a) { a = a.toLowerCase(); var b = s.exec(a) || t.exec(a) || u.exec(a) || a.indexOf("compatible") < 0 && v.exec(a) || []; return { browser: b[1] || "", version: b[2] || "0" } }, sub: function () { function a(b, c) { return new a.fn.init(b, c) } e.extend(!0, a, this), a.superclass = this, a.fn = a.prototype = this(), a.fn.constructor = a, a.sub = this.sub, a.fn.init = function (c, d) { d && d instanceof e && !(d instanceof a) && (d = a(d)); return e.fn.init.call(this, c, d, b) }, a.fn.init.prototype = a.fn; var b = a(c); return a }, browser: {} }), e.each("Boolean Number String Function Array Date RegExp Object".split(" "), function (a, b) { G["[object " + b + "]"] = b.toLowerCase() }), x = e.uaMatch(w), x.browser && (e.browser[x.browser] = !0, e.browser.version = x.version), e.browser.webkit && (e.browser.safari = !0), j.test(" ") && (k = /^[\s\xA0]+/, l = /[\s\xA0]+$/), h = e(c), c.addEventListener ? z = function () { c.removeEventListener("DOMContentLoaded", z, !1), e.ready() } : c.attachEvent && (z = function () { c.readyState === "complete" && (c.detachEvent("onreadystatechange", z), e.ready()) }); return e }(), g = "done fail isResolved isRejected promise then always pipe".split(" "), h = [].slice; f.extend({ _Deferred: function () { var a = [], b, c, d, e = { done: function () { if (!d) { var c = arguments, g, h, i, j, k; b && (k = b, b = 0); for (g = 0, h = c.length; g < h; g++)i = c[g], j = f.type(i), j === "array" ? e.done.apply(e, i) : j === "function" && a.push(i); k && e.resolveWith(k[0], k[1]) } return this }, resolveWith: function (e, f) { if (!d && !b && !c) { f = f || [], c = 1; try { while (a[0]) a.shift().apply(e, f) } finally { b = [e, f], c = 0 } } return this }, resolve: function () { e.resolveWith(this, arguments); return this }, isResolved: function () { return !!c || !!b }, cancel: function () { d = 1, a = []; return this } }; return e }, Deferred: function (a) { var b = f._Deferred(), c = f._Deferred(), d; f.extend(b, { then: function (a, c) { b.done(a).fail(c); return this }, always: function () { return b.done.apply(b, arguments).fail.apply(this, arguments) }, fail: c.done, rejectWith: c.resolveWith, reject: c.resolve, isRejected: c.isResolved, pipe: function (a, c) { return f.Deferred(function (d) { f.each({ done: [a, "resolve"], fail: [c, "reject"] }, function (a, c) { var e = c[0], g = c[1], h; f.isFunction(e) ? b[a](function () { h = e.apply(this, arguments), f.isFunction(h.promise) ? h.promise().then(d.resolve, d.reject) : d[g](h) }) : b[a](d[g]) }) }).promise() }, promise: function (a) { if (a == null) { if (d) return d; d = a = {} } var c = g.length; while (c--) a[g[c]] = b[g[c]]; return a } }), b.done(c.cancel).fail(b.cancel), delete b.cancel, a && a.call(b, b); return b }, when: function (a) { function i(a) { return function (c) { b[a] = arguments.length > 1 ? h.call(arguments, 0) : c, --e || g.resolveWith(g, h.call(b, 0)) } } var b = arguments, c = 0, d = b.length, e = d, g = d <= 1 && a && f.isFunction(a.promise) ? a : f.Deferred(); if (d > 1) { for (; c < d; c++)b[c] && f.isFunction(b[c].promise) ? b[c].promise().then(i(c), g.reject) : --e; e || g.resolveWith(g, b) } else g !== a && g.resolveWith(g, d ? [a] : []); return g.promise() } }), f.support = function () { var a = c.createElement("div"), b, d, e, f, g, h, i, j, k, l, m, n, o, p, q; a.setAttribute("className", "t"), a.innerHTML = "
    a", b = a.getElementsByTagName("*"), d = a.getElementsByTagName("a")[0]; if (!b || !b.length || !d) return {}; e = c.createElement("select"), f = e.appendChild(c.createElement("option")), g = a.getElementsByTagName("input")[0], i = { leadingWhitespace: a.firstChild.nodeType === 3, tbody: !a.getElementsByTagName("tbody").length, htmlSerialize: !!a.getElementsByTagName("link").length, style: /top/.test(d.getAttribute("style")), hrefNormalized: d.getAttribute("href") === "/a", opacity: /^0.55$/.test(d.style.opacity), cssFloat: !!d.style.cssFloat, checkOn: g.value === "on", optSelected: f.selected, getSetAttribute: a.className !== "t", submitBubbles: !0, changeBubbles: !0, focusinBubbles: !1, deleteExpando: !0, noCloneEvent: !0, inlineBlockNeedsLayout: !1, shrinkWrapBlocks: !1, reliableMarginRight: !0 }, g.checked = !0, i.noCloneChecked = g.cloneNode(!0).checked, e.disabled = !0, i.optDisabled = !f.disabled; try { delete a.test } catch (r) { i.deleteExpando = !1 } !a.addEventListener && a.attachEvent && a.fireEvent && (a.attachEvent("onclick", function click() { i.noCloneEvent = !1, a.detachEvent("onclick", click) }), a.cloneNode(!0).fireEvent("onclick")), g = c.createElement("input"), g.value = "t", g.setAttribute("type", "radio"), i.radioValue = g.value === "t", g.setAttribute("checked", "checked"), a.appendChild(g), j = c.createDocumentFragment(), j.appendChild(a.firstChild), i.checkClone = j.cloneNode(!0).cloneNode(!0).lastChild.checked, a.innerHTML = "", a.style.width = a.style.paddingLeft = "1px", k = c.createElement("body"), l = { visibility: "hidden", width: 0, height: 0, border: 0, margin: 0, background: "none" }; for (p in l) k.style[p] = l[p]; k.appendChild(a), c.documentElement.appendChild(k), i.appendChecked = g.checked, i.boxModel = a.offsetWidth === 2, "zoom" in a.style && (a.style.display = "inline", a.style.zoom = 1, i.inlineBlockNeedsLayout = a.offsetWidth === 2, a.style.display = "", a.innerHTML = "
    ", i.shrinkWrapBlocks = a.offsetWidth !== 2), a.innerHTML = "
    t
    ", m = a.getElementsByTagName("td"), q = m[0].offsetHeight === 0, m[0].style.display = "", m[1].style.display = "none", i.reliableHiddenOffsets = q && m[0].offsetHeight === 0, a.innerHTML = "", c.defaultView && c.defaultView.getComputedStyle && (h = c.createElement("div"), h.style.width = "0", h.style.marginRight = "0", a.appendChild(h), i.reliableMarginRight = (parseInt(c.defaultView.getComputedStyle(h, null).marginRight, 10) || 0) === 0), k.innerHTML = "", c.documentElement.removeChild(k); if (a.attachEvent) for (p in { submit: 1, change: 1, focusin: 1 }) o = "on" + p, q = o in a, q || (a.setAttribute(o, "return;"), q = typeof a[o] == "function"), i[p + "Bubbles"] = q; return i }(), f.boxModel = f.support.boxModel; var i = /^(?:\{.*\}|\[.*\])$/, j = /([a-z])([A-Z])/g; f.extend({ cache: {}, uuid: 0, expando: "jQuery" + (f.fn.jquery + Math.random()).replace(/\D/g, ""), noData: { embed: !0, object: "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", applet: !0 }, hasData: function (a) { a = a.nodeType ? f.cache[a[f.expando]] : a[f.expando]; return !!a && !l(a) }, data: function (a, c, d, e) { if (!!f.acceptData(a)) { var g = f.expando, h = typeof c == "string", i, j = a.nodeType, k = j ? f.cache : a, l = j ? a[f.expando] : a[f.expando] && f.expando; if ((!l || e && l && !k[l][g]) && h && d === b) return; l || (j ? a[f.expando] = l = ++f.uuid : l = f.expando), k[l] || (k[l] = {}, j || (k[l].toJSON = f.noop)); if (typeof c == "object" || typeof c == "function") e ? k[l][g] = f.extend(k[l][g], c) : k[l] = f.extend(k[l], c); i = k[l], e && (i[g] || (i[g] = {}), i = i[g]), d !== b && (i[c] = d); if (c === "events" && !i[c]) return i[g] && i[g].events; return h ? i[c] : i } }, removeData: function (b, c, d) { if (!!f.acceptData(b)) { var e = f.expando, g = b.nodeType, h = g ? f.cache : b, i = g ? b[f.expando] : f.expando; if (!h[i]) return; if (c) { var j = d ? h[i][e] : h[i]; if (j) { delete j[c]; if (!l(j)) return } } if (d) { delete h[i][e]; if (!l(h[i])) return } var k = h[i][e]; f.support.deleteExpando || h != a ? delete h[i] : h[i] = null, k ? (h[i] = {}, g || (h[i].toJSON = f.noop), h[i][e] = k) : g && (f.support.deleteExpando ? delete b[f.expando] : b.removeAttribute ? b.removeAttribute(f.expando) : b[f.expando] = null) } }, _data: function (a, b, c) { return f.data(a, b, c, !0) }, acceptData: function (a) { if (a.nodeName) { var b = f.noData[a.nodeName.toLowerCase()]; if (b) return b !== !0 && a.getAttribute("classid") === b } return !0 } }), f.fn.extend({ data: function (a, c) { var d = null; if (typeof a == "undefined") { if (this.length) { d = f.data(this[0]); if (this[0].nodeType === 1) { var e = this[0].attributes, g; for (var h = 0, i = e.length; h < i; h++)g = e[h].name, g.indexOf("data-") === 0 && (g = f.camelCase(g.substring(5)), k(this[0], g, d[g])) } } return d } if (typeof a == "object") return this.each(function () { f.data(this, a) }); var j = a.split("."); j[1] = j[1] ? "." + j[1] : ""; if (c === b) { d = this.triggerHandler("getData" + j[1] + "!", [j[0]]), d === b && this.length && (d = f.data(this[0], a), d = k(this[0], a, d)); return d === b && j[1] ? this.data(j[0]) : d } return this.each(function () { var b = f(this), d = [j[0], c]; b.triggerHandler("setData" + j[1] + "!", d), f.data(this, a, c), b.triggerHandler("changeData" + j[1] + "!", d) }) }, removeData: function (a) { return this.each(function () { f.removeData(this, a) }) } }), f.extend({ _mark: function (a, c) { a && (c = (c || "fx") + "mark", f.data(a, c, (f.data(a, c, b, !0) || 0) + 1, !0)) }, _unmark: function (a, c, d) { a !== !0 && (d = c, c = a, a = !1); if (c) { d = d || "fx"; var e = d + "mark", g = a ? 0 : (f.data(c, e, b, !0) || 1) - 1; g ? f.data(c, e, g, !0) : (f.removeData(c, e, !0), m(c, d, "mark")) } }, queue: function (a, c, d) { if (a) { c = (c || "fx") + "queue"; var e = f.data(a, c, b, !0); d && (!e || f.isArray(d) ? e = f.data(a, c, f.makeArray(d), !0) : e.push(d)); return e || [] } }, dequeue: function (a, b) { b = b || "fx"; var c = f.queue(a, b), d = c.shift(), e; d === "inprogress" && (d = c.shift()), d && (b === "fx" && c.unshift("inprogress"), d.call(a, function () { f.dequeue(a, b) })), c.length || (f.removeData(a, b + "queue", !0), m(a, b, "queue")) } }), f.fn.extend({ queue: function (a, c) { typeof a != "string" && (c = a, a = "fx"); if (c === b) return f.queue(this[0], a); return this.each(function () { var b = f.queue(this, a, c); a === "fx" && b[0] !== "inprogress" && f.dequeue(this, a) }) }, dequeue: function (a) { return this.each(function () { f.dequeue(this, a) }) }, delay: function (a, b) { a = f.fx ? f.fx.speeds[a] || a : a, b = b || "fx"; return this.queue(b, function () { var c = this; setTimeout(function () { f.dequeue(c, b) }, a) }) }, clearQueue: function (a) { return this.queue(a || "fx", []) }, promise: function (a, c) { function l() { --h || d.resolveWith(e, [e]) } typeof a != "string" && (c = a, a = b), a = a || "fx"; var d = f.Deferred(), e = this, g = e.length, h = 1, i = a + "defer", j = a + "queue", k = a + "mark"; while (g--) if (tmp = f.data(e[g], i, b, !0) || (f.data(e[g], j, b, !0) || f.data(e[g], k, b, !0)) && f.data(e[g], i, f._Deferred(), !0)) h++, tmp.done(l); l(); return d.promise() } }); var n = /[\n\t\r]/g, o = /\s+/, p = /\r/g, q = /^(?:button|input)$/i, r = /^(?:button|input|object|select|textarea)$/i, s = /^a(?:rea)?$/i, t = /^(?:data-|aria-)/, u = /\:/, v; f.fn.extend({ attr: function (a, b) { return f.access(this, a, b, !0, f.attr) }, removeAttr: function (a) { return this.each(function () { f.removeAttr(this, a) }) }, prop: function (a, b) { return f.access(this, a, b, !0, f.prop) }, removeProp: function (a) { return this.each(function () { try { this[a] = b, delete this[a] } catch (c) { } }) }, addClass: function (a) { if (f.isFunction(a)) return this.each(function (b) { var c = f(this); c.addClass(a.call(this, b, c.attr("class") || "")) }); if (a && typeof a == "string") { var b = (a || "").split(o); for (var c = 0, d = this.length; c < d; c++) { var e = this[c]; if (e.nodeType === 1) if (!e.className) e.className = a; else { var g = " " + e.className + " ", h = e.className; for (var i = 0, j = b.length; i < j; i++)g.indexOf(" " + b[i] + " ") < 0 && (h += " " + b[i]); e.className = f.trim(h) } } } return this }, removeClass: function (a) { if (f.isFunction(a)) return this.each(function (b) { var c = f(this); c.removeClass(a.call(this, b, c.attr("class"))) }); if (a && typeof a == "string" || a === b) { var c = (a || "").split(o); for (var d = 0, e = this.length; d < e; d++) { var g = this[d]; if (g.nodeType === 1 && g.className) if (a) { var h = (" " + g.className + " ").replace(n, " "); for (var i = 0, j = c.length; i < j; i++)h = h.replace(" " + c[i] + " ", " "); g.className = f.trim(h) } else g.className = "" } } return this }, toggleClass: function (a, b) { var c = typeof a, d = typeof b == "boolean"; if (f.isFunction(a)) return this.each(function (c) { var d = f(this); d.toggleClass(a.call(this, c, d.attr("class"), b), b) }); return this.each(function () { if (c === "string") { var e, g = 0, h = f(this), i = b, j = a.split(o); while (e = j[g++]) i = d ? i : !h.hasClass(e), h[i ? "addClass" : "removeClass"](e) } else if (c === "undefined" || c === "boolean") this.className && f._data(this, "__className__", this.className), this.className = this.className || a === !1 ? "" : f._data(this, "__className__") || "" }) }, hasClass: function (a) { var b = " " + a + " "; for (var c = 0, d = this.length; c < d; c++)if ((" " + this[c].className + " ").replace(n, " ").indexOf(b) > -1) return !0; return !1 }, val: function (a) { var c, d, e = this[0]; if (!arguments.length) { if (e) { c = f.valHooks[e.nodeName.toLowerCase()] || f.valHooks[e.type]; if (c && "get" in c && (d = c.get(e, "value")) !== b) return d; return (e.value || "").replace(p, "") } return b } var g = f.isFunction(a); return this.each(function (d) { var e = f(this), h; if (this.nodeType === 1) { g ? h = a.call(this, d, e.val()) : h = a, h == null ? h = "" : typeof h == "number" ? h += "" : f.isArray(h) && (h = f.map(h, function (a) { return a == null ? "" : a + "" })), c = f.valHooks[this.nodeName.toLowerCase()] || f.valHooks[this.type]; if (!c || "set" in c && c.set(this, h, "value") === b) this.value = h } }) } }), f.extend({ valHooks: { option: { get: function (a) { var b = a.attributes.value; return !b || b.specified ? a.value : a.text } }, select: { get: function (a) { var b = a.selectedIndex, c = [], d = a.options, e = a.type === "select-one"; if (b < 0) return null; for (var g = e ? b : 0, h = e ? b + 1 : d.length; g < h; g++) { var i = d[g]; if (i.selected && (f.support.optDisabled ? !i.disabled : i.getAttribute("disabled") === null) && (!i.parentNode.disabled || !f.nodeName(i.parentNode, "optgroup"))) { value = f(i).val(); if (e) return value; c.push(value) } } if (e && !c.length && d.length) return f(d[b]).val(); return c }, set: function (a, b) { var c = f.makeArray(b); f(a).find("option").each(function () { this.selected = f.inArray(f(this).val(), c) >= 0 }), c.length || (a.selectedIndex = -1); return c } } }, attrFn: { val: !0, css: !0, html: !0, text: !0, data: !0, width: !0, height: !0, offset: !0 }, attrFix: { tabindex: "tabIndex", readonly: "readOnly" }, attr: function (a, c, d, e) { var g = a.nodeType; if (!a || g === 3 || g === 8 || g === 2) return b; if (e && c in f.attrFn) return f(a)[c](d); var h, i, j = g !== 1 || !f.isXMLDoc(a); c = j && f.attrFix[c] || c, i = f.attrHooks[c] || (v && (f.nodeName(a, "form") || u.test(c)) ? v : b); if (d !== b) { if (d === null || d === !1 && !t.test(c)) { f.removeAttr(a, c); return b } if (i && "set" in i && j && (h = i.set(a, d, c)) !== b) return h; d === !0 && !t.test(c) && (d = c), a.setAttribute(c, "" + d); return d } if (i && "get" in i && j) return i.get(a, c); h = a.getAttribute(c); return h === null ? b : h }, removeAttr: function (a, b) { a.nodeType === 1 && (b = f.attrFix[b] || b, f.support.getSetAttribute ? a.removeAttribute(b) : (f.attr(a, b, ""), a.removeAttributeNode(a.getAttributeNode(b)))) }, attrHooks: { type: { set: function (a, b) { if (q.test(a.nodeName) && a.parentNode) f.error("type property can't be changed"); else if (!f.support.radioValue && b === "radio" && f.nodeName(a, "input")) { var c = a.getAttribute("value"); a.setAttribute("type", b), c && (a.value = c); return b } } }, tabIndex: { get: function (a) { var c = a.getAttributeNode("tabIndex"); return c && c.specified ? parseInt(c.value, 10) : r.test(a.nodeName) || s.test(a.nodeName) && a.href ? 0 : b } } }, propFix: {}, prop: function (a, c, d) { var e = a.nodeType; if (!a || e === 3 || e === 8 || e === 2) return b; var g, h, i = e !== 1 || !f.isXMLDoc(a); c = i && f.propFix[c] || c, h = f.propHooks[c]; return d !== b ? h && "set" in h && (g = h.set(a, d, c)) !== b ? g : a[c] = d : h && "get" in h && (g = h.get(a, c)) !== b ? g : a[c] }, propHooks: {} }), f.support.getSetAttribute || (f.attrFix = f.extend(f.attrFix, { "for": "htmlFor", "class": "className", maxlength: "maxLength", cellspacing: "cellSpacing", cellpadding: "cellPadding", rowspan: "rowSpan", colspan: "colSpan", usemap: "useMap", frameborder: "frameBorder" }), v = f.attrHooks.name = f.attrHooks.value = f.valHooks.button = { get: function (a, c) { var d; if (c === "value" && !f.nodeName(a, "button")) return a.getAttribute(c); d = a.getAttributeNode(c); return d && d.specified ? d.nodeValue : b }, set: function (a, b, c) { var d = a.getAttributeNode(c); if (d) { d.nodeValue = b; return b } } }, f.each(["width", "height"], function (a, b) { f.attrHooks[b] = f.extend(f.attrHooks[b], { set: function (a, c) { if (c === "") { a.setAttribute(b, "auto"); return c } } }) })), f.support.hrefNormalized || f.each(["href", "src", "width", "height"], function (a, c) { f.attrHooks[c] = f.extend(f.attrHooks[c], { get: function (a) { var d = a.getAttribute(c, 2); return d === null ? b : d } }) }), f.support.style || (f.attrHooks.style = { get: function (a) { return a.style.cssText.toLowerCase() || b }, set: function (a, b) { return a.style.cssText = "" + b } }), f.support.optSelected || (f.propHooks.selected = f.extend(f.propHooks.selected, { get: function (a) { var b = a.parentNode; b && (b.selectedIndex, b.parentNode && b.parentNode.selectedIndex) } })), f.support.checkOn || f.each(["radio", "checkbox"], function () { f.valHooks[this] = { get: function (a) { return a.getAttribute("value") === null ? "on" : a.value } } }), f.each(["radio", "checkbox"], function () { f.valHooks[this] = f.extend(f.valHooks[this], { set: function (a, b) { if (f.isArray(b)) return a.checked = f.inArray(f(a).val(), b) >= 0 } }) }); var w = Object.prototype.hasOwnProperty, x = /\.(.*)$/, y = /^(?:textarea|input|select)$/i, z = /\./g, A = / /g, B = /[^\w\s.|`]/g, C = function (a) { return a.replace(B, "\\$&") }; f.event = { add: function (a, c, d, e) { if (a.nodeType !== 3 && a.nodeType !== 8) { if (d === !1) d = D; else if (!d) return; var g, h; d.handler && (g = d, d = g.handler), d.guid || (d.guid = f.guid++); var i = f._data(a); if (!i) return; var j = i.events, k = i.handle; j || (i.events = j = {}), k || (i.handle = k = function (a) { return typeof f != "undefined" && (!a || f.event.triggered !== a.type) ? f.event.handle.apply(k.elem, arguments) : b }), k.elem = a, c = c.split(" "); var l, m = 0, n; while (l = c[m++]) { h = g ? f.extend({}, g) : { handler: d, data: e }, l.indexOf(".") > -1 ? (n = l.split("."), l = n.shift(), h.namespace = n.slice(0).sort().join(".")) : (n = [], h.namespace = ""), h.type = l, h.guid || (h.guid = d.guid); var o = j[l], p = f.event.special[l] || {}; if (!o) { o = j[l] = []; if (!p.setup || p.setup.call(a, e, n, k) === !1) a.addEventListener ? a.addEventListener(l, k, !1) : a.attachEvent && a.attachEvent("on" + l, k) } p.add && (p.add.call(a, h), h.handler.guid || (h.handler.guid = d.guid)), o.push(h), f.event.global[l] = !0 } a = null } }, global: {}, remove: function (a, c, d, e) { if (a.nodeType !== 3 && a.nodeType !== 8) { d === !1 && (d = D); var g, h, i, j, k = 0, l, m, n, o, p, q, r, s = f.hasData(a) && f._data(a), t = s && s.events; if (!s || !t) return; c && c.type && (d = c.handler, c = c.type); if (!c || typeof c == "string" && c.charAt(0) === ".") { c = c || ""; for (h in t) f.event.remove(a, h + c); return } c = c.split(" "); while (h = c[k++]) { r = h, q = null, l = h.indexOf(".") < 0, m = [], l || (m = h.split("."), h = m.shift(), n = new RegExp("(^|\\.)" + f.map(m.slice(0).sort(), C).join("\\.(?:.*\\.)?") + "(\\.|$)")), p = t[h]; if (!p) continue; if (!d) { for (j = 0; j < p.length; j++) { q = p[j]; if (l || n.test(q.namespace)) f.event.remove(a, r, q.handler, j), p.splice(j--, 1) } continue } o = f.event.special[h] || {}; for (j = e || 0; j < p.length; j++) { q = p[j]; if (d.guid === q.guid) { if (l || n.test(q.namespace)) e == null && p.splice(j--, 1), o.remove && o.remove.call(a, q); if (e != null) break } } if (p.length === 0 || e != null && p.length === 1) (!o.teardown || o.teardown.call(a, m) === !1) && f.removeEvent(a, h, s.handle), g = null, delete t[h] } if (f.isEmptyObject(t)) { var u = s.handle; u && (u.elem = null), delete s.events, delete s.handle, f.isEmptyObject(s) && f.removeData(a, b, !0) } } }, customEvent: { getData: !0, setData: !0, changeData: !0 }, trigger: function (c, d, e, g) { var h = c.type || c, i = [], j; h.indexOf("!") >= 0 && (h = h.slice(0, -1), j = !0), h.indexOf(".") >= 0 && (i = h.split("."), h = i.shift(), i.sort()); if (!!e && !f.event.customEvent[h] || !!f.event.global[h]) { c = typeof c == "object" ? c[f.expando] ? c : new f.Event(h, c) : new f.Event(h), c.type = h, c.exclusive = j, c.namespace = i.join("."), c.namespace_re = new RegExp("(^|\\.)" + i.join("\\.(?:.*\\.)?") + "(\\.|$)"); if (g || !e) c.preventDefault(), c.stopPropagation(); if (!e) { f.each(f.cache, function () { var a = f.expando, b = this[a]; b && b.events && b.events[h] && f.event.trigger(c, d, b.handle.elem) }); return } if (e.nodeType === 3 || e.nodeType === 8) return; c.result = b, c.target = e, d = d ? f.makeArray(d) : [], d.unshift(c); var k = e, l = h.indexOf(":") < 0 ? "on" + h : ""; do { var m = f._data(k, "handle"); c.currentTarget = k, m && m.apply(k, d), l && f.acceptData(k) && k[l] && k[l].apply(k, d) === !1 && (c.result = !1, c.preventDefault()), k = k.parentNode || k.ownerDocument || k === c.target.ownerDocument && a } while (k && !c.isPropagationStopped()); if (!c.isDefaultPrevented()) { var n, o = f.event.special[h] || {}; if ((!o._default || o._default.call(e.ownerDocument, c) === !1) && (h !== "click" || !f.nodeName(e, "a")) && f.acceptData(e)) { try { l && e[h] && (n = e[l], n && (e[l] = null), f.event.triggered = h, e[h]()) } catch (p) { } n && (e[l] = n), f.event.triggered = b } } return c.result } }, handle: function (c) { c = f.event.fix(c || a.event); var d = ((f._data(this, "events") || {})[c.type] || []).slice(0), e = !c.exclusive && !c.namespace, g = Array.prototype.slice.call(arguments, 0); g[0] = c, c.currentTarget = this; for (var h = 0, i = d.length; h < i; h++) { var j = d[h]; if (e || c.namespace_re.test(j.namespace)) { c.handler = j.handler, c.data = j.data, c.handleObj = j; var k = j.handler.apply(this, g); k !== b && (c.result = k, k === !1 && (c.preventDefault(), c.stopPropagation())); if (c.isImmediatePropagationStopped()) break } } return c.result }, props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "), fix: function (a) { if (a[f.expando]) return a; var d = a; a = f.Event(d); for (var e = this.props.length, g; e;)g = this.props[--e], a[g] = d[g]; a.target || (a.target = a.srcElement || c), a.target.nodeType === 3 && (a.target = a.target.parentNode), !a.relatedTarget && a.fromElement && (a.relatedTarget = a.fromElement === a.target ? a.toElement : a.fromElement); if (a.pageX == null && a.clientX != null) { var h = a.target.ownerDocument || c, i = h.documentElement, j = h.body; a.pageX = a.clientX + (i && i.scrollLeft || j && j.scrollLeft || 0) - (i && i.clientLeft || j && j.clientLeft || 0), a.pageY = a.clientY + (i && i.scrollTop || j && j.scrollTop || 0) - (i && i.clientTop || j && j.clientTop || 0) } a.which == null && (a.charCode != null || a.keyCode != null) && (a.which = a.charCode != null ? a.charCode : a.keyCode), !a.metaKey && a.ctrlKey && (a.metaKey = a.ctrlKey), !a.which && a.button !== b && (a.which = a.button & 1 ? 1 : a.button & 2 ? 3 : a.button & 4 ? 2 : 0); return a }, guid: 1e8, proxy: f.proxy, special: { ready: { setup: f.bindReady, teardown: f.noop }, live: { add: function (a) { f.event.add(this, N(a.origType, a.selector), f.extend({}, a, { handler: M, guid: a.handler.guid })) }, remove: function (a) { f.event.remove(this, N(a.origType, a.selector), a) } }, beforeunload: { setup: function (a, b, c) { f.isWindow(this) && (this.onbeforeunload = c) }, teardown: function (a, b) { this.onbeforeunload === b && (this.onbeforeunload = null) } } } }, f.removeEvent = c.removeEventListener ? function (a, b, c) { a.removeEventListener && a.removeEventListener(b, c, !1) } : function (a, b, c) { a.detachEvent && a.detachEvent("on" + b, c) }, f.Event = function (a, b) { if (!this.preventDefault) return new f.Event(a, b); a && a.type ? (this.originalEvent = a, this.type = a.type, this.isDefaultPrevented = a.defaultPrevented || a.returnValue === !1 || a.getPreventDefault && a.getPreventDefault() ? E : D) : this.type = a, b && f.extend(this, b), this.timeStamp = f.now(), this[f.expando] = !0 }, f.Event.prototype = { preventDefault: function () { this.isDefaultPrevented = E; var a = this.originalEvent; !a || (a.preventDefault ? a.preventDefault() : a.returnValue = !1) }, stopPropagation: function () { this.isPropagationStopped = E; var a = this.originalEvent; !a || (a.stopPropagation && a.stopPropagation(), a.cancelBubble = !0) }, stopImmediatePropagation: function () { this.isImmediatePropagationStopped = E, this.stopPropagation() }, isDefaultPrevented: D, isPropagationStopped: D, isImmediatePropagationStopped: D }; var F = function (a) { var b = a.relatedTarget; try { if (b && b !== c && !b.parentNode) return; while (b && b !== this) b = b.parentNode; b !== this && (a.type = a.data, f.event.handle.apply(this, arguments)) } catch (d) { } }, G = function (a) { a.type = a.data, f.event.handle.apply(this, arguments) }; f.each({ mouseenter: "mouseover", mouseleave: "mouseout" }, function (a, b) { f.event.special[a] = { setup: function (c) { f.event.add(this, b, c && c.selector ? G : F, a) }, teardown: function (a) { f.event.remove(this, b, a && a.selector ? G : F) } } }), f.support.submitBubbles || (f.event.special.submit = { setup: function (a, b) { if (!f.nodeName(this, "form")) f.event.add(this, "click.specialSubmit", function (a) { var b = a.target, c = b.type; (c === "submit" || c === "image") && f(b).closest("form").length && K("submit", this, arguments) }), f.event.add(this, "keypress.specialSubmit", function (a) { var b = a.target, c = b.type; (c === "text" || c === "password") && f(b).closest("form").length && a.keyCode === 13 && K("submit", this, arguments) }); else return !1 }, teardown: function (a) { f.event.remove(this, ".specialSubmit") } }); if (!f.support.changeBubbles) { var H, I = function (a) { var b = a.type, c = a.value; b === "radio" || b === "checkbox" ? c = a.checked : b === "select-multiple" ? c = a.selectedIndex > -1 ? f.map(a.options, function (a) { return a.selected }).join("-") : "" : f.nodeName(a, "select") && (c = a.selectedIndex); return c }, J = function J(a) { var c = a.target, d, e; if (!!y.test(c.nodeName) && !c.readOnly) { d = f._data(c, "_change_data"), e = I(c), (a.type !== "focusout" || c.type !== "radio") && f._data(c, "_change_data", e); if (d === b || e === d) return; if (d != null || e) a.type = "change", a.liveFired = b, f.event.trigger(a, arguments[1], c) } }; f.event.special.change = { filters: { focusout: J, beforedeactivate: J, click: function (a) { var b = a.target, c = f.nodeName(b, "input") ? b.type : ""; (c === "radio" || c === "checkbox" || f.nodeName(b, "select")) && J.call(this, a) }, keydown: function (a) { var b = a.target, c = f.nodeName(b, "input") ? b.type : ""; (a.keyCode === 13 && !f.nodeName(b, "textarea") || a.keyCode === 32 && (c === "checkbox" || c === "radio") || c === "select-multiple") && J.call(this, a) }, beforeactivate: function (a) { var b = a.target; f._data(b, "_change_data", I(b)) } }, setup: function (a, b) { if (this.type === "file") return !1; for (var c in H) f.event.add(this, c + ".specialChange", H[c]); return y.test(this.nodeName) }, teardown: function (a) { f.event.remove(this, ".specialChange"); return y.test(this.nodeName) } }, H = f.event.special.change.filters, H.focus = H.beforeactivate } f.support.focusinBubbles || f.each({ focus: "focusin", blur: "focusout" }, function (a, b) { function e(a) { var c = f.event.fix(a); c.type = b, c.originalEvent = {}, f.event.trigger(c, null, c.target), c.isDefaultPrevented() && a.preventDefault() } var d = 0; f.event.special[b] = { setup: function () { d++ === 0 && c.addEventListener(a, e, !0) }, teardown: function () { --d === 0 && c.removeEventListener(a, e, !0) } } }), f.each(["bind", "one"], function (a, c) { f.fn[c] = function (a, d, e) { var g; if (typeof a == "object") { for (var h in a) this[c](h, d, a[h], e); return this } if (arguments.length === 2 || d === !1) e = d, d = b; c === "one" ? (g = function (a) { f(this).unbind(a, g); return e.apply(this, arguments) }, g.guid = e.guid || f.guid++) : g = e; if (a === "unload" && c !== "one") this.one(a, d, e); else for (var i = 0, j = this.length; i < j; i++)f.event.add(this[i], a, g, d); return this } }), f.fn.extend({ unbind: function (a, b) { if (typeof a == "object" && !a.preventDefault) for (var c in a) this.unbind(c, a[c]); else for (var d = 0, e = this.length; d < e; d++)f.event.remove(this[d], a, b); return this }, delegate: function (a, b, c, d) { return this.live(b, c, d, a) }, undelegate: function (a, b, c) { return arguments.length === 0 ? this.unbind("live") : this.die(b, null, c, a) }, trigger: function (a, b) { return this.each(function () { f.event.trigger(a, b, this) }) }, triggerHandler: function (a, b) { if (this[0]) return f.event.trigger(a, b, this[0], !0) }, toggle: function (a) { var b = arguments, c = a.guid || f.guid++, d = 0, e = function (c) { var e = (f.data(this, "lastToggle" + a.guid) || 0) % d; f.data(this, "lastToggle" + a.guid, e + 1), c.preventDefault(); return b[e].apply(this, arguments) || !1 }; e.guid = c; while (d < b.length) b[d++].guid = c; return this.click(e) }, hover: function (a, b) { return this.mouseenter(a).mouseleave(b || a) } }); var L = { focus: "focusin", blur: "focusout", mouseenter: "mouseover", mouseleave: "mouseout" }; f.each(["live", "die"], function (a, c) { f.fn[c] = function (a, d, e, g) { var h, i = 0, j, k, l, m = g || this.selector, n = g ? this : f(this.context); if (typeof a == "object" && !a.preventDefault) { for (var o in a) n[c](o, d, a[o], m); return this } if (c === "die" && !a && g && g.charAt(0) === ".") { n.unbind(g); return this } if (d === !1 || f.isFunction(d)) e = d || D, d = b; a = (a || "").split(" "); while ((h = a[i++]) != null) { j = x.exec(h), k = "", j && (k = j[0], h = h.replace(x, "")); if (h === "hover") { a.push("mouseenter" + k, "mouseleave" + k); continue } l = h, L[h] ? (a.push(L[h] + k), h = h + k) : h = (L[h] || h) + k; if (c === "live") for (var p = 0, q = n.length; p < q; p++)f.event.add(n[p], "live." + N(h, m), { data: d, selector: m, handler: e, origType: h, origHandler: e, preType: l }); else n.unbind("live." + N(h, m), e) } return this } }), f.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "), function (a, b) { f.fn[b] = function (a, c) { c == null && (c = a, a = null); return arguments.length > 0 ? this.bind(b, a, c) : this.trigger(b) }, f.attrFn && (f.attrFn[b] = !0) }), function () { function u(a, b, c, d, e, f) { for (var g = 0, h = d.length; g < h; g++) { var i = d[g]; if (i) { var j = !1; i = i[a]; while (i) { if (i.sizcache === c) { j = d[i.sizset]; break } if (i.nodeType === 1) { f || (i.sizcache = c, i.sizset = g); if (typeof b != "string") { if (i === b) { j = !0; break } } else if (k.filter(b, [i]).length > 0) { j = i; break } } i = i[a] } d[g] = j } } } function t(a, b, c, d, e, f) { for (var g = 0, h = d.length; g < h; g++) { var i = d[g]; if (i) { var j = !1; i = i[a]; while (i) { if (i.sizcache === c) { j = d[i.sizset]; break } i.nodeType === 1 && !f && (i.sizcache = c, i.sizset = g); if (i.nodeName.toLowerCase() === b) { j = i; break } i = i[a] } d[g] = j } } } var a = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, d = 0, e = Object.prototype.toString, g = !1, h = !0, i = /\\/g, j = /\W/;[0, 0].sort(function () { h = !1; return 0 }); var k = function (b, d, f, g) { f = f || [], d = d || c; var h = d; if (d.nodeType !== 1 && d.nodeType !== 9) return []; if (!b || typeof b != "string") return f; var i, j, n, o, q, r, s, t, u = !0, w = k.isXML(d), x = [], y = b; do { a.exec(""), i = a.exec(y); if (i) { y = i[3], x.push(i[1]); if (i[2]) { o = i[3]; break } } } while (i); if (x.length > 1 && m.exec(b)) if (x.length === 2 && l.relative[x[0]]) j = v(x[0] + x[1], d); else { j = l.relative[x[0]] ? [d] : k(x.shift(), d); while (x.length) b = x.shift(), l.relative[b] && (b += x.shift()), j = v(b, j) } else { !g && x.length > 1 && d.nodeType === 9 && !w && l.match.ID.test(x[0]) && !l.match.ID.test(x[x.length - 1]) && (q = k.find(x.shift(), d, w), d = q.expr ? k.filter(q.expr, q.set)[0] : q.set[0]); if (d) { q = g ? { expr: x.pop(), set: p(g) } : k.find(x.pop(), x.length === 1 && (x[0] === "~" || x[0] === "+") && d.parentNode ? d.parentNode : d, w), j = q.expr ? k.filter(q.expr, q.set) : q.set, x.length > 0 ? n = p(j) : u = !1; while (x.length) r = x.pop(), s = r, l.relative[r] ? s = x.pop() : r = "", s == null && (s = d), l.relative[r](n, s, w) } else n = x = [] } n || (n = j), n || k.error(r || b); if (e.call(n) === "[object Array]") if (!u) f.push.apply(f, n); else if (d && d.nodeType === 1) for (t = 0; n[t] != null; t++)n[t] && (n[t] === !0 || n[t].nodeType === 1 && k.contains(d, n[t])) && f.push(j[t]); else for (t = 0; n[t] != null; t++)n[t] && n[t].nodeType === 1 && f.push(j[t]); else p(n, f); o && (k(o, h, f, g), k.uniqueSort(f)); return f }; k.uniqueSort = function (a) { if (r) { g = h, a.sort(r); if (g) for (var b = 1; b < a.length; b++)a[b] === a[b - 1] && a.splice(b--, 1) } return a }, k.matches = function (a, b) { return k(a, null, null, b) }, k.matchesSelector = function (a, b) { return k(b, null, null, [a]).length > 0 }, k.find = function (a, b, c) { var d; if (!a) return []; for (var e = 0, f = l.order.length; e < f; e++) { var g, h = l.order[e]; if (g = l.leftMatch[h].exec(a)) { var j = g[1]; g.splice(1, 1); if (j.substr(j.length - 1) !== "\\") { g[1] = (g[1] || "").replace(i, ""), d = l.find[h](g, b, c); if (d != null) { a = a.replace(l.match[h], ""); break } } } } d || (d = typeof b.getElementsByTagName != "undefined" ? b.getElementsByTagName("*") : []); return { set: d, expr: a } }, k.filter = function (a, c, d, e) { var f, g, h = a, i = [], j = c, m = c && c[0] && k.isXML(c[0]); while (a && c.length) { for (var n in l.filter) if ((f = l.leftMatch[n].exec(a)) != null && f[2]) { var o, p, q = l.filter[n], r = f[1]; g = !1, f.splice(1, 1); if (r.substr(r.length - 1) === "\\") continue; j === i && (i = []); if (l.preFilter[n]) { f = l.preFilter[n](f, j, d, i, e, m); if (!f) g = o = !0; else if (f === !0) continue } if (f) for (var s = 0; (p = j[s]) != null; s++)if (p) { o = q(p, f, s, j); var t = e ^ !!o; d && o != null ? t ? g = !0 : j[s] = !1 : t && (i.push(p), g = !0) } if (o !== b) { d || (j = i), a = a.replace(l.match[n], ""); if (!g) return []; break } } if (a === h) if (g == null) k.error(a); else break; h = a } return j }, k.error = function (a) { throw "Syntax error, unrecognized expression: " + a }; var l = k.selectors = { order: ["ID", "NAME", "TAG"], match: { ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/, ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/, TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/, CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/, POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/, PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/ }, leftMatch: {}, attrMap: { "class": "className", "for": "htmlFor" }, attrHandle: { href: function (a) { return a.getAttribute("href") }, type: function (a) { return a.getAttribute("type") } }, relative: { "+": function (a, b) { var c = typeof b == "string", d = c && !j.test(b), e = c && !d; d && (b = b.toLowerCase()); for (var f = 0, g = a.length, h; f < g; f++)if (h = a[f]) { while ((h = h.previousSibling) && h.nodeType !== 1); a[f] = e || h && h.nodeName.toLowerCase() === b ? h || !1 : h === b } e && k.filter(b, a, !0) }, ">": function (a, b) { var c, d = typeof b == "string", e = 0, f = a.length; if (d && !j.test(b)) { b = b.toLowerCase(); for (; e < f; e++) { c = a[e]; if (c) { var g = c.parentNode; a[e] = g.nodeName.toLowerCase() === b ? g : !1 } } } else { for (; e < f; e++)c = a[e], c && (a[e] = d ? c.parentNode : c.parentNode === b); d && k.filter(b, a, !0) } }, "": function (a, b, c) { var e, f = d++, g = u; typeof b == "string" && !j.test(b) && (b = b.toLowerCase(), e = b, g = t), g("parentNode", b, f, a, e, c) }, "~": function (a, b, c) { var e, f = d++, g = u; typeof b == "string" && !j.test(b) && (b = b.toLowerCase(), e = b, g = t), g("previousSibling", b, f, a, e, c) } }, find: { ID: function (a, b, c) { if (typeof b.getElementById != "undefined" && !c) { var d = b.getElementById(a[1]); return d && d.parentNode ? [d] : [] } }, NAME: function (a, b) { if (typeof b.getElementsByName != "undefined") { var c = [], d = b.getElementsByName(a[1]); for (var e = 0, f = d.length; e < f; e++)d[e].getAttribute("name") === a[1] && c.push(d[e]); return c.length === 0 ? null : c } }, TAG: function (a, b) { if (typeof b.getElementsByTagName != "undefined") return b.getElementsByTagName(a[1]) } }, preFilter: { CLASS: function (a, b, c, d, e, f) { a = " " + a[1].replace(i, "") + " "; if (f) return a; for (var g = 0, h; (h = b[g]) != null; g++)h && (e ^ (h.className && (" " + h.className + " ").replace(/[\t\n\r]/g, " ").indexOf(a) >= 0) ? c || d.push(h) : c && (b[g] = !1)); return !1 }, ID: function (a) { return a[1].replace(i, "") }, TAG: function (a, b) { return a[1].replace(i, "").toLowerCase() }, CHILD: function (a) { if (a[1] === "nth") { a[2] || k.error(a[0]), a[2] = a[2].replace(/^\+|\s*/g, ""); var b = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2] === "even" && "2n" || a[2] === "odd" && "2n+1" || !/\D/.test(a[2]) && "0n+" + a[2] || a[2]); a[2] = b[1] + (b[2] || 1) - 0, a[3] = b[3] - 0 } else a[2] && k.error(a[0]); a[0] = d++; return a }, ATTR: function (a, b, c, d, e, f) { var g = a[1] = a[1].replace(i, ""); !f && l.attrMap[g] && (a[1] = l.attrMap[g]), a[4] = (a[4] || a[5] || "").replace(i, ""), a[2] === "~=" && (a[4] = " " + a[4] + " "); return a }, PSEUDO: function (b, c, d, e, f) { if (b[1] === "not") if ((a.exec(b[3]) || "").length > 1 || /^\w/.test(b[3])) b[3] = k(b[3], null, null, c); else { var g = k.filter(b[3], c, d, !0 ^ f); d || e.push.apply(e, g); return !1 } else if (l.match.POS.test(b[0]) || l.match.CHILD.test(b[0])) return !0; return b }, POS: function (a) { a.unshift(!0); return a } }, filters: { enabled: function (a) { return a.disabled === !1 && a.type !== "hidden" }, disabled: function (a) { return a.disabled === !0 }, checked: function (a) { return a.checked === !0 }, selected: function (a) { a.parentNode && a.parentNode.selectedIndex; return a.selected === !0 }, parent: function (a) { return !!a.firstChild }, empty: function (a) { return !a.firstChild }, has: function (a, b, c) { return !!k(c[3], a).length }, header: function (a) { return /h\d/i.test(a.nodeName) }, text: function (a) { var b = a.getAttribute("type"), c = a.type; return a.nodeName.toLowerCase() === "input" && "text" === c && (b === c || b === null) }, radio: function (a) { return a.nodeName.toLowerCase() === "input" && "radio" === a.type }, checkbox: function (a) { return a.nodeName.toLowerCase() === "input" && "checkbox" === a.type }, file: function (a) { return a.nodeName.toLowerCase() === "input" && "file" === a.type }, password: function (a) { return a.nodeName.toLowerCase() === "input" && "password" === a.type }, submit: function (a) { var b = a.nodeName.toLowerCase(); return (b === "input" || b === "button") && "submit" === a.type }, image: function (a) { return a.nodeName.toLowerCase() === "input" && "image" === a.type }, reset: function (a) { return a.nodeName.toLowerCase() === "input" && "reset" === a.type }, button: function (a) { var b = a.nodeName.toLowerCase(); return b === "input" && "button" === a.type || b === "button" }, input: function (a) { return /input|select|textarea|button/i.test(a.nodeName) }, focus: function (a) { return a === a.ownerDocument.activeElement } }, setFilters: { first: function (a, b) { return b === 0 }, last: function (a, b, c, d) { return b === d.length - 1 }, even: function (a, b) { return b % 2 === 0 }, odd: function (a, b) { return b % 2 === 1 }, lt: function (a, b, c) { return b < c[3] - 0 }, gt: function (a, b, c) { return b > c[3] - 0 }, nth: function (a, b, c) { return c[3] - 0 === b }, eq: function (a, b, c) { return c[3] - 0 === b } }, filter: { PSEUDO: function (a, b, c, d) { var e = b[1], f = l.filters[e]; if (f) return f(a, c, b, d); if (e === "contains") return (a.textContent || a.innerText || k.getText([a]) || "").indexOf(b[3]) >= 0; if (e === "not") { var g = b[3]; for (var h = 0, i = g.length; h < i; h++)if (g[h] === a) return !1; return !0 } k.error(e) }, CHILD: function (a, b) { var c = b[1], d = a; switch (c) { case "only": case "first": while (d = d.previousSibling) if (d.nodeType === 1) return !1; if (c === "first") return !0; d = a; case "last": while (d = d.nextSibling) if (d.nodeType === 1) return !1; return !0; case "nth": var e = b[2], f = b[3]; if (e === 1 && f === 0) return !0; var g = b[0], h = a.parentNode; if (h && (h.sizcache !== g || !a.nodeIndex)) { var i = 0; for (d = h.firstChild; d; d = d.nextSibling)d.nodeType === 1 && (d.nodeIndex = ++i); h.sizcache = g } var j = a.nodeIndex - f; return e === 0 ? j === 0 : j % e === 0 && j / e >= 0 } }, ID: function (a, b) { return a.nodeType === 1 && a.getAttribute("id") === b }, TAG: function (a, b) { return b === "*" && a.nodeType === 1 || a.nodeName.toLowerCase() === b }, CLASS: function (a, b) { return (" " + (a.className || a.getAttribute("class")) + " ").indexOf(b) > -1 }, ATTR: function (a, b) { var c = b[1], d = l.attrHandle[c] ? l.attrHandle[c](a) : a[c] != null ? a[c] : a.getAttribute(c), e = d + "", f = b[2], g = b[4]; return d == null ? f === "!=" : f === "=" ? e === g : f === "*=" ? e.indexOf(g) >= 0 : f === "~=" ? (" " + e + " ").indexOf(g) >= 0 : g ? f === "!=" ? e !== g : f === "^=" ? e.indexOf(g) === 0 : f === "$=" ? e.substr(e.length - g.length) === g : f === "|=" ? e === g || e.substr(0, g.length + 1) === g + "-" : !1 : e && d !== !1 }, POS: function (a, b, c, d) { var e = b[2], f = l.setFilters[e]; if (f) return f(a, c, b, d) } } }, m = l.match.POS, n = function (a, b) { return "\\" + (b - 0 + 1) }; for (var o in l.match) l.match[o] = new RegExp(l.match[o].source + /(?![^\[]*\])(?![^\(]*\))/.source), l.leftMatch[o] = new RegExp(/(^(?:.|\r|\n)*?)/.source + l.match[o].source.replace(/\\(\d+)/g, n)); var p = function (a, b) { a = Array.prototype.slice.call(a, 0); if (b) { b.push.apply(b, a); return b } return a }; try { Array.prototype.slice.call(c.documentElement.childNodes, 0)[0].nodeType } catch (q) { p = function (a, b) { var c = 0, d = b || []; if (e.call(a) === "[object Array]") Array.prototype.push.apply(d, a); else if (typeof a.length == "number") for (var f = a.length; c < f; c++)d.push(a[c]); else for (; a[c]; c++)d.push(a[c]); return d } } var r, s; c.documentElement.compareDocumentPosition ? r = function (a, b) { if (a === b) { g = !0; return 0 } if (!a.compareDocumentPosition || !b.compareDocumentPosition) return a.compareDocumentPosition ? -1 : 1; return a.compareDocumentPosition(b) & 4 ? -1 : 1 } : (r = function (a, b) { var c, d, e = [], f = [], h = a.parentNode, i = b.parentNode, j = h; if (a === b) { g = !0; return 0 } if (h === i) return s(a, b); if (!h) return -1; if (!i) return 1; while (j) e.unshift(j), j = j.parentNode; j = i; while (j) f.unshift(j), j = j.parentNode; c = e.length, d = f.length; for (var k = 0; k < c && k < d; k++)if (e[k] !== f[k]) return s(e[k], f[k]); return k === c ? s(a, f[k], -1) : s(e[k], b, 1) }, s = function (a, b, c) { if (a === b) return c; var d = a.nextSibling; while (d) { if (d === b) return -1; d = d.nextSibling } return 1 }), k.getText = function (a) { var b = "", c; for (var d = 0; a[d]; d++)c = a[d], c.nodeType === 3 || c.nodeType === 4 ? b += c.nodeValue : c.nodeType !== 8 && (b += k.getText(c.childNodes)); return b }, function () { var a = c.createElement("div"), d = "script" + (new Date).getTime(), e = c.documentElement; a.innerHTML = "", e.insertBefore(a, e.firstChild), c.getElementById(d) && (l.find.ID = function (a, c, d) { if (typeof c.getElementById != "undefined" && !d) { var e = c.getElementById(a[1]); return e ? e.id === a[1] || typeof e.getAttributeNode != "undefined" && e.getAttributeNode("id").nodeValue === a[1] ? [e] : b : [] } }, l.filter.ID = function (a, b) { var c = typeof a.getAttributeNode != "undefined" && a.getAttributeNode("id"); return a.nodeType === 1 && c && c.nodeValue === b }), e.removeChild(a), e = a = null }(), function () { var a = c.createElement("div"); a.appendChild(c.createComment("")), a.getElementsByTagName("*").length > 0 && (l.find.TAG = function (a, b) { var c = b.getElementsByTagName(a[1]); if (a[1] === "*") { var d = []; for (var e = 0; c[e]; e++)c[e].nodeType === 1 && d.push(c[e]); c = d } return c }), a.innerHTML = "", a.firstChild && typeof a.firstChild.getAttribute != "undefined" && a.firstChild.getAttribute("href") !== "#" && (l.attrHandle.href = function (a) { return a.getAttribute("href", 2) }), a = null }(), c.querySelectorAll && function () { var a = k, b = c.createElement("div"), d = "__sizzle__"; b.innerHTML = "

    "; if (!b.querySelectorAll || b.querySelectorAll(".TEST").length !== 0) { k = function (b, e, f, g) { e = e || c; if (!g && !k.isXML(e)) { var h = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b); if (h && (e.nodeType === 1 || e.nodeType === 9)) { if (h[1]) return p(e.getElementsByTagName(b), f); if (h[2] && l.find.CLASS && e.getElementsByClassName) return p(e.getElementsByClassName(h[2]), f) } if (e.nodeType === 9) { if (b === "body" && e.body) return p([e.body], f); if (h && h[3]) { var i = e.getElementById(h[3]); if (!i || !i.parentNode) return p([], f); if (i.id === h[3]) return p([i], f) } try { return p(e.querySelectorAll(b), f) } catch (j) { } } else if (e.nodeType === 1 && e.nodeName.toLowerCase() !== "object") { var m = e, n = e.getAttribute("id"), o = n || d, q = e.parentNode, r = /^\s*[+~]/.test(b); n ? o = o.replace(/'/g, "\\$&") : e.setAttribute("id", o), r && q && (e = e.parentNode); try { if (!r || q) return p(e.querySelectorAll("[id='" + o + "'] " + b), f) } catch (s) { } finally { n || m.removeAttribute("id") } } } return a(b, e, f, g) }; for (var e in a) k[e] = a[e]; b = null } }(), function () { var a = c.documentElement, b = a.matchesSelector || a.mozMatchesSelector || a.webkitMatchesSelector || a.msMatchesSelector; if (b) { var d = !b.call(c.createElement("div"), "div"), e = !1; try { b.call(c.documentElement, "[test!='']:sizzle") } catch (f) { e = !0 } k.matchesSelector = function (a, c) { c = c.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']"); if (!k.isXML(a)) try { if (e || !l.match.PSEUDO.test(c) && !/!=/.test(c)) { var f = b.call(a, c); if (f || !d || a.document && a.document.nodeType !== 11) return f } } catch (g) { } return k(c, null, null, [a]).length > 0 } } }(), function () { var a = c.createElement("div"); a.innerHTML = "
    "; if (!!a.getElementsByClassName && a.getElementsByClassName("e").length !== 0) { a.lastChild.className = "e"; if (a.getElementsByClassName("e").length === 1) return; l.order.splice(1, 0, "CLASS"), l.find.CLASS = function (a, b, c) { if (typeof b.getElementsByClassName != "undefined" && !c) return b.getElementsByClassName(a[1]) }, a = null } }(), c.documentElement.contains ? k.contains = function (a, b) { return a !== b && (a.contains ? a.contains(b) : !0) } : c.documentElement.compareDocumentPosition ? k.contains = function (a, b) { return !!(a.compareDocumentPosition(b) & 16) } : k.contains = function () { return !1 }, k.isXML = function (a) { var b = (a ? a.ownerDocument || a : 0).documentElement; return b ? b.nodeName !== "HTML" : !1 }; var v = function (a, b) { var c, d = [], e = "", f = b.nodeType ? [b] : b; while (c = l.match.PSEUDO.exec(a)) e += c[0], a = a.replace(l.match.PSEUDO, ""); a = l.relative[a] ? a + "*" : a; for (var g = 0, h = f.length; g < h; g++)k(a, f[g], d); return k.filter(e, d) }; f.find = k, f.expr = k.selectors, f.expr[":"] = f.expr.filters, f.unique = k.uniqueSort, f.text = k.getText, f.isXMLDoc = k.isXML, f.contains = k.contains }(); var O = /Until$/, P = /^(?:parents|prevUntil|prevAll)/, Q = /,/, R = /^.[^:#\[\.,]*$/, S = Array.prototype.slice, T = f.expr.match.POS, U = { children: !0, contents: !0, next: !0, prev: !0 }; f.fn.extend({ find: function (a) { var b = this, c, d; if (typeof a != "string") return f(a).filter(function () { for (c = 0, d = b.length; c < d; c++)if (f.contains(b[c], this)) return !0 }); var e = this.pushStack("", "find", a), g, h, i; for (c = 0, d = this.length; c < d; c++) { g = e.length, f.find(a, this[c], e); if (c > 0) for (h = g; h < e.length; h++)for (i = 0; i < g; i++)if (e[i] === e[h]) { e.splice(h--, 1); break } } return e }, has: function (a) { var b = f(a); return this.filter(function () { for (var a = 0, c = b.length; a < c; a++)if (f.contains(this, b[a])) return !0 }) }, not: function (a) { return this.pushStack(W(this, a, !1), "not", a) }, filter: function (a) { return this.pushStack(W(this, a, !0), "filter", a) }, is: function (a) { return !!a && (typeof a == "string" ? f.filter(a, this).length > 0 : this.filter(a).length > 0) }, closest: function (a, b) { var c = [], d, e, g = this[0]; if (f.isArray(a)) { var h, i, j = {}, k = 1; if (g && a.length) { for (d = 0, e = a.length; d < e; d++)i = a[d], j[i] || (j[i] = T.test(i) ? f(i, b || this.context) : i); while (g && g.ownerDocument && g !== b) { for (i in j) h = j[i], (h.jquery ? h.index(g) > -1 : f(g).is(h)) && c.push({ selector: i, elem: g, level: k }); g = g.parentNode, k++ } } return c } var l = T.test(a) || typeof a != "string" ? f(a, b || this.context) : 0; for (d = 0, e = this.length; d < e; d++) { g = this[d]; while (g) { if (l ? l.index(g) > -1 : f.find.matchesSelector(g, a)) { c.push(g); break } g = g.parentNode; if (!g || !g.ownerDocument || g === b || g.nodeType === 11) break } } c = c.length > 1 ? f.unique(c) : c; return this.pushStack(c, "closest", a) }, index: function (a) { if (!a || typeof a == "string") return f.inArray(this[0], a ? f(a) : this.parent().children()); return f.inArray(a.jquery ? a[0] : a, this) }, add: function (a, b) { var c = typeof a == "string" ? f(a, b) : f.makeArray(a && a.nodeType ? [a] : a), d = f.merge(this.get(), c); return this.pushStack(V(c[0]) || V(d[0]) ? d : f.unique(d)) }, andSelf: function () { return this.add(this.prevObject) } }), f.each({ parent: function (a) { var b = a.parentNode; return b && b.nodeType !== 11 ? b : null }, parents: function (a) { return f.dir(a, "parentNode") }, parentsUntil: function (a, b, c) { return f.dir(a, "parentNode", c) }, next: function (a) { return f.nth(a, 2, "nextSibling") }, prev: function (a) { return f.nth(a, 2, "previousSibling") }, nextAll: function (a) { return f.dir(a, "nextSibling") }, prevAll: function (a) { return f.dir(a, "previousSibling") }, nextUntil: function (a, b, c) { return f.dir(a, "nextSibling", c) }, prevUntil: function (a, b, c) { return f.dir(a, "previousSibling", c) }, siblings: function (a) { return f.sibling(a.parentNode.firstChild, a) }, children: function (a) { return f.sibling(a.firstChild) }, contents: function (a) { return f.nodeName(a, "iframe") ? a.contentDocument || a.contentWindow.document : f.makeArray(a.childNodes) } }, function (a, b) { f.fn[a] = function (c, d) { var e = f.map(this, b, c), g = S.call(arguments); O.test(a) || (d = c), d && typeof d == "string" && (e = f.filter(d, e)), e = this.length > 1 && !U[a] ? f.unique(e) : e, (this.length > 1 || Q.test(d)) && P.test(a) && (e = e.reverse()); return this.pushStack(e, a, g.join(",")) } }), f.extend({ filter: function (a, b, c) { c && (a = ":not(" + a + ")"); return b.length === 1 ? f.find.matchesSelector(b[0], a) ? [b[0]] : [] : f.find.matches(a, b) }, dir: function (a, c, d) { var e = [], g = a[c]; while (g && g.nodeType !== 9 && (d === b || g.nodeType !== 1 || !f(g).is(d))) g.nodeType === 1 && e.push(g), g = g[c]; return e }, nth: function (a, b, c, d) { b = b || 1; var e = 0; for (; a; a = a[c])if (a.nodeType === 1 && ++e === b) break; return a }, sibling: function (a, b) { var c = []; for (; a; a = a.nextSibling)a.nodeType === 1 && a !== b && c.push(a); return c } }); var X = / jQuery\d+="(?:\d+|null)"/g, Y = /^\s+/, Z = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig, $ = /<([\w:]+)/, _ = /", ""], legend: [1, "
    ", "
    "], thead: [1, "", "
    "], tr: [2, "", "
    "], td: [3, "", "
    "], col: [2, "", "
    "], area: [1, "", ""], _default: [0, "", ""] }; be.optgroup = be.option, be.tbody = be.tfoot = be.colgroup = be.caption = be.thead, be.th = be.td, f.support.htmlSerialize || (be._default = [1, "div
    ", "
    "]), f.fn.extend({ text: function (a) { if (f.isFunction(a)) return this.each(function (b) { var c = f(this); c.text(a.call(this, b, c.text())) }); if (typeof a != "object" && a !== b) return this.empty().append((this[0] && this[0].ownerDocument || c).createTextNode(a)); return f.text(this) }, wrapAll: function (a) { if (f.isFunction(a)) return this.each(function (b) { f(this).wrapAll(a.call(this, b)) }); if (this[0]) { var b = f(a, this[0].ownerDocument).eq(0).clone(!0); this[0].parentNode && b.insertBefore(this[0]), b.map(function () { var a = this; while (a.firstChild && a.firstChild.nodeType === 1) a = a.firstChild; return a }).append(this) } return this }, wrapInner: function (a) { if (f.isFunction(a)) return this.each(function (b) { f(this).wrapInner(a.call(this, b)) }); return this.each(function () { var b = f(this), c = b.contents(); c.length ? c.wrapAll(a) : b.append(a) }) }, wrap: function (a) { return this.each(function () { f(this).wrapAll(a) }) }, unwrap: function () { return this.parent().each(function () { f.nodeName(this, "body") || f(this).replaceWith(this.childNodes) }).end() }, append: function () { return this.domManip(arguments, !0, function (a) { this.nodeType === 1 && this.appendChild(a) }) }, prepend: function () { return this.domManip(arguments, !0, function (a) { this.nodeType === 1 && this.insertBefore(a, this.firstChild) }) }, before: function () { if (this[0] && this[0].parentNode) return this.domManip(arguments, !1, function (a) { this.parentNode.insertBefore(a, this) }); if (arguments.length) { var a = f(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, !1, function (a) { this.parentNode.insertBefore(a, this.nextSibling) }); if (arguments.length) { var a = this.pushStack(this, "after", arguments); a.push.apply(a, f(arguments[0]).toArray()); return a } }, remove: function (a, b) { for (var c = 0, d; (d = this[c]) != null; c++)if (!a || f.filter(a, [d]).length) !b && d.nodeType === 1 && (f.cleanData(d.getElementsByTagName("*")), f.cleanData([d])), d.parentNode && d.parentNode.removeChild(d); return this }, empty: function () { for (var a = 0, b; (b = this[a]) != null; a++) { b.nodeType === 1 && f.cleanData(b.getElementsByTagName("*")); while (b.firstChild) b.removeChild(b.firstChild) } return this }, clone: function (a, b) { a = a == null ? !1 : a, b = b == null ? a : b; return this.map(function () { return f.clone(this, a, b) }) }, html: function (a) { if (a === b) return this[0] && this[0].nodeType === 1 ? this[0].innerHTML.replace(X, "") : null; if (typeof a == "string" && !bb.test(a) && (f.support.leadingWhitespace || !Y.test(a)) && !be[($.exec(a) || ["", ""])[1].toLowerCase()]) { a = a.replace(Z, "<$1>"); try { for (var c = 0, d = this.length; c < d; c++)this[c].nodeType === 1 && (f.cleanData(this[c].getElementsByTagName("*")), this[c].innerHTML = a) } catch (e) { this.empty().append(a) } } else f.isFunction(a) ? this.each(function (b) { var c = f(this); c.html(a.call(this, b, c.html())) }) : this.empty().append(a); return this }, replaceWith: function (a) { if (this[0] && this[0].parentNode) { if (f.isFunction(a)) return this.each(function (b) { var c = f(this), d = c.html(); c.replaceWith(a.call(this, b, d)) }); typeof a != "string" && (a = f(a).detach()); return this.each(function () { var b = this.nextSibling, c = this.parentNode; f(this).remove(), b ? f(b).before(a) : f(c).append(a) }) } return this.length ? this.pushStack(f(f.isFunction(a) ? a() : a), "replaceWith", a) : this }, detach: function (a) { return this.remove(a, !0) }, domManip: function (a, c, d) { var e, g, h, i, j = a[0], k = []; if (!f.support.checkClone && arguments.length === 3 && typeof j == "string" && bc.test(j)) return this.each(function () { f(this).domManip(a, c, d, !0) }); if (f.isFunction(j)) return this.each(function (e) { var g = f(this); a[0] = j.call(this, e, c ? g.html() : b), g.domManip(a, c, d) }); if (this[0]) { i = j && j.parentNode, f.support.parentNode && i && i.nodeType === 11 && i.childNodes.length === this.length ? e = { fragment: i } : e = f.buildFragment(a, this, k), h = e.fragment, h.childNodes.length === 1 ? g = h = h.firstChild : g = h.firstChild; if (g) { c = c && f.nodeName(g, "tr"); for (var l = 0, m = this.length, n = m - 1; l < m; l++)d.call(c ? bf(this[l], g) : this[l], e.cacheable || m > 1 && l < n ? f.clone(h, !0, !0) : h) } k.length && f.each(k, bl) } return this } }), f.buildFragment = function (a, b, d) { var e, g, h, i = b && b[0] ? b[0].ownerDocument || b[0] : c; a.length === 1 && typeof a[0] == "string" && a[0].length < 512 && i === c && a[0].charAt(0) === "<" && !bb.test(a[0]) && (f.support.checkClone || !bc.test(a[0])) && (g = !0, h = f.fragments[a[0]], h && h !== 1 && (e = h)), e || (e = i.createDocumentFragment(), f.clean(a, i, e, d)), g && (f.fragments[a[0]] = h ? e : 1); return { fragment: e, cacheable: g } }, f.fragments = {}, f.each({ appendTo: "append", prependTo: "prepend", insertBefore: "before", insertAfter: "after", replaceAll: "replaceWith" }, function (a, b) { f.fn[a] = function (c) { var d = [], e = f(c), g = this.length === 1 && this[0].parentNode; if (g && g.nodeType === 11 && g.childNodes.length === 1 && e.length === 1) { e[b](this[0]); return this } for (var h = 0, i = e.length; h < i; h++) { var j = (h > 0 ? this.clone(!0) : this).get(); f(e[h])[b](j), d = d.concat(j) } return this.pushStack(d, a, e.selector) } }), f.extend({ clone: function (a, b, c) { var d = a.cloneNode(!0), e, g, h; if ((!f.support.noCloneEvent || !f.support.noCloneChecked) && (a.nodeType === 1 || a.nodeType === 11) && !f.isXMLDoc(a)) { bh(a, d), e = bi(a), g = bi(d); for (h = 0; e[h]; ++h)bh(e[h], g[h]) } if (b) { bg(a, d); if (c) { e = bi(a), g = bi(d); for (h = 0; e[h]; ++h)bg(e[h], g[h]) } } return d }, clean: function (a, b, d, e) { var g; b = b || c, typeof b.createElement == "undefined" && (b = b.ownerDocument || b[0] && b[0].ownerDocument || c); var h = []; for (var i = 0, j; (j = a[i]) != null; i++) { typeof j == "number" && (j += ""); if (!j) continue; if (typeof j == "string") if (!ba.test(j)) j = b.createTextNode(j); else { j = j.replace(Z, "<$1>"); var k = ($.exec(j) || ["", ""])[1].toLowerCase(), l = be[k] || be._default, m = l[0], n = b.createElement("div"); n.innerHTML = l[1] + j + l[2]; while (m--) n = n.lastChild; if (!f.support.tbody) { var o = _.test(j), p = k === "table" && !o ? n.firstChild && n.firstChild.childNodes : l[1] === "" && !o ? n.childNodes : []; for (var q = p.length - 1; q >= 0; --q)f.nodeName(p[q], "tbody") && !p[q].childNodes.length && p[q].parentNode.removeChild(p[q]) } !f.support.leadingWhitespace && Y.test(j) && n.insertBefore(b.createTextNode(Y.exec(j)[0]), n.firstChild), j = n.childNodes } var r; if (!f.support.appendChecked) if (j[0] && typeof (r = j.length) == "number") for (i = 0; i < r; i++)bk(j[i]); else bk(j); j.nodeType ? h.push(j) : h = f.merge(h, j) } if (d) { g = function (a) { return !a.type || bd.test(a.type) }; for (i = 0; h[i]; i++)if (e && f.nodeName(h[i], "script") && (!h[i].type || h[i].type.toLowerCase() === "text/javascript")) e.push(h[i].parentNode ? h[i].parentNode.removeChild(h[i]) : h[i]); else { if (h[i].nodeType === 1) { var s = f.grep(h[i].getElementsByTagName("script"), g); h.splice.apply(h, [i + 1, 0].concat(s)) } d.appendChild(h[i]) } } return h }, cleanData: function (a) { var b, c, d = f.cache, e = f.expando, g = f.event.special, h = f.support.deleteExpando; for (var i = 0, j; (j = a[i]) != null; i++) { if (j.nodeName && f.noData[j.nodeName.toLowerCase()]) continue; c = j[f.expando]; if (c) { b = d[c] && d[c][e]; if (b && b.events) { for (var k in b.events) g[k] ? f.event.remove(j, k) : f.removeEvent(j, k, b.handle); b.handle && (b.handle.elem = null) } h ? delete j[f.expando] : j.removeAttribute && j.removeAttribute(f.expando), delete d[c] } } } }); var bm = /alpha\([^)]*\)/i, bn = /opacity=([^)]*)/, bo = /-([a-z])/ig, bp = /([A-Z]|^ms)/g, bq = /^-?\d+(?:px)?$/i, br = /^-?\d/, bs = /^[+\-]=/, bt = /[^+\-\.\de]+/g, bu = { position: "absolute", visibility: "hidden", display: "block" }, bv = ["Left", "Right"], bw = ["Top", "Bottom"], bx, by, bz, bA = function (a, b) { return b.toUpperCase() }; f.fn.css = function (a, c) { if (arguments.length === 2 && c === b) return this; return f.access(this, a, c, !0, function (a, c, d) { return d !== b ? f.style(a, c, d) : f.css(a, c) }) }, f.extend({ cssHooks: { opacity: { get: function (a, b) { if (b) { var c = bx(a, "opacity", "opacity"); return c === "" ? "1" : c } return a.style.opacity } } }, cssNumber: { zIndex: !0, fontWeight: !0, opacity: !0, zoom: !0, lineHeight: !0, widows: !0, orphans: !0 }, cssProps: { "float": f.support.cssFloat ? "cssFloat" : "styleFloat" }, style: function (a, c, d, e) { if (!!a && a.nodeType !== 3 && a.nodeType !== 8 && !!a.style) { var g, h, i = f.camelCase(c), j = a.style, k = f.cssHooks[i]; c = f.cssProps[i] || i; if (d === b) { if (k && "get" in k && (g = k.get(a, !1, e)) !== b) return g; return j[c] } h = typeof d; if (h === "number" && isNaN(d) || d == null) return; h === "string" && bs.test(d) && (d = +d.replace(bt, "") + parseFloat(f.css(a, c))), h === "number" && !f.cssNumber[i] && (d += "px"); if (!k || !("set" in k) || (d = k.set(a, d)) !== b) try { j[c] = d } catch (l) { } } }, css: function (a, c, d) { var e, g; c = f.camelCase(c), g = f.cssHooks[c], c = f.cssProps[c] || c, c === "cssFloat" && (c = "float"); if (g && "get" in g && (e = g.get(a, !0, d)) !== b) return e; if (bx) return bx(a, c) }, swap: function (a, b, c) { var d = {}; for (var e in b) d[e] = a.style[e], a.style[e] = b[e]; c.call(a); for (e in b) a.style[e] = d[e] }, camelCase: function (a) { return a.replace(bo, bA) } }), f.curCSS = f.css, f.each(["height", "width"], function (a, b) { f.cssHooks[b] = { get: function (a, c, d) { var e; if (c) { a.offsetWidth !== 0 ? e = bB(a, b, d) : f.swap(a, bu, function () { e = bB(a, b, d) }); if (e <= 0) { e = bx(a, b, b), e === "0px" && bz && (e = bz(a, b, b)); if (e != null) return e === "" || e === "auto" ? "0px" : e } if (e < 0 || e == null) { e = a.style[b]; return e === "" || e === "auto" ? "0px" : e } return typeof e == "string" ? e : e + "px" } }, set: function (a, b) { if (!bq.test(b)) return b; b = parseFloat(b); if (b >= 0) return b + "px" } } }), f.support.opacity || (f.cssHooks.opacity = { get: function (a, b) { return bn.test((b && a.currentStyle ? a.currentStyle.filter : a.style.filter) || "") ? parseFloat(RegExp.$1) / 100 + "" : b ? "1" : "" }, set: function (a, b) { var c = a.style, d = a.currentStyle; c.zoom = 1; var e = f.isNaN(b) ? "" : "alpha(opacity=" + b * 100 + ")", g = d && d.filter || c.filter || ""; c.filter = bm.test(g) ? g.replace(bm, e) : g + " " + e } }), f(function () { f.support.reliableMarginRight || (f.cssHooks.marginRight = { get: function (a, b) { var c; f.swap(a, { display: "inline-block" }, function () { b ? c = bx(a, "margin-right", "marginRight") : c = a.style.marginRight }); return c } }) }), c.defaultView && c.defaultView.getComputedStyle && (by = function (a, c) { var d, e, g; c = c.replace(bp, "-$1").toLowerCase(); if (!(e = a.ownerDocument.defaultView)) return b; if (g = e.getComputedStyle(a, null)) d = g.getPropertyValue(c), d === "" && !f.contains(a.ownerDocument.documentElement, a) && (d = f.style(a, c)); return d }), c.documentElement.currentStyle && (bz = function (a, b) { var c, d = a.currentStyle && a.currentStyle[b], e = a.runtimeStyle && a.runtimeStyle[b], f = a.style; !bq.test(d) && br.test(d) && (c = f.left, e && (a.runtimeStyle.left = a.currentStyle.left), f.left = b === "fontSize" ? "1em" : d || 0, d = f.pixelLeft + "px", f.left = c, e && (a.runtimeStyle.left = e)); return d === "" ? "auto" : d }), bx = by || bz, f.expr && f.expr.filters && (f.expr.filters.hidden = function (a) { var b = a.offsetWidth, c = a.offsetHeight; return b === 0 && c === 0 || !f.support.reliableHiddenOffsets && (a.style.display || f.css(a, "display")) === "none" }, f.expr.filters.visible = function (a) { return !f.expr.filters.hidden(a) }); var bC = /%20/g, bD = /\[\]$/, bE = /\r?\n/g, bF = /#.*$/, bG = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, bH = /^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i, bI = /^(?:about|app|app\-storage|.+\-extension|file|widget):$/, bJ = /^(?:GET|HEAD)$/, bK = /^\/\//, bL = /\?/, bM = /)<[^<]*)*<\/script>/gi, bN = /^(?:select|textarea)/i, bO = /\s+/, bP = /([?&])_=[^&]*/, bQ = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/, bR = f.fn.load, bS = {}, bT = {}, bU, bV; try { bU = e.href } catch (bW) { bU = c.createElement("a"), bU.href = "", bU = bU.href } bV = bQ.exec(bU.toLowerCase()) || [], f.fn.extend({ load: function (a, c, d) { if (typeof a != "string" && bR) return bR.apply(this, arguments); if (!this.length) return this; var e = a.indexOf(" "); if (e >= 0) { var g = a.slice(e, a.length); a = a.slice(0, e) } var h = "GET"; c && (f.isFunction(c) ? (d = c, c = b) : typeof c == "object" && (c = f.param(c, f.ajaxSettings.traditional), h = "POST")); var i = this; f.ajax({ url: a, type: h, dataType: "html", data: c, complete: function (a, b, c) { c = a.responseText, a.isResolved() && (a.done(function (a) { c = a }), i.html(g ? f("
    ").append(c.replace(bM, "")).find(g) : c)), d && i.each(d, [c, b, a]) } }); return this }, serialize: function () { return f.param(this.serializeArray()) }, serializeArray: function () { return this.map(function () { return this.elements ? f.makeArray(this.elements) : this }).filter(function () { return this.name && !this.disabled && (this.checked || bN.test(this.nodeName) || bH.test(this.type)) }).map(function (a, b) { var c = f(this).val(); return c == null ? null : f.isArray(c) ? f.map(c, function (a, c) { return { name: b.name, value: a.replace(bE, "\r\n") } }) : { name: b.name, value: c.replace(bE, "\r\n") } }).get() } }), f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "), function (a, b) { f.fn[b] = function (a) { return this.bind(b, a) } }), f.each(["get", "post"], function (a, c) { f[c] = function (a, d, e, g) { f.isFunction(d) && (g = g || e, e = d, d = b); return f.ajax({ type: c, url: a, data: d, success: e, dataType: g }) } }), f.extend({ getScript: function (a, c) { return f.get(a, b, c, "script") }, getJSON: function (a, b, c) { return f.get(a, b, c, "json") }, ajaxSetup: function (a, b) { b ? f.extend(!0, a, f.ajaxSettings, b) : (b = a, a = f.extend(!0, f.ajaxSettings, b)); for (var c in { context: 1, url: 1 }) c in b ? a[c] = b[c] : c in f.ajaxSettings && (a[c] = f.ajaxSettings[c]); return a }, ajaxSettings: { url: bU, isLocal: bI.test(bV[1]), global: !0, type: "GET", contentType: "application/x-www-form-urlencoded", processData: !0, async: !0, accepts: { xml: "application/xml, text/xml", html: "text/html", text: "text/plain", json: "application/json, text/javascript", "*": "*/*" }, contents: { xml: /xml/, html: /html/, json: /json/ }, responseFields: { xml: "responseXML", text: "responseText" }, converters: { "* text": a.String, "text html": !0, "text json": f.parseJSON, "text xml": f.parseXML } }, ajaxPrefilter: bX(bS), ajaxTransport: bX(bT), ajax: function (a, c) { function w(a, c, l, m) { if (s !== 2) { s = 2, q && clearTimeout(q), p = b, n = m || "", v.readyState = a ? 4 : 0; var o, r, u, w = l ? b$(d, v, l) : b, x, y; if (a >= 200 && a < 300 || a === 304) { if (d.ifModified) { if (x = v.getResponseHeader("Last-Modified")) f.lastModified[k] = x; if (y = v.getResponseHeader("Etag")) f.etag[k] = y } if (a === 304) c = "notmodified", o = !0; else try { r = b_(d, w), c = "success", o = !0 } catch (z) { c = "parsererror", u = z } } else { u = c; if (!c || a) c = "error", a < 0 && (a = 0) } v.status = a, v.statusText = c, o ? h.resolveWith(e, [r, c, v]) : h.rejectWith(e, [v, c, u]), v.statusCode(j), j = b, t && g.trigger("ajax" + (o ? "Success" : "Error"), [v, d, o ? r : u]), i.resolveWith(e, [v, c]), t && (g.trigger("ajaxComplete", [v, d]), --f.active || f.event.trigger("ajaxStop")) } } typeof a == "object" && (c = a, a = b), c = c || {}; var d = f.ajaxSetup({}, c), e = d.context || d, g = e !== d && (e.nodeType || e instanceof f) ? f(e) : f.event, h = f.Deferred(), i = f._Deferred(), j = d.statusCode || {}, k, l = {}, m = {}, n, o, p, q, r, s = 0, t, u, v = { readyState: 0, setRequestHeader: function (a, b) { if (!s) { var c = a.toLowerCase(); a = m[c] = m[c] || a, l[a] = b } return this }, getAllResponseHeaders: function () { return s === 2 ? n : null }, getResponseHeader: function (a) { var c; if (s === 2) { if (!o) { o = {}; while (c = bG.exec(n)) o[c[1].toLowerCase()] = c[2] } c = o[a.toLowerCase()] } return c === b ? null : c }, overrideMimeType: function (a) { s || (d.mimeType = a); return this }, abort: function (a) { a = a || "abort", p && p.abort(a), w(0, a); return this } }; h.promise(v), v.success = v.done, v.error = v.fail, v.complete = i.done, v.statusCode = function (a) { if (a) { var b; if (s < 2) for (b in a) j[b] = [j[b], a[b]]; else b = a[v.status], v.then(b, b) } return this }, d.url = ((a || d.url) + "").replace(bF, "").replace(bK, bV[1] + "//"), d.dataTypes = f.trim(d.dataType || "*").toLowerCase().split(bO), d.crossDomain == null && (r = bQ.exec(d.url.toLowerCase()), d.crossDomain = !(!r || r[1] == bV[1] && r[2] == bV[2] && (r[3] || (r[1] === "http:" ? 80 : 443)) == (bV[3] || (bV[1] === "http:" ? 80 : 443)))), d.data && d.processData && typeof d.data != "string" && (d.data = f.param(d.data, d.traditional)), bY(bS, d, c, v); if (s === 2) return !1; t = d.global, d.type = d.type.toUpperCase(), d.hasContent = !bJ.test(d.type), t && f.active++ === 0 && f.event.trigger("ajaxStart"); if (!d.hasContent) { d.data && (d.url += (bL.test(d.url) ? "&" : "?") + d.data), k = d.url; if (d.cache === !1) { var x = f.now(), y = d.url.replace(bP, "$1_=" + x); d.url = y + (y === d.url ? (bL.test(d.url) ? "&" : "?") + "_=" + x : "") } } (d.data && d.hasContent && d.contentType !== !1 || c.contentType) && v.setRequestHeader("Content-Type", d.contentType), d.ifModified && (k = k || d.url, f.lastModified[k] && v.setRequestHeader("If-Modified-Since", f.lastModified[k]), f.etag[k] && v.setRequestHeader("If-None-Match", f.etag[k])), v.setRequestHeader("Accept", d.dataTypes[0] && d.accepts[d.dataTypes[0]] ? d.accepts[d.dataTypes[0]] + (d.dataTypes[0] !== "*" ? ", */*; q=0.01" : "") : d.accepts["*"]); for (u in d.headers) v.setRequestHeader(u, d.headers[u]); if (d.beforeSend && (d.beforeSend.call(e, v, d) === !1 || s === 2)) { v.abort(); return !1 } for (u in { success: 1, error: 1, complete: 1 }) v[u](d[u]); p = bY(bT, d, c, v); if (!p) w(-1, "No Transport"); else { v.readyState = 1, t && g.trigger("ajaxSend", [v, d]), d.async && d.timeout > 0 && (q = setTimeout(function () { v.abort("timeout") }, d.timeout)); try { s = 1, p.send(l, w) } catch (z) { status < 2 ? w(-1, z) : f.error(z) } } return v }, param: function (a, c) { var d = [], e = function (a, b) { b = f.isFunction(b) ? b() : b, d[d.length] = encodeURIComponent(a) + "=" + encodeURIComponent(b) }; c === b && (c = f.ajaxSettings.traditional); if (f.isArray(a) || a.jquery && !f.isPlainObject(a)) f.each(a, function () { e(this.name, this.value) }); else for (var g in a) bZ(g, a[g], c, e); return d.join("&").replace(bC, "+") } }), f.extend({ active: 0, lastModified: {}, etag: {} }); var ca = f.now(), cb = /(\=)\?(&|$)|\?\?/i; f.ajaxSetup({ jsonp: "callback", jsonpCallback: function () { return f.expando + "_" + ca++ } }), f.ajaxPrefilter("json jsonp", function (b, c, d) { var e = b.contentType === "application/x-www-form-urlencoded" && typeof b.data == "string"; if (b.dataTypes[0] === "jsonp" || b.jsonp !== !1 && (cb.test(b.url) || e && cb.test(b.data))) { var g, h = b.jsonpCallback = f.isFunction(b.jsonpCallback) ? b.jsonpCallback() : b.jsonpCallback, i = a[h], j = b.url, k = b.data, l = "$1" + h + "$2"; b.jsonp !== !1 && (j = j.replace(cb, l), b.url === j && (e && (k = k.replace(cb, l)), b.data === k && (j += (/\?/.test(j) ? "&" : "?") + b.jsonp + "=" + h))), b.url = j, b.data = k, a[h] = function (a) { g = [a] }, d.always(function () { a[h] = i, g && f.isFunction(i) && a[h](g[0]) }), b.converters["script json"] = function () { g || f.error(h + " was not called"); return g[0] }, b.dataTypes[0] = "json"; return "script" } }), f.ajaxSetup({ accepts: { script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" }, contents: { script: /javascript|ecmascript/ }, converters: { "text script": function (a) { f.globalEval(a); return a } } }), f.ajaxPrefilter("script", function (a) { a.cache === b && (a.cache = !1), a.crossDomain && (a.type = "GET", a.global = !1) }), f.ajaxTransport("script", function (a) { if (a.crossDomain) { var d, e = c.head || c.getElementsByTagName("head")[0] || c.documentElement; return { send: function (f, g) { d = c.createElement("script"), d.async = "async", a.scriptCharset && (d.charset = a.scriptCharset), d.src = a.url, d.onload = d.onreadystatechange = function (a, c) { if (c || !d.readyState || /loaded|complete/.test(d.readyState)) d.onload = d.onreadystatechange = null, e && d.parentNode && e.removeChild(d), d = b, c || g(200, "success") }, e.insertBefore(d, e.firstChild) }, abort: function () { d && d.onload(0, 1) } } } }); var cc = a.ActiveXObject ? function () { for (var a in ce) ce[a](0, 1) } : !1, cd = 0, ce; f.ajaxSettings.xhr = a.ActiveXObject ? function () { return !this.isLocal && cf() || cg() } : cf, function (a) { f.extend(f.support, { ajax: !!a, cors: !!a && "withCredentials" in a }) }(f.ajaxSettings.xhr()), f.support.ajax && f.ajaxTransport(function (c) { if (!c.crossDomain || f.support.cors) { var d; return { send: function (e, g) { var h = c.xhr(), i, j; c.username ? h.open(c.type, c.url, c.async, c.username, c.password) : h.open(c.type, c.url, c.async); if (c.xhrFields) for (j in c.xhrFields) h[j] = c.xhrFields[j]; c.mimeType && h.overrideMimeType && h.overrideMimeType(c.mimeType), !c.crossDomain && !e["X-Requested-With"] && (e["X-Requested-With"] = "XMLHttpRequest"); try { for (j in e) h.setRequestHeader(j, e[j]) } catch (k) { } h.send(c.hasContent && c.data || null), d = function (a, e) { var j, k, l, m, n; try { if (d && (e || h.readyState === 4)) { d = b, i && (h.onreadystatechange = f.noop, cc && delete ce[i]); if (e) h.readyState !== 4 && h.abort(); else { j = h.status, l = h.getAllResponseHeaders(), m = {}, n = h.responseXML, n && n.documentElement && (m.xml = n), m.text = h.responseText; try { k = h.statusText } catch (o) { k = "" } !j && c.isLocal && !c.crossDomain ? j = m.text ? 200 : 404 : j === 1223 && (j = 204) } } } catch (p) { e || g(-1, p) } m && g(j, k, m, l) }, !c.async || h.readyState === 4 ? d() : (i = ++cd, cc && (ce || (ce = {}, f(a).unload(cc)), ce[i] = d), h.onreadystatechange = d) }, abort: function () { d && d(0, 1) } } } }); var ch = {}, ci, cj, ck = /^(?:toggle|show|hide)$/, cl = /^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i, cm, cn = [["height", "marginTop", "marginBottom", "paddingTop", "paddingBottom"], ["width", "marginLeft", "marginRight", "paddingLeft", "paddingRight"], ["opacity"]], co, cp = a.webkitRequestAnimationFrame || a.mozRequestAnimationFrame || a.oRequestAnimationFrame; f.fn.extend({ show: function (a, b, c) { var d, e; if (a || a === 0) return this.animate(cs("show", 3), a, b, c); for (var g = 0, h = this.length; g < h; g++)d = this[g], d.style && (e = d.style.display, !f._data(d, "olddisplay") && e === "none" && (e = d.style.display = ""), e === "" && f.css(d, "display") === "none" && f._data(d, "olddisplay", ct(d.nodeName))); for (g = 0; g < h; g++) { d = this[g]; if (d.style) { e = d.style.display; if (e === "" || e === "none") d.style.display = f._data(d, "olddisplay") || "" } } return this }, hide: function (a, b, c) { if (a || a === 0) return this.animate(cs("hide", 3), a, b, c); for (var d = 0, e = this.length; d < e; d++)if (this[d].style) { var g = f.css(this[d], "display"); g !== "none" && !f._data(this[d], "olddisplay") && f._data(this[d], "olddisplay", g) } for (d = 0; d < e; d++)this[d].style && (this[d].style.display = "none"); return this }, _toggle: f.fn.toggle, toggle: function (a, b, c) { var d = typeof a == "boolean"; f.isFunction(a) && f.isFunction(b) ? this._toggle.apply(this, arguments) : a == null || d ? this.each(function () { var b = d ? a : f(this).is(":hidden"); f(this)[b ? "show" : "hide"]() }) : this.animate(cs("toggle", 3), a, b, c); return this }, fadeTo: function (a, b, c, d) { return this.filter(":hidden").css("opacity", 0).show().end().animate({ opacity: b }, a, c, d) }, animate: function (a, b, c, d) { var e = f.speed(b, c, d); if (f.isEmptyObject(a)) return this.each(e.complete, [!1]); return this[e.queue === !1 ? "each" : "queue"](function () { e.queue === !1 && f._mark(this); var b = f.extend({}, e), c = this.nodeType === 1, d = c && f(this).is(":hidden"), g, h, i, j, k, l, m, n, o; b.animatedProperties = {}; for (i in a) { g = f.camelCase(i), i !== g && (a[g] = a[i], delete a[i]), h = a[g]; if (h === "hide" && d || h === "show" && !d) return b.complete.call(this); c && (g === "height" || g === "width") && (b.overflow = [this.style.overflow, this.style.overflowX, this.style.overflowY], f.css(this, "display") === "inline" && f.css(this, "float") === "none" && (f.support.inlineBlockNeedsLayout ? (j = ct(this.nodeName), j === "inline" ? this.style.display = "inline-block" : (this.style.display = "inline", this.style.zoom = 1)) : this.style.display = "inline-block")), b.animatedProperties[g] = f.isArray(h) ? h[1] : b.specialEasing && b.specialEasing[g] || b.easing || "swing" } b.overflow != null && (this.style.overflow = "hidden"); for (i in a) k = new f.fx(this, b, i), h = a[i], ck.test(h) ? k[h === "toggle" ? d ? "show" : "hide" : h]() : (l = cl.exec(h), m = k.cur(), l ? (n = parseFloat(l[2]), o = l[3] || (f.cssNumber[g] ? "" : "px"), o !== "px" && (f.style(this, i, (n || 1) + o), m = (n || 1) / k.cur() * m, f.style(this, i, m + o)), l[1] && (n = (l[1] === "-=" ? -1 : 1) * n + m), k.custom(m, n, o)) : k.custom(m, h, "")); return !0 }) }, stop: function (a, b) { a && this.queue([]), this.each(function () { var a = f.timers, c = a.length; b || f._unmark(!0, this); while (c--) a[c].elem === this && (b && a[c](!0), a.splice(c, 1)) }), b || this.dequeue(); return this } }), f.each({ slideDown: cs("show", 1), slideUp: cs("hide", 1), slideToggle: cs("toggle", 1), fadeIn: { opacity: "show" }, fadeOut: { opacity: "hide" }, fadeToggle: { opacity: "toggle" } }, function (a, b) { f.fn[a] = function (a, c, d) { return this.animate(b, a, c, d) } }), f.extend({ speed: function (a, b, c) { var d = a && typeof a == "object" ? f.extend({}, a) : { complete: c || !c && b || f.isFunction(a) && a, duration: a, easing: c && b || b && !f.isFunction(b) && b }; d.duration = f.fx.off ? 0 : typeof d.duration == "number" ? d.duration : d.duration in f.fx.speeds ? f.fx.speeds[d.duration] : f.fx.speeds._default, d.old = d.complete, d.complete = function (a) { d.queue !== !1 ? f.dequeue(this) : a !== !1 && f._unmark(this), f.isFunction(d.old) && d.old.call(this) }; return d }, easing: { linear: function (a, b, c, d) { return c + d * a }, swing: function (a, b, c, d) { return (-Math.cos(a * Math.PI) / 2 + .5) * d + c } }, timers: [], fx: function (a, b, c) { this.options = b, this.elem = a, this.prop = c, b.orig = b.orig || {} } }), f.fx.prototype = { update: function () { this.options.step && this.options.step.call(this.elem, this.now, this), (f.fx.step[this.prop] || f.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, b = f.css(this.elem, this.prop); return isNaN(a = parseFloat(b)) ? !b || b === "auto" ? 0 : b : a }, custom: function (a, b, c) { function h(a) { return d.step(a) } var d = this, e = f.fx, g; this.startTime = co || cq(), this.start = a, this.end = b, this.unit = c || this.unit || (f.cssNumber[this.prop] ? "" : "px"), this.now = this.start, this.pos = this.state = 0, h.elem = this.elem, h() && f.timers.push(h) && !cm && (cp ? (cm = 1, g = function () { cm && (cp(g), e.tick()) }, cp(g)) : cm = setInterval(e.tick, e.interval)) }, show: function () { this.options.orig[this.prop] = f.style(this.elem, this.prop), this.options.show = !0, this.custom(this.prop === "width" || this.prop === "height" ? 1 : 0, this.cur()), f(this.elem).show() }, hide: function () { this.options.orig[this.prop] = f.style(this.elem, this.prop), this.options.hide = !0, this.custom(this.cur(), 0) }, step: function (a) { var b = co || cq(), c = !0, d = this.elem, e = this.options, g, h; if (a || b >= e.duration + this.startTime) { this.now = this.end, this.pos = this.state = 1, this.update(), e.animatedProperties[this.prop] = !0; for (g in e.animatedProperties) e.animatedProperties[g] !== !0 && (c = !1); if (c) { e.overflow != null && !f.support.shrinkWrapBlocks && f.each(["", "X", "Y"], function (a, b) { d.style["overflow" + b] = e.overflow[a] }), e.hide && f(d).hide(); if (e.hide || e.show) for (var i in e.animatedProperties) f.style(d, i, e.orig[i]); e.complete.call(d) } return !1 } e.duration == Infinity ? this.now = b : (h = b - this.startTime, this.state = h / e.duration, this.pos = f.easing[e.animatedProperties[this.prop]](this.state, h, 0, 1, e.duration), this.now = this.start + (this.end - this.start) * this.pos), this.update(); return !0 } }, f.extend(f.fx, { tick: function () { var a = f.timers, b = a.length; while (b--) a[b]() || a.splice(b, 1); a.length || f.fx.stop() }, interval: 13, stop: function () { clearInterval(cm), cm = null }, speeds: { slow: 600, fast: 200, _default: 400 }, step: { opacity: function (a) { f.style(a.elem, "opacity", a.now) }, _default: function (a) { a.elem.style && a.elem.style[a.prop] != null ? a.elem.style[a.prop] = (a.prop === "width" || a.prop === "height" ? Math.max(0, a.now) : a.now) + a.unit : a.elem[a.prop] = a.now } } }), f.expr && f.expr.filters && (f.expr.filters.animated = function (a) { return f.grep(f.timers, function (b) { return a === b.elem }).length }); var cu = /^t(?:able|d|h)$/i, cv = /^(?:body|html)$/i; "getBoundingClientRect" in c.documentElement ? f.fn.offset = function (a) { var b = this[0], c; if (a) return this.each(function (b) { f.offset.setOffset(this, a, b) }); if (!b || !b.ownerDocument) return null; if (b === b.ownerDocument.body) return f.offset.bodyOffset(b); try { c = b.getBoundingClientRect() } catch (d) { } var e = b.ownerDocument, g = e.documentElement; if (!c || !f.contains(g, b)) return c ? { top: c.top, left: c.left } : { top: 0, left: 0 }; var h = e.body, i = cw(e), j = g.clientTop || h.clientTop || 0, k = g.clientLeft || h.clientLeft || 0, l = i.pageYOffset || f.support.boxModel && g.scrollTop || h.scrollTop, m = i.pageXOffset || f.support.boxModel && g.scrollLeft || h.scrollLeft, n = c.top + l - j, o = c.left + m - k; return { top: n, left: o } } : f.fn.offset = function (a) { var b = this[0]; if (a) return this.each(function (b) { f.offset.setOffset(this, a, b) }); if (!b || !b.ownerDocument) return null; if (b === b.ownerDocument.body) return f.offset.bodyOffset(b); f.offset.initialize(); var c, d = b.offsetParent, e = b, g = b.ownerDocument, h = g.documentElement, i = g.body, j = g.defaultView, k = j ? j.getComputedStyle(b, null) : b.currentStyle, l = b.offsetTop, m = b.offsetLeft; while ((b = b.parentNode) && b !== i && b !== h) { if (f.offset.supportsFixedPosition && k.position === "fixed") break; c = j ? j.getComputedStyle(b, null) : b.currentStyle, l -= b.scrollTop, m -= b.scrollLeft, b === d && (l += b.offsetTop, m += b.offsetLeft, f.offset.doesNotAddBorder && (!f.offset.doesAddBorderForTableAndCells || !cu.test(b.nodeName)) && (l += parseFloat(c.borderTopWidth) || 0, m += parseFloat(c.borderLeftWidth) || 0), e = d, d = b.offsetParent), f.offset.subtractsBorderForOverflowNotVisible && c.overflow !== "visible" && (l += parseFloat(c.borderTopWidth) || 0, m += parseFloat(c.borderLeftWidth) || 0), k = c } if (k.position === "relative" || k.position === "static") l += i.offsetTop, m += i.offsetLeft; f.offset.supportsFixedPosition && k.position === "fixed" && (l += Math.max(h.scrollTop, i.scrollTop), m += Math.max(h.scrollLeft, i.scrollLeft)); return { top: l, left: m } }, f.offset = { initialize: function () { var a = c.body, b = c.createElement("div"), d, e, g, h, i = parseFloat(f.css(a, "marginTop")) || 0, j = "
    "; f.extend(b.style, { position: "absolute", top: 0, left: 0, margin: 0, border: 0, width: "1px", height: "1px", visibility: "hidden" }), b.innerHTML = j, a.insertBefore(b, a.firstChild), d = b.firstChild, e = d.firstChild, h = d.nextSibling.firstChild.firstChild, this.doesNotAddBorder = e.offsetTop !== 5, this.doesAddBorderForTableAndCells = h.offsetTop === 5, e.style.position = "fixed", e.style.top = "20px", this.supportsFixedPosition = e.offsetTop === 20 || e.offsetTop === 15, e.style.position = e.style.top = "", d.style.overflow = "hidden", d.style.position = "relative", this.subtractsBorderForOverflowNotVisible = e.offsetTop === -5, this.doesNotIncludeMarginInBodyOffset = a.offsetTop !== i, a.removeChild(b), f.offset.initialize = f.noop }, bodyOffset: function (a) { var b = a.offsetTop, c = a.offsetLeft; f.offset.initialize(), f.offset.doesNotIncludeMarginInBodyOffset && (b += parseFloat(f.css(a, "marginTop")) || 0, c += parseFloat(f.css(a, "marginLeft")) || 0); return { top: b, left: c } }, setOffset: function (a, b, c) { var d = f.css(a, "position"); d === "static" && (a.style.position = "relative"); var e = f(a), g = e.offset(), h = f.css(a, "top"), i = f.css(a, "left"), j = (d === "absolute" || d === "fixed") && f.inArray("auto", [h, i]) > -1, k = {}, l = {}, m, n; j ? (l = e.position(), m = l.top, n = l.left) : (m = parseFloat(h) || 0, n = parseFloat(i) || 0), f.isFunction(b) && (b = b.call(a, c, g)), b.top != null && (k.top = b.top - g.top + m), b.left != null && (k.left = b.left - g.left + n), "using" in b ? b.using.call(a, k) : e.css(k) } }, f.fn.extend({ position: function () { if (!this[0]) return null; var a = this[0], b = this.offsetParent(), c = this.offset(), d = cv.test(b[0].nodeName) ? { top: 0, left: 0 } : b.offset(); c.top -= parseFloat(f.css(a, "marginTop")) || 0, c.left -= parseFloat(f.css(a, "marginLeft")) || 0, d.top += parseFloat(f.css(b[0], "borderTopWidth")) || 0, d.left += parseFloat(f.css(b[0], "borderLeftWidth")) || 0; return { top: c.top - d.top, left: c.left - d.left } }, offsetParent: function () { return this.map(function () { var a = this.offsetParent || c.body; while (a && !cv.test(a.nodeName) && f.css(a, "position") === "static") a = a.offsetParent; return a }) } }), f.each(["Left", "Top"], function (a, c) { var d = "scroll" + c; f.fn[d] = function (c) { var e, g; if (c === b) { e = this[0]; if (!e) return null; g = cw(e); return g ? "pageXOffset" in g ? g[a ? "pageYOffset" : "pageXOffset"] : f.support.boxModel && g.document.documentElement[d] || g.document.body[d] : e[d] } return this.each(function () { g = cw(this), g ? g.scrollTo(a ? f(g).scrollLeft() : c, a ? c : f(g).scrollTop()) : this[d] = c }) } }), f.each(["Height", "Width"], function (a, c) { var d = c.toLowerCase(); f.fn["inner" + c] = function () { return this[0] ? parseFloat(f.css(this[0], d, "padding")) : null }, f.fn["outer" + c] = function (a) { return this[0] ? parseFloat(f.css(this[0], d, a ? "margin" : "border")) : null }, f.fn[d] = function (a) { var e = this[0]; if (!e) return a == null ? null : this; if (f.isFunction(a)) return this.each(function (b) { var c = f(this); c[d](a.call(this, b, c[d]())) }); if (f.isWindow(e)) { var g = e.document.documentElement["client" + c]; return e.document.compatMode === "CSS1Compat" && g || e.document.body["client" + c] || g } if (e.nodeType === 9) return Math.max(e.documentElement["client" + c], e.body["scroll" + c], e.documentElement["scroll" + c], e.body["offset" + c], e.documentElement["offset" + c]); if (a === b) { var h = f.css(e, d), i = parseFloat(h); return f.isNaN(i) ? h : i } return this.css(d, typeof a == "string" ? a : a + "px") } }), a.jQuery = a.$ = f })(window); \ No newline at end of file diff --git a/cadline/backend/maintenance/js/jquery.ticker.js b/cadline/backend/maintenance/js/jquery.ticker.js deleted file mode 100644 index 1516cc4a..00000000 --- a/cadline/backend/maintenance/js/jquery.ticker.js +++ /dev/null @@ -1,427 +0,0 @@ -/* - jQuery News Ticker is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, version 2 of the License. - - jQuery News Ticker is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with jQuery News Ticker. If not, see . -*/ -(function ($) { - $.fn.ticker = function (options) { - // Extend our default options with those provided. - // Note that the first arg to extend is an empty object - - // this is to keep from overriding our "defaults" object. - var opts = $.extend({}, $.fn.ticker.defaults, options); - - // check that the passed element is actually in the DOM - if ($(this).length == 0) { - if (window.console && window.console.log) { - window.console.log('Element does not exist in DOM!'); - } - else { - alert('Element does not exist in DOM!'); - } - return false; - } - - /* Get the id of the UL to get our news content from */ - var newsID = '#' + $(this).attr('id'); - - /* Get the tag type - we will check this later to makde sure it is a UL tag */ - var tagType = $(this).get(0).tagName; - - return this.each(function () { - // get a unique id for this ticker - var uniqID = getUniqID(); - - /* Internal vars */ - var settings = { - position: 0, - time: 0, - distance: 0, - newsArr: {}, - play: true, - paused: false, - contentLoaded: false, - dom: { - contentID: '#ticker-content-' + uniqID, - titleID: '#ticker-title-' + uniqID, - titleElem: '#ticker-title-' + uniqID + ' SPAN', - tickerID: '#ticker-' + uniqID, - wrapperID: '#ticker-wrapper-' + uniqID, - revealID: '#ticker-swipe-' + uniqID, - revealElem: '#ticker-swipe-' + uniqID + ' SPAN', - controlsID: '#ticker-controls-' + uniqID, - prevID: '#prev-' + uniqID, - nextID: '#next-' + uniqID, - playPauseID: '#play-pause-' + uniqID - } - }; - - // if we are not using a UL, display an error message and stop any further execution - if (tagType != 'UL' && tagType != 'OL' && opts.htmlFeed === true) { - debugError('Cannot use <' + tagType.toLowerCase() + '> type of element for this plugin - must of type
      or
        '); - return false; - } - - // set the ticker direction - opts.direction == 'rtl' ? opts.direction = 'right' : opts.direction = 'left'; - - // lets go... - initialisePage(); - /* Function to get the size of an Object*/ - function countSize(obj) { - var size = 0, key; - for (key in obj) { - if (obj.hasOwnProperty(key)) size++; - } - return size; - }; - - function getUniqID() { - var newDate = new Date; - return newDate.getTime(); - } - - /* Function for handling debug and error messages */ - function debugError(obj) { - if (opts.debugMode) { - if (window.console && window.console.log) { - window.console.log(obj); - } - else { - alert(obj); - } - } - } - - /* Function to setup the page */ - function initialisePage() { - // process the content for this ticker - processContent(); - - // add our HTML structure for the ticker to the DOM - $(newsID).wrap('
        '); - - // remove any current content inside this ticker - $(settings.dom.wrapperID).children().remove(); - - $(settings.dom.wrapperID).append('

        '); - $(settings.dom.wrapperID).removeClass('no-js').addClass('ticker-wrapper has-js ' + opts.direction); - // hide the ticker - $(settings.dom.tickerElem + ',' + settings.dom.contentID).hide(); - // add the controls to the DOM if required - if (opts.controls) { - // add related events - set functions to run on given event - $(settings.dom.controlsID).live('click mouseover mousedown mouseout mouseup', function (e) { - var button = e.target.id; - if (e.type == 'click') { - switch (button) { - case settings.dom.prevID.replace('#', ''): - // show previous item - settings.paused = true; - $(settings.dom.playPauseID).addClass('paused'); - manualChangeContent('prev'); - break; - case settings.dom.nextID.replace('#', ''): - // show next item - settings.paused = true; - $(settings.dom.playPauseID).addClass('paused'); - manualChangeContent('next'); - break; - case settings.dom.playPauseID.replace('#', ''): - // play or pause the ticker - if (settings.play == true) { - settings.paused = true; - $(settings.dom.playPauseID).addClass('paused'); - pauseTicker(); - } - else { - settings.paused = false; - $(settings.dom.playPauseID).removeClass('paused'); - restartTicker(); - } - break; - } - } - else if (e.type == 'mouseover' && $('#' + button).hasClass('controls')) { - $('#' + button).addClass('over'); - } - else if (e.type == 'mousedown' && $('#' + button).hasClass('controls')) { - $('#' + button).addClass('down'); - } - else if (e.type == 'mouseup' && $('#' + button).hasClass('controls')) { - $('#' + button).removeClass('down'); - } - else if (e.type == 'mouseout' && $('#' + button).hasClass('controls')) { - $('#' + button).removeClass('over'); - } - }); - // add controls HTML to DOM - $(settings.dom.wrapperID).append('
        '); - } - if (opts.displayType != 'fade') { - // add mouse over on the content - $(settings.dom.contentID).mouseover(function () { - if (settings.paused == false) { - pauseTicker(); - } - }).mouseout(function () { - if (settings.paused == false) { - restartTicker(); - } - }); - } - // we may have to wait for the ajax call to finish here - if (!opts.ajaxFeed) { - setupContentAndTriggerDisplay(); - } - } - - /* Start to process the content for this ticker */ - function processContent() { - // check to see if we need to load content - if (settings.contentLoaded == false) { - // construct content - if (opts.ajaxFeed) { - if (opts.feedType == 'xml') { - $.ajax({ - url: opts.feedUrl, - cache: false, - dataType: opts.feedType, - async: true, - success: function (data) { - count = 0; - // get the 'root' node - for (var a = 0; a < data.childNodes.length; a++) { - if (data.childNodes[a].nodeName == 'rss') { - xmlContent = data.childNodes[a]; - } - } - // find the channel node - for (var i = 0; i < xmlContent.childNodes.length; i++) { - if (xmlContent.childNodes[i].nodeName == 'channel') { - xmlChannel = xmlContent.childNodes[i]; - } - } - // for each item create a link and add the article title as the link text - for (var x = 0; x < xmlChannel.childNodes.length; x++) { - if (xmlChannel.childNodes[x].nodeName == 'item') { - xmlItems = xmlChannel.childNodes[x]; - var title, link = false; - for (var y = 0; y < xmlItems.childNodes.length; y++) { - if (xmlItems.childNodes[y].nodeName == 'title') { - title = xmlItems.childNodes[y].lastChild.nodeValue; - } - else if (xmlItems.childNodes[y].nodeName == 'link') { - link = xmlItems.childNodes[y].lastChild.nodeValue; - } - if ((title !== false && title != '') && link !== false) { - settings.newsArr['item-' + count] = { type: opts.titleText, content: '' + title + '' }; count++; title = false; link = false; - } - } - } - } - // quick check here to see if we actually have any content - log error if not - if (countSize(settings.newsArr < 1)) { - debugError('Couldn\'t find any content from the XML feed for the ticker to use!'); - return false; - } - settings.contentLoaded = true; - setupContentAndTriggerDisplay(); - } - }); - } - else { - debugError('Code Me!'); - } - } - else if (opts.htmlFeed) { - if ($(newsID + ' LI').length > 0) { - $(newsID + ' LI').each(function (i) { - // maybe this could be one whole object and not an array of objects? - settings.newsArr['item-' + i] = { type: opts.titleText, content: $(this).html() }; - }); - } - else { - debugError('Couldn\'t find HTML any content for the ticker to use!'); - return false; - } - } - else { - debugError('The ticker is set to not use any types of content! Check the settings for the ticker.'); - return false; - } - } - } - - function setupContentAndTriggerDisplay() { - - settings.contentLoaded = true; - - // update the ticker content with the correct item - // insert news content into DOM - $(settings.dom.titleElem).html(settings.newsArr['item-' + settings.position].type); - $(settings.dom.contentID).html(settings.newsArr['item-' + settings.position].content); - - // set the next content item to be used - loop round if we are at the end of the content - if (settings.position == (countSize(settings.newsArr) - 1)) { - settings.position = 0; - } - else { - settings.position++; - } - - // get the values of content and set the time of the reveal (so all reveals have the same speed regardless of content size) - distance = $(settings.dom.contentID).width(); - time = distance / opts.speed; - - // start the ticker animation - revealContent(); - } - - // slide back cover or fade in content - function revealContent() { - $(settings.dom.contentID).css('opacity', '1'); - if (settings.play) { - // get the width of the title element to offset the content and reveal - var offset = $(settings.dom.titleID).width() + 20; - - $(settings.dom.revealID).css(opts.direction, offset + 'px'); - // show the reveal element and start the animation - if (opts.displayType == 'fade') { - // fade in effect ticker - $(settings.dom.revealID).hide(0, function () { - $(settings.dom.contentID).css(opts.direction, offset + 'px').fadeIn(opts.fadeInSpeed, postReveal); - }); - } - else if (opts.displayType == 'scroll') { - // to code - } - else { - // default bbc scroll effect - $(settings.dom.revealElem).show(0, function () { - $(settings.dom.contentID).css(opts.direction, offset + 'px').show(); - // set our animation direction - animationAction = opts.direction == 'right' ? { marginRight: distance + 'px' } : { marginLeft: distance + 'px' }; - $(settings.dom.revealID).css('margin-' + opts.direction, '0px').delay(20).animate(animationAction, time, 'linear', postReveal); - }); - } - } - else { - return false; - } - }; - - // here we hide the current content and reset the ticker elements to a default state ready for the next ticker item - function postReveal() { - if (settings.play) { - // we have to separately fade the content out here to get around an IE bug - needs further investigation - $(settings.dom.contentID).delay(opts.pauseOnItems).fadeOut(opts.fadeOutSpeed); - // deal with the rest of the content, prepare the DOM and trigger the next ticker - if (opts.displayType == 'fade') { - $(settings.dom.contentID).fadeOut(opts.fadeOutSpeed, function () { - $(settings.dom.wrapperID) - .find(settings.dom.revealElem + ',' + settings.dom.contentID) - .hide() - .end().find(settings.dom.tickerID + ',' + settings.dom.revealID) - .show() - .end().find(settings.dom.tickerID + ',' + settings.dom.revealID) - .removeAttr('style'); - setupContentAndTriggerDisplay(); - }); - } - else { - $(settings.dom.revealID).hide(0, function () { - $(settings.dom.contentID).fadeOut(opts.fadeOutSpeed, function () { - $(settings.dom.wrapperID) - .find(settings.dom.revealElem + ',' + settings.dom.contentID) - .hide() - .end().find(settings.dom.tickerID + ',' + settings.dom.revealID) - .show() - .end().find(settings.dom.tickerID + ',' + settings.dom.revealID) - .removeAttr('style'); - setupContentAndTriggerDisplay(); - }); - }); - } - } - else { - $(settings.dom.revealElem).hide(); - } - } - - // pause ticker - function pauseTicker() { - settings.play = false; - // stop animation and show content - must pass "true, true" to the stop function, or we can get some funky behaviour - $(settings.dom.tickerID + ',' + settings.dom.revealID + ',' + settings.dom.titleID + ',' + settings.dom.titleElem + ',' + settings.dom.revealElem + ',' + settings.dom.contentID).stop(true, true); - $(settings.dom.revealID + ',' + settings.dom.revealElem).hide(); - $(settings.dom.wrapperID) - .find(settings.dom.titleID + ',' + settings.dom.titleElem).show() - .end().find(settings.dom.contentID).show(); - } - - // play ticker - function restartTicker() { - settings.play = true; - settings.paused = false; - // start the ticker again - postReveal(); - } - - // change the content on user input - function manualChangeContent(direction) { - pauseTicker(); - switch (direction) { - case 'prev': - if (settings.position == 0) { - settings.position = countSize(settings.newsArr) - 2; - } - else if (settings.position == 1) { - settings.position = countSize(settings.newsArr) - 1; - } - else { - settings.position = settings.position - 2; - } - $(settings.dom.titleElem).html(settings.newsArr['item-' + settings.position].type); - $(settings.dom.contentID).html(settings.newsArr['item-' + settings.position].content); - break; - case 'next': - $(settings.dom.titleElem).html(settings.newsArr['item-' + settings.position].type); - $(settings.dom.contentID).html(settings.newsArr['item-' + settings.position].content); - break; - } - // set the next content item to be used - loop round if we are at the end of the content - if (settings.position == (countSize(settings.newsArr) - 1)) { - settings.position = 0; - } - else { - settings.position++; - } - } - }); - }; - - // plugin defaults - added as a property on our plugin function - $.fn.ticker.defaults = { - speed: 0.10, - ajaxFeed: false, - feedUrl: '', - feedType: 'xml', - displayType: 'reveal', - htmlFeed: true, - debugMode: true, - controls: true, - titleText: 'Latest', - direction: 'ltr', - pauseOnItems: 3000, - fadeInSpeed: 600, - fadeOutSpeed: 300 - }; -})(jQuery); \ No newline at end of file diff --git a/cadline/backend/maintenance/js/jszip/jszip-utils.js b/cadline/backend/maintenance/js/jszip/jszip-utils.js deleted file mode 100644 index 5f0e34c0..00000000 --- a/cadline/backend/maintenance/js/jszip/jszip-utils.js +++ /dev/null @@ -1,121 +0,0 @@ -/*! - -JSZipUtils - A collection of cross-browser utilities to go along with JSZip. - - -(c) 2014 Stuart Knightley, David Duponchel -Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip-utils/master/LICENSE.markdown. - -*/ -!function (e) { "object" == typeof exports ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : "undefined" != typeof window ? window.JSZipUtils = e() : "undefined" != typeof global ? global.JSZipUtils = e() : "undefined" != typeof self && (self.JSZipUtils = e()) }(function () { - var define, module, exports; return (function e(t, n, r) { function s(o, u) { if (!n[o]) { if (!t[o]) { var a = typeof require == "function" && require; if (!u && a) return a(o, !0); if (i) return i(o, !0); throw new Error("Cannot find module '" + o + "'") } var f = n[o] = { exports: {} }; t[o][0].call(f.exports, function (e) { var n = t[o][1][e]; return s(n ? n : e) }, f, f.exports, e, t, n, r) } return n[o].exports } var i = typeof require == "function" && require; for (var o = 0; o < r.length; o++)s(r[o]); return s })({ - 1: [function (require, module, exports) { - 'use strict'; - - var JSZipUtils = {}; - // just use the responseText with xhr1, response with xhr2. - // The transformation doesn't throw away high-order byte (with responseText) - // because JSZip handles that case. If not used with JSZip, you may need to - // do it, see https://developer.mozilla.org/En/Using_XMLHttpRequest#Handling_binary_data - JSZipUtils._getBinaryFromXHR = function (xhr) { - // for xhr.responseText, the 0xFF mask is applied by JSZip - return xhr.response || xhr.responseText; - }; - - // taken from jQuery - function createStandardXHR() { - try { - return new window.XMLHttpRequest(); - } catch (e) { } - } - - function createActiveXHR() { - try { - return new window.ActiveXObject("Microsoft.XMLHTTP"); - } catch (e) { } - } - - // Create the request object - var createXHR = window.ActiveXObject ? - /* Microsoft failed to properly - * implement the XMLHttpRequest in IE7 (can't request local files), - * so we use the ActiveXObject when it is available - * Additionally XMLHttpRequest can be disabled in IE7/IE8 so - * we need a fallback. - */ - function () { - return createStandardXHR() || createActiveXHR(); - } : - // For all other browsers, use the standard XMLHttpRequest object - createStandardXHR; - - - - JSZipUtils.getBinaryContent = function (path, callback) { - /* - * Here is the tricky part : getting the data. - * In firefox/chrome/opera/... setting the mimeType to 'text/plain; charset=x-user-defined' - * is enough, the result is in the standard xhr.responseText. - * cf https://developer.mozilla.org/En/XMLHttpRequest/Using_XMLHttpRequest#Receiving_binary_data_in_older_browsers - * In IE <= 9, we must use (the IE only) attribute responseBody - * (for binary data, its content is different from responseText). - * In IE 10, the 'charset=x-user-defined' trick doesn't work, only the - * responseType will work : - * http://msdn.microsoft.com/en-us/library/ie/hh673569%28v=vs.85%29.aspx#Binary_Object_upload_and_download - * - * I'd like to use jQuery to avoid this XHR madness, but it doesn't support - * the responseType attribute : http://bugs.jquery.com/ticket/11461 - */ - try { - - var xhr = createXHR(); - - xhr.open('GET', path, true); - - // recent browsers - if ("responseType" in xhr) { - xhr.responseType = "arraybuffer"; - } - - // older browser - if (xhr.overrideMimeType) { - xhr.overrideMimeType("text/plain; charset=x-user-defined"); - } - - xhr.onreadystatechange = function (evt) { - var file, err; - // use `xhr` and not `this`... thanks IE - if (xhr.readyState === 4) { - if (xhr.status === 200 || xhr.status === 0) { - file = null; - err = null; - try { - file = JSZipUtils._getBinaryFromXHR(xhr); - } catch (e) { - err = new Error(e); - } - callback(err, file); - } else { - callback(new Error("Ajax error for " + path + " : " + this.status + " " + this.statusText), null); - } - } - }; - - xhr.send(); - - } catch (e) { - callback(new Error(e), null); - } - }; - - // export - module.exports = JSZipUtils; - - // enforcing Stuk's coding style - // vim: set shiftwidth=4 softtabstop=4: - - }, {}] - }, {}, [1]) - (1) -}); -; \ No newline at end of file diff --git a/cadline/backend/maintenance/js/jszip/jszip.js b/cadline/backend/maintenance/js/jszip/jszip.js deleted file mode 100644 index 8863e56c..00000000 --- a/cadline/backend/maintenance/js/jszip/jszip.js +++ /dev/null @@ -1,11367 +0,0 @@ -/*! - -JSZip v3.5.0 - A JavaScript class for generating and reading zip files - - -(c) 2009-2016 Stuart Knightley -Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/master/LICENSE.markdown. - -JSZip uses the library pako released under the MIT license : -https://github.com/nodeca/pako/blob/master/LICENSE -*/ - -(function (f) { if (typeof exports === "object" && typeof module !== "undefined") { module.exports = f() } else if (typeof define === "function" && define.amd) { define([], f) } else { var g; if (typeof window !== "undefined") { g = window } else if (typeof global !== "undefined") { g = global } else if (typeof self !== "undefined") { g = self } else { g = this } g.JSZip = f() } })(function () { - var define, module, exports; return (function e(t, n, r) { function s(o, u) { if (!n[o]) { if (!t[o]) { var a = typeof require == "function" && require; if (!u && a) return a(o, !0); if (i) return i(o, !0); var f = new Error("Cannot find module '" + o + "'"); throw f.code = "MODULE_NOT_FOUND", f } var l = n[o] = { exports: {} }; t[o][0].call(l.exports, function (e) { var n = t[o][1][e]; return s(n ? n : e) }, l, l.exports, e, t, n, r) } return n[o].exports } var i = typeof require == "function" && require; for (var o = 0; o < r.length; o++)s(r[o]); return s })({ - 1: [function (require, module, exports) { - 'use strict'; - var utils = require('./utils'); - var support = require('./support'); - // private property - var _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; - - - // public method for encoding - exports.encode = function (input) { - var output = []; - var chr1, chr2, chr3, enc1, enc2, enc3, enc4; - var i = 0, len = input.length, remainingBytes = len; - - var isArray = utils.getTypeOf(input) !== "string"; - while (i < input.length) { - remainingBytes = len - i; - - if (!isArray) { - chr1 = input.charCodeAt(i++); - chr2 = i < len ? input.charCodeAt(i++) : 0; - chr3 = i < len ? input.charCodeAt(i++) : 0; - } else { - chr1 = input[i++]; - chr2 = i < len ? input[i++] : 0; - chr3 = i < len ? input[i++] : 0; - } - - enc1 = chr1 >> 2; - enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); - enc3 = remainingBytes > 1 ? (((chr2 & 15) << 2) | (chr3 >> 6)) : 64; - enc4 = remainingBytes > 2 ? (chr3 & 63) : 64; - - output.push(_keyStr.charAt(enc1) + _keyStr.charAt(enc2) + _keyStr.charAt(enc3) + _keyStr.charAt(enc4)); - - } - - return output.join(""); - }; - - // public method for decoding - exports.decode = function (input) { - var chr1, chr2, chr3; - var enc1, enc2, enc3, enc4; - var i = 0, resultIndex = 0; - - var dataUrlPrefix = "data:"; - - if (input.substr(0, dataUrlPrefix.length) === dataUrlPrefix) { - // This is a common error: people give a data url - // (data:image/png;base64,iVBOR...) with a {base64: true} and - // wonders why things don't work. - // We can detect that the string input looks like a data url but we - // *can't* be sure it is one: removing everything up to the comma would - // be too dangerous. - throw new Error("Invalid base64 input, it looks like a data url."); - } - - input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); - - var totalLength = input.length * 3 / 4; - if (input.charAt(input.length - 1) === _keyStr.charAt(64)) { - totalLength--; - } - if (input.charAt(input.length - 2) === _keyStr.charAt(64)) { - totalLength--; - } - if (totalLength % 1 !== 0) { - // totalLength is not an integer, the length does not match a valid - // base64 content. That can happen if: - // - the input is not a base64 content - // - the input is *almost* a base64 content, with a extra chars at the - // beginning or at the end - // - the input uses a base64 variant (base64url for example) - throw new Error("Invalid base64 input, bad content length."); - } - var output; - if (support.uint8array) { - output = new Uint8Array(totalLength | 0); - } else { - output = new Array(totalLength | 0); - } - - while (i < input.length) { - - enc1 = _keyStr.indexOf(input.charAt(i++)); - enc2 = _keyStr.indexOf(input.charAt(i++)); - enc3 = _keyStr.indexOf(input.charAt(i++)); - enc4 = _keyStr.indexOf(input.charAt(i++)); - - chr1 = (enc1 << 2) | (enc2 >> 4); - chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); - chr3 = ((enc3 & 3) << 6) | enc4; - - output[resultIndex++] = chr1; - - if (enc3 !== 64) { - output[resultIndex++] = chr2; - } - if (enc4 !== 64) { - output[resultIndex++] = chr3; - } - - } - - return output; - }; - - }, { "./support": 30, "./utils": 32 }], 2: [function (require, module, exports) { - 'use strict'; - - var external = require("./external"); - var DataWorker = require('./stream/DataWorker'); - var DataLengthProbe = require('./stream/DataLengthProbe'); - var Crc32Probe = require('./stream/Crc32Probe'); - var DataLengthProbe = require('./stream/DataLengthProbe'); - - /** - * Represent a compressed object, with everything needed to decompress it. - * @constructor - * @param {number} compressedSize the size of the data compressed. - * @param {number} uncompressedSize the size of the data after decompression. - * @param {number} crc32 the crc32 of the decompressed file. - * @param {object} compression the type of compression, see lib/compressions.js. - * @param {String|ArrayBuffer|Uint8Array|Buffer} data the compressed data. - */ - function CompressedObject(compressedSize, uncompressedSize, crc32, compression, data) { - this.compressedSize = compressedSize; - this.uncompressedSize = uncompressedSize; - this.crc32 = crc32; - this.compression = compression; - this.compressedContent = data; - } - - CompressedObject.prototype = { - /** - * Create a worker to get the uncompressed content. - * @return {GenericWorker} the worker. - */ - getContentWorker: function () { - var worker = new DataWorker(external.Promise.resolve(this.compressedContent)) - .pipe(this.compression.uncompressWorker()) - .pipe(new DataLengthProbe("data_length")); - - var that = this; - worker.on("end", function () { - if (this.streamInfo['data_length'] !== that.uncompressedSize) { - throw new Error("Bug : uncompressed data size mismatch"); - } - }); - return worker; - }, - /** - * Create a worker to get the compressed content. - * @return {GenericWorker} the worker. - */ - getCompressedWorker: function () { - return new DataWorker(external.Promise.resolve(this.compressedContent)) - .withStreamInfo("compressedSize", this.compressedSize) - .withStreamInfo("uncompressedSize", this.uncompressedSize) - .withStreamInfo("crc32", this.crc32) - .withStreamInfo("compression", this.compression) - ; - } - }; - - /** - * Chain the given worker with other workers to compress the content with the - * given compression. - * @param {GenericWorker} uncompressedWorker the worker to pipe. - * @param {Object} compression the compression object. - * @param {Object} compressionOptions the options to use when compressing. - * @return {GenericWorker} the new worker compressing the content. - */ - CompressedObject.createWorkerFrom = function (uncompressedWorker, compression, compressionOptions) { - return uncompressedWorker - .pipe(new Crc32Probe()) - .pipe(new DataLengthProbe("uncompressedSize")) - .pipe(compression.compressWorker(compressionOptions)) - .pipe(new DataLengthProbe("compressedSize")) - .withStreamInfo("compression", compression); - }; - - module.exports = CompressedObject; - - }, { "./external": 6, "./stream/Crc32Probe": 25, "./stream/DataLengthProbe": 26, "./stream/DataWorker": 27 }], 3: [function (require, module, exports) { - 'use strict'; - - var GenericWorker = require("./stream/GenericWorker"); - - exports.STORE = { - magic: "\x00\x00", - compressWorker: function (compressionOptions) { - return new GenericWorker("STORE compression"); - }, - uncompressWorker: function () { - return new GenericWorker("STORE decompression"); - } - }; - exports.DEFLATE = require('./flate'); - - }, { "./flate": 7, "./stream/GenericWorker": 28 }], 4: [function (require, module, exports) { - 'use strict'; - - var utils = require('./utils'); - - /** - * The following functions come from pako, from pako/lib/zlib/crc32.js - * released under the MIT license, see pako https://github.com/nodeca/pako/ - */ - - // Use ordinary array, since untyped makes no boost here - function makeTable() { - var c, table = []; - - for (var n = 0; n < 256; n++) { - c = n; - for (var k = 0; k < 8; k++) { - c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1)); - } - table[n] = c; - } - - return table; - } - - // Create table on load. Just 255 signed longs. Not a problem. - var crcTable = makeTable(); - - - function crc32(crc, buf, len, pos) { - var t = crcTable, end = pos + len; - - crc = crc ^ (-1); - - for (var i = pos; i < end; i++) { - crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF]; - } - - return (crc ^ (-1)); // >>> 0; - } - - // That's all for the pako functions. - - /** - * Compute the crc32 of a string. - * This is almost the same as the function crc32, but for strings. Using the - * same function for the two use cases leads to horrible performances. - * @param {Number} crc the starting value of the crc. - * @param {String} str the string to use. - * @param {Number} len the length of the string. - * @param {Number} pos the starting position for the crc32 computation. - * @return {Number} the computed crc32. - */ - function crc32str(crc, str, len, pos) { - var t = crcTable, end = pos + len; - - crc = crc ^ (-1); - - for (var i = pos; i < end; i++) { - crc = (crc >>> 8) ^ t[(crc ^ str.charCodeAt(i)) & 0xFF]; - } - - return (crc ^ (-1)); // >>> 0; - } - - module.exports = function crc32wrapper(input, crc) { - if (typeof input === "undefined" || !input.length) { - return 0; - } - - var isArray = utils.getTypeOf(input) !== "string"; - - if (isArray) { - return crc32(crc | 0, input, input.length, 0); - } else { - return crc32str(crc | 0, input, input.length, 0); - } - }; - - }, { "./utils": 32 }], 5: [function (require, module, exports) { - 'use strict'; - exports.base64 = false; - exports.binary = false; - exports.dir = false; - exports.createFolders = true; - exports.date = null; - exports.compression = null; - exports.compressionOptions = null; - exports.comment = null; - exports.unixPermissions = null; - exports.dosPermissions = null; - - }, {}], 6: [function (require, module, exports) { - /* global Promise */ - 'use strict'; - - // load the global object first: - // - it should be better integrated in the system (unhandledRejection in node) - // - the environment may have a custom Promise implementation (see zone.js) - var ES6Promise = null; - if (typeof Promise !== "undefined") { - ES6Promise = Promise; - } else { - ES6Promise = require("lie"); - } - - /** - * Let the user use/change some implementations. - */ - module.exports = { - Promise: ES6Promise - }; - - }, { "lie": 37 }], 7: [function (require, module, exports) { - 'use strict'; - var USE_TYPEDARRAY = (typeof Uint8Array !== 'undefined') && (typeof Uint16Array !== 'undefined') && (typeof Uint32Array !== 'undefined'); - - var pako = require("pako"); - var utils = require("./utils"); - var GenericWorker = require("./stream/GenericWorker"); - - var ARRAY_TYPE = USE_TYPEDARRAY ? "uint8array" : "array"; - - exports.magic = "\x08\x00"; - - /** - * Create a worker that uses pako to inflate/deflate. - * @constructor - * @param {String} action the name of the pako function to call : either "Deflate" or "Inflate". - * @param {Object} options the options to use when (de)compressing. - */ - function FlateWorker(action, options) { - GenericWorker.call(this, "FlateWorker/" + action); - - this._pako = null; - this._pakoAction = action; - this._pakoOptions = options; - // the `meta` object from the last chunk received - // this allow this worker to pass around metadata - this.meta = {}; - } - - utils.inherits(FlateWorker, GenericWorker); - - /** - * @see GenericWorker.processChunk - */ - FlateWorker.prototype.processChunk = function (chunk) { - this.meta = chunk.meta; - if (this._pako === null) { - this._createPako(); - } - this._pako.push(utils.transformTo(ARRAY_TYPE, chunk.data), false); - }; - - /** - * @see GenericWorker.flush - */ - FlateWorker.prototype.flush = function () { - GenericWorker.prototype.flush.call(this); - if (this._pako === null) { - this._createPako(); - } - this._pako.push([], true); - }; - /** - * @see GenericWorker.cleanUp - */ - FlateWorker.prototype.cleanUp = function () { - GenericWorker.prototype.cleanUp.call(this); - this._pako = null; - }; - - /** - * Create the _pako object. - * TODO: lazy-loading this object isn't the best solution but it's the - * quickest. The best solution is to lazy-load the worker list. See also the - * issue #446. - */ - FlateWorker.prototype._createPako = function () { - this._pako = new pako[this._pakoAction]({ - raw: true, - level: this._pakoOptions.level || -1 // default compression - }); - var self = this; - this._pako.onData = function (data) { - self.push({ - data: data, - meta: self.meta - }); - }; - }; - - exports.compressWorker = function (compressionOptions) { - return new FlateWorker("Deflate", compressionOptions); - }; - exports.uncompressWorker = function () { - return new FlateWorker("Inflate", {}); - }; - - }, { "./stream/GenericWorker": 28, "./utils": 32, "pako": 38 }], 8: [function (require, module, exports) { - 'use strict'; - - var utils = require('../utils'); - var GenericWorker = require('../stream/GenericWorker'); - var utf8 = require('../utf8'); - var crc32 = require('../crc32'); - var signature = require('../signature'); - - /** - * Transform an integer into a string in hexadecimal. - * @private - * @param {number} dec the number to convert. - * @param {number} bytes the number of bytes to generate. - * @returns {string} the result. - */ - var decToHex = function (dec, bytes) { - var hex = "", i; - for (i = 0; i < bytes; i++) { - hex += String.fromCharCode(dec & 0xff); - dec = dec >>> 8; - } - return hex; - }; - - /** - * Generate the UNIX part of the external file attributes. - * @param {Object} unixPermissions the unix permissions or null. - * @param {Boolean} isDir true if the entry is a directory, false otherwise. - * @return {Number} a 32 bit integer. - * - * adapted from http://unix.stackexchange.com/questions/14705/the-zip-formats-external-file-attribute : - * - * TTTTsstrwxrwxrwx0000000000ADVSHR - * ^^^^____________________________ file type, see zipinfo.c (UNX_*) - * ^^^_________________________ setuid, setgid, sticky - * ^^^^^^^^^________________ permissions - * ^^^^^^^^^^______ not used ? - * ^^^^^^ DOS attribute bits : Archive, Directory, Volume label, System file, Hidden, Read only - */ - var generateUnixExternalFileAttr = function (unixPermissions, isDir) { - - var result = unixPermissions; - if (!unixPermissions) { - // I can't use octal values in strict mode, hence the hexa. - // 040775 => 0x41fd - // 0100664 => 0x81b4 - result = isDir ? 0x41fd : 0x81b4; - } - return (result & 0xFFFF) << 16; - }; - - /** - * Generate the DOS part of the external file attributes. - * @param {Object} dosPermissions the dos permissions or null. - * @param {Boolean} isDir true if the entry is a directory, false otherwise. - * @return {Number} a 32 bit integer. - * - * Bit 0 Read-Only - * Bit 1 Hidden - * Bit 2 System - * Bit 3 Volume Label - * Bit 4 Directory - * Bit 5 Archive - */ - var generateDosExternalFileAttr = function (dosPermissions, isDir) { - - // the dir flag is already set for compatibility - return (dosPermissions || 0) & 0x3F; - }; - - /** - * Generate the various parts used in the construction of the final zip file. - * @param {Object} streamInfo the hash with information about the compressed file. - * @param {Boolean} streamedContent is the content streamed ? - * @param {Boolean} streamingEnded is the stream finished ? - * @param {number} offset the current offset from the start of the zip file. - * @param {String} platform let's pretend we are this platform (change platform dependents fields) - * @param {Function} encodeFileName the function to encode the file name / comment. - * @return {Object} the zip parts. - */ - var generateZipParts = function (streamInfo, streamedContent, streamingEnded, offset, platform, encodeFileName) { - var file = streamInfo['file'], - compression = streamInfo['compression'], - useCustomEncoding = encodeFileName !== utf8.utf8encode, - encodedFileName = utils.transformTo("string", encodeFileName(file.name)), - utfEncodedFileName = utils.transformTo("string", utf8.utf8encode(file.name)), - comment = file.comment, - encodedComment = utils.transformTo("string", encodeFileName(comment)), - utfEncodedComment = utils.transformTo("string", utf8.utf8encode(comment)), - useUTF8ForFileName = utfEncodedFileName.length !== file.name.length, - useUTF8ForComment = utfEncodedComment.length !== comment.length, - dosTime, - dosDate, - extraFields = "", - unicodePathExtraField = "", - unicodeCommentExtraField = "", - dir = file.dir, - date = file.date; - - - var dataInfo = { - crc32: 0, - compressedSize: 0, - uncompressedSize: 0 - }; - - // if the content is streamed, the sizes/crc32 are only available AFTER - // the end of the stream. - if (!streamedContent || streamingEnded) { - dataInfo.crc32 = streamInfo['crc32']; - dataInfo.compressedSize = streamInfo['compressedSize']; - dataInfo.uncompressedSize = streamInfo['uncompressedSize']; - } - - var bitflag = 0; - if (streamedContent) { - // Bit 3: the sizes/crc32 are set to zero in the local header. - // The correct values are put in the data descriptor immediately - // following the compressed data. - bitflag |= 0x0008; - } - if (!useCustomEncoding && (useUTF8ForFileName || useUTF8ForComment)) { - // Bit 11: Language encoding flag (EFS). - bitflag |= 0x0800; - } - - - var extFileAttr = 0; - var versionMadeBy = 0; - if (dir) { - // dos or unix, we set the dos dir flag - extFileAttr |= 0x00010; - } - if (platform === "UNIX") { - versionMadeBy = 0x031E; // UNIX, version 3.0 - extFileAttr |= generateUnixExternalFileAttr(file.unixPermissions, dir); - } else { // DOS or other, fallback to DOS - versionMadeBy = 0x0014; // DOS, version 2.0 - extFileAttr |= generateDosExternalFileAttr(file.dosPermissions, dir); - } - - // date - // @see http://www.delorie.com/djgpp/doc/rbinter/it/52/13.html - // @see http://www.delorie.com/djgpp/doc/rbinter/it/65/16.html - // @see http://www.delorie.com/djgpp/doc/rbinter/it/66/16.html - - dosTime = date.getUTCHours(); - dosTime = dosTime << 6; - dosTime = dosTime | date.getUTCMinutes(); - dosTime = dosTime << 5; - dosTime = dosTime | date.getUTCSeconds() / 2; - - dosDate = date.getUTCFullYear() - 1980; - dosDate = dosDate << 4; - dosDate = dosDate | (date.getUTCMonth() + 1); - dosDate = dosDate << 5; - dosDate = dosDate | date.getUTCDate(); - - if (useUTF8ForFileName) { - // set the unicode path extra field. unzip needs at least one extra - // field to correctly handle unicode path, so using the path is as good - // as any other information. This could improve the situation with - // other archive managers too. - // This field is usually used without the utf8 flag, with a non - // unicode path in the header (winrar, winzip). This helps (a bit) - // with the messy Windows' default compressed folders feature but - // breaks on p7zip which doesn't seek the unicode path extra field. - // So for now, UTF-8 everywhere ! - unicodePathExtraField = - // Version - decToHex(1, 1) + - // NameCRC32 - decToHex(crc32(encodedFileName), 4) + - // UnicodeName - utfEncodedFileName; - - extraFields += - // Info-ZIP Unicode Path Extra Field - "\x75\x70" + - // size - decToHex(unicodePathExtraField.length, 2) + - // content - unicodePathExtraField; - } - - if (useUTF8ForComment) { - - unicodeCommentExtraField = - // Version - decToHex(1, 1) + - // CommentCRC32 - decToHex(crc32(encodedComment), 4) + - // UnicodeName - utfEncodedComment; - - extraFields += - // Info-ZIP Unicode Path Extra Field - "\x75\x63" + - // size - decToHex(unicodeCommentExtraField.length, 2) + - // content - unicodeCommentExtraField; - } - - var header = ""; - - // version needed to extract - header += "\x0A\x00"; - // general purpose bit flag - header += decToHex(bitflag, 2); - // compression method - header += compression.magic; - // last mod file time - header += decToHex(dosTime, 2); - // last mod file date - header += decToHex(dosDate, 2); - // crc-32 - header += decToHex(dataInfo.crc32, 4); - // compressed size - header += decToHex(dataInfo.compressedSize, 4); - // uncompressed size - header += decToHex(dataInfo.uncompressedSize, 4); - // file name length - header += decToHex(encodedFileName.length, 2); - // extra field length - header += decToHex(extraFields.length, 2); - - - var fileRecord = signature.LOCAL_FILE_HEADER + header + encodedFileName + extraFields; - - var dirRecord = signature.CENTRAL_FILE_HEADER + - // version made by (00: DOS) - decToHex(versionMadeBy, 2) + - // file header (common to file and central directory) - header + - // file comment length - decToHex(encodedComment.length, 2) + - // disk number start - "\x00\x00" + - // internal file attributes TODO - "\x00\x00" + - // external file attributes - decToHex(extFileAttr, 4) + - // relative offset of local header - decToHex(offset, 4) + - // file name - encodedFileName + - // extra field - extraFields + - // file comment - encodedComment; - - return { - fileRecord: fileRecord, - dirRecord: dirRecord - }; - }; - - /** - * Generate the EOCD record. - * @param {Number} entriesCount the number of entries in the zip file. - * @param {Number} centralDirLength the length (in bytes) of the central dir. - * @param {Number} localDirLength the length (in bytes) of the local dir. - * @param {String} comment the zip file comment as a binary string. - * @param {Function} encodeFileName the function to encode the comment. - * @return {String} the EOCD record. - */ - var generateCentralDirectoryEnd = function (entriesCount, centralDirLength, localDirLength, comment, encodeFileName) { - var dirEnd = ""; - var encodedComment = utils.transformTo("string", encodeFileName(comment)); - - // end of central dir signature - dirEnd = signature.CENTRAL_DIRECTORY_END + - // number of this disk - "\x00\x00" + - // number of the disk with the start of the central directory - "\x00\x00" + - // total number of entries in the central directory on this disk - decToHex(entriesCount, 2) + - // total number of entries in the central directory - decToHex(entriesCount, 2) + - // size of the central directory 4 bytes - decToHex(centralDirLength, 4) + - // offset of start of central directory with respect to the starting disk number - decToHex(localDirLength, 4) + - // .ZIP file comment length - decToHex(encodedComment.length, 2) + - // .ZIP file comment - encodedComment; - - return dirEnd; - }; - - /** - * Generate data descriptors for a file entry. - * @param {Object} streamInfo the hash generated by a worker, containing information - * on the file entry. - * @return {String} the data descriptors. - */ - var generateDataDescriptors = function (streamInfo) { - var descriptor = ""; - descriptor = signature.DATA_DESCRIPTOR + - // crc-32 4 bytes - decToHex(streamInfo['crc32'], 4) + - // compressed size 4 bytes - decToHex(streamInfo['compressedSize'], 4) + - // uncompressed size 4 bytes - decToHex(streamInfo['uncompressedSize'], 4); - - return descriptor; - }; - - - /** - * A worker to concatenate other workers to create a zip file. - * @param {Boolean} streamFiles `true` to stream the content of the files, - * `false` to accumulate it. - * @param {String} comment the comment to use. - * @param {String} platform the platform to use, "UNIX" or "DOS". - * @param {Function} encodeFileName the function to encode file names and comments. - */ - function ZipFileWorker(streamFiles, comment, platform, encodeFileName) { - GenericWorker.call(this, "ZipFileWorker"); - // The number of bytes written so far. This doesn't count accumulated chunks. - this.bytesWritten = 0; - // The comment of the zip file - this.zipComment = comment; - // The platform "generating" the zip file. - this.zipPlatform = platform; - // the function to encode file names and comments. - this.encodeFileName = encodeFileName; - // Should we stream the content of the files ? - this.streamFiles = streamFiles; - // If `streamFiles` is false, we will need to accumulate the content of the - // files to calculate sizes / crc32 (and write them *before* the content). - // This boolean indicates if we are accumulating chunks (it will change a lot - // during the lifetime of this worker). - this.accumulate = false; - // The buffer receiving chunks when accumulating content. - this.contentBuffer = []; - // The list of generated directory records. - this.dirRecords = []; - // The offset (in bytes) from the beginning of the zip file for the current source. - this.currentSourceOffset = 0; - // The total number of entries in this zip file. - this.entriesCount = 0; - // the name of the file currently being added, null when handling the end of the zip file. - // Used for the emitted metadata. - this.currentFile = null; - - - - this._sources = []; - } - utils.inherits(ZipFileWorker, GenericWorker); - - /** - * @see GenericWorker.push - */ - ZipFileWorker.prototype.push = function (chunk) { - - var currentFilePercent = chunk.meta.percent || 0; - var entriesCount = this.entriesCount; - var remainingFiles = this._sources.length; - - if (this.accumulate) { - this.contentBuffer.push(chunk); - } else { - this.bytesWritten += chunk.data.length; - - GenericWorker.prototype.push.call(this, { - data: chunk.data, - meta: { - currentFile: this.currentFile, - percent: entriesCount ? (currentFilePercent + 100 * (entriesCount - remainingFiles - 1)) / entriesCount : 100 - } - }); - } - }; - - /** - * The worker started a new source (an other worker). - * @param {Object} streamInfo the streamInfo object from the new source. - */ - ZipFileWorker.prototype.openedSource = function (streamInfo) { - this.currentSourceOffset = this.bytesWritten; - this.currentFile = streamInfo['file'].name; - - var streamedContent = this.streamFiles && !streamInfo['file'].dir; - - // don't stream folders (because they don't have any content) - if (streamedContent) { - var record = generateZipParts(streamInfo, streamedContent, false, this.currentSourceOffset, this.zipPlatform, this.encodeFileName); - this.push({ - data: record.fileRecord, - meta: { percent: 0 } - }); - } else { - // we need to wait for the whole file before pushing anything - this.accumulate = true; - } - }; - - /** - * The worker finished a source (an other worker). - * @param {Object} streamInfo the streamInfo object from the finished source. - */ - ZipFileWorker.prototype.closedSource = function (streamInfo) { - this.accumulate = false; - var streamedContent = this.streamFiles && !streamInfo['file'].dir; - var record = generateZipParts(streamInfo, streamedContent, true, this.currentSourceOffset, this.zipPlatform, this.encodeFileName); - - this.dirRecords.push(record.dirRecord); - if (streamedContent) { - // after the streamed file, we put data descriptors - this.push({ - data: generateDataDescriptors(streamInfo), - meta: { percent: 100 } - }); - } else { - // the content wasn't streamed, we need to push everything now - // first the file record, then the content - this.push({ - data: record.fileRecord, - meta: { percent: 0 } - }); - while (this.contentBuffer.length) { - this.push(this.contentBuffer.shift()); - } - } - this.currentFile = null; - }; - - /** - * @see GenericWorker.flush - */ - ZipFileWorker.prototype.flush = function () { - - var localDirLength = this.bytesWritten; - for (var i = 0; i < this.dirRecords.length; i++) { - this.push({ - data: this.dirRecords[i], - meta: { percent: 100 } - }); - } - var centralDirLength = this.bytesWritten - localDirLength; - - var dirEnd = generateCentralDirectoryEnd(this.dirRecords.length, centralDirLength, localDirLength, this.zipComment, this.encodeFileName); - - this.push({ - data: dirEnd, - meta: { percent: 100 } - }); - }; - - /** - * Prepare the next source to be read. - */ - ZipFileWorker.prototype.prepareNextSource = function () { - this.previous = this._sources.shift(); - this.openedSource(this.previous.streamInfo); - if (this.isPaused) { - this.previous.pause(); - } else { - this.previous.resume(); - } - }; - - /** - * @see GenericWorker.registerPrevious - */ - ZipFileWorker.prototype.registerPrevious = function (previous) { - this._sources.push(previous); - var self = this; - - previous.on('data', function (chunk) { - self.processChunk(chunk); - }); - previous.on('end', function () { - self.closedSource(self.previous.streamInfo); - if (self._sources.length) { - self.prepareNextSource(); - } else { - self.end(); - } - }); - previous.on('error', function (e) { - self.error(e); - }); - return this; - }; - - /** - * @see GenericWorker.resume - */ - ZipFileWorker.prototype.resume = function () { - if (!GenericWorker.prototype.resume.call(this)) { - return false; - } - - if (!this.previous && this._sources.length) { - this.prepareNextSource(); - return true; - } - if (!this.previous && !this._sources.length && !this.generatedError) { - this.end(); - return true; - } - }; - - /** - * @see GenericWorker.error - */ - ZipFileWorker.prototype.error = function (e) { - var sources = this._sources; - if (!GenericWorker.prototype.error.call(this, e)) { - return false; - } - for (var i = 0; i < sources.length; i++) { - try { - sources[i].error(e); - } catch (e) { - // the `error` exploded, nothing to do - } - } - return true; - }; - - /** - * @see GenericWorker.lock - */ - ZipFileWorker.prototype.lock = function () { - GenericWorker.prototype.lock.call(this); - var sources = this._sources; - for (var i = 0; i < sources.length; i++) { - sources[i].lock(); - } - }; - - module.exports = ZipFileWorker; - - }, { "../crc32": 4, "../signature": 23, "../stream/GenericWorker": 28, "../utf8": 31, "../utils": 32 }], 9: [function (require, module, exports) { - 'use strict'; - - var compressions = require('../compressions'); - var ZipFileWorker = require('./ZipFileWorker'); - - /** - * Find the compression to use. - * @param {String} fileCompression the compression defined at the file level, if any. - * @param {String} zipCompression the compression defined at the load() level. - * @return {Object} the compression object to use. - */ - var getCompression = function (fileCompression, zipCompression) { - - var compressionName = fileCompression || zipCompression; - var compression = compressions[compressionName]; - if (!compression) { - throw new Error(compressionName + " is not a valid compression method !"); - } - return compression; - }; - - /** - * Create a worker to generate a zip file. - * @param {JSZip} zip the JSZip instance at the right root level. - * @param {Object} options to generate the zip file. - * @param {String} comment the comment to use. - */ - exports.generateWorker = function (zip, options, comment) { - - var zipFileWorker = new ZipFileWorker(options.streamFiles, comment, options.platform, options.encodeFileName); - var entriesCount = 0; - try { - - zip.forEach(function (relativePath, file) { - entriesCount++; - var compression = getCompression(file.options.compression, options.compression); - var compressionOptions = file.options.compressionOptions || options.compressionOptions || {}; - var dir = file.dir, date = file.date; - - file._compressWorker(compression, compressionOptions) - .withStreamInfo("file", { - name: relativePath, - dir: dir, - date: date, - comment: file.comment || "", - unixPermissions: file.unixPermissions, - dosPermissions: file.dosPermissions - }) - .pipe(zipFileWorker); - }); - zipFileWorker.entriesCount = entriesCount; - } catch (e) { - zipFileWorker.error(e); - } - - return zipFileWorker; - }; - - }, { "../compressions": 3, "./ZipFileWorker": 8 }], 10: [function (require, module, exports) { - 'use strict'; - - /** - * Representation a of zip file in js - * @constructor - */ - function JSZip() { - // if this constructor is used without `new`, it adds `new` before itself: - if (!(this instanceof JSZip)) { - return new JSZip(); - } - - if (arguments.length) { - throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide."); - } - - // object containing the files : - // { - // "folder/" : {...}, - // "folder/data.txt" : {...} - // } - this.files = {}; - - this.comment = null; - - // Where we are in the hierarchy - this.root = ""; - this.clone = function () { - var newObj = new JSZip(); - for (var i in this) { - if (typeof this[i] !== "function") { - newObj[i] = this[i]; - } - } - return newObj; - }; - } - JSZip.prototype = require('./object'); - JSZip.prototype.loadAsync = require('./load'); - JSZip.support = require('./support'); - JSZip.defaults = require('./defaults'); - - // TODO find a better way to handle this version, - // a require('package.json').version doesn't work with webpack, see #327 - JSZip.version = "3.5.0"; - - JSZip.loadAsync = function (content, options) { - return new JSZip().loadAsync(content, options); - }; - - JSZip.external = require("./external"); - module.exports = JSZip; - - }, { "./defaults": 5, "./external": 6, "./load": 11, "./object": 15, "./support": 30 }], 11: [function (require, module, exports) { - 'use strict'; - var utils = require('./utils'); - var external = require("./external"); - var utf8 = require('./utf8'); - var utils = require('./utils'); - var ZipEntries = require('./zipEntries'); - var Crc32Probe = require('./stream/Crc32Probe'); - var nodejsUtils = require("./nodejsUtils"); - - /** - * Check the CRC32 of an entry. - * @param {ZipEntry} zipEntry the zip entry to check. - * @return {Promise} the result. - */ - function checkEntryCRC32(zipEntry) { - return new external.Promise(function (resolve, reject) { - var worker = zipEntry.decompressed.getContentWorker().pipe(new Crc32Probe()); - worker.on("error", function (e) { - reject(e); - }) - .on("end", function () { - if (worker.streamInfo.crc32 !== zipEntry.decompressed.crc32) { - reject(new Error("Corrupted zip : CRC32 mismatch")); - } else { - resolve(); - } - }) - .resume(); - }); - } - - module.exports = function (data, options) { - var zip = this; - options = utils.extend(options || {}, { - base64: false, - checkCRC32: false, - optimizedBinaryString: false, - createFolders: false, - decodeFileName: utf8.utf8decode - }); - - if (nodejsUtils.isNode && nodejsUtils.isStream(data)) { - return external.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")); - } - - return utils.prepareContent("the loaded zip file", data, true, options.optimizedBinaryString, options.base64) - .then(function (data) { - var zipEntries = new ZipEntries(options); - zipEntries.load(data); - return zipEntries; - }).then(function checkCRC32(zipEntries) { - var promises = [external.Promise.resolve(zipEntries)]; - var files = zipEntries.files; - if (options.checkCRC32) { - for (var i = 0; i < files.length; i++) { - promises.push(checkEntryCRC32(files[i])); - } - } - return external.Promise.all(promises); - }).then(function addFiles(results) { - var zipEntries = results.shift(); - var files = zipEntries.files; - for (var i = 0; i < files.length; i++) { - var input = files[i]; - zip.file(input.fileNameStr, input.decompressed, { - binary: true, - optimizedBinaryString: true, - date: input.date, - dir: input.dir, - comment: input.fileCommentStr.length ? input.fileCommentStr : null, - unixPermissions: input.unixPermissions, - dosPermissions: input.dosPermissions, - createFolders: options.createFolders - }); - } - if (zipEntries.zipComment.length) { - zip.comment = zipEntries.zipComment; - } - - return zip; - }); - }; - - }, { "./external": 6, "./nodejsUtils": 14, "./stream/Crc32Probe": 25, "./utf8": 31, "./utils": 32, "./zipEntries": 33 }], 12: [function (require, module, exports) { - "use strict"; - - var utils = require('../utils'); - var GenericWorker = require('../stream/GenericWorker'); - - /** - * A worker that use a nodejs stream as source. - * @constructor - * @param {String} filename the name of the file entry for this stream. - * @param {Readable} stream the nodejs stream. - */ - function NodejsStreamInputAdapter(filename, stream) { - GenericWorker.call(this, "Nodejs stream input adapter for " + filename); - this._upstreamEnded = false; - this._bindStream(stream); - } - - utils.inherits(NodejsStreamInputAdapter, GenericWorker); - - /** - * Prepare the stream and bind the callbacks on it. - * Do this ASAP on node 0.10 ! A lazy binding doesn't always work. - * @param {Stream} stream the nodejs stream to use. - */ - NodejsStreamInputAdapter.prototype._bindStream = function (stream) { - var self = this; - this._stream = stream; - stream.pause(); - stream - .on("data", function (chunk) { - self.push({ - data: chunk, - meta: { - percent: 0 - } - }); - }) - .on("error", function (e) { - if (self.isPaused) { - this.generatedError = e; - } else { - self.error(e); - } - }) - .on("end", function () { - if (self.isPaused) { - self._upstreamEnded = true; - } else { - self.end(); - } - }); - }; - NodejsStreamInputAdapter.prototype.pause = function () { - if (!GenericWorker.prototype.pause.call(this)) { - return false; - } - this._stream.pause(); - return true; - }; - NodejsStreamInputAdapter.prototype.resume = function () { - if (!GenericWorker.prototype.resume.call(this)) { - return false; - } - - if (this._upstreamEnded) { - this.end(); - } else { - this._stream.resume(); - } - - return true; - }; - - module.exports = NodejsStreamInputAdapter; - - }, { "../stream/GenericWorker": 28, "../utils": 32 }], 13: [function (require, module, exports) { - 'use strict'; - - var Readable = require('readable-stream').Readable; - - var utils = require('../utils'); - utils.inherits(NodejsStreamOutputAdapter, Readable); - - /** - * A nodejs stream using a worker as source. - * @see the SourceWrapper in http://nodejs.org/api/stream.html - * @constructor - * @param {StreamHelper} helper the helper wrapping the worker - * @param {Object} options the nodejs stream options - * @param {Function} updateCb the update callback. - */ - function NodejsStreamOutputAdapter(helper, options, updateCb) { - Readable.call(this, options); - this._helper = helper; - - var self = this; - helper.on("data", function (data, meta) { - if (!self.push(data)) { - self._helper.pause(); - } - if (updateCb) { - updateCb(meta); - } - }) - .on("error", function (e) { - self.emit('error', e); - }) - .on("end", function () { - self.push(null); - }); - } - - - NodejsStreamOutputAdapter.prototype._read = function () { - this._helper.resume(); - }; - - module.exports = NodejsStreamOutputAdapter; - - }, { "../utils": 32, "readable-stream": 16 }], 14: [function (require, module, exports) { - 'use strict'; - - module.exports = { - /** - * True if this is running in Nodejs, will be undefined in a browser. - * In a browser, browserify won't include this file and the whole module - * will be resolved an empty object. - */ - isNode: typeof Buffer !== "undefined", - /** - * Create a new nodejs Buffer from an existing content. - * @param {Object} data the data to pass to the constructor. - * @param {String} encoding the encoding to use. - * @return {Buffer} a new Buffer. - */ - newBufferFrom: function (data, encoding) { - if (Buffer.from && Buffer.from !== Uint8Array.from) { - return Buffer.from(data, encoding); - } else { - if (typeof data === "number") { - // Safeguard for old Node.js versions. On newer versions, - // Buffer.from(number) / Buffer(number, encoding) already throw. - throw new Error("The \"data\" argument must not be a number"); - } - return new Buffer(data, encoding); - } - }, - /** - * Create a new nodejs Buffer with the specified size. - * @param {Integer} size the size of the buffer. - * @return {Buffer} a new Buffer. - */ - allocBuffer: function (size) { - if (Buffer.alloc) { - return Buffer.alloc(size); - } else { - var buf = new Buffer(size); - buf.fill(0); - return buf; - } - }, - /** - * Find out if an object is a Buffer. - * @param {Object} b the object to test. - * @return {Boolean} true if the object is a Buffer, false otherwise. - */ - isBuffer: function (b) { - return Buffer.isBuffer(b); - }, - - isStream: function (obj) { - return obj && - typeof obj.on === "function" && - typeof obj.pause === "function" && - typeof obj.resume === "function"; - } - }; - - }, {}], 15: [function (require, module, exports) { - 'use strict'; - var utf8 = require('./utf8'); - var utils = require('./utils'); - var GenericWorker = require('./stream/GenericWorker'); - var StreamHelper = require('./stream/StreamHelper'); - var defaults = require('./defaults'); - var CompressedObject = require('./compressedObject'); - var ZipObject = require('./zipObject'); - var generate = require("./generate"); - var nodejsUtils = require("./nodejsUtils"); - var NodejsStreamInputAdapter = require("./nodejs/NodejsStreamInputAdapter"); - - - /** - * Add a file in the current folder. - * @private - * @param {string} name the name of the file - * @param {String|ArrayBuffer|Uint8Array|Buffer} data the data of the file - * @param {Object} originalOptions the options of the file - * @return {Object} the new file. - */ - var fileAdd = function (name, data, originalOptions) { - // be sure sub folders exist - var dataType = utils.getTypeOf(data), - parent; - - - /* - * Correct options. - */ - - var o = utils.extend(originalOptions || {}, defaults); - o.date = o.date || new Date(); - if (o.compression !== null) { - o.compression = o.compression.toUpperCase(); - } - - if (typeof o.unixPermissions === "string") { - o.unixPermissions = parseInt(o.unixPermissions, 8); - } - - // UNX_IFDIR 0040000 see zipinfo.c - if (o.unixPermissions && (o.unixPermissions & 0x4000)) { - o.dir = true; - } - // Bit 4 Directory - if (o.dosPermissions && (o.dosPermissions & 0x0010)) { - o.dir = true; - } - - if (o.dir) { - name = forceTrailingSlash(name); - } - if (o.createFolders && (parent = parentFolder(name))) { - folderAdd.call(this, parent, true); - } - - var isUnicodeString = dataType === "string" && o.binary === false && o.base64 === false; - if (!originalOptions || typeof originalOptions.binary === "undefined") { - o.binary = !isUnicodeString; - } - - - var isCompressedEmpty = (data instanceof CompressedObject) && data.uncompressedSize === 0; - - if (isCompressedEmpty || o.dir || !data || data.length === 0) { - o.base64 = false; - o.binary = true; - data = ""; - o.compression = "STORE"; - dataType = "string"; - } - - /* - * Convert content to fit. - */ - - var zipObjectContent = null; - if (data instanceof CompressedObject || data instanceof GenericWorker) { - zipObjectContent = data; - } else if (nodejsUtils.isNode && nodejsUtils.isStream(data)) { - zipObjectContent = new NodejsStreamInputAdapter(name, data); - } else { - zipObjectContent = utils.prepareContent(name, data, o.binary, o.optimizedBinaryString, o.base64); - } - - var object = new ZipObject(name, zipObjectContent, o); - this.files[name] = object; - /* - TODO: we can't throw an exception because we have async promises - (we can have a promise of a Date() for example) but returning a - promise is useless because file(name, data) returns the JSZip - object for chaining. Should we break that to allow the user - to catch the error ? - - return external.Promise.resolve(zipObjectContent) - .then(function () { - return object; - }); - */ - }; - - /** - * Find the parent folder of the path. - * @private - * @param {string} path the path to use - * @return {string} the parent folder, or "" - */ - var parentFolder = function (path) { - if (path.slice(-1) === '/') { - path = path.substring(0, path.length - 1); - } - var lastSlash = path.lastIndexOf('/'); - return (lastSlash > 0) ? path.substring(0, lastSlash) : ""; - }; - - /** - * Returns the path with a slash at the end. - * @private - * @param {String} path the path to check. - * @return {String} the path with a trailing slash. - */ - var forceTrailingSlash = function (path) { - // Check the name ends with a / - if (path.slice(-1) !== "/") { - path += "/"; // IE doesn't like substr(-1) - } - return path; - }; - - /** - * Add a (sub) folder in the current folder. - * @private - * @param {string} name the folder's name - * @param {boolean=} [createFolders] If true, automatically create sub - * folders. Defaults to false. - * @return {Object} the new folder. - */ - var folderAdd = function (name, createFolders) { - createFolders = (typeof createFolders !== 'undefined') ? createFolders : defaults.createFolders; - - name = forceTrailingSlash(name); - - // Does this folder already exist? - if (!this.files[name]) { - fileAdd.call(this, name, null, { - dir: true, - createFolders: createFolders - }); - } - return this.files[name]; - }; - - /** - * Cross-window, cross-Node-context regular expression detection - * @param {Object} object Anything - * @return {Boolean} true if the object is a regular expression, - * false otherwise - */ - function isRegExp(object) { - return Object.prototype.toString.call(object) === "[object RegExp]"; - } - - // return the actual prototype of JSZip - var out = { - /** - * @see loadAsync - */ - load: function () { - throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide."); - }, - - - /** - * Call a callback function for each entry at this folder level. - * @param {Function} cb the callback function: - * function (relativePath, file) {...} - * It takes 2 arguments : the relative path and the file. - */ - forEach: function (cb) { - var filename, relativePath, file; - for (filename in this.files) { - if (!this.files.hasOwnProperty(filename)) { - continue; - } - file = this.files[filename]; - relativePath = filename.slice(this.root.length, filename.length); - if (relativePath && filename.slice(0, this.root.length) === this.root) { // the file is in the current root - cb(relativePath, file); // TODO reverse the parameters ? need to be clean AND consistent with the filter search fn... - } - } - }, - - /** - * Filter nested files/folders with the specified function. - * @param {Function} search the predicate to use : - * function (relativePath, file) {...} - * It takes 2 arguments : the relative path and the file. - * @return {Array} An array of matching elements. - */ - filter: function (search) { - var result = []; - this.forEach(function (relativePath, entry) { - if (search(relativePath, entry)) { // the file matches the function - result.push(entry); - } - - }); - return result; - }, - - /** - * Add a file to the zip file, or search a file. - * @param {string|RegExp} name The name of the file to add (if data is defined), - * the name of the file to find (if no data) or a regex to match files. - * @param {String|ArrayBuffer|Uint8Array|Buffer} data The file data, either raw or base64 encoded - * @param {Object} o File options - * @return {JSZip|Object|Array} this JSZip object (when adding a file), - * a file (when searching by string) or an array of files (when searching by regex). - */ - file: function (name, data, o) { - if (arguments.length === 1) { - if (isRegExp(name)) { - var regexp = name; - return this.filter(function (relativePath, file) { - return !file.dir && regexp.test(relativePath); - }); - } - else { // text - var obj = this.files[this.root + name]; - if (obj && !obj.dir) { - return obj; - } else { - return null; - } - } - } - else { // more than one argument : we have data ! - name = this.root + name; - fileAdd.call(this, name, data, o); - } - return this; - }, - - /** - * Add a directory to the zip file, or search. - * @param {String|RegExp} arg The name of the directory to add, or a regex to search folders. - * @return {JSZip} an object with the new directory as the root, or an array containing matching folders. - */ - folder: function (arg) { - if (!arg) { - return this; - } - - if (isRegExp(arg)) { - return this.filter(function (relativePath, file) { - return file.dir && arg.test(relativePath); - }); - } - - // else, name is a new folder - var name = this.root + arg; - var newFolder = folderAdd.call(this, name); - - // Allow chaining by returning a new object with this folder as the root - var ret = this.clone(); - ret.root = newFolder.name; - return ret; - }, - - /** - * Delete a file, or a directory and all sub-files, from the zip - * @param {string} name the name of the file to delete - * @return {JSZip} this JSZip object - */ - remove: function (name) { - name = this.root + name; - var file = this.files[name]; - if (!file) { - // Look for any folders - if (name.slice(-1) !== "/") { - name += "/"; - } - file = this.files[name]; - } - - if (file && !file.dir) { - // file - delete this.files[name]; - } else { - // maybe a folder, delete recursively - var kids = this.filter(function (relativePath, file) { - return file.name.slice(0, name.length) === name; - }); - for (var i = 0; i < kids.length; i++) { - delete this.files[kids[i].name]; - } - } - - return this; - }, - - /** - * Generate the complete zip file - * @param {Object} options the options to generate the zip file : - * - compression, "STORE" by default. - * - type, "base64" by default. Values are : string, base64, uint8array, arraybuffer, blob. - * @return {String|Uint8Array|ArrayBuffer|Buffer|Blob} the zip file - */ - generate: function (options) { - throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide."); - }, - - /** - * Generate the complete zip file as an internal stream. - * @param {Object} options the options to generate the zip file : - * - compression, "STORE" by default. - * - type, "base64" by default. Values are : string, base64, uint8array, arraybuffer, blob. - * @return {StreamHelper} the streamed zip file. - */ - generateInternalStream: function (options) { - var worker, opts = {}; - try { - opts = utils.extend(options || {}, { - streamFiles: false, - compression: "STORE", - compressionOptions: null, - type: "", - platform: "DOS", - comment: null, - mimeType: 'application/zip', - encodeFileName: utf8.utf8encode - }); - - opts.type = opts.type.toLowerCase(); - opts.compression = opts.compression.toUpperCase(); - - // "binarystring" is preferred but the internals use "string". - if (opts.type === "binarystring") { - opts.type = "string"; - } - - if (!opts.type) { - throw new Error("No output type specified."); - } - - utils.checkSupport(opts.type); - - // accept nodejs `process.platform` - if ( - opts.platform === 'darwin' || - opts.platform === 'freebsd' || - opts.platform === 'linux' || - opts.platform === 'sunos' - ) { - opts.platform = "UNIX"; - } - if (opts.platform === 'win32') { - opts.platform = "DOS"; - } - - var comment = opts.comment || this.comment || ""; - worker = generate.generateWorker(this, opts, comment); - } catch (e) { - worker = new GenericWorker("error"); - worker.error(e); - } - return new StreamHelper(worker, opts.type || "string", opts.mimeType); - }, - /** - * Generate the complete zip file asynchronously. - * @see generateInternalStream - */ - generateAsync: function (options, onUpdate) { - return this.generateInternalStream(options).accumulate(onUpdate); - }, - /** - * Generate the complete zip file asynchronously. - * @see generateInternalStream - */ - generateNodeStream: function (options, onUpdate) { - options = options || {}; - if (!options.type) { - options.type = "nodebuffer"; - } - return this.generateInternalStream(options).toNodejsStream(onUpdate); - } - }; - module.exports = out; - - }, { "./compressedObject": 2, "./defaults": 5, "./generate": 9, "./nodejs/NodejsStreamInputAdapter": 12, "./nodejsUtils": 14, "./stream/GenericWorker": 28, "./stream/StreamHelper": 29, "./utf8": 31, "./utils": 32, "./zipObject": 35 }], 16: [function (require, module, exports) { - /* - * This file is used by module bundlers (browserify/webpack/etc) when - * including a stream implementation. We use "readable-stream" to get a - * consistent behavior between nodejs versions but bundlers often have a shim - * for "stream". Using this shim greatly improve the compatibility and greatly - * reduce the final size of the bundle (only one stream implementation, not - * two). - */ - module.exports = require("stream"); - - }, { "stream": undefined }], 17: [function (require, module, exports) { - 'use strict'; - var DataReader = require('./DataReader'); - var utils = require('../utils'); - - function ArrayReader(data) { - DataReader.call(this, data); - for (var i = 0; i < this.data.length; i++) { - data[i] = data[i] & 0xFF; - } - } - utils.inherits(ArrayReader, DataReader); - /** - * @see DataReader.byteAt - */ - ArrayReader.prototype.byteAt = function (i) { - return this.data[this.zero + i]; - }; - /** - * @see DataReader.lastIndexOfSignature - */ - ArrayReader.prototype.lastIndexOfSignature = function (sig) { - var sig0 = sig.charCodeAt(0), - sig1 = sig.charCodeAt(1), - sig2 = sig.charCodeAt(2), - sig3 = sig.charCodeAt(3); - for (var i = this.length - 4; i >= 0; --i) { - if (this.data[i] === sig0 && this.data[i + 1] === sig1 && this.data[i + 2] === sig2 && this.data[i + 3] === sig3) { - return i - this.zero; - } - } - - return -1; - }; - /** - * @see DataReader.readAndCheckSignature - */ - ArrayReader.prototype.readAndCheckSignature = function (sig) { - var sig0 = sig.charCodeAt(0), - sig1 = sig.charCodeAt(1), - sig2 = sig.charCodeAt(2), - sig3 = sig.charCodeAt(3), - data = this.readData(4); - return sig0 === data[0] && sig1 === data[1] && sig2 === data[2] && sig3 === data[3]; - }; - /** - * @see DataReader.readData - */ - ArrayReader.prototype.readData = function (size) { - this.checkOffset(size); - if (size === 0) { - return []; - } - var result = this.data.slice(this.zero + this.index, this.zero + this.index + size); - this.index += size; - return result; - }; - module.exports = ArrayReader; - - }, { "../utils": 32, "./DataReader": 18 }], 18: [function (require, module, exports) { - 'use strict'; - var utils = require('../utils'); - - function DataReader(data) { - this.data = data; // type : see implementation - this.length = data.length; - this.index = 0; - this.zero = 0; - } - DataReader.prototype = { - /** - * Check that the offset will not go too far. - * @param {string} offset the additional offset to check. - * @throws {Error} an Error if the offset is out of bounds. - */ - checkOffset: function (offset) { - this.checkIndex(this.index + offset); - }, - /** - * Check that the specified index will not be too far. - * @param {string} newIndex the index to check. - * @throws {Error} an Error if the index is out of bounds. - */ - checkIndex: function (newIndex) { - if (this.length < this.zero + newIndex || newIndex < 0) { - throw new Error("End of data reached (data length = " + this.length + ", asked index = " + (newIndex) + "). Corrupted zip ?"); - } - }, - /** - * Change the index. - * @param {number} newIndex The new index. - * @throws {Error} if the new index is out of the data. - */ - setIndex: function (newIndex) { - this.checkIndex(newIndex); - this.index = newIndex; - }, - /** - * Skip the next n bytes. - * @param {number} n the number of bytes to skip. - * @throws {Error} if the new index is out of the data. - */ - skip: function (n) { - this.setIndex(this.index + n); - }, - /** - * Get the byte at the specified index. - * @param {number} i the index to use. - * @return {number} a byte. - */ - byteAt: function (i) { - // see implementations - }, - /** - * Get the next number with a given byte size. - * @param {number} size the number of bytes to read. - * @return {number} the corresponding number. - */ - readInt: function (size) { - var result = 0, - i; - this.checkOffset(size); - for (i = this.index + size - 1; i >= this.index; i--) { - result = (result << 8) + this.byteAt(i); - } - this.index += size; - return result; - }, - /** - * Get the next string with a given byte size. - * @param {number} size the number of bytes to read. - * @return {string} the corresponding string. - */ - readString: function (size) { - return utils.transformTo("string", this.readData(size)); - }, - /** - * Get raw data without conversion, bytes. - * @param {number} size the number of bytes to read. - * @return {Object} the raw data, implementation specific. - */ - readData: function (size) { - // see implementations - }, - /** - * Find the last occurrence of a zip signature (4 bytes). - * @param {string} sig the signature to find. - * @return {number} the index of the last occurrence, -1 if not found. - */ - lastIndexOfSignature: function (sig) { - // see implementations - }, - /** - * Read the signature (4 bytes) at the current position and compare it with sig. - * @param {string} sig the expected signature - * @return {boolean} true if the signature matches, false otherwise. - */ - readAndCheckSignature: function (sig) { - // see implementations - }, - /** - * Get the next date. - * @return {Date} the date. - */ - readDate: function () { - var dostime = this.readInt(4); - return new Date(Date.UTC( - ((dostime >> 25) & 0x7f) + 1980, // year - ((dostime >> 21) & 0x0f) - 1, // month - (dostime >> 16) & 0x1f, // day - (dostime >> 11) & 0x1f, // hour - (dostime >> 5) & 0x3f, // minute - (dostime & 0x1f) << 1)); // second - } - }; - module.exports = DataReader; - - }, { "../utils": 32 }], 19: [function (require, module, exports) { - 'use strict'; - var Uint8ArrayReader = require('./Uint8ArrayReader'); - var utils = require('../utils'); - - function NodeBufferReader(data) { - Uint8ArrayReader.call(this, data); - } - utils.inherits(NodeBufferReader, Uint8ArrayReader); - - /** - * @see DataReader.readData - */ - NodeBufferReader.prototype.readData = function (size) { - this.checkOffset(size); - var result = this.data.slice(this.zero + this.index, this.zero + this.index + size); - this.index += size; - return result; - }; - module.exports = NodeBufferReader; - - }, { "../utils": 32, "./Uint8ArrayReader": 21 }], 20: [function (require, module, exports) { - 'use strict'; - var DataReader = require('./DataReader'); - var utils = require('../utils'); - - function StringReader(data) { - DataReader.call(this, data); - } - utils.inherits(StringReader, DataReader); - /** - * @see DataReader.byteAt - */ - StringReader.prototype.byteAt = function (i) { - return this.data.charCodeAt(this.zero + i); - }; - /** - * @see DataReader.lastIndexOfSignature - */ - StringReader.prototype.lastIndexOfSignature = function (sig) { - return this.data.lastIndexOf(sig) - this.zero; - }; - /** - * @see DataReader.readAndCheckSignature - */ - StringReader.prototype.readAndCheckSignature = function (sig) { - var data = this.readData(4); - return sig === data; - }; - /** - * @see DataReader.readData - */ - StringReader.prototype.readData = function (size) { - this.checkOffset(size); - // this will work because the constructor applied the "& 0xff" mask. - var result = this.data.slice(this.zero + this.index, this.zero + this.index + size); - this.index += size; - return result; - }; - module.exports = StringReader; - - }, { "../utils": 32, "./DataReader": 18 }], 21: [function (require, module, exports) { - 'use strict'; - var ArrayReader = require('./ArrayReader'); - var utils = require('../utils'); - - function Uint8ArrayReader(data) { - ArrayReader.call(this, data); - } - utils.inherits(Uint8ArrayReader, ArrayReader); - /** - * @see DataReader.readData - */ - Uint8ArrayReader.prototype.readData = function (size) { - this.checkOffset(size); - if (size === 0) { - // in IE10, when using subarray(idx, idx), we get the array [0x00] instead of []. - return new Uint8Array(0); - } - var result = this.data.subarray(this.zero + this.index, this.zero + this.index + size); - this.index += size; - return result; - }; - module.exports = Uint8ArrayReader; - - }, { "../utils": 32, "./ArrayReader": 17 }], 22: [function (require, module, exports) { - 'use strict'; - - var utils = require('../utils'); - var support = require('../support'); - var ArrayReader = require('./ArrayReader'); - var StringReader = require('./StringReader'); - var NodeBufferReader = require('./NodeBufferReader'); - var Uint8ArrayReader = require('./Uint8ArrayReader'); - - /** - * Create a reader adapted to the data. - * @param {String|ArrayBuffer|Uint8Array|Buffer} data the data to read. - * @return {DataReader} the data reader. - */ - module.exports = function (data) { - var type = utils.getTypeOf(data); - utils.checkSupport(type); - if (type === "string" && !support.uint8array) { - return new StringReader(data); - } - if (type === "nodebuffer") { - return new NodeBufferReader(data); - } - if (support.uint8array) { - return new Uint8ArrayReader(utils.transformTo("uint8array", data)); - } - return new ArrayReader(utils.transformTo("array", data)); - }; - - }, { "../support": 30, "../utils": 32, "./ArrayReader": 17, "./NodeBufferReader": 19, "./StringReader": 20, "./Uint8ArrayReader": 21 }], 23: [function (require, module, exports) { - 'use strict'; - exports.LOCAL_FILE_HEADER = "PK\x03\x04"; - exports.CENTRAL_FILE_HEADER = "PK\x01\x02"; - exports.CENTRAL_DIRECTORY_END = "PK\x05\x06"; - exports.ZIP64_CENTRAL_DIRECTORY_LOCATOR = "PK\x06\x07"; - exports.ZIP64_CENTRAL_DIRECTORY_END = "PK\x06\x06"; - exports.DATA_DESCRIPTOR = "PK\x07\x08"; - - }, {}], 24: [function (require, module, exports) { - 'use strict'; - - var GenericWorker = require('./GenericWorker'); - var utils = require('../utils'); - - /** - * A worker which convert chunks to a specified type. - * @constructor - * @param {String} destType the destination type. - */ - function ConvertWorker(destType) { - GenericWorker.call(this, "ConvertWorker to " + destType); - this.destType = destType; - } - utils.inherits(ConvertWorker, GenericWorker); - - /** - * @see GenericWorker.processChunk - */ - ConvertWorker.prototype.processChunk = function (chunk) { - this.push({ - data: utils.transformTo(this.destType, chunk.data), - meta: chunk.meta - }); - }; - module.exports = ConvertWorker; - - }, { "../utils": 32, "./GenericWorker": 28 }], 25: [function (require, module, exports) { - 'use strict'; - - var GenericWorker = require('./GenericWorker'); - var crc32 = require('../crc32'); - var utils = require('../utils'); - - /** - * A worker which calculate the crc32 of the data flowing through. - * @constructor - */ - function Crc32Probe() { - GenericWorker.call(this, "Crc32Probe"); - this.withStreamInfo("crc32", 0); - } - utils.inherits(Crc32Probe, GenericWorker); - - /** - * @see GenericWorker.processChunk - */ - Crc32Probe.prototype.processChunk = function (chunk) { - this.streamInfo.crc32 = crc32(chunk.data, this.streamInfo.crc32 || 0); - this.push(chunk); - }; - module.exports = Crc32Probe; - - }, { "../crc32": 4, "../utils": 32, "./GenericWorker": 28 }], 26: [function (require, module, exports) { - 'use strict'; - - var utils = require('../utils'); - var GenericWorker = require('./GenericWorker'); - - /** - * A worker which calculate the total length of the data flowing through. - * @constructor - * @param {String} propName the name used to expose the length - */ - function DataLengthProbe(propName) { - GenericWorker.call(this, "DataLengthProbe for " + propName); - this.propName = propName; - this.withStreamInfo(propName, 0); - } - utils.inherits(DataLengthProbe, GenericWorker); - - /** - * @see GenericWorker.processChunk - */ - DataLengthProbe.prototype.processChunk = function (chunk) { - if (chunk) { - var length = this.streamInfo[this.propName] || 0; - this.streamInfo[this.propName] = length + chunk.data.length; - } - GenericWorker.prototype.processChunk.call(this, chunk); - }; - module.exports = DataLengthProbe; - - - }, { "../utils": 32, "./GenericWorker": 28 }], 27: [function (require, module, exports) { - 'use strict'; - - var utils = require('../utils'); - var GenericWorker = require('./GenericWorker'); - - // the size of the generated chunks - // TODO expose this as a public variable - var DEFAULT_BLOCK_SIZE = 16 * 1024; - - /** - * A worker that reads a content and emits chunks. - * @constructor - * @param {Promise} dataP the promise of the data to split - */ - function DataWorker(dataP) { - GenericWorker.call(this, "DataWorker"); - var self = this; - this.dataIsReady = false; - this.index = 0; - this.max = 0; - this.data = null; - this.type = ""; - - this._tickScheduled = false; - - dataP.then(function (data) { - self.dataIsReady = true; - self.data = data; - self.max = data && data.length || 0; - self.type = utils.getTypeOf(data); - if (!self.isPaused) { - self._tickAndRepeat(); - } - }, function (e) { - self.error(e); - }); - } - - utils.inherits(DataWorker, GenericWorker); - - /** - * @see GenericWorker.cleanUp - */ - DataWorker.prototype.cleanUp = function () { - GenericWorker.prototype.cleanUp.call(this); - this.data = null; - }; - - /** - * @see GenericWorker.resume - */ - DataWorker.prototype.resume = function () { - if (!GenericWorker.prototype.resume.call(this)) { - return false; - } - - if (!this._tickScheduled && this.dataIsReady) { - this._tickScheduled = true; - utils.delay(this._tickAndRepeat, [], this); - } - return true; - }; - - /** - * Trigger a tick a schedule an other call to this function. - */ - DataWorker.prototype._tickAndRepeat = function () { - this._tickScheduled = false; - if (this.isPaused || this.isFinished) { - return; - } - this._tick(); - if (!this.isFinished) { - utils.delay(this._tickAndRepeat, [], this); - this._tickScheduled = true; - } - }; - - /** - * Read and push a chunk. - */ - DataWorker.prototype._tick = function () { - - if (this.isPaused || this.isFinished) { - return false; - } - - var size = DEFAULT_BLOCK_SIZE; - var data = null, nextIndex = Math.min(this.max, this.index + size); - if (this.index >= this.max) { - // EOF - return this.end(); - } else { - switch (this.type) { - case "string": - data = this.data.substring(this.index, nextIndex); - break; - case "uint8array": - data = this.data.subarray(this.index, nextIndex); - break; - case "array": - case "nodebuffer": - data = this.data.slice(this.index, nextIndex); - break; - } - this.index = nextIndex; - return this.push({ - data: data, - meta: { - percent: this.max ? this.index / this.max * 100 : 0 - } - }); - } - }; - - module.exports = DataWorker; - - }, { "../utils": 32, "./GenericWorker": 28 }], 28: [function (require, module, exports) { - 'use strict'; - - /** - * A worker that does nothing but passing chunks to the next one. This is like - * a nodejs stream but with some differences. On the good side : - * - it works on IE 6-9 without any issue / polyfill - * - it weights less than the full dependencies bundled with browserify - * - it forwards errors (no need to declare an error handler EVERYWHERE) - * - * A chunk is an object with 2 attributes : `meta` and `data`. The former is an - * object containing anything (`percent` for example), see each worker for more - * details. The latter is the real data (String, Uint8Array, etc). - * - * @constructor - * @param {String} name the name of the stream (mainly used for debugging purposes) - */ - function GenericWorker(name) { - // the name of the worker - this.name = name || "default"; - // an object containing metadata about the workers chain - this.streamInfo = {}; - // an error which happened when the worker was paused - this.generatedError = null; - // an object containing metadata to be merged by this worker into the general metadata - this.extraStreamInfo = {}; - // true if the stream is paused (and should not do anything), false otherwise - this.isPaused = true; - // true if the stream is finished (and should not do anything), false otherwise - this.isFinished = false; - // true if the stream is locked to prevent further structure updates (pipe), false otherwise - this.isLocked = false; - // the event listeners - this._listeners = { - 'data': [], - 'end': [], - 'error': [] - }; - // the previous worker, if any - this.previous = null; - } - - GenericWorker.prototype = { - /** - * Push a chunk to the next workers. - * @param {Object} chunk the chunk to push - */ - push: function (chunk) { - this.emit("data", chunk); - }, - /** - * End the stream. - * @return {Boolean} true if this call ended the worker, false otherwise. - */ - end: function () { - if (this.isFinished) { - return false; - } - - this.flush(); - try { - this.emit("end"); - this.cleanUp(); - this.isFinished = true; - } catch (e) { - this.emit("error", e); - } - return true; - }, - /** - * End the stream with an error. - * @param {Error} e the error which caused the premature end. - * @return {Boolean} true if this call ended the worker with an error, false otherwise. - */ - error: function (e) { - if (this.isFinished) { - return false; - } - - if (this.isPaused) { - this.generatedError = e; - } else { - this.isFinished = true; - - this.emit("error", e); - - // in the workers chain exploded in the middle of the chain, - // the error event will go downward but we also need to notify - // workers upward that there has been an error. - if (this.previous) { - this.previous.error(e); - } - - this.cleanUp(); - } - return true; - }, - /** - * Add a callback on an event. - * @param {String} name the name of the event (data, end, error) - * @param {Function} listener the function to call when the event is triggered - * @return {GenericWorker} the current object for chainability - */ - on: function (name, listener) { - this._listeners[name].push(listener); - return this; - }, - /** - * Clean any references when a worker is ending. - */ - cleanUp: function () { - this.streamInfo = this.generatedError = this.extraStreamInfo = null; - this._listeners = []; - }, - /** - * Trigger an event. This will call registered callback with the provided arg. - * @param {String} name the name of the event (data, end, error) - * @param {Object} arg the argument to call the callback with. - */ - emit: function (name, arg) { - if (this._listeners[name]) { - for (var i = 0; i < this._listeners[name].length; i++) { - this._listeners[name][i].call(this, arg); - } - } - }, - /** - * Chain a worker with an other. - * @param {Worker} next the worker receiving events from the current one. - * @return {worker} the next worker for chainability - */ - pipe: function (next) { - return next.registerPrevious(this); - }, - /** - * Same as `pipe` in the other direction. - * Using an API with `pipe(next)` is very easy. - * Implementing the API with the point of view of the next one registering - * a source is easier, see the ZipFileWorker. - * @param {Worker} previous the previous worker, sending events to this one - * @return {Worker} the current worker for chainability - */ - registerPrevious: function (previous) { - if (this.isLocked) { - throw new Error("The stream '" + this + "' has already been used."); - } - - // sharing the streamInfo... - this.streamInfo = previous.streamInfo; - // ... and adding our own bits - this.mergeStreamInfo(); - this.previous = previous; - var self = this; - previous.on('data', function (chunk) { - self.processChunk(chunk); - }); - previous.on('end', function () { - self.end(); - }); - previous.on('error', function (e) { - self.error(e); - }); - return this; - }, - /** - * Pause the stream so it doesn't send events anymore. - * @return {Boolean} true if this call paused the worker, false otherwise. - */ - pause: function () { - if (this.isPaused || this.isFinished) { - return false; - } - this.isPaused = true; - - if (this.previous) { - this.previous.pause(); - } - return true; - }, - /** - * Resume a paused stream. - * @return {Boolean} true if this call resumed the worker, false otherwise. - */ - resume: function () { - if (!this.isPaused || this.isFinished) { - return false; - } - this.isPaused = false; - - // if true, the worker tried to resume but failed - var withError = false; - if (this.generatedError) { - this.error(this.generatedError); - withError = true; - } - if (this.previous) { - this.previous.resume(); - } - - return !withError; - }, - /** - * Flush any remaining bytes as the stream is ending. - */ - flush: function () { }, - /** - * Process a chunk. This is usually the method overridden. - * @param {Object} chunk the chunk to process. - */ - processChunk: function (chunk) { - this.push(chunk); - }, - /** - * Add a key/value to be added in the workers chain streamInfo once activated. - * @param {String} key the key to use - * @param {Object} value the associated value - * @return {Worker} the current worker for chainability - */ - withStreamInfo: function (key, value) { - this.extraStreamInfo[key] = value; - this.mergeStreamInfo(); - return this; - }, - /** - * Merge this worker's streamInfo into the chain's streamInfo. - */ - mergeStreamInfo: function () { - for (var key in this.extraStreamInfo) { - if (!this.extraStreamInfo.hasOwnProperty(key)) { - continue; - } - this.streamInfo[key] = this.extraStreamInfo[key]; - } - }, - - /** - * Lock the stream to prevent further updates on the workers chain. - * After calling this method, all calls to pipe will fail. - */ - lock: function () { - if (this.isLocked) { - throw new Error("The stream '" + this + "' has already been used."); - } - this.isLocked = true; - if (this.previous) { - this.previous.lock(); - } - }, - - /** - * - * Pretty print the workers chain. - */ - toString: function () { - var me = "Worker " + this.name; - if (this.previous) { - return this.previous + " -> " + me; - } else { - return me; - } - } - }; - - module.exports = GenericWorker; - - }, {}], 29: [function (require, module, exports) { - 'use strict'; - - var utils = require('../utils'); - var ConvertWorker = require('./ConvertWorker'); - var GenericWorker = require('./GenericWorker'); - var base64 = require('../base64'); - var support = require("../support"); - var external = require("../external"); - - var NodejsStreamOutputAdapter = null; - if (support.nodestream) { - try { - NodejsStreamOutputAdapter = require('../nodejs/NodejsStreamOutputAdapter'); - } catch (e) { } - } - - /** - * Apply the final transformation of the data. If the user wants a Blob for - * example, it's easier to work with an U8intArray and finally do the - * ArrayBuffer/Blob conversion. - * @param {String} type the name of the final type - * @param {String|Uint8Array|Buffer} content the content to transform - * @param {String} mimeType the mime type of the content, if applicable. - * @return {String|Uint8Array|ArrayBuffer|Buffer|Blob} the content in the right format. - */ - function transformZipOutput(type, content, mimeType) { - switch (type) { - case "blob": - return utils.newBlob(utils.transformTo("arraybuffer", content), mimeType); - case "base64": - return base64.encode(content); - default: - return utils.transformTo(type, content); - } - } - - /** - * Concatenate an array of data of the given type. - * @param {String} type the type of the data in the given array. - * @param {Array} dataArray the array containing the data chunks to concatenate - * @return {String|Uint8Array|Buffer} the concatenated data - * @throws Error if the asked type is unsupported - */ - function concat(type, dataArray) { - var i, index = 0, res = null, totalLength = 0; - for (i = 0; i < dataArray.length; i++) { - totalLength += dataArray[i].length; - } - switch (type) { - case "string": - return dataArray.join(""); - case "array": - return Array.prototype.concat.apply([], dataArray); - case "uint8array": - res = new Uint8Array(totalLength); - for (i = 0; i < dataArray.length; i++) { - res.set(dataArray[i], index); - index += dataArray[i].length; - } - return res; - case "nodebuffer": - return Buffer.concat(dataArray); - default: - throw new Error("concat : unsupported type '" + type + "'"); - } - } - - /** - * Listen a StreamHelper, accumulate its content and concatenate it into a - * complete block. - * @param {StreamHelper} helper the helper to use. - * @param {Function} updateCallback a callback called on each update. Called - * with one arg : - * - the metadata linked to the update received. - * @return Promise the promise for the accumulation. - */ - function accumulate(helper, updateCallback) { - return new external.Promise(function (resolve, reject) { - var dataArray = []; - var chunkType = helper._internalType, - resultType = helper._outputType, - mimeType = helper._mimeType; - helper - .on('data', function (data, meta) { - dataArray.push(data); - if (updateCallback) { - updateCallback(meta); - } - }) - .on('error', function (err) { - dataArray = []; - reject(err); - }) - .on('end', function () { - try { - var result = transformZipOutput(resultType, concat(chunkType, dataArray), mimeType); - resolve(result); - } catch (e) { - reject(e); - } - dataArray = []; - }) - .resume(); - }); - } - - /** - * An helper to easily use workers outside of JSZip. - * @constructor - * @param {Worker} worker the worker to wrap - * @param {String} outputType the type of data expected by the use - * @param {String} mimeType the mime type of the content, if applicable. - */ - function StreamHelper(worker, outputType, mimeType) { - var internalType = outputType; - switch (outputType) { - case "blob": - case "arraybuffer": - internalType = "uint8array"; - break; - case "base64": - internalType = "string"; - break; - } - - try { - // the type used internally - this._internalType = internalType; - // the type used to output results - this._outputType = outputType; - // the mime type - this._mimeType = mimeType; - utils.checkSupport(internalType); - this._worker = worker.pipe(new ConvertWorker(internalType)); - // the last workers can be rewired without issues but we need to - // prevent any updates on previous workers. - worker.lock(); - } catch (e) { - this._worker = new GenericWorker("error"); - this._worker.error(e); - } - } - - StreamHelper.prototype = { - /** - * Listen a StreamHelper, accumulate its content and concatenate it into a - * complete block. - * @param {Function} updateCb the update callback. - * @return Promise the promise for the accumulation. - */ - accumulate: function (updateCb) { - return accumulate(this, updateCb); - }, - /** - * Add a listener on an event triggered on a stream. - * @param {String} evt the name of the event - * @param {Function} fn the listener - * @return {StreamHelper} the current helper. - */ - on: function (evt, fn) { - var self = this; - - if (evt === "data") { - this._worker.on(evt, function (chunk) { - fn.call(self, chunk.data, chunk.meta); - }); - } else { - this._worker.on(evt, function () { - utils.delay(fn, arguments, self); - }); - } - return this; - }, - /** - * Resume the flow of chunks. - * @return {StreamHelper} the current helper. - */ - resume: function () { - utils.delay(this._worker.resume, [], this._worker); - return this; - }, - /** - * Pause the flow of chunks. - * @return {StreamHelper} the current helper. - */ - pause: function () { - this._worker.pause(); - return this; - }, - /** - * Return a nodejs stream for this helper. - * @param {Function} updateCb the update callback. - * @return {NodejsStreamOutputAdapter} the nodejs stream. - */ - toNodejsStream: function (updateCb) { - utils.checkSupport("nodestream"); - if (this._outputType !== "nodebuffer") { - // an object stream containing blob/arraybuffer/uint8array/string - // is strange and I don't know if it would be useful. - // I you find this comment and have a good usecase, please open a - // bug report ! - throw new Error(this._outputType + " is not supported by this method"); - } - - return new NodejsStreamOutputAdapter(this, { - objectMode: this._outputType !== "nodebuffer" - }, updateCb); - } - }; - - - module.exports = StreamHelper; - - }, { "../base64": 1, "../external": 6, "../nodejs/NodejsStreamOutputAdapter": 13, "../support": 30, "../utils": 32, "./ConvertWorker": 24, "./GenericWorker": 28 }], 30: [function (require, module, exports) { - 'use strict'; - - exports.base64 = true; - exports.array = true; - exports.string = true; - exports.arraybuffer = typeof ArrayBuffer !== "undefined" && typeof Uint8Array !== "undefined"; - exports.nodebuffer = typeof Buffer !== "undefined"; - // contains true if JSZip can read/generate Uint8Array, false otherwise. - exports.uint8array = typeof Uint8Array !== "undefined"; - - if (typeof ArrayBuffer === "undefined") { - exports.blob = false; - } - else { - var buffer = new ArrayBuffer(0); - try { - exports.blob = new Blob([buffer], { - type: "application/zip" - }).size === 0; - } - catch (e) { - try { - var Builder = self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder; - var builder = new Builder(); - builder.append(buffer); - exports.blob = builder.getBlob('application/zip').size === 0; - } - catch (e) { - exports.blob = false; - } - } - } - - try { - exports.nodestream = !!require('readable-stream').Readable; - } catch (e) { - exports.nodestream = false; - } - - }, { "readable-stream": 16 }], 31: [function (require, module, exports) { - 'use strict'; - - var utils = require('./utils'); - var support = require('./support'); - var nodejsUtils = require('./nodejsUtils'); - var GenericWorker = require('./stream/GenericWorker'); - - /** - * The following functions come from pako, from pako/lib/utils/strings - * released under the MIT license, see pako https://github.com/nodeca/pako/ - */ - - // Table with utf8 lengths (calculated by first byte of sequence) - // Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS, - // because max possible codepoint is 0x10ffff - var _utf8len = new Array(256); - for (var i = 0; i < 256; i++) { - _utf8len[i] = (i >= 252 ? 6 : i >= 248 ? 5 : i >= 240 ? 4 : i >= 224 ? 3 : i >= 192 ? 2 : 1); - } - _utf8len[254] = _utf8len[254] = 1; // Invalid sequence start - - // convert string to array (typed, when possible) - var string2buf = function (str) { - var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0; - - // count binary size - for (m_pos = 0; m_pos < str_len; m_pos++) { - c = str.charCodeAt(m_pos); - if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) { - c2 = str.charCodeAt(m_pos + 1); - if ((c2 & 0xfc00) === 0xdc00) { - c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); - m_pos++; - } - } - buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4; - } - - // allocate buffer - if (support.uint8array) { - buf = new Uint8Array(buf_len); - } else { - buf = new Array(buf_len); - } - - // convert - for (i = 0, m_pos = 0; i < buf_len; m_pos++) { - c = str.charCodeAt(m_pos); - if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) { - c2 = str.charCodeAt(m_pos + 1); - if ((c2 & 0xfc00) === 0xdc00) { - c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); - m_pos++; - } - } - if (c < 0x80) { - /* one byte */ - buf[i++] = c; - } else if (c < 0x800) { - /* two bytes */ - buf[i++] = 0xC0 | (c >>> 6); - buf[i++] = 0x80 | (c & 0x3f); - } else if (c < 0x10000) { - /* three bytes */ - buf[i++] = 0xE0 | (c >>> 12); - buf[i++] = 0x80 | (c >>> 6 & 0x3f); - buf[i++] = 0x80 | (c & 0x3f); - } else { - /* four bytes */ - buf[i++] = 0xf0 | (c >>> 18); - buf[i++] = 0x80 | (c >>> 12 & 0x3f); - buf[i++] = 0x80 | (c >>> 6 & 0x3f); - buf[i++] = 0x80 | (c & 0x3f); - } - } - - return buf; - }; - - // Calculate max possible position in utf8 buffer, - // that will not break sequence. If that's not possible - // - (very small limits) return max size as is. - // - // buf[] - utf8 bytes array - // max - length limit (mandatory); - var utf8border = function (buf, max) { - var pos; - - max = max || buf.length; - if (max > buf.length) { max = buf.length; } - - // go back from last position, until start of sequence found - pos = max - 1; - while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; } - - // Fuckup - very small and broken sequence, - // return max, because we should return something anyway. - if (pos < 0) { return max; } - - // If we came to start of buffer - that means vuffer is too small, - // return max too. - if (pos === 0) { return max; } - - return (pos + _utf8len[buf[pos]] > max) ? pos : max; - }; - - // convert array to string - var buf2string = function (buf) { - var str, i, out, c, c_len; - var len = buf.length; - - // Reserve max possible length (2 words per char) - // NB: by unknown reasons, Array is significantly faster for - // String.fromCharCode.apply than Uint16Array. - var utf16buf = new Array(len * 2); - - for (out = 0, i = 0; i < len;) { - c = buf[i++]; - // quick process ascii - if (c < 0x80) { utf16buf[out++] = c; continue; } - - c_len = _utf8len[c]; - // skip 5 & 6 byte codes - if (c_len > 4) { utf16buf[out++] = 0xfffd; i += c_len - 1; continue; } - - // apply mask on first byte - c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07; - // join the rest - while (c_len > 1 && i < len) { - c = (c << 6) | (buf[i++] & 0x3f); - c_len--; - } - - // terminated by end of string? - if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; } - - if (c < 0x10000) { - utf16buf[out++] = c; - } else { - c -= 0x10000; - utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff); - utf16buf[out++] = 0xdc00 | (c & 0x3ff); - } - } - - // shrinkBuf(utf16buf, out) - if (utf16buf.length !== out) { - if (utf16buf.subarray) { - utf16buf = utf16buf.subarray(0, out); - } else { - utf16buf.length = out; - } - } - - // return String.fromCharCode.apply(null, utf16buf); - return utils.applyFromCharCode(utf16buf); - }; - - - // That's all for the pako functions. - - - /** - * Transform a javascript string into an array (typed if possible) of bytes, - * UTF-8 encoded. - * @param {String} str the string to encode - * @return {Array|Uint8Array|Buffer} the UTF-8 encoded string. - */ - exports.utf8encode = function utf8encode(str) { - if (support.nodebuffer) { - return nodejsUtils.newBufferFrom(str, "utf-8"); - } - - return string2buf(str); - }; - - - /** - * Transform a bytes array (or a representation) representing an UTF-8 encoded - * string into a javascript string. - * @param {Array|Uint8Array|Buffer} buf the data de decode - * @return {String} the decoded string. - */ - exports.utf8decode = function utf8decode(buf) { - if (support.nodebuffer) { - return utils.transformTo("nodebuffer", buf).toString("utf-8"); - } - - buf = utils.transformTo(support.uint8array ? "uint8array" : "array", buf); - - return buf2string(buf); - }; - - /** - * A worker to decode utf8 encoded binary chunks into string chunks. - * @constructor - */ - function Utf8DecodeWorker() { - GenericWorker.call(this, "utf-8 decode"); - // the last bytes if a chunk didn't end with a complete codepoint. - this.leftOver = null; - } - utils.inherits(Utf8DecodeWorker, GenericWorker); - - /** - * @see GenericWorker.processChunk - */ - Utf8DecodeWorker.prototype.processChunk = function (chunk) { - - var data = utils.transformTo(support.uint8array ? "uint8array" : "array", chunk.data); - - // 1st step, re-use what's left of the previous chunk - if (this.leftOver && this.leftOver.length) { - if (support.uint8array) { - var previousData = data; - data = new Uint8Array(previousData.length + this.leftOver.length); - data.set(this.leftOver, 0); - data.set(previousData, this.leftOver.length); - } else { - data = this.leftOver.concat(data); - } - this.leftOver = null; - } - - var nextBoundary = utf8border(data); - var usableData = data; - if (nextBoundary !== data.length) { - if (support.uint8array) { - usableData = data.subarray(0, nextBoundary); - this.leftOver = data.subarray(nextBoundary, data.length); - } else { - usableData = data.slice(0, nextBoundary); - this.leftOver = data.slice(nextBoundary, data.length); - } - } - - this.push({ - data: exports.utf8decode(usableData), - meta: chunk.meta - }); - }; - - /** - * @see GenericWorker.flush - */ - Utf8DecodeWorker.prototype.flush = function () { - if (this.leftOver && this.leftOver.length) { - this.push({ - data: exports.utf8decode(this.leftOver), - meta: {} - }); - this.leftOver = null; - } - }; - exports.Utf8DecodeWorker = Utf8DecodeWorker; - - /** - * A worker to endcode string chunks into utf8 encoded binary chunks. - * @constructor - */ - function Utf8EncodeWorker() { - GenericWorker.call(this, "utf-8 encode"); - } - utils.inherits(Utf8EncodeWorker, GenericWorker); - - /** - * @see GenericWorker.processChunk - */ - Utf8EncodeWorker.prototype.processChunk = function (chunk) { - this.push({ - data: exports.utf8encode(chunk.data), - meta: chunk.meta - }); - }; - exports.Utf8EncodeWorker = Utf8EncodeWorker; - - }, { "./nodejsUtils": 14, "./stream/GenericWorker": 28, "./support": 30, "./utils": 32 }], 32: [function (require, module, exports) { - 'use strict'; - - var support = require('./support'); - var base64 = require('./base64'); - var nodejsUtils = require('./nodejsUtils'); - var setImmediate = require('set-immediate-shim'); - var external = require("./external"); - - - /** - * Convert a string that pass as a "binary string": it should represent a byte - * array but may have > 255 char codes. Be sure to take only the first byte - * and returns the byte array. - * @param {String} str the string to transform. - * @return {Array|Uint8Array} the string in a binary format. - */ - function string2binary(str) { - var result = null; - if (support.uint8array) { - result = new Uint8Array(str.length); - } else { - result = new Array(str.length); - } - return stringToArrayLike(str, result); - } - - /** - * Create a new blob with the given content and the given type. - * @param {String|ArrayBuffer} part the content to put in the blob. DO NOT use - * an Uint8Array because the stock browser of android 4 won't accept it (it - * will be silently converted to a string, "[object Uint8Array]"). - * - * Use only ONE part to build the blob to avoid a memory leak in IE11 / Edge: - * when a large amount of Array is used to create the Blob, the amount of - * memory consumed is nearly 100 times the original data amount. - * - * @param {String} type the mime type of the blob. - * @return {Blob} the created blob. - */ - exports.newBlob = function (part, type) { - exports.checkSupport("blob"); - - try { - // Blob constructor - return new Blob([part], { - type: type - }); - } - catch (e) { - - try { - // deprecated, browser only, old way - var Builder = self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder; - var builder = new Builder(); - builder.append(part); - return builder.getBlob(type); - } - catch (e) { - - // well, fuck ?! - throw new Error("Bug : can't construct the Blob."); - } - } - - - }; - /** - * The identity function. - * @param {Object} input the input. - * @return {Object} the same input. - */ - function identity(input) { - return input; - } - - /** - * Fill in an array with a string. - * @param {String} str the string to use. - * @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to fill in (will be mutated). - * @return {Array|ArrayBuffer|Uint8Array|Buffer} the updated array. - */ - function stringToArrayLike(str, array) { - for (var i = 0; i < str.length; ++i) { - array[i] = str.charCodeAt(i) & 0xFF; - } - return array; - } - - /** - * An helper for the function arrayLikeToString. - * This contains static information and functions that - * can be optimized by the browser JIT compiler. - */ - var arrayToStringHelper = { - /** - * Transform an array of int into a string, chunk by chunk. - * See the performances notes on arrayLikeToString. - * @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to transform. - * @param {String} type the type of the array. - * @param {Integer} chunk the chunk size. - * @return {String} the resulting string. - * @throws Error if the chunk is too big for the stack. - */ - stringifyByChunk: function (array, type, chunk) { - var result = [], k = 0, len = array.length; - // shortcut - if (len <= chunk) { - return String.fromCharCode.apply(null, array); - } - while (k < len) { - if (type === "array" || type === "nodebuffer") { - result.push(String.fromCharCode.apply(null, array.slice(k, Math.min(k + chunk, len)))); - } - else { - result.push(String.fromCharCode.apply(null, array.subarray(k, Math.min(k + chunk, len)))); - } - k += chunk; - } - return result.join(""); - }, - /** - * Call String.fromCharCode on every item in the array. - * This is the naive implementation, which generate A LOT of intermediate string. - * This should be used when everything else fail. - * @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to transform. - * @return {String} the result. - */ - stringifyByChar: function (array) { - var resultStr = ""; - for (var i = 0; i < array.length; i++) { - resultStr += String.fromCharCode(array[i]); - } - return resultStr; - }, - applyCanBeUsed: { - /** - * true if the browser accepts to use String.fromCharCode on Uint8Array - */ - uint8array: (function () { - try { - return support.uint8array && String.fromCharCode.apply(null, new Uint8Array(1)).length === 1; - } catch (e) { - return false; - } - })(), - /** - * true if the browser accepts to use String.fromCharCode on nodejs Buffer. - */ - nodebuffer: (function () { - try { - return support.nodebuffer && String.fromCharCode.apply(null, nodejsUtils.allocBuffer(1)).length === 1; - } catch (e) { - return false; - } - })() - } - }; - - /** - * Transform an array-like object to a string. - * @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to transform. - * @return {String} the result. - */ - function arrayLikeToString(array) { - // Performances notes : - // -------------------- - // String.fromCharCode.apply(null, array) is the fastest, see - // see http://jsperf.com/converting-a-uint8array-to-a-string/2 - // but the stack is limited (and we can get huge arrays !). - // - // result += String.fromCharCode(array[i]); generate too many strings ! - // - // This code is inspired by http://jsperf.com/arraybuffer-to-string-apply-performance/2 - // TODO : we now have workers that split the work. Do we still need that ? - var chunk = 65536, - type = exports.getTypeOf(array), - canUseApply = true; - if (type === "uint8array") { - canUseApply = arrayToStringHelper.applyCanBeUsed.uint8array; - } else if (type === "nodebuffer") { - canUseApply = arrayToStringHelper.applyCanBeUsed.nodebuffer; - } - - if (canUseApply) { - while (chunk > 1) { - try { - return arrayToStringHelper.stringifyByChunk(array, type, chunk); - } catch (e) { - chunk = Math.floor(chunk / 2); - } - } - } - - // no apply or chunk error : slow and painful algorithm - // default browser on android 4.* - return arrayToStringHelper.stringifyByChar(array); - } - - exports.applyFromCharCode = arrayLikeToString; - - - /** - * Copy the data from an array-like to an other array-like. - * @param {Array|ArrayBuffer|Uint8Array|Buffer} arrayFrom the origin array. - * @param {Array|ArrayBuffer|Uint8Array|Buffer} arrayTo the destination array which will be mutated. - * @return {Array|ArrayBuffer|Uint8Array|Buffer} the updated destination array. - */ - function arrayLikeToArrayLike(arrayFrom, arrayTo) { - for (var i = 0; i < arrayFrom.length; i++) { - arrayTo[i] = arrayFrom[i]; - } - return arrayTo; - } - - // a matrix containing functions to transform everything into everything. - var transform = {}; - - // string to ? - transform["string"] = { - "string": identity, - "array": function (input) { - return stringToArrayLike(input, new Array(input.length)); - }, - "arraybuffer": function (input) { - return transform["string"]["uint8array"](input).buffer; - }, - "uint8array": function (input) { - return stringToArrayLike(input, new Uint8Array(input.length)); - }, - "nodebuffer": function (input) { - return stringToArrayLike(input, nodejsUtils.allocBuffer(input.length)); - } - }; - - // array to ? - transform["array"] = { - "string": arrayLikeToString, - "array": identity, - "arraybuffer": function (input) { - return (new Uint8Array(input)).buffer; - }, - "uint8array": function (input) { - return new Uint8Array(input); - }, - "nodebuffer": function (input) { - return nodejsUtils.newBufferFrom(input); - } - }; - - // arraybuffer to ? - transform["arraybuffer"] = { - "string": function (input) { - return arrayLikeToString(new Uint8Array(input)); - }, - "array": function (input) { - return arrayLikeToArrayLike(new Uint8Array(input), new Array(input.byteLength)); - }, - "arraybuffer": identity, - "uint8array": function (input) { - return new Uint8Array(input); - }, - "nodebuffer": function (input) { - return nodejsUtils.newBufferFrom(new Uint8Array(input)); - } - }; - - // uint8array to ? - transform["uint8array"] = { - "string": arrayLikeToString, - "array": function (input) { - return arrayLikeToArrayLike(input, new Array(input.length)); - }, - "arraybuffer": function (input) { - return input.buffer; - }, - "uint8array": identity, - "nodebuffer": function (input) { - return nodejsUtils.newBufferFrom(input); - } - }; - - // nodebuffer to ? - transform["nodebuffer"] = { - "string": arrayLikeToString, - "array": function (input) { - return arrayLikeToArrayLike(input, new Array(input.length)); - }, - "arraybuffer": function (input) { - return transform["nodebuffer"]["uint8array"](input).buffer; - }, - "uint8array": function (input) { - return arrayLikeToArrayLike(input, new Uint8Array(input.length)); - }, - "nodebuffer": identity - }; - - /** - * Transform an input into any type. - * The supported output type are : string, array, uint8array, arraybuffer, nodebuffer. - * If no output type is specified, the unmodified input will be returned. - * @param {String} outputType the output type. - * @param {String|Array|ArrayBuffer|Uint8Array|Buffer} input the input to convert. - * @throws {Error} an Error if the browser doesn't support the requested output type. - */ - exports.transformTo = function (outputType, input) { - if (!input) { - // undefined, null, etc - // an empty string won't harm. - input = ""; - } - if (!outputType) { - return input; - } - exports.checkSupport(outputType); - var inputType = exports.getTypeOf(input); - var result = transform[inputType][outputType](input); - return result; - }; - - /** - * Return the type of the input. - * The type will be in a format valid for JSZip.utils.transformTo : string, array, uint8array, arraybuffer. - * @param {Object} input the input to identify. - * @return {String} the (lowercase) type of the input. - */ - exports.getTypeOf = function (input) { - if (typeof input === "string") { - return "string"; - } - if (Object.prototype.toString.call(input) === "[object Array]") { - return "array"; - } - if (support.nodebuffer && nodejsUtils.isBuffer(input)) { - return "nodebuffer"; - } - if (support.uint8array && input instanceof Uint8Array) { - return "uint8array"; - } - if (support.arraybuffer && input instanceof ArrayBuffer) { - return "arraybuffer"; - } - }; - - /** - * Throw an exception if the type is not supported. - * @param {String} type the type to check. - * @throws {Error} an Error if the browser doesn't support the requested type. - */ - exports.checkSupport = function (type) { - var supported = support[type.toLowerCase()]; - if (!supported) { - throw new Error(type + " is not supported by this platform"); - } - }; - - exports.MAX_VALUE_16BITS = 65535; - exports.MAX_VALUE_32BITS = -1; // well, "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" is parsed as -1 - - /** - * Prettify a string read as binary. - * @param {string} str the string to prettify. - * @return {string} a pretty string. - */ - exports.pretty = function (str) { - var res = '', - code, i; - for (i = 0; i < (str || "").length; i++) { - code = str.charCodeAt(i); - res += '\\x' + (code < 16 ? "0" : "") + code.toString(16).toUpperCase(); - } - return res; - }; - - /** - * Defer the call of a function. - * @param {Function} callback the function to call asynchronously. - * @param {Array} args the arguments to give to the callback. - */ - exports.delay = function (callback, args, self) { - setImmediate(function () { - callback.apply(self || null, args || []); - }); - }; - - /** - * Extends a prototype with an other, without calling a constructor with - * side effects. Inspired by nodejs' `utils.inherits` - * @param {Function} ctor the constructor to augment - * @param {Function} superCtor the parent constructor to use - */ - exports.inherits = function (ctor, superCtor) { - var Obj = function () { }; - Obj.prototype = superCtor.prototype; - ctor.prototype = new Obj(); - }; - - /** - * Merge the objects passed as parameters into a new one. - * @private - * @param {...Object} var_args All objects to merge. - * @return {Object} a new object with the data of the others. - */ - exports.extend = function () { - var result = {}, i, attr; - for (i = 0; i < arguments.length; i++) { // arguments is not enumerable in some browsers - for (attr in arguments[i]) { - if (arguments[i].hasOwnProperty(attr) && typeof result[attr] === "undefined") { - result[attr] = arguments[i][attr]; - } - } - } - return result; - }; - - /** - * Transform arbitrary content into a Promise. - * @param {String} name a name for the content being processed. - * @param {Object} inputData the content to process. - * @param {Boolean} isBinary true if the content is not an unicode string - * @param {Boolean} isOptimizedBinaryString true if the string content only has one byte per character. - * @param {Boolean} isBase64 true if the string content is encoded with base64. - * @return {Promise} a promise in a format usable by JSZip. - */ - exports.prepareContent = function (name, inputData, isBinary, isOptimizedBinaryString, isBase64) { - - // if inputData is already a promise, this flatten it. - var promise = external.Promise.resolve(inputData).then(function (data) { - - - var isBlob = support.blob && (data instanceof Blob || ['[object File]', '[object Blob]'].indexOf(Object.prototype.toString.call(data)) !== -1); - - if (isBlob && typeof FileReader !== "undefined") { - return new external.Promise(function (resolve, reject) { - var reader = new FileReader(); - - reader.onload = function (e) { - resolve(e.target.result); - }; - reader.onerror = function (e) { - reject(e.target.error); - }; - reader.readAsArrayBuffer(data); - }); - } else { - return data; - } - }); - - return promise.then(function (data) { - var dataType = exports.getTypeOf(data); - - if (!dataType) { - return external.Promise.reject( - new Error("Can't read the data of '" + name + "'. Is it " + - "in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?") - ); - } - // special case : it's way easier to work with Uint8Array than with ArrayBuffer - if (dataType === "arraybuffer") { - data = exports.transformTo("uint8array", data); - } else if (dataType === "string") { - if (isBase64) { - data = base64.decode(data); - } - else if (isBinary) { - // optimizedBinaryString === true means that the file has already been filtered with a 0xFF mask - if (isOptimizedBinaryString !== true) { - // this is a string, not in a base64 format. - // Be sure that this is a correct "binary string" - data = string2binary(data); - } - } - } - return data; - }); - }; - - }, { "./base64": 1, "./external": 6, "./nodejsUtils": 14, "./support": 30, "set-immediate-shim": 54 }], 33: [function (require, module, exports) { - 'use strict'; - var readerFor = require('./reader/readerFor'); - var utils = require('./utils'); - var sig = require('./signature'); - var ZipEntry = require('./zipEntry'); - var utf8 = require('./utf8'); - var support = require('./support'); - // class ZipEntries {{{ - /** - * All the entries in the zip file. - * @constructor - * @param {Object} loadOptions Options for loading the stream. - */ - function ZipEntries(loadOptions) { - this.files = []; - this.loadOptions = loadOptions; - } - ZipEntries.prototype = { - /** - * Check that the reader is on the specified signature. - * @param {string} expectedSignature the expected signature. - * @throws {Error} if it is an other signature. - */ - checkSignature: function (expectedSignature) { - if (!this.reader.readAndCheckSignature(expectedSignature)) { - this.reader.index -= 4; - var signature = this.reader.readString(4); - throw new Error("Corrupted zip or bug: unexpected signature " + "(" + utils.pretty(signature) + ", expected " + utils.pretty(expectedSignature) + ")"); - } - }, - /** - * Check if the given signature is at the given index. - * @param {number} askedIndex the index to check. - * @param {string} expectedSignature the signature to expect. - * @return {boolean} true if the signature is here, false otherwise. - */ - isSignature: function (askedIndex, expectedSignature) { - var currentIndex = this.reader.index; - this.reader.setIndex(askedIndex); - var signature = this.reader.readString(4); - var result = signature === expectedSignature; - this.reader.setIndex(currentIndex); - return result; - }, - /** - * Read the end of the central directory. - */ - readBlockEndOfCentral: function () { - this.diskNumber = this.reader.readInt(2); - this.diskWithCentralDirStart = this.reader.readInt(2); - this.centralDirRecordsOnThisDisk = this.reader.readInt(2); - this.centralDirRecords = this.reader.readInt(2); - this.centralDirSize = this.reader.readInt(4); - this.centralDirOffset = this.reader.readInt(4); - - this.zipCommentLength = this.reader.readInt(2); - // warning : the encoding depends of the system locale - // On a linux machine with LANG=en_US.utf8, this field is utf8 encoded. - // On a windows machine, this field is encoded with the localized windows code page. - var zipComment = this.reader.readData(this.zipCommentLength); - var decodeParamType = support.uint8array ? "uint8array" : "array"; - // To get consistent behavior with the generation part, we will assume that - // this is utf8 encoded unless specified otherwise. - var decodeContent = utils.transformTo(decodeParamType, zipComment); - this.zipComment = this.loadOptions.decodeFileName(decodeContent); - }, - /** - * Read the end of the Zip 64 central directory. - * Not merged with the method readEndOfCentral : - * The end of central can coexist with its Zip64 brother, - * I don't want to read the wrong number of bytes ! - */ - readBlockZip64EndOfCentral: function () { - this.zip64EndOfCentralSize = this.reader.readInt(8); - this.reader.skip(4); - // this.versionMadeBy = this.reader.readString(2); - // this.versionNeeded = this.reader.readInt(2); - this.diskNumber = this.reader.readInt(4); - this.diskWithCentralDirStart = this.reader.readInt(4); - this.centralDirRecordsOnThisDisk = this.reader.readInt(8); - this.centralDirRecords = this.reader.readInt(8); - this.centralDirSize = this.reader.readInt(8); - this.centralDirOffset = this.reader.readInt(8); - - this.zip64ExtensibleData = {}; - var extraDataSize = this.zip64EndOfCentralSize - 44, - index = 0, - extraFieldId, - extraFieldLength, - extraFieldValue; - while (index < extraDataSize) { - extraFieldId = this.reader.readInt(2); - extraFieldLength = this.reader.readInt(4); - extraFieldValue = this.reader.readData(extraFieldLength); - this.zip64ExtensibleData[extraFieldId] = { - id: extraFieldId, - length: extraFieldLength, - value: extraFieldValue - }; - } - }, - /** - * Read the end of the Zip 64 central directory locator. - */ - readBlockZip64EndOfCentralLocator: function () { - this.diskWithZip64CentralDirStart = this.reader.readInt(4); - this.relativeOffsetEndOfZip64CentralDir = this.reader.readInt(8); - this.disksCount = this.reader.readInt(4); - if (this.disksCount > 1) { - throw new Error("Multi-volumes zip are not supported"); - } - }, - /** - * Read the local files, based on the offset read in the central part. - */ - readLocalFiles: function () { - var i, file; - for (i = 0; i < this.files.length; i++) { - file = this.files[i]; - this.reader.setIndex(file.localHeaderOffset); - this.checkSignature(sig.LOCAL_FILE_HEADER); - file.readLocalPart(this.reader); - file.handleUTF8(); - file.processAttributes(); - } - }, - /** - * Read the central directory. - */ - readCentralDir: function () { - var file; - - this.reader.setIndex(this.centralDirOffset); - while (this.reader.readAndCheckSignature(sig.CENTRAL_FILE_HEADER)) { - file = new ZipEntry({ - zip64: this.zip64 - }, this.loadOptions); - file.readCentralPart(this.reader); - this.files.push(file); - } - - if (this.centralDirRecords !== this.files.length) { - if (this.centralDirRecords !== 0 && this.files.length === 0) { - // We expected some records but couldn't find ANY. - // This is really suspicious, as if something went wrong. - throw new Error("Corrupted zip or bug: expected " + this.centralDirRecords + " records in central dir, got " + this.files.length); - } else { - // We found some records but not all. - // Something is wrong but we got something for the user: no error here. - // console.warn("expected", this.centralDirRecords, "records in central dir, got", this.files.length); - } - } - }, - /** - * Read the end of central directory. - */ - readEndOfCentral: function () { - var offset = this.reader.lastIndexOfSignature(sig.CENTRAL_DIRECTORY_END); - if (offset < 0) { - // Check if the content is a truncated zip or complete garbage. - // A "LOCAL_FILE_HEADER" is not required at the beginning (auto - // extractible zip for example) but it can give a good hint. - // If an ajax request was used without responseType, we will also - // get unreadable data. - var isGarbage = !this.isSignature(0, sig.LOCAL_FILE_HEADER); - - if (isGarbage) { - throw new Error("Can't find end of central directory : is this a zip file ? " + - "If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html"); - } else { - throw new Error("Corrupted zip: can't find end of central directory"); - } - - } - this.reader.setIndex(offset); - var endOfCentralDirOffset = offset; - this.checkSignature(sig.CENTRAL_DIRECTORY_END); - this.readBlockEndOfCentral(); - - - /* extract from the zip spec : - 4) If one of the fields in the end of central directory - record is too small to hold required data, the field - should be set to -1 (0xFFFF or 0xFFFFFFFF) and the - ZIP64 format record should be created. - 5) The end of central directory record and the - Zip64 end of central directory locator record must - reside on the same disk when splitting or spanning - an archive. - */ - if (this.diskNumber === utils.MAX_VALUE_16BITS || this.diskWithCentralDirStart === utils.MAX_VALUE_16BITS || this.centralDirRecordsOnThisDisk === utils.MAX_VALUE_16BITS || this.centralDirRecords === utils.MAX_VALUE_16BITS || this.centralDirSize === utils.MAX_VALUE_32BITS || this.centralDirOffset === utils.MAX_VALUE_32BITS) { - this.zip64 = true; - - /* - Warning : the zip64 extension is supported, but ONLY if the 64bits integer read from - the zip file can fit into a 32bits integer. This cannot be solved : JavaScript represents - all numbers as 64-bit double precision IEEE 754 floating point numbers. - So, we have 53bits for integers and bitwise operations treat everything as 32bits. - see https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Bitwise_Operators - and http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf section 8.5 - */ - - // should look for a zip64 EOCD locator - offset = this.reader.lastIndexOfSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR); - if (offset < 0) { - throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator"); - } - this.reader.setIndex(offset); - this.checkSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR); - this.readBlockZip64EndOfCentralLocator(); - - // now the zip64 EOCD record - if (!this.isSignature(this.relativeOffsetEndOfZip64CentralDir, sig.ZIP64_CENTRAL_DIRECTORY_END)) { - // console.warn("ZIP64 end of central directory not where expected."); - this.relativeOffsetEndOfZip64CentralDir = this.reader.lastIndexOfSignature(sig.ZIP64_CENTRAL_DIRECTORY_END); - if (this.relativeOffsetEndOfZip64CentralDir < 0) { - throw new Error("Corrupted zip: can't find the ZIP64 end of central directory"); - } - } - this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir); - this.checkSignature(sig.ZIP64_CENTRAL_DIRECTORY_END); - this.readBlockZip64EndOfCentral(); - } - - var expectedEndOfCentralDirOffset = this.centralDirOffset + this.centralDirSize; - if (this.zip64) { - expectedEndOfCentralDirOffset += 20; // end of central dir 64 locator - expectedEndOfCentralDirOffset += 12 /* should not include the leading 12 bytes */ + this.zip64EndOfCentralSize; - } - - var extraBytes = endOfCentralDirOffset - expectedEndOfCentralDirOffset; - - if (extraBytes > 0) { - // console.warn(extraBytes, "extra bytes at beginning or within zipfile"); - if (this.isSignature(endOfCentralDirOffset, sig.CENTRAL_FILE_HEADER)) { - // The offsets seem wrong, but we have something at the specified offset. - // So… we keep it. - } else { - // the offset is wrong, update the "zero" of the reader - // this happens if data has been prepended (crx files for example) - this.reader.zero = extraBytes; - } - } else if (extraBytes < 0) { - throw new Error("Corrupted zip: missing " + Math.abs(extraBytes) + " bytes."); - } - }, - prepareReader: function (data) { - this.reader = readerFor(data); - }, - /** - * Read a zip file and create ZipEntries. - * @param {String|ArrayBuffer|Uint8Array|Buffer} data the binary string representing a zip file. - */ - load: function (data) { - this.prepareReader(data); - this.readEndOfCentral(); - this.readCentralDir(); - this.readLocalFiles(); - } - }; - // }}} end of ZipEntries - module.exports = ZipEntries; - - }, { "./reader/readerFor": 22, "./signature": 23, "./support": 30, "./utf8": 31, "./utils": 32, "./zipEntry": 34 }], 34: [function (require, module, exports) { - 'use strict'; - var readerFor = require('./reader/readerFor'); - var utils = require('./utils'); - var CompressedObject = require('./compressedObject'); - var crc32fn = require('./crc32'); - var utf8 = require('./utf8'); - var compressions = require('./compressions'); - var support = require('./support'); - - var MADE_BY_DOS = 0x00; - var MADE_BY_UNIX = 0x03; - - /** - * Find a compression registered in JSZip. - * @param {string} compressionMethod the method magic to find. - * @return {Object|null} the JSZip compression object, null if none found. - */ - var findCompression = function (compressionMethod) { - for (var method in compressions) { - if (!compressions.hasOwnProperty(method)) { - continue; - } - if (compressions[method].magic === compressionMethod) { - return compressions[method]; - } - } - return null; - }; - - // class ZipEntry {{{ - /** - * An entry in the zip file. - * @constructor - * @param {Object} options Options of the current file. - * @param {Object} loadOptions Options for loading the stream. - */ - function ZipEntry(options, loadOptions) { - this.options = options; - this.loadOptions = loadOptions; - } - ZipEntry.prototype = { - /** - * say if the file is encrypted. - * @return {boolean} true if the file is encrypted, false otherwise. - */ - isEncrypted: function () { - // bit 1 is set - return (this.bitFlag & 0x0001) === 0x0001; - }, - /** - * say if the file has utf-8 filename/comment. - * @return {boolean} true if the filename/comment is in utf-8, false otherwise. - */ - useUTF8: function () { - // bit 11 is set - return (this.bitFlag & 0x0800) === 0x0800; - }, - /** - * Read the local part of a zip file and add the info in this object. - * @param {DataReader} reader the reader to use. - */ - readLocalPart: function (reader) { - var compression, localExtraFieldsLength; - - // we already know everything from the central dir ! - // If the central dir data are false, we are doomed. - // On the bright side, the local part is scary : zip64, data descriptors, both, etc. - // The less data we get here, the more reliable this should be. - // Let's skip the whole header and dash to the data ! - reader.skip(22); - // in some zip created on windows, the filename stored in the central dir contains \ instead of /. - // Strangely, the filename here is OK. - // I would love to treat these zip files as corrupted (see http://www.info-zip.org/FAQ.html#backslashes - // or APPNOTE#4.4.17.1, "All slashes MUST be forward slashes '/'") but there are a lot of bad zip generators... - // Search "unzip mismatching "local" filename continuing with "central" filename version" on - // the internet. - // - // I think I see the logic here : the central directory is used to display - // content and the local directory is used to extract the files. Mixing / and \ - // may be used to display \ to windows users and use / when extracting the files. - // Unfortunately, this lead also to some issues : http://seclists.org/fulldisclosure/2009/Sep/394 - this.fileNameLength = reader.readInt(2); - localExtraFieldsLength = reader.readInt(2); // can't be sure this will be the same as the central dir - // the fileName is stored as binary data, the handleUTF8 method will take care of the encoding. - this.fileName = reader.readData(this.fileNameLength); - reader.skip(localExtraFieldsLength); - - if (this.compressedSize === -1 || this.uncompressedSize === -1) { - throw new Error("Bug or corrupted zip : didn't get enough information from the central directory " + "(compressedSize === -1 || uncompressedSize === -1)"); - } - - compression = findCompression(this.compressionMethod); - if (compression === null) { // no compression found - throw new Error("Corrupted zip : compression " + utils.pretty(this.compressionMethod) + " unknown (inner file : " + utils.transformTo("string", this.fileName) + ")"); - } - this.decompressed = new CompressedObject(this.compressedSize, this.uncompressedSize, this.crc32, compression, reader.readData(this.compressedSize)); - }, - - /** - * Read the central part of a zip file and add the info in this object. - * @param {DataReader} reader the reader to use. - */ - readCentralPart: function (reader) { - this.versionMadeBy = reader.readInt(2); - reader.skip(2); - // this.versionNeeded = reader.readInt(2); - this.bitFlag = reader.readInt(2); - this.compressionMethod = reader.readString(2); - this.date = reader.readDate(); - this.crc32 = reader.readInt(4); - this.compressedSize = reader.readInt(4); - this.uncompressedSize = reader.readInt(4); - var fileNameLength = reader.readInt(2); - this.extraFieldsLength = reader.readInt(2); - this.fileCommentLength = reader.readInt(2); - this.diskNumberStart = reader.readInt(2); - this.internalFileAttributes = reader.readInt(2); - this.externalFileAttributes = reader.readInt(4); - this.localHeaderOffset = reader.readInt(4); - - if (this.isEncrypted()) { - throw new Error("Encrypted zip are not supported"); - } - - // will be read in the local part, see the comments there - reader.skip(fileNameLength); - this.readExtraFields(reader); - this.parseZIP64ExtraField(reader); - this.fileComment = reader.readData(this.fileCommentLength); - }, - - /** - * Parse the external file attributes and get the unix/dos permissions. - */ - processAttributes: function () { - this.unixPermissions = null; - this.dosPermissions = null; - var madeBy = this.versionMadeBy >> 8; - - // Check if we have the DOS directory flag set. - // We look for it in the DOS and UNIX permissions - // but some unknown platform could set it as a compatibility flag. - this.dir = this.externalFileAttributes & 0x0010 ? true : false; - - if (madeBy === MADE_BY_DOS) { - // first 6 bits (0 to 5) - this.dosPermissions = this.externalFileAttributes & 0x3F; - } - - if (madeBy === MADE_BY_UNIX) { - this.unixPermissions = (this.externalFileAttributes >> 16) & 0xFFFF; - // the octal permissions are in (this.unixPermissions & 0x01FF).toString(8); - } - - // fail safe : if the name ends with a / it probably means a folder - if (!this.dir && this.fileNameStr.slice(-1) === '/') { - this.dir = true; - } - }, - - /** - * Parse the ZIP64 extra field and merge the info in the current ZipEntry. - * @param {DataReader} reader the reader to use. - */ - parseZIP64ExtraField: function (reader) { - - if (!this.extraFields[0x0001]) { - return; - } - - // should be something, preparing the extra reader - var extraReader = readerFor(this.extraFields[0x0001].value); - - // I really hope that these 64bits integer can fit in 32 bits integer, because js - // won't let us have more. - if (this.uncompressedSize === utils.MAX_VALUE_32BITS) { - this.uncompressedSize = extraReader.readInt(8); - } - if (this.compressedSize === utils.MAX_VALUE_32BITS) { - this.compressedSize = extraReader.readInt(8); - } - if (this.localHeaderOffset === utils.MAX_VALUE_32BITS) { - this.localHeaderOffset = extraReader.readInt(8); - } - if (this.diskNumberStart === utils.MAX_VALUE_32BITS) { - this.diskNumberStart = extraReader.readInt(4); - } - }, - /** - * Read the central part of a zip file and add the info in this object. - * @param {DataReader} reader the reader to use. - */ - readExtraFields: function (reader) { - var end = reader.index + this.extraFieldsLength, - extraFieldId, - extraFieldLength, - extraFieldValue; - - if (!this.extraFields) { - this.extraFields = {}; - } - - while (reader.index + 4 < end) { - extraFieldId = reader.readInt(2); - extraFieldLength = reader.readInt(2); - extraFieldValue = reader.readData(extraFieldLength); - - this.extraFields[extraFieldId] = { - id: extraFieldId, - length: extraFieldLength, - value: extraFieldValue - }; - } - - reader.setIndex(end); - }, - /** - * Apply an UTF8 transformation if needed. - */ - handleUTF8: function () { - var decodeParamType = support.uint8array ? "uint8array" : "array"; - if (this.useUTF8()) { - this.fileNameStr = utf8.utf8decode(this.fileName); - this.fileCommentStr = utf8.utf8decode(this.fileComment); - } else { - var upath = this.findExtraFieldUnicodePath(); - if (upath !== null) { - this.fileNameStr = upath; - } else { - // ASCII text or unsupported code page - var fileNameByteArray = utils.transformTo(decodeParamType, this.fileName); - this.fileNameStr = this.loadOptions.decodeFileName(fileNameByteArray); - } - - var ucomment = this.findExtraFieldUnicodeComment(); - if (ucomment !== null) { - this.fileCommentStr = ucomment; - } else { - // ASCII text or unsupported code page - var commentByteArray = utils.transformTo(decodeParamType, this.fileComment); - this.fileCommentStr = this.loadOptions.decodeFileName(commentByteArray); - } - } - }, - - /** - * Find the unicode path declared in the extra field, if any. - * @return {String} the unicode path, null otherwise. - */ - findExtraFieldUnicodePath: function () { - var upathField = this.extraFields[0x7075]; - if (upathField) { - var extraReader = readerFor(upathField.value); - - // wrong version - if (extraReader.readInt(1) !== 1) { - return null; - } - - // the crc of the filename changed, this field is out of date. - if (crc32fn(this.fileName) !== extraReader.readInt(4)) { - return null; - } - - return utf8.utf8decode(extraReader.readData(upathField.length - 5)); - } - return null; - }, - - /** - * Find the unicode comment declared in the extra field, if any. - * @return {String} the unicode comment, null otherwise. - */ - findExtraFieldUnicodeComment: function () { - var ucommentField = this.extraFields[0x6375]; - if (ucommentField) { - var extraReader = readerFor(ucommentField.value); - - // wrong version - if (extraReader.readInt(1) !== 1) { - return null; - } - - // the crc of the comment changed, this field is out of date. - if (crc32fn(this.fileComment) !== extraReader.readInt(4)) { - return null; - } - - return utf8.utf8decode(extraReader.readData(ucommentField.length - 5)); - } - return null; - } - }; - module.exports = ZipEntry; - - }, { "./compressedObject": 2, "./compressions": 3, "./crc32": 4, "./reader/readerFor": 22, "./support": 30, "./utf8": 31, "./utils": 32 }], 35: [function (require, module, exports) { - 'use strict'; - - var StreamHelper = require('./stream/StreamHelper'); - var DataWorker = require('./stream/DataWorker'); - var utf8 = require('./utf8'); - var CompressedObject = require('./compressedObject'); - var GenericWorker = require('./stream/GenericWorker'); - - /** - * A simple object representing a file in the zip file. - * @constructor - * @param {string} name the name of the file - * @param {String|ArrayBuffer|Uint8Array|Buffer} data the data - * @param {Object} options the options of the file - */ - var ZipObject = function (name, data, options) { - this.name = name; - this.dir = options.dir; - this.date = options.date; - this.comment = options.comment; - this.unixPermissions = options.unixPermissions; - this.dosPermissions = options.dosPermissions; - - this._data = data; - this._dataBinary = options.binary; - // keep only the compression - this.options = { - compression: options.compression, - compressionOptions: options.compressionOptions - }; - }; - - ZipObject.prototype = { - /** - * Create an internal stream for the content of this object. - * @param {String} type the type of each chunk. - * @return StreamHelper the stream. - */ - internalStream: function (type) { - var result = null, outputType = "string"; - try { - if (!type) { - throw new Error("No output type specified."); - } - outputType = type.toLowerCase(); - var askUnicodeString = outputType === "string" || outputType === "text"; - if (outputType === "binarystring" || outputType === "text") { - outputType = "string"; - } - result = this._decompressWorker(); - - var isUnicodeString = !this._dataBinary; - - if (isUnicodeString && !askUnicodeString) { - result = result.pipe(new utf8.Utf8EncodeWorker()); - } - if (!isUnicodeString && askUnicodeString) { - result = result.pipe(new utf8.Utf8DecodeWorker()); - } - } catch (e) { - result = new GenericWorker("error"); - result.error(e); - } - - return new StreamHelper(result, outputType, ""); - }, - - /** - * Prepare the content in the asked type. - * @param {String} type the type of the result. - * @param {Function} onUpdate a function to call on each internal update. - * @return Promise the promise of the result. - */ - async: function (type, onUpdate) { - return this.internalStream(type).accumulate(onUpdate); - }, - - /** - * Prepare the content as a nodejs stream. - * @param {String} type the type of each chunk. - * @param {Function} onUpdate a function to call on each internal update. - * @return Stream the stream. - */ - nodeStream: function (type, onUpdate) { - return this.internalStream(type || "nodebuffer").toNodejsStream(onUpdate); - }, - - /** - * Return a worker for the compressed content. - * @private - * @param {Object} compression the compression object to use. - * @param {Object} compressionOptions the options to use when compressing. - * @return Worker the worker. - */ - _compressWorker: function (compression, compressionOptions) { - if ( - this._data instanceof CompressedObject && - this._data.compression.magic === compression.magic - ) { - return this._data.getCompressedWorker(); - } else { - var result = this._decompressWorker(); - if (!this._dataBinary) { - result = result.pipe(new utf8.Utf8EncodeWorker()); - } - return CompressedObject.createWorkerFrom(result, compression, compressionOptions); - } - }, - /** - * Return a worker for the decompressed content. - * @private - * @return Worker the worker. - */ - _decompressWorker: function () { - if (this._data instanceof CompressedObject) { - return this._data.getContentWorker(); - } else if (this._data instanceof GenericWorker) { - return this._data; - } else { - return new DataWorker(this._data); - } - } - }; - - var removedMethods = ["asText", "asBinary", "asNodeBuffer", "asUint8Array", "asArrayBuffer"]; - var removedFn = function () { - throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide."); - }; - - for (var i = 0; i < removedMethods.length; i++) { - ZipObject.prototype[removedMethods[i]] = removedFn; - } - module.exports = ZipObject; - - }, { "./compressedObject": 2, "./stream/DataWorker": 27, "./stream/GenericWorker": 28, "./stream/StreamHelper": 29, "./utf8": 31 }], 36: [function (require, module, exports) { - (function (global) { - 'use strict'; - var Mutation = global.MutationObserver || global.WebKitMutationObserver; - - var scheduleDrain; - - { - if (Mutation) { - var called = 0; - var observer = new Mutation(nextTick); - var element = global.document.createTextNode(''); - observer.observe(element, { - characterData: true - }); - scheduleDrain = function () { - element.data = (called = ++called % 2); - }; - } else if (!global.setImmediate && typeof global.MessageChannel !== 'undefined') { - var channel = new global.MessageChannel(); - channel.port1.onmessage = nextTick; - scheduleDrain = function () { - channel.port2.postMessage(0); - }; - } else if ('document' in global && 'onreadystatechange' in global.document.createElement('script')) { - scheduleDrain = function () { - - // Create a "; - } else { - echo ($email . " email not found.
        "); - exit(); - } -} else { - echo ($email . " is not a valid email address.
        "); - exit(); -} diff --git a/cadline/backend/maintenance/libraries/Excel2/oleread.php b/cadline/backend/maintenance/libraries/Excel2/oleread.php deleted file mode 100644 index 50660b5a..00000000 --- a/cadline/backend/maintenance/libraries/Excel2/oleread.php +++ /dev/null @@ -1,269 +0,0 @@ -= 4294967294) { - $value = -2; - } - return $value; -} - - -class OLERead -{ - var $data = ''; - - - function OLERead() - { - } - - function read($sFileName) - { - - // check if file exist and is readable (Darko Miljanovic) - if (!is_readable($sFileName)) { - $this->error = 1; - return false; - } - - $this->data = @file_get_contents($sFileName); - if (!$this->data) { - $this->error = 1; - return false; - } - //echo IDENTIFIER_OLE; - //echo 'start'; - if (substr($this->data, 0, 8) != IDENTIFIER_OLE) { - $this->error = 1; - return false; - } - $this->numBigBlockDepotBlocks = GetInt4d($this->data, NUM_BIG_BLOCK_DEPOT_BLOCKS_POS); - $this->sbdStartBlock = GetInt4d($this->data, SMALL_BLOCK_DEPOT_BLOCK_POS); - $this->rootStartBlock = GetInt4d($this->data, ROOT_START_BLOCK_POS); - $this->extensionBlock = GetInt4d($this->data, EXTENSION_BLOCK_POS); - $this->numExtensionBlocks = GetInt4d($this->data, NUM_EXTENSION_BLOCK_POS); - - /* - echo $this->numBigBlockDepotBlocks." "; - echo $this->sbdStartBlock." "; - echo $this->rootStartBlock." "; - echo $this->extensionBlock." "; - echo $this->numExtensionBlocks." "; - */ - //echo "sbdStartBlock = $this->sbdStartBlock\n"; - $bigBlockDepotBlocks = array(); - $pos = BIG_BLOCK_DEPOT_BLOCKS_POS; - // echo "pos = $pos"; - $bbdBlocks = $this->numBigBlockDepotBlocks; - - if ($this->numExtensionBlocks != 0) { - $bbdBlocks = (BIG_BLOCK_SIZE - BIG_BLOCK_DEPOT_BLOCKS_POS) / 4; - } - - for ($i = 0; $i < $bbdBlocks; $i++) { - $bigBlockDepotBlocks[$i] = GetInt4d($this->data, $pos); - $pos += 4; - } - - - for ($j = 0; $j < $this->numExtensionBlocks; $j++) { - $pos = ($this->extensionBlock + 1) * BIG_BLOCK_SIZE; - $blocksToRead = min($this->numBigBlockDepotBlocks - $bbdBlocks, BIG_BLOCK_SIZE / 4 - 1); - - for ($i = $bbdBlocks; $i < $bbdBlocks + $blocksToRead; $i++) { - $bigBlockDepotBlocks[$i] = GetInt4d($this->data, $pos); - $pos += 4; - } - - $bbdBlocks += $blocksToRead; - if ($bbdBlocks < $this->numBigBlockDepotBlocks) { - $this->extensionBlock = GetInt4d($this->data, $pos); - } - } - - // var_dump($bigBlockDepotBlocks); - - // readBigBlockDepot - $pos = 0; - $index = 0; - $this->bigBlockChain = array(); - - for ($i = 0; $i < $this->numBigBlockDepotBlocks; $i++) { - $pos = ($bigBlockDepotBlocks[$i] + 1) * BIG_BLOCK_SIZE; - //echo "pos = $pos"; - for ($j = 0; $j < BIG_BLOCK_SIZE / 4; $j++) { - $this->bigBlockChain[$index] = GetInt4d($this->data, $pos); - $pos += 4; - $index++; - } - } - - //var_dump($this->bigBlockChain); - //echo '=====2'; - // readSmallBlockDepot(); - $pos = 0; - $index = 0; - $sbdBlock = $this->sbdStartBlock; - $this->smallBlockChain = array(); - - while ($sbdBlock != -2) { - - $pos = ($sbdBlock + 1) * BIG_BLOCK_SIZE; - - for ($j = 0; $j < BIG_BLOCK_SIZE / 4; $j++) { - $this->smallBlockChain[$index] = GetInt4d($this->data, $pos); - $pos += 4; - $index++; - } - - $sbdBlock = $this->bigBlockChain[$sbdBlock]; - } - - - // readData(rootStartBlock) - $block = $this->rootStartBlock; - $pos = 0; - $this->entry = $this->__readData($block); - - /* - while ($block != -2) { - $pos = ($block + 1) * BIG_BLOCK_SIZE; - $this->entry = $this->entry.substr($this->data, $pos, BIG_BLOCK_SIZE); - $block = $this->bigBlockChain[$block]; - } - */ - //echo '==='.$this->entry."==="; - $this->__readPropertySets(); - } - - function __readData($bl) - { - $block = $bl; - $pos = 0; - $data = ''; - - while ($block != -2) { - $pos = ($block + 1) * BIG_BLOCK_SIZE; - $data = $data . substr($this->data, $pos, BIG_BLOCK_SIZE); - //echo "pos = $pos data=$data\n"; - $block = $this->bigBlockChain[$block]; - } - return $data; - } - - function __readPropertySets() - { - $offset = 0; - //var_dump($this->entry); - while ($offset < strlen($this->entry)) { - $d = substr($this->entry, $offset, PROPERTY_STORAGE_BLOCK_SIZE); - - $nameSize = ord($d[SIZE_OF_NAME_POS]) | (ord($d[SIZE_OF_NAME_POS + 1]) << 8); - - $type = ord($d[TYPE_POS]); - //$maxBlock = strlen($d) / BIG_BLOCK_SIZE - 1; - - $startBlock = GetInt4d($d, START_BLOCK_POS); - $size = GetInt4d($d, SIZE_POS); - - $name = ''; - for ($i = 0; $i < $nameSize; $i++) { - $name .= $d[$i]; - } - - $name = str_replace("\x00", "", $name); - - $this->props[] = array( - 'name' => $name, - 'type' => $type, - 'startBlock' => $startBlock, - 'size' => $size - ); - - if (($name == "Workbook") || ($name == "Book")) { - $this->wrkbook = count($this->props) - 1; - } - - if ($name == "Root Entry") { - $this->rootentry = count($this->props) - 1; - } - - //echo "name ==$name=\n"; - - - $offset += PROPERTY_STORAGE_BLOCK_SIZE; - } - } - - - function getWorkBook() - { - if ($this->props[$this->wrkbook]['size'] < SMALL_BLOCK_THRESHOLD) { - // getSmallBlockStream(PropertyStorage ps) - - $rootdata = $this->__readData($this->props[$this->rootentry]['startBlock']); - - $streamData = ''; - $block = $this->props[$this->wrkbook]['startBlock']; - //$count = 0; - $pos = 0; - while ($block != -2) { - $pos = $block * SMALL_BLOCK_SIZE; - $streamData .= substr($rootdata, $pos, SMALL_BLOCK_SIZE); - - $block = $this->smallBlockChain[$block]; - } - - return $streamData; - } else { - - $numBlocks = $this->props[$this->wrkbook]['size'] / BIG_BLOCK_SIZE; - if ($this->props[$this->wrkbook]['size'] % BIG_BLOCK_SIZE != 0) { - $numBlocks++; - } - - if ($numBlocks == 0) return ''; - - //echo "numBlocks = $numBlocks\n"; - //byte[] streamData = new byte[numBlocks * BIG_BLOCK_SIZE]; - //print_r($this->wrkbook); - $streamData = ''; - $block = $this->props[$this->wrkbook]['startBlock']; - //$count = 0; - $pos = 0; - //echo "block = $block"; - while ($block != -2) { - $pos = ($block + 1) * BIG_BLOCK_SIZE; - $streamData .= substr($this->data, $pos, BIG_BLOCK_SIZE); - $block = $this->bigBlockChain[$block]; - } - //echo 'stream'.$streamData; - return $streamData; - } - } -} diff --git a/cadline/backend/maintenance/libraries/Excel2/reader.php b/cadline/backend/maintenance/libraries/Excel2/reader.php deleted file mode 100644 index 48f5c3ec..00000000 --- a/cadline/backend/maintenance/libraries/Excel2/reader.php +++ /dev/null @@ -1,1084 +0,0 @@ - -* @license http://www.php.net/license/3_0.txt PHP License 3.0 -* @version CVS: $Id: reader.php 19 2007-03-13 12:42:41Z shangxiao $ -* @link http://pear.php.net/package/Spreadsheet_Excel_Reader -* @see OLE, Spreadsheet_Excel_Writer -*/ - - -//require_once 'PEAR.php'; -require_once 'oleread.php'; -//require_once 'OLE.php'; - -define('SPREADSHEET_EXCEL_READER_BIFF8', 0x600); -define('SPREADSHEET_EXCEL_READER_BIFF7', 0x500); -define('SPREADSHEET_EXCEL_READER_WORKBOOKGLOBALS', 0x5); -define('SPREADSHEET_EXCEL_READER_WORKSHEET', 0x10); - -define('SPREADSHEET_EXCEL_READER_TYPE_BOF', 0x809); -define('SPREADSHEET_EXCEL_READER_TYPE_EOF', 0x0a); -define('SPREADSHEET_EXCEL_READER_TYPE_BOUNDSHEET', 0x85); -define('SPREADSHEET_EXCEL_READER_TYPE_DIMENSION', 0x200); -define('SPREADSHEET_EXCEL_READER_TYPE_ROW', 0x208); -define('SPREADSHEET_EXCEL_READER_TYPE_DBCELL', 0xd7); -define('SPREADSHEET_EXCEL_READER_TYPE_FILEPASS', 0x2f); -define('SPREADSHEET_EXCEL_READER_TYPE_NOTE', 0x1c); -define('SPREADSHEET_EXCEL_READER_TYPE_TXO', 0x1b6); -define('SPREADSHEET_EXCEL_READER_TYPE_RK', 0x7e); -define('SPREADSHEET_EXCEL_READER_TYPE_RK2', 0x27e); -define('SPREADSHEET_EXCEL_READER_TYPE_MULRK', 0xbd); -define('SPREADSHEET_EXCEL_READER_TYPE_MULBLANK', 0xbe); -define('SPREADSHEET_EXCEL_READER_TYPE_INDEX', 0x20b); -define('SPREADSHEET_EXCEL_READER_TYPE_SST', 0xfc); -define('SPREADSHEET_EXCEL_READER_TYPE_EXTSST', 0xff); -define('SPREADSHEET_EXCEL_READER_TYPE_CONTINUE', 0x3c); -define('SPREADSHEET_EXCEL_READER_TYPE_LABEL', 0x204); -define('SPREADSHEET_EXCEL_READER_TYPE_LABELSST', 0xfd); -define('SPREADSHEET_EXCEL_READER_TYPE_NUMBER', 0x203); -define('SPREADSHEET_EXCEL_READER_TYPE_NAME', 0x18); -define('SPREADSHEET_EXCEL_READER_TYPE_ARRAY', 0x221); -define('SPREADSHEET_EXCEL_READER_TYPE_STRING', 0x207); -define('SPREADSHEET_EXCEL_READER_TYPE_FORMULA', 0x406); -define('SPREADSHEET_EXCEL_READER_TYPE_FORMULA2', 0x6); -define('SPREADSHEET_EXCEL_READER_TYPE_FORMAT', 0x41e); -define('SPREADSHEET_EXCEL_READER_TYPE_XF', 0xe0); -define('SPREADSHEET_EXCEL_READER_TYPE_BOOLERR', 0x205); -define('SPREADSHEET_EXCEL_READER_TYPE_UNKNOWN', 0xffff); -define('SPREADSHEET_EXCEL_READER_TYPE_NINETEENFOUR', 0x22); -define('SPREADSHEET_EXCEL_READER_TYPE_MERGEDCELLS', 0xE5); - -define('SPREADSHEET_EXCEL_READER_UTCOFFSETDAYS' , 25569); -define('SPREADSHEET_EXCEL_READER_UTCOFFSETDAYS1904', 24107); -define('SPREADSHEET_EXCEL_READER_MSINADAY', 86400); -//define('SPREADSHEET_EXCEL_READER_MSINADAY', 24 * 60 * 60); - -//define('SPREADSHEET_EXCEL_READER_DEF_NUM_FORMAT', "%.2f"); -define('SPREADSHEET_EXCEL_READER_DEF_NUM_FORMAT', "%s"); - - -/* -* Place includes, constant defines and $_GLOBAL settings here. -* Make sure they have appropriate docblocks to avoid phpDocumentor -* construing they are documented by the page-level docblock. -*/ - -/** -* A class for reading Microsoft Excel Spreadsheets. -* -* Originally developed by Vadim Tkachenko under the name PHPExcelReader. -* (http://sourceforge.net/projects/phpexcelreader) -* Based on the Java version by Andy Khan (http://www.andykhan.com). Now -* maintained by David Sanders. Reads only Biff 7 and Biff 8 formats. -* -* @category Spreadsheet -* @package Spreadsheet_Excel_Reader -* @author Vadim Tkachenko -* @copyright 1997-2005 The PHP Group -* @license http://www.php.net/license/3_0.txt PHP License 3.0 -* @version Release: @package_version@ -* @link http://pear.php.net/package/PackageName -* @see OLE, Spreadsheet_Excel_Writer -*/ -class Spreadsheet_Excel_Reader -{ - /** - * Array of worksheets found - * - * @var array - * @access public - */ - var $boundsheets = array(); - - /** - * Array of format records found - * - * @var array - * @access public - */ - var $formatRecords = array(); - - /** - * todo - * - * @var array - * @access public - */ - var $sst = array(); - - /** - * Array of worksheets - * - * The data is stored in 'cells' and the meta-data is stored in an array - * called 'cellsInfo' - * - * Example: - * - * $sheets --> 'cells' --> row --> column --> Interpreted value - * --> 'cellsInfo' --> row --> column --> 'type' - Can be 'date', 'number', or 'unknown' - * --> 'raw' - The raw data that Excel stores for that data cell - * - * @var array - * @access public - */ - var $sheets = array(); - - /** - * The data returned by OLE - * - * @var string - * @access public - */ - var $data; - - /** - * OLE object for reading the file - * - * @var OLE object - * @access private - */ - var $_ole; - - /** - * Default encoding - * - * @var string - * @access private - */ - var $_defaultEncoding; - - /** - * Default number format - * - * @var integer - * @access private - */ - var $_defaultFormat = SPREADSHEET_EXCEL_READER_DEF_NUM_FORMAT; - - /** - * todo - * List of formats to use for each column - * - * @var array - * @access private - */ - var $_columnsFormat = array(); - - /** - * todo - * - * @var integer - * @access private - */ - var $_rowoffset = 1; - - /** - * todo - * - * @var integer - * @access private - */ - var $_coloffset = 1; - - /** - * List of default date formats used by Excel - * - * @var array - * @access public - */ - var $dateFormats = array ( - 0xe => "d/m/Y", - 0xf => "d-M-Y", - 0x10 => "d-M", - 0x11 => "M-Y", - 0x12 => "h:i a", - 0x13 => "h:i:s a", - 0x14 => "H:i", - 0x15 => "H:i:s", - 0x16 => "d/m/Y H:i", - 0x2d => "i:s", - 0x2e => "H:i:s", - 0x2f => "i:s.S"); - - /** - * Default number formats used by Excel - * - * @var array - * @access public - */ - var $numberFormats = array( - 0x1 => "%1.0f", // "0" - 0x2 => "%1.2f", // "0.00", - 0x3 => "%1.0f", //"#,##0", - 0x4 => "%1.2f", //"#,##0.00", - 0x5 => "%1.0f", /*"$#,##0;($#,##0)",*/ - 0x6 => '$%1.0f', /*"$#,##0;($#,##0)",*/ - 0x7 => '$%1.2f', //"$#,##0.00;($#,##0.00)", - 0x8 => '$%1.2f', //"$#,##0.00;($#,##0.00)", - 0x9 => '%1.0f%%', // "0%" - 0xa => '%1.2f%%', // "0.00%" - 0xb => '%1.2f', // 0.00E00", - 0x25 => '%1.0f', // "#,##0;(#,##0)", - 0x26 => '%1.0f', //"#,##0;(#,##0)", - 0x27 => '%1.2f', //"#,##0.00;(#,##0.00)", - 0x28 => '%1.2f', //"#,##0.00;(#,##0.00)", - 0x29 => '%1.0f', //"#,##0;(#,##0)", - 0x2a => '$%1.0f', //"$#,##0;($#,##0)", - 0x2b => '%1.2f', //"#,##0.00;(#,##0.00)", - 0x2c => '$%1.2f', //"$#,##0.00;($#,##0.00)", - 0x30 => '%1.0f'); //"##0.0E0"; - - // }}} - // {{{ Spreadsheet_Excel_Reader() - - /** - * Constructor - * - * Some basic initialisation - */ - function Spreadsheet_Excel_Reader() - { - $this->_ole =& new OLERead(); - $this->setUTFEncoder('iconv'); - } - - // }}} - // {{{ setOutputEncoding() - - /** - * Set the encoding method - * - * @param string Encoding to use - * @access public - */ - function setOutputEncoding($encoding) - { - $this->_defaultEncoding = $encoding; - } - - // }}} - // {{{ setUTFEncoder() - - /** - * $encoder = 'iconv' or 'mb' - * set iconv if you would like use 'iconv' for encode UTF-16LE to your encoding - * set mb if you would like use 'mb_convert_encoding' for encode UTF-16LE to your encoding - * - * @access public - * @param string Encoding type to use. Either 'iconv' or 'mb' - */ - function setUTFEncoder($encoder = 'iconv') - { - $this->_encoderFunction = ''; - - if ($encoder == 'iconv') { - $this->_encoderFunction = function_exists('iconv') ? 'iconv' : ''; - } elseif ($encoder == 'mb') { - $this->_encoderFunction = function_exists('mb_convert_encoding') ? - 'mb_convert_encoding' : - ''; - } - } - - // }}} - // {{{ setRowColOffset() - - /** - * todo - * - * @access public - * @param offset - */ - function setRowColOffset($iOffset) - { - $this->_rowoffset = $iOffset; - $this->_coloffset = $iOffset; - } - - // }}} - // {{{ setDefaultFormat() - - /** - * Set the default number format - * - * @access public - * @param Default format - */ - function setDefaultFormat($sFormat) - { - $this->_defaultFormat = $sFormat; - } - - // }}} - // {{{ setColumnFormat() - - /** - * Force a column to use a certain format - * - * @access public - * @param integer Column number - * @param string Format - */ - function setColumnFormat($column, $sFormat) - { - $this->_columnsFormat[$column] = $sFormat; - } - - - // }}} - // {{{ read() - - /** - * Read the spreadsheet file using OLE, then parse - * - * @access public - * @param filename - * @todo return a valid value - */ - function read($sFileName) - { - /* - require_once 'OLE.php'; - $ole = new OLE(); - $ole->read($sFileName); - - foreach ($ole->_list as $i => $pps) { - if (($pps->Name == 'Workbook' || $pps->Name == 'Book') && - $pps->Size >= SMALL_BLOCK_THRESHOLD) { - - $this->data = $ole->getData($i, 0, $ole->getDataLength($i)); - } elseif ($pps->Name == 'Root Entry') { - $this->data = $ole->getData($i, 0, $ole->getDataLength($i)); - } - //var_dump(strlen($ole->getData($i, 0, $ole->getDataLength($i))), $pps->Name, md5($this->data), $ole->getDataLength($i)); - } -//exit; - $this->_parse(); - - return sizeof($this->sheets) > 0; - */ - - $res = $this->_ole->read($sFileName); - - // oops, something goes wrong (Darko Miljanovic) - if($res === false) { - // check error code - if($this->_ole->error == 1) { - // bad file - die('The filename ' . $sFileName . ' is not readable'); - } - // check other error codes here (eg bad fileformat, etc...) - } - - $this->data = $this->_ole->getWorkBook(); - - - /* - $res = $this->_ole->read($sFileName); - - if ($this->isError($res)) { -// var_dump($res); - return $this->raiseError($res); - } - - $total = $this->_ole->ppsTotal(); - for ($i = 0; $i < $total; $i++) { - if ($this->_ole->isFile($i)) { - $type = unpack("v", $this->_ole->getData($i, 0, 2)); - if ($type[''] == 0x0809) { // check if it's a BIFF stream - $this->_index = $i; - $this->data = $this->_ole->getData($i, 0, $this->_ole->getDataLength($i)); - break; - } - } - } - - if ($this->_index === null) { - return $this->raiseError("$file doesn't seem to be an Excel file"); - } - - */ - - //echo "data =".$this->data; - //$this->readRecords(); - $this->_parse(); - } - - - // }}} - // {{{ _parse() - - /** - * Parse a workbook - * - * @access private - * @return bool - */ - function _parse() - { - $pos = 0; - - $code = ord($this->data[$pos]) | ord($this->data[$pos+1])<<8; - $length = ord($this->data[$pos+2]) | ord($this->data[$pos+3])<<8; - - $version = ord($this->data[$pos + 4]) | ord($this->data[$pos + 5])<<8; - $substreamType = ord($this->data[$pos + 6]) | ord($this->data[$pos + 7])<<8; - //echo "Start parse code=".base_convert($code,10,16)." version=".base_convert($version,10,16)." substreamType=".base_convert($substreamType,10,16).""."\n"; - - if (($version != SPREADSHEET_EXCEL_READER_BIFF8) && - ($version != SPREADSHEET_EXCEL_READER_BIFF7)) { - return false; - } - - if ($substreamType != SPREADSHEET_EXCEL_READER_WORKBOOKGLOBALS){ - return false; - } - - //print_r($rec); - $pos += $length + 4; - - $code = ord($this->data[$pos]) | ord($this->data[$pos+1])<<8; - $length = ord($this->data[$pos+2]) | ord($this->data[$pos+3])<<8; - - while ($code != SPREADSHEET_EXCEL_READER_TYPE_EOF) { - switch ($code) { - case SPREADSHEET_EXCEL_READER_TYPE_SST: - //echo "Type_SST\n"; - $spos = $pos + 4; - $limitpos = $spos + $length; - $uniqueStrings = $this->_GetInt4d($this->data, $spos+4); - $spos += 8; - for ($i = 0; $i < $uniqueStrings; $i++) { - // Read in the number of characters - if ($spos == $limitpos) { - $opcode = ord($this->data[$spos]) | ord($this->data[$spos+1])<<8; - $conlength = ord($this->data[$spos+2]) | ord($this->data[$spos+3])<<8; - if ($opcode != 0x3c) { - return -1; - } - $spos += 4; - $limitpos = $spos + $conlength; - } - $numChars = ord($this->data[$spos]) | (ord($this->data[$spos+1]) << 8); - //echo "i = $i pos = $pos numChars = $numChars "; - $spos += 2; - $optionFlags = ord($this->data[$spos]); - $spos++; - $asciiEncoding = (($optionFlags & 0x01) == 0) ; - $extendedString = ( ($optionFlags & 0x04) != 0); - - // See if string contains formatting information - $richString = ( ($optionFlags & 0x08) != 0); - - if ($richString) { - // Read in the crun - $formattingRuns = ord($this->data[$spos]) | (ord($this->data[$spos+1]) << 8); - $spos += 2; - } - - if ($extendedString) { - // Read in cchExtRst - $extendedRunLength = $this->_GetInt4d($this->data, $spos); - $spos += 4; - } - - $len = ($asciiEncoding)? $numChars : $numChars*2; - if ($spos + $len < $limitpos) { - $retstr = substr($this->data, $spos, $len); - $spos += $len; - }else{ - // found countinue - $retstr = substr($this->data, $spos, $limitpos - $spos); - $bytesRead = $limitpos - $spos; - $charsLeft = $numChars - (($asciiEncoding) ? $bytesRead : ($bytesRead / 2)); - $spos = $limitpos; - - while ($charsLeft > 0){ - $opcode = ord($this->data[$spos]) | ord($this->data[$spos+1])<<8; - $conlength = ord($this->data[$spos+2]) | ord($this->data[$spos+3])<<8; - if ($opcode != 0x3c) { - return -1; - } - $spos += 4; - $limitpos = $spos + $conlength; - $option = ord($this->data[$spos]); - $spos += 1; - if ($asciiEncoding && ($option == 0)) { - $len = min($charsLeft, $limitpos - $spos); // min($charsLeft, $conlength); - $retstr .= substr($this->data, $spos, $len); - $charsLeft -= $len; - $asciiEncoding = true; - }elseif (!$asciiEncoding && ($option != 0)){ - $len = min($charsLeft * 2, $limitpos - $spos); // min($charsLeft, $conlength); - $retstr .= substr($this->data, $spos, $len); - $charsLeft -= $len/2; - $asciiEncoding = false; - }elseif (!$asciiEncoding && ($option == 0)) { - // Bummer - the string starts off as Unicode, but after the - // continuation it is in straightforward ASCII encoding - $len = min($charsLeft, $limitpos - $spos); // min($charsLeft, $conlength); - for ($j = 0; $j < $len; $j++) { - $retstr .= $this->data[$spos + $j].chr(0); - } - $charsLeft -= $len; - $asciiEncoding = false; - }else{ - $newstr = ''; - for ($j = 0; $j < strlen($retstr); $j++) { - $newstr = $retstr[$j].chr(0); - } - $retstr = $newstr; - $len = min($charsLeft * 2, $limitpos - $spos); // min($charsLeft, $conlength); - $retstr .= substr($this->data, $spos, $len); - $charsLeft -= $len/2; - $asciiEncoding = false; - //echo "Izavrat\n"; - } - $spos += $len; - - } - } - $retstr = ($asciiEncoding) ? $retstr : $this->_encodeUTF16($retstr); -// echo "Str $i = $retstr\n"; - if ($richString){ - $spos += 4 * $formattingRuns; - } - - // For extended strings, skip over the extended string data - if ($extendedString) { - $spos += $extendedRunLength; - } - //if ($retstr == 'Derby'){ - // echo "bb\n"; - //} - $this->sst[]=$retstr; - } - /*$continueRecords = array(); - while ($this->getNextCode() == Type_CONTINUE) { - $continueRecords[] = &$this->nextRecord(); - } - //echo " 1 Type_SST\n"; - $this->shareStrings = new SSTRecord($r, $continueRecords); - //print_r($this->shareStrings->strings); - */ - // echo 'SST read: '.($time_end-$time_start)."\n"; - break; - - case SPREADSHEET_EXCEL_READER_TYPE_FILEPASS: - return false; - break; - case SPREADSHEET_EXCEL_READER_TYPE_NAME: - //echo "Type_NAME\n"; - break; - case SPREADSHEET_EXCEL_READER_TYPE_FORMAT: - $indexCode = ord($this->data[$pos+4]) | ord($this->data[$pos+5]) << 8; - - if ($version == SPREADSHEET_EXCEL_READER_BIFF8) { - $numchars = ord($this->data[$pos+6]) | ord($this->data[$pos+7]) << 8; - if (ord($this->data[$pos+8]) == 0){ - $formatString = substr($this->data, $pos+9, $numchars); - } else { - $formatString = substr($this->data, $pos+9, $numchars*2); - } - } else { - $numchars = ord($this->data[$pos+6]); - $formatString = substr($this->data, $pos+7, $numchars*2); - } - - $this->formatRecords[$indexCode] = $formatString; - // echo "Type.FORMAT\n"; - break; - case SPREADSHEET_EXCEL_READER_TYPE_XF: - //global $dateFormats, $numberFormats; - $indexCode = ord($this->data[$pos+6]) | ord($this->data[$pos+7]) << 8; - //echo "\nType.XF ".count($this->formatRecords['xfrecords'])." $indexCode "; - if (array_key_exists($indexCode, $this->dateFormats)) { - //echo "isdate ".$dateFormats[$indexCode]; - $this->formatRecords['xfrecords'][] = array( - 'type' => 'date', - 'format' => $this->dateFormats[$indexCode] - ); - }elseif (array_key_exists($indexCode, $this->numberFormats)) { - //echo "isnumber ".$this->numberFormats[$indexCode]; - $this->formatRecords['xfrecords'][] = array( - 'type' => 'number', - 'format' => $this->numberFormats[$indexCode] - ); - }else{ - $isdate = FALSE; - if ($indexCode > 0){ - if (isset($this->formatRecords[$indexCode])) - $formatstr = $this->formatRecords[$indexCode]; - //echo '.other.'; - //echo "\ndate-time=$formatstr=\n"; - if ($formatstr) - if (preg_match("/[^hmsday\/\-:\s]/i", $formatstr) == 0) { // found day and time format - $isdate = TRUE; - $formatstr = str_replace('mm', 'i', $formatstr); - $formatstr = str_replace('h', 'H', $formatstr); - //echo "\ndate-time $formatstr \n"; - } - } - - if ($isdate){ - $this->formatRecords['xfrecords'][] = array( - 'type' => 'date', - 'format' => $formatstr, - ); - }else{ - $this->formatRecords['xfrecords'][] = array( - 'type' => 'other', - 'format' => '', - 'code' => $indexCode - ); - } - } - //echo "\n"; - break; - case SPREADSHEET_EXCEL_READER_TYPE_NINETEENFOUR: - //echo "Type.NINETEENFOUR\n"; - $this->nineteenFour = (ord($this->data[$pos+4]) == 1); - break; - case SPREADSHEET_EXCEL_READER_TYPE_BOUNDSHEET: - //echo "Type.BOUNDSHEET\n"; - $rec_offset = $this->_GetInt4d($this->data, $pos+4); - $rec_typeFlag = ord($this->data[$pos+8]); - $rec_visibilityFlag = ord($this->data[$pos+9]); - $rec_length = ord($this->data[$pos+10]); - - if ($version == SPREADSHEET_EXCEL_READER_BIFF8){ - $chartype = ord($this->data[$pos+11]); - if ($chartype == 0){ - $rec_name = substr($this->data, $pos+12, $rec_length); - } else { - $rec_name = $this->_encodeUTF16(substr($this->data, $pos+12, $rec_length*2)); - } - }elseif ($version == SPREADSHEET_EXCEL_READER_BIFF7){ - $rec_name = substr($this->data, $pos+11, $rec_length); - } - $this->boundsheets[] = array('name'=>$rec_name, - 'offset'=>$rec_offset); - - break; - - } - - //echo "Code = ".base_convert($r['code'],10,16)."\n"; - $pos += $length + 4; - $code = ord($this->data[$pos]) | ord($this->data[$pos+1])<<8; - $length = ord($this->data[$pos+2]) | ord($this->data[$pos+3])<<8; - - //$r = &$this->nextRecord(); - //echo "1 Code = ".base_convert($r['code'],10,16)."\n"; - } - - foreach ($this->boundsheets as $key=>$val){ - $this->sn = $key; - $this->_parsesheet($val['offset']); - } - return true; - - } - - /** - * Parse a worksheet - * - * @access private - * @param todo - * @todo fix return codes - */ - function _parsesheet($spos) - { - $cont = true; - // read BOF - $code = ord($this->data[$spos]) | ord($this->data[$spos+1])<<8; - $length = ord($this->data[$spos+2]) | ord($this->data[$spos+3])<<8; - - $version = ord($this->data[$spos + 4]) | ord($this->data[$spos + 5])<<8; - $substreamType = ord($this->data[$spos + 6]) | ord($this->data[$spos + 7])<<8; - - if (($version != SPREADSHEET_EXCEL_READER_BIFF8) && ($version != SPREADSHEET_EXCEL_READER_BIFF7)) { - return -1; - } - - if ($substreamType != SPREADSHEET_EXCEL_READER_WORKSHEET){ - return -2; - } - //echo "Start parse code=".base_convert($code,10,16)." version=".base_convert($version,10,16)." substreamType=".base_convert($substreamType,10,16).""."\n"; - $spos += $length + 4; - //var_dump($this->formatRecords); - //echo "code $code $length"; - while($cont) { - //echo "mem= ".memory_get_usage()."\n"; -// $r = &$this->file->nextRecord(); - $lowcode = ord($this->data[$spos]); - if ($lowcode == SPREADSHEET_EXCEL_READER_TYPE_EOF) break; - $code = $lowcode | ord($this->data[$spos+1])<<8; - $length = ord($this->data[$spos+2]) | ord($this->data[$spos+3])<<8; - $spos += 4; - $this->sheets[$this->sn]['maxrow'] = $this->_rowoffset - 1; - $this->sheets[$this->sn]['maxcol'] = $this->_coloffset - 1; - //echo "Code=".base_convert($code,10,16)." $code\n"; - unset($this->rectype); - $this->multiplier = 1; // need for format with % - switch ($code) { - case SPREADSHEET_EXCEL_READER_TYPE_DIMENSION: - //echo 'Type_DIMENSION '; - if (!isset($this->numRows)) { - if (($length == 10) || ($version == SPREADSHEET_EXCEL_READER_BIFF7)){ - $this->sheets[$this->sn]['numRows'] = ord($this->data[$spos+2]) | ord($this->data[$spos+3]) << 8; - $this->sheets[$this->sn]['numCols'] = ord($this->data[$spos+6]) | ord($this->data[$spos+7]) << 8; - } else { - $this->sheets[$this->sn]['numRows'] = ord($this->data[$spos+4]) | ord($this->data[$spos+5]) << 8; - $this->sheets[$this->sn]['numCols'] = ord($this->data[$spos+10]) | ord($this->data[$spos+11]) << 8; - } - } - //echo 'numRows '.$this->numRows.' '.$this->numCols."\n"; - break; - case SPREADSHEET_EXCEL_READER_TYPE_MERGEDCELLS: - $cellRanges = ord($this->data[$spos]) | ord($this->data[$spos+1])<<8; - for ($i = 0; $i < $cellRanges; $i++) { - $fr = ord($this->data[$spos + 8*$i + 2]) | ord($this->data[$spos + 8*$i + 3])<<8; - $lr = ord($this->data[$spos + 8*$i + 4]) | ord($this->data[$spos + 8*$i + 5])<<8; - $fc = ord($this->data[$spos + 8*$i + 6]) | ord($this->data[$spos + 8*$i + 7])<<8; - $lc = ord($this->data[$spos + 8*$i + 8]) | ord($this->data[$spos + 8*$i + 9])<<8; - //$this->sheets[$this->sn]['mergedCells'][] = array($fr + 1, $fc + 1, $lr + 1, $lc + 1); - if ($lr - $fr > 0) { - $this->sheets[$this->sn]['cellsInfo'][$fr+1][$fc+1]['rowspan'] = $lr - $fr + 1; - } - if ($lc - $fc > 0) { - $this->sheets[$this->sn]['cellsInfo'][$fr+1][$fc+1]['colspan'] = $lc - $fc + 1; - } - } - //echo "Merged Cells $cellRanges $lr $fr $lc $fc\n"; - break; - case SPREADSHEET_EXCEL_READER_TYPE_RK: - case SPREADSHEET_EXCEL_READER_TYPE_RK2: - //echo 'SPREADSHEET_EXCEL_READER_TYPE_RK'."\n"; - $row = ord($this->data[$spos]) | ord($this->data[$spos+1])<<8; - $column = ord($this->data[$spos+2]) | ord($this->data[$spos+3])<<8; - $rknum = $this->_GetInt4d($this->data, $spos + 6); - $numValue = $this->_GetIEEE754($rknum); - //echo $numValue." "; - if ($this->isDate($spos)) { - list($string, $raw) = $this->createDate($numValue); - }else{ - $raw = $numValue; - if (isset($this->_columnsFormat[$column + 1])){ - $this->curformat = $this->_columnsFormat[$column + 1]; - } - $string = sprintf($this->curformat, $numValue * $this->multiplier); - //$this->addcell(RKRecord($r)); - } - $this->addcell($row, $column, $string, $raw); - //echo "Type_RK $row $column $string $raw {$this->curformat}\n"; - break; - case SPREADSHEET_EXCEL_READER_TYPE_LABELSST: - $row = ord($this->data[$spos]) | ord($this->data[$spos+1])<<8; - $column = ord($this->data[$spos+2]) | ord($this->data[$spos+3])<<8; - $xfindex = ord($this->data[$spos+4]) | ord($this->data[$spos+5])<<8; - $index = $this->_GetInt4d($this->data, $spos + 6); - //var_dump($this->sst); - $this->addcell($row, $column, $this->sst[$index]); - //echo "LabelSST $row $column $string\n"; - break; - case SPREADSHEET_EXCEL_READER_TYPE_MULRK: - $row = ord($this->data[$spos]) | ord($this->data[$spos+1])<<8; - $colFirst = ord($this->data[$spos+2]) | ord($this->data[$spos+3])<<8; - $colLast = ord($this->data[$spos + $length - 2]) | ord($this->data[$spos + $length - 1])<<8; - $columns = $colLast - $colFirst + 1; - $tmppos = $spos+4; - for ($i = 0; $i < $columns; $i++) { - $numValue = $this->_GetIEEE754($this->_GetInt4d($this->data, $tmppos + 2)); - if ($this->isDate($tmppos-4)) { - list($string, $raw) = $this->createDate($numValue); - }else{ - $raw = $numValue; - if (isset($this->_columnsFormat[$colFirst + $i + 1])){ - $this->curformat = $this->_columnsFormat[$colFirst + $i + 1]; - } - $string = sprintf($this->curformat, $numValue * $this->multiplier); - } - //$rec['rknumbers'][$i]['xfindex'] = ord($rec['data'][$pos]) | ord($rec['data'][$pos+1]) << 8; - $tmppos += 6; - $this->addcell($row, $colFirst + $i, $string, $raw); - //echo "MULRK $row ".($colFirst + $i)." $string\n"; - } - //MulRKRecord($r); - // Get the individual cell records from the multiple record - //$num = ; - - break; - case SPREADSHEET_EXCEL_READER_TYPE_NUMBER: - $row = ord($this->data[$spos]) | ord($this->data[$spos+1])<<8; - $column = ord($this->data[$spos+2]) | ord($this->data[$spos+3])<<8; - $tmp = unpack("ddouble", substr($this->data, $spos + 6, 8)); // It machine machine dependent - if ($this->isDate($spos)) { - list($string, $raw) = $this->createDate($tmp['double']); - // $this->addcell(DateRecord($r, 1)); - }else{ - //$raw = $tmp['']; - if (isset($this->_columnsFormat[$column + 1])){ - $this->curformat = $this->_columnsFormat[$column + 1]; - } - $raw = $this->createNumber($spos); - $string = sprintf($this->curformat, $raw * $this->multiplier); - - // $this->addcell(NumberRecord($r)); - } - $this->addcell($row, $column, $string, $raw); - //echo "Number $row $column $string\n"; - break; - case SPREADSHEET_EXCEL_READER_TYPE_FORMULA: - case SPREADSHEET_EXCEL_READER_TYPE_FORMULA2: - $row = ord($this->data[$spos]) | ord($this->data[$spos+1])<<8; - $column = ord($this->data[$spos+2]) | ord($this->data[$spos+3])<<8; - if ((ord($this->data[$spos+6])==0) && (ord($this->data[$spos+12])==255) && (ord($this->data[$spos+13])==255)) { - //String formula. Result follows in a STRING record - //echo "FORMULA $row $column Formula with a string
        \n"; - } elseif ((ord($this->data[$spos+6])==1) && (ord($this->data[$spos+12])==255) && (ord($this->data[$spos+13])==255)) { - //Boolean formula. Result is in +2; 0=false,1=true - } elseif ((ord($this->data[$spos+6])==2) && (ord($this->data[$spos+12])==255) && (ord($this->data[$spos+13])==255)) { - //Error formula. Error code is in +2; - } elseif ((ord($this->data[$spos+6])==3) && (ord($this->data[$spos+12])==255) && (ord($this->data[$spos+13])==255)) { - //Formula result is a null string. - } else { - // result is a number, so first 14 bytes are just like a _NUMBER record - $tmp = unpack("ddouble", substr($this->data, $spos + 6, 8)); // It machine machine dependent - if ($this->isDate($spos)) { - list($string, $raw) = $this->createDate($tmp['double']); - // $this->addcell(DateRecord($r, 1)); - }else{ - //$raw = $tmp['']; - if (isset($this->_columnsFormat[$column + 1])){ - $this->curformat = $this->_columnsFormat[$column + 1]; - } - $raw = $this->createNumber($spos); - $string = sprintf($this->curformat, $raw * $this->multiplier); - - // $this->addcell(NumberRecord($r)); - } - $this->addcell($row, $column, $string, $raw); - //echo "Number $row $column $string\n"; - } - break; - case SPREADSHEET_EXCEL_READER_TYPE_BOOLERR: - $row = ord($this->data[$spos]) | ord($this->data[$spos+1])<<8; - $column = ord($this->data[$spos+2]) | ord($this->data[$spos+3])<<8; - $string = ord($this->data[$spos+6]); - $this->addcell($row, $column, $string); - //echo 'Type_BOOLERR '."\n"; - break; - case SPREADSHEET_EXCEL_READER_TYPE_ROW: - case SPREADSHEET_EXCEL_READER_TYPE_DBCELL: - case SPREADSHEET_EXCEL_READER_TYPE_MULBLANK: - break; - case SPREADSHEET_EXCEL_READER_TYPE_LABEL: - $row = ord($this->data[$spos]) | ord($this->data[$spos+1])<<8; - $column = ord($this->data[$spos+2]) | ord($this->data[$spos+3])<<8; - $this->addcell($row, $column, substr($this->data, $spos + 8, ord($this->data[$spos + 6]) | ord($this->data[$spos + 7])<<8)); - - // $this->addcell(LabelRecord($r)); - break; - - case SPREADSHEET_EXCEL_READER_TYPE_EOF: - $cont = false; - break; - default: - //echo ' unknown :'.base_convert($r['code'],10,16)."\n"; - break; - - } - $spos += $length; - } - - if (!isset($this->sheets[$this->sn]['numRows'])) - $this->sheets[$this->sn]['numRows'] = $this->sheets[$this->sn]['maxrow']; - if (!isset($this->sheets[$this->sn]['numCols'])) - $this->sheets[$this->sn]['numCols'] = $this->sheets[$this->sn]['maxcol']; - - } - - /** - * Check whether the current record read is a date - * - * @param todo - * @return boolean True if date, false otherwise - */ - function isDate($spos) - { - //$xfindex = GetInt2d(, 4); - $xfindex = ord($this->data[$spos+4]) | ord($this->data[$spos+5]) << 8; - //echo 'check is date '.$xfindex.' '.$this->formatRecords['xfrecords'][$xfindex]['type']."\n"; - //var_dump($this->formatRecords['xfrecords'][$xfindex]); - if ($this->formatRecords['xfrecords'][$xfindex]['type'] == 'date') { - $this->curformat = $this->formatRecords['xfrecords'][$xfindex]['format']; - $this->rectype = 'date'; - return true; - } else { - if ($this->formatRecords['xfrecords'][$xfindex]['type'] == 'number') { - $this->curformat = $this->formatRecords['xfrecords'][$xfindex]['format']; - $this->rectype = 'number'; - if (($xfindex == 0x9) || ($xfindex == 0xa)){ - $this->multiplier = 100; - } - }else{ - $this->curformat = $this->_defaultFormat; - $this->rectype = 'unknown'; - } - return false; - } - } - - //}}} - //{{{ createDate() - - /** - * Convert the raw Excel date into a human readable format - * - * Dates in Excel are stored as number of seconds from an epoch. On - * Windows, the epoch is 30/12/1899 and on Mac it's 01/01/1904 - * - * @access private - * @param integer The raw Excel value to convert - * @return array First element is the converted date, the second element is number a unix timestamp - */ - function createDate($numValue) - { - if ($numValue > 1) { - $utcDays = $numValue - ($this->nineteenFour ? SPREADSHEET_EXCEL_READER_UTCOFFSETDAYS1904 : SPREADSHEET_EXCEL_READER_UTCOFFSETDAYS); - $utcValue = round(($utcDays+1) * SPREADSHEET_EXCEL_READER_MSINADAY); - $string = date ($this->curformat, $utcValue); - $raw = $utcValue; - } else { - $raw = $numValue; - $hours = floor($numValue * 24); - $mins = floor($numValue * 24 * 60) - $hours * 60; - $secs = floor($numValue * SPREADSHEET_EXCEL_READER_MSINADAY) - $hours * 60 * 60 - $mins * 60; - $string = date ($this->curformat, mktime($hours, $mins, $secs)); - } - - return array($string, $raw); - } - - function createNumber($spos) - { - $rknumhigh = $this->_GetInt4d($this->data, $spos + 10); - $rknumlow = $this->_GetInt4d($this->data, $spos + 6); - //for ($i=0; $i<8; $i++) { echo ord($this->data[$i+$spos+6]) . " "; } echo "
        "; - $sign = ($rknumhigh & 0x80000000) >> 31; - $exp = ($rknumhigh & 0x7ff00000) >> 20; - $mantissa = (0x100000 | ($rknumhigh & 0x000fffff)); - $mantissalow1 = ($rknumlow & 0x80000000) >> 31; - $mantissalow2 = ($rknumlow & 0x7fffffff); - $value = $mantissa / pow( 2 , (20- ($exp - 1023))); - if ($mantissalow1 != 0) $value += 1 / pow (2 , (21 - ($exp - 1023))); - $value += $mantissalow2 / pow (2 , (52 - ($exp - 1023))); - //echo "Sign = $sign, Exp = $exp, mantissahighx = $mantissa, mantissalow1 = $mantissalow1, mantissalow2 = $mantissalow2
        \n"; - if ($sign) {$value = -1 * $value;} - return $value; - } - - function addcell($row, $col, $string, $raw = '') - { - //echo "ADD cel $row-$col $string\n"; - $this->sheets[$this->sn]['maxrow'] = max($this->sheets[$this->sn]['maxrow'], $row + $this->_rowoffset); - $this->sheets[$this->sn]['maxcol'] = max($this->sheets[$this->sn]['maxcol'], $col + $this->_coloffset); - $this->sheets[$this->sn]['cells'][$row + $this->_rowoffset][$col + $this->_coloffset] = $string; - if ($raw) - $this->sheets[$this->sn]['cellsInfo'][$row + $this->_rowoffset][$col + $this->_coloffset]['raw'] = $raw; - if (isset($this->rectype)) - $this->sheets[$this->sn]['cellsInfo'][$row + $this->_rowoffset][$col + $this->_coloffset]['type'] = $this->rectype; - - } - - - function _GetIEEE754($rknum) - { - if (($rknum & 0x02) != 0) { - $value = $rknum >> 2; - } else { -//mmp -// first comment out the previously existing 7 lines of code here -// $tmp = unpack("d", pack("VV", 0, ($rknum & 0xfffffffc))); -// //$value = $tmp['']; -// if (array_key_exists(1, $tmp)) { -// $value = $tmp[1]; -// } else { -// $value = $tmp['']; -// } -// I got my info on IEEE754 encoding from -// http://research.microsoft.com/~hollasch/cgindex/coding/ieeefloat.html -// The RK format calls for using only the most significant 30 bits of the -// 64 bit floating point value. The other 34 bits are assumed to be 0 -// So, we use the upper 30 bits of $rknum as follows... - $sign = ($rknum & 0x80000000) >> 31; - $exp = ($rknum & 0x7ff00000) >> 20; - $mantissa = (0x100000 | ($rknum & 0x000ffffc)); - $value = $mantissa / pow( 2 , (20- ($exp - 1023))); - if ($sign) {$value = -1 * $value;} -//end of changes by mmp - - } - - if (($rknum & 0x01) != 0) { - $value /= 100; - } - return $value; - } - - function _encodeUTF16($string) - { - $result = $string; - if ($this->_defaultEncoding){ - switch ($this->_encoderFunction){ - case 'iconv' : $result = iconv('UTF-16LE', $this->_defaultEncoding, $string); - break; - case 'mb_convert_encoding' : $result = mb_convert_encoding($string, $this->_defaultEncoding, 'UTF-16LE' ); - break; - } - } - return $result; - } - - function _GetInt4d($data, $pos) - { - $value = ord($data[$pos]) | (ord($data[$pos+1]) << 8) | (ord($data[$pos+2]) << 16) | (ord($data[$pos+3]) << 24); - if ($value>=4294967294) - { - $value=-2; - } - return $value; - } - -} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * c-hanging-comment-ender-p: nil - * End: - */ - -?> \ No newline at end of file diff --git a/cadline/backend/maintenance/libraries/mmail/RFC822.php b/cadline/backend/maintenance/libraries/mmail/RFC822.php deleted file mode 100644 index bac0568a..00000000 --- a/cadline/backend/maintenance/libraries/mmail/RFC822.php +++ /dev/null @@ -1,880 +0,0 @@ - (A comment), ted@example.com (Ted Bloggs), Barney;'; - * $structure = Mail_RFC822::parseAddressList($address_string, 'example.com', TRUE) - * print_r($structure); - */ - -class Mail_RFC822 -{ - /** - * The address being parsed by the RFC822 object. - * @private string $address - */ - private $address = ''; - - /** - * The default domain to use for unqualified addresses. - * @private string $default_domain - */ - private $default_domain = 'localhost'; - - /** - * Should we return a nested array showing groups, or flatten everything? - * @private boolean $nestGroups - */ - private $nestGroups = true; - - /** - * Whether or not to validate atoms for non-ascii characters. - * @private boolean $validate - */ - private $validate = true; - - /** - * The array of raw addresses built up as we parse. - * @private array $addresses - */ - private $addresses = array(); - - /** - * The final array of parsed address information that we build up. - * @private array $structure - */ - private $structure = array(); - - /** - * The current error message, if any. - * @private string $error - */ - private $error = null; - - /** - * An internal counter/pointer. - * @private integer $index - */ - private $index = null; - - /** - * The number of groups that have been found in the address list. - * @private integer $num_groups - * @access public - */ - private $num_groups = 0; - - /** - * A variable so that we can tell whether or not we're inside a - * Mail_RFC822 object. - * @private boolean $mailRFC822 - */ - private $mailRFC822 = true; - - /** - * A limit after which processing stops - * @private int $limit - */ - private $limit = null; - - - /** - * Sets up the object. The address must either be set here or when - * calling parseAddressList(). One or the other. - * - * @access public - * @param string $address The address(es) to validate. - * @param string $default_domain Default domain/host etc. If not supplied, will be set to localhost. - * @param boolean $nest_groups Whether to return the structure with groups nested for easier viewing. - * @param boolean $validate Whether to validate atoms. Turn this off if you need to run addresses through before encoding the personal names, for instance. - * - * @return object Mail_RFC822 A new Mail_RFC822 object. - */ - function __construct($address = null, $default_domain = null, $nest_groups = null, $validate = null, $limit = null) - { - if (isset($address)) $this->address = $address; - if (isset($default_domain)) $this->default_domain = $default_domain; - if (isset($nest_groups)) $this->nestGroups = $nest_groups; - if (isset($validate)) $this->validate = $validate; - if (isset($limit)) $this->limit = $limit; - } - - - /** - * Starts the whole process. The address must either be set here - * or when creating the object. One or the other. - * - * @access public - * @param string $address The address(es) to validate. - * @param string $default_domain Default domain/host etc. - * @param boolean $nest_groups Whether to return the structure with groups nested for easier viewing. - * @param boolean $validate Whether to validate atoms. Turn this off if you need to run addresses through before encoding the personal names, for instance. - * - * @return array A structured array of addresses. - */ - function parseAddressList($address = null, $default_domain = null, $nest_groups = null, $validate = null, $limit = null) - { - - if (!isset($this->mailRFC822)) { - $obj = new Mail_RFC822($address, $default_domain, $nest_groups, $validate, $limit); - return $obj->parseAddressList(); - } - - if (isset($address)) $this->address = $address; - if (isset($default_domain)) $this->default_domain = $default_domain; - if (isset($nest_groups)) $this->nestGroups = $nest_groups; - if (isset($validate)) $this->validate = $validate; - if (isset($limit)) $this->limit = $limit; - - $this->structure = array(); - $this->addresses = array(); - $this->error = null; - $this->index = null; - - while ($this->address = $this->_splitAddresses($this->address)) { - continue; - } - - if ($this->address === false || isset($this->error)) { - return false; - } - - // Reset timer since large amounts of addresses can take a long time to - // get here - set_time_limit(30); - - // Loop through all the addresses - for ($i = 0; $i < count($this->addresses); $i++) { - - if (($return = $this->_validateAddress($this->addresses[$i])) === false - || isset($this->error) - ) { - return false; - } - - if (!$this->nestGroups) { - $this->structure = array_merge($this->structure, $return); - } else { - $this->structure[] = $return; - } - } - - return $this->structure; - } - - /** - * Splits an address into seperate addresses. - * - * @access private - * @param string $address The addresses to split. - * @return boolean Success or failure. - */ - function _splitAddresses($address) - { - - if (!empty($this->limit) and count($this->addresses) == $this->limit) { - return ''; - } - - if ($this->_isGroup($address) && !isset($this->error)) { - $split_char = ';'; - $is_group = true; - } elseif (!isset($this->error)) { - $split_char = ','; - $is_group = false; - } elseif (isset($this->error)) { - return false; - } - - // Split the string based on the above ten or so lines. - $parts = explode($split_char, $address); - $string = $this->_splitCheck($parts, $split_char); - - // If a group... - if ($is_group) { - // If $string does not contain a colon outside of - // brackets/quotes etc then something's fubar. - - // First check there's a colon at all: - if (strpos($string, ':') === false) { - $this->error = 'Invalid address: ' . $string; - return false; - } - - // Now check it's outside of brackets/quotes: - if (!$this->_splitCheck(explode(':', $string), ':')) - return false; - - // We must have a group at this point, so increase the counter: - $this->num_groups++; - } - - // $string now contains the first full address/group. - // Add to the addresses array. - $this->addresses[] = array( - 'address' => trim($string), - 'group' => $is_group - ); - - // Remove the now stored address from the initial line, the +1 - // is to account for the explode character. - $address = trim(substr($address, strlen($string) + 1)); - - // If the next char is a comma and this was a group, then - // there are more addresses, otherwise, if there are any more - // chars, then there is another address. - if ($is_group && substr($address, 0, 1) == ',') { - $address = trim(substr($address, 1)); - return $address; - } elseif (strlen($address) > 0) { - return $address; - } else { - return ''; - } - - // If you got here then something's off - return false; - } - - /** - * Checks for a group at the start of the string. - * - * @access private - * @param string $address The address to check. - * @return boolean Whether or not there is a group at the start of the string. - */ - function _isGroup($address) - { - // First comma not in quotes, angles or escaped: - $parts = explode(',', $address); - $string = $this->_splitCheck($parts, ','); - - // Now we have the first address, we can reliably check for a - // group by searching for a colon that's not escaped or in - // quotes or angle brackets. - if (count($parts = explode(':', $string)) > 1) { - $string2 = $this->_splitCheck($parts, ':'); - return ($string2 !== $string); - } else { - return false; - } - } - - /** - * A common function that will check an exploded string. - * - * @access private - * @param array $parts The exloded string. - * @param string $char The char that was exploded on. - * @return mixed False if the string contains unclosed quotes/brackets, or the string on success. - */ - function _splitCheck($parts, $char) - { - $string = $parts[0]; - - for ($i = 0; $i < count($parts); $i++) { - if ( - $this->_hasUnclosedQuotes($string) - || $this->_hasUnclosedBrackets($string, '<>') - || $this->_hasUnclosedBrackets($string, '[]') - || $this->_hasUnclosedBrackets($string, '()') - || substr($string, -1) == '\\' - ) { - if (isset($parts[$i + 1])) { - $string = $string . $char . $parts[$i + 1]; - } else { - $this->error = 'Invalid address spec. Unclosed bracket or quotes'; - return false; - } - } else { - $this->index = $i; - break; - } - } - - return $string; - } - - /** - * Checks if a string has an unclosed quotes or not. - * - * @access private - * @param string $string The string to check. - * @return boolean True if there are unclosed quotes inside the string, false otherwise. - */ - function _hasUnclosedQuotes($string) - { - $string = explode('"', $string); - $string_cnt = count($string); - - for ($i = 0; $i < (count($string) - 1); $i++) - if (substr($string[$i], -1) == '\\') - $string_cnt--; - - return ($string_cnt % 2 === 0); - } - - /** - * Checks if a string has an unclosed brackets or not. IMPORTANT: - * This function handles both angle brackets and square brackets; - * - * @access private - * @param string $string The string to check. - * @param string $chars The characters to check for. - * @return boolean True if there are unclosed brackets inside the string, false otherwise. - */ - function _hasUnclosedBrackets($string, $chars) - { - $num_angle_start = substr_count($string, $chars[0]); - $num_angle_end = substr_count($string, $chars[1]); - - $this->_hasUnclosedBracketsSub($string, $num_angle_start, $chars[0]); - $this->_hasUnclosedBracketsSub($string, $num_angle_end, $chars[1]); - - if ($num_angle_start < $num_angle_end) { - $this->error = 'Invalid address spec. Unmatched quote or bracket (' . $chars . ')'; - return false; - } else { - return ($num_angle_start > $num_angle_end); - } - } - - /** - * Sub function that is used only by hasUnclosedBrackets(). - * - * @access private - * @param string $string The string to check. - * @param integer &$num The number of occurences. - * @param string $char The character to count. - * @return integer The number of occurences of $char in $string, adjusted for backslashes. - */ - function _hasUnclosedBracketsSub($string, &$num, $char) - { - $parts = explode($char, $string); - for ($i = 0; $i < count($parts); $i++) { - if (substr($parts[$i], -1) == '\\' || $this->_hasUnclosedQuotes($parts[$i])) - $num--; - if (isset($parts[$i + 1])) - $parts[$i + 1] = $parts[$i] . $char . $parts[$i + 1]; - } - - return $num; - } - - /** - * Function to begin checking the address. - * - * @access private - * @param string $address The address to validate. - * @return mixed False on failure, or a structured array of address information on success. - */ - function _validateAddress($address) - { - $is_group = false; - - if ($address['group']) { - $is_group = true; - - // Get the group part of the name - $parts = explode(':', $address['address']); - $groupname = $this->_splitCheck($parts, ':'); - $structure = array(); - - // And validate the group part of the name. - if (!$this->_validatePhrase($groupname)) { - $this->error = 'Group name did not validate.'; - return false; - } else { - // Don't include groups if we are not nesting - // them. This avoids returning invalid addresses. - if ($this->nestGroups) { - $structure = new stdClass; - $structure->groupname = $groupname; - } - } - - $address['address'] = ltrim(substr($address['address'], strlen($groupname . ':'))); - } - - // If a group then split on comma and put into an array. - // Otherwise, Just put the whole address in an array. - if ($is_group) { - while (strlen($address['address']) > 0) { - $parts = explode(',', $address['address']); - $addresses[] = $this->_splitCheck($parts, ','); - $address['address'] = trim(substr($address['address'], strlen(end($addresses) . ','))); - } - } else { - $addresses[] = $address['address']; - } - - // Check that $addresses is set, if address like this: - // Groupname:; - // Then errors were appearing. - if (!isset($addresses)) { - $this->error = 'Empty group.'; - return false; - } - - for ($i = 0; $i < count($addresses); $i++) { - $addresses[$i] = trim($addresses[$i]); - } - - // Validate each mailbox. - // Format could be one of: name - // geezer@domain.com - // geezer - // ... or any other format valid by RFC 822. - array_walk($addresses, array($this, 'validateMailbox')); - - // Nested format - if ($this->nestGroups) { - if ($is_group) { - $structure->addresses = $addresses; - } else { - $structure = $addresses[0]; - } - - // Flat format - } else { - if ($is_group) { - $structure = array_merge($structure, $addresses); - } else { - $structure = $addresses; - } - } - - return $structure; - } - - /** - * Function to validate a phrase. - * - * @access private - * @param string $phrase The phrase to check. - * @return boolean Success or failure. - */ - function _validatePhrase($phrase) - { - // Splits on one or more Tab or space. - $parts = preg_split('/[ \\x09]+/', $phrase, -1, PREG_SPLIT_NO_EMPTY); - - $phrase_parts = array(); - while (count($parts) > 0) { - $phrase_parts[] = $this->_splitCheck($parts, ' '); - for ($i = 0; $i < $this->index + 1; $i++) - array_shift($parts); - } - - for ($i = 0; $i < count($phrase_parts); $i++) { - // If quoted string: - if (substr($phrase_parts[$i], 0, 1) == '"') { - if (!$this->_validateQuotedString($phrase_parts[$i])) - return false; - continue; - } - - // Otherwise it's an atom: - if (!$this->_validateAtom($phrase_parts[$i])) return false; - } - - return true; - } - - /** - * Function to validate an atom which from rfc822 is: - * atom = 1* - * - * If validation ($this->validate) has been turned off, then - * validateAtom() doesn't actually check anything. This is so that you - * can split a list of addresses up before encoding personal names - * (umlauts, etc.), for example. - * - * @access private - * @param string $atom The string to check. - * @return boolean Success or failure. - */ - function _validateAtom($atom) - { - if (!$this->validate) { - // Validation has been turned off; assume the atom is okay. - return true; - } - - // Check for any char from ASCII 0 - ASCII 127 - if (!preg_match('/^[\\x00-\\x7E]+$/i', $atom, $matches)) { - return false; - } - - // Check for specials: - if (preg_match('/[][()<>@,;\\:". ]/', $atom)) { - return false; - } - - // Check for control characters (ASCII 0-31): - if (preg_match('/[\\x00-\\x1F]+/', $atom)) { - return false; - } - - return true; - } - - /** - * Function to validate quoted string, which is: - * quoted-string = <"> *(qtext/quoted-pair) <"> - * - * @access private - * @param string $qstring The string to check - * @return boolean Success or failure. - */ - function _validateQuotedString($qstring) - { - // Leading and trailing " - $qstring = substr($qstring, 1, -1); - - // Perform check. - return !(preg_match('/(.)[\x0D\\\\"]/', $qstring, $matches) && $matches[1] != '\\'); - } - - /** - * Function to validate a mailbox, which is: - * mailbox = addr-spec ; simple address - * / phrase route-addr ; name and route-addr - * - * @access public - * @param string &$mailbox The string to check. - * @return boolean Success or failure. - */ - function validateMailbox(&$mailbox) - { - // A couple of defaults. - $phrase = ''; - $comment = ''; - $comments = array(); - - // Catch any RFC822 comments and store them separately - $_mailbox = $mailbox; - while (strlen(trim($_mailbox)) > 0) { - $parts = explode('(', $_mailbox); - $before_comment = $this->_splitCheck($parts, '('); - if ($before_comment != $_mailbox) { - // First char should be a ( - $comment = substr(str_replace($before_comment, '', $_mailbox), 1); - $parts = explode(')', $comment); - $comment = $this->_splitCheck($parts, ')'); - $comments[] = $comment; - - // +1 is for the trailing ) - $_mailbox = substr($_mailbox, strpos($_mailbox, $comment) + strlen($comment) + 1); - } else { - break; - } - } - - for ($i = 0; $i < count(@$comments); $i++) { - $mailbox = str_replace('(' . $comments[$i] . ')', '', $mailbox); - } - $mailbox = trim($mailbox); - - // Check for name + route-addr - if (substr($mailbox, -1) == '>' && substr($mailbox, 0, 1) != '<') { - $parts = explode('<', $mailbox); - $name = $this->_splitCheck($parts, '<'); - - $phrase = trim($name); - $route_addr = trim(substr($mailbox, strlen($name . '<'), -1)); - - if ($this->_validatePhrase($phrase) === false || ($route_addr = $this->_validateRouteAddr($route_addr)) === false) - return false; - - // Only got addr-spec - } else { - // First snip angle brackets if present. - if (substr($mailbox, 0, 1) == '<' && substr($mailbox, -1) == '>') - $addr_spec = substr($mailbox, 1, -1); - else - $addr_spec = $mailbox; - - if (($addr_spec = $this->_validateAddrSpec($addr_spec)) === false) - return false; - } - - // Construct the object that will be returned. - $mbox = new stdClass(); - - // Add the phrase (even if empty) and comments - $mbox->personal = $phrase; - $mbox->comment = isset($comments) ? $comments : array(); - - if (isset($route_addr)) { - $mbox->mailbox = $route_addr['local_part']; - $mbox->host = $route_addr['domain']; - $route_addr['adl'] !== '' ? $mbox->adl = $route_addr['adl'] : ''; - } else { - $mbox->mailbox = $addr_spec['local_part']; - $mbox->host = $addr_spec['domain']; - } - - $mailbox = $mbox; - return true; - } - - /** - * This function validates a route-addr which is: - * route-addr = "<" [route] addr-spec ">" - * - * Angle brackets have already been removed at the point of - * getting to this function. - * - * @access private - * @param string $route_addr The string to check. - * @return mixed False on failure, or an array containing validated address/route information on success. - */ - function _validateRouteAddr($route_addr) - { - // Check for colon. - if (strpos($route_addr, ':') !== false) { - $parts = explode(':', $route_addr); - $route = $this->_splitCheck($parts, ':'); - } else { - $route = $route_addr; - } - - // If $route is same as $route_addr then the colon was in - // quotes or brackets or, of course, non existent. - if ($route === $route_addr) { - unset($route); - $addr_spec = $route_addr; - if (($addr_spec = $this->_validateAddrSpec($addr_spec)) === false) { - return false; - } - } else { - // Validate route part. - if (($route = $this->_validateRoute($route)) === false) { - return false; - } - - $addr_spec = substr($route_addr, strlen($route . ':')); - - // Validate addr-spec part. - if (($addr_spec = $this->_validateAddrSpec($addr_spec)) === false) { - return false; - } - } - - if (isset($route)) { - $return['adl'] = $route; - } else { - $return['adl'] = ''; - } - - $return = array_merge($return, $addr_spec); - return $return; - } - - /** - * Function to validate a route, which is: - * route = 1#("@" domain) ":" - * - * @access private - * @param string $route The string to check. - * @return mixed False on failure, or the validated $route on success. - */ - function _validateRoute($route) - { - // Split on comma. - $domains = explode(',', trim($route)); - - for ($i = 0; $i < count($domains); $i++) { - $domains[$i] = str_replace('@', '', trim($domains[$i])); - if (!$this->_validateDomain($domains[$i])) return false; - } - - return $route; - } - - /** - * Function to validate a domain, though this is not quite what - * you expect of a strict internet domain. - * - * domain = sub-domain *("." sub-domain) - * - * @access private - * @param string $domain The string to check. - * @return mixed False on failure, or the validated domain on success. - */ - function _validateDomain($domain) - { - // Note the different use of $subdomains and $sub_domains - $subdomains = explode('.', $domain); - - while (count($subdomains) > 0) { - $sub_domains[] = $this->_splitCheck($subdomains, '.'); - for ($i = 0; $i < $this->index + 1; $i++) - array_shift($subdomains); - } - - for ($i = 0; $i < count($sub_domains); $i++) { - if (!$this->_validateSubdomain(trim($sub_domains[$i]))) - return false; - } - - // Managed to get here, so return input. - return $domain; - } - - /** - * Function to validate a subdomain: - * subdomain = domain-ref / domain-literal - * - * @access private - * @param string $subdomain The string to check. - * @return boolean Success or failure. - */ - function _validateSubdomain($subdomain) - { - if (preg_match('|^\[(.*)]$|', $subdomain, $arr)) { - if (!$this->_validateDliteral($arr[1])) return false; - } else { - if (!$this->_validateAtom($subdomain)) return false; - } - - // Got here, so return successful. - return true; - } - - /** - * Function to validate a domain literal: - * domain-literal = "[" *(dtext / quoted-pair) "]" - * - * @access private - * @param string $dliteral The string to check. - * @return boolean Success or failure. - */ - function _validateDliteral($dliteral) - { - return !preg_match('/(.)[][\x0D\\\\]/', $dliteral, $matches) && $matches[1] != '\\'; - } - - /** - * Function to validate an addr-spec. - * - * addr-spec = local-part "@" domain - * - * @access private - * @param string $addr_spec The string to check. - * @return mixed False on failure, or the validated addr-spec on success. - */ - function _validateAddrSpec($addr_spec) - { - $addr_spec = trim($addr_spec); - - // Split on @ sign if there is one. - if (strpos($addr_spec, '@') !== false) { - $parts = explode('@', $addr_spec); - $local_part = $this->_splitCheck($parts, '@'); - $domain = substr($addr_spec, strlen($local_part . '@')); - - // No @ sign so assume the default domain. - } else { - $local_part = $addr_spec; - $domain = $this->default_domain; - } - - if (($local_part = $this->_validateLocalPart($local_part)) === false) return false; - if (($domain = $this->_validateDomain($domain)) === false) return false; - - // Got here so return successful. - return array('local_part' => $local_part, 'domain' => $domain); - } - - /** - * Function to validate the local part of an address: - * local-part = word *("." word) - * - * @access private - * @param string $local_part - * @return mixed False on failure, or the validated local part on success. - */ - function _validateLocalPart($local_part) - { - $parts = explode('.', $local_part); - - // Split the local_part into words. - while (count($parts) > 0) { - $words[] = $this->_splitCheck($parts, '.'); - for ($i = 0; $i < $this->index + 1; $i++) { - array_shift($parts); - } - } - - // Validate each word. - for ($i = 0; $i < count($words); $i++) { - if ($this->_validatePhrase(trim($words[$i])) === false) return false; - } - - // Managed to get here, so return the input. - return $local_part; - } - - /** - * Returns an approximate count of how many addresses are - * in the given string. This is APPROXIMATE as it only splits - * based on a comma which has no preceding backslash. Could be - * useful as large amounts of addresses will end up producing - * *large* structures when used with parseAddressList(). - * - * @param string $data Addresses to count - * @return int Approximate count - */ - function approximateCount($data) - { - return count(preg_split('/(?@. This can be - * sufficient for most people. Optional stricter mode can - * be utilised which restricts mailbox characters allowed - * to alphanumeric, full stop, hyphen and underscore. - * - * @param string $data Address to check - * @param boolean $strict Optional stricter mode - * @return mixed False if it fails, an indexed array - * username/domain if it matches - */ - function isValidInetAddress($data, $strict = false) - { - $regex = $strict ? '/^([.0-9a-z_-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,4})$/i' : '/^([*+!.&#$|\'\\%\/0-9a-z^_`{}=?~:-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,4})$/i'; - if (preg_match($regex, trim($data), $matches)) { - return array($matches[1], $matches[2]); - } else { - return false; - } - } -} diff --git a/cadline/backend/maintenance/libraries/mmail/htmlMimeMail.php b/cadline/backend/maintenance/libraries/mmail/htmlMimeMail.php deleted file mode 100644 index 5726e450..00000000 --- a/cadline/backend/maintenance/libraries/mmail/htmlMimeMail.php +++ /dev/null @@ -1,1109 +0,0 @@ -attachments = array(); - $this->html_images = array(); - $this->headers = array(); - $this->is_built = false; - $this->text = ''; - $this->sendmail_path = '/usr/lib/sendmail -ti'; - - /** - * If you want the auto load functionality - * to find other image/file types, add the - * extension and content type here. - */ - $this->image_types = array( - 'gif' => 'image/gif', - 'jpg' => 'image/jpeg', - 'jpeg' => 'image/jpeg', - 'jpe' => 'image/jpeg', - 'bmp' => 'image/bmp', - 'png' => 'image/png', - 'tif' => 'image/tiff', - 'tiff' => 'image/tiff', - 'swf' => 'application/x-shockwave-flash' - ); - - /** - * Set these up - */ - $this->build_params['html_encoding'] = new QPrintEncoding(); - $this->build_params['text_encoding'] = new SevenBitEncoding(); - $this->build_params['html_charset'] = 'UTF-8'; - $this->build_params['text_charset'] = 'UTF-8'; - $this->build_params['head_charset'] = 'UTF-8'; - $this->build_params['text_wrap'] = 998; - - /** - * Defaults for smtp sending - */ - if (!empty($_SERVER['HTTP_HOST'])) { - $helo = $_SERVER['HTTP_HOST']; - } elseif (!empty($_SERVER['SERVER_NAME'])) { - $helo = $_SERVER['SERVER_NAME']; - } else { - $helo = 'localhost'; - } - - $this->smtp_params['host'] = 'localhost'; - $this->smtp_params['port'] = 25; - $this->smtp_params['helo'] = $helo; - $this->smtp_params['auth'] = false; - $this->smtp_params['user'] = ''; - $this->smtp_params['pass'] = ''; - - /** - * Make sure the MIME version header is first. - */ - $this->headers['MIME-Version'] = '1.0'; - $this->headers['X-Mailer'] = 'htmlMimeMail5 '; - } - - /** - * Accessor to set the CRLF style - * - * @param string $crlf CRLF style to use. - * Use \r\n for SMTP, and \n - * for normal. - */ - public function setCRLF($crlf = "\n") - { - if (!defined('CRLF')) { - define('CRLF', $crlf, true); - } - - if (!defined('MAIL_MIMEPART_CRLF')) { - define('MAIL_MIMEPART_CRLF', $crlf, true); - } - } - - /** - * Accessor to set the SMTP parameters - * - * @param string $host Hostname - * @param string $port Port - * @param string $helo HELO string to use - * @param bool $auth User authentication or not - * @param string $user Username - * @param string $pass Password - */ - public function setSMTPParams($host = null, $port = null, $helo = null, $auth = null, $user = null, $pass = null) - { - if (!is_null($host)) $this->smtp_params['host'] = $host; - if (!is_null($port)) $this->smtp_params['port'] = $port; - if (!is_null($helo)) $this->smtp_params['helo'] = $helo; - if (!is_null($auth)) $this->smtp_params['auth'] = $auth; - if (!is_null($user)) $this->smtp_params['user'] = $user; - if (!is_null($pass)) $this->smtp_params['pass'] = $pass; - } - - /** - * Sets sendmail path and options (optionally) (when directly piping to sendmail) - * - * @param string $path Path and options for sendmail command - */ - public function setSendmailPath($path) - { - $this->sendmail_path = $path; - } - - /** - * Accessor function to set the text encoding - * - * @param object $encoding Text encoding to use - */ - public function setTextEncoding(iEncoding $encoding) - { - $this->build_params['text_encoding'] = $encoding; - } - - /** - * Accessor function to set the HTML encoding - * - * @param object $encoding HTML encoding to use - */ - public function setHTMLEncoding(iEncoding $encoding) - { - $this->build_params['html_encoding'] = $encoding; - } - - /** - * Accessor function to set the text charset - * - * @param string $charset Character set to use - */ - public function setTextCharset($charset = 'UTF-8') - { - $this->build_params['text_charset'] = $charset; - } - - /** - * Accessor function to set the HTML charset - * - * @param string $charset Character set to use - */ - public function setHTMLCharset($charset = 'UTF-8') - { - $this->build_params['html_charset'] = $charset; - } - - /** - * Accessor function to set the header encoding charset - * - * @param string $charset Character set to use - */ - public function setHeadCharset($charset = 'UTF-8') - { - $this->build_params['head_charset'] = $charset; - } - - /** - * Accessor function to set the text wrap count - * - * @param integer $count Point at which to wrap text - */ - public function setTextWrap($count = 998) - { - $this->build_params['text_wrap'] = $count; - } - - /** - * Accessor to set a header - * - * @param string $name Name of header - * @param string $value Value of header - */ - public function setHeader($name, $value) - { - $this->headers[$name] = $value; - } - - /** - * Accessor to add a Subject: header - * - * @param string $subject Subject to set - */ - public function setSubject($subject) - { - $this->headers['Subject'] = $subject; - } - - /** - * Accessor to add a From: header - * - * @param string $from From address - */ - public function setFrom($from) - { - $this->headers['From'] = $from; - } - - /** - * Accessor to set priority. Priority given should be either - * high, normal or low. Can also be specified numerically, - * being 1, 3 or 5 (respectively). - * - * @param mixed $priority The priority to use. - */ - public function setPriority($priority = 'normal') - { - switch (strtolower($priority)) { - case 'high': - case '1': - $this->headers['X-Priority'] = '1'; - $this->headers['X-MSMail-Priority'] = 'High'; - break; - - case 'normal': - case '3': - $this->headers['X-Priority'] = '3'; - $this->headers['X-MSMail-Priority'] = 'Normal'; - break; - - case 'low': - case '5': - $this->headers['X-Priority'] = '5'; - $this->headers['X-MSMail-Priority'] = 'Low'; - break; - } - } - - /** - * Accessor to set the return path - * - * @param string $return_path Return path to use - */ - public function setReturnPath($return_path) - { - $this->return_path = $return_path; - } - - /** - * Accessor to add a Cc: header - * - * @param string $cc Carbon Copy address - */ - public function setCc($cc) - { - $this->headers['Cc'] = $cc; - } - - /** - * Accessor to add a Bcc: header - * - * @param string $bcc Blind Carbon Copy address - */ - public function setBcc($bcc) - { - $this->headers['Bcc'] = $bcc; - } - - /** - * Adds plain text. Use this function - * when NOT sending html email - * - * @param string $text Plain text of email - */ - public function setText($text) - { - $this->text = $text; - } - - /** - * Adds HTML to the emails, with an associated text part. - * If third part is given, images in the email will be loaded - * from this directory. - * - * @param string $html HTML part of email - * @param string $images_dir Images directory - */ - public function setHTML($html, $images_dir = null) - { - $this->html = $html; - - if (!empty($images_dir)) { - $this->findHtmlImages($images_dir); - } - } - - /** - * Function for extracting images from - * html source. This function will look - * through the html code supplied by setHTML() - * and find any file that ends in one of the - * extensions defined in $obj->image_types. - * If the file exists it will read it in and - * embed it, (not an attachment). - * - * @param string $images_dir Images directory to look in - */ - private function findHtmlImages($images_dir) - { - // Build the list of image extensions - $extensions = array_keys($this->image_types); - - preg_match_all('/(?:"|\')([^"\']+\.(' . implode('|', $extensions) . '))(?:"|\')/Ui', $this->html, $matches); - - foreach ($matches[1] as $m) { - if (file_exists($images_dir . $m)) { - $html_images[] = $m; - $this->html = str_replace($m, basename($m), $this->html); - } - } - - /** - * Go thru found images - */ - if (!empty($html_images)) { - - // If duplicate images are embedded, they may show up as attachments, so remove them. - $html_images = array_unique($html_images); - sort($html_images); - - foreach ($html_images as $img) { - if ($image = file_get_contents($images_dir . $img)) { - $ext = preg_replace('#^.*\.(\w{3,4})$#e', 'strtolower("$1")', $img); - $content_type = $this->image_types[$ext]; - $this->addEmbeddedImage(new stringEmbeddedImage($image, basename($img), $content_type)); - } - } - } - } - - /** - * Adds an image to the list of embedded - * images. - * - * @param string $object Embedded image object - */ - public function addEmbeddedImage($embeddedImage) - { - $embeddedImage->cid = md5(uniqid(time())); - - $this->html_images[] = $embeddedImage; - } - - - /** - * Adds a file to the list of attachments. - * - * @param string $attachment Attachment object - */ - public function addAttachment($attachment) - { - $this->attachments[] = $attachment; - } - - /** - * Adds a text subpart to a mime_part object - * - * @param object $obj - * @return object Mime part object - */ - private function addTextPart(&$message) - { - $params['content_type'] = 'text/plain'; - $params['encoding'] = $this->build_params['text_encoding']->getType(); - $params['charset'] = $this->build_params['text_charset']; - - if (!empty($message)) { - $message->addSubpart($this->text, $params); - } else { - $message = new Mail_mimePart($this->text, $params); - } - } - - /** - * Adds a html subpart to a mime_part object - * - * @param object $obj - * @return object Mime part object - */ - private function addHtmlPart(&$message) - { - $params['content_type'] = 'text/html'; - $params['encoding'] = $this->build_params['html_encoding']->getType(); - $params['charset'] = $this->build_params['html_charset']; - if (!empty($message)) { - $message->addSubpart($this->html, $params); - } else { - $message = new Mail_mimePart($this->html, $params); - } - } - - /** - * Starts a message with a mixed part - * - * @return object Mime part object - */ - private function addMixedPart(&$message) - { - $params['content_type'] = 'multipart/mixed'; - - $message = new Mail_mimePart('', $params); - } - - /** - * Adds an alternative part to a mime_part object - * - * @param object $obj - * @return object Mime part object - */ - private function addAlternativePart(&$message) - { - $params['content_type'] = 'multipart/alternative'; - - if (!empty($message)) { - return $message->addSubpart('', $params); - } else { - $message = new Mail_mimePart('', $params); - } - } - - /** - * Adds a html subpart to a mime_part object - * - * @param object $obj - * @return object Mime part object - */ - private function addRelatedPart(&$message) - { - $params['content_type'] = 'multipart/related'; - - if (!empty($message)) { - return $message->addSubpart('', $params); - } else { - $message = new Mail_mimePart('', $params); - } - } - - /** - * Adds all html images to a mime_part object - * - * @param object $obj Message object - */ - private function addHtmlImageParts(&$message) - { - foreach ($this->html_images as $value) { - $params['content_type'] = $value->contentType; - $params['encoding'] = $value->encoding->getType(); - $params['disposition'] = 'inline'; - $params['dfilename'] = $value->name; - $params['cid'] = $value->cid; - - $message->addSubpart($value->data, $params); - } - } - - /** - * Adds all attachments to a mime_part object - * - * @param object $obj Message object - */ - private function addAttachmentParts(&$message) - { - foreach ($this->attachments as $value) { - $params['content_type'] = $value->contentType; - $params['encoding'] = $value->encoding->getType(); - $params['disposition'] = 'attachment'; - $params['dfilename'] = $value->name; - - $message->addSubpart($value->data, $params); - } - } - - /** - * Builds the multipart message. - */ - private function build() - { - if (!empty($this->html_images)) { - foreach ($this->html_images as $value) { - $quoted = preg_quote($value->name); - $cid = preg_quote($value->cid); - - $this->html = preg_replace("#src=\"$quoted\"|src='$quoted'#", "src=\"cid:$cid\"", $this->html); - $this->html = preg_replace("#background=\"$quoted\"|background='$quoted'#", "background=\"cid:$cid\"", $this->html); - } - } - - $message = null; - $attachments = !empty($this->attachments); - $html_images = !empty($this->html_images); - $html = !empty($this->html); - $text = !$html; - switch (true) { - case $text: - $message = null; - if ($attachments) { - $this->addMixedPart($message); - } - - $this->addTextPart($message); - - // Attachments - $this->addAttachmentParts($message); - break; - - case $html and !$attachments and !$html_images: - $this->addAlternativePart($message); - $this->addTextPart($message); - $this->addHtmlPart($message); - break; - - case $html and !$attachments and $html_images: - $this->addRelatedPart($message); - $alt = $this->addAlternativePart($message); - - $this->addTextPart($alt); - $this->addHtmlPart($alt); - - // HTML images - $this->addHtmlImageParts($message); - break; - - case $html and $attachments and !$html_images: - $this->addMixedPart($message); - $alt = $this->addAlternativePart($message); - - $this->addTextPart($alt); - $this->addHtmlPart($alt); - - // Attachments - $this->addAttachmentParts($message); - break; - - case $html and $attachments and $html_images: - $this->addMixedPart($message); - $rel = $this->addRelatedPart($message); - $alt = $this->addAlternativePart($rel); - - $this->addTextPart($alt); - $this->addHtmlPart($alt); - - // HTML images - $this->addHtmlImageParts($rel); - - // Attachments - $this->addAttachmentParts($message); - break; - } - - if (isset($message)) { - $output = $message->encode(); - $this->output = $output['body']; - $this->headers = array_merge($this->headers, $output['headers']); - - // Figure out hostname - if (!empty($_SERVER['HTTP_HOST'])) { - $hostname = $_SERVER['HTTP_HOST']; - } else if (!empty($_SERVER['SERVER_NAME'])) { - $hostname = $_SERVER['SERVER_NAME']; - } else if (!empty($_ENV['HOSTNAME'])) { - $hostname = $_ENV['HOSTNAME']; - } else { - $hostname = 'localhost'; - } - - $message_id = sprintf('<%s.%s@%s>', base_convert(time(), 10, 36), base_convert(rand(), 10, 36), $hostname); - $this->headers['Message-ID'] = $message_id; - - $this->is_built = true; - return true; - } else { - return false; - } - } - - /** - * Function to encode a header if necessary - * according to RFC2047 - * - * @param string $input Value to encode - * @param string $charset Character set to use - * @return string Encoded value - */ - private function encodeHeader($input, $charset = 'ISO-8859-1') - { - preg_match_all('/(\w*[\x80-\xFF]+\w*)/', $input, $matches); - foreach ($matches[1] as $value) { - $replacement = preg_replace('/([\x80-\xFF])/e', '"=" . strtoupper(dechex(ord("\1")))', $value); - $input = str_replace($value, '=?' . $charset . '?Q?' . $replacement . '?=', $input); - } - - return $input; - } - - /** - * Sends the mail. - * - * @param array $recipients Array of receipients to send the mail to - * @param string $type How to send the mail ('mail' or 'sendmail' or 'smtp') - * @return mixed - */ - public function send($recipients, $type = 'mail') - { - if (!is_array($recipients)) { - $t = $recipients; - $recipients = array(); - $recipients[] = $t; - } - - if (!defined('CRLF')) { - $this->setCRLF(($type == 'mail' or $type == 'sendmail') ? "\n" : "\r\n"); - } - - if (!$this->is_built) { - $this->build(); - } - - switch ($type) { - case 'mail': - $subject = ''; - if (!empty($this->headers['Subject'])) { - $subject = $this->encodeHeader($this->headers['Subject'], $this->build_params['head_charset']); - unset($this->headers['Subject']); - } - - // Get flat representation of headers - foreach ($this->headers as $name => $value) { - $headers[] = $name . ': ' . $this->encodeHeader($value, $this->build_params['head_charset']); - } - - $to = $this->encodeHeader(implode(', ', $recipients), $this->build_params['head_charset']); - - if (!empty($this->return_path)) { - $result = mail($to, $subject, $this->output, implode(CRLF, $headers), '-f' . $this->return_path); - } else { - $result = mail($to, $subject, $this->output, implode(CRLF, $headers)); - } - - // Reset the subject in case mail is resent - if ($subject !== '') { - $this->headers['Subject'] = $subject; - } - - - // Return - return $result; - break; - - case 'sendmail': - // Get flat representation of headers - foreach ($this->headers as $name => $value) { - $headers[] = $name . ': ' . $this->encodeHeader($value, $this->build_params['head_charset']); - } - - // Encode To: - $headers[] = 'To: ' . $this->encodeHeader(implode(', ', $recipients), $this->build_params['head_charset']); - - // Get return path arg for sendmail command if necessary - $returnPath = ''; - if (!empty($this->return_path)) { - $returnPath = '-f' . $this->return_path; - } - - $pipe = popen($this->sendmail_path . " " . $returnPath, 'w'); - $bytes = fputs($pipe, implode(CRLF, $headers) . CRLF . CRLF . $this->output); - $r = pclose($pipe); - - return $r; - break; - - case 'smtp': - require_once(dirname(__FILE__) . '/smtp.php'); - require_once(dirname(__FILE__) . '/RFC822.php'); - $smtp = &smtp::connect($this->smtp_params); - // Parse recipients argument for internet addresses - foreach ($recipients as $recipient) { - $addresses = Mail_RFC822::parseAddressList($recipient, $this->smtp_params['helo'], null, false); - foreach ($addresses as $address) { - $smtp_recipients[] = sprintf('%s@%s', $address->mailbox, $address->host); - } - } - unset($addresses); // These are reused - unset($address); // These are reused - - // Get flat representation of headers, parsing - // Cc and Bcc as we go - foreach ($this->headers as $name => $value) { - if ($name == 'Cc' or $name == 'Bcc') { - $addresses = Mail_RFC822::parseAddressList($value, $this->smtp_params['helo'], null, false); - foreach ($addresses as $address) { - $smtp_recipients[] = sprintf('%s@%s', $address->mailbox, $address->host); - } - } - if ($name == 'Bcc') { - continue; - } - $headers[] = $name . ': ' . $this->encodeHeader($value, $this->build_params['head_charset']); - } - // Add To header based on $recipients argument - $headers[] = 'To: ' . $this->encodeHeader(implode(', ', $recipients), $this->build_params['head_charset']); - - // Add headers to send_params - $send_params['headers'] = $headers; - $send_params['recipients'] = array_values(array_unique($smtp_recipients)); - $send_params['body'] = $this->output; - - // Setup return path - if (isset($this->return_path)) { - $send_params['from'] = $this->return_path; - } elseif (!empty($this->headers['From'])) { - $from = Mail_RFC822::parseAddressList($this->headers['From']); - $send_params['from'] = sprintf('%s@%s', $from[0]->mailbox, $from[0]->host); - } else { - $send_params['from'] = 'postmaster@' . $this->smtp_params['helo']; - } - // Send it - if (!$smtp->send($send_params)) { - $this->errors = $smtp->getErrors(); - return false; - } - return true; - break; - } - } - - /** - * Use this method to return the email - * in message/rfc822 format. Useful for - * adding an email to another email as - * an attachment. there's a commented - * out example in example.php. - * - * @param array $recipients Array of recipients - * @param string $type Method to be used to send the mail. - * Used to determine the line ending type. - */ - public function getRFC822($recipients, $type = 'mail') - { - // Make up the date header as according to RFC822 - $this->setHeader('Date', date('D, d M y H:i:s O')); - - if (!defined('CRLF')) { - $this->setCRLF($type == 'mail' ? "\n" : "\r\n"); - } - - if (!$this->is_built) { - $this->build(); - } - - // Return path ? - if (isset($this->return_path)) { - $headers[] = 'Return-Path: ' . $this->return_path; - } - - // Get flat representation of headers - foreach ($this->headers as $name => $value) { - $headers[] = $name . ': ' . $value; - } - $headers[] = 'To: ' . implode(', ', $recipients); - - return implode(CRLF, $headers) . CRLF . CRLF . $this->output; - } -} // End of class. - - -/** - * Attachment classes - */ -class attachment -{ - /** - * Data of attachment - * @var string - */ - public $data; - - /** - * Name of attachment (filename) - * @var string - */ - public $name; - - /** - * Content type of attachment - * @var string - */ - public $contentType; - - /** - * Encoding type of attachment - * @var object - */ - public $encoding; - - /** - * Constructor - * - * @param string $data File data - * @param string $name Name of attachment (filename) - * @param string $contentType Content type of attachment - * @param object $encoding Encoding type to use - */ - public function __construct($data, $name, $contentType, iEncoding $encoding) - { - $this->data = $data; - $this->name = $name; - $this->contentType = $contentType; - $this->encoding = $encoding; - } -} - - -/** - * File based attachment class - */ -class fileAttachment extends attachment -{ - /** - * Constructor - * - * @param string $filename Name of file - * @param string $contentType Content type of file - * @param string $encoding What encoding to use - */ - public function __construct($filename, $contentType = 'application/octet-stream', $encoding = null) - { - $encoding = is_null($encoding) ? new Base64Encoding() : $encoding; - - parent::__construct(file_get_contents($filename), basename($filename), $contentType, $encoding); - } -} - - -/** - * Attachment class to handle attachments which are contained - * in a variable. - */ -class stringAttachment extends attachment -{ - /** - * Constructor - * - * @param string $data File data - * @param string $name Name of attachment (filename) - * @param string $contentType Content type of file - * @param string $encoding What encoding to use - */ - public function __construct($data, $name = '', $contentType = 'application/octet-stream', $encoding = null) - { - $encoding = is_null($encoding) ? new Base64Encoding() : $encoding; - - parent::__construct($data, $name, $contentType, $encoding); - } -} - - -/** - * File based embedded image class - */ -class fileEmbeddedImage extends fileAttachment -{ -} - - -/** - * String based embedded image class - */ -class stringEmbeddedImage extends stringAttachment -{ -} - - -/** - * - */ -/** - * Encoding interface - */ -interface iEncoding -{ - public function encode($input); - public function getType(); -} - - -/** - * Base64 Encoding class - */ -class Base64Encoding implements iEncoding -{ - /* - * Function to encode data using - * base64 encoding. - * - * @param string $input Data to encode - */ - public function encode($input) - { - return rtrim(chunk_split(base64_encode($input), 76, defined('MAIL_MIME_PART_CRLF') ? MAIL_MIME_PART_CRLF : "\r\n")); - } - - /** - * Returns type - */ - public function getType() - { - return 'base64'; - } -} - - -/** - * Quoted Printable Encoding class - */ -class QPrintEncoding implements iEncoding -{ - /* - * Function to encode data using - * quoted-printable encoding. - * - * @param string $input Data to encode - */ - public function encode($input) - { - // Replace non printables - $input = preg_replace('/([^\x20\x21-\x3C\x3E-\x7E\x0A\x0D])/e', 'sprintf("=%02X", ord("\1"))', $input); - $inputLen = strlen($input); - $outLines = array(); - $output = ''; - - $lines = preg_split('/\r?\n/', $input); - - // Walk through each line - for ($i = 0; $i < count($lines); $i++) { - // Is line too long ? - if (strlen($lines[$i]) > $lineMax) { - $outLines[] = substr($lines[$i], 0, $lineMax - 1) . "="; // \r\n Gets added when lines are imploded - $lines[$i] = substr($lines[$i], $lineMax - 1); - $i--; // Ensure this line gets redone as we just changed it - } else { - $outLines[] = $lines[$i]; - } - } - - // Convert trailing whitespace - $output = preg_replace('/(\x20+)$/me', 'str_replace(" ", "=20", "\1")', $outLines); - - return implode("\r\n", $output); - } - - /** - * Returns type - */ - public function getType() - { - return 'quoted-printable'; - } -} - - -/** - * 7Bit Encoding class - */ -class SevenBitEncoding implements iEncoding -{ - /* - * Function to "encode" data using - * 7bit encoding. - * - * @param string $input Data to encode - */ - public function encode($input) - { - return $input; - } - - /** - * Returns type - */ - public function getType() - { - return '7bit'; - } -} - - -/** - * 8Bit Encoding class - */ -class EightBitEncoding implements iEncoding -{ - /* - * Function to "encode" data using - * 8bit encoding. - * - * @param string $input Data to encode - */ - public function encode($input) - { - return $input; - } - - /** - * Returns type - */ - public function getType() - { - return '8bit'; - } -} diff --git a/cadline/backend/maintenance/libraries/mmail/mimePart.php b/cadline/backend/maintenance/libraries/mmail/mimePart.php deleted file mode 100644 index 0e481336..00000000 --- a/cadline/backend/maintenance/libraries/mmail/mimePart.php +++ /dev/null @@ -1,310 +0,0 @@ -addSubPart($body, $params); - * - * // Now add an attachment. Assume $attach is - * the contents of the attachment - * - * $params['content_type'] = 'application/zip'; - * $params['encoding'] = 'base64'; - * $params['disposition'] = 'attachment'; - * $params['dfilename'] = 'example.zip'; - * $attach =& $email->addSubPart($body, $params); - * - * // Now build the email. Note that the encode - * // function returns an associative array containing two - * // elements, body and headers. You will need to add extra - * // headers, (eg. Mime-Version) before sending. - * - * $email = $message->encode(); - * $email['headers'][] = 'Mime-Version: 1.0'; - * - * - * Further examples are available at http://www.phpguru.org - * - * TODO: - * - Set encode() to return the $obj->encoded if encode() - * has already been run. Unless a flag is passed to specifically - * re-build the message. - * - * @author Richard Heyes - * @version $Revision: 1.3 $ - * @package Mail - */ - -class Mail_MIMEPart -{ - /** - * The encoding type of this part - * @var string - */ - private $encoding; - - /** - * An array of subparts - * @var array - */ - private $subparts; - - /** - * The output of this part after being built - * @var string - */ - private $encoded; - - /** - * Headers for this part - * @var array - */ - private $headers; - - /** - * The body of this part (not encoded) - * @var string - */ - private $body; - - /** - * Constructor. - * - * Sets up the object. - * - * @param $body - The body of the mime part if any. - * @param $params - An associative array of parameters: - * content_type - The content type for this part eg multipart/mixed - * encoding - The encoding to use, 7bit, 8bit, base64, or quoted-printable - * cid - Content ID to apply - * disposition - Content disposition, inline or attachment - * dfilename - Optional filename parameter for content disposition - * description - Content description - * charset - Character set to use - * @access public - */ - public function __construct($body = '', $params = array()) - { - if (!defined('MAIL_MIMEPART_CRLF')) { - define('MAIL_MIMEPART_CRLF', defined('MAIL_MIME_CRLF') ? MAIL_MIME_CRLF : "\r\n", true); - } - - foreach ($params as $key => $value) { - switch ($key) { - case 'content_type': - $headers['Content-Type'] = $value . (isset($charset) ? '; charset="' . $charset . '"' : ''); - break; - - case 'encoding': - $this->encoding = $value; - $headers['Content-Transfer-Encoding'] = $value; - break; - - case 'cid': - $headers['Content-ID'] = '<' . $value . '>'; - break; - - case 'disposition': - $headers['Content-Disposition'] = $value . (isset($dfilename) ? '; filename="' . $dfilename . '"' : ''); - break; - - case 'dfilename': - if (isset($headers['Content-Disposition'])) { - $headers['Content-Disposition'] .= '; filename="' . $value . '"'; - } else { - $dfilename = $value; - } - break; - - case 'description': - $headers['Content-Description'] = $value; - break; - - case 'charset': - if (isset($headers['Content-Type'])) { - $headers['Content-Type'] .= '; charset="' . $value . '"'; - } else { - $charset = $value; - } - break; - } - } - - // Default content-type - if (!isset($headers['Content-Type'])) { - $headers['Content-Type'] = 'text/plain'; - } - - // Default encoding - if (!isset($this->encoding)) { - $this->encoding = '7bit'; - } - - // Assign stuff to member variables - $this->encoded = array(); - $this->headers = $headers; - $this->body = $body; - } - - /** - * Encodes and returns the email. Also stores - * it in the encoded member variable - * - * @return An associative array containing two elements, - * body and headers. The headers element is itself - * an indexed array. - */ - public function encode() - { - $encoded = &$this->encoded; - - if (!empty($this->subparts)) { - srand((float)microtime() * 1000000); - $boundary = '=_' . md5(uniqid(rand()) . microtime()); - $this->headers['Content-Type'] .= ';' . MAIL_MIMEPART_CRLF . "\t" . 'boundary="' . $boundary . '"'; - - // Add body parts to $subparts - for ($i = 0; $i < count($this->subparts); $i++) { - $headers = array(); - $tmp = $this->subparts[$i]->encode(); - foreach ($tmp['headers'] as $key => $value) { - $headers[] = $key . ': ' . $value; - } - $subparts[] = implode(MAIL_MIMEPART_CRLF, $headers) . MAIL_MIMEPART_CRLF . MAIL_MIMEPART_CRLF . $tmp['body']; - } - - $encoded['body'] = '--' . $boundary . MAIL_MIMEPART_CRLF . - implode('--' . $boundary . MAIL_MIMEPART_CRLF, $subparts) . - '--' . $boundary . '--' . MAIL_MIMEPART_CRLF; - } else { - $encoded['body'] = $this->getEncodedData($this->body, $this->encoding) . MAIL_MIMEPART_CRLF; - } - - // Add headers to $encoded - $encoded['headers'] = &$this->headers; - - return $encoded; - } - - /** - * Adds a subpart to current mime part and returns - * a reference to it - * - * @param $body The body of the subpart, if any. - * @param $params The parameters for the subpart, same - * as the $params argument for constructor. - * @return A reference to the part you just added. - */ - public function addSubPart($body, $params) - { - $this->subparts[] = new Mail_MIMEPart($body, $params); - - return $this->subparts[count($this->subparts) - 1]; - } - - /** - * Returns encoded data based upon encoding passed to it - * - * @param $data The data to encode. - * @param $encoding The encoding type to use, 7bit, base64, - * or quoted-printable. - */ - private function getEncodedData($data, $encoding) - { - switch ($encoding) { - case '8bit': - case '7bit': - return $data; - break; - - case 'quoted-printable': - return $this->quotedPrintableEncode($data); - break; - - case 'base64': - return rtrim(chunk_split(base64_encode($data), 76, MAIL_MIMEPART_CRLF)); - break; - - default: - return $data; - } - } - - /** - * Encodes data to quoted-printable standard. - * - * @param $input The data to encode - * @param $line_max Optional max line length. Should - * not be more than 76 chars - */ - private function quotedPrintableEncode($input, $line_max = 76) - { - $lines = preg_split("/\r?\n/", $input); - $eol = MAIL_MIMEPART_CRLF; - $escape = '='; - $output = ''; - - while (list(, $line) = each($lines)) { - - $linlen = strlen($line); - $newline = ''; - - for ($i = 0; $i < $linlen; $i++) { - $char = substr($line, $i, 1); - $dec = ord($char); - - if (($dec == 32) and ($i == ($linlen - 1))) { // convert space at eol only - $char = '=20'; - } elseif ($dec == 9) {; // Do nothing if a tab. - } elseif (($dec == 61) or ($dec < 32) or ($dec > 126)) { - $char = $escape . strtoupper(sprintf('%02s', dechex($dec))); - } - - if ((strlen($newline) + strlen($char)) >= $line_max) { // MAIL_MIMEPART_CRLF is not counted - $output .= $newline . $escape . $eol; // soft line break; " =\r\n" is okay - $newline = ''; - } - $newline .= $char; - } // end of for - $output .= $newline . $eol; - } - $output = substr($output, 0, -1 * strlen($eol)); // Don't want last crlf - return $output; - } -} // End of class \ No newline at end of file diff --git a/cadline/backend/maintenance/libraries/mmail/smtp.php b/cadline/backend/maintenance/libraries/mmail/smtp.php deleted file mode 100644 index 81deaec3..00000000 --- a/cadline/backend/maintenance/libraries/mmail/smtp.php +++ /dev/null @@ -1,358 +0,0 @@ - - * pass - Password for authentication Default: - * timeout - The timeout in seconds for the call Default: 5 - * to fsockopen() - */ - public function __construct($params = array()) - { - - if (!defined('CRLF')) - define('CRLF', "\r\n", TRUE); - - $this->authenticated = FALSE; - $this->timeout = 5; - $this->status = SMTP_STATUS_NOT_CONNECTED; - $this->host = 'localhost'; - $this->port = 25; - $this->helo = 'localhost'; - $this->auth = FALSE; - $this->user = ''; - $this->pass = ''; - $this->errors = array(); - - foreach ($params as $key => $value) { - $this->$key = $value; - } - } - - /** - * Connect function. This will, when called - * statically, create a new smtp object, - * call the connect function (ie this function) - * and return it. When not called statically, - * it will connect to the server and send - * the HELO command. - */ - public function connect($params = array()) - { - if (!isset($this->status)) { - $obj = new smtp($params); - if ($obj->connect()) { - $obj->status = SMTP_STATUS_CONNECTED; - } - return $obj; - } else { - $this->connection = fsockopen($this->host, $this->port, $errno, $errstr, $this->timeout); - if (function_exists('socket_set_timeout')) { - @socket_set_timeout($this->connection, 5, 0); - } - - $greeting = $this->get_data(); - if (is_resource($this->connection)) { - return $this->auth ? $this->ehlo() : $this->helo(); - } else { - $this->errors[] = 'Failed to connect to server: ' . $errstr; - return FALSE; - } - } - } - - /** - * Function which handles sending the mail. - * Arguments: - * $params - Optional assoc array of parameters. - * Can contain: - * recipients - Indexed array of recipients - * from - The from address. (used in MAIL FROM:), - * this will be the return path - * headers - Indexed array of headers, one header per array entry - * body - The body of the email - * It can also contain any of the parameters from the connect() - * function - */ - public function send($params = array()) - { - foreach ($params as $key => $value) { - $this->set($key, $value); - } - if ($this->is_connected()) { - // Do we auth or not? Note the distinction between the auth variable and auth() function - if ($this->auth and !$this->authenticated) { - if (!$this->auth()) - return false; - } - $this->mail($this->from); - - if (is_array($this->recipients)) { - foreach ($this->recipients as $value) { - $this->rcpt($value); - } - } else { - $this->rcpt($this->recipients); - } - if (!$this->data()) { - return false; - } - // Transparency - $headers = str_replace(CRLF . '.', CRLF . '..', trim(implode(CRLF, $this->headers))); - $body = str_replace(CRLF . '.', CRLF . '..', $this->body); - $body = substr($body, 0, 1) == '.' ? '.' . $body : $body; - $this->send_data($headers); - $this->send_data(''); - $this->send_data($body); - $this->send_data('.'); - - $result = (substr(trim($this->get_data()), 0, 3) === '250'); - //$this->rset(); - return $result; - } else { - $this->errors[] = 'Not connected!'; - return FALSE; - } - } - - /** - * Function to implement HELO cmd - */ - private function helo() - { - if ( - is_resource($this->connection) - and $this->send_data('HELO ' . $this->helo) - and substr(trim($error = $this->get_data()), 0, 3) === '250' - ) { - return true; - } else { - $this->errors[] = 'HELO command failed, output: ' . trim(substr(trim($error), 3)); - return false; - } - } - - /** - * Function to implement EHLO cmd - */ - private function ehlo() - { - if ( - is_resource($this->connection) - and $this->send_data('EHLO ' . $this->helo) - and substr(trim($error = $this->get_data()), 0, 3) === '250' - ) { - return true; - } else { - $this->errors[] = 'EHLO command failed, output: ' . trim(substr(trim($error), 3)); - return false; - } - } - - /** - * Function to implement RSET cmd - */ - private function rset() - { - if ( - is_resource($this->connection) - and $this->send_data('RSET') - and substr(trim($error = $this->get_data()), 0, 3) === '250' - ) { - - return true; - } else { - $this->errors[] = 'RSET command failed, output: ' . trim(substr(trim($error), 3)); - return false; - } - } - - /** - * Function to implement QUIT cmd - */ - private function quit() - { - if ( - is_resource($this->connection) - and $this->send_data('QUIT') - and substr(trim($error = $this->get_data()), 0, 3) === '221' - ) { - - fclose($this->connection); - $this->status = SMTP_STATUS_NOT_CONNECTED; - return true; - } else { - $this->errors[] = 'QUIT command failed, output: ' . trim(substr(trim($error), 3)); - return false; - } - } - - /** - * Function to implement AUTH cmd - */ - private function auth() - { - if ( - is_resource($this->connection) - and $this->send_data('AUTH LOGIN') - and substr(trim($error = $this->get_data()), 0, 3) === '334' - and $this->send_data(base64_encode($this->user)) // Send username - and substr(trim($error = $this->get_data()), 0, 3) === '334' - and $this->send_data(base64_encode($this->pass)) // Send password - and substr(trim($error = $this->get_data()), 0, 3) === '235' - ) { - $this->authenticated = true; - return true; - } else { - $this->errors[] = 'AUTH command failed: ' . trim(substr(trim($error), 3)); - return false; - } - } - - /** - * Function that handles the MAIL FROM: cmd - */ - private function mail($from) - { - if ($this->is_connected()) { - if ($this->send_data('MAIL FROM:<' . $from . '>')) { - if (substr(trim($this->get_data()), 0, 3) === '250') { - return true; - } - } - } else { - return false; - } - } - - /** - * Function that handles the RCPT TO: cmd - */ - private function rcpt($to) - { - if ($this->is_connected()) { - if ($this->send_data('RCPT TO:<' . $to . '>')) { - if (substr(trim($error = $this->get_data()), 0, 2) === '25') - return true; - } - } else { - $this->errors[] = trim(substr(trim($error), 3)); - return false; - } - } - - /** - * Function that sends the DATA cmd - */ - private function data() - { - if ($this->is_connected()) { - if ($this->send_data('DATA')) { - if (substr(trim($error = $this->get_data()), 0, 3) === '354') - return true; - } - } else { - $this->errors[] = trim(substr(trim($error), 3)); - return false; - } - } - - /** - * Function to determine if this object - * is connected to the server or not. - */ - private function is_connected() - { - return (is_resource($this->connection) and ($this->status === SMTP_STATUS_CONNECTED)); - } - - /** - * Function to send a bit of data - */ - private function send_data($data) - { - if (is_resource($this->connection)) { - return fwrite($this->connection, $data . CRLF, strlen($data) + 2); - } else { - return false; - } - } - - /** - * Function to get data. - */ - private function get_data() - { - $return = ''; - $line = ''; - $loops = 0; - - if (is_resource($this->connection)) { - while ((strpos($return, CRLF) === FALSE or substr($line, 3, 1) !== ' ') and $loops < 100) { - $line = fgets($this->connection, 512); - $return .= $line; - $loops++; - } - return $return; - } else - return false; - } - - /** - * Sets a variable - */ - public function set($var, $value) - { - $this->$var = $value; - return true; - } - - /** - * Function to return the errors array - */ - public function getErrors() - { - return $this->errors; - } -} diff --git a/cadline/backend/maintenance/libraries/phpmailer/PHPMailerAutoload.php b/cadline/backend/maintenance/libraries/phpmailer/PHPMailerAutoload.php deleted file mode 100644 index 9044af43..00000000 --- a/cadline/backend/maintenance/libraries/phpmailer/PHPMailerAutoload.php +++ /dev/null @@ -1,50 +0,0 @@ - - * @author Jim Jagielski (jimjag) - * @author Andy Prevost (codeworxtech) - * @author Brent R. Matzelle (original founder) - * @copyright 2012 - 2014 Marcus Bointon - * @copyright 2010 - 2012 Jim Jagielski - * @copyright 2004 - 2009 Andy Prevost - * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License - * @note This program is distributed in the hope that it will be useful - WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. - */ - -/** - * PHPMailer SPL autoloader. - * @param string $classname The name of the class to load - */ -function PHPMailerAutoload($classname) -{ - //Can't use __DIR__ as it's only in PHP 5.3+ - $filename = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'class.' . strtolower($classname) . '.php'; - if (is_readable($filename)) { - require $filename; - } -} - -if (version_compare(PHP_VERSION, '5.1.2', '>=')) { - //SPL autoloading was introduced in PHP 5.1.2 - if (version_compare(PHP_VERSION, '5.3.0', '>=')) { - spl_autoload_register('PHPMailerAutoload', true, true); - } else { - spl_autoload_register('PHPMailerAutoload'); - } -} else { - /** - * Fall back to traditional autoload for old PHP versions - * @param string $classname The name of the class to load - */ - function __autoload($classname) - { - PHPMailerAutoload($classname); - } -} diff --git a/cadline/backend/maintenance/libraries/phpmailer/class.phpmailer.php b/cadline/backend/maintenance/libraries/phpmailer/class.phpmailer.php deleted file mode 100644 index b6a08577..00000000 --- a/cadline/backend/maintenance/libraries/phpmailer/class.phpmailer.php +++ /dev/null @@ -1,3454 +0,0 @@ - - * @author Jim Jagielski (jimjag) - * @author Andy Prevost (codeworxtech) - * @author Brent R. Matzelle (original founder) - * @copyright 2012 - 2014 Marcus Bointon - * @copyright 2010 - 2012 Jim Jagielski - * @copyright 2004 - 2009 Andy Prevost - * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License - * @note This program is distributed in the hope that it will be useful - WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. - */ - -/** - * PHPMailer - PHP email creation and transport class. - * @package PHPMailer - * @author Marcus Bointon (Synchro/coolbru) - * @author Jim Jagielski (jimjag) - * @author Andy Prevost (codeworxtech) - * @author Brent R. Matzelle (original founder) - */ -class PHPMailer -{ - /** - * The PHPMailer Version number. - * @type string - */ - public $Version = '5.2.9'; - - /** - * Email priority. - * Options: 1 = High, 3 = Normal, 5 = low. - * @type integer - */ - public $Priority = 3; - - /** - * The character set of the message. - * @type string - */ - public $CharSet = 'iso-8859-1'; - - /** - * The MIME Content-type of the message. - * @type string - */ - public $ContentType = 'text/plain'; - - /** - * The message encoding. - * Options: "8bit", "7bit", "binary", "base64", and "quoted-printable". - * @type string - */ - public $Encoding = '8bit'; - - /** - * Holds the most recent mailer error message. - * @type string - */ - public $ErrorInfo = ''; - - /** - * The From email address for the message. - * @type string - */ - public $From = 'root@localhost'; - - /** - * The From name of the message. - * @type string - */ - public $FromName = 'Root User'; - - /** - * The Sender email (Return-Path) of the message. - * If not empty, will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode. - * @type string - */ - public $Sender = ''; - - /** - * The Return-Path of the message. - * If empty, it will be set to either From or Sender. - * @type string - * @deprecated Email senders should never set a return-path header; - * it's the receiver's job (RFC5321 section 4.4), so this no longer does anything. - * @link https://tools.ietf.org/html/rfc5321#section-4.4 RFC5321 reference - */ - public $ReturnPath = ''; - - /** - * The Subject of the message. - * @type string - */ - public $Subject = ''; - - /** - * An HTML or plain text message body. - * If HTML then call isHTML(true). - * @type string - */ - public $Body = ''; - - /** - * The plain-text message body. - * This body can be read by mail clients that do not have HTML email - * capability such as mutt & Eudora. - * Clients that can read HTML will view the normal Body. - * @type string - */ - public $AltBody = ''; - - /** - * An iCal message part body. - * Only supported in simple alt or alt_inline message types - * To generate iCal events, use the bundled extras/EasyPeasyICS.php class or iCalcreator - * @link http://sprain.ch/blog/downloads/php-class-easypeasyics-create-ical-files-with-php/ - * @link http://kigkonsult.se/iCalcreator/ - * @type string - */ - public $Ical = ''; - - /** - * The complete compiled MIME message body. - * @access protected - * @type string - */ - protected $MIMEBody = ''; - - /** - * The complete compiled MIME message headers. - * @type string - * @access protected - */ - protected $MIMEHeader = ''; - - /** - * Extra headers that createHeader() doesn't fold in. - * @type string - * @access protected - */ - protected $mailHeader = ''; - - /** - * Word-wrap the message body to this number of chars. - * @type integer - */ - public $WordWrap = 0; - - /** - * Which method to use to send mail. - * Options: "mail", "sendmail", or "smtp". - * @type string - */ - public $Mailer = 'mail'; - - /** - * The path to the sendmail program. - * @type string - */ - public $Sendmail = '/usr/sbin/sendmail'; - - /** - * Whether mail() uses a fully sendmail-compatible MTA. - * One which supports sendmail's "-oi -f" options. - * @type boolean - */ - public $UseSendmailOptions = true; - - /** - * Path to PHPMailer plugins. - * Useful if the SMTP class is not in the PHP include path. - * @type string - * @deprecated Should not be needed now there is an autoloader. - */ - public $PluginDir = ''; - - /** - * The email address that a reading confirmation should be sent to. - * @type string - */ - public $ConfirmReadingTo = ''; - - /** - * The hostname to use in Message-Id and Received headers - * and as default HELO string. - * If empty, the value returned - * by SERVER_NAME is used or 'localhost.localdomain'. - * @type string - */ - public $Hostname = ''; - - /** - * An ID to be used in the Message-Id header. - * If empty, a unique id will be generated. - * @type string - */ - public $MessageID = ''; - - /** - * The message Date to be used in the Date header. - * If empty, the current date will be added. - * @type string - */ - public $MessageDate = ''; - - /** - * SMTP hosts. - * Either a single hostname or multiple semicolon-delimited hostnames. - * You can also specify a different port - * for each host by using this format: [hostname:port] - * (e.g. "smtp1.example.com:25;smtp2.example.com"). - * You can also specify encryption type, for example: - * (e.g. "tls://smtp1.example.com:587;ssl://smtp2.example.com:465"). - * Hosts will be tried in order. - * @type string - */ - public $Host = 'localhost'; - - /** - * The default SMTP server port. - * @type integer - * @TODO Why is this needed when the SMTP class takes care of it? - */ - public $Port = 25; - - /** - * The SMTP HELO of the message. - * Default is $Hostname. - * @type string - * @see PHPMailer::$Hostname - */ - public $Helo = ''; - - /** - * The secure connection prefix. - * Options: "", "ssl" or "tls" - * @type string - */ - public $SMTPSecure = ''; - - /** - * Whether to use SMTP authentication. - * Uses the Username and Password properties. - * @type boolean - * @see PHPMailer::$Username - * @see PHPMailer::$Password - */ - public $SMTPAuth = false; - - /** - * SMTP username. - * @type string - */ - public $Username = ''; - - /** - * SMTP password. - * @type string - */ - public $Password = ''; - - /** - * SMTP auth type. - * Options are LOGIN (default), PLAIN, NTLM, CRAM-MD5 - * @type string - */ - public $AuthType = ''; - - /** - * SMTP realm. - * Used for NTLM auth - * @type string - */ - public $Realm = ''; - - /** - * SMTP workstation. - * Used for NTLM auth - * @type string - */ - public $Workstation = ''; - - /** - * The SMTP server timeout in seconds. - * @type integer - */ - public $Timeout = 10; - - /** - * SMTP class debug output mode. - * Debug output level. - * Options: - * * `0` No output - * * `1` Commands - * * `2` Data and commands - * * `3` As 2 plus connection status - * * `4` Low-level data output - * @type integer - * @see SMTP::$do_debug - */ - public $SMTPDebug = 0; - - /** - * How to handle debug output. - * Options: - * * `echo` Output plain-text as-is, appropriate for CLI - * * `html` Output escaped, line breaks converted to `
        `, appropriate for browser output - * * `error_log` Output to error log as configured in php.ini - * - * Alternatively, you can provide a callable expecting two params: a message string and the debug level: - * - * $mail->Debugoutput = function($str, $level) {echo "debug level $level; message: $str";}; - * - * @type string|callable - * @see SMTP::$Debugoutput - */ - public $Debugoutput = 'echo'; - - /** - * Whether to keep SMTP connection open after each message. - * If this is set to true then to close the connection - * requires an explicit call to smtpClose(). - * @type boolean - */ - public $SMTPKeepAlive = false; - - /** - * Whether to split multiple to addresses into multiple messages - * or send them all in one message. - * @type boolean - */ - public $SingleTo = false; - - /** - * Storage for addresses when SingleTo is enabled. - * @type array - * @TODO This should really not be public - */ - public $SingleToArray = array(); - - /** - * Whether to generate VERP addresses on send. - * Only applicable when sending via SMTP. - * @link http://en.wikipedia.org/wiki/Variable_envelope_return_path - * @link http://www.postfix.org/VERP_README.html Postfix VERP info - * @type boolean - */ - public $do_verp = false; - - /** - * Whether to allow sending messages with an empty body. - * @type boolean - */ - public $AllowEmpty = false; - - /** - * The default line ending. - * @note The default remains "\n". We force CRLF where we know - * it must be used via self::CRLF. - * @type string - */ - public $LE = "\n"; - - /** - * DKIM selector. - * @type string - */ - public $DKIM_selector = ''; - - /** - * DKIM Identity. - * Usually the email address used as the source of the email - * @type string - */ - public $DKIM_identity = ''; - - /** - * DKIM passphrase. - * Used if your key is encrypted. - * @type string - */ - public $DKIM_passphrase = ''; - - /** - * DKIM signing domain name. - * @example 'example.com' - * @type string - */ - public $DKIM_domain = ''; - - /** - * DKIM private key file path. - * @type string - */ - public $DKIM_private = ''; - - /** - * Callback Action function name. - * - * The function that handles the result of the send email action. - * It is called out by send() for each email sent. - * - * Value can be any php callable: http://www.php.net/is_callable - * - * Parameters: - * boolean $result result of the send action - * string $to email address of the recipient - * string $cc cc email addresses - * string $bcc bcc email addresses - * string $subject the subject - * string $body the email body - * string $from email address of sender - * @type string - */ - public $action_function = ''; - - /** - * What to use in the X-Mailer header. - * Options: null for default, whitespace for none, or a string to use - * @type string - */ - public $XMailer = ''; - - /** - * An instance of the SMTP sender class. - * @type SMTP - * @access protected - */ - protected $smtp = null; - - /** - * The array of 'to' addresses. - * @type array - * @access protected - */ - protected $to = array(); - - /** - * The array of 'cc' addresses. - * @type array - * @access protected - */ - protected $cc = array(); - - /** - * The array of 'bcc' addresses. - * @type array - * @access protected - */ - protected $bcc = array(); - - /** - * The array of reply-to names and addresses. - * @type array - * @access protected - */ - protected $ReplyTo = array(); - - /** - * An array of all kinds of addresses. - * Includes all of $to, $cc, $bcc, $replyto - * @type array - * @access protected - */ - protected $all_recipients = array(); - - /** - * The array of attachments. - * @type array - * @access protected - */ - protected $attachment = array(); - - /** - * The array of custom headers. - * @type array - * @access protected - */ - protected $CustomHeader = array(); - - /** - * The most recent Message-ID (including angular brackets). - * @type string - * @access protected - */ - protected $lastMessageID = ''; - - /** - * The message's MIME type. - * @type string - * @access protected - */ - protected $message_type = ''; - - /** - * The array of MIME boundary strings. - * @type array - * @access protected - */ - protected $boundary = array(); - - /** - * The array of available languages. - * @type array - * @access protected - */ - protected $language = array(); - - /** - * The number of errors encountered. - * @type integer - * @access protected - */ - protected $error_count = 0; - - /** - * The S/MIME certificate file path. - * @type string - * @access protected - */ - protected $sign_cert_file = ''; - - /** - * The S/MIME key file path. - * @type string - * @access protected - */ - protected $sign_key_file = ''; - - /** - * The S/MIME password for the key. - * Used only if the key is encrypted. - * @type string - * @access protected - */ - protected $sign_key_pass = ''; - - /** - * Whether to throw exceptions for errors. - * @type boolean - * @access protected - */ - protected $exceptions = false; - - /** - * Error severity: message only, continue processing. - */ - const STOP_MESSAGE = 0; - - /** - * Error severity: message, likely ok to continue processing. - */ - const STOP_CONTINUE = 1; - - /** - * Error severity: message, plus full stop, critical error reached. - */ - const STOP_CRITICAL = 2; - - /** - * SMTP RFC standard line ending. - */ - const CRLF = "\r\n"; - - /** - * Constructor. - * @param boolean $exceptions Should we throw external exceptions? - */ - public function __construct($exceptions = false) - { - $this->exceptions = ($exceptions == true); - } - - /** - * Destructor. - */ - public function __destruct() - { - if ($this->Mailer == 'smtp') { //close any open SMTP connection nicely - $this->smtpClose(); - } - } - - /** - * Call mail() in a safe_mode-aware fashion. - * Also, unless sendmail_path points to sendmail (or something that - * claims to be sendmail), don't pass params (not a perfect fix, - * but it will do) - * @param string $to To - * @param string $subject Subject - * @param string $body Message Body - * @param string $header Additional Header(s) - * @param string $params Params - * @access private - * @return boolean - */ - private function mailPassthru($to, $subject, $body, $header, $params) - { - //Check overloading of mail function to avoid double-encoding - if (ini_get('mbstring.func_overload') & 1) { - $subject = $this->secureHeader($subject); - } else { - $subject = $this->encodeHeader($this->secureHeader($subject)); - } - if (ini_get('safe_mode') || !($this->UseSendmailOptions)) { - $result = @mail($to, $subject, $body, $header); - } else { - $result = @mail($to, $subject, $body, $header, $params); - } - return $result; - } - - /** - * Output debugging info via user-defined method. - * Only generates output if SMTP debug output is enabled (@see SMTP::$do_debug). - * @see PHPMailer::$Debugoutput - * @see PHPMailer::$SMTPDebug - * @param string $str - */ - protected function edebug($str) - { - if ($this->SMTPDebug <= 0) { - return; - } - if (is_callable($this->Debugoutput)) { - call_user_func($this->Debugoutput, $str, $this->SMTPDebug); - return; - } - switch ($this->Debugoutput) { - case 'error_log': - //Don't output, just log - error_log($str); - break; - case 'html': - //Cleans up output a bit for a better looking, HTML-safe output - echo htmlentities( - preg_replace('/[\r\n]+/', '', $str), - ENT_QUOTES, - 'UTF-8' - ) - . "
        \n"; - break; - case 'echo': - default: - //Normalize line breaks - $str = preg_replace('/(\r\n|\r|\n)/ms', "\n", $str); - echo gmdate('Y-m-d H:i:s') . "\t" . str_replace( - "\n", - "\n \t ", - trim($str) - ) . "\n"; - } - } - - /** - * Sets message type to HTML or plain. - * @param boolean $isHtml True for HTML mode. - * @return void - */ - public function isHTML($isHtml = true) - { - if ($isHtml) { - $this->ContentType = 'text/html'; - } else { - $this->ContentType = 'text/plain'; - } - } - - /** - * Send messages using SMTP. - * @return void - */ - public function isSMTP() - { - $this->Mailer = 'smtp'; - } - - /** - * Send messages using PHP's mail() function. - * @return void - */ - public function isMail() - { - $this->Mailer = 'mail'; - } - - /** - * Send messages using $Sendmail. - * @return void - */ - public function isSendmail() - { - $ini_sendmail_path = ini_get('sendmail_path'); - - if (!stristr($ini_sendmail_path, 'sendmail')) { - $this->Sendmail = '/usr/sbin/sendmail'; - } else { - $this->Sendmail = $ini_sendmail_path; - } - $this->Mailer = 'sendmail'; - } - - /** - * Send messages using qmail. - * @return void - */ - public function isQmail() - { - $ini_sendmail_path = ini_get('sendmail_path'); - - if (!stristr($ini_sendmail_path, 'qmail')) { - $this->Sendmail = '/var/qmail/bin/qmail-inject'; - } else { - $this->Sendmail = $ini_sendmail_path; - } - $this->Mailer = 'qmail'; - } - - /** - * Add a "To" address. - * @param string $address - * @param string $name - * @return boolean true on success, false if address already used - */ - public function addAddress($address, $name = '') - { - return $this->addAnAddress('to', $address, $name); - } - - /** - * Add a "CC" address. - * @note: This function works with the SMTP mailer on win32, not with the "mail" mailer. - * @param string $address - * @param string $name - * @return boolean true on success, false if address already used - */ - public function addCC($address, $name = '') - { - return $this->addAnAddress('cc', $address, $name); - } - - /** - * Add a "BCC" address. - * @note: This function works with the SMTP mailer on win32, not with the "mail" mailer. - * @param string $address - * @param string $name - * @return boolean true on success, false if address already used - */ - public function addBCC($address, $name = '') - { - return $this->addAnAddress('bcc', $address, $name); - } - - /** - * Add a "Reply-to" address. - * @param string $address - * @param string $name - * @return boolean - */ - public function addReplyTo($address, $name = '') - { - return $this->addAnAddress('Reply-To', $address, $name); - } - - /** - * Add an address to one of the recipient arrays. - * Addresses that have been added already return false, but do not throw exceptions - * @param string $kind One of 'to', 'cc', 'bcc', 'ReplyTo' - * @param string $address The email address to send to - * @param string $name - * @throws phpmailerException - * @return boolean true on success, false if address already used or invalid in some way - * @access protected - */ - protected function addAnAddress($kind, $address, $name = '') - { - if (!preg_match('/^(to|cc|bcc|Reply-To)$/', $kind)) { - $this->setError($this->lang('Invalid recipient array') . ': ' . $kind); - $this->edebug($this->lang('Invalid recipient array') . ': ' . $kind); - if ($this->exceptions) { - throw new phpmailerException('Invalid recipient array: ' . $kind); - } - return false; - } - $address = trim($address); - $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim - if (!$this->validateAddress($address)) { - $this->setError($this->lang('invalid_address') . ': ' . $address); - $this->edebug($this->lang('invalid_address') . ': ' . $address); - if ($this->exceptions) { - throw new phpmailerException($this->lang('invalid_address') . ': ' . $address); - } - return false; - } - if ($kind != 'Reply-To') { - if (!isset($this->all_recipients[strtolower($address)])) { - array_push($this->$kind, array($address, $name)); - $this->all_recipients[strtolower($address)] = true; - return true; - } - } else { - if (!array_key_exists(strtolower($address), $this->ReplyTo)) { - $this->ReplyTo[strtolower($address)] = array($address, $name); - return true; - } - } - return false; - } - - /** - * Set the From and FromName properties. - * @param string $address - * @param string $name - * @param boolean $auto Whether to also set the Sender address, defaults to true - * @throws phpmailerException - * @return boolean - */ - public function setFrom($address, $name = '', $auto = true) - { - $address = trim($address); - $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim - if (!$this->validateAddress($address)) { - $this->setError($this->lang('invalid_address') . ': ' . $address); - $this->edebug($this->lang('invalid_address') . ': ' . $address); - if ($this->exceptions) { - throw new phpmailerException($this->lang('invalid_address') . ': ' . $address); - } - return false; - } - $this->From = $address; - $this->FromName = $name; - if ($auto) { - if (empty($this->Sender)) { - $this->Sender = $address; - } - } - return true; - } - - /** - * Return the Message-ID header of the last email. - * Technically this is the value from the last time the headers were created, - * but it's also the message ID of the last sent message except in - * pathological cases. - * @return string - */ - public function getLastMessageID() - { - return $this->lastMessageID; - } - - /** - * Check that a string looks like an email address. - * @param string $address The email address to check - * @param string $patternselect A selector for the validation pattern to use : - * * `auto` Pick strictest one automatically; - * * `pcre8` Use the squiloople.com pattern, requires PCRE > 8.0, PHP >= 5.3.2, 5.2.14; - * * `pcre` Use old PCRE implementation; - * * `php` Use PHP built-in FILTER_VALIDATE_EMAIL; same as pcre8 but does not allow 'dotless' domains; - * * `html5` Use the pattern given by the HTML5 spec for 'email' type form input elements. - * * `noregex` Don't use a regex: super fast, really dumb. - * @return boolean - * @static - * @access public - */ - public static function validateAddress($address, $patternselect = 'auto') - { - if (!$patternselect or $patternselect == 'auto') { - //Check this constant first so it works when extension_loaded() is disabled by safe mode - //Constant was added in PHP 5.2.4 - if (defined('PCRE_VERSION')) { - //This pattern can get stuck in a recursive loop in PCRE <= 8.0.2 - if (version_compare(PCRE_VERSION, '8.0.3') >= 0) { - $patternselect = 'pcre8'; - } else { - $patternselect = 'pcre'; - } - } elseif (function_exists('extension_loaded') and extension_loaded('pcre')) { - //Fall back to older PCRE - $patternselect = 'pcre'; - } else { - //Filter_var appeared in PHP 5.2.0 and does not require the PCRE extension - if (version_compare(PHP_VERSION, '5.2.0') >= 0) { - $patternselect = 'php'; - } else { - $patternselect = 'noregex'; - } - } - } - switch ($patternselect) { - case 'pcre8': - /** - * Uses the same RFC5322 regex on which FILTER_VALIDATE_EMAIL is based, but allows dotless domains. - * @link http://squiloople.com/2009/12/20/email-address-validation/ - * @copyright 2009-2010 Michael Rushton - * Feel free to use and redistribute this code. But please keep this copyright notice. - */ - return (boolean)preg_match( - '/^(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){255,})(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){65,}@)' . - '((?>(?>(?>((?>(?>(?>\x0D\x0A)?[\t ])+|(?>[\t ]*\x0D\x0A)?[\t ]+)?)(\((?>(?2)' . - '(?>[\x01-\x08\x0B\x0C\x0E-\'*-\[\]-\x7F]|\\\[\x00-\x7F]|(?3)))*(?2)\)))+(?2))|(?2))?)' . - '([!#-\'*+\/-9=?^-~-]+|"(?>(?2)(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\x7F]))*' . - '(?2)")(?>(?1)\.(?1)(?4))*(?1)@(?!(?1)[a-z0-9-]{64,})(?1)(?>([a-z0-9](?>[a-z0-9-]*[a-z0-9])?)' . - '(?>(?1)\.(?!(?1)[a-z0-9-]{64,})(?1)(?5)){0,126}|\[(?:(?>IPv6:(?>([a-f0-9]{1,4})(?>:(?6)){7}' . - '|(?!(?:.*[a-f0-9][:\]]){8,})((?6)(?>:(?6)){0,6})?::(?7)?))|(?>(?>IPv6:(?>(?6)(?>:(?6)){5}:' . - '|(?!(?:.*[a-f0-9]:){6,})(?8)?::(?>((?6)(?>:(?6)){0,4}):)?))?(25[0-5]|2[0-4][0-9]|1[0-9]{2}' . - '|[1-9]?[0-9])(?>\.(?9)){3}))\])(?1)$/isD', - $address - ); - case 'pcre': - //An older regex that doesn't need a recent PCRE - return (boolean)preg_match( - '/^(?!(?>"?(?>\\\[ -~]|[^"])"?){255,})(?!(?>"?(?>\\\[ -~]|[^"])"?){65,}@)(?>' . - '[!#-\'*+\/-9=?^-~-]+|"(?>(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\xFF]))*")' . - '(?>\.(?>[!#-\'*+\/-9=?^-~-]+|"(?>(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\xFF]))*"))*' . - '@(?>(?![a-z0-9-]{64,})(?>[a-z0-9](?>[a-z0-9-]*[a-z0-9])?)(?>\.(?![a-z0-9-]{64,})' . - '(?>[a-z0-9](?>[a-z0-9-]*[a-z0-9])?)){0,126}|\[(?:(?>IPv6:(?>(?>[a-f0-9]{1,4})(?>:' . - '[a-f0-9]{1,4}){7}|(?!(?:.*[a-f0-9][:\]]){8,})(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,6})?' . - '::(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,6})?))|(?>(?>IPv6:(?>[a-f0-9]{1,4}(?>:' . - '[a-f0-9]{1,4}){5}:|(?!(?:.*[a-f0-9]:){6,})(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,4})?' . - '::(?>(?:[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,4}):)?))?(?>25[0-5]|2[0-4][0-9]|1[0-9]{2}' . - '|[1-9]?[0-9])(?>\.(?>25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}))\])$/isD', - $address - ); - case 'html5': - /** - * This is the pattern used in the HTML5 spec for validation of 'email' type form input elements. - * @link http://www.whatwg.org/specs/web-apps/current-work/#e-mail-state-(type=email) - */ - return (boolean)preg_match( - '/^[a-zA-Z0-9.!#$%&\'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}' . - '[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/sD', - $address - ); - case 'noregex': - //No PCRE! Do something _very_ approximate! - //Check the address is 3 chars or longer and contains an @ that's not the first or last char - return (strlen($address) >= 3 - and strpos($address, '@') >= 1 - and strpos($address, '@') != strlen($address) - 1); - case 'php': - default: - return (boolean)filter_var($address, FILTER_VALIDATE_EMAIL); - } - } - - /** - * Create a message and send it. - * Uses the sending method specified by $Mailer. - * @throws phpmailerException - * @return boolean false on error - See the ErrorInfo property for details of the error. - */ - public function send() - { - try { - if (!$this->preSend()) { - return false; - } - return $this->postSend(); - } catch (phpmailerException $exc) { - $this->mailHeader = ''; - $this->setError($exc->getMessage()); - if ($this->exceptions) { - throw $exc; - } - return false; - } - } - - /** - * Prepare a message for sending. - * @throws phpmailerException - * @return boolean - */ - public function preSend() - { - try { - $this->mailHeader = ''; - if ((count($this->to) + count($this->cc) + count($this->bcc)) < 1) { - throw new phpmailerException($this->lang('provide_address'), self::STOP_CRITICAL); - } - - // Set whether the message is multipart/alternative - if (!empty($this->AltBody)) { - $this->ContentType = 'multipart/alternative'; - } - - $this->error_count = 0; // reset errors - $this->setMessageType(); - // Refuse to send an empty message unless we are specifically allowing it - if (!$this->AllowEmpty and empty($this->Body)) { - throw new phpmailerException($this->lang('empty_message'), self::STOP_CRITICAL); - } - - $this->MIMEHeader = $this->createHeader(); - $this->MIMEBody = $this->createBody(); - - // To capture the complete message when using mail(), create - // an extra header list which createHeader() doesn't fold in - if ($this->Mailer == 'mail') { - if (count($this->to) > 0) { - $this->mailHeader .= $this->addrAppend('To', $this->to); - } else { - $this->mailHeader .= $this->headerLine('To', 'undisclosed-recipients:;'); - } - $this->mailHeader .= $this->headerLine( - 'Subject', - $this->encodeHeader($this->secureHeader(trim($this->Subject))) - ); - } - - // Sign with DKIM if enabled - if (!empty($this->DKIM_domain) - && !empty($this->DKIM_private) - && !empty($this->DKIM_selector) - && !empty($this->DKIM_domain) - && file_exists($this->DKIM_private)) { - $header_dkim = $this->DKIM_Add( - $this->MIMEHeader . $this->mailHeader, - $this->encodeHeader($this->secureHeader($this->Subject)), - $this->MIMEBody - ); - $this->MIMEHeader = rtrim($this->MIMEHeader, "\r\n ") . self::CRLF . - str_replace("\r\n", "\n", $header_dkim) . self::CRLF; - } - return true; - - } catch (phpmailerException $exc) { - $this->setError($exc->getMessage()); - if ($this->exceptions) { - throw $exc; - } - return false; - } - } - - /** - * Actually send a message. - * Send the email via the selected mechanism - * @throws phpmailerException - * @return boolean - */ - public function postSend() - { - try { - // Choose the mailer and send through it - switch ($this->Mailer) { - case 'sendmail': - case 'qmail': - return $this->sendmailSend($this->MIMEHeader, $this->MIMEBody); - case 'smtp': - return $this->smtpSend($this->MIMEHeader, $this->MIMEBody); - case 'mail': - return $this->mailSend($this->MIMEHeader, $this->MIMEBody); - default: - $sendMethod = $this->Mailer.'Send'; - if (method_exists($this, $sendMethod)) { - return $this->$sendMethod($this->MIMEHeader, $this->MIMEBody); - } - - return $this->mailSend($this->MIMEHeader, $this->MIMEBody); - } - } catch (phpmailerException $exc) { - $this->setError($exc->getMessage()); - $this->edebug($exc->getMessage()); - if ($this->exceptions) { - throw $exc; - } - } - return false; - } - - /** - * Send mail using the $Sendmail program. - * @param string $header The message headers - * @param string $body The message body - * @see PHPMailer::$Sendmail - * @throws phpmailerException - * @access protected - * @return boolean - */ - protected function sendmailSend($header, $body) - { - if ($this->Sender != '') { - if ($this->Mailer == 'qmail') { - $sendmail = sprintf('%s -f%s', escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender)); - } else { - $sendmail = sprintf('%s -oi -f%s -t', escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender)); - } - } else { - if ($this->Mailer == 'qmail') { - $sendmail = sprintf('%s', escapeshellcmd($this->Sendmail)); - } else { - $sendmail = sprintf('%s -oi -t', escapeshellcmd($this->Sendmail)); - } - } - if ($this->SingleTo === true) { - foreach ($this->SingleToArray as $toAddr) { - if (!@$mail = popen($sendmail, 'w')) { - throw new phpmailerException($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL); - } - fputs($mail, 'To: ' . $toAddr . "\n"); - fputs($mail, $header); - fputs($mail, $body); - $result = pclose($mail); - $this->doCallback( - ($result == 0), - array($toAddr), - $this->cc, - $this->bcc, - $this->Subject, - $body, - $this->From - ); - if ($result != 0) { - throw new phpmailerException($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL); - } - } - } else { - if (!@$mail = popen($sendmail, 'w')) { - throw new phpmailerException($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL); - } - fputs($mail, $header); - fputs($mail, $body); - $result = pclose($mail); - $this->doCallback(($result == 0), $this->to, $this->cc, $this->bcc, $this->Subject, $body, $this->From); - if ($result != 0) { - throw new phpmailerException($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL); - } - } - return true; - } - - /** - * Send mail using the PHP mail() function. - * @param string $header The message headers - * @param string $body The message body - * @link http://www.php.net/manual/en/book.mail.php - * @throws phpmailerException - * @access protected - * @return boolean - */ - protected function mailSend($header, $body) - { - $toArr = array(); - foreach ($this->to as $toaddr) { - $toArr[] = $this->addrFormat($toaddr); - } - $to = implode(', ', $toArr); - - if (empty($this->Sender)) { - $params = ' '; - } else { - $params = sprintf('-f%s', $this->Sender); - } - if ($this->Sender != '' and !ini_get('safe_mode')) { - $old_from = ini_get('sendmail_from'); - ini_set('sendmail_from', $this->Sender); - } - $result = false; - if ($this->SingleTo === true && count($toArr) > 1) { - foreach ($toArr as $toAddr) { - $result = $this->mailPassthru($toAddr, $this->Subject, $body, $header, $params); - $this->doCallback($result, array($toAddr), $this->cc, $this->bcc, $this->Subject, $body, $this->From); - } - } else { - $result = $this->mailPassthru($to, $this->Subject, $body, $header, $params); - $this->doCallback($result, $this->to, $this->cc, $this->bcc, $this->Subject, $body, $this->From); - } - if (isset($old_from)) { - ini_set('sendmail_from', $old_from); - } - if (!$result) { - throw new phpmailerException($this->lang('instantiate'), self::STOP_CRITICAL); - } - return true; - } - - /** - * Get an instance to use for SMTP operations. - * Override this function to load your own SMTP implementation - * @return SMTP - */ - public function getSMTPInstance() - { - if (!is_object($this->smtp)) { - $this->smtp = new SMTP; - } - return $this->smtp; - } - - /** - * Send mail via SMTP. - * Returns false if there is a bad MAIL FROM, RCPT, or DATA input. - * Uses the PHPMailerSMTP class by default. - * @see PHPMailer::getSMTPInstance() to use a different class. - * @param string $header The message headers - * @param string $body The message body - * @throws phpmailerException - * @uses SMTP - * @access protected - * @return boolean - */ - protected function smtpSend($header, $body) - { - $bad_rcpt = array(); - - if (!$this->smtpConnect()) { - throw new phpmailerException($this->lang('smtp_connect_failed'), self::STOP_CRITICAL); - } - $smtp_from = ($this->Sender == '') ? $this->From : $this->Sender; - if (!$this->smtp->mail($smtp_from)) { - $this->setError($this->lang('from_failed') . $smtp_from . ' : ' . implode(',', $this->smtp->getError())); - throw new phpmailerException($this->ErrorInfo, self::STOP_CRITICAL); - } - - // Attempt to send to all recipients - foreach ($this->to as $to) { - if (!$this->smtp->recipient($to[0])) { - $bad_rcpt[] = $to[0]; - $isSent = false; - } else { - $isSent = true; - } - $this->doCallback($isSent, array($to[0]), array(), array(), $this->Subject, $body, $this->From); - } - foreach ($this->cc as $cc) { - if (!$this->smtp->recipient($cc[0])) { - $bad_rcpt[] = $cc[0]; - $isSent = false; - } else { - $isSent = true; - } - $this->doCallback($isSent, array(), array($cc[0]), array(), $this->Subject, $body, $this->From); - } - foreach ($this->bcc as $bcc) { - if (!$this->smtp->recipient($bcc[0])) { - $bad_rcpt[] = $bcc[0]; - $isSent = false; - } else { - $isSent = true; - } - $this->doCallback($isSent, array(), array(), array($bcc[0]), $this->Subject, $body, $this->From); - } - - // Only send the DATA command if we have viable recipients - if ((count($this->all_recipients) > count($bad_rcpt)) and !$this->smtp->data($header . $body)) { - throw new phpmailerException($this->lang('data_not_accepted'), self::STOP_CRITICAL); - } - if ($this->SMTPKeepAlive == true) { - $this->smtp->reset(); - } else { - $this->smtp->quit(); - $this->smtp->close(); - } - if (count($bad_rcpt) > 0) { // Create error message for any bad addresses - throw new phpmailerException( - $this->lang('recipients_failed') . implode(', ', $bad_rcpt), - self::STOP_CONTINUE - ); - } - return true; - } - - /** - * Initiate a connection to an SMTP server. - * Returns false if the operation failed. - * @param array $options An array of options compatible with stream_context_create() - * @uses SMTP - * @access public - * @throws phpmailerException - * @return boolean - */ - public function smtpConnect($options = array()) - { - if (is_null($this->smtp)) { - $this->smtp = $this->getSMTPInstance(); - } - - // Already connected? - if ($this->smtp->connected()) { - return true; - } - - $this->smtp->setTimeout($this->Timeout); - $this->smtp->setDebugLevel($this->SMTPDebug); - $this->smtp->setDebugOutput($this->Debugoutput); - $this->smtp->setVerp($this->do_verp); - $hosts = explode(';', $this->Host); - $lastexception = null; - - foreach ($hosts as $hostentry) { - $hostinfo = array(); - if (!preg_match('/^((ssl|tls):\/\/)*([a-zA-Z0-9\.-]*):?([0-9]*)$/', trim($hostentry), $hostinfo)) { - // Not a valid host entry - continue; - } - // $hostinfo[2]: optional ssl or tls prefix - // $hostinfo[3]: the hostname - // $hostinfo[4]: optional port number - // The host string prefix can temporarily override the current setting for SMTPSecure - // If it's not specified, the default value is used - $prefix = ''; - $tls = ($this->SMTPSecure == 'tls'); - if ($hostinfo[2] == 'ssl' or ($hostinfo[2] == '' and $this->SMTPSecure == 'ssl')) { - $prefix = 'ssl://'; - $tls = false; // Can't have SSL and TLS at once - } elseif ($hostinfo[2] == 'tls') { - $tls = true; - // tls doesn't use a prefix - } - $host = $hostinfo[3]; - $port = $this->Port; - $tport = (integer)$hostinfo[4]; - if ($tport > 0 and $tport < 65536) { - $port = $tport; - } - if ($this->smtp->connect($prefix . $host, $port, $this->Timeout, $options)) { - try { - if ($this->Helo) { - $hello = $this->Helo; - } else { - $hello = $this->serverHostname(); - } - $this->smtp->hello($hello); - - if ($tls) { - if (!$this->smtp->startTLS()) { - throw new phpmailerException($this->lang('connect_host')); - } - // We must resend HELO after tls negotiation - $this->smtp->hello($hello); - } - if ($this->SMTPAuth) { - if (!$this->smtp->authenticate( - $this->Username, - $this->Password, - $this->AuthType, - $this->Realm, - $this->Workstation - ) - ) { - throw new phpmailerException($this->lang('authenticate')); - } - } - return true; - } catch (phpmailerException $exc) { - $lastexception = $exc; - // We must have connected, but then failed TLS or Auth, so close connection nicely - $this->smtp->quit(); - } - } - } - // If we get here, all connection attempts have failed, so close connection hard - $this->smtp->close(); - // As we've caught all exceptions, just report whatever the last one was - if ($this->exceptions and !is_null($lastexception)) { - throw $lastexception; - } - return false; - } - - /** - * Close the active SMTP session if one exists. - * @return void - */ - public function smtpClose() - { - if ($this->smtp !== null) { - if ($this->smtp->connected()) { - $this->smtp->quit(); - $this->smtp->close(); - } - } - } - - /** - * Set the language for error messages. - * Returns false if it cannot load the language file. - * The default language is English. - * @param string $langcode ISO 639-1 2-character language code (e.g. French is "fr") - * @param string $lang_path Path to the language file directory, with trailing separator (slash) - * @return boolean - * @access public - */ - public function setLanguage($langcode = 'en', $lang_path = '') - { - // Define full set of translatable strings in English - $PHPMAILER_LANG = array( - 'authenticate' => 'SMTP Error: Could not authenticate.', - 'connect_host' => 'SMTP Error: Could not connect to SMTP host.', - 'data_not_accepted' => 'SMTP Error: data not accepted.', - 'empty_message' => 'Message body empty', - 'encoding' => 'Unknown encoding: ', - 'execute' => 'Could not execute: ', - 'file_access' => 'Could not access file: ', - 'file_open' => 'File Error: Could not open file: ', - 'from_failed' => 'The following From address failed: ', - 'instantiate' => 'Could not instantiate mail function.', - 'invalid_address' => 'Invalid address', - 'mailer_not_supported' => ' mailer is not supported.', - 'provide_address' => 'You must provide at least one recipient email address.', - 'recipients_failed' => 'SMTP Error: The following recipients failed: ', - 'signing' => 'Signing Error: ', - 'smtp_connect_failed' => 'SMTP connect() failed.', - 'smtp_error' => 'SMTP server error: ', - 'variable_set' => 'Cannot set or reset variable: ' - ); - if (empty($lang_path)) { - // Calculate an absolute path so it can work if CWD is not here - $lang_path = dirname(__FILE__). DIRECTORY_SEPARATOR . 'language'. DIRECTORY_SEPARATOR; - } - $foundlang = true; - $lang_file = $lang_path . 'phpmailer.lang-' . $langcode . '.php'; - if ($langcode != 'en') { // There is no English translation file - // Make sure language file path is readable - if (!is_readable($lang_file)) { - $foundlang = false; - } else { - // Overwrite language-specific strings. - // This way we'll never have missing translations. - $foundlang = include $lang_file; - } - } - $this->language = $PHPMAILER_LANG; - return ($foundlang == true); // Returns false if language not found - } - - /** - * Get the array of strings for the current language. - * @return array - */ - public function getTranslations() - { - return $this->language; - } - - /** - * Create recipient headers. - * @access public - * @param string $type - * @param array $addr An array of recipient, - * where each recipient is a 2-element indexed array with element 0 containing an address - * and element 1 containing a name, like: - * array(array('joe@example.com', 'Joe User'), array('zoe@example.com', 'Zoe User')) - * @return string - */ - public function addrAppend($type, $addr) - { - $addresses = array(); - foreach ($addr as $address) { - $addresses[] = $this->addrFormat($address); - } - return $type . ': ' . implode(', ', $addresses) . $this->LE; - } - - /** - * Format an address for use in a message header. - * @access public - * @param array $addr A 2-element indexed array, element 0 containing an address, element 1 containing a name - * like array('joe@example.com', 'Joe User') - * @return string - */ - public function addrFormat($addr) - { - if (empty($addr[1])) { // No name provided - return $this->secureHeader($addr[0]); - } else { - return $this->encodeHeader($this->secureHeader($addr[1]), 'phrase') . ' <' . $this->secureHeader( - $addr[0] - ) . '>'; - } - } - - /** - * Word-wrap message. - * For use with mailers that do not automatically perform wrapping - * and for quoted-printable encoded messages. - * Original written by philippe. - * @param string $message The message to wrap - * @param integer $length The line length to wrap to - * @param boolean $qp_mode Whether to run in Quoted-Printable mode - * @access public - * @return string - */ - public function wrapText($message, $length, $qp_mode = false) - { - $soft_break = ($qp_mode) ? sprintf(' =%s', $this->LE) : $this->LE; - // If utf-8 encoding is used, we will need to make sure we don't - // split multibyte characters when we wrap - $is_utf8 = (strtolower($this->CharSet) == 'utf-8'); - $lelen = strlen($this->LE); - $crlflen = strlen(self::CRLF); - - $message = $this->fixEOL($message); - if (substr($message, -$lelen) == $this->LE) { - $message = substr($message, 0, -$lelen); - } - - $line = explode($this->LE, $message); // Magic. We know fixEOL uses $LE - $message = ''; - for ($i = 0; $i < count($line); $i++) { - $line_part = explode(' ', $line[$i]); - $buf = ''; - for ($e = 0; $e < count($line_part); $e++) { - $word = $line_part[$e]; - if ($qp_mode and (strlen($word) > $length)) { - $space_left = $length - strlen($buf) - $crlflen; - if ($e != 0) { - if ($space_left > 20) { - $len = $space_left; - if ($is_utf8) { - $len = $this->utf8CharBoundary($word, $len); - } elseif (substr($word, $len - 1, 1) == '=') { - $len--; - } elseif (substr($word, $len - 2, 1) == '=') { - $len -= 2; - } - $part = substr($word, 0, $len); - $word = substr($word, $len); - $buf .= ' ' . $part; - $message .= $buf . sprintf('=%s', self::CRLF); - } else { - $message .= $buf . $soft_break; - } - $buf = ''; - } - while (strlen($word) > 0) { - if ($length <= 0) { - break; - } - $len = $length; - if ($is_utf8) { - $len = $this->utf8CharBoundary($word, $len); - } elseif (substr($word, $len - 1, 1) == '=') { - $len--; - } elseif (substr($word, $len - 2, 1) == '=') { - $len -= 2; - } - $part = substr($word, 0, $len); - $word = substr($word, $len); - - if (strlen($word) > 0) { - $message .= $part . sprintf('=%s', self::CRLF); - } else { - $buf = $part; - } - } - } else { - $buf_o = $buf; - $buf .= ($e == 0) ? $word : (' ' . $word); - - if (strlen($buf) > $length and $buf_o != '') { - $message .= $buf_o . $soft_break; - $buf = $word; - } - } - } - $message .= $buf . self::CRLF; - } - - return $message; - } - - /** - * Find the last character boundary prior to $maxLength in a utf-8 - * quoted (printable) encoded string. - * Original written by Colin Brown. - * @access public - * @param string $encodedText utf-8 QP text - * @param integer $maxLength find last character boundary prior to this length - * @return integer - */ - public function utf8CharBoundary($encodedText, $maxLength) - { - $foundSplitPos = false; - $lookBack = 3; - while (!$foundSplitPos) { - $lastChunk = substr($encodedText, $maxLength - $lookBack, $lookBack); - $encodedCharPos = strpos($lastChunk, '='); - if ($encodedCharPos !== false) { - // Found start of encoded character byte within $lookBack block. - // Check the encoded byte value (the 2 chars after the '=') - $hex = substr($encodedText, $maxLength - $lookBack + $encodedCharPos + 1, 2); - $dec = hexdec($hex); - if ($dec < 128) { // Single byte character. - // If the encoded char was found at pos 0, it will fit - // otherwise reduce maxLength to start of the encoded char - $maxLength = ($encodedCharPos == 0) ? $maxLength : - $maxLength - ($lookBack - $encodedCharPos); - $foundSplitPos = true; - } elseif ($dec >= 192) { // First byte of a multi byte character - // Reduce maxLength to split at start of character - $maxLength = $maxLength - ($lookBack - $encodedCharPos); - $foundSplitPos = true; - } elseif ($dec < 192) { // Middle byte of a multi byte character, look further back - $lookBack += 3; - } - } else { - // No encoded character found - $foundSplitPos = true; - } - } - return $maxLength; - } - - /** - * Set the body wrapping. - * @access public - * @return void - */ - public function setWordWrap() - { - if ($this->WordWrap < 1) { - return; - } - - switch ($this->message_type) { - case 'alt': - case 'alt_inline': - case 'alt_attach': - case 'alt_inline_attach': - $this->AltBody = $this->wrapText($this->AltBody, $this->WordWrap); - break; - default: - $this->Body = $this->wrapText($this->Body, $this->WordWrap); - break; - } - } - - /** - * Assemble message headers. - * @access public - * @return string The assembled headers - */ - public function createHeader() - { - $result = ''; - - // Set the boundaries - $uniq_id = md5(uniqid(time())); - $this->boundary[1] = 'b1_' . $uniq_id; - $this->boundary[2] = 'b2_' . $uniq_id; - $this->boundary[3] = 'b3_' . $uniq_id; - - if ($this->MessageDate == '') { - $this->MessageDate = self::rfcDate(); - } - $result .= $this->headerLine('Date', $this->MessageDate); - - - // To be created automatically by mail() - if ($this->SingleTo === true) { - if ($this->Mailer != 'mail') { - foreach ($this->to as $toaddr) { - $this->SingleToArray[] = $this->addrFormat($toaddr); - } - } - } else { - if (count($this->to) > 0) { - if ($this->Mailer != 'mail') { - $result .= $this->addrAppend('To', $this->to); - } - } elseif (count($this->cc) == 0) { - $result .= $this->headerLine('To', 'undisclosed-recipients:;'); - } - } - - $result .= $this->addrAppend('From', array(array(trim($this->From), $this->FromName))); - - // sendmail and mail() extract Cc from the header before sending - if (count($this->cc) > 0) { - $result .= $this->addrAppend('Cc', $this->cc); - } - - // sendmail and mail() extract Bcc from the header before sending - if (( - $this->Mailer == 'sendmail' or $this->Mailer == 'qmail' or $this->Mailer == 'mail' - ) - and count($this->bcc) > 0 - ) { - $result .= $this->addrAppend('Bcc', $this->bcc); - } - - if (count($this->ReplyTo) > 0) { - $result .= $this->addrAppend('Reply-To', $this->ReplyTo); - } - - // mail() sets the subject itself - if ($this->Mailer != 'mail') { - $result .= $this->headerLine('Subject', $this->encodeHeader($this->secureHeader($this->Subject))); - } - - if ($this->MessageID != '') { - $this->lastMessageID = $this->MessageID; - } else { - $this->lastMessageID = sprintf('<%s@%s>', $uniq_id, $this->ServerHostname()); - } - $result .= $this->HeaderLine('Message-ID', $this->lastMessageID); - $result .= $this->headerLine('X-Priority', $this->Priority); - if ($this->XMailer == '') { - $result .= $this->headerLine( - 'X-Mailer', - 'PHPMailer ' . $this->Version . ' (https://github.com/PHPMailer/PHPMailer/)' - ); - } else { - $myXmailer = trim($this->XMailer); - if ($myXmailer) { - $result .= $this->headerLine('X-Mailer', $myXmailer); - } - } - - if ($this->ConfirmReadingTo != '') { - $result .= $this->headerLine('Disposition-Notification-To', '<' . trim($this->ConfirmReadingTo) . '>'); - } - - // Add custom headers - for ($index = 0; $index < count($this->CustomHeader); $index++) { - $result .= $this->headerLine( - trim($this->CustomHeader[$index][0]), - $this->encodeHeader(trim($this->CustomHeader[$index][1])) - ); - } - if (!$this->sign_key_file) { - $result .= $this->headerLine('MIME-Version', '1.0'); - $result .= $this->getMailMIME(); - } - - return $result; - } - - /** - * Get the message MIME type headers. - * @access public - * @return string - */ - public function getMailMIME() - { - $result = ''; - $ismultipart = true; - switch ($this->message_type) { - case 'inline': - $result .= $this->headerLine('Content-Type', 'multipart/related;'); - $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"'); - break; - case 'attach': - case 'inline_attach': - case 'alt_attach': - case 'alt_inline_attach': - $result .= $this->headerLine('Content-Type', 'multipart/mixed;'); - $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"'); - break; - case 'alt': - case 'alt_inline': - $result .= $this->headerLine('Content-Type', 'multipart/alternative;'); - $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"'); - break; - default: - // Catches case 'plain': and case '': - $result .= $this->textLine('Content-Type: ' . $this->ContentType . '; charset=' . $this->CharSet); - $ismultipart = false; - break; - } - // RFC1341 part 5 says 7bit is assumed if not specified - if ($this->Encoding != '7bit') { - // RFC 2045 section 6.4 says multipart MIME parts may only use 7bit, 8bit or binary CTE - if ($ismultipart) { - if ($this->Encoding == '8bit') { - $result .= $this->headerLine('Content-Transfer-Encoding', '8bit'); - } - // The only remaining alternatives are quoted-printable and base64, which are both 7bit compatible - } else { - $result .= $this->headerLine('Content-Transfer-Encoding', $this->Encoding); - } - } - - if ($this->Mailer != 'mail') { - $result .= $this->LE; - } - - return $result; - } - - /** - * Returns the whole MIME message. - * Includes complete headers and body. - * Only valid post preSend(). - * @see PHPMailer::preSend() - * @access public - * @return string - */ - public function getSentMIMEMessage() - { - return $this->MIMEHeader . $this->mailHeader . self::CRLF . $this->MIMEBody; - } - - - /** - * Assemble the message body. - * Returns an empty string on failure. - * @access public - * @throws phpmailerException - * @return string The assembled message body - */ - public function createBody() - { - $body = ''; - - if ($this->sign_key_file) { - $body .= $this->getMailMIME() . $this->LE; - } - - $this->setWordWrap(); - - $bodyEncoding = $this->Encoding; - $bodyCharSet = $this->CharSet; - if ($bodyEncoding == '8bit' and !$this->has8bitChars($this->Body)) { - $bodyEncoding = '7bit'; - $bodyCharSet = 'us-ascii'; - } - $altBodyEncoding = $this->Encoding; - $altBodyCharSet = $this->CharSet; - if ($altBodyEncoding == '8bit' and !$this->has8bitChars($this->AltBody)) { - $altBodyEncoding = '7bit'; - $altBodyCharSet = 'us-ascii'; - } - switch ($this->message_type) { - case 'inline': - $body .= $this->getBoundary($this->boundary[1], $bodyCharSet, '', $bodyEncoding); - $body .= $this->encodeString($this->Body, $bodyEncoding); - $body .= $this->LE . $this->LE; - $body .= $this->attachAll('inline', $this->boundary[1]); - break; - case 'attach': - $body .= $this->getBoundary($this->boundary[1], $bodyCharSet, '', $bodyEncoding); - $body .= $this->encodeString($this->Body, $bodyEncoding); - $body .= $this->LE . $this->LE; - $body .= $this->attachAll('attachment', $this->boundary[1]); - break; - case 'inline_attach': - $body .= $this->textLine('--' . $this->boundary[1]); - $body .= $this->headerLine('Content-Type', 'multipart/related;'); - $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"'); - $body .= $this->LE; - $body .= $this->getBoundary($this->boundary[2], $bodyCharSet, '', $bodyEncoding); - $body .= $this->encodeString($this->Body, $bodyEncoding); - $body .= $this->LE . $this->LE; - $body .= $this->attachAll('inline', $this->boundary[2]); - $body .= $this->LE; - $body .= $this->attachAll('attachment', $this->boundary[1]); - break; - case 'alt': - $body .= $this->getBoundary($this->boundary[1], $altBodyCharSet, 'text/plain', $altBodyEncoding); - $body .= $this->encodeString($this->AltBody, $altBodyEncoding); - $body .= $this->LE . $this->LE; - $body .= $this->getBoundary($this->boundary[1], $bodyCharSet, 'text/html', $bodyEncoding); - $body .= $this->encodeString($this->Body, $bodyEncoding); - $body .= $this->LE . $this->LE; - if (!empty($this->Ical)) { - $body .= $this->getBoundary($this->boundary[1], '', 'text/calendar; method=REQUEST', ''); - $body .= $this->encodeString($this->Ical, $this->Encoding); - $body .= $this->LE . $this->LE; - } - $body .= $this->endBoundary($this->boundary[1]); - break; - case 'alt_inline': - $body .= $this->getBoundary($this->boundary[1], $altBodyCharSet, 'text/plain', $altBodyEncoding); - $body .= $this->encodeString($this->AltBody, $altBodyEncoding); - $body .= $this->LE . $this->LE; - $body .= $this->textLine('--' . $this->boundary[1]); - $body .= $this->headerLine('Content-Type', 'multipart/related;'); - $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"'); - $body .= $this->LE; - $body .= $this->getBoundary($this->boundary[2], $bodyCharSet, 'text/html', $bodyEncoding); - $body .= $this->encodeString($this->Body, $bodyEncoding); - $body .= $this->LE . $this->LE; - $body .= $this->attachAll('inline', $this->boundary[2]); - $body .= $this->LE; - $body .= $this->endBoundary($this->boundary[1]); - break; - case 'alt_attach': - $body .= $this->textLine('--' . $this->boundary[1]); - $body .= $this->headerLine('Content-Type', 'multipart/alternative;'); - $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"'); - $body .= $this->LE; - $body .= $this->getBoundary($this->boundary[2], $altBodyCharSet, 'text/plain', $altBodyEncoding); - $body .= $this->encodeString($this->AltBody, $altBodyEncoding); - $body .= $this->LE . $this->LE; - $body .= $this->getBoundary($this->boundary[2], $bodyCharSet, 'text/html', $bodyEncoding); - $body .= $this->encodeString($this->Body, $bodyEncoding); - $body .= $this->LE . $this->LE; - $body .= $this->endBoundary($this->boundary[2]); - $body .= $this->LE; - $body .= $this->attachAll('attachment', $this->boundary[1]); - break; - case 'alt_inline_attach': - $body .= $this->textLine('--' . $this->boundary[1]); - $body .= $this->headerLine('Content-Type', 'multipart/alternative;'); - $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"'); - $body .= $this->LE; - $body .= $this->getBoundary($this->boundary[2], $altBodyCharSet, 'text/plain', $altBodyEncoding); - $body .= $this->encodeString($this->AltBody, $altBodyEncoding); - $body .= $this->LE . $this->LE; - $body .= $this->textLine('--' . $this->boundary[2]); - $body .= $this->headerLine('Content-Type', 'multipart/related;'); - $body .= $this->textLine("\tboundary=\"" . $this->boundary[3] . '"'); - $body .= $this->LE; - $body .= $this->getBoundary($this->boundary[3], $bodyCharSet, 'text/html', $bodyEncoding); - $body .= $this->encodeString($this->Body, $bodyEncoding); - $body .= $this->LE . $this->LE; - $body .= $this->attachAll('inline', $this->boundary[3]); - $body .= $this->LE; - $body .= $this->endBoundary($this->boundary[2]); - $body .= $this->LE; - $body .= $this->attachAll('attachment', $this->boundary[1]); - break; - default: - // catch case 'plain' and case '' - $body .= $this->encodeString($this->Body, $bodyEncoding); - break; - } - - if ($this->isError()) { - $body = ''; - } elseif ($this->sign_key_file) { - try { - if (!defined('PKCS7_TEXT')) { - throw new phpmailerException($this->lang('signing') . ' OpenSSL extension missing.'); - } - // @TODO would be nice to use php://temp streams here, but need to wrap for PHP < 5.1 - $file = tempnam(sys_get_temp_dir(), 'mail'); - file_put_contents($file, $body); // @TODO check this worked - $signed = tempnam(sys_get_temp_dir(), 'signed'); - if (@openssl_pkcs7_sign( - $file, - $signed, - 'file://' . realpath($this->sign_cert_file), - array('file://' . realpath($this->sign_key_file), $this->sign_key_pass), - null - ) - ) { - @unlink($file); - $body = file_get_contents($signed); - @unlink($signed); - } else { - @unlink($file); - @unlink($signed); - throw new phpmailerException($this->lang('signing') . openssl_error_string()); - } - } catch (phpmailerException $exc) { - $body = ''; - if ($this->exceptions) { - throw $exc; - } - } - } - return $body; - } - - /** - * Return the start of a message boundary. - * @access protected - * @param string $boundary - * @param string $charSet - * @param string $contentType - * @param string $encoding - * @return string - */ - protected function getBoundary($boundary, $charSet, $contentType, $encoding) - { - $result = ''; - if ($charSet == '') { - $charSet = $this->CharSet; - } - if ($contentType == '') { - $contentType = $this->ContentType; - } - if ($encoding == '') { - $encoding = $this->Encoding; - } - $result .= $this->textLine('--' . $boundary); - $result .= sprintf('Content-Type: %s; charset=%s', $contentType, $charSet); - $result .= $this->LE; - // RFC1341 part 5 says 7bit is assumed if not specified - if ($encoding != '7bit') { - $result .= $this->headerLine('Content-Transfer-Encoding', $encoding); - } - $result .= $this->LE; - - return $result; - } - - /** - * Return the end of a message boundary. - * @access protected - * @param string $boundary - * @return string - */ - protected function endBoundary($boundary) - { - return $this->LE . '--' . $boundary . '--' . $this->LE; - } - - /** - * Set the message type. - * PHPMailer only supports some preset message types, - * not arbitrary MIME structures. - * @access protected - * @return void - */ - protected function setMessageType() - { - $type = array(); - if ($this->alternativeExists()) { - $type[] = 'alt'; - } - if ($this->inlineImageExists()) { - $type[] = 'inline'; - } - if ($this->attachmentExists()) { - $type[] = 'attach'; - } - $this->message_type = implode('_', $type); - if ($this->message_type == '') { - $this->message_type = 'plain'; - } - } - - /** - * Format a header line. - * @access public - * @param string $name - * @param string $value - * @return string - */ - public function headerLine($name, $value) - { - return $name . ': ' . $value . $this->LE; - } - - /** - * Return a formatted mail line. - * @access public - * @param string $value - * @return string - */ - public function textLine($value) - { - return $value . $this->LE; - } - - /** - * Add an attachment from a path on the filesystem. - * Returns false if the file could not be found or read. - * @param string $path Path to the attachment. - * @param string $name Overrides the attachment name. - * @param string $encoding File encoding (see $Encoding). - * @param string $type File extension (MIME) type. - * @param string $disposition Disposition to use - * @throws phpmailerException - * @return boolean - */ - public function addAttachment($path, $name = '', $encoding = 'base64', $type = '', $disposition = 'attachment') - { - try { - if (!@is_file($path)) { - throw new phpmailerException($this->lang('file_access') . $path, self::STOP_CONTINUE); - } - - // If a MIME type is not specified, try to work it out from the file name - if ($type == '') { - $type = self::filenameToType($path); - } - - $filename = basename($path); - if ($name == '') { - $name = $filename; - } - - $this->attachment[] = array( - 0 => $path, - 1 => $filename, - 2 => $name, - 3 => $encoding, - 4 => $type, - 5 => false, // isStringAttachment - 6 => $disposition, - 7 => 0 - ); - - } catch (phpmailerException $exc) { - $this->setError($exc->getMessage()); - $this->edebug($exc->getMessage()); - if ($this->exceptions) { - throw $exc; - } - return false; - } - return true; - } - - /** - * Return the array of attachments. - * @return array - */ - public function getAttachments() - { - return $this->attachment; - } - - /** - * Attach all file, string, and binary attachments to the message. - * Returns an empty string on failure. - * @access protected - * @param string $disposition_type - * @param string $boundary - * @return string - */ - protected function attachAll($disposition_type, $boundary) - { - // Return text of body - $mime = array(); - $cidUniq = array(); - $incl = array(); - - // Add all attachments - foreach ($this->attachment as $attachment) { - // Check if it is a valid disposition_filter - if ($attachment[6] == $disposition_type) { - // Check for string attachment - $string = ''; - $path = ''; - $bString = $attachment[5]; - if ($bString) { - $string = $attachment[0]; - } else { - $path = $attachment[0]; - } - - $inclhash = md5(serialize($attachment)); - if (in_array($inclhash, $incl)) { - continue; - } - $incl[] = $inclhash; - $name = $attachment[2]; - $encoding = $attachment[3]; - $type = $attachment[4]; - $disposition = $attachment[6]; - $cid = $attachment[7]; - if ($disposition == 'inline' && isset($cidUniq[$cid])) { - continue; - } - $cidUniq[$cid] = true; - - $mime[] = sprintf('--%s%s', $boundary, $this->LE); - $mime[] = sprintf( - 'Content-Type: %s; name="%s"%s', - $type, - $this->encodeHeader($this->secureHeader($name)), - $this->LE - ); - // RFC1341 part 5 says 7bit is assumed if not specified - if ($encoding != '7bit') { - $mime[] = sprintf('Content-Transfer-Encoding: %s%s', $encoding, $this->LE); - } - - if ($disposition == 'inline') { - $mime[] = sprintf('Content-ID: <%s>%s', $cid, $this->LE); - } - - // If a filename contains any of these chars, it should be quoted, - // but not otherwise: RFC2183 & RFC2045 5.1 - // Fixes a warning in IETF's msglint MIME checker - // Allow for bypassing the Content-Disposition header totally - if (!(empty($disposition))) { - $encoded_name = $this->encodeHeader($this->secureHeader($name)); - if (preg_match('/[ \(\)<>@,;:\\"\/\[\]\?=]/', $encoded_name)) { - $mime[] = sprintf( - 'Content-Disposition: %s; filename="%s"%s', - $disposition, - $encoded_name, - $this->LE . $this->LE - ); - } else { - $mime[] = sprintf( - 'Content-Disposition: %s; filename=%s%s', - $disposition, - $encoded_name, - $this->LE . $this->LE - ); - } - } else { - $mime[] = $this->LE; - } - - // Encode as string attachment - if ($bString) { - $mime[] = $this->encodeString($string, $encoding); - if ($this->isError()) { - return ''; - } - $mime[] = $this->LE . $this->LE; - } else { - $mime[] = $this->encodeFile($path, $encoding); - if ($this->isError()) { - return ''; - } - $mime[] = $this->LE . $this->LE; - } - } - } - - $mime[] = sprintf('--%s--%s', $boundary, $this->LE); - - return implode('', $mime); - } - - /** - * Encode a file attachment in requested format. - * Returns an empty string on failure. - * @param string $path The full path to the file - * @param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable' - * @throws phpmailerException - * @see EncodeFile(encodeFile - * @access protected - * @return string - */ - protected function encodeFile($path, $encoding = 'base64') - { - try { - if (!is_readable($path)) { - throw new phpmailerException($this->lang('file_open') . $path, self::STOP_CONTINUE); - } - $magic_quotes = get_magic_quotes_runtime(); - if ($magic_quotes) { - if (version_compare(PHP_VERSION, '5.3.0', '<')) { - set_magic_quotes_runtime(false); - } else { - //Doesn't exist in PHP 5.4, but we don't need to check because - //get_magic_quotes_runtime always returns false in 5.4+ - //so it will never get here - ini_set('magic_quotes_runtime', 0); - } - } - $file_buffer = file_get_contents($path); - $file_buffer = $this->encodeString($file_buffer, $encoding); - if ($magic_quotes) { - if (version_compare(PHP_VERSION, '5.3.0', '<')) { - set_magic_quotes_runtime($magic_quotes); - } else { - ini_set('magic_quotes_runtime', ($magic_quotes?'1':'0')); - } - } - return $file_buffer; - } catch (Exception $exc) { - $this->setError($exc->getMessage()); - return ''; - } - } - - /** - * Encode a string in requested format. - * Returns an empty string on failure. - * @param string $str The text to encode - * @param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable' - * @access public - * @return string - */ - public function encodeString($str, $encoding = 'base64') - { - $encoded = ''; - switch (strtolower($encoding)) { - case 'base64': - $encoded = chunk_split(base64_encode($str), 76, $this->LE); - break; - case '7bit': - case '8bit': - $encoded = $this->fixEOL($str); - // Make sure it ends with a line break - if (substr($encoded, -(strlen($this->LE))) != $this->LE) { - $encoded .= $this->LE; - } - break; - case 'binary': - $encoded = $str; - break; - case 'quoted-printable': - $encoded = $this->encodeQP($str); - break; - default: - $this->setError($this->lang('encoding') . $encoding); - break; - } - return $encoded; - } - - /** - * Encode a header string optimally. - * Picks shortest of Q, B, quoted-printable or none. - * @access public - * @param string $str - * @param string $position - * @return string - */ - public function encodeHeader($str, $position = 'text') - { - $matchcount = 0; - switch (strtolower($position)) { - case 'phrase': - if (!preg_match('/[\200-\377]/', $str)) { - // Can't use addslashes as we don't know the value of magic_quotes_sybase - $encoded = addcslashes($str, "\0..\37\177\\\""); - if (($str == $encoded) && !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str)) { - return ($encoded); - } else { - return ("\"$encoded\""); - } - } - $matchcount = preg_match_all('/[^\040\041\043-\133\135-\176]/', $str, $matches); - break; - /** @noinspection PhpMissingBreakStatementInspection */ - case 'comment': - $matchcount = preg_match_all('/[()"]/', $str, $matches); - // Intentional fall-through - case 'text': - default: - $matchcount += preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/', $str, $matches); - break; - } - - if ($matchcount == 0) { // There are no chars that need encoding - return ($str); - } - - $maxlen = 75 - 7 - strlen($this->CharSet); - // Try to select the encoding which should produce the shortest output - if ($matchcount > strlen($str) / 3) { - // More than a third of the content will need encoding, so B encoding will be most efficient - $encoding = 'B'; - if (function_exists('mb_strlen') && $this->hasMultiBytes($str)) { - // Use a custom function which correctly encodes and wraps long - // multibyte strings without breaking lines within a character - $encoded = $this->base64EncodeWrapMB($str, "\n"); - } else { - $encoded = base64_encode($str); - $maxlen -= $maxlen % 4; - $encoded = trim(chunk_split($encoded, $maxlen, "\n")); - } - } else { - $encoding = 'Q'; - $encoded = $this->encodeQ($str, $position); - $encoded = $this->wrapText($encoded, $maxlen, true); - $encoded = str_replace('=' . self::CRLF, "\n", trim($encoded)); - } - - $encoded = preg_replace('/^(.*)$/m', ' =?' . $this->CharSet . "?$encoding?\\1?=", $encoded); - $encoded = trim(str_replace("\n", $this->LE, $encoded)); - - return $encoded; - } - - /** - * Check if a string contains multi-byte characters. - * @access public - * @param string $str multi-byte text to wrap encode - * @return boolean - */ - public function hasMultiBytes($str) - { - if (function_exists('mb_strlen')) { - return (strlen($str) > mb_strlen($str, $this->CharSet)); - } else { // Assume no multibytes (we can't handle without mbstring functions anyway) - return false; - } - } - - /** - * Does a string contain any 8-bit chars (in any charset)? - * @param string $text - * @return boolean - */ - public function has8bitChars($text) - { - return (boolean)preg_match('/[\x80-\xFF]/', $text); - } - - /** - * Encode and wrap long multibyte strings for mail headers - * without breaking lines within a character. - * Adapted from a function by paravoid - * @link http://www.php.net/manual/en/function.mb-encode-mimeheader.php#60283 - * @access public - * @param string $str multi-byte text to wrap encode - * @param string $linebreak string to use as linefeed/end-of-line - * @return string - */ - public function base64EncodeWrapMB($str, $linebreak = null) - { - $start = '=?' . $this->CharSet . '?B?'; - $end = '?='; - $encoded = ''; - if ($linebreak === null) { - $linebreak = $this->LE; - } - - $mb_length = mb_strlen($str, $this->CharSet); - // Each line must have length <= 75, including $start and $end - $length = 75 - strlen($start) - strlen($end); - // Average multi-byte ratio - $ratio = $mb_length / strlen($str); - // Base64 has a 4:3 ratio - $avgLength = floor($length * $ratio * .75); - - for ($i = 0; $i < $mb_length; $i += $offset) { - $lookBack = 0; - do { - $offset = $avgLength - $lookBack; - $chunk = mb_substr($str, $i, $offset, $this->CharSet); - $chunk = base64_encode($chunk); - $lookBack++; - } while (strlen($chunk) > $length); - $encoded .= $chunk . $linebreak; - } - - // Chomp the last linefeed - $encoded = substr($encoded, 0, -strlen($linebreak)); - return $encoded; - } - - /** - * Encode a string in quoted-printable format. - * According to RFC2045 section 6.7. - * @access public - * @param string $string The text to encode - * @param integer $line_max Number of chars allowed on a line before wrapping - * @return string - * @link http://www.php.net/manual/en/function.quoted-printable-decode.php#89417 Adapted from this comment - */ - public function encodeQP($string, $line_max = 76) - { - if (function_exists('quoted_printable_encode')) { // Use native function if it's available (>= PHP5.3) - return $this->fixEOL(quoted_printable_encode($string)); - } - // Fall back to a pure PHP implementation - $string = str_replace( - array('%20', '%0D%0A.', '%0D%0A', '%'), - array(' ', "\r\n=2E", "\r\n", '='), - rawurlencode($string) - ); - $string = preg_replace('/[^\r\n]{' . ($line_max - 3) . '}[^=\r\n]{2}/', "$0=\r\n", $string); - return $this->fixEOL($string); - } - - /** - * Backward compatibility wrapper for an old QP encoding function that was removed. - * @see PHPMailer::encodeQP() - * @access public - * @param string $string - * @param integer $line_max - * @param boolean $space_conv - * @return string - * @deprecated Use encodeQP instead. - */ - public function encodeQPphp( - $string, - $line_max = 76, - /** @noinspection PhpUnusedParameterInspection */ $space_conv = false - ) { - return $this->encodeQP($string, $line_max); - } - - /** - * Encode a string using Q encoding. - * @link http://tools.ietf.org/html/rfc2047 - * @param string $str the text to encode - * @param string $position Where the text is going to be used, see the RFC for what that means - * @access public - * @return string - */ - public function encodeQ($str, $position = 'text') - { - // There should not be any EOL in the string - $pattern = ''; - $encoded = str_replace(array("\r", "\n"), '', $str); - switch (strtolower($position)) { - case 'phrase': - // RFC 2047 section 5.3 - $pattern = '^A-Za-z0-9!*+\/ -'; - break; - /** @noinspection PhpMissingBreakStatementInspection */ - case 'comment': - // RFC 2047 section 5.2 - $pattern = '\(\)"'; - // intentional fall-through - // for this reason we build the $pattern without including delimiters and [] - case 'text': - default: - // RFC 2047 section 5.1 - // Replace every high ascii, control, =, ? and _ characters - $pattern = '\000-\011\013\014\016-\037\075\077\137\177-\377' . $pattern; - break; - } - $matches = array(); - if (preg_match_all("/[{$pattern}]/", $encoded, $matches)) { - // If the string contains an '=', make sure it's the first thing we replace - // so as to avoid double-encoding - $eqkey = array_search('=', $matches[0]); - if ($eqkey !== false) { - unset($matches[0][$eqkey]); - array_unshift($matches[0], '='); - } - foreach (array_unique($matches[0]) as $char) { - $encoded = str_replace($char, '=' . sprintf('%02X', ord($char)), $encoded); - } - } - // Replace every spaces to _ (more readable than =20) - return str_replace(' ', '_', $encoded); - } - - - /** - * Add a string or binary attachment (non-filesystem). - * This method can be used to attach ascii or binary data, - * such as a BLOB record from a database. - * @param string $string String attachment data. - * @param string $filename Name of the attachment. - * @param string $encoding File encoding (see $Encoding). - * @param string $type File extension (MIME) type. - * @param string $disposition Disposition to use - * @return void - */ - public function addStringAttachment( - $string, - $filename, - $encoding = 'base64', - $type = '', - $disposition = 'attachment' - ) { - // If a MIME type is not specified, try to work it out from the file name - if ($type == '') { - $type = self::filenameToType($filename); - } - // Append to $attachment array - $this->attachment[] = array( - 0 => $string, - 1 => $filename, - 2 => basename($filename), - 3 => $encoding, - 4 => $type, - 5 => true, // isStringAttachment - 6 => $disposition, - 7 => 0 - ); - } - - /** - * Add an embedded (inline) attachment from a file. - * This can include images, sounds, and just about any other document type. - * These differ from 'regular' attachmants in that they are intended to be - * displayed inline with the message, not just attached for download. - * This is used in HTML messages that embed the images - * the HTML refers to using the $cid value. - * @param string $path Path to the attachment. - * @param string $cid Content ID of the attachment; Use this to reference - * the content when using an embedded image in HTML. - * @param string $name Overrides the attachment name. - * @param string $encoding File encoding (see $Encoding). - * @param string $type File MIME type. - * @param string $disposition Disposition to use - * @return boolean True on successfully adding an attachment - */ - public function addEmbeddedImage($path, $cid, $name = '', $encoding = 'base64', $type = '', $disposition = 'inline') - { - if (!@is_file($path)) { - $this->setError($this->lang('file_access') . $path); - return false; - } - - // If a MIME type is not specified, try to work it out from the file name - if ($type == '') { - $type = self::filenameToType($path); - } - - $filename = basename($path); - if ($name == '') { - $name = $filename; - } - - // Append to $attachment array - $this->attachment[] = array( - 0 => $path, - 1 => $filename, - 2 => $name, - 3 => $encoding, - 4 => $type, - 5 => false, // isStringAttachment - 6 => $disposition, - 7 => $cid - ); - return true; - } - - /** - * Add an embedded stringified attachment. - * This can include images, sounds, and just about any other document type. - * Be sure to set the $type to an image type for images: - * JPEG images use 'image/jpeg', GIF uses 'image/gif', PNG uses 'image/png'. - * @param string $string The attachment binary data. - * @param string $cid Content ID of the attachment; Use this to reference - * the content when using an embedded image in HTML. - * @param string $name - * @param string $encoding File encoding (see $Encoding). - * @param string $type MIME type. - * @param string $disposition Disposition to use - * @return boolean True on successfully adding an attachment - */ - public function addStringEmbeddedImage( - $string, - $cid, - $name = '', - $encoding = 'base64', - $type = '', - $disposition = 'inline' - ) { - // If a MIME type is not specified, try to work it out from the name - if ($type == '') { - $type = self::filenameToType($name); - } - - // Append to $attachment array - $this->attachment[] = array( - 0 => $string, - 1 => $name, - 2 => $name, - 3 => $encoding, - 4 => $type, - 5 => true, // isStringAttachment - 6 => $disposition, - 7 => $cid - ); - return true; - } - - /** - * Check if an inline attachment is present. - * @access public - * @return boolean - */ - public function inlineImageExists() - { - foreach ($this->attachment as $attachment) { - if ($attachment[6] == 'inline') { - return true; - } - } - return false; - } - - /** - * Check if an attachment (non-inline) is present. - * @return boolean - */ - public function attachmentExists() - { - foreach ($this->attachment as $attachment) { - if ($attachment[6] == 'attachment') { - return true; - } - } - return false; - } - - /** - * Check if this message has an alternative body set. - * @return boolean - */ - public function alternativeExists() - { - return !empty($this->AltBody); - } - - /** - * Clear all To recipients. - * @return void - */ - public function clearAddresses() - { - foreach ($this->to as $to) { - unset($this->all_recipients[strtolower($to[0])]); - } - $this->to = array(); - } - - /** - * Clear all CC recipients. - * @return void - */ - public function clearCCs() - { - foreach ($this->cc as $cc) { - unset($this->all_recipients[strtolower($cc[0])]); - } - $this->cc = array(); - } - - /** - * Clear all BCC recipients. - * @return void - */ - public function clearBCCs() - { - foreach ($this->bcc as $bcc) { - unset($this->all_recipients[strtolower($bcc[0])]); - } - $this->bcc = array(); - } - - /** - * Clear all ReplyTo recipients. - * @return void - */ - public function clearReplyTos() - { - $this->ReplyTo = array(); - } - - /** - * Clear all recipient types. - * @return void - */ - public function clearAllRecipients() - { - $this->to = array(); - $this->cc = array(); - $this->bcc = array(); - $this->all_recipients = array(); - } - - /** - * Clear all filesystem, string, and binary attachments. - * @return void - */ - public function clearAttachments() - { - $this->attachment = array(); - } - - /** - * Clear all custom headers. - * @return void - */ - public function clearCustomHeaders() - { - $this->CustomHeader = array(); - } - - /** - * Add an error message to the error container. - * @access protected - * @param string $msg - * @return void - */ - protected function setError($msg) - { - $this->error_count++; - if ($this->Mailer == 'smtp' and !is_null($this->smtp)) { - $lasterror = $this->smtp->getError(); - if (!empty($lasterror) and array_key_exists('smtp_msg', $lasterror)) { - $msg .= '

        ' . $this->lang('smtp_error') . $lasterror['smtp_msg'] . "

        \n"; - } - } - $this->ErrorInfo = $msg; - } - - /** - * Return an RFC 822 formatted date. - * @access public - * @return string - * @static - */ - public static function rfcDate() - { - // Set the time zone to whatever the default is to avoid 500 errors - // Will default to UTC if it's not set properly in php.ini - date_default_timezone_set(@date_default_timezone_get()); - return date('D, j M Y H:i:s O'); - } - - /** - * Get the server hostname. - * Returns 'localhost.localdomain' if unknown. - * @access protected - * @return string - */ - protected function serverHostname() - { - $result = 'localhost.localdomain'; - if (!empty($this->Hostname)) { - $result = $this->Hostname; - } elseif (isset($_SERVER) and array_key_exists('SERVER_NAME', $_SERVER) and !empty($_SERVER['SERVER_NAME'])) { - $result = $_SERVER['SERVER_NAME']; - } elseif (function_exists('gethostname') && gethostname() !== false) { - $result = gethostname(); - } elseif (php_uname('n') !== false) { - $result = php_uname('n'); - } - return $result; - } - - /** - * Get an error message in the current language. - * @access protected - * @param string $key - * @return string - */ - protected function lang($key) - { - if (count($this->language) < 1) { - $this->setLanguage('en'); // set the default language - } - - if (isset($this->language[$key])) { - return $this->language[$key]; - } else { - return 'Language string failed to load: ' . $key; - } - } - - /** - * Check if an error occurred. - * @access public - * @return boolean True if an error did occur. - */ - public function isError() - { - return ($this->error_count > 0); - } - - /** - * Ensure consistent line endings in a string. - * Changes every end of line from CRLF, CR or LF to $this->LE. - * @access public - * @param string $str String to fixEOL - * @return string - */ - public function fixEOL($str) - { - // Normalise to \n - $nstr = str_replace(array("\r\n", "\r"), "\n", $str); - // Now convert LE as needed - if ($this->LE !== "\n") { - $nstr = str_replace("\n", $this->LE, $nstr); - } - return $nstr; - } - - /** - * Add a custom header. - * $name value can be overloaded to contain - * both header name and value (name:value) - * @access public - * @param string $name Custom header name - * @param string $value Header value - * @return void - */ - public function addCustomHeader($name, $value = null) - { - if ($value === null) { - // Value passed in as name:value - $this->CustomHeader[] = explode(':', $name, 2); - } else { - $this->CustomHeader[] = array($name, $value); - } - } - - /** - * Create a message from an HTML string. - * Automatically makes modifications for inline images and backgrounds - * and creates a plain-text version by converting the HTML. - * Overwrites any existing values in $this->Body and $this->AltBody - * @access public - * @param string $message HTML message string - * @param string $basedir baseline directory for path - * @param boolean $advanced Whether to use the advanced HTML to text converter - * @return string $message - */ - public function msgHTML($message, $basedir = '', $advanced = false) - { - preg_match_all('/(src|background)=["\'](.*)["\']/Ui', $message, $images); - if (isset($images[2])) { - foreach ($images[2] as $imgindex => $url) { - // Convert data URIs into embedded images - if (preg_match('#^data:(image[^;,]*)(;base64)?,#', $url, $match)) { - $data = substr($url, strpos($url, ',')); - if ($match[2]) { - $data = base64_decode($data); - } else { - $data = rawurldecode($data); - } - $cid = md5($url) . '@phpmailer.0'; // RFC2392 S 2 - if ($this->addStringEmbeddedImage($data, $cid, '', 'base64', $match[1])) { - $message = preg_replace( - '/' . $images[1][$imgindex] . '=["\']' . preg_quote($url, '/') . '["\']/Ui', - $images[1][$imgindex] . '="cid:' . $cid . '"', - $message - ); - } - } elseif (!preg_match('#^[A-z]+://#', $url)) { - // Do not change urls for absolute images (thanks to corvuscorax) - $filename = basename($url); - $directory = dirname($url); - if ($directory == '.') { - $directory = ''; - } - $cid = md5($url) . '@phpmailer.0'; // RFC2392 S 2 - if (strlen($basedir) > 1 && substr($basedir, -1) != '/') { - $basedir .= '/'; - } - if (strlen($directory) > 1 && substr($directory, -1) != '/') { - $directory .= '/'; - } - if ($this->addEmbeddedImage( - $basedir . $directory . $filename, - $cid, - $filename, - 'base64', - self::_mime_types(self::mb_pathinfo($filename, PATHINFO_EXTENSION)) - ) - ) { - $message = preg_replace( - '/' . $images[1][$imgindex] . '=["\']' . preg_quote($url, '/') . '["\']/Ui', - $images[1][$imgindex] . '="cid:' . $cid . '"', - $message - ); - } - } - } - } - $this->isHTML(true); - // Convert all message body line breaks to CRLF, makes quoted-printable encoding work much better - $this->Body = $this->normalizeBreaks($message); - $this->AltBody = $this->normalizeBreaks($this->html2text($message, $advanced)); - if (empty($this->AltBody)) { - $this->AltBody = 'To view this email message, open it in a program that understands HTML!' . - self::CRLF . self::CRLF; - } - return $this->Body; - } - - /** - * Convert an HTML string into plain text. - * @param string $html The HTML text to convert - * @param boolean $advanced Should this use the more complex html2text converter or just a simple one? - * @return string - */ - public function html2text($html, $advanced = false) - { - if ($advanced) { - require_once 'extras/class.html2text.php'; - $htmlconverter = new html2text($html); - return $htmlconverter->get_text(); - } - return html_entity_decode( - trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/si', '', $html))), - ENT_QUOTES, - $this->CharSet - ); - } - - /** - * Get the MIME type for a file extension. - * @param string $ext File extension - * @access public - * @return string MIME type of file. - * @static - */ - public static function _mime_types($ext = '') - { - $mimes = array( - 'xl' => 'application/excel', - 'hqx' => 'application/mac-binhex40', - 'cpt' => 'application/mac-compactpro', - 'bin' => 'application/macbinary', - 'doc' => 'application/msword', - 'word' => 'application/msword', - 'class' => 'application/octet-stream', - 'dll' => 'application/octet-stream', - 'dms' => 'application/octet-stream', - 'exe' => 'application/octet-stream', - 'lha' => 'application/octet-stream', - 'lzh' => 'application/octet-stream', - 'psd' => 'application/octet-stream', - 'sea' => 'application/octet-stream', - 'so' => 'application/octet-stream', - 'oda' => 'application/oda', - 'pdf' => 'application/pdf', - 'ai' => 'application/postscript', - 'eps' => 'application/postscript', - 'ps' => 'application/postscript', - 'smi' => 'application/smil', - 'smil' => 'application/smil', - 'mif' => 'application/vnd.mif', - 'xls' => 'application/vnd.ms-excel', - 'ppt' => 'application/vnd.ms-powerpoint', - 'wbxml' => 'application/vnd.wap.wbxml', - 'wmlc' => 'application/vnd.wap.wmlc', - 'dcr' => 'application/x-director', - 'dir' => 'application/x-director', - 'dxr' => 'application/x-director', - 'dvi' => 'application/x-dvi', - 'gtar' => 'application/x-gtar', - 'php3' => 'application/x-httpd-php', - 'php4' => 'application/x-httpd-php', - 'php' => 'application/x-httpd-php', - 'phtml' => 'application/x-httpd-php', - 'phps' => 'application/x-httpd-php-source', - 'js' => 'application/x-javascript', - 'swf' => 'application/x-shockwave-flash', - 'sit' => 'application/x-stuffit', - 'tar' => 'application/x-tar', - 'tgz' => 'application/x-tar', - 'xht' => 'application/xhtml+xml', - 'xhtml' => 'application/xhtml+xml', - 'zip' => 'application/zip', - 'mid' => 'audio/midi', - 'midi' => 'audio/midi', - 'mp2' => 'audio/mpeg', - 'mp3' => 'audio/mpeg', - 'mpga' => 'audio/mpeg', - 'aif' => 'audio/x-aiff', - 'aifc' => 'audio/x-aiff', - 'aiff' => 'audio/x-aiff', - 'ram' => 'audio/x-pn-realaudio', - 'rm' => 'audio/x-pn-realaudio', - 'rpm' => 'audio/x-pn-realaudio-plugin', - 'ra' => 'audio/x-realaudio', - 'wav' => 'audio/x-wav', - 'bmp' => 'image/bmp', - 'gif' => 'image/gif', - 'jpeg' => 'image/jpeg', - 'jpe' => 'image/jpeg', - 'jpg' => 'image/jpeg', - 'png' => 'image/png', - 'tiff' => 'image/tiff', - 'tif' => 'image/tiff', - 'eml' => 'message/rfc822', - 'css' => 'text/css', - 'html' => 'text/html', - 'htm' => 'text/html', - 'shtml' => 'text/html', - 'log' => 'text/plain', - 'text' => 'text/plain', - 'txt' => 'text/plain', - 'rtx' => 'text/richtext', - 'rtf' => 'text/rtf', - 'vcf' => 'text/vcard', - 'vcard' => 'text/vcard', - 'xml' => 'text/xml', - 'xsl' => 'text/xml', - 'mpeg' => 'video/mpeg', - 'mpe' => 'video/mpeg', - 'mpg' => 'video/mpeg', - 'mov' => 'video/quicktime', - 'qt' => 'video/quicktime', - 'rv' => 'video/vnd.rn-realvideo', - 'avi' => 'video/x-msvideo', - 'movie' => 'video/x-sgi-movie' - ); - return (array_key_exists(strtolower($ext), $mimes) ? $mimes[strtolower($ext)]: 'application/octet-stream'); - } - - /** - * Map a file name to a MIME type. - * Defaults to 'application/octet-stream', i.e.. arbitrary binary data. - * @param string $filename A file name or full path, does not need to exist as a file - * @return string - * @static - */ - public static function filenameToType($filename) - { - // In case the path is a URL, strip any query string before getting extension - $qpos = strpos($filename, '?'); - if ($qpos !== false) { - $filename = substr($filename, 0, $qpos); - } - $pathinfo = self::mb_pathinfo($filename); - return self::_mime_types($pathinfo['extension']); - } - - /** - * Multi-byte-safe pathinfo replacement. - * Drop-in replacement for pathinfo(), but multibyte-safe, cross-platform-safe, old-version-safe. - * Works similarly to the one in PHP >= 5.2.0 - * @link http://www.php.net/manual/en/function.pathinfo.php#107461 - * @param string $path A filename or path, does not need to exist as a file - * @param integer|string $options Either a PATHINFO_* constant, - * or a string name to return only the specified piece, allows 'filename' to work on PHP < 5.2 - * @return string|array - * @static - */ - public static function mb_pathinfo($path, $options = null) - { - $ret = array('dirname' => '', 'basename' => '', 'extension' => '', 'filename' => ''); - $pathinfo = array(); - if (preg_match('%^(.*?)[\\\\/]*(([^/\\\\]*?)(\.([^\.\\\\/]+?)|))[\\\\/\.]*$%im', $path, $pathinfo)) { - if (array_key_exists(1, $pathinfo)) { - $ret['dirname'] = $pathinfo[1]; - } - if (array_key_exists(2, $pathinfo)) { - $ret['basename'] = $pathinfo[2]; - } - if (array_key_exists(5, $pathinfo)) { - $ret['extension'] = $pathinfo[5]; - } - if (array_key_exists(3, $pathinfo)) { - $ret['filename'] = $pathinfo[3]; - } - } - switch ($options) { - case PATHINFO_DIRNAME: - case 'dirname': - return $ret['dirname']; - case PATHINFO_BASENAME: - case 'basename': - return $ret['basename']; - case PATHINFO_EXTENSION: - case 'extension': - return $ret['extension']; - case PATHINFO_FILENAME: - case 'filename': - return $ret['filename']; - default: - return $ret; - } - } - - /** - * Set or reset instance properties. - * - * Usage Example: - * $page->set('X-Priority', '3'); - * - * @access public - * @param string $name - * @param mixed $value - * NOTE: will not work with arrays, there are no arrays to set/reset - * @throws phpmailerException - * @return boolean - * @TODO Should this not be using __set() magic function? - */ - public function set($name, $value = '') - { - try { - if (isset($this->$name)) { - $this->$name = $value; - } else { - throw new phpmailerException($this->lang('variable_set') . $name, self::STOP_CRITICAL); - } - } catch (Exception $exc) { - $this->setError($exc->getMessage()); - if ($exc->getCode() == self::STOP_CRITICAL) { - return false; - } - } - return true; - } - - /** - * Strip newlines to prevent header injection. - * @access public - * @param string $str - * @return string - */ - public function secureHeader($str) - { - return trim(str_replace(array("\r", "\n"), '', $str)); - } - - /** - * Normalize line breaks in a string. - * Converts UNIX LF, Mac CR and Windows CRLF line breaks into a single line break format. - * Defaults to CRLF (for message bodies) and preserves consecutive breaks. - * @param string $text - * @param string $breaktype What kind of line break to use, defaults to CRLF - * @return string - * @access public - * @static - */ - public static function normalizeBreaks($text, $breaktype = "\r\n") - { - return preg_replace('/(\r\n|\r|\n)/ms', $breaktype, $text); - } - - - /** - * Set the public and private key files and password for S/MIME signing. - * @access public - * @param string $cert_filename - * @param string $key_filename - * @param string $key_pass Password for private key - */ - public function sign($cert_filename, $key_filename, $key_pass) - { - $this->sign_cert_file = $cert_filename; - $this->sign_key_file = $key_filename; - $this->sign_key_pass = $key_pass; - } - - /** - * Quoted-Printable-encode a DKIM header. - * @access public - * @param string $txt - * @return string - */ - public function DKIM_QP($txt) - { - $line = ''; - for ($i = 0; $i < strlen($txt); $i++) { - $ord = ord($txt[$i]); - if (((0x21 <= $ord) && ($ord <= 0x3A)) || $ord == 0x3C || ((0x3E <= $ord) && ($ord <= 0x7E))) { - $line .= $txt[$i]; - } else { - $line .= '=' . sprintf('%02X', $ord); - } - } - return $line; - } - - /** - * Generate a DKIM signature. - * @access public - * @param string $signHeader - * @throws phpmailerException - * @return string - */ - public function DKIM_Sign($signHeader) - { - if (!defined('PKCS7_TEXT')) { - if ($this->exceptions) { - throw new phpmailerException($this->lang('signing') . ' OpenSSL extension missing.'); - } - return ''; - } - $privKeyStr = file_get_contents($this->DKIM_private); - if ($this->DKIM_passphrase != '') { - $privKey = openssl_pkey_get_private($privKeyStr, $this->DKIM_passphrase); - } else { - $privKey = $privKeyStr; - } - if (openssl_sign($signHeader, $signature, $privKey)) { - return base64_encode($signature); - } - return ''; - } - - /** - * Generate a DKIM canonicalization header. - * @access public - * @param string $signHeader Header - * @return string - */ - public function DKIM_HeaderC($signHeader) - { - $signHeader = preg_replace('/\r\n\s+/', ' ', $signHeader); - $lines = explode("\r\n", $signHeader); - foreach ($lines as $key => $line) { - list($heading, $value) = explode(':', $line, 2); - $heading = strtolower($heading); - $value = preg_replace('/\s+/', ' ', $value); // Compress useless spaces - $lines[$key] = $heading . ':' . trim($value); // Don't forget to remove WSP around the value - } - $signHeader = implode("\r\n", $lines); - return $signHeader; - } - - /** - * Generate a DKIM canonicalization body. - * @access public - * @param string $body Message Body - * @return string - */ - public function DKIM_BodyC($body) - { - if ($body == '') { - return "\r\n"; - } - // stabilize line endings - $body = str_replace("\r\n", "\n", $body); - $body = str_replace("\n", "\r\n", $body); - // END stabilize line endings - while (substr($body, strlen($body) - 4, 4) == "\r\n\r\n") { - $body = substr($body, 0, strlen($body) - 2); - } - return $body; - } - - /** - * Create the DKIM header and body in a new message header. - * @access public - * @param string $headers_line Header lines - * @param string $subject Subject - * @param string $body Body - * @return string - */ - public function DKIM_Add($headers_line, $subject, $body) - { - $DKIMsignatureType = 'rsa-sha1'; // Signature & hash algorithms - $DKIMcanonicalization = 'relaxed/simple'; // Canonicalization of header/body - $DKIMquery = 'dns/txt'; // Query method - $DKIMtime = time(); // Signature Timestamp = seconds since 00:00:00 - Jan 1, 1970 (UTC time zone) - $subject_header = "Subject: $subject"; - $headers = explode($this->LE, $headers_line); - $from_header = ''; - $to_header = ''; - $current = ''; - foreach ($headers as $header) { - if (strpos($header, 'From:') === 0) { - $from_header = $header; - $current = 'from_header'; - } elseif (strpos($header, 'To:') === 0) { - $to_header = $header; - $current = 'to_header'; - } else { - if ($current && strpos($header, ' =?') === 0) { - $current .= $header; - } else { - $current = ''; - } - } - } - $from = str_replace('|', '=7C', $this->DKIM_QP($from_header)); - $to = str_replace('|', '=7C', $this->DKIM_QP($to_header)); - $subject = str_replace( - '|', - '=7C', - $this->DKIM_QP($subject_header) - ); // Copied header fields (dkim-quoted-printable) - $body = $this->DKIM_BodyC($body); - $DKIMlen = strlen($body); // Length of body - $DKIMb64 = base64_encode(pack('H*', sha1($body))); // Base64 of packed binary SHA-1 hash of body - $ident = ($this->DKIM_identity == '') ? '' : ' i=' . $this->DKIM_identity . ';'; - $dkimhdrs = 'DKIM-Signature: v=1; a=' . - $DKIMsignatureType . '; q=' . - $DKIMquery . '; l=' . - $DKIMlen . '; s=' . - $this->DKIM_selector . - ";\r\n" . - "\tt=" . $DKIMtime . '; c=' . $DKIMcanonicalization . ";\r\n" . - "\th=From:To:Subject;\r\n" . - "\td=" . $this->DKIM_domain . ';' . $ident . "\r\n" . - "\tz=$from\r\n" . - "\t|$to\r\n" . - "\t|$subject;\r\n" . - "\tbh=" . $DKIMb64 . ";\r\n" . - "\tb="; - $toSign = $this->DKIM_HeaderC( - $from_header . "\r\n" . $to_header . "\r\n" . $subject_header . "\r\n" . $dkimhdrs - ); - $signed = $this->DKIM_Sign($toSign); - return $dkimhdrs . $signed . "\r\n"; - } - - /** - * Allows for public read access to 'to' property. - * @access public - * @return array - */ - public function getToAddresses() - { - return $this->to; - } - - /** - * Allows for public read access to 'cc' property. - * @access public - * @return array - */ - public function getCcAddresses() - { - return $this->cc; - } - - /** - * Allows for public read access to 'bcc' property. - * @access public - * @return array - */ - public function getBccAddresses() - { - return $this->bcc; - } - - /** - * Allows for public read access to 'ReplyTo' property. - * @access public - * @return array - */ - public function getReplyToAddresses() - { - return $this->ReplyTo; - } - - /** - * Allows for public read access to 'all_recipients' property. - * @access public - * @return array - */ - public function getAllRecipientAddresses() - { - return $this->all_recipients; - } - - /** - * Perform a callback. - * @param boolean $isSent - * @param array $to - * @param array $cc - * @param array $bcc - * @param string $subject - * @param string $body - * @param string $from - */ - protected function doCallback($isSent, $to, $cc, $bcc, $subject, $body, $from) - { - if (!empty($this->action_function) && is_callable($this->action_function)) { - $params = array($isSent, $to, $cc, $bcc, $subject, $body, $from); - call_user_func_array($this->action_function, $params); - } - } -} - -/** - * PHPMailer exception handler - * @package PHPMailer - */ -class phpmailerException extends Exception -{ - /** - * Prettify error message output - * @return string - */ - public function errorMessage() - { - $errorMsg = '' . $this->getMessage() . "
        \n"; - return $errorMsg; - } -} diff --git a/cadline/backend/maintenance/libraries/phpmailer/class.pop3.php b/cadline/backend/maintenance/libraries/phpmailer/class.pop3.php deleted file mode 100644 index 86e47cdc..00000000 --- a/cadline/backend/maintenance/libraries/phpmailer/class.pop3.php +++ /dev/null @@ -1,398 +0,0 @@ - - * @author Jim Jagielski (jimjag) - * @author Andy Prevost (codeworxtech) - * @author Brent R. Matzelle (original founder) - * @copyright 2012 - 2014 Marcus Bointon - * @copyright 2010 - 2012 Jim Jagielski - * @copyright 2004 - 2009 Andy Prevost - * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License - * @note This program is distributed in the hope that it will be useful - WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. - */ - -/** - * PHPMailer POP-Before-SMTP Authentication Class. - * Specifically for PHPMailer to use for RFC1939 POP-before-SMTP authentication. - * Does not support APOP. - * @package PHPMailer - * @author Richard Davey (original author) - * @author Marcus Bointon (Synchro/coolbru) - * @author Jim Jagielski (jimjag) - * @author Andy Prevost (codeworxtech) - */ -class POP3 -{ - /** - * The POP3 PHPMailer Version number. - * @type string - * @access public - */ - public $Version = '5.2.9'; - - /** - * Default POP3 port number. - * @type integer - * @access public - */ - public $POP3_PORT = 110; - - /** - * Default timeout in seconds. - * @type integer - * @access public - */ - public $POP3_TIMEOUT = 30; - - /** - * POP3 Carriage Return + Line Feed. - * @type string - * @access public - * @deprecated Use the constant instead - */ - public $CRLF = "\r\n"; - - /** - * Debug display level. - * Options: 0 = no, 1+ = yes - * @type integer - * @access public - */ - public $do_debug = 0; - - /** - * POP3 mail server hostname. - * @type string - * @access public - */ - public $host; - - /** - * POP3 port number. - * @type integer - * @access public - */ - public $port; - - /** - * POP3 Timeout Value in seconds. - * @type integer - * @access public - */ - public $tval; - - /** - * POP3 username - * @type string - * @access public - */ - public $username; - - /** - * POP3 password. - * @type string - * @access public - */ - public $password; - - /** - * Resource handle for the POP3 connection socket. - * @type resource - * @access private - */ - private $pop_conn; - - /** - * Are we connected? - * @type boolean - * @access private - */ - private $connected = false; - - /** - * Error container. - * @type array - * @access private - */ - private $errors = array(); - - /** - * Line break constant - */ - const CRLF = "\r\n"; - - /** - * Simple static wrapper for all-in-one POP before SMTP - * @param $host - * @param boolean $port - * @param boolean $tval - * @param string $username - * @param string $password - * @param integer $debug_level - * @return boolean - */ - public static function popBeforeSmtp( - $host, - $port = false, - $tval = false, - $username = '', - $password = '', - $debug_level = 0 - ) { - $pop = new POP3; - return $pop->authorise($host, $port, $tval, $username, $password, $debug_level); - } - - /** - * Authenticate with a POP3 server. - * A connect, login, disconnect sequence - * appropriate for POP-before SMTP authorisation. - * @access public - * @param string $host The hostname to connect to - * @param integer|boolean $port The port number to connect to - * @param integer|boolean $timeout The timeout value - * @param string $username - * @param string $password - * @param integer $debug_level - * @return boolean - */ - public function authorise($host, $port = false, $timeout = false, $username = '', $password = '', $debug_level = 0) - { - $this->host = $host; - // If no port value provided, use default - if ($port === false) { - $this->port = $this->POP3_PORT; - } else { - $this->port = (int)$port; - } - // If no timeout value provided, use default - if ($timeout === false) { - $this->tval = $this->POP3_TIMEOUT; - } else { - $this->tval = (int)$timeout; - } - $this->do_debug = $debug_level; - $this->username = $username; - $this->password = $password; - // Reset the error log - $this->errors = array(); - // connect - $result = $this->connect($this->host, $this->port, $this->tval); - if ($result) { - $login_result = $this->login($this->username, $this->password); - if ($login_result) { - $this->disconnect(); - return true; - } - } - // We need to disconnect regardless of whether the login succeeded - $this->disconnect(); - return false; - } - - /** - * Connect to a POP3 server. - * @access public - * @param string $host - * @param integer|boolean $port - * @param integer $tval - * @return boolean - */ - public function connect($host, $port = false, $tval = 30) - { - // Are we already connected? - if ($this->connected) { - return true; - } - - //On Windows this will raise a PHP Warning error if the hostname doesn't exist. - //Rather than suppress it with @fsockopen, capture it cleanly instead - set_error_handler(array($this, 'catchWarning')); - - if ($port === false) { - $port = $this->POP3_PORT; - } - - // connect to the POP3 server - $this->pop_conn = fsockopen( - $host, // POP3 Host - $port, // Port # - $errno, // Error Number - $errstr, // Error Message - $tval - ); // Timeout (seconds) - // Restore the error handler - restore_error_handler(); - - // Did we connect? - if ($this->pop_conn === false) { - // It would appear not... - $this->setError(array( - 'error' => "Failed to connect to server $host on port $port", - 'errno' => $errno, - 'errstr' => $errstr - )); - return false; - } - - // Increase the stream time-out - stream_set_timeout($this->pop_conn, $tval, 0); - - // Get the POP3 server response - $pop3_response = $this->getResponse(); - // Check for the +OK - if ($this->checkResponse($pop3_response)) { - // The connection is established and the POP3 server is talking - $this->connected = true; - return true; - } - return false; - } - - /** - * Log in to the POP3 server. - * Does not support APOP (RFC 2828, 4949). - * @access public - * @param string $username - * @param string $password - * @return boolean - */ - public function login($username = '', $password = '') - { - if (!$this->connected) { - $this->setError('Not connected to POP3 server'); - } - if (empty($username)) { - $username = $this->username; - } - if (empty($password)) { - $password = $this->password; - } - - // Send the Username - $this->sendString("USER $username" . self::CRLF); - $pop3_response = $this->getResponse(); - if ($this->checkResponse($pop3_response)) { - // Send the Password - $this->sendString("PASS $password" . self::CRLF); - $pop3_response = $this->getResponse(); - if ($this->checkResponse($pop3_response)) { - return true; - } - } - return false; - } - - /** - * Disconnect from the POP3 server. - * @access public - */ - public function disconnect() - { - $this->sendString('QUIT'); - //The QUIT command may cause the daemon to exit, which will kill our connection - //So ignore errors here - try { - @fclose($this->pop_conn); - } catch (Exception $e) { - //Do nothing - }; - } - - /** - * Get a response from the POP3 server. - * $size is the maximum number of bytes to retrieve - * @param integer $size - * @return string - * @access private - */ - private function getResponse($size = 128) - { - $response = fgets($this->pop_conn, $size); - if ($this->do_debug >= 1) { - echo "Server -> Client: $response"; - } - return $response; - } - - /** - * Send raw data to the POP3 server. - * @param string $string - * @return integer - * @access private - */ - private function sendString($string) - { - if ($this->pop_conn) { - if ($this->do_debug >= 2) { //Show client messages when debug >= 2 - echo "Client -> Server: $string"; - } - return fwrite($this->pop_conn, $string, strlen($string)); - } - return 0; - } - - /** - * Checks the POP3 server response. - * Looks for for +OK or -ERR. - * @param string $string - * @return boolean - * @access private - */ - private function checkResponse($string) - { - if (substr($string, 0, 3) !== '+OK') { - $this->setError(array( - 'error' => "Server reported an error: $string", - 'errno' => 0, - 'errstr' => '' - )); - return false; - } else { - return true; - } - } - - /** - * Add an error to the internal error store. - * Also display debug output if it's enabled. - * @param $error - */ - private function setError($error) - { - $this->errors[] = $error; - if ($this->do_debug >= 1) { - echo '
        ';
        -            foreach ($this->errors as $error) {
        -                print_r($error);
        -            }
        -            echo '
        '; - } - } - - /** - * POP3 connection error handler. - * @param integer $errno - * @param string $errstr - * @param string $errfile - * @param integer $errline - * @access private - */ - private function catchWarning($errno, $errstr, $errfile, $errline) - { - $this->setError(array( - 'error' => "Connecting to the POP3 server raised a PHP warning: ", - 'errno' => $errno, - 'errstr' => $errstr, - 'errfile' => $errfile, - 'errline' => $errline - )); - } -} diff --git a/cadline/backend/maintenance/libraries/phpmailer/class.smtp.php b/cadline/backend/maintenance/libraries/phpmailer/class.smtp.php deleted file mode 100644 index eb12ac50..00000000 --- a/cadline/backend/maintenance/libraries/phpmailer/class.smtp.php +++ /dev/null @@ -1,965 +0,0 @@ - - * @author Jim Jagielski (jimjag) - * @author Andy Prevost (codeworxtech) - * @author Brent R. Matzelle (original founder) - * @copyright 2014 Marcus Bointon - * @copyright 2010 - 2012 Jim Jagielski - * @copyright 2004 - 2009 Andy Prevost - * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License - * @note This program is distributed in the hope that it will be useful - WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. - */ - -/** - * PHPMailer RFC821 SMTP email transport class. - * Implements RFC 821 SMTP commands and provides some utility methods for sending mail to an SMTP server. - * @package PHPMailer - * @author Chris Ryan - * @author Marcus Bointon - */ -class SMTP -{ - /** - * The PHPMailer SMTP version number. - * @type string - */ - const VERSION = '5.2.9'; - - /** - * SMTP line break constant. - * @type string - */ - const CRLF = "\r\n"; - - /** - * The SMTP port to use if one is not specified. - * @type integer - */ - const DEFAULT_SMTP_PORT = 25; - - /** - * The maximum line length allowed by RFC 2822 section 2.1.1 - * @type integer - */ - const MAX_LINE_LENGTH = 998; - - /** - * Debug level for no output - */ - const DEBUG_OFF = 0; - - /** - * Debug level to show client -> server messages - */ - const DEBUG_CLIENT = 1; - - /** - * Debug level to show client -> server and server -> client messages - */ - const DEBUG_SERVER = 2; - - /** - * Debug level to show connection status, client -> server and server -> client messages - */ - const DEBUG_CONNECTION = 3; - - /** - * Debug level to show all messages - */ - const DEBUG_LOWLEVEL = 4; - - /** - * The PHPMailer SMTP Version number. - * @type string - * @deprecated Use the `VERSION` constant instead - * @see SMTP::VERSION - */ - public $Version = '5.2.9'; - - /** - * SMTP server port number. - * @type integer - * @deprecated This is only ever used as a default value, so use the `DEFAULT_SMTP_PORT` constant instead - * @see SMTP::DEFAULT_SMTP_PORT - */ - public $SMTP_PORT = 25; - - /** - * SMTP reply line ending. - * @type string - * @deprecated Use the `CRLF` constant instead - * @see SMTP::CRLF - */ - public $CRLF = "\r\n"; - - /** - * Debug output level. - * Options: - * * self::DEBUG_OFF (`0`) No debug output, default - * * self::DEBUG_CLIENT (`1`) Client commands - * * self::DEBUG_SERVER (`2`) Client commands and server responses - * * self::DEBUG_CONNECTION (`3`) As DEBUG_SERVER plus connection status - * * self::DEBUG_LOWLEVEL (`4`) Low-level data output, all messages - * @type integer - */ - public $do_debug = self::DEBUG_OFF; - - /** - * How to handle debug output. - * Options: - * * `echo` Output plain-text as-is, appropriate for CLI - * * `html` Output escaped, line breaks converted to `
        `, appropriate for browser output - * * `error_log` Output to error log as configured in php.ini - * - * Alternatively, you can provide a callable expecting two params: a message string and the debug level: - * - * $smtp->Debugoutput = function($str, $level) {echo "debug level $level; message: $str";}; - * - * @type string|callable - */ - public $Debugoutput = 'echo'; - - /** - * Whether to use VERP. - * @link http://en.wikipedia.org/wiki/Variable_envelope_return_path - * @link http://www.postfix.org/VERP_README.html Info on VERP - * @type boolean - */ - public $do_verp = false; - - /** - * The timeout value for connection, in seconds. - * Default of 5 minutes (300sec) is from RFC2821 section 4.5.3.2 - * This needs to be quite high to function correctly with hosts using greetdelay as an anti-spam measure. - * @link http://tools.ietf.org/html/rfc2821#section-4.5.3.2 - * @type integer - */ - public $Timeout = 300; - - /** - * The SMTP timelimit value for reads, in seconds. - * @type integer - */ - public $Timelimit = 30; - - /** - * The socket for the server connection. - * @type resource - */ - protected $smtp_conn; - - /** - * Error message, if any, for the last call. - * @type array - */ - protected $error = array(); - - /** - * The reply the server sent to us for HELO. - * If null, no HELO string has yet been received. - * @type string|null - */ - protected $helo_rply = null; - - /** - * The most recent reply received from the server. - * @type string - */ - protected $last_reply = ''; - - /** - * Output debugging info via a user-selected method. - * @see SMTP::$Debugoutput - * @see SMTP::$do_debug - * @param string $str Debug string to output - * @param integer $level The debug level of this message; see DEBUG_* constants - * @return void - */ - protected function edebug($str, $level = 0) - { - if ($level > $this->do_debug) { - return; - } - if (is_callable($this->Debugoutput)) { - call_user_func($this->Debugoutput, $str, $this->do_debug); - return; - } - switch ($this->Debugoutput) { - case 'error_log': - //Don't output, just log - error_log($str); - break; - case 'html': - //Cleans up output a bit for a better looking, HTML-safe output - echo htmlentities( - preg_replace('/[\r\n]+/', '', $str), - ENT_QUOTES, - 'UTF-8' - ) - . "
        \n"; - break; - case 'echo': - default: - //Normalize line breaks - $str = preg_replace('/(\r\n|\r|\n)/ms', "\n", $str); - echo gmdate('Y-m-d H:i:s') . "\t" . str_replace( - "\n", - "\n \t ", - trim($str) - ) . "\n"; - } - } - - /** - * Connect to an SMTP server. - * @param string $host SMTP server IP or host name - * @param integer $port The port number to connect to - * @param integer $timeout How long to wait for the connection to open - * @param array $options An array of options for stream_context_create() - * @access public - * @return boolean - */ - public function connect($host, $port = null, $timeout = 30, $options = array()) - { - static $streamok; - //This is enabled by default since 5.0.0 but some providers disable it - //Check this once and cache the result - if (is_null($streamok)) { - $streamok = function_exists('stream_socket_client'); - } - // Clear errors to avoid confusion - $this->error = array(); - // Make sure we are __not__ connected - if ($this->connected()) { - // Already connected, generate error - $this->error = array('error' => 'Already connected to a server'); - return false; - } - if (empty($port)) { - $port = self::DEFAULT_SMTP_PORT; - } - // Connect to the SMTP server - $this->edebug( - "Connection: opening to $host:$port, t=$timeout, opt=" . var_export($options, true), - self::DEBUG_CONNECTION - ); - $errno = 0; - $errstr = ''; - if ($streamok) { - $socket_context = stream_context_create($options); - //Suppress errors; connection failures are handled at a higher level - $this->smtp_conn = @stream_socket_client( - $host . ":" . $port, - $errno, - $errstr, - $timeout, - STREAM_CLIENT_CONNECT, - $socket_context - ); - } else { - //Fall back to fsockopen which should work in more places, but is missing some features - $this->edebug( - "Connection: stream_socket_client not available, falling back to fsockopen", - self::DEBUG_CONNECTION - ); - $this->smtp_conn = fsockopen( - $host, - $port, - $errno, - $errstr, - $timeout - ); - } - // Verify we connected properly - if (!is_resource($this->smtp_conn)) { - $this->error = array( - 'error' => 'Failed to connect to server', - 'errno' => $errno, - 'errstr' => $errstr - ); - $this->edebug( - 'SMTP ERROR: ' . $this->error['error'] - . ": $errstr ($errno)", - self::DEBUG_CLIENT - ); - return false; - } - $this->edebug('Connection: opened', self::DEBUG_CONNECTION); - // SMTP server can take longer to respond, give longer timeout for first read - // Windows does not have support for this timeout function - if (substr(PHP_OS, 0, 3) != 'WIN') { - $max = ini_get('max_execution_time'); - if ($max != 0 && $timeout > $max) { // Don't bother if unlimited - @set_time_limit($timeout); - } - stream_set_timeout($this->smtp_conn, $timeout, 0); - } - // Get any announcement - $announce = $this->get_lines(); - $this->edebug('SERVER -> CLIENT: ' . $announce, self::DEBUG_SERVER); - return true; - } - - /** - * Initiate a TLS (encrypted) session. - * @access public - * @return boolean - */ - public function startTLS() - { - if (!$this->sendCommand('STARTTLS', 'STARTTLS', 220)) { - return false; - } - // Begin encrypted connection - if (!stream_socket_enable_crypto( - $this->smtp_conn, - true, - STREAM_CRYPTO_METHOD_TLS_CLIENT - )) { - return false; - } - return true; - } - - /** - * Perform SMTP authentication. - * Must be run after hello(). - * @see hello() - * @param string $username The user name - * @param string $password The password - * @param string $authtype The auth type (PLAIN, LOGIN, NTLM, CRAM-MD5) - * @param string $realm The auth realm for NTLM - * @param string $workstation The auth workstation for NTLM - * @access public - * @return boolean True if successfully authenticated. - */ - public function authenticate( - $username, - $password, - $authtype = 'LOGIN', - $realm = '', - $workstation = '' - ) { - if (empty($authtype)) { - $authtype = 'LOGIN'; - } - switch ($authtype) { - case 'PLAIN': - // Start authentication - if (!$this->sendCommand('AUTH', 'AUTH PLAIN', 334)) { - return false; - } - // Send encoded username and password - if (!$this->sendCommand( - 'User & Password', - base64_encode("\0" . $username . "\0" . $password), - 235 - )) { - return false; - } - break; - case 'LOGIN': - // Start authentication - if (!$this->sendCommand('AUTH', 'AUTH LOGIN', 334)) { - return false; - } - if (!$this->sendCommand("Username", base64_encode($username), 334)) { - return false; - } - if (!$this->sendCommand("Password", base64_encode($password), 235)) { - return false; - } - break; - case 'NTLM': - /* - * ntlm_sasl_client.php - * Bundled with Permission - * - * How to telnet in windows: - * http://technet.microsoft.com/en-us/library/aa995718%28EXCHG.65%29.aspx - * PROTOCOL Docs http://curl.haxx.se/rfc/ntlm.html#ntlmSmtpAuthentication - */ - require_once 'extras/ntlm_sasl_client.php'; - $temp = new stdClass(); - $ntlm_client = new ntlm_sasl_client_class; - //Check that functions are available - if (!$ntlm_client->Initialize($temp)) { - $this->error = array('error' => $temp->error); - $this->edebug( - 'You need to enable some modules in your php.ini file: ' - . $this->error['error'], - self::DEBUG_CLIENT - ); - return false; - } - //msg1 - $msg1 = $ntlm_client->TypeMsg1($realm, $workstation); //msg1 - - if (!$this->sendCommand( - 'AUTH NTLM', - 'AUTH NTLM ' . base64_encode($msg1), - 334 - )) { - return false; - } - //Though 0 based, there is a white space after the 3 digit number - //msg2 - $challenge = substr($this->last_reply, 3); - $challenge = base64_decode($challenge); - $ntlm_res = $ntlm_client->NTLMResponse( - substr($challenge, 24, 8), - $password - ); - //msg3 - $msg3 = $ntlm_client->TypeMsg3( - $ntlm_res, - $username, - $realm, - $workstation - ); - // send encoded username - return $this->sendCommand('Username', base64_encode($msg3), 235); - case 'CRAM-MD5': - // Start authentication - if (!$this->sendCommand('AUTH CRAM-MD5', 'AUTH CRAM-MD5', 334)) { - return false; - } - // Get the challenge - $challenge = base64_decode(substr($this->last_reply, 4)); - - // Build the response - $response = $username . ' ' . $this->hmac($challenge, $password); - - // send encoded credentials - return $this->sendCommand('Username', base64_encode($response), 235); - } - return true; - } - - /** - * Calculate an MD5 HMAC hash. - * Works like hash_hmac('md5', $data, $key) - * in case that function is not available - * @param string $data The data to hash - * @param string $key The key to hash with - * @access protected - * @return string - */ - protected function hmac($data, $key) - { - if (function_exists('hash_hmac')) { - return hash_hmac('md5', $data, $key); - } - - // The following borrowed from - // http://php.net/manual/en/function.mhash.php#27225 - - // RFC 2104 HMAC implementation for php. - // Creates an md5 HMAC. - // Eliminates the need to install mhash to compute a HMAC - // by Lance Rushing - - $bytelen = 64; // byte length for md5 - if (strlen($key) > $bytelen) { - $key = pack('H*', md5($key)); - } - $key = str_pad($key, $bytelen, chr(0x00)); - $ipad = str_pad('', $bytelen, chr(0x36)); - $opad = str_pad('', $bytelen, chr(0x5c)); - $k_ipad = $key ^ $ipad; - $k_opad = $key ^ $opad; - - return md5($k_opad . pack('H*', md5($k_ipad . $data))); - } - - /** - * Check connection state. - * @access public - * @return boolean True if connected. - */ - public function connected() - { - if (is_resource($this->smtp_conn)) { - $sock_status = stream_get_meta_data($this->smtp_conn); - if ($sock_status['eof']) { - // The socket is valid but we are not connected - $this->edebug( - 'SMTP NOTICE: EOF caught while checking if connected', - self::DEBUG_CLIENT - ); - $this->close(); - return false; - } - return true; // everything looks good - } - return false; - } - - /** - * Close the socket and clean up the state of the class. - * Don't use this function without first trying to use QUIT. - * @see quit() - * @access public - * @return void - */ - public function close() - { - $this->error = array(); - $this->helo_rply = null; - if (is_resource($this->smtp_conn)) { - // close the connection and cleanup - fclose($this->smtp_conn); - $this->smtp_conn = null; //Makes for cleaner serialization - $this->edebug('Connection: closed', self::DEBUG_CONNECTION); - } - } - - /** - * Send an SMTP DATA command. - * Issues a data command and sends the msg_data to the server, - * finializing the mail transaction. $msg_data is the message - * that is to be send with the headers. Each header needs to be - * on a single line followed by a with the message headers - * and the message body being separated by and additional . - * Implements rfc 821: DATA - * @param string $msg_data Message data to send - * @access public - * @return boolean - */ - public function data($msg_data) - { - if (!$this->sendCommand('DATA', 'DATA', 354)) { - return false; - } - /* The server is ready to accept data! - * According to rfc821 we should not send more than 1000 characters on a single line (including the CRLF) - * so we will break the data up into lines by \r and/or \n then if needed we will break each of those into - * smaller lines to fit within the limit. - * We will also look for lines that start with a '.' and prepend an additional '.'. - * NOTE: this does not count towards line-length limit. - */ - - // Normalize line breaks before exploding - $lines = explode("\n", str_replace(array("\r\n", "\r"), "\n", $msg_data)); - - /* To distinguish between a complete RFC822 message and a plain message body, we check if the first field - * of the first line (':' separated) does not contain a space then it _should_ be a header and we will - * process all lines before a blank line as headers. - */ - - $field = substr($lines[0], 0, strpos($lines[0], ':')); - $in_headers = false; - if (!empty($field) && strpos($field, ' ') === false) { - $in_headers = true; - } - - foreach ($lines as $line) { - $lines_out = array(); - if ($in_headers and $line == '') { - $in_headers = false; - } - // ok we need to break this line up into several smaller lines - //This is a small micro-optimisation: isset($str[$len]) is equivalent to (strlen($str) > $len) - while (isset($line[self::MAX_LINE_LENGTH])) { - //Working backwards, try to find a space within the last MAX_LINE_LENGTH chars of the line to break on - //so as to avoid breaking in the middle of a word - $pos = strrpos(substr($line, 0, self::MAX_LINE_LENGTH), ' '); - if (!$pos) { //Deliberately matches both false and 0 - //No nice break found, add a hard break - $pos = self::MAX_LINE_LENGTH - 1; - $lines_out[] = substr($line, 0, $pos); - $line = substr($line, $pos); - } else { - //Break at the found point - $lines_out[] = substr($line, 0, $pos); - //Move along by the amount we dealt with - $line = substr($line, $pos + 1); - } - /* If processing headers add a LWSP-char to the front of new line - * RFC822 section 3.1.1 - */ - if ($in_headers) { - $line = "\t" . $line; - } - } - $lines_out[] = $line; - - // Send the lines to the server - foreach ($lines_out as $line_out) { - //RFC2821 section 4.5.2 - if (!empty($line_out) and $line_out[0] == '.') { - $line_out = '.' . $line_out; - } - $this->client_send($line_out . self::CRLF); - } - } - - // Message data has been sent, complete the command - return $this->sendCommand('DATA END', '.', 250); - } - - /** - * Send an SMTP HELO or EHLO command. - * Used to identify the sending server to the receiving server. - * This makes sure that client and server are in a known state. - * Implements RFC 821: HELO - * and RFC 2821 EHLO. - * @param string $host The host name or IP to connect to - * @access public - * @return boolean - */ - public function hello($host = '') - { - // Try extended hello first (RFC 2821) - return (bool)($this->sendHello('EHLO', $host) or $this->sendHello('HELO', $host)); - } - - /** - * Send an SMTP HELO or EHLO command. - * Low-level implementation used by hello() - * @see hello() - * @param string $hello The HELO string - * @param string $host The hostname to say we are - * @access protected - * @return boolean - */ - protected function sendHello($hello, $host) - { - $noerror = $this->sendCommand($hello, $hello . ' ' . $host, 250); - $this->helo_rply = $this->last_reply; - return $noerror; - } - - /** - * Send an SMTP MAIL command. - * Starts a mail transaction from the email address specified in - * $from. Returns true if successful or false otherwise. If True - * the mail transaction is started and then one or more recipient - * commands may be called followed by a data command. - * Implements rfc 821: MAIL FROM: - * @param string $from Source address of this message - * @access public - * @return boolean - */ - public function mail($from) - { - $useVerp = ($this->do_verp ? ' XVERP' : ''); - return $this->sendCommand( - 'MAIL FROM', - 'MAIL FROM:<' . $from . '>' . $useVerp, - 250 - ); - } - - /** - * Send an SMTP QUIT command. - * Closes the socket if there is no error or the $close_on_error argument is true. - * Implements from rfc 821: QUIT - * @param boolean $close_on_error Should the connection close if an error occurs? - * @access public - * @return boolean - */ - public function quit($close_on_error = true) - { - $noerror = $this->sendCommand('QUIT', 'QUIT', 221); - $err = $this->error; //Save any error - if ($noerror or $close_on_error) { - $this->close(); - $this->error = $err; //Restore any error from the quit command - } - return $noerror; - } - - /** - * Send an SMTP RCPT command. - * Sets the TO argument to $toaddr. - * Returns true if the recipient was accepted false if it was rejected. - * Implements from rfc 821: RCPT TO: - * @param string $toaddr The address the message is being sent to - * @access public - * @return boolean - */ - public function recipient($toaddr) - { - return $this->sendCommand( - 'RCPT TO', - 'RCPT TO:<' . $toaddr . '>', - array(250, 251) - ); - } - - /** - * Send an SMTP RSET command. - * Abort any transaction that is currently in progress. - * Implements rfc 821: RSET - * @access public - * @return boolean True on success. - */ - public function reset() - { - return $this->sendCommand('RSET', 'RSET', 250); - } - - /** - * Send a command to an SMTP server and check its return code. - * @param string $command The command name - not sent to the server - * @param string $commandstring The actual command to send - * @param integer|array $expect One or more expected integer success codes - * @access protected - * @return boolean True on success. - */ - protected function sendCommand($command, $commandstring, $expect) - { - if (!$this->connected()) { - $this->error = array( - 'error' => "Called $command without being connected" - ); - return false; - } - $this->client_send($commandstring . self::CRLF); - - $this->last_reply = $this->get_lines(); - $code = substr($this->last_reply, 0, 3); - - $this->edebug('SERVER -> CLIENT: ' . $this->last_reply, self::DEBUG_SERVER); - - if (!in_array($code, (array)$expect)) { - $this->error = array( - 'error' => "$command command failed", - 'smtp_code' => $code, - 'detail' => substr($this->last_reply, 4) - ); - $this->edebug( - 'SMTP ERROR: ' . $this->error['error'] . ': ' . $this->last_reply, - self::DEBUG_CLIENT - ); - return false; - } - - $this->error = array(); - return true; - } - - /** - * Send an SMTP SAML command. - * Starts a mail transaction from the email address specified in $from. - * Returns true if successful or false otherwise. If True - * the mail transaction is started and then one or more recipient - * commands may be called followed by a data command. This command - * will send the message to the users terminal if they are logged - * in and send them an email. - * Implements rfc 821: SAML FROM: - * @param string $from The address the message is from - * @access public - * @return boolean - */ - public function sendAndMail($from) - { - return $this->sendCommand('SAML', "SAML FROM:$from", 250); - } - - /** - * Send an SMTP VRFY command. - * @param string $name The name to verify - * @access public - * @return boolean - */ - public function verify($name) - { - return $this->sendCommand('VRFY', "VRFY $name", array(250, 251)); - } - - /** - * Send an SMTP NOOP command. - * Used to keep keep-alives alive, doesn't actually do anything - * @access public - * @return boolean - */ - public function noop() - { - return $this->sendCommand('NOOP', 'NOOP', 250); - } - - /** - * Send an SMTP TURN command. - * This is an optional command for SMTP that this class does not support. - * This method is here to make the RFC821 Definition complete for this class - * and _may_ be implemented in future - * Implements from rfc 821: TURN - * @access public - * @return boolean - */ - public function turn() - { - $this->error = array( - 'error' => 'The SMTP TURN command is not implemented' - ); - $this->edebug('SMTP NOTICE: ' . $this->error['error'], self::DEBUG_CLIENT); - return false; - } - - /** - * Send raw data to the server. - * @param string $data The data to send - * @access public - * @return integer|boolean The number of bytes sent to the server or false on error - */ - public function client_send($data) - { - $this->edebug("CLIENT -> SERVER: $data", self::DEBUG_CLIENT); - return fwrite($this->smtp_conn, $data); - } - - /** - * Get the latest error. - * @access public - * @return array - */ - public function getError() - { - return $this->error; - } - - /** - * Get the last reply from the server. - * @access public - * @return string - */ - public function getLastReply() - { - return $this->last_reply; - } - - /** - * Read the SMTP server's response. - * Either before eof or socket timeout occurs on the operation. - * With SMTP we can tell if we have more lines to read if the - * 4th character is '-' symbol. If it is a space then we don't - * need to read anything else. - * @access protected - * @return string - */ - protected function get_lines() - { - // If the connection is bad, give up straight away - if (!is_resource($this->smtp_conn)) { - return ''; - } - $data = ''; - $endtime = 0; - stream_set_timeout($this->smtp_conn, $this->Timeout); - if ($this->Timelimit > 0) { - $endtime = time() + $this->Timelimit; - } - while (is_resource($this->smtp_conn) && !feof($this->smtp_conn)) { - $str = @fgets($this->smtp_conn, 515); - $this->edebug("SMTP -> get_lines(): \$data was \"$data\"", self::DEBUG_LOWLEVEL); - $this->edebug("SMTP -> get_lines(): \$str is \"$str\"", self::DEBUG_LOWLEVEL); - $data .= $str; - $this->edebug("SMTP -> get_lines(): \$data is \"$data\"", self::DEBUG_LOWLEVEL); - // If 4th character is a space, we are done reading, break the loop, micro-optimisation over strlen - if ((isset($str[3]) and $str[3] == ' ')) { - break; - } - // Timed-out? Log and break - $info = stream_get_meta_data($this->smtp_conn); - if ($info['timed_out']) { - $this->edebug( - 'SMTP -> get_lines(): timed-out (' . $this->Timeout . ' sec)', - self::DEBUG_LOWLEVEL - ); - break; - } - // Now check if reads took too long - if ($endtime and time() > $endtime) { - $this->edebug( - 'SMTP -> get_lines(): timelimit reached (' . - $this->Timelimit . ' sec)', - self::DEBUG_LOWLEVEL - ); - break; - } - } - return $data; - } - - /** - * Enable or disable VERP address generation. - * @param boolean $enabled - */ - public function setVerp($enabled = false) - { - $this->do_verp = $enabled; - } - - /** - * Get VERP address generation mode. - * @return boolean - */ - public function getVerp() - { - return $this->do_verp; - } - - /** - * Set debug output method. - * @param string $method The function/method to use for debugging output. - */ - public function setDebugOutput($method = 'echo') - { - $this->Debugoutput = $method; - } - - /** - * Get debug output method. - * @return string - */ - public function getDebugOutput() - { - return $this->Debugoutput; - } - - /** - * Set debug output level. - * @param integer $level - */ - public function setDebugLevel($level = 0) - { - $this->do_debug = $level; - } - - /** - * Get debug output level. - * @return integer - */ - public function getDebugLevel() - { - return $this->do_debug; - } - - /** - * Set SMTP timeout. - * @param integer $timeout - */ - public function setTimeout($timeout = 0) - { - $this->Timeout = $timeout; - } - - /** - * Get SMTP timeout. - * @return integer - */ - public function getTimeout() - { - return $this->Timeout; - } -} diff --git a/cadline/backend/maintenance/libraries/phpmailer/composer.json b/cadline/backend/maintenance/libraries/phpmailer/composer.json deleted file mode 100644 index 8050bd06..00000000 --- a/cadline/backend/maintenance/libraries/phpmailer/composer.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "name": "phpmailer/phpmailer", - "type": "library", - "description": "PHPMailer is a full-featured email creation and transfer class for PHP", - "authors": [ - { - "name": "Marcus Bointon", - "email": "phpmailer@synchromedia.co.uk" - }, - { - "name": "Jim Jagielski", - "email": "jimjag@gmail.com" - }, - { - "name": "Andy Prevost", - "email": "codeworxtech@users.sourceforge.net" - }, - { - "name": "Brent R. Matzelle" - } - ], - "require": { - "php": ">=5.0.0" - }, - "require-dev": { - "phpdocumentor/phpdocumentor": "*", - "phpunit/phpunit": "4.1.*" - }, - "autoload": { - "classmap": [ - "class.phpmailer.php", - "class.pop3.php", - "class.smtp.php" - ] - }, - "license": "LGPL-2.1" -} \ No newline at end of file diff --git a/cadline/backend/maintenance/libraries/phpmailer/extras/EasyPeasyICS.php b/cadline/backend/maintenance/libraries/phpmailer/extras/EasyPeasyICS.php deleted file mode 100644 index ff67677f..00000000 --- a/cadline/backend/maintenance/libraries/phpmailer/extras/EasyPeasyICS.php +++ /dev/null @@ -1,93 +0,0 @@ -calendarName = $calendarName; - } //function - - - /** - * Add event to calendar - * @param string $calendarName - */ - public function addEvent($start, $end, $summary = "", $description = "", $url = "") - { - $this->events[] = array( - "start" => $start, - "end" => $end, - "summary" => $summary, - "description" => $description, - "url" => $url - ); - } //function - - - public function render($output = true) - { - - //start Variable - $ics = ""; - - //Add header - $ics .= "BEGIN:VCALENDAR -METHOD:PUBLISH -VERSION:2.0 -X-WR-CALNAME:" . $this->calendarName . " -PRODID:-//hacksw/handcal//NONSGML v1.0//EN"; - - //Add events - foreach ($this->events as $event) { - $ics .= " -BEGIN:VEVENT -UID:" . md5(uniqid(mt_rand(), true)) . "@EasyPeasyICS.php -DTSTAMP:" . gmdate('Ymd') . 'T' . gmdate('His') . "Z -DTSTART:" . gmdate('Ymd', $event["start"]) . "T" . gmdate('His', $event["start"]) . "Z -DTEND:" . gmdate('Ymd', $event["end"]) . "T" . gmdate('His', $event["end"]) . "Z -SUMMARY:" . str_replace("\n", "\\n", $event['summary']) . " -DESCRIPTION:" . str_replace("\n", "\\n", $event['description']) . " -URL;VALUE=URI:" . $event['url'] . " -END:VEVENT"; - } //foreach - - - //Footer - $ics .= " -END:VCALENDAR"; - - - if ($output) { - //Output - header('Content-type: text/calendar; charset=utf-8'); - header('Content-Disposition: inline; filename=' . $this->calendarName . '.ics'); - echo $ics; - } else { - return $ics; - } - } //function - -}//class \ No newline at end of file diff --git a/cadline/backend/maintenance/libraries/phpmailer/extras/README.md b/cadline/backend/maintenance/libraries/phpmailer/extras/README.md deleted file mode 100644 index f3b66042..00000000 --- a/cadline/backend/maintenance/libraries/phpmailer/extras/README.md +++ /dev/null @@ -1,21 +0,0 @@ -#PHPMailer Extras - -These classes provide optional additional functions to PHPMailer. - -These are not loaded by the PHPMailer autoloader, so in some cases you may need to `require` them yourself before using them. - -##HTML2Text - -This class was written by Jon Abernathy and provides a simple conversion of HTML to plain-text, while attempting to preserve some aspects of the formatting. It is used in PHPMailer if you set the `advanced` parameter to `true` in either the `msgHTML()` or `html2text` methods of PHPMailer. - -##EasyPeasyICS - -This class was originally written by Manuel Reinhard and provides a simple means of generating ICS/vCal files that are used in sending calendar events. PHPMailer does not use it diorectly, but you can use it to generate content appropriate for placing in the `Ical` property of PHPMailer. The PHPMailer project is now its official home as Manuel has given permission for that and is no longer maintaining it himself. - -##htmlfilter - -This class by Konstantin Riabitsev and Jim Jagielski implements HTML filtering to remove potentially malicious tags, such as ` - - - - - \ No newline at end of file diff --git a/cadline/backend/maintenance/tests/scripts/jquery-1.11.1.min.js b/cadline/backend/maintenance/tests/scripts/jquery-1.11.1.min.js deleted file mode 100644 index ae4aecff..00000000 --- a/cadline/backend/maintenance/tests/scripts/jquery-1.11.1.min.js +++ /dev/null @@ -1,4 +0,0 @@ -/*! jQuery v1.11.1 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */ -!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l="1.11.1",m=function(a,b){return new m.fn.init(a,b)},n=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,o=/^-ms-/,p=/-([\da-z])/gi,q=function(a,b){return b.toUpperCase()};m.fn=m.prototype={jquery:l,constructor:m,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=m.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return m.each(this,a,b)},map:function(a){return this.pushStack(m.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},m.extend=m.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||m.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(m.isPlainObject(c)||(b=m.isArray(c)))?(b?(b=!1,f=a&&m.isArray(a)?a:[]):f=a&&m.isPlainObject(a)?a:{},g[d]=m.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},m.extend({expando:"jQuery"+(l+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===m.type(a)},isArray:Array.isArray||function(a){return"array"===m.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return!m.isArray(a)&&a-parseFloat(a)>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==m.type(a)||a.nodeType||m.isWindow(a))return!1;try{if(a.constructor&&!j.call(a,"constructor")&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(k.ownLast)for(b in a)return j.call(a,b);for(b in a);return void 0===b||j.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(b){b&&m.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(o,"ms-").replace(p,q)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=r(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(n,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(r(Object(a))?m.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(g)return g.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=r(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(f=a[b],b=a,a=f),m.isFunction(a)?(c=d.call(arguments,2),e=function(){return a.apply(b||this,c.concat(d.call(arguments)))},e.guid=a.guid=a.guid||m.guid++,e):void 0},now:function(){return+new Date},support:k}),m.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function r(a){var b=a.length,c=m.type(a);return"function"===c||m.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var s=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+-new Date,v=a.document,w=0,x=0,y=gb(),z=gb(),A=gb(),B=function(a,b){return a===b&&(l=!0),0},C="undefined",D=1<<31,E={}.hasOwnProperty,F=[],G=F.pop,H=F.push,I=F.push,J=F.slice,K=F.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},L="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",N="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=N.replace("w","w#"),P="\\["+M+"*("+N+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+O+"))|)"+M+"*\\]",Q=":("+N+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+P+")*)|.*)\\)|)",R=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),S=new RegExp("^"+M+"*,"+M+"*"),T=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),U=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),V=new RegExp(Q),W=new RegExp("^"+O+"$"),X={ID:new RegExp("^#("+N+")"),CLASS:new RegExp("^\\.("+N+")"),TAG:new RegExp("^("+N.replace("w","w*")+")"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+Q),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+L+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ab=/[+~]/,bb=/'|\\/g,cb=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),db=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)};try{I.apply(F=J.call(v.childNodes),v.childNodes),F[v.childNodes.length].nodeType}catch(eb){I={apply:F.length?function(a,b){H.apply(a,J.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function fb(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],!a||"string"!=typeof a)return d;if(1!==(k=b.nodeType)&&9!==k)return[];if(p&&!e){if(f=_.exec(a))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return I.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName&&b.getElementsByClassName)return I.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=9===k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(bb,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+qb(o[l]);w=ab.test(a)&&ob(b.parentNode)||b,x=o.join(",")}if(x)try{return I.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function gb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function hb(a){return a[u]=!0,a}function ib(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function jb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function kb(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||D)-(~a.sourceIndex||D);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function lb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function mb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function nb(a){return hb(function(b){return b=+b,hb(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function ob(a){return a&&typeof a.getElementsByTagName!==C&&a}c=fb.support={},f=fb.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=fb.setDocument=function(a){var b,e=a?a.ownerDocument||a:v,g=e.defaultView;return e!==n&&9===e.nodeType&&e.documentElement?(n=e,o=e.documentElement,p=!f(e),g&&g!==g.top&&(g.addEventListener?g.addEventListener("unload",function(){m()},!1):g.attachEvent&&g.attachEvent("onunload",function(){m()})),c.attributes=ib(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ib(function(a){return a.appendChild(e.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(e.getElementsByClassName)&&ib(function(a){return a.innerHTML="
        ",a.firstChild.className="i",2===a.getElementsByClassName("i").length}),c.getById=ib(function(a){return o.appendChild(a).id=u,!e.getElementsByName||!e.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if(typeof b.getElementById!==C&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){var c=typeof a.getAttributeNode!==C&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==C?b.getElementsByTagName(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return typeof b.getElementsByClassName!==C&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(e.querySelectorAll))&&(ib(function(a){a.innerHTML="",a.querySelectorAll("[msallowclip^='']").length&&q.push("[*^$]="+M+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+M+"*(?:value|"+L+")"),a.querySelectorAll(":checked").length||q.push(":checked")}),ib(function(a){var b=e.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+M+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ib(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",Q)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===e||a.ownerDocument===v&&t(v,a)?-1:b===e||b.ownerDocument===v&&t(v,b)?1:k?K.call(k,a)-K.call(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,f=a.parentNode,g=b.parentNode,h=[a],i=[b];if(!f||!g)return a===e?-1:b===e?1:f?-1:g?1:k?K.call(k,a)-K.call(k,b):0;if(f===g)return kb(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?kb(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},e):n},fb.matches=function(a,b){return fb(a,null,null,b)},fb.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return fb(b,n,null,[a]).length>0},fb.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},fb.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&E.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},fb.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},fb.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=fb.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=fb.selectors={cacheLength:50,createPseudo:hb,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(cb,db),a[3]=(a[3]||a[4]||a[5]||"").replace(cb,db),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||fb.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&fb.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(cb,db).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+M+")"+a+"("+M+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==C&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=fb.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||fb.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?hb(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=K.call(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:hb(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?hb(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:hb(function(a){return function(b){return fb(a,b).length>0}}),contains:hb(function(a){return function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:hb(function(a){return W.test(a||"")||fb.error("unsupported lang: "+a),a=a.replace(cb,db).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:nb(function(){return[0]}),last:nb(function(a,b){return[b-1]}),eq:nb(function(a,b,c){return[0>c?c+b:c]}),even:nb(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:nb(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:nb(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:nb(function(a,b,c){for(var d=0>c?c+b:c;++db;b++)d+=a[b].value;return d}function rb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function sb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function tb(a,b,c){for(var d=0,e=b.length;e>d;d++)fb(a,b[d],c);return c}function ub(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function vb(a,b,c,d,e,f){return d&&!d[u]&&(d=vb(d)),e&&!e[u]&&(e=vb(e,f)),hb(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||tb(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ub(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ub(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?K.call(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=ub(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):I.apply(g,r)})}function wb(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=rb(function(a){return a===b},h,!0),l=rb(function(a){return K.call(b,a)>-1},h,!0),m=[function(a,c,d){return!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d))}];f>i;i++)if(c=d.relative[a[i].type])m=[rb(sb(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return vb(i>1&&sb(m),i>1&&qb(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&wb(a.slice(i,e)),f>e&&wb(a=a.slice(e)),f>e&&qb(a))}m.push(c)}return sb(m)}function xb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=G.call(i));s=ub(s)}I.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&fb.uniqueSort(i)}return k&&(w=v,j=t),r};return c?hb(f):f}return h=fb.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=wb(b[c]),f[u]?d.push(f):e.push(f);f=A(a,xb(e,d)),f.selector=a}return f},i=fb.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(cb,db),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(cb,db),ab.test(j[0].type)&&ob(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&qb(j),!a)return I.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,ab.test(a)&&ob(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ib(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ib(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||jb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ib(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||jb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ib(function(a){return null==a.getAttribute("disabled")})||jb(L,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),fb}(a);m.find=s,m.expr=s.selectors,m.expr[":"]=m.expr.pseudos,m.unique=s.uniqueSort,m.text=s.getText,m.isXMLDoc=s.isXML,m.contains=s.contains;var t=m.expr.match.needsContext,u=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,v=/^.[^:#\[\.,]*$/;function w(a,b,c){if(m.isFunction(b))return m.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return m.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(v.test(b))return m.filter(b,a,c);b=m.filter(b,a)}return m.grep(a,function(a){return m.inArray(a,b)>=0!==c})}m.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?m.find.matchesSelector(d,a)?[d]:[]:m.find.matches(a,m.grep(b,function(a){return 1===a.nodeType}))},m.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(m(a).filter(function(){for(b=0;e>b;b++)if(m.contains(d[b],this))return!0}));for(b=0;e>b;b++)m.find(a,d[b],c);return c=this.pushStack(e>1?m.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(w(this,a||[],!1))},not:function(a){return this.pushStack(w(this,a||[],!0))},is:function(a){return!!w(this,"string"==typeof a&&t.test(a)?m(a):a||[],!1).length}});var x,y=a.document,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=m.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||x).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof m?b[0]:b,m.merge(this,m.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:y,!0)),u.test(c[1])&&m.isPlainObject(b))for(c in b)m.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}if(d=y.getElementById(c[2]),d&&d.parentNode){if(d.id!==c[2])return x.find(a);this.length=1,this[0]=d}return this.context=y,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):m.isFunction(a)?"undefined"!=typeof x.ready?x.ready(a):a(m):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),m.makeArray(a,this))};A.prototype=m.fn,x=m(y);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};m.extend({dir:function(a,b,c){var d=[],e=a[b];while(e&&9!==e.nodeType&&(void 0===c||1!==e.nodeType||!m(e).is(c)))1===e.nodeType&&d.push(e),e=e[b];return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),m.fn.extend({has:function(a){var b,c=m(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(m.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=t.test(a)||"string"!=typeof a?m(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&m.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?m.unique(f):f)},index:function(a){return a?"string"==typeof a?m.inArray(this[0],m(a)):m.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(m.unique(m.merge(this.get(),m(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}m.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return m.dir(a,"parentNode")},parentsUntil:function(a,b,c){return m.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return m.dir(a,"nextSibling")},prevAll:function(a){return m.dir(a,"previousSibling")},nextUntil:function(a,b,c){return m.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return m.dir(a,"previousSibling",c)},siblings:function(a){return m.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return m.sibling(a.firstChild)},contents:function(a){return m.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:m.merge([],a.childNodes)}},function(a,b){m.fn[a]=function(c,d){var e=m.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=m.filter(d,e)),this.length>1&&(C[a]||(e=m.unique(e)),B.test(a)&&(e=e.reverse())),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return m.each(a.match(E)||[],function(a,c){b[c]=!0}),b}m.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):m.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(c=a.memory&&l,d=!0,f=g||0,g=0,e=h.length,b=!0;h&&e>f;f++)if(h[f].apply(l[0],l[1])===!1&&a.stopOnFalse){c=!1;break}b=!1,h&&(i?i.length&&j(i.shift()):c?h=[]:k.disable())},k={add:function(){if(h){var d=h.length;!function f(b){m.each(b,function(b,c){var d=m.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&f(c)})}(arguments),b?e=h.length:c&&(g=d,j(c))}return this},remove:function(){return h&&m.each(arguments,function(a,c){var d;while((d=m.inArray(c,h,d))>-1)h.splice(d,1),b&&(e>=d&&e--,f>=d&&f--)}),this},has:function(a){return a?m.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],e=0,this},disable:function(){return h=i=c=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,c||k.disable(),this},locked:function(){return!i},fireWith:function(a,c){return!h||d&&!i||(c=c||[],c=[a,c.slice?c.slice():c],b?i.push(c):j(c)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!d}};return k},m.extend({Deferred:function(a){var b=[["resolve","done",m.Callbacks("once memory"),"resolved"],["reject","fail",m.Callbacks("once memory"),"rejected"],["notify","progress",m.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return m.Deferred(function(c){m.each(b,function(b,f){var g=m.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&m.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?m.extend(a,d):d}},e={};return d.pipe=d.then,m.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&m.isFunction(a.promise)?e:0,g=1===f?a:m.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&m.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;m.fn.ready=function(a){return m.ready.promise().done(a),this},m.extend({isReady:!1,readyWait:1,holdReady:function(a){a?m.readyWait++:m.ready(!0)},ready:function(a){if(a===!0?!--m.readyWait:!m.isReady){if(!y.body)return setTimeout(m.ready);m.isReady=!0,a!==!0&&--m.readyWait>0||(H.resolveWith(y,[m]),m.fn.triggerHandler&&(m(y).triggerHandler("ready"),m(y).off("ready")))}}});function I(){y.addEventListener?(y.removeEventListener("DOMContentLoaded",J,!1),a.removeEventListener("load",J,!1)):(y.detachEvent("onreadystatechange",J),a.detachEvent("onload",J))}function J(){(y.addEventListener||"load"===event.type||"complete"===y.readyState)&&(I(),m.ready())}m.ready.promise=function(b){if(!H)if(H=m.Deferred(),"complete"===y.readyState)setTimeout(m.ready);else if(y.addEventListener)y.addEventListener("DOMContentLoaded",J,!1),a.addEventListener("load",J,!1);else{y.attachEvent("onreadystatechange",J),a.attachEvent("onload",J);var c=!1;try{c=null==a.frameElement&&y.documentElement}catch(d){}c&&c.doScroll&&!function e(){if(!m.isReady){try{c.doScroll("left")}catch(a){return setTimeout(e,50)}I(),m.ready()}}()}return H.promise(b)};var K="undefined",L;for(L in m(k))break;k.ownLast="0"!==L,k.inlineBlockNeedsLayout=!1,m(function(){var a,b,c,d;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",k.inlineBlockNeedsLayout=a=3===b.offsetWidth,a&&(c.style.zoom=1)),c.removeChild(d))}),function(){var a=y.createElement("div");if(null==k.deleteExpando){k.deleteExpando=!0;try{delete a.test}catch(b){k.deleteExpando=!1}}a=null}(),m.acceptData=function(a){var b=m.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute("classid")===b};var M=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,N=/([A-Z])/g;function O(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(N,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:M.test(c)?m.parseJSON(c):c}catch(e){}m.data(a,b,c)}else c=void 0}return c}function P(a){var b;for(b in a)if(("data"!==b||!m.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;return!0}function Q(a,b,d,e){if(m.acceptData(a)){var f,g,h=m.expando,i=a.nodeType,j=i?m.cache:a,k=i?a[h]:a[h]&&h; -if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||m.guid++:h),j[k]||(j[k]=i?{}:{toJSON:m.noop}),("object"==typeof b||"function"==typeof b)&&(e?j[k]=m.extend(j[k],b):j[k].data=m.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[m.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[m.camelCase(b)])):f=g,f}}function R(a,b,c){if(m.acceptData(a)){var d,e,f=a.nodeType,g=f?m.cache:a,h=f?a[m.expando]:m.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){m.isArray(b)?b=b.concat(m.map(b,m.camelCase)):b in d?b=[b]:(b=m.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!P(d):!m.isEmptyObject(d))return}(c||(delete g[h].data,P(g[h])))&&(f?m.cleanData([a],!0):k.deleteExpando||g!=g.window?delete g[h]:g[h]=null)}}}m.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?m.cache[a[m.expando]]:a[m.expando],!!a&&!P(a)},data:function(a,b,c){return Q(a,b,c)},removeData:function(a,b){return R(a,b)},_data:function(a,b,c){return Q(a,b,c,!0)},_removeData:function(a,b){return R(a,b,!0)}}),m.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=m.data(f),1===f.nodeType&&!m._data(f,"parsedAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=m.camelCase(d.slice(5)),O(f,d,e[d])));m._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){m.data(this,a)}):arguments.length>1?this.each(function(){m.data(this,a,b)}):f?O(f,a,m.data(f,a)):void 0},removeData:function(a){return this.each(function(){m.removeData(this,a)})}}),m.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=m._data(a,b),c&&(!d||m.isArray(c)?d=m._data(a,b,m.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=m.queue(a,b),d=c.length,e=c.shift(),f=m._queueHooks(a,b),g=function(){m.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return m._data(a,c)||m._data(a,c,{empty:m.Callbacks("once memory").add(function(){m._removeData(a,b+"queue"),m._removeData(a,c)})})}}),m.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.lengthh;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},W=/^(?:checkbox|radio)$/i;!function(){var a=y.createElement("input"),b=y.createElement("div"),c=y.createDocumentFragment();if(b.innerHTML="
        a",k.leadingWhitespace=3===b.firstChild.nodeType,k.tbody=!b.getElementsByTagName("tbody").length,k.htmlSerialize=!!b.getElementsByTagName("link").length,k.html5Clone="<:nav>"!==y.createElement("nav").cloneNode(!0).outerHTML,a.type="checkbox",a.checked=!0,c.appendChild(a),k.appendChecked=a.checked,b.innerHTML="",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue,c.appendChild(b),b.innerHTML="",k.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,k.noCloneEvent=!0,b.attachEvent&&(b.attachEvent("onclick",function(){k.noCloneEvent=!1}),b.cloneNode(!0).click()),null==k.deleteExpando){k.deleteExpando=!0;try{delete b.test}catch(d){k.deleteExpando=!1}}}(),function(){var b,c,d=y.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(k[b+"Bubbles"]=c in a)||(d.setAttribute(c,"t"),k[b+"Bubbles"]=d.attributes[c].expando===!1);d=null}();var X=/^(?:input|select|textarea)$/i,Y=/^key/,Z=/^(?:mouse|pointer|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=/^([^.]*)(?:\.(.+)|)$/;function ab(){return!0}function bb(){return!1}function cb(){try{return y.activeElement}catch(a){}}m.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=m.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return typeof m===K||a&&m.event.triggered===a.type?void 0:m.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(E)||[""],h=b.length;while(h--)f=_.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=m.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=m.event.special[o]||{},l=m.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&m.expr.match.needsContext.test(e),namespace:p.join(".")},i),(n=g[o])||(n=g[o]=[],n.delegateCount=0,j.setup&&j.setup.call(a,d,p,k)!==!1||(a.addEventListener?a.addEventListener(o,k,!1):a.attachEvent&&a.attachEvent("on"+o,k))),j.add&&(j.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),e?n.splice(n.delegateCount++,0,l):n.push(l),m.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m.hasData(a)&&m._data(a);if(r&&(k=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=_.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=m.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,n=k[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=n.length;while(f--)g=n[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(n.splice(f,1),g.selector&&n.delegateCount--,l.remove&&l.remove.call(a,g));i&&!n.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||m.removeEvent(a,o,r.handle),delete k[o])}else for(o in k)m.event.remove(a,o+b[j],c,d,!0);m.isEmptyObject(k)&&(delete r.handle,m._removeData(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,l,n,o=[d||y],p=j.call(b,"type")?b.type:b,q=j.call(b,"namespace")?b.namespace.split("."):[];if(h=l=d=d||y,3!==d.nodeType&&8!==d.nodeType&&!$.test(p+m.event.triggered)&&(p.indexOf(".")>=0&&(q=p.split("."),p=q.shift(),q.sort()),g=p.indexOf(":")<0&&"on"+p,b=b[m.expando]?b:new m.Event(p,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=q.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:m.makeArray(c,[b]),k=m.event.special[p]||{},e||!k.trigger||k.trigger.apply(d,c)!==!1)){if(!e&&!k.noBubble&&!m.isWindow(d)){for(i=k.delegateType||p,$.test(i+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),l=h;l===(d.ownerDocument||y)&&o.push(l.defaultView||l.parentWindow||a)}n=0;while((h=o[n++])&&!b.isPropagationStopped())b.type=n>1?i:k.bindType||p,f=(m._data(h,"events")||{})[b.type]&&m._data(h,"handle"),f&&f.apply(h,c),f=g&&h[g],f&&f.apply&&m.acceptData(h)&&(b.result=f.apply(h,c),b.result===!1&&b.preventDefault());if(b.type=p,!e&&!b.isDefaultPrevented()&&(!k._default||k._default.apply(o.pop(),c)===!1)&&m.acceptData(d)&&g&&d[p]&&!m.isWindow(d)){l=d[g],l&&(d[g]=null),m.event.triggered=p;try{d[p]()}catch(r){}m.event.triggered=void 0,l&&(d[g]=l)}return b.result}},dispatch:function(a){a=m.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(m._data(this,"events")||{})[a.type]||[],k=m.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=m.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,g=0;while((e=f.handlers[g++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(e.namespace))&&(a.handleObj=e,a.data=e.data,c=((m.event.special[e.origType]||{}).handle||e.handler).apply(f.elem,i),void 0!==c&&(a.result=c)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(e=[],f=0;h>f;f++)d=b[f],c=d.selector+" ",void 0===e[c]&&(e[c]=d.needsContext?m(c,this).index(i)>=0:m.find(c,this,null,[i]).length),e[c]&&e.push(d);e.length&&g.push({elem:i,handlers:e})}return h]","i"),hb=/^\s+/,ib=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,jb=/<([\w:]+)/,kb=/\s*$/g,rb={option:[1,""],legend:[1,"
        ","
        "],area:[1,"",""],param:[1,"",""],thead:[1,"","
        "],tr:[2,"","
        "],col:[2,"","
        "],td:[3,"","
        "],_default:k.htmlSerialize?[0,"",""]:[1,"X
        ","
        "]},sb=db(y),tb=sb.appendChild(y.createElement("div"));rb.optgroup=rb.option,rb.tbody=rb.tfoot=rb.colgroup=rb.caption=rb.thead,rb.th=rb.td;function ub(a,b){var c,d,e=0,f=typeof a.getElementsByTagName!==K?a.getElementsByTagName(b||"*"):typeof a.querySelectorAll!==K?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||m.nodeName(d,b)?f.push(d):m.merge(f,ub(d,b));return void 0===b||b&&m.nodeName(a,b)?m.merge([a],f):f}function vb(a){W.test(a.type)&&(a.defaultChecked=a.checked)}function wb(a,b){return m.nodeName(a,"table")&&m.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function xb(a){return a.type=(null!==m.find.attr(a,"type"))+"/"+a.type,a}function yb(a){var b=pb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function zb(a,b){for(var c,d=0;null!=(c=a[d]);d++)m._data(c,"globalEval",!b||m._data(b[d],"globalEval"))}function Ab(a,b){if(1===b.nodeType&&m.hasData(a)){var c,d,e,f=m._data(a),g=m._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)m.event.add(b,c,h[c][d])}g.data&&(g.data=m.extend({},g.data))}}function Bb(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!k.noCloneEvent&&b[m.expando]){e=m._data(b);for(d in e.events)m.removeEvent(b,d,e.handle);b.removeAttribute(m.expando)}"script"===c&&b.text!==a.text?(xb(b).text=a.text,yb(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),k.html5Clone&&a.innerHTML&&!m.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&W.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}}m.extend({clone:function(a,b,c){var d,e,f,g,h,i=m.contains(a.ownerDocument,a);if(k.html5Clone||m.isXMLDoc(a)||!gb.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(tb.innerHTML=a.outerHTML,tb.removeChild(f=tb.firstChild)),!(k.noCloneEvent&&k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||m.isXMLDoc(a)))for(d=ub(f),h=ub(a),g=0;null!=(e=h[g]);++g)d[g]&&Bb(e,d[g]);if(b)if(c)for(h=h||ub(a),d=d||ub(f),g=0;null!=(e=h[g]);g++)Ab(e,d[g]);else Ab(a,f);return d=ub(f,"script"),d.length>0&&zb(d,!i&&ub(a,"script")),d=h=e=null,f},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,l,n=a.length,o=db(b),p=[],q=0;n>q;q++)if(f=a[q],f||0===f)if("object"===m.type(f))m.merge(p,f.nodeType?[f]:f);else if(lb.test(f)){h=h||o.appendChild(b.createElement("div")),i=(jb.exec(f)||["",""])[1].toLowerCase(),l=rb[i]||rb._default,h.innerHTML=l[1]+f.replace(ib,"<$1>")+l[2],e=l[0];while(e--)h=h.lastChild;if(!k.leadingWhitespace&&hb.test(f)&&p.push(b.createTextNode(hb.exec(f)[0])),!k.tbody){f="table"!==i||kb.test(f)?""!==l[1]||kb.test(f)?0:h:h.firstChild,e=f&&f.childNodes.length;while(e--)m.nodeName(j=f.childNodes[e],"tbody")&&!j.childNodes.length&&f.removeChild(j)}m.merge(p,h.childNodes),h.textContent="";while(h.firstChild)h.removeChild(h.firstChild);h=o.lastChild}else p.push(b.createTextNode(f));h&&o.removeChild(h),k.appendChecked||m.grep(ub(p,"input"),vb),q=0;while(f=p[q++])if((!d||-1===m.inArray(f,d))&&(g=m.contains(f.ownerDocument,f),h=ub(o.appendChild(f),"script"),g&&zb(h),c)){e=0;while(f=h[e++])ob.test(f.type||"")&&c.push(f)}return h=null,o},cleanData:function(a,b){for(var d,e,f,g,h=0,i=m.expando,j=m.cache,l=k.deleteExpando,n=m.event.special;null!=(d=a[h]);h++)if((b||m.acceptData(d))&&(f=d[i],g=f&&j[f])){if(g.events)for(e in g.events)n[e]?m.event.remove(d,e):m.removeEvent(d,e,g.handle);j[f]&&(delete j[f],l?delete d[i]:typeof d.removeAttribute!==K?d.removeAttribute(i):d[i]=null,c.push(f))}}}),m.fn.extend({text:function(a){return V(this,function(a){return void 0===a?m.text(this):this.empty().append((this[0]&&this[0].ownerDocument||y).createTextNode(a))},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?m.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||m.cleanData(ub(c)),c.parentNode&&(b&&m.contains(c.ownerDocument,c)&&zb(ub(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){1===a.nodeType&&m.cleanData(ub(a,!1));while(a.firstChild)a.removeChild(a.firstChild);a.options&&m.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return m.clone(this,a,b)})},html:function(a){return V(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a)return 1===b.nodeType?b.innerHTML.replace(fb,""):void 0;if(!("string"!=typeof a||mb.test(a)||!k.htmlSerialize&&gb.test(a)||!k.leadingWhitespace&&hb.test(a)||rb[(jb.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(ib,"<$1>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(m.cleanData(ub(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,m.cleanData(ub(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,n=this,o=l-1,p=a[0],q=m.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&nb.test(p))return this.each(function(c){var d=n.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(i=m.buildFragment(a,this[0].ownerDocument,!1,this),c=i.firstChild,1===i.childNodes.length&&(i=c),c)){for(g=m.map(ub(i,"script"),xb),f=g.length;l>j;j++)d=i,j!==o&&(d=m.clone(d,!0,!0),f&&m.merge(g,ub(d,"script"))),b.call(this[j],d,j);if(f)for(h=g[g.length-1].ownerDocument,m.map(g,yb),j=0;f>j;j++)d=g[j],ob.test(d.type||"")&&!m._data(d,"globalEval")&&m.contains(h,d)&&(d.src?m._evalUrl&&m._evalUrl(d.src):m.globalEval((d.text||d.textContent||d.innerHTML||"").replace(qb,"")));i=c=null}return this}}),m.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){m.fn[a]=function(a){for(var c,d=0,e=[],g=m(a),h=g.length-1;h>=d;d++)c=d===h?this:this.clone(!0),m(g[d])[b](c),f.apply(e,c.get());return this.pushStack(e)}});var Cb,Db={};function Eb(b,c){var d,e=m(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:m.css(e[0],"display");return e.detach(),f}function Fb(a){var b=y,c=Db[a];return c||(c=Eb(a,b),"none"!==c&&c||(Cb=(Cb||m("