From 32a9bc030527394e09fc83c7ade31e50de19666d Mon Sep 17 00:00:00 2001 From: Sergey <31823239+SeAnSolovev@users.noreply.github.com> Date: Sun, 5 Mar 2023 16:59:34 +0300 Subject: [PATCH] Minor fixes --- acp/index.php | 66 +- system/acp/distributor.php | 56 +- system/acp/engine/addons.php | 50 +- system/acp/engine/boost.php | 52 +- system/acp/engine/cashback.php | 84 +- system/acp/engine/control.php | 46 +- system/acp/engine/hosting.php | 10 +- system/acp/engine/index.php | 134 +- system/acp/engine/jobs.php | 42 +- system/acp/engine/letter.php | 32 +- system/acp/engine/logs.php | 44 +- system/acp/engine/news.php | 38 +- system/acp/engine/notice.php | 40 +- system/acp/engine/pages.php | 34 +- system/acp/engine/promo.php | 46 +- system/acp/engine/servers.php | 94 +- system/acp/engine/system.php | 80 +- system/acp/engine/tarifs.php | 42 +- system/acp/engine/units.php | 42 +- system/acp/engine/users.php | 58 +- system/acp/engine/web.php | 82 +- system/acp/engine/wiki.php | 40 +- system/acp/sections/addons/addcat.php | 66 +- system/acp/sections/addons/addpl.php | 534 +- system/acp/sections/addons/cats.php | 38 +- system/acp/sections/addons/delete.php | 96 +- system/acp/sections/addons/index.php | 94 +- system/acp/sections/addons/plugin.php | 538 +- system/acp/sections/addons/search.php | 108 +- system/acp/sections/addons/update.php | 506 +- system/acp/sections/addons/updmp.php | 102 +- system/acp/sections/boost/index.php | 108 +- system/acp/sections/boost/search.php | 112 +- system/acp/sections/boost/service.php | 108 +- system/acp/sections/control/delete.php | 8 +- system/acp/sections/control/index.php | 86 +- system/acp/sections/control/overdue.php | 58 +- system/acp/sections/control/search.php | 154 +- system/acp/sections/control/server.php | 168 +- system/acp/sections/jobs/add.php | 42 +- system/acp/sections/jobs/edit.php | 60 +- system/acp/sections/jobs/index.php | 64 +- system/acp/sections/jobs/request.php | 106 +- system/acp/sections/letter/index.php | 36 +- system/acp/sections/letter/send.php | 70 +- system/acp/sections/logs/buy.php | 42 +- system/acp/sections/logs/cashout.php | 42 +- system/acp/sections/logs/extend.php | 42 +- system/acp/sections/logs/index.php | 52 +- system/acp/sections/logs/part.php | 42 +- system/acp/sections/logs/replenish.php | 42 +- system/acp/sections/logs/search.php | 116 +- system/acp/sections/logs/sysearch.php | 120 +- system/acp/sections/news/add.php | 52 +- system/acp/sections/news/delete.php | 8 +- system/acp/sections/news/index.php | 56 +- system/acp/sections/news/news.php | 62 +- system/acp/sections/news/search.php | 92 +- system/acp/sections/notice/add.php | 82 +- system/acp/sections/notice/delete.php | 8 +- system/acp/sections/notice/end.php | 74 +- system/acp/sections/notice/index.php | 74 +- system/acp/sections/notice/notice.php | 120 +- system/acp/sections/notice/search.php | 108 +- system/acp/sections/pages/add.php | 36 +- system/acp/sections/pages/delete.php | 14 +- system/acp/sections/pages/index.php | 50 +- system/acp/sections/pages/page.php | 46 +- system/acp/sections/promo/add.php | 140 +- system/acp/sections/promo/delete.php | 10 +- system/acp/sections/promo/end.php | 66 +- system/acp/sections/promo/index.php | 66 +- system/acp/sections/promo/promo.php | 142 +- system/acp/sections/promo/search.php | 98 +- system/acp/sections/promo/stats.php | 54 +- system/acp/sections/servers/crmp.php | 118 +- system/acp/sections/servers/cs.php | 118 +- system/acp/sections/servers/csgo.php | 118 +- system/acp/sections/servers/css.php | 118 +- system/acp/sections/servers/cssold.php | 118 +- system/acp/sections/servers/delete.php | 8 +- system/acp/sections/servers/index.php | 122 +- system/acp/sections/servers/mc.php | 118 +- system/acp/sections/servers/mta.php | 118 +- system/acp/sections/servers/overdue.php | 70 +- system/acp/sections/servers/samp.php | 118 +- system/acp/sections/servers/search.php | 212 +- system/acp/sections/servers/server.php | 444 +- system/acp/sections/tarifs/add.php | 598 +- system/acp/sections/tarifs/copy.php | 112 +- system/acp/sections/tarifs/delete.php | 14 +- system/acp/sections/tarifs/index.php | 96 +- system/acp/sections/tarifs/search.php | 112 +- system/acp/sections/tarifs/stats.php | 102 +- system/acp/sections/tarifs/tarif.php | 706 +- system/acp/sections/units/add.php | 114 +- system/acp/sections/units/delete.php | 102 +- system/acp/sections/units/index.php | 44 +- system/acp/sections/units/loading.php | 154 +- system/acp/sections/units/stats.php | 94 +- system/acp/sections/units/unit.php | 138 +- system/acp/sections/users/action.php | 262 +- system/acp/sections/users/delete.php | 56 +- system/acp/sections/users/index.php | 90 +- system/acp/sections/users/offline.php | 46 +- system/acp/sections/users/online.php | 52 +- system/acp/sections/users/search.php | 98 +- system/acp/sections/users/signup.php | 44 +- system/acp/sections/users/stats.php | 50 +- system/acp/sections/users/user.php | 200 +- system/acp/sections/web/amxbans.php | 86 +- system/acp/sections/web/astats.php | 86 +- system/acp/sections/web/csbans.php | 86 +- system/acp/sections/web/csstats.php | 86 +- system/acp/sections/web/hosting.php | 86 +- system/acp/sections/web/index.php | 86 +- system/acp/sections/web/mysql.php | 86 +- system/acp/sections/web/psychostats.php | 86 +- system/acp/sections/web/rankme.php | 86 +- system/acp/sections/web/search.php | 134 +- system/acp/sections/web/sourcebans.php | 86 +- system/acp/sections/wiki/add.php | 70 +- system/acp/sections/wiki/addcat.php | 32 +- system/acp/sections/wiki/cat.php | 42 +- system/acp/sections/wiki/cats.php | 36 +- system/acp/sections/wiki/delete.php | 18 +- system/acp/sections/wiki/index.php | 58 +- system/acp/sections/wiki/search.php | 92 +- system/acp/sections/wiki/wiki.php | 84 +- system/data/acpengine.php | 76 +- system/data/boost.php | 32 +- system/data/config.php | 540 +- system/data/engine.php | 336 +- system/data/filedits.php | 318 +- system/data/graph.php | 72 +- system/data/header.php | 46 +- system/data/mail.ini | 98 +- system/data/maps.php | 52 +- system/data/mysql.php | 14 +- system/data/params.php | 420 +- system/data/scfg/crmp.php | 96 +- system/data/scfg/cs.php | 198 +- system/data/scfg/csgo.php | 82 +- system/data/scfg/css.php | 292 +- system/data/scfg/cssold.php | 242 +- system/data/scfg/mc.php | 216 +- system/data/scfg/samp.php | 96 +- system/data/text/error.php | 38 +- system/data/text/input.php | 52 +- system/data/text/logs.php | 40 +- system/data/text/mail.php | 110 +- system/data/text/other.php | 12 +- system/data/text/output.php | 32 +- system/data/text/servers.php | 22 +- system/data/text/syslogs.php | 20 +- system/data/web.php | 1008 +- system/engine/api.php | 62 +- system/engine/api_v1.php | 10 +- system/engine/autocontrol.php | 102 +- system/engine/chat.php | 8 +- system/engine/check.php | 6 +- system/engine/contacts.php | 12 +- system/engine/control.php | 110 +- system/engine/freekassa.php | 120 +- system/engine/graph.php | 86 +- system/engine/help.php | 52 +- system/engine/index.php | 36 +- system/engine/jobs.php | 134 +- system/engine/news.php | 18 +- system/engine/pages.php | 24 +- system/engine/partners.php | 10 +- system/engine/pluginbuy.php | 32 +- system/engine/plugins.php | 250 +- system/engine/replenish.php | 14 +- system/engine/servers.php | 178 +- system/engine/services.php | 40 +- system/engine/unitpay.php | 180 +- system/engine/unitpay_entity.php | 162 +- system/engine/user.php | 36 +- system/engine/webmoney.php | 134 +- system/engine/wiki.php | 14 +- system/library/acpsystem.php | 1104 +- system/library/api.php | 144 +- system/library/control/actions.php | 510 +- system/library/control/control.php | 638 +- system/library/control/cs/action.php | 152 +- system/library/control/cs/rcon.php | 142 +- system/library/control/cs/scan.php | 192 +- system/library/control/csgo/action.php | 368 +- system/library/control/csgo/rcon.php | 144 +- system/library/control/csgo/scan.php | 194 +- system/library/control/css/action.php | 290 +- system/library/control/css/rcon.php | 144 +- system/library/control/css/scan.php | 192 +- system/library/control/cssold/action.php | 154 +- system/library/control/cssold/rcon.php | 144 +- system/library/control/cssold/scan.php | 192 +- system/library/control/plugins.php | 270 +- system/library/control/scans.php | 256 +- system/library/cron.php | 112 +- system/library/cron/control_delete.php | 52 +- system/library/cron/control_install.php | 44 +- system/library/cron/control_scan_servers.php | 150 +- .../cron/control_scan_servers_admins.php | 90 +- .../cron/control_scan_servers_copy.php | 74 +- .../cron/control_scan_servers_down.php | 82 +- .../cron/control_scan_servers_route.php | 138 +- system/library/cron/control_server_action.php | 74 +- system/library/cron/control_server_cron.php | 32 +- system/library/cron/control_server_scan.php | 26 +- system/library/cron/control_threads.php | 86 +- system/library/cron/graph_servers_day.php | 74 +- system/library/cron/graph_servers_hour.php | 42 +- system/library/cron/notice_help.php | 44 +- system/library/cron/notice_help_admin.php | 56 +- system/library/cron/notice_server_overdue.php | 44 +- system/library/cron/preparing_web_delete.php | 26 +- system/library/cron/privileges.php | 130 +- system/library/cron/scan_control.php | 30 +- system/library/cron/scan_servers.php | 208 +- system/library/cron/scan_servers_admins.php | 94 +- system/library/cron/scan_servers_copy.php | 74 +- system/library/cron/scan_servers_down.php | 82 +- system/library/cron/scan_servers_load.php | 132 +- system/library/cron/scan_servers_route.php | 138 +- system/library/cron/scan_servers_stop.php | 74 +- system/library/cron/server_action.php | 74 +- system/library/cron/server_cron.php | 32 +- system/library/cron/server_delete.php | 208 +- system/library/cron/server_scan.php | 26 +- system/library/cron/threads.php | 86 +- system/library/cron/update_address.php | 62 +- system/library/cron/users_recovery_signup.php | 26 +- system/library/cron/web_delete.php | 50 +- system/library/ftp.php | 812 +- system/library/games/actions.php | 454 +- system/library/games/boost.php | 170 +- system/library/games/crmp/action.php | 168 +- system/library/games/crmp/scan.php | 166 +- system/library/games/crmp/service.php | 572 +- system/library/games/crmp/tarif.php | 248 +- system/library/games/cs/action.php | 164 +- system/library/games/cs/rcon.php | 146 +- system/library/games/cs/scan.php | 202 +- system/library/games/cs/service.php | 596 +- system/library/games/cs/tarif.php | 314 +- system/library/games/csgo/action.php | 388 +- system/library/games/csgo/rcon.php | 148 +- system/library/games/csgo/scan.php | 204 +- system/library/games/csgo/service.php | 596 +- system/library/games/csgo/tarif.php | 314 +- system/library/games/css/action.php | 308 +- system/library/games/css/rcon.php | 148 +- system/library/games/css/scan.php | 202 +- system/library/games/css/service.php | 596 +- system/library/games/css/tarif.php | 314 +- system/library/games/cssold/action.php | 162 +- system/library/games/cssold/rcon.php | 148 +- system/library/games/cssold/scan.php | 202 +- system/library/games/cssold/service.php | 610 +- system/library/games/cssold/tarif.php | 336 +- system/library/games/games.php | 1372 +- system/library/games/graph.php | 632 +- system/library/games/graph/pData.php | 1070 +- system/library/games/graph/pDraw.php | 1600 +- system/library/games/graph/pImage.php | 138 +- system/library/games/mc/action.php | 144 +- system/library/games/mc/scan.php | 162 +- system/library/games/mc/service.php | 596 +- system/library/games/mc/tarif.php | 320 +- system/library/games/mta/action.php | 216 +- system/library/games/mta/scan.php | 164 +- system/library/games/mta/service.php | 570 +- system/library/games/mta/tarif.php | 248 +- system/library/games/plugins.php | 270 +- system/library/games/query/BaseSocket.php | 148 +- system/library/games/query/Buffer.php | 142 +- system/library/games/query/GoldSourceRcon.php | 150 +- system/library/games/query/McQuery.php | 148 +- system/library/games/query/MtaQuery.php | 130 +- system/library/games/query/SampQuery.php | 168 +- system/library/games/query/Socket.php | 92 +- system/library/games/query/SourceQuery.php | 692 +- system/library/games/query/SourceRcon.php | 208 +- system/library/games/samp/action.php | 166 +- system/library/games/samp/scan.php | 164 +- system/library/games/samp/service.php | 574 +- system/library/games/samp/tarif.php | 248 +- system/library/games/scans.php | 330 +- system/library/games/services.php | 88 +- system/library/games/tarifs.php | 442 +- system/library/geo.php | 780 +- system/library/help.php | 152 +- system/library/html.php | 252 +- system/library/smtp.php | 6 +- system/library/sql.php | 12 +- system/library/ssh.php | 144 +- system/library/system.php | 2180 +-- system/library/users.php | 68 +- system/library/web/free.php | 730 +- system/library/zip.php | 322 +- system/sections/web/aes/free/connect.php | 36 +- system/sections/web/mysql/free/install.php | 146 +- system/sections/wiki/msearch.php | 216 +- template/acp/all.html | 242 +- template/acp/cashback.html | 14 +- template/acp/css/bootbox.css | 128 +- template/acp/css/jquery.datetimepicker.css | 562 +- template/acp/css/style.css | 204 +- template/acp/js/addons.js | 388 +- template/acp/js/control.js | 288 +- .../acp/js/date/jquery.datetimepicker.full.js | 4744 ++--- template/acp/js/functions.js | 102 +- template/acp/js/letter.js | 78 +- template/acp/js/logs.js | 136 +- template/acp/js/news.js | 178 +- template/acp/js/notice.js | 176 +- template/acp/js/pages.js | 92 +- template/acp/js/promo.js | 220 +- template/acp/js/servers.js | 328 +- template/acp/js/system.js | 106 +- template/acp/js/tarifs.js | 200 +- template/acp/js/units.js | 210 +- template/acp/js/users.js | 262 +- template/acp/js/web.js | 130 +- template/acp/js/wiki.js | 238 +- template/acp/main.html | 152 +- template/acp/pages.html | 2 +- template/acp/sections/addons/addcat.html | 100 +- template/acp/sections/addons/addpl.html | 316 +- template/acp/sections/addons/cats.html | 26 +- template/acp/sections/addons/index.html | 42 +- template/acp/sections/addons/menu.html | 10 +- template/acp/sections/addons/plugin.html | 236 +- template/acp/sections/addons/update.html | 212 +- template/acp/sections/addons/updmp.html | 66 +- template/acp/sections/boost/index.html | 94 +- template/acp/sections/boost/menu.html | 4 +- template/acp/sections/control/index.html | 36 +- template/acp/sections/control/menu.html | 4 +- template/acp/sections/control/server.html | 86 +- template/acp/sections/hosting/menu.html | 4 +- template/acp/sections/jobs/add.html | 102 +- template/acp/sections/jobs/edit.html | 96 +- template/acp/sections/jobs/index.html | 66 +- template/acp/sections/jobs/menu.html | 6 +- template/acp/sections/jobs/request.html | 66 +- template/acp/sections/jobs/request_edit.html | 92 +- template/acp/sections/letter/index.html | 60 +- template/acp/sections/letter/menu.html | 2 +- template/acp/sections/logs/index.html | 34 +- template/acp/sections/logs/logs.html | 34 +- template/acp/sections/logs/menu.html | 12 +- template/acp/sections/news/add.html | 78 +- template/acp/sections/news/index.html | 36 +- template/acp/sections/news/menu.html | 4 +- template/acp/sections/news/news.html | 78 +- template/acp/sections/notice/add.html | 86 +- template/acp/sections/notice/index.html | 32 +- template/acp/sections/notice/menu.html | 6 +- template/acp/sections/notice/notice.html | 64 +- template/acp/sections/pages/add.html | 32 +- template/acp/sections/pages/index.html | 24 +- template/acp/sections/pages/menu.html | 4 +- template/acp/sections/pages/page.html | 32 +- template/acp/sections/promo/add.html | 124 +- template/acp/sections/promo/index.html | 42 +- template/acp/sections/promo/menu.html | 8 +- template/acp/sections/promo/promo.html | 104 +- template/acp/sections/promo/stats.html | 26 +- template/acp/sections/servers/index.html | 38 +- template/acp/sections/servers/menu.html | 18 +- template/acp/sections/servers/overdue.html | 24 +- template/acp/sections/servers/server.html | 184 +- template/acp/sections/system/index.html | 54 +- template/acp/sections/tarifs/add.html | 370 +- template/acp/sections/tarifs/copy.html | 232 +- template/acp/sections/tarifs/index.html | 46 +- template/acp/sections/tarifs/menu.html | 6 +- template/acp/sections/tarifs/stats.html | 28 +- template/acp/sections/tarifs/tarif.html | 232 +- template/acp/sections/units/add.html | 162 +- template/acp/sections/units/index.html | 26 +- template/acp/sections/units/loading.html | 36 +- template/acp/sections/units/menu.html | 8 +- template/acp/sections/units/stats.html | 28 +- template/acp/sections/units/unit.html | 156 +- template/acp/sections/users/index.html | 42 +- template/acp/sections/users/menu.html | 10 +- template/acp/sections/users/offline.html | 26 +- template/acp/sections/users/online.html | 28 +- template/acp/sections/users/signup.html | 24 +- template/acp/sections/users/stats.html | 44 +- template/acp/sections/users/user.html | 236 +- template/acp/sections/web/index.html | 36 +- template/acp/sections/web/menu.html | 14 +- template/acp/sections/wiki/add.html | 64 +- template/acp/sections/wiki/addcat.html | 26 +- template/acp/sections/wiki/cat.html | 26 +- template/acp/sections/wiki/cats.html | 24 +- template/acp/sections/wiki/index.html | 34 +- template/acp/sections/wiki/menu.html | 8 +- template/acp/sections/wiki/wiki.html | 64 +- template/css/bootbox.css | 128 +- template/css/chat.css | 102 +- template/css/date.css | 6 +- template/css/error.css | 76 +- template/css/help.css | 128 +- template/css/img.css | 380 +- template/css/pointer.css | 62 +- template/css/replenish.css | 70 +- template/css/style.css | 1424 +- template/css/switch.css | 110 +- template/css/user.css | 48 +- template/jobs/jobs.html | 134 +- template/js/ace-elements.js | 2 +- template/js/chat.js | 738 +- template/js/functions.js | 150 +- template/js/help.js | 682 +- template/js/jquery.js | 15630 ++++++++-------- template/js/load.js | 12 +- template/js/sections/servers/console.js | 146 +- template/js/sections/servers/copy.js | 162 +- template/js/sections/servers/filetp.js | 520 +- template/js/sections/servers/index.js | 448 +- template/js/sections/servers/maps.js | 320 +- template/js/sections/servers/owners.js | 70 +- template/js/sections/servers/plugins.js | 382 +- template/js/sections/servers/rcon.js | 272 +- template/js/sections/servers/settings.js | 146 +- .../js/sections/servers/settings/admins.js | 330 +- .../sections/servers/settings/admins_css.js | 266 +- template/js/sections/servers/settings/bans.js | 130 +- .../js/sections/servers/settings/crontab.js | 92 +- .../js/sections/servers/settings/firewall.js | 114 +- .../js/sections/servers/settings/start.js | 62 +- template/js/sections/servers/tarif.js | 518 +- template/js/sections/services/crmp.js | 114 +- template/js/sections/services/cs.js | 118 +- template/js/sections/services/csgo.js | 114 +- template/js/sections/services/css.js | 114 +- template/js/sections/services/cssold.js | 114 +- template/js/sections/services/mc.js | 114 +- template/js/sections/services/mta.js | 114 +- template/js/sections/services/privileges.js | 124 +- template/js/sections/services/samp.js | 114 +- template/js/sections/user/auth.js | 62 +- template/js/sections/user/lk.js | 594 +- template/js/sections/user/recovery.js | 56 +- template/js/sections/user/signup.js | 56 +- template/js/sections/web/amxbans.js | 366 +- template/js/sections/web/astats.js | 196 +- template/js/sections/web/csbans.js | 366 +- template/js/sections/web/csstats.js | 386 +- template/js/sections/web/hosting.js | 128 +- template/js/sections/web/mysql.js | 128 +- template/js/sections/web/psychostats.js | 228 +- template/js/sections/web/rankme.js | 366 +- template/js/sections/web/sourcebans.js | 366 +- template/js/servers.js | 400 +- template/js/top.js | 40 +- template/js/wiki.js | 56 +- template/sections/chat/messages_all.html | 6 +- template/sections/check/check.html | 2 +- template/sections/check/list.html | 4 +- template/sections/help/close.html | 28 +- template/sections/help/close/question.html | 46 +- template/sections/help/create.html | 152 +- template/sections/help/dialog.html | 190 +- template/sections/help/dialog/attachment.html | 6 +- template/sections/help/dialog/msg.html | 50 +- template/sections/help/notice.html | 8 +- template/sections/help/open.html | 28 +- template/sections/help/open/question.html | 46 +- template/sections/monitoring/all.html | 132 +- template/sections/monitoring/server.html | 168 +- template/sections/news/list.html | 14 +- template/sections/news/news.html | 14 +- template/sections/servers/crmp/console.html | 82 +- template/sections/servers/crmp/copy.html | 96 +- template/sections/servers/crmp/gmenu.html | 32 +- template/sections/servers/crmp/index.html | 188 +- template/sections/servers/crmp/owners.html | 136 +- template/sections/servers/crmp/settings.html | 88 +- .../servers/crmp/settings/crontab.html | 256 +- .../servers/crmp/settings/oldstart.html | 2 +- .../servers/crmp/settings/servercfg.html | 34 +- .../sections/servers/crmp/settings/start.html | 34 +- template/sections/servers/crmp/vmenu.html | 26 +- template/sections/servers/cs/console.html | 116 +- template/sections/servers/cs/copy.html | 96 +- template/sections/servers/cs/gmenu.html | 34 +- template/sections/servers/cs/index.html | 188 +- .../sections/servers/cs/maps/listing.html | 78 +- template/sections/servers/cs/maps/types.html | 204 +- template/sections/servers/cs/rcon.html | 90 +- template/sections/servers/cs/rcon/player.html | 30 +- template/sections/servers/cs/settings.html | 196 +- .../sections/servers/cs/settings/admins.html | 38 +- .../servers/cs/settings/admins/list.html | 22 +- .../sections/servers/cs/settings/bans.html | 70 +- .../sections/servers/cs/settings/crontab.html | 258 +- .../servers/cs/settings/servercfg.html | 34 +- .../sections/servers/cs/settings/start.html | 196 +- template/sections/servers/cs/top.html | 8 +- template/sections/servers/cs/vmenu.html | 40 +- template/sections/servers/csgo/console.html | 106 +- template/sections/servers/csgo/copy.html | 96 +- template/sections/servers/csgo/gmenu.html | 34 +- template/sections/servers/csgo/index.html | 186 +- .../sections/servers/csgo/maps/listing.html | 78 +- .../servers/csgo/maps/map_server.html | 30 +- .../sections/servers/csgo/maps/types.html | 96 +- template/sections/servers/csgo/owners.html | 160 +- template/sections/servers/csgo/rcon.html | 90 +- .../sections/servers/csgo/rcon/player.html | 32 +- template/sections/servers/csgo/settings.html | 172 +- .../servers/csgo/settings/admins.html | 38 +- .../servers/csgo/settings/admins/list.html | 22 +- .../sections/servers/csgo/settings/bans.html | 70 +- .../servers/csgo/settings/crontab.html | 260 +- .../servers/csgo/settings/servercfg.html | 34 +- .../sections/servers/csgo/settings/start.html | 168 +- template/sections/servers/csgo/vmenu.html | 28 +- template/sections/servers/css/console.html | 106 +- template/sections/servers/css/copy.html | 96 +- template/sections/servers/css/gmenu.html | 34 +- template/sections/servers/css/index.html | 186 +- .../sections/servers/css/maps/listing.html | 78 +- template/sections/servers/css/maps/types.html | 96 +- template/sections/servers/css/owners.html | 160 +- template/sections/servers/css/rcon.html | 90 +- .../sections/servers/css/rcon/player.html | 32 +- template/sections/servers/css/settings.html | 172 +- .../sections/servers/css/settings/admins.html | 38 +- .../servers/css/settings/admins/list.html | 22 +- .../sections/servers/css/settings/bans.html | 70 +- .../servers/css/settings/crontab.html | 260 +- .../servers/css/settings/servercfg.html | 34 +- .../sections/servers/css/settings/start.html | 168 +- template/sections/servers/css/vmenu.html | 28 +- template/sections/servers/cssold/console.html | 106 +- template/sections/servers/cssold/copy.html | 96 +- template/sections/servers/cssold/gmenu.html | 34 +- template/sections/servers/cssold/index.html | 186 +- .../sections/servers/cssold/maps/listing.html | 78 +- .../sections/servers/cssold/maps/types.html | 96 +- template/sections/servers/cssold/owners.html | 160 +- template/sections/servers/cssold/rcon.html | 90 +- .../sections/servers/cssold/rcon/player.html | 32 +- .../sections/servers/cssold/settings.html | 172 +- .../servers/cssold/settings/admins.html | 38 +- .../servers/cssold/settings/admins/list.html | 22 +- .../servers/cssold/settings/bans.html | 70 +- .../servers/cssold/settings/crontab.html | 258 +- .../servers/cssold/settings/servercfg.html | 34 +- .../servers/cssold/settings/start.html | 196 +- template/sections/servers/cssold/vmenu.html | 28 +- .../sections/servers/games/copy/copy.html | 42 +- .../sections/servers/games/copy/list.html | 14 +- .../servers/games/filetp/filetp_back.html | 2 +- .../servers/games/filetp/filetp_find.html | 38 +- .../servers/games/filetp/filetp_list.html | 38 +- .../servers/games/filetp/filetp_logs.html | 12 +- .../servers/games/filetp/filetp_off.html | 24 +- .../servers/games/filetp/filetp_on.html | 208 +- template/sections/servers/games/graph.html | 178 +- template/sections/servers/games/maps.html | 18 +- .../sections/servers/games/maps/install.html | 46 +- .../servers/games/maps/map_install.html | 12 +- .../servers/games/maps/map_search.html | 12 +- .../servers/games/maps/map_server.html | 12 +- .../sections/servers/games/owners/access.html | 4 +- .../sections/servers/games/owners/index.html | 82 +- .../sections/servers/games/owners/owners.html | 8 +- template/sections/servers/games/plugins.html | 92 +- .../servers/games/plugins/category.html | 4 +- .../servers/games/plugins/config.html | 14 +- .../servers/games/plugins/config_list.html | 14 +- .../servers/games/plugins/configs.html | 44 +- .../servers/games/plugins/plugin.html | 22 +- .../servers/games/plugins/plugin_install.html | 24 +- .../servers/games/plugins/search.html | 34 +- .../servers/games/settings/bans_list.html | 4 +- .../servers/games/settings/crontab_list.html | 12 +- .../servers/games/settings/debug.html | 2 +- .../servers/games/settings/edits_list.html | 10 +- .../sections/servers/games/settings/file.html | 12 +- .../servers/games/settings/firewall.html | 112 +- .../servers/games/settings/firewall/list.html | 4 +- .../sections/servers/games/settings/logs.html | 26 +- .../servers/games/settings/logs/list.html | 16 +- .../servers/games/settings/logs/view.html | 2 +- .../games/settings/servercfg_list.html | 10 +- .../servers/games/settings/startlogs.html | 26 +- .../games/settings/startlogs/list.html | 16 +- template/sections/servers/games/tarif.html | 2 +- .../servers/games/tarif/addextend.html | 42 +- .../sections/servers/games/tarif/address.html | 48 +- .../servers/games/tarif/address_extend.html | 42 +- .../sections/servers/games/tarif/extend.html | 76 +- .../servers/games/tarif/extend_address.html | 14 +- .../servers/games/tarif/extend_sp.html | 84 +- .../sections/servers/games/tarif/plan.html | 48 +- .../sections/servers/games/tarif/slots.html | 48 +- .../servers/games/tarif/slots_buy.html | 46 +- .../sections/servers/games/tarif/unit.html | 60 +- .../sections/servers/games/web/block.html | 10 +- template/sections/servers/games/web/list.html | 4 +- .../servers/games/web/list_install.html | 4 +- template/sections/servers/list.html | 68 +- template/sections/servers/mc/console.html | 84 +- template/sections/servers/mc/copy.html | 96 +- template/sections/servers/mc/gmenu.html | 32 +- template/sections/servers/mc/index.html | 184 +- template/sections/servers/mc/owners.html | 144 +- template/sections/servers/mc/settings.html | 110 +- .../sections/servers/mc/settings/crontab.html | 260 +- .../servers/mc/settings/oldstart.html | 2 +- .../servers/mc/settings/servercfg.html | 24 +- .../sections/servers/mc/settings/start.html | 34 +- template/sections/servers/mc/vmenu.html | 26 +- template/sections/servers/mta/console.html | 84 +- template/sections/servers/mta/copy.html | 96 +- template/sections/servers/mta/gmenu.html | 32 +- template/sections/servers/mta/index.html | 188 +- template/sections/servers/mta/owners.html | 136 +- template/sections/servers/mta/settings.html | 126 +- .../servers/mta/settings/crontab.html | 258 +- .../servers/mta/settings/oldstart.html | 2 +- .../servers/mta/settings/servercfg.html | 34 +- .../sections/servers/mta/settings/start.html | 58 +- template/sections/servers/mta/vmenu.html | 26 +- template/sections/servers/players/cs.html | 8 +- template/sections/servers/players/csgo.html | 8 +- template/sections/servers/players/css.html | 8 +- template/sections/servers/players/cssold.html | 8 +- template/sections/servers/players/mc.html | 4 +- template/sections/servers/players/mta.html | 8 +- template/sections/servers/players/samp.html | 8 +- template/sections/servers/samp/console.html | 82 +- template/sections/servers/samp/copy.html | 96 +- template/sections/servers/samp/gmenu.html | 32 +- template/sections/servers/samp/index.html | 188 +- template/sections/servers/samp/owners.html | 136 +- template/sections/servers/samp/settings.html | 110 +- .../servers/samp/settings/crontab.html | 256 +- .../servers/samp/settings/oldstart.html | 2 +- .../servers/samp/settings/servercfg.html | 34 +- .../sections/servers/samp/settings/start.html | 34 +- template/sections/servers/samp/vmenu.html | 26 +- template/sections/servers/servers.html | 8 +- template/sections/services/games/crmp.html | 172 +- template/sections/services/games/cs.html | 188 +- template/sections/services/games/csgo.html | 188 +- template/sections/services/games/css.html | 188 +- template/sections/services/games/cssold.html | 204 +- template/sections/services/games/mc.html | 188 +- template/sections/services/games/mta.html | 172 +- template/sections/services/games/samp.html | 172 +- template/sections/services/index.html | 64 +- template/sections/user/auth.html | 76 +- template/sections/user/gmenu.html | 22 +- template/sections/user/inputs/signup.html | 8 +- template/sections/user/lk/auth.html | 20 +- template/sections/user/lk/auth/list.html | 6 +- template/sections/user/lk/index.html | 178 +- template/sections/user/lk/logs.html | 12 +- template/sections/user/lk/logs/list.html | 8 +- template/sections/user/lk/logs/replenish.html | 8 +- template/sections/user/lk/security.html | 204 +- template/sections/user/lk/security/list.html | 4 +- template/sections/user/lk/settings.html | 86 +- template/sections/user/recovery.html | 52 +- template/sections/user/replenish.html | 150 +- template/sections/user/signup.html | 42 +- template/sections/user/vmenu.html | 16 +- .../sections/web/astats/free/install.html | 58 +- template/sections/web/astats/free/manage.html | 70 +- .../sections/web/csbans/free/install.html | 76 +- template/sections/web/csbans/free/manage.html | 100 +- .../sections/web/csstats/free/install.html | 58 +- .../sections/web/csstats/free/manage.html | 78 +- .../sections/web/hosting/free/install.html | 60 +- .../sections/web/hosting/free/manage.html | 66 +- template/sections/web/mysql/free/install.html | 38 +- template/sections/web/mysql/free/manage.html | 54 +- .../sections/web/sourcebans/free/install.html | 76 +- .../sections/web/sourcebans/free/manage.html | 100 +- 689 files changed, 56051 insertions(+), 56051 deletions(-) diff --git a/acp/index.php b/acp/index.php index c772fee..2d3ebf5 100644 --- a/acp/index.php +++ b/acp/index.php @@ -1,28 +1,28 @@ connect('127.0.0.1', 11211) or exit('Ошибка подключения Memcache'); + $mcache = new Memcache; + $mcache->connect('127.0.0.1', 11211) or exit('Ошибка подключения Memcache'); // Composer if (!file_exists(ROOT.'vendor/autoload.php')) { @@ -30,22 +30,22 @@ } require(ROOT.'vendor/autoload.php'); - // Настройки - include(DATA.'config.php'); - include(DATA.'mysql.php'); - include(DATA.'params.php'); - include(DATA.'acpengine.php'); + // Настройки + include(DATA.'config.php'); + include(DATA.'mysql.php'); + include(DATA.'params.php'); + include(DATA.'acpengine.php'); - // Библиотеки - include(LIB.'sql.php'); - include(LIB.'html.php'); - include(LIB.'acpsystem.php'); + // Библиотеки + include(LIB.'sql.php'); + include(LIB.'html.php'); + include(LIB.'acpsystem.php'); - $uip = sys::ip(); + $uip = sys::ip(); - // Распределитель - include(ACP.'distributor.php'); + // Распределитель + include(ACP.'distributor.php'); - // Выхлоп - echo $html->arr['all']; + // Выхлоп + echo $html->arr['all']; ?> \ No newline at end of file diff --git a/system/acp/distributor.php b/system/acp/distributor.php index 3cbe8ee..18ba2fc 100644 --- a/system/acp/distributor.php +++ b/system/acp/distributor.php @@ -1,8 +1,8 @@ arr['main'])) + if(isset($html->arr['main'])) { - $html->upd( - 'main', + $html->upd( + 'main', array( '[cur]', @@ -78,13 +78,13 @@ $cfg['http'].'template/acp/css/', $cfg['http'].'template/acp/images/' ), - ); - } + ); + } - if(isset($html->arr['menu'])) + if(isset($html->arr['menu'])) { - $html->upd( - 'menu', + $html->upd( + 'menu', array( '[acp]', @@ -101,8 +101,8 @@ $cfg['http'].'template/acp/css/', $cfg['http'].'template/acp/images/' ), - ); - } + ); + } // Заготовка выхлопа $html->get('all'); @@ -114,20 +114,20 @@ $html->set('css', $cfg['http'].'template/acp/css/'); $html->set('img', $cfg['http'].'template/acp/images/'); - if(isset($html->arr['menu'])) - { - $html->unit('section', true); - $html->set('info', $info); - $html->set('menu', $html->arr['menu']); - }else - $html->unit('section'); + if(isset($html->arr['menu'])) + { + $html->unit('section', true); + $html->set('info', $info); + $html->set('menu', $html->arr['menu']); + }else + $html->unit('section'); - $html->unit('p_'.$route, true); + $html->unit('p_'.$route, true); - unset($aRoute[array_search($route, $aRoute)]); + unset($aRoute[array_search($route, $aRoute)]); - foreach($aRoute as $route) - $html->unit('p_'.$route); + foreach($aRoute as $route) + $html->unit('p_'.$route); $html->set('main', isset($html->arr['main']) ? $html->arr['main'] : '', true); diff --git a/system/acp/engine/addons.php b/system/acp/engine/addons.php index 3033eee..4404b40 100644 --- a/system/acp/engine/addons.php +++ b/system/acp/engine/addons.php @@ -1,38 +1,38 @@ Управление дополнениями'; + $info = ' Управление дополнениями'; - $aSection = array( - 'index', - 'update', - 'addcat', - 'addpl', - 'cats', - 'updmp', - 'delete' - ); + $aSection = array( + 'index', + 'update', + 'addcat', + 'addpl', + 'cats', + 'updmp', + 'delete' + ); - if(!in_array($section, $aSection)) - $section = 'index'; + if(!in_array($section, $aSection)) + $section = 'index'; - $html->get('menu', 'sections/addons'); + $html->get('menu', 'sections/addons'); - $html->unit('s_'.$section, true); + $html->unit('s_'.$section, true); - unset($aSection[array_search($section, $aSection)]); + unset($aSection[array_search($section, $aSection)]); - foreach($aSection as $noactive) - $html->unit('s_'.$noactive); + foreach($aSection as $noactive) + $html->unit('s_'.$noactive); - $sql->query('SELECT `id` FROM `plugins_category`'); - $html->set('cats', $sql->num()); + $sql->query('SELECT `id` FROM `plugins_category`'); + $html->set('cats', $sql->num()); - $sql->query('SELECT `id` FROM `plugins`'); - $html->set('plugins', $sql->num()); + $sql->query('SELECT `id` FROM `plugins`'); + $html->set('plugins', $sql->num()); - $html->pack('menu'); + $html->pack('menu'); - include(SEC.'addons/'.$section.'.php'); + include(SEC.'addons/'.$section.'.php'); ?> \ No newline at end of file diff --git a/system/acp/engine/boost.php b/system/acp/engine/boost.php index 6b0200f..597b150 100644 --- a/system/acp/engine/boost.php +++ b/system/acp/engine/boost.php @@ -1,41 +1,41 @@ Статистика BOOST CS: 1.6'; + $info = ' Статистика BOOST CS: 1.6'; - $aSection = $aBoost['cs']['boost']; + $aSection = $aBoost['cs']['boost']; - if($section == 'search') - include(SEC.'boost/search.php'); + if($section == 'search') + include(SEC.'boost/search.php'); - if(!in_array($section, $aSection)) - $section = 'index'; + if(!in_array($section, $aSection)) + $section = 'index'; - $html->get('menu', 'sections/boost'); + $html->get('menu', 'sections/boost'); - $boosts = ''; + $boosts = ''; - if($section != 'index') - $html->unit('s_index'); - else - $html->unit('s_index', true); + if($section != 'index') + $html->unit('s_index'); + else + $html->unit('s_index', true); - foreach($aSection as $service) - { - if($section == $service) - $boosts .= '
  • '.$aBoost['cs'][$section]['site'].'
  • '; - else - $boosts .= '
  • '.$aBoost['cs'][$service]['site'].'
  • '; - } + foreach($aSection as $service) + { + if($section == $service) + $boosts .= '
  • '.$aBoost['cs'][$section]['site'].'
  • '; + else + $boosts .= '
  • '.$aBoost['cs'][$service]['site'].'
  • '; + } - $html->set('boosts', $boosts); + $html->set('boosts', $boosts); - $html->pack('menu'); + $html->pack('menu'); - $inc = $section != 'index' ? 'service' : 'index'; + $inc = $section != 'index' ? 'service' : 'index'; - include(SEC.'boost/'.$inc.'.php'); + include(SEC.'boost/'.$inc.'.php'); ?> \ No newline at end of file diff --git a/system/acp/engine/cashback.php b/system/acp/engine/cashback.php index 4897040..71dea0e 100644 --- a/system/acp/engine/cashback.php +++ b/system/acp/engine/cashback.php @@ -1,61 +1,61 @@ get($nmc)) - sys::outjs(array('e' => $text['mcache']), $nmc); + // Проверка сессии + if($mcache->get($nmc)) + sys::outjs(array('e' => $text['mcache']), $nmc); - // Создание сессии - $mcache->set($nmc, 1, false, 10); + // Создание сессии + $mcache->set($nmc, 1, false, 10); - if($id) - { - $sql->query('SELECT `user`, `money`, `purse`, `status` FROM `cashback` WHERE `id`="'.$id.'" LIMIT 1'); - $cb = $sql->get(); + if($id) + { + $sql->query('SELECT `user`, `money`, `purse`, `status` FROM `cashback` WHERE `id`="'.$id.'" LIMIT 1'); + $cb = $sql->get(); - if(!$cb['status']) - sys::outjs(array('e' => 'Данная заявка уже была обработана'), $nmc); + if(!$cb['status']) + sys::outjs(array('e' => 'Данная заявка уже была обработана'), $nmc); - $purse = $cb['purse']{0} == 'R' ? 'webmoney' : 'qiwi'; + $purse = $cb['purse']{0} == 'R' ? 'webmoney' : 'qiwi'; - // Запрос на шлюз - if($cfg['part_gateway'] == 'unitpay') - { - $sum = $cb['money']-($cb['money']/100*$cfg['part_output_proc']); + // Запрос на шлюз + if($cfg['part_gateway'] == 'unitpay') + { + $sum = $cb['money']-($cb['money']/100*$cfg['part_output_proc']); - $json = file_get_contents('https://unitpay.ru/api?method=massPayment¶ms[sum]='.$sum.'¶ms[purse]='.$cb['purse'].'¶ms[login]='.$cfg['unitpay_mail'].'¶ms[transactionId]='.$id.' ¶ms[secretKey]='.$cfg['unitpay_api'].'¶ms[paymentType]='.$purse); + $json = file_get_contents('https://unitpay.ru/api?method=massPayment¶ms[sum]='.$sum.'¶ms[purse]='.$cb['purse'].'¶ms[login]='.$cfg['unitpay_mail'].'¶ms[transactionId]='.$id.' ¶ms[secretKey]='.$cfg['unitpay_api'].'¶ms[paymentType]='.$purse); - $array = json_decode($json, true); + $array = json_decode($json, true); - // Упешный вывод средств - if(is_array($array) AND isset($array['result']) AND in_array($array['result']['status'], array('success', 'not_completed '))) - { - $sql->query('UPDATE `cashback` set `status`="0" WHERE `id`="'.$id.'" LIMIT 1'); - $sql->query('INSERT INTO `logs` set `user`="'.$cb['user'].'", `text`="'.sys::updtext(sys::text('logs', 'cashback'), - array('purse' => $purse, 'money' => $cb['money'])).'", `date`="'.$start_point.'", `type`="cashback", `money`="'.$cb['money'].'"'); + // Упешный вывод средств + if(is_array($array) AND isset($array['result']) AND in_array($array['result']['status'], array('success', 'not_completed '))) + { + $sql->query('UPDATE `cashback` set `status`="0" WHERE `id`="'.$id.'" LIMIT 1'); + $sql->query('INSERT INTO `logs` set `user`="'.$cb['user'].'", `text`="'.sys::updtext(sys::text('logs', 'cashback'), + array('purse' => $purse, 'money' => $cb['money'])).'", `date`="'.$start_point.'", `type`="cashback", `money`="'.$cb['money'].'"'); - sys::outjs(array('s' => 'Запрос на вывод средств был успешно выполнен'), $nmc); - } + sys::outjs(array('s' => 'Запрос на вывод средств был успешно выполнен'), $nmc); + } - if(!is_array($array)) - sys::outjs(array('e' => 'Неудалось выполнить запрос'), $nmc); + if(!is_array($array)) + sys::outjs(array('e' => 'Неудалось выполнить запрос'), $nmc); - sys::outjs(array('e' => $array['error']['message']), $nmc); - } + sys::outjs(array('e' => $array['error']['message']), $nmc); + } - $sql->query('UPDATE `cashback` set `status`="0" WHERE `id`="'.$id.'" LIMIT 1'); - $sql->query('INSERT INTO `logs` set `user`="'.$cb['user'].'", `text`="'.sys::updtext(sys::text('logs', 'cashback'), - array('purse' => $purse, 'money' => $cb['money'])).'", `date`="'.$start_point.'", `type`="cashback", `money`="'.$cb['money'].'"'); + $sql->query('UPDATE `cashback` set `status`="0" WHERE `id`="'.$id.'" LIMIT 1'); + $sql->query('INSERT INTO `logs` set `user`="'.$cb['user'].'", `text`="'.sys::updtext(sys::text('logs', 'cashback'), + array('purse' => $purse, 'money' => $cb['money'])).'", `date`="'.$start_point.'", `type`="cashback", `money`="'.$cb['money'].'"'); - sys::outjs(array('s' => 'Запрос на вывод средств был успешно выполнен в ручном режиме'), $nmc); - } + sys::outjs(array('s' => 'Запрос на вывод средств был успешно выполнен в ручном режиме'), $nmc); + } - sys::outjs(array('e' => 'Не передан идентификатор заявки'), $nmc); + sys::outjs(array('e' => 'Не передан идентификатор заявки'), $nmc); ?> \ No newline at end of file diff --git a/system/acp/engine/control.php b/system/acp/engine/control.php index a358684..4a11d0b 100644 --- a/system/acp/engine/control.php +++ b/system/acp/engine/control.php @@ -1,37 +1,37 @@ Контроль'; + $info = ' Контроль'; - $aSection = array( - 'index', - 'overdue', - 'delete' - ); + $aSection = array( + 'index', + 'overdue', + 'delete' + ); - if(!in_array($section, $aSection)) - $section = 'index'; + if(!in_array($section, $aSection)) + $section = 'index'; - $del = $cfg['server_delete']*86400; - $time = $start_point-$del; + $del = $cfg['server_delete']*86400; + $time = $start_point-$del; - $html->get('menu', 'sections/control'); + $html->get('menu', 'sections/control'); - $html->unit('s_'.$section, true); + $html->unit('s_'.$section, true); - unset($aSection[array_search($section, $aSection)]); + unset($aSection[array_search($section, $aSection)]); - foreach($aSection as $noactive) - $html->unit('s_'.$noactive); + foreach($aSection as $noactive) + $html->unit('s_'.$noactive); - $sql->query('SELECT `id` FROM `control` WHERE `user`!="-1"'); - $html->set('all', $sql->num()); + $sql->query('SELECT `id` FROM `control` WHERE `user`!="-1"'); + $html->set('all', $sql->num()); - $sql->query('SELECT `id` FROM `control` WHERE `user`!="-1" AND `time`<"'.$start_point.'" AND `overdue`>"'.$time.'"'); - $html->set('overdue', $sql->num()); + $sql->query('SELECT `id` FROM `control` WHERE `user`!="-1" AND `time`<"'.$start_point.'" AND `overdue`>"'.$time.'"'); + $html->set('overdue', $sql->num()); - $html->pack('menu'); + $html->pack('menu'); - include(SEC.'control/'.$section.'.php'); + include(SEC.'control/'.$section.'.php'); ?> \ No newline at end of file diff --git a/system/acp/engine/hosting.php b/system/acp/engine/hosting.php index 1fd8008..a1edc16 100644 --- a/system/acp/engine/hosting.php +++ b/system/acp/engine/hosting.php @@ -1,9 +1,9 @@ Список вирт. хостингов'; + $info = ' Список вирт. хостингов'; - $html->get('menu', 'sections/hosting'); - $html->pack('menu'); + $html->get('menu', 'sections/hosting'); + $html->pack('menu'); ?> \ No newline at end of file diff --git a/system/acp/engine/index.php b/system/acp/engine/index.php index 77d4261..c2578a4 100644 --- a/system/acp/engine/index.php +++ b/system/acp/engine/index.php @@ -1,91 +1,91 @@ arr['main'] = $mcache->get($mcache_name); + $html->arr['main'] = $mcache->get($mcache_name); - $cbs = $sql->query('SELECT * FROM `cashback` WHERE `status`="1" ORDER BY `date` ASC'); - while($cb = $sql->get($cbs)) - { - $sql->query('SELECT `mail` FROM `users` WHERE `id`="'.$cb['user'].'" LIMIT 1'); - $us = $sql->get(); + $cbs = $sql->query('SELECT * FROM `cashback` WHERE `status`="1" ORDER BY `date` ASC'); + while($cb = $sql->get($cbs)) + { + $sql->query('SELECT `mail` FROM `users` WHERE `id`="'.$cb['user'].'" LIMIT 1'); + $us = $sql->get(); - $html->get('cashback'); + $html->get('cashback'); - $html->set('id', $cb['id']); - $html->set('user', $cb['user']); - $html->set('mail', $us['mail']); - $html->set('money', $cb['money'].' '.$cfg['currency']); - $html->set('cashback', ($cb['money']-($cb['money']/100*$cfg['part_output_proc'])).' '.$cfg['currency']); - $html->set('type', $cb['purse'][0] == 'R' ? 'WebMoney' : 'Qiwi'); - $html->set('purse', $cb['purse']); - $html->set('gateway', empty($cfg['part_gateway']) ? 'mm' : 'auto'); - $html->set('date', sys::today($cb['date'])); + $html->set('id', $cb['id']); + $html->set('user', $cb['user']); + $html->set('mail', $us['mail']); + $html->set('money', $cb['money'].' '.$cfg['currency']); + $html->set('cashback', ($cb['money']-($cb['money']/100*$cfg['part_output_proc'])).' '.$cfg['currency']); + $html->set('type', $cb['purse'][0] == 'R' ? 'WebMoney' : 'Qiwi'); + $html->set('purse', $cb['purse']); + $html->set('gateway', empty($cfg['part_gateway']) ? 'mm' : 'auto'); + $html->set('date', sys::today($cb['date'])); - $html->pack('cashback'); - } + $html->pack('cashback'); + } - $html->arr['cashback'] = isset($html->arr['cashback']) ? $html->arr['cashback'] : ''; + $html->arr['cashback'] = isset($html->arr['cashback']) ? $html->arr['cashback'] : ''; - if($html->arr['main'] == '') - { - $sql->query('SELECT `id` FROM `users`'); - $users = $sql->num(); + if($html->arr['main'] == '') + { + $sql->query('SELECT `id` FROM `users`'); + $users = $sql->num(); - $sql->query('SELECT `id`, `game`, `slots` FROM `servers`'); - $servers = $sql->num(); + $sql->query('SELECT `id`, `game`, `slots` FROM `servers`'); + $servers = $sql->num(); - $aSlots = array('cs' => 0, 'cssold' => 0, 'css' => 0, 'csgo' => 0, 'samp' => 0, 'crmp' => 0, 'mta' => 0, 'mc' => 0); - $aServers = array('cs' => 0, 'cssold' => 0, 'css' => 0, 'csgo' => 0, 'samp' => 0, 'crmp' => 0, 'mta' => 0, 'mc' => 0); + $aSlots = array('cs' => 0, 'cssold' => 0, 'css' => 0, 'csgo' => 0, 'samp' => 0, 'crmp' => 0, 'mta' => 0, 'mc' => 0); + $aServers = array('cs' => 0, 'cssold' => 0, 'css' => 0, 'csgo' => 0, 'samp' => 0, 'crmp' => 0, 'mta' => 0, 'mc' => 0); - while($server = $sql->get()) - { - $aSlots[$server['game']] += $server['slots']; - $aServers[$server['game']] += 1; - } + while($server = $sql->get()) + { + $aSlots[$server['game']] += $server['slots']; + $aServers[$server['game']] += 1; + } - $sql->query('SELECT SUM(`money`) FROM `logs` WHERE `type`="replenish"'); - $replenish = $sql->get(); + $sql->query('SELECT SUM(`money`) FROM `logs` WHERE `type`="replenish"'); + $replenish = $sql->get(); - $sf_list = ''; + $sf_list = ''; - $sql->query('SELECT `id`, `name`, `group`, `lastname`, `ip`, `browser`, `time` FROM `users` WHERE `group`!="user" ORDER BY `id` ASC LIMIT 20'); - while($staff = $sql->get()) - { - $online = $staff['time']+15 > $start_point ? 'text-green">Онлайн' : 'text-red">Офлайн'; + $sql->query('SELECT `id`, `name`, `group`, `lastname`, `ip`, `browser`, `time` FROM `users` WHERE `group`!="user" ORDER BY `id` ASC LIMIT 20'); + while($staff = $sql->get()) + { + $online = $staff['time']+15 > $start_point ? 'text-green">Онлайн' : 'text-red">Офлайн'; - $group = $staff['group'] == 'admin' ? 'text-red">Администратор' : '">Тех. Поддержка'; + $group = $staff['group'] == 'admin' ? 'text-red">Администратор' : '">Тех. Поддержка'; - $sf_list .= ''; - $sf_list .= ''.$staff['id'].''; - $sf_list .= ''.$staff['lastname'].' '.$staff['name'].''; - $sf_list .= ''.$staff['ip'].''; - $sf_list .= ''.$staff['browser'].''; - $sf_list .= ''.sys::today($staff['time']).''; - $sf_list .= ''; - } + $sf_list .= ''; + $sf_list .= ''.$staff['id'].''; + $sf_list .= ''.$staff['lastname'].' '.$staff['name'].''; + $sf_list .= ''.$staff['ip'].''; + $sf_list .= ''.$staff['browser'].''; + $sf_list .= ''.sys::today($staff['time']).''; + $sf_list .= ''; + } - $html->get('main'); + $html->get('main'); - $html->set('cashback', $html->arr['cashback']); - $html->set('users', $users); - $html->set('servers', $servers); - $html->set('replenish', $replenish['SUM(`money`)']); - $html->set('staff', $sf_list); + $html->set('cashback', $html->arr['cashback']); + $html->set('users', $users); + $html->set('servers', $servers); + $html->set('replenish', $replenish['SUM(`money`)']); + $html->set('staff', $sf_list); - foreach($aSlots as $game => $slots) - $html->set('slots_'.$game, $slots); + foreach($aSlots as $game => $slots) + $html->set('slots_'.$game, $slots); - foreach($aServers as $game => $num) - $html->set($game, $num); + foreach($aServers as $game => $num) + $html->set($game, $num); - $html->pack('main'); + $html->pack('main'); - $mcache->set($mcache_name, $html->arr['main'], false, 10); - }else - $html->arr['main'] = str_replace('[cashback]', $html->arr['cashback'], $html->arr['main']); + $mcache->set($mcache_name, $html->arr['main'], false, 10); + }else + $html->arr['main'] = str_replace('[cashback]', $html->arr['cashback'], $html->arr['main']); ?> \ No newline at end of file diff --git a/system/acp/engine/jobs.php b/system/acp/engine/jobs.php index 61e2497..5132957 100644 --- a/system/acp/engine/jobs.php +++ b/system/acp/engine/jobs.php @@ -1,32 +1,32 @@ Вакансии'; + $info = ' Вакансии'; - $aSection = array( - 'index', - 'add', - 'request' - ); + $aSection = array( + 'index', + 'add', + 'request' + ); - if(!in_array($section, $aSection)) - $section = 'index'; + if(!in_array($section, $aSection)) + $section = 'index'; - $html->get('menu', 'sections/jobs'); + $html->get('menu', 'sections/jobs'); - $html->unit('s_'.$section, true); + $html->unit('s_'.$section, true); - unset($aSection[array_search($section, $aSection)]); + unset($aSection[array_search($section, $aSection)]); - foreach($aSection as $noactive) - $html->unit('s_'.$noactive); + foreach($aSection as $noactive) + $html->unit('s_'.$noactive); - $sql->query('SELECT `id` FROM `jobs`'); - $html->set('jobs', $sql->num()); - $sql->query('SELECT `id` FROM `jobs_app`'); - $html->set('jobs_app', $sql->num()); - $html->pack('menu'); + $sql->query('SELECT `id` FROM `jobs`'); + $html->set('jobs', $sql->num()); + $sql->query('SELECT `id` FROM `jobs_app`'); + $html->set('jobs_app', $sql->num()); + $html->pack('menu'); - include(SEC.'jobs/'.$section.'.php'); + include(SEC.'jobs/'.$section.'.php'); ?> \ No newline at end of file diff --git a/system/acp/engine/letter.php b/system/acp/engine/letter.php index 0aa4635..c27c89a 100644 --- a/system/acp/engine/letter.php +++ b/system/acp/engine/letter.php @@ -1,27 +1,27 @@ Рассылка новостей'; + $info = ' Рассылка новостей'; - $aSection = array( - 'index', - 'send' - ); + $aSection = array( + 'index', + 'send' + ); - if(!in_array($section, $aSection)) - $section = 'index'; + if(!in_array($section, $aSection)) + $section = 'index'; - $html->get('menu', 'sections/letter'); + $html->get('menu', 'sections/letter'); - $html->unit('s_'.$section, true); + $html->unit('s_'.$section, true); - unset($aSection[array_search($section, $aSection)]); + unset($aSection[array_search($section, $aSection)]); - foreach($aSection as $noactive) - $html->unit('s_'.$noactive); + foreach($aSection as $noactive) + $html->unit('s_'.$noactive); - $html->pack('menu'); + $html->pack('menu'); - include(SEC.'letter/'.$section.'.php'); + include(SEC.'letter/'.$section.'.php'); ?> \ No newline at end of file diff --git a/system/acp/engine/logs.php b/system/acp/engine/logs.php index 09677d4..12ac2e4 100644 --- a/system/acp/engine/logs.php +++ b/system/acp/engine/logs.php @@ -1,33 +1,33 @@ Логи операций'; + $info = ' Логи операций'; - $aSection = array( - 'index', - 'buy', - 'extend', - 'boost', - 'cashout', - 'part', - 'search', - 'replenish' - ); + $aSection = array( + 'index', + 'buy', + 'extend', + 'boost', + 'cashout', + 'part', + 'search', + 'replenish' + ); - if(!in_array($section, $aSection)) - $section = 'index'; + if(!in_array($section, $aSection)) + $section = 'index'; - $html->get('menu', 'sections/logs'); + $html->get('menu', 'sections/logs'); - $html->unit('s_'.$section, true); + $html->unit('s_'.$section, true); - unset($aSection[array_search($section, $aSection)]); + unset($aSection[array_search($section, $aSection)]); - foreach($aSection as $noactive) - $html->unit('s_'.$noactive); + foreach($aSection as $noactive) + $html->unit('s_'.$noactive); - $html->pack('menu'); + $html->pack('menu'); - include(SEC.'logs/'.$section.'.php'); + include(SEC.'logs/'.$section.'.php'); ?> \ No newline at end of file diff --git a/system/acp/engine/news.php b/system/acp/engine/news.php index 7444066..c983425 100644 --- a/system/acp/engine/news.php +++ b/system/acp/engine/news.php @@ -1,31 +1,31 @@ Управление новостями'; + $info = ' Управление новостями'; - $aSection = array( - 'index', - 'add', - 'delete' - ); + $aSection = array( + 'index', + 'add', + 'delete' + ); - if(!in_array($section, $aSection)) - $section = 'index'; + if(!in_array($section, $aSection)) + $section = 'index'; - $html->get('menu', 'sections/news'); + $html->get('menu', 'sections/news'); - $html->unit('s_'.$section, true); + $html->unit('s_'.$section, true); - unset($aSection[array_search($section, $aSection)]); + unset($aSection[array_search($section, $aSection)]); - foreach($aSection as $noactive) - $html->unit('s_'.$noactive); + foreach($aSection as $noactive) + $html->unit('s_'.$noactive); - $sql->query('SELECT `id` FROM `news`'); - $html->set('news', $sql->num()); + $sql->query('SELECT `id` FROM `news`'); + $html->set('news', $sql->num()); - $html->pack('menu'); + $html->pack('menu'); - include(SEC.'news/'.$section.'.php'); + include(SEC.'news/'.$section.'.php'); ?> \ No newline at end of file diff --git a/system/acp/engine/notice.php b/system/acp/engine/notice.php index f284ca6..5e4793c 100644 --- a/system/acp/engine/notice.php +++ b/system/acp/engine/notice.php @@ -1,32 +1,32 @@ Управление уведомлениями'; + $info = ' Управление уведомлениями'; - $aSection = array( - 'index', - 'add', - 'end', - 'delete' - ); + $aSection = array( + 'index', + 'add', + 'end', + 'delete' + ); - if(!in_array($section, $aSection)) - $section = 'index'; + if(!in_array($section, $aSection)) + $section = 'index'; - $html->get('menu', 'sections/notice'); + $html->get('menu', 'sections/notice'); - $html->unit('s_'.$section, true); + $html->unit('s_'.$section, true); - unset($aSection[array_search($section, $aSection)]); + unset($aSection[array_search($section, $aSection)]); - foreach($aSection as $noactive) - $html->unit('s_'.$noactive); + foreach($aSection as $noactive) + $html->unit('s_'.$noactive); - $sql->query('SELECT `id` FROM `notice` WHERE `time`>"'.$start_point.'"'); - $html->set('active', $sql->num()); + $sql->query('SELECT `id` FROM `notice` WHERE `time`>"'.$start_point.'"'); + $html->set('active', $sql->num()); - $html->pack('menu'); + $html->pack('menu'); - include(SEC.'notice/'.$section.'.php'); + include(SEC.'notice/'.$section.'.php'); ?> \ No newline at end of file diff --git a/system/acp/engine/pages.php b/system/acp/engine/pages.php index b39c89b..ee31704 100644 --- a/system/acp/engine/pages.php +++ b/system/acp/engine/pages.php @@ -1,28 +1,28 @@ Управление старницами'; + $info = ' Управление старницами'; - $aSection = array( - 'index', - 'add', - 'delete' - ); + $aSection = array( + 'index', + 'add', + 'delete' + ); - if(!in_array($section, $aSection)) - $section = 'index'; + if(!in_array($section, $aSection)) + $section = 'index'; - $html->get('menu', 'sections/pages'); + $html->get('menu', 'sections/pages'); - $html->unit('s_'.$section, true); + $html->unit('s_'.$section, true); - unset($aSection[array_search($section, $aSection)]); + unset($aSection[array_search($section, $aSection)]); - foreach($aSection as $noactive) - $html->unit('s_'.$noactive); + foreach($aSection as $noactive) + $html->unit('s_'.$noactive); - $html->pack('menu'); + $html->pack('menu'); - include(SEC.'pages/'.$section.'.php'); + include(SEC.'pages/'.$section.'.php'); ?> \ No newline at end of file diff --git a/system/acp/engine/promo.php b/system/acp/engine/promo.php index 3b8b9a8..153476f 100644 --- a/system/acp/engine/promo.php +++ b/system/acp/engine/promo.php @@ -1,36 +1,36 @@ Управление акциями'; + $info = ' Управление акциями'; - $aSection = array( - 'index', - 'add', - 'end', - 'stats', - 'delete' - ); + $aSection = array( + 'index', + 'add', + 'end', + 'stats', + 'delete' + ); - if(!in_array($section, $aSection)) - $section = 'index'; + if(!in_array($section, $aSection)) + $section = 'index'; - $html->get('menu', 'sections/promo'); + $html->get('menu', 'sections/promo'); - $html->unit('s_'.$section, true); + $html->unit('s_'.$section, true); - unset($aSection[array_search($section, $aSection)]); + unset($aSection[array_search($section, $aSection)]); - foreach($aSection as $noactive) - $html->unit('s_'.$noactive); + foreach($aSection as $noactive) + $html->unit('s_'.$noactive); - $sql->query('SELECT `id` FROM `promo` WHERE `time`>"'.$start_point.'"'); - $html->set('active', $sql->num()); + $sql->query('SELECT `id` FROM `promo` WHERE `time`>"'.$start_point.'"'); + $html->set('active', $sql->num()); - $sql->query('SELECT `id` FROM `promo` WHERE `time`<"'.$start_point.'"'); - $html->set('end', $sql->num()); + $sql->query('SELECT `id` FROM `promo` WHERE `time`<"'.$start_point.'"'); + $html->set('end', $sql->num()); - $html->pack('menu'); + $html->pack('menu'); - include(SEC.'promo/'.$section.'.php'); + include(SEC.'promo/'.$section.'.php'); ?> \ No newline at end of file diff --git a/system/acp/engine/servers.php b/system/acp/engine/servers.php index 049c368..b27da1d 100644 --- a/system/acp/engine/servers.php +++ b/system/acp/engine/servers.php @@ -1,69 +1,69 @@ Список серверов'; + $info = ' Список серверов'; - $aSection = array( - 'index', - 'cs', - 'cssold', - 'css', - 'csgo', - 'samp', - 'crmp', - 'mta', - 'mc', - 'overdue', - 'delete' - ); + $aSection = array( + 'index', + 'cs', + 'cssold', + 'css', + 'csgo', + 'samp', + 'crmp', + 'mta', + 'mc', + 'overdue', + 'delete' + ); - if(!in_array($section, $aSection)) - $section = 'index'; + if(!in_array($section, $aSection)) + $section = 'index'; - $del = $cfg['server_delete']*86400; - $time = $start_point-$del; + $del = $cfg['server_delete']*86400; + $time = $start_point-$del; - $html->get('menu', 'sections/servers'); + $html->get('menu', 'sections/servers'); - $html->unit('s_'.$section, true); + $html->unit('s_'.$section, true); - unset($aSection[array_search($section, $aSection)]); + unset($aSection[array_search($section, $aSection)]); - foreach($aSection as $noactive) - $html->unit('s_'.$noactive); + foreach($aSection as $noactive) + $html->unit('s_'.$noactive); - $sql->query('SELECT `id` FROM `servers` WHERE `user`!="-1"'); - $html->set('all', $sql->num()); + $sql->query('SELECT `id` FROM `servers` WHERE `user`!="-1"'); + $html->set('all', $sql->num()); - $sql->query('SELECT `id` FROM `servers` WHERE `user`!="-1" AND `game`="cs"'); - $html->set('cs', $sql->num()); + $sql->query('SELECT `id` FROM `servers` WHERE `user`!="-1" AND `game`="cs"'); + $html->set('cs', $sql->num()); - $sql->query('SELECT `id` FROM `servers` WHERE `user`!="-1" AND `game`="cssold"'); - $html->set('cssold', $sql->num()); + $sql->query('SELECT `id` FROM `servers` WHERE `user`!="-1" AND `game`="cssold"'); + $html->set('cssold', $sql->num()); - $sql->query('SELECT `id` FROM `servers` WHERE `user`!="-1" AND `game`="css"'); - $html->set('css', $sql->num()); + $sql->query('SELECT `id` FROM `servers` WHERE `user`!="-1" AND `game`="css"'); + $html->set('css', $sql->num()); - $sql->query('SELECT `id` FROM `servers` WHERE `user`!="-1" AND `game`="csgo"'); - $html->set('csgo', $sql->num()); + $sql->query('SELECT `id` FROM `servers` WHERE `user`!="-1" AND `game`="csgo"'); + $html->set('csgo', $sql->num()); - $sql->query('SELECT `id` FROM `servers` WHERE `user`!="-1" AND `game`="samp"'); - $html->set('samp', $sql->num()); + $sql->query('SELECT `id` FROM `servers` WHERE `user`!="-1" AND `game`="samp"'); + $html->set('samp', $sql->num()); - $sql->query('SELECT `id` FROM `servers` WHERE `user`!="-1" AND `game`="crmp"'); - $html->set('crmp', $sql->num()); + $sql->query('SELECT `id` FROM `servers` WHERE `user`!="-1" AND `game`="crmp"'); + $html->set('crmp', $sql->num()); - $sql->query('SELECT `id` FROM `servers` WHERE `user`!="-1" AND `game`="mta"'); - $html->set('mta', $sql->num()); + $sql->query('SELECT `id` FROM `servers` WHERE `user`!="-1" AND `game`="mta"'); + $html->set('mta', $sql->num()); - $sql->query('SELECT `id` FROM `servers` WHERE `user`!="-1" AND `game`="mc"'); - $html->set('mc', $sql->num()); + $sql->query('SELECT `id` FROM `servers` WHERE `user`!="-1" AND `game`="mc"'); + $html->set('mc', $sql->num()); - $sql->query('SELECT `id` FROM `servers` WHERE `user`!="-1" AND `time`<"'.$start_point.'" AND `overdue`>"'.$time.'"'); - $html->set('overdue', $sql->num()); + $sql->query('SELECT `id` FROM `servers` WHERE `user`!="-1" AND `time`<"'.$start_point.'" AND `overdue`>"'.$time.'"'); + $html->set('overdue', $sql->num()); - $html->pack('menu'); + $html->pack('menu'); - include(SEC.'servers/'.$section.'.php'); + include(SEC.'servers/'.$section.'.php'); ?> \ No newline at end of file diff --git a/system/acp/engine/system.php b/system/acp/engine/system.php index 9e1a897..38ce30b 100644 --- a/system/acp/engine/system.php +++ b/system/acp/engine/system.php @@ -1,57 +1,57 @@ query('SELECT `address`, `passwd` FROM `panel` LIMIT 1'); - $unit = $sql->get(); + if($go) + { + $sql->query('SELECT `address`, `passwd` FROM `panel` LIMIT 1'); + $unit = $sql->get(); - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - if(isset($url['service']) AND in_array($url['service'], array('apache2', 'nginx', 'mysql', 'unit'))) - { - if(!$ssh->auth($unit['passwd'], $unit['address'])) - sys::outjs(array('e' => 'Не удалось создать связь с сервером')); + if(isset($url['service']) AND in_array($url['service'], array('apache2', 'nginx', 'mysql', 'unit'))) + { + if(!$ssh->auth($unit['passwd'], $unit['address'])) + sys::outjs(array('e' => 'Не удалось создать связь с сервером')); - if($url['service'] == 'unit') - $ssh->set('screen -dmS reboot reboot'); - else - $ssh->set('screen -dmS sr_'.$url['service'].' service '.$url['service'].' restart'); + if($url['service'] == 'unit') + $ssh->set('screen -dmS reboot reboot'); + else + $ssh->set('screen -dmS sr_'.$url['service'].' service '.$url['service'].' restart'); - sys::outjs(array('s' => 'ok')); - } + sys::outjs(array('s' => 'ok')); + } - $aData = array( - 'cpu' => '0%', - 'ram' => '0%', - 'hdd' => '0%', - 'apache' => 'Перезагрузить', - 'nginx' => 'Перезагрузить', - 'mysql' => 'Перезагрузить', - 'uptime' => 'unknown', - 'ssh' => 'error' - ); + $aData = array( + 'cpu' => '0%', + 'ram' => '0%', + 'hdd' => '0%', + 'apache' => 'Перезагрузить', + 'nginx' => 'Перезагрузить', + 'mysql' => 'Перезагрузить', + 'uptime' => 'unknown', + 'ssh' => 'error' + ); - if(!$ssh->auth($unit['passwd'], $unit['address'])) - sys::outjs($aData); + if(!$ssh->auth($unit['passwd'], $unit['address'])) + sys::outjs($aData); - $aData['ssh'] = ''; + $aData['ssh'] = ''; - $stat_ram = $ssh->get('echo `cat /proc/meminfo | grep MemTotal | awk \'{print $2}\'; cat /proc/meminfo | grep MemFree | awk \'{print $2}\'; cat /proc/meminfo | grep Buffers | awk \'{print $2}\'; cat /proc/meminfo | grep Cached | grep -v SwapCached | awk \'{print $2}\'`'); - $aData['ram'] = ceil(sys::ram_load($stat_ram)).'%'; + $stat_ram = $ssh->get('echo `cat /proc/meminfo | grep MemTotal | awk \'{print $2}\'; cat /proc/meminfo | grep MemFree | awk \'{print $2}\'; cat /proc/meminfo | grep Buffers | awk \'{print $2}\'; cat /proc/meminfo | grep Cached | grep -v SwapCached | awk \'{print $2}\'`'); + $aData['ram'] = ceil(sys::ram_load($stat_ram)).'%'; - $aData['hdd'] = $ssh->get('df -P / | awk \'{print $5}\' | tail -1'); + $aData['hdd'] = $ssh->get('df -P / | awk \'{print $5}\' | tail -1'); - $time = ceil($ssh->get('cat /proc/uptime | awk \'{print $1}\'')); - $aData['uptime'] = sys::uptime_load($time); + $time = ceil($ssh->get('cat /proc/uptime | awk \'{print $1}\'')); + $aData['uptime'] = sys::uptime_load($time); - $aData['cpu'] = sys::cpu_load($ssh->get('echo "`ps -A -o pcpu | tail -n+2 | paste -sd+ | bc | awk \'{print $0}\'` `cat /proc/cpuinfo | grep processor | wc -l | awk \'{print $1}\'`"')).'%'; + $aData['cpu'] = sys::cpu_load($ssh->get('echo "`ps -A -o pcpu | tail -n+2 | paste -sd+ | bc | awk \'{print $0}\'` `cat /proc/cpuinfo | grep processor | wc -l | awk \'{print $1}\'`"')).'%'; - sys::outjs($aData); - } + sys::outjs($aData); + } - $html->get('index', 'sections/system'); + $html->get('index', 'sections/system'); - $html->pack('main'); + $html->pack('main'); ?> \ No newline at end of file diff --git a/system/acp/engine/tarifs.php b/system/acp/engine/tarifs.php index 284e0b9..c65e9cc 100644 --- a/system/acp/engine/tarifs.php +++ b/system/acp/engine/tarifs.php @@ -1,33 +1,33 @@ Управление тарифами'; + $info = ' Управление тарифами'; - $aSection = array( - 'index', - 'add', - 'copy', - 'stats', - 'delete' - ); + $aSection = array( + 'index', + 'add', + 'copy', + 'stats', + 'delete' + ); - if(!in_array($section, $aSection)) - $section = 'index'; + if(!in_array($section, $aSection)) + $section = 'index'; - $html->get('menu', 'sections/tarifs'); + $html->get('menu', 'sections/tarifs'); - $html->unit('s_'.$section, true); + $html->unit('s_'.$section, true); - unset($aSection[array_search($section, $aSection)]); + unset($aSection[array_search($section, $aSection)]); - foreach($aSection as $noactive) - $html->unit('s_'.$noactive); + foreach($aSection as $noactive) + $html->unit('s_'.$noactive); - $sql->query('SELECT `id` FROM `tarifs`'); - $html->set('tarifs', $sql->num()); + $sql->query('SELECT `id` FROM `tarifs`'); + $html->set('tarifs', $sql->num()); - $html->pack('menu'); + $html->pack('menu'); - include(SEC.'tarifs/'.$section.'.php'); + include(SEC.'tarifs/'.$section.'.php'); ?> \ No newline at end of file diff --git a/system/acp/engine/units.php b/system/acp/engine/units.php index f1e932e..70f4317 100644 --- a/system/acp/engine/units.php +++ b/system/acp/engine/units.php @@ -1,33 +1,33 @@ Управление локациями'; + $info = ' Управление локациями'; - $aSection = array( - 'index', - 'add', - 'loading', - 'stats', - 'delete' - ); + $aSection = array( + 'index', + 'add', + 'loading', + 'stats', + 'delete' + ); - if(!in_array($section, $aSection)) - $section = 'index'; + if(!in_array($section, $aSection)) + $section = 'index'; - $html->get('menu', 'sections/units'); + $html->get('menu', 'sections/units'); - $html->unit('s_'.$section, true); + $html->unit('s_'.$section, true); - unset($aSection[array_search($section, $aSection)]); + unset($aSection[array_search($section, $aSection)]); - foreach($aSection as $noactive) - $html->unit('s_'.$noactive); + foreach($aSection as $noactive) + $html->unit('s_'.$noactive); - $sql->query('SELECT `id` FROM `units`'); - $html->set('units', $sql->num()); + $sql->query('SELECT `id` FROM `units`'); + $html->set('units', $sql->num()); - $html->pack('menu'); + $html->pack('menu'); - include(SEC.'units/'.$section.'.php'); + include(SEC.'units/'.$section.'.php'); ?> \ No newline at end of file diff --git a/system/acp/engine/users.php b/system/acp/engine/users.php index 86cd61e..eca6e81 100644 --- a/system/acp/engine/users.php +++ b/system/acp/engine/users.php @@ -1,44 +1,44 @@ Управление пользователями'; + $info = ' Управление пользователями'; - $aSection = array( - 'index', - 'online', - 'offline', - 'signup', - 'stats', - 'delete' - ); + $aSection = array( + 'index', + 'online', + 'offline', + 'signup', + 'stats', + 'delete' + ); - if(!in_array($section, $aSection)) - $section = 'index'; + if(!in_array($section, $aSection)) + $section = 'index'; - $html->get('menu', 'sections/users'); + $html->get('menu', 'sections/users'); - $html->unit('s_'.$section, true); + $html->unit('s_'.$section, true); - unset($aSection[array_search($section, $aSection)]); + unset($aSection[array_search($section, $aSection)]); - foreach($aSection as $noactive) - $html->unit('s_'.$noactive); + foreach($aSection as $noactive) + $html->unit('s_'.$noactive); - $sql->query('SELECT `id` FROM `users`'); - $all = $sql->num(); + $sql->query('SELECT `id` FROM `users`'); + $all = $sql->num(); - $sql->query('SELECT `id` FROM `users` WHERE `time`>"'.($start_point-180).'"'); - $online = $sql->num(); + $sql->query('SELECT `id` FROM `users` WHERE `time`>"'.($start_point-180).'"'); + $online = $sql->num(); - $html->set('all', $all); - $html->set('online', $online); - $html->set('offline', $all-$online); + $html->set('all', $all); + $html->set('online', $online); + $html->set('offline', $all-$online); - $sql->query('SELECT `id` FROM `signup`'); - $html->set('signup', $sql->num()); + $sql->query('SELECT `id` FROM `signup`'); + $html->set('signup', $sql->num()); - $html->pack('menu'); + $html->pack('menu'); - include(SEC.'users/'.$section.'.php'); + include(SEC.'users/'.$section.'.php'); ?> \ No newline at end of file diff --git a/system/acp/engine/web.php b/system/acp/engine/web.php index 6395ab4..c83c296 100644 --- a/system/acp/engine/web.php +++ b/system/acp/engine/web.php @@ -1,62 +1,62 @@ Список бесплатных услуг'; + $info = ' Список бесплатных услуг'; - $aSection = array( - 'index', - 'csbans', - 'csstats', - 'astats', - 'sourcebans', - 'mysql', - 'hosting' - ); + $aSection = array( + 'index', + 'csbans', + 'csstats', + 'astats', + 'sourcebans', + 'mysql', + 'hosting' + ); - if(!in_array($section, $aSection)) - $section = 'index'; + if(!in_array($section, $aSection)) + $section = 'index'; - $html->get('menu', 'sections/web'); + $html->get('menu', 'sections/web'); - $html->unit('s_'.$section, true); + $html->unit('s_'.$section, true); - unset($aSection[array_search($section, $aSection)]); + unset($aSection[array_search($section, $aSection)]); - foreach($aSection as $noactive) - $html->unit('s_'.$noactive); + foreach($aSection as $noactive) + $html->unit('s_'.$noactive); - $sql->query('SELECT `id` FROM `web`'); - $html->set('all', $sql->num()); + $sql->query('SELECT `id` FROM `web`'); + $html->set('all', $sql->num()); - $sql->query('SELECT `id` FROM `web` WHERE `type`="amxbans"'); - $html->set('amxbans', $sql->num()); + $sql->query('SELECT `id` FROM `web` WHERE `type`="amxbans"'); + $html->set('amxbans', $sql->num()); - $sql->query('SELECT `id` FROM `web` WHERE `type`="csbans"'); - $html->set('csbans', $sql->num()); + $sql->query('SELECT `id` FROM `web` WHERE `type`="csbans"'); + $html->set('csbans', $sql->num()); - $sql->query('SELECT `id` FROM `web` WHERE `type`="psychostats"'); - $html->set('psychostats', $sql->num()); + $sql->query('SELECT `id` FROM `web` WHERE `type`="psychostats"'); + $html->set('psychostats', $sql->num()); - $sql->query('SELECT `id` FROM `web` WHERE `type`="csstats"'); - $html->set('csstats', $sql->num()); + $sql->query('SELECT `id` FROM `web` WHERE `type`="csstats"'); + $html->set('csstats', $sql->num()); - $sql->query('SELECT `id` FROM `web` WHERE `type`="astats"'); - $html->set('astats', $sql->num()); + $sql->query('SELECT `id` FROM `web` WHERE `type`="astats"'); + $html->set('astats', $sql->num()); - $sql->query('SELECT `id` FROM `web` WHERE `type`="sourcebans"'); - $html->set('sourcebans', $sql->num()); + $sql->query('SELECT `id` FROM `web` WHERE `type`="sourcebans"'); + $html->set('sourcebans', $sql->num()); - $sql->query('SELECT `id` FROM `web` WHERE `type`="rankme"'); - $html->set('rankme', $sql->num()); + $sql->query('SELECT `id` FROM `web` WHERE `type`="rankme"'); + $html->set('rankme', $sql->num()); - $sql->query('SELECT `id` FROM `web` WHERE `type`="mysql"'); - $html->set('mysql', $sql->num()); + $sql->query('SELECT `id` FROM `web` WHERE `type`="mysql"'); + $html->set('mysql', $sql->num()); - $sql->query('SELECT `id` FROM `web` WHERE `type`="hosting"'); - $html->set('hosting', $sql->num()); + $sql->query('SELECT `id` FROM `web` WHERE `type`="hosting"'); + $html->set('hosting', $sql->num()); - $html->pack('menu'); + $html->pack('menu'); - include(SEC.'web/'.$section.'.php'); + include(SEC.'web/'.$section.'.php'); ?> \ No newline at end of file diff --git a/system/acp/engine/wiki.php b/system/acp/engine/wiki.php index 3b7ebc9..85b8a96 100644 --- a/system/acp/engine/wiki.php +++ b/system/acp/engine/wiki.php @@ -1,31 +1,31 @@ Управление википедией'; + $info = ' Управление википедией'; - $aSection = array( - 'addcat', - 'cat', - 'cats', - 'index', - 'add', - 'delete' - ); + $aSection = array( + 'addcat', + 'cat', + 'cats', + 'index', + 'add', + 'delete' + ); - if(!in_array($section, $aSection)) - $section = 'index'; + if(!in_array($section, $aSection)) + $section = 'index'; - $html->get('menu', 'sections/wiki'); + $html->get('menu', 'sections/wiki'); - $html->unit('s_'.$section, true); + $html->unit('s_'.$section, true); - unset($aSection[array_search($section, $aSection)]); + unset($aSection[array_search($section, $aSection)]); - foreach($aSection as $noactive) - $html->unit('s_'.$noactive); + foreach($aSection as $noactive) + $html->unit('s_'.$noactive); - $html->pack('menu'); + $html->pack('menu'); - include(SEC.'wiki/'.$section.'.php'); + include(SEC.'wiki/'.$section.'.php'); ?> \ No newline at end of file diff --git a/system/acp/sections/addons/addcat.php b/system/acp/sections/addons/addcat.php index ab7b2aa..0fe2b58 100644 --- a/system/acp/sections/addons/addcat.php +++ b/system/acp/sections/addons/addcat.php @@ -1,45 +1,45 @@ 'Необходимо заполнить все поля')); + if(in_array('', $aData)) + sys::outjs(array('e' => 'Необходимо заполнить все поля')); - foreach($aGames as $game) - { - if(!$aData[$game]) - continue; + foreach($aGames as $game) + { + if(!$aData[$game]) + continue; - $sql->query('INSERT INTO `plugins_category` set ' - .'`game`="'.$game.'",' - .'`name`="'.htmlspecialchars($aData['name']).'",' - .'`sort`="'.$aData['sort'].'"'); - } + $sql->query('INSERT INTO `plugins_category` set ' + .'`game`="'.$game.'",' + .'`name`="'.htmlspecialchars($aData['name']).'",' + .'`sort`="'.$aData['sort'].'"'); + } - sys::outjs(array('s' => 'ok')); - } + sys::outjs(array('s' => 'ok')); + } - $html->get('addcat', 'sections/addons'); + $html->get('addcat', 'sections/addons'); - $html->pack('main'); + $html->pack('main'); ?> \ No newline at end of file diff --git a/system/acp/sections/addons/addpl.php b/system/acp/sections/addons/addpl.php index 2ef23c2..a11a1cf 100644 --- a/system/acp/sections/addons/addpl.php +++ b/system/acp/sections/addons/addpl.php @@ -1,373 +1,373 @@ query('SELECT `id`, `name` FROM `plugins_category` WHERE `game`="'.$game.'" ORDER BY `sort` ASC'); - while($cat = $sql->get()) - $cats .= ''; + $sql->query('SELECT `id`, `name` FROM `plugins_category` WHERE `game`="'.$game.'" ORDER BY `sort` ASC'); + while($cat = $sql->get()) + $cats .= ''; - sys::out($cats); - } - } + sys::out($cats); + } + } - if($go) - { - $aData = array(); + if($go) + { + $aData = array(); - $aData['name'] = isset($_POST['name']) ? trim($_POST['name']) : ''; - $aData['game'] = isset($_POST['game']) ? trim($_POST['game']) : ''; - $aData['cat'] = isset($_POST['category']) ? ceil($_POST['category']) : 0; - $aData['status'] = isset($_POST['status']) ? ceil($_POST['status']) : 0; - $aData['packs'] = isset($_POST['packs']) ? trim($_POST['packs']) : ''; - $aData['desc'] = isset($_POST['desc']) ? trim($_POST['desc']) : ''; - $aData['info'] = isset($_POST['info']) ? trim($_POST['info']) : ''; - $aData['images'] = isset($_POST['images']) ? trim($_POST['images']) : ''; - $aData['incompatible'] = isset($_POST['incompatible']) ? trim($_POST['incompatible']) : ''; - $aData['choice'] = isset($_POST['choice']) ? trim($_POST['choice']) : ''; - $aData['required'] = isset($_POST['required']) ? trim($_POST['required']) : ''; - $aData['update'] = isset($_POST['update']) ? ceil($_POST['update']) : 0; - $aData['delete'] = isset($_POST['delete']) ? ceil($_POST['delete']) : 0; - $aData['aecfg'] = isset($_POST['aecfg']) ? $_POST['aecfg'] : 0; - $aData['sort'] = isset($_POST['sort']) ? ceil($_POST['sort']) : 0; - $aData['price'] = isset($_POST['price']) ? ceil($_POST['price']) : 0; + $aData['name'] = isset($_POST['name']) ? trim($_POST['name']) : ''; + $aData['game'] = isset($_POST['game']) ? trim($_POST['game']) : ''; + $aData['cat'] = isset($_POST['category']) ? ceil($_POST['category']) : 0; + $aData['status'] = isset($_POST['status']) ? ceil($_POST['status']) : 0; + $aData['packs'] = isset($_POST['packs']) ? trim($_POST['packs']) : ''; + $aData['desc'] = isset($_POST['desc']) ? trim($_POST['desc']) : ''; + $aData['info'] = isset($_POST['info']) ? trim($_POST['info']) : ''; + $aData['images'] = isset($_POST['images']) ? trim($_POST['images']) : ''; + $aData['incompatible'] = isset($_POST['incompatible']) ? trim($_POST['incompatible']) : ''; + $aData['choice'] = isset($_POST['choice']) ? trim($_POST['choice']) : ''; + $aData['required'] = isset($_POST['required']) ? trim($_POST['required']) : ''; + $aData['update'] = isset($_POST['update']) ? ceil($_POST['update']) : 0; + $aData['delete'] = isset($_POST['delete']) ? ceil($_POST['delete']) : 0; + $aData['aecfg'] = isset($_POST['aecfg']) ? $_POST['aecfg'] : 0; + $aData['sort'] = isset($_POST['sort']) ? ceil($_POST['sort']) : 0; + $aData['price'] = isset($_POST['price']) ? ceil($_POST['price']) : 0; - $aData['config_files_file'] = isset($_POST['config_files_file']) ? $_POST['config_files_file'] : array(); - $aData['config_files_sort'] = isset($_POST['config_files_sort']) ? $_POST['config_files_sort'] : array(); - $aData['config_clear_file'] = isset($_POST['config_clear_file']) ? $_POST['config_clear_file'] : array(); - $aData['config_clear_text'] = isset($_POST['config_clear_text']) ? $_POST['config_clear_text'] : array(); - $aData['config_write_file'] = isset($_POST['config_write_file']) ? $_POST['config_write_file'] : array(); - $aData['config_write_text'] = isset($_POST['config_write_text']) ? $_POST['config_write_text'] : array(); - $aData['config_write_top'] = isset($_POST['config_write_top']) ? $_POST['config_write_top'] : array(); - $aData['config_write_del_file'] = isset($_POST['config_write_del_file']) ? $_POST['config_write_del_file'] : array(); - $aData['config_write_del_text'] = isset($_POST['config_write_del_text']) ? $_POST['config_write_del_text'] : array(); - $aData['config_write_del_top'] = isset($_POST['config_write_del_top']) ? $_POST['config_write_del_top'] : array(); - $aData['files_delete_file'] = isset($_POST['files_delete_file']) ? $_POST['files_delete_file'] : array(); + $aData['config_files_file'] = isset($_POST['config_files_file']) ? $_POST['config_files_file'] : array(); + $aData['config_files_sort'] = isset($_POST['config_files_sort']) ? $_POST['config_files_sort'] : array(); + $aData['config_clear_file'] = isset($_POST['config_clear_file']) ? $_POST['config_clear_file'] : array(); + $aData['config_clear_text'] = isset($_POST['config_clear_text']) ? $_POST['config_clear_text'] : array(); + $aData['config_write_file'] = isset($_POST['config_write_file']) ? $_POST['config_write_file'] : array(); + $aData['config_write_text'] = isset($_POST['config_write_text']) ? $_POST['config_write_text'] : array(); + $aData['config_write_top'] = isset($_POST['config_write_top']) ? $_POST['config_write_top'] : array(); + $aData['config_write_del_file'] = isset($_POST['config_write_del_file']) ? $_POST['config_write_del_file'] : array(); + $aData['config_write_del_text'] = isset($_POST['config_write_del_text']) ? $_POST['config_write_del_text'] : array(); + $aData['config_write_del_top'] = isset($_POST['config_write_del_top']) ? $_POST['config_write_del_top'] : array(); + $aData['files_delete_file'] = isset($_POST['files_delete_file']) ? $_POST['files_delete_file'] : array(); - $aData['cfg'] = 0; + $aData['cfg'] = 0; - if($aData['name'] == '') - sys::outjs(array('e' => 'Необходимо указать название')); + if($aData['name'] == '') + sys::outjs(array('e' => 'Необходимо указать название')); - if(sys::strlen($aData['name']) > 50) - sys::outjs(array('e' => 'Длина названия не должна превышать 50 символов.')); + if(sys::strlen($aData['name']) > 50) + sys::outjs(array('e' => 'Длина названия не должна превышать 50 символов.')); - if(!in_array($aData['game'], $aGames)) - sys::outjs(array('e' => 'Необходимо выбрать игру')); + if(!in_array($aData['game'], $aGames)) + sys::outjs(array('e' => 'Необходимо выбрать игру')); - include(LIB.'zip.php'); + include(LIB.'zip.php'); - $sql->query('SELECT `id` FROM `plugins` WHERE `id`="'.$aData['update'].'" LIMIT 1'); - if($sql->num()) - { - $sql->query('INSERT INTO `plugins_update` set `plugin`="0", `name`="'.htmlspecialchars($aData['name']).'", `status`="'.$aData['status'].'", `cfg`="0", `upd`="0"'); + $sql->query('SELECT `id` FROM `plugins` WHERE `id`="'.$aData['update'].'" LIMIT 1'); + if($sql->num()) + { + $sql->query('INSERT INTO `plugins_update` set `plugin`="0", `name`="'.htmlspecialchars($aData['name']).'", `status`="'.$aData['status'].'", `cfg`="0", `upd`="0"'); - $id = $aData['update']; - $aData['update'] = $sql->id(); - }else{ - $sql->query('INSERT INTO `plugins` set `name`="'.htmlspecialchars($aData['name']).'", `cat`="'.$aData['cat'].'", `game`="'.$aData['game'].'", `status`="'.$aData['status'].'", `cfg`="0", `upd`="0", `sort`="'.$aData['sort'].'"'); + $id = $aData['update']; + $aData['update'] = $sql->id(); + }else{ + $sql->query('INSERT INTO `plugins` set `name`="'.htmlspecialchars($aData['name']).'", `cat`="'.$aData['cat'].'", `game`="'.$aData['game'].'", `status`="'.$aData['status'].'", `cfg`="0", `upd`="0", `sort`="'.$aData['sort'].'"'); - $id = $sql->id(); - $aData['update'] = 0; - } + $id = $sql->id(); + $aData['update'] = 0; + } - $edit = array(); + $edit = array(); - if(!$aData['update']) - { - if(!move_uploaded_file($_FILES['file']['tmp_name'], FILES.'plugins/install/'.$id.'.zip')) - { - $sql->query('DELETE FROM `plugins` WHERE `id`="'.$id.'" LIMIT 1'); + if(!$aData['update']) + { + if(!move_uploaded_file($_FILES['file']['tmp_name'], FILES.'plugins/install/'.$id.'.zip')) + { + $sql->query('DELETE FROM `plugins` WHERE `id`="'.$id.'" LIMIT 1'); - sys::outjs(array('e' => 'Неудалось загрузить архив')); - } + sys::outjs(array('e' => 'Неудалось загрузить архив')); + } - $zip = new ZipArchive; + $zip = new ZipArchive; - if($zip->open(FILES.'plugins/install/'.$id.'.zip') !== TRUE) - { - $sql->query('DELETE FROM `plugins` WHERE `id`="'.$id.'" LIMIT 1'); + if($zip->open(FILES.'plugins/install/'.$id.'.zip') !== TRUE) + { + $sql->query('DELETE FROM `plugins` WHERE `id`="'.$id.'" LIMIT 1'); - unlink(FILES.'plugins/install/'.$id.'.zip'); + unlink(FILES.'plugins/install/'.$id.'.zip'); - sys::outjs(array('e' => 'Неудалось открыть архив')); - } + sys::outjs(array('e' => 'Неудалось открыть архив')); + } - $count = $zip->numFiles; + $count = $zip->numFiles; - $rm = ''; + $rm = ''; - for($i = 0; $i < $count; $i+=1) - { - $stat = $zip->statIndex($i); + for($i = 0; $i < $count; $i+=1) + { + $stat = $zip->statIndex($i); - $check = count(explode('.', $stat['name'])); + $check = count(explode('.', $stat['name'])); - if($check < 2) - continue; + if($check < 2) + continue; - $rm .= 'rm '.$stat['name'].';'.PHP_EOL; + $rm .= 'rm '.$stat['name'].';'.PHP_EOL; - $type = explode('.', $stat['name']); + $type = explode('.', $stat['name']); - if($aData['aecfg'] AND in_array(end($type), $types)) - $edit[] = $stat['name']; - } + if($aData['aecfg'] AND in_array(end($type), $types)) + $edit[] = $stat['name']; + } - $file = fopen(FILES.'plugins/delete/'.$id.'.rm', "w"); - fputs($file, $rm); - fclose($file); - }else{ - if(!move_uploaded_file($_FILES['new_file']['tmp_name'], FILES.'plugins/install/u'.$aData['update'].'.zip')) - { - $sql->query('DELETE FROM `plugins_update` WHERE `id`="'.$aData['update'].'" LIMIT 1'); + $file = fopen(FILES.'plugins/delete/'.$id.'.rm', "w"); + fputs($file, $rm); + fclose($file); + }else{ + if(!move_uploaded_file($_FILES['new_file']['tmp_name'], FILES.'plugins/install/u'.$aData['update'].'.zip')) + { + $sql->query('DELETE FROM `plugins_update` WHERE `id`="'.$aData['update'].'" LIMIT 1'); - sys::outjs(array('e' => 'Неудалось загрузить архив')); - } + sys::outjs(array('e' => 'Неудалось загрузить архив')); + } - if(!move_uploaded_file($_FILES['upd_file']['tmp_name'], FILES.'plugins/update/'.$aData['update'].'.zip')) - { - $sql->query('DELETE FROM `plugins_update` WHERE `id`="'.$aData['update'].'" LIMIT 1'); + if(!move_uploaded_file($_FILES['upd_file']['tmp_name'], FILES.'plugins/update/'.$aData['update'].'.zip')) + { + $sql->query('DELETE FROM `plugins_update` WHERE `id`="'.$aData['update'].'" LIMIT 1'); - unlink(FILES.'plugins/install/u'.$aData['update'].'.zip'); + unlink(FILES.'plugins/install/u'.$aData['update'].'.zip'); - sys::outjs(array('e' => 'Неудалось загрузить архив обновления')); - } + sys::outjs(array('e' => 'Неудалось загрузить архив обновления')); + } - $zip = new ZipArchive; + $zip = new ZipArchive; - if($zip->open(FILES.'plugins/install/u'.$aData['update'].'.zip') !== TRUE) - { - $sql->query('DELETE FROM `plugins_update` WHERE `id`="'.$aData['update'].'" LIMIT 1'); + if($zip->open(FILES.'plugins/install/u'.$aData['update'].'.zip') !== TRUE) + { + $sql->query('DELETE FROM `plugins_update` WHERE `id`="'.$aData['update'].'" LIMIT 1'); - unlink(FILES.'plugins/install/u'.$aData['update'].'.zip'); - unlink(FILES.'plugins/update/'.$aData['update'].'.zip'); + unlink(FILES.'plugins/install/u'.$aData['update'].'.zip'); + unlink(FILES.'plugins/update/'.$aData['update'].'.zip'); - sys::outjs(array('e' => 'Неудалось открыть архив')); - } + sys::outjs(array('e' => 'Неудалось открыть архив')); + } - $count = $zip->numFiles; + $count = $zip->numFiles; - $rm = ''; + $rm = ''; - for($i = 0; $i < $count; $i+=1) - { - $stat = $zip->statIndex($i); + for($i = 0; $i < $count; $i+=1) + { + $stat = $zip->statIndex($i); - $check = count(explode('.', $stat['name'])); + $check = count(explode('.', $stat['name'])); - if($check < 2) - continue; + if($check < 2) + continue; - $rm .= 'rm '.$stat['name'].';'.PHP_EOL; + $rm .= 'rm '.$stat['name'].';'.PHP_EOL; - $type = explode('.', $stat['name']); + $type = explode('.', $stat['name']); - if($aData['aecfg'] AND in_array(end($type), $types)) - $edit[] = $stat['name']; - } + if($aData['aecfg'] AND in_array(end($type), $types)) + $edit[] = $stat['name']; + } - $file = fopen(FILES.'plugins/delete/u'.$aData['update'].'.rm', "w"); - fputs($file, $rm); - fclose($file); - } + $file = fopen(FILES.'plugins/delete/u'.$aData['update'].'.rm', "w"); + fputs($file, $rm); + fclose($file); + } - $aPacks = explode(':', $aData['packs']); + $aPacks = explode(':', $aData['packs']); - $spacks = ''; + $spacks = ''; - foreach($aPacks as $packs) - $spacks .= trim($packs).':'; + foreach($aPacks as $packs) + $spacks .= trim($packs).':'; - $spacks = isset($spacks{0}) ? substr($spacks, 0, -1) : ''; + $spacks = isset($spacks{0}) ? substr($spacks, 0, -1) : ''; - $aData['packs'] = $spacks == '' ? 'all' : $spacks; + $aData['packs'] = $spacks == '' ? 'all' : $spacks; - $aIncom = explode(':', $aData['incompatible']); + $aIncom = explode(':', $aData['incompatible']); - $incoms = ''; + $incoms = ''; - foreach($aIncom as $incom) - { - $incom = trim($incom); + foreach($aIncom as $incom) + { + $incom = trim($incom); - if(!is_numeric($incom)) - continue; + if(!is_numeric($incom)) + continue; - $incoms .= intval($incom).':'; - } + $incoms .= intval($incom).':'; + } - $incoms = isset($incoms{0}) ? substr($incoms, 0, -1) : ''; + $incoms = isset($incoms{0}) ? substr($incoms, 0, -1) : ''; - $aData['incompatible'] = $incoms; + $aData['incompatible'] = $incoms; - $aChoice = explode(' ', $aData['choice']); + $aChoice = explode(' ', $aData['choice']); - $choice = ''; + $choice = ''; - foreach($aChoice as $chpl) - { - $aChpl = explode(':', $chpl); + foreach($aChoice as $chpl) + { + $aChpl = explode(':', $chpl); - foreach($aChpl as $idchpl) - { - $idchpl = trim($idchpl); + foreach($aChpl as $idchpl) + { + $idchpl = trim($idchpl); - if(!is_numeric($idchpl)) - continue; + if(!is_numeric($idchpl)) + continue; - $choice .= intval($idchpl).':'; - } + $choice .= intval($idchpl).':'; + } - $choice .= ' '; - } + $choice .= ' '; + } - $choice = isset($choice{0}) ? substr(trim($choice), 0, -1) : ''; + $choice = isset($choice{0}) ? substr(trim($choice), 0, -1) : ''; - $aData['choice'] = $choice; + $aData['choice'] = $choice; - $aRequi = explode(':', $aData['required']); + $aRequi = explode(':', $aData['required']); - $requis = ''; + $requis = ''; - foreach($aRequi as $requi) - { - $requi = trim($requi); + foreach($aRequi as $requi) + { + $requi = trim($requi); - if(!is_numeric($requi)) - continue; + if(!is_numeric($requi)) + continue; - $requis .= intval($requi).':'; - } + $requis .= intval($requi).':'; + } - $requis = isset($requis{0}) ? substr($requis, 0, -1) : ''; + $requis = isset($requis{0}) ? substr($requis, 0, -1) : ''; - $aData['required'] = $requis; + $aData['required'] = $requis; - if(!$aData['aecfg']) - { - $n = 0; + if(!$aData['aecfg']) + { + $n = 0; - foreach($aData['config_files_file'] as $i => $file) - { - if($file == '') - continue; + foreach($aData['config_files_file'] as $i => $file) + { + if($file == '') + continue; - $n+=1; + $n+=1; - $aData['config_files_sort'][$i] = $aData['config_files_sort'][$i] ? intval($aData['config_files_sort'][$i]) : $n; + $aData['config_files_sort'][$i] = $aData['config_files_sort'][$i] ? intval($aData['config_files_sort'][$i]) : $n; - $sql->query('INSERT INTO `plugins_config` set `plugin`="'.$id.'", `update`="'.$aData['update'].'", `file`="'.$file.'", `sort`="'.$n.'"'); - } + $sql->query('INSERT INTO `plugins_config` set `plugin`="'.$id.'", `update`="'.$aData['update'].'", `file`="'.$file.'", `sort`="'.$n.'"'); + } - if($n) - $aData['cfg'] = 1; - }else{ - $n = 0; + if($n) + $aData['cfg'] = 1; + }else{ + $n = 0; - foreach($edit as $file) - { - $n+=1; + foreach($edit as $file) + { + $n+=1; - $sql->query('INSERT INTO `plugins_config` set `plugin`="'.$id.'", `update`="'.$aData['update'].'", `file`="'.$file.'", `sort`="'.$n.'"'); - } + $sql->query('INSERT INTO `plugins_config` set `plugin`="'.$id.'", `update`="'.$aData['update'].'", `file`="'.$file.'", `sort`="'.$n.'"'); + } - if($n) - $aData['cfg'] = 1; - } + if($n) + $aData['cfg'] = 1; + } - foreach($aData['config_clear_file'] as $i => $file) - { - if($aData['config_clear_text'][$i] == '' || $file == '') - continue; + foreach($aData['config_clear_file'] as $i => $file) + { + if($aData['config_clear_text'][$i] == '' || $file == '') + continue; - $regex = (string) $aData['config_clear_regex'] == 'on' ? 1 : 0; + $regex = (string) $aData['config_clear_regex'] == 'on' ? 1 : 0; - $text = htmlspecialchars(trim($aData['config_clear_text'][$i])); + $text = htmlspecialchars(trim($aData['config_clear_text'][$i])); - $sql->query('INSERT INTO `plugins_clear` set `plugin`="'.$id.'", `update`="'.$aData['update'].'", `text`="'.$text.'", `file`="'.$file.'", `regex`="'.$regex.'"'); - } + $sql->query('INSERT INTO `plugins_clear` set `plugin`="'.$id.'", `update`="'.$aData['update'].'", `text`="'.$text.'", `file`="'.$file.'", `regex`="'.$regex.'"'); + } - foreach($aData['config_write_file'] as $i => $file) - { - if($aData['config_write_text'][$i] == '' || $file == '') - continue; + foreach($aData['config_write_file'] as $i => $file) + { + if($aData['config_write_text'][$i] == '' || $file == '') + continue; - $top = (string) $aData['config_write_top'][$i] == 'on' ? 1 : 0; + $top = (string) $aData['config_write_top'][$i] == 'on' ? 1 : 0; - $text = htmlspecialchars(trim($aData['config_write_text'][$i])); + $text = htmlspecialchars(trim($aData['config_write_text'][$i])); - $sql->query('INSERT INTO `plugins_write` set `plugin`="'.$id.'", `update`="'.$aData['update'].'", `text`="'.$text.'", `file`="'.$file.'", `top`="'.$top.'"'); - } + $sql->query('INSERT INTO `plugins_write` set `plugin`="'.$id.'", `update`="'.$aData['update'].'", `text`="'.$text.'", `file`="'.$file.'", `top`="'.$top.'"'); + } - foreach($aData['config_write_del_file'] as $i => $file) - { - if($aData['config_write_del_text'][$i] == '' || $file == '') - continue; + foreach($aData['config_write_del_file'] as $i => $file) + { + if($aData['config_write_del_text'][$i] == '' || $file == '') + continue; - $top = (string) $aData['config_write_del_top'][$i] == 'on' ? 1 : 0; + $top = (string) $aData['config_write_del_top'][$i] == 'on' ? 1 : 0; - $text = htmlspecialchars(trim($aData['config_write_del_text'][$i])); + $text = htmlspecialchars(trim($aData['config_write_del_text'][$i])); - $sql->query('INSERT INTO `plugins_write_del` set `plugin`="'.$id.'", `update`="'.$aData['update'].'", `text`="'.$text.'", `file`="'.$file.'", `top`="'.$top.'"'); - } + $sql->query('INSERT INTO `plugins_write_del` set `plugin`="'.$id.'", `update`="'.$aData['update'].'", `text`="'.$text.'", `file`="'.$file.'", `top`="'.$top.'"'); + } - foreach($aData['files_delete_file'] as $file) - { - if($file == '') - continue; + foreach($aData['files_delete_file'] as $file) + { + if($file == '') + continue; - $sql->query('INSERT INTO `plugins_delete` set `plugin`="'.$id.'", `update`="'.$aData['update'].'", `file`="'.$file.'"'); - } + $sql->query('INSERT INTO `plugins_delete` set `plugin`="'.$id.'", `update`="'.$aData['update'].'", `file`="'.$file.'"'); + } - if($aData['delete']) - $sql->query('INSERT INTO `plugins_delete_ins` set `plugin`="'.$id.'", `update`="'.$aData['update'].'", `file`="'.$aData['delete'].'"'); + if($aData['delete']) + $sql->query('INSERT INTO `plugins_delete_ins` set `plugin`="'.$id.'", `update`="'.$aData['update'].'", `file`="'.$aData['delete'].'"'); - if($aData['update']) - { - $sql->query('UPDATE `plugins_update` set ' - .'`plugin`="'.$id.'",' - .'`desc`="'.htmlspecialchars($aData['desc']).'",' - .'`info`="'.htmlspecialchars($aData['info']).'",' - .'`images`="'.htmlspecialchars($aData['images']).'",' - .'`incompatible`="'.$aData['incompatible'].'",' - .'`choice`="'.$aData['choice'].'",' - .'`required`="'.$aData['required'].'",' - .'`cfg`="'.$aData['cfg'].'",' - .'`price`="'.$aData['price'].'",' - .'`packs`="'.$aData['packs'].'" WHERE `id`="'.$aData['update'].'"'); + if($aData['update']) + { + $sql->query('UPDATE `plugins_update` set ' + .'`plugin`="'.$id.'",' + .'`desc`="'.htmlspecialchars($aData['desc']).'",' + .'`info`="'.htmlspecialchars($aData['info']).'",' + .'`images`="'.htmlspecialchars($aData['images']).'",' + .'`incompatible`="'.$aData['incompatible'].'",' + .'`choice`="'.$aData['choice'].'",' + .'`required`="'.$aData['required'].'",' + .'`cfg`="'.$aData['cfg'].'",' + .'`price`="'.$aData['price'].'",' + .'`packs`="'.$aData['packs'].'" WHERE `id`="'.$aData['update'].'"'); - $sql->query('UPDATE `plugins` set `upd`="'.$aData['update'].'" WHERE `id`="'.$id.'" LIMIT 1'); + $sql->query('UPDATE `plugins` set `upd`="'.$aData['update'].'" WHERE `id`="'.$id.'" LIMIT 1'); - $sql->query('UPDATE `plugins_update` set `upd`="'.$aData['update'].'" WHERE `id`!="'.$aData['update'].'" AND `plugin`="'.$id.'" AND `upd`="0" ORDER BY `id` DESC LIMIT 1'); - }else - $sql->query('UPDATE `plugins` set' - .'`desc`="'.htmlspecialchars($aData['desc']).'",' - .'`info`="'.htmlspecialchars($aData['info']).'",' - .'`images`="'.htmlspecialchars($aData['images']).'",' - .'`incompatible`="'.$aData['incompatible'].'",' - .'`choice`="'.$aData['choice'].'",' - .'`required`="'.$aData['required'].'",' - .'`cfg`="'.$aData['cfg'].'",' - .'`price`="'.$aData['price'].'",' - .'`packs`="'.$aData['packs'].'" WHERE `id`="'.$id.'"'); + $sql->query('UPDATE `plugins_update` set `upd`="'.$aData['update'].'" WHERE `id`!="'.$aData['update'].'" AND `plugin`="'.$id.'" AND `upd`="0" ORDER BY `id` DESC LIMIT 1'); + }else + $sql->query('UPDATE `plugins` set' + .'`desc`="'.htmlspecialchars($aData['desc']).'",' + .'`info`="'.htmlspecialchars($aData['info']).'",' + .'`images`="'.htmlspecialchars($aData['images']).'",' + .'`incompatible`="'.$aData['incompatible'].'",' + .'`choice`="'.$aData['choice'].'",' + .'`required`="'.$aData['required'].'",' + .'`cfg`="'.$aData['cfg'].'",' + .'`price`="'.$aData['price'].'",' + .'`packs`="'.$aData['packs'].'" WHERE `id`="'.$id.'"'); - sys::outjs(array('s' => 'ok')); - } + sys::outjs(array('s' => 'ok')); + } - $html->get('addpl', 'sections/addons'); - $html->pack('main'); + $html->get('addpl', 'sections/addons'); + $html->pack('main'); ?> \ No newline at end of file diff --git a/system/acp/sections/addons/cats.php b/system/acp/sections/addons/cats.php index 464071f..a3dcff3 100644 --- a/system/acp/sections/addons/cats.php +++ b/system/acp/sections/addons/cats.php @@ -1,26 +1,26 @@ query('SELECT `id`, `game`, `name`, `sort` FROM `plugins_category` ORDER BY `game` ASC'); - while($cat = $sql->get($cats)) - { - $sql->query('SELECT `name` FROM `plugins` WHERE `cat`="'.$cat['id'].'"'); - $plugins = $sql->num(); + $cats = $sql->query('SELECT `id`, `game`, `name`, `sort` FROM `plugins_category` ORDER BY `game` ASC'); + while($cat = $sql->get($cats)) + { + $sql->query('SELECT `name` FROM `plugins` WHERE `cat`="'.$cat['id'].'"'); + $plugins = $sql->num(); - $list .= ''; - $list .= ''.$cat['id'].''; - $list .= ''.$cat['name'].''; - $list .= ''.strtoupper($cat['game']).''; - $list .= ''.$plugins.' шт.'; - $list .= ''.$cat['sort'].''; - $list .= 'Удалить'; - $list .= ''; - } + $list .= ''; + $list .= ''.$cat['id'].''; + $list .= ''.$cat['name'].''; + $list .= ''.strtoupper($cat['game']).''; + $list .= ''.$plugins.' шт.'; + $list .= ''.$cat['sort'].''; + $list .= 'Удалить'; + $list .= ''; + } - $html->get('cats', 'sections/addons'); + $html->get('cats', 'sections/addons'); - $html->set('list', $list); + $html->set('list', $list); - $html->pack('main'); + $html->pack('main'); ?> \ No newline at end of file diff --git a/system/acp/sections/addons/delete.php b/system/acp/sections/addons/delete.php index e57a3f4..68e2c44 100644 --- a/system/acp/sections/addons/delete.php +++ b/system/acp/sections/addons/delete.php @@ -1,60 +1,60 @@ query('DELETE FROM `plugins_config` WHERE `plugin`="'.$id.'"'); - $sql->query('DELETE FROM `plugins_clear` WHERE `plugin`="'.$id.'"'); - $sql->query('DELETE FROM `plugins_write` WHERE `plugin`="'.$id.'"'); - $sql->query('DELETE FROM `plugins_write_del` WHERE `plugin`="'.$id.'"'); - $sql->query('DELETE FROM `plugins_delete` WHERE `plugin`="'.$id.'"'); - $sql->query('DELETE FROM `plugins_delete_ins` WHERE `plugin`="'.$id.'" LIMIT 1'); - $sql->query('DELETE FROM `plugins` WHERE `id`="'.$id.'" LIMIT 1'); + if($url['type'] == 'plugin') + { + $sql->query('DELETE FROM `plugins_config` WHERE `plugin`="'.$id.'"'); + $sql->query('DELETE FROM `plugins_clear` WHERE `plugin`="'.$id.'"'); + $sql->query('DELETE FROM `plugins_write` WHERE `plugin`="'.$id.'"'); + $sql->query('DELETE FROM `plugins_write_del` WHERE `plugin`="'.$id.'"'); + $sql->query('DELETE FROM `plugins_delete` WHERE `plugin`="'.$id.'"'); + $sql->query('DELETE FROM `plugins_delete_ins` WHERE `plugin`="'.$id.'" LIMIT 1'); + $sql->query('DELETE FROM `plugins` WHERE `id`="'.$id.'" LIMIT 1'); - $sql->query('SELECT `id` FROM `plugins_update` WHERE `plugin`="'.$plugin['plugin'].'"'); - while($update = $sql->get()) - { - unlink(FILES.'plugins/delete/u'.$update['id'].'.rm'); - unlink(FILES.'plugins/delete/'.$update['id'].'.rm'); - unlink(FILES.'plugins/install/u'.$update['id'].'.zip'); - unlink(FILES.'plugins/update/'.$update['id'].'.zip'); - } + $sql->query('SELECT `id` FROM `plugins_update` WHERE `plugin`="'.$plugin['plugin'].'"'); + while($update = $sql->get()) + { + unlink(FILES.'plugins/delete/u'.$update['id'].'.rm'); + unlink(FILES.'plugins/delete/'.$update['id'].'.rm'); + unlink(FILES.'plugins/install/u'.$update['id'].'.zip'); + unlink(FILES.'plugins/update/'.$update['id'].'.zip'); + } - unlink(FILES.'plugins/delete/'.$id.'.rm'); - unlink(FILES.'plugins/install/'.$id.'.zip'); + unlink(FILES.'plugins/delete/'.$id.'.rm'); + unlink(FILES.'plugins/install/'.$id.'.zip'); - $sql->query('DELETE FROM `plugins_update` WHERE `id`="'.$id.'"'); - }elseif($url['type'] == 'update'){ - $sql->query('DELETE FROM `plugins_config` WHERE `update`="'.$id.'"'); - $sql->query('DELETE FROM `plugins_clear` WHERE `update`="'.$id.'"'); - $sql->query('DELETE FROM `plugins_write` WHERE `update`="'.$id.'"'); - $sql->query('DELETE FROM `plugins_write_del` WHERE `update`="'.$id.'"'); - $sql->query('DELETE FROM `plugins_delete` WHERE `update`="'.$id.'"'); - $sql->query('DELETE FROM `plugins_delete_ins` WHERE `update`="'.$id.'" LIMIT 1'); + $sql->query('DELETE FROM `plugins_update` WHERE `id`="'.$id.'"'); + }elseif($url['type'] == 'update'){ + $sql->query('DELETE FROM `plugins_config` WHERE `update`="'.$id.'"'); + $sql->query('DELETE FROM `plugins_clear` WHERE `update`="'.$id.'"'); + $sql->query('DELETE FROM `plugins_write` WHERE `update`="'.$id.'"'); + $sql->query('DELETE FROM `plugins_write_del` WHERE `update`="'.$id.'"'); + $sql->query('DELETE FROM `plugins_delete` WHERE `update`="'.$id.'"'); + $sql->query('DELETE FROM `plugins_delete_ins` WHERE `update`="'.$id.'" LIMIT 1'); - unlink(FILES.'plugins/delete/u'.$id.'.rm'); - unlink(FILES.'plugins/install/u'.$id.'.zip'); - unlink(FILES.'plugins/update/'.$id.'.zip'); + unlink(FILES.'plugins/delete/u'.$id.'.rm'); + unlink(FILES.'plugins/install/u'.$id.'.zip'); + unlink(FILES.'plugins/update/'.$id.'.zip'); - $sql->query('DELETE FROM `plugins_update` WHERE `id`="'.$id.'" LIMIT 1'); + $sql->query('DELETE FROM `plugins_update` WHERE `id`="'.$id.'" LIMIT 1'); - $sql->query('SELECT `id` FROM `plugins_update` WHERE `plugin`="'.$plugin['plugin'].'" ORDER BY `id` DESC LIMIT 1'); - if($sql->num()) - { - $update = $sql->get(); + $sql->query('SELECT `id` FROM `plugins_update` WHERE `plugin`="'.$plugin['plugin'].'" ORDER BY `id` DESC LIMIT 1'); + if($sql->num()) + { + $update = $sql->get(); - $sql->query('UPDATE `plugins` set `upd`="'.$update['id'].'" WHERE `id`="'.$plugin['plugin'].'" LIMIT 1'); - }else - $sql->query('UPDATE `plugins` set `upd`="0" WHERE `id`="'.$plugin['plugin'].'" LIMIT 1'); - }else{ - $sql->query('SELECT `id` FROM `plugins` WHERE `cat`="'.$id.'" LIMIT 1'); - if(!$sql->num()) - $sql->query('DELETE FROM `plugins_category` WHERE `id`="'.$id.'" LIMIT 1'); - } + $sql->query('UPDATE `plugins` set `upd`="'.$update['id'].'" WHERE `id`="'.$plugin['plugin'].'" LIMIT 1'); + }else + $sql->query('UPDATE `plugins` set `upd`="0" WHERE `id`="'.$plugin['plugin'].'" LIMIT 1'); + }else{ + $sql->query('SELECT `id` FROM `plugins` WHERE `cat`="'.$id.'" LIMIT 1'); + if(!$sql->num()) + $sql->query('DELETE FROM `plugins_category` WHERE `id`="'.$id.'" LIMIT 1'); + } - sys::outjs(array('s' => 'ok')); + sys::outjs(array('s' => 'ok')); ?> \ No newline at end of file diff --git a/system/acp/sections/addons/index.php b/system/acp/sections/addons/index.php index 4a6ea8e..df7ea2f 100644 --- a/system/acp/sections/addons/index.php +++ b/system/acp/sections/addons/index.php @@ -1,68 +1,68 @@ $sort); - } + $sort_icon = array($url['sort'] => $sort); + } - $list = ''; + $list = ''; - $sql->query('SELECT `id` FROM `plugins`'); + $sql->query('SELECT `id` FROM `plugins`'); - $aPage = sys::page($page, $sql->num(), 20); + $aPage = sys::page($page, $sql->num(), 20); - sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/addons'.$sort_page); + sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/addons'.$sort_page); - $status = array(0 => 'Стабильный', 1 => 'Нестабильный', 2 => 'Тестируемый'); + $status = array(0 => 'Стабильный', 1 => 'Нестабильный', 2 => 'Тестируемый'); - $plugins = $sql->query('SELECT `id`, `cat`, `game`, `name`, `status` FROM `plugins` '.$sort_sql.' LIMIT '.$aPage['num'].', 20'); - while($plugin = $sql->get($plugins)) - { - $sql->query('SELECT `name` FROM `plugins_category` WHERE `id`="'.$plugin['cat'].'" LIMIT 1'); - $cat = $sql->get(); + $plugins = $sql->query('SELECT `id`, `cat`, `game`, `name`, `status` FROM `plugins` '.$sort_sql.' LIMIT '.$aPage['num'].', 20'); + while($plugin = $sql->get($plugins)) + { + $sql->query('SELECT `name` FROM `plugins_category` WHERE `id`="'.$plugin['cat'].'" LIMIT 1'); + $cat = $sql->get(); - $list .= ''; - $list .= ''.$plugin['id'].''; - $list .= ''.$plugin['name'].''; - $list .= ''.$cat['name'].''; - $list .= ''.$status[$plugin['status']].''; - $list .= ''.strtoupper($plugin['game']).''; - $list .= 'Удалить'; - $list .= ''; - } + $list .= ''; + $list .= ''.$plugin['id'].''; + $list .= ''.$plugin['name'].''; + $list .= ''.$cat['name'].''; + $list .= ''.$status[$plugin['status']].''; + $list .= ''.strtoupper($plugin['game']).''; + $list .= 'Удалить'; + $list .= ''; + } - $html->get('index', 'sections/addons'); + $html->get('index', 'sections/addons'); - $html->set('sort_id', 'asc'); - $html->set('sort_cat', 'asc'); - $html->set('sort_game', 'asc'); + $html->set('sort_id', 'asc'); + $html->set('sort_cat', 'asc'); + $html->set('sort_game', 'asc'); - if(isset($sort_icon)) - $html->set('sort_'.key($sort_icon), array_shift($sort_icon)); + if(isset($sort_icon)) + $html->set('sort_'.key($sort_icon), array_shift($sort_icon)); - $html->set('list', $list); + $html->set('list', $list); - $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); + $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); - $html->pack('main'); - } + $html->pack('main'); + } ?> \ No newline at end of file diff --git a/system/acp/sections/addons/plugin.php b/system/acp/sections/addons/plugin.php index 5502fd6..ac12bab 100644 --- a/system/acp/sections/addons/plugin.php +++ b/system/acp/sections/addons/plugin.php @@ -1,337 +1,337 @@ query('SELECT * FROM `plugins` WHERE `id`="'.$id.'" LIMIT 1'); - $plugin = $sql->get(); + $sql->query('SELECT * FROM `plugins` WHERE `id`="'.$id.'" LIMIT 1'); + $plugin = $sql->get(); - $aGames = array( - 'cs' => 'Counter-Strike: 1.6', - 'cssold' => 'Counter-Strike: Source v34', - 'css' => 'Counter-Strike: Source', - 'csgo' => 'Counter-Strike: Global Offensive', - 'samp' => 'San Andreas Multiplayer', - 'crmp' => 'GTA: Criminal Russia', - 'mta' => 'Multi Theft Auto', - 'mc' => 'Minecraft' - ); + $aGames = array( + 'cs' => 'Counter-Strike: 1.6', + 'cssold' => 'Counter-Strike: Source v34', + 'css' => 'Counter-Strike: Source', + 'csgo' => 'Counter-Strike: Global Offensive', + 'samp' => 'San Andreas Multiplayer', + 'crmp' => 'GTA: Criminal Russia', + 'mta' => 'Multi Theft Auto', + 'mc' => 'Minecraft' + ); - if($go) - { - $aData = array(); + if($go) + { + $aData = array(); - $aData['name'] = isset($_POST['name']) ? trim($_POST['name']) : $plugin['name']; - $aData['cat'] = isset($_POST['category']) ? sys::int($_POST['category']) : $plugin['cat']; - $aData['status'] = isset($_POST['status']) ? sys::int($_POST['status']) : $plugin['status']; - $aData['packs'] = isset($_POST['packs']) ? trim($_POST['packs']) : $plugin['packs']; - $aData['desc'] = isset($_POST['desc']) ? trim($_POST['desc']) : $plugin['desc']; - $aData['info'] = isset($_POST['info']) ? trim($_POST['info']) : $plugin['info']; - $aData['images'] = isset($_POST['images']) ? trim($_POST['images']) : $plugin['images']; - $aData['incompatible'] = isset($_POST['incompatible']) ? trim($_POST['incompatible']) : $plugin['incompatible']; - $aData['choice'] = isset($_POST['choice']) ? trim($_POST['choice']) : $plugin['choice']; - $aData['required'] = isset($_POST['required']) ? trim($_POST['required']) : $plugin['required']; - $aData['update'] = isset($_POST['update']) ? sys::int($_POST['update']) : $plugin['update']; - $aData['delete'] = isset($_POST['delete']) ? sys::int($_POST['delete']) : $plugin['delete']; - $aData['sort'] = isset($_POST['sort']) ? sys::int($_POST['sort']) : $plugin['sort']; - $aData['price'] = isset($_POST['price']) ? ceil($_POST['price']) : $plugin['price']; + $aData['name'] = isset($_POST['name']) ? trim($_POST['name']) : $plugin['name']; + $aData['cat'] = isset($_POST['category']) ? sys::int($_POST['category']) : $plugin['cat']; + $aData['status'] = isset($_POST['status']) ? sys::int($_POST['status']) : $plugin['status']; + $aData['packs'] = isset($_POST['packs']) ? trim($_POST['packs']) : $plugin['packs']; + $aData['desc'] = isset($_POST['desc']) ? trim($_POST['desc']) : $plugin['desc']; + $aData['info'] = isset($_POST['info']) ? trim($_POST['info']) : $plugin['info']; + $aData['images'] = isset($_POST['images']) ? trim($_POST['images']) : $plugin['images']; + $aData['incompatible'] = isset($_POST['incompatible']) ? trim($_POST['incompatible']) : $plugin['incompatible']; + $aData['choice'] = isset($_POST['choice']) ? trim($_POST['choice']) : $plugin['choice']; + $aData['required'] = isset($_POST['required']) ? trim($_POST['required']) : $plugin['required']; + $aData['update'] = isset($_POST['update']) ? sys::int($_POST['update']) : $plugin['update']; + $aData['delete'] = isset($_POST['delete']) ? sys::int($_POST['delete']) : $plugin['delete']; + $aData['sort'] = isset($_POST['sort']) ? sys::int($_POST['sort']) : $plugin['sort']; + $aData['price'] = isset($_POST['price']) ? ceil($_POST['price']) : $plugin['price']; - $aData['config_files_file'] = isset($_POST['config_files_file']) ? $_POST['config_files_file'] : array(); - $aData['config_files_sort'] = isset($_POST['config_files_sort']) ? $_POST['config_files_sort'] : array(); - $aData['config_clear_file'] = isset($_POST['config_clear_file']) ? $_POST['config_clear_file'] : array(); - $aData['config_clear_text'] = isset($_POST['config_clear_text']) ? $_POST['config_clear_text'] : array(); - $aData['config_write_file'] = isset($_POST['config_write_file']) ? $_POST['config_write_file'] : array(); - $aData['config_write_text'] = isset($_POST['config_write_text']) ? $_POST['config_write_text'] : array(); - $aData['config_write_top'] = isset($_POST['config_write_top']) ? $_POST['config_write_top'] : array(); - $aData['config_write_del_file'] = isset($_POST['config_write_del_file']) ? $_POST['config_write_del_file'] : array(); - $aData['config_write_del_text'] = isset($_POST['config_write_del_text']) ? $_POST['config_write_del_text'] : array(); - $aData['config_write_del_top'] = isset($_POST['config_write_del_top']) ? $_POST['config_write_del_top'] : array(); - $aData['files_delete_file'] = isset($_POST['files_delete_file']) ? $_POST['files_delete_file'] : array(); + $aData['config_files_file'] = isset($_POST['config_files_file']) ? $_POST['config_files_file'] : array(); + $aData['config_files_sort'] = isset($_POST['config_files_sort']) ? $_POST['config_files_sort'] : array(); + $aData['config_clear_file'] = isset($_POST['config_clear_file']) ? $_POST['config_clear_file'] : array(); + $aData['config_clear_text'] = isset($_POST['config_clear_text']) ? $_POST['config_clear_text'] : array(); + $aData['config_write_file'] = isset($_POST['config_write_file']) ? $_POST['config_write_file'] : array(); + $aData['config_write_text'] = isset($_POST['config_write_text']) ? $_POST['config_write_text'] : array(); + $aData['config_write_top'] = isset($_POST['config_write_top']) ? $_POST['config_write_top'] : array(); + $aData['config_write_del_file'] = isset($_POST['config_write_del_file']) ? $_POST['config_write_del_file'] : array(); + $aData['config_write_del_text'] = isset($_POST['config_write_del_text']) ? $_POST['config_write_del_text'] : array(); + $aData['config_write_del_top'] = isset($_POST['config_write_del_top']) ? $_POST['config_write_del_top'] : array(); + $aData['files_delete_file'] = isset($_POST['files_delete_file']) ? $_POST['files_delete_file'] : array(); - $aData['cfg'] = 0; + $aData['cfg'] = 0; - if($aData['name'] == '') - sys::outjs(array('e' => 'Необходимо указать название')); + if($aData['name'] == '') + sys::outjs(array('e' => 'Необходимо указать название')); - $aPacks = explode(':', $aData['packs']); + $aPacks = explode(':', $aData['packs']); - $spacks = ''; + $spacks = ''; - foreach($aPacks as $packs) - $spacks .= trim($packs).':'; + foreach($aPacks as $packs) + $spacks .= trim($packs).':'; - $spacks = isset($spacks{0}) ? substr($spacks, 0, -1) : ''; + $spacks = isset($spacks{0}) ? substr($spacks, 0, -1) : ''; - $aData['packs'] = $spacks == '' ? 'all' : $spacks; + $aData['packs'] = $spacks == '' ? 'all' : $spacks; - $aIncom = explode(':', $aData['incompatible']); + $aIncom = explode(':', $aData['incompatible']); - $incoms = ''; + $incoms = ''; - foreach($aIncom as $incom) - { - $incom = trim($incom); + foreach($aIncom as $incom) + { + $incom = trim($incom); - if(!is_numeric($incom)) - continue; + if(!is_numeric($incom)) + continue; - $incoms .= intval($incom).':'; - } + $incoms .= intval($incom).':'; + } - $incoms = isset($incoms{0}) ? substr($incoms, 0, -1) : ''; + $incoms = isset($incoms{0}) ? substr($incoms, 0, -1) : ''; - $aData['incompatible'] = $incoms; + $aData['incompatible'] = $incoms; - $aChoice = explode(' ', $aData['choice']); + $aChoice = explode(' ', $aData['choice']); - $choice = ''; + $choice = ''; - foreach($aChoice as $chpl) - { - $aChpl = explode(':', $chpl); + foreach($aChoice as $chpl) + { + $aChpl = explode(':', $chpl); - foreach($aChpl as $idchpl) - { - $idchpl = trim($idchpl); + foreach($aChpl as $idchpl) + { + $idchpl = trim($idchpl); - if(!is_numeric($idchpl)) - continue; + if(!is_numeric($idchpl)) + continue; - $choice .= intval($idchpl).':'; - } + $choice .= intval($idchpl).':'; + } - $choice .= ' '; - } + $choice .= ' '; + } - $choice = isset($choice{0}) ? substr(trim($choice), 0, -1) : ''; + $choice = isset($choice{0}) ? substr(trim($choice), 0, -1) : ''; - $aData['choice'] = $choice; + $aData['choice'] = $choice; - $aRequi = explode(':', $aData['required']); + $aRequi = explode(':', $aData['required']); - $requis = ''; + $requis = ''; - foreach($aRequi as $requi) - { - $requi = trim($requi); + foreach($aRequi as $requi) + { + $requi = trim($requi); - if(!is_numeric($requi)) - continue; + if(!is_numeric($requi)) + continue; - $requis .= intval($requi).':'; - } + $requis .= intval($requi).':'; + } - $requis = isset($requis{0}) ? substr($requis, 0, -1) : ''; + $requis = isset($requis{0}) ? substr($requis, 0, -1) : ''; - $aData['required'] = $requis; + $aData['required'] = $requis; - $n = 0; + $n = 0; - $sql->query('DELETE FROM `plugins_config` WHERE `plugin`="'.$id.'" AND `update`="0"'); + $sql->query('DELETE FROM `plugins_config` WHERE `plugin`="'.$id.'" AND `update`="0"'); - foreach($aData['config_files_file'] as $i => $file) - { - if($file == '') - continue; + foreach($aData['config_files_file'] as $i => $file) + { + if($file == '') + continue; - $n+=1; + $n+=1; - $aData['config_files_sort'][$i] = $aData['config_files_sort'][$i] ? intval($aData['config_files_sort'][$i]) : $n; + $aData['config_files_sort'][$i] = $aData['config_files_sort'][$i] ? intval($aData['config_files_sort'][$i]) : $n; - $sql->query('INSERT INTO `plugins_config` set `plugin`="'.$id.'", `update`="0", `file`="'.$file.'", `sort`="'.$n.'"'); - } + $sql->query('INSERT INTO `plugins_config` set `plugin`="'.$id.'", `update`="0", `file`="'.$file.'", `sort`="'.$n.'"'); + } - if($n) - $aData['cfg'] = 1; + if($n) + $aData['cfg'] = 1; - $sql->query('DELETE FROM `plugins_clear` WHERE `plugin`="'.$id.'" AND `update`="0"'); + $sql->query('DELETE FROM `plugins_clear` WHERE `plugin`="'.$id.'" AND `update`="0"'); - foreach($aData['config_clear_file'] as $i => $file) - { - if($aData['config_clear_text'][$i] == '' || $file == '') - continue; + foreach($aData['config_clear_file'] as $i => $file) + { + if($aData['config_clear_text'][$i] == '' || $file == '') + continue; - $regex = (string) $aData['config_clear_regex'] == 'on' ? 1 : 0; + $regex = (string) $aData['config_clear_regex'] == 'on' ? 1 : 0; - $text = htmlspecialchars(trim($aData['config_clear_text'][$i])); + $text = htmlspecialchars(trim($aData['config_clear_text'][$i])); - $sql->query('INSERT INTO `plugins_clear` set `plugin`="'.$id.'", `update`="0", `text`="'.$text.'", `file`="'.$file.'", `regex`="'.$regex.'"'); - } + $sql->query('INSERT INTO `plugins_clear` set `plugin`="'.$id.'", `update`="0", `text`="'.$text.'", `file`="'.$file.'", `regex`="'.$regex.'"'); + } - $sql->query('DELETE FROM `plugins_write` WHERE `plugin`="'.$id.'" AND `update`="0"'); + $sql->query('DELETE FROM `plugins_write` WHERE `plugin`="'.$id.'" AND `update`="0"'); - foreach($aData['config_write_file'] as $i => $file) - { - if($aData['config_write_text'][$i] == '' || $file == '') - continue; + foreach($aData['config_write_file'] as $i => $file) + { + if($aData['config_write_text'][$i] == '' || $file == '') + continue; - $top = (string) $aData['config_write_top'][$i] == 'on' ? 1 : 0; + $top = (string) $aData['config_write_top'][$i] == 'on' ? 1 : 0; - $text = htmlspecialchars(trim($aData['config_write_text'][$i])); + $text = htmlspecialchars(trim($aData['config_write_text'][$i])); - $sql->query('INSERT INTO `plugins_write` set `plugin`="'.$id.'", `update`="0", `text`="'.$text.'", `file`="'.$file.'", `top`="'.$top.'"'); - } + $sql->query('INSERT INTO `plugins_write` set `plugin`="'.$id.'", `update`="0", `text`="'.$text.'", `file`="'.$file.'", `top`="'.$top.'"'); + } - $sql->query('DELETE FROM `plugins_write_del` WHERE `plugin`="'.$id.'" AND `update`="0"'); + $sql->query('DELETE FROM `plugins_write_del` WHERE `plugin`="'.$id.'" AND `update`="0"'); - foreach($aData['config_write_del_file'] as $i => $file) - { - if($aData['config_write_del_text'][$i] == '' || $file == '') - continue; + foreach($aData['config_write_del_file'] as $i => $file) + { + if($aData['config_write_del_text'][$i] == '' || $file == '') + continue; - $top = (string) $aData['config_write_del_top'][$i] == 'on' ? 1 : 0; + $top = (string) $aData['config_write_del_top'][$i] == 'on' ? 1 : 0; - $text = htmlspecialchars(trim($aData['config_write_del_text'][$i])); + $text = htmlspecialchars(trim($aData['config_write_del_text'][$i])); - $sql->query('INSERT INTO `plugins_write_del` set `plugin`="'.$id.'", `update`="0", `text`="'.$text.'", `file`="'.$file.'", `top`="'.$top.'"'); - } + $sql->query('INSERT INTO `plugins_write_del` set `plugin`="'.$id.'", `update`="0", `text`="'.$text.'", `file`="'.$file.'", `top`="'.$top.'"'); + } - $sql->query('DELETE FROM `plugins_delete` WHERE `plugin`="'.$id.'" AND `update`="0"'); + $sql->query('DELETE FROM `plugins_delete` WHERE `plugin`="'.$id.'" AND `update`="0"'); - foreach($aData['files_delete_file'] as $file) - { - if($file == '') - continue; + foreach($aData['files_delete_file'] as $file) + { + if($file == '') + continue; - $sql->query('INSERT INTO `plugins_delete` set `plugin`="'.$id.'", `update`="0", `file`="'.$file.'"'); - } + $sql->query('INSERT INTO `plugins_delete` set `plugin`="'.$id.'", `update`="0", `file`="'.$file.'"'); + } - if($aData['delete']) - { - $sql->query('DELETE FROM `plugins_delete_ins` WHERE `plugin`="'.$id.'" AND `update`="0" LIMIT 1'); + if($aData['delete']) + { + $sql->query('DELETE FROM `plugins_delete_ins` WHERE `plugin`="'.$id.'" AND `update`="0" LIMIT 1'); - $sql->query('INSERT INTO `plugins_delete_ins` set `plugin`="'.$id.'", `update`="0", `file`="'.$aData['delete'].'"'); - } + $sql->query('INSERT INTO `plugins_delete_ins` set `plugin`="'.$id.'", `update`="0", `file`="'.$aData['delete'].'"'); + } - $sql->query('UPDATE `plugins` set ' - .'`name`="'.htmlspecialchars($aData['name']).'",' - .'`cat`="'.$aData['cat'].'",' - .'`desc`="'.htmlspecialchars($aData['desc']).'",' - .'`info`="'.htmlspecialchars($aData['info']).'",' - .'`images`="'.htmlspecialchars($aData['images']).'",' - .'`incompatible`="'.$aData['incompatible'].'",' - .'`choice`="'.$aData['choice'].'",' - .'`status`="'.$aData['status'].'",' - .'`required`="'.$aData['required'].'",' - .'`cfg`="'.$aData['cfg'].'",' - .'`price`="'.$aData['price'].'",' - .'`packs`="'.$aData['packs'].'" WHERE `id`="'.$id.'"'); + $sql->query('UPDATE `plugins` set ' + .'`name`="'.htmlspecialchars($aData['name']).'",' + .'`cat`="'.$aData['cat'].'",' + .'`desc`="'.htmlspecialchars($aData['desc']).'",' + .'`info`="'.htmlspecialchars($aData['info']).'",' + .'`images`="'.htmlspecialchars($aData['images']).'",' + .'`incompatible`="'.$aData['incompatible'].'",' + .'`choice`="'.$aData['choice'].'",' + .'`status`="'.$aData['status'].'",' + .'`required`="'.$aData['required'].'",' + .'`cfg`="'.$aData['cfg'].'",' + .'`price`="'.$aData['price'].'",' + .'`packs`="'.$aData['packs'].'" WHERE `id`="'.$id.'"'); - sys::outjs(array('s' => 'ok')); - } + sys::outjs(array('s' => 'ok')); + } - $html->get('plugin', 'sections/addons'); + $html->get('plugin', 'sections/addons'); - $html->set('id', $plugin['id']); - $html->set('name', $plugin['name']); - $html->set('game', $aGames[$plugin['game']]); - $html->set('desc', htmlspecialchars_decode($plugin['desc'])); - $html->set('info', htmlspecialchars_decode($plugin['info'])); - $html->set('images', htmlspecialchars_decode($plugin['images'])); - - $html->set('incompatible', $plugin['incompatible']); - $html->set('choice', $plugin['choice']); - $html->set('required', $plugin['required']); - $html->set('packs', $plugin['packs']); - $html->set('sort', $plugin['sort']); - $html->set('price', $plugin['price']); - - $status = ''; - - $html->set('status', str_replace('"'.$plugin['status'].'">', '"'.$plugin['status'].'" selected>', $status)); - - $cats = ''; - - $sql->query('SELECT `id`, `name` FROM `plugins_category` WHERE `game`="'.$plugin['game'].'" ORDER BY `sort` ASC'); - while($cat = $sql->get()) - $cats .= ''; - - $html->set('category', str_replace('"'.$plugin['cat'].'">', '"'.$plugin['cat'].'" selected>', $cats)); - - $config_files_all = ''; - $config_clear_all = ''; - $config_write_all = ''; - $config_write_del_all = ''; - $files_delete_all = ''; - - $sql->query('SELECT `id`, `file`, `sort` FROM `plugins_config` WHERE `plugin`="'.$id.'" AND `update`="0" ORDER BY `sort` ASC'); - while($data = $sql->get()) - { - $config_files_all .= ''; - $config_files_all .= ''; - $config_files_all .= ''; - $config_files_all .= 'Удалить'; - $config_files_all .= ''; - } - - $sql->query('SELECT `id`, `text`, `file`, `regex` FROM `plugins_clear` WHERE `plugin`="'.$id.'" AND `update`="0" ORDER BY `id` ASC'); - while($data = $sql->get()) - { - $regex = $data['regex'] ? 'checked' : ''; - - $config_clear_all .= ''; - $config_clear_all .= ''; - $config_clear_all .= ''; - $config_clear_all .= ''; - $config_clear_all .= 'Удалить'; - $config_clear_all .= ''; - } - - $sql->query('SELECT `id`, `text`, `file`, `top` FROM `plugins_write` WHERE `plugin`="'.$id.'" AND `update`="0" ORDER BY `id` ASC'); - while($data = $sql->get()) - { - $top = $data['top'] ? 'checked' : ''; - - $config_write_all .= ''; - $config_write_all .= ''; - $config_write_all .= ''; - $config_write_all .= ''; - $config_write_all .= 'Удалить'; - $config_write_all .= ''; - } - - $sql->query('SELECT `id`, `text`, `file`, `top` FROM `plugins_write_del` WHERE `plugin`="'.$id.'" AND `update`="0" ORDER BY `id` ASC'); - while($data = $sql->get()) - { - $top = $data['top'] ? 'checked' : ''; - - $config_write_del_all .= ''; - $config_write_del_all .= ''; - $config_write_del_all .= ''; - $config_write_del_all .= ''; - $config_write_del_all .= 'Удалить'; - $config_write_del_all .= ''; - } - - $sql->query('SELECT `id`, `file` FROM `plugins_delete` WHERE `plugin`="'.$id.'" AND `update`="0" ORDER BY `id` ASC'); - while($data = $sql->get()) - { - $files_delete_all .= ''; - $files_delete_all .= ''; - $files_delete_all .= 'Удалить'; - $files_delete_all .= ''; - } - - $html->set('config_files_all', $config_files_all); - $html->set('config_clear_all', $config_clear_all); - $html->set('config_write_all', $config_write_all); - $html->set('config_write_del_all', $config_write_del_all); - $html->set('files_delete_all', $files_delete_all); - - $update = ''; - - $status = array(0 => 'Стабильный', 1 => 'Нестабильный', 2 => 'Тестируемый'); - - $sql->query('SELECT `id`, `name`, `status` FROM `plugins_update` WHERE `plugin`="'.$id.'" ORDER BY `id` ASC'); - while($data = $sql->get()) - { - $update .= ''; - $update .= ''.$data['name'].''; - $update .= ''.$status[$data['status']].''; - $update .= 'Удалить'; - $update .= ''; - } - - $html->set('update', $update); - - $html->pack('main'); + $html->set('id', $plugin['id']); + $html->set('name', $plugin['name']); + $html->set('game', $aGames[$plugin['game']]); + $html->set('desc', htmlspecialchars_decode($plugin['desc'])); + $html->set('info', htmlspecialchars_decode($plugin['info'])); + $html->set('images', htmlspecialchars_decode($plugin['images'])); + + $html->set('incompatible', $plugin['incompatible']); + $html->set('choice', $plugin['choice']); + $html->set('required', $plugin['required']); + $html->set('packs', $plugin['packs']); + $html->set('sort', $plugin['sort']); + $html->set('price', $plugin['price']); + + $status = ''; + + $html->set('status', str_replace('"'.$plugin['status'].'">', '"'.$plugin['status'].'" selected>', $status)); + + $cats = ''; + + $sql->query('SELECT `id`, `name` FROM `plugins_category` WHERE `game`="'.$plugin['game'].'" ORDER BY `sort` ASC'); + while($cat = $sql->get()) + $cats .= ''; + + $html->set('category', str_replace('"'.$plugin['cat'].'">', '"'.$plugin['cat'].'" selected>', $cats)); + + $config_files_all = ''; + $config_clear_all = ''; + $config_write_all = ''; + $config_write_del_all = ''; + $files_delete_all = ''; + + $sql->query('SELECT `id`, `file`, `sort` FROM `plugins_config` WHERE `plugin`="'.$id.'" AND `update`="0" ORDER BY `sort` ASC'); + while($data = $sql->get()) + { + $config_files_all .= ''; + $config_files_all .= ''; + $config_files_all .= ''; + $config_files_all .= 'Удалить'; + $config_files_all .= ''; + } + + $sql->query('SELECT `id`, `text`, `file`, `regex` FROM `plugins_clear` WHERE `plugin`="'.$id.'" AND `update`="0" ORDER BY `id` ASC'); + while($data = $sql->get()) + { + $regex = $data['regex'] ? 'checked' : ''; + + $config_clear_all .= ''; + $config_clear_all .= ''; + $config_clear_all .= ''; + $config_clear_all .= ''; + $config_clear_all .= 'Удалить'; + $config_clear_all .= ''; + } + + $sql->query('SELECT `id`, `text`, `file`, `top` FROM `plugins_write` WHERE `plugin`="'.$id.'" AND `update`="0" ORDER BY `id` ASC'); + while($data = $sql->get()) + { + $top = $data['top'] ? 'checked' : ''; + + $config_write_all .= ''; + $config_write_all .= ''; + $config_write_all .= ''; + $config_write_all .= ''; + $config_write_all .= 'Удалить'; + $config_write_all .= ''; + } + + $sql->query('SELECT `id`, `text`, `file`, `top` FROM `plugins_write_del` WHERE `plugin`="'.$id.'" AND `update`="0" ORDER BY `id` ASC'); + while($data = $sql->get()) + { + $top = $data['top'] ? 'checked' : ''; + + $config_write_del_all .= ''; + $config_write_del_all .= ''; + $config_write_del_all .= ''; + $config_write_del_all .= ''; + $config_write_del_all .= 'Удалить'; + $config_write_del_all .= ''; + } + + $sql->query('SELECT `id`, `file` FROM `plugins_delete` WHERE `plugin`="'.$id.'" AND `update`="0" ORDER BY `id` ASC'); + while($data = $sql->get()) + { + $files_delete_all .= ''; + $files_delete_all .= ''; + $files_delete_all .= 'Удалить'; + $files_delete_all .= ''; + } + + $html->set('config_files_all', $config_files_all); + $html->set('config_clear_all', $config_clear_all); + $html->set('config_write_all', $config_write_all); + $html->set('config_write_del_all', $config_write_del_all); + $html->set('files_delete_all', $files_delete_all); + + $update = ''; + + $status = array(0 => 'Стабильный', 1 => 'Нестабильный', 2 => 'Тестируемый'); + + $sql->query('SELECT `id`, `name`, `status` FROM `plugins_update` WHERE `plugin`="'.$id.'" ORDER BY `id` ASC'); + while($data = $sql->get()) + { + $update .= ''; + $update .= ''.$data['name'].''; + $update .= ''.$status[$data['status']].''; + $update .= 'Удалить'; + $update .= ''; + } + + $html->set('update', $update); + + $html->pack('main'); ?> \ No newline at end of file diff --git a/system/acp/sections/addons/search.php b/system/acp/sections/addons/search.php index ab13ee8..4742a9e 100644 --- a/system/acp/sections/addons/search.php +++ b/system/acp/sections/addons/search.php @@ -1,75 +1,75 @@ get($mkey); + $cache = $mcache->get($mkey); - if(is_array($cache)) - { - if($go) - sys::outjs($cache, $nmch); + if(is_array($cache)) + { + if($go) + sys::outjs($cache, $nmch); - sys::outjs($cache); - } + sys::outjs($cache); + } - if(!isset($text{2})) - { - if($go) - sys::outjs(array('e' => 'Для выполнения поиска, необходимо больше данных'), $nmch); + if(!isset($text{2})) + { + if($go) + sys::outjs(array('e' => 'Для выполнения поиска, необходимо больше данных'), $nmch); - sys::outjs(array('e' => '')); - } + sys::outjs(array('e' => '')); + } - if(substr($text, 0, 5) == 'game=') - { - $game = trim(substr($text, 5)); + if(substr($text, 0, 5) == 'game=') + { + $game = trim(substr($text, 5)); - if(in_array($game, array('cs', 'cssold', 'css', 'csgo', 'samp', 'crmp', 'mta', 'mc'))) - $plugins = $sql->query('SELECT `id`, `cat`, `game`, `name`, `status` FROM `plugins` WHERE `game`="'.$game.'" ORDER BY `id` ASC'); - }elseif($text{0} == 'i' AND $text{1} == 'd') - $plugins = $sql->query('SELECT `id`, `cat`, `game`, `name`, `status` FROM `plugins` WHERE `id`="'.sys::int($text).'" LIMIT 1'); - else{ - $like = '`id` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' - .'`name` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' - .'`desc` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' - .'`info` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' - .'`packs` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\')'; + if(in_array($game, array('cs', 'cssold', 'css', 'csgo', 'samp', 'crmp', 'mta', 'mc'))) + $plugins = $sql->query('SELECT `id`, `cat`, `game`, `name`, `status` FROM `plugins` WHERE `game`="'.$game.'" ORDER BY `id` ASC'); + }elseif($text{0} == 'i' AND $text{1} == 'd') + $plugins = $sql->query('SELECT `id`, `cat`, `game`, `name`, `status` FROM `plugins` WHERE `id`="'.sys::int($text).'" LIMIT 1'); + else{ + $like = '`id` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' + .'`name` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' + .'`desc` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' + .'`info` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' + .'`packs` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\')'; - $plugins = $sql->query('SELECT `id`, `cat`, `game`, `name`, `status` FROM `plugins` WHERE '.$like.' ORDER BY `id` ASC LIMIT 10'); - } + $plugins = $sql->query('SELECT `id`, `cat`, `game`, `name`, `status` FROM `plugins` WHERE '.$like.' ORDER BY `id` ASC LIMIT 10'); + } - if(!$sql->num($plugins)) - { - if($go) - sys::outjs(array('e' => 'По вашему запросу ничего не найдено'), $nmch); + if(!$sql->num($plugins)) + { + if($go) + sys::outjs(array('e' => 'По вашему запросу ничего не найдено'), $nmch); - sys::outjs(array('e' => 'По вашему запросу ничего не найдено')); - } + sys::outjs(array('e' => 'По вашему запросу ничего не найдено')); + } - $list = ''; + $list = ''; - $status = array(0 => 'Стабильный', 2 => 'Нестабильный', 1 => 'Тестируемый'); + $status = array(0 => 'Стабильный', 2 => 'Нестабильный', 1 => 'Тестируемый'); - while($plugin = $sql->get($plugins)) - { - $sql->query('SELECT `name` FROM `plugins_category` WHERE `id`="'.$plugin['cat'].'" LIMIT 1'); - $cat = $sql->get(); + while($plugin = $sql->get($plugins)) + { + $sql->query('SELECT `name` FROM `plugins_category` WHERE `id`="'.$plugin['cat'].'" LIMIT 1'); + $cat = $sql->get(); - $list .= ''; - $list .= ''.$plugin['id'].''; - $list .= ''.$plugin['name'].''; - $list .= ''.$cat['name'].''; - $list .= ''.$status[$plugin['status']].''; - $list .= ''.strtoupper($plugin['game']).''; - $list .= 'Удалить'; - $list .= ''; - } + $list .= ''; + $list .= ''.$plugin['id'].''; + $list .= ''.$plugin['name'].''; + $list .= ''.$cat['name'].''; + $list .= ''.$status[$plugin['status']].''; + $list .= ''.strtoupper($plugin['game']).''; + $list .= 'Удалить'; + $list .= ''; + } - $mcache->set($mkey, array('s' => $list), false, 15); + $mcache->set($mkey, array('s' => $list), false, 15); - sys::outjs(array('s' => $list)); + sys::outjs(array('s' => $list)); ?> \ No newline at end of file diff --git a/system/acp/sections/addons/update.php b/system/acp/sections/addons/update.php index 162a066..ccc3b75 100644 --- a/system/acp/sections/addons/update.php +++ b/system/acp/sections/addons/update.php @@ -1,322 +1,322 @@ query('SELECT * FROM `plugins_update` WHERE `id`="'.$id.'" LIMIT 1'); - $plugin = $sql->get(); + $sql->query('SELECT * FROM `plugins_update` WHERE `id`="'.$id.'" LIMIT 1'); + $plugin = $sql->get(); - $aGames = array( - 'cs' => 'Counter-Strike: 1.6', - 'cssold' => 'Counter-Strike: Source v34', - 'css' => 'Counter-Strike: Source', - 'csgo' => 'Counter-Strike: Global Offensive', - 'samp' => 'San Andreas Multiplayer', - 'crmp' => 'GTA: Criminal Russia', - 'mta' => 'Multi Theft Auto', - 'mc' => 'Minecraft' - ); + $aGames = array( + 'cs' => 'Counter-Strike: 1.6', + 'cssold' => 'Counter-Strike: Source v34', + 'css' => 'Counter-Strike: Source', + 'csgo' => 'Counter-Strike: Global Offensive', + 'samp' => 'San Andreas Multiplayer', + 'crmp' => 'GTA: Criminal Russia', + 'mta' => 'Multi Theft Auto', + 'mc' => 'Minecraft' + ); - if($go) - { - $aData = array(); + if($go) + { + $aData = array(); - $aData['name'] = isset($_POST['name']) ? trim($_POST['name']) : $plugin['name']; - $aData['cat'] = isset($_POST['category']) ? sys::int($_POST['category']) : $plugin['cat']; - $aData['status'] = isset($_POST['status']) ? sys::int($_POST['status']) : $plugin['status']; - $aData['packs'] = isset($_POST['packs']) ? trim($_POST['packs']) : $plugin['packs']; - $aData['desc'] = isset($_POST['desc']) ? trim($_POST['desc']) : $plugin['desc']; - $aData['info'] = isset($_POST['info']) ? trim($_POST['info']) : $plugin['info']; - $aData['images'] = isset($_POST['images']) ? trim($_POST['images']) : $plugin['images']; - $aData['incompatible'] = isset($_POST['incompatible']) ? trim($_POST['incompatible']) : $plugin['incompatible']; - $aData['choice'] = isset($_POST['choice']) ? trim($_POST['choice']) : $plugin['choice']; - $aData['required'] = isset($_POST['required']) ? trim($_POST['required']) : $plugin['required']; - $aData['update'] = isset($_POST['update']) ? sys::int($_POST['update']) : $plugin['update']; - $aData['delete'] = isset($_POST['delete']) ? sys::int($_POST['delete']) : $plugin['delete']; - $aData['sort'] = isset($_POST['sort']) ? sys::int($_POST['sort']) : $plugin['sort']; - $aData['price'] = isset($_POST['price']) ? ceil($_POST['price']) : $plugin['price']; + $aData['name'] = isset($_POST['name']) ? trim($_POST['name']) : $plugin['name']; + $aData['cat'] = isset($_POST['category']) ? sys::int($_POST['category']) : $plugin['cat']; + $aData['status'] = isset($_POST['status']) ? sys::int($_POST['status']) : $plugin['status']; + $aData['packs'] = isset($_POST['packs']) ? trim($_POST['packs']) : $plugin['packs']; + $aData['desc'] = isset($_POST['desc']) ? trim($_POST['desc']) : $plugin['desc']; + $aData['info'] = isset($_POST['info']) ? trim($_POST['info']) : $plugin['info']; + $aData['images'] = isset($_POST['images']) ? trim($_POST['images']) : $plugin['images']; + $aData['incompatible'] = isset($_POST['incompatible']) ? trim($_POST['incompatible']) : $plugin['incompatible']; + $aData['choice'] = isset($_POST['choice']) ? trim($_POST['choice']) : $plugin['choice']; + $aData['required'] = isset($_POST['required']) ? trim($_POST['required']) : $plugin['required']; + $aData['update'] = isset($_POST['update']) ? sys::int($_POST['update']) : $plugin['update']; + $aData['delete'] = isset($_POST['delete']) ? sys::int($_POST['delete']) : $plugin['delete']; + $aData['sort'] = isset($_POST['sort']) ? sys::int($_POST['sort']) : $plugin['sort']; + $aData['price'] = isset($_POST['price']) ? ceil($_POST['price']) : $plugin['price']; - $aData['config_files_file'] = isset($_POST['config_files_file']) ? $_POST['config_files_file'] : array(); - $aData['config_files_sort'] = isset($_POST['config_files_sort']) ? $_POST['config_files_sort'] : array(); - $aData['config_clear_file'] = isset($_POST['config_clear_file']) ? $_POST['config_clear_file'] : array(); - $aData['config_clear_text'] = isset($_POST['config_clear_text']) ? $_POST['config_clear_text'] : array(); - $aData['config_write_file'] = isset($_POST['config_write_file']) ? $_POST['config_write_file'] : array(); - $aData['config_write_text'] = isset($_POST['config_write_text']) ? $_POST['config_write_text'] : array(); - $aData['config_write_top'] = isset($_POST['config_write_top']) ? $_POST['config_write_top'] : array(); - $aData['config_write_del_file'] = isset($_POST['config_write_del_file']) ? $_POST['config_write_del_file'] : array(); - $aData['config_write_del_text'] = isset($_POST['config_write_del_text']) ? $_POST['config_write_del_text'] : array(); - $aData['config_write_del_top'] = isset($_POST['config_write_del_top']) ? $_POST['config_write_del_top'] : array(); - $aData['files_delete_file'] = isset($_POST['files_delete_file']) ? $_POST['files_delete_file'] : array(); + $aData['config_files_file'] = isset($_POST['config_files_file']) ? $_POST['config_files_file'] : array(); + $aData['config_files_sort'] = isset($_POST['config_files_sort']) ? $_POST['config_files_sort'] : array(); + $aData['config_clear_file'] = isset($_POST['config_clear_file']) ? $_POST['config_clear_file'] : array(); + $aData['config_clear_text'] = isset($_POST['config_clear_text']) ? $_POST['config_clear_text'] : array(); + $aData['config_write_file'] = isset($_POST['config_write_file']) ? $_POST['config_write_file'] : array(); + $aData['config_write_text'] = isset($_POST['config_write_text']) ? $_POST['config_write_text'] : array(); + $aData['config_write_top'] = isset($_POST['config_write_top']) ? $_POST['config_write_top'] : array(); + $aData['config_write_del_file'] = isset($_POST['config_write_del_file']) ? $_POST['config_write_del_file'] : array(); + $aData['config_write_del_text'] = isset($_POST['config_write_del_text']) ? $_POST['config_write_del_text'] : array(); + $aData['config_write_del_top'] = isset($_POST['config_write_del_top']) ? $_POST['config_write_del_top'] : array(); + $aData['files_delete_file'] = isset($_POST['files_delete_file']) ? $_POST['files_delete_file'] : array(); - $aData['cfg'] = 0; + $aData['cfg'] = 0; - if($aData['name'] == '') - sys::outjs(array('e' => 'Необходимо указать название')); + if($aData['name'] == '') + sys::outjs(array('e' => 'Необходимо указать название')); - $aPacks = explode(':', $aData['packs']); + $aPacks = explode(':', $aData['packs']); - $spacks = ''; + $spacks = ''; - foreach($aPacks as $packs) - { - $packs = trim($packs); + foreach($aPacks as $packs) + { + $packs = trim($packs); - $spacks .= intval($packs).':'; - } + $spacks .= intval($packs).':'; + } - $spacks = isset($spacks{0}) ? substr($spacks, 0, -1) : ''; + $spacks = isset($spacks{0}) ? substr($spacks, 0, -1) : ''; - $aData['packs'] = $spacks == '' ? $spacks : 'all'; + $aData['packs'] = $spacks == '' ? $spacks : 'all'; - $aIncom = explode(':', $aData['incompatible']); + $aIncom = explode(':', $aData['incompatible']); - $incoms = ''; + $incoms = ''; - foreach($aIncom as $incom) - { - $incom = trim($incom); + foreach($aIncom as $incom) + { + $incom = trim($incom); - if(!is_numeric($incom)) - continue; + if(!is_numeric($incom)) + continue; - $incoms .= intval($incom).':'; - } + $incoms .= intval($incom).':'; + } - $incoms = isset($incoms{0}) ? substr($incoms, 0, -1) : ''; + $incoms = isset($incoms{0}) ? substr($incoms, 0, -1) : ''; - $aData['incompatible'] = $incoms; + $aData['incompatible'] = $incoms; - $aChoice = explode(' ', $aData['choice']); + $aChoice = explode(' ', $aData['choice']); - $choice = ''; + $choice = ''; - foreach($aChoice as $chpl) - { - $aChpl = explode(':', $chpl); + foreach($aChoice as $chpl) + { + $aChpl = explode(':', $chpl); - foreach($aChpl as $idchpl) - { - $idchpl = trim($idchpl); + foreach($aChpl as $idchpl) + { + $idchpl = trim($idchpl); - if(!is_numeric($idchpl)) - continue; + if(!is_numeric($idchpl)) + continue; - $choice .= intval($idchpl).':'; - } + $choice .= intval($idchpl).':'; + } - $choice .= ' '; - } + $choice .= ' '; + } - $choice = isset($choice{0}) ? substr(trim($choice), 0, -1) : ''; + $choice = isset($choice{0}) ? substr(trim($choice), 0, -1) : ''; - $aData['choice'] = $choice; + $aData['choice'] = $choice; - $aRequi = explode(':', $aData['required']); + $aRequi = explode(':', $aData['required']); - $requis = ''; + $requis = ''; - foreach($aRequi as $requi) - { - $requi = trim($requi); + foreach($aRequi as $requi) + { + $requi = trim($requi); - if(!is_numeric($requi)) - continue; + if(!is_numeric($requi)) + continue; - $requis .= intval($requi).':'; - } + $requis .= intval($requi).':'; + } - $requis = isset($requis{0}) ? substr($requis, 0, -1) : ''; + $requis = isset($requis{0}) ? substr($requis, 0, -1) : ''; - $aData['required'] = $requis; + $aData['required'] = $requis; - $n = 0; + $n = 0; - $sql->query('DELETE FROM `plugins_config` WHERE `update`="'.$id.'"'); + $sql->query('DELETE FROM `plugins_config` WHERE `update`="'.$id.'"'); - foreach($aData['config_files_file'] as $i => $file) - { - if($file == '') - continue; + foreach($aData['config_files_file'] as $i => $file) + { + if($file == '') + continue; - $n+=1; + $n+=1; - $aData['config_files_sort'][$i] = $aData['config_files_sort'][$i] ? intval($aData['config_files_sort'][$i]) : $n; + $aData['config_files_sort'][$i] = $aData['config_files_sort'][$i] ? intval($aData['config_files_sort'][$i]) : $n; - $sql->query('INSERT INTO `plugins_config` set `plugin`="'.$plugin['plugin'].'", `update`="'.$id.'", `file`="'.$file.'", `sort`="'.$n.'"'); - } + $sql->query('INSERT INTO `plugins_config` set `plugin`="'.$plugin['plugin'].'", `update`="'.$id.'", `file`="'.$file.'", `sort`="'.$n.'"'); + } - if($n) - $aData['cfg'] = 1; + if($n) + $aData['cfg'] = 1; - $sql->query('DELETE FROM `plugins_clear` WHERE `update`="'.$id.'"'); + $sql->query('DELETE FROM `plugins_clear` WHERE `update`="'.$id.'"'); - foreach($aData['config_clear_file'] as $i => $file) - { - if($aData['config_clear_text'][$i] == '' || $file == '') - continue; + foreach($aData['config_clear_file'] as $i => $file) + { + if($aData['config_clear_text'][$i] == '' || $file == '') + continue; - $regex = (string) $aData['config_clear_regex'] == 'on' ? 1 : 0; + $regex = (string) $aData['config_clear_regex'] == 'on' ? 1 : 0; - $text = htmlspecialchars(trim($aData['config_clear_text'][$i])); + $text = htmlspecialchars(trim($aData['config_clear_text'][$i])); - $sql->query('INSERT INTO `plugins_clear` set `plugin`="'.$plugin['plugin'].'", `update`="'.$id.'", `text`="'.$text.'", `file`="'.$file.'", `regex`="'.$regex.'"'); - } + $sql->query('INSERT INTO `plugins_clear` set `plugin`="'.$plugin['plugin'].'", `update`="'.$id.'", `text`="'.$text.'", `file`="'.$file.'", `regex`="'.$regex.'"'); + } - $sql->query('DELETE FROM `plugins_write` WHERE `update`="'.$id.'"'); + $sql->query('DELETE FROM `plugins_write` WHERE `update`="'.$id.'"'); - foreach($aData['config_write_file'] as $i => $file) - { - if($aData['config_write_text'][$i] == '' || $file == '') - continue; + foreach($aData['config_write_file'] as $i => $file) + { + if($aData['config_write_text'][$i] == '' || $file == '') + continue; - $top = (string) $aData['config_write_top'][$i] == 'on' ? 1 : 0; + $top = (string) $aData['config_write_top'][$i] == 'on' ? 1 : 0; - $text = htmlspecialchars(trim($aData['config_write_text'][$i])); + $text = htmlspecialchars(trim($aData['config_write_text'][$i])); - $sql->query('INSERT INTO `plugins_write` set `plugin`="'.$plugin['plugin'].'", `update`="'.$id.'", `text`="'.$text.'", `file`="'.$file.'", `top`="'.$top.'"'); - } + $sql->query('INSERT INTO `plugins_write` set `plugin`="'.$plugin['plugin'].'", `update`="'.$id.'", `text`="'.$text.'", `file`="'.$file.'", `top`="'.$top.'"'); + } - $sql->query('DELETE FROM `plugins_write_del` WHERE `update`="'.$id.'"'); + $sql->query('DELETE FROM `plugins_write_del` WHERE `update`="'.$id.'"'); - foreach($aData['config_write_del_file'] as $i => $file) - { - if($aData['config_write_del_text'][$i] == '' || $file == '') - continue; + foreach($aData['config_write_del_file'] as $i => $file) + { + if($aData['config_write_del_text'][$i] == '' || $file == '') + continue; - $top = (string) $aData['config_write_del_top'][$i] == 'on' ? 1 : 0; + $top = (string) $aData['config_write_del_top'][$i] == 'on' ? 1 : 0; - $text = htmlspecialchars(trim($aData['config_write_del_text'][$i])); + $text = htmlspecialchars(trim($aData['config_write_del_text'][$i])); - $sql->query('INSERT INTO `plugins_write_del` set `plugin`="'.$plugin['plugin'].'", `update`="'.$id.'", `text`="'.$text.'", `file`="'.$file.'", `top`="'.$top.'"'); - } + $sql->query('INSERT INTO `plugins_write_del` set `plugin`="'.$plugin['plugin'].'", `update`="'.$id.'", `text`="'.$text.'", `file`="'.$file.'", `top`="'.$top.'"'); + } - $sql->query('DELETE FROM `plugins_delete` WHERE `update`="'.$id.'"'); + $sql->query('DELETE FROM `plugins_delete` WHERE `update`="'.$id.'"'); - foreach($aData['files_delete_file'] as $file) - { - if($file == '') - continue; + foreach($aData['files_delete_file'] as $file) + { + if($file == '') + continue; - $sql->query('INSERT INTO `plugins_delete` set `plugin`="'.$plugin['plugin'].'", `update`="'.$id.'", `file`="'.$file.'"'); - } + $sql->query('INSERT INTO `plugins_delete` set `plugin`="'.$plugin['plugin'].'", `update`="'.$id.'", `file`="'.$file.'"'); + } - if($aData['delete']) - { - $sql->query('DELETE FROM `plugins_delete_ins` WHERE `update`="'.$id.'" LIMIT 1'); + if($aData['delete']) + { + $sql->query('DELETE FROM `plugins_delete_ins` WHERE `update`="'.$id.'" LIMIT 1'); - $sql->query('INSERT INTO `plugins_delete_ins` set `plugin`="'.$plugin['plugin'].'", `update`="'.$id.'", `file`="'.$aData['delete'].'"'); - } + $sql->query('INSERT INTO `plugins_delete_ins` set `plugin`="'.$plugin['plugin'].'", `update`="'.$id.'", `file`="'.$aData['delete'].'"'); + } - $sql->query('UPDATE `plugins_update` set ' - .'`name`="'.htmlspecialchars($aData['name']).'",' - .'`desc`="'.htmlspecialchars($aData['desc']).'",' - .'`info`="'.htmlspecialchars($aData['info']).'",' - .'`images`="'.htmlspecialchars($aData['images']).'",' - .'`incompatible`="'.$aData['incompatible'].'",' - .'`choice`="'.$aData['choice'].'",' - .'`required`="'.$aData['required'].'",' - .'`status`="'.$aData['status'].'",' - .'`cfg`="'.$aData['cfg'].'",' - .'`price`="'.$aData['price'].'",' - .'`packs`="'.$aData['packs'].'" WHERE `id`="'.$id.'"'); + $sql->query('UPDATE `plugins_update` set ' + .'`name`="'.htmlspecialchars($aData['name']).'",' + .'`desc`="'.htmlspecialchars($aData['desc']).'",' + .'`info`="'.htmlspecialchars($aData['info']).'",' + .'`images`="'.htmlspecialchars($aData['images']).'",' + .'`incompatible`="'.$aData['incompatible'].'",' + .'`choice`="'.$aData['choice'].'",' + .'`required`="'.$aData['required'].'",' + .'`status`="'.$aData['status'].'",' + .'`cfg`="'.$aData['cfg'].'",' + .'`price`="'.$aData['price'].'",' + .'`packs`="'.$aData['packs'].'" WHERE `id`="'.$id.'"'); - sys::outjs(array('s' => 'ok')); - } + sys::outjs(array('s' => 'ok')); + } - $html->get('update', 'sections/addons'); + $html->get('update', 'sections/addons'); - $html->set('id', $plugin['id']); - $html->set('plugin', $plugin['plugin']); - $html->set('name', $plugin['name']); - $html->set('game', $aGames[$plugin['game']]); - $html->set('desc', htmlspecialchars_decode($plugin['desc'])); - $html->set('info', htmlspecialchars_decode($plugin['info'])); - $html->set('images', htmlspecialchars_decode($plugin['images'])); - - $html->set('incompatible', $plugin['incompatible']); - $html->set('choice', $plugin['choice']); - $html->set('required', $plugin['required']); - $html->set('packs', $plugin['packs']); - $html->set('sort', $plugin['sort']); - $html->set('price', $plugin['price']); - - $status = ''; - - $html->set('status', str_replace('"'.$plugin['status'].'">', '"'.$plugin['status'].'" selected>', $status)); - - $sql->query('SELECT `name` FROM `plugins_category` WHERE `id`="'.$plugin['cat'].'" LIMIT 1'); - $cat = $sql->get(); - - $html->set('category', $cat['name']); - - $config_files_all = ''; - $config_clear_all = ''; - $config_write_all = ''; - $config_write_del_all = ''; - $files_delete_all = ''; - - $sql->query('SELECT `id`, `file`, `sort` FROM `plugins_config` WHERE `update`="'.$id.'" ORDER BY `sort` ASC'); - while($data = $sql->get()) - { - $config_files_all .= ''; - $config_files_all .= ''; - $config_files_all .= ''; - $config_files_all .= 'Удалить'; - $config_files_all .= ''; - } - - $sql->query('SELECT `id`, `text`, `file`, `regex` FROM `plugins_clear` WHERE `update`="'.$id.'" ORDER BY `id` ASC'); - while($data = $sql->get()) - { - $regex = $data['regex'] ? 'checked' : ''; - - $config_clear_all .= ''; - $config_clear_all .= ''; - $config_clear_all .= ''; - $config_clear_all .= ''; - $config_clear_all .= 'Удалить'; - $config_clear_all .= ''; - } - - $sql->query('SELECT `id`, `text`, `file`, `top` FROM `plugins_write` WHERE `update`="'.$id.'" ORDER BY `id` ASC'); - while($data = $sql->get()) - { - $top = $data['top'] ? 'checked' : ''; - - $config_write_all .= ''; - $config_write_all .= ''; - $config_write_all .= ''; - $config_write_all .= ''; - $config_write_all .= 'Удалить'; - $config_write_all .= ''; - } - - $sql->query('SELECT `id`, `text`, `file`, `top` FROM `plugins_write_del` WHERE `update`="'.$id.'" ORDER BY `id` ASC'); - while($data = $sql->get()) - { - $top = $data['top'] ? 'checked' : ''; - - $config_write_del_all .= ''; - $config_write_del_all .= ''; - $config_write_del_all .= ''; - $config_write_del_all .= ''; - $config_write_del_all .= 'Удалить'; - $config_write_del_all .= ''; - } - - $sql->query('SELECT `id`, `file` FROM `plugins_delete` WHERE `update`="'.$id.'" ORDER BY `id` ASC'); - while($data = $sql->get()) - { - $files_delete_all .= ''; - $files_delete_all .= ''; - $files_delete_all .= 'Удалить'; - $files_delete_all .= ''; - } - - $html->set('config_files_all', $config_files_all); - $html->set('config_clear_all', $config_clear_all); - $html->set('config_write_all', $config_write_all); - $html->set('config_write_del_all', $config_write_del_all); - $html->set('files_delete_all', $files_delete_all); - - $html->pack('main'); + $html->set('id', $plugin['id']); + $html->set('plugin', $plugin['plugin']); + $html->set('name', $plugin['name']); + $html->set('game', $aGames[$plugin['game']]); + $html->set('desc', htmlspecialchars_decode($plugin['desc'])); + $html->set('info', htmlspecialchars_decode($plugin['info'])); + $html->set('images', htmlspecialchars_decode($plugin['images'])); + + $html->set('incompatible', $plugin['incompatible']); + $html->set('choice', $plugin['choice']); + $html->set('required', $plugin['required']); + $html->set('packs', $plugin['packs']); + $html->set('sort', $plugin['sort']); + $html->set('price', $plugin['price']); + + $status = ''; + + $html->set('status', str_replace('"'.$plugin['status'].'">', '"'.$plugin['status'].'" selected>', $status)); + + $sql->query('SELECT `name` FROM `plugins_category` WHERE `id`="'.$plugin['cat'].'" LIMIT 1'); + $cat = $sql->get(); + + $html->set('category', $cat['name']); + + $config_files_all = ''; + $config_clear_all = ''; + $config_write_all = ''; + $config_write_del_all = ''; + $files_delete_all = ''; + + $sql->query('SELECT `id`, `file`, `sort` FROM `plugins_config` WHERE `update`="'.$id.'" ORDER BY `sort` ASC'); + while($data = $sql->get()) + { + $config_files_all .= ''; + $config_files_all .= ''; + $config_files_all .= ''; + $config_files_all .= 'Удалить'; + $config_files_all .= ''; + } + + $sql->query('SELECT `id`, `text`, `file`, `regex` FROM `plugins_clear` WHERE `update`="'.$id.'" ORDER BY `id` ASC'); + while($data = $sql->get()) + { + $regex = $data['regex'] ? 'checked' : ''; + + $config_clear_all .= ''; + $config_clear_all .= ''; + $config_clear_all .= ''; + $config_clear_all .= ''; + $config_clear_all .= 'Удалить'; + $config_clear_all .= ''; + } + + $sql->query('SELECT `id`, `text`, `file`, `top` FROM `plugins_write` WHERE `update`="'.$id.'" ORDER BY `id` ASC'); + while($data = $sql->get()) + { + $top = $data['top'] ? 'checked' : ''; + + $config_write_all .= ''; + $config_write_all .= ''; + $config_write_all .= ''; + $config_write_all .= ''; + $config_write_all .= 'Удалить'; + $config_write_all .= ''; + } + + $sql->query('SELECT `id`, `text`, `file`, `top` FROM `plugins_write_del` WHERE `update`="'.$id.'" ORDER BY `id` ASC'); + while($data = $sql->get()) + { + $top = $data['top'] ? 'checked' : ''; + + $config_write_del_all .= ''; + $config_write_del_all .= ''; + $config_write_del_all .= ''; + $config_write_del_all .= ''; + $config_write_del_all .= 'Удалить'; + $config_write_del_all .= ''; + } + + $sql->query('SELECT `id`, `file` FROM `plugins_delete` WHERE `update`="'.$id.'" ORDER BY `id` ASC'); + while($data = $sql->get()) + { + $files_delete_all .= ''; + $files_delete_all .= ''; + $files_delete_all .= 'Удалить'; + $files_delete_all .= ''; + } + + $html->set('config_files_all', $config_files_all); + $html->set('config_clear_all', $config_clear_all); + $html->set('config_write_all', $config_write_all); + $html->set('config_write_del_all', $config_write_del_all); + $html->set('files_delete_all', $files_delete_all); + + $html->pack('main'); ?> \ No newline at end of file diff --git a/system/acp/sections/addons/updmp.php b/system/acp/sections/addons/updmp.php index ea7cd11..b701e20 100644 --- a/system/acp/sections/addons/updmp.php +++ b/system/acp/sections/addons/updmp.php @@ -1,78 +1,78 @@ query('SELECT `name` FROM `maps` WHERE `unit`="'.$unit.'" AND `game`="'.$game.'" ORDER BY `id` ASC'); - - $all = 'Общее число карт: '.$sql->num().' шт.'.PHP_EOL; - - while($map = $sql->get()) - $maps .= $map['name'].PHP_EOL; + $sql->query('SELECT `name` FROM `maps` WHERE `unit`="'.$unit.'" AND `game`="'.$game.'" ORDER BY `id` ASC'); + + $all = 'Общее число карт: '.$sql->num().' шт.'.PHP_EOL; + + while($map = $sql->get()) + $maps .= $map['name'].PHP_EOL; - $maps = $maps == '' ? 'В базе нет карт' : $all.$maps.$all; + $maps = $maps == '' ? 'В базе нет карт' : $all.$maps.$all; - sys::out($maps); - } + sys::out($maps); + } - if($go) - { - $unit = isset($url['unit']) ? sys::int($url['unit']) : sys::outjs(array('e' => 'Необходимо выбрать локацию')); - $game = isset($url['game']) ? $url['game'] : sys::outjs(array('e' => 'Необходимо выбрать игру')); + if($go) + { + $unit = isset($url['unit']) ? sys::int($url['unit']) : sys::outjs(array('e' => 'Необходимо выбрать локацию')); + $game = isset($url['game']) ? $url['game'] : sys::outjs(array('e' => 'Необходимо выбрать игру')); - if(!$unit) - sys::outjs(array('e' => 'Необходимо выбрать локацию')); + if(!$unit) + sys::outjs(array('e' => 'Необходимо выбрать локацию')); - if(!in_array($game, array('cs', 'cssold', 'css', 'csgo'))) - sys::outjs(array('e' => 'Необходимо выбрать игру')); + if(!in_array($game, array('cs', 'cssold', 'css', 'csgo'))) + sys::outjs(array('e' => 'Необходимо выбрать игру')); - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - $sql->query('SELECT `id`, `passwd`, `address` FROM `units` WHERE `id`="'.$unit.'" LIMIT 1'); - if(!$sql->num()) - sys::outjs(array('e' => 'Локация не найдена')); + $sql->query('SELECT `id`, `passwd`, `address` FROM `units` WHERE `id`="'.$unit.'" LIMIT 1'); + if(!$sql->num()) + sys::outjs(array('e' => 'Локация не найдена')); - $unit = $sql->get(); + $unit = $sql->get(); - if(!$ssh->auth($unit['passwd'], $unit['address'])) - sys::outjs(array('e' => 'Не удалось создать связь с локацией')); + if(!$ssh->auth($unit['passwd'], $unit['address'])) + sys::outjs(array('e' => 'Не удалось создать связь с локацией')); - $sql->query('DELETE FROM `maps` WHERE `unit`="'.$unit['id'].'" AND `game`="'.$game.'"'); + $sql->query('DELETE FROM `maps` WHERE `unit`="'.$unit['id'].'" AND `game`="'.$game.'"'); - $maps = $ssh->get('cd /path/maps/'.$game.' && ls | grep .bsp | grep -v .bsp.'); + $maps = $ssh->get('cd /path/maps/'.$game.' && ls | grep .bsp | grep -v .bsp.'); - $aMaps = explode("\n", $maps); + $aMaps = explode("\n", $maps); - array_pop($aMaps); + array_pop($aMaps); - foreach($aMaps as $map) - { - $name = array_shift(explode('.', $map)); + foreach($aMaps as $map) + { + $name = array_shift(explode('.', $map)); - $sql->query('INSERT INTO `maps` set `unit`="'.$unit['id'].'", `game`="'.$game.'", `name`="'.$name.'"'); - } + $sql->query('INSERT INTO `maps` set `unit`="'.$unit['id'].'", `game`="'.$game.'", `name`="'.$name.'"'); + } - sys::outjs(array('s' => 'ok')); - } + sys::outjs(array('s' => 'ok')); + } - $units = ''; + $units = ''; - $sql->query('SELECT `id`, `name` FROM `units` ORDER BY `id` ASC'); - while($unit = $sql->get()) - $units .= ''; + $sql->query('SELECT `id`, `name` FROM `units` ORDER BY `id` ASC'); + while($unit = $sql->get()) + $units .= ''; - $html->get('updmp', 'sections/addons'); + $html->get('updmp', 'sections/addons'); - $html->set('units', $units); + $html->set('units', $units); - $html->pack('main'); + $html->pack('main'); ?> \ No newline at end of file diff --git a/system/acp/sections/boost/index.php b/system/acp/sections/boost/index.php index 395f162..3ec36c2 100644 --- a/system/acp/sections/boost/index.php +++ b/system/acp/sections/boost/index.php @@ -1,81 +1,81 @@ query('SELECT `id` FROM `boost`'); + $sql->query('SELECT `id` FROM `boost`'); - $aPage = sys::page($page, $sql->num(), 40); + $aPage = sys::page($page, $sql->num(), 40); - sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/boost'); + sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/boost'); - $sql->query('SELECT * FROM `boost` ORDER BY `id` DESC LIMIT '.$aPage['num'].', 40'); - while($log = $sql->get()) - { - $list .= ''; - $list .= ''.$log['id'].''; - $list .= 'Покупка кругов: '.$log['circles'].' шт. на сайте: '.$aBoost['cs'][$log['site']]['site'].', списана сумма: '.$log['money'].' '.$cfg['currency'].''; - $list .= 'USER_'.$log['user'].''; - $list .= 'SERVER_'.$log['server'].''; - $list .= ''.date('d.m.Y - H:i:s', $log['date']).''; - $list .= ''; - } + $sql->query('SELECT * FROM `boost` ORDER BY `id` DESC LIMIT '.$aPage['num'].', 40'); + while($log = $sql->get()) + { + $list .= ''; + $list .= ''.$log['id'].''; + $list .= 'Покупка кругов: '.$log['circles'].' шт. на сайте: '.$aBoost['cs'][$log['site']]['site'].', списана сумма: '.$log['money'].' '.$cfg['currency'].''; + $list .= 'USER_'.$log['user'].''; + $list .= 'SERVER_'.$log['server'].''; + $list .= ''.date('d.m.Y - H:i:s', $log['date']).''; + $list .= ''; + } - $month = date('n', $start_point)-1; + $month = date('n', $start_point)-1; - if(!$month) - $month = 12; + if(!$month) + $month = 12; - $aData = $mcache->get('data_boost_all'); + $aData = $mcache->get('data_boost_all'); - if(!is_array($aData)) - { - $sql->query('SELECT SUM(`circles`), SUM(`money`) FROM `boost`'); - $data = $sql->get(); + if(!is_array($aData)) + { + $sql->query('SELECT SUM(`circles`), SUM(`money`) FROM `boost`'); + $data = $sql->get(); - $aData['all_num'] = (int) $data['SUM(`circles`)']; - $aData['all_sum'] = (int) $data['SUM(`money`)']; + $aData['all_num'] = (int) $data['SUM(`circles`)']; + $aData['all_sum'] = (int) $data['SUM(`money`)']; - $now = $start_point-(date('d', $start_point)*86400); + $now = $start_point-(date('d', $start_point)*86400); - $old = $start_point-(params::$aDayMonth[$month]*86400); + $old = $start_point-(params::$aDayMonth[$month]*86400); - $sql->query('SELECT SUM(`circles`), SUM(`money`) FROM `boost` WHERE `date`>="'.$old.'" AND date<"'.$now.'"'); - $data = $sql->get(); + $sql->query('SELECT SUM(`circles`), SUM(`money`) FROM `boost` WHERE `date`>="'.$old.'" AND date<"'.$now.'"'); + $data = $sql->get(); - $aData['old_num'] = (int) $data['SUM(`circles`)']; - $aData['old_sum'] = (int) $data['SUM(`money`)']; + $aData['old_num'] = (int) $data['SUM(`circles`)']; + $aData['old_sum'] = (int) $data['SUM(`money`)']; - $sql->query('SELECT SUM(`circles`), SUM(`money`) FROM `boost` WHERE `date`>="'.$now.'"'); - $data = $sql->get(); + $sql->query('SELECT SUM(`circles`), SUM(`money`) FROM `boost` WHERE `date`>="'.$now.'"'); + $data = $sql->get(); - $aData['now_num'] = (int) $data['SUM(`circles`)']; - $aData['now_sum'] = (int) $data['SUM(`money`)']; + $aData['now_num'] = (int) $data['SUM(`circles`)']; + $aData['now_sum'] = (int) $data['SUM(`money`)']; - $mcache->set('data_boost_all', $aData, false, 60); - } + $mcache->set('data_boost_all', $aData, false, 60); + } - $html->get('index', 'sections/boost'); + $html->get('index', 'sections/boost'); - $html->set('list', $list); + $html->set('list', $list); - $html->set('month_old', params::$aNameMonth[$month]); - $html->set('month_now', params::$aNameMonth[date('n', $start_point)]); + $html->set('month_old', params::$aNameMonth[$month]); + $html->set('month_now', params::$aNameMonth[date('n', $start_point)]); - $html->set('all_num', $aData['all_num']); - $html->set('all_sum', $aData['all_sum']); - $html->set('old_num', $aData['old_num']); - $html->set('old_sum', $aData['old_sum']); - $html->set('now_num', $aData['now_num']); - $html->set('now_sum', $aData['now_sum']); + $html->set('all_num', $aData['all_num']); + $html->set('all_sum', $aData['all_sum']); + $html->set('old_num', $aData['old_num']); + $html->set('old_sum', $aData['old_sum']); + $html->set('now_num', $aData['now_num']); + $html->set('now_sum', $aData['now_sum']); - $html->set('cur', $cfg['currency']); + $html->set('cur', $cfg['currency']); - $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); + $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); - $html->pack('main'); + $html->pack('main'); ?> \ No newline at end of file diff --git a/system/acp/sections/boost/search.php b/system/acp/sections/boost/search.php index 8498976..fbff74d 100644 --- a/system/acp/sections/boost/search.php +++ b/system/acp/sections/boost/search.php @@ -1,77 +1,77 @@ get($mkey); + $cache = $mcache->get($mkey); - if(is_array($cache)) - { - if($go) - sys::outjs($cache, $nmch); + if(is_array($cache)) + { + if($go) + sys::outjs($cache, $nmch); - sys::outjs($cache); - } + sys::outjs($cache); + } - if(!isset($text{2})) - { - if($go) - sys::outjs(array('e' => 'Для выполнения поиска, необходимо больше данных'), $nmch); + if(!isset($text{2})) + { + if($go) + sys::outjs(array('e' => 'Для выполнения поиска, необходимо больше данных'), $nmch); - sys::outjs(array('e' => '')); - } + sys::outjs(array('e' => '')); + } - $check = explode('=', $text); + $check = explode('=', $text); - if(in_array($check[0], array('server', 'user'))) - { - $val = trim($check[1]); + if(in_array($check[0], array('server', 'user'))) + { + $val = trim($check[1]); - switch($check[0]) - { - case 'server': - $sql->query('SELECT * FROM `boost` WHERE `server`="'.sys::int($val).'" ORDER BY `id` DESC'); - break; + switch($check[0]) + { + case 'server': + $sql->query('SELECT * FROM `boost` WHERE `server`="'.sys::int($val).'" ORDER BY `id` DESC'); + break; - case 'user': - $sql->query('SELECT * FROM `boost` WHERE `user`="'.sys::int($val).'" ORDER BY `id` DESC'); - } - }elseif($text{0} == 'i' AND $text{1} == 'd') - $sql->query('SELECT * FROM `boost` WHERE `id`="'.sys::int($text).'" LIMIT 1'); - else{ - $like = '`id` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' - .'`site` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' - .'`circles` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' - .'`money` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\')'; + case 'user': + $sql->query('SELECT * FROM `boost` WHERE `user`="'.sys::int($val).'" ORDER BY `id` DESC'); + } + }elseif($text{0} == 'i' AND $text{1} == 'd') + $sql->query('SELECT * FROM `boost` WHERE `id`="'.sys::int($text).'" LIMIT 1'); + else{ + $like = '`id` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' + .'`site` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' + .'`circles` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' + .'`money` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\')'; - $sql->query('SELECT * FROM `boost` WHERE '.$like.' ORDER BY `id` DESC LIMIT 40'); - } + $sql->query('SELECT * FROM `boost` WHERE '.$like.' ORDER BY `id` DESC LIMIT 40'); + } - if(!$sql->num()) - { - if($go) - sys::outjs(array('e' => 'По вашему запросу ничего не найдено'), $nmch); + if(!$sql->num()) + { + if($go) + sys::outjs(array('e' => 'По вашему запросу ничего не найдено'), $nmch); - sys::outjs(array('e' => 'По вашему запросу ничего не найдено')); - } + sys::outjs(array('e' => 'По вашему запросу ничего не найдено')); + } - $list = ''; + $list = ''; - while($log = $sql->get()) - { - $list .= ''; - $list .= ''.$log['id'].''; - $list .= 'Покупка кругов: '.$log['circles'].' шт. на сайте: '.$aBoost['cs'][$log['site']]['site'].', списана сумма: '.$log['money'].' '.$cfg['currency'].''; - $list .= 'USER_'.$log['user'].''; - $list .= 'SERVER_'.$log['server'].''; - $list .= ''.date('d.m.Y - H:i:s', $log['date']).''; - $list .= ''; - } + while($log = $sql->get()) + { + $list .= ''; + $list .= ''.$log['id'].''; + $list .= 'Покупка кругов: '.$log['circles'].' шт. на сайте: '.$aBoost['cs'][$log['site']]['site'].', списана сумма: '.$log['money'].' '.$cfg['currency'].''; + $list .= 'USER_'.$log['user'].''; + $list .= 'SERVER_'.$log['server'].''; + $list .= ''.date('d.m.Y - H:i:s', $log['date']).''; + $list .= ''; + } - $mcache->set($mkey, array('s' => $list), false, 15); + $mcache->set($mkey, array('s' => $list), false, 15); - sys::outjs(array('s' => $list)); + sys::outjs(array('s' => $list)); ?> \ No newline at end of file diff --git a/system/acp/sections/boost/service.php b/system/acp/sections/boost/service.php index d76e43e..31586c7 100644 --- a/system/acp/sections/boost/service.php +++ b/system/acp/sections/boost/service.php @@ -1,81 +1,81 @@ query('SELECT `id` FROM `boost` WHERE `site`="'.$section.'"'); + $sql->query('SELECT `id` FROM `boost` WHERE `site`="'.$section.'"'); - $aPage = sys::page($page, $sql->num(), 40); + $aPage = sys::page($page, $sql->num(), 40); - sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/boost/section/'.$section); + sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/boost/section/'.$section); - $sql->query('SELECT * FROM `boost` WHERE `site`="'.$section.'" ORDER BY `id` DESC LIMIT '.$aPage['num'].', 40'); - while($log = $sql->get()) - { - $list .= ''; - $list .= ''.$log['id'].''; - $list .= 'Покупка кругов: '.$log['circles'].' шт. на сайте: '.$aBoost['cs'][$log['site']]['site'].', списана сумма: '.$log['money'].' '.$cfg['currency'].''; - $list .= 'USER_'.$log['user'].''; - $list .= 'SERVER_'.$log['server'].''; - $list .= ''.date('d.m.Y - H:i:s', $log['date']).''; - $list .= ''; - } + $sql->query('SELECT * FROM `boost` WHERE `site`="'.$section.'" ORDER BY `id` DESC LIMIT '.$aPage['num'].', 40'); + while($log = $sql->get()) + { + $list .= ''; + $list .= ''.$log['id'].''; + $list .= 'Покупка кругов: '.$log['circles'].' шт. на сайте: '.$aBoost['cs'][$log['site']]['site'].', списана сумма: '.$log['money'].' '.$cfg['currency'].''; + $list .= 'USER_'.$log['user'].''; + $list .= 'SERVER_'.$log['server'].''; + $list .= ''.date('d.m.Y - H:i:s', $log['date']).''; + $list .= ''; + } - $month = date('n', $start_point)-1; + $month = date('n', $start_point)-1; - if(!$month) - $month = 12; + if(!$month) + $month = 12; - $aData = $mcache->get('data_boost_'.$section); + $aData = $mcache->get('data_boost_'.$section); - if(!is_array($aData)) - { - $sql->query('SELECT SUM(`circles`), SUM(`money`) FROM `boost` WHERE `site`="'.$section.'"'); - $data = $sql->get(); + if(!is_array($aData)) + { + $sql->query('SELECT SUM(`circles`), SUM(`money`) FROM `boost` WHERE `site`="'.$section.'"'); + $data = $sql->get(); - $aData['all_num'] = (int) $data['SUM(`circles`)']; - $aData['all_sum'] = (int) $data['SUM(`money`)']; + $aData['all_num'] = (int) $data['SUM(`circles`)']; + $aData['all_sum'] = (int) $data['SUM(`money`)']; - $now = $start_point-(date('d', $start_point)*86400); + $now = $start_point-(date('d', $start_point)*86400); - $old = $start_point-(params::$aDayMonth[$month]*86400); + $old = $start_point-(params::$aDayMonth[$month]*86400); - $sql->query('SELECT SUM(`circles`), SUM(`money`) FROM `boost` WHERE `site`="'.$section.'" AND `date`>="'.$old.'" AND date<"'.$now.'"'); - $data = $sql->get(); + $sql->query('SELECT SUM(`circles`), SUM(`money`) FROM `boost` WHERE `site`="'.$section.'" AND `date`>="'.$old.'" AND date<"'.$now.'"'); + $data = $sql->get(); - $aData['old_num'] = (int) $data['SUM(`circles`)']; - $aData['old_sum'] = (int) $data['SUM(`money`)']; + $aData['old_num'] = (int) $data['SUM(`circles`)']; + $aData['old_sum'] = (int) $data['SUM(`money`)']; - $sql->query('SELECT SUM(`circles`), SUM(`money`) FROM `boost` WHERE `site`="'.$section.'" AND `date`>="'.$now.'"'); - $data = $sql->get(); + $sql->query('SELECT SUM(`circles`), SUM(`money`) FROM `boost` WHERE `site`="'.$section.'" AND `date`>="'.$now.'"'); + $data = $sql->get(); - $aData['now_num'] = (int) $data['SUM(`circles`)']; - $aData['now_sum'] = (int) $data['SUM(`money`)']; + $aData['now_num'] = (int) $data['SUM(`circles`)']; + $aData['now_sum'] = (int) $data['SUM(`money`)']; - $mcache->set('data_boost_'.$section, $aData, false, 60); - } + $mcache->set('data_boost_'.$section, $aData, false, 60); + } - $html->get('index', 'sections/boost'); + $html->get('index', 'sections/boost'); - $html->set('list', $list); + $html->set('list', $list); - $html->set('month_old', params::$aNameMonth[$month]); - $html->set('month_now', params::$aNameMonth[date('n', $start_point)]); + $html->set('month_old', params::$aNameMonth[$month]); + $html->set('month_now', params::$aNameMonth[date('n', $start_point)]); - $html->set('all_num', $aData['all_num']); - $html->set('all_sum', $aData['all_sum']); - $html->set('old_num', $aData['old_num']); - $html->set('old_sum', $aData['old_sum']); - $html->set('now_num', $aData['now_num']); - $html->set('now_sum', $aData['now_sum']); + $html->set('all_num', $aData['all_num']); + $html->set('all_sum', $aData['all_sum']); + $html->set('old_num', $aData['old_num']); + $html->set('old_sum', $aData['old_sum']); + $html->set('now_num', $aData['now_num']); + $html->set('now_sum', $aData['now_sum']); - $html->set('cur', $cfg['currency']); + $html->set('cur', $cfg['currency']); - $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); + $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); - $html->pack('main'); + $html->pack('main'); ?> \ No newline at end of file diff --git a/system/acp/sections/control/delete.php b/system/acp/sections/control/delete.php index 799b9fd..062d362 100644 --- a/system/acp/sections/control/delete.php +++ b/system/acp/sections/control/delete.php @@ -1,8 +1,8 @@ query('UPDATE `control` set `user`="-1", `status`="overdue", `time`="0", `overdue`="0" WHERE `id`="'.$id.'" LIMIT 1'); + $sql->query('UPDATE `control` set `user`="-1", `status`="overdue", `time`="0", `overdue`="0" WHERE `id`="'.$id.'" LIMIT 1'); - sys::outjs(array('s' => 'ok')); + sys::outjs(array('s' => 'ok')); ?> \ No newline at end of file diff --git a/system/acp/sections/control/index.php b/system/acp/sections/control/index.php index 6f34916..81b28cb 100644 --- a/system/acp/sections/control/index.php +++ b/system/acp/sections/control/index.php @@ -1,54 +1,54 @@ 'Работает', - 'reboot' => 'перезагружается', - 'error' => 'Не отвечает', - 'install' => 'Настраивается', - 'overdue' => 'Просрочен', - 'blocked' => 'Заблокирован' - ); + $status = array( + 'working' => 'Работает', + 'reboot' => 'перезагружается', + 'error' => 'Не отвечает', + 'install' => 'Настраивается', + 'overdue' => 'Просрочен', + 'blocked' => 'Заблокирован' + ); - $sql->query('SELECT `id` FROM `control` WHERE `user`!="-1"'); + $sql->query('SELECT `id` FROM `control` WHERE `user`!="-1"'); - $aPage = sys::page($page, $sql->num(), 20); + $aPage = sys::page($page, $sql->num(), 20); - sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/control'); + sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/control'); - $sql->query('SELECT `id`, `user`, `address`, `time`, `date`, `status`, `limit`, `price` FROM `control` WHERE `user`!="-1" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); - while($ctrl = $sql->get()) - { - $list .= ''; - $list .= ''.$ctrl['id'].''; - $list .= ''.$ctrl['address'].''; - $list .= ''.date('d.m.Y - H:i:s', $ctrl['date']).''; - $list .= ''.$ctrl['limit'].' шт.'; - $list .= 'Перейти'; - $list .= ''; + $sql->query('SELECT `id`, `user`, `address`, `time`, `date`, `status`, `limit`, `price` FROM `control` WHERE `user`!="-1" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); + while($ctrl = $sql->get()) + { + $list .= ''; + $list .= ''.$ctrl['id'].''; + $list .= ''.$ctrl['address'].''; + $list .= ''.date('d.m.Y - H:i:s', $ctrl['date']).''; + $list .= ''.$ctrl['limit'].' шт.'; + $list .= 'Перейти'; + $list .= ''; - $list .= ''; - $list .= 'USER_'.$ctrl['user'].''; - $list .= ''.$status[$ctrl['status']].''; - $list .= ''.date('d.m.Y - H:i:s', $ctrl['time']).''; - $list .= ''.$ctrl['price'].' '.$cfg['currency'].''; - $list .= 'Удалить'; - $list .= ''; - } + $list .= ''; + $list .= 'USER_'.$ctrl['user'].''; + $list .= ''.$status[$ctrl['status']].''; + $list .= ''.date('d.m.Y - H:i:s', $ctrl['time']).''; + $list .= ''.$ctrl['price'].' '.$cfg['currency'].''; + $list .= 'Удалить'; + $list .= ''; + } - $html->get('index', 'sections/control'); - $html->set('list', $list); - $html->set('url_search', $url_search); - $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); - $html->pack('main'); - } + $html->get('index', 'sections/control'); + $html->set('list', $list); + $html->set('url_search', $url_search); + $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); + $html->pack('main'); + } ?> \ No newline at end of file diff --git a/system/acp/sections/control/overdue.php b/system/acp/sections/control/overdue.php index 13ce562..e931858 100644 --- a/system/acp/sections/control/overdue.php +++ b/system/acp/sections/control/overdue.php @@ -1,35 +1,35 @@ query('SELECT `id`, `user`, `address`, `overdue`, `date`, `status`, `limit`, `price` FROM `control` WHERE `user`!="-1" AND `time`<"'.$start_point.'" AND `overdue`>"'.$start_point.'" ORDER BY `id` ASC'); - while($ctrl = $sql->get()) - { - $list .= ''; - $list .= ''.$ctrl['id'].''; - $list .= ''.$ctrl['address'].''; - $list .= ''.date('d.m.Y - H:i:s', $ctrl['date']).''; - $list .= ''.$ctrl['limit'].' шт.'; - $list .= 'Перейти'; - $list .= ''; + $servers = $sql->query('SELECT `id`, `user`, `address`, `overdue`, `date`, `status`, `limit`, `price` FROM `control` WHERE `user`!="-1" AND `time`<"'.$start_point.'" AND `overdue`>"'.$start_point.'" ORDER BY `id` ASC'); + while($ctrl = $sql->get()) + { + $list .= ''; + $list .= ''.$ctrl['id'].''; + $list .= ''.$ctrl['address'].''; + $list .= ''.date('d.m.Y - H:i:s', $ctrl['date']).''; + $list .= ''.$ctrl['limit'].' шт.'; + $list .= 'Перейти'; + $list .= ''; - $list .= ''; - $list .= 'USER_'.$ctrl['user'].''; - $list .= ''.$status[$ctrl['status']].''; - $list .= 'Удаление через: '.sys::date('min', $ctrl['overdue']+$cfg['control_delete']*86400).''; - $list .= ''.$ctrl['price'].' '.$cfg['currency'].''; - $list .= 'Удалить'; - $list .= ''; - } + $list .= ''; + $list .= 'USER_'.$ctrl['user'].''; + $list .= ''.$status[$ctrl['status']].''; + $list .= 'Удаление через: '.sys::date('min', $ctrl['overdue']+$cfg['control_delete']*86400).''; + $list .= ''.$ctrl['price'].' '.$cfg['currency'].''; + $list .= 'Удалить'; + $list .= ''; + } - $html->get('index', 'sections/control'); - $html->set('list', $list); - $html->set('pages', ''); - $html->pack('main'); - } + $html->get('index', 'sections/control'); + $html->set('list', $list); + $html->set('pages', ''); + $html->pack('main'); + } ?> \ No newline at end of file diff --git a/system/acp/sections/control/search.php b/system/acp/sections/control/search.php index 48907c9..dfd9647 100644 --- a/system/acp/sections/control/search.php +++ b/system/acp/sections/control/search.php @@ -1,103 +1,103 @@ get($mkey); + $cache = $mcache->get($mkey); - if(is_array($cache)) - { - if($go) - sys::outjs($cache, $nmch); + if(is_array($cache)) + { + if($go) + sys::outjs($cache, $nmch); - sys::outjs($cache); - } + sys::outjs($cache); + } - if(!isset($text{2})) - { - if($go) - sys::outjs(array('e' => 'Для выполнения поиска, необходимо больше данных'), $nmch); + if(!isset($text{2})) + { + if($go) + sys::outjs(array('e' => 'Для выполнения поиска, необходимо больше данных'), $nmch); - sys::outjs(array('e' => '')); - } + sys::outjs(array('e' => '')); + } - $select = '`id`, `user`, `address`, `time`, `date`, `status`, `limit`, `price` FROM `control` WHERE `user`!="-1" AND'; + $select = '`id`, `user`, `address`, `time`, `date`, `status`, `limit`, `price` FROM `control` WHERE `user`!="-1" AND'; - $check = explode('=', $text); + $check = explode('=', $text); - if(in_array($check[0], array('limit', 'price', 'user', 'status'))) - { - $val = trim($check[1]); + if(in_array($check[0], array('limit', 'price', 'user', 'status'))) + { + $val = trim($check[1]); - switch($check[0]) - { - case 'limit': - $ctrls = $sql->query('SELECT '.$select.' `limit`="'.sys::int($val).'" ORDER BY `id` ASC'); - break; + switch($check[0]) + { + case 'limit': + $ctrls = $sql->query('SELECT '.$select.' `limit`="'.sys::int($val).'" ORDER BY `id` ASC'); + break; - case 'price': - $ctrls = $sql->query('SELECT '.$select.' `price`="'.sys::int($val).'" ORDER BY `id` ASC'); - break; + case 'price': + $ctrls = $sql->query('SELECT '.$select.' `price`="'.sys::int($val).'" ORDER BY `id` ASC'); + break; - case 'ctrls': - $ctrl = $sql->query('SELECT '.$select.' `user`="'.sys::int($val).'" ORDER BY `id` ASC'); - break; + case 'ctrls': + $ctrl = $sql->query('SELECT '.$select.' `user`="'.sys::int($val).'" ORDER BY `id` ASC'); + break; - case 'status': - if(in_array($val, array('working', 'error', 'reboot', 'overdue', 'blocked', 'install'))) - $ctrls = $sql->query('SELECT '.$select.' `status`="'.$val.'" ORDER BY `id` ASC'); - } - }elseif($text{0} == 'i' AND $text{1} == 'd') - $ctrls = $sql->query('SELECT '.$select.' `id`="'.sys::int($text).'" LIMIT 1'); - else{ - $like = '`id` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' - .'`address` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\')'; + case 'status': + if(in_array($val, array('working', 'error', 'reboot', 'overdue', 'blocked', 'install'))) + $ctrls = $sql->query('SELECT '.$select.' `status`="'.$val.'" ORDER BY `id` ASC'); + } + }elseif($text{0} == 'i' AND $text{1} == 'd') + $ctrls = $sql->query('SELECT '.$select.' `id`="'.sys::int($text).'" LIMIT 1'); + else{ + $like = '`id` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' + .'`address` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\')'; - $ctrls = $sql->query('SELECT '.$select.' ('.$like.') ORDER BY `id` ASC'); - } + $ctrls = $sql->query('SELECT '.$select.' ('.$like.') ORDER BY `id` ASC'); + } - if(!$sql->num($ctrls)) - { - if($go) - sys::outjs(array('e' => 'По вашему запросу ничего не найдено'), $nmch); + if(!$sql->num($ctrls)) + { + if($go) + sys::outjs(array('e' => 'По вашему запросу ничего не найдено'), $nmch); - sys::outjs(array('e' => 'По вашему запросу ничего не найдено')); - } + sys::outjs(array('e' => 'По вашему запросу ничего не найдено')); + } - $status = array( - 'working' => 'Работает', - 'reboot' => 'перезагружается', - 'error' => 'Не отвечает', - 'install' => 'Настраивается', - 'overdue' => 'Просрочен', - 'blocked' => 'Заблокирован' - ); + $status = array( + 'working' => 'Работает', + 'reboot' => 'перезагружается', + 'error' => 'Не отвечает', + 'install' => 'Настраивается', + 'overdue' => 'Просрочен', + 'blocked' => 'Заблокирован' + ); - $list = ''; + $list = ''; - while($ctrl = $sql->get($ctrls)) - { - $list .= ''; - $list .= ''.$ctrl['id'].''; - $list .= ''.$ctrl['address'].''; - $list .= ''.date('d.m.Y - H:i:s', $ctrl['date']).''; - $list .= ''.$ctrl['limit'].' шт.'; - $list .= 'Перейти'; - $list .= ''; + while($ctrl = $sql->get($ctrls)) + { + $list .= ''; + $list .= ''.$ctrl['id'].''; + $list .= ''.$ctrl['address'].''; + $list .= ''.date('d.m.Y - H:i:s', $ctrl['date']).''; + $list .= ''.$ctrl['limit'].' шт.'; + $list .= 'Перейти'; + $list .= ''; - $list .= ''; - $list .= 'USER_'.$ctrl['user'].''; - $list .= ''.$status[$ctrl['status']].''; - $list .= ''.date('d.m.Y - H:i:s', $ctrl['time']).''; - $list .= ''.$ctrl['price'].' '.$cfg['currency'].''; - $list .= 'Удалить'; - $list .= ''; - } + $list .= ''; + $list .= 'USER_'.$ctrl['user'].''; + $list .= ''.$status[$ctrl['status']].''; + $list .= ''.date('d.m.Y - H:i:s', $ctrl['time']).''; + $list .= ''.$ctrl['price'].' '.$cfg['currency'].''; + $list .= 'Удалить'; + $list .= ''; + } - $mcache->set($mkey, array('s' => $list), false, 15); + $mcache->set($mkey, array('s' => $list), false, 15); - sys::outjs(array('s' => $list)); + sys::outjs(array('s' => $list)); ?> \ No newline at end of file diff --git a/system/acp/sections/control/server.php b/system/acp/sections/control/server.php index 2cc4d2c..e7ed4bf 100644 --- a/system/acp/sections/control/server.php +++ b/system/acp/sections/control/server.php @@ -1,109 +1,109 @@ query('SELECT `time`, `overdue` FROM `control` WHERE `id`="'.$id.'" LIMIT 1'); - $ctrl = $sql->get(); + $sql->query('SELECT `time`, `overdue` FROM `control` WHERE `id`="'.$id.'" LIMIT 1'); + $ctrl = $sql->get(); - if($ctrl['time'] > $start_point AND $ctrl['overdue']) - $sql->query('UPDATE `control` set `overdue`="0" WHERE `id`="'.$id.'" LIMIT 1'); + if($ctrl['time'] > $start_point AND $ctrl['overdue']) + $sql->query('UPDATE `control` set `overdue`="0" WHERE `id`="'.$id.'" LIMIT 1'); - $sql->query('SELECT * FROM `control` WHERE `id`="'.$id.'" LIMIT 1'); - $ctrl = $sql->get(); + $sql->query('SELECT * FROM `control` WHERE `id`="'.$id.'" LIMIT 1'); + $ctrl = $sql->get(); - if($go) - { - if(isset($url['type']) AND in_array($url['type'], array('overdue', 'block', 'tarif'))) - { - if($url['type'] != 'tarif') - { - $time = isset($_POST['time']) ? trim($_POST['time']) : sys::outjs(array('e' => 'Необходимо указать дату.')); + if($go) + { + if(isset($url['type']) AND in_array($url['type'], array('overdue', 'block', 'tarif'))) + { + if($url['type'] != 'tarif') + { + $time = isset($_POST['time']) ? trim($_POST['time']) : sys::outjs(array('e' => 'Необходимо указать дату.')); - $date = sys::checkdate($time); - } + $date = sys::checkdate($time); + } - switch($url['type']) - { - case 'overdue': - if($ctrl['time'] > $start_point) - sys::outjs(array('e' => 'Игровой сервер должен быть просрочен.')); + switch($url['type']) + { + case 'overdue': + if($ctrl['time'] > $start_point) + sys::outjs(array('e' => 'Игровой сервер должен быть просрочен.')); - $sql->query('UPDATE `control` set `overdue`="'.$date.'" WHERE `id`="'.$id.'" LIMIT 1'); - break; + $sql->query('UPDATE `control` set `overdue`="'.$date.'" WHERE `id`="'.$id.'" LIMIT 1'); + break; - case 'block': - if($ctrl['status'] != ('off' || 'overdue')) - sys::outjs(array('e' => 'Игровой сервер должен быть выключен.')); + case 'block': + if($ctrl['status'] != ('off' || 'overdue')) + sys::outjs(array('e' => 'Игровой сервер должен быть выключен.')); - if($date < $start_point) - $sql->query('UPDATE `control` set `status`="off", `block`="0" WHERE `id`="'.$id.'" LIMIT 1'); - else - $sql->query('UPDATE `control` set `status`="blocked", `block`="'.$date.'" WHERE `id`="'.$id.'" LIMIT 1'); - } + if($date < $start_point) + $sql->query('UPDATE `control` set `status`="off", `block`="0" WHERE `id`="'.$id.'" LIMIT 1'); + else + $sql->query('UPDATE `control` set `status`="blocked", `block`="'.$date.'" WHERE `id`="'.$id.'" LIMIT 1'); + } - sys::outjs(array('s' => 'ok')); - } + sys::outjs(array('s' => 'ok')); + } - $aData = array(); + $aData = array(); - $aData['user'] = isset($_POST['user']) ? sys::int($_POST['user']) : $ctrl['user']; - $aData['address'] = isset($_POST['address']) ? trim($_POST['address']) : $ctrl['address']; - $aData['passwd'] = isset($_POST['passwd']) ? trim($_POST['passwd']) : $ctrl['passwd']; - $aData['time'] = isset($_POST['time']) ? trim($_POST['time']) : $ctrl['time']; - $aData['sql_passwd'] = isset($_POST['sql_passwd']) ? trim($_POST['sql_passwd']) : $ctrl['sql_passwd']; - $aData['sql_ftp'] = isset($_POST['sql_ftp']) ? trim($_POST['sql_ftp']) : $ctrl['sql_ftp']; - $aData['limit'] = isset($_POST['sql_ftp']) ? sys::int($_POST['limit']) : $ctrl['limit']; - $aData['price'] = isset($_POST['price']) ? sys::int($_POST['price']) : $ctrl['price']; + $aData['user'] = isset($_POST['user']) ? sys::int($_POST['user']) : $ctrl['user']; + $aData['address'] = isset($_POST['address']) ? trim($_POST['address']) : $ctrl['address']; + $aData['passwd'] = isset($_POST['passwd']) ? trim($_POST['passwd']) : $ctrl['passwd']; + $aData['time'] = isset($_POST['time']) ? trim($_POST['time']) : $ctrl['time']; + $aData['sql_passwd'] = isset($_POST['sql_passwd']) ? trim($_POST['sql_passwd']) : $ctrl['sql_passwd']; + $aData['sql_ftp'] = isset($_POST['sql_ftp']) ? trim($_POST['sql_ftp']) : $ctrl['sql_ftp']; + $aData['limit'] = isset($_POST['sql_ftp']) ? sys::int($_POST['limit']) : $ctrl['limit']; + $aData['price'] = isset($_POST['price']) ? sys::int($_POST['price']) : $ctrl['price']; - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - if(sys::valid($aData['address'].':22', 'other', $aValid['address'])) - $aData['address'] = $ctrl['address']; + if(sys::valid($aData['address'].':22', 'other', $aValid['address'])) + $aData['address'] = $ctrl['address']; - if(sys::valid($aData['sql_passwd'], 'en')) - $aData['sql_passwd'] = $ctrl['sql_passwd']; + if(sys::valid($aData['sql_passwd'], 'en')) + $aData['sql_passwd'] = $ctrl['sql_passwd']; - if(sys::valid($aData['sql_ftp'], 'en')) - $aData['sql_ftp'] = $ctrl['sql_ftp']; + if(sys::valid($aData['sql_ftp'], 'en')) + $aData['sql_ftp'] = $ctrl['sql_ftp']; - if(!$ssh->auth($aData['passwd'], $aData['address'])) - sys::outjs(array('e' => 'Не удалось создать связь с локацией')); + if(!$ssh->auth($aData['passwd'], $aData['address'])) + sys::outjs(array('e' => 'Не удалось создать связь с локацией')); - if($ctrl['user'] != $aData['user']) - { - $sql->query('SELECT `id` FROM `users` WHERE `id`="'.$aData['user'].'" LIMIT 1'); - if(!$sql->num()) - sys::outjs(array('e' => 'Пользователь не найден.')); - } + if($ctrl['user'] != $aData['user']) + { + $sql->query('SELECT `id` FROM `users` WHERE `id`="'.$aData['user'].'" LIMIT 1'); + if(!$sql->num()) + sys::outjs(array('e' => 'Пользователь не найден.')); + } - $aData['time'] = sys::checkdate($aData['time']); + $aData['time'] = sys::checkdate($aData['time']); - $sql->query('UPDATE `control` set ' - .'`user`="'.$aData['user'].'",' - .'`address`="'.$aData['address'].'",' - .'`passwd`="'.$aData['passwd'].'",' - .'`time`="'.$aData['time'].'",' - .'`sql_passwd`="'.$aData['sql_passwd'].'",' - .'`sql_ftp`="'.$aData['sql_ftp'].'",' - .'`limit`="'.$aData['limit'].'",' - .'`price`="'.$aData['price'].'" WHERE `id`="'.$id.'" LIMIT 1'); + $sql->query('UPDATE `control` set ' + .'`user`="'.$aData['user'].'",' + .'`address`="'.$aData['address'].'",' + .'`passwd`="'.$aData['passwd'].'",' + .'`time`="'.$aData['time'].'",' + .'`sql_passwd`="'.$aData['sql_passwd'].'",' + .'`sql_ftp`="'.$aData['sql_ftp'].'",' + .'`limit`="'.$aData['limit'].'",' + .'`price`="'.$aData['price'].'" WHERE `id`="'.$id.'" LIMIT 1'); - sys::outjs(array('s' => 'ok')); - } + sys::outjs(array('s' => 'ok')); + } - $html->get('server', 'sections/control'); - $html->set('id', $id); - $html->set('user', $ctrl['user']); - $html->set('address', $ctrl['address']); - $html->set('passwd', $ctrl['passwd']); - $html->set('sql_passwd', $ctrl['sql_passwd']); - $html->set('sql_ftp', $ctrl['sql_ftp']); - $html->set('limit', $ctrl['limit']); - $html->set('price', $ctrl['price']); - $html->set('time', date('d/m/Y H:i', $ctrl['time'])); - $html->set('date', date('d.m.Y - H:i:s', $ctrl['date'])); - $html->set('overdue', $ctrl['overdue'] == 0 ? 'Установить' : date('d/m/Y H:i', $ctrl['overdue'])); - $html->set('block', $ctrl['block'] == 0 ? 'Заблокировать' : date('d/m/Y H:i', $ctrl['block'])); + $html->get('server', 'sections/control'); + $html->set('id', $id); + $html->set('user', $ctrl['user']); + $html->set('address', $ctrl['address']); + $html->set('passwd', $ctrl['passwd']); + $html->set('sql_passwd', $ctrl['sql_passwd']); + $html->set('sql_ftp', $ctrl['sql_ftp']); + $html->set('limit', $ctrl['limit']); + $html->set('price', $ctrl['price']); + $html->set('time', date('d/m/Y H:i', $ctrl['time'])); + $html->set('date', date('d.m.Y - H:i:s', $ctrl['date'])); + $html->set('overdue', $ctrl['overdue'] == 0 ? 'Установить' : date('d/m/Y H:i', $ctrl['overdue'])); + $html->set('block', $ctrl['block'] == 0 ? 'Заблокировать' : date('d/m/Y H:i', $ctrl['block'])); - $html->pack('main'); + $html->pack('main'); ?> \ No newline at end of file diff --git a/system/acp/sections/jobs/add.php b/system/acp/sections/jobs/add.php index 736ee06..bdc5e32 100644 --- a/system/acp/sections/jobs/add.php +++ b/system/acp/sections/jobs/add.php @@ -1,28 +1,28 @@ 'Необходимо заполнить все поля!')); - - $sql->query('INSERT INTO `jobs` set' - .'`name`="'.$aData['name'].'",' - .'`job`="'.$aData['job'].'",' - .'`desc`="'.$aData['desc'].'",' - .'`status`="'.$aData['status'].'",' - .'`date`="'.$start_point.'"'); + if(in_array('', $aData)) + sys::outjs(array('e' => 'Необходимо заполнить все поля!')); + + $sql->query('INSERT INTO `jobs` set' + .'`name`="'.$aData['name'].'",' + .'`job`="'.$aData['job'].'",' + .'`desc`="'.$aData['desc'].'",' + .'`status`="'.$aData['status'].'",' + .'`date`="'.$start_point.'"'); - sys::outjs(array('s' => 'ok')); - } + sys::outjs(array('s' => 'ok')); + } - $html->get('add', 'sections/jobs'); - $html->pack('main'); + $html->get('add', 'sections/jobs'); + $html->pack('main'); ?> \ No newline at end of file diff --git a/system/acp/sections/jobs/edit.php b/system/acp/sections/jobs/edit.php index f154941..30ec9a9 100644 --- a/system/acp/sections/jobs/edit.php +++ b/system/acp/sections/jobs/edit.php @@ -1,39 +1,39 @@ query('SELECT * FROM `jobs` WHERE `id`="'.$id.'" LIMIT 1'); - if(!$sql->num()) - header('Location: '.$cfg['http'].'acp/jobs'); - $jobs = $sql->get(); + $sql->query('SELECT * FROM `jobs` WHERE `id`="'.$id.'" LIMIT 1'); + if(!$sql->num()) + header('Location: '.$cfg['http'].'acp/jobs'); + $jobs = $sql->get(); - if($go) - { - $aData = []; + if($go) + { + $aData = []; - $data = ['name', 'job', 'desc', 'status']; - foreach($data as $idata) - $aData[$idata] = isset($_POST[$idata]) ? $_POST[$idata] : ''; + $data = ['name', 'job', 'desc', 'status']; + foreach($data as $idata) + $aData[$idata] = isset($_POST[$idata]) ? $_POST[$idata] : ''; - if(in_array('', $aData)) - sys::outjs(array('e' => 'Необходимо заполнить все поля!')); - - $sql->query('UPDATE `jobs` set' - .'`name`="'.$aData['name'].'",' - .'`job`="'.$aData['job'].'",' - .'`desc`="'.$aData['desc'].'",' - .'`status`="'.$aData['status'].'",' - .'`date`="'.$start_point.'"'); + if(in_array('', $aData)) + sys::outjs(array('e' => 'Необходимо заполнить все поля!')); + + $sql->query('UPDATE `jobs` set' + .'`name`="'.$aData['name'].'",' + .'`job`="'.$aData['job'].'",' + .'`desc`="'.$aData['desc'].'",' + .'`status`="'.$aData['status'].'",' + .'`date`="'.$start_point.'"'); - sys::outjs(array('s' => 'ok')); - } + sys::outjs(array('s' => 'ok')); + } - $html->get('edit', 'sections/jobs'); - $status = $jobs['status'] ? '' : ''; - $html->set('status', $status); + $html->get('edit', 'sections/jobs'); + $status = $jobs['status'] ? '' : ''; + $html->set('status', $status); - $data = ['id', 'name', 'job', 'desc']; - foreach($data as $idata) - $html->set($idata, $jobs[$idata]); - $html->pack('main'); + $data = ['id', 'name', 'job', 'desc']; + foreach($data as $idata) + $html->set($idata, $jobs[$idata]); + $html->pack('main'); ?> \ No newline at end of file diff --git a/system/acp/sections/jobs/index.php b/system/acp/sections/jobs/index.php index b4f5052..e32c13c 100644 --- a/system/acp/sections/jobs/index.php +++ b/system/acp/sections/jobs/index.php @@ -1,38 +1,38 @@ query('SELECT * FROM `jobs` ORDER BY `id` ASC'); - while($jobs = $sql->get()) - { - $status = [ - '1' => 'Доступна', - '0' => 'Недоступна' - ]; + if($url['edit']){ + include(SEC.'jobs/edit.php'); + }else{ + $sql->query('SELECT * FROM `jobs` ORDER BY `id` ASC'); + while($jobs = $sql->get()) + { + $status = [ + '1' => 'Доступна', + '0' => 'Недоступна' + ]; - $list .= ''; - $list .= ''.$jobs['id'].''; - $list .= ''.$jobs['name'].''; - $list .= ''.$jobs['job'].''; - $list .= ''.$jobs['desc'].''; - $list .= ''.$status[$jobs['status']].''; - $list .= ''.sys::today($jobs['date']).''; - $list .= '
    удалить
    '; - $list .= 'Изменить'; - $list .= ''; - } + $list .= ''; + $list .= ''.$jobs['id'].''; + $list .= ''.$jobs['name'].''; + $list .= ''.$jobs['job'].''; + $list .= ''.$jobs['desc'].''; + $list .= ''.$status[$jobs['status']].''; + $list .= ''.sys::today($jobs['date']).''; + $list .= '
    удалить
    '; + $list .= 'Изменить'; + $list .= ''; + } - if(isset($url['del'])) - { - $sql->query('DELETE FROM `jobs` WHERE `id`="'.$url['del'].'" LIMIT 1'); - sys::outjs(array('s' => 'ok')); - } + if(isset($url['del'])) + { + $sql->query('DELETE FROM `jobs` WHERE `id`="'.$url['del'].'" LIMIT 1'); + sys::outjs(array('s' => 'ok')); + } - $html->get('index', 'sections/jobs'); - $html->set('list', $list); - $html->pack('main'); - } + $html->get('index', 'sections/jobs'); + $html->set('list', $list); + $html->pack('main'); + } ?> \ No newline at end of file diff --git a/system/acp/sections/jobs/request.php b/system/acp/sections/jobs/request.php index f4a61ae..0906802 100644 --- a/system/acp/sections/jobs/request.php +++ b/system/acp/sections/jobs/request.php @@ -1,64 +1,64 @@ query('SELECT * FROM `jobs_app` WHERE `id`="'.$id.'" LIMIT 1'); - $jobs_app = $sql->get(); + if($id) + { + $sql->query('SELECT * FROM `jobs_app` WHERE `id`="'.$id.'" LIMIT 1'); + $jobs_app = $sql->get(); - if($go) - { - $aData = []; + if($go) + { + $aData = []; - $data = ['user', 'text', 'contact', 'job']; - foreach($data as $idata) - $aData[$idata] = isset($_POST[$idata]) ? $_POST[$idata] : ''; + $data = ['user', 'text', 'contact', 'job']; + foreach($data as $idata) + $aData[$idata] = isset($_POST[$idata]) ? $_POST[$idata] : ''; - $sql->query('UPDATE `jobs_app` set' - .'`user`="'.$aData['user'].'",' - .'`text`="'.$aData['text'].'",' - .'`contact`="'.$aData['contact'].'",' - .'`job`="'.$aData['job'].'"'); + $sql->query('UPDATE `jobs_app` set' + .'`user`="'.$aData['user'].'",' + .'`text`="'.$aData['text'].'",' + .'`contact`="'.$aData['contact'].'",' + .'`job`="'.$aData['job'].'"'); - sys::outjs(array('s' => 'ok')); - } + sys::outjs(array('s' => 'ok')); + } - $html->get('request_edit', 'sections/jobs'); - $data = ['id', 'user', 'text', 'contact', 'job']; - foreach($data as $idata) - $html->set($idata, $jobs_app[$idata]); - $html->pack('main'); - }else{ - $sql->query('SELECT * FROM `jobs_app` ORDER BY `id` ASC'); - while($jobs = $sql->get()) - { - $status = [ - '1' => 'Доступна', - '0' => 'Недоступна' - ]; + $html->get('request_edit', 'sections/jobs'); + $data = ['id', 'user', 'text', 'contact', 'job']; + foreach($data as $idata) + $html->set($idata, $jobs_app[$idata]); + $html->pack('main'); + }else{ + $sql->query('SELECT * FROM `jobs_app` ORDER BY `id` ASC'); + while($jobs = $sql->get()) + { + $status = [ + '1' => 'Доступна', + '0' => 'Недоступна' + ]; - $list .= ''; - $list .= ''.$jobs['id'].''; - $list .= 'user_'.$jobs['user'].''; - $list .= ''.sys::strlen($jobs['text']) > 0 ? ''.$jobs['text'].'' : 'Ответить'.''; - $list .= ''.$jobs['contact'].''; - $list .= 'job_'.$jobs['job'].''; - $list .= ''.sys::today($jobs['date']).''; - $list .= '
    удалить
    '; - $list .= 'Изменить'; - $list .= ''; - - if(isset($url['del'])) - { - $sql->query('DELETE FROM `jobs_app` WHERE `id`="'.$url['del'].'" LIMIT 1'); - sys::outjs(array('s' => 'ok')); + $list .= ''; + $list .= ''.$jobs['id'].''; + $list .= 'user_'.$jobs['user'].''; + $list .= ''.sys::strlen($jobs['text']) > 0 ? ''.$jobs['text'].'' : 'Ответить'.''; + $list .= ''.$jobs['contact'].''; + $list .= 'job_'.$jobs['job'].''; + $list .= ''.sys::today($jobs['date']).''; + $list .= '
    удалить
    '; + $list .= 'Изменить'; + $list .= ''; + + if(isset($url['del'])) + { + $sql->query('DELETE FROM `jobs_app` WHERE `id`="'.$url['del'].'" LIMIT 1'); + sys::outjs(array('s' => 'ok')); - } - } + } + } - $html->get('request', 'sections/jobs'); - $html->set('list', $list); - $html->pack('main'); - } + $html->get('request', 'sections/jobs'); + $html->set('list', $list); + $html->pack('main'); + } ?> \ No newline at end of file diff --git a/system/acp/sections/letter/index.php b/system/acp/sections/letter/index.php index ca0486a..0374065 100644 --- a/system/acp/sections/letter/index.php +++ b/system/acp/sections/letter/index.php @@ -1,25 +1,25 @@ 'Пользователь', 'support' => 'Тех.поддержка', 'admin' => 'Администратор'); - $list = ''; + $group = array('user' => 'Пользователь', 'support' => 'Тех.поддержка', 'admin' => 'Администратор'); + $list = ''; - $sql->query('SELECT `id`, `login`, `mail`, `group`, `name`, `lastname`, `patronymic`, `balance`, `time` FROM `users` WHERE `notice_news`="1" ORDER BY `id` ASC'); - while($us = $sql->get()) - { - $list .= ''; - $list .= ''; - $list .= ''; - $list .= ''.$us['mail'].''; - $list .= ''.$us['balance'].' '.$cfg['currency'].''; - $list .= ''.sys::today($us['time']).''; - $list .= ''; - } + $sql->query('SELECT `id`, `login`, `mail`, `group`, `name`, `lastname`, `patronymic`, `balance`, `time` FROM `users` WHERE `notice_news`="1" ORDER BY `id` ASC'); + while($us = $sql->get()) + { + $list .= ''; + $list .= ''; + $list .= ''; + $list .= ''.$us['mail'].''; + $list .= ''.$us['balance'].' '.$cfg['currency'].''; + $list .= ''.sys::today($us['time']).''; + $list .= ''; + } - $html->get('index', 'sections/letter'); + $html->get('index', 'sections/letter'); - $html->set('list', $list); + $html->set('list', $list); - $html->pack('main'); + $html->pack('main'); ?> \ No newline at end of file diff --git a/system/acp/sections/letter/send.php b/system/acp/sections/letter/send.php index baecdc6..293475c 100644 --- a/system/acp/sections/letter/send.php +++ b/system/acp/sections/letter/send.php @@ -1,54 +1,54 @@ 'Необходимо указать заголовок')); - $aData['text'] = isset($_POST['text']) ? trim($_POST['text']) : sys::outjs(array('e' => 'Необходимо указать сообщение')); + $aData['title'] = isset($_POST['title']) ? trim($_POST['title']) : sys::outjs(array('e' => 'Необходимо указать заголовок')); + $aData['text'] = isset($_POST['text']) ? trim($_POST['text']) : sys::outjs(array('e' => 'Необходимо указать сообщение')); - $aData['users'] = isset($_POST['users']) ? $_POST['users'] : sys::outjs(array('e' => 'Необходимо указать получателей')); + $aData['users'] = isset($_POST['users']) ? $_POST['users'] : sys::outjs(array('e' => 'Необходимо указать получателей')); - if($aData['title'] == '' || $aData['text'] == '') - sys::outjs(array('e' => 'Необходимо заполнить все поля')); + if($aData['title'] == '' || $aData['text'] == '') + sys::outjs(array('e' => 'Необходимо заполнить все поля')); - if(!is_array($aData['users']) || !count($aData['users'])) - sys::outjs(array('e' => 'Необходимо указать минимум одного получателя')); + if(!is_array($aData['users']) || !count($aData['users'])) + sys::outjs(array('e' => 'Необходимо указать минимум одного получателя')); - $noletter = ''; + $noletter = ''; - include(LIB.'smtp.php'); + include(LIB.'smtp.php'); - foreach($aData['users'] as $id => $cheked) - { - if($cheked != 'on') - continue; + foreach($aData['users'] as $id => $cheked) + { + if($cheked != 'on') + continue; - $sql->query('SELECT `mail` FROM `users` WHERE `id`="'.sys::int($id).'" LIMIT 1'); - $us = $sql->get(); + $sql->query('SELECT `mail` FROM `users` WHERE `id`="'.sys::int($id).'" LIMIT 1'); + $us = $sql->get(); - $tpl = file_get_contents(DATA.'mail.ini', "r"); + $tpl = file_get_contents(DATA.'mail.ini', "r"); - $text = str_replace( - array('[name]', '[text]', '[http]', '[img]', '[css]'), - array($cfg['name'], $aData['text'], $cfg['http'], $cfg['http'].'template/images/', $cfg['http'].'template/css/'), - $tpl - ); + $text = str_replace( + array('[name]', '[text]', '[http]', '[img]', '[css]'), + array($cfg['name'], $aData['text'], $cfg['http'], $cfg['http'].'template/images/', $cfg['http'].'template/css/'), + $tpl + ); - $smtp = new smtp($cfg['smtp_login'], $cfg['smtp_passwd'], $cfg['smtp_url'], $cfg['smtp_mail'], 465); + $smtp = new smtp($cfg['smtp_login'], $cfg['smtp_passwd'], $cfg['smtp_url'], $cfg['smtp_mail'], 465); - $headers = "MIME-Version: 1.0\r\n"; - $headers .= "Content-type: text/html; charset=utf-8\r\n"; - $headers .= "From: ".$cfg['smtp_name']." <".$cfg['smtp_mail'].">\r\n"; + $headers = "MIME-Version: 1.0\r\n"; + $headers .= "Content-type: text/html; charset=utf-8\r\n"; + $headers .= "From: ".$cfg['smtp_name']." <".$cfg['smtp_mail'].">\r\n"; - if(!$smtp->send($us['mail'], strip_tags($aData['title']), $text, $headers)) - $noletter .= '

    '.$us['mail'].'

    '; - } + if(!$smtp->send($us['mail'], strip_tags($aData['title']), $text, $headers)) + $noletter .= '

    '.$us['mail'].'

    '; + } - if($noletter == '') - $noletter = 'отправлено всем.'; + if($noletter == '') + $noletter = 'отправлено всем.'; - sys::outjs(array('s' => $noletter)); + sys::outjs(array('s' => $noletter)); ?> \ No newline at end of file diff --git a/system/acp/sections/logs/buy.php b/system/acp/sections/logs/buy.php index a1deb10..2274f0c 100644 --- a/system/acp/sections/logs/buy.php +++ b/system/acp/sections/logs/buy.php @@ -1,32 +1,32 @@ query('SELECT `id` FROM `logs` WHERE `type`="buy"'); + $sql->query('SELECT `id` FROM `logs` WHERE `type`="buy"'); - $aPage = sys::page($page, $sql->num(), 40); + $aPage = sys::page($page, $sql->num(), 40); - sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/logs'); + sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/logs'); - $sql->query('SELECT `id`, `user`, `text`, `date`, `money` FROM `logs` WHERE `type`="buy" ORDER BY `id` DESC LIMIT '.$aPage['num'].', 40'); - while($log = $sql->get()) - { - $list .= ''; - $list .= ''.$log['id'].''; - $list .= ''.$log['text'].''; - $list .= 'USER_'.$log['user'].''; - $list .= ''.$log['money'].''; - $list .= ''.date('d.m.Y - H:i:s', $log['date']).''; - $list .= ''; - } + $sql->query('SELECT `id`, `user`, `text`, `date`, `money` FROM `logs` WHERE `type`="buy" ORDER BY `id` DESC LIMIT '.$aPage['num'].', 40'); + while($log = $sql->get()) + { + $list .= ''; + $list .= ''.$log['id'].''; + $list .= ''.$log['text'].''; + $list .= 'USER_'.$log['user'].''; + $list .= ''.$log['money'].''; + $list .= ''.date('d.m.Y - H:i:s', $log['date']).''; + $list .= ''; + } - $html->get('logs', 'sections/logs'); + $html->get('logs', 'sections/logs'); - $html->set('list', $list); + $html->set('list', $list); - $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); + $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); - $html->pack('main'); + $html->pack('main'); ?> \ No newline at end of file diff --git a/system/acp/sections/logs/cashout.php b/system/acp/sections/logs/cashout.php index 3287162..af269b0 100644 --- a/system/acp/sections/logs/cashout.php +++ b/system/acp/sections/logs/cashout.php @@ -1,32 +1,32 @@ query('SELECT `id` FROM `logs` WHERE `type`="cashout"'); + $sql->query('SELECT `id` FROM `logs` WHERE `type`="cashout"'); - $aPage = sys::page($page, $sql->num(), 40); + $aPage = sys::page($page, $sql->num(), 40); - sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/logs/section/cashout'); + sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/logs/section/cashout'); - $sql->query('SELECT `id`, `user`, `text`, `date`, `money` FROM `logs` WHERE `type`="cashout" ORDER BY `id` DESC LIMIT '.$aPage['num'].', 40'); - while($log = $sql->get()) - { - $list .= ''; - $list .= ''.$log['id'].''; - $list .= ''.$log['text'].''; - $list .= 'USER_'.$log['user'].''; - $list .= ''.$log['money'].''; - $list .= ''.date('d.m.Y - H:i:s', $log['date']).''; - $list .= ''; - } + $sql->query('SELECT `id`, `user`, `text`, `date`, `money` FROM `logs` WHERE `type`="cashout" ORDER BY `id` DESC LIMIT '.$aPage['num'].', 40'); + while($log = $sql->get()) + { + $list .= ''; + $list .= ''.$log['id'].''; + $list .= ''.$log['text'].''; + $list .= 'USER_'.$log['user'].''; + $list .= ''.$log['money'].''; + $list .= ''.date('d.m.Y - H:i:s', $log['date']).''; + $list .= ''; + } - $html->get('logs', 'sections/logs'); + $html->get('logs', 'sections/logs'); - $html->set('list', $list); + $html->set('list', $list); - $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); + $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); - $html->pack('main'); + $html->pack('main'); ?> \ No newline at end of file diff --git a/system/acp/sections/logs/extend.php b/system/acp/sections/logs/extend.php index 1e3058b..dde0f89 100644 --- a/system/acp/sections/logs/extend.php +++ b/system/acp/sections/logs/extend.php @@ -1,32 +1,32 @@ query('SELECT `id` FROM `logs` WHERE `type`="extend"'); + $sql->query('SELECT `id` FROM `logs` WHERE `type`="extend"'); - $aPage = sys::page($page, $sql->num(), 40); + $aPage = sys::page($page, $sql->num(), 40); - sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/logs/section/extend'); + sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/logs/section/extend'); - $sql->query('SELECT `id`, `user`, `text`, `date`, `money` FROM `logs` WHERE `type`="extend" ORDER BY `id` DESC LIMIT '.$aPage['num'].', 40'); - while($log = $sql->get()) - { - $list .= ''; - $list .= ''.$log['id'].''; - $list .= ''.$log['text'].''; - $list .= 'USER_'.$log['user'].''; - $list .= ''.$log['money'].''; - $list .= ''.date('d.m.Y - H:i:s', $log['date']).''; - $list .= ''; - } + $sql->query('SELECT `id`, `user`, `text`, `date`, `money` FROM `logs` WHERE `type`="extend" ORDER BY `id` DESC LIMIT '.$aPage['num'].', 40'); + while($log = $sql->get()) + { + $list .= ''; + $list .= ''.$log['id'].''; + $list .= ''.$log['text'].''; + $list .= 'USER_'.$log['user'].''; + $list .= ''.$log['money'].''; + $list .= ''.date('d.m.Y - H:i:s', $log['date']).''; + $list .= ''; + } - $html->get('logs', 'sections/logs'); + $html->get('logs', 'sections/logs'); - $html->set('list', $list); + $html->set('list', $list); - $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); + $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); - $html->pack('main'); + $html->pack('main'); ?> \ No newline at end of file diff --git a/system/acp/sections/logs/index.php b/system/acp/sections/logs/index.php index 93848d9..2043c0b 100644 --- a/system/acp/sections/logs/index.php +++ b/system/acp/sections/logs/index.php @@ -1,40 +1,40 @@ query('SELECT `id` FROM `logs_sys`'); + $sql->query('SELECT `id` FROM `logs_sys`'); - $aPage = sys::page($page, $sql->num(), 40); + $aPage = sys::page($page, $sql->num(), 40); - sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/logs'); + sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/logs'); - $sql->query('SELECT `id`, `user`, `server`, `text`, `time` FROM `logs_sys` ORDER BY `id` DESC LIMIT '.$aPage['num'].', 40'); - while($log = $sql->get()) - { - $list .= ''; - $list .= ''.$log['id'].''; - $list .= ''.$log['text'].''; + $sql->query('SELECT `id`, `user`, `server`, `text`, `time` FROM `logs_sys` ORDER BY `id` DESC LIMIT '.$aPage['num'].', 40'); + while($log = $sql->get()) + { + $list .= ''; + $list .= ''.$log['id'].''; + $list .= ''.$log['text'].''; - if(!$log['user']) - $list .= 'Система'; - else - $list .= 'USER_'.$log['user'].''; + if(!$log['user']) + $list .= 'Система'; + else + $list .= 'USER_'.$log['user'].''; - $list .= 'SERVER_'.$log['server'].''; - $list .= ''.date('d.m.Y - H:i:s', $log['time']).''; - $list .= ''; - } + $list .= 'SERVER_'.$log['server'].''; + $list .= ''.date('d.m.Y - H:i:s', $log['time']).''; + $list .= ''; + } - $html->get('index', 'sections/logs'); + $html->get('index', 'sections/logs'); - $html->set('list', $list); + $html->set('list', $list); - $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); + $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); - $html->pack('main'); + $html->pack('main'); ?> \ No newline at end of file diff --git a/system/acp/sections/logs/part.php b/system/acp/sections/logs/part.php index db84692..ef5d2ed 100644 --- a/system/acp/sections/logs/part.php +++ b/system/acp/sections/logs/part.php @@ -1,32 +1,32 @@ query('SELECT `id` FROM `logs` WHERE `type`="part"'); + $sql->query('SELECT `id` FROM `logs` WHERE `type`="part"'); - $aPage = sys::page($page, $sql->num(), 40); + $aPage = sys::page($page, $sql->num(), 40); - sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/logs/section/part'); + sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/logs/section/part'); - $sql->query('SELECT `id`, `user`, `text`, `date`, `money` FROM `logs` WHERE `type`="part" ORDER BY `id` DESC LIMIT '.$aPage['num'].', 40'); - while($log = $sql->get()) - { - $list .= ''; - $list .= ''.$log['id'].''; - $list .= ''.$log['text'].''; - $list .= 'USER_'.$log['user'].''; - $list .= ''.$log['money'].''; - $list .= ''.date('d.m.Y - H:i:s', $log['date']).''; - $list .= ''; - } + $sql->query('SELECT `id`, `user`, `text`, `date`, `money` FROM `logs` WHERE `type`="part" ORDER BY `id` DESC LIMIT '.$aPage['num'].', 40'); + while($log = $sql->get()) + { + $list .= ''; + $list .= ''.$log['id'].''; + $list .= ''.$log['text'].''; + $list .= 'USER_'.$log['user'].''; + $list .= ''.$log['money'].''; + $list .= ''.date('d.m.Y - H:i:s', $log['date']).''; + $list .= ''; + } - $html->get('logs', 'sections/logs'); + $html->get('logs', 'sections/logs'); - $html->set('list', $list); + $html->set('list', $list); - $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); + $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); - $html->pack('main'); + $html->pack('main'); ?> \ No newline at end of file diff --git a/system/acp/sections/logs/replenish.php b/system/acp/sections/logs/replenish.php index f51c67e..bcef272 100644 --- a/system/acp/sections/logs/replenish.php +++ b/system/acp/sections/logs/replenish.php @@ -1,32 +1,32 @@ query('SELECT `id` FROM `logs` WHERE `type`="replenish"'); + $sql->query('SELECT `id` FROM `logs` WHERE `type`="replenish"'); - $aPage = sys::page($page, $sql->num(), 40); + $aPage = sys::page($page, $sql->num(), 40); - sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/logs/section/replenish'); + sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/logs/section/replenish'); - $sql->query('SELECT `id`, `user`, `text`, `date`, `money` FROM `logs` WHERE `type`="replenish" ORDER BY `id` DESC LIMIT '.$aPage['num'].', 40'); - while($log = $sql->get()) - { - $list .= ''; - $list .= ''.$log['id'].''; - $list .= ''.$log['text'].''; - $list .= 'USER_'.$log['user'].''; - $list .= ''.$log['money'].''; - $list .= ''.date('d.m.Y - H:i:s', $log['date']).''; - $list .= ''; - } + $sql->query('SELECT `id`, `user`, `text`, `date`, `money` FROM `logs` WHERE `type`="replenish" ORDER BY `id` DESC LIMIT '.$aPage['num'].', 40'); + while($log = $sql->get()) + { + $list .= ''; + $list .= ''.$log['id'].''; + $list .= ''.$log['text'].''; + $list .= 'USER_'.$log['user'].''; + $list .= ''.$log['money'].''; + $list .= ''.date('d.m.Y - H:i:s', $log['date']).''; + $list .= ''; + } - $html->get('logs', 'sections/logs'); + $html->get('logs', 'sections/logs'); - $html->set('list', $list); + $html->set('list', $list); - $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); + $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); - $html->pack('main'); + $html->pack('main'); ?> \ No newline at end of file diff --git a/system/acp/sections/logs/search.php b/system/acp/sections/logs/search.php index cc41b52..0d70793 100644 --- a/system/acp/sections/logs/search.php +++ b/system/acp/sections/logs/search.php @@ -1,80 +1,80 @@ get($mkey); + $cache = $mcache->get($mkey); - if(is_array($cache)) - { - if($go) - sys::outjs($cache, $nmch); + if(is_array($cache)) + { + if($go) + sys::outjs($cache, $nmch); - sys::outjs($cache); - } + sys::outjs($cache); + } - if(!isset($text{2})) - { - if($go) - sys::outjs(array('e' => 'Для выполнения поиска, необходимо больше данных'), $nmch); + if(!isset($text{2})) + { + if($go) + sys::outjs(array('e' => 'Для выполнения поиска, необходимо больше данных'), $nmch); - sys::outjs(array('e' => '')); - } + sys::outjs(array('e' => '')); + } - $select = '`id`, `user`, `text`, `date`, `type`, `money` FROM `logs`'; + $select = '`id`, `user`, `text`, `date`, `type`, `money` FROM `logs`'; - $check = explode('=', $text); + $check = explode('=', $text); - if(in_array($check[0], array('server', 'user'))) - { - $val = trim($check[1]); + if(in_array($check[0], array('server', 'user'))) + { + $val = trim($check[1]); - switch($check[0]) - { - case 'server': - $sql->query('SELECT '.$select.' WHERE `server`="'.sys::int($val).'" ORDER BY `id` DESC'); - break; + switch($check[0]) + { + case 'server': + $sql->query('SELECT '.$select.' WHERE `server`="'.sys::int($val).'" ORDER BY `id` DESC'); + break; - case 'user': - $sql->query('SELECT '.$select.' WHERE `user`="'.sys::int($val).'" ORDER BY `id` DESC'); - } - }elseif($text{0} == 'i' AND $text{1} == 'd') - $sql->query('SELECT `id`, `user`, `text`, `date`, `type`, `money` FROM `logs` WHERE `id`="'.sys::int($text).'" LIMIT 1'); - else{ - $like = '`id` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' - .'`user` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' - .'`type` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' - .'`money` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' - .'`text` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\')'; + case 'user': + $sql->query('SELECT '.$select.' WHERE `user`="'.sys::int($val).'" ORDER BY `id` DESC'); + } + }elseif($text{0} == 'i' AND $text{1} == 'd') + $sql->query('SELECT `id`, `user`, `text`, `date`, `type`, `money` FROM `logs` WHERE `id`="'.sys::int($text).'" LIMIT 1'); + else{ + $like = '`id` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' + .'`user` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' + .'`type` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' + .'`money` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' + .'`text` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\')'; - $sql->query('SELECT '.$select.' WHERE '.$like.' ORDER BY `id` DESC LIMIT 40'); - } + $sql->query('SELECT '.$select.' WHERE '.$like.' ORDER BY `id` DESC LIMIT 40'); + } - if(!$sql->num()) - { - if($go) - sys::outjs(array('e' => 'По вашему запросу ничего не найдено'), $nmch); + if(!$sql->num()) + { + if($go) + sys::outjs(array('e' => 'По вашему запросу ничего не найдено'), $nmch); - sys::outjs(array('e' => 'По вашему запросу ничего не найдено')); - } + sys::outjs(array('e' => 'По вашему запросу ничего не найдено')); + } - $list = ''; + $list = ''; - while($log = $sql->get()) - { - $list .= ''; - $list .= ''.$log['id'].''; - $list .= ''.$log['text'].''; - $list .= 'USER_'.$log['user'].''; - $list .= ''.$log['money'].' '.$cur['currency'].''; - $list .= ''.date('d.m.Y - H:i:s', $log['date']).''; - $list .= ''; - } + while($log = $sql->get()) + { + $list .= ''; + $list .= ''.$log['id'].''; + $list .= ''.$log['text'].''; + $list .= 'USER_'.$log['user'].''; + $list .= ''.$log['money'].' '.$cur['currency'].''; + $list .= ''.date('d.m.Y - H:i:s', $log['date']).''; + $list .= ''; + } - $mcache->set($mkey, array('s' => $list), false, 15); + $mcache->set($mkey, array('s' => $list), false, 15); - sys::outjs(array('s' => $list)); + sys::outjs(array('s' => $list)); ?> \ No newline at end of file diff --git a/system/acp/sections/logs/sysearch.php b/system/acp/sections/logs/sysearch.php index a3e980a..3701c23 100644 --- a/system/acp/sections/logs/sysearch.php +++ b/system/acp/sections/logs/sysearch.php @@ -1,84 +1,84 @@ get($mkey); + $cache = $mcache->get($mkey); - if(is_array($cache)) - { - if($go) - sys::outjs($cache, $nmch); + if(is_array($cache)) + { + if($go) + sys::outjs($cache, $nmch); - sys::outjs($cache); - } + sys::outjs($cache); + } - if(!isset($text{2})) - { - if($go) - sys::outjs(array('e' => 'Для выполнения поиска, необходимо больше данных'), $nmch); + if(!isset($text{2})) + { + if($go) + sys::outjs(array('e' => 'Для выполнения поиска, необходимо больше данных'), $nmch); - sys::outjs(array('e' => '')); - } + sys::outjs(array('e' => '')); + } - $select = '`id`, `user`, `server`, `text`, `time` FROM `logs_sys`'; + $select = '`id`, `user`, `server`, `text`, `time` FROM `logs_sys`'; - $check = explode('=', $text); + $check = explode('=', $text); - if(in_array($check[0], array('server', 'user'))) - { - $val = trim($check[1]); + if(in_array($check[0], array('server', 'user'))) + { + $val = trim($check[1]); - switch($check[0]) - { - case 'server': - $sql->query('SELECT '.$select.' WHERE `server`="'.sys::int($val).'" ORDER BY `id` DESC'); - break; + switch($check[0]) + { + case 'server': + $sql->query('SELECT '.$select.' WHERE `server`="'.sys::int($val).'" ORDER BY `id` DESC'); + break; - case 'user': - $sql->query('SELECT '.$select.' WHERE `user`="'.sys::int($val).'" ORDER BY `id` DESC'); - } - }elseif($text{0} == 'i' AND $text{1} == 'd') - $sql->query('SELECT '.$select.' WHERE `id`="'.sys::int($text).'" LIMIT 1'); - else{ - $like = '`id` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' - .'`user` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' - .'`server` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' - .'`text` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\')'; + case 'user': + $sql->query('SELECT '.$select.' WHERE `user`="'.sys::int($val).'" ORDER BY `id` DESC'); + } + }elseif($text{0} == 'i' AND $text{1} == 'd') + $sql->query('SELECT '.$select.' WHERE `id`="'.sys::int($text).'" LIMIT 1'); + else{ + $like = '`id` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' + .'`user` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' + .'`server` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' + .'`text` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\')'; - $sql->query('SELECT '.$select.' WHERE '.$like.' ORDER BY `id` DESC LIMIT 40'); - } + $sql->query('SELECT '.$select.' WHERE '.$like.' ORDER BY `id` DESC LIMIT 40'); + } - if(!$sql->num()) - { - if($go) - sys::outjs(array('e' => 'По вашему запросу ничего не найдено'), $nmch); + if(!$sql->num()) + { + if($go) + sys::outjs(array('e' => 'По вашему запросу ничего не найдено'), $nmch); - sys::outjs(array('e' => 'По вашему запросу ничего не найдено')); - } + sys::outjs(array('e' => 'По вашему запросу ничего не найдено')); + } - $list = ''; + $list = ''; - while($log = $sql->get()) - { - $list .= ''; - $list .= ''.$log['id'].''; - $list .= ''.$log['text'].''; + while($log = $sql->get()) + { + $list .= ''; + $list .= ''.$log['id'].''; + $list .= ''.$log['text'].''; - if(!$log['user']) - $list .= 'Система'; - else - $list .= 'USER_'.$log['user'].''; + if(!$log['user']) + $list .= 'Система'; + else + $list .= 'USER_'.$log['user'].''; - $list .= 'SERVER_'.$log['server'].''; - $list .= ''.date('d.m.Y - H:i:s', $log['time']).''; - $list .= ''; - } + $list .= 'SERVER_'.$log['server'].''; + $list .= ''.date('d.m.Y - H:i:s', $log['time']).''; + $list .= ''; + } - $mcache->set($mkey, array('s' => $list), false, 15); + $mcache->set($mkey, array('s' => $list), false, 15); - sys::outjs(array('s' => $list)); + sys::outjs(array('s' => $list)); ?> \ No newline at end of file diff --git a/system/acp/sections/news/add.php b/system/acp/sections/news/add.php index b94d89a..11e2515 100644 --- a/system/acp/sections/news/add.php +++ b/system/acp/sections/news/add.php @@ -1,37 +1,37 @@ 'Необходимо заполнить все поля')); + if(in_array('', $aData)) + sys::outjs(array('e' => 'Необходимо заполнить все поля')); - if(sys::strlen($aData['name']) > 50) - sys::outjs(array('e' => 'Заголовок не должен превышать 50 символов.')); + if(sys::strlen($aData['name']) > 50) + sys::outjs(array('e' => 'Заголовок не должен превышать 50 символов.')); - if(sys::strlen($aData['tags']) > 100) - sys::outjs(array('e' => 'Теги не должен превышать 100 символов.')); + if(sys::strlen($aData['tags']) > 100) + sys::outjs(array('e' => 'Теги не должен превышать 100 символов.')); - $sql->query('INSERT INTO `news` set ' - .'`name`="'.htmlspecialchars($aData['name']).'",' - .'`text`="'.htmlspecialchars($aData['text']).'",' - .'`full_text`="'.htmlspecialchars($aData['full']).'",' - .'`tags`="'.htmlspecialchars($aData['tags']).'",' - .'`views`="0",' - .'`date`="'.$start_point.'"'); + $sql->query('INSERT INTO `news` set ' + .'`name`="'.htmlspecialchars($aData['name']).'",' + .'`text`="'.htmlspecialchars($aData['text']).'",' + .'`full_text`="'.htmlspecialchars($aData['full']).'",' + .'`tags`="'.htmlspecialchars($aData['tags']).'",' + .'`views`="0",' + .'`date`="'.$start_point.'"'); - sys::outjs(array('s' => 'ok')); - } + sys::outjs(array('s' => 'ok')); + } - $html->get('add', 'sections/news'); + $html->get('add', 'sections/news'); - $html->pack('main'); + $html->pack('main'); ?> \ No newline at end of file diff --git a/system/acp/sections/news/delete.php b/system/acp/sections/news/delete.php index e2e8a1e..d376055 100644 --- a/system/acp/sections/news/delete.php +++ b/system/acp/sections/news/delete.php @@ -1,8 +1,8 @@ query('DELETE FROM `news` WHERE `id`="'.$id.'" LIMIT 1'); + $sql->query('DELETE FROM `news` WHERE `id`="'.$id.'" LIMIT 1'); - sys::outjs(array('s' => 'ok')); + sys::outjs(array('s' => 'ok')); ?> \ No newline at end of file diff --git a/system/acp/sections/news/index.php b/system/acp/sections/news/index.php index 143b906..ccf2a73 100644 --- a/system/acp/sections/news/index.php +++ b/system/acp/sections/news/index.php @@ -1,40 +1,40 @@ query('SELECT `id` FROM `news`'); + $sql->query('SELECT `id` FROM `news`'); - $aPage = sys::page($page, $sql->num(), 20); + $aPage = sys::page($page, $sql->num(), 20); - sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/news'); + sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/news'); - $sql->query('SELECT `id`, `name`, `tags`, `views`, `date` FROM `news` ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); - while($news = $sql->get()) - { - $list .= ''; - $list .= ''.$news['id'].''; - $list .= ''.$news['name'].''; - $list .= ''.$news['tags'].''; - $list .= ''.$news['views'].''; - $list .= ''.date('d.m.Y - H:i:s', $news['date']).''; - $list .= 'Удалить'; - $list .= ''; - } + $sql->query('SELECT `id`, `name`, `tags`, `views`, `date` FROM `news` ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); + while($news = $sql->get()) + { + $list .= ''; + $list .= ''.$news['id'].''; + $list .= ''.$news['name'].''; + $list .= ''.$news['tags'].''; + $list .= ''.$news['views'].''; + $list .= ''.date('d.m.Y - H:i:s', $news['date']).''; + $list .= 'Удалить'; + $list .= ''; + } - $html->get('index', 'sections/news'); + $html->get('index', 'sections/news'); - $html->set('list', $list); + $html->set('list', $list); - $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); + $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); - $html->pack('main'); - } + $html->pack('main'); + } ?> \ No newline at end of file diff --git a/system/acp/sections/news/news.php b/system/acp/sections/news/news.php index f7cd248..f8d9351 100644 --- a/system/acp/sections/news/news.php +++ b/system/acp/sections/news/news.php @@ -1,44 +1,44 @@ query('SELECT `name`, `text`, `full_text`, `tags` FROM `news` WHERE `id`="'.$id.'" LIMIT 1'); - $news = $sql->get(); + $sql->query('SELECT `name`, `text`, `full_text`, `tags` FROM `news` WHERE `id`="'.$id.'" LIMIT 1'); + $news = $sql->get(); - if($go) - { - $aData = array(); + if($go) + { + $aData = array(); - $aData['name'] = isset($_POST['name']) ? trim($_POST['name']) : htmlspecialchars_decode($news['name']); - $aData['text'] = isset($_POST['text']) ? sys::bbc(trim($_POST['text'])) : htmlspecialchars_decode($news['text']); - $aData['full'] = isset($_POST['full']) ? sys::bbc(trim($_POST['full'])) : htmlspecialchars_decode($news['full_text']); - $aData['tags'] = isset($_POST['tags']) ? trim($_POST['tags']) : htmlspecialchars_decode($news['tags']); + $aData['name'] = isset($_POST['name']) ? trim($_POST['name']) : htmlspecialchars_decode($news['name']); + $aData['text'] = isset($_POST['text']) ? sys::bbc(trim($_POST['text'])) : htmlspecialchars_decode($news['text']); + $aData['full'] = isset($_POST['full']) ? sys::bbc(trim($_POST['full'])) : htmlspecialchars_decode($news['full_text']); + $aData['tags'] = isset($_POST['tags']) ? trim($_POST['tags']) : htmlspecialchars_decode($news['tags']); - if(in_array('', $aData)) - sys::outjs(array('e' => 'Необходимо заполнить все поля')); + if(in_array('', $aData)) + sys::outjs(array('e' => 'Необходимо заполнить все поля')); - if(sys::strlen($aData['name']) > 50) - sys::outjs(array('e' => 'Заголовок не должен превышать 50 символов.')); + if(sys::strlen($aData['name']) > 50) + sys::outjs(array('e' => 'Заголовок не должен превышать 50 символов.')); - if(sys::strlen($aData['tags']) > 100) - sys::outjs(array('e' => 'Теги не должен превышать 100 символов.')); + if(sys::strlen($aData['tags']) > 100) + sys::outjs(array('e' => 'Теги не должен превышать 100 символов.')); - $sql->query('UPDATE `news` set ' - .'`name`="'.htmlspecialchars($aData['name']).'",' - .'`text`="'.htmlspecialchars($aData['text']).'",' - .'`full_text`="'.htmlspecialchars($aData['full']).'",' - .'`tags`="'.htmlspecialchars($aData['tags']).'" WHERE `id`="'.$id.'" LIMIT 1'); + $sql->query('UPDATE `news` set ' + .'`name`="'.htmlspecialchars($aData['name']).'",' + .'`text`="'.htmlspecialchars($aData['text']).'",' + .'`full_text`="'.htmlspecialchars($aData['full']).'",' + .'`tags`="'.htmlspecialchars($aData['tags']).'" WHERE `id`="'.$id.'" LIMIT 1'); - sys::outjs(array('s' => 'ok')); - } + sys::outjs(array('s' => 'ok')); + } - $html->get('news', 'sections/news'); + $html->get('news', 'sections/news'); - $html->set('id', $id); - $html->set('name', htmlspecialchars_decode($news['name'])); - $html->set('text', htmlspecialchars_decode($news['text'])); - $html->set('full', htmlspecialchars_decode($news['full_text'])); - $html->set('tags', htmlspecialchars_decode($news['tags'])); + $html->set('id', $id); + $html->set('name', htmlspecialchars_decode($news['name'])); + $html->set('text', htmlspecialchars_decode($news['text'])); + $html->set('full', htmlspecialchars_decode($news['full_text'])); + $html->set('tags', htmlspecialchars_decode($news['tags'])); - $html->pack('main'); + $html->pack('main'); ?> \ No newline at end of file diff --git a/system/acp/sections/news/search.php b/system/acp/sections/news/search.php index 3e2928f..25d264c 100644 --- a/system/acp/sections/news/search.php +++ b/system/acp/sections/news/search.php @@ -1,64 +1,64 @@ get($mkey); + $cache = $mcache->get($mkey); - if(is_array($cache)) - { - if($go) - sys::outjs($cache, $nmch); + if(is_array($cache)) + { + if($go) + sys::outjs($cache, $nmch); - sys::outjs($cache); - } + sys::outjs($cache); + } - if(!isset($text{2})) - { - if($go) - sys::outjs(array('e' => 'Для выполнения поиска, необходимо больше данных'), $nmch); + if(!isset($text{2})) + { + if($go) + sys::outjs(array('e' => 'Для выполнения поиска, необходимо больше данных'), $nmch); - sys::outjs(array('e' => '')); - } + sys::outjs(array('e' => '')); + } - if($text{0} == 'i' AND $text{1} == 'd') - $sql->query('SELECT `id`, `name`, `tags`, `views`, `date` FROM `news` WHERE `id`="'.sys::int($text).'" LIMIT 1'); - else{ - $like = '`id` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' - .'`name` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' - .'`text` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' - .'`tags` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' - .'`full_text` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\')'; + if($text{0} == 'i' AND $text{1} == 'd') + $sql->query('SELECT `id`, `name`, `tags`, `views`, `date` FROM `news` WHERE `id`="'.sys::int($text).'" LIMIT 1'); + else{ + $like = '`id` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' + .'`name` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' + .'`text` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' + .'`tags` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' + .'`full_text` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\')'; - $sql->query('SELECT `id`, `name`, `tags`, `views`, `date` FROM `news` WHERE '.$like.' ORDER BY `id` ASC LIMIT 20'); - } + $sql->query('SELECT `id`, `name`, `tags`, `views`, `date` FROM `news` WHERE '.$like.' ORDER BY `id` ASC LIMIT 20'); + } - if(!$sql->num()) - { - if($go) - sys::outjs(array('e' => 'По вашему запросу ничего не найдено'), $nmch); + if(!$sql->num()) + { + if($go) + sys::outjs(array('e' => 'По вашему запросу ничего не найдено'), $nmch); - sys::outjs(array('e' => 'По вашему запросу ничего не найдено')); - } + sys::outjs(array('e' => 'По вашему запросу ничего не найдено')); + } - $list = ''; + $list = ''; - while($news = $sql->get()) - { - $list .= ''; - $list .= ''.$news['id'].''; - $list .= ''.$news['name'].''; - $list .= ''.$news['tags'].''; - $list .= ''.$news['views'].''; - $list .= ''.date('d.m.Y - H:i:s', $news['date']).''; - $list .= 'Удалить'; - $list .= ''; - } + while($news = $sql->get()) + { + $list .= ''; + $list .= ''.$news['id'].''; + $list .= ''.$news['name'].''; + $list .= ''.$news['tags'].''; + $list .= ''.$news['views'].''; + $list .= ''.date('d.m.Y - H:i:s', $news['date']).''; + $list .= 'Удалить'; + $list .= ''; + } - $mcache->set($mkey, array('s' => $list), false, 15); + $mcache->set($mkey, array('s' => $list), false, 15); - sys::outjs(array('s' => $list)); + sys::outjs(array('s' => $list)); ?> \ No newline at end of file diff --git a/system/acp/sections/notice/add.php b/system/acp/sections/notice/add.php index 18dbc96..e76967b 100644 --- a/system/acp/sections/notice/add.php +++ b/system/acp/sections/notice/add.php @@ -1,55 +1,55 @@ query('SELECT `id` FROM `units` WHERE `id`="'.$aData['unit'].'" LIMIT 1'); - if(!$sql->num()) - sys::outjs(array('e' => 'Указанная локация не найдена')); + if($aData['type'] == 'unit') + { + $sql->query('SELECT `id` FROM `units` WHERE `id`="'.$aData['unit'].'" LIMIT 1'); + if(!$sql->num()) + sys::outjs(array('e' => 'Указанная локация не найдена')); - $aData['server'] = 0; - }elseif($aData['type'] == 'server'){ - $sql->query('SELECT `id` FROM `servers` WHERE `id`="'.$aData['server'].'" LIMIT 1'); - if(!$sql->num()) - sys::outjs(array('e' => 'Указанный сервер не найден')); + $aData['server'] = 0; + }elseif($aData['type'] == 'server'){ + $sql->query('SELECT `id` FROM `servers` WHERE `id`="'.$aData['server'].'" LIMIT 1'); + if(!$sql->num()) + sys::outjs(array('e' => 'Указанный сервер не найден')); - $aData['unit'] = 0; - }else - sys::outjs(array('e' => 'Выберете получателя уведомления')); + $aData['unit'] = 0; + }else + sys::outjs(array('e' => 'Выберете получателя уведомления')); - $sql->query('INSERT INTO `notice` set ' - .'`unit`="'.$aData['unit'].'",' - .'`server`="'.$aData['server'].'",' - .'`text`="'.htmlspecialchars($aData['text']).'",' - .'`color`="'.$aData['color'].'",' - .'`time`="'.$aData['time'].'"'); - - sys::outjs(array('s' => 'ok')); - } + $sql->query('INSERT INTO `notice` set ' + .'`unit`="'.$aData['unit'].'",' + .'`server`="'.$aData['server'].'",' + .'`text`="'.htmlspecialchars($aData['text']).'",' + .'`color`="'.$aData['color'].'",' + .'`time`="'.$aData['time'].'"'); + + sys::outjs(array('s' => 'ok')); + } - $units = ''; + $units = ''; - $sql->query('SELECT `id`, `name` FROM `units` ORDER BY `id` ASC'); - while($unit = $sql->get()) - $units .= ''; + $sql->query('SELECT `id`, `name` FROM `units` ORDER BY `id` ASC'); + while($unit = $sql->get()) + $units .= ''; - $html->get('add', 'sections/notice'); + $html->get('add', 'sections/notice'); - $html->set('units', $units); + $html->set('units', $units); - $html->pack('main'); + $html->pack('main'); ?> \ No newline at end of file diff --git a/system/acp/sections/notice/delete.php b/system/acp/sections/notice/delete.php index 0ebbeb6..19976d6 100644 --- a/system/acp/sections/notice/delete.php +++ b/system/acp/sections/notice/delete.php @@ -1,8 +1,8 @@ query('DELETE FROM `notice` WHERE `id`="'.$id.'" LIMIT 1'); + $sql->query('DELETE FROM `notice` WHERE `id`="'.$id.'" LIMIT 1'); - sys::outjs(array('s' => 'ok')); + sys::outjs(array('s' => 'ok')); ?> \ No newline at end of file diff --git a/system/acp/sections/notice/end.php b/system/acp/sections/notice/end.php index 21a1da2..7e715bc 100644 --- a/system/acp/sections/notice/end.php +++ b/system/acp/sections/notice/end.php @@ -1,52 +1,52 @@ query('SELECT `id` FROM `notice`'); + $sql->query('SELECT `id` FROM `notice`'); - $aPage = sys::page($page, $sql->num(), 20); + $aPage = sys::page($page, $sql->num(), 20); - sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/notice'); + sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/notice'); - $notices = $sql->query('SELECT `id`, `unit`, `server`, `text`, `time` FROM `notice` WHERE `time`<"'.$start_point.'" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); - while($notice = $sql->get($notices)) - { - if($notice['unit']) - { - $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$notice['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $notices = $sql->query('SELECT `id`, `unit`, `server`, `text`, `time` FROM `notice` WHERE `time`<"'.$start_point.'" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); + while($notice = $sql->get($notices)) + { + if($notice['unit']) + { + $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$notice['unit'].'" LIMIT 1'); + $unit = $sql->get(); - $name = $unit['name']; - }else - $name = 'SERVER_'.$notice['server'].''; + $name = $unit['name']; + }else + $name = 'SERVER_'.$notice['server'].''; - $list .= ''; - $list .= ''.$notice['id'].''; - $list .= 'Адресовано: '.$name.''; - $list .= 'Завершен: '.date('d.m.Y - H:i:s', $notice['time']).''; - $list .= 'Редактировать'; - $list .= 'Удалить'; - $list .= ''; + $list .= ''; + $list .= ''.$notice['id'].''; + $list .= 'Адресовано: '.$name.''; + $list .= 'Завершен: '.date('d.m.Y - H:i:s', $notice['time']).''; + $list .= 'Редактировать'; + $list .= 'Удалить'; + $list .= ''; - $list .= ''; - $list .= ''.$notice['text'].''; - $list .= ''; - } + $list .= ''; + $list .= ''.$notice['text'].''; + $list .= ''; + } - $html->get('index', 'sections/notice'); + $html->get('index', 'sections/notice'); - $html->set('list', $list); + $html->set('list', $list); - $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); + $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); - $html->pack('main'); - } + $html->pack('main'); + } ?> \ No newline at end of file diff --git a/system/acp/sections/notice/index.php b/system/acp/sections/notice/index.php index eadb806..e097611 100644 --- a/system/acp/sections/notice/index.php +++ b/system/acp/sections/notice/index.php @@ -1,52 +1,52 @@ query('SELECT `id` FROM `notice`'); + $sql->query('SELECT `id` FROM `notice`'); - $aPage = sys::page($page, $sql->num(), 20); + $aPage = sys::page($page, $sql->num(), 20); - sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/notice'); + sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/notice'); - $notices = $sql->query('SELECT `id`, `unit`, `server`, `text`, `time` FROM `notice` WHERE `time`>"'.$start_point.'" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); - while($notice = $sql->get($notices)) - { - if($notice['unit']) - { - $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$notice['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $notices = $sql->query('SELECT `id`, `unit`, `server`, `text`, `time` FROM `notice` WHERE `time`>"'.$start_point.'" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); + while($notice = $sql->get($notices)) + { + if($notice['unit']) + { + $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$notice['unit'].'" LIMIT 1'); + $unit = $sql->get(); - $name = $unit['name']; - }else - $name = 'SERVER_'.$notice['server'].''; + $name = $unit['name']; + }else + $name = 'SERVER_'.$notice['server'].''; - $list .= ''; - $list .= ''.$notice['id'].''; - $list .= 'Адресовано: '.$name.''; - $list .= 'Завершится: '.date('d.m.Y - H:i:s', $notice['time']).''; - $list .= 'Редактировать'; - $list .= 'Удалить'; - $list .= ''; + $list .= ''; + $list .= ''.$notice['id'].''; + $list .= 'Адресовано: '.$name.''; + $list .= 'Завершится: '.date('d.m.Y - H:i:s', $notice['time']).''; + $list .= 'Редактировать'; + $list .= 'Удалить'; + $list .= ''; - $list .= ''; - $list .= ''.$notice['text'].''; - $list .= ''; - } + $list .= ''; + $list .= ''.$notice['text'].''; + $list .= ''; + } - $html->get('index', 'sections/notice'); + $html->get('index', 'sections/notice'); - $html->set('list', $list); + $html->set('list', $list); - $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); + $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); - $html->pack('main'); - } + $html->pack('main'); + } ?> \ No newline at end of file diff --git a/system/acp/sections/notice/notice.php b/system/acp/sections/notice/notice.php index ccecf70..fae3f81 100644 --- a/system/acp/sections/notice/notice.php +++ b/system/acp/sections/notice/notice.php @@ -1,79 +1,79 @@ query('SELECT * FROM `notice` WHERE `id`="'.$id.'" LIMIT 1'); - $notice = $sql->get(); + $sql->query('SELECT * FROM `notice` WHERE `id`="'.$id.'" LIMIT 1'); + $notice = $sql->get(); - if($go) - { - $aData = array(); + if($go) + { + $aData = array(); - $aData['text'] = isset($_POST['text']) ? trim($_POST['text']) : htmlspecialchars_decode($notice['text']); - $aData['color'] = isset($_POST['color']) ? trim($_POST['color']) : $notice['color']; - $aData['type'] = isset($_POST['type']) ? trim($_POST['type']) : $notice['type']; - $aData['unit'] = isset($_POST['unit']) ? sys::int($_POST['unit']) : $notice['unit']; - $aData['server'] = isset($_POST['server']) ? sys::int($_POST['server']) : $notice['server']; - $aData['time'] = isset($_POST['time']) ? trim($_POST['time']) : ''; + $aData['text'] = isset($_POST['text']) ? trim($_POST['text']) : htmlspecialchars_decode($notice['text']); + $aData['color'] = isset($_POST['color']) ? trim($_POST['color']) : $notice['color']; + $aData['type'] = isset($_POST['type']) ? trim($_POST['type']) : $notice['type']; + $aData['unit'] = isset($_POST['unit']) ? sys::int($_POST['unit']) : $notice['unit']; + $aData['server'] = isset($_POST['server']) ? sys::int($_POST['server']) : $notice['server']; + $aData['time'] = isset($_POST['time']) ? trim($_POST['time']) : ''; - $aData['time'] = sys::checkdate($aData['time']); + $aData['time'] = sys::checkdate($aData['time']); - if($aData['type'] == 'unit') - { - $sql->query('SELECT `id` FROM `units` WHERE `id`="'.$aData['unit'].'" LIMIT 1'); - if(!$sql->num()) - sys::outjs(array('e' => 'Указанная локация не найдена')); + if($aData['type'] == 'unit') + { + $sql->query('SELECT `id` FROM `units` WHERE `id`="'.$aData['unit'].'" LIMIT 1'); + if(!$sql->num()) + sys::outjs(array('e' => 'Указанная локация не найдена')); - $aData['server'] = 0; - }elseif($aData['type'] == 'server'){ - $sql->query('SELECT `id` FROM `servers` WHERE `id`="'.$aData['server'].'" LIMIT 1'); - if(!$sql->num()) - sys::outjs(array('e' => 'Указанный сервер не найден')); + $aData['server'] = 0; + }elseif($aData['type'] == 'server'){ + $sql->query('SELECT `id` FROM `servers` WHERE `id`="'.$aData['server'].'" LIMIT 1'); + if(!$sql->num()) + sys::outjs(array('e' => 'Указанный сервер не найден')); - $aData['unit'] = 0; - }else - sys::outjs(array('e' => 'Выберете получателя уведомления')); + $aData['unit'] = 0; + }else + sys::outjs(array('e' => 'Выберете получателя уведомления')); - $sql->query('UPDATE `notice` set ' - .'`unit`="'.$aData['unit'].'",' - .'`server`="'.$aData['server'].'",' - .'`text`="'.htmlspecialchars($aData['text']).'",' - .'`color`="'.$aData['color'].'",' - .'`time`="'.$aData['time'].'" WHERE `id`="'.$id.'" LIMIT 1'); - - sys::outjs(array('s' => 'ok')); - } + $sql->query('UPDATE `notice` set ' + .'`unit`="'.$aData['unit'].'",' + .'`server`="'.$aData['server'].'",' + .'`text`="'.htmlspecialchars($aData['text']).'",' + .'`color`="'.$aData['color'].'",' + .'`time`="'.$aData['time'].'" WHERE `id`="'.$id.'" LIMIT 1'); + + sys::outjs(array('s' => 'ok')); + } - $units = ''; + $units = ''; - $sql->query('SELECT `id`, `name` FROM `units` ORDER BY `id` ASC'); - while($unit = $sql->get()) - $units .= ''; + $sql->query('SELECT `id`, `name` FROM `units` ORDER BY `id` ASC'); + while($unit = $sql->get()) + $units .= ''; - $html->get('notice', 'sections/notice'); + $html->get('notice', 'sections/notice'); - $html->set('id', $notice['id']); - $html->set('text', htmlspecialchars_decode($notice['text'])); - $html->set('time', date('d/m/Y H:i', $notice['time'])); + $html->set('id', $notice['id']); + $html->set('text', htmlspecialchars_decode($notice['text'])); + $html->set('time', date('d/m/Y H:i', $notice['time'])); - if($notice['unit']) - { - $html->set('type', ''); - $html->set('units', str_replace('"'.$notice['unit'].'"', '"'.$notice['unit'].'" selected', $units)); - $html->set('server', ''); + if($notice['unit']) + { + $html->set('type', ''); + $html->set('units', str_replace('"'.$notice['unit'].'"', '"'.$notice['unit'].'" selected', $units)); + $html->set('server', ''); - $html->unit('unit'); - $html->unit('server', true); - }else{ - $html->set('type', ''); - $html->set('units', $units); - $html->set('server', $notice['server']); + $html->unit('unit'); + $html->unit('server', true); + }else{ + $html->set('type', ''); + $html->set('units', $units); + $html->set('server', $notice['server']); - $html->unit('unit', true); - $html->unit('server'); - } + $html->unit('unit', true); + $html->unit('server'); + } - $html->set('colors', str_replace('"'.$notice['color'].'"', '"'.$notice['color'].'" selected', '')); + $html->set('colors', str_replace('"'.$notice['color'].'"', '"'.$notice['color'].'" selected', '')); - $html->pack('main'); + $html->pack('main'); ?> \ No newline at end of file diff --git a/system/acp/sections/notice/search.php b/system/acp/sections/notice/search.php index afed208..c4794e9 100644 --- a/system/acp/sections/notice/search.php +++ b/system/acp/sections/notice/search.php @@ -1,75 +1,75 @@ get($mkey); + $cache = $mcache->get($mkey); - if(is_array($cache)) - { - if($go) - sys::outjs($cache, $nmch); + if(is_array($cache)) + { + if($go) + sys::outjs($cache, $nmch); - sys::outjs($cache); - } + sys::outjs($cache); + } - if(!isset($text{2})) - { - if($go) - sys::outjs(array('e' => 'Для выполнения поиска, необходимо больше данных'), $nmch); + if(!isset($text{2})) + { + if($go) + sys::outjs(array('e' => 'Для выполнения поиска, необходимо больше данных'), $nmch); - sys::outjs(array('e' => '')); - } + sys::outjs(array('e' => '')); + } - if($text{0} == 'i' AND $text{1} == 'd') - $notices = $sql->query('SELECT `id`, `unit`, `server`, `text`, `time` FROM `notice` WHERE `id`="'.sys::int($text).'" LIMIT 1'); - else{ - $like = '`id` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' - .'`unit` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' - .'`server` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' - .'`text` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\')'; + if($text{0} == 'i' AND $text{1} == 'd') + $notices = $sql->query('SELECT `id`, `unit`, `server`, `text`, `time` FROM `notice` WHERE `id`="'.sys::int($text).'" LIMIT 1'); + else{ + $like = '`id` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' + .'`unit` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' + .'`server` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' + .'`text` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\')'; - $notices = $sql->query('SELECT `id`, `unit`, `server`, `text`, `time` FROM `notice` WHERE '.$like.' ORDER BY `id` ASC LIMIT 20'); - } + $notices = $sql->query('SELECT `id`, `unit`, `server`, `text`, `time` FROM `notice` WHERE '.$like.' ORDER BY `id` ASC LIMIT 20'); + } - if(!$sql->num($notices)) - { - if($go) - sys::outjs(array('e' => 'По вашему запросу ничего не найдено'), $nmch); + if(!$sql->num($notices)) + { + if($go) + sys::outjs(array('e' => 'По вашему запросу ничего не найдено'), $nmch); - sys::outjs(array('e' => 'По вашему запросу ничего не найдено')); - } + sys::outjs(array('e' => 'По вашему запросу ничего не найдено')); + } - $list = ''; + $list = ''; - while($notice = $sql->get($notices)) - { - if($notice['unit']) - { - $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$notice['unit'].'" LIMIT 1'); - $unit = $sql->get(); + while($notice = $sql->get($notices)) + { + if($notice['unit']) + { + $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$notice['unit'].'" LIMIT 1'); + $unit = $sql->get(); - $name = $unit['name']; - }else - $name = 'SERVER_'.$notice['server'].''; + $name = $unit['name']; + }else + $name = 'SERVER_'.$notice['server'].''; - $list .= ''; - $list .= ''.$notice['id'].''; - $list .= 'Адресовано: '.$name.''; - $list .= 'Завершится: '.date('d.m.Y - H:i:s', $notice['time']).''; - $list .= 'Редактировать'; - $list .= 'Удалить'; - $list .= ''; + $list .= ''; + $list .= ''.$notice['id'].''; + $list .= 'Адресовано: '.$name.''; + $list .= 'Завершится: '.date('d.m.Y - H:i:s', $notice['time']).''; + $list .= 'Редактировать'; + $list .= 'Удалить'; + $list .= ''; - $list .= ''; - $list .= ''.$notice['text'].''; - $list .= ''; - } + $list .= ''; + $list .= ''.$notice['text'].''; + $list .= ''; + } - $mcache->set($mkey, array('s' => $list), false, 15); + $mcache->set($mkey, array('s' => $list), false, 15); - sys::outjs(array('s' => $list)); + sys::outjs(array('s' => $list)); ?> \ No newline at end of file diff --git a/system/acp/sections/pages/add.php b/system/acp/sections/pages/add.php index c610239..2eabb0b 100644 --- a/system/acp/sections/pages/add.php +++ b/system/acp/sections/pages/add.php @@ -1,31 +1,31 @@ 'Необходимо заполнить все поля')); + if(in_array('', $aData)) + sys::outjs(array('e' => 'Необходимо заполнить все поля')); - $name = md5(time().rand(5, 100).rand(10, 20).rand(1, 20).rand(40, 80)); + $name = md5(time().rand(5, 100).rand(10, 20).rand(1, 20).rand(40, 80)); - $file = fopen(FILES.'pages/'.$name, "w"); + $file = fopen(FILES.'pages/'.$name, "w"); - fputs($file, $aData['text']); + fputs($file, $aData['text']); - fclose($file); + fclose($file); - $sql->query('INSERT INTO `pages` set `name`="'.htmlspecialchars($aData['name']).'", `file`="'.$name.'"'); + $sql->query('INSERT INTO `pages` set `name`="'.htmlspecialchars($aData['name']).'", `file`="'.$name.'"'); - sys::outjs(array('s' => 'ok')); - } + sys::outjs(array('s' => 'ok')); + } - $html->get('add', 'sections/pages'); + $html->get('add', 'sections/pages'); - $html->pack('main'); + $html->pack('main'); ?> \ No newline at end of file diff --git a/system/acp/sections/pages/delete.php b/system/acp/sections/pages/delete.php index 1519c3d..a08b3a8 100644 --- a/system/acp/sections/pages/delete.php +++ b/system/acp/sections/pages/delete.php @@ -1,13 +1,13 @@ query('SELECT `file` FROM `pages` WHERE `id`="'.$id.'" LIMIT 1'); - $page = $sql->get(); + $sql->query('SELECT `file` FROM `pages` WHERE `id`="'.$id.'" LIMIT 1'); + $page = $sql->get(); - unlink(FILES.'pages/'.$page['file']); + unlink(FILES.'pages/'.$page['file']); - $sql->query('DELETE FROM `pages` WHERE `id`="'.$id.'" LIMIT 1'); + $sql->query('DELETE FROM `pages` WHERE `id`="'.$id.'" LIMIT 1'); - sys::outjs(array('s' => 'ok')); + sys::outjs(array('s' => 'ok')); ?> \ No newline at end of file diff --git a/system/acp/sections/pages/index.php b/system/acp/sections/pages/index.php index c914b7f..f10903d 100644 --- a/system/acp/sections/pages/index.php +++ b/system/acp/sections/pages/index.php @@ -1,36 +1,36 @@ query('SELECT `id` FROM `pages`'); + $sql->query('SELECT `id` FROM `pages`'); - $aPage = sys::page($page, $sql->num(), 20); + $aPage = sys::page($page, $sql->num(), 20); - sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/pages'); + sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/pages'); - $sql->query('SELECT * FROM `pages` ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); - while($page = $sql->get()) - { - $list .= ''; - $list .= ''.$page['id'].''; - $list .= ''.$page['name'].''; - $list .= ''.$page['file'].''; - $list .= 'Перейти'; - $list .= 'Удалить'; - $list .= ''; - } + $sql->query('SELECT * FROM `pages` ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); + while($page = $sql->get()) + { + $list .= ''; + $list .= ''.$page['id'].''; + $list .= ''.$page['name'].''; + $list .= ''.$page['file'].''; + $list .= 'Перейти'; + $list .= 'Удалить'; + $list .= ''; + } - $html->get('index', 'sections/pages'); + $html->get('index', 'sections/pages'); - $html->set('list', $list); + $html->set('list', $list); - $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); + $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); - $html->pack('main'); - } + $html->pack('main'); + } ?> \ No newline at end of file diff --git a/system/acp/sections/pages/page.php b/system/acp/sections/pages/page.php index 953fcb8..1ba2d06 100644 --- a/system/acp/sections/pages/page.php +++ b/system/acp/sections/pages/page.php @@ -1,37 +1,37 @@ query('SELECT `name`, `file` FROM `pages` WHERE `id`="'.$id.'" LIMIT 1'); - $page = $sql->get(); + $sql->query('SELECT `name`, `file` FROM `pages` WHERE `id`="'.$id.'" LIMIT 1'); + $page = $sql->get(); - if($go) - { - $aData = array(); + if($go) + { + $aData = array(); - $aData['name'] = isset($_POST['name']) ? trim($_POST['name']) : $page['name']; - $aData['text'] = isset($_POST['text']) ? trim($_POST['text']) : file_get_contents(FILES.'pages/'.$page['file']); + $aData['name'] = isset($_POST['name']) ? trim($_POST['name']) : $page['name']; + $aData['text'] = isset($_POST['text']) ? trim($_POST['text']) : file_get_contents(FILES.'pages/'.$page['file']); - if(in_array('', $aData)) - sys::outjs(array('e' => 'Необходимо заполнить все поля')); + if(in_array('', $aData)) + sys::outjs(array('e' => 'Необходимо заполнить все поля')); - $file = fopen(FILES.'pages/'.$page['file'], "w"); + $file = fopen(FILES.'pages/'.$page['file'], "w"); - fputs($file, $aData['text']); + fputs($file, $aData['text']); - fclose($file); + fclose($file); - $sql->query('UPDATE `pages` set `name`="'.htmlspecialchars($aData['name']).'" WHERE `id`="'.$id.'" LIMIT 1'); + $sql->query('UPDATE `pages` set `name`="'.htmlspecialchars($aData['name']).'" WHERE `id`="'.$id.'" LIMIT 1'); - sys::outjs(array('s' => 'ok')); - } + sys::outjs(array('s' => 'ok')); + } - $html->get('page', 'sections/pages'); - - $html->set('id', $id); - $html->set('name', htmlspecialchars_decode($page['name'])); + $html->get('page', 'sections/pages'); + + $html->set('id', $id); + $html->set('name', htmlspecialchars_decode($page['name'])); - $html->set('text', htmlspecialchars(file_get_contents(FILES.'pages/'.$page['file']))); + $html->set('text', htmlspecialchars(file_get_contents(FILES.'pages/'.$page['file']))); - $html->pack('main'); + $html->pack('main'); ?> \ No newline at end of file diff --git a/system/acp/sections/promo/add.php b/system/acp/sections/promo/add.php index 88357bd..6e89441 100644 --- a/system/acp/sections/promo/add.php +++ b/system/acp/sections/promo/add.php @@ -1,88 +1,88 @@ 'Неправильный формат промо-кода')); + if(sys::valid($aData['cod'], 'promo')) + sys::outjs(array('e' => 'Неправильный формат промо-кода')); - if($aData['user']) - { - $sql->query('SELECT `id` FROM `users` WHERE `id`="'.$aData['user'].'" LIMIT 1'); - if(!$sql->num()) - sys::outjs(array('e' => 'Указанный пользователь не найден')); - }else - $aData['user'] = 0; + if($aData['user']) + { + $sql->query('SELECT `id` FROM `users` WHERE `id`="'.$aData['user'].'" LIMIT 1'); + if(!$sql->num()) + sys::outjs(array('e' => 'Указанный пользователь не найден')); + }else + $aData['user'] = 0; - if($aData['server']) - { - $sql->query('SELECT `id` FROM `servers` WHERE `id`="'.$aData['server'].'" LIMIT 1'); - if(!$sql->num()) - sys::outjs(array('e' => 'Указанный сервер не найден')); - }else - $aData['server'] = 0; + if($aData['server']) + { + $sql->query('SELECT `id` FROM `servers` WHERE `id`="'.$aData['server'].'" LIMIT 1'); + if(!$sql->num()) + sys::outjs(array('e' => 'Указанный сервер не найден')); + }else + $aData['server'] = 0; - if(!is_array($aData['tarifs']) || !count($aData['tarifs'])) - sys::outjs(array('e' => 'Необходимо указать минимум один тариф')); + if(!is_array($aData['tarifs']) || !count($aData['tarifs'])) + sys::outjs(array('e' => 'Необходимо указать минимум один тариф')); - if($aData['discount']) - $proc = strpos($aData['value'], '%') ? '%' : ''; + if($aData['discount']) + $proc = strpos($aData['value'], '%') ? '%' : ''; - $aData['value'] = sys::int($aData['value']).$proc; + $aData['value'] = sys::int($aData['value']).$proc; - foreach($aData['tarifs'] as $id => $on) - { - $sql->query('SELECT `id` FROM `promo` WHERE `cod`="'.$aData['cod'].'" AND `tarif`="'.$id.'" LIMIT 1'); - if($sql->num()) - continue; + foreach($aData['tarifs'] as $id => $on) + { + $sql->query('SELECT `id` FROM `promo` WHERE `cod`="'.$aData['cod'].'" AND `tarif`="'.$id.'" LIMIT 1'); + if($sql->num()) + continue; - $sql->query('INSERT INTO `promo` set ' - .'`cod`="'.$aData['cod'].'",' - .'`value`="'.$aData['value'].'",' - .'`discount`="'.$aData['discount'].'",' - .'`data`="'.base64_encode('{'.$aData['data'].'}').'",' - .'`hits`="'.$aData['hits'].'",' - .'`use`="'.$aData['use'].'",' - .'`extend`="'.$aData['extend'].'",' - .'`tarif`="'.$id.'",' - .'`user`="'.$aData['user'].'",' - .'`server`="'.$aData['server'].'",' - .'`time`="'.$aData['time'].'"'); - } - - sys::outjs(array('s' => 'ok')); - } + $sql->query('INSERT INTO `promo` set ' + .'`cod`="'.$aData['cod'].'",' + .'`value`="'.$aData['value'].'",' + .'`discount`="'.$aData['discount'].'",' + .'`data`="'.base64_encode('{'.$aData['data'].'}').'",' + .'`hits`="'.$aData['hits'].'",' + .'`use`="'.$aData['use'].'",' + .'`extend`="'.$aData['extend'].'",' + .'`tarif`="'.$id.'",' + .'`user`="'.$aData['user'].'",' + .'`server`="'.$aData['server'].'",' + .'`time`="'.$aData['time'].'"'); + } + + sys::outjs(array('s' => 'ok')); + } - $tarifs = ''; + $tarifs = ''; - $units = $sql->query('SELECT `id`, `name` FROM `units` ORDER BY `id` ASC'); - while($unit = $sql->get($units)) - { - $sql->query('SELECT `id`, `name`, `game` FROM `tarifs` WHERE `unit`="'.$unit['id'].'" ORDER BY `id` ASC'); - while($tarif = $sql->get()) - $tarifs .= ''; - } + $units = $sql->query('SELECT `id`, `name` FROM `units` ORDER BY `id` ASC'); + while($unit = $sql->get($units)) + { + $sql->query('SELECT `id`, `name`, `game` FROM `tarifs` WHERE `unit`="'.$unit['id'].'" ORDER BY `id` ASC'); + while($tarif = $sql->get()) + $tarifs .= ''; + } - $html->get('add', 'sections/promo'); + $html->get('add', 'sections/promo'); - $html->set('tarifs', $tarifs); + $html->set('tarifs', $tarifs); - $html->pack('main'); + $html->pack('main'); ?> \ No newline at end of file diff --git a/system/acp/sections/promo/delete.php b/system/acp/sections/promo/delete.php index e6fdd8b..759e360 100644 --- a/system/acp/sections/promo/delete.php +++ b/system/acp/sections/promo/delete.php @@ -1,9 +1,9 @@ query('DELETE FROM `promo` WHERE `id`="'.$id.'" LIMIT 1'); - $sql->query('DELETE FROM `promo_use` WHERE `promo`="'.$id.'" LIMIT 1'); + $sql->query('DELETE FROM `promo` WHERE `id`="'.$id.'" LIMIT 1'); + $sql->query('DELETE FROM `promo_use` WHERE `promo`="'.$id.'" LIMIT 1'); - sys::outjs(array('s' => 'ok')); + sys::outjs(array('s' => 'ok')); ?> \ No newline at end of file diff --git a/system/acp/sections/promo/end.php b/system/acp/sections/promo/end.php index 5897704..15c57b7 100644 --- a/system/acp/sections/promo/end.php +++ b/system/acp/sections/promo/end.php @@ -1,46 +1,46 @@ query('SELECT `id` FROM `promo`'); + $sql->query('SELECT `id` FROM `promo`'); - $aPage = sys::page($page, $sql->num(), 20); + $aPage = sys::page($page, $sql->num(), 20); - sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/promo'); + sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/promo'); - $promos = $sql->query('SELECT `id`, `cod`, `value`, `discount`, `use`, `extend`, `tarif`, `time` FROM `promo` WHERE `time`<"'.$start_point.'"ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); - while($promo = $sql->get($promos)) - { - $sql->query('SELECT `name` FROM `tarifs` WHERE `id`="'.$promo['tarif'].'" LIMIT 1'); - $tarif = $sql->get(); + $promos = $sql->query('SELECT `id`, `cod`, `value`, `discount`, `use`, `extend`, `tarif`, `time` FROM `promo` WHERE `time`<"'.$start_point.'"ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); + while($promo = $sql->get($promos)) + { + $sql->query('SELECT `name` FROM `tarifs` WHERE `id`="'.$promo['tarif'].'" LIMIT 1'); + $tarif = $sql->get(); - $list .= ''; - $list .= ''.$promo['id'].''; - $list .= ''.$promo['cod'].''; - $list .= ''.$promo['value'].''; - $list .= '#'.$promo['tarif'].' '.$tarif['name'].''; - $list .= ''.($promo['discount'] ? 'Скидка' : 'Подарочные дни').''; - $list .= ''.($promo['extend'] ? 'Продление' : 'Аренда').''; - $list .= ''.$promo['use'].' шт.'; - $list .= 'Завершена'; - $list .= 'Удалить'; - $list .= ''; - } + $list .= ''; + $list .= ''.$promo['id'].''; + $list .= ''.$promo['cod'].''; + $list .= ''.$promo['value'].''; + $list .= '#'.$promo['tarif'].' '.$tarif['name'].''; + $list .= ''.($promo['discount'] ? 'Скидка' : 'Подарочные дни').''; + $list .= ''.($promo['extend'] ? 'Продление' : 'Аренда').''; + $list .= ''.$promo['use'].' шт.'; + $list .= 'Завершена'; + $list .= 'Удалить'; + $list .= ''; + } - $html->get('index', 'sections/promo'); + $html->get('index', 'sections/promo'); - $html->set('list', $list); + $html->set('list', $list); - $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); + $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); - $html->pack('main'); - } + $html->pack('main'); + } ?> \ No newline at end of file diff --git a/system/acp/sections/promo/index.php b/system/acp/sections/promo/index.php index 5acd8df..84a9342 100644 --- a/system/acp/sections/promo/index.php +++ b/system/acp/sections/promo/index.php @@ -1,46 +1,46 @@ query('SELECT `id` FROM `promo`'); + $sql->query('SELECT `id` FROM `promo`'); - $aPage = sys::page($page, $sql->num(), 20); + $aPage = sys::page($page, $sql->num(), 20); - sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/promo'); + sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/promo'); - $promos = $sql->query('SELECT `id`, `cod`, `value`, `discount`, `use`, `extend`, `tarif`, `time` FROM `promo` WHERE `time`>"'.$start_point.'" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); - while($promo = $sql->get($promos)) - { - $sql->query('SELECT `name` FROM `tarifs` WHERE `id`="'.$promo['tarif'].'" LIMIT 1'); - $tarif = $sql->get(); + $promos = $sql->query('SELECT `id`, `cod`, `value`, `discount`, `use`, `extend`, `tarif`, `time` FROM `promo` WHERE `time`>"'.$start_point.'" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); + while($promo = $sql->get($promos)) + { + $sql->query('SELECT `name` FROM `tarifs` WHERE `id`="'.$promo['tarif'].'" LIMIT 1'); + $tarif = $sql->get(); - $list .= ''; - $list .= ''.$promo['id'].''; - $list .= ''.$promo['cod'].''; - $list .= ''.$promo['value'].''; - $list .= '#'.$promo['tarif'].' '.$tarif['name'].''; - $list .= ''.($promo['discount'] ? 'Скидка' : 'Подарочные дни').''; - $list .= ''.($promo['extend'] ? 'Продление' : 'Аренда').''; - $list .= ''.$promo['use'].' шт.'; - $list .= ''.date('d.m.Y - H:i:s', $promo['time']).''; - $list .= 'Удалить'; - $list .= ''; - } + $list .= ''; + $list .= ''.$promo['id'].''; + $list .= ''.$promo['cod'].''; + $list .= ''.$promo['value'].''; + $list .= '#'.$promo['tarif'].' '.$tarif['name'].''; + $list .= ''.($promo['discount'] ? 'Скидка' : 'Подарочные дни').''; + $list .= ''.($promo['extend'] ? 'Продление' : 'Аренда').''; + $list .= ''.$promo['use'].' шт.'; + $list .= ''.date('d.m.Y - H:i:s', $promo['time']).''; + $list .= 'Удалить'; + $list .= ''; + } - $html->get('index', 'sections/promo'); + $html->get('index', 'sections/promo'); - $html->set('list', $list); + $html->set('list', $list); - $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); + $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); - $html->pack('main'); - } + $html->pack('main'); + } ?> \ No newline at end of file diff --git a/system/acp/sections/promo/promo.php b/system/acp/sections/promo/promo.php index 9c110aa..9555f72 100644 --- a/system/acp/sections/promo/promo.php +++ b/system/acp/sections/promo/promo.php @@ -1,92 +1,92 @@ query('SELECT * FROM `promo` WHERE `id`="'.$id.'" LIMIT 1'); - $promo = $sql->get(); + $sql->query('SELECT * FROM `promo` WHERE `id`="'.$id.'" LIMIT 1'); + $promo = $sql->get(); - if($go) - { - $aData = array(); + if($go) + { + $aData = array(); - $aData['cod'] = isset($_POST['cod']) ? trim($_POST['cod']) : $promo['cod']; - $aData['value'] = isset($_POST['value']) ? trim($_POST['value']) : $promo['value']; - $aData['discount'] = isset($_POST['discount']) ? sys::int($_POST['discount']) : $promo['discount']; - $aData['hits'] = isset($_POST['hits']) ? sys::int($_POST['hits']) : $promo['hits']; - $aData['use'] = isset($_POST['use']) ? sys::int($_POST['use']) : $promo['use']; - $aData['extend'] = isset($_POST['extend']) ? sys::int($_POST['extend']) : $promo['extend']; - $aData['user'] = isset($_POST['user']) ? sys::int($_POST['user']) : $promo['user']; - $aData['server'] = isset($_POST['server']) ? sys::int($_POST['server']) : $promo['server']; - $aData['time'] = isset($_POST['time']) ? trim($_POST['time']) : date('d/m/Y H:i', $promo['time']); - $aData['data'] = isset($_POST['data']) ? trim($_POST['data']) : $promo['data']; + $aData['cod'] = isset($_POST['cod']) ? trim($_POST['cod']) : $promo['cod']; + $aData['value'] = isset($_POST['value']) ? trim($_POST['value']) : $promo['value']; + $aData['discount'] = isset($_POST['discount']) ? sys::int($_POST['discount']) : $promo['discount']; + $aData['hits'] = isset($_POST['hits']) ? sys::int($_POST['hits']) : $promo['hits']; + $aData['use'] = isset($_POST['use']) ? sys::int($_POST['use']) : $promo['use']; + $aData['extend'] = isset($_POST['extend']) ? sys::int($_POST['extend']) : $promo['extend']; + $aData['user'] = isset($_POST['user']) ? sys::int($_POST['user']) : $promo['user']; + $aData['server'] = isset($_POST['server']) ? sys::int($_POST['server']) : $promo['server']; + $aData['time'] = isset($_POST['time']) ? trim($_POST['time']) : date('d/m/Y H:i', $promo['time']); + $aData['data'] = isset($_POST['data']) ? trim($_POST['data']) : $promo['data']; - $aData['time'] = sys::checkdate($aData['time']); + $aData['time'] = sys::checkdate($aData['time']); - if(sys::valid($aData['cod'], 'promo')) - sys::outjs(array('e' => 'Неправильный формат промо-кода')); + if(sys::valid($aData['cod'], 'promo')) + sys::outjs(array('e' => 'Неправильный формат промо-кода')); - $sql->query('SELECT `id` FROM `promo` WHERE `id`!="'.$id.'" AND `cod`="'.$aData['cod'].'" AND `tarif`="'.$promo['tarif'].'" LIMIT 1'); - if($sql->num()) - sys::outjs(array('e' => 'Указанный код используется в другой акции')); + $sql->query('SELECT `id` FROM `promo` WHERE `id`!="'.$id.'" AND `cod`="'.$aData['cod'].'" AND `tarif`="'.$promo['tarif'].'" LIMIT 1'); + if($sql->num()) + sys::outjs(array('e' => 'Указанный код используется в другой акции')); - if($aData['user']) - { - $sql->query('SELECT `id` FROM `users` WHERE `id`="'.$aData['user'].'" LIMIT 1'); - if(!$sql->num()) - sys::outjs(array('e' => 'Указанный пользователь не найден')); - }else - $aData['user'] = 0; + if($aData['user']) + { + $sql->query('SELECT `id` FROM `users` WHERE `id`="'.$aData['user'].'" LIMIT 1'); + if(!$sql->num()) + sys::outjs(array('e' => 'Указанный пользователь не найден')); + }else + $aData['user'] = 0; - if($aData['server']) - { - $sql->query('SELECT `id` FROM `servers` WHERE `id`="'.$aData['server'].'" LIMIT 1'); - if(!$sql->num()) - sys::outjs(array('e' => 'Указанный сервер не найден')); - }else - $aData['server'] = 0; + if($aData['server']) + { + $sql->query('SELECT `id` FROM `servers` WHERE `id`="'.$aData['server'].'" LIMIT 1'); + if(!$sql->num()) + sys::outjs(array('e' => 'Указанный сервер не найден')); + }else + $aData['server'] = 0; - if($aData['discount']) - $proc = strpos($aData['value'], '%') ? '%' : ''; + if($aData['discount']) + $proc = strpos($aData['value'], '%') ? '%' : ''; - $aData['value'] = sys::int($aData['value']).$proc; + $aData['value'] = sys::int($aData['value']).$proc; - $sql->query('UPDATE `promo` set ' - .'`cod`="'.$aData['cod'].'",' - .'`value`="'.$aData['value'].'",' - .'`discount`="'.$aData['discount'].'",' - .'`data`="'.base64_encode('{'.$aData['data'].'}').'",' - .'`hits`="'.$aData['hits'].'",' - .'`use`="'.$aData['use'].'",' - .'`extend`="'.$aData['extend'].'",' - .'`user`="'.$aData['user'].'",' - .'`server`="'.$aData['server'].'",' - .'`time`="'.$aData['time'].'" WHERE `id`="'.$id.'" LIMIT 1'); + $sql->query('UPDATE `promo` set ' + .'`cod`="'.$aData['cod'].'",' + .'`value`="'.$aData['value'].'",' + .'`discount`="'.$aData['discount'].'",' + .'`data`="'.base64_encode('{'.$aData['data'].'}').'",' + .'`hits`="'.$aData['hits'].'",' + .'`use`="'.$aData['use'].'",' + .'`extend`="'.$aData['extend'].'",' + .'`user`="'.$aData['user'].'",' + .'`server`="'.$aData['server'].'",' + .'`time`="'.$aData['time'].'" WHERE `id`="'.$id.'" LIMIT 1'); - sys::outjs(array('s' => 'ok')); - } + sys::outjs(array('s' => 'ok')); + } - $sql->query('SELECT `id`, `unit`, `name`, `game` FROM `tarifs` WHERE `id`="'.$promo['tarif'].'" LIMIT 1'); - $tarif = $sql->get(); + $sql->query('SELECT `id`, `unit`, `name`, `game` FROM `tarifs` WHERE `id`="'.$promo['tarif'].'" LIMIT 1'); + $tarif = $sql->get(); - $sql->query('SELECT `id`, `name` FROM `units` WHERE `id`="'.$tarif['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $sql->query('SELECT `id`, `name` FROM `units` WHERE `id`="'.$tarif['unit'].'" LIMIT 1'); + $unit = $sql->get(); - $html->get('promo', 'sections/promo'); + $html->get('promo', 'sections/promo'); - $html->set('id', $promo['id']); - $html->set('cod', $promo['cod']); - $html->set('value', $promo['value']); - $html->set('data', str_replace(array('{', '}'), '', base64_decode($promo['data']))); - $html->set('hits', $promo['hits']); - $html->set('use', $promo['use']); - $html->set('user', $promo['user']); - $html->set('server', $promo['server']); - $html->set('time', date('d/m/Y H:i', $promo['time'])); + $html->set('id', $promo['id']); + $html->set('cod', $promo['cod']); + $html->set('value', $promo['value']); + $html->set('data', str_replace(array('{', '}'), '', base64_decode($promo['data']))); + $html->set('hits', $promo['hits']); + $html->set('use', $promo['use']); + $html->set('user', $promo['user']); + $html->set('server', $promo['server']); + $html->set('time', date('d/m/Y H:i', $promo['time'])); - $html->set('discount', $promo['discount'] ? '' : ''); - $html->set('extend', $promo['extend'] ? '' : ''); + $html->set('discount', $promo['discount'] ? '' : ''); + $html->set('extend', $promo['extend'] ? '' : ''); - $html->set('tarif', $unit['name'].' / #'.$tarif['id'].' '.$tarif['name'].' ('.strtoupper($tarif['game']).')'); + $html->set('tarif', $unit['name'].' / #'.$tarif['id'].' '.$tarif['name'].' ('.strtoupper($tarif['game']).')'); - $html->pack('main'); + $html->pack('main'); ?> \ No newline at end of file diff --git a/system/acp/sections/promo/search.php b/system/acp/sections/promo/search.php index ccb5884..98c0a24 100644 --- a/system/acp/sections/promo/search.php +++ b/system/acp/sections/promo/search.php @@ -1,68 +1,68 @@ get($mkey); + $cache = $mcache->get($mkey); - if(is_array($cache)) - { - if($go) - sys::outjs($cache, $nmch); + if(is_array($cache)) + { + if($go) + sys::outjs($cache, $nmch); - sys::outjs($cache); - } + sys::outjs($cache); + } - if(!isset($text{2})) - { - if($go) - sys::outjs(array('e' => 'Для выполнения поиска, необходимо больше данных'), $nmch); + if(!isset($text{2})) + { + if($go) + sys::outjs(array('e' => 'Для выполнения поиска, необходимо больше данных'), $nmch); - sys::outjs(array('e' => '')); - } + sys::outjs(array('e' => '')); + } - if($text{0} == 'i' AND $text{1} == 'd') - $promos = $sql->query('SELECT `id`, `cod`, `value`, `discount`, `use`, `extend`, `tarif`, `time` FROM `promo` WHERE `id`="'.sys::int($text).'" LIMIT 1'); - else{ - $like = '`id` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' - .'`cod` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' - .'`value` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\')'; + if($text{0} == 'i' AND $text{1} == 'd') + $promos = $sql->query('SELECT `id`, `cod`, `value`, `discount`, `use`, `extend`, `tarif`, `time` FROM `promo` WHERE `id`="'.sys::int($text).'" LIMIT 1'); + else{ + $like = '`id` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' + .'`cod` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' + .'`value` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\')'; - $promos = $sql->query('SELECT `id`, `cod`, `value`, `discount`, `use`, `extend`, `tarif`, `time` FROM `promo` WHERE '.$like.' ORDER BY `id` ASC LIMIT 20'); - } + $promos = $sql->query('SELECT `id`, `cod`, `value`, `discount`, `use`, `extend`, `tarif`, `time` FROM `promo` WHERE '.$like.' ORDER BY `id` ASC LIMIT 20'); + } - if(!$sql->num($promos)) - { - if($go) - sys::outjs(array('e' => 'По вашему запросу ничего не найдено'), $nmch); + if(!$sql->num($promos)) + { + if($go) + sys::outjs(array('e' => 'По вашему запросу ничего не найдено'), $nmch); - sys::outjs(array('e' => 'По вашему запросу ничего не найдено')); - } + sys::outjs(array('e' => 'По вашему запросу ничего не найдено')); + } - $list = ''; + $list = ''; - while($promo = $sql->get($promos)) - { - $sql->query('SELECT `name` FROM `tarifs` WHERE `id`="'.$promo['tarif'].'" LIMIT 1'); - $tarif = $sql->get(); + while($promo = $sql->get($promos)) + { + $sql->query('SELECT `name` FROM `tarifs` WHERE `id`="'.$promo['tarif'].'" LIMIT 1'); + $tarif = $sql->get(); - $list .= ''; - $list .= ''.$promo['id'].''; - $list .= ''.$promo['cod'].''; - $list .= ''.$promo['value'].''; - $list .= '#'.$promo['tarif'].' '.$tarif['name'].''; - $list .= ''.($promo['discount'] ? 'Скидка' : 'Подарочные дни').''; - $list .= ''.($promo['extend'] ? 'Продление' : 'Аренда').''; - $list .= ''.$promo['use'].' шт.'; - $list .= ''.date('d.m.Y - H:i:s', $promo['time']).''; - $list .= 'Удалить'; - $list .= ''; - } + $list .= ''; + $list .= ''.$promo['id'].''; + $list .= ''.$promo['cod'].''; + $list .= ''.$promo['value'].''; + $list .= '#'.$promo['tarif'].' '.$tarif['name'].''; + $list .= ''.($promo['discount'] ? 'Скидка' : 'Подарочные дни').''; + $list .= ''.($promo['extend'] ? 'Продление' : 'Аренда').''; + $list .= ''.$promo['use'].' шт.'; + $list .= ''.date('d.m.Y - H:i:s', $promo['time']).''; + $list .= 'Удалить'; + $list .= ''; + } - $mcache->set($mkey, array('s' => $list), false, 15); + $mcache->set($mkey, array('s' => $list), false, 15); - sys::outjs(array('s' => $list)); + sys::outjs(array('s' => $list)); ?> \ No newline at end of file diff --git a/system/acp/sections/promo/stats.php b/system/acp/sections/promo/stats.php index 4502c00..a0d22c1 100644 --- a/system/acp/sections/promo/stats.php +++ b/system/acp/sections/promo/stats.php @@ -1,38 +1,38 @@ query('DELETE FROM `promo_use` WHERE `id`="'.sys::int($url['delete']).'" LIMIT 1'); + if(isset($url['delete'])) + { + $sql->query('DELETE FROM `promo_use` WHERE `id`="'.sys::int($url['delete']).'" LIMIT 1'); - sys::outjs(array('s' => 'ok')); - } + sys::outjs(array('s' => 'ok')); + } - $list = ''; + $list = ''; - $all_use = $sql->query('SELECT * FROM `promo_use` ORDER BY `id` ASC LIMIT 100'); - while($promo_use = $sql->get($all_use)) - { - $sql->query('SELECT `text` FROM `logs` WHERE `user`="'.$promo_use['user'].'" AND `date`="'.$promo_use['time'].'" LIMIT 1'); - $log = $sql->get(); + $all_use = $sql->query('SELECT * FROM `promo_use` ORDER BY `id` ASC LIMIT 100'); + while($promo_use = $sql->get($all_use)) + { + $sql->query('SELECT `text` FROM `logs` WHERE `user`="'.$promo_use['user'].'" AND `date`="'.$promo_use['time'].'" LIMIT 1'); + $log = $sql->get(); - $sql->query('SELECT `cod` FROM `promo` WHERE `id`="'.$promo_use['promo'].'" LIMIT 1'); - $promo = $sql->get(); + $sql->query('SELECT `cod` FROM `promo` WHERE `id`="'.$promo_use['promo'].'" LIMIT 1'); + $promo = $sql->get(); - $list .= ''; - $list .= ''.$promo_use['id'].''; - $list .= ''.$promo['cod'].''; - $list .= 'USER_'.$promo_use['user'].''; - $list .= ''.$log['text'].''; - $list .= ''.sys::today($promo_use['time']).''; - $list .= 'Удалить'; - $list .= ''; - } + $list .= ''; + $list .= ''.$promo_use['id'].''; + $list .= ''.$promo['cod'].''; + $list .= 'USER_'.$promo_use['user'].''; + $list .= ''.$log['text'].''; + $list .= ''.sys::today($promo_use['time']).''; + $list .= 'Удалить'; + $list .= ''; + } - $html->get('stats', 'sections/promo'); + $html->get('stats', 'sections/promo'); - $html->set('list', $list); + $html->set('list', $list); - $html->pack('main'); + $html->pack('main'); ?> \ No newline at end of file diff --git a/system/acp/sections/servers/crmp.php b/system/acp/sections/servers/crmp.php index b6b1997..b4b559d 100644 --- a/system/acp/sections/servers/crmp.php +++ b/system/acp/sections/servers/crmp.php @@ -1,77 +1,77 @@ 'Работает', - 'off' => 'Выключен', - 'start' => 'Запускается', - 'restart' => 'Перезапускается', - 'change' => 'Смена карты', - 'install' => 'Устанавливается', - 'reinstall' => 'Переустанавливается', - 'update' => 'Обновляется', - 'recovery' => 'Восстанавливается', - 'overdue' => 'Просрочен', - 'blocked' => 'Заблокирован' - ); + $status = array( + 'working' => 'Работает', + 'off' => 'Выключен', + 'start' => 'Запускается', + 'restart' => 'Перезапускается', + 'change' => 'Смена карты', + 'install' => 'Устанавливается', + 'reinstall' => 'Переустанавливается', + 'update' => 'Обновляется', + 'recovery' => 'Восстанавливается', + 'overdue' => 'Просрочен', + 'blocked' => 'Заблокирован' + ); - $select = 'WHERE `user`!="-1"'; - $url_search = ''; + $select = 'WHERE `user`!="-1"'; + $url_search = ''; - if(isset($url['search']) AND in_array($url['search'], array('unit', 'tarif'))) - { - $select = 'WHERE `'.$url['search'].'`="'.sys::int($url[$url['search']]).'" AND `user`!="-1"'; - $url_search = '/search/'.$url['search'].'/'.$url['search'].'/'.$url[$url['search']]; - } + if(isset($url['search']) AND in_array($url['search'], array('unit', 'tarif'))) + { + $select = 'WHERE `'.$url['search'].'`="'.sys::int($url[$url['search']]).'" AND `user`!="-1"'; + $url_search = '/search/'.$url['search'].'/'.$url['search'].'/'.$url[$url['search']]; + } - $sql->query('SELECT `id` FROM `servers` '.$select.' AND `game`="crmp"'); + $sql->query('SELECT `id` FROM `servers` '.$select.' AND `game`="crmp"'); - $aPage = sys::page($page, $sql->num(), 20); + $aPage = sys::page($page, $sql->num(), 20); - sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/servers/section/crmp'.$url_search); + sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/servers/section/crmp'.$url_search); - $servers = $sql->query('SELECT `id`, `unit`, `tarif`, `user`, `address`, `game`, `status`, `slots`, `name`, `time` FROM `servers` '.$select.' AND `game`="crmp" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); - while($server = $sql->get($servers)) - { - $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $servers = $sql->query('SELECT `id`, `unit`, `tarif`, `user`, `address`, `game`, `status`, `slots`, `name`, `time` FROM `servers` '.$select.' AND `game`="crmp" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); + while($server = $sql->get($servers)) + { + $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); - $sql->query('SELECT `name` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); - $tarif = $sql->get(); + $sql->query('SELECT `name` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); + $tarif = $sql->get(); - $list .= ''; - $list .= ''.$server['id'].''; - $list .= ''.$server['name'].''; - $list .= '#'.$server['unit'].' '.$unit['name'].''; - $list .= ''.$server['slots'].' шт.'; - $list .= ''.strtoupper($server['game']).''; - $list .= 'Перейти'; - $list .= ''; + $list .= ''; + $list .= ''.$server['id'].''; + $list .= ''.$server['name'].''; + $list .= '#'.$server['unit'].' '.$unit['name'].''; + $list .= ''.$server['slots'].' шт.'; + $list .= ''.strtoupper($server['game']).''; + $list .= 'Перейти'; + $list .= ''; - $list .= ''; - $list .= 'USER_'.$server['user'].''; - $list .= ''.$server['address'].''; - $list .= '#'.$server['tarif'].' '.$tarif['name'].''; - $list .= ''.$status[$server['status']].''; - $list .= ''.date('d.m.Y - H:i:s', $server['time']).''; - $list .= 'Удалить'; - $list .= ''; - } + $list .= ''; + $list .= 'USER_'.$server['user'].''; + $list .= ''.$server['address'].''; + $list .= '#'.$server['tarif'].' '.$tarif['name'].''; + $list .= ''.$status[$server['status']].''; + $list .= ''.date('d.m.Y - H:i:s', $server['time']).''; + $list .= 'Удалить'; + $list .= ''; + } - $html->get('index', 'sections/servers'); + $html->get('index', 'sections/servers'); - $html->set('list', $list); + $html->set('list', $list); - $html->set('url_search', $url_search); + $html->set('url_search', $url_search); - $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); + $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); - $html->pack('main'); - } + $html->pack('main'); + } ?> \ No newline at end of file diff --git a/system/acp/sections/servers/cs.php b/system/acp/sections/servers/cs.php index a14b882..1ef8476 100644 --- a/system/acp/sections/servers/cs.php +++ b/system/acp/sections/servers/cs.php @@ -1,77 +1,77 @@ 'Работает', - 'off' => 'Выключен', - 'start' => 'Запускается', - 'restart' => 'Перезапускается', - 'change' => 'Смена карты', - 'install' => 'Устанавливается', - 'reinstall' => 'Переустанавливается', - 'update' => 'Обновляется', - 'recovery' => 'Восстанавливается', - 'overdue' => 'Просрочен', - 'blocked' => 'Заблокирован' - ); + $status = array( + 'working' => 'Работает', + 'off' => 'Выключен', + 'start' => 'Запускается', + 'restart' => 'Перезапускается', + 'change' => 'Смена карты', + 'install' => 'Устанавливается', + 'reinstall' => 'Переустанавливается', + 'update' => 'Обновляется', + 'recovery' => 'Восстанавливается', + 'overdue' => 'Просрочен', + 'blocked' => 'Заблокирован' + ); - $select = 'WHERE `user`!="-1"'; - $url_search = ''; + $select = 'WHERE `user`!="-1"'; + $url_search = ''; - if(isset($url['search']) AND in_array($url['search'], array('unit', 'tarif'))) - { - $select = 'WHERE `'.$url['search'].'`="'.sys::int($url[$url['search']]).'" AND `user`!="-1"'; - $url_search = '/search/'.$url['search'].'/'.$url['search'].'/'.$url[$url['search']]; - } + if(isset($url['search']) AND in_array($url['search'], array('unit', 'tarif'))) + { + $select = 'WHERE `'.$url['search'].'`="'.sys::int($url[$url['search']]).'" AND `user`!="-1"'; + $url_search = '/search/'.$url['search'].'/'.$url['search'].'/'.$url[$url['search']]; + } - $sql->query('SELECT `id` FROM `servers` '.$select.' AND `game`="cs"'); + $sql->query('SELECT `id` FROM `servers` '.$select.' AND `game`="cs"'); - $aPage = sys::page($page, $sql->num(), 20); + $aPage = sys::page($page, $sql->num(), 20); - sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/servers/section/cs'.$url_search); + sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/servers/section/cs'.$url_search); - $servers = $sql->query('SELECT `id`, `unit`, `tarif`, `user`, `address`, `game`, `status`, `slots`, `name`, `time` FROM `servers` '.$select.' AND `game`="cs" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); - while($server = $sql->get($servers)) - { - $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $servers = $sql->query('SELECT `id`, `unit`, `tarif`, `user`, `address`, `game`, `status`, `slots`, `name`, `time` FROM `servers` '.$select.' AND `game`="cs" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); + while($server = $sql->get($servers)) + { + $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); - $sql->query('SELECT `name` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); - $tarif = $sql->get(); + $sql->query('SELECT `name` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); + $tarif = $sql->get(); - $list .= ''; - $list .= ''.$server['id'].''; - $list .= ''.$server['name'].''; - $list .= '#'.$server['unit'].' '.$unit['name'].''; - $list .= ''.$server['slots'].' шт.'; - $list .= ''.strtoupper($server['game']).''; - $list .= 'Перейти'; - $list .= ''; + $list .= ''; + $list .= ''.$server['id'].''; + $list .= ''.$server['name'].''; + $list .= '#'.$server['unit'].' '.$unit['name'].''; + $list .= ''.$server['slots'].' шт.'; + $list .= ''.strtoupper($server['game']).''; + $list .= 'Перейти'; + $list .= ''; - $list .= ''; - $list .= 'USER_'.$server['user'].''; - $list .= ''.$server['address'].''; - $list .= '#'.$server['tarif'].' '.$tarif['name'].''; - $list .= ''.$status[$server['status']].''; - $list .= ''.date('d.m.Y - H:i:s', $server['time']).''; - $list .= 'Удалить'; - $list .= ''; - } + $list .= ''; + $list .= 'USER_'.$server['user'].''; + $list .= ''.$server['address'].''; + $list .= '#'.$server['tarif'].' '.$tarif['name'].''; + $list .= ''.$status[$server['status']].''; + $list .= ''.date('d.m.Y - H:i:s', $server['time']).''; + $list .= 'Удалить'; + $list .= ''; + } - $html->get('index', 'sections/servers'); + $html->get('index', 'sections/servers'); - $html->set('list', $list); + $html->set('list', $list); - $html->set('url_search', $url_search); + $html->set('url_search', $url_search); - $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); + $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); - $html->pack('main'); - } + $html->pack('main'); + } ?> \ No newline at end of file diff --git a/system/acp/sections/servers/csgo.php b/system/acp/sections/servers/csgo.php index f56ff6e..d0c1a2b 100644 --- a/system/acp/sections/servers/csgo.php +++ b/system/acp/sections/servers/csgo.php @@ -1,77 +1,77 @@ 'Работает', - 'off' => 'Выключен', - 'start' => 'Запускается', - 'restart' => 'Перезапускается', - 'change' => 'Смена карты', - 'install' => 'Устанавливается', - 'reinstall' => 'Переустанавливается', - 'update' => 'Обновляется', - 'recovery' => 'Восстанавливается', - 'overdue' => 'Просрочен', - 'blocked' => 'Заблокирован' - ); + $status = array( + 'working' => 'Работает', + 'off' => 'Выключен', + 'start' => 'Запускается', + 'restart' => 'Перезапускается', + 'change' => 'Смена карты', + 'install' => 'Устанавливается', + 'reinstall' => 'Переустанавливается', + 'update' => 'Обновляется', + 'recovery' => 'Восстанавливается', + 'overdue' => 'Просрочен', + 'blocked' => 'Заблокирован' + ); - $select = 'WHERE `user`!="-1"'; - $url_search = ''; + $select = 'WHERE `user`!="-1"'; + $url_search = ''; - if(isset($url['search']) AND in_array($url['search'], array('unit', 'tarif'))) - { - $select = 'WHERE `'.$url['search'].'`="'.sys::int($url[$url['search']]).'" AND `user`!="-1"'; - $url_search = '/search/'.$url['search'].'/'.$url['search'].'/'.$url[$url['search']]; - } + if(isset($url['search']) AND in_array($url['search'], array('unit', 'tarif'))) + { + $select = 'WHERE `'.$url['search'].'`="'.sys::int($url[$url['search']]).'" AND `user`!="-1"'; + $url_search = '/search/'.$url['search'].'/'.$url['search'].'/'.$url[$url['search']]; + } - $sql->query('SELECT `id` FROM `servers` '.$select.' AND `game`="csgo"'); + $sql->query('SELECT `id` FROM `servers` '.$select.' AND `game`="csgo"'); - $aPage = sys::page($page, $sql->num(), 20); + $aPage = sys::page($page, $sql->num(), 20); - sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/servers/section/csgo'.$url_search); + sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/servers/section/csgo'.$url_search); - $servers = $sql->query('SELECT `id`, `unit`, `tarif`, `user`, `address`, `game`, `status`, `slots`, `name`, `time` FROM `servers` '.$select.' AND `game`="csgo" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); - while($server = $sql->get($servers)) - { - $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $servers = $sql->query('SELECT `id`, `unit`, `tarif`, `user`, `address`, `game`, `status`, `slots`, `name`, `time` FROM `servers` '.$select.' AND `game`="csgo" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); + while($server = $sql->get($servers)) + { + $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); - $sql->query('SELECT `name` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); - $tarif = $sql->get(); + $sql->query('SELECT `name` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); + $tarif = $sql->get(); - $list .= ''; - $list .= ''.$server['id'].''; - $list .= ''.$server['name'].''; - $list .= '#'.$server['unit'].' '.$unit['name'].''; - $list .= ''.$server['slots'].' шт.'; - $list .= ''.strtoupper($server['game']).''; - $list .= 'Перейти'; - $list .= ''; + $list .= ''; + $list .= ''.$server['id'].''; + $list .= ''.$server['name'].''; + $list .= '#'.$server['unit'].' '.$unit['name'].''; + $list .= ''.$server['slots'].' шт.'; + $list .= ''.strtoupper($server['game']).''; + $list .= 'Перейти'; + $list .= ''; - $list .= ''; - $list .= 'USER_'.$server['user'].''; - $list .= ''.$server['address'].''; - $list .= '#'.$server['tarif'].' '.$tarif['name'].''; - $list .= ''.$status[$server['status']].''; - $list .= ''.date('d.m.Y - H:i:s', $server['time']).''; - $list .= 'Удалить'; - $list .= ''; - } + $list .= ''; + $list .= 'USER_'.$server['user'].''; + $list .= ''.$server['address'].''; + $list .= '#'.$server['tarif'].' '.$tarif['name'].''; + $list .= ''.$status[$server['status']].''; + $list .= ''.date('d.m.Y - H:i:s', $server['time']).''; + $list .= 'Удалить'; + $list .= ''; + } - $html->get('index', 'sections/servers'); + $html->get('index', 'sections/servers'); - $html->set('list', $list); + $html->set('list', $list); - $html->set('url_search', $url_search); + $html->set('url_search', $url_search); - $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); + $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); - $html->pack('main'); - } + $html->pack('main'); + } ?> \ No newline at end of file diff --git a/system/acp/sections/servers/css.php b/system/acp/sections/servers/css.php index 05c7a7b..e7e6e61 100644 --- a/system/acp/sections/servers/css.php +++ b/system/acp/sections/servers/css.php @@ -1,77 +1,77 @@ 'Работает', - 'off' => 'Выключен', - 'start' => 'Запускается', - 'restart' => 'Перезапускается', - 'change' => 'Смена карты', - 'install' => 'Устанавливается', - 'reinstall' => 'Переустанавливается', - 'update' => 'Обновляется', - 'recovery' => 'Восстанавливается', - 'overdue' => 'Просрочен', - 'blocked' => 'Заблокирован' - ); + $status = array( + 'working' => 'Работает', + 'off' => 'Выключен', + 'start' => 'Запускается', + 'restart' => 'Перезапускается', + 'change' => 'Смена карты', + 'install' => 'Устанавливается', + 'reinstall' => 'Переустанавливается', + 'update' => 'Обновляется', + 'recovery' => 'Восстанавливается', + 'overdue' => 'Просрочен', + 'blocked' => 'Заблокирован' + ); - $select = 'WHERE `user`!="-1"'; - $url_search = ''; + $select = 'WHERE `user`!="-1"'; + $url_search = ''; - if(isset($url['search']) AND in_array($url['search'], array('unit', 'tarif'))) - { - $select = 'WHERE `'.$url['search'].'`="'.sys::int($url[$url['search']]).'" AND `user`!="-1"'; - $url_search = '/search/'.$url['search'].'/'.$url['search'].'/'.$url[$url['search']]; - } + if(isset($url['search']) AND in_array($url['search'], array('unit', 'tarif'))) + { + $select = 'WHERE `'.$url['search'].'`="'.sys::int($url[$url['search']]).'" AND `user`!="-1"'; + $url_search = '/search/'.$url['search'].'/'.$url['search'].'/'.$url[$url['search']]; + } - $sql->query('SELECT `id` FROM `servers` '.$select.' AND `game`="css"'); + $sql->query('SELECT `id` FROM `servers` '.$select.' AND `game`="css"'); - $aPage = sys::page($page, $sql->num(), 20); + $aPage = sys::page($page, $sql->num(), 20); - sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/servers/section/css'.$url_search); + sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/servers/section/css'.$url_search); - $servers = $sql->query('SELECT `id`, `unit`, `tarif`, `user`, `address`, `game`, `status`, `slots`, `name`, `time` FROM `servers` '.$select.' AND `game`="css" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); - while($server = $sql->get($servers)) - { - $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $servers = $sql->query('SELECT `id`, `unit`, `tarif`, `user`, `address`, `game`, `status`, `slots`, `name`, `time` FROM `servers` '.$select.' AND `game`="css" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); + while($server = $sql->get($servers)) + { + $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); - $sql->query('SELECT `name` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); - $tarif = $sql->get(); + $sql->query('SELECT `name` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); + $tarif = $sql->get(); - $list .= ''; - $list .= ''.$server['id'].''; - $list .= ''.$server['name'].''; - $list .= '#'.$server['unit'].' '.$unit['name'].''; - $list .= ''.$server['slots'].' шт.'; - $list .= ''.strtoupper($server['game']).''; - $list .= 'Перейти'; - $list .= ''; + $list .= ''; + $list .= ''.$server['id'].''; + $list .= ''.$server['name'].''; + $list .= '#'.$server['unit'].' '.$unit['name'].''; + $list .= ''.$server['slots'].' шт.'; + $list .= ''.strtoupper($server['game']).''; + $list .= 'Перейти'; + $list .= ''; - $list .= ''; - $list .= 'USER_'.$server['user'].''; - $list .= ''.$server['address'].''; - $list .= '#'.$server['tarif'].' '.$tarif['name'].''; - $list .= ''.$status[$server['status']].''; - $list .= ''.date('d.m.Y - H:i:s', $server['time']).''; - $list .= 'Удалить'; - $list .= ''; - } + $list .= ''; + $list .= 'USER_'.$server['user'].''; + $list .= ''.$server['address'].''; + $list .= '#'.$server['tarif'].' '.$tarif['name'].''; + $list .= ''.$status[$server['status']].''; + $list .= ''.date('d.m.Y - H:i:s', $server['time']).''; + $list .= 'Удалить'; + $list .= ''; + } - $html->get('index', 'sections/servers'); + $html->get('index', 'sections/servers'); - $html->set('list', $list); + $html->set('list', $list); - $html->set('url_search', $url_search); + $html->set('url_search', $url_search); - $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); + $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); - $html->pack('main'); - } + $html->pack('main'); + } ?> \ No newline at end of file diff --git a/system/acp/sections/servers/cssold.php b/system/acp/sections/servers/cssold.php index 219abb8..3168b9d 100644 --- a/system/acp/sections/servers/cssold.php +++ b/system/acp/sections/servers/cssold.php @@ -1,77 +1,77 @@ 'Работает', - 'off' => 'Выключен', - 'start' => 'Запускается', - 'restart' => 'Перезапускается', - 'change' => 'Смена карты', - 'install' => 'Устанавливается', - 'reinstall' => 'Переустанавливается', - 'update' => 'Обновляется', - 'recovery' => 'Восстанавливается', - 'overdue' => 'Просрочен', - 'blocked' => 'Заблокирован' - ); + $status = array( + 'working' => 'Работает', + 'off' => 'Выключен', + 'start' => 'Запускается', + 'restart' => 'Перезапускается', + 'change' => 'Смена карты', + 'install' => 'Устанавливается', + 'reinstall' => 'Переустанавливается', + 'update' => 'Обновляется', + 'recovery' => 'Восстанавливается', + 'overdue' => 'Просрочен', + 'blocked' => 'Заблокирован' + ); - $select = 'WHERE `user`!="-1"'; - $url_search = ''; + $select = 'WHERE `user`!="-1"'; + $url_search = ''; - if(isset($url['search']) AND in_array($url['search'], array('unit', 'tarif'))) - { - $select = 'WHERE `'.$url['search'].'`="'.sys::int($url[$url['search']]).'" AND `user`!="-1"'; - $url_search = '/search/'.$url['search'].'/'.$url['search'].'/'.$url[$url['search']]; - } + if(isset($url['search']) AND in_array($url['search'], array('unit', 'tarif'))) + { + $select = 'WHERE `'.$url['search'].'`="'.sys::int($url[$url['search']]).'" AND `user`!="-1"'; + $url_search = '/search/'.$url['search'].'/'.$url['search'].'/'.$url[$url['search']]; + } - $sql->query('SELECT `id` FROM `servers` '.$select.' AND `game`="cssold"'); + $sql->query('SELECT `id` FROM `servers` '.$select.' AND `game`="cssold"'); - $aPage = sys::page($page, $sql->num(), 20); + $aPage = sys::page($page, $sql->num(), 20); - sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/servers/section/cssold'.$url_search); + sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/servers/section/cssold'.$url_search); - $servers = $sql->query('SELECT `id`, `unit`, `tarif`, `user`, `address`, `game`, `status`, `slots`, `name`, `time` FROM `servers` '.$select.' AND `game`="cssold" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); - while($server = $sql->get($servers)) - { - $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $servers = $sql->query('SELECT `id`, `unit`, `tarif`, `user`, `address`, `game`, `status`, `slots`, `name`, `time` FROM `servers` '.$select.' AND `game`="cssold" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); + while($server = $sql->get($servers)) + { + $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); - $sql->query('SELECT `name` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); - $tarif = $sql->get(); + $sql->query('SELECT `name` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); + $tarif = $sql->get(); - $list .= ''; - $list .= ''.$server['id'].''; - $list .= ''.$server['name'].''; - $list .= '#'.$server['unit'].' '.$unit['name'].''; - $list .= ''.$server['slots'].' шт.'; - $list .= ''.strtoupper($server['game']).''; - $list .= 'Перейти'; - $list .= ''; + $list .= ''; + $list .= ''.$server['id'].''; + $list .= ''.$server['name'].''; + $list .= '#'.$server['unit'].' '.$unit['name'].''; + $list .= ''.$server['slots'].' шт.'; + $list .= ''.strtoupper($server['game']).''; + $list .= 'Перейти'; + $list .= ''; - $list .= ''; - $list .= 'USER_'.$server['user'].''; - $list .= ''.$server['address'].''; - $list .= '#'.$server['tarif'].' '.$tarif['name'].''; - $list .= ''.$status[$server['status']].''; - $list .= ''.date('d.m.Y - H:i:s', $server['time']).''; - $list .= 'Удалить'; - $list .= ''; - } + $list .= ''; + $list .= 'USER_'.$server['user'].''; + $list .= ''.$server['address'].''; + $list .= '#'.$server['tarif'].' '.$tarif['name'].''; + $list .= ''.$status[$server['status']].''; + $list .= ''.date('d.m.Y - H:i:s', $server['time']).''; + $list .= 'Удалить'; + $list .= ''; + } - $html->get('index', 'sections/servers'); + $html->get('index', 'sections/servers'); - $html->set('list', $list); + $html->set('list', $list); - $html->set('url_search', $url_search); + $html->set('url_search', $url_search); - $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); + $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); - $html->pack('main'); - } + $html->pack('main'); + } ?> \ No newline at end of file diff --git a/system/acp/sections/servers/delete.php b/system/acp/sections/servers/delete.php index 29625f6..b9287ce 100644 --- a/system/acp/sections/servers/delete.php +++ b/system/acp/sections/servers/delete.php @@ -1,8 +1,8 @@ query('UPDATE `servers` set `user`="-1", `status`="overdue", `time`="0", `overdue`="0" WHERE `id`="'.$id.'" LIMIT 1'); + $sql->query('UPDATE `servers` set `user`="-1", `status`="overdue", `time`="0", `overdue`="0" WHERE `id`="'.$id.'" LIMIT 1'); - sys::outjs(array('s' => 'ok')); + sys::outjs(array('s' => 'ok')); ?> \ No newline at end of file diff --git a/system/acp/sections/servers/index.php b/system/acp/sections/servers/index.php index cdbde17..dd8408d 100644 --- a/system/acp/sections/servers/index.php +++ b/system/acp/sections/servers/index.php @@ -1,80 +1,80 @@ 'Работает', - 'off' => 'Выключен', - 'start' => 'Запускается', - 'restart' => 'Перезапускается', - 'change' => 'Смена карты', - 'install' => 'Устанавливается', - 'reinstall' => 'Переустанавливается', - 'update' => 'Обновляется', - 'recovery' => 'Восстанавливается', - 'overdue' => 'Просрочен', - 'blocked' => 'Заблокирован' - ); + $status = array( + 'working' => 'Работает', + 'off' => 'Выключен', + 'start' => 'Запускается', + 'restart' => 'Перезапускается', + 'change' => 'Смена карты', + 'install' => 'Устанавливается', + 'reinstall' => 'Переустанавливается', + 'update' => 'Обновляется', + 'recovery' => 'Восстанавливается', + 'overdue' => 'Просрочен', + 'blocked' => 'Заблокирован' + ); - $select = 'WHERE `user`!="-1"'; - $url_search = ''; + $select = 'WHERE `user`!="-1"'; + $url_search = ''; - if(isset($url['search']) AND in_array($url['search'], array('unit', 'tarif'))) - { - $select = 'WHERE `'.$url['search'].'`="'.sys::int($url[$url['search']]).'" AND `user`!="-1"'; - $url_search = '/search/'.$url['search'].'/'.$url['search'].'/'.$url[$url['search']]; - } + if(isset($url['search']) AND in_array($url['search'], array('unit', 'tarif'))) + { + $select = 'WHERE `'.$url['search'].'`="'.sys::int($url[$url['search']]).'" AND `user`!="-1"'; + $url_search = '/search/'.$url['search'].'/'.$url['search'].'/'.$url[$url['search']]; + } - $sql->query('SELECT `id` FROM `servers` '.$select); + $sql->query('SELECT `id` FROM `servers` '.$select); - $aPage = sys::page($page, $sql->num(), 20); + $aPage = sys::page($page, $sql->num(), 20); - sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/servers'.$url_search); + sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/servers'.$url_search); - $servers = $sql->query('SELECT `id`, `unit`, `tarif`, `user`, `address`, `game`, `status`, `slots`, `name`, `time` FROM `servers` '.$select.' ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); - while($server = $sql->get($servers)) - { - $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $servers = $sql->query('SELECT `id`, `unit`, `tarif`, `user`, `address`, `game`, `status`, `slots`, `name`, `time` FROM `servers` '.$select.' ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); + while($server = $sql->get($servers)) + { + $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); - $sql->query('SELECT `name` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); - $tarif = $sql->get(); + $sql->query('SELECT `name` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); + $tarif = $sql->get(); - $list .= ''; - $list .= ''.$server['id'].''; - $list .= ''.$server['name'].''; - $list .= '#'.$server['unit'].' '.$unit['name'].''; - $list .= ''.$server['slots'].' шт.'; - $list .= ''.strtoupper($server['game']).''; - $list .= 'Перейти'; - $list .= ''; + $list .= ''; + $list .= ''.$server['id'].''; + $list .= ''.$server['name'].''; + $list .= '#'.$server['unit'].' '.$unit['name'].''; + $list .= ''.$server['slots'].' шт.'; + $list .= ''.strtoupper($server['game']).''; + $list .= 'Перейти'; + $list .= ''; - $list .= ''; - $list .= 'USER_'.$server['user'].''; - $list .= ''.$server['address'].''; - $list .= '#'.$server['tarif'].' '.$tarif['name'].''; - $list .= ''.$status[$server['status']].''; - $list .= ''.date('d.m.Y - H:i:s', $server['time']).''; - $list .= 'Удалить'; - $list .= ''; - } + $list .= ''; + $list .= 'USER_'.$server['user'].''; + $list .= ''.$server['address'].''; + $list .= '#'.$server['tarif'].' '.$tarif['name'].''; + $list .= ''.$status[$server['status']].''; + $list .= ''.date('d.m.Y - H:i:s', $server['time']).''; + $list .= 'Удалить'; + $list .= ''; + } - $html->get('index', 'sections/servers'); + $html->get('index', 'sections/servers'); - $html->set('list', $list); + $html->set('list', $list); - $html->set('url_search', $url_search); + $html->set('url_search', $url_search); - $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); + $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); - $html->pack('main'); - } + $html->pack('main'); + } ?> \ No newline at end of file diff --git a/system/acp/sections/servers/mc.php b/system/acp/sections/servers/mc.php index 9aed1dd..bee34d1 100644 --- a/system/acp/sections/servers/mc.php +++ b/system/acp/sections/servers/mc.php @@ -1,77 +1,77 @@ 'Работает', - 'off' => 'Выключен', - 'start' => 'Запускается', - 'restart' => 'Перезапускается', - 'change' => 'Смена карты', - 'install' => 'Устанавливается', - 'reinstall' => 'Переустанавливается', - 'update' => 'Обновляется', - 'recovery' => 'Восстанавливается', - 'overdue' => 'Просрочен', - 'blocked' => 'Заблокирован' - ); + $status = array( + 'working' => 'Работает', + 'off' => 'Выключен', + 'start' => 'Запускается', + 'restart' => 'Перезапускается', + 'change' => 'Смена карты', + 'install' => 'Устанавливается', + 'reinstall' => 'Переустанавливается', + 'update' => 'Обновляется', + 'recovery' => 'Восстанавливается', + 'overdue' => 'Просрочен', + 'blocked' => 'Заблокирован' + ); - $select = 'WHERE `user`!="-1"'; - $url_search = ''; + $select = 'WHERE `user`!="-1"'; + $url_search = ''; - if(isset($url['search']) AND in_array($url['search'], array('unit', 'tarif'))) - { - $select = 'WHERE `'.$url['search'].'`="'.sys::int($url[$url['search']]).'" AND `user`!="-1"'; - $url_search = '/search/'.$url['search'].'/'.$url['search'].'/'.$url[$url['search']]; - } + if(isset($url['search']) AND in_array($url['search'], array('unit', 'tarif'))) + { + $select = 'WHERE `'.$url['search'].'`="'.sys::int($url[$url['search']]).'" AND `user`!="-1"'; + $url_search = '/search/'.$url['search'].'/'.$url['search'].'/'.$url[$url['search']]; + } - $sql->query('SELECT `id` FROM `servers` '.$select.' AND `game`="mc"'); + $sql->query('SELECT `id` FROM `servers` '.$select.' AND `game`="mc"'); - $aPage = sys::page($page, $sql->num(), 20); + $aPage = sys::page($page, $sql->num(), 20); - sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/servers/section/mc'.$url_search); + sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/servers/section/mc'.$url_search); - $servers = $sql->query('SELECT `id`, `unit`, `tarif`, `user`, `address`, `game`, `status`, `slots`, `name`, `time` FROM `servers` '.$select.' AND `game`="mc" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); - while($server = $sql->get($servers)) - { - $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $servers = $sql->query('SELECT `id`, `unit`, `tarif`, `user`, `address`, `game`, `status`, `slots`, `name`, `time` FROM `servers` '.$select.' AND `game`="mc" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); + while($server = $sql->get($servers)) + { + $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); - $sql->query('SELECT `name` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); - $tarif = $sql->get(); + $sql->query('SELECT `name` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); + $tarif = $sql->get(); - $list .= ''; - $list .= ''.$server['id'].''; - $list .= ''.$server['name'].''; - $list .= '#'.$server['unit'].' '.$unit['name'].''; - $list .= ''.$server['slots'].' шт.'; - $list .= ''.strtoupper($server['game']).''; - $list .= 'Перейти'; - $list .= ''; + $list .= ''; + $list .= ''.$server['id'].''; + $list .= ''.$server['name'].''; + $list .= '#'.$server['unit'].' '.$unit['name'].''; + $list .= ''.$server['slots'].' шт.'; + $list .= ''.strtoupper($server['game']).''; + $list .= 'Перейти'; + $list .= ''; - $list .= ''; - $list .= 'USER_'.$server['user'].''; - $list .= ''.$server['address'].''; - $list .= '#'.$server['tarif'].' '.$tarif['name'].''; - $list .= ''.$status[$server['status']].''; - $list .= ''.date('d.m.Y - H:i:s', $server['time']).''; - $list .= 'Удалить'; - $list .= ''; - } + $list .= ''; + $list .= 'USER_'.$server['user'].''; + $list .= ''.$server['address'].''; + $list .= '#'.$server['tarif'].' '.$tarif['name'].''; + $list .= ''.$status[$server['status']].''; + $list .= ''.date('d.m.Y - H:i:s', $server['time']).''; + $list .= 'Удалить'; + $list .= ''; + } - $html->get('index', 'sections/servers'); + $html->get('index', 'sections/servers'); - $html->set('list', $list); + $html->set('list', $list); - $html->set('url_search', $url_search); + $html->set('url_search', $url_search); - $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); + $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); - $html->pack('main'); - } + $html->pack('main'); + } ?> \ No newline at end of file diff --git a/system/acp/sections/servers/mta.php b/system/acp/sections/servers/mta.php index f83c1b5..73bb3cd 100644 --- a/system/acp/sections/servers/mta.php +++ b/system/acp/sections/servers/mta.php @@ -1,77 +1,77 @@ 'Работает', - 'off' => 'Выключен', - 'start' => 'Запускается', - 'restart' => 'Перезапускается', - 'change' => 'Смена карты', - 'install' => 'Устанавливается', - 'reinstall' => 'Переустанавливается', - 'update' => 'Обновляется', - 'recovery' => 'Восстанавливается', - 'overdue' => 'Просрочен', - 'blocked' => 'Заблокирован' - ); + $status = array( + 'working' => 'Работает', + 'off' => 'Выключен', + 'start' => 'Запускается', + 'restart' => 'Перезапускается', + 'change' => 'Смена карты', + 'install' => 'Устанавливается', + 'reinstall' => 'Переустанавливается', + 'update' => 'Обновляется', + 'recovery' => 'Восстанавливается', + 'overdue' => 'Просрочен', + 'blocked' => 'Заблокирован' + ); - $select = 'WHERE `user`!="-1"'; - $url_search = ''; + $select = 'WHERE `user`!="-1"'; + $url_search = ''; - if(isset($url['search']) AND in_array($url['search'], array('unit', 'tarif'))) - { - $select = 'WHERE `'.$url['search'].'`="'.sys::int($url[$url['search']]).'" AND `user`!="-1"'; - $url_search = '/search/'.$url['search'].'/'.$url['search'].'/'.$url[$url['search']]; - } + if(isset($url['search']) AND in_array($url['search'], array('unit', 'tarif'))) + { + $select = 'WHERE `'.$url['search'].'`="'.sys::int($url[$url['search']]).'" AND `user`!="-1"'; + $url_search = '/search/'.$url['search'].'/'.$url['search'].'/'.$url[$url['search']]; + } - $sql->query('SELECT `id` FROM `servers` '.$select.' AND `game`="mta"'); + $sql->query('SELECT `id` FROM `servers` '.$select.' AND `game`="mta"'); - $aPage = sys::page($page, $sql->num(), 20); + $aPage = sys::page($page, $sql->num(), 20); - sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/servers/section/mta'.$url_search); + sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/servers/section/mta'.$url_search); - $servers = $sql->query('SELECT `id`, `unit`, `tarif`, `user`, `address`, `game`, `status`, `slots`, `name`, `time` FROM `servers` '.$select.' AND `game`="mta" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); - while($server = $sql->get($servers)) - { - $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $servers = $sql->query('SELECT `id`, `unit`, `tarif`, `user`, `address`, `game`, `status`, `slots`, `name`, `time` FROM `servers` '.$select.' AND `game`="mta" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); + while($server = $sql->get($servers)) + { + $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); - $sql->query('SELECT `name` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); - $tarif = $sql->get(); + $sql->query('SELECT `name` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); + $tarif = $sql->get(); - $list .= ''; - $list .= ''.$server['id'].''; - $list .= ''.$server['name'].''; - $list .= '#'.$server['unit'].' '.$unit['name'].''; - $list .= ''.$server['slots'].' шт.'; - $list .= ''.strtoupper($server['game']).''; - $list .= 'Перейти'; - $list .= ''; + $list .= ''; + $list .= ''.$server['id'].''; + $list .= ''.$server['name'].''; + $list .= '#'.$server['unit'].' '.$unit['name'].''; + $list .= ''.$server['slots'].' шт.'; + $list .= ''.strtoupper($server['game']).''; + $list .= 'Перейти'; + $list .= ''; - $list .= ''; - $list .= 'USER_'.$server['user'].''; - $list .= ''.$server['address'].''; - $list .= '#'.$server['tarif'].' '.$tarif['name'].''; - $list .= ''.$status[$server['status']].''; - $list .= ''.date('d.m.Y - H:i:s', $server['time']).''; - $list .= 'Удалить'; - $list .= ''; - } + $list .= ''; + $list .= 'USER_'.$server['user'].''; + $list .= ''.$server['address'].''; + $list .= '#'.$server['tarif'].' '.$tarif['name'].''; + $list .= ''.$status[$server['status']].''; + $list .= ''.date('d.m.Y - H:i:s', $server['time']).''; + $list .= 'Удалить'; + $list .= ''; + } - $html->get('index', 'sections/servers'); + $html->get('index', 'sections/servers'); - $html->set('list', $list); + $html->set('list', $list); - $html->set('url_search', $url_search); + $html->set('url_search', $url_search); - $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); + $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); - $html->pack('main'); - } + $html->pack('main'); + } ?> \ No newline at end of file diff --git a/system/acp/sections/servers/overdue.php b/system/acp/sections/servers/overdue.php index bc56d59..05356c2 100644 --- a/system/acp/sections/servers/overdue.php +++ b/system/acp/sections/servers/overdue.php @@ -1,43 +1,43 @@ query('SELECT `id`, `unit`, `tarif`, `user`, `address`, `game`, `slots`, `name`, `overdue` FROM `servers` WHERE `user`!="-1" AND `time`<"'.$start_point.'" AND `overdue`>"'.$start_point.'" ORDER BY `id` ASC'); - while($server = $sql->get($servers)) - { - $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $servers = $sql->query('SELECT `id`, `unit`, `tarif`, `user`, `address`, `game`, `slots`, `name`, `overdue` FROM `servers` WHERE `user`!="-1" AND `time`<"'.$start_point.'" AND `overdue`>"'.$start_point.'" ORDER BY `id` ASC'); + while($server = $sql->get($servers)) + { + $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); - $sql->query('SELECT `name` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); - $tarif = $sql->get(); + $sql->query('SELECT `name` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); + $tarif = $sql->get(); - $list .= ''; - $list .= ''.$server['id'].''; - $list .= ''.$server['name'].''; - $list .= '#'.$server['unit'].' '.$unit['name'].''; - $list .= ''.$server['slots'].' шт.'; - $list .= ''.strtoupper($server['game']).''; - $list .= 'Перейти'; - $list .= ''; + $list .= ''; + $list .= ''.$server['id'].''; + $list .= ''.$server['name'].''; + $list .= '#'.$server['unit'].' '.$unit['name'].''; + $list .= ''.$server['slots'].' шт.'; + $list .= ''.strtoupper($server['game']).''; + $list .= 'Перейти'; + $list .= ''; - $list .= ''; - $list .= 'USER_'.$server['user'].''; - $list .= ''.$server['address'].''; - $list .= '#'.$server['tarif'].' '.$tarif['name'].''; - $list .= 'Просрочен'; - $list .= 'Удаление через: '.sys::date('min', $server['overdue']+$cfg['server_delete']*86400).''; - $list .= 'Удалить'; - $list .= ''; - } + $list .= ''; + $list .= 'USER_'.$server['user'].''; + $list .= ''.$server['address'].''; + $list .= '#'.$server['tarif'].' '.$tarif['name'].''; + $list .= 'Просрочен'; + $list .= 'Удаление через: '.sys::date('min', $server['overdue']+$cfg['server_delete']*86400).''; + $list .= 'Удалить'; + $list .= ''; + } - $html->get('index', 'sections/servers'); - $html->set('list', $list); - $html->set('pages', ''); - $html->pack('main'); - } + $html->get('index', 'sections/servers'); + $html->set('list', $list); + $html->set('pages', ''); + $html->pack('main'); + } ?> \ No newline at end of file diff --git a/system/acp/sections/servers/samp.php b/system/acp/sections/servers/samp.php index 8e2a8d4..6e076be 100644 --- a/system/acp/sections/servers/samp.php +++ b/system/acp/sections/servers/samp.php @@ -1,77 +1,77 @@ 'Работает', - 'off' => 'Выключен', - 'start' => 'Запускается', - 'restart' => 'Перезапускается', - 'change' => 'Смена карты', - 'install' => 'Устанавливается', - 'reinstall' => 'Переустанавливается', - 'update' => 'Обновляется', - 'recovery' => 'Восстанавливается', - 'overdue' => 'Просрочен', - 'blocked' => 'Заблокирован' - ); + $status = array( + 'working' => 'Работает', + 'off' => 'Выключен', + 'start' => 'Запускается', + 'restart' => 'Перезапускается', + 'change' => 'Смена карты', + 'install' => 'Устанавливается', + 'reinstall' => 'Переустанавливается', + 'update' => 'Обновляется', + 'recovery' => 'Восстанавливается', + 'overdue' => 'Просрочен', + 'blocked' => 'Заблокирован' + ); - $select = 'WHERE `user`!="-1"'; - $url_search = ''; + $select = 'WHERE `user`!="-1"'; + $url_search = ''; - if(isset($url['search']) AND in_array($url['search'], array('unit', 'tarif'))) - { - $select = 'WHERE `'.$url['search'].'`="'.sys::int($url[$url['search']]).'" AND `user`!="-1"'; - $url_search = '/search/'.$url['search'].'/'.$url['search'].'/'.$url[$url['search']]; - } + if(isset($url['search']) AND in_array($url['search'], array('unit', 'tarif'))) + { + $select = 'WHERE `'.$url['search'].'`="'.sys::int($url[$url['search']]).'" AND `user`!="-1"'; + $url_search = '/search/'.$url['search'].'/'.$url['search'].'/'.$url[$url['search']]; + } - $sql->query('SELECT `id` FROM `servers` '.$select.' AND `game`="samp"'); + $sql->query('SELECT `id` FROM `servers` '.$select.' AND `game`="samp"'); - $aPage = sys::page($page, $sql->num(), 20); + $aPage = sys::page($page, $sql->num(), 20); - sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/servers/section/samp'.$url_search); + sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/servers/section/samp'.$url_search); - $servers = $sql->query('SELECT `id`, `unit`, `tarif`, `user`, `address`, `game`, `status`, `slots`, `name`, `time` FROM `servers` '.$select.' AND `game`="samp" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); - while($server = $sql->get($servers)) - { - $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $servers = $sql->query('SELECT `id`, `unit`, `tarif`, `user`, `address`, `game`, `status`, `slots`, `name`, `time` FROM `servers` '.$select.' AND `game`="samp" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); + while($server = $sql->get($servers)) + { + $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); - $sql->query('SELECT `name` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); - $tarif = $sql->get(); + $sql->query('SELECT `name` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); + $tarif = $sql->get(); - $list .= ''; - $list .= ''.$server['id'].''; - $list .= ''.$server['name'].''; - $list .= '#'.$server['unit'].' '.$unit['name'].''; - $list .= ''.$server['slots'].' шт.'; - $list .= ''.strtoupper($server['game']).''; - $list .= 'Перейти'; - $list .= ''; + $list .= ''; + $list .= ''.$server['id'].''; + $list .= ''.$server['name'].''; + $list .= '#'.$server['unit'].' '.$unit['name'].''; + $list .= ''.$server['slots'].' шт.'; + $list .= ''.strtoupper($server['game']).''; + $list .= 'Перейти'; + $list .= ''; - $list .= ''; - $list .= 'USER_'.$server['user'].''; - $list .= ''.$server['address'].''; - $list .= '#'.$server['tarif'].' '.$tarif['name'].''; - $list .= ''.$status[$server['status']].''; - $list .= ''.date('d.m.Y - H:i:s', $server['time']).''; - $list .= 'Удалить'; - $list .= ''; - } + $list .= ''; + $list .= 'USER_'.$server['user'].''; + $list .= ''.$server['address'].''; + $list .= '#'.$server['tarif'].' '.$tarif['name'].''; + $list .= ''.$status[$server['status']].''; + $list .= ''.date('d.m.Y - H:i:s', $server['time']).''; + $list .= 'Удалить'; + $list .= ''; + } - $html->get('index', 'sections/servers'); + $html->get('index', 'sections/servers'); - $html->set('list', $list); + $html->set('list', $list); - $html->set('url_search', $url_search); + $html->set('url_search', $url_search); - $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); + $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); - $html->pack('main'); - } + $html->pack('main'); + } ?> \ No newline at end of file diff --git a/system/acp/sections/servers/search.php b/system/acp/sections/servers/search.php index d204690..19598e2 100644 --- a/system/acp/sections/servers/search.php +++ b/system/acp/sections/servers/search.php @@ -1,138 +1,138 @@ get($mkey); + $cache = $mcache->get($mkey); - if(is_array($cache)) - { - if($go) - sys::outjs($cache, $nmch); + if(is_array($cache)) + { + if($go) + sys::outjs($cache, $nmch); - sys::outjs($cache); - } + sys::outjs($cache); + } - if(!isset($text{2})) - { - if($go) - sys::outjs(array('e' => 'Для выполнения поиска, необходимо больше данных'), $nmch); + if(!isset($text{2})) + { + if($go) + sys::outjs(array('e' => 'Для выполнения поиска, необходимо больше данных'), $nmch); - sys::outjs(array('e' => '')); - } + sys::outjs(array('e' => '')); + } - $select = '`id`, `unit`, `tarif`, `user`, `address`, `game`, `status`, `slots`, `name`, `time` FROM `servers` WHERE `user`!="-1" AND'; + $select = '`id`, `unit`, `tarif`, `user`, `address`, `game`, `status`, `slots`, `name`, `time` FROM `servers` WHERE `user`!="-1" AND'; - if(isset($url['search']) AND in_array($url['search'], array('unit', 'tarif'))) - $select .= ' `'.$url['search'].'`='.sys::int($url[$url['search']]).' AND'; + if(isset($url['search']) AND in_array($url['search'], array('unit', 'tarif'))) + $select .= ' `'.$url['search'].'`='.sys::int($url[$url['search']]).' AND'; - $check = explode('=', $text); + $check = explode('=', $text); - if(in_array($check[0], array('game', 'unit', 'core', 'tarif', 'user', 'status', 'slots'))) - { - $val = trim($check[1]); + if(in_array($check[0], array('game', 'unit', 'core', 'tarif', 'user', 'status', 'slots'))) + { + $val = trim($check[1]); - switch($check[0]) - { - case 'game': - if(in_array($val, array('cs', 'cssold', 'css', 'csgo', 'samp', 'crmp', 'mta', 'mc'))) - $servers = $sql->query('SELECT '.$select.' FROM `servers` WHERE `user`!="-1" AND `game`="'.$val.'" ORDER BY `id` ASC'); - break; + switch($check[0]) + { + case 'game': + if(in_array($val, array('cs', 'cssold', 'css', 'csgo', 'samp', 'crmp', 'mta', 'mc'))) + $servers = $sql->query('SELECT '.$select.' FROM `servers` WHERE `user`!="-1" AND `game`="'.$val.'" ORDER BY `id` ASC'); + break; - case 'unit': - $servers = $sql->query('SELECT '.$select.' `unit`="'.sys::int($val).'" ORDER BY `id` ASC'); - break; + case 'unit': + $servers = $sql->query('SELECT '.$select.' `unit`="'.sys::int($val).'" ORDER BY `id` ASC'); + break; - case 'core': - $servers = $sql->query('SELECT '.$select.' `core_use`="'.sys::int($val).'" ORDER BY `id` ASC'); - break; + case 'core': + $servers = $sql->query('SELECT '.$select.' `core_use`="'.sys::int($val).'" ORDER BY `id` ASC'); + break; - case 'tarif': - $servers = $sql->query('SELECT '.$select.' `tarif`="'.sys::int($val).'" ORDER BY `id` ASC'); - break; + case 'tarif': + $servers = $sql->query('SELECT '.$select.' `tarif`="'.sys::int($val).'" ORDER BY `id` ASC'); + break; - case 'user': - $servers = $sql->query('SELECT '.$select.' `user`="'.sys::int($val).'" ORDER BY `id` ASC'); - break; + case 'user': + $servers = $sql->query('SELECT '.$select.' `user`="'.sys::int($val).'" ORDER BY `id` ASC'); + break; - case 'status': - if(in_array($val, array('working', 'start', 'change', 'restart', 'off', 'overdue', 'blocked', 'recovery', 'reinstall', 'update', 'install'))) - $servers = $sql->query('SELECT '.$select.' `status`="'.$val.'" ORDER BY `id` ASC'); - break; + case 'status': + if(in_array($val, array('working', 'start', 'change', 'restart', 'off', 'overdue', 'blocked', 'recovery', 'reinstall', 'update', 'install'))) + $servers = $sql->query('SELECT '.$select.' `status`="'.$val.'" ORDER BY `id` ASC'); + break; - case 'slots': - $servers = $sql->query('SELECT '.$select.' `slots`="'.sys::int($val).'" ORDER BY `id` ASC'); - break; - } - }elseif($text{0} == 'i' AND $text{1} == 'd') - $servers = $sql->query('SELECT '.$select.' `id`="'.sys::int($text).'" LIMIT 1'); - else{ - $like = '`id` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' - .'`name` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' - .'`game` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' - .'`slots` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' - .'`status` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' - .'`address` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' - .'`port` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\')'; + case 'slots': + $servers = $sql->query('SELECT '.$select.' `slots`="'.sys::int($val).'" ORDER BY `id` ASC'); + break; + } + }elseif($text{0} == 'i' AND $text{1} == 'd') + $servers = $sql->query('SELECT '.$select.' `id`="'.sys::int($text).'" LIMIT 1'); + else{ + $like = '`id` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' + .'`name` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' + .'`game` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' + .'`slots` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' + .'`status` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' + .'`address` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' + .'`port` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\')'; - $servers = $sql->query('SELECT '.$select.' ('.$like.') ORDER BY `id` ASC'); - } + $servers = $sql->query('SELECT '.$select.' ('.$like.') ORDER BY `id` ASC'); + } - if(!$sql->num($servers)) - { - if($go) - sys::outjs(array('e' => 'По вашему запросу ничего не найдено'), $nmch); + if(!$sql->num($servers)) + { + if($go) + sys::outjs(array('e' => 'По вашему запросу ничего не найдено'), $nmch); - sys::outjs(array('e' => 'По вашему запросу ничего не найдено')); - } + sys::outjs(array('e' => 'По вашему запросу ничего не найдено')); + } - $status = array( - 'working' => 'Работает', - 'off' => 'Выключен', - 'start' => 'Запускается', - 'restart' => 'Перезапускается', - 'change' => 'Смена карты', - 'install' => 'Устанавливается', - 'reinstall' => 'Переустанавливается', - 'update' => 'Обновляется', - 'recovery' => 'Восстанавливается', - 'overdue' => 'Просрочен', - 'blocked' => 'Заблокирован' - ); + $status = array( + 'working' => 'Работает', + 'off' => 'Выключен', + 'start' => 'Запускается', + 'restart' => 'Перезапускается', + 'change' => 'Смена карты', + 'install' => 'Устанавливается', + 'reinstall' => 'Переустанавливается', + 'update' => 'Обновляется', + 'recovery' => 'Восстанавливается', + 'overdue' => 'Просрочен', + 'blocked' => 'Заблокирован' + ); - $list = ''; + $list = ''; - while($server = $sql->get($servers)) - { - $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); + while($server = $sql->get($servers)) + { + $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); - $sql->query('SELECT `name` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); - $tarif = $sql->get(); + $sql->query('SELECT `name` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); + $tarif = $sql->get(); - $list .= ''; - $list .= ''.$server['id'].''; - $list .= ''.$server['name'].''; - $list .= '#'.$server['unit'].' '.$unit['name'].''; - $list .= ''.$server['slots'].' шт.'; - $list .= ''.strtoupper($server['game']).''; - $list .= 'Перейти'; - $list .= ''; + $list .= ''; + $list .= ''.$server['id'].''; + $list .= ''.$server['name'].''; + $list .= '#'.$server['unit'].' '.$unit['name'].''; + $list .= ''.$server['slots'].' шт.'; + $list .= ''.strtoupper($server['game']).''; + $list .= 'Перейти'; + $list .= ''; - $list .= ''; - $list .= 'USER_'.$server['user'].''; - $list .= ''.$server['address'].''; - $list .= '#'.$server['tarif'].' '.$tarif['name'].''; - $list .= ''.$status[$server['status']].''; - $list .= ''.date('d.m.Y - H:i:s', $server['time']).''; - $list .= 'Удалить'; - $list .= ''; - } + $list .= ''; + $list .= 'USER_'.$server['user'].''; + $list .= ''.$server['address'].''; + $list .= '#'.$server['tarif'].' '.$tarif['name'].''; + $list .= ''.$status[$server['status']].''; + $list .= ''.date('d.m.Y - H:i:s', $server['time']).''; + $list .= 'Удалить'; + $list .= ''; + } - $mcache->set($mkey, array('s' => $list), false, 15); + $mcache->set($mkey, array('s' => $list), false, 15); - sys::outjs(array('s' => $list)); + sys::outjs(array('s' => $list)); ?> \ No newline at end of file diff --git a/system/acp/sections/servers/server.php b/system/acp/sections/servers/server.php index 43b04b6..704f708 100644 --- a/system/acp/sections/servers/server.php +++ b/system/acp/sections/servers/server.php @@ -1,282 +1,282 @@ query('SELECT `time`, `overdue` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `time`, `overdue` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - if($server['time'] > $start_point AND $server['overdue']) - $sql->query('UPDATE `servers` set `overdue`="0" WHERE `id`="'.$id.'" LIMIT 1'); + if($server['time'] > $start_point AND $server['overdue']) + $sql->query('UPDATE `servers` set `overdue`="0" WHERE `id`="'.$id.'" LIMIT 1'); - $sql->query('SELECT * FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT * FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - $sql->query('SELECT `address` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $sql->query('SELECT `address` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); - $sql->query('SELECT `name`, `slots_min`, `slots_max`, `packs` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); - $tarif = $sql->get(); + $sql->query('SELECT `name`, `slots_min`, `slots_max`, `packs` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); + $tarif = $sql->get(); - if($go) - { - if(isset($url['type']) AND in_array($url['type'], array('overdue', 'block', 'tarif'))) - { - if($url['type'] != 'tarif') - { - $time = isset($_POST['time']) ? trim($_POST['time']) : sys::outjs(array('e' => 'Необходимо указать дату.')); + if($go) + { + if(isset($url['type']) AND in_array($url['type'], array('overdue', 'block', 'tarif'))) + { + if($url['type'] != 'tarif') + { + $time = isset($_POST['time']) ? trim($_POST['time']) : sys::outjs(array('e' => 'Необходимо указать дату.')); - $date = sys::checkdate($time); - } + $date = sys::checkdate($time); + } - switch($url['type']) - { - case 'overdue': - if($server['time'] > $start_point) - sys::outjs(array('e' => 'Игровой сервер должен быть просрочен.')); + switch($url['type']) + { + case 'overdue': + if($server['time'] > $start_point) + sys::outjs(array('e' => 'Игровой сервер должен быть просрочен.')); - $sql->query('UPDATE `servers` set `overdue`="'.$date.'" WHERE `id`="'.$id.'" LIMIT 1'); - break; + $sql->query('UPDATE `servers` set `overdue`="'.$date.'" WHERE `id`="'.$id.'" LIMIT 1'); + break; - case 'block': - if($server['status'] != ('off' || 'overdue')) - sys::outjs(array('e' => 'Игровой сервер должен быть выключен.')); + case 'block': + if($server['status'] != ('off' || 'overdue')) + sys::outjs(array('e' => 'Игровой сервер должен быть выключен.')); - if($date < $start_point) - $sql->query('UPDATE `servers` set `status`="off", `block`="0" WHERE `id`="'.$id.'" LIMIT 1'); - else - $sql->query('UPDATE `servers` set `status`="blocked", `block`="'.$date.'" WHERE `id`="'.$id.'" LIMIT 1'); - break; + if($date < $start_point) + $sql->query('UPDATE `servers` set `status`="off", `block`="0" WHERE `id`="'.$id.'" LIMIT 1'); + else + $sql->query('UPDATE `servers` set `status`="blocked", `block`="'.$date.'" WHERE `id`="'.$id.'" LIMIT 1'); + break; - case 'tarif': - $tid = isset($url['tarif']) ? sys::int($url['tarif']) : sys::outjs(array('e' => 'Необходимо указать тариф.')); + case 'tarif': + $tid = isset($url['tarif']) ? sys::int($url['tarif']) : sys::outjs(array('e' => 'Необходимо указать тариф.')); - if($tid == $server['tarif']) - sys::outjs(array('s' => 'ok')); + if($tid == $server['tarif']) + sys::outjs(array('s' => 'ok')); - $sql->query('SELECT `id`, `slots_min`, `slots_max`, `packs`, `fps`, `tickrate`, `ram` FROM `tarifs` WHERE `id`="'.$tid.'" AND `unit`="'.$server['unit'].'" AND `game`="'.$server['game'].'" LIMIT 1'); - if(!$sql->num()) - sys::outjs(array('e' => 'Укажите тариф из списка.')); + $sql->query('SELECT `id`, `slots_min`, `slots_max`, `packs`, `fps`, `tickrate`, `ram` FROM `tarifs` WHERE `id`="'.$tid.'" AND `unit`="'.$server['unit'].'" AND `game`="'.$server['game'].'" LIMIT 1'); + if(!$sql->num()) + sys::outjs(array('e' => 'Укажите тариф из списка.')); - $tarif = $sql->get(); + $tarif = $sql->get(); - if($server['slots'] < $tarif['slots_min'] || $server['slots'] > $tarif['slots_max']) - sys::outjs(array('e' => 'Данный тариф не совместим по слотам.')); + if($server['slots'] < $tarif['slots_min'] || $server['slots'] > $tarif['slots_max']) + sys::outjs(array('e' => 'Данный тариф не совместим по слотам.')); - if($server['fps']) - { - if(!in_array($server['fps'], explode(':', $tarif['fps']))) - sys::outjs(array('e' => 'Данный тариф не совместим по FPS.')); - } + if($server['fps']) + { + if(!in_array($server['fps'], explode(':', $tarif['fps']))) + sys::outjs(array('e' => 'Данный тариф не совместим по FPS.')); + } - if($server['tickrate']) - { - if(!in_array($server['tickrate'], explode(':', $tarif['tickrate']))) - sys::outjs(array('e' => 'Данный тариф не совместим по TickRate.')); - } + if($server['tickrate']) + { + if(!in_array($server['tickrate'], explode(':', $tarif['tickrate']))) + sys::outjs(array('e' => 'Данный тариф не совместим по TickRate.')); + } - if($server['game'] == 'mc') - { - $ram = $server['ram']/$server['slots']; + if($server['game'] == 'mc') + { + $ram = $server['ram']/$server['slots']; - if(!in_array($ram, explode(':', $tarif['ram']))) - sys::outjs(array('e' => 'Данный тариф не совместим по RAM.')); - } + if(!in_array($ram, explode(':', $tarif['ram']))) + sys::outjs(array('e' => 'Данный тариф не совместим по RAM.')); + } - if(!array_key_exists($server['pack'], sys::b64djs($tarif['packs']))) - sys::outjs(array('e' => 'На данном тарифном плане нет сборки игрового сервера.')); + if(!array_key_exists($server['pack'], sys::b64djs($tarif['packs']))) + sys::outjs(array('e' => 'На данном тарифном плане нет сборки игрового сервера.')); - $sql->query('UPDATE `servers` set `tarif`="'.$tid.'" WHERE `id`="'.$id.'" LIMIT 1'); - break; - } + $sql->query('UPDATE `servers` set `tarif`="'.$tid.'" WHERE `id`="'.$id.'" LIMIT 1'); + break; + } - sys::outjs(array('s' => 'ok')); - } + sys::outjs(array('s' => 'ok')); + } - $aData = array(); + $aData = array(); - $aData['user'] = isset($_POST['user']) ? sys::int($_POST['user']) : $server['user']; - $aData['address'] = isset($_POST['address']) ? trim($_POST['address']) : $server['address']; - $aData['port'] = isset($_POST['port']) ? sys::int($_POST['port']) : $server['port']; - $aData['hdd'] = isset($_POST['hdd']) ? sys::int($_POST['hdd']) : $server['hdd']; - $aData['slots'] = isset($_POST['slots']) ? trim($_POST['slots']) : $server['slots']; - $aData['pack'] = isset($_POST['pack']) ? trim($_POST['pack']) : $server['pack']; - $aData['fps'] = isset($_POST['fps']) ? sys::int($_POST['fps']) : $server['fps']; - $aData['tickrate'] = isset($_POST['tickrate']) ? sys::int($_POST['tickrate']) : $server['tickrate']; - $aData['ram'] = isset($_POST['ram']) ? sys::int($_POST['ram']) : $server['ram']; - $aData['core_fix_one'] = isset($_POST['core_fix_one']) ? sys::int($_POST['core_fix_one']) : $server['core_fix_one']; - $aData['core_fix'] = isset($_POST['core_fix']) ? sys::int($_POST['core_fix']) : $server['core_fix']; - $aData['cpu_use_max'] = isset($_POST['cpu_use_max']) ? sys::int($_POST['cpu_use_max']) : $server['cpu_use_max']; - $aData['pingboost'] = isset($_POST['pingboost']) ? sys::int($_POST['pingboost']) : $server['pingboost']; - $aData['time'] = isset($_POST['time']) ? trim($_POST['time']) : $server['time']; + $aData['user'] = isset($_POST['user']) ? sys::int($_POST['user']) : $server['user']; + $aData['address'] = isset($_POST['address']) ? trim($_POST['address']) : $server['address']; + $aData['port'] = isset($_POST['port']) ? sys::int($_POST['port']) : $server['port']; + $aData['hdd'] = isset($_POST['hdd']) ? sys::int($_POST['hdd']) : $server['hdd']; + $aData['slots'] = isset($_POST['slots']) ? trim($_POST['slots']) : $server['slots']; + $aData['pack'] = isset($_POST['pack']) ? trim($_POST['pack']) : $server['pack']; + $aData['fps'] = isset($_POST['fps']) ? sys::int($_POST['fps']) : $server['fps']; + $aData['tickrate'] = isset($_POST['tickrate']) ? sys::int($_POST['tickrate']) : $server['tickrate']; + $aData['ram'] = isset($_POST['ram']) ? sys::int($_POST['ram']) : $server['ram']; + $aData['core_fix_one'] = isset($_POST['core_fix_one']) ? sys::int($_POST['core_fix_one']) : $server['core_fix_one']; + $aData['core_fix'] = isset($_POST['core_fix']) ? sys::int($_POST['core_fix']) : $server['core_fix']; + $aData['cpu_use_max'] = isset($_POST['cpu_use_max']) ? sys::int($_POST['cpu_use_max']) : $server['cpu_use_max']; + $aData['pingboost'] = isset($_POST['pingboost']) ? sys::int($_POST['pingboost']) : $server['pingboost']; + $aData['time'] = isset($_POST['time']) ? trim($_POST['time']) : $server['time']; - $aData['ftp_use'] = isset($_POST['ftp_use']) ? $_POST['ftp_use'] : $server['ftp_use']; - $aData['ftp_root'] = isset($_POST['ftp_root']) ? sys::int($_POST['ftp_root']) : $server['ftp_root']; - $aData['plugins_use'] = isset($_POST['plugins_use']) ? $_POST['plugins_use'] : $server['plugins_use']; - $aData['console_use'] = isset($_POST['console_use']) ? $_POST['console_use'] : $server['console_use']; - $aData['stats_use'] = isset($_POST['stats_use']) ? $_POST['stats_use'] : $server['stats_use']; - $aData['copy_use'] = isset($_POST['copy_use']) ? $_POST['copy_use'] : $server['copy_use']; - $aData['web_use'] = isset($_POST['web_use']) ? $_POST['web_use'] : $server['web_use']; + $aData['ftp_use'] = isset($_POST['ftp_use']) ? $_POST['ftp_use'] : $server['ftp_use']; + $aData['ftp_root'] = isset($_POST['ftp_root']) ? sys::int($_POST['ftp_root']) : $server['ftp_root']; + $aData['plugins_use'] = isset($_POST['plugins_use']) ? $_POST['plugins_use'] : $server['plugins_use']; + $aData['console_use'] = isset($_POST['console_use']) ? $_POST['console_use'] : $server['console_use']; + $aData['stats_use'] = isset($_POST['stats_use']) ? $_POST['stats_use'] : $server['stats_use']; + $aData['copy_use'] = isset($_POST['copy_use']) ? $_POST['copy_use'] : $server['copy_use']; + $aData['web_use'] = isset($_POST['web_use']) ? $_POST['web_use'] : $server['web_use']; - if($server['user'] != $aData['user']) - { - $sql->query('SELECT `id` FROM `users` WHERE `id`="'.$aData['user'].'" LIMIT 1'); - if(!$sql->num()) - sys::outjs(array('e' => 'Пользователь не найден.')); - else{ - $sql->query('SELECT `id` FROM `web` WHERE `user`!="'.$aData['user'].'" AND `server`="'.$id.'" LIMIT 1'); - if($sql->num()) - sys::outjs(array('e' => 'Невозможно установить пользователя владельцем данного сервера
    Из-за возможной несовместимости с бесплатными услугами.
    Удалите у данного сервера бесплатные услуги.')); - } - } + if($server['user'] != $aData['user']) + { + $sql->query('SELECT `id` FROM `users` WHERE `id`="'.$aData['user'].'" LIMIT 1'); + if(!$sql->num()) + sys::outjs(array('e' => 'Пользователь не найден.')); + else{ + $sql->query('SELECT `id` FROM `web` WHERE `user`!="'.$aData['user'].'" AND `server`="'.$id.'" LIMIT 1'); + if($sql->num()) + sys::outjs(array('e' => 'Невозможно установить пользователя владельцем данного сервера
    Из-за возможной несовместимости с бесплатными услугами.
    Удалите у данного сервера бесплатные услуги.')); + } + } - if(sys::valid($aData['address'], 'other', $aValid['address'])) - $aData['address'] = $server['address']; + if(sys::valid($aData['address'], 'other', $aValid['address'])) + $aData['address'] = $server['address']; - $sql->query('SELECT `id` FROM `servers` WHERE `id`!="'.$id.'" AND `address`="'.$aData['address'].'" LIMIT 1'); - if($sql->num()) - sys::outjs(array('e' => 'Данный адрес занят другим сервером.')); + $sql->query('SELECT `id` FROM `servers` WHERE `id`!="'.$id.'" AND `address`="'.$aData['address'].'" LIMIT 1'); + if($sql->num()) + sys::outjs(array('e' => 'Данный адрес занят другим сервером.')); - $sql->query('SELECT `id` FROM `servers` WHERE `id`!="'.$id.'" AND `address` LIKE \'%'.sys::first(explode(':', $unit['address'])).'\' AND `port`="'.$aData['port'].'" LIMIT 1'); - if($sql->num()) - sys::outjs(array('e' => 'Данный порт занят другим сервером.')); + $sql->query('SELECT `id` FROM `servers` WHERE `id`!="'.$id.'" AND `address` LIKE \'%'.sys::first(explode(':', $unit['address'])).'\' AND `port`="'.$aData['port'].'" LIMIT 1'); + if($sql->num()) + sys::outjs(array('e' => 'Данный порт занят другим сервером.')); - $slots = explode(':', $aData['slots']); + $slots = explode(':', $aData['slots']); - if(!isset($slots[0]) AND !isset($slots[1])) - sys::outjs(array('e' => 'Слоты указаны не правильно.')); + if(!isset($slots[0]) AND !isset($slots[1])) + sys::outjs(array('e' => 'Слоты указаны не правильно.')); - if($slots[0] < 2 || $slots[1] < 2) - sys::outjs(array('e' => 'Слоты указаны не правильно.')); + if($slots[0] < 2 || $slots[1] < 2) + sys::outjs(array('e' => 'Слоты указаны не правильно.')); - if($slots[0] > $tarif['slots_max'] || $slots[0] < $tarif['slots_min']) - sys::outjs(array('e' => 'Слоты указаны не правильно.')); + if($slots[0] > $tarif['slots_max'] || $slots[0] < $tarif['slots_min']) + sys::outjs(array('e' => 'Слоты указаны не правильно.')); - $slots[1] = $slots[1] > $slots[0] ? $slots[0] : $slots[1]; + $slots[1] = $slots[1] > $slots[0] ? $slots[0] : $slots[1]; - $aPacks = sys::b64djs($tarif['packs']); + $aPacks = sys::b64djs($tarif['packs']); - if(!array_key_exists($aData['pack'], $aPacks)) - sys::outjs(array('e' => 'Указанная сборка не найдена.')); + if(!array_key_exists($aData['pack'], $aPacks)) + sys::outjs(array('e' => 'Указанная сборка не найдена.')); - if($aData['core_fix_one']) - { - if($aData['core_fix']) - { - $sql->query('SELECT `id` FROM `servers` WHERE `id`!="'.$id.'" AND `unit`="'.$server['unit'].'" AND `core_fix`="'.$aData['core_fix'].'" AND `core_fix_one`="1"'); - if($sql->num()) - sys::outjs(array('e' => 'Указанное ядро занято другим сервером.')); - }else - $aData['core_fix_one'] = 0; - } + if($aData['core_fix_one']) + { + if($aData['core_fix']) + { + $sql->query('SELECT `id` FROM `servers` WHERE `id`!="'.$id.'" AND `unit`="'.$server['unit'].'" AND `core_fix`="'.$aData['core_fix'].'" AND `core_fix_one`="1"'); + if($sql->num()) + sys::outjs(array('e' => 'Указанное ядро занято другим сервером.')); + }else + $aData['core_fix_one'] = 0; + } - if(!in_array($aData['pingboost'], array(1,2,3))) - $aData['pingboost'] = 0; + if(!in_array($aData['pingboost'], array(1,2,3))) + $aData['pingboost'] = 0; - $aData['time'] = sys::checkdate($aData['time']); + $aData['time'] = sys::checkdate($aData['time']); - foreach(array('ftp_use', 'plugins_use', 'console_use', 'stats_use', 'copy_use', 'web_use') as $section) - $aData[$section] = (string) $aData[$section] == 'on' ? '1' : '0'; + foreach(array('ftp_use', 'plugins_use', 'console_use', 'stats_use', 'copy_use', 'web_use') as $section) + $aData[$section] = (string) $aData[$section] == 'on' ? '1' : '0'; - $sql->query('UPDATE `servers` set ' - .'`user`="'.$aData['user'].'",' - .'`address`="'.$aData['address'].'",' - .'`port`="'.$aData['port'].'",' - .'`slots`="'.$slots[0].'",' - .'`slots_start`="'.$slots[1].'",' - .'`fps`="'.$aData['fps'].'",' - .'`tickrate`="'.$aData['tickrate'].'",' - .'`ram`="'.$aData['ram'].'",' - .'`core_fix`="'.$aData['core_fix'].'",' - .'`core_fix_one`="'.$aData['core_fix_one'].'",' - .'`cpu_use_max`="'.$aData['cpu_use_max'].'",' - .'`pingboost`="'.$aData['pingboost'].'",' - .'`time`="'.$aData['time'].'",' - .'`ftp_use`="'.$aData['ftp_use'].'",' - .'`ftp_root`="'.$aData['ftp_root'].'",' - .'`plugins_use`="'.$aData['plugins_use'].'",' - .'`console_use`="'.$aData['console_use'].'",' - .'`stats_use`="'.$aData['stats_use'].'",' - .'`copy_use`="'.$aData['copy_use'].'",' - .'`web_use`="'.$aData['web_use'].'",' - .'`pack`="'.$aData['pack'].'",' - .'`hdd`="'.$aData['hdd'].'" WHERE `id`="'.$id.'" LIMIT 1'); + $sql->query('UPDATE `servers` set ' + .'`user`="'.$aData['user'].'",' + .'`address`="'.$aData['address'].'",' + .'`port`="'.$aData['port'].'",' + .'`slots`="'.$slots[0].'",' + .'`slots_start`="'.$slots[1].'",' + .'`fps`="'.$aData['fps'].'",' + .'`tickrate`="'.$aData['tickrate'].'",' + .'`ram`="'.$aData['ram'].'",' + .'`core_fix`="'.$aData['core_fix'].'",' + .'`core_fix_one`="'.$aData['core_fix_one'].'",' + .'`cpu_use_max`="'.$aData['cpu_use_max'].'",' + .'`pingboost`="'.$aData['pingboost'].'",' + .'`time`="'.$aData['time'].'",' + .'`ftp_use`="'.$aData['ftp_use'].'",' + .'`ftp_root`="'.$aData['ftp_root'].'",' + .'`plugins_use`="'.$aData['plugins_use'].'",' + .'`console_use`="'.$aData['console_use'].'",' + .'`stats_use`="'.$aData['stats_use'].'",' + .'`copy_use`="'.$aData['copy_use'].'",' + .'`web_use`="'.$aData['web_use'].'",' + .'`pack`="'.$aData['pack'].'",' + .'`hdd`="'.$aData['hdd'].'" WHERE `id`="'.$id.'" LIMIT 1'); - $sql->query('UPDATE `web` set `user`="'.$aData['user'].'" WHERE `server`="'.$id.'"'); + $sql->query('UPDATE `web` set `user`="'.$aData['user'].'" WHERE `server`="'.$id.'"'); - $mcache->delete('server_index_'.$id); - $mcache->delete('server_resources_'.$id); - $mcache->delete('server_status_'.$id); + $mcache->delete('server_index_'.$id); + $mcache->delete('server_resources_'.$id); + $mcache->delete('server_status_'.$id); - sys::outjs(array('s' => 'ok')); - } + sys::outjs(array('s' => 'ok')); + } - $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); - $packs = ''; + $packs = ''; - $aPacks = sys::b64djs($tarif['packs']); + $aPacks = sys::b64djs($tarif['packs']); - foreach($aPacks as $name => $fullname) - $packs .= ''; + foreach($aPacks as $name => $fullname) + $packs .= ''; - $packs = str_replace('"'.$server['pack'].'"', '"'.$server['pack'].'" selected', $packs); + $packs = str_replace('"'.$server['pack'].'"', '"'.$server['pack'].'" selected', $packs); - $cfo = $server['core_fix_one'] ? '' : ''; - $pingboost = str_replace('="'.$server['pingboost'].'"', '="'.$server['pingboost'].'" selected', ''); - $ftp_root = $server['ftp_root'] ? '' : ''; + $cfo = $server['core_fix_one'] ? '' : ''; + $pingboost = str_replace('="'.$server['pingboost'].'"', '="'.$server['pingboost'].'" selected', ''); + $ftp_root = $server['ftp_root'] ? '' : ''; - $tarifs = ''; + $tarifs = ''; - $sql->query('SELECT `id`, `name` FROM `tarifs` WHERE `unit`="'.$server['unit'].'" AND `game`="'.$server['game'].'" AND `id`!="'.$server['tarif'].'"'); - while($tarif_list = $sql->get()) - $tarifs .= ''; + $sql->query('SELECT `id`, `name` FROM `tarifs` WHERE `unit`="'.$server['unit'].'" AND `game`="'.$server['game'].'" AND `id`!="'.$server['tarif'].'"'); + while($tarif_list = $sql->get()) + $tarifs .= ''; - $copys = $sql->query('SELECT `id`, `user` FROM `copy` WHERE `server`="'.$id.'" LIMIT 10'); - while($copy = $sql->get($copys)) - { - $aCP = explode('_', $copy['user']); + $copys = $sql->query('SELECT `id`, `user` FROM `copy` WHERE `server`="'.$id.'" LIMIT 10'); + while($copy = $sql->get($copys)) + { + $aCP = explode('_', $copy['user']); - if($aCP[0] != $aData['user']) - $sql->query('UPDATE `copy` set `user`="'.$aData['user'].'_'.$aCP[1].'" WHERE `id`="'.$copy['id'].' LIMIT 1'); - } + if($aCP[0] != $aData['user']) + $sql->query('UPDATE `copy` set `user`="'.$aData['user'].'_'.$aCP[1].'" WHERE `id`="'.$copy['id'].' LIMIT 1'); + } - $html->get('server', 'sections/servers'); - $html->set('id', $id); - $html->set('name', $server['name']); - $html->set('address', $server['address']); - $html->set('port', $server['port']); - $html->set('slots', $server['slots']); - $html->set('slots_start', $server['slots_start']); - $html->set('user', $server['user']); - $html->set('game', $server['game']); - $html->set('unit', $unit['name']); - $html->set('tarif', '#'.$server['tarif'].' '.$tarif['name']); - $html->set('hdd', $server['hdd']); - $html->set('fps', $server['fps']); - $html->set('tickrate', $server['tickrate']); - $html->set('ram', $server['ram']); - $html->set('ftp_on', $server['ftp_on'] ? 'Использовался' : 'Не использовался'); - $html->set('tarifs', $tarifs); - $html->set('pingboost', $pingboost); - $html->set('ftp_root', $ftp_root); - $html->set('core_fix', $server['core_fix']); - $html->set('cpu_use_max', $server['cpu_use_max']); - $html->set('cpu_limi', $cfg['cpu_use_max'][$server['game']]); - $html->set('core_fix_one', $cfo); - $html->set('packs', $packs); - $html->set('time', date('d/m/Y H:i', $server['time'])); - $html->set('date', date('d.m.Y - H:i:s', $server['date'])); - $html->set('overdue', $server['overdue'] == 0 ? 'Установить' : date('d/m/Y H:i', $server['overdue'])); - $html->set('block', $server['block'] == 0 ? 'Заблокировать' : date('d/m/Y H:i', $server['block'])); + $html->get('server', 'sections/servers'); + $html->set('id', $id); + $html->set('name', $server['name']); + $html->set('address', $server['address']); + $html->set('port', $server['port']); + $html->set('slots', $server['slots']); + $html->set('slots_start', $server['slots_start']); + $html->set('user', $server['user']); + $html->set('game', $server['game']); + $html->set('unit', $unit['name']); + $html->set('tarif', '#'.$server['tarif'].' '.$tarif['name']); + $html->set('hdd', $server['hdd']); + $html->set('fps', $server['fps']); + $html->set('tickrate', $server['tickrate']); + $html->set('ram', $server['ram']); + $html->set('ftp_on', $server['ftp_on'] ? 'Использовался' : 'Не использовался'); + $html->set('tarifs', $tarifs); + $html->set('pingboost', $pingboost); + $html->set('ftp_root', $ftp_root); + $html->set('core_fix', $server['core_fix']); + $html->set('cpu_use_max', $server['cpu_use_max']); + $html->set('cpu_limi', $cfg['cpu_use_max'][$server['game']]); + $html->set('core_fix_one', $cfo); + $html->set('packs', $packs); + $html->set('time', date('d/m/Y H:i', $server['time'])); + $html->set('date', date('d.m.Y - H:i:s', $server['date'])); + $html->set('overdue', $server['overdue'] == 0 ? 'Установить' : date('d/m/Y H:i', $server['overdue'])); + $html->set('block', $server['block'] == 0 ? 'Заблокировать' : date('d/m/Y H:i', $server['block'])); - foreach(array('ftp_use', 'plugins_use', 'console_use', 'stats_use', 'copy_use', 'web_use') as $section) - { - if($server[$section]) - $html->unit($section, 1); - else - $html->unit($section); - } + foreach(array('ftp_use', 'plugins_use', 'console_use', 'stats_use', 'copy_use', 'web_use') as $section) + { + if($server[$section]) + $html->unit($section, 1); + else + $html->unit($section); + } - $html->pack('main'); + $html->pack('main'); ?> \ No newline at end of file diff --git a/system/acp/sections/tarifs/add.php b/system/acp/sections/tarifs/add.php index a355e9f..7cffff9 100644 --- a/system/acp/sections/tarifs/add.php +++ b/system/acp/sections/tarifs/add.php @@ -1,416 +1,416 @@ 'Необходимо указать название')); + if($aData['name'] == '') + sys::outjs(array('e' => 'Необходимо указать название')); - $sql->query('SELECT `id` FROM `units` WHERE `id`="'.$aData['unit'].'" LIMIT 1'); - if(!$sql->num()) - sys::outjs(array('e' => 'Необходимо указать локацию')); + $sql->query('SELECT `id` FROM `units` WHERE `id`="'.$aData['unit'].'" LIMIT 1'); + if(!$sql->num()) + sys::outjs(array('e' => 'Необходимо указать локацию')); - if(!in_array($aData['game'], array('cs', 'cssold', 'css', 'csgo', 'samp', 'crmp', 'mta', 'mc'))) - sys::outjs(array('e' => 'Необходимо указать игру')); + if(!in_array($aData['game'], array('cs', 'cssold', 'css', 'csgo', 'samp', 'crmp', 'mta', 'mc'))) + sys::outjs(array('e' => 'Необходимо указать игру')); - $aSlots = explode('-', $aData['slots']); + $aSlots = explode('-', $aData['slots']); - if(!isset($aSlots[0]) || !isset($aSlots[1])) - sys::outjs(array('e' => 'Необходимо указать слоты')); + if(!isset($aSlots[0]) || !isset($aSlots[1])) + sys::outjs(array('e' => 'Необходимо указать слоты')); - $aSlots[0] = trim($aSlots[0]); - $aSlots[1] = trim($aSlots[1]); + $aSlots[0] = trim($aSlots[0]); + $aSlots[1] = trim($aSlots[1]); - $aData['slots_min'] = $aSlots[0] > 1 ? $aSlots[0] : sys::outjs(array('e' => 'Неправильно указаны слоты')); - $aData['slots_max'] = $aSlots[1] >= $aSlots[0] ? $aSlots[1] : sys::outjs(array('e' => 'Неправильно указаны слоты')); + $aData['slots_min'] = $aSlots[0] > 1 ? $aSlots[0] : sys::outjs(array('e' => 'Неправильно указаны слоты')); + $aData['slots_max'] = $aSlots[1] >= $aSlots[0] ? $aSlots[1] : sys::outjs(array('e' => 'Неправильно указаны слоты')); - $aPorts = explode('-', $aData['posts']); + $aPorts = explode('-', $aData['posts']); - if(!isset($aPorts[0]) || !isset($aPorts[1])) - sys::outjs(array('e' => 'Необходимо указать порты')); + if(!isset($aPorts[0]) || !isset($aPorts[1])) + sys::outjs(array('e' => 'Необходимо указать порты')); - $aPorts[0] = trim($aPorts[0]); - $aPorts[1] = trim($aPorts[1]); + $aPorts[0] = trim($aPorts[0]); + $aPorts[1] = trim($aPorts[1]); - $aData['port_min'] = $aPorts[0] > 1 ? $aPorts[0] : sys::outjs(array('e' => 'Неправильно указаны порты')); - $aData['port_max'] = $aPorts[1] >= $aPorts[0] ? $aPorts[1] : sys::outjs(array('e' => 'Неправильно указаны порты')); + $aData['port_min'] = $aPorts[0] > 1 ? $aPorts[0] : sys::outjs(array('e' => 'Неправильно указаны порты')); + $aData['port_max'] = $aPorts[1] >= $aPorts[0] ? $aPorts[1] : sys::outjs(array('e' => 'Неправильно указаны порты')); - if($aData['hostname'] == '') - sys::outjs(array('e' => 'Необходимо указать название сервера')); + if($aData['hostname'] == '') + sys::outjs(array('e' => 'Необходимо указать название сервера')); - if($aData['path'] == '') - sys::outjs(array('e' => 'Необходимо указать путь до сборок')); + if($aData['path'] == '') + sys::outjs(array('e' => 'Необходимо указать путь до сборок')); - if($aData['install'] == '') - sys::outjs(array('e' => 'Необходимо указать путь для установки серверов')); + if($aData['install'] == '') + sys::outjs(array('e' => 'Необходимо указать путь для установки серверов')); - if($aData['update'] == '') - sys::outjs(array('e' => 'Необходимо указать путь до обновления сборки')); + if($aData['update'] == '') + sys::outjs(array('e' => 'Необходимо указать путь до обновления сборки')); - if(substr($aData['path'], -1) != '/' || substr($aData['install'], -1) != '/' || substr($aData['update'], -1) != '/') - sys::outjs(array('e' => 'Пути должны заканчиваться символом "/"')); + if(substr($aData['path'], -1) != '/' || substr($aData['install'], -1) != '/' || substr($aData['update'], -1) != '/') + sys::outjs(array('e' => 'Пути должны заканчиваться символом "/"')); - $int = array( - 'Тестов' => 'tests', - 'Положение' => 'sort', - 'Диск' => 'hdd' - ); + $int = array( + 'Тестов' => 'tests', + 'Положение' => 'sort', + 'Диск' => 'hdd' + ); - foreach($int as $name => $input) - { - if($aData[$input] == '') - sys::outjs(array('e' => 'Необходимо указать поле "'.$name.'"')); - } + foreach($int as $name => $input) + { + if($aData[$input] == '') + sys::outjs(array('e' => 'Необходимо указать поле "'.$name.'"')); + } - $aPacks = explode(',', $aData['packs']); + $aPacks = explode(',', $aData['packs']); - $packs = array(); + $packs = array(); - foreach($aPacks as $pack) - { - $aPack = explode(':', trim($pack)); + foreach($aPacks as $pack) + { + $aPack = explode(':', trim($pack)); - if(!isset($aPack[0]) || !isset($aPack[1])) - continue; + if(!isset($aPack[0]) || !isset($aPack[1])) + continue; - $name = str_replace('"', '', $aPack[0]); - $fullname = str_replace('"', '', $aPack[1]); + $name = str_replace('"', '', $aPack[0]); + $fullname = str_replace('"', '', $aPack[1]); - $packs[trim($name)] = trim($fullname); - } + $packs[trim($name)] = trim($fullname); + } - if(!count($packs)) - sys::outjs(array('e' => 'Необходимо указать минимум одну сборку')); + if(!count($packs)) + sys::outjs(array('e' => 'Необходимо указать минимум одну сборку')); - $aData['packs'] = sys::b64js($packs); + $aData['packs'] = sys::b64js($packs); - $aIp = explode(':', $aData['ip']); + $aIp = explode(':', $aData['ip']); - $ips = ''; + $ips = ''; - foreach($aIp as $ip) - { - $ip = trim($ip); + foreach($aIp as $ip) + { + $ip = trim($ip); - if(sys::valid($ip, 'ip')) - continue; + if(sys::valid($ip, 'ip')) + continue; - $ips .= $ip.':'; - } + $ips .= $ip.':'; + } - $ips = isset($ips{0}) ? substr($ips, 0, -1) : ''; + $ips = isset($ips{0}) ? substr($ips, 0, -1) : ''; - $aData['ip'] = $ips; + $aData['ip'] = $ips; - $aPlugins = explode('","', $aData['plugins_install']); + $aPlugins = explode('","', $aData['plugins_install']); - $plugins = array(); + $plugins = array(); - foreach($aPlugins as $plugin) - { - $aPlugin = explode(':', trim($plugin)); + foreach($aPlugins as $plugin) + { + $aPlugin = explode(':', trim($plugin)); - if(!isset($aPlugin[0]) || !isset($aPlugin[1])) - continue; + if(!isset($aPlugin[0]) || !isset($aPlugin[1])) + continue; - $name = trim(str_replace('"', '', $aPlugin[0])); + $name = trim(str_replace('"', '', $aPlugin[0])); - if(!isset($packs[$name])) - continue; + if(!isset($packs[$name])) + continue; - $aList = explode(',', str_replace('"', '', $aPlugin[1])); + $aList = explode(',', str_replace('"', '', $aPlugin[1])); - $list = ''; + $list = ''; - foreach($aList as $pid) - { - $pid = trim($pid); + foreach($aList as $pid) + { + $pid = trim($pid); - if(!is_numeric($pid)) - continue; + if(!is_numeric($pid)) + continue; - $list .= intval($pid).','; - } + $list .= intval($pid).','; + } - $list = isset($list{0}) ? substr($list, 0, -1) : ''; + $list = isset($list{0}) ? substr($list, 0, -1) : ''; - if($list == '') - continue; + if($list == '') + continue; - $plugins[$name] = $list; - } + $plugins[$name] = $list; + } - $aData['plugins_install'] = count($plugins) ? sys::b64js($plugins) : ''; + $aData['plugins_install'] = count($plugins) ? sys::b64js($plugins) : ''; - $aCores = explode(',', $aData['core_fix']); + $aCores = explode(',', $aData['core_fix']); - $cores = ''; + $cores = ''; - foreach($aCores as $core) - { - $core = trim($core); + foreach($aCores as $core) + { + $core = trim($core); - if(!is_numeric($core)) - continue; + if(!is_numeric($core)) + continue; - if($core < 1) - continue; + if($core < 1) + continue; - $cores .= intval($core).','; - } + $cores .= intval($core).','; + } - $cores = isset($cores{0}) ? substr($cores, 0, -1) : ''; + $cores = isset($cores{0}) ? substr($cores, 0, -1) : ''; - $aData['core_fix'] = $cores; + $aData['core_fix'] = $cores; - $aTime = explode(':', $aData['time']); + $aTime = explode(':', $aData['time']); - $times = ''; + $times = ''; - foreach($aTime as $time) - { - $time = trim($time); + foreach($aTime as $time) + { + $time = trim($time); - if(!is_numeric($time)) - continue; + if(!is_numeric($time)) + continue; - $times .= intval($time).':'; - } + $times .= intval($time).':'; + } - $times = isset($times{0}) ? substr($times, 0, -1) : ''; + $times = isset($times{0}) ? substr($times, 0, -1) : ''; - $aData['time'] = $times; + $aData['time'] = $times; - $aTimext = explode(':', $aData['timext']); + $aTimext = explode(':', $aData['timext']); - $timexts = ''; + $timexts = ''; - foreach($aTimext as $timext) - { - $timext = trim($timext); + foreach($aTimext as $timext) + { + $timext = trim($timext); - if(!is_numeric($timext)) - continue; + if(!is_numeric($timext)) + continue; - $timexts .= intval($timext).':'; - } + $timexts .= intval($timext).':'; + } - $timexts = isset($timexts{0}) ? substr($timexts, 0, -1) : ''; + $timexts = isset($timexts{0}) ? substr($timexts, 0, -1) : ''; - $aData['timext'] = $timexts; + $aData['timext'] = $timexts; - $aFps = explode(':', $aData['fps']); + $aFps = explode(':', $aData['fps']); - $sfps = ''; + $sfps = ''; - foreach($aFps as $fps) - { - $fps = trim($fps); + foreach($aFps as $fps) + { + $fps = trim($fps); - if(!is_numeric($fps)) - continue; + if(!is_numeric($fps)) + continue; - $sfps .= intval($fps).':'; - } + $sfps .= intval($fps).':'; + } - $sfps = isset($sfps{0}) ? substr($sfps, 0, -1) : ''; + $sfps = isset($sfps{0}) ? substr($sfps, 0, -1) : ''; - $aData['fps'] = $sfps; + $aData['fps'] = $sfps; - $aTick = explode(':', $aData['tickrate']); + $aTick = explode(':', $aData['tickrate']); - $stick = ''; + $stick = ''; - foreach($aTick as $tick) - { - $tick = trim($tick); + foreach($aTick as $tick) + { + $tick = trim($tick); - if(!is_numeric($tick)) - continue; + if(!is_numeric($tick)) + continue; - $stick .= intval($tick).':'; - } + $stick .= intval($tick).':'; + } - $stick = isset($stick{0}) ? substr($stick, 0, -1) : ''; + $stick = isset($stick{0}) ? substr($stick, 0, -1) : ''; - $aData['tickrate'] = $stick; + $aData['tickrate'] = $stick; - $aRam = explode(':', $aData['ram']); + $aRam = explode(':', $aData['ram']); - $sram = ''; + $sram = ''; - foreach($aRam as $ram) - { - $ram = trim($ram); + foreach($aRam as $ram) + { + $ram = trim($ram); - if(!is_numeric($ram)) - continue; + if(!is_numeric($ram)) + continue; - $sram .= intval($ram).':'; - } + $sram .= intval($ram).':'; + } - $sram = isset($sram{0}) ? substr($sram, 0, -1) : ''; + $sram = isset($sram{0}) ? substr($sram, 0, -1) : ''; - $aData['ram'] = $sram; + $aData['ram'] = $sram; - $aPrice = explode(':', $aData['price']); + $aPrice = explode(':', $aData['price']); - $sprice = ''; + $sprice = ''; - foreach($aPrice as $price) - { - $price = trim($price); + foreach($aPrice as $price) + { + $price = trim($price); - if(!is_numeric($price)) - continue; + if(!is_numeric($price)) + continue; - $sprice .= $price.':'; - } + $sprice .= $price.':'; + } - $sprice = isset($sprice{0}) ? substr($sprice, 0, -1) : ''; + $sprice = isset($sprice{0}) ? substr($sprice, 0, -1) : ''; - $aData['price'] = $sprice; + $aData['price'] = $sprice; - switch($aData['game']) - { - case 'cs': - if(count(explode(':', $aData['fps'])) != count(explode(':', $aData['price']))) - sys::outjs(array('e' => 'Неправильно указано поле "Цена"')); + switch($aData['game']) + { + case 'cs': + if(count(explode(':', $aData['fps'])) != count(explode(':', $aData['price']))) + sys::outjs(array('e' => 'Неправильно указано поле "Цена"')); - break; + break; - case 'cssold': - $afps = explode(':', $aData['fps']); - $atick = explode(':', $aData['tickrate']); - $aprice = explode(':', $aData['price']); + case 'cssold': + $afps = explode(':', $aData['fps']); + $atick = explode(':', $aData['tickrate']); + $aprice = explode(':', $aData['price']); - if((count($afps)*count($atick)) != count($aprice)) - sys::outjs(array('e' => 'Неправильно указано поле "Цена"')); + if((count($afps)*count($atick)) != count($aprice)) + sys::outjs(array('e' => 'Неправильно указано поле "Цена"')); - $price = array(); + $price = array(); - $i = 0; + $i = 0; - foreach($afps as $fps) - { - foreach($atick as $tick) - { - $price[$tick.'_'.$fps] = $aprice[$i]; + foreach($afps as $fps) + { + foreach($atick as $tick) + { + $price[$tick.'_'.$fps] = $aprice[$i]; - $i+=1; - } - } + $i+=1; + } + } - $aData['price'] = sys::b64js($price); + $aData['price'] = sys::b64js($price); - break; + break; - case 'css': - case 'csgo': - if(count(explode(':', $aData['tickrate'])) != count(explode(':', $aData['price']))) - sys::outjs(array('e' => 'Неправильно указано поле "Цена"')); + case 'css': + case 'csgo': + if(count(explode(':', $aData['tickrate'])) != count(explode(':', $aData['price']))) + sys::outjs(array('e' => 'Неправильно указано поле "Цена"')); - break; + break; - case 'mc': - if(count(explode(':', $aData['ram'])) != count(explode(':', $aData['price']))) - sys::outjs(array('e' => 'Неправильно указано поле "Цена"')); + case 'mc': + if(count(explode(':', $aData['ram'])) != count(explode(':', $aData['price']))) + sys::outjs(array('e' => 'Неправильно указано поле "Цена"')); - } + } - $access = array('ftp', 'plugins', 'console', 'stats', 'copy', 'web'); + $access = array('ftp', 'plugins', 'console', 'stats', 'copy', 'web'); - foreach($access as $section) - $aData[$section] = (string) $aData[$section] == 'on' ? '1' : '0'; + foreach($access as $section) + $aData[$section] = (string) $aData[$section] == 'on' ? '1' : '0'; - $sql->query('INSERT INTO `tarifs` set' - .'`unit`="'.$aData['unit'].'",' - .'`game`="'.$aData['game'].'",' - .'`name`="'.htmlspecialchars($aData['name']).'",' - .'`slots_min`="'.$aData['slots_min'].'",' - .'`slots_max`="'.$aData['slots_max'].'",' - .'`port_min`="'.$aData['port_min'].'",' - .'`port_max`="'.$aData['port_max'].'",' - .'`hostname`="'.htmlspecialchars($aData['hostname']).'",' - .'`packs`="'.$aData['packs'].'",' - .'`path`="'.addslashes($aData['path']).'",' - .'`install`="'.addslashes($aData['install']).'",' - .'`update`="'.addslashes($aData['update']).'",' - .'`fps`="'.$aData['fps'].'",' - .'`tickrate`="'.$aData['tickrate'].'",' - .'`ram`="'.$aData['ram'].'",' - .'`param_fix`="'.$aData['param_fix'].'",' - .'`time`="'.$aData['time'].'",' - .'`timext`="'.$aData['timext'].'",' - .'`test`="'.$aData['test'].'",' - .'`tests`="'.$aData['tests'].'",' - .'`discount`="'.$aData['discount'].'",' - .'`map`="'.addslashes($aData['map']).'",' - .'`ftp`="'.$aData['ftp'].'",' - .'`plugins`="'.$aData['plugins'].'",' - .'`console`="'.$aData['console'].'",' - .'`stats`="'.$aData['stats'].'",' - .'`copy`="'.$aData['copy'].'",' - .'`web`="'.$aData['web'].'",' - .'`plugins_install`="'.$aData['plugins_install'].'",' - .'`hdd`="'.$aData['hdd'].'",' - .'`autostop`="'.$aData['autostop'].'",' - .'`price`="'.$aData['price'].'",' - .'`core_fix`="'.$aData['core_fix'].'",' - .'`ip`="'.$aData['ip'].'",' - .'`show`="'.$aData['show'].'",' - .'`sort`="'.$aData['sort'].'"'); - - sys::outjs(array('s' => 'ok')); - } - - $units = ''; - - $sql->query('SELECT `id`, `name` FROM `units` ORDER BY `id` ASC'); - while($unit = $sql->get()) - $units .= ''; - - $html->get('add', 'sections/tarifs'); - - $html->set('units', $units); - - $html->pack('main'); + $sql->query('INSERT INTO `tarifs` set' + .'`unit`="'.$aData['unit'].'",' + .'`game`="'.$aData['game'].'",' + .'`name`="'.htmlspecialchars($aData['name']).'",' + .'`slots_min`="'.$aData['slots_min'].'",' + .'`slots_max`="'.$aData['slots_max'].'",' + .'`port_min`="'.$aData['port_min'].'",' + .'`port_max`="'.$aData['port_max'].'",' + .'`hostname`="'.htmlspecialchars($aData['hostname']).'",' + .'`packs`="'.$aData['packs'].'",' + .'`path`="'.addslashes($aData['path']).'",' + .'`install`="'.addslashes($aData['install']).'",' + .'`update`="'.addslashes($aData['update']).'",' + .'`fps`="'.$aData['fps'].'",' + .'`tickrate`="'.$aData['tickrate'].'",' + .'`ram`="'.$aData['ram'].'",' + .'`param_fix`="'.$aData['param_fix'].'",' + .'`time`="'.$aData['time'].'",' + .'`timext`="'.$aData['timext'].'",' + .'`test`="'.$aData['test'].'",' + .'`tests`="'.$aData['tests'].'",' + .'`discount`="'.$aData['discount'].'",' + .'`map`="'.addslashes($aData['map']).'",' + .'`ftp`="'.$aData['ftp'].'",' + .'`plugins`="'.$aData['plugins'].'",' + .'`console`="'.$aData['console'].'",' + .'`stats`="'.$aData['stats'].'",' + .'`copy`="'.$aData['copy'].'",' + .'`web`="'.$aData['web'].'",' + .'`plugins_install`="'.$aData['plugins_install'].'",' + .'`hdd`="'.$aData['hdd'].'",' + .'`autostop`="'.$aData['autostop'].'",' + .'`price`="'.$aData['price'].'",' + .'`core_fix`="'.$aData['core_fix'].'",' + .'`ip`="'.$aData['ip'].'",' + .'`show`="'.$aData['show'].'",' + .'`sort`="'.$aData['sort'].'"'); + + sys::outjs(array('s' => 'ok')); + } + + $units = ''; + + $sql->query('SELECT `id`, `name` FROM `units` ORDER BY `id` ASC'); + while($unit = $sql->get()) + $units .= ''; + + $html->get('add', 'sections/tarifs'); + + $html->set('units', $units); + + $html->pack('main'); ?> \ No newline at end of file diff --git a/system/acp/sections/tarifs/copy.php b/system/acp/sections/tarifs/copy.php index 4e6398c..ad8158f 100644 --- a/system/acp/sections/tarifs/copy.php +++ b/system/acp/sections/tarifs/copy.php @@ -1,84 +1,84 @@ query('SELECT * FROM `tarifs` WHERE `id`="'.$id.'" LIMIT 1'); - $tarif = $sql->get(); + $sql->query('SELECT * FROM `tarifs` WHERE `id`="'.$id.'" LIMIT 1'); + $tarif = $sql->get(); - $games = '' - .'' - .''; + $games = '' + .'' + .''; - $fix = $tarif['param_fix'] ? '' : ''; - $test = $tarif['test'] ? '' : ''; - $discount = $tarif['discount'] ? '' : ''; - $autostop = $tarif['autostop'] ? '' : ''; - $show = $tarif['show'] ? '' : ''; + $fix = $tarif['param_fix'] ? '' : ''; + $test = $tarif['test'] ? '' : ''; + $discount = $tarif['discount'] ? '' : ''; + $autostop = $tarif['autostop'] ? '' : ''; + $show = $tarif['show'] ? '' : ''; - $units = ''; + $units = ''; - $sql->query('SELECT `id`, `name` FROM `units` ORDER BY `id` ASC'); - while($unit = $sql->get()) - $units .= ''; + $sql->query('SELECT `id`, `name` FROM `units` ORDER BY `id` ASC'); + while($unit = $sql->get()) + $units .= ''; - $games = str_replace('"'.$tarif['game'].'"', '"'.$tarif['game'].'" selected="select"', $games); + $games = str_replace('"'.$tarif['game'].'"', '"'.$tarif['game'].'" selected="select"', $games); - $html->get('copy', 'sections/tarifs'); + $html->get('copy', 'sections/tarifs'); - if($tarif['game'] == 'cssold') - { - $sprice = ''; + if($tarif['game'] == 'cssold') + { + $sprice = ''; - $aPrice = sys::b64djs($tarif['price']); + $aPrice = sys::b64djs($tarif['price']); - foreach($aPrice as $price) - $sprice .= $price.':'; + foreach($aPrice as $price) + $sprice .= $price.':'; - $sprice = isset($sprice{0}) ? substr($sprice, 0, -1) : ''; + $sprice = isset($sprice{0}) ? substr($sprice, 0, -1) : ''; - $tarif['price'] = $sprice; - } + $tarif['price'] = $sprice; + } - foreach($tarif as $field => $val) - $html->set($field, $val); + foreach($tarif as $field => $val) + $html->set($field, $val); - $html->set('units', $units); - $html->set('games', $games); - $html->set('param_fix', $fix); - $html->set('test', $test); - $html->set('discount', $discount); - $html->set('autostop', $autostop); - $html->set('show', $show); + $html->set('units', $units); + $html->set('games', $games); + $html->set('param_fix', $fix); + $html->set('test', $test); + $html->set('discount', $discount); + $html->set('autostop', $autostop); + $html->set('show', $show); - foreach(array('ftp', 'plugins', 'console', 'stats', 'copy', 'web') as $section) - { - if($tarif[$section]) - $html->unit($section, 1); - else - $html->unit($section); - } + foreach(array('ftp', 'plugins', 'console', 'stats', 'copy', 'web') as $section) + { + if($tarif[$section]) + $html->unit($section, 1); + else + $html->unit($section); + } - $packs = ''; + $packs = ''; - $aPacks = sys::b64djs($tarif['packs']); + $aPacks = sys::b64djs($tarif['packs']); - foreach($aPacks as $name => $fullname) - $packs .= '"'.$name.'":"'.$fullname.'",'; + foreach($aPacks as $name => $fullname) + $packs .= '"'.$name.'":"'.$fullname.'",'; - $packs = isset($packs{0}) ? substr($packs, 0, -1) : ''; + $packs = isset($packs{0}) ? substr($packs, 0, -1) : ''; - $html->set('packs', $packs); + $html->set('packs', $packs); - $plugins = ''; + $plugins = ''; - $aPlugins = sys::b64djs($tarif['plugins_install']); + $aPlugins = sys::b64djs($tarif['plugins_install']); - foreach($aPlugins as $pack => $list) - $plugins .= '"'.$pack.'":"'.$list.'",'; + foreach($aPlugins as $pack => $list) + $plugins .= '"'.$pack.'":"'.$list.'",'; - $plugins = isset($plugins{0}) ? substr($plugins, 0, -1) : ''; + $plugins = isset($plugins{0}) ? substr($plugins, 0, -1) : ''; - $html->set('plugins_install', $plugins); + $html->set('plugins_install', $plugins); - $html->pack('main'); + $html->pack('main'); ?> \ No newline at end of file diff --git a/system/acp/sections/tarifs/delete.php b/system/acp/sections/tarifs/delete.php index f551f28..e9911f9 100644 --- a/system/acp/sections/tarifs/delete.php +++ b/system/acp/sections/tarifs/delete.php @@ -1,12 +1,12 @@ query('SELECT `id` FROM `servers` WHERE `tarif`="'.$id.'" LIMIT 1'); - if($sql->num()) - sys::outjs(array('e' => 'Нельзя удалить тариф с серверами.')); + $sql->query('SELECT `id` FROM `servers` WHERE `tarif`="'.$id.'" LIMIT 1'); + if($sql->num()) + sys::outjs(array('e' => 'Нельзя удалить тариф с серверами.')); - $sql->query('DELETE FROM `tarifs` WHERE `id`="'.$id.'" LIMIT 1'); + $sql->query('DELETE FROM `tarifs` WHERE `id`="'.$id.'" LIMIT 1'); - sys::outjs(array('s' => 'ok')); + sys::outjs(array('s' => 'ok')); ?> \ No newline at end of file diff --git a/system/acp/sections/tarifs/index.php b/system/acp/sections/tarifs/index.php index e30964b..e619c08 100644 --- a/system/acp/sections/tarifs/index.php +++ b/system/acp/sections/tarifs/index.php @@ -1,68 +1,68 @@ $sort); - } + $sort_icon = array($url['sort'] => $sort); + } - $list = ''; + $list = ''; - $sql->query('SELECT `id` FROM `tarifs`'); + $sql->query('SELECT `id` FROM `tarifs`'); - $aPage = sys::page($page, $sql->num(), 20); + $aPage = sys::page($page, $sql->num(), 20); - sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/tarif'.$sort_page); + sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/tarif'.$sort_page); - $tarifs = $sql->query('SELECT `id`, `unit`, `game`, `name`, `slots_min`, `slots_max`, `port_min`, `port_max` FROM `tarifs` '.$sort_sql.' LIMIT '.$aPage['num'].', 20'); - while($tarif = $sql->get($tarifs)) - { - $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$tarif['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $tarifs = $sql->query('SELECT `id`, `unit`, `game`, `name`, `slots_min`, `slots_max`, `port_min`, `port_max` FROM `tarifs` '.$sort_sql.' LIMIT '.$aPage['num'].', 20'); + while($tarif = $sql->get($tarifs)) + { + $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$tarif['unit'].'" LIMIT 1'); + $unit = $sql->get(); - $list .= ''; - $list .= ''.$tarif['id'].''; - $list .= ''.$tarif['name'].''; - $list .= '#'.$tarif['unit'].' '.$unit['name'].''; - $list .= ''.$tarif['slots_min'].'-'.$tarif['slots_max'].''; - $list .= ''.$tarif['port_min'].'-'.$tarif['port_max'].''; - $list .= ''.strtoupper($tarif['game']).''; - $list .= 'Копировать'; - $list .= 'Удалить'; - $list .= ''; - } + $list .= ''; + $list .= ''.$tarif['id'].''; + $list .= ''.$tarif['name'].''; + $list .= '#'.$tarif['unit'].' '.$unit['name'].''; + $list .= ''.$tarif['slots_min'].'-'.$tarif['slots_max'].''; + $list .= ''.$tarif['port_min'].'-'.$tarif['port_max'].''; + $list .= ''.strtoupper($tarif['game']).''; + $list .= 'Копировать'; + $list .= 'Удалить'; + $list .= ''; + } - $html->get('index', 'sections/tarifs'); + $html->get('index', 'sections/tarifs'); - $html->set('sort_id', 'asc'); - $html->set('sort_unit', 'asc'); - $html->set('sort_game', 'asc'); + $html->set('sort_id', 'asc'); + $html->set('sort_unit', 'asc'); + $html->set('sort_game', 'asc'); - if(isset($sort_icon)) - $html->set('sort_'.key($sort_icon), array_shift($sort_icon)); + if(isset($sort_icon)) + $html->set('sort_'.key($sort_icon), array_shift($sort_icon)); - $html->set('list', $list); + $html->set('list', $list); - $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); + $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); - $html->pack('main'); - } + $html->pack('main'); + } ?> \ No newline at end of file diff --git a/system/acp/sections/tarifs/search.php b/system/acp/sections/tarifs/search.php index c7d5552..4098a7b 100644 --- a/system/acp/sections/tarifs/search.php +++ b/system/acp/sections/tarifs/search.php @@ -1,76 +1,76 @@ get($mkey); + $cache = $mcache->get($mkey); - if(is_array($cache)) - { - if($go) - sys::outjs($cache, $nmch); + if(is_array($cache)) + { + if($go) + sys::outjs($cache, $nmch); - sys::outjs($cache); - } + sys::outjs($cache); + } - if(!isset($text{2})) - { - if($go) - sys::outjs(array('e' => 'Для выполнения поиска, необходимо больше данных'), $nmch); + if(!isset($text{2})) + { + if($go) + sys::outjs(array('e' => 'Для выполнения поиска, необходимо больше данных'), $nmch); - sys::outjs(array('e' => '')); - } + sys::outjs(array('e' => '')); + } - if(substr($text, 0, 5) == 'game=') - { - $game = trim(substr($text, 5)); + if(substr($text, 0, 5) == 'game=') + { + $game = trim(substr($text, 5)); - if(in_array($game, array('cs', 'cssold', 'css', 'csgo', 'samp', 'crmp', 'mta', 'mc'))) - $tarifs = $sql->query('SELECT `id`, `unit`, `game`, `name`, `slots_min`, `slots_max`, `port_min`, `port_max` FROM `tarifs` WHERE `game`="'.$game.'" ORDER BY `id` ASC'); - }elseif($text{0} == 'i' AND $text{1} == 'd') - $tarifs = $sql->query('SELECT `id`, `unit`, `game`, `name`, `slots_min`, `slots_max`, `port_min`, `port_max` FROM `tarifs` WHERE `id`="'.sys::int($text).'" LIMIT 1'); - else{ - $like = '`id` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' - .'`name` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' - .'`game` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' - .'`slots_min` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' - .'`slots_max` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' - .'`port_min` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' - .'`port_max` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\')'; + if(in_array($game, array('cs', 'cssold', 'css', 'csgo', 'samp', 'crmp', 'mta', 'mc'))) + $tarifs = $sql->query('SELECT `id`, `unit`, `game`, `name`, `slots_min`, `slots_max`, `port_min`, `port_max` FROM `tarifs` WHERE `game`="'.$game.'" ORDER BY `id` ASC'); + }elseif($text{0} == 'i' AND $text{1} == 'd') + $tarifs = $sql->query('SELECT `id`, `unit`, `game`, `name`, `slots_min`, `slots_max`, `port_min`, `port_max` FROM `tarifs` WHERE `id`="'.sys::int($text).'" LIMIT 1'); + else{ + $like = '`id` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' + .'`name` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' + .'`game` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' + .'`slots_min` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' + .'`slots_max` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' + .'`port_min` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' + .'`port_max` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\')'; - $tarifs = $sql->query('SELECT `id`, `unit`, `game`, `name`, `slots_min`, `slots_max`, `port_min`, `port_max` FROM `tarifs` WHERE '.$like.' ORDER BY `id` ASC LIMIT 10'); - } + $tarifs = $sql->query('SELECT `id`, `unit`, `game`, `name`, `slots_min`, `slots_max`, `port_min`, `port_max` FROM `tarifs` WHERE '.$like.' ORDER BY `id` ASC LIMIT 10'); + } - if(!$sql->num($tarifs)) - { - if($go) - sys::outjs(array('e' => 'По вашему запросу ничего не найдено'), $nmch); + if(!$sql->num($tarifs)) + { + if($go) + sys::outjs(array('e' => 'По вашему запросу ничего не найдено'), $nmch); - sys::outjs(array('e' => 'По вашему запросу ничего не найдено')); - } + sys::outjs(array('e' => 'По вашему запросу ничего не найдено')); + } - $list = ''; + $list = ''; - while($tarif = $sql->get($tarifs)) - { - $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$tarif['unit'].'" LIMIT 1'); - $unit = $sql->get(); + while($tarif = $sql->get($tarifs)) + { + $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$tarif['unit'].'" LIMIT 1'); + $unit = $sql->get(); - $list .= ''; - $list .= ''.$tarif['id'].''; - $list .= ''.$tarif['name'].''; - $list .= ''.$unit['name'].''; - $list .= ''.$tarif['slots_min'].'-'.$tarif['slots_max'].''; - $list .= ''.$tarif['port_min'].'-'.$tarif['port_max'].''; - $list .= ''.strtoupper($tarif['game']).''; - $list .= 'Удалить'; - $list .= ''; - } + $list .= ''; + $list .= ''.$tarif['id'].''; + $list .= ''.$tarif['name'].''; + $list .= ''.$unit['name'].''; + $list .= ''.$tarif['slots_min'].'-'.$tarif['slots_max'].''; + $list .= ''.$tarif['port_min'].'-'.$tarif['port_max'].''; + $list .= ''.strtoupper($tarif['game']).''; + $list .= 'Удалить'; + $list .= ''; + } - $mcache->set($mkey, array('s' => $list), false, 15); + $mcache->set($mkey, array('s' => $list), false, 15); - sys::outjs(array('s' => $list)); + sys::outjs(array('s' => $list)); ?> \ No newline at end of file diff --git a/system/acp/sections/tarifs/stats.php b/system/acp/sections/tarifs/stats.php index 329dd2c..15ea62d 100644 --- a/system/acp/sections/tarifs/stats.php +++ b/system/acp/sections/tarifs/stats.php @@ -1,71 +1,71 @@ query('SELECT `id`, `unit`, `game`, `name` FROM `tarifs` ORDER BY `id` ASC'); - while($tarif = $sql->get($tarifs)) - { - $servers = $sql->query('SELECT `id`, `user` FROM `servers` WHERE `tarif`="'.$tarif['id'].'"'); - $all_servers = $sql->num($servers); + $tarifs = $sql->query('SELECT `id`, `unit`, `game`, `name` FROM `tarifs` ORDER BY `id` ASC'); + while($tarif = $sql->get($tarifs)) + { + $servers = $sql->query('SELECT `id`, `user` FROM `servers` WHERE `tarif`="'.$tarif['id'].'"'); + $all_servers = $sql->num($servers); - $money_all = 0; - $money_month = 0; + $money_all = 0; + $money_month = 0; - $time = date('j', $start_point)*86400; + $time = date('j', $start_point)*86400; - while($server = $sql->get($servers)) - { - $sql->query('SELECT `id` FROM `users` WHERE `id`="'.$server['user'].'" AND `group`="user" LIMIT 1'); - if(!$sql->num()) - continue; + while($server = $sql->get($servers)) + { + $sql->query('SELECT `id` FROM `users` WHERE `id`="'.$server['user'].'" AND `group`="user" LIMIT 1'); + if(!$sql->num()) + continue; - $sql->query('SELECT `money`, `date` FROM `logs` WHERE `user`="'.$server['user'].'" AND (`type`="buy" OR `type`="extend") AND `text` LIKE \'%(сервер: #'.$server['id'].')%\''); - while($logs = $sql->get()) - { - $money_all += $logs['money']; + $sql->query('SELECT `money`, `date` FROM `logs` WHERE `user`="'.$server['user'].'" AND (`type`="buy" OR `type`="extend") AND `text` LIKE \'%(сервер: #'.$server['id'].')%\''); + while($logs = $sql->get()) + { + $money_all += $logs['money']; - if($logs['date'] >= ($start_point-$time)) - $money_month += $logs['money']; - } - } + if($logs['date'] >= ($start_point-$time)) + $money_month += $logs['money']; + } + } - if($money_all < 1) - continue; + if($money_all < 1) + continue; - $all_money += $money_all; - $all_money_month += $money_month; + $all_money += $money_all; + $all_money_month += $money_month; - $sql->query('SELECT `id` FROM `servers` WHERE `tarif`="'.$tarif['id'].'" AND `time`<"'.$start_point.'"'); - $overdue_servers = $sql->num(); + $sql->query('SELECT `id` FROM `servers` WHERE `tarif`="'.$tarif['id'].'" AND `time`<"'.$start_point.'"'); + $overdue_servers = $sql->num(); - $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$tarif['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$tarif['unit'].'" LIMIT 1'); + $unit = $sql->get(); - $list .= ''; - $list .= ''.$tarif['id'].''; - $list .= ''.$tarif['name'].''; - $list .= ''.$unit['name'].''; - $list .= ''.$all_servers.' шт./'.$overdue_servers.' шт.'; - $list .= ''.$money_all.' '.$cfg['currency'].''; - $list .= ''.$money_month.' '.$cfg['currency'].''; - $list .= ''.strtoupper($tarif['game']).''; - $list .= ''; - } + $list .= ''; + $list .= ''.$tarif['id'].''; + $list .= ''.$tarif['name'].''; + $list .= ''.$unit['name'].''; + $list .= ''.$all_servers.' шт./'.$overdue_servers.' шт.'; + $list .= ''.$money_all.' '.$cfg['currency'].''; + $list .= ''.$money_month.' '.$cfg['currency'].''; + $list .= ''.strtoupper($tarif['game']).''; + $list .= ''; + } - $html->get('stats', 'sections/tarifs'); + $html->get('stats', 'sections/tarifs'); - $html->set('list', $list); + $html->set('list', $list); - $html->set('month', mb_strtolower(params::$aNameMonth[sys::int(date('n', $start_point))], 'UTF-8')); + $html->set('month', mb_strtolower(params::$aNameMonth[sys::int(date('n', $start_point))], 'UTF-8')); - $html->set('all_money', $all_money); - $html->set('all_money_month', $all_money_month); - $html->set('cur', $cfg['currency']); + $html->set('all_money', $all_money); + $html->set('all_money_month', $all_money_month); + $html->set('cur', $cfg['currency']); - $html->pack('main'); + $html->pack('main'); ?> \ No newline at end of file diff --git a/system/acp/sections/tarifs/tarif.php b/system/acp/sections/tarifs/tarif.php index b6c7bf6..d2f8bbc 100644 --- a/system/acp/sections/tarifs/tarif.php +++ b/system/acp/sections/tarifs/tarif.php @@ -1,485 +1,485 @@ query('SELECT * FROM `tarifs` WHERE `id`="'.$id.'" LIMIT 1'); - $tarif = $sql->get(); - - if($go) - { - $aData = array(); - - $aData['name'] = isset($_POST['name']) ? trim($_POST['name']) : $tarif['name']; - $aData['unit'] = isset($_POST['unit']) ? sys::int($_POST['unit']) : $tarif['unit']; - $aData['game'] = isset($_POST['game']) ? trim($_POST['game']) : $tarif['game']; - $aData['slots'] = isset($_POST['slots']) ? trim($_POST['slots']) : $tarif['slots']; - $aData['posts'] = isset($_POST['posts']) ? trim($_POST['posts']) : $tarif['posts']; - $aData['hostname'] = isset($_POST['hostname']) ? trim($_POST['hostname']) : $tarif['hostname']; - $aData['packs'] = isset($_POST['packs']) ? trim($_POST['packs']) : $tarif['packs']; - $aData['path'] = isset($_POST['path']) ? trim($_POST['path']) : $tarif['path']; - $aData['install'] = isset($_POST['install']) ? trim($_POST['install']) : $tarif['install']; - $aData['update'] = isset($_POST['update']) ? trim($_POST['update']) : $tarif['update']; - $aData['fps'] = isset($_POST['fps']) ? trim($_POST['fps']) : $tarif['fps']; - $aData['tickrate'] = isset($_POST['tickrate']) ? trim($_POST['tickrate']) : $tarif['tickrate']; - $aData['ram'] = isset($_POST['ram']) ? trim($_POST['ram']) : $tarif['ram']; - $aData['param_fix'] = isset($_POST['param_fix']) ? trim($_POST['param_fix']) : $tarif['param_fix']; - $aData['time'] = isset($_POST['time']) ? trim($_POST['time']) : $tarif['time']; - $aData['timext'] = isset($_POST['timext']) ? trim($_POST['timext']) : $tarif['timext']; - $aData['test'] = isset($_POST['test']) ? sys::int($_POST['test']) : $tarif['test']; - $aData['tests'] = isset($_POST['tests']) ? sys::int($_POST['tests']) : $tarif['tests']; - $aData['discount'] = isset($_POST['discount']) ? sys::int($_POST['discount']) : $tarif['discount']; - $aData['map'] = isset($_POST['map']) ? trim($_POST['map']) : $tarif['map']; - $aData['ftp'] = isset($_POST['ftp']) ? $_POST['ftp'] : $tarif['ftp']; - $aData['plugins'] = isset($_POST['plugins']) ? $_POST['plugins'] : $tarif['plugins']; - $aData['console'] = isset($_POST['console']) ? $_POST['console'] : $tarif['console']; - $aData['stats'] = isset($_POST['stats']) ? $_POST['stats'] : $tarif['stats']; - $aData['copy'] = isset($_POST['copy']) ? $_POST['copy'] : $tarif['copy']; - $aData['web'] = isset($_POST['web']) ? $_POST['web'] : $tarif['web']; - $aData['plugins_install'] = isset($_POST['plugins_install']) ? trim($_POST['plugins_install']) : $tarif['plugins_install']; - $aData['hdd'] = isset($_POST['hdd']) ? sys::int($_POST['hdd']) : $tarif['hdd']; - $aData['autostop'] = isset($_POST['autostop']) ? sys::int($_POST['autostop']) : $tarif['autostop']; - $aData['price'] = isset($_POST['price']) ? trim($_POST['price']) : $tarif['price']; - $aData['core_fix'] = isset($_POST['core_fix']) ? trim($_POST['core_fix']) : $tarif['core_fix']; - $aData['ip'] = isset($_POST['ip']) ? trim($_POST['ip']) : $tarif['ip']; - $aData['show'] = isset($_POST['show']) ? sys::int($_POST['show']) : $tarif['show']; - $aData['sort'] = isset($_POST['sort']) ? sys::int($_POST['sort']) : $tarif['sort']; + if(!DEFINED('EGP')) + exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404')); + + $sql->query('SELECT * FROM `tarifs` WHERE `id`="'.$id.'" LIMIT 1'); + $tarif = $sql->get(); + + if($go) + { + $aData = array(); + + $aData['name'] = isset($_POST['name']) ? trim($_POST['name']) : $tarif['name']; + $aData['unit'] = isset($_POST['unit']) ? sys::int($_POST['unit']) : $tarif['unit']; + $aData['game'] = isset($_POST['game']) ? trim($_POST['game']) : $tarif['game']; + $aData['slots'] = isset($_POST['slots']) ? trim($_POST['slots']) : $tarif['slots']; + $aData['posts'] = isset($_POST['posts']) ? trim($_POST['posts']) : $tarif['posts']; + $aData['hostname'] = isset($_POST['hostname']) ? trim($_POST['hostname']) : $tarif['hostname']; + $aData['packs'] = isset($_POST['packs']) ? trim($_POST['packs']) : $tarif['packs']; + $aData['path'] = isset($_POST['path']) ? trim($_POST['path']) : $tarif['path']; + $aData['install'] = isset($_POST['install']) ? trim($_POST['install']) : $tarif['install']; + $aData['update'] = isset($_POST['update']) ? trim($_POST['update']) : $tarif['update']; + $aData['fps'] = isset($_POST['fps']) ? trim($_POST['fps']) : $tarif['fps']; + $aData['tickrate'] = isset($_POST['tickrate']) ? trim($_POST['tickrate']) : $tarif['tickrate']; + $aData['ram'] = isset($_POST['ram']) ? trim($_POST['ram']) : $tarif['ram']; + $aData['param_fix'] = isset($_POST['param_fix']) ? trim($_POST['param_fix']) : $tarif['param_fix']; + $aData['time'] = isset($_POST['time']) ? trim($_POST['time']) : $tarif['time']; + $aData['timext'] = isset($_POST['timext']) ? trim($_POST['timext']) : $tarif['timext']; + $aData['test'] = isset($_POST['test']) ? sys::int($_POST['test']) : $tarif['test']; + $aData['tests'] = isset($_POST['tests']) ? sys::int($_POST['tests']) : $tarif['tests']; + $aData['discount'] = isset($_POST['discount']) ? sys::int($_POST['discount']) : $tarif['discount']; + $aData['map'] = isset($_POST['map']) ? trim($_POST['map']) : $tarif['map']; + $aData['ftp'] = isset($_POST['ftp']) ? $_POST['ftp'] : $tarif['ftp']; + $aData['plugins'] = isset($_POST['plugins']) ? $_POST['plugins'] : $tarif['plugins']; + $aData['console'] = isset($_POST['console']) ? $_POST['console'] : $tarif['console']; + $aData['stats'] = isset($_POST['stats']) ? $_POST['stats'] : $tarif['stats']; + $aData['copy'] = isset($_POST['copy']) ? $_POST['copy'] : $tarif['copy']; + $aData['web'] = isset($_POST['web']) ? $_POST['web'] : $tarif['web']; + $aData['plugins_install'] = isset($_POST['plugins_install']) ? trim($_POST['plugins_install']) : $tarif['plugins_install']; + $aData['hdd'] = isset($_POST['hdd']) ? sys::int($_POST['hdd']) : $tarif['hdd']; + $aData['autostop'] = isset($_POST['autostop']) ? sys::int($_POST['autostop']) : $tarif['autostop']; + $aData['price'] = isset($_POST['price']) ? trim($_POST['price']) : $tarif['price']; + $aData['core_fix'] = isset($_POST['core_fix']) ? trim($_POST['core_fix']) : $tarif['core_fix']; + $aData['ip'] = isset($_POST['ip']) ? trim($_POST['ip']) : $tarif['ip']; + $aData['show'] = isset($_POST['show']) ? sys::int($_POST['show']) : $tarif['show']; + $aData['sort'] = isset($_POST['sort']) ? sys::int($_POST['sort']) : $tarif['sort']; - if($aData['name'] == '') - sys::outjs(array('e' => 'Необходимо указать название')); + if($aData['name'] == '') + sys::outjs(array('e' => 'Необходимо указать название')); - $sql->query('SELECT `id` FROM `units` WHERE `id`="'.$aData['unit'].'" LIMIT 1'); - if(!$sql->num()) - sys::outjs(array('e' => 'Необходимо указать локацию')); + $sql->query('SELECT `id` FROM `units` WHERE `id`="'.$aData['unit'].'" LIMIT 1'); + if(!$sql->num()) + sys::outjs(array('e' => 'Необходимо указать локацию')); - if(!in_array($aData['game'], array('cs', 'cssold', 'css', 'csgo', 'samp', 'crmp', 'mta', 'mc'))) - sys::outjs(array('e' => 'Необходимо указать игру')); + if(!in_array($aData['game'], array('cs', 'cssold', 'css', 'csgo', 'samp', 'crmp', 'mta', 'mc'))) + sys::outjs(array('e' => 'Необходимо указать игру')); - $aSlots = explode('-', $aData['slots']); + $aSlots = explode('-', $aData['slots']); - if(!isset($aSlots[0]) || !isset($aSlots[1])) - sys::outjs(array('e' => 'Необходимо указать слоты')); + if(!isset($aSlots[0]) || !isset($aSlots[1])) + sys::outjs(array('e' => 'Необходимо указать слоты')); - $aSlots[0] = trim($aSlots[0]); - $aSlots[1] = trim($aSlots[1]); + $aSlots[0] = trim($aSlots[0]); + $aSlots[1] = trim($aSlots[1]); - $aData['slots_min'] = $aSlots[0] > 1 ? $aSlots[0] : sys::outjs(array('e' => 'Неправильно указаны слоты')); - $aData['slots_max'] = $aSlots[1] >= $aSlots[0] ? $aSlots[1] : sys::outjs(array('e' => 'Неправильно указаны слоты')); + $aData['slots_min'] = $aSlots[0] > 1 ? $aSlots[0] : sys::outjs(array('e' => 'Неправильно указаны слоты')); + $aData['slots_max'] = $aSlots[1] >= $aSlots[0] ? $aSlots[1] : sys::outjs(array('e' => 'Неправильно указаны слоты')); - $aPorts = explode('-', $aData['posts']); + $aPorts = explode('-', $aData['posts']); - if(!isset($aPorts[0]) || !isset($aPorts[1])) - sys::outjs(array('e' => 'Необходимо указать порты')); + if(!isset($aPorts[0]) || !isset($aPorts[1])) + sys::outjs(array('e' => 'Необходимо указать порты')); - $aPorts[0] = trim($aPorts[0]); - $aPorts[1] = trim($aPorts[1]); + $aPorts[0] = trim($aPorts[0]); + $aPorts[1] = trim($aPorts[1]); - $aData['port_min'] = $aPorts[0] > 1 ? $aPorts[0] : sys::outjs(array('e' => 'Неправильно указаны порты')); - $aData['port_max'] = $aPorts[1] >= $aPorts[0] ? $aPorts[1] : sys::outjs(array('e' => 'Неправильно указаны порты')); + $aData['port_min'] = $aPorts[0] > 1 ? $aPorts[0] : sys::outjs(array('e' => 'Неправильно указаны порты')); + $aData['port_max'] = $aPorts[1] >= $aPorts[0] ? $aPorts[1] : sys::outjs(array('e' => 'Неправильно указаны порты')); - if($aData['hostname'] == '') - sys::outjs(array('e' => 'Необходимо указать название сервера')); + if($aData['hostname'] == '') + sys::outjs(array('e' => 'Необходимо указать название сервера')); - if($aData['path'] == '') - sys::outjs(array('e' => 'Необходимо указать путь до сборок')); + if($aData['path'] == '') + sys::outjs(array('e' => 'Необходимо указать путь до сборок')); - if($aData['install'] == '') - sys::outjs(array('e' => 'Необходимо указать путь для установки серверов')); + if($aData['install'] == '') + sys::outjs(array('e' => 'Необходимо указать путь для установки серверов')); - if($aData['update'] == '' AND !in_array($aData['game'], array('css', 'csgo'))) - sys::outjs(array('e' => 'Необходимо указать путь до обновления сборки')); + if($aData['update'] == '' AND !in_array($aData['game'], array('css', 'csgo'))) + sys::outjs(array('e' => 'Необходимо указать путь до обновления сборки')); - if(substr($aData['path'], -1) != '/' || substr($aData['install'], -1) != '/' || (substr($aData['update'], -1) != '/' AND !in_array($aData['game'], array('css', 'csgo')))) - sys::outjs(array('e' => 'Пути должны заканчиваться символом "/"')); + if(substr($aData['path'], -1) != '/' || substr($aData['install'], -1) != '/' || (substr($aData['update'], -1) != '/' AND !in_array($aData['game'], array('css', 'csgo')))) + sys::outjs(array('e' => 'Пути должны заканчиваться символом "/"')); - $int = array( - 'Тестов' => 'tests', - 'Положение' => 'sort', - 'Диск' => 'hdd' - ); + $int = array( + 'Тестов' => 'tests', + 'Положение' => 'sort', + 'Диск' => 'hdd' + ); - foreach($int as $name => $input) - { - if($aData[$input] == '') - sys::outjs(array('e' => 'Необходимо указать поле "'.$name.'"')); - } + foreach($int as $name => $input) + { + if($aData[$input] == '') + sys::outjs(array('e' => 'Необходимо указать поле "'.$name.'"')); + } - $aPacks = explode(',', $aData['packs']); + $aPacks = explode(',', $aData['packs']); - $packs = array(); + $packs = array(); - foreach($aPacks as $pack) - { - $aPack = explode(':', trim($pack)); + foreach($aPacks as $pack) + { + $aPack = explode(':', trim($pack)); - if(!isset($aPack[0]) || !isset($aPack[1])) - continue; + if(!isset($aPack[0]) || !isset($aPack[1])) + continue; - $name = str_replace('"', '', $aPack[0]); - $fullname = str_replace('"', '', $aPack[1]); + $name = str_replace('"', '', $aPack[0]); + $fullname = str_replace('"', '', $aPack[1]); - $packs[trim($name)] = trim($fullname); - } + $packs[trim($name)] = trim($fullname); + } - if(!count($packs)) - sys::outjs(array('e' => 'Необходимо указать минимум одну сборку')); + if(!count($packs)) + sys::outjs(array('e' => 'Необходимо указать минимум одну сборку')); - $aData['packs'] = sys::b64js($packs); + $aData['packs'] = sys::b64js($packs); - $aIp = explode(':', $aData['ip']); + $aIp = explode(':', $aData['ip']); - $ips = ''; + $ips = ''; - foreach($aIp as $ip) - { - $ip = trim($ip); + foreach($aIp as $ip) + { + $ip = trim($ip); - if(sys::valid($ip, 'ip')) - continue; + if(sys::valid($ip, 'ip')) + continue; - $ips .= $ip.':'; - } + $ips .= $ip.':'; + } - $ips = isset($ips{0}) ? substr($ips, 0, -1) : ''; + $ips = isset($ips{0}) ? substr($ips, 0, -1) : ''; - $aData['ip'] = $ips; + $aData['ip'] = $ips; - $aPlugins = explode('","', $aData['plugins_install']); + $aPlugins = explode('","', $aData['plugins_install']); - $plugins = array(); + $plugins = array(); - foreach($aPlugins as $plugin) - { - $aPlugin = explode(':', trim($plugin)); + foreach($aPlugins as $plugin) + { + $aPlugin = explode(':', trim($plugin)); - if(!isset($aPlugin[0]) || !isset($aPlugin[1])) - continue; + if(!isset($aPlugin[0]) || !isset($aPlugin[1])) + continue; - $name = trim(str_replace('"', '', $aPlugin[0])); + $name = trim(str_replace('"', '', $aPlugin[0])); - if(!isset($packs[$name])) - continue; + if(!isset($packs[$name])) + continue; - $aList = explode(',', str_replace('"', '', $aPlugin[1])); + $aList = explode(',', str_replace('"', '', $aPlugin[1])); - $list = ''; + $list = ''; - foreach($aList as $pid) - { - $pid = trim($pid); + foreach($aList as $pid) + { + $pid = trim($pid); - if(!is_numeric($pid)) - continue; + if(!is_numeric($pid)) + continue; - $list .= intval($pid).','; - } + $list .= intval($pid).','; + } - $list = isset($list{0}) ? substr($list, 0, -1) : ''; + $list = isset($list{0}) ? substr($list, 0, -1) : ''; - if($list == '') - continue; + if($list == '') + continue; - $plugins[$name] = $list; - } + $plugins[$name] = $list; + } - $aData['plugins_install'] = count($plugins) ? sys::b64js($plugins) : ''; + $aData['plugins_install'] = count($plugins) ? sys::b64js($plugins) : ''; - $aCores = explode(',', $aData['core_fix']); + $aCores = explode(',', $aData['core_fix']); - $cores = ''; + $cores = ''; - foreach($aCores as $core) - { - $core = trim($core); + foreach($aCores as $core) + { + $core = trim($core); - if(!is_numeric($core)) - continue; + if(!is_numeric($core)) + continue; - if($core < 1) - continue; + if($core < 1) + continue; - $cores .= intval($core).','; - } + $cores .= intval($core).','; + } - $cores = isset($cores{0}) ? substr($cores, 0, -1) : ''; + $cores = isset($cores{0}) ? substr($cores, 0, -1) : ''; - $aData['core_fix'] = $cores; + $aData['core_fix'] = $cores; - $aTime = explode(':', $aData['time']); + $aTime = explode(':', $aData['time']); - $times = ''; + $times = ''; - foreach($aTime as $time) - { - $time = trim($time); + foreach($aTime as $time) + { + $time = trim($time); - if(!is_numeric($time)) - continue; + if(!is_numeric($time)) + continue; - $times .= intval($time).':'; - } + $times .= intval($time).':'; + } - $times = isset($times{0}) ? substr($times, 0, -1) : ''; + $times = isset($times{0}) ? substr($times, 0, -1) : ''; - $aData['time'] = $times; + $aData['time'] = $times; - $aTimext = explode(':', $aData['timext']); + $aTimext = explode(':', $aData['timext']); - $timexts = ''; + $timexts = ''; - foreach($aTimext as $timext) - { - $timext = trim($timext); + foreach($aTimext as $timext) + { + $timext = trim($timext); - if(!is_numeric($timext)) - continue; + if(!is_numeric($timext)) + continue; - $timexts .= intval($timext).':'; - } + $timexts .= intval($timext).':'; + } - $timexts = isset($timexts{0}) ? substr($timexts, 0, -1) : ''; + $timexts = isset($timexts{0}) ? substr($timexts, 0, -1) : ''; - $aData['timext'] = $timexts; + $aData['timext'] = $timexts; - $aFps = explode(':', $aData['fps']); + $aFps = explode(':', $aData['fps']); - $sfps = ''; + $sfps = ''; - foreach($aFps as $fps) - { - $fps = trim($fps); + foreach($aFps as $fps) + { + $fps = trim($fps); - if(!is_numeric($fps)) - continue; + if(!is_numeric($fps)) + continue; - $sfps .= intval($fps).':'; - } + $sfps .= intval($fps).':'; + } - $sfps = isset($sfps{0}) ? substr($sfps, 0, -1) : ''; + $sfps = isset($sfps{0}) ? substr($sfps, 0, -1) : ''; - $aData['fps'] = $sfps; + $aData['fps'] = $sfps; - $aTick = explode(':', $aData['tickrate']); + $aTick = explode(':', $aData['tickrate']); - $stick = ''; + $stick = ''; - foreach($aTick as $tick) - { - $tick = trim($tick); + foreach($aTick as $tick) + { + $tick = trim($tick); - if(!is_numeric($tick)) - continue; + if(!is_numeric($tick)) + continue; - $stick .= intval($tick).':'; - } + $stick .= intval($tick).':'; + } - $stick = isset($stick{0}) ? substr($stick, 0, -1) : ''; + $stick = isset($stick{0}) ? substr($stick, 0, -1) : ''; - $aData['tickrate'] = $stick; + $aData['tickrate'] = $stick; - $aRam = explode(':', $aData['ram']); + $aRam = explode(':', $aData['ram']); - $sram = ''; + $sram = ''; - foreach($aRam as $ram) - { - $ram = trim($ram); + foreach($aRam as $ram) + { + $ram = trim($ram); - if(!is_numeric($ram)) - continue; + if(!is_numeric($ram)) + continue; - $sram .= intval($ram).':'; - } + $sram .= intval($ram).':'; + } - $sram = isset($sram{0}) ? substr($sram, 0, -1) : ''; + $sram = isset($sram{0}) ? substr($sram, 0, -1) : ''; - $aData['ram'] = $sram; + $aData['ram'] = $sram; - $aPrice = explode(':', $aData['price']); + $aPrice = explode(':', $aData['price']); - $sprice = ''; + $sprice = ''; - foreach($aPrice as $price) - { - $price = trim($price); + foreach($aPrice as $price) + { + $price = trim($price); - if(!is_numeric($price)) - continue; + if(!is_numeric($price)) + continue; - $sprice .= $price.':'; - } + $sprice .= $price.':'; + } - $sprice = isset($sprice{0}) ? substr($sprice, 0, -1) : ''; + $sprice = isset($sprice{0}) ? substr($sprice, 0, -1) : ''; - $aData['price'] = $sprice; + $aData['price'] = $sprice; - switch($aData['game']) - { - case 'cs': - if(count(explode(':', $aData['fps'])) != count(explode(':', $aData['price']))) - sys::outjs(array('e' => 'Неправильно указано поле "Цена"')); + switch($aData['game']) + { + case 'cs': + if(count(explode(':', $aData['fps'])) != count(explode(':', $aData['price']))) + sys::outjs(array('e' => 'Неправильно указано поле "Цена"')); - break; + break; - case 'cssold': - $afps = explode(':', $aData['fps']); - $atick = explode(':', $aData['tickrate']); - $aprice = explode(':', $aData['price']); + case 'cssold': + $afps = explode(':', $aData['fps']); + $atick = explode(':', $aData['tickrate']); + $aprice = explode(':', $aData['price']); - if((count($afps)*count($atick)) != count($aprice)) - sys::outjs(array('e' => 'Неправильно указано поле "Цена"')); + if((count($afps)*count($atick)) != count($aprice)) + sys::outjs(array('e' => 'Неправильно указано поле "Цена"')); - $price = array(); + $price = array(); - $i = 0; + $i = 0; - foreach($afps as $fps) - { - foreach($atick as $tick) - { - $price[$tick.'_'.$fps] = $aprice[$i]; + foreach($afps as $fps) + { + foreach($atick as $tick) + { + $price[$tick.'_'.$fps] = $aprice[$i]; - $i+=1; - } - } + $i+=1; + } + } - $aData['price'] = sys::b64js($price); + $aData['price'] = sys::b64js($price); - break; + break; - case 'css': - case 'csgo': - if(count(explode(':', $aData['tickrate'])) != count(explode(':', $aData['price']))) - sys::outjs(array('e' => 'Неправильно указано поле "Цена"')); + case 'css': + case 'csgo': + if(count(explode(':', $aData['tickrate'])) != count(explode(':', $aData['price']))) + sys::outjs(array('e' => 'Неправильно указано поле "Цена"')); - break; + break; - case 'mc': - if(count(explode(':', $aData['ram'])) != count(explode(':', $aData['price']))) - sys::outjs(array('e' => 'Неправильно указано поле "Цена"')); + case 'mc': + if(count(explode(':', $aData['ram'])) != count(explode(':', $aData['price']))) + sys::outjs(array('e' => 'Неправильно указано поле "Цена"')); - } + } - $access = array('ftp', 'plugins', 'console', 'stats', 'copy', 'web'); + $access = array('ftp', 'plugins', 'console', 'stats', 'copy', 'web'); - foreach($access as $section) - $aData[$section] = (string) $aData[$section] == 'on' ? '1' : '0'; + foreach($access as $section) + $aData[$section] = (string) $aData[$section] == 'on' ? '1' : '0'; - $sql->query('UPDATE `tarifs` set' - .'`unit`="'.$aData['unit'].'",' - .'`game`="'.$aData['game'].'",' - .'`name`="'.htmlspecialchars($aData['name']).'",' - .'`slots_min`="'.$aData['slots_min'].'",' - .'`slots_max`="'.$aData['slots_max'].'",' - .'`port_min`="'.$aData['port_min'].'",' - .'`port_max`="'.$aData['port_max'].'",' - .'`hostname`="'.htmlspecialchars($aData['hostname']).'",' - .'`packs`="'.$aData['packs'].'",' - .'`path`="'.addslashes($aData['path']).'",' - .'`install`="'.addslashes($aData['install']).'",' - .'`update`="'.addslashes($aData['update']).'",' - .'`fps`="'.$aData['fps'].'",' - .'`tickrate`="'.$aData['tickrate'].'",' - .'`ram`="'.$aData['ram'].'",' - .'`param_fix`="'.$aData['param_fix'].'",' - .'`time`="'.$aData['time'].'",' - .'`timext`="'.$aData['timext'].'",' - .'`test`="'.$aData['test'].'",' - .'`tests`="'.$aData['tests'].'",' - .'`discount`="'.$aData['discount'].'",' - .'`map`="'.addslashes($aData['map']).'",' - .'`ftp`="'.$aData['ftp'].'",' - .'`plugins`="'.$aData['plugins'].'",' - .'`console`="'.$aData['console'].'",' - .'`stats`="'.$aData['stats'].'",' - .'`copy`="'.$aData['copy'].'",' - .'`web`="'.$aData['web'].'",' - .'`plugins_install`="'.$aData['plugins_install'].'",' - .'`hdd`="'.$aData['hdd'].'",' - .'`autostop`="'.$aData['autostop'].'",' - .'`price`="'.$aData['price'].'",' - .'`core_fix`="'.$aData['core_fix'].'",' - .'`ip`="'.$aData['ip'].'",' - .'`show`="'.$aData['show'].'",' - .'`sort`="'.$aData['sort'].'" WHERE `id`="'.$id.'" LIMIT 1'); + $sql->query('UPDATE `tarifs` set' + .'`unit`="'.$aData['unit'].'",' + .'`game`="'.$aData['game'].'",' + .'`name`="'.htmlspecialchars($aData['name']).'",' + .'`slots_min`="'.$aData['slots_min'].'",' + .'`slots_max`="'.$aData['slots_max'].'",' + .'`port_min`="'.$aData['port_min'].'",' + .'`port_max`="'.$aData['port_max'].'",' + .'`hostname`="'.htmlspecialchars($aData['hostname']).'",' + .'`packs`="'.$aData['packs'].'",' + .'`path`="'.addslashes($aData['path']).'",' + .'`install`="'.addslashes($aData['install']).'",' + .'`update`="'.addslashes($aData['update']).'",' + .'`fps`="'.$aData['fps'].'",' + .'`tickrate`="'.$aData['tickrate'].'",' + .'`ram`="'.$aData['ram'].'",' + .'`param_fix`="'.$aData['param_fix'].'",' + .'`time`="'.$aData['time'].'",' + .'`timext`="'.$aData['timext'].'",' + .'`test`="'.$aData['test'].'",' + .'`tests`="'.$aData['tests'].'",' + .'`discount`="'.$aData['discount'].'",' + .'`map`="'.addslashes($aData['map']).'",' + .'`ftp`="'.$aData['ftp'].'",' + .'`plugins`="'.$aData['plugins'].'",' + .'`console`="'.$aData['console'].'",' + .'`stats`="'.$aData['stats'].'",' + .'`copy`="'.$aData['copy'].'",' + .'`web`="'.$aData['web'].'",' + .'`plugins_install`="'.$aData['plugins_install'].'",' + .'`hdd`="'.$aData['hdd'].'",' + .'`autostop`="'.$aData['autostop'].'",' + .'`price`="'.$aData['price'].'",' + .'`core_fix`="'.$aData['core_fix'].'",' + .'`ip`="'.$aData['ip'].'",' + .'`show`="'.$aData['show'].'",' + .'`sort`="'.$aData['sort'].'" WHERE `id`="'.$id.'" LIMIT 1'); - sys::outjs(array('s' => 'ok')); - } + sys::outjs(array('s' => 'ok')); + } - $games = '' - .'' - .''; + $games = '' + .'' + .''; - $fix = $tarif['param_fix'] ? '' : ''; - $test = $tarif['test'] ? '' : ''; - $discount = $tarif['discount'] ? '' : ''; - $autostop = $tarif['autostop'] ? '' : ''; - $show = $tarif['show'] ? '' : ''; + $fix = $tarif['param_fix'] ? '' : ''; + $test = $tarif['test'] ? '' : ''; + $discount = $tarif['discount'] ? '' : ''; + $autostop = $tarif['autostop'] ? '' : ''; + $show = $tarif['show'] ? '' : ''; - $units = ''; + $units = ''; - $sql->query('SELECT `id`, `name` FROM `units` ORDER BY `id` ASC'); - while($unit = $sql->get()) - $units .= ''; + $sql->query('SELECT `id`, `name` FROM `units` ORDER BY `id` ASC'); + while($unit = $sql->get()) + $units .= ''; - $units = str_replace('"'.$tarif['unit'].'"', '"'.$tarif['unit'].'" selected="select"', $units); - $games = str_replace('"'.$tarif['game'].'"', '"'.$tarif['game'].'" selected="select"', $games); + $units = str_replace('"'.$tarif['unit'].'"', '"'.$tarif['unit'].'" selected="select"', $units); + $games = str_replace('"'.$tarif['game'].'"', '"'.$tarif['game'].'" selected="select"', $games); - $html->get('tarif', 'sections/tarifs'); + $html->get('tarif', 'sections/tarifs'); - if($tarif['game'] == 'cssold') - { - $sprice = ''; + if($tarif['game'] == 'cssold') + { + $sprice = ''; - $aPrice = sys::b64djs($tarif['price']); + $aPrice = sys::b64djs($tarif['price']); - foreach($aPrice as $price) - $sprice .= $price.':'; - - $sprice = isset($sprice{0}) ? substr($sprice, 0, -1) : ''; + foreach($aPrice as $price) + $sprice .= $price.':'; + + $sprice = isset($sprice{0}) ? substr($sprice, 0, -1) : ''; - $tarif['price'] = $sprice; - } + $tarif['price'] = $sprice; + } - foreach($tarif as $field => $val) - $html->set($field, $val); - - $html->set('units', $units); - $html->set('games', $games); - $html->set('param_fix', $fix); - $html->set('test', $test); - $html->set('discount', $discount); - $html->set('autostop', $autostop); - $html->set('show', $show); - - foreach(array('ftp', 'plugins', 'console', 'stats', 'copy', 'web') as $section) - { - if($tarif[$section]) - $html->unit($section, 1); - else - $html->unit($section); - } - - $packs = ''; - - $aPacks = sys::b64djs($tarif['packs']); - - foreach($aPacks as $name => $fullname) - $packs .= '"'.$name.'":"'.$fullname.'",'; - - $packs = isset($packs{0}) ? substr($packs, 0, -1) : ''; - - $html->set('packs', $packs); - - $plugins = ''; - - $aPlugins = sys::b64djs($tarif['plugins_install']); - - foreach($aPlugins as $pack => $list) - $plugins .= '"'.$pack.'":"'.$list.'",'; + foreach($tarif as $field => $val) + $html->set($field, $val); + + $html->set('units', $units); + $html->set('games', $games); + $html->set('param_fix', $fix); + $html->set('test', $test); + $html->set('discount', $discount); + $html->set('autostop', $autostop); + $html->set('show', $show); + + foreach(array('ftp', 'plugins', 'console', 'stats', 'copy', 'web') as $section) + { + if($tarif[$section]) + $html->unit($section, 1); + else + $html->unit($section); + } + + $packs = ''; + + $aPacks = sys::b64djs($tarif['packs']); + + foreach($aPacks as $name => $fullname) + $packs .= '"'.$name.'":"'.$fullname.'",'; + + $packs = isset($packs{0}) ? substr($packs, 0, -1) : ''; + + $html->set('packs', $packs); + + $plugins = ''; + + $aPlugins = sys::b64djs($tarif['plugins_install']); + + foreach($aPlugins as $pack => $list) + $plugins .= '"'.$pack.'":"'.$list.'",'; - $plugins = isset($plugins{0}) ? substr($plugins, 0, -1) : ''; + $plugins = isset($plugins{0}) ? substr($plugins, 0, -1) : ''; - $html->set('plugins_install', $plugins); + $html->set('plugins_install', $plugins); - $html->pack('main'); + $html->pack('main'); ?> \ No newline at end of file diff --git a/system/acp/sections/units/add.php b/system/acp/sections/units/add.php index 74c7c5c..90dd498 100644 --- a/system/acp/sections/units/add.php +++ b/system/acp/sections/units/add.php @@ -1,69 +1,69 @@ 'Необходимо заполнить все поля')); + if(in_array('', $aData)) + sys::outjs(array('e' => 'Необходимо заполнить все поля')); - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - if(!$ssh->auth($aData['passwd'], $aData['address'])) - sys::outjs(array('e' => 'Не удалось создать связь с локацией')); + if(!$ssh->auth($aData['passwd'], $aData['address'])) + sys::outjs(array('e' => 'Не удалось создать связь с локацией')); - $sql->query('INSERT INTO `units` set ' - .'`name`="'.htmlspecialchars($aData['name']).'",' - .'`address`="'.$aData['address'].'",' - .'`passwd`="'.$aData['passwd'].'",' - .'`sql_login`="'.$aData['sql_login'].'",' - .'`sql_passwd`="'.$aData['sql_passwd'].'",' - .'`sql_port`="'.$aData['sql_port'].'",' - .'`sql_ftp`="'.$aData['sql_ftp'].'",' - .'`cs`="'.$aData['cs'].'",' - .'`cssold`="'.$aData['cssold'].'",' - .'`css`="'.$aData['css'].'",' - .'`csgo`="'.$aData['csgo'].'",' - .'`samp`="'.$aData['samp'].'",' - .'`crmp`="'.$aData['crmp'].'",' - .'`mta`="'.$aData['mta'].'",' - .'`mc`="'.$aData['mc'].'",' - .'`ram`="'.$aData['ram'].'",' - .'`test`="'.$aData['test'].'",' - .'`show`="'.$aData['show'].'",' - .'`sort`="'.$aData['sort'].'",' - .'`domain`="'.$aData['domain'].'"'); + $sql->query('INSERT INTO `units` set ' + .'`name`="'.htmlspecialchars($aData['name']).'",' + .'`address`="'.$aData['address'].'",' + .'`passwd`="'.$aData['passwd'].'",' + .'`sql_login`="'.$aData['sql_login'].'",' + .'`sql_passwd`="'.$aData['sql_passwd'].'",' + .'`sql_port`="'.$aData['sql_port'].'",' + .'`sql_ftp`="'.$aData['sql_ftp'].'",' + .'`cs`="'.$aData['cs'].'",' + .'`cssold`="'.$aData['cssold'].'",' + .'`css`="'.$aData['css'].'",' + .'`csgo`="'.$aData['csgo'].'",' + .'`samp`="'.$aData['samp'].'",' + .'`crmp`="'.$aData['crmp'].'",' + .'`mta`="'.$aData['mta'].'",' + .'`mc`="'.$aData['mc'].'",' + .'`ram`="'.$aData['ram'].'",' + .'`test`="'.$aData['test'].'",' + .'`show`="'.$aData['show'].'",' + .'`sort`="'.$aData['sort'].'",' + .'`domain`="'.$aData['domain'].'"'); - sys::outjs(array('s' => $sql->id())); - } + sys::outjs(array('s' => $sql->id())); + } - $html->get('add', 'sections/units'); + $html->get('add', 'sections/units'); - $html->pack('main'); + $html->pack('main'); ?> \ No newline at end of file diff --git a/system/acp/sections/units/delete.php b/system/acp/sections/units/delete.php index 6d3ac17..03ad5ae 100644 --- a/system/acp/sections/units/delete.php +++ b/system/acp/sections/units/delete.php @@ -1,67 +1,67 @@ query('SELECT `address`, `passwd` FROM `panel` LIMIT 1'); - $panel = $sql->get(); + if(isset($url['delete']) AND $url['delete'] == 'all') + { + $sql->query('SELECT `address`, `passwd` FROM `panel` LIMIT 1'); + $panel = $sql->get(); - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - if(!$ssh->auth($panel['passwd'], $panel['address'])) - sys::outjs(array('e' => 'PANEL не удалось создать связь.')); + if(!$ssh->auth($panel['passwd'], $panel['address'])) + sys::outjs(array('e' => 'PANEL не удалось создать связь.')); - $servers = $sql->query('SELECT `id`, `user`, `game` FROM `servers` WHERE `unit`="'.$id.'"'); - while($server = $sql->get($servers)) - { - $crons = $sql->query('SELECT `id`, `cron` FROM `crontab` WHERE `server`="'.$server['id'].'"'); - while($cron = $sql->get($crons)) - { - $ssh->set('echo "" >> /etc/crontab && cat /etc/crontab'); - $crontab = str_replace($cron['cron'], '', $ssh->get()); + $servers = $sql->query('SELECT `id`, `user`, `game` FROM `servers` WHERE `unit`="'.$id.'"'); + while($server = $sql->get($servers)) + { + $crons = $sql->query('SELECT `id`, `cron` FROM `crontab` WHERE `server`="'.$server['id'].'"'); + while($cron = $sql->get($crons)) + { + $ssh->set('echo "" >> /etc/crontab && cat /etc/crontab'); + $crontab = str_replace($cron['cron'], '', $ssh->get()); - // Временный файл - $temp = sys::temp($crontab); + // Временный файл + $temp = sys::temp($crontab); - $ssh->setfile($temp, '/etc/crontab', 0644); + $ssh->setfile($temp, '/etc/crontab', 0644); - $ssh->set("sed -i '/^$/d' /etc/crontab"); - $ssh->set('crontab -u root /etc/crontab'); + $ssh->set("sed -i '/^$/d' /etc/crontab"); + $ssh->set('crontab -u root /etc/crontab'); - unlink($temp); + unlink($temp); - $sql->query('DELETE FROM `crontab` WHERE `id`="'.$cron['id'].'" LIMIT 1'); - } + $sql->query('DELETE FROM `crontab` WHERE `id`="'.$cron['id'].'" LIMIT 1'); + } - $helps = $sql->query('SELECT `id` FROM `help` WHERE `type`="server" AND `service`="'.$server['id'].'"'); - while($help = $sql->get($helps)) - { - $sql->query('DELETE FROM `help_dialogs` WHERE `help`="'.$help['id'].'"'); - $sql->query('DELETE FROM `help` WHERE `id`="'.$help['id'].'" LIMIT 1'); - } + $helps = $sql->query('SELECT `id` FROM `help` WHERE `type`="server" AND `service`="'.$server['id'].'"'); + while($help = $sql->get($helps)) + { + $sql->query('DELETE FROM `help_dialogs` WHERE `help`="'.$help['id'].'"'); + $sql->query('DELETE FROM `help` WHERE `id`="'.$help['id'].'" LIMIT 1'); + } - $sql->query('DELETE FROM `admins_'.$server['game'].'` WHERE `server`="'.$server['id'].'" LIMIT 1'); - $sql->query('DELETE FROM `address_buy` WHERE `server`="'.$server['id'].'"'); - $sql->query('DELETE FROM `logs_sys` WHERE `server`="'.$server['id'].'"'); - $sql->query('DELETE FROM `owners` WHERE `server`="'.$server['id'].'"'); - $sql->query('DELETE FROM `copy` WHERE `server`="'.$server['id'].'"'); - $sql->query('DELETE FROM `plugins_install` WHERE `server`="'.$server['id'].'"'); - $sql->query('DELETE FROM `graph` WHERE `server`="'.$server['id'].'" LIMIT 1'); - $sql->query('DELETE FROM `graph_day` WHERE `server`="'.$server['id'].'"'); - $sql->query('DELETE FROM `graph_hour` WHERE `server`="'.$server['id'].'"'); - $sql->query('DELETE FROM `web` WHERE `server`="'.$server['id'].'"'); - } + $sql->query('DELETE FROM `admins_'.$server['game'].'` WHERE `server`="'.$server['id'].'" LIMIT 1'); + $sql->query('DELETE FROM `address_buy` WHERE `server`="'.$server['id'].'"'); + $sql->query('DELETE FROM `logs_sys` WHERE `server`="'.$server['id'].'"'); + $sql->query('DELETE FROM `owners` WHERE `server`="'.$server['id'].'"'); + $sql->query('DELETE FROM `copy` WHERE `server`="'.$server['id'].'"'); + $sql->query('DELETE FROM `plugins_install` WHERE `server`="'.$server['id'].'"'); + $sql->query('DELETE FROM `graph` WHERE `server`="'.$server['id'].'" LIMIT 1'); + $sql->query('DELETE FROM `graph_day` WHERE `server`="'.$server['id'].'"'); + $sql->query('DELETE FROM `graph_hour` WHERE `server`="'.$server['id'].'"'); + $sql->query('DELETE FROM `web` WHERE `server`="'.$server['id'].'"'); + } - $sql->query('DELETE FROM `address` WHERE `unit`="'.$id.'"'); - $sql->query('DELETE FROM `tarifs` WHERE `unit`="'.$id.'"'); - }else{ - $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$id.'" LIMIT 1'); - if($sql->num()) - sys::outjs(array('e' => 'Нельзя удалить локацию с серверами.')); - } + $sql->query('DELETE FROM `address` WHERE `unit`="'.$id.'"'); + $sql->query('DELETE FROM `tarifs` WHERE `unit`="'.$id.'"'); + }else{ + $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$id.'" LIMIT 1'); + if($sql->num()) + sys::outjs(array('e' => 'Нельзя удалить локацию с серверами.')); + } - $sql->query('DELETE FROM `units` WHERE `id`="'.$id.'" LIMIT 1'); + $sql->query('DELETE FROM `units` WHERE `id`="'.$id.'" LIMIT 1'); - sys::outjs(array('s' => 'ok')); + sys::outjs(array('s' => 'ok')); ?> \ No newline at end of file diff --git a/system/acp/sections/units/index.php b/system/acp/sections/units/index.php index 54d94d5..18fbafe 100644 --- a/system/acp/sections/units/index.php +++ b/system/acp/sections/units/index.php @@ -1,29 +1,29 @@ query('SELECT `id`, `name`, `address`, `show`, `domain` FROM `units` ORDER BY `id` ASC'); - while($unit = $sql->get()) - { - $list .= ''; - $list .= ''.$unit['id'].''; - $list .= ''.$unit['name'].''; - $list .= ''.$unit['address'].''; - $list .= ''.($unit['show'] == '1' ? 'Доступна' : 'Недоступна').''; - $list .= ''.$unit['domain'].''; - $list .= 'Удалить'; - $list .= ''; - } + $sql->query('SELECT `id`, `name`, `address`, `show`, `domain` FROM `units` ORDER BY `id` ASC'); + while($unit = $sql->get()) + { + $list .= ''; + $list .= ''.$unit['id'].''; + $list .= ''.$unit['name'].''; + $list .= ''.$unit['address'].''; + $list .= ''.($unit['show'] == '1' ? 'Доступна' : 'Недоступна').''; + $list .= ''.$unit['domain'].''; + $list .= 'Удалить'; + $list .= ''; + } - $html->get('index', 'sections/units'); + $html->get('index', 'sections/units'); - $html->set('list', $list); + $html->set('list', $list); - $html->pack('main'); - } + $html->pack('main'); + } ?> \ No newline at end of file diff --git a/system/acp/sections/units/loading.php b/system/acp/sections/units/loading.php index 958af65..2a62ec9 100644 --- a/system/acp/sections/units/loading.php +++ b/system/acp/sections/units/loading.php @@ -1,103 +1,103 @@ query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$id.'" LIMIT 1'); - $unit = $sql->get(); + if($id) + { + $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$id.'" LIMIT 1'); + $unit = $sql->get(); - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - if(isset($url['service']) AND in_array($url['service'], array('apache2', 'nginx', 'mysql', 'unit', 'geo', 'ungeo'))) - { - if(!$ssh->auth($unit['passwd'], $unit['address'])) - sys::outjs(array('e' => 'Не удалось создать связь с локацией')); + if(isset($url['service']) AND in_array($url['service'], array('apache2', 'nginx', 'mysql', 'unit', 'geo', 'ungeo'))) + { + if(!$ssh->auth($unit['passwd'], $unit['address'])) + sys::outjs(array('e' => 'Не удалось создать связь с локацией')); - switch($url['service']) - { - case 'unit': - $ssh->set('screen -dmS reboot reboot'); - break; + switch($url['service']) + { + case 'unit': + $ssh->set('screen -dmS reboot reboot'); + break; - case 'geo': - $ssh->set('iptables-restore < /etc/firewall/geo.conf; iptables-restore << '.$cfg['iptables']); + case 'geo': + $ssh->set('iptables-restore < /etc/firewall/geo.conf; iptables-restore << '.$cfg['iptables']); - $sql->query('UPDATE `units` set `ddos`="1" WHERE `id`="'.$id.'" LIMIT 1'); - break; + $sql->query('UPDATE `units` set `ddos`="1" WHERE `id`="'.$id.'" LIMIT 1'); + break; - case 'ungeo': - $ssh->set('iptables-restore < /etc/firewall/ungeo.conf; iptables-restore << '.$cfg['iptables'].'; iptables-restore << /root/'.$cfg['iptables'].'_geo'); + case 'ungeo': + $ssh->set('iptables-restore < /etc/firewall/ungeo.conf; iptables-restore << '.$cfg['iptables'].'; iptables-restore << /root/'.$cfg['iptables'].'_geo'); - $sql->query('UPDATE `units` set `ddos`="0" WHERE `id`="'.$id.'" LIMIT 1'); - break; + $sql->query('UPDATE `units` set `ddos`="0" WHERE `id`="'.$id.'" LIMIT 1'); + break; - default: - $ssh->set('screen -dmS sr_'.$url['service'].' service '.$url['service'].' restart'); - } + default: + $ssh->set('screen -dmS sr_'.$url['service'].' service '.$url['service'].' restart'); + } - sys::outjs(array('s' => 'ok')); - } + sys::outjs(array('s' => 'ok')); + } - $aData = array( - 'cpu' => '0%', - 'ram' => '0%', - 'hdd' => '0%', - 'apache' => 'unknown', - 'nginx' => 'unknown', - 'mysql' => 'unknown', - 'uptime' => 'unknown', - 'ssh' => 'error' - ); + $aData = array( + 'cpu' => '0%', + 'ram' => '0%', + 'hdd' => '0%', + 'apache' => 'unknown', + 'nginx' => 'unknown', + 'mysql' => 'unknown', + 'uptime' => 'unknown', + 'ssh' => 'error' + ); - if(!$ssh->auth($unit['passwd'], $unit['address'])) - sys::outjs($aData); + if(!$ssh->auth($unit['passwd'], $unit['address'])) + sys::outjs($aData); - $aData['ssh'] = ''; + $aData['ssh'] = ''; - $stat_ram = $ssh->get('echo `cat /proc/meminfo | grep MemTotal | awk \'{print $2}\'; cat /proc/meminfo | grep MemFree | awk \'{print $2}\'; cat /proc/meminfo | grep Buffers | awk \'{print $2}\'; cat /proc/meminfo | grep Cached | grep -v SwapCached | awk \'{print $2}\'`'); - $aData['ram'] = ceil(sys::ram_load($stat_ram)).'%'; + $stat_ram = $ssh->get('echo `cat /proc/meminfo | grep MemTotal | awk \'{print $2}\'; cat /proc/meminfo | grep MemFree | awk \'{print $2}\'; cat /proc/meminfo | grep Buffers | awk \'{print $2}\'; cat /proc/meminfo | grep Cached | grep -v SwapCached | awk \'{print $2}\'`'); + $aData['ram'] = ceil(sys::ram_load($stat_ram)).'%'; - $aData['hdd'] = $ssh->get('df -P / | awk \'{print $5}\' | tail -1'); + $aData['hdd'] = $ssh->get('df -P / | awk \'{print $5}\' | tail -1'); - $aData['apache'] = sys::status($ssh->get('service apache2 status')) ? 'Работает' : 'Поднять'; - $aData['nginx'] = sys::status($ssh->get('service nginx status')) ? 'Работает' : 'Поднять'; - $aData['mysql'] = sys::status($ssh->get('service mysql status')) ? 'Работает' : 'Поднять'; - - $time = ceil($ssh->get('cat /proc/uptime | awk \'{print $1}\'')); - $aData['uptime'] = sys::uptime_load($time); + $aData['apache'] = sys::status($ssh->get('service apache2 status')) ? 'Работает' : 'Поднять'; + $aData['nginx'] = sys::status($ssh->get('service nginx status')) ? 'Работает' : 'Поднять'; + $aData['mysql'] = sys::status($ssh->get('service mysql status')) ? 'Работает' : 'Поднять'; + + $time = ceil($ssh->get('cat /proc/uptime | awk \'{print $1}\'')); + $aData['uptime'] = sys::uptime_load($time); - $aData['cpu'] = sys::cpu_load($ssh->get('echo "`ps -A -o pcpu | tail -n+2 | paste -sd+ | bc | awk \'{print $0}\'` `cat /proc/cpuinfo | grep processor | wc -l | awk \'{print $1}\'`"')).'%'; + $aData['cpu'] = sys::cpu_load($ssh->get('echo "`ps -A -o pcpu | tail -n+2 | paste -sd+ | bc | awk \'{print $0}\'` `cat /proc/cpuinfo | grep processor | wc -l | awk \'{print $1}\'`"')).'%'; - sys::outjs($aData); - } + sys::outjs($aData); + } - $loads = ''; - $list = ''; + $loads = ''; + $list = ''; - $sql->query('SELECT `id`, `name` FROM `units` ORDER BY `id` ASC'); - while($unit = $sql->get()) - { - $list .= ''; - $list .= ''.$unit['id'].''; - $list .= ''.$unit['name'].''; - $list .= ''; - $list .= ''; - $list .= ''; - $list .= ''; - $list .= ''; - $list .= ''; - $list .= ''; - $list .= ''; - $list .= ''; + $sql->query('SELECT `id`, `name` FROM `units` ORDER BY `id` ASC'); + while($unit = $sql->get()) + { + $list .= ''; + $list .= ''.$unit['id'].''; + $list .= ''.$unit['name'].''; + $list .= ''; + $list .= ''; + $list .= ''; + $list .= ''; + $list .= ''; + $list .= ''; + $list .= ''; + $list .= ''; + $list .= ''; - $loads .= 'units_load(\''.$unit['id'].'\', false);'; - } + $loads .= 'units_load(\''.$unit['id'].'\', false);'; + } - $html->get('loading', 'sections/units'); + $html->get('loading', 'sections/units'); - $html->set('list', $list); - $html->set('loads', $loads); + $html->set('list', $list); + $html->set('loads', $loads); - $html->pack('main'); + $html->pack('main'); ?> \ No newline at end of file diff --git a/system/acp/sections/units/stats.php b/system/acp/sections/units/stats.php index 90bfa46..f299a57 100644 --- a/system/acp/sections/units/stats.php +++ b/system/acp/sections/units/stats.php @@ -1,65 +1,65 @@ query('SELECT `id`, `name`, `show` FROM `units` ORDER BY `id` ASC'); - while($unit = $sql->get($units)) - { - $servers = $sql->query('SELECT `id`, `user` FROM `servers` WHERE `unit`="'.$unit['id'].'"'); - $all_servers = $sql->num($servers); + $units = $sql->query('SELECT `id`, `name`, `show` FROM `units` ORDER BY `id` ASC'); + while($unit = $sql->get($units)) + { + $servers = $sql->query('SELECT `id`, `user` FROM `servers` WHERE `unit`="'.$unit['id'].'"'); + $all_servers = $sql->num($servers); - $money_all = 0; - $money_month = 0; + $money_all = 0; + $money_month = 0; - $time = date('j', $start_point)*86400; + $time = date('j', $start_point)*86400; - while($server = $sql->get($servers)) - { - $sql->query('SELECT `id` FROM `users` WHERE `id`="'.$server['user'].'" AND `group`="user" LIMIT 1'); - if(!$sql->num()) - continue; + while($server = $sql->get($servers)) + { + $sql->query('SELECT `id` FROM `users` WHERE `id`="'.$server['user'].'" AND `group`="user" LIMIT 1'); + if(!$sql->num()) + continue; - $sql->query('SELECT `money`, `date` FROM `logs` WHERE `user`="'.$server['user'].'" AND (`type`="buy" OR `type`="extend") AND `text` LIKE \'%(сервер: #'.$server['id'].')%\''); - while($logs = $sql->get()) - { - $money_all += $logs['money']; + $sql->query('SELECT `money`, `date` FROM `logs` WHERE `user`="'.$server['user'].'" AND (`type`="buy" OR `type`="extend") AND `text` LIKE \'%(сервер: #'.$server['id'].')%\''); + while($logs = $sql->get()) + { + $money_all += $logs['money']; - if($logs['date'] >= ($start_point-$time)) - $money_month += $logs['money']; - } - } + if($logs['date'] >= ($start_point-$time)) + $money_month += $logs['money']; + } + } - $all_money += $money_all; - $all_money_month += $money_month; + $all_money += $money_all; + $all_money_month += $money_month; - $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$unit['id'].'" AND `time`<"'.$start_point.'"'); - $overdue_servers = $sql->num(); + $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$unit['id'].'" AND `time`<"'.$start_point.'"'); + $overdue_servers = $sql->num(); - $list .= ''; - $list .= ''.$unit['id'].''; - $list .= ''.$unit['name'].''; - $list .= ''.($unit['show'] == '1' ? 'Доступна' : 'Недоступна').''; - $list .= ''.$all_servers.' шт.'; - $list .= ''.$overdue_servers.' шт.'; - $list .= ''.$money_all.' '.$cfg['currency'].''; - $list .= ''.$money_month.' '.$cfg['currency'].''; - $list .= ''; - } + $list .= ''; + $list .= ''.$unit['id'].''; + $list .= ''.$unit['name'].''; + $list .= ''.($unit['show'] == '1' ? 'Доступна' : 'Недоступна').''; + $list .= ''.$all_servers.' шт.'; + $list .= ''.$overdue_servers.' шт.'; + $list .= ''.$money_all.' '.$cfg['currency'].''; + $list .= ''.$money_month.' '.$cfg['currency'].''; + $list .= ''; + } - $html->get('stats', 'sections/units'); + $html->get('stats', 'sections/units'); - $html->set('list', $list); + $html->set('list', $list); - $html->set('month', mb_strtolower(params::$aNameMonth[sys::int(date('n', $start_point))], 'UTF-8')); + $html->set('month', mb_strtolower(params::$aNameMonth[sys::int(date('n', $start_point))], 'UTF-8')); - $html->set('all_money', $all_money); - $html->set('all_money_month', $all_money_month); - $html->set('cur', $cfg['currency']); + $html->set('all_money', $all_money); + $html->set('all_money_month', $all_money_month); + $html->set('cur', $cfg['currency']); - $html->pack('main'); + $html->pack('main'); ?> \ No newline at end of file diff --git a/system/acp/sections/units/unit.php b/system/acp/sections/units/unit.php index d8c6fc4..43d42cb 100644 --- a/system/acp/sections/units/unit.php +++ b/system/acp/sections/units/unit.php @@ -1,85 +1,85 @@ query('SELECT * FROM `units` WHERE `id`="'.$id.'" LIMIT 1'); - $unit = $sql->get(); + $sql->query('SELECT * FROM `units` WHERE `id`="'.$id.'" LIMIT 1'); + $unit = $sql->get(); - if($go) - { - $aData = array(); + if($go) + { + $aData = array(); - $aData['name'] = isset($_POST['name']) ? trim($_POST['name']) : $unit['name']; - $aData['address'] = isset($_POST['address']) ? trim($_POST['address']) : $unit['address']; - $aData['passwd'] = isset($_POST['passwd']) ? trim($_POST['passwd']) : $unit['passwd']; - $aData['sql_login'] = isset($_POST['sql_login']) ? trim($_POST['sql_login']) : $unit['sql_login']; - $aData['sql_passwd'] = isset($_POST['sql_passwd']) ? trim($_POST['sql_passwd']) : $unit['sql_passwd']; - $aData['sql_port'] = isset($_POST['sql_port']) ? sys::int($_POST['sql_port']) : $unit['sql_port']; - $aData['sql_ftp'] = isset($_POST['sql_ftp']) ? trim($_POST['sql_ftp']) : $unit['sql_ftp']; - $aData['cs'] = isset($_POST['cs']) ? $_POST['cs'] : $unit['cs']; - $aData['cssold'] = isset($_POST['cssold']) ? $_POST['cssold'] : $unit['cssold']; - $aData['css'] = isset($_POST['css']) ? $_POST['css'] : $unit['css']; - $aData['csgo'] = isset($_POST['csgo']) ? $_POST['csgo'] : $unit['csgo']; - $aData['samp'] = isset($_POST['samp']) ? $_POST['samp'] : $unit['samp']; - $aData['crmp'] = isset($_POST['crmp']) ? $_POST['crmp'] : $unit['crmp']; - $aData['mta'] = isset($_POST['mta']) ? $_POST['mta'] : $unit['mta']; - $aData['mc'] = isset($_POST['mc']) ? $_POST['mc'] : $unit['mc']; - $aData['ram'] = isset($_POST['ram']) ? sys::int($_POST['ram']) : $unit['ram']; - $aData['test'] = isset($_POST['test']) ? sys::int($_POST['test']) : $unit['test']; - $aData['show'] = isset($_POST['show']) ? $_POST['show'] : $unit['show']; - $aData['sort'] = isset($_POST['sort']) ? sys::int($_POST['sort']) : $unit['sort']; - $aData['domain'] = isset($_POST['domain']) ? trim($_POST['domain']) : $unit['domain']; + $aData['name'] = isset($_POST['name']) ? trim($_POST['name']) : $unit['name']; + $aData['address'] = isset($_POST['address']) ? trim($_POST['address']) : $unit['address']; + $aData['passwd'] = isset($_POST['passwd']) ? trim($_POST['passwd']) : $unit['passwd']; + $aData['sql_login'] = isset($_POST['sql_login']) ? trim($_POST['sql_login']) : $unit['sql_login']; + $aData['sql_passwd'] = isset($_POST['sql_passwd']) ? trim($_POST['sql_passwd']) : $unit['sql_passwd']; + $aData['sql_port'] = isset($_POST['sql_port']) ? sys::int($_POST['sql_port']) : $unit['sql_port']; + $aData['sql_ftp'] = isset($_POST['sql_ftp']) ? trim($_POST['sql_ftp']) : $unit['sql_ftp']; + $aData['cs'] = isset($_POST['cs']) ? $_POST['cs'] : $unit['cs']; + $aData['cssold'] = isset($_POST['cssold']) ? $_POST['cssold'] : $unit['cssold']; + $aData['css'] = isset($_POST['css']) ? $_POST['css'] : $unit['css']; + $aData['csgo'] = isset($_POST['csgo']) ? $_POST['csgo'] : $unit['csgo']; + $aData['samp'] = isset($_POST['samp']) ? $_POST['samp'] : $unit['samp']; + $aData['crmp'] = isset($_POST['crmp']) ? $_POST['crmp'] : $unit['crmp']; + $aData['mta'] = isset($_POST['mta']) ? $_POST['mta'] : $unit['mta']; + $aData['mc'] = isset($_POST['mc']) ? $_POST['mc'] : $unit['mc']; + $aData['ram'] = isset($_POST['ram']) ? sys::int($_POST['ram']) : $unit['ram']; + $aData['test'] = isset($_POST['test']) ? sys::int($_POST['test']) : $unit['test']; + $aData['show'] = isset($_POST['show']) ? $_POST['show'] : $unit['show']; + $aData['sort'] = isset($_POST['sort']) ? sys::int($_POST['sort']) : $unit['sort']; + $aData['domain'] = isset($_POST['domain']) ? trim($_POST['domain']) : $unit['domain']; - foreach(array('cs', 'cssold', 'css', 'csgo', 'samp', 'crmp', 'mta', 'mc') as $game) - $aData[$game] = (string) $aData[$game] == 'on' ? '1' : '0'; + foreach(array('cs', 'cssold', 'css', 'csgo', 'samp', 'crmp', 'mta', 'mc') as $game) + $aData[$game] = (string) $aData[$game] == 'on' ? '1' : '0'; - if(in_array('', $aData)) - sys::outjs(array('e' => 'Необходимо заполнить все поля')); + if(in_array('', $aData)) + sys::outjs(array('e' => 'Необходимо заполнить все поля')); - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - if(!$ssh->auth($aData['passwd'], $aData['address'])) - sys::outjs(array('e' => 'Не удалось создать связь с локацией')); + if(!$ssh->auth($aData['passwd'], $aData['address'])) + sys::outjs(array('e' => 'Не удалось создать связь с локацией')); - $sql->query('UPDATE `units` set ' - .'`name`="'.htmlspecialchars($aData['name']).'",' - .'`address`="'.$aData['address'].'",' - .'`passwd`="'.$aData['passwd'].'",' - .'`sql_login`="'.$aData['sql_login'].'",' - .'`sql_passwd`="'.$aData['sql_passwd'].'",' - .'`sql_port`="'.$aData['sql_port'].'",' - .'`sql_ftp`="'.$aData['sql_ftp'].'",' - .'`cs`="'.$aData['cs'].'",' - .'`cssold`="'.$aData['cssold'].'",' - .'`css`="'.$aData['css'].'",' - .'`csgo`="'.$aData['csgo'].'",' - .'`samp`="'.$aData['samp'].'",' - .'`crmp`="'.$aData['crmp'].'",' - .'`mta`="'.$aData['mta'].'",' - .'`mc`="'.$aData['mc'].'",' - .'`ram`="'.$aData['ram'].'",' - .'`test`="'.$aData['test'].'",' - .'`show`="'.$aData['show'].'",' - .'`sort`="'.$aData['sort'].'",' - .'`domain`="'.$aData['domain'].'" WHERE `id`="'.$id.'" LIMIT 1'); + $sql->query('UPDATE `units` set ' + .'`name`="'.htmlspecialchars($aData['name']).'",' + .'`address`="'.$aData['address'].'",' + .'`passwd`="'.$aData['passwd'].'",' + .'`sql_login`="'.$aData['sql_login'].'",' + .'`sql_passwd`="'.$aData['sql_passwd'].'",' + .'`sql_port`="'.$aData['sql_port'].'",' + .'`sql_ftp`="'.$aData['sql_ftp'].'",' + .'`cs`="'.$aData['cs'].'",' + .'`cssold`="'.$aData['cssold'].'",' + .'`css`="'.$aData['css'].'",' + .'`csgo`="'.$aData['csgo'].'",' + .'`samp`="'.$aData['samp'].'",' + .'`crmp`="'.$aData['crmp'].'",' + .'`mta`="'.$aData['mta'].'",' + .'`mc`="'.$aData['mc'].'",' + .'`ram`="'.$aData['ram'].'",' + .'`test`="'.$aData['test'].'",' + .'`show`="'.$aData['show'].'",' + .'`sort`="'.$aData['sort'].'",' + .'`domain`="'.$aData['domain'].'" WHERE `id`="'.$id.'" LIMIT 1'); - sys::outjs(array('s' => $id)); - } + sys::outjs(array('s' => $id)); + } - $html->get('unit', 'sections/units'); + $html->get('unit', 'sections/units'); - foreach($unit as $i => $val) - $html->set($i, $val); + foreach($unit as $i => $val) + $html->set($i, $val); - foreach(array('cs', 'cssold', 'css', 'csgo', 'samp', 'crmp', 'mta', 'mc') as $game) - { - if($unit[$game]) - $html->unit('game_'.$game, 1); - else - $html->unit('game_'.$game); - } + foreach(array('cs', 'cssold', 'css', 'csgo', 'samp', 'crmp', 'mta', 'mc') as $game) + { + if($unit[$game]) + $html->unit('game_'.$game, 1); + else + $html->unit('game_'.$game); + } - $html->set('show', $unit['show'] == 1 ? '' : ''); + $html->set('show', $unit['show'] == 1 ? '' : ''); - $html->pack('main'); + $html->pack('main'); ?> \ No newline at end of file diff --git a/system/acp/sections/users/action.php b/system/acp/sections/users/action.php index 0e10076..a85e341 100644 --- a/system/acp/sections/users/action.php +++ b/system/acp/sections/users/action.php @@ -1,164 +1,164 @@ 'логина', - 'mail' => 'почты' - ); + $arr_other = array( + 'login' => 'логина', + 'mail' => 'почты' + ); - $arr_other_null = array( - 'name' => 'имени', - 'lastname' => 'фамилии', - 'patronymic' => 'отчества', - 'contacts' => 'контактов', - 'phone' => 'номера' - ); + $arr_other_null = array( + 'name' => 'имени', + 'lastname' => 'фамилии', + 'patronymic' => 'отчества', + 'contacts' => 'контактов', + 'phone' => 'номера' + ); - foreach($arr_other as $input => $name) - if(sys::valid($aData[$input], 'other', $aValid[$input])) - sys::outjs(array('e' => 'Неправильный формат '.$name)); + foreach($arr_other as $input => $name) + if(sys::valid($aData[$input], 'other', $aValid[$input])) + sys::outjs(array('e' => 'Неправильный формат '.$name)); - foreach($arr_other as $input => $name) - { - if($aData[$input] == '') - continue; + foreach($arr_other as $input => $name) + { + if($aData[$input] == '') + continue; - if(sys::valid($aData[$input], 'other', $aValid[$input])) - sys::outjs(array('e' => 'Неправильный формат '.$name)); - } + if(sys::valid($aData[$input], 'other', $aValid[$input])) + sys::outjs(array('e' => 'Неправильный формат '.$name)); + } - $sql->query('SELECT `id` FROM `users` WHERE `id`!="'.$id.'" AND `login`="'.$aData['login'].'" LIMIT 1'); - if($sql->num()) - sys::outjs(array('e' => 'Логин занят другим пользователем')); + $sql->query('SELECT `id` FROM `users` WHERE `id`!="'.$id.'" AND `login`="'.$aData['login'].'" LIMIT 1'); + if($sql->num()) + sys::outjs(array('e' => 'Логин занят другим пользователем')); - $sql->query('SELECT `id` FROM `users` WHERE `id`!="'.$id.'" AND `mail`="'.$aData['mail'].'" LIMIT 1'); - if($sql->num()) - sys::outjs(array('e' => 'Почта занята другим пользователем')); + $sql->query('SELECT `id` FROM `users` WHERE `id`!="'.$id.'" AND `mail`="'.$aData['mail'].'" LIMIT 1'); + if($sql->num()) + sys::outjs(array('e' => 'Почта занята другим пользователем')); - if($aData['contacts'] != '') - { - $sql->query('SELECT `id` FROM `users` WHERE `id`!="'.$id.'" AND `contacts`="'.$aData['contacts'].'" LIMIT 1'); - if($sql->num()) - sys::outjs(array('e' => 'Контакты заняты другим пользователем')); - } + if($aData['contacts'] != '') + { + $sql->query('SELECT `id` FROM `users` WHERE `id`!="'.$id.'" AND `contacts`="'.$aData['contacts'].'" LIMIT 1'); + if($sql->num()) + sys::outjs(array('e' => 'Контакты заняты другим пользователем')); + } - if($aData['phone'] != '') - { - $sql->query('SELECT `id` FROM `users` WHERE `id`!="'.$id.'" AND `phone`="'.$aData['phone'].'" LIMIT 1'); - if($sql->num()) - sys::outjs(array('e' => 'Номер занят другим пользователем')); - } + if($aData['phone'] != '') + { + $sql->query('SELECT `id` FROM `users` WHERE `id`!="'.$id.'" AND `phone`="'.$aData['phone'].'" LIMIT 1'); + if($sql->num()) + sys::outjs(array('e' => 'Номер занят другим пользователем')); + } - if($aData['passwd'] != '') - { - if(sys::valid($aData['passwd'], 'other', $aValid['passwd'])) - sys::outjs(array('e' => 'Неправильный формат пароля')); + if($aData['passwd'] != '') + { + if(sys::valid($aData['passwd'], 'other', $aValid['passwd'])) + sys::outjs(array('e' => 'Неправильный формат пароля')); - $aData['passwd'] = sys::passwdkey($aData['passwd']); - }else - $aData['passwd'] = $us['passwd']; + $aData['passwd'] = sys::passwdkey($aData['passwd']); + }else + $aData['passwd'] = $us['passwd']; - $aData['help'] = $aData['help'] == 0 ? 0 : 1; - $aData['confirm_phone'] = $aData['confirm_phone'] == 0 ? 0 : 1; - $aData['group'] = in_array($aData['group'], array('user', 'support', 'admin')) ? $aData['group'] : $us['group']; - $aData['level'] = in_array($aData['level'], array(0, 1, 2)) ? $aData['level'] : $us['level']; + $aData['help'] = $aData['help'] == 0 ? 0 : 1; + $aData['confirm_phone'] = $aData['confirm_phone'] == 0 ? 0 : 1; + $aData['group'] = in_array($aData['group'], array('user', 'support', 'admin')) ? $aData['group'] : $us['group']; + $aData['level'] = in_array($aData['level'], array(0, 1, 2)) ? $aData['level'] : $us['level']; - if($aData['support_info'] != '' AND sys::valid($aData['support_info'], 'other', $aValid['support_info'])) - sys::outjs(array('e' => 'Неправильный формат подписи')); + if($aData['support_info'] != '' AND sys::valid($aData['support_info'], 'other', $aValid['support_info'])) + sys::outjs(array('e' => 'Неправильный формат подписи')); - if($aData['balance'] == '') $aData['balance'] = 0; + if($aData['balance'] == '') $aData['balance'] = 0; - if(!is_numeric($aData['balance'])) - sys::outjs(array('e' => 'Неправильный формат баланса')); + if(!is_numeric($aData['balance'])) + sys::outjs(array('e' => 'Неправильный формат баланса')); - if(!is_numeric($aData['part_money'])) - sys::outjs(array('e' => 'Неправильный формат заработанных средств')); + if(!is_numeric($aData['part_money'])) + sys::outjs(array('e' => 'Неправильный формат заработанных средств')); - if($aData['replenish'] > 0) - { - if(!is_numeric($aData['replenish'])) - sys::outjs(array('e' => 'Неправильный формат суммы пополнения')); + if($aData['replenish'] > 0) + { + if(!is_numeric($aData['replenish'])) + sys::outjs(array('e' => 'Неправильный формат суммы пополнения')); - $aData['balance'] += $aData['replenish']; + $aData['balance'] += $aData['replenish']; - $sql->query('INSERT INTO `logs` set `user`="'.$id.'", `text`="Пополнение баланса на сумму: '.$aData['replenish'].' '.$cfg['currency'].' (прямой платеж)", `date`="'.$start_point.'", `type`="replenish", `money`="'.$aData['replenish'].'"'); - } + $sql->query('INSERT INTO `logs` set `user`="'.$id.'", `text`="Пополнение баланса на сумму: '.$aData['replenish'].' '.$cfg['currency'].' (прямой платеж)", `date`="'.$start_point.'", `type`="replenish", `money`="'.$aData['replenish'].'"'); + } - if($aData['part_money'] < $us['part_money']) - { - $cashout = round($us['part_money']-$aData['part_money'], 2); + if($aData['part_money'] < $us['part_money']) + { + $cashout = round($us['part_money']-$aData['part_money'], 2); - $sql->query('INSERT INTO `logs` set `user`="'.$id.'", `text`="Вывод заработанных средств: '.$cashout.' '.$cfg['currency'].'", `date`="'.$start_point.'", `type`="cashout", `money`="'.$cashout.'"'); - } + $sql->query('INSERT INTO `logs` set `user`="'.$id.'", `text`="Вывод заработанных средств: '.$cashout.' '.$cfg['currency'].'", `date`="'.$start_point.'", `type`="cashout", `money`="'.$cashout.'"'); + } - if($aData['rental']) - { - $rental = sys::int($aData['rental']); + if($aData['rental']) + { + $rental = sys::int($aData['rental']); - if($rental) - $aData['rental'] = strpos($aData['rental'], '%') ? $rental.'%' : $rental; - else - $aData['rental'] = 0; - }else - $aData['rental'] = 0; + if($rental) + $aData['rental'] = strpos($aData['rental'], '%') ? $rental.'%' : $rental; + else + $aData['rental'] = 0; + }else + $aData['rental'] = 0; - if(strlen($aData['rental']) > 4) - sys::outjs(array('e' => 'Неправильно указана скидка на аренду')); + if(strlen($aData['rental']) > 4) + sys::outjs(array('e' => 'Неправильно указана скидка на аренду')); - if($aData['extend']) - { - $extend = sys::int($aData['extend']); + if($aData['extend']) + { + $extend = sys::int($aData['extend']); - if($extend) - $aData['extend'] = strpos($aData['extend'], '%') ? $extend.'%' : $extend; - else - $aData['extend'] = 0; - }else - $aData['extend'] = 0; + if($extend) + $aData['extend'] = strpos($aData['extend'], '%') ? $extend.'%' : $extend; + else + $aData['extend'] = 0; + }else + $aData['extend'] = 0; - if(strlen($aData['extend']) > 4) - sys::outjs(array('e' => 'Неправильно указана скидка на аренду')); + if(strlen($aData['extend']) > 4) + sys::outjs(array('e' => 'Неправильно указана скидка на аренду')); - $sql->query('UPDATE `users` set ' - .'`login`="'.$aData['login'].'",' - .'`mail`="'.$aData['mail'].'",' - .'`passwd`="'.$aData['passwd'].'",' - .'`name`="'.$aData['name'].'",' - .'`lastname`="'.$aData['lastname'].'",' - .'`patronymic`="'.$aData['patronymic'].'",' - .'`balance`="'.$aData['balance'].'",' - .'`part_money`="'.$aData['part_money'].'",' - .'`group`="'.$aData['group'].'",' - .'`support_info`="'.$aData['support_info'].'",' - .'`level`="'.$aData['level'].'",' - .'`contacts`="'.$aData['contacts'].'",' - .'`phone`="'.$aData['phone'].'",' - .'`confirm_phone`="'.$aData['confirm_phone'].'",' - .'`help`="'.$aData['help'].'",' - .'`rental`="'.$aData['rental'].'",' - .'`extend`="'.$aData['extend'].'" WHERE `id`="'.$id.'" LIMIT 1'); + $sql->query('UPDATE `users` set ' + .'`login`="'.$aData['login'].'",' + .'`mail`="'.$aData['mail'].'",' + .'`passwd`="'.$aData['passwd'].'",' + .'`name`="'.$aData['name'].'",' + .'`lastname`="'.$aData['lastname'].'",' + .'`patronymic`="'.$aData['patronymic'].'",' + .'`balance`="'.$aData['balance'].'",' + .'`part_money`="'.$aData['part_money'].'",' + .'`group`="'.$aData['group'].'",' + .'`support_info`="'.$aData['support_info'].'",' + .'`level`="'.$aData['level'].'",' + .'`contacts`="'.$aData['contacts'].'",' + .'`phone`="'.$aData['phone'].'",' + .'`confirm_phone`="'.$aData['confirm_phone'].'",' + .'`help`="'.$aData['help'].'",' + .'`rental`="'.$aData['rental'].'",' + .'`extend`="'.$aData['extend'].'" WHERE `id`="'.$id.'" LIMIT 1'); - sys::outjs(array('s' => 'ok')); + sys::outjs(array('s' => 'ok')); ?> \ No newline at end of file diff --git a/system/acp/sections/users/delete.php b/system/acp/sections/users/delete.php index 0b5d18b..08c3cba 100644 --- a/system/acp/sections/users/delete.php +++ b/system/acp/sections/users/delete.php @@ -1,38 +1,38 @@ query('DELETE FROM `auth` WHERE `user`="'.$id.'"'); - $sql->query('DELETE FROM `logs` WHERE `user`="'.$id.'"'); + if(isset($url['delete']) AND $url['delete'] == 'all') + { + $sql->query('DELETE FROM `auth` WHERE `user`="'.$id.'"'); + $sql->query('DELETE FROM `logs` WHERE `user`="'.$id.'"'); - $helps = $sql->query('SELECT `id` FROM `help` WHERE `user`="'.$id.'"'); - while($help = $sql->get($helps)) - { - $sql->query('DELETE FROM `help_dialogs` WHERE `help`="'.$help['id'].'"'); - $sql->query('DELETE FROM `help` WHERE `id`="'.$help['id'].'" LIMIT 1'); - } + $helps = $sql->query('SELECT `id` FROM `help` WHERE `user`="'.$id.'"'); + while($help = $sql->get($helps)) + { + $sql->query('DELETE FROM `help_dialogs` WHERE `help`="'.$help['id'].'"'); + $sql->query('DELETE FROM `help` WHERE `id`="'.$help['id'].'" LIMIT 1'); + } - $uploads = $sql->query('SELECT `id`, `name` FROM `help_upload` WHERE `user`="'.$id.'"'); - while($upload = $sql->get($uploads)) - { - @unlink(ROOT.'upload/'.$upload['name']); + $uploads = $sql->query('SELECT `id`, `name` FROM `help_upload` WHERE `user`="'.$id.'"'); + while($upload = $sql->get($uploads)) + { + @unlink(ROOT.'upload/'.$upload['name']); - $sql->query('DELETE FROM `help_upload` WHERE `id`="'.$upload['id'].'" LIMIT 1'); - } + $sql->query('DELETE FROM `help_upload` WHERE `id`="'.$upload['id'].'" LIMIT 1'); + } - $sql->query('DELETE FROM `logs_sys` WHERE `user`="'.$id.'"'); - $sql->query('DELETE FROM `owners` WHERE `user`="'.$id.'"'); - $sql->query('DELETE FROM `promo_use` WHERE `user`="'.$id.'"'); - $sql->query('DELETE FROM `recovery` WHERE `user`="'.$id.'"'); - $sql->query('DELETE FROM `security` WHERE `user`="'.$id.'"'); + $sql->query('DELETE FROM `logs_sys` WHERE `user`="'.$id.'"'); + $sql->query('DELETE FROM `owners` WHERE `user`="'.$id.'"'); + $sql->query('DELETE FROM `promo_use` WHERE `user`="'.$id.'"'); + $sql->query('DELETE FROM `recovery` WHERE `user`="'.$id.'"'); + $sql->query('DELETE FROM `security` WHERE `user`="'.$id.'"'); - $sql->query('UPDATE `servers` set `user`="0" WHERE `user`="'.$id.'"'); - $sql->query('UPDATE `web` set `user`="0" WHERE `user`="'.$id.'"'); - } + $sql->query('UPDATE `servers` set `user`="0" WHERE `user`="'.$id.'"'); + $sql->query('UPDATE `web` set `user`="0" WHERE `user`="'.$id.'"'); + } - $sql->query('DELETE FROM `users` WHERE `id`="'.$id.'" LIMIT 1'); + $sql->query('DELETE FROM `users` WHERE `id`="'.$id.'" LIMIT 1'); - sys::outjs(array('s' => 'ok')); + sys::outjs(array('s' => 'ok')); ?> \ No newline at end of file diff --git a/system/acp/sections/users/index.php b/system/acp/sections/users/index.php index 28e8f47..0b4f651 100644 --- a/system/acp/sections/users/index.php +++ b/system/acp/sections/users/index.php @@ -1,65 +1,65 @@ $sort); - } + $sort_icon = array($url['sort'] => $sort); + } - $list = ''; + $list = ''; - $aGroup = array('user' => 'Пользователь', 'support' => 'Тех. поддержка', 'admin' => 'Администратор'); + $aGroup = array('user' => 'Пользователь', 'support' => 'Тех. поддержка', 'admin' => 'Администратор'); - $sql->query('SELECT `id` FROM `users`'); + $sql->query('SELECT `id` FROM `users`'); - $aPage = sys::page($page, $sql->num(), 20); + $aPage = sys::page($page, $sql->num(), 20); - sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/users'.$sort_page); + sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/users'.$sort_page); - $sql->query('SELECT `id`, `login`, `mail`, `balance`, `group` FROM `users` '.$sort_sql.' LIMIT '.$aPage['num'].', 20'); - while($us = $sql->get()) - { - $list .= ''; - $list .= ''.$us['id'].''; - $list .= ''.$us['login'].''; - $list .= ''.$us['mail'].''; - $list .= ''.$us['balance'].' '.$cfg['currency'].''; - $list .= ''.$aGroup[$us['group']].''; - $list .= 'Удалить'; - $list .= ''; - } + $sql->query('SELECT `id`, `login`, `mail`, `balance`, `group` FROM `users` '.$sort_sql.' LIMIT '.$aPage['num'].', 20'); + while($us = $sql->get()) + { + $list .= ''; + $list .= ''.$us['id'].''; + $list .= ''.$us['login'].''; + $list .= ''.$us['mail'].''; + $list .= ''.$us['balance'].' '.$cfg['currency'].''; + $list .= ''.$aGroup[$us['group']].''; + $list .= 'Удалить'; + $list .= ''; + } - $html->get('index', 'sections/users'); + $html->get('index', 'sections/users'); - $html->set('sort_id', 'asc'); - $html->set('sort_balance', 'asc'); - $html->set('sort_group', 'asc'); + $html->set('sort_id', 'asc'); + $html->set('sort_balance', 'asc'); + $html->set('sort_group', 'asc'); - if(isset($sort_icon)) - $html->set('sort_'.key($sort_icon), array_shift($sort_icon)); + if(isset($sort_icon)) + $html->set('sort_'.key($sort_icon), array_shift($sort_icon)); - $html->set('list', $list); + $html->set('list', $list); - $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); + $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); - $html->pack('main'); - } + $html->pack('main'); + } ?> \ No newline at end of file diff --git a/system/acp/sections/users/offline.php b/system/acp/sections/users/offline.php index 658bca1..bc2f2a1 100644 --- a/system/acp/sections/users/offline.php +++ b/system/acp/sections/users/offline.php @@ -1,34 +1,34 @@ 'Пользователь', 'support' => 'Тех. поддержка', 'admin' => 'Администратор'); + $aGroup = array('user' => 'Пользователь', 'support' => 'Тех. поддержка', 'admin' => 'Администратор'); - $sql->query('SELECT `id` FROM `users` WHERE `time`<"'.($start_point-181).'"'); + $sql->query('SELECT `id` FROM `users` WHERE `time`<"'.($start_point-181).'"'); - $aPage = sys::page($page, $sql->num(), 20); + $aPage = sys::page($page, $sql->num(), 20); - sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/users/section'); + sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/users/section'); - $sql->query('SELECT `id`, `login`, `mail`, `group`, `time` FROM `users` WHERE `time`<"'.($start_point-181).'" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); - while($us = $sql->get()) - { - $list .= ''; - $list .= ''.$us['id'].''; - $list .= ''.$us['login'].''; - $list .= ''.$us['mail'].''; - $list .= ''.$aGroup[$us['group']].''; - $list .= ''.sys::today($us['time']).''; - $list .= 'Удалить'; - $list .= ''; - } + $sql->query('SELECT `id`, `login`, `mail`, `group`, `time` FROM `users` WHERE `time`<"'.($start_point-181).'" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); + while($us = $sql->get()) + { + $list .= ''; + $list .= ''.$us['id'].''; + $list .= ''.$us['login'].''; + $list .= ''.$us['mail'].''; + $list .= ''.$aGroup[$us['group']].''; + $list .= ''.sys::today($us['time']).''; + $list .= 'Удалить'; + $list .= ''; + } - $html->get('offline', 'sections/users'); + $html->get('offline', 'sections/users'); - $html->set('list', $list); - $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); + $html->set('list', $list); + $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); - $html->pack('main'); + $html->pack('main'); ?> \ No newline at end of file diff --git a/system/acp/sections/users/online.php b/system/acp/sections/users/online.php index df6840c..fd8dc81 100644 --- a/system/acp/sections/users/online.php +++ b/system/acp/sections/users/online.php @@ -1,39 +1,39 @@ 'Пользователь', 'support' => 'Тех. поддержка', 'admin' => 'Администратор'); + $aGroup = array('user' => 'Пользователь', 'support' => 'Тех. поддержка', 'admin' => 'Администратор'); - $sql->query('SELECT `id` FROM `users` WHERE `time`>"'.($start_point-180).'"'); + $sql->query('SELECT `id` FROM `users` WHERE `time`>"'.($start_point-180).'"'); - $aPage = sys::page($page, $sql->num(), 20); + $aPage = sys::page($page, $sql->num(), 20); - sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/users/section'); + sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/users/section'); - include(LIB.'geo.php'); + include(LIB.'geo.php'); - $SxGeo = new SxGeo(DATA.'SxGeoCity.dat'); + $SxGeo = new SxGeo(DATA.'SxGeoCity.dat'); - $sql->query('SELECT `id`, `login`, `group`, `ip`, `browser` FROM `users` WHERE `time`>"'.($start_point-180).'" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); - while($us = $sql->get()) - { - $list .= ''; - $list .= ''.$us['id'].''; - $list .= ''.$us['login'].''; - $list .= ''.$aGroup[$us['group']].''; - $list .= ''.sys::browser($us['browser']).''; - $list .= ''.$us['ip'].''; - $list .= ''.sys::country($us['ip']).''; - $list .= 'Удалить'; - $list .= ''; - } + $sql->query('SELECT `id`, `login`, `group`, `ip`, `browser` FROM `users` WHERE `time`>"'.($start_point-180).'" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); + while($us = $sql->get()) + { + $list .= ''; + $list .= ''.$us['id'].''; + $list .= ''.$us['login'].''; + $list .= ''.$aGroup[$us['group']].''; + $list .= ''.sys::browser($us['browser']).''; + $list .= ''.$us['ip'].''; + $list .= ''.sys::country($us['ip']).''; + $list .= 'Удалить'; + $list .= ''; + } - $html->get('online', 'sections/users'); + $html->get('online', 'sections/users'); - $html->set('list', $list); - $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); + $html->set('list', $list); + $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); - $html->pack('main'); + $html->pack('main'); ?> \ No newline at end of file diff --git a/system/acp/sections/users/search.php b/system/acp/sections/users/search.php index bb94c7a..176af6f 100644 --- a/system/acp/sections/users/search.php +++ b/system/acp/sections/users/search.php @@ -1,67 +1,67 @@ get($mkey); + $cache = $mcache->get($mkey); - if(is_array($cache)) - { - if($go) - sys::outjs($cache, $nmch); + if(is_array($cache)) + { + if($go) + sys::outjs($cache, $nmch); - sys::outjs($cache); - } + sys::outjs($cache); + } - if(!isset($text{2})) - { - if($go) - sys::outjs(array('e' => 'Для выполнения поиска, необходимо больше данных'), $nmch); + if(!isset($text{2})) + { + if($go) + sys::outjs(array('e' => 'Для выполнения поиска, необходимо больше данных'), $nmch); - sys::outjs(array('e' => '')); - } + sys::outjs(array('e' => '')); + } - if($text{0} == 'i' AND $text{1} == 'd') - $sql->query('SELECT `id`, `login`, `mail`, `balance`, `group` FROM `users` WHERE `id`="'.sys::int($text).'" LIMIT 1'); - else{ - $like = '`id` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' - .'`login` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' - .'`mail` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' - .'`balance` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' - .'`group` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' - .'`phone` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' - .'`contacts` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' - .'`ip` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\')'; + if($text{0} == 'i' AND $text{1} == 'd') + $sql->query('SELECT `id`, `login`, `mail`, `balance`, `group` FROM `users` WHERE `id`="'.sys::int($text).'" LIMIT 1'); + else{ + $like = '`id` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' + .'`login` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' + .'`mail` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' + .'`balance` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' + .'`group` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' + .'`phone` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' + .'`contacts` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' + .'`ip` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\')'; - $sql->query('SELECT `id`, `login`, `mail`, `balance`, `group` FROM `users` WHERE '.$like.' ORDER BY `id` ASC LIMIT 10'); - } + $sql->query('SELECT `id`, `login`, `mail`, `balance`, `group` FROM `users` WHERE '.$like.' ORDER BY `id` ASC LIMIT 10'); + } - if(!$sql->num()) - { - if($go) - sys::outjs(array('e' => 'По вашему запросу ничего не найдено'), $nmch); + if(!$sql->num()) + { + if($go) + sys::outjs(array('e' => 'По вашему запросу ничего не найдено'), $nmch); - sys::outjs(array('e' => 'По вашему запросу ничего не найдено')); - } + sys::outjs(array('e' => 'По вашему запросу ничего не найдено')); + } - $list = ''; + $list = ''; - while($us = $sql->get()) - { - $list .= ''; - $list .= ''.$us['id'].''; - $list .= ''.$us['login'].''; - $list .= ''.$us['mail'].''; - $list .= ''.$us['balance'].' '.$cfg['currency'].''; - $list .= ''.$aGroup[$us['group']].''; - $list .= 'Удалить'; - $list .= ''; - } + while($us = $sql->get()) + { + $list .= ''; + $list .= ''.$us['id'].''; + $list .= ''.$us['login'].''; + $list .= ''.$us['mail'].''; + $list .= ''.$us['balance'].' '.$cfg['currency'].''; + $list .= ''.$aGroup[$us['group']].''; + $list .= 'Удалить'; + $list .= ''; + } - $mcache->set($mkey, array('s' => $list), false, 15); + $mcache->set($mkey, array('s' => $list), false, 15); - sys::outjs(array('s' => $list)); + sys::outjs(array('s' => $list)); ?> \ No newline at end of file diff --git a/system/acp/sections/users/signup.php b/system/acp/sections/users/signup.php index fe9ad72..dd4b963 100644 --- a/system/acp/sections/users/signup.php +++ b/system/acp/sections/users/signup.php @@ -1,31 +1,31 @@ query('DELETE FROM `signup` WHERE `id`="'.$id.'" LIMIT 1'); + if(isset($url['delete'])) + { + $sql->query('DELETE FROM `signup` WHERE `id`="'.$id.'" LIMIT 1'); - sys::outjs(array('s' => 'ok')); - } + sys::outjs(array('s' => 'ok')); + } - $list = ''; + $list = ''; - $sql->query('SELECT `id`, `mail`, `key`, `date` FROM `signup` ORDER BY `id` ASC'); - while($sign = $sql->get()) - { - $list .= ''; - $list .= ''.$sign['id'].''; - $list .= ''.$sign['mail'].''; - $list .= ''.$sign['key'].''; - $list .= ''.sys::today($sign['date']).''; - $list .= 'Удалить'; - $list .= ''; - } + $sql->query('SELECT `id`, `mail`, `key`, `date` FROM `signup` ORDER BY `id` ASC'); + while($sign = $sql->get()) + { + $list .= ''; + $list .= ''.$sign['id'].''; + $list .= ''.$sign['mail'].''; + $list .= ''.$sign['key'].''; + $list .= ''.sys::today($sign['date']).''; + $list .= 'Удалить'; + $list .= ''; + } - $html->get('signup', 'sections/users'); + $html->get('signup', 'sections/users'); - $html->set('list', $list); + $html->set('list', $list); - $html->pack('main'); + $html->pack('main'); ?> \ No newline at end of file diff --git a/system/acp/sections/users/stats.php b/system/acp/sections/users/stats.php index 6d075e6..187afac 100644 --- a/system/acp/sections/users/stats.php +++ b/system/acp/sections/users/stats.php @@ -1,36 +1,36 @@ query('SELECT `id`, `login`, `mail`, `balance` FROM `users` WHERE `group`="user" AND `balance`!="0" ORDER BY `balance` DESC LIMIT 10'); - while($us = $sql->get($uss)) - { - $sql->query('SELECT `id` FROM `servers` WHERE `user`="'.$us['id'].'" LIMIT 10'); - $servers = $sql->num(); + $uss = $sql->query('SELECT `id`, `login`, `mail`, `balance` FROM `users` WHERE `group`="user" AND `balance`!="0" ORDER BY `balance` DESC LIMIT 10'); + while($us = $sql->get($uss)) + { + $sql->query('SELECT `id` FROM `servers` WHERE `user`="'.$us['id'].'" LIMIT 10'); + $servers = $sql->num(); - $list .= ''; - $list .= ''.$us['id'].''; - $list .= ''.$us['login'].''; - $list .= ''.$us['mail'].''; - $list .= ''.$us['balance'].' '.$cfg['currency'].''; - $list .= ''.$servers.' шт.'; - $list .= ''; - } + $list .= ''; + $list .= ''.$us['id'].''; + $list .= ''.$us['login'].''; + $list .= ''.$us['mail'].''; + $list .= ''.$us['balance'].' '.$cfg['currency'].''; + $list .= ''.$servers.' шт.'; + $list .= ''; + } - $html->get('stats', 'sections/users'); + $html->get('stats', 'sections/users'); - $html->set('list', $list); + $html->set('list', $list); - $sql->query('SELECT `balance` FROM `users` WHERE `group`="user" AND `balance`!="0"'); - $html->set('users', $sql->num()); + $sql->query('SELECT `balance` FROM `users` WHERE `group`="user" AND `balance`!="0"'); + $html->set('users', $sql->num()); - $money = 0; - while($us = $sql->get()) - $money += $us['balance']; + $money = 0; + while($us = $sql->get()) + $money += $us['balance']; - $html->set('money', $money); + $html->set('money', $money); - $html->pack('main'); + $html->pack('main'); ?> \ No newline at end of file diff --git a/system/acp/sections/users/user.php b/system/acp/sections/users/user.php index af3b622..a1a174d 100644 --- a/system/acp/sections/users/user.php +++ b/system/acp/sections/users/user.php @@ -1,125 +1,125 @@ 'Работает', - 'off' => 'Выключен', - 'start' => 'Запускается', - 'restart' => 'Перезапускается', - 'change' => 'Смена карты', - 'install' => 'Устанавливается', - 'reinstall' => 'Переустанавливается', - 'update' => 'Обновляется', - 'recovery' => 'Восстанавливается', - 'overdue' => 'Просрочен', - 'blocked' => 'Заблокирован' - ); - - $sql->query('SELECT * FROM `users` WHERE `id`="'.$id.'" LIMIT 1'); - $us = $sql->get(); + $status = array( + 'working' => 'Работает', + 'off' => 'Выключен', + 'start' => 'Запускается', + 'restart' => 'Перезапускается', + 'change' => 'Смена карты', + 'install' => 'Устанавливается', + 'reinstall' => 'Переустанавливается', + 'update' => 'Обновляется', + 'recovery' => 'Восстанавливается', + 'overdue' => 'Просрочен', + 'blocked' => 'Заблокирован' + ); + + $sql->query('SELECT * FROM `users` WHERE `id`="'.$id.'" LIMIT 1'); + $us = $sql->get(); - if($go) - include(SEC.'users/action.php'); + if($go) + include(SEC.'users/action.php'); - $auth_list = ''; + $auth_list = ''; - include(LIB.'geo.php'); + include(LIB.'geo.php'); - $SxGeo = new SxGeo(DATA.'SxGeoCity.dat'); + $SxGeo = new SxGeo(DATA.'SxGeoCity.dat'); - $sql->query('SELECT `ip`, `date`, `browser` FROM `auth` WHERE `user`="'.$id.'" ORDER BY `id` DESC LIMIT 15'); - while($auth_info = $sql->get()) - { - $auth_list .= ''; - $auth_list .= 'Авторизация через браузер: '.sys::browser(base64_decode($auth_info['browser'])).''; - $auth_list .= ''.$auth_info['ip'].''; - $auth_list .= ''.sys::country($auth_info['ip']).''; - $auth_list .= ''.sys::today($auth_info['date']).''; - $auth_list .= ''; - } + $sql->query('SELECT `ip`, `date`, `browser` FROM `auth` WHERE `user`="'.$id.'" ORDER BY `id` DESC LIMIT 15'); + while($auth_info = $sql->get()) + { + $auth_list .= ''; + $auth_list .= 'Авторизация через браузер: '.sys::browser(base64_decode($auth_info['browser'])).''; + $auth_list .= ''.$auth_info['ip'].''; + $auth_list .= ''.sys::country($auth_info['ip']).''; + $auth_list .= ''.sys::today($auth_info['date']).''; + $auth_list .= ''; + } - $logs_list = ''; + $logs_list = ''; - $sql->query('SELECT `text`, `date` FROM `logs` WHERE `user`="'.$id.'" ORDER BY `id` DESC LIMIT 30'); - while($logs_info = $sql->get()) - { - $logs_list .= ''; - $logs_list .= ''.$logs_info['text'].''; - $logs_list .= ''.sys::today($logs_info['date']).''; - $logs_list .= ''; - } - - $serv_user = ''; + $sql->query('SELECT `text`, `date` FROM `logs` WHERE `user`="'.$id.'" ORDER BY `id` DESC LIMIT 30'); + while($logs_info = $sql->get()) + { + $logs_list .= ''; + $logs_list .= ''.$logs_info['text'].''; + $logs_list .= ''.sys::today($logs_info['date']).''; + $logs_list .= ''; + } + + $serv_user = ''; - $servers_user = $sql->query('SELECT `id`, `unit`, `tarif`, `user`, `address`, `game`, `status`, `slots`, `name`, `time`, `online` FROM `servers` WHERE `user`="'.$id.'" ORDER BY `id` DESC LIMIT 30'); - while($server_user = $sql->get($servers_user)) - { - $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$server_user['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $servers_user = $sql->query('SELECT `id`, `unit`, `tarif`, `user`, `address`, `game`, `status`, `slots`, `name`, `time`, `online` FROM `servers` WHERE `user`="'.$id.'" ORDER BY `id` DESC LIMIT 30'); + while($server_user = $sql->get($servers_user)) + { + $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$server_user['unit'].'" LIMIT 1'); + $unit = $sql->get(); - $sql->query('SELECT `name` FROM `tarifs` WHERE `id`="'.$server_user['tarif'].'" LIMIT 1'); - $tarif = $sql->get(); - - $serv_user .= ''; - $serv_user .= ''.$server_user['id'].''; - $serv_user .= ''.$server_user['address'].' (Перейти)'; - $serv_user .= '#'.$server_user['tarif'].' '.$tarif['name'].''; - $serv_user .= ''.$status[$server_user['status']].''; - $serv_user .= ''.strtoupper($aGname[$server_user['game']]).''; - $serv_user .= ''.$time_end = $server_user['status'] == 'overdue' ? 'Удаление через: '.sys::date('min', $server_user['overdue']+$cfg['server_delete']*86400) : 'Осталось: '.sys::date('min', $server_user['time']).''; - $serv_user .= ''; - } + $sql->query('SELECT `name` FROM `tarifs` WHERE `id`="'.$server_user['tarif'].'" LIMIT 1'); + $tarif = $sql->get(); + + $serv_user .= ''; + $serv_user .= ''.$server_user['id'].''; + $serv_user .= ''.$server_user['address'].' (Перейти)'; + $serv_user .= '#'.$server_user['tarif'].' '.$tarif['name'].''; + $serv_user .= ''.$status[$server_user['status']].''; + $serv_user .= ''.strtoupper($aGname[$server_user['game']]).''; + $serv_user .= ''.$time_end = $server_user['status'] == 'overdue' ? 'Удаление через: '.sys::date('min', $server_user['overdue']+$cfg['server_delete']*86400) : 'Осталось: '.sys::date('min', $server_user['time']).''; + $serv_user .= ''; + } - $money_all = 0; - $money_buy = 0; - $money_month = 0; - - $sql->query('SELECT `money` FROM `logs` WHERE `user`="'.$us['id'].'" AND (`type`="buy" OR `type`="extend")'); - while($logs = $sql->get()) - $money_all += $logs['money']; + $money_all = 0; + $money_buy = 0; + $money_month = 0; + + $sql->query('SELECT `money` FROM `logs` WHERE `user`="'.$us['id'].'" AND (`type`="buy" OR `type`="extend")'); + while($logs = $sql->get()) + $money_all += $logs['money']; - $sql->query('SELECT `money` FROM `logs` WHERE `user`="'.$us['id'].'" AND `type`="buy"'); - while($logs = $sql->get()) - $money_buy += $logs['money']; + $sql->query('SELECT `money` FROM `logs` WHERE `user`="'.$us['id'].'" AND `type`="buy"'); + while($logs = $sql->get()) + $money_buy += $logs['money']; - $time = (params::$aDayMonth[date('n', $start_point)]-date('j', $start_point))*86400; + $time = (params::$aDayMonth[date('n', $start_point)]-date('j', $start_point))*86400; - $sql->query('SELECT `money` FROM `logs` WHERE `user`="'.$us['id'].'" AND (`type`="buy" OR `type`="extend") AND `date`>"'.($start_point-$time).'"'); - while($logs = $sql->get()) - $money_month += $logs['money']; + $sql->query('SELECT `money` FROM `logs` WHERE `user`="'.$us['id'].'" AND (`type`="buy" OR `type`="extend") AND `date`>"'.($start_point-$time).'"'); + while($logs = $sql->get()) + $money_month += $logs['money']; - $html->get('user', 'sections/users'); + $html->get('user', 'sections/users'); - foreach($us as $i => $val) - $html->set($i, $val); + foreach($us as $i => $val) + $html->set($i, $val); - $html->set('time', $us['time'] < $start_point-600 ? sys::today($us['time']) : sys::ago($us['time'])); - $html->set('date', sys::today($us['date'])); + $html->set('time', $us['time'] < $start_point-600 ? sys::today($us['time']) : sys::ago($us['time'])); + $html->set('date', sys::today($us['date'])); - $html->set('month', mb_strtolower(params::$aNameMonth[sys::int(date('n', $start_point))], 'UTF-8')); - $html->set('money_all', $money_all); - $html->set('money_buy', $money_buy); - $html->set('money_extend', $money_all-$money_buy); - $html->set('money_month', $money_month); + $html->set('month', mb_strtolower(params::$aNameMonth[sys::int(date('n', $start_point))], 'UTF-8')); + $html->set('money_all', $money_all); + $html->set('money_buy', $money_buy); + $html->set('money_extend', $money_all-$money_buy); + $html->set('money_month', $money_month); - $html->set('auth', $auth_list); - $html->set('logs', $logs_list); - $html->set('serv_user', $serv_user); + $html->set('auth', $auth_list); + $html->set('logs', $logs_list); + $html->set('serv_user', $serv_user); - $html->set('confirm_phone', str_replace($us['confirm_phone'], $us['confirm_phone'].'" selected="select', '')); - $html->set('group', str_replace($us['group'], $us['group'].'" selected="select', '')); - $html->set('help', str_replace($us['help'], $us['help'].'" selected="select', '')); + $html->set('confirm_phone', str_replace($us['confirm_phone'], $us['confirm_phone'].'" selected="select', '')); + $html->set('group', str_replace($us['group'], $us['group'].'" selected="select', '')); + $html->set('help', str_replace($us['help'], $us['help'].'" selected="select', '')); - if($us['group'] == 'support') - { - $html->set('level', str_replace($us['level'].'"', $us['level'].'" selected="select"', '')); - $html->unit('support', true, true); - }else - $html->unit('support', false, true); + if($us['group'] == 'support') + { + $html->set('level', str_replace($us['level'].'"', $us['level'].'" selected="select"', '')); + $html->unit('support', true, true); + }else + $html->unit('support', false, true); - $html->set('rental', $us['rental']); - $html->set('extend', $us['extend']); + $html->set('rental', $us['rental']); + $html->set('extend', $us['extend']); - $html->pack('main'); + $html->pack('main'); ?> \ No newline at end of file diff --git a/system/acp/sections/web/amxbans.php b/system/acp/sections/web/amxbans.php index fe1126d..cb87f3e 100644 --- a/system/acp/sections/web/amxbans.php +++ b/system/acp/sections/web/amxbans.php @@ -1,58 +1,58 @@ query('SELECT `id` FROM `web`'); + $sql->query('SELECT `id` FROM `web`'); - $aPage = sys::page($page, $sql->num(), 20); + $aPage = sys::page($page, $sql->num(), 20); - sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/web'); + sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/web'); - $webs = $sql->query('SELECT `id`, `type`, `server`, `user`, `unit`, `domain`, `passwd`, `login`, `date` FROM `web` WHERE `type`="amxbans" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); - while($web = $sql->get($webs)) - { - if(!$web['unit']) - $unit = array('name' => 'Веб хостинг'); - else{ - $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$web['unit'].'" LIMIT 1'); - $unit = $sql->get(); - } + $webs = $sql->query('SELECT `id`, `type`, `server`, `user`, `unit`, `domain`, `passwd`, `login`, `date` FROM `web` WHERE `type`="amxbans" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); + while($web = $sql->get($webs)) + { + if(!$web['unit']) + $unit = array('name' => 'Веб хостинг'); + else{ + $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$web['unit'].'" LIMIT 1'); + $unit = $sql->get(); + } - $list .= ''; - $list .= ''.$web['id'].''; - $list .= 'USER_'.$web['user'].''; - $list .= ''.$web['domain'].''; - $list .= ''.$web['login'].''; - $list .= ''.date('H:i:s', $web['date']).''; - $list .= 'Перейти'; - $list .= ''; + $list .= ''; + $list .= ''.$web['id'].''; + $list .= 'USER_'.$web['user'].''; + $list .= ''.$web['domain'].''; + $list .= ''.$web['login'].''; + $list .= ''.date('H:i:s', $web['date']).''; + $list .= 'Перейти'; + $list .= ''; - $list .= ''; - $list .= ''.$aWebname[$web['type']].''; - $list .= 'SERVER_'.$web['server'].''; - $list .= ''.$unit['name'].''; - $list .= ''.$web['passwd'].''; - $list .= ''.date('d.n.Y', $web['date']).''; - $list .= 'Удалить'; - $list .= ''; - } + $list .= ''; + $list .= ''.$aWebname[$web['type']].''; + $list .= 'SERVER_'.$web['server'].''; + $list .= ''.$unit['name'].''; + $list .= ''.$web['passwd'].''; + $list .= ''.date('d.n.Y', $web['date']).''; + $list .= 'Удалить'; + $list .= ''; + } - $html->get('index', 'sections/web'); + $html->get('index', 'sections/web'); - $html->set('list', $list); + $html->set('list', $list); - $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); + $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); - $html->pack('main'); - } + $html->pack('main'); + } ?> \ No newline at end of file diff --git a/system/acp/sections/web/astats.php b/system/acp/sections/web/astats.php index 6699189..4b65083 100644 --- a/system/acp/sections/web/astats.php +++ b/system/acp/sections/web/astats.php @@ -1,58 +1,58 @@ query('SELECT `id` FROM `web`'); + $sql->query('SELECT `id` FROM `web`'); - $aPage = sys::page($page, $sql->num(), 20); + $aPage = sys::page($page, $sql->num(), 20); - sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/web'); + sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/web'); - $webs = $sql->query('SELECT `id`, `type`, `server`, `user`, `unit`, `domain`, `passwd`, `login`, `date` FROM `web` WHERE `type`="astats" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); - while($web = $sql->get($webs)) - { - if(!$web['unit']) - $unit = array('name' => 'Веб хостинг'); - else{ - $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$web['unit'].'" LIMIT 1'); - $unit = $sql->get(); - } + $webs = $sql->query('SELECT `id`, `type`, `server`, `user`, `unit`, `domain`, `passwd`, `login`, `date` FROM `web` WHERE `type`="astats" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); + while($web = $sql->get($webs)) + { + if(!$web['unit']) + $unit = array('name' => 'Веб хостинг'); + else{ + $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$web['unit'].'" LIMIT 1'); + $unit = $sql->get(); + } - $list .= ''; - $list .= ''.$web['id'].''; - $list .= 'USER_'.$web['user'].''; - $list .= ''.$web['domain'].''; - $list .= ''.$web['login'].''; - $list .= ''.date('H:i:s', $web['date']).''; - $list .= 'Перейти'; - $list .= ''; + $list .= ''; + $list .= ''.$web['id'].''; + $list .= 'USER_'.$web['user'].''; + $list .= ''.$web['domain'].''; + $list .= ''.$web['login'].''; + $list .= ''.date('H:i:s', $web['date']).''; + $list .= 'Перейти'; + $list .= ''; - $list .= ''; - $list .= ''.$aWebname[$web['type']].''; - $list .= 'SERVER_'.$web['server'].''; - $list .= ''.$unit['name'].''; - $list .= ''.$web['passwd'].''; - $list .= ''.date('d.n.Y', $web['date']).''; - $list .= 'Удалить'; - $list .= ''; - } + $list .= ''; + $list .= ''.$aWebname[$web['type']].''; + $list .= 'SERVER_'.$web['server'].''; + $list .= ''.$unit['name'].''; + $list .= ''.$web['passwd'].''; + $list .= ''.date('d.n.Y', $web['date']).''; + $list .= 'Удалить'; + $list .= ''; + } - $html->get('index', 'sections/web'); + $html->get('index', 'sections/web'); - $html->set('list', $list); + $html->set('list', $list); - $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); + $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); - $html->pack('main'); - } + $html->pack('main'); + } ?> \ No newline at end of file diff --git a/system/acp/sections/web/csbans.php b/system/acp/sections/web/csbans.php index 6215144..8428faa 100644 --- a/system/acp/sections/web/csbans.php +++ b/system/acp/sections/web/csbans.php @@ -1,58 +1,58 @@ query('SELECT `id` FROM `web`'); + $sql->query('SELECT `id` FROM `web`'); - $aPage = sys::page($page, $sql->num(), 20); + $aPage = sys::page($page, $sql->num(), 20); - sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/web'); + sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/web'); - $webs = $sql->query('SELECT `id`, `type`, `server`, `user`, `unit`, `domain`, `passwd`, `login`, `date` FROM `web` WHERE `type`="csbans" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); - while($web = $sql->get($webs)) - { - if(!$web['unit']) - $unit = array('name' => 'Веб хостинг'); - else{ - $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$web['unit'].'" LIMIT 1'); - $unit = $sql->get(); - } + $webs = $sql->query('SELECT `id`, `type`, `server`, `user`, `unit`, `domain`, `passwd`, `login`, `date` FROM `web` WHERE `type`="csbans" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); + while($web = $sql->get($webs)) + { + if(!$web['unit']) + $unit = array('name' => 'Веб хостинг'); + else{ + $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$web['unit'].'" LIMIT 1'); + $unit = $sql->get(); + } - $list .= ''; - $list .= ''.$web['id'].''; - $list .= 'USER_'.$web['user'].''; - $list .= ''.$web['domain'].''; - $list .= ''.$web['login'].''; - $list .= ''.date('H:i:s', $web['date']).''; - $list .= 'Перейти'; - $list .= ''; + $list .= ''; + $list .= ''.$web['id'].''; + $list .= 'USER_'.$web['user'].''; + $list .= ''.$web['domain'].''; + $list .= ''.$web['login'].''; + $list .= ''.date('H:i:s', $web['date']).''; + $list .= 'Перейти'; + $list .= ''; - $list .= ''; - $list .= ''.$aWebname[$web['type']].''; - $list .= 'SERVER_'.$web['server'].''; - $list .= ''.$unit['name'].''; - $list .= ''.$web['passwd'].''; - $list .= ''.date('d.n.Y', $web['date']).''; - $list .= 'Удалить'; - $list .= ''; - } + $list .= ''; + $list .= ''.$aWebname[$web['type']].''; + $list .= 'SERVER_'.$web['server'].''; + $list .= ''.$unit['name'].''; + $list .= ''.$web['passwd'].''; + $list .= ''.date('d.n.Y', $web['date']).''; + $list .= 'Удалить'; + $list .= ''; + } - $html->get('index', 'sections/web'); + $html->get('index', 'sections/web'); - $html->set('list', $list); + $html->set('list', $list); - $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); + $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); - $html->pack('main'); - } + $html->pack('main'); + } ?> \ No newline at end of file diff --git a/system/acp/sections/web/csstats.php b/system/acp/sections/web/csstats.php index ea17c00..703806e 100644 --- a/system/acp/sections/web/csstats.php +++ b/system/acp/sections/web/csstats.php @@ -1,58 +1,58 @@ query('SELECT `id` FROM `web`'); + $sql->query('SELECT `id` FROM `web`'); - $aPage = sys::page($page, $sql->num(), 20); + $aPage = sys::page($page, $sql->num(), 20); - sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/web'); + sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/web'); - $webs = $sql->query('SELECT `id`, `type`, `server`, `user`, `unit`, `domain`, `passwd`, `login`, `date` FROM `web` WHERE `type`="csstats" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); - while($web = $sql->get($webs)) - { - if(!$web['unit']) - $unit = array('name' => 'Веб хостинг'); - else{ - $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$web['unit'].'" LIMIT 1'); - $unit = $sql->get(); - } + $webs = $sql->query('SELECT `id`, `type`, `server`, `user`, `unit`, `domain`, `passwd`, `login`, `date` FROM `web` WHERE `type`="csstats" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); + while($web = $sql->get($webs)) + { + if(!$web['unit']) + $unit = array('name' => 'Веб хостинг'); + else{ + $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$web['unit'].'" LIMIT 1'); + $unit = $sql->get(); + } - $list .= ''; - $list .= ''.$web['id'].''; - $list .= 'USER_'.$web['user'].''; - $list .= ''.$web['domain'].''; - $list .= ''.$web['login'].''; - $list .= ''.date('H:i:s', $web['date']).''; - $list .= 'Перейти'; - $list .= ''; + $list .= ''; + $list .= ''.$web['id'].''; + $list .= 'USER_'.$web['user'].''; + $list .= ''.$web['domain'].''; + $list .= ''.$web['login'].''; + $list .= ''.date('H:i:s', $web['date']).''; + $list .= 'Перейти'; + $list .= ''; - $list .= ''; - $list .= ''.$aWebname[$web['type']].''; - $list .= 'SERVER_'.$web['server'].''; - $list .= ''.$unit['name'].''; - $list .= ''.$web['passwd'].''; - $list .= ''.date('d.n.Y', $web['date']).''; - $list .= 'Удалить'; - $list .= ''; - } + $list .= ''; + $list .= ''.$aWebname[$web['type']].''; + $list .= 'SERVER_'.$web['server'].''; + $list .= ''.$unit['name'].''; + $list .= ''.$web['passwd'].''; + $list .= ''.date('d.n.Y', $web['date']).''; + $list .= 'Удалить'; + $list .= ''; + } - $html->get('index', 'sections/web'); + $html->get('index', 'sections/web'); - $html->set('list', $list); + $html->set('list', $list); - $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); + $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); - $html->pack('main'); - } + $html->pack('main'); + } ?> \ No newline at end of file diff --git a/system/acp/sections/web/hosting.php b/system/acp/sections/web/hosting.php index 671bcd7..42e3c11 100644 --- a/system/acp/sections/web/hosting.php +++ b/system/acp/sections/web/hosting.php @@ -1,58 +1,58 @@ query('SELECT `id` FROM `web`'); + $sql->query('SELECT `id` FROM `web`'); - $aPage = sys::page($page, $sql->num(), 20); + $aPage = sys::page($page, $sql->num(), 20); - sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/web'); + sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/web'); - $webs = $sql->query('SELECT `id`, `type`, `server`, `user`, `unit`, `domain`, `passwd`, `login`, `date` FROM `web` WHERE `type`="hosting" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); - while($web = $sql->get($webs)) - { - if(!$web['unit']) - $unit = array('name' => 'Веб хостинг'); - else{ - $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$web['unit'].'" LIMIT 1'); - $unit = $sql->get(); - } + $webs = $sql->query('SELECT `id`, `type`, `server`, `user`, `unit`, `domain`, `passwd`, `login`, `date` FROM `web` WHERE `type`="hosting" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); + while($web = $sql->get($webs)) + { + if(!$web['unit']) + $unit = array('name' => 'Веб хостинг'); + else{ + $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$web['unit'].'" LIMIT 1'); + $unit = $sql->get(); + } - $list .= ''; - $list .= ''.$web['id'].''; - $list .= 'USER_'.$web['user'].''; - $list .= ''.$web['domain'].''; - $list .= ''.$web['login'].''; - $list .= ''.date('H:i:s', $web['date']).''; - $list .= 'Перейти'; - $list .= ''; + $list .= ''; + $list .= ''.$web['id'].''; + $list .= 'USER_'.$web['user'].''; + $list .= ''.$web['domain'].''; + $list .= ''.$web['login'].''; + $list .= ''.date('H:i:s', $web['date']).''; + $list .= 'Перейти'; + $list .= ''; - $list .= ''; - $list .= ''.$aWebname[$web['type']].''; - $list .= 'SERVER_'.$web['server'].''; - $list .= ''.$unit['name'].''; - $list .= ''.$web['passwd'].''; - $list .= ''.date('d.n.Y', $web['date']).''; - $list .= 'Удалить'; - $list .= ''; - } + $list .= ''; + $list .= ''.$aWebname[$web['type']].''; + $list .= 'SERVER_'.$web['server'].''; + $list .= ''.$unit['name'].''; + $list .= ''.$web['passwd'].''; + $list .= ''.date('d.n.Y', $web['date']).''; + $list .= 'Удалить'; + $list .= ''; + } - $html->get('index', 'sections/web'); + $html->get('index', 'sections/web'); - $html->set('list', $list); + $html->set('list', $list); - $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); + $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); - $html->pack('main'); - } + $html->pack('main'); + } ?> \ No newline at end of file diff --git a/system/acp/sections/web/index.php b/system/acp/sections/web/index.php index bbac61c..40ae937 100644 --- a/system/acp/sections/web/index.php +++ b/system/acp/sections/web/index.php @@ -1,58 +1,58 @@ query('SELECT `id` FROM `web`'); + $sql->query('SELECT `id` FROM `web`'); - $aPage = sys::page($page, $sql->num(), 20); + $aPage = sys::page($page, $sql->num(), 20); - sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/web'); + sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/web'); - $webs = $sql->query('SELECT `id`, `type`, `server`, `user`, `unit`, `domain`, `passwd`, `login`, `date` FROM `web` ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); - while($web = $sql->get($webs)) - { - if(!$web['unit']) - $unit = array('name' => 'Веб хостинг'); - else{ - $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$web['unit'].'" LIMIT 1'); - $unit = $sql->get(); - } + $webs = $sql->query('SELECT `id`, `type`, `server`, `user`, `unit`, `domain`, `passwd`, `login`, `date` FROM `web` ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); + while($web = $sql->get($webs)) + { + if(!$web['unit']) + $unit = array('name' => 'Веб хостинг'); + else{ + $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$web['unit'].'" LIMIT 1'); + $unit = $sql->get(); + } - $list .= ''; - $list .= ''.$web['id'].''; - $list .= 'USER_'.$web['user'].''; - $list .= ''.$web['domain'].''; - $list .= ''.$web['login'].''; - $list .= ''.date('H:i:s', $web['date']).''; - $list .= 'Перейти'; - $list .= ''; + $list .= ''; + $list .= ''.$web['id'].''; + $list .= 'USER_'.$web['user'].''; + $list .= ''.$web['domain'].''; + $list .= ''.$web['login'].''; + $list .= ''.date('H:i:s', $web['date']).''; + $list .= 'Перейти'; + $list .= ''; - $list .= ''; - $list .= ''.$aWebname[$web['type']].''; - $list .= 'SERVER_'.$web['server'].''; - $list .= ''.$unit['name'].''; - $list .= ''.$web['passwd'].''; - $list .= ''.date('d.n.Y', $web['date']).''; - $list .= 'Удалить'; - $list .= ''; - } + $list .= ''; + $list .= ''.$aWebname[$web['type']].''; + $list .= 'SERVER_'.$web['server'].''; + $list .= ''.$unit['name'].''; + $list .= ''.$web['passwd'].''; + $list .= ''.date('d.n.Y', $web['date']).''; + $list .= 'Удалить'; + $list .= ''; + } - $html->get('index', 'sections/web'); + $html->get('index', 'sections/web'); - $html->set('list', $list); + $html->set('list', $list); - $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); + $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); - $html->pack('main'); - } + $html->pack('main'); + } ?> \ No newline at end of file diff --git a/system/acp/sections/web/mysql.php b/system/acp/sections/web/mysql.php index 3b546e8..6eaf569 100644 --- a/system/acp/sections/web/mysql.php +++ b/system/acp/sections/web/mysql.php @@ -1,58 +1,58 @@ query('SELECT `id` FROM `web`'); + $sql->query('SELECT `id` FROM `web`'); - $aPage = sys::page($page, $sql->num(), 20); + $aPage = sys::page($page, $sql->num(), 20); - sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/web'); + sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/web'); - $webs = $sql->query('SELECT `id`, `type`, `server`, `user`, `unit`, `domain`, `passwd`, `login`, `date` FROM `web` WHERE `type`="mysql" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); - while($web = $sql->get($webs)) - { - if(!$web['unit']) - $unit = array('name' => 'Веб хостинг'); - else{ - $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$web['unit'].'" LIMIT 1'); - $unit = $sql->get(); - } + $webs = $sql->query('SELECT `id`, `type`, `server`, `user`, `unit`, `domain`, `passwd`, `login`, `date` FROM `web` WHERE `type`="mysql" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); + while($web = $sql->get($webs)) + { + if(!$web['unit']) + $unit = array('name' => 'Веб хостинг'); + else{ + $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$web['unit'].'" LIMIT 1'); + $unit = $sql->get(); + } - $list .= ''; - $list .= ''.$web['id'].''; - $list .= 'USER_'.$web['user'].''; - $list .= ''.$web['domain'].''; - $list .= ''.$web['login'].''; - $list .= ''.date('H:i:s', $web['date']).''; - $list .= 'Перейти'; - $list .= ''; + $list .= ''; + $list .= ''.$web['id'].''; + $list .= 'USER_'.$web['user'].''; + $list .= ''.$web['domain'].''; + $list .= ''.$web['login'].''; + $list .= ''.date('H:i:s', $web['date']).''; + $list .= 'Перейти'; + $list .= ''; - $list .= ''; - $list .= ''.$aWebname[$web['type']].''; - $list .= 'SERVER_'.$web['server'].''; - $list .= ''.$unit['name'].''; - $list .= ''.$web['passwd'].''; - $list .= ''.date('d.n.Y', $web['date']).''; - $list .= 'Удалить'; - $list .= ''; - } + $list .= ''; + $list .= ''.$aWebname[$web['type']].''; + $list .= 'SERVER_'.$web['server'].''; + $list .= ''.$unit['name'].''; + $list .= ''.$web['passwd'].''; + $list .= ''.date('d.n.Y', $web['date']).''; + $list .= 'Удалить'; + $list .= ''; + } - $html->get('index', 'sections/web'); + $html->get('index', 'sections/web'); - $html->set('list', $list); + $html->set('list', $list); - $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); + $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); - $html->pack('main'); - } + $html->pack('main'); + } ?> \ No newline at end of file diff --git a/system/acp/sections/web/psychostats.php b/system/acp/sections/web/psychostats.php index 9444164..0f91f5d 100644 --- a/system/acp/sections/web/psychostats.php +++ b/system/acp/sections/web/psychostats.php @@ -1,58 +1,58 @@ query('SELECT `id` FROM `web`'); + $sql->query('SELECT `id` FROM `web`'); - $aPage = sys::page($page, $sql->num(), 20); + $aPage = sys::page($page, $sql->num(), 20); - sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/web'); + sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/web'); - $webs = $sql->query('SELECT `id`, `type`, `server`, `user`, `unit`, `domain`, `passwd`, `login`, `date` FROM `web` WHERE `type`="psychostats" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); - while($web = $sql->get($webs)) - { - if(!$web['unit']) - $unit = array('name' => 'Веб хостинг'); - else{ - $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$web['unit'].'" LIMIT 1'); - $unit = $sql->get(); - } + $webs = $sql->query('SELECT `id`, `type`, `server`, `user`, `unit`, `domain`, `passwd`, `login`, `date` FROM `web` WHERE `type`="psychostats" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); + while($web = $sql->get($webs)) + { + if(!$web['unit']) + $unit = array('name' => 'Веб хостинг'); + else{ + $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$web['unit'].'" LIMIT 1'); + $unit = $sql->get(); + } - $list .= ''; - $list .= ''.$web['id'].''; - $list .= 'USER_'.$web['user'].''; - $list .= ''.$web['domain'].''; - $list .= ''.$web['login'].''; - $list .= ''.date('H:i:s', $web['date']).''; - $list .= 'Перейти'; - $list .= ''; + $list .= ''; + $list .= ''.$web['id'].''; + $list .= 'USER_'.$web['user'].''; + $list .= ''.$web['domain'].''; + $list .= ''.$web['login'].''; + $list .= ''.date('H:i:s', $web['date']).''; + $list .= 'Перейти'; + $list .= ''; - $list .= ''; - $list .= ''.$aWebname[$web['type']].''; - $list .= 'SERVER_'.$web['server'].''; - $list .= ''.$unit['name'].''; - $list .= ''.$web['passwd'].''; - $list .= ''.date('d.n.Y', $web['date']).''; - $list .= 'Удалить'; - $list .= ''; - } + $list .= ''; + $list .= ''.$aWebname[$web['type']].''; + $list .= 'SERVER_'.$web['server'].''; + $list .= ''.$unit['name'].''; + $list .= ''.$web['passwd'].''; + $list .= ''.date('d.n.Y', $web['date']).''; + $list .= 'Удалить'; + $list .= ''; + } - $html->get('index', 'sections/web'); + $html->get('index', 'sections/web'); - $html->set('list', $list); + $html->set('list', $list); - $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); + $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); - $html->pack('main'); - } + $html->pack('main'); + } ?> \ No newline at end of file diff --git a/system/acp/sections/web/rankme.php b/system/acp/sections/web/rankme.php index 4b0f726..91439f4 100644 --- a/system/acp/sections/web/rankme.php +++ b/system/acp/sections/web/rankme.php @@ -1,58 +1,58 @@ query('SELECT `id` FROM `web`'); + $sql->query('SELECT `id` FROM `web`'); - $aPage = sys::page($page, $sql->num(), 20); + $aPage = sys::page($page, $sql->num(), 20); - sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/web'); + sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/web'); - $webs = $sql->query('SELECT `id`, `type`, `server`, `user`, `unit`, `domain`, `passwd`, `login`, `date` FROM `web` WHERE `type`="rankme" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); - while($web = $sql->get($webs)) - { - if(!$web['unit']) - $unit = array('name' => 'Веб хостинг'); - else{ - $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$web['unit'].'" LIMIT 1'); - $unit = $sql->get(); - } + $webs = $sql->query('SELECT `id`, `type`, `server`, `user`, `unit`, `domain`, `passwd`, `login`, `date` FROM `web` WHERE `type`="rankme" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); + while($web = $sql->get($webs)) + { + if(!$web['unit']) + $unit = array('name' => 'Веб хостинг'); + else{ + $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$web['unit'].'" LIMIT 1'); + $unit = $sql->get(); + } - $list .= ''; - $list .= ''.$web['id'].''; - $list .= 'USER_'.$web['user'].''; - $list .= ''.$web['domain'].''; - $list .= ''.$web['login'].''; - $list .= ''.date('H:i:s', $web['date']).''; - $list .= 'Перейти'; - $list .= ''; + $list .= ''; + $list .= ''.$web['id'].''; + $list .= 'USER_'.$web['user'].''; + $list .= ''.$web['domain'].''; + $list .= ''.$web['login'].''; + $list .= ''.date('H:i:s', $web['date']).''; + $list .= 'Перейти'; + $list .= ''; - $list .= ''; - $list .= ''.$aWebname[$web['type']].''; - $list .= 'SERVER_'.$web['server'].''; - $list .= ''.$unit['name'].''; - $list .= ''.$web['passwd'].''; - $list .= ''.date('d.n.Y', $web['date']).''; - $list .= 'Удалить'; - $list .= ''; - } + $list .= ''; + $list .= ''.$aWebname[$web['type']].''; + $list .= 'SERVER_'.$web['server'].''; + $list .= ''.$unit['name'].''; + $list .= ''.$web['passwd'].''; + $list .= ''.date('d.n.Y', $web['date']).''; + $list .= 'Удалить'; + $list .= ''; + } - $html->get('index', 'sections/web'); + $html->get('index', 'sections/web'); - $html->set('list', $list); + $html->set('list', $list); - $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); + $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); - $html->pack('main'); - } + $html->pack('main'); + } ?> \ No newline at end of file diff --git a/system/acp/sections/web/search.php b/system/acp/sections/web/search.php index 6c1df6e..55ec66e 100644 --- a/system/acp/sections/web/search.php +++ b/system/acp/sections/web/search.php @@ -1,88 +1,88 @@ get($mkey); + $cache = $mcache->get($mkey); - if(is_array($cache)) - { - if($go) - sys::outjs($cache, $nmch); + if(is_array($cache)) + { + if($go) + sys::outjs($cache, $nmch); - sys::outjs($cache); - } + sys::outjs($cache); + } - if(!isset($text{2})) - { - if($go) - sys::outjs(array('e' => 'Для выполнения поиска, необходимо больше данных'), $nmch); + if(!isset($text{2})) + { + if($go) + sys::outjs(array('e' => 'Для выполнения поиска, необходимо больше данных'), $nmch); - sys::outjs(array('e' => '')); - } + sys::outjs(array('e' => '')); + } - if(substr($text, 0, 5) == 'game=') - { - $game = trim(substr($text, 5)); + if(substr($text, 0, 5) == 'game=') + { + $game = trim(substr($text, 5)); - if(in_array($game, array('cs', 'cssold', 'css', 'csgo', 'samp', 'crmp', 'mta', 'mc'))) - $webs = $sql->query('SELECT `id`, `type`, `server`, `user`, `unit`, `domain`, `passwd`, `login`, `date` FROM `web` WHERE `game`="'.$game.'" ORDER BY `id` ASC'); - }elseif($text{0} == 'i' AND $text{1} == 'd') - $webs = $sql->query('SELECT `id`, `type`, `server`, `user`, `unit`, `domain`, `passwd`, `login`, `date` FROM `web` WHERE `id`="'.sys::int($text).'" LIMIT 1'); - else{ - $like = '`id` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' - .'`type` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' - .'`server` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' - .'`user` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' - .'`unit` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' - .'`domain` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' - .'`login` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\')'; + if(in_array($game, array('cs', 'cssold', 'css', 'csgo', 'samp', 'crmp', 'mta', 'mc'))) + $webs = $sql->query('SELECT `id`, `type`, `server`, `user`, `unit`, `domain`, `passwd`, `login`, `date` FROM `web` WHERE `game`="'.$game.'" ORDER BY `id` ASC'); + }elseif($text{0} == 'i' AND $text{1} == 'd') + $webs = $sql->query('SELECT `id`, `type`, `server`, `user`, `unit`, `domain`, `passwd`, `login`, `date` FROM `web` WHERE `id`="'.sys::int($text).'" LIMIT 1'); + else{ + $like = '`id` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' + .'`type` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' + .'`server` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' + .'`user` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' + .'`unit` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' + .'`domain` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' + .'`login` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\')'; - $webs = $sql->query('SELECT `id`, `type`, `server`, `user`, `unit`, `domain`, `passwd`, `login`, `date` FROM `web` WHERE '.$like.' ORDER BY `id` ASC'); - } + $webs = $sql->query('SELECT `id`, `type`, `server`, `user`, `unit`, `domain`, `passwd`, `login`, `date` FROM `web` WHERE '.$like.' ORDER BY `id` ASC'); + } - if(!$sql->num($webs)) - { - if($go) - sys::outjs(array('e' => 'По вашему запросу ничего не найдено'), $nmch); + if(!$sql->num($webs)) + { + if($go) + sys::outjs(array('e' => 'По вашему запросу ничего не найдено'), $nmch); - sys::outjs(array('e' => 'По вашему запросу ничего не найдено')); - } + sys::outjs(array('e' => 'По вашему запросу ничего не найдено')); + } - $list = ''; + $list = ''; - while($web = $sql->get($webs)) - { - if(!$web['unit']) - $unit = array('name' => 'Веб хостинг'); - else{ - $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$web['unit'].'" LIMIT 1'); - $unit = $sql->get(); - } + while($web = $sql->get($webs)) + { + if(!$web['unit']) + $unit = array('name' => 'Веб хостинг'); + else{ + $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$web['unit'].'" LIMIT 1'); + $unit = $sql->get(); + } - $list .= ''; - $list .= ''.$web['id'].''; - $list .= 'USER_'.$web['user'].''; - $list .= ''.$web['domain'].''; - $list .= ''.$web['login'].''; - $list .= ''.date('H:i:s', $web['date']).''; - $list .= 'Перейти'; - $list .= ''; + $list .= ''; + $list .= ''.$web['id'].''; + $list .= 'USER_'.$web['user'].''; + $list .= ''.$web['domain'].''; + $list .= ''.$web['login'].''; + $list .= ''.date('H:i:s', $web['date']).''; + $list .= 'Перейти'; + $list .= ''; - $list .= ''; - $list .= ''.$aWebname[$web['type']].''; - $list .= 'SERVER_'.$web['server'].''; - $list .= ''.$unit['name'].''; - $list .= ''.$web['passwd'].''; - $list .= ''.date('d.n.Y', $web['date']).''; - $list .= 'Удалить'; - $list .= ''; - } + $list .= ''; + $list .= ''.$aWebname[$web['type']].''; + $list .= 'SERVER_'.$web['server'].''; + $list .= ''.$unit['name'].''; + $list .= ''.$web['passwd'].''; + $list .= ''.date('d.n.Y', $web['date']).''; + $list .= 'Удалить'; + $list .= ''; + } - $mcache->set($mkey, array('s' => $list), false, 15); + $mcache->set($mkey, array('s' => $list), false, 15); - sys::outjs(array('s' => $list)); + sys::outjs(array('s' => $list)); ?> \ No newline at end of file diff --git a/system/acp/sections/web/sourcebans.php b/system/acp/sections/web/sourcebans.php index dee3f4f..f50a144 100644 --- a/system/acp/sections/web/sourcebans.php +++ b/system/acp/sections/web/sourcebans.php @@ -1,58 +1,58 @@ query('SELECT `id` FROM `web`'); + $sql->query('SELECT `id` FROM `web`'); - $aPage = sys::page($page, $sql->num(), 20); + $aPage = sys::page($page, $sql->num(), 20); - sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/web'); + sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/web'); - $webs = $sql->query('SELECT `id`, `type`, `server`, `user`, `unit`, `domain`, `passwd`, `login`, `date` FROM `web` WHERE `type`="sourcebans" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); - while($web = $sql->get($webs)) - { - if(!$web['unit']) - $unit = array('name' => 'Веб хостинг'); - else{ - $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$web['unit'].'" LIMIT 1'); - $unit = $sql->get(); - } + $webs = $sql->query('SELECT `id`, `type`, `server`, `user`, `unit`, `domain`, `passwd`, `login`, `date` FROM `web` WHERE `type`="sourcebans" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); + while($web = $sql->get($webs)) + { + if(!$web['unit']) + $unit = array('name' => 'Веб хостинг'); + else{ + $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$web['unit'].'" LIMIT 1'); + $unit = $sql->get(); + } - $list .= ''; - $list .= ''.$web['id'].''; - $list .= 'USER_'.$web['user'].''; - $list .= ''.$web['domain'].''; - $list .= ''.$web['login'].''; - $list .= ''.date('H:i:s', $web['date']).''; - $list .= 'Перейти'; - $list .= ''; + $list .= ''; + $list .= ''.$web['id'].''; + $list .= 'USER_'.$web['user'].''; + $list .= ''.$web['domain'].''; + $list .= ''.$web['login'].''; + $list .= ''.date('H:i:s', $web['date']).''; + $list .= 'Перейти'; + $list .= ''; - $list .= ''; - $list .= ''.$aWebname[$web['type']].''; - $list .= 'SERVER_'.$web['server'].''; - $list .= ''.$unit['name'].''; - $list .= ''.$web['passwd'].''; - $list .= ''.date('d.n.Y', $web['date']).''; - $list .= 'Удалить'; - $list .= ''; - } + $list .= ''; + $list .= ''.$aWebname[$web['type']].''; + $list .= 'SERVER_'.$web['server'].''; + $list .= ''.$unit['name'].''; + $list .= ''.$web['passwd'].''; + $list .= ''.date('d.n.Y', $web['date']).''; + $list .= 'Удалить'; + $list .= ''; + } - $html->get('index', 'sections/web'); + $html->get('index', 'sections/web'); - $html->set('list', $list); + $html->set('list', $list); - $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); + $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); - $html->pack('main'); - } + $html->pack('main'); + } ?> \ No newline at end of file diff --git a/system/acp/sections/wiki/add.php b/system/acp/sections/wiki/add.php index 7916c56..83086dc 100644 --- a/system/acp/sections/wiki/add.php +++ b/system/acp/sections/wiki/add.php @@ -1,51 +1,51 @@ 'Необходимо заполнить все поля')); + if(in_array('', $aData)) + sys::outjs(array('e' => 'Необходимо заполнить все поля')); - if(sys::strlen($aData['tags']) > 100) - sys::outjs(array('e' => 'Теги не должен превышать 100 символов.')); + if(sys::strlen($aData['tags']) > 100) + sys::outjs(array('e' => 'Теги не должен превышать 100 символов.')); - $sql->query('SELECT `id` FROM `wiki_category` WHERE `id`="'.$aData['cat'].'" LIMIT 1'); - if(!$sql->num()) - sys::outjs(array('e' => 'Указанная категория не найдена')); + $sql->query('SELECT `id` FROM `wiki_category` WHERE `id`="'.$aData['cat'].'" LIMIT 1'); + if(!$sql->num()) + sys::outjs(array('e' => 'Указанная категория не найдена')); - $sql->query('INSERT INTO `wiki` set ' - .'`name`="'.htmlspecialchars($aData['name']).'",' - .'`cat`="'.$aData['cat'].'",' - .'`tags`="'.htmlspecialchars($aData['tags']).'",' - .'`date`="'.$start_point.'"'); + $sql->query('INSERT INTO `wiki` set ' + .'`name`="'.htmlspecialchars($aData['name']).'",' + .'`cat`="'.$aData['cat'].'",' + .'`tags`="'.htmlspecialchars($aData['tags']).'",' + .'`date`="'.$start_point.'"'); - $id = $sql->id(); + $id = $sql->id(); - $sql->query('INSERT INTO `wiki_answer` set ' - .'`wiki`="'.$id.'",' - .'`cat`="'.$aData['cat'].'",' - .'`text`="'.htmlspecialchars($aData['text']).'"'); + $sql->query('INSERT INTO `wiki_answer` set ' + .'`wiki`="'.$id.'",' + .'`cat`="'.$aData['cat'].'",' + .'`text`="'.htmlspecialchars($aData['text']).'"'); - sys::outjs(array('s' => 'ok')); - } + sys::outjs(array('s' => 'ok')); + } - $cats = ''; + $cats = ''; - $sql->query('SELECT `id`, `name` FROM `wiki_category` ORDER BY `id` ASC'); - while($cat = $sql->get()) - $cats .= ''; + $sql->query('SELECT `id`, `name` FROM `wiki_category` ORDER BY `id` ASC'); + while($cat = $sql->get()) + $cats .= ''; - $html->get('add', 'sections/wiki'); + $html->get('add', 'sections/wiki'); - $html->set('cats', $cats); + $html->set('cats', $cats); - $html->pack('main'); + $html->pack('main'); ?> \ No newline at end of file diff --git a/system/acp/sections/wiki/addcat.php b/system/acp/sections/wiki/addcat.php index a1f625e..9a8eafd 100644 --- a/system/acp/sections/wiki/addcat.php +++ b/system/acp/sections/wiki/addcat.php @@ -1,25 +1,25 @@ 'Необходимо заполнить все поля')); + if(in_array('', $aData)) + sys::outjs(array('e' => 'Необходимо заполнить все поля')); - $sql->query('INSERT INTO `wiki_category` set ' - .'`name`="'.htmlspecialchars($aData['name']).'",' - .'`sort`="'.$aData['sort'].'"'); + $sql->query('INSERT INTO `wiki_category` set ' + .'`name`="'.htmlspecialchars($aData['name']).'",' + .'`sort`="'.$aData['sort'].'"'); - sys::outjs(array('s' => 'ok')); - } + sys::outjs(array('s' => 'ok')); + } - $html->get('addcat', 'sections/wiki'); + $html->get('addcat', 'sections/wiki'); - $html->pack('main'); + $html->pack('main'); ?> \ No newline at end of file diff --git a/system/acp/sections/wiki/cat.php b/system/acp/sections/wiki/cat.php index 37a3069..bac5f42 100644 --- a/system/acp/sections/wiki/cat.php +++ b/system/acp/sections/wiki/cat.php @@ -1,32 +1,32 @@ query('SELECT * FROM `wiki_category` WHERE `id`="'.$id.'" LIMIT 1'); - $wiki = $sql->get(); + $sql->query('SELECT * FROM `wiki_category` WHERE `id`="'.$id.'" LIMIT 1'); + $wiki = $sql->get(); - if($go) - { - $aData = array(); + if($go) + { + $aData = array(); - $aData['name'] = isset($_POST['name']) ? trim($_POST['name']) : htmlspecialchars_decode($wiki['name']); - $aData['sort'] = isset($_POST['sort']) ? sys::int($_POST['sort']) : $wiki['sort']; + $aData['name'] = isset($_POST['name']) ? trim($_POST['name']) : htmlspecialchars_decode($wiki['name']); + $aData['sort'] = isset($_POST['sort']) ? sys::int($_POST['sort']) : $wiki['sort']; - if(in_array('', $aData)) - sys::outjs(array('e' => 'Необходимо заполнить все поля')); + if(in_array('', $aData)) + sys::outjs(array('e' => 'Необходимо заполнить все поля')); - $sql->query('UPDATE `wiki_category` set ' - .'`name`="'.htmlspecialchars($aData['name']).'",' - .'`sort`="'.$aData['sort'].'" WHERE `id`="'.$id.'" LIMIT 1'); + $sql->query('UPDATE `wiki_category` set ' + .'`name`="'.htmlspecialchars($aData['name']).'",' + .'`sort`="'.$aData['sort'].'" WHERE `id`="'.$id.'" LIMIT 1'); - sys::outjs(array('s' => 'ok')); - } + sys::outjs(array('s' => 'ok')); + } - $html->get('cat', 'sections/wiki'); + $html->get('cat', 'sections/wiki'); - $html->set('name', htmlspecialchars_decode($wiki['name'])); - $html->set('id', $wiki['id']); - $html->set('sort', $wiki['sort']); + $html->set('name', htmlspecialchars_decode($wiki['name'])); + $html->set('id', $wiki['id']); + $html->set('sort', $wiki['sort']); - $html->pack('main'); + $html->pack('main'); ?> \ No newline at end of file diff --git a/system/acp/sections/wiki/cats.php b/system/acp/sections/wiki/cats.php index c7e1c04..6b5eda4 100644 --- a/system/acp/sections/wiki/cats.php +++ b/system/acp/sections/wiki/cats.php @@ -1,25 +1,25 @@ query('SELECT `id`, `name`, `sort` FROM `wiki_category` ORDER BY `id` ASC'); - while($cat = $sql->get($cats)) - { - $sql->query('SELECT `name` FROM `wiki` WHERE `cat`="'.$cat['id'].'"'); - $wiki = $sql->num(); + $cats = $sql->query('SELECT `id`, `name`, `sort` FROM `wiki_category` ORDER BY `id` ASC'); + while($cat = $sql->get($cats)) + { + $sql->query('SELECT `name` FROM `wiki` WHERE `cat`="'.$cat['id'].'"'); + $wiki = $sql->num(); - $list .= ''; - $list .= ''.$cat['id'].''; - $list .= ''.$cat['name'].''; - $list .= ''.$wiki.' шт.'; - $list .= ''.$cat['sort'].''; - $list .= 'Удалить'; - $list .= ''; - } + $list .= ''; + $list .= ''.$cat['id'].''; + $list .= ''.$cat['name'].''; + $list .= ''.$wiki.' шт.'; + $list .= ''.$cat['sort'].''; + $list .= 'Удалить'; + $list .= ''; + } - $html->get('cats', 'sections/wiki'); + $html->get('cats', 'sections/wiki'); - $html->set('list', $list); + $html->set('list', $list); - $html->pack('main'); + $html->pack('main'); ?> \ No newline at end of file diff --git a/system/acp/sections/wiki/delete.php b/system/acp/sections/wiki/delete.php index cd60e19..7b075be 100644 --- a/system/acp/sections/wiki/delete.php +++ b/system/acp/sections/wiki/delete.php @@ -1,13 +1,13 @@ query('DELETE FROM `wiki_category` WHERE `id`="'.$id.'" LIMIT 1'); - else{ - $sql->query('DELETE FROM `wiki` WHERE `id`="'.$id.'" LIMIT 1'); - $sql->query('DELETE FROM `wiki_answer` WHERE `wiki`="'.$id.'" LIMIT 1'); - } + if(isset($url['type']) AND $url['type'] == 'cat') + $sql->query('DELETE FROM `wiki_category` WHERE `id`="'.$id.'" LIMIT 1'); + else{ + $sql->query('DELETE FROM `wiki` WHERE `id`="'.$id.'" LIMIT 1'); + $sql->query('DELETE FROM `wiki_answer` WHERE `wiki`="'.$id.'" LIMIT 1'); + } - sys::outjs(array('s' => 'ok')); + sys::outjs(array('s' => 'ok')); ?> \ No newline at end of file diff --git a/system/acp/sections/wiki/index.php b/system/acp/sections/wiki/index.php index 1ce66f0..82eb834 100644 --- a/system/acp/sections/wiki/index.php +++ b/system/acp/sections/wiki/index.php @@ -1,42 +1,42 @@ query('SELECT `id` FROM `wiki`'); + $sql->query('SELECT `id` FROM `wiki`'); - $aPage = sys::page($page, $sql->num(), 20); + $aPage = sys::page($page, $sql->num(), 20); - sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/wiki'); + sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/wiki'); - $wikis = $sql->query('SELECT `id`, `name`, `cat`, `date` FROM `wiki` ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); - while($wiki = $sql->get($wikis)) - { - $sql->query('SELECT `name` FROM `wiki_category` WHERE `id`="'.$wiki['cat'].'" LIMIT 1'); - $cat = $sql->get(); + $wikis = $sql->query('SELECT `id`, `name`, `cat`, `date` FROM `wiki` ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20'); + while($wiki = $sql->get($wikis)) + { + $sql->query('SELECT `name` FROM `wiki_category` WHERE `id`="'.$wiki['cat'].'" LIMIT 1'); + $cat = $sql->get(); - $list .= ''; - $list .= ''.$wiki['id'].''; - $list .= ''.$wiki['name'].''; - $list .= ''.$cat['name'].''; - $list .= ''.date('d.m.Y - H:i:s', $wiki['date']).''; - $list .= 'Удалить'; - $list .= ''; - } + $list .= ''; + $list .= ''.$wiki['id'].''; + $list .= ''.$wiki['name'].''; + $list .= ''.$cat['name'].''; + $list .= ''.date('d.m.Y - H:i:s', $wiki['date']).''; + $list .= 'Удалить'; + $list .= ''; + } - $html->get('index', 'sections/wiki'); + $html->get('index', 'sections/wiki'); - $html->set('list', $list); + $html->set('list', $list); - $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); + $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : ''); - $html->pack('main'); - } + $html->pack('main'); + } ?> \ No newline at end of file diff --git a/system/acp/sections/wiki/search.php b/system/acp/sections/wiki/search.php index e89f27e..742d2d2 100644 --- a/system/acp/sections/wiki/search.php +++ b/system/acp/sections/wiki/search.php @@ -1,65 +1,65 @@ get($mkey); + $cache = $mcache->get($mkey); - if(is_array($cache)) - { - if($go) - sys::outjs($cache, $nmch); + if(is_array($cache)) + { + if($go) + sys::outjs($cache, $nmch); - sys::outjs($cache); - } + sys::outjs($cache); + } - if(!isset($text{2})) - { - if($go) - sys::outjs(array('e' => 'Для выполнения поиска, необходимо больше данных'), $nmch); + if(!isset($text{2})) + { + if($go) + sys::outjs(array('e' => 'Для выполнения поиска, необходимо больше данных'), $nmch); - sys::outjs(array('e' => '')); - } + sys::outjs(array('e' => '')); + } - if($text{0} == 'i' AND $text{1} == 'd') - $wikis = $sql->query('SELECT `id`, `name`, `cat`, `date` FROM `wiki` WHERE `id`="'.sys::int($text).'" LIMIT 1'); - else{ - $like = '`id` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' - .'`name` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' - .'`cat` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' - .'`tags` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\')'; + if($text{0} == 'i' AND $text{1} == 'd') + $wikis = $sql->query('SELECT `id`, `name`, `cat`, `date` FROM `wiki` WHERE `id`="'.sys::int($text).'" LIMIT 1'); + else{ + $like = '`id` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' + .'`name` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' + .'`cat` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR' + .'`tags` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\')'; - $wiki = $sql->query('SELECT `id`, `name`, `cat`, `date` FROM `wiki` WHERE '.$like.' ORDER BY `id` ASC LIMIT 20'); - } + $wiki = $sql->query('SELECT `id`, `name`, `cat`, `date` FROM `wiki` WHERE '.$like.' ORDER BY `id` ASC LIMIT 20'); + } - if(!$sql->num($wikis)) - { - if($go) - sys::outjs(array('e' => 'По вашему запросу ничего не найдено'), $nmch); + if(!$sql->num($wikis)) + { + if($go) + sys::outjs(array('e' => 'По вашему запросу ничего не найдено'), $nmch); - sys::outjs(array('e' => 'По вашему запросу ничего не найдено')); - } + sys::outjs(array('e' => 'По вашему запросу ничего не найдено')); + } - $list = ''; + $list = ''; - while($wiki = $sql->get($wikis)) - { - $sql->query('SELECT `name` FROM `wiki_category` WHERE `id`="'.$wiki['cat'].'" LIMIT 1'); - $cat = $sql->get(); + while($wiki = $sql->get($wikis)) + { + $sql->query('SELECT `name` FROM `wiki_category` WHERE `id`="'.$wiki['cat'].'" LIMIT 1'); + $cat = $sql->get(); - $list .= ''; - $list .= ''.$wiki['id'].''; - $list .= ''.$wiki['name'].''; - $list .= ''.$cat['name'].''; - $list .= ''.date('d.m.Y - H:i:s', $wiki['date']).''; - $list .= 'Удалить'; - $list .= ''; - } + $list .= ''; + $list .= ''.$wiki['id'].''; + $list .= ''.$wiki['name'].''; + $list .= ''.$cat['name'].''; + $list .= ''.date('d.m.Y - H:i:s', $wiki['date']).''; + $list .= 'Удалить'; + $list .= ''; + } - $mcache->set($mkey, array('s' => $list), false, 15); + $mcache->set($mkey, array('s' => $list), false, 15); - sys::outjs(array('s' => $list)); + sys::outjs(array('s' => $list)); ?> \ No newline at end of file diff --git a/system/acp/sections/wiki/wiki.php b/system/acp/sections/wiki/wiki.php index e0615eb..e0c649d 100644 --- a/system/acp/sections/wiki/wiki.php +++ b/system/acp/sections/wiki/wiki.php @@ -1,58 +1,58 @@ query('SELECT `name`, `cat`, `tags` FROM `wiki` WHERE `id`="'.$id.'" LIMIT 1'); - $wiki = $sql->get(); - - $sql->query('SELECT `text` FROM `wiki_answer` WHERE `wiki`="'.$id.'" LIMIT 1'); - $wiki = array_merge($wiki, $sql->get()); + $sql->query('SELECT `name`, `cat`, `tags` FROM `wiki` WHERE `id`="'.$id.'" LIMIT 1'); + $wiki = $sql->get(); + + $sql->query('SELECT `text` FROM `wiki_answer` WHERE `wiki`="'.$id.'" LIMIT 1'); + $wiki = array_merge($wiki, $sql->get()); - if($go) - { - $aData = array(); + if($go) + { + $aData = array(); - $aData['name'] = isset($_POST['name']) ? trim($_POST['name']) : htmlspecialchars_decode($wiki['name']); - $aData['text'] = isset($_POST['text']) ? sys::bbc(trim($_POST['text'])) : htmlspecialchars_decode($wiki['text']); - $aData['cat'] = isset($_POST['cat']) ? sys::int($_POST['cat']) : $wiki['cat']; - $aData['tags'] = isset($_POST['tags']) ? trim($_POST['tags']) : htmlspecialchars_decode($wiki['tags']); + $aData['name'] = isset($_POST['name']) ? trim($_POST['name']) : htmlspecialchars_decode($wiki['name']); + $aData['text'] = isset($_POST['text']) ? sys::bbc(trim($_POST['text'])) : htmlspecialchars_decode($wiki['text']); + $aData['cat'] = isset($_POST['cat']) ? sys::int($_POST['cat']) : $wiki['cat']; + $aData['tags'] = isset($_POST['tags']) ? trim($_POST['tags']) : htmlspecialchars_decode($wiki['tags']); - if(in_array('', $aData)) - sys::outjs(array('e' => 'Необходимо заполнить все поля')); + if(in_array('', $aData)) + sys::outjs(array('e' => 'Необходимо заполнить все поля')); - if(sys::strlen($aData['tags']) > 100) - sys::outjs(array('e' => 'Теги не должен превышать 100 символов.')); + if(sys::strlen($aData['tags']) > 100) + sys::outjs(array('e' => 'Теги не должен превышать 100 символов.')); - $sql->query('SELECT `id` FROM `wiki_category` WHERE `id`="'.$aData['cat'].'" LIMIT 1'); - if(!$sql->num()) - sys::outjs(array('e' => 'Указанная категория не найдена')); + $sql->query('SELECT `id` FROM `wiki_category` WHERE `id`="'.$aData['cat'].'" LIMIT 1'); + if(!$sql->num()) + sys::outjs(array('e' => 'Указанная категория не найдена')); - $sql->query('UPDATE `wiki` set ' - .'`name`="'.htmlspecialchars($aData['name']).'",' - .'`cat`="'.$aData['cat'].'",' - .'`tags`="'.htmlspecialchars($aData['tags']).'",' - .'`date`="'.$start_point.'" WHERE `id`="'.$id.'" LIMIT 1'); + $sql->query('UPDATE `wiki` set ' + .'`name`="'.htmlspecialchars($aData['name']).'",' + .'`cat`="'.$aData['cat'].'",' + .'`tags`="'.htmlspecialchars($aData['tags']).'",' + .'`date`="'.$start_point.'" WHERE `id`="'.$id.'" LIMIT 1'); - $sql->query('UPDATE `wiki_answer` set ' - .'`cat`="'.$aData['cat'].'",' - .'`text`="'.htmlspecialchars($aData['text']).'" WHERE `wiki`="'.$id.'" LIMIT 1'); + $sql->query('UPDATE `wiki_answer` set ' + .'`cat`="'.$aData['cat'].'",' + .'`text`="'.htmlspecialchars($aData['text']).'" WHERE `wiki`="'.$id.'" LIMIT 1'); - sys::outjs(array('s' => 'ok')); - } + sys::outjs(array('s' => 'ok')); + } - $cats = ''; + $cats = ''; - $sql->query('SELECT `id`, `name` FROM `wiki_category` ORDER BY `id` ASC'); - while($cat = $sql->get()) - $cats .= ''; + $sql->query('SELECT `id`, `name` FROM `wiki_category` ORDER BY `id` ASC'); + while($cat = $sql->get()) + $cats .= ''; - $html->get('wiki', 'sections/wiki'); + $html->get('wiki', 'sections/wiki'); - $html->set('id', $id); - $html->set('name', htmlspecialchars_decode($wiki['name'])); - $html->set('text', htmlspecialchars_decode($wiki['text'])); - $html->set('tags', htmlspecialchars_decode($wiki['tags'])); - $html->set('cats', str_replace('"'.$wiki['cat'].'"', '"'.$wiki['cat'].'" selected', $cats)); + $html->set('id', $id); + $html->set('name', htmlspecialchars_decode($wiki['name'])); + $html->set('text', htmlspecialchars_decode($wiki['text'])); + $html->set('tags', htmlspecialchars_decode($wiki['tags'])); + $html->set('cats', str_replace('"'.$wiki['cat'].'"', '"'.$wiki['cat'].'" selected', $cats)); - $html->pack('main'); + $html->pack('main'); ?> \ No newline at end of file diff --git a/system/data/acpengine.php b/system/data/acpengine.php index 2d7429a..753e4e2 100644 --- a/system/data/acpengine.php +++ b/system/data/acpengine.php @@ -1,49 +1,49 @@ '/^[A-Za-z0-9_]{4,16}$/', - 'mail' => '/^([a-z0-9_\.-])+@[a-z0-9-]+\.([a-z]{2,4}\.)?[a-z]{2,4}$/i', - 'name' => '/^[А-Я]{1,1}[а-я]{2,15}$/u', - 'lastname' => '/^[А-Я]{1,1}[а-я]{2,15}$/u', - 'patronymic' => '/^[А-Я]{1,1}[а-я]{2,15}$/u', - 'phone' => '/^380+[0-9]{9,9}$|^77+[0-9]{9,9}$|^79+[0-9]{9,9}$|^375+[0-9]{9,9}$/m', - 'contacts' => '/^(http|https):\/\/(new\.vk|vk)\.com\/[A-Za-z\_\.]{1,2}[A-Za-z0-9\_\.]{4,32}$|^[A-Za-z][A-Za-z0-9\.\-\_]{6,32}$/', - 'passwd' => '/^[A-Za-z0-9]{6,26}$/', - 'support_info' => '/[^а-яА-Я\s]+/msi', - 'address' => '/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\:[0-9]{1,5}/' - ); + $aValid = array( + 'login' => '/^[A-Za-z0-9_]{4,16}$/', + 'mail' => '/^([a-z0-9_\.-])+@[a-z0-9-]+\.([a-z]{2,4}\.)?[a-z]{2,4}$/i', + 'name' => '/^[А-Я]{1,1}[а-я]{2,15}$/u', + 'lastname' => '/^[А-Я]{1,1}[а-я]{2,15}$/u', + 'patronymic' => '/^[А-Я]{1,1}[а-я]{2,15}$/u', + 'phone' => '/^380+[0-9]{9,9}$|^77+[0-9]{9,9}$|^79+[0-9]{9,9}$|^375+[0-9]{9,9}$/m', + 'contacts' => '/^(http|https):\/\/(new\.vk|vk)\.com\/[A-Za-z\_\.]{1,2}[A-Za-z0-9\_\.]{4,32}$|^[A-Za-z][A-Za-z0-9\.\-\_]{6,32}$/', + 'passwd' => '/^[A-Za-z0-9]{6,26}$/', + 'support_info' => '/[^а-яА-Я\s]+/msi', + 'address' => '/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\:[0-9]{1,5}/' + ); - // Массив имен игр - $aGname = array( - 'cs' => 'CS: 1.6', + // Массив имен игр + $aGname = array( + 'cs' => 'CS: 1.6', 'css' => 'CS: Source', - 'csgo' => 'CS: Global Offensive', + 'csgo' => 'CS: Global Offensive', 'cssold' => 'CS: Source v34', 'mc' => 'MineCraft', 'mta' => 'GTA: MTA', diff --git a/system/data/boost.php b/system/data/boost.php index 7f1ad99..cbbf464 100644 --- a/system/data/boost.php +++ b/system/data/boost.php @@ -1,22 +1,22 @@ array( - 'boost' => array( - - ), + 'cs' => array( + 'boost' => array( + + ), - 'mon' => array( - 'site' => '', // адрес сайта раскрутки - 'api' => '', // адрес API сайта раскрутки - 'key' => '', // секретный ключ для API - 'services' => array(), // array(номер услуги) - выборка (номер услуги либо кол-во кругов) - 'circles' => array(), // array(номер услуги => кол-во кругов) - выборка - 'price' => array(), // array(номер услуги => цена) - 'type' => 'def' // тип работы с API сайта раскрутки - ) - ) - ); + 'mon' => array( + 'site' => '', // адрес сайта раскрутки + 'api' => '', // адрес API сайта раскрутки + 'key' => '', // секретный ключ для API + 'services' => array(), // array(номер услуги) - выборка (номер услуги либо кол-во кругов) + 'circles' => array(), // array(номер услуги => кол-во кругов) - выборка + 'price' => array(), // array(номер услуги => цена) + 'type' => 'def' // тип работы с API сайта раскрутки + ) + ) + ); ?> \ No newline at end of file diff --git a/system/data/config.php b/system/data/config.php index 16e7e3f..7c69b44 100644 --- a/system/data/config.php +++ b/system/data/config.php @@ -1,306 +1,306 @@ 'EngineGP', // Название сайта - 'graph' => 'EngineGP', // Описание сайта - 'url' => 'IPADDR', // Тут ваш IP или Домен, пример: 127.0.0.1 - 'http' => 'http://IPADDR/', // Тут ваш IP или Домен с указанием http, пример: http://127.0.0.1 - 'plugins' => 'http://IPADDR/files/plugins/', // Путь к плагинам - 'ip' => 'IPADDR', // IP-Адрес сайта прмер: 127.0.0.1 - 'subnet' => 'IPADDR.0/23', // Подсеть сайта пример: 127.0.0.1.0/23 .0/23(не стирать) + $cfg = array( + 'name' => 'EngineGP', // Название сайта + 'graph' => 'EngineGP', // Описание сайта + 'url' => 'IPADDR', // Тут ваш IP или Домен, пример: 127.0.0.1 + 'http' => 'http://IPADDR/', // Тут ваш IP или Домен с указанием http, пример: http://127.0.0.1 + 'plugins' => 'http://IPADDR/files/plugins/', // Путь к плагинам + 'ip' => 'IPADDR', // IP-Адрес сайта прмер: 127.0.0.1 + 'subnet' => 'IPADDR.0/23', // Подсеть сайта пример: 127.0.0.1.0/23 .0/23(не стирать) - 'cdn' => 'http://cdn.enginegp.ru/', // CDN сервис EGP, если ваш сайт переехал на https то следует тут тоже сменить протокол с http на https + 'cdn' => 'http://cdn.enginegp.ru/', // CDN сервис EGP, если ваш сайт переехал на https то следует тут тоже сменить протокол с http на https - // Данные для пополнения баланса пользователям - 'freekassa_id' => '', // Номер кассы - 'freekassa_key_1' => '', // Первый секретный ключ FreeKassa - 'freekassa_key_2' => '', // Второй секретный ключ FreeKassa - 'webmoney_wmr' => '', // Wmr кошелек - 'webmoney_key' => '', // Секретный ключ WebMoney - 'unitpay_key' => '', // Секретный ключ UnitPay - 'unitpay_pubkey' => '', // Публичный ключ UnitPay + // Данные для пополнения баланса пользователям + 'freekassa_id' => '', // Номер кассы + 'freekassa_key_1' => '', // Первый секретный ключ FreeKassa + 'freekassa_key_2' => '', // Второй секретный ключ FreeKassa + 'webmoney_wmr' => '', // Wmr кошелек + 'webmoney_key' => '', // Секретный ключ WebMoney + 'unitpay_key' => '', // Секретный ключ UnitPay + 'unitpay_pubkey' => '', // Публичный ключ UnitPay - // Данные для отправки почты - 'smtp_url' => '', // * SMTP URL, пример: ssl://smtp.mail.ru | ssl://smtp.yandex.ru | ssl://smtp.google.com - 'smtp_login' => '', // * E-mail отправителя, пример: support@enginegp.ru - 'smtp_passwd' => '', // * Пароль от E-mail отправителя support@enginegp.ru - 'smtp_name' => '', // * Имя отправителя, пример: EngineGP Support - 'smtp_mail' => '', // * E-mail отправителя(ещё раз) - (support@enginegp.ru) + // Данные для отправки почты + 'smtp_url' => '', // * SMTP URL, пример: ssl://smtp.mail.ru | ssl://smtp.yandex.ru | ssl://smtp.google.com + 'smtp_login' => '', // * E-mail отправителя, пример: support@enginegp.ru + 'smtp_passwd' => '', // * Пароль от E-mail отправителя support@enginegp.ru + 'smtp_name' => '', // * Имя отправителя, пример: EngineGP Support + 'smtp_mail' => '', // * E-mail отправителя(ещё раз) - (support@enginegp.ru) - // Уведомления о сообщениях в тикетах - 'notice_admin' => array(1), // перечислить id пользователя, на их почты будут отправлять уведомления + // Уведомления о сообщениях в тикетах + 'notice_admin' => array(1), // перечислить id пользователя, на их почты будут отправлять уведомления - // Данные для работы с sms шлюзом (sms.ru) - 'sms_gateway' => 'http://sms.ru/sms/send?api_id=_KEY_&from=_WHO_', // шлюз - 'sms_to' => 'to', // GET параметр для получателя - 'sms_text' => 'text', // GET параметр для сообщения - 'sms_ok' => '100', // значение удачи + // Данные для работы с sms шлюзом (sms.ru) + 'sms_gateway' => 'http://sms.ru/sms/send?api_id=_KEY_&from=_WHO_', // шлюз + 'sms_to' => 'to', // GET параметр для получателя + 'sms_text' => 'text', // GET параметр для сообщения + 'sms_ok' => '100', // значение удачи - // Новости - 'news_page' => 10, // Кол-во новостей на странице + // Новости + 'news_page' => 10, // Кол-во новостей на странице - // Данные для рассчетов - 'benefitblock' => true, // Включена ли система контроля скидок (запрет выгоды при использовании скидок) - 'settlement_period' => false, // Включена ли система расчетного периода - 'currency' => 'руб.', // Наименование валюты - 'curinrub' => 1, // Курс к рублю - 'promo_discount' => true, // Суммировать скидки промо-кода и периода - 'part_proc' => 10, // Процент партнерской программы - 'part_money' => true, // true == зачислять в отдельный счет / false == сразу суммировать с балансом - 'part' => false, // true == пополнять процент при пополнении счета рефералом / false == пополнять при списании средств у реферала (продление/аренда) + // Данные для рассчетов + 'benefitblock' => true, // Включена ли система контроля скидок (запрет выгоды при использовании скидок) + 'settlement_period' => false, // Включена ли система расчетного периода + 'currency' => 'руб.', // Наименование валюты + 'curinrub' => 1, // Курс к рублю + 'promo_discount' => true, // Суммировать скидки промо-кода и периода + 'part_proc' => 10, // Процент партнерской программы + 'part_money' => true, // true == зачислять в отдельный счет / false == сразу суммировать с балансом + 'part' => false, // true == пополнять процент при пополнении счета рефералом / false == пополнять при списании средств у реферала (продление/аренда) - // Данные для вывода средств (если part_money == true) - 'part_log' => 'Лицевой счет', // название кошелька при выводе на баланс сайта - 'part_output_proc' => 10, // процент комисси за вывод - 'part_limit_min' => 100, // мин. лимит на вывод за раз пользователем - 'part_limit_max' => 500, // макс. лимит на вывод за день пользователем - 'part_limit_day' => 5000, // лимит на вывод за день - 'part_output' => false, // true == выводить без одобрения / false == вывод производиться после одобрения администратором - 'part_gateway' => 'unitpay', // платежный шлюз для вывода (unitpay) + // Данные для вывода средств (если part_money == true) + 'part_log' => 'Лицевой счет', // название кошелька при выводе на баланс сайта + 'part_output_proc' => 10, // процент комисси за вывод + 'part_limit_min' => 100, // мин. лимит на вывод за раз пользователем + 'part_limit_max' => 500, // макс. лимит на вывод за день пользователем + 'part_limit_day' => 5000, // лимит на вывод за день + 'part_output' => false, // true == выводить без одобрения / false == вывод производиться после одобрения администратором + 'part_gateway' => 'unitpay', // платежный шлюз для вывода (unitpay) - // Остальное - 'text_group' => true, // Вывод сообщений (ошибок) по группе пользователя - 'recaptcha' => false, // Требовать повторного ввода капчи (false - сохранить удачу в кеше на 60 секунд) - 'server_delete' => 3, // Через сколько дней удалить игровой сервер после окончания его аренды. - 'steamcmd' => '/path/cmd', // Путь к steamcmd на локациях (/path/steam) - 'iptables' => 'iptables_block', // Файл правил для FireWall (блокировка на уровне оборудования) (/root/_FILE_) - 'cron_key' => 'CRONKEY', // Ключ для cron.php - 'cron_taskset' => '0', // Ядро, на котором запускать cron.php (уставновить отличный от нуля, если на VDS больше 1 ядра/потока) + // Остальное + 'text_group' => true, // Вывод сообщений (ошибок) по группе пользователя + 'recaptcha' => false, // Требовать повторного ввода капчи (false - сохранить удачу в кеше на 60 секунд) + 'server_delete' => 3, // Через сколько дней удалить игровой сервер после окончания его аренды. + 'steamcmd' => '/path/cmd', // Путь к steamcmd на локациях (/path/steam) + 'iptables' => 'iptables_block', // Файл правил для FireWall (блокировка на уровне оборудования) (/root/_FILE_) + 'cron_key' => 'CRONKEY', // Ключ для cron.php + 'cron_taskset' => '0', // Ядро, на котором запускать cron.php (уставновить отличный от нуля, если на VDS больше 1 ядра/потока) 'cookie_same_site' => 'Lax', // Lax, None, Strict | https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite - // Кеш (кол-во секунд) - 'mcache_server_mon' => 2, // Мониторинг (онлайн, название, карта) - 'mcache_server_status' => 2, // Статус (состояние: включен, смена карты, переустановка) - 'mcache_server_resources' => 2, // Ресурсы (нагрузка: cpu, ram hdd) + // Кеш (кол-во секунд) + 'mcache_server_mon' => 2, // Мониторинг (онлайн, название, карта) + 'mcache_server_status' => 2, // Статус (состояние: включен, смена карты, переустановка) + 'mcache_server_resources' => 2, // Ресурсы (нагрузка: cpu, ram hdd) - // Контролеры / параметры - 'autostop' => 30, // Через сколько минут выключить CW сервер, если на нем нет игроков - 'teststop' => 10, // Через сколько минут выключить тестовый сервер, если на нем нет игроков - 'fpsplus' => 100, // Прибавление fps к параметру "sys_ticrate" при старте (пример: 1000+100 | итог: sys_ticrate 1100) - 'pingboost' => 3, // Значение pingboost по умолчанию (1,2,3 | 0 = без pingboost) - 'change_pingboost' => false, // Смена pingboost клиентом (true = разрешено / false = запрещено) - 'cpu_route' => true, // Активация (EngineGP CPU ROUTE) автораспределения игровых серверов по ядрам/потокам | false - выключена - 'cpu_first' => true, // Запретить использовать первый поток cpu (значение имеет вес при 2х и более потоках) | РЕКОМЕНДУЕМОЕ ЗНАЧЕНИЕ: true - 'crontabs' => 3, // Количество заданий crontab на 1 игровой сервер + // Контролеры / параметры + 'autostop' => 30, // Через сколько минут выключить CW сервер, если на нем нет игроков + 'teststop' => 10, // Через сколько минут выключить тестовый сервер, если на нем нет игроков + 'fpsplus' => 100, // Прибавление fps к параметру "sys_ticrate" при старте (пример: 1000+100 | итог: sys_ticrate 1100) + 'pingboost' => 3, // Значение pingboost по умолчанию (1,2,3 | 0 = без pingboost) + 'change_pingboost' => false, // Смена pingboost клиентом (true = разрешено / false = запрещено) + 'cpu_route' => true, // Активация (EngineGP CPU ROUTE) автораспределения игровых серверов по ядрам/потокам | false - выключена + 'cpu_first' => true, // Запретить использовать первый поток cpu (значение имеет вес при 2х и более потоках) | РЕКОМЕНДУЕМОЕ ЗНАЧЕНИЕ: true + 'crontabs' => 3, // Количество заданий crontab на 1 игровой сервер - // Услуга "Контроль" - 'control_delete' => 10, // через сколько дней удалять услугу - 'control_time' => array(30, 90), // периоды аренды - 'control_limit' => array( // лимит / цена - 1 => 50, - 5 => 100, - 10 => 150, - 20 => 250 - ), - 'control_server' => 'http://games.enginegp.ru/', // головной сервер, путь к архивам - 'control_packs' => array( - 'cs' => array( - '6153' => 'Build 6153', - '5787' => 'Build 5787', - 'rehlds' => 'ReHLDS' - ), - 'cssold' => array( - 'cssold' => 'Стандарт', - ), - 'css' => array( - 'default' => 'Стандарт', - ), - 'csgo' => array( - 'default' => 'Стандарт', - ) - ), - 'control_install' => array( - 'cs' => 'pack="6153", `map_start`="de_dust2", `fps`="1100"', - 'cssold' => 'pack="cssold", `map_start`="de_dust2", `fps`="1000",`tickrate`="100"', - 'css' => 'pack="default", `map_start`="de_dust2", `tickrate`="100"', - 'csgo' => 'pack="default", `map_start`="de_dust2", `tickrate`="128"' - ), - 'control_steamcmd' => array( - 'css' => 232330, - 'csgo' => 740 - ), + // Услуга "Контроль" + 'control_delete' => 10, // через сколько дней удалять услугу + 'control_time' => array(30, 90), // периоды аренды + 'control_limit' => array( // лимит / цена + 1 => 50, + 5 => 100, + 10 => 150, + 20 => 250 + ), + 'control_server' => 'http://games.enginegp.ru/', // головной сервер, путь к архивам + 'control_packs' => array( + 'cs' => array( + '6153' => 'Build 6153', + '5787' => 'Build 5787', + 'rehlds' => 'ReHLDS' + ), + 'cssold' => array( + 'cssold' => 'Стандарт', + ), + 'css' => array( + 'default' => 'Стандарт', + ), + 'csgo' => array( + 'default' => 'Стандарт', + ) + ), + 'control_install' => array( + 'cs' => 'pack="6153", `map_start`="de_dust2", `fps`="1100"', + 'cssold' => 'pack="cssold", `map_start`="de_dust2", `fps`="1000",`tickrate`="100"', + 'css' => 'pack="default", `map_start`="de_dust2", `tickrate`="100"', + 'csgo' => 'pack="default", `map_start`="de_dust2", `tickrate`="128"' + ), + 'control_steamcmd' => array( + 'css' => 232330, + 'csgo' => 740 + ), - // Задержка в возможности повторной переустановки сервера (минуты) - 'reinstall' => array( - 'cs' => '60', - 'cssold' => '60', - 'css' => '60', - 'csgo' => '60', - 'samp' => '60', - 'crmp' => '60', - 'mta' => '60', - 'mc' => '60' - ), + // Задержка в возможности повторной переустановки сервера (минуты) + 'reinstall' => array( + 'cs' => '60', + 'cssold' => '60', + 'css' => '60', + 'csgo' => '60', + 'samp' => '60', + 'crmp' => '60', + 'mta' => '60', + 'mc' => '60' + ), - // Задержка в возможности повторного обновления сервера (минуты) - 'update' => array( - 'cs' => '60', - 'cssold' => '60', - 'css' => '60', - 'csgo' => '60' - ), + // Задержка в возможности повторного обновления сервера (минуты) + 'update' => array( + 'cs' => '60', + 'cssold' => '60', + 'css' => '60', + 'csgo' => '60' + ), - // RAM на 1 слот - 'ram' => array( - 'cs' => '32', - 'cssold' => '32', - 'css' => '32', - 'csgo' => '32', - 'samp' => '32', - 'crmp' => '32', - 'mta' => '32' - ), + // RAM на 1 слот + 'ram' => array( + 'cs' => '32', + 'cssold' => '32', + 'css' => '32', + 'csgo' => '32', + 'samp' => '32', + 'crmp' => '32', + 'mta' => '32' + ), - // Максимальная нагрузка % на RAM 1-го игрового сервера - 'ram_use_max' => array( - 'cs' => '99', - 'cssold' => '99', - 'css' => '99', - 'csgo' => '99', - 'samp' => '99', - 'crmp' => '99', - 'mta' => '99', - ), + // Максимальная нагрузка % на RAM 1-го игрового сервера + 'ram_use_max' => array( + 'cs' => '99', + 'cssold' => '99', + 'css' => '99', + 'csgo' => '99', + 'samp' => '99', + 'crmp' => '99', + 'mta' => '99', + ), - // Максимальная нагрузка % на CPU 1-го игрового сервера - 'cpu_use_max' => array( - 'cs' => '99', - 'cssold' => '99', - 'css' => '99', - 'csgo' => '99', - 'samp' => '99', - 'crmp' => '99', - 'mta' => '99', - 'mc' => '99', - ), + // Максимальная нагрузка % на CPU 1-го игрового сервера + 'cpu_use_max' => array( + 'cs' => '99', + 'cssold' => '99', + 'css' => '99', + 'csgo' => '99', + 'samp' => '99', + 'crmp' => '99', + 'mta' => '99', + 'mc' => '99', + ), - // Параметры ftp игровых серверов - 'ftp' => array( - // Корневая директория серверов (false = server/(cstrike | csgo | l4d)/ | true = server/) - 'root' => array( - 'cs' => false, - 'cssold' => false, - 'css' => false, - 'csgo' => false, - 'samp' => false, - 'crmp' => false, - 'mta' => false, - 'mc' => false - ), + // Параметры ftp игровых серверов + 'ftp' => array( + // Корневая директория серверов (false = server/(cstrike | csgo | l4d)/ | true = server/) + 'root' => array( + 'cs' => false, + 'cssold' => false, + 'css' => false, + 'csgo' => false, + 'samp' => false, + 'crmp' => false, + 'mta' => false, + 'mc' => false + ), - // Путь к директори для файлового менеджера EngineGP (используется при $cfg['ftp']['root'][$game] == TRUE) - 'dir' => array( - 'cs' => '/cstrike', - 'cssold' => '/cstrike', - 'css' => '/cstrike', - 'csgo' => '/csgo', - 'samp' => '/', - 'crmp' => '/', - 'mta' => '/mods/deathmatch', - 'mc' => '/' - ), + // Путь к директори для файлового менеджера EngineGP (используется при $cfg['ftp']['root'][$game] == TRUE) + 'dir' => array( + 'cs' => '/cstrike', + 'cssold' => '/cstrike', + 'css' => '/cstrike', + 'csgo' => '/csgo', + 'samp' => '/', + 'crmp' => '/', + 'mta' => '/mods/deathmatch', + 'mc' => '/' + ), - // Путь к директори (используется при $cfg['ftp']['root'][$game] == FALSE) - 'home' => array( - 'cs' => '/cstrike', - 'cssold' => '/cstrike', - 'css' => '/cstrike', - 'csgo' => '/csgo', - 'samp' => '/', - 'crmp' => '/', - 'mta' => '/mods/deathmatch', - 'mc' => '/' - ), - ), + // Путь к директори (используется при $cfg['ftp']['root'][$game] == FALSE) + 'home' => array( + 'cs' => '/cstrike', + 'cssold' => '/cstrike', + 'css' => '/cstrike', + 'csgo' => '/csgo', + 'samp' => '/', + 'crmp' => '/', + 'mta' => '/mods/deathmatch', + 'mc' => '/' + ), + ), - // Смена количества слот - 'change_slots' => array( - 'cs' => array( - 'days' => true, // При смене кол-ва слот вычитывать/добавлять дни аренды (add == true), если false, то смена (увеличение) на платной основе - 'down' => true, // Если 'days == true', то дать возможность уменьшать слоты - 'add' => true // Если 'down == true', то при уменьшении кол-во слот, добавлять дни к аренде - ), + // Смена количества слот + 'change_slots' => array( + 'cs' => array( + 'days' => true, // При смене кол-ва слот вычитывать/добавлять дни аренды (add == true), если false, то смена (увеличение) на платной основе + 'down' => true, // Если 'days == true', то дать возможность уменьшать слоты + 'add' => true // Если 'down == true', то при уменьшении кол-во слот, добавлять дни к аренде + ), - 'cssold' => array( - 'days' => true, // При смене кол-ва слот вычитывать/добавлять дни аренды (add == true), если false, то смена (увеличение) на платной основе - 'down' => true, // Если 'days == true', то дать возможность уменьшать слоты - 'add' => true // Если 'down == true', то при уменьшении кол-во слот, добавлять дни к аренде - ), + 'cssold' => array( + 'days' => true, // При смене кол-ва слот вычитывать/добавлять дни аренды (add == true), если false, то смена (увеличение) на платной основе + 'down' => true, // Если 'days == true', то дать возможность уменьшать слоты + 'add' => true // Если 'down == true', то при уменьшении кол-во слот, добавлять дни к аренде + ), - 'css' => array( - 'days' => true, // При смене кол-ва слот вычитывать/добавлять дни аренды (add == true), если false, то смена (увеличение) на платной основе - 'down' => true, // Если 'days == true', то дать возможность уменьшать слоты - 'add' => true // Если 'down == true', то при уменьшении кол-во слот, добавлять дни к аренде - ), + 'css' => array( + 'days' => true, // При смене кол-ва слот вычитывать/добавлять дни аренды (add == true), если false, то смена (увеличение) на платной основе + 'down' => true, // Если 'days == true', то дать возможность уменьшать слоты + 'add' => true // Если 'down == true', то при уменьшении кол-во слот, добавлять дни к аренде + ), - 'csgo' => array( - 'days' => false, // При смене кол-ва слот вычитывать/добавлять дни аренды (add == true), если false, то смена (увеличение) на платной основе - 'down' => true, // Если 'days == true', то дать возможность уменьшать слоты - 'add' => true // Если 'down == true', то при уменьшении кол-во слот, добавлять дни к аренде - ), + 'csgo' => array( + 'days' => false, // При смене кол-ва слот вычитывать/добавлять дни аренды (add == true), если false, то смена (увеличение) на платной основе + 'down' => true, // Если 'days == true', то дать возможность уменьшать слоты + 'add' => true // Если 'down == true', то при уменьшении кол-во слот, добавлять дни к аренде + ), - 'samp' => array( - 'days' => true, // При смене кол-ва слот вычитывать/добавлять дни аренды (add == true), если false, то смена (увеличение) на платной основе - 'down' => true, // Если 'days == true', то дать возможность уменьшать слоты - 'add' => true // Если 'down == true', то при уменьшении кол-во слот, добавлять дни к аренде - ), + 'samp' => array( + 'days' => true, // При смене кол-ва слот вычитывать/добавлять дни аренды (add == true), если false, то смена (увеличение) на платной основе + 'down' => true, // Если 'days == true', то дать возможность уменьшать слоты + 'add' => true // Если 'down == true', то при уменьшении кол-во слот, добавлять дни к аренде + ), - 'crmp' => array( - 'days' => true, // При смене кол-ва слот вычитывать/добавлять дни аренды (add == true), если false, то смена (увеличение) на платной основе - 'down' => true, // Если 'days == true', то дать возможность уменьшать слоты - 'add' => true // Если 'down == true', то при уменьшении кол-во слот, добавлять дни к аренде - ), + 'crmp' => array( + 'days' => true, // При смене кол-ва слот вычитывать/добавлять дни аренды (add == true), если false, то смена (увеличение) на платной основе + 'down' => true, // Если 'days == true', то дать возможность уменьшать слоты + 'add' => true // Если 'down == true', то при уменьшении кол-во слот, добавлять дни к аренде + ), - 'mta' => array( - 'days' => true, // При смене кол-ва слот вычитывать/добавлять дни аренды (add == true), если false, то смена (увеличение) на платной основе - 'down' => true, // Если 'days == true', то дать возможность уменьшать слоты - 'add' => true // Если 'down == true', то при уменьшении кол-во слот, добавлять дни к аренде - ), + 'mta' => array( + 'days' => true, // При смене кол-ва слот вычитывать/добавлять дни аренды (add == true), если false, то смена (увеличение) на платной основе + 'down' => true, // Если 'days == true', то дать возможность уменьшать слоты + 'add' => true // Если 'down == true', то при уменьшении кол-во слот, добавлять дни к аренде + ), - 'mc' => array( - 'days' => true, // При смене кол-ва слот вычитывать/добавлять дни аренды (add == true), если false, то смена (увеличение) на платной основе - 'down' => true, // Если 'days == true', то дать возможность уменьшать слоты - 'add' => true // Если 'down == true', то при уменьшении кол-во слот, добавлять дни к аренде - ) - ), + 'mc' => array( + 'days' => true, // При смене кол-ва слот вычитывать/добавлять дни аренды (add == true), если false, то смена (увеличение) на платной основе + 'down' => true, // Если 'days == true', то дать возможность уменьшать слоты + 'add' => true // Если 'down == true', то при уменьшении кол-во слот, добавлять дни к аренде + ) + ), - // Смена локации - 'change_unit' => array( - 'cs' => false, - 'cssold' => false, - 'css' => false, - 'csgo' => false, - 'samp' => false, - 'crmp' => false, - 'mta' => false, - 'mc' => false - ), + // Смена локации + 'change_unit' => array( + 'cs' => false, + 'cssold' => false, + 'css' => false, + 'csgo' => false, + 'samp' => false, + 'crmp' => false, + 'mta' => false, + 'mc' => false + ), - // Аренда выделенного адреса (пример: cs 1.6 => ip:27015) - 'buy_address' => array( - 'cs' => true, // true == по месячная аренда, false == разовая оплата на весь период аренды игрового сервера - 'cssold' => true, - 'css' => true, - 'csgo' => true, - 'samp' => true, - 'crmp' => true, - 'mta' => true, - 'mc' => true - ), + // Аренда выделенного адреса (пример: cs 1.6 => ip:27015) + 'buy_address' => array( + 'cs' => true, // true == по месячная аренда, false == разовая оплата на весь период аренды игрового сервера + 'cssold' => true, + 'css' => true, + 'csgo' => true, + 'samp' => true, + 'crmp' => true, + 'mta' => true, + 'mc' => true + ), - // Тестовый период (тестовый период возможен только пользователям с подтвержденным номером, выдается 1 раз) - 'tests' => array( - 'game' => false, // Разрешить брать тест другой игры - 'sametime' => false // Разрешить брать тест другой игры во время тестирования. (при условии, что game == true) - ), + // Тестовый период (тестовый период возможен только пользователям с подтвержденным номером, выдается 1 раз) + 'tests' => array( + 'game' => false, // Разрешить брать тест другой игры + 'sametime' => false // Разрешить брать тест другой игры во время тестирования. (при условии, что game == true) + ), - // Боты на сервере (включение -nobots в параметре запуска сервера) - 'bots' => array( - 'cssold' => false, // true == разрешены, false == запрещены - 'css' => false, - 'csgo' => false - ) - ); + // Боты на сервере (включение -nobots в параметре запуска сервера) + 'bots' => array( + 'cssold' => false, // true == разрешены, false == запрещены + 'css' => false, + 'csgo' => false + ) + ); ?> \ No newline at end of file diff --git a/system/data/engine.php b/system/data/engine.php index 6c7da1a..29dc387 100644 --- a/system/data/engine.php +++ b/system/data/engine.php @@ -1,124 +1,124 @@ '/^[A-Za-z0-9_]{4,16}$/', - 'mail' => '/^([a-z0-9_\.-])+@[a-z0-9-]+\.([a-z]{2,4}\.)?[a-z]{2,4}$/i', - 'name' => '/^[А-Я]{1,1}[а-я]{2,15}$/u', - 'lastname' => '/^[А-Я]{1,1}[а-я]{2,15}$/u', - 'patronymic' => '/^[А-Я]{1,1}[а-я]{2,15}$/u', - 'phone' => '/^380+[0-9]{9,9}$|^77+[0-9]{9,9}$|^79+[0-9]{9,9}$|^375+[0-9]{9,9}$/m', - 'contacts' => '/^(http|https):\/\/(new\.vk|vk)\.com\/[A-Za-z\_\.]{1,2}[A-Za-z0-9\_\.]{4,32}$|^[A-Za-z][A-Za-z0-9\.\-\_]{6,32}$/', - 'passwd' => '/^[A-Za-z0-9]{6,26}$/', - 'cslogs' => '/^L[A-Za-z0-9\.]/', - 'csamxlogs' => '/^[A-Za-z0-9_\.-]/', - 'csssmlogs' => '/^[A-Za-z0-9_\.-]/', - 'address' => '/^(25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[0-9]{2}|[0-9])(\.(25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[0-9]{2}|[0-9])){3}:[0-9]{4,5}$/', - ); + $aValid = array( + 'login' => '/^[A-Za-z0-9_]{4,16}$/', + 'mail' => '/^([a-z0-9_\.-])+@[a-z0-9-]+\.([a-z]{2,4}\.)?[a-z]{2,4}$/i', + 'name' => '/^[А-Я]{1,1}[а-я]{2,15}$/u', + 'lastname' => '/^[А-Я]{1,1}[а-я]{2,15}$/u', + 'patronymic' => '/^[А-Я]{1,1}[а-я]{2,15}$/u', + 'phone' => '/^380+[0-9]{9,9}$|^77+[0-9]{9,9}$|^79+[0-9]{9,9}$|^375+[0-9]{9,9}$/m', + 'contacts' => '/^(http|https):\/\/(new\.vk|vk)\.com\/[A-Za-z\_\.]{1,2}[A-Za-z0-9\_\.]{4,32}$|^[A-Za-z][A-Za-z0-9\.\-\_]{6,32}$/', + 'passwd' => '/^[A-Za-z0-9]{6,26}$/', + 'cslogs' => '/^L[A-Za-z0-9\.]/', + 'csamxlogs' => '/^[A-Za-z0-9_\.-]/', + 'csssmlogs' => '/^[A-Za-z0-9_\.-]/', + 'address' => '/^(25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[0-9]{2}|[0-9])(\.(25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[0-9]{2}|[0-9])){3}:[0-9]{4,5}$/', + ); - // Массив данных для регистрации - $aSignup = array( - // Массив дополнительных полей - 'input' => array( - 'login' => true, - 'mail' => true, - 'name' => true, - 'lastname' => true, - 'patronymic' => false, - 'phone' => false, - 'contacts' => false, - 'passwd' => true - ), - // Массив описания полей - 'info' => array( - 'login' => 'Логин', - 'mail' => 'Почта', - 'name' => 'Имя', - 'lastname' => 'Фамилия', - 'patronymic' => 'Отчество', - 'phone' => 'Телефон', - 'contacts' => 'Контакты', - 'passwd' => 'Пароль' - ), - // Массив типа полей - 'type' => array( - 'login' => 'text', - 'mail' => 'text', - 'name' => 'text', - 'lastname' => 'text', - 'patronymic' => 'text', - 'phone' => 'text', - 'contacts' => 'text', - 'passwd' => 'password' - ), - // Массив подсказки полей - 'placeholder' => array( - 'login' => 'Введите логин', - 'mail' => 'Введите почту', - 'name' => 'Введите имя', - 'lastname' => 'Введите фамилию', - 'patronymic' => 'Введите отчество', - 'phone' => 'Введите номер', - 'contacts' => 'Введите skype или vk', - 'passwd' => 'Введите пароль' - ) - ); + // Массив данных для регистрации + $aSignup = array( + // Массив дополнительных полей + 'input' => array( + 'login' => true, + 'mail' => true, + 'name' => true, + 'lastname' => true, + 'patronymic' => false, + 'phone' => false, + 'contacts' => false, + 'passwd' => true + ), + // Массив описания полей + 'info' => array( + 'login' => 'Логин', + 'mail' => 'Почта', + 'name' => 'Имя', + 'lastname' => 'Фамилия', + 'patronymic' => 'Отчество', + 'phone' => 'Телефон', + 'contacts' => 'Контакты', + 'passwd' => 'Пароль' + ), + // Массив типа полей + 'type' => array( + 'login' => 'text', + 'mail' => 'text', + 'name' => 'text', + 'lastname' => 'text', + 'patronymic' => 'text', + 'phone' => 'text', + 'contacts' => 'text', + 'passwd' => 'password' + ), + // Массив подсказки полей + 'placeholder' => array( + 'login' => 'Введите логин', + 'mail' => 'Введите почту', + 'name' => 'Введите имя', + 'lastname' => 'Введите фамилию', + 'patronymic' => 'Введите отчество', + 'phone' => 'Введите номер', + 'contacts' => 'Введите skype или vk', + 'passwd' => 'Введите пароль' + ) + ); - // Данные для вывода информаци отправителя - $iHelp = 0; // 0 = Имя/Отчество || 1 = Имя || 2 = Логин | 3 = Почта + // Данные для вывода информаци отправителя + $iHelp = 0; // 0 = Имя/Отчество || 1 = Имя || 2 = Логин | 3 = Почта - // Вывод времени сообщения - $tHelp = 0; // 0 - вариант: * минут назад (макс 10мин) || 1 - дата. время (* минут назад) + // Вывод времени сообщения + $tHelp = 0; // 0 - вариант: * минут назад (макс 10мин) || 1 - дата. время (* минут назад) - // Названия игр - $aGname = array( - 'cs' => 'CS: 1.6', + // Названия игр + $aGname = array( + 'cs' => 'CS: 1.6', 'css' => 'CS: Source', - 'csgo' => 'CS: Global Offensive', + 'csgo' => 'CS: Global Offensive', 'cssold' => 'CS: Source v34', 'mc' => 'MineCraft', 'mta' => 'GTA: MTA', @@ -126,68 +126,68 @@ 'crmp' => 'GTA: CRMP' ); - // Роутер подразделов - $aRouteSub = array( - 'settings' => array( - 'api', - 'pack', - 'firewall', - 'crontab', - 'startlogs', - 'file' - ), - ); + // Роутер подразделов + $aRouteSub = array( + 'settings' => array( + 'api', + 'pack', + 'firewall', + 'crontab', + 'startlogs', + 'file' + ), + ); - // Директория логов StartLogs - $aSLdir = array( - 'cs' => 'cstrike/oldstart', - 'cssold' => 'cstrike/oldstart', - 'css' => 'cstrike/oldstart', - 'csgo' => 'csgo/oldstart', - 'mc' => 'oldstart', - 'mta' => 'mods/deathmatch/oldstart', - 'samp' => 'oldstart', - 'crmp' => 'oldstart' - ); + // Директория логов StartLogs + $aSLdir = array( + 'cs' => 'cstrike/oldstart', + 'cssold' => 'cstrike/oldstart', + 'css' => 'cstrike/oldstart', + 'csgo' => 'csgo/oldstart', + 'mc' => 'oldstart', + 'mta' => 'mods/deathmatch/oldstart', + 'samp' => 'oldstart', + 'crmp' => 'oldstart' + ); - // Директория логов StartLogs ftp (указывать изходя из настроек ftp) - $aSLdirFtp = array( - 'cs' => 'oldstart', - 'cssold' => 'oldstart', - 'css' => 'oldstart', - 'csgo' => 'csgo/oldstart', - 'mc' => 'oldstart', - 'mta' => 'mods/deathmatch/oldstart', - 'samp' => 'oldstart', - 'crmp' => 'oldstart' - ); + // Директория логов StartLogs ftp (указывать изходя из настроек ftp) + $aSLdirFtp = array( + 'cs' => 'oldstart', + 'cssold' => 'oldstart', + 'css' => 'oldstart', + 'csgo' => 'csgo/oldstart', + 'mc' => 'oldstart', + 'mta' => 'mods/deathmatch/oldstart', + 'samp' => 'oldstart', + 'crmp' => 'oldstart' + ); - // Права для совладельцев - $aOwners = array( - 'cs' => array('start' , 'stop', 'restart', 'change', 'reinstall', 'update', 'console', 'settings', 'plugins', 'maps', 'filetp', 'tarif', 'copy', 'graph'), - 'cssold' => array('start' , 'stop', 'restart', 'change', 'reinstall', 'update', 'console', 'settings', 'plugins', 'maps', 'filetp', 'tarif', 'copy', 'graph'), - 'css' => array('start' , 'stop', 'restart', 'change', 'reinstall', 'update', 'console', 'settings', 'plugins', 'maps', 'filetp', 'tarif', 'copy', 'graph'), - 'csgo' => array('start' , 'stop', 'restart', 'change', 'reinstall', 'update', 'console', 'settings', 'plugins', 'maps', 'filetp', 'tarif', 'copy', 'graph'), - 'mc' => array('start', 'stop', 'restart', 'reinstall', 'console', 'settings', 'plugins', 'filetp', 'tarif', 'copy', 'graph'), - 'mta' => array('start', 'stop', 'restart', 'reinstall', 'console', 'settings', 'plugins', 'filetp', 'tarif', 'copy', 'graph'), - 'samp' => array('start', 'stop', 'restart', 'reinstall', 'console', 'settings', 'plugins', 'filetp', 'tarif', 'copy', 'graph'), - 'crmp' => array('start', 'stop', 'restart', 'reinstall', 'console', 'settings', 'plugins', 'filetp', 'tarif', 'copy', 'graph'), - ); + // Права для совладельцев + $aOwners = array( + 'cs' => array('start' , 'stop', 'restart', 'change', 'reinstall', 'update', 'console', 'settings', 'plugins', 'maps', 'filetp', 'tarif', 'copy', 'graph'), + 'cssold' => array('start' , 'stop', 'restart', 'change', 'reinstall', 'update', 'console', 'settings', 'plugins', 'maps', 'filetp', 'tarif', 'copy', 'graph'), + 'css' => array('start' , 'stop', 'restart', 'change', 'reinstall', 'update', 'console', 'settings', 'plugins', 'maps', 'filetp', 'tarif', 'copy', 'graph'), + 'csgo' => array('start' , 'stop', 'restart', 'change', 'reinstall', 'update', 'console', 'settings', 'plugins', 'maps', 'filetp', 'tarif', 'copy', 'graph'), + 'mc' => array('start', 'stop', 'restart', 'reinstall', 'console', 'settings', 'plugins', 'filetp', 'tarif', 'copy', 'graph'), + 'mta' => array('start', 'stop', 'restart', 'reinstall', 'console', 'settings', 'plugins', 'filetp', 'tarif', 'copy', 'graph'), + 'samp' => array('start', 'stop', 'restart', 'reinstall', 'console', 'settings', 'plugins', 'filetp', 'tarif', 'copy', 'graph'), + 'crmp' => array('start', 'stop', 'restart', 'reinstall', 'console', 'settings', 'plugins', 'filetp', 'tarif', 'copy', 'graph'), + ); - $aOwnersI = array( - 'start' => 'Включение', - 'stop' => 'Выключение', - 'restart' => 'Перезагрузка', - 'change' => 'Смена карты', - 'reinstall' => 'Переустановка', - 'update' => 'Обновление', - 'console' => 'Раздел "Консоль"', - 'settings' => 'Раздел "Настройки"', - 'plugins' => 'Раздел "Плагины"', - 'maps' => 'Раздел "Карты"', - 'filetp' => 'Раздел "FileTP"', - 'tarif' => 'Раздел "Тариф"', - 'copy' => 'Раздел "Копии"', - 'graph' => 'Раздел "Графики"' - ); + $aOwnersI = array( + 'start' => 'Включение', + 'stop' => 'Выключение', + 'restart' => 'Перезагрузка', + 'change' => 'Смена карты', + 'reinstall' => 'Переустановка', + 'update' => 'Обновление', + 'console' => 'Раздел "Консоль"', + 'settings' => 'Раздел "Настройки"', + 'plugins' => 'Раздел "Плагины"', + 'maps' => 'Раздел "Карты"', + 'filetp' => 'Раздел "FileTP"', + 'tarif' => 'Раздел "Тариф"', + 'copy' => 'Раздел "Копии"', + 'graph' => 'Раздел "Графики"' + ); ?> \ No newline at end of file diff --git a/system/data/filedits.php b/system/data/filedits.php index 9ca62ab..f8be504 100644 --- a/system/data/filedits.php +++ b/system/data/filedits.php @@ -1,173 +1,173 @@ array( - 'all' => array( - 'files' => array( - 'autoexec.cfg', - 'fastdl.cfg', - 'plugins.ini', - 'users.ini', - 'motd.txt', - ), - 'path' => array( - 'autoexec.cfg' => 'cstrike/', - 'fastdl.cfg' => 'cstrike/', - 'plugins.ini' => 'cstrike/addons/amxmodx/configs/', - 'users.ini' => 'cstrike/addons/amxmodx/configs/', - 'motd.txt' => 'cstrike/', - ), - 'desc' => array( - 'autoexec.cfg' => 'Автоподключаемый конфигурационный файл.', - 'fastdl.cfg' => 'Быстрая закачка файлов с сервера.', - 'plugins.ini' => 'Список плагинов на сервере.', - 'users.ini' => 'Список админов на сервере.', - 'motd.txt' => 'Окно приветствия на сервере.', - ) - ), - - ), + $aEdits = array( + 'cs' => array( + 'all' => array( + 'files' => array( + 'autoexec.cfg', + 'fastdl.cfg', + 'plugins.ini', + 'users.ini', + 'motd.txt', + ), + 'path' => array( + 'autoexec.cfg' => 'cstrike/', + 'fastdl.cfg' => 'cstrike/', + 'plugins.ini' => 'cstrike/addons/amxmodx/configs/', + 'users.ini' => 'cstrike/addons/amxmodx/configs/', + 'motd.txt' => 'cstrike/', + ), + 'desc' => array( + 'autoexec.cfg' => 'Автоподключаемый конфигурационный файл.', + 'fastdl.cfg' => 'Быстрая закачка файлов с сервера.', + 'plugins.ini' => 'Список плагинов на сервере.', + 'users.ini' => 'Список админов на сервере.', + 'motd.txt' => 'Окно приветствия на сервере.', + ) + ), + + ), - 'cssold' => array( - 'all' => array( - 'files' => array( - 'autoexec.cfg', - 'fastdl.cfg', - 'admins_simple.ini', - ), - 'path' => array( - 'autoexec.cfg' => 'cstrike/cfg/', - 'fastdl.cfg' => 'cstrike/cfg/', - 'admins_simple.ini' => 'cstrike/addons/sourcemod/configs/', - ), - 'desc' => array( - 'autoexec.cfg' => 'Автоподключаемый конфигурационный файл.', - 'fastdl.cfg' => 'Быстрая закачка файлов с сервера.', - 'admins_simple.ini' => 'Список админов на сервере.', - ) - ) - ), + 'cssold' => array( + 'all' => array( + 'files' => array( + 'autoexec.cfg', + 'fastdl.cfg', + 'admins_simple.ini', + ), + 'path' => array( + 'autoexec.cfg' => 'cstrike/cfg/', + 'fastdl.cfg' => 'cstrike/cfg/', + 'admins_simple.ini' => 'cstrike/addons/sourcemod/configs/', + ), + 'desc' => array( + 'autoexec.cfg' => 'Автоподключаемый конфигурационный файл.', + 'fastdl.cfg' => 'Быстрая закачка файлов с сервера.', + 'admins_simple.ini' => 'Список админов на сервере.', + ) + ) + ), - 'css' => array( - 'all' => array( - 'files' => array( - 'autoexec.cfg', - 'fastdl.cfg', - 'admins_simple.ini', - ), - 'path' => array( - 'autoexec.cfg' => 'cstrike/cfg/', - 'fastdl.cfg' => 'cstrike/cfg/', - 'admins_simple.ini' => 'cstrike/addons/sourcemod/configs/', - ), - 'desc' => array( - 'autoexec.cfg' => 'Автоподключаемый конфигурационный файл.', - 'fastdl.cfg' => 'Быстрая закачка файлов с сервера.', - 'admins_simple.ini' => 'Список админов на сервере.', - ) - ) - ), + 'css' => array( + 'all' => array( + 'files' => array( + 'autoexec.cfg', + 'fastdl.cfg', + 'admins_simple.ini', + ), + 'path' => array( + 'autoexec.cfg' => 'cstrike/cfg/', + 'fastdl.cfg' => 'cstrike/cfg/', + 'admins_simple.ini' => 'cstrike/addons/sourcemod/configs/', + ), + 'desc' => array( + 'autoexec.cfg' => 'Автоподключаемый конфигурационный файл.', + 'fastdl.cfg' => 'Быстрая закачка файлов с сервера.', + 'admins_simple.ini' => 'Список админов на сервере.', + ) + ) + ), - 'csgo' => array( - 'all' => array( - 'files' => array( - 'autoexec.cfg', - 'fastdl.cfg', - 'webapi_authkey.txt', - ), - 'path' => array( - 'autoexec.cfg' => 'csgo/cfg/', - 'fastdl.cfg' => 'csgo/cfg/', - 'webapi_authkey.txt' => 'csgo/', - ), - 'desc' => array( - 'autoexec.cfg' => 'Автоподключаемый конфигурационный файл.', - 'fastdl.cfg' => 'Быстрая закачка файлов с сервера.', - 'webapi_authkey.txt' => 'API ключ для установки карт из мастерской WorkShop.', - ) - ) - ), + 'csgo' => array( + 'all' => array( + 'files' => array( + 'autoexec.cfg', + 'fastdl.cfg', + 'webapi_authkey.txt', + ), + 'path' => array( + 'autoexec.cfg' => 'csgo/cfg/', + 'fastdl.cfg' => 'csgo/cfg/', + 'webapi_authkey.txt' => 'csgo/', + ), + 'desc' => array( + 'autoexec.cfg' => 'Автоподключаемый конфигурационный файл.', + 'fastdl.cfg' => 'Быстрая закачка файлов с сервера.', + 'webapi_authkey.txt' => 'API ключ для установки карт из мастерской WorkShop.', + ) + ) + ), - 'mta' => array( - 'all' => array( - 'files' => array( - 'mtaserver.conf', - 'acl.xml', - 'vehiclecolors.conf' - ), - 'path' => array( - 'mtaserver.conf' => 'mods/deathmatch/', - 'acl.xml' => 'mods/deathmatch/', - 'vehiclecolors.conf' => 'mods/deathmatch/' - ), - 'desc' => array( - 'mtaserver.conf' => 'Основной конфигурационный файл сервера.', - 'acl.xml' => 'Настройки прав на игровом сервере.', - 'vehiclecolors.conf' => 'Настройки цветов автомобилей на игровом сервере.' - ) - ) - ), + 'mta' => array( + 'all' => array( + 'files' => array( + 'mtaserver.conf', + 'acl.xml', + 'vehiclecolors.conf' + ), + 'path' => array( + 'mtaserver.conf' => 'mods/deathmatch/', + 'acl.xml' => 'mods/deathmatch/', + 'vehiclecolors.conf' => 'mods/deathmatch/' + ), + 'desc' => array( + 'mtaserver.conf' => 'Основной конфигурационный файл сервера.', + 'acl.xml' => 'Настройки прав на игровом сервере.', + 'vehiclecolors.conf' => 'Настройки цветов автомобилей на игровом сервере.' + ) + ) + ), - 'mc' => array( - 'all' => array( - 'files' => array( - 'ops.txt', - 'permissions.yml', - 'white-list.txt', - 'banned-players.txt', - 'banned-ips.txt' - ), - 'path' => array( - 'ops.txt' => '/', - 'permissions.yml' => '/', - 'white-list.txt' => '/', - 'banned-players.txt' => '/', - 'banned-ips.txt' => '/' - ), - 'desc' => array( - 'ops.txt' => 'Файл в котором прописываются админы.', - 'permissions.yml' => 'Список разрешений', - 'white-list.txt' => 'Белый список игроков.', - 'banned-players.txt' => 'Забаненные игроки.', - 'banned-ips.txt' => 'Забаненные IP адреса.' - ) - ) - ) - ); + 'mc' => array( + 'all' => array( + 'files' => array( + 'ops.txt', + 'permissions.yml', + 'white-list.txt', + 'banned-players.txt', + 'banned-ips.txt' + ), + 'path' => array( + 'ops.txt' => '/', + 'permissions.yml' => '/', + 'white-list.txt' => '/', + 'banned-players.txt' => '/', + 'banned-ips.txt' => '/' + ), + 'desc' => array( + 'ops.txt' => 'Файл в котором прописываются админы.', + 'permissions.yml' => 'Список разрешений', + 'white-list.txt' => 'Белый список игроков.', + 'banned-players.txt' => 'Забаненные игроки.', + 'banned-ips.txt' => 'Забаненные IP адреса.' + ) + ) + ) + ); - if(isset($aEditslist)) - { - $dir = isset($ctrlmod) ? 'control/' : ''; + if(isset($aEditslist)) + { + $dir = isset($ctrlmod) ? 'control/' : ''; - // Генерация общего списка редактируемых файлов - if(isset($aEdits[$server['game']]['all']['files'])) - foreach($aEdits[$server['game']]['all']['files'] as $file) - { - $html->get('edits_list', 'sections/'.$dir.'servers/games/settings'); - $html->set('id', $id); - $html->set('name', $file); - $html->set('desc', $aEdits[$server['game']]['all']['desc'][$file]); + // Генерация общего списка редактируемых файлов + if(isset($aEdits[$server['game']]['all']['files'])) + foreach($aEdits[$server['game']]['all']['files'] as $file) + { + $html->get('edits_list', 'sections/'.$dir.'servers/games/settings'); + $html->set('id', $id); + $html->set('name', $file); + $html->set('desc', $aEdits[$server['game']]['all']['desc'][$file]); - if(isset($ctrlmod)) - $html->set('server', $sid); - $html->pack('edits'); - } + if(isset($ctrlmod)) + $html->set('server', $sid); + $html->pack('edits'); + } - if(!isset($ctrlmod)) - { - // Генерация списка редактируемых файлов по тарифу - if(isset($aEdits[$server['game']][$tarif['name']]['files'])) - foreach($aEdits[$server['game']][$tarif['name']]['files'] as $file) - { - $html->get('edits_list', 'sections/servers/games/settings'); - $html->set('id', $id); - $html->set('name', $file); - $html->set('desc', $aEdits[$server['game']][$tarif['name']]['desc'][$file]); - $html->pack('edits'); - } - } - } + if(!isset($ctrlmod)) + { + // Генерация списка редактируемых файлов по тарифу + if(isset($aEdits[$server['game']][$tarif['name']]['files'])) + foreach($aEdits[$server['game']][$tarif['name']]['files'] as $file) + { + $html->get('edits_list', 'sections/servers/games/settings'); + $html->set('id', $id); + $html->set('name', $file); + $html->set('desc', $aEdits[$server['game']][$tarif['name']]['desc'][$file]); + $html->pack('edits'); + } + } + } ?> \ No newline at end of file diff --git a/system/data/graph.php b/system/data/graph.php index 0b11f83..f7fe98a 100644 --- a/system/data/graph.php +++ b/system/data/graph.php @@ -1,42 +1,42 @@ array( - 'fon' => array('R' => 232, 'G' => 235, 'B' => 240), - 'border' => array('R' => 220, 'G' => 220, 'B' => 220), - 'graph' => array('R' => 255, 'G' => 255, 'B' => 255, 'Surrounding' => -200, 'Alpha' => 10), - 'line' => array('R' => 68, 'G' => 148, 'B' => 224), - 'leftbox' => array('R' => 0, 'G' => 0, 'B' => 0), - 'box' => array('R' => 0, 'G' => 0, 'B' => 0), - 'boxcolor' => array('R' => 255, 'G' => 255, 'B' => 255), - 'color' => array('R' => 0, 'G' => 0, 'B' => 0), - 'progress' => array('R' => 68, 'G' => 148, 'B' => 224) - ), + $aStyle = array( + 'default' => array( + 'fon' => array('R' => 232, 'G' => 235, 'B' => 240), + 'border' => array('R' => 220, 'G' => 220, 'B' => 220), + 'graph' => array('R' => 255, 'G' => 255, 'B' => 255, 'Surrounding' => -200, 'Alpha' => 10), + 'line' => array('R' => 68, 'G' => 148, 'B' => 224), + 'leftbox' => array('R' => 0, 'G' => 0, 'B' => 0), + 'box' => array('R' => 0, 'G' => 0, 'B' => 0), + 'boxcolor' => array('R' => 255, 'G' => 255, 'B' => 255), + 'color' => array('R' => 0, 'G' => 0, 'B' => 0), + 'progress' => array('R' => 68, 'G' => 148, 'B' => 224) + ), - 'black' => array( - 'fon' => array('R' => 0, 'G' => 0, 'B' => 0), - 'border' => array('R' => 232, 'G' => 235, 'B' => 240), - 'graph' => array('R' => 232, 'G' => 235, 'B' => 240, 'Surrounding' => -200, 'Alpha' => 100), - 'line' => array('R' => 68, 'G' => 148, 'B' => 224), - 'leftbox' => array('R' => 255, 'G' => 255, 'B' => 255), - 'box' => array('R' => 255, 'G' => 255, 'B' => 255), - 'boxcolor' => array('R' => 0, 'G' => 0, 'B' => 0), - 'color' => array('R' => 255, 'G' => 255, 'B' => 255), - 'progress' => array('R' => 68, 'G' => 148, 'B' => 224) - ), + 'black' => array( + 'fon' => array('R' => 0, 'G' => 0, 'B' => 0), + 'border' => array('R' => 232, 'G' => 235, 'B' => 240), + 'graph' => array('R' => 232, 'G' => 235, 'B' => 240, 'Surrounding' => -200, 'Alpha' => 100), + 'line' => array('R' => 68, 'G' => 148, 'B' => 224), + 'leftbox' => array('R' => 255, 'G' => 255, 'B' => 255), + 'box' => array('R' => 255, 'G' => 255, 'B' => 255), + 'boxcolor' => array('R' => 0, 'G' => 0, 'B' => 0), + 'color' => array('R' => 255, 'G' => 255, 'B' => 255), + 'progress' => array('R' => 68, 'G' => 148, 'B' => 224) + ), - 'camo' => array( - 'fon' => array('R' => 55, 'G' => 62, 'B' => 40), - 'border' => array('R' => 62, 'G' => 68, 'B' => 51), - 'graph' => array('R' => 46, 'G' => 50, 'B' => 37, 'Surrounding' => -200, 'Alpha' => 10), - 'line' => array('R' => 166, 'G' => 186, 'B' => 149), - 'leftbox' => array('R' => 32, 'G' => 35, 'B' => 27), - 'box' => array('R' => 46, 'G' => 50, 'B' => 37), - 'boxcolor' => array('R' => 210, 'G' => 225, 'B' => 181), - 'color' => array('R' => 136, 'G' => 156, 'B' => 99), - 'progress' => array('R' => 136, 'G' => 156, 'B' => 99, 'BoxBorderR' => 46, 'BoxBorderG' => 50, 'BoxBorderB' => 37) - ), - ); + 'camo' => array( + 'fon' => array('R' => 55, 'G' => 62, 'B' => 40), + 'border' => array('R' => 62, 'G' => 68, 'B' => 51), + 'graph' => array('R' => 46, 'G' => 50, 'B' => 37, 'Surrounding' => -200, 'Alpha' => 10), + 'line' => array('R' => 166, 'G' => 186, 'B' => 149), + 'leftbox' => array('R' => 32, 'G' => 35, 'B' => 27), + 'box' => array('R' => 46, 'G' => 50, 'B' => 37), + 'boxcolor' => array('R' => 210, 'G' => 225, 'B' => 181), + 'color' => array('R' => 136, 'G' => 156, 'B' => 99), + 'progress' => array('R' => 136, 'G' => 156, 'B' => 99, 'BoxBorderR' => 46, 'BoxBorderG' => 50, 'BoxBorderB' => 37) + ), + ); ?> \ No newline at end of file diff --git a/system/data/header.php b/system/data/header.php index 83497c1..342635a 100644 --- a/system/data/header.php +++ b/system/data/header.php @@ -1,31 +1,31 @@ array( - 'description' => 'Наш хостинг игровых серверов это высокое качество техподдержки, быстрое оформление и разумные расценки. Качественный хостинг игровых серверов', - 'keywords' => 'аренда игровых серверов, хостинг игровых серверов, игровой хостинг, дешевый хостинг игровых серверов, хостинг игровых серверов css, самый дешевый хостинг игровых серверов, качественный хостинг игровых серверов, бесплатный игровой хостинг' - ), + $header = array( + 'index' => array( + 'description' => 'Наш хостинг игровых серверов это высокое качество техподдержки, быстрое оформление и разумные расценки. Качественный хостинг игровых серверов', + 'keywords' => 'аренда игровых серверов, хостинг игровых серверов, игровой хостинг, дешевый хостинг игровых серверов, хостинг игровых серверов css, самый дешевый хостинг игровых серверов, качественный хостинг игровых серверов, бесплатный игровой хостинг' + ), - 'news' => array( - 'description' => 'Наш хостинг игровых серверов это высокое качество техподдержки, быстрое оформление и разумные расценки. Качественный хостинг игровых серверов', - 'keywords' => 'аренда игровых серверов, хостинг игровых серверов, игровой хостинг, дешевый хостинг игровых серверов, хостинг игровых серверов css, самый дешевый хостинг игровых серверов, качественный хостинг игровых серверов, бесплатный игровой хостинг' - ), + 'news' => array( + 'description' => 'Наш хостинг игровых серверов это высокое качество техподдержки, быстрое оформление и разумные расценки. Качественный хостинг игровых серверов', + 'keywords' => 'аренда игровых серверов, хостинг игровых серверов, игровой хостинг, дешевый хостинг игровых серверов, хостинг игровых серверов css, самый дешевый хостинг игровых серверов, качественный хостинг игровых серверов, бесплатный игровой хостинг' + ), - 'services' => array( - 'description' => 'Наш хостинг игровых серверов это высокое качество техподдержки, быстрое оформление и разумные расценки. Качественный хостинг игровых серверов', - 'keywords' => 'аренда игровых серверов, хостинг игровых серверов, игровой хостинг, дешевый хостинг игровых серверов, хостинг игровых серверов css, самый дешевый хостинг игровых серверов, качественный хостинг игровых серверов, бесплатный игровой хостинг' - ), + 'services' => array( + 'description' => 'Наш хостинг игровых серверов это высокое качество техподдержки, быстрое оформление и разумные расценки. Качественный хостинг игровых серверов', + 'keywords' => 'аренда игровых серверов, хостинг игровых серверов, игровой хостинг, дешевый хостинг игровых серверов, хостинг игровых серверов css, самый дешевый хостинг игровых серверов, качественный хостинг игровых серверов, бесплатный игровой хостинг' + ), - 'wiki' => array( - 'description' => 'Наш хостинг игровых серверов это высокое качество техподдержки, быстрое оформление и разумные расценки. Качественный хостинг игровых серверов', - 'keywords' => 'аренда игровых серверов, хостинг игровых серверов, игровой хостинг, дешевый хостинг игровых серверов, хостинг игровых серверов css, самый дешевый хостинг игровых серверов, качественный хостинг игровых серверов, бесплатный игровой хостинг' - ), + 'wiki' => array( + 'description' => 'Наш хостинг игровых серверов это высокое качество техподдержки, быстрое оформление и разумные расценки. Качественный хостинг игровых серверов', + 'keywords' => 'аренда игровых серверов, хостинг игровых серверов, игровой хостинг, дешевый хостинг игровых серверов, хостинг игровых серверов css, самый дешевый хостинг игровых серверов, качественный хостинг игровых серверов, бесплатный игровой хостинг' + ), - 'contacts' => array( - 'description' => 'Наш хостинг игровых серверов это высокое качество техподдержки, быстрое оформление и разумные расценки. Качественный хостинг игровых серверов', - 'keywords' => 'аренда игровых серверов, хостинг игровых серверов, игровой хостинг, дешевый хостинг игровых серверов, хостинг игровых серверов css, самый дешевый хостинг игровых серверов, качественный хостинг игровых серверов, бесплатный игровой хостинг' - ) - ); + 'contacts' => array( + 'description' => 'Наш хостинг игровых серверов это высокое качество техподдержки, быстрое оформление и разумные расценки. Качественный хостинг игровых серверов', + 'keywords' => 'аренда игровых серверов, хостинг игровых серверов, игровой хостинг, дешевый хостинг игровых серверов, хостинг игровых серверов css, самый дешевый хостинг игровых серверов, качественный хостинг игровых серверов, бесплатный игровой хостинг' + ) + ); ?> \ No newline at end of file diff --git a/system/data/mail.ini b/system/data/mail.ini index a9d17dd..ae423ce 100644 --- a/system/data/mail.ini +++ b/system/data/mail.ini @@ -1,51 +1,51 @@
    - - - - - - -
    - - - - - - -
    - - - - - - - - - - - - -
    - - [name] - -
    - - - - - - - - - -
    - -

    - [text] -

    -
    -
    -
    -
    + + + + + + +
    + + + + + + +
    + + + + + + + + + + + + +
    + + [name] + +
    + + + + + + + + + +
    + +

    + [text] +

    +
    +
    +
    +
    \ No newline at end of file diff --git a/system/data/maps.php b/system/data/maps.php index fbb6158..5f3bd7f 100644 --- a/system/data/maps.php +++ b/system/data/maps.php @@ -1,29 +1,29 @@ array( - 'de' => array('de'), - 'cs' => array('cs'), - 'aim' => array('aim'), - 'awp' => array('awp'), - 'bhop' => array('bhop'), - 'csde' => array('csde'), - 'deathrun' => array('deathrun'), - 'jail' => array('jail', 'jailbreak', 'jb'), - 'zm' => array('zm', 'ze'), - 'fy' => array('fy'), - 'gg' => array('gg'), - 'surf' => array('surf'), - 'dm' => array('dm', 'deathmatch'), - 'as' => array('as'), - 'es' => array('es'), - 'fun' => array('fun'), - 'he' => array('he'), - 'ka' => array('ka'), - 'sp' => array('sp'), - '35hp' => array('35hp') - ) - ); + $aFindMap = array( + 'cs' => array( + 'de' => array('de'), + 'cs' => array('cs'), + 'aim' => array('aim'), + 'awp' => array('awp'), + 'bhop' => array('bhop'), + 'csde' => array('csde'), + 'deathrun' => array('deathrun'), + 'jail' => array('jail', 'jailbreak', 'jb'), + 'zm' => array('zm', 'ze'), + 'fy' => array('fy'), + 'gg' => array('gg'), + 'surf' => array('surf'), + 'dm' => array('dm', 'deathmatch'), + 'as' => array('as'), + 'es' => array('es'), + 'fun' => array('fun'), + 'he' => array('he'), + 'ka' => array('ka'), + 'sp' => array('sp'), + '35hp' => array('35hp') + ) + ); ?> \ No newline at end of file diff --git a/system/data/mysql.php b/system/data/mysql.php index 220679b..c6c6c56 100644 --- a/system/data/mysql.php +++ b/system/data/mysql.php @@ -1,10 +1,10 @@ \ No newline at end of file diff --git a/system/data/params.php b/system/data/params.php index 072bf8d..d119460 100644 --- a/system/data/params.php +++ b/system/data/params.php @@ -1,249 +1,249 @@ array( - 'time' => array( - 'buy' => array( - '15' => '+:30', - '90' => '-:5%', - '180' => '-:7%' - ), + class params + { + // Скидки / Наценки + public static $disconunt = array( + 'service' => array( + 'time' => array( + 'buy' => array( + '15' => '+:30', + '90' => '-:5%', + '180' => '-:7%' + ), - 'extend' => array( - '1' => '+:100%', - '15' => '+:30%', - '90' => '-:5%', - '180' => '-:7%' - ) - ), + 'extend' => array( + '1' => '+:100%', + '15' => '+:30%', + '90' => '-:5%', + '180' => '-:7%' + ) + ), - 9 => array( - 'buy' => array( - '30' => '+:49%' - ), + 9 => array( + 'buy' => array( + '30' => '+:49%' + ), - 'extend' => array( - '1' => '+:50%' - ) - ) - ) - ); + 'extend' => array( + '1' => '+:50%' + ) + ) + ) + ); - // Стандартные порты - public static $aDefPort = array( - 'cs' => 27015, - 'cssold' => 27015, - 'css' => 27015, - 'csgo' => 27015, - 'samp' => 7777, - 'crmp' => 7777, - 'mta' => 22003, - 'mc' => 25565, - ); + // Стандартные порты + public static $aDefPort = array( + 'cs' => 27015, + 'cssold' => 27015, + 'css' => 27015, + 'csgo' => 27015, + 'samp' => 7777, + 'crmp' => 7777, + 'mta' => 22003, + 'mc' => 25565, + ); - // Параметры раздела "Копии" - public static $section_copy = array( - 'cs' => array( - 'CopyFull' => 'cstrike', + // Параметры раздела "Копии" + public static $section_copy = array( + 'cs' => array( + 'CopyFull' => 'cstrike', - 'aCopy' => array( - 'addons' => 'Директория с дополнениями (модули/плагины)', - 'cfg' => 'Файлы настроек (server.cfg/motd.txt/liblist.gam/banned.cfg и т.д.)', - 'dlls' => 'Директория с библиотеками (название.so)', - 'gfx' => 'Директория с изображениями (название.tga)', - 'maps' => 'Директория с картами (название.bsp)', - 'models' => 'Директория с моделями (название.mdl)', - 'sound' => 'Директория со звуками (название.mp3/название.wav)' - ), + 'aCopy' => array( + 'addons' => 'Директория с дополнениями (модули/плагины)', + 'cfg' => 'Файлы настроек (server.cfg/motd.txt/liblist.gam/banned.cfg и т.д.)', + 'dlls' => 'Директория с библиотеками (название.so)', + 'gfx' => 'Директория с изображениями (название.tga)', + 'maps' => 'Директория с картами (название.bsp)', + 'models' => 'Директория с моделями (название.mdl)', + 'sound' => 'Директория со звуками (название.mp3/название.wav)' + ), - 'aCopyDir' => array( - 'addons' => 'cstrike/addons', - 'dlls' => 'cstrike/dlls', - 'gfx' => 'cstrike/gfx', - 'maps' => 'cstrike/maps', - 'models' => 'cstrike/models', - 'sound' => 'cstrike/sound' - ), + 'aCopyDir' => array( + 'addons' => 'cstrike/addons', + 'dlls' => 'cstrike/dlls', + 'gfx' => 'cstrike/gfx', + 'maps' => 'cstrike/maps', + 'models' => 'cstrike/models', + 'sound' => 'cstrike/sound' + ), - 'aCopyFile' => array( - 'cfg' => 'cstrike/server.cfg cstrike/motd.txt cstrike/fastdl.cfg cstrike/liblist.gam cstrike/banned.cfg cstrike/listip.cfg cstrike/reunion.cfg cstrike/mapcycle.txt' - ) - ), + 'aCopyFile' => array( + 'cfg' => 'cstrike/server.cfg cstrike/motd.txt cstrike/fastdl.cfg cstrike/liblist.gam cstrike/banned.cfg cstrike/listip.cfg cstrike/reunion.cfg cstrike/mapcycle.txt' + ) + ), - 'cssold' => array( - 'CopyFull' => 'cstrike', + 'cssold' => array( + 'CopyFull' => 'cstrike', - 'aCopy' => array( - 'addons' => 'Директория с дополнениями (модули/плагины)', - 'cfg' => 'Файлы настроек (server.cfg/motd.txt/banned_user.cfg/banned_ip.cfg и т.д.)', - 'maps' => 'Директория с картами (название.bsp)', - 'models' => 'Директория с моделями (название.mdl)', - 'sound' => 'Директория со звуками (название.mp3/название.wav)' - ), + 'aCopy' => array( + 'addons' => 'Директория с дополнениями (модули/плагины)', + 'cfg' => 'Файлы настроек (server.cfg/motd.txt/banned_user.cfg/banned_ip.cfg и т.д.)', + 'maps' => 'Директория с картами (название.bsp)', + 'models' => 'Директория с моделями (название.mdl)', + 'sound' => 'Директория со звуками (название.mp3/название.wav)' + ), - 'aCopyDir' => array( - 'addons' => 'cstrike/addons', - 'maps' => 'cstrike/maps', - 'models' => 'cstrike/models', - 'sound' => 'cstrike/sound' - ), + 'aCopyDir' => array( + 'addons' => 'cstrike/addons', + 'maps' => 'cstrike/maps', + 'models' => 'cstrike/models', + 'sound' => 'cstrike/sound' + ), - 'aCopyFile' => array( - 'cfg' => 'cstrike/cfg/server.cfg cstrike/motd.txt cstrike/fastdl.cfg cstrike/banned_user.cfg cstrike/banned_ip.cfg cstrike/mapcycle.txt cstrike/maplist.txt' - ) - ), + 'aCopyFile' => array( + 'cfg' => 'cstrike/cfg/server.cfg cstrike/motd.txt cstrike/fastdl.cfg cstrike/banned_user.cfg cstrike/banned_ip.cfg cstrike/mapcycle.txt cstrike/maplist.txt' + ) + ), - 'css' => array( - 'CopyFull' => 'cstrike', + 'css' => array( + 'CopyFull' => 'cstrike', - 'aCopy' => array( - 'addons' => 'Директория с дополнениями (модули/плагины)', - 'cfg' => 'Файлы настроек (server.cfg/motd.txt/banned_user.cfg/banned_ip.cfg и т.д.)', - 'maps' => 'Директория с картами (название.bsp)', - 'models' => 'Директория с моделями (название.mdl)', - 'sound' => 'Директория со звуками (название.mp3/название.wav)' - ), + 'aCopy' => array( + 'addons' => 'Директория с дополнениями (модули/плагины)', + 'cfg' => 'Файлы настроек (server.cfg/motd.txt/banned_user.cfg/banned_ip.cfg и т.д.)', + 'maps' => 'Директория с картами (название.bsp)', + 'models' => 'Директория с моделями (название.mdl)', + 'sound' => 'Директория со звуками (название.mp3/название.wav)' + ), - 'aCopyDir' => array( - 'addons' => 'cstrike/addons', - 'maps' => 'cstrike/maps', - 'models' => 'cstrike/models', - 'sound' => 'cstrike/sound' - ), + 'aCopyDir' => array( + 'addons' => 'cstrike/addons', + 'maps' => 'cstrike/maps', + 'models' => 'cstrike/models', + 'sound' => 'cstrike/sound' + ), - 'aCopyFile' => array( - 'cfg' => 'cstrike/cfg/server.cfg cstrike/motd.txt cstrike/fastdl.cfg cstrike/banned_user.cfg cstrike/banned_ip.cfg cstrike/mapcycle.txt cstrike/maplist.txt' - ) - ), + 'aCopyFile' => array( + 'cfg' => 'cstrike/cfg/server.cfg cstrike/motd.txt cstrike/fastdl.cfg cstrike/banned_user.cfg cstrike/banned_ip.cfg cstrike/mapcycle.txt cstrike/maplist.txt' + ) + ), - 'csgo' => array( - 'CopyFull' => 'csgo', + 'csgo' => array( + 'CopyFull' => 'csgo', - 'aCopy' => array( - 'addons' => 'Директория с дополнениями (модули/плагины)', - 'cfg' => 'Файлы настроек (server.cfg/motd.txt/banned_user.cfg/banned_ip.cfg и т.д.)', - 'maps' => 'Директория с картами (название.bsp)', - 'models' => 'Директория с моделями (название.mdl)', - 'sound' => 'Директория со звуками (название.mp3/название.wav)' - ), + 'aCopy' => array( + 'addons' => 'Директория с дополнениями (модули/плагины)', + 'cfg' => 'Файлы настроек (server.cfg/motd.txt/banned_user.cfg/banned_ip.cfg и т.д.)', + 'maps' => 'Директория с картами (название.bsp)', + 'models' => 'Директория с моделями (название.mdl)', + 'sound' => 'Директория со звуками (название.mp3/название.wav)' + ), - 'aCopyDir' => array( - 'addons' => 'csgo/addons', - 'maps' => 'csgo/maps', - 'models' => 'csgo/models', - 'sound' => 'csgo/sound' - ), + 'aCopyDir' => array( + 'addons' => 'csgo/addons', + 'maps' => 'csgo/maps', + 'models' => 'csgo/models', + 'sound' => 'csgo/sound' + ), - 'aCopyFile' => array( - 'cfg' => 'csgo/cfg/server.cfg csgo/motd.txt csgo/fastdl.cfg csgo/banned_user.cfg csgo/banned_ip.cfg csgo/mapcycle.txt csgo/maplist.txt' - ) - ), + 'aCopyFile' => array( + 'cfg' => 'csgo/cfg/server.cfg csgo/motd.txt csgo/fastdl.cfg csgo/banned_user.cfg csgo/banned_ip.cfg csgo/mapcycle.txt csgo/maplist.txt' + ) + ), - 'samp' => array( - 'CopyFull' => '*', + 'samp' => array( + 'CopyFull' => '*', - 'aCopy' => array( - 'filterscripts' => 'Директория с дополнительными скриптами', - 'cfg' => 'Файл настроек (server.cfg)', - 'gamemodes' => 'Директория с модами', - 'scriptfiles' => 'Директория с скриптами' - ), + 'aCopy' => array( + 'filterscripts' => 'Директория с дополнительными скриптами', + 'cfg' => 'Файл настроек (server.cfg)', + 'gamemodes' => 'Директория с модами', + 'scriptfiles' => 'Директория с скриптами' + ), - 'aCopyDir' => array( - 'filterscripts' => 'filterscripts', - 'gamemodes' => 'gamemodes', - 'scriptfiles' => 'scriptfiles' - ), + 'aCopyDir' => array( + 'filterscripts' => 'filterscripts', + 'gamemodes' => 'gamemodes', + 'scriptfiles' => 'scriptfiles' + ), - 'aCopyFile' => array( - 'cfg' => 'server.cfg' - ) - ), + 'aCopyFile' => array( + 'cfg' => 'server.cfg' + ) + ), - 'crmp' => array( - 'CopyFull' => '*', + 'crmp' => array( + 'CopyFull' => '*', - 'aCopy' => array( - 'filterscripts' => 'Директория с дополнительными скриптами', - 'cfg' => 'Файл настроек (server.cfg)', - 'gamemodes' => 'Директория с модами', - 'scriptfiles' => 'Директория с скриптами' - ), + 'aCopy' => array( + 'filterscripts' => 'Директория с дополнительными скриптами', + 'cfg' => 'Файл настроек (server.cfg)', + 'gamemodes' => 'Директория с модами', + 'scriptfiles' => 'Директория с скриптами' + ), - 'aCopyDir' => array( - 'filterscripts' => 'filterscripts', - 'gamemodes' => 'gamemodes', - 'scriptfiles' => 'scriptfiles' - ), + 'aCopyDir' => array( + 'filterscripts' => 'filterscripts', + 'gamemodes' => 'gamemodes', + 'scriptfiles' => 'scriptfiles' + ), - 'aCopyFile' => array( - 'cfg' => 'server.cfg' - ) - ), + 'aCopyFile' => array( + 'cfg' => 'server.cfg' + ) + ), - 'mta' => array( - 'CopyFull' => '*', + 'mta' => array( + 'CopyFull' => '*', - 'aCopy' => array( - 'databases' => 'Директория баз данных', - 'cfg' => 'Файлы настроек (mtaserver.conf, acl.xml, vehiclecolors.conf и т.д.)', - 'modules ' => 'Директория с модулями', - 'resources' => 'Директория с ресурсами' - ), + 'aCopy' => array( + 'databases' => 'Директория баз данных', + 'cfg' => 'Файлы настроек (mtaserver.conf, acl.xml, vehiclecolors.conf и т.д.)', + 'modules ' => 'Директория с модулями', + 'resources' => 'Директория с ресурсами' + ), - 'aCopyDir' => array( - 'databases' => 'mods/deathmatch/databases', - 'modules' => 'mods/deathmatch/modules', - 'resources' => 'mods/deathmatch/resources' - ), + 'aCopyDir' => array( + 'databases' => 'mods/deathmatch/databases', + 'modules' => 'mods/deathmatch/modules', + 'resources' => 'mods/deathmatch/resources' + ), - 'aCopyFile' => array( - 'cfg' => 'mods/deathmatch/mtaserver.conf mods/deathmatch/acl.xml mods/deathmatch/vehiclecolors.conf mods/deathmatch/settings.xml' - ) - ) - ); + 'aCopyFile' => array( + 'cfg' => 'mods/deathmatch/mtaserver.conf mods/deathmatch/acl.xml mods/deathmatch/vehiclecolors.conf mods/deathmatch/settings.xml' + ) + ) + ); - // Дни в месяцах - public static $aDayMonth = array( - 1 => 31, 2 => 28, 3 => 31, 4 => 30, - 5 => 31, 6 => 30, 7 => 31, 8 => 31, - 9 => 30, 10 => 31, 11 => 30, 12 => 31 - ); + // Дни в месяцах + public static $aDayMonth = array( + 1 => 31, 2 => 28, 3 => 31, 4 => 30, + 5 => 31, 6 => 30, 7 => 31, 8 => 31, + 9 => 30, 10 => 31, 11 => 30, 12 => 31 + ); - // Названия месяцев - public static $aNameMonth = array( - 1 => 'Январь', 2 => 'Февраль', 3 => 'Март', 4 => 'Апрель', - 5 => 'Май', 6 => 'Июнь', 7 => 'Июль', 8 => 'Август', - 9 => 'Сентябрь', 10 => 'Октябрь', 11 => 'Ноябрь', 12 => 'Декабрь' - ); + // Названия месяцев + public static $aNameMonth = array( + 1 => 'Январь', 2 => 'Февраль', 3 => 'Март', 4 => 'Апрель', + 5 => 'Май', 6 => 'Июнь', 7 => 'Июль', 8 => 'Август', + 9 => 'Сентябрь', 10 => 'Октябрь', 11 => 'Ноябрь', 12 => 'Декабрь' + ); - // Директории - public static $aDirGame = array( - 'cs' => 'cstrike', - 'cssold' => 'cstrike', - 'css' => 'cstrike', - 'csgo' => 'csgo', - 'samp' => '', - 'crmp' => '', - 'mta' => '', - 'mc' => '', - ); + // Директории + public static $aDirGame = array( + 'cs' => 'cstrike', + 'cssold' => 'cstrike', + 'css' => 'cstrike', + 'csgo' => 'csgo', + 'samp' => '', + 'crmp' => '', + 'mta' => '', + 'mc' => '', + ); - // Исполняемые файлы - public static $aFileGame = array( - 'cs' => 'hlds_run hlds_linux hlds_i686', - 'cssold' => 'srcds_run srcds_i486 srcds_i686', - 'css' => 'srcds_linux srcds_run', - 'csgo' => 'srcds_linux srcds_run', - 'samp' => 'samp03svr', - 'crmp' => 'samp03svr-cr', - 'mta' => 'mta-server', - 'mc' => 'start.jar' - ); - } + // Исполняемые файлы + public static $aFileGame = array( + 'cs' => 'hlds_run hlds_linux hlds_i686', + 'cssold' => 'srcds_run srcds_i486 srcds_i686', + 'css' => 'srcds_linux srcds_run', + 'csgo' => 'srcds_linux srcds_run', + 'samp' => 'samp03svr', + 'crmp' => 'samp03svr-cr', + 'mta' => 'mta-server', + 'mc' => 'start.jar' + ); + } ?> \ No newline at end of file diff --git a/system/data/scfg/crmp.php b/system/data/scfg/crmp.php index a00972b..fe1f6ca 100644 --- a/system/data/scfg/crmp.php +++ b/system/data/scfg/crmp.php @@ -1,53 +1,53 @@ 'Название игрового сервера.', - 'rcon' => 'Управление RCON командами.', - 'rcon_password' => 'Пароль для упраления сервером через RCON команды.', - 'password' => 'Пароль для входа на сервер.', - 'lanmode' => 'Тип игрового сервера.', - 'gamemode0' => 'Моды на сервере.', - 'filterscripts' => 'Сценарии на сервере.', - 'announce' => 'Отображение сервера в интернете.', - 'weburl' => 'Адрес сайта севера.', - 'maxnpc' => 'Максимальное число NPC подключаемых к серверу.', - 'onfoot_rate' => 'Время в миллисекундах за которое сервер обновляет данные о пешем игроке.', - 'incar_rate' => 'Время в миллисекундах за которое сервер обновляет данные о игроке находящемся в транспорте.', - 'weapon_rate' => 'Время в миллисекундах за которое сервер обновляет данные о стрельбе игрока.', - 'stream_distance' => 'Дистанция для обновления стримера игроков.', - 'stream_rate' => 'Время в миллисекундах за которое сервер обновляет игроков в стримере.', - 'logqueries' => 'Логирование всех запросов.' - ); + $aScfg = array( + 'hostname' => 'Название игрового сервера.', + 'rcon' => 'Управление RCON командами.', + 'rcon_password' => 'Пароль для упраления сервером через RCON команды.', + 'password' => 'Пароль для входа на сервер.', + 'lanmode' => 'Тип игрового сервера.', + 'gamemode0' => 'Моды на сервере.', + 'filterscripts' => 'Сценарии на сервере.', + 'announce' => 'Отображение сервера в интернете.', + 'weburl' => 'Адрес сайта севера.', + 'maxnpc' => 'Максимальное число NPC подключаемых к серверу.', + 'onfoot_rate' => 'Время в миллисекундах за которое сервер обновляет данные о пешем игроке.', + 'incar_rate' => 'Время в миллисекундах за которое сервер обновляет данные о игроке находящемся в транспорте.', + 'weapon_rate' => 'Время в миллисекундах за которое сервер обновляет данные о стрельбе игрока.', + 'stream_distance' => 'Дистанция для обновления стримера игроков.', + 'stream_rate' => 'Время в миллисекундах за которое сервер обновляет игроков в стримере.', + 'logqueries' => 'Логирование всех запросов.' + ); - $aScfg_form = array( - 'hostname' => '', - 'rcon_password' => '', - 'password' => '', - 'gamemode0' => '', - 'filterscripts' => '', - 'maxnpc' => '', - 'onfoot_rate' => '', - 'incar_rate' => '', - 'weapon_rate' => '', - 'stream_distance' => '', - 'stream_rate' => '', - 'lagcompmode' => '', - 'rcon' => '', - 'announce' => '', - 'logqueries' => '', - 'lanmode' => '' - ); + $aScfg_form = array( + 'hostname' => '', + 'rcon_password' => '', + 'password' => '', + 'gamemode0' => '', + 'filterscripts' => '', + 'maxnpc' => '', + 'onfoot_rate' => '', + 'incar_rate' => '', + 'weapon_rate' => '', + 'stream_distance' => '', + 'stream_rate' => '', + 'lagcompmode' => '', + 'rcon' => '', + 'announce' => '', + 'logqueries' => '', + 'lanmode' => '' + ); ?> \ No newline at end of file diff --git a/system/data/scfg/cs.php b/system/data/scfg/cs.php index 8754229..35b29a2 100644 --- a/system/data/scfg/cs.php +++ b/system/data/scfg/cs.php @@ -1,104 +1,104 @@ 'Название игрового сервера.', - 'rcon_password' => 'Пароль для упраления сервером через RCON команды.', - 'sv_password' => 'Пароль для входа на сервер.', - 'decalfrequency' => 'Установить как часто игрок может рисовать свою эмблему. Значения выставляются в секундах.', - 'allow_spectators' => 'Максимальное количество наблюдателей на сервере. Поставтьте 0, что бы выключить.', - 'mp_autokick' => 'Включает автоматический бан для тимкиллеров и кикает подвисших игроков.', - 'mp_autoteambalance' => 'Автобаланс игроков.', - 'mp_chattime' => 'Количество секунд на которое сервер позволяет игрокам писать в общий чат после конца карты и до загрузки новой.', - 'mp_decals' => 'Определяет количество декалов на сервере (напр кол-во дырок от пуль на стенах сохраняемых сервером).', - 'mp_fadetoblack' => 'Погибшие игроки не могут наблюдать за игрой (черный экран).', - 'mp_flashlight' => 'Разрешить использовать фонарик.', - 'mp_footsteps' => 'Разрешить игрокам слышать звук шагов.', - 'mp_forcecamera' => 'Задает также параметры наблюдения.', - 'mp_forcechasecam' => 'Команда задает режим наблюдения за игроками.', - 'mp_fraglimit' => 'Лимит убийств игрока до смены карты. 0 - Отключено.', - 'mp_freezetime' => 'Время заморозки игроков перед началом раунда. 0 - Отключено.', - 'mp_friendlyfire' => 'Нанесение повреждений игрокам своей команды.', - 'mp_hostagepenalty' => 'Устанавливает количество заложников, которых можно убить, прежде чем вас выкинет с сервера. 0 - Отключено.', - 'mp_limitteams' => 'Число игроков, на которое одна команда может превышать другую. Лишних игроков не будет пускать в команду. 0 - Отключено.', - 'mp_maxrounds' => 'Максимальное количество раундов, которые могут быть сыграны на карте до ее смены.', - 'mp_playerid' => 'Всплывающие подсказки при наведении прицела на игрока.', - 'mp_roundtime' => 'Время раунда. Измеряется в минутах.', - 'mp_startmoney' => 'Количество денег у игрока в первом раунде.', - 'mp_timelimit' => 'Время, отведенное на одну карту. Измеряется в минутах. Значение 0 - отключение лимита времени.', - 'mp_tkpunish' => 'В начале нового раунда убивает игрока, который в предыдущем убил игрока своей команды.', - 'mp_winlimit' => 'Ограничение по победам на карту.', - 'sv_allowdownload' => 'Возможность скачивать с сервера файлы.', - 'sv_allowupload' => 'Возможность закачивать на сервер файлы. Например спрэи.', - 'sv_alltalk' => 'Режим работы общего голосового чата. При включении все игроки будут слышать друг друга независимо от команды, в которой они играют.', - 'sv_gravity' => 'Гравитация на сервере. По умолчанию 800.', - 'sv_maxspeed' => 'Максимальная скорость передвижения игроков на сервере. По умолчанию 320.', - 'sv_maxunlag' => 'Максимальная лаго компенсация в секунду.', - 'pausable' => 'Возможность использования паузы во время игры.', - 'sv_voiceenable' => 'Возможность использовать микрофон в игре.', - 'mp_c4timer' => 'Время таймера до взрыва бомбы с момента ее установки. Измеряется в секундах.', - 'mp_consistency' => 'Проверка соответствия файлов сервера и клиента.', - 'mp_buytime' => 'Время для закупки оружия в начале раунда. Значение выставляется в минутах.', - 'sv_contact' => 'Контакты админа.', - 'sv_rcon_banpenalty' => 'Колличество минут на которое банится игрок пытавшийся подобрать rcon-пароль к серверу.', - 'sv_rcon_maxfailures' => 'Максимальное колличество попыток при наборе rcon-пароля, после истечения которых игрок будет забанен.', - 'sv_rcon_minfailures' => 'Колличество попыток при наборе rcon-пароля во время заданное sv_rcon_minfailuretime, после истечения которых игрок будет забанен.', - 'sv_rcon_minfailuretime' => 'Колличество секунд для определения неверной rcon-аутенфикации.', - 'sv_maxrate' => 'Максимально-допустимый предел передачи/приёма байт в секунду между клиентом и сервером.', - 'sv_maxupdaterate' => 'Максимальное количество переданных пакетов в секунду.', - 'sv_minrate' => 'Минимально допустимый предел передачи/приёма байт в секунду между клиентом и сервером.', - 'sv_minupdaterate' => 'Минимальное количество переданных пакетов в секунду.', - 'mp_mapvoteratio' => 'Процент голосование за следующую карту, командой votemap.' - ); + $aScfg = array( + 'hostname' => 'Название игрового сервера.', + 'rcon_password' => 'Пароль для упраления сервером через RCON команды.', + 'sv_password' => 'Пароль для входа на сервер.', + 'decalfrequency' => 'Установить как часто игрок может рисовать свою эмблему. Значения выставляются в секундах.', + 'allow_spectators' => 'Максимальное количество наблюдателей на сервере. Поставтьте 0, что бы выключить.', + 'mp_autokick' => 'Включает автоматический бан для тимкиллеров и кикает подвисших игроков.', + 'mp_autoteambalance' => 'Автобаланс игроков.', + 'mp_chattime' => 'Количество секунд на которое сервер позволяет игрокам писать в общий чат после конца карты и до загрузки новой.', + 'mp_decals' => 'Определяет количество декалов на сервере (напр кол-во дырок от пуль на стенах сохраняемых сервером).', + 'mp_fadetoblack' => 'Погибшие игроки не могут наблюдать за игрой (черный экран).', + 'mp_flashlight' => 'Разрешить использовать фонарик.', + 'mp_footsteps' => 'Разрешить игрокам слышать звук шагов.', + 'mp_forcecamera' => 'Задает также параметры наблюдения.', + 'mp_forcechasecam' => 'Команда задает режим наблюдения за игроками.', + 'mp_fraglimit' => 'Лимит убийств игрока до смены карты. 0 - Отключено.', + 'mp_freezetime' => 'Время заморозки игроков перед началом раунда. 0 - Отключено.', + 'mp_friendlyfire' => 'Нанесение повреждений игрокам своей команды.', + 'mp_hostagepenalty' => 'Устанавливает количество заложников, которых можно убить, прежде чем вас выкинет с сервера. 0 - Отключено.', + 'mp_limitteams' => 'Число игроков, на которое одна команда может превышать другую. Лишних игроков не будет пускать в команду. 0 - Отключено.', + 'mp_maxrounds' => 'Максимальное количество раундов, которые могут быть сыграны на карте до ее смены.', + 'mp_playerid' => 'Всплывающие подсказки при наведении прицела на игрока.', + 'mp_roundtime' => 'Время раунда. Измеряется в минутах.', + 'mp_startmoney' => 'Количество денег у игрока в первом раунде.', + 'mp_timelimit' => 'Время, отведенное на одну карту. Измеряется в минутах. Значение 0 - отключение лимита времени.', + 'mp_tkpunish' => 'В начале нового раунда убивает игрока, который в предыдущем убил игрока своей команды.', + 'mp_winlimit' => 'Ограничение по победам на карту.', + 'sv_allowdownload' => 'Возможность скачивать с сервера файлы.', + 'sv_allowupload' => 'Возможность закачивать на сервер файлы. Например спрэи.', + 'sv_alltalk' => 'Режим работы общего голосового чата. При включении все игроки будут слышать друг друга независимо от команды, в которой они играют.', + 'sv_gravity' => 'Гравитация на сервере. По умолчанию 800.', + 'sv_maxspeed' => 'Максимальная скорость передвижения игроков на сервере. По умолчанию 320.', + 'sv_maxunlag' => 'Максимальная лаго компенсация в секунду.', + 'pausable' => 'Возможность использования паузы во время игры.', + 'sv_voiceenable' => 'Возможность использовать микрофон в игре.', + 'mp_c4timer' => 'Время таймера до взрыва бомбы с момента ее установки. Измеряется в секундах.', + 'mp_consistency' => 'Проверка соответствия файлов сервера и клиента.', + 'mp_buytime' => 'Время для закупки оружия в начале раунда. Значение выставляется в минутах.', + 'sv_contact' => 'Контакты админа.', + 'sv_rcon_banpenalty' => 'Колличество минут на которое банится игрок пытавшийся подобрать rcon-пароль к серверу.', + 'sv_rcon_maxfailures' => 'Максимальное колличество попыток при наборе rcon-пароля, после истечения которых игрок будет забанен.', + 'sv_rcon_minfailures' => 'Колличество попыток при наборе rcon-пароля во время заданное sv_rcon_minfailuretime, после истечения которых игрок будет забанен.', + 'sv_rcon_minfailuretime' => 'Колличество секунд для определения неверной rcon-аутенфикации.', + 'sv_maxrate' => 'Максимально-допустимый предел передачи/приёма байт в секунду между клиентом и сервером.', + 'sv_maxupdaterate' => 'Максимальное количество переданных пакетов в секунду.', + 'sv_minrate' => 'Минимально допустимый предел передачи/приёма байт в секунду между клиентом и сервером.', + 'sv_minupdaterate' => 'Минимальное количество переданных пакетов в секунду.', + 'mp_mapvoteratio' => 'Процент голосование за следующую карту, командой votemap.' + ); - $aScfg_form = array( - 'hostname' => '', - 'rcon_password' => '', - 'sv_password' => '', - 'decalfrequency' => '', - 'allow_spectators' => '', - 'mp_autokick' => '', - 'mp_autoteambalance' => '', - 'mp_chattime' => '', - 'mp_decals' => '', - 'mp_fadetoblack' => '', - 'mp_flashlight' => '', - 'mp_footsteps' => '', - 'mp_forcecamera' => '', - 'mp_fraglimit' => '', - 'mp_freezetime' => '', - 'mp_friendlyfire' => '', - 'mp_hostagepenalty' => '', - 'mp_limitteams' => '', - 'mp_maxrounds' => '', - 'mp_playerid' => '', - 'mp_roundtime' => '', - 'mp_startmoney' => '', - 'mp_timelimit' => '', - 'mp_tkpunish' => '', - 'mp_winlimit' => '', - 'sv_allowdownload' => '', - 'sv_allowupload' => '', - 'sv_alltalk' => '', - 'sv_gravity' => '', - 'sv_maxspeed' => '', - 'sv_maxunlag' => '', - 'pausable' => '', - 'sv_voiceenable' => '', - 'mp_c4timer' => '', - 'mp_consistency' => '', - 'mp_buytime' => '', - 'sv_contact' => '', - 'sv_rcon_banpenalty' => '', - 'sv_rcon_maxfailures' => '', - 'sv_rcon_minfailures' => '', - 'sv_rcon_minfailuretime' => '', - 'sv_maxrate' => '', - 'sv_maxupdaterate' => '', - 'sv_minrate' => '', - 'sv_minupdaterate' => '', - 'mp_mapvoteratio' => '', - 'mp_forcechasecam' => '' - ); + $aScfg_form = array( + 'hostname' => '', + 'rcon_password' => '', + 'sv_password' => '', + 'decalfrequency' => '', + 'allow_spectators' => '', + 'mp_autokick' => '', + 'mp_autoteambalance' => '', + 'mp_chattime' => '', + 'mp_decals' => '', + 'mp_fadetoblack' => '', + 'mp_flashlight' => '', + 'mp_footsteps' => '', + 'mp_forcecamera' => '', + 'mp_fraglimit' => '', + 'mp_freezetime' => '', + 'mp_friendlyfire' => '', + 'mp_hostagepenalty' => '', + 'mp_limitteams' => '', + 'mp_maxrounds' => '', + 'mp_playerid' => '', + 'mp_roundtime' => '', + 'mp_startmoney' => '', + 'mp_timelimit' => '', + 'mp_tkpunish' => '', + 'mp_winlimit' => '', + 'sv_allowdownload' => '', + 'sv_allowupload' => '', + 'sv_alltalk' => '', + 'sv_gravity' => '', + 'sv_maxspeed' => '', + 'sv_maxunlag' => '', + 'pausable' => '', + 'sv_voiceenable' => '', + 'mp_c4timer' => '', + 'mp_consistency' => '', + 'mp_buytime' => '', + 'sv_contact' => '', + 'sv_rcon_banpenalty' => '', + 'sv_rcon_maxfailures' => '', + 'sv_rcon_minfailures' => '', + 'sv_rcon_minfailuretime' => '', + 'sv_maxrate' => '', + 'sv_maxupdaterate' => '', + 'sv_minrate' => '', + 'sv_minupdaterate' => '', + 'mp_mapvoteratio' => '', + 'mp_forcechasecam' => '' + ); ?> \ No newline at end of file diff --git a/system/data/scfg/csgo.php b/system/data/scfg/csgo.php index 74a59cf..94c543c 100644 --- a/system/data/scfg/csgo.php +++ b/system/data/scfg/csgo.php @@ -1,46 +1,46 @@ 'Название игрового сервера.', - 'rcon_password' => 'Пароль для упраления сервером через RCON команды.', - 'sv_password' => 'Пароль для входа на сервер.', - 'sv_pure' => 'Режим проверки соответствия файлов моделей на клиенте.', - 'host_name_store' => 'Передача названия сервера в GOTV.', - 'host_info_show' => 'Передача информации о сервере.', - 'host_players_show' => 'Передача информации о игроках на сервере.', - 'sv_steamgroup' => 'Группа в steam сервера.', - 'sv_downloadurl' => 'Место, из которого клиенты могут скачать недостающие файлы.
    Использовать, если не включен FastDL.', - 'mapgroup' => 'Набор карт на сервере.', - 'sv_hibernate_when_empty' => 'Через сколько секунд переводить сервер в спящий режим.
    0 = Cпящий режим выключен.', - 'sv_setsteamaccount' => 'Токен для игрового сервера (без него на сервер не смогут зайти игроки).' - ); + $aScfg = array( + 'hostname' => 'Название игрового сервера.', + 'rcon_password' => 'Пароль для упраления сервером через RCON команды.', + 'sv_password' => 'Пароль для входа на сервер.', + 'sv_pure' => 'Режим проверки соответствия файлов моделей на клиенте.', + 'host_name_store' => 'Передача названия сервера в GOTV.', + 'host_info_show' => 'Передача информации о сервере.', + 'host_players_show' => 'Передача информации о игроках на сервере.', + 'sv_steamgroup' => 'Группа в steam сервера.', + 'sv_downloadurl' => 'Место, из которого клиенты могут скачать недостающие файлы.
    Использовать, если не включен FastDL.', + 'mapgroup' => 'Набор карт на сервере.', + 'sv_hibernate_when_empty' => 'Через сколько секунд переводить сервер в спящий режим.
    0 = Cпящий режим выключен.', + 'sv_setsteamaccount' => 'Токен для игрового сервера (без него на сервер не смогут зайти игроки).' + ); - $aScfg_form = array( - 'hostname' => '', - 'rcon_password' => '', - 'sv_password' => '', - 'sv_pure' => '', - 'host_name_store' => '', - 'host_info_show' => '', - 'host_players_show' => '', - 'sv_steamgroup' => '', - 'sv_downloadurl' => '', - 'mapgroup' => '', - 'sv_hibernate_when_empty' => '', - 'sv_setsteamaccount' => '' - ); + $aScfg_form = array( + 'hostname' => '', + 'rcon_password' => '', + 'sv_password' => '', + 'sv_pure' => '', + 'host_name_store' => '', + 'host_info_show' => '', + 'host_players_show' => '', + 'sv_steamgroup' => '', + 'sv_downloadurl' => '', + 'mapgroup' => '', + 'sv_hibernate_when_empty' => '', + 'sv_setsteamaccount' => '' + ); ?> \ No newline at end of file diff --git a/system/data/scfg/css.php b/system/data/scfg/css.php index 094dab2..8df9888 100644 --- a/system/data/scfg/css.php +++ b/system/data/scfg/css.php @@ -1,152 +1,152 @@ 'Название игрового сервера.', - 'rcon_password' => 'Пароль для управления сервером через RCON команды.', - 'sv_password' => 'Пароль доступа на сервер.', - 'mp_allowspectators' => 'Присутствие в игре спектаторов.', - 'mp_autoteambalance' => 'Выравнивание количества играющих в командах.', - 'mp_chattime' => 'Время перед сменой карты после победы одной из команд. Измеряется в секундах.', - 'mp_decals' => 'Определяет количество декалов на сервере (например кол-во дырок от пуль на стенах сохраняемых сервером)', - 'mp_fadetoblack' => 'Мертвые игроки не могут наблюдать за игрой (черный экран)', - 'mp_falldamage' => 'Режим реалистичных повреждений при падениях с крыш и т.п.', - 'mp_flashlight' => 'Разрешить использовать фонарик.', - 'mp_footsteps' => 'Разрешить игрокам слышать звук шагов.', - 'mp_forcecamera' => 'Отключает режим свободного обзора для мертвых игроков.', - 'mp_forcerespawn' => 'Режим автоматического подключения игроков за команду.', - 'mp_fraglimit' => 'Лимит убийств игрока до смены карты. 0 - Отключено.', - 'mp_freezetime' => 'Время закупки перед началом раунда. (Заморозка игроков на одном месте).', - 'mp_friendlyfire' => 'Нанесение повреждений игрокам своей команды.', - 'mp_hostagepenalty' => 'Устанавливает количество заложников, которых можно убить, прежде чем вас выкинет с сервера. 0 - Отключено.', - 'mp_limitteams' => 'Число игроков, на которое одна команда может превышать другую. Лишних игроков не будет пускать в команду. 0 - Отключено.', - 'mp_maxrounds' => 'Максимальное количество раундов, которые могут быть сыграны на карте до ее смены.', - 'mp_playerid' => 'Всплывающие подсказки при наведении прицела на игрока.', - 'mp_roundtime' => 'Время раунда. Измеряется в минутах.', - 'mp_spawnprotectiontime' => 'Время защиты игрока после респавна. Измеряется в секундах.', - 'mp_startmoney' => 'Количество денег у игрока в первом раунде.', - 'mp_timelimit' => 'Время, отведенное на одну карту. Измеряется в минутах. Значение 0 - отключение лимита времени. 0 = Отключено.', - 'mp_tkpunish' => 'В начале нового раунда убивает игрока, который в предыдущем убил игрока своей команды.', - 'mp_weaponstay' => 'Упавшее с игроков оружие остается лежать на земле.', - 'mp_winlimit' => 'Ограничение по победам на карту.', - 'sv_airaccelerate' => 'Ускорение игрока в полете. Опцию имеет смысл изменять только для Surf сервера.', - 'sv_allowdownload' => 'Возможность скачивать с сервера файлы.', - 'sv_allowupload' => 'Возможность закачивать на сервер файлы. Например эмблемы.', - 'sv_alltalk' => 'Режим работы общего голосового чата. При включении все игроки будут слышать друг друга независимо от команды, в которой они играют.', - 'sv_gravity' => 'Гравитация на сервере. По умолчанию 800.', - 'sv_pausable' => 'Возможность использования паузы во время игры.', - 'sv_voiceenable' => 'Режим работы голосового чата в игре.', - 'sv_downloadurl' => 'Место, из которого клиенты могут загрузить недостающие файлы.', - 'mp_c4timer' => 'Время таймера до взрыва бомбы с момента ее установки. Измеряется в секундах.', - 'sv_timeout' => 'Таймаут подключения при потери связи.', - 'sv_pure' => 'Проверка соответствия файлов сервера и клиента.', - 'sv_pushaway_force' => 'Сила отталкивания предметов.', - 'sv_turbophysics' => 'Позволяет толкать предметы при нажатии на кнопку "E"', - 'mp_buytime' => 'Время для закупки оружия в начале раунда. Значение выставляется в минутах.', - 'net_maxfilesize' => 'Максимальный размер загружаемого файла в MB.', - 'sv_contact' => 'Контакты админа игрового сервера.', - 'sm_deadtalk' => 'Голосовое общение мертвых игроков.', - 'sv_nostats' => 'Статистика и получение достижений (achievements) на сервере.', - 'sv_nomvp' => 'MVP (самый результативный игрок).', - 'sv_nonemesis' => 'Cистема доминирования и реванша на сервере.', - 'sv_disablefreezecam' => 'Заморозка камеры при убийстве.', - 'sv_rcon_banpenalty' => 'Колличество минут на которое банится игрок пытавшийся подобрать rcon-пароль к серверу.', - 'sv_rcon_maxfailures' => 'Максимальное колличество попыток при наборе rcon-пароля, после истечения которых игрок будет забанен.', - 'sv_rcon_minfailures' => 'Колличество попыток при наборе rcon-пароля во время заданное sv_rcon_minfailuretime, после истечения которых игрок будет забанен.', - 'sv_rcon_minfailuretime' => 'Колличество секунд для определения неверной rcon-аутенфикации.', - 'sv_maxrate' => 'Максимально-допустимый предел передачи/приёма байт в секунду между клиентом и сервером.', - 'sv_mincmdrate' => 'Минимальное количество пакетов в секунду к серверу.', - 'sv_minrate' => 'Минимально допустимый предел передачи/приёма байт в секунду между клиентом и сервером.', - 'sv_maxcmdrate' => 'Максимальное количество пакетов в секунду к серверу.', - 'sv_minupdaterate' => 'Минимальное количество переданных пакетов в секунду.', - 'sv_client_cmdrate_difference' => '-', - 'sv_maxupdaterate' => 'Максимальное количество переданных пакетов в секунду.', - 'sv_steamgroup' => 'Номер группы Steam для отображения Вашего сервера в списке серверов у игроков Группы в главном меню игры.', - 'sv_tags' => 'Отображается справа в браузере поиска серверов.', - 'sv_enablebunnyhopping' => 'Распрыжка (Bhop)', - 'mp_ignore_round_win_conditions' => 'Бесконечный раунд на сервере.', - 'sv_maxspeed' => 'Максимальная скорость передвижения игроков на сервере. По умолчанию 320', - 'mp_disable_respawn_times' => 'Время респауна обоих команда, в секундах.', - 'sv_ignoregrenaderadio' => 'Радио-уведомление "Fire In Hole!" При броске гранаты.', - 'sv_hudhint_sound' => 'Озвучивать окошко подсказок.', - 'phys_timescale' => 'Коэффициент шкалы времени для вычисления "физики" в игре. Если по тарифу тикрейт 100, то нужно выставить значение 1.5.', - 'sv_use_steam_voice' => 'Использовать голосовой кодек Steam.', - 'sv_allow_voice_from_file' => 'Разрешить игрокам использовать voice_inputfromfile на сервере.' - ); + $aScfg = array( + 'hostname' => 'Название игрового сервера.', + 'rcon_password' => 'Пароль для управления сервером через RCON команды.', + 'sv_password' => 'Пароль доступа на сервер.', + 'mp_allowspectators' => 'Присутствие в игре спектаторов.', + 'mp_autoteambalance' => 'Выравнивание количества играющих в командах.', + 'mp_chattime' => 'Время перед сменой карты после победы одной из команд. Измеряется в секундах.', + 'mp_decals' => 'Определяет количество декалов на сервере (например кол-во дырок от пуль на стенах сохраняемых сервером)', + 'mp_fadetoblack' => 'Мертвые игроки не могут наблюдать за игрой (черный экран)', + 'mp_falldamage' => 'Режим реалистичных повреждений при падениях с крыш и т.п.', + 'mp_flashlight' => 'Разрешить использовать фонарик.', + 'mp_footsteps' => 'Разрешить игрокам слышать звук шагов.', + 'mp_forcecamera' => 'Отключает режим свободного обзора для мертвых игроков.', + 'mp_forcerespawn' => 'Режим автоматического подключения игроков за команду.', + 'mp_fraglimit' => 'Лимит убийств игрока до смены карты. 0 - Отключено.', + 'mp_freezetime' => 'Время закупки перед началом раунда. (Заморозка игроков на одном месте).', + 'mp_friendlyfire' => 'Нанесение повреждений игрокам своей команды.', + 'mp_hostagepenalty' => 'Устанавливает количество заложников, которых можно убить, прежде чем вас выкинет с сервера. 0 - Отключено.', + 'mp_limitteams' => 'Число игроков, на которое одна команда может превышать другую. Лишних игроков не будет пускать в команду. 0 - Отключено.', + 'mp_maxrounds' => 'Максимальное количество раундов, которые могут быть сыграны на карте до ее смены.', + 'mp_playerid' => 'Всплывающие подсказки при наведении прицела на игрока.', + 'mp_roundtime' => 'Время раунда. Измеряется в минутах.', + 'mp_spawnprotectiontime' => 'Время защиты игрока после респавна. Измеряется в секундах.', + 'mp_startmoney' => 'Количество денег у игрока в первом раунде.', + 'mp_timelimit' => 'Время, отведенное на одну карту. Измеряется в минутах. Значение 0 - отключение лимита времени. 0 = Отключено.', + 'mp_tkpunish' => 'В начале нового раунда убивает игрока, который в предыдущем убил игрока своей команды.', + 'mp_weaponstay' => 'Упавшее с игроков оружие остается лежать на земле.', + 'mp_winlimit' => 'Ограничение по победам на карту.', + 'sv_airaccelerate' => 'Ускорение игрока в полете. Опцию имеет смысл изменять только для Surf сервера.', + 'sv_allowdownload' => 'Возможность скачивать с сервера файлы.', + 'sv_allowupload' => 'Возможность закачивать на сервер файлы. Например эмблемы.', + 'sv_alltalk' => 'Режим работы общего голосового чата. При включении все игроки будут слышать друг друга независимо от команды, в которой они играют.', + 'sv_gravity' => 'Гравитация на сервере. По умолчанию 800.', + 'sv_pausable' => 'Возможность использования паузы во время игры.', + 'sv_voiceenable' => 'Режим работы голосового чата в игре.', + 'sv_downloadurl' => 'Место, из которого клиенты могут загрузить недостающие файлы.', + 'mp_c4timer' => 'Время таймера до взрыва бомбы с момента ее установки. Измеряется в секундах.', + 'sv_timeout' => 'Таймаут подключения при потери связи.', + 'sv_pure' => 'Проверка соответствия файлов сервера и клиента.', + 'sv_pushaway_force' => 'Сила отталкивания предметов.', + 'sv_turbophysics' => 'Позволяет толкать предметы при нажатии на кнопку "E"', + 'mp_buytime' => 'Время для закупки оружия в начале раунда. Значение выставляется в минутах.', + 'net_maxfilesize' => 'Максимальный размер загружаемого файла в MB.', + 'sv_contact' => 'Контакты админа игрового сервера.', + 'sm_deadtalk' => 'Голосовое общение мертвых игроков.', + 'sv_nostats' => 'Статистика и получение достижений (achievements) на сервере.', + 'sv_nomvp' => 'MVP (самый результативный игрок).', + 'sv_nonemesis' => 'Cистема доминирования и реванша на сервере.', + 'sv_disablefreezecam' => 'Заморозка камеры при убийстве.', + 'sv_rcon_banpenalty' => 'Колличество минут на которое банится игрок пытавшийся подобрать rcon-пароль к серверу.', + 'sv_rcon_maxfailures' => 'Максимальное колличество попыток при наборе rcon-пароля, после истечения которых игрок будет забанен.', + 'sv_rcon_minfailures' => 'Колличество попыток при наборе rcon-пароля во время заданное sv_rcon_minfailuretime, после истечения которых игрок будет забанен.', + 'sv_rcon_minfailuretime' => 'Колличество секунд для определения неверной rcon-аутенфикации.', + 'sv_maxrate' => 'Максимально-допустимый предел передачи/приёма байт в секунду между клиентом и сервером.', + 'sv_mincmdrate' => 'Минимальное количество пакетов в секунду к серверу.', + 'sv_minrate' => 'Минимально допустимый предел передачи/приёма байт в секунду между клиентом и сервером.', + 'sv_maxcmdrate' => 'Максимальное количество пакетов в секунду к серверу.', + 'sv_minupdaterate' => 'Минимальное количество переданных пакетов в секунду.', + 'sv_client_cmdrate_difference' => '-', + 'sv_maxupdaterate' => 'Максимальное количество переданных пакетов в секунду.', + 'sv_steamgroup' => 'Номер группы Steam для отображения Вашего сервера в списке серверов у игроков Группы в главном меню игры.', + 'sv_tags' => 'Отображается справа в браузере поиска серверов.', + 'sv_enablebunnyhopping' => 'Распрыжка (Bhop)', + 'mp_ignore_round_win_conditions' => 'Бесконечный раунд на сервере.', + 'sv_maxspeed' => 'Максимальная скорость передвижения игроков на сервере. По умолчанию 320', + 'mp_disable_respawn_times' => 'Время респауна обоих команда, в секундах.', + 'sv_ignoregrenaderadio' => 'Радио-уведомление "Fire In Hole!" При броске гранаты.', + 'sv_hudhint_sound' => 'Озвучивать окошко подсказок.', + 'phys_timescale' => 'Коэффициент шкалы времени для вычисления "физики" в игре. Если по тарифу тикрейт 100, то нужно выставить значение 1.5.', + 'sv_use_steam_voice' => 'Использовать голосовой кодек Steam.', + 'sv_allow_voice_from_file' => 'Разрешить игрокам использовать voice_inputfromfile на сервере.' + ); - $aScfg_form = array( - 'hostname' => '', - 'rcon_password' => '', - 'sv_password' => '', - 'mp_allowspectators' => '', - 'sv_allow_voice_from_file' => '', - 'mp_playerid' => '', - 'mp_autokick' => '', - 'sv_pure' => '', - 'sm_deadtalk' => '', - 'mp_autoteambalance' => '', - 'mp_fadetoblack' => '', - 'mp_falldamage' => '', - 'mp_flashlight' => '', - 'mp_footsteps' => '', - 'mp_forcecamera' => '', - 'mp_forcerespawn' => '', - 'mp_friendlyfire' => '', - 'mp_tkpunish' => '', - 'mp_weaponstay' => '', - 'sv_allowdownload' => '', - 'sv_allowupload' => '', - 'sv_alltalk' => '', - 'sv_pausable' => '', - 'sv_voiceenable' => '', - 'sv_turbophysics' => '', - 'sv_nostats' => '', - 'sv_nomvp' => '', - 'sv_nonemesis' => '', - 'sv_enablebunnyhopping' => '', - 'mp_ignore_round_win_conditions' => '', - 'sv_use_steam_voice' => '', - 'sv_disablefreezecam' => '', - 'sv_ignoregrenaderadio' => '', - 'sv_hudhint_sound' => '', - 'mp_chattime' => '', - 'mp_decals' => '', - 'mp_fraglimit' => '', - 'mp_freezetime' => '', - 'mp_hostagepenalty' => '', - 'mp_limitteams' => '', - 'mp_maxrounds' => '', - 'mp_roundtime' => '', - 'mp_spawnprotectiontime' => '', - 'mp_startmoney' => '', - 'mp_timelimit' => '', - 'mp_winlimit' => '', - 'sv_airaccelerate' => '', - 'sv_gravity' => '', - 'sv_downloadurl' => '', - 'mp_c4timer' => '', - 'sv_timeout' => '', - 'sv_pushaway_force' => '', - 'mp_buytime' => '', - 'net_maxfilesize' => '', - 'sv_contact' => '', - 'sv_rcon_banpenalty' => '', - 'sv_rcon_maxfailures' => '', - 'sv_rcon_minfailures' => '', - 'sv_rcon_minfailuretime' => '', - 'sv_maxrate' => '', - 'sv_mincmdrate' => '', - 'sv_minrate' => '', - 'sv_minupdaterate' => '', - 'sv_client_cmdrate_difference' => '', - 'sv_maxupdaterate' => '', - 'sv_steamgroup' => '', - 'sv_tags' => '', - 'sv_maxspeed' => '', - 'mp_disable_respawn_times' => '', - 'phys_timescale' => '', - 'sv_maxcmdrate' => '' + $aScfg_form = array( + 'hostname' => '', + 'rcon_password' => '', + 'sv_password' => '', + 'mp_allowspectators' => '', + 'sv_allow_voice_from_file' => '', + 'mp_playerid' => '', + 'mp_autokick' => '', + 'sv_pure' => '', + 'sm_deadtalk' => '', + 'mp_autoteambalance' => '', + 'mp_fadetoblack' => '', + 'mp_falldamage' => '', + 'mp_flashlight' => '', + 'mp_footsteps' => '', + 'mp_forcecamera' => '', + 'mp_forcerespawn' => '', + 'mp_friendlyfire' => '', + 'mp_tkpunish' => '', + 'mp_weaponstay' => '', + 'sv_allowdownload' => '', + 'sv_allowupload' => '', + 'sv_alltalk' => '', + 'sv_pausable' => '', + 'sv_voiceenable' => '', + 'sv_turbophysics' => '', + 'sv_nostats' => '', + 'sv_nomvp' => '', + 'sv_nonemesis' => '', + 'sv_enablebunnyhopping' => '', + 'mp_ignore_round_win_conditions' => '', + 'sv_use_steam_voice' => '', + 'sv_disablefreezecam' => '', + 'sv_ignoregrenaderadio' => '', + 'sv_hudhint_sound' => '', + 'mp_chattime' => '', + 'mp_decals' => '', + 'mp_fraglimit' => '', + 'mp_freezetime' => '', + 'mp_hostagepenalty' => '', + 'mp_limitteams' => '', + 'mp_maxrounds' => '', + 'mp_roundtime' => '', + 'mp_spawnprotectiontime' => '', + 'mp_startmoney' => '', + 'mp_timelimit' => '', + 'mp_winlimit' => '', + 'sv_airaccelerate' => '', + 'sv_gravity' => '', + 'sv_downloadurl' => '', + 'mp_c4timer' => '', + 'sv_timeout' => '', + 'sv_pushaway_force' => '', + 'mp_buytime' => '', + 'net_maxfilesize' => '', + 'sv_contact' => '', + 'sv_rcon_banpenalty' => '', + 'sv_rcon_maxfailures' => '', + 'sv_rcon_minfailures' => '', + 'sv_rcon_minfailuretime' => '', + 'sv_maxrate' => '', + 'sv_mincmdrate' => '', + 'sv_minrate' => '', + 'sv_minupdaterate' => '', + 'sv_client_cmdrate_difference' => '', + 'sv_maxupdaterate' => '', + 'sv_steamgroup' => '', + 'sv_tags' => '', + 'sv_maxspeed' => '', + 'mp_disable_respawn_times' => '', + 'phys_timescale' => '', + 'sv_maxcmdrate' => '' - ); + ); ?> \ No newline at end of file diff --git a/system/data/scfg/cssold.php b/system/data/scfg/cssold.php index 2e34d60..8d56f6e 100644 --- a/system/data/scfg/cssold.php +++ b/system/data/scfg/cssold.php @@ -1,126 +1,126 @@ 'Название игрового сервера.', - 'rcon_password' => 'Пароль для упраления сервером через RCON команды.', - 'sv_password' => 'Пароль для входа на сервер.', - 'decalfrequency' => 'Установить как часто игрок может рисовать свою эмблему. Значения выставляются в секундах.', - 'mp_allowspectators' => 'Присутствие в игре спектаторов.', - 'mp_autokick' => 'Включает автоматическое запрещение тим-киллеров и скидывает не играющих клиентов.', - 'mp_autoteambalance' => 'Выравнивание количества играющих в командах.', - 'mp_chattime' => 'Время перед сменой карты после победы одной из команд. Измеряется в секундах.', - 'mp_decals' => 'Определяет количество декалов на сервере (напр кол-во дырок от пуль на стенах сохраняемых сервером).', - 'mp_fadetoblack' => 'Погибшие игроки не могут наблюдать за игрой (черный экран).', - 'mp_falldamage' => 'Режим реалистичных повреждений при падениях с крыш и т.п.', - 'mp_flashlight' => 'Разрешить использовать фонарик.', - 'mp_footsteps' => 'Разрешить игрокам слышать звук шагов.', - 'mp_forcecamera' => 'Отключает режим свободного обзора для мертвых игроков.', - 'mp_forcerespawn' => 'Режим автоматического подключения игроков за команду', - 'mp_fraglimit' => 'Лимит убийств игрока до смены карты. 0 - Отключено.', - 'mp_freezetime' => 'Время закупки перед началом раунда. (Заморозка игроков на одном месте).', - 'mp_friendlyfire' => 'Нанесение повреждений игрокам своей команды.', - 'mp_hostagepenalty' => 'Устанавливает количество заложников, которых можно убить, прежде чем вас выкинет с сервера. 0 - Отключено.', - 'mp_limitteams' => 'Число игроков, на которое одна команда может превышать другую. Лишних игроков не будет пускать в команду. 0 - Отключено.', - 'mp_maxrounds' => 'Максимальное количество раундов, которые могут быть сыграны на карте до ее смены.', - 'mp_playerid' => 'Всплывающие подсказки при наведении прицела на игрока.', - 'mp_roundtime' => 'Время раунда. Измеряется в минутах.', - 'mp_spawnprotectiontime' => 'Время защиты игрока после респавна. Измеряется в секундах.', - 'mp_startmoney' => 'Количество денег у игрока в первом раунде.', - 'mp_timelimit' => 'Время, отведенное на одну карту. Измеряется в минутах. Значение 0 - отключение лимита времени. 0 = Отключено.', - 'mp_tkpunish' => 'В начале нового раунда убивает игрока, который в предыдущем убил игрока своей команды.', - 'mp_weaponstay' => 'Упавшее с игроков оружие остается лежать на земле.', - 'mp_winlimit' => 'Ограничение по победам на карту.', - 'mp_c4timer' => 'Время таймера до взрыва бомбы с момента ее установки. Измеряется в секундах.', - 'mp_buytime' => 'Время для закупки оружия в начале раунда. Значение выставляется в минутах.', - 'sv_airaccelerate' => 'Ускорение игрока в полете. Опцию имеет смысл изменять только для Surf сервера.', - 'sv_downloadurl' => 'Место, из которого клиенты могут скачать недостающие файлы.
    Использовать, если не включен FastDL.', - 'sv_allowdownload' => 'Возможность скачивать с сервера файлы.', - 'sv_allowupload' => 'Возможность закачивать на сервер файлы. Например эмблемы.', - 'sv_alltalk' => 'Режим работы общего голосового чата. При включении все игроки будут слышать друг друга независимо от команды, в которой они играют.', - 'sm_deadtalk' => 'Голосовое общение мертвых игроков.', - 'sv_consistency' => 'Режим проверки соответствия файлов моделей на клиенте.', - 'sv_gravity' => 'Гравитация на сервере. По умолчанию 800.', - 'sv_maxspeed' => 'Максимальная скорость передвижения игроков на сервере. По умолчанию 320.', - 'sv_maxunlag' => 'Опция влияет на хитбоксы и стрельбу. Меняйте только в том случае, если вы точно знаете, что делаете.', - 'sv_pausable' => 'Возможность использования паузы во время игры.', - 'sv_voiceenable' => 'Режим работы голосового чата в игре.', - 'sv_pushaway_force' => 'Сила отталкивания предметов.', - 'sv_turbophysics' => 'Позволяет толкать предметы при нажатии на кнопку "E".', - 'sv_contact' => 'Контакты админа.', - 'sv_rcon_banpenalty' => 'Колличество минут на которое банится игрок пытавшийся подобрать rcon-пароль к серверу.', - 'sv_rcon_maxfailures' => 'Максимальное колличество попыток при наборе rcon-пароля, после истечения которых игрок будет забанен.', - 'sv_rcon_minfailures' => 'Колличество попыток при наборе rcon-пароля во время заданное sv_rcon_minfailuretime, после истечения которых игрок будет забанен.', - 'sv_rcon_minfailuretime' => 'Колличество секунд для определения неверной rcon-аутенфикации.', - 'sv_maxrate' => 'Максимально-допустимый предел передачи/приёма байт в секунду между клиентом и сервером.', - 'sv_maxcmdrate' => 'Максимальное количество пакетов в секунду к серверу.', - 'sv_maxupdaterate' => 'Максимальное количество переданных пакетов в секунду.', - 'sv_minrate' => 'Минимально допустимый предел передачи/приёма байт в секунду между клиентом и сервером.', - 'sv_mincmdrate' => 'Минимальное количество пакетов в секунду к серверу. 0 = Не лимитирован.', - 'sv_minupdaterate' => 'Минимальное количество переданных пакетов в секунду.', - 'net_maxfilesize' => 'Максимальный размер загружаемого файла в MB', - 'phys_timescale' => 'Коэффициент шкалы времени для вычисления "физики" в игре. Если по тарифу тикрейт 100, то нужно выставить значение 1.5' - ); + $aScfg = array( + 'hostname' => 'Название игрового сервера.', + 'rcon_password' => 'Пароль для упраления сервером через RCON команды.', + 'sv_password' => 'Пароль для входа на сервер.', + 'decalfrequency' => 'Установить как часто игрок может рисовать свою эмблему. Значения выставляются в секундах.', + 'mp_allowspectators' => 'Присутствие в игре спектаторов.', + 'mp_autokick' => 'Включает автоматическое запрещение тим-киллеров и скидывает не играющих клиентов.', + 'mp_autoteambalance' => 'Выравнивание количества играющих в командах.', + 'mp_chattime' => 'Время перед сменой карты после победы одной из команд. Измеряется в секундах.', + 'mp_decals' => 'Определяет количество декалов на сервере (напр кол-во дырок от пуль на стенах сохраняемых сервером).', + 'mp_fadetoblack' => 'Погибшие игроки не могут наблюдать за игрой (черный экран).', + 'mp_falldamage' => 'Режим реалистичных повреждений при падениях с крыш и т.п.', + 'mp_flashlight' => 'Разрешить использовать фонарик.', + 'mp_footsteps' => 'Разрешить игрокам слышать звук шагов.', + 'mp_forcecamera' => 'Отключает режим свободного обзора для мертвых игроков.', + 'mp_forcerespawn' => 'Режим автоматического подключения игроков за команду', + 'mp_fraglimit' => 'Лимит убийств игрока до смены карты. 0 - Отключено.', + 'mp_freezetime' => 'Время закупки перед началом раунда. (Заморозка игроков на одном месте).', + 'mp_friendlyfire' => 'Нанесение повреждений игрокам своей команды.', + 'mp_hostagepenalty' => 'Устанавливает количество заложников, которых можно убить, прежде чем вас выкинет с сервера. 0 - Отключено.', + 'mp_limitteams' => 'Число игроков, на которое одна команда может превышать другую. Лишних игроков не будет пускать в команду. 0 - Отключено.', + 'mp_maxrounds' => 'Максимальное количество раундов, которые могут быть сыграны на карте до ее смены.', + 'mp_playerid' => 'Всплывающие подсказки при наведении прицела на игрока.', + 'mp_roundtime' => 'Время раунда. Измеряется в минутах.', + 'mp_spawnprotectiontime' => 'Время защиты игрока после респавна. Измеряется в секундах.', + 'mp_startmoney' => 'Количество денег у игрока в первом раунде.', + 'mp_timelimit' => 'Время, отведенное на одну карту. Измеряется в минутах. Значение 0 - отключение лимита времени. 0 = Отключено.', + 'mp_tkpunish' => 'В начале нового раунда убивает игрока, который в предыдущем убил игрока своей команды.', + 'mp_weaponstay' => 'Упавшее с игроков оружие остается лежать на земле.', + 'mp_winlimit' => 'Ограничение по победам на карту.', + 'mp_c4timer' => 'Время таймера до взрыва бомбы с момента ее установки. Измеряется в секундах.', + 'mp_buytime' => 'Время для закупки оружия в начале раунда. Значение выставляется в минутах.', + 'sv_airaccelerate' => 'Ускорение игрока в полете. Опцию имеет смысл изменять только для Surf сервера.', + 'sv_downloadurl' => 'Место, из которого клиенты могут скачать недостающие файлы.
    Использовать, если не включен FastDL.', + 'sv_allowdownload' => 'Возможность скачивать с сервера файлы.', + 'sv_allowupload' => 'Возможность закачивать на сервер файлы. Например эмблемы.', + 'sv_alltalk' => 'Режим работы общего голосового чата. При включении все игроки будут слышать друг друга независимо от команды, в которой они играют.', + 'sm_deadtalk' => 'Голосовое общение мертвых игроков.', + 'sv_consistency' => 'Режим проверки соответствия файлов моделей на клиенте.', + 'sv_gravity' => 'Гравитация на сервере. По умолчанию 800.', + 'sv_maxspeed' => 'Максимальная скорость передвижения игроков на сервере. По умолчанию 320.', + 'sv_maxunlag' => 'Опция влияет на хитбоксы и стрельбу. Меняйте только в том случае, если вы точно знаете, что делаете.', + 'sv_pausable' => 'Возможность использования паузы во время игры.', + 'sv_voiceenable' => 'Режим работы голосового чата в игре.', + 'sv_pushaway_force' => 'Сила отталкивания предметов.', + 'sv_turbophysics' => 'Позволяет толкать предметы при нажатии на кнопку "E".', + 'sv_contact' => 'Контакты админа.', + 'sv_rcon_banpenalty' => 'Колличество минут на которое банится игрок пытавшийся подобрать rcon-пароль к серверу.', + 'sv_rcon_maxfailures' => 'Максимальное колличество попыток при наборе rcon-пароля, после истечения которых игрок будет забанен.', + 'sv_rcon_minfailures' => 'Колличество попыток при наборе rcon-пароля во время заданное sv_rcon_minfailuretime, после истечения которых игрок будет забанен.', + 'sv_rcon_minfailuretime' => 'Колличество секунд для определения неверной rcon-аутенфикации.', + 'sv_maxrate' => 'Максимально-допустимый предел передачи/приёма байт в секунду между клиентом и сервером.', + 'sv_maxcmdrate' => 'Максимальное количество пакетов в секунду к серверу.', + 'sv_maxupdaterate' => 'Максимальное количество переданных пакетов в секунду.', + 'sv_minrate' => 'Минимально допустимый предел передачи/приёма байт в секунду между клиентом и сервером.', + 'sv_mincmdrate' => 'Минимальное количество пакетов в секунду к серверу. 0 = Не лимитирован.', + 'sv_minupdaterate' => 'Минимальное количество переданных пакетов в секунду.', + 'net_maxfilesize' => 'Максимальный размер загружаемого файла в MB', + 'phys_timescale' => 'Коэффициент шкалы времени для вычисления "физики" в игре. Если по тарифу тикрейт 100, то нужно выставить значение 1.5' + ); - $aScfg_form = array( - 'hostname' => '', - 'rcon_password' => '', - 'sv_password' => '', - 'decalfrequency' => '', - 'mp_allowspectators' => '', - 'mp_autokick' => '', - 'mp_autoteambalance' => '', - 'mp_chattime' => '', - 'mp_decals' => '', - 'mp_fadetoblack' => '', - 'mp_falldamage' => '', - 'mp_flashlight' => '', - 'mp_footsteps' => '', - 'mp_forcecamera' => '', - 'mp_forcerespawn' => '', - 'mp_fraglimit' => '', - 'mp_freezetime' => '', - 'mp_friendlyfire' => '', - 'mp_hostagepenalty' => '', - 'mp_limitteams' => '', - 'mp_maxrounds' => '', - 'mp_playerid' => '', - 'mp_roundtime' => '', - 'mp_spawnprotectiontime' => '', - 'mp_startmoney' => '', - 'mp_timelimit' => '', - 'mp_tkpunish' => '', - 'mp_weaponstay' => '', - 'mp_winlimit' => '', - 'mp_c4timer' => '', - 'mp_buytime' => '', - 'sv_airaccelerate' => '', - 'sv_allowdownload' => '', - 'sv_allowupload' => '', - 'sv_alltalk' => '', - 'sm_deadtalk' => '', - 'sv_consistency' => '', - 'sv_gravity' => '', - 'sv_maxspeed' => '', - 'sv_maxunlag' => '', - 'sv_pausable' => '', - 'sv_voiceenable' => '', - 'sv_pushaway_force' => '', - 'sv_turbophysics' => '', - 'sv_contact' => '', - 'sv_rcon_banpenalty' => '', - 'sv_rcon_maxfailures' => '', - 'sv_rcon_minfailures' => '', - 'sv_rcon_minfailuretime' => '', - 'sv_maxrate' => '', - 'sv_maxcmdrate' => '', - 'sv_maxupdaterate' => '', - 'sv_minrate' => '', - 'sv_mincmdrate' => '', - 'sv_minupdaterate' => '', - 'sv_downloadurl' => '', - 'net_maxfilesize' => '', - 'phys_timescale' => '' - ); + $aScfg_form = array( + 'hostname' => '', + 'rcon_password' => '', + 'sv_password' => '', + 'decalfrequency' => '', + 'mp_allowspectators' => '', + 'mp_autokick' => '', + 'mp_autoteambalance' => '', + 'mp_chattime' => '', + 'mp_decals' => '', + 'mp_fadetoblack' => '', + 'mp_falldamage' => '', + 'mp_flashlight' => '', + 'mp_footsteps' => '', + 'mp_forcecamera' => '', + 'mp_forcerespawn' => '', + 'mp_fraglimit' => '', + 'mp_freezetime' => '', + 'mp_friendlyfire' => '', + 'mp_hostagepenalty' => '', + 'mp_limitteams' => '', + 'mp_maxrounds' => '', + 'mp_playerid' => '', + 'mp_roundtime' => '', + 'mp_spawnprotectiontime' => '', + 'mp_startmoney' => '', + 'mp_timelimit' => '', + 'mp_tkpunish' => '', + 'mp_weaponstay' => '', + 'mp_winlimit' => '', + 'mp_c4timer' => '', + 'mp_buytime' => '', + 'sv_airaccelerate' => '', + 'sv_allowdownload' => '', + 'sv_allowupload' => '', + 'sv_alltalk' => '', + 'sm_deadtalk' => '', + 'sv_consistency' => '', + 'sv_gravity' => '', + 'sv_maxspeed' => '', + 'sv_maxunlag' => '', + 'sv_pausable' => '', + 'sv_voiceenable' => '', + 'sv_pushaway_force' => '', + 'sv_turbophysics' => '', + 'sv_contact' => '', + 'sv_rcon_banpenalty' => '', + 'sv_rcon_maxfailures' => '', + 'sv_rcon_minfailures' => '', + 'sv_rcon_minfailuretime' => '', + 'sv_maxrate' => '', + 'sv_maxcmdrate' => '', + 'sv_maxupdaterate' => '', + 'sv_minrate' => '', + 'sv_mincmdrate' => '', + 'sv_minupdaterate' => '', + 'sv_downloadurl' => '', + 'net_maxfilesize' => '', + 'phys_timescale' => '' + ); ?> \ No newline at end of file diff --git a/system/data/scfg/mc.php b/system/data/scfg/mc.php index 8069232..69456e6 100644 --- a/system/data/scfg/mc.php +++ b/system/data/scfg/mc.php @@ -1,113 +1,113 @@ 'Название игрового сервера.', - 'server-name' => 'Название игрового сервера.', - 'level-name' => 'Название карты.', - 'rcon.password' => 'ароль для управления сервером через RCON команды.', - 'enable-rcon' => 'Разрешено управление RCON командами на сервере.', - 'allow-nether' => 'Разрешено игрокам путешествовать в Нижний мир (Nether).', - 'allow-flight' => 'Разрешено игрокам летать в режиме выживания, если установлен мод для полетов.', - 'white-list' => 'Белый список на сервере. Если на сервере включен "белый лист", то на нем могут играть только пользователи записанные в файле white-list.txt.', - 'spawn-animals' => 'Появление животных.', - 'spawn-monsters' => 'Появление монстров.', - 'online-mode' => 'Проверять наличие игрока в базе аккаунтов minecraft. При включении, игроки смогут играть только с лицензионного клиента игры.', - 'pvp' => 'Получение урона игрокам от атак других игроков на сервере. При выключении игроки не смогут наносить прямой урон один другому.', - 'difficulty' => 'Cложность игры на сервере..', - 'gamemode' => 'Режим игры на сервере.', - 'view-distance' => 'Дистанция обзора со стороны сервера. Рекомендуемое значение 10. Если наблюдаются сильные лаги можно уменьшить это значение.', - 'level-seed' => 'Входные данные (сид) для генератора уровня.', - 'level-type' => 'Опция генерации мира. DEFAULT - Стандартный, FLAT - Суперплоскость, LARGEBIOMES - Большие биомы, DAYZ, BIOMESOP.', - 'generate-structures' => 'Генерировать ли структуры (сокровищницы, крепости, деревни...).', - 'max-built-height' => 'Указывает максимальную высоту постройки на сервере.', - 'texture-pack' => 'Для серверов версии ниже 1.7.2. Архив текстур, который сервер предложит загрузить игроку при соединении. В данном поле нужно указать имя zip-архива, находящегося в папке сервера.', - 'resource-pack' => 'Для серверов версии ниже 1.7.2. Архив ресурсов, который сервер предложит загрузить игроку при соединении. В данном поле нужно указать имя zip-архива, находящегося в папке сервера.', - 'enable-command-block' => 'Командный блок.', - 'hardcore' => 'Включает на сервере режим Хардкор. После смерти - бан, переподключиться нельзя.', - 'announce-player-achievements' => 'Отправлять в чат сообщения о получении достижений.', - 'op-permission-level' => 'Позволяет изменять права операторов.' - .'
  • 1 - Операторы могут ломать / ставить блоки внутри радиуса защиты территории спауна.
  • ' - .'
  • 2 - Операторы могут использовать команды /clear, /difficulty, /effect, /gamemode, /gamerule, /give, /tp, и могут изменять командные блоки.
  • ' - .'
  • 3 - Операторы могут использовать команды /ban, /deop, /kick, и /op.
  • ' - .'
  • 4 - Операторы могут использовать команду /stop.
  • ' - ); + $aScfg = array( + 'motd' => 'Название игрового сервера.', + 'server-name' => 'Название игрового сервера.', + 'level-name' => 'Название карты.', + 'rcon.password' => 'ароль для управления сервером через RCON команды.', + 'enable-rcon' => 'Разрешено управление RCON командами на сервере.', + 'allow-nether' => 'Разрешено игрокам путешествовать в Нижний мир (Nether).', + 'allow-flight' => 'Разрешено игрокам летать в режиме выживания, если установлен мод для полетов.', + 'white-list' => 'Белый список на сервере. Если на сервере включен "белый лист", то на нем могут играть только пользователи записанные в файле white-list.txt.', + 'spawn-animals' => 'Появление животных.', + 'spawn-monsters' => 'Появление монстров.', + 'online-mode' => 'Проверять наличие игрока в базе аккаунтов minecraft. При включении, игроки смогут играть только с лицензионного клиента игры.', + 'pvp' => 'Получение урона игрокам от атак других игроков на сервере. При выключении игроки не смогут наносить прямой урон один другому.', + 'difficulty' => 'Cложность игры на сервере..', + 'gamemode' => 'Режим игры на сервере.', + 'view-distance' => 'Дистанция обзора со стороны сервера. Рекомендуемое значение 10. Если наблюдаются сильные лаги можно уменьшить это значение.', + 'level-seed' => 'Входные данные (сид) для генератора уровня.', + 'level-type' => 'Опция генерации мира. DEFAULT - Стандартный, FLAT - Суперплоскость, LARGEBIOMES - Большие биомы, DAYZ, BIOMESOP.', + 'generate-structures' => 'Генерировать ли структуры (сокровищницы, крепости, деревни...).', + 'max-built-height' => 'Указывает максимальную высоту постройки на сервере.', + 'texture-pack' => 'Для серверов версии ниже 1.7.2. Архив текстур, который сервер предложит загрузить игроку при соединении. В данном поле нужно указать имя zip-архива, находящегося в папке сервера.', + 'resource-pack' => 'Для серверов версии ниже 1.7.2. Архив ресурсов, который сервер предложит загрузить игроку при соединении. В данном поле нужно указать имя zip-архива, находящегося в папке сервера.', + 'enable-command-block' => 'Командный блок.', + 'hardcore' => 'Включает на сервере режим Хардкор. После смерти - бан, переподключиться нельзя.', + 'announce-player-achievements' => 'Отправлять в чат сообщения о получении достижений.', + 'op-permission-level' => 'Позволяет изменять права операторов.' + .'
  • 1 - Операторы могут ломать / ставить блоки внутри радиуса защиты территории спауна.
  • ' + .'
  • 2 - Операторы могут использовать команды /clear, /difficulty, /effect, /gamemode, /gamerule, /give, /tp, и могут изменять командные блоки.
  • ' + .'
  • 3 - Операторы могут использовать команды /ban, /deop, /kick, и /op.
  • ' + .'
  • 4 - Операторы могут использовать команду /stop.
  • ' + ); - $aScfg_form = array( - 'motd' => '', - 'server-name' => '', - 'level-name' => '', - 'rcon.password' => '', - 'view-distance' => '', - 'level-seed' => '', - 'level-type' => '', - 'texture-pack' => '', - 'resource-pack' => '', - 'enable-rcon' => '', - 'generate-structures' => '', - 'allow-nether' => '', - 'allow-flight' => '', - 'white-list' => '', - 'hardcore' => '', - 'spawn-animals' => '', - 'announce-player-achievements' => '', - 'spawn-monsters' => '', - 'online-mode' => '', - 'pvp' => '', - 'enable-command-block' => '', - 'difficulty' => '', - 'gamemode' => '', - 'max-built-height' => '', - 'op-permission-level' => '' - ); + $aScfg_form = array( + 'motd' => '', + 'server-name' => '', + 'level-name' => '', + 'rcon.password' => '', + 'view-distance' => '', + 'level-seed' => '', + 'level-type' => '', + 'texture-pack' => '', + 'resource-pack' => '', + 'enable-rcon' => '', + 'generate-structures' => '', + 'allow-nether' => '', + 'allow-flight' => '', + 'white-list' => '', + 'hardcore' => '', + 'spawn-animals' => '', + 'announce-player-achievements' => '', + 'spawn-monsters' => '', + 'online-mode' => '', + 'pvp' => '', + 'enable-command-block' => '', + 'difficulty' => '', + 'gamemode' => '', + 'max-built-height' => '', + 'op-permission-level' => '' + ); ?> \ No newline at end of file diff --git a/system/data/scfg/samp.php b/system/data/scfg/samp.php index a00972b..fe1f6ca 100644 --- a/system/data/scfg/samp.php +++ b/system/data/scfg/samp.php @@ -1,53 +1,53 @@ 'Название игрового сервера.', - 'rcon' => 'Управление RCON командами.', - 'rcon_password' => 'Пароль для упраления сервером через RCON команды.', - 'password' => 'Пароль для входа на сервер.', - 'lanmode' => 'Тип игрового сервера.', - 'gamemode0' => 'Моды на сервере.', - 'filterscripts' => 'Сценарии на сервере.', - 'announce' => 'Отображение сервера в интернете.', - 'weburl' => 'Адрес сайта севера.', - 'maxnpc' => 'Максимальное число NPC подключаемых к серверу.', - 'onfoot_rate' => 'Время в миллисекундах за которое сервер обновляет данные о пешем игроке.', - 'incar_rate' => 'Время в миллисекундах за которое сервер обновляет данные о игроке находящемся в транспорте.', - 'weapon_rate' => 'Время в миллисекундах за которое сервер обновляет данные о стрельбе игрока.', - 'stream_distance' => 'Дистанция для обновления стримера игроков.', - 'stream_rate' => 'Время в миллисекундах за которое сервер обновляет игроков в стримере.', - 'logqueries' => 'Логирование всех запросов.' - ); + $aScfg = array( + 'hostname' => 'Название игрового сервера.', + 'rcon' => 'Управление RCON командами.', + 'rcon_password' => 'Пароль для упраления сервером через RCON команды.', + 'password' => 'Пароль для входа на сервер.', + 'lanmode' => 'Тип игрового сервера.', + 'gamemode0' => 'Моды на сервере.', + 'filterscripts' => 'Сценарии на сервере.', + 'announce' => 'Отображение сервера в интернете.', + 'weburl' => 'Адрес сайта севера.', + 'maxnpc' => 'Максимальное число NPC подключаемых к серверу.', + 'onfoot_rate' => 'Время в миллисекундах за которое сервер обновляет данные о пешем игроке.', + 'incar_rate' => 'Время в миллисекундах за которое сервер обновляет данные о игроке находящемся в транспорте.', + 'weapon_rate' => 'Время в миллисекундах за которое сервер обновляет данные о стрельбе игрока.', + 'stream_distance' => 'Дистанция для обновления стримера игроков.', + 'stream_rate' => 'Время в миллисекундах за которое сервер обновляет игроков в стримере.', + 'logqueries' => 'Логирование всех запросов.' + ); - $aScfg_form = array( - 'hostname' => '', - 'rcon_password' => '', - 'password' => '', - 'gamemode0' => '', - 'filterscripts' => '', - 'maxnpc' => '', - 'onfoot_rate' => '', - 'incar_rate' => '', - 'weapon_rate' => '', - 'stream_distance' => '', - 'stream_rate' => '', - 'lagcompmode' => '', - 'rcon' => '', - 'announce' => '', - 'logqueries' => '', - 'lanmode' => '' - ); + $aScfg_form = array( + 'hostname' => '', + 'rcon_password' => '', + 'password' => '', + 'gamemode0' => '', + 'filterscripts' => '', + 'maxnpc' => '', + 'onfoot_rate' => '', + 'incar_rate' => '', + 'weapon_rate' => '', + 'stream_distance' => '', + 'stream_rate' => '', + 'lagcompmode' => '', + 'rcon' => '', + 'announce' => '', + 'logqueries' => '', + 'lanmode' => '' + ); ?> \ No newline at end of file diff --git a/system/data/text/error.php b/system/data/text/error.php index 1b77176..ea1e1b0 100644 --- a/system/data/text/error.php +++ b/system/data/text/error.php @@ -1,9 +1,9 @@ array( + $text = array( + 'ssh' => array( // Если вывод ошибок по группе пользователя 'admin' => 'Не удалось создать соединение с оборудованием.', @@ -15,7 +15,7 @@ 'all' => 'Не удалось создать соединение с оборудованием.' ), - 'cpu' => array( + 'cpu' => array( // Если вывод ошибок по группе пользователя 'admin' => 'Не удается запустить игровой сервер, нет свободного потока.', @@ -26,21 +26,21 @@ // Если вывод ошибок не учитывать группу пользователя 'all' => 'Не удается запустить игровой сервер, нет свободного потока.' ), - - 'mail' => 'Не удалось отправить сообщение на почту.', + + 'mail' => 'Не удалось отправить сообщение на почту.', - 'signup' => 'Подача регистрации не найдена.', + 'signup' => 'Подача регистрации не найдена.', - 'recovery' => 'Подача восстановления не найдена.', + 'recovery' => 'Подача восстановления не найдена.', - 'ser_stop' => 'Выключение невозможно, сервер должен быть включен.', - 'ser_start' => 'Включение невозможно, сервер должен быть выключен.', - 'ser_restart' => 'Перезагрузка невозможна, сервер должен быть включен.', - 'ser_reinstall' => 'Переустановка невозможна, сервер должен быть выключен.', - 'ser_update' => 'Обновление невозможно, сервер должен быть выключен.', - 'ser_change' => 'Смена карты невозможна, сервер должен быть полностью запущен.', - 'ser_change_go' => 'Не удалось сменить карту.', - 'ser_owner' => 'У вас нет доступа к данной операции.', - 'ser_delete' => 'Удаление невозможно, сервер должен быть выключен.', - ); + 'ser_stop' => 'Выключение невозможно, сервер должен быть включен.', + 'ser_start' => 'Включение невозможно, сервер должен быть выключен.', + 'ser_restart' => 'Перезагрузка невозможна, сервер должен быть включен.', + 'ser_reinstall' => 'Переустановка невозможна, сервер должен быть выключен.', + 'ser_update' => 'Обновление невозможно, сервер должен быть выключен.', + 'ser_change' => 'Смена карты невозможна, сервер должен быть полностью запущен.', + 'ser_change_go' => 'Не удалось сменить карту.', + 'ser_owner' => 'У вас нет доступа к данной операции.', + 'ser_delete' => 'Удаление невозможно, сервер должен быть выключен.', + ); ?> \ No newline at end of file diff --git a/system/data/text/input.php b/system/data/text/input.php index 534a900..94facd4 100644 --- a/system/data/text/input.php +++ b/system/data/text/input.php @@ -1,31 +1,31 @@ 'Необходимо заполнить все поля.', - 'login_valid' => 'Неправильный формат логина.', - 'mail_valid' => 'Неправильный формат почты.', - 'name_valid' => 'Неправильный формат имени.', - 'lastname_valid' => 'Неправильный формат фамилии.', - 'patronymic_valid' => 'Неправильный формат отчества.', - 'contacts_valid' => 'Неправильный формат контактов.
    Пример: vk - https://vk.com/enginegamespanel или skype - enginegamepanel.', - 'passwd_valid' => 'Неправильный формат пароля, используйте латинские буквы и цифры от 4 до 20 символов.', - 'phone_valid' => 'Указанный номер имеет неверный формат, пример: RU - 79260010203, KZ - 77058197322.', - 'wmr_valid' => 'Указанный кошелек имеет неверный формат, пример: R123456789100.', + $text = array( + 'all' => 'Необходимо заполнить все поля.', + 'login_valid' => 'Неправильный формат логина.', + 'mail_valid' => 'Неправильный формат почты.', + 'name_valid' => 'Неправильный формат имени.', + 'lastname_valid' => 'Неправильный формат фамилии.', + 'patronymic_valid' => 'Неправильный формат отчества.', + 'contacts_valid' => 'Неправильный формат контактов.
    Пример: vk - https://vk.com/enginegamespanel или skype - enginegamepanel.', + 'passwd_valid' => 'Неправильный формат пароля, используйте латинские буквы и цифры от 4 до 20 символов.', + 'phone_valid' => 'Указанный номер имеет неверный формат, пример: RU - 79260010203, KZ - 77058197322.', + 'wmr_valid' => 'Указанный кошелек имеет неверный формат, пример: R123456789100.', - 'mail_use' => 'Почта занята другим пользователем.', - 'login_use' => 'Логин занят другим пользователем.', - 'phone_use' => 'Телефон занят другим пользователем.', - 'contacts_use' => 'Контакты заняты другим пользователем.', + 'mail_use' => 'Почта занята другим пользователем.', + 'login_use' => 'Логин занят другим пользователем.', + 'phone_use' => 'Телефон занят другим пользователем.', + 'contacts_use' => 'Контакты заняты другим пользователем.', - 'auth' => 'Неправильный логин или пароль.', - 'recovery' => 'Пользователь не найден.', - 'word' => 'В сообщении присутствует длинное слово.', - 'similar' => 'Указанные данные совпадают с текущими.', - 'phone_confirm' => 'Изменение подтвержденного номера невозможно.', - 'wmr_confirm' => 'Изменение кошелька невозможно.', - 'phone' => 'Для подтверждения номера, необходимо его указать.', - 'code' => 'Указанный код неправильный.', - ); + 'auth' => 'Неправильный логин или пароль.', + 'recovery' => 'Пользователь не найден.', + 'word' => 'В сообщении присутствует длинное слово.', + 'similar' => 'Указанные данные совпадают с текущими.', + 'phone_confirm' => 'Изменение подтвержденного номера невозможно.', + 'wmr_confirm' => 'Изменение кошелька невозможно.', + 'phone' => 'Для подтверждения номера, необходимо его указать.', + 'code' => 'Указанный код неправильный.', + ); ?> \ No newline at end of file diff --git a/system/data/text/logs.php b/system/data/text/logs.php index 3797e5e..7b94331 100644 --- a/system/data/text/logs.php +++ b/system/data/text/logs.php @@ -1,23 +1,23 @@ 'Аренда игрового сервера на срок: [days], списана сумма: [money] руб. (сервер: #[id])', - 'buy_control' => 'Аренда услуги \"Контроль\" на срок: [days], списана сумма: [money] руб. (сервер: #[id])', - 'buy_server_promo' => 'Аренда игрового сервера на срок: [days], использование промо-кода: [promo], списана сумма: [money] руб. (сервер: #[id])', - 'buy_server_test' => 'Получение тестового периода для игрового сервера, списана сумма: 0 руб. (сервер: #[id])', - 'extend_server' => 'Продление игрового сервера на срок: [days], списана сумма: [money] руб. (сервер: #[id])', - 'extend_control' => 'Продление подключенного сервера на срок: [days], списана сумма: [money] руб. (контроль: #[id])', - 'extend_server_promo' => 'Продление игрового сервера на срок: [days], использование промо-кода: [promo], списана сумма: [money] руб. (сервер: #[id])', - 'part' => 'Партнерская программа: прибыль [money] руб. от партнера (пользоветль: #[part])', - 'cashback' => 'Вывод средств на [purse], сумма [money] руб.', - 'profit' => 'Продажа привилегии на игровом сервере: прибыль [money] руб. (сервер: #[server])', - 'buy_address' => 'Аренда выделенного адреса, списана сумма: [money] руб. (сервер: #[id])', - 'extend_address' => 'Продление аренды выделенного адреса, списана сумма: [money] руб. (сервер: #[id])', - 'buy_slots' => 'Аренда дополнительных слот: [slots] шт., списана сумма: [money] руб. (сервер: #[id])', - 'buy_boost' => 'Покупка кругов: [circles] шт. на сайте: [site], списана сумма: [money] руб. (сервер: #[id])', - 'buy_plugin' => 'Покупка плагина: [plugin], списана сумма: [money] руб. (сервер: #[id])', - 'ctrl_buy_plugin' => 'Покупка плагина: [plugin], списана сумма: [money] руб. (CTRL сервер: #[id])', - ); + $text = array( + 'buy_server' => 'Аренда игрового сервера на срок: [days], списана сумма: [money] руб. (сервер: #[id])', + 'buy_control' => 'Аренда услуги \"Контроль\" на срок: [days], списана сумма: [money] руб. (сервер: #[id])', + 'buy_server_promo' => 'Аренда игрового сервера на срок: [days], использование промо-кода: [promo], списана сумма: [money] руб. (сервер: #[id])', + 'buy_server_test' => 'Получение тестового периода для игрового сервера, списана сумма: 0 руб. (сервер: #[id])', + 'extend_server' => 'Продление игрового сервера на срок: [days], списана сумма: [money] руб. (сервер: #[id])', + 'extend_control' => 'Продление подключенного сервера на срок: [days], списана сумма: [money] руб. (контроль: #[id])', + 'extend_server_promo' => 'Продление игрового сервера на срок: [days], использование промо-кода: [promo], списана сумма: [money] руб. (сервер: #[id])', + 'part' => 'Партнерская программа: прибыль [money] руб. от партнера (пользоветль: #[part])', + 'cashback' => 'Вывод средств на [purse], сумма [money] руб.', + 'profit' => 'Продажа привилегии на игровом сервере: прибыль [money] руб. (сервер: #[server])', + 'buy_address' => 'Аренда выделенного адреса, списана сумма: [money] руб. (сервер: #[id])', + 'extend_address' => 'Продление аренды выделенного адреса, списана сумма: [money] руб. (сервер: #[id])', + 'buy_slots' => 'Аренда дополнительных слот: [slots] шт., списана сумма: [money] руб. (сервер: #[id])', + 'buy_boost' => 'Покупка кругов: [circles] шт. на сайте: [site], списана сумма: [money] руб. (сервер: #[id])', + 'buy_plugin' => 'Покупка плагина: [plugin], списана сумма: [money] руб. (сервер: #[id])', + 'ctrl_buy_plugin' => 'Покупка плагина: [plugin], списана сумма: [money] руб. (CTRL сервер: #[id])', + ); ?> \ No newline at end of file diff --git a/system/data/text/mail.php b/system/data/text/mail.php index fa21199..e9a07cf 100644 --- a/system/data/text/mail.php +++ b/system/data/text/mail.php @@ -1,66 +1,66 @@ '
    Здравствуйте, для завершения регистрации ' - .'на сайте: [site], необходимо подтвердить свои действия, ' - .'для этого необходимо перейти по ссылке: подтвердить.' - .'
    ' - .'Если вы не регистрировались на данном сайте, то проигнорируйте данное сообщение.' - .'

    ' - .'С уважением, администрация [site].', + $text = array( + 'signup' => '
    Здравствуйте, для завершения регистрации ' + .'на сайте: [site], необходимо подтвердить свои действия, ' + .'для этого необходимо перейти по ссылке: подтвердить.' + .'
    ' + .'Если вы не регистрировались на данном сайте, то проигнорируйте данное сообщение.' + .'

    ' + .'С уважением, администрация [site].', - 'signup_end' => '
    Здравствуйте, вы успешно зарегистрированы ' - .'на сайте: [site], ваши персональные данные: ' - .'

    ' - .'Логин: [login]' - .'
    ' - .'Пароль: [passwd]' - .'

    ' - .'С уважением, администрация [site].', + 'signup_end' => '
    Здравствуйте, вы успешно зарегистрированы ' + .'на сайте: [site], ваши персональные данные: ' + .'

    ' + .'Логин: [login]' + .'
    ' + .'Пароль: [passwd]' + .'

    ' + .'С уважением, администрация [site].', - 'recovery' => '
    Здравствуйте, для восстановления доступа ' - .'на сайте: [site], необходимо подтвердить свои действия, ' - .'для этого необходимо перейти по ссылке: подтвердить.' - .'
    ' - .'Если вы не производили данную операцию, то проигнорируйте данное сообщение, не беспокойтесь, пароль не будет изменен.' - .'

    ' - .'С уважением, администрация [site].', + 'recovery' => '
    Здравствуйте, для восстановления доступа ' + .'на сайте: [site], необходимо подтвердить свои действия, ' + .'для этого необходимо перейти по ссылке: подтвердить.' + .'
    ' + .'Если вы не производили данную операцию, то проигнорируйте данное сообщение, не беспокойтесь, пароль не будет изменен.' + .'

    ' + .'С уважением, администрация [site].', - 'change' => '
    Здравствуйте, для смена почты ' - .'на сайте: [site], необходимо подтвердить свои действия, ' - .'для этого необходимо перейти по ссылке: подтвердить.' - .'
    ' - .'Если вы не производили данную операцию, то проигнорируйте данное сообщение, не беспокойтесь, почта не будет изменена.' - .'

    ' - .'С уважением, администрация [site].', + 'change' => '
    Здравствуйте, для смена почты ' + .'на сайте: [site], необходимо подтвердить свои действия, ' + .'для этого необходимо перейти по ссылке: подтвердить.' + .'
    ' + .'Если вы не производили данную операцию, то проигнорируйте данное сообщение, не беспокойтесь, почта не будет изменена.' + .'

    ' + .'С уважением, администрация [site].', - 'recovery_end' => '
    Здравствуйте, восстановление доступа ' - .'на сайте: [site] успешно завершено.' - .'
    ' - .'Ваш новый пароль: [passwd], теперь вы можете авторизоваться.' - .'

    ' - .'С уважением, администрация [site].', + 'recovery_end' => '
    Здравствуйте, восстановление доступа ' + .'на сайте: [site] успешно завершено.' + .'
    ' + .'Ваш новый пароль: [passwd], теперь вы можете авторизоваться.' + .'

    ' + .'С уважением, администрация [site].', - 'security_code' => '
    Здравствуйте, для авторизации ' - .'укажите код подверждения: [code]. (код будет доступен 180 секунд.)' - .'
    ' - .'Если авторизацию инициировали не вы, не беспокойтесь, без данного кода авторизация не будет завершена.' - .'

    ' - .'Система защиты по коду [site].', + 'security_code' => '
    Здравствуйте, для авторизации ' + .'укажите код подверждения: [code]. (код будет доступен 180 секунд.)' + .'
    ' + .'Если авторизацию инициировали не вы, не беспокойтесь, без данного кода авторизация не будет завершена.' + .'

    ' + .'Система защиты по коду [site].', - 'notice_help' => '
    Здравствуйте, на ваш вопрос был дан ответ, прочитать.' - .'
    ' - .'С уважением, администрация [site].', + 'notice_help' => '
    Здравствуйте, на ваш вопрос был дан ответ, прочитать.' + .'
    ' + .'С уважением, администрация [site].', - 'notice_help_admin' => '
    Новый тикет в тех. подвержке: прочитать.', - 'notice_help_admin_new' => '
    Новое сообщение в тех. подвержке: прочитать.', + 'notice_help_admin' => '
    Новый тикет в тех. подвержке: прочитать.', + 'notice_help_admin_new' => '
    Новое сообщение в тех. подвержке: прочитать.', - 'notice_server_overdue' => '
    Здравствуйте, ваш арендованный игровой сервер #[id] ([address]) просрочен,' - .'
    ' - .'через некоторое время он будет удален, во избежание этого, необходимо продлить аренду.' - .'
    ' - .'С уважением, администрация [site].', - ); + 'notice_server_overdue' => '
    Здравствуйте, ваш арендованный игровой сервер #[id] ([address]) просрочен,' + .'
    ' + .'через некоторое время он будет удален, во избежание этого, необходимо продлить аренду.' + .'
    ' + .'С уважением, администрация [site].', + ); ?> \ No newline at end of file diff --git a/system/data/text/other.php b/system/data/text/other.php index 2831222..caf66b5 100644 --- a/system/data/text/other.php +++ b/system/data/text/other.php @@ -1,9 +1,9 @@ 'Пожалуйста, дождитесь выполнения предыдущего запроса.', - 'captcha' => 'Неправильно указан код проверки либо закончился срок его жизни.', - ); + $text = array( + 'mcache' => 'Пожалуйста, дождитесь выполнения предыдущего запроса.', + 'captcha' => 'Неправильно указан код проверки либо закончился срок его жизни.', + ); ?> \ No newline at end of file diff --git a/system/data/text/output.php b/system/data/text/output.php index af0e4f6..abaae4d 100644 --- a/system/data/text/output.php +++ b/system/data/text/output.php @@ -1,20 +1,20 @@ 'На указанную почту отправлено письмо с дальнейшей инструкцией.', - 'remail' => 'На указанную почту повторно отправлено письмо с подтверждением.', - 'signup' => 'Вы успешно зарегистрировались, на вашу почту отправлены логин и пароль для авторизации на сайте.', - 'oldmail' => 'На старую почту отправлено письмо с инструкцией.', - - 'confirm_key_error' => 'Неправильный код подтверждения операции.', - 'confirm_mail_done' => 'Операция смены почты успешно выполнена.', - 'confirm_phone' => 'Ваш номер подтвержден, сменить его нельзя.', - 'confirm_phone_done' => 'Ваш номер уже подтвержден.', - 'confirm_phone_error' => 'Не удалось подтвердить номер.', + $text = array( + 'mail' => 'На указанную почту отправлено письмо с дальнейшей инструкцией.', + 'remail' => 'На указанную почту повторно отправлено письмо с подтверждением.', + 'signup' => 'Вы успешно зарегистрировались, на вашу почту отправлены логин и пароль для авторизации на сайте.', + 'oldmail' => 'На старую почту отправлено письмо с инструкцией.', + + 'confirm_key_error' => 'Неправильный код подтверждения операции.', + 'confirm_mail_done' => 'Операция смены почты успешно выполнена.', + 'confirm_phone' => 'Ваш номер подтвержден, сменить его нельзя.', + 'confirm_phone_done' => 'Ваш номер уже подтвержден.', + 'confirm_phone_error' => 'Не удалось подтвердить номер.', - 'auth' => 'Вы уже авторизованы, обновите страницу.', - 'noauth' => 'Необходимо авторизоваться.', - ); + 'auth' => 'Вы уже авторизованы, обновите страницу.', + 'noauth' => 'Необходимо авторизоваться.', + ); ?> \ No newline at end of file diff --git a/system/data/text/servers.php b/system/data/text/servers.php index 50f51f0..98922ae 100644 --- a/system/data/text/servers.php +++ b/system/data/text/servers.php @@ -1,14 +1,14 @@ 'Игровой сервер выключен.', - 'nomap' => 'Отсутствует стартовая карта: [map].', - 'change' => 'Отсутствует выбранная карта: [map].', - 'reinstall' => 'Повторная переустановка возможна через [time].', - 'update' => 'Повторное обновление возможно через [time].', - 'firewall' => 'Неверный формат адреса.', - 'bans' => 'Неверный формат переданных данных.', - ); + $text = array( + 'off' => 'Игровой сервер выключен.', + 'nomap' => 'Отсутствует стартовая карта: [map].', + 'change' => 'Отсутствует выбранная карта: [map].', + 'reinstall' => 'Повторная переустановка возможна через [time].', + 'update' => 'Повторное обновление возможно через [time].', + 'firewall' => 'Неверный формат адреса.', + 'bans' => 'Неверный формат переданных данных.', + ); ?> \ No newline at end of file diff --git a/system/data/text/syslogs.php b/system/data/text/syslogs.php index e3bbf85..d3a1ae8 100644 --- a/system/data/text/syslogs.php +++ b/system/data/text/syslogs.php @@ -1,14 +1,14 @@ 'Переустановка игрового сервера.', - 'update' => 'Обновление игрового сервера.', - 'recovery' => 'Восстановление игрового сервера.', + $text = array( + 'reinstall' => 'Переустановка игрового сервера.', + 'update' => 'Обновление игрового сервера.', + 'recovery' => 'Восстановление игрового сервера.', - 'change_slots' => 'Изменение количества слот.', - 'change_plan' => 'Изменение тарифного плана.', - 'change_unit' => 'Изменение локации.', - ); + 'change_slots' => 'Изменение количества слот.', + 'change_plan' => 'Изменение тарифного плана.', + 'change_unit' => 'Изменение локации.', + ); ?> \ No newline at end of file diff --git a/system/data/web.php b/system/data/web.php index 6643f82..4e8b1c0 100644 --- a/system/data/web.php +++ b/system/data/web.php @@ -1,511 +1,511 @@ array( - #'update', - 'passwd', - 'delete', - 'connect' - ), - - 'csstats' => array( - #'update', - 'delete', - 'connect' - ), - - 'bp' => array( - #'update', - 'settings', - 'passwd', - 'delete' - ), - - 'astats' => array( - #'update', - 'delete', - 'connect' - ), - - 'sourcebans' => array( - #'update', - 'passwd', - 'delete', - 'connect' - ), - - 'mysql' => array( - 'install', - 'passwd', - 'delete' - ), - - 'hosting' => array( - 'install', - 'passwd', - 'delete' - ) - ); - - // Бесплатные доп. услуги - $aWeb = array( - 'cs' => array( - 'csbans' => true, - - 'bp' => true, - - 'csstats' => true, - 'astats' => true, - - 'mysql' => true, - 'hosting' => true - ), - - 'cssold' => array( - 'sourcebans' => false, - - 'mysql' => true, - 'hosting' => true - ), - - 'css' => array( - 'sourcebans' => true, - - 'mysql' => true, - 'hosting' => true - ), - - 'csgo' => array( - 'sourcebans' => true, - - 'mysql' => true, - 'hosting' => true - ), - - 'samp' => array( - 'mysql' => true, - 'hosting' => true - ), - - 'crmp' => array( - 'mysql' => true, - 'hosting' => true - ), - - 'mta' => array( - 'mysql' => true, - 'hosting' => true - ), - - 'mc' => array( - 'mysql' => true, - 'hosting' => true - ) - ); - - $aWebOne = array( - 'cs' => array( - 'csbans' => array(), - - 'bp' => array(), - - 'csstats' => array('astats'), - 'astats' => array('csstats'), - - 'mysql' => array(), - 'hosting' => array() - ), - - 'cssold' => array( - 'sourcebans' => array(), - 'mysql' => array(), - 'hosting' => array() - ), - - 'css' => array( - 'sourcebans' => array(), - 'mysql' => array(), - 'hosting' => array() - ), - - 'csgo' => array( - 'sourcebans' => array(), - 'mysql' => array(), - 'hosting' => array() - ), - - 'samp' => array( - 'mysql' => array(), - 'hosting' => array() - ), - - 'mta' => array( - 'mysql' => array(), - 'hosting' => array() - ), + exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404')); + + $aSub = array( + 'csbans', + 'bp', + 'csstats', + 'astats', + 'sourcebans', + 'mysql', + 'hosting' + ); + + $aAction = array( + 'csbans' => array( + #'update', + 'passwd', + 'delete', + 'connect' + ), + + 'csstats' => array( + #'update', + 'delete', + 'connect' + ), + + 'bp' => array( + #'update', + 'settings', + 'passwd', + 'delete' + ), + + 'astats' => array( + #'update', + 'delete', + 'connect' + ), + + 'sourcebans' => array( + #'update', + 'passwd', + 'delete', + 'connect' + ), + + 'mysql' => array( + 'install', + 'passwd', + 'delete' + ), + + 'hosting' => array( + 'install', + 'passwd', + 'delete' + ) + ); + + // Бесплатные доп. услуги + $aWeb = array( + 'cs' => array( + 'csbans' => true, + + 'bp' => true, + + 'csstats' => true, + 'astats' => true, + + 'mysql' => true, + 'hosting' => true + ), + + 'cssold' => array( + 'sourcebans' => false, + + 'mysql' => true, + 'hosting' => true + ), + + 'css' => array( + 'sourcebans' => true, + + 'mysql' => true, + 'hosting' => true + ), + + 'csgo' => array( + 'sourcebans' => true, + + 'mysql' => true, + 'hosting' => true + ), + + 'samp' => array( + 'mysql' => true, + 'hosting' => true + ), + + 'crmp' => array( + 'mysql' => true, + 'hosting' => true + ), + + 'mta' => array( + 'mysql' => true, + 'hosting' => true + ), + + 'mc' => array( + 'mysql' => true, + 'hosting' => true + ) + ); + + $aWebOne = array( + 'cs' => array( + 'csbans' => array(), + + 'bp' => array(), + + 'csstats' => array('astats'), + 'astats' => array('csstats'), + + 'mysql' => array(), + 'hosting' => array() + ), + + 'cssold' => array( + 'sourcebans' => array(), + 'mysql' => array(), + 'hosting' => array() + ), + + 'css' => array( + 'sourcebans' => array(), + 'mysql' => array(), + 'hosting' => array() + ), + + 'csgo' => array( + 'sourcebans' => array(), + 'mysql' => array(), + 'hosting' => array() + ), + + 'samp' => array( + 'mysql' => array(), + 'hosting' => array() + ), + + 'mta' => array( + 'mysql' => array(), + 'hosting' => array() + ), - 'mc' => array( - 'mysql' => array(), - 'hosting' => array() - ) - ); + 'mc' => array( + 'mysql' => array(), + 'hosting' => array() + ) + ); - $aWebInstall = array( - /* - 'unit' ==> одна услуга на одной локации + $aWebInstall = array( + /* + 'unit' ==> одна услуга на одной локации - 'user' ==> одна услуга на одного пользователя + 'user' ==> одна услуга на одного пользователя - 'server' ==> каждая услуга на каждый игровой сервер - */ - 'system' => array( - 'csbans' => 'server', - 'csstats' => 'server', - 'bp' => 'server', - 'astats' => 'server', - 'sourcebans' => 'server', - 'mysql' => 'server', - 'hosting' => 'server' - ), - - 'cs' => array( - 'csbans' => 'unit', - - 'bp' => 'user', - - 'csstats' => 'server', - 'astats' => 'unit', - - 'mysql' => 'server', - 'hosting' => 'user' - ), - - 'cssold' => array( - 'sourcebans' => 'unit', - - 'mysql' => 'server', - 'hosting' => 'user' - ), - - 'css' => array( - 'sourcebans' => 'unit', - - 'mysql' => 'server', - 'hosting' => 'user' - ), - - 'csgo' => array( - 'sourcebans' => 'unit', - - 'mysql' => 'server', - 'hosting' => 'user' - ), - - 'samp' => array( - 'mysql' => 'server', - 'hosting' => 'user' - ), - - 'crmp' => array( - 'mysql' => 'server', - 'hosting' => 'user' - ), - - 'mta' => array( - 'mysql' => 'server', - 'hosting' => 'user' - ), - - 'mc' => array( - 'mysql' => 'server', - 'hosting' => 'user' - ) - ); - - $aWebname = array( - 'csbans' => 'СS:Bans 1.3', - - 'bp' => 'Buy Privileges', - - 'csstats' => 'CsStats', - 'astats' => 'AStats', - - 'sourcebans' => 'SourceBans', - - 'mysql' => 'MySQL', - 'hosting' => 'WebHosting' - ); - - $aWebDesc = array( - 'csbans' => 'система контроля наказаний игроков на серверах (замена amxbans).', - - 'bp' => 'многофункциональная система продажи привилегий.', - - 'csstats' => 'подробная статистика игроков, для одного сервера.', - 'astats' => 'выводит топ игроков на веб странице.', - - 'sourcebans' => 'система контроля наказаний игроков на серверах.', - - 'mysql' => 'свободная реляционная система управления базами данных.', - 'hosting' => 'услуга для размещения сайта, форума или обычных файлов в сети.' - ); - - $aWebType = array( - 'csbans' => 'bans', - 'sourcebans' => 'bans', - - 'csstats' => 'stats', - 'astats' => 'stats', - - 'bp' => 'other', - 'mysql' => 'other', - 'hosting' => 'other' - ); - - $aWebTypeInfo = array( - 'cs' => array( - 'bans' => 'Системы управления банами', - 'stats' => 'Статистика', - 'other' => 'Прочее' - ), - - 'cssold' => array( - 'bans' => 'Системы управления банами', - 'stats' => 'Статистика', - 'other' => 'Прочее' - ), - - 'css' => array( - 'bans' => 'Системы управления банами', - 'stats' => 'Статистика', - 'other' => 'Прочее' - ), - - 'csgo' => array( - 'bans' => 'Системы управления банами', - 'stats' => 'Статистика', - 'other' => 'Прочее' - ), - - 'samp' => array( - 'other' => 'Прочее' - ), - - 'crmp' => array( - 'other' => 'Прочее' - ), - - 'mta' => array( - 'other' => 'Прочее' - ), - - 'mc' => array( - 'other' => 'Прочее' - ) - ); - - $aWebParam = array( - 'csbans' => array( - 'passwd' => 10, - 'desing' => array( - 'default' => 'Default' - ), - ), - - 'csstats' => array( - 'desing' => array( - 'default' => 'Default' - ), - ), - - 'astats' => array( - 'desing' => array( - 'default' => 'Default' - ), - ), - - 'sourcebans' => array( - 'passwd' => 10, - 'desing' => array( - 'default' => 'Default' - ), - ), - - 'mysql' => array( - 'passwd' => 10, - ), - - 'hosting' => array( - 'passwd' => 10, - ) - ); - - $aWebVHTtype = true; // Разрешен ли всем вирт. хостинг - $aWebVHT = array( // Массив списка tarif_id зависит от значения VHT, если VHT true, то перечисленным id тарифов недоступен вирт. хост или наоборот. - - ); - - $aWebUnit = array( - 'address' => '127.0.0.1:22', // ip:22 web сервера - 'passwd' => 'kgdfgjksad', // пароль ssh root - 'pma' => '127.0.0.1', // Домен || ip без http / pma / index.php и т.д. - 'domains' => array( - 'domain.ru', - ), - 'subdomains' => array( // список поддоменов, которые нельзя создать - 'panel', 'admin' - ), - - 'isp' => array( - 'panel' => 'ip/manager', // https://_ЗНАЧЕНИЕ_ (панель управления вирт. хостинга ISP MANAGER PRO 4) - - 'domain' => array( - 'create' => 'http://IP:1500/?authinfo=root:password&out=json&name=[subdomain].[domain].&sdtype=A&addr=[ip]&prio=&wght=&port=&func=domain.sublist.edit&elid=&plid=[domain]&sok=ok', - 'delete' => 'http://IP:1500/?authinfo=root:password&out=json&func=domain.sublist.delete&elid=[subdomain].+A++[ip]&plid=[domain]&sok=ok', - ), - - 'account' => array( - 'create' => 'http://IP:1500/?authinfo=root:password&out=json&name=[login]&passwd=[passwd]&confirm=[passwd]&owner=root&ip=IP&domain=[domain]&preset=default&email=[mail]&phpmod=on&func=user.edit&elid=&sok=ok', - 'passwd' => 'http://IP:1500/?authinfo=root:password&out=json&name=[login]&passwd=[passwd]&confirm=[passwd]&preset=default&email=[mail]&disklimit=1000&phpmod=on&func=user.edit&elid=[login]&sok=ok', - 'delete' => 'http://IP:1500/?authinfo=root:password&out=json&func=user.delete&elid=[login]&sok=ok', - ), - - 'crontab' => array( - 'bp' => array( - 'install' => 'http://IP:1500/?authinfo=root:password&out=json&min=*&hour=*&mday=*&month=*&wday=*&name=/usr/bin/wget+http://[subdomain].[domain]/cron.php?cron=874319&period=daily&crmin=all&evmin=02&semin=&crhour=all&evhour=02&sehour=&crmday=all&evmday=02&semday=&crmonth=all&evmonth=02&semonth=&crwday=all&evwday=02&sewday=&hideout=on&func=cron.edit&elid=&sok=ok', - 'delete' => 'http://IP:1500/?authinfo=root:password&out=json&elid=[data]&func=cron.delete&sok=ok' - ) - ) - ), - - 'unit' => array( - 'csbans' => 'remote', - 'csstats' => 'remote', - 'astats' => 'remote', - 'sourcebans' => 'remote', - 'mysql' => 'remote' - ), - - 'path' => array( - 'local' => array( - 'csbans' => '/path/web/csbans/', - 'csstats' => '/path/web/csstats/', - 'astats' => '/path/web/astats/', - 'sourcebans' => '/path/web/sourcebans/' - ), - - 'remote' => array( - 'csbans' => '/path/web/csbans/', - 'csstats' => '/path/web/csstats/', - 'astats' => '/path/web/astats/', - 'sourcebans' => '/path/web/sourcebans/' - ), - ), - - 'install' => array( - 'local' => array( - 'csbans' => '/var/www/', - 'csstats' => '/var/www/', - 'astats' => '/var/www/', - 'sourcebans' => '/var/www/' - ), - - 'remote' => array( - 'csbans' => '/var/www/web/', - 'csstats' => '/var/www/web/', - 'astats' => '/var/www/web/', - 'sourcebans' => '/var/www/web/' - ) - ) - ); - - $aWebConnect = array( - 'csbans' => array( - 'cs' => 0 // id плагина - ), - - 'csstats' => array( - 'cs' => 0 - ), - - 'sourcebans' => array( - 'cssold' => 0, - 'css' => 0, - 'csgo' => 0, - ) - ); - - $aWebChmod = array( - 'csbans' => 'chmod 777 assets protected/runtime', - 'csstats' => '', - 'astats' => 'chmod 777 ftpcache', - 'sourcebans' => 'chmod 777 demos themes_c' - ); - - $aWebSQL = array( - 'csbans' => array( - 'install' => array( - "INSERT INTO amx_webadmins set id='1', username='admin', password=MD5('[passwd]'), level='1', email='[mail]'", - ), - - 'connect' => array( - "DELETE FROM amx_serverinfo WHERE address='[address]'", - "INSERT INTO amx_serverinfo set timestamp='[time]', hostname='[name]', rcon='[rcon]', address='[address]', gametype='cstrike', amxban_version='1.6', motd_delay='10', amxban_menu='1'" - ), - - 'passwd' => array( - "UPDATE amx_webadmins set password=MD5('[passwd]') WHERE id='1' LIMIT 1" - ) - ), - - 'sourcebans' => array( - 'install' => array( - "INSERT INTO sb_admins set aid='1', user='admin', authid='', password=SHA1(SHA1('SourceBans[passwd]')), gid='-1', email='[mail]', extraflags='-513'" - ), - - 'connect' => array( - "DELETE FROM sb_servers WHERE ip='[ip]' and port='[port]'", - "INSERT INTO sb_servers set ip='[ip]', port='[port]', rcon='[rcon]', modid='3', enabled='1'" - ), - - 'passwd' => array( - "UPDATE sb_admins set password=SHA1(SHA1('SourceBans[passwd]')) WHERE aid='1' LIMIT 1" - ) - ), - - 'csstats' => array() - ); - - $aWebdbConf = array( - 'csbans' => array( - 'file' => '/include/db.config.inc.php', - 'chmod' => 0644 - ), - - 'csstats' => array( - 'file' => '/include/config.php', - 'chmod' => 0644 - ), - - 'sourcebans' => array( - 'file' => '/config.php', - 'chmod' => 0644 - ) - ); - - $aWebothPath = array( - - ); + 'server' ==> каждая услуга на каждый игровой сервер + */ + 'system' => array( + 'csbans' => 'server', + 'csstats' => 'server', + 'bp' => 'server', + 'astats' => 'server', + 'sourcebans' => 'server', + 'mysql' => 'server', + 'hosting' => 'server' + ), + + 'cs' => array( + 'csbans' => 'unit', + + 'bp' => 'user', + + 'csstats' => 'server', + 'astats' => 'unit', + + 'mysql' => 'server', + 'hosting' => 'user' + ), + + 'cssold' => array( + 'sourcebans' => 'unit', + + 'mysql' => 'server', + 'hosting' => 'user' + ), + + 'css' => array( + 'sourcebans' => 'unit', + + 'mysql' => 'server', + 'hosting' => 'user' + ), + + 'csgo' => array( + 'sourcebans' => 'unit', + + 'mysql' => 'server', + 'hosting' => 'user' + ), + + 'samp' => array( + 'mysql' => 'server', + 'hosting' => 'user' + ), + + 'crmp' => array( + 'mysql' => 'server', + 'hosting' => 'user' + ), + + 'mta' => array( + 'mysql' => 'server', + 'hosting' => 'user' + ), + + 'mc' => array( + 'mysql' => 'server', + 'hosting' => 'user' + ) + ); + + $aWebname = array( + 'csbans' => 'СS:Bans 1.3', + + 'bp' => 'Buy Privileges', + + 'csstats' => 'CsStats', + 'astats' => 'AStats', + + 'sourcebans' => 'SourceBans', + + 'mysql' => 'MySQL', + 'hosting' => 'WebHosting' + ); + + $aWebDesc = array( + 'csbans' => 'система контроля наказаний игроков на серверах (замена amxbans).', + + 'bp' => 'многофункциональная система продажи привилегий.', + + 'csstats' => 'подробная статистика игроков, для одного сервера.', + 'astats' => 'выводит топ игроков на веб странице.', + + 'sourcebans' => 'система контроля наказаний игроков на серверах.', + + 'mysql' => 'свободная реляционная система управления базами данных.', + 'hosting' => 'услуга для размещения сайта, форума или обычных файлов в сети.' + ); + + $aWebType = array( + 'csbans' => 'bans', + 'sourcebans' => 'bans', + + 'csstats' => 'stats', + 'astats' => 'stats', + + 'bp' => 'other', + 'mysql' => 'other', + 'hosting' => 'other' + ); + + $aWebTypeInfo = array( + 'cs' => array( + 'bans' => 'Системы управления банами', + 'stats' => 'Статистика', + 'other' => 'Прочее' + ), + + 'cssold' => array( + 'bans' => 'Системы управления банами', + 'stats' => 'Статистика', + 'other' => 'Прочее' + ), + + 'css' => array( + 'bans' => 'Системы управления банами', + 'stats' => 'Статистика', + 'other' => 'Прочее' + ), + + 'csgo' => array( + 'bans' => 'Системы управления банами', + 'stats' => 'Статистика', + 'other' => 'Прочее' + ), + + 'samp' => array( + 'other' => 'Прочее' + ), + + 'crmp' => array( + 'other' => 'Прочее' + ), + + 'mta' => array( + 'other' => 'Прочее' + ), + + 'mc' => array( + 'other' => 'Прочее' + ) + ); + + $aWebParam = array( + 'csbans' => array( + 'passwd' => 10, + 'desing' => array( + 'default' => 'Default' + ), + ), + + 'csstats' => array( + 'desing' => array( + 'default' => 'Default' + ), + ), + + 'astats' => array( + 'desing' => array( + 'default' => 'Default' + ), + ), + + 'sourcebans' => array( + 'passwd' => 10, + 'desing' => array( + 'default' => 'Default' + ), + ), + + 'mysql' => array( + 'passwd' => 10, + ), + + 'hosting' => array( + 'passwd' => 10, + ) + ); + + $aWebVHTtype = true; // Разрешен ли всем вирт. хостинг + $aWebVHT = array( // Массив списка tarif_id зависит от значения VHT, если VHT true, то перечисленным id тарифов недоступен вирт. хост или наоборот. + + ); + + $aWebUnit = array( + 'address' => '127.0.0.1:22', // ip:22 web сервера + 'passwd' => 'kgdfgjksad', // пароль ssh root + 'pma' => '127.0.0.1', // Домен || ip без http / pma / index.php и т.д. + 'domains' => array( + 'domain.ru', + ), + 'subdomains' => array( // список поддоменов, которые нельзя создать + 'panel', 'admin' + ), + + 'isp' => array( + 'panel' => 'ip/manager', // https://_ЗНАЧЕНИЕ_ (панель управления вирт. хостинга ISP MANAGER PRO 4) + + 'domain' => array( + 'create' => 'http://IP:1500/?authinfo=root:password&out=json&name=[subdomain].[domain].&sdtype=A&addr=[ip]&prio=&wght=&port=&func=domain.sublist.edit&elid=&plid=[domain]&sok=ok', + 'delete' => 'http://IP:1500/?authinfo=root:password&out=json&func=domain.sublist.delete&elid=[subdomain].+A++[ip]&plid=[domain]&sok=ok', + ), + + 'account' => array( + 'create' => 'http://IP:1500/?authinfo=root:password&out=json&name=[login]&passwd=[passwd]&confirm=[passwd]&owner=root&ip=IP&domain=[domain]&preset=default&email=[mail]&phpmod=on&func=user.edit&elid=&sok=ok', + 'passwd' => 'http://IP:1500/?authinfo=root:password&out=json&name=[login]&passwd=[passwd]&confirm=[passwd]&preset=default&email=[mail]&disklimit=1000&phpmod=on&func=user.edit&elid=[login]&sok=ok', + 'delete' => 'http://IP:1500/?authinfo=root:password&out=json&func=user.delete&elid=[login]&sok=ok', + ), + + 'crontab' => array( + 'bp' => array( + 'install' => 'http://IP:1500/?authinfo=root:password&out=json&min=*&hour=*&mday=*&month=*&wday=*&name=/usr/bin/wget+http://[subdomain].[domain]/cron.php?cron=874319&period=daily&crmin=all&evmin=02&semin=&crhour=all&evhour=02&sehour=&crmday=all&evmday=02&semday=&crmonth=all&evmonth=02&semonth=&crwday=all&evwday=02&sewday=&hideout=on&func=cron.edit&elid=&sok=ok', + 'delete' => 'http://IP:1500/?authinfo=root:password&out=json&elid=[data]&func=cron.delete&sok=ok' + ) + ) + ), + + 'unit' => array( + 'csbans' => 'remote', + 'csstats' => 'remote', + 'astats' => 'remote', + 'sourcebans' => 'remote', + 'mysql' => 'remote' + ), + + 'path' => array( + 'local' => array( + 'csbans' => '/path/web/csbans/', + 'csstats' => '/path/web/csstats/', + 'astats' => '/path/web/astats/', + 'sourcebans' => '/path/web/sourcebans/' + ), + + 'remote' => array( + 'csbans' => '/path/web/csbans/', + 'csstats' => '/path/web/csstats/', + 'astats' => '/path/web/astats/', + 'sourcebans' => '/path/web/sourcebans/' + ), + ), + + 'install' => array( + 'local' => array( + 'csbans' => '/var/www/', + 'csstats' => '/var/www/', + 'astats' => '/var/www/', + 'sourcebans' => '/var/www/' + ), + + 'remote' => array( + 'csbans' => '/var/www/web/', + 'csstats' => '/var/www/web/', + 'astats' => '/var/www/web/', + 'sourcebans' => '/var/www/web/' + ) + ) + ); + + $aWebConnect = array( + 'csbans' => array( + 'cs' => 0 // id плагина + ), + + 'csstats' => array( + 'cs' => 0 + ), + + 'sourcebans' => array( + 'cssold' => 0, + 'css' => 0, + 'csgo' => 0, + ) + ); + + $aWebChmod = array( + 'csbans' => 'chmod 777 assets protected/runtime', + 'csstats' => '', + 'astats' => 'chmod 777 ftpcache', + 'sourcebans' => 'chmod 777 demos themes_c' + ); + + $aWebSQL = array( + 'csbans' => array( + 'install' => array( + "INSERT INTO amx_webadmins set id='1', username='admin', password=MD5('[passwd]'), level='1', email='[mail]'", + ), + + 'connect' => array( + "DELETE FROM amx_serverinfo WHERE address='[address]'", + "INSERT INTO amx_serverinfo set timestamp='[time]', hostname='[name]', rcon='[rcon]', address='[address]', gametype='cstrike', amxban_version='1.6', motd_delay='10', amxban_menu='1'" + ), + + 'passwd' => array( + "UPDATE amx_webadmins set password=MD5('[passwd]') WHERE id='1' LIMIT 1" + ) + ), + + 'sourcebans' => array( + 'install' => array( + "INSERT INTO sb_admins set aid='1', user='admin', authid='', password=SHA1(SHA1('SourceBans[passwd]')), gid='-1', email='[mail]', extraflags='-513'" + ), + + 'connect' => array( + "DELETE FROM sb_servers WHERE ip='[ip]' and port='[port]'", + "INSERT INTO sb_servers set ip='[ip]', port='[port]', rcon='[rcon]', modid='3', enabled='1'" + ), + + 'passwd' => array( + "UPDATE sb_admins set password=SHA1(SHA1('SourceBans[passwd]')) WHERE aid='1' LIMIT 1" + ) + ), + + 'csstats' => array() + ); + + $aWebdbConf = array( + 'csbans' => array( + 'file' => '/include/db.config.inc.php', + 'chmod' => 0644 + ), + + 'csstats' => array( + 'file' => '/include/config.php', + 'chmod' => 0644 + ), + + 'sourcebans' => array( + 'file' => '/config.php', + 'chmod' => 0644 + ) + ); + + $aWebothPath = array( + + ); ?> \ No newline at end of file diff --git a/system/engine/api.php b/system/engine/api.php index 524c99d..244b0b3 100644 --- a/system/engine/api.php +++ b/system/engine/api.php @@ -1,46 +1,46 @@ 'ключ не указан')); - $action = isset($url['action']) ? $url['action'] : sys::outjs(array('e' => 'метод не указан')); + $key = isset($url['key']) ? $url['key'] : sys::outjs(array('e' => 'ключ не указан')); + $action = isset($url['action']) ? $url['action'] : sys::outjs(array('e' => 'метод не указан')); - if(sys::valid($key, 'md5')) - sys::outjs(array('e' => 'ключ имеет неправильный формат')); + if(sys::valid($key, 'md5')) + sys::outjs(array('e' => 'ключ имеет неправильный формат')); - $sql->query('SELECT `id`, `server` FROM `api` WHERE `key`="'.$key.'" LIMIT 1'); - if(!$sql->num()) - sys::outjs(array('e' => 'ключ не найден')); + $sql->query('SELECT `id`, `server` FROM `api` WHERE `key`="'.$key.'" LIMIT 1'); + if(!$sql->num()) + sys::outjs(array('e' => 'ключ не найден')); - $api = $sql->get(); + $api = $sql->get(); - $id = $api['server']; + $id = $api['server']; - include(LIB.'games/games.php'); - include(LIB.'api.php'); + include(LIB.'games/games.php'); + include(LIB.'api.php'); - if(in_array($action, array('start', 'restart', 'stop', 'change', 'reinstall', 'update'))) - { - $sql->query('SELECT `id` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); - if(!$sql->num()) - sys::outjs(array('e' => 'сервер не найден')); + if(in_array($action, array('start', 'restart', 'stop', 'change', 'reinstall', 'update'))) + { + $sql->query('SELECT `id` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); + if(!$sql->num()) + sys::outjs(array('e' => 'сервер не найден')); - include(SEC.'servers/action.php'); - } + include(SEC.'servers/action.php'); + } - switch($action) - { - case 'data': - sys::outjs(api::data($id)); + switch($action) + { + case 'data': + sys::outjs(api::data($id)); - case 'load': - sys::outjs(api::load($id)); + case 'load': + sys::outjs(api::load($id)); - case 'console': - $cmd = isset($url['command']) ? $url['command'] : false; + case 'console': + $cmd = isset($url['command']) ? $url['command'] : false; - sys::outjs(api::console($id, $cmd)); - } + sys::outjs(api::console($id, $cmd)); + } - sys::outjs(array('e' => 'Метод не найден')); + sys::outjs(array('e' => 'Метод не найден')); ?> \ No newline at end of file diff --git a/system/engine/api_v1.php b/system/engine/api_v1.php index 992f9e7..e2beb57 100644 --- a/system/engine/api_v1.php +++ b/system/engine/api_v1.php @@ -1,10 +1,10 @@ nav($title); + $title = 'API интерфейс'; + $html->nav($title); - $html->get('api'); - $html->pack('main'); + $html->get('api'); + $html->pack('main'); ?> \ No newline at end of file diff --git a/system/engine/autocontrol.php b/system/engine/autocontrol.php index 6991bb3..2025e84 100644 --- a/system/engine/autocontrol.php +++ b/system/engine/autocontrol.php @@ -1,75 +1,75 @@ query('SELECT `id` FROM `control` WHERE `address`="'.$uip.'" LIMIT 1'); - if(!$sql->num()) - sys::out($uip); + switch($url['action']) + { + case 'script': + $sql->query('SELECT `id` FROM `control` WHERE `address`="'.$uip.'" LIMIT 1'); + if(!$sql->num()) + sys::out($uip); - $del = false; - $tmp = DATA.'control/egpautounit.sh'; + $del = false; + $tmp = DATA.'control/egpautounit.sh'; - break; + break; - case 'sqlpasswd': - $sql->query('SELECT `id`, `sql_passwd` FROM `control` WHERE `address`="'.$uip.'" LIMIT 1'); - if(!$sql->num()) - include(ENG.'404.php'); + case 'sqlpasswd': + $sql->query('SELECT `id`, `sql_passwd` FROM `control` WHERE `address`="'.$uip.'" LIMIT 1'); + if(!$sql->num()) + include(ENG.'404.php'); - $unit = $sql->get(); + $unit = $sql->get(); - if($unit['sql_passwd']) - $tmp = sys::temp($unit['sql_passwd']); - else{ - $passwd = sys::passwd(); - $tmp = sys::temp($passwd); - $sql->query('UPDATE `control` set `sql_passwd`="'.$passwd.'" WHERE `id`="'.$unit['id'].'" LIMIT 1'); - } + if($unit['sql_passwd']) + $tmp = sys::temp($unit['sql_passwd']); + else{ + $passwd = sys::passwd(); + $tmp = sys::temp($passwd); + $sql->query('UPDATE `control` set `sql_passwd`="'.$passwd.'" WHERE `id`="'.$unit['id'].'" LIMIT 1'); + } - break; + break; - case 'proftpd_sql': - $sql->query('SELECT `id`, `sql_passwd` FROM `control` WHERE `address`="'.$uip.'" LIMIT 1'); - if(!$sql->num()) - include(ENG.'404.php'); + case 'proftpd_sql': + $sql->query('SELECT `id`, `sql_passwd` FROM `control` WHERE `address`="'.$uip.'" LIMIT 1'); + if(!$sql->num()) + include(ENG.'404.php'); - $unit = $sql->get(); + $unit = $sql->get(); - $data = file_get_contents(DATA.'control/proftpd_sql.txt'); - $tmp = sys::temp(str_replace('[passwd]', $unit['sql_passwd'], $data)); + $data = file_get_contents(DATA.'control/proftpd_sql.txt'); + $tmp = sys::temp(str_replace('[passwd]', $unit['sql_passwd'], $data)); - break; + break; - case 'proftpd_passwd': - $sql->query('SELECT `id`, `sql_passwd` FROM `control` WHERE `address`="'.$uip.'" LIMIT 1'); - if(!$sql->num()) - include(ENG.'404.php'); + case 'proftpd_passwd': + $sql->query('SELECT `id`, `sql_passwd` FROM `control` WHERE `address`="'.$uip.'" LIMIT 1'); + if(!$sql->num()) + include(ENG.'404.php'); - $unit = $sql->get(); + $unit = $sql->get(); - $data = file_get_contents(DATA.'control/proftpd_passwd.txt'); - $tmp = sys::temp(str_replace(array('[passwd]', '[passwd_ftp]'), array($unit['sql_passwd'], sys::passwd()), $data)); + $data = file_get_contents(DATA.'control/proftpd_passwd.txt'); + $tmp = sys::temp(str_replace(array('[passwd]', '[passwd_ftp]'), array($unit['sql_passwd'], sys::passwd()), $data)); - break; + break; - case 'endinstall': - $sql->query('UPDATE `control` set `status`="reboot" WHERE `address`="'.$uip.'" LIMIT 1'); + case 'endinstall': + $sql->query('UPDATE `control` set `status`="reboot" WHERE `address`="'.$uip.'" LIMIT 1'); - sys::out('ok:'.$uip); + sys::out('ok:'.$uip); - default: - sys::outfile(DATA.'control/'.$url['action'].'.txt', $url['action']); - } + default: + sys::outfile(DATA.'control/'.$url['action'].'.txt', $url['action']); + } - sys::outfile($tmp, $url['action'], $del); + sys::outfile($tmp, $url['action'], $del); ?> \ No newline at end of file diff --git a/system/engine/chat.php b/system/engine/chat.php index 877d7b8..5d7930c 100644 --- a/system/engine/chat.php +++ b/system/engine/chat.php @@ -1,10 +1,10 @@ \ No newline at end of file diff --git a/system/engine/contacts.php b/system/engine/contacts.php index 561d4da..d35d4fc 100644 --- a/system/engine/contacts.php +++ b/system/engine/contacts.php @@ -1,11 +1,11 @@ nav($title); + $html->nav($title); - $html->get('contacts'); - $html->pack('main'); + $html->get('contacts'); + $html->pack('main'); ?> \ No newline at end of file diff --git a/system/engine/control.php b/system/engine/control.php index 1606729..7cfb171 100644 --- a/system/engine/control.php +++ b/system/engine/control.php @@ -1,72 +1,72 @@ query('SELECT `id`, `user`, `status`, `time` FROM `control` WHERE `id`="'.$id.'" LIMIT 1'); - else - $sql->query('SELECT `id`, `user`, `status`, `time` FROM `control` WHERE `id`="'.$id.' AND `user`="'.$user['id'].'" LIMIT 1'); + if($id) + { + if($user['group'] == 'admin') + $sql->query('SELECT `id`, `user`, `status`, `time` FROM `control` WHERE `id`="'.$id.'" LIMIT 1'); + else + $sql->query('SELECT `id`, `user`, `status`, `time` FROM `control` WHERE `id`="'.$id.' AND `user`="'.$user['id'].'" LIMIT 1'); - if(!$sql->num()) - { - if($go) - sys::outjs(array('e' => 'Сервер #'.$id.' не найден')); + if(!$sql->num()) + { + if($go) + sys::outjs(array('e' => 'Сервер #'.$id.' не найден')); - sys::back($cfg['http'].'control'); - } + sys::back($cfg['http'].'control'); + } - $ctrl = $sql->get(); + $ctrl = $sql->get(); - if(in_array($ctrl['status'], array('install', 'overdue', 'blocked', 'reboot')) && !in_array($section, array('extend', 'scan'))) - include(SEC.'control/noaccess.php'); - else{ - if(!$section) - $section = 'index'; + if(in_array($ctrl['status'], array('install', 'overdue', 'blocked', 'reboot')) && !in_array($section, array('extend', 'scan'))) + include(SEC.'control/noaccess.php'); + else{ + if(!$section) + $section = 'index'; - $sid = array_key_exists('server', $url) ? sys::int($url['server']) : false; + $sid = array_key_exists('server', $url) ? sys::int($url['server']) : false; - if($sid) - include(SEC.'control/servers/'.$section.'.php'); - else - include(SEC.'control/'.$section.'.php'); - } - }else{ - $html->nav($title); + if($sid) + include(SEC.'control/servers/'.$section.'.php'); + else + include(SEC.'control/'.$section.'.php'); + } + }else{ + $html->nav($title); - $js = ''; + $js = ''; - $ctrls = $sql->query('SELECT `id`, `address`, `passwd`, `time`, `date`, `status` FROM `control` WHERE `user`="'.$user['id'].'"'); - while($ctrl = $sql->get($ctrls)) - { - $time_end = $ctrl['status'] == 'overdue' ? 'Удаление через: '.sys::date('min', $ctrl['overdue']+$cfg['control_delete']*86400) : 'Осталось: '.sys::date('min', $ctrl['time']); - $btn = ctrl::buttons($ctrl['id'], $ctrl['status']); + $ctrls = $sql->query('SELECT `id`, `address`, `passwd`, `time`, `date`, `status` FROM `control` WHERE `user`="'.$user['id'].'"'); + while($ctrl = $sql->get($ctrls)) + { + $time_end = $ctrl['status'] == 'overdue' ? 'Удаление через: '.sys::date('min', $ctrl['overdue']+$cfg['control_delete']*86400) : 'Осталось: '.sys::date('min', $ctrl['time']); + $btn = ctrl::buttons($ctrl['id'], $ctrl['status']); - $html->get('control', 'sections/control'); - $html->set('id', $ctrl['id']); - $html->set('address', $ctrl['address']); - $html->set('passwd', $ctrl['passwd']); - $html->set('time', sys::today($ctrl['time'])); - $html->set('date', sys::today($ctrl['date'])); - $html->set('time_end', $time_end); - $html->set('status', ctrl::status($ctrl['status'])); - $html->set('btn', $btn); - $html->pack('list'); + $html->get('control', 'sections/control'); + $html->set('id', $ctrl['id']); + $html->set('address', $ctrl['address']); + $html->set('passwd', $ctrl['passwd']); + $html->set('time', sys::today($ctrl['time'])); + $html->set('date', sys::today($ctrl['date'])); + $html->set('time_end', $time_end); + $html->set('status', ctrl::status($ctrl['status'])); + $html->set('btn', $btn); + $html->pack('list'); - $js .= 'update_resources('.$ctrl['id'].', true);'; - } + $js .= 'update_resources('.$ctrl['id'].', true);'; + } - $html->get('controls', 'sections/control'); - $html->set('list', isset($html->arr['list']) ? $html->arr['list'] : 'У вас нет подключенных серверов', true); - $html->set('updates_control', $js); - $html->pack('main'); - } + $html->get('controls', 'sections/control'); + $html->set('list', isset($html->arr['list']) ? $html->arr['list'] : 'У вас нет подключенных серверов', true); + $html->set('updates_control', $js); + $html->pack('main'); + } ?> \ No newline at end of file diff --git a/system/engine/freekassa.php b/system/engine/freekassa.php index 64b5672..a27ed61 100644 --- a/system/engine/freekassa.php +++ b/system/engine/freekassa.php @@ -1,91 +1,91 @@ query('SELECT `id`, `server`, `price` FROM `privileges_buy` WHERE `key`="'.$_POST['us_user'].'" LIMIT 1'); - if(!$sql->num()) - sys::out('bad key'); + // Оплата по ключу + if(!sys::valid($_POST['us_user'], 'md5')) + { + $sql->query('SELECT `id`, `server`, `price` FROM `privileges_buy` WHERE `key`="'.$_POST['us_user'].'" LIMIT 1'); + if(!$sql->num()) + sys::out('bad key'); - $privilege = $sql->get(); + $privilege = $sql->get(); - $money = round($sum*$cfg['curinrub'], 2); + $money = round($sum*$cfg['curinrub'], 2); - if($money < $privilege['price']) - sys::out('bad sum'); + if($money < $privilege['price']) + sys::out('bad sum'); - $sql->query('SELECT `user` FROM `servers` WHERE `id`="'.$privilege['server'].'" LIMIT 1'); - if(!$sql->num()) - sys::out('bad server'); + $sql->query('SELECT `user` FROM `servers` WHERE `id`="'.$privilege['server'].'" LIMIT 1'); + if(!$sql->num()) + sys::out('bad server'); - $server = $sql->get(); + $server = $sql->get(); - $sql->query('SELECT `id`, `balance`, `part_money` FROM `users` WHERE `id`="'.$server['user'].'" LIMIT 1'); - if(!$sql->num()) - sys::out('bad owner'); + $sql->query('SELECT `id`, `balance`, `part_money` FROM `users` WHERE `id`="'.$server['user'].'" LIMIT 1'); + if(!$sql->num()) + sys::out('bad owner'); - $user = $sql->get(); + $user = $sql->get(); - if($cfg['part_money']) - $sql->query('UPDATE `users` set `part_money`="'.($user['part_money']+$money).'" WHERE `id`="'.$user['id'].'" LIMIT 1'); - else - $sql->query('UPDATE `users` set `balance`="'.($user['balance']+$money).'" WHERE `id`="'.$user['id'].'" LIMIT 1'); + if($cfg['part_money']) + $sql->query('UPDATE `users` set `part_money`="'.($user['part_money']+$money).'" WHERE `id`="'.$user['id'].'" LIMIT 1'); + else + $sql->query('UPDATE `users` set `balance`="'.($user['balance']+$money).'" WHERE `id`="'.$user['id'].'" LIMIT 1'); - $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="'.sys::updtext(sys::text('logs', 'profit'), - array('server' => $privilege['server'], 'money' => $money)).'", `date`="'.$start_point.'", `type`="part", `money`="'.$money.'"'); + $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="'.sys::updtext(sys::text('logs', 'profit'), + array('server' => $privilege['server'], 'money' => $money)).'", `date`="'.$start_point.'", `type`="part", `money`="'.$money.'"'); - $sql->query('UPDATE `privileges_buy` set `status`="1" WHERE `id`="'.$privilege['id'].'" LIMIT 1'); + $sql->query('UPDATE `privileges_buy` set `status`="1" WHERE `id`="'.$privilege['id'].'" LIMIT 1'); - sys::out('YES'); - } + sys::out('YES'); + } - $user = intval($_POST['us_user']); + $user = intval($_POST['us_user']); - $sql->query('SELECT `id`, `balance`, `part` FROM `users` WHERE `id`="'.$user.'" LIMIT 1'); - if(!$sql->num()) - sys::out('bad user'); + $sql->query('SELECT `id`, `balance`, `part` FROM `users` WHERE `id`="'.$user.'" LIMIT 1'); + if(!$sql->num()) + sys::out('bad user'); - $user = $sql->get(); + $user = $sql->get(); - $money = round($user['balance']+$sum*$cfg['curinrub'], 2); + $money = round($user['balance']+$sum*$cfg['curinrub'], 2); - if($cfg['part']) - { - $part_sum = round($sum/100*$cfg['part_proc'], 2); + if($cfg['part']) + { + $part_sum = round($sum/100*$cfg['part_proc'], 2); - $sql->query('SELECT `balance`, `part_money` FROM `users` WHERE `id`="'.$user['part'].'" LIMIT 1'); - if($sql->num()) - { - $part = $sql->get(); + $sql->query('SELECT `balance`, `part_money` FROM `users` WHERE `id`="'.$user['part'].'" LIMIT 1'); + if($sql->num()) + { + $part = $sql->get(); - if($cfg['part_money']) - $sql->query('UPDATE `users` set `part_money`="'.($part['part_money']+$part_sum).'" WHERE `id`="'.$user['part'].'" LIMIT 1'); - else - $sql->query('UPDATE `users` set `balance`="'.($part['balance']+$part_sum).'" WHERE `id`="'.$user['part'].'" LIMIT 1'); + if($cfg['part_money']) + $sql->query('UPDATE `users` set `part_money`="'.($part['part_money']+$part_sum).'" WHERE `id`="'.$user['part'].'" LIMIT 1'); + else + $sql->query('UPDATE `users` set `balance`="'.($part['balance']+$part_sum).'" WHERE `id`="'.$user['part'].'" LIMIT 1'); - $sql->query('INSERT INTO `logs` set `user`="'.$user['part'].'", `text`="'.sys::updtext(sys::text('logs', 'part'), - array('part' => $uid, 'money' => $part_sum)).'", `date`="'.$start_point.'", `type`="part", `money`="'.$part_sum.'"'); - } - } + $sql->query('INSERT INTO `logs` set `user`="'.$user['part'].'", `text`="'.sys::updtext(sys::text('logs', 'part'), + array('part' => $uid, 'money' => $part_sum)).'", `date`="'.$start_point.'", `type`="part", `money`="'.$part_sum.'"'); + } + } - $sql->query('UPDATE `users` set `balance`="'.$money.'" WHERE `id`="'.$user['id'].'" LIMIT 1'); + $sql->query('UPDATE `users` set `balance`="'.$money.'" WHERE `id`="'.$user['id'].'" LIMIT 1'); - $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="Пополнение баланса на сумму: '.$sum.' '.$cfg['currency'].'", `date`="'.$start_point.'", `type`="replenish", `money`="'.$sum.'"'); + $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="Пополнение баланса на сумму: '.$sum.' '.$cfg['currency'].'", `date`="'.$start_point.'", `type`="replenish", `money`="'.$sum.'"'); - sys::out('YES'); + sys::out('YES'); ?> \ No newline at end of file diff --git a/system/engine/graph.php b/system/engine/graph.php index 27138c2..23b5f6d 100644 --- a/system/engine/graph.php +++ b/system/engine/graph.php @@ -1,65 +1,65 @@ query('SELECT `id`, `server`, `time` FROM `graph` WHERE `key`="'.$key.'" LIMIT 1'); + $sql->query('SELECT `id`, `server`, `time` FROM `graph` WHERE `key`="'.$key.'" LIMIT 1'); - if(!$sql->num()) - exit; + if(!$sql->num()) + exit; - $graph = $sql->get(); + $graph = $sql->get(); - include(LIB.'games/graph/pData.php'); - include(LIB.'games/graph/pDraw.php'); - include(LIB.'games/graph/pImage.php'); + include(LIB.'games/graph/pData.php'); + include(LIB.'games/graph/pDraw.php'); + include(LIB.'games/graph/pImage.php'); - if(isset($url['type'])) - { - include(DATA.'graph.php'); + if(isset($url['type'])) + { + include(DATA.'graph.php'); - include(LIB.'games/graph.php'); + include(LIB.'games/graph.php'); - $style = isset($url['style']) ? $url['style'] : 'default'; + $style = isset($url['style']) ? $url['style'] : 'default'; - if(!array_key_exists($style, $aStyle)) - $style = 'default'; + if(!array_key_exists($style, $aStyle)) + $style = 'default'; - $type = isset($url['type']) ? $url['type'] : 'first'; + $type = isset($url['type']) ? $url['type'] : 'first'; - if(!in_array($type, array('first', 'second'))) - $type = 'first'; + if(!in_array($type, array('first', 'second'))) + $type = 'first'; - // Выхлоп кеш баннера - if(file_exists(TEMP.(md5($key.$style.$type)).'.png') AND $graph['time']+300 > $start_point) - { - header('Content-type: image/png'); - exit(file_get_contents(TEMP.(md5($key.$style.$type)).'.png')); - } + // Выхлоп кеш баннера + if(file_exists(TEMP.(md5($key.$style.$type)).'.png') AND $graph['time']+300 > $start_point) + { + header('Content-type: image/png'); + exit(file_get_contents(TEMP.(md5($key.$style.$type)).'.png')); + } - $sql->query('SELECT `address`, `game`, `slots_start`, `online`, `status`, `name`, `map` FROM `servers` WHERE `id`="'.$graph['server'].'" LIMIT 1'); - if(!$sql->num()) - exit; + $sql->query('SELECT `address`, `game`, `slots_start`, `online`, `status`, `name`, `map` FROM `servers` WHERE `id`="'.$graph['server'].'" LIMIT 1'); + if(!$sql->num()) + exit; - $server = $sql->get(); + $server = $sql->get(); - $aPoints = graph::online_day($graph['server'], $server['slots_start']); + $aPoints = graph::online_day($graph['server'], $server['slots_start']); - // Обновление баннеров - foreach($aStyle as $name => $styles) - { - graph::first($server, $aPoints, $aStyle, $name, $key); - graph::second($server, $aPoints, $aStyle, $name, $key); - } + // Обновление баннеров + foreach($aStyle as $name => $styles) + { + graph::first($server, $aPoints, $aStyle, $name, $key); + graph::second($server, $aPoints, $aStyle, $name, $key); + } - // Обновление данных - $sql->query('UPDATE `graph` set `time`="'.$start_point.'" WHERE `id`="'.$graph['id'].'" LIMIT 1'); + // Обновление данных + $sql->query('UPDATE `graph` set `time`="'.$start_point.'" WHERE `id`="'.$graph['id'].'" LIMIT 1'); - header('Content-type: image/png'); - exit(file_get_contents(TEMP.(md5($key.$style.$type)).'.png')); - } + header('Content-type: image/png'); + exit(file_get_contents(TEMP.(md5($key.$style.$type)).'.png')); + } ?> \ No newline at end of file diff --git a/system/engine/help.php b/system/engine/help.php index 3358145..a8de8b8 100644 --- a/system/engine/help.php +++ b/system/engine/help.php @@ -1,34 +1,34 @@ query('SELECT `id` FROM `users` WHERE `id`="'.$user['id'].'" AND `help`="0" LIMIT 1'); - if(!$sql->num()) - { - $html->nav('Техническая поддержка'); + $sql->query('SELECT `id` FROM `users` WHERE `id`="'.$user['id'].'" AND `help`="0" LIMIT 1'); + if(!$sql->num()) + { + $html->nav('Техническая поддержка'); - $html->get('noaccess', 'sections/help'); - $html->pack('main'); - }else{ - // Подключение раздела - if(!in_array($section, array('create', 'dialog', 'open', 'close', 'notice', 'upload'))) - include(ENG.'404.php'); + $html->get('noaccess', 'sections/help'); + $html->pack('main'); + }else{ + // Подключение раздела + if(!in_array($section, array('create', 'dialog', 'open', 'close', 'notice', 'upload'))) + include(ENG.'404.php'); - $aNav = array( - 'help' => 'Техническая поддержка', - 'create' => 'Создание вопроса', - 'dialog' => 'Решение вопроса', - 'open' => 'Список открытых вопросов', - 'close' => 'Список закрытых вопросов' - ); + $aNav = array( + 'help' => 'Техническая поддержка', + 'create' => 'Создание вопроса', + 'dialog' => 'Решение вопроса', + 'open' => 'Список открытых вопросов', + 'close' => 'Список закрытых вопросов' + ); - $title = isset($aNav[$section]) ? $aNav[$section] : $section; - $html->nav($aNav['help'], $cfg['http'].'help/section/open'); - $html->nav($title); + $title = isset($aNav[$section]) ? $aNav[$section] : $section; + $html->nav($aNav['help'], $cfg['http'].'help/section/open'); + $html->nav($title); - include(SEC.'help/'.$section.'.php'); - } + include(SEC.'help/'.$section.'.php'); + } ?> \ No newline at end of file diff --git a/system/engine/index.php b/system/engine/index.php index d05e9a9..234ec5b 100644 --- a/system/engine/index.php +++ b/system/engine/index.php @@ -1,27 +1,27 @@ nav($title); + $title = 'Главная страница'; + $html->nav($title); - $sql->query('SELECT `id`, `name`, `text`, `views`, `tags`, `date` FROM `news` ORDER BY `id` DESC LIMIT 3'); - while($news = $sql->get()) - { - $html->get('list', 'sections/news'); + $sql->query('SELECT `id`, `name`, `text`, `views`, `tags`, `date` FROM `news` ORDER BY `id` DESC LIMIT 3'); + while($news = $sql->get()) + { + $html->get('list', 'sections/news'); - $html->set('id', $news['id']); - $html->set('name', htmlspecialchars_decode($news['name'])); - $html->set('text', htmlspecialchars_decode($news['text'])); - $html->set('views', $news['views']); - $html->set('tags', sys::tags($news['tags'])); - $html->set('date', sys::today($news['date'])); + $html->set('id', $news['id']); + $html->set('name', htmlspecialchars_decode($news['name'])); + $html->set('text', htmlspecialchars_decode($news['text'])); + $html->set('views', $news['views']); + $html->set('tags', sys::tags($news['tags'])); + $html->set('date', sys::today($news['date'])); - $html->pack('news'); - } + $html->pack('news'); + } - $html->get('index'); + $html->get('index'); - $html->set('news', isset($html->arr['news']) ? $html->arr['news'] : ''); - $html->pack('main'); + $html->set('news', isset($html->arr['news']) ? $html->arr['news'] : ''); + $html->pack('main'); ?> \ No newline at end of file diff --git a/system/engine/jobs.php b/system/engine/jobs.php index c491e92..05e05be 100644 --- a/system/engine/jobs.php +++ b/system/engine/jobs.php @@ -1,82 +1,82 @@ query('SELECT `name` FROM `jobs` WHERE `id`="'.$id.'" AND `status`!="0" LIMIT 1'); - $nav = $sql->get(); + $sql->query('SELECT `name` FROM `jobs` WHERE `id`="'.$id.'" AND `status`!="0" LIMIT 1'); + $nav = $sql->get(); - $html->nav('Вакансии', $cfg['http'].'jobs'); - $html->nav($nav['name']); + $html->nav('Вакансии', $cfg['http'].'jobs'); + $html->nav($nav['name']); - if($id) - { - $sql->query('SELECT * FROM `jobs` WHERE `id`="'.$id.'" AND `status`!="0" LIMIT 1'); - if(!$sql->num()) - sys::back($cfg['http'].'jobs'); + if($id) + { + $sql->query('SELECT * FROM `jobs` WHERE `id`="'.$id.'" AND `status`!="0" LIMIT 1'); + if(!$sql->num()) + sys::back($cfg['http'].'jobs'); - $jobs = $sql->get(); + $jobs = $sql->get(); - if($go) - { - $sql->query('SELECT `id` FROM `jobs_app` WHERE `user`="'.$user['id'].'" AND `job`="'.$id.'" LIMIT 1'); - if($sql->num()) - sys::outjs(array('e' => 'Вы уже подали заявку, ожидайте, пожалуйста, ответа от Администрации.')); + if($go) + { + $sql->query('SELECT `id` FROM `jobs_app` WHERE `user`="'.$user['id'].'" AND `job`="'.$id.'" LIMIT 1'); + if($sql->num()) + sys::outjs(array('e' => 'Вы уже подали заявку, ожидайте, пожалуйста, ответа от Администрации.')); - if($_POST['contact'] == '') - sys::outjs(array('e' => 'Необходимо указать контакты для связи!')); + if($_POST['contact'] == '') + sys::outjs(array('e' => 'Необходимо указать контакты для связи!')); - sys::noauth(); - - $sql->query('INSERT INTO `jobs_app` set' - .'`user`="'.$user['id'].'",' - .'`text`="",' - .'`contact`="'.$_POST['contact'].'",' - .'`job`="'.$id.'",' - .'`date`="'.$start_point.'"'); + sys::noauth(); + + $sql->query('INSERT INTO `jobs_app` set' + .'`user`="'.$user['id'].'",' + .'`text`="",' + .'`contact`="'.$_POST['contact'].'",' + .'`job`="'.$id.'",' + .'`date`="'.$start_point.'"'); - sys::outjs(array('s' => 'ok')); - } + sys::outjs(array('s' => 'ok')); + } - $sql->query('SELECT `text` FROM `jobs_app` WHERE `user`="'.$user['id'].'" AND `job`="'.$jobs['id'].'" LIMIT 1'); - $text = $sql->get(); + $sql->query('SELECT `text` FROM `jobs_app` WHERE `user`="'.$user['id'].'" AND `job`="'.$jobs['id'].'" LIMIT 1'); + $text = $sql->get(); - $html->get('jobs', 'jobs'); - $html->set('id', $jobs['id']); - $html->set('name', $jobs['name']); - $html->set('job', $jobs['job']); - $html->set('desc', $jobs['desc']); - $html->set('date', sys::today($jobs['date'])); - if(sys::strlen($text['text']) > 0) - { - $html->unit('answer', 1, 1); - $html->set('text', $text['text']); - } else { - $html->unit('answer', 0, 1); - $html->set('text', ''); - } - $html->pack('main'); - } else { - $sql->query('SELECT * FROM `jobs` WHERE `status`!="0" ORDER BY `id` ASC'); - while($jobs = $sql->get()) - { - $html->get('list', 'jobs'); - $html->set('id', $jobs['id']); - $html->set('name', $jobs['name']); - $html->set('job', $jobs['job']); - $html->set('desc', $jobs['desc']); - $html->set('date', sys::today($jobs['date'])); - if($id) $html->unit('close', 1, 1); else $html->unit('close', 0, 1); - $html->pack('jobs_list'); - } - } + $html->get('jobs', 'jobs'); + $html->set('id', $jobs['id']); + $html->set('name', $jobs['name']); + $html->set('job', $jobs['job']); + $html->set('desc', $jobs['desc']); + $html->set('date', sys::today($jobs['date'])); + if(sys::strlen($text['text']) > 0) + { + $html->unit('answer', 1, 1); + $html->set('text', $text['text']); + } else { + $html->unit('answer', 0, 1); + $html->set('text', ''); + } + $html->pack('main'); + } else { + $sql->query('SELECT * FROM `jobs` WHERE `status`!="0" ORDER BY `id` ASC'); + while($jobs = $sql->get()) + { + $html->get('list', 'jobs'); + $html->set('id', $jobs['id']); + $html->set('name', $jobs['name']); + $html->set('job', $jobs['job']); + $html->set('desc', $jobs['desc']); + $html->set('date', sys::today($jobs['date'])); + if($id) $html->unit('close', 1, 1); else $html->unit('close', 0, 1); + $html->pack('jobs_list'); + } + } - $html->get('index', 'jobs'); - if(!$id) - $html->set('jobs', isset($html->arr['jobs_list']) ? $html->arr['jobs_list'] : '
    На данный момент у нас нет свободных вакансий.
    '); - else - $html->set('jobs', ''); + $html->get('index', 'jobs'); + if(!$id) + $html->set('jobs', isset($html->arr['jobs_list']) ? $html->arr['jobs_list'] : '
    На данный момент у нас нет свободных вакансий.
    '); + else + $html->set('jobs', ''); - $html->pack('main'); + $html->pack('main'); ?> \ No newline at end of file diff --git a/system/engine/news.php b/system/engine/news.php index b380b89..b074e5f 100644 --- a/system/engine/news.php +++ b/system/engine/news.php @@ -1,15 +1,15 @@ \ No newline at end of file diff --git a/system/engine/pages.php b/system/engine/pages.php index d95f8e0..5af41be 100644 --- a/system/engine/pages.php +++ b/system/engine/pages.php @@ -1,24 +1,24 @@ query('SELECT `name`, `file` FROM `pages` WHERE `id`="'.$id.'" LIMIT 1'); + $sql->query('SELECT `name`, `file` FROM `pages` WHERE `id`="'.$id.'" LIMIT 1'); - if(!$sql->num()) - include(ENG.'404.php'); + if(!$sql->num()) + include(ENG.'404.php'); - $page = $sql->get(); + $page = $sql->get(); - $title = $page['name']; + $title = $page['name']; - $html->nav($page['name']); + $html->nav($page['name']); - $html->get('page'); + $html->get('page'); - $html->set('content', file_get_contents(FILES.'pages/'.$page['file'])); + $html->set('content', file_get_contents(FILES.'pages/'.$page['file'])); - $html->pack('main'); + $html->pack('main'); ?> \ No newline at end of file diff --git a/system/engine/partners.php b/system/engine/partners.php index 5211206..ad4f616 100644 --- a/system/engine/partners.php +++ b/system/engine/partners.php @@ -1,10 +1,10 @@ nav($title); + $title = 'Партнеры'; + $html->nav($title); - $html->get('partners'); - $html->pack('main'); + $html->get('partners'); + $html->pack('main'); ?> \ No newline at end of file diff --git a/system/engine/pluginbuy.php b/system/engine/pluginbuy.php index a49d1d6..7576070 100644 --- a/system/engine/pluginbuy.php +++ b/system/engine/pluginbuy.php @@ -1,27 +1,27 @@ query('SELECT `id` FROM `servers` WHERE `address`="'.$address.'" LIMIT 1'); - if(!$sql->num()) - sys::out('bad server'); + $sql->query('SELECT `id` FROM `servers` WHERE `address`="'.$address.'" LIMIT 1'); + if(!$sql->num()) + sys::out('bad server'); - $server = $sql->get(); + $server = $sql->get(); - $sql->query('SELECT `id` FROM `plugins_buy` WHERE `key`="'.$url['plugin'].'" AND `server`="'.$server['id'].'" LIMIT 1'); - if($sql->num()) - sys::out('true'); + $sql->query('SELECT `id` FROM `plugins_buy` WHERE `key`="'.$url['plugin'].'" AND `server`="'.$server['id'].'" LIMIT 1'); + if($sql->num()) + sys::out('true'); - sys::out('false'); + sys::out('false'); ?> \ No newline at end of file diff --git a/system/engine/plugins.php b/system/engine/plugins.php index db45750..476a4d1 100644 --- a/system/engine/plugins.php +++ b/system/engine/plugins.php @@ -1,171 +1,171 @@ 'Counter-Strike: 1.6', - 'cssold' => 'Counter-Strike: Source v34', - 'css' => 'Counter-Strike: Source', - 'csgo' => 'Counter-Strike: Global Offensive' - ); + $aGame = array( + 'cs' => 'Counter-Strike: 1.6', + 'cssold' => 'Counter-Strike: Source v34', + 'css' => 'Counter-Strike: Source', + 'csgo' => 'Counter-Strike: Global Offensive' + ); - if(!isset($url['game']) || !array_key_exists($url['game'], $aGame)) - $url['game'] = 'cs'; + if(!isset($url['game']) || !array_key_exists($url['game'], $aGame)) + $url['game'] = 'cs'; - $title = 'Доступные плагины для установки'; + $title = 'Доступные плагины для установки'; - include(LIB.'games/plugins.php'); + include(LIB.'games/plugins.php'); - if($id) - { - $sql->query('SELECT `upd` FROM `plugins` WHERE `id`="'.$id.'" LIMIT 1'); + if($id) + { + $sql->query('SELECT `upd` FROM `plugins` WHERE `id`="'.$id.'" LIMIT 1'); - if(!$sql->num()) - sys::back($cfg['http'].'plugins/game/'.$url['game']); + if(!$sql->num()) + sys::back($cfg['http'].'plugins/game/'.$url['game']); - $update = $sql->get(); + $update = $sql->get(); - $sqlq = '`name`, `info`, `desc`, `images`, `upd`'; + $sqlq = '`name`, `info`, `desc`, `images`, `upd`'; - // Если установленно обновление - if($update['upd']) - { - $sql->query('SELECT '.$sqlq.' FROM `plugins_update` WHERE `id`="'.$update['upd'].'" LIMIT 1'); + // Если установленно обновление + if($update['upd']) + { + $sql->query('SELECT '.$sqlq.' FROM `plugins_update` WHERE `id`="'.$update['upd'].'" LIMIT 1'); - if(!$sql->num()) - $sql->query('SELECT '.$sqlq.' FROM `plugins` WHERE `id`="'.$id.'" LIMIT 1'); - }else - $sql->query('SELECT '.$sqlq.' FROM `plugins` WHERE `id`="'.$id.'" LIMIT 1'); + if(!$sql->num()) + $sql->query('SELECT '.$sqlq.' FROM `plugins` WHERE `id`="'.$id.'" LIMIT 1'); + }else + $sql->query('SELECT '.$sqlq.' FROM `plugins` WHERE `id`="'.$id.'" LIMIT 1'); - $plugin = $sql->get(); + $plugin = $sql->get(); - $sql->query('SELECT `id`, `file` FROM `plugins_config` WHERE (`plugin`="'.$id.'" AND `update`="0") OR (`plugin`="'.$id.'" AND `update`="'.$update['upd'].'") ORDER BY `sort`, `id` ASC'); - while($config = $sql->get()) - { - // Исключить дублирование, путем проверки массива файлов - if(in_array($config['file'], $aConf)) - continue; + $sql->query('SELECT `id`, `file` FROM `plugins_config` WHERE (`plugin`="'.$id.'" AND `update`="0") OR (`plugin`="'.$id.'" AND `update`="'.$update['upd'].'") ORDER BY `sort`, `id` ASC'); + while($config = $sql->get()) + { + // Исключить дублирование, путем проверки массива файлов + if(in_array($config['file'], $aConf)) + continue; - $aConf[] = $config['file']; + $aConf[] = $config['file']; - // Данные файла - $file = explode('/', $config['file']); + // Данные файла + $file = explode('/', $config['file']); - $html->get('config_list', 'sections/plugins'); + $html->get('config_list', 'sections/plugins'); - $html->set('game', $url['game']); - $html->set('fid', $config['id']); - $html->set('name', end($file)); - $html->set('file', $config['file']); + $html->set('game', $url['game']); + $html->set('fid', $config['id']); + $html->set('name', end($file)); + $html->set('file', $config['file']); - $html->pack('configs'); - } + $html->pack('configs'); + } - $images = plugins::images($plugin['images'], $pid); + $images = plugins::images($plugin['images'], $pid); - $html->get('configs', 'sections/plugins'); + $html->get('configs', 'sections/plugins'); - $html->set('game', $url['game']); - $html->set('name', $plugin['name']); - $html->set('info', htmlspecialchars_decode($plugin['info'])); - $html->set('desc', htmlspecialchars_decode($plugin['desc'])); + $html->set('game', $url['game']); + $html->set('name', $plugin['name']); + $html->set('info', htmlspecialchars_decode($plugin['info'])); + $html->set('desc', htmlspecialchars_decode($plugin['desc'])); - // Картинки - if(!empty($images)) - { - $html->unit('images', 1); - $html->set('images', $images); - }else - $html->unit('images'); + // Картинки + if(!empty($images)) + { + $html->unit('images', 1); + $html->set('images', $images); + }else + $html->unit('images'); - // Редактируемые файлы - if(isset($html->arr['configs'])) - { - $html->set('configs', $html->arr['configs']); - $html->unit('configs', 1); - }else - $html->unit('configs'); + // Редактируемые файлы + if(isset($html->arr['configs'])) + { + $html->set('configs', $html->arr['configs']); + $html->unit('configs', 1); + }else + $html->unit('configs'); - $html->pack('main'); + $html->pack('main'); - $plugin['name'] = strip_tags($plugin['name']); + $plugin['name'] = strip_tags($plugin['name']); - $title = $plugin['name']; - $html->nav('Доступные плагины для установки', $cfg['http'].'plugins/game/'.$url['game']); - $html->nav($plugin['name']); - } + $title = $plugin['name']; + $html->nav('Доступные плагины для установки', $cfg['http'].'plugins/game/'.$url['game']); + $html->nav($plugin['name']); + } - if(!isset($html->arr['main'])) - { - $html->nav('Доступные плагины для установки'); + if(!isset($html->arr['main'])) + { + $html->nav('Доступные плагины для установки'); - // Если есть кеш - if($mcache->get('plugins_list_view_'.$url['game']) != '') - $html->arr['main'] = $mcache->get('plugins_list_view_'.$url['game']); - else{ - // Категории - $cats = $sql->query('SELECT `id`, `name` FROM `plugins_category` WHERE `game`="'.$url['game'].'" ORDER BY `sort` ASC'); - while($cat = $sql->get($cats)) - { - // Плагины - $plugins = $sql->query('SELECT `id`, `name`, `desc`, `images`, `status`, `upd`, `packs` FROM `plugins` WHERE `cat`="'.$cat['id'].'" ORDER BY `sort`, `id` ASC'); - while($plugin = $sql->get($plugins)) - { - // Проверка наличия обновленной версии плагина - if($plugin['upd']) - { - $idp = $plugin['id']; + // Если есть кеш + if($mcache->get('plugins_list_view_'.$url['game']) != '') + $html->arr['main'] = $mcache->get('plugins_list_view_'.$url['game']); + else{ + // Категории + $cats = $sql->query('SELECT `id`, `name` FROM `plugins_category` WHERE `game`="'.$url['game'].'" ORDER BY `sort` ASC'); + while($cat = $sql->get($cats)) + { + // Плагины + $plugins = $sql->query('SELECT `id`, `name`, `desc`, `images`, `status`, `upd`, `packs` FROM `plugins` WHERE `cat`="'.$cat['id'].'" ORDER BY `sort`, `id` ASC'); + while($plugin = $sql->get($plugins)) + { + // Проверка наличия обновленной версии плагина + if($plugin['upd']) + { + $idp = $plugin['id']; - $sql->query('SELECT `name`, `desc`, `images`, `status`, `packs` FROM `plugins_update` WHERE `plugin`="'.$plugin['id'].'" ORDER BY `id` DESC LIMIT 1'); - if($sql->num()) - { - $plugin = $sql->get(); + $sql->query('SELECT `name`, `desc`, `images`, `status`, `packs` FROM `plugins_update` WHERE `plugin`="'.$plugin['id'].'" ORDER BY `id` DESC LIMIT 1'); + if($sql->num()) + { + $plugin = $sql->get(); - $plugin['id'] = $idp; - }else - $plugin['upd'] = 0; - } + $plugin['id'] = $idp; + }else + $plugin['upd'] = 0; + } - $images = plugins::images($plugin['images'], $plugin['id']); + $images = plugins::images($plugin['images'], $plugin['id']); - // Шаблон плагина - $html->get('plugin', 'sections/plugins'); + // Шаблон плагина + $html->get('plugin', 'sections/plugins'); - $html->set('plugin', $plugin['id']); - $html->set('game', $url['game']); + $html->set('plugin', $plugin['id']); + $html->set('game', $url['game']); - plugins::status($plugin['status']); + plugins::status($plugin['status']); - $html->set('name', htmlspecialchars_decode($plugin['name'])); - $html->set('desc', htmlspecialchars_decode($plugin['desc'])); + $html->set('name', htmlspecialchars_decode($plugin['name'])); + $html->set('desc', htmlspecialchars_decode($plugin['desc'])); - if(!empty($images)) - { - $html->unit('images', 1); - $html->set('images', $images); - }else - $html->unit('images'); + if(!empty($images)) + { + $html->unit('images', 1); + $html->set('images', $images); + }else + $html->unit('images'); - $html->pack('plugins'); - } + $html->pack('plugins'); + } - // Шаблон блока плагинов - $html->get('category', 'sections/plugins'); + // Шаблон блока плагинов + $html->get('category', 'sections/plugins'); - $html->set('name', $cat['name']); - $html->set('plugins', isset($html->arr['plugins']) ? $html->arr['plugins'] : 'Доступных для установки плагинов нет.', 1); + $html->set('name', $cat['name']); + $html->set('plugins', isset($html->arr['plugins']) ? $html->arr['plugins'] : 'Доступных для установки плагинов нет.', 1); - $html->pack('addons'); - } + $html->pack('addons'); + } - $html->get('plugins', 'sections/plugins'); + $html->get('plugins', 'sections/plugins'); - $html->set('game', $aGame[$url['game']]); - $html->set('addons', isset($html->arr['addons']) ? $html->arr['addons'] : ''); + $html->set('game', $aGame[$url['game']]); + $html->set('addons', isset($html->arr['addons']) ? $html->arr['addons'] : ''); - $html->pack('main'); + $html->pack('main'); - $mcache->set('plugins_list_view_'.$url['game'], $html->arr['main'], false, 60); - } - } + $mcache->set('plugins_list_view_'.$url['game'], $html->arr['main'], false, 60); + } + } ?> \ No newline at end of file diff --git a/system/engine/replenish.php b/system/engine/replenish.php index 3970cd3..4452781 100644 --- a/system/engine/replenish.php +++ b/system/engine/replenish.php @@ -1,12 +1,12 @@ \ No newline at end of file diff --git a/system/engine/servers.php b/system/engine/servers.php index 0afc822..0773d3f 100644 --- a/system/engine/servers.php +++ b/system/engine/servers.php @@ -1,113 +1,113 @@ query('SELECT `id` FROM `servers` WHERE `user`="'.$user['id'].'" LIMIT 1'); - $owners = $sql->query('SELECT `id` FROM `owners` WHERE `user`="'.$user['id'].'" LIMIT 1'); + if(!$id AND $user['group'] == 'user') + { + $servers = $sql->query('SELECT `id` FROM `servers` WHERE `user`="'.$user['id'].'" LIMIT 1'); + $owners = $sql->query('SELECT `id` FROM `owners` WHERE `user`="'.$user['id'].'" LIMIT 1'); - if(!$sql->num($servers) AND !$sql->num($owners)) - sys::back($cfg['http'].'services'); // Если нет игровых серверов отправить на страницу аренды - } + if(!$sql->num($servers) AND !$sql->num($owners)) + sys::back($cfg['http'].'services'); // Если нет игровых серверов отправить на страницу аренды + } - if($id AND !$section) - $section = 'index'; + if($id AND !$section) + $section = 'index'; - $title = 'Управление игровыми серверами'; + $title = 'Управление игровыми серверами'; - // Подключение раздела - if(in_array($section, array('action', 'scan', 'index', 'console', 'settings', 'plugins', 'maps', 'owners', 'filetp', 'tarif', 'copy', 'graph', 'web', 'boost', 'rcon'))) - { - if(!$id) - sys::back($cfg['http'].'servers'); + // Подключение раздела + if(in_array($section, array('action', 'scan', 'index', 'console', 'settings', 'plugins', 'maps', 'owners', 'filetp', 'tarif', 'copy', 'graph', 'web', 'boost', 'rcon'))) + { + if(!$id) + sys::back($cfg['http'].'servers'); - if($user['group'] == 'admin' || ($user['group'] == 'support' AND $user['level'])) - { - if($user['group'] == 'support' AND $user['level'] < 2) - { - $sql->query('SELECT `id` FROM `servers` WHERE `id`="'.$id.'" AND `user`="'.$user['id'].'" LIMIT 1'); - if(!$sql->num()) - { - $sql->query('SELECT `id` FROM `help` WHERE `type`="server" AND `service`="'.$id.'" LIMIT 1'); - if(!$sql->num()) - { - $sql->query('SELECT `rights` FROM `owners` WHERE `server`="'.$id.'" AND `user`="'.$user['id'].'" LIMIT 1'); - if(!$sql->num()) - sys::back($cfg['http'].'servers'); + if($user['group'] == 'admin' || ($user['group'] == 'support' AND $user['level'])) + { + if($user['group'] == 'support' AND $user['level'] < 2) + { + $sql->query('SELECT `id` FROM `servers` WHERE `id`="'.$id.'" AND `user`="'.$user['id'].'" LIMIT 1'); + if(!$sql->num()) + { + $sql->query('SELECT `id` FROM `help` WHERE `type`="server" AND `service`="'.$id.'" LIMIT 1'); + if(!$sql->num()) + { + $sql->query('SELECT `rights` FROM `owners` WHERE `server`="'.$id.'" AND `user`="'.$user['id'].'" LIMIT 1'); + if(!$sql->num()) + sys::back($cfg['http'].'servers'); - $owner = $sql->get(); + $owner = $sql->get(); - $rights = sys::b64djs($owner['rights']); + $rights = sys::b64djs($owner['rights']); - if($section == 'action') - { - if(!isset($rights[$url['action']]) || !$rights[$url['action']]) - sys::outjs(array('e' => 'У вас нет доступа к данному серверу')); - }else{ - if(!in_array($section, array('index', 'scan')) AND (!isset($rights[$section]) || !$rights[$section])) - sys::back($cfg['http'].'servers'); - } - } - } - } + if($section == 'action') + { + if(!isset($rights[$url['action']]) || !$rights[$url['action']]) + sys::outjs(array('e' => 'У вас нет доступа к данному серверу')); + }else{ + if(!in_array($section, array('index', 'scan')) AND (!isset($rights[$section]) || !$rights[$section])) + sys::back($cfg['http'].'servers'); + } + } + } + } - $sql->query('SELECT `id` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); - }else{ - $sql->query('SELECT `id` FROM `servers` WHERE `id`="'.$id.'" AND `user`="'.$user['id'].'" LIMIT 1'); - if(!$sql->num()) - { - $sql->query('SELECT `rights` FROM `owners` WHERE `server`="'.$id.'" AND `user`="'.$user['id'].'" LIMIT 1'); - if(!$sql->num()) - sys::back($cfg['http'].'servers'); + $sql->query('SELECT `id` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); + }else{ + $sql->query('SELECT `id` FROM `servers` WHERE `id`="'.$id.'" AND `user`="'.$user['id'].'" LIMIT 1'); + if(!$sql->num()) + { + $sql->query('SELECT `rights` FROM `owners` WHERE `server`="'.$id.'" AND `user`="'.$user['id'].'" LIMIT 1'); + if(!$sql->num()) + sys::back($cfg['http'].'servers'); - $owner = $sql->get(); + $owner = $sql->get(); - $rights = sys::b64djs($owner['rights']); + $rights = sys::b64djs($owner['rights']); - if($section == 'action') - { - if(!isset($rights[$url['action']]) || !$rights[$url['action']]) - sys::outjs(array('e' => sys::text('error', 'ser_owner'))); - }else{ - if(!in_array($section, array('index', 'scan')) AND (!isset($rights[$section]) || !$rights[$section])) - sys::back($cfg['http'].'servers/id/'.$owner['server']); - } + if($section == 'action') + { + if(!isset($rights[$url['action']]) || !$rights[$url['action']]) + sys::outjs(array('e' => sys::text('error', 'ser_owner'))); + }else{ + if(!in_array($section, array('index', 'scan')) AND (!isset($rights[$section]) || !$rights[$section])) + sys::back($cfg['http'].'servers/id/'.$owner['server']); + } - $sql->query('SELECT `id` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); - } - } + $sql->query('SELECT `id` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); + } + } - if(!$sql->num()) - sys::back($cfg['http'].'servers'); // Если нет игрового сервера отправить на страницу списка + if(!$sql->num()) + sys::back($cfg['http'].'servers'); // Если нет игрового сервера отправить на страницу списка - $html->nav($title, $cfg['http'].'servers'); + $html->nav($title, $cfg['http'].'servers'); - $file_section = file_exists(SEC.'servers/'.$section.'.php'); - if($file_section) - include(SEC.'servers/'.$section.'.php'); - else - sys::back($cfg['http'].'servers/id/'.$id); + $file_section = file_exists(SEC.'servers/'.$section.'.php'); + if($file_section) + include(SEC.'servers/'.$section.'.php'); + else + sys::back($cfg['http'].'servers/id/'.$id); - }else{ - $html->nav($title); + }else{ + $html->nav($title); - if($user['group'] == 'user' AND $mcache->get('servers_'.$user['id']) != '') - $html->arr['main'] = $mcache->get('servers_'.$user['id']); - else{ - include(SEC.'servers/list.php'); - include(SEC.'servers/owners_list.php'); + if($user['group'] == 'user' AND $mcache->get('servers_'.$user['id']) != '') + $html->arr['main'] = $mcache->get('servers_'.$user['id']); + else{ + include(SEC.'servers/list.php'); + include(SEC.'servers/owners_list.php'); - $html->get('servers', 'sections/servers'); - $html->set('list', isset($html->arr['list']) ? $html->arr['list'] : 'У вас нет игровых серверов', true); - $html->set('wait_servers', $wait_servers); - $html->set('updates_servers', $updates_servers); - $html->pack('main'); + $html->get('servers', 'sections/servers'); + $html->set('list', isset($html->arr['list']) ? $html->arr['list'] : 'У вас нет игровых серверов', true); + $html->set('wait_servers', $wait_servers); + $html->set('updates_servers', $updates_servers); + $html->pack('main'); - $mcache->set('servers_'.$user['id'], $html->arr['main'], false, 4); - } - } + $mcache->set('servers_'.$user['id'], $html->arr['main'], false, 4); + } + } ?> \ No newline at end of file diff --git a/system/engine/services.php b/system/engine/services.php index ece74c0..609a584 100644 --- a/system/engine/services.php +++ b/system/engine/services.php @@ -1,8 +1,8 @@ get('index', 'sections/services'); $html->pack('main'); }else{ - $aNav = array( - 'cs' => 'Counter-Srike: 1.6', - 'css' => 'Counter-Srike: Source', - 'csgo' => 'Counter-Srike: Global Offensive', - 'cssold' => 'Counter-Srike: Source v34', - 'mc' => 'MineCraft', - 'mta' => 'GTA: MTA', - 'samp' => 'GTA: SA-MP', - 'crmp' => 'GTA: CR-MP', - 'hosting' => 'виртуального хостинга', - 'privileges' => 'привилегий на игровом сервере', - 'control' => 'услуги "контроль"', - ); + $aNav = array( + 'cs' => 'Counter-Srike: 1.6', + 'css' => 'Counter-Srike: Source', + 'csgo' => 'Counter-Srike: Global Offensive', + 'cssold' => 'Counter-Srike: Source v34', + 'mc' => 'MineCraft', + 'mta' => 'GTA: MTA', + 'samp' => 'GTA: SA-MP', + 'crmp' => 'GTA: CR-MP', + 'hosting' => 'виртуального хостинга', + 'privileges' => 'привилегий на игровом сервере', + 'control' => 'услуги "контроль"', + ); - $title = 'Аренда '.$aNav[$section]; + $title = 'Аренда '.$aNav[$section]; - $html->nav('Список услуг', $cfg['http'].'services'); - $html->nav($title); + $html->nav('Список услуг', $cfg['http'].'services'); + $html->nav($title); - include(SEC.'services/'.$section.'.php'); - } + include(SEC.'services/'.$section.'.php'); + } ?> \ No newline at end of file diff --git a/system/engine/unitpay.php b/system/engine/unitpay.php index c608146..185fca4 100644 --- a/system/engine/unitpay.php +++ b/system/engine/unitpay.php @@ -1,130 +1,130 @@ array('message' => 'Некорректный адрес сервера'))); + if(!in_array($uip, $unitpayIp)) + sys::outjs(array('error' => array('message' => 'Некорректный адрес сервера'))); - $secretKey = $cfg['unitpay_key']; - $params = $_GET['params']; + $secretKey = $cfg['unitpay_key']; + $params = $_GET['params']; - if($params['signature'] != getSignature($_GET['method'], $params, $secretKey)) - sys::outjs(array('error' => array('message' => 'Некорректная цифровая подпись'))); + if($params['signature'] != getSignature($_GET['method'], $params, $secretKey)) + sys::outjs(array('error' => array('message' => 'Некорректная цифровая подпись'))); - if(!in_array($_GET['method'], array('pay', 'check', 'error'))) - sys::outjs(array('error' => array('message' => 'Некорректный метод'))); + if(!in_array($_GET['method'], array('pay', 'check', 'error'))) + sys::outjs(array('error' => array('message' => 'Некорректный метод'))); - // Оплата по ключу - if(!sys::valid($params['account'], 'md5')) - { - $sql->query('SELECT `id`, `server`, `price` FROM `privileges_buy` WHERE `key`="'.$params['account'].'" LIMIT 1'); - if(!$sql->num()) - sys::outjs(array('error' => array('message' => 'bad key: '.$params['account']))); + // Оплата по ключу + if(!sys::valid($params['account'], 'md5')) + { + $sql->query('SELECT `id`, `server`, `price` FROM `privileges_buy` WHERE `key`="'.$params['account'].'" LIMIT 1'); + if(!$sql->num()) + sys::outjs(array('error' => array('message' => 'bad key: '.$params['account']))); - $privilege = $sql->get(); + $privilege = $sql->get(); - $money = round($params['sum']*$cfg['curinrub'], 2); + $money = round($params['sum']*$cfg['curinrub'], 2); - if($money < $privilege['price']) - sys::outjs(array('error' => array('message' => 'bad sum'))); + if($money < $privilege['price']) + sys::outjs(array('error' => array('message' => 'bad sum'))); - $sql->query('SELECT `user` FROM `servers` WHERE `id`="'.$privilege['server'].'" LIMIT 1'); - if(!$sql->num()) - sys::outjs(array('error' => array('message' => 'bad server'))); + $sql->query('SELECT `user` FROM `servers` WHERE `id`="'.$privilege['server'].'" LIMIT 1'); + if(!$sql->num()) + sys::outjs(array('error' => array('message' => 'bad server'))); - $server = $sql->get(); + $server = $sql->get(); - $sql->query('SELECT `id`, `balance`, `part_money` FROM `users` WHERE `id`="'.$server['user'].'" LIMIT 1'); - if(!$sql->num()) - sys::outjs(array('error' => array('message' => 'bad owner'))); + $sql->query('SELECT `id`, `balance`, `part_money` FROM `users` WHERE `id`="'.$server['user'].'" LIMIT 1'); + if(!$sql->num()) + sys::outjs(array('error' => array('message' => 'bad owner'))); - if(isset($_GET['method']) AND $_GET['method'] == 'check') - sys::outjs(array('result' => array('message' => 'Запрос успешно обработан'))); + if(isset($_GET['method']) AND $_GET['method'] == 'check') + sys::outjs(array('result' => array('message' => 'Запрос успешно обработан'))); - $user = $sql->get(); + $user = $sql->get(); - if($cfg['part_money']) - $sql->query('UPDATE `users` set `part_money`="'.($user['part_money']+$money).'" WHERE `id`="'.$user['id'].'" LIMIT 1'); - else - $sql->query('UPDATE `users` set `balance`="'.($user['balance']+$money).'" WHERE `id`="'.$user['id'].'" LIMIT 1'); + if($cfg['part_money']) + $sql->query('UPDATE `users` set `part_money`="'.($user['part_money']+$money).'" WHERE `id`="'.$user['id'].'" LIMIT 1'); + else + $sql->query('UPDATE `users` set `balance`="'.($user['balance']+$money).'" WHERE `id`="'.$user['id'].'" LIMIT 1'); - $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="'.sys::updtext(sys::text('logs', 'profit'), - array('server' => $privilege['server'], 'money' => $money)).'", `date`="'.$start_point.'", `type`="part", `money`="'.$money.'"'); + $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="'.sys::updtext(sys::text('logs', 'profit'), + array('server' => $privilege['server'], 'money' => $money)).'", `date`="'.$start_point.'", `type`="part", `money`="'.$money.'"'); - $sql->query('UPDATE `privileges_buy` set `status`="1" WHERE `id`="'.$privilege['id'].'" LIMIT 1'); + $sql->query('UPDATE `privileges_buy` set `status`="1" WHERE `id`="'.$privilege['id'].'" LIMIT 1'); - sys::outjs(array('result' => array('message' => 'Запрос успешно обработан'))); - } + sys::outjs(array('result' => array('message' => 'Запрос успешно обработан'))); + } - switch($_GET['method']) - { - case 'pay': - $sum = round($params['sum'], 2); + switch($_GET['method']) + { + case 'pay': + $sum = round($params['sum'], 2); - $user = intval($params['account']); + $user = intval($params['account']); - $sql->query('SELECT `id`, `balance`, `part` FROM `users` WHERE `id`="'.$user.'" LIMIT 1'); - if(!$sql->num()) - sys::outjs(array('result' => array('message' => 'Пользователь c ID: '.$user.' не найден'))); + $sql->query('SELECT `id`, `balance`, `part` FROM `users` WHERE `id`="'.$user.'" LIMIT 1'); + if(!$sql->num()) + sys::outjs(array('result' => array('message' => 'Пользователь c ID: '.$user.' не найден'))); - $user = $sql->get(); + $user = $sql->get(); - $money = round($user['balance']+$sum*$cfg['curinrub'], 2); + $money = round($user['balance']+$sum*$cfg['curinrub'], 2); - if($cfg['part']) - { - $part_sum = round($sum/100*$cfg['part_proc'], 2); + if($cfg['part']) + { + $part_sum = round($sum/100*$cfg['part_proc'], 2); - $sql->query('SELECT `balance`, `part_money` FROM `users` WHERE `id`="'.$user['part'].'" LIMIT 1'); - if($sql->num()) - { - $part = $sql->get(); + $sql->query('SELECT `balance`, `part_money` FROM `users` WHERE `id`="'.$user['part'].'" LIMIT 1'); + if($sql->num()) + { + $part = $sql->get(); - if($cfg['part_money']) - $sql->query('UPDATE `users` set `part_money`="'.($part['part_money']+$part_sum).'" WHERE `id`="'.$user['part'].'" LIMIT 1'); - else - $sql->query('UPDATE `users` set `balance`="'.($part['balance']+$part_sum).'" WHERE `id`="'.$user['part'].'" LIMIT 1'); + if($cfg['part_money']) + $sql->query('UPDATE `users` set `part_money`="'.($part['part_money']+$part_sum).'" WHERE `id`="'.$user['part'].'" LIMIT 1'); + else + $sql->query('UPDATE `users` set `balance`="'.($part['balance']+$part_sum).'" WHERE `id`="'.$user['part'].'" LIMIT 1'); - $sql->query('INSERT INTO `logs` set `user`="'.$user['part'].'", `text`="'.sys::updtext(sys::text('logs', 'part'), - array('part' => $uid, 'money' => $part_sum)).'", `date`="'.$start_point.'", `type`="part", `money`="'.$part_sum.'"'); - } - } + $sql->query('INSERT INTO `logs` set `user`="'.$user['part'].'", `text`="'.sys::updtext(sys::text('logs', 'part'), + array('part' => $uid, 'money' => $part_sum)).'", `date`="'.$start_point.'", `type`="part", `money`="'.$part_sum.'"'); + } + } - $sql->query('UPDATE `users` set `balance`="'.$money.'" WHERE `id`="'.$user['id'].'" LIMIT 1'); + $sql->query('UPDATE `users` set `balance`="'.$money.'" WHERE `id`="'.$user['id'].'" LIMIT 1'); - $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="Пополнение баланса на сумму: '.$sum.' '.$cfg['currency'].'", `date`="'.$start_point.'", `type`="replenish", `money`="'.$sum.'"'); + $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="Пополнение баланса на сумму: '.$sum.' '.$cfg['currency'].'", `date`="'.$start_point.'", `type`="replenish", `money`="'.$sum.'"'); - sys::outjs(array('result' => array('message' => 'Запрос успешно обработан'))); + sys::outjs(array('result' => array('message' => 'Запрос успешно обработан'))); - case 'check': - $sql->query('SELECT `id` FROM `users` WHERE `id`="'.intval($params['account']).'" LIMIT 1'); - if($sql->num()) - sys::outjs(array('result' => array('message' => 'Запрос успешно обработан'))); + case 'check': + $sql->query('SELECT `id` FROM `users` WHERE `id`="'.intval($params['account']).'" LIMIT 1'); + if($sql->num()) + sys::outjs(array('result' => array('message' => 'Запрос успешно обработан'))); - sys::outjs(array('jsonrpc' => "2.0", 'error' => array('code' => -32000, 'message' => 'Пользователь не найден'), 'id' => 1)); + sys::outjs(array('jsonrpc' => "2.0", 'error' => array('code' => -32000, 'message' => 'Пользователь не найден'), 'id' => 1)); - case 'error': - sys::outjs(array('result' => array('message' => 'Запрос успешно обработан'))); - } + case 'error': + sys::outjs(array('result' => array('message' => 'Запрос успешно обработан'))); + } ?> \ No newline at end of file diff --git a/system/engine/unitpay_entity.php b/system/engine/unitpay_entity.php index dd779be..b704720 100644 --- a/system/engine/unitpay_entity.php +++ b/system/engine/unitpay_entity.php @@ -1,120 +1,120 @@ array('message' => 'Некорректный адрес сервера'))); + if(!in_array($uip, $unitpayIp)) + sys::outjs(array('error' => array('message' => 'Некорректный адрес сервера'))); - $secretKey = $cfg['unitpay_key']; - $params = $_GET['params']; + $secretKey = $cfg['unitpay_key']; + $params = $_GET['params']; - if ($params['signature'] != getSha256SignatureByMethodAndParams( + if ($params['signature'] != getSha256SignatureByMethodAndParams( $_REQUEST["method"], $params, $GATEWAY['SecretKey'] )); - if(!in_array($_GET['method'], array('pay', 'check', 'error'))) - sys::outjs(array('error' => array('message' => 'Некорректный метод'))); + if(!in_array($_GET['method'], array('pay', 'check', 'error'))) + sys::outjs(array('error' => array('message' => 'Некорректный метод'))); - // Оплата по ключу - if(!sys::valid($params['account'], 'md5')) - { - $sql->query('SELECT `id`, `server`, `price` FROM `privileges_buy` WHERE `key`="'.$params['account'].'" LIMIT 1'); - if(!$sql->num()) - sys::outjs(array('error' => array('message' => 'bad key: '.$params['account']))); + // Оплата по ключу + if(!sys::valid($params['account'], 'md5')) + { + $sql->query('SELECT `id`, `server`, `price` FROM `privileges_buy` WHERE `key`="'.$params['account'].'" LIMIT 1'); + if(!$sql->num()) + sys::outjs(array('error' => array('message' => 'bad key: '.$params['account']))); - $privilege = $sql->get(); + $privilege = $sql->get(); - $money = round($params['sum']*$cfg['curinrub'], 2); + $money = round($params['sum']*$cfg['curinrub'], 2); - if($money < $privilege['price']) - sys::outjs(array('error' => array('message' => 'bad sum'))); + if($money < $privilege['price']) + sys::outjs(array('error' => array('message' => 'bad sum'))); - $sql->query('SELECT `user` FROM `servers` WHERE `id`="'.$privilege['server'].'" LIMIT 1'); - if(!$sql->num()) - sys::outjs(array('error' => array('message' => 'bad server'))); + $sql->query('SELECT `user` FROM `servers` WHERE `id`="'.$privilege['server'].'" LIMIT 1'); + if(!$sql->num()) + sys::outjs(array('error' => array('message' => 'bad server'))); - $server = $sql->get(); + $server = $sql->get(); - $sql->query('SELECT `id`, `balance`, `part_money` FROM `users` WHERE `id`="'.$server['user'].'" LIMIT 1'); - if(!$sql->num()) - sys::outjs(array('error' => array('message' => 'bad owner'))); + $sql->query('SELECT `id`, `balance`, `part_money` FROM `users` WHERE `id`="'.$server['user'].'" LIMIT 1'); + if(!$sql->num()) + sys::outjs(array('error' => array('message' => 'bad owner'))); - if(isset($_GET['method']) AND $_GET['method'] == 'check') - sys::outjs(array('result' => array('message' => 'Запрос успешно обработан'))); + if(isset($_GET['method']) AND $_GET['method'] == 'check') + sys::outjs(array('result' => array('message' => 'Запрос успешно обработан'))); - $user = $sql->get(); + $user = $sql->get(); - if($cfg['part_money']) - $sql->query('UPDATE `users` set `part_money`="'.($user['part_money']+$money).'" WHERE `id`="'.$user['id'].'" LIMIT 1'); - else - $sql->query('UPDATE `users` set `balance`="'.($user['balance']+$money).'" WHERE `id`="'.$user['id'].'" LIMIT 1'); + if($cfg['part_money']) + $sql->query('UPDATE `users` set `part_money`="'.($user['part_money']+$money).'" WHERE `id`="'.$user['id'].'" LIMIT 1'); + else + $sql->query('UPDATE `users` set `balance`="'.($user['balance']+$money).'" WHERE `id`="'.$user['id'].'" LIMIT 1'); - $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="'.sys::updtext(sys::text('logs', 'profit'), - array('server' => $privilege['server'], 'money' => $money)).'", `date`="'.$start_point.'", `type`="part", `money`="'.$money.'"'); + $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="'.sys::updtext(sys::text('logs', 'profit'), + array('server' => $privilege['server'], 'money' => $money)).'", `date`="'.$start_point.'", `type`="part", `money`="'.$money.'"'); - $sql->query('UPDATE `privileges_buy` set `status`="1" WHERE `id`="'.$privilege['id'].'" LIMIT 1'); + $sql->query('UPDATE `privileges_buy` set `status`="1" WHERE `id`="'.$privilege['id'].'" LIMIT 1'); - sys::outjs(array('result' => array('message' => 'Запрос успешно обработан'))); - } + sys::outjs(array('result' => array('message' => 'Запрос успешно обработан'))); + } - switch($_GET['method']) - { - case 'pay': - $sum = round($params['sum'], 2); + switch($_GET['method']) + { + case 'pay': + $sum = round($params['sum'], 2); - $user = intval($params['account']); + $user = intval($params['account']); - $sql->query('SELECT `id`, `balance`, `part` FROM `users` WHERE `id`="'.$user.'" LIMIT 1'); - if(!$sql->num()) - sys::outjs(array('result' => array('message' => 'Пользователь c ID: '.$user.' не найден'))); + $sql->query('SELECT `id`, `balance`, `part` FROM `users` WHERE `id`="'.$user.'" LIMIT 1'); + if(!$sql->num()) + sys::outjs(array('result' => array('message' => 'Пользователь c ID: '.$user.' не найден'))); - $user = $sql->get(); + $user = $sql->get(); - $money = round($user['balance']+$sum*$cfg['curinrub'], 2); + $money = round($user['balance']+$sum*$cfg['curinrub'], 2); - if($cfg['part']) - { - $part_sum = round($sum/100*$cfg['part_proc'], 2); + if($cfg['part']) + { + $part_sum = round($sum/100*$cfg['part_proc'], 2); - $sql->query('SELECT `balance`, `part_money` FROM `users` WHERE `id`="'.$user['part'].'" LIMIT 1'); - if($sql->num()) - { - $part = $sql->get(); + $sql->query('SELECT `balance`, `part_money` FROM `users` WHERE `id`="'.$user['part'].'" LIMIT 1'); + if($sql->num()) + { + $part = $sql->get(); - if($cfg['part_money']) - $sql->query('UPDATE `users` set `part_money`="'.($part['part_money']+$part_sum).'" WHERE `id`="'.$user['part'].'" LIMIT 1'); - else - $sql->query('UPDATE `users` set `balance`="'.($part['balance']+$part_sum).'" WHERE `id`="'.$user['part'].'" LIMIT 1'); + if($cfg['part_money']) + $sql->query('UPDATE `users` set `part_money`="'.($part['part_money']+$part_sum).'" WHERE `id`="'.$user['part'].'" LIMIT 1'); + else + $sql->query('UPDATE `users` set `balance`="'.($part['balance']+$part_sum).'" WHERE `id`="'.$user['part'].'" LIMIT 1'); - $sql->query('INSERT INTO `logs` set `user`="'.$user['part'].'", `text`="'.sys::updtext(sys::text('logs', 'part'), - array('part' => $uid, 'money' => $part_sum)).'", `date`="'.$start_point.'", `type`="part", `money`="'.$part_sum.'"'); - } - } + $sql->query('INSERT INTO `logs` set `user`="'.$user['part'].'", `text`="'.sys::updtext(sys::text('logs', 'part'), + array('part' => $uid, 'money' => $part_sum)).'", `date`="'.$start_point.'", `type`="part", `money`="'.$part_sum.'"'); + } + } - $sql->query('UPDATE `users` set `balance`="'.$money.'" WHERE `id`="'.$user['id'].'" LIMIT 1'); + $sql->query('UPDATE `users` set `balance`="'.$money.'" WHERE `id`="'.$user['id'].'" LIMIT 1'); - $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="Пополнение баланса на сумму: '.$sum.' '.$cfg['currency'].'", `date`="'.$start_point.'", `type`="replenish", `money`="'.$sum.'"'); + $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="Пополнение баланса на сумму: '.$sum.' '.$cfg['currency'].'", `date`="'.$start_point.'", `type`="replenish", `money`="'.$sum.'"'); - sys::outjs(array('result' => array('message' => 'Запрос успешно обработан'))); + sys::outjs(array('result' => array('message' => 'Запрос успешно обработан'))); - case 'check': - $sql->query('SELECT `id` FROM `users` WHERE `id`="'.intval($params['account']).'" LIMIT 1'); - if($sql->num()) - sys::outjs(array('result' => array('message' => 'Запрос успешно обработан'))); + case 'check': + $sql->query('SELECT `id` FROM `users` WHERE `id`="'.intval($params['account']).'" LIMIT 1'); + if($sql->num()) + sys::outjs(array('result' => array('message' => 'Запрос успешно обработан'))); - sys::outjs(array('jsonrpc' => "2.0", 'error' => array('code' => -32000, 'message' => 'Пользователь не найден'), 'id' => 1)); + sys::outjs(array('jsonrpc' => "2.0", 'error' => array('code' => -32000, 'message' => 'Пользователь не найден'), 'id' => 1)); - case 'error': - sys::outjs(array('result' => array('message' => 'Запрос успешно обработан'))); - } + case 'error': + sys::outjs(array('result' => array('message' => 'Запрос успешно обработан'))); + } ?> \ No newline at end of file diff --git a/system/engine/user.php b/system/engine/user.php index 21851f8..da443b6 100644 --- a/system/engine/user.php +++ b/system/engine/user.php @@ -1,26 +1,26 @@ 'Авторизация', - 'recovery' => 'Восстановление', - 'replenish' => 'Пополнение баланса', - 'signup' => 'Регистрация', - 'lk' => 'Личный кабинет', - 'quit' => 'Выход' - ); + $aTitle = array( + 'auth' => 'Авторизация', + 'recovery' => 'Восстановление', + 'replenish' => 'Пополнение баланса', + 'signup' => 'Регистрация', + 'lk' => 'Личный кабинет', + 'quit' => 'Выход' + ); - $title = $aTitle[$section]; + $title = $aTitle[$section]; - if($section == 'lk') - $html->nav($title, $cfg['http'].'user/section/lk'); - else - $html->nav($title); + if($section == 'lk') + $html->nav($title, $cfg['http'].'user/section/lk'); + else + $html->nav($title); - include(SEC.'user/'.$section.'.php'); + include(SEC.'user/'.$section.'.php'); ?> diff --git a/system/engine/webmoney.php b/system/engine/webmoney.php index ed15de4..913cc60 100644 --- a/system/engine/webmoney.php +++ b/system/engine/webmoney.php @@ -1,97 +1,97 @@ query('SELECT `id`, `server`, `price` FROM `privileges_buy` WHERE `key`="'.$_POST['us_user'].'" LIMIT 1'); - if(!$sql->num()) - sys::out('bad key'); + // Оплата по ключу + if(!sys::valid($_POST['us_user'], 'md5')) + { + $sql->query('SELECT `id`, `server`, `price` FROM `privileges_buy` WHERE `key`="'.$_POST['us_user'].'" LIMIT 1'); + if(!$sql->num()) + sys::out('bad key'); - $privilege = $sql->get(); + $privilege = $sql->get(); - $money = round($sum*$cfg['curinrub'], 2); + $money = round($sum*$cfg['curinrub'], 2); - if($money < $privilege['price']) - sys::out('bad sum'); + if($money < $privilege['price']) + sys::out('bad sum'); - $sql->query('SELECT `user` FROM `servers` WHERE `id`="'.$privilege['server'].'" LIMIT 1'); - if(!$sql->num()) - sys::out('bad server'); + $sql->query('SELECT `user` FROM `servers` WHERE `id`="'.$privilege['server'].'" LIMIT 1'); + if(!$sql->num()) + sys::out('bad server'); - $server = $sql->get(); + $server = $sql->get(); - $sql->query('SELECT `id`, `balance`, `part_money` FROM `users` WHERE `id`="'.$server['user'].'" LIMIT 1'); - if(!$sql->num()) - sys::out('bad owner'); + $sql->query('SELECT `id`, `balance`, `part_money` FROM `users` WHERE `id`="'.$server['user'].'" LIMIT 1'); + if(!$sql->num()) + sys::out('bad owner'); - $user = $sql->get(); + $user = $sql->get(); - if($cfg['part_money']) - $sql->query('UPDATE `users` set `part_money`="'.($user['part_money']+$money).'" WHERE `id`="'.$user['id'].'" LIMIT 1'); - else - $sql->query('UPDATE `users` set `balance`="'.($user['balance']+$money).'" WHERE `id`="'.$user['id'].'" LIMIT 1'); + if($cfg['part_money']) + $sql->query('UPDATE `users` set `part_money`="'.($user['part_money']+$money).'" WHERE `id`="'.$user['id'].'" LIMIT 1'); + else + $sql->query('UPDATE `users` set `balance`="'.($user['balance']+$money).'" WHERE `id`="'.$user['id'].'" LIMIT 1'); - $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="'.sys::updtext(sys::text('logs', 'profit'), - array('server' => $privilege['server'], 'money' => $money)).'", `date`="'.$start_point.'", `type`="part", `money`="'.$money.'"'); + $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="'.sys::updtext(sys::text('logs', 'profit'), + array('server' => $privilege['server'], 'money' => $money)).'", `date`="'.$start_point.'", `type`="part", `money`="'.$money.'"'); - $sql->query('UPDATE `privileges_buy` set `status`="1" WHERE `id`="'.$privilege['id'].'" LIMIT 1'); + $sql->query('UPDATE `privileges_buy` set `status`="1" WHERE `id`="'.$privilege['id'].'" LIMIT 1'); - sys::out('success'); - } + sys::out('success'); + } - $user = intval($_POST['us_user']); + $user = intval($_POST['us_user']); - $sql->query('SELECT `id`, `balance`, `part` FROM `users` WHERE `id`="'.$user.'" LIMIT 1'); - if(!$sql->num()) - sys::out('bad user'); + $sql->query('SELECT `id`, `balance`, `part` FROM `users` WHERE `id`="'.$user.'" LIMIT 1'); + if(!$sql->num()) + sys::out('bad user'); - $user = $sql->get(); + $user = $sql->get(); - $money = round($user['balance']+$sum*$cfg['curinrub'], 2); + $money = round($user['balance']+$sum*$cfg['curinrub'], 2); - if($cfg['part']) - { - $part_sum = round($sum/100*$cfg['part_proc'], 2); + if($cfg['part']) + { + $part_sum = round($sum/100*$cfg['part_proc'], 2); - $sql->query('SELECT `balance`, `part_money` FROM `users` WHERE `id`="'.$user['part'].'" LIMIT 1'); - if($sql->num()) - { - $part = $sql->get(); + $sql->query('SELECT `balance`, `part_money` FROM `users` WHERE `id`="'.$user['part'].'" LIMIT 1'); + if($sql->num()) + { + $part = $sql->get(); - if($cfg['part_money']) - $sql->query('UPDATE `users` set `part_money`="'.($part['part_money']+$part_sum).'" WHERE `id`="'.$user['part'].'" LIMIT 1'); - else - $sql->query('UPDATE `users` set `balance`="'.($part['balance']+$part_sum).'" WHERE `id`="'.$user['part'].'" LIMIT 1'); + if($cfg['part_money']) + $sql->query('UPDATE `users` set `part_money`="'.($part['part_money']+$part_sum).'" WHERE `id`="'.$user['part'].'" LIMIT 1'); + else + $sql->query('UPDATE `users` set `balance`="'.($part['balance']+$part_sum).'" WHERE `id`="'.$user['part'].'" LIMIT 1'); - $sql->query('INSERT INTO `logs` set `user`="'.$user['part'].'", `text`="'.sys::updtext(sys::text('logs', 'part'), - array('part' => $uid, 'money' => $part_sum)).'", `date`="'.$start_point.'", `type`="part", `money`="'.$part_sum.'"'); - } - } + $sql->query('INSERT INTO `logs` set `user`="'.$user['part'].'", `text`="'.sys::updtext(sys::text('logs', 'part'), + array('part' => $uid, 'money' => $part_sum)).'", `date`="'.$start_point.'", `type`="part", `money`="'.$part_sum.'"'); + } + } - $sql->query('UPDATE `users` set `balance`="'.$money.'" WHERE `id`="'.$user['id'].'" LIMIT 1'); + $sql->query('UPDATE `users` set `balance`="'.$money.'" WHERE `id`="'.$user['id'].'" LIMIT 1'); - $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="Пополнение баланса на сумму: '.$sum.' '.$cfg['currency'].'", `date`="'.$start_point.'", `type`="replenish", `money`="'.$sum.'"'); + $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="Пополнение баланса на сумму: '.$sum.' '.$cfg['currency'].'", `date`="'.$start_point.'", `type`="replenish", `money`="'.$sum.'"'); - sys::out('success'); + sys::out('success'); ?> \ No newline at end of file diff --git a/system/engine/wiki.php b/system/engine/wiki.php index 33b1205..ff2e355 100644 --- a/system/engine/wiki.php +++ b/system/engine/wiki.php @@ -1,11 +1,11 @@ \ No newline at end of file diff --git a/system/library/acpsystem.php b/system/library/acpsystem.php index 9ebbfd7..18f180e 100644 --- a/system/library/acpsystem.php +++ b/system/library/acpsystem.php @@ -1,713 +1,713 @@ delete($cache); + if($cache) + $mcache->delete($cache); - die(json_encode($val)); - } + die(json_encode($val)); + } - public static function out($val = '', $cache = false) - { - global $mcache; + public static function out($val = '', $cache = false) + { + global $mcache; - if($cache) - $mcache->delete($cache); + if($cache) + $mcache->delete($cache); - die(''.$val.''); - } + die(''.$val.''); + } - public static function valid($val, $type, $preg = '') - { - switch($type) - { - case 'promo': - if(!preg_match("/^[A-Za-z0-9]{2,20}$/", $val)) - return true; + public static function valid($val, $type, $preg = '') + { + switch($type) + { + case 'promo': + if(!preg_match("/^[A-Za-z0-9]{2,20}$/", $val)) + return true; - return false; + return false; - case 'en': - if(!preg_match("/^[A-Za-z0-9]$/", $val)) - return true; + case 'en': + if(!preg_match("/^[A-Za-z0-9]$/", $val)) + return true; - return false; + return false; - case 'ru': - if(!preg_match("/^[А-Яа-я]$/u", $val)) - return true; + case 'ru': + if(!preg_match("/^[А-Яа-я]$/u", $val)) + return true; - return false; + return false; - case 'wm': - if(!preg_match('/^R[0-9]{12,12}$|^Z[0-9]{12,12}$|^U[0-9]{12,12}$/m', $val)) - return true; + case 'wm': + if(!preg_match('/^R[0-9]{12,12}$|^Z[0-9]{12,12}$|^U[0-9]{12,12}$/m', $val)) + return true; - return false; + return false; - case 'ip': - if(!preg_match("/^(25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[0-9]{2}|[0-9])(\.(25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[0-9]{2}|[0-9])){3}$/", $val)) - return true; + case 'ip': + if(!preg_match("/^(25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[0-9]{2}|[0-9])(\.(25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[0-9]{2}|[0-9])){3}$/", $val)) + return true; - return false; + return false; - case 'steamid': - if(!preg_match("/^STEAM_[0-9]:[0-9]:[0-9]{6,12}$|^HLTV$|^STEAM_ID_LAN$|^STEAM_ID_PENDING$|^VALVE_ID_LAN$|^VALVE_ID_PENDING$|^STEAM_666:88:666$/", $val)) - return true; + case 'steamid': + if(!preg_match("/^STEAM_[0-9]:[0-9]:[0-9]{6,12}$|^HLTV$|^STEAM_ID_LAN$|^STEAM_ID_PENDING$|^VALVE_ID_LAN$|^VALVE_ID_PENDING$|^STEAM_666:88:666$/", $val)) + return true; - return false; + return false; - case 'steamid3': - if(!preg_match("/^\[U:[01]:[0-9]{3,12}\]$/i", $val)) - return true; + case 'steamid3': + if(!preg_match("/^\[U:[01]:[0-9]{3,12}\]$/i", $val)) + return true; - return false; + return false; - case 'num': - if(!preg_match('/[^0-9]/', $val)) - return true; + case 'num': + if(!preg_match('/[^0-9]/', $val)) + return true; - return false; + return false; - case 'md5': - if(!preg_match("/^[a-z0-9]{32,32}$/", $val)) - return true; + case 'md5': + if(!preg_match("/^[a-z0-9]{32,32}$/", $val)) + return true; - return false; + return false; - case 'other': - if(!preg_match($preg, $val)) - return true; + case 'other': + if(!preg_match($preg, $val)) + return true; - return false; - } + return false; + } - return true; - } - - public static function page($page, $nums, $num) - { - $ceil = ceil($nums/$num); - - if($page > $ceil) - $page = $ceil; - - $next = $page*$num; - - if($next <= $nums) - $next = $next-$num; + return true; + } + + public static function page($page, $nums, $num) + { + $ceil = ceil($nums/$num); + + if($page > $ceil) + $page = $ceil; + + $next = $page*$num; + + if($next <= $nums) + $next = $next-$num; - if($next > $nums) - $next = $next-$num; + if($next > $nums) + $next = $next-$num; - if($next < 1) - $next = 0; + if($next < 1) + $next = 0; - $num_go = $next; - if($page == '') - $page = 1; + $num_go = $next; + if($page == '') + $page = 1; - $aPage = array( - 'page' => $page, - 'num' => $num_go, - 'ceil' => $ceil - ); + $aPage = array( + 'page' => $page, + 'num' => $num_go, + 'ceil' => $ceil + ); - return $aPage; - } - - public static function page_list($countnum, $actnum) - { - if($countnum == 0 || $countnum == 1) - return array(); - - if($countnum > 10) - { - if($actnum <= 4 || $actnum + 3 >= $countnum) - { - for($i = 0; $i <= 4; $i++) - $numlist[$i] = $i + 1; + return $aPage; + } + + public static function page_list($countnum, $actnum) + { + if($countnum == 0 || $countnum == 1) + return array(); + + if($countnum > 10) + { + if($actnum <= 4 || $actnum + 3 >= $countnum) + { + for($i = 0; $i <= 4; $i++) + $numlist[$i] = $i + 1; - $numlist[5] = '...'; - for($j = 6, $k = 4; $j <= 10; $j+=1, $k-=1) - $numlist[$j] = $countnum - $k; - }else{ - $numlist[0] = 1; - $numlist[1] = 2; - $numlist[2] = '...'; - $numlist[3] = $actnum - 2; - $numlist[4] = $actnum - 1; - $numlist[5] = $actnum; - $numlist[6] = $actnum + 1; - $numlist[7] = $actnum + 2; - $numlist[8] = '...'; - $numlist[9] = $countnum - 1; - $numlist[10] = $countnum; - } - }else - for($n = 0; $n < $countnum; $n+=1) - $numlist[$n] = $n + 1; + $numlist[5] = '...'; + for($j = 6, $k = 4; $j <= 10; $j+=1, $k-=1) + $numlist[$j] = $countnum - $k; + }else{ + $numlist[0] = 1; + $numlist[1] = 2; + $numlist[2] = '...'; + $numlist[3] = $actnum - 2; + $numlist[4] = $actnum - 1; + $numlist[5] = $actnum; + $numlist[6] = $actnum + 1; + $numlist[7] = $actnum + 2; + $numlist[8] = '...'; + $numlist[9] = $countnum - 1; + $numlist[10] = $countnum; + } + }else + for($n = 0; $n < $countnum; $n+=1) + $numlist[$n] = $n + 1; - return $numlist; - } + return $numlist; + } - public static function page_gen($ceil, $page, $actnum, $section) - { - global $cfg, $html; + public static function page_gen($ceil, $page, $actnum, $section) + { + global $cfg, $html; - $aNum = sys::page_list($ceil, $actnum); + $aNum = sys::page_list($ceil, $actnum); - $pages = ''; - - $html->get('pages'); - - if($ceil) - { - if($page != 1) - { - $next = $page-1; - $pages .= ''; - } - - foreach($aNum as $v) - { - if($v != $page && $v != '...') - $pages .= ''.$v.''; - - if($v == $page) - $pages .= ''.$v.''; - - if($v == '...') - $pages .= '...'; - } - - if($ceil > $page) - { - if($page < $ceil) - { - $next = $page+1; - $pages .= ''; - }else - $pages .= ''; - } - } - - $html->set('pages', $pages); - - $html->pack('pages'); - - return NULL; - } - - public static function ago($time, $brackets = false) - { - global $start_point; - - $diff = $start_point-$time; - - if($diff < 0) - return ''; - - if(!$diff) - $diff = 1; - - $seconds = array('секунду', 'секунды', 'секунд'); - $minutes = array('минуту', 'минуты', 'минут'); - $hours = array('час', 'часа', 'часов'); - $days = array('день', 'дня', 'дней'); - $weeks = array('неделю', 'недели', 'недель'); - $months = array('месяц', 'месяца', 'месяцев'); - $years = array('год', 'года', 'лет'); - - $phrase = array($seconds, $minutes, $hours, $days, $weeks, $months, $years); - $length = array(1, 60, 3600, 86400, 604800, 2630880, 31570560); - - for($i = 6; ($i >= 0) AND (($no = $diff/$length[$i]) <= 1); $i-=1); - - if($i < 0) - $i = 0; - - $_time = $start_point-($diff % $length[$i]); - $no = ceil($no); - - if($brackets) - return '('.$no.' '.sys::parse_ago($no, $phrase[$i]).' назад)'; - - return $no.' '.sys::parse_ago($no, $phrase[$i]).' назад'; - } - - private static function parse_ago($number, $titles) - { - $cases = array(2, 0, 1, 1, 1, 2); - - return $titles[($number % 100 > 4 AND $number % 100 < 20 ) ? 2 : $cases[min($number % 10, 5)]]; - } + $pages = ''; + + $html->get('pages'); + + if($ceil) + { + if($page != 1) + { + $next = $page-1; + $pages .= ''; + } + + foreach($aNum as $v) + { + if($v != $page && $v != '...') + $pages .= ''.$v.''; + + if($v == $page) + $pages .= ''.$v.''; + + if($v == '...') + $pages .= '...'; + } + + if($ceil > $page) + { + if($page < $ceil) + { + $next = $page+1; + $pages .= ''; + }else + $pages .= ''; + } + } + + $html->set('pages', $pages); + + $html->pack('pages'); + + return NULL; + } + + public static function ago($time, $brackets = false) + { + global $start_point; + + $diff = $start_point-$time; + + if($diff < 0) + return ''; + + if(!$diff) + $diff = 1; + + $seconds = array('секунду', 'секунды', 'секунд'); + $minutes = array('минуту', 'минуты', 'минут'); + $hours = array('час', 'часа', 'часов'); + $days = array('день', 'дня', 'дней'); + $weeks = array('неделю', 'недели', 'недель'); + $months = array('месяц', 'месяца', 'месяцев'); + $years = array('год', 'года', 'лет'); + + $phrase = array($seconds, $minutes, $hours, $days, $weeks, $months, $years); + $length = array(1, 60, 3600, 86400, 604800, 2630880, 31570560); + + for($i = 6; ($i >= 0) AND (($no = $diff/$length[$i]) <= 1); $i-=1); + + if($i < 0) + $i = 0; + + $_time = $start_point-($diff % $length[$i]); + $no = ceil($no); + + if($brackets) + return '('.$no.' '.sys::parse_ago($no, $phrase[$i]).' назад)'; + + return $no.' '.sys::parse_ago($no, $phrase[$i]).' назад'; + } + + private static function parse_ago($number, $titles) + { + $cases = array(2, 0, 1, 1, 1, 2); + + return $titles[($number % 100 > 4 AND $number % 100 < 20 ) ? 2 : $cases[min($number % 10, 5)]]; + } - public static function date($lenght, $date) - { - global $start_point; + public static function date($lenght, $date) + { + global $start_point; - $check_time = $date-$start_point; + $check_time = $date-$start_point; - if($check_time < 1) - return 'время истекло.'; + if($check_time < 1) + return 'время истекло.'; - $days = floor($check_time/86400); - $hours = floor(($check_time%86400)/3600); - $minutes = floor(($check_time%3600)/60); - $seconds = $check_time%60; + $days = floor($check_time/86400); + $hours = floor(($check_time%86400)/3600); + $minutes = floor(($check_time%3600)/60); + $seconds = $check_time%60; - $adata = array( - 'min' => array( - 'days' => array('день', 'дня', 'дней'), - 'hours' => array('ч.', 'ч.', 'ч.'), - 'minutes' => array('мин.', 'мин.', 'мин.'), - 'seconds' => array('сек.', 'сек.', 'сек.') - ), - 'max' => array( - 'days' => array('день', 'дня', 'дней'), - 'hours' => array('час', 'часа', 'часов'), - 'minutes' => array('минуту','минуты','минут'), - 'seconds' => array('секунду','секунды','секунд') - ) - ); + $adata = array( + 'min' => array( + 'days' => array('день', 'дня', 'дней'), + 'hours' => array('ч.', 'ч.', 'ч.'), + 'minutes' => array('мин.', 'мин.', 'мин.'), + 'seconds' => array('сек.', 'сек.', 'сек.') + ), + 'max' => array( + 'days' => array('день', 'дня', 'дней'), + 'hours' => array('час', 'часа', 'часов'), + 'minutes' => array('минуту','минуты','минут'), + 'seconds' => array('секунду','секунды','секунд') + ) + ); - $text = ''; + $text = ''; - if($days > 0) - $text .= sys::date_decl($days, $adata[$lenght]['days']); + if($days > 0) + $text .= sys::date_decl($days, $adata[$lenght]['days']); - if($days < 1 AND $hours > 0) - $text .= ' '.sys::date_decl($hours, $adata[$lenght]['hours']); + if($days < 1 AND $hours > 0) + $text .= ' '.sys::date_decl($hours, $adata[$lenght]['hours']); - if($days < 1 AND $minutes > 0) - $text .= ' '.sys::date_decl($minutes, $adata[$lenght]['minutes']); + if($days < 1 AND $minutes > 0) + $text .= ' '.sys::date_decl($minutes, $adata[$lenght]['minutes']); - if($days < 1 AND $seconds > 0) - $text .= ' '.sys::date_decl($seconds, $adata[$lenght]['seconds']); + if($days < 1 AND $seconds > 0) + $text .= ' '.sys::date_decl($seconds, $adata[$lenght]['seconds']); - return $text; - } + return $text; + } - public static function date_decl($digit, $expr, $onlyword = false) - { - if(!is_array($expr)) - $expr = array_filter(explode(' ', $expr)); + public static function date_decl($digit, $expr, $onlyword = false) + { + if(!is_array($expr)) + $expr = array_filter(explode(' ', $expr)); - if(empty($expr[2])) - $expr[2] = $expr[1]; + if(empty($expr[2])) + $expr[2] = $expr[1]; - $i = sys::int($digit)%100; + $i = sys::int($digit)%100; - if($onlyword) - $digit = ''; + if($onlyword) + $digit = ''; - if($i > 4 AND $i < 21) - $res = $digit.' '.$expr[2]; - else - $i%=10; + if($i > 4 AND $i < 21) + $res = $digit.' '.$expr[2]; + else + $i%=10; - if($i == 1) - $res = $digit.' '.$expr[0]; - elseif($i > 1 AND $i < 5) - $res = $digit.' '.$expr[1]; - else - $res = $digit.' '.$expr[2]; + if($i == 1) + $res = $digit.' '.$expr[0]; + elseif($i > 1 AND $i < 5) + $res = $digit.' '.$expr[1]; + else + $res = $digit.' '.$expr[2]; - return trim($res); - } + return trim($res); + } - public static function today($time, $cp = false) - { - global $start_point; + public static function today($time, $cp = false) + { + global $start_point; - $today = date('d.m.Y', $start_point); - $day = date('d.m.Y', $time); + $today = date('d.m.Y', $start_point); + $day = date('d.m.Y', $time); - if($day == $today) - { - if($cp) - return 'Сегодня '.date('H:i', $time); + if($day == $today) + { + if($cp) + return 'Сегодня '.date('H:i', $time); - return 'Сегодня '.date('- H:i', $time); - } + return 'Сегодня '.date('- H:i', $time); + } - $yesterday_first = sys::int(sys::first(explode('.', $today)))-1; - $yesterday_full = date('m.Y', $time); + $yesterday_first = sys::int(sys::first(explode('.', $today)))-1; + $yesterday_full = date('m.Y', $time); - if($day == $yesterday_first.'.'.$yesterday_full AND !$yesterday_first) - { - if($cp) - return 'Вчера '.date('H:i', $time); + if($day == $yesterday_first.'.'.$yesterday_full AND !$yesterday_first) + { + if($cp) + return 'Вчера '.date('H:i', $time); - return 'Вчера '.date('- H:i', $time); - } + return 'Вчера '.date('- H:i', $time); + } - if($cp) - return date('d.m.Y H:i', $time); + if($cp) + return date('d.m.Y H:i', $time); - return date('d.m.Y - H:i', $time); - } + return date('d.m.Y - H:i', $time); + } - public static function browser($agent) - { - if(strpos($agent, 'Firefox') !== false) - return 'Mozilla Firefox'; + public static function browser($agent) + { + if(strpos($agent, 'Firefox') !== false) + return 'Mozilla Firefox'; - if(strpos($agent, 'Opera') !== false) - return 'Opera'; + if(strpos($agent, 'Opera') !== false) + return 'Opera'; - if(strpos($agent, 'Chrome') !== false) - return 'Google Chrome'; + if(strpos($agent, 'Chrome') !== false) + return 'Google Chrome'; - if(strpos($agent, 'MSIE') !== false) - return 'Internet Explorer'; + if(strpos($agent, 'MSIE') !== false) + return 'Internet Explorer'; - if(strpos($agent, 'Safari') !== false) - return 'Safari'; + if(strpos($agent, 'Safari') !== false) + return 'Safari'; - return 'Неизвестный'; - } + return 'Неизвестный'; + } - public static function whois($ip) - { - $stack = fsockopen('whois.ripe.net', 43, $errno, $errstr); + public static function whois($ip) + { + $stack = fsockopen('whois.ripe.net', 43, $errno, $errstr); - if(!$stack) - return 'не определена'; + if(!$stack) + return 'не определена'; - fputs($stack, $ip."\r\n"); + fputs($stack, $ip."\r\n"); - $subnetwork = ''; + $subnetwork = ''; - while(!feof($stack)) - { - $str = fgets($stack, 128); + while(!feof($stack)) + { + $str = fgets($stack, 128); - if(strpos($str, 'route:') !== FALSE) - { - $subnetwork = trim(str_replace('route:', '', $str)); + if(strpos($str, 'route:') !== FALSE) + { + $subnetwork = trim(str_replace('route:', '', $str)); - break; - } - } + break; + } + } - fclose($stack); + fclose($stack); - return isset($subnetwork{0}) ? $subnetwork : 'не определена'; - } + return isset($subnetwork{0}) ? $subnetwork : 'не определена'; + } - public static function uptime_load($time) - { - $uptime = ''; + public static function uptime_load($time) + { + $uptime = ''; - $day = floor($time/60/60/24); - if($day) - $uptime .= $day.'д. '; + $day = floor($time/60/60/24); + if($day) + $uptime .= $day.'д. '; - $hour = $time/60/60%24; - if($hour) - $uptime .= $hour.'ч. '; + $hour = $time/60/60%24; + if($hour) + $uptime .= $hour.'ч. '; - $min = $time/60%60; - if($min) - $uptime .= $min.'м. '; - - return $uptime.($time%60).'с.'; - } + $min = $time/60%60; + if($min) + $uptime .= $min.'м. '; + + return $uptime.($time%60).'с.'; + } - public static function ram_load($data) - { - $aData = explode(' ', $data); + public static function ram_load($data) + { + $aData = explode(' ', $data); - return ceil(($aData[0]-($aData[1]+$aData[2]+$aData[3]))*100/$aData[0]); - } + return ceil(($aData[0]-($aData[1]+$aData[2]+$aData[3]))*100/$aData[0]); + } - public static function cpu_load($data) - { - $aData = explode(' ', $data); + public static function cpu_load($data) + { + $aData = explode(' ', $data); - $load = ceil($aData[0]/$aData[1]); + $load = ceil($aData[0]/$aData[1]); - return $load > 100 ? 100 : $load; - } + return $load > 100 ? 100 : $load; + } - public static function cpu_idle($pros_stat = array(), $fcpu = false) - { - return sys::cpu_get_idle(sys::parse_cpu($pros_stat[0]), sys::parse_cpu($pros_stat[1]), $fcpu); - } + public static function cpu_idle($pros_stat = array(), $fcpu = false) + { + return sys::cpu_get_idle(sys::parse_cpu($pros_stat[0]), sys::parse_cpu($pros_stat[1]), $fcpu); + } - public static function cpu_get_idle($first, $second, $fcpu) - { - if(count($first) !== count($second)) - return; + public static function cpu_get_idle($first, $second, $fcpu) + { + if(count($first) !== count($second)) + return; - $cpus = array(); + $cpus = array(); - for($i = 0, $l = count($first); $i < $l; $i+=1) - { - $dif = array(); - $dif['use'] = $second[$i]['use']-$first[$i]['use']; - $dif['nice'] = $second[$i]['nice']-$first[$i]['nice']; - $dif['sys'] = $second[$i]['sys']-$first[$i]['sys']; - $dif['idle'] = $second[$i]['idle']-$first[$i]['idle']; - $total = array_sum($dif); - $cpu = array(); + for($i = 0, $l = count($first); $i < $l; $i+=1) + { + $dif = array(); + $dif['use'] = $second[$i]['use']-$first[$i]['use']; + $dif['nice'] = $second[$i]['nice']-$first[$i]['nice']; + $dif['sys'] = $second[$i]['sys']-$first[$i]['sys']; + $dif['idle'] = $second[$i]['idle']-$first[$i]['idle']; + $total = array_sum($dif); + $cpu = array(); - foreach($dif as $x => $y) - $cpu[$x] = $y ? round($y/$total*100, 1) : 0; + foreach($dif as $x => $y) + $cpu[$x] = $y ? round($y/$total*100, 1) : 0; - $cpus['cpu'.$i] = $cpu; - } + $cpus['cpu'.$i] = $cpu; + } - if($fcpu) - return $cpus; + if($fcpu) + return $cpus; - $threads = array(); + $threads = array(); - $l = count($first); + $l = count($first); - for($i = 0; $i < $l; $i+=1) - $threads[$i] = $cpus['cpu'.$i]['idle']; + for($i = 0; $i < $l; $i+=1) + $threads[$i] = $cpus['cpu'.$i]['idle']; - if(count($first) > 1) - unset($threads[0]); + if(count($first) > 1) + unset($threads[0]); - $max = max($threads); + $max = max($threads); - return array_search($max, $threads); - } + return array_search($max, $threads); + } - public static function parse_cpu($data) - { - $data = explode("\n", $data); + public static function parse_cpu($data) + { + $data = explode("\n", $data); - $cpu = array(); + $cpu = array(); - foreach($data as $line) - { - if(preg_match('/^cpu[0-9]/', $line)) - { - $info = explode(' ', $line); + foreach($data as $line) + { + if(preg_match('/^cpu[0-9]/', $line)) + { + $info = explode(' ', $line); - $cpu[] = array( - 'use' => $info[1], - 'nice' => $info[2], - 'sys' => $info[3], - 'idle' => $info[4] - ); - } - } + $cpu[] = array( + 'use' => $info[1], + 'nice' => $info[2], + 'sys' => $info[3], + 'idle' => $info[4] + ); + } + } - return $cpu; - } + return $cpu; + } - public static function checkdate($time) - { - $time = explode(' ', $time); + public static function checkdate($time) + { + $time = explode(' ', $time); - if(count($time) != 2) - sys::outjs(array('e' => 'Указанная дата неправильная.')); + if(count($time) != 2) + sys::outjs(array('e' => 'Указанная дата неправильная.')); - $aDate = explode('/', $time[0]); - $aTime = explode(':', $time[1]); + $aDate = explode('/', $time[0]); + $aTime = explode(':', $time[1]); - if(!isset($aDate[1], $aDate[0], $aDate[2]) || !checkdate($aDate[1], $aDate[0], $aDate[2])) - sys::outjs(array('e' => 'Указанная дата неправильная.')); + if(!isset($aDate[1], $aDate[0], $aDate[2]) || !checkdate($aDate[1], $aDate[0], $aDate[2])) + sys::outjs(array('e' => 'Указанная дата неправильная.')); - return mktime($aTime[0], $aTime[1], 0, $aDate[1], $aDate[0], $aDate[2]); - } + return mktime($aTime[0], $aTime[1], 0, $aDate[1], $aDate[0], $aDate[2]); + } - public static function passwdkey($passwd) - { - return md5(sha1($passwd)); - } + public static function passwdkey($passwd) + { + return md5(sha1($passwd)); + } - public static function mail($name, $text, $mail) - { - global $cfg; + public static function mail($name, $text, $mail) + { + global $cfg; - require_once(LIB.'smtp.php'); + require_once(LIB.'smtp.php'); - $tpl = file_get_contents(DATA.'mail.ini', "r"); + $tpl = file_get_contents(DATA.'mail.ini', "r"); - $text = str_replace( - array('[name]', '[text]', '[http]', '[img]', '[css]'), - array($cfg['name'], $text, $cfg['http'], $cfg['http'].'template/images/', $cfg['http'].'template/css/'), - $tpl - ); + $text = str_replace( + array('[name]', '[text]', '[http]', '[img]', '[css]'), + array($cfg['name'], $text, $cfg['http'], $cfg['http'].'template/images/', $cfg['http'].'template/css/'), + $tpl + ); - $smtp = new smtp($cfg['smtp_login'], $cfg['smtp_passwd'], $cfg['smtp_url'], $cfg['smtp_mail'], 465); + $smtp = new smtp($cfg['smtp_login'], $cfg['smtp_passwd'], $cfg['smtp_url'], $cfg['smtp_mail'], 465); - $headers = "MIME-Version: 1.0\r\n"; - $headers .= "Content-type: text/html; charset=utf-8\r\n"; - $headers .= "From: ".$cfg['smtp_name']." <".$cfg['smtp_mail'].">\r\n"; + $headers = "MIME-Version: 1.0\r\n"; + $headers .= "Content-type: text/html; charset=utf-8\r\n"; + $headers .= "From: ".$cfg['smtp_name']." <".$cfg['smtp_mail'].">\r\n"; - if($smtp->send($mail, $name, $text, $headers)) - return true; + if($smtp->send($mail, $name, $text, $headers)) + return true; - return false; - } + return false; + } - public static function country($address) - { - global $SxGeo; + public static function country($address) + { + global $SxGeo; - if(sys::valid($address, 'ip')) - return 'не определена'; + if(sys::valid($address, 'ip')) + return 'не определена'; - $data = $SxGeo->getCityFull($address); + $data = $SxGeo->getCityFull($address); - return $data['country']['name_ru'] != '' ? $data['country']['name_ru'] : 'не определена'; - } + return $data['country']['name_ru'] != '' ? $data['country']['name_ru'] : 'не определена'; + } - public static function ipproxy() - { - global $_SERVER; + public static function ipproxy() + { + global $_SERVER; - if(isset($_SERVER['HTTP_CF_CONNECTING_IP']) && !empty($_SERVER['HTTP_CF_CONNECTING_IP'])) - return $_SERVER['HTTP_CF_CONNECTING_IP']; + if(isset($_SERVER['HTTP_CF_CONNECTING_IP']) && !empty($_SERVER['HTTP_CF_CONNECTING_IP'])) + return $_SERVER['HTTP_CF_CONNECTING_IP']; - return NULL; - } + return NULL; + } - public static function ip() - { - $ip = sys::ipproxy(); + public static function ip() + { + $ip = sys::ipproxy(); - if(sys::valid($ip, 'ip')) - return $_SERVER['REMOTE_ADDR']; + if(sys::valid($ip, 'ip')) + return $_SERVER['REMOTE_ADDR']; - return $ip; - } + return $ip; + } - public static function status($data) - { - if(strpos($data, 'is running') || strpos($data, '(running)')) - return true; - - return false; - } + public static function status($data) + { + if(strpos($data, 'is running') || strpos($data, '(running)')) + return true; + + return false; + } - public static function strlen($str) - { - return iconv_strlen($str, 'UTF-8'); - } + public static function strlen($str) + { + return iconv_strlen($str, 'UTF-8'); + } - public static function bbc($text) - { - global $cfg; + public static function bbc($text) + { + global $cfg; - $lines = explode("\n", $text); + $lines = explode("\n", $text); - $str_search = array( - "#\[spoiler\](.+?)\[\/spoiler\]#is", - "#\[sp\](.+?)\[\/sp\]#is", - "#\[b\](.+?)\[\/b\]#is", - "#\[u\](.+?)\[\/u\]#is", - "#\[code\](.+?)\[\/code\]#is", - "#(.+?)<\/code>#isUe", - "#\[quote\](.+?)\[\/quote\]#is", - "#\[url=(.+?)\](.+?)\[\/url\]#is", - "#(^|[\n ])([\w]+?://[\w\#$%&~/.\-;:=,?@\[\]+]*)#is" - ); + $str_search = array( + "#\[spoiler\](.+?)\[\/spoiler\]#is", + "#\[sp\](.+?)\[\/sp\]#is", + "#\[b\](.+?)\[\/b\]#is", + "#\[u\](.+?)\[\/u\]#is", + "#\[code\](.+?)\[\/code\]#is", + "#(.+?)<\/code>#isUe", + "#\[quote\](.+?)\[\/quote\]#is", + "#\[url=(.+?)\](.+?)\[\/url\]#is", + "#(^|[\n ])([\w]+?://[\w\#$%&~/.\-;:=,?@\[\]+]*)#is" + ); - $str_replace = array( - "
    Посмотреть содержимое
    \\1
    ", - "
    Посмотреть содержимое
    \\1
    ", - "\\1", - "\\1", - "
    Посмотреть содержимое
    \\1
    ", - "''.htmlspecialchars('$1').''", - "

    \\1

    ", - "\\2", - "\\2" - ); + $str_replace = array( + "
    Посмотреть содержимое
    \\1
    ", + "
    Посмотреть содержимое
    \\1
    ", + "\\1", + "\\1", + "
    Посмотреть содержимое
    \\1
    ", + "''.htmlspecialchars('$1').''", + "

    \\1

    ", + "\\2", + "\\2" + ); - $uptext = ''; + $uptext = ''; - foreach($lines as $line) - $uptext .= preg_replace($str_search, $str_replace, $line).PHP_EOL; + foreach($lines as $line) + $uptext .= preg_replace($str_search, $str_replace, $line).PHP_EOL; - return $uptext; - } + return $uptext; + } - public static function text($section, $name) - { - global $cfg, $user; + public static function text($section, $name) + { + global $cfg, $user; - $group = isset($user['group']) ? $user['group'] : 'user'; + $group = isset($user['group']) ? $user['group'] : 'user'; - if($section != 'error' || !$cfg['text_group']) - $group = 'all'; + if($section != 'error' || !$cfg['text_group']) + $group = 'all'; - include(DATA.'text/'.$section.'.php'); + include(DATA.'text/'.$section.'.php'); - return isset($text[$name][$group]) ? $text[$name][$group] : $text[$name]; - } + return isset($text[$name][$group]) ? $text[$name][$group] : $text[$name]; + } - public static function updtext($text, $data) - { - foreach($data as $name => $val) - $text = str_replace('['.$name.']', $val, $text); - - return $text; - } - } + public static function updtext($text, $data) + { + foreach($data as $name => $val) + $text = str_replace('['.$name.']', $val, $text); + + return $text; + } + } ?> \ No newline at end of file diff --git a/system/library/api.php b/system/library/api.php index 478f980..40b0a11 100644 --- a/system/library/api.php +++ b/system/library/api.php @@ -1,95 +1,95 @@ query('SELECT `unit`, `tarif`, `address`, `game`, `slots_start`, `online`, `players`, `status`, `name`, `map`, `pack`, `fps`, `tickrate`, `ram`, `time`, `date`, `overdue` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); - if(!$sql->num()) - return array('e' => 'сервер не найден'); + $sql->query('SELECT `unit`, `tarif`, `address`, `game`, `slots_start`, `online`, `players`, `status`, `name`, `map`, `pack`, `fps`, `tickrate`, `ram`, `time`, `date`, `overdue` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); + if(!$sql->num()) + return array('e' => 'сервер не найден'); - $server = $sql->get(); + $server = $sql->get(); - $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - if(!$sql->num()) - return array('e' => 'локация не найдена'); + $sql->query('SELECT `name` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + if(!$sql->num()) + return array('e' => 'локация не найдена'); - $unit = $sql->get(); - - $sql->query('SELECT `name`, `packs` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); - if(!$sql->num()) - return array('e' => 'тариф не найден'); + $unit = $sql->get(); + + $sql->query('SELECT `name`, `packs` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); + if(!$sql->num()) + return array('e' => 'тариф не найден'); - $tarif = $sql->get(); - $packs = sys::b64djs($tarif['packs']); + $tarif = $sql->get(); + $packs = sys::b64djs($tarif['packs']); - $time_end = $server['status'] == 'overdue' ? 'Удаление через: '.sys::date('min', $server['overdue']+$cfg['server_delete']*86400) : 'Осталось: '.sys::date('min', $server['time']); + $time_end = $server['status'] == 'overdue' ? 'Удаление через: '.sys::date('min', $server['overdue']+$cfg['server_delete']*86400) : 'Осталось: '.sys::date('min', $server['time']); - return array( - 'id' => $id, - 'address' => $server['address'], - 'unit' => $unit['name'], - 'tarif' => games::info_tarif($server['game'], $tarif['name'], array('fps' => $server['fps'], 'tickrate' => $server['tickrate'], 'ram' => $server['ram'])), - 'game' => $server['game'], - 'name' => $server['name'], - 'slots' => $server['slots_start'], - 'online' => $server['online'], - 'players' => $server['players'], - 'status' => sys::status($server['status'], $server['game'], $server['map']), - 'img' => sys::status($server['status'], $server['game'], $server['map'], 'img'), - 'time_end' => $time_end, - 'time' => sys::today($server['time']), - 'date' => sys::today($server['date']), - 'pack' => $packs[$server['pack']] - ); - } + return array( + 'id' => $id, + 'address' => $server['address'], + 'unit' => $unit['name'], + 'tarif' => games::info_tarif($server['game'], $tarif['name'], array('fps' => $server['fps'], 'tickrate' => $server['tickrate'], 'ram' => $server['ram'])), + 'game' => $server['game'], + 'name' => $server['name'], + 'slots' => $server['slots_start'], + 'online' => $server['online'], + 'players' => $server['players'], + 'status' => sys::status($server['status'], $server['game'], $server['map']), + 'img' => sys::status($server['status'], $server['game'], $server['map'], 'img'), + 'time_end' => $time_end, + 'time' => sys::today($server['time']), + 'date' => sys::today($server['date']), + 'pack' => $packs[$server['pack']] + ); + } - public function load($id) - { - global $sql, $cfg; + public function load($id) + { + global $sql, $cfg; - $sql->query('SELECT `online`, `slots_start`, `ram_use`, `cpu_use`, `hdd_use` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); - if(!$sql->num()) - return array('e' => 'сервер не найден'); + $sql->query('SELECT `online`, `slots_start`, `ram_use`, `cpu_use`, `hdd_use` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); + if(!$sql->num()) + return array('e' => 'сервер не найден'); - $server = $sql->get(); + $server = $sql->get(); - $online = 100/$server['slots_start']*$server['online']; - $online = $online > 100 ? 100: $online; + $online = 100/$server['slots_start']*$server['online']; + $online = $online > 100 ? 100: $online; - return array( - 'id' => $id, - 'cpu' => $server['cpu_use'], - 'ram' => $server['ram_use'], - 'hdd' => $server['hdd_use'], - 'onl' => $online - ); - } + return array( + 'id' => $id, + 'cpu' => $server['cpu_use'], + 'ram' => $server['ram_use'], + 'hdd' => $server['hdd_use'], + 'onl' => $online + ); + } - public function console($id, $cmd) - { - global $sql, $cfg; + public function console($id, $cmd) + { + global $sql, $cfg; - $aGames = array('cs', 'css', 'cssold', 'csgo', 'mc', 'mta'); + $aGames = array('cs', 'css', 'cssold', 'csgo', 'mc', 'mta'); - $sql->query('SELECT `game` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); - if(!$sql->num()) - return 'сервер не найден'; + $sql->query('SELECT `game` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); + if(!$sql->num()) + return 'сервер не найден'; - $server = $sql->get(); + $server = $sql->get(); - if(!in_array($server['game'], $aGames)) - return 'Игра не поддерживает команды'; + if(!in_array($server['game'], $aGames)) + return 'Игра не поддерживает команды'; - $go = true; + $go = true; - $_POST['command'] = isset($cmd{0}) ? urldecode($cmd) : ''; + $_POST['command'] = isset($cmd{0}) ? urldecode($cmd) : ''; - include(SEC.'servers/'.$server['game'].'/console.php'); - } - } + include(SEC.'servers/'.$server['game'].'/console.php'); + } + } ?> \ No newline at end of file diff --git a/system/library/control/actions.php b/system/library/control/actions.php index 2972f05..14f8abc 100644 --- a/system/library/control/actions.php +++ b/system/library/control/actions.php @@ -1,360 +1,360 @@ query('SELECT `uid`, `unit`, `game`, `address`, `name` FROM `control_servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `uid`, `unit`, `game`, `address`, `name` FROM `control_servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - $sql->query('SELECT `address`, `passwd` FROM `control` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $sql->query('SELECT `address`, `passwd` FROM `control` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); - // Проверка ssh соедниения пу с локацией - if(!$ssh->auth($unit['passwd'], $unit['address'])) - return array('e' => sys::text('error', 'ssh')); + // Проверка ssh соедниения пу с локацией + if(!$ssh->auth($unit['passwd'], $unit['address'])) + return array('e' => sys::text('error', 'ssh')); - $ssh->set('kill -9 `ps aux | grep s_'.$server['uid'].' | grep -v grep | awk '."'{print $2}'".' | xargs;' - .'lsof -i@'.$server['address'].' | awk '."'{print $2}'".' | grep -v PID | xargs`; sudo -u server'.$server['uid'].' screen -wipe'); + $ssh->set('kill -9 `ps aux | grep s_'.$server['uid'].' | grep -v grep | awk '."'{print $2}'".' | xargs;' + .'lsof -i@'.$server['address'].' | awk '."'{print $2}'".' | grep -v PID | xargs`; sudo -u server'.$server['uid'].' screen -wipe'); - // Обновление информации в базе - $sql->query('UPDATE `control_servers` set `status`="off", `online`="0", `players`="", `stop`="0" WHERE `id`="'.$id.'" LIMIT 1'); + // Обновление информации в базе + $sql->query('UPDATE `control_servers` set `status`="off", `online`="0", `players`="", `stop`="0" WHERE `id`="'.$id.'" LIMIT 1'); - // Сброс кеша - actions::clmcache($id); + // Сброс кеша + actions::clmcache($id); - sys::reset_mcache('ctrl_server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'off', 'online' => 0, 'players' => '')); - sys::reset_mcache('ctrl_server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'off', 'online' => 0)); + sys::reset_mcache('ctrl_server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'off', 'online' => 0, 'players' => '')); + sys::reset_mcache('ctrl_server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'off', 'online' => 0)); - return array('s' => 'ok'); - } + return array('s' => 'ok'); + } - public static function change($id, $map = false) - { - global $cfg, $sql, $html, $user, $mcache; + public static function change($id, $map = false) + { + global $cfg, $sql, $html, $user, $mcache; - // Если в кеше есть карты - if($mcache->get('ctrl_server_maps_change_'.$id) != '' && !$map) - return array('maps' => $mcache->get('ctrl_server_maps_change_'.$id)); + // Если в кеше есть карты + if($mcache->get('ctrl_server_maps_change_'.$id) != '' && !$map) + return array('maps' => $mcache->get('ctrl_server_maps_change_'.$id)); - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - $sql->query('SELECT `uid`, `unit`, `game`, `online`, `players`, `name` FROM `control_servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `uid`, `unit`, `game`, `online`, `players`, `name` FROM `control_servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - $sql->query('SELECT `address`, `passwd` FROM `control` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $sql->query('SELECT `address`, `passwd` FROM `control` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); - // Проверка ssh соедниения пу с локацией - if(!$ssh->auth($unit['passwd'], $unit['address'])) - return array('e' => sys::text('error', 'ssh')); + // Проверка ssh соедниения пу с локацией + if(!$ssh->auth($unit['passwd'], $unit['address'])) + return array('e' => sys::text('error', 'ssh')); - // Массив карт игрового сервера (папка "maps") - $aMaps = explode("\n", $ssh->get('cd /servers/'.$server['uid'].'/cstrike/maps/ && ls | grep .bsp | grep -v .bsp.')); + // Массив карт игрового сервера (папка "maps") + $aMaps = explode("\n", $ssh->get('cd /servers/'.$server['uid'].'/cstrike/maps/ && ls | grep .bsp | grep -v .bsp.')); - // Удаление пустого элемента - unset($aMaps[count($aMaps)-1]); + // Удаление пустого элемента + unset($aMaps[count($aMaps)-1]); - // Удаление ".bsp" - $aMaps = str_replace('.bsp', '', $aMaps); + // Удаление ".bsp" + $aMaps = str_replace('.bsp', '', $aMaps); - // Если выбрана карта - if($map) - { - // Проверка наличия выбранной карты - if(!in_array($map, $aMaps)) - return array('e' => sys::updtext(sys::text('servers', 'change'), array('map' => $map.'.bsp'))); + // Если выбрана карта + if($map) + { + // Проверка наличия выбранной карты + if(!in_array($map, $aMaps)) + return array('e' => sys::updtext(sys::text('servers', 'change'), array('map' => $map.'.bsp'))); - // Отправка команды changelevel - $ssh->set('sudo -u server'.$server['uid'].' screen -p 0 -S s_'.$server['uid'].' -X eval '."'stuff \"changelevel ".sys::cmd($map)."\"\015'"); + // Отправка команды changelevel + $ssh->set('sudo -u server'.$server['uid'].' screen -p 0 -S s_'.$server['uid'].' -X eval '."'stuff \"changelevel ".sys::cmd($map)."\"\015'"); - // Обновление информации в базе - $sql->query('UPDATE `control_servers` set `status`="change" WHERE `id`="'.$id.'" LIMIT 1'); + // Обновление информации в базе + $sql->query('UPDATE `control_servers` set `status`="change" WHERE `id`="'.$id.'" LIMIT 1'); - // Сброс кеша - actions::clmcache($id); + // Сброс кеша + actions::clmcache($id); - sys::reset_mcache('ctrl_server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'change', 'online' => $server['online'], 'players' => base64_decode($server['players']))); - sys::reset_mcache('ctrl_server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'change', 'online' => $server['online'])); + sys::reset_mcache('ctrl_server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'change', 'online' => $server['online'], 'players' => base64_decode($server['players']))); + sys::reset_mcache('ctrl_server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'change', 'online' => $server['online'])); - return array('s' => 'ok'); - } + return array('s' => 'ok'); + } - // Сортировка списка карт - sort($aMaps); - reset($aMaps); + // Сортировка списка карт + sort($aMaps); + reset($aMaps); - // Генерация списка карт для выбора - foreach($aMaps as $map) - { - $html->get('change_list', 'sections/control/servers/games'); - $html->set('img', file_exists(DIR.'/maps/'.$server['game'].'/'.$map.'.jpg') ? $cfg['http'].'maps/'.$server['game'].'/'.$map.'.jpg' : $cfg['http'].'template/images/status/none.jpg'); - $html->set('name', $map); - $html->set('id', $server['unit']); - $html->set('server', $id); - $html->pack('maps'); - } + // Генерация списка карт для выбора + foreach($aMaps as $map) + { + $html->get('change_list', 'sections/control/servers/games'); + $html->set('img', file_exists(DIR.'/maps/'.$server['game'].'/'.$map.'.jpg') ? $cfg['http'].'maps/'.$server['game'].'/'.$map.'.jpg' : $cfg['http'].'template/images/status/none.jpg'); + $html->set('name', $map); + $html->set('id', $server['unit']); + $html->set('server', $id); + $html->pack('maps'); + } - // Запись карт в кеш - $mcache->set('ctrl_server_maps_change_'.$id, $html->arr['maps'], false, 30); + // Запись карт в кеш + $mcache->set('ctrl_server_maps_change_'.$id, $html->arr['maps'], false, 30); - return array('maps' => $html->arr['maps']); - } + return array('maps' => $html->arr['maps']); + } - public static function reinstall($id) - { - global $cfg, $sql, $user, $start_point; + public static function reinstall($id) + { + global $cfg, $sql, $user, $start_point; - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - $sql->query('SELECT `uid`, `unit`, `address`, `game`, `name`, `pack`, `ftp`, `core_fix` FROM `control_servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `uid`, `unit`, `address`, `game`, `name`, `pack`, `ftp`, `core_fix` FROM `control_servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - $sql->query('SELECT `address`, `passwd`, `fcpu` FROM `control` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $sql->query('SELECT `address`, `passwd`, `fcpu` FROM `control` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); - // Проверка ssh соедниения пу с локацией - if(!$ssh->auth($unit['passwd'], $unit['address'])) - return array('e' => sys::text('error', 'ssh')); + // Проверка ssh соедниения пу с локацией + if(!$ssh->auth($unit['passwd'], $unit['address'])) + return array('e' => sys::text('error', 'ssh')); - $ssh->set('kill -9 `ps aux | grep s_'.$server['uid'].' | grep -v grep | awk '."'{print $2}'".' | xargs;' - .'lsof -i@'.$server['address'].' | awk '."'{print $2}'".' | grep -v PID | xargs`; sudo -u server'.$server['uid'].' screen -wipe'); + $ssh->set('kill -9 `ps aux | grep s_'.$server['uid'].' | grep -v grep | awk '."'{print $2}'".' | xargs;' + .'lsof -i@'.$server['address'].' | awk '."'{print $2}'".' | grep -v PID | xargs`; sudo -u server'.$server['uid'].' screen -wipe'); - $taskset = ''; + $taskset = ''; - // Если включена система автораспределения и не установлен фиксированный поток - if(!$server['core_fix']) - { - $proc_stat = array(); + // Если включена система автораспределения и не установлен фиксированный поток + if(!$server['core_fix']) + { + $proc_stat = array(); - $proc_stat[0] = $ssh->get('cat /proc/stat'); - } + $proc_stat[0] = $ssh->get('cat /proc/stat'); + } - $path = 'rm '.$server['pack'].'.zip; wget '.$cfg['control_server'].'/'.$server['pack'].'.zip; unzip '.$server['pack'].'.zip; rm '.$server['pack'].'.zip;'; + $path = 'rm '.$server['pack'].'.zip; wget '.$cfg['control_server'].'/'.$server['pack'].'.zip; unzip '.$server['pack'].'.zip; rm '.$server['pack'].'.zip;'; - if(in_array($server['game'], array('css', 'csgo'))) - $path = 'cd '.$cfg['steamcmd'].'; ./steamcmd.sh +login anonymous +force_install_dir "/servers/'.$uid.'" +app_update '.$cfg['control_steamcmd'][$game].' +quit;'; + if(in_array($server['game'], array('css', 'csgo'))) + $path = 'cd '.$cfg['steamcmd'].'; ./steamcmd.sh +login anonymous +force_install_dir "/servers/'.$uid.'" +app_update '.$cfg['control_steamcmd'][$game].' +quit;'; - // Директория игрового сервера - $install = '/servers/'.$server['uid']; + // Директория игрового сервера + $install = '/servers/'.$server['uid']; - // Если система автораспределения продолжить парсинг загрузки процессора - if(isset($proc_stat)) - { - $proc_stat[1] = $ssh->get('cat /proc/stat'); + // Если система автораспределения продолжить парсинг загрузки процессора + if(isset($proc_stat)) + { + $proc_stat[1] = $ssh->get('cat /proc/stat'); - // Ядро/поток, на котором будет запущен игровой сервер (поток выбран с рассчетом наименьшей загруженности в момент запуска игрового сервера) - $core = sys::cpu_idle($proc_stat, $server['unit'], $unit['fcpu'], true); // число от 1 до n (где n число ядер/потоков в процессоре (без нулевого) + // Ядро/поток, на котором будет запущен игровой сервер (поток выбран с рассчетом наименьшей загруженности в момент запуска игрового сервера) + $core = sys::cpu_idle($proc_stat, $server['unit'], $unit['fcpu'], true); // число от 1 до n (где n число ядер/потоков в процессоре (без нулевого) - if(!is_numeric($core)) - return array('e' => 'Не удается выполнить операцию, нет свободного потока.'); + if(!is_numeric($core)) + return array('e' => 'Не удается выполнить операцию, нет свободного потока.'); - $taskset = 'taskset -c '.$core; - } + $taskset = 'taskset -c '.$core; + } - if($server['core_fix']) - { - $core = $server['core_fix']-1; - $taskset = 'taskset -c '.$core; - } + if($server['core_fix']) + { + $core = $server['core_fix']-1; + $taskset = 'taskset -c '.$core; + } - $ssh->set('rm -r '.$install.';' // Удаление директории игрового сервера - .'mkdir '.$install.';' // Создание директории - .'chown server'.$server['uid'].':1000 '.$install.';' // Изменение владельца и группы директории - .'cd '.$install.' && sudo -u server'.$server['uid'].' '.$taskset.' screen -dmS r_'.$server['uid'].' sh -c "' - .$path // Копирование файлов сборки для сервера - .'find . -type d -exec chmod 700 {} \;;' - .'find . -type f -exec chmod 600 {} \;;' - .'chmod 500 '.params::$aFileGame[$server['game']].'"'); + $ssh->set('rm -r '.$install.';' // Удаление директории игрового сервера + .'mkdir '.$install.';' // Создание директории + .'chown server'.$server['uid'].':1000 '.$install.';' // Изменение владельца и группы директории + .'cd '.$install.' && sudo -u server'.$server['uid'].' '.$taskset.' screen -dmS r_'.$server['uid'].' sh -c "' + .$path // Копирование файлов сборки для сервера + .'find . -type d -exec chmod 700 {} \;;' + .'find . -type f -exec chmod 600 {} \;;' + .'chmod 500 '.params::$aFileGame[$server['game']].'"'); - // Очистка записей в базе - $sql->query('DELETE FROM `control_admins_'.$server['game'].'` WHERE `server`="'.$id.'"'); // Список админов на сервере - $sql->query('DELETE FROM `control_plugins_install` WHERE `server`="'.$id.'"'); // Список установленных плагинов на сервере + // Очистка записей в базе + $sql->query('DELETE FROM `control_admins_'.$server['game'].'` WHERE `server`="'.$id.'"'); // Список админов на сервере + $sql->query('DELETE FROM `control_plugins_install` WHERE `server`="'.$id.'"'); // Список установленных плагинов на сервере - $core = !isset($core) ? 0 : $core+1; + $core = !isset($core) ? 0 : $core+1; - // Обновление информации в базе - $sql->query('UPDATE `control_servers` set `status`="reinstall", `core_use`="'.$core.'", `fastdl`="0" WHERE `id`="'.$id.'" LIMIT 1'); + // Обновление информации в базе + $sql->query('UPDATE `control_servers` set `status`="reinstall", `core_use`="'.$core.'", `fastdl`="0" WHERE `id`="'.$id.'" LIMIT 1'); - // Сброс кеша - actions::clmcache($id); + // Сброс кеша + actions::clmcache($id); - sys::reset_mcache('ctrl_server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'reinstall', 'online' => 0, 'players' => '')); - sys::reset_mcache('ctrl_server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'reinstall', 'online' => 0)); + sys::reset_mcache('ctrl_server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'reinstall', 'online' => 0, 'players' => '')); + sys::reset_mcache('ctrl_server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'reinstall', 'online' => 0)); - return array('s' => 'ok'); - } + return array('s' => 'ok'); + } - public static function update($id) - { - global $cfg, $sql, $user, $start_point; + public static function update($id) + { + global $cfg, $sql, $user, $start_point; - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - $sql->query('SELECT `uid`, `unit`, `address`, `game`, `name`, `pack`, `ftp` FROM `control_servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `uid`, `unit`, `address`, `game`, `name`, `pack`, `ftp` FROM `control_servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - $sql->query('SELECT `address`, `passwd`, `fcpu` FROM `control` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $sql->query('SELECT `address`, `passwd`, `fcpu` FROM `control` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); - // Проверка ssh соедниения пу с локацией - if(!$ssh->auth($unit['passwd'], $unit['address'])) - return array('e' => sys::text('error', 'ssh')); + // Проверка ssh соедниения пу с локацией + if(!$ssh->auth($unit['passwd'], $unit['address'])) + return array('e' => sys::text('error', 'ssh')); - $ssh->set('kill -9 `ps aux | grep s_'.$server['uid'].' | grep -v grep | awk '."'{print $2}'".' | xargs;' - .'lsof -i@'.$server['address'].' | awk '."'{print $2}'".' | grep -v PID | xargs`; sudo -u server'.$server['uid'].' screen -wipe'); + $ssh->set('kill -9 `ps aux | grep s_'.$server['uid'].' | grep -v grep | awk '."'{print $2}'".' | xargs;' + .'lsof -i@'.$server['address'].' | awk '."'{print $2}'".' | grep -v PID | xargs`; sudo -u server'.$server['uid'].' screen -wipe'); - $taskset = ''; + $taskset = ''; - // Если включена система автораспределения и не установлен фиксированный поток - if(!$server['core_fix']) - { - $proc_stat = array(); + // Если включена система автораспределения и не установлен фиксированный поток + if(!$server['core_fix']) + { + $proc_stat = array(); - $proc_stat[0] = $ssh->get('cat /proc/stat'); - } + $proc_stat[0] = $ssh->get('cat /proc/stat'); + } - $path = 'rm '.$server['pack'].'_udp.zip; wget '.$cfg['control_server'].'/'.$server['pack'].'_udp.zip; unzip -u '.$server['pack'].'_udp.zip; rm '.$server['pack'].'_udp.zip;'; + $path = 'rm '.$server['pack'].'_udp.zip; wget '.$cfg['control_server'].'/'.$server['pack'].'_udp.zip; unzip -u '.$server['pack'].'_udp.zip; rm '.$server['pack'].'_udp.zip;'; - // Директория игрового сервера - $install = '/servers/'.$server['uid']; + // Директория игрового сервера + $install = '/servers/'.$server['uid']; - // Если система автораспределения продолжить парсинг загрузки процессора - if(isset($proc_stat)) - { - $proc_stat[1] = $ssh->get('cat /proc/stat'); + // Если система автораспределения продолжить парсинг загрузки процессора + if(isset($proc_stat)) + { + $proc_stat[1] = $ssh->get('cat /proc/stat'); - // Ядро/поток, на котором будет запущен игровой сервер (поток выбран с рассчетом наименьшей загруженности в момент запуска игрового сервера) - $core = sys::cpu_idle($proc_stat, $server['unit'], $unit['fcpu'], true); // число от 1 до n (где n число ядер/потоков в процессоре (без нулевого) + // Ядро/поток, на котором будет запущен игровой сервер (поток выбран с рассчетом наименьшей загруженности в момент запуска игрового сервера) + $core = sys::cpu_idle($proc_stat, $server['unit'], $unit['fcpu'], true); // число от 1 до n (где n число ядер/потоков в процессоре (без нулевого) - if(!is_numeric($core)) - return array('e' => 'Не удается выполнить операцию, нет свободного потока.'); + if(!is_numeric($core)) + return array('e' => 'Не удается выполнить операцию, нет свободного потока.'); - $taskset = 'taskset -c '.$core; - } + $taskset = 'taskset -c '.$core; + } - if($server['core_fix']) - { - $core = $server['core_fix']-1; - $taskset = 'taskset -c '.$core; - } + if($server['core_fix']) + { + $core = $server['core_fix']-1; + $taskset = 'taskset -c '.$core; + } - $ssh->set('cd '.$install.' && sudo -u server'.$server['uid'].' '.$taskset.' screen -dmS u_'.$server['uid'].' sh -c "'.$path // Копирование файлов обвновления сборки для сервера - .'find . -type d -exec chmod 700 {} \;;' - .'find . -type f -exec chmod 600 {} \;;' - .'chmod 500 '.params::$aFileGame[$server['game']].'"'); + $ssh->set('cd '.$install.' && sudo -u server'.$server['uid'].' '.$taskset.' screen -dmS u_'.$server['uid'].' sh -c "'.$path // Копирование файлов обвновления сборки для сервера + .'find . -type d -exec chmod 700 {} \;;' + .'find . -type f -exec chmod 600 {} \;;' + .'chmod 500 '.params::$aFileGame[$server['game']].'"'); - $core = !isset($core) ? 0 : $core+1; + $core = !isset($core) ? 0 : $core+1; - // Обновление информации в базе - $sql->query('UPDATE `control_servers` set `status`="update", `core_use`="'.$core.'" WHERE `id`="'.$id.'" LIMIT 1'); + // Обновление информации в базе + $sql->query('UPDATE `control_servers` set `status`="update", `core_use`="'.$core.'" WHERE `id`="'.$id.'" LIMIT 1'); - // Сброс кеша - actions::clmcache($id); + // Сброс кеша + actions::clmcache($id); - sys::reset_mcache('ctrl_server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'update', 'online' => 0, 'players' => '')); - sys::reset_mcache('ctrl_server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'update', 'online' => 0)); + sys::reset_mcache('ctrl_server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'update', 'online' => 0, 'players' => '')); + sys::reset_mcache('ctrl_server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'update', 'online' => 0)); - return array('s' => 'ok'); - } + return array('s' => 'ok'); + } - public static function delete($id) - { - global $cfg, $sql, $user; + public static function delete($id) + { + global $cfg, $sql, $user; - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - $sql->query('SELECT `uid`, `unit`, `game`, `slots`, `address` FROM `control_servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `uid`, `unit`, `game`, `slots`, `address` FROM `control_servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - if(!$server['uid']) - return array('e' => 'uid 404'); + if(!$server['uid']) + return array('e' => 'uid 404'); - $sql->query('SELECT `address`, `passwd`, `sql_login`, `sql_passwd`, `sql_port`, `sql_ftp` FROM `control` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $sql->query('SELECT `address`, `passwd`, `sql_login`, `sql_passwd`, `sql_port`, `sql_ftp` FROM `control` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); - // Проверка ssh соедниения пу с локацией - if(!$ssh->auth($unit['passwd'], $unit['address'])) - return array('e' => sys::text('error', 'ssh')); + // Проверка ssh соедниения пу с локацией + if(!$ssh->auth($unit['passwd'], $unit['address'])) + return array('e' => sys::text('error', 'ssh')); - // Убить процессы - $ssh->set('kill -9 `ps aux | grep s_'.$server['uid'].' | grep -v grep | awk '."'{print $2}'".' | xargs;' - .'lsof -i@:'.$server['address'].' | awk '."'{print $2}'".' | xargs`; sudo -u server'.$server['uid'].' screen -wipe'); + // Убить процессы + $ssh->set('kill -9 `ps aux | grep s_'.$server['uid'].' | grep -v grep | awk '."'{print $2}'".' | xargs;' + .'lsof -i@:'.$server['address'].' | awk '."'{print $2}'".' | xargs`; sudo -u server'.$server['uid'].' screen -wipe'); - // Директория игрового сервера - $install = '/servers/'.$server['uid']; + // Директория игрового сервера + $install = '/servers/'.$server['uid']; - $copys = 'screen -dmS r_copy_'.$server['uid'].' sh -c "'; + $copys = 'screen -dmS r_copy_'.$server['uid'].' sh -c "'; - $scopy = $sql->query('SELECT `id`, `name` FROM `control_copy` WHERE `server`="'.$id.'"'); - while($copy = $sql->get($scopy)) - { - $copys .= 'rm /copy/'.$copy['name'].'.tar;'; + $scopy = $sql->query('SELECT `id`, `name` FROM `control_copy` WHERE `server`="'.$id.'"'); + while($copy = $sql->get($scopy)) + { + $copys .= 'rm /copy/'.$copy['name'].'.tar;'; - $sql->query('DELETE FROM `control_copy` WHERE `id`="'.$copy['id'].'" LIMIT 1'); - } + $sql->query('DELETE FROM `control_copy` WHERE `id`="'.$copy['id'].'" LIMIT 1'); + } - $copys .= '";'; + $copys .= '";'; - $ssh->set($copys // Удаление резервных копий - .'screen -dmS r_'.$server['uid'].' sh -c "rm -r '.$install.';' // Удаление директории сервера - .'userdel server'.$server['uid'].'"'); // Удаление пользователя сервера c локации + $ssh->set($copys // Удаление резервных копий + .'screen -dmS r_'.$server['uid'].' sh -c "rm -r '.$install.';' // Удаление директории сервера + .'userdel server'.$server['uid'].'"'); // Удаление пользователя сервера c локации - // Удаление ftp доступа - $qSql = 'DELETE FROM users WHERE username=\''.$server['uid'].'\';'; + // Удаление ftp доступа + $qSql = 'DELETE FROM users WHERE username=\''.$server['uid'].'\';'; $ssh->set('screen -dmS ftp'.$server['uid'].' mysql -P '.$unit['sql_port'].' -u'.$unit['sql_login'].' -p'.$unit['sql_passwd'].' --database '.$unit['sql_ftp'].' -e "'.$qSql.'"'); - // Очистка правил FireWall - ctrl::iptables($id, 'remove', NULL, NULL, $server['unit'], false, $ssh); + // Очистка правил FireWall + ctrl::iptables($id, 'remove', NULL, NULL, $server['unit'], false, $ssh); - // Удаление заданий из crontab - $sql->query('SELECT `address`, `passwd` FROM `panel` LIMIT 1'); - $panel = $sql->get(); + // Удаление заданий из crontab + $sql->query('SELECT `address`, `passwd` FROM `panel` LIMIT 1'); + $panel = $sql->get(); - if(!$ssh->auth($panel['passwd'], $panel['address'])) - return array('e' => 'Неудалось создать связь с панелью'); + if(!$ssh->auth($panel['passwd'], $panel['address'])) + return array('e' => 'Неудалось создать связь с панелью'); - $crons = $sql->query('SELECT `id`, `cron` FROM `control_crontab` WHERE `server`="'.$id.'"'); - while($cron = $sql->get($crons)) - { - $ssh->set('echo "" >> /etc/crontab && cat /etc/crontab'); - $crontab = str_replace($cron['cron'], '', $ssh->get()); + $crons = $sql->query('SELECT `id`, `cron` FROM `control_crontab` WHERE `server`="'.$id.'"'); + while($cron = $sql->get($crons)) + { + $ssh->set('echo "" >> /etc/crontab && cat /etc/crontab'); + $crontab = str_replace($cron['cron'], '', $ssh->get()); - // Временный файл - $temp = sys::temp($crontab); + // Временный файл + $temp = sys::temp($crontab); - $ssh->setfile($temp, '/etc/crontab', 0644); + $ssh->setfile($temp, '/etc/crontab', 0644); - $ssh->set("sed -i '/^$/d' /etc/crontab"); - $ssh->set('crontab -u root /etc/crontab'); + $ssh->set("sed -i '/^$/d' /etc/crontab"); + $ssh->set('crontab -u root /etc/crontab'); - unlink($temp); + unlink($temp); - $sql->query('DELETE FROM `control_crontab` WHERE `id`="'.$cron['id'].'" LIMIT 1'); - } + $sql->query('DELETE FROM `control_crontab` WHERE `id`="'.$cron['id'].'" LIMIT 1'); + } - // Удаление различной информации игрового сервера - $sql->query('DELETE FROM `control_admins_'.$server['game'].'` WHERE `server`="'.$id.'" LIMIT 1'); - $sql->query('DELETE FROM `control_plugins_install` WHERE `server`="'.$id.'" LIMIT 1'); - $sql->query('DELETE FROM `control_plugins_buy` WHERE `server`="'.$id.'" LIMIT 1'); - $sql->query('DELETE FROM `control_servers` WHERE `id`="'.$id.'" LIMIT 1'); + // Удаление различной информации игрового сервера + $sql->query('DELETE FROM `control_admins_'.$server['game'].'` WHERE `server`="'.$id.'" LIMIT 1'); + $sql->query('DELETE FROM `control_plugins_install` WHERE `server`="'.$id.'" LIMIT 1'); + $sql->query('DELETE FROM `control_plugins_buy` WHERE `server`="'.$id.'" LIMIT 1'); + $sql->query('DELETE FROM `control_servers` WHERE `id`="'.$id.'" LIMIT 1'); - return array('s' => 'ok'); - } + return array('s' => 'ok'); + } - public static function clmcache($id) - { - global $mcache; + public static function clmcache($id) + { + global $mcache; - $mcache->delete('ctrl_server_index_'.$id); - $mcache->delete('ctrl_server_resources_'.$id); - $mcache->delete('ctrl_server_status_'.$id); - } - } \ No newline at end of file + $mcache->delete('ctrl_server_index_'.$id); + $mcache->delete('ctrl_server_resources_'.$id); + $mcache->delete('ctrl_server_status_'.$id); + } + } \ No newline at end of file diff --git a/system/library/control/control.php b/system/library/control/control.php index 73470eb..36718e9 100644 --- a/system/library/control/control.php +++ b/system/library/control/control.php @@ -1,448 +1,448 @@ arr['btn'] = ''; + $html->arr['btn'] = ''; - if($status == 'working') - { - $html->get('restart', 'sections/control/buttons'); - $html->set('id', $id); - $html->pack('btn'); + if($status == 'working') + { + $html->get('restart', 'sections/control/buttons'); + $html->set('id', $id); + $html->pack('btn'); - return $html->arr['btn']; - } + return $html->arr['btn']; + } - return ''; - } + return ''; + } - public static function resources($id) - { - global $sql; + public static function resources($id) + { + global $sql; - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - $aData = array( - 'cpu' => '0%', - 'ram' => '0%', - 'hdd' => '0%' - ); + $aData = array( + 'cpu' => '0%', + 'ram' => '0%', + 'hdd' => '0%' + ); - $sql->query('SELECT `address`, `passwd` FROM `control` WHERE `id`="'.$id.'" LIMIT 1'); - $ctrl = $sql->get(); + $sql->query('SELECT `address`, `passwd` FROM `control` WHERE `id`="'.$id.'" LIMIT 1'); + $ctrl = $sql->get(); - if(!$ssh->auth($ctrl['passwd'], $ctrl['address'])) - sys::outjs($aData); + if(!$ssh->auth($ctrl['passwd'], $ctrl['address'])) + sys::outjs($aData); - $data = $ssh->get('echo `cat /proc/meminfo | grep MemTotal | awk \'{print $2}\'; cat /proc/meminfo | grep MemFree | awk \'{print $2}\'; cat /proc/meminfo | grep Buffers | awk \'{print $2}\'; cat /proc/meminfo | grep Cached | grep -v SwapCached | awk \'{print $2}\'`'); - $aData['ram'] = ceil(ctrl::ram_load($data)).'%'; + $data = $ssh->get('echo `cat /proc/meminfo | grep MemTotal | awk \'{print $2}\'; cat /proc/meminfo | grep MemFree | awk \'{print $2}\'; cat /proc/meminfo | grep Buffers | awk \'{print $2}\'; cat /proc/meminfo | grep Cached | grep -v SwapCached | awk \'{print $2}\'`'); + $aData['ram'] = ceil(ctrl::ram_load($data)).'%'; - $aData['hdd'] = trim($ssh->get('df -h | awk \'/rootfs/ {print $5}\'')); + $aData['hdd'] = trim($ssh->get('df -h | awk \'/rootfs/ {print $5}\'')); - $aData['cpu'] = ctrl::cpu_load($ssh->get('echo "`ps -A -o pcpu | tail -n+2 | paste -sd+ | bc | awk \'{print $0}\'` `cat /proc/cpuinfo | grep processor | wc -l | awk \'{print $1}\'`"')).'%'; + $aData['cpu'] = ctrl::cpu_load($ssh->get('echo "`ps -A -o pcpu | tail -n+2 | paste -sd+ | bc | awk \'{print $0}\'` `cat /proc/cpuinfo | grep processor | wc -l | awk \'{print $1}\'`"')).'%'; - sys::outjs($aData); - } + sys::outjs($aData); + } - public static function update_info($id) - { - global $sql; + public static function update_info($id) + { + global $sql; - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - $aData = array( - 'cpu' => 'произошла ошибка', - 'ram' => 'произошла ошибка', - 'hdd' => 'произошла ошибка' - ); + $aData = array( + 'cpu' => 'произошла ошибка', + 'ram' => 'произошла ошибка', + 'hdd' => 'произошла ошибка' + ); - $sql->query('SELECT `address`, `passwd` FROM `control` WHERE `id`="'.$id.'" LIMIT 1'); - $ctrl = $sql->get(); + $sql->query('SELECT `address`, `passwd` FROM `control` WHERE `id`="'.$id.'" LIMIT 1'); + $ctrl = $sql->get(); - if(!$ssh->auth($ctrl['passwd'], $ctrl['address'].':22')) - sys::outjs($aData); + if(!$ssh->auth($ctrl['passwd'], $ctrl['address'].':22')) + sys::outjs($aData); - $data = $ssh->get('cat /proc/meminfo | grep MemTotal | cut -d \' \' -f 2-'); - $aData['ram'] = $data.' ('.(round(sys::int($data)/1024/1024, 2)).'Gb)'; + $data = $ssh->get('cat /proc/meminfo | grep MemTotal | cut -d \' \' -f 2-'); + $aData['ram'] = $data.' ('.(round(sys::int($data)/1024/1024, 2)).'Gb)'; - $aData['hdd'] = trim($ssh->get('df -h | awk \'/rootfs/ {print $2}\'')); + $aData['hdd'] = trim($ssh->get('df -h | awk \'/rootfs/ {print $2}\'')); - $aCPU = explode("\n", trim($ssh->get('cat /proc/cpuinfo | grep -c processor && cat /proc/cpuinfo | grep "MHz" | awk \'{print $4}\' | head -n 1'))); - - $aData['cpu'] = $aCPU[0].'x'.round($aCPU[1], 0).' MHz ['.trim($ssh->get('cat /proc/cpuinfo | grep -m 1 "model name" | cut -d \' \' -f 3-')).']'; + $aCPU = explode("\n", trim($ssh->get('cat /proc/cpuinfo | grep -c processor && cat /proc/cpuinfo | grep "MHz" | awk \'{print $4}\' | head -n 1'))); + + $aData['cpu'] = $aCPU[0].'x'.round($aCPU[1], 0).' MHz ['.trim($ssh->get('cat /proc/cpuinfo | grep -m 1 "model name" | cut -d \' \' -f 3-')).']'; - sys::outjs($aData); - } + sys::outjs($aData); + } - public static function update_status($id, $ssh = false) - { - global $cfg, $sql, $start_point, $mcache; + public static function update_status($id, $ssh = false) + { + global $cfg, $sql, $start_point, $mcache; - if(!$ssh) - include(LIB.'ssh.php'); + if(!$ssh) + include(LIB.'ssh.php'); - $sql->query('SELECT `address`, `passwd`, `time`, `overdue`, `block`, `status` FROM `control` WHERE `id`="'.$id.'" LIMIT 1'); - $ctrl = $sql->get(); + $sql->query('SELECT `address`, `passwd`, `time`, `overdue`, `block`, `status` FROM `control` WHERE `id`="'.$id.'" LIMIT 1'); + $ctrl = $sql->get(); - $status = $ctrl['status']; + $status = $ctrl['status']; - if($ctrl['status'] == 'blocked' && $ctrl['block'] < $start_point) - $sql->query('UPDATE `control` set `block`="0", `status`="working" WHERE `id`="'.$id.'" LIMIT 1'); + if($ctrl['status'] == 'blocked' && $ctrl['block'] < $start_point) + $sql->query('UPDATE `control` set `block`="0", `status`="working" WHERE `id`="'.$id.'" LIMIT 1'); - if($ctrl['status'] == 'blocked') - return 'blocked'; + if($ctrl['status'] == 'blocked') + return 'blocked'; - // Если аренда закончилась и сервер просрочен длительное время - if($ctrl['time'] < $start_point && $ctrl['status'] == 'overdue' && ($ctrl['overdue']+$cfg['control_delete']*86400) < $start_point) - { - $sql->query('UPDATE `control` set `user`="-1" WHERE `id`="'.$id.'" LIMIT 1'); + // Если аренда закончилась и сервер просрочен длительное время + if($ctrl['time'] < $start_point && $ctrl['status'] == 'overdue' && ($ctrl['overdue']+$cfg['control_delete']*86400) < $start_point) + { + $sql->query('UPDATE `control` set `user`="-1" WHERE `id`="'.$id.'" LIMIT 1'); - return 'delete'; - } + return 'delete'; + } - // Если аренда закончилась, а услуга не просрочена - if($ctrl['time'] < $start_point && !in_array($ctrl['status'], array('overdue', 'blocked'))) - { - $sql->query('UPDATE `control` set `status`="overdue" WHERE `id`="'.$id.'" LIMIT 1'); + // Если аренда закончилась, а услуга не просрочена + if($ctrl['time'] < $start_point && !in_array($ctrl['status'], array('overdue', 'blocked'))) + { + $sql->query('UPDATE `control` set `status`="overdue" WHERE `id`="'.$id.'" LIMIT 1'); - $status = 'overdue'; - } + $status = 'overdue'; + } - // Если аренда не закончилась, а услуга просрочена - if($ctrl['time'] > $start_point && $ctrl['status'] == 'overdue') - $sql->query('UPDATE `control` set `status`="working" WHERE `id`="'.$id.'" LIMIT 1'); + // Если аренда не закончилась, а услуга просрочена + if($ctrl['time'] > $start_point && $ctrl['status'] == 'overdue') + $sql->query('UPDATE `control` set `status`="working" WHERE `id`="'.$id.'" LIMIT 1'); - if(in_array($ctrl['status'], array('working', 'error'))) - { - $status = 'working'; - if(!$ssh->auth($ctrl['passwd'], $ctrl['address'])) - $status = 'error'; + if(in_array($ctrl['status'], array('working', 'error'))) + { + $status = 'working'; + if(!$ssh->auth($ctrl['passwd'], $ctrl['address'])) + $status = 'error'; - $sql->query('UPDATE `control` set `status`="'.$status.'" WHERE `id`="'.$id.'" LIMIT 1'); - } + $sql->query('UPDATE `control` set `status`="'.$status.'" WHERE `id`="'.$id.'" LIMIT 1'); + } - if($ctrl['status'] == 'reboot' && !$mcache->get('reboot_control_'.$id)) - { - if($ssh->auth($ctrl['passwd'], $ctrl['address'])) - { - $sql->query('UPDATE `control` set `status`="working" WHERE `id`="'.$id.'" LIMIT 1'); + if($ctrl['status'] == 'reboot' && !$mcache->get('reboot_control_'.$id)) + { + if($ssh->auth($ctrl['passwd'], $ctrl['address'])) + { + $sql->query('UPDATE `control` set `status`="working" WHERE `id`="'.$id.'" LIMIT 1'); - $status = 'working'; - } - } + $status = 'working'; + } + } - $time_end = $ctrl['status'] == 'overdue' ? 'Удаление через: '.sys::date('min', $ctrl['overdue']+$cfg['control_delete']*86400) : 'Осталось: '.sys::date('min', $ctrl['time']); + $time_end = $ctrl['status'] == 'overdue' ? 'Удаление через: '.sys::date('min', $ctrl['overdue']+$cfg['control_delete']*86400) : 'Осталось: '.sys::date('min', $ctrl['time']); - $aData = array( - 'time' => sys::today($ctrl['time']), - 'time_end' => $time_end, - 'buttons' => ctrl::buttons($id, $status), - 'status' => ctrl::status($status) - ); + $aData = array( + 'time' => sys::today($ctrl['time']), + 'time_end' => $time_end, + 'buttons' => ctrl::buttons($id, $status), + 'status' => ctrl::status($status) + ); - return $aData; - } + return $aData; + } - public static function ram_load($data) - { - $aData = explode(' ', $data); + public static function ram_load($data) + { + $aData = explode(' ', $data); - return ceil(($aData[0]-($aData[1]+$aData[2]+$aData[3]))*100/$aData[0]); - } + return ceil(($aData[0]-($aData[1]+$aData[2]+$aData[3]))*100/$aData[0]); + } - public static function cpu_load($data) - { - $aData = explode(' ', $data); + public static function cpu_load($data) + { + $aData = explode(' ', $data); - $load = ceil($aData[0]/$aData[1]); + $load = ceil($aData[0]/$aData[1]); - return $load > 100 ? 100 : $load; - } + return $load > 100 ? 100 : $load; + } - public static function nav($server, $id, $sid, $active) - { - global $cfg, $html, $sql, $mcache, $start_point; + public static function nav($server, $id, $sid, $active) + { + global $cfg, $html, $sql, $mcache, $start_point; - $aUnit = array('index', 'console', 'settings', 'plugins', 'filetp', 'copy', 'boost'); + $aUnit = array('index', 'console', 'settings', 'plugins', 'filetp', 'copy', 'boost'); - $html->get('gmenu', 'sections/control/servers/'.$server['game']); + $html->get('gmenu', 'sections/control/servers/'.$server['game']); - $html->set('id', $id); - $html->set('server', $sid); - $html->set('home', $cfg['http']); + $html->set('id', $id); + $html->set('server', $sid); + $html->set('home', $cfg['http']); - foreach($aUnit as $unit) - if($unit == $active) $html->unit($unit, 1); else $html->unit($unit); + foreach($aUnit as $unit) + if($unit == $active) $html->unit($unit, 1); else $html->unit($unit); - $html->pack('main'); + $html->pack('main'); - $html->get('vmenu', 'sections/control/servers/'.$server['game']); + $html->get('vmenu', 'sections/control/servers/'.$server['game']); - $html->set('id', $id); - $html->set('server', $sid); - $html->set('home', $cfg['http']); + $html->set('id', $id); + $html->set('server', $sid); + $html->set('home', $cfg['http']); - foreach($aUnit as $unit) - if($unit == $active) $html->unit($unit, 1); else $html->unit($unit); + foreach($aUnit as $unit) + if($unit == $active) $html->unit($unit, 1); else $html->unit($unit); - $html->pack('vmenu'); + $html->pack('vmenu'); - return NULL; - } + return NULL; + } - public static function route($server, $inc, $go) - { - global $device, $start_point; + public static function route($server, $inc, $go) + { + global $device, $start_point; - if(in_array($server['status'], array('install', 'reinstall', 'update', 'recovery'))) - { - if($go) - sys::out('Раздел недоступен'); + if(in_array($server['status'], array('install', 'reinstall', 'update', 'recovery'))) + { + if($go) + sys::out('Раздел недоступен'); - return SEC.'control/servers/noaccess.php'; - } + return SEC.'control/servers/noaccess.php'; + } - if(!file_exists(SEC.'control/servers/'.$server['game'].'/'.$inc.'.php')) - return SEC.'control/servers/'.$server['game'].'/index.php'; + if(!file_exists(SEC.'control/servers/'.$server['game'].'/'.$inc.'.php')) + return SEC.'control/servers/'.$server['game'].'/index.php'; - return SEC.'control/servers/'.$server['game'].'/'.$inc.'.php'; - } + return SEC.'control/servers/'.$server['game'].'/'.$inc.'.php'; + } - public static function cpulist($unit, $core, $count = false) - { - global $device, $start_point; + public static function cpulist($unit, $core, $count = false) + { + global $device, $start_point; - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - if(!$ssh->auth($unit['passwd'], $unit['address'])) - { - if($count) - return 1; + if(!$ssh->auth($unit['passwd'], $unit['address'])) + { + if($count) + return 1; - $out = $core ? '' : ''; + $out = $core ? '' : ''; - sys::outjs(array('core_fix' => $core)); - } + sys::outjs(array('core_fix' => $core)); + } - $n = sys::int($ssh->get('cat /proc/cpuinfo | grep "cpu MHz" | wc -l')); + $n = sys::int($ssh->get('cat /proc/cpuinfo | grep "cpu MHz" | wc -l')); - if($count) - return $n; + if($count) + return $n; - $list = ''; + $list = ''; - for($i = 1; $i <= $n; $i+=1) - $list .= ''; + for($i = 1; $i <= $n; $i+=1) + $list .= ''; - sys::outjs(array('core_fix' => str_replace($core.'"', $core.'" selected="select"', $list))); - } + sys::outjs(array('core_fix' => str_replace($core.'"', $core.'" selected="select"', $list))); + } - public static function iptables($id, $action, $source, $dest, $unit, $snw = false, $ssh = false) - { - global $cfg, $sql, $start_point; + public static function iptables($id, $action, $source, $dest, $unit, $snw = false, $ssh = false) + { + global $cfg, $sql, $start_point; - if(!$ssh) - { - $sql->query('SELECT `address`, `passwd` FROM `control` WHERE `id`="'.$unit.'" LIMIT 1'); - $unit = $sql->get(); + if(!$ssh) + { + $sql->query('SELECT `address`, `passwd` FROM `control` WHERE `id`="'.$unit.'" LIMIT 1'); + $unit = $sql->get(); - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - if(!$ssh->auth($unit['passwd'], $unit['address'])) - return array('e' => sys::text('all', 'ssh')); - } + if(!$ssh->auth($unit['passwd'], $unit['address'])) + return array('e' => sys::text('all', 'ssh')); + } - switch($action) - { - case 'block': - if(sys::valid($source, 'ip')) - return array('e' => sys::text('servers', 'firewall')); + switch($action) + { + case 'block': + if(sys::valid($source, 'ip')) + return array('e' => sys::text('servers', 'firewall')); - // Если подсеть - if($snw) - { - $source = sys::whois($source); + // Если подсеть + if($snw) + { + $source = sys::whois($source); - if($source == 'не определена') - return array('e' => 'Не удалось определить подсеть для указанного адреса.'); - } + if($source == 'не определена') + return array('e' => 'Не удалось определить подсеть для указанного адреса.'); + } - $sql->query('SELECT `id` FROM `control_firewall` WHERE `sip`="'.$source.'" AND `server`="'.$id.'" LIMIT 1'); + $sql->query('SELECT `id` FROM `control_firewall` WHERE `sip`="'.$source.'" AND `server`="'.$id.'" LIMIT 1'); - // Если такое правило уже добавлено или указан адрес сайта (ПУ) - if($sql->num() || ($source == $cfg['ip'] || $source == $cfg['subnet'])) - return array('s' => 'ok'); + // Если такое правило уже добавлено или указан адрес сайта (ПУ) + if($sql->num() || ($source == $cfg['ip'] || $source == $cfg['subnet'])) + return array('s' => 'ok'); - $sql->query('INSERT INTO `control_firewall` set `sip`="'.$source.'", `dest`="'.$dest[0].':'.$dest[1].'", `server`="'.$id.'", `time`="'.$start_point.'"'); + $sql->query('INSERT INTO `control_firewall` set `sip`="'.$source.'", `dest`="'.$dest[0].':'.$dest[1].'", `server`="'.$id.'", `time`="'.$start_point.'"'); - $line = $sql->id(); + $line = $sql->id(); - $rule = 'iptables -I INPUT -s '.$source.' -p udp -d '.$dest[0].' --dport '.$dest[1].' -j DROP;'; + $rule = 'iptables -I INPUT -s '.$source.' -p udp -d '.$dest[0].' --dport '.$dest[1].' -j DROP;'; - $ssh->set($rule.' echo -e "#'.$line.';\n'.$rule.'" >> /root/'.$cfg['iptables']); + $ssh->set($rule.' echo -e "#'.$line.';\n'.$rule.'" >> /root/'.$cfg['iptables']); - return array('s' => 'ok'); + return array('s' => 'ok'); - case 'unblock': - if(!is_numeric($source) AND sys::valid($source, 'ip')) - return array('e' => sys::text('servers', 'firewall')); + case 'unblock': + if(!is_numeric($source) AND sys::valid($source, 'ip')) + return array('e' => sys::text('servers', 'firewall')); - if(is_numeric($source)) - { - $sql->query('SELECT `id`, `sip` FROM `control_firewall` WHERE `id`="'.$source.'" AND `server`="'.$id.'" LIMIT 1'); + if(is_numeric($source)) + { + $sql->query('SELECT `id`, `sip` FROM `control_firewall` WHERE `id`="'.$source.'" AND `server`="'.$id.'" LIMIT 1'); - // Если такое правило отсутствует - if(!$sql->num()) - return array('s' => 'ok'); - }else{ - $sql->query('SELECT `id`, `sip` FROM `control_firewall` WHERE `sip`="'.$source.'" AND `server`="'.$id.'" LIMIT 1'); + // Если такое правило отсутствует + if(!$sql->num()) + return array('s' => 'ok'); + }else{ + $sql->query('SELECT `id`, `sip` FROM `control_firewall` WHERE `sip`="'.$source.'" AND `server`="'.$id.'" LIMIT 1'); - // Если одиночный адрес не найден, проверить на блокировку подсети - if(!$sql->num()) - { - $source = sys::whois($source); + // Если одиночный адрес не найден, проверить на блокировку подсети + if(!$sql->num()) + { + $source = sys::whois($source); - $sql->query('SELECT `id` FROM `control_firewall` WHERE `sip`="'.$source.'" AND `server`="'.$id.'" LIMIT 1'); + $sql->query('SELECT `id` FROM `control_firewall` WHERE `sip`="'.$source.'" AND `server`="'.$id.'" LIMIT 1'); - if($sql->num()) - { - $firewall = $sql->get(); + if($sql->num()) + { + $firewall = $sql->get(); - return array('i' => 'Указанный адрес входит в заблокированную подсеть, разблокировать подсеть?', 'id' => $firewall['id']); - } + return array('i' => 'Указанный адрес входит в заблокированную подсеть, разблокировать подсеть?', 'id' => $firewall['id']); + } - return array('s' => 'ok'); - } - } + return array('s' => 'ok'); + } + } - $firewall = $sql->get(); + $firewall = $sql->get(); - $ssh->set('iptables -D INPUT -s '.$firewall['sip'].' -p udp -d '.$dest[0].' --dport '.$dest[1].' -j DROP;' - .'sed "`nl '.$cfg['iptables'].' | grep \"#'.$firewall['id'].'\" | awk \'{print $1","$1+1}\'`d" '.$cfg['iptables'].' > '.$cfg['iptables'].'_temp; cat '.$cfg['iptables'].'_temp > '.$cfg['iptables'].'; rm '.$cfg['iptables'].'_temp'); + $ssh->set('iptables -D INPUT -s '.$firewall['sip'].' -p udp -d '.$dest[0].' --dport '.$dest[1].' -j DROP;' + .'sed "`nl '.$cfg['iptables'].' | grep \"#'.$firewall['id'].'\" | awk \'{print $1","$1+1}\'`d" '.$cfg['iptables'].' > '.$cfg['iptables'].'_temp; cat '.$cfg['iptables'].'_temp > '.$cfg['iptables'].'; rm '.$cfg['iptables'].'_temp'); - $sql->query('DELETE FROM `control_firewall` WHERE `id`="'.$firewall['id'].'" LIMIT 1'); + $sql->query('DELETE FROM `control_firewall` WHERE `id`="'.$firewall['id'].'" LIMIT 1'); - return array('s' => 'ok'); + return array('s' => 'ok'); - case 'remove': - $sql->query('SELECT `id`, `sip`, `dest` FROM `control_firewall` WHERE `server`="'.$id.'"'); + case 'remove': + $sql->query('SELECT `id`, `sip`, `dest` FROM `control_firewall` WHERE `server`="'.$id.'"'); - $aRule = array(); + $aRule = array(); - while($firewall = $sql->get()) - { - list($ip, $port) = explode(':', $firewall['dest']); + while($firewall = $sql->get()) + { + list($ip, $port) = explode(':', $firewall['dest']); - $aRule[$firewall['id']] = 'iptables -D INPUT -s '.$firewall['sip'].' -p udp -d '.$ip.' --dport '.$port.' -j DROP;'; - } + $aRule[$firewall['id']] = 'iptables -D INPUT -s '.$firewall['sip'].' -p udp -d '.$ip.' --dport '.$port.' -j DROP;'; + } - $nRule = count($aRule); + $nRule = count($aRule); - if(!$nRule) - return NULL; + if(!$nRule) + return NULL; - $cmd = ''; + $cmd = ''; - foreach($aRule as $line => $rule) - $cmd .= $rule.'sed "`nl '.$cfg['iptables'].' | grep "#'.$line.'" | awk \'{print $1","$1+1}\'`d" '.$cfg['iptables'].' > '.$cfg['iptables'].'_temp; cat '.$cfg['iptables'].'_temp > '.$cfg['iptables'].'; rm '.$cfg['iptables'].'_temp'; + foreach($aRule as $line => $rule) + $cmd .= $rule.'sed "`nl '.$cfg['iptables'].' | grep "#'.$line.'" | awk \'{print $1","$1+1}\'`d" '.$cfg['iptables'].' > '.$cfg['iptables'].'_temp; cat '.$cfg['iptables'].'_temp > '.$cfg['iptables'].'; rm '.$cfg['iptables'].'_temp'; - $ssh->set($cmd); + $ssh->set($cmd); - $sql->query('DELETE FROM `control_firewall` WHERE `server`="'.$id.'" LIMIT '.$nRule); + $sql->query('DELETE FROM `control_firewall` WHERE `server`="'.$id.'" LIMIT '.$nRule); - return array('s' => 'ok'); - } - } + return array('s' => 'ok'); + } + } - public static function crontab($id, $cid, $data = array()) - { - global $cfg; + public static function crontab($id, $cid, $data = array()) + { + global $cfg; - if($data['allhour']) - $time = '0 * * * '; - else{ - $hour = array( - '00', '01', '02', - '03', '04', '05', - '06', '07', '08', - '09', '10', '11', - '12', '13', '14', - '15', '16', '17', - '18', '19', '20', - '21', '22', '23' - ); + if($data['allhour']) + $time = '0 * * * '; + else{ + $hour = array( + '00', '01', '02', + '03', '04', '05', + '06', '07', '08', + '09', '10', '11', + '12', '13', '14', + '15', '16', '17', + '18', '19', '20', + '21', '22', '23' + ); - $minute = array( - '00', '05', '10', - '15', '20', '25', - '30', '35', '40', - '45', '50', '55' - ); + $minute = array( + '00', '05', '10', + '15', '20', '25', + '30', '35', '40', + '45', '50', '55' + ); - if(!in_array($data['hour'], $hour)) - $data['hour'] = '00'; + if(!in_array($data['hour'], $hour)) + $data['hour'] = '00'; - if(!in_array($data['minute'], $minute)) - $data['minute'] = '00'; + if(!in_array($data['minute'], $minute)) + $data['minute'] = '00'; - $time = $data['minute'].' '.$data['hour'].' * * '; - } + $time = $data['minute'].' '.$data['hour'].' * * '; + } - $week = array(); - $week[1] = isset($data['week']['\'1\'']) ? 1 : 0; - $week[2] = isset($data['week']['\'2\'']) ? 2 : 0; - $week[3] = isset($data['week']['\'3\'']) ? 3 : 0; - $week[4] = isset($data['week']['\'4\'']) ? 4 : 0; - $week[5] = isset($data['week']['\'5\'']) ? 5 : 0; - $week[6] = isset($data['week']['\'6\'']) ? 6 : 0; - $week[7] = isset($data['week']['\'7\'']) ? 7 : 0; + $week = array(); + $week[1] = isset($data['week']['\'1\'']) ? 1 : 0; + $week[2] = isset($data['week']['\'2\'']) ? 2 : 0; + $week[3] = isset($data['week']['\'3\'']) ? 3 : 0; + $week[4] = isset($data['week']['\'4\'']) ? 4 : 0; + $week[5] = isset($data['week']['\'5\'']) ? 5 : 0; + $week[6] = isset($data['week']['\'6\'']) ? 6 : 0; + $week[7] = isset($data['week']['\'7\'']) ? 7 : 0; - $check = 0; + $check = 0; - foreach($week as $index => $val) - $check+= $val; + foreach($week as $index => $val) + $check+= $val; - if($check == 28 || !$check) - $week = '*'; - else{ - $weeks = $week[1].','.$week[2].','.$week[3].','.$week[4].','.$week[5].','.$week[6].','.$week[7]; - $weeks = str_replace(array(',0', '0'), '', $weeks); - $week = $weeks{0} == ',' ? substr($weeks, 1) : $weeks; - } + if($check == 28 || !$check) + $week = '*'; + else{ + $weeks = $week[1].','.$week[2].','.$week[3].','.$week[4].','.$week[5].','.$week[6].','.$week[7]; + $weeks = str_replace(array(',0', '0'), '', $weeks); + $week = $weeks{0} == ',' ? substr($weeks, 1) : $weeks; + } - $cron_task = $time.$week.' screen -dmS s'.$id.' bash -c \'cd /var/enginegp && php cron.php '.$cfg['cron_key'].' control_server_cron '.$id.' '.$cid.'\''; + $cron_task = $time.$week.' screen -dmS s'.$id.' bash -c \'cd /var/enginegp && php cron.php '.$cfg['cron_key'].' control_server_cron '.$id.' '.$cid.'\''; - return $cron_task; - } - } + return $cron_task; + } + } ?> \ No newline at end of file diff --git a/system/library/control/cs/action.php b/system/library/control/cs/action.php index 492e689..01a6af1 100644 --- a/system/library/control/cs/action.php +++ b/system/library/control/cs/action.php @@ -1,109 +1,109 @@ query('SELECT `uid`, `unit`, `game`, `address`, `slots`, `name`, `fps`, `map_start`, `vac`, `pingboost`, `time_start`, `core_fix` FROM `control_servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `uid`, `unit`, `game`, `address`, `slots`, `name`, `fps`, `map_start`, `vac`, `pingboost`, `time_start`, `core_fix` FROM `control_servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - $sql->query('SELECT `address`, `passwd`, `fcpu` FROM `control` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $sql->query('SELECT `address`, `passwd`, `fcpu` FROM `control` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); - // Проверка ssh соедниения пу с локацией - if(!$ssh->auth($unit['passwd'], $unit['address'])) - return array('e' => sys::text('error', 'ssh')); + // Проверка ssh соедниения пу с локацией + if(!$ssh->auth($unit['passwd'], $unit['address'])) + return array('e' => sys::text('error', 'ssh')); - list($ip, $port) = explode(':', $server['address']); + list($ip, $port) = explode(':', $server['address']); - // Убить процессы - $ssh->set('kill -9 `ps aux | grep s_'.$server['uid'].' | grep -v grep | awk '."'{print $2}'".' | xargs;' - .'lsof -i@'.$server['address'].' | awk '."'{print $2}'".' | grep -v PID | xargs`; sudo -u server'.$server['uid'].' screen -wipe'); + // Убить процессы + $ssh->set('kill -9 `ps aux | grep s_'.$server['uid'].' | grep -v grep | awk '."'{print $2}'".' | xargs;' + .'lsof -i@'.$server['address'].' | awk '."'{print $2}'".' | grep -v PID | xargs`; sudo -u server'.$server['uid'].' screen -wipe'); - $taskset = ''; + $taskset = ''; - // Если включена система автораспределения и не установлен фиксированный поток - if(!$server['core_fix']) - { - $proc_stat = array(); + // Если включена система автораспределения и не установлен фиксированный поток + if(!$server['core_fix']) + { + $proc_stat = array(); - $proc_stat[0] = $ssh->get('cat /proc/stat'); - } + $proc_stat[0] = $ssh->get('cat /proc/stat'); + } - // Проверка наличия стартовой карты - $ssh->set('cd /servers/'.$server['uid'].'/cstrike/maps/ && ls | grep .bsp | grep -v .bsp.'); + // Проверка наличия стартовой карты + $ssh->set('cd /servers/'.$server['uid'].'/cstrike/maps/ && ls | grep .bsp | grep -v .bsp.'); - if($server['map_start'] != '' AND !in_array($server['map_start'], str_replace('.bsp', '', explode("\n", $ssh->get())))) - return array('e' => sys::updtext(sys::text('servers', 'nomap'), array('map' => $server['map_start'].'.bsp'))); + if($server['map_start'] != '' AND !in_array($server['map_start'], str_replace('.bsp', '', explode("\n", $ssh->get())))) + return array('e' => sys::updtext(sys::text('servers', 'nomap'), array('map' => $server['map_start'].'.bsp'))); - // Если система автораспределения продолжить парсинг загрузки процессора - if(isset($proc_stat)) - { - $proc_stat[1] = $ssh->get('cat /proc/stat'); + // Если система автораспределения продолжить парсинг загрузки процессора + if(isset($proc_stat)) + { + $proc_stat[1] = $ssh->get('cat /proc/stat'); - // Ядро/поток, на котором будет запущен игровой сервер (поток выбран с рассчетом наименьшей загруженности в момент запуска игрового сервера) - $core = sys::cpu_idle($proc_stat, $server['unit'], $unit['fcpu'], true); // число от 1 до n (где n число ядер/потоков в процессоре (без нулевого) + // Ядро/поток, на котором будет запущен игровой сервер (поток выбран с рассчетом наименьшей загруженности в момент запуска игрового сервера) + $core = sys::cpu_idle($proc_stat, $server['unit'], $unit['fcpu'], true); // число от 1 до n (где n число ядер/потоков в процессоре (без нулевого) - if(!is_numeric($core)) - return array('e' => sys::text('error', 'cpu')); + if(!is_numeric($core)) + return array('e' => sys::text('error', 'cpu')); - $taskset = 'taskset -c '.$core; - } + $taskset = 'taskset -c '.$core; + } - if($server['core_fix']) - { - $core = $server['core_fix']-1; - $taskset = 'taskset -c '.$core; - } + if($server['core_fix']) + { + $core = $server['core_fix']-1; + $taskset = 'taskset -c '.$core; + } - // Античит VAC - $vac = $server['vac'] == 0 ? '-insecure' : '-secure'; + // Античит VAC + $vac = $server['vac'] == 0 ? '-insecure' : '-secure'; - // Значение PingBoost - $pingboost = $server['pingboost'] ? '-pingboost '.$pingboost : ''; + // Значение PingBoost + $pingboost = $server['pingboost'] ? '-pingboost '.$pingboost : ''; - // Значение sys_ticrate (FPS) - $fps = $server['fps']; + // Значение sys_ticrate (FPS) + $fps = $server['fps']; - // Параметры запуска - $bash = './hlds_run -debug -game cstrike -norestart -condebug -sys_ticrate '.$fps.' +servercfgfile server.cfg +sys_ticrate '.$fps.' +map \''.$server['map_start'].'\' +maxplayers '.$server['slots'].' +ip '.$ip.' +port '.$port.' +sv_lan 0 '.$vac.' '.$pingboost; + // Параметры запуска + $bash = './hlds_run -debug -game cstrike -norestart -condebug -sys_ticrate '.$fps.' +servercfgfile server.cfg +sys_ticrate '.$fps.' +map \''.$server['map_start'].'\' +maxplayers '.$server['slots'].' +ip '.$ip.' +port '.$port.' +sv_lan 0 '.$vac.' '.$pingboost; - // Временный файл - $temp = sys::temp($bash); + // Временный файл + $temp = sys::temp($bash); - // Обновление файла start.sh - $ssh->setfile($temp, '/servers/'.$server['uid'].'/start.sh', 0500); + // Обновление файла start.sh + $ssh->setfile($temp, '/servers/'.$server['uid'].'/start.sh', 0500); - // Строка запуска - $ssh->set('cd /servers/'.$server['uid'].';' // переход в директорию игрового сервера - .'rm *.pid;' // Удаление *.pid файлов - .'sudo -u server'.$server['uid'].' mkdir -p cstrike/oldstart;' // Создание папки логов - .'cat cstrike/qconsole.log >> cstrike/oldstart/'.date('d.m.Y_H:i:s', $server['time_start']).'.log; rm cstrike/qconsole.log; rm cstrike/oldstart/01.01.1970_03:00:00.log;' // Перемещение лога предыдущего запуска - .'chown server'.$server['uid'].':1000 start.sh;' // Обновление владельца файла start.sh - .'sudo -u server'.$server['uid'].' screen -dmS s_'.$server['uid'].' '.$taskset.' sh -c ./start.sh'); // Запуск игровго сервера + // Строка запуска + $ssh->set('cd /servers/'.$server['uid'].';' // переход в директорию игрового сервера + .'rm *.pid;' // Удаление *.pid файлов + .'sudo -u server'.$server['uid'].' mkdir -p cstrike/oldstart;' // Создание папки логов + .'cat cstrike/qconsole.log >> cstrike/oldstart/'.date('d.m.Y_H:i:s', $server['time_start']).'.log; rm cstrike/qconsole.log; rm cstrike/oldstart/01.01.1970_03:00:00.log;' // Перемещение лога предыдущего запуска + .'chown server'.$server['uid'].':1000 start.sh;' // Обновление владельца файла start.sh + .'sudo -u server'.$server['uid'].' screen -dmS s_'.$server['uid'].' '.$taskset.' sh -c ./start.sh'); // Запуск игровго сервера - $core = !isset($core) ? 0 : $core+1; + $core = !isset($core) ? 0 : $core+1; - // Обновление информации в базе - $sql->query('UPDATE `control_servers` set `status`="'.$type.'", `online`="0", `players`="", `core_use`="'.$core.'", `time_start`="'.$start_point.'", `stop`="1" WHERE `id`="'.$id.'" LIMIT 1'); + // Обновление информации в базе + $sql->query('UPDATE `control_servers` set `status`="'.$type.'", `online`="0", `players`="", `core_use`="'.$core.'", `time_start`="'.$start_point.'", `stop`="1" WHERE `id`="'.$id.'" LIMIT 1'); - unlink($temp); + unlink($temp); - // Сброс кеша - actions::clmcache($id); + // Сброс кеша + actions::clmcache($id); - sys::reset_mcache('ctrl_server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => $type, 'online' => 0, 'players' => '')); - sys::reset_mcache('ctrl_server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => $type, 'online' => 0)); + sys::reset_mcache('ctrl_server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => $type, 'online' => 0, 'players' => '')); + sys::reset_mcache('ctrl_server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => $type, 'online' => 0)); - return array('s' => 'ok'); - } - } + return array('s' => 'ok'); + } + } ?> \ No newline at end of file diff --git a/system/library/control/cs/rcon.php b/system/library/control/cs/rcon.php index 08717ed..21b2649 100644 --- a/system/library/control/cs/rcon.php +++ b/system/library/control/cs/rcon.php @@ -1,107 +1,107 @@ Connect($ip, $port, 3, SourceQuery::GOLDSOURCE); + $sq->Connect($ip, $port, 3, SourceQuery::GOLDSOURCE); - $sq->SetRconPassword(rcon::rcon_passwd($server)); + $sq->SetRconPassword(rcon::rcon_passwd($server)); - $out = $sq->Rcon($cmd); + $out = $sq->Rcon($cmd); - $sq->Disconnect(); + $sq->Disconnect(); - return $out; - } + return $out; + } - public static function players($data) - { - $aPlayers = array(); - $n = 1; + public static function players($data) + { + $aPlayers = array(); + $n = 1; - $lines = explode("\n", $data); + $lines = explode("\n", $data); - foreach($lines as $line) - { - if(strpos($line, '#') === FALSE) - continue; + foreach($lines as $line) + { + if(strpos($line, '#') === FALSE) + continue; - $start = strpos($line, '"')+1; - $end = strrpos($line, '"'); + $start = strpos($line, '"')+1; + $end = strrpos($line, '"'); - $name = htmlspecialchars(substr($line, $start, $end-$start)); + $name = htmlspecialchars(substr($line, $start, $end-$start)); - $line = trim(substr($line, $end + 1)); + $line = trim(substr($line, $end + 1)); - $aData = array_values(array_diff(explode(' ', $line), array('', ' '))); + $aData = array_values(array_diff(explode(' ', $line), array('', ' '))); - $steamid = trim($aData[1]); - $ip = trim(sys::first(explode(':', $aData[6]))); + $steamid = trim($aData[1]); + $ip = trim(sys::first(explode(':', $aData[6]))); - if(sys::valid($steamid, 'steamid') || sys::valid($ip, 'ip')) - continue; + if(sys::valid($steamid, 'steamid') || sys::valid($ip, 'ip')) + continue; - $aPlayers[$n]['name'] = $name; - $aPlayers[$n]['steamid'] = $steamid; - $aPlayers[$n]['frags'] = trim($aData[2]); - $aPlayers[$n]['time'] = trim($aData[3]); - $aPlayers[$n]['ping'] = trim($aData[4]); - $aPlayers[$n]['ip'] = $ip; + $aPlayers[$n]['name'] = $name; + $aPlayers[$n]['steamid'] = $steamid; + $aPlayers[$n]['frags'] = trim($aData[2]); + $aPlayers[$n]['time'] = trim($aData[3]); + $aPlayers[$n]['ping'] = trim($aData[4]); + $aPlayers[$n]['ip'] = $ip; - $whois = rcon::country($ip); + $whois = rcon::country($ip); - $aPlayers[$n]['ico'] = $whois['ico']; - $aPlayers[$n]['country'] = $whois['name']; + $aPlayers[$n]['ico'] = $whois['ico']; + $aPlayers[$n]['country'] = $whois['name']; - $n+=1; - } + $n+=1; + } - return $aPlayers; - } + return $aPlayers; + } - public static function rcon_passwd($server) - { - global $cfg, $sql, $user; + public static function rcon_passwd($server) + { + global $cfg, $sql, $user; - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - $sql->query('SELECT `address`, `passwd` FROM `control` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $sql->query('SELECT `address`, `passwd` FROM `control` WHERE `id`="'.$server['unit'].'" LIMIT 1'); $unit = $sql->get(); - if(!$ssh->auth($unit['passwd'], $unit['address'])) + if(!$ssh->auth($unit['passwd'], $unit['address'])) sys::outjs(array('e' => sys::text('error', 'ssh'))); - $ssh->set('cat /servers/'.$server['uid'].'/cstrike/server.cfg | grep rcon_password'); - $get = explode(' ', str_replace('"', '', trim($ssh->get()))); - $rcon = trim(end($get)); + $ssh->set('cat /servers/'.$server['uid'].'/cstrike/server.cfg | grep rcon_password'); + $get = explode(' ', str_replace('"', '', trim($ssh->get()))); + $rcon = trim(end($get)); - if(!isset($rcon{0})) - sys::outjs(array('r' => 'Необходимо установить rcon пароль (rcon_password).', 'url' => $cfg['http'].'control/id/'.$server['unit'].'/server/'.$server['unit'].'/section/settings/subsection/server'), $nmch); + if(!isset($rcon{0})) + sys::outjs(array('r' => 'Необходимо установить rcon пароль (rcon_password).', 'url' => $cfg['http'].'control/id/'.$server['unit'].'/server/'.$server['unit'].'/section/settings/subsection/server'), $nmch); - return $rcon; - } + return $rcon; + } - public static function country($ip) - { - global $SxGeo; + public static function country($ip) + { + global $SxGeo; - $cData = $SxGeo->getCityFull($ip); - $ico = sys::country($cData['country']['iso']); + $cData = $SxGeo->getCityFull($ip); + $ico = sys::country($cData['country']['iso']); - return array('ico' => $ico, 'name' => empty($cData['country']['name_ru']) ? 'Не определена' : $cData['country']['name_ru']); - } - } + return array('ico' => $ico, 'name' => empty($cData['country']['name_ru']) ? 'Не определена' : $cData['country']['name_ru']); + } + } ?> \ No newline at end of file diff --git a/system/library/control/cs/scan.php b/system/library/control/cs/scan.php index 20e3fe1..ff1c37f 100644 --- a/system/library/control/cs/scan.php +++ b/system/library/control/cs/scan.php @@ -1,133 +1,133 @@ get($nmch))) - return $mcache->get($nmch); + if(is_array($mcache->get($nmch))) + return $mcache->get($nmch); - $out = array(); + $out = array(); - $info = scan::info($sq, $id); + $info = scan::info($sq, $id); - $sql->query('SELECT `unit`, `game`, `name`, `map`, `online`, `players`, `status` FROM `control_servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `unit`, `game`, `name`, `map`, `online`, `players`, `status` FROM `control_servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - if(!$info['status']) - { - $out['name'] = $server['name']; - $out['status'] = sys::status($server['status'], $server['game'], $server['map']); - $out['online'] = $server['online']; - $out['image'] = ''; - $out['buttons'] = sys::buttons($id, $server['status'], $server['game'], $server['unit']); + if(!$info['status']) + { + $out['name'] = $server['name']; + $out['status'] = sys::status($server['status'], $server['game'], $server['map']); + $out['online'] = $server['online']; + $out['image'] = ''; + $out['buttons'] = sys::buttons($id, $server['status'], $server['game'], $server['unit']); - if($players_get) - $out['players'] = base64_decode($server['players']); + if($players_get) + $out['players'] = base64_decode($server['players']); - $mcache->set($nmch, $out, false, $cfg['mcache_server_mon']); + $mcache->set($nmch, $out, false, $cfg['mcache_server_mon']); - return $out; - } + return $out; + } - if($players_get) - $players = scan::info($sq, $id, true); + if($players_get) + $players = scan::info($sq, $id, true); - $out['name'] = htmlspecialchars($info['name']); - $out['status'] = sys::status('working', $server['game'], $info['map']); - $out['online'] = $info['online']; - $out['image'] = ''; - $out['buttons'] = sys::buttons($id, 'working', $server['game'], $server['unit']); - $out['players'] = ''; + $out['name'] = htmlspecialchars($info['name']); + $out['status'] = sys::status('working', $server['game'], $info['map']); + $out['online'] = $info['online']; + $out['image'] = ''; + $out['buttons'] = sys::buttons($id, 'working', $server['game'], $server['unit']); + $out['players'] = ''; - if($players_get) - { - foreach($players as $index => $player) - { - $html->get($server['game'], 'sections/servers/players'); + if($players_get) + { + foreach($players as $index => $player) + { + $html->get($server['game'], 'sections/servers/players'); - $html->set('i', $player['i']); - $html->set('name', $player['name']); - $html->set('score', $player['score']); - $html->set('time', $player['time']); + $html->set('i', $player['i']); + $html->set('name', $player['name']); + $html->set('score', $player['score']); + $html->set('time', $player['time']); - $html->pack('list'); - } + $html->pack('list'); + } - $out['players'] = isset($html->arr['list']) ? $html->arr['list'] : ''; - } + $out['players'] = isset($html->arr['list']) ? $html->arr['list'] : ''; + } - $sql->query('UPDATE `control_servers` set ' - .'`name`="'.$out['name'].'", ' - .'`online`="'.$out['online'].'", ' - .'`map`="'.$info['map'].'", ' - .'`status`="working" WHERE `id`="'.$id.'" LIMIT 1'); + $sql->query('UPDATE `control_servers` set ' + .'`name`="'.$out['name'].'", ' + .'`online`="'.$out['online'].'", ' + .'`map`="'.$info['map'].'", ' + .'`status`="working" WHERE `id`="'.$id.'" LIMIT 1'); - if($players_get) - $sql->query('UPDATE `control_servers` set `players`="'.base64_encode($out['players']).'" WHERE `id`="'.$id.'" LIMIT 1'); + if($players_get) + $sql->query('UPDATE `control_servers` set `players`="'.base64_encode($out['players']).'" WHERE `id`="'.$id.'" LIMIT 1'); - $mcache->set($nmch, $out, false, $cfg['mcache_server_mon']); + $mcache->set($nmch, $out, false, $cfg['mcache_server_mon']); - return $out; - } + return $out; + } - public static function info($sq, $id, $pl = false) - { - global $sql; + public static function info($sq, $id, $pl = false) + { + global $sql; - $sql->query('SELECT `address` FROM `control_servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `address` FROM `control_servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - list($ip, $port) = explode(':', $server['address']); + list($ip, $port) = explode(':', $server['address']); - $sq->Connect($ip, $port, 1, SourceQuery::GOLDSOURCE); + $sq->Connect($ip, $port, 1, SourceQuery::GOLDSOURCE); - if($pl) - { - $players = $sq->GetPlayers(); + if($pl) + { + $players = $sq->GetPlayers(); - $i = 1; - $data = array(); + $i = 1; + $data = array(); - foreach($players as $n => $player) - { - $data[$i]['i'] = $i; - $data[$i]['name'] = $player['Name'] == '' ? 'Подключается' : $player['Name']; - $data[$i]['score'] = $player['Frags']; - $data[$i]['time'] = $player['TimeF']; + foreach($players as $n => $player) + { + $data[$i]['i'] = $i; + $data[$i]['name'] = $player['Name'] == '' ? 'Подключается' : $player['Name']; + $data[$i]['score'] = $player['Frags']; + $data[$i]['time'] = $player['TimeF']; - $i+=1; - } + $i+=1; + } - return $data; - } + return $data; + } - $data = $sq->GetInfo(); + $data = $sq->GetInfo(); - $server['name'] = $data['HostName']; - $server['map'] = $data['Map']; - $server['online'] = $data['Players']; - $server['status'] = strlen($server['map']) > 3 ? true : false; + $server['name'] = $data['HostName']; + $server['map'] = $data['Map']; + $server['online'] = $data['Players']; + $server['status'] = strlen($server['map']) > 3 ? true : false; - return $server; - } - } + return $server; + } + } ?> \ No newline at end of file diff --git a/system/library/control/csgo/action.php b/system/library/control/csgo/action.php index 0232e54..5e3d51b 100644 --- a/system/library/control/csgo/action.php +++ b/system/library/control/csgo/action.php @@ -1,282 +1,282 @@ query('SELECT `uid`, `unit`, `game`, `address`, `slots`, `name`, `tickrate`, `map_start`, `vac`, `time_start`, `core_fix`, `pingboost` FROM `control_servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `uid`, `unit`, `game`, `address`, `slots`, `name`, `tickrate`, `map_start`, `vac`, `time_start`, `core_fix`, `pingboost` FROM `control_servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - $sql->query('SELECT `address`, `passwd`, `fcpu` FROM `control` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $sql->query('SELECT `address`, `passwd`, `fcpu` FROM `control` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); - // Проверка ssh соедниения пу с локацией - if(!$ssh->auth($unit['passwd'], $unit['address'])) - return array('e' => sys::text('error', 'ssh')); + // Проверка ssh соедниения пу с локацией + if(!$ssh->auth($unit['passwd'], $unit['address'])) + return array('e' => sys::text('error', 'ssh')); - list($ip, $port) = explode(':', $server['address']); + list($ip, $port) = explode(':', $server['address']); - // Убить процессы - $ssh->set('kill -9 `ps aux | grep s_'.$server['uid'].' | grep -v grep | awk '."'{print $2}'".' | xargs;' - .'lsof -i@'.$server['address'].' | awk '."'{print $2}'".' | grep -v PID | xargs`; sudo -u server'.$server['uid'].' screen -wipe'); + // Убить процессы + $ssh->set('kill -9 `ps aux | grep s_'.$server['uid'].' | grep -v grep | awk '."'{print $2}'".' | xargs;' + .'lsof -i@'.$server['address'].' | awk '."'{print $2}'".' | grep -v PID | xargs`; sudo -u server'.$server['uid'].' screen -wipe'); - $taskset = ''; + $taskset = ''; - // Если включена система автораспределения и не установлен фиксированный поток - if(!$server['core_fix']) - { - $proc_stat = array(); + // Если включена система автораспределения и не установлен фиксированный поток + if(!$server['core_fix']) + { + $proc_stat = array(); - $proc_stat[0] = $ssh->get('cat /proc/stat'); - } + $proc_stat[0] = $ssh->get('cat /proc/stat'); + } - // Проверка наличия стартовой карты - $ssh->set('cd /servers/'.$server['uid'].'/csgo/maps/ && du -ah | grep -e "\.bsp$" | awk \'{print $2}\''); + // Проверка наличия стартовой карты + $ssh->set('cd /servers/'.$server['uid'].'/csgo/maps/ && du -ah | grep -e "\.bsp$" | awk \'{print $2}\''); - include_once(LIB.'games/games.php'); + include_once(LIB.'games/games.php'); - if(games::map($server['map_start'], $ssh->get())) - return array('e' => sys::updtext(sys::text('servers', 'nomap'), array('map' => $server['map_start'].'.bsp'))); + if(games::map($server['map_start'], $ssh->get())) + return array('e' => sys::updtext(sys::text('servers', 'nomap'), array('map' => $server['map_start'].'.bsp'))); - // Если система автораспределения продолжить парсинг загрузки процессора - if(isset($proc_stat)) - { - $proc_stat[1] = $ssh->get('cat /proc/stat'); + // Если система автораспределения продолжить парсинг загрузки процессора + if(isset($proc_stat)) + { + $proc_stat[1] = $ssh->get('cat /proc/stat'); - // Ядро/поток, на котором будет запущен игровой сервер (поток выбран с рассчетом наименьшей загруженности в момент запуска игрового сервера) - $core = sys::cpu_idle($proc_stat, $server['unit'], $unit['fcpu'], true); // число от 1 до n (где n число ядер/потоков в процессоре (без нулевого) + // Ядро/поток, на котором будет запущен игровой сервер (поток выбран с рассчетом наименьшей загруженности в момент запуска игрового сервера) + $core = sys::cpu_idle($proc_stat, $server['unit'], $unit['fcpu'], true); // число от 1 до n (где n число ядер/потоков в процессоре (без нулевого) - if(!is_numeric($core)) - return array('e' => sys::text('error', 'cpu')); + if(!is_numeric($core)) + return array('e' => sys::text('error', 'cpu')); - $taskset = 'taskset -c '.$core; - } + $taskset = 'taskset -c '.$core; + } - if($server['core_fix']) - { - $core = $server['core_fix']-1; - $taskset = 'taskset -c '.$core; - } + if($server['core_fix']) + { + $core = $server['core_fix']-1; + $taskset = 'taskset -c '.$core; + } - // Античит VAC - $vac = $server['vac'] == 0 ? '-insecure' : '-secure'; + // Античит VAC + $vac = $server['vac'] == 0 ? '-insecure' : '-secure'; - // TV - $tv = $server['tv'] ? '+tv_enable 1 +tv_maxclients 30 +tv_port '.($port+10000) : '-nohltv'; + // TV + $tv = $server['tv'] ? '+tv_enable 1 +tv_maxclients 30 +tv_port '.($port+10000) : '-nohltv'; - $check = explode('/', $server['map_start']); + $check = explode('/', $server['map_start']); - // Стартовая карта - $map = $check[0] == 'workshop' ? '+workshop_start_map '.$check[1] : '+map \''.$server['map_start'].'\''; + // Стартовая карта + $map = $check[0] == 'workshop' ? '+workshop_start_map '.$check[1] : '+map \''.$server['map_start'].'\''; - // Игровой режим - $mods = array( - 1 => '+game_type 0 +game_mode 0', - 2 => '+game_type 0 +game_mode 1', - 3 => '+game_type 1 +game_mode 0', - 4 => '+game_type 1 +game_mode 1', - 5 => '+game_type 1 +game_mode 2' - ); + // Игровой режим + $mods = array( + 1 => '+game_type 0 +game_mode 0', + 2 => '+game_type 0 +game_mode 1', + 3 => '+game_type 1 +game_mode 0', + 4 => '+game_type 1 +game_mode 1', + 5 => '+game_type 1 +game_mode 2' + ); - $mod = !$server['pingboost'] ? $mods[2] : $mods[$server['pingboost']]; + $mod = !$server['pingboost'] ? $mods[2] : $mods[$server['pingboost']]; - // Параметры запуска - $bash = './srcds_run -debug -game csgo -norestart -condebug console.log -usercon -tickrate '.$server['tickrate'].' '.$mod.' +servercfgfile server.cfg '.$map.' -maxplayers_override '.$server['slots'].' +ip '.$ip.' +net_public_adr '.$ip.' +port '.$port.' -sv_lan 0 '.$vac.' '.$tv; + // Параметры запуска + $bash = './srcds_run -debug -game csgo -norestart -condebug console.log -usercon -tickrate '.$server['tickrate'].' '.$mod.' +servercfgfile server.cfg '.$map.' -maxplayers_override '.$server['slots'].' +ip '.$ip.' +net_public_adr '.$ip.' +port '.$port.' -sv_lan 0 '.$vac.' '.$tv; - // Временный файл - $temp = sys::temp($bash); + // Временный файл + $temp = sys::temp($bash); - // Обновление файла start.sh - $ssh->setfile($temp, '/servers/'.$server['uid'].'/start.sh', 0500); + // Обновление файла start.sh + $ssh->setfile($temp, '/servers/'.$server['uid'].'/start.sh', 0500); - // Строка запуска - $ssh->set('cd /servers/'.$server['uid'].';' // переход в директорию игрового сервера - .'rm *.pid;' // Удаление *.pid файлов - .'sudo -u server'.$server['uid'].' mkdir -p csgo/oldstart;' // Создание папки логов - .'cat csgo/console.log >> csgo/oldstart/'.date('d.m.Y_H:i:s', $server['time_start']).'.log; rm csgo/console.log; rm csgo/oldstart/01.01.1970_03:00:00.log;' // Перемещение лога предыдущего запуска - .'chown server'.$server['uid'].':1000 start.sh;' // Обновление владельца файла start.sh - .'sudo -u server'.$server['uid'].' screen -dmS s_'.$server['uid'].' '.$taskset.' sh -c "./start.sh"'); // Запуск игровго сервера + // Строка запуска + $ssh->set('cd /servers/'.$server['uid'].';' // переход в директорию игрового сервера + .'rm *.pid;' // Удаление *.pid файлов + .'sudo -u server'.$server['uid'].' mkdir -p csgo/oldstart;' // Создание папки логов + .'cat csgo/console.log >> csgo/oldstart/'.date('d.m.Y_H:i:s', $server['time_start']).'.log; rm csgo/console.log; rm csgo/oldstart/01.01.1970_03:00:00.log;' // Перемещение лога предыдущего запуска + .'chown server'.$server['uid'].':1000 start.sh;' // Обновление владельца файла start.sh + .'sudo -u server'.$server['uid'].' screen -dmS s_'.$server['uid'].' '.$taskset.' sh -c "./start.sh"'); // Запуск игровго сервера - $core = !isset($core) ? 0 : $core+1; + $core = !isset($core) ? 0 : $core+1; - // Обновление информации в базе - $sql->query('UPDATE `control_servers` set `status`="'.$type.'", `online`="0", `players`="", `core_use`="'.$core.'", `time_start`="'.$start_point.'", `stop`="1" WHERE `id`="'.$id.'" LIMIT 1'); + // Обновление информации в базе + $sql->query('UPDATE `control_servers` set `status`="'.$type.'", `online`="0", `players`="", `core_use`="'.$core.'", `time_start`="'.$start_point.'", `stop`="1" WHERE `id`="'.$id.'" LIMIT 1'); - unlink($temp); + unlink($temp); - // Сброс кеша - actions::clmcache($id); + // Сброс кеша + actions::clmcache($id); - sys::reset_mcache('ctrl_server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => $type, 'online' => 0, 'players' => '')); - sys::reset_mcache('ctrl_server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => $type, 'online' => 0)); + sys::reset_mcache('ctrl_server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => $type, 'online' => 0, 'players' => '')); + sys::reset_mcache('ctrl_server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => $type, 'online' => 0)); - return array('s' => 'ok'); - } + return array('s' => 'ok'); + } public static function change($id, $map = false) { - global $cfg, $sql, $html, $user, $mcache; + global $cfg, $sql, $html, $user, $mcache; - // Если в кеше есть карты - if($mcache->get('ctrl_server_maps_change_'.$id) != '' AND !$map) - return array('maps' => $mcache->get('ctrl_server_maps_change_'.$id)); + // Если в кеше есть карты + if($mcache->get('ctrl_server_maps_change_'.$id) != '' AND !$map) + return array('maps' => $mcache->get('ctrl_server_maps_change_'.$id)); - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - include(LIB.'games/games.php'); + include(LIB.'games/games.php'); - $sql->query('SELECT `uid`, `unit`, `game`, `online`, `players`, `name` FROM `control_servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `uid`, `unit`, `game`, `online`, `players`, `name` FROM `control_servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - $sql->query('SELECT `address`, `passwd` FROM `control` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $sql->query('SELECT `address`, `passwd` FROM `control` WHERE `id`="'.$server['unit'].'" LIMIT 1'); $unit = $sql->get(); - // Проверка ssh соедниения пу с локацией + // Проверка ssh соедниения пу с локацией if(!$ssh->auth($unit['passwd'], $unit['address'])) return array('e' => sys::text('error', 'ssh')); - // Массив карт игрового сервера (папка "maps") - $aMaps = explode("\n", $ssh->get('cd /servers/'.$server['uid'].'/csgo/maps/ && du -ah | grep -e "\.bsp$" | awk \'{print $2}\'')); + // Массив карт игрового сервера (папка "maps") + $aMaps = explode("\n", $ssh->get('cd /servers/'.$server['uid'].'/csgo/maps/ && du -ah | grep -e "\.bsp$" | awk \'{print $2}\'')); - // Удаление пустого элемента - unset($aMaps[count($aMaps)-1]); + // Удаление пустого элемента + unset($aMaps[count($aMaps)-1]); - // Удаление ".bsp" - $aMaps = str_ireplace(array('./', '.bsp'), '', $aMaps); + // Удаление ".bsp" + $aMaps = str_ireplace(array('./', '.bsp'), '', $aMaps); - // Если выбрана карта - if($map) - { - $map = str_replace('|', '/', $map); + // Если выбрана карта + if($map) + { + $map = str_replace('|', '/', $map); - // Проверка наличия выбранной карты - if(games::map($map, $aMaps)) - return array('e' => sys::updtext(sys::text('servers', 'change'), array('map' => $map.'.bsp'))); + // Проверка наличия выбранной карты + if(games::map($map, $aMaps)) + return array('e' => sys::updtext(sys::text('servers', 'change'), array('map' => $map.'.bsp'))); - // Отправка команды changelevel - $ssh->set('sudo -u server'.$server['uid'].' screen -p 0 -S s_'.$server['uid'].' -X eval '."'stuff \"changelevel ".sys::cmd($map)."\"\015'"); + // Отправка команды changelevel + $ssh->set('sudo -u server'.$server['uid'].' screen -p 0 -S s_'.$server['uid'].' -X eval '."'stuff \"changelevel ".sys::cmd($map)."\"\015'"); - // Обновление информации в базе - $sql->query('UPDATE `control_servers` set `status`="change" WHERE `id`="'.$id.'" LIMIT 1'); + // Обновление информации в базе + $sql->query('UPDATE `control_servers` set `status`="change" WHERE `id`="'.$id.'" LIMIT 1'); - // Сброс кеша - actions::clmcache($id); + // Сброс кеша + actions::clmcache($id); - sys::reset_mcache('ctrl_server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'change', 'online' => $server['online'], 'players' => base64_decode($server['players']))); - sys::reset_mcache('ctrl_server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'change', 'online' => $server['online'])); + sys::reset_mcache('ctrl_server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'change', 'online' => $server['online'], 'players' => base64_decode($server['players']))); + sys::reset_mcache('ctrl_server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'change', 'online' => $server['online'])); - return array('s' => 'ok'); - } + return array('s' => 'ok'); + } - // Сортировка списка карт - sort($aMaps); - reset($aMaps); + // Сортировка списка карт + sort($aMaps); + reset($aMaps); - // Генерация списка карт для выбора - foreach($aMaps as $map) - { - $aName = explode('/', $map); - $name = end($aName); + // Генерация списка карт для выбора + foreach($aMaps as $map) + { + $aName = explode('/', $map); + $name = end($aName); - $html->get('change_list', 'sections/control/servers/csgo'); + $html->get('change_list', 'sections/control/servers/csgo'); - $html->set('img', file_exists(DIR.'/maps/'.$server['game'].'/'.$name.'.jpg') ? $cfg['http'].'maps/'.$server['game'].'/'.$name.'.jpg' : $cfg['http'].'template/images/status/none.jpg'); - $html->set('map', str_replace('/', '|', $map)); - $html->set('name', $name); - $html->set('id', $server['unit']); - $html->set('server', $id); + $html->set('img', file_exists(DIR.'/maps/'.$server['game'].'/'.$name.'.jpg') ? $cfg['http'].'maps/'.$server['game'].'/'.$name.'.jpg' : $cfg['http'].'template/images/status/none.jpg'); + $html->set('map', str_replace('/', '|', $map)); + $html->set('name', $name); + $html->set('id', $server['unit']); + $html->set('server', $id); - if(count($aName) > 1) - $html->unit('workshop', true); - else - $html->unit('workshop'); + if(count($aName) > 1) + $html->unit('workshop', true); + else + $html->unit('workshop'); - $html->pack('maps'); - } + $html->pack('maps'); + } - // Запись карт в кеш - $mcache->set('ctrl_server_maps_change_'.$id, $html->arr['maps'], false, 60); + // Запись карт в кеш + $mcache->set('ctrl_server_maps_change_'.$id, $html->arr['maps'], false, 60); - return array('maps' => $html->arr['maps']); - } + return array('maps' => $html->arr['maps']); + } public static function update($id) { - global $cfg, $sql, $user, $start_point; + global $cfg, $sql, $user, $start_point; - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - $sql->query('SELECT `uid`, `unit`, `game`, `name`, `ftp`, `core_fix` FROM `control_servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `uid`, `unit`, `game`, `name`, `ftp`, `core_fix` FROM `control_servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - $sql->query('SELECT `address`, `passwd`, `sql_login`, `sql_passwd`, `sql_port`, `sql_ftp`, `fcpu` FROM `control` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $sql->query('SELECT `address`, `passwd`, `sql_login`, `sql_passwd`, `sql_port`, `sql_ftp`, `fcpu` FROM `control` WHERE `id`="'.$server['unit'].'" LIMIT 1'); $unit = $sql->get(); - // Проверка ssh соедниения пу с локацией + // Проверка ssh соедниения пу с локацией if(!$ssh->auth($unit['passwd'], $unit['address'])) return array('e' => sys::text('error', 'ssh')); - $taskset = ''; + $taskset = ''; - // Если включена система автораспределения и не установлен фиксированный поток - if(!$server['core_fix']) - { - $proc_stat = array(); + // Если включена система автораспределения и не установлен фиксированный поток + if(!$server['core_fix']) + { + $proc_stat = array(); - $proc_stat[0] = $ssh->get('cat /proc/stat'); - } + $proc_stat[0] = $ssh->get('cat /proc/stat'); + } - // Директория игрового сервера - $install = '/servers/'.$server['uid']; + // Директория игрового сервера + $install = '/servers/'.$server['uid']; - // Если система автораспределения продолжить парсинг загрузки процессора - if(isset($proc_stat)) - { - $proc_stat[1] = $ssh->get('cat /proc/stat'); + // Если система автораспределения продолжить парсинг загрузки процессора + if(isset($proc_stat)) + { + $proc_stat[1] = $ssh->get('cat /proc/stat'); - // Ядро/поток, на котором будет запущен игровой сервер (поток выбран с рассчетом наименьшей загруженности в момент запуска игрового сервера) - $core = sys::cpu_idle($proc_stat, $server['unit'], $unit['fcpu'], true); // число от 1 до n (где n число ядер/потоков в процессоре (без нулевого) + // Ядро/поток, на котором будет запущен игровой сервер (поток выбран с рассчетом наименьшей загруженности в момент запуска игрового сервера) + $core = sys::cpu_idle($proc_stat, $server['unit'], $unit['fcpu'], true); // число от 1 до n (где n число ядер/потоков в процессоре (без нулевого) - if(!is_numeric($core)) - return array('e' => 'Не удается выполнить операцию, нет свободного потока.'); + if(!is_numeric($core)) + return array('e' => 'Не удается выполнить операцию, нет свободного потока.'); - $taskset = 'taskset -c '.$core; - } + $taskset = 'taskset -c '.$core; + } - if($server['core_fix']) - { - $core = $server['core_fix']-1; - $taskset = 'taskset -c '.$core; - } + if($server['core_fix']) + { + $core = $server['core_fix']-1; + $taskset = 'taskset -c '.$core; + } - $ssh->set('cd '.$cfg['steamcmd'].' && '.$taskset.' screen -dmS u_'.$server['uid'].' sh -c "' - .'./steamcmd.sh +login anonymous +force_install_dir "'.$install.'" +app_update 740 +quit;' - .'cd '.$install.';' - .'chown -R server'.$server['uid'].':servers .;' - .'find . -type d -exec chmod 700 {} \;;' - .'find . -type f -exec chmod 600 {} \;;' - .'chmod 500 '.params::$aFileGame[$server['game']].'"'); + $ssh->set('cd '.$cfg['steamcmd'].' && '.$taskset.' screen -dmS u_'.$server['uid'].' sh -c "' + .'./steamcmd.sh +login anonymous +force_install_dir "'.$install.'" +app_update 740 +quit;' + .'cd '.$install.';' + .'chown -R server'.$server['uid'].':servers .;' + .'find . -type d -exec chmod 700 {} \;;' + .'find . -type f -exec chmod 600 {} \;;' + .'chmod 500 '.params::$aFileGame[$server['game']].'"'); - $core = !isset($core) ? 0 : $core+1; + $core = !isset($core) ? 0 : $core+1; - // Обновление информации в базе - $sql->query('UPDATE `control_servers` set `status`="update", `core_use`="'.$core.'" WHERE `id`="'.$id.'" LIMIT 1'); + // Обновление информации в базе + $sql->query('UPDATE `control_servers` set `status`="update", `core_use`="'.$core.'" WHERE `id`="'.$id.'" LIMIT 1'); - // Сброс кеша - actions::clmcache($id); + // Сброс кеша + actions::clmcache($id); - sys::reset_mcache('ctrl_server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'update', 'online' => 0, 'players' => '')); - sys::reset_mcache('ctrl_server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'update', 'online' => 0)); + sys::reset_mcache('ctrl_server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'update', 'online' => 0, 'players' => '')); + sys::reset_mcache('ctrl_server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'update', 'online' => 0)); - return array('s' => 'ok'); - } + return array('s' => 'ok'); + } } ?> \ No newline at end of file diff --git a/system/library/control/csgo/rcon.php b/system/library/control/csgo/rcon.php index cfaf75c..d783736 100644 --- a/system/library/control/csgo/rcon.php +++ b/system/library/control/csgo/rcon.php @@ -1,109 +1,109 @@ Connect($ip, $port, 3, SourceQuery::SOURCE); + $sq->Connect($ip, $port, 3, SourceQuery::SOURCE); - $sq->SetRconPassword(rcon::rcon_passwd($server)); + $sq->SetRconPassword(rcon::rcon_passwd($server)); - $out = $sq->Rcon($cmd); + $out = $sq->Rcon($cmd); - $sq->Disconnect(); + $sq->Disconnect(); - return $out; - } + return $out; + } - public static function players($data) - { - $aPlayers = array(); - $n = 1; + public static function players($data) + { + $aPlayers = array(); + $n = 1; - $lines = explode("\n", $data); + $lines = explode("\n", $data); - foreach($lines as $line) - { - if(strpos($line, '#') === FALSE) - continue; + foreach($lines as $line) + { + if(strpos($line, '#') === FALSE) + continue; - $start = strpos($line, '"')+1; - $end = strrpos($line, '"'); + $start = strpos($line, '"')+1; + $end = strrpos($line, '"'); - $userid = sys::int(substr($line, 0, $start)); + $userid = sys::int(substr($line, 0, $start)); - $name = htmlspecialchars(substr($line, $start, $end-$start)); + $name = htmlspecialchars(substr($line, $start, $end-$start)); - $line = trim(substr($line, $end + 1)); + $line = trim(substr($line, $end + 1)); - $aData = array_values(array_diff(explode(' ', $line), array('', ' '))); + $aData = array_values(array_diff(explode(' ', $line), array('', ' '))); - $steamid = trim($aData[0]); - $ip = trim(sys::first(explode(':', $aData[5]))); + $steamid = trim($aData[0]); + $ip = trim(sys::first(explode(':', $aData[5]))); - if((sys::valid($steamid, 'steamid') AND sys::valid($steamid, 'steamid3')) || sys::valid($ip, 'ip')) - continue; + if((sys::valid($steamid, 'steamid') AND sys::valid($steamid, 'steamid3')) || sys::valid($ip, 'ip')) + continue; - $aPlayers[$n]['userid'] = $userid; - $aPlayers[$n]['name'] = $name; - $aPlayers[$n]['steamid'] = $steamid; - $aPlayers[$n]['time'] = trim($aData[1]); - $aPlayers[$n]['ping'] = trim($aData[2]); - $aPlayers[$n]['ip'] = $ip; + $aPlayers[$n]['userid'] = $userid; + $aPlayers[$n]['name'] = $name; + $aPlayers[$n]['steamid'] = $steamid; + $aPlayers[$n]['time'] = trim($aData[1]); + $aPlayers[$n]['ping'] = trim($aData[2]); + $aPlayers[$n]['ip'] = $ip; - $whois = rcon::country($ip); + $whois = rcon::country($ip); - $aPlayers[$n]['ico'] = $whois['ico']; - $aPlayers[$n]['country'] = $whois['name']; + $aPlayers[$n]['ico'] = $whois['ico']; + $aPlayers[$n]['country'] = $whois['name']; - $n+=1; - } + $n+=1; + } - return $aPlayers; - } + return $aPlayers; + } - public static function rcon_passwd($server) - { - global $cfg, $sql, $user; + public static function rcon_passwd($server) + { + global $cfg, $sql, $user; - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - $sql->query('SELECT `address`, `passwd` FROM `control` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $sql->query('SELECT `address`, `passwd` FROM `control` WHERE `id`="'.$server['unit'].'" LIMIT 1'); $unit = $sql->get(); - if(!$ssh->auth($unit['passwd'], $unit['address'])) + if(!$ssh->auth($unit['passwd'], $unit['address'])) sys::outjs(array('e' => sys::text('error', 'ssh'))); - $ssh->set('cat /servers/'.$server['uid'].'/csgo/cfg/server.cfg | grep rcon_password'); - $get = explode(' ', str_replace('"', '', trim($ssh->get()))); - $rcon = trim(end($get)); + $ssh->set('cat /servers/'.$server['uid'].'/csgo/cfg/server.cfg | grep rcon_password'); + $get = explode(' ', str_replace('"', '', trim($ssh->get()))); + $rcon = trim(end($get)); - if(!isset($rcon{0})) - sys::outjs(array('r' => 'Необходимо установить rcon пароль (rcon_password).', 'url' => $cfg['http'].'control/id/'.$server['unit'].'/server/'.$server['unit'].'/section/settings/subsection/server'), $nmch); + if(!isset($rcon{0})) + sys::outjs(array('r' => 'Необходимо установить rcon пароль (rcon_password).', 'url' => $cfg['http'].'control/id/'.$server['unit'].'/server/'.$server['unit'].'/section/settings/subsection/server'), $nmch); - return $rcon; - } + return $rcon; + } - public static function country($ip) - { - global $SxGeo; + public static function country($ip) + { + global $SxGeo; - $cData = $SxGeo->getCityFull($ip); - $ico = sys::country($cData['country']['iso']); + $cData = $SxGeo->getCityFull($ip); + $ico = sys::country($cData['country']['iso']); - return array('ico' => $ico, 'name' => empty($cData['country']['name_ru']) ? 'Не определена' : $cData['country']['name_ru']); - } - } + return array('ico' => $ico, 'name' => empty($cData['country']['name_ru']) ? 'Не определена' : $cData['country']['name_ru']); + } + } ?> \ No newline at end of file diff --git a/system/library/control/csgo/scan.php b/system/library/control/csgo/scan.php index 3c89854..ab68e56 100644 --- a/system/library/control/csgo/scan.php +++ b/system/library/control/csgo/scan.php @@ -1,135 +1,135 @@ get($nmch))) - return $mcache->get($nmch); + if(is_array($mcache->get($nmch))) + return $mcache->get($nmch); - $out = array(); + $out = array(); - $info = scan::info($sq, $id); + $info = scan::info($sq, $id); - $sql->query('SELECT `unit`, `game`, `name`, `map`, `online`, `players`, `status` FROM `control_servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `unit`, `game`, `name`, `map`, `online`, `players`, `status` FROM `control_servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - if(!$info['status']) - { - $out['name'] = $server['name']; - $out['status'] = sys::status($server['status'], $server['game'], $server['map']); - $out['online'] = $server['online']; - $out['image'] = ''; - $out['buttons'] = sys::buttons($id, $server['status'], $server['game'], $server['unit']); + if(!$info['status']) + { + $out['name'] = $server['name']; + $out['status'] = sys::status($server['status'], $server['game'], $server['map']); + $out['online'] = $server['online']; + $out['image'] = ''; + $out['buttons'] = sys::buttons($id, $server['status'], $server['game'], $server['unit']); - if($players_get) - $out['players'] = base64_decode($server['players']); + if($players_get) + $out['players'] = base64_decode($server['players']); - $mcache->set($nmch, $out, false, $cfg['mcache_server_mon']); + $mcache->set($nmch, $out, false, $cfg['mcache_server_mon']); - return $out; - } + return $out; + } - if($players_get) - $players = scan::info($sq, $id, true); + if($players_get) + $players = scan::info($sq, $id, true); - $out['name'] = htmlspecialchars($info['name']); - $out['status'] = sys::status('working', $server['game'], $info['map']); - $out['online'] = $info['online']; - $out['image'] = ''; - $out['buttons'] = sys::buttons($id, 'working', $server['game'], $server['unit']); - $out['players'] = ''; + $out['name'] = htmlspecialchars($info['name']); + $out['status'] = sys::status('working', $server['game'], $info['map']); + $out['online'] = $info['online']; + $out['image'] = ''; + $out['buttons'] = sys::buttons($id, 'working', $server['game'], $server['unit']); + $out['players'] = ''; - if($players_get) - { - foreach($players as $index => $player) - { - $html->get($server['game'], 'sections/servers/players'); + if($players_get) + { + foreach($players as $index => $player) + { + $html->get($server['game'], 'sections/servers/players'); - $html->set('i', $player['i']); - $html->set('name', $player['name']); - $html->set('score', $player['score']); - $html->set('time', $player['time']); + $html->set('i', $player['i']); + $html->set('name', $player['name']); + $html->set('score', $player['score']); + $html->set('time', $player['time']); - $html->pack('list'); - } + $html->pack('list'); + } - $out['players'] = isset($html->arr['list']) ? $html->arr['list'] : ''; - } + $out['players'] = isset($html->arr['list']) ? $html->arr['list'] : ''; + } - $sql->query('UPDATE `control_servers` set ' - .'`name`="'.$out['name'].'", ' - .'`online`="'.$out['online'].'", ' - .'`map`="'.$info['map'].'", ' - .'`status`="working" WHERE `id`="'.$id.'" LIMIT 1'); + $sql->query('UPDATE `control_servers` set ' + .'`name`="'.$out['name'].'", ' + .'`online`="'.$out['online'].'", ' + .'`map`="'.$info['map'].'", ' + .'`status`="working" WHERE `id`="'.$id.'" LIMIT 1'); - if($players_get) - $sql->query('UPDATE `control_servers` set `players`="'.base64_encode($out['players']).'" WHERE `id`="'.$id.'" LIMIT 1'); + if($players_get) + $sql->query('UPDATE `control_servers` set `players`="'.base64_encode($out['players']).'" WHERE `id`="'.$id.'" LIMIT 1'); - $mcache->set($nmch, $out, false, $cfg['mcache_server_mon']); + $mcache->set($nmch, $out, false, $cfg['mcache_server_mon']); - return $out; - } + return $out; + } - public static function info($sq, $id, $pl = false) - { - global $sql; + public static function info($sq, $id, $pl = false) + { + global $sql; - $sql->query('SELECT `address` FROM `control_servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `address` FROM `control_servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - list($ip, $port) = explode(':', $server['address']); + list($ip, $port) = explode(':', $server['address']); - $sq->Connect($ip, $port, 1, SourceQuery::SOURCE); + $sq->Connect($ip, $port, 1, SourceQuery::SOURCE); - if($pl) - { - $players = $sq->GetPlayers(); + if($pl) + { + $players = $sq->GetPlayers(); - $i = 1; - $data = array(); + $i = 1; + $data = array(); - foreach($players as $n => $player) - { - $data[$i]['i'] = $i; - $data[$i]['name'] = $player['Name'] == '' ? 'Подключается' : $player['Name']; - $data[$i]['score'] = $player['Frags']; - $data[$i]['time'] = $player['TimeF']; + foreach($players as $n => $player) + { + $data[$i]['i'] = $i; + $data[$i]['name'] = $player['Name'] == '' ? 'Подключается' : $player['Name']; + $data[$i]['score'] = $player['Frags']; + $data[$i]['time'] = $player['TimeF']; - $i+=1; - } + $i+=1; + } - return $data; - } + return $data; + } - $data = $sq->GetInfo(); + $data = $sq->GetInfo(); - $map = explode('/', $data['Map']); + $map = explode('/', $data['Map']); - $server['name'] = $data['HostName']; - $server['map'] = end($map); - $server['online'] = $data['Players']; - $server['status'] = strlen($server['map']) > 3 ? true : false; + $server['name'] = $data['HostName']; + $server['map'] = end($map); + $server['online'] = $data['Players']; + $server['status'] = strlen($server['map']) > 3 ? true : false; - return $server; - } - } + return $server; + } + } ?> \ No newline at end of file diff --git a/system/library/control/css/action.php b/system/library/control/css/action.php index 638b854..87f4de8 100644 --- a/system/library/control/css/action.php +++ b/system/library/control/css/action.php @@ -1,177 +1,177 @@ query('SELECT `uid`, `unit`, `game`, `address`, `slots`, `name`, `tickrate`, `map_start`, `vac`, `time_start`, `core_fix` FROM `control_servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `uid`, `unit`, `game`, `address`, `slots`, `name`, `tickrate`, `map_start`, `vac`, `time_start`, `core_fix` FROM `control_servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - $sql->query('SELECT `address`, `passwd`, `fcpu` FROM `control` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); - - // Проверка ssh соедниения пу с локацией - if(!$ssh->auth($unit['passwd'], $unit['address'])) - return array('e' => sys::text('error', 'ssh')); - - list($ip, $port) = explode(':', $server['address']); - - // Убить процессы - $ssh->set('kill -9 `ps aux | grep s_'.$server['uid'].' | grep -v grep | awk '."'{print $2}'".' | xargs;' - .'lsof -i@'.$server['address'].' | awk '."'{print $2}'".' | grep -v PID | xargs`; sudo -u server'.$server['uid'].' screen -wipe'); - - $taskset = ''; - - // Если включена система автораспределения и не установлен фиксированный поток - if(!$server['core_fix']) - { - $proc_stat = array(); - - $proc_stat[0] = $ssh->get('cat /proc/stat'); - } - - // Проверка наличия стартовой карты - $ssh->set('cd /servers/'.$server['uid'].'/cstrike/maps/ && ls | grep .bsp | grep -v .bsp.'); - - if($server['map_start'] != '' AND !in_array($server['map_start'], str_replace('.bsp', '', explode("\n", $ssh->get())))) - return array('e' => sys::updtext(sys::text('servers', 'nomap'), array('map' => $server['map_start'].'.bsp'))); - - // Если система автораспределения продолжить парсинг загрузки процессора - if(isset($proc_stat)) - { - $proc_stat[1] = $ssh->get('cat /proc/stat'); - - // Ядро/поток, на котором будет запущен игровой сервер (поток выбран с рассчетом наименьшей загруженности в момент запуска игрового сервера) - $core = sys::cpu_idle($proc_stat, $server['unit'], $unit['fcpu'], true); // число от 1 до n (где n число ядер/потоков в процессоре (без нулевого) - - if(!is_numeric($core)) - return array('e' => sys::text('error', 'cpu')); - - $taskset = 'taskset -c '.$core; - } - - if($server['core_fix']) - { - $core = $server['core_fix']-1; - $taskset = 'taskset -c '.$core; - } - - // Античит VAC - $vac = $server['vac'] == 0 ? '-insecure' : '-secure'; - - // TV - $tv = $server['tv'] ? '+tv_enable 1 +tv_maxclients 255 +tv_port '.($port+10000) : '-nohltv'; - - // Параметры запуска - $bash = './srcds_run -debug -game cstrike -norestart -condebug console.log -tickrate '.$server['tickrate'].' +servercfgfile server.cfg +map \''.$server['map_start'].'\' +maxplayers '.$server['slots'].' +ip '.$ip.' +port '.$port.' -sv_lan 0 '.$vac.' '.$tv; - - // Временный файл - $temp = sys::temp($bash); - - // Обновление файла start.sh - $ssh->setfile($temp, '/servers/'.$server['uid'].'/start.sh', 0500); - - // Строка запуска - $ssh->set('cd /servers/'.$server['uid'].';' // переход в директорию игрового сервера - .'rm *.pid;' // Удаление *.pid файлов - .'sudo -u server'.$server['uid'].' mkdir -p cstrike/oldstart;' // Создание папки логов - .'cat cstrike/console.log >> cstrike/oldstart/'.date('d.m.Y_H:i:s', $server['time_start']).'.log; rm cstrike/console.log; rm cstrike/oldstart/01.01.1970_03:00:00.log;' // Перемещение лога предыдущего запуска - .'chown server'.$server['uid'].':1000 start.sh;' // Обновление владельца файла start.sh - .'sudo -u server'.$server['uid'].' screen -dmS s_'.$server['uid'].' '.$taskset.' sh -c "./start.sh"'); // Запуск игровго сервера - - $core = !isset($core) ? 0 : $core+1; - - // Обновление информации в базе - $sql->query('UPDATE `control_servers` set `status`="'.$type.'", `online`="0", `players`="", `core_use`="'.$core.'", `time_start`="'.$start_point.'", `stop`="1" WHERE `id`="'.$id.'" LIMIT 1'); - - unlink($temp); - - // Сброс кеша - actions::clmcache($id); - - sys::reset_mcache('ctrl_server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => $type, 'online' => 0, 'players' => '')); - sys::reset_mcache('ctrl_server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => $type, 'online' => 0)); - - return array('s' => 'ok'); - } - - public static function update($id) - { - global $cfg, $sql, $user, $start_point; - - include(LIB.'ssh.php'); - - $sql->query('SELECT `uid`, `unit`, `game`, `name`, `ftp`, `core_fix` FROM `control_servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); - - $sql->query('SELECT `address`, `passwd`, `sql_login`, `sql_passwd`, `sql_port`, `sql_ftp`, `fcpu` FROM `control` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $sql->query('SELECT `address`, `passwd`, `fcpu` FROM `control` WHERE `id`="'.$server['unit'].'" LIMIT 1'); $unit = $sql->get(); - // Проверка ssh соедниения пу с локацией + // Проверка ssh соедниения пу с локацией if(!$ssh->auth($unit['passwd'], $unit['address'])) return array('e' => sys::text('error', 'ssh')); - $taskset = ''; + list($ip, $port) = explode(':', $server['address']); - // Если включена система автораспределения и не установлен фиксированный поток - if(!$server['core_fix']) - { - $proc_stat = array(); + // Убить процессы + $ssh->set('kill -9 `ps aux | grep s_'.$server['uid'].' | grep -v grep | awk '."'{print $2}'".' | xargs;' + .'lsof -i@'.$server['address'].' | awk '."'{print $2}'".' | grep -v PID | xargs`; sudo -u server'.$server['uid'].' screen -wipe'); - $proc_stat[0] = $ssh->get('cat /proc/stat'); - } + $taskset = ''; - // Директория игрового сервера - $install = '/servers/'.$server['uid']; + // Если включена система автораспределения и не установлен фиксированный поток + if(!$server['core_fix']) + { + $proc_stat = array(); - // Если система автораспределения продолжить парсинг загрузки процессора - if(isset($proc_stat)) - { - $proc_stat[1] = $ssh->get('cat /proc/stat'); + $proc_stat[0] = $ssh->get('cat /proc/stat'); + } - // Ядро/поток, на котором будет запущен игровой сервер (поток выбран с рассчетом наименьшей загруженности в момент запуска игрового сервера) - $core = sys::cpu_idle($proc_stat, $server['unit'], $unit['fcpu'], true); // число от 1 до n (где n число ядер/потоков в процессоре (без нулевого) + // Проверка наличия стартовой карты + $ssh->set('cd /servers/'.$server['uid'].'/cstrike/maps/ && ls | grep .bsp | grep -v .bsp.'); - if(!is_numeric($core)) - return array('e' => 'Не удается выполнить операцию, нет свободного потока.'); + if($server['map_start'] != '' AND !in_array($server['map_start'], str_replace('.bsp', '', explode("\n", $ssh->get())))) + return array('e' => sys::updtext(sys::text('servers', 'nomap'), array('map' => $server['map_start'].'.bsp'))); - $taskset = 'taskset -c '.$core; - } + // Если система автораспределения продолжить парсинг загрузки процессора + if(isset($proc_stat)) + { + $proc_stat[1] = $ssh->get('cat /proc/stat'); - if($server['core_fix']) - { - $core = $server['core_fix']-1; - $taskset = 'taskset -c '.$core; - } + // Ядро/поток, на котором будет запущен игровой сервер (поток выбран с рассчетом наименьшей загруженности в момент запуска игрового сервера) + $core = sys::cpu_idle($proc_stat, $server['unit'], $unit['fcpu'], true); // число от 1 до n (где n число ядер/потоков в процессоре (без нулевого) - $ssh->set('cd '.$cfg['steamcmd'].' && '.$taskset.' screen -dmS u_'.$server['uid'].' sh -c "' - .'./steamcmd.sh +login anonymous +force_install_dir "'.$install.'" +app_update 232330 +quit;' - .'cd '.$install.';' - .'chown -R server'.$server['uid'].':servers .;' - .'find . -type d -exec chmod 700 {} \;;' - .'find . -type f -exec chmod 600 {} \;;' - .'chmod 500 '.params::$aFileGame[$server['game']].'"'); + if(!is_numeric($core)) + return array('e' => sys::text('error', 'cpu')); - $core = !isset($core) ? 0 : $core+1; + $taskset = 'taskset -c '.$core; + } - // Обновление информации в базе - $sql->query('UPDATE `control_servers` set `status`="update", `core_use`="'.$core.'" WHERE `id`="'.$id.'" LIMIT 1'); + if($server['core_fix']) + { + $core = $server['core_fix']-1; + $taskset = 'taskset -c '.$core; + } - // Сброс кеша - actions::clmcache($id); + // Античит VAC + $vac = $server['vac'] == 0 ? '-insecure' : '-secure'; - sys::reset_mcache('ctrl_server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'update', 'online' => 0, 'players' => '')); - sys::reset_mcache('ctrl_server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'update', 'online' => 0)); + // TV + $tv = $server['tv'] ? '+tv_enable 1 +tv_maxclients 255 +tv_port '.($port+10000) : '-nohltv'; - return array('s' => 'ok'); - } + // Параметры запуска + $bash = './srcds_run -debug -game cstrike -norestart -condebug console.log -tickrate '.$server['tickrate'].' +servercfgfile server.cfg +map \''.$server['map_start'].'\' +maxplayers '.$server['slots'].' +ip '.$ip.' +port '.$port.' -sv_lan 0 '.$vac.' '.$tv; + + // Временный файл + $temp = sys::temp($bash); + + // Обновление файла start.sh + $ssh->setfile($temp, '/servers/'.$server['uid'].'/start.sh', 0500); + + // Строка запуска + $ssh->set('cd /servers/'.$server['uid'].';' // переход в директорию игрового сервера + .'rm *.pid;' // Удаление *.pid файлов + .'sudo -u server'.$server['uid'].' mkdir -p cstrike/oldstart;' // Создание папки логов + .'cat cstrike/console.log >> cstrike/oldstart/'.date('d.m.Y_H:i:s', $server['time_start']).'.log; rm cstrike/console.log; rm cstrike/oldstart/01.01.1970_03:00:00.log;' // Перемещение лога предыдущего запуска + .'chown server'.$server['uid'].':1000 start.sh;' // Обновление владельца файла start.sh + .'sudo -u server'.$server['uid'].' screen -dmS s_'.$server['uid'].' '.$taskset.' sh -c "./start.sh"'); // Запуск игровго сервера + + $core = !isset($core) ? 0 : $core+1; + + // Обновление информации в базе + $sql->query('UPDATE `control_servers` set `status`="'.$type.'", `online`="0", `players`="", `core_use`="'.$core.'", `time_start`="'.$start_point.'", `stop`="1" WHERE `id`="'.$id.'" LIMIT 1'); + + unlink($temp); + + // Сброс кеша + actions::clmcache($id); + + sys::reset_mcache('ctrl_server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => $type, 'online' => 0, 'players' => '')); + sys::reset_mcache('ctrl_server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => $type, 'online' => 0)); + + return array('s' => 'ok'); + } + + public static function update($id) + { + global $cfg, $sql, $user, $start_point; + + include(LIB.'ssh.php'); + + $sql->query('SELECT `uid`, `unit`, `game`, `name`, `ftp`, `core_fix` FROM `control_servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); + + $sql->query('SELECT `address`, `passwd`, `sql_login`, `sql_passwd`, `sql_port`, `sql_ftp`, `fcpu` FROM `control` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); + + // Проверка ssh соедниения пу с локацией + if(!$ssh->auth($unit['passwd'], $unit['address'])) + return array('e' => sys::text('error', 'ssh')); + + $taskset = ''; + + // Если включена система автораспределения и не установлен фиксированный поток + if(!$server['core_fix']) + { + $proc_stat = array(); + + $proc_stat[0] = $ssh->get('cat /proc/stat'); + } + + // Директория игрового сервера + $install = '/servers/'.$server['uid']; + + // Если система автораспределения продолжить парсинг загрузки процессора + if(isset($proc_stat)) + { + $proc_stat[1] = $ssh->get('cat /proc/stat'); + + // Ядро/поток, на котором будет запущен игровой сервер (поток выбран с рассчетом наименьшей загруженности в момент запуска игрового сервера) + $core = sys::cpu_idle($proc_stat, $server['unit'], $unit['fcpu'], true); // число от 1 до n (где n число ядер/потоков в процессоре (без нулевого) + + if(!is_numeric($core)) + return array('e' => 'Не удается выполнить операцию, нет свободного потока.'); + + $taskset = 'taskset -c '.$core; + } + + if($server['core_fix']) + { + $core = $server['core_fix']-1; + $taskset = 'taskset -c '.$core; + } + + $ssh->set('cd '.$cfg['steamcmd'].' && '.$taskset.' screen -dmS u_'.$server['uid'].' sh -c "' + .'./steamcmd.sh +login anonymous +force_install_dir "'.$install.'" +app_update 232330 +quit;' + .'cd '.$install.';' + .'chown -R server'.$server['uid'].':servers .;' + .'find . -type d -exec chmod 700 {} \;;' + .'find . -type f -exec chmod 600 {} \;;' + .'chmod 500 '.params::$aFileGame[$server['game']].'"'); + + $core = !isset($core) ? 0 : $core+1; + + // Обновление информации в базе + $sql->query('UPDATE `control_servers` set `status`="update", `core_use`="'.$core.'" WHERE `id`="'.$id.'" LIMIT 1'); + + // Сброс кеша + actions::clmcache($id); + + sys::reset_mcache('ctrl_server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'update', 'online' => 0, 'players' => '')); + sys::reset_mcache('ctrl_server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'update', 'online' => 0)); + + return array('s' => 'ok'); + } } ?> \ No newline at end of file diff --git a/system/library/control/css/rcon.php b/system/library/control/css/rcon.php index 1dff675..5cca4f4 100644 --- a/system/library/control/css/rcon.php +++ b/system/library/control/css/rcon.php @@ -1,109 +1,109 @@ Connect($ip, $port, 3, SourceQuery::SOURCE); + $sq->Connect($ip, $port, 3, SourceQuery::SOURCE); - $sq->SetRconPassword(rcon::rcon_passwd($server)); + $sq->SetRconPassword(rcon::rcon_passwd($server)); - $out = $sq->Rcon($cmd); + $out = $sq->Rcon($cmd); - $sq->Disconnect(); + $sq->Disconnect(); - return $out; - } + return $out; + } - public static function players($data) - { - $aPlayers = array(); - $n = 1; + public static function players($data) + { + $aPlayers = array(); + $n = 1; - $lines = explode("\n", $data); + $lines = explode("\n", $data); - foreach($lines as $line) - { - if(strpos($line, '#') === FALSE) - continue; + foreach($lines as $line) + { + if(strpos($line, '#') === FALSE) + continue; - $start = strpos($line, '"')+1; - $end = strrpos($line, '"'); + $start = strpos($line, '"')+1; + $end = strrpos($line, '"'); - $userid = sys::int(substr($line, 0, $start)); + $userid = sys::int(substr($line, 0, $start)); - $name = htmlspecialchars(substr($line, $start, $end-$start)); + $name = htmlspecialchars(substr($line, $start, $end-$start)); - $line = trim(substr($line, $end + 1)); + $line = trim(substr($line, $end + 1)); - $aData = array_values(array_diff(explode(' ', $line), array('', ' '))); + $aData = array_values(array_diff(explode(' ', $line), array('', ' '))); - $steamid = trim($aData[0]); - $ip = trim(sys::first(explode(':', $aData[5]))); + $steamid = trim($aData[0]); + $ip = trim(sys::first(explode(':', $aData[5]))); - if((sys::valid($steamid, 'steamid') AND sys::valid($steamid, 'steamid3')) || sys::valid($ip, 'ip')) - continue; + if((sys::valid($steamid, 'steamid') AND sys::valid($steamid, 'steamid3')) || sys::valid($ip, 'ip')) + continue; - $aPlayers[$n]['userid'] = $userid; - $aPlayers[$n]['name'] = $name; - $aPlayers[$n]['steamid'] = $steamid; - $aPlayers[$n]['time'] = trim($aData[1]); - $aPlayers[$n]['ping'] = trim($aData[2]); - $aPlayers[$n]['ip'] = $ip; + $aPlayers[$n]['userid'] = $userid; + $aPlayers[$n]['name'] = $name; + $aPlayers[$n]['steamid'] = $steamid; + $aPlayers[$n]['time'] = trim($aData[1]); + $aPlayers[$n]['ping'] = trim($aData[2]); + $aPlayers[$n]['ip'] = $ip; - $whois = rcon::country($ip); + $whois = rcon::country($ip); - $aPlayers[$n]['ico'] = $whois['ico']; - $aPlayers[$n]['country'] = $whois['name']; + $aPlayers[$n]['ico'] = $whois['ico']; + $aPlayers[$n]['country'] = $whois['name']; - $n+=1; - } + $n+=1; + } - return $aPlayers; - } + return $aPlayers; + } - public static function rcon_passwd($server) - { - global $cfg, $sql, $user; + public static function rcon_passwd($server) + { + global $cfg, $sql, $user; - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - $sql->query('SELECT `address`, `passwd` FROM `control` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $sql->query('SELECT `address`, `passwd` FROM `control` WHERE `id`="'.$server['unit'].'" LIMIT 1'); $unit = $sql->get(); - if(!$ssh->auth($unit['passwd'], $unit['address'])) + if(!$ssh->auth($unit['passwd'], $unit['address'])) sys::outjs(array('e' => sys::text('error', 'ssh'))); - $ssh->set('cat /servers/'.$server['uid'].'/cstrike/cfg/server.cfg | grep rcon_password'); - $get = explode(' ', str_replace('"', '', trim($ssh->get()))); - $rcon = trim(end($get)); + $ssh->set('cat /servers/'.$server['uid'].'/cstrike/cfg/server.cfg | grep rcon_password'); + $get = explode(' ', str_replace('"', '', trim($ssh->get()))); + $rcon = trim(end($get)); - if(!isset($rcon{0})) - sys::outjs(array('r' => 'Необходимо установить rcon пароль (rcon_password).', 'url' => $cfg['http'].'control/id/'.$server['unit'].'/server/'.$server['unit'].'/section/settings/subsection/server'), $nmch); + if(!isset($rcon{0})) + sys::outjs(array('r' => 'Необходимо установить rcon пароль (rcon_password).', 'url' => $cfg['http'].'control/id/'.$server['unit'].'/server/'.$server['unit'].'/section/settings/subsection/server'), $nmch); - return $rcon; - } + return $rcon; + } - public static function country($ip) - { - global $SxGeo; + public static function country($ip) + { + global $SxGeo; - $cData = $SxGeo->getCityFull($ip); - $ico = sys::country($cData['country']['iso']); + $cData = $SxGeo->getCityFull($ip); + $ico = sys::country($cData['country']['iso']); - return array('ico' => $ico, 'name' => empty($cData['country']['name_ru']) ? 'Не определена' : $cData['country']['name_ru']); - } - } + return array('ico' => $ico, 'name' => empty($cData['country']['name_ru']) ? 'Не определена' : $cData['country']['name_ru']); + } + } ?> \ No newline at end of file diff --git a/system/library/control/css/scan.php b/system/library/control/css/scan.php index f736d83..14ce945 100644 --- a/system/library/control/css/scan.php +++ b/system/library/control/css/scan.php @@ -1,133 +1,133 @@ get($nmch))) - return $mcache->get($nmch); + if(is_array($mcache->get($nmch))) + return $mcache->get($nmch); - $out = array(); + $out = array(); - $info = scan::info($sq, $id); + $info = scan::info($sq, $id); - $sql->query('SELECT `unit`, `game`, `name`, `map`, `online`, `players`, `status` FROM `control_servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `unit`, `game`, `name`, `map`, `online`, `players`, `status` FROM `control_servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - if(!$info['status']) - { - $out['name'] = $server['name']; - $out['status'] = sys::status($server['status'], $server['game'], $server['map']); - $out['online'] = $server['online']; - $out['image'] = ''; - $out['buttons'] = sys::buttons($id, $server['status'], $server['game'], $server['unit']); + if(!$info['status']) + { + $out['name'] = $server['name']; + $out['status'] = sys::status($server['status'], $server['game'], $server['map']); + $out['online'] = $server['online']; + $out['image'] = ''; + $out['buttons'] = sys::buttons($id, $server['status'], $server['game'], $server['unit']); - if($players_get) - $out['players'] = base64_decode($server['players']); + if($players_get) + $out['players'] = base64_decode($server['players']); - $mcache->set($nmch, $out, false, $cfg['mcache_server_mon']); + $mcache->set($nmch, $out, false, $cfg['mcache_server_mon']); - return $out; - } + return $out; + } - if($players_get) - $players = scan::info($sq, $id, true); + if($players_get) + $players = scan::info($sq, $id, true); - $out['name'] = htmlspecialchars($info['name']); - $out['status'] = sys::status('working', $server['game'], $info['map']); - $out['online'] = $info['online']; - $out['image'] = ''; - $out['buttons'] = sys::buttons($id, 'working', $server['game'], $server['unit']); - $out['players'] = ''; + $out['name'] = htmlspecialchars($info['name']); + $out['status'] = sys::status('working', $server['game'], $info['map']); + $out['online'] = $info['online']; + $out['image'] = ''; + $out['buttons'] = sys::buttons($id, 'working', $server['game'], $server['unit']); + $out['players'] = ''; - if($players_get) - { - foreach($players as $index => $player) - { - $html->get($server['game'], 'sections/servers/players'); + if($players_get) + { + foreach($players as $index => $player) + { + $html->get($server['game'], 'sections/servers/players'); - $html->set('i', $player['i']); - $html->set('name', $player['name']); - $html->set('score', $player['score']); - $html->set('time', $player['time']); + $html->set('i', $player['i']); + $html->set('name', $player['name']); + $html->set('score', $player['score']); + $html->set('time', $player['time']); - $html->pack('list'); - } + $html->pack('list'); + } - $out['players'] = isset($html->arr['list']) ? $html->arr['list'] : ''; - } + $out['players'] = isset($html->arr['list']) ? $html->arr['list'] : ''; + } - $sql->query('UPDATE `control_servers` set ' - .'`name`="'.$out['name'].'", ' - .'`online`="'.$out['online'].'", ' - .'`map`="'.$info['map'].'", ' - .'`status`="working" WHERE `id`="'.$id.'" LIMIT 1'); + $sql->query('UPDATE `control_servers` set ' + .'`name`="'.$out['name'].'", ' + .'`online`="'.$out['online'].'", ' + .'`map`="'.$info['map'].'", ' + .'`status`="working" WHERE `id`="'.$id.'" LIMIT 1'); - if($players_get) - $sql->query('UPDATE `control_servers` set `players`="'.base64_encode($out['players']).'" WHERE `id`="'.$id.'" LIMIT 1'); + if($players_get) + $sql->query('UPDATE `control_servers` set `players`="'.base64_encode($out['players']).'" WHERE `id`="'.$id.'" LIMIT 1'); - $mcache->set($nmch, $out, false, $cfg['mcache_server_mon']); + $mcache->set($nmch, $out, false, $cfg['mcache_server_mon']); - return $out; - } + return $out; + } - public static function info($sq, $id, $pl = false) - { - global $sql; + public static function info($sq, $id, $pl = false) + { + global $sql; - $sql->query('SELECT `address` FROM `control_servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `address` FROM `control_servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - list($ip, $port) = explode(':', $server['address']); + list($ip, $port) = explode(':', $server['address']); - $sq->Connect($ip, $port, 1, SourceQuery::SOURCE); + $sq->Connect($ip, $port, 1, SourceQuery::SOURCE); - if($pl) - { - $players = $sq->GetPlayers(); + if($pl) + { + $players = $sq->GetPlayers(); - $i = 1; - $data = array(); + $i = 1; + $data = array(); - foreach($players as $n => $player) - { - $data[$i]['i'] = $i; - $data[$i]['name'] = $player['Name'] == '' ? 'Подключается' : $player['Name']; - $data[$i]['score'] = $player['Frags']; - $data[$i]['time'] = $player['TimeF']; + foreach($players as $n => $player) + { + $data[$i]['i'] = $i; + $data[$i]['name'] = $player['Name'] == '' ? 'Подключается' : $player['Name']; + $data[$i]['score'] = $player['Frags']; + $data[$i]['time'] = $player['TimeF']; - $i+=1; - } + $i+=1; + } - return $data; - } + return $data; + } - $data = $sq->GetInfo(); + $data = $sq->GetInfo(); - $server['name'] = $data['HostName']; - $server['map'] = $data['Map']; - $server['online'] = $data['Players']; - $server['status'] = strlen($server['map']) > 3 ? true : false; + $server['name'] = $data['HostName']; + $server['map'] = $data['Map']; + $server['online'] = $data['Players']; + $server['status'] = strlen($server['map']) > 3 ? true : false; - return $server; - } - } + return $server; + } + } ?> \ No newline at end of file diff --git a/system/library/control/cssold/action.php b/system/library/control/cssold/action.php index 392f4f2..692ca32 100644 --- a/system/library/control/cssold/action.php +++ b/system/library/control/cssold/action.php @@ -1,110 +1,110 @@ query('SELECT `uid`, `unit`, `game`, `address`, `slots`, `name`, `tickrate`, `fps`, `map_start`, `vac`, `time_start`, `core_fix` FROM `control_servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `uid`, `unit`, `game`, `address`, `slots`, `name`, `tickrate`, `fps`, `map_start`, `vac`, `time_start`, `core_fix` FROM `control_servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - $sql->query('SELECT `address`, `passwd`, `fcpu` FROM `control` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $sql->query('SELECT `address`, `passwd`, `fcpu` FROM `control` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); - // Проверка ssh соедниения пу с локацией - if(!$ssh->auth($unit['passwd'], $unit['address'])) - return array('e' => sys::text('error', 'ssh')); + // Проверка ssh соедниения пу с локацией + if(!$ssh->auth($unit['passwd'], $unit['address'])) + return array('e' => sys::text('error', 'ssh')); - list($ip, $port) = explode(':', $server['address']); + list($ip, $port) = explode(':', $server['address']); - // Убить процессы - $ssh->set('kill -9 `ps aux | grep s_'.$server['uid'].' | grep -v grep | awk '."'{print $2}'".' | xargs;' - .'lsof -i@'.$server['address'].' | awk '."'{print $2}'".' | grep -v PID | xargs`; sudo -u server'.$server['uid'].' screen -wipe'); + // Убить процессы + $ssh->set('kill -9 `ps aux | grep s_'.$server['uid'].' | grep -v grep | awk '."'{print $2}'".' | xargs;' + .'lsof -i@'.$server['address'].' | awk '."'{print $2}'".' | grep -v PID | xargs`; sudo -u server'.$server['uid'].' screen -wipe'); - $taskset = ''; + $taskset = ''; - // Если включена система автораспределения и не установлен фиксированный поток - if(!$server['core_fix']) - { - $proc_stat = array(); + // Если включена система автораспределения и не установлен фиксированный поток + if(!$server['core_fix']) + { + $proc_stat = array(); - $proc_stat[0] = $ssh->get('cat /proc/stat'); - } + $proc_stat[0] = $ssh->get('cat /proc/stat'); + } - // Проверка наличия стартовой карты - $ssh->set('cd /servers/'.$server['uid'].'/cstrike/maps/ && ls | grep .bsp | grep -v .bsp.'); + // Проверка наличия стартовой карты + $ssh->set('cd /servers/'.$server['uid'].'/cstrike/maps/ && ls | grep .bsp | grep -v .bsp.'); - if($server['map_start'] != '' AND !in_array($server['map_start'], str_replace('.bsp', '', explode("\n", $ssh->get())))) - return array('e' => sys::updtext(sys::text('servers', 'nomap'), array('map' => $server['map_start'].'.bsp'))); + if($server['map_start'] != '' AND !in_array($server['map_start'], str_replace('.bsp', '', explode("\n", $ssh->get())))) + return array('e' => sys::updtext(sys::text('servers', 'nomap'), array('map' => $server['map_start'].'.bsp'))); - // Если система автораспределения продолжить парсинг загрузки процессора - if(isset($proc_stat)) - { - $proc_stat[1] = $ssh->get('cat /proc/stat'); + // Если система автораспределения продолжить парсинг загрузки процессора + if(isset($proc_stat)) + { + $proc_stat[1] = $ssh->get('cat /proc/stat'); - // Ядро/поток, на котором будет запущен игровой сервер (поток выбран с рассчетом наименьшей загруженности в момент запуска игрового сервера) - $core = sys::cpu_idle($proc_stat, $server['unit'], $unit['fcpu'], true); // число от 1 до n (где n число ядер/потоков в процессоре (без нулевого) + // Ядро/поток, на котором будет запущен игровой сервер (поток выбран с рассчетом наименьшей загруженности в момент запуска игрового сервера) + $core = sys::cpu_idle($proc_stat, $server['unit'], $unit['fcpu'], true); // число от 1 до n (где n число ядер/потоков в процессоре (без нулевого) - if(!is_numeric($core)) - return array('e' => sys::text('error', 'cpu')); + if(!is_numeric($core)) + return array('e' => sys::text('error', 'cpu')); - $taskset = 'taskset -c '.$core; - } + $taskset = 'taskset -c '.$core; + } - if($server['core_fix']) - { - $core = $server['core_fix']-1; - $taskset = 'taskset -c '.$core; - } + if($server['core_fix']) + { + $core = $server['core_fix']-1; + $taskset = 'taskset -c '.$core; + } - // Античит VAC - $vac = $server['vac'] == 0 ? '-insecure' : '-secure'; + // Античит VAC + $vac = $server['vac'] == 0 ? '-insecure' : '-secure'; - // TV - $tv = $server['tv'] ? '+tv_enable 1 +tv_maxclients 255 +tv_port '.($port+10000) : '-nohltv'; + // TV + $tv = $server['tv'] ? '+tv_enable 1 +tv_maxclients 255 +tv_port '.($port+10000) : '-nohltv'; - // FPS - $fps = $server['fps']; + // FPS + $fps = $server['fps']; - // Параметры запуска - $bash = './srcds_run -debug -game cstrike -norestart -condebug console.log -tickrate '.$server['tickrate'].' +fps_egp '.$fps.' +servercfgfile server.cfg +map \''.$server['map_start'].'\' +maxplayers '.$server['slots'].' +ip '.$ip.' +port '.$port.' +sv_lan 0 -nomaster -localcser '.$vac.' '.$tv; + // Параметры запуска + $bash = './srcds_run -debug -game cstrike -norestart -condebug console.log -tickrate '.$server['tickrate'].' +fps_egp '.$fps.' +servercfgfile server.cfg +map \''.$server['map_start'].'\' +maxplayers '.$server['slots'].' +ip '.$ip.' +port '.$port.' +sv_lan 0 -nomaster -localcser '.$vac.' '.$tv; - // Временный файл - $temp = sys::temp($bash); + // Временный файл + $temp = sys::temp($bash); - // Обновление файла start.sh - $ssh->setfile($temp, '/servers/'.$server['uid'].'/start.sh', 0500); + // Обновление файла start.sh + $ssh->setfile($temp, '/servers/'.$server['uid'].'/start.sh', 0500); - // Строка запуска - $ssh->set('cd /servers/'.$server['uid'].';' // переход в директорию игрового сервера - .'rm *.pid;' // Удаление *.pid файлов - .'mv console.log oldstart.log;' // Перемещение лога предыдущего запуска в файл oldstart.log - .'sudo -u server'.$server['uid'].' mkdir -p cstrike/oldstart;' // Создание папки логов - .'cat cstrike/console.log >> cstrike/oldstart/'.date('d.m.Y_H:i:s', $server['time_start']).'.log; rm cstrike/console.log; rm cstrike/oldstart/01.01.1970_03:00:00.log;' // Перемещение лога предыдущего запуска - .'chown server'.$server['uid'].':1000 start.sh;' // Обновление владельца файла start.sh - .'sudo -u server'.$server['uid'].' screen -dmS s_'.$server['uid'].' '.$taskset.' sh -c "./start.sh"'); // Запуск игровго сервера + // Строка запуска + $ssh->set('cd /servers/'.$server['uid'].';' // переход в директорию игрового сервера + .'rm *.pid;' // Удаление *.pid файлов + .'mv console.log oldstart.log;' // Перемещение лога предыдущего запуска в файл oldstart.log + .'sudo -u server'.$server['uid'].' mkdir -p cstrike/oldstart;' // Создание папки логов + .'cat cstrike/console.log >> cstrike/oldstart/'.date('d.m.Y_H:i:s', $server['time_start']).'.log; rm cstrike/console.log; rm cstrike/oldstart/01.01.1970_03:00:00.log;' // Перемещение лога предыдущего запуска + .'chown server'.$server['uid'].':1000 start.sh;' // Обновление владельца файла start.sh + .'sudo -u server'.$server['uid'].' screen -dmS s_'.$server['uid'].' '.$taskset.' sh -c "./start.sh"'); // Запуск игровго сервера - $core = !isset($core) ? 0 : $core+1; + $core = !isset($core) ? 0 : $core+1; - // Обновление информации в базе - $sql->query('UPDATE `control_servers` set `status`="'.$type.'", `online`="0", `players`="", `core_use`="'.$core.'", `time_start`="'.$start_point.'", `stop`="1" WHERE `id`="'.$id.'" LIMIT 1'); + // Обновление информации в базе + $sql->query('UPDATE `control_servers` set `status`="'.$type.'", `online`="0", `players`="", `core_use`="'.$core.'", `time_start`="'.$start_point.'", `stop`="1" WHERE `id`="'.$id.'" LIMIT 1'); - unlink($temp); + unlink($temp); - // Сброс кеша - actions::clmcache($id); + // Сброс кеша + actions::clmcache($id); - sys::reset_mcache('ctrl_server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => $type, 'online' => 0, 'players' => '')); - sys::reset_mcache('ctrl_server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => $type, 'online' => 0)); + sys::reset_mcache('ctrl_server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => $type, 'online' => 0, 'players' => '')); + sys::reset_mcache('ctrl_server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => $type, 'online' => 0)); - return array('s' => 'ok'); - } - } + return array('s' => 'ok'); + } + } ?> \ No newline at end of file diff --git a/system/library/control/cssold/rcon.php b/system/library/control/cssold/rcon.php index 97607e6..c92583e 100644 --- a/system/library/control/cssold/rcon.php +++ b/system/library/control/cssold/rcon.php @@ -1,109 +1,109 @@ Connect($ip, $port, 3, SourceQuery::SOURCE); + $sq->Connect($ip, $port, 3, SourceQuery::SOURCE); - $sq->SetRconPassword(rcon::rcon_passwd($server)); + $sq->SetRconPassword(rcon::rcon_passwd($server)); - $out = $sq->Rcon($cmd); + $out = $sq->Rcon($cmd); - $sq->Disconnect(); + $sq->Disconnect(); - return $out; - } + return $out; + } - public static function players($data) - { - $aPlayers = array(); - $n = 1; + public static function players($data) + { + $aPlayers = array(); + $n = 1; - $lines = explode("\n", $data); + $lines = explode("\n", $data); - foreach($lines as $line) - { - if(strpos($line, '#') === FALSE) - continue; + foreach($lines as $line) + { + if(strpos($line, '#') === FALSE) + continue; - $start = strpos($line, '"')+1; - $end = strrpos($line, '"'); + $start = strpos($line, '"')+1; + $end = strrpos($line, '"'); - $userid = sys::int(substr($line, 0, $start)); + $userid = sys::int(substr($line, 0, $start)); - $name = htmlspecialchars(substr($line, $start, $end-$start)); + $name = htmlspecialchars(substr($line, $start, $end-$start)); - $line = trim(substr($line, $end + 1)); + $line = trim(substr($line, $end + 1)); - $aData = array_values(array_diff(explode(' ', $line), array('', ' '))); + $aData = array_values(array_diff(explode(' ', $line), array('', ' '))); - $steamid = trim($aData[0]); - $ip = trim(sys::first(explode(':', $aData[5]))); + $steamid = trim($aData[0]); + $ip = trim(sys::first(explode(':', $aData[5]))); - if(sys::valid($steamid, 'steamid') || sys::valid($ip, 'ip')) - continue; + if(sys::valid($steamid, 'steamid') || sys::valid($ip, 'ip')) + continue; - $aPlayers[$n]['userid'] = $userid; - $aPlayers[$n]['name'] = $name; - $aPlayers[$n]['steamid'] = $steamid; - $aPlayers[$n]['time'] = trim($aData[1]); - $aPlayers[$n]['ping'] = trim($aData[2]); - $aPlayers[$n]['ip'] = $ip; + $aPlayers[$n]['userid'] = $userid; + $aPlayers[$n]['name'] = $name; + $aPlayers[$n]['steamid'] = $steamid; + $aPlayers[$n]['time'] = trim($aData[1]); + $aPlayers[$n]['ping'] = trim($aData[2]); + $aPlayers[$n]['ip'] = $ip; - $whois = rcon::country($ip); + $whois = rcon::country($ip); - $aPlayers[$n]['ico'] = $whois['ico']; - $aPlayers[$n]['country'] = $whois['name']; + $aPlayers[$n]['ico'] = $whois['ico']; + $aPlayers[$n]['country'] = $whois['name']; - $n+=1; - } + $n+=1; + } - return $aPlayers; - } + return $aPlayers; + } - public static function rcon_passwd($server) - { - global $cfg, $sql, $user; + public static function rcon_passwd($server) + { + global $cfg, $sql, $user; - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - $sql->query('SELECT `address`, `passwd` FROM `control` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $sql->query('SELECT `address`, `passwd` FROM `control` WHERE `id`="'.$server['unit'].'" LIMIT 1'); $unit = $sql->get(); - if(!$ssh->auth($unit['passwd'], $unit['address'])) + if(!$ssh->auth($unit['passwd'], $unit['address'])) sys::outjs(array('e' => sys::text('error', 'ssh'))); - $ssh->set('cat /servers/'.$server['uid'].'/cstrike/cfg/server.cfg | grep rcon_password'); - $get = explode(' ', str_replace('"', '', trim($ssh->get()))); - $rcon = trim(end($get)); + $ssh->set('cat /servers/'.$server['uid'].'/cstrike/cfg/server.cfg | grep rcon_password'); + $get = explode(' ', str_replace('"', '', trim($ssh->get()))); + $rcon = trim(end($get)); - if(!isset($rcon{0})) - sys::outjs(array('r' => 'Необходимо установить rcon пароль (rcon_password).', 'url' => $cfg['http'].'control/id/'.$server['unit'].'/server/'.$server['unit'].'/section/settings/subsection/server'), $nmch); + if(!isset($rcon{0})) + sys::outjs(array('r' => 'Необходимо установить rcon пароль (rcon_password).', 'url' => $cfg['http'].'control/id/'.$server['unit'].'/server/'.$server['unit'].'/section/settings/subsection/server'), $nmch); - return $rcon; - } + return $rcon; + } - public static function country($ip) - { - global $SxGeo; + public static function country($ip) + { + global $SxGeo; - $cData = $SxGeo->getCityFull($ip); - $ico = sys::country($cData['country']['iso']); + $cData = $SxGeo->getCityFull($ip); + $ico = sys::country($cData['country']['iso']); - return array('ico' => $ico, 'name' => empty($cData['country']['name_ru']) ? 'Не определена' : $cData['country']['name_ru']); - } - } + return array('ico' => $ico, 'name' => empty($cData['country']['name_ru']) ? 'Не определена' : $cData['country']['name_ru']); + } + } ?> \ No newline at end of file diff --git a/system/library/control/cssold/scan.php b/system/library/control/cssold/scan.php index f736d83..14ce945 100644 --- a/system/library/control/cssold/scan.php +++ b/system/library/control/cssold/scan.php @@ -1,133 +1,133 @@ get($nmch))) - return $mcache->get($nmch); + if(is_array($mcache->get($nmch))) + return $mcache->get($nmch); - $out = array(); + $out = array(); - $info = scan::info($sq, $id); + $info = scan::info($sq, $id); - $sql->query('SELECT `unit`, `game`, `name`, `map`, `online`, `players`, `status` FROM `control_servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `unit`, `game`, `name`, `map`, `online`, `players`, `status` FROM `control_servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - if(!$info['status']) - { - $out['name'] = $server['name']; - $out['status'] = sys::status($server['status'], $server['game'], $server['map']); - $out['online'] = $server['online']; - $out['image'] = ''; - $out['buttons'] = sys::buttons($id, $server['status'], $server['game'], $server['unit']); + if(!$info['status']) + { + $out['name'] = $server['name']; + $out['status'] = sys::status($server['status'], $server['game'], $server['map']); + $out['online'] = $server['online']; + $out['image'] = ''; + $out['buttons'] = sys::buttons($id, $server['status'], $server['game'], $server['unit']); - if($players_get) - $out['players'] = base64_decode($server['players']); + if($players_get) + $out['players'] = base64_decode($server['players']); - $mcache->set($nmch, $out, false, $cfg['mcache_server_mon']); + $mcache->set($nmch, $out, false, $cfg['mcache_server_mon']); - return $out; - } + return $out; + } - if($players_get) - $players = scan::info($sq, $id, true); + if($players_get) + $players = scan::info($sq, $id, true); - $out['name'] = htmlspecialchars($info['name']); - $out['status'] = sys::status('working', $server['game'], $info['map']); - $out['online'] = $info['online']; - $out['image'] = ''; - $out['buttons'] = sys::buttons($id, 'working', $server['game'], $server['unit']); - $out['players'] = ''; + $out['name'] = htmlspecialchars($info['name']); + $out['status'] = sys::status('working', $server['game'], $info['map']); + $out['online'] = $info['online']; + $out['image'] = ''; + $out['buttons'] = sys::buttons($id, 'working', $server['game'], $server['unit']); + $out['players'] = ''; - if($players_get) - { - foreach($players as $index => $player) - { - $html->get($server['game'], 'sections/servers/players'); + if($players_get) + { + foreach($players as $index => $player) + { + $html->get($server['game'], 'sections/servers/players'); - $html->set('i', $player['i']); - $html->set('name', $player['name']); - $html->set('score', $player['score']); - $html->set('time', $player['time']); + $html->set('i', $player['i']); + $html->set('name', $player['name']); + $html->set('score', $player['score']); + $html->set('time', $player['time']); - $html->pack('list'); - } + $html->pack('list'); + } - $out['players'] = isset($html->arr['list']) ? $html->arr['list'] : ''; - } + $out['players'] = isset($html->arr['list']) ? $html->arr['list'] : ''; + } - $sql->query('UPDATE `control_servers` set ' - .'`name`="'.$out['name'].'", ' - .'`online`="'.$out['online'].'", ' - .'`map`="'.$info['map'].'", ' - .'`status`="working" WHERE `id`="'.$id.'" LIMIT 1'); + $sql->query('UPDATE `control_servers` set ' + .'`name`="'.$out['name'].'", ' + .'`online`="'.$out['online'].'", ' + .'`map`="'.$info['map'].'", ' + .'`status`="working" WHERE `id`="'.$id.'" LIMIT 1'); - if($players_get) - $sql->query('UPDATE `control_servers` set `players`="'.base64_encode($out['players']).'" WHERE `id`="'.$id.'" LIMIT 1'); + if($players_get) + $sql->query('UPDATE `control_servers` set `players`="'.base64_encode($out['players']).'" WHERE `id`="'.$id.'" LIMIT 1'); - $mcache->set($nmch, $out, false, $cfg['mcache_server_mon']); + $mcache->set($nmch, $out, false, $cfg['mcache_server_mon']); - return $out; - } + return $out; + } - public static function info($sq, $id, $pl = false) - { - global $sql; + public static function info($sq, $id, $pl = false) + { + global $sql; - $sql->query('SELECT `address` FROM `control_servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `address` FROM `control_servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - list($ip, $port) = explode(':', $server['address']); + list($ip, $port) = explode(':', $server['address']); - $sq->Connect($ip, $port, 1, SourceQuery::SOURCE); + $sq->Connect($ip, $port, 1, SourceQuery::SOURCE); - if($pl) - { - $players = $sq->GetPlayers(); + if($pl) + { + $players = $sq->GetPlayers(); - $i = 1; - $data = array(); + $i = 1; + $data = array(); - foreach($players as $n => $player) - { - $data[$i]['i'] = $i; - $data[$i]['name'] = $player['Name'] == '' ? 'Подключается' : $player['Name']; - $data[$i]['score'] = $player['Frags']; - $data[$i]['time'] = $player['TimeF']; + foreach($players as $n => $player) + { + $data[$i]['i'] = $i; + $data[$i]['name'] = $player['Name'] == '' ? 'Подключается' : $player['Name']; + $data[$i]['score'] = $player['Frags']; + $data[$i]['time'] = $player['TimeF']; - $i+=1; - } + $i+=1; + } - return $data; - } + return $data; + } - $data = $sq->GetInfo(); + $data = $sq->GetInfo(); - $server['name'] = $data['HostName']; - $server['map'] = $data['Map']; - $server['online'] = $data['Players']; - $server['status'] = strlen($server['map']) > 3 ? true : false; + $server['name'] = $data['HostName']; + $server['map'] = $data['Map']; + $server['online'] = $data['Players']; + $server['status'] = strlen($server['map']) > 3 ? true : false; - return $server; - } - } + return $server; + } + } ?> \ No newline at end of file diff --git a/system/library/control/plugins.php b/system/library/control/plugins.php index 96700cd..2951608 100644 --- a/system/library/control/plugins.php +++ b/system/library/control/plugins.php @@ -1,181 +1,181 @@ arr['images'])) - unset($html->arr['images']); + if(isset($html->arr['images'])) + unset($html->arr['images']); - $aImg = explode("\n", $images); + $aImg = explode("\n", $images); - foreach($aImg as $img) - { - $html->get('plugin_images', 'sections/control/servers/games/plugins'); + foreach($aImg as $img) + { + $html->get('plugin_images', 'sections/control/servers/games/plugins'); - $html->set('id', $plugin); - $html->set('img', $img); + $html->set('id', $plugin); + $html->set('img', $img); - $html->pack('images'); - } + $html->pack('images'); + } - return isset($html->arr['images']) ? $html->arr['images'] : ''; - } + return isset($html->arr['images']) ? $html->arr['images'] : ''; + } - public static function status($status) - { - global $html; + public static function status($status) + { + global $html; - if(!$status) - { - $html->unit('unstable'); - $html->unit('stable', 1); - $html->unit('testing'); - }elseif($status == 2){ - $html->unit('unstable'); - $html->unit('stable'); - $html->unit('testing', 1); - }else{ - $html->unit('unstable', 1); - $html->unit('stable'); - $html->unit('testing'); - } + if(!$status) + { + $html->unit('unstable'); + $html->unit('stable', 1); + $html->unit('testing'); + }elseif($status == 2){ + $html->unit('unstable'); + $html->unit('stable'); + $html->unit('testing', 1); + }else{ + $html->unit('unstable', 1); + $html->unit('stable'); + $html->unit('testing'); + } - return NULL; - } + return NULL; + } - public static function required($id, $required, $choice, $mcache) - { - global $sql; + public static function required($id, $required, $choice, $mcache) + { + global $sql; - if($required == '') - return NULL; + if($required == '') + return NULL; - $aRequi = explode(':', $required); + $aRequi = explode(':', $required); - foreach($aRequi as $pl) - { - $sql->query('SELECT `id` FROM `control_plugins_install` WHERE `server`="'.$sid.'" AND `plugin`="'.$pl.'" LIMIT 1'); - if(!$sql->num()) - { - $sql->query('SELECT `name` FROM `plugins` WHERE `id`="'.$pl.'" LIMIT 1'); - $plRequi = $sql->get(); + foreach($aRequi as $pl) + { + $sql->query('SELECT `id` FROM `control_plugins_install` WHERE `server`="'.$sid.'" AND `plugin`="'.$pl.'" LIMIT 1'); + if(!$sql->num()) + { + $sql->query('SELECT `name` FROM `plugins` WHERE `id`="'.$pl.'" LIMIT 1'); + $plRequi = $sql->get(); - if($choice != '') - { - $aChoice = explode(' ', $choice); + if($choice != '') + { + $aChoice = explode(' ', $choice); - foreach($aChoice as $plugins) - { - $aPlugins = explode(':', $plugins); + foreach($aChoice as $plugins) + { + $aPlugins = explode(':', $plugins); - if(in_array($pl, $aPlugins)) - { - $options = ''; - foreach($aPlugins as $plugin) - { - $sql->query('SELECT `name`, `upd` FROM `plugins` WHERE `id`="'.$plugin.'" LIMIT 1'); - $data = $sql->get(); + if(in_array($pl, $aPlugins)) + { + $options = ''; + foreach($aPlugins as $plugin) + { + $sql->query('SELECT `name`, `upd` FROM `plugins` WHERE `id`="'.$plugin.'" LIMIT 1'); + $data = $sql->get(); - if($data['upd']) - { - $sql->query('SELECT `name` FROM `plugins_update` WHERE `plugin`="'.$plugin.'" ORDER BY `id` DESC LIMIT 1'); - $data = $sql->get(); - } + if($data['upd']) + { + $sql->query('SELECT `name` FROM `plugins_update` WHERE `plugin`="'.$plugin.'" ORDER BY `id` DESC LIMIT 1'); + $data = $sql->get(); + } - $options .= ''; - } + $options .= ''; + } - if($options != '') - sys::outjs(array('e' => 'Для данного плагина требуется установка одного из родителя', 'required' => true, 'pid' => $pl, 'select' => $options), $mcache); - } - } - } + if($options != '') + sys::outjs(array('e' => 'Для данного плагина требуется установка одного из родителя', 'required' => true, 'pid' => $pl, 'select' => $options), $mcache); + } + } + } - sys::outjs(array('e' => 'Для данного плагина требуется установка родителя', 'required' => true, 'pid' => $pl, 'pname' => htmlspecialchars_decode($plRequi['name'])), $mcache); - } - } + sys::outjs(array('e' => 'Для данного плагина требуется установка родителя', 'required' => true, 'pid' => $pl, 'pname' => htmlspecialchars_decode($plRequi['name'])), $mcache); + } + } - return NULL; - } + return NULL; + } - public static function incompatible($id, $incompatible, $mcache) - { - global $sql; + public static function incompatible($id, $incompatible, $mcache) + { + global $sql; - if($incompatible == '') - return NULL; + if($incompatible == '') + return NULL; - $aIncomp = explode(':', $incompatible); + $aIncomp = explode(':', $incompatible); - foreach($aIncomp as $pl) - { - $sql->query('SELECT `id` FROM `control_plugins_install` WHERE `server`="'.$sid.'" AND `plugin`="'.$pl.'" LIMIT 1'); - if($sql->num()) - { - $sql->query('SELECT `name` FROM `plugins` WHERE `id`="'.$pl.'" LIMIT 1'); - $plIncomp = $sql->get(); + foreach($aIncomp as $pl) + { + $sql->query('SELECT `id` FROM `control_plugins_install` WHERE `server`="'.$sid.'" AND `plugin`="'.$pl.'" LIMIT 1'); + if($sql->num()) + { + $sql->query('SELECT `name` FROM `plugins` WHERE `id`="'.$pl.'" LIMIT 1'); + $plIncomp = $sql->get(); - sys::outjs(array('e' => 'Данный плагин несовместим с уже установленным плагином', 'pid' => $pl, 'pname' => htmlspecialchars_decode($plIncomp['name'])), $mcache); - } - } + sys::outjs(array('e' => 'Данный плагин несовместим с уже установленным плагином', 'pid' => $pl, 'pname' => htmlspecialchars_decode($plIncomp['name'])), $mcache); + } + } - return NULL; - } + return NULL; + } - public static function clear($clear, $uid, $dir) - { - global $ssh; + public static function clear($clear, $uid, $dir) + { + global $ssh; - // Если регулярное выражение - if(isset($clear['regex']) AND $clear['regex']) - { - $file = preg_replace($clear['text'], '', $ssh->get('sudo -u server'.$uid.' cat '.$dir.$clear['file'])); + // Если регулярное выражение + if(isset($clear['regex']) AND $clear['regex']) + { + $file = preg_replace($clear['text'], '', $ssh->get('sudo -u server'.$uid.' cat '.$dir.$clear['file'])); - // Временный файл - $temp = sys::temp($file); + // Временный файл + $temp = sys::temp($file); - $ssh->setfile($temp, $dir.$clear['file'], 0644); + $ssh->setfile($temp, $dir.$clear['file'], 0644); - unlink($temp); + unlink($temp); - $query = 'chown server'.$uid.':servers '.$dir.$clear['file'].';'; + $query = 'chown server'.$uid.':servers '.$dir.$clear['file'].';'; - }else - // Удаление текста из файла - $query = 'sudo -u server'.$uid.' sed -i '."'s/".str_replace('/', '\/', htmlspecialchars_decode($clear['text']))."//g'".' '.$dir.$clear['file'].';'; + }else + // Удаление текста из файла + $query = 'sudo -u server'.$uid.' sed -i '."'s/".str_replace('/', '\/', htmlspecialchars_decode($clear['text']))."//g'".' '.$dir.$clear['file'].';'; - $ssh->set($query.'sudo -u server'.$uid.' sed -i '."'/./!d'".' '.$dir.$clear['file']); + $ssh->set($query.'sudo -u server'.$uid.' sed -i '."'/./!d'".' '.$dir.$clear['file']); - return NULL; - } + return NULL; + } - public static function write($write, $uid, $dir) - { - global $ssh; + public static function write($write, $uid, $dir) + { + global $ssh; - // Костыль (добавить пустую строку на всякий случай) - $query = 'sudo -u server'.$uid.' echo "" >> '.$dir.$write['file'].';'; + // Костыль (добавить пустую строку на всякий случай) + $query = 'sudo -u server'.$uid.' echo "" >> '.$dir.$write['file'].';'; - // Исключить дублирование, путем удаления добавляемого текста - $query .= 'sudo -u server'.$uid.' sed -i '."'s/".str_replace('/', '\/', htmlspecialchars_decode($write['text']))."//g'".' '.$dir.$write['file'].';'; + // Исключить дублирование, путем удаления добавляемого текста + $query .= 'sudo -u server'.$uid.' sed -i '."'s/".str_replace('/', '\/', htmlspecialchars_decode($write['text']))."//g'".' '.$dir.$write['file'].';'; - // Добавление текста в начало файла - if($write['top']) - $query .= 'sudo -u server'.$uid.' touch '.$dir.$write['file'].'; sudo -u server'.$uid.' sed -i '."'1i ".str_replace(array('/', "'", '\"'), array('\/', "\'", '"'), htmlspecialchars_decode($write['text']))."'".' '.$dir.$write['file'].';'; - else - // Добавление текста в конец файла - $query .= 'sudo -u server'.$uid.' touch '.$dir.$write['file'].'; sudo -u server'.$uid.' echo "'.str_replace('"', '\"', htmlspecialchars_decode($write['text'])).'" >> '.$dir.$write['file'].';'; + // Добавление текста в начало файла + if($write['top']) + $query .= 'sudo -u server'.$uid.' touch '.$dir.$write['file'].'; sudo -u server'.$uid.' sed -i '."'1i ".str_replace(array('/', "'", '\"'), array('\/', "\'", '"'), htmlspecialchars_decode($write['text']))."'".' '.$dir.$write['file'].';'; + else + // Добавление текста в конец файла + $query .= 'sudo -u server'.$uid.' touch '.$dir.$write['file'].'; sudo -u server'.$uid.' echo "'.str_replace('"', '\"', htmlspecialchars_decode($write['text'])).'" >> '.$dir.$write['file'].';'; - $ssh->set($query.'sudo -u server'.$uid.' sed -i '."'/./!d'".' '.$dir.$clear['file']); + $ssh->set($query.'sudo -u server'.$uid.' sed -i '."'/./!d'".' '.$dir.$clear['file']); - return NULL; - } - } + return NULL; + } + } ?> \ No newline at end of file diff --git a/system/library/control/scans.php b/system/library/control/scans.php index 9b94376..47549c2 100644 --- a/system/library/control/scans.php +++ b/system/library/control/scans.php @@ -1,186 +1,186 @@ 'hlds_', - 'cssold' => 'srcds_i686', - 'css' => 'srcds_', - 'csgo' => 'srcds_', - 'samp' => 'samp', - 'crmp' => 'samp', - 'mta' => 'mta', - 'mc' => 'java' - ); + class scans + { + private static $process = array( + 'cs' => 'hlds_', + 'cssold' => 'srcds_i686', + 'css' => 'srcds_', + 'csgo' => 'srcds_', + 'samp' => 'samp', + 'crmp' => 'samp', + 'mta' => 'mta', + 'mc' => 'java' + ); - public static function resources($id) - { - global $cfg, $sql, $mcache; + public static function resources($id) + { + global $cfg, $sql, $mcache; - $nmch = 'ctrl_server_resources_'.$id; + $nmch = 'ctrl_server_resources_'.$id; - if(is_array($mcache->get($nmch))) - return $mcache->get($nmch); + if(is_array($mcache->get($nmch))) + return $mcache->get($nmch); - $sql->query('SELECT `uid`, `unit`, `game`, `slots`, `status`, `online`, `hdd_use` FROM `control_servers` WHERE `id`="'.$id.'" LIMIT 1'); + $sql->query('SELECT `uid`, `unit`, `game`, `slots`, `status`, `online`, `hdd_use` FROM `control_servers` WHERE `id`="'.$id.'" LIMIT 1'); - if(!$sql->num()) - return NULL; + if(!$sql->num()) + return NULL; - $server = $sql->get(); + $server = $sql->get(); - $resources = array( - 'usr' => 0, - 'cpu' => 0, - 'ram' => 0, - 'hdd' => $server['hdd_use'] - ); + $resources = array( + 'usr' => 0, + 'cpu' => 0, + 'ram' => 0, + 'hdd' => $server['hdd_use'] + ); - $sql->query('SELECT `address`, `passwd`, `ram`, `hdd` FROM `control` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $sql->query('SELECT `address`, `passwd`, `ram`, `hdd` FROM `control` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - if(!$ssh->auth($unit['passwd'], $unit['address'])) - return $resources; + if(!$ssh->auth($unit['passwd'], $unit['address'])) + return $resources; - if(!in_array($server['status'], array('working', 'start', 'restart', 'change'))) - return $resources; + if(!in_array($server['status'], array('working', 'start', 'restart', 'change'))) + return $resources; - $resources['usr'] = ceil(100/$server['slots']*$server['online']); - $resources['usr'] = $resources['usr'] > 100 ? 100 : $resources['usr']; + $resources['usr'] = ceil(100/$server['slots']*$server['online']); + $resources['usr'] = $resources['usr'] > 100 ? 100 : $resources['usr']; - $cr = explode('|', $ssh->get('top -u '.$server['uid'].' -b -n 1 | grep '.(scans::$process[$server['game']]).' | sort | tail -1 | awk \'{print $9"|"$10}\'')); + $cr = explode('|', $ssh->get('top -u '.$server['uid'].' -b -n 1 | grep '.(scans::$process[$server['game']]).' | sort | tail -1 | awk \'{print $9"|"$10}\'')); - if(isset($cr[0])) - $resources['cpu'] = str_replace(',', '.', $cr[0]); + if(isset($cr[0])) + $resources['cpu'] = str_replace(',', '.', $cr[0]); - $resources['cpu'] = $resources['cpu'] > 100 ? 100 : round($resources['cpu']); + $resources['cpu'] = $resources['cpu'] > 100 ? 100 : round($resources['cpu']); - if(isset($cr[1])) - $resources['ram'] = str_replace(',', '.', $cr[1]); + if(isset($cr[1])) + $resources['ram'] = str_replace(',', '.', $cr[1]); - // ram на сервер - $ram = $server['ram'] ? $server['ram'] : $server['slots']*$cfg['ram'][$server['game']]; + // ram на сервер + $ram = $server['ram'] ? $server['ram'] : $server['slots']*$cfg['ram'][$server['game']]; - $resources['ram'] = $unit['ram']/100*$resources['ram']/($ram/100); + $resources['ram'] = $unit['ram']/100*$resources['ram']/($ram/100); - $resources['ram'] = $resources['ram'] > 100 ? 100 : round($resources['ram']); + $resources['ram'] = $resources['ram'] > 100 ? 100 : round($resources['ram']); - $resources['hdd'] = ceil(sys::int($ssh->get('cd /servers/'.$server['uid'].' && du -ms'))/($unit['hdd']/100)); - $resources['hdd'] = $resources['hdd'] > 100 ? 100 : $resources['hdd']; + $resources['hdd'] = ceil(sys::int($ssh->get('cd /servers/'.$server['uid'].' && du -ms'))/($unit['hdd']/100)); + $resources['hdd'] = $resources['hdd'] > 100 ? 100 : $resources['hdd']; - $sql->query('UPDATE `control_servers` set `ram_use`="'.$resources['ram'].'", `cpu_use`="'.$resources['cpu'].'", `hdd_use`="'.$resources['hdd'].'" WHERE `id`="'.$id.'" LIMIT 1'); + $sql->query('UPDATE `control_servers` set `ram_use`="'.$resources['ram'].'", `cpu_use`="'.$resources['cpu'].'", `hdd_use`="'.$resources['hdd'].'" WHERE `id`="'.$id.'" LIMIT 1'); - $mcache->set($nmch, $resources, false, $cfg['mcache_server_resources']); + $mcache->set($nmch, $resources, false, $cfg['mcache_server_resources']); - return $resources; - } + return $resources; + } - public static function status($id) - { - global $start_point, $cfg, $sql, $mcache; + public static function status($id) + { + global $start_point, $cfg, $sql, $mcache; - $nmch = 'ctrl_server_status_'.$id; + $nmch = 'ctrl_server_status_'.$id; - if($mcache->get($nmch)) - return 'mcache -> system_block_operation'; + if($mcache->get($nmch)) + return 'mcache -> system_block_operation'; - $mcache->set($nmch, true, false, $cfg['mcache_server_status']); + $mcache->set($nmch, true, false, $cfg['mcache_server_status']); - $sql->query('SELECT `uid`, `unit`, `game`, `address`, `status`, `name`, `online`, `players` FROM `control_servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `uid`, `unit`, `game`, `address`, `status`, `name`, `online`, `players` FROM `control_servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - $sql->query('SELECT `address`, `passwd` FROM `control` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $sql->query('SELECT `address`, `passwd` FROM `control` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - if(!$ssh->auth($unit['passwd'], $unit['address'])) - return 'unit error connect'; + if(!$ssh->auth($unit['passwd'], $unit['address'])) + return 'unit error connect'; - switch($server['status']) - { - case 'working': case 'change': case 'start': case 'restart': - if(!sys::int($ssh->get('ps aux | grep s_'.$server['uid'].' | grep -v grep | awk \'{print $2}\''))) - { - $sql->query('UPDATE `control_servers` set `status`="off", `online`="0", `players`="0" WHERE `id`="'.$id.'" LIMIT 1'); + switch($server['status']) + { + case 'working': case 'change': case 'start': case 'restart': + if(!sys::int($ssh->get('ps aux | grep s_'.$server['uid'].' | grep -v grep | awk \'{print $2}\''))) + { + $sql->query('UPDATE `control_servers` set `status`="off", `online`="0", `players`="0" WHERE `id`="'.$id.'" LIMIT 1'); - sys::reset_mcache('ctrl_server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'off', 'online' => 0, 'players' => '')); - sys::reset_mcache('ctrl_server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'off', 'online' => 0)); + sys::reset_mcache('ctrl_server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'off', 'online' => 0, 'players' => '')); + sys::reset_mcache('ctrl_server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'off', 'online' => 0)); - return 'server -> working -> off'; - } + return 'server -> working -> off'; + } - break; + break; - case 'off': - if(sys::int($ssh->get('ps aux | grep s_'.$server['uid'].' | grep -v grep | awk \'{print $2}\''))) - { - $sql->query('UPDATE `control_servers` set `status`="working" WHERE `id`="'.$id.'" LIMIT 1'); + case 'off': + if(sys::int($ssh->get('ps aux | grep s_'.$server['uid'].' | grep -v grep | awk \'{print $2}\''))) + { + $sql->query('UPDATE `control_servers` set `status`="working" WHERE `id`="'.$id.'" LIMIT 1'); - sys::reset_mcache('ctrl_server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'working', 'online' => $server['online'], 'players' => $server['players'])); - sys::reset_mcache('ctrl_server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'working', 'online' => $server['online'])); + sys::reset_mcache('ctrl_server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'working', 'online' => $server['online'], 'players' => $server['players'])); + sys::reset_mcache('ctrl_server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'working', 'online' => $server['online'])); - return 'server -> off -> working'; - } + return 'server -> off -> working'; + } - break; + break; - case 'reinstall': - if(!sys::int($ssh->get('ps aux | grep r_'.$server['uid'].' | grep -v grep | awk \'{print $2}\''))) - { - $sql->query('UPDATE `control_servers` set `status`="off" WHERE `id`="'.$id.'" LIMIT 1'); + case 'reinstall': + if(!sys::int($ssh->get('ps aux | grep r_'.$server['uid'].' | grep -v grep | awk \'{print $2}\''))) + { + $sql->query('UPDATE `control_servers` set `status`="off" WHERE `id`="'.$id.'" LIMIT 1'); - sys::reset_mcache('ctrl_server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'off', 'online' => 0, 'players' => '')); - sys::reset_mcache('ctrl_server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'off', 'online' => 0)); + sys::reset_mcache('ctrl_server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'off', 'online' => 0, 'players' => '')); + sys::reset_mcache('ctrl_server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'off', 'online' => 0)); - return 'server -> reinstall -> end'; - } + return 'server -> reinstall -> end'; + } - break; + break; - case 'update': - if(!sys::int($ssh->get('ps aux | grep u_'.$server['uid'].' | grep -v grep | awk \'{print $2}\''))) - { - $sql->query('UPDATE `control_servers` set `status`="off" WHERE `id`="'.$id.'" LIMIT 1'); + case 'update': + if(!sys::int($ssh->get('ps aux | grep u_'.$server['uid'].' | grep -v grep | awk \'{print $2}\''))) + { + $sql->query('UPDATE `control_servers` set `status`="off" WHERE `id`="'.$id.'" LIMIT 1'); - sys::reset_mcache('ctrl_server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'off', 'online' => 0, 'players' => '')); - sys::reset_mcache('ctrl_server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'off', 'online' => 0)); + sys::reset_mcache('ctrl_server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'off', 'online' => 0, 'players' => '')); + sys::reset_mcache('ctrl_server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'off', 'online' => 0)); - return 'server -> update -> end'; - } + return 'server -> update -> end'; + } - break; + break; - case 'install': - if(!sys::int($ssh->get('ps aux | grep i_'.$server['uid'].' | grep -v grep | awk \'{print $2}\''))) - { - $sql->query('UPDATE `control_servers` set `status`="off" WHERE `id`="'.$id.'" LIMIT 1'); + case 'install': + if(!sys::int($ssh->get('ps aux | grep i_'.$server['uid'].' | grep -v grep | awk \'{print $2}\''))) + { + $sql->query('UPDATE `control_servers` set `status`="off" WHERE `id`="'.$id.'" LIMIT 1'); - sys::reset_mcache('ctrl_server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'off', 'online' => 0, 'players' => '')); - sys::reset_mcache('ctrl_server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'off', 'online' => 0)); + sys::reset_mcache('ctrl_server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'off', 'online' => 0, 'players' => '')); + sys::reset_mcache('ctrl_server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'off', 'online' => 0)); - return 'server -> install -> end'; - } + return 'server -> install -> end'; + } - break; + break; - case 'recovery': - if(!sys::int($ssh->get('ps aux | grep rec_'.$server['uid'].' | grep -v grep | awk \'{print $2}\''))) - { - $sql->query('UPDATE `control_servers` set `status`="off" WHERE `id`="'.$id.'" LIMIT 1'); + case 'recovery': + if(!sys::int($ssh->get('ps aux | grep rec_'.$server['uid'].' | grep -v grep | awk \'{print $2}\''))) + { + $sql->query('UPDATE `control_servers` set `status`="off" WHERE `id`="'.$id.'" LIMIT 1'); - sys::reset_mcache('ctrl_server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'off', 'online' => 0, 'players' => '')); - sys::reset_mcache('ctrl_server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'off', 'online' => 0)); + sys::reset_mcache('ctrl_server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'off', 'online' => 0, 'players' => '')); + sys::reset_mcache('ctrl_server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'off', 'online' => 0)); - return 'server -> recovery -> end'; - } - } + return 'server -> recovery -> end'; + } + } - return 'server -> no change -> end scan'; - } - } + return 'server -> no change -> end scan'; + } + } ?> \ No newline at end of file diff --git a/system/library/cron.php b/system/library/cron.php index cac5f93..406c5d2 100644 --- a/system/library/cron.php +++ b/system/library/cron.php @@ -1,77 +1,77 @@ 0, 'group' => 'admin'); + $device = '!mobile'; + $user = array('id' => 0, 'group' => 'admin'); - class cron - { - public static $seping = 5; + class cron + { + public static $seping = 5; - public static $process = array( - 'cs' => 'hlds_', - 'cssold' => 'srcds_i686', - 'css' => 'srcds_', - 'csgo' => 'srcds_', - 'samp' => 'samp', - 'crmp' => 'samp', - 'mta' => 'mta', - 'mc' => 'java' - ); + public static $process = array( + 'cs' => 'hlds_', + 'cssold' => 'srcds_i686', + 'css' => 'srcds_', + 'csgo' => 'srcds_', + 'samp' => 'samp', + 'crmp' => 'samp', + 'mta' => 'mta', + 'mc' => 'java' + ); - public static $quakestat = array( - 'cs' => 'a2s', - 'cssold' => 'a2s', - 'css' => 'a2s', - 'csgo' => 'a2s', - 'mta' => 'eye' - ); + public static $quakestat = array( + 'cs' => 'a2s', + 'cssold' => 'a2s', + 'css' => 'a2s', + 'csgo' => 'a2s', + 'mta' => 'eye' + ); - public static $admins_file = array( - 'cs' => 'cstrike/addons/amxmodx/configs/users.ini', - 'cssold' => 'cstrike/addons/sourcemod/configs/admins_simple.ini', - 'css' => 'cstrike/addons/sourcemod/configs/admins_simple.ini', - 'csgo' => 'csgo/addons/sourcemod/configs/admins_simple.ini' - ); + public static $admins_file = array( + 'cs' => 'cstrike/addons/amxmodx/configs/users.ini', + 'cssold' => 'cstrike/addons/sourcemod/configs/admins_simple.ini', + 'css' => 'cstrike/addons/sourcemod/configs/admins_simple.ini', + 'csgo' => 'csgo/addons/sourcemod/configs/admins_simple.ini' + ); - public static function thread($num, $type, $aData) - { - $threads = array(); + public static function thread($num, $type, $aData) + { + $threads = array(); - for($n = 1; $n <= $num; $n+=1) - { - $data = ''; + for($n = 1; $n <= $num; $n+=1) + { + $data = ''; - $i = 0; + $i = 0; - foreach($aData as $key => $val) - { - if($i == cron::$seping) - break; + foreach($aData as $key => $val) + { + if($i == cron::$seping) + break; - $data .= $val.' '; + $data .= $val.' '; - unset($aData[$key]); + unset($aData[$key]); - $i+=1; - } + $i+=1; + } - $aData = array_values($aData); + $aData = array_values($aData); - $threads[] = $type.' '.substr($data, 0, -1); - } + $threads[] = $type.' '.substr($data, 0, -1); + } - return $threads; - } - } + return $threads; + } + } - include(CRON.$task.'.php'); + include(CRON.$task.'.php'); - new $task(); + new $task(); ?> \ No newline at end of file diff --git a/system/library/cron/control_delete.php b/system/library/cron/control_delete.php index 3adc903..a8b7d23 100644 --- a/system/library/cron/control_delete.php +++ b/system/library/cron/control_delete.php @@ -1,36 +1,36 @@ query('SELECT `id` FROM `control` WHERE `user`="-1" LIMIT 1'); + $sql->query('SELECT `id` FROM `control` WHERE `user`="-1" LIMIT 1'); - if(!$sql->num()) - return NULL; + if(!$sql->num()) + return NULL; - $unit = $sql->get(); + $unit = $sql->get(); - $servers = $sql->query('SELECT `id` FROM `control_servers` WHERE `unit`="'.$unit['id'].'"'); - while($server = $sql->get($servers)) - { - $sql->query('DELETE FROM `control_admins_'.$server['game'].'` WHERE `server`="'.$server['id'].'"'); - $sql->query('DELETE FROM `control_copy` WHERE `server`="'.$server['id'].'"'); - $sql->query('DELETE FROM `control_firewall` WHERE `server`="'.$server['id'].'"'); - $sql->query('DELETE FROM `control_plugins_install` WHERE `server`="'.$server['id'].'"'); - } + $servers = $sql->query('SELECT `id` FROM `control_servers` WHERE `unit`="'.$unit['id'].'"'); + while($server = $sql->get($servers)) + { + $sql->query('DELETE FROM `control_admins_'.$server['game'].'` WHERE `server`="'.$server['id'].'"'); + $sql->query('DELETE FROM `control_copy` WHERE `server`="'.$server['id'].'"'); + $sql->query('DELETE FROM `control_firewall` WHERE `server`="'.$server['id'].'"'); + $sql->query('DELETE FROM `control_plugins_install` WHERE `server`="'.$server['id'].'"'); + } - // Удаление различной информации игрового сервера - $sql->query('DELETE FROM `control_servers` WHERE `unit`="'.$unit['id'].'"'); - $sql->query('DELETE FROM `control` WHERE `id`="'.$unit['id'].'"'); + // Удаление различной информации игрового сервера + $sql->query('DELETE FROM `control_servers` WHERE `unit`="'.$unit['id'].'"'); + $sql->query('DELETE FROM `control` WHERE `id`="'.$unit['id'].'"'); - $sql->query('INSERT INTO `logs_sys` set `user`="0", `control`="'.$unit['id'].'", `text`="Удаление подключенного сервера #'.$unit['id'].' ('.$unit['address'].') passwd: #'.$unit['passwd'].'", `time`="'.$start_point.'"'); + $sql->query('INSERT INTO `logs_sys` set `user`="0", `control`="'.$unit['id'].'", `text`="Удаление подключенного сервера #'.$unit['id'].' ('.$unit['address'].') passwd: #'.$unit['passwd'].'", `time`="'.$start_point.'"'); - return NULL; - } - } + return NULL; + } + } ?> \ No newline at end of file diff --git a/system/library/cron/control_install.php b/system/library/cron/control_install.php index ee0f604..9d07735 100644 --- a/system/library/cron/control_install.php +++ b/system/library/cron/control_install.php @@ -1,35 +1,35 @@ query('SELECT `id`, `address`, `passwd` FROM `control` WHERE `status`="install" AND `install`="0" LIMIT 1'); + $sql->query('SELECT `id`, `address`, `passwd` FROM `control` WHERE `status`="install" AND `install`="0" LIMIT 1'); - if(!$sql->num()) - exit('not found'); + if(!$sql->num()) + exit('not found'); - $unit = $sql->get(); + $unit = $sql->get(); - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - // Проверка ssh соедниения пу с локацией - if(!$ssh->auth($unit['passwd'], $unit['address'])) - exit('error connect'); + // Проверка ssh соедниения пу с локацией + if(!$ssh->auth($unit['passwd'], $unit['address'])) + exit('error connect'); - $ssh->set('apt-get update; apt-get install -y wget screen'); + $ssh->set('apt-get update; apt-get install -y wget screen'); - sleep(20); + sleep(20); - $ssh->set('screen -dmS install bash -c "cd /tmp; rm script.sh; wget -O script.sh [home]autocontrol/action/script --no-check-certificate; chmod 500 script.sh;./script.sh"'); + $ssh->set('screen -dmS install bash -c "cd /tmp; rm script.sh; wget -O script.sh [home]autocontrol/action/script --no-check-certificate; chmod 500 script.sh;./script.sh"'); - $sql->query('UPDATE `control` set install="1" WHERE `id`="'.$unit['id'].'" LIMIT 1'); + $sql->query('UPDATE `control` set install="1" WHERE `id`="'.$unit['id'].'" LIMIT 1'); - exit('install'); - } - } + exit('install'); + } + } ?> \ No newline at end of file diff --git a/system/library/cron/control_scan_servers.php b/system/library/cron/control_scan_servers.php index 5657515..9a391d5 100644 --- a/system/library/cron/control_scan_servers.php +++ b/system/library/cron/control_scan_servers.php @@ -1,105 +1,105 @@ query('SELECT `address` FROM `control` WHERE `id`="'.$servers[4].'" LIMIT 1'); - if(!$sql->num()) - return NULL; + $sql->query('SELECT `address` FROM `control` WHERE `id`="'.$servers[4].'" LIMIT 1'); + if(!$sql->num()) + return NULL; - $unit = $sql->get(); + $unit = $sql->get(); - $game = $servers[3]; + $game = $servers[3]; - unset($servers[3], $servers[4]); + unset($servers[3], $servers[4]); - $sql->query('SELECT `unit` FROM `control_servers` WHERE `id`="'.$servers[5].'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `unit` FROM `control_servers` WHERE `id`="'.$servers[5].'" LIMIT 1'); + $server = $sql->get(); - $sql->query('SELECT `address`, `passwd` FROM `control` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $sql->query('SELECT `address`, `passwd` FROM `control` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - // Проверка ssh соедниения пу с локацией - if(!$ssh->auth($unit['passwd'], $unit['address'])) - return NULL; + // Проверка ssh соедниения пу с локацией + if(!$ssh->auth($unit['passwd'], $unit['address'])) + return NULL; - foreach($servers as $id) - { - $sql->query('SELECT `uid`, `address`, `status`, `stop` FROM `control_servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + foreach($servers as $id) + { + $sql->query('SELECT `uid`, `address`, `status`, `stop` FROM `control_servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - switch($server['status']) - { - case 'working': case 'change': case 'start': case 'restart': - if(!sys::int($ssh->get('ps aux | grep s_'.$server['uid'].' | grep -v grep | awk \'{print $2}\''))) - { - $sql->query('UPDATE `control_servers` set `status`="off", `online`="0", `players`="0" WHERE `id`="'.$id.'" LIMIT 1'); + switch($server['status']) + { + case 'working': case 'change': case 'start': case 'restart': + if(!sys::int($ssh->get('ps aux | grep s_'.$server['uid'].' | grep -v grep | awk \'{print $2}\''))) + { + $sql->query('UPDATE `control_servers` set `status`="off", `online`="0", `players`="0" WHERE `id`="'.$id.'" LIMIT 1'); - // Запуск сервера (если он был выключен не через панель) - if($server['stop']) - { - exec('sh -c "cd /var/enginegp; php cron.php '.$cfg['cron_key'].' control_server_action start '.$game.' '.$id.'"'); + // Запуск сервера (если он был выключен не через панель) + if($server['stop']) + { + exec('sh -c "cd /var/enginegp; php cron.php '.$cfg['cron_key'].' control_server_action start '.$game.' '.$id.'"'); - $sql->query('INSERT INTO `logs_sys` set `user`="0", `server`="'.$id.'", `text`="[Контроль] Включение сервера: сервер выключен не через панель", `time`="'.$start_point.'"'); - } - }else - exec('sh -c "cd /var/enginegp; php cron.php '.$cfg['cron_key'].' control_server_scan '.$game.' '.$id.'"'); + $sql->query('INSERT INTO `logs_sys` set `user`="0", `server`="'.$id.'", `text`="[Контроль] Включение сервера: сервер выключен не через панель", `time`="'.$start_point.'"'); + } + }else + exec('sh -c "cd /var/enginegp; php cron.php '.$cfg['cron_key'].' control_server_scan '.$game.' '.$id.'"'); - break; + break; - case 'off': - if(sys::int($ssh->get('ps aux | grep s_'.$server['uid'].' | grep -v grep | awk \'{print $2}\''))) - $sql->query('UPDATE `control_servers` set `status`="working" WHERE `id`="'.$id.'" LIMIT 1'); - else{ - // Запуск сервера (если он был выключен не через панель) - if($server['stop']) - { - exec('sh -c "cd /var/enginegp; php cron.php '.$cfg['cron_key'].' control_server_action start '.$game.' '.$id.'"'); + case 'off': + if(sys::int($ssh->get('ps aux | grep s_'.$server['uid'].' | grep -v grep | awk \'{print $2}\''))) + $sql->query('UPDATE `control_servers` set `status`="working" WHERE `id`="'.$id.'" LIMIT 1'); + else{ + // Запуск сервера (если он был выключен не через панель) + if($server['stop']) + { + exec('sh -c "cd /var/enginegp; php cron.php '.$cfg['cron_key'].' control_server_action start '.$game.' '.$id.'"'); - $sql->query('INSERT INTO `logs_sys` set `user`="0", `server`="'.$id.'", `text`="[Контроль] Включение сервера: сервер выключен не через панель", `time`="'.$start_point.'"'); + $sql->query('INSERT INTO `logs_sys` set `user`="0", `server`="'.$id.'", `text`="[Контроль] Включение сервера: сервер выключен не через панель", `time`="'.$start_point.'"'); - continue; - } - } + continue; + } + } - break; + break; - case 'reinstall': - if(!sys::int($ssh->get('ps aux | grep r_'.$server['uid'].' | grep -v grep | awk \'{print $2}\''))) - $sql->query('UPDATE `control_servers` set `status`="off" WHERE `id`="'.$id.'" LIMIT 1'); + case 'reinstall': + if(!sys::int($ssh->get('ps aux | grep r_'.$server['uid'].' | grep -v grep | awk \'{print $2}\''))) + $sql->query('UPDATE `control_servers` set `status`="off" WHERE `id`="'.$id.'" LIMIT 1'); - break; + break; - case 'update': - if(!sys::int($ssh->get('ps aux | grep u_'.$server['uid'].' | grep -v grep | awk \'{print $2}\''))) - $sql->query('UPDATE `control_servers` set `status`="off" WHERE `id`="'.$id.'" LIMIT 1'); + case 'update': + if(!sys::int($ssh->get('ps aux | grep u_'.$server['uid'].' | grep -v grep | awk \'{print $2}\''))) + $sql->query('UPDATE `control_servers` set `status`="off" WHERE `id`="'.$id.'" LIMIT 1'); - break; + break; - case 'install': - if(!sys::int($ssh->get('ps aux | grep i_'.$server['uid'].' | grep -v grep | awk \'{print $2}\''))) - $sql->query('UPDATE `control_servers` set `status`="off" WHERE `id`="'.$id.'" LIMIT 1'); + case 'install': + if(!sys::int($ssh->get('ps aux | grep i_'.$server['uid'].' | grep -v grep | awk \'{print $2}\''))) + $sql->query('UPDATE `control_servers` set `status`="off" WHERE `id`="'.$id.'" LIMIT 1'); - break; + break; - case 'recovery': - if(!sys::int($ssh->get('ps aux | grep rec_'.$server['uid'].' | grep -v grep | awk \'{print $2}\''))) - $sql->query('UPDATE `control_servers` set `status`="off" WHERE `id`="'.$id.'" LIMIT 1'); - } - } + case 'recovery': + if(!sys::int($ssh->get('ps aux | grep rec_'.$server['uid'].' | grep -v grep | awk \'{print $2}\''))) + $sql->query('UPDATE `control_servers` set `status`="off" WHERE `id`="'.$id.'" LIMIT 1'); + } + } - return NULL; - } - } + return NULL; + } + } ?> \ No newline at end of file diff --git a/system/library/cron/control_scan_servers_admins.php b/system/library/cron/control_scan_servers_admins.php index a9c64ed..1f76e19 100644 --- a/system/library/cron/control_scan_servers_admins.php +++ b/system/library/cron/control_scan_servers_admins.php @@ -1,68 +1,68 @@ query('SELECT `address` FROM `control` WHERE `id`="'.$servers[4].'" LIMIT 1'); - if(!$sql->num()) - return NULL; + $sql->query('SELECT `address` FROM `control` WHERE `id`="'.$servers[4].'" LIMIT 1'); + if(!$sql->num()) + return NULL; - $unit = $sql->get(); + $unit = $sql->get(); - unset($servers[3], $servers[4]); + unset($servers[3], $servers[4]); - $sql->query('SELECT `unit` FROM `control_servers` WHERE `id`="'.$servers[5].'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `unit` FROM `control_servers` WHERE `id`="'.$servers[5].'" LIMIT 1'); + $server = $sql->get(); - $sql->query('SELECT `address`, `passwd` FROM `control` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $sql->query('SELECT `address`, `passwd` FROM `control` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - // Проверка ssh соедниения пу с локацией - if(!$ssh->auth($unit['passwd'], $unit['address'])) - return NULL; + // Проверка ssh соедниения пу с локацией + if(!$ssh->auth($unit['passwd'], $unit['address'])) + return NULL; - foreach($servers as $id) - { - $sql->query('SELECT `uid` FROM `control_servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + foreach($servers as $id) + { + $sql->query('SELECT `uid` FROM `control_servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - $admins = $sql->query('SELECT `id`, `text` FROM `control_admins_'.$game.'` WHERE `server`="'.$id.'" AND `active`="1" AND `time`<"'.$start_point.'"'); + $admins = $sql->query('SELECT `id`, `text` FROM `control_admins_'.$game.'` WHERE `server`="'.$id.'" AND `active`="1" AND `time`<"'.$start_point.'"'); - if(!$sql->num($admins)) - continue; + if(!$sql->num($admins)) + continue; - $cmd = 'cd /servers/'.$server['uid'].';'; + $cmd = 'cd /servers/'.$server['uid'].';'; - while($admin = $sql->get($admins)) - { - $cmd .= 'sed -i -e \'s/'.escapeshellcmd(htmlspecialchars_decode($admin['text'])).'//g\' '.cron::$admins_file[$game].';'; + while($admin = $sql->get($admins)) + { + $cmd .= 'sed -i -e \'s/'.escapeshellcmd(htmlspecialchars_decode($admin['text'])).'//g\' '.cron::$admins_file[$game].';'; - $sql->query('UPDATE `admins_'.$game.'` set `active`="0" WHERE `id`="'.$admin['id'].'" LIMIT 1'); - } + $sql->query('UPDATE `admins_'.$game.'` set `active`="0" WHERE `id`="'.$admin['id'].'" LIMIT 1'); + } - $cmd .= 'sed -i '."'/./!d'".' '.cron::$admins_file[$game].'; echo -e "\n" >> '.cron::$admins_file[$game].';'; - $cmd .= 'chown server'.$server['uid'].':1000 '.cron::$admins_file[$game]; + $cmd .= 'sed -i '."'/./!d'".' '.cron::$admins_file[$game].'; echo -e "\n" >> '.cron::$admins_file[$game].';'; + $cmd .= 'chown server'.$server['uid'].':1000 '.cron::$admins_file[$game]; - $ssh->set($cmd); - } + $ssh->set($cmd); + } - return NULL; - } - } + return NULL; + } + } ?> \ No newline at end of file diff --git a/system/library/cron/control_scan_servers_copy.php b/system/library/cron/control_scan_servers_copy.php index 9a643e3..423ad74 100644 --- a/system/library/cron/control_scan_servers_copy.php +++ b/system/library/cron/control_scan_servers_copy.php @@ -1,53 +1,53 @@ query('SELECT `address` FROM `control` WHERE `id`="'.$servers[4].'" LIMIT 1'); - if(!$sql->num()) - return NULL; + $sql->query('SELECT `address` FROM `control` WHERE `id`="'.$servers[4].'" LIMIT 1'); + if(!$sql->num()) + return NULL; - $unit = $sql->get(); + $unit = $sql->get(); - $game = $servers[3]; + $game = $servers[3]; - unset($servers[3], $servers[4]); + unset($servers[3], $servers[4]); - $sql->query('SELECT `unit` FROM `control_servers` WHERE `id`="'.$servers[5].'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `unit` FROM `control_servers` WHERE `id`="'.$servers[5].'" LIMIT 1'); + $server = $sql->get(); - $sql->query('SELECT `address`, `passwd` FROM `control` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $sql->query('SELECT `address`, `passwd` FROM `control` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - // Проверка ssh соедниения пу с локацией - if(!$ssh->auth($unit['passwd'], $unit['address'])) - return NULL; + // Проверка ssh соедниения пу с локацией + if(!$ssh->auth($unit['passwd'], $unit['address'])) + return NULL; - foreach($servers as $id) - { - $copys = $sql->query('SELECT `id` FROM `control_copy` WHERE `status`="0"'); - while($copy = $sql->get($copys)) - { - $sql->query('SELECT `uid` FROM `control_servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + foreach($servers as $id) + { + $copys = $sql->query('SELECT `id` FROM `control_copy` WHERE `status`="0"'); + while($copy = $sql->get($copys)) + { + $sql->query('SELECT `uid` FROM `control_servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - if(!sys::int($ssh->get('ps aux | grep copy_'.$server['uid'].' | grep -v grep | awk \'{print $2}\''))) - $sql->query('UPDATE `control_copy` set `status`="1" WHERE `id`="'.$copy['id'].'" LIMIT 1'); - } - } + if(!sys::int($ssh->get('ps aux | grep copy_'.$server['uid'].' | grep -v grep | awk \'{print $2}\''))) + $sql->query('UPDATE `control_copy` set `status`="1" WHERE `id`="'.$copy['id'].'" LIMIT 1'); + } + } - return NULL; - } - } + return NULL; + } + } ?> \ No newline at end of file diff --git a/system/library/cron/control_scan_servers_down.php b/system/library/cron/control_scan_servers_down.php index 6cdd074..d0b01fb 100644 --- a/system/library/cron/control_scan_servers_down.php +++ b/system/library/cron/control_scan_servers_down.php @@ -1,62 +1,62 @@ query('SELECT `address` FROM `control` WHERE `id`="'.$servers[4].'" LIMIT 1'); - if(!$sql->num()) - return NULL; + $sql->query('SELECT `address` FROM `control` WHERE `id`="'.$servers[4].'" LIMIT 1'); + if(!$sql->num()) + return NULL; - $unit = $sql->get(); + $unit = $sql->get(); - $game = $servers[3]; + $game = $servers[3]; - if(!array_key_exists($game, cron::$quakestat)) - return NULL; + if(!array_key_exists($game, cron::$quakestat)) + return NULL; - unset($servers[3], $servers[4]); + unset($servers[3], $servers[4]); - $sql->query('SELECT `unit` FROM `control_servers` WHERE `id`="'.$servers[5].'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `unit` FROM `control_servers` WHERE `id`="'.$servers[5].'" LIMIT 1'); + $server = $sql->get(); - $sql->query('SELECT `address`, `passwd`, `ram` FROM `control` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $sql->query('SELECT `address`, `passwd`, `ram` FROM `control` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - // Проверка ssh соедниения пу с локацией - if(!$ssh->auth($unit['passwd'], $unit['address'])) - return NULL; + // Проверка ssh соедниения пу с локацией + if(!$ssh->auth($unit['passwd'], $unit['address'])) + return NULL; - foreach($servers as $id) - { - $sql->query('SELECT `uid`, `address`, `status`, `autorestart` FROM `control_servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + foreach($servers as $id) + { + $sql->query('SELECT `uid`, `address`, `status`, `autorestart` FROM `control_servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - if(!$server['autorestart']) - continue; + if(!$server['autorestart']) + continue; - if($server['status'] != 'working') - continue; + if($server['status'] != 'working') + continue; - if(!in_array(trim($ssh->get('quakestat -'.(cron::$quakestat[$game]).' '.$server['address'].' -retry 5 -interval 2 | grep -v frags | tail -1 | awk \'{print $2}\'')), array('DOWN', 'no'))) - continue; + if(!in_array(trim($ssh->get('quakestat -'.(cron::$quakestat[$game]).' '.$server['address'].' -retry 5 -interval 2 | grep -v frags | tail -1 | awk \'{print $2}\'')), array('DOWN', 'no'))) + continue; - exec('sh -c "cd /var/enginegp; php cron.php '.$cfg['cron_key'].' control_server_action restart '.$game.' '.$id.'"'); + exec('sh -c "cd /var/enginegp; php cron.php '.$cfg['cron_key'].' control_server_action restart '.$game.' '.$id.'"'); - $sql->query('INSERT INTO `logs_sys` set `user`="0", `server`="'.$id.'", `text`="[Контроль] Перезагрука сервера: сервер завис", `time`="'.$start_point.'"'); - } + $sql->query('INSERT INTO `logs_sys` set `user`="0", `server`="'.$id.'", `text`="[Контроль] Перезагрука сервера: сервер завис", `time`="'.$start_point.'"'); + } - return NULL; - } - } + return NULL; + } + } ?> \ No newline at end of file diff --git a/system/library/cron/control_scan_servers_route.php b/system/library/cron/control_scan_servers_route.php index 2822cfa..6f7e7e5 100644 --- a/system/library/cron/control_scan_servers_route.php +++ b/system/library/cron/control_scan_servers_route.php @@ -1,104 +1,104 @@ query('SELECT `address` FROM `control` WHERE `id`="'.$servers[4].'" LIMIT 1'); - if(!$sql->num()) - return NULL; + $sql->query('SELECT `address` FROM `control` WHERE `id`="'.$servers[4].'" LIMIT 1'); + if(!$sql->num()) + return NULL; - $unit = $sql->get(); + $unit = $sql->get(); - $game = $servers[3]; + $game = $servers[3]; - unset($servers[3], $servers[4]); + unset($servers[3], $servers[4]); - $sql->query('SELECT `unit` FROM `control_servers` WHERE `id`="'.$servers[5].'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `unit` FROM `control_servers` WHERE `id`="'.$servers[5].'" LIMIT 1'); + $server = $sql->get(); - $sql->query('SELECT `address`, `passwd`, `fcpu` FROM `control` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $sql->query('SELECT `address`, `passwd`, `fcpu` FROM `control` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - // Проверка ssh соедниения пу с локацией - if(!$ssh->auth($unit['passwd'], $unit['address'])) - return NULL; + // Проверка ssh соедниения пу с локацией + if(!$ssh->auth($unit['passwd'], $unit['address'])) + return NULL; - $first = $ssh->get('cat /proc/stat'); + $first = $ssh->get('cat /proc/stat'); - sleep(1); + sleep(1); - $aCpu = sys::cpu_idle(array($first, $ssh->get('cat /proc/stat')), $unit['fcpu'], true); + $aCpu = sys::cpu_idle(array($first, $ssh->get('cat /proc/stat')), $unit['fcpu'], true); - array_shift($aCpu); + array_shift($aCpu); - $idle = array(); - $uses = array(); + $idle = array(); + $uses = array(); - foreach($aCpu as $cpu => $data) - { - $core = sys::int($cpu)+1; + foreach($aCpu as $cpu => $data) + { + $core = sys::int($cpu)+1; - $sql->query('SELECT `id` FROM `control_servers` WHERE `unit`="'.$server['unit'].'" AND `core_fix`="'.$core.'" AND `core_fix`="1" LIMIT 1'); - if($sql->num()) - { - unset($aCpu[$cpu]); + $sql->query('SELECT `id` FROM `control_servers` WHERE `unit`="'.$server['unit'].'" AND `core_fix`="'.$core.'" AND `core_fix`="1" LIMIT 1'); + if($sql->num()) + { + unset($aCpu[$cpu]); - continue; - } + continue; + } - if($data['idle'] > 50) - $idle[$core] = $data['idle']; - else - $uses[$core] = 100-$data['idle']; - } + if($data['idle'] > 50) + $idle[$core] = $data['idle']; + else + $uses[$core] = 100-$data['idle']; + } - if(!count($idle)) - return NULL; + if(!count($idle)) + return NULL; - foreach($uses as $use_core => $use) - { - if(!count($idle)) - break; + foreach($uses as $use_core => $use) + { + if(!count($idle)) + break; - $sql->query('SELECT `id`, `uid` FROM `control_servers` WHERE `unit`="'.$server['unit'].'" AND `game`="'.$game.'" AND `core_use`="'.$use_core.'" AND `status`="working" AND `core_fix`="0" ORDER BY `slots_start` DESC, `online` DESC LIMIT 3'); - if($sql->num() > 1) - { - $server = $sql->get(); + $sql->query('SELECT `id`, `uid` FROM `control_servers` WHERE `unit`="'.$server['unit'].'" AND `game`="'.$game.'" AND `core_use`="'.$use_core.'" AND `status`="working" AND `core_fix`="0" ORDER BY `slots_start` DESC, `online` DESC LIMIT 3'); + if($sql->num() > 1) + { + $server = $sql->get(); - $core = array_search(max($idle), $idle); + $core = array_search(max($idle), $idle); - $aPid = explode("\n", $ssh->get('ps aux | grep -v grep | grep '.$server['uid'].' | awk \'{print $2}\'')); + $aPid = explode("\n", $ssh->get('ps aux | grep -v grep | grep '.$server['uid'].' | awk \'{print $2}\'')); - if(count($aPid) < 2) - continue; + if(count($aPid) < 2) + continue; - array_pop($aPid); + array_pop($aPid); - $taskset = ''; + $taskset = ''; - foreach($aPid as $pid) - $taskset .= 'taskset -cp '.($core-1).' '.$pid.';'; + foreach($aPid as $pid) + $taskset .= 'taskset -cp '.($core-1).' '.$pid.';'; - $ssh->set($taskset); + $ssh->set($taskset); - unset($idle[$core]); + unset($idle[$core]); - $sql->query('UPDATE `control_servers` set `core_use`="'.$core.'" WHERE `id`="'.$server['id'].'" LIMIT 1'); - } - } + $sql->query('UPDATE `control_servers` set `core_use`="'.$core.'" WHERE `id`="'.$server['id'].'" LIMIT 1'); + } + } - return NULL; - } - } + return NULL; + } + } ?> \ No newline at end of file diff --git a/system/library/cron/control_server_action.php b/system/library/cron/control_server_action.php index 4582fdc..748cd95 100644 --- a/system/library/cron/control_server_action.php +++ b/system/library/cron/control_server_action.php @@ -1,55 +1,55 @@ get($nmch)) - return NULL; + if($mcache->get($nmch)) + return NULL; - $mcache->set($nmch, true, false, 10); + $mcache->set($nmch, true, false, 10); - if($argv[3] == 'console') - { - global $sql; + if($argv[3] == 'console') + { + global $sql; - $sql->query('SELECT `uid`, `unit` FROM `control_servers` WHERE `id`="'.$argv[5].'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `uid`, `unit` FROM `control_servers` WHERE `id`="'.$argv[5].'" LIMIT 1'); + $server = $sql->get(); - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - $sql->query('SELECT `address`, `passwd` FROM `control` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $sql->query('SELECT `address`, `passwd` FROM `control` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); - // Проверка ssh соедниения пу с локацией - if(!$ssh->auth($unit['passwd'], $unit['address'])) - return NULL; + // Проверка ssh соедниения пу с локацией + if(!$ssh->auth($unit['passwd'], $unit['address'])) + return NULL; - $sql->query('SELECT `commands` FROM `control_crontab` WHERE `id`="'.$argv[6].'" LIMIT 1'); - $cron = $sql->get(); + $sql->query('SELECT `commands` FROM `control_crontab` WHERE `id`="'.$argv[6].'" LIMIT 1'); + $cron = $sql->get(); - $aCmd = explode("\n", base64_decode($cron['commands'])); + $aCmd = explode("\n", base64_decode($cron['commands'])); - foreach($aCmd as $cmd) - $ssh->set('sudo -u server'.$server['uid'].' screen -p 0 -S s_'.$server['uid'].' -X eval \'stuff "'.sys::cmd($cmd).'"\015\'; sudo -u server'.$server['uid'].' screen -p 0 -S s_'.$server['uid'].' -X eval \'stuff \015\''); + foreach($aCmd as $cmd) + $ssh->set('sudo -u server'.$server['uid'].' screen -p 0 -S s_'.$server['uid'].' -X eval \'stuff "'.sys::cmd($cmd).'"\015\'; sudo -u server'.$server['uid'].' screen -p 0 -S s_'.$server['uid'].' -X eval \'stuff \015\''); - return NULL; - } + return NULL; + } - include(LIB.'control/'.$argv[4].'/action.php'); + include(LIB.'control/'.$argv[4].'/action.php'); - if($argv[3] == 'restart') - action::start($argv[5], 'restart'); - else - action::$argv[3]($argv[5]); + if($argv[3] == 'restart') + action::start($argv[5], 'restart'); + else + action::$argv[3]($argv[5]); - return NULL; - } - } + return NULL; + } + } ?> \ No newline at end of file diff --git a/system/library/cron/control_server_cron.php b/system/library/cron/control_server_cron.php index 89aa18a..cc48c45 100644 --- a/system/library/cron/control_server_cron.php +++ b/system/library/cron/control_server_cron.php @@ -1,24 +1,24 @@ query('SELECT `game` FROM `control_servers` WHERE `id`="'.$argv[3].'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `game` FROM `control_servers` WHERE `id`="'.$argv[3].'" LIMIT 1'); + $server = $sql->get(); - $sql->query('SELECT `task` FROM `control_crontab` WHERE `id`="'.$argv[4].'" LIMIT 1'); - $cron = $sql->get(); + $sql->query('SELECT `task` FROM `control_crontab` WHERE `id`="'.$argv[4].'" LIMIT 1'); + $cron = $sql->get(); - $cmd = $cron['task'] == 'console' ? ' '.$argv[4] : ''; + $cmd = $cron['task'] == 'console' ? ' '.$argv[4] : ''; - exec('sh -c "cd /var/enginegp; php cron.php '.$cfg['cron_key'].' control_server_action '.$cron['task'].' '.$server['game'].' '.$argv[3].$cmd.'"'); + exec('sh -c "cd /var/enginegp; php cron.php '.$cfg['cron_key'].' control_server_action '.$cron['task'].' '.$server['game'].' '.$argv[3].$cmd.'"'); - return NULL; - } - } + return NULL; + } + } ?> \ No newline at end of file diff --git a/system/library/cron/control_server_scan.php b/system/library/cron/control_server_scan.php index 9dd6439..7d3efa0 100644 --- a/system/library/cron/control_server_scan.php +++ b/system/library/cron/control_server_scan.php @@ -1,19 +1,19 @@ \ No newline at end of file diff --git a/system/library/cron/control_threads.php b/system/library/cron/control_threads.php index 24fce18..9af8c7a 100644 --- a/system/library/cron/control_threads.php +++ b/system/library/cron/control_threads.php @@ -1,63 +1,63 @@ query('SELECT `id` FROM `control` ORDER BY `id` ASC'); + $aUnit = array(); + $sql->query('SELECT `id` FROM `control` ORDER BY `id` ASC'); - if(!$sql->num()) - return NULL; + if(!$sql->num()) + return NULL; - while($unit = $sql->get()) - $aUnit[$unit['id']] = ''; + while($unit = $sql->get()) + $aUnit[$unit['id']] = ''; - $sql->query('SELECT `id` FROM `control_servers` LIMIT 1'); + $sql->query('SELECT `id` FROM `control_servers` LIMIT 1'); - if(!$sql->num()) - return NULL; + if(!$sql->num()) + return NULL; - $sql->query('SELECT `id`, `unit`, `game` FROM `control_servers` ORDER BY `unit` DESC'); + $sql->query('SELECT `id`, `unit`, `game` FROM `control_servers` ORDER BY `unit` DESC'); - $all = $sql->num(); + $all = $sql->num(); - while($server = $sql->get()) - $aUnit[$server['unit']][$server['game']] .= $server['id'].' '; + while($server = $sql->get()) + $aUnit[$server['unit']][$server['game']] .= $server['id'].' '; - if($argv[3] == 'control_scan_servers_route') - cron::$seping = 50; + if($argv[3] == 'control_scan_servers_route') + cron::$seping = 50; - foreach($aUnit as $unit => $aGame) - { - foreach($aGame as $game => $servers) - { - $aData = explode(' ', $servers); + foreach($aUnit as $unit => $aGame) + { + foreach($aGame as $game => $servers) + { + $aData = explode(' ', $servers); - $num = count($aData)-1; - $sep = $num > 0 ? ceil($num/cron::$seping) : 1; + $num = count($aData)-1; + $sep = $num > 0 ? ceil($num/cron::$seping) : 1; - unset($aData[end($aData)]); + unset($aData[end($aData)]); - $threads[] = cron::thread($sep, $game.' '.$unit, $aData); - } - } + $threads[] = cron::thread($sep, $game.' '.$unit, $aData); + } + } - $cmd = ''; + $cmd = ''; - foreach($threads as $thread) - { - foreach($thread as $screen => $servers) - $cmd .= 'sudo -u www-data screen -dmS scan_'.(sys::first(explode(' ', $servers))).'_'.$screen.' taskset -c '.$cfg['cron_taskset'].' sh -c \"cd /var/enginegp; php cron.php '.$cfg['cron_key'].' '.$argv[3].' '.$servers.'\"; sleep 1;'; - } + foreach($threads as $thread) + { + foreach($thread as $screen => $servers) + $cmd .= 'sudo -u www-data screen -dmS scan_'.(sys::first(explode(' ', $servers))).'_'.$screen.' taskset -c '.$cfg['cron_taskset'].' sh -c \"cd /var/enginegp; php cron.php '.$cfg['cron_key'].' '.$argv[3].' '.$servers.'\"; sleep 1;'; + } - exec('screen -dmS control_threads_'.date('His', $start_point).' sh -c "'.$cmd.'"'); + exec('screen -dmS control_threads_'.date('His', $start_point).' sh -c "'.$cmd.'"'); - return NULL; - } - } + return NULL; + } + } ?> \ No newline at end of file diff --git a/system/library/cron/graph_servers_day.php b/system/library/cron/graph_servers_day.php index edf1fe6..1058036 100644 --- a/system/library/cron/graph_servers_day.php +++ b/system/library/cron/graph_servers_day.php @@ -1,50 +1,50 @@ query('SELECT `id`, `date` FROM `servers` ORDER BY `id` ASC'); + $servers = $sql->query('SELECT `id`, `date` FROM `servers` ORDER BY `id` ASC'); - while($server = $sql->get($servers)) - { - if($server['date']+86400 > $start_point) - continue; + while($server = $sql->get($servers)) + { + if($server['date']+86400 > $start_point) + continue; - $aGraph = array('online' => 0, 'cpu' => 0, 'ram' => 0, 'hdd' => 0, 'time' => 0); + $aGraph = array('online' => 0, 'cpu' => 0, 'ram' => 0, 'hdd' => 0, 'time' => 0); - $sql->query('SELECT `online`, `cpu`, `ram`, `hdd` FROM `graph_hour` WHERE `server`="'.$server['id'].'" AND `time`>"'.($start_point-86400).'" ORDER BY `id` DESC LIMIT 24'); + $sql->query('SELECT `online`, `cpu`, `ram`, `hdd` FROM `graph_hour` WHERE `server`="'.$server['id'].'" AND `time`>"'.($start_point-86400).'" ORDER BY `id` DESC LIMIT 24'); - $n = $sql->num(); + $n = $sql->num(); - if(!$n) - continue; + if(!$n) + continue; - while($graph = $sql->get()) - { - $aGraph['online'] += $graph['online']; - $aGraph['cpu'] += $graph['cpu']; - $aGraph['ram'] += $graph['ram']; - $aGraph['hdd'] += $graph['hdd']; - } + while($graph = $sql->get()) + { + $aGraph['online'] += $graph['online']; + $aGraph['cpu'] += $graph['cpu']; + $aGraph['ram'] += $graph['ram']; + $aGraph['hdd'] += $graph['hdd']; + } - $aGraph['online'] = $aGraph['online']/$n; - $aGraph['cpu'] = $aGraph['cpu']/$n; - $aGraph['ram'] = $aGraph['ram']/$n; - $aGraph['hdd'] = $aGraph['hdd']/$n; + $aGraph['online'] = $aGraph['online']/$n; + $aGraph['cpu'] = $aGraph['cpu']/$n; + $aGraph['ram'] = $aGraph['ram']/$n; + $aGraph['hdd'] = $aGraph['hdd']/$n; - $sql->query('INSERT INTO `graph_day` set `server`="'.$server['id'].'",' - .'`online`="'.$aGraph['online'].'",' - .'`cpu`="'.$aGraph['cpu'].'",' - .'`ram`="'.$aGraph['ram'].'",' - .'`hdd`="'.$aGraph['hdd'].'", `time`="'.$start_point.'"'); - } + $sql->query('INSERT INTO `graph_day` set `server`="'.$server['id'].'",' + .'`online`="'.$aGraph['online'].'",' + .'`cpu`="'.$aGraph['cpu'].'",' + .'`ram`="'.$aGraph['ram'].'",' + .'`hdd`="'.$aGraph['hdd'].'", `time`="'.$start_point.'"'); + } - return NULL; - } - } + return NULL; + } + } ?> \ No newline at end of file diff --git a/system/library/cron/graph_servers_hour.php b/system/library/cron/graph_servers_hour.php index 06cc145..3c07b56 100644 --- a/system/library/cron/graph_servers_hour.php +++ b/system/library/cron/graph_servers_hour.php @@ -1,28 +1,28 @@ query('SELECT `id`, `online`, `ram_use`, `cpu_use`, `hdd_use`, `date` FROM `servers` ORDER BY `id` ASC'); + $servers = $sql->query('SELECT `id`, `online`, `ram_use`, `cpu_use`, `hdd_use`, `date` FROM `servers` ORDER BY `id` ASC'); - while($server = $sql->get($servers)) - { - if($server['date']+3600 > $start_point) - continue; + while($server = $sql->get($servers)) + { + if($server['date']+3600 > $start_point) + continue; - $sql->query('INSERT INTO `graph_hour` set `server`="'.$server['id'].'",' - .'`online`="'.$server['online'].'",' - .'`cpu`="'.$server['cpu_use'].'",' - .'`ram`="'.$server['ram_use'].'",' - .'`hdd`="'.$server['hdd_use'].'", `time`="'.$start_point.'"'); - } + $sql->query('INSERT INTO `graph_hour` set `server`="'.$server['id'].'",' + .'`online`="'.$server['online'].'",' + .'`cpu`="'.$server['cpu_use'].'",' + .'`ram`="'.$server['ram_use'].'",' + .'`hdd`="'.$server['hdd_use'].'", `time`="'.$start_point.'"'); + } - return NULL; - } - } + return NULL; + } + } ?> \ No newline at end of file diff --git a/system/library/cron/notice_help.php b/system/library/cron/notice_help.php index 6b5065f..f1457db 100644 --- a/system/library/cron/notice_help.php +++ b/system/library/cron/notice_help.php @@ -1,32 +1,32 @@ query('SELECT `id`, `user`, `time` FROM `help` WHERE `status`="0" AND `time`<"'.$time.'" AND `notice`="0" AND `close`="0"'); - while($help = $sql->get($helps)) - { - $sql->query('SELECT `mail` FROM `users` WHERE `id`="'.$help['user'].'" AND `time`<"'.$help['time'].'" AND `notice_help`="1" LIMIT 1'); + $helps = $sql->query('SELECT `id`, `user`, `time` FROM `help` WHERE `status`="0" AND `time`<"'.$time.'" AND `notice`="0" AND `close`="0"'); + while($help = $sql->get($helps)) + { + $sql->query('SELECT `mail` FROM `users` WHERE `id`="'.$help['user'].'" AND `time`<"'.$help['time'].'" AND `notice_help`="1" LIMIT 1'); - if(!$sql->num()) - continue; + if(!$sql->num()) + continue; - $user = $sql->get(); + $user = $sql->get(); - if(!sys::mail('Техническая поддержка', sys::updtext(sys::text('mail', 'notice_help'), array('site' => $cfg['name'], 'url' => $cfg['http'].'help/section/dialog/id/'.$help['id'])), $user['mail'])) - continue; + if(!sys::mail('Техническая поддержка', sys::updtext(sys::text('mail', 'notice_help'), array('site' => $cfg['name'], 'url' => $cfg['http'].'help/section/dialog/id/'.$help['id'])), $user['mail'])) + continue; - $sql->query('UPDATE `help` set `notice`="1" WHERE `id`="'.$help['id'].'" LIMIT 1'); - } + $sql->query('UPDATE `help` set `notice`="1" WHERE `id`="'.$help['id'].'" LIMIT 1'); + } - return NULL; - } - } + return NULL; + } + } ?> \ No newline at end of file diff --git a/system/library/cron/notice_help_admin.php b/system/library/cron/notice_help_admin.php index 26e391c..581b06c 100644 --- a/system/library/cron/notice_help_admin.php +++ b/system/library/cron/notice_help_admin.php @@ -1,37 +1,37 @@ query('SELECT `id`, `time`, `notice_admin` FROM `help` WHERE (`notice_admin`="0" OR `notice_admin`="2") AND `close`="0" LIMIT 1'); - if(!$sql->num()) - return NULL; + $sql->query('SELECT `id`, `time`, `notice_admin` FROM `help` WHERE (`notice_admin`="0" OR `notice_admin`="2") AND `close`="0" LIMIT 1'); + if(!$sql->num()) + return NULL; - $help = $sql->get(); + $help = $sql->get(); - foreach($cfg['notice_admin'] as $id) - { - $sql->query('SELECT `mail` FROM `users` WHERE `id`="'.$id.'" LIMIT 1'); - $admin = $sql->get(); + foreach($cfg['notice_admin'] as $id) + { + $sql->query('SELECT `mail` FROM `users` WHERE `id`="'.$id.'" LIMIT 1'); + $admin = $sql->get(); - if($help['notice_admin'] != 2) - { - if(!sys::mail('Техническая поддержка', sys::updtext(sys::text('mail', 'notice_help_admin_new'), array('url' => $cfg['http'].'help/section/dialog/id/'.$help['id'])), $admin['mail'])) - continue; - }else{ - if(!sys::mail('Техническая поддержка', sys::updtext(sys::text('mail', 'notice_help_admin'), array('url' => $cfg['http'].'help/section/dialog/id/'.$help['id'])), $admin['mail'])) - continue; - } - } + if($help['notice_admin'] != 2) + { + if(!sys::mail('Техническая поддержка', sys::updtext(sys::text('mail', 'notice_help_admin_new'), array('url' => $cfg['http'].'help/section/dialog/id/'.$help['id'])), $admin['mail'])) + continue; + }else{ + if(!sys::mail('Техническая поддержка', sys::updtext(sys::text('mail', 'notice_help_admin'), array('url' => $cfg['http'].'help/section/dialog/id/'.$help['id'])), $admin['mail'])) + continue; + } + } - $sql->query('UPDATE `help` set `notice_admin`="1" WHERE `id`="'.$help['id'].'" LIMIT 1'); + $sql->query('UPDATE `help` set `notice_admin`="1" WHERE `id`="'.$help['id'].'" LIMIT 1'); - return NULL; - } - } + return NULL; + } + } ?> \ No newline at end of file diff --git a/system/library/cron/notice_server_overdue.php b/system/library/cron/notice_server_overdue.php index ca3e4c0..ba0407f 100644 --- a/system/library/cron/notice_server_overdue.php +++ b/system/library/cron/notice_server_overdue.php @@ -1,30 +1,30 @@ query('SELECT `id`, `user`, `address` FROM `servers` WHERE `time`<"'.$start_point.'" AND `mail`="0"'); - while($server = $sql->get($servers)) - { - $sql->query('SELECT `mail` FROM `users` WHERE `id`="'.$server['user'].'" LIMIT 1'); - $user = $sql->get(); + $servers = $sql->query('SELECT `id`, `user`, `address` FROM `servers` WHERE `time`<"'.$start_point.'" AND `mail`="0"'); + while($server = $sql->get($servers)) + { + $sql->query('SELECT `mail` FROM `users` WHERE `id`="'.$server['user'].'" LIMIT 1'); + $user = $sql->get(); - if(!sys::mail('Аренда сервера', sys::updtext(sys::text('mail', 'notice_server_overdue'), array('site' => $cfg['name'], 'id' => $server['id'], 'address' => $server['address'])), $user['mail'])) - continue; + if(!sys::mail('Аренда сервера', sys::updtext(sys::text('mail', 'notice_server_overdue'), array('site' => $cfg['name'], 'id' => $server['id'], 'address' => $server['address'])), $user['mail'])) + continue; - $sql->query('UPDATE `servers` set `mail`="1" WHERE `id`="'.$server['id'].'" LIMIT 1'); - } + $sql->query('UPDATE `servers` set `mail`="1" WHERE `id`="'.$server['id'].'" LIMIT 1'); + } - $servers = $sql->query('SELECT `id` FROM `servers` WHERE `time`>"'.$start_point.'" AND `mail`="1"'); - while($server = $sql->get($servers)) - $sql->query('UPDATE `servers` set `mail`="0" WHERE `id`="'.$server['id'].'" LIMIT 1'); + $servers = $sql->query('SELECT `id` FROM `servers` WHERE `time`>"'.$start_point.'" AND `mail`="1"'); + while($server = $sql->get($servers)) + $sql->query('UPDATE `servers` set `mail`="0" WHERE `id`="'.$server['id'].'" LIMIT 1'); - return NULL; - } - } + return NULL; + } + } ?> \ No newline at end of file diff --git a/system/library/cron/preparing_web_delete.php b/system/library/cron/preparing_web_delete.php index 73e240f..e7b8d1d 100644 --- a/system/library/cron/preparing_web_delete.php +++ b/system/library/cron/preparing_web_delete.php @@ -1,18 +1,18 @@ query('SELECT `id` FROM `web` WHERE `user`="0"'); - while($web = $sql->get()) - exec('sh -c "cd /var/enginegp; php cron.php '.$cfg['cron_key'].' web_delete '.$web['id'].'"'); + $sql->query('SELECT `id` FROM `web` WHERE `user`="0"'); + while($web = $sql->get()) + exec('sh -c "cd /var/enginegp; php cron.php '.$cfg['cron_key'].' web_delete '.$web['id'].'"'); - return NULL; - } - } + return NULL; + } + } ?> \ No newline at end of file diff --git a/system/library/cron/privileges.php b/system/library/cron/privileges.php index df716cc..5348300 100644 --- a/system/library/cron/privileges.php +++ b/system/library/cron/privileges.php @@ -1,99 +1,99 @@ query('SELECT `address` FROM `units` WHERE `id`="'.$servers[4].'" LIMIT 1'); - if(!$sql->num()) - return ': UNIT#'.$servers[4].' .'; + $sql->query('SELECT `address` FROM `units` WHERE `id`="'.$servers[4].'" LIMIT 1'); + if(!$sql->num()) + return ': UNIT#'.$servers[4].' .'; - $unit = $sql->get(); + $unit = $sql->get(); - unset($servers[3], $servers[4]); + unset($servers[3], $servers[4]); - foreach($servers as $i => $id) - { - $sql->query('SELECT `id` FROM `privileges_buy` WHERE `server`="'.$id.'" AND `status`="1" LIMIT 1'); - if(!$sql->num()) - unset($servers[$i]); - } + foreach($servers as $i => $id) + { + $sql->query('SELECT `id` FROM `privileges_buy` WHERE `server`="'.$id.'" AND `status`="1" LIMIT 1'); + if(!$sql->num()) + unset($servers[$i]); + } - if(!count($servers)) - return NULL; + if(!count($servers)) + return NULL; - $sql->query('SELECT `unit` FROM `servers` WHERE `id`="'.end($servers).'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `unit` FROM `servers` WHERE `id`="'.end($servers).'" LIMIT 1'); + $server = $sql->get(); - $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - // ssh - if(!$ssh->auth($unit['passwd'], $unit['address'])) - return ': UNIT#'.$server['unit'].' .'; + // ssh + if(!$ssh->auth($unit['passwd'], $unit['address'])) + return ': UNIT#'.$server['unit'].' .'; - $time = $start_point-172800; + $time = $start_point-172800; - foreach($servers as $id) - { - $sql->query('DELETE FROM `privileges_buy` WHERE `date`<"'.$time.'" AND status`="0" LIMIT 5'); + foreach($servers as $id) + { + $sql->query('DELETE FROM `privileges_buy` WHERE `date`<"'.$time.'" AND status`="0" LIMIT 5'); - $aMail = array(); + $aMail = array(); - $sql->query('SELECT `uid`, `tarif` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `uid`, `tarif` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - $sql->query('SELECT `install` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); - $tarif = $sql->get(); + $sql->query('SELECT `install` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); + $tarif = $sql->get(); - $file = $tarif['install'].$server['uid'].'/'.cron::$admins_file[$game]; + $file = $tarif['install'].$server['uid'].'/'.cron::$admins_file[$game]; - $text = $ssh->get('cat '.$file); + $text = $ssh->get('cat '.$file); - $privileges = $sql->query('SELECT `id`, `text`, `sql`, `mail` FROM `privileges_buy` WHERE `server`="'.$id.'" AND `status`="1" LIMIT 3'); - while($privilege = $sql->get($privileges)) - { - $text .= base64_decode($privilege['text']).PHP_EOL; + $privileges = $sql->query('SELECT `id`, `text`, `sql`, `mail` FROM `privileges_buy` WHERE `server`="'.$id.'" AND `status`="1" LIMIT 3'); + while($privilege = $sql->get($privileges)) + { + $text .= base64_decode($privilege['text']).PHP_EOL; - $sql->query(base64_decode($privilege['sql'])); - $sql->query('DELETE FROM `privileges_buy` WHERE `id`="'.$privilege['id'].'" LIMIT 1'); + $sql->query(base64_decode($privilege['sql'])); + $sql->query('DELETE FROM `privileges_buy` WHERE `id`="'.$privilege['id'].'" LIMIT 1'); - $aMail[] = $privilege['mail']; - } + $aMail[] = $privilege['mail']; + } - $temp = sys::temp($text); + $temp = sys::temp($text); - $ssh->setfile($temp, $file, 0644); + $ssh->setfile($temp, $file, 0644); - unlink($temp); + unlink($temp); - $cmd = $game == 'cs' ? 'amx_reloadadmins' : 'sm_reloadadmins'; + $cmd = $game == 'cs' ? 'amx_reloadadmins' : 'sm_reloadadmins'; - $ssh->set('chown server'.$server['uid'].':servers '.$file); - $ssh->set("sudo -u server".$server['uid']." screen -p 0 -S s_".$server['uid']." -X eval 'stuff \"".$cmd."\"\015'"); + $ssh->set('chown server'.$server['uid'].':servers '.$file); + $ssh->set("sudo -u server".$server['uid']." screen -p 0 -S s_".$server['uid']." -X eval 'stuff \"".$cmd."\"\015'"); - foreach($aMail as $mail) - sys::mail(' ', sys::text('mail', 'success_privilege'), $mail); + foreach($aMail as $mail) + sys::mail(' ', sys::text('mail', 'success_privilege'), $mail); - echo 'server#'.$id.' ('.$game.') -> add privileges '.PHP_EOL; - } + echo 'server#'.$id.' ('.$game.') -> add privileges '.PHP_EOL; + } - return NULL; - } - } + return NULL; + } + } ?> \ No newline at end of file diff --git a/system/library/cron/scan_control.php b/system/library/cron/scan_control.php index 583a21c..e588827 100644 --- a/system/library/cron/scan_control.php +++ b/system/library/cron/scan_control.php @@ -1,21 +1,21 @@ query('SELECT `id` FROM `control` ORDER BY `id` ASC'); - while($ctrl = $sql->get()) - ctrl::update_status($ctrl['id'], $ssh); + $sql->query('SELECT `id` FROM `control` ORDER BY `id` ASC'); + while($ctrl = $sql->get()) + ctrl::update_status($ctrl['id'], $ssh); - return NULL; - } - } + return NULL; + } + } ?> \ No newline at end of file diff --git a/system/library/cron/scan_servers.php b/system/library/cron/scan_servers.php index 3836246..8d2346e 100644 --- a/system/library/cron/scan_servers.php +++ b/system/library/cron/scan_servers.php @@ -1,145 +1,145 @@ query('SELECT `address`, `sql_login`, `sql_passwd`, `sql_port`, `sql_ftp` FROM `units` WHERE `id`="'.$servers[4].'" LIMIT 1'); - if(!$sql->num()) - return NULL; + $sql->query('SELECT `address`, `sql_login`, `sql_passwd`, `sql_port`, `sql_ftp` FROM `units` WHERE `id`="'.$servers[4].'" LIMIT 1'); + if(!$sql->num()) + return NULL; - $unit = $sql->get(); + $unit = $sql->get(); - $game = $servers[3]; + $game = $servers[3]; - unset($servers[3], $servers[4]); + unset($servers[3], $servers[4]); - $sql->query('SELECT `unit` FROM `servers` WHERE `id`="'.$servers[5].'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `unit` FROM `servers` WHERE `id`="'.$servers[5].'" LIMIT 1'); + $server = $sql->get(); - $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - // Проверка ssh соедниения пу с локацией - if(!$ssh->auth($unit['passwd'], $unit['address'])) - return NULL; + // Проверка ssh соедниения пу с локацией + if(!$ssh->auth($unit['passwd'], $unit['address'])) + return NULL; - foreach($servers as $id) - { - $sql->query('SELECT `user`, `uid`, `address`, `status`, `time`, `overdue`, `ftp`, `stop`, `block` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + foreach($servers as $id) + { + $sql->query('SELECT `user`, `uid`, `address`, `status`, `time`, `overdue`, `ftp`, `stop`, `block` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - // Если аренда не закончилась, а сервер просрочен - if($server['time'] > $start_point && $server['status'] == 'overdue') - { - $sql->query('UPDATE `servers` set `status`="off" WHERE `id`="'.$id.'" LIMIT 1'); + // Если аренда не закончилась, а сервер просрочен + if($server['time'] > $start_point && $server['status'] == 'overdue') + { + $sql->query('UPDATE `servers` set `status`="off" WHERE `id`="'.$id.'" LIMIT 1'); - continue; - } + continue; + } - // Если аренда закончилась, а сервер не просрочен (и не заблокирован) - if($server['time'] < $start_point && !in_array($server['status'], array('overdue', 'blocked'))) - { - // Убить процессы - $ssh->set('kill -9 `ps aux | grep s_'.$server['uid'].' | grep -v grep | awk '."'{print $2}'".' | xargs;' - .'lsof -i@'.$server['address'].' | awk '."'{print $2}'".' | grep -v PID | xargs`; sudo -u server'.$server['uid'].' screen -wipe'); + // Если аренда закончилась, а сервер не просрочен (и не заблокирован) + if($server['time'] < $start_point && !in_array($server['status'], array('overdue', 'blocked'))) + { + // Убить процессы + $ssh->set('kill -9 `ps aux | grep s_'.$server['uid'].' | grep -v grep | awk '."'{print $2}'".' | xargs;' + .'lsof -i@'.$server['address'].' | awk '."'{print $2}'".' | grep -v PID | xargs`; sudo -u server'.$server['uid'].' screen -wipe'); - if($server['ftp']) - $ssh->set("mysql -P ".$unit['sql_port']." -u".$unit['sql_login']." -p".$unit['sql_passwd']." --database ".$unit['sql_ftp']." -e \"DELETE FROM ftp WHERE user='".$server['uid']."'\""); + if($server['ftp']) + $ssh->set("mysql -P ".$unit['sql_port']." -u".$unit['sql_login']." -p".$unit['sql_passwd']." --database ".$unit['sql_ftp']." -e \"DELETE FROM ftp WHERE user='".$server['uid']."'\""); - $sql->query('UPDATE `servers` set `status`="overdue", `online`="0", `players`="", `ftp`="0", `overdue`="'.$start_point.'" WHERE `id`="'.$id.'" LIMIT 1'); + $sql->query('UPDATE `servers` set `status`="overdue", `online`="0", `players`="", `ftp`="0", `overdue`="'.$start_point.'" WHERE `id`="'.$id.'" LIMIT 1'); - continue; - } + continue; + } - // Если аренда закончилась и сервер просрочен длительное время или поставлен на удаление - if($server['user'] == -1 || ($server['time'] < $start_point && ($server['overdue']+$cfg['server_delete']*86400) < $start_point)) - { - if($server['user'] != -1) - $sql->query('UPDATE `servers` set `user`="-1" WHERE `id`="'.$id.'" LIMIT 1'); + // Если аренда закончилась и сервер просрочен длительное время или поставлен на удаление + if($server['user'] == -1 || ($server['time'] < $start_point && ($server['overdue']+$cfg['server_delete']*86400) < $start_point)) + { + if($server['user'] != -1) + $sql->query('UPDATE `servers` set `user`="-1" WHERE `id`="'.$id.'" LIMIT 1'); - exec('sh -c "cd /var/enginegp; php cron.php '.$cfg['cron_key'].' server_delete '.$id.'"'); + exec('sh -c "cd /var/enginegp; php cron.php '.$cfg['cron_key'].' server_delete '.$id.'"'); - continue; - } + continue; + } - switch($server['status']) - { - case 'working': case 'change': case 'start': case 'restart': - if(!sys::int($ssh->get('ps aux | grep s_'.$server['uid'].' | grep -v grep | awk \'{print $2}\''))) - { - $sql->query('UPDATE `servers` set `status`="off", `online`="0", `players`="0" WHERE `id`="'.$id.'" LIMIT 1'); + switch($server['status']) + { + case 'working': case 'change': case 'start': case 'restart': + if(!sys::int($ssh->get('ps aux | grep s_'.$server['uid'].' | grep -v grep | awk \'{print $2}\''))) + { + $sql->query('UPDATE `servers` set `status`="off", `online`="0", `players`="0" WHERE `id`="'.$id.'" LIMIT 1'); - // Запуск сервера (если он был выключен не через панель) - if($server['stop']) - { - exec('sh -c "cd /var/enginegp; php cron.php '.$cfg['cron_key'].' server_action start '.$game.' '.$id.'"'); + // Запуск сервера (если он был выключен не через панель) + if($server['stop']) + { + exec('sh -c "cd /var/enginegp; php cron.php '.$cfg['cron_key'].' server_action start '.$game.' '.$id.'"'); - $sql->query('INSERT INTO `logs_sys` set `user`="0", `server`="'.$id.'", `text`="Включение сервера: сервер выключен не через панель", `time`="'.$start_point.'"'); - } - }else - exec('sh -c "cd /var/enginegp; php cron.php '.$cfg['cron_key'].' server_scan '.$game.' '.$id.'"'); + $sql->query('INSERT INTO `logs_sys` set `user`="0", `server`="'.$id.'", `text`="Включение сервера: сервер выключен не через панель", `time`="'.$start_point.'"'); + } + }else + exec('sh -c "cd /var/enginegp; php cron.php '.$cfg['cron_key'].' server_scan '.$game.' '.$id.'"'); - break; + break; - case 'off': - if(sys::int($ssh->get('ps aux | grep s_'.$server['uid'].' | grep -v grep | awk \'{print $2}\''))) - $sql->query('UPDATE `servers` set `status`="working" WHERE `id`="'.$id.'" LIMIT 1'); - else{ - // Запуск сервера (если он был выключен не через панель) - if($server['stop']) - { - exec('sh -c "cd /var/enginegp; php cron.php '.$cfg['cron_key'].' server_action start '.$game.' '.$id.'"'); + case 'off': + if(sys::int($ssh->get('ps aux | grep s_'.$server['uid'].' | grep -v grep | awk \'{print $2}\''))) + $sql->query('UPDATE `servers` set `status`="working" WHERE `id`="'.$id.'" LIMIT 1'); + else{ + // Запуск сервера (если он был выключен не через панель) + if($server['stop']) + { + exec('sh -c "cd /var/enginegp; php cron.php '.$cfg['cron_key'].' server_action start '.$game.' '.$id.'"'); - $sql->query('INSERT INTO `logs_sys` set `user`="0", `server`="'.$id.'", `text`="Включение сервера: сервер выключен не через панель", `time`="'.$start_point.'"'); + $sql->query('INSERT INTO `logs_sys` set `user`="0", `server`="'.$id.'", `text`="Включение сервера: сервер выключен не через панель", `time`="'.$start_point.'"'); - continue; - } - } + continue; + } + } - break; + break; - case 'reinstall': - if(!sys::int($ssh->get('ps aux | grep r_'.$server['uid'].' | grep -v grep | awk \'{print $2}\''))) - $sql->query('UPDATE `servers` set `status`="off" WHERE `id`="'.$id.'" LIMIT 1'); + case 'reinstall': + if(!sys::int($ssh->get('ps aux | grep r_'.$server['uid'].' | grep -v grep | awk \'{print $2}\''))) + $sql->query('UPDATE `servers` set `status`="off" WHERE `id`="'.$id.'" LIMIT 1'); - break; + break; - case 'update': - if(!sys::int($ssh->get('ps aux | grep u_'.$server['uid'].' | grep -v grep | awk \'{print $2}\''))) - $sql->query('UPDATE `servers` set `status`="off" WHERE `id`="'.$id.'" LIMIT 1'); + case 'update': + if(!sys::int($ssh->get('ps aux | grep u_'.$server['uid'].' | grep -v grep | awk \'{print $2}\''))) + $sql->query('UPDATE `servers` set `status`="off" WHERE `id`="'.$id.'" LIMIT 1'); - break; + break; - case 'install': - if(!sys::int($ssh->get('ps aux | grep i_'.$server['uid'].' | grep -v grep | awk \'{print $2}\''))) - $sql->query('UPDATE `servers` set `status`="off" WHERE `id`="'.$id.'" LIMIT 1'); + case 'install': + if(!sys::int($ssh->get('ps aux | grep i_'.$server['uid'].' | grep -v grep | awk \'{print $2}\''))) + $sql->query('UPDATE `servers` set `status`="off" WHERE `id`="'.$id.'" LIMIT 1'); - break; + break; - case 'recovery': - if(!sys::int($ssh->get('ps aux | grep rec_'.$server['uid'].' | grep -v grep | awk \'{print $2}\''))) - $sql->query('UPDATE `servers` set `status`="off" WHERE `id`="'.$id.'" LIMIT 1'); + case 'recovery': + if(!sys::int($ssh->get('ps aux | grep rec_'.$server['uid'].' | grep -v grep | awk \'{print $2}\''))) + $sql->query('UPDATE `servers` set `status`="off" WHERE `id`="'.$id.'" LIMIT 1'); - break; + break; - case 'blocked': - if($server['block'] < $start_point) - $sql->query('UPDATE `servers` set `status`="off", `block`="0" WHERE `id`="'.$id.'" LIMIT 1'); - } - } + case 'blocked': + if($server['block'] < $start_point) + $sql->query('UPDATE `servers` set `status`="off", `block`="0" WHERE `id`="'.$id.'" LIMIT 1'); + } + } - return NULL; - } - } + return NULL; + } + } ?> \ No newline at end of file diff --git a/system/library/cron/scan_servers_admins.php b/system/library/cron/scan_servers_admins.php index 7034e07..40578ad 100644 --- a/system/library/cron/scan_servers_admins.php +++ b/system/library/cron/scan_servers_admins.php @@ -1,71 +1,71 @@ query('SELECT `address` FROM `units` WHERE `id`="'.$servers[4].'" LIMIT 1'); - if(!$sql->num()) - return NULL; + $sql->query('SELECT `address` FROM `units` WHERE `id`="'.$servers[4].'" LIMIT 1'); + if(!$sql->num()) + return NULL; - $unit = $sql->get(); + $unit = $sql->get(); - unset($servers[3], $servers[4]); + unset($servers[3], $servers[4]); - $sql->query('SELECT `unit` FROM `servers` WHERE `id`="'.$servers[5].'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `unit` FROM `servers` WHERE `id`="'.$servers[5].'" LIMIT 1'); + $server = $sql->get(); - $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - // Проверка ssh соедниения пу с локацией - if(!$ssh->auth($unit['passwd'], $unit['address'])) - return NULL; + // Проверка ssh соедниения пу с локацией + if(!$ssh->auth($unit['passwd'], $unit['address'])) + return NULL; - foreach($servers as $id) - { - $sql->query('SELECT `uid`, `tarif` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + foreach($servers as $id) + { + $sql->query('SELECT `uid`, `tarif` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - $sql->query('SELECT `install` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); - $tarif = $sql->get(); + $sql->query('SELECT `install` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); + $tarif = $sql->get(); - $admins = $sql->query('SELECT `id`, `text` FROM `admins_'.$game.'` WHERE `server`="'.$id.'" AND `active`="1" AND `time`<"'.$start_point.'"'); + $admins = $sql->query('SELECT `id`, `text` FROM `admins_'.$game.'` WHERE `server`="'.$id.'" AND `active`="1" AND `time`<"'.$start_point.'"'); - if(!$sql->num($admins)) - continue; + if(!$sql->num($admins)) + continue; - $cmd = 'cd '.$tarif['install'].$server['uid'].';'; + $cmd = 'cd '.$tarif['install'].$server['uid'].';'; - while($admin = $sql->get($admins)) - { - $cmd .= 'sed -i -e \'s/'.escapeshellcmd(htmlspecialchars_decode($admin['text'])).'//g\' '.cron::$admins_file[$game].';'; + while($admin = $sql->get($admins)) + { + $cmd .= 'sed -i -e \'s/'.escapeshellcmd(htmlspecialchars_decode($admin['text'])).'//g\' '.cron::$admins_file[$game].';'; - $sql->query('UPDATE `admins_'.$game.'` set `active`="0" WHERE `id`="'.$admin['id'].'" LIMIT 1'); - } + $sql->query('UPDATE `admins_'.$game.'` set `active`="0" WHERE `id`="'.$admin['id'].'" LIMIT 1'); + } - $cmd .= 'sed -i '."'/./!d'".' '.cron::$admins_file[$game].'; echo -e "\n" >> '.cron::$admins_file[$game].';'; - $cmd .= 'chown server'.$server['uid'].':1000 '.cron::$admins_file[$game]; + $cmd .= 'sed -i '."'/./!d'".' '.cron::$admins_file[$game].'; echo -e "\n" >> '.cron::$admins_file[$game].';'; + $cmd .= 'chown server'.$server['uid'].':1000 '.cron::$admins_file[$game]; - $ssh->set($cmd); - } + $ssh->set($cmd); + } - return NULL; - } - } + return NULL; + } + } ?> \ No newline at end of file diff --git a/system/library/cron/scan_servers_copy.php b/system/library/cron/scan_servers_copy.php index f7259a7..ff03a8a 100644 --- a/system/library/cron/scan_servers_copy.php +++ b/system/library/cron/scan_servers_copy.php @@ -1,53 +1,53 @@ query('SELECT `address` FROM `units` WHERE `id`="'.$servers[4].'" LIMIT 1'); - if(!$sql->num()) - return NULL; + $sql->query('SELECT `address` FROM `units` WHERE `id`="'.$servers[4].'" LIMIT 1'); + if(!$sql->num()) + return NULL; - $unit = $sql->get(); + $unit = $sql->get(); - $game = $servers[3]; + $game = $servers[3]; - unset($servers[3], $servers[4]); + unset($servers[3], $servers[4]); - $sql->query('SELECT `unit` FROM `servers` WHERE `id`="'.$servers[5].'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `unit` FROM `servers` WHERE `id`="'.$servers[5].'" LIMIT 1'); + $server = $sql->get(); - $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - // Проверка ssh соедниения пу с локацией - if(!$ssh->auth($unit['passwd'], $unit['address'])) - return NULL; + // Проверка ssh соедниения пу с локацией + if(!$ssh->auth($unit['passwd'], $unit['address'])) + return NULL; - foreach($servers as $id) - { - $copys = $sql->query('SELECT `id` FROM `copy` WHERE `status`="0"'); - while($copy = $sql->get($copys)) - { - $sql->query('SELECT `uid` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + foreach($servers as $id) + { + $copys = $sql->query('SELECT `id` FROM `copy` WHERE `status`="0"'); + while($copy = $sql->get($copys)) + { + $sql->query('SELECT `uid` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - if(!sys::int($ssh->get('ps aux | grep copy_'.$server['uid'].' | grep -v grep | awk \'{print $2}\''))) - $sql->query('UPDATE `copy` set `status`="1" WHERE `id`="'.$copy['id'].'" LIMIT 1'); - } - } + if(!sys::int($ssh->get('ps aux | grep copy_'.$server['uid'].' | grep -v grep | awk \'{print $2}\''))) + $sql->query('UPDATE `copy` set `status`="1" WHERE `id`="'.$copy['id'].'" LIMIT 1'); + } + } - return NULL; - } - } + return NULL; + } + } ?> \ No newline at end of file diff --git a/system/library/cron/scan_servers_down.php b/system/library/cron/scan_servers_down.php index 043956c..293ac5c 100644 --- a/system/library/cron/scan_servers_down.php +++ b/system/library/cron/scan_servers_down.php @@ -1,62 +1,62 @@ query('SELECT `address` FROM `units` WHERE `id`="'.$servers[4].'" LIMIT 1'); - if(!$sql->num()) - return NULL; + $sql->query('SELECT `address` FROM `units` WHERE `id`="'.$servers[4].'" LIMIT 1'); + if(!$sql->num()) + return NULL; - $unit = $sql->get(); + $unit = $sql->get(); - $game = $servers[3]; + $game = $servers[3]; - if(!array_key_exists($game, cron::$quakestat)) - return NULL; + if(!array_key_exists($game, cron::$quakestat)) + return NULL; - unset($servers[3], $servers[4]); + unset($servers[3], $servers[4]); - $sql->query('SELECT `unit` FROM `servers` WHERE `id`="'.$servers[5].'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `unit` FROM `servers` WHERE `id`="'.$servers[5].'" LIMIT 1'); + $server = $sql->get(); - $sql->query('SELECT `address`, `passwd`, `ram` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $sql->query('SELECT `address`, `passwd`, `ram` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - // Проверка ssh соедниения пу с локацией - if(!$ssh->auth($unit['passwd'], $unit['address'])) - return NULL; + // Проверка ssh соедниения пу с локацией + if(!$ssh->auth($unit['passwd'], $unit['address'])) + return NULL; - foreach($servers as $id) - { - $sql->query('SELECT `uid`, `address`, `status`, `autorestart` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + foreach($servers as $id) + { + $sql->query('SELECT `uid`, `address`, `status`, `autorestart` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - if(!$server['autorestart']) - continue; + if(!$server['autorestart']) + continue; - if($server['status'] != 'working') - continue; + if($server['status'] != 'working') + continue; - if(!in_array(trim($ssh->get('quakestat -'.(cron::$quakestat[$game]).' '.$server['address'].' -retry 5 -interval 2 | grep -v frags | tail -1 | awk \'{print $2}\'')), array('DOWN', 'no'))) - continue; + if(!in_array(trim($ssh->get('quakestat -'.(cron::$quakestat[$game]).' '.$server['address'].' -retry 5 -interval 2 | grep -v frags | tail -1 | awk \'{print $2}\'')), array('DOWN', 'no'))) + continue; - exec('sh -c "cd /var/enginegp; php cron.php '.$cfg['cron_key'].' server_action restart '.$game.' '.$id.'"'); + exec('sh -c "cd /var/enginegp; php cron.php '.$cfg['cron_key'].' server_action restart '.$game.' '.$id.'"'); - $sql->query('INSERT INTO `logs_sys` set `user`="0", `server`="'.$id.'", `text`="Перезагрука сервера: сервер завис", `time`="'.$start_point.'"'); - } + $sql->query('INSERT INTO `logs_sys` set `user`="0", `server`="'.$id.'", `text`="Перезагрука сервера: сервер завис", `time`="'.$start_point.'"'); + } - return NULL; - } - } + return NULL; + } + } ?> \ No newline at end of file diff --git a/system/library/cron/scan_servers_load.php b/system/library/cron/scan_servers_load.php index a58e925..9ecd804 100644 --- a/system/library/cron/scan_servers_load.php +++ b/system/library/cron/scan_servers_load.php @@ -1,96 +1,96 @@ query('SELECT `address` FROM `units` WHERE `id`="'.$servers[4].'" LIMIT 1'); - if(!$sql->num()) - return NULL; + $sql->query('SELECT `address` FROM `units` WHERE `id`="'.$servers[4].'" LIMIT 1'); + if(!$sql->num()) + return NULL; - $unit = $sql->get(); + $unit = $sql->get(); - $game = $servers[3]; + $game = $servers[3]; - unset($servers[3], $servers[4]); + unset($servers[3], $servers[4]); - $sql->query('SELECT `unit` FROM `servers` WHERE `id`="'.$servers[5].'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `unit` FROM `servers` WHERE `id`="'.$servers[5].'" LIMIT 1'); + $server = $sql->get(); - $sql->query('SELECT `address`, `passwd`, `ram` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $sql->query('SELECT `address`, `passwd`, `ram` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - // Проверка ssh соедниения пу с локацией - if(!$ssh->auth($unit['passwd'], $unit['address'])) - return NULL; + // Проверка ssh соедниения пу с локацией + if(!$ssh->auth($unit['passwd'], $unit['address'])) + return NULL; - foreach($servers as $id) - { - $sql->query('SELECT `uid`, `slots`, `hdd`, `ram`, `ram_use_max`, `cpu_use_max`, `core_fix`, `core_fix_one` `status` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + foreach($servers as $id) + { + $sql->query('SELECT `uid`, `slots`, `hdd`, `ram`, `ram_use_max`, `cpu_use_max`, `core_fix`, `core_fix_one` `status` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - if($server['core_fix'] AND $server['core_fix_one']) - continue; + if($server['core_fix'] AND $server['core_fix_one']) + continue; - if(!in_array($server['status'], array('working', 'start', 'restart', 'change'))) - { - echo 'server#'.$id.' ('.$game.') -> load average: cpu = 0% / ram = 0% (no working)'.PHP_EOL; + if(!in_array($server['status'], array('working', 'start', 'restart', 'change'))) + { + echo 'server#'.$id.' ('.$game.') -> load average: cpu = 0% / ram = 0% (no working)'.PHP_EOL; - continue; - } + continue; + } - $resources = array(); + $resources = array(); - for($n = 0; $n <= 2; $n+=1) - { - $cr = explode('|', $ssh->get('top -u '.$server['uid'].' -b -n 1 | grep '.(cron::$process[$game]).' | awk \'{print $9"|"$10}\'')); + for($n = 0; $n <= 2; $n+=1) + { + $cr = explode('|', $ssh->get('top -u '.$server['uid'].' -b -n 1 | grep '.(cron::$process[$game]).' | awk \'{print $9"|"$10}\'')); - $resources[$n]['cpu'] = isset($cr[0]) ? round(str_replace(',', '.', $cr[0])) : 0; + $resources[$n]['cpu'] = isset($cr[0]) ? round(str_replace(',', '.', $cr[0])) : 0; - $resources[$n]['ram'] = isset($cr[1]) ? str_replace(',', '.', $cr[1]) : 0; - $ram = $server['ram'] ? $server['ram'] : $server['slots']*$cfg['ram'][$game]; - $resources[$n]['ram'] = round($unit['ram']/100*$resources[$n]['ram']/($ram/100)); + $resources[$n]['ram'] = isset($cr[1]) ? str_replace(',', '.', $cr[1]) : 0; + $ram = $server['ram'] ? $server['ram'] : $server['slots']*$cfg['ram'][$game]; + $resources[$n]['ram'] = round($unit['ram']/100*$resources[$n]['ram']/($ram/100)); - sleep(1); - } + sleep(1); + } - $loads = array(); + $loads = array(); - foreach($resources as $n => $load) - { - foreach($load as $type => $val) - $loads[$type] += $val; - } + foreach($resources as $n => $load) + { + foreach($load as $type => $val) + $loads[$type] += $val; + } - $average_cpu = isset($loads['cpu']) ? $loads['cpu']/2 : 0; - $average_ram = isset($loads['ram']) ? $loads['ram']/2 : 0; + $average_cpu = isset($loads['cpu']) ? $loads['cpu']/2 : 0; + $average_ram = isset($loads['ram']) ? $loads['ram']/2 : 0; - $max_cpu = $server['cpu_use_max'] ? $server['cpu_use_max'] : $cfg['cpu_use_max'][$game]; - $max_ram = $server['ram_use_max'] ? $server['ram_use_max'] : $cfg['ram_use_max'][$game]; + $max_cpu = $server['cpu_use_max'] ? $server['cpu_use_max'] : $cfg['cpu_use_max'][$game]; + $max_ram = $server['ram_use_max'] ? $server['ram_use_max'] : $cfg['ram_use_max'][$game]; - if($average_cpu > $max_cpu) - { - exec('sh -c "cd /var/enginegp; php cron.php '.$cfg['cron_key'].' server_action restart '.$game.' '.$id.'"'); + if($average_cpu > $max_cpu) + { + exec('sh -c "cd /var/enginegp; php cron.php '.$cfg['cron_key'].' server_action restart '.$game.' '.$id.'"'); - $sql->query('INSERT INTO `logs_sys` set `user`="0", `server`="'.$id.'", `text`="Перезагрука сервера: OVERLOAD^cpu = '.$average_cpu.'%", `time`="'.$start_point.'"'); - }elseif($average_ram > $max_ram){ - exec('sh -c "cd /var/enginegp; php cron.php '.$cfg['cron_key'].' server_action restart '.$game.' '.$id.'"'); + $sql->query('INSERT INTO `logs_sys` set `user`="0", `server`="'.$id.'", `text`="Перезагрука сервера: OVERLOAD^cpu = '.$average_cpu.'%", `time`="'.$start_point.'"'); + }elseif($average_ram > $max_ram){ + exec('sh -c "cd /var/enginegp; php cron.php '.$cfg['cron_key'].' server_action restart '.$game.' '.$id.'"'); - $sql->query('INSERT INTO `logs_sys` set `user`="0", `server`="'.$id.'", `text`="Перезагрука сервера: OVERLOAD^ram = '.$average_ram.'%", `time`="'.$start_point.'"'); - } - } + $sql->query('INSERT INTO `logs_sys` set `user`="0", `server`="'.$id.'", `text`="Перезагрука сервера: OVERLOAD^ram = '.$average_ram.'%", `time`="'.$start_point.'"'); + } + } - return NULL; - } - } + return NULL; + } + } ?> \ No newline at end of file diff --git a/system/library/cron/scan_servers_route.php b/system/library/cron/scan_servers_route.php index 0c830e6..0c4d105 100644 --- a/system/library/cron/scan_servers_route.php +++ b/system/library/cron/scan_servers_route.php @@ -1,104 +1,104 @@ query('SELECT `address` FROM `units` WHERE `id`="'.$servers[4].'" LIMIT 1'); - if(!$sql->num()) - return NULL; + $sql->query('SELECT `address` FROM `units` WHERE `id`="'.$servers[4].'" LIMIT 1'); + if(!$sql->num()) + return NULL; - $unit = $sql->get(); + $unit = $sql->get(); - $game = $servers[3]; + $game = $servers[3]; - unset($servers[3], $servers[4]); + unset($servers[3], $servers[4]); - $sql->query('SELECT `unit` FROM `servers` WHERE `id`="'.$servers[5].'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `unit` FROM `servers` WHERE `id`="'.$servers[5].'" LIMIT 1'); + $server = $sql->get(); - $sql->query('SELECT `address`, `passwd`, `ram` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $sql->query('SELECT `address`, `passwd`, `ram` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - // Проверка ssh соедниения пу с локацией - if(!$ssh->auth($unit['passwd'], $unit['address'])) - return NULL; + // Проверка ssh соедниения пу с локацией + if(!$ssh->auth($unit['passwd'], $unit['address'])) + return NULL; - $first = $ssh->get('cat /proc/stat'); + $first = $ssh->get('cat /proc/stat'); - sleep(1); + sleep(1); - $aCpu = sys::cpu_idle(array($first, $ssh->get('cat /proc/stat')), false, true); + $aCpu = sys::cpu_idle(array($first, $ssh->get('cat /proc/stat')), false, true); - array_shift($aCpu); + array_shift($aCpu); - $idle = array(); - $uses = array(); + $idle = array(); + $uses = array(); - foreach($aCpu as $cpu => $data) - { - $core = sys::int($cpu)+1; + foreach($aCpu as $cpu => $data) + { + $core = sys::int($cpu)+1; - $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$server['unit'].'" AND `core_fix`="'.$core.'" AND `core_fix`="1" LIMIT 1'); - if($sql->num()) - { - unset($aCpu[$cpu]); + $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$server['unit'].'" AND `core_fix`="'.$core.'" AND `core_fix`="1" LIMIT 1'); + if($sql->num()) + { + unset($aCpu[$cpu]); - continue; - } + continue; + } - if($data['idle'] > 50) - $idle[$core] = $data['idle']; - else - $uses[$core] = 100-$data['idle']; - } + if($data['idle'] > 50) + $idle[$core] = $data['idle']; + else + $uses[$core] = 100-$data['idle']; + } - if(!count($idle)) - return NULL; + if(!count($idle)) + return NULL; - foreach($uses as $use_core => $use) - { - if(!count($idle)) - break; + foreach($uses as $use_core => $use) + { + if(!count($idle)) + break; - $sql->query('SELECT `id`, `uid` FROM `servers` WHERE `unit`="'.$server['unit'].'" AND `game`="'.$game.'" AND `core_use`="'.$use_core.'" AND `status`="working" AND `core_fix`="0" ORDER BY `slots_start` DESC, `online` DESC LIMIT 3'); - if($sql->num() > 1) - { - $server = $sql->get(); + $sql->query('SELECT `id`, `uid` FROM `servers` WHERE `unit`="'.$server['unit'].'" AND `game`="'.$game.'" AND `core_use`="'.$use_core.'" AND `status`="working" AND `core_fix`="0" ORDER BY `slots_start` DESC, `online` DESC LIMIT 3'); + if($sql->num() > 1) + { + $server = $sql->get(); - $core = array_search(max($idle), $idle); + $core = array_search(max($idle), $idle); - $aPid = explode("\n", $ssh->get('ps aux | grep -v grep | grep '.$server['uid'].' | awk \'{print $2}\'')); + $aPid = explode("\n", $ssh->get('ps aux | grep -v grep | grep '.$server['uid'].' | awk \'{print $2}\'')); - if(count($aPid) < 2) - continue; + if(count($aPid) < 2) + continue; - array_pop($aPid); + array_pop($aPid); - $taskset = ''; + $taskset = ''; - foreach($aPid as $pid) - $taskset .= 'taskset -cp '.($core-1).' '.$pid.';'; + foreach($aPid as $pid) + $taskset .= 'taskset -cp '.($core-1).' '.$pid.';'; - $ssh->set($taskset); + $ssh->set($taskset); - unset($idle[$core]); + unset($idle[$core]); - $sql->query('UPDATE `servers` set `core_use`="'.$core.'" WHERE `id`="'.$server['id'].'" LIMIT 1'); - } - } + $sql->query('UPDATE `servers` set `core_use`="'.$core.'" WHERE `id`="'.$server['id'].'" LIMIT 1'); + } + } - return NULL; - } - } + return NULL; + } + } ?> \ No newline at end of file diff --git a/system/library/cron/scan_servers_stop.php b/system/library/cron/scan_servers_stop.php index 89b68c2..1f071f3 100644 --- a/system/library/cron/scan_servers_stop.php +++ b/system/library/cron/scan_servers_stop.php @@ -1,57 +1,57 @@ query('SELECT `address` FROM `units` WHERE `id`="'.$servers[4].'" LIMIT 1'); - if(!$sql->num()) - return NULL; + $sql->query('SELECT `address` FROM `units` WHERE `id`="'.$servers[4].'" LIMIT 1'); + if(!$sql->num()) + return NULL; - $unit = $sql->get(); + $unit = $sql->get(); - $game = $servers[3]; + $game = $servers[3]; - unset($servers[3], $servers[4]); + unset($servers[3], $servers[4]); - $sql->query('SELECT `unit` FROM `servers` WHERE `id`="'.$servers[5].'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `unit` FROM `servers` WHERE `id`="'.$servers[5].'" LIMIT 1'); + $server = $sql->get(); - $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - // Проверка ssh соедниения пу с локацией - if(!$ssh->auth($unit['passwd'], $unit['address'])) - return NULL; + // Проверка ssh соедниения пу с локацией + if(!$ssh->auth($unit['passwd'], $unit['address'])) + return NULL; - $autostop = $start_point-$cfg['autostop']*60; - $teststop = $start_point-$cfg['teststop']*60; + $autostop = $start_point-$cfg['autostop']*60; + $teststop = $start_point-$cfg['teststop']*60; - $sqlq = '(`test`="1" AND `time_start`<"'.$teststop.'" OR `autostop`="1" AND `time_start`<"'.$autostop.'")'; + $sqlq = '(`test`="1" AND `time_start`<"'.$teststop.'" OR `autostop`="1" AND `time_start`<"'.$autostop.'")'; - foreach($servers as $id) - { - $sql->query('SELECT `id` FROM `servers` WHERE `id`="'.$id.'" AND `status`="working" AND `online`="0" AND '.$sqlq.' LIMIT 1'); + foreach($servers as $id) + { + $sql->query('SELECT `id` FROM `servers` WHERE `id`="'.$id.'" AND `status`="working" AND `online`="0" AND '.$sqlq.' LIMIT 1'); - if(!$sql->num()) - continue; + if(!$sql->num()) + continue; - exec('sh -c "cd /var/enginegp; php cron.php '.$cfg['cron_key'].' server_action stop '.$game.' '.$id.'"'); + exec('sh -c "cd /var/enginegp; php cron.php '.$cfg['cron_key'].' server_action stop '.$game.' '.$id.'"'); - $sql->query('INSERT INTO `logs_sys` set `user`="0", `server`="'.$id.'", `text`="Выключение сервера: на сервере нет игроков", `time`="'.$start_point.'"'); - } + $sql->query('INSERT INTO `logs_sys` set `user`="0", `server`="'.$id.'", `text`="Выключение сервера: на сервере нет игроков", `time`="'.$start_point.'"'); + } - return NULL; - } - } + return NULL; + } + } ?> \ No newline at end of file diff --git a/system/library/cron/server_action.php b/system/library/cron/server_action.php index 325aa71..dda1c5e 100644 --- a/system/library/cron/server_action.php +++ b/system/library/cron/server_action.php @@ -1,55 +1,55 @@ get($nmch)) - return NULL; + if($mcache->get($nmch)) + return NULL; - $mcache->set($nmch, true, false, 10); + $mcache->set($nmch, true, false, 10); - if($argv[3] == 'console') - { - global $sql; + if($argv[3] == 'console') + { + global $sql; - $sql->query('SELECT `uid`, `unit` FROM `servers` WHERE `id`="'.$argv[5].'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `uid`, `unit` FROM `servers` WHERE `id`="'.$argv[5].'" LIMIT 1'); + $server = $sql->get(); - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); - // Проверка ssh соедниения пу с локацией - if(!$ssh->auth($unit['passwd'], $unit['address'])) - return NULL; + // Проверка ssh соедниения пу с локацией + if(!$ssh->auth($unit['passwd'], $unit['address'])) + return NULL; - $sql->query('SELECT `commands` FROM `crontab` WHERE `id`="'.$argv[6].'" LIMIT 1'); - $cron = $sql->get(); + $sql->query('SELECT `commands` FROM `crontab` WHERE `id`="'.$argv[6].'" LIMIT 1'); + $cron = $sql->get(); - $aCmd = explode("\n", base64_decode($cron['commands'])); + $aCmd = explode("\n", base64_decode($cron['commands'])); - foreach($aCmd as $cmd) - $ssh->set('sudo -u server'.$server['uid'].' screen -p 0 -S s_'.$server['uid'].' -X eval \'stuff "'.sys::cmd($cmd).'"\015\'; sudo -u server'.$server['uid'].' screen -p 0 -S s_'.$server['uid'].' -X eval \'stuff \015\''); + foreach($aCmd as $cmd) + $ssh->set('sudo -u server'.$server['uid'].' screen -p 0 -S s_'.$server['uid'].' -X eval \'stuff "'.sys::cmd($cmd).'"\015\'; sudo -u server'.$server['uid'].' screen -p 0 -S s_'.$server['uid'].' -X eval \'stuff \015\''); - return NULL; - } + return NULL; + } - include(LIB.'games/'.$argv[4].'/action.php'); + include(LIB.'games/'.$argv[4].'/action.php'); - if($argv[3] == 'restart') - action::start($argv[5], 'restart'); - else - action::$argv[3]($argv[5]); + if($argv[3] == 'restart') + action::start($argv[5], 'restart'); + else + action::$argv[3]($argv[5]); - return NULL; - } - } + return NULL; + } + } ?> \ No newline at end of file diff --git a/system/library/cron/server_cron.php b/system/library/cron/server_cron.php index 5825e83..5b4f77f 100644 --- a/system/library/cron/server_cron.php +++ b/system/library/cron/server_cron.php @@ -1,24 +1,24 @@ query('SELECT `game` FROM `servers` WHERE `id`="'.$argv[3].'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `game` FROM `servers` WHERE `id`="'.$argv[3].'" LIMIT 1'); + $server = $sql->get(); - $sql->query('SELECT `task` FROM `crontab` WHERE `id`="'.$argv[4].'" LIMIT 1'); - $cron = $sql->get(); + $sql->query('SELECT `task` FROM `crontab` WHERE `id`="'.$argv[4].'" LIMIT 1'); + $cron = $sql->get(); - $cmd = $cron['task'] == 'console' ? ' '.$argv[4] : ''; + $cmd = $cron['task'] == 'console' ? ' '.$argv[4] : ''; - exec('sh -c "cd /var/enginegp; php cron.php '.$cfg['cron_key'].' server_action '.$cron['task'].' '.$server['game'].' '.$argv[3].$cmd.'"'); + exec('sh -c "cd /var/enginegp; php cron.php '.$cfg['cron_key'].' server_action '.$cron['task'].' '.$server['game'].' '.$argv[3].$cmd.'"'); - return NULL; - } - } + return NULL; + } + } ?> \ No newline at end of file diff --git a/system/library/cron/server_delete.php b/system/library/cron/server_delete.php index fdac0c4..fb5a47d 100644 --- a/system/library/cron/server_delete.php +++ b/system/library/cron/server_delete.php @@ -1,148 +1,148 @@ query('SELECT `id`, `uid`, `user`, `unit`, `tarif`, `game`, `slots`, `address`, `ddos` FROM `servers` WHERE `id`="'.$argv[3].'" AND `user`="-1" LIMIT 1'); + $sql->query('SELECT `id`, `uid`, `user`, `unit`, `tarif`, `game`, `slots`, `address`, `ddos` FROM `servers` WHERE `id`="'.$argv[3].'" AND `user`="-1" LIMIT 1'); - if(!$sql->num()) - return NULL; + if(!$sql->num()) + return NULL; - $server = $sql->get(); + $server = $sql->get(); - if(!$server['uid']) - return NULL; + if(!$server['uid']) + return NULL; - $sql->query('SELECT `install` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); - $tarif = $sql->get(); + $sql->query('SELECT `install` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); + $tarif = $sql->get(); - $sql->query('SELECT `address`, `passwd`, `sql_login`, `sql_passwd`, `sql_port`, `sql_ftp` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $sql->query('SELECT `address`, `passwd`, `sql_login`, `sql_passwd`, `sql_port`, `sql_ftp` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - // Проверка ssh соединения с локацией - if(!$ssh->auth($unit['passwd'], $unit['address'])) - return NULL; + // Проверка ssh соединения с локацией + if(!$ssh->auth($unit['passwd'], $unit['address'])) + return NULL; - // Убить процессы - $ssh->set('kill -9 `ps aux | grep s_'.$server['uid'].' | grep -v grep | awk '."'{print $2}'".' | xargs;' - .'lsof -i@:'.$server['address'].' | awk '."'{print $2}'".' | xargs`; sudo -u server'.$server['uid'].' screen -wipe'); + // Убить процессы + $ssh->set('kill -9 `ps aux | grep s_'.$server['uid'].' | grep -v grep | awk '."'{print $2}'".' | xargs;' + .'lsof -i@:'.$server['address'].' | awk '."'{print $2}'".' | xargs`; sudo -u server'.$server['uid'].' screen -wipe'); - // Директория игрового сервера - $install = $tarif['install'].$server['uid']; + // Директория игрового сервера + $install = $tarif['install'].$server['uid']; - $copys = 'screen -dmS r_copy_'.$server['uid'].' sh -c "'; + $copys = 'screen -dmS r_copy_'.$server['uid'].' sh -c "'; - $scopy = $sql->query('SELECT `id`, `name` FROM `copy` WHERE `server`="'.$server['id'].'"'); - while($copy = $sql->get($scopy)) - { - $copys .= 'rm /copy/'.$copy['name'].'.tar;'; + $scopy = $sql->query('SELECT `id`, `name` FROM `copy` WHERE `server`="'.$server['id'].'"'); + while($copy = $sql->get($scopy)) + { + $copys .= 'rm /copy/'.$copy['name'].'.tar;'; - $sql->query('DELETE FROM `copy` WHERE `id`="'.$copy['id'].'" LIMIT 1'); - } + $sql->query('DELETE FROM `copy` WHERE `id`="'.$copy['id'].'" LIMIT 1'); + } - $copys .= '";'; + $copys .= '";'; - $ssh->set($copys // Удаление резервных копий - .'screen -dmS r_'.$server['uid'].' sh -c "rm -r '.$install.';' // Удаление директории сервера - .'userdel server'.$server['uid'].'"'); // Удаление пользователя сервера c локации + $ssh->set($copys // Удаление резервных копий + .'screen -dmS r_'.$server['uid'].' sh -c "rm -r '.$install.';' // Удаление директории сервера + .'userdel server'.$server['uid'].'"'); // Удаление пользователя сервера c локации - // Удаление ftp доступа - $qSql = 'DELETE FROM users WHERE username=\''.$server['uid'].'\';' + // Удаление ftp доступа + $qSql = 'DELETE FROM users WHERE username=\''.$server['uid'].'\';' .'DELETE FROM quotalimits WHERE name=\''.$server['uid'].'\';' .'DELETE FROM quotatallies WHERE name=\''.$server['uid'].'\''; $ssh->set('screen -dmS ftp'.$server['uid'].' mysql -P '.$unit['sql_port'].' -u'.$unit['sql_login'].' -p'.$unit['sql_passwd'].' --database '.$unit['sql_ftp'].' -e "'.$qSql.'"'); - include(LIB.'games/games.php'); + include(LIB.'games/games.php'); - // Очистка правил FireWall - games::iptables($server['id'], 'remove', NULL, NULL, NULL, false, $ssh); + // Очистка правил FireWall + games::iptables($server['id'], 'remove', NULL, NULL, NULL, false, $ssh); - // Очистка правил FireWall GEO - if($server['ddos']) - { - $geo = $cfg['iptables'].'_geo'; + // Очистка правил FireWall GEO + if($server['ddos']) + { + $geo = $cfg['iptables'].'_geo'; - $country = $server['ddos'] == 2 ? 'AM,BY,UA,RU,KZ' : 'UA,RU'; + $country = $server['ddos'] == 2 ? 'AM,BY,UA,RU,KZ' : 'UA,RU'; - $ssh->set('iptables -D INPUT -p udp -d '.$ip.' --dport '.$port.' -m geoip ! --source-country '.$country.' -j DROP;' - .'sed "`nl '.$geo.' | grep \"#'.$id.'\" | awk \'{print $1","$1+1}\'`d" '.$geo.' > '.$geo.'_temp; cat '.$geo.'_temp > '.$geo.'; rm '.$geo.'_temp;'); - } + $ssh->set('iptables -D INPUT -p udp -d '.$ip.' --dport '.$port.' -m geoip ! --source-country '.$country.' -j DROP;' + .'sed "`nl '.$geo.' | grep \"#'.$id.'\" | awk \'{print $1","$1+1}\'`d" '.$geo.' > '.$geo.'_temp; cat '.$geo.'_temp > '.$geo.'; rm '.$geo.'_temp;'); + } - // Удаление заданий из crontab - $sql->query('SELECT `address`, `passwd` FROM `panel` LIMIT 1'); - $panel = $sql->get(); + // Удаление заданий из crontab + $sql->query('SELECT `address`, `passwd` FROM `panel` LIMIT 1'); + $panel = $sql->get(); - if(!$ssh->auth($panel['passwd'], $panel['address'])) - return NULL; + if(!$ssh->auth($panel['passwd'], $panel['address'])) + return NULL; - $crons = $sql->query('SELECT `id`, `cron` FROM `crontab` WHERE `server`="'.$server['id'].'"'); - while($cron = $sql->get($crons)) - { - $ssh->set('echo "" >> /etc/crontab && cat /etc/crontab'); - $crontab = str_replace($cron['cron'], '', $ssh->get()); + $crons = $sql->query('SELECT `id`, `cron` FROM `crontab` WHERE `server`="'.$server['id'].'"'); + while($cron = $sql->get($crons)) + { + $ssh->set('echo "" >> /etc/crontab && cat /etc/crontab'); + $crontab = str_replace($cron['cron'], '', $ssh->get()); - // Временный файл - $temp = sys::temp($crontab); + // Временный файл + $temp = sys::temp($crontab); - $ssh->setfile($temp, '/etc/crontab', 0644); + $ssh->setfile($temp, '/etc/crontab', 0644); - $ssh->set("sed -i '/^$/d' /etc/crontab"); - $ssh->set('crontab -u root /etc/crontab'); + $ssh->set("sed -i '/^$/d' /etc/crontab"); + $ssh->set('crontab -u root /etc/crontab'); - unlink($temp); + unlink($temp); - $sql->query('DELETE FROM `crontab` WHERE `id`="'.$cron['id'].'" LIMIT 1'); - } + $sql->query('DELETE FROM `crontab` WHERE `id`="'.$cron['id'].'" LIMIT 1'); + } - // Обновление данных выделенного адреса - $sql->query('SELECT `id`, `aid` FROM `address_buy` WHERE `server`="'.$server['id'].'" LIMIT 1'); - if($sql->num()) - { - $add = $sql->get(); + // Обновление данных выделенного адреса + $sql->query('SELECT `id`, `aid` FROM `address_buy` WHERE `server`="'.$server['id'].'" LIMIT 1'); + if($sql->num()) + { + $add = $sql->get(); - $sql->query('UPDATE `address` set `buy`="0" WHERE `id`="'.$add['aid'].'" LIMIT 1'); - $sql->query('DELETE FROM `address_buy` WHERE `id`="'.$add['id'].'" LIMIT 1'); - } + $sql->query('UPDATE `address` set `buy`="0" WHERE `id`="'.$add['aid'].'" LIMIT 1'); + $sql->query('DELETE FROM `address_buy` WHERE `id`="'.$add['id'].'" LIMIT 1'); + } - include(DATA.'web.php'); + include(DATA.'web.php'); - $sql->query('SELECT `id` FROM `servers` WHERE `id`!="'.$server['id'].'" AND `user`="'.$server['user'].'" AND `unit`="'.$server['unit'].'" LIMIT 1'); - if($sql->num()) - { - $server_sec = $sql->get(); + $sql->query('SELECT `id` FROM `servers` WHERE `id`!="'.$server['id'].'" AND `user`="'.$server['user'].'" AND `unit`="'.$server['unit'].'" LIMIT 1'); + if($sql->num()) + { + $server_sec = $sql->get(); - // Подготовка к удалению доп. услуги или обновление данных - $webs = $sql->query('SELECT `id`, `type` FROM `web` WHERE `server`="'.$server['id'].'"'); - while($web = $sql->get($webs)) - { - if($aWebInstall[$server['game']][$web['type']] == ('unit' || 'user')) - $sql->query('UPDATE `web` set `server`="'.$server_sec['id'].'" WHERE `id`="'.$web['id'].'" LIMIT 1'); - else - $sql->query('UPDATE `web` set `user`="0" WHERE `id`="'.$web['id'].'" LIMIT 1'); - } - }else - $sql->query('UPDATE `web` set `user`="0" WHERE `server`="'.$server['id'].'"'); + // Подготовка к удалению доп. услуги или обновление данных + $webs = $sql->query('SELECT `id`, `type` FROM `web` WHERE `server`="'.$server['id'].'"'); + while($web = $sql->get($webs)) + { + if($aWebInstall[$server['game']][$web['type']] == ('unit' || 'user')) + $sql->query('UPDATE `web` set `server`="'.$server_sec['id'].'" WHERE `id`="'.$web['id'].'" LIMIT 1'); + else + $sql->query('UPDATE `web` set `user`="0" WHERE `id`="'.$web['id'].'" LIMIT 1'); + } + }else + $sql->query('UPDATE `web` set `user`="0" WHERE `server`="'.$server['id'].'"'); - // Удаление различной информации игрового сервера - $sql->query('DELETE FROM `admins_'.$server['game'].'` WHERE `server`="'.$server['id'].'"'); - $sql->query('DELETE FROM `plugins_install` WHERE `server`="'.$server['id'].'"'); - $sql->query('DELETE FROM `owners` WHERE `server`="'.$server['id'].'"'); - $sql->query('DELETE FROM `graph` WHERE `server`="'.$server['id'].'"'); - $sql->query('DELETE FROM `graph_day` WHERE `server`="'.$server['id'].'"'); - $sql->query('DELETE FROM `graph_hour` WHERE `server`="'.$server['id'].'"'); - $sql->query('DELETE FROM `servers` WHERE `id`="'.$server['id'].'" LIMIT 1'); + // Удаление различной информации игрового сервера + $sql->query('DELETE FROM `admins_'.$server['game'].'` WHERE `server`="'.$server['id'].'"'); + $sql->query('DELETE FROM `plugins_install` WHERE `server`="'.$server['id'].'"'); + $sql->query('DELETE FROM `owners` WHERE `server`="'.$server['id'].'"'); + $sql->query('DELETE FROM `graph` WHERE `server`="'.$server['id'].'"'); + $sql->query('DELETE FROM `graph_day` WHERE `server`="'.$server['id'].'"'); + $sql->query('DELETE FROM `graph_hour` WHERE `server`="'.$server['id'].'"'); + $sql->query('DELETE FROM `servers` WHERE `id`="'.$server['id'].'" LIMIT 1'); - $sql->query('INSERT INTO `logs_sys` set `user`="0", `server`="'.$argv[3].'", `text`="Удаление игрового сервера #'.$argv[3].' ('.$server['game'].') unit: #'.$server['unit'].', tarif: #'.$server['tarif'].', slots: #'.$server['slots'].'", `time`="'.$start_point.'"'); + $sql->query('INSERT INTO `logs_sys` set `user`="0", `server`="'.$argv[3].'", `text`="Удаление игрового сервера #'.$argv[3].' ('.$server['game'].') unit: #'.$server['unit'].', tarif: #'.$server['tarif'].', slots: #'.$server['slots'].'", `time`="'.$start_point.'"'); - return NULL; - } - } + return NULL; + } + } ?> \ No newline at end of file diff --git a/system/library/cron/server_scan.php b/system/library/cron/server_scan.php index d00e14c..04e0ce9 100644 --- a/system/library/cron/server_scan.php +++ b/system/library/cron/server_scan.php @@ -1,19 +1,19 @@ \ No newline at end of file diff --git a/system/library/cron/threads.php b/system/library/cron/threads.php index e656b66..8ab696e 100644 --- a/system/library/cron/threads.php +++ b/system/library/cron/threads.php @@ -1,63 +1,63 @@ query('SELECT `id` FROM `units` ORDER BY `id` ASC'); + $aUnit = array(); + $sql->query('SELECT `id` FROM `units` ORDER BY `id` ASC'); - if(!$sql->num()) - return NULL; + if(!$sql->num()) + return NULL; - while($unit = $sql->get()) - $aUnit[$unit['id']] = ''; + while($unit = $sql->get()) + $aUnit[$unit['id']] = ''; - $sql->query('SELECT `id` FROM `servers` LIMIT 1'); + $sql->query('SELECT `id` FROM `servers` LIMIT 1'); - if(!$sql->num()) - return NULL; + if(!$sql->num()) + return NULL; - $sql->query('SELECT `id`, `unit`, `game` FROM `servers` ORDER BY `unit` DESC'); + $sql->query('SELECT `id`, `unit`, `game` FROM `servers` ORDER BY `unit` DESC'); - $all = $sql->num(); + $all = $sql->num(); - while($server = $sql->get()) - $aUnit[$server['unit']][$server['game']] .= $server['id'].' '; + while($server = $sql->get()) + $aUnit[$server['unit']][$server['game']] .= $server['id'].' '; - if($argv[3] == 'scan_servers_route') - cron::$seping = 50; + if($argv[3] == 'scan_servers_route') + cron::$seping = 50; - foreach($aUnit as $unit => $aGame) - { - foreach($aGame as $game => $servers) - { - $aData = explode(' ', $servers); + foreach($aUnit as $unit => $aGame) + { + foreach($aGame as $game => $servers) + { + $aData = explode(' ', $servers); - $num = count($aData)-1; - $sep = $num > 0 ? ceil($num/cron::$seping) : 1; + $num = count($aData)-1; + $sep = $num > 0 ? ceil($num/cron::$seping) : 1; - unset($aData[end($aData)]); + unset($aData[end($aData)]); - $threads[] = cron::thread($sep, $game.' '.$unit, $aData); - } - } + $threads[] = cron::thread($sep, $game.' '.$unit, $aData); + } + } - $cmd = ''; + $cmd = ''; - foreach($threads as $thread) - { - foreach($thread as $screen => $servers) - $cmd .= 'sudo -u www-data screen -dmS scan_'.(sys::first(explode(' ', $servers))).'_'.$screen.' taskset -c '.$cfg['cron_taskset'].' sh -c \"cd /var/enginegp; php cron.php '.$cfg['cron_key'].' '.$argv[3].' '.$servers.'\"; sleep 1;'; - } + foreach($threads as $thread) + { + foreach($thread as $screen => $servers) + $cmd .= 'sudo -u www-data screen -dmS scan_'.(sys::first(explode(' ', $servers))).'_'.$screen.' taskset -c '.$cfg['cron_taskset'].' sh -c \"cd /var/enginegp; php cron.php '.$cfg['cron_key'].' '.$argv[3].' '.$servers.'\"; sleep 1;'; + } - exec('screen -dmS threads_'.date('His', $start_point).' sh -c "'.$cmd.'"'); + exec('screen -dmS threads_'.date('His', $start_point).' sh -c "'.$cmd.'"'); - return NULL; - } - } + return NULL; + } + } ?> \ No newline at end of file diff --git a/system/library/cron/update_address.php b/system/library/cron/update_address.php index 7d8366b..c815957 100644 --- a/system/library/cron/update_address.php +++ b/system/library/cron/update_address.php @@ -1,44 +1,44 @@ query('SELECT `id`, `aid`, `server` FROM `address_buy` WHERE `time`<"'.$start_point.'"'); + $add_buys = $sql->query('SELECT `id`, `aid`, `server` FROM `address_buy` WHERE `time`<"'.$start_point.'"'); - while($add_buy = $sql->get($add_buys)) - { - $sql->query('SELECT `unit`, `port`, `game`, `status` FROM `servers` WHERE `id`="'.$add_buy['server'].'" LIMIT 1'); - if($sql->num()) - { - $server = $sql->get(); + while($add_buy = $sql->get($add_buys)) + { + $sql->query('SELECT `unit`, `port`, `game`, `status` FROM `servers` WHERE `id`="'.$add_buy['server'].'" LIMIT 1'); + if($sql->num()) + { + $server = $sql->get(); - if(!$cfg['buy_address'][$server['game']]) - continue; + if(!$cfg['buy_address'][$server['game']]) + continue; - $sql->query('SELECT `address` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $sql->query('SELECT `address` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); - include(LIB.'games/games.php'); + include(LIB.'games/games.php'); - // Очистка правил FireWall - games::iptables($add_buy['server'], 'remove', NULL, NULL, $server['unit'], false); + // Очистка правил FireWall + games::iptables($add_buy['server'], 'remove', NULL, NULL, $server['unit'], false); - $sql->query('UPDATE `servers` set `address`="'.(sys::first(explode(':', $unit['address']))).':'.$server['port'].'" WHERE `id`="'.$add_buy['server'].'" LIMIT 1'); + $sql->query('UPDATE `servers` set `address`="'.(sys::first(explode(':', $unit['address']))).':'.$server['port'].'" WHERE `id`="'.$add_buy['server'].'" LIMIT 1'); - if(in_array($server['status'], array('working', 'start', 'restart', 'change'))) - exec('sh -c "cd /var/enginegp; php cron.php '.$cfg['cron_key'].' server_action restart '.$server['game'].' '.$add_buy['server'].'"'); - } + if(in_array($server['status'], array('working', 'start', 'restart', 'change'))) + exec('sh -c "cd /var/enginegp; php cron.php '.$cfg['cron_key'].' server_action restart '.$server['game'].' '.$add_buy['server'].'"'); + } - $sql->query('UPDATE `address` set `buy`="0" WHERE `id`="'.$add_buy['aid'].'" LIMIT 1'); - $sql->query('DELETE FROM `address_buy` WHERE `id`="'.$add_buy['id'].'" LIMIT 1'); - } + $sql->query('UPDATE `address` set `buy`="0" WHERE `id`="'.$add_buy['aid'].'" LIMIT 1'); + $sql->query('DELETE FROM `address_buy` WHERE `id`="'.$add_buy['id'].'" LIMIT 1'); + } - return NULL; - } - } + return NULL; + } + } ?> \ No newline at end of file diff --git a/system/library/cron/users_recovery_signup.php b/system/library/cron/users_recovery_signup.php index bc29f13..072a0b8 100644 --- a/system/library/cron/users_recovery_signup.php +++ b/system/library/cron/users_recovery_signup.php @@ -1,19 +1,19 @@ query('DELETE FROM `signup` WHERE `date`<"'.$time.'"'); - $sql->query('DELETE FROM `recovery` WHERE `date`<"'.$time.'"'); + $sql->query('DELETE FROM `signup` WHERE `date`<"'.$time.'"'); + $sql->query('DELETE FROM `recovery` WHERE `date`<"'.$time.'"'); - return NULL; - } - } + return NULL; + } + } ?> \ No newline at end of file diff --git a/system/library/cron/web_delete.php b/system/library/cron/web_delete.php index d2386f9..970582b 100644 --- a/system/library/cron/web_delete.php +++ b/system/library/cron/web_delete.php @@ -1,36 +1,36 @@ query('SELECT `id`, `login`, `type`, `server`, `unit` FROM `web` WHERE `id`="'.$argv[3].'" LIMIT 1'); - $web = $sql->get(); + $sql->query('SELECT `id`, `login`, `type`, `server`, `unit` FROM `web` WHERE `id`="'.$argv[3].'" LIMIT 1'); + $web = $sql->get(); - if($web['type'] == 'hosting') - { - include(DATA.'web.php'); + if($web['type'] == 'hosting') + { + include(DATA.'web.php'); - $result = json_decode(file_get_contents(sys::updtext($aWebUnit['isp']['account']['delete'], array('login' => $web['login']))), true); + $result = json_decode(file_get_contents(sys::updtext($aWebUnit['isp']['account']['delete'], array('login' => $web['login']))), true); - if(!isset($result['result']) || strtolower($result['result']) != 'ok') - continue; + if(!isset($result['result']) || strtolower($result['result']) != 'ok') + continue; - $sql->query('DELETE FROM `web` WHERE `id`="'.$web['id'].'" LIMIT 1'); - } + $sql->query('DELETE FROM `web` WHERE `id`="'.$web['id'].'" LIMIT 1'); + } - include(LIB.'web/free.php'); + include(LIB.'web/free.php'); - $aData = array( - 'type' => $web['type'], - 'server' => array('id' => $web['server'], 'unit' => $web['unit'], 'user' => 0, 'game' => 'system') - ); + $aData = array( + 'type' => $web['type'], + 'server' => array('id' => $web['server'], 'unit' => $web['unit'], 'user' => 0, 'game' => 'system') + ); - web::delete($aData, false); - } - } + web::delete($aData, false); + } + } ?> \ No newline at end of file diff --git a/system/library/ftp.php b/system/library/ftp.php index 2778dac..bb30b6c 100644 --- a/system/library/ftp.php +++ b/system/library/ftp.php @@ -1,516 +1,516 @@ 'Понедельник', - 'Tue' => 'Вторник', - 'Wed' => 'Среда', - 'Thu' => 'Четверг', - 'Fri' => 'Пятница', - 'Sat' => 'Суббота', - 'Sun' => 'Воскресенье' - ); - - var $mounthint = array( - 'Jan' => '01', - 'Feb' => '02', - 'Mar' => '03', - 'Apr' => '04', - 'May' => '05', - 'Jun' => '06', - 'Jul' => '07', - 'Aug' => '08', - 'Sep' => '09', - 'Oct' => '10', - 'Nov' => '11', - 'Dec' => '12' - ); - - var $mounthru = array( - 'Jan' => 'Янв', - 'Feb' => 'Фев', - 'Mar' => 'Мар', - 'Apr' => 'Апр', - 'May' => 'Май', - 'Jun' => 'Июн', - 'Jul' => 'Июл', - 'Aug' => 'Авг', - 'Sep' => 'Сен', - 'Oct' => 'Окт', - 'Nov' => 'Ноя', - 'Dec' => 'Дек' - ); - - var $aEdits = array( - 'txt', - 'cfg', - 'conf', - 'json', - 'xml', - 'ini', - 'gam', - 'php', - 'html', - 'inf', - 'js', - 'css', - 'sma', - 'log' - ); - - public function auth($host, $user, $password, $port = 21) - { - $ftp_connect = @ftp_connect($host, $port); - - if(!$ftp_connect) - return false; - - if(!@ftp_login($ftp_connect, $user, $password)) - return false; - - @ftp_pasv($ftp_connect, true); - - $this->steck = $ftp_connect; - - return true; - } - - public function read($path) - { - $path = ($path == '') ? '/' : $path; - - $path = str_replace('//', '/', $path); - - $aDir = array(); - $aFile = array(); - $aInfo = array(); - - $rawlist = array(); - - $data = ftp_rawlist($this->steck, $path); - - if(is_array($data)) - foreach($data as $index) - { - $vinfo = preg_split('/[\s]+/', $index, 9); - - if($vinfo[0] !== 'total') - { - $aInfo['chmod'] = $vinfo[0]; - $aInfo['num'] = $vinfo[1]; - $aInfo['owner'] = $vinfo[2]; - $aInfo['group'] = $vinfo[3]; - $aInfo['size'] = $vinfo[4]; - $aInfo['month'] = $vinfo[5]; - $aInfo['day'] = $vinfo[6]; - $aInfo['time'] = $vinfo[7]; - $aInfo['name'] = $vinfo[8]; - - $rawlist[$aInfo['name']] = $aInfo; - } - } - - foreach($rawlist as $name => $data) - { - if($data['chmod']{0} == 'd') - $aDir[$name] = $data; - - elseif($data['chmod']{0} == '-') - $aFile[$name] = $data; - } - - $aData = array( - 'folder' => $aDir, - 'file' => $aFile, - 'path' => $path - ); - - return $aData; - } - - public function view($view, $server) - { - global $html; - - if($view['path'] != '/') - { - $html->get('filetp_back', 'sections/servers/games/filetp'); - - $html->set('back', $this->path($view['path'])); - - $html->pack('list'); - } + exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404')); + + class ftp + { + var $steck = false; + + var $dayru = array( + 'Mon' => 'Понедельник', + 'Tue' => 'Вторник', + 'Wed' => 'Среда', + 'Thu' => 'Четверг', + 'Fri' => 'Пятница', + 'Sat' => 'Суббота', + 'Sun' => 'Воскресенье' + ); + + var $mounthint = array( + 'Jan' => '01', + 'Feb' => '02', + 'Mar' => '03', + 'Apr' => '04', + 'May' => '05', + 'Jun' => '06', + 'Jul' => '07', + 'Aug' => '08', + 'Sep' => '09', + 'Oct' => '10', + 'Nov' => '11', + 'Dec' => '12' + ); + + var $mounthru = array( + 'Jan' => 'Янв', + 'Feb' => 'Фев', + 'Mar' => 'Мар', + 'Apr' => 'Апр', + 'May' => 'Май', + 'Jun' => 'Июн', + 'Jul' => 'Июл', + 'Aug' => 'Авг', + 'Sep' => 'Сен', + 'Oct' => 'Окт', + 'Nov' => 'Ноя', + 'Dec' => 'Дек' + ); + + var $aEdits = array( + 'txt', + 'cfg', + 'conf', + 'json', + 'xml', + 'ini', + 'gam', + 'php', + 'html', + 'inf', + 'js', + 'css', + 'sma', + 'log' + ); + + public function auth($host, $user, $password, $port = 21) + { + $ftp_connect = @ftp_connect($host, $port); + + if(!$ftp_connect) + return false; + + if(!@ftp_login($ftp_connect, $user, $password)) + return false; + + @ftp_pasv($ftp_connect, true); + + $this->steck = $ftp_connect; + + return true; + } + + public function read($path) + { + $path = ($path == '') ? '/' : $path; + + $path = str_replace('//', '/', $path); + + $aDir = array(); + $aFile = array(); + $aInfo = array(); + + $rawlist = array(); + + $data = ftp_rawlist($this->steck, $path); + + if(is_array($data)) + foreach($data as $index) + { + $vinfo = preg_split('/[\s]+/', $index, 9); + + if($vinfo[0] !== 'total') + { + $aInfo['chmod'] = $vinfo[0]; + $aInfo['num'] = $vinfo[1]; + $aInfo['owner'] = $vinfo[2]; + $aInfo['group'] = $vinfo[3]; + $aInfo['size'] = $vinfo[4]; + $aInfo['month'] = $vinfo[5]; + $aInfo['day'] = $vinfo[6]; + $aInfo['time'] = $vinfo[7]; + $aInfo['name'] = $vinfo[8]; + + $rawlist[$aInfo['name']] = $aInfo; + } + } + + foreach($rawlist as $name => $data) + { + if($data['chmod']{0} == 'd') + $aDir[$name] = $data; + + elseif($data['chmod']{0} == '-') + $aFile[$name] = $data; + } + + $aData = array( + 'folder' => $aDir, + 'file' => $aFile, + 'path' => $path + ); + + return $aData; + } + + public function view($view, $server) + { + global $html; + + if($view['path'] != '/') + { + $html->get('filetp_back', 'sections/servers/games/filetp'); + + $html->set('back', $this->path($view['path'])); + + $html->pack('list'); + } - foreach($view as $type => $aVal) - { - if(!is_array($aVal)) - continue; + foreach($view as $type => $aVal) + { + if(!is_array($aVal)) + continue; - foreach($aVal as $name => $info) - { - $html->get('filetp_list', 'sections/servers/games/filetp'); + foreach($aVal as $name => $info) + { + $html->get('filetp_list', 'sections/servers/games/filetp'); - $html->set('id', $server); - $html->set('name', $name); + $html->set('id', $server); + $html->set('name', $name); - $path = $view['path']; + $path = $view['path']; - if($path{0} != '/') $path = '/'.$path; + if($path{0} != '/') $path = '/'.$path; - if($path != '/') $path = $path.'/'; + if($path != '/') $path = $path.'/'; - $html->set('path', $path); - $html->set('chmod', $this->cti($info['chmod']).' '.$info['chmod']); - $html->set('owner', $info['owner']); - $html->set('group', $info['group']); + $html->set('path', $path); + $html->set('chmod', $this->cti($info['chmod']).' '.$info['chmod']); + $html->set('owner', $info['owner']); + $html->set('group', $info['group']); - if($type == 'folder') - { - $html->unit('folder', 1); - $html->unit('file'); - $html->set('size', ''); - }else{ - $type = explode('.', $name); + if($type == 'folder') + { + $html->unit('folder', 1); + $html->unit('file'); + $html->set('size', ''); + }else{ + $type = explode('.', $name); - if(in_array(end($type), $this->aEdits)) - $html->unit('edit', 1); - else - $html->unit('edit'); + if(in_array(end($type), $this->aEdits)) + $html->unit('edit', 1); + else + $html->unit('edit'); - $html->unit('file', 1); - $html->unit('folder'); - $html->set('size', sys::size($info['size'])); - } + $html->unit('file', 1); + $html->unit('folder'); + $html->set('size', sys::size($info['size'])); + } - $html->set('month', $this->mounthru[$info['month']]); - $html->set('day', $info['day']); - $html->set('time', $info['time']); + $html->set('month', $this->mounthru[$info['month']]); + $html->set('day', $info['day']); + $html->set('time', $info['time']); - $html->pack('list'); - } - } + $html->pack('list'); + } + } - return isset($html->arr['list']) ? $html->arr['list'] : ''; - } + return isset($html->arr['list']) ? $html->arr['list'] : ''; + } - public function mkdir($path, $folders) - { - if(!@ftp_chdir($this->steck, $path)) - sys::outjs(array('e' => 'Ошибка: не удалось создать папку')); + public function mkdir($path, $folders) + { + if(!@ftp_chdir($this->steck, $path)) + sys::outjs(array('e' => 'Ошибка: не удалось создать папку')); - $aFolder = explode('/', $folders); + $aFolder = explode('/', $folders); - foreach($aFolder as $folder) - { - if($folder == '') - continue; + foreach($aFolder as $folder) + { + if($folder == '') + continue; - if(!@ftp_chdir($this->steck, $folder)) - { - if(!@ftp_mkdir($this->steck, $folder)) - sys::outjs(array('e' => 'Ошибка: не удалось создать папку '.$folder)); + if(!@ftp_chdir($this->steck, $folder)) + { + if(!@ftp_mkdir($this->steck, $folder)) + sys::outjs(array('e' => 'Ошибка: не удалось создать папку '.$folder)); - @ftp_chdir($this->steck, $folder); - } - } + @ftp_chdir($this->steck, $folder); + } + } - sys::outjs(array('s' => 'ok')); - } + sys::outjs(array('s' => 'ok')); + } - public function touch($path, $file, $text) - { - $aData = explode('/', $file); + public function touch($path, $file, $text) + { + $aData = explode('/', $file); - $path_file = ''; + $path_file = ''; - if(count($aData)) - { - $file = end($aData); + if(count($aData)) + { + $file = end($aData); - unset($aData[count($aData)-1]); + unset($aData[count($aData)-1]); - foreach($aData as $val) - $path_file .= $val.'/'; - } + foreach($aData as $val) + $path_file .= $val.'/'; + } - $dir = str_replace('//', '', $path.'/'.$path_file); + $dir = str_replace('//', '', $path.'/'.$path_file); - $dir = ($dir == '') ? '/' : $dir; + $dir = ($dir == '') ? '/' : $dir; - if(!@ftp_chdir($this->steck, $dir)) - sys::outjs(array('e' => 'Ошибка: не удалось создать файл')); + if(!@ftp_chdir($this->steck, $dir)) + sys::outjs(array('e' => 'Ошибка: не удалось создать файл')); - $temp = sys::temp($text); + $temp = sys::temp($text); - if(@ftp_put($this->steck, $file, $temp, FTP_BINARY)) - { - unlink($temp); + if(@ftp_put($this->steck, $file, $temp, FTP_BINARY)) + { + unlink($temp); - sys::outjs(array('s' => 'ok')); - } + sys::outjs(array('s' => 'ok')); + } - unlink($temp); + unlink($temp); - sys::outjs(array('e' => 'Ошибка: не удалось создать файл')); - } + sys::outjs(array('e' => 'Ошибка: не удалось создать файл')); + } - public function edit_file($path, $file) - { - $name = md5(time().$file.'ftp'); + public function edit_file($path, $file) + { + $name = md5(time().$file.'ftp'); - if(@ftp_get($this->steck, TEMP.$name, $path.'/'.$file, FTP_BINARY)) - { - $data = file_get_contents(TEMP.$name); + if(@ftp_get($this->steck, TEMP.$name, $path.'/'.$file, FTP_BINARY)) + { + $data = file_get_contents(TEMP.$name); - unlink(TEMP.$name); + unlink(TEMP.$name); - sys::outjs(array('s' => $data)); - } + sys::outjs(array('s' => $data)); + } - sys::outjs(array('e' => 'Не удалось открыть файл')); - } + sys::outjs(array('e' => 'Не удалось открыть файл')); + } - public function rename($path, $oldname, $newname) - { - if(@ftp_rename($this->steck, $path.'/'.$oldname, $path.'/'.$newname)) - sys::outjs(array('s' => 'ok')); + public function rename($path, $oldname, $newname) + { + if(@ftp_rename($this->steck, $path.'/'.$oldname, $path.'/'.$newname)) + sys::outjs(array('s' => 'ok')); - sys::outjs(array('e' => 'Не удалось сменить имя')); - } + sys::outjs(array('e' => 'Не удалось сменить имя')); + } - public function rmdir($path, $folder) - { - if(@ftp_rmdir($this->steck, $path.'/'.$folder)) - sys::outjs(array('s' => 'ok')); + public function rmdir($path, $folder) + { + if(@ftp_rmdir($this->steck, $path.'/'.$folder)) + sys::outjs(array('s' => 'ok')); - sys::outjs(array('e' => 'Ошибка: не удалось удалить папку.')); - } + sys::outjs(array('e' => 'Ошибка: не удалось удалить папку.')); + } - public function rmfile($file) - { - if(@ftp_delete($this->steck, $file)) - sys::outjs(array('s' => 'ok')); + public function rmfile($file) + { + if(@ftp_delete($this->steck, $file)) + sys::outjs(array('s' => 'ok')); - sys::outjs(array('e' => 'Ошибка: не удалось удалить файл')); - } + sys::outjs(array('e' => 'Ошибка: не удалось удалить файл')); + } - public function chmod($path, $name, $chmod) - { - if(ftp_site($this->steck, 'CHMOD 0'.$chmod.' '.$path.'/'.$name)) - sys::outjs(array('s' => 'ok')); + public function chmod($path, $name, $chmod) + { + if(ftp_site($this->steck, 'CHMOD 0'.$chmod.' '.$path.'/'.$name)) + sys::outjs(array('s' => 'ok')); - sys::outjs(array('e' => 'Ошибка: не удалось изменить права.')); - } + sys::outjs(array('e' => 'Ошибка: не удалось изменить права.')); + } - public function search($str, $server) - { - global $html, $mcache; + public function search($str, $server) + { + global $html, $mcache; - $nmch = md5($str.$server); + $nmch = md5($str.$server); - $cache = $mcache->get($nmch); + $cache = $mcache->get($nmch); - if(!is_array($cache)) - { - $aData = ftp_rawlist($this->steck, '/', true); + if(!is_array($cache)) + { + $aData = ftp_rawlist($this->steck, '/', true); - if(!is_array($aData)) - sys::out('Ничего не найдено'); + if(!is_array($aData)) + sys::out('Ничего не найдено'); - // Файлы - $aFile = array(); + // Файлы + $aFile = array(); - // Файлы в корне - $end = array_search('', $aData); + // Файлы в корне + $end = array_search('', $aData); - for($i = 0; $i < $end; $i+=1) - { - $aInfo = preg_split('/[\s]+/', $aData[$i], 9); + for($i = 0; $i < $end; $i+=1) + { + $aInfo = preg_split('/[\s]+/', $aData[$i], 9); - $info = ''; + $info = ''; - for($n = 0; $n < 8; $n+=1) - $info .= $aInfo[$n].' '; + for($n = 0; $n < 8; $n+=1) + $info .= $aInfo[$n].' '; - $aFile['/'][] = array('info' => $info, 'name' => $aInfo[8]); - } + $aFile['/'][] = array('info' => $info, 'name' => $aInfo[8]); + } - // Перебор директорий и файлов в них - foreach($aData as $index) - { - $begin = array_search('', $aData); - unset($aData[$begin]); + // Перебор директорий и файлов в них + foreach($aData as $index) + { + $begin = array_search('', $aData); + unset($aData[$begin]); - $end = array_search('', $aData); + $end = array_search('', $aData); - if(!$begin) - break; + if(!$begin) + break; - $dir = substr($aData[$begin+1], 0, -1); + $dir = substr($aData[$begin+1], 0, -1); - for($i = $begin+2; $i < $end; $i+=1) - { - $aInfo = preg_split('/[\s]+/', $aData[$i], 9); + for($i = $begin+2; $i < $end; $i+=1) + { + $aInfo = preg_split('/[\s]+/', $aData[$i], 9); - $info = ''; + $info = ''; - for($n = 0; $n < 8; $n+=1) - $info .= $aInfo[$n].' '; + for($n = 0; $n < 8; $n+=1) + $info .= $aInfo[$n].' '; - $aFile[$dir][] = array('info' => $info, 'name' => $aInfo[8]); - } - } + $aFile[$dir][] = array('info' => $info, 'name' => $aInfo[8]); + } + } - $mcache->set($nmch, $aFile, false, 20); - }else - $aFile = $cache; + $mcache->set($nmch, $aFile, false, 20); + }else + $aFile = $cache; - $aFind = array(); + $aFind = array(); - // Поиск - foreach($aFile as $dir => $files) - { - foreach($files as $file) - { - $find = sys::first(explode('.', $file['name'])); + // Поиск + foreach($aFile as $dir => $files) + { + foreach($files as $file) + { + $find = sys::first(explode('.', $file['name'])); - if(preg_match('/'.$str.'/i', $find)) - $aFind[] = array('dir' => $dir, 'info' => $file['info'], 'file' => $file['name'], 'find' => sys::find($file['name'], $str)); - } - } + if(preg_match('/'.$str.'/i', $find)) + $aFind[] = array('dir' => $dir, 'info' => $file['info'], 'file' => $file['name'], 'find' => sys::find($file['name'], $str)); + } + } - unset($aFile); + unset($aFile); - foreach($aFind as $data) - { - $info = preg_split('/[\s]+/', trim($data['info']), 8); + foreach($aFind as $data) + { + $info = preg_split('/[\s]+/', trim($data['info']), 8); - $html->get('filetp_find', 'sections/servers/games/filetp'); + $html->get('filetp_find', 'sections/servers/games/filetp'); - $html->set('id', $server); - $html->set('find', $data['find']); - $html->set('name', $data['file']); + $html->set('id', $server); + $html->set('find', $data['find']); + $html->set('name', $data['file']); - $path = $data['dir']; + $path = $data['dir']; - if($path{0} != '/') $path = '/'.$path; + if($path{0} != '/') $path = '/'.$path; - if($path != '/') $path = $path.'/'; + if($path != '/') $path = $path.'/'; - $html->set('path', $path); - $html->set('chmod', $this->cti($info[0]).' '.$info[0]); - $html->set('owner', $info[2]); - $html->set('group', $info[3]); + $html->set('path', $path); + $html->set('chmod', $this->cti($info[0]).' '.$info[0]); + $html->set('owner', $info[2]); + $html->set('group', $info[3]); - if($info[0]{0} == 'd') - { - $html->unit('folder', 1); - $html->unit('file'); - $html->set('size', ''); - }else{ - $type = explode('.', $data['file']); + if($info[0]{0} == 'd') + { + $html->unit('folder', 1); + $html->unit('file'); + $html->set('size', ''); + }else{ + $type = explode('.', $data['file']); - if(in_array(end($type), $this->aEdits)) - $html->unit('edit', 1); - else - $html->unit('edit'); + if(in_array(end($type), $this->aEdits)) + $html->unit('edit', 1); + else + $html->unit('edit'); - $html->unit('file', 1); - $html->unit('folder'); - $html->set('size', sys::size($info[4])); - } + $html->unit('file', 1); + $html->unit('folder'); + $html->set('size', sys::size($info[4])); + } - $html->set('month', $this->mounthru[$info[5]]); - $html->set('day', $info[6]); - $html->set('time', $info[7]); + $html->set('month', $this->mounthru[$info[5]]); + $html->set('day', $info[6]); + $html->set('time', $info[7]); - $html->pack('list'); - } + $html->pack('list'); + } - if(isset($html->arr['list'])) - sys::out($html->arr['list']); + if(isset($html->arr['list'])) + sys::out($html->arr['list']); - sys::out('Ничего не найдено'); - } + sys::out('Ничего не найдено'); + } - public function logs($data, $uid) - { - global $html; + public function logs($data, $uid) + { + global $html; - $aLine = explode("\n", $data); + $aLine = explode("\n", $data); - $actions = array('i' => 'загрузка', 'o' => 'скачивание', 'd' => 'удаление'); - $acticon = array('i' => '', 'o' => '', 'd' => ''); + $actions = array('i' => 'загрузка', 'o' => 'скачивание', 'd' => 'удаление'); + $acticon = array('i' => '', 'o' => '', 'd' => ''); - unset($aLine[count($aLine)-1]); + unset($aLine[count($aLine)-1]); - rsort($aLine); + rsort($aLine); - foreach($aLine as $line) - { - $aData = explode('\\', $line); + foreach($aLine as $line) + { + $aData = explode('\\', $line); - $html->get('filetp_logs', 'sections/servers/games/filetp'); + $html->get('filetp_logs', 'sections/servers/games/filetp'); - $html->set('month', $this->mounthint[$aData[0]]); - $html->set('day', $aData[1]); - $html->set('time', $aData[2]); - $html->set('year', $aData[3]); - $html->set('who', $this->who($aData[4])); - $html->set('size', sys::size($aData[5])); - $html->set('file', str_replace('/servers/'.$uid.'/', '', $aData[6])); - $html->set('action', $actions[$aData[7]]); - $html->set('acticon', $acticon[$aData[7]]); + $html->set('month', $this->mounthint[$aData[0]]); + $html->set('day', $aData[1]); + $html->set('time', $aData[2]); + $html->set('year', $aData[3]); + $html->set('who', $this->who($aData[4])); + $html->set('size', sys::size($aData[5])); + $html->set('file', str_replace('/servers/'.$uid.'/', '', $aData[6])); + $html->set('action', $actions[$aData[7]]); + $html->set('acticon', $acticon[$aData[7]]); - $html->pack('logs'); - } + $html->pack('logs'); + } - return isset($html->arr['logs']) ? $html->arr['logs'] : 'Список логов отсутствует'; - } + return isset($html->arr['logs']) ? $html->arr['logs'] : 'Список логов отсутствует'; + } - private function path($path) - { - $path = str_replace('//', '/', $path); + private function path($path) + { + $path = str_replace('//', '/', $path); - $path = explode('/', $path); + $path = explode('/', $path); - unset($path[count($path)-1]); + unset($path[count($path)-1]); - $newpath = '/'; + $newpath = '/'; - foreach($path as $index => $val) - if(count($path)-1 == $index) $newpath .= $val; else $newpath .= $val.'/'; + foreach($path as $index => $val) + if(count($path)-1 == $index) $newpath .= $val; else $newpath .= $val.'/'; - return str_replace('//', '/', $newpath); - } + return str_replace('//', '/', $newpath); + } - private function cti($chmod) - { - $intchmod = array('-' => '0', 'r' => '4', 'w' => '2', 'x' => '1'); + private function cti($chmod) + { + $intchmod = array('-' => '0', 'r' => '4', 'w' => '2', 'x' => '1'); - $chmod = substr(strtr($chmod, $intchmod), 1); + $chmod = substr(strtr($chmod, $intchmod), 1); - $split = str_split($chmod, 3); + $split = str_split($chmod, 3); - return array_sum(str_split($split[0])).array_sum(str_split($split[1])).array_sum(str_split($split[2])); - } + return array_sum(str_split($split[0])).array_sum(str_split($split[1])).array_sum(str_split($split[2])); + } - private function who($address) - { - global $cfg, $uip; + private function who($address) + { + global $cfg, $uip; - if($address == $cfg['ip']) - return 'панель управления'; + if($address == $cfg['ip']) + return 'панель управления'; - if($address == $uip) - return 'вы'; + if($address == $uip) + return 'вы'; - return $address; - } - } + return $address; + } + } ?> \ No newline at end of file diff --git a/system/library/games/actions.php b/system/library/games/actions.php index aa1a7b8..7a4537d 100644 --- a/system/library/games/actions.php +++ b/system/library/games/actions.php @@ -1,316 +1,316 @@ query('SELECT `uid`, `unit`, `game`, `address`, `name` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `uid`, `unit`, `game`, `address`, `name` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); - // Проверка ssh соедниения пу с локацией - if(!$ssh->auth($unit['passwd'], $unit['address'])) - return array('e' => sys::text('error', 'ssh')); + // Проверка ssh соедниения пу с локацией + if(!$ssh->auth($unit['passwd'], $unit['address'])) + return array('e' => sys::text('error', 'ssh')); - $ssh->set('kill -9 `ps aux | grep s_'.$server['uid'].' | grep -v grep | awk '."'{print $2}'".' | xargs;' - .'lsof -i@'.$server['address'].' | awk '."'{print $2}'".' | grep -v PID | xargs`; sudo -u server'.$server['uid'].' screen -wipe'); + $ssh->set('kill -9 `ps aux | grep s_'.$server['uid'].' | grep -v grep | awk '."'{print $2}'".' | xargs;' + .'lsof -i@'.$server['address'].' | awk '."'{print $2}'".' | grep -v PID | xargs`; sudo -u server'.$server['uid'].' screen -wipe'); - // Обновление информации в базе - $sql->query('UPDATE `servers` set `status`="off", `online`="0", `players`="", `stop`="0" WHERE `id`="'.$id.'" LIMIT 1'); + // Обновление информации в базе + $sql->query('UPDATE `servers` set `status`="off", `online`="0", `players`="", `stop`="0" WHERE `id`="'.$id.'" LIMIT 1'); - // Сброс кеша - actions::clmcache($id); + // Сброс кеша + actions::clmcache($id); - sys::reset_mcache('server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'off', 'online' => 0, 'players' => '')); - sys::reset_mcache('server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'off', 'online' => 0)); + sys::reset_mcache('server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'off', 'online' => 0, 'players' => '')); + sys::reset_mcache('server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'off', 'online' => 0)); - return array('s' => 'ok'); - } + return array('s' => 'ok'); + } - public static function change($id, $map = false) - { - global $cfg, $sql, $html, $user, $mcache; + public static function change($id, $map = false) + { + global $cfg, $sql, $html, $user, $mcache; - // Если в кеше есть карты - if($mcache->get('server_maps_change_'.$id) != '' && !$map) - return array('maps' => $mcache->get('server_maps_change_'.$id)); + // Если в кеше есть карты + if($mcache->get('server_maps_change_'.$id) != '' && !$map) + return array('maps' => $mcache->get('server_maps_change_'.$id)); - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - $sql->query('SELECT `uid`, `unit`, `game`, `tarif`, `online`, `players`, `name` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `uid`, `unit`, `game`, `tarif`, `online`, `players`, `name` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); - $sql->query('SELECT `install` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); - $tarif = $sql->get(); + $sql->query('SELECT `install` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); + $tarif = $sql->get(); - // Проверка ssh соедниения пу с локацией - if(!$ssh->auth($unit['passwd'], $unit['address'])) - return array('e' => sys::text('error', 'ssh')); + // Проверка ssh соедниения пу с локацией + if(!$ssh->auth($unit['passwd'], $unit['address'])) + return array('e' => sys::text('error', 'ssh')); - // Массив карт игрового сервера (папка "maps") - $aMaps = explode("\n", $ssh->get('cd '.$tarif['install'].$server['uid'].'/cstrike/maps/ && ls | grep .bsp | grep -v .bsp.')); + // Массив карт игрового сервера (папка "maps") + $aMaps = explode("\n", $ssh->get('cd '.$tarif['install'].$server['uid'].'/cstrike/maps/ && ls | grep .bsp | grep -v .bsp.')); - // Удаление пустого элемента - unset($aMaps[count($aMaps)-1]); + // Удаление пустого элемента + unset($aMaps[count($aMaps)-1]); - // Удаление ".bsp" - $aMaps = str_replace('.bsp', '', $aMaps); + // Удаление ".bsp" + $aMaps = str_replace('.bsp', '', $aMaps); - // Если выбрана карта - if($map) - { - // Проверка наличия выбранной карты - if(!in_array($map, $aMaps)) - return array('e' => sys::updtext(sys::text('servers', 'change'), array('map' => $map.'.bsp'))); + // Если выбрана карта + if($map) + { + // Проверка наличия выбранной карты + if(!in_array($map, $aMaps)) + return array('e' => sys::updtext(sys::text('servers', 'change'), array('map' => $map.'.bsp'))); - // Отправка команды changelevel - $ssh->set('sudo -u server'.$server['uid'].' screen -p 0 -S s_'.$server['uid'].' -X eval '."'stuff \"changelevel ".sys::cmd($map)."\"\015'"); + // Отправка команды changelevel + $ssh->set('sudo -u server'.$server['uid'].' screen -p 0 -S s_'.$server['uid'].' -X eval '."'stuff \"changelevel ".sys::cmd($map)."\"\015'"); - // Обновление информации в базе - $sql->query('UPDATE `servers` set `status`="change" WHERE `id`="'.$id.'" LIMIT 1'); + // Обновление информации в базе + $sql->query('UPDATE `servers` set `status`="change" WHERE `id`="'.$id.'" LIMIT 1'); - // Сброс кеша - actions::clmcache($id); + // Сброс кеша + actions::clmcache($id); - sys::reset_mcache('server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'change', 'online' => $server['online'], 'players' => base64_decode($server['players']))); - sys::reset_mcache('server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'change', 'online' => $server['online'])); + sys::reset_mcache('server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'change', 'online' => $server['online'], 'players' => base64_decode($server['players']))); + sys::reset_mcache('server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'change', 'online' => $server['online'])); - return array('s' => 'ok'); - } + return array('s' => 'ok'); + } - // Сортировка списка карт - sort($aMaps); - reset($aMaps); + // Сортировка списка карт + sort($aMaps); + reset($aMaps); - // Генерация списка карт для выбора - foreach($aMaps as $map) - { - $html->get('change_list', 'sections/servers/games'); - $html->set('img', sys::img($map, $server['game'])); - $html->set('name', $map); - $html->set('id', $id); - $html->pack('maps'); - } + // Генерация списка карт для выбора + foreach($aMaps as $map) + { + $html->get('change_list', 'sections/servers/games'); + $html->set('img', sys::img($map, $server['game'])); + $html->set('name', $map); + $html->set('id', $id); + $html->pack('maps'); + } - // Запись карт в кеш - $mcache->set('server_maps_change_'.$id, $html->arr['maps'], false, 30); + // Запись карт в кеш + $mcache->set('server_maps_change_'.$id, $html->arr['maps'], false, 30); - return array('maps' => $html->arr['maps']); - } + return array('maps' => $html->arr['maps']); + } - public static function reinstall($id) - { - global $cfg, $sql, $user, $start_point; + public static function reinstall($id) + { + global $cfg, $sql, $user, $start_point; - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - $sql->query('SELECT `uid`, `unit`, `tarif`, `address`, `game`, `name`, `pack`, `plugins_use`, `ftp`, `reinstall`, `core_fix` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `uid`, `unit`, `tarif`, `address`, `game`, `name`, `pack`, `plugins_use`, `ftp`, `reinstall`, `core_fix` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - // Проверка времени переустановки - $reinstall = $server['reinstall']+$cfg['reinstall'][$server['game']]*60; + // Проверка времени переустановки + $reinstall = $server['reinstall']+$cfg['reinstall'][$server['game']]*60; - if($reinstall > $start_point && $user['group'] != 'admin') - return array('e' => sys::updtext(sys::text('servers', 'reinstall'), array('time' => sys::date('max', $reinstall)))); + if($reinstall > $start_point && $user['group'] != 'admin') + return array('e' => sys::updtext(sys::text('servers', 'reinstall'), array('time' => sys::date('max', $reinstall)))); - $sql->query('SELECT `address`, `passwd`, `sql_login`, `sql_passwd`, `sql_port`, `sql_ftp` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $sql->query('SELECT `address`, `passwd`, `sql_login`, `sql_passwd`, `sql_port`, `sql_ftp` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); - $sql->query('SELECT `path`, `install`, `plugins_install` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); - $tarif = $sql->get(); + $sql->query('SELECT `path`, `install`, `plugins_install` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); + $tarif = $sql->get(); - // Проверка ssh соедниения пу с локацией - if(!$ssh->auth($unit['passwd'], $unit['address'])) - return array('e' => sys::text('error', 'ssh')); + // Проверка ssh соедниения пу с локацией + if(!$ssh->auth($unit['passwd'], $unit['address'])) + return array('e' => sys::text('error', 'ssh')); - $ssh->set('kill -9 `ps aux | grep s_'.$server['uid'].' | grep -v grep | awk '."'{print $2}'".' | xargs;' - .'lsof -i@'.$server['address'].' | awk '."'{print $2}'".' | grep -v PID | xargs`; sudo -u server'.$server['uid'].' screen -wipe'); + $ssh->set('kill -9 `ps aux | grep s_'.$server['uid'].' | grep -v grep | awk '."'{print $2}'".' | xargs;' + .'lsof -i@'.$server['address'].' | awk '."'{print $2}'".' | grep -v PID | xargs`; sudo -u server'.$server['uid'].' screen -wipe'); - $taskset = ''; + $taskset = ''; - // Если включена система автораспределения и не установлен фиксированный поток - if($cfg['cpu_route'] && !$server['core_fix']) - { - $proc_stat = array(); + // Если включена система автораспределения и не установлен фиксированный поток + if($cfg['cpu_route'] && !$server['core_fix']) + { + $proc_stat = array(); - $proc_stat[0] = $ssh->get('cat /proc/stat'); - } + $proc_stat[0] = $ssh->get('cat /proc/stat'); + } - // Директория сборки - $path = $tarif['path'].$server['pack']; + // Директория сборки + $path = $tarif['path'].$server['pack']; - // Директория игрового сервера - $install = $tarif['install'].$server['uid']; + // Директория игрового сервера + $install = $tarif['install'].$server['uid']; - // Если система автораспределения продолжить парсинг загрузки процессора - if(isset($proc_stat)) - { - $proc_stat[1] = $ssh->get('cat /proc/stat'); + // Если система автораспределения продолжить парсинг загрузки процессора + if(isset($proc_stat)) + { + $proc_stat[1] = $ssh->get('cat /proc/stat'); - // Ядро/поток, на котором будет запущен игровой сервер (поток выбран с рассчетом наименьшей загруженности в момент запуска игрового сервера) - $core = sys::cpu_idle($proc_stat, $server['unit'], false); // число от 1 до n (где n число ядер/потоков в процессоре (без нулевого) + // Ядро/поток, на котором будет запущен игровой сервер (поток выбран с рассчетом наименьшей загруженности в момент запуска игрового сервера) + $core = sys::cpu_idle($proc_stat, $server['unit'], false); // число от 1 до n (где n число ядер/потоков в процессоре (без нулевого) - if(!is_numeric($core)) - return array('e' => 'Не удается выполнить операцию, нет свободного потока.'); + if(!is_numeric($core)) + return array('e' => 'Не удается выполнить операцию, нет свободного потока.'); - $taskset = 'taskset -c '.$core; - } + $taskset = 'taskset -c '.$core; + } - if($server['core_fix']) - { - $core = $server['core_fix']-1; - $taskset = 'taskset -c '.$core; - } + if($server['core_fix']) + { + $core = $server['core_fix']-1; + $taskset = 'taskset -c '.$core; + } - $ssh->set('rm -r '.$install.';' // Удаление директории игрового сервера - .'mkdir '.$install.';' // Создание директории - .'chown server'.$server['uid'].':1000 '.$install.';' // Изменение владельца и группы директории - .'cd '.$install.' && sudo -u server'.$server['uid'].' '.$taskset.' screen -dmS r_'.$server['uid'].' sh -c "' - .'cp -r '.$path.'/. .;' // Копирование файлов сборки для сервера - .'find . -type d -exec chmod 700 {} \;;' - .'find . -type f -exec chmod 600 {} \;;' - .'chmod 500 '.params::$aFileGame[$server['game']].'"'); + $ssh->set('rm -r '.$install.';' // Удаление директории игрового сервера + .'mkdir '.$install.';' // Создание директории + .'chown server'.$server['uid'].':1000 '.$install.';' // Изменение владельца и группы директории + .'cd '.$install.' && sudo -u server'.$server['uid'].' '.$taskset.' screen -dmS r_'.$server['uid'].' sh -c "' + .'cp -r '.$path.'/. .;' // Копирование файлов сборки для сервера + .'find . -type d -exec chmod 700 {} \;;' + .'find . -type f -exec chmod 600 {} \;;' + .'chmod 500 '.params::$aFileGame[$server['game']].'"'); - // Очистка записей в базе - $sql->query('DELETE FROM `admins_'.$server['game'].'` WHERE `server`="'.$id.'"'); // Список админов на сервере - $sql->query('DELETE FROM `plugins_install` WHERE `server`="'.$id.'"'); // Список установленных плагинов на сервере + // Очистка записей в базе + $sql->query('DELETE FROM `admins_'.$server['game'].'` WHERE `server`="'.$id.'"'); // Список админов на сервере + $sql->query('DELETE FROM `plugins_install` WHERE `server`="'.$id.'"'); // Список установленных плагинов на сервере - // Запись установленных плагинов - if($server['plugins_use']) - { - // Массив идентификаторов плагинов - $aPlugins = sys::b64djs($tarif['plugins_install']); + // Запись установленных плагинов + if($server['plugins_use']) + { + // Массив идентификаторов плагинов + $aPlugins = sys::b64djs($tarif['plugins_install']); - if(isset($aPlugins[$server['pack']])) - { - $plugins = explode(',', $aPlugins[$server['pack']]); + if(isset($aPlugins[$server['pack']])) + { + $plugins = explode(',', $aPlugins[$server['pack']]); - foreach($plugins as $plugin) - if($plugin) - $sql->query('INSERT INTO `plugins_install` set `server`="'.$id.'", `plugin`="'.$plugin.'", `time`="'.$start_point.'"'); - } - } + foreach($plugins as $plugin) + if($plugin) + $sql->query('INSERT INTO `plugins_install` set `server`="'.$id.'", `plugin`="'.$plugin.'", `time`="'.$start_point.'"'); + } + } - $core = !isset($core) ? 0 : $core+1; + $core = !isset($core) ? 0 : $core+1; - // Обновление информации в базе - $sql->query('UPDATE `servers` set `status`="reinstall", `reinstall`="'.$start_point.'", `core_use`="'.$core.'", `fastdl`="0" WHERE `id`="'.$id.'" LIMIT 1'); + // Обновление информации в базе + $sql->query('UPDATE `servers` set `status`="reinstall", `reinstall`="'.$start_point.'", `core_use`="'.$core.'", `fastdl`="0" WHERE `id`="'.$id.'" LIMIT 1'); - // Логирование - $sql->query('INSERT INTO `logs_sys` set `user`="'.$user['id'].'", `server`="'.$id.'", `text`="'.sys::text('syslogs', 'reinstall').'", `time`="'.$start_point.'"'); + // Логирование + $sql->query('INSERT INTO `logs_sys` set `user`="'.$user['id'].'", `server`="'.$id.'", `text`="'.sys::text('syslogs', 'reinstall').'", `time`="'.$start_point.'"'); - // Сброс кеша - actions::clmcache($id); + // Сброс кеша + actions::clmcache($id); - sys::reset_mcache('server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'reinstall', 'online' => 0, 'players' => '')); - sys::reset_mcache('server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'reinstall', 'online' => 0)); + sys::reset_mcache('server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'reinstall', 'online' => 0, 'players' => '')); + sys::reset_mcache('server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'reinstall', 'online' => 0)); - return array('s' => 'ok'); - } + return array('s' => 'ok'); + } - public static function update($id) - { - global $cfg, $sql, $user, $start_point; + public static function update($id) + { + global $cfg, $sql, $user, $start_point; - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - $sql->query('SELECT `uid`, `unit`, `tarif`, `address`, `game`, `name`, `pack`, `plugins_use`, `ftp`, `update` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `uid`, `unit`, `tarif`, `address`, `game`, `name`, `pack`, `plugins_use`, `ftp`, `update` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - // Проверка времени обновления - $update = $server['update']+$cfg['update'][$server['game']]*60; + // Проверка времени обновления + $update = $server['update']+$cfg['update'][$server['game']]*60; - if($update > $start_point && $user['group'] != 'admin') - return array('e' => sys::updtext(sys::text('servers', 'update'), array('time' => sys::date('max', $update)))); + if($update > $start_point && $user['group'] != 'admin') + return array('e' => sys::updtext(sys::text('servers', 'update'), array('time' => sys::date('max', $update)))); - $sql->query('SELECT `address`, `passwd`, `sql_login`, `sql_passwd`, `sql_port`, `sql_ftp` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $sql->query('SELECT `address`, `passwd`, `sql_login`, `sql_passwd`, `sql_port`, `sql_ftp` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); - $sql->query('SELECT `update`, `install` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); - $tarif = $sql->get(); + $sql->query('SELECT `update`, `install` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); + $tarif = $sql->get(); - // Проверка ssh соедниения пу с локацией - if(!$ssh->auth($unit['passwd'], $unit['address'])) - return array('e' => sys::text('error', 'ssh')); + // Проверка ssh соедниения пу с локацией + if(!$ssh->auth($unit['passwd'], $unit['address'])) + return array('e' => sys::text('error', 'ssh')); - $ssh->set('kill -9 `ps aux | grep s_'.$server['uid'].' | grep -v grep | awk '."'{print $2}'".' | xargs;' - .'lsof -i@'.$server['address'].' | awk '."'{print $2}'".' | grep -v PID | xargs`; sudo -u server'.$server['uid'].' screen -wipe'); + $ssh->set('kill -9 `ps aux | grep s_'.$server['uid'].' | grep -v grep | awk '."'{print $2}'".' | xargs;' + .'lsof -i@'.$server['address'].' | awk '."'{print $2}'".' | grep -v PID | xargs`; sudo -u server'.$server['uid'].' screen -wipe'); - $taskset = ''; + $taskset = ''; - // Если включена система автораспределения и не установлен фиксированный поток - if($cfg['cpu_route'] && !$server['core_fix']) - { - $proc_stat = array(); + // Если включена система автораспределения и не установлен фиксированный поток + if($cfg['cpu_route'] && !$server['core_fix']) + { + $proc_stat = array(); - $proc_stat[0] = $ssh->get('cat /proc/stat'); - } + $proc_stat[0] = $ssh->get('cat /proc/stat'); + } - // Директория обновлений сборки - $path = $tarif['update'].$server['pack']; + // Директория обновлений сборки + $path = $tarif['update'].$server['pack']; - // Директория игрового сервера - $install = $tarif['install'].$server['uid']; + // Директория игрового сервера + $install = $tarif['install'].$server['uid']; - // Если система автораспределения продолжить парсинг загрузки процессора - if(isset($proc_stat)) - { - $proc_stat[1] = $ssh->get('cat /proc/stat'); + // Если система автораспределения продолжить парсинг загрузки процессора + if(isset($proc_stat)) + { + $proc_stat[1] = $ssh->get('cat /proc/stat'); - // Ядро/поток, на котором будет запущен игровой сервер (поток выбран с рассчетом наименьшей загруженности в момент запуска игрового сервера) - $core = sys::cpu_idle($proc_stat, $server['unit'], false); // число от 1 до n (где n число ядер/потоков в процессоре (без нулевого) + // Ядро/поток, на котором будет запущен игровой сервер (поток выбран с рассчетом наименьшей загруженности в момент запуска игрового сервера) + $core = sys::cpu_idle($proc_stat, $server['unit'], false); // число от 1 до n (где n число ядер/потоков в процессоре (без нулевого) - if(!is_numeric($core)) - return array('e' => 'Не удается выполнить операцию, нет свободного потока.'); + if(!is_numeric($core)) + return array('e' => 'Не удается выполнить операцию, нет свободного потока.'); - $taskset = 'taskset -c '.$core; - } + $taskset = 'taskset -c '.$core; + } - if($server['core_fix']) - { - $core = $server['core_fix']-1; - $taskset = 'taskset -c '.$core; - } + if($server['core_fix']) + { + $core = $server['core_fix']-1; + $taskset = 'taskset -c '.$core; + } - $ssh->set('cd '.$install.' && sudo -u server'.$server['uid'].' '.$taskset.' screen -dmS u_'.$server['uid'].' sh -c "cp -rv '.$path.'/. .;' // Копирование файлов обвновления сборки для сервера - .'find . -type d -exec chmod 700 {} \;;' - .'find . -type f -exec chmod 600 {} \;;' - .'chmod 500 '.params::$aFileGame[$server['game']].'"'); + $ssh->set('cd '.$install.' && sudo -u server'.$server['uid'].' '.$taskset.' screen -dmS u_'.$server['uid'].' sh -c "cp -rv '.$path.'/. .;' // Копирование файлов обвновления сборки для сервера + .'find . -type d -exec chmod 700 {} \;;' + .'find . -type f -exec chmod 600 {} \;;' + .'chmod 500 '.params::$aFileGame[$server['game']].'"'); - $core = !isset($core) ? 0 : $core+1; + $core = !isset($core) ? 0 : $core+1; - // Обновление информации в базе - $sql->query('UPDATE `servers` set `status`="update", `update`="'.$start_point.'", `core_use`="'.$core.'" WHERE `id`="'.$id.'" LIMIT 1'); + // Обновление информации в базе + $sql->query('UPDATE `servers` set `status`="update", `update`="'.$start_point.'", `core_use`="'.$core.'" WHERE `id`="'.$id.'" LIMIT 1'); - // Логирование - $sql->query('INSERT INTO `logs_sys` set `user`="'.$user['id'].'", `server`="'.$id.'", `text`="'.sys::text('syslogs', 'update').'", `time`="'.$start_point.'"'); + // Логирование + $sql->query('INSERT INTO `logs_sys` set `user`="'.$user['id'].'", `server`="'.$id.'", `text`="'.sys::text('syslogs', 'update').'", `time`="'.$start_point.'"'); - // Сброс кеша - actions::clmcache($id); + // Сброс кеша + actions::clmcache($id); - sys::reset_mcache('server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'update', 'online' => 0, 'players' => '')); - sys::reset_mcache('server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'update', 'online' => 0)); + sys::reset_mcache('server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'update', 'online' => 0, 'players' => '')); + sys::reset_mcache('server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'update', 'online' => 0)); - return array('s' => 'ok'); - } + return array('s' => 'ok'); + } - public static function clmcache($id) - { - global $mcache; + public static function clmcache($id) + { + global $mcache; - $mcache->delete('server_index_'.$id); - $mcache->delete('server_resources_'.$id); - $mcache->delete('server_status_'.$id); - } - } \ No newline at end of file + $mcache->delete('server_index_'.$id); + $mcache->delete('server_resources_'.$id); + $mcache->delete('server_status_'.$id); + } + } \ No newline at end of file diff --git a/system/library/games/boost.php b/system/library/games/boost.php index 0d96409..43b71fd 100644 --- a/system/library/games/boost.php +++ b/system/library/games/boost.php @@ -1,113 +1,113 @@ partner_key = $key; - $this->service_url = $url; - } + function __construct($key, $url) + { + $this->partner_key = $key; + $this->service_url = $url; + } - public function def($data) - { - $aData = array( - 'service' => 'boost', - 'period' => $data['period'], - 'address' => $data['address'], - 'game' => 'cs16' - ); + public function def($data) + { + $aData = array( + 'service' => 'boost', + 'period' => $data['period'], + 'address' => $data['address'], + 'game' => 'cs16' + ); - $out = json_decode($this->defaultcurl(json_encode($aData)), true); + $out = json_decode($this->defaultcurl(json_encode($aData)), true); - if($out['message'] == 'Услуга уже присутствует') - $out = json_decode($this->defaultcurl(json_encode($aData), 'prolong'), true); + if($out['message'] == 'Услуга уже присутствует') + $out = json_decode($this->defaultcurl(json_encode($aData), 'prolong'), true); - if(!array_key_exists('status', $out)) - array('error' => 'Не удалось приобрести услугу, повторите запрос позже.'); + if(!array_key_exists('status', $out)) + array('error' => 'Не удалось приобрести услугу, повторите запрос позже.'); - if(!$out['status']) - return true; + if(!$out['status']) + return true; - return array('error' => $out['message']); - } + return array('error' => $out['message']); + } - private function defaultcurl($data, $action = 'buy') - { - if(!($curl = curl_init())) - array('error' => 'FAIL: curl_init().'); + private function defaultcurl($data, $action = 'buy') + { + if(!($curl = curl_init())) + array('error' => 'FAIL: curl_init().'); - curl_setopt($curl, CURLOPT_URL, $this->service_url); - curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); - curl_setopt($curl, CURLOPT_POST, true); - curl_setopt($curl, CURLOPT_POSTFIELDS, 'key='.$this->partner_key.'&action='.$action.'&data='.$data); + curl_setopt($curl, CURLOPT_URL, $this->service_url); + curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); + curl_setopt($curl, CURLOPT_POST, true); + curl_setopt($curl, CURLOPT_POSTFIELDS, 'key='.$this->partner_key.'&action='.$action.'&data='.$data); - $out = curl_exec($curl); + $out = curl_exec($curl); - curl_close($curl); + curl_close($curl); - return $out; - } + return $out; + } - public function vipms($data) - { - $aData = array( - 'format' => 'POST', - 'country' => 'RU', - 'hoster_id' => 1, - 'key' => $this->partner_key, - 'full_address' => $data['address'], - 'service_id' => $data['period'] - ); + public function vipms($data) + { + $aData = array( + 'format' => 'POST', + 'country' => 'RU', + 'hoster_id' => 1, + 'key' => $this->partner_key, + 'full_address' => $data['address'], + 'service_id' => $data['period'] + ); - return $this->othercurl($aData); - } + return $this->othercurl($aData); + } - public function fulls($data) - { - $aData = array( - 'format' => 'POST', - 'country' => 'RU', - 'hoster_id' => 1, - 'key' => $this->partner_key, - 'full_address' => $data['address'], - 'service_id' => $data['period'] - ); + public function fulls($data) + { + $aData = array( + 'format' => 'POST', + 'country' => 'RU', + 'hoster_id' => 1, + 'key' => $this->partner_key, + 'full_address' => $data['address'], + 'service_id' => $data['period'] + ); - return $this->othercurl($aData); - } + return $this->othercurl($aData); + } - private function othercurl($aData) - { - if(!($curl = curl_init())) - array('error' => 'FAIL: curl_init().'); + private function othercurl($aData) + { + if(!($curl = curl_init())) + array('error' => 'FAIL: curl_init().'); - curl_setopt($curl, CURLOPT_URL, $this->service_url.'?'.urldecode(http_build_query($aData))); - curl_setopt($curl, CURLOPT_POST, true); - curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); - curl_setopt($curl, CURLOPT_POSTFIELDS, urldecode(http_build_query($aData))); - curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); + curl_setopt($curl, CURLOPT_URL, $this->service_url.'?'.urldecode(http_build_query($aData))); + curl_setopt($curl, CURLOPT_POST, true); + curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); + curl_setopt($curl, CURLOPT_POSTFIELDS, urldecode(http_build_query($aData))); + curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); - $result = curl_exec($curl); + $result = curl_exec($curl); - curl_close($curl); + curl_close($curl); - if($result == 'OK') - return true; + if($result == 'OK') + return true; - $aErr = array( - 1 => 'BAD_HOSTER_ID', - 2 => 'HOSTER_NOT_FOUND', - 3 => 'BAD_HOSTER_IP', - 4 => 'FORM_INVALID', - 5 => 'BAD_SERVICE_ID' - ); + $aErr = array( + 1 => 'BAD_HOSTER_ID', + 2 => 'HOSTER_NOT_FOUND', + 3 => 'BAD_HOSTER_IP', + 4 => 'FORM_INVALID', + 5 => 'BAD_SERVICE_ID' + ); - return array('error' => $aErr[$result]); - } - } + return array('error' => $aErr[$result]); + } + } ?> \ No newline at end of file diff --git a/system/library/games/crmp/action.php b/system/library/games/crmp/action.php index 9398e77..b8533a3 100644 --- a/system/library/games/crmp/action.php +++ b/system/library/games/crmp/action.php @@ -1,130 +1,130 @@ query('SELECT `uid`, `unit`, `tarif`, `game`, `address`, `slots_start`, `name`, `map_start`, `time_start`, `core_fix` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `uid`, `unit`, `tarif`, `game`, `address`, `slots_start`, `name`, `map_start`, `time_start`, `core_fix` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - $sql->query('SELECT `install` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); + $sql->query('SELECT `install` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); $tarif = $sql->get(); - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); - // Проверка ssh соедниения пу с локацией - if(!$ssh->auth($unit['passwd'], $unit['address'])) - return array('e' => sys::text('error', 'ssh')); + // Проверка ssh соедниения пу с локацией + if(!$ssh->auth($unit['passwd'], $unit['address'])) + return array('e' => sys::text('error', 'ssh')); - list($ip, $port) = explode(':', $server['address']); + list($ip, $port) = explode(':', $server['address']); - // Убить процессы - $ssh->set('kill -9 `ps aux | grep s_'.$server['uid'].' | grep -v grep | awk '."'{print $2}'".' | xargs;' - .'lsof -i@'.$server['address'].' | awk '."'{print $2}'".' | grep -v PID | xargs`; sudo -u server'.$server['uid'].' screen -wipe;'); + // Убить процессы + $ssh->set('kill -9 `ps aux | grep s_'.$server['uid'].' | grep -v grep | awk '."'{print $2}'".' | xargs;' + .'lsof -i@'.$server['address'].' | awk '."'{print $2}'".' | grep -v PID | xargs`; sudo -u server'.$server['uid'].' screen -wipe;'); - // Временный файл - $temp = sys::temp(action::config($ip, $port, $server['slots_start'], $ssh->get('cat '.$tarif['install'].'/'.$server['uid'].'/server.cfg'))); + // Временный файл + $temp = sys::temp(action::config($ip, $port, $server['slots_start'], $ssh->get('cat '.$tarif['install'].'/'.$server['uid'].'/server.cfg'))); - // Обновление файла server.cfg - $ssh->setfile($temp, $tarif['install'].$server['uid'].'/server.cfg', 0644); + // Обновление файла server.cfg + $ssh->setfile($temp, $tarif['install'].$server['uid'].'/server.cfg', 0644); - unlink($temp); + unlink($temp); - $taskset = ''; + $taskset = ''; - // Если включена система автораспределения и не установлен фиксированный поток - if($cfg['cpu_route'] AND !$server['core_fix']) - { - $proc_stat = array(); + // Если включена система автораспределения и не установлен фиксированный поток + if($cfg['cpu_route'] AND !$server['core_fix']) + { + $proc_stat = array(); - $proc_stat[0] = $ssh->get('cat /proc/stat'); - } + $proc_stat[0] = $ssh->get('cat /proc/stat'); + } - // Если система автораспределения продолжить парсинг загрузки процессора - if(isset($proc_stat)) - { - $ssh->set('cat /proc/stat'); - $proc_stat[1] = $ssh->get(); + // Если система автораспределения продолжить парсинг загрузки процессора + if(isset($proc_stat)) + { + $ssh->set('cat /proc/stat'); + $proc_stat[1] = $ssh->get(); - // Ядро/поток, на котором будет запущен игровой сервер (поток выбран с рассчетом наименьшей загруженности в момент запуска игрового сервера) - $core = sys::cpu_idle($proc_stat, $server['unit'], false); // число от 1 до n (где n число ядер/потоков в процессоре (без нулевого) + // Ядро/поток, на котором будет запущен игровой сервер (поток выбран с рассчетом наименьшей загруженности в момент запуска игрового сервера) + $core = sys::cpu_idle($proc_stat, $server['unit'], false); // число от 1 до n (где n число ядер/потоков в процессоре (без нулевого) - if(!is_numeric($core)) - return array('e' => sys::text('error', 'cpu')); + if(!is_numeric($core)) + return array('e' => sys::text('error', 'cpu')); - $taskset = 'taskset -c '.$core; - } + $taskset = 'taskset -c '.$core; + } - if($server['core_fix']) - { - $core = $server['core_fix']-1; - $taskset = 'taskset -c '.$core; - } + if($server['core_fix']) + { + $core = $server['core_fix']-1; + $taskset = 'taskset -c '.$core; + } - // Параметры запуска - $bash = './samp03svr-cr'; + // Параметры запуска + $bash = './samp03svr-cr'; - // Временный файл - $temp = sys::temp($bash); + // Временный файл + $temp = sys::temp($bash); - // Обновление файла start.sh - $ssh->setfile($temp, $tarif['install'].$server['uid'].'/start.sh', 0500); + // Обновление файла start.sh + $ssh->setfile($temp, $tarif['install'].$server['uid'].'/start.sh', 0500); - // Строка запуска - $ssh->set('cd '.$tarif['install'].$server['uid'].';' // переход в директорию игрового сервера - .'rm *.pid;' // Удаление *.pid файлов - .'sudo -u server'.$server['uid'].' mkdir -p oldstart;' // Создание папки логов - .'cat server_log.txt >> oldstart/'.date('d.m.Y_H:i:s', $server['time_start']).'.log; rm server_log.txt; rm oldstart/01.01.1970_03:00:00.log;' // Перемещение лога предыдущего запуска - .'chown server'.$server['uid'].':1000 server.cfg start.sh;' // Обновление владельца файлов server.cfg start.sh - .'sudo -u server'.$server['uid'].' screen -dmS s_'.$server['uid'].' '.$taskset.' sh -c "./start.sh"'); // Запуск игровго сервера + // Строка запуска + $ssh->set('cd '.$tarif['install'].$server['uid'].';' // переход в директорию игрового сервера + .'rm *.pid;' // Удаление *.pid файлов + .'sudo -u server'.$server['uid'].' mkdir -p oldstart;' // Создание папки логов + .'cat server_log.txt >> oldstart/'.date('d.m.Y_H:i:s', $server['time_start']).'.log; rm server_log.txt; rm oldstart/01.01.1970_03:00:00.log;' // Перемещение лога предыдущего запуска + .'chown server'.$server['uid'].':1000 server.cfg start.sh;' // Обновление владельца файлов server.cfg start.sh + .'sudo -u server'.$server['uid'].' screen -dmS s_'.$server['uid'].' '.$taskset.' sh -c "./start.sh"'); // Запуск игровго сервера - $core = !isset($core) ? 0 : $core+1; + $core = !isset($core) ? 0 : $core+1; - // Обновление информации в базе - $sql->query('UPDATE `servers` set `status`="'.$type.'", `online`="0", `players`="", `core_use`="'.$core.'", `time_start`="'.$start_point.'", `stop`="1" WHERE `id`="'.$id.'" LIMIT 1'); + // Обновление информации в базе + $sql->query('UPDATE `servers` set `status`="'.$type.'", `online`="0", `players`="", `core_use`="'.$core.'", `time_start`="'.$start_point.'", `stop`="1" WHERE `id`="'.$id.'" LIMIT 1'); - unlink($temp); + unlink($temp); - // Сброс кеша - actions::clmcache($id); + // Сброс кеша + actions::clmcache($id); - sys::reset_mcache('server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => $type, 'online' => 0, 'players' => '')); - sys::reset_mcache('server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => $type, 'online' => 0)); + sys::reset_mcache('server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => $type, 'online' => 0, 'players' => '')); + sys::reset_mcache('server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => $type, 'online' => 0)); - return array('s' => 'ok'); - } + return array('s' => 'ok'); + } - public static function config($ip, $port, $slots, $config) - { - $aLine = explode("\n", $config); + public static function config($ip, $port, $slots, $config) + { + $aLine = explode("\n", $config); - $eConfig = ''; + $eConfig = ''; - foreach($aLine as $line) - { - $param = explode(' ', trim($line)); + foreach($aLine as $line) + { + $param = explode(' ', trim($line)); - if(in_array(trim($param[0]), array('bind', 'port', 'maxplayers', 'query'))) - continue; + if(in_array(trim($param[0]), array('bind', 'port', 'maxplayers', 'query'))) + continue; - $eConfig .= $line.PHP_EOL; - } + $eConfig .= $line.PHP_EOL; + } - $eConfig .= 'bind '.$ip.PHP_EOL - .'port '.$port.PHP_EOL - .'maxplayers '.$slots.PHP_EOL - .'query 1'; + $eConfig .= 'bind '.$ip.PHP_EOL + .'port '.$port.PHP_EOL + .'maxplayers '.$slots.PHP_EOL + .'query 1'; - return $eConfig; - } + return $eConfig; + } } ?> \ No newline at end of file diff --git a/system/library/games/crmp/scan.php b/system/library/games/crmp/scan.php index 5545de9..e79dade 100644 --- a/system/library/games/crmp/scan.php +++ b/system/library/games/crmp/scan.php @@ -1,115 +1,115 @@ query('SELECT `address`, `game`, `name`, `map`, `online`, `players`, `status`, `time`, `overdue` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `address`, `game`, `name`, `map`, `online`, `players`, `status`, `time`, `overdue` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - list($ip, $port) = explode(':', $server['address']); + list($ip, $port) = explode(':', $server['address']); - include(LIB.'games/query/SampQuery.php'); + include(LIB.'games/query/SampQuery.php'); - $sq = new SampQuery($ip, $port); + $sq = new SampQuery($ip, $port); - if($players_get) - $nmch = 'server_scan_mon_pl_'.$id; - else - $nmch = 'server_scan_mon_'.$id; + if($players_get) + $nmch = 'server_scan_mon_pl_'.$id; + else + $nmch = 'server_scan_mon_'.$id; - if(is_array($mcache->get($nmch))) - return $mcache->get($nmch); + if(is_array($mcache->get($nmch))) + return $mcache->get($nmch); - $out = array(); + $out = array(); - $out['time'] = 'Арендован до: '.date('d.m.Y - H:i', $server['time']); + $out['time'] = 'Арендован до: '.date('d.m.Y - H:i', $server['time']); - if($server['status'] == 'overdue') - $out['time_end'] = 'Удаление через: '.sys::date('min', $server['overdue']+$cfg['server_delete']*86400); - else - $out['time_end'] = 'Осталось: '.sys::date('min', $server['time']); + if($server['status'] == 'overdue') + $out['time_end'] = 'Удаление через: '.sys::date('min', $server['overdue']+$cfg['server_delete']*86400); + else + $out['time_end'] = 'Осталось: '.sys::date('min', $server['time']); - if(!$sq->connect()) - { - $out['name'] = $server['name']; - $out['status'] = sys::status($server['status'], $server['game'], $server['map']); - $out['online'] = $server['online']; - $out['image'] = ''; - $out['buttons'] = sys::buttons($id, $server['status'], $server['game']); + if(!$sq->connect()) + { + $out['name'] = $server['name']; + $out['status'] = sys::status($server['status'], $server['game'], $server['map']); + $out['online'] = $server['online']; + $out['image'] = ''; + $out['buttons'] = sys::buttons($id, $server['status'], $server['game']); - if($players_get) - $out['players'] = base64_decode($server['players']); + if($players_get) + $out['players'] = base64_decode($server['players']); - $mcache->set($nmch, $out, false, $cfg['mcache_server_mon']); + $mcache->set($nmch, $out, false, $cfg['mcache_server_mon']); - return $out; - } + return $out; + } - $info = $sq->getInfo(); + $info = $sq->getInfo(); - if($players_get) - $players = scan::players($sq->getDetailedPlayers()); + if($players_get) + $players = scan::players($sq->getDetailedPlayers()); - $info['map'] = htmlspecialchars(mb_convert_encoding($info['map'], 'UTF-8', 'WINDOWS-1251')); - $out['name'] = htmlspecialchars(mb_convert_encoding($info['hostname'], 'UTF-8', 'WINDOWS-1251')); - $out['status'] = sys::status('working', $server['game'], $info['map']); - $out['online'] = sys::int($info['players']); - $out['image'] = ''; - $out['buttons'] = sys::buttons($id, 'working', $server['game']); - $out['players'] = ''; + $info['map'] = htmlspecialchars(mb_convert_encoding($info['map'], 'UTF-8', 'WINDOWS-1251')); + $out['name'] = htmlspecialchars(mb_convert_encoding($info['hostname'], 'UTF-8', 'WINDOWS-1251')); + $out['status'] = sys::status('working', $server['game'], $info['map']); + $out['online'] = sys::int($info['players']); + $out['image'] = ''; + $out['buttons'] = sys::buttons($id, 'working', $server['game']); + $out['players'] = ''; - if($players_get) - { - foreach($players as $index => $player) - { - $html->get($server['game'], 'sections/servers/players'); + if($players_get) + { + foreach($players as $index => $player) + { + $html->get($server['game'], 'sections/servers/players'); - $html->set('i', $player['i']); - $html->set('name', htmlspecialchars($player['name'])); - $html->set('ping', sys::int($player['ping'])); + $html->set('i', $player['i']); + $html->set('name', htmlspecialchars($player['name'])); + $html->set('ping', sys::int($player['ping'])); - $html->pack('list'); - } + $html->pack('list'); + } - $out['players'] = isset($html->arr['list']) ? $html->arr['list'] : ''; - } + $out['players'] = isset($html->arr['list']) ? $html->arr['list'] : ''; + } - $sql->query('UPDATE `servers` set ' - .'`name`="'.$out['name'].'", ' - .'`online`="'.$out['online'].'", ' - .'`map`="'.$info['map'].'", ' - .'`status`="working" WHERE `id`="'.$id.'" LIMIT 1'); + $sql->query('UPDATE `servers` set ' + .'`name`="'.$out['name'].'", ' + .'`online`="'.$out['online'].'", ' + .'`map`="'.$info['map'].'", ' + .'`status`="working" WHERE `id`="'.$id.'" LIMIT 1'); - if($players_get) - $sql->query('UPDATE `servers` set `players`="'.base64_encode($out['players']).'" WHERE `id`="'.$id.'" LIMIT 1'); + if($players_get) + $sql->query('UPDATE `servers` set `players`="'.base64_encode($out['players']).'" WHERE `id`="'.$id.'" LIMIT 1'); - $mcache->set($nmch, $out, false, $cfg['mcache_server_mon']); + $mcache->set($nmch, $out, false, $cfg['mcache_server_mon']); - return $out; - } + return $out; + } - public static function players($aPlayrs) - { - $i = 1; - $aData = array(); + public static function players($aPlayrs) + { + $i = 1; + $aData = array(); - foreach($aPlayrs as $n => $player) - { - $aData[$i]['i'] = $i; - $aData[$i]['name'] = $player['nickname'] == '' ? 'Подключается' : htmlspecialchars($player['nickname']); - $aData[$i]['ping'] = sys::int($player['ping']); + foreach($aPlayrs as $n => $player) + { + $aData[$i]['i'] = $i; + $aData[$i]['name'] = $player['nickname'] == '' ? 'Подключается' : htmlspecialchars($player['nickname']); + $aData[$i]['ping'] = sys::int($player['ping']); - $i+=1; - } + $i+=1; + } - return $aData; - } - } + return $aData; + } + } ?> \ No newline at end of file diff --git a/system/library/games/crmp/service.php b/system/library/games/crmp/service.php index 32e2531..46c862f 100644 --- a/system/library/games/crmp/service.php +++ b/system/library/games/crmp/service.php @@ -1,355 +1,355 @@ query('SELECT `address`, `test` FROM `units` WHERE `id`="'.$aData['unit'].'" AND `crmp`="1" AND `show`="1" LIMIT 1'); - if(!$sql->num()) - sys::outjs(array('e' => 'Локация не найдена.')); + // Проверка локации + $sql->query('SELECT `address`, `test` FROM `units` WHERE `id`="'.$aData['unit'].'" AND `crmp`="1" AND `show`="1" LIMIT 1'); + if(!$sql->num()) + sys::outjs(array('e' => 'Локация не найдена.')); - $unit = $sql->get(); + $unit = $sql->get(); - // Проверка тарифа - $sql->query('SELECT `id` FROM `tarifs` WHERE `id`="'.$aData['tarif'].'" AND `unit`="'.$aData['unit'].'" AND `show`="1" LIMIT 1'); - if(!$sql->num()) - sys::outjs(array('e' => 'Тариф не найден.')); + // Проверка тарифа + $sql->query('SELECT `id` FROM `tarifs` WHERE `id`="'.$aData['tarif'].'" AND `unit`="'.$aData['unit'].'" AND `show`="1" LIMIT 1'); + if(!$sql->num()) + sys::outjs(array('e' => 'Тариф не найден.')); - $sql->query('SELECT ' - .'`slots_min`,' - .'`slots_max`,' - .'`port_min`,' - .'`port_max`,' - .'`hostname`,' - .'`packs`,' - .'`time`,' - .'`test`,' - .'`tests`,' - .'`discount`,' - .'`ftp`,' - .'`plugins`,' - .'`console`,' - .'`stats`,' - .'`copy`,' - .'`web`,' - .'`plugins_install`,' - .'`hdd`,' - .'`autostop`,' - .'`core_fix`,' - .'`ip`,' - .'`price`' - .' FROM `tarifs` WHERE `id`="'.$aData['tarif'].'" LIMIT 1'); + $sql->query('SELECT ' + .'`slots_min`,' + .'`slots_max`,' + .'`port_min`,' + .'`port_max`,' + .'`hostname`,' + .'`packs`,' + .'`time`,' + .'`test`,' + .'`tests`,' + .'`discount`,' + .'`ftp`,' + .'`plugins`,' + .'`console`,' + .'`stats`,' + .'`copy`,' + .'`web`,' + .'`plugins_install`,' + .'`hdd`,' + .'`autostop`,' + .'`core_fix`,' + .'`ip`,' + .'`price`' + .' FROM `tarifs` WHERE `id`="'.$aData['tarif'].'" LIMIT 1'); - $tarif = $sql->get(); + $tarif = $sql->get(); - // Проверка сборки - if(!array_key_exists($aData['pack'], sys::b64djs($tarif['packs'], true))) - sys::outjs(array('e' => 'Сборка не найдена.')); + // Проверка сборки + if(!array_key_exists($aData['pack'], sys::b64djs($tarif['packs'], true))) + sys::outjs(array('e' => 'Сборка не найдена.')); - $test = 0; + $test = 0; - // Проверка периода на тест - if($aData['test']) - { - if(!$tarif['test'] || !$unit['test']) - sys::outjs(array('e' => 'Тестовый период недоступен.')); + // Проверка периода на тест + if($aData['test']) + { + if(!$tarif['test'] || !$unit['test']) + sys::outjs(array('e' => 'Тестовый период недоступен.')); - // Проверка на повторный запрос - $sql->query('SELECT `id`, `game` FROM `tests` WHERE `user`="'.$user['id'].'" LIMIT 1'); - if($sql->num()) - { - $test_info = $sql->get(); + // Проверка на повторный запрос + $sql->query('SELECT `id`, `game` FROM `tests` WHERE `user`="'.$user['id'].'" LIMIT 1'); + if($sql->num()) + { + $test_info = $sql->get(); - if(!$cfg['tests']['game'] || $test_info['game'] == 'crmp') - sys::outjs(array('e' => 'Тестовый период предоставляется один раз.')); + if(!$cfg['tests']['game'] || $test_info['game'] == 'crmp') + sys::outjs(array('e' => 'Тестовый период предоставляется один раз.')); - $sql->query('SELECT `id` FROM `servers` WHERE `user`="'.$user['id'].'" AND `test`="1" LIMIT 1'); - if($sql->num() AND !$cfg['tests']['sametime']) - sys::outjs(array('e' => 'Чтобы получить тестовый период другой игры, дождитесь окончания текущего.')); - } + $sql->query('SELECT `id` FROM `servers` WHERE `user`="'.$user['id'].'" AND `test`="1" LIMIT 1'); + if($sql->num() AND !$cfg['tests']['sametime']) + sys::outjs(array('e' => 'Чтобы получить тестовый период другой игры, дождитесь окончания текущего.')); + } - // Проверка наличия мест на локации - $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND `test`="1" AND `time`>"'.$start_point.'" LIMIT '.$unit['test']); - if($sql->num() == $unit['test']) - sys::outjs(array('e' => 'Свободного места для тестового периода нет.')); + // Проверка наличия мест на локации + $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND `test`="1" AND `time`>"'.$start_point.'" LIMIT '.$unit['test']); + if($sql->num() == $unit['test']) + sys::outjs(array('e' => 'Свободного места для тестового периода нет.')); - // Проверка наличия мест для выбранного тарифа - $sql->query('SELECT `id` FROM `servers` WHERE `tarif`="'.$aData['tarif'].'" AND `test`="1" AND `time`>"'.$start_point.'" LIMIT '.$tarif['tests']); - if($sql->num() == $tarif['tests']) - sys::outjs(array('e' => 'Свободного места для тестового периода выбранного тарифа нет.')); + // Проверка наличия мест для выбранного тарифа + $sql->query('SELECT `id` FROM `servers` WHERE `tarif`="'.$aData['tarif'].'" AND `test`="1" AND `time`>"'.$start_point.'" LIMIT '.$tarif['tests']); + if($sql->num() == $tarif['tests']) + sys::outjs(array('e' => 'Свободного места для тестового периода выбранного тарифа нет.')); - $test = 1; - }else - // Проверка периода - if(!$cfg['settlement_period'] AND !in_array($aData['time'], explode(':', $tarif['time']))) - sys::outjs(array('e' => 'Переданные данные периода неверны.')); + $test = 1; + }else + // Проверка периода + if(!$cfg['settlement_period'] AND !in_array($aData['time'], explode(':', $tarif['time']))) + sys::outjs(array('e' => 'Переданные данные периода неверны.')); - // Проверка слот - if($aData['slots'] < $tarif['slots_min'] || $aData['slots'] > $tarif['slots_max']) - sys::outjs(array('e' => 'Переданные данные слот неверны.')); + // Проверка слот + if($aData['slots'] < $tarif['slots_min'] || $aData['slots'] > $tarif['slots_max']) + sys::outjs(array('e' => 'Переданные данные слот неверны.')); - // Определение суммы - if($cfg['settlement_period']) - { - // Цена аренды за расчетный период - $sum = games::define_sum($tarif['discount'], $tarif['price'], $aData['slots'], $start_point); + // Определение суммы + if($cfg['settlement_period']) + { + // Цена аренды за расчетный период + $sum = games::define_sum($tarif['discount'], $tarif['price'], $aData['slots'], $start_point); - $aData['time'] = games::define_period('buy', params::$aDayMonth); - }else - $sum = games::define_sum($tarif['discount'], $tarif['price'], $aData['slots'], $aData['time']); + $aData['time'] = games::define_period('buy', params::$aDayMonth); + }else + $sum = games::define_sum($tarif['discount'], $tarif['price'], $aData['slots'], $aData['time']); - // Проверка промо-кода - $promo = games::define_promo( - $aData['promo'], - array( - 'tarif' => $aData['tarif'], - 'slots' => $aData['slots'], - 'time' => $aData['time'], - 'user' => $user['id'] - ), - $tarif['discount'], - $sum - ); + // Проверка промо-кода + $promo = games::define_promo( + $aData['promo'], + array( + 'tarif' => $aData['tarif'], + 'slots' => $aData['slots'], + 'time' => $aData['time'], + 'user' => $user['id'] + ), + $tarif['discount'], + $sum + ); - $days = $aData['time']; // Кол-во дней аренды + $days = $aData['time']; // Кол-во дней аренды - // Использование промо-кода - if(is_array($promo)) - { - if(array_key_exists('sum', $promo)) - $sum = $promo['sum']; - else - $days += $promo['days']; // Кол-во дней аренды с учетом подарочных (промо-код) - } + // Использование промо-кода + if(is_array($promo)) + { + if(array_key_exists('sum', $promo)) + $sum = $promo['sum']; + else + $days += $promo['days']; // Кол-во дней аренды с учетом подарочных (промо-код) + } - // Проверка баланса - if($user['balance'] < $sum) - sys::outjs(array('e' => 'У вас не хватает '.(round($sum-$user['balance'], 2)).' '.$cfg['currency'])); + // Проверка баланса + if($user['balance'] < $sum) + sys::outjs(array('e' => 'У вас не хватает '.(round($sum-$user['balance'], 2)).' '.$cfg['currency'])); - // Выделенный адрес игрового сервера - if(!empty($tarif['ip'])) - { - $aIp = explode(':', $tarif['ip']); + // Выделенный адрес игрового сервера + if(!empty($tarif['ip'])) + { + $aIp = explode(':', $tarif['ip']); - $ip = false; - $port = params::$aDefPort['crmp']; + $ip = false; + $port = params::$aDefPort['crmp']; - // Проверка наличия свободного адреса - foreach($aIp as $adr) - { - $adr = trim($adr); + // Проверка наличия свободного адреса + foreach($aIp as $adr) + { + $adr = trim($adr); - $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND `address` LIKE "'.$adr.':%" LIMIT 1'); - if(!$sql->num()) - { - $ip = $adr; + $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND `address` LIKE "'.$adr.':%" LIMIT 1'); + if(!$sql->num()) + { + $ip = $adr; - break; - } - } - }else{ - $ip = sys::first(explode(':', $unit['address'])); - $port = false; + break; + } + } + }else{ + $ip = sys::first(explode(':', $unit['address'])); + $port = false; - // Проверка наличия свободного порта - for($tarif['port_min']; $tarif['port_min'] <= $tarif['port_max']; $tarif['port_min']+=1) - { - $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND (`address`="'.$ip.':'.$tarif['port_min'].'" OR `port`="'.$tarif['port_min'].'") LIMIT 1'); - if(!$sql->num()) - { - $port = $tarif['port_min']; + // Проверка наличия свободного порта + for($tarif['port_min']; $tarif['port_min'] <= $tarif['port_max']; $tarif['port_min']+=1) + { + $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND (`address`="'.$ip.':'.$tarif['port_min'].'" OR `port`="'.$tarif['port_min'].'") LIMIT 1'); + if(!$sql->num()) + { + $port = $tarif['port_min']; - break; - } - } - } + break; + } + } + } - if(!$ip || !$port) - { - $sql->query('UPDATE `tarifs` set `show`="0" WHERE `id`="'.$aData['tarif'].'" LIMIT 1'); + if(!$ip || !$port) + { + $sql->query('UPDATE `tarifs` set `show`="0" WHERE `id`="'.$aData['tarif'].'" LIMIT 1'); - sys::outjs(array('e' => 'К сожалению нет доступных мест, обратитесь в тех.поддержку.')); - } + sys::outjs(array('e' => 'К сожалению нет доступных мест, обратитесь в тех.поддержку.')); + } - if($test) - $aData['time'] = games::time($start_point, $tarif['test']); - else - $aData['time'] = games::time($start_point, $days); + if($test) + $aData['time'] = games::time($start_point, $tarif['test']); + else + $aData['time'] = games::time($start_point, $days); - $fix_one = 0; - $core = 0; + $fix_one = 0; + $core = 0; - if($tarif['core_fix'] != '') - { - $aCore = explode(',', $tarif['core_fix']); + if($tarif['core_fix'] != '') + { + $aCore = explode(',', $tarif['core_fix']); - foreach($aCore as $cpu) - { - $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND `tarif`="'.$aData['tarif'].'" AND `core_fix`="'.$cpu.'" AND `core_fix_one`="1" LIMIT 1'); + foreach($aCore as $cpu) + { + $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND `tarif`="'.$aData['tarif'].'" AND `core_fix`="'.$cpu.'" AND `core_fix_one`="1" LIMIT 1'); - if($sql->num()) - continue; + if($sql->num()) + continue; - $fix_one = 1; - $core = $cpu; + $fix_one = 1; + $core = $cpu; - break; - } + break; + } - if(!$core) - { - $sql->query('UPDATE `tarifs` set `show`="0" WHERE `id`="'.$aData['tarif'].'" LIMIT 1'); + if(!$core) + { + $sql->query('UPDATE `tarifs` set `show`="0" WHERE `id`="'.$aData['tarif'].'" LIMIT 1'); - sys::outjs(array('e' => 'К сожалению нет доступных мест, обратитесь в тех.поддержку.')); - } - } + sys::outjs(array('e' => 'К сожалению нет доступных мест, обратитесь в тех.поддержку.')); + } + } - $ram = $tarif['param_fix'] ? $aData['ram'] : $cfg['ram']['crmp']*$aSDATA['slots']; + $ram = $tarif['param_fix'] ? $aData['ram'] : $cfg['ram']['crmp']*$aSDATA['slots']; - // Массив данных - $aSDATA = array( - 'unit' => $aData['unit'], // идентификатор локации - 'tarif' => $aData['tarif'], // идентификатор тарифа - 'ram' => $ram, // значение ram - 'param_fix' => $tarif['param_fix'], // фиксированные параметры - 'pack' => $aData['pack'], // Выбранная сборка для установки - 'time' => $aData['time'], // Время аренды - 'days' => $days, // Число дней - 'sum' => $sum, // Сумма списания - 'test' => $test, // тестовый период - 'address' => $ip.':'.$port, // адрес игрового сервера - 'port' => $port, // порт игрового сервера - 'slots' => $aData['slots'], // Кол-во слот - 'autostop' => $tarif['autostop'], // Выключение при 0 онлайне - 'ftp' => $tarif['ftp'], // Использование ftp - 'plugins' => $tarif['plugins'], // Использование плагинов - 'console' => $tarif['console'], // Использование консоли - 'stats' => $tarif['stats'], // Использование графиков (ведение статистики) - 'copy' => $tarif['copy'], // Использование резервных копий - 'web' => $tarif['web'], // Использование доп услуг - 'plugins_install' => $tarif['plugins_install'], // Список установленных плагинов - 'hdd' => $tarif['hdd'], // Дисковое пространство - 'core_fix' => $core, // Выделенный поток - 'core_fix_one' => $fix_one, // Выделенный поток - 'promo' => $promo // Использование промо-кода - ); + // Массив данных + $aSDATA = array( + 'unit' => $aData['unit'], // идентификатор локации + 'tarif' => $aData['tarif'], // идентификатор тарифа + 'ram' => $ram, // значение ram + 'param_fix' => $tarif['param_fix'], // фиксированные параметры + 'pack' => $aData['pack'], // Выбранная сборка для установки + 'time' => $aData['time'], // Время аренды + 'days' => $days, // Число дней + 'sum' => $sum, // Сумма списания + 'test' => $test, // тестовый период + 'address' => $ip.':'.$port, // адрес игрового сервера + 'port' => $port, // порт игрового сервера + 'slots' => $aData['slots'], // Кол-во слот + 'autostop' => $tarif['autostop'], // Выключение при 0 онлайне + 'ftp' => $tarif['ftp'], // Использование ftp + 'plugins' => $tarif['plugins'], // Использование плагинов + 'console' => $tarif['console'], // Использование консоли + 'stats' => $tarif['stats'], // Использование графиков (ведение статистики) + 'copy' => $tarif['copy'], // Использование резервных копий + 'web' => $tarif['web'], // Использование доп услуг + 'plugins_install' => $tarif['plugins_install'], // Список установленных плагинов + 'hdd' => $tarif['hdd'], // Дисковое пространство + 'core_fix' => $core, // Выделенный поток + 'core_fix_one' => $fix_one, // Выделенный поток + 'promo' => $promo // Использование промо-кода + ); - return $aSDATA; - } + return $aSDATA; + } - public static function install($aSDATA = array()) - { - global $cfg, $sql, $user, $start_point; + public static function install($aSDATA = array()) + { + global $cfg, $sql, $user, $start_point; - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - // Массив данных локации (адрес,пароль) - $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$aSDATA['unit'].'" LIMIT 1'); - $unit = $sql->get(); + // Массив данных локации (адрес,пароль) + $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$aSDATA['unit'].'" LIMIT 1'); + $unit = $sql->get(); - // Проверка ssh соединения с локацией - if(!$ssh->auth($unit['passwd'], $unit['address'])) - sys::outjs(array('e' => sys::text('error', 'ssh'))); + // Проверка ssh соединения с локацией + if(!$ssh->auth($unit['passwd'], $unit['address'])) + sys::outjs(array('e' => sys::text('error', 'ssh'))); - // Массив данных тарифа (путь сборки,путь установки) - $sql->query('SELECT `path`, `install`, `hostname` FROM `tarifs` WHERE `id`="'.$aSDATA['tarif'].'" LIMIT 1'); - $tarif = $sql->get(); + // Массив данных тарифа (путь сборки,путь установки) + $sql->query('SELECT `path`, `install`, `hostname` FROM `tarifs` WHERE `id`="'.$aSDATA['tarif'].'" LIMIT 1'); + $tarif = $sql->get(); - // Получение идентификаторов игрового сервера - $sql->query('INSERT INTO `servers` set uid="1"'); - $id = $sql->id(); - $uid = $id+1000; + // Получение идентификаторов игрового сервера + $sql->query('INSERT INTO `servers` set uid="1"'); + $id = $sql->id(); + $uid = $id+1000; - // Директория сборки - $path = $tarif['path'].$aSDATA['pack']; + // Директория сборки + $path = $tarif['path'].$aSDATA['pack']; - // Директория игрового сервера - $install = $tarif['install'].$uid; + // Директория игрового сервера + $install = $tarif['install'].$uid; - $ssh->set('mkdir '.$install.';' // Создание директории - .'useradd -s /bin/false -d '.$install.' -g servers -u '.$uid.' server'.$uid.';' // Создание пользователя сервера на локации - .'chown server'.$uid.':1000 '.$install.';' // Изменение владельца и группы директории - .'cd '.$install.' && sudo -u server'.$uid.' screen -dmS i_'.$uid.' sh -c "cp -r '.$path.'/. .;' // Копирование файлов сборки для сервера - .'find . -type d -exec chmod 700 {} \;;' - .'find . -type f -exec chmod 777 {} \;;' - .'chmod 500 '.params::$aFileGame['crmp'].'"'); + $ssh->set('mkdir '.$install.';' // Создание директории + .'useradd -s /bin/false -d '.$install.' -g servers -u '.$uid.' server'.$uid.';' // Создание пользователя сервера на локации + .'chown server'.$uid.':1000 '.$install.';' // Изменение владельца и группы директории + .'cd '.$install.' && sudo -u server'.$uid.' screen -dmS i_'.$uid.' sh -c "cp -r '.$path.'/. .;' // Копирование файлов сборки для сервера + .'find . -type d -exec chmod 700 {} \;;' + .'find . -type f -exec chmod 777 {} \;;' + .'chmod 500 '.params::$aFileGame['crmp'].'"'); - // Запись данных нового сервера - $sql->query('UPDATE `servers` set - `uid`="'.$uid.'", - `unit`="'.$aSDATA['unit'].'", - `tarif`="'.$aSDATA['tarif'].'", - `user`="'.$user['id'].'", - `address`="'.$aSDATA['address'].'", - `port`="'.$aSDATA['port'].'", - `game`="crmp", - `slots`="'.$aSDATA['slots'].'", - `slots_start`="'.$aSDATA['slots'].'", - `status`="install", - `name`="'.$tarif['hostname'].'", - `pack`="'.$aSDATA['pack'].'", - `plugins_use`="'.$aSDATA['plugins'].'", - `ftp_use`="'.$aSDATA['ftp'].'", - `console_use`="'.$aSDATA['console'].'", - `stats_use`="'.$aSDATA['stats'].'", - `copy_use`="'.$aSDATA['copy'].'", - `web_use`="'.$aSDATA['web'].'", - `vac`="1", - `hdd`="'.$aSDATA['hdd'].'", - `time`="'.$aSDATA['time'].'", - `date`="'.$start_point.'", - `test`="'.$aSDATA['test'].'", - `ram`="'.$aSDATA['ram'].'", - `map_start`="'.sys::passwd(8).'", - `core_fix`="'.$aSDATA['core_fix'].'", - `core_fix_one`="'.$aSDATA['core_fix_one'].'", - `autostop`="'.$aSDATA['autostop'].'" WHERE `id`="'.$id.'" LIMIT 1'); + // Запись данных нового сервера + $sql->query('UPDATE `servers` set + `uid`="'.$uid.'", + `unit`="'.$aSDATA['unit'].'", + `tarif`="'.$aSDATA['tarif'].'", + `user`="'.$user['id'].'", + `address`="'.$aSDATA['address'].'", + `port`="'.$aSDATA['port'].'", + `game`="crmp", + `slots`="'.$aSDATA['slots'].'", + `slots_start`="'.$aSDATA['slots'].'", + `status`="install", + `name`="'.$tarif['hostname'].'", + `pack`="'.$aSDATA['pack'].'", + `plugins_use`="'.$aSDATA['plugins'].'", + `ftp_use`="'.$aSDATA['ftp'].'", + `console_use`="'.$aSDATA['console'].'", + `stats_use`="'.$aSDATA['stats'].'", + `copy_use`="'.$aSDATA['copy'].'", + `web_use`="'.$aSDATA['web'].'", + `vac`="1", + `hdd`="'.$aSDATA['hdd'].'", + `time`="'.$aSDATA['time'].'", + `date`="'.$start_point.'", + `test`="'.$aSDATA['test'].'", + `ram`="'.$aSDATA['ram'].'", + `map_start`="'.sys::passwd(8).'", + `core_fix`="'.$aSDATA['core_fix'].'", + `core_fix_one`="'.$aSDATA['core_fix_one'].'", + `autostop`="'.$aSDATA['autostop'].'" WHERE `id`="'.$id.'" LIMIT 1'); - // Запись установленных плагинов - if($aSDATA['plugins']) - { - // Массив идентификаторов плагинов - $aPlugins = sys::b64djs($aSDATA['plugins_install']); + // Запись установленных плагинов + if($aSDATA['plugins']) + { + // Массив идентификаторов плагинов + $aPlugins = sys::b64djs($aSDATA['plugins_install']); - if(isset($aPlugins[$aSDATA['pack']])) - { - $plugins = explode(',', $aPlugins[$aSDATA['pack']]); + if(isset($aPlugins[$aSDATA['pack']])) + { + $plugins = explode(',', $aPlugins[$aSDATA['pack']]); - foreach($plugins as $plugin) - if($plugin) - $sql->query('INSERT INTO `plugins_install` set `server`="'.$id.'", `plugin`="'.$plugin.'", `time`="'.$start_point.'"'); - } - } + foreach($plugins as $plugin) + if($plugin) + $sql->query('INSERT INTO `plugins_install` set `server`="'.$id.'", `plugin`="'.$plugin.'", `time`="'.$start_point.'"'); + } + } - // Списание средств с баланса пользователя - $sql->query('UPDATE `users` set `balance`="'.($user['balance']-$aSDATA['sum']).'" WHERE `id`="'.$user['id'].'" LIMIT 1'); + // Списание средств с баланса пользователя + $sql->query('UPDATE `users` set `balance`="'.($user['balance']-$aSDATA['sum']).'" WHERE `id`="'.$user['id'].'" LIMIT 1'); - // Запись получения тестового периода - if($aSDATA['test']) - { - $sql->query('INSERT INTO `tests` set `server`="'.$id.'", `unit`="'.$aSDATA['unit'].'", `game`="crmp", `user`="'.$user['id'].'", `time`="'.$start_point.'"'); - $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="'.sys::updtext(sys::text('logs', 'buy_server_test'), array('id' => $id)).'", `date`="'.$start_point.'", `type`="buy", `money`="0"'); - }else{ - // Реф. система - games::part($user['id'], $aSDATA['sum']); + // Запись получения тестового периода + if($aSDATA['test']) + { + $sql->query('INSERT INTO `tests` set `server`="'.$id.'", `unit`="'.$aSDATA['unit'].'", `game`="crmp", `user`="'.$user['id'].'", `time`="'.$start_point.'"'); + $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="'.sys::updtext(sys::text('logs', 'buy_server_test'), array('id' => $id)).'", `date`="'.$start_point.'", `type`="buy", `money`="0"'); + }else{ + // Реф. система + games::part($user['id'], $aSDATA['sum']); - // Запись логов - if(!is_array($aSDATA['promo'])) - $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="'.sys::updtext(sys::text('logs', 'buy_server'), array('days' => games::parse_day($aSDATA['days'], true), 'money' => $aSDATA['sum'], 'id' => $id)).'", `date`="'.$start_point.'", `type`="buy", `money`="'.$aSDATA['sum'].'"'); - else{ - $sql->query('UPDATE `servers` set `benefit`="'.$aSDATA['time'].'" WHERE `id`="'.$id.'" LIMIT 1'); - $sql->query('INSERT INTO `promo_use` set `promo`="'.$aSDATA['promo']['id'].'", `user`="'.$user['id'].'", `time`="'.$start_point.'"'); - $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="'.sys::updtext(sys::text('logs', 'buy_server_promo'), array('days' => games::parse_day($aSDATA['days'], true), 'money' => $aSDATA['sum'], 'promo' => $aSDATA['promo']['cod'], 'id' => $id)).'", `date`="'.$start_point.'", `type`="buy", `money`="'.$aSDATA['sum'].'"'); - } - } + // Запись логов + if(!is_array($aSDATA['promo'])) + $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="'.sys::updtext(sys::text('logs', 'buy_server'), array('days' => games::parse_day($aSDATA['days'], true), 'money' => $aSDATA['sum'], 'id' => $id)).'", `date`="'.$start_point.'", `type`="buy", `money`="'.$aSDATA['sum'].'"'); + else{ + $sql->query('UPDATE `servers` set `benefit`="'.$aSDATA['time'].'" WHERE `id`="'.$id.'" LIMIT 1'); + $sql->query('INSERT INTO `promo_use` set `promo`="'.$aSDATA['promo']['id'].'", `user`="'.$user['id'].'", `time`="'.$start_point.'"'); + $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="'.sys::updtext(sys::text('logs', 'buy_server_promo'), array('days' => games::parse_day($aSDATA['days'], true), 'money' => $aSDATA['sum'], 'promo' => $aSDATA['promo']['cod'], 'id' => $id)).'", `date`="'.$start_point.'", `type`="buy", `money`="'.$aSDATA['sum'].'"'); + } + } - return $id; - } + return $id; + } } ?> \ No newline at end of file diff --git a/system/library/games/crmp/tarif.php b/system/library/games/crmp/tarif.php index a65da45..b61e6a3 100644 --- a/system/library/games/crmp/tarif.php +++ b/system/library/games/crmp/tarif.php @@ -1,179 +1,179 @@ get('extend', 'sections/servers/games/tarif'); + $html->get('extend', 'sections/servers/games/tarif'); - if(isset($html->arr['extend_address'])) - { - $html->unit('extend_address', 1); - $html->set('extend_address', $html->arr['extend_address']); - }else - $html->unit('extend_address'); + if(isset($html->arr['extend_address'])) + { + $html->unit('extend_address', 1); + $html->set('extend_address', $html->arr['extend_address']); + }else + $html->unit('extend_address'); - $html->set('id', $sid); - $html->set('time', sys::date('min', $server['time'])); - $html->set('options', ''.$options); - $html->set('slots', $server['slots']); - $html->set('info', ''); - $html->set('tarif', $tarif_name); - $html->set('cur', $cfg['currency']); + $html->set('id', $sid); + $html->set('time', sys::date('min', $server['time'])); + $html->set('options', ''.$options); + $html->set('slots', $server['slots']); + $html->set('info', ''); + $html->set('tarif', $tarif_name); + $html->set('cur', $cfg['currency']); - $html->pack('main'); + $html->pack('main'); - return NULL; - } + return NULL; + } public static function extend_sp($server, $tarif, $sid) { - global $cfg, $sql, $html, $start_point; + global $cfg, $sql, $html, $start_point; - tarifs::extend_address($server['game'], $sid); + tarifs::extend_address($server['game'], $sid); - $sum = $tarif['slots'] ? $tarif['price'] : $tarif['price']*$server['slots']; + $sum = $tarif['slots'] ? $tarif['price'] : $tarif['price']*$server['slots']; - $html->get('extend_sp', 'sections/servers/games/tarif'); + $html->get('extend_sp', 'sections/servers/games/tarif'); - if(isset($html->arr['extend_address'])) - { - $html->unit('extend_address', 1); - $html->set('extend_address', $html->arr['extend_address']); - }else - $html->unit('extend_address'); + if(isset($html->arr['extend_address'])) + { + $html->unit('extend_address', 1); + $html->set('extend_address', $html->arr['extend_address']); + }else + $html->unit('extend_address'); - $html->set('id', $sid); - $html->set('time', sys::date('min', $server['time'])); - $html->set('date', $server['time'] > $start_point ? 'Сервер продлен до: '.date('d.m.Y', $server['time']) : 'Текущая дата: '.date('d.m.Y', $start_point)); - $html->set('options', ''.$options); - $html->set('slots', $server['slots']); - $html->set('info', ''); - $html->set('tarif', $tarif['name']); - $html->set('sum', $sum); - $html->set('cur', $cfg['currency']); + $html->set('id', $sid); + $html->set('time', sys::date('min', $server['time'])); + $html->set('date', $server['time'] > $start_point ? 'Сервер продлен до: '.date('d.m.Y', $server['time']) : 'Текущая дата: '.date('d.m.Y', $start_point)); + $html->set('options', ''.$options); + $html->set('slots', $server['slots']); + $html->set('info', ''); + $html->set('tarif', $tarif['name']); + $html->set('sum', $sum); + $html->set('cur', $cfg['currency']); - $html->pack('main'); + $html->pack('main'); - return NULL; - } + return NULL; + } public static function plan() { - return NULL; - } + return NULL; + } - public static function unit($server, $unit_name, $tarif_name, $sid) + public static function unit($server, $unit_name, $tarif_name, $sid) { - global $cfg, $sql, $html; + global $cfg, $sql, $html; - if(!$cfg['change_unit'][$server['game']]) - return NULL; + if(!$cfg['change_unit'][$server['game']]) + return NULL; - $tarifs = $sql->query('SELECT `unit` FROM `tarifs` WHERE `game`="'.$server['game'].'" AND `name`="'.$tarif_name.'" AND `id`!="'.$server['tarif'].'" AND `show`="1" ORDER BY `unit`'); - if(!$sql->num($tarifs)) - return NULL; + $tarifs = $sql->query('SELECT `unit` FROM `tarifs` WHERE `game`="'.$server['game'].'" AND `name`="'.$tarif_name.'" AND `id`!="'.$server['tarif'].'" AND `show`="1" ORDER BY `unit`'); + if(!$sql->num($tarifs)) + return NULL; - $units = 0; + $units = 0; - $options = ''; + $options = ''; - while($tarif = $sql->get($tarifs)) - { - $sql->query('SELECT `id`, `name` FROM `units` WHERE `id`="'.$tarif['unit'].'" AND `show`="1" LIMIT 1'); - if(!$sql->num()) - continue; + while($tarif = $sql->get($tarifs)) + { + $sql->query('SELECT `id`, `name` FROM `units` WHERE `id`="'.$tarif['unit'].'" AND `show`="1" LIMIT 1'); + if(!$sql->num()) + continue; - $unit = $sql->get(); + $unit = $sql->get(); - $options .= ''; + $options .= ''; - $units+=1; - } + $units+=1; + } - if(!$units) - return NULL; + if(!$units) + return NULL; - $html->get('unit', 'sections/servers/games/tarif'); + $html->get('unit', 'sections/servers/games/tarif'); - $html->set('id', $sid); - $html->set('options', $options); - $html->set('slots', $server['slots']); - $html->set('info', ''); - $html->set('unit', $unit_name); - $html->set('tarif', $tarif_name); + $html->set('id', $sid); + $html->set('options', $options); + $html->set('slots', $server['slots']); + $html->set('info', ''); + $html->set('unit', $unit_name); + $html->set('tarif', $tarif_name); - $html->pack('main'); + $html->pack('main'); - return NULL; - } + return NULL; + } - public static function unit_new($tarif, $unit, $server, $mcache) - { - global $ssh, $sql, $user, $start_point; + public static function unit_new($tarif, $unit, $server, $mcache) + { + global $ssh, $sql, $user, $start_point; - // Проверка ssh соединения с локацией - if(!$ssh->auth($unit['passwd'], $unit['address'])) - sys::outjs(array('e' => sys::text('error', 'ssh'))); + // Проверка ssh соединения с локацией + if(!$ssh->auth($unit['passwd'], $unit['address'])) + sys::outjs(array('e' => sys::text('error', 'ssh'))); - // Директория сборки - $path = $tarif['path'].$tarif['pack']; + // Директория сборки + $path = $tarif['path'].$tarif['pack']; - // Директория игрового сервера - $install = $tarif['install'].$server['uid']; + // Директория игрового сервера + $install = $tarif['install'].$server['uid']; - // Пользователь сервера - $uS = 'server'.$server['uid']; + // Пользователь сервера + $uS = 'server'.$server['uid']; - $ssh->set('mkdir '.$install.';' // Создание директории - .'useradd -d '.$install.' -g servers -u '.$server['uid'].' '.$uS.';' // Создание пользователя сервера на локации - .'chown '.$uS.':1000 '.$install.';' // Изменение владельца и группы директории - .'cd '.$install.' && sudo -u '.$uS.' screen -dmS i_'.$server['uid'].' cp -r '.$path.'/. .'); // Копирование файлов сборки для сервера + $ssh->set('mkdir '.$install.';' // Создание директории + .'useradd -d '.$install.' -g servers -u '.$server['uid'].' '.$uS.';' // Создание пользователя сервера на локации + .'chown '.$uS.':1000 '.$install.';' // Изменение владельца и группы директории + .'cd '.$install.' && sudo -u '.$uS.' screen -dmS i_'.$server['uid'].' cp -r '.$path.'/. .'); // Копирование файлов сборки для сервера - $address = explode(':', $server['address']); + $address = explode(':', $server['address']); - $fix_one = $tarif['core_fix'] ? 1 : 0; + $fix_one = $tarif['core_fix'] ? 1 : 0; - // Обновление данных нового сервера - $sql->query('UPDATE `servers` set - `unit`="'.$tarif['unit'].'", - `tarif`="'.$tarif['id'].'", - `address`="'.$server['address'].'", - `port`="'.$address[1].'", - `status`="install", - `name`="'.$tarif['hostname'].'", - `pack`="'.$tarif['pack'].'", - `map_start`="'.$tarif['map'].'", - `hdd`="'.$tarif['hdd'].'", - `time`="'.$tarif['time'].'", - `autostop`="'.$tarif['autostop'].'", - `core_fix`="'.$tarif['core_fix'].'", - `core_fix_one`="'.$fix_one.'", - `reinstall`="'.$start_point.'" WHERE `id`="'.$server['id'].'" LIMIT 1'); + // Обновление данных нового сервера + $sql->query('UPDATE `servers` set + `unit`="'.$tarif['unit'].'", + `tarif`="'.$tarif['id'].'", + `address`="'.$server['address'].'", + `port`="'.$address[1].'", + `status`="install", + `name`="'.$tarif['hostname'].'", + `pack`="'.$tarif['pack'].'", + `map_start`="'.$tarif['map'].'", + `hdd`="'.$tarif['hdd'].'", + `time`="'.$tarif['time'].'", + `autostop`="'.$tarif['autostop'].'", + `core_fix`="'.$tarif['core_fix'].'", + `core_fix_one`="'.$fix_one.'", + `reinstall`="'.$start_point.'" WHERE `id`="'.$server['id'].'" LIMIT 1'); - // Запись установленных плагинов - if($tarif['plugins']) - { - // Массив идентификаторов плагинов - $aPlugins = sys::b64js($tarif['plugins_install']); + // Запись установленных плагинов + if($tarif['plugins']) + { + // Массив идентификаторов плагинов + $aPlugins = sys::b64js($tarif['plugins_install']); - if(isset($aPlugins[$tarif['pack']])) - { - $plugins = explode(',', $aPlugins[$tarif['pack']]); + if(isset($aPlugins[$tarif['pack']])) + { + $plugins = explode(',', $aPlugins[$tarif['pack']]); - foreach($plugins as $plugin) - if($plugin) - $sql->query('INSERT INTO `plugins_install` set `server`="'.$server['id'].'", `plugin`="'.$plugin.'", `time`="'.$start_point.'"'); - } - } + foreach($plugins as $plugin) + if($plugin) + $sql->query('INSERT INTO `plugins_install` set `server`="'.$server['id'].'", `plugin`="'.$plugin.'", `time`="'.$start_point.'"'); + } + } - return NULL; - } + return NULL; + } } ?> \ No newline at end of file diff --git a/system/library/games/cs/action.php b/system/library/games/cs/action.php index 76ada82..01bd54b 100644 --- a/system/library/games/cs/action.php +++ b/system/library/games/cs/action.php @@ -1,117 +1,117 @@ query('SELECT `uid`, `unit`, `tarif`, `game`, `address`, `slots_start`, `name`, `fps`, `map_start`, `vac`, `pingboost`, `time_start`, `core_fix` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `uid`, `unit`, `tarif`, `game`, `address`, `slots_start`, `name`, `fps`, `map_start`, `vac`, `pingboost`, `time_start`, `core_fix` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - $sql->query('SELECT `install` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); - $tarif = $sql->get(); + $sql->query('SELECT `install` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); + $tarif = $sql->get(); - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); - // Проверка ssh соедниения пу с локацией - if(!$ssh->auth($unit['passwd'], $unit['address'])) - return array('e' => sys::text('error', 'ssh')); + // Проверка ssh соедниения пу с локацией + if(!$ssh->auth($unit['passwd'], $unit['address'])) + return array('e' => sys::text('error', 'ssh')); - list($ip, $port) = explode(':', $server['address']); + list($ip, $port) = explode(':', $server['address']); - // Убить процессы - $ssh->set('kill -9 `ps aux | grep s_'.$server['uid'].' | grep -v grep | awk '."'{print $2}'".' | xargs;' - .'lsof -i@'.$server['address'].' | awk '."'{print $2}'".' | grep -v PID | xargs`; sudo -u server'.$server['uid'].' screen -wipe'); + // Убить процессы + $ssh->set('kill -9 `ps aux | grep s_'.$server['uid'].' | grep -v grep | awk '."'{print $2}'".' | xargs;' + .'lsof -i@'.$server['address'].' | awk '."'{print $2}'".' | grep -v PID | xargs`; sudo -u server'.$server['uid'].' screen -wipe'); - $taskset = ''; + $taskset = ''; - // Если включена система автораспределения и не установлен фиксированный поток - if($cfg['cpu_route'] AND !$server['core_fix']) - { - $proc_stat = array(); + // Если включена система автораспределения и не установлен фиксированный поток + if($cfg['cpu_route'] AND !$server['core_fix']) + { + $proc_stat = array(); - $proc_stat[0] = $ssh->get('cat /proc/stat'); - } + $proc_stat[0] = $ssh->get('cat /proc/stat'); + } - // Проверка наличия стартовой карты - $ssh->set('cd '.$tarif['install'].$server['uid'].'/cstrike/maps/ && ls | grep .bsp | grep -v .bsp.'); + // Проверка наличия стартовой карты + $ssh->set('cd '.$tarif['install'].$server['uid'].'/cstrike/maps/ && ls | grep .bsp | grep -v .bsp.'); - if($server['map_start'] != '' AND !in_array($server['map_start'], str_replace('.bsp', '', explode("\n", $ssh->get())))) - return array('e' => sys::updtext(sys::text('servers', 'nomap'), array('map' => $server['map_start'].'.bsp'))); + if($server['map_start'] != '' AND !in_array($server['map_start'], str_replace('.bsp', '', explode("\n", $ssh->get())))) + return array('e' => sys::updtext(sys::text('servers', 'nomap'), array('map' => $server['map_start'].'.bsp'))); - // Если система автораспределения продолжить парсинг загрузки процессора - if(isset($proc_stat)) - { - $proc_stat[1] = $ssh->get('cat /proc/stat'); + // Если система автораспределения продолжить парсинг загрузки процессора + if(isset($proc_stat)) + { + $proc_stat[1] = $ssh->get('cat /proc/stat'); - // Ядро/поток, на котором будет запущен игровой сервер (поток выбран с рассчетом наименьшей загруженности в момент запуска игрового сервера) - $core = sys::cpu_idle($proc_stat, $server['unit'], false); // число от 1 до n (где n число ядер/потоков в процессоре (без нулевого) + // Ядро/поток, на котором будет запущен игровой сервер (поток выбран с рассчетом наименьшей загруженности в момент запуска игрового сервера) + $core = sys::cpu_idle($proc_stat, $server['unit'], false); // число от 1 до n (где n число ядер/потоков в процессоре (без нулевого) - if(!is_numeric($core)) - return array('e' => sys::text('error', 'cpu')); + if(!is_numeric($core)) + return array('e' => sys::text('error', 'cpu')); - $taskset = 'taskset -c '.$core; - } + $taskset = 'taskset -c '.$core; + } - if($server['core_fix']) - { - $core = $server['core_fix']-1; - $taskset = 'taskset -c '.$core; - } + if($server['core_fix']) + { + $core = $server['core_fix']-1; + $taskset = 'taskset -c '.$core; + } - // Античит VAC - $vac = $server['vac'] == 0 ? '-insecure' : '-secure'; + // Античит VAC + $vac = $server['vac'] == 0 ? '-insecure' : '-secure'; - // Значение PingBoost - $pingboost = $server['pingboost'] == 0 ? $cfg['pingboost'] : $server['pingboost']; + // Значение PingBoost + $pingboost = $server['pingboost'] == 0 ? $cfg['pingboost'] : $server['pingboost']; - if(!$pingboost) - $pingboost = ''; - else - $pingboost = '-pingboost '.$pingboost; + if(!$pingboost) + $pingboost = ''; + else + $pingboost = '-pingboost '.$pingboost; - // Значение sys_ticrate (FPS) - $fps = $server['fps']+$cfg['fpsplus']; + // Значение sys_ticrate (FPS) + $fps = $server['fps']+$cfg['fpsplus']; - // Параметры запуска - $bash = './hlds_run -debug -game cstrike -norestart -condebug -sys_ticrate '.$fps.' +servercfgfile server.cfg +sys_ticrate '.$fps.' +map \''.$server['map_start'].'\' +maxplayers '.$server['slots_start'].' +ip '.$ip.' +port '.$port.' +sv_lan 0 '.$vac.' '.$pingboost; + // Параметры запуска + $bash = './hlds_run -debug -game cstrike -norestart -condebug -sys_ticrate '.$fps.' +servercfgfile server.cfg +sys_ticrate '.$fps.' +map \''.$server['map_start'].'\' +maxplayers '.$server['slots_start'].' +ip '.$ip.' +port '.$port.' +sv_lan 0 '.$vac.' '.$pingboost; - // Временный файл - $temp = sys::temp($bash); + // Временный файл + $temp = sys::temp($bash); - // Обновление файла start.sh - $ssh->setfile($temp, $tarif['install'].$server['uid'].'/start.sh', 0500); + // Обновление файла start.sh + $ssh->setfile($temp, $tarif['install'].$server['uid'].'/start.sh', 0500); - // Строка запуска - $ssh->set('cd '.$tarif['install'].$server['uid'].';' // переход в директорию игрового сервера - .'rm *.pid;' // Удаление *.pid файлов - .'sudo -u server'.$server['uid'].' mkdir -p cstrike/oldstart;' // Создание папки логов - .'cat cstrike/qconsole.log >> cstrike/oldstart/'.date('d.m.Y_H:i:s', $server['time_start']).'.log; rm cstrike/qconsole.log; rm cstrike/oldstart/01.01.1970_03:00:00.log;' // Перемещение лога предыдущего запуска - .'chown server'.$server['uid'].':1000 start.sh;' // Обновление владельца файла start.sh - .'sudo -u server'.$server['uid'].' screen -dmS s_'.$server['uid'].' '.$taskset.' sh -c ./start.sh'); // Запуск игровго сервера + // Строка запуска + $ssh->set('cd '.$tarif['install'].$server['uid'].';' // переход в директорию игрового сервера + .'rm *.pid;' // Удаление *.pid файлов + .'sudo -u server'.$server['uid'].' mkdir -p cstrike/oldstart;' // Создание папки логов + .'cat cstrike/qconsole.log >> cstrike/oldstart/'.date('d.m.Y_H:i:s', $server['time_start']).'.log; rm cstrike/qconsole.log; rm cstrike/oldstart/01.01.1970_03:00:00.log;' // Перемещение лога предыдущего запуска + .'chown server'.$server['uid'].':1000 start.sh;' // Обновление владельца файла start.sh + .'sudo -u server'.$server['uid'].' screen -dmS s_'.$server['uid'].' '.$taskset.' sh -c ./start.sh'); // Запуск игровго сервера - $core = !isset($core) ? 0 : $core+1; + $core = !isset($core) ? 0 : $core+1; - // Обновление информации в базе - $sql->query('UPDATE `servers` set `status`="'.$type.'", `online`="0", `players`="", `core_use`="'.$core.'", `time_start`="'.$start_point.'", `stop`="1" WHERE `id`="'.$id.'" LIMIT 1'); + // Обновление информации в базе + $sql->query('UPDATE `servers` set `status`="'.$type.'", `online`="0", `players`="", `core_use`="'.$core.'", `time_start`="'.$start_point.'", `stop`="1" WHERE `id`="'.$id.'" LIMIT 1'); - unlink($temp); + unlink($temp); - // Сброс кеша - actions::clmcache($id); + // Сброс кеша + actions::clmcache($id); - sys::reset_mcache('server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => $type, 'online' => 0, 'players' => '')); - sys::reset_mcache('server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => $type, 'online' => 0)); + sys::reset_mcache('server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => $type, 'online' => 0, 'players' => '')); + sys::reset_mcache('server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => $type, 'online' => 0)); - return array('s' => 'ok'); - } - } + return array('s' => 'ok'); + } + } ?> \ No newline at end of file diff --git a/system/library/games/cs/rcon.php b/system/library/games/cs/rcon.php index 0cf116a..0cc957a 100644 --- a/system/library/games/cs/rcon.php +++ b/system/library/games/cs/rcon.php @@ -1,110 +1,110 @@ Connect($ip, $port, 3, SourceQuery::GOLDSOURCE); + $sq->Connect($ip, $port, 3, SourceQuery::GOLDSOURCE); - $sq->SetRconPassword(rcon::rcon_passwd($server)); + $sq->SetRconPassword(rcon::rcon_passwd($server)); - $out = $sq->Rcon($cmd); + $out = $sq->Rcon($cmd); - $sq->Disconnect(); + $sq->Disconnect(); - return $out; - } + return $out; + } - public static function players($data) - { - $aPlayers = array(); - $n = 1; + public static function players($data) + { + $aPlayers = array(); + $n = 1; - $lines = explode("\n", $data); + $lines = explode("\n", $data); - foreach($lines as $line) - { - if(strpos($line, '#') === FALSE) - continue; + foreach($lines as $line) + { + if(strpos($line, '#') === FALSE) + continue; - $start = strpos($line, '"')+1; - $end = strrpos($line, '"'); + $start = strpos($line, '"')+1; + $end = strrpos($line, '"'); - $name = htmlspecialchars(substr($line, $start, $end-$start)); + $name = htmlspecialchars(substr($line, $start, $end-$start)); - $line = trim(substr($line, $end + 1)); + $line = trim(substr($line, $end + 1)); - $aData = array_values(array_diff(explode(' ', $line), array('', ' '))); + $aData = array_values(array_diff(explode(' ', $line), array('', ' '))); - $steamid = trim($aData[1]); - $ip = trim(sys::first(explode(':', $aData[6]))); + $steamid = trim($aData[1]); + $ip = trim(sys::first(explode(':', $aData[6]))); - if(sys::valid($steamid, 'steamid') || sys::valid($ip, 'ip')) - continue; + if(sys::valid($steamid, 'steamid') || sys::valid($ip, 'ip')) + continue; - $aPlayers[$n]['name'] = $name; - $aPlayers[$n]['steamid'] = $steamid; - $aPlayers[$n]['frags'] = trim($aData[2]); - $aPlayers[$n]['time'] = trim($aData[3]); - $aPlayers[$n]['ping'] = trim($aData[4]); - $aPlayers[$n]['ip'] = $ip; + $aPlayers[$n]['name'] = $name; + $aPlayers[$n]['steamid'] = $steamid; + $aPlayers[$n]['frags'] = trim($aData[2]); + $aPlayers[$n]['time'] = trim($aData[3]); + $aPlayers[$n]['ping'] = trim($aData[4]); + $aPlayers[$n]['ip'] = $ip; - $whois = rcon::country($ip); + $whois = rcon::country($ip); - $aPlayers[$n]['ico'] = $whois['ico']; - $aPlayers[$n]['country'] = $whois['name']; + $aPlayers[$n]['ico'] = $whois['ico']; + $aPlayers[$n]['country'] = $whois['name']; - $n+=1; - } + $n+=1; + } - return $aPlayers; - } + return $aPlayers; + } - public static function rcon_passwd($server) - { - global $cfg, $sql, $user; + public static function rcon_passwd($server) + { + global $cfg, $sql, $user; - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); $unit = $sql->get(); - if(!$ssh->auth($unit['passwd'], $unit['address'])) + if(!$ssh->auth($unit['passwd'], $unit['address'])) sys::outjs(array('e' => sys::text('error', 'ssh'))); - $sql->query('SELECT `install` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); - $tarif = $sql->get(); + $sql->query('SELECT `install` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); + $tarif = $sql->get(); - $ssh->set('cat '.$tarif['install'].$server['uid'].'/cstrike/server.cfg | grep rcon_password'); - $get = explode(' ', str_replace('"', '', trim($ssh->get()))); - $rcon = trim(end($get)); + $ssh->set('cat '.$tarif['install'].$server['uid'].'/cstrike/server.cfg | grep rcon_password'); + $get = explode(' ', str_replace('"', '', trim($ssh->get()))); + $rcon = trim(end($get)); - if(!isset($rcon{0})) - sys::outjs(array('r' => 'Необходимо установить rcon пароль (rcon_password).', 'url' => $cfg['http'].'servers/id/'.$server['id'].'/section/settings/subsection/server'), $nmch); + if(!isset($rcon{0})) + sys::outjs(array('r' => 'Необходимо установить rcon пароль (rcon_password).', 'url' => $cfg['http'].'servers/id/'.$server['id'].'/section/settings/subsection/server'), $nmch); - return $rcon; - } + return $rcon; + } - public static function country($ip) - { - global $SxGeo; + public static function country($ip) + { + global $SxGeo; - $cData = $SxGeo->getCityFull($ip); - $ico = sys::country($cData['country']['iso']); + $cData = $SxGeo->getCityFull($ip); + $ico = sys::country($cData['country']['iso']); - return array('ico' => $ico, 'name' => empty($cData['country']['name_ru']) ? 'Не определена' : $cData['country']['name_ru']); - } - } + return array('ico' => $ico, 'name' => empty($cData['country']['name_ru']) ? 'Не определена' : $cData['country']['name_ru']); + } + } ?> \ No newline at end of file diff --git a/system/library/games/cs/scan.php b/system/library/games/cs/scan.php index 59b6507..999aae1 100644 --- a/system/library/games/cs/scan.php +++ b/system/library/games/cs/scan.php @@ -1,140 +1,140 @@ get($nmch))) - return $mcache->get($nmch); + if(is_array($mcache->get($nmch))) + return $mcache->get($nmch); - $out = array(); + $out = array(); - $info = scan::info($sq, $id); + $info = scan::info($sq, $id); - $sql->query('SELECT `game`, `name`, `map`, `online`, `players`, `status`, `time`, `overdue` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `game`, `name`, `map`, `online`, `players`, `status`, `time`, `overdue` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - $out['time'] = 'Арендован до: '.date('d.m.Y - H:i', $server['time']); + $out['time'] = 'Арендован до: '.date('d.m.Y - H:i', $server['time']); - if($server['status'] == 'overdue') - $out['time_end'] = 'Удаление через: '.sys::date('min', $server['overdue']+$cfg['server_delete']*86400); - else - $out['time_end'] = 'Осталось: '.sys::date('min', $server['time']); + if($server['status'] == 'overdue') + $out['time_end'] = 'Удаление через: '.sys::date('min', $server['overdue']+$cfg['server_delete']*86400); + else + $out['time_end'] = 'Осталось: '.sys::date('min', $server['time']); - if(!$info['status']) - { - $out['name'] = $server['name']; - $out['status'] = sys::status($server['status'], $server['game'], $server['map']); - $out['online'] = $server['online']; - $out['image'] = ''; - $out['buttons'] = sys::buttons($id, $server['status']); + if(!$info['status']) + { + $out['name'] = $server['name']; + $out['status'] = sys::status($server['status'], $server['game'], $server['map']); + $out['online'] = $server['online']; + $out['image'] = ''; + $out['buttons'] = sys::buttons($id, $server['status']); - if($players_get) - $out['players'] = base64_decode($server['players']); + if($players_get) + $out['players'] = base64_decode($server['players']); - $mcache->set($nmch, $out, false, $cfg['mcache_server_mon']); + $mcache->set($nmch, $out, false, $cfg['mcache_server_mon']); - return $out; - } + return $out; + } - if($players_get) - $players = scan::info($sq, $id, true); + if($players_get) + $players = scan::info($sq, $id, true); - $out['name'] = htmlspecialchars($info['name']); - $out['status'] = sys::status('working', $server['game'], $info['map']); - $out['online'] = $info['online']; - $out['image'] = ''; - $out['buttons'] = sys::buttons($id, 'working'); - $out['players'] = ''; + $out['name'] = htmlspecialchars($info['name']); + $out['status'] = sys::status('working', $server['game'], $info['map']); + $out['online'] = $info['online']; + $out['image'] = ''; + $out['buttons'] = sys::buttons($id, 'working'); + $out['players'] = ''; - if($players_get) - { - foreach($players as $index => $player) - { - $html->get($server['game'], 'sections/servers/players'); + if($players_get) + { + foreach($players as $index => $player) + { + $html->get($server['game'], 'sections/servers/players'); - $html->set('i', $player['i']); - $html->set('name', $player['name']); - $html->set('score', $player['score']); - $html->set('time', $player['time']); + $html->set('i', $player['i']); + $html->set('name', $player['name']); + $html->set('score', $player['score']); + $html->set('time', $player['time']); - $html->pack('list'); - } + $html->pack('list'); + } - $out['players'] = isset($html->arr['list']) ? $html->arr['list'] : ''; - } + $out['players'] = isset($html->arr['list']) ? $html->arr['list'] : ''; + } - $sql->query('UPDATE `servers` set ' - .'`name`="'.$out['name'].'", ' - .'`online`="'.$out['online'].'", ' - .'`map`="'.$info['map'].'", ' - .'`status`="working" WHERE `id`="'.$id.'" LIMIT 1'); + $sql->query('UPDATE `servers` set ' + .'`name`="'.$out['name'].'", ' + .'`online`="'.$out['online'].'", ' + .'`map`="'.$info['map'].'", ' + .'`status`="working" WHERE `id`="'.$id.'" LIMIT 1'); - if($players_get) - $sql->query('UPDATE `servers` set `players`="'.base64_encode($out['players']).'" WHERE `id`="'.$id.'" LIMIT 1'); + if($players_get) + $sql->query('UPDATE `servers` set `players`="'.base64_encode($out['players']).'" WHERE `id`="'.$id.'" LIMIT 1'); - $mcache->set($nmch, $out, false, $cfg['mcache_server_mon']); + $mcache->set($nmch, $out, false, $cfg['mcache_server_mon']); - return $out; - } + return $out; + } - public static function info($sq, $id, $pl = false) - { - global $sql; + public static function info($sq, $id, $pl = false) + { + global $sql; - $sql->query('SELECT `address` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `address` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - list($ip, $port) = explode(':', $server['address']); + list($ip, $port) = explode(':', $server['address']); - $sq->Connect($ip, $port, 1, SourceQuery::GOLDSOURCE); + $sq->Connect($ip, $port, 1, SourceQuery::GOLDSOURCE); - if($pl) - { - $players = $sq->GetPlayers(); + if($pl) + { + $players = $sq->GetPlayers(); - $i = 1; - $data = array(); + $i = 1; + $data = array(); - foreach($players as $n => $player) - { - $data[$i]['i'] = $i; - $data[$i]['name'] = $player['Name'] == '' ? 'Подключается' : $player['Name']; - $data[$i]['score'] = $player['Frags']; - $data[$i]['time'] = $player['TimeF']; + foreach($players as $n => $player) + { + $data[$i]['i'] = $i; + $data[$i]['name'] = $player['Name'] == '' ? 'Подключается' : $player['Name']; + $data[$i]['score'] = $player['Frags']; + $data[$i]['time'] = $player['TimeF']; - $i+=1; - } + $i+=1; + } - return $data; - } + return $data; + } - $data = $sq->GetInfo(); + $data = $sq->GetInfo(); - $server['name'] = $data['HostName']; - $server['map'] = $data['Map']; - $server['online'] = $data['Players']; - $server['status'] = strlen($server['map']) > 3 ? true : false; + $server['name'] = $data['HostName']; + $server['map'] = $data['Map']; + $server['online'] = $data['Players']; + $server['status'] = strlen($server['map']) > 3 ? true : false; - return $server; - } - } + return $server; + } + } ?> \ No newline at end of file diff --git a/system/library/games/cs/service.php b/system/library/games/cs/service.php index 44655e0..952bc0c 100644 --- a/system/library/games/cs/service.php +++ b/system/library/games/cs/service.php @@ -1,368 +1,368 @@ query('SELECT `address`, `test` FROM `units` WHERE `id`="'.$aData['unit'].'" AND `cs`="1" AND `show`="1" LIMIT 1'); - if(!$sql->num()) - sys::outjs(array('e' => 'Локация не найдена.')); + // Проверка локации + $sql->query('SELECT `address`, `test` FROM `units` WHERE `id`="'.$aData['unit'].'" AND `cs`="1" AND `show`="1" LIMIT 1'); + if(!$sql->num()) + sys::outjs(array('e' => 'Локация не найдена.')); - $unit = $sql->get(); + $unit = $sql->get(); - // Проверка тарифа - $sql->query('SELECT `id` FROM `tarifs` WHERE `id`="'.$aData['tarif'].'" AND `unit`="'.$aData['unit'].'" AND `show`="1" LIMIT 1'); - if(!$sql->num()) - sys::outjs(array('e' => 'Тариф не найден.')); + // Проверка тарифа + $sql->query('SELECT `id` FROM `tarifs` WHERE `id`="'.$aData['tarif'].'" AND `unit`="'.$aData['unit'].'" AND `show`="1" LIMIT 1'); + if(!$sql->num()) + sys::outjs(array('e' => 'Тариф не найден.')); - $sql->query('SELECT ' - .'`slots_min`,' - .'`slots_max`,' - .'`port_min`,' - .'`port_max`,' - .'`hostname`,' - .'`packs`,' - .'`fps`,' - .'`time`,' - .'`test`,' - .'`tests`,' - .'`discount`,' - .'`map`,' - .'`ftp`,' - .'`plugins`,' - .'`console`,' - .'`stats`,' - .'`copy`,' - .'`web`,' - .'`plugins_install`,' - .'`hdd`,' - .'`autostop`,' - .'`core_fix`,' - .'`ip`,' - .'`price`' - .' FROM `tarifs` WHERE `id`="'.$aData['tarif'].'" LIMIT 1'); + $sql->query('SELECT ' + .'`slots_min`,' + .'`slots_max`,' + .'`port_min`,' + .'`port_max`,' + .'`hostname`,' + .'`packs`,' + .'`fps`,' + .'`time`,' + .'`test`,' + .'`tests`,' + .'`discount`,' + .'`map`,' + .'`ftp`,' + .'`plugins`,' + .'`console`,' + .'`stats`,' + .'`copy`,' + .'`web`,' + .'`plugins_install`,' + .'`hdd`,' + .'`autostop`,' + .'`core_fix`,' + .'`ip`,' + .'`price`' + .' FROM `tarifs` WHERE `id`="'.$aData['tarif'].'" LIMIT 1'); - $tarif = $sql->get(); + $tarif = $sql->get(); - // Проверка сборки - if(!array_key_exists($aData['pack'], sys::b64djs($tarif['packs'], true))) - sys::outjs(array('e' => 'Сборка не найдена.')); + // Проверка сборки + if(!array_key_exists($aData['pack'], sys::b64djs($tarif['packs'], true))) + sys::outjs(array('e' => 'Сборка не найдена.')); - // Проверка FPS - if(!in_array($aData['fps'], explode(':', $tarif['fps']))) - sys::outjs(array('e' => 'Переданные данные fps неверны.')); + // Проверка FPS + if(!in_array($aData['fps'], explode(':', $tarif['fps']))) + sys::outjs(array('e' => 'Переданные данные fps неверны.')); - $test = 0; + $test = 0; - // Проверка периода на тест - if($aData['test']) - { - if(!$tarif['test'] || !$unit['test']) - sys::outjs(array('e' => 'Тестовый период недоступен.')); + // Проверка периода на тест + if($aData['test']) + { + if(!$tarif['test'] || !$unit['test']) + sys::outjs(array('e' => 'Тестовый период недоступен.')); - // Проверка на повторный запрос - $sql->query('SELECT `id`, `game` FROM `tests` WHERE `user`="'.$user['id'].'" LIMIT 1'); - if($sql->num()) - { - $test_info = $sql->get(); + // Проверка на повторный запрос + $sql->query('SELECT `id`, `game` FROM `tests` WHERE `user`="'.$user['id'].'" LIMIT 1'); + if($sql->num()) + { + $test_info = $sql->get(); - if(!$cfg['tests']['game'] || $test_info['game'] == 'cs') - sys::outjs(array('e' => 'Тестовый период предоставляется один раз.')); + if(!$cfg['tests']['game'] || $test_info['game'] == 'cs') + sys::outjs(array('e' => 'Тестовый период предоставляется один раз.')); - $sql->query('SELECT `id` FROM `servers` WHERE `user`="'.$user['id'].'" AND `test`="1" LIMIT 1'); - if($sql->num() AND !$cfg['tests']['sametime']) - sys::outjs(array('e' => 'Чтобы получить тестовый период другой игры, дождитесь окончания текущего.')); - } + $sql->query('SELECT `id` FROM `servers` WHERE `user`="'.$user['id'].'" AND `test`="1" LIMIT 1'); + if($sql->num() AND !$cfg['tests']['sametime']) + sys::outjs(array('e' => 'Чтобы получить тестовый период другой игры, дождитесь окончания текущего.')); + } - // Проверка наличия мест на локации - $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND `test`="1" AND `time`>"'.$start_point.'" LIMIT '.$unit['test']); - if($sql->num() == $unit['test']) - sys::outjs(array('e' => 'Свободного места для тестового периода нет.')); + // Проверка наличия мест на локации + $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND `test`="1" AND `time`>"'.$start_point.'" LIMIT '.$unit['test']); + if($sql->num() == $unit['test']) + sys::outjs(array('e' => 'Свободного места для тестового периода нет.')); - // Проверка наличия мест для выбранного тарифа - $sql->query('SELECT `id` FROM `servers` WHERE `tarif`="'.$aData['tarif'].'" AND `test`="1" AND `time`>"'.$start_point.'" LIMIT '.$tarif['tests']); - if($sql->num() == $tarif['tests']) - sys::outjs(array('e' => 'Свободного места для тестового периода выбранного тарифа нет.')); + // Проверка наличия мест для выбранного тарифа + $sql->query('SELECT `id` FROM `servers` WHERE `tarif`="'.$aData['tarif'].'" AND `test`="1" AND `time`>"'.$start_point.'" LIMIT '.$tarif['tests']); + if($sql->num() == $tarif['tests']) + sys::outjs(array('e' => 'Свободного места для тестового периода выбранного тарифа нет.')); - $test = 1; - }else - // Проверка периода - if(!$cfg['settlement_period'] AND !in_array($aData['time'], explode(':', $tarif['time']))) - sys::outjs(array('e' => 'Переданные данные периода неверны.')); + $test = 1; + }else + // Проверка периода + if(!$cfg['settlement_period'] AND !in_array($aData['time'], explode(':', $tarif['time']))) + sys::outjs(array('e' => 'Переданные данные периода неверны.')); - // Проверка слот - if($aData['slots'] < $tarif['slots_min'] || $aData['slots'] > $tarif['slots_max']) - sys::outjs(array('e' => 'Переданные данные слот неверны.')); + // Проверка слот + if($aData['slots'] < $tarif['slots_min'] || $aData['slots'] > $tarif['slots_max']) + sys::outjs(array('e' => 'Переданные данные слот неверны.')); - // Определение цены - $aPrice = explode(':', $tarif['price']); - $price = $aPrice[array_search($aData['fps'], explode(':', $tarif['fps']))]; + // Определение цены + $aPrice = explode(':', $tarif['price']); + $price = $aPrice[array_search($aData['fps'], explode(':', $tarif['fps']))]; - // Определение суммы - if($cfg['settlement_period']) - { - // Цена аренды за расчетный период - $sum = games::define_sum($tarif['discount'], $price, $aData['slots'], $start_point); + // Определение суммы + if($cfg['settlement_period']) + { + // Цена аренды за расчетный период + $sum = games::define_sum($tarif['discount'], $price, $aData['slots'], $start_point); - $aData['time'] = games::define_period('buy', params::$aDayMonth); - }else - $sum = games::define_sum($tarif['discount'], $price, $aData['slots'], $aData['time']); + $aData['time'] = games::define_period('buy', params::$aDayMonth); + }else + $sum = games::define_sum($tarif['discount'], $price, $aData['slots'], $aData['time']); - // Проверка промо-кода - $promo = games::define_promo( - $aData['promo'], - array( - 'tarif' => $aData['tarif'], - 'fps' => $aData['fps'], - 'slots' => $aData['slots'], - 'time' => $aData['time'], - 'user' => $user['id'] - ), - $tarif['discount'], - $sum - ); + // Проверка промо-кода + $promo = games::define_promo( + $aData['promo'], + array( + 'tarif' => $aData['tarif'], + 'fps' => $aData['fps'], + 'slots' => $aData['slots'], + 'time' => $aData['time'], + 'user' => $user['id'] + ), + $tarif['discount'], + $sum + ); - $days = $aData['time']; // Кол-во дней аренды + $days = $aData['time']; // Кол-во дней аренды - // Использование промо-кода - if(is_array($promo)) - { - if(array_key_exists('sum', $promo)) - $sum = $promo['sum']; - else - $days += $promo['days']; // Кол-во дней аренды с учетом подарочных (промо-код) - } + // Использование промо-кода + if(is_array($promo)) + { + if(array_key_exists('sum', $promo)) + $sum = $promo['sum']; + else + $days += $promo['days']; // Кол-во дней аренды с учетом подарочных (промо-код) + } - // Проверка баланса - if($user['balance'] < $sum) - sys::outjs(array('e' => 'У вас не хватает '.(round($sum-$user['balance'], 2)).' '.$cfg['currency'])); + // Проверка баланса + if($user['balance'] < $sum) + sys::outjs(array('e' => 'У вас не хватает '.(round($sum-$user['balance'], 2)).' '.$cfg['currency'])); - // Выделенный адрес игрового сервера - if(!empty($tarif['ip'])) - { - $aIp = explode(':', $tarif['ip']); + // Выделенный адрес игрового сервера + if(!empty($tarif['ip'])) + { + $aIp = explode(':', $tarif['ip']); - $ip = false; - $port = params::$aDefPort['cs']; + $ip = false; + $port = params::$aDefPort['cs']; - // Проверка наличия свободного адреса - foreach($aIp as $adr) - { - $adr = trim($adr); + // Проверка наличия свободного адреса + foreach($aIp as $adr) + { + $adr = trim($adr); - $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND `address` LIKE "'.$adr.':%" LIMIT 1'); - if(!$sql->num()) - { - $ip = $adr; + $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND `address` LIKE "'.$adr.':%" LIMIT 1'); + if(!$sql->num()) + { + $ip = $adr; - break; - } - } - }else{ - $ip = sys::first(explode(':', $unit['address'])); - $port = false; + break; + } + } + }else{ + $ip = sys::first(explode(':', $unit['address'])); + $port = false; - // Проверка наличия свободного порта - for($tarif['port_min']; $tarif['port_min'] <= $tarif['port_max']; $tarif['port_min']+=1) - { - $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND (`address`="'.$ip.':'.$tarif['port_min'].'" OR `port`="'.$tarif['port_min'].'") LIMIT 1'); - if(!$sql->num()) - { - $port = $tarif['port_min']; + // Проверка наличия свободного порта + for($tarif['port_min']; $tarif['port_min'] <= $tarif['port_max']; $tarif['port_min']+=1) + { + $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND (`address`="'.$ip.':'.$tarif['port_min'].'" OR `port`="'.$tarif['port_min'].'") LIMIT 1'); + if(!$sql->num()) + { + $port = $tarif['port_min']; - break; - } - } - } + break; + } + } + } - if(!$ip || !$port) - { - $sql->query('UPDATE `tarifs` set `show`="0" WHERE `id`="'.$aData['tarif'].'" LIMIT 1'); + if(!$ip || !$port) + { + $sql->query('UPDATE `tarifs` set `show`="0" WHERE `id`="'.$aData['tarif'].'" LIMIT 1'); - sys::outjs(array('e' => 'К сожалению нет доступных мест, обратитесь в тех.поддержку.')); - } + sys::outjs(array('e' => 'К сожалению нет доступных мест, обратитесь в тех.поддержку.')); + } - if($test) - $aData['time'] = games::time($start_point, $tarif['test']); - else - $aData['time'] = games::time($start_point, $days); + if($test) + $aData['time'] = games::time($start_point, $tarif['test']); + else + $aData['time'] = games::time($start_point, $days); - $fix_one = 0; - $core = 0; + $fix_one = 0; + $core = 0; - if($tarif['core_fix'] != '') - { - $aCore = explode(',', $tarif['core_fix']); + if($tarif['core_fix'] != '') + { + $aCore = explode(',', $tarif['core_fix']); - foreach($aCore as $cpu) - { - $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND `core_fix`="'.$cpu.'" AND `core_fix_one`="1" LIMIT 1'); + foreach($aCore as $cpu) + { + $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND `core_fix`="'.$cpu.'" AND `core_fix_one`="1" LIMIT 1'); - if($sql->num()) - continue; + if($sql->num()) + continue; - $fix_one = 1; - $core = $cpu; + $fix_one = 1; + $core = $cpu; - break; - } + break; + } - if(!$core) - { - $sql->query('UPDATE `tarifs` set `show`="0" WHERE `id`="'.$aData['tarif'].'" LIMIT 1'); + if(!$core) + { + $sql->query('UPDATE `tarifs` set `show`="0" WHERE `id`="'.$aData['tarif'].'" LIMIT 1'); - sys::outjs(array('e' => 'К сожалению нет доступных мест, обратитесь в тех.поддержку.')); - } - } + sys::outjs(array('e' => 'К сожалению нет доступных мест, обратитесь в тех.поддержку.')); + } + } - $ram = $tarif['param_fix'] ? $aData['ram'] : $cfg['ram']['cs']*$aSDATA['slots']; + $ram = $tarif['param_fix'] ? $aData['ram'] : $cfg['ram']['cs']*$aSDATA['slots']; - // Массив данных - $aSDATA = array( - 'unit' => $aData['unit'], // идентификатор локации - 'tarif' => $aData['tarif'], // идентификатор тарифа - 'ram' => $ram, // значение ram - 'param_fix' => $tarif['param_fix'], // фиксированные параметры - 'fps' => $aData['fps'], // значение fps - 'pack' => $aData['pack'], // Выбранная сборка для установки - 'time' => $aData['time'], // Время аренды - 'days' => $days, // Число дней - 'sum' => $sum, // Сумма списания - 'test' => $test, // тестовый период - 'address' => $ip.':'.$port, // адрес игрового сервера - 'port' => $port, // порт игрового сервера - 'slots' => $aData['slots'], // Кол-во слот - 'map' => $tarif['map'], // Фиксированное значение слот - 'autostop' => $tarif['autostop'], // Выключение при 0 онлайне - 'ftp' => $tarif['ftp'], // Использование ftp - 'plugins' => $tarif['plugins'], // Использование плагинов - 'console' => $tarif['console'], // Использование консоли - 'stats' => $tarif['stats'], // Использование графиков (ведение статистики) - 'copy' => $tarif['copy'], // Использование резервных копий - 'web' => $tarif['web'], // Использование доп услуг - 'plugins_install' => $tarif['plugins_install'], // Список установленных плагинов - 'hdd' => $tarif['hdd'], // Дисковое пространство - 'core_fix' => $core, // Выделенный поток - 'core_fix_one' => $fix_one, // Выделенный поток - 'promo' => $promo // Использование промо-кода - ); + // Массив данных + $aSDATA = array( + 'unit' => $aData['unit'], // идентификатор локации + 'tarif' => $aData['tarif'], // идентификатор тарифа + 'ram' => $ram, // значение ram + 'param_fix' => $tarif['param_fix'], // фиксированные параметры + 'fps' => $aData['fps'], // значение fps + 'pack' => $aData['pack'], // Выбранная сборка для установки + 'time' => $aData['time'], // Время аренды + 'days' => $days, // Число дней + 'sum' => $sum, // Сумма списания + 'test' => $test, // тестовый период + 'address' => $ip.':'.$port, // адрес игрового сервера + 'port' => $port, // порт игрового сервера + 'slots' => $aData['slots'], // Кол-во слот + 'map' => $tarif['map'], // Фиксированное значение слот + 'autostop' => $tarif['autostop'], // Выключение при 0 онлайне + 'ftp' => $tarif['ftp'], // Использование ftp + 'plugins' => $tarif['plugins'], // Использование плагинов + 'console' => $tarif['console'], // Использование консоли + 'stats' => $tarif['stats'], // Использование графиков (ведение статистики) + 'copy' => $tarif['copy'], // Использование резервных копий + 'web' => $tarif['web'], // Использование доп услуг + 'plugins_install' => $tarif['plugins_install'], // Список установленных плагинов + 'hdd' => $tarif['hdd'], // Дисковое пространство + 'core_fix' => $core, // Выделенный поток + 'core_fix_one' => $fix_one, // Выделенный поток + 'promo' => $promo // Использование промо-кода + ); - return $aSDATA; - } + return $aSDATA; + } - public static function install($aSDATA = array()) - { - global $cfg, $sql, $user, $start_point; + public static function install($aSDATA = array()) + { + global $cfg, $sql, $user, $start_point; - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - // Массив данных локации (адрес,пароль) - $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$aSDATA['unit'].'" LIMIT 1'); - $unit = $sql->get(); + // Массив данных локации (адрес,пароль) + $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$aSDATA['unit'].'" LIMIT 1'); + $unit = $sql->get(); - // Проверка ssh соединения с локацией - if(!$ssh->auth($unit['passwd'], $unit['address'])) - sys::outjs(array('e' => sys::text('error', 'ssh'))); + // Проверка ssh соединения с локацией + if(!$ssh->auth($unit['passwd'], $unit['address'])) + sys::outjs(array('e' => sys::text('error', 'ssh'))); - // Массив данных тарифа (путь сборки,путь установки) - $sql->query('SELECT `path`, `install`, `hostname` FROM `tarifs` WHERE `id`="'.$aSDATA['tarif'].'" LIMIT 1'); - $tarif = $sql->get(); + // Массив данных тарифа (путь сборки,путь установки) + $sql->query('SELECT `path`, `install`, `hostname` FROM `tarifs` WHERE `id`="'.$aSDATA['tarif'].'" LIMIT 1'); + $tarif = $sql->get(); - // Получение идентификаторов игрового сервера - $sql->query('INSERT INTO `servers` set uid="1"'); - $id = $sql->id(); - $uid = $id+1000; + // Получение идентификаторов игрового сервера + $sql->query('INSERT INTO `servers` set uid="1"'); + $id = $sql->id(); + $uid = $id+1000; - // Директория сборки - $path = $tarif['path'].$aSDATA['pack']; + // Директория сборки + $path = $tarif['path'].$aSDATA['pack']; - // Директория игрового сервера - $install = $tarif['install'].$uid; + // Директория игрового сервера + $install = $tarif['install'].$uid; - $ssh->set('mkdir '.$install.';' // Создание директории - .'useradd -s /bin/false -d '.$install.' -g servers -u '.$uid.' server'.$uid.';' // Создание пользователя сервера на локации - .'chown server'.$uid.':1000 '.$install.';' // Изменение владельца и группы директории - .'cd '.$install.' && sudo -u server'.$uid.' screen -dmS i_'.$uid.' sh -c "cp -r '.$path.'/. .;' // Копирование файлов сборки для сервера - .'find . -type d -exec chmod 700 {} \;;' - .'find . -type f -exec chmod 600 {} \;;' - .'chmod 500 '.params::$aFileGame['cs'].'"'); + $ssh->set('mkdir '.$install.';' // Создание директории + .'useradd -s /bin/false -d '.$install.' -g servers -u '.$uid.' server'.$uid.';' // Создание пользователя сервера на локации + .'chown server'.$uid.':1000 '.$install.';' // Изменение владельца и группы директории + .'cd '.$install.' && sudo -u server'.$uid.' screen -dmS i_'.$uid.' sh -c "cp -r '.$path.'/. .;' // Копирование файлов сборки для сервера + .'find . -type d -exec chmod 700 {} \;;' + .'find . -type f -exec chmod 600 {} \;;' + .'chmod 500 '.params::$aFileGame['cs'].'"'); - // Запись данных нового сервера - $sql->query('UPDATE `servers` set - `uid`="'.$uid.'", - `unit`="'.$aSDATA['unit'].'", - `tarif`="'.$aSDATA['tarif'].'", - `user`="'.$user['id'].'", - `address`="'.$aSDATA['address'].'", - `port`="'.$aSDATA['port'].'", - `game`="cs", - `slots`="'.$aSDATA['slots'].'", - `slots_start`="'.$aSDATA['slots'].'", - `status`="install", - `name`="'.$tarif['hostname'].'", - `pack`="'.$aSDATA['pack'].'", - `plugins_use`="'.$aSDATA['plugins'].'", - `ftp_use`="'.$aSDATA['ftp'].'", - `console_use`="'.$aSDATA['console'].'", - `stats_use`="'.$aSDATA['stats'].'", - `copy_use`="'.$aSDATA['copy'].'", - `web_use`="'.$aSDATA['web'].'", - `fps`="'.$aSDATA['fps'].'", - `map_start`="'.$aSDATA['map'].'", - `vac`="1", - `hdd`="'.$aSDATA['hdd'].'", - `time`="'.$aSDATA['time'].'", - `date`="'.$start_point.'", - `test`="'.$aSDATA['test'].'", - `ram`="'.$aSDATA['ram'].'", - `core_fix`="'.$aSDATA['core_fix'].'", - `core_fix_one`="'.$aSDATA['core_fix_one'].'", - `autostop`="'.$aSDATA['autostop'].'" WHERE `id`="'.$id.'" LIMIT 1'); + // Запись данных нового сервера + $sql->query('UPDATE `servers` set + `uid`="'.$uid.'", + `unit`="'.$aSDATA['unit'].'", + `tarif`="'.$aSDATA['tarif'].'", + `user`="'.$user['id'].'", + `address`="'.$aSDATA['address'].'", + `port`="'.$aSDATA['port'].'", + `game`="cs", + `slots`="'.$aSDATA['slots'].'", + `slots_start`="'.$aSDATA['slots'].'", + `status`="install", + `name`="'.$tarif['hostname'].'", + `pack`="'.$aSDATA['pack'].'", + `plugins_use`="'.$aSDATA['plugins'].'", + `ftp_use`="'.$aSDATA['ftp'].'", + `console_use`="'.$aSDATA['console'].'", + `stats_use`="'.$aSDATA['stats'].'", + `copy_use`="'.$aSDATA['copy'].'", + `web_use`="'.$aSDATA['web'].'", + `fps`="'.$aSDATA['fps'].'", + `map_start`="'.$aSDATA['map'].'", + `vac`="1", + `hdd`="'.$aSDATA['hdd'].'", + `time`="'.$aSDATA['time'].'", + `date`="'.$start_point.'", + `test`="'.$aSDATA['test'].'", + `ram`="'.$aSDATA['ram'].'", + `core_fix`="'.$aSDATA['core_fix'].'", + `core_fix_one`="'.$aSDATA['core_fix_one'].'", + `autostop`="'.$aSDATA['autostop'].'" WHERE `id`="'.$id.'" LIMIT 1'); - // Запись установленных плагинов - if($aSDATA['plugins']) - { - // Массив идентификаторов плагинов - $aPlugins = sys::b64djs($aSDATA['plugins_install']); + // Запись установленных плагинов + if($aSDATA['plugins']) + { + // Массив идентификаторов плагинов + $aPlugins = sys::b64djs($aSDATA['plugins_install']); - if(isset($aPlugins[$aSDATA['pack']])) - { - $plugins = explode(',', $aPlugins[$aSDATA['pack']]); + if(isset($aPlugins[$aSDATA['pack']])) + { + $plugins = explode(',', $aPlugins[$aSDATA['pack']]); - foreach($plugins as $plugin) - if($plugin) - $sql->query('INSERT INTO `plugins_install` set `server`="'.$id.'", `plugin`="'.$plugin.'", `time`="'.$start_point.'"'); - } - } + foreach($plugins as $plugin) + if($plugin) + $sql->query('INSERT INTO `plugins_install` set `server`="'.$id.'", `plugin`="'.$plugin.'", `time`="'.$start_point.'"'); + } + } - // Списание средств с баланса пользователя - $sql->query('UPDATE `users` set `balance`="'.($user['balance']-$aSDATA['sum']).'" WHERE `id`="'.$user['id'].'" LIMIT 1'); + // Списание средств с баланса пользователя + $sql->query('UPDATE `users` set `balance`="'.($user['balance']-$aSDATA['sum']).'" WHERE `id`="'.$user['id'].'" LIMIT 1'); - // Запись получения тестового периода - if($aSDATA['test']) - { - $sql->query('INSERT INTO `tests` set `server`="'.$id.'", `unit`="'.$aSDATA['unit'].'", `game`="cs", `user`="'.$user['id'].'", `time`="'.$start_point.'"'); - $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="'.sys::updtext(sys::text('logs', 'buy_server_test'), array('id' => $id)).'", `date`="'.$start_point.'", `type`="buy", `money`="0"'); - }else{ - // Реф. система - games::part($user['id'], $aSDATA['sum']); + // Запись получения тестового периода + if($aSDATA['test']) + { + $sql->query('INSERT INTO `tests` set `server`="'.$id.'", `unit`="'.$aSDATA['unit'].'", `game`="cs", `user`="'.$user['id'].'", `time`="'.$start_point.'"'); + $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="'.sys::updtext(sys::text('logs', 'buy_server_test'), array('id' => $id)).'", `date`="'.$start_point.'", `type`="buy", `money`="0"'); + }else{ + // Реф. система + games::part($user['id'], $aSDATA['sum']); - // Запись логов - if(!is_array($aSDATA['promo'])) - $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="'.sys::updtext(sys::text('logs', 'buy_server'), array('days' => games::parse_day($aSDATA['days'], true), 'money' => $aSDATA['sum'], 'id' => $id)).'", `date`="'.$start_point.'", `type`="buy", `money`="'.$aSDATA['sum'].'"'); - else{ - $sql->query('UPDATE `servers` set `benefit`="'.$aSDATA['time'].'" WHERE `id`="'.$id.'" LIMIT 1'); - $sql->query('INSERT INTO `promo_use` set `promo`="'.$aSDATA['promo']['id'].'", `user`="'.$user['id'].'", `time`="'.$start_point.'"'); - $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="'.sys::updtext(sys::text('logs', 'buy_server_promo'), array('days' => games::parse_day($aSDATA['days'], true), 'money' => $aSDATA['sum'], 'promo' => $aSDATA['promo']['cod'], 'id' => $id)).'", `date`="'.$start_point.'", `type`="buy", `money`="'.$aSDATA['sum'].'"'); - } - } + // Запись логов + if(!is_array($aSDATA['promo'])) + $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="'.sys::updtext(sys::text('logs', 'buy_server'), array('days' => games::parse_day($aSDATA['days'], true), 'money' => $aSDATA['sum'], 'id' => $id)).'", `date`="'.$start_point.'", `type`="buy", `money`="'.$aSDATA['sum'].'"'); + else{ + $sql->query('UPDATE `servers` set `benefit`="'.$aSDATA['time'].'" WHERE `id`="'.$id.'" LIMIT 1'); + $sql->query('INSERT INTO `promo_use` set `promo`="'.$aSDATA['promo']['id'].'", `user`="'.$user['id'].'", `time`="'.$start_point.'"'); + $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="'.sys::updtext(sys::text('logs', 'buy_server_promo'), array('days' => games::parse_day($aSDATA['days'], true), 'money' => $aSDATA['sum'], 'promo' => $aSDATA['promo']['cod'], 'id' => $id)).'", `date`="'.$start_point.'", `type`="buy", `money`="'.$aSDATA['sum'].'"'); + } + } - return $id; - } + return $id; + } } ?> \ No newline at end of file diff --git a/system/library/games/cs/tarif.php b/system/library/games/cs/tarif.php index c571bc8..f8e5e7f 100644 --- a/system/library/games/cs/tarif.php +++ b/system/library/games/cs/tarif.php @@ -1,225 +1,225 @@ get('extend', 'sections/servers/games/tarif'); + $html->get('extend', 'sections/servers/games/tarif'); - if(isset($html->arr['extend_address'])) - { - $html->unit('extend_address', 1); - $html->set('extend_address', $html->arr['extend_address']); - }else - $html->unit('extend_address'); + if(isset($html->arr['extend_address'])) + { + $html->unit('extend_address', 1); + $html->set('extend_address', $html->arr['extend_address']); + }else + $html->unit('extend_address'); - $html->set('id', $sid); - $html->set('time', sys::date('min', $server['time'])); - $html->set('options', ''.$options); - $html->set('slots', $server['slots']); - $html->set('info', $server['fps'].' FPS'); - $html->set('tarif', $tarif_name); - $html->set('cur', $cfg['currency']); + $html->set('id', $sid); + $html->set('time', sys::date('min', $server['time'])); + $html->set('options', ''.$options); + $html->set('slots', $server['slots']); + $html->set('info', $server['fps'].' FPS'); + $html->set('tarif', $tarif_name); + $html->set('cur', $cfg['currency']); - $html->pack('main'); + $html->pack('main'); - return NULL; - } + return NULL; + } public static function extend_sp($server, $tarif, $sid) { - global $cfg, $sql, $html, $start_point; + global $cfg, $sql, $html, $start_point; - tarifs::extend_address($server['game'], $sid); + tarifs::extend_address($server['game'], $sid); - $aPrice = explode(':', $tarif['price']); - $aFPS = explode(':', $tarif['fps']); + $aPrice = explode(':', $tarif['price']); + $aFPS = explode(':', $tarif['fps']); - $sum = $tarif['slots'] ? $aPrice[array_search($server['fps'], $aFPS)] : $aPrice[array_search($server['fps'], $aFPS)]*$server['slots']; + $sum = $tarif['slots'] ? $aPrice[array_search($server['fps'], $aFPS)] : $aPrice[array_search($server['fps'], $aFPS)]*$server['slots']; - $html->get('extend_sp', 'sections/servers/games/tarif'); + $html->get('extend_sp', 'sections/servers/games/tarif'); - if(isset($html->arr['extend_address'])) - { - $html->unit('extend_address', 1); - $html->set('extend_address', $html->arr['extend_address']); - }else - $html->unit('extend_address'); + if(isset($html->arr['extend_address'])) + { + $html->unit('extend_address', 1); + $html->set('extend_address', $html->arr['extend_address']); + }else + $html->unit('extend_address'); - $html->set('id', $sid); - $html->set('time', sys::date('min', $server['time'])); - $html->set('date', $server['time'] > $start_point ? 'Сервер продлен до: '.date('d.m.Y', $server['time']) : 'Текущая дата: '.date('d.m.Y', $start_point)); - $html->set('options', ''.$options); - $html->set('slots', $server['slots']); - $html->set('info', $server['fps'].' FPS'); - $html->set('tarif', $tarif['name']); - $html->set('sum', $sum); - $html->set('cur', $cfg['currency']); + $html->set('id', $sid); + $html->set('time', sys::date('min', $server['time'])); + $html->set('date', $server['time'] > $start_point ? 'Сервер продлен до: '.date('d.m.Y', $server['time']) : 'Текущая дата: '.date('d.m.Y', $start_point)); + $html->set('options', ''.$options); + $html->set('slots', $server['slots']); + $html->set('info', $server['fps'].' FPS'); + $html->set('tarif', $tarif['name']); + $html->set('sum', $sum); + $html->set('cur', $cfg['currency']); - $html->pack('main'); + $html->pack('main'); - return NULL; - } + return NULL; + } public static function plan($server, $tarif_name, $sid) { - global $cfg, $sql, $html; + global $cfg, $sql, $html; - $sql->query('SELECT `fps`, `price` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); + $sql->query('SELECT `fps`, `price` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); - if(!$sql->num()) - return NULL; + if(!$sql->num()) + return NULL; - $tarif = $sql->get(); + $tarif = $sql->get(); - $options = ''; + $options = ''; - $aPrice = explode(':', $tarif['price']); - $aFps = explode(':', $tarif['fps']); + $aPrice = explode(':', $tarif['price']); + $aFps = explode(':', $tarif['fps']); - // Если есть выбор - if(count($aFps) > 1) - { - // Удалить при наличии fps сервера из выбора - if(in_array($server['fps'], $aFps)) - unset($aFps[array_search($server['fps'], $aFps)]); + // Если есть выбор + if(count($aFps) > 1) + { + // Удалить при наличии fps сервера из выбора + if(in_array($server['fps'], $aFps)) + unset($aFps[array_search($server['fps'], $aFps)]); - foreach($aFps as $index => $fps) - $options .= ''; - }else - return NULL; + foreach($aFps as $index => $fps) + $options .= ''; + }else + return NULL; - $html->get('plan', 'sections/servers/games/tarif'); + $html->get('plan', 'sections/servers/games/tarif'); - $html->set('id', $sid); - $html->set('options', $options); - $html->set('info', $server['fps'].' FPS'); - $html->set('tarif', $tarif_name); + $html->set('id', $sid); + $html->set('options', $options); + $html->set('info', $server['fps'].' FPS'); + $html->set('tarif', $tarif_name); - $html->pack('main'); + $html->pack('main'); - return NULL; - } + return NULL; + } - public static function unit($server, $unit_name, $tarif_name, $sid) + public static function unit($server, $unit_name, $tarif_name, $sid) { - global $cfg, $sql, $html; + global $cfg, $sql, $html; - if(!$cfg['change_unit'][$server['game']]) - return NULL; + if(!$cfg['change_unit'][$server['game']]) + return NULL; - $tarifs = $sql->query('SELECT `unit`, `fps` FROM `tarifs` WHERE `game`="'.$server['game'].'" AND `name`="'.$tarif_name.'" AND `id`!="'.$server['tarif'].'" AND `show`="1" ORDER BY `unit`'); - if(!$sql->num($tarifs)) - return NULL; + $tarifs = $sql->query('SELECT `unit`, `fps` FROM `tarifs` WHERE `game`="'.$server['game'].'" AND `name`="'.$tarif_name.'" AND `id`!="'.$server['tarif'].'" AND `show`="1" ORDER BY `unit`'); + if(!$sql->num($tarifs)) + return NULL; - $units = 0; + $units = 0; - $options = ''; + $options = ''; - while($tarif = $sql->get($tarifs)) - { - if(!in_array($server['fps'], explode(':', $tarif['fps']))) - continue; + while($tarif = $sql->get($tarifs)) + { + if(!in_array($server['fps'], explode(':', $tarif['fps']))) + continue; - $sql->query('SELECT `id`, `name` FROM `units` WHERE `id`="'.$tarif['unit'].'" AND `show`="1" LIMIT 1'); - if(!$sql->num()) - continue; + $sql->query('SELECT `id`, `name` FROM `units` WHERE `id`="'.$tarif['unit'].'" AND `show`="1" LIMIT 1'); + if(!$sql->num()) + continue; - $unit = $sql->get(); + $unit = $sql->get(); - $options .= ''; + $options .= ''; - $units+=1; - } + $units+=1; + } - if(!$units) - return NULL; + if(!$units) + return NULL; - $html->get('unit', 'sections/servers/games/tarif'); + $html->get('unit', 'sections/servers/games/tarif'); - $html->set('id', $sid); - $html->set('options', $options); - $html->set('slots', $server['slots']); - $html->set('info', $server['fps'].' FPS'); - $html->set('unit', $unit_name); - $html->set('tarif', $tarif_name); + $html->set('id', $sid); + $html->set('options', $options); + $html->set('slots', $server['slots']); + $html->set('info', $server['fps'].' FPS'); + $html->set('unit', $unit_name); + $html->set('tarif', $tarif_name); - $html->pack('main'); + $html->pack('main'); - return NULL; - } + return NULL; + } - public static function unit_new($tarif, $unit, $server, $mcache) - { - global $ssh, $sql, $user, $start_point; + public static function unit_new($tarif, $unit, $server, $mcache) + { + global $ssh, $sql, $user, $start_point; - // Проверка ssh соединения с локацией - if(!$ssh->auth($unit['passwd'], $unit['address'])) - sys::outjs(array('e' => sys::text('error', 'ssh'))); + // Проверка ssh соединения с локацией + if(!$ssh->auth($unit['passwd'], $unit['address'])) + sys::outjs(array('e' => sys::text('error', 'ssh'))); - // Директория сборки - $path = $tarif['path'].$tarif['pack']; + // Директория сборки + $path = $tarif['path'].$tarif['pack']; - // Директория игрового сервера - $install = $tarif['install'].$server['uid']; + // Директория игрового сервера + $install = $tarif['install'].$server['uid']; - // Пользователь сервера - $uS = 'server'.$server['uid']; + // Пользователь сервера + $uS = 'server'.$server['uid']; - $ssh->set('mkdir '.$install.';' // Создание директории - .'useradd -d '.$install.' -g servers -u '.$server['uid'].' '.$uS.';' // Создание пользователя сервера на локации - .'chown '.$uS.':1000 '.$install.';' // Изменение владельца и группы директории - .'cd '.$install.' && sudo -u '.$uS.' screen -dmS i_'.$server['uid'].' cp -r '.$path.'/. .'); // Копирование файлов сборки для сервера + $ssh->set('mkdir '.$install.';' // Создание директории + .'useradd -d '.$install.' -g servers -u '.$server['uid'].' '.$uS.';' // Создание пользователя сервера на локации + .'chown '.$uS.':1000 '.$install.';' // Изменение владельца и группы директории + .'cd '.$install.' && sudo -u '.$uS.' screen -dmS i_'.$server['uid'].' cp -r '.$path.'/. .'); // Копирование файлов сборки для сервера - $address = explode(':', $server['address']); + $address = explode(':', $server['address']); - $fix_one = $tarif['core_fix'] ? 1 : 0; + $fix_one = $tarif['core_fix'] ? 1 : 0; - // Обновление данных нового сервера - $sql->query('UPDATE `servers` set - `unit`="'.$tarif['unit'].'", - `tarif`="'.$tarif['id'].'", - `address`="'.$server['address'].'", - `port`="'.$address[1].'", - `status`="install", - `name`="'.$tarif['hostname'].'", - `pack`="'.$tarif['pack'].'", - `map_start`="'.$tarif['map'].'", - `vac`="1", - `hdd`="'.$tarif['hdd'].'", - `time`="'.$tarif['time'].'", - `autostop`="'.$tarif['autostop'].'", - `core_fix`="'.$tarif['core_fix'].'", - `core_fix_one`="'.$fix_one.'", - `reinstall`="'.$start_point.'" WHERE `id`="'.$server['id'].'" LIMIT 1'); + // Обновление данных нового сервера + $sql->query('UPDATE `servers` set + `unit`="'.$tarif['unit'].'", + `tarif`="'.$tarif['id'].'", + `address`="'.$server['address'].'", + `port`="'.$address[1].'", + `status`="install", + `name`="'.$tarif['hostname'].'", + `pack`="'.$tarif['pack'].'", + `map_start`="'.$tarif['map'].'", + `vac`="1", + `hdd`="'.$tarif['hdd'].'", + `time`="'.$tarif['time'].'", + `autostop`="'.$tarif['autostop'].'", + `core_fix`="'.$tarif['core_fix'].'", + `core_fix_one`="'.$fix_one.'", + `reinstall`="'.$start_point.'" WHERE `id`="'.$server['id'].'" LIMIT 1'); - // Запись установленных плагинов - if($tarif['plugins']) - { - // Массив идентификаторов плагинов - $aPlugins = sys::b64js($tarif['plugins_install']); + // Запись установленных плагинов + if($tarif['plugins']) + { + // Массив идентификаторов плагинов + $aPlugins = sys::b64js($tarif['plugins_install']); - if(isset($aPlugins[$tarif['pack']])) - { - $plugins = explode(',', $aPlugins[$tarif['pack']]); + if(isset($aPlugins[$tarif['pack']])) + { + $plugins = explode(',', $aPlugins[$tarif['pack']]); - foreach($plugins as $plugin) - if($plugin) - $sql->query('INSERT INTO `plugins_install` set `server`="'.$server['id'].'", `plugin`="'.$plugin.'", `time`="'.$start_point.'"'); - } - } + foreach($plugins as $plugin) + if($plugin) + $sql->query('INSERT INTO `plugins_install` set `server`="'.$server['id'].'", `plugin`="'.$plugin.'", `time`="'.$start_point.'"'); + } + } - return NULL; - } + return NULL; + } } ?> \ No newline at end of file diff --git a/system/library/games/csgo/action.php b/system/library/games/csgo/action.php index ab3c467..c3d83d2 100644 --- a/system/library/games/csgo/action.php +++ b/system/library/games/csgo/action.php @@ -1,302 +1,302 @@ query('SELECT `uid`, `unit`, `tarif`, `game`, `address`, `slots_start`, `name`, `tickrate`, `map_start`, `vac`, `time_start`, `core_fix`, `pingboost` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `uid`, `unit`, `tarif`, `game`, `address`, `slots_start`, `name`, `tickrate`, `map_start`, `vac`, `time_start`, `core_fix`, `pingboost` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - $sql->query('SELECT `install` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); + $sql->query('SELECT `install` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); $tarif = $sql->get(); - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); - // Проверка ssh соедниения пу с локацией - if(!$ssh->auth($unit['passwd'], $unit['address'])) - return array('e' => sys::text('error', 'ssh')); + // Проверка ssh соедниения пу с локацией + if(!$ssh->auth($unit['passwd'], $unit['address'])) + return array('e' => sys::text('error', 'ssh')); - list($ip, $port) = explode(':', $server['address']); + list($ip, $port) = explode(':', $server['address']); - // Убить процессы - $ssh->set('kill -9 `ps aux | grep s_'.$server['uid'].' | grep -v grep | awk '."'{print $2}'".' | xargs;' - .'lsof -i@'.$server['address'].' | awk '."'{print $2}'".' | grep -v PID | xargs`; sudo -u server'.$server['uid'].' screen -wipe'); + // Убить процессы + $ssh->set('kill -9 `ps aux | grep s_'.$server['uid'].' | grep -v grep | awk '."'{print $2}'".' | xargs;' + .'lsof -i@'.$server['address'].' | awk '."'{print $2}'".' | grep -v PID | xargs`; sudo -u server'.$server['uid'].' screen -wipe'); - $taskset = ''; + $taskset = ''; - // Если включена система автораспределения и не установлен фиксированный поток - if($cfg['cpu_route'] AND !$server['core_fix']) - { - $proc_stat = array(); + // Если включена система автораспределения и не установлен фиксированный поток + if($cfg['cpu_route'] AND !$server['core_fix']) + { + $proc_stat = array(); - $proc_stat[0] = $ssh->get('cat /proc/stat'); - } + $proc_stat[0] = $ssh->get('cat /proc/stat'); + } - // Проверка наличия стартовой карты - $ssh->set('cd '.$tarif['install'].$server['uid'].'/csgo/maps/ && du -ah | grep -e "\.bsp$" | awk \'{print $2}\''); + // Проверка наличия стартовой карты + $ssh->set('cd '.$tarif['install'].$server['uid'].'/csgo/maps/ && du -ah | grep -e "\.bsp$" | awk \'{print $2}\''); - include_once(LIB.'games/games.php'); + include_once(LIB.'games/games.php'); - if(games::map($server['map_start'], $ssh->get())) - return array('e' => sys::updtext(sys::text('servers', 'nomap'), array('map' => $server['map_start'].'.bsp'))); + if(games::map($server['map_start'], $ssh->get())) + return array('e' => sys::updtext(sys::text('servers', 'nomap'), array('map' => $server['map_start'].'.bsp'))); - // Если система автораспределения продолжить парсинг загрузки процессора - if(isset($proc_stat)) - { - $proc_stat[1] = $ssh->get('cat /proc/stat'); + // Если система автораспределения продолжить парсинг загрузки процессора + if(isset($proc_stat)) + { + $proc_stat[1] = $ssh->get('cat /proc/stat'); - // Ядро/поток, на котором будет запущен игровой сервер (поток выбран с рассчетом наименьшей загруженности в момент запуска игрового сервера) - $core = sys::cpu_idle($proc_stat, $server['unit'], false); // число от 1 до n (где n число ядер/потоков в процессоре (без нулевого) + // Ядро/поток, на котором будет запущен игровой сервер (поток выбран с рассчетом наименьшей загруженности в момент запуска игрового сервера) + $core = sys::cpu_idle($proc_stat, $server['unit'], false); // число от 1 до n (где n число ядер/потоков в процессоре (без нулевого) - if(!is_numeric($core)) - return array('e' => sys::text('error', 'cpu')); + if(!is_numeric($core)) + return array('e' => sys::text('error', 'cpu')); - $taskset = 'taskset -c '.$core; - } + $taskset = 'taskset -c '.$core; + } - if($server['core_fix']) - { - $core = $server['core_fix']-1; - $taskset = 'taskset -c '.$core; - } + if($server['core_fix']) + { + $core = $server['core_fix']-1; + $taskset = 'taskset -c '.$core; + } - // Античит VAC - $vac = $server['vac'] == 0 ? '-insecure' : '-secure'; + // Античит VAC + $vac = $server['vac'] == 0 ? '-insecure' : '-secure'; - // Боты - $bots = $cfg['bots'][$server['game']] ? '' : '-nobots'; + // Боты + $bots = $cfg['bots'][$server['game']] ? '' : '-nobots'; - // TV - $tv = $server['tv'] ? '+tv_enable 1 +tv_maxclients 30 +tv_port '.($port+10000) : '-nohltv'; + // TV + $tv = $server['tv'] ? '+tv_enable 1 +tv_maxclients 30 +tv_port '.($port+10000) : '-nohltv'; - $check = explode('/', $server['map_start']); + $check = explode('/', $server['map_start']); - // Стартовая карта - $map = $check[0] == 'workshop' ? '+workshop_start_map '.$check[1] : '+map \''.$server['map_start'].'\''; + // Стартовая карта + $map = $check[0] == 'workshop' ? '+workshop_start_map '.$check[1] : '+map \''.$server['map_start'].'\''; - // Игровой режим - $mods = array( - 1 => '+game_type 0 +game_mode 0', - 2 => '+game_type 0 +game_mode 1', - 3 => '+game_type 1 +game_mode 0', - 4 => '+game_type 1 +game_mode 1', - 5 => '+game_type 1 +game_mode 2' - ); + // Игровой режим + $mods = array( + 1 => '+game_type 0 +game_mode 0', + 2 => '+game_type 0 +game_mode 1', + 3 => '+game_type 1 +game_mode 0', + 4 => '+game_type 1 +game_mode 1', + 5 => '+game_type 1 +game_mode 2' + ); - $mod = !$server['pingboost'] ? $mods[2] : $mods[$server['pingboost']]; + $mod = !$server['pingboost'] ? $mods[2] : $mods[$server['pingboost']]; - // Параметры запуска - $bash = './srcds_run -debug -game csgo -norestart -condebug console.log -usercon -tickrate '.$server['tickrate'].' '.$mod.' +servercfgfile server.cfg '.$map.' -maxplayers_override '.$server['slots_start'].' +ip '.$ip.' +net_public_adr '.$ip.' +port '.$port.' -sv_lan 0 '.$vac.' '.$bots.' '.$tv; + // Параметры запуска + $bash = './srcds_run -debug -game csgo -norestart -condebug console.log -usercon -tickrate '.$server['tickrate'].' '.$mod.' +servercfgfile server.cfg '.$map.' -maxplayers_override '.$server['slots_start'].' +ip '.$ip.' +net_public_adr '.$ip.' +port '.$port.' -sv_lan 0 '.$vac.' '.$bots.' '.$tv; - // Временный файл - $temp = sys::temp($bash); + // Временный файл + $temp = sys::temp($bash); - // Обновление файла start.sh - $ssh->setfile($temp, $tarif['install'].$server['uid'].'/start.sh', 0500); + // Обновление файла start.sh + $ssh->setfile($temp, $tarif['install'].$server['uid'].'/start.sh', 0500); - // Строка запуска - $ssh->set('cd '.$tarif['install'].$server['uid'].';' // переход в директорию игрового сервера - .'rm *.pid;' // Удаление *.pid файлов - .'sudo -u server'.$server['uid'].' mkdir -p csgo/oldstart;' // Создание папки логов - .'cat csgo/console.log >> csgo/oldstart/'.date('d.m.Y_H:i:s', $server['time_start']).'.log; rm csgo/console.log; rm csgo/oldstart/01.01.1970_03:00:00.log;' // Перемещение лога предыдущего запуска - .'chown server'.$server['uid'].':1000 start.sh;' // Обновление владельца файла start.sh - .'sudo -u server'.$server['uid'].' screen -dmS s_'.$server['uid'].' '.$taskset.' sh -c "./start.sh"'); // Запуск игровго сервера + // Строка запуска + $ssh->set('cd '.$tarif['install'].$server['uid'].';' // переход в директорию игрового сервера + .'rm *.pid;' // Удаление *.pid файлов + .'sudo -u server'.$server['uid'].' mkdir -p csgo/oldstart;' // Создание папки логов + .'cat csgo/console.log >> csgo/oldstart/'.date('d.m.Y_H:i:s', $server['time_start']).'.log; rm csgo/console.log; rm csgo/oldstart/01.01.1970_03:00:00.log;' // Перемещение лога предыдущего запуска + .'chown server'.$server['uid'].':1000 start.sh;' // Обновление владельца файла start.sh + .'sudo -u server'.$server['uid'].' screen -dmS s_'.$server['uid'].' '.$taskset.' sh -c "./start.sh"'); // Запуск игровго сервера - $core = !isset($core) ? 0 : $core+1; + $core = !isset($core) ? 0 : $core+1; - // Обновление информации в базе - $sql->query('UPDATE `servers` set `status`="'.$type.'", `online`="0", `players`="", `core_use`="'.$core.'", `time_start`="'.$start_point.'", `stop`="1" WHERE `id`="'.$id.'" LIMIT 1'); + // Обновление информации в базе + $sql->query('UPDATE `servers` set `status`="'.$type.'", `online`="0", `players`="", `core_use`="'.$core.'", `time_start`="'.$start_point.'", `stop`="1" WHERE `id`="'.$id.'" LIMIT 1'); - unlink($temp); + unlink($temp); - // Сброс кеша - actions::clmcache($id); + // Сброс кеша + actions::clmcache($id); - sys::reset_mcache('server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => $type, 'online' => 0, 'players' => '')); - sys::reset_mcache('server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => $type, 'online' => 0)); + sys::reset_mcache('server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => $type, 'online' => 0, 'players' => '')); + sys::reset_mcache('server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => $type, 'online' => 0)); - return array('s' => 'ok'); - } + return array('s' => 'ok'); + } public static function change($id, $map = false) { - global $cfg, $sql, $html, $user, $mcache; + global $cfg, $sql, $html, $user, $mcache; - // Если в кеше есть карты - if($mcache->get('server_maps_change_'.$id) != '' AND !$map) - return array('maps' => $mcache->get('server_maps_change_'.$id)); + // Если в кеше есть карты + if($mcache->get('server_maps_change_'.$id) != '' AND !$map) + return array('maps' => $mcache->get('server_maps_change_'.$id)); - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - include(LIB.'games/games.php'); + include(LIB.'games/games.php'); - $sql->query('SELECT `uid`, `unit`, `game`, `tarif`, `online`, `players`, `name` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `uid`, `unit`, `game`, `tarif`, `online`, `players`, `name` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); $unit = $sql->get(); - $sql->query('SELECT `install` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); + $sql->query('SELECT `install` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); $tarif = $sql->get(); - // Проверка ssh соедниения пу с локацией + // Проверка ssh соедниения пу с локацией if(!$ssh->auth($unit['passwd'], $unit['address'])) return array('e' => sys::text('error', 'ssh')); - // Массив карт игрового сервера (папка "maps") - $aMaps = explode("\n", $ssh->get('cd '.$tarif['install'].$server['uid'].'/csgo/maps/ && du -ah | grep -e "\.bsp$" | awk \'{print $2}\'')); + // Массив карт игрового сервера (папка "maps") + $aMaps = explode("\n", $ssh->get('cd '.$tarif['install'].$server['uid'].'/csgo/maps/ && du -ah | grep -e "\.bsp$" | awk \'{print $2}\'')); - // Удаление пустого элемента - unset($aMaps[count($aMaps)-1]); + // Удаление пустого элемента + unset($aMaps[count($aMaps)-1]); - // Удаление ".bsp" - $aMaps = str_ireplace(array('./', '.bsp'), '', $aMaps); + // Удаление ".bsp" + $aMaps = str_ireplace(array('./', '.bsp'), '', $aMaps); - // Если выбрана карта - if($map) - { - $map = str_replace('|', '/', $map); + // Если выбрана карта + if($map) + { + $map = str_replace('|', '/', $map); - // Проверка наличия выбранной карты - if(games::map($map, $aMaps)) - return array('e' => sys::updtext(sys::text('servers', 'change'), array('map' => $map.'.bsp'))); + // Проверка наличия выбранной карты + if(games::map($map, $aMaps)) + return array('e' => sys::updtext(sys::text('servers', 'change'), array('map' => $map.'.bsp'))); - // Отправка команды changelevel - $ssh->set('sudo -u server'.$server['uid'].' screen -p 0 -S s_'.$server['uid'].' -X eval '."'stuff \"changelevel ".sys::cmd($map)."\"\015'"); + // Отправка команды changelevel + $ssh->set('sudo -u server'.$server['uid'].' screen -p 0 -S s_'.$server['uid'].' -X eval '."'stuff \"changelevel ".sys::cmd($map)."\"\015'"); - // Обновление информации в базе - $sql->query('UPDATE `servers` set `status`="change" WHERE `id`="'.$id.'" LIMIT 1'); + // Обновление информации в базе + $sql->query('UPDATE `servers` set `status`="change" WHERE `id`="'.$id.'" LIMIT 1'); - // Сброс кеша - actions::clmcache($id); + // Сброс кеша + actions::clmcache($id); - sys::reset_mcache('server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'change', 'online' => $server['online'], 'players' => base64_decode($server['players']))); - sys::reset_mcache('server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'change', 'online' => $server['online'])); + sys::reset_mcache('server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'change', 'online' => $server['online'], 'players' => base64_decode($server['players']))); + sys::reset_mcache('server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'change', 'online' => $server['online'])); - return array('s' => 'ok'); - } + return array('s' => 'ok'); + } - // Сортировка списка карт - sort($aMaps); - reset($aMaps); + // Сортировка списка карт + sort($aMaps); + reset($aMaps); - // Генерация списка карт для выбора - foreach($aMaps as $map) - { - $aName = explode('/', $map); - $name = end($aName); + // Генерация списка карт для выбора + foreach($aMaps as $map) + { + $aName = explode('/', $map); + $name = end($aName); - $html->get('change_list', 'sections/servers/csgo'); + $html->get('change_list', 'sections/servers/csgo'); - $html->set('img', file_exists(DIR.'/maps/'.$server['game'].'/'.$name.'.jpg') ? $cfg['http'].'maps/'.$server['game'].'/'.$name.'.jpg' : $cfg['http'].'template/images/status/none.jpg'); - $html->set('map', str_replace('/', '|', $map)); - $html->set('name', $name); - $html->set('id', $id); + $html->set('img', file_exists(DIR.'/maps/'.$server['game'].'/'.$name.'.jpg') ? $cfg['http'].'maps/'.$server['game'].'/'.$name.'.jpg' : $cfg['http'].'template/images/status/none.jpg'); + $html->set('map', str_replace('/', '|', $map)); + $html->set('name', $name); + $html->set('id', $id); - if(count($aName) > 1) - $html->unit('workshop', true); - else - $html->unit('workshop'); + if(count($aName) > 1) + $html->unit('workshop', true); + else + $html->unit('workshop'); - $html->pack('maps'); - } + $html->pack('maps'); + } - // Запись карт в кеш - $mcache->set('server_maps_change_'.$id, $html->arr['maps'], false, 60); + // Запись карт в кеш + $mcache->set('server_maps_change_'.$id, $html->arr['maps'], false, 60); - return array('maps' => $html->arr['maps']); - } + return array('maps' => $html->arr['maps']); + } public static function update($id) { - global $cfg, $sql, $user, $start_point; + global $cfg, $sql, $user, $start_point; - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - $sql->query('SELECT `uid`, `unit`, `tarif`, `game`, `name`, `ftp`, `update`, `core_fix` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `uid`, `unit`, `tarif`, `game`, `name`, `ftp`, `update`, `core_fix` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - // Проверка времени обновления - $update = $server['update']+$cfg['update'][$server['game']]*60; + // Проверка времени обновления + $update = $server['update']+$cfg['update'][$server['game']]*60; - if($update > $start_point AND $user['group'] != 'admin') - return array('e' => sys::updtext(sys::text('servers', 'update'), array('time' => sys::date('max', $update)))); + if($update > $start_point AND $user['group'] != 'admin') + return array('e' => sys::updtext(sys::text('servers', 'update'), array('time' => sys::date('max', $update)))); - $sql->query('SELECT `address`, `passwd`, `sql_login`, `sql_passwd`, `sql_port`, `sql_ftp` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $sql->query('SELECT `address`, `passwd`, `sql_login`, `sql_passwd`, `sql_port`, `sql_ftp` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); $unit = $sql->get(); - $sql->query('SELECT `install`, `plugins_install` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); + $sql->query('SELECT `install`, `plugins_install` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); $tarif = $sql->get(); - // Проверка ssh соедниения пу с локацией + // Проверка ssh соедниения пу с локацией if(!$ssh->auth($unit['passwd'], $unit['address'])) return array('e' => sys::text('error', 'ssh')); - $taskset = ''; + $taskset = ''; - // Если включена система автораспределения и не установлен фиксированный поток - if($cfg['cpu_route'] AND !$server['core_fix']) - { - $proc_stat = array(); + // Если включена система автораспределения и не установлен фиксированный поток + if($cfg['cpu_route'] AND !$server['core_fix']) + { + $proc_stat = array(); - $proc_stat[0] = $ssh->get('cat /proc/stat'); - } + $proc_stat[0] = $ssh->get('cat /proc/stat'); + } - // Директория игрового сервера - $install = $tarif['install'].$server['uid']; + // Директория игрового сервера + $install = $tarif['install'].$server['uid']; - // Если система автораспределения продолжить парсинг загрузки процессора - if(isset($proc_stat)) - { - $proc_stat[1] = $ssh->get('cat /proc/stat'); + // Если система автораспределения продолжить парсинг загрузки процессора + if(isset($proc_stat)) + { + $proc_stat[1] = $ssh->get('cat /proc/stat'); - // Ядро/поток, на котором будет запущен игровой сервер (поток выбран с рассчетом наименьшей загруженности в момент запуска игрового сервера) - $core = sys::cpu_idle($proc_stat, $server['unit'], false); // число от 1 до n (где n число ядер/потоков в процессоре (без нулевого) + // Ядро/поток, на котором будет запущен игровой сервер (поток выбран с рассчетом наименьшей загруженности в момент запуска игрового сервера) + $core = sys::cpu_idle($proc_stat, $server['unit'], false); // число от 1 до n (где n число ядер/потоков в процессоре (без нулевого) - if(!is_numeric($core)) - return array('e' => 'Не удается выполнить операцию, нет свободного потока.'); + if(!is_numeric($core)) + return array('e' => 'Не удается выполнить операцию, нет свободного потока.'); - $taskset = 'taskset -c '.$core; - } + $taskset = 'taskset -c '.$core; + } - if($server['core_fix']) - { - $core = $server['core_fix']-1; - $taskset = 'taskset -c '.$core; - } + if($server['core_fix']) + { + $core = $server['core_fix']-1; + $taskset = 'taskset -c '.$core; + } - $ssh->set('cd '.$cfg['steamcmd'].' && '.$taskset.' screen -dmS u_'.$server['uid'].' sh -c "' - .'./steamcmd.sh +login anonymous +force_install_dir "'.$install.'" +app_update 740 +quit;' - .'cd '.$install.';' - .'chown -R server'.$server['uid'].':servers .;' - .'find . -type d -exec chmod 700 {} \;;' - .'find . -type f -exec chmod 600 {} \;;' - .'chmod 500 '.params::$aFileGame[$server['game']].'"'); + $ssh->set('cd '.$cfg['steamcmd'].' && '.$taskset.' screen -dmS u_'.$server['uid'].' sh -c "' + .'./steamcmd.sh +login anonymous +force_install_dir "'.$install.'" +app_update 740 +quit;' + .'cd '.$install.';' + .'chown -R server'.$server['uid'].':servers .;' + .'find . -type d -exec chmod 700 {} \;;' + .'find . -type f -exec chmod 600 {} \;;' + .'chmod 500 '.params::$aFileGame[$server['game']].'"'); - $core = !isset($core) ? 0 : $core+1; + $core = !isset($core) ? 0 : $core+1; - // Обновление информации в базе - $sql->query('UPDATE `servers` set `status`="update", `update`="'.$start_point.'", `core_use`="'.$core.'" WHERE `id`="'.$id.'" LIMIT 1'); + // Обновление информации в базе + $sql->query('UPDATE `servers` set `status`="update", `update`="'.$start_point.'", `core_use`="'.$core.'" WHERE `id`="'.$id.'" LIMIT 1'); - // Логирование - $sql->query('INSERT INTO `logs_sys` set `user`="'.$user['id'].'", `server`="'.$id.'", `text`="'.sys::text('syslogs', 'update').'", `time`="'.$start_point.'"'); + // Логирование + $sql->query('INSERT INTO `logs_sys` set `user`="'.$user['id'].'", `server`="'.$id.'", `text`="'.sys::text('syslogs', 'update').'", `time`="'.$start_point.'"'); - // Сброс кеша - actions::clmcache($id); + // Сброс кеша + actions::clmcache($id); - sys::reset_mcache('server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'update', 'online' => 0, 'players' => '')); - sys::reset_mcache('server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'update', 'online' => 0)); + sys::reset_mcache('server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'update', 'online' => 0, 'players' => '')); + sys::reset_mcache('server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'update', 'online' => 0)); - return array('s' => 'ok'); - } + return array('s' => 'ok'); + } } ?> \ No newline at end of file diff --git a/system/library/games/csgo/rcon.php b/system/library/games/csgo/rcon.php index 74182de..f40eb6f 100644 --- a/system/library/games/csgo/rcon.php +++ b/system/library/games/csgo/rcon.php @@ -1,112 +1,112 @@ Connect($ip, $port, 3, SourceQuery::SOURCE); + $sq->Connect($ip, $port, 3, SourceQuery::SOURCE); - $sq->SetRconPassword(rcon::rcon_passwd($server)); + $sq->SetRconPassword(rcon::rcon_passwd($server)); - $out = $sq->Rcon($cmd); + $out = $sq->Rcon($cmd); - $sq->Disconnect(); + $sq->Disconnect(); - return $out; - } + return $out; + } - public static function players($data) - { - $aPlayers = array(); - $n = 1; + public static function players($data) + { + $aPlayers = array(); + $n = 1; - $lines = explode("\n", $data); + $lines = explode("\n", $data); - foreach($lines as $line) - { - if(strpos($line, '#') === FALSE) - continue; + foreach($lines as $line) + { + if(strpos($line, '#') === FALSE) + continue; - $start = strpos($line, '"')+1; - $end = strrpos($line, '"'); + $start = strpos($line, '"')+1; + $end = strrpos($line, '"'); - $userid = sys::int(substr($line, 0, $start)); + $userid = sys::int(substr($line, 0, $start)); - $name = htmlspecialchars(substr($line, $start, $end-$start)); + $name = htmlspecialchars(substr($line, $start, $end-$start)); - $line = trim(substr($line, $end + 1)); + $line = trim(substr($line, $end + 1)); - $aData = array_values(array_diff(explode(' ', $line), array('', ' '))); + $aData = array_values(array_diff(explode(' ', $line), array('', ' '))); - $steamid = trim($aData[0]); - $ip = trim(sys::first(explode(':', $aData[5]))); + $steamid = trim($aData[0]); + $ip = trim(sys::first(explode(':', $aData[5]))); - if((sys::valid($steamid, 'steamid') AND sys::valid($steamid, 'steamid3')) || sys::valid($ip, 'ip')) - continue; + if((sys::valid($steamid, 'steamid') AND sys::valid($steamid, 'steamid3')) || sys::valid($ip, 'ip')) + continue; - $aPlayers[$n]['userid'] = $userid; - $aPlayers[$n]['name'] = $name; - $aPlayers[$n]['steamid'] = $steamid; - $aPlayers[$n]['time'] = trim($aData[1]); - $aPlayers[$n]['ping'] = trim($aData[2]); - $aPlayers[$n]['ip'] = $ip; + $aPlayers[$n]['userid'] = $userid; + $aPlayers[$n]['name'] = $name; + $aPlayers[$n]['steamid'] = $steamid; + $aPlayers[$n]['time'] = trim($aData[1]); + $aPlayers[$n]['ping'] = trim($aData[2]); + $aPlayers[$n]['ip'] = $ip; - $whois = rcon::country($ip); + $whois = rcon::country($ip); - $aPlayers[$n]['ico'] = $whois['ico']; - $aPlayers[$n]['country'] = $whois['name']; + $aPlayers[$n]['ico'] = $whois['ico']; + $aPlayers[$n]['country'] = $whois['name']; - $n+=1; - } + $n+=1; + } - return $aPlayers; - } + return $aPlayers; + } - public static function rcon_passwd($server) - { - global $cfg, $sql, $user; + public static function rcon_passwd($server) + { + global $cfg, $sql, $user; - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); $unit = $sql->get(); - if(!$ssh->auth($unit['passwd'], $unit['address'])) + if(!$ssh->auth($unit['passwd'], $unit['address'])) sys::outjs(array('e' => sys::text('error', 'ssh'))); - $sql->query('SELECT `install` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); - $tarif = $sql->get(); + $sql->query('SELECT `install` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); + $tarif = $sql->get(); - $ssh->set('cat '.$tarif['install'].'/'.$server['uid'].'/csgo/cfg/server.cfg | grep rcon_password'); - $get = explode(' ', str_replace('"', '', trim($ssh->get()))); - $rcon = trim(end($get)); + $ssh->set('cat '.$tarif['install'].'/'.$server['uid'].'/csgo/cfg/server.cfg | grep rcon_password'); + $get = explode(' ', str_replace('"', '', trim($ssh->get()))); + $rcon = trim(end($get)); - if(!isset($rcon{0})) - sys::outjs(array('r' => 'Необходимо установить rcon пароль (rcon_password).', 'url' => $cfg['http'].'servers/id/'.$server['id'].'/section/settings/subsection/server'), $nmch); + if(!isset($rcon{0})) + sys::outjs(array('r' => 'Необходимо установить rcon пароль (rcon_password).', 'url' => $cfg['http'].'servers/id/'.$server['id'].'/section/settings/subsection/server'), $nmch); - return $rcon; - } + return $rcon; + } - public static function country($ip) - { - global $SxGeo; + public static function country($ip) + { + global $SxGeo; - $cData = $SxGeo->getCityFull($ip); - $ico = sys::country($cData['country']['iso']); + $cData = $SxGeo->getCityFull($ip); + $ico = sys::country($cData['country']['iso']); - return array('ico' => $ico, 'name' => empty($cData['country']['name_ru']) ? 'Не определена' : $cData['country']['name_ru']); - } - } + return array('ico' => $ico, 'name' => empty($cData['country']['name_ru']) ? 'Не определена' : $cData['country']['name_ru']); + } + } ?> \ No newline at end of file diff --git a/system/library/games/csgo/scan.php b/system/library/games/csgo/scan.php index 5e498aa..f19df98 100644 --- a/system/library/games/csgo/scan.php +++ b/system/library/games/csgo/scan.php @@ -1,142 +1,142 @@ get($nmch))) - return $mcache->get($nmch); + if(is_array($mcache->get($nmch))) + return $mcache->get($nmch); - $out = array(); + $out = array(); - $info = scan::info($sq, $id); + $info = scan::info($sq, $id); - $sql->query('SELECT `game`, `name`, `map`, `online`, `players`, `status`, `time`, `overdue` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `game`, `name`, `map`, `online`, `players`, `status`, `time`, `overdue` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - $out['time'] = 'Арендован до: '.date('d.m.Y - H:i', $server['time']); + $out['time'] = 'Арендован до: '.date('d.m.Y - H:i', $server['time']); - if($server['status'] == 'overdue') - $out['time_end'] = 'Удаление через: '.sys::date('min', $server['overdue']+$cfg['server_delete']*86400); - else - $out['time_end'] = 'Осталось: '.sys::date('min', $server['time']); + if($server['status'] == 'overdue') + $out['time_end'] = 'Удаление через: '.sys::date('min', $server['overdue']+$cfg['server_delete']*86400); + else + $out['time_end'] = 'Осталось: '.sys::date('min', $server['time']); - if(!$info['status']) - { - $out['name'] = $server['name']; - $out['status'] = sys::status($server['status'], $server['game'], $server['map']); - $out['online'] = $server['online']; - $out['image'] = ''; - $out['buttons'] = sys::buttons($id, $server['status']); + if(!$info['status']) + { + $out['name'] = $server['name']; + $out['status'] = sys::status($server['status'], $server['game'], $server['map']); + $out['online'] = $server['online']; + $out['image'] = ''; + $out['buttons'] = sys::buttons($id, $server['status']); - if($players_get) - $out['players'] = base64_decode($server['players']); + if($players_get) + $out['players'] = base64_decode($server['players']); - $mcache->set($nmch, $out, false, $cfg['mcache_server_mon']); + $mcache->set($nmch, $out, false, $cfg['mcache_server_mon']); - return $out; - } + return $out; + } - if($players_get) - $players = scan::info($sq, $id, true); + if($players_get) + $players = scan::info($sq, $id, true); - $out['name'] = htmlspecialchars($info['name']); - $out['status'] = sys::status('working', $server['game'], $info['map']); - $out['online'] = $info['online']; - $out['image'] = ''; - $out['buttons'] = sys::buttons($id, 'working'); - $out['players'] = ''; + $out['name'] = htmlspecialchars($info['name']); + $out['status'] = sys::status('working', $server['game'], $info['map']); + $out['online'] = $info['online']; + $out['image'] = ''; + $out['buttons'] = sys::buttons($id, 'working'); + $out['players'] = ''; - if($players_get) - { - foreach($players as $index => $player) - { - $html->get($server['game'], 'sections/servers/players'); + if($players_get) + { + foreach($players as $index => $player) + { + $html->get($server['game'], 'sections/servers/players'); - $html->set('i', $player['i']); - $html->set('name', $player['name']); - $html->set('score', $player['score']); - $html->set('time', $player['time']); + $html->set('i', $player['i']); + $html->set('name', $player['name']); + $html->set('score', $player['score']); + $html->set('time', $player['time']); - $html->pack('list'); - } + $html->pack('list'); + } - $out['players'] = isset($html->arr['list']) ? $html->arr['list'] : ''; - } + $out['players'] = isset($html->arr['list']) ? $html->arr['list'] : ''; + } - $sql->query('UPDATE `servers` set ' - .'`name`="'.$out['name'].'", ' - .'`online`="'.$out['online'].'", ' - .'`map`="'.$info['map'].'", ' - .'`status`="working" WHERE `id`="'.$id.'" LIMIT 1'); + $sql->query('UPDATE `servers` set ' + .'`name`="'.$out['name'].'", ' + .'`online`="'.$out['online'].'", ' + .'`map`="'.$info['map'].'", ' + .'`status`="working" WHERE `id`="'.$id.'" LIMIT 1'); - if($players_get) - $sql->query('UPDATE `servers` set `players`="'.base64_encode($out['players']).'" WHERE `id`="'.$id.'" LIMIT 1'); + if($players_get) + $sql->query('UPDATE `servers` set `players`="'.base64_encode($out['players']).'" WHERE `id`="'.$id.'" LIMIT 1'); - $mcache->set($nmch, $out, false, $cfg['mcache_server_mon']); + $mcache->set($nmch, $out, false, $cfg['mcache_server_mon']); - return $out; - } + return $out; + } - public static function info($sq, $id, $pl = false) - { - global $sql; + public static function info($sq, $id, $pl = false) + { + global $sql; - $sql->query('SELECT `address` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `address` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - list($ip, $port) = explode(':', $server['address']); + list($ip, $port) = explode(':', $server['address']); - $sq->Connect($ip, $port, 1, SourceQuery::SOURCE); + $sq->Connect($ip, $port, 1, SourceQuery::SOURCE); - if($pl) - { - $players = $sq->GetPlayers(); + if($pl) + { + $players = $sq->GetPlayers(); - $i = 1; - $data = array(); + $i = 1; + $data = array(); - foreach($players as $n => $player) - { - $data[$i]['i'] = $i; - $data[$i]['name'] = $player['Name'] == '' ? 'Подключается' : $player['Name']; - $data[$i]['score'] = $player['Frags']; - $data[$i]['time'] = $player['TimeF']; + foreach($players as $n => $player) + { + $data[$i]['i'] = $i; + $data[$i]['name'] = $player['Name'] == '' ? 'Подключается' : $player['Name']; + $data[$i]['score'] = $player['Frags']; + $data[$i]['time'] = $player['TimeF']; - $i+=1; - } + $i+=1; + } - return $data; - } + return $data; + } - $data = $sq->GetInfo(); + $data = $sq->GetInfo(); - $map = explode('/', $data['Map']); + $map = explode('/', $data['Map']); - $server['name'] = $data['HostName']; - $server['map'] = end($map); - $server['online'] = $data['Players']; - $server['status'] = strlen($server['map']) > 3 ? true : false; + $server['name'] = $data['HostName']; + $server['map'] = end($map); + $server['online'] = $data['Players']; + $server['status'] = strlen($server['map']) > 3 ? true : false; - return $server; - } - } + return $server; + } + } ?> \ No newline at end of file diff --git a/system/library/games/csgo/service.php b/system/library/games/csgo/service.php index 6f3729c..0657d50 100644 --- a/system/library/games/csgo/service.php +++ b/system/library/games/csgo/service.php @@ -1,369 +1,369 @@ query('SELECT `address`, `test` FROM `units` WHERE `id`="'.$aData['unit'].'" AND `csgo`="1" AND `show`="1" LIMIT 1'); - if(!$sql->num()) - sys::outjs(array('e' => 'Локация не найдена.')); + // Проверка локации + $sql->query('SELECT `address`, `test` FROM `units` WHERE `id`="'.$aData['unit'].'" AND `csgo`="1" AND `show`="1" LIMIT 1'); + if(!$sql->num()) + sys::outjs(array('e' => 'Локация не найдена.')); - $unit = $sql->get(); + $unit = $sql->get(); - // Проверка тарифа - $sql->query('SELECT `id` FROM `tarifs` WHERE `id`="'.$aData['tarif'].'" AND `unit`="'.$aData['unit'].'" AND `show`="1" LIMIT 1'); - if(!$sql->num()) - sys::outjs(array('e' => 'Тариф не найден.')); + // Проверка тарифа + $sql->query('SELECT `id` FROM `tarifs` WHERE `id`="'.$aData['tarif'].'" AND `unit`="'.$aData['unit'].'" AND `show`="1" LIMIT 1'); + if(!$sql->num()) + sys::outjs(array('e' => 'Тариф не найден.')); - $sql->query('SELECT ' - .'`slots_min`,' - .'`slots_max`,' - .'`port_min`,' - .'`port_max`,' - .'`hostname`,' - .'`packs`,' - .'`tickrate`,' - .'`time`,' - .'`test`,' - .'`tests`,' - .'`discount`,' - .'`map`,' - .'`ftp`,' - .'`plugins`,' - .'`console`,' - .'`stats`,' - .'`copy`,' - .'`web`,' - .'`plugins_install`,' - .'`hdd`,' - .'`autostop`,' - .'`core_fix`,' - .'`ip`,' - .'`price`' - .' FROM `tarifs` WHERE `id`="'.$aData['tarif'].'" LIMIT 1'); + $sql->query('SELECT ' + .'`slots_min`,' + .'`slots_max`,' + .'`port_min`,' + .'`port_max`,' + .'`hostname`,' + .'`packs`,' + .'`tickrate`,' + .'`time`,' + .'`test`,' + .'`tests`,' + .'`discount`,' + .'`map`,' + .'`ftp`,' + .'`plugins`,' + .'`console`,' + .'`stats`,' + .'`copy`,' + .'`web`,' + .'`plugins_install`,' + .'`hdd`,' + .'`autostop`,' + .'`core_fix`,' + .'`ip`,' + .'`price`' + .' FROM `tarifs` WHERE `id`="'.$aData['tarif'].'" LIMIT 1'); - $tarif = $sql->get(); + $tarif = $sql->get(); - // Проверка сборки - if(!array_key_exists($aData['pack'], sys::b64djs($tarif['packs'], true))) - sys::outjs(array('e' => 'Сборка не найдена.')); + // Проверка сборки + if(!array_key_exists($aData['pack'], sys::b64djs($tarif['packs'], true))) + sys::outjs(array('e' => 'Сборка не найдена.')); - // Проверка TickRate - if(!in_array($aData['tickrate'], explode(':', $tarif['tickrate']))) - sys::outjs(array('e' => 'Переданные данные tickrate неверны.')); + // Проверка TickRate + if(!in_array($aData['tickrate'], explode(':', $tarif['tickrate']))) + sys::outjs(array('e' => 'Переданные данные tickrate неверны.')); - $test = 0; + $test = 0; - // Проверка периода на тест - if($aData['test']) - { - if(!$tarif['test'] || !$unit['test']) - sys::outjs(array('e' => 'Тестовый период недоступен.')); + // Проверка периода на тест + if($aData['test']) + { + if(!$tarif['test'] || !$unit['test']) + sys::outjs(array('e' => 'Тестовый период недоступен.')); - // Проверка на повторный запрос - $sql->query('SELECT `id`, `game` FROM `tests` WHERE `user`="'.$user['id'].'" LIMIT 1'); - if($sql->num()) - { - $test_info = $sql->get(); + // Проверка на повторный запрос + $sql->query('SELECT `id`, `game` FROM `tests` WHERE `user`="'.$user['id'].'" LIMIT 1'); + if($sql->num()) + { + $test_info = $sql->get(); - if(!$cfg['tests']['game'] || $test_info['game'] == 'csgo') - sys::outjs(array('e' => 'Тестовый период предоставляется один раз.')); + if(!$cfg['tests']['game'] || $test_info['game'] == 'csgo') + sys::outjs(array('e' => 'Тестовый период предоставляется один раз.')); - $sql->query('SELECT `id` FROM `servers` WHERE `user`="'.$user['id'].'" AND `test`="1" LIMIT 1'); - if($sql->num() AND !$cfg['tests']['sametime']) - sys::outjs(array('e' => 'Чтобы получить тестовый период другой игры, дождитесь окончания текущего.')); - } + $sql->query('SELECT `id` FROM `servers` WHERE `user`="'.$user['id'].'" AND `test`="1" LIMIT 1'); + if($sql->num() AND !$cfg['tests']['sametime']) + sys::outjs(array('e' => 'Чтобы получить тестовый период другой игры, дождитесь окончания текущего.')); + } - // Проверка наличия мест на локации - $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND `test`="1" AND `time`>"'.$start_point.'" LIMIT '.$unit['test']); - if($sql->num() == $unit['test']) - sys::outjs(array('e' => 'Свободного места для тестового периода нет.')); + // Проверка наличия мест на локации + $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND `test`="1" AND `time`>"'.$start_point.'" LIMIT '.$unit['test']); + if($sql->num() == $unit['test']) + sys::outjs(array('e' => 'Свободного места для тестового периода нет.')); - // Проверка наличия мест для выбранного тарифа - $sql->query('SELECT `id` FROM `servers` WHERE `tarif`="'.$aData['tarif'].'" AND `test`="1" AND `time`>"'.$start_point.'" LIMIT '.$tarif['tests']); - if($sql->num() == $tarif['tests']) - sys::outjs(array('e' => 'Свободного места для тестового периода выбранного тарифа нет.')); + // Проверка наличия мест для выбранного тарифа + $sql->query('SELECT `id` FROM `servers` WHERE `tarif`="'.$aData['tarif'].'" AND `test`="1" AND `time`>"'.$start_point.'" LIMIT '.$tarif['tests']); + if($sql->num() == $tarif['tests']) + sys::outjs(array('e' => 'Свободного места для тестового периода выбранного тарифа нет.')); - $test = 1; - }else - // Проверка периода - if(!$cfg['settlement_period'] AND !in_array($aData['time'], explode(':', $tarif['time']))) - sys::outjs(array('e' => 'Переданные данные периода неверны.')); + $test = 1; + }else + // Проверка периода + if(!$cfg['settlement_period'] AND !in_array($aData['time'], explode(':', $tarif['time']))) + sys::outjs(array('e' => 'Переданные данные периода неверны.')); - // Проверка слот - if($aData['slots'] < $tarif['slots_min'] || $aData['slots'] > $tarif['slots_max']) - sys::outjs(array('e' => 'Переданные данные слот неверны.')); + // Проверка слот + if($aData['slots'] < $tarif['slots_min'] || $aData['slots'] > $tarif['slots_max']) + sys::outjs(array('e' => 'Переданные данные слот неверны.')); - // Определение цены - $aPrice = explode(':', $tarif['price']); - $price = $aPrice[array_search($aData['tickrate'], explode(':', $tarif['tickrate']))]; + // Определение цены + $aPrice = explode(':', $tarif['price']); + $price = $aPrice[array_search($aData['tickrate'], explode(':', $tarif['tickrate']))]; - // Определение суммы - if($cfg['settlement_period']) - { - // Цена аренды за расчетный период - $sum = games::define_sum($tarif['discount'], $price, $aData['slots'], $start_point); + // Определение суммы + if($cfg['settlement_period']) + { + // Цена аренды за расчетный период + $sum = games::define_sum($tarif['discount'], $price, $aData['slots'], $start_point); - $aData['time'] = games::define_period('buy', params::$aDayMonth); - }else - $sum = games::define_sum($tarif['discount'], $price, $aData['slots'], $aData['time']); + $aData['time'] = games::define_period('buy', params::$aDayMonth); + }else + $sum = games::define_sum($tarif['discount'], $price, $aData['slots'], $aData['time']); - // Проверка промо-кода - $promo = games::define_promo( - $aData['promo'], - array( - 'tarif' => $aData['tarif'], - 'tickrate' => $aData['tickrate'], - 'slots' => $aData['slots'], - 'time' => $aData['time'], - 'user' => $user['id'] - ), - $tarif['discount'], - $sum - ); + // Проверка промо-кода + $promo = games::define_promo( + $aData['promo'], + array( + 'tarif' => $aData['tarif'], + 'tickrate' => $aData['tickrate'], + 'slots' => $aData['slots'], + 'time' => $aData['time'], + 'user' => $user['id'] + ), + $tarif['discount'], + $sum + ); - $days = $aData['time']; // Кол-во дней аренды + $days = $aData['time']; // Кол-во дней аренды - // Использование промо-кода - if(is_array($promo)) - { - if(array_key_exists('sum', $promo)) - $sum = $promo['sum']; - else - $days += $promo['days']; // Кол-во дней аренды с учетом подарочных (промо-код) - } + // Использование промо-кода + if(is_array($promo)) + { + if(array_key_exists('sum', $promo)) + $sum = $promo['sum']; + else + $days += $promo['days']; // Кол-во дней аренды с учетом подарочных (промо-код) + } - // Проверка баланса - if($user['balance'] < $sum) - sys::outjs(array('e' => 'У вас не хватает '.(round($sum-$user['balance'], 2)).' '.$cfg['currency'])); + // Проверка баланса + if($user['balance'] < $sum) + sys::outjs(array('e' => 'У вас не хватает '.(round($sum-$user['balance'], 2)).' '.$cfg['currency'])); - // Выделенный адрес игрового сервера - if(!empty($tarif['ip'])) - { - $aIp = explode(':', $tarif['ip']); + // Выделенный адрес игрового сервера + if(!empty($tarif['ip'])) + { + $aIp = explode(':', $tarif['ip']); - $ip = false; - $port = params::$aDefPort['csgo']; + $ip = false; + $port = params::$aDefPort['csgo']; - // Проверка наличия свободного адреса - foreach($aIp as $adr) - { - $adr = trim($adr); + // Проверка наличия свободного адреса + foreach($aIp as $adr) + { + $adr = trim($adr); - $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND `address` LIKE "'.$adr.':%" LIMIT 1'); - if(!$sql->num()) - { - $ip = $adr; + $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND `address` LIKE "'.$adr.':%" LIMIT 1'); + if(!$sql->num()) + { + $ip = $adr; - break; - } - } - }else{ - $ip = sys::first(explode(':', $unit['address'])); - $port = false; + break; + } + } + }else{ + $ip = sys::first(explode(':', $unit['address'])); + $port = false; - // Проверка наличия свободного порта - for($tarif['port_min']; $tarif['port_min'] <= $tarif['port_max']; $tarif['port_min']+=1) - { - $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND (`address`="'.$ip.':'.$tarif['port_min'].'" OR `port`="'.$tarif['port_min'].'") LIMIT 1'); - if(!$sql->num()) - { - $port = $tarif['port_min']; + // Проверка наличия свободного порта + for($tarif['port_min']; $tarif['port_min'] <= $tarif['port_max']; $tarif['port_min']+=1) + { + $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND (`address`="'.$ip.':'.$tarif['port_min'].'" OR `port`="'.$tarif['port_min'].'") LIMIT 1'); + if(!$sql->num()) + { + $port = $tarif['port_min']; - break; - } - } - } + break; + } + } + } - if(!$ip || !$port) - { - $sql->query('UPDATE `tarifs` set `show`="0" WHERE `id`="'.$aData['tarif'].'" LIMIT 1'); + if(!$ip || !$port) + { + $sql->query('UPDATE `tarifs` set `show`="0" WHERE `id`="'.$aData['tarif'].'" LIMIT 1'); - sys::outjs(array('e' => 'К сожалению нет доступных мест, обратитесь в тех.поддержку.')); - } + sys::outjs(array('e' => 'К сожалению нет доступных мест, обратитесь в тех.поддержку.')); + } - if($test) - $aData['time'] = games::time($start_point, $tarif['test']); - else - $aData['time'] = games::time($start_point, $days); + if($test) + $aData['time'] = games::time($start_point, $tarif['test']); + else + $aData['time'] = games::time($start_point, $days); - $fix_one = 0; - $core = 0; + $fix_one = 0; + $core = 0; - if($tarif['core_fix'] != '') - { - $aCore = explode(',', $tarif['core_fix']); + if($tarif['core_fix'] != '') + { + $aCore = explode(',', $tarif['core_fix']); - foreach($aCore as $cpu) - { - $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND `tarif`="'.$aData['tarif'].'" AND `core_fix`="'.$cpu.'" AND `core_fix_one`="1" LIMIT 1'); + foreach($aCore as $cpu) + { + $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND `tarif`="'.$aData['tarif'].'" AND `core_fix`="'.$cpu.'" AND `core_fix_one`="1" LIMIT 1'); - if($sql->num()) - continue; + if($sql->num()) + continue; - $fix_one = 1; - $core = $cpu; + $fix_one = 1; + $core = $cpu; - break; - } + break; + } - if(!$core) - { - $sql->query('UPDATE `tarifs` set `show`="0" WHERE `id`="'.$aData['tarif'].'" LIMIT 1'); + if(!$core) + { + $sql->query('UPDATE `tarifs` set `show`="0" WHERE `id`="'.$aData['tarif'].'" LIMIT 1'); - sys::outjs(array('e' => 'К сожалению нет доступных мест, обратитесь в тех.поддержку.')); - } - } + sys::outjs(array('e' => 'К сожалению нет доступных мест, обратитесь в тех.поддержку.')); + } + } - $ram = $tarif['param_fix'] ? $aData['ram'] : $cfg['ram']['csgo']*$aSDATA['slots']; + $ram = $tarif['param_fix'] ? $aData['ram'] : $cfg['ram']['csgo']*$aSDATA['slots']; - // Массив данных - $aSDATA = array( - 'unit' => $aData['unit'], // идентификатор локации - 'tarif' => $aData['tarif'], // идентификатор тарифа - 'ram' => $ram, // значение ram - 'param_fix' => $tarif['param_fix'], // фиксированные параметры - 'tickrate' => $aData['tickrate'], // значение tickrate - 'pack' => $aData['pack'], // Выбранная сборка для установки - 'time' => $aData['time'], // Время аренды - 'days' => $days, // Число дней - 'sum' => $sum, // Сумма списания - 'test' => $test, // тестовый период - 'address' => $ip.':'.$port, // адрес игрового сервера - 'port' => $port, // порт игрового сервера - 'slots' => $aData['slots'], // Кол-во слот - 'map' => $tarif['map'], // Фиксированное значение слот - 'autostop' => $tarif['autostop'], // Выключение при 0 онлайне - 'ftp' => $tarif['ftp'], // Использование ftp - 'plugins' => $tarif['plugins'], // Использование плагинов - 'console' => $tarif['console'], // Использование консоли - 'stats' => $tarif['stats'], // Использование графиков (ведение статистики) - 'copy' => $tarif['copy'], // Использование резервных копий - 'web' => $tarif['web'], // Использование доп услуг - 'plugins_install' => $tarif['plugins_install'], // Список установленных плагинов - 'hdd' => $tarif['hdd'], // Дисковое пространство - 'core_fix' => $core, // Выделенный поток - 'core_fix_one' => $fix_one, // Выделенный поток - 'promo' => $promo // Использование промо-кода - ); + // Массив данных + $aSDATA = array( + 'unit' => $aData['unit'], // идентификатор локации + 'tarif' => $aData['tarif'], // идентификатор тарифа + 'ram' => $ram, // значение ram + 'param_fix' => $tarif['param_fix'], // фиксированные параметры + 'tickrate' => $aData['tickrate'], // значение tickrate + 'pack' => $aData['pack'], // Выбранная сборка для установки + 'time' => $aData['time'], // Время аренды + 'days' => $days, // Число дней + 'sum' => $sum, // Сумма списания + 'test' => $test, // тестовый период + 'address' => $ip.':'.$port, // адрес игрового сервера + 'port' => $port, // порт игрового сервера + 'slots' => $aData['slots'], // Кол-во слот + 'map' => $tarif['map'], // Фиксированное значение слот + 'autostop' => $tarif['autostop'], // Выключение при 0 онлайне + 'ftp' => $tarif['ftp'], // Использование ftp + 'plugins' => $tarif['plugins'], // Использование плагинов + 'console' => $tarif['console'], // Использование консоли + 'stats' => $tarif['stats'], // Использование графиков (ведение статистики) + 'copy' => $tarif['copy'], // Использование резервных копий + 'web' => $tarif['web'], // Использование доп услуг + 'plugins_install' => $tarif['plugins_install'], // Список установленных плагинов + 'hdd' => $tarif['hdd'], // Дисковое пространство + 'core_fix' => $core, // Выделенный поток + 'core_fix_one' => $fix_one, // Выделенный поток + 'promo' => $promo // Использование промо-кода + ); - return $aSDATA; - } + return $aSDATA; + } - public static function install($aSDATA = array()) - { - global $cfg, $sql, $user, $start_point; + public static function install($aSDATA = array()) + { + global $cfg, $sql, $user, $start_point; - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - // Массив данных локации (адрес,пароль) - $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$aSDATA['unit'].'" LIMIT 1'); - $unit = $sql->get(); + // Массив данных локации (адрес,пароль) + $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$aSDATA['unit'].'" LIMIT 1'); + $unit = $sql->get(); - // Проверка ssh соединения с локацией - if(!$ssh->auth($unit['passwd'], $unit['address'])) - sys::outjs(array('e' => sys::text('error', 'ssh'))); + // Проверка ssh соединения с локацией + if(!$ssh->auth($unit['passwd'], $unit['address'])) + sys::outjs(array('e' => sys::text('error', 'ssh'))); - // Массив данных тарифа (путь сборки,путь установки) - $sql->query('SELECT `path`, `install`, `hostname` FROM `tarifs` WHERE `id`="'.$aSDATA['tarif'].'" LIMIT 1'); - $tarif = $sql->get(); + // Массив данных тарифа (путь сборки,путь установки) + $sql->query('SELECT `path`, `install`, `hostname` FROM `tarifs` WHERE `id`="'.$aSDATA['tarif'].'" LIMIT 1'); + $tarif = $sql->get(); - // Получение идентификаторов игрового сервера - $sql->query('INSERT INTO `servers` set uid="1"'); - $id = $sql->id(); - $uid = $id+1000; + // Получение идентификаторов игрового сервера + $sql->query('INSERT INTO `servers` set uid="1"'); + $id = $sql->id(); + $uid = $id+1000; - // Директория сборки - $path = $tarif['path'].$aSDATA['pack']; + // Директория сборки + $path = $tarif['path'].$aSDATA['pack']; - // Директория игрового сервера - $install = $tarif['install'].$uid; + // Директория игрового сервера + $install = $tarif['install'].$uid; - $ssh->set('mkdir '.$install.';' // Создание директории - .'useradd -s /bin/false -d '.$install.' -g servers -u '.$uid.' server'.$uid.';' // Создание пользователя сервера на локации - .'chown server'.$uid.':1000 '.$install.';' // Изменение владельца и группы директории - .'cd '.$install.' && sudo -u server'.$uid.' screen -dmS i_'.$uid.' sh -c "cp -r '.$path.'/. .;' // Копирование файлов сборки для сервера - .'find . -type d -exec chmod 700 {} \;;' - .'find . -type f -exec chmod 600 {} \;;' - .'chmod 500 '.params::$aFileGame['csgo'].'"'); + $ssh->set('mkdir '.$install.';' // Создание директории + .'useradd -s /bin/false -d '.$install.' -g servers -u '.$uid.' server'.$uid.';' // Создание пользователя сервера на локации + .'chown server'.$uid.':1000 '.$install.';' // Изменение владельца и группы директории + .'cd '.$install.' && sudo -u server'.$uid.' screen -dmS i_'.$uid.' sh -c "cp -r '.$path.'/. .;' // Копирование файлов сборки для сервера + .'find . -type d -exec chmod 700 {} \;;' + .'find . -type f -exec chmod 600 {} \;;' + .'chmod 500 '.params::$aFileGame['csgo'].'"'); - // Запись данных нового сервера - $sql->query('UPDATE `servers` set - `uid`="'.$uid.'", - `unit`="'.$aSDATA['unit'].'", - `tarif`="'.$aSDATA['tarif'].'", - `user`="'.$user['id'].'", - `address`="'.$aSDATA['address'].'", - `port`="'.$aSDATA['port'].'", - `game`="csgo", - `slots`="'.$aSDATA['slots'].'", - `slots_start`="'.$aSDATA['slots'].'", - `status`="install", - `name`="'.$tarif['hostname'].'", - `pack`="'.$aSDATA['pack'].'", - `plugins_use`="'.$aSDATA['plugins'].'", - `ftp_use`="'.$aSDATA['ftp'].'", - `console_use`="'.$aSDATA['console'].'", - `stats_use`="'.$aSDATA['stats'].'", - `copy_use`="'.$aSDATA['copy'].'", - `web_use`="'.$aSDATA['web'].'", - `tickrate`="'.$aSDATA['tickrate'].'", - `map_start`="'.$aSDATA['map'].'", - `vac`="1", - `hdd`="'.$aSDATA['hdd'].'", - `time`="'.$aSDATA['time'].'", - `date`="'.$start_point.'", - `test`="'.$aSDATA['test'].'", - `ram`="'.$aSDATA['ram'].'", - `core_fix`="'.$aSDATA['core_fix'].'", - `core_fix_one`="'.$aSDATA['core_fix_one'].'", - `autostop`="'.$aSDATA['autostop'].'" WHERE `id`="'.$id.'" LIMIT 1'); + // Запись данных нового сервера + $sql->query('UPDATE `servers` set + `uid`="'.$uid.'", + `unit`="'.$aSDATA['unit'].'", + `tarif`="'.$aSDATA['tarif'].'", + `user`="'.$user['id'].'", + `address`="'.$aSDATA['address'].'", + `port`="'.$aSDATA['port'].'", + `game`="csgo", + `slots`="'.$aSDATA['slots'].'", + `slots_start`="'.$aSDATA['slots'].'", + `status`="install", + `name`="'.$tarif['hostname'].'", + `pack`="'.$aSDATA['pack'].'", + `plugins_use`="'.$aSDATA['plugins'].'", + `ftp_use`="'.$aSDATA['ftp'].'", + `console_use`="'.$aSDATA['console'].'", + `stats_use`="'.$aSDATA['stats'].'", + `copy_use`="'.$aSDATA['copy'].'", + `web_use`="'.$aSDATA['web'].'", + `tickrate`="'.$aSDATA['tickrate'].'", + `map_start`="'.$aSDATA['map'].'", + `vac`="1", + `hdd`="'.$aSDATA['hdd'].'", + `time`="'.$aSDATA['time'].'", + `date`="'.$start_point.'", + `test`="'.$aSDATA['test'].'", + `ram`="'.$aSDATA['ram'].'", + `core_fix`="'.$aSDATA['core_fix'].'", + `core_fix_one`="'.$aSDATA['core_fix_one'].'", + `autostop`="'.$aSDATA['autostop'].'" WHERE `id`="'.$id.'" LIMIT 1'); - // Запись установленных плагинов - if($aSDATA['plugins']) - { - // Массив идентификаторов плагинов - $aPlugins = sys::b64djs($aSDATA['plugins_install']); + // Запись установленных плагинов + if($aSDATA['plugins']) + { + // Массив идентификаторов плагинов + $aPlugins = sys::b64djs($aSDATA['plugins_install']); - if(isset($aPlugins[$aSDATA['pack']])) - { - $plugins = explode(',', $aPlugins[$aSDATA['pack']]); + if(isset($aPlugins[$aSDATA['pack']])) + { + $plugins = explode(',', $aPlugins[$aSDATA['pack']]); - foreach($plugins as $plugin) - if($plugin) - $sql->query('INSERT INTO `plugins_install` set `server`="'.$id.'", `plugin`="'.$plugin.'", `time`="'.$start_point.'"'); - } - } + foreach($plugins as $plugin) + if($plugin) + $sql->query('INSERT INTO `plugins_install` set `server`="'.$id.'", `plugin`="'.$plugin.'", `time`="'.$start_point.'"'); + } + } - // Списание средств с баланса пользователя - $sql->query('UPDATE `users` set `balance`="'.($user['balance']-$aSDATA['sum']).'" WHERE `id`="'.$user['id'].'" LIMIT 1'); + // Списание средств с баланса пользователя + $sql->query('UPDATE `users` set `balance`="'.($user['balance']-$aSDATA['sum']).'" WHERE `id`="'.$user['id'].'" LIMIT 1'); - // Запись получения тестового периода - if($aSDATA['test']) - { - $sql->query('INSERT INTO `tests` set `server`="'.$id.'", `unit`="'.$aSDATA['unit'].'", `game`="csgo", `user`="'.$user['id'].'", `time`="'.$start_point.'"'); - $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="'.sys::updtext(sys::text('logs', 'buy_server_test'), array('id' => $id)).'", `date`="'.$start_point.'", `type`="buy", `money`="0"'); - }else{ - // Реф. система - games::part($user['id'], $aSDATA['sum']); + // Запись получения тестового периода + if($aSDATA['test']) + { + $sql->query('INSERT INTO `tests` set `server`="'.$id.'", `unit`="'.$aSDATA['unit'].'", `game`="csgo", `user`="'.$user['id'].'", `time`="'.$start_point.'"'); + $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="'.sys::updtext(sys::text('logs', 'buy_server_test'), array('id' => $id)).'", `date`="'.$start_point.'", `type`="buy", `money`="0"'); + }else{ + // Реф. система + games::part($user['id'], $aSDATA['sum']); - // Запись логов - if(!is_array($aSDATA['promo'])) - $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="'.sys::updtext(sys::text('logs', 'buy_server'), array('days' => games::parse_day($aSDATA['days'], true), 'money' => $aSDATA['sum'], 'id' => $id)).'", `date`="'.$start_point.'", `type`="buy", `money`="'.$aSDATA['sum'].'"'); - else{ - $sql->query('UPDATE `servers` set `benefit`="'.$aSDATA['time'].'" WHERE `id`="'.$id.'" LIMIT 1'); - $sql->query('INSERT INTO `promo_use` set `promo`="'.$aSDATA['promo']['id'].'", `user`="'.$user['id'].'", `time`="'.$start_point.'"'); - $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="'.sys::updtext(sys::text('logs', 'buy_server_promo'), array('days' => games::parse_day($aSDATA['days'], true), 'money' => $aSDATA['sum'], 'promo' => $aSDATA['promo']['cod'], 'id' => $id)).'", `date`="'.$start_point.'", `type`="buy", `money`="'.$aSDATA['sum'].'"'); - } - } + // Запись логов + if(!is_array($aSDATA['promo'])) + $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="'.sys::updtext(sys::text('logs', 'buy_server'), array('days' => games::parse_day($aSDATA['days'], true), 'money' => $aSDATA['sum'], 'id' => $id)).'", `date`="'.$start_point.'", `type`="buy", `money`="'.$aSDATA['sum'].'"'); + else{ + $sql->query('UPDATE `servers` set `benefit`="'.$aSDATA['time'].'" WHERE `id`="'.$id.'" LIMIT 1'); + $sql->query('INSERT INTO `promo_use` set `promo`="'.$aSDATA['promo']['id'].'", `user`="'.$user['id'].'", `time`="'.$start_point.'"'); + $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="'.sys::updtext(sys::text('logs', 'buy_server_promo'), array('days' => games::parse_day($aSDATA['days'], true), 'money' => $aSDATA['sum'], 'promo' => $aSDATA['promo']['cod'], 'id' => $id)).'", `date`="'.$start_point.'", `type`="buy", `money`="'.$aSDATA['sum'].'"'); + } + } - return $id; - } + return $id; + } } ?> \ No newline at end of file diff --git a/system/library/games/csgo/tarif.php b/system/library/games/csgo/tarif.php index 0aba2f5..5dffa48 100644 --- a/system/library/games/csgo/tarif.php +++ b/system/library/games/csgo/tarif.php @@ -1,225 +1,225 @@ get('extend', 'sections/servers/games/tarif'); + $html->get('extend', 'sections/servers/games/tarif'); - if(isset($html->arr['extend_address'])) - { - $html->unit('extend_address', 1); - $html->set('extend_address', $html->arr['extend_address']); - }else - $html->unit('extend_address'); + if(isset($html->arr['extend_address'])) + { + $html->unit('extend_address', 1); + $html->set('extend_address', $html->arr['extend_address']); + }else + $html->unit('extend_address'); - $html->set('id', $sid); - $html->set('time', sys::date('min', $server['time'])); - $html->set('options', ''.$options); - $html->set('slots', $server['slots']); - $html->set('info', $server['tickrate'].' TickRate'); - $html->set('tarif', $tarif_name); - $html->set('cur', $cfg['currency']); + $html->set('id', $sid); + $html->set('time', sys::date('min', $server['time'])); + $html->set('options', ''.$options); + $html->set('slots', $server['slots']); + $html->set('info', $server['tickrate'].' TickRate'); + $html->set('tarif', $tarif_name); + $html->set('cur', $cfg['currency']); - $html->pack('main'); + $html->pack('main'); - return NULL; - } + return NULL; + } public static function extend_sp($server, $tarif, $sid) { - global $cfg, $sql, $html, $start_point; + global $cfg, $sql, $html, $start_point; - tarifs::extend_address($server['game'], $sid); + tarifs::extend_address($server['game'], $sid); - $aPrice = explode(':', $tarif['price']); - $aTICK = explode(':', $tarif['tickrate']); + $aPrice = explode(':', $tarif['price']); + $aTICK = explode(':', $tarif['tickrate']); - $sum = $tarif['slots'] ? $aPrice[array_search($server['tickrate'], $aTICK)] : $aPrice[array_search($server['tickrate'], $aTICK)]*$server['slots']; + $sum = $tarif['slots'] ? $aPrice[array_search($server['tickrate'], $aTICK)] : $aPrice[array_search($server['tickrate'], $aTICK)]*$server['slots']; - $html->get('extend_sp', 'sections/servers/games/tarif'); + $html->get('extend_sp', 'sections/servers/games/tarif'); - if(isset($html->arr['extend_address'])) - { - $html->unit('extend_address', 1); - $html->set('extend_address', $html->arr['extend_address']); - }else - $html->unit('extend_address'); + if(isset($html->arr['extend_address'])) + { + $html->unit('extend_address', 1); + $html->set('extend_address', $html->arr['extend_address']); + }else + $html->unit('extend_address'); - $html->set('id', $sid); - $html->set('time', sys::date('min', $server['time'])); - $html->set('date', $server['time'] > $start_point ? 'Сервер продлен до: '.date('d.m.Y', $server['time']) : 'Текущая дата: '.date('d.m.Y', $start_point)); - $html->set('options', ''.$options); - $html->set('slots', $server['slots']); - $html->set('info', $server['tickrate'].' TickRate'); - $html->set('tarif', $tarif['name']); - $html->set('sum', $sum); - $html->set('cur', $cfg['currency']); + $html->set('id', $sid); + $html->set('time', sys::date('min', $server['time'])); + $html->set('date', $server['time'] > $start_point ? 'Сервер продлен до: '.date('d.m.Y', $server['time']) : 'Текущая дата: '.date('d.m.Y', $start_point)); + $html->set('options', ''.$options); + $html->set('slots', $server['slots']); + $html->set('info', $server['tickrate'].' TickRate'); + $html->set('tarif', $tarif['name']); + $html->set('sum', $sum); + $html->set('cur', $cfg['currency']); - $html->pack('main'); + $html->pack('main'); - return NULL; - } + return NULL; + } public static function plan($server, $tarif_name, $sid) { - global $cfg, $sql, $html; + global $cfg, $sql, $html; - $sql->query('SELECT `tickrate`, `price` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); + $sql->query('SELECT `tickrate`, `price` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); - if(!$sql->num()) - return NULL; + if(!$sql->num()) + return NULL; - $tarif = $sql->get(); + $tarif = $sql->get(); - $options = ''; + $options = ''; - $aPrice = explode(':', $tarif['price']); - $aTick = explode(':', $tarif['tickrate']); + $aPrice = explode(':', $tarif['price']); + $aTick = explode(':', $tarif['tickrate']); - // Если есть выбор - if(count($aTick) > 1) - { - // Удалить при наличии tickrate сервера из выбора - if(in_array($server['tickrate'], $aTick)) - unset($aTick[array_search($server['tickrate'], $aTick)]); + // Если есть выбор + if(count($aTick) > 1) + { + // Удалить при наличии tickrate сервера из выбора + if(in_array($server['tickrate'], $aTick)) + unset($aTick[array_search($server['tickrate'], $aTick)]); - foreach($aTick as $index => $tickrate) - $options .= ''; - }else - return NULL; + foreach($aTick as $index => $tickrate) + $options .= ''; + }else + return NULL; - $html->get('plan', 'sections/servers/games/tarif'); + $html->get('plan', 'sections/servers/games/tarif'); - $html->set('id', $sid); - $html->set('options', $options); - $html->set('info', $server['tickrate'].' TickRate'); - $html->set('tarif', $tarif_name); + $html->set('id', $sid); + $html->set('options', $options); + $html->set('info', $server['tickrate'].' TickRate'); + $html->set('tarif', $tarif_name); - $html->pack('main'); + $html->pack('main'); - return NULL; - } + return NULL; + } - public static function unit($server, $unit_name, $tarif_name, $sid) + public static function unit($server, $unit_name, $tarif_name, $sid) { - global $cfg, $sql, $html; + global $cfg, $sql, $html; - if(!$cfg['change_unit'][$server['game']]) - return NULL; + if(!$cfg['change_unit'][$server['game']]) + return NULL; - $tarifs = $sql->query('SELECT `unit`, `tickrate` FROM `tarifs` WHERE `game`="'.$server['game'].'" AND `name`="'.$tarif_name.'" AND `id`!="'.$server['tarif'].'" AND `show`="1" ORDER BY `unit`'); - if(!$sql->num($tarifs)) - return NULL; + $tarifs = $sql->query('SELECT `unit`, `tickrate` FROM `tarifs` WHERE `game`="'.$server['game'].'" AND `name`="'.$tarif_name.'" AND `id`!="'.$server['tarif'].'" AND `show`="1" ORDER BY `unit`'); + if(!$sql->num($tarifs)) + return NULL; - $units = 0; + $units = 0; - $options = ''; + $options = ''; - while($tarif = $sql->get($tarifs)) - { - if(!in_array($server['tickrate'], explode(':', $tarif['tickrate']))) - continue; + while($tarif = $sql->get($tarifs)) + { + if(!in_array($server['tickrate'], explode(':', $tarif['tickrate']))) + continue; - $sql->query('SELECT `id`, `name` FROM `units` WHERE `id`="'.$tarif['unit'].'" AND `show`="1" LIMIT 1'); - if(!$sql->num()) - continue; + $sql->query('SELECT `id`, `name` FROM `units` WHERE `id`="'.$tarif['unit'].'" AND `show`="1" LIMIT 1'); + if(!$sql->num()) + continue; - $unit = $sql->get(); + $unit = $sql->get(); - $options .= ''; + $options .= ''; - $units+=1; - } + $units+=1; + } - if(!$units) - return NULL; + if(!$units) + return NULL; - $html->get('unit', 'sections/servers/games/tarif'); + $html->get('unit', 'sections/servers/games/tarif'); - $html->set('id', $sid); - $html->set('options', $options); - $html->set('slots', $server['slots']); - $html->set('info', $server['tickrate'].' TickRate'); - $html->set('unit', $unit_name); - $html->set('tarif', $tarif_name); + $html->set('id', $sid); + $html->set('options', $options); + $html->set('slots', $server['slots']); + $html->set('info', $server['tickrate'].' TickRate'); + $html->set('unit', $unit_name); + $html->set('tarif', $tarif_name); - $html->pack('main'); + $html->pack('main'); - return NULL; - } + return NULL; + } - public static function unit_new($tarif, $unit, $server, $mcache) - { - global $ssh, $sql, $user, $start_point; + public static function unit_new($tarif, $unit, $server, $mcache) + { + global $ssh, $sql, $user, $start_point; - // Проверка ssh соединения с локацией - if(!$ssh->auth($unit['passwd'], $unit['address'])) - sys::outjs(array('e' => sys::text('error', 'ssh'))); + // Проверка ssh соединения с локацией + if(!$ssh->auth($unit['passwd'], $unit['address'])) + sys::outjs(array('e' => sys::text('error', 'ssh'))); - // Директория сборки - $path = $tarif['path'].$tarif['pack']; + // Директория сборки + $path = $tarif['path'].$tarif['pack']; - // Директория игрового сервера - $install = $tarif['install'].$server['uid']; + // Директория игрового сервера + $install = $tarif['install'].$server['uid']; - // Пользователь сервера - $uS = 'server'.$server['uid']; + // Пользователь сервера + $uS = 'server'.$server['uid']; - $ssh->set('mkdir '.$install.';' // Создание директории - .'useradd -d '.$install.' -g servers -u '.$server['uid'].' '.$uS.';' // Создание пользователя сервера на локации - .'chown '.$uS.':1000 '.$install.';' // Изменение владельца и группы директории - .'cd '.$install.' && sudo -u '.$uS.' screen -dmS i_'.$server['uid'].' cp -r '.$path.'/. .'); // Копирование файлов сборки для сервера + $ssh->set('mkdir '.$install.';' // Создание директории + .'useradd -d '.$install.' -g servers -u '.$server['uid'].' '.$uS.';' // Создание пользователя сервера на локации + .'chown '.$uS.':1000 '.$install.';' // Изменение владельца и группы директории + .'cd '.$install.' && sudo -u '.$uS.' screen -dmS i_'.$server['uid'].' cp -r '.$path.'/. .'); // Копирование файлов сборки для сервера - $address = explode(':', $server['address']); + $address = explode(':', $server['address']); - $fix_one = $tarif['core_fix'] ? 1 : 0; + $fix_one = $tarif['core_fix'] ? 1 : 0; - // Обновление данных нового сервера - $sql->query('UPDATE `servers` set - `unit`="'.$tarif['unit'].'", - `tarif`="'.$tarif['id'].'", - `address`="'.$server['address'].'", - `port`="'.$address[1].'", - `status`="install", - `name`="'.$tarif['hostname'].'", - `pack`="'.$tarif['pack'].'", - `map_start`="'.$tarif['map'].'", - `vac`="1", - `hdd`="'.$tarif['hdd'].'", - `time`="'.$tarif['time'].'", - `autostop`="'.$tarif['autostop'].'", - `core_fix`="'.$tarif['core_fix'].'", - `core_fix_one`="'.$fix_one.'", - `reinstall`="'.$start_point.'" WHERE `id`="'.$server['id'].'" LIMIT 1'); + // Обновление данных нового сервера + $sql->query('UPDATE `servers` set + `unit`="'.$tarif['unit'].'", + `tarif`="'.$tarif['id'].'", + `address`="'.$server['address'].'", + `port`="'.$address[1].'", + `status`="install", + `name`="'.$tarif['hostname'].'", + `pack`="'.$tarif['pack'].'", + `map_start`="'.$tarif['map'].'", + `vac`="1", + `hdd`="'.$tarif['hdd'].'", + `time`="'.$tarif['time'].'", + `autostop`="'.$tarif['autostop'].'", + `core_fix`="'.$tarif['core_fix'].'", + `core_fix_one`="'.$fix_one.'", + `reinstall`="'.$start_point.'" WHERE `id`="'.$server['id'].'" LIMIT 1'); - // Запись установленных плагинов - if($tarif['plugins']) - { - // Массив идентификаторов плагинов - $aPlugins = sys::b64js($tarif['plugins_install']); + // Запись установленных плагинов + if($tarif['plugins']) + { + // Массив идентификаторов плагинов + $aPlugins = sys::b64js($tarif['plugins_install']); - if(isset($aPlugins[$tarif['pack']])) - { - $plugins = explode(',', $aPlugins[$tarif['pack']]); + if(isset($aPlugins[$tarif['pack']])) + { + $plugins = explode(',', $aPlugins[$tarif['pack']]); - foreach($plugins as $plugin) - if($plugin) - $sql->query('INSERT INTO `plugins_install` set `server`="'.$server['id'].'", `plugin`="'.$plugin.'", `time`="'.$start_point.'"'); - } - } + foreach($plugins as $plugin) + if($plugin) + $sql->query('INSERT INTO `plugins_install` set `server`="'.$server['id'].'", `plugin`="'.$plugin.'", `time`="'.$start_point.'"'); + } + } - return NULL; - } + return NULL; + } } ?> \ No newline at end of file diff --git a/system/library/games/css/action.php b/system/library/games/css/action.php index 334800b..f01075f 100644 --- a/system/library/games/css/action.php +++ b/system/library/games/css/action.php @@ -1,189 +1,189 @@ query('SELECT `uid`, `unit`, `tarif`, `game`, `address`, `slots_start`, `name`, `tickrate`, `map_start`, `vac`, `time_start`, `core_fix` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `uid`, `unit`, `tarif`, `game`, `address`, `slots_start`, `name`, `tickrate`, `map_start`, `vac`, `time_start`, `core_fix` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - $sql->query('SELECT `install` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); + $sql->query('SELECT `install` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); $tarif = $sql->get(); - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); - - // Проверка ssh соедниения пу с локацией - if(!$ssh->auth($unit['passwd'], $unit['address'])) - return array('e' => sys::text('error', 'ssh')); - - list($ip, $port) = explode(':', $server['address']); - - // Убить процессы - $ssh->set('kill -9 `ps aux | grep s_'.$server['uid'].' | grep -v grep | awk '."'{print $2}'".' | xargs;' - .'lsof -i@'.$server['address'].' | awk '."'{print $2}'".' | grep -v PID | xargs`; sudo -u server'.$server['uid'].' screen -wipe'); - - $taskset = ''; - - // Если включена система автораспределения и не установлен фиксированный поток - if($cfg['cpu_route'] AND !$server['core_fix']) - { - $proc_stat = array(); - - $proc_stat[0] = $ssh->get('cat /proc/stat'); - } - - // Проверка наличия стартовой карты - $ssh->set('cd '.$tarif['install'].$server['uid'].'/cstrike/maps/ && ls | grep .bsp | grep -v .bsp.'); - - if($server['map_start'] != '' AND !in_array($server['map_start'], str_replace('.bsp', '', explode("\n", $ssh->get())))) - return array('e' => sys::updtext(sys::text('servers', 'nomap'), array('map' => $server['map_start'].'.bsp'))); - - // Если система автораспределения продолжить парсинг загрузки процессора - if(isset($proc_stat)) - { - $proc_stat[1] = $ssh->get('cat /proc/stat'); - - // Ядро/поток, на котором будет запущен игровой сервер (поток выбран с рассчетом наименьшей загруженности в момент запуска игрового сервера) - $core = sys::cpu_idle($proc_stat, $server['unit'], false); // число от 1 до n (где n число ядер/потоков в процессоре (без нулевого) - - if(!is_numeric($core)) - return array('e' => sys::text('error', 'cpu')); - - $taskset = 'taskset -c '.$core; - } - - if($server['core_fix']) - { - $core = $server['core_fix']-1; - $taskset = 'taskset -c '.$core; - } - - // Античит VAC - $vac = $server['vac'] == 0 ? '-insecure' : '-secure'; - - // Боты - $bots = $cfg['bots'][$server['game']] ? '' : '-nobots'; - - // TV - $tv = $server['tv'] ? '+tv_enable 1 +tv_maxclients 30 +tv_port '.($port+10000) : '-nohltv'; - - // Параметры запуска - $bash = './srcds_run -debug -game cstrike -norestart -condebug console.log -tickrate '.$server['tickrate'].' +servercfgfile server.cfg +map \''.$server['map_start'].'\' +maxplayers '.$server['slots_start'].' +ip '.$ip.' +port '.$port.' -sv_lan 0 '.$vac.' '.$bots.' '.$tv; - - // Временный файл - $temp = sys::temp($bash); - - // Обновление файла start.sh - $ssh->setfile($temp, $tarif['install'].$server['uid'].'/start.sh', 0500); - - // Строка запуска - $ssh->set('cd '.$tarif['install'].$server['uid'].';' // переход в директорию игрового сервера - .'rm *.pid;' // Удаление *.pid файлов - .'sudo -u server'.$server['uid'].' mkdir -p cstrike/oldstart;' // Создание папки логов - .'cat cstrike/console.log >> cstrike/oldstart/'.date('d.m.Y_H:i:s', $server['time_start']).'.log; rm cstrike/console.log; rm cstrike/oldstart/01.01.1970_03:00:00.log;' // Перемещение лога предыдущего запуска - .'chown server'.$server['uid'].':1000 start.sh;' // Обновление владельца файла start.sh - .'sudo -u server'.$server['uid'].' screen -dmS s_'.$server['uid'].' '.$taskset.' sh -c "./start.sh"'); // Запуск игровго сервера - - $core = !isset($core) ? 0 : $core+1; - - // Обновление информации в базе - $sql->query('UPDATE `servers` set `status`="'.$type.'", `online`="0", `players`="", `core_use`="'.$core.'", `time_start`="'.$start_point.'", `stop`="1" WHERE `id`="'.$id.'" LIMIT 1'); - - unlink($temp); - - // Сброс кеша - actions::clmcache($id); - - sys::reset_mcache('server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => $type, 'online' => 0, 'players' => '')); - sys::reset_mcache('server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => $type, 'online' => 0)); - - return array('s' => 'ok'); - } - - public static function update($id) - { - global $cfg, $sql, $user, $start_point; - - include(LIB.'ssh.php'); - - $sql->query('SELECT `uid`, `unit`, `tarif`, `game`, `name`, `ftp`, `update`, `core_fix` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); - - // Проверка времени обновления - $update = $server['update']+$cfg['update'][$server['game']]*60; - - if($update > $start_point AND $user['group'] != 'admin') - return array('e' => sys::updtext(sys::text('servers', 'update'), array('time' => sys::date('max', $update)))); - - $sql->query('SELECT `address`, `passwd`, `sql_login`, `sql_passwd`, `sql_port`, `sql_ftp` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); $unit = $sql->get(); - $sql->query('SELECT `install`, `plugins_install` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); - $tarif = $sql->get(); - - // Проверка ssh соедниения пу с локацией + // Проверка ssh соедниения пу с локацией if(!$ssh->auth($unit['passwd'], $unit['address'])) return array('e' => sys::text('error', 'ssh')); - $taskset = ''; + list($ip, $port) = explode(':', $server['address']); - // Если включена система автораспределения и не установлен фиксированный поток - if($cfg['cpu_route'] AND !$server['core_fix']) - { - $proc_stat = array(); + // Убить процессы + $ssh->set('kill -9 `ps aux | grep s_'.$server['uid'].' | grep -v grep | awk '."'{print $2}'".' | xargs;' + .'lsof -i@'.$server['address'].' | awk '."'{print $2}'".' | grep -v PID | xargs`; sudo -u server'.$server['uid'].' screen -wipe'); - $proc_stat[0] = $ssh->get('cat /proc/stat'); - } + $taskset = ''; - // Директория игрового сервера - $install = $tarif['install'].$server['uid']; + // Если включена система автораспределения и не установлен фиксированный поток + if($cfg['cpu_route'] AND !$server['core_fix']) + { + $proc_stat = array(); - // Если система автораспределения продолжить парсинг загрузки процессора - if(isset($proc_stat)) - { - $proc_stat[1] = $ssh->get('cat /proc/stat'); + $proc_stat[0] = $ssh->get('cat /proc/stat'); + } - // Ядро/поток, на котором будет запущен игровой сервер (поток выбран с рассчетом наименьшей загруженности в момент запуска игрового сервера) - $core = sys::cpu_idle($proc_stat, $server['unit'], false); // число от 1 до n (где n число ядер/потоков в процессоре (без нулевого) + // Проверка наличия стартовой карты + $ssh->set('cd '.$tarif['install'].$server['uid'].'/cstrike/maps/ && ls | grep .bsp | grep -v .bsp.'); - if(!is_numeric($core)) - return array('e' => 'Не удается выполнить операцию, нет свободного потока.'); + if($server['map_start'] != '' AND !in_array($server['map_start'], str_replace('.bsp', '', explode("\n", $ssh->get())))) + return array('e' => sys::updtext(sys::text('servers', 'nomap'), array('map' => $server['map_start'].'.bsp'))); - $taskset = 'taskset -c '.$core; - } + // Если система автораспределения продолжить парсинг загрузки процессора + if(isset($proc_stat)) + { + $proc_stat[1] = $ssh->get('cat /proc/stat'); - if($server['core_fix']) - { - $core = $server['core_fix']-1; - $taskset = 'taskset -c '.$core; - } + // Ядро/поток, на котором будет запущен игровой сервер (поток выбран с рассчетом наименьшей загруженности в момент запуска игрового сервера) + $core = sys::cpu_idle($proc_stat, $server['unit'], false); // число от 1 до n (где n число ядер/потоков в процессоре (без нулевого) - $ssh->set('cd '.$cfg['steamcmd'].' && sudo -u server'.$server['uid'].' '.$taskset.' sh -c "screen -dmS u_'.$server['uid'].' ./steamcmd.sh +login anonymous +force_install_dir "'.$install.'" +app_update 232330 +quit"'); + if(!is_numeric($core)) + return array('e' => sys::text('error', 'cpu')); - $core = !isset($core) ? 0 : $core+1; + $taskset = 'taskset -c '.$core; + } - // Обновление информации в базе - $sql->query('UPDATE `servers` set `status`="update", `update`="'.$start_point.'", `core_use`="'.$core.'" WHERE `id`="'.$id.'" LIMIT 1'); + if($server['core_fix']) + { + $core = $server['core_fix']-1; + $taskset = 'taskset -c '.$core; + } - // Логирование - $sql->query('INSERT INTO `logs_sys` set `user`="'.$user['id'].'", `server`="'.$id.'", `text`="'.sys::text('syslogs', 'update').'", `time`="'.$start_point.'"'); + // Античит VAC + $vac = $server['vac'] == 0 ? '-insecure' : '-secure'; - // Сброс кеша - actions::clmcache($id); + // Боты + $bots = $cfg['bots'][$server['game']] ? '' : '-nobots'; - sys::reset_mcache('server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'update', 'online' => 0, 'players' => '')); - sys::reset_mcache('server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'update', 'online' => 0)); + // TV + $tv = $server['tv'] ? '+tv_enable 1 +tv_maxclients 30 +tv_port '.($port+10000) : '-nohltv'; - return array('s' => 'ok'); - } + // Параметры запуска + $bash = './srcds_run -debug -game cstrike -norestart -condebug console.log -tickrate '.$server['tickrate'].' +servercfgfile server.cfg +map \''.$server['map_start'].'\' +maxplayers '.$server['slots_start'].' +ip '.$ip.' +port '.$port.' -sv_lan 0 '.$vac.' '.$bots.' '.$tv; + + // Временный файл + $temp = sys::temp($bash); + + // Обновление файла start.sh + $ssh->setfile($temp, $tarif['install'].$server['uid'].'/start.sh', 0500); + + // Строка запуска + $ssh->set('cd '.$tarif['install'].$server['uid'].';' // переход в директорию игрового сервера + .'rm *.pid;' // Удаление *.pid файлов + .'sudo -u server'.$server['uid'].' mkdir -p cstrike/oldstart;' // Создание папки логов + .'cat cstrike/console.log >> cstrike/oldstart/'.date('d.m.Y_H:i:s', $server['time_start']).'.log; rm cstrike/console.log; rm cstrike/oldstart/01.01.1970_03:00:00.log;' // Перемещение лога предыдущего запуска + .'chown server'.$server['uid'].':1000 start.sh;' // Обновление владельца файла start.sh + .'sudo -u server'.$server['uid'].' screen -dmS s_'.$server['uid'].' '.$taskset.' sh -c "./start.sh"'); // Запуск игровго сервера + + $core = !isset($core) ? 0 : $core+1; + + // Обновление информации в базе + $sql->query('UPDATE `servers` set `status`="'.$type.'", `online`="0", `players`="", `core_use`="'.$core.'", `time_start`="'.$start_point.'", `stop`="1" WHERE `id`="'.$id.'" LIMIT 1'); + + unlink($temp); + + // Сброс кеша + actions::clmcache($id); + + sys::reset_mcache('server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => $type, 'online' => 0, 'players' => '')); + sys::reset_mcache('server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => $type, 'online' => 0)); + + return array('s' => 'ok'); + } + + public static function update($id) + { + global $cfg, $sql, $user, $start_point; + + include(LIB.'ssh.php'); + + $sql->query('SELECT `uid`, `unit`, `tarif`, `game`, `name`, `ftp`, `update`, `core_fix` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); + + // Проверка времени обновления + $update = $server['update']+$cfg['update'][$server['game']]*60; + + if($update > $start_point AND $user['group'] != 'admin') + return array('e' => sys::updtext(sys::text('servers', 'update'), array('time' => sys::date('max', $update)))); + + $sql->query('SELECT `address`, `passwd`, `sql_login`, `sql_passwd`, `sql_port`, `sql_ftp` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); + + $sql->query('SELECT `install`, `plugins_install` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); + $tarif = $sql->get(); + + // Проверка ssh соедниения пу с локацией + if(!$ssh->auth($unit['passwd'], $unit['address'])) + return array('e' => sys::text('error', 'ssh')); + + $taskset = ''; + + // Если включена система автораспределения и не установлен фиксированный поток + if($cfg['cpu_route'] AND !$server['core_fix']) + { + $proc_stat = array(); + + $proc_stat[0] = $ssh->get('cat /proc/stat'); + } + + // Директория игрового сервера + $install = $tarif['install'].$server['uid']; + + // Если система автораспределения продолжить парсинг загрузки процессора + if(isset($proc_stat)) + { + $proc_stat[1] = $ssh->get('cat /proc/stat'); + + // Ядро/поток, на котором будет запущен игровой сервер (поток выбран с рассчетом наименьшей загруженности в момент запуска игрового сервера) + $core = sys::cpu_idle($proc_stat, $server['unit'], false); // число от 1 до n (где n число ядер/потоков в процессоре (без нулевого) + + if(!is_numeric($core)) + return array('e' => 'Не удается выполнить операцию, нет свободного потока.'); + + $taskset = 'taskset -c '.$core; + } + + if($server['core_fix']) + { + $core = $server['core_fix']-1; + $taskset = 'taskset -c '.$core; + } + + $ssh->set('cd '.$cfg['steamcmd'].' && sudo -u server'.$server['uid'].' '.$taskset.' sh -c "screen -dmS u_'.$server['uid'].' ./steamcmd.sh +login anonymous +force_install_dir "'.$install.'" +app_update 232330 +quit"'); + + $core = !isset($core) ? 0 : $core+1; + + // Обновление информации в базе + $sql->query('UPDATE `servers` set `status`="update", `update`="'.$start_point.'", `core_use`="'.$core.'" WHERE `id`="'.$id.'" LIMIT 1'); + + // Логирование + $sql->query('INSERT INTO `logs_sys` set `user`="'.$user['id'].'", `server`="'.$id.'", `text`="'.sys::text('syslogs', 'update').'", `time`="'.$start_point.'"'); + + // Сброс кеша + actions::clmcache($id); + + sys::reset_mcache('server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'update', 'online' => 0, 'players' => '')); + sys::reset_mcache('server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'update', 'online' => 0)); + + return array('s' => 'ok'); + } } ?> \ No newline at end of file diff --git a/system/library/games/css/rcon.php b/system/library/games/css/rcon.php index 6a97e06..9896e8a 100644 --- a/system/library/games/css/rcon.php +++ b/system/library/games/css/rcon.php @@ -1,112 +1,112 @@ Connect($ip, $port, 3, SourceQuery::SOURCE); + $sq->Connect($ip, $port, 3, SourceQuery::SOURCE); - $sq->SetRconPassword(rcon::rcon_passwd($server)); + $sq->SetRconPassword(rcon::rcon_passwd($server)); - $out = $sq->Rcon($cmd); + $out = $sq->Rcon($cmd); - $sq->Disconnect(); + $sq->Disconnect(); - return $out; - } + return $out; + } - public static function players($data) - { - $aPlayers = array(); - $n = 1; + public static function players($data) + { + $aPlayers = array(); + $n = 1; - $lines = explode("\n", $data); + $lines = explode("\n", $data); - foreach($lines as $line) - { - if(strpos($line, '#') === FALSE) - continue; + foreach($lines as $line) + { + if(strpos($line, '#') === FALSE) + continue; - $start = strpos($line, '"')+1; - $end = strrpos($line, '"'); + $start = strpos($line, '"')+1; + $end = strrpos($line, '"'); - $userid = sys::int(substr($line, 0, $start)); + $userid = sys::int(substr($line, 0, $start)); - $name = htmlspecialchars(substr($line, $start, $end-$start)); + $name = htmlspecialchars(substr($line, $start, $end-$start)); - $line = trim(substr($line, $end + 1)); + $line = trim(substr($line, $end + 1)); - $aData = array_values(array_diff(explode(' ', $line), array('', ' '))); + $aData = array_values(array_diff(explode(' ', $line), array('', ' '))); - $steamid = trim($aData[0]); - $ip = trim(sys::first(explode(':', $aData[5]))); + $steamid = trim($aData[0]); + $ip = trim(sys::first(explode(':', $aData[5]))); - if((sys::valid($steamid, 'steamid') AND sys::valid($steamid, 'steamid3')) || sys::valid($ip, 'ip')) - continue; + if((sys::valid($steamid, 'steamid') AND sys::valid($steamid, 'steamid3')) || sys::valid($ip, 'ip')) + continue; - $aPlayers[$n]['userid'] = $userid; - $aPlayers[$n]['name'] = $name; - $aPlayers[$n]['steamid'] = $steamid; - $aPlayers[$n]['time'] = trim($aData[1]); - $aPlayers[$n]['ping'] = trim($aData[2]); - $aPlayers[$n]['ip'] = $ip; + $aPlayers[$n]['userid'] = $userid; + $aPlayers[$n]['name'] = $name; + $aPlayers[$n]['steamid'] = $steamid; + $aPlayers[$n]['time'] = trim($aData[1]); + $aPlayers[$n]['ping'] = trim($aData[2]); + $aPlayers[$n]['ip'] = $ip; - $whois = rcon::country($ip); + $whois = rcon::country($ip); - $aPlayers[$n]['ico'] = $whois['ico']; - $aPlayers[$n]['country'] = $whois['name']; + $aPlayers[$n]['ico'] = $whois['ico']; + $aPlayers[$n]['country'] = $whois['name']; - $n+=1; - } + $n+=1; + } - return $aPlayers; - } + return $aPlayers; + } - public static function rcon_passwd($server) - { - global $cfg, $sql, $user; + public static function rcon_passwd($server) + { + global $cfg, $sql, $user; - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); $unit = $sql->get(); - if(!$ssh->auth($unit['passwd'], $unit['address'])) + if(!$ssh->auth($unit['passwd'], $unit['address'])) sys::outjs(array('e' => sys::text('error', 'ssh'))); - $sql->query('SELECT `install` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); - $tarif = $sql->get(); + $sql->query('SELECT `install` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); + $tarif = $sql->get(); - $ssh->set('cat '.$tarif['install'].'/'.$server['uid'].'/cstrike/cfg/server.cfg | grep rcon_password'); - $get = explode(' ', str_replace('"', '', trim($ssh->get()))); - $rcon = trim(end($get)); + $ssh->set('cat '.$tarif['install'].'/'.$server['uid'].'/cstrike/cfg/server.cfg | grep rcon_password'); + $get = explode(' ', str_replace('"', '', trim($ssh->get()))); + $rcon = trim(end($get)); - if(!isset($rcon{0})) - sys::outjs(array('r' => 'Необходимо установить rcon пароль (rcon_password).', 'url' => $cfg['http'].'servers/id/'.$server['id'].'/section/settings/subsection/server'), $nmch); + if(!isset($rcon{0})) + sys::outjs(array('r' => 'Необходимо установить rcon пароль (rcon_password).', 'url' => $cfg['http'].'servers/id/'.$server['id'].'/section/settings/subsection/server'), $nmch); - return $rcon; - } + return $rcon; + } - public static function country($ip) - { - global $SxGeo; + public static function country($ip) + { + global $SxGeo; - $cData = $SxGeo->getCityFull($ip); - $ico = sys::country($cData['country']['iso']); + $cData = $SxGeo->getCityFull($ip); + $ico = sys::country($cData['country']['iso']); - return array('ico' => $ico, 'name' => empty($cData['country']['name_ru']) ? 'Не определена' : $cData['country']['name_ru']); - } - } + return array('ico' => $ico, 'name' => empty($cData['country']['name_ru']) ? 'Не определена' : $cData['country']['name_ru']); + } + } ?> \ No newline at end of file diff --git a/system/library/games/css/scan.php b/system/library/games/css/scan.php index ca76ba3..aeb3bdd 100644 --- a/system/library/games/css/scan.php +++ b/system/library/games/css/scan.php @@ -1,140 +1,140 @@ get($nmch))) - return $mcache->get($nmch); + if(is_array($mcache->get($nmch))) + return $mcache->get($nmch); - $out = array(); + $out = array(); - $info = scan::info($sq, $id); + $info = scan::info($sq, $id); - $sql->query('SELECT `game`, `name`, `map`, `online`, `players`, `status`, `time`, `overdue` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `game`, `name`, `map`, `online`, `players`, `status`, `time`, `overdue` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - $out['time'] = 'Арендован до: '.date('d.m.Y - H:i', $server['time']); + $out['time'] = 'Арендован до: '.date('d.m.Y - H:i', $server['time']); - if($server['status'] == 'overdue') - $out['time_end'] = 'Удаление через: '.sys::date('min', $server['overdue']+$cfg['server_delete']*86400); - else - $out['time_end'] = 'Осталось: '.sys::date('min', $server['time']); + if($server['status'] == 'overdue') + $out['time_end'] = 'Удаление через: '.sys::date('min', $server['overdue']+$cfg['server_delete']*86400); + else + $out['time_end'] = 'Осталось: '.sys::date('min', $server['time']); - if(!$info['status']) - { - $out['name'] = $server['name']; - $out['status'] = sys::status($server['status'], $server['game'], $server['map']); - $out['online'] = $server['online']; - $out['image'] = ''; - $out['buttons'] = sys::buttons($id, $server['status']); + if(!$info['status']) + { + $out['name'] = $server['name']; + $out['status'] = sys::status($server['status'], $server['game'], $server['map']); + $out['online'] = $server['online']; + $out['image'] = ''; + $out['buttons'] = sys::buttons($id, $server['status']); - if($players_get) - $out['players'] = base64_decode($server['players']); + if($players_get) + $out['players'] = base64_decode($server['players']); - $mcache->set($nmch, $out, false, $cfg['mcache_server_mon']); + $mcache->set($nmch, $out, false, $cfg['mcache_server_mon']); - return $out; - } + return $out; + } - if($players_get) - $players = scan::info($sq, $id, true); + if($players_get) + $players = scan::info($sq, $id, true); - $out['name'] = htmlspecialchars($info['name']); - $out['status'] = sys::status('working', $server['game'], $info['map']); - $out['online'] = $info['online']; - $out['image'] = ''; - $out['buttons'] = sys::buttons($id, 'working'); - $out['players'] = ''; + $out['name'] = htmlspecialchars($info['name']); + $out['status'] = sys::status('working', $server['game'], $info['map']); + $out['online'] = $info['online']; + $out['image'] = ''; + $out['buttons'] = sys::buttons($id, 'working'); + $out['players'] = ''; - if($players_get) - { - foreach($players as $index => $player) - { - $html->get($server['game'], 'sections/servers/players'); + if($players_get) + { + foreach($players as $index => $player) + { + $html->get($server['game'], 'sections/servers/players'); - $html->set('i', $player['i']); - $html->set('name', $player['name']); - $html->set('score', $player['score']); - $html->set('time', $player['time']); + $html->set('i', $player['i']); + $html->set('name', $player['name']); + $html->set('score', $player['score']); + $html->set('time', $player['time']); - $html->pack('list'); - } + $html->pack('list'); + } - $out['players'] = isset($html->arr['list']) ? $html->arr['list'] : ''; - } + $out['players'] = isset($html->arr['list']) ? $html->arr['list'] : ''; + } - $sql->query('UPDATE `servers` set ' - .'`name`="'.$out['name'].'", ' - .'`online`="'.$out['online'].'", ' - .'`map`="'.$info['map'].'", ' - .'`status`="working" WHERE `id`="'.$id.'" LIMIT 1'); + $sql->query('UPDATE `servers` set ' + .'`name`="'.$out['name'].'", ' + .'`online`="'.$out['online'].'", ' + .'`map`="'.$info['map'].'", ' + .'`status`="working" WHERE `id`="'.$id.'" LIMIT 1'); - if($players_get) - $sql->query('UPDATE `servers` set `players`="'.base64_encode($out['players']).'" WHERE `id`="'.$id.'" LIMIT 1'); + if($players_get) + $sql->query('UPDATE `servers` set `players`="'.base64_encode($out['players']).'" WHERE `id`="'.$id.'" LIMIT 1'); - $mcache->set($nmch, $out, false, $cfg['mcache_server_mon']); + $mcache->set($nmch, $out, false, $cfg['mcache_server_mon']); - return $out; - } + return $out; + } - public static function info($sq, $id, $pl = false) - { - global $sql; + public static function info($sq, $id, $pl = false) + { + global $sql; - $sql->query('SELECT `address` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `address` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - list($ip, $port) = explode(':', $server['address']); + list($ip, $port) = explode(':', $server['address']); - $sq->Connect($ip, $port, 1, SourceQuery::SOURCE); + $sq->Connect($ip, $port, 1, SourceQuery::SOURCE); - if($pl) - { - $players = $sq->GetPlayers(); + if($pl) + { + $players = $sq->GetPlayers(); - $i = 1; - $data = array(); + $i = 1; + $data = array(); - foreach($players as $n => $player) - { - $data[$i]['i'] = $i; - $data[$i]['name'] = $player['Name'] == '' ? 'Подключается' : $player['Name']; - $data[$i]['score'] = $player['Frags']; - $data[$i]['time'] = $player['TimeF']; + foreach($players as $n => $player) + { + $data[$i]['i'] = $i; + $data[$i]['name'] = $player['Name'] == '' ? 'Подключается' : $player['Name']; + $data[$i]['score'] = $player['Frags']; + $data[$i]['time'] = $player['TimeF']; - $i+=1; - } + $i+=1; + } - return $data; - } + return $data; + } - $data = $sq->GetInfo(); + $data = $sq->GetInfo(); - $server['name'] = $data['HostName']; - $server['map'] = $data['Map']; - $server['online'] = $data['Players']; - $server['status'] = strlen($server['map']) > 3 ? true : false; + $server['name'] = $data['HostName']; + $server['map'] = $data['Map']; + $server['online'] = $data['Players']; + $server['status'] = strlen($server['map']) > 3 ? true : false; - return $server; - } - } + return $server; + } + } ?> \ No newline at end of file diff --git a/system/library/games/css/service.php b/system/library/games/css/service.php index efc9a89..d541dad 100644 --- a/system/library/games/css/service.php +++ b/system/library/games/css/service.php @@ -1,369 +1,369 @@ query('SELECT `address`, `test` FROM `units` WHERE `id`="'.$aData['unit'].'" AND `css`="1" AND `show`="1" LIMIT 1'); - if(!$sql->num()) - sys::outjs(array('e' => 'Локация не найдена.')); + // Проверка локации + $sql->query('SELECT `address`, `test` FROM `units` WHERE `id`="'.$aData['unit'].'" AND `css`="1" AND `show`="1" LIMIT 1'); + if(!$sql->num()) + sys::outjs(array('e' => 'Локация не найдена.')); - $unit = $sql->get(); + $unit = $sql->get(); - // Проверка тарифа - $sql->query('SELECT `id` FROM `tarifs` WHERE `id`="'.$aData['tarif'].'" AND `unit`="'.$aData['unit'].'" AND `show`="1" LIMIT 1'); - if(!$sql->num()) - sys::outjs(array('e' => 'Тариф не найден.')); + // Проверка тарифа + $sql->query('SELECT `id` FROM `tarifs` WHERE `id`="'.$aData['tarif'].'" AND `unit`="'.$aData['unit'].'" AND `show`="1" LIMIT 1'); + if(!$sql->num()) + sys::outjs(array('e' => 'Тариф не найден.')); - $sql->query('SELECT ' - .'`slots_min`,' - .'`slots_max`,' - .'`port_min`,' - .'`port_max`,' - .'`hostname`,' - .'`packs`,' - .'`tickrate`,' - .'`time`,' - .'`test`,' - .'`tests`,' - .'`discount`,' - .'`map`,' - .'`ftp`,' - .'`plugins`,' - .'`console`,' - .'`stats`,' - .'`copy`,' - .'`web`,' - .'`plugins_install`,' - .'`hdd`,' - .'`autostop`,' - .'`core_fix`,' - .'`ip`,' - .'`price`' - .' FROM `tarifs` WHERE `id`="'.$aData['tarif'].'" LIMIT 1'); + $sql->query('SELECT ' + .'`slots_min`,' + .'`slots_max`,' + .'`port_min`,' + .'`port_max`,' + .'`hostname`,' + .'`packs`,' + .'`tickrate`,' + .'`time`,' + .'`test`,' + .'`tests`,' + .'`discount`,' + .'`map`,' + .'`ftp`,' + .'`plugins`,' + .'`console`,' + .'`stats`,' + .'`copy`,' + .'`web`,' + .'`plugins_install`,' + .'`hdd`,' + .'`autostop`,' + .'`core_fix`,' + .'`ip`,' + .'`price`' + .' FROM `tarifs` WHERE `id`="'.$aData['tarif'].'" LIMIT 1'); - $tarif = $sql->get(); + $tarif = $sql->get(); - // Проверка сборки - if(!array_key_exists($aData['pack'], sys::b64djs($tarif['packs'], true))) - sys::outjs(array('e' => 'Сборка не найдена.')); + // Проверка сборки + if(!array_key_exists($aData['pack'], sys::b64djs($tarif['packs'], true))) + sys::outjs(array('e' => 'Сборка не найдена.')); - // Проверка TickRate - if(!in_array($aData['tickrate'], explode(':', $tarif['tickrate']))) - sys::outjs(array('e' => 'Переданные данные tickrate неверны.')); + // Проверка TickRate + if(!in_array($aData['tickrate'], explode(':', $tarif['tickrate']))) + sys::outjs(array('e' => 'Переданные данные tickrate неверны.')); - $test = 0; + $test = 0; - // Проверка периода на тест - if($aData['test']) - { - if(!$tarif['test'] || !$unit['test']) - sys::outjs(array('e' => 'Тестовый период недоступен.')); + // Проверка периода на тест + if($aData['test']) + { + if(!$tarif['test'] || !$unit['test']) + sys::outjs(array('e' => 'Тестовый период недоступен.')); - // Проверка на повторный запрос - $sql->query('SELECT `id`, `game` FROM `tests` WHERE `user`="'.$user['id'].'" LIMIT 1'); - if($sql->num()) - { - $test_info = $sql->get(); + // Проверка на повторный запрос + $sql->query('SELECT `id`, `game` FROM `tests` WHERE `user`="'.$user['id'].'" LIMIT 1'); + if($sql->num()) + { + $test_info = $sql->get(); - if(!$cfg['tests']['game'] || $test_info['game'] == 'css') - sys::outjs(array('e' => 'Тестовый период предоставляется один раз.')); + if(!$cfg['tests']['game'] || $test_info['game'] == 'css') + sys::outjs(array('e' => 'Тестовый период предоставляется один раз.')); - $sql->query('SELECT `id` FROM `servers` WHERE `user`="'.$user['id'].'" AND `test`="1" LIMIT 1'); - if($sql->num() AND !$cfg['tests']['sametime']) - sys::outjs(array('e' => 'Чтобы получить тестовый период другой игры, дождитесь окончания текущего.')); - } + $sql->query('SELECT `id` FROM `servers` WHERE `user`="'.$user['id'].'" AND `test`="1" LIMIT 1'); + if($sql->num() AND !$cfg['tests']['sametime']) + sys::outjs(array('e' => 'Чтобы получить тестовый период другой игры, дождитесь окончания текущего.')); + } - // Проверка наличия мест на локации - $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND `test`="1" AND `time`>"'.$start_point.'" LIMIT '.$unit['test']); - if($sql->num() == $unit['test']) - sys::outjs(array('e' => 'Свободного места для тестового периода нет.')); + // Проверка наличия мест на локации + $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND `test`="1" AND `time`>"'.$start_point.'" LIMIT '.$unit['test']); + if($sql->num() == $unit['test']) + sys::outjs(array('e' => 'Свободного места для тестового периода нет.')); - // Проверка наличия мест для выбранного тарифа - $sql->query('SELECT `id` FROM `servers` WHERE `tarif`="'.$aData['tarif'].'" AND `test`="1" AND `time`>"'.$start_point.'" LIMIT '.$tarif['tests']); - if($sql->num() == $tarif['tests']) - sys::outjs(array('e' => 'Свободного места для тестового периода выбранного тарифа нет.')); + // Проверка наличия мест для выбранного тарифа + $sql->query('SELECT `id` FROM `servers` WHERE `tarif`="'.$aData['tarif'].'" AND `test`="1" AND `time`>"'.$start_point.'" LIMIT '.$tarif['tests']); + if($sql->num() == $tarif['tests']) + sys::outjs(array('e' => 'Свободного места для тестового периода выбранного тарифа нет.')); - $test = 1; - }else - // Проверка периода - if(!$cfg['settlement_period'] AND !in_array($aData['time'], explode(':', $tarif['time']))) - sys::outjs(array('e' => 'Переданные данные периода неверны.')); + $test = 1; + }else + // Проверка периода + if(!$cfg['settlement_period'] AND !in_array($aData['time'], explode(':', $tarif['time']))) + sys::outjs(array('e' => 'Переданные данные периода неверны.')); - // Проверка слот - if($aData['slots'] < $tarif['slots_min'] || $aData['slots'] > $tarif['slots_max']) - sys::outjs(array('e' => 'Переданные данные слот неверны.')); + // Проверка слот + if($aData['slots'] < $tarif['slots_min'] || $aData['slots'] > $tarif['slots_max']) + sys::outjs(array('e' => 'Переданные данные слот неверны.')); - // Определение цены - $aPrice = explode(':', $tarif['price']); - $price = $aPrice[array_search($aData['tickrate'], explode(':', $tarif['tickrate']))]; + // Определение цены + $aPrice = explode(':', $tarif['price']); + $price = $aPrice[array_search($aData['tickrate'], explode(':', $tarif['tickrate']))]; - // Определение суммы - if($cfg['settlement_period']) - { - // Цена аренды за расчетный период - $sum = games::define_sum($tarif['discount'], $price, $aData['slots'], $start_point); + // Определение суммы + if($cfg['settlement_period']) + { + // Цена аренды за расчетный период + $sum = games::define_sum($tarif['discount'], $price, $aData['slots'], $start_point); - $aData['time'] = games::define_period('buy', params::$aDayMonth); - }else - $sum = games::define_sum($tarif['discount'], $price, $aData['slots'], $aData['time']); + $aData['time'] = games::define_period('buy', params::$aDayMonth); + }else + $sum = games::define_sum($tarif['discount'], $price, $aData['slots'], $aData['time']); - // Проверка промо-кода - $promo = games::define_promo( - $aData['promo'], - array( - 'tarif' => $aData['tarif'], - 'tickrate' => $aData['tickrate'], - 'slots' => $aData['slots'], - 'time' => $aData['time'], - 'user' => $user['id'] - ), - $tarif['discount'], - $sum - ); + // Проверка промо-кода + $promo = games::define_promo( + $aData['promo'], + array( + 'tarif' => $aData['tarif'], + 'tickrate' => $aData['tickrate'], + 'slots' => $aData['slots'], + 'time' => $aData['time'], + 'user' => $user['id'] + ), + $tarif['discount'], + $sum + ); - $days = $aData['time']; // Кол-во дней аренды + $days = $aData['time']; // Кол-во дней аренды - // Использование промо-кода - if(is_array($promo)) - { - if(array_key_exists('sum', $promo)) - $sum = $promo['sum']; - else - $days += $promo['days']; // Кол-во дней аренды с учетом подарочных (промо-код) - } + // Использование промо-кода + if(is_array($promo)) + { + if(array_key_exists('sum', $promo)) + $sum = $promo['sum']; + else + $days += $promo['days']; // Кол-во дней аренды с учетом подарочных (промо-код) + } - // Проверка баланса - if($user['balance'] < $sum) - sys::outjs(array('e' => 'У вас не хватает '.(round($sum-$user['balance'], 2)).' '.$cfg['currency'])); + // Проверка баланса + if($user['balance'] < $sum) + sys::outjs(array('e' => 'У вас не хватает '.(round($sum-$user['balance'], 2)).' '.$cfg['currency'])); - // Выделенный адрес игрового сервера - if(!empty($tarif['ip'])) - { - $aIp = explode(':', $tarif['ip']); + // Выделенный адрес игрового сервера + if(!empty($tarif['ip'])) + { + $aIp = explode(':', $tarif['ip']); - $ip = false; - $port = params::$aDefPort['css']; + $ip = false; + $port = params::$aDefPort['css']; - // Проверка наличия свободного адреса - foreach($aIp as $adr) - { - $adr = trim($adr); + // Проверка наличия свободного адреса + foreach($aIp as $adr) + { + $adr = trim($adr); - $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND `address` LIKE "'.$adr.':%" LIMIT 1'); - if(!$sql->num()) - { - $ip = $adr; + $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND `address` LIKE "'.$adr.':%" LIMIT 1'); + if(!$sql->num()) + { + $ip = $adr; - break; - } - } - }else{ - $ip = sys::first(explode(':', $unit['address'])); - $port = false; + break; + } + } + }else{ + $ip = sys::first(explode(':', $unit['address'])); + $port = false; - // Проверка наличия свободного порта - for($tarif['port_min']; $tarif['port_min'] <= $tarif['port_max']; $tarif['port_min']+=1) - { - $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND (`address`="'.$ip.':'.$tarif['port_min'].'" OR `port`="'.$tarif['port_min'].'") LIMIT 1'); - if(!$sql->num()) - { - $port = $tarif['port_min']; + // Проверка наличия свободного порта + for($tarif['port_min']; $tarif['port_min'] <= $tarif['port_max']; $tarif['port_min']+=1) + { + $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND (`address`="'.$ip.':'.$tarif['port_min'].'" OR `port`="'.$tarif['port_min'].'") LIMIT 1'); + if(!$sql->num()) + { + $port = $tarif['port_min']; - break; - } - } - } + break; + } + } + } - if(!$ip || !$port) - { - $sql->query('UPDATE `tarifs` set `show`="0" WHERE `id`="'.$aData['tarif'].'" LIMIT 1'); + if(!$ip || !$port) + { + $sql->query('UPDATE `tarifs` set `show`="0" WHERE `id`="'.$aData['tarif'].'" LIMIT 1'); - sys::outjs(array('e' => 'К сожалению нет доступных мест, обратитесь в тех.поддержку.')); - } + sys::outjs(array('e' => 'К сожалению нет доступных мест, обратитесь в тех.поддержку.')); + } - if($test) - $aData['time'] = games::time($start_point, $tarif['test']); - else - $aData['time'] = games::time($start_point, $days); + if($test) + $aData['time'] = games::time($start_point, $tarif['test']); + else + $aData['time'] = games::time($start_point, $days); - $fix_one = 0; - $core = 0; + $fix_one = 0; + $core = 0; - if($tarif['core_fix'] != '') - { - $aCore = explode(',', $tarif['core_fix']); + if($tarif['core_fix'] != '') + { + $aCore = explode(',', $tarif['core_fix']); - foreach($aCore as $cpu) - { - $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND `tarif`="'.$aData['tarif'].'" AND `core_fix`="'.$cpu.'" AND `core_fix_one`="1" LIMIT 1'); + foreach($aCore as $cpu) + { + $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND `tarif`="'.$aData['tarif'].'" AND `core_fix`="'.$cpu.'" AND `core_fix_one`="1" LIMIT 1'); - if($sql->num()) - continue; + if($sql->num()) + continue; - $fix_one = 1; - $core = $cpu; + $fix_one = 1; + $core = $cpu; - break; - } + break; + } - if(!$core) - { - $sql->query('UPDATE `tarifs` set `show`="0" WHERE `id`="'.$aData['tarif'].'" LIMIT 1'); + if(!$core) + { + $sql->query('UPDATE `tarifs` set `show`="0" WHERE `id`="'.$aData['tarif'].'" LIMIT 1'); - sys::outjs(array('e' => 'К сожалению нет доступных мест, обратитесь в тех.поддержку.')); - } - } + sys::outjs(array('e' => 'К сожалению нет доступных мест, обратитесь в тех.поддержку.')); + } + } - $ram = $tarif['param_fix'] ? $aData['ram'] : $cfg['ram']['css']*$aSDATA['slots']; + $ram = $tarif['param_fix'] ? $aData['ram'] : $cfg['ram']['css']*$aSDATA['slots']; - // Массив данных - $aSDATA = array( - 'unit' => $aData['unit'], // идентификатор локации - 'tarif' => $aData['tarif'], // идентификатор тарифа - 'ram' => $ram, // значение ram - 'param_fix' => $tarif['param_fix'], // фиксированные параметры - 'tickrate' => $aData['tickrate'], // значение tickrate - 'pack' => $aData['pack'], // Выбранная сборка для установки - 'time' => $aData['time'], // Время аренды - 'days' => $days, // Число дней - 'sum' => $sum, // Сумма списания - 'test' => $test, // тестовый период - 'address' => $ip.':'.$port, // адрес игрового сервера - 'port' => $port, // порт игрового сервера - 'slots' => $aData['slots'], // Кол-во слот - 'map' => $tarif['map'], // Фиксированное значение слот - 'autostop' => $tarif['autostop'], // Выключение при 0 онлайне - 'ftp' => $tarif['ftp'], // Использование ftp - 'plugins' => $tarif['plugins'], // Использование плагинов - 'console' => $tarif['console'], // Использование консоли - 'stats' => $tarif['stats'], // Использование графиков (ведение статистики) - 'copy' => $tarif['copy'], // Использование резервных копий - 'web' => $tarif['web'], // Использование доп услуг - 'plugins_install' => $tarif['plugins_install'], // Список установленных плагинов - 'hdd' => $tarif['hdd'], // Дисковое пространство - 'core_fix' => $core, // Выделенный поток - 'core_fix_one' => $fix_one, // Выделенный поток - 'promo' => $promo // Использование промо-кода - ); + // Массив данных + $aSDATA = array( + 'unit' => $aData['unit'], // идентификатор локации + 'tarif' => $aData['tarif'], // идентификатор тарифа + 'ram' => $ram, // значение ram + 'param_fix' => $tarif['param_fix'], // фиксированные параметры + 'tickrate' => $aData['tickrate'], // значение tickrate + 'pack' => $aData['pack'], // Выбранная сборка для установки + 'time' => $aData['time'], // Время аренды + 'days' => $days, // Число дней + 'sum' => $sum, // Сумма списания + 'test' => $test, // тестовый период + 'address' => $ip.':'.$port, // адрес игрового сервера + 'port' => $port, // порт игрового сервера + 'slots' => $aData['slots'], // Кол-во слот + 'map' => $tarif['map'], // Фиксированное значение слот + 'autostop' => $tarif['autostop'], // Выключение при 0 онлайне + 'ftp' => $tarif['ftp'], // Использование ftp + 'plugins' => $tarif['plugins'], // Использование плагинов + 'console' => $tarif['console'], // Использование консоли + 'stats' => $tarif['stats'], // Использование графиков (ведение статистики) + 'copy' => $tarif['copy'], // Использование резервных копий + 'web' => $tarif['web'], // Использование доп услуг + 'plugins_install' => $tarif['plugins_install'], // Список установленных плагинов + 'hdd' => $tarif['hdd'], // Дисковое пространство + 'core_fix' => $core, // Выделенный поток + 'core_fix_one' => $fix_one, // Выделенный поток + 'promo' => $promo // Использование промо-кода + ); - return $aSDATA; - } + return $aSDATA; + } - public static function install($aSDATA = array()) - { - global $cfg, $sql, $user, $start_point; + public static function install($aSDATA = array()) + { + global $cfg, $sql, $user, $start_point; - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - // Массив данных локации (адрес,пароль) - $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$aSDATA['unit'].'" LIMIT 1'); - $unit = $sql->get(); + // Массив данных локации (адрес,пароль) + $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$aSDATA['unit'].'" LIMIT 1'); + $unit = $sql->get(); - // Проверка ssh соединения с локацией - if(!$ssh->auth($unit['passwd'], $unit['address'])) - sys::outjs(array('e' => sys::text('error', 'ssh'))); + // Проверка ssh соединения с локацией + if(!$ssh->auth($unit['passwd'], $unit['address'])) + sys::outjs(array('e' => sys::text('error', 'ssh'))); - // Массив данных тарифа (путь сборки,путь установки) - $sql->query('SELECT `path`, `install`, `hostname` FROM `tarifs` WHERE `id`="'.$aSDATA['tarif'].'" LIMIT 1'); - $tarif = $sql->get(); + // Массив данных тарифа (путь сборки,путь установки) + $sql->query('SELECT `path`, `install`, `hostname` FROM `tarifs` WHERE `id`="'.$aSDATA['tarif'].'" LIMIT 1'); + $tarif = $sql->get(); - // Получение идентификаторов игрового сервера - $sql->query('INSERT INTO `servers` set uid="1"'); - $id = $sql->id(); - $uid = $id+1000; + // Получение идентификаторов игрового сервера + $sql->query('INSERT INTO `servers` set uid="1"'); + $id = $sql->id(); + $uid = $id+1000; - // Директория сборки - $path = $tarif['path'].$aSDATA['pack']; + // Директория сборки + $path = $tarif['path'].$aSDATA['pack']; - // Директория игрового сервера - $install = $tarif['install'].$uid; + // Директория игрового сервера + $install = $tarif['install'].$uid; - $ssh->set('mkdir '.$install.';' // Создание директории - .'useradd -s /bin/false -d '.$install.' -g servers -u '.$uid.' server'.$uid.';' // Создание пользователя сервера на локации - .'chown server'.$uid.':1000 '.$install.';' // Изменение владельца и группы директории - .'cd '.$install.' && sudo -u server'.$uid.' screen -dmS i_'.$uid.' sh -c "cp -r '.$path.'/. .;' // Копирование файлов сборки для сервера - .'find . -type d -exec chmod 700 {} \;;' - .'find . -type f -exec chmod 600 {} \;;' - .'chmod 500 '.params::$aFileGame['css'].'"'); + $ssh->set('mkdir '.$install.';' // Создание директории + .'useradd -s /bin/false -d '.$install.' -g servers -u '.$uid.' server'.$uid.';' // Создание пользователя сервера на локации + .'chown server'.$uid.':1000 '.$install.';' // Изменение владельца и группы директории + .'cd '.$install.' && sudo -u server'.$uid.' screen -dmS i_'.$uid.' sh -c "cp -r '.$path.'/. .;' // Копирование файлов сборки для сервера + .'find . -type d -exec chmod 700 {} \;;' + .'find . -type f -exec chmod 600 {} \;;' + .'chmod 500 '.params::$aFileGame['css'].'"'); - // Запись данных нового сервера - $sql->query('UPDATE `servers` set - `uid`="'.$uid.'", - `unit`="'.$aSDATA['unit'].'", - `tarif`="'.$aSDATA['tarif'].'", - `user`="'.$user['id'].'", - `address`="'.$aSDATA['address'].'", - `port`="'.$aSDATA['port'].'", - `game`="css", - `slots`="'.$aSDATA['slots'].'", - `slots_start`="'.$aSDATA['slots'].'", - `status`="install", - `name`="'.$tarif['hostname'].'", - `pack`="'.$aSDATA['pack'].'", - `plugins_use`="'.$aSDATA['plugins'].'", - `ftp_use`="'.$aSDATA['ftp'].'", - `console_use`="'.$aSDATA['console'].'", - `stats_use`="'.$aSDATA['stats'].'", - `copy_use`="'.$aSDATA['copy'].'", - `web_use`="'.$aSDATA['web'].'", - `tickrate`="'.$aSDATA['tickrate'].'", - `map_start`="'.$aSDATA['map'].'", - `vac`="1", - `hdd`="'.$aSDATA['hdd'].'", - `time`="'.$aSDATA['time'].'", - `date`="'.$start_point.'", - `test`="'.$aSDATA['test'].'", - `ram`="'.$aSDATA['ram'].'", - `core_fix`="'.$aSDATA['core_fix'].'", - `core_fix_one`="'.$aSDATA['core_fix_one'].'", - `autostop`="'.$aSDATA['autostop'].'" WHERE `id`="'.$id.'" LIMIT 1'); + // Запись данных нового сервера + $sql->query('UPDATE `servers` set + `uid`="'.$uid.'", + `unit`="'.$aSDATA['unit'].'", + `tarif`="'.$aSDATA['tarif'].'", + `user`="'.$user['id'].'", + `address`="'.$aSDATA['address'].'", + `port`="'.$aSDATA['port'].'", + `game`="css", + `slots`="'.$aSDATA['slots'].'", + `slots_start`="'.$aSDATA['slots'].'", + `status`="install", + `name`="'.$tarif['hostname'].'", + `pack`="'.$aSDATA['pack'].'", + `plugins_use`="'.$aSDATA['plugins'].'", + `ftp_use`="'.$aSDATA['ftp'].'", + `console_use`="'.$aSDATA['console'].'", + `stats_use`="'.$aSDATA['stats'].'", + `copy_use`="'.$aSDATA['copy'].'", + `web_use`="'.$aSDATA['web'].'", + `tickrate`="'.$aSDATA['tickrate'].'", + `map_start`="'.$aSDATA['map'].'", + `vac`="1", + `hdd`="'.$aSDATA['hdd'].'", + `time`="'.$aSDATA['time'].'", + `date`="'.$start_point.'", + `test`="'.$aSDATA['test'].'", + `ram`="'.$aSDATA['ram'].'", + `core_fix`="'.$aSDATA['core_fix'].'", + `core_fix_one`="'.$aSDATA['core_fix_one'].'", + `autostop`="'.$aSDATA['autostop'].'" WHERE `id`="'.$id.'" LIMIT 1'); - // Запись установленных плагинов - if($aSDATA['plugins']) - { - // Массив идентификаторов плагинов - $aPlugins = sys::b64djs($aSDATA['plugins_install']); + // Запись установленных плагинов + if($aSDATA['plugins']) + { + // Массив идентификаторов плагинов + $aPlugins = sys::b64djs($aSDATA['plugins_install']); - if(isset($aPlugins[$aSDATA['pack']])) - { - $plugins = explode(',', $aPlugins[$aSDATA['pack']]); + if(isset($aPlugins[$aSDATA['pack']])) + { + $plugins = explode(',', $aPlugins[$aSDATA['pack']]); - foreach($plugins as $plugin) - if($plugin) - $sql->query('INSERT INTO `plugins_install` set `server`="'.$id.'", `plugin`="'.$plugin.'", `time`="'.$start_point.'"'); - } - } + foreach($plugins as $plugin) + if($plugin) + $sql->query('INSERT INTO `plugins_install` set `server`="'.$id.'", `plugin`="'.$plugin.'", `time`="'.$start_point.'"'); + } + } - // Списание средств с баланса пользователя - $sql->query('UPDATE `users` set `balance`="'.($user['balance']-$aSDATA['sum']).'" WHERE `id`="'.$user['id'].'" LIMIT 1'); + // Списание средств с баланса пользователя + $sql->query('UPDATE `users` set `balance`="'.($user['balance']-$aSDATA['sum']).'" WHERE `id`="'.$user['id'].'" LIMIT 1'); - // Запись получения тестового периода - if($aSDATA['test']) - { - $sql->query('INSERT INTO `tests` set `server`="'.$id.'", `unit`="'.$aSDATA['unit'].'", `game`="css", `user`="'.$user['id'].'", `time`="'.$start_point.'"'); - $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="'.sys::updtext(sys::text('logs', 'buy_server_test'), array('id' => $id)).'", `date`="'.$start_point.'", `type`="buy", `money`="0"'); - }else{ - // Реф. система - games::part($user['id'], $aSDATA['sum']); + // Запись получения тестового периода + if($aSDATA['test']) + { + $sql->query('INSERT INTO `tests` set `server`="'.$id.'", `unit`="'.$aSDATA['unit'].'", `game`="css", `user`="'.$user['id'].'", `time`="'.$start_point.'"'); + $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="'.sys::updtext(sys::text('logs', 'buy_server_test'), array('id' => $id)).'", `date`="'.$start_point.'", `type`="buy", `money`="0"'); + }else{ + // Реф. система + games::part($user['id'], $aSDATA['sum']); - // Запись логов - if(!is_array($aSDATA['promo'])) - $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="'.sys::updtext(sys::text('logs', 'buy_server'), array('days' => games::parse_day($aSDATA['days'], true), 'money' => $aSDATA['sum'], 'id' => $id)).'", `date`="'.$start_point.'", `type`="buy", `money`="'.$aSDATA['sum'].'"'); - else{ - $sql->query('UPDATE `servers` set `benefit`="'.$aSDATA['time'].'" WHERE `id`="'.$id.'" LIMIT 1'); - $sql->query('INSERT INTO `promo_use` set `promo`="'.$aSDATA['promo']['id'].'", `user`="'.$user['id'].'", `time`="'.$start_point.'"'); - $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="'.sys::updtext(sys::text('logs', 'buy_server_promo'), array('days' => games::parse_day($aSDATA['days'], true), 'money' => $aSDATA['sum'], 'promo' => $aSDATA['promo']['cod'], 'id' => $id)).'", `date`="'.$start_point.'", `type`="buy", `money`="'.$aSDATA['sum'].'"'); - } - } + // Запись логов + if(!is_array($aSDATA['promo'])) + $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="'.sys::updtext(sys::text('logs', 'buy_server'), array('days' => games::parse_day($aSDATA['days'], true), 'money' => $aSDATA['sum'], 'id' => $id)).'", `date`="'.$start_point.'", `type`="buy", `money`="'.$aSDATA['sum'].'"'); + else{ + $sql->query('UPDATE `servers` set `benefit`="'.$aSDATA['time'].'" WHERE `id`="'.$id.'" LIMIT 1'); + $sql->query('INSERT INTO `promo_use` set `promo`="'.$aSDATA['promo']['id'].'", `user`="'.$user['id'].'", `time`="'.$start_point.'"'); + $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="'.sys::updtext(sys::text('logs', 'buy_server_promo'), array('days' => games::parse_day($aSDATA['days'], true), 'money' => $aSDATA['sum'], 'promo' => $aSDATA['promo']['cod'], 'id' => $id)).'", `date`="'.$start_point.'", `type`="buy", `money`="'.$aSDATA['sum'].'"'); + } + } - return $id; - } + return $id; + } } ?> \ No newline at end of file diff --git a/system/library/games/css/tarif.php b/system/library/games/css/tarif.php index 0aba2f5..5dffa48 100644 --- a/system/library/games/css/tarif.php +++ b/system/library/games/css/tarif.php @@ -1,225 +1,225 @@ get('extend', 'sections/servers/games/tarif'); + $html->get('extend', 'sections/servers/games/tarif'); - if(isset($html->arr['extend_address'])) - { - $html->unit('extend_address', 1); - $html->set('extend_address', $html->arr['extend_address']); - }else - $html->unit('extend_address'); + if(isset($html->arr['extend_address'])) + { + $html->unit('extend_address', 1); + $html->set('extend_address', $html->arr['extend_address']); + }else + $html->unit('extend_address'); - $html->set('id', $sid); - $html->set('time', sys::date('min', $server['time'])); - $html->set('options', ''.$options); - $html->set('slots', $server['slots']); - $html->set('info', $server['tickrate'].' TickRate'); - $html->set('tarif', $tarif_name); - $html->set('cur', $cfg['currency']); + $html->set('id', $sid); + $html->set('time', sys::date('min', $server['time'])); + $html->set('options', ''.$options); + $html->set('slots', $server['slots']); + $html->set('info', $server['tickrate'].' TickRate'); + $html->set('tarif', $tarif_name); + $html->set('cur', $cfg['currency']); - $html->pack('main'); + $html->pack('main'); - return NULL; - } + return NULL; + } public static function extend_sp($server, $tarif, $sid) { - global $cfg, $sql, $html, $start_point; + global $cfg, $sql, $html, $start_point; - tarifs::extend_address($server['game'], $sid); + tarifs::extend_address($server['game'], $sid); - $aPrice = explode(':', $tarif['price']); - $aTICK = explode(':', $tarif['tickrate']); + $aPrice = explode(':', $tarif['price']); + $aTICK = explode(':', $tarif['tickrate']); - $sum = $tarif['slots'] ? $aPrice[array_search($server['tickrate'], $aTICK)] : $aPrice[array_search($server['tickrate'], $aTICK)]*$server['slots']; + $sum = $tarif['slots'] ? $aPrice[array_search($server['tickrate'], $aTICK)] : $aPrice[array_search($server['tickrate'], $aTICK)]*$server['slots']; - $html->get('extend_sp', 'sections/servers/games/tarif'); + $html->get('extend_sp', 'sections/servers/games/tarif'); - if(isset($html->arr['extend_address'])) - { - $html->unit('extend_address', 1); - $html->set('extend_address', $html->arr['extend_address']); - }else - $html->unit('extend_address'); + if(isset($html->arr['extend_address'])) + { + $html->unit('extend_address', 1); + $html->set('extend_address', $html->arr['extend_address']); + }else + $html->unit('extend_address'); - $html->set('id', $sid); - $html->set('time', sys::date('min', $server['time'])); - $html->set('date', $server['time'] > $start_point ? 'Сервер продлен до: '.date('d.m.Y', $server['time']) : 'Текущая дата: '.date('d.m.Y', $start_point)); - $html->set('options', ''.$options); - $html->set('slots', $server['slots']); - $html->set('info', $server['tickrate'].' TickRate'); - $html->set('tarif', $tarif['name']); - $html->set('sum', $sum); - $html->set('cur', $cfg['currency']); + $html->set('id', $sid); + $html->set('time', sys::date('min', $server['time'])); + $html->set('date', $server['time'] > $start_point ? 'Сервер продлен до: '.date('d.m.Y', $server['time']) : 'Текущая дата: '.date('d.m.Y', $start_point)); + $html->set('options', ''.$options); + $html->set('slots', $server['slots']); + $html->set('info', $server['tickrate'].' TickRate'); + $html->set('tarif', $tarif['name']); + $html->set('sum', $sum); + $html->set('cur', $cfg['currency']); - $html->pack('main'); + $html->pack('main'); - return NULL; - } + return NULL; + } public static function plan($server, $tarif_name, $sid) { - global $cfg, $sql, $html; + global $cfg, $sql, $html; - $sql->query('SELECT `tickrate`, `price` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); + $sql->query('SELECT `tickrate`, `price` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); - if(!$sql->num()) - return NULL; + if(!$sql->num()) + return NULL; - $tarif = $sql->get(); + $tarif = $sql->get(); - $options = ''; + $options = ''; - $aPrice = explode(':', $tarif['price']); - $aTick = explode(':', $tarif['tickrate']); + $aPrice = explode(':', $tarif['price']); + $aTick = explode(':', $tarif['tickrate']); - // Если есть выбор - if(count($aTick) > 1) - { - // Удалить при наличии tickrate сервера из выбора - if(in_array($server['tickrate'], $aTick)) - unset($aTick[array_search($server['tickrate'], $aTick)]); + // Если есть выбор + if(count($aTick) > 1) + { + // Удалить при наличии tickrate сервера из выбора + if(in_array($server['tickrate'], $aTick)) + unset($aTick[array_search($server['tickrate'], $aTick)]); - foreach($aTick as $index => $tickrate) - $options .= ''; - }else - return NULL; + foreach($aTick as $index => $tickrate) + $options .= ''; + }else + return NULL; - $html->get('plan', 'sections/servers/games/tarif'); + $html->get('plan', 'sections/servers/games/tarif'); - $html->set('id', $sid); - $html->set('options', $options); - $html->set('info', $server['tickrate'].' TickRate'); - $html->set('tarif', $tarif_name); + $html->set('id', $sid); + $html->set('options', $options); + $html->set('info', $server['tickrate'].' TickRate'); + $html->set('tarif', $tarif_name); - $html->pack('main'); + $html->pack('main'); - return NULL; - } + return NULL; + } - public static function unit($server, $unit_name, $tarif_name, $sid) + public static function unit($server, $unit_name, $tarif_name, $sid) { - global $cfg, $sql, $html; + global $cfg, $sql, $html; - if(!$cfg['change_unit'][$server['game']]) - return NULL; + if(!$cfg['change_unit'][$server['game']]) + return NULL; - $tarifs = $sql->query('SELECT `unit`, `tickrate` FROM `tarifs` WHERE `game`="'.$server['game'].'" AND `name`="'.$tarif_name.'" AND `id`!="'.$server['tarif'].'" AND `show`="1" ORDER BY `unit`'); - if(!$sql->num($tarifs)) - return NULL; + $tarifs = $sql->query('SELECT `unit`, `tickrate` FROM `tarifs` WHERE `game`="'.$server['game'].'" AND `name`="'.$tarif_name.'" AND `id`!="'.$server['tarif'].'" AND `show`="1" ORDER BY `unit`'); + if(!$sql->num($tarifs)) + return NULL; - $units = 0; + $units = 0; - $options = ''; + $options = ''; - while($tarif = $sql->get($tarifs)) - { - if(!in_array($server['tickrate'], explode(':', $tarif['tickrate']))) - continue; + while($tarif = $sql->get($tarifs)) + { + if(!in_array($server['tickrate'], explode(':', $tarif['tickrate']))) + continue; - $sql->query('SELECT `id`, `name` FROM `units` WHERE `id`="'.$tarif['unit'].'" AND `show`="1" LIMIT 1'); - if(!$sql->num()) - continue; + $sql->query('SELECT `id`, `name` FROM `units` WHERE `id`="'.$tarif['unit'].'" AND `show`="1" LIMIT 1'); + if(!$sql->num()) + continue; - $unit = $sql->get(); + $unit = $sql->get(); - $options .= ''; + $options .= ''; - $units+=1; - } + $units+=1; + } - if(!$units) - return NULL; + if(!$units) + return NULL; - $html->get('unit', 'sections/servers/games/tarif'); + $html->get('unit', 'sections/servers/games/tarif'); - $html->set('id', $sid); - $html->set('options', $options); - $html->set('slots', $server['slots']); - $html->set('info', $server['tickrate'].' TickRate'); - $html->set('unit', $unit_name); - $html->set('tarif', $tarif_name); + $html->set('id', $sid); + $html->set('options', $options); + $html->set('slots', $server['slots']); + $html->set('info', $server['tickrate'].' TickRate'); + $html->set('unit', $unit_name); + $html->set('tarif', $tarif_name); - $html->pack('main'); + $html->pack('main'); - return NULL; - } + return NULL; + } - public static function unit_new($tarif, $unit, $server, $mcache) - { - global $ssh, $sql, $user, $start_point; + public static function unit_new($tarif, $unit, $server, $mcache) + { + global $ssh, $sql, $user, $start_point; - // Проверка ssh соединения с локацией - if(!$ssh->auth($unit['passwd'], $unit['address'])) - sys::outjs(array('e' => sys::text('error', 'ssh'))); + // Проверка ssh соединения с локацией + if(!$ssh->auth($unit['passwd'], $unit['address'])) + sys::outjs(array('e' => sys::text('error', 'ssh'))); - // Директория сборки - $path = $tarif['path'].$tarif['pack']; + // Директория сборки + $path = $tarif['path'].$tarif['pack']; - // Директория игрового сервера - $install = $tarif['install'].$server['uid']; + // Директория игрового сервера + $install = $tarif['install'].$server['uid']; - // Пользователь сервера - $uS = 'server'.$server['uid']; + // Пользователь сервера + $uS = 'server'.$server['uid']; - $ssh->set('mkdir '.$install.';' // Создание директории - .'useradd -d '.$install.' -g servers -u '.$server['uid'].' '.$uS.';' // Создание пользователя сервера на локации - .'chown '.$uS.':1000 '.$install.';' // Изменение владельца и группы директории - .'cd '.$install.' && sudo -u '.$uS.' screen -dmS i_'.$server['uid'].' cp -r '.$path.'/. .'); // Копирование файлов сборки для сервера + $ssh->set('mkdir '.$install.';' // Создание директории + .'useradd -d '.$install.' -g servers -u '.$server['uid'].' '.$uS.';' // Создание пользователя сервера на локации + .'chown '.$uS.':1000 '.$install.';' // Изменение владельца и группы директории + .'cd '.$install.' && sudo -u '.$uS.' screen -dmS i_'.$server['uid'].' cp -r '.$path.'/. .'); // Копирование файлов сборки для сервера - $address = explode(':', $server['address']); + $address = explode(':', $server['address']); - $fix_one = $tarif['core_fix'] ? 1 : 0; + $fix_one = $tarif['core_fix'] ? 1 : 0; - // Обновление данных нового сервера - $sql->query('UPDATE `servers` set - `unit`="'.$tarif['unit'].'", - `tarif`="'.$tarif['id'].'", - `address`="'.$server['address'].'", - `port`="'.$address[1].'", - `status`="install", - `name`="'.$tarif['hostname'].'", - `pack`="'.$tarif['pack'].'", - `map_start`="'.$tarif['map'].'", - `vac`="1", - `hdd`="'.$tarif['hdd'].'", - `time`="'.$tarif['time'].'", - `autostop`="'.$tarif['autostop'].'", - `core_fix`="'.$tarif['core_fix'].'", - `core_fix_one`="'.$fix_one.'", - `reinstall`="'.$start_point.'" WHERE `id`="'.$server['id'].'" LIMIT 1'); + // Обновление данных нового сервера + $sql->query('UPDATE `servers` set + `unit`="'.$tarif['unit'].'", + `tarif`="'.$tarif['id'].'", + `address`="'.$server['address'].'", + `port`="'.$address[1].'", + `status`="install", + `name`="'.$tarif['hostname'].'", + `pack`="'.$tarif['pack'].'", + `map_start`="'.$tarif['map'].'", + `vac`="1", + `hdd`="'.$tarif['hdd'].'", + `time`="'.$tarif['time'].'", + `autostop`="'.$tarif['autostop'].'", + `core_fix`="'.$tarif['core_fix'].'", + `core_fix_one`="'.$fix_one.'", + `reinstall`="'.$start_point.'" WHERE `id`="'.$server['id'].'" LIMIT 1'); - // Запись установленных плагинов - if($tarif['plugins']) - { - // Массив идентификаторов плагинов - $aPlugins = sys::b64js($tarif['plugins_install']); + // Запись установленных плагинов + if($tarif['plugins']) + { + // Массив идентификаторов плагинов + $aPlugins = sys::b64js($tarif['plugins_install']); - if(isset($aPlugins[$tarif['pack']])) - { - $plugins = explode(',', $aPlugins[$tarif['pack']]); + if(isset($aPlugins[$tarif['pack']])) + { + $plugins = explode(',', $aPlugins[$tarif['pack']]); - foreach($plugins as $plugin) - if($plugin) - $sql->query('INSERT INTO `plugins_install` set `server`="'.$server['id'].'", `plugin`="'.$plugin.'", `time`="'.$start_point.'"'); - } - } + foreach($plugins as $plugin) + if($plugin) + $sql->query('INSERT INTO `plugins_install` set `server`="'.$server['id'].'", `plugin`="'.$plugin.'", `time`="'.$start_point.'"'); + } + } - return NULL; - } + return NULL; + } } ?> \ No newline at end of file diff --git a/system/library/games/cssold/action.php b/system/library/games/cssold/action.php index 3786d72..a3072ff 100644 --- a/system/library/games/cssold/action.php +++ b/system/library/games/cssold/action.php @@ -1,116 +1,116 @@ query('SELECT `uid`, `unit`, `tarif`, `game`, `address`, `slots_start`, `name`, `tickrate`, `fps`, `map_start`, `vac`, `time_start`, `core_fix` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `uid`, `unit`, `tarif`, `game`, `address`, `slots_start`, `name`, `tickrate`, `fps`, `map_start`, `vac`, `time_start`, `core_fix` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - $sql->query('SELECT `install` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); - $tarif = $sql->get(); + $sql->query('SELECT `install` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); + $tarif = $sql->get(); - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); - // Проверка ssh соедниения пу с локацией - if(!$ssh->auth($unit['passwd'], $unit['address'])) - return array('e' => sys::text('error', 'ssh')); + // Проверка ssh соедниения пу с локацией + if(!$ssh->auth($unit['passwd'], $unit['address'])) + return array('e' => sys::text('error', 'ssh')); - list($ip, $port) = explode(':', $server['address']); + list($ip, $port) = explode(':', $server['address']); - // Убить процессы - $ssh->set('kill -9 `ps aux | grep s_'.$server['uid'].' | grep -v grep | awk '."'{print $2}'".' | xargs;' - .'lsof -i@'.$server['address'].' | awk '."'{print $2}'".' | grep -v PID | xargs`; sudo -u server'.$server['uid'].' screen -wipe'); + // Убить процессы + $ssh->set('kill -9 `ps aux | grep s_'.$server['uid'].' | grep -v grep | awk '."'{print $2}'".' | xargs;' + .'lsof -i@'.$server['address'].' | awk '."'{print $2}'".' | grep -v PID | xargs`; sudo -u server'.$server['uid'].' screen -wipe'); - $taskset = ''; + $taskset = ''; - // Если включена система автораспределения и не установлен фиксированный поток - if($cfg['cpu_route'] AND !$server['core_fix']) - { - $proc_stat = array(); + // Если включена система автораспределения и не установлен фиксированный поток + if($cfg['cpu_route'] AND !$server['core_fix']) + { + $proc_stat = array(); - $proc_stat[0] = $ssh->get('cat /proc/stat'); - } + $proc_stat[0] = $ssh->get('cat /proc/stat'); + } - // Проверка наличия стартовой карты - $ssh->set('cd '.$tarif['install'].$server['uid'].'/cstrike/maps/ && ls | grep .bsp | grep -v .bsp.'); + // Проверка наличия стартовой карты + $ssh->set('cd '.$tarif['install'].$server['uid'].'/cstrike/maps/ && ls | grep .bsp | grep -v .bsp.'); - if($server['map_start'] != '' AND !in_array($server['map_start'], str_replace('.bsp', '', explode("\n", $ssh->get())))) - return array('e' => sys::updtext(sys::text('servers', 'nomap'), array('map' => $server['map_start'].'.bsp'))); + if($server['map_start'] != '' AND !in_array($server['map_start'], str_replace('.bsp', '', explode("\n", $ssh->get())))) + return array('e' => sys::updtext(sys::text('servers', 'nomap'), array('map' => $server['map_start'].'.bsp'))); - // Если система автораспределения продолжить парсинг загрузки процессора - if(isset($proc_stat)) - { - $proc_stat[1] = $ssh->get('cat /proc/stat'); + // Если система автораспределения продолжить парсинг загрузки процессора + if(isset($proc_stat)) + { + $proc_stat[1] = $ssh->get('cat /proc/stat'); - // Ядро/поток, на котором будет запущен игровой сервер (поток выбран с рассчетом наименьшей загруженности в момент запуска игрового сервера) - $core = sys::cpu_idle($proc_stat, $server['unit'], false); // число от 1 до n (где n число ядер/потоков в процессоре (без нулевого) + // Ядро/поток, на котором будет запущен игровой сервер (поток выбран с рассчетом наименьшей загруженности в момент запуска игрового сервера) + $core = sys::cpu_idle($proc_stat, $server['unit'], false); // число от 1 до n (где n число ядер/потоков в процессоре (без нулевого) - if(!is_numeric($core)) - return array('e' => sys::text('error', 'cpu')); + if(!is_numeric($core)) + return array('e' => sys::text('error', 'cpu')); - $taskset = 'taskset -c '.$core; - } + $taskset = 'taskset -c '.$core; + } - if($server['core_fix']) - { - $core = $server['core_fix']-1; - $taskset = 'taskset -c '.$core; - } + if($server['core_fix']) + { + $core = $server['core_fix']-1; + $taskset = 'taskset -c '.$core; + } - // Античит VAC - $vac = $server['vac'] == 0 ? '-insecure' : '-secure'; + // Античит VAC + $vac = $server['vac'] == 0 ? '-insecure' : '-secure'; - // Боты - $bots = $cfg['bots'][$server['game']] ? '' : '-nobots'; + // Боты + $bots = $cfg['bots'][$server['game']] ? '' : '-nobots'; - // TV - $tv = $server['tv'] ? '+tv_enable 1 +tv_maxclients 30 +tv_port '.($port+10000) : '-nohltv'; + // TV + $tv = $server['tv'] ? '+tv_enable 1 +tv_maxclients 30 +tv_port '.($port+10000) : '-nohltv'; - // FPS - $fps = $server['fps']+$cfg['fpsplus']; + // FPS + $fps = $server['fps']+$cfg['fpsplus']; - // Параметры запуска - $bash = './srcds_run -debug -game cstrike -norestart -condebug console.log -tickrate '.$server['tickrate'].' +fps_egp '.$fps.' +servercfgfile server.cfg +map \''.$server['map_start'].'\' +maxplayers '.$server['slots_start'].' +ip '.$ip.' +port '.$port.' +sv_lan 0 -nomaster -localcser '.$vac.' '.$bots.' '.$tv; + // Параметры запуска + $bash = './srcds_run -debug -game cstrike -norestart -condebug console.log -tickrate '.$server['tickrate'].' +fps_egp '.$fps.' +servercfgfile server.cfg +map \''.$server['map_start'].'\' +maxplayers '.$server['slots_start'].' +ip '.$ip.' +port '.$port.' +sv_lan 0 -nomaster -localcser '.$vac.' '.$bots.' '.$tv; - // Временный файл - $temp = sys::temp($bash); + // Временный файл + $temp = sys::temp($bash); - // Обновление файла start.sh - $ssh->setfile($temp, $tarif['install'].$server['uid'].'/start.sh', 0500); + // Обновление файла start.sh + $ssh->setfile($temp, $tarif['install'].$server['uid'].'/start.sh', 0500); - // Строка запуска - $ssh->set('cd '.$tarif['install'].$server['uid'].';' // переход в директорию игрового сервера - .'rm *.pid;' // Удаление *.pid файлов - .'mv console.log oldstart.log;' // Перемещение лога предыдущего запуска в файл oldstart.log - .'sudo -u server'.$server['uid'].' mkdir -p cstrike/oldstart;' // Создание папки логов - .'cat cstrike/console.log >> cstrike/oldstart/'.date('d.m.Y_H:i:s', $server['time_start']).'.log; rm cstrike/console.log; rm cstrike/oldstart/01.01.1970_03:00:00.log;' // Перемещение лога предыдущего запуска - .'chown server'.$server['uid'].':1000 start.sh;' // Обновление владельца файла start.sh - .'sudo -u server'.$server['uid'].' screen -dmS s_'.$server['uid'].' '.$taskset.' sh -c "./start.sh"'); // Запуск игровго сервера + // Строка запуска + $ssh->set('cd '.$tarif['install'].$server['uid'].';' // переход в директорию игрового сервера + .'rm *.pid;' // Удаление *.pid файлов + .'mv console.log oldstart.log;' // Перемещение лога предыдущего запуска в файл oldstart.log + .'sudo -u server'.$server['uid'].' mkdir -p cstrike/oldstart;' // Создание папки логов + .'cat cstrike/console.log >> cstrike/oldstart/'.date('d.m.Y_H:i:s', $server['time_start']).'.log; rm cstrike/console.log; rm cstrike/oldstart/01.01.1970_03:00:00.log;' // Перемещение лога предыдущего запуска + .'chown server'.$server['uid'].':1000 start.sh;' // Обновление владельца файла start.sh + .'sudo -u server'.$server['uid'].' screen -dmS s_'.$server['uid'].' '.$taskset.' sh -c "./start.sh"'); // Запуск игровго сервера - $core = !isset($core) ? 0 : $core+1; + $core = !isset($core) ? 0 : $core+1; - // Обновление информации в базе - $sql->query('UPDATE `servers` set `status`="'.$type.'", `online`="0", `players`="", `core_use`="'.$core.'", `time_start`="'.$start_point.'", `stop`="1" WHERE `id`="'.$id.'" LIMIT 1'); + // Обновление информации в базе + $sql->query('UPDATE `servers` set `status`="'.$type.'", `online`="0", `players`="", `core_use`="'.$core.'", `time_start`="'.$start_point.'", `stop`="1" WHERE `id`="'.$id.'" LIMIT 1'); - unlink($temp); + unlink($temp); - // Сброс кеша - actions::clmcache($id); + // Сброс кеша + actions::clmcache($id); - sys::reset_mcache('server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => $type, 'online' => 0, 'players' => '')); - sys::reset_mcache('server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => $type, 'online' => 0)); + sys::reset_mcache('server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => $type, 'online' => 0, 'players' => '')); + sys::reset_mcache('server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => $type, 'online' => 0)); - return array('s' => 'ok'); - } - } + return array('s' => 'ok'); + } + } ?> \ No newline at end of file diff --git a/system/library/games/cssold/rcon.php b/system/library/games/cssold/rcon.php index 40627de..8d9d451 100644 --- a/system/library/games/cssold/rcon.php +++ b/system/library/games/cssold/rcon.php @@ -1,112 +1,112 @@ Connect($ip, $port, 3, SourceQuery::SOURCE); + $sq->Connect($ip, $port, 3, SourceQuery::SOURCE); - $sq->SetRconPassword(rcon::rcon_passwd($server)); + $sq->SetRconPassword(rcon::rcon_passwd($server)); - $out = $sq->Rcon($cmd); + $out = $sq->Rcon($cmd); - $sq->Disconnect(); + $sq->Disconnect(); - return $out; - } + return $out; + } - public static function players($data) - { - $aPlayers = array(); - $n = 1; + public static function players($data) + { + $aPlayers = array(); + $n = 1; - $lines = explode("\n", $data); + $lines = explode("\n", $data); - foreach($lines as $line) - { - if(strpos($line, '#') === FALSE) - continue; + foreach($lines as $line) + { + if(strpos($line, '#') === FALSE) + continue; - $start = strpos($line, '"')+1; - $end = strrpos($line, '"'); + $start = strpos($line, '"')+1; + $end = strrpos($line, '"'); - $userid = sys::int(substr($line, 0, $start)); + $userid = sys::int(substr($line, 0, $start)); - $name = htmlspecialchars(substr($line, $start, $end-$start)); + $name = htmlspecialchars(substr($line, $start, $end-$start)); - $line = trim(substr($line, $end + 1)); + $line = trim(substr($line, $end + 1)); - $aData = array_values(array_diff(explode(' ', $line), array('', ' '))); + $aData = array_values(array_diff(explode(' ', $line), array('', ' '))); - $steamid = trim($aData[0]); - $ip = trim(sys::first(explode(':', $aData[5]))); + $steamid = trim($aData[0]); + $ip = trim(sys::first(explode(':', $aData[5]))); - if(sys::valid($steamid, 'steamid') || sys::valid($ip, 'ip')) - continue; + if(sys::valid($steamid, 'steamid') || sys::valid($ip, 'ip')) + continue; - $aPlayers[$n]['userid'] = $userid; - $aPlayers[$n]['name'] = $name; - $aPlayers[$n]['steamid'] = $steamid; - $aPlayers[$n]['time'] = trim($aData[1]); - $aPlayers[$n]['ping'] = trim($aData[2]); - $aPlayers[$n]['ip'] = $ip; + $aPlayers[$n]['userid'] = $userid; + $aPlayers[$n]['name'] = $name; + $aPlayers[$n]['steamid'] = $steamid; + $aPlayers[$n]['time'] = trim($aData[1]); + $aPlayers[$n]['ping'] = trim($aData[2]); + $aPlayers[$n]['ip'] = $ip; - $whois = rcon::country($ip); + $whois = rcon::country($ip); - $aPlayers[$n]['ico'] = $whois['ico']; - $aPlayers[$n]['country'] = $whois['name']; + $aPlayers[$n]['ico'] = $whois['ico']; + $aPlayers[$n]['country'] = $whois['name']; - $n+=1; - } + $n+=1; + } - return $aPlayers; - } + return $aPlayers; + } - public static function rcon_passwd($server) - { - global $cfg, $sql, $user; + public static function rcon_passwd($server) + { + global $cfg, $sql, $user; - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); $unit = $sql->get(); - if(!$ssh->auth($unit['passwd'], $unit['address'])) + if(!$ssh->auth($unit['passwd'], $unit['address'])) sys::outjs(array('e' => sys::text('error', 'ssh'))); - $sql->query('SELECT `install` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); - $tarif = $sql->get(); + $sql->query('SELECT `install` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); + $tarif = $sql->get(); - $ssh->set('cat '.$tarif['install'].'/'.$server['uid'].'/cstrike/cfg/server.cfg | grep rcon_password'); - $get = explode(' ', str_replace('"', '', trim($ssh->get()))); - $rcon = trim(end($get)); + $ssh->set('cat '.$tarif['install'].'/'.$server['uid'].'/cstrike/cfg/server.cfg | grep rcon_password'); + $get = explode(' ', str_replace('"', '', trim($ssh->get()))); + $rcon = trim(end($get)); - if(!isset($rcon{0})) - sys::outjs(array('r' => 'Необходимо установить rcon пароль (rcon_password).', 'url' => $cfg['http'].'servers/id/'.$server['id'].'/section/settings/subsection/server'), $nmch); + if(!isset($rcon{0})) + sys::outjs(array('r' => 'Необходимо установить rcon пароль (rcon_password).', 'url' => $cfg['http'].'servers/id/'.$server['id'].'/section/settings/subsection/server'), $nmch); - return $rcon; - } + return $rcon; + } - public static function country($ip) - { - global $SxGeo; + public static function country($ip) + { + global $SxGeo; - $cData = $SxGeo->getCityFull($ip); - $ico = sys::country($cData['country']['iso']); + $cData = $SxGeo->getCityFull($ip); + $ico = sys::country($cData['country']['iso']); - return array('ico' => $ico, 'name' => empty($cData['country']['name_ru']) ? 'Не определена' : $cData['country']['name_ru']); - } - } + return array('ico' => $ico, 'name' => empty($cData['country']['name_ru']) ? 'Не определена' : $cData['country']['name_ru']); + } + } ?> \ No newline at end of file diff --git a/system/library/games/cssold/scan.php b/system/library/games/cssold/scan.php index ca76ba3..aeb3bdd 100644 --- a/system/library/games/cssold/scan.php +++ b/system/library/games/cssold/scan.php @@ -1,140 +1,140 @@ get($nmch))) - return $mcache->get($nmch); + if(is_array($mcache->get($nmch))) + return $mcache->get($nmch); - $out = array(); + $out = array(); - $info = scan::info($sq, $id); + $info = scan::info($sq, $id); - $sql->query('SELECT `game`, `name`, `map`, `online`, `players`, `status`, `time`, `overdue` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `game`, `name`, `map`, `online`, `players`, `status`, `time`, `overdue` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - $out['time'] = 'Арендован до: '.date('d.m.Y - H:i', $server['time']); + $out['time'] = 'Арендован до: '.date('d.m.Y - H:i', $server['time']); - if($server['status'] == 'overdue') - $out['time_end'] = 'Удаление через: '.sys::date('min', $server['overdue']+$cfg['server_delete']*86400); - else - $out['time_end'] = 'Осталось: '.sys::date('min', $server['time']); + if($server['status'] == 'overdue') + $out['time_end'] = 'Удаление через: '.sys::date('min', $server['overdue']+$cfg['server_delete']*86400); + else + $out['time_end'] = 'Осталось: '.sys::date('min', $server['time']); - if(!$info['status']) - { - $out['name'] = $server['name']; - $out['status'] = sys::status($server['status'], $server['game'], $server['map']); - $out['online'] = $server['online']; - $out['image'] = ''; - $out['buttons'] = sys::buttons($id, $server['status']); + if(!$info['status']) + { + $out['name'] = $server['name']; + $out['status'] = sys::status($server['status'], $server['game'], $server['map']); + $out['online'] = $server['online']; + $out['image'] = ''; + $out['buttons'] = sys::buttons($id, $server['status']); - if($players_get) - $out['players'] = base64_decode($server['players']); + if($players_get) + $out['players'] = base64_decode($server['players']); - $mcache->set($nmch, $out, false, $cfg['mcache_server_mon']); + $mcache->set($nmch, $out, false, $cfg['mcache_server_mon']); - return $out; - } + return $out; + } - if($players_get) - $players = scan::info($sq, $id, true); + if($players_get) + $players = scan::info($sq, $id, true); - $out['name'] = htmlspecialchars($info['name']); - $out['status'] = sys::status('working', $server['game'], $info['map']); - $out['online'] = $info['online']; - $out['image'] = ''; - $out['buttons'] = sys::buttons($id, 'working'); - $out['players'] = ''; + $out['name'] = htmlspecialchars($info['name']); + $out['status'] = sys::status('working', $server['game'], $info['map']); + $out['online'] = $info['online']; + $out['image'] = ''; + $out['buttons'] = sys::buttons($id, 'working'); + $out['players'] = ''; - if($players_get) - { - foreach($players as $index => $player) - { - $html->get($server['game'], 'sections/servers/players'); + if($players_get) + { + foreach($players as $index => $player) + { + $html->get($server['game'], 'sections/servers/players'); - $html->set('i', $player['i']); - $html->set('name', $player['name']); - $html->set('score', $player['score']); - $html->set('time', $player['time']); + $html->set('i', $player['i']); + $html->set('name', $player['name']); + $html->set('score', $player['score']); + $html->set('time', $player['time']); - $html->pack('list'); - } + $html->pack('list'); + } - $out['players'] = isset($html->arr['list']) ? $html->arr['list'] : ''; - } + $out['players'] = isset($html->arr['list']) ? $html->arr['list'] : ''; + } - $sql->query('UPDATE `servers` set ' - .'`name`="'.$out['name'].'", ' - .'`online`="'.$out['online'].'", ' - .'`map`="'.$info['map'].'", ' - .'`status`="working" WHERE `id`="'.$id.'" LIMIT 1'); + $sql->query('UPDATE `servers` set ' + .'`name`="'.$out['name'].'", ' + .'`online`="'.$out['online'].'", ' + .'`map`="'.$info['map'].'", ' + .'`status`="working" WHERE `id`="'.$id.'" LIMIT 1'); - if($players_get) - $sql->query('UPDATE `servers` set `players`="'.base64_encode($out['players']).'" WHERE `id`="'.$id.'" LIMIT 1'); + if($players_get) + $sql->query('UPDATE `servers` set `players`="'.base64_encode($out['players']).'" WHERE `id`="'.$id.'" LIMIT 1'); - $mcache->set($nmch, $out, false, $cfg['mcache_server_mon']); + $mcache->set($nmch, $out, false, $cfg['mcache_server_mon']); - return $out; - } + return $out; + } - public static function info($sq, $id, $pl = false) - { - global $sql; + public static function info($sq, $id, $pl = false) + { + global $sql; - $sql->query('SELECT `address` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `address` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - list($ip, $port) = explode(':', $server['address']); + list($ip, $port) = explode(':', $server['address']); - $sq->Connect($ip, $port, 1, SourceQuery::SOURCE); + $sq->Connect($ip, $port, 1, SourceQuery::SOURCE); - if($pl) - { - $players = $sq->GetPlayers(); + if($pl) + { + $players = $sq->GetPlayers(); - $i = 1; - $data = array(); + $i = 1; + $data = array(); - foreach($players as $n => $player) - { - $data[$i]['i'] = $i; - $data[$i]['name'] = $player['Name'] == '' ? 'Подключается' : $player['Name']; - $data[$i]['score'] = $player['Frags']; - $data[$i]['time'] = $player['TimeF']; + foreach($players as $n => $player) + { + $data[$i]['i'] = $i; + $data[$i]['name'] = $player['Name'] == '' ? 'Подключается' : $player['Name']; + $data[$i]['score'] = $player['Frags']; + $data[$i]['time'] = $player['TimeF']; - $i+=1; - } + $i+=1; + } - return $data; - } + return $data; + } - $data = $sq->GetInfo(); + $data = $sq->GetInfo(); - $server['name'] = $data['HostName']; - $server['map'] = $data['Map']; - $server['online'] = $data['Players']; - $server['status'] = strlen($server['map']) > 3 ? true : false; + $server['name'] = $data['HostName']; + $server['map'] = $data['Map']; + $server['online'] = $data['Players']; + $server['status'] = strlen($server['map']) > 3 ? true : false; - return $server; - } - } + return $server; + } + } ?> \ No newline at end of file diff --git a/system/library/games/cssold/service.php b/system/library/games/cssold/service.php index 80cab04..1afeb43 100644 --- a/system/library/games/cssold/service.php +++ b/system/library/games/cssold/service.php @@ -1,378 +1,378 @@ query('SELECT `address`, `test` FROM `units` WHERE `id`="'.$aData['unit'].'" AND `cssold`="1" AND `show`="1" LIMIT 1'); - if(!$sql->num()) - sys::outjs(array('e' => 'Локация не найдена.')); + // Проверка локации + $sql->query('SELECT `address`, `test` FROM `units` WHERE `id`="'.$aData['unit'].'" AND `cssold`="1" AND `show`="1" LIMIT 1'); + if(!$sql->num()) + sys::outjs(array('e' => 'Локация не найдена.')); - $unit = $sql->get(); + $unit = $sql->get(); - // Проверка тарифа - $sql->query('SELECT `id` FROM `tarifs` WHERE `id`="'.$aData['tarif'].'" AND `unit`="'.$aData['unit'].'" AND `show`="1" LIMIT 1'); - if(!$sql->num()) - sys::outjs(array('e' => 'Тариф не найден.')); + // Проверка тарифа + $sql->query('SELECT `id` FROM `tarifs` WHERE `id`="'.$aData['tarif'].'" AND `unit`="'.$aData['unit'].'" AND `show`="1" LIMIT 1'); + if(!$sql->num()) + sys::outjs(array('e' => 'Тариф не найден.')); - $sql->query('SELECT ' - .'`slots_min`,' - .'`slots_max`,' - .'`port_min`,' - .'`port_max`,' - .'`hostname`,' - .'`packs`,' - .'`fps`,' - .'`tickrate`,' - .'`time`,' - .'`test`,' - .'`tests`,' - .'`discount`,' - .'`map`,' - .'`ftp`,' - .'`plugins`,' - .'`console`,' - .'`stats`,' - .'`copy`,' - .'`web`,' - .'`plugins_install`,' - .'`hdd`,' - .'`autostop`,' - .'`core_fix`,' - .'`ip`,' - .'`price`' - .' FROM `tarifs` WHERE `id`="'.$aData['tarif'].'" LIMIT 1'); + $sql->query('SELECT ' + .'`slots_min`,' + .'`slots_max`,' + .'`port_min`,' + .'`port_max`,' + .'`hostname`,' + .'`packs`,' + .'`fps`,' + .'`tickrate`,' + .'`time`,' + .'`test`,' + .'`tests`,' + .'`discount`,' + .'`map`,' + .'`ftp`,' + .'`plugins`,' + .'`console`,' + .'`stats`,' + .'`copy`,' + .'`web`,' + .'`plugins_install`,' + .'`hdd`,' + .'`autostop`,' + .'`core_fix`,' + .'`ip`,' + .'`price`' + .' FROM `tarifs` WHERE `id`="'.$aData['tarif'].'" LIMIT 1'); - $tarif = $sql->get(); + $tarif = $sql->get(); - // Проверка сборки - if(!array_key_exists($aData['pack'], sys::b64djs($tarif['packs'], true))) - sys::outjs(array('e' => 'Сборка не найдена.')); + // Проверка сборки + if(!array_key_exists($aData['pack'], sys::b64djs($tarif['packs'], true))) + sys::outjs(array('e' => 'Сборка не найдена.')); - // Проверка FPS - if(!in_array($aData['fps'], explode(':', $tarif['fps']))) - sys::outjs(array('e' => 'Переданные данные fps неверны.')); + // Проверка FPS + if(!in_array($aData['fps'], explode(':', $tarif['fps']))) + sys::outjs(array('e' => 'Переданные данные fps неверны.')); - // Проверка TickRate - if(!in_array($aData['tickrate'], explode(':', $tarif['tickrate']))) - sys::outjs(array('e' => 'Переданные данные tickrate неверны.')); + // Проверка TickRate + if(!in_array($aData['tickrate'], explode(':', $tarif['tickrate']))) + sys::outjs(array('e' => 'Переданные данные tickrate неверны.')); - $test = 0; + $test = 0; - // Проверка периода на тест - if($aData['test']) - { - if(!$tarif['test'] || !$unit['test']) - sys::outjs(array('e' => 'Тестовый период недоступен.')); + // Проверка периода на тест + if($aData['test']) + { + if(!$tarif['test'] || !$unit['test']) + sys::outjs(array('e' => 'Тестовый период недоступен.')); - // Проверка на повторный запрос - $sql->query('SELECT `id`, `game` FROM `tests` WHERE `user`="'.$user['id'].'" LIMIT 1'); - if($sql->num()) - { - $test_info = $sql->get(); + // Проверка на повторный запрос + $sql->query('SELECT `id`, `game` FROM `tests` WHERE `user`="'.$user['id'].'" LIMIT 1'); + if($sql->num()) + { + $test_info = $sql->get(); - if(!$cfg['tests']['game'] || $test_info['game'] == 'cssold') - sys::outjs(array('e' => 'Тестовый период предоставляется один раз.')); + if(!$cfg['tests']['game'] || $test_info['game'] == 'cssold') + sys::outjs(array('e' => 'Тестовый период предоставляется один раз.')); - $sql->query('SELECT `id` FROM `servers` WHERE `user`="'.$user['id'].'" AND `test`="1" LIMIT 1'); - if($sql->num() AND !$cfg['tests']['sametime']) - sys::outjs(array('e' => 'Чтобы получить тестовый период другой игры, дождитесь окончания текущего.')); - } + $sql->query('SELECT `id` FROM `servers` WHERE `user`="'.$user['id'].'" AND `test`="1" LIMIT 1'); + if($sql->num() AND !$cfg['tests']['sametime']) + sys::outjs(array('e' => 'Чтобы получить тестовый период другой игры, дождитесь окончания текущего.')); + } - // Проверка наличия мест на локации - $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND `test`="1" AND `time`>"'.$start_point.'" LIMIT '.$unit['test']); - if($sql->num() == $unit['test']) - sys::outjs(array('e' => 'Свободного места для тестового периода нет.')); + // Проверка наличия мест на локации + $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND `test`="1" AND `time`>"'.$start_point.'" LIMIT '.$unit['test']); + if($sql->num() == $unit['test']) + sys::outjs(array('e' => 'Свободного места для тестового периода нет.')); - // Проверка наличия мест для выбранного тарифа - $sql->query('SELECT `id` FROM `servers` WHERE `tarif`="'.$aData['tarif'].'" AND `test`="1" AND `time`>"'.$start_point.'" LIMIT '.$tarif['tests']); - if($sql->num() == $tarif['tests']) - sys::outjs(array('e' => 'Свободного места для тестового периода выбранного тарифа нет.')); + // Проверка наличия мест для выбранного тарифа + $sql->query('SELECT `id` FROM `servers` WHERE `tarif`="'.$aData['tarif'].'" AND `test`="1" AND `time`>"'.$start_point.'" LIMIT '.$tarif['tests']); + if($sql->num() == $tarif['tests']) + sys::outjs(array('e' => 'Свободного места для тестового периода выбранного тарифа нет.')); - $test = 1; - }else - // Проверка периода - if(!$cfg['settlement_period'] AND !in_array($aData['time'], explode(':', $tarif['time']))) - sys::outjs(array('e' => 'Переданные данные периода неверны.')); + $test = 1; + }else + // Проверка периода + if(!$cfg['settlement_period'] AND !in_array($aData['time'], explode(':', $tarif['time']))) + sys::outjs(array('e' => 'Переданные данные периода неверны.')); - // Проверка слот - if($aData['slots'] < $tarif['slots_min'] || $aData['slots'] > $tarif['slots_max']) - sys::outjs(array('e' => 'Переданные данные слот неверны.')); + // Проверка слот + if($aData['slots'] < $tarif['slots_min'] || $aData['slots'] > $tarif['slots_max']) + sys::outjs(array('e' => 'Переданные данные слот неверны.')); - $aPrice = sys::b64djs($tarif['price'], true); + $aPrice = sys::b64djs($tarif['price'], true); - // Определение цены - $price = $aPrice[$aData['tickrate'].'_'.$aData['fps']]; + // Определение цены + $price = $aPrice[$aData['tickrate'].'_'.$aData['fps']]; - // Определение суммы - if($cfg['settlement_period']) - { - // Цена аренды за расчетный период - $sum = games::define_sum($tarif['discount'], $price, $aData['slots'], $start_point); + // Определение суммы + if($cfg['settlement_period']) + { + // Цена аренды за расчетный период + $sum = games::define_sum($tarif['discount'], $price, $aData['slots'], $start_point); - $aData['time'] = games::define_period('buy', params::$aDayMonth); - }else - $sum = games::define_sum($tarif['discount'], $price, $aData['slots'], $aData['time']); + $aData['time'] = games::define_period('buy', params::$aDayMonth); + }else + $sum = games::define_sum($tarif['discount'], $price, $aData['slots'], $aData['time']); - // Проверка промо-кода - $promo = games::define_promo( - $aData['promo'], - array( - 'tarif' => $aData['tarif'], - 'tickrate' => $aData['tickrate'], - 'fps' => $aData['fps'], - 'slots' => $aData['slots'], - 'time' => $aData['time'], - 'user' => $user['id'] - ), - $tarif['discount'], - $sum - ); + // Проверка промо-кода + $promo = games::define_promo( + $aData['promo'], + array( + 'tarif' => $aData['tarif'], + 'tickrate' => $aData['tickrate'], + 'fps' => $aData['fps'], + 'slots' => $aData['slots'], + 'time' => $aData['time'], + 'user' => $user['id'] + ), + $tarif['discount'], + $sum + ); - $days = $aData['time']; // Кол-во дней аренды + $days = $aData['time']; // Кол-во дней аренды - // Использование промо-кода - if(is_array($promo)) - { - if(array_key_exists('sum', $promo)) - $sum = $promo['sum']; - else - $days += $promo['days']; // Кол-во дней аренды с учетом подарочных (промо-код) - } + // Использование промо-кода + if(is_array($promo)) + { + if(array_key_exists('sum', $promo)) + $sum = $promo['sum']; + else + $days += $promo['days']; // Кол-во дней аренды с учетом подарочных (промо-код) + } - // Проверка баланса - if($user['balance'] < $sum) - sys::outjs(array('e' => 'У вас не хватает '.(round($sum-$user['balance'], 2)).' '.$cfg['currency'])); + // Проверка баланса + if($user['balance'] < $sum) + sys::outjs(array('e' => 'У вас не хватает '.(round($sum-$user['balance'], 2)).' '.$cfg['currency'])); - // Выделенный адрес игрового сервера - if(!empty($tarif['ip'])) - { - $aIp = explode(':', $tarif['ip']); + // Выделенный адрес игрового сервера + if(!empty($tarif['ip'])) + { + $aIp = explode(':', $tarif['ip']); - $ip = false; - $port = params::$aDefPort['cssold']; + $ip = false; + $port = params::$aDefPort['cssold']; - // Проверка наличия свободного адреса - foreach($aIp as $adr) - { - $adr = trim($adr); + // Проверка наличия свободного адреса + foreach($aIp as $adr) + { + $adr = trim($adr); - $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND `address` LIKE "'.$adr.':%" LIMIT 1'); - if(!$sql->num()) - { - $ip = $adr; + $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND `address` LIKE "'.$adr.':%" LIMIT 1'); + if(!$sql->num()) + { + $ip = $adr; - break; - } - } - }else{ - $ip = sys::first(explode(':', $unit['address'])); - $port = false; + break; + } + } + }else{ + $ip = sys::first(explode(':', $unit['address'])); + $port = false; - // Проверка наличия свободного порта - for($tarif['port_min']; $tarif['port_min'] <= $tarif['port_max']; $tarif['port_min']+=1) - { - $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND (`address`="'.$ip.':'.$tarif['port_min'].'" OR `port`="'.$tarif['port_min'].'") LIMIT 1'); - if(!$sql->num()) - { - $port = $tarif['port_min']; + // Проверка наличия свободного порта + for($tarif['port_min']; $tarif['port_min'] <= $tarif['port_max']; $tarif['port_min']+=1) + { + $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND (`address`="'.$ip.':'.$tarif['port_min'].'" OR `port`="'.$tarif['port_min'].'") LIMIT 1'); + if(!$sql->num()) + { + $port = $tarif['port_min']; - break; - } - } - } + break; + } + } + } - if(!$ip || !$port) - { - $sql->query('UPDATE `tarifs` set `show`="0" WHERE `id`="'.$aData['tarif'].'" LIMIT 1'); + if(!$ip || !$port) + { + $sql->query('UPDATE `tarifs` set `show`="0" WHERE `id`="'.$aData['tarif'].'" LIMIT 1'); - sys::outjs(array('e' => 'К сожалению нет доступных мест, обратитесь в тех.поддержку.')); - } + sys::outjs(array('e' => 'К сожалению нет доступных мест, обратитесь в тех.поддержку.')); + } - if($test) - $aData['time'] = games::time($start_point, $tarif['test']); - else - $aData['time'] = games::time($start_point, $days); + if($test) + $aData['time'] = games::time($start_point, $tarif['test']); + else + $aData['time'] = games::time($start_point, $days); - $fix_one = 0; - $core = 0; + $fix_one = 0; + $core = 0; - if($tarif['core_fix'] != '') - { - $aCore = explode(',', $tarif['core_fix']); + if($tarif['core_fix'] != '') + { + $aCore = explode(',', $tarif['core_fix']); - foreach($aCore as $cpu) - { - $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND `tarif`="'.$aData['tarif'].'" AND `core_fix`="'.$cpu.'" AND `core_fix_one`="1" LIMIT 1'); + foreach($aCore as $cpu) + { + $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND `tarif`="'.$aData['tarif'].'" AND `core_fix`="'.$cpu.'" AND `core_fix_one`="1" LIMIT 1'); - if($sql->num()) - continue; + if($sql->num()) + continue; - $fix_one = 1; - $core = $cpu; + $fix_one = 1; + $core = $cpu; - break; - } + break; + } - if(!$core) - { - $sql->query('UPDATE `tarifs` set `show`="0" WHERE `id`="'.$aData['tarif'].'" LIMIT 1'); + if(!$core) + { + $sql->query('UPDATE `tarifs` set `show`="0" WHERE `id`="'.$aData['tarif'].'" LIMIT 1'); - sys::outjs(array('e' => 'К сожалению нет доступных мест, обратитесь в тех.поддержку.')); - } - } + sys::outjs(array('e' => 'К сожалению нет доступных мест, обратитесь в тех.поддержку.')); + } + } - $ram = $tarif['param_fix'] ? $aData['ram'] : $cfg['ram']['cssold']*$aSDATA['slots']; + $ram = $tarif['param_fix'] ? $aData['ram'] : $cfg['ram']['cssold']*$aSDATA['slots']; - // Массив данных - $aSDATA = array( - 'unit' => $aData['unit'], // идентификатор локации - 'tarif' => $aData['tarif'], // идентификатор тарифа - 'ram' => $ram, // значение ram - 'param_fix' => $tarif['param_fix'], // фиксированные параметры - 'tickrate' => $aData['tickrate'], // значение tickrate - 'fps' => $aData['fps'], // значение fps - 'pack' => $aData['pack'], // Выбранная сборка для установки - 'time' => $aData['time'], // Время аренды - 'days' => $days, // Число дней - 'sum' => $sum, // Сумма списания - 'test' => $test, // тестовый период - 'address' => $ip.':'.$port, // адрес игрового сервера - 'port' => $port, // порт игрового сервера - 'slots' => $aData['slots'], // Кол-во слот - 'map' => $tarif['map'], // Фиксированное значение слот - 'autostop' => $tarif['autostop'], // Выключение при 0 онлайне - 'ftp' => $tarif['ftp'], // Использование ftp - 'plugins' => $tarif['plugins'], // Использование плагинов - 'console' => $tarif['console'], // Использование консоли - 'stats' => $tarif['stats'], // Использование графиков (ведение статистики) - 'copy' => $tarif['copy'], // Использование резервных копий - 'web' => $tarif['web'], // Использование доп услуг - 'plugins_install' => $tarif['plugins_install'], // Список установленных плагинов - 'hdd' => $tarif['hdd'], // Дисковое пространство - 'core_fix' => $core, // Выделенный поток - 'core_fix_one' => $fix_one, // Выделенный поток - 'promo' => $promo // Использование промо-кода - ); + // Массив данных + $aSDATA = array( + 'unit' => $aData['unit'], // идентификатор локации + 'tarif' => $aData['tarif'], // идентификатор тарифа + 'ram' => $ram, // значение ram + 'param_fix' => $tarif['param_fix'], // фиксированные параметры + 'tickrate' => $aData['tickrate'], // значение tickrate + 'fps' => $aData['fps'], // значение fps + 'pack' => $aData['pack'], // Выбранная сборка для установки + 'time' => $aData['time'], // Время аренды + 'days' => $days, // Число дней + 'sum' => $sum, // Сумма списания + 'test' => $test, // тестовый период + 'address' => $ip.':'.$port, // адрес игрового сервера + 'port' => $port, // порт игрового сервера + 'slots' => $aData['slots'], // Кол-во слот + 'map' => $tarif['map'], // Фиксированное значение слот + 'autostop' => $tarif['autostop'], // Выключение при 0 онлайне + 'ftp' => $tarif['ftp'], // Использование ftp + 'plugins' => $tarif['plugins'], // Использование плагинов + 'console' => $tarif['console'], // Использование консоли + 'stats' => $tarif['stats'], // Использование графиков (ведение статистики) + 'copy' => $tarif['copy'], // Использование резервных копий + 'web' => $tarif['web'], // Использование доп услуг + 'plugins_install' => $tarif['plugins_install'], // Список установленных плагинов + 'hdd' => $tarif['hdd'], // Дисковое пространство + 'core_fix' => $core, // Выделенный поток + 'core_fix_one' => $fix_one, // Выделенный поток + 'promo' => $promo // Использование промо-кода + ); - return $aSDATA; - } + return $aSDATA; + } - public static function install($aSDATA = array()) - { - global $cfg, $sql, $user, $start_point; + public static function install($aSDATA = array()) + { + global $cfg, $sql, $user, $start_point; - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - // Массив данных локации (адрес,пароль) - $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$aSDATA['unit'].'" LIMIT 1'); - $unit = $sql->get(); + // Массив данных локации (адрес,пароль) + $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$aSDATA['unit'].'" LIMIT 1'); + $unit = $sql->get(); - // Проверка ssh соединения с локацией - if(!$ssh->auth($unit['passwd'], $unit['address'])) - sys::outjs(array('e' => sys::text('error', 'ssh'))); + // Проверка ssh соединения с локацией + if(!$ssh->auth($unit['passwd'], $unit['address'])) + sys::outjs(array('e' => sys::text('error', 'ssh'))); - // Массив данных тарифа (путь сборки,путь установки) - $sql->query('SELECT `path`, `install`, `hostname` FROM `tarifs` WHERE `id`="'.$aSDATA['tarif'].'" LIMIT 1'); - $tarif = $sql->get(); + // Массив данных тарифа (путь сборки,путь установки) + $sql->query('SELECT `path`, `install`, `hostname` FROM `tarifs` WHERE `id`="'.$aSDATA['tarif'].'" LIMIT 1'); + $tarif = $sql->get(); - // Получение идентификаторов игрового сервера - $sql->query('INSERT INTO `servers` set uid="1"'); - $id = $sql->id(); - $uid = $id+1000; + // Получение идентификаторов игрового сервера + $sql->query('INSERT INTO `servers` set uid="1"'); + $id = $sql->id(); + $uid = $id+1000; - // Директория сборки - $path = $tarif['path'].$aSDATA['pack']; + // Директория сборки + $path = $tarif['path'].$aSDATA['pack']; - // Директория игрового сервера - $install = $tarif['install'].$uid; + // Директория игрового сервера + $install = $tarif['install'].$uid; - $ssh->set('mkdir '.$install.';' // Создание директории - .'useradd -s /bin/false -d '.$install.' -g servers -u '.$uid.' server'.$uid.';' // Создание пользователя сервера на локации - .'chown server'.$uid.':1000 '.$install.';' // Изменение владельца и группы директории - .'cd '.$install.' && sudo -u server'.$uid.' screen -dmS i_'.$uid.' sh -c "cp -r '.$path.'/. .;' // Копирование файлов сборки для сервера - .'find . -type d -exec chmod 700 {} \;;' - .'find . -type f -exec chmod 600 {} \;;' - .'chmod 500 '.params::$aFileGame['cssold'].'"'); + $ssh->set('mkdir '.$install.';' // Создание директории + .'useradd -s /bin/false -d '.$install.' -g servers -u '.$uid.' server'.$uid.';' // Создание пользователя сервера на локации + .'chown server'.$uid.':1000 '.$install.';' // Изменение владельца и группы директории + .'cd '.$install.' && sudo -u server'.$uid.' screen -dmS i_'.$uid.' sh -c "cp -r '.$path.'/. .;' // Копирование файлов сборки для сервера + .'find . -type d -exec chmod 700 {} \;;' + .'find . -type f -exec chmod 600 {} \;;' + .'chmod 500 '.params::$aFileGame['cssold'].'"'); - // Запись данных нового сервера - $sql->query('UPDATE `servers` set - `uid`="'.$uid.'", - `unit`="'.$aSDATA['unit'].'", - `tarif`="'.$aSDATA['tarif'].'", - `user`="'.$user['id'].'", - `address`="'.$aSDATA['address'].'", - `port`="'.$aSDATA['port'].'", - `game`="cssold", - `slots`="'.$aSDATA['slots'].'", - `slots_start`="'.$aSDATA['slots'].'", - `status`="install", - `name`="'.$tarif['hostname'].'", - `pack`="'.$aSDATA['pack'].'", - `plugins_use`="'.$aSDATA['plugins'].'", - `ftp_use`="'.$aSDATA['ftp'].'", - `console_use`="'.$aSDATA['console'].'", - `stats_use`="'.$aSDATA['stats'].'", - `copy_use`="'.$aSDATA['copy'].'", - `web_use`="'.$aSDATA['web'].'", - `tickrate`="'.$aSDATA['tickrate'].'", - `fps`="'.$aSDATA['fps'].'", - `map_start`="'.$aSDATA['map'].'", - `vac`="1", - `hdd`="'.$aSDATA['hdd'].'", - `time`="'.$aSDATA['time'].'", - `date`="'.$start_point.'", - `test`="'.$aSDATA['test'].'", - `ram`="'.$aSDATA['ram'].'", - `core_fix`="'.$aSDATA['core_fix'].'", - `core_fix_one`="'.$aSDATA['core_fix_one'].'", - `autostop`="'.$aSDATA['autostop'].'" WHERE `id`="'.$id.'" LIMIT 1'); + // Запись данных нового сервера + $sql->query('UPDATE `servers` set + `uid`="'.$uid.'", + `unit`="'.$aSDATA['unit'].'", + `tarif`="'.$aSDATA['tarif'].'", + `user`="'.$user['id'].'", + `address`="'.$aSDATA['address'].'", + `port`="'.$aSDATA['port'].'", + `game`="cssold", + `slots`="'.$aSDATA['slots'].'", + `slots_start`="'.$aSDATA['slots'].'", + `status`="install", + `name`="'.$tarif['hostname'].'", + `pack`="'.$aSDATA['pack'].'", + `plugins_use`="'.$aSDATA['plugins'].'", + `ftp_use`="'.$aSDATA['ftp'].'", + `console_use`="'.$aSDATA['console'].'", + `stats_use`="'.$aSDATA['stats'].'", + `copy_use`="'.$aSDATA['copy'].'", + `web_use`="'.$aSDATA['web'].'", + `tickrate`="'.$aSDATA['tickrate'].'", + `fps`="'.$aSDATA['fps'].'", + `map_start`="'.$aSDATA['map'].'", + `vac`="1", + `hdd`="'.$aSDATA['hdd'].'", + `time`="'.$aSDATA['time'].'", + `date`="'.$start_point.'", + `test`="'.$aSDATA['test'].'", + `ram`="'.$aSDATA['ram'].'", + `core_fix`="'.$aSDATA['core_fix'].'", + `core_fix_one`="'.$aSDATA['core_fix_one'].'", + `autostop`="'.$aSDATA['autostop'].'" WHERE `id`="'.$id.'" LIMIT 1'); - // Запись установленных плагинов - if($aSDATA['plugins']) - { - // Массив идентификаторов плагинов - $aPlugins = sys::b64djs($aSDATA['plugins_install']); + // Запись установленных плагинов + if($aSDATA['plugins']) + { + // Массив идентификаторов плагинов + $aPlugins = sys::b64djs($aSDATA['plugins_install']); - if(isset($aPlugins[$aSDATA['pack']])) - { - $plugins = explode(',', $aPlugins[$aSDATA['pack']]); + if(isset($aPlugins[$aSDATA['pack']])) + { + $plugins = explode(',', $aPlugins[$aSDATA['pack']]); - foreach($plugins as $plugin) - if($plugin) - $sql->query('INSERT INTO `plugins_install` set `server`="'.$id.'", `plugin`="'.$plugin.'", `time`="'.$start_point.'"'); - } - } + foreach($plugins as $plugin) + if($plugin) + $sql->query('INSERT INTO `plugins_install` set `server`="'.$id.'", `plugin`="'.$plugin.'", `time`="'.$start_point.'"'); + } + } - // Списание средств с баланса пользователя - $sql->query('UPDATE `users` set `balance`="'.($user['balance']-$aSDATA['sum']).'" WHERE `id`="'.$user['id'].'" LIMIT 1'); + // Списание средств с баланса пользователя + $sql->query('UPDATE `users` set `balance`="'.($user['balance']-$aSDATA['sum']).'" WHERE `id`="'.$user['id'].'" LIMIT 1'); - // Запись получения тестового периода - if($aSDATA['test']) - { - $sql->query('INSERT INTO `tests` set `server`="'.$id.'", `unit`="'.$aSDATA['unit'].'", `game`="cssold", `user`="'.$user['id'].'", `time`="'.$start_point.'"'); - $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="'.sys::updtext(sys::text('logs', 'buy_server_test'), array('id' => $id)).'", `date`="'.$start_point.'", `type`="buy", `money`="0"'); - }else{ - // Реф. система - games::part($user['id'], $aSDATA['sum']); + // Запись получения тестового периода + if($aSDATA['test']) + { + $sql->query('INSERT INTO `tests` set `server`="'.$id.'", `unit`="'.$aSDATA['unit'].'", `game`="cssold", `user`="'.$user['id'].'", `time`="'.$start_point.'"'); + $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="'.sys::updtext(sys::text('logs', 'buy_server_test'), array('id' => $id)).'", `date`="'.$start_point.'", `type`="buy", `money`="0"'); + }else{ + // Реф. система + games::part($user['id'], $aSDATA['sum']); - // Запись логов - if(!is_array($aSDATA['promo'])) - $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="'.sys::updtext(sys::text('logs', 'buy_server'), array('days' => games::parse_day($aSDATA['days'], true), 'money' => $aSDATA['sum'], 'id' => $id)).'", `date`="'.$start_point.'", `type`="buy", `money`="'.$aSDATA['sum'].'"'); - else{ - $sql->query('UPDATE `servers` set `benefit`="'.$aSDATA['time'].'" WHERE `id`="'.$id.'" LIMIT 1'); - $sql->query('INSERT INTO `promo_use` set `promo`="'.$aSDATA['promo']['id'].'", `user`="'.$user['id'].'", `time`="'.$start_point.'"'); - $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="'.sys::updtext(sys::text('logs', 'buy_server_promo'), array('days' => games::parse_day($aSDATA['days'], true), 'money' => $aSDATA['sum'], 'promo' => $aSDATA['promo']['cod'], 'id' => $id)).'", `date`="'.$start_point.'", `type`="buy", `money`="'.$aSDATA['sum'].'"'); - } - } + // Запись логов + if(!is_array($aSDATA['promo'])) + $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="'.sys::updtext(sys::text('logs', 'buy_server'), array('days' => games::parse_day($aSDATA['days'], true), 'money' => $aSDATA['sum'], 'id' => $id)).'", `date`="'.$start_point.'", `type`="buy", `money`="'.$aSDATA['sum'].'"'); + else{ + $sql->query('UPDATE `servers` set `benefit`="'.$aSDATA['time'].'" WHERE `id`="'.$id.'" LIMIT 1'); + $sql->query('INSERT INTO `promo_use` set `promo`="'.$aSDATA['promo']['id'].'", `user`="'.$user['id'].'", `time`="'.$start_point.'"'); + $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="'.sys::updtext(sys::text('logs', 'buy_server_promo'), array('days' => games::parse_day($aSDATA['days'], true), 'money' => $aSDATA['sum'], 'promo' => $aSDATA['promo']['cod'], 'id' => $id)).'", `date`="'.$start_point.'", `type`="buy", `money`="'.$aSDATA['sum'].'"'); + } + } - return $id; - } + return $id; + } } ?> \ No newline at end of file diff --git a/system/library/games/cssold/tarif.php b/system/library/games/cssold/tarif.php index c98df60..5c575f1 100644 --- a/system/library/games/cssold/tarif.php +++ b/system/library/games/cssold/tarif.php @@ -1,244 +1,244 @@ get('extend', 'sections/servers/games/tarif'); + $html->get('extend', 'sections/servers/games/tarif'); - if(isset($html->arr['extend_address'])) - { - $html->unit('extend_address', 1); - $html->set('extend_address', $html->arr['extend_address']); - }else - $html->unit('extend_address'); + if(isset($html->arr['extend_address'])) + { + $html->unit('extend_address', 1); + $html->set('extend_address', $html->arr['extend_address']); + }else + $html->unit('extend_address'); - $html->set('id', $sid); - $html->set('time', sys::date('min', $server['time'])); - $html->set('options', ''.$options); - $html->set('slots', $server['slots']); - $html->set('info', $server['tickrate'].' TickRate / '.$server['fps'].' FPS'); - $html->set('tarif', $tarif_name); - $html->set('cur', $cfg['currency']); + $html->set('id', $sid); + $html->set('time', sys::date('min', $server['time'])); + $html->set('options', ''.$options); + $html->set('slots', $server['slots']); + $html->set('info', $server['tickrate'].' TickRate / '.$server['fps'].' FPS'); + $html->set('tarif', $tarif_name); + $html->set('cur', $cfg['currency']); - $html->pack('main'); + $html->pack('main'); - return NULL; - } + return NULL; + } public static function extend_sp($server, $tarif, $sid) { - global $cfg, $sql, $html, $start_point; + global $cfg, $sql, $html, $start_point; - tarifs::extend_address($server['game'], $sid); + tarifs::extend_address($server['game'], $sid); - $aPrice = sys::b64djs($tarif['price']); + $aPrice = sys::b64djs($tarif['price']); - $sum = $tarif['slots'] ? $aPrice[$server['tickrate'].'_'.$server['fps']] : $aPrice[$server['tickrate'].'_'.$server['fps']]*$server['slots']; + $sum = $tarif['slots'] ? $aPrice[$server['tickrate'].'_'.$server['fps']] : $aPrice[$server['tickrate'].'_'.$server['fps']]*$server['slots']; - $html->get('extend_sp', 'sections/servers/games/tarif'); + $html->get('extend_sp', 'sections/servers/games/tarif'); - if(isset($html->arr['extend_address'])) - { - $html->unit('extend_address', 1); - $html->set('extend_address', $html->arr['extend_address']); - }else - $html->unit('extend_address'); + if(isset($html->arr['extend_address'])) + { + $html->unit('extend_address', 1); + $html->set('extend_address', $html->arr['extend_address']); + }else + $html->unit('extend_address'); - $html->set('id', $sid); - $html->set('time', sys::date('min', $server['time'])); - $html->set('date', $server['time'] > $start_point ? 'Сервер продлен до: '.date('d.m.Y', $server['time']) : 'Текущая дата: '.date('d.m.Y', $start_point)); - $html->set('options', ''.$options); - $html->set('slots', $server['slots']); - $html->set('info', $server['tickrate'].' TickRate / '.$server['fps'].' FPS'); - $html->set('tarif', $tarif['name']); - $html->set('sum', $sum); - $html->set('cur', $cfg['currency']); + $html->set('id', $sid); + $html->set('time', sys::date('min', $server['time'])); + $html->set('date', $server['time'] > $start_point ? 'Сервер продлен до: '.date('d.m.Y', $server['time']) : 'Текущая дата: '.date('d.m.Y', $start_point)); + $html->set('options', ''.$options); + $html->set('slots', $server['slots']); + $html->set('info', $server['tickrate'].' TickRate / '.$server['fps'].' FPS'); + $html->set('tarif', $tarif['name']); + $html->set('sum', $sum); + $html->set('cur', $cfg['currency']); - $html->pack('main'); + $html->pack('main'); - return NULL; - } + return NULL; + } public static function plan($server, $tarif_name, $sid) { - global $cfg, $sql, $html; + global $cfg, $sql, $html; - $sql->query('SELECT `fps`, `tickrate`, `price` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); + $sql->query('SELECT `fps`, `tickrate`, `price` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); - if(!$sql->num()) - return NULL; + if(!$sql->num()) + return NULL; - $tarif = $sql->get(); + $tarif = $sql->get(); - $options = ''; + $options = ''; - $aPrice = sys::b64djs($tarif['price']); + $aPrice = sys::b64djs($tarif['price']); - unset($aPrice[$server['tickrate'].'_'.$server['fps']]); + unset($aPrice[$server['tickrate'].'_'.$server['fps']]); - foreach($aPrice as $param => $price) - { - list($tickrate, $fps) = explode('_', $param); + foreach($aPrice as $param => $price) + { + list($tickrate, $fps) = explode('_', $param); - $options .= ''; - } + $options .= ''; + } - if($options == '') - return NULL; + if($options == '') + return NULL; - $html->get('plan', 'sections/servers/games/tarif'); + $html->get('plan', 'sections/servers/games/tarif'); - $html->set('id', $sid); - $html->set('options', ''.$options); - $html->set('info', $server['tickrate'].' TickRate / '.$server['fps'].' FPS'); - $html->set('tarif', $tarif_name); + $html->set('id', $sid); + $html->set('options', ''.$options); + $html->set('info', $server['tickrate'].' TickRate / '.$server['fps'].' FPS'); + $html->set('tarif', $tarif_name); - $html->pack('main'); + $html->pack('main'); - return NULL; - } + return NULL; + } - public static function unit($server, $unit_name, $tarif_name, $sid) + public static function unit($server, $unit_name, $tarif_name, $sid) { - global $cfg, $sql, $html; + global $cfg, $sql, $html; - if(!$cfg['change_unit'][$server['game']]) - return NULL; + if(!$cfg['change_unit'][$server['game']]) + return NULL; - $tarifs = $sql->query('SELECT `unit`, `fps`, `tickrate`, `price` FROM `tarifs` WHERE `game`="'.$server['game'].'" AND `name`="'.$tarif_name.'" AND `id`!="'.$server['tarif'].'" AND `show`="1" ORDER BY `unit`'); - if(!$sql->num($tarifs)) - return NULL; + $tarifs = $sql->query('SELECT `unit`, `fps`, `tickrate`, `price` FROM `tarifs` WHERE `game`="'.$server['game'].'" AND `name`="'.$tarif_name.'" AND `id`!="'.$server['tarif'].'" AND `show`="1" ORDER BY `unit`'); + if(!$sql->num($tarifs)) + return NULL; - $units = 0; + $units = 0; - $options = ''; + $options = ''; - while($tarif = $sql->get($tarifs)) - { - if(!array_key_exists($server['tickrate'].'_'.$server['fps'], sys::b64djs($tarif['price']))) - continue; + while($tarif = $sql->get($tarifs)) + { + if(!array_key_exists($server['tickrate'].'_'.$server['fps'], sys::b64djs($tarif['price']))) + continue; - $sql->query('SELECT `id`, `name` FROM `units` WHERE `id`="'.$tarif['unit'].'" AND `show`="1" LIMIT 1'); - if(!$sql->num()) - continue; + $sql->query('SELECT `id`, `name` FROM `units` WHERE `id`="'.$tarif['unit'].'" AND `show`="1" LIMIT 1'); + if(!$sql->num()) + continue; - $unit = $sql->get(); + $unit = $sql->get(); - $options .= ''; + $options .= ''; - $units+=1; - } + $units+=1; + } - if(!$units) - return NULL; + if(!$units) + return NULL; - $html->get('unit', 'sections/servers/games/tarif'); + $html->get('unit', 'sections/servers/games/tarif'); - $html->set('id', $sid); - $html->set('options', $options); - $html->set('slots', $server['slots']); - $html->set('info', $server['tickrate'].' TickRate / '.$server['fps'].' FPS'); - $html->set('unit', $unit_name); - $html->set('tarif', $tarif_name); + $html->set('id', $sid); + $html->set('options', $options); + $html->set('slots', $server['slots']); + $html->set('info', $server['tickrate'].' TickRate / '.$server['fps'].' FPS'); + $html->set('unit', $unit_name); + $html->set('tarif', $tarif_name); - $html->pack('main'); + $html->pack('main'); - return NULL; - } + return NULL; + } - public static function unit_new($tarif, $unit, $server, $mcache) - { - global $ssh, $sql, $user, $start_point; + public static function unit_new($tarif, $unit, $server, $mcache) + { + global $ssh, $sql, $user, $start_point; - // Проверка ssh соединения с локацией - if(!$ssh->auth($unit['passwd'], $unit['address'])) - sys::outjs(array('e' => sys::text('error', 'ssh'))); + // Проверка ssh соединения с локацией + if(!$ssh->auth($unit['passwd'], $unit['address'])) + sys::outjs(array('e' => sys::text('error', 'ssh'))); - // Директория сборки - $path = $tarif['path'].$tarif['pack']; + // Директория сборки + $path = $tarif['path'].$tarif['pack']; - // Директория игрового сервера - $install = $tarif['install'].$server['uid']; + // Директория игрового сервера + $install = $tarif['install'].$server['uid']; - // Пользователь сервера - $uS = 'server'.$server['uid']; + // Пользователь сервера + $uS = 'server'.$server['uid']; - $ssh->set('mkdir '.$install.';' // Создание директории - .'useradd -d '.$install.' -g servers -u '.$server['uid'].' '.$uS.';' // Создание пользователя сервера на локации - .'chown '.$uS.':1000 '.$install.';' // Изменение владельца и группы директории - .'cd '.$install.' && sudo -u '.$uS.' screen -dmS i_'.$server['uid'].' cp -r '.$path.'/. .'); // Копирование файлов сборки для сервера + $ssh->set('mkdir '.$install.';' // Создание директории + .'useradd -d '.$install.' -g servers -u '.$server['uid'].' '.$uS.';' // Создание пользователя сервера на локации + .'chown '.$uS.':1000 '.$install.';' // Изменение владельца и группы директории + .'cd '.$install.' && sudo -u '.$uS.' screen -dmS i_'.$server['uid'].' cp -r '.$path.'/. .'); // Копирование файлов сборки для сервера - $address = explode(':', $server['address']); + $address = explode(':', $server['address']); - $fix_one = $tarif['core_fix'] ? 1 : 0; + $fix_one = $tarif['core_fix'] ? 1 : 0; - // Обновление данных нового сервера - $sql->query('UPDATE `servers` set - `unit`="'.$tarif['unit'].'", - `tarif`="'.$tarif['id'].'", - `address`="'.$server['address'].'", - `port`="'.$address[1].'", - `status`="install", - `name`="'.$tarif['hostname'].'", - `pack`="'.$tarif['pack'].'", - `map_start`="'.$tarif['map'].'", - `vac`="1", - `hdd`="'.$tarif['hdd'].'", - `time`="'.$tarif['time'].'", - `autostop`="'.$tarif['autostop'].'", - `core_fix`="'.$tarif['core_fix'].'", - `core_fix_one`="'.$fix_one.'", - `reinstall`="'.$start_point.'" WHERE `id`="'.$server['id'].'" LIMIT 1'); + // Обновление данных нового сервера + $sql->query('UPDATE `servers` set + `unit`="'.$tarif['unit'].'", + `tarif`="'.$tarif['id'].'", + `address`="'.$server['address'].'", + `port`="'.$address[1].'", + `status`="install", + `name`="'.$tarif['hostname'].'", + `pack`="'.$tarif['pack'].'", + `map_start`="'.$tarif['map'].'", + `vac`="1", + `hdd`="'.$tarif['hdd'].'", + `time`="'.$tarif['time'].'", + `autostop`="'.$tarif['autostop'].'", + `core_fix`="'.$tarif['core_fix'].'", + `core_fix_one`="'.$fix_one.'", + `reinstall`="'.$start_point.'" WHERE `id`="'.$server['id'].'" LIMIT 1'); - // Запись установленных плагинов - if($tarif['plugins']) - { - // Массив идентификаторов плагинов - $aPlugins = sys::b64js($tarif['plugins_install']); + // Запись установленных плагинов + if($tarif['plugins']) + { + // Массив идентификаторов плагинов + $aPlugins = sys::b64js($tarif['plugins_install']); - if(isset($aPlugins[$tarif['pack']])) - { - $plugins = explode(',', $aPlugins[$tarif['pack']]); + if(isset($aPlugins[$tarif['pack']])) + { + $plugins = explode(',', $aPlugins[$tarif['pack']]); - foreach($plugins as $plugin) - if($plugin) - $sql->query('INSERT INTO `plugins_install` set `server`="'.$server['id'].'", `plugin`="'.$plugin.'", `time`="'.$start_point.'"'); - } - } + foreach($plugins as $plugin) + if($plugin) + $sql->query('INSERT INTO `plugins_install` set `server`="'.$server['id'].'", `plugin`="'.$plugin.'", `time`="'.$start_point.'"'); + } + } - return NULL; - } + return NULL; + } - public static function price($plan) - { - $aPrice = array_values(sys::b64djs($plan)); + public static function price($plan) + { + $aPrice = array_values(sys::b64djs($plan)); - $check = $aPrice[0]; + $check = $aPrice[0]; - unset($aPrice[0]); + unset($aPrice[0]); - if(!count($aPrice)) - return false; + if(!count($aPrice)) + return false; - foreach($aPrice as $price) - { - if($check != $price) - return true; - } + foreach($aPrice as $price) + { + if($check != $price) + return true; + } - return false; - } + return false; + } } ?> \ No newline at end of file diff --git a/system/library/games/games.php b/system/library/games/games.php index aa7bbc3..a105683 100644 --- a/system/library/games/games.php +++ b/system/library/games/games.php @@ -1,810 +1,810 @@ 'устанавливается', - 'reinstall' => 'переустанавливается', - 'update' => 'обновляется', - 'recovery' => 'восстанавливается', - 'overdue' => 'не оплачен', - 'blocked' => 'заблокирован' - ); - - $msg = sys::updtext(sys::text('servers', 'determine'), array('status' => $aText[$status])); - - if($go) - sys::out($msg); - - $html->get('informer'); - - $html->set('[class]', 'info_red'); - $html->set('[text]', $msg); - - $html->pack($tpl); - - return false; - } - - public static function crontab_week($week) - { - $aWeek = array(); - $aWeek[1] = isset($week['\'1\'']) ? 'Пн., ' : ''; - $aWeek[2] = isset($week['\'2\'']) ? 'Вт., ' : ''; - $aWeek[3] = isset($week['\'3\'']) ? 'Ср., ' : ''; - $aWeek[4] = isset($week['\'4\'']) ? 'Чт., ' : ''; - $aWeek[5] = isset($week['\'5\'']) ? 'Пт., ' : ''; - $aWeek[6] = isset($week['\'6\'']) ? 'Сб., ' : ''; - $aWeek[7] = isset($week['\'7\'']) ? 'Вс., ' : ''; - - $days = ''; - - foreach($aWeek as $index => $val) - { - if($val == '') - continue; - - $days .= $val; - } - - $days = substr($days, 0, -2); - - if($days == '') - $days = 'Пн., Вт., Ср., Чт., Пт., Сб., Вс.'; - - return $days; - } - - public static function crontab_time($allhour, $hour, $minute) - { - if($allhour) - return 'Каждый час'; - - $aHour = array( - '00', '01', '02', - '03', '04', '05', - '06', '07', '08', - '09', '10', '11', - '12', '13', '14', - '15', '16', '17', - '18', '19', '20', - '21', '22', '23' - ); - - $aMinute = array( - '00', '05', '10', - '15', '20', '25', - '30', '35', '40', - '45', '50', '55' - ); - - if(!in_array($hour, $aHour)) - $hour = '00'; - - if(!in_array($minute, $aMinute)) - $minute = '00'; + return $cfg['url'].'template/images/country/none.png'; + } + + public static function determine($status, $go = false, $tpl = 'content') + { + global $html, $text; + + if(!in_array($status, array('install', 'reinstall', 'update', 'recovery', 'overdue', 'blocked'))) + return true; + + $aText = array( + 'install' => 'устанавливается', + 'reinstall' => 'переустанавливается', + 'update' => 'обновляется', + 'recovery' => 'восстанавливается', + 'overdue' => 'не оплачен', + 'blocked' => 'заблокирован' + ); + + $msg = sys::updtext(sys::text('servers', 'determine'), array('status' => $aText[$status])); + + if($go) + sys::out($msg); + + $html->get('informer'); + + $html->set('[class]', 'info_red'); + $html->set('[text]', $msg); + + $html->pack($tpl); + + return false; + } + + public static function crontab_week($week) + { + $aWeek = array(); + $aWeek[1] = isset($week['\'1\'']) ? 'Пн., ' : ''; + $aWeek[2] = isset($week['\'2\'']) ? 'Вт., ' : ''; + $aWeek[3] = isset($week['\'3\'']) ? 'Ср., ' : ''; + $aWeek[4] = isset($week['\'4\'']) ? 'Чт., ' : ''; + $aWeek[5] = isset($week['\'5\'']) ? 'Пт., ' : ''; + $aWeek[6] = isset($week['\'6\'']) ? 'Сб., ' : ''; + $aWeek[7] = isset($week['\'7\'']) ? 'Вс., ' : ''; + + $days = ''; + + foreach($aWeek as $index => $val) + { + if($val == '') + continue; + + $days .= $val; + } + + $days = substr($days, 0, -2); + + if($days == '') + $days = 'Пн., Вт., Ср., Чт., Пт., Сб., Вс.'; + + return $days; + } + + public static function crontab_time($allhour, $hour, $minute) + { + if($allhour) + return 'Каждый час'; + + $aHour = array( + '00', '01', '02', + '03', '04', '05', + '06', '07', '08', + '09', '10', '11', + '12', '13', '14', + '15', '16', '17', + '18', '19', '20', + '21', '22', '23' + ); + + $aMinute = array( + '00', '05', '10', + '15', '20', '25', + '30', '35', '40', + '45', '50', '55' + ); + + if(!in_array($hour, $aHour)) + $hour = '00'; + + if(!in_array($minute, $aMinute)) + $minute = '00'; - return $hour.':'.$minute; - } - - public static function crontab($id, $cid, $data = array()) - { - global $cfg; - - if($data['allhour']) - $time = '0 * * * '; - else{ - $hour = array( - '00', '01', '02', - '03', '04', '05', - '06', '07', '08', - '09', '10', '11', - '12', '13', '14', - '15', '16', '17', - '18', '19', '20', - '21', '22', '23' - ); - - $minute = array( - '00', '05', '10', - '15', '20', '25', - '30', '35', '40', - '45', '50', '55' - ); + return $hour.':'.$minute; + } + + public static function crontab($id, $cid, $data = array()) + { + global $cfg; + + if($data['allhour']) + $time = '0 * * * '; + else{ + $hour = array( + '00', '01', '02', + '03', '04', '05', + '06', '07', '08', + '09', '10', '11', + '12', '13', '14', + '15', '16', '17', + '18', '19', '20', + '21', '22', '23' + ); + + $minute = array( + '00', '05', '10', + '15', '20', '25', + '30', '35', '40', + '45', '50', '55' + ); - if(!in_array($data['hour'], $hour)) - $data['hour'] = '00'; + if(!in_array($data['hour'], $hour)) + $data['hour'] = '00'; - if(!in_array($data['minute'], $minute)) - $data['minute'] = '00'; - - $time = $data['minute'].' '.$data['hour'].' * * '; - } - - $week = array(); - $week[1] = isset($data['week']['\'1\'']) ? 1 : 0; - $week[2] = isset($data['week']['\'2\'']) ? 2 : 0; - $week[3] = isset($data['week']['\'3\'']) ? 3 : 0; - $week[4] = isset($data['week']['\'4\'']) ? 4 : 0; - $week[5] = isset($data['week']['\'5\'']) ? 5 : 0; - $week[6] = isset($data['week']['\'6\'']) ? 6 : 0; - $week[7] = isset($data['week']['\'7\'']) ? 7 : 0; - - $check = 0; + if(!in_array($data['minute'], $minute)) + $data['minute'] = '00'; + + $time = $data['minute'].' '.$data['hour'].' * * '; + } + + $week = array(); + $week[1] = isset($data['week']['\'1\'']) ? 1 : 0; + $week[2] = isset($data['week']['\'2\'']) ? 2 : 0; + $week[3] = isset($data['week']['\'3\'']) ? 3 : 0; + $week[4] = isset($data['week']['\'4\'']) ? 4 : 0; + $week[5] = isset($data['week']['\'5\'']) ? 5 : 0; + $week[6] = isset($data['week']['\'6\'']) ? 6 : 0; + $week[7] = isset($data['week']['\'7\'']) ? 7 : 0; + + $check = 0; - foreach($week as $index => $val) - $check+= $val; + foreach($week as $index => $val) + $check+= $val; - if($check == 28 || !$check) - $week = '*'; - else{ - $weeks = $week[1].','.$week[2].','.$week[3].','.$week[4].','.$week[5].','.$week[6].','.$week[7]; - $weeks = str_replace(array(',0', '0'), '', $weeks); - $week = $weeks[0] == ',' ? substr($weeks, 1) : $weeks; - } + if($check == 28 || !$check) + $week = '*'; + else{ + $weeks = $week[1].','.$week[2].','.$week[3].','.$week[4].','.$week[5].','.$week[6].','.$week[7]; + $weeks = str_replace(array(',0', '0'), '', $weeks); + $week = $weeks[0] == ',' ? substr($weeks, 1) : $weeks; + } - $cron_task = $time.$week.' screen -dmS s'.$id.' bash -c \'cd /var/enginegp && php cron.php '.$cfg['cron_key'].' server_cron '.$id.' '.$cid.'\''; - - return $cron_task; - } - - public static function parse_tarif($aTarif = array(), $aUnit = array()) - { - global $cfg, $mcache; - - $nmch = 'parse_tarif_'.$aTarif['id']; - - $cache = $mcache->get($nmch); - - if(is_array($cache)) - return $cache; - - if(isset($aTarif['fps'])) - $aFPS = explode(':', $aTarif['fps']); - - if(isset($aTarif['tickrate'])) - $aTICKRATE = explode(':', $aTarif['tickrate']); - - if(isset($aTarif['ram'])) - $aRAM = explode(':', $aTarif['ram']); - - $fps = ''; - - if(isset($aFPS)) - foreach($aFPS as $value) - $fps .= ''; - - $tickrate = ''; + $cron_task = $time.$week.' screen -dmS s'.$id.' bash -c \'cd /var/enginegp && php cron.php '.$cfg['cron_key'].' server_cron '.$id.' '.$cid.'\''; + + return $cron_task; + } + + public static function parse_tarif($aTarif = array(), $aUnit = array()) + { + global $cfg, $mcache; + + $nmch = 'parse_tarif_'.$aTarif['id']; + + $cache = $mcache->get($nmch); + + if(is_array($cache)) + return $cache; + + if(isset($aTarif['fps'])) + $aFPS = explode(':', $aTarif['fps']); + + if(isset($aTarif['tickrate'])) + $aTICKRATE = explode(':', $aTarif['tickrate']); + + if(isset($aTarif['ram'])) + $aRAM = explode(':', $aTarif['ram']); + + $fps = ''; + + if(isset($aFPS)) + foreach($aFPS as $value) + $fps .= ''; + + $tickrate = ''; - if(isset($aTICKRATE)) - foreach($aTICKRATE as $value) - $tickrate .= ''; + if(isset($aTICKRATE)) + foreach($aTICKRATE as $value) + $tickrate .= ''; - $ram = ''; - - if(isset($aRAM)) - { - if($aTarif['param_fix']) - foreach($aRAM as $value) - $ram .= ''; - else - foreach($aRAM as $value) - $ram .= ''; - } - - $packs = ''; - $aPack = sys::b64djs($aTarif['packs'], true); + $ram = ''; + + if(isset($aRAM)) + { + if($aTarif['param_fix']) + foreach($aRAM as $value) + $ram .= ''; + else + foreach($aRAM as $value) + $ram .= ''; + } + + $packs = ''; + $aPack = sys::b64djs($aTarif['packs'], true); - if(is_array($aPack)) - foreach($aPack as $index => $name) - $packs .= ''; + if(is_array($aPack)) + foreach($aPack as $index => $name) + $packs .= ''; - $slots = ''; + $slots = ''; - for($i = $aTarif['slots_min']; $i <= $aTarif['slots_max']; $i+=1) - $slots .= ''; + for($i = $aTarif['slots_min']; $i <= $aTarif['slots_max']; $i+=1) + $slots .= ''; - $aTime = explode(':', $aTarif['time']); + $aTime = explode(':', $aTarif['time']); - $time = games::parse_time($aTime, $aTarif['discount'], $aTarif['id']); + $time = games::parse_time($aTime, $aTarif['discount'], $aTarif['id']); - if($aTarif['test'] AND $aUnit['test']) - $time .= ''; + if($aTarif['test'] AND $aUnit['test']) + $time .= ''; - $data = array( - 'packs' => $packs, - 'slots' => $slots, - 'time' => $time, - 'fps' => $fps, - 'tickrate' => $tickrate, - 'ram' => $ram - ); + $data = array( + 'packs' => $packs, + 'slots' => $slots, + 'time' => $time, + 'fps' => $fps, + 'tickrate' => $tickrate, + 'ram' => $ram + ); - $mcache->set($nmch, $data, false, 60); - - return $data; - } + $mcache->set($nmch, $data, false, 60); + + return $data; + } - public static function parse_time($aTime, $discount, $tarif, $type = 'buy') - { - global $cfg; + public static function parse_time($aTime, $discount, $tarif, $type = 'buy') + { + global $cfg; - $time = ''; + $time = ''; - $arr = isset(params::$disconunt['service'][$tarif]) ? $tarif : 'time'; + $arr = isset(params::$disconunt['service'][$tarif]) ? $tarif : 'time'; - foreach($aTime as $value) - { - if(array_key_exists($value, params::$disconunt['service'][$arr][$type]) AND $discount) - { - $data = explode(':', params::$disconunt['service'][$arr][$type][$value]); + foreach($aTime as $value) + { + if(array_key_exists($value, params::$disconunt['service'][$arr][$type]) AND $discount) + { + $data = explode(':', params::$disconunt['service'][$arr][$type][$value]); - // Если наценка - if($data[0] == '+') - { - // Если значение в процентах - if(substr($data[1], -1) == '%') - $time .= ''; - else - $time .= ''; - }else{ - // Если значение в процентах - if(substr($data[1], -1) == '%') - $time .= ''; - else - $time .= ''; - } - }else - $time .= ''; - } + // Если наценка + if($data[0] == '+') + { + // Если значение в процентах + if(substr($data[1], -1) == '%') + $time .= ''; + else + $time .= ''; + }else{ + // Если значение в процентах + if(substr($data[1], -1) == '%') + $time .= ''; + else + $time .= ''; + } + }else + $time .= ''; + } - return $time; - } + return $time; + } - public static function define_period($type, $aD_M, $time = 0) - { - global $start_point; + public static function define_period($type, $aD_M, $time = 0) + { + global $start_point; - if($time < $start_point) - $time = $start_point; + if($time < $start_point) + $time = $start_point; - $day = $type == 'extend' ? date('d', $time) : date('d', $start_point); - $month = $type == 'extend' ? date('n', $time) : date('n', $start_point); - - $period = $aD_M[$month]-$day; + $day = $type == 'extend' ? date('d', $time) : date('d', $start_point); + $month = $type == 'extend' ? date('n', $time) : date('n', $start_point); + + $period = $aD_M[$month]-$day; - if($day > 15) - $period += $month != 12 ? $aD_M[$month+1] : $aD_M[1]; - - return $period+1; - } - - public static function define_sum($discount, $price, $slots, $time, $type = 'buy') - { - global $sql, $user, $cfg, $start_point; - - if($cfg['settlement_period']) - { - if($time < $start_point) - $time = $start_point; - - $day = $type == 'extend' ? date('d', $time) : date('d', $start_point); - $month = $type == 'extend' ? date('n', $time) : date('n', $start_point); + if($day > 15) + $period += $month != 12 ? $aD_M[$month+1] : $aD_M[1]; + + return $period+1; + } + + public static function define_sum($discount, $price, $slots, $time, $type = 'buy') + { + global $sql, $user, $cfg, $start_point; + + if($cfg['settlement_period']) + { + if($time < $start_point) + $time = $start_point; + + $day = $type == 'extend' ? date('d', $time) : date('d', $start_point); + $month = $type == 'extend' ? date('n', $time) : date('n', $start_point); - $period = params::$aDayMonth[$month]+1-$day; - - $new_month_sum = 0; - - if($day > 15) - $new_month_sum = ceil($price*$slots); - - $sum = params::$aDayMonth[$month] == $period ? $price*$slots : floor($price*$slots/30*$period)+$new_month_sum; - }else{ - $sum = floor($price*$slots/30*$time); - - if(array_key_exists($time, params::$disconunt['service']['time'][$type]) AND $discount) - { - $data = explode(':', params::$disconunt['service']['time'][$type][$time]); - - // Если наценка - if($data[0] == '+') - { - // Если значение в процентах - if(substr($data[1], -1) == '%') - $sum = ceil($sum+$sum/100*intval($data[1])); - else - $sum = $sum+intval($data[1]); - }else{ - // Если значение в процентах - if(substr($data[1], -1) == '%') - $sum = ceil($sum-$sum/100*intval($data[1])); - else - $sum = $sum-intval($data[1]); - } - } - } - - $sel = $type == 'buy' ? 'rental' : 'extend'; - - $sql->query('SELECT `'.$sel.'` FROM `users` WHERE `id`="'.$user['id'].'" LIMIT 1'); - $user = array_merge($user, $sql->get()); - - $sum = strpos($user[$sel], '%') ? $sum-$sum/100*$user[$sel] : $sum-$user[$sel]; - - if($sum < 0) - sys::outjs(array('e' => 'Ошибка: сумма за услугу неверна')); - - return $sum; - } - - public static function define_promo($cod, $data, $discount, $sum, $type = 'buy') - { - global $cfg, $sql, $go, $start_point; - - // Проверка формата кода - if(sys::valid($cod, 'promo')) - { - if(!$go) - sys::outjs(array('e' => 'Промо-код имеет неверный формат.')); - - return NULL; - } - - $sql->query('SELECT `id`, `value`, `discount`, `data`, `hits`, `use`, `extend`, `user`, `server` FROM `promo` WHERE `cod`="'.$cod.'" AND `tarif`="'.$data['tarif'].'" AND `time`>"'.$start_point.'" LIMIT 1'); - - // Проверка наличия промо-кода - if(!$sql->num()) - { - if(!$go) - sys::outjs(array('e' => 'Промо-код не найден.')); - - return NULL; - } - - $promo = $sql->get(); - - // Проверка типа при аренде - if($type == 'buy' AND $promo['extend']) - { - if(!$go) - sys::outjs(array('e' => 'Промо-код для продления игрового сервера.')); - - return NULL; - } - - // Проверка типа при продлении - if($type != 'buy' AND !$promo['extend']) - { - if(!$go) - sys::outjs(array('e' => 'Промо-код для аренды нового игрового сервера.')); - - return NULL; - } - - // Проверка доступности на пользователя - if($promo['user'] AND $data['user'] != $promo['user']) - { - if(!$go) - sys::outjs(array('e' => 'Промо-код не найден.')); - - return NULL; - } - - // Проверка доступности на сервер - if($promo['server'] AND $data['server'] != $promo['server']) - { - if(!$go) - sys::outjs(array('e' => 'Промо-код не найден.')); - - return NULL; - } - - $use = $promo['use'] < 1 ? '1' : $promo['use']; - - // Проверка доступности - $sql->query('SELECT `id` FROM `promo_use` WHERE `promo`="'.$promo['id'].'" LIMIT '.$use); - if($sql->num() >= $promo['use']) - { - if(!$go) - sys::outjs(array('e' => 'Промо-код использован максимальное количество раз.')); - - return NULL; - } - - // Данные для сравнения - $data_promo = sys::b64djs($promo['data'], true); - - $check = 0; - - // Проверка периода - if(in_array($data['time'], explode(':', $data_promo['time']))) - $check = 1; - - // Проверка значения FPS - if((isset($data['fps']) AND isset($data_promo['fps'])) AND in_array($data['fps'], explode(':', $data_promo['fps']))) - $check+= 1; - - // Проверка значения TICKRATE - if((isset($data['tickrate']) AND isset($data_promo['tickrate'])) AND in_array($data['tickrate'], explode(':', $data_promo['tickrate']))) - $check+= 1; - - // Проверка значения RAM - if((isset($data['ram']) AND isset($data_promo['ram'])) AND in_array($data['ram'], explode(':', $data_promo['ram']))) - $check+= 1; - - // Проверка кол-ва слот - if(isset($data_promo['slots'])) - { - // Если совпало по перечислению слот (через число:число:число ...) - if(in_array($data['slots'], explode(':', $data_promo['slots']))) - $check+= 1; - else{ - // Если указан диапозон слот - $aSl = explode('-', $data_promo['slots']); - if(count($aSl) == 2 AND ($data['slots'] >= $aSl[0] AND $data['slots'] <= $aSl[1])) - $check+= 1; - } - } - - // Проверка совпадений - if($check < $promo['hits']) - { - if(!$go) - sys::outjs(array('e' => 'Условия для данного промо-кода не выполнены.')); - - return NULL; - } - - // Если скидка - if($promo['discount']) - { - // Если не суммировать скидки - if(!$cfg['promo_discount']) - { - if(array_key_exists($data['time'], params::$disconunt['service']['time'][$type]) AND $discount) - { - $data = explode(':', params::$disconunt['service']['time'][$type][$data['time']]); - - // Если скидка - if($data[0] == '-') - { - // Если значение в процентах - if(substr($data[1], -1) == '%') - $sum = ceil($sum+$sum/100*intval($data[1])); - else - $sum = $sum+intval($data[1]); - } - } - } + $period = params::$aDayMonth[$month]+1-$day; + + $new_month_sum = 0; + + if($day > 15) + $new_month_sum = ceil($price*$slots); + + $sum = params::$aDayMonth[$month] == $period ? $price*$slots : floor($price*$slots/30*$period)+$new_month_sum; + }else{ + $sum = floor($price*$slots/30*$time); + + if(array_key_exists($time, params::$disconunt['service']['time'][$type]) AND $discount) + { + $data = explode(':', params::$disconunt['service']['time'][$type][$time]); + + // Если наценка + if($data[0] == '+') + { + // Если значение в процентах + if(substr($data[1], -1) == '%') + $sum = ceil($sum+$sum/100*intval($data[1])); + else + $sum = $sum+intval($data[1]); + }else{ + // Если значение в процентах + if(substr($data[1], -1) == '%') + $sum = ceil($sum-$sum/100*intval($data[1])); + else + $sum = $sum-intval($data[1]); + } + } + } + + $sel = $type == 'buy' ? 'rental' : 'extend'; + + $sql->query('SELECT `'.$sel.'` FROM `users` WHERE `id`="'.$user['id'].'" LIMIT 1'); + $user = array_merge($user, $sql->get()); + + $sum = strpos($user[$sel], '%') ? $sum-$sum/100*$user[$sel] : $sum-$user[$sel]; + + if($sum < 0) + sys::outjs(array('e' => 'Ошибка: сумма за услугу неверна')); + + return $sum; + } + + public static function define_promo($cod, $data, $discount, $sum, $type = 'buy') + { + global $cfg, $sql, $go, $start_point; + + // Проверка формата кода + if(sys::valid($cod, 'promo')) + { + if(!$go) + sys::outjs(array('e' => 'Промо-код имеет неверный формат.')); + + return NULL; + } + + $sql->query('SELECT `id`, `value`, `discount`, `data`, `hits`, `use`, `extend`, `user`, `server` FROM `promo` WHERE `cod`="'.$cod.'" AND `tarif`="'.$data['tarif'].'" AND `time`>"'.$start_point.'" LIMIT 1'); + + // Проверка наличия промо-кода + if(!$sql->num()) + { + if(!$go) + sys::outjs(array('e' => 'Промо-код не найден.')); + + return NULL; + } + + $promo = $sql->get(); + + // Проверка типа при аренде + if($type == 'buy' AND $promo['extend']) + { + if(!$go) + sys::outjs(array('e' => 'Промо-код для продления игрового сервера.')); + + return NULL; + } + + // Проверка типа при продлении + if($type != 'buy' AND !$promo['extend']) + { + if(!$go) + sys::outjs(array('e' => 'Промо-код для аренды нового игрового сервера.')); + + return NULL; + } + + // Проверка доступности на пользователя + if($promo['user'] AND $data['user'] != $promo['user']) + { + if(!$go) + sys::outjs(array('e' => 'Промо-код не найден.')); + + return NULL; + } + + // Проверка доступности на сервер + if($promo['server'] AND $data['server'] != $promo['server']) + { + if(!$go) + sys::outjs(array('e' => 'Промо-код не найден.')); + + return NULL; + } + + $use = $promo['use'] < 1 ? '1' : $promo['use']; + + // Проверка доступности + $sql->query('SELECT `id` FROM `promo_use` WHERE `promo`="'.$promo['id'].'" LIMIT '.$use); + if($sql->num() >= $promo['use']) + { + if(!$go) + sys::outjs(array('e' => 'Промо-код использован максимальное количество раз.')); + + return NULL; + } + + // Данные для сравнения + $data_promo = sys::b64djs($promo['data'], true); + + $check = 0; + + // Проверка периода + if(in_array($data['time'], explode(':', $data_promo['time']))) + $check = 1; + + // Проверка значения FPS + if((isset($data['fps']) AND isset($data_promo['fps'])) AND in_array($data['fps'], explode(':', $data_promo['fps']))) + $check+= 1; + + // Проверка значения TICKRATE + if((isset($data['tickrate']) AND isset($data_promo['tickrate'])) AND in_array($data['tickrate'], explode(':', $data_promo['tickrate']))) + $check+= 1; + + // Проверка значения RAM + if((isset($data['ram']) AND isset($data_promo['ram'])) AND in_array($data['ram'], explode(':', $data_promo['ram']))) + $check+= 1; + + // Проверка кол-ва слот + if(isset($data_promo['slots'])) + { + // Если совпало по перечислению слот (через число:число:число ...) + if(in_array($data['slots'], explode(':', $data_promo['slots']))) + $check+= 1; + else{ + // Если указан диапозон слот + $aSl = explode('-', $data_promo['slots']); + if(count($aSl) == 2 AND ($data['slots'] >= $aSl[0] AND $data['slots'] <= $aSl[1])) + $check+= 1; + } + } + + // Проверка совпадений + if($check < $promo['hits']) + { + if(!$go) + sys::outjs(array('e' => 'Условия для данного промо-кода не выполнены.')); + + return NULL; + } + + // Если скидка + if($promo['discount']) + { + // Если не суммировать скидки + if(!$cfg['promo_discount']) + { + if(array_key_exists($data['time'], params::$disconunt['service']['time'][$type]) AND $discount) + { + $data = explode(':', params::$disconunt['service']['time'][$type][$data['time']]); + + // Если скидка + if($data[0] == '-') + { + // Если значение в процентах + if(substr($data[1], -1) == '%') + $sum = ceil($sum+$sum/100*intval($data[1])); + else + $sum = $sum+intval($data[1]); + } + } + } - // Пересчет суммы - if(substr($promo['value'], -1) == '%') - $sum = $sum-ceil($sum/100*intval($promo['value'])); - else - $sum = $sum-intval($promo['value']); + // Пересчет суммы + if(substr($promo['value'], -1) == '%') + $sum = $sum-ceil($sum/100*intval($promo['value'])); + else + $sum = $sum-intval($promo['value']); - if(!$go) - sys::outjs(array('sum' => $sum, 'discount' => 1, 'cur' => $cfg['currency'])); + if(!$go) + sys::outjs(array('sum' => $sum, 'discount' => 1, 'cur' => $cfg['currency'])); - return array('id' => $promo['id'], 'cod' => $cod, 'sum' => $sum); + return array('id' => $promo['id'], 'cod' => $cod, 'sum' => $sum); - } + } - // Подарочные дни - $days = intval($promo['value']); + // Подарочные дни + $days = intval($promo['value']); - if(!$go) - sys::outjs(array('days' => games::parse_day($days))); + if(!$go) + sys::outjs(array('days' => games::parse_day($days))); - return array('id' => $promo['id'], 'cod' => $cod, 'days' => $days); - } + return array('id' => $promo['id'], 'cod' => $cod, 'days' => $days); + } - public static function info_tarif($game, $tarif, $param) - { - if($game == 'cs') - return $tarif.' / '.$param['fps'].' FPS'; + public static function info_tarif($game, $tarif, $param) + { + if($game == 'cs') + return $tarif.' / '.$param['fps'].' FPS'; - if($game == 'mc') - return $tarif.' / '.$param['ram'].' RAM'; + if($game == 'mc') + return $tarif.' / '.$param['ram'].' RAM'; - if($game == 'cssold') - return $tarif.' / '.$param['fps'].' FPS / '.$param['tickrate'].' TickRate'; + if($game == 'cssold') + return $tarif.' / '.$param['fps'].' FPS / '.$param['tickrate'].' TickRate'; - if(in_array($game, array('css', 'csgo'))) - return $tarif.' / '.$param['tickrate'].' TickRate'; + if(in_array($game, array('css', 'csgo'))) + return $tarif.' / '.$param['tickrate'].' TickRate'; - return $tarif; - } + return $tarif; + } - public static function maplist($id, $unit, $folder, $map, $go, $mcache = '', $ctrl = false) - { - global $user, $sql; + public static function maplist($id, $unit, $folder, $map, $go, $mcache = '', $ctrl = false) + { + global $user, $sql; - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - if(!$ssh->auth($unit['passwd'], $unit['address'])) - { - if($go) - sys::outjs(array('e' => sys::text('error', 'ssh')), $mcache); + if(!$ssh->auth($unit['passwd'], $unit['address'])) + { + if($go) + sys::outjs(array('e' => sys::text('error', 'ssh')), $mcache); - sys::outjs(array('maps', '')); - } + sys::outjs(array('maps', '')); + } - // Генерация списка карт - $aMaps = array_diff(explode("\n", $ssh->get('cd '.$folder.' && du -ah | grep -e "\.bsp$" | awk \'{print $2}\'')), array('')); + // Генерация списка карт + $aMaps = array_diff(explode("\n", $ssh->get('cd '.$folder.' && du -ah | grep -e "\.bsp$" | awk \'{print $2}\'')), array('')); - // Удаление ".bsp" - $aMaps = str_ireplace(array('./', '.bsp'), '', $aMaps); + // Удаление ".bsp" + $aMaps = str_ireplace(array('./', '.bsp'), '', $aMaps); - if($go) - { - $map = str_replace('|', '/', urldecode($map)); + if($go) + { + $map = str_replace('|', '/', urldecode($map)); - $sqlq = $ctrl ? 'control_' : ''; + $sqlq = $ctrl ? 'control_' : ''; - // Проверка наличия выбранной карты - if(in_array($map, $aMaps)) - $sql->query('UPDATE `'.$sqlq.'servers` set `map_start`="'.$map.'" WHERE `id`="'.$id.'" LIMIT 1'); + // Проверка наличия выбранной карты + if(in_array($map, $aMaps)) + $sql->query('UPDATE `'.$sqlq.'servers` set `map_start`="'.$map.'" WHERE `id`="'.$id.'" LIMIT 1'); - sys::outjs(array('s' => 'ok'), $mcache); - } + sys::outjs(array('s' => 'ok'), $mcache); + } - sort($aMaps); - reset($aMaps); + sort($aMaps); + reset($aMaps); - $ismap = in_array($map, $aMaps); - $maps = $ismap ? '' : ''; + $ismap = in_array($map, $aMaps); + $maps = $ismap ? '' : ''; - // Удаление стартовой карты - if($ismap) - unset($aMaps[array_search($map, $aMaps)]); + // Удаление стартовой карты + if($ismap) + unset($aMaps[array_search($map, $aMaps)]); - foreach($aMaps as $map) - $maps .= ''; + foreach($aMaps as $map) + $maps .= ''; - sys::outjs(array('maps' => $maps)); - } + sys::outjs(array('maps' => $maps)); + } - public static function owners($aRights) - { - if(array_search(0, $aRights)) - return 'Есть ограничения в доступе.'; + public static function owners($aRights) + { + if(array_search(0, $aRights)) + return 'Есть ограничения в доступе.'; - return 'Выданы все права.'; - } + return 'Выданы все права.'; + } - public static function part($uid, $money) - { - global $cfg, $sql, $start_point; + public static function part($uid, $money) + { + global $cfg, $sql, $start_point; - if($cfg['part']) - return NULL; + if($cfg['part']) + return NULL; - $sql->query('SELECT `part` FROM `users` WHERE `id`="'.$uid.'" LIMIT 1'); - $user = $sql->get(); + $sql->query('SELECT `part` FROM `users` WHERE `id`="'.$uid.'" LIMIT 1'); + $user = $sql->get(); - if(!$user['part']) - return NULL; + if(!$user['part']) + return NULL; - $sql->query('SELECT `balance`, `part_money` FROM `users` WHERE `id`="'.$user['part'].'" LIMIT 1'); - if(!$sql->num()) - return NULL; + $sql->query('SELECT `balance`, `part_money` FROM `users` WHERE `id`="'.$user['part'].'" LIMIT 1'); + if(!$sql->num()) + return NULL; - $user = array_merge($user, $sql->get()); + $user = array_merge($user, $sql->get()); - $sum = round($money/100*$cfg['part_proc'], 2); + $sum = round($money/100*$cfg['part_proc'], 2); - if($cfg['part_money']) - $sql->query('UPDATE `users` set `part_money`="'.($user['part_money']+$sum).'" WHERE `id`="'.$user['part'].'" LIMIT 1'); - else - $sql->query('UPDATE `users` set `balance`="'.($user['balance']+$sum).'" WHERE `id`="'.$user['part'].'" LIMIT 1'); + if($cfg['part_money']) + $sql->query('UPDATE `users` set `part_money`="'.($user['part_money']+$sum).'" WHERE `id`="'.$user['part'].'" LIMIT 1'); + else + $sql->query('UPDATE `users` set `balance`="'.($user['balance']+$sum).'" WHERE `id`="'.$user['part'].'" LIMIT 1'); - $sql->query('INSERT INTO `logs` set `user`="'.$user['part'].'", `text`="'.sys::updtext(sys::text('logs', 'part'), - array('part' => $uid, 'money' => $sum)).'", `date`="'.$start_point.'", `type`="part", `money`="'.$sum.'"'); + $sql->query('INSERT INTO `logs` set `user`="'.$user['part'].'", `text`="'.sys::updtext(sys::text('logs', 'part'), + array('part' => $uid, 'money' => $sum)).'", `date`="'.$start_point.'", `type`="part", `money`="'.$sum.'"'); - return NULL; - } + return NULL; + } - public static function map($map, $aMaps) - { - if(!is_array($aMaps)) - $aMaps = explode("\n", str_ireplace(array('./', '.bsp'), '', $aMaps)); + public static function map($map, $aMaps) + { + if(!is_array($aMaps)) + $aMaps = explode("\n", str_ireplace(array('./', '.bsp'), '', $aMaps)); - if(in_array($map, $aMaps)) - return false; + if(in_array($map, $aMaps)) + return false; - return true; - } + return true; + } - public static function mapsql($arr = array()) - { - $sql = 'AND ('; + public static function mapsql($arr = array()) + { + $sql = 'AND ('; - foreach($arr as $map) - $sql .= ' `name` REGEXP FROM_BASE64(\''.base64_encode('^'.$map.'\_').'\') OR'; + foreach($arr as $map) + $sql .= ' `name` REGEXP FROM_BASE64(\''.base64_encode('^'.$map.'\_').'\') OR'; - return $sql == 'AND (' ? '' : substr($sql, 0, -3).')'; - } + return $sql == 'AND (' ? '' : substr($sql, 0, -3).')'; + } - public static function iptables_whois($mcache) - { - $address = isset($_POST['address']) ? trim($_POST['address']) : sys::outjs(array('info' => 'Не удалось получить информацию.'), $mcache); + public static function iptables_whois($mcache) + { + $address = isset($_POST['address']) ? trim($_POST['address']) : sys::outjs(array('info' => 'Не удалось получить информацию.'), $mcache); - if(sys::valid($address, 'ip')) - sys::outjs(array('e' => sys::text('servers', 'firewall')), $mcache); + if(sys::valid($address, 'ip')) + sys::outjs(array('e' => sys::text('servers', 'firewall')), $mcache); - include(LIB.'geo.php'); + include(LIB.'geo.php'); - $SxGeo = new SxGeo(DATA.'SxGeoCity.dat'); + $SxGeo = new SxGeo(DATA.'SxGeoCity.dat'); - $data = $SxGeo->getCityFull($address); + $data = $SxGeo->getCityFull($address); - $info = 'Информация об IP адресе:'; + $info = 'Информация об IP адресе:'; - if($data['country']['name_ru'] != '') - { - $info .= '

    Страна: '.$data['country']['name_ru']; + if($data['country']['name_ru'] != '') + { + $info .= '

    Страна: '.$data['country']['name_ru']; - if($data['city']['name_ru'] != '') - $info .= '

    Город: '.$data['city']['name_ru']; + if($data['city']['name_ru'] != '') + $info .= '

    Город: '.$data['city']['name_ru']; - $info .= '

    Подсеть: '.sys::whois($address); + $info .= '

    Подсеть: '.sys::whois($address); - }else - $info = 'Не удалось получить информацию.'; + }else + $info = 'Не удалось получить информацию.'; - sys::outjs(array('info' => $info), $mcache); - } + sys::outjs(array('info' => $info), $mcache); + } - public static function iptables($id, $action, $source, $dest, $unit, $snw = false, $ssh = false) - { - global $cfg, $sql, $start_point; + public static function iptables($id, $action, $source, $dest, $unit, $snw = false, $ssh = false) + { + global $cfg, $sql, $start_point; - if(!$ssh) - { - $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$unit.'" LIMIT 1'); - $unit = $sql->get(); + if(!$ssh) + { + $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$unit.'" LIMIT 1'); + $unit = $sql->get(); - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - if(!$ssh->auth($unit['passwd'], $unit['address'])) - return array('e' => sys::text('all', 'ssh')); - } + if(!$ssh->auth($unit['passwd'], $unit['address'])) + return array('e' => sys::text('all', 'ssh')); + } - switch($action) - { - case 'block': - if(sys::valid($source, 'ip')) - return array('e' => sys::text('servers', 'firewall')); + switch($action) + { + case 'block': + if(sys::valid($source, 'ip')) + return array('e' => sys::text('servers', 'firewall')); - // Если подсеть - if($snw) - { - $source = sys::whois($source); + // Если подсеть + if($snw) + { + $source = sys::whois($source); - if($source == 'не определена') - return array('e' => 'Не удалось определить подсеть для указанного адреса.'); - } + if($source == 'не определена') + return array('e' => 'Не удалось определить подсеть для указанного адреса.'); + } - $sql->query('SELECT `id` FROM `firewall` WHERE `sip`="'.$source.'" AND `server`="'.$id.'" LIMIT 1'); + $sql->query('SELECT `id` FROM `firewall` WHERE `sip`="'.$source.'" AND `server`="'.$id.'" LIMIT 1'); - // Если такое правило уже добавлено или указан адрес сайта (ПУ) - if($sql->num() || ($source == $cfg['ip'] || $source == $cfg['subnet'])) - return array('s' => 'ok'); + // Если такое правило уже добавлено или указан адрес сайта (ПУ) + if($sql->num() || ($source == $cfg['ip'] || $source == $cfg['subnet'])) + return array('s' => 'ok'); - $sql->query('INSERT INTO `firewall` set `sip`="'.$source.'", `dest`="'.$dest[0].':'.$dest[1].'", `server`="'.$id.'", `time`="'.$start_point.'"'); + $sql->query('INSERT INTO `firewall` set `sip`="'.$source.'", `dest`="'.$dest[0].':'.$dest[1].'", `server`="'.$id.'", `time`="'.$start_point.'"'); - $line = $sql->id(); + $line = $sql->id(); - $rule = 'iptables -I INPUT -s '.$source.' -p udp -d '.$dest[0].' --dport '.$dest[1].' -j DROP;'; + $rule = 'iptables -I INPUT -s '.$source.' -p udp -d '.$dest[0].' --dport '.$dest[1].' -j DROP;'; - $ssh->set($rule.' echo -e "#'.$line.';\n'.$rule.'" >> /root/'.$cfg['iptables']); + $ssh->set($rule.' echo -e "#'.$line.';\n'.$rule.'" >> /root/'.$cfg['iptables']); - return array('s' => 'ok'); + return array('s' => 'ok'); - case 'unblock': - if(!is_numeric($source) AND sys::valid($source, 'ip')) - return array('e' => sys::text('servers', 'firewall')); + case 'unblock': + if(!is_numeric($source) AND sys::valid($source, 'ip')) + return array('e' => sys::text('servers', 'firewall')); - if(is_numeric($source)) - { - $sql->query('SELECT `id`, `sip` FROM `firewall` WHERE `id`="'.$source.'" AND `server`="'.$id.'" LIMIT 1'); + if(is_numeric($source)) + { + $sql->query('SELECT `id`, `sip` FROM `firewall` WHERE `id`="'.$source.'" AND `server`="'.$id.'" LIMIT 1'); - // Если такое правило отсутствует - if(!$sql->num()) - return array('s' => 'ok'); - }else{ - $sql->query('SELECT `id`, `sip` FROM `firewall` WHERE `sip`="'.$source.'" AND `server`="'.$id.'" LIMIT 1'); + // Если такое правило отсутствует + if(!$sql->num()) + return array('s' => 'ok'); + }else{ + $sql->query('SELECT `id`, `sip` FROM `firewall` WHERE `sip`="'.$source.'" AND `server`="'.$id.'" LIMIT 1'); - // Если одиночный адрес не найден, проверить на блокировку подсети - if(!$sql->num()) - { - $source = sys::whois($source); + // Если одиночный адрес не найден, проверить на блокировку подсети + if(!$sql->num()) + { + $source = sys::whois($source); - $sql->query('SELECT `id` FROM `firewall` WHERE `sip`="'.$source.'" AND `server`="'.$id.'" LIMIT 1'); + $sql->query('SELECT `id` FROM `firewall` WHERE `sip`="'.$source.'" AND `server`="'.$id.'" LIMIT 1'); - if($sql->num()) - { - $firewall = $sql->get(); + if($sql->num()) + { + $firewall = $sql->get(); - return array('i' => 'Указанный адрес входит в заблокированную подсеть, разблокировать подсеть?', 'id' => $firewall['id']); - } + return array('i' => 'Указанный адрес входит в заблокированную подсеть, разблокировать подсеть?', 'id' => $firewall['id']); + } - return array('s' => 'ok'); - } - } + return array('s' => 'ok'); + } + } - $firewall = $sql->get(); + $firewall = $sql->get(); - $ssh->set('iptables -D INPUT -s '.$firewall['sip'].' -p udp -d '.$dest[0].' --dport '.$dest[1].' -j DROP;' - .'sed "`nl '.$cfg['iptables'].' | grep \"#'.$firewall['id'].'\" | awk \'{print $1","$1+1}\'`d" '.$cfg['iptables'].' > '.$cfg['iptables'].'_temp; cat '.$cfg['iptables'].'_temp > '.$cfg['iptables'].'; rm '.$cfg['iptables'].'_temp'); + $ssh->set('iptables -D INPUT -s '.$firewall['sip'].' -p udp -d '.$dest[0].' --dport '.$dest[1].' -j DROP;' + .'sed "`nl '.$cfg['iptables'].' | grep \"#'.$firewall['id'].'\" | awk \'{print $1","$1+1}\'`d" '.$cfg['iptables'].' > '.$cfg['iptables'].'_temp; cat '.$cfg['iptables'].'_temp > '.$cfg['iptables'].'; rm '.$cfg['iptables'].'_temp'); - $sql->query('DELETE FROM `firewall` WHERE `id`="'.$firewall['id'].'" LIMIT 1'); + $sql->query('DELETE FROM `firewall` WHERE `id`="'.$firewall['id'].'" LIMIT 1'); - return array('s' => 'ok'); + return array('s' => 'ok'); - case 'remove': - $sql->query('SELECT `id`, `sip`, `dest` FROM `firewall` WHERE `server`="'.$id.'"'); + case 'remove': + $sql->query('SELECT `id`, `sip`, `dest` FROM `firewall` WHERE `server`="'.$id.'"'); - $aRule = array(); + $aRule = array(); - while($firewall = $sql->get()) - { - list($ip, $port) = explode(':', $firewall['dest']); + while($firewall = $sql->get()) + { + list($ip, $port) = explode(':', $firewall['dest']); - $aRule[$firewall['id']] = 'iptables -D INPUT -s '.$firewall['sip'].' -p udp -d '.$ip.' --dport '.$port.' -j DROP;'; - } + $aRule[$firewall['id']] = 'iptables -D INPUT -s '.$firewall['sip'].' -p udp -d '.$ip.' --dport '.$port.' -j DROP;'; + } - $nRule = count($aRule); + $nRule = count($aRule); - if(!$nRule) - return NULL; + if(!$nRule) + return NULL; - $cmd = ''; + $cmd = ''; - foreach($aRule as $line => $rule) - $cmd .= $rule.'sed "`nl '.$cfg['iptables'].' | grep "#'.$line.'" | awk \'{print $1","$1+1}\'`d" '.$cfg['iptables'].' > '.$cfg['iptables'].'_temp; cat '.$cfg['iptables'].'_temp > '.$cfg['iptables'].'; rm '.$cfg['iptables'].'_temp'; + foreach($aRule as $line => $rule) + $cmd .= $rule.'sed "`nl '.$cfg['iptables'].' | grep "#'.$line.'" | awk \'{print $1","$1+1}\'`d" '.$cfg['iptables'].' > '.$cfg['iptables'].'_temp; cat '.$cfg['iptables'].'_temp > '.$cfg['iptables'].'; rm '.$cfg['iptables'].'_temp'; - $ssh->set($cmd); + $ssh->set($cmd); - $sql->query('DELETE FROM `firewall` WHERE `server`="'.$id.'" LIMIT '.$nRule); + $sql->query('DELETE FROM `firewall` WHERE `server`="'.$id.'" LIMIT '.$nRule); - return array('s' => 'ok'); - } - } - } + return array('s' => 'ok'); + } + } + } ?> \ No newline at end of file diff --git a/system/library/games/graph.php b/system/library/games/graph.php index 493141a..f76e70e 100644 --- a/system/library/games/graph.php +++ b/system/library/games/graph.php @@ -1,404 +1,404 @@ addPoints($aOnline, 'ONLINE'); - - // CPU - $MyData->addPoints($aCPU, 'CPU'); - - // RAM - $MyData->addPoints($aRAM, 'RAM'); - - // HDD - $MyData->addPoints($aHDD, 'HDD'); - - // Время - $MyData->addPoints($aData['time'], 'TIME'); - - $MyData->setSerieOnAxis('CPU', 1); - $MyData->setSerieOnAxis('RAM', 1); - $MyData->setSerieOnAxis('HDD', 1); - $MyData->setAxisPosition(1, AXIS_POSITION_RIGHT); - - $MyData->setAxisName(0, 'Онлайн'); - $MyData->setAxisName(1, 'Нагрузка %'); - - $MyData->setAbscissa('TIME'); - - // Сечение линии - $MyData->setSerieTicks('ONLINE', 4); - - // Цвет линий - $MyData->setPalette('ONLINE', array('R' => 68, 'G' => 148, 'B' => 224)); - $MyData->setPalette('CPU', array('R' => 216, 'G' => 65, 'B' => 65)); - $MyData->setPalette('RAM', array('R' => 26, 'G' => 150, 'B' => 38)); - $MyData->setPalette('HDD', array('R' => 205, 'G' => 196, 'B' => 37)); - - $myPicture = new pImage(896, 220, $MyData); - - $myPicture->drawFilledRectangle(0, 0, 896, 220, array('R' => 255, 'G' => 255, 'B' => 255)); - - $myPicture->drawRectangle(0, 0, 895, 219, array('R' => 221, 'G' => 221, 'B' => 221)); - - $myPicture->setFontProperties(array('R' => 25, 'G' => 25, 'B' => 25, 'FontName' => LIB.'games/graph/fonts/tahoma.ttf', 'FontSize' => 8)); - $myPicture->setGraphArea(40, 20, 616, 190); - $myPicture->drawFilledRectangle(40, 20, 616, 190, array('R' => 240, 'G' => 242, 'B' => 242, 'Alpha' => 100)); - $myPicture->drawScale(array('XMargin' => 5, 'YMargin' => 5, 'GridR' => 76, 'GridG' => 109, 'GridB' => 120, 'LabelSkip' => 0, 'DrawSubTicks' => TRUE, 'Mode' => SCALE_MODE_MANUAL, 'Factors' => array(0 => array($slots), 1 => array(25, 50, 75, 100)), 'ManualScale' => array(0 => array('Min' => 0, 'Max' => $slots), 1 => array('Min' => 0, 'Max' => 100)))); - - $myPicture->drawText(676, 34, 'Средний онлайн: '.graph::average($aOnline), array('R' => 25, 'G' => 25, 'B' => 25, 'FontName' => LIB.'games/graph/fonts/arianamu.ttf', 'FontSize' => 10, 'Align' => TEXT_ALIGN_BOTTOMLEFT)); - $myPicture->drawText(676, 54, 'Средняя нагрузка (CPU): '.graph::average($aCPU).'%', array('R' => 25, 'G' => 25, 'B' => 25, 'FontName' => LIB.'games/graph/fonts/arianamu.ttf', 'FontSize' => 10, 'Align' => TEXT_ALIGN_BOTTOMLEFT)); - $myPicture->drawText(676, 74, 'Средняя нагрузка (RAM): '.graph::average($aRAM).'%', array('R' => 25, 'G' => 25, 'B' => 25, 'FontName' => LIB.'games/graph/fonts/arianamu.ttf', 'FontSize' => 10, 'Align' => TEXT_ALIGN_BOTTOMLEFT)); - $myPicture->drawText(676, 94, 'Средняя нагрузка (HDD): '.graph::average($aHDD).'%', array('R' => 25, 'G' => 25, 'B' => 25, 'FontName' => LIB.'games/graph/fonts/arianamu.ttf', 'FontSize' => 10, 'Align' => TEXT_ALIGN_BOTTOMLEFT)); - - $myPicture->drawText(676, 129, 'Максимальный онлайн: '.max($aOnline), array('R' => 25, 'G' => 25, 'B' => 25, 'FontName' => LIB.'games/graph/fonts/arianamu.ttf', 'FontSize' => 10, 'Align' => TEXT_ALIGN_BOTTOMLEFT)); - $myPicture->drawText(676, 153, 'Максимальная нагрузка (CPU): '.max($aCPU).'%', array('R' => 25, 'G' => 25, 'B' => 25, 'FontName' => LIB.'games/graph/fonts/arianamu.ttf', 'FontSize' => 10, 'Align' => TEXT_ALIGN_BOTTOMLEFT)); - $myPicture->drawText(676, 173, 'Максимальная нагрузка (RAM): '.max($aRAM).'%', array('R' => 25, 'G' => 25, 'B' => 25, 'FontName' => LIB.'games/graph/fonts/arianamu.ttf', 'FontSize' => 10, 'Align' => TEXT_ALIGN_BOTTOMLEFT)); - $myPicture->drawText(676, 193, 'Максимальная нагрузка (HDD): '.max($aHDD).'%', array('R' => 25, 'G' => 25, 'B' => 25, 'FontName' => LIB.'games/graph/fonts/arianamu.ttf', 'FontSize' => 10, 'Align' => TEXT_ALIGN_BOTTOMLEFT)); - - $myPicture->setFontProperties(array('FontName'=> LIB.'games/graph/fonts/tahoma.ttf', 'FontSize' => 7)); - $myPicture->drawSplineChart(); - $myPicture->setShadow(FALSE); - - $myPicture->drawLegend(466, 10, array('Style' => LEGEND_NOBORDER, 'Mode' => LEGEND_HORIZONTAL)); - - $myPicture->render(TEMP.(md5($key.'full_'.$time)).'.png'); - - unset($MyData, $myPicture); - - return NULL; - } - - public static function first($server, $aPoints, $aStyle, $style, $key) + public static function full($server, $slots, $key, $time) { - global $cfg, $aGname; + // Массивы данных + $aData = graph::graph_data($time, $server, $slots); - $MyData = new pData(); + $aOnline = $aData['online']; - // Значения - $MyData->addPoints($aPoints, 'ONLINE'); + $aCPU = $aData['cpu']; + $aRAM = $aData['ram']; + $aHDD = $aData['hdd']; - $MyData->addPoints(array(VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID), 'NONE'); - $MyData->setAbscissa('NONE'); + $MyData = new pData(); - // Цвет линии - $MyData->setPalette('ONLINE', $aStyle[$style]['line']); + // Онлайн + $MyData->addPoints($aOnline, 'ONLINE'); - // Размер баннера - $myPicture = new pImage(160, 248, $MyData); + // CPU + $MyData->addPoints($aCPU, 'CPU'); - // Цвет фона - $myPicture->drawFilledRectangle(0, 0, 160, 248, $aStyle[$style]['fon']); + // RAM + $MyData->addPoints($aRAM, 'RAM'); - // Обводка - $myPicture->drawRectangle(0, 0, 159, 247, $aStyle[$style]['border']); + // HDD + $MyData->addPoints($aHDD, 'HDD'); - // Шрифт текста - $myPicture->setFontProperties(array_merge($aStyle[$style]['color'], array('FontName' => LIB.'games/graph/fonts/tahoma.ttf', 'FontSize' => 5))); + // Время + $MyData->addPoints($aData['time'], 'TIME'); - // Размер графика - $myPicture->setGraphArea(35, 160, 150, 210); + $MyData->setSerieOnAxis('CPU', 1); + $MyData->setSerieOnAxis('RAM', 1); + $MyData->setSerieOnAxis('HDD', 1); + $MyData->setAxisPosition(1, AXIS_POSITION_RIGHT); - // Цвет фона графика - $myPicture->drawFilledRectangle(35, 160, 150, 210, $aStyle[$style]['graph']); + $MyData->setAxisName(0, 'Онлайн'); + $MyData->setAxisName(1, 'Нагрузка %'); - // График - $myPicture->drawScale(array('XMargin' => 5, 'YMargin' => 5, 'CycleBackground' => TRUE, 'LabelSkip' => 0, 'DrawSubTicks' => TRUE, 'Mode' => SCALE_MODE_MANUAL, 'Factors' => array(0 => array($server['slots_start'])), 'ManualScale' => array(0 => array('Min' => 0, 'Max' => $server['slots_start'])))); + $MyData->setAbscissa('TIME'); - // Название игрового сервера - $myPicture->drawFilledRectangle(0, 0, 18, 248, $aStyle[$style]['leftbox']); - $myPicture->drawText(14, 245, $server['name'], array_merge($aStyle[$style]['boxcolor'], array('Angle' => 90, 'FontName' => LIB.'games/graph/fonts/tahoma.ttf', 'FontSize' => 10))); - $myPicture->drawFilledRectangle(0, 0, 18, 5, $aStyle[$style]['leftbox']); + // Сечение линии + $MyData->setSerieTicks('ONLINE', 4); - // Адрес игрового сервера - $myPicture->drawFilledRectangle(25, 5, 153, 18, $aStyle[$style]['box']); - $myPicture->drawText(28, 17, 'Адрес сервера', array_merge($aStyle[$style]['boxcolor'], array('FontName' => LIB.'games/graph/fonts/tahoma.ttf', 'FontSize' => 8))); - $myPicture->drawText(26, 30, $server['address'], array_merge($aStyle[$style]['color'], array('FontName' => LIB.'games/graph/fonts/tahoma.ttf', 'FontSize' => 8))); + // Цвет линий + $MyData->setPalette('ONLINE', array('R' => 68, 'G' => 148, 'B' => 224)); + $MyData->setPalette('CPU', array('R' => 216, 'G' => 65, 'B' => 65)); + $MyData->setPalette('RAM', array('R' => 26, 'G' => 150, 'B' => 38)); + $MyData->setPalette('HDD', array('R' => 205, 'G' => 196, 'B' => 37)); - // Статус игрового сервера - $myPicture->drawFilledRectangle(25, 35, 153, 48, $aStyle[$style]['box']); - $myPicture->drawText(28, 47, 'Состояние сервера', array_merge($aStyle[$style]['boxcolor'], array('FontName' => LIB.'games/graph/fonts/tahoma.ttf', 'FontSize' => 8))); - $myPicture->drawText(26, 62, graph::status($server['status'], $server['map']), array_merge($aStyle[$style]['color'], array('FontName' => LIB.'games/graph/fonts/tahoma.ttf', 'FontSize' => 8))); + $myPicture = new pImage(896, 220, $MyData); - // Игроки на игровом сервере - $myPicture->drawFilledRectangle(25, 65, 153, 78, $aStyle[$style]['box']); - $myPicture->drawText(28, 77, 'Игроки на сервере', array_merge($aStyle[$style]['boxcolor'], array('FontName' => LIB.'games/graph/fonts/tahoma.ttf', 'FontSize' => 8))); - $myPicture->drawText(26, 92, $server['online'].' / '.$server['slots_start'], array_merge($aStyle[$style]['color'], array('FontName' => LIB.'games/graph/fonts/tahoma.ttf', 'FontSize' => 8))); + $myPicture->drawFilledRectangle(0, 0, 896, 220, array('R' => 255, 'G' => 255, 'B' => 255)); - // Полоска загрузки - $myPicture->drawProgress(83, 82, ceil($server['slots_start']/100*$server['online']), array_merge($aStyle[$style]['progress'], array('Width' => 70, 'Height' => 8))); + $myPicture->drawRectangle(0, 0, 895, 219, array('R' => 221, 'G' => 221, 'B' => 221)); - // Тип игрового сервера - $myPicture->drawFilledRectangle(25, 95, 153, 108, $aStyle[$style]['box']); - $myPicture->drawText(28, 107, 'Тип сервера', array_merge($aStyle[$style]['boxcolor'], array('FontName' => LIB.'games/graph/fonts/tahoma.ttf', 'FontSize' => 8))); - $myPicture->drawText(26, 122, $aGname[$server['game']], array_merge($aStyle[$style]['color'], array('FontName' => LIB.'games/graph/fonts/tahoma.ttf', 'FontSize' => 8))); + $myPicture->setFontProperties(array('R' => 25, 'G' => 25, 'B' => 25, 'FontName' => LIB.'games/graph/fonts/tahoma.ttf', 'FontSize' => 8)); + $myPicture->setGraphArea(40, 20, 616, 190); + $myPicture->drawFilledRectangle(40, 20, 616, 190, array('R' => 240, 'G' => 242, 'B' => 242, 'Alpha' => 100)); + $myPicture->drawScale(array('XMargin' => 5, 'YMargin' => 5, 'GridR' => 76, 'GridG' => 109, 'GridB' => 120, 'LabelSkip' => 0, 'DrawSubTicks' => TRUE, 'Mode' => SCALE_MODE_MANUAL, 'Factors' => array(0 => array($slots), 1 => array(25, 50, 75, 100)), 'ManualScale' => array(0 => array('Min' => 0, 'Max' => $slots), 1 => array('Min' => 0, 'Max' => 100)))); - // Хостинг игровых серверов - $myPicture->drawText(89, 230, $cfg['graph'], array_merge($aStyle[$style]['color'], array('FontSize' => 10, 'Align' => TEXT_ALIGN_BOTTOMMIDDLE))); - $myPicture->drawText(89, 245, 'Хостинг игровых серверов', array_merge($aStyle[$style]['color'], array('FontSize' => 8, 'Align' => TEXT_ALIGN_BOTTOMMIDDLE))); + $myPicture->drawText(676, 34, 'Средний онлайн: '.graph::average($aOnline), array('R' => 25, 'G' => 25, 'B' => 25, 'FontName' => LIB.'games/graph/fonts/arianamu.ttf', 'FontSize' => 10, 'Align' => TEXT_ALIGN_BOTTOMLEFT)); + $myPicture->drawText(676, 54, 'Средняя нагрузка (CPU): '.graph::average($aCPU).'%', array('R' => 25, 'G' => 25, 'B' => 25, 'FontName' => LIB.'games/graph/fonts/arianamu.ttf', 'FontSize' => 10, 'Align' => TEXT_ALIGN_BOTTOMLEFT)); + $myPicture->drawText(676, 74, 'Средняя нагрузка (RAM): '.graph::average($aRAM).'%', array('R' => 25, 'G' => 25, 'B' => 25, 'FontName' => LIB.'games/graph/fonts/arianamu.ttf', 'FontSize' => 10, 'Align' => TEXT_ALIGN_BOTTOMLEFT)); + $myPicture->drawText(676, 94, 'Средняя нагрузка (HDD): '.graph::average($aHDD).'%', array('R' => 25, 'G' => 25, 'B' => 25, 'FontName' => LIB.'games/graph/fonts/arianamu.ttf', 'FontSize' => 10, 'Align' => TEXT_ALIGN_BOTTOMLEFT)); - $myPicture->drawSplineChart(); + $myPicture->drawText(676, 129, 'Максимальный онлайн: '.max($aOnline), array('R' => 25, 'G' => 25, 'B' => 25, 'FontName' => LIB.'games/graph/fonts/arianamu.ttf', 'FontSize' => 10, 'Align' => TEXT_ALIGN_BOTTOMLEFT)); + $myPicture->drawText(676, 153, 'Максимальная нагрузка (CPU): '.max($aCPU).'%', array('R' => 25, 'G' => 25, 'B' => 25, 'FontName' => LIB.'games/graph/fonts/arianamu.ttf', 'FontSize' => 10, 'Align' => TEXT_ALIGN_BOTTOMLEFT)); + $myPicture->drawText(676, 173, 'Максимальная нагрузка (RAM): '.max($aRAM).'%', array('R' => 25, 'G' => 25, 'B' => 25, 'FontName' => LIB.'games/graph/fonts/arianamu.ttf', 'FontSize' => 10, 'Align' => TEXT_ALIGN_BOTTOMLEFT)); + $myPicture->drawText(676, 193, 'Максимальная нагрузка (HDD): '.max($aHDD).'%', array('R' => 25, 'G' => 25, 'B' => 25, 'FontName' => LIB.'games/graph/fonts/arianamu.ttf', 'FontSize' => 10, 'Align' => TEXT_ALIGN_BOTTOMLEFT)); - $myPicture->render(TEMP.(md5($key.$style.'first')).'.png'); + $myPicture->setFontProperties(array('FontName'=> LIB.'games/graph/fonts/tahoma.ttf', 'FontSize' => 7)); + $myPicture->drawSplineChart(); + $myPicture->setShadow(FALSE); - unset($MyData, $myPicture); + $myPicture->drawLegend(466, 10, array('Style' => LEGEND_NOBORDER, 'Mode' => LEGEND_HORIZONTAL)); - return NULL; + $myPicture->render(TEMP.(md5($key.'full_'.$time)).'.png'); + + unset($MyData, $myPicture); + + return NULL; } - public static function second($server, $aPoints, $aStyle, $style, $key) - { - global $cfg, $aGname; + public static function first($server, $aPoints, $aStyle, $style, $key) + { + global $cfg, $aGname; - $MyData = new pData(); + $MyData = new pData(); - // Значения - $MyData->addPoints($aPoints, 'ONLINE'); + // Значения + $MyData->addPoints($aPoints, 'ONLINE'); - $MyData->addPoints(array(VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID), 'NONE'); - $MyData->setAbscissa('NONE'); + $MyData->addPoints(array(VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID), 'NONE'); + $MyData->setAbscissa('NONE'); - // Цвет линии - $MyData->setPalette('ONLINE', $aStyle[$style]['line']); + // Цвет линии + $MyData->setPalette('ONLINE', $aStyle[$style]['line']); - // Размер баннера - $myPicture = new pImage(560, 95, $MyData); + // Размер баннера + $myPicture = new pImage(160, 248, $MyData); - // Цвет фона - $myPicture->drawFilledRectangle(0, 0, 560, 95, $aStyle[$style]['fon']); + // Цвет фона + $myPicture->drawFilledRectangle(0, 0, 160, 248, $aStyle[$style]['fon']); - // Название игрового сервера - $myPicture->drawFilledRectangle(5, 5, 410, 18, $aStyle[$style]['box']); - $myPicture->drawText(8, 17, 'Название сервера', array_merge($aStyle[$style]['boxcolor'], array('FontName' => LIB.'games/graph/fonts/tahoma.ttf', 'FontSize' => 8))); - $myPicture->drawText(6, 31, $server['name'], array_merge($aStyle[$style]['color'], array('FontName' => LIB.'games/graph/fonts/tahoma.ttf', 'FontSize' => 8))); + // Обводка + $myPicture->drawRectangle(0, 0, 159, 247, $aStyle[$style]['border']); - // Костыль для "обрезания" названия сервера - $myPicture->drawFilledRectangle(405, 19, 560, 35, $aStyle[$style]['fon']); + // Шрифт текста + $myPicture->setFontProperties(array_merge($aStyle[$style]['color'], array('FontName' => LIB.'games/graph/fonts/tahoma.ttf', 'FontSize' => 5))); - // Обводка - $myPicture->drawRectangle(0, 0, 559, 94, $aStyle[$style]['border']); + // Размер графика + $myPicture->setGraphArea(35, 160, 150, 210); - // Шрифт текста - $myPicture->setFontProperties(array_merge($aStyle[$style]['color'], array('FontName' => LIB.'games/graph/fonts/tahoma.ttf', 'FontSize' => 5))); + // Цвет фона графика + $myPicture->drawFilledRectangle(35, 160, 150, 210, $aStyle[$style]['graph']); - // Размер графика - $myPicture->setGraphArea(430, 5, 554, 60); + // График + $myPicture->drawScale(array('XMargin' => 5, 'YMargin' => 5, 'CycleBackground' => TRUE, 'LabelSkip' => 0, 'DrawSubTicks' => TRUE, 'Mode' => SCALE_MODE_MANUAL, 'Factors' => array(0 => array($server['slots_start'])), 'ManualScale' => array(0 => array('Min' => 0, 'Max' => $server['slots_start'])))); - // Цвет фона графика - $myPicture->drawFilledRectangle(430, 5, 554, 60, $aStyle[$style]['graph']); + // Название игрового сервера + $myPicture->drawFilledRectangle(0, 0, 18, 248, $aStyle[$style]['leftbox']); + $myPicture->drawText(14, 245, $server['name'], array_merge($aStyle[$style]['boxcolor'], array('Angle' => 90, 'FontName' => LIB.'games/graph/fonts/tahoma.ttf', 'FontSize' => 10))); + $myPicture->drawFilledRectangle(0, 0, 18, 5, $aStyle[$style]['leftbox']); - // График - $myPicture->drawScale(array('XMargin' => 5, 'YMargin' => 5, 'CycleBackground' => TRUE, 'LabelSkip' => 0, 'DrawSubTicks' => TRUE, 'Mode' => SCALE_MODE_MANUAL, 'Factors' => array(0 => array($server['slots_start'])), 'ManualScale' => array(0 => array('Min' => 0, 'Max' => $server['slots_start'])))); + // Адрес игрового сервера + $myPicture->drawFilledRectangle(25, 5, 153, 18, $aStyle[$style]['box']); + $myPicture->drawText(28, 17, 'Адрес сервера', array_merge($aStyle[$style]['boxcolor'], array('FontName' => LIB.'games/graph/fonts/tahoma.ttf', 'FontSize' => 8))); + $myPicture->drawText(26, 30, $server['address'], array_merge($aStyle[$style]['color'], array('FontName' => LIB.'games/graph/fonts/tahoma.ttf', 'FontSize' => 8))); - // Адрес игрового сервера - $myPicture->drawFilledRectangle(5, 36, 210, 49, $aStyle[$style]['box']); - $myPicture->drawText(8, 48, 'Адрес сервера', array_merge($aStyle[$style]['boxcolor'], array('FontName' => LIB.'games/graph/fonts/tahoma.ttf', 'FontSize' => 8))); - $myPicture->drawText(6, 62, $server['address'], array_merge($aStyle[$style]['color'], array('FontName' => LIB.'games/graph/fonts/tahoma.ttf', 'FontSize' => 8))); + // Статус игрового сервера + $myPicture->drawFilledRectangle(25, 35, 153, 48, $aStyle[$style]['box']); + $myPicture->drawText(28, 47, 'Состояние сервера', array_merge($aStyle[$style]['boxcolor'], array('FontName' => LIB.'games/graph/fonts/tahoma.ttf', 'FontSize' => 8))); + $myPicture->drawText(26, 62, graph::status($server['status'], $server['map']), array_merge($aStyle[$style]['color'], array('FontName' => LIB.'games/graph/fonts/tahoma.ttf', 'FontSize' => 8))); - // Статус игрового сервера - $myPicture->drawFilledRectangle(215, 36, 410, 49, $aStyle[$style]['box']); - $myPicture->drawText(218, 48, 'Состояние сервера', array_merge($aStyle[$style]['boxcolor'], array('FontName' => LIB.'games/graph/fonts/tahoma.ttf', 'FontSize' => 8))); - $myPicture->drawText(216, 62, graph::status($server['status'], $server['map']), array_merge($aStyle[$style]['color'], array('FontName' => LIB.'games/graph/fonts/tahoma.ttf', 'FontSize' => 8))); + // Игроки на игровом сервере + $myPicture->drawFilledRectangle(25, 65, 153, 78, $aStyle[$style]['box']); + $myPicture->drawText(28, 77, 'Игроки на сервере', array_merge($aStyle[$style]['boxcolor'], array('FontName' => LIB.'games/graph/fonts/tahoma.ttf', 'FontSize' => 8))); + $myPicture->drawText(26, 92, $server['online'].' / '.$server['slots_start'], array_merge($aStyle[$style]['color'], array('FontName' => LIB.'games/graph/fonts/tahoma.ttf', 'FontSize' => 8))); - // Игроки на игровом сервере - $myPicture->drawFilledRectangle(5, 67, 210, 80, $aStyle[$style]['box']); - $myPicture->drawText(8, 79, 'Игроки на сервере', array_merge($aStyle[$style]['boxcolor'], array('FontName' => LIB.'games/graph/fonts/tahoma.ttf', 'FontSize' => 8))); - $myPicture->drawText(6, 93, $server['online'].' / '.$server['slots_start'], array_merge($aStyle[$style]['color'], array('FontName' => LIB.'games/graph/fonts/tahoma.ttf', 'FontSize' => 8))); + // Полоска загрузки + $myPicture->drawProgress(83, 82, ceil($server['slots_start']/100*$server['online']), array_merge($aStyle[$style]['progress'], array('Width' => 70, 'Height' => 8))); - // Полоска загрузки - $myPicture->drawProgress(90, 83, ceil($server['slots_start']/100*$server['online']), array_merge($aStyle[$style]['progress'], array('Width' => 120, 'Height' => 8))); + // Тип игрового сервера + $myPicture->drawFilledRectangle(25, 95, 153, 108, $aStyle[$style]['box']); + $myPicture->drawText(28, 107, 'Тип сервера', array_merge($aStyle[$style]['boxcolor'], array('FontName' => LIB.'games/graph/fonts/tahoma.ttf', 'FontSize' => 8))); + $myPicture->drawText(26, 122, $aGname[$server['game']], array_merge($aStyle[$style]['color'], array('FontName' => LIB.'games/graph/fonts/tahoma.ttf', 'FontSize' => 8))); - // Тип игрового сервера - $myPicture->drawFilledRectangle(215, 67, 410, 80, $aStyle[$style]['box']); - $myPicture->drawText(218, 79, 'Тип сервера', array_merge($aStyle[$style]['boxcolor'], array('FontName' => LIB.'games/graph/fonts/tahoma.ttf', 'FontSize' => 8))); - $myPicture->drawText(216, 91, $aGname[$server['game']], array_merge($aStyle[$style]['color'], array('FontName' => LIB.'games/graph/fonts/tahoma.ttf', 'FontSize' => 8))); + // Хостинг игровых серверов + $myPicture->drawText(89, 230, $cfg['graph'], array_merge($aStyle[$style]['color'], array('FontSize' => 10, 'Align' => TEXT_ALIGN_BOTTOMMIDDLE))); + $myPicture->drawText(89, 245, 'Хостинг игровых серверов', array_merge($aStyle[$style]['color'], array('FontSize' => 8, 'Align' => TEXT_ALIGN_BOTTOMMIDDLE))); - // Хостинг игровых серверов - $myPicture->drawText(490, 77, $cfg['graph'], array('FontSize' => 10, 'Align' => TEXT_ALIGN_BOTTOMMIDDLE)); - $myPicture->drawText(490, 90, 'Хостинг игровых серверов', array('FontSize' => 8, 'Align' => TEXT_ALIGN_BOTTOMMIDDLE)); + $myPicture->drawSplineChart(); - $myPicture->drawSplineChart(); + $myPicture->render(TEMP.(md5($key.$style.'first')).'.png'); - $myPicture->render(TEMP.(md5($key.$style.'second')).'.png'); + unset($MyData, $myPicture); - unset($MyData, $myPicture); + return NULL; + } - return NULL; - } + public static function second($server, $aPoints, $aStyle, $style, $key) + { + global $cfg, $aGname; - public static function online_day($server, $max) - { - global $sql, $start_point; + $MyData = new pData(); - $time = $start_point-86400; + // Значения + $MyData->addPoints($aPoints, 'ONLINE'); - $aOnline = array(); + $MyData->addPoints(array(VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID, VOID), 'NONE'); + $MyData->setAbscissa('NONE'); - $aSel = array(); + // Цвет линии + $MyData->setPalette('ONLINE', $aStyle[$style]['line']); - $sql->query('SELECT `online` FROM `graph_hour` WHERE `server`="'.$server.'" AND `time`>"'.$time.'" ORDER BY `id` DESC LIMIT 24'); - while($value = $sql->get()) - $aSel[] = $value['online']; + // Размер баннера + $myPicture = new pImage(560, 95, $MyData); - $n = count($aSel); + // Цвет фона + $myPicture->drawFilledRectangle(0, 0, 560, 95, $aStyle[$style]['fon']); - $n = $n > 1 ? $n-1 : 0; + // Название игрового сервера + $myPicture->drawFilledRectangle(5, 5, 410, 18, $aStyle[$style]['box']); + $myPicture->drawText(8, 17, 'Название сервера', array_merge($aStyle[$style]['boxcolor'], array('FontName' => LIB.'games/graph/fonts/tahoma.ttf', 'FontSize' => 8))); + $myPicture->drawText(6, 31, $server['name'], array_merge($aStyle[$style]['color'], array('FontName' => LIB.'games/graph/fonts/tahoma.ttf', 'FontSize' => 8))); - if($n) - { - for($i = $n; $i >= 0; $i-=1) - $aOnline[] = $aSel[$i] > $max ? $max : $aSel[$i]; - } + // Костыль для "обрезания" названия сервера + $myPicture->drawFilledRectangle(405, 19, 560, 35, $aStyle[$style]['fon']); - $add = count($aOnline); + // Обводка + $myPicture->drawRectangle(0, 0, 559, 94, $aStyle[$style]['border']); - if($add < 24) - { - for($i = $n; $i <= 23; $i+=1) - $aOnline[] = 0; - } + // Шрифт текста + $myPicture->setFontProperties(array_merge($aStyle[$style]['color'], array('FontName' => LIB.'games/graph/fonts/tahoma.ttf', 'FontSize' => 5))); - return $aOnline; - } + // Размер графика + $myPicture->setGraphArea(430, 5, 554, 60); - private static function graph_data($period, $server, $max) - { - global $sql, $start_point; + // Цвет фона графика + $myPicture->drawFilledRectangle(430, 5, 554, 60, $aStyle[$style]['graph']); - $aData = array( - 'limit' => array( - 'day' => 24, - 'week' => 7, - 'month' => 30 - ), + // График + $myPicture->drawScale(array('XMargin' => 5, 'YMargin' => 5, 'CycleBackground' => TRUE, 'LabelSkip' => 0, 'DrawSubTicks' => TRUE, 'Mode' => SCALE_MODE_MANUAL, 'Factors' => array(0 => array($server['slots_start'])), 'ManualScale' => array(0 => array('Min' => 0, 'Max' => $server['slots_start'])))); - 'for' => array( - 'day' => 23, - 'week' => 6, - 'month' => 29 - ), + // Адрес игрового сервера + $myPicture->drawFilledRectangle(5, 36, 210, 49, $aStyle[$style]['box']); + $myPicture->drawText(8, 48, 'Адрес сервера', array_merge($aStyle[$style]['boxcolor'], array('FontName' => LIB.'games/graph/fonts/tahoma.ttf', 'FontSize' => 8))); + $myPicture->drawText(6, 62, $server['address'], array_merge($aStyle[$style]['color'], array('FontName' => LIB.'games/graph/fonts/tahoma.ttf', 'FontSize' => 8))); - 'from' => array( - 'day' => 'graph_hour', - 'week' => 'graph_day', - 'month' => 'graph_day' - ), + // Статус игрового сервера + $myPicture->drawFilledRectangle(215, 36, 410, 49, $aStyle[$style]['box']); + $myPicture->drawText(218, 48, 'Состояние сервера', array_merge($aStyle[$style]['boxcolor'], array('FontName' => LIB.'games/graph/fonts/tahoma.ttf', 'FontSize' => 8))); + $myPicture->drawText(216, 62, graph::status($server['status'], $server['map']), array_merge($aStyle[$style]['color'], array('FontName' => LIB.'games/graph/fonts/tahoma.ttf', 'FontSize' => 8))); - 'time' => array( - 'day' => 86400, - 'week' => 604800, - 'month' => 2592000 - ) - ); + // Игроки на игровом сервере + $myPicture->drawFilledRectangle(5, 67, 210, 80, $aStyle[$style]['box']); + $myPicture->drawText(8, 79, 'Игроки на сервере', array_merge($aStyle[$style]['boxcolor'], array('FontName' => LIB.'games/graph/fonts/tahoma.ttf', 'FontSize' => 8))); + $myPicture->drawText(6, 93, $server['online'].' / '.$server['slots_start'], array_merge($aStyle[$style]['color'], array('FontName' => LIB.'games/graph/fonts/tahoma.ttf', 'FontSize' => 8))); - $time = $start_point-$aData['time'][$period]; + // Полоска загрузки + $myPicture->drawProgress(90, 83, ceil($server['slots_start']/100*$server['online']), array_merge($aStyle[$style]['progress'], array('Width' => 120, 'Height' => 8))); - $aOnline = array(); + // Тип игрового сервера + $myPicture->drawFilledRectangle(215, 67, 410, 80, $aStyle[$style]['box']); + $myPicture->drawText(218, 79, 'Тип сервера', array_merge($aStyle[$style]['boxcolor'], array('FontName' => LIB.'games/graph/fonts/tahoma.ttf', 'FontSize' => 8))); + $myPicture->drawText(216, 91, $aGname[$server['game']], array_merge($aStyle[$style]['color'], array('FontName' => LIB.'games/graph/fonts/tahoma.ttf', 'FontSize' => 8))); - $aCPU = array(); - $aRAM = array(); - $aHDD = array(); - $aTime = array(); + // Хостинг игровых серверов + $myPicture->drawText(490, 77, $cfg['graph'], array('FontSize' => 10, 'Align' => TEXT_ALIGN_BOTTOMMIDDLE)); + $myPicture->drawText(490, 90, 'Хостинг игровых серверов', array('FontSize' => 8, 'Align' => TEXT_ALIGN_BOTTOMMIDDLE)); - $aSel = array(); + $myPicture->drawSplineChart(); - $sql->query('SELECT `online`, `cpu`, `ram`, `hdd`, `time` FROM `'.$aData['from'][$period].'` WHERE `server`="'.$server.'" AND `time`>"'.$time.'" ORDER BY `id` DESC LIMIT '.$aData['limit'][$period]); - while($value = $sql->get()) - $aSel[] = array('online' => $value['online'], 'cpu' => $value['cpu'], 'ram' => $value['ram'], 'hdd' => $value['hdd'], 'time' => $value['time']); + $myPicture->render(TEMP.(md5($key.$style.'second')).'.png'); - $n = count($aSel); + unset($MyData, $myPicture); - $n = $n > 1 ? $n-1 : 0; + return NULL; + } - $next = true; + public static function online_day($server, $max) + { + global $sql, $start_point; - if(isset($aSel[$n]['online'])) - { - for($i = $n; $i >= 0; $i-=1) - { - $aOnline[] = $aSel[$i]['online'] > $max ? $max : $aSel[$i]['online']; + $time = $start_point-86400; - $aCPU[] = $aSel[$i]['cpu']; - $aRAM[] = $aSel[$i]['ram']; - $aHDD[] = $aSel[$i]['hdd']; + $aOnline = array(); - if($next) - { - $aTime[] = VOID; + $aSel = array(); - $next = false; - }else{ - $aTime[] = $period == 'day' ? date('H:i', $aSel[$i]['time']) : date('d.m', $aSel[$i]['time']); + $sql->query('SELECT `online` FROM `graph_hour` WHERE `server`="'.$server.'" AND `time`>"'.$time.'" ORDER BY `id` DESC LIMIT 24'); + while($value = $sql->get()) + $aSel[] = $value['online']; - $next = true; - } - } - } + $n = count($aSel); - $add = count($aOnline); + $n = $n > 1 ? $n-1 : 0; - for($i = $add; $i <= $aData['for'][$period]; $i+=1) - { - $aOnline[] = 0; + if($n) + { + for($i = $n; $i >= 0; $i-=1) + $aOnline[] = $aSel[$i] > $max ? $max : $aSel[$i]; + } - $aCPU[] = 0; - $aRAM[] = 0; - $aHDD[] = 0; + $add = count($aOnline); - $aTime[] = VOID; - } + if($add < 24) + { + for($i = $n; $i <= 23; $i+=1) + $aOnline[] = 0; + } - return array('online' => $aOnline, 'cpu' => $aCPU, 'ram' => $aRAM, 'hdd' => $aHDD, 'time' => $aTime); - } + return $aOnline; + } - private static function status($status, $map) - { - switch($status) - { - case 'working': - return 'Карта: '.$map; - case 'off': - return 'Статус: выключен'; - case 'start': - return 'Статус: запускается'; - case 'restart': - return 'Статус: перезапускается'; - case 'change': - return 'Статус: меняется карта'; - case 'install': - return 'Статус: устанавливается'; - case 'reinstall': - return 'Статус: переустанавливается'; - case 'update': - return 'Статус: обновляется'; - case 'recovery': - return 'Статус: восстанавливается'; - case 'overdue': - return 'Статус: просрочен'; - case 'blocked': - return 'Статус: заблокирован'; - } - } + private static function graph_data($period, $server, $max) + { + global $sql, $start_point; - private static function average($arr) - { - return !count($arr) ? 0 : ceil(array_sum($arr)/count($arr)); - } - } + $aData = array( + 'limit' => array( + 'day' => 24, + 'week' => 7, + 'month' => 30 + ), + + 'for' => array( + 'day' => 23, + 'week' => 6, + 'month' => 29 + ), + + 'from' => array( + 'day' => 'graph_hour', + 'week' => 'graph_day', + 'month' => 'graph_day' + ), + + 'time' => array( + 'day' => 86400, + 'week' => 604800, + 'month' => 2592000 + ) + ); + + $time = $start_point-$aData['time'][$period]; + + $aOnline = array(); + + $aCPU = array(); + $aRAM = array(); + $aHDD = array(); + $aTime = array(); + + $aSel = array(); + + $sql->query('SELECT `online`, `cpu`, `ram`, `hdd`, `time` FROM `'.$aData['from'][$period].'` WHERE `server`="'.$server.'" AND `time`>"'.$time.'" ORDER BY `id` DESC LIMIT '.$aData['limit'][$period]); + while($value = $sql->get()) + $aSel[] = array('online' => $value['online'], 'cpu' => $value['cpu'], 'ram' => $value['ram'], 'hdd' => $value['hdd'], 'time' => $value['time']); + + $n = count($aSel); + + $n = $n > 1 ? $n-1 : 0; + + $next = true; + + if(isset($aSel[$n]['online'])) + { + for($i = $n; $i >= 0; $i-=1) + { + $aOnline[] = $aSel[$i]['online'] > $max ? $max : $aSel[$i]['online']; + + $aCPU[] = $aSel[$i]['cpu']; + $aRAM[] = $aSel[$i]['ram']; + $aHDD[] = $aSel[$i]['hdd']; + + if($next) + { + $aTime[] = VOID; + + $next = false; + }else{ + $aTime[] = $period == 'day' ? date('H:i', $aSel[$i]['time']) : date('d.m', $aSel[$i]['time']); + + $next = true; + } + } + } + + $add = count($aOnline); + + for($i = $add; $i <= $aData['for'][$period]; $i+=1) + { + $aOnline[] = 0; + + $aCPU[] = 0; + $aRAM[] = 0; + $aHDD[] = 0; + + $aTime[] = VOID; + } + + return array('online' => $aOnline, 'cpu' => $aCPU, 'ram' => $aRAM, 'hdd' => $aHDD, 'time' => $aTime); + } + + private static function status($status, $map) + { + switch($status) + { + case 'working': + return 'Карта: '.$map; + case 'off': + return 'Статус: выключен'; + case 'start': + return 'Статус: запускается'; + case 'restart': + return 'Статус: перезапускается'; + case 'change': + return 'Статус: меняется карта'; + case 'install': + return 'Статус: устанавливается'; + case 'reinstall': + return 'Статус: переустанавливается'; + case 'update': + return 'Статус: обновляется'; + case 'recovery': + return 'Статус: восстанавливается'; + case 'overdue': + return 'Статус: просрочен'; + case 'blocked': + return 'Статус: заблокирован'; + } + } + + private static function average($arr) + { + return !count($arr) ? 0 : ceil(array_sum($arr)/count($arr)); + } + } ?> \ No newline at end of file diff --git a/system/library/games/graph/pData.php b/system/library/games/graph/pData.php index dc79cb9..7c46584 100644 --- a/system/library/games/graph/pData.php +++ b/system/library/games/graph/pData.php @@ -1,518 +1,518 @@ array('R'=>188,'G'=>224,'B'=>46,'Alpha'=>100), - '1'=>array('R'=>224,'G'=>100,'B'=>46,'Alpha'=>100), - '2'=>array('R'=>224,'G'=>214,'B'=>46,'Alpha'=>100), - '3'=>array('R'=>46,'G'=>151,'B'=>224,'Alpha'=>100), - '4'=>array('R'=>176,'G'=>46,'B'=>224,'Alpha'=>100), - '5'=>array('R'=>224,'G'=>46,'B'=>117,'Alpha'=>100), - '6'=>array('R'=>92,'G'=>224,'B'=>46,'Alpha'=>100), - '7'=>array('R'=>224,'G'=>176,'B'=>46,'Alpha'=>100)); - - function pData() - { - $this->Data = ''; - $this->Data['XAxisDisplay'] = AXIS_FORMAT_DEFAULT; - $this->Data['XAxisFormat'] = NULL; - $this->Data['XAxisName'] = NULL; - $this->Data['XAxisUnit'] = NULL; - $this->Data['Abscissa'] = NULL; - $this->Data['AbsicssaPosition'] = AXIS_POSITION_BOTTOM; - $this->Data['Axis'][0]['Display'] = AXIS_FORMAT_DEFAULT; - $this->Data['Axis'][0]['Position'] = AXIS_POSITION_LEFT; - $this->Data['Axis'][0]['Identity'] = AXIS_Y; - } - - function addPoints($Values, $SerieName = 'Serie1') - { - if(!isset($this->Data['Series'][$SerieName])) - $this->initialise($SerieName); - - if(is_array($Values)) - { - foreach($Values as $Key => $Value) - $this->Data['Series'][$SerieName]['Data'][] = $Value; - }else - $this->Data['Series'][$SerieName]['Data'][] = $Values; - - if($Values != VOID) - { - $StrippedData = $this->stripVOID($this->Data['Series'][$SerieName]['Data']); - - if(empty($StrippedData)) - { - $this->Data['Series'][$SerieName]['Max'] = 0; - $this->Data['Series'][$SerieName]['Min'] =0; - return(0); - } - - $this->Data['Series'][$SerieName]['Max'] = max($StrippedData); - $this->Data['Series'][$SerieName]['Min'] = min($StrippedData); - } - } - - function stripVOID($Values) - { - if(!is_array($Values)) - return(array()); - - $Result = array(); - - foreach($Values as $Key => $Value) - { - if($Value != VOID) - $Result[] = $Value; - } - - return($Result); - } - - function getSerieCount($Serie) - { - if(isset($this->Data['Series'][$Serie]['Data'])) - return(sizeof($this->Data['Series'][$Serie]['Data'])); - - return(0); - } - - function removeSerie($Series) - { - if(!is_array($Series)) - $Series = $this->convertToArray($Series); - - foreach($Series as $Key => $Serie) - { - if(isset($this->Data['Series'][$Serie])) - unset($this->Data['Series'][$Serie]); - } - } - - function getValueAt($Serie,$Index=0) - { - if(isset($this->Data['Series'][$Serie]['Data'][$Index])) - return($this->Data['Series'][$Serie]['Data'][$Index]); - - return(NULL); - } - - function getValues($Serie) - { - if(isset($this->Data['Series'][$Serie]['Data'])) - return($this->Data['Series'][$Serie]['Data']); - - return(NULL); - } - - function reverseSerie($Series) - { - if(!is_array($Series)) - $Series = $this->convertToArray($Series); - - foreach($Series as $Key => $Serie) - { - if(isset($this->Data['Series'][$Serie]['Data'])) - $this->Data['Series'][$Serie]['Data'] = array_reverse($this->Data['Series'][$Serie]['Data']); - } - } - - function getSum($Serie) - { - if(isset($this->Data['Series'][$Serie])) - return(array_sum($this->Data['Series'][$Serie]['Data'])); - - return(NULL); - } - - function getMax($Serie) - { - if(isset($this->Data['Series'][$Serie]['Max'])) - return($this->Data['Series'][$Serie]['Max']); - - return(NULL); - } - - function getMin($Serie) - { - if(isset($this->Data['Series'][$Serie]['Min'])) - return($this->Data['Series'][$Serie]['Min']); - - return(NULL); - } - - function setSerieShape($Series, $Shape = SERIE_SHAPE_FILLEDCIRCLE) - { - if(!is_array($Series)) - $Series = $this->convertToArray($Series); - - foreach($Series as $Key => $Serie) - { - if(isset($this->Data['Series'][$Serie])) - $this->Data['Series'][$Serie]['Shape'] = $Shape; - } - } - - function setSerieDescription($Series, $Description = 'My serie') - { - if(!is_array($Series)) - $Series = $this->convertToArray($Series); - - foreach($Series as $Key => $Serie) - { - if(isset($this->Data['Series'][$Serie])) - $this->Data['Series'][$Serie]['Description'] = $Description; - } - } - - function setSerieDrawable($Series, $Drawable = TRUE) - { - if(!is_array($Series)) - $Series = $this->convertToArray($Series); - - foreach($Series as $Key => $Serie) - { - if(isset($this->Data['Series'][$Serie])) - $this->Data['Series'][$Serie]['isDrawable'] = $Drawable; - } - } - - function setSeriePicture($Series,$Picture=NULL) - { - if(!is_array($Series)) - $Series = $this->convertToArray($Series); - - foreach($Series as $Key => $Serie) - { - if(isset($this->Data['Series'][$Serie])) - $this->Data['Series'][$Serie]['Picture'] = $Picture; - } - } - - function setXAxisName($Name) - { - $this->Data['XAxisName'] = $Name; - } - - function setXAxisDisplay($Mode, $Format = NULL) - { - $this->Data['XAxisDisplay'] = $Mode; - $this->Data['XAxisFormat'] = $Format; - } - - function setXAxisUnit($Unit) - { - $this->Data['XAxisUnit'] = $Unit; - } - - function setAbscissa($Serie) - { - if(isset($this->Data['Series'][$Serie])) - $this->Data['Abscissa'] = $Serie; - } - - function setAbsicssaPosition($Position = AXIS_POSITION_BOTTOM) - { - $this->Data['AbsicssaPosition'] = $Position; - } - - function setAbscissaName($Name) - { - $this->Data['AbscissaName'] = $Name; - } - - function setScatterSerie($SerieX, $SerieY, $ID = 0) - { - if(isset($this->Data['Series'][$SerieX]) && isset($this->Data['Series'][$SerieY])) - { - $this->initScatterSerie($ID); - $this->Data['ScatterSeries'][$ID]['X'] = $SerieX; - $this->Data['ScatterSeries'][$ID]['Y'] = $SerieY; - } - } - - function setScatterSerieShape($ID, $Shape = SERIE_SHAPE_FILLEDCIRCLE) - { - if(isset($this->Data['ScatterSeries'][$ID])) - $this->Data['ScatterSeries'][$ID]['Shape'] = $Shape; - } - - function setScatterSerieDescription($ID, $Description = 'My serie') - { - if(isset($this->Data['ScatterSeries'][$ID])) - $this->Data['ScatterSeries'][$ID]['Description'] = $Description; - } - - function setScatterSeriePicture($ID, $Picture = NULL) - { - if(isset($this->Data['ScatterSeries'][$ID])) - $this->Data['ScatterSeries'][$ID]['Picture'] = $Picture; - } - - function setScatterSerieDrawable($ID, $Drawable = TRUE) - { - if(isset($this->Data['ScatterSeries'][$ID])) - $this->Data['ScatterSeries'][$ID]['isDrawable'] = $Drawable; - } - - function setScatterSerieTicks($ID, $Width = 0) - { - if(isset($this->Data['ScatterSeries'][$ID])) - $this->Data['ScatterSeries'][$ID]['Ticks'] = $Width; - } - - function setScatterSerieWeight($ID, $Weight = 0) - { - if(isset($this->Data['ScatterSeries'][$ID])) - $this->Data['ScatterSeries'][$ID]['Weight'] = $Weight; - } - - function setScatterSerieColor($ID, $Format) - { - $R = isset($Format['R']) ? $Format['R'] : 0; - $G = isset($Format['G']) ? $Format['G'] : 0; - $B = isset($Format['B']) ? $Format['B'] : 0; - $Alpha = isset($Format['Alpha']) ? $Format['Alpha'] : 100; - - if(isset($this->Data['ScatterSeries'][$ID])) - { - $this->Data['ScatterSeries'][$ID]['Color']['R'] = $R; - $this->Data['ScatterSeries'][$ID]['Color']['G'] = $G; - $this->Data['ScatterSeries'][$ID]['Color']['B'] = $B; - $this->Data['ScatterSeries'][$ID]['Color']['Alpha'] = $Alpha; - } - } - - function limits() - { - $GlobalMin = ABSOLUTE_MAX; - $GlobalMax = ABSOLUTE_MIN; - - foreach($this->Data['Series'] as $Key => $Value) - { - if($this->Data['Abscissa'] != $Key && $this->Data['Series'][$Key]['isDrawable'] == TRUE) - { - if($GlobalMin > $this->Data['Series'][$Key]['Min']) - $GlobalMin = $this->Data['Series'][$Key]['Min']; - - if($GlobalMax < $this->Data['Series'][$Key]['Max']) - $GlobalMax = $this->Data['Series'][$Key]['Max']; - } - } - - $this->Data['Min'] = $GlobalMin; - $this->Data['Max'] = $GlobalMax; - - return(array($GlobalMin,$GlobalMax)); - } - - function drawAll() - { - foreach($this->Data['Series'] as $Key => $Value) - { - if($this->Data['Abscissa'] != $Key) - $this->Data['Series'][$Key]['isDrawable'] = TRUE; - } - } - - function getSerieAverage($Serie) - { - if(isset($this->Data['Series'][$Serie])) - { - $SerieData = $this->stripVOID($this->Data['Series'][$Serie]['Data']); - - return(array_sum($SerieData)/sizeof($SerieData)); - } - - return(NULL); - } - - function getGeometricMean($Serie) - { - if(isset($this->Data['Series'][$Serie])) - { - $SerieData = $this->stripVOID($this->Data['Series'][$Serie]['Data']); - $Seriesum = 1; - - foreach($SerieData as $Key => $Value) - $Seriesum = $Seriesum * $Value; - - return(pow($Seriesum,1/sizeof($SerieData))); - } - - return(NULL); - } - - function getHarmonicMean($Serie) - { - if(isset($this->Data['Series'][$Serie])) - { - $SerieData = $this->stripVOID($this->Data['Series'][$Serie]['Data']); - $Seriesum = 0; - - foreach($SerieData as $Key => $Value) - $Seriesum = $Seriesum + 1/$Value; - - return(sizeof($SerieData)/$Seriesum); - } - - return(NULL); - } - - function getStandardDeviation($Serie) - { - if(isset($this->Data['Series'][$Serie])) - { - $Average = $this->getSerieAverage($Serie); - $SerieData = $this->stripVOID($this->Data['Series'][$Serie]['Data']); - - $DeviationSum = 0; - - foreach($SerieData as $Key => $Value) - $DeviationSum = $DeviationSum + ($Value-$Average)*($Value-$Average); - - $Deviation = sqrt($DeviationSum/count($SerieData)); - - return($Deviation); - } - - return(NULL); - } - - function getCoefficientOfVariation($Serie) - { - if(isset($this->Data['Series'][$Serie])) - { - $Average = $this->getSerieAverage($Serie); - $StandardDeviation = $this->getStandardDeviation($Serie); - - if($StandardDeviation != 0) - return($StandardDeviation/$Average); - } - - return(NULL); - } - - function getSerieMedian($Serie) - { - if(isset($this->Data['Series'][$Serie])) - { - $SerieData = $this->stripVOID($this->Data['Series'][$Serie]['Data']); - - sort($SerieData); - - $SerieCenter = floor(sizeof($SerieData)/2); - - if(isset($SerieData[$SerieCenter])) - return($SerieData[$SerieCenter]); - } - - return(NULL); - } - - function getSeriePercentile($Serie = 'Serie1', $Percentil = 95) - { - if(!isset($this->Data['Series'][$Serie]['Data'])) - return(NULL); + if(!DEFINED('EGP')) + exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404')); + + define('AXIS_FORMAT_DEFAULT', 680001); + define('AXIS_FORMAT_TIME', 680002); + define('AXIS_FORMAT_DATE', 680003); + define('AXIS_FORMAT_METRIC', 680004); + define('AXIS_FORMAT_CURRENCY', 680005); + define('AXIS_FORMAT_TRAFFIC', 680006); + define('AXIS_FORMAT_CUSTOM', 680007); + define('AXIS_POSITION_LEFT', 681001); + define('AXIS_POSITION_RIGHT', 681002); + define('AXIS_POSITION_TOP', 681001); + define('AXIS_POSITION_BOTTOM', 681002); + define('SERIE_SHAPE_FILLEDCIRCLE', 681011); + define('SERIE_SHAPE_FILLEDTRIANGLE', 681012); + define('SERIE_SHAPE_FILLEDSQUARE', 681013); + define('SERIE_SHAPE_FILLEDDIAMOND', 681017); + define('SERIE_SHAPE_CIRCLE', 681014); + define('SERIE_SHAPE_TRIANGLE', 681015); + define('SERIE_SHAPE_SQUARE', 681016); + define('SERIE_SHAPE_DIAMOND', 681018); + define('AXIS_X', 682001); + define('AXIS_Y', 682002); + define('ABSOLUTE_MIN', -10000000000000); + define('ABSOLUTE_MAX', 10000000000000); + define('VOID' , 0.123456789); + define('EURO_SYMBOL', utf8_encode('€')); + + class pData + { + var $Data; + + var $Palette = array('0'=>array('R'=>188,'G'=>224,'B'=>46,'Alpha'=>100), + '1'=>array('R'=>224,'G'=>100,'B'=>46,'Alpha'=>100), + '2'=>array('R'=>224,'G'=>214,'B'=>46,'Alpha'=>100), + '3'=>array('R'=>46,'G'=>151,'B'=>224,'Alpha'=>100), + '4'=>array('R'=>176,'G'=>46,'B'=>224,'Alpha'=>100), + '5'=>array('R'=>224,'G'=>46,'B'=>117,'Alpha'=>100), + '6'=>array('R'=>92,'G'=>224,'B'=>46,'Alpha'=>100), + '7'=>array('R'=>224,'G'=>176,'B'=>46,'Alpha'=>100)); + + function pData() + { + $this->Data = ''; + $this->Data['XAxisDisplay'] = AXIS_FORMAT_DEFAULT; + $this->Data['XAxisFormat'] = NULL; + $this->Data['XAxisName'] = NULL; + $this->Data['XAxisUnit'] = NULL; + $this->Data['Abscissa'] = NULL; + $this->Data['AbsicssaPosition'] = AXIS_POSITION_BOTTOM; + $this->Data['Axis'][0]['Display'] = AXIS_FORMAT_DEFAULT; + $this->Data['Axis'][0]['Position'] = AXIS_POSITION_LEFT; + $this->Data['Axis'][0]['Identity'] = AXIS_Y; + } + + function addPoints($Values, $SerieName = 'Serie1') + { + if(!isset($this->Data['Series'][$SerieName])) + $this->initialise($SerieName); + + if(is_array($Values)) + { + foreach($Values as $Key => $Value) + $this->Data['Series'][$SerieName]['Data'][] = $Value; + }else + $this->Data['Series'][$SerieName]['Data'][] = $Values; + + if($Values != VOID) + { + $StrippedData = $this->stripVOID($this->Data['Series'][$SerieName]['Data']); + + if(empty($StrippedData)) + { + $this->Data['Series'][$SerieName]['Max'] = 0; + $this->Data['Series'][$SerieName]['Min'] =0; + return(0); + } + + $this->Data['Series'][$SerieName]['Max'] = max($StrippedData); + $this->Data['Series'][$SerieName]['Min'] = min($StrippedData); + } + } + + function stripVOID($Values) + { + if(!is_array($Values)) + return(array()); + + $Result = array(); + + foreach($Values as $Key => $Value) + { + if($Value != VOID) + $Result[] = $Value; + } + + return($Result); + } + + function getSerieCount($Serie) + { + if(isset($this->Data['Series'][$Serie]['Data'])) + return(sizeof($this->Data['Series'][$Serie]['Data'])); + + return(0); + } + + function removeSerie($Series) + { + if(!is_array($Series)) + $Series = $this->convertToArray($Series); + + foreach($Series as $Key => $Serie) + { + if(isset($this->Data['Series'][$Serie])) + unset($this->Data['Series'][$Serie]); + } + } + + function getValueAt($Serie,$Index=0) + { + if(isset($this->Data['Series'][$Serie]['Data'][$Index])) + return($this->Data['Series'][$Serie]['Data'][$Index]); + + return(NULL); + } + + function getValues($Serie) + { + if(isset($this->Data['Series'][$Serie]['Data'])) + return($this->Data['Series'][$Serie]['Data']); + + return(NULL); + } + + function reverseSerie($Series) + { + if(!is_array($Series)) + $Series = $this->convertToArray($Series); + + foreach($Series as $Key => $Serie) + { + if(isset($this->Data['Series'][$Serie]['Data'])) + $this->Data['Series'][$Serie]['Data'] = array_reverse($this->Data['Series'][$Serie]['Data']); + } + } + + function getSum($Serie) + { + if(isset($this->Data['Series'][$Serie])) + return(array_sum($this->Data['Series'][$Serie]['Data'])); + + return(NULL); + } + + function getMax($Serie) + { + if(isset($this->Data['Series'][$Serie]['Max'])) + return($this->Data['Series'][$Serie]['Max']); + + return(NULL); + } + + function getMin($Serie) + { + if(isset($this->Data['Series'][$Serie]['Min'])) + return($this->Data['Series'][$Serie]['Min']); + + return(NULL); + } + + function setSerieShape($Series, $Shape = SERIE_SHAPE_FILLEDCIRCLE) + { + if(!is_array($Series)) + $Series = $this->convertToArray($Series); + + foreach($Series as $Key => $Serie) + { + if(isset($this->Data['Series'][$Serie])) + $this->Data['Series'][$Serie]['Shape'] = $Shape; + } + } + + function setSerieDescription($Series, $Description = 'My serie') + { + if(!is_array($Series)) + $Series = $this->convertToArray($Series); + + foreach($Series as $Key => $Serie) + { + if(isset($this->Data['Series'][$Serie])) + $this->Data['Series'][$Serie]['Description'] = $Description; + } + } + + function setSerieDrawable($Series, $Drawable = TRUE) + { + if(!is_array($Series)) + $Series = $this->convertToArray($Series); + + foreach($Series as $Key => $Serie) + { + if(isset($this->Data['Series'][$Serie])) + $this->Data['Series'][$Serie]['isDrawable'] = $Drawable; + } + } + + function setSeriePicture($Series,$Picture=NULL) + { + if(!is_array($Series)) + $Series = $this->convertToArray($Series); + + foreach($Series as $Key => $Serie) + { + if(isset($this->Data['Series'][$Serie])) + $this->Data['Series'][$Serie]['Picture'] = $Picture; + } + } + + function setXAxisName($Name) + { + $this->Data['XAxisName'] = $Name; + } + + function setXAxisDisplay($Mode, $Format = NULL) + { + $this->Data['XAxisDisplay'] = $Mode; + $this->Data['XAxisFormat'] = $Format; + } + + function setXAxisUnit($Unit) + { + $this->Data['XAxisUnit'] = $Unit; + } + + function setAbscissa($Serie) + { + if(isset($this->Data['Series'][$Serie])) + $this->Data['Abscissa'] = $Serie; + } + + function setAbsicssaPosition($Position = AXIS_POSITION_BOTTOM) + { + $this->Data['AbsicssaPosition'] = $Position; + } + + function setAbscissaName($Name) + { + $this->Data['AbscissaName'] = $Name; + } + + function setScatterSerie($SerieX, $SerieY, $ID = 0) + { + if(isset($this->Data['Series'][$SerieX]) && isset($this->Data['Series'][$SerieY])) + { + $this->initScatterSerie($ID); + $this->Data['ScatterSeries'][$ID]['X'] = $SerieX; + $this->Data['ScatterSeries'][$ID]['Y'] = $SerieY; + } + } + + function setScatterSerieShape($ID, $Shape = SERIE_SHAPE_FILLEDCIRCLE) + { + if(isset($this->Data['ScatterSeries'][$ID])) + $this->Data['ScatterSeries'][$ID]['Shape'] = $Shape; + } + + function setScatterSerieDescription($ID, $Description = 'My serie') + { + if(isset($this->Data['ScatterSeries'][$ID])) + $this->Data['ScatterSeries'][$ID]['Description'] = $Description; + } + + function setScatterSeriePicture($ID, $Picture = NULL) + { + if(isset($this->Data['ScatterSeries'][$ID])) + $this->Data['ScatterSeries'][$ID]['Picture'] = $Picture; + } + + function setScatterSerieDrawable($ID, $Drawable = TRUE) + { + if(isset($this->Data['ScatterSeries'][$ID])) + $this->Data['ScatterSeries'][$ID]['isDrawable'] = $Drawable; + } + + function setScatterSerieTicks($ID, $Width = 0) + { + if(isset($this->Data['ScatterSeries'][$ID])) + $this->Data['ScatterSeries'][$ID]['Ticks'] = $Width; + } + + function setScatterSerieWeight($ID, $Weight = 0) + { + if(isset($this->Data['ScatterSeries'][$ID])) + $this->Data['ScatterSeries'][$ID]['Weight'] = $Weight; + } + + function setScatterSerieColor($ID, $Format) + { + $R = isset($Format['R']) ? $Format['R'] : 0; + $G = isset($Format['G']) ? $Format['G'] : 0; + $B = isset($Format['B']) ? $Format['B'] : 0; + $Alpha = isset($Format['Alpha']) ? $Format['Alpha'] : 100; + + if(isset($this->Data['ScatterSeries'][$ID])) + { + $this->Data['ScatterSeries'][$ID]['Color']['R'] = $R; + $this->Data['ScatterSeries'][$ID]['Color']['G'] = $G; + $this->Data['ScatterSeries'][$ID]['Color']['B'] = $B; + $this->Data['ScatterSeries'][$ID]['Color']['Alpha'] = $Alpha; + } + } + + function limits() + { + $GlobalMin = ABSOLUTE_MAX; + $GlobalMax = ABSOLUTE_MIN; + + foreach($this->Data['Series'] as $Key => $Value) + { + if($this->Data['Abscissa'] != $Key && $this->Data['Series'][$Key]['isDrawable'] == TRUE) + { + if($GlobalMin > $this->Data['Series'][$Key]['Min']) + $GlobalMin = $this->Data['Series'][$Key]['Min']; + + if($GlobalMax < $this->Data['Series'][$Key]['Max']) + $GlobalMax = $this->Data['Series'][$Key]['Max']; + } + } + + $this->Data['Min'] = $GlobalMin; + $this->Data['Max'] = $GlobalMax; + + return(array($GlobalMin,$GlobalMax)); + } + + function drawAll() + { + foreach($this->Data['Series'] as $Key => $Value) + { + if($this->Data['Abscissa'] != $Key) + $this->Data['Series'][$Key]['isDrawable'] = TRUE; + } + } + + function getSerieAverage($Serie) + { + if(isset($this->Data['Series'][$Serie])) + { + $SerieData = $this->stripVOID($this->Data['Series'][$Serie]['Data']); + + return(array_sum($SerieData)/sizeof($SerieData)); + } + + return(NULL); + } + + function getGeometricMean($Serie) + { + if(isset($this->Data['Series'][$Serie])) + { + $SerieData = $this->stripVOID($this->Data['Series'][$Serie]['Data']); + $Seriesum = 1; + + foreach($SerieData as $Key => $Value) + $Seriesum = $Seriesum * $Value; + + return(pow($Seriesum,1/sizeof($SerieData))); + } + + return(NULL); + } + + function getHarmonicMean($Serie) + { + if(isset($this->Data['Series'][$Serie])) + { + $SerieData = $this->stripVOID($this->Data['Series'][$Serie]['Data']); + $Seriesum = 0; + + foreach($SerieData as $Key => $Value) + $Seriesum = $Seriesum + 1/$Value; + + return(sizeof($SerieData)/$Seriesum); + } + + return(NULL); + } + + function getStandardDeviation($Serie) + { + if(isset($this->Data['Series'][$Serie])) + { + $Average = $this->getSerieAverage($Serie); + $SerieData = $this->stripVOID($this->Data['Series'][$Serie]['Data']); + + $DeviationSum = 0; + + foreach($SerieData as $Key => $Value) + $DeviationSum = $DeviationSum + ($Value-$Average)*($Value-$Average); + + $Deviation = sqrt($DeviationSum/count($SerieData)); + + return($Deviation); + } + + return(NULL); + } + + function getCoefficientOfVariation($Serie) + { + if(isset($this->Data['Series'][$Serie])) + { + $Average = $this->getSerieAverage($Serie); + $StandardDeviation = $this->getStandardDeviation($Serie); + + if($StandardDeviation != 0) + return($StandardDeviation/$Average); + } + + return(NULL); + } + + function getSerieMedian($Serie) + { + if(isset($this->Data['Series'][$Serie])) + { + $SerieData = $this->stripVOID($this->Data['Series'][$Serie]['Data']); + + sort($SerieData); + + $SerieCenter = floor(sizeof($SerieData)/2); + + if(isset($SerieData[$SerieCenter])) + return($SerieData[$SerieCenter]); + } + + return(NULL); + } + + function getSeriePercentile($Serie = 'Serie1', $Percentil = 95) + { + if(!isset($this->Data['Series'][$Serie]['Data'])) + return(NULL); - $Values = count($this->Data['Series'][$Serie]['Data'])-1; + $Values = count($this->Data['Series'][$Serie]['Data'])-1; - if($Values < 0) - $Values = 0; + if($Values < 0) + $Values = 0; - $PercentilID = floor(($Values/100)*$Percentil+.5); - $SortedValues = $this->Data['Series'][$Serie]['Data']; + $PercentilID = floor(($Values/100)*$Percentil+.5); + $SortedValues = $this->Data['Series'][$Serie]['Data']; - sort($SortedValues); + sort($SortedValues); - if(is_numeric($SortedValues[$PercentilID])) - return($SortedValues[$PercentilID]); - - return(NULL); - } + if(is_numeric($SortedValues[$PercentilID])) + return($SortedValues[$PercentilID]); + + return(NULL); + } - function addRandomValues($SerieName = 'Serie1', $Options = '') - { - $Values = isset($Options['Values']) ? $Options['Values'] : 20; - $Min = isset($Options['Min']) ? $Options['Min'] : 0; - $Max = isset($Options['Max']) ? $Options['Max'] : 100; - $withFloat = isset($Options['withFloat']) ? $Options['withFloat'] : FALSE; + function addRandomValues($SerieName = 'Serie1', $Options = '') + { + $Values = isset($Options['Values']) ? $Options['Values'] : 20; + $Min = isset($Options['Min']) ? $Options['Min'] : 0; + $Max = isset($Options['Max']) ? $Options['Max'] : 100; + $withFloat = isset($Options['withFloat']) ? $Options['withFloat'] : FALSE; - for($i = 0; $i <= $Values; $i+=1) - { - if($withFloat) - $Value = rand($Min*100,$Max*100)/100; - else - $Value = rand($Min, $Max); + for($i = 0; $i <= $Values; $i+=1) + { + if($withFloat) + $Value = rand($Min*100,$Max*100)/100; + else + $Value = rand($Min, $Max); - $this->addPoints($Value,$SerieName); - } - } + $this->addPoints($Value,$SerieName); + } + } - function containsData() - { - if(!isset($this->Data['Series'])) - return(FALSE); + function containsData() + { + if(!isset($this->Data['Series'])) + return(FALSE); - $Result = FALSE; + $Result = FALSE; - foreach($this->Data['Series'] as $Key => $Value) - { - if($this->Data['Abscissa'] != $Key && $this->Data['Series'][$Key]['isDrawable'] == TRUE) - $Result=TRUE; - } + foreach($this->Data['Series'] as $Key => $Value) + { + if($this->Data['Abscissa'] != $Key && $this->Data['Series'][$Key]['isDrawable'] == TRUE) + $Result=TRUE; + } - return($Result); - } + return($Result); + } - function setAxisDisplay($AxisID, $Mode = AXIS_FORMAT_DEFAULT, $Format = NULL) - { - if(isset($this->Data['Axis'][$AxisID])) - { - $this->Data['Axis'][$AxisID]['Display'] = $Mode; + function setAxisDisplay($AxisID, $Mode = AXIS_FORMAT_DEFAULT, $Format = NULL) + { + if(isset($this->Data['Axis'][$AxisID])) + { + $this->Data['Axis'][$AxisID]['Display'] = $Mode; - if($Format != NULL) - $this->Data['Axis'][$AxisID]['Format'] = $Format; - } - } - - function setAxisPosition($AxisID, $Position = AXIS_POSITION_LEFT) - { - if(isset($this->Data['Axis'][$AxisID])) - { - $this->Data['Axis'][$AxisID]['Position'] = $Position; - } - } + if($Format != NULL) + $this->Data['Axis'][$AxisID]['Format'] = $Format; + } + } + + function setAxisPosition($AxisID, $Position = AXIS_POSITION_LEFT) + { + if(isset($this->Data['Axis'][$AxisID])) + { + $this->Data['Axis'][$AxisID]['Position'] = $Position; + } + } /* Associate an unit to an axis */ function setAxisUnit($AxisID,$Unit) @@ -525,9 +525,9 @@ /* Associate a color to an axis */ function setAxisColor($AxisID,$Format) { - $R = isset($Format['R']) ? $Format['R'] : 0; - $G = isset($Format['G']) ? $Format['G'] : 0; - $B = isset($Format['B']) ? $Format['B'] : 0; + $R = isset($Format['R']) ? $Format['R'] : 0; + $G = isset($Format['G']) ? $Format['G'] : 0; + $B = isset($Format['B']) ? $Format['B'] : 0; $Alpha = isset($Format['Alpha']) ? $Format['Alpha'] : 100; if ( isset($this->Data['Axis'][$AxisID] ) ) @@ -565,14 +565,14 @@ } } - /* define if a serie should be draw with ticks */ + /* define if a serie should be draw with ticks */ function setSerieTicks($Series,$Width=0) { if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); } foreach($Series as $Key => $Serie) { if ( isset($this->Data['Series'][$Serie]) ) { $this->Data['Series'][$Serie]['Ticks'] = $Width; } } } - /* define if a serie should be draw with a special weight */ + /* define if a serie should be draw with a special weight */ function setSerieWeight($Series,$Weight=0) { if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); } @@ -600,9 +600,9 @@ foreach($Series as $Key => $Serie) { - $R = isset($Format['R']) ? $Format['R'] : 0; - $G = isset($Format['G']) ? $Format['G'] : 0; - $B = isset($Format['B']) ? $Format['B'] : 0; + $R = isset($Format['R']) ? $Format['R'] : 0; + $G = isset($Format['G']) ? $Format['G'] : 0; + $B = isset($Format['B']) ? $Format['B'] : 0; $Alpha = isset($Format['Alpha']) ? $Format['Alpha'] : 100; if ( isset($this->Data['Series'][$Serie]) ) @@ -660,11 +660,11 @@ { if ( isset($this->Data['ScatterSeries'][$ID]) ) { return(0); } - $this->Data['ScatterSeries'][$ID]['Description'] = 'Scatter '.$ID; - $this->Data['ScatterSeries'][$ID]['isDrawable'] = TRUE; - $this->Data['ScatterSeries'][$ID]['Picture'] = NULL; - $this->Data['ScatterSeries'][$ID]['Ticks'] = 0; - $this->Data['ScatterSeries'][$ID]['Weight'] = 0; + $this->Data['ScatterSeries'][$ID]['Description'] = 'Scatter '.$ID; + $this->Data['ScatterSeries'][$ID]['isDrawable'] = TRUE; + $this->Data['ScatterSeries'][$ID]['Picture'] = NULL; + $this->Data['ScatterSeries'][$ID]['Ticks'] = 0; + $this->Data['ScatterSeries'][$ID]['Weight'] = 0; if ( isset($this->Palette[$ID]) ) $this->Data['ScatterSeries'][$ID]['Color'] = $this->Palette[$ID]; @@ -682,15 +682,15 @@ { if ( isset($this->Data['Series']) ) { $ID = count($this->Data['Series']); } else { $ID = 0; } - $this->Data['Series'][$Serie]['Description'] = $Serie; - $this->Data['Series'][$Serie]['isDrawable'] = TRUE; - $this->Data['Series'][$Serie]['Picture'] = NULL; - $this->Data['Series'][$Serie]['Max'] = NULL; - $this->Data['Series'][$Serie]['Min'] = NULL; - $this->Data['Series'][$Serie]['Axis'] = 0; - $this->Data['Series'][$Serie]['Ticks'] = 0; - $this->Data['Series'][$Serie]['Weight'] = 0; - $this->Data['Series'][$Serie]['Shape'] = SERIE_SHAPE_FILLEDCIRCLE; + $this->Data['Series'][$Serie]['Description'] = $Serie; + $this->Data['Series'][$Serie]['isDrawable'] = TRUE; + $this->Data['Series'][$Serie]['Picture'] = NULL; + $this->Data['Series'][$Serie]['Max'] = NULL; + $this->Data['Series'][$Serie]['Min'] = NULL; + $this->Data['Series'][$Serie]['Axis'] = 0; + $this->Data['Series'][$Serie]['Ticks'] = 0; + $this->Data['Series'][$Serie]['Weight'] = 0; + $this->Data['Series'][$Serie]['Shape'] = SERIE_SHAPE_FILLEDCIRCLE; if ( isset($this->Palette[$ID]) ) $this->Data['Series'][$Serie]['Color'] = $this->Palette[$ID]; @@ -762,10 +762,10 @@ /* Load data from a CSV (or similar) data source */ function importFromCSV($FileName,$Options='') { - $Delimiter = isset($Options['Delimiter']) ? $Options['Delimiter'] : ','; - $GotHeader = isset($Options['GotHeader']) ? $Options['GotHeader'] : FALSE; - $SkipColumns = isset($Options['SkipColumns']) ? $Options['SkipColumns'] : array(-1); - $DefaultSerieName = isset($Options['DefaultSerieName']) ? $Options['DefaultSerieName'] : 'Serie'; + $Delimiter = isset($Options['Delimiter']) ? $Options['Delimiter'] : ','; + $GotHeader = isset($Options['GotHeader']) ? $Options['GotHeader'] : FALSE; + $SkipColumns = isset($Options['SkipColumns']) ? $Options['SkipColumns'] : array(-1); + $DefaultSerieName = isset($Options['DefaultSerieName']) ? $Options['DefaultSerieName'] : 'Serie'; $Handle = @fopen($FileName,'r'); if ($Handle) @@ -799,12 +799,12 @@ /* Create a dataset based on a formula */ function createFunctionSerie($SerieName,$Formula='',$Options='') { - $MinX = isset($Options['MinX']) ? $Options['MinX'] : -10; - $MaxX = isset($Options['MaxX']) ? $Options['MaxX'] : 10; - $XStep = isset($Options['XStep']) ? $Options['XStep'] : 1; - $AutoDescription = isset($Options['AutoDescription']) ? $Options['AutoDescription'] : FALSE; - $RecordAbscissa = isset($Options['RecordAbscissa']) ? $Options['RecordAbscissa'] : FALSE; - $AbscissaSerie = isset($Options['AbscissaSerie']) ? $Options['AbscissaSerie'] : 'Abscissa'; + $MinX = isset($Options['MinX']) ? $Options['MinX'] : -10; + $MaxX = isset($Options['MaxX']) ? $Options['MaxX'] : 10; + $XStep = isset($Options['XStep']) ? $Options['XStep'] : 1; + $AutoDescription = isset($Options['AutoDescription']) ? $Options['AutoDescription'] : FALSE; + $RecordAbscissa = isset($Options['RecordAbscissa']) ? $Options['RecordAbscissa'] : FALSE; + $AbscissaSerie = isset($Options['AbscissaSerie']) ? $Options['AbscissaSerie'] : 'Abscissa'; if ( $Formula == '' ) { return(0); } @@ -868,8 +868,8 @@ function __toString() { return('pData object.'); } - function left($value,$NbChar) { return substr($value,0,$NbChar); } - function right($value,$NbChar) { return substr($value,strlen($value)-$NbChar,$NbChar); } - function mid($value,$Depart,$NbChar) { return substr($value,$Depart-1,$NbChar); } + function left($value,$NbChar) { return substr($value,0,$NbChar); } + function right($value,$NbChar) { return substr($value,strlen($value)-$NbChar,$NbChar); } + function mid($value,$Depart,$NbChar) { return substr($value,$Depart-1,$NbChar); } } ?> \ No newline at end of file diff --git a/system/library/games/graph/pDraw.php b/system/library/games/graph/pDraw.php index cc49e57..f7a0acb 100644 --- a/system/library/games/graph/pDraw.php +++ b/system/library/games/graph/pDraw.php @@ -1,73 +1,73 @@ fixBoxCoordinates($X1,$Y1,$X2,$Y2); @@ -239,14 +239,14 @@ /* Draw a rectangle with rounded corners */ function drawRoundedFilledRectangle($X1,$Y1,$X2,$Y2,$Radius,$Format="") { - $R = isset($Format["R"]) ? $Format["R"] : 0; - $G = isset($Format["G"]) ? $Format["G"] : 0; - $B = isset($Format["B"]) ? $Format["B"] : 0; - $BorderR = isset($Format["BorderR"]) ? $Format["BorderR"] : -1; - $BorderG = isset($Format["BorderG"]) ? $Format["BorderG"] : -1; - $BorderB = isset($Format["BorderB"]) ? $Format["BorderB"] : -1; - $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100; - $Surrounding = isset($Format["Surrounding"]) ? $Format["Surrounding"] : NULL; + $R = isset($Format["R"]) ? $Format["R"] : 0; + $G = isset($Format["G"]) ? $Format["G"] : 0; + $B = isset($Format["B"]) ? $Format["B"] : 0; + $BorderR = isset($Format["BorderR"]) ? $Format["BorderR"] : -1; + $BorderG = isset($Format["BorderG"]) ? $Format["BorderG"] : -1; + $BorderB = isset($Format["BorderB"]) ? $Format["BorderB"] : -1; + $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100; + $Surrounding = isset($Format["Surrounding"]) ? $Format["Surrounding"] : NULL; /* Temporary fix for AA issue */ $Y1 = floor($Y1); $Y2 = floor($Y2); $X1 = floor($X1); $X2 = floor($X2); @@ -324,14 +324,14 @@ /* Draw a rectangle with rounded corners */ function drawRoundedFilledRectangle_deprecated($X1,$Y1,$X2,$Y2,$Radius,$Format="") { - $R = isset($Format["R"]) ? $Format["R"] : 0; - $G = isset($Format["G"]) ? $Format["G"] : 0; - $B = isset($Format["B"]) ? $Format["B"] : 0; - $BorderR = isset($Format["BorderR"]) ? $Format["BorderR"] : -1; - $BorderG = isset($Format["BorderG"]) ? $Format["BorderG"] : -1; - $BorderB = isset($Format["BorderB"]) ? $Format["BorderB"] : -1; - $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100; - $Surrounding = isset($Format["Surrounding"]) ? $Format["Surrounding"] : NULL; + $R = isset($Format["R"]) ? $Format["R"] : 0; + $G = isset($Format["G"]) ? $Format["G"] : 0; + $B = isset($Format["B"]) ? $Format["B"] : 0; + $BorderR = isset($Format["BorderR"]) ? $Format["BorderR"] : -1; + $BorderG = isset($Format["BorderG"]) ? $Format["BorderG"] : -1; + $BorderB = isset($Format["BorderB"]) ? $Format["BorderB"] : -1; + $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100; + $Surrounding = isset($Format["Surrounding"]) ? $Format["Surrounding"] : NULL; if ( $Surrounding != NULL ) { $BorderR = $R+$Surrounding; $BorderG = $G+$Surrounding; $BorderB = $B+$Surrounding; } if ( $BorderR == -1 ) { $BorderR = $R; $BorderG = $G; $BorderB = $B; } @@ -403,12 +403,12 @@ /* Draw a rectangle */ function drawRectangle($X1,$Y1,$X2,$Y2,$Format="") { - $R = isset($Format["R"]) ? $Format["R"] : 0; - $G = isset($Format["G"]) ? $Format["G"] : 0; - $B = isset($Format["B"]) ? $Format["B"] : 0; - $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100; - $Ticks = isset($Format["Ticks"]) ? $Format["Ticks"] : NULL; - $NoAngle = isset($Format["NoAngle"]) ? $Format["NoAngle"] : FALSE; + $R = isset($Format["R"]) ? $Format["R"] : 0; + $G = isset($Format["G"]) ? $Format["G"] : 0; + $B = isset($Format["B"]) ? $Format["B"] : 0; + $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100; + $Ticks = isset($Format["Ticks"]) ? $Format["Ticks"] : NULL; + $NoAngle = isset($Format["NoAngle"]) ? $Format["NoAngle"] : FALSE; if ($X1 > $X2) { list($X1, $X2) = array($X2, $X1); } if ($Y1 > $Y2) { list($Y1, $Y2) = array($Y2, $Y1); } @@ -440,23 +440,23 @@ /* Draw a filled rectangle */ function drawFilledRectangle($X1,$Y1,$X2,$Y2,$Format="") { - $R = isset($Format["R"]) ? $Format["R"] : 0; - $G = isset($Format["G"]) ? $Format["G"] : 0; - $B = isset($Format["B"]) ? $Format["B"] : 0; - $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100; - $BorderR = isset($Format["BorderR"]) ? $Format["BorderR"] : -1; - $BorderG = isset($Format["BorderG"]) ? $Format["BorderG"] : -1; - $BorderB = isset($Format["BorderB"]) ? $Format["BorderB"] : -1; - $BorderAlpha = isset($Format["BorderAlpha"]) ? $Format["BorderAlpha"] : $Alpha; - $Surrounding = isset($Format["Surrounding"]) ? $Format["Surrounding"] : NULL; - $Ticks = isset($Format["Ticks"]) ? $Format["Ticks"] : NULL; - $NoAngle = isset($Format["NoAngle"]) ? $Format["NoAngle"] : NULL; - $Dash = isset($Format["Dash"]) ? $Format["Dash"] : FALSE; - $DashStep = isset($Format["DashStep"]) ? $Format["DashStep"] : 4; - $DashR = isset($Format["DashR"]) ? $Format["DashR"] : 0; - $DashG = isset($Format["DashG"]) ? $Format["DashG"] : 0; - $DashB = isset($Format["DashB"]) ? $Format["DashB"] : 0; - $NoBorder = isset($Format["NoBorder"]) ? $Format["NoBorder"] : FALSE; + $R = isset($Format["R"]) ? $Format["R"] : 0; + $G = isset($Format["G"]) ? $Format["G"] : 0; + $B = isset($Format["B"]) ? $Format["B"] : 0; + $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100; + $BorderR = isset($Format["BorderR"]) ? $Format["BorderR"] : -1; + $BorderG = isset($Format["BorderG"]) ? $Format["BorderG"] : -1; + $BorderB = isset($Format["BorderB"]) ? $Format["BorderB"] : -1; + $BorderAlpha = isset($Format["BorderAlpha"]) ? $Format["BorderAlpha"] : $Alpha; + $Surrounding = isset($Format["Surrounding"]) ? $Format["Surrounding"] : NULL; + $Ticks = isset($Format["Ticks"]) ? $Format["Ticks"] : NULL; + $NoAngle = isset($Format["NoAngle"]) ? $Format["NoAngle"] : NULL; + $Dash = isset($Format["Dash"]) ? $Format["Dash"] : FALSE; + $DashStep = isset($Format["DashStep"]) ? $Format["DashStep"] : 4; + $DashR = isset($Format["DashR"]) ? $Format["DashR"] : 0; + $DashG = isset($Format["DashG"]) ? $Format["DashG"] : 0; + $DashB = isset($Format["DashB"]) ? $Format["DashB"] : 0; + $NoBorder = isset($Format["NoBorder"]) ? $Format["NoBorder"] : FALSE; if ( $Surrounding != NULL ) { $BorderR = $R+$Surrounding; $BorderG = $G+$Surrounding; $BorderB = $B+$Surrounding; } @@ -544,16 +544,16 @@ /* Drawn a spline based on the bezier function */ function drawSpline($Coordinates,$Format="") { - $R = isset($Format["R"]) ? $Format["R"] : 0; - $G = isset($Format["G"]) ? $Format["G"] : 0; - $B = isset($Format["B"]) ? $Format["B"] : 0; - $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100; - $Force = isset($Format["Force"]) ? $Format["Force"] : 30; - $Forces = isset($Format["Forces"]) ? $Format["Forces"] : NULL; - $ShowC = isset($Format["ShowControl"]) ? $Format["ShowControl"] : FALSE; - $Ticks = isset($Format["Ticks"]) ? $Format["Ticks"] : NULL; - $PathOnly = isset($Format["PathOnly"]) ? $Format["PathOnly"] : FALSE; - $Weight = isset($Format["Weight"]) ? $Format["Weight"] : NULL; + $R = isset($Format["R"]) ? $Format["R"] : 0; + $G = isset($Format["G"]) ? $Format["G"] : 0; + $B = isset($Format["B"]) ? $Format["B"] : 0; + $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100; + $Force = isset($Format["Force"]) ? $Format["Force"] : 30; + $Forces = isset($Format["Forces"]) ? $Format["Forces"] : NULL; + $ShowC = isset($Format["ShowControl"]) ? $Format["ShowControl"] : FALSE; + $Ticks = isset($Format["Ticks"]) ? $Format["Ticks"] : NULL; + $PathOnly = isset($Format["PathOnly"]) ? $Format["PathOnly"] : FALSE; + $Weight = isset($Format["Weight"]) ? $Format["Weight"] : NULL; $Cpt = NULL; $Mode = NULL; $Result = ""; for($i=1;$i<=count($Coordinates)-1;$i++) @@ -603,20 +603,20 @@ /* Draw a bezier curve with two controls points */ function drawBezier($X1,$Y1,$X2,$Y2,$Xv1,$Yv1,$Xv2,$Yv2,$Format="") { - $R = isset($Format["R"]) ? $Format["R"] : 0; - $G = isset($Format["G"]) ? $Format["G"] : 0; - $B = isset($Format["B"]) ? $Format["B"] : 0; - $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100; - $ShowC = isset($Format["ShowControl"]) ? $Format["ShowControl"] : FALSE; - $Segments = isset($Format["Segments"]) ? $Format["Segments"] : NULL; - $Ticks = isset($Format["Ticks"]) ? $Format["Ticks"] : NULL; + $R = isset($Format["R"]) ? $Format["R"] : 0; + $G = isset($Format["G"]) ? $Format["G"] : 0; + $B = isset($Format["B"]) ? $Format["B"] : 0; + $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100; + $ShowC = isset($Format["ShowControl"]) ? $Format["ShowControl"] : FALSE; + $Segments = isset($Format["Segments"]) ? $Format["Segments"] : NULL; + $Ticks = isset($Format["Ticks"]) ? $Format["Ticks"] : NULL; $NoDraw = isset($Format["NoDraw"]) ? $Format["NoDraw"] : FALSE; $PathOnly = isset($Format["PathOnly"]) ? $Format["PathOnly"] : FALSE; $Weight = isset($Format["Weight"]) ? $Format["Weight"] : NULL; - $DrawArrow = isset($Format["DrawArrow"]) ? $Format["DrawArrow"] : FALSE; - $ArrowSize = isset($Format["ArrowSize"]) ? $Format["ArrowSize"] : 10; - $ArrowRatio = isset($Format["ArrowRatio"]) ? $Format["ArrowRatio"] : .5; - $ArrowTwoHeads = isset($Format["ArrowTwoHeads"]) ? $Format["ArrowTwoHeads"] : FALSE; + $DrawArrow = isset($Format["DrawArrow"]) ? $Format["DrawArrow"] : FALSE; + $ArrowSize = isset($Format["ArrowSize"]) ? $Format["ArrowSize"] : 10; + $ArrowRatio = isset($Format["ArrowRatio"]) ? $Format["ArrowRatio"] : .5; + $ArrowTwoHeads = isset($Format["ArrowTwoHeads"]) ? $Format["ArrowTwoHeads"] : FALSE; if ( $Segments == NULL ) { @@ -707,15 +707,15 @@ /* Draw a line between two points */ function drawLine($X1,$Y1,$X2,$Y2,$Format="") { - $R = isset($Format["R"]) ? $Format["R"] : 0; - $G = isset($Format["G"]) ? $Format["G"] : 0; - $B = isset($Format["B"]) ? $Format["B"] : 0; - $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100; - $Ticks = isset($Format["Ticks"]) ? $Format["Ticks"] : NULL; - $Cpt = isset($Format["Cpt"]) ? $Format["Cpt"] : 1; - $Mode = isset($Format["Mode"]) ? $Format["Mode"] : 1; - $Weight = isset($Format["Weight"]) ? $Format["Weight"] : NULL; - $Threshold = isset($Format["Threshold"]) ? $Format["Threshold"] : NULL; + $R = isset($Format["R"]) ? $Format["R"] : 0; + $G = isset($Format["G"]) ? $Format["G"] : 0; + $B = isset($Format["B"]) ? $Format["B"] : 0; + $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100; + $Ticks = isset($Format["Ticks"]) ? $Format["Ticks"] : NULL; + $Cpt = isset($Format["Cpt"]) ? $Format["Cpt"] : 1; + $Mode = isset($Format["Mode"]) ? $Format["Mode"] : 1; + $Weight = isset($Format["Weight"]) ? $Format["Weight"] : NULL; + $Threshold = isset($Format["Threshold"]) ? $Format["Threshold"] : NULL; if ( $this->Antialias == FALSE && $Ticks == NULL ) { @@ -760,7 +760,7 @@ $Points[] = cos(deg2rad($Angle-90)) * $Weight + $Xa; $Points[] = sin(deg2rad($Angle-90)) * $Weight + $Ya; $Points[] = cos(deg2rad($Angle+90)) * $Weight + $Xa; $Points[] = sin(deg2rad($Angle+90)) * $Weight + $Ya; $Points[] = cos(deg2rad($Angle+90)) * $Weight + $Xb; $Points[] = sin(deg2rad($Angle+90)) * $Weight + $Yb; - $Points[] = cos(deg2rad($Angle-90)) * $Weight + $Xb; $Points[] = sin(deg2rad($Angle-90)) * $Weight + $Yb; + $Points[] = cos(deg2rad($Angle-90)) * $Weight + $Xb; $Points[] = sin(deg2rad($Angle-90)) * $Weight + $Yb; $this->drawPolygon($Points,$PolySettings); } @@ -814,14 +814,14 @@ /* Draw a circle */ function drawCircle($Xc,$Yc,$Height,$Width,$Format="") { - $R = isset($Format["R"]) ? $Format["R"] : 0; - $G = isset($Format["G"]) ? $Format["G"] : 0; - $B = isset($Format["B"]) ? $Format["B"] : 0; + $R = isset($Format["R"]) ? $Format["R"] : 0; + $G = isset($Format["G"]) ? $Format["G"] : 0; + $B = isset($Format["B"]) ? $Format["B"] : 0; $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100; $Ticks = isset($Format["Ticks"]) ? $Format["Ticks"] : NULL; - $Height = abs($Height); - $Width = abs($Width); + $Height = abs($Height); + $Width = abs($Width); if ( $Height == 0 ) { $Height = 1; } if ( $Width == 0 ) { $Width = 1; } @@ -866,16 +866,16 @@ /* Draw a filled circle */ function drawFilledCircle($X,$Y,$Radius,$Format="") { - $R = isset($Format["R"]) ? $Format["R"] : 0; - $G = isset($Format["G"]) ? $Format["G"] : 0; - $B = isset($Format["B"]) ? $Format["B"] : 0; - $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100; - $BorderR = isset($Format["BorderR"]) ? $Format["BorderR"] : -1; - $BorderG = isset($Format["BorderG"]) ? $Format["BorderG"] : -1; - $BorderB = isset($Format["BorderB"]) ? $Format["BorderB"] : -1; - $BorderAlpha = isset($Format["BorderAlpha"]) ? $Format["BorderAlpha"] : $Alpha; - $Ticks = isset($Format["Ticks"]) ? $Format["Ticks"] : NULL; - $Surrounding = isset($Format["Surrounding"]) ? $Format["Surrounding"] : NULL; + $R = isset($Format["R"]) ? $Format["R"] : 0; + $G = isset($Format["G"]) ? $Format["G"] : 0; + $B = isset($Format["B"]) ? $Format["B"] : 0; + $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100; + $BorderR = isset($Format["BorderR"]) ? $Format["BorderR"] : -1; + $BorderG = isset($Format["BorderG"]) ? $Format["BorderG"] : -1; + $BorderB = isset($Format["BorderB"]) ? $Format["BorderB"] : -1; + $BorderAlpha = isset($Format["BorderAlpha"]) ? $Format["BorderAlpha"] : $Alpha; + $Ticks = isset($Format["Ticks"]) ? $Format["Ticks"] : NULL; + $Surrounding = isset($Format["Surrounding"]) ? $Format["Surrounding"] : NULL; if ( $Radius == 0 ) { $Radius = 1; } if ( $Surrounding != NULL ) { $BorderR = $R+$Surrounding; $BorderG = $G+$Surrounding; $BorderB = $B+$Surrounding; } @@ -911,37 +911,37 @@ if ( $BorderR != -1 ) $this->drawCircle($X,$Y,$Radius,$Radius,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha,"Ticks"=>$Ticks)); - $this->Shadow = $RestoreShadow; + $this->Shadow = $RestoreShadow; } /* Write text */ function drawText($X,$Y,$Text,$Format="") { - $R = isset($Format["R"]) ? $Format["R"] : $this->FontColorR; - $G = isset($Format["G"]) ? $Format["G"] : $this->FontColorG; - $B = isset($Format["B"]) ? $Format["B"] : $this->FontColorB; - $Angle = isset($Format["Angle"]) ? $Format["Angle"] : 0; - $Align = isset($Format["Align"]) ? $Format["Align"] : TEXT_ALIGN_BOTTOMLEFT; - $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : $this->FontColorA; - $FontName = isset($Format["FontName"]) ? $Format["FontName"] : $this->FontName; - $FontSize = isset($Format["FontSize"]) ? $Format["FontSize"] : $this->FontSize; - $ShowOrigine = isset($Format["ShowOrigine"]) ? $Format["ShowOrigine"] : FALSE; - $TOffset = isset($Format["TOffset"]) ? $Format["TOffset"] : 2; - $DrawBox = isset($Format["DrawBox"]) ? $Format["DrawBox"] : FALSE; - $DrawBoxBorder = isset($Format["DrawBoxBorder"]) ? $Format["DrawBoxBorder"] : TRUE; - $BorderOffset = isset($Format["BorderOffset"]) ? $Format["BorderOffset"] : 6; - $BoxRounded = isset($Format["BoxRounded"]) ? $Format["BoxRounded"] : FALSE; - $RoundedRadius = isset($Format["RoundedRadius"]) ? $Format["RoundedRadius"] : 6; - $BoxR = isset($Format["BoxR"]) ? $Format["BoxR"] : 255; - $BoxG = isset($Format["BoxG"]) ? $Format["BoxG"] : 255; - $BoxB = isset($Format["BoxB"]) ? $Format["BoxB"] : 255; - $BoxAlpha = isset($Format["BoxAlpha"]) ? $Format["BoxAlpha"] : 50; - $BoxSurrounding = isset($Format["BoxSurrounding"]) ? $Format["BoxSurrounding"] : ""; - $BoxBorderR = isset($Format["BoxR"]) ? $Format["BoxR"] : 0; - $BoxBorderG = isset($Format["BoxG"]) ? $Format["BoxG"] : 0; - $BoxBorderB = isset($Format["BoxB"]) ? $Format["BoxB"] : 0; - $BoxBorderAlpha = isset($Format["BoxAlpha"]) ? $Format["BoxAlpha"] : 50; - $NoShadow = isset($Format["NoShadow"]) ? $Format["NoShadow"] : FALSE; + $R = isset($Format["R"]) ? $Format["R"] : $this->FontColorR; + $G = isset($Format["G"]) ? $Format["G"] : $this->FontColorG; + $B = isset($Format["B"]) ? $Format["B"] : $this->FontColorB; + $Angle = isset($Format["Angle"]) ? $Format["Angle"] : 0; + $Align = isset($Format["Align"]) ? $Format["Align"] : TEXT_ALIGN_BOTTOMLEFT; + $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : $this->FontColorA; + $FontName = isset($Format["FontName"]) ? $Format["FontName"] : $this->FontName; + $FontSize = isset($Format["FontSize"]) ? $Format["FontSize"] : $this->FontSize; + $ShowOrigine = isset($Format["ShowOrigine"]) ? $Format["ShowOrigine"] : FALSE; + $TOffset = isset($Format["TOffset"]) ? $Format["TOffset"] : 2; + $DrawBox = isset($Format["DrawBox"]) ? $Format["DrawBox"] : FALSE; + $DrawBoxBorder = isset($Format["DrawBoxBorder"]) ? $Format["DrawBoxBorder"] : TRUE; + $BorderOffset = isset($Format["BorderOffset"]) ? $Format["BorderOffset"] : 6; + $BoxRounded = isset($Format["BoxRounded"]) ? $Format["BoxRounded"] : FALSE; + $RoundedRadius = isset($Format["RoundedRadius"]) ? $Format["RoundedRadius"] : 6; + $BoxR = isset($Format["BoxR"]) ? $Format["BoxR"] : 255; + $BoxG = isset($Format["BoxG"]) ? $Format["BoxG"] : 255; + $BoxB = isset($Format["BoxB"]) ? $Format["BoxB"] : 255; + $BoxAlpha = isset($Format["BoxAlpha"]) ? $Format["BoxAlpha"] : 50; + $BoxSurrounding = isset($Format["BoxSurrounding"]) ? $Format["BoxSurrounding"] : ""; + $BoxBorderR = isset($Format["BoxR"]) ? $Format["BoxR"] : 0; + $BoxBorderG = isset($Format["BoxG"]) ? $Format["BoxG"] : 0; + $BoxBorderB = isset($Format["BoxB"]) ? $Format["BoxB"] : 0; + $BoxBorderAlpha = isset($Format["BoxAlpha"]) ? $Format["BoxAlpha"] : 50; + $NoShadow = isset($Format["NoShadow"]) ? $Format["NoShadow"] : FALSE; $Shadow = $this->Shadow; if ( $NoShadow ) { $this->Shadow = FALSE; } @@ -999,14 +999,14 @@ /* Draw a gradient within a defined area */ function drawGradientArea($X1,$Y1,$X2,$Y2,$Direction,$Format="") { - $StartR = isset($Format["StartR"]) ? $Format["StartR"] : 90; - $StartG = isset($Format["StartG"]) ? $Format["StartG"] : 90; - $StartB = isset($Format["StartB"]) ? $Format["StartB"] : 90; - $EndR = isset($Format["EndR"]) ? $Format["EndR"] : 0; - $EndG = isset($Format["EndG"]) ? $Format["EndG"] : 0; - $EndB = isset($Format["EndB"]) ? $Format["EndB"] : 0; - $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100; - $Levels = isset($Format["Levels"]) ? $Format["Levels"] : NULL; + $StartR = isset($Format["StartR"]) ? $Format["StartR"] : 90; + $StartG = isset($Format["StartG"]) ? $Format["StartG"] : 90; + $StartB = isset($Format["StartB"]) ? $Format["StartB"] : 90; + $EndR = isset($Format["EndR"]) ? $Format["EndR"] : 0; + $EndG = isset($Format["EndG"]) ? $Format["EndG"] : 0; + $EndB = isset($Format["EndB"]) ? $Format["EndB"] : 0; + $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100; + $Levels = isset($Format["Levels"]) ? $Format["Levels"] : NULL; $Shadow = $this->Shadow; $this->Shadow = FALSE; @@ -1250,17 +1250,17 @@ /* Draw an arrow */ function drawArrow($X1,$Y1,$X2,$Y2,$Format="") { - $FillR = isset($Format["FillR"]) ? $Format["FillR"] : 0; - $FillG = isset($Format["FillG"]) ? $Format["FillG"] : 0; - $FillB = isset($Format["FillB"]) ? $Format["FillB"] : 0; - $BorderR = isset($Format["BorderR"]) ? $Format["BorderR"] : $FillR; - $BorderG = isset($Format["BorderG"]) ? $Format["BorderG"] : $FillG; - $BorderB = isset($Format["BorderB"]) ? $Format["BorderB"] : $FillB; - $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100; - $Size = isset($Format["Size"]) ? $Format["Size"] : 10; - $Ratio = isset($Format["Ratio"]) ? $Format["Ratio"] : .5; - $TwoHeads = isset($Format["TwoHeads"]) ? $Format["TwoHeads"] : FALSE; - $Ticks = isset($Format["Ticks"]) ? $Format["Ticks"] : FALSE; + $FillR = isset($Format["FillR"]) ? $Format["FillR"] : 0; + $FillG = isset($Format["FillG"]) ? $Format["FillG"] : 0; + $FillB = isset($Format["FillB"]) ? $Format["FillB"] : 0; + $BorderR = isset($Format["BorderR"]) ? $Format["BorderR"] : $FillR; + $BorderG = isset($Format["BorderG"]) ? $Format["BorderG"] : $FillG; + $BorderB = isset($Format["BorderB"]) ? $Format["BorderB"] : $FillB; + $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100; + $Size = isset($Format["Size"]) ? $Format["Size"] : 10; + $Ratio = isset($Format["Ratio"]) ? $Format["Ratio"] : .5; + $TwoHeads = isset($Format["TwoHeads"]) ? $Format["TwoHeads"] : FALSE; + $Ticks = isset($Format["Ticks"]) ? $Format["Ticks"] : FALSE; /* Calculate the line angle */ $Angle = $this->getAngle($X1,$Y1,$X2,$Y2); @@ -1277,10 +1277,10 @@ $TailX = cos(($Angle-180)*PI/180)*$Size+$X2; $TailY = sin(($Angle-180)*PI/180)*$Size+$Y2; - $Points = ""; + $Points = ""; $Points[] = $X2; $Points[] = $Y2; - $Points[] = cos(($Angle-90)*PI/180)*$Size*$Ratio+$TailX; $Points[] = sin(($Angle-90)*PI/180)*$Size*$Ratio+$TailY; - $Points[] = cos(($Angle-270)*PI/180)*$Size*$Ratio+$TailX; $Points[] = sin(($Angle-270)*PI/180)*$Size*$Ratio+$TailY; + $Points[] = cos(($Angle-90)*PI/180)*$Size*$Ratio+$TailX; $Points[] = sin(($Angle-90)*PI/180)*$Size*$Ratio+$TailY; + $Points[] = cos(($Angle-270)*PI/180)*$Size*$Ratio+$TailX; $Points[] = sin(($Angle-270)*PI/180)*$Size*$Ratio+$TailY; $Points[] = $X2; $Points[] = $Y2; /* Visual correction */ @@ -1357,9 +1357,9 @@ $this->drawArrow($X2,$Y2,$X1,$Y1,$Format); - $Size = imagettfbbox($FontSize,0,$FontName,$Text); - $TxtWidth = max(abs($Size[2]-$Size[0]),abs($Size[0]-$Size[6])); - $TxtHeight = max(abs($Size[1]-$Size[7]),abs($Size[3]-$Size[1])); + $Size = imagettfbbox($FontSize,0,$FontName,$Text); + $TxtWidth = max(abs($Size[2]-$Size[0]),abs($Size[0]-$Size[6])); + $TxtHeight = max(abs($Size[1]-$Size[7]),abs($Size[3]-$Size[1])); if ( $Angle > 0 && $Angle < 180 ) { @@ -1385,31 +1385,31 @@ if ( $Percent > 100 ) { $Percent = 100; } if ( $Percent < 0 ) { $Percent = 0; } - $Width = isset($Format["Width"]) ? $Format["Width"] : 200; - $Height = isset($Format["Height"]) ? $Format["Height"] : 20; + $Width = isset($Format["Width"]) ? $Format["Width"] : 200; + $Height = isset($Format["Height"]) ? $Format["Height"] : 20; $Orientation = isset($Format["Orientation"]) ? $Format["Orientation"] : ORIENTATION_HORIZONTAL; $ShowLabel = isset($Format["ShowLabel"]) ? $Format["ShowLabel"] : FALSE; - $LabelPos = isset($Format["LabelPos"]) ? $Format["LabelPos"] : LABEL_POS_INSIDE; + $LabelPos = isset($Format["LabelPos"]) ? $Format["LabelPos"] : LABEL_POS_INSIDE; $Margin = isset($Format["Margin"]) ? $Format["Margin"] : 10; - $R = isset($Format["R"]) ? $Format["R"] : 130; - $G = isset($Format["G"]) ? $Format["G"] : 130; - $B = isset($Format["B"]) ? $Format["B"] : 130; - $RFade = isset($Format["RFade"]) ? $Format["RFade"] : -1; - $GFade = isset($Format["GFade"]) ? $Format["GFade"] : -1; - $BFade = isset($Format["BFade"]) ? $Format["BFade"] : -1; - $BorderR = isset($Format["BorderR"]) ? $Format["BorderR"] : $R; - $BorderG = isset($Format["BorderG"]) ? $Format["BorderG"] : $G; - $BorderB = isset($Format["BorderB"]) ? $Format["BorderB"] : $B; + $R = isset($Format["R"]) ? $Format["R"] : 130; + $G = isset($Format["G"]) ? $Format["G"] : 130; + $B = isset($Format["B"]) ? $Format["B"] : 130; + $RFade = isset($Format["RFade"]) ? $Format["RFade"] : -1; + $GFade = isset($Format["GFade"]) ? $Format["GFade"] : -1; + $BFade = isset($Format["BFade"]) ? $Format["BFade"] : -1; + $BorderR = isset($Format["BorderR"]) ? $Format["BorderR"] : $R; + $BorderG = isset($Format["BorderG"]) ? $Format["BorderG"] : $G; + $BorderB = isset($Format["BorderB"]) ? $Format["BorderB"] : $B; $BoxBorderR = isset($Format["BoxBorderR"]) ? $Format["BoxBorderR"] : 0; $BoxBorderG = isset($Format["BoxBorderG"]) ? $Format["BoxBorderG"] : 0; $BoxBorderB = isset($Format["BoxBorderB"]) ? $Format["BoxBorderB"] : 0; - $BoxBackR = isset($Format["BoxBackR"]) ? $Format["BoxBackR"] : 255; - $BoxBackG = isset($Format["BoxBackG"]) ? $Format["BoxBackG"] : 255; - $BoxBackB = isset($Format["BoxBackB"]) ? $Format["BoxBackB"] : 255; - $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100; + $BoxBackR = isset($Format["BoxBackR"]) ? $Format["BoxBackR"] : 255; + $BoxBackG = isset($Format["BoxBackG"]) ? $Format["BoxBackG"] : 255; + $BoxBackB = isset($Format["BoxBackB"]) ? $Format["BoxBackB"] : 255; + $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100; $Surrounding = isset($Format["Surrounding"]) ? $Format["Surrounding"] : NULL; $BoxSurrounding = isset($Format["BoxSurrounding"]) ? $Format["BoxSurrounding"] : NULL; - $NoAngle = isset($Format["NoAngle"]) ? $Format["NoAngle"] : FALSE; + $NoAngle = isset($Format["NoAngle"]) ? $Format["NoAngle"] : FALSE; if ( $RFade != -1 && $GFade != -1 && $BFade != -1 ) { @@ -1440,10 +1440,10 @@ $this->Shadow = $RestoreShadow; - if ( $ShowLabel && $LabelPos == LABEL_POS_BOTTOM ) { $this->drawText($X+($Width/2),$Y+$Margin,$Percent."%",array("Align"=>TEXT_ALIGN_TOPMIDDLE)); } - if ( $ShowLabel && $LabelPos == LABEL_POS_TOP ) { $this->drawText($X+($Width/2),$Y-$Height-$Margin,$Percent."%",array("Align"=>TEXT_ALIGN_BOTTOMMIDDLE)); } - if ( $ShowLabel && $LabelPos == LABEL_POS_INSIDE ) { $this->drawText($X+($Width/2),$Y-$InnerHeight-$Margin,$Percent."%",array("Align"=>TEXT_ALIGN_MIDDLELEFT,"Angle"=>90)); } - if ( $ShowLabel && $LabelPos == LABEL_POS_CENTER ) { $this->drawText($X+($Width/2),$Y-($Height/2),$Percent."%",array("Align"=>TEXT_ALIGN_MIDDLEMIDDLE,"Angle"=>90)); } + if ( $ShowLabel && $LabelPos == LABEL_POS_BOTTOM ) { $this->drawText($X+($Width/2),$Y+$Margin,$Percent."%",array("Align"=>TEXT_ALIGN_TOPMIDDLE)); } + if ( $ShowLabel && $LabelPos == LABEL_POS_TOP ) { $this->drawText($X+($Width/2),$Y-$Height-$Margin,$Percent."%",array("Align"=>TEXT_ALIGN_BOTTOMMIDDLE)); } + if ( $ShowLabel && $LabelPos == LABEL_POS_INSIDE ) { $this->drawText($X+($Width/2),$Y-$InnerHeight-$Margin,$Percent."%",array("Align"=>TEXT_ALIGN_MIDDLELEFT,"Angle"=>90)); } + if ( $ShowLabel && $LabelPos == LABEL_POS_CENTER ) { $this->drawText($X+($Width/2),$Y-($Height/2),$Percent."%",array("Align"=>TEXT_ALIGN_MIDDLEMIDDLE,"Angle"=>90)); } } else { @@ -1468,27 +1468,27 @@ $this->Shadow = $RestoreShadow; - if ( $ShowLabel && $LabelPos == LABEL_POS_LEFT ) { $this->drawText($X-$Margin,$Y+($Height/2),$Percent."%",array("Align"=>TEXT_ALIGN_MIDDLERIGHT)); } - if ( $ShowLabel && $LabelPos == LABEL_POS_RIGHT ) { $this->drawText($X+$Width+$Margin,$Y+($Height/2),$Percent."%",array("Align"=>TEXT_ALIGN_MIDDLELEFT)); } - if ( $ShowLabel && $LabelPos == LABEL_POS_CENTER ) { $this->drawText($X+($Width/2),$Y+($Height/2),$Percent."%",array("Align"=>TEXT_ALIGN_MIDDLEMIDDLE)); } - if ( $ShowLabel && $LabelPos == LABEL_POS_INSIDE ) { $this->drawText($X+$InnerWidth+$Margin,$Y+($Height/2),$Percent."%",array("Align"=>TEXT_ALIGN_MIDDLELEFT)); } + if ( $ShowLabel && $LabelPos == LABEL_POS_LEFT ) { $this->drawText($X-$Margin,$Y+($Height/2),$Percent."%",array("Align"=>TEXT_ALIGN_MIDDLERIGHT)); } + if ( $ShowLabel && $LabelPos == LABEL_POS_RIGHT ) { $this->drawText($X+$Width+$Margin,$Y+($Height/2),$Percent."%",array("Align"=>TEXT_ALIGN_MIDDLELEFT)); } + if ( $ShowLabel && $LabelPos == LABEL_POS_CENTER ) { $this->drawText($X+($Width/2),$Y+($Height/2),$Percent."%",array("Align"=>TEXT_ALIGN_MIDDLEMIDDLE)); } + if ( $ShowLabel && $LabelPos == LABEL_POS_INSIDE ) { $this->drawText($X+$InnerWidth+$Margin,$Y+($Height/2),$Percent."%",array("Align"=>TEXT_ALIGN_MIDDLELEFT)); } } } /* Get the legend box size */ function getLegendSize($Format="") { - $FontName = isset($Format["FontName"]) ? $Format["FontName"] : $this->FontName; - $FontSize = isset($Format["FontSize"]) ? $Format["FontSize"] : $this->FontSize; - $BoxSize = isset($Format["BoxSize"]) ? $Format["BoxSize"] : 5; - $Margin = isset($Format["Margin"]) ? $Format["Margin"] : 5; - $Style = isset($Format["Style"]) ? $Format["Style"] : LEGEND_ROUND; - $Mode = isset($Format["Mode"]) ? $Format["Mode"] : LEGEND_VERTICAL; - $BoxWidth = isset($Format["BoxWidth"]) ? $Format["BoxWidth"] : 5; - $BoxHeight = isset($Format["BoxHeight"]) ? $Format["BoxHeight"] : 5; - $IconAreaWidth = isset($Format["IconAreaWidth"]) ? $Format["IconAreaWidth"] : $BoxWidth; - $IconAreaHeight = isset($Format["IconAreaHeight"]) ? $Format["IconAreaHeight"] : $BoxHeight; - $XSpacing = isset($Format["XSpacing"]) ? $Format["XSpacing"] : 5; + $FontName = isset($Format["FontName"]) ? $Format["FontName"] : $this->FontName; + $FontSize = isset($Format["FontSize"]) ? $Format["FontSize"] : $this->FontSize; + $BoxSize = isset($Format["BoxSize"]) ? $Format["BoxSize"] : 5; + $Margin = isset($Format["Margin"]) ? $Format["Margin"] : 5; + $Style = isset($Format["Style"]) ? $Format["Style"] : LEGEND_ROUND; + $Mode = isset($Format["Mode"]) ? $Format["Mode"] : LEGEND_VERTICAL; + $BoxWidth = isset($Format["BoxWidth"]) ? $Format["BoxWidth"] : 5; + $BoxHeight = isset($Format["BoxHeight"]) ? $Format["BoxHeight"] : 5; + $IconAreaWidth = isset($Format["IconAreaWidth"]) ? $Format["IconAreaWidth"] : $BoxWidth; + $IconAreaHeight = isset($Format["IconAreaHeight"]) ? $Format["IconAreaHeight"] : $BoxHeight; + $XSpacing = isset($Format["XSpacing"]) ? $Format["XSpacing"] : 5; $Data = $this->DataSet->getData(); @@ -1557,28 +1557,28 @@ /* Draw the legend of the active series */ function drawLegend($X,$Y,$Format="") { - $Family = isset($Format["Family"]) ? $Format["Family"] : LEGEND_FAMILY_BOX; - $FontName = isset($Format["FontName"]) ? $Format["FontName"] : $this->FontName; - $FontSize = isset($Format["FontSize"]) ? $Format["FontSize"] : $this->FontSize; - $FontR = isset($Format["FontR"]) ? $Format["FontR"] : $this->FontColorR; - $FontG = isset($Format["FontG"]) ? $Format["FontG"] : $this->FontColorG; - $FontB = isset($Format["FontB"]) ? $Format["FontB"] : $this->FontColorB; - $BoxWidth = isset($Format["BoxWidth"]) ? $Format["BoxWidth"] : 5; - $BoxHeight = isset($Format["BoxHeight"]) ? $Format["BoxHeight"] : 5; - $IconAreaWidth = isset($Format["IconAreaWidth"]) ? $Format["IconAreaWidth"] : $BoxWidth; - $IconAreaHeight = isset($Format["IconAreaHeight"]) ? $Format["IconAreaHeight"] : $BoxHeight; - $XSpacing = isset($Format["XSpacing"]) ? $Format["XSpacing"] : 5; - $Margin = isset($Format["Margin"]) ? $Format["Margin"] : 5; - $R = isset($Format["R"]) ? $Format["R"] : 200; - $G = isset($Format["G"]) ? $Format["G"] : 200; - $B = isset($Format["B"]) ? $Format["B"] : 200; - $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100; - $BorderR = isset($Format["BorderR"]) ? $Format["BorderR"] : 255; - $BorderG = isset($Format["BorderG"]) ? $Format["BorderG"] : 255; - $BorderB = isset($Format["BorderB"]) ? $Format["BorderB"] : 255; + $Family = isset($Format["Family"]) ? $Format["Family"] : LEGEND_FAMILY_BOX; + $FontName = isset($Format["FontName"]) ? $Format["FontName"] : $this->FontName; + $FontSize = isset($Format["FontSize"]) ? $Format["FontSize"] : $this->FontSize; + $FontR = isset($Format["FontR"]) ? $Format["FontR"] : $this->FontColorR; + $FontG = isset($Format["FontG"]) ? $Format["FontG"] : $this->FontColorG; + $FontB = isset($Format["FontB"]) ? $Format["FontB"] : $this->FontColorB; + $BoxWidth = isset($Format["BoxWidth"]) ? $Format["BoxWidth"] : 5; + $BoxHeight = isset($Format["BoxHeight"]) ? $Format["BoxHeight"] : 5; + $IconAreaWidth = isset($Format["IconAreaWidth"]) ? $Format["IconAreaWidth"] : $BoxWidth; + $IconAreaHeight = isset($Format["IconAreaHeight"]) ? $Format["IconAreaHeight"] : $BoxHeight; + $XSpacing = isset($Format["XSpacing"]) ? $Format["XSpacing"] : 5; + $Margin = isset($Format["Margin"]) ? $Format["Margin"] : 5; + $R = isset($Format["R"]) ? $Format["R"] : 200; + $G = isset($Format["G"]) ? $Format["G"] : 200; + $B = isset($Format["B"]) ? $Format["B"] : 200; + $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100; + $BorderR = isset($Format["BorderR"]) ? $Format["BorderR"] : 255; + $BorderG = isset($Format["BorderG"]) ? $Format["BorderG"] : 255; + $BorderB = isset($Format["BorderB"]) ? $Format["BorderB"] : 255; $Surrounding = isset($Format["Surrounding"]) ? $Format["Surrounding"] : NULL; - $Style = isset($Format["Style"]) ? $Format["Style"] : LEGEND_ROUND; - $Mode = isset($Format["Mode"]) ? $Format["Mode"] : LEGEND_VERTICAL; + $Style = isset($Format["Style"]) ? $Format["Style"] : LEGEND_ROUND; + $Mode = isset($Format["Mode"]) ? $Format["Mode"] : LEGEND_VERTICAL; if ( $Surrounding != NULL ) { $BorderR = $R + $Surrounding; $BorderG = $G + $Surrounding; $BorderB = $B + $Surrounding; } @@ -1709,68 +1709,68 @@ function drawScale($Format="") { - $Pos = isset($Format["Pos"]) ? $Format["Pos"] : SCALE_POS_LEFTRIGHT; - $Floating = isset($Format["Floating"]) ? $Format["Floating"] : FALSE; - $Mode = isset($Format["Mode"]) ? $Format["Mode"] : SCALE_MODE_FLOATING; - $RemoveXAxis = isset($Format["RemoveXAxis"]) ? $Format["RemoveXAxis"] : FALSE; - $MinDivHeight = isset($Format["MinDivHeight"]) ? $Format["MinDivHeight"] : 20; - $Factors = isset($Format["Factors"]) ? $Format["Factors"] : array(1,2,5); - $ManualScale = isset($Format["ManualScale"]) ? $Format["ManualScale"] : array("0"=>array("Min"=>-100,"Max"=>100)); - $XMargin = isset($Format["XMargin"]) ? $Format["XMargin"] : AUTO; - $YMargin = isset($Format["YMargin"]) ? $Format["YMargin"] : 0; - $ScaleSpacing = isset($Format["ScaleSpacing"]) ? $Format["ScaleSpacing"] : 15; - $InnerTickWidth = isset($Format["InnerTickWidth"]) ? $Format["InnerTickWidth"] : 2; - $OuterTickWidth = isset($Format["OuterTickWidth"]) ? $Format["OuterTickWidth"] : 2; - $DrawXLines = isset($Format["DrawXLines"]) ? $Format["DrawXLines"] : TRUE; - $DrawYLines = isset($Format["DrawYLines"]) ? $Format["DrawYLines"] : ALL; - $GridTicks = isset($Format["GridTicks"]) ? $Format["GridTicks"] : 4; - $GridR = isset($Format["GridR"]) ? $Format["GridR"] : 255; - $GridG = isset($Format["GridG"]) ? $Format["GridG"] : 255; - $GridB = isset($Format["GridB"]) ? $Format["GridB"] : 255; - $GridAlpha = isset($Format["GridAlpha"]) ? $Format["GridAlpha"] : 40; - $AxisRo = isset($Format["AxisR"]) ? $Format["AxisR"] : 0; - $AxisGo = isset($Format["AxisG"]) ? $Format["AxisG"] : 0; - $AxisBo = isset($Format["AxisB"]) ? $Format["AxisB"] : 0; - $AxisAlpha = isset($Format["AxisAlpha"]) ? $Format["AxisAlpha"] : 100; - $TickRo = isset($Format["TickR"]) ? $Format["TickR"] : 0; - $TickGo = isset($Format["TickG"]) ? $Format["TickG"] : 0; - $TickBo = isset($Format["TickB"]) ? $Format["TickB"] : 0; - $TickAlpha = isset($Format["TickAlpha"]) ? $Format["TickAlpha"] : 100; - $DrawSubTicks = isset($Format["DrawSubTicks"]) ? $Format["DrawSubTicks"] : FALSE; - $InnerSubTickWidth = isset($Format["InnerSubTickWidth"]) ? $Format["InnerSubTickWidth"] : 0; - $OuterSubTickWidth = isset($Format["OuterSubTickWidth"]) ? $Format["OuterSubTickWidth"] : 2; - $SubTickR = isset($Format["SubTickR"]) ? $Format["SubTickR"] : 255; - $SubTickG = isset($Format["SubTickG"]) ? $Format["SubTickG"] : 0; - $SubTickB = isset($Format["SubTickB"]) ? $Format["SubTickB"] : 0; - $SubTickAlpha = isset($Format["SubTickAlpha"]) ? $Format["SubTickAlpha"] : 100; - $AutoAxisLabels = isset($Format["AutoAxisLabels"]) ? $Format["AutoAxisLabels"] : TRUE; - $XReleasePercent = isset($Format["XReleasePercent"]) ? $Format["XReleasePercent"] : 1; - $DrawArrows = isset($Format["DrawArrows"]) ? $Format["DrawArrows"] : FALSE; + $Pos = isset($Format["Pos"]) ? $Format["Pos"] : SCALE_POS_LEFTRIGHT; + $Floating = isset($Format["Floating"]) ? $Format["Floating"] : FALSE; + $Mode = isset($Format["Mode"]) ? $Format["Mode"] : SCALE_MODE_FLOATING; + $RemoveXAxis = isset($Format["RemoveXAxis"]) ? $Format["RemoveXAxis"] : FALSE; + $MinDivHeight = isset($Format["MinDivHeight"]) ? $Format["MinDivHeight"] : 20; + $Factors = isset($Format["Factors"]) ? $Format["Factors"] : array(1,2,5); + $ManualScale = isset($Format["ManualScale"]) ? $Format["ManualScale"] : array("0"=>array("Min"=>-100,"Max"=>100)); + $XMargin = isset($Format["XMargin"]) ? $Format["XMargin"] : AUTO; + $YMargin = isset($Format["YMargin"]) ? $Format["YMargin"] : 0; + $ScaleSpacing = isset($Format["ScaleSpacing"]) ? $Format["ScaleSpacing"] : 15; + $InnerTickWidth = isset($Format["InnerTickWidth"]) ? $Format["InnerTickWidth"] : 2; + $OuterTickWidth = isset($Format["OuterTickWidth"]) ? $Format["OuterTickWidth"] : 2; + $DrawXLines = isset($Format["DrawXLines"]) ? $Format["DrawXLines"] : TRUE; + $DrawYLines = isset($Format["DrawYLines"]) ? $Format["DrawYLines"] : ALL; + $GridTicks = isset($Format["GridTicks"]) ? $Format["GridTicks"] : 4; + $GridR = isset($Format["GridR"]) ? $Format["GridR"] : 255; + $GridG = isset($Format["GridG"]) ? $Format["GridG"] : 255; + $GridB = isset($Format["GridB"]) ? $Format["GridB"] : 255; + $GridAlpha = isset($Format["GridAlpha"]) ? $Format["GridAlpha"] : 40; + $AxisRo = isset($Format["AxisR"]) ? $Format["AxisR"] : 0; + $AxisGo = isset($Format["AxisG"]) ? $Format["AxisG"] : 0; + $AxisBo = isset($Format["AxisB"]) ? $Format["AxisB"] : 0; + $AxisAlpha = isset($Format["AxisAlpha"]) ? $Format["AxisAlpha"] : 100; + $TickRo = isset($Format["TickR"]) ? $Format["TickR"] : 0; + $TickGo = isset($Format["TickG"]) ? $Format["TickG"] : 0; + $TickBo = isset($Format["TickB"]) ? $Format["TickB"] : 0; + $TickAlpha = isset($Format["TickAlpha"]) ? $Format["TickAlpha"] : 100; + $DrawSubTicks = isset($Format["DrawSubTicks"]) ? $Format["DrawSubTicks"] : FALSE; + $InnerSubTickWidth = isset($Format["InnerSubTickWidth"]) ? $Format["InnerSubTickWidth"] : 0; + $OuterSubTickWidth = isset($Format["OuterSubTickWidth"]) ? $Format["OuterSubTickWidth"] : 2; + $SubTickR = isset($Format["SubTickR"]) ? $Format["SubTickR"] : 255; + $SubTickG = isset($Format["SubTickG"]) ? $Format["SubTickG"] : 0; + $SubTickB = isset($Format["SubTickB"]) ? $Format["SubTickB"] : 0; + $SubTickAlpha = isset($Format["SubTickAlpha"]) ? $Format["SubTickAlpha"] : 100; + $AutoAxisLabels = isset($Format["AutoAxisLabels"]) ? $Format["AutoAxisLabels"] : TRUE; + $XReleasePercent = isset($Format["XReleasePercent"]) ? $Format["XReleasePercent"] : 1; + $DrawArrows = isset($Format["DrawArrows"]) ? $Format["DrawArrows"] : FALSE; $ArrowSize = isset($Format["ArrowSize"]) ? $Format["ArrowSize"] : 8; - $CycleBackground = isset($Format["CycleBackground"]) ? $Format["CycleBackground"] : FALSE; - $BackgroundR1 = isset($Format["BackgroundR1"]) ? $Format["BackgroundR1"] : 255; - $BackgroundG1 = isset($Format["BackgroundG1"]) ? $Format["BackgroundG1"] : 255; - $BackgroundB1 = isset($Format["BackgroundB1"]) ? $Format["BackgroundB1"] : 255; - $BackgroundAlpha1 = isset($Format["BackgroundAlpha1"]) ? $Format["BackgroundAlpha1"] : 20; - $BackgroundR2 = isset($Format["BackgroundR2"]) ? $Format["BackgroundR2"] : 230; - $BackgroundG2 = isset($Format["BackgroundG2"]) ? $Format["BackgroundG2"] : 230; - $BackgroundB2 = isset($Format["BackgroundB2"]) ? $Format["BackgroundB2"] : 230; - $BackgroundAlpha2 = isset($Format["BackgroundAlpha2"]) ? $Format["BackgroundAlpha2"] : 20; - $LabelingMethod = isset($Format["LabelingMethod"]) ? $Format["LabelingMethod"] : LABELING_ALL; - $LabelSkip = isset($Format["LabelSkip"]) ? $Format["LabelSkip"] : 0; - $LabelRotation = isset($Format["LabelRotation"]) ? $Format["LabelRotation"] : 0; - $RemoveSkippedAxis = isset($Format["RemoveSkippedAxis"]) ? $Format["RemoveSkippedAxis"] : FALSE; - $SkippedAxisTicks = isset($Format["SkippedAxisTicks"]) ? $Format["SkippedAxisTicks"] : $GridTicks+2; - $SkippedAxisR = isset($Format["SkippedAxisR"]) ? $Format["SkippedAxisR"] : $GridR; - $SkippedAxisG = isset($Format["SkippedAxisG"]) ? $Format["SkippedAxisG"] : $GridG; - $SkippedAxisB = isset($Format["SkippedAxisB"]) ? $Format["SkippedAxisB"] : $GridB; - $SkippedAxisAlpha = isset($Format["SkippedAxisAlpha"]) ? $Format["SkippedAxisAlpha"] : $GridAlpha-30; - $SkippedTickR = isset($Format["SkippedTickR"]) ? $Format["SkippedTickR"] : $TickRo; - $SkippedTickG = isset($Format["SkippedTickG"]) ? $Format["SkippedTickG"] : $TickGo; - $SkippedTickB = isset($Format["SkippedTicksB"]) ? $Format["SkippedTickB"] : $TickBo; - $SkippedTickAlpha = isset($Format["SkippedTickAlpha"]) ? $Format["SkippedTickAlpha"] : $TickAlpha-80; - $SkippedInnerTickWidth = isset($Format["SkippedInnerTickWidth"]) ? $Format["SkippedInnerTickWidth"] : 0; - $SkippedOuterTickWidth = isset($Format["SkippedOuterTickWidth"]) ? $Format["SkippedOuterTickWidth"] : 2; + $CycleBackground = isset($Format["CycleBackground"]) ? $Format["CycleBackground"] : FALSE; + $BackgroundR1 = isset($Format["BackgroundR1"]) ? $Format["BackgroundR1"] : 255; + $BackgroundG1 = isset($Format["BackgroundG1"]) ? $Format["BackgroundG1"] : 255; + $BackgroundB1 = isset($Format["BackgroundB1"]) ? $Format["BackgroundB1"] : 255; + $BackgroundAlpha1 = isset($Format["BackgroundAlpha1"]) ? $Format["BackgroundAlpha1"] : 20; + $BackgroundR2 = isset($Format["BackgroundR2"]) ? $Format["BackgroundR2"] : 230; + $BackgroundG2 = isset($Format["BackgroundG2"]) ? $Format["BackgroundG2"] : 230; + $BackgroundB2 = isset($Format["BackgroundB2"]) ? $Format["BackgroundB2"] : 230; + $BackgroundAlpha2 = isset($Format["BackgroundAlpha2"]) ? $Format["BackgroundAlpha2"] : 20; + $LabelingMethod = isset($Format["LabelingMethod"]) ? $Format["LabelingMethod"] : LABELING_ALL; + $LabelSkip = isset($Format["LabelSkip"]) ? $Format["LabelSkip"] : 0; + $LabelRotation = isset($Format["LabelRotation"]) ? $Format["LabelRotation"] : 0; + $RemoveSkippedAxis = isset($Format["RemoveSkippedAxis"]) ? $Format["RemoveSkippedAxis"] : FALSE; + $SkippedAxisTicks = isset($Format["SkippedAxisTicks"]) ? $Format["SkippedAxisTicks"] : $GridTicks+2; + $SkippedAxisR = isset($Format["SkippedAxisR"]) ? $Format["SkippedAxisR"] : $GridR; + $SkippedAxisG = isset($Format["SkippedAxisG"]) ? $Format["SkippedAxisG"] : $GridG; + $SkippedAxisB = isset($Format["SkippedAxisB"]) ? $Format["SkippedAxisB"] : $GridB; + $SkippedAxisAlpha = isset($Format["SkippedAxisAlpha"]) ? $Format["SkippedAxisAlpha"] : $GridAlpha-30; + $SkippedTickR = isset($Format["SkippedTickR"]) ? $Format["SkippedTickR"] : $TickRo; + $SkippedTickG = isset($Format["SkippedTickG"]) ? $Format["SkippedTickG"] : $TickGo; + $SkippedTickB = isset($Format["SkippedTicksB"]) ? $Format["SkippedTickB"] : $TickBo; + $SkippedTickAlpha = isset($Format["SkippedTickAlpha"]) ? $Format["SkippedTickAlpha"] : $TickAlpha-80; + $SkippedInnerTickWidth = isset($Format["SkippedInnerTickWidth"]) ? $Format["SkippedInnerTickWidth"] : 0; + $SkippedOuterTickWidth = isset($Format["SkippedOuterTickWidth"]) ? $Format["SkippedOuterTickWidth"] : 2; /* Floating scale require X & Y margins to be set manually */ if ( $Floating && ( $XMargin == AUTO || $YMargin == 0 ) ) { $Floating = FALSE; } @@ -1958,10 +1958,10 @@ { if ( $Parameters["Position"] == AXIS_POSITION_BOTTOM ) { - if ( $LabelRotation == 0 ) { $LabelAlign = TEXT_ALIGN_TOPMIDDLE; $YLabelOffset = 2; } - if ( $LabelRotation > 0 && $LabelRotation < 190 ) { $LabelAlign = TEXT_ALIGN_MIDDLERIGHT; $YLabelOffset = 5; } - if ( $LabelRotation == 180 ) { $LabelAlign = TEXT_ALIGN_BOTTOMMIDDLE; $YLabelOffset = 5; } - if ( $LabelRotation > 180 && $LabelRotation < 360 ) { $LabelAlign = TEXT_ALIGN_MIDDLELEFT; $YLabelOffset = 2; } + if ( $LabelRotation == 0 ) { $LabelAlign = TEXT_ALIGN_TOPMIDDLE; $YLabelOffset = 2; } + if ( $LabelRotation > 0 && $LabelRotation < 190 ) { $LabelAlign = TEXT_ALIGN_MIDDLERIGHT; $YLabelOffset = 5; } + if ( $LabelRotation == 180 ) { $LabelAlign = TEXT_ALIGN_BOTTOMMIDDLE; $YLabelOffset = 5; } + if ( $LabelRotation > 180 && $LabelRotation < 360 ) { $LabelAlign = TEXT_ALIGN_MIDDLELEFT; $YLabelOffset = 2; } if ( !$RemoveXAxis ) { @@ -2031,10 +2031,10 @@ } elseif ( $Parameters["Position"] == AXIS_POSITION_TOP ) { - if ( $LabelRotation == 0 ) { $LabelAlign = TEXT_ALIGN_BOTTOMMIDDLE; $YLabelOffset = 2; } - if ( $LabelRotation > 0 && $LabelRotation < 190 ) { $LabelAlign = TEXT_ALIGN_MIDDLELEFT; $YLabelOffset = 2; } - if ( $LabelRotation == 180 ) { $LabelAlign = TEXT_ALIGN_TOPMIDDLE; $YLabelOffset = 5; } - if ( $LabelRotation > 180 && $LabelRotation < 360 ) { $LabelAlign = TEXT_ALIGN_MIDDLERIGHT; $YLabelOffset = 5; } + if ( $LabelRotation == 0 ) { $LabelAlign = TEXT_ALIGN_BOTTOMMIDDLE; $YLabelOffset = 2; } + if ( $LabelRotation > 0 && $LabelRotation < 190 ) { $LabelAlign = TEXT_ALIGN_MIDDLELEFT; $YLabelOffset = 2; } + if ( $LabelRotation == 180 ) { $LabelAlign = TEXT_ALIGN_TOPMIDDLE; $YLabelOffset = 5; } + if ( $LabelRotation > 180 && $LabelRotation < 360 ) { $LabelAlign = TEXT_ALIGN_MIDDLERIGHT; $YLabelOffset = 5; } if ( !$RemoveXAxis ) { @@ -2108,10 +2108,10 @@ { if ( $Parameters["Position"] == AXIS_POSITION_LEFT ) { - if ( $LabelRotation == 0 ) { $LabelAlign = TEXT_ALIGN_MIDDLERIGHT; $XLabelOffset = -2; } - if ( $LabelRotation > 0 && $LabelRotation < 190 ) { $LabelAlign = TEXT_ALIGN_MIDDLERIGHT; $XLabelOffset = -6; } - if ( $LabelRotation == 180 ) { $LabelAlign = TEXT_ALIGN_MIDDLELEFT; $XLabelOffset = -2; } - if ( $LabelRotation > 180 && $LabelRotation < 360 ) { $LabelAlign = TEXT_ALIGN_MIDDLELEFT; $XLabelOffset = -5; } + if ( $LabelRotation == 0 ) { $LabelAlign = TEXT_ALIGN_MIDDLERIGHT; $XLabelOffset = -2; } + if ( $LabelRotation > 0 && $LabelRotation < 190 ) { $LabelAlign = TEXT_ALIGN_MIDDLERIGHT; $XLabelOffset = -6; } + if ( $LabelRotation == 180 ) { $LabelAlign = TEXT_ALIGN_MIDDLELEFT; $XLabelOffset = -2; } + if ( $LabelRotation > 180 && $LabelRotation < 360 ) { $LabelAlign = TEXT_ALIGN_MIDDLELEFT; $XLabelOffset = -5; } if ( !$RemoveXAxis ) { @@ -2181,10 +2181,10 @@ } elseif ( $Parameters["Position"] == AXIS_POSITION_RIGHT ) { - if ( $LabelRotation == 0 ) { $LabelAlign = TEXT_ALIGN_MIDDLELEFT; $XLabelOffset = 2; } - if ( $LabelRotation > 0 && $LabelRotation < 190 ) { $LabelAlign = TEXT_ALIGN_MIDDLELEFT; $XLabelOffset = 6; } - if ( $LabelRotation == 180 ) { $LabelAlign = TEXT_ALIGN_MIDDLERIGHT; $XLabelOffset = 5; } - if ( $LabelRotation > 180 && $LabelRotation < 360 ) { $LabelAlign = TEXT_ALIGN_MIDDLERIGHT; $XLabelOffset = 7; } + if ( $LabelRotation == 0 ) { $LabelAlign = TEXT_ALIGN_MIDDLELEFT; $XLabelOffset = 2; } + if ( $LabelRotation > 0 && $LabelRotation < 190 ) { $LabelAlign = TEXT_ALIGN_MIDDLELEFT; $XLabelOffset = 6; } + if ( $LabelRotation == 180 ) { $LabelAlign = TEXT_ALIGN_MIDDLERIGHT; $XLabelOffset = 5; } + if ( $LabelRotation > 180 && $LabelRotation < 360 ) { $LabelAlign = TEXT_ALIGN_MIDDLERIGHT; $XLabelOffset = 7; } if ( !$RemoveXAxis ) { @@ -2573,10 +2573,10 @@ return($Scale); } - /* + /* function modulo($Value1,$Value2) { - if ($Value1 > $Value2) { return 0; } + if ($Value1 > $Value2) { return 0; } if (floor($Value2) == 0) { return(0); } if (floor($Value2) != 0) { return($Value1 % $Value2); } @@ -2586,9 +2586,9 @@ return(($Value1*$Factor) % ($Value2*$Factor)); } - */ - function modulo( $Value1, $Value2 ) { - if ($Value1 > $Value2) { return 0; } + */ + function modulo( $Value1, $Value2 ) { + if ($Value1 > $Value2) { return 0; } if ($Value2 == 0) { return 0; @@ -2602,37 +2602,37 @@ /* Draw an X threshold */ function drawXThreshold($Value,$Format="") { - $R = isset($Format["R"]) ? $Format["R"] : 255; - $G = isset($Format["G"]) ? $Format["G"] : 0; - $B = isset($Format["B"]) ? $Format["B"] : 0; - $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 50; - $Weight = isset($Format["Weight"]) ? $Format["Weight"] : NULL; - $Ticks = isset($Format["Ticks"]) ? $Format["Ticks"] : 6; - $Wide = isset($Format["Wide"]) ? $Format["Wide"] : FALSE; - $WideFactor = isset($Format["WideFactor"]) ? $Format["WideFactor"] : 5; - $WriteCaption = isset($Format["WriteCaption"]) ? $Format["WriteCaption"] : FALSE; - $Caption = isset($Format["Caption"]) ? $Format["Caption"] : NULL; - $CaptionAlign = isset($Format["CaptionAlign"]) ? $Format["CaptionAlign"] : CAPTION_LEFT_TOP; + $R = isset($Format["R"]) ? $Format["R"] : 255; + $G = isset($Format["G"]) ? $Format["G"] : 0; + $B = isset($Format["B"]) ? $Format["B"] : 0; + $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 50; + $Weight = isset($Format["Weight"]) ? $Format["Weight"] : NULL; + $Ticks = isset($Format["Ticks"]) ? $Format["Ticks"] : 6; + $Wide = isset($Format["Wide"]) ? $Format["Wide"] : FALSE; + $WideFactor = isset($Format["WideFactor"]) ? $Format["WideFactor"] : 5; + $WriteCaption = isset($Format["WriteCaption"]) ? $Format["WriteCaption"] : FALSE; + $Caption = isset($Format["Caption"]) ? $Format["Caption"] : NULL; + $CaptionAlign = isset($Format["CaptionAlign"]) ? $Format["CaptionAlign"] : CAPTION_LEFT_TOP; $CaptionOffset = isset($Format["CaptionOffset"]) ? $Format["CaptionOffset"] : 5; - $CaptionR = isset($Format["CaptionR"]) ? $Format["CaptionR"] : 255; - $CaptionG = isset($Format["CaptionG"]) ? $Format["CaptionG"] : 255; - $CaptionB = isset($Format["CaptionB"]) ? $Format["CaptionB"] : 255; - $CaptionAlpha = isset($Format["CaptionAlpha"]) ? $Format["CaptionAlpha"] : 100; - $DrawBox = isset($Format["DrawBox"]) ? $Format["DrawBox"] : TRUE; - $DrawBoxBorder = isset($Format["DrawBoxBorder"]) ? $Format["DrawBoxBorder"] : FALSE; - $BorderOffset = isset($Format["BorderOffset"]) ? $Format["BorderOffset"] : 3; - $BoxRounded = isset($Format["BoxRounded"]) ? $Format["BoxRounded"] : TRUE; - $RoundedRadius = isset($Format["RoundedRadius"]) ? $Format["RoundedRadius"] : 3; - $BoxR = isset($Format["BoxR"]) ? $Format["BoxR"] : 0; - $BoxG = isset($Format["BoxG"]) ? $Format["BoxG"] : 0; - $BoxB = isset($Format["BoxB"]) ? $Format["BoxB"] : 0; - $BoxAlpha = isset($Format["BoxAlpha"]) ? $Format["BoxAlpha"] : 30; - $BoxSurrounding = isset($Format["BoxSurrounding"]) ? $Format["BoxSurrounding"] : ""; - $BoxBorderR = isset($Format["BoxBorderR"]) ? $Format["BoxBorderR"] : 255; - $BoxBorderG = isset($Format["BoxBorderG"]) ? $Format["BoxBorderG"] : 255; - $BoxBorderB = isset($Format["BoxBorderB"]) ? $Format["BoxBorderB"] : 255; - $BoxBorderAlpha = isset($Format["BoxBorderAlpha"]) ? $Format["BoxBorderAlpha"] : 100; - $ValueIsLabel = isset($Format["ValueIsLabel"]) ? $Format["ValueIsLabel"] : FALSE; + $CaptionR = isset($Format["CaptionR"]) ? $Format["CaptionR"] : 255; + $CaptionG = isset($Format["CaptionG"]) ? $Format["CaptionG"] : 255; + $CaptionB = isset($Format["CaptionB"]) ? $Format["CaptionB"] : 255; + $CaptionAlpha = isset($Format["CaptionAlpha"]) ? $Format["CaptionAlpha"] : 100; + $DrawBox = isset($Format["DrawBox"]) ? $Format["DrawBox"] : TRUE; + $DrawBoxBorder = isset($Format["DrawBoxBorder"]) ? $Format["DrawBoxBorder"] : FALSE; + $BorderOffset = isset($Format["BorderOffset"]) ? $Format["BorderOffset"] : 3; + $BoxRounded = isset($Format["BoxRounded"]) ? $Format["BoxRounded"] : TRUE; + $RoundedRadius = isset($Format["RoundedRadius"]) ? $Format["RoundedRadius"] : 3; + $BoxR = isset($Format["BoxR"]) ? $Format["BoxR"] : 0; + $BoxG = isset($Format["BoxG"]) ? $Format["BoxG"] : 0; + $BoxB = isset($Format["BoxB"]) ? $Format["BoxB"] : 0; + $BoxAlpha = isset($Format["BoxAlpha"]) ? $Format["BoxAlpha"] : 30; + $BoxSurrounding = isset($Format["BoxSurrounding"]) ? $Format["BoxSurrounding"] : ""; + $BoxBorderR = isset($Format["BoxBorderR"]) ? $Format["BoxBorderR"] : 255; + $BoxBorderG = isset($Format["BoxBorderG"]) ? $Format["BoxBorderG"] : 255; + $BoxBorderB = isset($Format["BoxBorderB"]) ? $Format["BoxBorderB"] : 255; + $BoxBorderAlpha = isset($Format["BoxBorderAlpha"]) ? $Format["BoxBorderAlpha"] : 100; + $ValueIsLabel = isset($Format["ValueIsLabel"]) ? $Format["ValueIsLabel"] : FALSE; $Data = $this->DataSet->getData(); $AbscissaMargin = $this->getAbscissaMargin($Data); @@ -2732,22 +2732,22 @@ /* Draw an X threshold area */ function drawXThresholdArea($Value1,$Value2,$Format="") { - $R = isset($Format["R"]) ? $Format["R"] : 255; - $G = isset($Format["G"]) ? $Format["G"] : 0; - $B = isset($Format["B"]) ? $Format["B"] : 0; - $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 20; + $R = isset($Format["R"]) ? $Format["R"] : 255; + $G = isset($Format["G"]) ? $Format["G"] : 0; + $B = isset($Format["B"]) ? $Format["B"] : 0; + $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 20; $Border = isset($Format["Border"]) ? $Format["Border"] : TRUE; $BorderR = isset($Format["BorderR"]) ? $Format["BorderR"] : $R; $BorderG = isset($Format["BorderG"]) ? $Format["BorderG"] : $G; $BorderB = isset($Format["BorderB"]) ? $Format["BorderB"] : $B; $BorderAlpha = isset($Format["BorderAlpha"]) ? $Format["BorderAlpha"] : $Alpha + 20; $BorderTicks = isset($Format["BorderTicks"]) ? $Format["BorderTicks"] : 2; - $AreaName = isset($Format["AreaName"]) ? $Format["AreaName"] : NULL; - $NameAngle = isset($Format["NameAngle"]) ? $Format["NameAngle"] : ZONE_NAME_ANGLE_AUTO; - $NameR = isset($Format["NameR"]) ? $Format["NameR"] : 255; - $NameG = isset($Format["NameG"]) ? $Format["NameG"] : 255; - $NameB = isset($Format["NameB"]) ? $Format["NameB"] : 255; - $NameAlpha = isset($Format["NameAlpha"]) ? $Format["NameAlpha"] : 100; + $AreaName = isset($Format["AreaName"]) ? $Format["AreaName"] : NULL; + $NameAngle = isset($Format["NameAngle"]) ? $Format["NameAngle"] : ZONE_NAME_ANGLE_AUTO; + $NameR = isset($Format["NameR"]) ? $Format["NameR"] : 255; + $NameG = isset($Format["NameG"]) ? $Format["NameG"] : 255; + $NameB = isset($Format["NameB"]) ? $Format["NameB"] : 255; + $NameAlpha = isset($Format["NameAlpha"]) ? $Format["NameAlpha"] : 100; $DisableShadowOnArea = isset($Format["DisableShadowOnArea"]) ? $Format["DisableShadowOnArea"] : TRUE; $RestoreShadow = $this->Shadow; @@ -2838,38 +2838,38 @@ /* Draw an Y threshold with the computed scale */ function drawThreshold($Value,$Format="") { - $AxisID = isset($Format["AxisID"]) ? $Format["AxisID"] : 0; - $R = isset($Format["R"]) ? $Format["R"] : 255; - $G = isset($Format["G"]) ? $Format["G"] : 0; - $B = isset($Format["B"]) ? $Format["B"] : 0; - $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 50; - $Weight = isset($Format["Weight"]) ? $Format["Weight"] : NULL; - $Ticks = isset($Format["Ticks"]) ? $Format["Ticks"] : 6; - $Wide = isset($Format["Wide"]) ? $Format["Wide"] : FALSE; - $WideFactor = isset($Format["WideFactor"]) ? $Format["WideFactor"] : 5; - $WriteCaption = isset($Format["WriteCaption"]) ? $Format["WriteCaption"] : FALSE; - $Caption = isset($Format["Caption"]) ? $Format["Caption"] : NULL; - $CaptionAlign = isset($Format["CaptionAlign"]) ? $Format["CaptionAlign"] : CAPTION_LEFT_TOP; + $AxisID = isset($Format["AxisID"]) ? $Format["AxisID"] : 0; + $R = isset($Format["R"]) ? $Format["R"] : 255; + $G = isset($Format["G"]) ? $Format["G"] : 0; + $B = isset($Format["B"]) ? $Format["B"] : 0; + $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 50; + $Weight = isset($Format["Weight"]) ? $Format["Weight"] : NULL; + $Ticks = isset($Format["Ticks"]) ? $Format["Ticks"] : 6; + $Wide = isset($Format["Wide"]) ? $Format["Wide"] : FALSE; + $WideFactor = isset($Format["WideFactor"]) ? $Format["WideFactor"] : 5; + $WriteCaption = isset($Format["WriteCaption"]) ? $Format["WriteCaption"] : FALSE; + $Caption = isset($Format["Caption"]) ? $Format["Caption"] : NULL; + $CaptionAlign = isset($Format["CaptionAlign"]) ? $Format["CaptionAlign"] : CAPTION_LEFT_TOP; $CaptionOffset = isset($Format["CaptionOffset"]) ? $Format["CaptionOffset"] : 10; - $CaptionR = isset($Format["CaptionR"]) ? $Format["CaptionR"] : 255; - $CaptionG = isset($Format["CaptionG"]) ? $Format["CaptionG"] : 255; - $CaptionB = isset($Format["CaptionB"]) ? $Format["CaptionB"] : 255; - $CaptionAlpha = isset($Format["CaptionAlpha"]) ? $Format["CaptionAlpha"] : 100; - $DrawBox = isset($Format["DrawBox"]) ? $Format["DrawBox"] : TRUE; - $DrawBoxBorder = isset($Format["DrawBoxBorder"]) ? $Format["DrawBoxBorder"] : FALSE; - $BorderOffset = isset($Format["BorderOffset"]) ? $Format["BorderOffset"] : 5; - $BoxRounded = isset($Format["BoxRounded"]) ? $Format["BoxRounded"] : TRUE; - $RoundedRadius = isset($Format["RoundedRadius"]) ? $Format["RoundedRadius"] : 3; - $BoxR = isset($Format["BoxR"]) ? $Format["BoxR"] : 0; - $BoxG = isset($Format["BoxG"]) ? $Format["BoxG"] : 0; - $BoxB = isset($Format["BoxB"]) ? $Format["BoxB"] : 0; - $BoxAlpha = isset($Format["BoxAlpha"]) ? $Format["BoxAlpha"] : 20; - $BoxSurrounding = isset($Format["BoxSurrounding"]) ? $Format["BoxSurrounding"] : ""; - $BoxBorderR = isset($Format["BoxBorderR"]) ? $Format["BoxBorderR"] : 255; - $BoxBorderG = isset($Format["BoxBorderG"]) ? $Format["BoxBorderG"] : 255; - $BoxBorderB = isset($Format["BoxBorderB"]) ? $Format["BoxBorderB"] : 255; - $BoxBorderAlpha = isset($Format["BoxBorderAlpha"]) ? $Format["BoxBorderAlpha"] : 100; - $NoMargin = isset($Format["NoMargin"]) ? $Format["NoMargin"] : FALSE; + $CaptionR = isset($Format["CaptionR"]) ? $Format["CaptionR"] : 255; + $CaptionG = isset($Format["CaptionG"]) ? $Format["CaptionG"] : 255; + $CaptionB = isset($Format["CaptionB"]) ? $Format["CaptionB"] : 255; + $CaptionAlpha = isset($Format["CaptionAlpha"]) ? $Format["CaptionAlpha"] : 100; + $DrawBox = isset($Format["DrawBox"]) ? $Format["DrawBox"] : TRUE; + $DrawBoxBorder = isset($Format["DrawBoxBorder"]) ? $Format["DrawBoxBorder"] : FALSE; + $BorderOffset = isset($Format["BorderOffset"]) ? $Format["BorderOffset"] : 5; + $BoxRounded = isset($Format["BoxRounded"]) ? $Format["BoxRounded"] : TRUE; + $RoundedRadius = isset($Format["RoundedRadius"]) ? $Format["RoundedRadius"] : 3; + $BoxR = isset($Format["BoxR"]) ? $Format["BoxR"] : 0; + $BoxG = isset($Format["BoxG"]) ? $Format["BoxG"] : 0; + $BoxB = isset($Format["BoxB"]) ? $Format["BoxB"] : 0; + $BoxAlpha = isset($Format["BoxAlpha"]) ? $Format["BoxAlpha"] : 20; + $BoxSurrounding = isset($Format["BoxSurrounding"]) ? $Format["BoxSurrounding"] : ""; + $BoxBorderR = isset($Format["BoxBorderR"]) ? $Format["BoxBorderR"] : 255; + $BoxBorderG = isset($Format["BoxBorderG"]) ? $Format["BoxBorderG"] : 255; + $BoxBorderB = isset($Format["BoxBorderB"]) ? $Format["BoxBorderB"] : 255; + $BoxBorderAlpha = isset($Format["BoxBorderAlpha"]) ? $Format["BoxBorderAlpha"] : 100; + $NoMargin = isset($Format["NoMargin"]) ? $Format["NoMargin"] : FALSE; if ( is_array($Value) ) { foreach ($Value as $Key => $ID) { $this->drawThreshold($ID,$Format); } return(0); } @@ -2950,25 +2950,25 @@ /* Draw a threshold with the computed scale */ function drawThresholdArea($Value1,$Value2,$Format="") { - $AxisID = isset($Format["AxisID"]) ? $Format["AxisID"] : 0; - $R = isset($Format["R"]) ? $Format["R"] : 255; - $G = isset($Format["G"]) ? $Format["G"] : 0; - $B = isset($Format["B"]) ? $Format["B"] : 0; - $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 20; + $AxisID = isset($Format["AxisID"]) ? $Format["AxisID"] : 0; + $R = isset($Format["R"]) ? $Format["R"] : 255; + $G = isset($Format["G"]) ? $Format["G"] : 0; + $B = isset($Format["B"]) ? $Format["B"] : 0; + $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 20; $Border = isset($Format["Border"]) ? $Format["Border"] : TRUE; $BorderR = isset($Format["BorderR"]) ? $Format["BorderR"] : $R; $BorderG = isset($Format["BorderG"]) ? $Format["BorderG"] : $G; $BorderB = isset($Format["BorderB"]) ? $Format["BorderB"] : $B; $BorderAlpha = isset($Format["BorderAlpha"]) ? $Format["BorderAlpha"] : $Alpha + 20; $BorderTicks = isset($Format["BorderTicks"]) ? $Format["BorderTicks"] : 2; - $AreaName = isset($Format["AreaName"]) ? $Format["AreaName"] : NULL; - $NameAngle = isset($Format["NameAngle"]) ? $Format["NameAngle"] : ZONE_NAME_ANGLE_AUTO; - $NameR = isset($Format["NameR"]) ? $Format["NameR"] : 255; - $NameG = isset($Format["NameG"]) ? $Format["NameG"] : 255; - $NameB = isset($Format["NameB"]) ? $Format["NameB"] : 255; - $NameAlpha = isset($Format["NameAlpha"]) ? $Format["NameAlpha"] : 100; + $AreaName = isset($Format["AreaName"]) ? $Format["AreaName"] : NULL; + $NameAngle = isset($Format["NameAngle"]) ? $Format["NameAngle"] : ZONE_NAME_ANGLE_AUTO; + $NameR = isset($Format["NameR"]) ? $Format["NameR"] : 255; + $NameG = isset($Format["NameG"]) ? $Format["NameG"] : 255; + $NameB = isset($Format["NameB"]) ? $Format["NameB"] : 255; + $NameAlpha = isset($Format["NameAlpha"]) ? $Format["NameAlpha"] : 100; $DisableShadowOnArea = isset($Format["DisableShadowOnArea"]) ? $Format["DisableShadowOnArea"] : TRUE; - $NoMargin = isset($Format["NoMargin"]) ? $Format["NoMargin"] : FALSE; + $NoMargin = isset($Format["NoMargin"]) ? $Format["NoMargin"] : FALSE; if ($Value1 > $Value2) { list($Value1, $Value2) = array($Value2, $Value1); } @@ -3070,8 +3070,8 @@ function scaleComputeY($Values,$Option="",$ReturnOnly0Height=FALSE) { - $AxisID = isset($Option["AxisID"]) ? $Option["AxisID"] : 0; - $SerieName = isset($Option["SerieName"]) ? $Option["SerieName"] : NULL; + $AxisID = isset($Option["AxisID"]) ? $Option["AxisID"] : 0; + $SerieName = isset($Option["SerieName"]) ? $Option["SerieName"] : NULL; $Data = $this->DataSet->getData(); if ( !isset($Data["Axis"][$AxisID]) ) { return(-1); } @@ -3096,11 +3096,11 @@ $Width = ($this->GraphAreaX2 - $this->GraphAreaX1) - $Data["Axis"][$AxisID]["Margin"]*2; $ScaleWidth = $Data["Axis"][$AxisID]["ScaleMax"] - $Data["Axis"][$AxisID]["ScaleMin"]; - if ($ScaleWidth > 0) { - $Step = $Width / $ScaleWidth; - } else { - $Step = 1; // or change this to 0 if it doesn't work, I am not sure what this line does. - } + if ($ScaleWidth > 0) { + $Step = $Width / $ScaleWidth; + } else { + $Step = 1; // or change this to 0 if it doesn't work, I am not sure what this line does. + } if ( $ReturnOnly0Height ) { foreach($Values as $Key => $Value) { if ( $Value == VOID ) { $Result[] = VOID; } else { $Result[] = $Step * $Value; } } } @@ -3157,34 +3157,34 @@ /* Write Max value on a chart */ function writeBounds($Type=BOUND_BOTH,$Format=NULL) { - $MaxLabelTxt = isset($Format["MaxLabelTxt"]) ? $Format["MaxLabelTxt"] : "max="; - $MinLabelTxt = isset($Format["MinLabelTxt"]) ? $Format["MinLabelTxt"] : "min="; - $Decimals = isset($Format["Decimals"]) ? $Format["Decimals"] : 1; - $ExcludedSeries = isset($Format["ExcludedSeries"]) ? $Format["ExcludedSeries"] : ""; - $DisplayOffset = isset($Format["DisplayOffset"]) ? $Format["DisplayOffset"] : 4; - $DisplayColor = isset($Format["DisplayColor"]) ? $Format["DisplayColor"] : DISPLAY_MANUAL; - $MaxDisplayR = isset($Format["MaxDisplayR"]) ? $Format["MaxDisplayR"] : 0; - $MaxDisplayG = isset($Format["MaxDisplayG"]) ? $Format["MaxDisplayG"] : 0; - $MaxDisplayB = isset($Format["MaxDisplayB"]) ? $Format["MaxDisplayB"] : 0; - $MinDisplayR = isset($Format["MinDisplayR"]) ? $Format["MinDisplayR"] : 255; - $MinDisplayG = isset($Format["MinDisplayG"]) ? $Format["MinDisplayG"] : 255; - $MinDisplayB = isset($Format["MinDisplayB"]) ? $Format["MinDisplayB"] : 255; - $MinLabelPos = isset($Format["MinLabelPos"]) ? $Format["MinLabelPos"] : BOUND_LABEL_POS_AUTO; - $MaxLabelPos = isset($Format["MaxLabelPos"]) ? $Format["MaxLabelPos"] : BOUND_LABEL_POS_AUTO; - $DrawBox = isset($Format["DrawBox"]) ? $Format["DrawBox"] : TRUE; - $DrawBoxBorder = isset($Format["DrawBoxBorder"]) ? $Format["DrawBoxBorder"] : FALSE; - $BorderOffset = isset($Format["BorderOffset"]) ? $Format["BorderOffset"] : 5; - $BoxRounded = isset($Format["BoxRounded"]) ? $Format["BoxRounded"] : TRUE; - $RoundedRadius = isset($Format["RoundedRadius"]) ? $Format["RoundedRadius"] : 3; - $BoxR = isset($Format["BoxR"]) ? $Format["BoxR"] : 0; - $BoxG = isset($Format["BoxG"]) ? $Format["BoxG"] : 0; - $BoxB = isset($Format["BoxB"]) ? $Format["BoxB"] : 0; - $BoxAlpha = isset($Format["BoxAlpha"]) ? $Format["BoxAlpha"] : 20; - $BoxSurrounding = isset($Format["BoxSurrounding"]) ? $Format["BoxSurrounding"] : ""; - $BoxBorderR = isset($Format["BoxBorderR"]) ? $Format["BoxBorderR"] : 255; - $BoxBorderG = isset($Format["BoxBorderG"]) ? $Format["BoxBorderG"] : 255; - $BoxBorderB = isset($Format["BoxBorderB"]) ? $Format["BoxBorderB"] : 255; - $BoxBorderAlpha = isset($Format["BoxBorderAlpha"]) ? $Format["BoxBorderAlpha"] : 100; + $MaxLabelTxt = isset($Format["MaxLabelTxt"]) ? $Format["MaxLabelTxt"] : "max="; + $MinLabelTxt = isset($Format["MinLabelTxt"]) ? $Format["MinLabelTxt"] : "min="; + $Decimals = isset($Format["Decimals"]) ? $Format["Decimals"] : 1; + $ExcludedSeries = isset($Format["ExcludedSeries"]) ? $Format["ExcludedSeries"] : ""; + $DisplayOffset = isset($Format["DisplayOffset"]) ? $Format["DisplayOffset"] : 4; + $DisplayColor = isset($Format["DisplayColor"]) ? $Format["DisplayColor"] : DISPLAY_MANUAL; + $MaxDisplayR = isset($Format["MaxDisplayR"]) ? $Format["MaxDisplayR"] : 0; + $MaxDisplayG = isset($Format["MaxDisplayG"]) ? $Format["MaxDisplayG"] : 0; + $MaxDisplayB = isset($Format["MaxDisplayB"]) ? $Format["MaxDisplayB"] : 0; + $MinDisplayR = isset($Format["MinDisplayR"]) ? $Format["MinDisplayR"] : 255; + $MinDisplayG = isset($Format["MinDisplayG"]) ? $Format["MinDisplayG"] : 255; + $MinDisplayB = isset($Format["MinDisplayB"]) ? $Format["MinDisplayB"] : 255; + $MinLabelPos = isset($Format["MinLabelPos"]) ? $Format["MinLabelPos"] : BOUND_LABEL_POS_AUTO; + $MaxLabelPos = isset($Format["MaxLabelPos"]) ? $Format["MaxLabelPos"] : BOUND_LABEL_POS_AUTO; + $DrawBox = isset($Format["DrawBox"]) ? $Format["DrawBox"] : TRUE; + $DrawBoxBorder = isset($Format["DrawBoxBorder"]) ? $Format["DrawBoxBorder"] : FALSE; + $BorderOffset = isset($Format["BorderOffset"]) ? $Format["BorderOffset"] : 5; + $BoxRounded = isset($Format["BoxRounded"]) ? $Format["BoxRounded"] : TRUE; + $RoundedRadius = isset($Format["RoundedRadius"]) ? $Format["RoundedRadius"] : 3; + $BoxR = isset($Format["BoxR"]) ? $Format["BoxR"] : 0; + $BoxG = isset($Format["BoxG"]) ? $Format["BoxG"] : 0; + $BoxB = isset($Format["BoxB"]) ? $Format["BoxB"] : 0; + $BoxAlpha = isset($Format["BoxAlpha"]) ? $Format["BoxAlpha"] : 20; + $BoxSurrounding = isset($Format["BoxSurrounding"]) ? $Format["BoxSurrounding"] : ""; + $BoxBorderR = isset($Format["BoxBorderR"]) ? $Format["BoxBorderR"] : 255; + $BoxBorderG = isset($Format["BoxBorderG"]) ? $Format["BoxBorderG"] : 255; + $BoxBorderB = isset($Format["BoxBorderB"]) ? $Format["BoxBorderB"] : 255; + $BoxBorderAlpha = isset($Format["BoxBorderAlpha"]) ? $Format["BoxBorderAlpha"] : 100; $CaptionSettings = array("DrawBox"=>$DrawBox,"DrawBoxBorder"=>$DrawBoxBorder,"BorderOffset"=>$BorderOffset,"BoxRounded"=>$BoxRounded,"RoundedRadius"=>$RoundedRadius, "BoxR"=>$BoxR,"BoxG"=>$BoxG,"BoxB"=>$BoxB,"BoxAlpha"=>$BoxAlpha,"BoxSurrounding"=>$BoxSurrounding, @@ -3210,10 +3210,10 @@ if ( $Value == $MaxValue ) { $MaxPos = $Key; } } - $AxisID = $Serie["Axis"]; - $Mode = $Data["Axis"][$AxisID]["Display"]; - $Format = $Data["Axis"][$AxisID]["Format"]; - $Unit = $Data["Axis"][$AxisID]["Unit"]; + $AxisID = $Serie["Axis"]; + $Mode = $Data["Axis"][$AxisID]["Display"]; + $Format = $Data["Axis"][$AxisID]["Format"]; + $Unit = $Data["Axis"][$AxisID]["Unit"]; $PosArray = $this->scaleComputeY($Serie["Data"],array("AxisID"=>$Serie["Axis"])); @@ -3320,21 +3320,21 @@ /* Draw a plot chart */ function drawPlotChart($Format=NULL) { - $PlotSize = isset($Format["PlotSize"]) ? $Format["PlotSize"] : NULL; - $PlotBorder = isset($Format["PlotBorder"]) ? $Format["PlotBorder"] : FALSE; - $BorderR = isset($Format["BorderR"]) ? $Format["BorderR"] : 50; - $BorderG = isset($Format["BorderG"]) ? $Format["BorderG"] : 50; - $BorderB = isset($Format["BorderB"]) ? $Format["BorderB"] : 50; - $BorderAlpha = isset($Format["BorderAlpha"]) ? $Format["BorderAlpha"] : 30; - $BorderSize = isset($Format["BorderSize"]) ? $Format["BorderSize"] : 2; - $Surrounding = isset($Format["Surrounding"]) ? $Format["Surrounding"] : NULL; - $DisplayValues = isset($Format["DisplayValues"]) ? $Format["DisplayValues"] : FALSE; - $DisplayOffset = isset($Format["DisplayOffset"]) ? $Format["DisplayOffset"] : 4; - $DisplayColor = isset($Format["DisplayColor"]) ? $Format["DisplayColor"] : DISPLAY_MANUAL; - $DisplayR = isset($Format["DisplayR"]) ? $Format["DisplayR"] : 0; - $DisplayG = isset($Format["DisplayG"]) ? $Format["DisplayG"] : 0; - $DisplayB = isset($Format["DisplayB"]) ? $Format["DisplayB"] : 0; - $RecordImageMap = isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE; + $PlotSize = isset($Format["PlotSize"]) ? $Format["PlotSize"] : NULL; + $PlotBorder = isset($Format["PlotBorder"]) ? $Format["PlotBorder"] : FALSE; + $BorderR = isset($Format["BorderR"]) ? $Format["BorderR"] : 50; + $BorderG = isset($Format["BorderG"]) ? $Format["BorderG"] : 50; + $BorderB = isset($Format["BorderB"]) ? $Format["BorderB"] : 50; + $BorderAlpha = isset($Format["BorderAlpha"]) ? $Format["BorderAlpha"] : 30; + $BorderSize = isset($Format["BorderSize"]) ? $Format["BorderSize"] : 2; + $Surrounding = isset($Format["Surrounding"]) ? $Format["Surrounding"] : NULL; + $DisplayValues = isset($Format["DisplayValues"]) ? $Format["DisplayValues"] : FALSE; + $DisplayOffset = isset($Format["DisplayOffset"]) ? $Format["DisplayOffset"] : 4; + $DisplayColor = isset($Format["DisplayColor"]) ? $Format["DisplayColor"] : DISPLAY_MANUAL; + $DisplayR = isset($Format["DisplayR"]) ? $Format["DisplayR"] : 0; + $DisplayG = isset($Format["DisplayG"]) ? $Format["DisplayG"] : 0; + $DisplayB = isset($Format["DisplayB"]) ? $Format["DisplayB"] : 0; + $RecordImageMap = isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE; $this->LastChartLayout = CHART_LAST_LAYOUT_REGULAR; @@ -3356,11 +3356,11 @@ if ( $DisplayColor == DISPLAY_AUTO ) { $DisplayR = $R; $DisplayG = $G; $DisplayB = $B; } - $AxisID = $Serie["Axis"]; - $Shape = $Serie["Shape"]; - $Mode = $Data["Axis"][$AxisID]["Display"]; - $Format = $Data["Axis"][$AxisID]["Format"]; - $Unit = $Data["Axis"][$AxisID]["Unit"]; + $AxisID = $Serie["Axis"]; + $Shape = $Serie["Shape"]; + $Mode = $Data["Axis"][$AxisID]["Display"]; + $Format = $Data["Axis"][$AxisID]["Format"]; + $Unit = $Data["Axis"][$AxisID]["Unit"]; if (isset($Serie["Description"])) { $SerieDescription = $Serie["Description"]; } else { $SerieDescription = $SerieName; } @@ -3423,18 +3423,18 @@ /* Draw a spline chart */ function drawSplineChart($Format=NULL) { - $BreakVoid = isset($Format["BreakVoid"]) ? $Format["BreakVoid"] : TRUE; - $VoidTicks = isset($Format["VoidTicks"]) ? $Format["VoidTicks"] : 4; - $BreakR = isset($Format["BreakR"]) ? $Format["BreakR"] : NULL; // 234 - $BreakG = isset($Format["BreakG"]) ? $Format["BreakG"] : NULL; // 55 - $BreakB = isset($Format["BreakB"]) ? $Format["BreakB"] : NULL; // 26 - $DisplayValues = isset($Format["DisplayValues"]) ? $Format["DisplayValues"] : FALSE; - $DisplayOffset = isset($Format["DisplayOffset"]) ? $Format["DisplayOffset"] : 2; - $DisplayColor = isset($Format["DisplayColor"]) ? $Format["DisplayColor"] : DISPLAY_MANUAL; - $DisplayR = isset($Format["DisplayR"]) ? $Format["DisplayR"] : 0; - $DisplayG = isset($Format["DisplayG"]) ? $Format["DisplayG"] : 0; - $DisplayB = isset($Format["DisplayB"]) ? $Format["DisplayB"] : 0; - $RecordImageMap = isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE; + $BreakVoid = isset($Format["BreakVoid"]) ? $Format["BreakVoid"] : TRUE; + $VoidTicks = isset($Format["VoidTicks"]) ? $Format["VoidTicks"] : 4; + $BreakR = isset($Format["BreakR"]) ? $Format["BreakR"] : NULL; // 234 + $BreakG = isset($Format["BreakG"]) ? $Format["BreakG"] : NULL; // 55 + $BreakB = isset($Format["BreakB"]) ? $Format["BreakB"] : NULL; // 26 + $DisplayValues = isset($Format["DisplayValues"]) ? $Format["DisplayValues"] : FALSE; + $DisplayOffset = isset($Format["DisplayOffset"]) ? $Format["DisplayOffset"] : 2; + $DisplayColor = isset($Format["DisplayColor"]) ? $Format["DisplayColor"] : DISPLAY_MANUAL; + $DisplayR = isset($Format["DisplayR"]) ? $Format["DisplayR"] : 0; + $DisplayG = isset($Format["DisplayG"]) ? $Format["DisplayG"] : 0; + $DisplayB = isset($Format["DisplayB"]) ? $Format["DisplayB"] : 0; + $RecordImageMap = isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE; $ImageMapPlotSize = isset($Format["ImageMapPlotSize"]) ? $Format["ImageMapPlotSize"] : 5; $this->LastChartLayout = CHART_LAST_LAYOUT_REGULAR; @@ -3454,10 +3454,10 @@ if ( $DisplayColor == DISPLAY_AUTO ) { $DisplayR = $R; $DisplayG = $G; $DisplayB = $B; } - $AxisID = $Serie["Axis"]; - $Mode = $Data["Axis"][$AxisID]["Display"]; - $Format = $Data["Axis"][$AxisID]["Format"]; - $Unit = $Data["Axis"][$AxisID]["Unit"]; + $AxisID = $Serie["Axis"]; + $Mode = $Data["Axis"][$AxisID]["Display"]; + $Format = $Data["Axis"][$AxisID]["Format"]; + $Unit = $Data["Axis"][$AxisID]["Unit"]; if (isset($Serie["Description"])) { $SerieDescription = $Serie["Description"]; } else { $SerieDescription = $SerieName; } @@ -3477,7 +3477,7 @@ { if ( $DisplayValues ) $this->drawText($X,$Y-$DisplayOffset,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit),array("R"=>$DisplayR,"G"=>$DisplayG,"B"=>$DisplayB,"Align"=>TEXT_ALIGN_BOTTOMMIDDLE)); - + if ( $RecordImageMap && $Y != VOID ) { $this->addToImageMap("CIRCLE",floor($X).",".floor($Y).",".$ImageMapPlotSize,$this->toHTMLColor($R,$G,$B),$SerieDescription,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit)); } if ( $Y == VOID && $LastY != NULL ) @@ -3536,14 +3536,14 @@ /* Draw a filled spline chart */ function drawFilledSplineChart($Format=NULL) { - $DisplayValues = isset($Format["DisplayValues"]) ? $Format["DisplayValues"] : FALSE; - $DisplayOffset = isset($Format["DisplayOffset"]) ? $Format["DisplayOffset"] : 2; - $DisplayColor = isset($Format["DisplayColor"]) ? $Format["DisplayColor"] : DISPLAY_MANUAL; - $DisplayR = isset($Format["DisplayR"]) ? $Format["DisplayR"] : 0; - $DisplayG = isset($Format["DisplayG"]) ? $Format["DisplayG"] : 0; - $DisplayB = isset($Format["DisplayB"]) ? $Format["DisplayB"] : 0; - $AroundZero = isset($Format["AroundZero"]) ? $Format["AroundZero"] : TRUE; - $Threshold = isset($Format["Threshold"]) ? $Format["Threshold"] : NULL; + $DisplayValues = isset($Format["DisplayValues"]) ? $Format["DisplayValues"] : FALSE; + $DisplayOffset = isset($Format["DisplayOffset"]) ? $Format["DisplayOffset"] : 2; + $DisplayColor = isset($Format["DisplayColor"]) ? $Format["DisplayColor"] : DISPLAY_MANUAL; + $DisplayR = isset($Format["DisplayR"]) ? $Format["DisplayR"] : 0; + $DisplayG = isset($Format["DisplayG"]) ? $Format["DisplayG"] : 0; + $DisplayB = isset($Format["DisplayB"]) ? $Format["DisplayB"] : 0; + $AroundZero = isset($Format["AroundZero"]) ? $Format["AroundZero"] : TRUE; + $Threshold = isset($Format["Threshold"]) ? $Format["Threshold"] : NULL; $this->LastChartLayout = CHART_LAST_LAYOUT_REGULAR; @@ -3556,10 +3556,10 @@ $R = $Serie["Color"]["R"]; $G = $Serie["Color"]["G"]; $B = $Serie["Color"]["B"]; $Alpha = $Serie["Color"]["Alpha"]; $Ticks = $Serie["Ticks"]; if ( $DisplayColor == DISPLAY_AUTO ) { $DisplayR = $R; $DisplayG = $G; $DisplayB = $B; } - $AxisID = $Serie["Axis"]; - $Mode = $Data["Axis"][$AxisID]["Display"]; - $Format = $Data["Axis"][$AxisID]["Format"]; - $Unit = $Data["Axis"][$AxisID]["Unit"]; + $AxisID = $Serie["Axis"]; + $Mode = $Data["Axis"][$AxisID]["Display"]; + $Format = $Data["Axis"][$AxisID]["Format"]; + $Unit = $Data["Axis"][$AxisID]["Unit"]; $PosArray = $this->scaleComputeY($Serie["Data"],array("AxisID"=>$Serie["Axis"])); if ( $AroundZero ) { $YZero = $this->scaleComputeY(0,array("AxisID"=>$Serie["Axis"])); } @@ -3710,24 +3710,24 @@ /* Draw a line chart */ function drawLineChart($Format=NULL) { - $BreakVoid = isset($Format["BreakVoid"]) ? $Format["BreakVoid"] : TRUE; - $VoidTicks = isset($Format["VoidTicks"]) ? $Format["VoidTicks"] : 4; - $BreakR = isset($Format["BreakR"]) ? $Format["BreakR"] : NULL; - $BreakG = isset($Format["BreakG"]) ? $Format["BreakG"] : NULL; - $BreakB = isset($Format["BreakB"]) ? $Format["BreakB"] : NULL; - $DisplayValues = isset($Format["DisplayValues"]) ? $Format["DisplayValues"] : FALSE; - $DisplayOffset = isset($Format["DisplayOffset"]) ? $Format["DisplayOffset"] : 2; - $DisplayColor = isset($Format["DisplayColor"]) ? $Format["DisplayColor"] : DISPLAY_MANUAL; - $DisplayR = isset($Format["DisplayR"]) ? $Format["DisplayR"] : 0; - $DisplayG = isset($Format["DisplayG"]) ? $Format["DisplayG"] : 0; - $DisplayB = isset($Format["DisplayB"]) ? $Format["DisplayB"] : 0; - $RecordImageMap = isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE; + $BreakVoid = isset($Format["BreakVoid"]) ? $Format["BreakVoid"] : TRUE; + $VoidTicks = isset($Format["VoidTicks"]) ? $Format["VoidTicks"] : 4; + $BreakR = isset($Format["BreakR"]) ? $Format["BreakR"] : NULL; + $BreakG = isset($Format["BreakG"]) ? $Format["BreakG"] : NULL; + $BreakB = isset($Format["BreakB"]) ? $Format["BreakB"] : NULL; + $DisplayValues = isset($Format["DisplayValues"]) ? $Format["DisplayValues"] : FALSE; + $DisplayOffset = isset($Format["DisplayOffset"]) ? $Format["DisplayOffset"] : 2; + $DisplayColor = isset($Format["DisplayColor"]) ? $Format["DisplayColor"] : DISPLAY_MANUAL; + $DisplayR = isset($Format["DisplayR"]) ? $Format["DisplayR"] : 0; + $DisplayG = isset($Format["DisplayG"]) ? $Format["DisplayG"] : 0; + $DisplayB = isset($Format["DisplayB"]) ? $Format["DisplayB"] : 0; + $RecordImageMap = isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE; $ImageMapPlotSize = isset($Format["ImageMapPlotSize"]) ? $Format["ImageMapPlotSize"] : 5; - $ForceColor = isset($Format["ForceColor"]) ? $Format["ForceColor"] : FALSE; - $ForceR = isset($Format["ForceR"]) ? $Format["ForceR"] : 0; - $ForceG = isset($Format["ForceG"]) ? $Format["ForceG"] : 0; - $ForceB = isset($Format["ForceB"]) ? $Format["ForceB"] : 0; - $ForceAlpha = isset($Format["ForceAlpha"]) ? $Format["ForceAlpha"] : 100; + $ForceColor = isset($Format["ForceColor"]) ? $Format["ForceColor"] : FALSE; + $ForceR = isset($Format["ForceR"]) ? $Format["ForceR"] : 0; + $ForceG = isset($Format["ForceG"]) ? $Format["ForceG"] : 0; + $ForceB = isset($Format["ForceB"]) ? $Format["ForceB"] : 0; + $ForceAlpha = isset($Format["ForceAlpha"]) ? $Format["ForceAlpha"] : 100; $this->LastChartLayout = CHART_LAST_LAYOUT_REGULAR; @@ -3749,10 +3749,10 @@ if ( $DisplayColor == DISPLAY_AUTO ) { $DisplayR = $R; $DisplayG = $G; $DisplayB = $B; } - $AxisID = $Serie["Axis"]; - $Mode = $Data["Axis"][$AxisID]["Display"]; - $Format = $Data["Axis"][$AxisID]["Format"]; - $Unit = $Data["Axis"][$AxisID]["Unit"]; + $AxisID = $Serie["Axis"]; + $Mode = $Data["Axis"][$AxisID]["Display"]; + $Format = $Data["Axis"][$AxisID]["Format"]; + $Unit = $Data["Axis"][$AxisID]["Unit"]; if (isset($Serie["Description"])) { $SerieDescription = $Serie["Description"]; } else { $SerieDescription = $SerieName; } @@ -3824,29 +3824,29 @@ /* Draw a line chart */ function drawZoneChart($SerieA,$SerieB,$Format=NULL) { - $AxisID = isset($Format["AxisID"]) ? $Format["AxisID"] : 0; - $LineR = isset($Format["LineR"]) ? $Format["LineR"] : 150; - $LineG = isset($Format["LineG"]) ? $Format["LineG"] : 150; - $LineB = isset($Format["LineB"]) ? $Format["LineB"] : 150; - $LineAlpha = isset($Format["LineAlpha"]) ? $Format["LineAlpha"] : 50; - $LineTicks = isset($Format["LineTicks"]) ? $Format["LineTicks"] : 1; - $AreaR = isset($Format["AreaR"]) ? $Format["AreaR"] : 150; - $AreaG = isset($Format["AreaG"]) ? $Format["AreaG"] : 150; - $AreaB = isset($Format["AreaB"]) ? $Format["AreaB"] : 150; - $AreaAlpha = isset($Format["AreaAlpha"]) ? $Format["AreaAlpha"] : 5; + $AxisID = isset($Format["AxisID"]) ? $Format["AxisID"] : 0; + $LineR = isset($Format["LineR"]) ? $Format["LineR"] : 150; + $LineG = isset($Format["LineG"]) ? $Format["LineG"] : 150; + $LineB = isset($Format["LineB"]) ? $Format["LineB"] : 150; + $LineAlpha = isset($Format["LineAlpha"]) ? $Format["LineAlpha"] : 50; + $LineTicks = isset($Format["LineTicks"]) ? $Format["LineTicks"] : 1; + $AreaR = isset($Format["AreaR"]) ? $Format["AreaR"] : 150; + $AreaG = isset($Format["AreaG"]) ? $Format["AreaG"] : 150; + $AreaB = isset($Format["AreaB"]) ? $Format["AreaB"] : 150; + $AreaAlpha = isset($Format["AreaAlpha"]) ? $Format["AreaAlpha"] : 5; $this->LastChartLayout = CHART_LAST_LAYOUT_REGULAR; - $Data = $this->DataSet->getData(); + $Data = $this->DataSet->getData(); if ( !isset($Data["Series"][$SerieA]["Data"]) || !isset($Data["Series"][$SerieB]["Data"]) ) { return(0); } $SerieAData = $Data["Series"][$SerieA]["Data"]; $SerieBData = $Data["Series"][$SerieB]["Data"]; list($XMargin,$XDivs) = $this->scaleGetXSettings(); - $Mode = $Data["Axis"][$AxisID]["Display"]; - $Format = $Data["Axis"][$AxisID]["Format"]; - $Unit = $Data["Axis"][$AxisID]["Unit"]; + $Mode = $Data["Axis"][$AxisID]["Display"]; + $Format = $Data["Axis"][$AxisID]["Format"]; + $Unit = $Data["Axis"][$AxisID]["Unit"]; $PosArrayA = $this->scaleComputeY($SerieAData,array("AxisID"=>$AxisID)); $PosArrayB = $this->scaleComputeY($SerieBData,array("AxisID"=>$AxisID)); @@ -3913,19 +3913,19 @@ /* Draw a step chart */ function drawStepChart($Format=NULL) { - $BreakVoid = isset($Format["BreakVoid"]) ? $Format["BreakVoid"] : FALSE; - $ReCenter = isset($Format["ReCenter"]) ? $Format["ReCenter"] : TRUE; - $VoidTicks = isset($Format["VoidTicks"]) ? $Format["VoidTicks"] : 4; - $BreakR = isset($Format["BreakR"]) ? $Format["BreakR"] : NULL; - $BreakG = isset($Format["BreakG"]) ? $Format["BreakG"] : NULL; - $BreakB = isset($Format["BreakB"]) ? $Format["BreakB"] : NULL; - $DisplayValues = isset($Format["DisplayValues"]) ? $Format["DisplayValues"] :FALSE; - $DisplayOffset = isset($Format["DisplayOffset"]) ? $Format["DisplayOffset"] : 2; - $DisplayColor = isset($Format["DisplayColor"]) ? $Format["DisplayColor"] : DISPLAY_MANUAL; - $DisplayR = isset($Format["DisplayR"]) ? $Format["DisplayR"] : 0; - $DisplayG = isset($Format["DisplayG"]) ? $Format["DisplayG"] : 0; - $DisplayB = isset($Format["DisplayB"]) ? $Format["DisplayB"] : 0; - $RecordImageMap = isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE; + $BreakVoid = isset($Format["BreakVoid"]) ? $Format["BreakVoid"] : FALSE; + $ReCenter = isset($Format["ReCenter"]) ? $Format["ReCenter"] : TRUE; + $VoidTicks = isset($Format["VoidTicks"]) ? $Format["VoidTicks"] : 4; + $BreakR = isset($Format["BreakR"]) ? $Format["BreakR"] : NULL; + $BreakG = isset($Format["BreakG"]) ? $Format["BreakG"] : NULL; + $BreakB = isset($Format["BreakB"]) ? $Format["BreakB"] : NULL; + $DisplayValues = isset($Format["DisplayValues"]) ? $Format["DisplayValues"] :FALSE; + $DisplayOffset = isset($Format["DisplayOffset"]) ? $Format["DisplayOffset"] : 2; + $DisplayColor = isset($Format["DisplayColor"]) ? $Format["DisplayColor"] : DISPLAY_MANUAL; + $DisplayR = isset($Format["DisplayR"]) ? $Format["DisplayR"] : 0; + $DisplayG = isset($Format["DisplayG"]) ? $Format["DisplayG"] : 0; + $DisplayB = isset($Format["DisplayB"]) ? $Format["DisplayB"] : 0; + $RecordImageMap = isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE; $ImageMapPlotSize = isset($Format["ImageMapPlotSize"]) ? $Format["ImageMapPlotSize"] : 5; $this->LastChartLayout = CHART_LAST_LAYOUT_REGULAR; @@ -3947,11 +3947,11 @@ if ( $DisplayColor == DISPLAY_AUTO ) { $DisplayR = $R; $DisplayG = $G; $DisplayB = $B; } - $AxisID = $Serie["Axis"]; - $Mode = $Data["Axis"][$AxisID]["Display"]; - $Format = $Data["Axis"][$AxisID]["Format"]; - $Unit = $Data["Axis"][$AxisID]["Unit"]; - $Color = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks,"Weight"=>$Weight); + $AxisID = $Serie["Axis"]; + $Mode = $Data["Axis"][$AxisID]["Display"]; + $Format = $Data["Axis"][$AxisID]["Format"]; + $Unit = $Data["Axis"][$AxisID]["Unit"]; + $Color = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks,"Weight"=>$Weight); $PosArray = $this->scaleComputeY($Serie["Data"],array("AxisID"=>$Serie["Axis"])); @@ -4082,15 +4082,15 @@ /* Draw a step chart */ function drawFilledStepChart($Format=NULL) { - $ReCenter = isset($Format["ReCenter"]) ? $Format["ReCenter"] : TRUE; - $DisplayValues = isset($Format["DisplayValues"]) ? $Format["DisplayValues"] :FALSE; - $DisplayOffset = isset($Format["DisplayOffset"]) ? $Format["DisplayOffset"] : 2; - $DisplayColor = isset($Format["DisplayColor"]) ? $Format["DisplayColor"] : DISPLAY_MANUAL; - $ForceTransparency = isset($Format["ForceTransparency"]) ? $Format["ForceTransparency"] : NULL; - $DisplayR = isset($Format["DisplayR"]) ? $Format["DisplayR"] : 0; - $DisplayG = isset($Format["DisplayG"]) ? $Format["DisplayG"] : 0; - $DisplayB = isset($Format["DisplayB"]) ? $Format["DisplayB"] : 0; - $AroundZero = isset($Format["AroundZero"]) ? $Format["AroundZero"] : TRUE; + $ReCenter = isset($Format["ReCenter"]) ? $Format["ReCenter"] : TRUE; + $DisplayValues = isset($Format["DisplayValues"]) ? $Format["DisplayValues"] :FALSE; + $DisplayOffset = isset($Format["DisplayOffset"]) ? $Format["DisplayOffset"] : 2; + $DisplayColor = isset($Format["DisplayColor"]) ? $Format["DisplayColor"] : DISPLAY_MANUAL; + $ForceTransparency = isset($Format["ForceTransparency"]) ? $Format["ForceTransparency"] : NULL; + $DisplayR = isset($Format["DisplayR"]) ? $Format["DisplayR"] : 0; + $DisplayG = isset($Format["DisplayG"]) ? $Format["DisplayG"] : 0; + $DisplayB = isset($Format["DisplayB"]) ? $Format["DisplayB"] : 0; + $AroundZero = isset($Format["AroundZero"]) ? $Format["AroundZero"] : TRUE; $this->LastChartLayout = CHART_LAST_LAYOUT_REGULAR; @@ -4104,12 +4104,12 @@ if ( $DisplayColor == DISPLAY_AUTO ) { $DisplayR = $R; $DisplayG = $G; $DisplayB = $B; } - $AxisID = $Serie["Axis"]; - $Mode = $Data["Axis"][$AxisID]["Display"]; - $Format = $Data["Axis"][$AxisID]["Format"]; - $Unit = $Data["Axis"][$AxisID]["Unit"]; + $AxisID = $Serie["Axis"]; + $Mode = $Data["Axis"][$AxisID]["Display"]; + $Format = $Data["Axis"][$AxisID]["Format"]; + $Unit = $Data["Axis"][$AxisID]["Unit"]; - $Color = array("R"=>$R,"G"=>$G,"B"=>$B); + $Color = array("R"=>$R,"G"=>$G,"B"=>$B); if ( $ForceTransparency != NULL ) { $Color["Alpha"] = $ForceTransparency; } else { $Color["Alpha"] = $Alpha; } $PosArray = $this->scaleComputeY($Serie["Data"],array("AxisID"=>$Serie["Axis"])); @@ -4222,15 +4222,15 @@ /* Draw an area chart */ function drawAreaChart($Format=NULL) { - $DisplayValues = isset($Format["DisplayValues"]) ? $Format["DisplayValues"] : FALSE; - $DisplayOffset = isset($Format["DisplayOffset"]) ? $Format["DisplayOffset"] : 2; - $DisplayColor = isset($Format["DisplayColor"]) ? $Format["DisplayColor"] : DISPLAY_MANUAL; - $DisplayR = isset($Format["DisplayR"]) ? $Format["DisplayR"] : 0; - $DisplayG = isset($Format["DisplayG"]) ? $Format["DisplayG"] : 0; - $DisplayB = isset($Format["DisplayB"]) ? $Format["DisplayB"] : 0; - $ForceTransparency = isset($Format["ForceTransparency"]) ? $Format["ForceTransparency"] : 25; - $AroundZero = isset($Format["AroundZero"]) ? $Format["AroundZero"] : TRUE; - $Threshold = isset($Format["Threshold"]) ? $Format["Threshold"] : NULL; + $DisplayValues = isset($Format["DisplayValues"]) ? $Format["DisplayValues"] : FALSE; + $DisplayOffset = isset($Format["DisplayOffset"]) ? $Format["DisplayOffset"] : 2; + $DisplayColor = isset($Format["DisplayColor"]) ? $Format["DisplayColor"] : DISPLAY_MANUAL; + $DisplayR = isset($Format["DisplayR"]) ? $Format["DisplayR"] : 0; + $DisplayG = isset($Format["DisplayG"]) ? $Format["DisplayG"] : 0; + $DisplayB = isset($Format["DisplayB"]) ? $Format["DisplayB"] : 0; + $ForceTransparency = isset($Format["ForceTransparency"]) ? $Format["ForceTransparency"] : 25; + $AroundZero = isset($Format["AroundZero"]) ? $Format["AroundZero"] : TRUE; + $Threshold = isset($Format["Threshold"]) ? $Format["Threshold"] : NULL; $this->LastChartLayout = CHART_LAST_LAYOUT_REGULAR; @@ -4244,10 +4244,10 @@ $R = $Serie["Color"]["R"]; $G = $Serie["Color"]["G"]; $B = $Serie["Color"]["B"]; $Alpha = $Serie["Color"]["Alpha"]; $Ticks = $Serie["Ticks"]; if ( $DisplayColor == DISPLAY_AUTO ) { $DisplayR = $R; $DisplayG = $G; $DisplayB = $B; } - $AxisID = $Serie["Axis"]; - $Mode = $Data["Axis"][$AxisID]["Display"]; - $Format = $Data["Axis"][$AxisID]["Format"]; - $Unit = $Data["Axis"][$AxisID]["Unit"]; + $AxisID = $Serie["Axis"]; + $Mode = $Data["Axis"][$AxisID]["Display"]; + $Format = $Data["Axis"][$AxisID]["Format"]; + $Unit = $Data["Axis"][$AxisID]["Unit"]; $PosArray = $this->scaleComputeY($Serie["Data"],array("AxisID"=>$Serie["Axis"])); $YZero = $this->scaleComputeY(0,array("AxisID"=>$Serie["Axis"])); @@ -4421,45 +4421,45 @@ /* Draw a bar chart */ function drawBarChart($Format=NULL) { - $Floating0Serie = isset($Format["Floating0Serie"]) ? $Format["Floating0Serie"] : NULL; - $Floating0Value = isset($Format["Floating0Value"]) ? $Format["Floating0Value"] : NULL; - $Draw0Line = isset($Format["Draw0Line"]) ? $Format["Draw0Line"] : FALSE; - $DisplayValues = isset($Format["DisplayValues"]) ? $Format["DisplayValues"] : FALSE; + $Floating0Serie = isset($Format["Floating0Serie"]) ? $Format["Floating0Serie"] : NULL; + $Floating0Value = isset($Format["Floating0Value"]) ? $Format["Floating0Value"] : NULL; + $Draw0Line = isset($Format["Draw0Line"]) ? $Format["Draw0Line"] : FALSE; + $DisplayValues = isset($Format["DisplayValues"]) ? $Format["DisplayValues"] : FALSE; $DisplayOrientation = isset($Format["DisplayOrientation"]) ? $Format["DisplayOrientation"] : ORIENTATION_HORIZONTAL; - $DisplayOffset = isset($Format["DisplayOffset"]) ? $Format["DisplayOffset"] : 2; - $DisplayColor = isset($Format["DisplayColor"]) ? $Format["DisplayColor"] : DISPLAY_MANUAL; - $DisplayFont = isset($Format["DisplaySize"]) ? $Format["DisplaySize"] : $this->FontName; - $DisplaySize = isset($Format["DisplaySize"]) ? $Format["DisplaySize"] : $this->FontSize; - $DisplayPos = isset($Format["DisplayPos"]) ? $Format["DisplayPos"] : LABEL_POS_OUTSIDE; - $DisplayShadow = isset($Format["DisplayShadow"]) ? $Format["DisplayShadow"] : TRUE; - $DisplayR = isset($Format["DisplayR"]) ? $Format["DisplayR"] : 0; - $DisplayG = isset($Format["DisplayG"]) ? $Format["DisplayG"] : 0; - $DisplayB = isset($Format["DisplayB"]) ? $Format["DisplayB"] : 0; - $AroundZero = isset($Format["AroundZero"]) ? $Format["AroundZero"] : TRUE; - $Interleave = isset($Format["Interleave"]) ? $Format["Interleave"] : .5; - $Rounded = isset($Format["Rounded"]) ? $Format["Rounded"] : FALSE; - $RoundRadius = isset($Format["RoundRadius"]) ? $Format["RoundRadius"] : 4; - $Surrounding = isset($Format["Surrounding"]) ? $Format["Surrounding"] : NULL; - $BorderR = isset($Format["BorderR"]) ? $Format["BorderR"] : -1; - $BorderG = isset($Format["BorderG"]) ? $Format["BorderG"] : -1; - $BorderB = isset($Format["BorderB"]) ? $Format["BorderB"] : -1; - $Gradient = isset($Format["Gradient"]) ? $Format["Gradient"] : FALSE; - $GradientMode = isset($Format["GradientMode"]) ? $Format["GradientMode"] : GRADIENT_SIMPLE; - $GradientAlpha = isset($Format["GradientAlpha"]) ? $Format["GradientAlpha"] : 20; - $GradientStartR = isset($Format["GradientStartR"]) ? $Format["GradientStartR"] : 255; - $GradientStartG = isset($Format["GradientStartG"]) ? $Format["GradientStartG"] : 255; - $GradientStartB = isset($Format["GradientStartB"]) ? $Format["GradientStartB"] : 255; - $GradientEndR = isset($Format["GradientEndR"]) ? $Format["GradientEndR"] : 0; - $GradientEndG = isset($Format["GradientEndG"]) ? $Format["GradientEndG"] : 0; - $GradientEndB = isset($Format["GradientEndB"]) ? $Format["GradientEndB"] : 0; - $TxtMargin = isset($Format["TxtMargin"]) ? $Format["TxtMargin"] : 6; - $OverrideColors = isset($Format["OverrideColors"]) ? $Format["OverrideColors"] : NULL; + $DisplayOffset = isset($Format["DisplayOffset"]) ? $Format["DisplayOffset"] : 2; + $DisplayColor = isset($Format["DisplayColor"]) ? $Format["DisplayColor"] : DISPLAY_MANUAL; + $DisplayFont = isset($Format["DisplaySize"]) ? $Format["DisplaySize"] : $this->FontName; + $DisplaySize = isset($Format["DisplaySize"]) ? $Format["DisplaySize"] : $this->FontSize; + $DisplayPos = isset($Format["DisplayPos"]) ? $Format["DisplayPos"] : LABEL_POS_OUTSIDE; + $DisplayShadow = isset($Format["DisplayShadow"]) ? $Format["DisplayShadow"] : TRUE; + $DisplayR = isset($Format["DisplayR"]) ? $Format["DisplayR"] : 0; + $DisplayG = isset($Format["DisplayG"]) ? $Format["DisplayG"] : 0; + $DisplayB = isset($Format["DisplayB"]) ? $Format["DisplayB"] : 0; + $AroundZero = isset($Format["AroundZero"]) ? $Format["AroundZero"] : TRUE; + $Interleave = isset($Format["Interleave"]) ? $Format["Interleave"] : .5; + $Rounded = isset($Format["Rounded"]) ? $Format["Rounded"] : FALSE; + $RoundRadius = isset($Format["RoundRadius"]) ? $Format["RoundRadius"] : 4; + $Surrounding = isset($Format["Surrounding"]) ? $Format["Surrounding"] : NULL; + $BorderR = isset($Format["BorderR"]) ? $Format["BorderR"] : -1; + $BorderG = isset($Format["BorderG"]) ? $Format["BorderG"] : -1; + $BorderB = isset($Format["BorderB"]) ? $Format["BorderB"] : -1; + $Gradient = isset($Format["Gradient"]) ? $Format["Gradient"] : FALSE; + $GradientMode = isset($Format["GradientMode"]) ? $Format["GradientMode"] : GRADIENT_SIMPLE; + $GradientAlpha = isset($Format["GradientAlpha"]) ? $Format["GradientAlpha"] : 20; + $GradientStartR = isset($Format["GradientStartR"]) ? $Format["GradientStartR"] : 255; + $GradientStartG = isset($Format["GradientStartG"]) ? $Format["GradientStartG"] : 255; + $GradientStartB = isset($Format["GradientStartB"]) ? $Format["GradientStartB"] : 255; + $GradientEndR = isset($Format["GradientEndR"]) ? $Format["GradientEndR"] : 0; + $GradientEndG = isset($Format["GradientEndG"]) ? $Format["GradientEndG"] : 0; + $GradientEndB = isset($Format["GradientEndB"]) ? $Format["GradientEndB"] : 0; + $TxtMargin = isset($Format["TxtMargin"]) ? $Format["TxtMargin"] : 6; + $OverrideColors = isset($Format["OverrideColors"]) ? $Format["OverrideColors"] : NULL; $OverrideSurrounding = isset($Format["OverrideSurrounding"]) ? $Format["OverrideSurrounding"] : 30; - $InnerSurrounding = isset($Format["InnerSurrounding"]) ? $Format["InnerSurrounding"] : NULL; - $InnerBorderR = isset($Format["InnerBorderR"]) ? $Format["InnerBorderR"] : -1; - $InnerBorderG = isset($Format["InnerBorderG"]) ? $Format["InnerBorderG"] : -1; - $InnerBorderB = isset($Format["InnerBorderB"]) ? $Format["InnerBorderB"] : -1; - $RecordImageMap = isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE; + $InnerSurrounding = isset($Format["InnerSurrounding"]) ? $Format["InnerSurrounding"] : NULL; + $InnerBorderR = isset($Format["InnerBorderR"]) ? $Format["InnerBorderR"] : -1; + $InnerBorderG = isset($Format["InnerBorderG"]) ? $Format["InnerBorderG"] : -1; + $InnerBorderB = isset($Format["InnerBorderB"]) ? $Format["InnerBorderB"] : -1; + $RecordImageMap = isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE; $this->LastChartLayout = CHART_LAST_LAYOUT_REGULAR; @@ -4487,10 +4487,10 @@ if ( $InnerBorderR == -1 ) { $InnerColor = NULL; } else { $InnerColor = array("R"=>$InnerBorderR,"G"=>$InnerBorderG,"B"=>$InnerBorderB); } $Color = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"BorderR"=>$BorderR,"BorderG"=>$BorderG,"BorderB"=>$BorderB); - $AxisID = $Serie["Axis"]; - $Mode = $Data["Axis"][$AxisID]["Display"]; - $Format = $Data["Axis"][$AxisID]["Format"]; - $Unit = $Data["Axis"][$AxisID]["Unit"]; + $AxisID = $Serie["Axis"]; + $Mode = $Data["Axis"][$AxisID]["Display"]; + $Format = $Data["Axis"][$AxisID]["Format"]; + $Unit = $Data["Axis"][$AxisID]["Unit"]; if (isset($Serie["Description"])) { $SerieDescription = $Serie["Description"]; } else { $SerieDescription = $SerieName; } @@ -4763,37 +4763,37 @@ /* Draw a bar chart */ function drawStackedBarChart($Format=NULL) { - $DisplayValues = isset($Format["DisplayValues"]) ? $Format["DisplayValues"] : FALSE; + $DisplayValues = isset($Format["DisplayValues"]) ? $Format["DisplayValues"] : FALSE; $DisplayOrientation = isset($Format["DisplayOrientation"]) ? $Format["DisplayOrientation"] : ORIENTATION_AUTO; $DisplayRound = isset($Format["DisplayRound"]) ? $Format["DisplayRound"] : 0; - $DisplayColor = isset($Format["DisplayColor"]) ? $Format["DisplayColor"] : DISPLAY_MANUAL; - $DisplayFont = isset($Format["DisplayFont"]) ? $Format["DisplayFont"] : $this->FontName; - $DisplaySize = isset($Format["DisplaySize"]) ? $Format["DisplaySize"] : $this->FontSize; - $DisplayR = isset($Format["DisplayR"]) ? $Format["DisplayR"] : 0; - $DisplayG = isset($Format["DisplayG"]) ? $Format["DisplayG"] : 0; - $DisplayB = isset($Format["DisplayB"]) ? $Format["DisplayB"] : 0; - $Interleave = isset($Format["Interleave"]) ? $Format["Interleave"] : .5; - $Rounded = isset($Format["Rounded"]) ? $Format["Rounded"] : FALSE; - $RoundRadius = isset($Format["RoundRadius"]) ? $Format["RoundRadius"] : 4; - $Surrounding = isset($Format["Surrounding"]) ? $Format["Surrounding"] : NULL; - $BorderR = isset($Format["BorderR"]) ? $Format["BorderR"] : -1; - $BorderG = isset($Format["BorderG"]) ? $Format["BorderG"] : -1; - $BorderB = isset($Format["BorderB"]) ? $Format["BorderB"] : -1; - $Gradient = isset($Format["Gradient"]) ? $Format["Gradient"] : FALSE; - $GradientMode = isset($Format["GradientMode"]) ? $Format["GradientMode"] : GRADIENT_SIMPLE; - $GradientAlpha = isset($Format["GradientAlpha"]) ? $Format["GradientAlpha"] : 20; - $GradientStartR = isset($Format["GradientStartR"]) ? $Format["GradientStartR"] : 255; - $GradientStartG = isset($Format["GradientStartG"]) ? $Format["GradientStartG"] : 255; - $GradientStartB = isset($Format["GradientStartB"]) ? $Format["GradientStartB"] : 255; - $GradientEndR = isset($Format["GradientEndR"]) ? $Format["GradientEndR"] : 0; - $GradientEndG = isset($Format["GradientEndG"]) ? $Format["GradientEndG"] : 0; - $GradientEndB = isset($Format["GradientEndB"]) ? $Format["GradientEndB"] : 0; - $InnerSurrounding = isset($Format["InnerSurrounding"]) ? $Format["InnerSurrounding"] : NULL; - $InnerBorderR = isset($Format["InnerBorderR"]) ? $Format["InnerBorderR"] : -1; - $InnerBorderG = isset($Format["InnerBorderG"]) ? $Format["InnerBorderG"] : -1; - $InnerBorderB = isset($Format["InnerBorderB"]) ? $Format["InnerBorderB"] : -1; - $RecordImageMap = isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE; - $FontFactor = isset($Format["FontFactor"]) ? $Format["FontFactor"] : 8; + $DisplayColor = isset($Format["DisplayColor"]) ? $Format["DisplayColor"] : DISPLAY_MANUAL; + $DisplayFont = isset($Format["DisplayFont"]) ? $Format["DisplayFont"] : $this->FontName; + $DisplaySize = isset($Format["DisplaySize"]) ? $Format["DisplaySize"] : $this->FontSize; + $DisplayR = isset($Format["DisplayR"]) ? $Format["DisplayR"] : 0; + $DisplayG = isset($Format["DisplayG"]) ? $Format["DisplayG"] : 0; + $DisplayB = isset($Format["DisplayB"]) ? $Format["DisplayB"] : 0; + $Interleave = isset($Format["Interleave"]) ? $Format["Interleave"] : .5; + $Rounded = isset($Format["Rounded"]) ? $Format["Rounded"] : FALSE; + $RoundRadius = isset($Format["RoundRadius"]) ? $Format["RoundRadius"] : 4; + $Surrounding = isset($Format["Surrounding"]) ? $Format["Surrounding"] : NULL; + $BorderR = isset($Format["BorderR"]) ? $Format["BorderR"] : -1; + $BorderG = isset($Format["BorderG"]) ? $Format["BorderG"] : -1; + $BorderB = isset($Format["BorderB"]) ? $Format["BorderB"] : -1; + $Gradient = isset($Format["Gradient"]) ? $Format["Gradient"] : FALSE; + $GradientMode = isset($Format["GradientMode"]) ? $Format["GradientMode"] : GRADIENT_SIMPLE; + $GradientAlpha = isset($Format["GradientAlpha"]) ? $Format["GradientAlpha"] : 20; + $GradientStartR = isset($Format["GradientStartR"]) ? $Format["GradientStartR"] : 255; + $GradientStartG = isset($Format["GradientStartG"]) ? $Format["GradientStartG"] : 255; + $GradientStartB = isset($Format["GradientStartB"]) ? $Format["GradientStartB"] : 255; + $GradientEndR = isset($Format["GradientEndR"]) ? $Format["GradientEndR"] : 0; + $GradientEndG = isset($Format["GradientEndG"]) ? $Format["GradientEndG"] : 0; + $GradientEndB = isset($Format["GradientEndB"]) ? $Format["GradientEndB"] : 0; + $InnerSurrounding = isset($Format["InnerSurrounding"]) ? $Format["InnerSurrounding"] : NULL; + $InnerBorderR = isset($Format["InnerBorderR"]) ? $Format["InnerBorderR"] : -1; + $InnerBorderG = isset($Format["InnerBorderG"]) ? $Format["InnerBorderG"] : -1; + $InnerBorderB = isset($Format["InnerBorderB"]) ? $Format["InnerBorderB"] : -1; + $RecordImageMap = isset($Format["RecordImageMap"]) ? $Format["RecordImageMap"] : FALSE; + $FontFactor = isset($Format["FontFactor"]) ? $Format["FontFactor"] : 8; $this->LastChartLayout = CHART_LAST_LAYOUT_STACKED; @@ -4813,10 +4813,10 @@ if ( $InnerSurrounding != NULL ) { $InnerBorderR = $R+$InnerSurrounding; $InnerBorderG = $G+$InnerSurrounding; $InnerBorderB = $B+$InnerSurrounding; } if ( $InnerBorderR == -1 ) { $InnerColor = NULL; } else { $InnerColor = array("R"=>$InnerBorderR,"G"=>$InnerBorderG,"B"=>$InnerBorderB); } - $AxisID = $Serie["Axis"]; - $Mode = $Data["Axis"][$AxisID]["Display"]; - $Format = $Data["Axis"][$AxisID]["Format"]; - $Unit = $Data["Axis"][$AxisID]["Unit"]; + $AxisID = $Serie["Axis"]; + $Mode = $Data["Axis"][$AxisID]["Display"]; + $Format = $Data["Axis"][$AxisID]["Format"]; + $Unit = $Data["Axis"][$AxisID]["Unit"]; if (isset($Serie["Description"])) { $SerieDescription = $Serie["Description"]; } else { $SerieDescription = $SerieName; } @@ -5023,21 +5023,21 @@ /* Draw a stacked area chart */ function drawStackedAreaChart($Format=NULL) { - $DrawLine = isset($Format["DrawLine"]) ? $Format["DrawLine"] : FALSE; - $LineSurrounding = isset($Format["LineSurrounding"]) ? $Format["LineSurrounding"] : NULL; - $LineR = isset($Format["LineR"]) ? $Format["LineR"] : VOID; - $LineG = isset($Format["LineG"]) ? $Format["LineG"] : VOID; - $LineB = isset($Format["LineB"]) ? $Format["LineB"] : VOID; - $LineAlpha = isset($Format["LineAlpha"]) ? $Format["LineAlpha"] : 100; - $DrawPlot = isset($Format["DrawPlot"]) ? $Format["DrawPlot"] : FALSE; - $PlotRadius = isset($Format["PlotRadius"]) ? $Format["PlotRadius"] : 2; - $PlotBorder = isset($Format["PlotBorder"]) ? $Format["PlotBorder"] : 1; + $DrawLine = isset($Format["DrawLine"]) ? $Format["DrawLine"] : FALSE; + $LineSurrounding = isset($Format["LineSurrounding"]) ? $Format["LineSurrounding"] : NULL; + $LineR = isset($Format["LineR"]) ? $Format["LineR"] : VOID; + $LineG = isset($Format["LineG"]) ? $Format["LineG"] : VOID; + $LineB = isset($Format["LineB"]) ? $Format["LineB"] : VOID; + $LineAlpha = isset($Format["LineAlpha"]) ? $Format["LineAlpha"] : 100; + $DrawPlot = isset($Format["DrawPlot"]) ? $Format["DrawPlot"] : FALSE; + $PlotRadius = isset($Format["PlotRadius"]) ? $Format["PlotRadius"] : 2; + $PlotBorder = isset($Format["PlotBorder"]) ? $Format["PlotBorder"] : 1; $PlotBorderSurrounding = isset($Format["PlotBorderSurrounding"]) ? $Format["PlotBorderSurrounding"] : NULL; - $PlotBorderR = isset($Format["PlotBorderR"]) ? $Format["PlotBorderR"] : 0; - $PlotBorderG = isset($Format["PlotBorderG"]) ? $Format["PlotBorderG"] : 0; - $PlotBorderB = isset($Format["PlotBorderB"]) ? $Format["PlotBorderB"] : 0; - $PlotBorderAlpha = isset($Format["PlotBorderAlpha"]) ? $Format["PlotBorderAlpha"] : 50; - $ForceTransparency = isset($Format["ForceTransparency"]) ? $Format["ForceTransparency"] : NULL; + $PlotBorderR = isset($Format["PlotBorderR"]) ? $Format["PlotBorderR"] : 0; + $PlotBorderG = isset($Format["PlotBorderG"]) ? $Format["PlotBorderG"] : 0; + $PlotBorderB = isset($Format["PlotBorderB"]) ? $Format["PlotBorderB"] : 0; + $PlotBorderAlpha = isset($Format["PlotBorderAlpha"]) ? $Format["PlotBorderAlpha"] : 50; + $ForceTransparency = isset($Format["ForceTransparency"]) ? $Format["ForceTransparency"] : NULL; $this->LastChartLayout = CHART_LAST_LAYOUT_STACKED; @@ -5097,10 +5097,10 @@ else $PlotBorderColor = array("R"=>$PlotBorderR,"G"=>$PlotBorderG,"B"=>$PlotBorderB,"Alpha"=>$PlotBorderAlpha); - $AxisID = $Serie["Axis"]; - $Mode = $Data["Axis"][$AxisID]["Display"]; - $Format = $Data["Axis"][$AxisID]["Format"]; - $Unit = $Data["Axis"][$AxisID]["Unit"]; + $AxisID = $Serie["Axis"]; + $Mode = $Data["Axis"][$AxisID]["Display"]; + $Format = $Data["Axis"][$AxisID]["Format"]; + $Unit = $Data["Axis"][$AxisID]["Unit"]; $PosArray = $this->scaleComputeY($Serie["Data"],array("AxisID"=>$Serie["Axis"]),TRUE); $YZero = $this->scaleComputeY(0,array("AxisID"=>$Serie["Axis"])); @@ -5219,45 +5219,45 @@ /* Draw the derivative chart associated to the data series */ function drawDerivative($Format=NULL) { - $Offset = isset($Format["Offset"]) ? $Format["Offset"] : 10; - $SerieSpacing = isset($Format["SerieSpacing"]) ? $Format["SerieSpacing"] : 3; - $DerivativeHeight = isset($Format["DerivativeHeight"]) ? $Format["DerivativeHeight"] : 4; - $ShadedSlopeBox = isset($Format["ShadedSlopeBox"]) ? $Format["ShadedSlopeBox"] : FALSE; - $DrawBackground = isset($Format["DrawBackground"]) ? $Format["DrawBackground"] : TRUE; - $BackgroundR = isset($Format["BackgroundR"]) ? $Format["BackgroundR"] : 255; - $BackgroundG = isset($Format["BackgroundG"]) ? $Format["BackgroundG"] : 255; - $BackgroundB = isset($Format["BackgroundB"]) ? $Format["BackgroundB"] : 255; - $BackgroundAlpha = isset($Format["BackgroundAlpha"]) ? $Format["BackgroundAlpha"] : 20; - $DrawBorder = isset($Format["DrawBorder"]) ? $Format["DrawBorder"] : TRUE; - $BorderR = isset($Format["BorderR"]) ? $Format["BorderR"] : 0; - $BorderG = isset($Format["BorderG"]) ? $Format["BorderG"] : 0; - $BorderB = isset($Format["BorderB"]) ? $Format["BorderB"] : 0; - $BorderAlpha = isset($Format["BorderAlpha"]) ? $Format["BorderAlpha"] : 100; - $Caption = isset($Format["Caption"]) ? $Format["Caption"] : TRUE; - $CaptionHeight = isset($Format["CaptionHeight"]) ? $Format["CaptionHeight"] : 10; - $CaptionWidth = isset($Format["CaptionWidth"]) ? $Format["CaptionWidth"] : 20; - $CaptionMargin = isset($Format["CaptionMargin"]) ? $Format["CaptionMargin"] : 4; - $CaptionLine = isset($Format["CaptionLine"]) ? $Format["CaptionLine"] : FALSE; - $CaptionBox = isset($Format["CaptionBox"]) ? $Format["CaptionBox"] : FALSE; - $CaptionBorderR = isset($Format["CaptionBorderR"]) ? $Format["CaptionBorderR"] : 0; - $CaptionBorderG = isset($Format["CaptionBorderG"]) ? $Format["CaptionBorderG"] : 0; - $CaptionBorderB = isset($Format["CaptionBorderB"]) ? $Format["CaptionBorderB"] : 0; - $CaptionFillR = isset($Format["CaptionFillR"]) ? $Format["CaptionFillR"] : 255; - $CaptionFillG = isset($Format["CaptionFillG"]) ? $Format["CaptionFillG"] : 255; - $CaptionFillB = isset($Format["CaptionFillB"]) ? $Format["CaptionFillB"] : 255; - $CaptionFillAlpha = isset($Format["CaptionFillAlpha"]) ? $Format["CaptionFillAlpha"] : 80; - $PositiveSlopeStartR = isset($Format["PositiveSlopeStartR"]) ? $Format["PositiveSlopeStartR"] : 184; - $PositiveSlopeStartG = isset($Format["PositiveSlopeStartG"]) ? $Format["PositiveSlopeStartG"] : 234; - $PositiveSlopeStartB = isset($Format["PositiveSlopeStartB"]) ? $Format["PositiveSlopeStartB"] : 88; - $PositiveSlopeEndR = isset($Format["PositiveSlopeStartR"]) ? $Format["PositiveSlopeStartR"] : 239; - $PositiveSlopeEndG = isset($Format["PositiveSlopeStartG"]) ? $Format["PositiveSlopeStartG"] : 31; - $PositiveSlopeEndB = isset($Format["PositiveSlopeStartB"]) ? $Format["PositiveSlopeStartB"] : 36; - $NegativeSlopeStartR = isset($Format["NegativeSlopeStartR"]) ? $Format["NegativeSlopeStartR"] : 184; - $NegativeSlopeStartG = isset($Format["NegativeSlopeStartG"]) ? $Format["NegativeSlopeStartG"] : 234; - $NegativeSlopeStartB = isset($Format["NegativeSlopeStartB"]) ? $Format["NegativeSlopeStartB"] : 88; - $NegativeSlopeEndR = isset($Format["NegativeSlopeStartR"]) ? $Format["NegativeSlopeStartR"] : 67; - $NegativeSlopeEndG = isset($Format["NegativeSlopeStartG"]) ? $Format["NegativeSlopeStartG"] : 124; - $NegativeSlopeEndB = isset($Format["NegativeSlopeStartB"]) ? $Format["NegativeSlopeStartB"] : 227; + $Offset = isset($Format["Offset"]) ? $Format["Offset"] : 10; + $SerieSpacing = isset($Format["SerieSpacing"]) ? $Format["SerieSpacing"] : 3; + $DerivativeHeight = isset($Format["DerivativeHeight"]) ? $Format["DerivativeHeight"] : 4; + $ShadedSlopeBox = isset($Format["ShadedSlopeBox"]) ? $Format["ShadedSlopeBox"] : FALSE; + $DrawBackground = isset($Format["DrawBackground"]) ? $Format["DrawBackground"] : TRUE; + $BackgroundR = isset($Format["BackgroundR"]) ? $Format["BackgroundR"] : 255; + $BackgroundG = isset($Format["BackgroundG"]) ? $Format["BackgroundG"] : 255; + $BackgroundB = isset($Format["BackgroundB"]) ? $Format["BackgroundB"] : 255; + $BackgroundAlpha = isset($Format["BackgroundAlpha"]) ? $Format["BackgroundAlpha"] : 20; + $DrawBorder = isset($Format["DrawBorder"]) ? $Format["DrawBorder"] : TRUE; + $BorderR = isset($Format["BorderR"]) ? $Format["BorderR"] : 0; + $BorderG = isset($Format["BorderG"]) ? $Format["BorderG"] : 0; + $BorderB = isset($Format["BorderB"]) ? $Format["BorderB"] : 0; + $BorderAlpha = isset($Format["BorderAlpha"]) ? $Format["BorderAlpha"] : 100; + $Caption = isset($Format["Caption"]) ? $Format["Caption"] : TRUE; + $CaptionHeight = isset($Format["CaptionHeight"]) ? $Format["CaptionHeight"] : 10; + $CaptionWidth = isset($Format["CaptionWidth"]) ? $Format["CaptionWidth"] : 20; + $CaptionMargin = isset($Format["CaptionMargin"]) ? $Format["CaptionMargin"] : 4; + $CaptionLine = isset($Format["CaptionLine"]) ? $Format["CaptionLine"] : FALSE; + $CaptionBox = isset($Format["CaptionBox"]) ? $Format["CaptionBox"] : FALSE; + $CaptionBorderR = isset($Format["CaptionBorderR"]) ? $Format["CaptionBorderR"] : 0; + $CaptionBorderG = isset($Format["CaptionBorderG"]) ? $Format["CaptionBorderG"] : 0; + $CaptionBorderB = isset($Format["CaptionBorderB"]) ? $Format["CaptionBorderB"] : 0; + $CaptionFillR = isset($Format["CaptionFillR"]) ? $Format["CaptionFillR"] : 255; + $CaptionFillG = isset($Format["CaptionFillG"]) ? $Format["CaptionFillG"] : 255; + $CaptionFillB = isset($Format["CaptionFillB"]) ? $Format["CaptionFillB"] : 255; + $CaptionFillAlpha = isset($Format["CaptionFillAlpha"]) ? $Format["CaptionFillAlpha"] : 80; + $PositiveSlopeStartR = isset($Format["PositiveSlopeStartR"]) ? $Format["PositiveSlopeStartR"] : 184; + $PositiveSlopeStartG = isset($Format["PositiveSlopeStartG"]) ? $Format["PositiveSlopeStartG"] : 234; + $PositiveSlopeStartB = isset($Format["PositiveSlopeStartB"]) ? $Format["PositiveSlopeStartB"] : 88; + $PositiveSlopeEndR = isset($Format["PositiveSlopeStartR"]) ? $Format["PositiveSlopeStartR"] : 239; + $PositiveSlopeEndG = isset($Format["PositiveSlopeStartG"]) ? $Format["PositiveSlopeStartG"] : 31; + $PositiveSlopeEndB = isset($Format["PositiveSlopeStartB"]) ? $Format["PositiveSlopeStartB"] : 36; + $NegativeSlopeStartR = isset($Format["NegativeSlopeStartR"]) ? $Format["NegativeSlopeStartR"] : 184; + $NegativeSlopeStartG = isset($Format["NegativeSlopeStartG"]) ? $Format["NegativeSlopeStartG"] : 234; + $NegativeSlopeStartB = isset($Format["NegativeSlopeStartB"]) ? $Format["NegativeSlopeStartB"] : 88; + $NegativeSlopeEndR = isset($Format["NegativeSlopeStartR"]) ? $Format["NegativeSlopeStartR"] : 67; + $NegativeSlopeEndG = isset($Format["NegativeSlopeStartG"]) ? $Format["NegativeSlopeStartG"] : 124; + $NegativeSlopeEndB = isset($Format["NegativeSlopeStartB"]) ? $Format["NegativeSlopeStartB"] : 227; $Data = $this->DataSet->getData(); @@ -5471,11 +5471,11 @@ /* Draw the line of best fit */ function drawBestFit($Format="") { - $OverrideTicks = isset($Format["Ticks"]) ? $Format["Ticks"] : NULL; - $OverrideR = isset($Format["R"]) ? $Format["R"] : VOID; - $OverrideG = isset($Format["G"]) ? $Format["G"] : VOID; - $OverrideB = isset($Format["B"]) ? $Format["B"] : VOID; - $OverrideAlpha = isset($Format["Alpha"]) ? $Format["Alpha"] : VOID; + $OverrideTicks = isset($Format["Ticks"]) ? $Format["Ticks"] : NULL; + $OverrideR = isset($Format["R"]) ? $Format["R"] : VOID; + $OverrideG = isset($Format["G"]) ? $Format["G"] : VOID; + $OverrideB = isset($Format["B"]) ? $Format["B"] : VOID; + $OverrideAlpha = isset($Format["Alpha"]) ? $Format["Alpha"] : VOID; $Data = $this->DataSet->getData(); list($XMargin,$XDivs) = $this->scaleGetXSettings(); @@ -5570,15 +5570,15 @@ /* Write labels */ function writeLabel($SeriesName,$Indexes,$Format="") { - $OverrideTitle = isset($Format["OverrideTitle"]) ? $Format["OverrideTitle"] : NULL; - $ForceLabels = isset($Format["ForceLabels"]) ? $Format["ForceLabels"] : NULL; - $DrawPoint = isset($Format["DrawPoint"]) ? $Format["DrawPoint"] : LABEL_POINT_BOX; - $DrawVerticalLine = isset($Format["DrawVerticalLine"]) ? $Format["DrawVerticalLine"] : FALSE; - $VerticalLineR = isset($Format["VerticalLineR"]) ? $Format["VerticalLineR"] : 0; - $VerticalLineG = isset($Format["VerticalLineG"]) ? $Format["VerticalLineG"] : 0; - $VerticalLineB = isset($Format["VerticalLineB"]) ? $Format["VerticalLineB"] : 0; - $VerticalLineAlpha = isset($Format["VerticalLineAlpha"]) ? $Format["VerticalLineAlpha"] : 40; - $VerticalLineTicks = isset($Format["VerticalLineTicks"]) ? $Format["VerticalLineTicks"] : 2; + $OverrideTitle = isset($Format["OverrideTitle"]) ? $Format["OverrideTitle"] : NULL; + $ForceLabels = isset($Format["ForceLabels"]) ? $Format["ForceLabels"] : NULL; + $DrawPoint = isset($Format["DrawPoint"]) ? $Format["DrawPoint"] : LABEL_POINT_BOX; + $DrawVerticalLine = isset($Format["DrawVerticalLine"]) ? $Format["DrawVerticalLine"] : FALSE; + $VerticalLineR = isset($Format["VerticalLineR"]) ? $Format["VerticalLineR"] : 0; + $VerticalLineG = isset($Format["VerticalLineG"]) ? $Format["VerticalLineG"] : 0; + $VerticalLineB = isset($Format["VerticalLineB"]) ? $Format["VerticalLineB"] : 0; + $VerticalLineAlpha = isset($Format["VerticalLineAlpha"]) ? $Format["VerticalLineAlpha"] : 40; + $VerticalLineTicks = isset($Format["VerticalLineTicks"]) ? $Format["VerticalLineTicks"] : 2; $Data = $this->DataSet->getData(); list($XMargin,$XDivs) = $this->scaleGetXSettings(); @@ -5783,39 +5783,39 @@ /* Draw a label box */ function drawLabelBox($X,$Y,$Title,$Captions,$Format="") { - $NoTitle = isset($Format["NoTitle"]) ? $Format["NoTitle"] : NULL; - $BoxWidth = isset($Format["BoxWidth"]) ? $Format["BoxWidth"] : 50; - $DrawSerieColor = isset($Format["DrawSerieColor"]) ? $Format["DrawSerieColor"] : TRUE; - $SerieR = isset($Format["SerieR"]) ? $Format["SerieR"] : NULL; - $SerieG = isset($Format["SerieG"]) ? $Format["SerieG"] : NULL; - $SerieB = isset($Format["SerieB"]) ? $Format["SerieB"] : NULL; - $SerieAlpha = isset($Format["SerieAlpha"]) ? $Format["SerieAlpha"] : NULL; - $SerieBoxSize = isset($Format["SerieBoxSize"]) ? $Format["SerieBoxSize"] : 6; - $SerieBoxSpacing = isset($Format["SerieBoxSpacing"]) ? $Format["SerieBoxSpacing"] : 4; - $VerticalMargin = isset($Format["VerticalMargin"]) ? $Format["VerticalMargin"] : 10; - $HorizontalMargin = isset($Format["HorizontalMargin"]) ? $Format["HorizontalMargin"] : 8; - $R = isset($Format["R"]) ? $Format["R"] : $this->FontColorR; - $G = isset($Format["G"]) ? $Format["G"] : $this->FontColorG; - $B = isset($Format["B"]) ? $Format["B"] : $this->FontColorB; - $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : $this->FontColorA; - $FontName = isset($Format["FontName"]) ? $Format["FontName"] : $this->FontName; - $FontSize = isset($Format["FontSize"]) ? $Format["FontSize"] : $this->FontSize; - $TitleMode = isset($Format["TitleMode"]) ? $Format["TitleMode"] : LABEL_TITLE_NOBACKGROUND; - $TitleR = isset($Format["TitleR"]) ? $Format["TitleR"] : $R; - $TitleG = isset($Format["TitleG"]) ? $Format["TitleG"] : $G; - $TitleB = isset($Format["TitleB"]) ? $Format["TitleB"] : $B; - $TitleAlpha = isset($Format["TitleAlpha"]) ? $Format["TitleAlpha"] : 100; - $TitleBackgroundR = isset($Format["TitleBackgroundR"]) ? $Format["TitleBackgroundR"] : 0; - $TitleBackgroundG = isset($Format["TitleBackgroundG"]) ? $Format["TitleBackgroundG"] : 0; - $TitleBackgroundB = isset($Format["TitleBackgroundB"]) ? $Format["TitleBackgroundB"] : 0; - $TitleBackgroundAlpha = isset($Format["TitleBackgroundAlpha"]) ? $Format["TitleBackgroundAlpha"] : 100; - $GradientStartR = isset($Format["GradientStartR"]) ? $Format["GradientStartR"] : 255; - $GradientStartG = isset($Format["GradientStartG"]) ? $Format["GradientStartG"] : 255; - $GradientStartB = isset($Format["GradientStartB"]) ? $Format["GradientStartB"] : 255; - $GradientEndR = isset($Format["GradientEndR"]) ? $Format["GradientEndR"] : 220; - $GradientEndG = isset($Format["GradientEndG"]) ? $Format["GradientEndG"] : 220; - $GradientEndB = isset($Format["GradientEndB"]) ? $Format["GradientEndB"] : 220; - $BoxAlpha = isset($Format["BoxAlpha"]) ? $Format["BoxAlpha"] : 100; + $NoTitle = isset($Format["NoTitle"]) ? $Format["NoTitle"] : NULL; + $BoxWidth = isset($Format["BoxWidth"]) ? $Format["BoxWidth"] : 50; + $DrawSerieColor = isset($Format["DrawSerieColor"]) ? $Format["DrawSerieColor"] : TRUE; + $SerieR = isset($Format["SerieR"]) ? $Format["SerieR"] : NULL; + $SerieG = isset($Format["SerieG"]) ? $Format["SerieG"] : NULL; + $SerieB = isset($Format["SerieB"]) ? $Format["SerieB"] : NULL; + $SerieAlpha = isset($Format["SerieAlpha"]) ? $Format["SerieAlpha"] : NULL; + $SerieBoxSize = isset($Format["SerieBoxSize"]) ? $Format["SerieBoxSize"] : 6; + $SerieBoxSpacing = isset($Format["SerieBoxSpacing"]) ? $Format["SerieBoxSpacing"] : 4; + $VerticalMargin = isset($Format["VerticalMargin"]) ? $Format["VerticalMargin"] : 10; + $HorizontalMargin = isset($Format["HorizontalMargin"]) ? $Format["HorizontalMargin"] : 8; + $R = isset($Format["R"]) ? $Format["R"] : $this->FontColorR; + $G = isset($Format["G"]) ? $Format["G"] : $this->FontColorG; + $B = isset($Format["B"]) ? $Format["B"] : $this->FontColorB; + $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : $this->FontColorA; + $FontName = isset($Format["FontName"]) ? $Format["FontName"] : $this->FontName; + $FontSize = isset($Format["FontSize"]) ? $Format["FontSize"] : $this->FontSize; + $TitleMode = isset($Format["TitleMode"]) ? $Format["TitleMode"] : LABEL_TITLE_NOBACKGROUND; + $TitleR = isset($Format["TitleR"]) ? $Format["TitleR"] : $R; + $TitleG = isset($Format["TitleG"]) ? $Format["TitleG"] : $G; + $TitleB = isset($Format["TitleB"]) ? $Format["TitleB"] : $B; + $TitleAlpha = isset($Format["TitleAlpha"]) ? $Format["TitleAlpha"] : 100; + $TitleBackgroundR = isset($Format["TitleBackgroundR"]) ? $Format["TitleBackgroundR"] : 0; + $TitleBackgroundG = isset($Format["TitleBackgroundG"]) ? $Format["TitleBackgroundG"] : 0; + $TitleBackgroundB = isset($Format["TitleBackgroundB"]) ? $Format["TitleBackgroundB"] : 0; + $TitleBackgroundAlpha = isset($Format["TitleBackgroundAlpha"]) ? $Format["TitleBackgroundAlpha"] : 100; + $GradientStartR = isset($Format["GradientStartR"]) ? $Format["GradientStartR"] : 255; + $GradientStartG = isset($Format["GradientStartG"]) ? $Format["GradientStartG"] : 255; + $GradientStartB = isset($Format["GradientStartB"]) ? $Format["GradientStartB"] : 255; + $GradientEndR = isset($Format["GradientEndR"]) ? $Format["GradientEndR"] : 220; + $GradientEndG = isset($Format["GradientEndG"]) ? $Format["GradientEndG"] : 220; + $GradientEndB = isset($Format["GradientEndB"]) ? $Format["GradientEndB"] : 220; + $BoxAlpha = isset($Format["BoxAlpha"]) ? $Format["BoxAlpha"] : 100; if ( !$DrawSerieColor ) { $SerieBoxSize = 0; $SerieBoxSpacing = 0; } @@ -6010,17 +6010,17 @@ function drawPolygonChart($Points,$Format="") { - $R = isset($Format["R"]) ? $Format["R"] : 0; - $G = isset($Format["G"]) ? $Format["G"] : 0; - $B = isset($Format["B"]) ? $Format["B"] : 0; - $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100; - $NoFill = isset($Format["NoFill"]) ? $Format["NoFill"] : FALSE; - $NoBorder = isset($Format["NoBorder"]) ? $Format["NoBorder"] : FALSE; - $BorderR = isset($Format["BorderR"]) ? $Format["BorderR"] : $R; - $BorderG = isset($Format["BorderG"]) ? $Format["BorderG"] : $G; - $BorderB = isset($Format["BorderB"]) ? $Format["BorderB"] : $B; - $BorderAlpha = isset($Format["BorderAlpha"]) ? $Format["BorderAlpha"] : $Alpha / 2; - $Surrounding = isset($Format["Surrounding"]) ? $Format["Surrounding"] : NULL; + $R = isset($Format["R"]) ? $Format["R"] : 0; + $G = isset($Format["G"]) ? $Format["G"] : 0; + $B = isset($Format["B"]) ? $Format["B"] : 0; + $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100; + $NoFill = isset($Format["NoFill"]) ? $Format["NoFill"] : FALSE; + $NoBorder = isset($Format["NoBorder"]) ? $Format["NoBorder"] : FALSE; + $BorderR = isset($Format["BorderR"]) ? $Format["BorderR"] : $R; + $BorderG = isset($Format["BorderG"]) ? $Format["BorderG"] : $G; + $BorderB = isset($Format["BorderB"]) ? $Format["BorderB"] : $B; + $BorderAlpha = isset($Format["BorderAlpha"]) ? $Format["BorderAlpha"] : $Alpha / 2; + $Surrounding = isset($Format["Surrounding"]) ? $Format["Surrounding"] : NULL; $Threshold = isset($Format["Threshold"]) ? $Format["Threshold"] : NULL; if ( $Surrounding != NULL ) { $BorderR = $R+$Surrounding; $BorderG = $G+$Surrounding; $BorderB = $B+$Surrounding; } diff --git a/system/library/games/graph/pImage.php b/system/library/games/graph/pImage.php index 99b6cae..cb9a3cc 100644 --- a/system/library/games/graph/pImage.php +++ b/system/library/games/graph/pImage.php @@ -1,6 +1,6 @@ Shadow = $Enabled; @@ -188,8 +188,8 @@ $RealPos[2]["X"] = cos((270-$Angle)*PI/180)*$Height + $RealPos[1]["X"]; $RealPos[2]["Y"] = sin((270-$Angle)*PI/180)*$Height + $RealPos[1]["Y"]; $RealPos[3]["X"] = cos((180-$Angle)*PI/180)*$Width + $RealPos[2]["X"]; $RealPos[3]["Y"] = sin((180-$Angle)*PI/180)*$Width + $RealPos[2]["Y"]; - $RealPos[TEXT_ALIGN_BOTTOMLEFT]["X"] = $RealPos[0]["X"]; $RealPos[TEXT_ALIGN_BOTTOMLEFT]["Y"] = $RealPos[0]["Y"]; - $RealPos[TEXT_ALIGN_BOTTOMRIGHT]["X"] = $RealPos[1]["X"]; $RealPos[TEXT_ALIGN_BOTTOMRIGHT]["Y"] = $RealPos[1]["Y"]; + $RealPos[TEXT_ALIGN_BOTTOMLEFT]["X"] = $RealPos[0]["X"]; $RealPos[TEXT_ALIGN_BOTTOMLEFT]["Y"] = $RealPos[0]["Y"]; + $RealPos[TEXT_ALIGN_BOTTOMRIGHT]["X"] = $RealPos[1]["X"]; $RealPos[TEXT_ALIGN_BOTTOMRIGHT]["Y"] = $RealPos[1]["Y"]; return($RealPos); } @@ -206,15 +206,15 @@ $RealPos[$i/2]["Y"] = $Y + round($coords[$i+1] * $ca - $coords[$i] * $sa); } - $RealPos[TEXT_ALIGN_BOTTOMLEFT]["X"] = $RealPos[0]["X"]; $RealPos[TEXT_ALIGN_BOTTOMLEFT]["Y"] = $RealPos[0]["Y"]; - $RealPos[TEXT_ALIGN_BOTTOMRIGHT]["X"] = $RealPos[1]["X"]; $RealPos[TEXT_ALIGN_BOTTOMRIGHT]["Y"] = $RealPos[1]["Y"]; - $RealPos[TEXT_ALIGN_TOPLEFT]["X"] = $RealPos[3]["X"]; $RealPos[TEXT_ALIGN_TOPLEFT]["Y"] = $RealPos[3]["Y"]; - $RealPos[TEXT_ALIGN_TOPRIGHT]["X"] = $RealPos[2]["X"]; $RealPos[TEXT_ALIGN_TOPRIGHT]["Y"] = $RealPos[2]["Y"]; - $RealPos[TEXT_ALIGN_BOTTOMMIDDLE]["X"] = ($RealPos[1]["X"]-$RealPos[0]["X"])/2+$RealPos[0]["X"]; $RealPos[TEXT_ALIGN_BOTTOMMIDDLE]["Y"] = ($RealPos[0]["Y"]-$RealPos[1]["Y"])/2+$RealPos[1]["Y"]; - $RealPos[TEXT_ALIGN_TOPMIDDLE]["X"] = ($RealPos[2]["X"]-$RealPos[3]["X"])/2+$RealPos[3]["X"]; $RealPos[TEXT_ALIGN_TOPMIDDLE]["Y"] = ($RealPos[3]["Y"]-$RealPos[2]["Y"])/2+$RealPos[2]["Y"]; - $RealPos[TEXT_ALIGN_MIDDLELEFT]["X"] = ($RealPos[0]["X"]-$RealPos[3]["X"])/2+$RealPos[3]["X"]; $RealPos[TEXT_ALIGN_MIDDLELEFT]["Y"] = ($RealPos[0]["Y"]-$RealPos[3]["Y"])/2+$RealPos[3]["Y"]; - $RealPos[TEXT_ALIGN_MIDDLERIGHT]["X"] = ($RealPos[1]["X"]-$RealPos[2]["X"])/2+$RealPos[2]["X"]; $RealPos[TEXT_ALIGN_MIDDLERIGHT]["Y"] = ($RealPos[1]["Y"]-$RealPos[2]["Y"])/2+$RealPos[2]["Y"]; - $RealPos[TEXT_ALIGN_MIDDLEMIDDLE]["X"] = ($RealPos[1]["X"]-$RealPos[3]["X"])/2+$RealPos[3]["X"]; $RealPos[TEXT_ALIGN_MIDDLEMIDDLE]["Y"] = ($RealPos[0]["Y"]-$RealPos[2]["Y"])/2+$RealPos[2]["Y"]; + $RealPos[TEXT_ALIGN_BOTTOMLEFT]["X"] = $RealPos[0]["X"]; $RealPos[TEXT_ALIGN_BOTTOMLEFT]["Y"] = $RealPos[0]["Y"]; + $RealPos[TEXT_ALIGN_BOTTOMRIGHT]["X"] = $RealPos[1]["X"]; $RealPos[TEXT_ALIGN_BOTTOMRIGHT]["Y"] = $RealPos[1]["Y"]; + $RealPos[TEXT_ALIGN_TOPLEFT]["X"] = $RealPos[3]["X"]; $RealPos[TEXT_ALIGN_TOPLEFT]["Y"] = $RealPos[3]["Y"]; + $RealPos[TEXT_ALIGN_TOPRIGHT]["X"] = $RealPos[2]["X"]; $RealPos[TEXT_ALIGN_TOPRIGHT]["Y"] = $RealPos[2]["Y"]; + $RealPos[TEXT_ALIGN_BOTTOMMIDDLE]["X"] = ($RealPos[1]["X"]-$RealPos[0]["X"])/2+$RealPos[0]["X"]; $RealPos[TEXT_ALIGN_BOTTOMMIDDLE]["Y"] = ($RealPos[0]["Y"]-$RealPos[1]["Y"])/2+$RealPos[1]["Y"]; + $RealPos[TEXT_ALIGN_TOPMIDDLE]["X"] = ($RealPos[2]["X"]-$RealPos[3]["X"])/2+$RealPos[3]["X"]; $RealPos[TEXT_ALIGN_TOPMIDDLE]["Y"] = ($RealPos[3]["Y"]-$RealPos[2]["Y"])/2+$RealPos[2]["Y"]; + $RealPos[TEXT_ALIGN_MIDDLELEFT]["X"] = ($RealPos[0]["X"]-$RealPos[3]["X"])/2+$RealPos[3]["X"]; $RealPos[TEXT_ALIGN_MIDDLELEFT]["Y"] = ($RealPos[0]["Y"]-$RealPos[3]["Y"])/2+$RealPos[3]["Y"]; + $RealPos[TEXT_ALIGN_MIDDLERIGHT]["X"] = ($RealPos[1]["X"]-$RealPos[2]["X"])/2+$RealPos[2]["X"]; $RealPos[TEXT_ALIGN_MIDDLERIGHT]["Y"] = ($RealPos[1]["Y"]-$RealPos[2]["Y"])/2+$RealPos[2]["Y"]; + $RealPos[TEXT_ALIGN_MIDDLEMIDDLE]["X"] = ($RealPos[1]["X"]-$RealPos[3]["X"])/2+$RealPos[3]["X"]; $RealPos[TEXT_ALIGN_MIDDLEMIDDLE]["Y"] = ($RealPos[0]["Y"]-$RealPos[2]["Y"])/2+$RealPos[2]["Y"]; return($RealPos); } @@ -222,12 +222,12 @@ /* Set current font properties */ function setFontProperties($Format="") { - $R = isset($Format["R"]) ? $Format["R"] : -1; - $G = isset($Format["G"]) ? $Format["G"] : -1; - $B = isset($Format["B"]) ? $Format["B"] : -1; - $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100; - $FontName = isset($Format["FontName"]) ? $Format["FontName"] : NULL; - $FontSize = isset($Format["FontSize"]) ? $Format["FontSize"] : NULL; + $R = isset($Format["R"]) ? $Format["R"] : -1; + $G = isset($Format["G"]) ? $Format["G"] : -1; + $B = isset($Format["B"]) ? $Format["B"] : -1; + $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100; + $FontName = isset($Format["FontName"]) ? $Format["FontName"] : NULL; + $FontSize = isset($Format["FontSize"]) ? $Format["FontSize"] : NULL; if ( $R != -1) { $this->FontColorR = $R; } if ( $G != -1) { $this->FontColorG = $G; } @@ -259,8 +259,8 @@ /* Initialise the image map methods */ function initialiseImageMap($Name="pChart",$StorageMode=IMAGE_MAP_STORAGE_SESSION,$UniqueID="imageMap",$StorageFolder="tmp") { - $this->ImageMapIndex = $Name; - $this->ImageMapStorageMode = $StorageMode; + $this->ImageMapIndex = $Name; + $this->ImageMapStorageMode = $StorageMode; if ($StorageMode == IMAGE_MAP_STORAGE_SESSION) { @@ -269,8 +269,8 @@ } elseif($StorageMode == IMAGE_MAP_STORAGE_FILE) { - $this->ImageMapFileName = $UniqueID; - $this->ImageMapStorageFolder = $StorageFolder; + $this->ImageMapFileName = $UniqueID; + $this->ImageMapStorageFolder = $StorageFolder; if (file_exists($StorageFolder."/".$UniqueID.".map")) { unlink($StorageFolder."/".$UniqueID.".map"); } } @@ -394,8 +394,8 @@ /* Dump the image map */ function dumpImageMap($Name="pChart",$StorageMode=IMAGE_MAP_STORAGE_SESSION,$UniqueID="imageMap",$StorageFolder="tmp") { - $this->ImageMapIndex = $Name; - $this->ImageMapStorageMode = $StorageMode; + $this->ImageMapIndex = $Name; + $this->ImageMapStorageMode = $StorageMode; if ( $this->ImageMapStorageMode == IMAGE_MAP_STORAGE_SESSION ) { @@ -442,8 +442,8 @@ /* Mirror Effect */ function drawAreaMirror($X,$Y,$Width,$Height,$Format="") { - $StartAlpha = isset($Format["StartAlpha"]) ? $Format["StartAlpha"] : 80; - $EndAlpha = isset($Format["EndAlpha"]) ? $Format["EndAlpha"] : 0; + $StartAlpha = isset($Format["StartAlpha"]) ? $Format["StartAlpha"] : 80; + $EndAlpha = isset($Format["EndAlpha"]) ? $Format["EndAlpha"] : 0; $AlphaStep = ($StartAlpha-$EndAlpha)/$Height; diff --git a/system/library/games/mc/action.php b/system/library/games/mc/action.php index 003c3ac..cf24a8e 100644 --- a/system/library/games/mc/action.php +++ b/system/library/games/mc/action.php @@ -1,110 +1,110 @@ query('SELECT `uid`, `unit`, `tarif`, `game`, `address`, `slots_start`, `name`, `ram`, `time_start` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `uid`, `unit`, `tarif`, `game`, `address`, `slots_start`, `name`, `ram`, `time_start` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - $sql->query('SELECT `install` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); + $sql->query('SELECT `install` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); $tarif = $sql->get(); - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); - // Проверка ssh соедниения пу с локацией - if(!$ssh->auth($unit['passwd'], $unit['address'])) - return array('e' => sys::text('error', 'ssh')); + // Проверка ssh соедниения пу с локацией + if(!$ssh->auth($unit['passwd'], $unit['address'])) + return array('e' => sys::text('error', 'ssh')); - list($ip, $port) = explode(':', $server['address']); + list($ip, $port) = explode(':', $server['address']); - // Убить процессы - $ssh->set('kill -9 `ps aux | grep s_'.$server['uid'].' | grep -v grep | awk '."'{print $2}'".' | xargs;' - .'lsof -i@'.$server['address'].' | awk '."'{print $2}'".' | grep -v PID | xargs`; sudo -u server'.$server['uid'].' screen -wipe;'); + // Убить процессы + $ssh->set('kill -9 `ps aux | grep s_'.$server['uid'].' | grep -v grep | awk '."'{print $2}'".' | xargs;' + .'lsof -i@'.$server['address'].' | awk '."'{print $2}'".' | grep -v PID | xargs`; sudo -u server'.$server['uid'].' screen -wipe;'); - // Временный файл - $temp = sys::temp(action::config($ip, $port, $server['slots_start'], $ssh->get('cat '.$tarif['install'].'/'.$server['uid'].'/server.properties'))); + // Временный файл + $temp = sys::temp(action::config($ip, $port, $server['slots_start'], $ssh->get('cat '.$tarif['install'].'/'.$server['uid'].'/server.properties'))); - // Обновление файла server.cfg - $ssh->setfile($temp, $tarif['install'].$server['uid'].'/server.properties', 0644); + // Обновление файла server.cfg + $ssh->setfile($temp, $tarif['install'].$server['uid'].'/server.properties', 0644); - unlink($temp); + unlink($temp); - // Параметры запуска - $bash = 'java -Xmx'.$server['ram'].'M -Xms'.$server['ram'].'M -jar start.jar nogui'; + // Параметры запуска + $bash = 'java -Xmx'.$server['ram'].'M -Xms'.$server['ram'].'M -jar start.jar nogui'; - // Временный файл - $temp = sys::temp($bash); + // Временный файл + $temp = sys::temp($bash); - // Обновление файла start.sh - $ssh->setfile($temp, $tarif['install'].$server['uid'].'/start.sh', 0500); + // Обновление файла start.sh + $ssh->setfile($temp, $tarif['install'].$server['uid'].'/start.sh', 0500); - // Строка запуска - $ssh->set('cd '.$tarif['install'].$server['uid'].';' // переход в директорию игрового сервера - .'sudo -u server'.$server['uid'].' mkdir -p oldstart;' // Создание папки логов - .'cat console.log >> oldstart/'.date('d.m.Y_H:i:s', $server['time_start']).'.log; rm console.log; rm oldstart/01.01.1970_03:00:00.log;' // Перемещение лога предыдущего запуска - .'chown server'.$server['uid'].':1000 server.properties start.sh;' // Обновление владельца файлов - .'sudo -u server'.$server['uid'].' screen -dmS s_'.$server['uid'].' '.$taskset.' sh -c "./start.sh > console.log"'); // Запуск игровго сервера + // Строка запуска + $ssh->set('cd '.$tarif['install'].$server['uid'].';' // переход в директорию игрового сервера + .'sudo -u server'.$server['uid'].' mkdir -p oldstart;' // Создание папки логов + .'cat console.log >> oldstart/'.date('d.m.Y_H:i:s', $server['time_start']).'.log; rm console.log; rm oldstart/01.01.1970_03:00:00.log;' // Перемещение лога предыдущего запуска + .'chown server'.$server['uid'].':1000 server.properties start.sh;' // Обновление владельца файлов + .'sudo -u server'.$server['uid'].' screen -dmS s_'.$server['uid'].' '.$taskset.' sh -c "./start.sh > console.log"'); // Запуск игровго сервера - // Обновление информации в базе - $sql->query('UPDATE `servers` set `status`="'.$type.'", `online`="0", `players`="", `time_start`="'.$start_point.'", `stop`="1" WHERE `id`="'.$id.'" LIMIT 1'); + // Обновление информации в базе + $sql->query('UPDATE `servers` set `status`="'.$type.'", `online`="0", `players`="", `time_start`="'.$start_point.'", `stop`="1" WHERE `id`="'.$id.'" LIMIT 1'); - unlink($temp); + unlink($temp); - // Сброс кеша - actions::clmcache($id); + // Сброс кеша + actions::clmcache($id); - sys::reset_mcache('server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => $type, 'online' => 0, 'players' => '')); - sys::reset_mcache('server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => $type, 'online' => 0)); + sys::reset_mcache('server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => $type, 'online' => 0, 'players' => '')); + sys::reset_mcache('server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => $type, 'online' => 0)); - return array('s' => 'ok'); - } + return array('s' => 'ok'); + } - public static function config($ip, $port, $slots, $config) - { - $aLine = explode("\n", $config); + public static function config($ip, $port, $slots, $config) + { + $aLine = explode("\n", $config); - $search = array( - "#^server-ip=(.*?)$#is", - "#^server-port=(.*?)$#is", - "#^rcon\.port=(.*?)$#is", - "#^query\.port=(.*?)$#is", - "#^max-players=(.*?)$#is", - "#^enable-query=(.*?)$#is", - "#^debug=(.*?)$#is" - ); + $search = array( + "#^server-ip=(.*?)$#is", + "#^server-port=(.*?)$#is", + "#^rcon\.port=(.*?)$#is", + "#^query\.port=(.*?)$#is", + "#^max-players=(.*?)$#is", + "#^enable-query=(.*?)$#is", + "#^debug=(.*?)$#is" + ); - $config = ''; + $config = ''; - foreach($aLine as $line) - { - if(str_replace(array(' ', "\t"), '', $line) != '') - $edit = trim(preg_replace($search, array('','','','','','',''), $line)); + foreach($aLine as $line) + { + if(str_replace(array(' ', "\t"), '', $line) != '') + $edit = trim(preg_replace($search, array('','','','','','',''), $line)); - if($edit != '') - $config .= $edit.PHP_EOL; + if($edit != '') + $config .= $edit.PHP_EOL; - $edit = ''; - } + $edit = ''; + } - $config .= 'server-ip='.$ip.PHP_EOL - .'server-port='.$port.PHP_EOL - .'rcon.port='.($port+10000).PHP_EOL - .'query.port='.($port).PHP_EOL - .'max-players='.$slots.PHP_EOL - .'enable-query=true'.PHP_EOL - .'debug=false'; + $config .= 'server-ip='.$ip.PHP_EOL + .'server-port='.$port.PHP_EOL + .'rcon.port='.($port+10000).PHP_EOL + .'query.port='.($port).PHP_EOL + .'max-players='.$slots.PHP_EOL + .'enable-query=true'.PHP_EOL + .'debug=false'; - return $config; - } + return $config; + } } ?> \ No newline at end of file diff --git a/system/library/games/mc/scan.php b/system/library/games/mc/scan.php index ed18502..48829a2 100644 --- a/system/library/games/mc/scan.php +++ b/system/library/games/mc/scan.php @@ -1,113 +1,113 @@ query('SELECT `address`, `game`, `name`, `map`, `online`, `players`, `status`, `time`, `overdue` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `address`, `game`, `name`, `map`, `online`, `players`, `status`, `time`, `overdue` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - list($ip, $port) = explode(':', $server['address']); + list($ip, $port) = explode(':', $server['address']); - include(LIB.'games/query/McQuery.php'); + include(LIB.'games/query/McQuery.php'); - $sq = new McQuery($ip, $port); + $sq = new McQuery($ip, $port); - if($players_get) - $nmch = 'server_scan_mon_pl_'.$id; - else - $nmch = 'server_scan_mon_'.$id; + if($players_get) + $nmch = 'server_scan_mon_pl_'.$id; + else + $nmch = 'server_scan_mon_'.$id; - if(is_array($mcache->get($nmch))) - return $mcache->get($nmch); + if(is_array($mcache->get($nmch))) + return $mcache->get($nmch); - $out = array(); + $out = array(); - $out['time'] = 'Арендован до: '.date('d.m.Y - H:i', $server['time']); + $out['time'] = 'Арендован до: '.date('d.m.Y - H:i', $server['time']); - if($server['status'] == 'overdue') - $out['time_end'] = 'Удаление через: '.sys::date('min', $server['overdue']+$cfg['server_delete']*86400); - else - $out['time_end'] = 'Осталось: '.sys::date('min', $server['time']); + if($server['status'] == 'overdue') + $out['time_end'] = 'Удаление через: '.sys::date('min', $server['overdue']+$cfg['server_delete']*86400); + else + $out['time_end'] = 'Осталось: '.sys::date('min', $server['time']); - $info = $sq->getInfo($players_get); + $info = $sq->getInfo($players_get); - if(!is_array($info)) - { - $out['name'] = $server['name']; - $out['status'] = sys::status($server['status'], $server['game'], $server['map']); - $out['online'] = $server['online']; - $out['image'] = ''; - $out['buttons'] = sys::buttons($id, $server['status'], $server['game']); + if(!is_array($info)) + { + $out['name'] = $server['name']; + $out['status'] = sys::status($server['status'], $server['game'], $server['map']); + $out['online'] = $server['online']; + $out['image'] = ''; + $out['buttons'] = sys::buttons($id, $server['status'], $server['game']); - if($players_get) - $out['players'] = base64_decode($server['players']); + if($players_get) + $out['players'] = base64_decode($server['players']); - $mcache->set($nmch, $out, false, $cfg['mcache_server_mon']); + $mcache->set($nmch, $out, false, $cfg['mcache_server_mon']); - return $out; - } + return $out; + } - $players = scan::players($info['players_list']); + $players = scan::players($info['players_list']); - $info['map'] = htmlspecialchars(mb_convert_encoding($info['map'], 'UTF-8', 'WINDOWS-1251')); - $out['name'] = htmlspecialchars(mb_convert_encoding($info['hostname'], 'UTF-8', 'WINDOWS-1251')); - $out['status'] = sys::status('working', $server['game'], $info['map']); - $out['online'] = sys::int($info['online']); - $out['image'] = ''; - $out['buttons'] = sys::buttons($id, 'working', $server['game']); - $out['players'] = ''; + $info['map'] = htmlspecialchars(mb_convert_encoding($info['map'], 'UTF-8', 'WINDOWS-1251')); + $out['name'] = htmlspecialchars(mb_convert_encoding($info['hostname'], 'UTF-8', 'WINDOWS-1251')); + $out['status'] = sys::status('working', $server['game'], $info['map']); + $out['online'] = sys::int($info['online']); + $out['image'] = ''; + $out['buttons'] = sys::buttons($id, 'working', $server['game']); + $out['players'] = ''; - if($players_get) - { - foreach($players as $index => $player) - { - $html->get($server['game'], 'sections/servers/players'); + if($players_get) + { + foreach($players as $index => $player) + { + $html->get($server['game'], 'sections/servers/players'); - $html->set('i', $player['i']); - $html->set('name', $player['name']); - $html->set('ping', $player['ping']); + $html->set('i', $player['i']); + $html->set('name', $player['name']); + $html->set('ping', $player['ping']); - $html->pack('list'); - } + $html->pack('list'); + } - $out['players'] = isset($html->arr['list']) ? $html->arr['list'] : ''; - } + $out['players'] = isset($html->arr['list']) ? $html->arr['list'] : ''; + } - $sql->query('UPDATE `servers` set ' - .'`name`="'.$out['name'].'", ' - .'`online`="'.$out['online'].'", ' - .'`map`="'.$info['map'].'", ' - .'`status`="working" WHERE `id`="'.$id.'" LIMIT 1'); + $sql->query('UPDATE `servers` set ' + .'`name`="'.$out['name'].'", ' + .'`online`="'.$out['online'].'", ' + .'`map`="'.$info['map'].'", ' + .'`status`="working" WHERE `id`="'.$id.'" LIMIT 1'); - if($players_get) - $sql->query('UPDATE `servers` set `players`="'.base64_encode($out['players']).'" WHERE `id`="'.$id.'" LIMIT 1'); + if($players_get) + $sql->query('UPDATE `servers` set `players`="'.base64_encode($out['players']).'" WHERE `id`="'.$id.'" LIMIT 1'); - $mcache->set($nmch, $out, false, $cfg['mcache_server_mon']); + $mcache->set($nmch, $out, false, $cfg['mcache_server_mon']); - return $out; - } + return $out; + } - public static function players($aPlayrs) - { - $i = 1; - $aData = array(); + public static function players($aPlayrs) + { + $i = 1; + $aData = array(); - foreach($aPlayrs as $n => $player) - { - $aData[$i]['i'] = $i; - $aData[$i]['name'] = $player['nickname'] == '' ? 'Подключается' : htmlspecialchars($player['nickname']); + foreach($aPlayrs as $n => $player) + { + $aData[$i]['i'] = $i; + $aData[$i]['name'] = $player['nickname'] == '' ? 'Подключается' : htmlspecialchars($player['nickname']); - $i+=1; - } + $i+=1; + } - return $aData; - } - } + return $aData; + } + } ?> \ No newline at end of file diff --git a/system/library/games/mc/service.php b/system/library/games/mc/service.php index 38745a8..97337dd 100644 --- a/system/library/games/mc/service.php +++ b/system/library/games/mc/service.php @@ -1,369 +1,369 @@ query('SELECT `address`, `test` FROM `units` WHERE `id`="'.$aData['unit'].'" AND `mc`="1" AND `show`="1" LIMIT 1'); - if(!$sql->num()) - sys::outjs(array('e' => 'Локация не найдена.')); + // Проверка локации + $sql->query('SELECT `address`, `test` FROM `units` WHERE `id`="'.$aData['unit'].'" AND `mc`="1" AND `show`="1" LIMIT 1'); + if(!$sql->num()) + sys::outjs(array('e' => 'Локация не найдена.')); - $unit = $sql->get(); + $unit = $sql->get(); - // Проверка тарифа - $sql->query('SELECT `id` FROM `tarifs` WHERE `id`="'.$aData['tarif'].'" AND `unit`="'.$aData['unit'].'" AND `show`="1" LIMIT 1'); - if(!$sql->num()) - sys::outjs(array('e' => 'Тариф не найден.')); + // Проверка тарифа + $sql->query('SELECT `id` FROM `tarifs` WHERE `id`="'.$aData['tarif'].'" AND `unit`="'.$aData['unit'].'" AND `show`="1" LIMIT 1'); + if(!$sql->num()) + sys::outjs(array('e' => 'Тариф не найден.')); - $sql->query('SELECT ' - .'`slots_min`,' - .'`slots_max`,' - .'`port_min`,' - .'`port_max`,' - .'`hostname`,' - .'`packs`,' - .'`ram`,' - .'`param_fix`,' - .'`time`,' - .'`test`,' - .'`tests`,' - .'`discount`,' - .'`map`,' - .'`ftp`,' - .'`plugins`,' - .'`console`,' - .'`stats`,' - .'`copy`,' - .'`web`,' - .'`plugins_install`,' - .'`hdd`,' - .'`autostop`,' - .'`core_fix`,' - .'`ip`,' - .'`price`' - .' FROM `tarifs` WHERE `id`="'.$aData['tarif'].'" LIMIT 1'); + $sql->query('SELECT ' + .'`slots_min`,' + .'`slots_max`,' + .'`port_min`,' + .'`port_max`,' + .'`hostname`,' + .'`packs`,' + .'`ram`,' + .'`param_fix`,' + .'`time`,' + .'`test`,' + .'`tests`,' + .'`discount`,' + .'`map`,' + .'`ftp`,' + .'`plugins`,' + .'`console`,' + .'`stats`,' + .'`copy`,' + .'`web`,' + .'`plugins_install`,' + .'`hdd`,' + .'`autostop`,' + .'`core_fix`,' + .'`ip`,' + .'`price`' + .' FROM `tarifs` WHERE `id`="'.$aData['tarif'].'" LIMIT 1'); - $tarif = $sql->get(); + $tarif = $sql->get(); - // Проверка сборки - if(!array_key_exists($aData['pack'], sys::b64djs($tarif['packs'], true))) - sys::outjs(array('e' => 'Сборка не найдена.')); + // Проверка сборки + if(!array_key_exists($aData['pack'], sys::b64djs($tarif['packs'], true))) + sys::outjs(array('e' => 'Сборка не найдена.')); - // Проверка RAM - if(!in_array($aData['ram'], explode(':', $tarif['ram']))) - sys::outjs(array('e' => 'Переданные данные ram неверны.')); + // Проверка RAM + if(!in_array($aData['ram'], explode(':', $tarif['ram']))) + sys::outjs(array('e' => 'Переданные данные ram неверны.')); - $test = 0; + $test = 0; - // Проверка периода на тест - if($aData['test']) - { - if(!$tarif['test'] || !$unit['test']) - sys::outjs(array('e' => 'Тестовый период недоступен.')); + // Проверка периода на тест + if($aData['test']) + { + if(!$tarif['test'] || !$unit['test']) + sys::outjs(array('e' => 'Тестовый период недоступен.')); - // Проверка на повторный запрос - $sql->query('SELECT `id`, `game` FROM `tests` WHERE `user`="'.$user['id'].'" LIMIT 1'); - if($sql->num()) - { - $test_info = $sql->get(); + // Проверка на повторный запрос + $sql->query('SELECT `id`, `game` FROM `tests` WHERE `user`="'.$user['id'].'" LIMIT 1'); + if($sql->num()) + { + $test_info = $sql->get(); - if(!$cfg['tests']['game'] || $test_info['game'] == 'mc') - sys::outjs(array('e' => 'Тестовый период предоставляется один раз.')); + if(!$cfg['tests']['game'] || $test_info['game'] == 'mc') + sys::outjs(array('e' => 'Тестовый период предоставляется один раз.')); - $sql->query('SELECT `id` FROM `servers` WHERE `user`="'.$user['id'].'" AND `test`="1" LIMIT 1'); - if($sql->num() AND !$cfg['tests']['sametime']) - sys::outjs(array('e' => 'Чтобы получить тестовый период другой игры, дождитесь окончания текущего.')); - } + $sql->query('SELECT `id` FROM `servers` WHERE `user`="'.$user['id'].'" AND `test`="1" LIMIT 1'); + if($sql->num() AND !$cfg['tests']['sametime']) + sys::outjs(array('e' => 'Чтобы получить тестовый период другой игры, дождитесь окончания текущего.')); + } - // Проверка наличия мест на локации - $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND `test`="1" AND `time`>"'.$start_point.'" LIMIT '.$unit['test']); - if($sql->num() == $unit['test']) - sys::outjs(array('e' => 'Свободного места для тестового периода нет.')); + // Проверка наличия мест на локации + $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND `test`="1" AND `time`>"'.$start_point.'" LIMIT '.$unit['test']); + if($sql->num() == $unit['test']) + sys::outjs(array('e' => 'Свободного места для тестового периода нет.')); - // Проверка наличия мест для выбранного тарифа - $sql->query('SELECT `id` FROM `servers` WHERE `tarif`="'.$aData['tarif'].'" AND `test`="1" AND `time`>"'.$start_point.'" LIMIT '.$tarif['tests']); - if($sql->num() == $tarif['tests']) - sys::outjs(array('e' => 'Свободного места для тестового периода выбранного тарифа нет.')); + // Проверка наличия мест для выбранного тарифа + $sql->query('SELECT `id` FROM `servers` WHERE `tarif`="'.$aData['tarif'].'" AND `test`="1" AND `time`>"'.$start_point.'" LIMIT '.$tarif['tests']); + if($sql->num() == $tarif['tests']) + sys::outjs(array('e' => 'Свободного места для тестового периода выбранного тарифа нет.')); - $test = 1; - }else - // Проверка периода - if(!$cfg['settlement_period'] AND !in_array($aData['time'], explode(':', $tarif['time']))) - sys::outjs(array('e' => 'Переданные данные периода неверны.')); + $test = 1; + }else + // Проверка периода + if(!$cfg['settlement_period'] AND !in_array($aData['time'], explode(':', $tarif['time']))) + sys::outjs(array('e' => 'Переданные данные периода неверны.')); - // Проверка слот - if($aData['slots'] < $tarif['slots_min'] || $aData['slots'] > $tarif['slots_max']) - sys::outjs(array('e' => 'Переданные данные слот неверны.')); + // Проверка слот + if($aData['slots'] < $tarif['slots_min'] || $aData['slots'] > $tarif['slots_max']) + sys::outjs(array('e' => 'Переданные данные слот неверны.')); - // Определение цены - $aPrice = explode(':', $tarif['price']); - $price = $aPrice[array_search($aData['ram'], explode(':', $tarif['ram']))]; + // Определение цены + $aPrice = explode(':', $tarif['price']); + $price = $aPrice[array_search($aData['ram'], explode(':', $tarif['ram']))]; - // Определение суммы - if($cfg['settlement_period']) - { - // Цена аренды за расчетный период - $sum = games::define_sum($tarif['discount'], $price, $aData['slots'], $start_point); + // Определение суммы + if($cfg['settlement_period']) + { + // Цена аренды за расчетный период + $sum = games::define_sum($tarif['discount'], $price, $aData['slots'], $start_point); - $aData['time'] = games::define_period('buy', params::$aDayMonth); - }else - $sum = games::define_sum($tarif['discount'], $price, $aData['slots'], $aData['time']); + $aData['time'] = games::define_period('buy', params::$aDayMonth); + }else + $sum = games::define_sum($tarif['discount'], $price, $aData['slots'], $aData['time']); - // Проверка промо-кода - $promo = games::define_promo( - $aData['promo'], - array( - 'tarif' => $aData['tarif'], - 'ram' => $aData['ram'], - 'slots' => $aData['slots'], - 'time' => $aData['time'], - 'user' => $user['id'] - ), - $tarif['discount'], - $sum - ); + // Проверка промо-кода + $promo = games::define_promo( + $aData['promo'], + array( + 'tarif' => $aData['tarif'], + 'ram' => $aData['ram'], + 'slots' => $aData['slots'], + 'time' => $aData['time'], + 'user' => $user['id'] + ), + $tarif['discount'], + $sum + ); - $days = $aData['time']; // Кол-во дней аренды + $days = $aData['time']; // Кол-во дней аренды - // Использование промо-кода - if(is_array($promo)) - { - if(array_key_exists('sum', $promo)) - $sum = $promo['sum']; - else - $days += $promo['days']; // Кол-во дней аренды с учетом подарочных (промо-код) - } + // Использование промо-кода + if(is_array($promo)) + { + if(array_key_exists('sum', $promo)) + $sum = $promo['sum']; + else + $days += $promo['days']; // Кол-во дней аренды с учетом подарочных (промо-код) + } - // Проверка баланса - if($user['balance'] < $sum) - sys::outjs(array('e' => 'У вас не хватает '.(round($sum-$user['balance'], 2)).' '.$cfg['currency'])); + // Проверка баланса + if($user['balance'] < $sum) + sys::outjs(array('e' => 'У вас не хватает '.(round($sum-$user['balance'], 2)).' '.$cfg['currency'])); - // Выделенный адрес игрового сервера - if(!empty($tarif['ip'])) - { - $aIp = explode(':', $tarif['ip']); + // Выделенный адрес игрового сервера + if(!empty($tarif['ip'])) + { + $aIp = explode(':', $tarif['ip']); - $ip = false; - $port = params::$aDefPort['mc']; + $ip = false; + $port = params::$aDefPort['mc']; - // Проверка наличия свободного адреса - foreach($aIp as $adr) - { - $adr = trim($adr); + // Проверка наличия свободного адреса + foreach($aIp as $adr) + { + $adr = trim($adr); - $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND `address` LIKE "'.$adr.':%" LIMIT 1'); - if(!$sql->num()) - { - $ip = $adr; + $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND `address` LIKE "'.$adr.':%" LIMIT 1'); + if(!$sql->num()) + { + $ip = $adr; - break; - } - } - }else{ - $ip = sys::first(explode(':', $unit['address'])); - $port = false; + break; + } + } + }else{ + $ip = sys::first(explode(':', $unit['address'])); + $port = false; - // Проверка наличия свободного порта - for($tarif['port_min']; $tarif['port_min'] <= $tarif['port_max']; $tarif['port_min']+=1) - { - $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND (`address`="'.$ip.':'.$tarif['port_min'].'" OR `port`="'.$tarif['port_min'].'") LIMIT 1'); - if(!$sql->num()) - { - $port = $tarif['port_min']; + // Проверка наличия свободного порта + for($tarif['port_min']; $tarif['port_min'] <= $tarif['port_max']; $tarif['port_min']+=1) + { + $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND (`address`="'.$ip.':'.$tarif['port_min'].'" OR `port`="'.$tarif['port_min'].'") LIMIT 1'); + if(!$sql->num()) + { + $port = $tarif['port_min']; - break; - } - } - } + break; + } + } + } - if(!$ip || !$port) - { - $sql->query('UPDATE `tarifs` set `show`="0" WHERE `id`="'.$aData['tarif'].'" LIMIT 1'); + if(!$ip || !$port) + { + $sql->query('UPDATE `tarifs` set `show`="0" WHERE `id`="'.$aData['tarif'].'" LIMIT 1'); - sys::outjs(array('e' => 'К сожалению нет доступных мест, обратитесь в тех.поддержку.')); - } + sys::outjs(array('e' => 'К сожалению нет доступных мест, обратитесь в тех.поддержку.')); + } - if($test) - $aData['time'] = games::time($start_point, $tarif['test']); - else - $aData['time'] = games::time($start_point, $days); + if($test) + $aData['time'] = games::time($start_point, $tarif['test']); + else + $aData['time'] = games::time($start_point, $days); - $fix_one = 0; - $core = 0; + $fix_one = 0; + $core = 0; - if($tarif['core_fix'] != '') - { - $aCore = explode(',', $tarif['core_fix']); + if($tarif['core_fix'] != '') + { + $aCore = explode(',', $tarif['core_fix']); - foreach($aCore as $cpu) - { - $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND `tarif`="'.$aData['tarif'].'" AND `core_fix`="'.$cpu.'" AND `core_fix_one`="1" LIMIT 1'); + foreach($aCore as $cpu) + { + $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND `tarif`="'.$aData['tarif'].'" AND `core_fix`="'.$cpu.'" AND `core_fix_one`="1" LIMIT 1'); - if($sql->num()) - continue; + if($sql->num()) + continue; - $fix_one = 1; - $core = $cpu; + $fix_one = 1; + $core = $cpu; - break; - } + break; + } - if(!$core) - { - $sql->query('UPDATE `tarifs` set `show`="0" WHERE `id`="'.$aData['tarif'].'" LIMIT 1'); + if(!$core) + { + $sql->query('UPDATE `tarifs` set `show`="0" WHERE `id`="'.$aData['tarif'].'" LIMIT 1'); - sys::outjs(array('e' => 'К сожалению нет доступных мест, обратитесь в тех.поддержку.')); - } - } + sys::outjs(array('e' => 'К сожалению нет доступных мест, обратитесь в тех.поддержку.')); + } + } - $ram = $tarif['param_fix'] ? $aData['ram'] : $aData['ram']*$aData['slots']; + $ram = $tarif['param_fix'] ? $aData['ram'] : $aData['ram']*$aData['slots']; - // Массив данных - $aSDATA = array( - 'unit' => $aData['unit'], // идентификатор локации - 'tarif' => $aData['tarif'], // идентификатор тарифа - 'ram' => $ram, // значение ram - 'param_fix' => $tarif['param_fix'], // фиксированные параметры - 'pack' => $aData['pack'], // Выбранная сборка для установки - 'time' => $aData['time'], // Время аренды - 'days' => $days, // Число дней - 'sum' => $sum, // Сумма списания - 'test' => $test, // тестовый период - 'address' => $ip.':'.$port, // адрес игрового сервера - 'port' => $port, // порт игрового сервера - 'slots' => $aData['slots'], // Кол-во слот - 'map' => $tarif['map'], // Фиксированное значение слот - 'autostop' => $tarif['autostop'], // Выключение при 0 онлайне - 'ftp' => $tarif['ftp'], // Использование ftp - 'plugins' => $tarif['plugins'], // Использование плагинов - 'console' => $tarif['console'], // Использование консоли - 'stats' => $tarif['stats'], // Использование графиков (ведение статистики) - 'copy' => $tarif['copy'], // Использование резервных копий - 'web' => $tarif['web'], // Использование доп услуг - 'plugins_install' => $tarif['plugins_install'], // Список установленных плагинов - 'hdd' => $tarif['hdd'], // Дисковое пространство - 'core_fix' => $core, // Выделенный поток - 'core_fix_one' => $fix_one, // Выделенный поток - 'promo' => $promo // Использование промо-кода - ); + // Массив данных + $aSDATA = array( + 'unit' => $aData['unit'], // идентификатор локации + 'tarif' => $aData['tarif'], // идентификатор тарифа + 'ram' => $ram, // значение ram + 'param_fix' => $tarif['param_fix'], // фиксированные параметры + 'pack' => $aData['pack'], // Выбранная сборка для установки + 'time' => $aData['time'], // Время аренды + 'days' => $days, // Число дней + 'sum' => $sum, // Сумма списания + 'test' => $test, // тестовый период + 'address' => $ip.':'.$port, // адрес игрового сервера + 'port' => $port, // порт игрового сервера + 'slots' => $aData['slots'], // Кол-во слот + 'map' => $tarif['map'], // Фиксированное значение слот + 'autostop' => $tarif['autostop'], // Выключение при 0 онлайне + 'ftp' => $tarif['ftp'], // Использование ftp + 'plugins' => $tarif['plugins'], // Использование плагинов + 'console' => $tarif['console'], // Использование консоли + 'stats' => $tarif['stats'], // Использование графиков (ведение статистики) + 'copy' => $tarif['copy'], // Использование резервных копий + 'web' => $tarif['web'], // Использование доп услуг + 'plugins_install' => $tarif['plugins_install'], // Список установленных плагинов + 'hdd' => $tarif['hdd'], // Дисковое пространство + 'core_fix' => $core, // Выделенный поток + 'core_fix_one' => $fix_one, // Выделенный поток + 'promo' => $promo // Использование промо-кода + ); - return $aSDATA; - } + return $aSDATA; + } - public static function install($aSDATA = array()) - { - global $cfg, $sql, $user, $start_point; + public static function install($aSDATA = array()) + { + global $cfg, $sql, $user, $start_point; - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - // Массив данных локации (адрес,пароль) - $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$aSDATA['unit'].'" LIMIT 1'); - $unit = $sql->get(); + // Массив данных локации (адрес,пароль) + $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$aSDATA['unit'].'" LIMIT 1'); + $unit = $sql->get(); - // Проверка ssh соединения с локацией - if(!$ssh->auth($unit['passwd'], $unit['address'])) - sys::outjs(array('e' => sys::text('error', 'ssh'))); + // Проверка ssh соединения с локацией + if(!$ssh->auth($unit['passwd'], $unit['address'])) + sys::outjs(array('e' => sys::text('error', 'ssh'))); - // Массив данных тарифа (путь сборки,путь установки) - $sql->query('SELECT `path`, `install`, `hostname` FROM `tarifs` WHERE `id`="'.$aSDATA['tarif'].'" LIMIT 1'); - $tarif = $sql->get(); + // Массив данных тарифа (путь сборки,путь установки) + $sql->query('SELECT `path`, `install`, `hostname` FROM `tarifs` WHERE `id`="'.$aSDATA['tarif'].'" LIMIT 1'); + $tarif = $sql->get(); - // Получение идентификаторов игрового сервера - $sql->query('INSERT INTO `servers` set uid="1"'); - $id = $sql->id(); - $uid = $id+1000; + // Получение идентификаторов игрового сервера + $sql->query('INSERT INTO `servers` set uid="1"'); + $id = $sql->id(); + $uid = $id+1000; - // Директория сборки - $path = $tarif['path'].$aSDATA['pack']; + // Директория сборки + $path = $tarif['path'].$aSDATA['pack']; - // Директория игрового сервера - $install = $tarif['install'].$uid; + // Директория игрового сервера + $install = $tarif['install'].$uid; - $ssh->set('mkdir '.$install.';' // Создание директории - .'useradd -s /bin/false -d '.$install.' -g servers -u '.$uid.' server'.$uid.';' // Создание пользователя сервера на локации - .'chown server'.$uid.':1000 '.$install.';' // Изменение владельца и группы директории - .'cd '.$install.' && sudo -u server'.$uid.' screen -dmS i_'.$uid.' sh -c "cp -r '.$path.'/. .;' // Копирование файлов сборки для сервера - .'find . -type d -exec chmod 700 {} \;;' - .'find . -type f -exec chmod 600 {} \;;' - .'chmod 500 '.params::$aFileGame['mc'].'"'); + $ssh->set('mkdir '.$install.';' // Создание директории + .'useradd -s /bin/false -d '.$install.' -g servers -u '.$uid.' server'.$uid.';' // Создание пользователя сервера на локации + .'chown server'.$uid.':1000 '.$install.';' // Изменение владельца и группы директории + .'cd '.$install.' && sudo -u server'.$uid.' screen -dmS i_'.$uid.' sh -c "cp -r '.$path.'/. .;' // Копирование файлов сборки для сервера + .'find . -type d -exec chmod 700 {} \;;' + .'find . -type f -exec chmod 600 {} \;;' + .'chmod 500 '.params::$aFileGame['mc'].'"'); - // Запись данных нового сервера - $sql->query('UPDATE `servers` set - `uid`="'.$uid.'", - `unit`="'.$aSDATA['unit'].'", - `tarif`="'.$aSDATA['tarif'].'", - `user`="'.$user['id'].'", - `address`="'.$aSDATA['address'].'", - `port`="'.$aSDATA['port'].'", - `game`="mc", - `slots`="'.$aSDATA['slots'].'", - `slots_start`="'.$aSDATA['slots'].'", - `status`="install", - `name`="'.$tarif['hostname'].'", - `pack`="'.$aSDATA['pack'].'", - `plugins_use`="'.$aSDATA['plugins'].'", - `ftp_use`="'.$aSDATA['ftp'].'", - `console_use`="'.$aSDATA['console'].'", - `stats_use`="'.$aSDATA['stats'].'", - `copy_use`="'.$aSDATA['copy'].'", - `web_use`="'.$aSDATA['web'].'", - `ram`="'.$aSDATA['ram'].'", - `ram_fix`="'.$aSDATA['param_fix'].'", - `map_start`="'.$aSDATA['map'].'", - `vac`="1", - `hdd`="'.$aSDATA['hdd'].'", - `time`="'.$aSDATA['time'].'", - `date`="'.$start_point.'", - `test`="'.$aSDATA['test'].'", - `core_fix`="'.$aSDATA['core_fix'].'", - `core_fix_one`="'.$aSDATA['core_fix_one'].'", - `autostop`="'.$aSDATA['autostop'].'" WHERE `id`="'.$id.'" LIMIT 1'); + // Запись данных нового сервера + $sql->query('UPDATE `servers` set + `uid`="'.$uid.'", + `unit`="'.$aSDATA['unit'].'", + `tarif`="'.$aSDATA['tarif'].'", + `user`="'.$user['id'].'", + `address`="'.$aSDATA['address'].'", + `port`="'.$aSDATA['port'].'", + `game`="mc", + `slots`="'.$aSDATA['slots'].'", + `slots_start`="'.$aSDATA['slots'].'", + `status`="install", + `name`="'.$tarif['hostname'].'", + `pack`="'.$aSDATA['pack'].'", + `plugins_use`="'.$aSDATA['plugins'].'", + `ftp_use`="'.$aSDATA['ftp'].'", + `console_use`="'.$aSDATA['console'].'", + `stats_use`="'.$aSDATA['stats'].'", + `copy_use`="'.$aSDATA['copy'].'", + `web_use`="'.$aSDATA['web'].'", + `ram`="'.$aSDATA['ram'].'", + `ram_fix`="'.$aSDATA['param_fix'].'", + `map_start`="'.$aSDATA['map'].'", + `vac`="1", + `hdd`="'.$aSDATA['hdd'].'", + `time`="'.$aSDATA['time'].'", + `date`="'.$start_point.'", + `test`="'.$aSDATA['test'].'", + `core_fix`="'.$aSDATA['core_fix'].'", + `core_fix_one`="'.$aSDATA['core_fix_one'].'", + `autostop`="'.$aSDATA['autostop'].'" WHERE `id`="'.$id.'" LIMIT 1'); - // Запись установленных плагинов - if($aSDATA['plugins']) - { - // Массив идентификаторов плагинов - $aPlugins = sys::b64djs($aSDATA['plugins_install']); + // Запись установленных плагинов + if($aSDATA['plugins']) + { + // Массив идентификаторов плагинов + $aPlugins = sys::b64djs($aSDATA['plugins_install']); - if(isset($aPlugins[$aSDATA['pack']])) - { - $plugins = explode(',', $aPlugins[$aSDATA['pack']]); + if(isset($aPlugins[$aSDATA['pack']])) + { + $plugins = explode(',', $aPlugins[$aSDATA['pack']]); - foreach($plugins as $plugin) - if($plugin) - $sql->query('INSERT INTO `plugins_install` set `server`="'.$id.'", `plugin`="'.$plugin.'", `time`="'.$start_point.'"'); - } - } + foreach($plugins as $plugin) + if($plugin) + $sql->query('INSERT INTO `plugins_install` set `server`="'.$id.'", `plugin`="'.$plugin.'", `time`="'.$start_point.'"'); + } + } - // Списание средств с баланса пользователя - $sql->query('UPDATE `users` set `balance`="'.($user['balance']-$aSDATA['sum']).'" WHERE `id`="'.$user['id'].'" LIMIT 1'); + // Списание средств с баланса пользователя + $sql->query('UPDATE `users` set `balance`="'.($user['balance']-$aSDATA['sum']).'" WHERE `id`="'.$user['id'].'" LIMIT 1'); - // Запись получения тестового периода - if($aSDATA['test']) - { - $sql->query('INSERT INTO `tests` set `server`="'.$id.'", `unit`="'.$aSDATA['unit'].'", `game`="mc", `user`="'.$user['id'].'", `time`="'.$start_point.'"'); - $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="'.sys::updtext(sys::text('logs', 'buy_server_test'), array('id' => $id)).'", `date`="'.$start_point.'", `type`="buy", `money`="0"'); - }else{ - // Реф. система - games::part($user['id'], $aSDATA['sum']); + // Запись получения тестового периода + if($aSDATA['test']) + { + $sql->query('INSERT INTO `tests` set `server`="'.$id.'", `unit`="'.$aSDATA['unit'].'", `game`="mc", `user`="'.$user['id'].'", `time`="'.$start_point.'"'); + $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="'.sys::updtext(sys::text('logs', 'buy_server_test'), array('id' => $id)).'", `date`="'.$start_point.'", `type`="buy", `money`="0"'); + }else{ + // Реф. система + games::part($user['id'], $aSDATA['sum']); - // Запись логов - if(!is_array($aSDATA['promo'])) - $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="'.sys::updtext(sys::text('logs', 'buy_server'), array('days' => games::parse_day($aSDATA['days'], true), 'money' => $aSDATA['sum'], 'id' => $id)).'", `date`="'.$start_point.'", `type`="buy", `money`="'.$aSDATA['sum'].'"'); - else{ - $sql->query('UPDATE `servers` set `benefit`="'.$aSDATA['time'].'" WHERE `id`="'.$id.'" LIMIT 1'); - $sql->query('INSERT INTO `promo_use` set `promo`="'.$aSDATA['promo']['id'].'", `user`="'.$user['id'].'", `time`="'.$start_point.'"'); - $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="'.sys::updtext(sys::text('logs', 'buy_server_promo'), array('days' => games::parse_day($aSDATA['days'], true), 'money' => $aSDATA['sum'], 'promo' => $aSDATA['promo']['cod'], 'id' => $id)).'", `date`="'.$start_point.'", `type`="buy", `money`="'.$aSDATA['sum'].'"'); - } - } + // Запись логов + if(!is_array($aSDATA['promo'])) + $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="'.sys::updtext(sys::text('logs', 'buy_server'), array('days' => games::parse_day($aSDATA['days'], true), 'money' => $aSDATA['sum'], 'id' => $id)).'", `date`="'.$start_point.'", `type`="buy", `money`="'.$aSDATA['sum'].'"'); + else{ + $sql->query('UPDATE `servers` set `benefit`="'.$aSDATA['time'].'" WHERE `id`="'.$id.'" LIMIT 1'); + $sql->query('INSERT INTO `promo_use` set `promo`="'.$aSDATA['promo']['id'].'", `user`="'.$user['id'].'", `time`="'.$start_point.'"'); + $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="'.sys::updtext(sys::text('logs', 'buy_server_promo'), array('days' => games::parse_day($aSDATA['days'], true), 'money' => $aSDATA['sum'], 'promo' => $aSDATA['promo']['cod'], 'id' => $id)).'", `date`="'.$start_point.'", `type`="buy", `money`="'.$aSDATA['sum'].'"'); + } + } - return $id; - } + return $id; + } } ?> \ No newline at end of file diff --git a/system/library/games/mc/tarif.php b/system/library/games/mc/tarif.php index 923aa1f..dbb33c8 100644 --- a/system/library/games/mc/tarif.php +++ b/system/library/games/mc/tarif.php @@ -1,231 +1,231 @@ get('extend', 'sections/servers/games/tarif'); + $html->get('extend', 'sections/servers/games/tarif'); - if(isset($html->arr['extend_address'])) - { - $html->unit('extend_address', 1); - $html->set('extend_address', $html->arr['extend_address']); - }else - $html->unit('extend_address'); + if(isset($html->arr['extend_address'])) + { + $html->unit('extend_address', 1); + $html->set('extend_address', $html->arr['extend_address']); + }else + $html->unit('extend_address'); - $html->set('id', $sid); - $html->set('time', sys::date('min', $server['time'])); - $html->set('options', ''.$options); - $html->set('slots', $server['slots']); - $html->set('info', $server['ram'].' RAM'); - $html->set('tarif', $tarif_name); - $html->set('cur', $cfg['currency']); + $html->set('id', $sid); + $html->set('time', sys::date('min', $server['time'])); + $html->set('options', ''.$options); + $html->set('slots', $server['slots']); + $html->set('info', $server['ram'].' RAM'); + $html->set('tarif', $tarif_name); + $html->set('cur', $cfg['currency']); - $html->pack('main'); + $html->pack('main'); - return NULL; - } + return NULL; + } public static function extend_sp($server, $tarif, $sid) { - global $cfg, $sql, $html, $start_point; + global $cfg, $sql, $html, $start_point; - tarifs::extend_address($server['game'], $sid); + tarifs::extend_address($server['game'], $sid); - $aPrice = explode(':', $tarif['price']); - $aRAM = explode(':', $tarif['ram']); + $aPrice = explode(':', $tarif['price']); + $aRAM = explode(':', $tarif['ram']); - $ram = $server['ram_fix'] ? $server['ram'] : $server['ram']/$server['slots']; + $ram = $server['ram_fix'] ? $server['ram'] : $server['ram']/$server['slots']; - $sum = $tarif['slots'] ? $aPrice[array_search($ram, $aRAM)] : $aPrice[array_search($ram, $aRAM)]*$server['slots']; + $sum = $tarif['slots'] ? $aPrice[array_search($ram, $aRAM)] : $aPrice[array_search($ram, $aRAM)]*$server['slots']; - $html->get('extend_sp', 'sections/servers/games/tarif'); + $html->get('extend_sp', 'sections/servers/games/tarif'); - if(isset($html->arr['extend_address'])) - { - $html->unit('extend_address', 1); - $html->set('extend_address', $html->arr['extend_address']); - }else - $html->unit('extend_address'); + if(isset($html->arr['extend_address'])) + { + $html->unit('extend_address', 1); + $html->set('extend_address', $html->arr['extend_address']); + }else + $html->unit('extend_address'); - $html->set('id', $sid); - $html->set('time', sys::date('min', $server['time'])); - $html->set('date', $server['time'] > $start_point ? 'Сервер продлен до: '.date('d.m.Y', $server['time']) : 'Текущая дата: '.date('d.m.Y', $start_point)); - $html->set('options', ''.$options); - $html->set('slots', $server['slots']); - $html->set('info', $server['ram'].' RAM'); - $html->set('tarif', $tarif['name']); - $html->set('sum', $sum); - $html->set('cur', $cfg['currency']); + $html->set('id', $sid); + $html->set('time', sys::date('min', $server['time'])); + $html->set('date', $server['time'] > $start_point ? 'Сервер продлен до: '.date('d.m.Y', $server['time']) : 'Текущая дата: '.date('d.m.Y', $start_point)); + $html->set('options', ''.$options); + $html->set('slots', $server['slots']); + $html->set('info', $server['ram'].' RAM'); + $html->set('tarif', $tarif['name']); + $html->set('sum', $sum); + $html->set('cur', $cfg['currency']); - $html->pack('main'); + $html->pack('main'); - return NULL; - } + return NULL; + } public static function plan($server, $tarif_name, $sid) { - global $cfg, $sql, $html; + global $cfg, $sql, $html; - $sql->query('SELECT `ram`, `price` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); + $sql->query('SELECT `ram`, `price` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); - if(!$sql->num()) - return NULL; + if(!$sql->num()) + return NULL; - $tarif = $sql->get(); + $tarif = $sql->get(); - $options = ''; + $options = ''; - $aPrice = explode(':', $tarif['price']); - $aRAM = explode(':', $tarif['ram']); + $aPrice = explode(':', $tarif['price']); + $aRAM = explode(':', $tarif['ram']); - $ram = $server['ram_fix'] ? $server['ram'] : $server['ram']/$server['slots']; + $ram = $server['ram_fix'] ? $server['ram'] : $server['ram']/$server['slots']; - // Если есть выбор - if(count($aRAM) > 1) - { - // Удалить при наличии ram сервера из выбора - if(in_array($ram, $aRAM)) - unset($aRAM[array_search($ram, $aRAM)]); + // Если есть выбор + if(count($aRAM) > 1) + { + // Удалить при наличии ram сервера из выбора + if(in_array($ram, $aRAM)) + unset($aRAM[array_search($ram, $aRAM)]); - foreach($aRAM as $index => $ram) - $options .= ''; - }else - return NULL; + foreach($aRAM as $index => $ram) + $options .= ''; + }else + return NULL; - $html->get('plan', 'sections/servers/games/tarif'); + $html->get('plan', 'sections/servers/games/tarif'); - $html->set('id', $sid); - $html->set('options', $options); - $html->set('info', $server['ram'].' RAM'); - $html->set('tarif', $tarif_name); + $html->set('id', $sid); + $html->set('options', $options); + $html->set('info', $server['ram'].' RAM'); + $html->set('tarif', $tarif_name); - $html->pack('main'); + $html->pack('main'); - return NULL; - } + return NULL; + } - public static function unit($server, $unit_name, $tarif_name, $sid) + public static function unit($server, $unit_name, $tarif_name, $sid) { - global $cfg, $sql, $html; + global $cfg, $sql, $html; - if(!$cfg['change_unit'][$server['game']]) - return NULL; + if(!$cfg['change_unit'][$server['game']]) + return NULL; - $tarifs = $sql->query('SELECT `unit`, `ram` FROM `tarifs` WHERE `game`="'.$server['game'].'" AND `name`="'.$tarif_name.'" AND `id`!="'.$server['tarif'].'" AND `show`="1" ORDER BY `unit`'); - if(!$sql->num($tarifs)) - return NULL; + $tarifs = $sql->query('SELECT `unit`, `ram` FROM `tarifs` WHERE `game`="'.$server['game'].'" AND `name`="'.$tarif_name.'" AND `id`!="'.$server['tarif'].'" AND `show`="1" ORDER BY `unit`'); + if(!$sql->num($tarifs)) + return NULL; - $units = 0; + $units = 0; - $options = ''; + $options = ''; - $ram = $server['ram_fix'] ? $server['ram'] : $server['ram']/$server['slots']; + $ram = $server['ram_fix'] ? $server['ram'] : $server['ram']/$server['slots']; - while($tarif = $sql->get($tarifs)) - { - if(!in_array($ram, explode(':', $tarif['ram']))) - continue; + while($tarif = $sql->get($tarifs)) + { + if(!in_array($ram, explode(':', $tarif['ram']))) + continue; - $sql->query('SELECT `id`, `name` FROM `units` WHERE `id`="'.$tarif['unit'].'" AND `show`="1" LIMIT 1'); - if(!$sql->num()) - continue; + $sql->query('SELECT `id`, `name` FROM `units` WHERE `id`="'.$tarif['unit'].'" AND `show`="1" LIMIT 1'); + if(!$sql->num()) + continue; - $unit = $sql->get(); + $unit = $sql->get(); - $options .= ''; + $options .= ''; - $units+=1; - } + $units+=1; + } - if(!$units) - return NULL; + if(!$units) + return NULL; - $html->get('unit', 'sections/servers/games/tarif'); + $html->get('unit', 'sections/servers/games/tarif'); - $html->set('id', $sid); - $html->set('options', $options); - $html->set('slots', $server['slots']); - $html->set('info', $server['ram'].' RAM'); - $html->set('unit', $unit_name); - $html->set('tarif', $tarif_name); + $html->set('id', $sid); + $html->set('options', $options); + $html->set('slots', $server['slots']); + $html->set('info', $server['ram'].' RAM'); + $html->set('unit', $unit_name); + $html->set('tarif', $tarif_name); - $html->pack('main'); + $html->pack('main'); - return NULL; - } + return NULL; + } - public static function unit_new($tarif, $unit, $server, $mcache) - { - global $ssh, $sql, $user, $start_point; + public static function unit_new($tarif, $unit, $server, $mcache) + { + global $ssh, $sql, $user, $start_point; - // Проверка ssh соединения с локацией - if(!$ssh->auth($unit['passwd'], $unit['address'])) - sys::outjs(array('e' => sys::text('error', 'ssh'))); + // Проверка ssh соединения с локацией + if(!$ssh->auth($unit['passwd'], $unit['address'])) + sys::outjs(array('e' => sys::text('error', 'ssh'))); - // Директория сборки - $path = $tarif['path'].$tarif['pack']; + // Директория сборки + $path = $tarif['path'].$tarif['pack']; - // Директория игрового сервера - $install = $tarif['install'].$server['uid']; + // Директория игрового сервера + $install = $tarif['install'].$server['uid']; - // Пользователь сервера - $uS = 'server'.$server['uid']; + // Пользователь сервера + $uS = 'server'.$server['uid']; - $ssh->set('mkdir '.$install.';' // Создание директории - .'useradd -d '.$install.' -g servers -u '.$server['uid'].' '.$uS.';' // Создание пользователя сервера на локации - .'chown '.$uS.':1000 '.$install.';' // Изменение владельца и группы директории - .'cd '.$install.' && sudo -u '.$uS.' screen -dmS i_'.$server['uid'].' cp -r '.$path.'/. .'); // Копирование файлов сборки для сервера + $ssh->set('mkdir '.$install.';' // Создание директории + .'useradd -d '.$install.' -g servers -u '.$server['uid'].' '.$uS.';' // Создание пользователя сервера на локации + .'chown '.$uS.':1000 '.$install.';' // Изменение владельца и группы директории + .'cd '.$install.' && sudo -u '.$uS.' screen -dmS i_'.$server['uid'].' cp -r '.$path.'/. .'); // Копирование файлов сборки для сервера - $address = explode(':', $server['address']); + $address = explode(':', $server['address']); - $fix_one = $tarif['core_fix'] ? 1 : 0; + $fix_one = $tarif['core_fix'] ? 1 : 0; - // Обновление данных нового сервера - $sql->query('UPDATE `servers` set - `unit`="'.$tarif['unit'].'", - `tarif`="'.$tarif['id'].'", - `address`="'.$server['address'].'", - `port`="'.$address[1].'", - `status`="install", - `name`="'.$tarif['hostname'].'", - `pack`="'.$tarif['pack'].'", - `map_start`="'.$tarif['map'].'", - `vac`="1", - `hdd`="'.$tarif['hdd'].'", - `time`="'.$tarif['time'].'", - `autostop`="'.$tarif['autostop'].'", - `core_fix`="'.$tarif['core_fix'].'", - `core_fix_one`="'.$fix_one.'", - `reinstall`="'.$start_point.'" WHERE `id`="'.$server['id'].'" LIMIT 1'); + // Обновление данных нового сервера + $sql->query('UPDATE `servers` set + `unit`="'.$tarif['unit'].'", + `tarif`="'.$tarif['id'].'", + `address`="'.$server['address'].'", + `port`="'.$address[1].'", + `status`="install", + `name`="'.$tarif['hostname'].'", + `pack`="'.$tarif['pack'].'", + `map_start`="'.$tarif['map'].'", + `vac`="1", + `hdd`="'.$tarif['hdd'].'", + `time`="'.$tarif['time'].'", + `autostop`="'.$tarif['autostop'].'", + `core_fix`="'.$tarif['core_fix'].'", + `core_fix_one`="'.$fix_one.'", + `reinstall`="'.$start_point.'" WHERE `id`="'.$server['id'].'" LIMIT 1'); - // Запись установленных плагинов - if($tarif['plugins']) - { - // Массив идентификаторов плагинов - $aPlugins = sys::b64js($tarif['plugins_install']); + // Запись установленных плагинов + if($tarif['plugins']) + { + // Массив идентификаторов плагинов + $aPlugins = sys::b64js($tarif['plugins_install']); - if(isset($aPlugins[$tarif['pack']])) - { - $plugins = explode(',', $aPlugins[$tarif['pack']]); + if(isset($aPlugins[$tarif['pack']])) + { + $plugins = explode(',', $aPlugins[$tarif['pack']]); - foreach($plugins as $plugin) - if($plugin) - $sql->query('INSERT INTO `plugins_install` set `server`="'.$server['id'].'", `plugin`="'.$plugin.'", `time`="'.$start_point.'"'); - } - } + foreach($plugins as $plugin) + if($plugin) + $sql->query('INSERT INTO `plugins_install` set `server`="'.$server['id'].'", `plugin`="'.$plugin.'", `time`="'.$start_point.'"'); + } + } - return NULL; - } + return NULL; + } } ?> \ No newline at end of file diff --git a/system/library/games/mta/action.php b/system/library/games/mta/action.php index 6e2cc55..bb747d7 100644 --- a/system/library/games/mta/action.php +++ b/system/library/games/mta/action.php @@ -1,157 +1,157 @@ query('SELECT `uid`, `unit`, `tarif`, `game`, `address`, `slots_start`, `name`, `time_start`, `core_fix` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `uid`, `unit`, `tarif`, `game`, `address`, `slots_start`, `name`, `time_start`, `core_fix` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - $sql->query('SELECT `install` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); + $sql->query('SELECT `install` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); $tarif = $sql->get(); - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); - // Проверка ssh соедниения пу с локацией - if(!$ssh->auth($unit['passwd'], $unit['address'])) - return array('e' => sys::text('error', 'ssh')); + // Проверка ssh соедниения пу с локацией + if(!$ssh->auth($unit['passwd'], $unit['address'])) + return array('e' => sys::text('error', 'ssh')); - list($ip, $port) = explode(':', $server['address']); + list($ip, $port) = explode(':', $server['address']); - // Убить процессы - $ssh->set('kill -9 `ps aux | grep s_'.$server['uid'].' | grep -v grep | awk '."'{print $2}'".' | xargs;' - .'lsof -i@'.$server['address'].' | awk '."'{print $2}'".' | grep -v PID | xargs`; sudo -u server'.$server['uid'].' screen -wipe;'); + // Убить процессы + $ssh->set('kill -9 `ps aux | grep s_'.$server['uid'].' | grep -v grep | awk '."'{print $2}'".' | xargs;' + .'lsof -i@'.$server['address'].' | awk '."'{print $2}'".' | grep -v PID | xargs`; sudo -u server'.$server['uid'].' screen -wipe;'); - // Временный файл - $temp = sys::temp(action::config($ip, $port, $server['slots_start'], $ssh->get('cat '.$tarif['install'].'/'.$server['uid'].'/mods/deathmatch/mtaserver.conf'))); + // Временный файл + $temp = sys::temp(action::config($ip, $port, $server['slots_start'], $ssh->get('cat '.$tarif['install'].'/'.$server['uid'].'/mods/deathmatch/mtaserver.conf'))); - // Обновление файла server.cfg - $ssh->setfile($temp, $tarif['install'].$server['uid'].'/mods/deathmatch/mtaserver.conf', 0644); + // Обновление файла server.cfg + $ssh->setfile($temp, $tarif['install'].$server['uid'].'/mods/deathmatch/mtaserver.conf', 0644); - unlink($temp); + unlink($temp); - $taskset = ''; + $taskset = ''; - // Если включена система автораспределения и не установлен фиксированный поток - if($cfg['cpu_route'] AND !$server['core_fix']) - { - $proc_stat = array(); + // Если включена система автораспределения и не установлен фиксированный поток + if($cfg['cpu_route'] AND !$server['core_fix']) + { + $proc_stat = array(); - $proc_stat[0] = $ssh->get('cat /proc/stat'); - } + $proc_stat[0] = $ssh->get('cat /proc/stat'); + } - // Если система автораспределения продолжить парсинг загрузки процессора - if(isset($proc_stat)) - { - $proc_stat[1] = $ssh->get('cat /proc/stat'); + // Если система автораспределения продолжить парсинг загрузки процессора + if(isset($proc_stat)) + { + $proc_stat[1] = $ssh->get('cat /proc/stat'); - // Ядро/поток, на котором будет запущен игровой сервер (поток выбран с рассчетом наименьшей загруженности в момент запуска игрового сервера) - $core = sys::cpu_idle($proc_stat, $server['unit'], false); // число от 1 до n (где n число ядер/потоков в процессоре (без нулевого) + // Ядро/поток, на котором будет запущен игровой сервер (поток выбран с рассчетом наименьшей загруженности в момент запуска игрового сервера) + $core = sys::cpu_idle($proc_stat, $server['unit'], false); // число от 1 до n (где n число ядер/потоков в процессоре (без нулевого) - if(!is_numeric($core)) - return array('e' => sys::text('error', 'cpu')); + if(!is_numeric($core)) + return array('e' => sys::text('error', 'cpu')); - $taskset = 'taskset -c '.$core; - } + $taskset = 'taskset -c '.$core; + } - if($server['core_fix']) - { - $core = $server['core_fix']-1; - $taskset = 'taskset -c '.$core; - } + if($server['core_fix']) + { + $core = $server['core_fix']-1; + $taskset = 'taskset -c '.$core; + } - // Параметры запуска - $bash = './mta-server'; + // Параметры запуска + $bash = './mta-server'; - // Временный файл - $temp = sys::temp($bash); + // Временный файл + $temp = sys::temp($bash); - // Обновление файла start.sh - $ssh->setfile($temp, $tarif['install'].$server['uid'].'/start.sh', 0500); + // Обновление файла start.sh + $ssh->setfile($temp, $tarif['install'].$server['uid'].'/start.sh', 0500); - // Строка запуска - $ssh->set('cd '.$tarif['install'].$server['uid'].';' // переход в директорию игрового сервера - .'rm *.pid;' // Удаление *.pid файлов - .'sudo -u server'.$server['uid'].' mkdir -p mods/deathmatch/oldstart;' // Создание папки логов - .'cat mods/deathmatch/logs/server.log >> mods/deathmatch/oldstart/'.date('d.m.Y_H:i:s', $server['time_start']).'.log; rm mods/deathmatch/logs/server.log; rm mods/deathmatch/logs/01.01.1970_03:00:00.log;' // Перемещение лога предыдущего запуска - .'chown server'.$server['uid'].':1000 mods/deathmatch/mtaserver.conf start.sh;' // Обновление владельца файлов - .'sudo -u server'.$server['uid'].' screen -dmS s_'.$server['uid'].' '.$taskset.' sh -c "./start.sh"'); // Запуск игровго сервера + // Строка запуска + $ssh->set('cd '.$tarif['install'].$server['uid'].';' // переход в директорию игрового сервера + .'rm *.pid;' // Удаление *.pid файлов + .'sudo -u server'.$server['uid'].' mkdir -p mods/deathmatch/oldstart;' // Создание папки логов + .'cat mods/deathmatch/logs/server.log >> mods/deathmatch/oldstart/'.date('d.m.Y_H:i:s', $server['time_start']).'.log; rm mods/deathmatch/logs/server.log; rm mods/deathmatch/logs/01.01.1970_03:00:00.log;' // Перемещение лога предыдущего запуска + .'chown server'.$server['uid'].':1000 mods/deathmatch/mtaserver.conf start.sh;' // Обновление владельца файлов + .'sudo -u server'.$server['uid'].' screen -dmS s_'.$server['uid'].' '.$taskset.' sh -c "./start.sh"'); // Запуск игровго сервера - $core = !isset($core) ? 0 : $core+1; + $core = !isset($core) ? 0 : $core+1; - // Обновление информации в базе - $sql->query('UPDATE `servers` set `status`="'.$type.'", `online`="0", `players`="", `core_use`="'.$core.'", `time_start`="'.$start_point.'", `stop`="1" WHERE `id`="'.$id.'" LIMIT 1'); + // Обновление информации в базе + $sql->query('UPDATE `servers` set `status`="'.$type.'", `online`="0", `players`="", `core_use`="'.$core.'", `time_start`="'.$start_point.'", `stop`="1" WHERE `id`="'.$id.'" LIMIT 1'); - unlink($temp); + unlink($temp); - // Сброс кеша - actions::clmcache($id); + // Сброс кеша + actions::clmcache($id); - sys::reset_mcache('server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => $type, 'online' => 0, 'players' => '')); - sys::reset_mcache('server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => $type, 'online' => 0)); + sys::reset_mcache('server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => $type, 'online' => 0, 'players' => '')); + sys::reset_mcache('server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => $type, 'online' => 0)); - return array('s' => 'ok'); - } + return array('s' => 'ok'); + } - public static function config($ip, $port, $slots, $config) - { - $aRepl = array( - '', '', - '', '', - '', '', - '', '', - '', '', - '', '', - '', '' - ); + public static function config($ip, $port, $slots, $config) + { + $aRepl = array( + '', '', + '', '', + '', '', + '', '', + '', '', + '', '', + '', '' + ); - $config = str_ireplace($aRepl, $aRepl, $config); - $config = str_ireplace(array('', '', "\r", "\t"),'', $config); - $config = preg_replace("#\<\!--(.+?)--\>#is", '', $config); + $config = str_ireplace($aRepl, $aRepl, $config); + $config = str_ireplace(array('', '', "\r", "\t"),'', $config); + $config = preg_replace("#\<\!--(.+?)--\>#is", '', $config); - $aLine = explode("\n", $config); + $aLine = explode("\n", $config); - $search = array( - "#\(.+?)\<\/serverip\>#is", - "#\(.+?)\<\/maxplayers\>#is", - "#\(.+?)\<\/httpserver\>#is", - "#\(.+?)\<\/serverport\>#is", - "#\(.+?)\<\/httpport\>#is", - "#\(.+?)\<\/logfile\>#is", - "#\(.+?)\<\/ase\>#is" - ); + $search = array( + "#\(.+?)\<\/serverip\>#is", + "#\(.+?)\<\/maxplayers\>#is", + "#\(.+?)\<\/httpserver\>#is", + "#\(.+?)\<\/serverport\>#is", + "#\(.+?)\<\/httpport\>#is", + "#\(.+?)\<\/logfile\>#is", + "#\(.+?)\<\/ase\>#is" + ); - $config = ''.PHP_EOL; + $config = ''.PHP_EOL; - foreach($aLine as $line) - { - if(str_replace(array(' ', "\t"), '', $line) != '') - $edit = trim(preg_replace($search, array('','','','','',''), $line)); + foreach($aLine as $line) + { + if(str_replace(array(' ', "\t"), '', $line) != '') + $edit = trim(preg_replace($search, array('','','','','',''), $line)); - if($edit != '') - $config .= ' '.$edit.PHP_EOL; + if($edit != '') + $config .= ' '.$edit.PHP_EOL; - $edit = ''; - } + $edit = ''; + } - $config .= ' '.$ip.''.PHP_EOL - .' '.$slots.''.PHP_EOL - .' 1'.PHP_EOL - .' '.$port.''.PHP_EOL - .' '.($port+10000).''.PHP_EOL - .' 1'.PHP_EOL - .' logs/server.log'; + $config .= ' '.$ip.''.PHP_EOL + .' '.$slots.''.PHP_EOL + .' 1'.PHP_EOL + .' '.$port.''.PHP_EOL + .' '.($port+10000).''.PHP_EOL + .' 1'.PHP_EOL + .' logs/server.log'; - return $config."\n".''; - } + return $config."\n".''; + } } ?> \ No newline at end of file diff --git a/system/library/games/mta/scan.php b/system/library/games/mta/scan.php index 7fe2d08..2f1b47e 100644 --- a/system/library/games/mta/scan.php +++ b/system/library/games/mta/scan.php @@ -1,114 +1,114 @@ query('SELECT `address`, `game`, `name`, `map`, `online`, `players`, `status`, `time`, `overdue` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `address`, `game`, `name`, `map`, `online`, `players`, `status`, `time`, `overdue` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - list($ip, $port) = explode(':', $server['address']); + list($ip, $port) = explode(':', $server['address']); - include(LIB.'games/query/MtaQuery.php'); + include(LIB.'games/query/MtaQuery.php'); - $sq = new MtaQuery($ip, $port); + $sq = new MtaQuery($ip, $port); - if($players_get) - $nmch = 'server_scan_mon_pl_'.$id; - else - $nmch = 'server_scan_mon_'.$id; + if($players_get) + $nmch = 'server_scan_mon_pl_'.$id; + else + $nmch = 'server_scan_mon_'.$id; - if(is_array($mcache->get($nmch))) - return $mcache->get($nmch); + if(is_array($mcache->get($nmch))) + return $mcache->get($nmch); - $out = array(); + $out = array(); - $out['time'] = 'Арендован до: '.date('d.m.Y - H:i', $server['time']); + $out['time'] = 'Арендован до: '.date('d.m.Y - H:i', $server['time']); - if($server['status'] == 'overdue') - $out['time_end'] = 'Удаление через: '.sys::date('min', $server['overdue']+$cfg['server_delete']*86400); - else - $out['time_end'] = 'Осталось: '.sys::date('min', $server['time']); + if($server['status'] == 'overdue') + $out['time_end'] = 'Удаление через: '.sys::date('min', $server['overdue']+$cfg['server_delete']*86400); + else + $out['time_end'] = 'Осталось: '.sys::date('min', $server['time']); - $info = $sq->getInfo($players_get); + $info = $sq->getInfo($players_get); - if(!is_array($info)) - { - $out['name'] = $server['name']; - $out['status'] = sys::status($server['status'], $server['game'], $server['map']); - $out['online'] = $server['online']; - $out['image'] = ''; - $out['buttons'] = sys::buttons($id, $server['status'], $server['game']); + if(!is_array($info)) + { + $out['name'] = $server['name']; + $out['status'] = sys::status($server['status'], $server['game'], $server['map']); + $out['online'] = $server['online']; + $out['image'] = ''; + $out['buttons'] = sys::buttons($id, $server['status'], $server['game']); - if($players_get) - $out['players'] = base64_decode($server['players']); + if($players_get) + $out['players'] = base64_decode($server['players']); - $mcache->set($nmch, $out, false, $cfg['mcache_server_mon']); + $mcache->set($nmch, $out, false, $cfg['mcache_server_mon']); - return $out; - } + return $out; + } - $players = scan::players($info['players_list']); + $players = scan::players($info['players_list']); - $info['map'] = htmlspecialchars(mb_convert_encoding($info['map'], 'UTF-8', 'WINDOWS-1251')); - $out['name'] = htmlspecialchars(mb_convert_encoding($info['hostname'], 'UTF-8', 'WINDOWS-1251')); - $out['status'] = sys::status('working', $server['game'], $info['map']); - $out['online'] = sys::int($info['players']); - $out['image'] = ''; - $out['buttons'] = sys::buttons($id, 'working', $server['game']); - $out['players'] = ''; + $info['map'] = htmlspecialchars(mb_convert_encoding($info['map'], 'UTF-8', 'WINDOWS-1251')); + $out['name'] = htmlspecialchars(mb_convert_encoding($info['hostname'], 'UTF-8', 'WINDOWS-1251')); + $out['status'] = sys::status('working', $server['game'], $info['map']); + $out['online'] = sys::int($info['players']); + $out['image'] = ''; + $out['buttons'] = sys::buttons($id, 'working', $server['game']); + $out['players'] = ''; - if($players_get) - { - foreach($players as $index => $player) - { - $html->get($server['game'], 'sections/servers/players'); + if($players_get) + { + foreach($players as $index => $player) + { + $html->get($server['game'], 'sections/servers/players'); - $html->set('i', $player['i']); - $html->set('name', $player['name']); - $html->set('ping', $player['ping']); + $html->set('i', $player['i']); + $html->set('name', $player['name']); + $html->set('ping', $player['ping']); - $html->pack('list'); - } + $html->pack('list'); + } - $out['players'] = isset($html->arr['list']) ? $html->arr['list'] : ''; - } + $out['players'] = isset($html->arr['list']) ? $html->arr['list'] : ''; + } - $sql->query('UPDATE `servers` set ' - .'`name`="'.$out['name'].'", ' - .'`online`="'.$out['online'].'", ' - .'`map`="'.$info['map'].'", ' - .'`status`="working" WHERE `id`="'.$id.'" LIMIT 1'); + $sql->query('UPDATE `servers` set ' + .'`name`="'.$out['name'].'", ' + .'`online`="'.$out['online'].'", ' + .'`map`="'.$info['map'].'", ' + .'`status`="working" WHERE `id`="'.$id.'" LIMIT 1'); - if($players_get) - $sql->query('UPDATE `servers` set `players`="'.base64_encode($out['players']).'" WHERE `id`="'.$id.'" LIMIT 1'); + if($players_get) + $sql->query('UPDATE `servers` set `players`="'.base64_encode($out['players']).'" WHERE `id`="'.$id.'" LIMIT 1'); - $mcache->set($nmch, $out, false, $cfg['mcache_server_mon']); + $mcache->set($nmch, $out, false, $cfg['mcache_server_mon']); - return $out; - } + return $out; + } - public static function players($aPlayrs) - { - $i = 1; - $aData = array(); + public static function players($aPlayrs) + { + $i = 1; + $aData = array(); - foreach($aPlayrs as $n => $player) - { - $aData[$i]['i'] = $i; - $aData[$i]['name'] = $player['nickname'] == '' ? 'Подключается' : htmlspecialchars($player['nickname']); - $aData[$i]['ping'] = sys::int($player['ping']); + foreach($aPlayrs as $n => $player) + { + $aData[$i]['i'] = $i; + $aData[$i]['name'] = $player['nickname'] == '' ? 'Подключается' : htmlspecialchars($player['nickname']); + $aData[$i]['ping'] = sys::int($player['ping']); - $i+=1; - } + $i+=1; + } - return $aData; - } - } + return $aData; + } + } ?> \ No newline at end of file diff --git a/system/library/games/mta/service.php b/system/library/games/mta/service.php index 74aa423..168b1ce 100644 --- a/system/library/games/mta/service.php +++ b/system/library/games/mta/service.php @@ -1,354 +1,354 @@ query('SELECT `address`, `test` FROM `units` WHERE `id`="'.$aData['unit'].'" AND `mta`="1" AND `show`="1" LIMIT 1'); - if(!$sql->num()) - sys::outjs(array('e' => 'Локация не найдена.')); + // Проверка локации + $sql->query('SELECT `address`, `test` FROM `units` WHERE `id`="'.$aData['unit'].'" AND `mta`="1" AND `show`="1" LIMIT 1'); + if(!$sql->num()) + sys::outjs(array('e' => 'Локация не найдена.')); - $unit = $sql->get(); + $unit = $sql->get(); - // Проверка тарифа - $sql->query('SELECT `id` FROM `tarifs` WHERE `id`="'.$aData['tarif'].'" AND `unit`="'.$aData['unit'].'" AND `show`="1" LIMIT 1'); - if(!$sql->num()) - sys::outjs(array('e' => 'Тариф не найден.')); + // Проверка тарифа + $sql->query('SELECT `id` FROM `tarifs` WHERE `id`="'.$aData['tarif'].'" AND `unit`="'.$aData['unit'].'" AND `show`="1" LIMIT 1'); + if(!$sql->num()) + sys::outjs(array('e' => 'Тариф не найден.')); - $sql->query('SELECT ' - .'`slots_min`,' - .'`slots_max`,' - .'`port_min`,' - .'`port_max`,' - .'`hostname`,' - .'`packs`,' - .'`time`,' - .'`test`,' - .'`tests`,' - .'`discount`,' - .'`ftp`,' - .'`plugins`,' - .'`console`,' - .'`stats`,' - .'`copy`,' - .'`web`,' - .'`plugins_install`,' - .'`hdd`,' - .'`autostop`,' - .'`core_fix`,' - .'`ip`,' - .'`price`' - .' FROM `tarifs` WHERE `id`="'.$aData['tarif'].'" LIMIT 1'); + $sql->query('SELECT ' + .'`slots_min`,' + .'`slots_max`,' + .'`port_min`,' + .'`port_max`,' + .'`hostname`,' + .'`packs`,' + .'`time`,' + .'`test`,' + .'`tests`,' + .'`discount`,' + .'`ftp`,' + .'`plugins`,' + .'`console`,' + .'`stats`,' + .'`copy`,' + .'`web`,' + .'`plugins_install`,' + .'`hdd`,' + .'`autostop`,' + .'`core_fix`,' + .'`ip`,' + .'`price`' + .' FROM `tarifs` WHERE `id`="'.$aData['tarif'].'" LIMIT 1'); - $tarif = $sql->get(); + $tarif = $sql->get(); - // Проверка сборки - if(!array_key_exists($aData['pack'], sys::b64djs($tarif['packs'], true))) - sys::outjs(array('e' => 'Сборка не найдена.')); + // Проверка сборки + if(!array_key_exists($aData['pack'], sys::b64djs($tarif['packs'], true))) + sys::outjs(array('e' => 'Сборка не найдена.')); - $test = 0; + $test = 0; - // Проверка периода на тест - if($aData['test']) - { - if(!$tarif['test'] || !$unit['test']) - sys::outjs(array('e' => 'Тестовый период недоступен.')); + // Проверка периода на тест + if($aData['test']) + { + if(!$tarif['test'] || !$unit['test']) + sys::outjs(array('e' => 'Тестовый период недоступен.')); - // Проверка на повторный запрос - $sql->query('SELECT `id`, `game` FROM `tests` WHERE `user`="'.$user['id'].'" LIMIT 1'); - if($sql->num()) - { - $test_info = $sql->get(); + // Проверка на повторный запрос + $sql->query('SELECT `id`, `game` FROM `tests` WHERE `user`="'.$user['id'].'" LIMIT 1'); + if($sql->num()) + { + $test_info = $sql->get(); - if(!$cfg['tests']['game'] || $test_info['game'] == 'mta') - sys::outjs(array('e' => 'Тестовый период предоставляется один раз.')); + if(!$cfg['tests']['game'] || $test_info['game'] == 'mta') + sys::outjs(array('e' => 'Тестовый период предоставляется один раз.')); - $sql->query('SELECT `id` FROM `servers` WHERE `user`="'.$user['id'].'" AND `test`="1" LIMIT 1'); - if($sql->num() AND !$cfg['tests']['sametime']) - sys::outjs(array('e' => 'Чтобы получить тестовый период другой игры, дождитесь окончания текущего.')); - } + $sql->query('SELECT `id` FROM `servers` WHERE `user`="'.$user['id'].'" AND `test`="1" LIMIT 1'); + if($sql->num() AND !$cfg['tests']['sametime']) + sys::outjs(array('e' => 'Чтобы получить тестовый период другой игры, дождитесь окончания текущего.')); + } - // Проверка наличия мест на локации - $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND `test`="1" AND `time`>"'.$start_point.'" LIMIT '.$unit['test']); - if($sql->num() == $unit['test']) - sys::outjs(array('e' => 'Свободного места для тестового периода нет.')); + // Проверка наличия мест на локации + $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND `test`="1" AND `time`>"'.$start_point.'" LIMIT '.$unit['test']); + if($sql->num() == $unit['test']) + sys::outjs(array('e' => 'Свободного места для тестового периода нет.')); - // Проверка наличия мест для выбранного тарифа - $sql->query('SELECT `id` FROM `servers` WHERE `tarif`="'.$aData['tarif'].'" AND `test`="1" AND `time`>"'.$start_point.'" LIMIT '.$tarif['tests']); - if($sql->num() == $tarif['tests']) - sys::outjs(array('e' => 'Свободного места для тестового периода выбранного тарифа нет.')); + // Проверка наличия мест для выбранного тарифа + $sql->query('SELECT `id` FROM `servers` WHERE `tarif`="'.$aData['tarif'].'" AND `test`="1" AND `time`>"'.$start_point.'" LIMIT '.$tarif['tests']); + if($sql->num() == $tarif['tests']) + sys::outjs(array('e' => 'Свободного места для тестового периода выбранного тарифа нет.')); - $test = 1; - }else - // Проверка периода - if(!$cfg['settlement_period'] AND !in_array($aData['time'], explode(':', $tarif['time']))) - sys::outjs(array('e' => 'Переданные данные периода неверны.')); + $test = 1; + }else + // Проверка периода + if(!$cfg['settlement_period'] AND !in_array($aData['time'], explode(':', $tarif['time']))) + sys::outjs(array('e' => 'Переданные данные периода неверны.')); - // Проверка слот - if($aData['slots'] < $tarif['slots_min'] || $aData['slots'] > $tarif['slots_max']) - sys::outjs(array('e' => 'Переданные данные слот неверны.')); + // Проверка слот + if($aData['slots'] < $tarif['slots_min'] || $aData['slots'] > $tarif['slots_max']) + sys::outjs(array('e' => 'Переданные данные слот неверны.')); - // Определение суммы - if($cfg['settlement_period']) - { - // Цена аренды за расчетный период - $sum = games::define_sum($tarif['discount'], $tarif['price'], $aData['slots'], $start_point); + // Определение суммы + if($cfg['settlement_period']) + { + // Цена аренды за расчетный период + $sum = games::define_sum($tarif['discount'], $tarif['price'], $aData['slots'], $start_point); - $aData['time'] = games::define_period('buy', params::$aDayMonth); - }else - $sum = games::define_sum($tarif['discount'], $tarif['price'], $aData['slots'], $aData['time']); + $aData['time'] = games::define_period('buy', params::$aDayMonth); + }else + $sum = games::define_sum($tarif['discount'], $tarif['price'], $aData['slots'], $aData['time']); - // Проверка промо-кода - $promo = games::define_promo( - $aData['promo'], - array( - 'tarif' => $aData['tarif'], - 'slots' => $aData['slots'], - 'time' => $aData['time'], - 'user' => $user['id'] - ), - $tarif['discount'], - $sum - ); + // Проверка промо-кода + $promo = games::define_promo( + $aData['promo'], + array( + 'tarif' => $aData['tarif'], + 'slots' => $aData['slots'], + 'time' => $aData['time'], + 'user' => $user['id'] + ), + $tarif['discount'], + $sum + ); - $days = $aData['time']; // Кол-во дней аренды + $days = $aData['time']; // Кол-во дней аренды - // Использование промо-кода - if(is_array($promo)) - { - if(array_key_exists('sum', $promo)) - $sum = $promo['sum']; - else - $days += $promo['days']; // Кол-во дней аренды с учетом подарочных (промо-код) - } + // Использование промо-кода + if(is_array($promo)) + { + if(array_key_exists('sum', $promo)) + $sum = $promo['sum']; + else + $days += $promo['days']; // Кол-во дней аренды с учетом подарочных (промо-код) + } - // Проверка баланса - if($user['balance'] < $sum) - sys::outjs(array('e' => 'У вас не хватает '.(round($sum-$user['balance'], 2)).' '.$cfg['currency'])); + // Проверка баланса + if($user['balance'] < $sum) + sys::outjs(array('e' => 'У вас не хватает '.(round($sum-$user['balance'], 2)).' '.$cfg['currency'])); - // Выделенный адрес игрового сервера - if(!empty($tarif['ip'])) - { - $aIp = explode(':', $tarif['ip']); + // Выделенный адрес игрового сервера + if(!empty($tarif['ip'])) + { + $aIp = explode(':', $tarif['ip']); - $ip = false; - $port = params::$aDefPort['mta']; + $ip = false; + $port = params::$aDefPort['mta']; - // Проверка наличия свободного адреса - foreach($aIp as $adr) - { - $adr = trim($adr); + // Проверка наличия свободного адреса + foreach($aIp as $adr) + { + $adr = trim($adr); - $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND `address` LIKE "'.$adr.':%" LIMIT 1'); - if(!$sql->num()) - { - $ip = $adr; + $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND `address` LIKE "'.$adr.':%" LIMIT 1'); + if(!$sql->num()) + { + $ip = $adr; - break; - } - } - }else{ - $ip = sys::first(explode(':', $unit['address'])); - $port = false; + break; + } + } + }else{ + $ip = sys::first(explode(':', $unit['address'])); + $port = false; - // Проверка наличия свободного порта - for($tarif['port_min']; $tarif['port_min'] <= $tarif['port_max']; $tarif['port_min']+=1) - { - $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND (`address`="'.$ip.':'.$tarif['port_min'].'" OR `port`="'.$tarif['port_min'].'") LIMIT 1'); - if(!$sql->num()) - { - $port = $tarif['port_min']; + // Проверка наличия свободного порта + for($tarif['port_min']; $tarif['port_min'] <= $tarif['port_max']; $tarif['port_min']+=1) + { + $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND (`address`="'.$ip.':'.$tarif['port_min'].'" OR `port`="'.$tarif['port_min'].'") LIMIT 1'); + if(!$sql->num()) + { + $port = $tarif['port_min']; - break; - } - } - } + break; + } + } + } - if(!$ip || !$port) - { - $sql->query('UPDATE `tarifs` set `show`="0" WHERE `id`="'.$aData['tarif'].'" LIMIT 1'); + if(!$ip || !$port) + { + $sql->query('UPDATE `tarifs` set `show`="0" WHERE `id`="'.$aData['tarif'].'" LIMIT 1'); - sys::outjs(array('e' => 'К сожалению нет доступных мест, обратитесь в тех.поддержку.')); - } + sys::outjs(array('e' => 'К сожалению нет доступных мест, обратитесь в тех.поддержку.')); + } - if($test) - $aData['time'] = games::time($start_point, $tarif['test']); - else - $aData['time'] = games::time($start_point, $days); + if($test) + $aData['time'] = games::time($start_point, $tarif['test']); + else + $aData['time'] = games::time($start_point, $days); - $fix_one = 0; - $core = 0; + $fix_one = 0; + $core = 0; - if($tarif['core_fix'] != '') - { - $aCore = explode(',', $tarif['core_fix']); + if($tarif['core_fix'] != '') + { + $aCore = explode(',', $tarif['core_fix']); - foreach($aCore as $cpu) - { - $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND `tarif`="'.$aData['tarif'].'" AND `core_fix`="'.$cpu.'" AND `core_fix_one`="1" LIMIT 1'); + foreach($aCore as $cpu) + { + $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND `tarif`="'.$aData['tarif'].'" AND `core_fix`="'.$cpu.'" AND `core_fix_one`="1" LIMIT 1'); - if($sql->num()) - continue; + if($sql->num()) + continue; - $fix_one = 1; - $core = $cpu; + $fix_one = 1; + $core = $cpu; - break; - } + break; + } - if(!$core) - { - $sql->query('UPDATE `tarifs` set `show`="0" WHERE `id`="'.$aData['tarif'].'" LIMIT 1'); + if(!$core) + { + $sql->query('UPDATE `tarifs` set `show`="0" WHERE `id`="'.$aData['tarif'].'" LIMIT 1'); - sys::outjs(array('e' => 'К сожалению нет доступных мест, обратитесь в тех.поддержку.')); - } - } + sys::outjs(array('e' => 'К сожалению нет доступных мест, обратитесь в тех.поддержку.')); + } + } - $ram = $tarif['param_fix'] ? $aData['ram'] : $cfg['ram']['mta']*$aSDATA['slots']; + $ram = $tarif['param_fix'] ? $aData['ram'] : $cfg['ram']['mta']*$aSDATA['slots']; - // Массив данных - $aSDATA = array( - 'unit' => $aData['unit'], // идентификатор локации - 'tarif' => $aData['tarif'], // идентификатор тарифа - 'ram' => $ram, // значение ram - 'param_fix' => $tarif['param_fix'], // фиксированные параметры - 'pack' => $aData['pack'], // Выбранная сборка для установки - 'time' => $aData['time'], // Время аренды - 'days' => $days, // Число дней - 'sum' => $sum, // Сумма списания - 'test' => $test, // тестовый период - 'address' => $ip.':'.$port, // адрес игрового сервера - 'port' => $port, // порт игрового сервера - 'slots' => $aData['slots'], // Кол-во слот - 'autostop' => $tarif['autostop'], // Выключение при 0 онлайне - 'ftp' => $tarif['ftp'], // Использование ftp - 'plugins' => $tarif['plugins'], // Использование плагинов - 'console' => $tarif['console'], // Использование консоли - 'stats' => $tarif['stats'], // Использование графиков (ведение статистики) - 'copy' => $tarif['copy'], // Использование резервных копий - 'web' => $tarif['web'], // Использование доп услуг - 'plugins_install' => $tarif['plugins_install'], // Список установленных плагинов - 'hdd' => $tarif['hdd'], // Дисковое пространство - 'core_fix' => $core, // Выделенный поток - 'core_fix_one' => $fix_one, // Выделенный поток - 'promo' => $promo // Использование промо-кода - ); + // Массив данных + $aSDATA = array( + 'unit' => $aData['unit'], // идентификатор локации + 'tarif' => $aData['tarif'], // идентификатор тарифа + 'ram' => $ram, // значение ram + 'param_fix' => $tarif['param_fix'], // фиксированные параметры + 'pack' => $aData['pack'], // Выбранная сборка для установки + 'time' => $aData['time'], // Время аренды + 'days' => $days, // Число дней + 'sum' => $sum, // Сумма списания + 'test' => $test, // тестовый период + 'address' => $ip.':'.$port, // адрес игрового сервера + 'port' => $port, // порт игрового сервера + 'slots' => $aData['slots'], // Кол-во слот + 'autostop' => $tarif['autostop'], // Выключение при 0 онлайне + 'ftp' => $tarif['ftp'], // Использование ftp + 'plugins' => $tarif['plugins'], // Использование плагинов + 'console' => $tarif['console'], // Использование консоли + 'stats' => $tarif['stats'], // Использование графиков (ведение статистики) + 'copy' => $tarif['copy'], // Использование резервных копий + 'web' => $tarif['web'], // Использование доп услуг + 'plugins_install' => $tarif['plugins_install'], // Список установленных плагинов + 'hdd' => $tarif['hdd'], // Дисковое пространство + 'core_fix' => $core, // Выделенный поток + 'core_fix_one' => $fix_one, // Выделенный поток + 'promo' => $promo // Использование промо-кода + ); - return $aSDATA; - } + return $aSDATA; + } - public static function install($aSDATA = array()) - { - global $cfg, $sql, $user, $start_point; + public static function install($aSDATA = array()) + { + global $cfg, $sql, $user, $start_point; - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - // Массив данных локации (адрес,пароль) - $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$aSDATA['unit'].'" LIMIT 1'); - $unit = $sql->get(); + // Массив данных локации (адрес,пароль) + $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$aSDATA['unit'].'" LIMIT 1'); + $unit = $sql->get(); - // Проверка ssh соединения с локацией - if(!$ssh->auth($unit['passwd'], $unit['address'])) - sys::outjs(array('e' => sys::text('error', 'ssh'))); + // Проверка ssh соединения с локацией + if(!$ssh->auth($unit['passwd'], $unit['address'])) + sys::outjs(array('e' => sys::text('error', 'ssh'))); - // Массив данных тарифа (путь сборки,путь установки) - $sql->query('SELECT `path`, `install`, `hostname` FROM `tarifs` WHERE `id`="'.$aSDATA['tarif'].'" LIMIT 1'); - $tarif = $sql->get(); + // Массив данных тарифа (путь сборки,путь установки) + $sql->query('SELECT `path`, `install`, `hostname` FROM `tarifs` WHERE `id`="'.$aSDATA['tarif'].'" LIMIT 1'); + $tarif = $sql->get(); - // Получение идентификаторов игрового сервера - $sql->query('INSERT INTO `servers` set uid="1"'); - $id = $sql->id(); - $uid = $id+1000; + // Получение идентификаторов игрового сервера + $sql->query('INSERT INTO `servers` set uid="1"'); + $id = $sql->id(); + $uid = $id+1000; - // Директория сборки - $path = $tarif['path'].$aSDATA['pack']; + // Директория сборки + $path = $tarif['path'].$aSDATA['pack']; - // Директория игрового сервера - $install = $tarif['install'].$uid; + // Директория игрового сервера + $install = $tarif['install'].$uid; - $ssh->set('mkdir '.$install.';' // Создание директории - .'useradd -s /bin/false -d '.$install.' -g servers -u '.$uid.' server'.$uid.';' // Создание пользователя сервера на локации - .'chown server'.$uid.':1000 '.$install.';' // Изменение владельца и группы директории - .'cd '.$install.' && sudo -u server'.$uid.' screen -dmS i_'.$uid.' sh -c "cp -r '.$path.'/. .;' // Копирование файлов сборки для сервера - .'find . -type d -exec chmod 700 {} \;;' - .'find . -type f -exec chmod 777 {} \;;' - .'chmod 500 '.params::$aFileGame[$server['mta']].'"'); + $ssh->set('mkdir '.$install.';' // Создание директории + .'useradd -s /bin/false -d '.$install.' -g servers -u '.$uid.' server'.$uid.';' // Создание пользователя сервера на локации + .'chown server'.$uid.':1000 '.$install.';' // Изменение владельца и группы директории + .'cd '.$install.' && sudo -u server'.$uid.' screen -dmS i_'.$uid.' sh -c "cp -r '.$path.'/. .;' // Копирование файлов сборки для сервера + .'find . -type d -exec chmod 700 {} \;;' + .'find . -type f -exec chmod 777 {} \;;' + .'chmod 500 '.params::$aFileGame[$server['mta']].'"'); - // Запись данных нового сервера - $sql->query('UPDATE `servers` set - `uid`="'.$uid.'", - `unit`="'.$aSDATA['unit'].'", - `tarif`="'.$aSDATA['tarif'].'", - `user`="'.$user['id'].'", - `address`="'.$aSDATA['address'].'", - `port`="'.$aSDATA['port'].'", - `game`="mta", - `slots`="'.$aSDATA['slots'].'", - `slots_start`="'.$aSDATA['slots'].'", - `status`="install", - `name`="'.$tarif['hostname'].'", - `pack`="'.$aSDATA['pack'].'", - `plugins_use`="'.$aSDATA['plugins'].'", - `ftp_use`="'.$aSDATA['ftp'].'", - `console_use`="'.$aSDATA['console'].'", - `stats_use`="'.$aSDATA['stats'].'", - `copy_use`="'.$aSDATA['copy'].'", - `web_use`="'.$aSDATA['web'].'", - `vac`="1", - `hdd`="'.$aSDATA['hdd'].'", - `time`="'.$aSDATA['time'].'", - `date`="'.$start_point.'", - `test`="'.$aSDATA['test'].'", - `ram`="'.$aSDATA['ram'].'", - `core_fix`="'.$aSDATA['core_fix'].'", - `core_fix_one`="'.$aSDATA['core_fix_one'].'", - `autostop`="'.$aSDATA['autostop'].'" WHERE `id`="'.$id.'" LIMIT 1'); + // Запись данных нового сервера + $sql->query('UPDATE `servers` set + `uid`="'.$uid.'", + `unit`="'.$aSDATA['unit'].'", + `tarif`="'.$aSDATA['tarif'].'", + `user`="'.$user['id'].'", + `address`="'.$aSDATA['address'].'", + `port`="'.$aSDATA['port'].'", + `game`="mta", + `slots`="'.$aSDATA['slots'].'", + `slots_start`="'.$aSDATA['slots'].'", + `status`="install", + `name`="'.$tarif['hostname'].'", + `pack`="'.$aSDATA['pack'].'", + `plugins_use`="'.$aSDATA['plugins'].'", + `ftp_use`="'.$aSDATA['ftp'].'", + `console_use`="'.$aSDATA['console'].'", + `stats_use`="'.$aSDATA['stats'].'", + `copy_use`="'.$aSDATA['copy'].'", + `web_use`="'.$aSDATA['web'].'", + `vac`="1", + `hdd`="'.$aSDATA['hdd'].'", + `time`="'.$aSDATA['time'].'", + `date`="'.$start_point.'", + `test`="'.$aSDATA['test'].'", + `ram`="'.$aSDATA['ram'].'", + `core_fix`="'.$aSDATA['core_fix'].'", + `core_fix_one`="'.$aSDATA['core_fix_one'].'", + `autostop`="'.$aSDATA['autostop'].'" WHERE `id`="'.$id.'" LIMIT 1'); - // Запись установленных плагинов - if($aSDATA['plugins']) - { - // Массив идентификаторов плагинов - $aPlugins = sys::b64djs($aSDATA['plugins_install']); + // Запись установленных плагинов + if($aSDATA['plugins']) + { + // Массив идентификаторов плагинов + $aPlugins = sys::b64djs($aSDATA['plugins_install']); - if(isset($aPlugins[$aSDATA['pack']])) - { - $plugins = explode(',', $aPlugins[$aSDATA['pack']]); + if(isset($aPlugins[$aSDATA['pack']])) + { + $plugins = explode(',', $aPlugins[$aSDATA['pack']]); - foreach($plugins as $plugin) - if($plugin) - $sql->query('INSERT INTO `plugins_install` set `server`="'.$id.'", `plugin`="'.$plugin.'", `time`="'.$start_point.'"'); - } - } + foreach($plugins as $plugin) + if($plugin) + $sql->query('INSERT INTO `plugins_install` set `server`="'.$id.'", `plugin`="'.$plugin.'", `time`="'.$start_point.'"'); + } + } - // Списание средств с баланса пользователя - $sql->query('UPDATE `users` set `balance`="'.($user['balance']-$aSDATA['sum']).'" WHERE `id`="'.$user['id'].'" LIMIT 1'); + // Списание средств с баланса пользователя + $sql->query('UPDATE `users` set `balance`="'.($user['balance']-$aSDATA['sum']).'" WHERE `id`="'.$user['id'].'" LIMIT 1'); - // Запись получения тестового периода - if($aSDATA['test']) - { - $sql->query('INSERT INTO `tests` set `server`="'.$id.'", `unit`="'.$aSDATA['unit'].'", `game`="mta", `user`="'.$user['id'].'", `time`="'.$start_point.'"'); - $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="'.sys::updtext(sys::text('logs', 'buy_server_test'), array('id' => $id)).'", `date`="'.$start_point.'", `type`="buy", `money`="0"'); - }else{ - // Реф. система - games::part($user['id'], $aSDATA['sum']); + // Запись получения тестового периода + if($aSDATA['test']) + { + $sql->query('INSERT INTO `tests` set `server`="'.$id.'", `unit`="'.$aSDATA['unit'].'", `game`="mta", `user`="'.$user['id'].'", `time`="'.$start_point.'"'); + $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="'.sys::updtext(sys::text('logs', 'buy_server_test'), array('id' => $id)).'", `date`="'.$start_point.'", `type`="buy", `money`="0"'); + }else{ + // Реф. система + games::part($user['id'], $aSDATA['sum']); - // Запись логов - if(!is_array($aSDATA['promo'])) - $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="'.sys::updtext(sys::text('logs', 'buy_server'), array('days' => games::parse_day($aSDATA['days'], true), 'money' => $aSDATA['sum'], 'id' => $id)).'", `date`="'.$start_point.'", `type`="buy", `money`="'.$aSDATA['sum'].'"'); - else{ - $sql->query('UPDATE `servers` set `benefit`="'.$aSDATA['time'].'" WHERE `id`="'.$id.'" LIMIT 1'); - $sql->query('INSERT INTO `promo_use` set `promo`="'.$aSDATA['promo']['id'].'", `user`="'.$user['id'].'", `time`="'.$start_point.'"'); - $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="'.sys::updtext(sys::text('logs', 'buy_server_promo'), array('days' => games::parse_day($aSDATA['days'], true), 'money' => $aSDATA['sum'], 'promo' => $aSDATA['promo']['cod'], 'id' => $id)).'", `date`="'.$start_point.'", `type`="buy", `money`="'.$aSDATA['sum'].'"'); - } - } + // Запись логов + if(!is_array($aSDATA['promo'])) + $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="'.sys::updtext(sys::text('logs', 'buy_server'), array('days' => games::parse_day($aSDATA['days'], true), 'money' => $aSDATA['sum'], 'id' => $id)).'", `date`="'.$start_point.'", `type`="buy", `money`="'.$aSDATA['sum'].'"'); + else{ + $sql->query('UPDATE `servers` set `benefit`="'.$aSDATA['time'].'" WHERE `id`="'.$id.'" LIMIT 1'); + $sql->query('INSERT INTO `promo_use` set `promo`="'.$aSDATA['promo']['id'].'", `user`="'.$user['id'].'", `time`="'.$start_point.'"'); + $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="'.sys::updtext(sys::text('logs', 'buy_server_promo'), array('days' => games::parse_day($aSDATA['days'], true), 'money' => $aSDATA['sum'], 'promo' => $aSDATA['promo']['cod'], 'id' => $id)).'", `date`="'.$start_point.'", `type`="buy", `money`="'.$aSDATA['sum'].'"'); + } + } - return $id; - } + return $id; + } } ?> \ No newline at end of file diff --git a/system/library/games/mta/tarif.php b/system/library/games/mta/tarif.php index a65da45..b61e6a3 100644 --- a/system/library/games/mta/tarif.php +++ b/system/library/games/mta/tarif.php @@ -1,179 +1,179 @@ get('extend', 'sections/servers/games/tarif'); + $html->get('extend', 'sections/servers/games/tarif'); - if(isset($html->arr['extend_address'])) - { - $html->unit('extend_address', 1); - $html->set('extend_address', $html->arr['extend_address']); - }else - $html->unit('extend_address'); + if(isset($html->arr['extend_address'])) + { + $html->unit('extend_address', 1); + $html->set('extend_address', $html->arr['extend_address']); + }else + $html->unit('extend_address'); - $html->set('id', $sid); - $html->set('time', sys::date('min', $server['time'])); - $html->set('options', ''.$options); - $html->set('slots', $server['slots']); - $html->set('info', ''); - $html->set('tarif', $tarif_name); - $html->set('cur', $cfg['currency']); + $html->set('id', $sid); + $html->set('time', sys::date('min', $server['time'])); + $html->set('options', ''.$options); + $html->set('slots', $server['slots']); + $html->set('info', ''); + $html->set('tarif', $tarif_name); + $html->set('cur', $cfg['currency']); - $html->pack('main'); + $html->pack('main'); - return NULL; - } + return NULL; + } public static function extend_sp($server, $tarif, $sid) { - global $cfg, $sql, $html, $start_point; + global $cfg, $sql, $html, $start_point; - tarifs::extend_address($server['game'], $sid); + tarifs::extend_address($server['game'], $sid); - $sum = $tarif['slots'] ? $tarif['price'] : $tarif['price']*$server['slots']; + $sum = $tarif['slots'] ? $tarif['price'] : $tarif['price']*$server['slots']; - $html->get('extend_sp', 'sections/servers/games/tarif'); + $html->get('extend_sp', 'sections/servers/games/tarif'); - if(isset($html->arr['extend_address'])) - { - $html->unit('extend_address', 1); - $html->set('extend_address', $html->arr['extend_address']); - }else - $html->unit('extend_address'); + if(isset($html->arr['extend_address'])) + { + $html->unit('extend_address', 1); + $html->set('extend_address', $html->arr['extend_address']); + }else + $html->unit('extend_address'); - $html->set('id', $sid); - $html->set('time', sys::date('min', $server['time'])); - $html->set('date', $server['time'] > $start_point ? 'Сервер продлен до: '.date('d.m.Y', $server['time']) : 'Текущая дата: '.date('d.m.Y', $start_point)); - $html->set('options', ''.$options); - $html->set('slots', $server['slots']); - $html->set('info', ''); - $html->set('tarif', $tarif['name']); - $html->set('sum', $sum); - $html->set('cur', $cfg['currency']); + $html->set('id', $sid); + $html->set('time', sys::date('min', $server['time'])); + $html->set('date', $server['time'] > $start_point ? 'Сервер продлен до: '.date('d.m.Y', $server['time']) : 'Текущая дата: '.date('d.m.Y', $start_point)); + $html->set('options', ''.$options); + $html->set('slots', $server['slots']); + $html->set('info', ''); + $html->set('tarif', $tarif['name']); + $html->set('sum', $sum); + $html->set('cur', $cfg['currency']); - $html->pack('main'); + $html->pack('main'); - return NULL; - } + return NULL; + } public static function plan() { - return NULL; - } + return NULL; + } - public static function unit($server, $unit_name, $tarif_name, $sid) + public static function unit($server, $unit_name, $tarif_name, $sid) { - global $cfg, $sql, $html; + global $cfg, $sql, $html; - if(!$cfg['change_unit'][$server['game']]) - return NULL; + if(!$cfg['change_unit'][$server['game']]) + return NULL; - $tarifs = $sql->query('SELECT `unit` FROM `tarifs` WHERE `game`="'.$server['game'].'" AND `name`="'.$tarif_name.'" AND `id`!="'.$server['tarif'].'" AND `show`="1" ORDER BY `unit`'); - if(!$sql->num($tarifs)) - return NULL; + $tarifs = $sql->query('SELECT `unit` FROM `tarifs` WHERE `game`="'.$server['game'].'" AND `name`="'.$tarif_name.'" AND `id`!="'.$server['tarif'].'" AND `show`="1" ORDER BY `unit`'); + if(!$sql->num($tarifs)) + return NULL; - $units = 0; + $units = 0; - $options = ''; + $options = ''; - while($tarif = $sql->get($tarifs)) - { - $sql->query('SELECT `id`, `name` FROM `units` WHERE `id`="'.$tarif['unit'].'" AND `show`="1" LIMIT 1'); - if(!$sql->num()) - continue; + while($tarif = $sql->get($tarifs)) + { + $sql->query('SELECT `id`, `name` FROM `units` WHERE `id`="'.$tarif['unit'].'" AND `show`="1" LIMIT 1'); + if(!$sql->num()) + continue; - $unit = $sql->get(); + $unit = $sql->get(); - $options .= ''; + $options .= ''; - $units+=1; - } + $units+=1; + } - if(!$units) - return NULL; + if(!$units) + return NULL; - $html->get('unit', 'sections/servers/games/tarif'); + $html->get('unit', 'sections/servers/games/tarif'); - $html->set('id', $sid); - $html->set('options', $options); - $html->set('slots', $server['slots']); - $html->set('info', ''); - $html->set('unit', $unit_name); - $html->set('tarif', $tarif_name); + $html->set('id', $sid); + $html->set('options', $options); + $html->set('slots', $server['slots']); + $html->set('info', ''); + $html->set('unit', $unit_name); + $html->set('tarif', $tarif_name); - $html->pack('main'); + $html->pack('main'); - return NULL; - } + return NULL; + } - public static function unit_new($tarif, $unit, $server, $mcache) - { - global $ssh, $sql, $user, $start_point; + public static function unit_new($tarif, $unit, $server, $mcache) + { + global $ssh, $sql, $user, $start_point; - // Проверка ssh соединения с локацией - if(!$ssh->auth($unit['passwd'], $unit['address'])) - sys::outjs(array('e' => sys::text('error', 'ssh'))); + // Проверка ssh соединения с локацией + if(!$ssh->auth($unit['passwd'], $unit['address'])) + sys::outjs(array('e' => sys::text('error', 'ssh'))); - // Директория сборки - $path = $tarif['path'].$tarif['pack']; + // Директория сборки + $path = $tarif['path'].$tarif['pack']; - // Директория игрового сервера - $install = $tarif['install'].$server['uid']; + // Директория игрового сервера + $install = $tarif['install'].$server['uid']; - // Пользователь сервера - $uS = 'server'.$server['uid']; + // Пользователь сервера + $uS = 'server'.$server['uid']; - $ssh->set('mkdir '.$install.';' // Создание директории - .'useradd -d '.$install.' -g servers -u '.$server['uid'].' '.$uS.';' // Создание пользователя сервера на локации - .'chown '.$uS.':1000 '.$install.';' // Изменение владельца и группы директории - .'cd '.$install.' && sudo -u '.$uS.' screen -dmS i_'.$server['uid'].' cp -r '.$path.'/. .'); // Копирование файлов сборки для сервера + $ssh->set('mkdir '.$install.';' // Создание директории + .'useradd -d '.$install.' -g servers -u '.$server['uid'].' '.$uS.';' // Создание пользователя сервера на локации + .'chown '.$uS.':1000 '.$install.';' // Изменение владельца и группы директории + .'cd '.$install.' && sudo -u '.$uS.' screen -dmS i_'.$server['uid'].' cp -r '.$path.'/. .'); // Копирование файлов сборки для сервера - $address = explode(':', $server['address']); + $address = explode(':', $server['address']); - $fix_one = $tarif['core_fix'] ? 1 : 0; + $fix_one = $tarif['core_fix'] ? 1 : 0; - // Обновление данных нового сервера - $sql->query('UPDATE `servers` set - `unit`="'.$tarif['unit'].'", - `tarif`="'.$tarif['id'].'", - `address`="'.$server['address'].'", - `port`="'.$address[1].'", - `status`="install", - `name`="'.$tarif['hostname'].'", - `pack`="'.$tarif['pack'].'", - `map_start`="'.$tarif['map'].'", - `hdd`="'.$tarif['hdd'].'", - `time`="'.$tarif['time'].'", - `autostop`="'.$tarif['autostop'].'", - `core_fix`="'.$tarif['core_fix'].'", - `core_fix_one`="'.$fix_one.'", - `reinstall`="'.$start_point.'" WHERE `id`="'.$server['id'].'" LIMIT 1'); + // Обновление данных нового сервера + $sql->query('UPDATE `servers` set + `unit`="'.$tarif['unit'].'", + `tarif`="'.$tarif['id'].'", + `address`="'.$server['address'].'", + `port`="'.$address[1].'", + `status`="install", + `name`="'.$tarif['hostname'].'", + `pack`="'.$tarif['pack'].'", + `map_start`="'.$tarif['map'].'", + `hdd`="'.$tarif['hdd'].'", + `time`="'.$tarif['time'].'", + `autostop`="'.$tarif['autostop'].'", + `core_fix`="'.$tarif['core_fix'].'", + `core_fix_one`="'.$fix_one.'", + `reinstall`="'.$start_point.'" WHERE `id`="'.$server['id'].'" LIMIT 1'); - // Запись установленных плагинов - if($tarif['plugins']) - { - // Массив идентификаторов плагинов - $aPlugins = sys::b64js($tarif['plugins_install']); + // Запись установленных плагинов + if($tarif['plugins']) + { + // Массив идентификаторов плагинов + $aPlugins = sys::b64js($tarif['plugins_install']); - if(isset($aPlugins[$tarif['pack']])) - { - $plugins = explode(',', $aPlugins[$tarif['pack']]); + if(isset($aPlugins[$tarif['pack']])) + { + $plugins = explode(',', $aPlugins[$tarif['pack']]); - foreach($plugins as $plugin) - if($plugin) - $sql->query('INSERT INTO `plugins_install` set `server`="'.$server['id'].'", `plugin`="'.$plugin.'", `time`="'.$start_point.'"'); - } - } + foreach($plugins as $plugin) + if($plugin) + $sql->query('INSERT INTO `plugins_install` set `server`="'.$server['id'].'", `plugin`="'.$plugin.'", `time`="'.$start_point.'"'); + } + } - return NULL; - } + return NULL; + } } ?> \ No newline at end of file diff --git a/system/library/games/plugins.php b/system/library/games/plugins.php index cbfe1e5..414684f 100644 --- a/system/library/games/plugins.php +++ b/system/library/games/plugins.php @@ -1,181 +1,181 @@ arr['images'])) - unset($html->arr['images']); + if(isset($html->arr['images'])) + unset($html->arr['images']); - $aImg = explode("\n", $images); + $aImg = explode("\n", $images); - foreach($aImg as $img) - { - $html->get('plugin_images', 'sections/servers/games/plugins'); + foreach($aImg as $img) + { + $html->get('plugin_images', 'sections/servers/games/plugins'); - $html->set('id', $plugin); - $html->set('img', $img); + $html->set('id', $plugin); + $html->set('img', $img); - $html->pack('images'); - } + $html->pack('images'); + } - return isset($html->arr['images']) ? $html->arr['images'] : ''; - } + return isset($html->arr['images']) ? $html->arr['images'] : ''; + } - public static function status($status) - { - global $html; + public static function status($status) + { + global $html; - if(!$status) - { - $html->unit('unstable'); - $html->unit('stable', 1); - $html->unit('testing'); - }elseif($status == 2){ - $html->unit('unstable'); - $html->unit('stable'); - $html->unit('testing', 1); - }else{ - $html->unit('unstable', 1); - $html->unit('stable'); - $html->unit('testing'); - } + if(!$status) + { + $html->unit('unstable'); + $html->unit('stable', 1); + $html->unit('testing'); + }elseif($status == 2){ + $html->unit('unstable'); + $html->unit('stable'); + $html->unit('testing', 1); + }else{ + $html->unit('unstable', 1); + $html->unit('stable'); + $html->unit('testing'); + } - return NULL; - } + return NULL; + } - public static function required($id, $required, $choice, $mcache) - { - global $sql; + public static function required($id, $required, $choice, $mcache) + { + global $sql; - if($required == '') - return NULL; + if($required == '') + return NULL; - $aRequi = explode(':', $required); + $aRequi = explode(':', $required); - foreach($aRequi as $pl) - { - $sql->query('SELECT `id` FROM `plugins_install` WHERE `server`="'.$id.'" AND `plugin`="'.$pl.'" LIMIT 1'); - if(!$sql->num()) - { - $sql->query('SELECT `name` FROM `plugins` WHERE `id`="'.$pl.'" LIMIT 1'); - $plRequi = $sql->get(); + foreach($aRequi as $pl) + { + $sql->query('SELECT `id` FROM `plugins_install` WHERE `server`="'.$id.'" AND `plugin`="'.$pl.'" LIMIT 1'); + if(!$sql->num()) + { + $sql->query('SELECT `name` FROM `plugins` WHERE `id`="'.$pl.'" LIMIT 1'); + $plRequi = $sql->get(); - if($choice != '') - { - $aChoice = explode(' ', $choice); + if($choice != '') + { + $aChoice = explode(' ', $choice); - foreach($aChoice as $plugins) - { - $aPlugins = explode(':', $plugins); + foreach($aChoice as $plugins) + { + $aPlugins = explode(':', $plugins); - if(in_array($pl, $aPlugins)) - { - $options = ''; - foreach($aPlugins as $plugin) - { - $sql->query('SELECT `name`, `upd` FROM `plugins` WHERE `id`="'.$plugin.'" LIMIT 1'); - $data = $sql->get(); + if(in_array($pl, $aPlugins)) + { + $options = ''; + foreach($aPlugins as $plugin) + { + $sql->query('SELECT `name`, `upd` FROM `plugins` WHERE `id`="'.$plugin.'" LIMIT 1'); + $data = $sql->get(); - if($data['upd']) - { - $sql->query('SELECT `name` FROM `plugins_update` WHERE `plugin`="'.$plugin.'" ORDER BY `id` DESC LIMIT 1'); - $data = $sql->get(); - } + if($data['upd']) + { + $sql->query('SELECT `name` FROM `plugins_update` WHERE `plugin`="'.$plugin.'" ORDER BY `id` DESC LIMIT 1'); + $data = $sql->get(); + } - $options .= ''; - } + $options .= ''; + } - if($options != '') - sys::outjs(array('e' => 'Для данного плагина требуется установка одного из родителя', 'required' => true, 'pid' => $pl, 'select' => $options), $mcache); - } - } - } + if($options != '') + sys::outjs(array('e' => 'Для данного плагина требуется установка одного из родителя', 'required' => true, 'pid' => $pl, 'select' => $options), $mcache); + } + } + } - sys::outjs(array('e' => 'Для данного плагина требуется установка родителя', 'required' => true, 'pid' => $pl, 'pname' => htmlspecialchars_decode($plRequi['name'])), $mcache); - } - } + sys::outjs(array('e' => 'Для данного плагина требуется установка родителя', 'required' => true, 'pid' => $pl, 'pname' => htmlspecialchars_decode($plRequi['name'])), $mcache); + } + } - return NULL; - } + return NULL; + } - public static function incompatible($id, $incompatible, $mcache) - { - global $sql; + public static function incompatible($id, $incompatible, $mcache) + { + global $sql; - if($incompatible == '') - return NULL; + if($incompatible == '') + return NULL; - $aIncomp = explode(':', $incompatible); + $aIncomp = explode(':', $incompatible); - foreach($aIncomp as $pl) - { - $sql->query('SELECT `id` FROM `plugins_install` WHERE `server`="'.$id.'" AND `plugin`="'.$pl.'" LIMIT 1'); - if($sql->num()) - { - $sql->query('SELECT `name` FROM `plugins` WHERE `id`="'.$pl.'" LIMIT 1'); - $plIncomp = $sql->get(); + foreach($aIncomp as $pl) + { + $sql->query('SELECT `id` FROM `plugins_install` WHERE `server`="'.$id.'" AND `plugin`="'.$pl.'" LIMIT 1'); + if($sql->num()) + { + $sql->query('SELECT `name` FROM `plugins` WHERE `id`="'.$pl.'" LIMIT 1'); + $plIncomp = $sql->get(); - sys::outjs(array('e' => 'Данный плагин несовместим с уже установленным плагином', 'pid' => $pl, 'pname' => htmlspecialchars_decode($plIncomp['name'])), $mcache); - } - } + sys::outjs(array('e' => 'Данный плагин несовместим с уже установленным плагином', 'pid' => $pl, 'pname' => htmlspecialchars_decode($plIncomp['name'])), $mcache); + } + } - return NULL; - } + return NULL; + } - public static function clear($clear, $uid, $dir) - { - global $ssh; + public static function clear($clear, $uid, $dir) + { + global $ssh; - // Если регулярное выражение - if(isset($clear['regex']) AND $clear['regex']) - { - $file = preg_replace($clear['text'], '', $ssh->get('sudo -u server'.$uid.' cat '.$dir.$clear['file'])); + // Если регулярное выражение + if(isset($clear['regex']) AND $clear['regex']) + { + $file = preg_replace($clear['text'], '', $ssh->get('sudo -u server'.$uid.' cat '.$dir.$clear['file'])); - // Временный файл - $temp = sys::temp($file); + // Временный файл + $temp = sys::temp($file); - $ssh->setfile($temp, $dir.$clear['file'], 0644); + $ssh->setfile($temp, $dir.$clear['file'], 0644); - unlink($temp); + unlink($temp); - $query = 'chown server'.$uid.':servers '.$dir.$clear['file'].';'; + $query = 'chown server'.$uid.':servers '.$dir.$clear['file'].';'; - }else - // Удаление текста из файла - $query = 'sudo -u server'.$uid.' sed -i '."'s/".str_replace('/', '\/', htmlspecialchars_decode($clear['text']))."//g'".' '.$dir.$clear['file'].';'; + }else + // Удаление текста из файла + $query = 'sudo -u server'.$uid.' sed -i '."'s/".str_replace('/', '\/', htmlspecialchars_decode($clear['text']))."//g'".' '.$dir.$clear['file'].';'; - $ssh->set($query.'sudo -u server'.$uid.' sed -i '."'/./!d'".' '.$dir.$clear['file']); + $ssh->set($query.'sudo -u server'.$uid.' sed -i '."'/./!d'".' '.$dir.$clear['file']); - return NULL; - } + return NULL; + } - public static function write($write, $uid, $dir) - { - global $ssh; + public static function write($write, $uid, $dir) + { + global $ssh; - // Костыль (добавить пустую строку на всякий случай) - $query = 'sudo -u server'.$uid.' echo "" >> '.$dir.$write['file'].';'; + // Костыль (добавить пустую строку на всякий случай) + $query = 'sudo -u server'.$uid.' echo "" >> '.$dir.$write['file'].';'; - // Исключить дублирование, путем удаления добавляемого текста - $query .= 'sudo -u server'.$uid.' sed -i '."'s/".str_replace('/', '\/', htmlspecialchars_decode($write['text']))."//g'".' '.$dir.$write['file'].';'; + // Исключить дублирование, путем удаления добавляемого текста + $query .= 'sudo -u server'.$uid.' sed -i '."'s/".str_replace('/', '\/', htmlspecialchars_decode($write['text']))."//g'".' '.$dir.$write['file'].';'; - // Добавление текста в начало файла - if($write['top']) - $query .= 'sudo -u server'.$uid.' touch '.$dir.$write['file'].'; sudo -u server'.$uid.' sed -i '."'1i ".str_replace(array('/', "'", '\"'), array('\/', "\'", '"'), htmlspecialchars_decode($write['text']))."'".' '.$dir.$write['file'].';'; - else - // Добавление текста в конец файла - $query .= 'sudo -u server'.$uid.' touch '.$dir.$write['file'].'; sudo -u server'.$uid.' echo "'.str_replace('"', '\"', htmlspecialchars_decode($write['text'])).'" >> '.$dir.$write['file'].';'; + // Добавление текста в начало файла + if($write['top']) + $query .= 'sudo -u server'.$uid.' touch '.$dir.$write['file'].'; sudo -u server'.$uid.' sed -i '."'1i ".str_replace(array('/', "'", '\"'), array('\/', "\'", '"'), htmlspecialchars_decode($write['text']))."'".' '.$dir.$write['file'].';'; + else + // Добавление текста в конец файла + $query .= 'sudo -u server'.$uid.' touch '.$dir.$write['file'].'; sudo -u server'.$uid.' echo "'.str_replace('"', '\"', htmlspecialchars_decode($write['text'])).'" >> '.$dir.$write['file'].';'; - $ssh->set($query.'sudo -u server'.$uid.' sed -i '."'/./!d'".' '.$dir.$clear['file']); + $ssh->set($query.'sudo -u server'.$uid.' sed -i '."'/./!d'".' '.$dir.$clear['file']); - return NULL; - } - } + return NULL; + } + } ?> \ No newline at end of file diff --git a/system/library/games/query/BaseSocket.php b/system/library/games/query/BaseSocket.php index 0e7cb0e..56e064c 100644 --- a/system/library/games/query/BaseSocket.php +++ b/system/library/games/query/BaseSocket.php @@ -1,98 +1,98 @@ Close(); - } + public function __destruct() + { + $this->Close(); + } - abstract public function Close(); - abstract public function Open($Address, $Port, $Timeout, $Engine); - abstract public function Write($Header, $String = ''); - abstract public function Read($Length = 1400); + abstract public function Close(); + abstract public function Open($Address, $Port, $Timeout, $Engine); + abstract public function Write($Header, $String = ''); + abstract public function Read($Length = 1400); - protected function ReadInternal($Buffer, $Length, $SherlockFunction) - { - if($Buffer->Remaining() === 0) - return false; + protected function ReadInternal($Buffer, $Length, $SherlockFunction) + { + if($Buffer->Remaining() === 0) + return false; - if($Buffer->Remaining() === 0) - return false; + if($Buffer->Remaining() === 0) + return false; - $Header = $Buffer->GetLong(); + $Header = $Buffer->GetLong(); - if($Header === -2) - { - $Packets = []; - $IsCompressed = false; - $ReadMore = false; + if($Header === -2) + { + $Packets = []; + $IsCompressed = false; + $ReadMore = false; - do - { - $RequestID = $Buffer->GetLong(); + do + { + $RequestID = $Buffer->GetLong(); - switch($this->Engine) - { - case SourceQuery::GOLDSOURCE: - { - $PacketCountAndNumber = $Buffer->GetByte(); - $PacketCount = $PacketCountAndNumber & 0xF; - $PacketNumber = $PacketCountAndNumber >> 4; + switch($this->Engine) + { + case SourceQuery::GOLDSOURCE: + { + $PacketCountAndNumber = $Buffer->GetByte(); + $PacketCount = $PacketCountAndNumber & 0xF; + $PacketNumber = $PacketCountAndNumber >> 4; - break; - } + break; + } - case SourceQuery::SOURCE: - { - $IsCompressed = ($RequestID & 0x80000000) !== 0; - $PacketCount = $Buffer->GetByte(); - $PacketNumber = $Buffer->GetByte() + 1; + case SourceQuery::SOURCE: + { + $IsCompressed = ($RequestID & 0x80000000) !== 0; + $PacketCount = $Buffer->GetByte(); + $PacketNumber = $Buffer->GetByte() + 1; - if($IsCompressed) - { - $Buffer->GetLong(); - - $PacketChecksum = $Buffer->GetUnsignedLong(); - }else - $Buffer->GetShort(); + if($IsCompressed) + { + $Buffer->GetLong(); + + $PacketChecksum = $Buffer->GetUnsignedLong(); + }else + $Buffer->GetShort(); - break; - } - } + break; + } + } - $Packets[$PacketNumber] = $Buffer->Get(); + $Packets[$PacketNumber] = $Buffer->Get(); - $ReadMore = $PacketCount > sizeof($Packets); - } + $ReadMore = $PacketCount > sizeof($Packets); + } - while($ReadMore && $SherlockFunction($Buffer, $Length)); + while($ReadMore && $SherlockFunction($Buffer, $Length)); - $Data = Implode($Packets); + $Data = Implode($Packets); - if($IsCompressed) - { - if(!Function_Exists('bzdecompress')) - return false; + if($IsCompressed) + { + if(!Function_Exists('bzdecompress')) + return false; - $Data = bzdecompress($Data); + $Data = bzdecompress($Data); - if(CRC32($Data) !== $PacketChecksum) - return false; - } + if(CRC32($Data) !== $PacketChecksum) + return false; + } - $Buffer->Set(SubStr($Data, 4)); - }else - return false; + $Buffer->Set(SubStr($Data, 4)); + }else + return false; - return $Buffer; - } - } \ No newline at end of file + return $Buffer; + } + } \ No newline at end of file diff --git a/system/library/games/query/Buffer.php b/system/library/games/query/Buffer.php index ae2e9d5..4145e1c 100644 --- a/system/library/games/query/Buffer.php +++ b/system/library/games/query/Buffer.php @@ -1,102 +1,102 @@ Buffer = $Buffer; - $this->Length = StrLen($Buffer); - $this->Position = 0; - } + public function Set($Buffer) + { + $this->Buffer = $Buffer; + $this->Length = StrLen($Buffer); + $this->Position = 0; + } - public function Remaining() - { - return $this->Length - $this->Position; - } + public function Remaining() + { + return $this->Length - $this->Position; + } - public function Get($Length = -1) - { - if($Length === 0) - return ''; + public function Get($Length = -1) + { + if($Length === 0) + return ''; - $Remaining = $this->Remaining(); + $Remaining = $this->Remaining(); - if($Length === -1) - $Length = $Remaining; + if($Length === -1) + $Length = $Remaining; - else if($Length > $Remaining) - return ''; + else if($Length > $Remaining) + return ''; - $Data = SubStr($this->Buffer, $this->Position, $Length); + $Data = SubStr($this->Buffer, $this->Position, $Length); - $this->Position += $Length; + $this->Position += $Length; - return $Data; - } + return $Data; + } - public function GetByte() - { - return Ord($this->Get(1)); - } + public function GetByte() + { + return Ord($this->Get(1)); + } - public function GetShort() - { - if($this->Remaining() < 2) - return false; + public function GetShort() + { + if($this->Remaining() < 2) + return false; - $Data = UnPack('v', $this->Get(2)); + $Data = UnPack('v', $this->Get(2)); - return $Data[ 1 ]; - } + return $Data[ 1 ]; + } - public function GetLong() - { - if($this->Remaining() < 4) - return false; + public function GetLong() + { + if($this->Remaining() < 4) + return false; - $Data = UnPack('l', $this->Get(4)); + $Data = UnPack('l', $this->Get(4)); - return $Data[ 1 ]; - } + return $Data[ 1 ]; + } - public function GetFloat() - { - if($this->Remaining() < 4) - return false; + public function GetFloat() + { + if($this->Remaining() < 4) + return false; - $Data = UnPack('f', $this->Get(4)); + $Data = UnPack('f', $this->Get(4)); - return $Data[ 1 ]; - } + return $Data[ 1 ]; + } - public function GetUnsignedLong() - { - if($this->Remaining() < 4) - return false; + public function GetUnsignedLong() + { + if($this->Remaining() < 4) + return false; - $Data = UnPack('V', $this->Get(4)); + $Data = UnPack('V', $this->Get(4)); - return $Data[ 1 ]; - } + return $Data[ 1 ]; + } - public function GetString() - { - $ZeroBytePosition = StrPos($this->Buffer, "\0", $this->Position); + public function GetString() + { + $ZeroBytePosition = StrPos($this->Buffer, "\0", $this->Position); - if($ZeroBytePosition === false) - return ''; + if($ZeroBytePosition === false) + return ''; - $String = $this->Get($ZeroBytePosition - $this->Position); + $String = $this->Get($ZeroBytePosition - $this->Position); - $this->Position++; + $this->Position++; - return $String; - } - } \ No newline at end of file + return $String; + } + } \ No newline at end of file diff --git a/system/library/games/query/GoldSourceRcon.php b/system/library/games/query/GoldSourceRcon.php index 3e2f466..5abcd4d 100644 --- a/system/library/games/query/GoldSourceRcon.php +++ b/system/library/games/query/GoldSourceRcon.php @@ -1,105 +1,105 @@ Socket = $Socket; - } + public function __construct($Socket) + { + $this->Socket = $Socket; + } - public function Close() - { - $this->RconChallenge = 0; - $this->RconRequestId = 0; - $this->RconPassword = 0; - } + public function Close() + { + $this->RconChallenge = 0; + $this->RconRequestId = 0; + $this->RconPassword = 0; + } - public function Open() - { - // - } + public function Open() + { + // + } - public function Write($Header, $String = '') - { - $Command = Pack('cccca*', 0xFF, 0xFF, 0xFF, 0xFF, $String); - $Length = StrLen($Command); + public function Write($Header, $String = '') + { + $Command = Pack('cccca*', 0xFF, 0xFF, 0xFF, 0xFF, $String); + $Length = StrLen($Command); - return $Length === FWrite($this->Socket->Socket, $Command, $Length); - } + return $Length === FWrite($this->Socket->Socket, $Command, $Length); + } - public function Read($Length = 1400) - { - $Buffer = $this->Socket->Read(); + public function Read($Length = 1400) + { + $Buffer = $this->Socket->Read(); - $StringBuffer = ''; - $ReadMore = false; + $StringBuffer = ''; + $ReadMore = false; - do - { - $ReadMore = $Buffer->Remaining() > 0; + do + { + $ReadMore = $Buffer->Remaining() > 0; - if($ReadMore) - { - if($Buffer->GetByte() !== SourceQuery::S2A_RCON) - sys::outjs(array('e' => 'неправильный rcon запрос.')); + if($ReadMore) + { + if($Buffer->GetByte() !== SourceQuery::S2A_RCON) + sys::outjs(array('e' => 'неправильный rcon запрос.')); - $Packet = $Buffer->Get(); - $StringBuffer .= $Packet; + $Packet = $Buffer->Get(); + $StringBuffer .= $Packet; - $ReadMore = StrLen($Packet) > 1000; + $ReadMore = StrLen($Packet) > 1000; - if($ReadMore) - $Buffer = $this->Socket->Read(); - } - } + if($ReadMore) + $Buffer = $this->Socket->Read(); + } + } - while($ReadMore); + while($ReadMore); - $Trimmed = trim($StringBuffer); + $Trimmed = trim($StringBuffer); - if($Trimmed === 'Bad rcon_password.') - sys::outjs(array('e' => 'rcon_password из server.cfg не подходит.')); + if($Trimmed === 'Bad rcon_password.') + sys::outjs(array('e' => 'rcon_password из server.cfg не подходит.')); - else if($Trimmed === 'You have been banned from this server.') - sys::outjs(array('e' => 'Игровой сервер заблокировал доступ.')); + else if($Trimmed === 'You have been banned from this server.') + sys::outjs(array('e' => 'Игровой сервер заблокировал доступ.')); - $Buffer->Set($Trimmed); + $Buffer->Set($Trimmed); - return $Buffer; - } + return $Buffer; + } - public function Command($Command) - { - if(!$this->RconChallenge) - return false; + public function Command($Command) + { + if(!$this->RconChallenge) + return false; - $this->Write(0, 'rcon ' . $this->RconChallenge . ' "' . $this->RconPassword . '" ' . $Command . "\0"); - $Buffer = $this->Read(); + $this->Write(0, 'rcon ' . $this->RconChallenge . ' "' . $this->RconPassword . '" ' . $Command . "\0"); + $Buffer = $this->Read(); - if($Buffer) - return $Buffer->Get(); + if($Buffer) + return $Buffer->Get(); - return $Buffer; - } + return $Buffer; + } - public function Authorize($Password) - { - $this->RconPassword = $Password; + public function Authorize($Password) + { + $this->RconPassword = $Password; - $this->Write(0, 'challenge rcon'); - $Buffer = $this->Socket->Read(); + $this->Write(0, 'challenge rcon'); + $Buffer = $this->Socket->Read(); - if($Buffer->Get(14) !== 'challenge rcon') - sys::outjs(array('e' => 'Не удалось выполнить rcon запрос.')); + if($Buffer->Get(14) !== 'challenge rcon') + sys::outjs(array('e' => 'Не удалось выполнить rcon запрос.')); - $this->RconChallenge = Trim($Buffer->Get()); - } - } \ No newline at end of file + $this->RconChallenge = Trim($Buffer->Get()); + } + } \ No newline at end of file diff --git a/system/library/games/query/McQuery.php b/system/library/games/query/McQuery.php index 2615d2c..c98b365 100644 --- a/system/library/games/query/McQuery.php +++ b/system/library/games/query/McQuery.php @@ -1,96 +1,96 @@ stack = fsockopen('udp://'.$ip, $port, $errorNum, $errorString, 2); + public function __construct($ip, $port = 25565) + { + $this->stack = fsockopen('udp://'.$ip, $port, $errorNum, $errorString, 2); - socket_set_timeout($this->stack, 2); - } + socket_set_timeout($this->stack, 2); + } - public function getInfo($pl = false) - { - $Data = $this->WriteData(0x00, $this->GetChallenge().Pack('c*', 0x00, 0x00, 0x00, 0x00)); + public function getInfo($pl = false) + { + $Data = $this->WriteData(0x00, $this->GetChallenge().Pack('c*', 0x00, 0x00, 0x00, 0x00)); - $server_info = array(); - - $Data = substr($Data, 11); - $Data = explode("\x00\x00\x01player_\x00\x00", $Data); - $aData = explode("\x00", $Data[0]); + $server_info = array(); + + $Data = substr($Data, 11); + $Data = explode("\x00\x00\x01player_\x00\x00", $Data); + $aData = explode("\x00", $Data[0]); - $last = ''; + $last = ''; - $keys = Array( - 'hostname' => 'hostname', - 'version' => 'version', - 'plugins' => 'plugins', - 'map' => 'map', - 'numplayers' => 'online' - ); + $keys = Array( + 'hostname' => 'hostname', + 'version' => 'version', + 'plugins' => 'plugins', + 'map' => 'map', + 'numplayers' => 'online' + ); - foreach($aData as $index => $val) - { - if(~$index & 1) - { - if(!array_key_exists($val, $keys)) - { - $last = false; - continue; - } + foreach($aData as $index => $val) + { + if(~$index & 1) + { + if(!array_key_exists($val, $keys)) + { + $last = false; + continue; + } - $last = $keys[$val]; - $server_info[$last] = ''; + $last = $keys[$val]; + $server_info[$last] = ''; - }elseif($last != false) - $server_info[$last] = $val; - } + }elseif($last != false) + $server_info[$last] = $val; + } - if(!count($server_info)) - return NULL; + if(!count($server_info)) + return NULL; - if(!$pl) - return $server_info; + if(!$pl) + return $server_info; - $server_info['players_list'] = explode("\x00", substr($Data[1], 0, -2)); + $server_info['players_list'] = explode("\x00", substr($Data[1], 0, -2)); - if(!isset($server_info['players_list'][1])) - $server_info['players_list'] = array(); + if(!isset($server_info['players_list'][1])) + $server_info['players_list'] = array(); - return $server_info; - } + return $server_info; + } - private function GetChallenge() - { - $Data = $this->WriteData(0x09); - - if($Data === false) - return NULL; + private function GetChallenge() + { + $Data = $this->WriteData(0x09); + + if($Data === false) + return NULL; - return Pack('N', $Data); - } + return Pack('N', $Data); + } - private function WriteData($Command, $Append = '') - { - $Command = Pack('c*', 0xFE, 0xFD, $Command, 0x01, 0x02, 0x03, 0x04).$Append; - $Length = StrLen($Command); - - if($Length !== fwrite($this->stack, $Command, $Length)) - return NULL; - - $Data = fread($this->stack, 2048); - - if($Data === false) - return NULL; - - if(StrLen($Data) < 5 || $Data[0] != $Command[2]) - return false; + private function WriteData($Command, $Append = '') + { + $Command = Pack('c*', 0xFE, 0xFD, $Command, 0x01, 0x02, 0x03, 0x04).$Append; + $Length = StrLen($Command); + + if($Length !== fwrite($this->stack, $Command, $Length)) + return NULL; + + $Data = fread($this->stack, 2048); + + if($Data === false) + return NULL; + + if(StrLen($Data) < 5 || $Data[0] != $Command[2]) + return false; - return SubStr($Data, 5); - } - } + return SubStr($Data, 5); + } + } ?> \ No newline at end of file diff --git a/system/library/games/query/MtaQuery.php b/system/library/games/query/MtaQuery.php index e86cdb0..e48e540 100644 --- a/system/library/games/query/MtaQuery.php +++ b/system/library/games/query/MtaQuery.php @@ -1,93 +1,93 @@ stack = fsockopen('udp://'.$ip, $port+123, $errorNum, $errorString, 2); + public function __construct($ip, $port = 22003) + { + $this->stack = fsockopen('udp://'.$ip, $port+123, $errorNum, $errorString, 2); - socket_set_timeout($this->stack, 2); - } + socket_set_timeout($this->stack, 2); + } - public function getInfo($pl = false) - { - fwrite($this->stack, 's'); + public function getInfo($pl = false) + { + fwrite($this->stack, 's'); - $buffer = fread($this->stack, 4096); + $buffer = fread($this->stack, 4096); - if(!$buffer) - return NULL; + if(!$buffer) + return NULL; - $buffer = substr($buffer, 4); + $buffer = substr($buffer, 4); - $server_info = array(); + $server_info = array(); - $server_info['gamename'] = $this->cut_pascal($buffer, 1, -1); - $server_info['hostport'] = $this->cut_pascal($buffer, 1, -1); - $server_info['hostname'] = $this->cut_pascal($buffer, 1, -1); - $server_info['gamemode'] = $this->cut_pascal($buffer, 1, -1); - $server_info['map'] = $this->cut_pascal($buffer, 1, -1); - $server_info['version'] = $this->cut_pascal($buffer, 1, -1); - $server_info['password'] = $this->cut_pascal($buffer, 1, -1); - $server_info['players'] = $this->cut_pascal($buffer, 1, -1); - $server_info['playersmax'] = $this->cut_pascal($buffer, 1, -1); + $server_info['gamename'] = $this->cut_pascal($buffer, 1, -1); + $server_info['hostport'] = $this->cut_pascal($buffer, 1, -1); + $server_info['hostname'] = $this->cut_pascal($buffer, 1, -1); + $server_info['gamemode'] = $this->cut_pascal($buffer, 1, -1); + $server_info['map'] = $this->cut_pascal($buffer, 1, -1); + $server_info['version'] = $this->cut_pascal($buffer, 1, -1); + $server_info['password'] = $this->cut_pascal($buffer, 1, -1); + $server_info['players'] = $this->cut_pascal($buffer, 1, -1); + $server_info['playersmax'] = $this->cut_pascal($buffer, 1, -1); - while($buffer && $buffer[0] != "\x01") - { - $item_key = strtolower($this->cut_pascal($buffer, 1, -1)); - $item_value = $this->cut_pascal($buffer, 1, -1); + while($buffer && $buffer[0] != "\x01") + { + $item_key = strtolower($this->cut_pascal($buffer, 1, -1)); + $item_value = $this->cut_pascal($buffer, 1, -1); - $server_info[$item_key] = $item_value; - } + $server_info[$item_key] = $item_value; + } - if(!$pl) - return $server_info; + if(!$pl) + return $server_info; - $buffer = substr($buffer, 1); + $buffer = substr($buffer, 1); - $i = 1; + $i = 1; - while($buffer) - { - $bit_flags = $this->cut_byte($buffer, 1); + while($buffer) + { + $bit_flags = $this->cut_byte($buffer, 1); - $field_list = array('name', '', '', '', 'ping', ''); + $field_list = array('name', '', '', '', 'ping', ''); - foreach($field_list as $item_key) - { - $item_value = $this->cut_pascal($buffer, 1, -1); + foreach($field_list as $item_key) + { + $item_value = $this->cut_pascal($buffer, 1, -1); - if(!$item_key) - continue; + if(!$item_key) + continue; - $server_info['players_list'][$i][$item_key] = $item_value; - } + $server_info['players_list'][$i][$item_key] = $item_value; + } - $i+=1; - } + $i+=1; + } - return $server_info; - } + return $server_info; + } - private function cut_pascal(&$buffer, $start_byte = 1, $length_adjust = 0, $end_byte = 0) - { - $length = ord(substr($buffer, 0, $start_byte)) + $length_adjust; - $string = substr($buffer, $start_byte, $length); - $buffer = substr($buffer, $start_byte + $length + $end_byte); + private function cut_pascal(&$buffer, $start_byte = 1, $length_adjust = 0, $end_byte = 0) + { + $length = ord(substr($buffer, 0, $start_byte)) + $length_adjust; + $string = substr($buffer, $start_byte, $length); + $buffer = substr($buffer, $start_byte + $length + $end_byte); - return $string; - } + return $string; + } - private function cut_byte(&$buffer, $length) - { - $string = substr($buffer, 0, $length); - $buffer = substr($buffer, $length); + private function cut_byte(&$buffer, $length) + { + $string = substr($buffer, 0, $length); + $buffer = substr($buffer, $length); - return $string; - } - } + return $string; + } + } ?> \ No newline at end of file diff --git a/system/library/games/query/SampQuery.php b/system/library/games/query/SampQuery.php index 5b6a2ba..2b18ae2 100644 --- a/system/library/games/query/SampQuery.php +++ b/system/library/games/query/SampQuery.php @@ -1,122 +1,122 @@ stack = fsockopen('udp://'.$ip, $port, $errorNum, $errorString, 2); + public function __construct($ip, $port = 7777) + { + $this->stack = fsockopen('udp://'.$ip, $port, $errorNum, $errorString, 2); - socket_set_timeout($this->stack, 2); - } + socket_set_timeout($this->stack, 2); + } - public function getInfo() - { - @fwrite($this->stack, $this->assemblePacket('i')); + public function getInfo() + { + @fwrite($this->stack, $this->assemblePacket('i')); - fread($this->stack, 11); + fread($this->stack, 11); - $serverInfo = array(); + $serverInfo = array(); - $serverInfo['password'] = sys::int(ord(fread($this->stack, 1))); + $serverInfo['password'] = sys::int(ord(fread($this->stack, 1))); - $serverInfo['players'] = sys::int($this->toInt(fread($this->stack, 2))); + $serverInfo['players'] = sys::int($this->toInt(fread($this->stack, 2))); - $serverInfo['maxplayers'] = sys::int($this->toInt(fread($this->stack, 2))); + $serverInfo['maxplayers'] = sys::int($this->toInt(fread($this->stack, 2))); - $strLen = ord(fread($this->stack, 4)); + $strLen = ord(fread($this->stack, 4)); - if(!$strLen) - return -1; + if(!$strLen) + return -1; - $serverInfo['hostname'] = fread($this->stack, $strLen); + $serverInfo['hostname'] = fread($this->stack, $strLen); - $strLen = ord(fread($this->stack, 4)); - $serverInfo['gamemode'] = fread($this->stack, $strLen); + $strLen = ord(fread($this->stack, 4)); + $serverInfo['gamemode'] = fread($this->stack, $strLen); - $strLen = ord(fread($this->stack, 4)); - $serverInfo['map'] = fread($this->stack, $strLen); + $strLen = ord(fread($this->stack, 4)); + $serverInfo['map'] = fread($this->stack, $strLen); - return $serverInfo; - } + return $serverInfo; + } - public function getDetailedPlayers() - { - @fwrite($this->stack, $this->assemblePacket('d')); - fread($this->stack, 11); + public function getDetailedPlayers() + { + @fwrite($this->stack, $this->assemblePacket('d')); + fread($this->stack, 11); - $playerCount = ord(fread($this->stack, 2)); - $players = array(); + $playerCount = ord(fread($this->stack, 2)); + $players = array(); - for($i = 0; $i < $playerCount; ++$i) - { - $player['playerid'] = ord(fread($this->stack, 1)); + for($i = 0; $i < $playerCount; ++$i) + { + $player['playerid'] = ord(fread($this->stack, 1)); - $strLen = ord(fread($this->stack, 1)); - $player['nickname'] = fread($this->stack, $strLen); + $strLen = ord(fread($this->stack, 1)); + $player['nickname'] = fread($this->stack, $strLen); - $player['ping'] = $this->toInt(fread($this->stack, 4)); + $player['ping'] = $this->toInt(fread($this->stack, 4)); - $players[$i] = $player; + $players[$i] = $player; - unset($player); - } + unset($player); + } - return $players; - } + return $players; + } - private function toInt($string) - { - if($string === '') - return null; + private function toInt($string) + { + if($string === '') + return null; - $int = 0; - $int += (ord($string[0])); + $int = 0; + $int += (ord($string[0])); - if(isset($string[1])) - $int += (ord($string[1]) << 8); + if(isset($string[1])) + $int += (ord($string[1]) << 8); - if(isset($string[2])) - $int += (ord($string[2]) << 16); + if(isset($string[2])) + $int += (ord($string[2]) << 16); - if(isset($string[3])) - $int += (ord($string[3]) << 24); + if(isset($string[3])) + $int += (ord($string[3]) << 24); - if($int >= 4294967294) - $int -= 4294967296; + if($int >= 4294967294) + $int -= 4294967296; - return $int; - } + return $int; + } - private function assemblePacket($type) - { - $packet = 'SAMP'; - $packet .= chr(strtok($this->server, '.')); - $packet .= chr(strtok('.')); - $packet .= chr(strtok('.')); - $packet .= chr(strtok('.')); - $packet .= chr($this->port & 0xFF); - $packet .= chr($this->port >> 8 & 0xFF); - $packet .= $type; + private function assemblePacket($type) + { + $packet = 'SAMP'; + $packet .= chr(strtok($this->server, '.')); + $packet .= chr(strtok('.')); + $packet .= chr(strtok('.')); + $packet .= chr(strtok('.')); + $packet .= chr($this->port & 0xFF); + $packet .= chr($this->port >> 8 & 0xFF); + $packet .= $type; - return $packet; - } + return $packet; + } - public function connect() - { - $connected = false; - fwrite($this->stack, $this->assemblePacket('p0101')); + public function connect() + { + $connected = false; + fwrite($this->stack, $this->assemblePacket('p0101')); - if(fread($this->stack, 10)) - { - if(fread($this->stack, 5) == 'p0101') - $connected = true; - } + if(fread($this->stack, 10)) + { + if(fread($this->stack, 5) == 'p0101') + $connected = true; + } - return $connected; - } - } + return $connected; + } + } ?> \ No newline at end of file diff --git a/system/library/games/query/Socket.php b/system/library/games/query/Socket.php index ffe1444..7ebb8a9 100644 --- a/system/library/games/query/Socket.php +++ b/system/library/games/query/Socket.php @@ -1,62 +1,62 @@ Socket) - { - FClose($this->Socket); + class Socket extends BaseSocket + { + public function Close() + { + if($this->Socket) + { + FClose($this->Socket); - $this->Socket = null; - } - } + $this->Socket = null; + } + } - public function Open($Address, $Port, $Timeout, $Engine) - { - $this->Timeout = $Timeout; - $this->Engine = $Engine; - $this->Port = $Port; - $this->Address = $Address; + public function Open($Address, $Port, $Timeout, $Engine) + { + $this->Timeout = $Timeout; + $this->Engine = $Engine; + $this->Port = $Port; + $this->Address = $Address; - $this->Socket = @FSockOpen('udp://' . $Address, $Port, $ErrNo, $ErrStr, $Timeout); + $this->Socket = @FSockOpen('udp://' . $Address, $Port, $ErrNo, $ErrStr, $Timeout); - if($ErrNo || $this->Socket === false) - return false; + if($ErrNo || $this->Socket === false) + return false; - Stream_Set_Timeout($this->Socket, $Timeout); - Stream_Set_Blocking($this->Socket, true); - } + Stream_Set_Timeout($this->Socket, $Timeout); + Stream_Set_Blocking($this->Socket, true); + } - public function Write($Header, $String = '') - { - $Command = Pack('ccccca*', 0xFF, 0xFF, 0xFF, 0xFF, $Header, $String); - $Length = StrLen($Command); + public function Write($Header, $String = '') + { + $Command = Pack('ccccca*', 0xFF, 0xFF, 0xFF, 0xFF, $Header, $String); + $Length = StrLen($Command); - return $Length === FWrite($this->Socket, $Command, $Length); - } + return $Length === FWrite($this->Socket, $Command, $Length); + } - public function Read($Length = 1400) - { - $Buffer = new Buffer(); - $Buffer->Set(FRead($this->Socket, $Length)); + public function Read($Length = 1400) + { + $Buffer = new Buffer(); + $Buffer->Set(FRead($this->Socket, $Length)); - $this->ReadInternal($Buffer, $Length, [$this, 'Sherlock']); + $this->ReadInternal($Buffer, $Length, [$this, 'Sherlock']); - return $Buffer; - } + return $Buffer; + } - public function Sherlock($Buffer, $Length) - { - $Data = FRead($this->Socket, $Length); + public function Sherlock($Buffer, $Length) + { + $Data = FRead($this->Socket, $Length); - if(StrLen($Data) < 4) - return false; + if(StrLen($Data) < 4) + return false; - $Buffer->Set($Data); + $Buffer->Set($Data); - return $Buffer->GetLong() === -2; - } - } \ No newline at end of file + return $Buffer->GetLong() === -2; + } + } \ No newline at end of file diff --git a/system/library/games/query/SourceQuery.php b/system/library/games/query/SourceQuery.php index 69f5685..bef4292 100644 --- a/system/library/games/query/SourceQuery.php +++ b/system/library/games/query/SourceQuery.php @@ -1,347 +1,347 @@ Socket = $Socket ?: new Socket(); - } - - public function __destruct() - { - $this->Disconnect(); - } - - public function Connect($Address, $Port, $Timeout = 3, $Engine = self::SOURCE) - { - $this->Disconnect(); - - if(!is_int($Timeout) || $Timeout < 0) - return false; - - $this->Socket->Open($Address, (int)$Port, $Timeout, (int)$Engine); - - $this->Connected = true; - } - - public function SetUseOldGetChallengeMethod($Value) - { - $Previous = $this->UseOldGetChallengeMethod; - - $this->UseOldGetChallengeMethod = $Value === true; - - return $Previous; - } - - public function Disconnect() - { - $this->Connected = false; - $this->Challenge = 0; - - $this->Socket->Close(); - - if($this->Rcon) - { - $this->Rcon->Close(); - - $this->Rcon = null; - } - } - - public function Ping() - { - if(!$this->Connected) - return false; - - $this->Socket->Write(self::A2S_PING); - $Buffer = $this->Socket->Read(); - - return $Buffer->GetByte() === self::S2A_PING; - } - - public function GetInfo() - { - if(!$this->Connected) - return false; - - $this->Socket->Write(self::A2S_INFO, "Source Engine Query\0"); - $Buffer = $this->Socket->Read(); - - $Type = $Buffer->GetByte(); - - if($Type === self::S2A_INFO_OLD && $this->Socket->Engine === self::GOLDSOURCE) - { - $Server['Address'] = $Buffer->GetString(); - $Server['HostName'] = $Buffer->GetString(); - $Server['Map'] = $Buffer->GetString(); - $Server['ModDir'] = $Buffer->GetString(); - $Server['ModDesc'] = $Buffer->GetString(); - $Server['Players'] = $Buffer->GetByte(); - $Server['MaxPlayers'] = $Buffer->GetByte(); - $Server['Protocol'] = $Buffer->GetByte(); - $Server['Dedicated'] = Chr($Buffer->GetByte()); - $Server['Os'] = Chr($Buffer->GetByte()); - $Server['Password'] = $Buffer->GetByte() === 1; - $Server['IsMod'] = $Buffer->GetByte() === 1; - - if($Server['IsMod']) - { - $Mod['Url'] = $Buffer->GetString(); - $Mod['Download'] = $Buffer->GetString(); - $Buffer->Get(1); - $Mod['Version'] = $Buffer->GetLong(); - $Mod['Size'] = $Buffer->GetLong(); - $Mod['ServerSide'] = $Buffer->GetByte() === 1; - $Mod['CustomDLL'] = $Buffer->GetByte() === 1; - } - - $Server['Secure'] = $Buffer->GetByte() === 1; - $Server['Bots'] = $Buffer->GetByte(); - - if(isset($Mod)) - $Server['Mod'] = $Mod; - - return $Server; - } - - if($Type !== self::S2A_INFO) - return false; - - if($Type !== self::S2A_INFO) - return false; - - $Server['Protocol'] = $Buffer->GetByte(); - $Server['HostName'] = $Buffer->GetString(); - $Server['Map'] = $Buffer->GetString(); - $Server['ModDir'] = $Buffer->GetString(); - $Server['ModDesc'] = $Buffer->GetString(); - $Server['AppID'] = $Buffer->GetShort(); - $Server['Players'] = $Buffer->GetByte(); - $Server['MaxPlayers'] = $Buffer->GetByte(); - $Server['Bots'] = $Buffer->GetByte(); - $Server['Dedicated'] = Chr($Buffer->GetByte()); - $Server['Os'] = Chr($Buffer->GetByte()); - $Server['Password'] = $Buffer->GetByte() === 1; - $Server['Secure'] = $Buffer->GetByte() === 1; - - if($Server['AppID'] === 2400) - { - $Server['GameMode'] = $Buffer->GetByte(); - $Server['WitnessCount'] = $Buffer->GetByte(); - $Server['WitnessTime'] = $Buffer->GetByte(); - } - - $Server['Version'] = $Buffer->GetString(); - - if($Buffer->Remaining() > 0) - { - $Server['ExtraDataFlags'] = $Flags = $Buffer->GetByte(); - - if($Flags & 0x80) - $Server['GamePort'] = $Buffer->GetShort(); - - if($Flags & 0x10) - { - $SteamIDLower = $Buffer->GetUnsignedLong(); - $SteamIDInstance = $Buffer->GetUnsignedLong(); - $SteamID = 0; - - if(PHP_INT_SIZE === 4) - { - if(extension_loaded('gmp')) - { - $SteamIDLower = gmp_abs($SteamIDLower); - $SteamIDInstance = gmp_abs($SteamIDInstance); - $SteamID = gmp_strval(gmp_or($SteamIDLower, gmp_mul($SteamIDInstance, gmp_pow(2, 32)))); - }else - return false; - }else - $SteamID = $SteamIDLower | ($SteamIDInstance << 32); - - $Server['SteamID'] = $SteamID; - - unset($SteamIDLower, $SteamIDInstance, $SteamID); - } - - if($Flags & 0x40) - { - $Server['SpecPort'] = $Buffer->GetShort(); - $Server['SpecName'] = $Buffer->GetString(); - } - - if($Flags & 0x20) - $Server['GameTags'] = $Buffer->GetString(); - - if($Flags & 0x01) - $Server['GameID'] = $Buffer->GetUnsignedLong() | ($Buffer->GetUnsignedLong() << 32); - - if($Buffer->Remaining() > 0) - return false; - } - - return $Server; - } - - public function GetPlayers() - { - if(!$this->Connected) - return false; - - $this->GetChallenge(self::A2S_PLAYER, self::S2A_PLAYER); - - $this->Socket->Write(self::A2S_PLAYER, $this->Challenge); - $Buffer = $this->Socket->Read(14000); - $Type = $Buffer->GetByte(); - - if($Type !== self::S2A_PLAYER) - return false; - - $Players = []; - $Count = $Buffer->GetByte(); - - while($Count-- > 0 && $Buffer->Remaining() > 0) - { - $Player['Id'] = $Buffer->GetByte(); - $Player['Name'] = $Buffer->GetString(); - $Player['Frags'] = $Buffer->GetLong(); - $Player['Time'] = (int)$Buffer->GetFloat(); - $Player['TimeF'] = GMDate(($Player['Time'] > 3600 ? "H:i:s" : "i:s"), $Player['Time']); - - $Players[] = $Player; - } - - return $Players; - } - - public function GetRules() - { - if(!$this->Connected) - return false; - - $this->GetChallenge(self::A2S_RULES, self::S2A_RULES); - $this->Socket->Write(self::A2S_RULES, $this->Challenge); - $Buffer = $this->Socket->Read(); - $Type = $Buffer->GetByte(); - - if($Type !== self::S2A_RULES) - return false; - - $Rules = []; - $Count = $Buffer->GetShort(); - - while($Count-- > 0 && $Buffer->Remaining() > 0) - { - $Rule = $Buffer->GetString(); - $Value = $Buffer->GetString(); - - if(!empty($Rule)) - $Rules[$Rule] = $Value; - } - - return $Rules; - } - - private function GetChallenge($Header, $ExpectedResult) - { - if($this->Challenge) - return; - - if($this->UseOldGetChallengeMethod) - $Header = self::A2S_SERVERQUERY_GETCHALLENGE; - - $this->Socket->Write($Header, "\xFF\xFF\xFF\xFF"); - $Buffer = $this->Socket->Read(); - $Type = $Buffer->GetByte(); - - switch($Type) - { - case self::S2A_CHALLENGE: - { - $this->Challenge = $Buffer->Get(4); - - return; - } - case $ExpectedResult: - { - return; - } - case 0: - { - return; - } - default: - { - return; - } - } - } - - public function SetRconPassword($Password) - { - if(!$this->Connected) - { - return false; - } - - switch($this->Socket->Engine) - { - case SourceQuery::GOLDSOURCE: - { - $this->Rcon = new GoldSourceRcon($this->Socket); - - break; - } - case SourceQuery::SOURCE: - { - $this->Rcon = new SourceRcon($this->Socket); - - break; - } - } - - $this->Rcon->Open(); - $this->Rcon->Authorize($Password); - } - - public function Rcon($Command) - { - if(!$this->Connected) - { - return false; - } - - if($this->Rcon === null) - { - return false; - } - - return $this->Rcon->Command($Command); - } - } \ No newline at end of file + if(!DEFINED('EGP')) + exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404')); + + class SourceQuery + { + const GOLDSOURCE = 0; + const SOURCE = 1; + const A2S_PING = 0x69; + const A2S_INFO = 0x54; + const A2S_PLAYER = 0x55; + const A2S_RULES = 0x56; + const A2S_SERVERQUERY_GETCHALLENGE = 0x57; + const S2A_PING = 0x6A; + const S2A_CHALLENGE = 0x41; + const S2A_INFO = 0x49; + const S2A_INFO_OLD = 0x6D; + const S2A_PLAYER = 0x44; + const S2A_RULES = 0x45; + const S2A_RCON = 0x6C; + const SERVERDATA_EXECCOMMAND = 2; + const SERVERDATA_AUTH = 3; + const SERVERDATA_RESPONSE_VALUE = 0; + const SERVERDATA_AUTH_RESPONSE = 2; + + private $Rcon; + private $Socket; + private $Connected; + private $Challenge; + private $UseOldGetChallengeMethod; + + public function __construct(BaseSocket $Socket = null) + { + $this->Socket = $Socket ?: new Socket(); + } + + public function __destruct() + { + $this->Disconnect(); + } + + public function Connect($Address, $Port, $Timeout = 3, $Engine = self::SOURCE) + { + $this->Disconnect(); + + if(!is_int($Timeout) || $Timeout < 0) + return false; + + $this->Socket->Open($Address, (int)$Port, $Timeout, (int)$Engine); + + $this->Connected = true; + } + + public function SetUseOldGetChallengeMethod($Value) + { + $Previous = $this->UseOldGetChallengeMethod; + + $this->UseOldGetChallengeMethod = $Value === true; + + return $Previous; + } + + public function Disconnect() + { + $this->Connected = false; + $this->Challenge = 0; + + $this->Socket->Close(); + + if($this->Rcon) + { + $this->Rcon->Close(); + + $this->Rcon = null; + } + } + + public function Ping() + { + if(!$this->Connected) + return false; + + $this->Socket->Write(self::A2S_PING); + $Buffer = $this->Socket->Read(); + + return $Buffer->GetByte() === self::S2A_PING; + } + + public function GetInfo() + { + if(!$this->Connected) + return false; + + $this->Socket->Write(self::A2S_INFO, "Source Engine Query\0"); + $Buffer = $this->Socket->Read(); + + $Type = $Buffer->GetByte(); + + if($Type === self::S2A_INFO_OLD && $this->Socket->Engine === self::GOLDSOURCE) + { + $Server['Address'] = $Buffer->GetString(); + $Server['HostName'] = $Buffer->GetString(); + $Server['Map'] = $Buffer->GetString(); + $Server['ModDir'] = $Buffer->GetString(); + $Server['ModDesc'] = $Buffer->GetString(); + $Server['Players'] = $Buffer->GetByte(); + $Server['MaxPlayers'] = $Buffer->GetByte(); + $Server['Protocol'] = $Buffer->GetByte(); + $Server['Dedicated'] = Chr($Buffer->GetByte()); + $Server['Os'] = Chr($Buffer->GetByte()); + $Server['Password'] = $Buffer->GetByte() === 1; + $Server['IsMod'] = $Buffer->GetByte() === 1; + + if($Server['IsMod']) + { + $Mod['Url'] = $Buffer->GetString(); + $Mod['Download'] = $Buffer->GetString(); + $Buffer->Get(1); + $Mod['Version'] = $Buffer->GetLong(); + $Mod['Size'] = $Buffer->GetLong(); + $Mod['ServerSide'] = $Buffer->GetByte() === 1; + $Mod['CustomDLL'] = $Buffer->GetByte() === 1; + } + + $Server['Secure'] = $Buffer->GetByte() === 1; + $Server['Bots'] = $Buffer->GetByte(); + + if(isset($Mod)) + $Server['Mod'] = $Mod; + + return $Server; + } + + if($Type !== self::S2A_INFO) + return false; + + if($Type !== self::S2A_INFO) + return false; + + $Server['Protocol'] = $Buffer->GetByte(); + $Server['HostName'] = $Buffer->GetString(); + $Server['Map'] = $Buffer->GetString(); + $Server['ModDir'] = $Buffer->GetString(); + $Server['ModDesc'] = $Buffer->GetString(); + $Server['AppID'] = $Buffer->GetShort(); + $Server['Players'] = $Buffer->GetByte(); + $Server['MaxPlayers'] = $Buffer->GetByte(); + $Server['Bots'] = $Buffer->GetByte(); + $Server['Dedicated'] = Chr($Buffer->GetByte()); + $Server['Os'] = Chr($Buffer->GetByte()); + $Server['Password'] = $Buffer->GetByte() === 1; + $Server['Secure'] = $Buffer->GetByte() === 1; + + if($Server['AppID'] === 2400) + { + $Server['GameMode'] = $Buffer->GetByte(); + $Server['WitnessCount'] = $Buffer->GetByte(); + $Server['WitnessTime'] = $Buffer->GetByte(); + } + + $Server['Version'] = $Buffer->GetString(); + + if($Buffer->Remaining() > 0) + { + $Server['ExtraDataFlags'] = $Flags = $Buffer->GetByte(); + + if($Flags & 0x80) + $Server['GamePort'] = $Buffer->GetShort(); + + if($Flags & 0x10) + { + $SteamIDLower = $Buffer->GetUnsignedLong(); + $SteamIDInstance = $Buffer->GetUnsignedLong(); + $SteamID = 0; + + if(PHP_INT_SIZE === 4) + { + if(extension_loaded('gmp')) + { + $SteamIDLower = gmp_abs($SteamIDLower); + $SteamIDInstance = gmp_abs($SteamIDInstance); + $SteamID = gmp_strval(gmp_or($SteamIDLower, gmp_mul($SteamIDInstance, gmp_pow(2, 32)))); + }else + return false; + }else + $SteamID = $SteamIDLower | ($SteamIDInstance << 32); + + $Server['SteamID'] = $SteamID; + + unset($SteamIDLower, $SteamIDInstance, $SteamID); + } + + if($Flags & 0x40) + { + $Server['SpecPort'] = $Buffer->GetShort(); + $Server['SpecName'] = $Buffer->GetString(); + } + + if($Flags & 0x20) + $Server['GameTags'] = $Buffer->GetString(); + + if($Flags & 0x01) + $Server['GameID'] = $Buffer->GetUnsignedLong() | ($Buffer->GetUnsignedLong() << 32); + + if($Buffer->Remaining() > 0) + return false; + } + + return $Server; + } + + public function GetPlayers() + { + if(!$this->Connected) + return false; + + $this->GetChallenge(self::A2S_PLAYER, self::S2A_PLAYER); + + $this->Socket->Write(self::A2S_PLAYER, $this->Challenge); + $Buffer = $this->Socket->Read(14000); + $Type = $Buffer->GetByte(); + + if($Type !== self::S2A_PLAYER) + return false; + + $Players = []; + $Count = $Buffer->GetByte(); + + while($Count-- > 0 && $Buffer->Remaining() > 0) + { + $Player['Id'] = $Buffer->GetByte(); + $Player['Name'] = $Buffer->GetString(); + $Player['Frags'] = $Buffer->GetLong(); + $Player['Time'] = (int)$Buffer->GetFloat(); + $Player['TimeF'] = GMDate(($Player['Time'] > 3600 ? "H:i:s" : "i:s"), $Player['Time']); + + $Players[] = $Player; + } + + return $Players; + } + + public function GetRules() + { + if(!$this->Connected) + return false; + + $this->GetChallenge(self::A2S_RULES, self::S2A_RULES); + $this->Socket->Write(self::A2S_RULES, $this->Challenge); + $Buffer = $this->Socket->Read(); + $Type = $Buffer->GetByte(); + + if($Type !== self::S2A_RULES) + return false; + + $Rules = []; + $Count = $Buffer->GetShort(); + + while($Count-- > 0 && $Buffer->Remaining() > 0) + { + $Rule = $Buffer->GetString(); + $Value = $Buffer->GetString(); + + if(!empty($Rule)) + $Rules[$Rule] = $Value; + } + + return $Rules; + } + + private function GetChallenge($Header, $ExpectedResult) + { + if($this->Challenge) + return; + + if($this->UseOldGetChallengeMethod) + $Header = self::A2S_SERVERQUERY_GETCHALLENGE; + + $this->Socket->Write($Header, "\xFF\xFF\xFF\xFF"); + $Buffer = $this->Socket->Read(); + $Type = $Buffer->GetByte(); + + switch($Type) + { + case self::S2A_CHALLENGE: + { + $this->Challenge = $Buffer->Get(4); + + return; + } + case $ExpectedResult: + { + return; + } + case 0: + { + return; + } + default: + { + return; + } + } + } + + public function SetRconPassword($Password) + { + if(!$this->Connected) + { + return false; + } + + switch($this->Socket->Engine) + { + case SourceQuery::GOLDSOURCE: + { + $this->Rcon = new GoldSourceRcon($this->Socket); + + break; + } + case SourceQuery::SOURCE: + { + $this->Rcon = new SourceRcon($this->Socket); + + break; + } + } + + $this->Rcon->Open(); + $this->Rcon->Authorize($Password); + } + + public function Rcon($Command) + { + if(!$this->Connected) + { + return false; + } + + if($this->Rcon === null) + { + return false; + } + + return $this->Rcon->Command($Command); + } + } \ No newline at end of file diff --git a/system/library/games/query/SourceRcon.php b/system/library/games/query/SourceRcon.php index 76ac507..378aaeb 100644 --- a/system/library/games/query/SourceRcon.php +++ b/system/library/games/query/SourceRcon.php @@ -1,148 +1,148 @@ Socket = $Socket; - } + public function __construct($Socket) + { + $this->Socket = $Socket; + } - public function Close() - { - if($this->RconSocket) - { - FClose($this->RconSocket); + public function Close() + { + if($this->RconSocket) + { + FClose($this->RconSocket); - $this->RconSocket = null; - } + $this->RconSocket = null; + } - $this->RconRequestId = 0; - } + $this->RconRequestId = 0; + } - public function Open() - { - if(!$this->RconSocket) - { - $this->RconSocket = @FSockOpen($this->Socket->Address, $this->Socket->Port, $ErrNo, $ErrStr, $this->Socket->Timeout); + public function Open() + { + if(!$this->RconSocket) + { + $this->RconSocket = @FSockOpen($this->Socket->Address, $this->Socket->Port, $ErrNo, $ErrStr, $this->Socket->Timeout); - if($ErrNo || !$this->RconSocket) - return false; + if($ErrNo || !$this->RconSocket) + return false; - Stream_Set_Timeout($this->RconSocket, $this->Socket->Timeout); - Stream_Set_Blocking($this->RconSocket, true); - } - } + Stream_Set_Timeout($this->RconSocket, $this->Socket->Timeout); + Stream_Set_Blocking($this->RconSocket, true); + } + } - public function Write($Header, $String = '') - { - $Command = Pack('VV', ++$this->RconRequestId, $Header) . $String . "\x00\x00"; - $Command = Pack('V', StrLen($Command)) . $Command; - $Length = StrLen($Command); + public function Write($Header, $String = '') + { + $Command = Pack('VV', ++$this->RconRequestId, $Header) . $String . "\x00\x00"; + $Command = Pack('V', StrLen($Command)) . $Command; + $Length = StrLen($Command); - return $Length === FWrite($this->RconSocket, $Command, $Length); - } + return $Length === FWrite($this->RconSocket, $Command, $Length); + } - public function Read() - { - $Buffer = new Buffer(); - $Buffer->Set(FRead($this->RconSocket, 4)); + public function Read() + { + $Buffer = new Buffer(); + $Buffer->Set(FRead($this->RconSocket, 4)); - if($Buffer->Remaining() < 4) - return false; + if($Buffer->Remaining() < 4) + return false; - $PacketSize = $Buffer->GetLong(); + $PacketSize = $Buffer->GetLong(); - $Buffer->Set(FRead($this->RconSocket, $PacketSize)); + $Buffer->Set(FRead($this->RconSocket, $PacketSize)); - $Data = $Buffer->Get(); + $Data = $Buffer->Get(); - $Remaining = $PacketSize - StrLen($Data); + $Remaining = $PacketSize - StrLen($Data); - while($Remaining > 0) - { - $Data2 = FRead($this->RconSocket, $Remaining); + while($Remaining > 0) + { + $Data2 = FRead($this->RconSocket, $Remaining); - $PacketSize = StrLen($Data2); + $PacketSize = StrLen($Data2); - if($PacketSize === 0) - return false; + if($PacketSize === 0) + return false; - $Data .= $Data2; - $Remaining -= $PacketSize; - } + $Data .= $Data2; + $Remaining -= $PacketSize; + } - $Buffer->Set($Data); + $Buffer->Set($Data); - return $Buffer; - } + return $Buffer; + } - public function Command($Command) - { - $this->Write(SourceQuery::SERVERDATA_EXECCOMMAND, $Command); - $Buffer = $this->Read(); + public function Command($Command) + { + $this->Write(SourceQuery::SERVERDATA_EXECCOMMAND, $Command); + $Buffer = $this->Read(); - $Buffer->GetLong(); + $Buffer->GetLong(); - $Type = $Buffer->GetLong(); + $Type = $Buffer->GetLong(); - if($Type === SourceQuery::SERVERDATA_AUTH_RESPONSE) - return false; + if($Type === SourceQuery::SERVERDATA_AUTH_RESPONSE) + return false; - if($Type !== SourceQuery::SERVERDATA_RESPONSE_VALUE) - return false; + if($Type !== SourceQuery::SERVERDATA_RESPONSE_VALUE) + return false; - $Data = $Buffer->Get(); + $Data = $Buffer->Get(); - if(StrLen($Data) >= 4000) - { - do - { - $this->Write(SourceQuery::SERVERDATA_RESPONSE_VALUE); + if(StrLen($Data) >= 4000) + { + do + { + $this->Write(SourceQuery::SERVERDATA_RESPONSE_VALUE); - $Buffer = $this->Read(); + $Buffer = $this->Read(); - $Buffer->GetLong(); + $Buffer->GetLong(); - if($Buffer->GetLong() !== SourceQuery::SERVERDATA_RESPONSE_VALUE) - break; + if($Buffer->GetLong() !== SourceQuery::SERVERDATA_RESPONSE_VALUE) + break; - $Data2 = $Buffer->Get(); + $Data2 = $Buffer->Get(); - if($Data2 === "\x00\x01\x00\x00\x00\x00") - break; + if($Data2 === "\x00\x01\x00\x00\x00\x00") + break; - $Data .= $Data2; - } + $Data .= $Data2; + } - while(true); - } + while(true); + } - return rtrim($Data, "\0"); - } + return rtrim($Data, "\0"); + } - public function Authorize($Password) - { - $this->Write(SourceQuery::SERVERDATA_AUTH, $Password); - $Buffer = $this->Read(); + public function Authorize($Password) + { + $this->Write(SourceQuery::SERVERDATA_AUTH, $Password); + $Buffer = $this->Read(); - $RequestID = $Buffer->GetLong(); - $Type = $Buffer->GetLong(); + $RequestID = $Buffer->GetLong(); + $Type = $Buffer->GetLong(); - if($Type === SourceQuery::SERVERDATA_RESPONSE_VALUE) - { - $Buffer = $this->Read(); + if($Type === SourceQuery::SERVERDATA_RESPONSE_VALUE) + { + $Buffer = $this->Read(); - $RequestID = $Buffer->GetLong(); - $Type = $Buffer->GetLong(); - } + $RequestID = $Buffer->GetLong(); + $Type = $Buffer->GetLong(); + } - if($RequestID === -1 || $Type !== SourceQuery::SERVERDATA_AUTH_RESPONSE) - return false; - } - } \ No newline at end of file + if($RequestID === -1 || $Type !== SourceQuery::SERVERDATA_AUTH_RESPONSE) + return false; + } + } \ No newline at end of file diff --git a/system/library/games/samp/action.php b/system/library/games/samp/action.php index 6d96f64..6a327b4 100644 --- a/system/library/games/samp/action.php +++ b/system/library/games/samp/action.php @@ -1,129 +1,129 @@ query('SELECT `uid`, `unit`, `tarif`, `game`, `address`, `slots_start`, `name`, `map_start`, `time_start`, `core_fix` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `uid`, `unit`, `tarif`, `game`, `address`, `slots_start`, `name`, `map_start`, `time_start`, `core_fix` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - $sql->query('SELECT `install` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); + $sql->query('SELECT `install` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); $tarif = $sql->get(); - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); - // Проверка ssh соедниения пу с локацией - if(!$ssh->auth($unit['passwd'], $unit['address'])) - return array('e' => sys::text('error', 'ssh')); + // Проверка ssh соедниения пу с локацией + if(!$ssh->auth($unit['passwd'], $unit['address'])) + return array('e' => sys::text('error', 'ssh')); - list($ip, $port) = explode(':', $server['address']); + list($ip, $port) = explode(':', $server['address']); - // Убить процессы - $ssh->set('kill -9 `ps aux | grep s_'.$server['uid'].' | grep -v grep | awk '."'{print $2}'".' | xargs;' - .'lsof -i@'.$server['address'].' | awk '."'{print $2}'".' | grep -v PID | xargs`; sudo -u server'.$server['uid'].' screen -wipe;'); + // Убить процессы + $ssh->set('kill -9 `ps aux | grep s_'.$server['uid'].' | grep -v grep | awk '."'{print $2}'".' | xargs;' + .'lsof -i@'.$server['address'].' | awk '."'{print $2}'".' | grep -v PID | xargs`; sudo -u server'.$server['uid'].' screen -wipe;'); - // Временный файл - $temp = sys::temp(action::config($ip, $port, $server['slots_start'], $ssh->get('cat '.$tarif['install'].'/'.$server['uid'].'/server.cfg'))); + // Временный файл + $temp = sys::temp(action::config($ip, $port, $server['slots_start'], $ssh->get('cat '.$tarif['install'].'/'.$server['uid'].'/server.cfg'))); - // Обновление файла server.cfg - $ssh->setfile($temp, $tarif['install'].$server['uid'].'/server.cfg', 0644); + // Обновление файла server.cfg + $ssh->setfile($temp, $tarif['install'].$server['uid'].'/server.cfg', 0644); - unlink($temp); + unlink($temp); - $taskset = ''; + $taskset = ''; - // Если включена система автораспределения и не установлен фиксированный поток - if($cfg['cpu_route'] AND !$server['core_fix']) - { - $proc_stat = array(); + // Если включена система автораспределения и не установлен фиксированный поток + if($cfg['cpu_route'] AND !$server['core_fix']) + { + $proc_stat = array(); - $proc_stat[0] = $ssh->get('cat /proc/stat'); - } + $proc_stat[0] = $ssh->get('cat /proc/stat'); + } - // Если система автораспределения продолжить парсинг загрузки процессора - if(isset($proc_stat)) - { - $proc_stat[1] = $ssh->get('cat /proc/stat'); + // Если система автораспределения продолжить парсинг загрузки процессора + if(isset($proc_stat)) + { + $proc_stat[1] = $ssh->get('cat /proc/stat'); - // Ядро/поток, на котором будет запущен игровой сервер (поток выбран с рассчетом наименьшей загруженности в момент запуска игрового сервера) - $core = sys::cpu_idle($proc_stat, $server['unit'], false); // число от 1 до n (где n число ядер/потоков в процессоре (без нулевого) + // Ядро/поток, на котором будет запущен игровой сервер (поток выбран с рассчетом наименьшей загруженности в момент запуска игрового сервера) + $core = sys::cpu_idle($proc_stat, $server['unit'], false); // число от 1 до n (где n число ядер/потоков в процессоре (без нулевого) - if(!is_numeric($core)) - return array('e' => sys::text('error', 'cpu')); + if(!is_numeric($core)) + return array('e' => sys::text('error', 'cpu')); - $taskset = 'taskset -c '.$core; - } + $taskset = 'taskset -c '.$core; + } - if($server['core_fix']) - { - $core = $server['core_fix']-1; - $taskset = 'taskset -c '.$core; - } + if($server['core_fix']) + { + $core = $server['core_fix']-1; + $taskset = 'taskset -c '.$core; + } - // Параметры запуска - $bash = './samp03svr'; + // Параметры запуска + $bash = './samp03svr'; - // Временный файл - $temp = sys::temp($bash); + // Временный файл + $temp = sys::temp($bash); - // Обновление файла start.sh - $ssh->setfile($temp, $tarif['install'].$server['uid'].'/start.sh', 0500); + // Обновление файла start.sh + $ssh->setfile($temp, $tarif['install'].$server['uid'].'/start.sh', 0500); - // Строка запуска - $ssh->set('cd '.$tarif['install'].$server['uid'].';' // переход в директорию игрового сервера - .'rm *.pid;' // Удаление *.pid файлов - .'sudo -u server'.$server['uid'].' mkdir -p oldstart;' // Создание папки логов - .'cat server_log.txt >> oldstart/'.date('d.m.Y_H:i:s', $server['time_start']).'.log; rm server_log.txt; rm oldstart/01.01.1970_03:00:00.log;' // Перемещение лога предыдущего запуска - .'chown server'.$server['uid'].':1000 server.cfg start.sh;' // Обновление владельца файлов - .'sudo -u server'.$server['uid'].' screen -dmS s_'.$server['uid'].' '.$taskset.' sh -c "./start.sh"'); // Запуск игровго сервера + // Строка запуска + $ssh->set('cd '.$tarif['install'].$server['uid'].';' // переход в директорию игрового сервера + .'rm *.pid;' // Удаление *.pid файлов + .'sudo -u server'.$server['uid'].' mkdir -p oldstart;' // Создание папки логов + .'cat server_log.txt >> oldstart/'.date('d.m.Y_H:i:s', $server['time_start']).'.log; rm server_log.txt; rm oldstart/01.01.1970_03:00:00.log;' // Перемещение лога предыдущего запуска + .'chown server'.$server['uid'].':1000 server.cfg start.sh;' // Обновление владельца файлов + .'sudo -u server'.$server['uid'].' screen -dmS s_'.$server['uid'].' '.$taskset.' sh -c "./start.sh"'); // Запуск игровго сервера - $core = !isset($core) ? 0 : $core+1; + $core = !isset($core) ? 0 : $core+1; - // Обновление информации в базе - $sql->query('UPDATE `servers` set `status`="'.$type.'", `online`="0", `players`="", `core_use`="'.$core.'", `time_start`="'.$start_point.'", `stop`="1" WHERE `id`="'.$id.'" LIMIT 1'); + // Обновление информации в базе + $sql->query('UPDATE `servers` set `status`="'.$type.'", `online`="0", `players`="", `core_use`="'.$core.'", `time_start`="'.$start_point.'", `stop`="1" WHERE `id`="'.$id.'" LIMIT 1'); - unlink($temp); + unlink($temp); - // Сброс кеша - actions::clmcache($id); + // Сброс кеша + actions::clmcache($id); - sys::reset_mcache('server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => $type, 'online' => 0, 'players' => '')); - sys::reset_mcache('server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => $type, 'online' => 0)); + sys::reset_mcache('server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => $type, 'online' => 0, 'players' => '')); + sys::reset_mcache('server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => $type, 'online' => 0)); - return array('s' => 'ok'); - } + return array('s' => 'ok'); + } - public static function config($ip, $port, $slots, $config) - { - $aLine = explode("\n", $config); + public static function config($ip, $port, $slots, $config) + { + $aLine = explode("\n", $config); - $eConfig = ''; + $eConfig = ''; - foreach($aLine as $line) - { - $param = explode(' ', trim($line)); + foreach($aLine as $line) + { + $param = explode(' ', trim($line)); - if(in_array(trim($param[0]), array('bind', 'port', 'maxplayers', 'query'))) - continue; + if(in_array(trim($param[0]), array('bind', 'port', 'maxplayers', 'query'))) + continue; - $eConfig .= $line.PHP_EOL; - } + $eConfig .= $line.PHP_EOL; + } - $eConfig .= 'bind '.$ip.PHP_EOL - .'port '.$port.PHP_EOL - .'maxplayers '.$slots.PHP_EOL - .'query 1'; + $eConfig .= 'bind '.$ip.PHP_EOL + .'port '.$port.PHP_EOL + .'maxplayers '.$slots.PHP_EOL + .'query 1'; - return $eConfig; - } + return $eConfig; + } } ?> \ No newline at end of file diff --git a/system/library/games/samp/scan.php b/system/library/games/samp/scan.php index 36cac68..1f15542 100644 --- a/system/library/games/samp/scan.php +++ b/system/library/games/samp/scan.php @@ -1,114 +1,114 @@ query('SELECT `address`, `game`, `name`, `map`, `online`, `players`, `status`, `time`, `overdue` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `address`, `game`, `name`, `map`, `online`, `players`, `status`, `time`, `overdue` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - list($ip, $port) = explode(':', $server['address']); + list($ip, $port) = explode(':', $server['address']); - include(LIB.'games/query/SampQuery.php'); + include(LIB.'games/query/SampQuery.php'); - $sq = new SampQuery($ip, $port); + $sq = new SampQuery($ip, $port); - if($players_get) - $nmch = 'server_scan_mon_pl_'.$id; - else - $nmch = 'server_scan_mon_'.$id; + if($players_get) + $nmch = 'server_scan_mon_pl_'.$id; + else + $nmch = 'server_scan_mon_'.$id; - if(is_array($mcache->get($nmch))) - return $mcache->get($nmch); + if(is_array($mcache->get($nmch))) + return $mcache->get($nmch); - $out = array(); + $out = array(); - $out['time'] = 'Арендован до: '.date('d.m.Y - H:i', $server['time']); + $out['time'] = 'Арендован до: '.date('d.m.Y - H:i', $server['time']); - if($server['status'] == 'overdue') - $out['time_end'] = 'Удаление через: '.sys::date('min', $server['overdue']+$cfg['server_delete']*86400); - else - $out['time_end'] = 'Осталось: '.sys::date('min', $server['time']); + if($server['status'] == 'overdue') + $out['time_end'] = 'Удаление через: '.sys::date('min', $server['overdue']+$cfg['server_delete']*86400); + else + $out['time_end'] = 'Осталось: '.sys::date('min', $server['time']); - if(!$sq->connect()) - { - $out['name'] = $server['name']; - $out['status'] = sys::status($server['status'], $server['game'], $server['map']); - $out['online'] = $server['online']; - $out['image'] = ''; - $out['buttons'] = sys::buttons($id, $server['status'], $server['game']); + if(!$sq->connect()) + { + $out['name'] = $server['name']; + $out['status'] = sys::status($server['status'], $server['game'], $server['map']); + $out['online'] = $server['online']; + $out['image'] = ''; + $out['buttons'] = sys::buttons($id, $server['status'], $server['game']); - if($players_get) - $out['players'] = base64_decode($server['players']); + if($players_get) + $out['players'] = base64_decode($server['players']); - $mcache->set($nmch, $out, false, $cfg['mcache_server_mon']); + $mcache->set($nmch, $out, false, $cfg['mcache_server_mon']); - return $out; - } + return $out; + } - $info = $sq->getInfo(); + $info = $sq->getInfo(); - if($players_get) - $players = scan::players($sq->getDetailedPlayers()); + if($players_get) + $players = scan::players($sq->getDetailedPlayers()); - $info['map'] = htmlspecialchars(mb_convert_encoding($info['map'], 'UTF-8', 'WINDOWS-1251')); - $out['name'] = htmlspecialchars(mb_convert_encoding($info['hostname'], 'UTF-8', 'WINDOWS-1251')); - $out['status'] = sys::status('working', $server['game'], $info['map']); - $out['online'] = sys::int($info['players']); - $out['image'] = ''; - $out['buttons'] = sys::buttons($id, 'working', $server['game']); - $out['players'] = ''; + $info['map'] = htmlspecialchars(mb_convert_encoding($info['map'], 'UTF-8', 'WINDOWS-1251')); + $out['name'] = htmlspecialchars(mb_convert_encoding($info['hostname'], 'UTF-8', 'WINDOWS-1251')); + $out['status'] = sys::status('working', $server['game'], $info['map']); + $out['online'] = sys::int($info['players']); + $out['image'] = ''; + $out['buttons'] = sys::buttons($id, 'working', $server['game']); + $out['players'] = ''; - if($players_get) - { - foreach($players as $index => $player) - { - $html->get($server['game'], 'sections/servers/players'); + if($players_get) + { + foreach($players as $index => $player) + { + $html->get($server['game'], 'sections/servers/players'); - $html->set('i', $player['i']); - $html->set('name', htmlspecialchars($player['name'])); + $html->set('i', $player['i']); + $html->set('name', htmlspecialchars($player['name'])); - $html->pack('list'); - } + $html->pack('list'); + } - $out['players'] = isset($html->arr['list']) ? $html->arr['list'] : ''; - } + $out['players'] = isset($html->arr['list']) ? $html->arr['list'] : ''; + } - $sql->query('UPDATE `servers` set ' - .'`name`="'.$out['name'].'", ' - .'`online`="'.$out['online'].'", ' - .'`map`="'.$info['map'].'", ' - .'`status`="working" WHERE `id`="'.$id.'" LIMIT 1'); + $sql->query('UPDATE `servers` set ' + .'`name`="'.$out['name'].'", ' + .'`online`="'.$out['online'].'", ' + .'`map`="'.$info['map'].'", ' + .'`status`="working" WHERE `id`="'.$id.'" LIMIT 1'); - if($players_get) - $sql->query('UPDATE `servers` set `players`="'.base64_encode($out['players']).'" WHERE `id`="'.$id.'" LIMIT 1'); + if($players_get) + $sql->query('UPDATE `servers` set `players`="'.base64_encode($out['players']).'" WHERE `id`="'.$id.'" LIMIT 1'); - $mcache->set($nmch, $out, false, $cfg['mcache_server_mon']); + $mcache->set($nmch, $out, false, $cfg['mcache_server_mon']); - return $out; - } + return $out; + } - public static function players($aPlayrs) - { - $i = 1; - $aData = array(); + public static function players($aPlayrs) + { + $i = 1; + $aData = array(); - foreach($aPlayrs as $n => $player) - { - $aData[$i]['i'] = $i; - $aData[$i]['name'] = $player['nickname'] == '' ? 'Подключается' : htmlspecialchars($player['nickname']); - $aData[$i]['ping'] = sys::int($player['ping']); + foreach($aPlayrs as $n => $player) + { + $aData[$i]['i'] = $i; + $aData[$i]['name'] = $player['nickname'] == '' ? 'Подключается' : htmlspecialchars($player['nickname']); + $aData[$i]['ping'] = sys::int($player['ping']); - $i+=1; - } + $i+=1; + } - return $aData; - } - } + return $aData; + } + } ?> \ No newline at end of file diff --git a/system/library/games/samp/service.php b/system/library/games/samp/service.php index 0d45d60..5bcb0d9 100644 --- a/system/library/games/samp/service.php +++ b/system/library/games/samp/service.php @@ -1,355 +1,355 @@ query('SELECT `address`, `test` FROM `units` WHERE `id`="'.$aData['unit'].'" AND `samp`="1" AND `show`="1" LIMIT 1'); - if(!$sql->num()) - sys::outjs(array('e' => 'Локация не найдена.')); + // Проверка локации + $sql->query('SELECT `address`, `test` FROM `units` WHERE `id`="'.$aData['unit'].'" AND `samp`="1" AND `show`="1" LIMIT 1'); + if(!$sql->num()) + sys::outjs(array('e' => 'Локация не найдена.')); - $unit = $sql->get(); + $unit = $sql->get(); - // Проверка тарифа - $sql->query('SELECT `id` FROM `tarifs` WHERE `id`="'.$aData['tarif'].'" AND `unit`="'.$aData['unit'].'" AND `show`="1" LIMIT 1'); - if(!$sql->num()) - sys::outjs(array('e' => 'Тариф не найден.')); + // Проверка тарифа + $sql->query('SELECT `id` FROM `tarifs` WHERE `id`="'.$aData['tarif'].'" AND `unit`="'.$aData['unit'].'" AND `show`="1" LIMIT 1'); + if(!$sql->num()) + sys::outjs(array('e' => 'Тариф не найден.')); - $sql->query('SELECT ' - .'`slots_min`,' - .'`slots_max`,' - .'`port_min`,' - .'`port_max`,' - .'`hostname`,' - .'`packs`,' - .'`time`,' - .'`test`,' - .'`tests`,' - .'`discount`,' - .'`ftp`,' - .'`plugins`,' - .'`console`,' - .'`stats`,' - .'`copy`,' - .'`web`,' - .'`plugins_install`,' - .'`hdd`,' - .'`autostop`,' - .'`core_fix`,' - .'`ip`,' - .'`price`' - .' FROM `tarifs` WHERE `id`="'.$aData['tarif'].'" LIMIT 1'); + $sql->query('SELECT ' + .'`slots_min`,' + .'`slots_max`,' + .'`port_min`,' + .'`port_max`,' + .'`hostname`,' + .'`packs`,' + .'`time`,' + .'`test`,' + .'`tests`,' + .'`discount`,' + .'`ftp`,' + .'`plugins`,' + .'`console`,' + .'`stats`,' + .'`copy`,' + .'`web`,' + .'`plugins_install`,' + .'`hdd`,' + .'`autostop`,' + .'`core_fix`,' + .'`ip`,' + .'`price`' + .' FROM `tarifs` WHERE `id`="'.$aData['tarif'].'" LIMIT 1'); - $tarif = $sql->get(); + $tarif = $sql->get(); - // Проверка сборки - if(!array_key_exists($aData['pack'], sys::b64djs($tarif['packs'], true))) - sys::outjs(array('e' => 'Сборка не найдена.')); + // Проверка сборки + if(!array_key_exists($aData['pack'], sys::b64djs($tarif['packs'], true))) + sys::outjs(array('e' => 'Сборка не найдена.')); - $test = 0; + $test = 0; - // Проверка периода на тест - if($aData['test']) - { - if(!$tarif['test'] || !$unit['test']) - sys::outjs(array('e' => 'Тестовый период недоступен.')); - + // Проверка периода на тест + if($aData['test']) + { + if(!$tarif['test'] || !$unit['test']) + sys::outjs(array('e' => 'Тестовый период недоступен.')); + - // Проверка на повторный запрос - $sql->query('SELECT `id`, `game` FROM `tests` WHERE `user`="'.$user['id'].'" LIMIT 1'); - if($sql->num()) - { - $test_info = $sql->get(); + // Проверка на повторный запрос + $sql->query('SELECT `id`, `game` FROM `tests` WHERE `user`="'.$user['id'].'" LIMIT 1'); + if($sql->num()) + { + $test_info = $sql->get(); - if(!$cfg['tests']['game'] || $test_info['game'] == 'samp') - sys::outjs(array('e' => 'Тестовый период предоставляется один раз.')); + if(!$cfg['tests']['game'] || $test_info['game'] == 'samp') + sys::outjs(array('e' => 'Тестовый период предоставляется один раз.')); - $sql->query('SELECT `id` FROM `servers` WHERE `user`="'.$user['id'].'" AND `test`="1" LIMIT 1'); - if($sql->num() AND !$cfg['tests']['sametime']) - sys::outjs(array('e' => 'Чтобы получить тестовый период другой игры, дождитесь окончания текущего.')); - } + $sql->query('SELECT `id` FROM `servers` WHERE `user`="'.$user['id'].'" AND `test`="1" LIMIT 1'); + if($sql->num() AND !$cfg['tests']['sametime']) + sys::outjs(array('e' => 'Чтобы получить тестовый период другой игры, дождитесь окончания текущего.')); + } - // Проверка наличия мест на локации - $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND `test`="1" AND `time`>"'.$start_point.'" LIMIT '.$unit['test']); - if($sql->num() == $unit['test']) - sys::outjs(array('e' => 'Свободного места для тестового периода нет.')); + // Проверка наличия мест на локации + $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND `test`="1" AND `time`>"'.$start_point.'" LIMIT '.$unit['test']); + if($sql->num() == $unit['test']) + sys::outjs(array('e' => 'Свободного места для тестового периода нет.')); - // Проверка наличия мест для выбранного тарифа - $sql->query('SELECT `id` FROM `servers` WHERE `tarif`="'.$aData['tarif'].'" AND `test`="1" AND `time`>"'.$start_point.'" LIMIT '.$tarif['tests']); - if($sql->num() == $tarif['tests']) - sys::outjs(array('e' => 'Свободного места для тестового периода выбранного тарифа нет.')); + // Проверка наличия мест для выбранного тарифа + $sql->query('SELECT `id` FROM `servers` WHERE `tarif`="'.$aData['tarif'].'" AND `test`="1" AND `time`>"'.$start_point.'" LIMIT '.$tarif['tests']); + if($sql->num() == $tarif['tests']) + sys::outjs(array('e' => 'Свободного места для тестового периода выбранного тарифа нет.')); - $test = 1; - }else - // Проверка периода - if(!$cfg['settlement_period'] AND !in_array($aData['time'], explode(':', $tarif['time']))) - sys::outjs(array('e' => 'Переданные данные периода неверны.')); + $test = 1; + }else + // Проверка периода + if(!$cfg['settlement_period'] AND !in_array($aData['time'], explode(':', $tarif['time']))) + sys::outjs(array('e' => 'Переданные данные периода неверны.')); - // Проверка слот - if($aData['slots'] < $tarif['slots_min'] || $aData['slots'] > $tarif['slots_max']) - sys::outjs(array('e' => 'Переданные данные слот неверны.')); + // Проверка слот + if($aData['slots'] < $tarif['slots_min'] || $aData['slots'] > $tarif['slots_max']) + sys::outjs(array('e' => 'Переданные данные слот неверны.')); - // Определение суммы - if($cfg['settlement_period']) - { - // Цена аренды за расчетный период - $sum = games::define_sum($tarif['discount'], $tarif['price'], $aData['slots'], $start_point); + // Определение суммы + if($cfg['settlement_period']) + { + // Цена аренды за расчетный период + $sum = games::define_sum($tarif['discount'], $tarif['price'], $aData['slots'], $start_point); - $aData['time'] = games::define_period('buy', params::$aDayMonth); - }else - $sum = games::define_sum($tarif['discount'], $tarif['price'], $aData['slots'], $aData['time']); + $aData['time'] = games::define_period('buy', params::$aDayMonth); + }else + $sum = games::define_sum($tarif['discount'], $tarif['price'], $aData['slots'], $aData['time']); - // Проверка промо-кода - $promo = games::define_promo( - $aData['promo'], - array( - 'tarif' => $aData['tarif'], - 'slots' => $aData['slots'], - 'time' => $aData['time'], - 'user' => $user['id'] - ), - $tarif['discount'], - $sum - ); + // Проверка промо-кода + $promo = games::define_promo( + $aData['promo'], + array( + 'tarif' => $aData['tarif'], + 'slots' => $aData['slots'], + 'time' => $aData['time'], + 'user' => $user['id'] + ), + $tarif['discount'], + $sum + ); - $days = $aData['time']; // Кол-во дней аренды + $days = $aData['time']; // Кол-во дней аренды - // Использование промо-кода - if(is_array($promo)) - { - if(array_key_exists('sum', $promo)) - $sum = $promo['sum']; - else - $days += $promo['days']; // Кол-во дней аренды с учетом подарочных (промо-код) - } + // Использование промо-кода + if(is_array($promo)) + { + if(array_key_exists('sum', $promo)) + $sum = $promo['sum']; + else + $days += $promo['days']; // Кол-во дней аренды с учетом подарочных (промо-код) + } - // Проверка баланса - if($user['balance'] < $sum) - sys::outjs(array('e' => 'У вас не хватает '.(round($sum-$user['balance'], 2)).' '.$cfg['currency'])); + // Проверка баланса + if($user['balance'] < $sum) + sys::outjs(array('e' => 'У вас не хватает '.(round($sum-$user['balance'], 2)).' '.$cfg['currency'])); - // Выделенный адрес игрового сервера - if(!empty($tarif['ip'])) - { - $aIp = explode(':', $tarif['ip']); + // Выделенный адрес игрового сервера + if(!empty($tarif['ip'])) + { + $aIp = explode(':', $tarif['ip']); - $ip = false; - $port = params::$aDefPort['samp']; + $ip = false; + $port = params::$aDefPort['samp']; - // Проверка наличия свободного адреса - foreach($aIp as $adr) - { - $adr = trim($adr); + // Проверка наличия свободного адреса + foreach($aIp as $adr) + { + $adr = trim($adr); - $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND `address` LIKE "'.$adr.':%" LIMIT 1'); - if(!$sql->num()) - { - $ip = $adr; + $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND `address` LIKE "'.$adr.':%" LIMIT 1'); + if(!$sql->num()) + { + $ip = $adr; - break; - } - } - }else{ - $ip = sys::first(explode(':', $unit['address'])); - $port = false; + break; + } + } + }else{ + $ip = sys::first(explode(':', $unit['address'])); + $port = false; - // Проверка наличия свободного порта - for($tarif['port_min']; $tarif['port_min'] <= $tarif['port_max']; $tarif['port_min']+=1) - { - $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND (`address`="'.$ip.':'.$tarif['port_min'].'" OR `port`="'.$tarif['port_min'].'") LIMIT 1'); - if(!$sql->num()) - { - $port = $tarif['port_min']; + // Проверка наличия свободного порта + for($tarif['port_min']; $tarif['port_min'] <= $tarif['port_max']; $tarif['port_min']+=1) + { + $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND (`address`="'.$ip.':'.$tarif['port_min'].'" OR `port`="'.$tarif['port_min'].'") LIMIT 1'); + if(!$sql->num()) + { + $port = $tarif['port_min']; - break; - } - } - } + break; + } + } + } - if(!$ip || !$port) - { - $sql->query('UPDATE `tarifs` set `show`="0" WHERE `id`="'.$aData['tarif'].'" LIMIT 1'); + if(!$ip || !$port) + { + $sql->query('UPDATE `tarifs` set `show`="0" WHERE `id`="'.$aData['tarif'].'" LIMIT 1'); - sys::outjs(array('e' => 'К сожалению нет доступных мест, обратитесь в тех.поддержку.')); - } + sys::outjs(array('e' => 'К сожалению нет доступных мест, обратитесь в тех.поддержку.')); + } - if($test) - $aData['time'] = games::time($start_point, $tarif['test']); - else - $aData['time'] = games::time($start_point, $days); + if($test) + $aData['time'] = games::time($start_point, $tarif['test']); + else + $aData['time'] = games::time($start_point, $days); - $fix_one = 0; - $core = 0; + $fix_one = 0; + $core = 0; - if($tarif['core_fix'] != '') - { - $aCore = explode(',', $tarif['core_fix']); + if($tarif['core_fix'] != '') + { + $aCore = explode(',', $tarif['core_fix']); - foreach($aCore as $cpu) - { - $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND `tarif`="'.$aData['tarif'].'" AND `core_fix`="'.$cpu.'" AND `core_fix_one`="1" LIMIT 1'); + foreach($aCore as $cpu) + { + $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$aData['unit'].'" AND `tarif`="'.$aData['tarif'].'" AND `core_fix`="'.$cpu.'" AND `core_fix_one`="1" LIMIT 1'); - if($sql->num()) - continue; + if($sql->num()) + continue; - $fix_one = 1; - $core = $cpu; + $fix_one = 1; + $core = $cpu; - break; - } + break; + } - if(!$core) - { - $sql->query('UPDATE `tarifs` set `show`="0" WHERE `id`="'.$aData['tarif'].'" LIMIT 1'); + if(!$core) + { + $sql->query('UPDATE `tarifs` set `show`="0" WHERE `id`="'.$aData['tarif'].'" LIMIT 1'); - sys::outjs(array('e' => 'К сожалению нет доступных мест, обратитесь в тех.поддержку.')); - } - } + sys::outjs(array('e' => 'К сожалению нет доступных мест, обратитесь в тех.поддержку.')); + } + } - $ram = $tarif['param_fix'] ? $aData['ram'] : $cfg['ram']['samp']*$aSDATA['slots']; + $ram = $tarif['param_fix'] ? $aData['ram'] : $cfg['ram']['samp']*$aSDATA['slots']; - // Массив данных - $aSDATA = array( - 'unit' => $aData['unit'], // идентификатор локации - 'tarif' => $aData['tarif'], // идентификатор тарифа - 'ram' => $ram, // значение ram - 'param_fix' => $tarif['param_fix'], // фиксированные параметры - 'pack' => $aData['pack'], // Выбранная сборка для установки - 'time' => $aData['time'], // Время аренды - 'days' => $days, // Число дней - 'sum' => $sum, // Сумма списания - 'test' => $test, // тестовый период - 'address' => $ip.':'.$port, // адрес игрового сервера - 'port' => $port, // порт игрового сервера - 'slots' => $aData['slots'], // Кол-во слот - 'autostop' => $tarif['autostop'], // Выключение при 0 онлайне - 'ftp' => $tarif['ftp'], // Использование ftp - 'plugins' => $tarif['plugins'], // Использование плагинов - 'console' => $tarif['console'], // Использование консоли - 'stats' => $tarif['stats'], // Использование графиков (ведение статистики) - 'copy' => $tarif['copy'], // Использование резервных копий - 'web' => $tarif['web'], // Использование доп услуг - 'plugins_install' => $tarif['plugins_install'], // Список установленных плагинов - 'hdd' => $tarif['hdd'], // Дисковое пространство - 'core_fix' => $core, // Выделенный поток - 'core_fix_one' => $fix_one, // Выделенный поток - 'promo' => $promo // Использование промо-кода - ); + // Массив данных + $aSDATA = array( + 'unit' => $aData['unit'], // идентификатор локации + 'tarif' => $aData['tarif'], // идентификатор тарифа + 'ram' => $ram, // значение ram + 'param_fix' => $tarif['param_fix'], // фиксированные параметры + 'pack' => $aData['pack'], // Выбранная сборка для установки + 'time' => $aData['time'], // Время аренды + 'days' => $days, // Число дней + 'sum' => $sum, // Сумма списания + 'test' => $test, // тестовый период + 'address' => $ip.':'.$port, // адрес игрового сервера + 'port' => $port, // порт игрового сервера + 'slots' => $aData['slots'], // Кол-во слот + 'autostop' => $tarif['autostop'], // Выключение при 0 онлайне + 'ftp' => $tarif['ftp'], // Использование ftp + 'plugins' => $tarif['plugins'], // Использование плагинов + 'console' => $tarif['console'], // Использование консоли + 'stats' => $tarif['stats'], // Использование графиков (ведение статистики) + 'copy' => $tarif['copy'], // Использование резервных копий + 'web' => $tarif['web'], // Использование доп услуг + 'plugins_install' => $tarif['plugins_install'], // Список установленных плагинов + 'hdd' => $tarif['hdd'], // Дисковое пространство + 'core_fix' => $core, // Выделенный поток + 'core_fix_one' => $fix_one, // Выделенный поток + 'promo' => $promo // Использование промо-кода + ); - return $aSDATA; - } + return $aSDATA; + } - public static function install($aSDATA = array()) - { - global $cfg, $sql, $user, $start_point; + public static function install($aSDATA = array()) + { + global $cfg, $sql, $user, $start_point; - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - // Массив данных локации (адрес,пароль) - $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$aSDATA['unit'].'" LIMIT 1'); - $unit = $sql->get(); + // Массив данных локации (адрес,пароль) + $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$aSDATA['unit'].'" LIMIT 1'); + $unit = $sql->get(); - // Проверка ssh соединения с локацией - if(!$ssh->auth($unit['passwd'], $unit['address'])) - sys::outjs(array('e' => sys::text('error', 'ssh'))); + // Проверка ssh соединения с локацией + if(!$ssh->auth($unit['passwd'], $unit['address'])) + sys::outjs(array('e' => sys::text('error', 'ssh'))); - // Массив данных тарифа (путь сборки,путь установки) - $sql->query('SELECT `path`, `install`, `hostname` FROM `tarifs` WHERE `id`="'.$aSDATA['tarif'].'" LIMIT 1'); - $tarif = $sql->get(); + // Массив данных тарифа (путь сборки,путь установки) + $sql->query('SELECT `path`, `install`, `hostname` FROM `tarifs` WHERE `id`="'.$aSDATA['tarif'].'" LIMIT 1'); + $tarif = $sql->get(); - // Получение идентификаторов игрового сервера - $sql->query('INSERT INTO `servers` set uid="1"'); - $id = $sql->id(); - $uid = $id+1000; + // Получение идентификаторов игрового сервера + $sql->query('INSERT INTO `servers` set uid="1"'); + $id = $sql->id(); + $uid = $id+1000; - // Директория сборки - $path = $tarif['path'].$aSDATA['pack']; + // Директория сборки + $path = $tarif['path'].$aSDATA['pack']; - // Директория игрового сервера - $install = $tarif['install'].$uid; + // Директория игрового сервера + $install = $tarif['install'].$uid; - $ssh->set('mkdir '.$install.';' // Создание директории - .'useradd -s /bin/false -d '.$install.' -g servers -u '.$uid.' server'.$uid.';' // Создание пользователя сервера на локации - .'chown server'.$uid.':1000 '.$install.';' // Изменение владельца и группы директории - .'cd '.$install.' && sudo -u server'.$uid.' screen -dmS i_'.$uid.' sh -c "cp -r '.$path.'/. .;' // Копирование файлов сборки для сервера - .'find . -type d -exec chmod 700 {} \;;' - .'find . -type f -exec chmod 777 {} \;;' - .'chmod 500 '.params::$aFileGame[$server['samp']].'"'); + $ssh->set('mkdir '.$install.';' // Создание директории + .'useradd -s /bin/false -d '.$install.' -g servers -u '.$uid.' server'.$uid.';' // Создание пользователя сервера на локации + .'chown server'.$uid.':1000 '.$install.';' // Изменение владельца и группы директории + .'cd '.$install.' && sudo -u server'.$uid.' screen -dmS i_'.$uid.' sh -c "cp -r '.$path.'/. .;' // Копирование файлов сборки для сервера + .'find . -type d -exec chmod 700 {} \;;' + .'find . -type f -exec chmod 777 {} \;;' + .'chmod 500 '.params::$aFileGame[$server['samp']].'"'); - // Запись данных нового сервера - $sql->query('UPDATE `servers` set - `uid`="'.$uid.'", - `unit`="'.$aSDATA['unit'].'", - `tarif`="'.$aSDATA['tarif'].'", - `user`="'.$user['id'].'", - `address`="'.$aSDATA['address'].'", - `port`="'.$aSDATA['port'].'", - `game`="samp", - `slots`="'.$aSDATA['slots'].'", - `slots_start`="'.$aSDATA['slots'].'", - `status`="install", - `name`="'.$tarif['hostname'].'", - `pack`="'.$aSDATA['pack'].'", - `plugins_use`="'.$aSDATA['plugins'].'", - `ftp_use`="'.$aSDATA['ftp'].'", - `console_use`="'.$aSDATA['console'].'", - `stats_use`="'.$aSDATA['stats'].'", - `copy_use`="'.$aSDATA['copy'].'", - `web_use`="'.$aSDATA['web'].'", - `vac`="1", - `hdd`="'.$aSDATA['hdd'].'", - `time`="'.$aSDATA['time'].'", - `date`="'.$start_point.'", - `test`="'.$aSDATA['test'].'", - `ram`="'.$aSDATA['ram'].'", - `map_start`="'.sys::passwd(8).'", - `core_fix`="'.$aSDATA['core_fix'].'", - `core_fix_one`="'.$aSDATA['core_fix_one'].'", - `autostop`="'.$aSDATA['autostop'].'" WHERE `id`="'.$id.'" LIMIT 1'); + // Запись данных нового сервера + $sql->query('UPDATE `servers` set + `uid`="'.$uid.'", + `unit`="'.$aSDATA['unit'].'", + `tarif`="'.$aSDATA['tarif'].'", + `user`="'.$user['id'].'", + `address`="'.$aSDATA['address'].'", + `port`="'.$aSDATA['port'].'", + `game`="samp", + `slots`="'.$aSDATA['slots'].'", + `slots_start`="'.$aSDATA['slots'].'", + `status`="install", + `name`="'.$tarif['hostname'].'", + `pack`="'.$aSDATA['pack'].'", + `plugins_use`="'.$aSDATA['plugins'].'", + `ftp_use`="'.$aSDATA['ftp'].'", + `console_use`="'.$aSDATA['console'].'", + `stats_use`="'.$aSDATA['stats'].'", + `copy_use`="'.$aSDATA['copy'].'", + `web_use`="'.$aSDATA['web'].'", + `vac`="1", + `hdd`="'.$aSDATA['hdd'].'", + `time`="'.$aSDATA['time'].'", + `date`="'.$start_point.'", + `test`="'.$aSDATA['test'].'", + `ram`="'.$aSDATA['ram'].'", + `map_start`="'.sys::passwd(8).'", + `core_fix`="'.$aSDATA['core_fix'].'", + `core_fix_one`="'.$aSDATA['core_fix_one'].'", + `autostop`="'.$aSDATA['autostop'].'" WHERE `id`="'.$id.'" LIMIT 1'); - // Запись установленных плагинов - if($aSDATA['plugins']) - { - // Массив идентификаторов плагинов - $aPlugins = sys::b64djs($aSDATA['plugins_install']); + // Запись установленных плагинов + if($aSDATA['plugins']) + { + // Массив идентификаторов плагинов + $aPlugins = sys::b64djs($aSDATA['plugins_install']); - if(isset($aPlugins[$aSDATA['pack']])) - { - $plugins = explode(',', $aPlugins[$aSDATA['pack']]); + if(isset($aPlugins[$aSDATA['pack']])) + { + $plugins = explode(',', $aPlugins[$aSDATA['pack']]); - foreach($plugins as $plugin) - if($plugin) - $sql->query('INSERT INTO `plugins_install` set `server`="'.$id.'", `plugin`="'.$plugin.'", `time`="'.$start_point.'"'); - } - } + foreach($plugins as $plugin) + if($plugin) + $sql->query('INSERT INTO `plugins_install` set `server`="'.$id.'", `plugin`="'.$plugin.'", `time`="'.$start_point.'"'); + } + } - // Списание средств с баланса пользователя - $sql->query('UPDATE `users` set `balance`="'.($user['balance']-$aSDATA['sum']).'" WHERE `id`="'.$user['id'].'" LIMIT 1'); + // Списание средств с баланса пользователя + $sql->query('UPDATE `users` set `balance`="'.($user['balance']-$aSDATA['sum']).'" WHERE `id`="'.$user['id'].'" LIMIT 1'); - // Запись получения тестового периода - if($aSDATA['test']) - { - $sql->query('INSERT INTO `tests` set `server`="'.$id.'", `unit`="'.$aSDATA['unit'].'", `game`="samp", `user`="'.$user['id'].'", `time`="'.$start_point.'"'); - $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="'.sys::updtext(sys::text('logs', 'buy_server_test'), array('id' => $id)).'", `date`="'.$start_point.'", `type`="buy", `money`="0"'); - }else{ - // Реф. система - games::part($user['id'], $aSDATA['sum']); + // Запись получения тестового периода + if($aSDATA['test']) + { + $sql->query('INSERT INTO `tests` set `server`="'.$id.'", `unit`="'.$aSDATA['unit'].'", `game`="samp", `user`="'.$user['id'].'", `time`="'.$start_point.'"'); + $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="'.sys::updtext(sys::text('logs', 'buy_server_test'), array('id' => $id)).'", `date`="'.$start_point.'", `type`="buy", `money`="0"'); + }else{ + // Реф. система + games::part($user['id'], $aSDATA['sum']); - // Запись логов - if(!is_array($aSDATA['promo'])) - $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="'.sys::updtext(sys::text('logs', 'buy_server'), array('days' => games::parse_day($aSDATA['days'], true), 'money' => $aSDATA['sum'], 'id' => $id)).'", `date`="'.$start_point.'", `type`="buy", `money`="'.$aSDATA['sum'].'"'); - else{ - $sql->query('UPDATE `servers` set `benefit`="'.$aSDATA['time'].'" WHERE `id`="'.$id.'" LIMIT 1'); - $sql->query('INSERT INTO `promo_use` set `promo`="'.$aSDATA['promo']['id'].'", `user`="'.$user['id'].'", `time`="'.$start_point.'"'); - $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="'.sys::updtext(sys::text('logs', 'buy_server_promo'), array('days' => games::parse_day($aSDATA['days'], true), 'money' => $aSDATA['sum'], 'promo' => $aSDATA['promo']['cod'], 'id' => $id)).'", `date`="'.$start_point.'", `type`="buy", `money`="'.$aSDATA['sum'].'"'); - } - } + // Запись логов + if(!is_array($aSDATA['promo'])) + $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="'.sys::updtext(sys::text('logs', 'buy_server'), array('days' => games::parse_day($aSDATA['days'], true), 'money' => $aSDATA['sum'], 'id' => $id)).'", `date`="'.$start_point.'", `type`="buy", `money`="'.$aSDATA['sum'].'"'); + else{ + $sql->query('UPDATE `servers` set `benefit`="'.$aSDATA['time'].'" WHERE `id`="'.$id.'" LIMIT 1'); + $sql->query('INSERT INTO `promo_use` set `promo`="'.$aSDATA['promo']['id'].'", `user`="'.$user['id'].'", `time`="'.$start_point.'"'); + $sql->query('INSERT INTO `logs` set `user`="'.$user['id'].'", `text`="'.sys::updtext(sys::text('logs', 'buy_server_promo'), array('days' => games::parse_day($aSDATA['days'], true), 'money' => $aSDATA['sum'], 'promo' => $aSDATA['promo']['cod'], 'id' => $id)).'", `date`="'.$start_point.'", `type`="buy", `money`="'.$aSDATA['sum'].'"'); + } + } - return $id; - } + return $id; + } } ?> \ No newline at end of file diff --git a/system/library/games/samp/tarif.php b/system/library/games/samp/tarif.php index a65da45..b61e6a3 100644 --- a/system/library/games/samp/tarif.php +++ b/system/library/games/samp/tarif.php @@ -1,179 +1,179 @@ get('extend', 'sections/servers/games/tarif'); + $html->get('extend', 'sections/servers/games/tarif'); - if(isset($html->arr['extend_address'])) - { - $html->unit('extend_address', 1); - $html->set('extend_address', $html->arr['extend_address']); - }else - $html->unit('extend_address'); + if(isset($html->arr['extend_address'])) + { + $html->unit('extend_address', 1); + $html->set('extend_address', $html->arr['extend_address']); + }else + $html->unit('extend_address'); - $html->set('id', $sid); - $html->set('time', sys::date('min', $server['time'])); - $html->set('options', ''.$options); - $html->set('slots', $server['slots']); - $html->set('info', ''); - $html->set('tarif', $tarif_name); - $html->set('cur', $cfg['currency']); + $html->set('id', $sid); + $html->set('time', sys::date('min', $server['time'])); + $html->set('options', ''.$options); + $html->set('slots', $server['slots']); + $html->set('info', ''); + $html->set('tarif', $tarif_name); + $html->set('cur', $cfg['currency']); - $html->pack('main'); + $html->pack('main'); - return NULL; - } + return NULL; + } public static function extend_sp($server, $tarif, $sid) { - global $cfg, $sql, $html, $start_point; + global $cfg, $sql, $html, $start_point; - tarifs::extend_address($server['game'], $sid); + tarifs::extend_address($server['game'], $sid); - $sum = $tarif['slots'] ? $tarif['price'] : $tarif['price']*$server['slots']; + $sum = $tarif['slots'] ? $tarif['price'] : $tarif['price']*$server['slots']; - $html->get('extend_sp', 'sections/servers/games/tarif'); + $html->get('extend_sp', 'sections/servers/games/tarif'); - if(isset($html->arr['extend_address'])) - { - $html->unit('extend_address', 1); - $html->set('extend_address', $html->arr['extend_address']); - }else - $html->unit('extend_address'); + if(isset($html->arr['extend_address'])) + { + $html->unit('extend_address', 1); + $html->set('extend_address', $html->arr['extend_address']); + }else + $html->unit('extend_address'); - $html->set('id', $sid); - $html->set('time', sys::date('min', $server['time'])); - $html->set('date', $server['time'] > $start_point ? 'Сервер продлен до: '.date('d.m.Y', $server['time']) : 'Текущая дата: '.date('d.m.Y', $start_point)); - $html->set('options', ''.$options); - $html->set('slots', $server['slots']); - $html->set('info', ''); - $html->set('tarif', $tarif['name']); - $html->set('sum', $sum); - $html->set('cur', $cfg['currency']); + $html->set('id', $sid); + $html->set('time', sys::date('min', $server['time'])); + $html->set('date', $server['time'] > $start_point ? 'Сервер продлен до: '.date('d.m.Y', $server['time']) : 'Текущая дата: '.date('d.m.Y', $start_point)); + $html->set('options', ''.$options); + $html->set('slots', $server['slots']); + $html->set('info', ''); + $html->set('tarif', $tarif['name']); + $html->set('sum', $sum); + $html->set('cur', $cfg['currency']); - $html->pack('main'); + $html->pack('main'); - return NULL; - } + return NULL; + } public static function plan() { - return NULL; - } + return NULL; + } - public static function unit($server, $unit_name, $tarif_name, $sid) + public static function unit($server, $unit_name, $tarif_name, $sid) { - global $cfg, $sql, $html; + global $cfg, $sql, $html; - if(!$cfg['change_unit'][$server['game']]) - return NULL; + if(!$cfg['change_unit'][$server['game']]) + return NULL; - $tarifs = $sql->query('SELECT `unit` FROM `tarifs` WHERE `game`="'.$server['game'].'" AND `name`="'.$tarif_name.'" AND `id`!="'.$server['tarif'].'" AND `show`="1" ORDER BY `unit`'); - if(!$sql->num($tarifs)) - return NULL; + $tarifs = $sql->query('SELECT `unit` FROM `tarifs` WHERE `game`="'.$server['game'].'" AND `name`="'.$tarif_name.'" AND `id`!="'.$server['tarif'].'" AND `show`="1" ORDER BY `unit`'); + if(!$sql->num($tarifs)) + return NULL; - $units = 0; + $units = 0; - $options = ''; + $options = ''; - while($tarif = $sql->get($tarifs)) - { - $sql->query('SELECT `id`, `name` FROM `units` WHERE `id`="'.$tarif['unit'].'" AND `show`="1" LIMIT 1'); - if(!$sql->num()) - continue; + while($tarif = $sql->get($tarifs)) + { + $sql->query('SELECT `id`, `name` FROM `units` WHERE `id`="'.$tarif['unit'].'" AND `show`="1" LIMIT 1'); + if(!$sql->num()) + continue; - $unit = $sql->get(); + $unit = $sql->get(); - $options .= ''; + $options .= ''; - $units+=1; - } + $units+=1; + } - if(!$units) - return NULL; + if(!$units) + return NULL; - $html->get('unit', 'sections/servers/games/tarif'); + $html->get('unit', 'sections/servers/games/tarif'); - $html->set('id', $sid); - $html->set('options', $options); - $html->set('slots', $server['slots']); - $html->set('info', ''); - $html->set('unit', $unit_name); - $html->set('tarif', $tarif_name); + $html->set('id', $sid); + $html->set('options', $options); + $html->set('slots', $server['slots']); + $html->set('info', ''); + $html->set('unit', $unit_name); + $html->set('tarif', $tarif_name); - $html->pack('main'); + $html->pack('main'); - return NULL; - } + return NULL; + } - public static function unit_new($tarif, $unit, $server, $mcache) - { - global $ssh, $sql, $user, $start_point; + public static function unit_new($tarif, $unit, $server, $mcache) + { + global $ssh, $sql, $user, $start_point; - // Проверка ssh соединения с локацией - if(!$ssh->auth($unit['passwd'], $unit['address'])) - sys::outjs(array('e' => sys::text('error', 'ssh'))); + // Проверка ssh соединения с локацией + if(!$ssh->auth($unit['passwd'], $unit['address'])) + sys::outjs(array('e' => sys::text('error', 'ssh'))); - // Директория сборки - $path = $tarif['path'].$tarif['pack']; + // Директория сборки + $path = $tarif['path'].$tarif['pack']; - // Директория игрового сервера - $install = $tarif['install'].$server['uid']; + // Директория игрового сервера + $install = $tarif['install'].$server['uid']; - // Пользователь сервера - $uS = 'server'.$server['uid']; + // Пользователь сервера + $uS = 'server'.$server['uid']; - $ssh->set('mkdir '.$install.';' // Создание директории - .'useradd -d '.$install.' -g servers -u '.$server['uid'].' '.$uS.';' // Создание пользователя сервера на локации - .'chown '.$uS.':1000 '.$install.';' // Изменение владельца и группы директории - .'cd '.$install.' && sudo -u '.$uS.' screen -dmS i_'.$server['uid'].' cp -r '.$path.'/. .'); // Копирование файлов сборки для сервера + $ssh->set('mkdir '.$install.';' // Создание директории + .'useradd -d '.$install.' -g servers -u '.$server['uid'].' '.$uS.';' // Создание пользователя сервера на локации + .'chown '.$uS.':1000 '.$install.';' // Изменение владельца и группы директории + .'cd '.$install.' && sudo -u '.$uS.' screen -dmS i_'.$server['uid'].' cp -r '.$path.'/. .'); // Копирование файлов сборки для сервера - $address = explode(':', $server['address']); + $address = explode(':', $server['address']); - $fix_one = $tarif['core_fix'] ? 1 : 0; + $fix_one = $tarif['core_fix'] ? 1 : 0; - // Обновление данных нового сервера - $sql->query('UPDATE `servers` set - `unit`="'.$tarif['unit'].'", - `tarif`="'.$tarif['id'].'", - `address`="'.$server['address'].'", - `port`="'.$address[1].'", - `status`="install", - `name`="'.$tarif['hostname'].'", - `pack`="'.$tarif['pack'].'", - `map_start`="'.$tarif['map'].'", - `hdd`="'.$tarif['hdd'].'", - `time`="'.$tarif['time'].'", - `autostop`="'.$tarif['autostop'].'", - `core_fix`="'.$tarif['core_fix'].'", - `core_fix_one`="'.$fix_one.'", - `reinstall`="'.$start_point.'" WHERE `id`="'.$server['id'].'" LIMIT 1'); + // Обновление данных нового сервера + $sql->query('UPDATE `servers` set + `unit`="'.$tarif['unit'].'", + `tarif`="'.$tarif['id'].'", + `address`="'.$server['address'].'", + `port`="'.$address[1].'", + `status`="install", + `name`="'.$tarif['hostname'].'", + `pack`="'.$tarif['pack'].'", + `map_start`="'.$tarif['map'].'", + `hdd`="'.$tarif['hdd'].'", + `time`="'.$tarif['time'].'", + `autostop`="'.$tarif['autostop'].'", + `core_fix`="'.$tarif['core_fix'].'", + `core_fix_one`="'.$fix_one.'", + `reinstall`="'.$start_point.'" WHERE `id`="'.$server['id'].'" LIMIT 1'); - // Запись установленных плагинов - if($tarif['plugins']) - { - // Массив идентификаторов плагинов - $aPlugins = sys::b64js($tarif['plugins_install']); + // Запись установленных плагинов + if($tarif['plugins']) + { + // Массив идентификаторов плагинов + $aPlugins = sys::b64js($tarif['plugins_install']); - if(isset($aPlugins[$tarif['pack']])) - { - $plugins = explode(',', $aPlugins[$tarif['pack']]); + if(isset($aPlugins[$tarif['pack']])) + { + $plugins = explode(',', $aPlugins[$tarif['pack']]); - foreach($plugins as $plugin) - if($plugin) - $sql->query('INSERT INTO `plugins_install` set `server`="'.$server['id'].'", `plugin`="'.$plugin.'", `time`="'.$start_point.'"'); - } - } + foreach($plugins as $plugin) + if($plugin) + $sql->query('INSERT INTO `plugins_install` set `server`="'.$server['id'].'", `plugin`="'.$plugin.'", `time`="'.$start_point.'"'); + } + } - return NULL; - } + return NULL; + } } ?> \ No newline at end of file diff --git a/system/library/games/scans.php b/system/library/games/scans.php index 5a94ea6..a8ce22b 100644 --- a/system/library/games/scans.php +++ b/system/library/games/scans.php @@ -1,237 +1,237 @@ 'hlds_', - 'cssold' => 'srcds_i686', - 'css' => 'srcds_', - 'csgo' => 'srcds_', - 'samp' => 'samp', - 'crmp' => 'samp', - 'mta' => 'mta', - 'mc' => 'java' - ); + class scans + { + private static $process = array( + 'cs' => 'hlds_', + 'cssold' => 'srcds_i686', + 'css' => 'srcds_', + 'csgo' => 'srcds_', + 'samp' => 'samp', + 'crmp' => 'samp', + 'mta' => 'mta', + 'mc' => 'java' + ); - public static function resources($id) - { - global $cfg, $sql, $mcache; + public static function resources($id) + { + global $cfg, $sql, $mcache; - $nmch = 'server_resources_'.$id; + $nmch = 'server_resources_'.$id; - if(is_array($mcache->get($nmch))) - return $mcache->get($nmch); + if(is_array($mcache->get($nmch))) + return $mcache->get($nmch); - $sql->query('SELECT `uid`, `unit`, `tarif`, `game`, `slots`, `slots_start`, `status`, `online`, `ram`, `hdd`, `hdd_use` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); + $sql->query('SELECT `uid`, `unit`, `tarif`, `game`, `slots`, `slots_start`, `status`, `online`, `ram`, `hdd`, `hdd_use` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); - if(!$sql->num()) - return NULL; + if(!$sql->num()) + return NULL; - $server = $sql->get(); + $server = $sql->get(); - $resources = array( - 'usr' => 0, - 'cpu' => 0, - 'ram' => 0, - 'hdd' => $server['hdd_use'] - ); + $resources = array( + 'usr' => 0, + 'cpu' => 0, + 'ram' => 0, + 'hdd' => $server['hdd_use'] + ); - $sql->query('SELECT `install` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); - $tarif = $sql->get(); + $sql->query('SELECT `install` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); + $tarif = $sql->get(); - $sql->query('SELECT `address`, `passwd`, `ram` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $sql->query('SELECT `address`, `passwd`, `ram` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - if(!$ssh->auth($unit['passwd'], $unit['address'])) - return $resources; + if(!$ssh->auth($unit['passwd'], $unit['address'])) + return $resources; - if(!in_array($server['status'], array('working', 'start', 'restart', 'change'))) - return $resources; + if(!in_array($server['status'], array('working', 'start', 'restart', 'change'))) + return $resources; - $resources['usr'] = ceil(100/$server['slots_start']*$server['online']); - $resources['usr'] = $resources['usr'] > 100 ? 100 : $resources['usr']; + $resources['usr'] = ceil(100/$server['slots_start']*$server['online']); + $resources['usr'] = $resources['usr'] > 100 ? 100 : $resources['usr']; - $cr = explode('|', $ssh->get('top -u '.$server['uid'].' -b -n 1 | grep '.(scans::$process[$server['game']]).' | sort | tail -1 | awk \'{print $9"|"$10}\'')); + $cr = explode('|', $ssh->get('top -u '.$server['uid'].' -b -n 1 | grep '.(scans::$process[$server['game']]).' | sort | tail -1 | awk \'{print $9"|"$10}\'')); - if(isset($cr[0])) - $resources['cpu'] = str_replace(',', '.', $cr[0]); + if(isset($cr[0])) + $resources['cpu'] = str_replace(',', '.', $cr[0]); - $resources['cpu'] = $resources['cpu'] > 100 ? 100 : round($resources['cpu']); + $resources['cpu'] = $resources['cpu'] > 100 ? 100 : round($resources['cpu']); - if(isset($cr[1])) - $resources['ram'] = str_replace(',', '.', $cr[1]); + if(isset($cr[1])) + $resources['ram'] = str_replace(',', '.', $cr[1]); - // ram на сервер - $ram = $server['ram'] ? $server['ram'] : $server['slots']*$cfg['ram'][$server['game']]; + // ram на сервер + $ram = $server['ram'] ? $server['ram'] : $server['slots']*$cfg['ram'][$server['game']]; - $resources['ram'] = $unit['ram']/100*$resources['ram']/($ram/100); - - $resources['ram'] = $resources['ram'] > 100 ? 100 : round($resources['ram']); + $resources['ram'] = $unit['ram']/100*$resources['ram']/($ram/100); + + $resources['ram'] = $resources['ram'] > 100 ? 100 : round($resources['ram']); - $resources['hdd'] = ceil(sys::int($ssh->get('cd '.$tarif['install'].$server['uid'].' && du -ms'))/($server['hdd']/100)); - $resources['hdd'] = $resources['hdd'] > 100 ? 100 : $resources['hdd']; + $resources['hdd'] = ceil(sys::int($ssh->get('cd '.$tarif['install'].$server['uid'].' && du -ms'))/($server['hdd']/100)); + $resources['hdd'] = $resources['hdd'] > 100 ? 100 : $resources['hdd']; - $sql->query('UPDATE `servers` set `ram_use`="'.$resources['ram'].'", `cpu_use`="'.$resources['cpu'].'", `hdd_use`="'.$resources['hdd'].'" WHERE `id`="'.$id.'" LIMIT 1'); + $sql->query('UPDATE `servers` set `ram_use`="'.$resources['ram'].'", `cpu_use`="'.$resources['cpu'].'", `hdd_use`="'.$resources['hdd'].'" WHERE `id`="'.$id.'" LIMIT 1'); - $mcache->set($nmch, $resources, false, $cfg['mcache_server_resources']); + $mcache->set($nmch, $resources, false, $cfg['mcache_server_resources']); - return $resources; - } + return $resources; + } - public static function status($id) - { - global $start_point, $cfg, $sql, $mcache; + public static function status($id) + { + global $start_point, $cfg, $sql, $mcache; - $nmch = 'server_status_'.$id; + $nmch = 'server_status_'.$id; - if($mcache->get($nmch)) - return 'mcache -> system_block_operation'; + if($mcache->get($nmch)) + return 'mcache -> system_block_operation'; - $mcache->set($nmch, true, false, $cfg['mcache_server_status']); + $mcache->set($nmch, true, false, $cfg['mcache_server_status']); - $sql->query('SELECT `uid`, `unit`, `game`, `address`, `status`, `name`, `online`, `players`, `time`, `overdue`, `ftp`, `block` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); - $server = $sql->get(); + $sql->query('SELECT `uid`, `unit`, `game`, `address`, `status`, `name`, `online`, `players`, `time`, `overdue`, `ftp`, `block` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); + $server = $sql->get(); - // Если аренда не закончилась, а сервер просрочен - if($server['time'] > $start_point && $server['status'] == 'overdue') - { - $sql->query('UPDATE `servers` set `status`="off" WHERE `id`="'.$id.'" LIMIT 1'); + // Если аренда не закончилась, а сервер просрочен + if($server['time'] > $start_point && $server['status'] == 'overdue') + { + $sql->query('UPDATE `servers` set `status`="off" WHERE `id`="'.$id.'" LIMIT 1'); - sys::reset_mcache('server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'off', 'online' => 0, 'players' => '')); - sys::reset_mcache('server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'off', 'online' => 0)); + sys::reset_mcache('server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'off', 'online' => 0, 'players' => '')); + sys::reset_mcache('server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'off', 'online' => 0)); - return 'server -> extend -> off'; - } + return 'server -> extend -> off'; + } - // Если аренда закончилась и сервер просрочен длительное время - if($server['time'] < $start_point && $server['status'] == 'overdue' && ($server['overdue']+$cfg['server_delete']*86400) < $start_point) - { - $sql->query('UPDATE `servers` set `user`="-1" WHERE `id`="'.$id.'" LIMIT 1'); + // Если аренда закончилась и сервер просрочен длительное время + if($server['time'] < $start_point && $server['status'] == 'overdue' && ($server['overdue']+$cfg['server_delete']*86400) < $start_point) + { + $sql->query('UPDATE `servers` set `user`="-1" WHERE `id`="'.$id.'" LIMIT 1'); - return 'server -> overdue -> delete'; - } + return 'server -> overdue -> delete'; + } - $sql->query('SELECT `address`, `passwd`, `sql_login`, `sql_passwd`, `sql_port`, `sql_ftp` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $sql->query('SELECT `address`, `passwd`, `sql_login`, `sql_passwd`, `sql_port`, `sql_ftp` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - if(!$ssh->auth($unit['passwd'], $unit['address'])) - return 'unit error connect'; + if(!$ssh->auth($unit['passwd'], $unit['address'])) + return 'unit error connect'; - // Если аренда закончилась, а сервер не просрочен - if($server['time'] < $start_point && !in_array($server['status'], array('overdue', 'blocked'))) - { - // Убить процессы - $ssh->set('kill -9 `ps aux | grep s_'.$server['uid'].' | grep -v grep | awk '."'{print $2}'".' | xargs;' - .'lsof -i@'.$server['address'].' | awk '."'{print $2}'".' | grep -v PID | xargs`; sudo -u server'.$server['uid'].' screen -wipe'); + // Если аренда закончилась, а сервер не просрочен + if($server['time'] < $start_point && !in_array($server['status'], array('overdue', 'blocked'))) + { + // Убить процессы + $ssh->set('kill -9 `ps aux | grep s_'.$server['uid'].' | grep -v grep | awk '."'{print $2}'".' | xargs;' + .'lsof -i@'.$server['address'].' | awk '."'{print $2}'".' | grep -v PID | xargs`; sudo -u server'.$server['uid'].' screen -wipe'); - if($server['ftp']) - $ssh->set("mysql -P ".$unit['sql_port']." -u".$unit['sql_login']." -p".$unit['sql_passwd']." --database ".$unit['sql_ftp']." -e \"DELETE FROM ftp WHERE user='".$server['uid']."'\""); + if($server['ftp']) + $ssh->set("mysql -P ".$unit['sql_port']." -u".$unit['sql_login']." -p".$unit['sql_passwd']." --database ".$unit['sql_ftp']." -e \"DELETE FROM ftp WHERE user='".$server['uid']."'\""); - $sql->query('UPDATE `servers` set `status`="overdue", `online`="0", `players`="", `ftp`="0", `overdue`="'.$start_point.'", `mail`="1" WHERE `id`="'.$id.'" LIMIT 1'); + $sql->query('UPDATE `servers` set `status`="overdue", `online`="0", `players`="", `ftp`="0", `overdue`="'.$start_point.'", `mail`="1" WHERE `id`="'.$id.'" LIMIT 1'); - sys::reset_mcache('server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'overdue', 'online' => 0, 'players' => '')); - sys::reset_mcache('server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'overdue', 'online' => 0)); + sys::reset_mcache('server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'overdue', 'online' => 0, 'players' => '')); + sys::reset_mcache('server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'overdue', 'online' => 0)); - return 'server -> overdue -> stoping'; - } + return 'server -> overdue -> stoping'; + } - switch($server['status']) - { - case 'working': case 'change': case 'start': case 'restart': - if(!sys::int($ssh->get('ps aux | grep s_'.$server['uid'].' | grep -v grep | awk \'{print $2}\''))) - { - $sql->query('UPDATE `servers` set `status`="off", `online`="0", `players`="0" WHERE `id`="'.$id.'" LIMIT 1'); + switch($server['status']) + { + case 'working': case 'change': case 'start': case 'restart': + if(!sys::int($ssh->get('ps aux | grep s_'.$server['uid'].' | grep -v grep | awk \'{print $2}\''))) + { + $sql->query('UPDATE `servers` set `status`="off", `online`="0", `players`="0" WHERE `id`="'.$id.'" LIMIT 1'); - sys::reset_mcache('server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'off', 'online' => 0, 'players' => '')); - sys::reset_mcache('server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'off', 'online' => 0)); + sys::reset_mcache('server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'off', 'online' => 0, 'players' => '')); + sys::reset_mcache('server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'off', 'online' => 0)); - return 'server -> working -> off'; - } + return 'server -> working -> off'; + } - break; + break; - case 'off': - if(sys::int($ssh->get('ps aux | grep s_'.$server['uid'].' | grep -v grep | awk \'{print $2}\''))) - { - $sql->query('UPDATE `servers` set `status`="working" WHERE `id`="'.$id.'" LIMIT 1'); + case 'off': + if(sys::int($ssh->get('ps aux | grep s_'.$server['uid'].' | grep -v grep | awk \'{print $2}\''))) + { + $sql->query('UPDATE `servers` set `status`="working" WHERE `id`="'.$id.'" LIMIT 1'); - sys::reset_mcache('server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'working', 'online' => $server['online'], 'players' => $server['players'])); - sys::reset_mcache('server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'working', 'online' => $server['online'])); + sys::reset_mcache('server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'working', 'online' => $server['online'], 'players' => $server['players'])); + sys::reset_mcache('server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'working', 'online' => $server['online'])); - return 'server -> off -> working'; - } + return 'server -> off -> working'; + } - break; + break; - case 'reinstall': - if(!sys::int($ssh->get('ps aux | grep r_'.$server['uid'].' | grep -v grep | awk \'{print $2}\''))) - { - $sql->query('UPDATE `servers` set `status`="off" WHERE `id`="'.$id.'" LIMIT 1'); + case 'reinstall': + if(!sys::int($ssh->get('ps aux | grep r_'.$server['uid'].' | grep -v grep | awk \'{print $2}\''))) + { + $sql->query('UPDATE `servers` set `status`="off" WHERE `id`="'.$id.'" LIMIT 1'); - sys::reset_mcache('server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'off', 'online' => 0, 'players' => '')); - sys::reset_mcache('server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'off', 'online' => 0)); + sys::reset_mcache('server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'off', 'online' => 0, 'players' => '')); + sys::reset_mcache('server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'off', 'online' => 0)); - return 'server -> reinstall -> end'; - } + return 'server -> reinstall -> end'; + } - break; + break; - case 'update': - if(!sys::int($ssh->get('ps aux | grep u_'.$server['uid'].' | grep -v grep | awk \'{print $2}\''))) - { - $sql->query('UPDATE `servers` set `status`="off" WHERE `id`="'.$id.'" LIMIT 1'); + case 'update': + if(!sys::int($ssh->get('ps aux | grep u_'.$server['uid'].' | grep -v grep | awk \'{print $2}\''))) + { + $sql->query('UPDATE `servers` set `status`="off" WHERE `id`="'.$id.'" LIMIT 1'); - sys::reset_mcache('server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'off', 'online' => 0, 'players' => '')); - sys::reset_mcache('server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'off', 'online' => 0)); + sys::reset_mcache('server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'off', 'online' => 0, 'players' => '')); + sys::reset_mcache('server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'off', 'online' => 0)); - return 'server -> update -> end'; - } + return 'server -> update -> end'; + } - break; + break; - case 'install': - if(!sys::int($ssh->get('ps aux | grep i_'.$server['uid'].' | grep -v grep | awk \'{print $2}\''))) - { - $sql->query('UPDATE `servers` set `status`="off" WHERE `id`="'.$id.'" LIMIT 1'); + case 'install': + if(!sys::int($ssh->get('ps aux | grep i_'.$server['uid'].' | grep -v grep | awk \'{print $2}\''))) + { + $sql->query('UPDATE `servers` set `status`="off" WHERE `id`="'.$id.'" LIMIT 1'); - sys::reset_mcache('server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'off', 'online' => 0, 'players' => '')); - sys::reset_mcache('server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'off', 'online' => 0)); + sys::reset_mcache('server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'off', 'online' => 0, 'players' => '')); + sys::reset_mcache('server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'off', 'online' => 0)); - return 'server -> install -> end'; - } + return 'server -> install -> end'; + } - break; + break; - case 'recovery': - if(!sys::int($ssh->get('ps aux | grep rec_'.$server['uid'].' | grep -v grep | awk \'{print $2}\''))) - { - $sql->query('UPDATE `servers` set `status`="off" WHERE `id`="'.$id.'" LIMIT 1'); + case 'recovery': + if(!sys::int($ssh->get('ps aux | grep rec_'.$server['uid'].' | grep -v grep | awk \'{print $2}\''))) + { + $sql->query('UPDATE `servers` set `status`="off" WHERE `id`="'.$id.'" LIMIT 1'); - sys::reset_mcache('server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'off', 'online' => 0, 'players' => '')); - sys::reset_mcache('server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'off', 'online' => 0)); + sys::reset_mcache('server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'off', 'online' => 0, 'players' => '')); + sys::reset_mcache('server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'off', 'online' => 0)); - return 'server -> recovery -> end'; - } + return 'server -> recovery -> end'; + } - break; + break; - case 'blocked': - if($server['block'] > $start_point) - break; + case 'blocked': + if($server['block'] > $start_point) + break; - $sql->query('UPDATE `servers` set `status`="off", `block`="0" WHERE `id`="'.$id.'" LIMIT 1'); + $sql->query('UPDATE `servers` set `status`="off", `block`="0" WHERE `id`="'.$id.'" LIMIT 1'); - sys::reset_mcache('server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'off', 'online' => 0, 'players' => '')); - sys::reset_mcache('server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'off', 'online' => 0)); - } + sys::reset_mcache('server_scan_mon_pl_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'off', 'online' => 0, 'players' => '')); + sys::reset_mcache('server_scan_mon_'.$id, $id, array('name' => $server['name'], 'game' => $server['game'], 'status' => 'off', 'online' => 0)); + } - return 'server -> no change -> end scan'; - } - } + return 'server -> no change -> end scan'; + } + } ?> \ No newline at end of file diff --git a/system/library/games/services.php b/system/library/games/services.php index 4ab56b6..48d32b6 100644 --- a/system/library/games/services.php +++ b/system/library/games/services.php @@ -1,58 +1,58 @@ query('SELECT `id` FROM `units` WHERE `'.$game.'`="1" AND `show`="1" ORDER BY `sort` ASC'); - while($unit = $sql->get($units)) - { - $sql->query('SELECT `id` FROM `tarifs` WHERE `unit`="'.$unit['id'].'" AND `game`="'.$game.'" AND `show`="1" LIMIT 1'); - if(!$sql->num()) - continue; - else{ - $sel = $unit['id']; - break; - } - } + $units = $sql->query('SELECT `id` FROM `units` WHERE `'.$game.'`="1" AND `show`="1" ORDER BY `sort` ASC'); + while($unit = $sql->get($units)) + { + $sql->query('SELECT `id` FROM `tarifs` WHERE `unit`="'.$unit['id'].'" AND `game`="'.$game.'" AND `show`="1" LIMIT 1'); + if(!$sql->num()) + continue; + else{ + $sel = $unit['id']; + break; + } + } - return 'SELECT `id`, `test` FROM `units` WHERE `id`="'.$sel.'" LIMIT 1'; - } + return 'SELECT `id`, `test` FROM `units` WHERE `id`="'.$sel.'" LIMIT 1'; + } - public static function units($game) - { - global $sql; + public static function units($game) + { + global $sql; - $list = ''; + $list = ''; - $units = $sql->query('SELECT `id`, `name` FROM `units` WHERE `'.$game.'`="1" AND `show`="1" ORDER BY `sort` ASC'); - while($unit = $sql->get($units)) - { - $sql->query('SELECT `id` FROM `tarifs` WHERE `unit`="'.$unit['id'].'" AND `game`="'.$game.'" AND `show`="1" LIMIT 1'); - if($sql->num()) - $list .= ''; - } + $units = $sql->query('SELECT `id`, `name` FROM `units` WHERE `'.$game.'`="1" AND `show`="1" ORDER BY `sort` ASC'); + while($unit = $sql->get($units)) + { + $sql->query('SELECT `id` FROM `tarifs` WHERE `unit`="'.$unit['id'].'" AND `game`="'.$game.'" AND `show`="1" LIMIT 1'); + if($sql->num()) + $list .= ''; + } - return $list; - } + return $list; + } - public static function tarifs($game, $unit) - { - global $sql; + public static function tarifs($game, $unit) + { + global $sql; - $list = ''; + $list = ''; - $sql->query('SELECT `id`, `name` FROM `tarifs` WHERE `game`="'.$game.'" AND `unit`="'.$unit.'" AND `show`="1" ORDER BY `sort` ASC'); - while($tarif = $sql->get()) - $list .= ''; + $sql->query('SELECT `id`, `name` FROM `tarifs` WHERE `game`="'.$game.'" AND `unit`="'.$unit.'" AND `show`="1" ORDER BY `sort` ASC'); + while($tarif = $sql->get()) + $list .= ''; - return $list; - } - } + return $list; + } + } ?> \ No newline at end of file diff --git a/system/library/games/tarifs.php b/system/library/games/tarifs.php index bda7f67..5c18f2f 100644 --- a/system/library/games/tarifs.php +++ b/system/library/games/tarifs.php @@ -1,218 +1,218 @@ query('SELECT `aid`, `time` FROM `address_buy` WHERE `server`="'.$sid.'" LIMIT 1'); - if(!$sql->num()) - return NULL; - - $ip_buy = $sql->get(); - - $sql->query('SELECT `ip`, `price` FROM `address` WHERE `id`="'.$ip_buy['aid'].'" LIMIT 1'); - - $ip_buy = array_merge($ip_buy, $sql->get()); - - $html->get('extend_address', 'sections/servers/games/tarif'); - $html->set('address', $ip_buy['ip'].':'.params::$aDefPort[$game]); - $html->set('iptime', sys::date('max', $ip_buy['time'])); - $html->set('ipprice', $ip_buy['price']); - $html->set('cur', $cfg['currency']); - $html->pack('extend_address'); - - return NULL; - } - - public static function address($server, $sid) - { - global $cfg, $sql, $html; - - $sql->query('SELECT `address` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $sUnit = $sql->get(); - - if(sys::first(explode(':', $sUnit['address'])) != sys::first(explode(':', $server['address']))) - { - if($cfg['buy_address'][$server['game']]) - tarif::address_extend($server['address'], $sid); - - return NULL; - } - - $options = ''; - - $sql->query('SELECT `id`, `ip`, `price` FROM `address` WHERE `unit`="'.$server['unit'].'" AND `buy`="0"'); - if(!$sql->num()) - return NULL; - - while($ip = $sql->get()) - $options .= ''; - - $html->get('address', 'sections/servers/games/tarif'); - if($cfg['buy_address'][$server['game']]){ - $html->unit('!mounth'); - $html->unit('mounth', 1); - }else{ - $html->unit('!mounth', 1); - $html->unit('mounth'); - } - - $html->set('id', $sid); - $html->set('options', $options); - $html->set('address', $server['address']); - $html->set('cur', $cfg['currency']); - $html->pack('main'); - - return NULL; - } - - public static function address_extend($address, $sid) - { - global $cfg, $sql, $html; - - $sql->query('SELECT `aid`, `time` FROM `address_buy` WHERE `server`="'.$sid.'" LIMIT 1'); - - if(!$sql->num()) - return NULL; - - $add = $sql->get(); - - $sql->query('SELECT `price` FROM `address` WHERE `id`="'.$add['aid'].'" LIMIT 1'); - - if(!$sql->num()) - return NULL; - - $add = array_merge($add, $sql->get()); - - $html->get('address_extend', 'sections/servers/games/tarif'); - $html->set('address', $address); - $html->set('time', sys::date('max', $add['time'])); - $html->set('price', $add['price']); - $html->set('cur', $cfg['currency']); - $html->pack('main'); - - return NULL; - } - - public static function address_add_sum($address, $server) - { - global $sql; - - if(!$address) - return 0; - - $ip = sys::first(explode(':', $server['address'])); - - $sql->query('SELECT `address` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); - - if($address AND sys::first(explode(':', $unit['address'])) != $ip) - { - $sql->query('SELECT `price` FROM `address` WHERE `ip`="'.$ip.'" LIMIT 1'); - - if($sql->num()) - { - $add = $sql->get(); - - return $add['price']; - } - } - - return 0; - } - - public static function slots($server, $aSlots, $sid) + class tarifs + { + public static function extend_address($game, $sid) { - global $cfg, $html, $start_point; + global $cfg, $sql, $html, $start_point; - $options = ''; + $sql->query('SELECT `aid`, `time` FROM `address_buy` WHERE `server`="'.$sid.'" LIMIT 1'); + if(!$sql->num()) + return NULL; - // С уменьшением (min ==> max) || закончился срок аренды - if(($cfg['change_slots'][$server['game']]['days'] AND $cfg['change_slots'][$server['game']]['down']) || $server['time'] < $start_point) - { - for($i = $aSlots['min']; $i <= $aSlots['max']; $i+=1) - $options .= ''; + $ip_buy = $sql->get(); - $html->get('slots', 'sections/servers/games/tarif'); - }else{ - if($server['slots'] == $aSlots['max']) - return NULL; + $sql->query('SELECT `ip`, `price` FROM `address` WHERE `id`="'.$ip_buy['aid'].'" LIMIT 1'); - $max = $aSlots['max']-$server['slots']; + $ip_buy = array_merge($ip_buy, $sql->get()); - if($max < 1) - return NULL; + $html->get('extend_address', 'sections/servers/games/tarif'); + $html->set('address', $ip_buy['ip'].':'.params::$aDefPort[$game]); + $html->set('iptime', sys::date('max', $ip_buy['time'])); + $html->set('ipprice', $ip_buy['price']); + $html->set('cur', $cfg['currency']); + $html->pack('extend_address'); - for($i = 1; $i <= $max; $i+=1) - $options .= ''; + return NULL; + } - $html->get('slots_buy', 'sections/servers/games/tarif'); - } + public static function address($server, $sid) + { + global $cfg, $sql, $html; - $html->set('id', $sid); - $html->set('options', $options); - $html->set('slots', $server['slots']); - $html->set('cur', $cfg['currency']); - $html->pack('main'); + $sql->query('SELECT `address` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $sUnit = $sql->get(); - return NULL; - } + if(sys::first(explode(':', $sUnit['address'])) != sys::first(explode(':', $server['address']))) + { + if($cfg['buy_address'][$server['game']]) + tarif::address_extend($server['address'], $sid); - public static function price($plan) - { - $aPrice = explode(':', $plan); + return NULL; + } - $check = $aPrice[0]; + $options = ''; - unset($aPrice[0]); + $sql->query('SELECT `id`, `ip`, `price` FROM `address` WHERE `unit`="'.$server['unit'].'" AND `buy`="0"'); + if(!$sql->num()) + return NULL; - if(!count($aPrice)) - return false; + while($ip = $sql->get()) + $options .= ''; - foreach($aPrice as $price) - if($check != $price) - return true; + $html->get('address', 'sections/servers/games/tarif'); + if($cfg['buy_address'][$server['game']]){ + $html->unit('!mounth'); + $html->unit('mounth', 1); + }else{ + $html->unit('!mounth', 1); + $html->unit('mounth'); + } - return false; - } + $html->set('id', $sid); + $html->set('options', $options); + $html->set('address', $server['address']); + $html->set('cur', $cfg['currency']); + $html->pack('main'); - public static function unit_old($tarif, $unit, $server, $mcache) - { - global $ssh, $sql, $user, $start_point; + return NULL; + } - // Проверка ssh соединения с локацией - if(!$ssh->auth($unit['passwd'], $unit['address'])) - sys::outjs(array('e' => sys::text('error', 'ssh')), $mcache); + public static function address_extend($address, $sid) + { + global $cfg, $sql, $html; - // Убить процессы - $ssh->set('kill -9 `ps aux | grep s_'.$server['uid'].' | grep -v grep | awk '."'{print $2}'".' | xargs;' - .'lsof -i@:'.$server['address'].' | awk '."'{print $2}'".' | xargs`; sudo -u server'.$server['uid'].' screen -wipe'); + $sql->query('SELECT `aid`, `time` FROM `address_buy` WHERE `server`="'.$sid.'" LIMIT 1'); - // Директория игрового сервера - $install = $tarif['install'].$server['uid']; + if(!$sql->num()) + return NULL; - $copys = 'screen -dmS r_copy_'.$server['uid'].' sh -c "'; + $add = $sql->get(); - $scopy = $sql->query('SELECT `id`, `name` FROM `copy` WHERE `server`="'.$server['id'].'"'); - while($copy = $sql->get($scopy)) - { - $copys .= 'rm /copy/'.$copy['name'].'.tar;'; + $sql->query('SELECT `price` FROM `address` WHERE `id`="'.$add['aid'].'" LIMIT 1'); - $sql->query('DELETE FROM `copy` WHERE `id`="'.$copy['id'].'" LIMIT 1'); - } + if(!$sql->num()) + return NULL; - $copys .= '";'; + $add = array_merge($add, $sql->get()); - $ssh->set($copys // Удаление резервных копий - .'screen -dmS r_'.$server['uid'].' rm -r '.$install.';' // Удаление директории сервера - .'userdel server'.$server['uid']); // Удаление пользователя сервера c локации + $html->get('address_extend', 'sections/servers/games/tarif'); + $html->set('address', $address); + $html->set('time', sys::date('max', $add['time'])); + $html->set('price', $add['price']); + $html->set('cur', $cfg['currency']); + $html->pack('main'); - // Удаление ftp доступа - $qSql = 'DELETE FROM users WHERE username=\''.$server['uid'].'\';' + return NULL; + } + + public static function address_add_sum($address, $server) + { + global $sql; + + if(!$address) + return 0; + + $ip = sys::first(explode(':', $server['address'])); + + $sql->query('SELECT `address` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); + + if($address AND sys::first(explode(':', $unit['address'])) != $ip) + { + $sql->query('SELECT `price` FROM `address` WHERE `ip`="'.$ip.'" LIMIT 1'); + + if($sql->num()) + { + $add = $sql->get(); + + return $add['price']; + } + } + + return 0; + } + + public static function slots($server, $aSlots, $sid) + { + global $cfg, $html, $start_point; + + $options = ''; + + // С уменьшением (min ==> max) || закончился срок аренды + if(($cfg['change_slots'][$server['game']]['days'] AND $cfg['change_slots'][$server['game']]['down']) || $server['time'] < $start_point) + { + for($i = $aSlots['min']; $i <= $aSlots['max']; $i+=1) + $options .= ''; + + $html->get('slots', 'sections/servers/games/tarif'); + }else{ + if($server['slots'] == $aSlots['max']) + return NULL; + + $max = $aSlots['max']-$server['slots']; + + if($max < 1) + return NULL; + + for($i = 1; $i <= $max; $i+=1) + $options .= ''; + + $html->get('slots_buy', 'sections/servers/games/tarif'); + } + + $html->set('id', $sid); + $html->set('options', $options); + $html->set('slots', $server['slots']); + $html->set('cur', $cfg['currency']); + $html->pack('main'); + + return NULL; + } + + public static function price($plan) + { + $aPrice = explode(':', $plan); + + $check = $aPrice[0]; + + unset($aPrice[0]); + + if(!count($aPrice)) + return false; + + foreach($aPrice as $price) + if($check != $price) + return true; + + return false; + } + + public static function unit_old($tarif, $unit, $server, $mcache) + { + global $ssh, $sql, $user, $start_point; + + // Проверка ssh соединения с локацией + if(!$ssh->auth($unit['passwd'], $unit['address'])) + sys::outjs(array('e' => sys::text('error', 'ssh')), $mcache); + + // Убить процессы + $ssh->set('kill -9 `ps aux | grep s_'.$server['uid'].' | grep -v grep | awk '."'{print $2}'".' | xargs;' + .'lsof -i@:'.$server['address'].' | awk '."'{print $2}'".' | xargs`; sudo -u server'.$server['uid'].' screen -wipe'); + + // Директория игрового сервера + $install = $tarif['install'].$server['uid']; + + $copys = 'screen -dmS r_copy_'.$server['uid'].' sh -c "'; + + $scopy = $sql->query('SELECT `id`, `name` FROM `copy` WHERE `server`="'.$server['id'].'"'); + while($copy = $sql->get($scopy)) + { + $copys .= 'rm /copy/'.$copy['name'].'.tar;'; + + $sql->query('DELETE FROM `copy` WHERE `id`="'.$copy['id'].'" LIMIT 1'); + } + + $copys .= '";'; + + $ssh->set($copys // Удаление резервных копий + .'screen -dmS r_'.$server['uid'].' rm -r '.$install.';' // Удаление директории сервера + .'userdel server'.$server['uid']); // Удаление пользователя сервера c локации + + // Удаление ftp доступа + $qSql = 'DELETE FROM users WHERE username=\''.$server['uid'].'\';' .'DELETE FROM quotalimits WHERE name=\''.$server['uid'].'\';' .'DELETE FROM quotatallies WHERE name=\''.$server['uid'].'\''; @@ -220,50 +220,50 @@ $sql->query('UPDATE `servers` SET `ftp`="0" WHERE `id`="'.$server['id'].'" LIMIT 1'); - // Очистка правил FireWall - games::iptables($server['id'], 'remove', NULL, NULL, NULL, false, $ssh); + // Очистка правил FireWall + games::iptables($server['id'], 'remove', NULL, NULL, NULL, false, $ssh); - // Удаление заданий из crontab - $sql->query('SELECT `address`, `passwd` FROM `panel` LIMIT 1'); - $panel = $sql->get(); + // Удаление заданий из crontab + $sql->query('SELECT `address`, `passwd` FROM `panel` LIMIT 1'); + $panel = $sql->get(); - if(!$ssh->auth($panel['passwd'], $panel['address'])) - sys::outjs(array('e' => sys::text('error', 'ssh')), $mcache); + if(!$ssh->auth($panel['passwd'], $panel['address'])) + sys::outjs(array('e' => sys::text('error', 'ssh')), $mcache); - $crons = $sql->query('SELECT `id`, `cron` FROM `crontab` WHERE `server`="'.$server['id'].'"'); - while($cron = $sql->get($crons)) - { - $ssh->set('echo "" >> /etc/crontab && cat /etc/crontab'); - $crontab = str_replace($cron['cron'], '', $ssh->get()); + $crons = $sql->query('SELECT `id`, `cron` FROM `crontab` WHERE `server`="'.$server['id'].'"'); + while($cron = $sql->get($crons)) + { + $ssh->set('echo "" >> /etc/crontab && cat /etc/crontab'); + $crontab = str_replace($cron['cron'], '', $ssh->get()); - // Временный файл - $temp = sys::temp($crontab); + // Временный файл + $temp = sys::temp($crontab); - $ssh->setfile($temp, '/etc/crontab', 0644); + $ssh->setfile($temp, '/etc/crontab', 0644); - $ssh->set("sed -i '/^$/d' /etc/crontab"); - $ssh->set('crontab -u root /etc/crontab'); + $ssh->set("sed -i '/^$/d' /etc/crontab"); + $ssh->set('crontab -u root /etc/crontab'); - unlink($temp); + unlink($temp); - $sql->query('DELETE FROM `crontab` WHERE `id`="'.$cron['id'].'" LIMIT 1'); - } + $sql->query('DELETE FROM `crontab` WHERE `id`="'.$cron['id'].'" LIMIT 1'); + } - // Удаление установок игрового сервера - $sql->query('DELETE FROM `admins_'.$server['game'].'` WHERE `server`="'.$server['id'].'" LIMIT 1'); - $sql->query('DELETE FROM `plugins_install` WHERE `server`="'.$server['id'].'" LIMIT 1'); + // Удаление установок игрового сервера + $sql->query('DELETE FROM `admins_'.$server['game'].'` WHERE `server`="'.$server['id'].'" LIMIT 1'); + $sql->query('DELETE FROM `plugins_install` WHERE `server`="'.$server['id'].'" LIMIT 1'); - // Обновление данных выделенного адреса - $sql->query('SELECT `id`, `aid` FROM `address_buy` WHERE `server`="'.$server['id'].'" LIMIT 1'); - if($sql->num()) - { - $add = $sql->get(); + // Обновление данных выделенного адреса + $sql->query('SELECT `id`, `aid` FROM `address_buy` WHERE `server`="'.$server['id'].'" LIMIT 1'); + if($sql->num()) + { + $add = $sql->get(); - $sql->query('UPDATE `address` set `buy`="0" WHERE `id`="'.$add['aid'].'" LIMIT 1'); - $sql->query('DELETE FROM `address_buy` WHERE `id`="'.$add['id'].'" LIMIT 1'); - } + $sql->query('UPDATE `address` set `buy`="0" WHERE `id`="'.$add['aid'].'" LIMIT 1'); + $sql->query('DELETE FROM `address_buy` WHERE `id`="'.$add['id'].'" LIMIT 1'); + } - return NULL; - } - } + return NULL; + } + } ?> \ No newline at end of file diff --git a/system/library/geo.php b/system/library/geo.php index 0188dc3..7364474 100644 --- a/system/library/geo.php +++ b/system/library/geo.php @@ -1,393 +1,393 @@ fh = fopen($db_file, 'rb'); - - $header = fread($this->fh, 40); - if(substr($header, 0, 3) != 'SxG') - die("Can't open {$db_file}\n"); - - $info = unpack('Cver/Ntime/Ctype/Ccharset/Cb_idx_len/nm_idx_len/nrange/Ndb_items/Cid_len/nmax_region/nmax_city/Nregion_size/Ncity_size/nmax_country/Ncountry_size/npack_size', substr($header, 3)); - - if($info['b_idx_len'] * $info['m_idx_len'] * $info['range'] * $info['db_items'] * $info['time'] * $info['id_len'] == 0) - die("Wrong file format {$db_file}\n"); - - $this->range = $info['range']; - $this->b_idx_len = $info['b_idx_len']; - $this->m_idx_len = $info['m_idx_len']; - $this->db_items = $info['db_items']; - $this->id_len = $info['id_len']; - $this->block_len = 3 + $this->id_len; - $this->max_region = $info['max_region']; - $this->max_city = $info['max_city']; - $this->max_country = $info['max_country']; - $this->country_size = $info['country_size']; - $this->batch_mode = $type & SXGEO_BATCH; - $this->memory_mode = $type & SXGEO_MEMORY; - $this->pack = $info['pack_size'] ? explode("\0", fread($this->fh, $info['pack_size'])) : ''; - $this->b_idx_str = fread($this->fh, $info['b_idx_len'] * 4); - $this->m_idx_str = fread($this->fh, $info['m_idx_len'] * 4); - $this->db_begin = ftell($this->fh); - - if($this->batch_mode) - { - $this->b_idx_arr = array_values(unpack("N*", $this->b_idx_str)); - - unset($this->b_idx_str); - - $this->m_idx_arr = str_split($this->m_idx_str, 4); - - unset($this->m_idx_str); - } - - if($this->memory_mode) - { - $this->db = fread($this->fh, $this->db_items * $this->block_len); - $this->regions_db = $info['region_size'] > 0 ? fread($this->fh, $info['region_size']) : ''; - $this->cities_db = $info['city_size'] > 0 ? fread($this->fh, $info['city_size']) : ''; - } - - $this->info = $info; - - $this->info['regions_begin'] = $this->db_begin + $this->db_items * $this->block_len; - $this->info['cities_begin'] = $this->info['regions_begin'] + $info['region_size']; - } - - protected function search_idx($ipn, $min, $max) - { - if($this->batch_mode) - { - while($max - $min > 8) - { - $offset = ($min + $max) >> 1; - - if($ipn > $this->m_idx_arr[$offset]) - $min = $offset; - else - $max = $offset; - } - - while ($ipn > $this->m_idx_arr[$min] && $min++ < $max){}; - }else{ - while($max - $min > 8) - { - $offset = ($min + $max) >> 1; - - if($ipn > substr($this->m_idx_str, $offset*4, 4)) - $min = $offset; - else - $max = $offset; - } - - while($ipn > substr($this->m_idx_str, $min*4, 4) && $min++ < $max){}; - } - - return $min; - } - - protected function search_db($str, $ipn, $min, $max) - { - if($max - $min > 1) - { - $ipn = substr($ipn, 1); - - while($max - $min > 8) - { - $offset = ($min + $max) >> 1; - if($ipn > substr($str, $offset * $this->block_len, 3)) - $min = $offset; - else - $max = $offset; - } - - while($ipn >= substr($str, $min * $this->block_len, 3) && ++$min < $max){}; - }else - $min++; - - return hexdec(bin2hex(substr($str, $min * $this->block_len - $this->id_len, $this->id_len))); - } - - public function get_num($ip) - { - $ip1n = (int)$ip; - - if($ip1n == 0 || $ip1n == 10 || $ip1n == 127 || $ip1n >= $this->b_idx_len || false === ($ipn = ip2long($ip))) - return false; - - $ipn = pack('N', $ipn); - $this->ip1c = chr($ip1n); - - if($this->batch_mode) - $blocks = array('min' => $this->b_idx_arr[$ip1n-1], 'max' => $this->b_idx_arr[$ip1n]); - else - $blocks = unpack("Nmin/Nmax", substr($this->b_idx_str, ($ip1n - 1) * 4, 8)); - - if($blocks['max'] - $blocks['min'] > $this->range) - { - $part = $this->search_idx($ipn, floor($blocks['min'] / $this->range), floor($blocks['max'] / $this->range)-1); - - $min = $part > 0 ? $part * $this->range : 0; - $max = $part > $this->m_idx_len ? $this->db_items : ($part+1) * $this->range; - - if($min < $blocks['min']) - $min = $blocks['min']; - - if($max > $blocks['max']) - $max = $blocks['max']; - }else{ - $min = $blocks['min']; - $max = $blocks['max']; - } - - $len = $max - $min; - - if($this->memory_mode) - return $this->search_db($this->db, $ipn, $min, $max); - - else{ - fseek($this->fh, $this->db_begin + $min * $this->block_len); - - return $this->search_db(fread($this->fh, $len * $this->block_len), $ipn, 0, $len); - } - } - - protected function readData($seek, $max, $type) - { - $raw = ''; - if($seek && $max) - { - if ($this->memory_mode) - $raw = substr($type == 1 ? $this->regions_db : $this->cities_db, $seek, $max); - else{ - fseek($this->fh, $this->info[$type == 1 ? 'regions_begin' : 'cities_begin'] + $seek); - - $raw = fread($this->fh, $max); - } - } - - return $this->unpack($this->pack[$type], $raw); - } - - protected function parseCity($seek, $full = false) - { - if(!$this->pack) - return false; - - $only_country = false; - - if($seek < $this->country_size) - { - $country = $this->readData($seek, $this->max_country, 0); - $city = $this->unpack($this->pack[2]); - $city['lat'] = $country['lat']; - $city['lon'] = $country['lon']; - $only_country = true; - }else{ - $city = $this->readData($seek, $this->max_city, 2); - $country = array('id' => $city['country_id'], 'iso' => $this->id2iso[$city['country_id']]); - unset($city['country_id']); - } - - if($full){ - $region = $this->readData($city['region_seek'], $this->max_region, 1); - - if(!$only_country) - $country = $this->readData($region['country_seek'], $this->max_country, 0); - - unset($city['region_seek']); - unset($region['country_seek']); - - return array('city' => $city, 'region' => $region, 'country' => $country); - }else{ - unset($city['region_seek']); - - return array('city' => $city, 'country' => array('id' => $country['id'], 'iso' => $country['iso'])); - } - } - - protected function unpack($pack, $item = '') - { - $unpacked = array(); - $empty = empty($item); - $pack = explode('/', $pack); - $pos = 0; - - foreach($pack AS $p) - { - list($type, $name) = explode(':', $p); - - $type0 = $type[0]; - - if($empty) - { - $unpacked[$name] = $type0 == 'b' || $type0 == 'c' ? '' : 0; - - continue; - } - - switch($type0) - { - case 't': - case 'T': $l = 1; break; - case 's': - case 'n': - case 'S': $l = 2; break; - case 'm': - case 'M': $l = 3; break; - case 'd': $l = 8; break; - case 'c': $l = (int)substr($type, 1); break; - case 'b': $l = strpos($item, "\0", $pos)-$pos; break; - default: $l = 4; - } - - $val = substr($item, $pos, $l); - - switch($type0) - { - case 't': $v = unpack('c', $val); break; - case 'T': $v = unpack('C', $val); break; - case 's': $v = unpack('s', $val); break; - case 'S': $v = unpack('S', $val); break; - case 'm': $v = unpack('l', $val . (ord($val[2]) >> 7 ? "\xff" : "\0")); break; - case 'M': $v = unpack('L', $val . "\0"); break; - case 'i': $v = unpack('l', $val); break; - case 'I': $v = unpack('L', $val); break; - case 'f': $v = unpack('f', $val); break; - case 'd': $v = unpack('d', $val); break; - - case 'n': $v = current(unpack('s', $val)) / pow(10, $type[1]); break; - case 'N': $v = current(unpack('l', $val)) / pow(10, $type[1]); break; - - case 'c': $v = rtrim($val, ' '); break; - case 'b': $v = $val; $l++; break; - } - - $pos += $l; - $unpacked[$name] = is_array($v) ? current($v) : $v; - } - - return $unpacked; - } - - public function get($ip) - { - return $this->max_city ? $this->getCity($ip) : $this->getCountry($ip); - } - - public function getCountry($ip) - { - if($this->max_city) - { - $tmp = $this->parseCity($this->get_num($ip)); - - return $tmp['country']['iso']; - }else - return $this->id2iso[$this->get_num($ip)]; - } - - public function getCountryId($ip) - { - if($this->max_city) - { - $tmp = $this->parseCity($this->get_num($ip)); - - return $tmp['country']['id']; - }else - return $this->get_num($ip); - } - - public function getCity($ip) - { - $seek = $this->get_num($ip); - - return $seek ? $this->parseCity($seek) : false; - } - - public function getCityFull($ip) - { - $seek = $this->get_num($ip); - - return $seek ? $this->parseCity($seek, 1) : false; - } - - public function about() - { - $charset = array('utf-8', 'latin1', 'cp1251'); - $types = array('n/a', 'SxGeo Country', 'SxGeo City RU', 'SxGeo City EN', 'SxGeo City', 'SxGeo City Max RU', 'SxGeo City Max EN', 'SxGeo City Max'); - - return array( - 'Created' => date('Y.m.d', $this->info['time']), - 'Timestamp' => $this->info['time'], - 'Charset' => $charset[$this->info['charset']], - 'Type' => $types[$this->info['type']], - 'Byte Index' => $this->b_idx_len, - 'Main Index' => $this->m_idx_len, - 'Blocks In Index Item' => $this->range, - 'IP Blocks' => $this->db_items, - 'Block Size' => $this->block_len, - - 'City' => array( - 'Max Length' => $this->max_city, - 'Total Size' => $this->info['city_size'], - ), - - 'Region' => array( - 'Max Length' => $this->max_region, - 'Total Size' => $this->info['region_size'], - ), - - 'Country' => array( - 'Max Length' => $this->max_country, - 'Total Size' => $this->info['country_size'], - ), - ); - } - } + exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404')); + + define('SXGEO_FILE', 0); + define('SXGEO_MEMORY', 1); + define('SXGEO_BATCH', 2); + + class SxGeo + { + protected $fh; + protected $ip1c; + protected $info; + protected $range; + protected $db_begin; + protected $b_idx_str; + protected $m_idx_str; + protected $b_idx_arr; + protected $m_idx_arr; + protected $m_idx_len; + protected $db_items; + protected $country_size; + protected $db; + protected $regions_db; + protected $cities_db; + + public $id2iso = array( + '', 'AP', 'EU', 'AD', 'AE', 'AF', 'AG', 'AI', 'AL', 'AM', 'CW', 'AO', 'AQ', 'AR', 'AS', 'AT', 'AU', + 'AW', 'AZ', 'BA', 'BB', 'BD', 'BE', 'BF', 'BG', 'BH', 'BI', 'BJ', 'BM', 'BN', 'BO', 'BR', 'BS', + 'BT', 'BV', 'BW', 'BY', 'BZ', 'CA', 'CC', 'CD', 'CF', 'CG', 'CH', 'CI', 'CK', 'CL', 'CM', 'CN', + 'CO', 'CR', 'CU', 'CV', 'CX', 'CY', 'CZ', 'DE', 'DJ', 'DK', 'DM', 'DO', 'DZ', 'EC', 'EE', 'EG', + 'EH', 'ER', 'ES', 'ET', 'FI', 'FJ', 'FK', 'FM', 'FO', 'FR', 'SX', 'GA', 'GB', 'GD', 'GE', 'GF', + 'GH', 'GI', 'GL', 'GM', 'GN', 'GP', 'GQ', 'GR', 'GS', 'GT', 'GU', 'GW', 'GY', 'HK', 'HM', 'HN', + 'HR', 'HT', 'HU', 'ID', 'IE', 'IL', 'IN', 'IO', 'IQ', 'IR', 'IS', 'IT', 'JM', 'JO', 'JP', 'KE', + 'KG', 'KH', 'KI', 'KM', 'KN', 'KP', 'KR', 'KW', 'KY', 'KZ', 'LA', 'LB', 'LC', 'LI', 'LK', 'LR', + 'LS', 'LT', 'LU', 'LV', 'LY', 'MA', 'MC', 'MD', 'MG', 'MH', 'MK', 'ML', 'MM', 'MN', 'MO', 'MP', + 'MQ', 'MR', 'MS', 'MT', 'MU', 'MV', 'MW', 'MX', 'MY', 'MZ', 'NA', 'NC', 'NE', 'NF', 'NG', 'NI', + 'NL', 'NO', 'NP', 'NR', 'NU', 'NZ', 'OM', 'PA', 'PE', 'PF', 'PG', 'PH', 'PK', 'PL', 'PM', 'PN', + 'PR', 'PS', 'PT', 'PW', 'PY', 'QA', 'RE', 'RO', 'RU', 'RW', 'SA', 'SB', 'SC', 'SD', 'SE', 'SG', + 'SH', 'SI', 'SJ', 'SK', 'SL', 'SM', 'SN', 'SO', 'SR', 'ST', 'SV', 'SY', 'SZ', 'TC', 'TD', 'TF', + 'TG', 'TH', 'TJ', 'TK', 'TM', 'TN', 'TO', 'TL', 'TR', 'TT', 'TV', 'TW', 'TZ', 'UA', 'UG', 'UM', + 'US', 'UY', 'UZ', 'VA', 'VC', 'VE', 'VG', 'VI', 'VN', 'VU', 'WF', 'WS', 'YE', 'YT', 'RS', 'ZA', + 'ZM', 'ME', 'ZW', 'A1', 'XK', 'O1', 'AX', 'GG', 'IM', 'JE', 'BL', 'MF', 'BQ', 'SS' + ); + + public $batch_mode = false; + public $memory_mode = false; + + public function __construct($db_file = 'SxGeo.dat', $type = SXGEO_FILE) + { + $this->fh = fopen($db_file, 'rb'); + + $header = fread($this->fh, 40); + if(substr($header, 0, 3) != 'SxG') + die("Can't open {$db_file}\n"); + + $info = unpack('Cver/Ntime/Ctype/Ccharset/Cb_idx_len/nm_idx_len/nrange/Ndb_items/Cid_len/nmax_region/nmax_city/Nregion_size/Ncity_size/nmax_country/Ncountry_size/npack_size', substr($header, 3)); + + if($info['b_idx_len'] * $info['m_idx_len'] * $info['range'] * $info['db_items'] * $info['time'] * $info['id_len'] == 0) + die("Wrong file format {$db_file}\n"); + + $this->range = $info['range']; + $this->b_idx_len = $info['b_idx_len']; + $this->m_idx_len = $info['m_idx_len']; + $this->db_items = $info['db_items']; + $this->id_len = $info['id_len']; + $this->block_len = 3 + $this->id_len; + $this->max_region = $info['max_region']; + $this->max_city = $info['max_city']; + $this->max_country = $info['max_country']; + $this->country_size = $info['country_size']; + $this->batch_mode = $type & SXGEO_BATCH; + $this->memory_mode = $type & SXGEO_MEMORY; + $this->pack = $info['pack_size'] ? explode("\0", fread($this->fh, $info['pack_size'])) : ''; + $this->b_idx_str = fread($this->fh, $info['b_idx_len'] * 4); + $this->m_idx_str = fread($this->fh, $info['m_idx_len'] * 4); + $this->db_begin = ftell($this->fh); + + if($this->batch_mode) + { + $this->b_idx_arr = array_values(unpack("N*", $this->b_idx_str)); + + unset($this->b_idx_str); + + $this->m_idx_arr = str_split($this->m_idx_str, 4); + + unset($this->m_idx_str); + } + + if($this->memory_mode) + { + $this->db = fread($this->fh, $this->db_items * $this->block_len); + $this->regions_db = $info['region_size'] > 0 ? fread($this->fh, $info['region_size']) : ''; + $this->cities_db = $info['city_size'] > 0 ? fread($this->fh, $info['city_size']) : ''; + } + + $this->info = $info; + + $this->info['regions_begin'] = $this->db_begin + $this->db_items * $this->block_len; + $this->info['cities_begin'] = $this->info['regions_begin'] + $info['region_size']; + } + + protected function search_idx($ipn, $min, $max) + { + if($this->batch_mode) + { + while($max - $min > 8) + { + $offset = ($min + $max) >> 1; + + if($ipn > $this->m_idx_arr[$offset]) + $min = $offset; + else + $max = $offset; + } + + while ($ipn > $this->m_idx_arr[$min] && $min++ < $max){}; + }else{ + while($max - $min > 8) + { + $offset = ($min + $max) >> 1; + + if($ipn > substr($this->m_idx_str, $offset*4, 4)) + $min = $offset; + else + $max = $offset; + } + + while($ipn > substr($this->m_idx_str, $min*4, 4) && $min++ < $max){}; + } + + return $min; + } + + protected function search_db($str, $ipn, $min, $max) + { + if($max - $min > 1) + { + $ipn = substr($ipn, 1); + + while($max - $min > 8) + { + $offset = ($min + $max) >> 1; + if($ipn > substr($str, $offset * $this->block_len, 3)) + $min = $offset; + else + $max = $offset; + } + + while($ipn >= substr($str, $min * $this->block_len, 3) && ++$min < $max){}; + }else + $min++; + + return hexdec(bin2hex(substr($str, $min * $this->block_len - $this->id_len, $this->id_len))); + } + + public function get_num($ip) + { + $ip1n = (int)$ip; + + if($ip1n == 0 || $ip1n == 10 || $ip1n == 127 || $ip1n >= $this->b_idx_len || false === ($ipn = ip2long($ip))) + return false; + + $ipn = pack('N', $ipn); + $this->ip1c = chr($ip1n); + + if($this->batch_mode) + $blocks = array('min' => $this->b_idx_arr[$ip1n-1], 'max' => $this->b_idx_arr[$ip1n]); + else + $blocks = unpack("Nmin/Nmax", substr($this->b_idx_str, ($ip1n - 1) * 4, 8)); + + if($blocks['max'] - $blocks['min'] > $this->range) + { + $part = $this->search_idx($ipn, floor($blocks['min'] / $this->range), floor($blocks['max'] / $this->range)-1); + + $min = $part > 0 ? $part * $this->range : 0; + $max = $part > $this->m_idx_len ? $this->db_items : ($part+1) * $this->range; + + if($min < $blocks['min']) + $min = $blocks['min']; + + if($max > $blocks['max']) + $max = $blocks['max']; + }else{ + $min = $blocks['min']; + $max = $blocks['max']; + } + + $len = $max - $min; + + if($this->memory_mode) + return $this->search_db($this->db, $ipn, $min, $max); + + else{ + fseek($this->fh, $this->db_begin + $min * $this->block_len); + + return $this->search_db(fread($this->fh, $len * $this->block_len), $ipn, 0, $len); + } + } + + protected function readData($seek, $max, $type) + { + $raw = ''; + if($seek && $max) + { + if ($this->memory_mode) + $raw = substr($type == 1 ? $this->regions_db : $this->cities_db, $seek, $max); + else{ + fseek($this->fh, $this->info[$type == 1 ? 'regions_begin' : 'cities_begin'] + $seek); + + $raw = fread($this->fh, $max); + } + } + + return $this->unpack($this->pack[$type], $raw); + } + + protected function parseCity($seek, $full = false) + { + if(!$this->pack) + return false; + + $only_country = false; + + if($seek < $this->country_size) + { + $country = $this->readData($seek, $this->max_country, 0); + $city = $this->unpack($this->pack[2]); + $city['lat'] = $country['lat']; + $city['lon'] = $country['lon']; + $only_country = true; + }else{ + $city = $this->readData($seek, $this->max_city, 2); + $country = array('id' => $city['country_id'], 'iso' => $this->id2iso[$city['country_id']]); + unset($city['country_id']); + } + + if($full){ + $region = $this->readData($city['region_seek'], $this->max_region, 1); + + if(!$only_country) + $country = $this->readData($region['country_seek'], $this->max_country, 0); + + unset($city['region_seek']); + unset($region['country_seek']); + + return array('city' => $city, 'region' => $region, 'country' => $country); + }else{ + unset($city['region_seek']); + + return array('city' => $city, 'country' => array('id' => $country['id'], 'iso' => $country['iso'])); + } + } + + protected function unpack($pack, $item = '') + { + $unpacked = array(); + $empty = empty($item); + $pack = explode('/', $pack); + $pos = 0; + + foreach($pack AS $p) + { + list($type, $name) = explode(':', $p); + + $type0 = $type[0]; + + if($empty) + { + $unpacked[$name] = $type0 == 'b' || $type0 == 'c' ? '' : 0; + + continue; + } + + switch($type0) + { + case 't': + case 'T': $l = 1; break; + case 's': + case 'n': + case 'S': $l = 2; break; + case 'm': + case 'M': $l = 3; break; + case 'd': $l = 8; break; + case 'c': $l = (int)substr($type, 1); break; + case 'b': $l = strpos($item, "\0", $pos)-$pos; break; + default: $l = 4; + } + + $val = substr($item, $pos, $l); + + switch($type0) + { + case 't': $v = unpack('c', $val); break; + case 'T': $v = unpack('C', $val); break; + case 's': $v = unpack('s', $val); break; + case 'S': $v = unpack('S', $val); break; + case 'm': $v = unpack('l', $val . (ord($val[2]) >> 7 ? "\xff" : "\0")); break; + case 'M': $v = unpack('L', $val . "\0"); break; + case 'i': $v = unpack('l', $val); break; + case 'I': $v = unpack('L', $val); break; + case 'f': $v = unpack('f', $val); break; + case 'd': $v = unpack('d', $val); break; + + case 'n': $v = current(unpack('s', $val)) / pow(10, $type[1]); break; + case 'N': $v = current(unpack('l', $val)) / pow(10, $type[1]); break; + + case 'c': $v = rtrim($val, ' '); break; + case 'b': $v = $val; $l++; break; + } + + $pos += $l; + $unpacked[$name] = is_array($v) ? current($v) : $v; + } + + return $unpacked; + } + + public function get($ip) + { + return $this->max_city ? $this->getCity($ip) : $this->getCountry($ip); + } + + public function getCountry($ip) + { + if($this->max_city) + { + $tmp = $this->parseCity($this->get_num($ip)); + + return $tmp['country']['iso']; + }else + return $this->id2iso[$this->get_num($ip)]; + } + + public function getCountryId($ip) + { + if($this->max_city) + { + $tmp = $this->parseCity($this->get_num($ip)); + + return $tmp['country']['id']; + }else + return $this->get_num($ip); + } + + public function getCity($ip) + { + $seek = $this->get_num($ip); + + return $seek ? $this->parseCity($seek) : false; + } + + public function getCityFull($ip) + { + $seek = $this->get_num($ip); + + return $seek ? $this->parseCity($seek, 1) : false; + } + + public function about() + { + $charset = array('utf-8', 'latin1', 'cp1251'); + $types = array('n/a', 'SxGeo Country', 'SxGeo City RU', 'SxGeo City EN', 'SxGeo City', 'SxGeo City Max RU', 'SxGeo City Max EN', 'SxGeo City Max'); + + return array( + 'Created' => date('Y.m.d', $this->info['time']), + 'Timestamp' => $this->info['time'], + 'Charset' => $charset[$this->info['charset']], + 'Type' => $types[$this->info['type']], + 'Byte Index' => $this->b_idx_len, + 'Main Index' => $this->m_idx_len, + 'Blocks In Index Item' => $this->range, + 'IP Blocks' => $this->db_items, + 'Block Size' => $this->block_len, + + 'City' => array( + 'Max Length' => $this->max_city, + 'Total Size' => $this->info['city_size'], + ), + + 'Region' => array( + 'Max Length' => $this->max_region, + 'Total Size' => $this->info['region_size'], + ), + + 'Country' => array( + 'Max Length' => $this->max_country, + 'Total Size' => $this->info['country_size'], + ), + ); + } + } ?> \ No newline at end of file diff --git a/system/library/help.php b/system/library/help.php index d94f78d..03140cd 100644 --- a/system/library/help.php +++ b/system/library/help.php @@ -1,100 +1,100 @@ $str) - { - $check = str_replace(' ', '', $str); + foreach($aStr as $line => $str) + { + $check = str_replace(' ', '', $str); - if(isset($aStr[$line+1]) AND ($check == '' AND str_replace(' ', '', $aStr[$line+1]) == '')) - continue; - else{ - $etext .= rtrim(str_replace("\t", ' ', $str))."\n"; + if(isset($aStr[$line+1]) AND ($check == '' AND str_replace(' ', '', $aStr[$line+1]) == '')) + continue; + else{ + $etext .= rtrim(str_replace("\t", ' ', $str))."\n"; - continue; - } + continue; + } - if($check != '') - $etext .= rtrim(str_replace("\t", ' ', $str))."\n"; - } + if($check != '') + $etext .= rtrim(str_replace("\t", ' ', $str))."\n"; + } - $str_search = array( - "#\\\n#is", - "#\[spoiler\](.+?)\[\/spoiler\]#is", - "#\[sp\](.+?)\[\/sp\]#is", - "#\[b\](.+?)\[\/b\]#is", - "#\[u\](.+?)\[\/u\]#is", - "#\[code\](.+?)\[\/code\]#is", - "#\[quote\](.+?)\[\/quote\]#is", - "#\[url=(.+?)\](.+?)\[\/url\]#is", - "#(^|[\n ])([\w]+?://[\w\#$%&~/.\-;:=,?@\[\]+]*)#is" - ); + $str_search = array( + "#\\\n#is", + "#\[spoiler\](.+?)\[\/spoiler\]#is", + "#\[sp\](.+?)\[\/sp\]#is", + "#\[b\](.+?)\[\/b\]#is", + "#\[u\](.+?)\[\/u\]#is", + "#\[code\](.+?)\[\/code\]#is", + "#\[quote\](.+?)\[\/quote\]#is", + "#\[url=(.+?)\](.+?)\[\/url\]#is", + "#(^|[\n ])([\w]+?://[\w\#$%&~/.\-;:=,?@\[\]+]*)#is" + ); - $str_replace = array( - "
    ", - "

    Посмотреть содержимое
    \\1
    ", - "
    Посмотреть содержимое
    \\1
    ", - "\\1", - "\\1", - "
    Посмотреть содержимое
    \\1
    ", - "

    \\1

    ", - "\\2", - " \\2" - ); + $str_replace = array( + "
    ", + "
    Посмотреть содержимое
    \\1
    ", + "
    Посмотреть содержимое
    \\1
    ", + "\\1", + "\\1", + "
    Посмотреть содержимое
    \\1
    ", + "

    \\1

    ", + "\\2", + " \\2" + ); - return preg_replace($str_search, $str_replace, $etext); - } + return preg_replace($str_search, $str_replace, $etext); + } - public static function ago($time, $brackets = false) - { - global $start_point; + public static function ago($time, $brackets = false) + { + global $start_point; - $diff = $start_point-$time; + $diff = $start_point-$time; - if($diff < 0) - return ''; + if($diff < 0) + return ''; - if(!$diff) - $diff = 1; + if(!$diff) + $diff = 1; - $seconds = array('секунду', 'секунды', 'секунд'); - $minutes = array('минуту', 'минуты', 'минут'); - $hours = array('час', 'часа', 'часов'); - $days = array('день', 'дня', 'дней'); - $weeks = array('неделю', 'недели', 'недель'); - $months = array('месяц', 'месяца', 'месяцев'); - $years = array('год', 'года', 'лет'); + $seconds = array('секунду', 'секунды', 'секунд'); + $minutes = array('минуту', 'минуты', 'минут'); + $hours = array('час', 'часа', 'часов'); + $days = array('день', 'дня', 'дней'); + $weeks = array('неделю', 'недели', 'недель'); + $months = array('месяц', 'месяца', 'месяцев'); + $years = array('год', 'года', 'лет'); - $phrase = array($seconds, $minutes, $hours, $days, $weeks, $months, $years); - $length = array(1, 60, 3600, 86400, 604800, 2630880, 31570560); + $phrase = array($seconds, $minutes, $hours, $days, $weeks, $months, $years); + $length = array(1, 60, 3600, 86400, 604800, 2630880, 31570560); - for($i = 6; ($i >= 0) AND (($no = $diff/$length[$i]) <= 1); $i-=1); + for($i = 6; ($i >= 0) AND (($no = $diff/$length[$i]) <= 1); $i-=1); - if($i < 0) - $i = 0; + if($i < 0) + $i = 0; - $_time = $start_point-($diff % $length[$i]); - $no = ceil($no); + $_time = $start_point-($diff % $length[$i]); + $no = ceil($no); - if($brackets) - return '('.$no.' '.help::parse_ago($no, $phrase[$i]).' назад)'; + if($brackets) + return '('.$no.' '.help::parse_ago($no, $phrase[$i]).' назад)'; - return $no.' '.help::parse_ago($no, $phrase[$i]).' назад'; - } + return $no.' '.help::parse_ago($no, $phrase[$i]).' назад'; + } - private static function parse_ago($number, $titles) - { - $cases = array(2, 0, 1, 1, 1, 2); + private static function parse_ago($number, $titles) + { + $cases = array(2, 0, 1, 1, 1, 2); - return $titles[($number % 100 > 4 AND $number % 100 < 20 ) ? 2 : $cases[min($number % 10, 5)]]; - } - } + return $titles[($number % 100 > 4 AND $number % 100 < 20 ) ? 2 : $cases[min($number % 10, 5)]]; + } + } ?> \ No newline at end of file diff --git a/system/library/html.php b/system/library/html.php index 58d6016..da88687 100644 --- a/system/library/html.php +++ b/system/library/html.php @@ -1,173 +1,173 @@ data['['.$name.']'] = $var; + public function set($name, $var, $unset = false) + { + $this->data['['.$name.']'] = $var; - if($unset) - unset($this->arr[$name]); + if($unset) + unset($this->arr[$name]); - return NULL; - } + return NULL; + } - public function unit($name, $var = false, $mirror = false) - { - $block = str_replace($name, "'\\|".$name."\\|(.*?)\\|_".$name."\\|'si", $name); + public function unit($name, $var = false, $mirror = false) + { + $block = str_replace($name, "'\\|".$name."\\|(.*?)\\|_".$name."\\|'si", $name); - $var = $var ? '\\1' : ''; + $var = $var ? '\\1' : ''; - $this->unitblock[$block] = $var; + $this->unitblock[$block] = $var; - if($mirror) - { - $block = str_replace($name, "'\\|!".$name."\\|(.*?)\\|_!".$name."\\|'si", $name); + if($mirror) + { + $block = str_replace($name, "'\\|!".$name."\\|(.*?)\\|_!".$name."\\|'si", $name); - $var = !$var ? '\\1' : ''; + $var = !$var ? '\\1' : ''; - $this->unitblock[$block] = $var; - } + $this->unitblock[$block] = $var; + } - return NULL; - } + return NULL; + } - public function nav($name, $link = false) - { - $this->get('nav'); - if($link) - { - $this->set('link', $link); - $this->unit('link', 1, 1); - }else - $this->unit('link', 0, 1); - $this->set('name', $name); - $this->pack('nav'); + public function nav($name, $link = false) + { + $this->get('nav'); + if($link) + { + $this->set('link', $link); + $this->unit('link', 1, 1); + }else + $this->unit('link', 0, 1); + $this->set('name', $name); + $this->pack('nav'); - return NULL; - } + return NULL; + } - public function get($name, $path = '') - { - global $device, $cfg; + public function get($name, $path = '') + { + global $device, $cfg; - $path_root = $device == '!mobile' ? '' : 'megp/'; + $path_root = $device == '!mobile' ? '' : 'megp/'; - $path = $path_root.$path; + $path = $path_root.$path; - if($path != '') - $name = str_replace('//', '/', $path.'/'.$name); + if($path != '') + $name = str_replace('//', '/', $path.'/'.$name); - if(!file_exists($this->dir.'/'.$name.'.html')) - { - $route = explode('/', $name); - $namefile = end($route); - $dir = $this->dir.str_replace($namefile, '', $name); + if(!file_exists($this->dir.'/'.$name.'.html')) + { + $route = explode('/', $name); + $namefile = end($route); + $dir = $this->dir.str_replace($namefile, '', $name); - die('Error: html file '.$namefile.'.html not found in: '.$dir.''); - } + die('Error: html file '.$namefile.'.html not found in: '.$dir.''); + } - $this->template = file_get_contents($this->dir.'/'.$name.'.html'); - $this->select_template = $this->template; + $this->template = file_get_contents($this->dir.'/'.$name.'.html'); + $this->select_template = $this->template; - return NULL; - } + return NULL; + } - private function delete() - { - unset($this->data); - unset($this->unitblock); + private function delete() + { + unset($this->data); + unset($this->unitblock); - $this->select_template = $this->template; + $this->select_template = $this->template; - return NULL; - } + return NULL; + } - public function pack($compile) - { - if(isset($this->unitblock)) - { - $find_preg = array(); - $replace_preg = array(); + public function pack($compile) + { + if(isset($this->unitblock)) + { + $find_preg = array(); + $replace_preg = array(); - foreach($this->unitblock as $key_find => $key_replace) - { - $find_preg[] = $key_find; - $replace_preg[] = $key_replace; - } + foreach($this->unitblock as $key_find => $key_replace) + { + $find_preg[] = $key_find; + $replace_preg[] = $key_replace; + } - $this->select_template = preg_replace($find_preg, $replace_preg, $this->select_template); - } + $this->select_template = preg_replace($find_preg, $replace_preg, $this->select_template); + } - $find = array(); - $replace = array(); + $find = array(); + $replace = array(); - if(isset($this->data)) - { - foreach($this->data as $key_find => $key_replace) - { - $find[] = $key_find; - $replace[] = $key_replace; - } - } + if(isset($this->data)) + { + foreach($this->data as $key_find => $key_replace) + { + $find[] = $key_find; + $replace[] = $key_replace; + } + } - $this->select_template = str_replace($find, $replace, $this->select_template); + $this->select_template = str_replace($find, $replace, $this->select_template); - if(isset($this->arr[$compile])) - $this->arr[$compile] .= $this->select_template; - else - $this->arr[$compile] = $this->select_template; + if(isset($this->arr[$compile])) + $this->arr[$compile] .= $this->select_template; + else + $this->arr[$compile] = $this->select_template; - $this->delete(); + $this->delete(); - return NULL; - } + return NULL; + } - public function upd($name, $old = array(), $new = array()) - { - $this->arr[$name] = str_replace($old, $new, $this->arr[$name]); + public function upd($name, $old = array(), $new = array()) + { + $this->arr[$name] = str_replace($old, $new, $this->arr[$name]); - return NULL; - } + return NULL; + } - public function unitall($name, $arr = array(), $var = false, $mirror = false) - { - $block = str_replace($name, "'\\|".$name."\\|(.*?)\\|_".$name."\\|'si", $name); + public function unitall($name, $arr = array(), $var = false, $mirror = false) + { + $block = str_replace($name, "'\\|".$name."\\|(.*?)\\|_".$name."\\|'si", $name); - $var = $var ? '\\1' : ''; + $var = $var ? '\\1' : ''; - $this->unitblock[$block] = $var; + $this->unitblock[$block] = $var; - if($mirror) - { - $block = str_replace($name, "'\\|!".$name."\\|(.*?)\\|_!".$name."\\|'si", $name); + if($mirror) + { + $block = str_replace($name, "'\\|!".$name."\\|(.*?)\\|_!".$name."\\|'si", $name); - $var = !$var ? '\\1' : ''; + $var = !$var ? '\\1' : ''; - $this->unitblock[$block] = $var; - } + $this->unitblock[$block] = $var; + } - if(count($this->unitblock)) - { - foreach($this->unitblock as $key_find => $key_replace) - { - $find_preg[] = $key_find; - $replace_preg[] = $key_replace; - } + if(count($this->unitblock)) + { + foreach($this->unitblock as $key_find => $key_replace) + { + $find_preg[] = $key_find; + $replace_preg[] = $key_replace; + } - $this->arr[$arr] = preg_replace($find_preg, $replace_preg, $this->arr[$arr]); - } + $this->arr[$arr] = preg_replace($find_preg, $replace_preg, $this->arr[$arr]); + } - return NULL; - } - } + return NULL; + } + } - $html = new html; + $html = new html; ?> \ No newline at end of file diff --git a/system/library/smtp.php b/system/library/smtp.php index d2a3361..5e4f451 100644 --- a/system/library/smtp.php +++ b/system/library/smtp.php @@ -1,6 +1,6 @@ smtp_host, $this->smtp_port, $errorNumber, $errorDescription, 30)) throw new Exception($errorNumber.'.'.$errorDescription); diff --git a/system/library/sql.php b/system/library/sql.php index 477a78b..899a3c3 100644 --- a/system/library/sql.php +++ b/system/library/sql.php @@ -1,6 +1,6 @@ query_id; - $get = mysqli_fetch_assoc($query_id); + $get = mysqli_fetch_assoc($query_id); return $get; } @@ -69,10 +69,10 @@ private function out_error($error, $query = '') { - global $go; + global $go; - if($go) - sys::outjs(array('e' => 'Query: '.$query.'
    Error:
    '.$error)); + if($go) + sys::outjs(array('e' => 'Query: '.$query.'
    Error:
    '.$error)); if($query != '') echo 'Query: '.$query.'
    '; diff --git a/system/library/ssh.php b/system/library/ssh.php index 4385ea1..4ea6c45 100644 --- a/system/library/ssh.php +++ b/system/library/ssh.php @@ -1,99 +1,99 @@ connect($address) AND $this->auth_pwd('root', $passwd)) - return true; + public function auth($passwd, $address) + { + if($this->connect($address) AND $this->auth_pwd('root', $passwd)) + return true; - return false; - } + return false; + } - public function connect($address) - { - list($host, $port) = explode(':', $address); + public function connect($address) + { + list($host, $port) = explode(':', $address); - if($port == '') - $port = 22; + if($port == '') + $port = 22; - ini_set('default_socket_timeout', '3'); + ini_set('default_socket_timeout', '3'); - if($this->conn = ssh2_connect($host, $port)) - { - ini_set('default_socket_timeout', '180'); + if($this->conn = ssh2_connect($host, $port)) + { + ini_set('default_socket_timeout', '180'); - return true; - } + return true; + } - return false; - } + return false; + } - public function setfile($localFile, $remoteFile, $permision) - { - if(@ssh2_scp_send($this->conn, $localFile, $remoteFile, $permision)) - return true; + public function setfile($localFile, $remoteFile, $permision) + { + if(@ssh2_scp_send($this->conn, $localFile, $remoteFile, $permision)) + return true; - return false; - } + return false; + } - public function getfile($remoteFile, $localFile) - { - if(@ssh2_scp_recv($this->conn, $remoteFile, $localFile)) - return true; + public function getfile($remoteFile, $localFile) + { + if(@ssh2_scp_recv($this->conn, $remoteFile, $localFile)) + return true; - return false; - } + return false; + } - public function set($cmd) - { - $this->stream = ssh2_exec($this->conn, $cmd); + public function set($cmd) + { + $this->stream = ssh2_exec($this->conn, $cmd); - stream_set_blocking($this->stream, true); - } + stream_set_blocking($this->stream, true); + } - public function auth_pwd($u, $p) - { - if(@ssh2_auth_password($this->conn, $u, $p)) - return true; + public function auth_pwd($u, $p) + { + if(@ssh2_auth_password($this->conn, $u, $p)) + return true; - return false; - } + return false; + } - public function get($cmd = false) - { - if($cmd) - { - $this->stream = ssh2_exec($this->conn, $cmd); + public function get($cmd = false) + { + if($cmd) + { + $this->stream = ssh2_exec($this->conn, $cmd); - stream_set_blocking($this->stream, true); - } + stream_set_blocking($this->stream, true); + } - $line = ''; + $line = ''; - while($get = fgets($this->stream)) - $line.= $get; + while($get = fgets($this->stream)) + $line.= $get; - return $line; - } + return $line; + } - public function esc() - { - if(function_exists('ssh2_disconnect')) - ssh2_disconnect($this->conn); - else{ - @fclose($this->conn); - unset($this->conn); - } + public function esc() + { + if(function_exists('ssh2_disconnect')) + ssh2_disconnect($this->conn); + else{ + @fclose($this->conn); + unset($this->conn); + } - return NULL; - } - } + return NULL; + } + } - $ssh = new ssh; + $ssh = new ssh; ?> \ No newline at end of file diff --git a/system/library/system.php b/system/library/system.php index ce51319..aa81e59 100644 --- a/system/library/system.php +++ b/system/library/system.php @@ -1,9 +1,9 @@ query('UPDATE `users` set `time`="'.$start_point.'" WHERE `id`="'.$user['id'].'" LIMIT 1'); + if($user['time']+10 < $start_point) + $sql->query('UPDATE `users` set `time`="'.$start_point.'" WHERE `id`="'.$user['id'].'" LIMIT 1'); - return NULL; - } + return NULL; + } - public static function users($users, $user, $authkey, $del = false) - { - global $mcache; + public static function users($users, $user, $authkey, $del = false) + { + global $mcache; - if($del) - unset($users[md5($user['login'].$user['authkey'].$user['passwd'])]); - else - $users[md5($user['login'].$user['authkey'].$user['passwd'])] = $user; + if($del) + unset($users[md5($user['login'].$user['authkey'].$user['passwd'])]); + else + $users[md5($user['login'].$user['authkey'].$user['passwd'])] = $user; - $mcache->set('users_auth', $users, false, 1000); + $mcache->set('users_auth', $users, false, 1000); - return NULL; - } + return NULL; + } - public static function nav($server, $sid, $active) - { - global $cfg, $html, $sql, $mcache, $start_point; + public static function nav($server, $sid, $active) + { + global $cfg, $html, $sql, $mcache, $start_point; - $notice_sid = $mcache->get('notice_'.$sid); + $notice_sid = $mcache->get('notice_'.$sid); - $notice = is_array($notice_sid) ? $notice_sid : $mcache->get('notice_'.$server['unit']); + $notice = is_array($notice_sid) ? $notice_sid : $mcache->get('notice_'.$server['unit']); - if(!is_array($notice)) - { - $sql->query('SELECT `server`, `text`, `color` FROM `notice` WHERE `server`="'.$sid.'" AND `time`>"'.$start_point.'" ORDER BY `id` DESC LIMIT 1'); + if(!is_array($notice)) + { + $sql->query('SELECT `server`, `text`, `color` FROM `notice` WHERE `server`="'.$sid.'" AND `time`>"'.$start_point.'" ORDER BY `id` DESC LIMIT 1'); - if(!$sql->num()) - $sql->query('SELECT `unit`, `text`, `color` FROM `notice` WHERE `unit`="'.$server['unit'].'" AND `time`>"'.$start_point.'" ORDER BY `id` DESC LIMIT 1'); + if(!$sql->num()) + $sql->query('SELECT `unit`, `text`, `color` FROM `notice` WHERE `unit`="'.$server['unit'].'" AND `time`>"'.$start_point.'" ORDER BY `id` DESC LIMIT 1'); - if($sql->num()) - { - $notice = $sql->get(); + if($sql->num()) + { + $notice = $sql->get(); - $nmc = $notice['server'] ? 'notice_'.$sid : 'notice_'.$server['unit']; + $nmc = $notice['server'] ? 'notice_'.$sid : 'notice_'.$server['unit']; - $mcache->set('notice_'.$nmc, $notice, false, 10); - }else - $mcache->set('notice_'.$server['unit'], NULL, false, 10); - } + $mcache->set('notice_'.$nmc, $notice, false, 10); + }else + $mcache->set('notice_'.$server['unit'], NULL, false, 10); + } - $aUnit = array('index', 'console', 'settings', 'plugins', 'maps', 'owners', 'filetp', 'tarif', 'copy', 'graph', 'web', 'boost'); + $aUnit = array('index', 'console', 'settings', 'plugins', 'maps', 'owners', 'filetp', 'tarif', 'copy', 'graph', 'web', 'boost'); - $html->get('gmenu', 'sections/servers/'.$server['game']); + $html->get('gmenu', 'sections/servers/'.$server['game']); - $html->set('id', $sid); - $html->set('home', $cfg['http']); + $html->set('id', $sid); + $html->set('home', $cfg['http']); - if(is_array($notice)) - { - global $device; + if(is_array($notice)) + { + global $device; - if($device == '!mobile') - $html->set('notice', '
    '.$notice['text'].'
    '); - else - $html->set('notice', '
    '.$notice['text'].'
    '); - }else - $html->set('notice', ''); + if($device == '!mobile') + $html->set('notice', '
    '.$notice['text'].'
    '); + else + $html->set('notice', '
    '.$notice['text'].'
    '); + }else + $html->set('notice', ''); - if($server['console_use']) $html->unit('console_use', 1); else $html->unit('console_use'); - if($server['plugins_use']) $html->unit('plugins_use', 1); else $html->unit('plugins_use'); - if($server['ftp_use']) $html->unit('ftp_use', 1); else $html->unit('ftp_use'); - if($server['stats_use']) $html->unit('graph_use', 1); else $html->unit('graph_use'); - if($server['web_use']) $html->unit('web_use', 1); else $html->unit('web_use'); - if($server['copy_use']) $html->unit('copy_use', 1); else $html->unit('copy_use'); + if($server['console_use']) $html->unit('console_use', 1); else $html->unit('console_use'); + if($server['plugins_use']) $html->unit('plugins_use', 1); else $html->unit('plugins_use'); + if($server['ftp_use']) $html->unit('ftp_use', 1); else $html->unit('ftp_use'); + if($server['stats_use']) $html->unit('graph_use', 1); else $html->unit('graph_use'); + if($server['web_use']) $html->unit('web_use', 1); else $html->unit('web_use'); + if($server['copy_use']) $html->unit('copy_use', 1); else $html->unit('copy_use'); - foreach($aUnit as $unit) - if($unit == $active) $html->unit($unit, 1); else $html->unit($unit); + foreach($aUnit as $unit) + if($unit == $active) $html->unit($unit, 1); else $html->unit($unit); - $html->pack('main'); + $html->pack('main'); - $html->get('vmenu', 'sections/servers/'.$server['game']); + $html->get('vmenu', 'sections/servers/'.$server['game']); - $html->set('id', $sid); - $html->set('home', $cfg['http']); + $html->set('id', $sid); + $html->set('home', $cfg['http']); - if($server['console_use']) $html->unit('console_use', 1); else $html->unit('console_use'); - if($server['plugins_use']) $html->unit('plugins_use', 1); else $html->unit('plugins_use'); - if($server['ftp_use']) $html->unit('ftp_use', 1); else $html->unit('ftp_use'); - if($server['stats_use']) $html->unit('graph_use', 1); else $html->unit('graph_use'); - if($server['web_use']) $html->unit('web_use', 1); else $html->unit('web_use'); - if($server['copy_use']) $html->unit('copy_use', 1); else $html->unit('copy_use'); + if($server['console_use']) $html->unit('console_use', 1); else $html->unit('console_use'); + if($server['plugins_use']) $html->unit('plugins_use', 1); else $html->unit('plugins_use'); + if($server['ftp_use']) $html->unit('ftp_use', 1); else $html->unit('ftp_use'); + if($server['stats_use']) $html->unit('graph_use', 1); else $html->unit('graph_use'); + if($server['web_use']) $html->unit('web_use', 1); else $html->unit('web_use'); + if($server['copy_use']) $html->unit('copy_use', 1); else $html->unit('copy_use'); - foreach($aUnit as $unit) - if($unit == $active) $html->unit($unit, 1); else $html->unit($unit); + foreach($aUnit as $unit) + if($unit == $active) $html->unit($unit, 1); else $html->unit($unit); - $html->pack('vmenu'); + $html->pack('vmenu'); - return NULL; - } + return NULL; + } - public static function route($server, $inc, $go, $all = false) - { - global $device, $start_point; + public static function route($server, $inc, $go, $all = false) + { + global $device, $start_point; - $dir = $device == '!mobile' ? '' : 'megp/'; - $use = true; + $dir = $device == '!mobile' ? '' : 'megp/'; + $use = true; - if(in_array($inc, array('plugins', 'ftp', 'console', 'graph', 'copy', 'web'))) - { - $server['graph_use'] = $server['stats_use']; + if(in_array($inc, array('plugins', 'ftp', 'console', 'graph', 'copy', 'web'))) + { + $server['graph_use'] = $server['stats_use']; - if(!$server[$inc.'_use']) - $use = false; - } + if(!$server[$inc.'_use']) + $use = false; + } - if(!$use || $server['time'] < $start_point || in_array($server['status'], array('install', 'reinstall', 'update', 'recovery', 'blocked'))) - { - if($go) - sys::out('Раздел недоступен'); + if(!$use || $server['time'] < $start_point || in_array($server['status'], array('install', 'reinstall', 'update', 'recovery', 'blocked'))) + { + if($go) + sys::out('Раздел недоступен'); - if(!$use) - return SEC.$dir.'servers/'.$server['game'].'/index.php'; + if(!$use) + return SEC.$dir.'servers/'.$server['game'].'/index.php'; - return SEC.$dir.'servers/noaccess.php'; - } + return SEC.$dir.'servers/noaccess.php'; + } - if($all) - return SEC.'servers/games/'.$inc.'.php'; + if($all) + return SEC.'servers/games/'.$inc.'.php'; - if(!file_exists(SEC.$dir.'servers/'.$server['game'].'/'.$inc.'.php')) - return SEC.$dir.'servers/'.$server['game'].'/index.php'; + if(!file_exists(SEC.$dir.'servers/'.$server['game'].'/'.$inc.'.php')) + return SEC.$dir.'servers/'.$server['game'].'/index.php'; - return SEC.$dir.'servers/'.$server['game'].'/'.$inc.'.php'; - } + return SEC.$dir.'servers/'.$server['game'].'/'.$inc.'.php'; + } - public static function int($data, $width = false) - { - if($width) - return preg_replace("([^0-9]{0, ".$width."})", '', $data); + public static function int($data, $width = false) + { + if($width) + return preg_replace("([^0-9]{0, ".$width."})", '', $data); - return preg_replace("([^0-9])", '', $data); - } + return preg_replace("([^0-9])", '', $data); + } - public static function b64js($data) - { - return base64_encode(json_encode($data)); - } + public static function b64js($data) + { + return base64_encode(json_encode($data)); + } - public static function b64djs($data) - { - return json_decode(base64_decode($data), true); - } + public static function b64djs($data) + { + return json_decode(base64_decode($data), true); + } - public static function hb64($data) - { - return base64_encode(htmlspecialchars($data)); - } + public static function hb64($data) + { + return base64_encode(htmlspecialchars($data)); + } - public static function hb64d($data) - { - return htmlspecialchars_decode(base64_decode($data)); - } + public static function hb64d($data) + { + return htmlspecialchars_decode(base64_decode($data)); + } - public static function outjs($val, $cache = false) - { - global $mcache; + public static function outjs($val, $cache = false) + { + global $mcache; - if($cache) - $mcache->delete($cache); + if($cache) + $mcache->delete($cache); - die(json_encode($val)); - } + die(json_encode($val)); + } - public static function out($val = '', $cache = false) - { - global $mcache; + public static function out($val = '', $cache = false) + { + global $mcache; - if($cache) - $mcache->delete($cache); + if($cache) + $mcache->delete($cache); - die(''.$val.''); - } + die(''.$val.''); + } - public static function outhtml($text, $time = 3, $url = false, $cache = false) - { - global $device, $mcache, $html, $cfg; + public static function outhtml($text, $time = 3, $url = false, $cache = false) + { + global $device, $mcache, $html, $cfg; - if($cache) - $mcache->delete($cache); + if($cache) + $mcache->delete($cache); - $tpl = $device == '!mobile' ? '' : '/megp'; + $tpl = $device == '!mobile' ? '' : '/megp'; - $html->get('out'); + $html->get('out'); - $html->set('title', $cfg['name']); - $html->set('home', $cfg['http']); - $html->set('css', $cfg['http'].'template'.$tpl.'/css/'); - $html->set('js', $cfg['http'].'template'.$tpl.'/js/'); - $html->set('img', $cfg['http'].'template'.$tpl.'/images/'); - $html->set('text', $text); + $html->set('title', $cfg['name']); + $html->set('home', $cfg['http']); + $html->set('css', $cfg['http'].'template'.$tpl.'/css/'); + $html->set('js', $cfg['http'].'template'.$tpl.'/js/'); + $html->set('img', $cfg['http'].'template'.$tpl.'/images/'); + $html->set('text', $text); - $html->pack('out'); + $html->pack('out'); - if(!$url) - $url = $cfg['http']; + if(!$url) + $url = $cfg['http']; - header('Refresh: '.$time.'; URL='.$url); + header('Refresh: '.$time.'; URL='.$url); - die($html->arr['out']); - } + die($html->arr['out']); + } - public static function valid($val, $type, $preg = '') - { + public static function valid($val, $type, $preg = '') + { $val = (isset($val) ? $val : ''); - switch($type) - { - case 'promo': - if(!preg_match("/^[A-Za-z0-9]{2,20}$/", $val)) - return true; + switch($type) + { + case 'promo': + if(!preg_match("/^[A-Za-z0-9]{2,20}$/", $val)) + return true; - return false; + return false; - case 'en': - if(!preg_match("/^[A-Za-z0-9]$/", $val)) - return true; + case 'en': + if(!preg_match("/^[A-Za-z0-9]$/", $val)) + return true; - return false; + return false; - case 'ru': - if(!preg_match("/^[А-Яа-я]$/u", $val)) - return true; + case 'ru': + if(!preg_match("/^[А-Яа-я]$/u", $val)) + return true; - return false; + return false; - case 'wm': - if(!preg_match('/^R[0-9]{12,12}$|^Z[0-9]{12,12}$|^U[0-9]{12,12}$/m', $val)) - return true; + case 'wm': + if(!preg_match('/^R[0-9]{12,12}$|^Z[0-9]{12,12}$|^U[0-9]{12,12}$/m', $val)) + return true; - return false; + return false; - case 'ip': - if(!preg_match('/^(25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[0-9]{2}|[0-9])(\.(25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[0-9]{2}|[0-9])){3}$/', $val)) - return true; + case 'ip': + if(!preg_match('/^(25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[0-9]{2}|[0-9])(\.(25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[0-9]{2}|[0-9])){3}$/', $val)) + return true; - return false; + return false; - case 'steamid': - if(!preg_match("/^STEAM_[0-9]:[0-9]:[0-9]{6,12}$|^HLTV$|^STEAM_ID_LAN$|^STEAM_ID_PENDING$|^VALVE_ID_LAN$|^VALVE_ID_PENDING$|^STEAM_666:88:666$/", $val)) - return true; + case 'steamid': + if(!preg_match("/^STEAM_[0-9]:[0-9]:[0-9]{6,12}$|^HLTV$|^STEAM_ID_LAN$|^STEAM_ID_PENDING$|^VALVE_ID_LAN$|^VALVE_ID_PENDING$|^STEAM_666:88:666$/", $val)) + return true; - return false; + return false; - case 'steamid3': - if(!preg_match("/^\[U:[01]:[0-9]{3,12}\]$/i", $val)) - return true; + case 'steamid3': + if(!preg_match("/^\[U:[01]:[0-9]{3,12}\]$/i", $val)) + return true; - return false; + return false; - case 'num': - if(!preg_match('/[^0-9]/', $val)) - return true; + case 'num': + if(!preg_match('/[^0-9]/', $val)) + return true; - return false; + return false; - case 'md5': - if(!preg_match("/^[a-z0-9]{32,32}$/", $val)) - return true; + case 'md5': + if(!preg_match("/^[a-z0-9]{32,32}$/", $val)) + return true; - return false; + return false; - case 'other': - if(!preg_match($preg, $val)) - return true; + case 'other': + if(!preg_match($preg, $val)) + return true; - return false; - } + return false; + } - return true; - } + return true; + } - public static function mail($name, $text, $mail) - { - global $cfg; + public static function mail($name, $text, $mail) + { + global $cfg; - require_once(LIB.'smtp.php'); + require_once(LIB.'smtp.php'); - $tpl = file_get_contents(DATA.'mail.ini', "r"); + $tpl = file_get_contents(DATA.'mail.ini', "r"); - $text = str_replace( - array('[name]', '[text]', '[http]', '[img]', '[css]'), - array($cfg['name'], $text, $cfg['http'], $cfg['http'].'template/images/', $cfg['http'].'template/css/'), - $tpl - ); + $text = str_replace( + array('[name]', '[text]', '[http]', '[img]', '[css]'), + array($cfg['name'], $text, $cfg['http'], $cfg['http'].'template/images/', $cfg['http'].'template/css/'), + $tpl + ); - $smtp = new smtp($cfg['smtp_login'], $cfg['smtp_passwd'], $cfg['smtp_url'], $cfg['smtp_mail'], 465); + $smtp = new smtp($cfg['smtp_login'], $cfg['smtp_passwd'], $cfg['smtp_url'], $cfg['smtp_mail'], 465); - $headers = "MIME-Version: 1.0\r\n"; - $headers .= "Content-type: text/html; charset=utf-8\r\n"; - $headers .= "From: ".$cfg['smtp_name']." <".$cfg['smtp_mail'].">\r\n"; + $headers = "MIME-Version: 1.0\r\n"; + $headers .= "Content-type: text/html; charset=utf-8\r\n"; + $headers .= "From: ".$cfg['smtp_name']." <".$cfg['smtp_mail'].">\r\n"; - if($smtp->send($mail, $name, $text, $headers)) - return true; + if($smtp->send($mail, $name, $text, $headers)) + return true; - return false; - } + return false; + } - public static function mail_domain($mail) - { - $domain = explode('@', $mail); + public static function mail_domain($mail) + { + $domain = explode('@', $mail); - $domain = end($domain); + $domain = end($domain); - if(in_array($domain, array('list.ru', 'bk.ru', 'inbox.ru'))) - $domain = 'mail.ru'; + if(in_array($domain, array('list.ru', 'bk.ru', 'inbox.ru'))) + $domain = 'mail.ru'; - switch($domain) - { - case 'mail.ru': - return $domain; + switch($domain) + { + case 'mail.ru': + return $domain; - case 'yandex.ru': - return 'mail.yandex.ru'; + case 'yandex.ru': + return 'mail.yandex.ru'; - case 'google.com': - return 'mail.google.com'; + case 'google.com': + return 'mail.google.com'; - default: - return ''; - } - } + default: + return ''; + } + } - public static function domain($domain) - { - $domain = explode('.', $domain); + public static function domain($domain) + { + $domain = explode('.', $domain); - unset($domain[0]); + unset($domain[0]); - return implode('.', $domain); - } + return implode('.', $domain); + } - public static function updtext($text, $data) - { - foreach($data as $name => $val) - $text = str_replace('['.$name.']', $val, $text); + public static function updtext($text, $data) + { + foreach($data as $name => $val) + $text = str_replace('['.$name.']', $val, $text); - return $text; - } + return $text; + } - public static function login($mail, $lchar) - { - if(!$lchar) - return str_replace(array('.', '_', '+', '-'), '', sys::first(explode('@', $mail))); + public static function login($mail, $lchar) + { + if(!$lchar) + return str_replace(array('.', '_', '+', '-'), '', sys::first(explode('@', $mail))); - $list = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuWwXxYyZz0123456789'; - $a = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuWwXxYyZz'; - $selections = strlen($list)-1; - $start = strlen($a)-1; - $b = rand(0, $start); - $start = $a[$b]; - $login = array(); + $list = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuWwXxYyZz0123456789'; + $a = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuWwXxYyZz'; + $selections = strlen($list)-1; + $start = strlen($a)-1; + $b = rand(0, $start); + $start = $a[$b]; + $login = array(); - $i = 0; + $i = 0; - for($i; $i <= 10; $i+=1) - { - $n = rand(0, $selections); - $login[] = $list[$n]; - } + for($i; $i <= 10; $i+=1) + { + $n = rand(0, $selections); + $login[] = $list[$n]; + } - return $start.implode('', $login); - } + return $start.implode('', $login); + } - public static function passwd($length = 8) - { - $list = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuWwXxYyZz0123456789'; - $a = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuWwXxYyZz'; - $selections = strlen($list)-1; - $start = strlen($a)-1; - $b = rand(0, $start); - $start = $a[$b]; - $passwd = array(); + public static function passwd($length = 8) + { + $list = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuWwXxYyZz0123456789'; + $a = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuWwXxYyZz'; + $selections = strlen($list)-1; + $start = strlen($a)-1; + $b = rand(0, $start); + $start = $a[$b]; + $passwd = array(); - $i = 0; + $i = 0; - for($i; $i <= $length-2; $i+=1) - { - $n = rand(0, $selections); - $passwd[] = $list[$n]; - } + for($i; $i <= $length-2; $i+=1) + { + $n = rand(0, $selections); + $passwd[] = $list[$n]; + } - return $start.implode('', $passwd); - } + return $start.implode('', $passwd); + } - public static function passwdkey($passwd) - { - return md5($passwd); - } + public static function passwdkey($passwd) + { + return md5($passwd); + } public static function cookie($name, $value, $expires) { @@ -447,1033 +447,1033 @@ \Delight\Cookie\Cookie::setcookie($name, $value, $expires, '/', $cfg['url'], self::isSecure(), true, $cfg['cookie_same_site']); } - public static function auth() - { - global $auth, $go, $text, $cfg; + public static function auth() + { + global $auth, $go, $text, $cfg; - if($auth) - { - if($go) - sys::outjs(array('e' => sys::text('output', 'auth'))); + if($auth) + { + if($go) + sys::outjs(array('e' => sys::text('output', 'auth'))); - global $device; + global $device; - $link = $device == '!mobile' ? 'user/section/lk' : ''; + $link = $device == '!mobile' ? 'user/section/lk' : ''; - exit(header('Refresh: 0; URL='.$cfg['http'].$link)); - } + exit(header('Refresh: 0; URL='.$cfg['http'].$link)); + } - return NULL; - } + return NULL; + } - public static function noauth() - { - global $auth, $go, $text, $cfg; + public static function noauth() + { + global $auth, $go, $text, $cfg; - if(!$auth) - { - if($go) - sys::outjs(array('e' => sys::text('output', 'noauth'))); + if(!$auth) + { + if($go) + sys::outjs(array('e' => sys::text('output', 'noauth'))); - global $device; + global $device; - $link = $device == '!mobile' ? 'user/section/auth' : 'auth'; + $link = $device == '!mobile' ? 'user/section/auth' : 'auth'; - exit(header('Refresh: 0; URL='.$cfg['http'].$link)); - } + exit(header('Refresh: 0; URL='.$cfg['http'].$link)); + } - return NULL; - } + return NULL; + } - public static function browser($agent) - { - if(strpos($agent, 'Firefox') !== false) - return 'Mozilla Firefox'; + public static function browser($agent) + { + if(strpos($agent, 'Firefox') !== false) + return 'Mozilla Firefox'; - if(strpos($agent, 'Opera') !== false) - return 'Opera'; + if(strpos($agent, 'Opera') !== false) + return 'Opera'; - if(strpos($agent, 'Chrome') !== false) - return 'Google Chrome'; + if(strpos($agent, 'Chrome') !== false) + return 'Google Chrome'; - if(strpos($agent, 'MSIE') !== false) - return 'Internet Explorer'; + if(strpos($agent, 'MSIE') !== false) + return 'Internet Explorer'; - if(strpos($agent, 'Safari') !== false) - return 'Safari'; + if(strpos($agent, 'Safari') !== false) + return 'Safari'; - return 'Неизвестный'; - } + return 'Неизвестный'; + } - public static function date($lenght, $date) - { - global $start_point; + public static function date($lenght, $date) + { + global $start_point; - $check_time = $date-$start_point; + $check_time = $date-$start_point; - if($check_time < 1) - return 'время истекло.'; + if($check_time < 1) + return 'время истекло.'; - $days = floor($check_time/86400); - $hours = floor(($check_time%86400)/3600); - $minutes = floor(($check_time%3600)/60); - $seconds = $check_time%60; + $days = floor($check_time/86400); + $hours = floor(($check_time%86400)/3600); + $minutes = floor(($check_time%3600)/60); + $seconds = $check_time%60; - $adata = array( - 'min' => array( - 'days' => array('день', 'дня', 'дней'), - 'hours' => array('ч.', 'ч.', 'ч.'), - 'minutes' => array('мин.', 'мин.', 'мин.'), - 'seconds' => array('сек.', 'сек.', 'сек.') - ), - 'max' => array( - 'days' => array('день', 'дня', 'дней'), - 'hours' => array('час', 'часа', 'часов'), - 'minutes' => array('минуту','минуты','минут'), - 'seconds' => array('секунду','секунды','секунд') - ) - ); + $adata = array( + 'min' => array( + 'days' => array('день', 'дня', 'дней'), + 'hours' => array('ч.', 'ч.', 'ч.'), + 'minutes' => array('мин.', 'мин.', 'мин.'), + 'seconds' => array('сек.', 'сек.', 'сек.') + ), + 'max' => array( + 'days' => array('день', 'дня', 'дней'), + 'hours' => array('час', 'часа', 'часов'), + 'minutes' => array('минуту','минуты','минут'), + 'seconds' => array('секунду','секунды','секунд') + ) + ); - $text = ''; + $text = ''; - if($days > 0) - $text .= sys::date_decl($days, $adata[$lenght]['days']); + if($days > 0) + $text .= sys::date_decl($days, $adata[$lenght]['days']); - if($days < 1 AND $hours > 0) - $text .= ' '.sys::date_decl($hours, $adata[$lenght]['hours']); + if($days < 1 AND $hours > 0) + $text .= ' '.sys::date_decl($hours, $adata[$lenght]['hours']); - if($days < 1 AND $minutes > 0) - $text .= ' '.sys::date_decl($minutes, $adata[$lenght]['minutes']); + if($days < 1 AND $minutes > 0) + $text .= ' '.sys::date_decl($minutes, $adata[$lenght]['minutes']); - if($days < 1 AND $seconds > 0) - $text .= ' '.sys::date_decl($seconds, $adata[$lenght]['seconds']); + if($days < 1 AND $seconds > 0) + $text .= ' '.sys::date_decl($seconds, $adata[$lenght]['seconds']); - return $text; - } + return $text; + } - public static function date_decl($digit, $expr, $onlyword = false) - { - if(!is_array($expr)) - $expr = array_filter(explode(' ', $expr)); + public static function date_decl($digit, $expr, $onlyword = false) + { + if(!is_array($expr)) + $expr = array_filter(explode(' ', $expr)); - if(empty($expr[2])) - $expr[2] = $expr[1]; + if(empty($expr[2])) + $expr[2] = $expr[1]; - $i = sys::int($digit)%100; + $i = sys::int($digit)%100; - if($onlyword) - $digit = ''; + if($onlyword) + $digit = ''; - if($i > 4 AND $i < 21) - $res = $digit.' '.$expr[2]; - else - $i%=10; + if($i > 4 AND $i < 21) + $res = $digit.' '.$expr[2]; + else + $i%=10; - if($i == 1) - $res = $digit.' '.$expr[0]; - elseif($i > 1 AND $i < 5) - $res = $digit.' '.$expr[1]; - else - $res = $digit.' '.$expr[2]; + if($i == 1) + $res = $digit.' '.$expr[0]; + elseif($i > 1 AND $i < 5) + $res = $digit.' '.$expr[1]; + else + $res = $digit.' '.$expr[2]; - return trim($res); - } + return trim($res); + } - public static function today($time, $cp = false) - { - global $start_point; + public static function today($time, $cp = false) + { + global $start_point; - $today = date('d.m.Y', $start_point); - $day = date('d.m.Y', $time); + $today = date('d.m.Y', $start_point); + $day = date('d.m.Y', $time); - if($day == $today) - { - if($cp) - return 'Сегодня '.date('H:i', $time); + if($day == $today) + { + if($cp) + return 'Сегодня '.date('H:i', $time); - return 'Сегодня '.date('- H:i', $time); - } + return 'Сегодня '.date('- H:i', $time); + } - $yesterday_first = sys::int(sys::first(explode('.', $today)))-1; - $yesterday_full = date('m.Y', $time); + $yesterday_first = sys::int(sys::first(explode('.', $today)))-1; + $yesterday_full = date('m.Y', $time); - if($day == $yesterday_first.'.'.$yesterday_full AND !$yesterday_first) - { - if($cp) - return 'Вчера '.date('H:i', $time); + if($day == $yesterday_first.'.'.$yesterday_full AND !$yesterday_first) + { + if($cp) + return 'Вчера '.date('H:i', $time); - return 'Вчера '.date('- H:i', $time); - } + return 'Вчера '.date('- H:i', $time); + } - if($cp) - return date('d.m.Y H:i', $time); + if($cp) + return date('d.m.Y H:i', $time); - return date('d.m.Y - H:i', $time); - } + return date('d.m.Y - H:i', $time); + } - public static function day($time) - { - $days = array('день', 'дня', 'дней'); - - $time = $time % 100; - - if($n > 10 AND $n < 20) - return $days[2]; - - $time = $time % 10; - - if($time > 1 AND $time < 5) - return $days[1]; + public static function day($time) + { + $days = array('день', 'дня', 'дней'); + + $time = $time % 100; + + if($n > 10 AND $n < 20) + return $days[2]; + + $time = $time % 10; + + if($time > 1 AND $time < 5) + return $days[1]; - if($time == 1) - return $days[0]; + if($time == 1) + return $days[0]; - return $days[2]; - } + return $days[2]; + } - public static function bbc($text) - { - global $cfg; + public static function bbc($text) + { + global $cfg; - $lines = explode("\n", $text); + $lines = explode("\n", $text); - $str_search = array( - "#\\\n#is", - "#\[spoiler\](.+?)\[\/spoiler\]#is", - "#\[sp\](.+?)\[\/sp\]#is", - "#\[b\](.+?)\[\/b\]#is", - "#\[u\](.+?)\[\/u\]#is", - "#\[code\](.+?)\[\/code\]#is", - "#\[quote\](.+?)\[\/quote\]#is", - "#\[url=(.+?)\](.+?)\[\/url\]#is", - "#\[img=(.+?)\] \[\/img\]#is", - "#(^|[\n ])([\w]+?://[\w\#$%&~/.\-;:=,?@\[\]+]*)#is" - ); + $str_search = array( + "#\\\n#is", + "#\[spoiler\](.+?)\[\/spoiler\]#is", + "#\[sp\](.+?)\[\/sp\]#is", + "#\[b\](.+?)\[\/b\]#is", + "#\[u\](.+?)\[\/u\]#is", + "#\[code\](.+?)\[\/code\]#is", + "#\[quote\](.+?)\[\/quote\]#is", + "#\[url=(.+?)\](.+?)\[\/url\]#is", + "#\[img=(.+?)\] \[\/img\]#is", + "#(^|[\n ])([\w]+?://[\w\#$%&~/.\-;:=,?@\[\]+]*)#is" + ); - $str_replace = array( - "
    ", - "
    Посмотреть содержимое
    \\1
    ", - "
    Посмотреть содержимое
    \\1
    ", - "\\1", - "\\1", - "
    Посмотреть содержимое
    \\1
    ", - "

    \\1

    ", - "\\2", - "Изображение", - " \\2" - ); + $str_replace = array( + "
    ", + "
    Посмотреть содержимое
    \\1
    ", + "
    Посмотреть содержимое
    \\1
    ", + "\\1", + "\\1", + "
    Посмотреть содержимое
    \\1
    ", + "

    \\1

    ", + "\\2", + "Изображение", + " \\2" + ); - $uptext = ''; - - foreach($lines as $line) - $uptext .= preg_replace($str_search, $str_replace, $line)."
    "; + $uptext = ''; + + foreach($lines as $line) + $uptext .= preg_replace($str_search, $str_replace, $line)."
    "; - return $uptext; - } + return $uptext; + } - public static function first($array = array()) - { - return $array[0]; - } + public static function first($array = array()) + { + return $array[0]; + } - public static function back($url) - { - exit(header('Refresh: 0; URL='.$url)); - } + public static function back($url) + { + exit(header('Refresh: 0; URL='.$url)); + } - public static function strlen($str) - { - return iconv_strlen($str, 'UTF-8'); - } + public static function strlen($str) + { + return iconv_strlen($str, 'UTF-8'); + } - public static function text($section, $name) - { - global $cfg, $user; + public static function text($section, $name) + { + global $cfg, $user; - $group = isset($user['group']) ? $user['group'] : 'user'; + $group = isset($user['group']) ? $user['group'] : 'user'; - if($section != 'error' || !$cfg['text_group']) - $group = 'all'; + if($section != 'error' || !$cfg['text_group']) + $group = 'all'; - include(DATA.'text/'.$section.'.php'); + include(DATA.'text/'.$section.'.php'); - return isset($text[$name][$group]) ? $text[$name][$group] : $text[$name]; - } - - public static function key($param = 'defegp') - { - return md5(sha1(rand(1, 15).$param.rand(16, 30).rand(200, 1000).rand(1, 100))); - } + return isset($text[$name][$group]) ? $text[$name][$group] : $text[$name]; + } + + public static function key($param = 'defegp') + { + return md5(sha1(rand(1, 15).$param.rand(16, 30).rand(200, 1000).rand(1, 100))); + } - public static function captcha($type, $ip) - { - global $mcache; - - $cod = ''; - $width = 100; - $height = 45; - $font_size = 16; - $symbols = 3; - $symbols_fon = 20; - $font = LIB.'captcha/text.ttf'; - - $chars = array('a','b','c','d','e','f','g','h','j','k','m','n','p','q','r','s','t','u','v','w','x','y','z','2','3','4','5','6','7','9'); - $colors = array('20','50','80','100'); + public static function captcha($type, $ip) + { + global $mcache; + + $cod = ''; + $width = 100; + $height = 45; + $font_size = 16; + $symbols = 3; + $symbols_fon = 20; + $font = LIB.'captcha/text.ttf'; + + $chars = array('a','b','c','d','e','f','g','h','j','k','m','n','p','q','r','s','t','u','v','w','x','y','z','2','3','4','5','6','7','9'); + $colors = array('20','50','80','100'); - $src = imagecreatetruecolor($width, $height); - $fon = imagecolorallocate($src, 255, 255, 255); - - imagefill($src, 0, 0, $fon); - - $i = 0; - for($i; $i < $symbols_fon; $i+=1) - { - $color = imagecolorallocatealpha($src, rand(0,255), rand(0,255), rand(0,255), 100); - $char = $chars[rand(0, sizeof($chars)-1)]; - $size = rand($font_size-2, $font_size+2); - - imagettftext($src, $size, rand(0,45), rand($width*0.1,$width-$width*0.1), rand($height*0.2,$height), $color, $font, $char); - } - - $i = 0; - for($i; $i < $symbols; $i+=1) - { - $color = imagecolorallocatealpha($src, $colors[rand(0,sizeof($colors)-1)], $colors[rand(0,sizeof($colors)-1)], $colors[rand(0,sizeof($colors)-1)], rand(20,40)); - $char = $chars[rand(0, sizeof($chars)-1)]; - $size = rand($font_size*2.1-2, $font_size*2.1+2); - - $x = ($i+1)*$font_size + rand(6,8); - $y = (($height*2)/3) + rand(3,7); - - $cod .= $char; - - imagettftext($src, $size, rand(0,15), $x, $y, $color, $font, $char); - } + $src = imagecreatetruecolor($width, $height); + $fon = imagecolorallocate($src, 255, 255, 255); + + imagefill($src, 0, 0, $fon); + + $i = 0; + for($i; $i < $symbols_fon; $i+=1) + { + $color = imagecolorallocatealpha($src, rand(0,255), rand(0,255), rand(0,255), 100); + $char = $chars[rand(0, sizeof($chars)-1)]; + $size = rand($font_size-2, $font_size+2); + + imagettftext($src, $size, rand(0,45), rand($width*0.1,$width-$width*0.1), rand($height*0.2,$height), $color, $font, $char); + } + + $i = 0; + for($i; $i < $symbols; $i+=1) + { + $color = imagecolorallocatealpha($src, $colors[rand(0,sizeof($colors)-1)], $colors[rand(0,sizeof($colors)-1)], $colors[rand(0,sizeof($colors)-1)], rand(20,40)); + $char = $chars[rand(0, sizeof($chars)-1)]; + $size = rand($font_size*2.1-2, $font_size*2.1+2); + + $x = ($i+1)*$font_size + rand(6,8); + $y = (($height*2)/3) + rand(3,7); + + $cod .= $char; + + imagettftext($src, $size, rand(0,15), $x, $y, $color, $font, $char); + } - $mcache->set($type.'_captcha_'.$ip, $cod, false, 120); + $mcache->set($type.'_captcha_'.$ip, $cod, false, 120); - header("Content-type: image/gif"); - imagegif($src); - imagedestroy($src); - exit; - } + header("Content-type: image/gif"); + imagegif($src); + imagedestroy($src); + exit; + } - public static function captcha_check($type, $ip, $cod = '') - { - global $cfg, $mcache; + public static function captcha_check($type, $ip, $cod = '') + { + global $cfg, $mcache; - // Если повтор ввода капчи выключен и в кеше есть подтвержденный сеанс - if(!$cfg['recaptcha'] AND $mcache->get($type.'_captcha_valid_'.$ip)) - return false; + // Если повтор ввода капчи выключен и в кеше есть подтвержденный сеанс + if(!$cfg['recaptcha'] AND $mcache->get($type.'_captcha_valid_'.$ip)) + return false; - if($mcache->get($type.'_captcha_'.$ip) != strtolower($cod)) - { - $mcache->set($type.'_captcha_valid_'.$ip, true, false, 60); + if($mcache->get($type.'_captcha_'.$ip) != strtolower($cod)) + { + $mcache->set($type.'_captcha_valid_'.$ip, true, false, 60); - return true; - } + return true; + } - return false; - } + return false; + } - public static function ismail($data) - { - $aData = explode('@', $data); + public static function ismail($data) + { + $aData = explode('@', $data); - if(count($aData) > 1) - return true; + if(count($aData) > 1) + return true; - return false; - } + return false; + } - public static function smscode() - { - return rand(1,9).rand(100,500).rand(10,99); - } + public static function smscode() + { + return rand(1,9).rand(100,500).rand(10,99); + } - public static function code($length = 8) - { - $list = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuWwXxYyZz0123456789'; - $a = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuWwXxYyZz'; - $selections = strlen($list)-1; - $start = strlen($a)-1; - $b = rand(0, $start); - $start = $a[$b]; - $code = array(); + public static function code($length = 8) + { + $list = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuWwXxYyZz0123456789'; + $a = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuWwXxYyZz'; + $selections = strlen($list)-1; + $start = strlen($a)-1; + $b = rand(0, $start); + $start = $a[$b]; + $code = array(); - $i = 0; + $i = 0; - for($i; $i <= $length-2; $i+=1) - { - $n = rand(0, $selections); - $code[] = $list[$n]; - } + for($i; $i <= $length-2; $i+=1) + { + $n = rand(0, $selections); + $code[] = $list[$n]; + } - return $start.implode('', $code); - } + return $start.implode('', $code); + } - public static function sms($text, $phone) - { - global $cfg; + public static function sms($text, $phone) + { + global $cfg; - $out = file_get_contents($cfg['sms_gateway'].'&'.$cfg['sms_to'].'='.$phone.'&'.$cfg['sms_text'].'='.urlencode($text)); + $out = file_get_contents($cfg['sms_gateway'].'&'.$cfg['sms_to'].'='.$phone.'&'.$cfg['sms_text'].'='.urlencode($text)); - $aOut = explode("\n", $out); + $aOut = explode("\n", $out); - if(trim($aOut[0]) == $cfg['sms_ok']) - return true; + if(trim($aOut[0]) == $cfg['sms_ok']) + return true; - return false; - } + return false; + } - public static function find($text, $find) - { - $words = explode(' ', $find); + public static function find($text, $find) + { + $words = explode(' ', $find); - foreach($words as $word) - if(strlen($word) >= 2) - $text = preg_replace('#'.quotemeta($word).'#iu', '$0', $text); + foreach($words as $word) + if(strlen($word) >= 2) + $text = preg_replace('#'.quotemeta($word).'#iu', '$0', $text); - return $text; - } + return $text; + } - public static function str_first_replace($search, $replace, $text) - { - $pos = strpos($text, $search); - - return $pos!==false ? substr_replace($text, $replace, $pos, strlen($search)) : $text; - } + public static function str_first_replace($search, $replace, $text) + { + $pos = strpos($text, $search); + + return $pos!==false ? substr_replace($text, $replace, $pos, strlen($search)) : $text; + } - public static function cmd($command) - { - $text = preg_replace('/\\$/', '$ы', trim($command)); + public static function cmd($command) + { + $text = preg_replace('/\\$/', '$ы', trim($command)); - mb_internal_encoding('UTF-8'); + mb_internal_encoding('UTF-8'); - if(mb_substr($text, -1) == 'ы') - $text = quotemeta(substr($text, 0, -2)); + if(mb_substr($text, -1) == 'ы') + $text = quotemeta(substr($text, 0, -2)); - return $text; - } + return $text; + } - public static function map($map) - { - $name = quotemeta(trim($map)); + public static function map($map) + { + $name = quotemeta(trim($map)); - if(substr($name, -1) == '$') - $name = substr($name, 0, -2).'$'; + if(substr($name, -1) == '$') + $name = substr($name, 0, -2).'$'; - return str_replace(array('\.', '\*'), array('.', '*'), $name); - } + return str_replace(array('\.', '\*'), array('.', '*'), $name); + } - public static function temp($text) - { - $temp = TEMP.md5(time().rand(5, 100).rand(10, 20).rand(1, 20).rand(40, 80)); + public static function temp($text) + { + $temp = TEMP.md5(time().rand(5, 100).rand(10, 20).rand(1, 20).rand(40, 80)); - $file = fopen($temp, "w"); + $file = fopen($temp, "w"); - fputs($file, $text); + fputs($file, $text); - fclose($file); + fclose($file); - return $temp; - } + return $temp; + } - public static function size($val) - { - $aSize = array(' Байт', ' Кб', ' Мб', ' Гб', ' Тб', ' Пб'); + public static function size($val) + { + $aSize = array(' Байт', ' Кб', ' Мб', ' Гб', ' Тб', ' Пб'); - return $val ? round($val/pow(1024, ($i = floor(log($val, 1024)))), 2) . $aSize[$i] : '0 Байт'; - } + return $val ? round($val/pow(1024, ($i = floor(log($val, 1024)))), 2) . $aSize[$i] : '0 Байт'; + } - public static function unidate($date) - { - $aDate = explode('-', $date); - - $aFirst = explode(' ', $aDate[2]); - - return $aFirst[1].' - '.$aFirst[0].'.'.$aDate[1].'.'.$aDate[0]; - } - - public static function page($page, $nums, $num) - { - $ceil = ceil($nums/$num); - - if($page > $ceil) - $page = $ceil; - - $next = $page*$num; - - if($next <= $nums) - $next = $next-$num; + public static function unidate($date) + { + $aDate = explode('-', $date); + + $aFirst = explode(' ', $aDate[2]); + + return $aFirst[1].' - '.$aFirst[0].'.'.$aDate[1].'.'.$aDate[0]; + } + + public static function page($page, $nums, $num) + { + $ceil = ceil($nums/$num); + + if($page > $ceil) + $page = $ceil; + + $next = $page*$num; + + if($next <= $nums) + $next = $next-$num; - if($next > $nums) - $next = $next-$num; + if($next > $nums) + $next = $next-$num; - if($next < 1) - $next = 0; + if($next < 1) + $next = 0; - $num_go = $next; - if($page == '') - $page = 1; + $num_go = $next; + if($page == '') + $page = 1; - $aPage = array( - 'page' => $page, - 'num' => $num_go, - 'ceil' => $ceil - ); + $aPage = array( + 'page' => $page, + 'num' => $num_go, + 'ceil' => $ceil + ); - return $aPage; - } + return $aPage; + } - public static function page_list($countnum, $actnum) - { - if($countnum == 0 || $countnum == 1) - return array(); + public static function page_list($countnum, $actnum) + { + if($countnum == 0 || $countnum == 1) + return array(); - if($countnum > 10) - { - if($actnum <= 4 || $actnum + 3 >= $countnum) - { - for($i = 0; $i <= 4; $i++) - $numlist[$i] = $i + 1; + if($countnum > 10) + { + if($actnum <= 4 || $actnum + 3 >= $countnum) + { + for($i = 0; $i <= 4; $i++) + $numlist[$i] = $i + 1; - $numlist[5] = '...'; - for($j = 6, $k = 4; $j <= 10; $j+=1, $k-=1) - $numlist[$j] = $countnum - $k; - }else{ - $numlist[0] = 1; - $numlist[1] = 2; - $numlist[2] = '...'; - $numlist[3] = $actnum - 2; - $numlist[4] = $actnum - 1; - $numlist[5] = $actnum; - $numlist[6] = $actnum + 1; - $numlist[7] = $actnum + 2; - $numlist[8] = '...'; - $numlist[9] = $countnum - 1; - $numlist[10] = $countnum; - } - }else - for($n = 0; $n < $countnum; $n+=1) - $numlist[$n] = $n + 1; + $numlist[5] = '...'; + for($j = 6, $k = 4; $j <= 10; $j+=1, $k-=1) + $numlist[$j] = $countnum - $k; + }else{ + $numlist[0] = 1; + $numlist[1] = 2; + $numlist[2] = '...'; + $numlist[3] = $actnum - 2; + $numlist[4] = $actnum - 1; + $numlist[5] = $actnum; + $numlist[6] = $actnum + 1; + $numlist[7] = $actnum + 2; + $numlist[8] = '...'; + $numlist[9] = $countnum - 1; + $numlist[10] = $countnum; + } + }else + for($n = 0; $n < $countnum; $n+=1) + $numlist[$n] = $n + 1; - return $numlist; - } + return $numlist; + } - public static function page_gen($ceil, $page, $actnum, $section) - { - global $cfg, $html; + public static function page_gen($ceil, $page, $actnum, $section) + { + global $cfg, $html; - $aNum = sys::page_list($ceil, $actnum); + $aNum = sys::page_list($ceil, $actnum); - $pages = ''; + $pages = ''; - $html->get('pages'); + $html->get('pages'); - if($ceil) - { - if($page != 1) - { - $next = $page-1; - $pages .= 'Предыдущая'; - } + if($ceil) + { + if($page != 1) + { + $next = $page-1; + $pages .= 'Предыдущая'; + } - foreach($aNum as $v) - { - if($v != $page && $v != '...') - $pages .= ''.$v.''; - - if($v == $page) - $pages .= ''.$v.''; - - if($v == '...') - $pages .= '...'; - } + foreach($aNum as $v) + { + if($v != $page && $v != '...') + $pages .= ''.$v.''; + + if($v == $page) + $pages .= ''.$v.''; + + if($v == '...') + $pages .= '...'; + } - if($ceil > $page) - { - if($page < $ceil) - { - $next = $page+1; - $pages .= 'Следующая'; - }else - $pages .= 'Следующая'; - } - } + if($ceil > $page) + { + if($page < $ceil) + { + $next = $page+1; + $pages .= 'Следующая'; + }else + $pages .= 'Следующая'; + } + } - $html->set('pages', $pages); + $html->set('pages', $pages); - $html->pack('pages'); + $html->pack('pages'); - return NULL; - } + return NULL; + } - public static function country($name) - { - global $cfg; - - $fileimg = file_exists(TPL.'/images/country/'.$name.'.png'); - - if($fileimg) - return $cfg['http'].'template/images/country/'.$name.'.png'; - - return $cfg['http'].'template/images/country/none.png'; - } - - public static function ipproxy() - { - global $_SERVER; - - if(isset($_SERVER['HTTP_CF_CONNECTING_IP']) && !empty($_SERVER['HTTP_CF_CONNECTING_IP'])) - return $_SERVER['HTTP_CF_CONNECTING_IP']; - - return NULL; - } + public static function country($name) + { + global $cfg; + + $fileimg = file_exists(TPL.'/images/country/'.$name.'.png'); + + if($fileimg) + return $cfg['http'].'template/images/country/'.$name.'.png'; + + return $cfg['http'].'template/images/country/none.png'; + } + + public static function ipproxy() + { + global $_SERVER; + + if(isset($_SERVER['HTTP_CF_CONNECTING_IP']) && !empty($_SERVER['HTTP_CF_CONNECTING_IP'])) + return $_SERVER['HTTP_CF_CONNECTING_IP']; + + return NULL; + } - public static function ip() - { - $ip = sys::ipproxy(); + public static function ip() + { + $ip = sys::ipproxy(); - if(sys::valid($ip, 'ip')) - return $_SERVER['REMOTE_ADDR']; + if(sys::valid($ip, 'ip')) + return $_SERVER['REMOTE_ADDR']; - return $ip; - } + return $ip; + } - public static function whois($ip) - { - $stack = fsockopen('whois.ripe.net', 43, $errno, $errstr); + public static function whois($ip) + { + $stack = fsockopen('whois.ripe.net', 43, $errno, $errstr); - if(!$stack) - return 'не определена'; + if(!$stack) + return 'не определена'; - fputs($stack, $ip."\r\n"); + fputs($stack, $ip."\r\n"); - $subnetwork = ''; + $subnetwork = ''; - while(!feof($stack)) - { - $str = fgets($stack, 128); + while(!feof($stack)) + { + $str = fgets($stack, 128); - if(strpos($str, 'route:') !== FALSE) - { - $subnetwork = trim(str_replace('route:', '', $str)); + if(strpos($str, 'route:') !== FALSE) + { + $subnetwork = trim(str_replace('route:', '', $str)); - break; - } - } + break; + } + } - fclose($stack); + fclose($stack); - return isset($subnetwork[0]) ? $subnetwork : 'не определена'; - } + return isset($subnetwork[0]) ? $subnetwork : 'не определена'; + } - public static function rep_act($name, $time = 20) - { - global $go, $mcache; + public static function rep_act($name, $time = 20) + { + global $go, $mcache; - if(!$go) - return NULL; + if(!$go) + return NULL; - if($mcache->get($name)) - sys::outjs(array('e' => sys::text('other', 'mcache'))); + if($mcache->get($name)) + sys::outjs(array('e' => sys::text('other', 'mcache'))); - $mcache->set($name, true, false, $time); + $mcache->set($name, true, false, $time); - return $name; - } + return $name; + } - public static function check_php_config($file, &$error) - { - exec('php -l '.$file, $error, $code); + public static function check_php_config($file, &$error) + { + exec('php -l '.$file, $error, $code); - if(!$code) - return true; + if(!$code) + return true; - return false; - } + return false; + } - public static function cpu_idle($pros_stat = array(), $unit = false, $fcpu = false, $ctrl = false) - { - return sys::cpu_get_idle(sys::parse_cpu($pros_stat[0]), sys::parse_cpu($pros_stat[1]), $unit, $fcpu, $ctrl); - } + public static function cpu_idle($pros_stat = array(), $unit = false, $fcpu = false, $ctrl = false) + { + return sys::cpu_get_idle(sys::parse_cpu($pros_stat[0]), sys::parse_cpu($pros_stat[1]), $unit, $fcpu, $ctrl); + } - public static function cpu_get_idle($first, $second, $unit, $fcpu, $ctrl) - { - global $sql; + public static function cpu_get_idle($first, $second, $unit, $fcpu, $ctrl) + { + global $sql; - if(count($first) !== count($second)) - return; + if(count($first) !== count($second)) + return; - $cpus = array(); + $cpus = array(); - for($i = 0, $l = count($first); $i < $l; $i+=1) - { - $dif = array(); - $dif['use'] = $second[$i]['use']-$first[$i]['use']; - $dif['nice'] = $second[$i]['nice']-$first[$i]['nice']; - $dif['sys'] = $second[$i]['sys']-$first[$i]['sys']; - $dif['idle'] = $second[$i]['idle']-$first[$i]['idle']; - $total = array_sum($dif); - $cpu = array(); + for($i = 0, $l = count($first); $i < $l; $i+=1) + { + $dif = array(); + $dif['use'] = $second[$i]['use']-$first[$i]['use']; + $dif['nice'] = $second[$i]['nice']-$first[$i]['nice']; + $dif['sys'] = $second[$i]['sys']-$first[$i]['sys']; + $dif['idle'] = $second[$i]['idle']-$first[$i]['idle']; + $total = array_sum($dif); + $cpu = array(); - foreach($dif as $x => $y) - $cpu[$x] = $y ? round($y/$total*100, 1) : 0; + foreach($dif as $x => $y) + $cpu[$x] = $y ? round($y/$total*100, 1) : 0; - $cpus['cpu'.$i] = $cpu; - } + $cpus['cpu'.$i] = $cpu; + } - if($fcpu) - return $cpus; + if($fcpu) + return $cpus; - $threads = array(); + $threads = array(); - $l = count($first); + $l = count($first); - for($i = 0; $i < $l; $i+=1) - $threads[$i] = $cpus['cpu'.$i]['idle']; + for($i = 0; $i < $l; $i+=1) + $threads[$i] = $cpus['cpu'.$i]['idle']; - if(count($first) > 1) - unset($threads[0]); + if(count($first) > 1) + unset($threads[0]); - $max = max($threads); + $max = max($threads); - foreach($threads as $idle) - { - $core = array_search($max, $threads); + foreach($threads as $idle) + { + $core = array_search($max, $threads); - if($ctrl) - $sql->query('SELECT `id` FROM `control_servers` WHERE `unit`="'.$unit.'" AND `core_fix`="'.($core+1).'" LIMIT 1'); - else - $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$unit.'" AND `core_fix`="'.($core+1).'" AND `core_fix_one`="1" LIMIT 1'); - if($sql->num()) - { - unset($threads[$core]); + if($ctrl) + $sql->query('SELECT `id` FROM `control_servers` WHERE `unit`="'.$unit.'" AND `core_fix`="'.($core+1).'" LIMIT 1'); + else + $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$unit.'" AND `core_fix`="'.($core+1).'" AND `core_fix_one`="1" LIMIT 1'); + if($sql->num()) + { + unset($threads[$core]); - if(!count($threads)) - return NULL; + if(!count($threads)) + return NULL; - $max = max($threads); - } - } + $max = max($threads); + } + } - return array_search($max, $threads); - } + return array_search($max, $threads); + } - public static function parse_cpu($data) - { - $data = explode("\n", $data); + public static function parse_cpu($data) + { + $data = explode("\n", $data); - $cpu = array(); + $cpu = array(); - foreach($data as $line) - { - if(preg_match('/^cpu[0-9]/', $line)) - { - $info = explode(' ', $line); + foreach($data as $line) + { + if(preg_match('/^cpu[0-9]/', $line)) + { + $info = explode(' ', $line); - $cpu[] = array( - 'use' => $info[1], - 'nice' => $info[2], - 'sys' => $info[3], - 'idle' => $info[4] - ); - } - } + $cpu[] = array( + 'use' => $info[1], + 'nice' => $info[2], + 'sys' => $info[3], + 'idle' => $info[4] + ); + } + } - return $cpu; - } + return $cpu; + } - public static function reset_mcache($nmch, $id, $data = array(), $ctrl = false) - { - global $mcache; + public static function reset_mcache($nmch, $id, $data = array(), $ctrl = false) + { + global $mcache; - $cache = array( - 'name' => $data['name'], - 'status' => sys::status($data['status'], $data['game']), - 'online' => $data['online'], - 'image' => '', - ); + $cache = array( + 'name' => $data['name'], + 'status' => sys::status($data['status'], $data['game']), + 'online' => $data['online'], + 'image' => '', + ); - $cache = $ctrl ? sys::buttons($id, $data['status'], $data['game'], $ctrl) : sys::buttons($id, $data['status'], $data['game']); + $cache = $ctrl ? sys::buttons($id, $data['status'], $data['game'], $ctrl) : sys::buttons($id, $data['status'], $data['game']); - if(isset($data['players'])) - $cache['players'] = $data['players']; + if(isset($data['players'])) + $cache['players'] = $data['players']; - $mcache->set($nmch, $cache, false, 5); + $mcache->set($nmch, $cache, false, 5); - return NULL; - } + return NULL; + } - public static function status($status, $game, $map = '', $get = 'text') - { - global $cfg; + public static function status($status, $game, $map = '', $get = 'text') + { + global $cfg; - switch($status) - { - case 'working': - if($get == 'img') - { - if(in_array($game, array('samp', 'crmp', 'mta', 'mc'))) - $map = $game; + switch($status) + { + case 'working': + if($get == 'img') + { + if(in_array($game, array('samp', 'crmp', 'mta', 'mc'))) + $map = $game; - return sys::img($map, $game); - } + return sys::img($map, $game); + } - return 'Карта: '.($map == '' ? '-' : $map); + return 'Карта: '.($map == '' ? '-' : $map); - case 'off': - if($get == 'img') - return $cfg['http'].'template/images/status/off.jpg'; + case 'off': + if($get == 'img') + return $cfg['http'].'template/images/status/off.jpg'; - return 'Статус: выключен'; + return 'Статус: выключен'; - case 'start': - if($get == 'img') - return $cfg['http'].'template/images/status/start.gif'; + case 'start': + if($get == 'img') + return $cfg['http'].'template/images/status/start.gif'; - return 'Статус: запускается'; + return 'Статус: запускается'; - case 'restart': - if($get == 'img') - return $cfg['http'].'template/images/status/restart.gif'; + case 'restart': + if($get == 'img') + return $cfg['http'].'template/images/status/restart.gif'; - return 'Статус: перезапускается'; + return 'Статус: перезапускается'; - case 'change': - if($get == 'img') - return $cfg['http'].'template/images/status/change.gif'; + case 'change': + if($get == 'img') + return $cfg['http'].'template/images/status/change.gif'; - return 'Статус: меняется карта'; + return 'Статус: меняется карта'; - case 'install': - if($get == 'img') - return $cfg['http'].'template/images/status/install.gif'; + case 'install': + if($get == 'img') + return $cfg['http'].'template/images/status/install.gif'; - return 'Статус: устанавливается'; + return 'Статус: устанавливается'; - case 'reinstall': - if($get == 'img') - return $cfg['http'].'template/images/status/reinstall.gif'; + case 'reinstall': + if($get == 'img') + return $cfg['http'].'template/images/status/reinstall.gif'; - return 'Статус: переустанавливается'; + return 'Статус: переустанавливается'; - case 'update': - if($get == 'img') - return $cfg['http'].'template/images/status/update.gif'; + case 'update': + if($get == 'img') + return $cfg['http'].'template/images/status/update.gif'; - return 'Статус: обновляется'; + return 'Статус: обновляется'; - case 'recovery': - if($get == 'img') - return $cfg['http'].'template/images/status/recovery.gif'; + case 'recovery': + if($get == 'img') + return $cfg['http'].'template/images/status/recovery.gif'; - return 'Статус: восстанавливается'; + return 'Статус: восстанавливается'; - case 'overdue': - if($get == 'img') - return $cfg['http'].'template/images/status/overdue.jpg'; + case 'overdue': + if($get == 'img') + return $cfg['http'].'template/images/status/overdue.jpg'; - return 'Статус: просрочен'; + return 'Статус: просрочен'; - case 'blocked': - if($get == 'img') - return $cfg['http'].'template/images/status/blocked.jpg'; + case 'blocked': + if($get == 'img') + return $cfg['http'].'template/images/status/blocked.jpg'; - return 'Статус: заблокирован'; - } - } + return 'Статус: заблокирован'; + } + } - public static function img($name, $game) - { - global $cfg; - - $filename = 'http://cdn.enginegp.ru/maps/'.$game.'/'.$name.'.jpg'; - $file_headers = @get_headers($filename) ; - $protocol = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://"; - if(!$file_headers || $file_headers[0] == 'HTTP/1.1 404 Not Found' ||trim($file_headers[0]) == 'HTTP/1.1 403 Forbidden') { - return $cfg['http'].'template/images/status/none.jpg'; - } - else { - return '' . $protocol .'cdn.enginegp.ru/maps/'.$game.'/'.$name.'.jpg'; - } - } + public static function img($name, $game) + { + global $cfg; + + $filename = 'http://cdn.enginegp.ru/maps/'.$game.'/'.$name.'.jpg'; + $file_headers = @get_headers($filename) ; + $protocol = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://"; + if(!$file_headers || $file_headers[0] == 'HTTP/1.1 404 Not Found' ||trim($file_headers[0]) == 'HTTP/1.1 403 Forbidden') { + return $cfg['http'].'template/images/status/none.jpg'; + } + else { + return '' . $protocol .'cdn.enginegp.ru/maps/'.$game.'/'.$name.'.jpg'; + } + } - public static function buttons($id, $status, $game = false, $ctrl = false) - { - global $html; + public static function buttons($id, $status, $game = false, $ctrl = false) + { + global $html; - if(isset($html->arr['buttons'])) - unset($html->arr['buttons']); + if(isset($html->arr['buttons'])) + unset($html->arr['buttons']); - $other = in_array($game, array('samp', 'crmp', 'mta', 'mc')); + $other = in_array($game, array('samp', 'crmp', 'mta', 'mc')); - $dir = $ctrl ? 'control/servers' : 'servers'; + $dir = $ctrl ? 'control/servers' : 'servers'; - if(in_array($status, array('working', 'change', 'start', 'restart'))) - { - $html->get('stop', 'sections/'.$dir.'/buttons'); + if(in_array($status, array('working', 'change', 'start', 'restart'))) + { + $html->get('stop', 'sections/'.$dir.'/buttons'); - $html->set('id', $id); - if($ctrl) - $html->set('ctrl', $ctrl); + $html->set('id', $id); + if($ctrl) + $html->set('ctrl', $ctrl); - $html->pack('buttons'); + $html->pack('buttons'); - $html->get('restart', 'sections/'.$dir.'/buttons'); + $html->get('restart', 'sections/'.$dir.'/buttons'); - $html->set('id', $id); - if($ctrl) - $html->set('ctrl', $ctrl); + $html->set('id', $id); + if($ctrl) + $html->set('ctrl', $ctrl); - $html->pack('buttons'); + $html->pack('buttons'); - if(!$other) - { - $html->get('change', 'sections/'.$dir.'/buttons'); + if(!$other) + { + $html->get('change', 'sections/'.$dir.'/buttons'); - $html->set('id', $id); - if($ctrl) - $html->set('ctrl', $ctrl); + $html->set('id', $id); + if($ctrl) + $html->set('ctrl', $ctrl); - $html->pack('buttons'); - } + $html->pack('buttons'); + } - return $html->arr['buttons']; - } + return $html->arr['buttons']; + } - if($status == 'off') - { - $html->get('start', 'sections/'.$dir.'/buttons'); + if($status == 'off') + { + $html->get('start', 'sections/'.$dir.'/buttons'); - $html->set('id', $id); - if($ctrl) - $html->set('ctrl', $ctrl); + $html->set('id', $id); + if($ctrl) + $html->set('ctrl', $ctrl); - $html->pack('buttons'); + $html->pack('buttons'); - $html->get('reinstall', 'sections/'.$dir.'/buttons'); + $html->get('reinstall', 'sections/'.$dir.'/buttons'); - $html->set('id', $id); - if($ctrl) - $html->set('ctrl', $ctrl); + $html->set('id', $id); + if($ctrl) + $html->set('ctrl', $ctrl); - $html->pack('buttons'); + $html->pack('buttons'); - if(!$other) - { - $html->get('update', 'sections/'.$dir.'/buttons'); + if(!$other) + { + $html->get('update', 'sections/'.$dir.'/buttons'); - $html->set('id', $id); - if($ctrl) - $html->set('ctrl', $ctrl); + $html->set('id', $id); + if($ctrl) + $html->set('ctrl', $ctrl); - $html->pack('buttons'); - } + $html->pack('buttons'); + } - return $html->arr['buttons']; - } + return $html->arr['buttons']; + } - $html->get('other', 'sections/'.$dir.'/buttons'); - $html->pack('buttons'); + $html->get('other', 'sections/'.$dir.'/buttons'); + $html->pack('buttons'); - return $html->arr['buttons']; - } + return $html->arr['buttons']; + } - public static function entoru($month) - { - $ru = array( - 1 => 'Янв', 2 => 'Фев', 3 => 'Мар', 4 => 'Апр', - 5 => 'Май', 6 => 'Июн', 7 => 'Июл', 8 => 'Авг', - 9 => 'Сен', 10 => 'Окт', 11 => 'Ноя', 12 => 'Дек' - ); + public static function entoru($month) + { + $ru = array( + 1 => 'Янв', 2 => 'Фев', 3 => 'Мар', 4 => 'Апр', + 5 => 'Май', 6 => 'Июн', 7 => 'Июл', 8 => 'Авг', + 9 => 'Сен', 10 => 'Окт', 11 => 'Ноя', 12 => 'Дек' + ); - return $ru[$month]; - } + return $ru[$month]; + } - public static function head($head) - { - global $route, $header; + public static function head($head) + { + global $route, $header; - if($head == 'description') - { - global $description; + if($head == 'description') + { + global $description; - if(isset($description)) - { - $text = str_replace(array('"', '-'), array('', '—'), strip_tags($description)); + if(isset($description)) + { + $text = str_replace(array('"', '-'), array('', '—'), strip_tags($description)); - if(strlen($text) > 160) - { - mb_internal_encoding('UTF-8'); + if(strlen($text) > 160) + { + mb_internal_encoding('UTF-8'); - $text = mb_substr($text, 0, 157).'...'; - } + $text = mb_substr($text, 0, 157).'...'; + } - return $text; - } - }else{ - global $keywords; + return $text; + } + }else{ + global $keywords; - if(isset($keywords)) - return str_replace(array('"', '-'), array('', '—'), strip_tags($keywords)); - } + if(isset($keywords)) + return str_replace(array('"', '-'), array('', '—'), strip_tags($keywords)); + } - return array_key_exists($route, $header) ? $header[$route][$head] : $header['index'][$head]; - } + return array_key_exists($route, $header) ? $header[$route][$head] : $header['index'][$head]; + } - public static function tags($tags) - { - $aTags = explode(',', $tags); + public static function tags($tags) + { + $aTags = explode(',', $tags); - $text = ''; + $text = ''; - foreach($aTags as $tag) - $text .= ''.trim($tag).', '; + foreach($aTags as $tag) + $text .= ''.trim($tag).', '; - return isset($text[0]) ? substr($text, 0, -2) : 'отсутствуют'; - } + return isset($text[0]) ? substr($text, 0, -2) : 'отсутствуют'; + } - public static function benefitblock($id, $nmch = false) - { - global $cfg, $sql, $start_point; + public static function benefitblock($id, $nmch = false) + { + global $cfg, $sql, $start_point; - if($cfg['benefitblock']) - { - $sql->query('SELECT `benefit` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); - $info = $sql->get(); + if($cfg['benefitblock']) + { + $sql->query('SELECT `benefit` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1'); + $info = $sql->get(); - if($info['benefit'] > $start_point) - sys::outjs(array('e' => 'Операция недоступна до '.date('d.m.Y - H:i:s', $info['benefit'])), $nmch); - } + if($info['benefit'] > $start_point) + sys::outjs(array('e' => 'Операция недоступна до '.date('d.m.Y - H:i:s', $info['benefit'])), $nmch); + } - return NULL; - } + return NULL; + } - function outfile($file, $name, $del = false) - { - if(file_exists($file)) - { - if(ob_get_level()) - ob_end_clean(); + function outfile($file, $name, $del = false) + { + if(file_exists($file)) + { + if(ob_get_level()) + ob_end_clean(); - header('Content-Description: File Transfer'); - header('Content-Type: application/octet-stream'); - header('Content-Disposition: attachment; filename='.$name); - header('Content-Transfer-Encoding: binary'); - header('Expires: 0'); - header('Cache-Control: must-revalidate'); - header('Pragma: public'); - header('Content-Length: '.filesize($file)); + header('Content-Description: File Transfer'); + header('Content-Type: application/octet-stream'); + header('Content-Disposition: attachment; filename='.$name); + header('Content-Transfer-Encoding: binary'); + header('Expires: 0'); + header('Cache-Control: must-revalidate'); + header('Pragma: public'); + header('Content-Length: '.filesize($file)); - readfile($file); + readfile($file); - if($del) - unlink($file); + if($del) + unlink($file); - exit; - } - } - } + exit; + } + } + } ?> \ No newline at end of file diff --git a/system/library/users.php b/system/library/users.php index 732d68a..fb87b91 100644 --- a/system/library/users.php +++ b/system/library/users.php @@ -1,53 +1,53 @@ get('gmenu', 'sections/user'); + $html->get('gmenu', 'sections/user'); - $html->set('home', $cfg['http']); + $html->set('home', $cfg['http']); - foreach($aUnit as $unit) - if($unit == $active) $html->unit($unit, 1); else $html->unit($unit); + foreach($aUnit as $unit) + if($unit == $active) $html->unit($unit, 1); else $html->unit($unit); - $html->pack('main'); + $html->pack('main'); - $html->get('vmenu', 'sections/user'); + $html->get('vmenu', 'sections/user'); - $html->set('home', $cfg['http']); + $html->set('home', $cfg['http']); - foreach($aUnit as $unit) - if($unit == $active) $html->unit($unit, 1); else $html->unit($unit); + foreach($aUnit as $unit) + if($unit == $active) $html->unit($unit, 1); else $html->unit($unit); - $html->pack('vmenu'); + $html->pack('vmenu'); - return NULL; - } - } + return NULL; + } + } ?> \ No newline at end of file diff --git a/system/library/web/free.php b/system/library/web/free.php index fef8c55..2302c94 100644 --- a/system/library/web/free.php +++ b/system/library/web/free.php @@ -1,496 +1,496 @@ 'Дополнительная услуга недоступна для установки.'), $mcache); + if(!$aWeb[$aData['server']['game']][$aData['type']]) + sys::outjs(array('e' => 'Дополнительная услуга недоступна для установки.'), $mcache); - // Проверка на наличие уже установленной выбранной услуги - if($sql->num(web::stack($aData, '`id`'))) - sys::outjs(array('i' => 'Дополнительная услуга уже установлена.'), $mcache); + // Проверка на наличие уже установленной выбранной услуги + if($sql->num(web::stack($aData, '`id`'))) + sys::outjs(array('i' => 'Дополнительная услуга уже установлена.'), $mcache); - // Проверка на наличие уже установленной подобной услуги - switch($aWebInstall[$aData['server']['game']][$aData['type']]) - { - case 'server': - foreach($aWebOne[$aData['server']['game']][$aData['type']] as $type) - { - $sql->query('SELECT `id` FROM `web` WHERE `type`="'.$type.'" AND `server`="'.$aData['server']['id'].'" LIMIT 1'); - if($sql->num()) - sys::outjs(array('i' => 'Подобная услуга уже установлена.', 'type' => $type), $mcache); - } + // Проверка на наличие уже установленной подобной услуги + switch($aWebInstall[$aData['server']['game']][$aData['type']]) + { + case 'server': + foreach($aWebOne[$aData['server']['game']][$aData['type']] as $type) + { + $sql->query('SELECT `id` FROM `web` WHERE `type`="'.$type.'" AND `server`="'.$aData['server']['id'].'" LIMIT 1'); + if($sql->num()) + sys::outjs(array('i' => 'Подобная услуга уже установлена.', 'type' => $type), $mcache); + } - break; + break; - case 'user': - foreach($aWebOne[$aData['server']['game']][$aData['type']] as $type) - { - $sql->query('SELECT `id` FROM `web` WHERE `type`="'.$type.'" AND `user`="'.$aData['server']['user'].'" LIMIT 1'); - if($sql->num()) - sys::outjs(array('i' => 'Подобная услуга уже установлена.', 'type' => $type), $mcache); - } + case 'user': + foreach($aWebOne[$aData['server']['game']][$aData['type']] as $type) + { + $sql->query('SELECT `id` FROM `web` WHERE `type`="'.$type.'" AND `user`="'.$aData['server']['user'].'" LIMIT 1'); + if($sql->num()) + sys::outjs(array('i' => 'Подобная услуга уже установлена.', 'type' => $type), $mcache); + } - break; + break; - case 'unit': - foreach($aWebOne[$aData['server']['game']][$aData['type']] as $type) - { - $sql->query('SELECT `id` FROM `web` WHERE `type`="'.$type.'" AND `user`="'.$aData['server']['user'].'" AND `unit`="'.$aData['server']['unit'].'" LIMIT 1'); - if($sql->num()) - sys::outjs(array('i' => 'Подобная услуга уже установлена.', 'type' => $type), $mcache); - } - } + case 'unit': + foreach($aWebOne[$aData['server']['game']][$aData['type']] as $type) + { + $sql->query('SELECT `id` FROM `web` WHERE `type`="'.$type.'" AND `user`="'.$aData['server']['user'].'" AND `unit`="'.$aData['server']['unit'].'" LIMIT 1'); + if($sql->num()) + sys::outjs(array('i' => 'Подобная услуга уже установлена.', 'type' => $type), $mcache); + } + } - // Проверка валидности поддомена - if(sys::valid($aData['subdomain'], 'other', "/^[a-z0-9]+$/")) - sys::outjs(array('e' => 'Адрес должен состоять из букв a-z и цифр.'), $mcache); + // Проверка валидности поддомена + if(sys::valid($aData['subdomain'], 'other', "/^[a-z0-9]+$/")) + sys::outjs(array('e' => 'Адрес должен состоять из букв a-z и цифр.'), $mcache); - // Проверка длины поддомена - if(!isset($aData['subdomain']{3}) || isset($aData['subdomain']{15})) - sys::outjs(array('e' => 'Длина адреса не должна превышать 16-и символов и быть не менее 4-х символов.'), $mcache); + // Проверка длины поддомена + if(!isset($aData['subdomain']{3}) || isset($aData['subdomain']{15})) + sys::outjs(array('e' => 'Длина адреса не должна превышать 16-и символов и быть не менее 4-х символов.'), $mcache); - // Проверка запрещенного поддомена - if(in_array($aData['subdomain'], $aWebUnit['subdomains'])) - sys::outjs(array('e' => 'Нельзя создать данный адрес, придумайте другой.'), $mcache); + // Проверка запрещенного поддомена + if(in_array($aData['subdomain'], $aWebUnit['subdomains'])) + sys::outjs(array('e' => 'Нельзя создать данный адрес, придумайте другой.'), $mcache); - // Проверка наличия домена - if(!in_array($aData['domain'], $aWebUnit['domains'])) - sys::outjs(array('e' => 'Выбранный домен не найден.'), $mcache); + // Проверка наличия домена + if(!in_array($aData['domain'], $aWebUnit['domains'])) + sys::outjs(array('e' => 'Выбранный домен не найден.'), $mcache); - // Проверка поддомена на занятость - $sql->query('SELECT `id` FROM `web` WHERE `domain`="'.$aData['subdomain'].'.'.$aData['domain'].'" LIMIT 1'); - if($sql->num()) - sys::outjs(array('e' => 'Данный адрес уже занят.'), $mcache); + // Проверка поддомена на занятость + $sql->query('SELECT `id` FROM `web` WHERE `domain`="'.$aData['subdomain'].'.'.$aData['domain'].'" LIMIT 1'); + if($sql->num()) + sys::outjs(array('e' => 'Данный адрес уже занят.'), $mcache); - // Проверка наличия шаблона - if(!array_key_exists($aData['desing'], $aWebParam[$aData['type']]['desing'])) - sys::outjs(array('e' => 'Выбранный шаблон не найден.'), $mcache); + // Проверка наличия шаблона + if(!array_key_exists($aData['desing'], $aWebParam[$aData['type']]['desing'])) + sys::outjs(array('e' => 'Выбранный шаблон не найден.'), $mcache); - if(isset($aData['passwd'])) - { - // Если не указан пароль сгенерировать - if($aData['passwd'] == '') - $aData['passwd'] = sys::passwd($aWebParam[$aData['type']]['passwd']); + if(isset($aData['passwd'])) + { + // Если не указан пароль сгенерировать + if($aData['passwd'] == '') + $aData['passwd'] = sys::passwd($aWebParam[$aData['type']]['passwd']); - // Проверка длинны пароля - if(!isset($aData['passwd']{5}) || isset($aData['passwd']{15})) - sys::outjs(array('e' => 'Необходимо указать пароль длинной не менее 6-и символов и не более 16-и.'), $mcache); + // Проверка длинны пароля + if(!isset($aData['passwd']{5}) || isset($aData['passwd']{15})) + sys::outjs(array('e' => 'Необходимо указать пароль длинной не менее 6-и символов и не более 16-и.'), $mcache); - // Проверка валидности пароля - if(sys::valid($aData['passwd'], 'other', "/^[A-Za-z0-9]{6,16}$/")) - sys::outjs(array('e' => 'Пароль должен состоять из букв a-z и цифр.'), $mcache); - } + // Проверка валидности пароля + if(sys::valid($aData['passwd'], 'other', "/^[A-Za-z0-9]{6,16}$/")) + sys::outjs(array('e' => 'Пароль должен состоять из букв a-z и цифр.'), $mcache); + } - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - $unit = web::unit($aWebUnit, $aData['type'], $aData['server']['unit']); + $unit = web::unit($aWebUnit, $aData['type'], $aData['server']['unit']); - if(!$ssh->auth($unit['passwd'], $unit['address'])) - sys::outjs(array('e' => sys::text('error', 'ssh')), $mcache); + if(!$ssh->auth($unit['passwd'], $unit['address'])) + sys::outjs(array('e' => sys::text('error', 'ssh')), $mcache); - // Директория файлов услуги - $path = $aWebUnit['path'][$aWebUnit['unit'][$aData['type']]][$aData['type']].$aData['desing']; + // Директория файлов услуги + $path = $aWebUnit['path'][$aWebUnit['unit'][$aData['type']]][$aData['type']].$aData['desing']; - // Директория дополнительной услуги - $install = $aWebUnit['install'][$aWebUnit['unit'][$aData['type']]][$aData['type']].$aData['subdomain'].'.'.$aData['domain']; + // Директория дополнительной услуги + $install = $aWebUnit['install'][$aWebUnit['unit'][$aData['type']]][$aData['type']].$aData['subdomain'].'.'.$aData['domain']; - $sql->query('INSERT INTO `web` set `type`="'.$aData['type'].'", `server`="'.$aData['server']['id'].'", `user`="'.$aData['server']['user'].'", `unit`="'.$aData['server']['unit'].'", `config`=""'); - $wid = $sql->id(); - $uid = $wid+10000; + $sql->query('INSERT INTO `web` set `type`="'.$aData['type'].'", `server`="'.$aData['server']['id'].'", `user`="'.$aData['server']['user'].'", `unit`="'.$aData['server']['unit'].'", `config`=""'); + $wid = $sql->id(); + $uid = $wid+10000; - $sql->query('SELECT `mail` FROM `users` WHERE `id`="'.$aData['server']['user'].'" LIMIT 1'); - if(!$sql->num()) - { - $sql->query('DELETE FROM `web` WHERE `id`="'.$wid.'" LIMIT 1'); + $sql->query('SELECT `mail` FROM `users` WHERE `id`="'.$aData['server']['user'].'" LIMIT 1'); + if(!$sql->num()) + { + $sql->query('DELETE FROM `web` WHERE `id`="'.$wid.'" LIMIT 1'); - sys::outjs(array('e' => 'Необходимо указать пользователя сервера.'), $mcache); - } + sys::outjs(array('e' => 'Необходимо указать пользователя сервера.'), $mcache); + } - $u = $sql->get(); + $u = $sql->get(); - // Данные - $login = 'w'.$uid; - $passwd = sys::passwd(10); - $ip = sys::first(explode(':', $unit['address'])); - $host = $aWebUnit['unit'][$aData['type']] == 'local' ? '127.0.0.1' : $ip; + // Данные + $login = 'w'.$uid; + $passwd = sys::passwd(10); + $ip = sys::first(explode(':', $unit['address'])); + $host = $aWebUnit['unit'][$aData['type']] == 'local' ? '127.0.0.1' : $ip; - $conf = array( - 'address' => $aData['server']['address'], - 'install' => $install, - 'login' => $login, - 'passwd' => $passwd, - 'host' => $host, - 'url' => $cfg['http'], - 'domain' => $aData['subdomain'].'.'.$aData['domain'] - ); + $conf = array( + 'address' => $aData['server']['address'], + 'install' => $install, + 'login' => $login, + 'passwd' => $passwd, + 'host' => $host, + 'url' => $cfg['http'], + 'domain' => $aData['subdomain'].'.'.$aData['domain'] + ); - $aData['config_sql'] = sys::updtext($aData['config_sql'], $conf); + $aData['config_sql'] = sys::updtext($aData['config_sql'], $conf); - if(isset($aWebdbConf[$aData['type']])) - { - $aData['config_php'] = sys::updtext($aData['config_php'], $conf); + if(isset($aWebdbConf[$aData['type']])) + { + $aData['config_php'] = sys::updtext($aData['config_php'], $conf); - $temp = sys::temp($aData['config_php']); - $ssh->setfile($temp, $path.$aWebdbConf[$aData['type']]['file'], $aWebdbConf[$aData['type']]['chmod']); + $temp = sys::temp($aData['config_php']); + $ssh->setfile($temp, $path.$aWebdbConf[$aData['type']]['file'], $aWebdbConf[$aData['type']]['chmod']); - unlink($temp); - } + unlink($temp); + } - if(isset($aWebothPath[$aData['type']])) - { - $aData['config_oth'] = sys::updtext($aData['config_oth'], $conf); + if(isset($aWebothPath[$aData['type']])) + { + $aData['config_oth'] = sys::updtext($aData['config_oth'], $conf); - $temp = sys::temp($aData['config_oth']); - $ssh->setfile($temp, $path.$aWebothPath[$aData['type']]['file'], $aWebothPath[$aData['type']]['chmod']); + $temp = sys::temp($aData['config_oth']); + $ssh->setfile($temp, $path.$aWebothPath[$aData['type']]['file'], $aWebothPath[$aData['type']]['chmod']); - unlink($temp); - } + unlink($temp); + } - // Создание поддомена - $result = json_decode(file_get_contents(sys::updtext($aWebUnit['isp']['domain']['create'], array('subdomain' => $aData['subdomain'], 'ip' => $ip, 'domain' => $aData['domain']))), true); - if(!isset($result['result']) || strtolower($result['result']) != 'ok') - { - $sql->query('DELETE FROM `web` WHERE `id`="'.$wid.'" LIMIT 1'); + // Создание поддомена + $result = json_decode(file_get_contents(sys::updtext($aWebUnit['isp']['domain']['create'], array('subdomain' => $aData['subdomain'], 'ip' => $ip, 'domain' => $aData['domain']))), true); + if(!isset($result['result']) || strtolower($result['result']) != 'ok') + { + $sql->query('DELETE FROM `web` WHERE `id`="'.$wid.'" LIMIT 1'); - sys::outjs(array('e' => 'Не удалось создать поддомен, обратитесь в тех.поддержку.'), $mcache); - } + sys::outjs(array('e' => 'Не удалось создать поддомен, обратитесь в тех.поддержку.'), $mcache); + } - // Создание задания crontab - if(isset($aWebUnit['isp']['crontab'][$aData['type']]['install'])) - { - $result = json_decode(file_get_contents(sys::updtext($aWebUnit['isp']['crontab'][$aData['type']]['install'], array('subdomain' => $aData['subdomain'], 'domain' => $aData['domain']))), true); - if(!isset($result['result']) || strtolower($result['result']) != 'ok') - { - $sql->query('DELETE FROM `web` WHERE `id`="'.$wid.'" LIMIT 1'); + // Создание задания crontab + if(isset($aWebUnit['isp']['crontab'][$aData['type']]['install'])) + { + $result = json_decode(file_get_contents(sys::updtext($aWebUnit['isp']['crontab'][$aData['type']]['install'], array('subdomain' => $aData['subdomain'], 'domain' => $aData['domain']))), true); + if(!isset($result['result']) || strtolower($result['result']) != 'ok') + { + $sql->query('DELETE FROM `web` WHERE `id`="'.$wid.'" LIMIT 1'); - sys::outjs(array('e' => 'Не удалось создать задание, обратитесь в тех.поддержку.'), $mcache); - } - } + sys::outjs(array('e' => 'Не удалось создать задание, обратитесь в тех.поддержку.'), $mcache); + } + } - $a2 = ''.PHP_EOL - .' ServerName '.$aData['subdomain'].'.'.$aData['domain'].PHP_EOL - .' DocumentRoot '.$install.PHP_EOL - .' AddType application/x-httpd-php .php .php3 .php4 .php5 .phtml'.PHP_EOL - .' AddType application/x-httpd-php-source .phps'.PHP_EOL - .''; + $a2 = ''.PHP_EOL + .' ServerName '.$aData['subdomain'].'.'.$aData['domain'].PHP_EOL + .' DocumentRoot '.$install.PHP_EOL + .' AddType application/x-httpd-php .php .php3 .php4 .php5 .phtml'.PHP_EOL + .' AddType application/x-httpd-php-source .phps'.PHP_EOL + .''; - // Смена прав на файлы/папки - $chmod = isset($aWebChmod[$aData['type']]) ? $aWebChmod[$aData['type']] : ''; + // Смена прав на файлы/папки + $chmod = isset($aWebChmod[$aData['type']]) ? $aWebChmod[$aData['type']] : ''; - $sql_q = ''; + $sql_q = ''; - if(isset($aWebSQL[$aData['type']])) - { - $sql_q .= 'mysql --login-path=local -e "CREATE DATABASE '.$login.';' - ."CREATE USER '".$login."'@'%' IDENTIFIED BY '".$passwd."';" - .'GRANT ALL PRIVILEGES ON '.$login.' . * TO \''.$login.'\'@\'%\';";' - .'mysql --login-path=local '.$login.' < '.$aWebUnit['path'][$aWebUnit['unit'][$aData['type']]][$aData['type']].'dump.sql;'; + if(isset($aWebSQL[$aData['type']])) + { + $sql_q .= 'mysql --login-path=local -e "CREATE DATABASE '.$login.';' + ."CREATE USER '".$login."'@'%' IDENTIFIED BY '".$passwd."';" + .'GRANT ALL PRIVILEGES ON '.$login.' . * TO \''.$login.'\'@\'%\';";' + .'mysql --login-path=local '.$login.' < '.$aWebUnit['path'][$aWebUnit['unit'][$aData['type']]][$aData['type']].'dump.sql;'; - if(isset($aWebSQL[$aData['type']]['install'])) - foreach($aWebSQL[$aData['type']]['install'] as $query) - $sql_q .= "mysql --login-path=local ".$login." -e \"".sys::updtext($query, - array( - 'url' => $cfg['http'], - 'passwd' => $aData['passwd'], - 'mail' => $u['mail'], - 'folder' => $install) - )."\";"; - } + if(isset($aWebSQL[$aData['type']]['install'])) + foreach($aWebSQL[$aData['type']]['install'] as $query) + $sql_q .= "mysql --login-path=local ".$login." -e \"".sys::updtext($query, + array( + 'url' => $cfg['http'], + 'passwd' => $aData['passwd'], + 'mail' => $u['mail'], + 'folder' => $install) + )."\";"; + } - // Установка - $ssh->set('echo "'.$a2.'" > /etc/apache2/sites-enabled/'.$aData['subdomain'].'.'.$aData['domain'].';' // Настроки апач - .'mkdir -p '.$install.';' // Создание директории - .'useradd -d '.$install.' -g web -u '.$uid.' web'.$uid.';' // Создание пользователя услуги на локации - .'chown -R web'.$uid.':999 '.$install.';' // Изменение владельца и группы директории - .'cd '.$install.' && sudo -u web'.$uid.' screen -dmS i_w_'.$uid.' sh -c "cp -r '.$path.'/. .; '.$chmod.'";' // Копирование файлов услуги - .'screen -dmS apache_reload_'.$uid.' service apache2 reload;' // Перезагрузить конфигурации апач - .$sql_q); // sql запросы + // Установка + $ssh->set('echo "'.$a2.'" > /etc/apache2/sites-enabled/'.$aData['subdomain'].'.'.$aData['domain'].';' // Настроки апач + .'mkdir -p '.$install.';' // Создание директории + .'useradd -d '.$install.' -g web -u '.$uid.' web'.$uid.';' // Создание пользователя услуги на локации + .'chown -R web'.$uid.':999 '.$install.';' // Изменение владельца и группы директории + .'cd '.$install.' && sudo -u web'.$uid.' screen -dmS i_w_'.$uid.' sh -c "cp -r '.$path.'/. .; '.$chmod.'";' // Копирование файлов услуги + .'screen -dmS apache_reload_'.$uid.' service apache2 reload;' // Перезагрузить конфигурации апач + .$sql_q); // sql запросы - $aData['passwd'] = isset($aData['passwd']) ? $aData['passwd'] : ''; + $aData['passwd'] = isset($aData['passwd']) ? $aData['passwd'] : ''; - // Обновление данных - $sql->query('UPDATE `web` set `uid`="'.$uid.'", `desing`="'.$aData['desing'].'", ' - .'`domain`="'.$aData['subdomain'].'.'.$aData['domain'].'", ' - .'`passwd`="'.$aData['passwd'].'", `config`="'.base64_encode($aData['config_sql']).'", ' - .'`login`="'.$login.'", `date`="'.$start_point.'" ' - .'WHERE `id`="'.$wid.'" LIMIT 1'); + // Обновление данных + $sql->query('UPDATE `web` set `uid`="'.$uid.'", `desing`="'.$aData['desing'].'", ' + .'`domain`="'.$aData['subdomain'].'.'.$aData['domain'].'", ' + .'`passwd`="'.$aData['passwd'].'", `config`="'.base64_encode($aData['config_sql']).'", ' + .'`login`="'.$login.'", `date`="'.$start_point.'" ' + .'WHERE `id`="'.$wid.'" LIMIT 1'); - sys::outjs(array('s' => 'ok'), $mcache); + sys::outjs(array('s' => 'ok'), $mcache); } - public static function update($aData = array(), $mcache) - { - global $sql, $start_point; - - include(DATA.'web.php'); - - $stack = web::stack($aData, '`id`, `uid`, `unit`, `login`, `desing`, `domain`, `update`'); - - if(!$sql->num($stack)) - sys::outjs(array('e' => 'Дополнительная услуга не установлена.'), $mcache); - - $web = $sql->get($stack); - - // Проверка времени последнего обновления - include(LIB.'games/games.php'); - - $upd = $web['update']+86400; - - if($upd > $start_point) - sys::outjs(array('e' => 'Для повторного обновления должно пройти: '.games::date('max', $upd))); - - include(LIB.'ssh.php'); - - $unit = web::unit($aWebUnit, $aData['type'], $web['unit']); - - if(!$ssh->auth($unit['passwd'], $unit['address'])) - sys::outjs(array('e' => sys::text('error', 'ssh')), $mcache); - - $install = $aWebUnit['install'][$aWebUnit['unit'][$aData['type']]][$aData['type']].$web['domain']; - - $path = $aWebUnit['path'][$aWebUnit['unit'][$aData['type']]][$aData['type']].$web['desing']; - - $sql->query('SELECT `mail` FROM `users` WHERE `id`="'.$aData['server']['user'].'" LIMIT 1'); - if(!$sql->num()) - sys::outjs(array('e' => 'Необходимо указать пользователя сервера.'), $mcache); - - $u = $sql->get(); - - // sql запросы - $sql_q = ''; - - if(isset($aWebSQL[$aData['type']]['update'])) - foreach($aWebSQL[$aData['type']]['update'] as $query) - $sql_q .= "mysql --login-path=local ".$web['login']." -e \"".sys::updtext($query, array('passwd' => $aData['passwd'], 'mail' => $u['mail']))."\";"; - - $cat = isset($aWebdbConf[$aData['type']]) ? 'cat '.$install.$aWebdbConf[$aData['type']]['file'].' > '.$path.$aWebdbConf[$aData['type']]['file'].';' : ''; - $chmod = isset($aWebChmod[$aData['type']]) ? $aWebChmod[$aData['type']] : ''; - - $ssh->set($cat - .'cd '.$install.' && sudo -u web'.$web['uid'].' screen -dmS u_w_'.$web['uid'].' sh -c "YES | cp -rf '.$path.'/. .; '.$chmod.'";' - .$sql_q); // sql запрос - - $sql->query('UPDATE `web` set `update`="'.$start_point.'" WHERE `id`="'.$web['id'].'" LIMIT 1'); - - sys::outjs(array('s' => 'ok'), $mcache); - } - - public static function delete($aData = array(), $mcache) + public static function update($aData = array(), $mcache) { - global $sql; + global $sql, $start_point; - include(DATA.'web.php'); + include(DATA.'web.php'); - $stack = web::stack($aData, '`id`, `uid`, `unit`, `domain`, `login`'); + $stack = web::stack($aData, '`id`, `uid`, `unit`, `login`, `desing`, `domain`, `update`'); - if(!$sql->num($stack)) - sys::outjs(array('e' => 'Дополнительная услуга не установлена.'), $mcache); + if(!$sql->num($stack)) + sys::outjs(array('e' => 'Дополнительная услуга не установлена.'), $mcache); - $web = $sql->get($stack); + $web = $sql->get($stack); - include(LIB.'ssh.php'); + // Проверка времени последнего обновления + include(LIB.'games/games.php'); - $unit = web::unit($aWebUnit, $aData['type'], $web['unit']); + $upd = $web['update']+86400; - if(!$ssh->auth($unit['passwd'], $unit['address'])) - sys::outjs(array('e' => sys::text('error', 'ssh')), $mcache); + if($upd > $start_point) + sys::outjs(array('e' => 'Для повторного обновления должно пройти: '.games::date('max', $upd))); - // Директория дополнительной услуги - $delete = ''; + include(LIB.'ssh.php'); - if($web['domain'] != '') - $delete = 'screen -dmS r_w_'.$web['uid'].' rm -r '.$aWebUnit['install'][$aWebUnit['unit'][$aData['type']]][$aData['type']].$web['domain'].';'; + $unit = web::unit($aWebUnit, $aData['type'], $web['unit']); - $ip = sys::first(explode(':', $unit['address'])); + if(!$ssh->auth($unit['passwd'], $unit['address'])) + sys::outjs(array('e' => sys::text('error', 'ssh')), $mcache); - $aDomain = explode('.', $web['domain']); - $zone = array_pop($aDomain); + $install = $aWebUnit['install'][$aWebUnit['unit'][$aData['type']]][$aData['type']].$web['domain']; - // Удаление поддомена - if($aData['type'] != 'mysql') - { - $result = json_decode(file_get_contents(sys::updtext($aWebUnit['isp']['domain']['delete'], array('subdomain' => $web['domain'], 'domain' => end($aDomain).'.'.$zone, 'ip' => $ip))), true); + $path = $aWebUnit['path'][$aWebUnit['unit'][$aData['type']]][$aData['type']].$web['desing']; - if(!isset($result['result']) || strtolower($result['result']) != 'ok') - sys::outjs(array('e' => 'Не удалось удалить поддомен, обратитесь в тех.поддержку.'), $mcache); - } + $sql->query('SELECT `mail` FROM `users` WHERE `id`="'.$aData['server']['user'].'" LIMIT 1'); + if(!$sql->num()) + sys::outjs(array('e' => 'Необходимо указать пользователя сервера.'), $mcache); - // Удаление задания crontab - if(isset($aWebUnit['isp']['crontab'][$aData['type']]['delete']) && isset($aData['cron'])) - { - $result = json_decode(file_get_contents(sys::updtext($aWebUnit['isp']['crontab'][$aData['type']]['delete'], array('data' => $aData['cron']))), true); - if(!isset($result['result']) || strtolower($result['result']) != 'ok') - sys::outjs(array('e' => 'Не удалось удалить задание, обратитесь в тех.поддержку.'), $mcache); - } + $u = $sql->get(); - $sql_q = isset($aWebSQL[$aData['type']]) ? "mysql --login-path=local -e \"DROP DATABASE IF EXISTS ".$web['login']."; DROP USER ".$web['login']."\"" : ''; + // sql запросы + $sql_q = ''; - $ssh->set('rm /etc/apache2/sites-enabled/'.$web['domain'].';' // Удаление настроек апач - .$delete // Удаление файлов - .'userdel web'.$web['uid'].';' // Удаление пользователя - .'screen -dmS apache_reload_'.$web['uid'].' service apache2 reload;' // Перезагрузить конфигурации апач - .$sql_q); // sql запрос + if(isset($aWebSQL[$aData['type']]['update'])) + foreach($aWebSQL[$aData['type']]['update'] as $query) + $sql_q .= "mysql --login-path=local ".$web['login']." -e \"".sys::updtext($query, array('passwd' => $aData['passwd'], 'mail' => $u['mail']))."\";"; - $sql->query('DELETE FROM `web` WHERE `id`="'.$web['id'].'" LIMIT 1'); + $cat = isset($aWebdbConf[$aData['type']]) ? 'cat '.$install.$aWebdbConf[$aData['type']]['file'].' > '.$path.$aWebdbConf[$aData['type']]['file'].';' : ''; + $chmod = isset($aWebChmod[$aData['type']]) ? $aWebChmod[$aData['type']] : ''; - sys::outjs(array('s' => 'ok'), $mcache); - } + $ssh->set($cat + .'cd '.$install.' && sudo -u web'.$web['uid'].' screen -dmS u_w_'.$web['uid'].' sh -c "YES | cp -rf '.$path.'/. .; '.$chmod.'";' + .$sql_q); // sql запрос - public static function connect($aData = array(), $mcache) + $sql->query('UPDATE `web` set `update`="'.$start_point.'" WHERE `id`="'.$web['id'].'" LIMIT 1'); + + sys::outjs(array('s' => 'ok'), $mcache); + } + + public static function delete($aData = array(), $mcache) { - global $cfg, $sql, $start_point; + global $sql; - include(DATA.'web.php'); + include(DATA.'web.php'); - $sql->query('SELECT `id`, `uid`, `unit`, `game`, `user`, `tarif`, `address`, `status`, `name` FROM `servers` WHERE `id`="'.$aData['server'].'" AND `user`="'.$aData['user'].'" LIMIT 1'); - if(!$sql->num()) - sys::outjs(array('e' => 'Игровой сервер не найден.'), $mcache); + $stack = web::stack($aData, '`id`, `uid`, `unit`, `domain`, `login`'); - $server = $sql->get(); + if(!$sql->num($stack)) + sys::outjs(array('e' => 'Дополнительная услуга не установлена.'), $mcache); - // Проверка статуса игрового сервера - if(!in_array($server['status'], array('working', 'off', 'start', 'restart', 'change'))) - sys::outjs(array('e' => 'Игровой сервер недоступен для подключения.'), $mcache); + $web = $sql->get($stack); - // Проверка установки плагина - $sql->query('SELECT `id` FROM `plugins_install` WHERE `server`="'.$server['id'].'" AND `plugin`="'.$aWebConnect[$aData['type']][$server['game']].'" LIMIT 1'); - if(!$sql->num()) - sys::outjs(array('i' => 'Для подключения, необходимо установить плагин.', 'pid' => $aWebConnect[$aData['type']][$server['game']]), $mcache); + include(LIB.'ssh.php'); - $aData['server'] = array_merge($server, array('id' => $aData['server'])); + $unit = web::unit($aWebUnit, $aData['type'], $web['unit']); - $stack = web::stack($aData, '`config`, `unit`, `login`'); + if(!$ssh->auth($unit['passwd'], $unit['address'])) + sys::outjs(array('e' => sys::text('error', 'ssh')), $mcache); - if(!$sql->num($stack)) - sys::outjs(array('e' => 'Дополнительная услуга не установлена.'), $mcache); + // Директория дополнительной услуги + $delete = ''; - $web = $sql->get($stack); + if($web['domain'] != '') + $delete = 'screen -dmS r_w_'.$web['uid'].' rm -r '.$aWebUnit['install'][$aWebUnit['unit'][$aData['type']]][$aData['type']].$web['domain'].';'; - include(LIB.'ssh.php'); + $ip = sys::first(explode(':', $unit['address'])); - $sql->query('SELECT `passwd`, `address` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); + $aDomain = explode('.', $web['domain']); + $zone = array_pop($aDomain); - if(!$ssh->auth($unit['passwd'], $unit['address'])) - sys::outjs(array('e' => sys::text('error', 'ssh')), $mcache); + // Удаление поддомена + if($aData['type'] != 'mysql') + { + $result = json_decode(file_get_contents(sys::updtext($aWebUnit['isp']['domain']['delete'], array('subdomain' => $web['domain'], 'domain' => end($aDomain).'.'.$zone, 'ip' => $ip))), true); - $sql->query('SELECT `install` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); - $tarif = $sql->get(); + if(!isset($result['result']) || strtolower($result['result']) != 'ok') + sys::outjs(array('e' => 'Не удалось удалить поддомен, обратитесь в тех.поддержку.'), $mcache); + } - // Директория игр. сервера - $dir = $tarif['install'].$server['uid'].'/'; + // Удаление задания crontab + if(isset($aWebUnit['isp']['crontab'][$aData['type']]['delete']) && isset($aData['cron'])) + { + $result = json_decode(file_get_contents(sys::updtext($aWebUnit['isp']['crontab'][$aData['type']]['delete'], array('data' => $aData['cron']))), true); + if(!isset($result['result']) || strtolower($result['result']) != 'ok') + sys::outjs(array('e' => 'Не удалось удалить задание, обратитесь в тех.поддержку.'), $mcache); + } - // Взять rcon_password - $get = explode(' ', str_replace('"', '', trim($ssh->get('cat '.$dir.$aData['cfg'].' | grep rcon_password')))); + $sql_q = isset($aWebSQL[$aData['type']]) ? "mysql --login-path=local -e \"DROP DATABASE IF EXISTS ".$web['login']."; DROP USER ".$web['login']."\"" : ''; - $rcon = trim(end($get)); + $ssh->set('rm /etc/apache2/sites-enabled/'.$web['domain'].';' // Удаление настроек апач + .$delete // Удаление файлов + .'userdel web'.$web['uid'].';' // Удаление пользователя + .'screen -dmS apache_reload_'.$web['uid'].' service apache2 reload;' // Перезагрузить конфигурации апач + .$sql_q); // sql запрос - if(!isset($rcon{0})) - sys::outjs(array('r' => 'Необходимо установить rcon пароль (rcon_password).', 'url' => $cfg['http'].'servers/id/'.$server['id'].'/section/settings/subsection/server'), $mcache); + $sql->query('DELETE FROM `web` WHERE `id`="'.$web['id'].'" LIMIT 1'); - $temp = sys::temp(sys::updtext(base64_decode($web['config']), $aData['orcfg'])); + sys::outjs(array('s' => 'ok'), $mcache); + } - $ssh->setfile($temp, $dir.$aData['file'], 0644); + public static function connect($aData = array(), $mcache) + { + global $cfg, $sql, $start_point; - $unit = web::unit($aWebUnit, $aData['type'], $web['unit']); + include(DATA.'web.php'); - if(!$ssh->auth($unit['passwd'], $unit['address'])) - sys::outjs(array('e' => sys::text('error', 'ssh')), $mcache); + $sql->query('SELECT `id`, `uid`, `unit`, `game`, `user`, `tarif`, `address`, `status`, `name` FROM `servers` WHERE `id`="'.$aData['server'].'" AND `user`="'.$aData['user'].'" LIMIT 1'); + if(!$sql->num()) + sys::outjs(array('e' => 'Игровой сервер не найден.'), $mcache); - // sql запросы - $sql_q = ''; + $server = $sql->get(); - list($ip, $port) = explode(':', $server['address']); + // Проверка статуса игрового сервера + if(!in_array($server['status'], array('working', 'off', 'start', 'restart', 'change'))) + sys::outjs(array('e' => 'Игровой сервер недоступен для подключения.'), $mcache); - if(isset($aWebSQL[$aData['type']]['connect'])) - foreach($aWebSQL[$aData['type']]['connect'] as $query) - $sql_q .= "mysql --login-path=local ".$web['login']." -e \"".sys::updtext($query, - array_merge(array('id' => $aData['server']['id'], 'rcon' => $rcon, 'address' => $server['address'], 'ip' => $ip, 'port' => $port, 'name' => $server['name'], 'time' => $start_point), $aData['orsql']))."\";"; + // Проверка установки плагина + $sql->query('SELECT `id` FROM `plugins_install` WHERE `server`="'.$server['id'].'" AND `plugin`="'.$aWebConnect[$aData['type']][$server['game']].'" LIMIT 1'); + if(!$sql->num()) + sys::outjs(array('i' => 'Для подключения, необходимо установить плагин.', 'pid' => $aWebConnect[$aData['type']][$server['game']]), $mcache); - $ssh->set('chown server'.$server['uid'].':servers '.$dir.$aData['file'].';' // Смена владельца файла - .$sql_q); // sql запросы + $aData['server'] = array_merge($server, array('id' => $aData['server'])); - unlink($temp); + $stack = web::stack($aData, '`config`, `unit`, `login`'); - sys::outjs(array('s' => 'ok'), $mcache); - } + if(!$sql->num($stack)) + sys::outjs(array('e' => 'Дополнительная услуга не установлена.'), $mcache); - public static function passwd($aData = array(), $mcache) - { - global $sql; + $web = $sql->get($stack); - include(DATA.'web.php'); + include(LIB.'ssh.php'); - $stack = web::stack($aData); + $sql->query('SELECT `passwd`, `address` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); - if(!$sql->num($stack)) - sys::outjs(array('e' => 'Дополнительная услуга не установлена.'), $mcache); + if(!$ssh->auth($unit['passwd'], $unit['address'])) + sys::outjs(array('e' => sys::text('error', 'ssh')), $mcache); - $web = $sql->get($stack); + $sql->query('SELECT `install` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1'); + $tarif = $sql->get(); - $passwd = sys::passwd($aWebParam[$aData['type']]['passwd']); + // Директория игр. сервера + $dir = $tarif['install'].$server['uid'].'/'; - include(LIB.'ssh.php'); + // Взять rcon_password + $get = explode(' ', str_replace('"', '', trim($ssh->get('cat '.$dir.$aData['cfg'].' | grep rcon_password')))); - $unit = web::unit($aWebUnit, $aData['type'], $web['unit']); + $rcon = trim(end($get)); - if(!$ssh->auth($unit['passwd'], $unit['address'])) - sys::outjs(array('e' => sys::text('error', 'ssh')), $mcache); + if(!isset($rcon{0})) + sys::outjs(array('r' => 'Необходимо установить rcon пароль (rcon_password).', 'url' => $cfg['http'].'servers/id/'.$server['id'].'/section/settings/subsection/server'), $mcache); - $sql_q = ''; + $temp = sys::temp(sys::updtext(base64_decode($web['config']), $aData['orcfg'])); - if(isset($aWebSQL[$aData['type']]['passwd'])) - foreach($aWebSQL[$aData['type']]['passwd'] as $query) - $sql_q .= "mysql --login-path=local ".$web['login']." -e \"".sys::updtext($query, array('passwd' => $passwd))."\";"; + $ssh->setfile($temp, $dir.$aData['file'], 0644); - $ssh->set($sql_q); + $unit = web::unit($aWebUnit, $aData['type'], $web['unit']); - $sql->query('UPDATE `web` set `passwd`="'.$passwd.'" WHERE `id`="'.$web['id'].'" LIMIT 1'); + if(!$ssh->auth($unit['passwd'], $unit['address'])) + sys::outjs(array('e' => sys::text('error', 'ssh')), $mcache); - sys::outjs(array('s' => 'ok'), $mcache); - } + // sql запросы + $sql_q = ''; - public static function stack($aData, $select = '`id`, `unit`, `login`') - { - global $sql; + list($ip, $port) = explode(':', $server['address']); - include(DATA.'web.php'); + if(isset($aWebSQL[$aData['type']]['connect'])) + foreach($aWebSQL[$aData['type']]['connect'] as $query) + $sql_q .= "mysql --login-path=local ".$web['login']." -e \"".sys::updtext($query, + array_merge(array('id' => $aData['server']['id'], 'rcon' => $rcon, 'address' => $server['address'], 'ip' => $ip, 'port' => $port, 'name' => $server['name'], 'time' => $start_point), $aData['orsql']))."\";"; - switch($aWebInstall[$aData['server']['game']][$aData['type']]) - { - case 'server': - return $sql->query('SELECT '.$select.' FROM `web` WHERE `type`="'.$aData['type'].'" AND `server`="'.$aData['server']['id'].'" LIMIT 1'); + $ssh->set('chown server'.$server['uid'].':servers '.$dir.$aData['file'].';' // Смена владельца файла + .$sql_q); // sql запросы - case 'user': - return $sql->query('SELECT '.$select.' FROM `web` WHERE `type`="'.$aData['type'].'" AND `user`="'.$aData['server']['user'].'" LIMIT 1'); + unlink($temp); - case 'unit': - return $sql->query('SELECT '.$select.' FROM `web` WHERE `type`="'.$aData['type'].'" AND `user`="'.$aData['server']['user'].'" AND `unit`="'.$aData['server']['unit'].'" LIMIT 1'); - } + sys::outjs(array('s' => 'ok'), $mcache); + } - return NULL; - } + public static function passwd($aData = array(), $mcache) + { + global $sql; - public static function unit($aWebUnit, $type, $id) - { - global $sql; + include(DATA.'web.php'); - if($aWebUnit['unit'][$type] == 'local') - { - $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$id.'" LIMIT 1'); + $stack = web::stack($aData); - return $sql->get(); - } + if(!$sql->num($stack)) + sys::outjs(array('e' => 'Дополнительная услуга не установлена.'), $mcache); - return array('address' => $aWebUnit['address'], 'passwd' => $aWebUnit['passwd']); - } + $web = $sql->get($stack); + + $passwd = sys::passwd($aWebParam[$aData['type']]['passwd']); + + include(LIB.'ssh.php'); + + $unit = web::unit($aWebUnit, $aData['type'], $web['unit']); + + if(!$ssh->auth($unit['passwd'], $unit['address'])) + sys::outjs(array('e' => sys::text('error', 'ssh')), $mcache); + + $sql_q = ''; + + if(isset($aWebSQL[$aData['type']]['passwd'])) + foreach($aWebSQL[$aData['type']]['passwd'] as $query) + $sql_q .= "mysql --login-path=local ".$web['login']." -e \"".sys::updtext($query, array('passwd' => $passwd))."\";"; + + $ssh->set($sql_q); + + $sql->query('UPDATE `web` set `passwd`="'.$passwd.'" WHERE `id`="'.$web['id'].'" LIMIT 1'); + + sys::outjs(array('s' => 'ok'), $mcache); + } + + public static function stack($aData, $select = '`id`, `unit`, `login`') + { + global $sql; + + include(DATA.'web.php'); + + switch($aWebInstall[$aData['server']['game']][$aData['type']]) + { + case 'server': + return $sql->query('SELECT '.$select.' FROM `web` WHERE `type`="'.$aData['type'].'" AND `server`="'.$aData['server']['id'].'" LIMIT 1'); + + case 'user': + return $sql->query('SELECT '.$select.' FROM `web` WHERE `type`="'.$aData['type'].'" AND `user`="'.$aData['server']['user'].'" LIMIT 1'); + + case 'unit': + return $sql->query('SELECT '.$select.' FROM `web` WHERE `type`="'.$aData['type'].'" AND `user`="'.$aData['server']['user'].'" AND `unit`="'.$aData['server']['unit'].'" LIMIT 1'); + } + + return NULL; + } + + public static function unit($aWebUnit, $type, $id) + { + global $sql; + + if($aWebUnit['unit'][$type] == 'local') + { + $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$id.'" LIMIT 1'); + + return $sql->get(); + } + + return array('address' => $aWebUnit['address'], 'passwd' => $aWebUnit['passwd']); + } } ?> \ No newline at end of file diff --git a/system/library/zip.php b/system/library/zip.php index 8f46a05..e378695 100644 --- a/system/library/zip.php +++ b/system/library/zip.php @@ -1,6 +1,6 @@ 2) { PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, - "Invalid number / type of arguments"); + "Invalid number / type of arguments"); return 0; } } @@ -390,7 +390,7 @@ ,PCLZIP_ATT_FILE_MTIME => 'optional' ,PCLZIP_ATT_FILE_CONTENT => 'optional' ,PCLZIP_ATT_FILE_COMMENT => 'optional' - ); + ); foreach ($v_att_list as $v_entry) { $v_result = $this->privFileDescrParseAtt($v_entry, $v_filedescr_list[], @@ -494,7 +494,7 @@ PCLZIP_OPT_TEMP_FILE_ON => 'optional', PCLZIP_OPT_TEMP_FILE_OFF => 'optional' //, PCLZIP_OPT_CRYPT => 'optional' - )); + )); if ($v_result != 1) { return 0; } @@ -573,7 +573,7 @@ ,PCLZIP_ATT_FILE_MTIME => 'optional' ,PCLZIP_ATT_FILE_CONTENT => 'optional' ,PCLZIP_ATT_FILE_COMMENT => 'optional' - ); + ); foreach ($v_att_list as $v_entry) { $v_result = $this->privFileDescrParseAtt($v_entry, $v_filedescr_list[], @@ -753,7 +753,7 @@ PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional', PCLZIP_OPT_TEMP_FILE_ON => 'optional', PCLZIP_OPT_TEMP_FILE_OFF => 'optional' - )); + )); if ($v_result != 1) { return 0; } @@ -807,7 +807,7 @@ // ----- Call the extracting fct $p_list = array(); $v_result = $this->privExtractByRule($p_list, $v_path, $v_remove_path, - $v_remove_all_path, $v_options); + $v_remove_all_path, $v_options); if ($v_result < 1) { unset($p_list); return(0); @@ -909,7 +909,7 @@ PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional', PCLZIP_OPT_TEMP_FILE_ON => 'optional', PCLZIP_OPT_TEMP_FILE_OFF => 'optional' - )); + )); if ($v_result != 1) { return 0; } @@ -1376,7 +1376,7 @@ { $v_result = true; - // ----- Reset the file system cache + // ----- Reset the file system cache clearstatcache(); // ----- Reset the error handler @@ -1598,9 +1598,9 @@ if (($i+1) >= $p_size) { // ----- Error log PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, - "Missing parameter value for option '" - .PclZipUtilOptionText($p_options_list[$i]) - ."'"); + "Missing parameter value for option '" + .PclZipUtilOptionText($p_options_list[$i]) + ."'"); // ----- Return return PclZip::errorCode(); @@ -1613,9 +1613,9 @@ else { // ----- Error log PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, - "Wrong parameter value for option '" - .PclZipUtilOptionText($p_options_list[$i]) - ."'"); + "Wrong parameter value for option '" + .PclZipUtilOptionText($p_options_list[$i]) + ."'"); // ----- Return return PclZip::errorCode(); @@ -1781,8 +1781,8 @@ default : // ----- Error log PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, - "Unknown parameter '" - .$p_options_list[$i]."'"); + "Unknown parameter '" + .$p_options_list[$i]."'"); // ----- Return return PclZip::errorCode(); @@ -1956,7 +1956,7 @@ default : // ----- Error log PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, - "Unknown parameter '".$v_key."'"); + "Unknown parameter '".$v_key."'"); // ----- Return return PclZip::errorCode(); @@ -3035,12 +3035,12 @@ // ----- Packed data $v_binary_data = pack("VvvvvvVVVvv", 0x04034b50, - $p_header['version_extracted'], $p_header['flag'], + $p_header['version_extracted'], $p_header['flag'], $p_header['compression'], $v_mtime, $v_mdate, $p_header['crc'], $p_header['compressed_size'], - $p_header['size'], + $p_header['size'], strlen($p_header['stored_filename']), - $p_header['extra_len']); + $p_header['extra_len']); // ----- Write the first 148 bytes of the header in the archive fputs($this->zip_fd, $v_binary_data, 30); @@ -3082,14 +3082,14 @@ // ----- Packed data $v_binary_data = pack("VvvvvvvVVVvvvvvVV", 0x02014b50, - $p_header['version'], $p_header['version_extracted'], + $p_header['version'], $p_header['version_extracted'], $p_header['flag'], $p_header['compression'], - $v_mtime, $v_mdate, $p_header['crc'], + $v_mtime, $v_mdate, $p_header['crc'], $p_header['compressed_size'], $p_header['size'], strlen($p_header['stored_filename']), - $p_header['extra_len'], $p_header['comment_len'], + $p_header['extra_len'], $p_header['comment_len'], $p_header['disk'], $p_header['internal'], - $p_header['external'], $p_header['offset']); + $p_header['external'], $p_header['offset']); // ----- Write the 42 bytes of the header in the zip file fputs($this->zip_fd, $v_binary_data, 46); @@ -3125,8 +3125,8 @@ // ----- Packed data $v_binary_data = pack("VvvvvVVv", 0x06054b50, 0, 0, $p_nb_entries, - $p_nb_entries, $p_size, - $p_offset, strlen($p_comment)); + $p_nb_entries, $p_size, + $p_offset, strlen($p_comment)); // ----- Write the 22 bytes of the header in the zip file fputs($this->zip_fd, $v_binary_data, 22); @@ -3283,9 +3283,9 @@ // ----- Check the path if ( ($p_path == "") - || ( (substr($p_path, 0, 1) != "/") - && (substr($p_path, 0, 3) != "../") - && (substr($p_path,1,2)!=":/"))) + || ( (substr($p_path, 0, 1) != "/") + && (substr($p_path, 0, 3) != "../") + && (substr($p_path,1,2)!=":/"))) $p_path = "./".$p_path; // ----- Reduce the path last (and duplicated) '/' @@ -3435,50 +3435,50 @@ $v_extract = true; } - // ----- Check compression method - if ( ($v_extract) - && ( ($v_header['compression'] != 8) - && ($v_header['compression'] != 0))) { + // ----- Check compression method + if ( ($v_extract) + && ( ($v_header['compression'] != 8) + && ($v_header['compression'] != 0))) { $v_header['status'] = 'unsupported_compression'; // ----- Look for PCLZIP_OPT_STOP_ON_ERROR if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) - && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) { + && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) { $this->privSwapBackMagicQuotes(); PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_COMPRESSION, - "Filename '".$v_header['stored_filename']."' is " - ."compressed by an unsupported compression " - ."method (".$v_header['compression'].") "); + "Filename '".$v_header['stored_filename']."' is " + ."compressed by an unsupported compression " + ."method (".$v_header['compression'].") "); return PclZip::errorCode(); - } - } - - // ----- Check encrypted files - if (($v_extract) && (($v_header['flag'] & 1) == 1)) { + } + } + + // ----- Check encrypted files + if (($v_extract) && (($v_header['flag'] & 1) == 1)) { $v_header['status'] = 'unsupported_encryption'; // ----- Look for PCLZIP_OPT_STOP_ON_ERROR if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) - && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) { + && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) { $this->privSwapBackMagicQuotes(); PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_ENCRYPTION, - "Unsupported encryption for " - ." filename '".$v_header['stored_filename'] - ."'"); + "Unsupported encryption for " + ." filename '".$v_header['stored_filename'] + ."'"); return PclZip::errorCode(); - } + } } // ----- Look for real extraction if (($v_extract) && ($v_header['status'] != 'ok')) { $v_result = $this->privConvertHeader2FileInfo($v_header, - $p_file_list[$v_nb_extracted++]); + $p_file_list[$v_nb_extracted++]); if ($v_result != 1) { $this->privCloseFd(); $this->privSwapBackMagicQuotes(); @@ -3539,12 +3539,12 @@ // ----- Look for user callback abort if ($v_result1 == 2) { - break; + break; } } // ----- Look for extraction in standard output elseif ( (isset($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) - && ($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) { + && ($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) { // ----- Extracting the file in standard output $v_result1 = $this->privExtractFileInOutput($v_header, $p_options); if ($v_result1 < 1) { @@ -3562,16 +3562,16 @@ // ----- Look for user callback abort if ($v_result1 == 2) { - break; + break; } } // ----- Look for normal extraction else { // ----- Extracting the file $v_result1 = $this->privExtractFile($v_header, - $p_path, $p_remove_path, - $p_remove_all_path, - $p_options); + $p_path, $p_remove_path, + $p_remove_all_path, + $p_options); if ($v_result1 < 1) { $this->privCloseFd(); $this->privSwapBackMagicQuotes(); @@ -3590,7 +3590,7 @@ // ----- Look for user callback abort if ($v_result1 == 2) { - break; + break; } } } @@ -3681,8 +3681,8 @@ if ($v_inclusion == 0) { PclZip::privErrorLog(PCLZIP_ERR_DIRECTORY_RESTRICTION, - "Filename '".$p_entry['filename']."' is " - ."outside PCLZIP_OPT_EXTRACT_DIR_RESTRICTION"); + "Filename '".$p_entry['filename']."' is " + ."outside PCLZIP_OPT_EXTRACT_DIR_RESTRICTION"); return PclZip::errorCode(); } @@ -3710,7 +3710,7 @@ if ($v_result == 2) { // ----- This status is internal and will be changed in 'skipped' $p_entry['status'] = "aborted"; - $v_result = PCLZIP_ERR_USER_ABORTED; + $v_result = PCLZIP_ERR_USER_ABORTED; } // ----- Update the informations @@ -3737,14 +3737,14 @@ // For historical reason first PclZip implementation does not stop // when this kind of error occurs. if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) - && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) { + && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) { PclZip::privErrorLog(PCLZIP_ERR_ALREADY_A_DIRECTORY, - "Filename '".$p_entry['filename']."' is " - ."already used by an existing directory"); + "Filename '".$p_entry['filename']."' is " + ."already used by an existing directory"); return PclZip::errorCode(); - } + } } // ----- Look if file is write protected else if (!is_writeable($p_entry['filename'])) @@ -3757,14 +3757,14 @@ // For historical reason first PclZip implementation does not stop // when this kind of error occurs. if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) - && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) { + && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) { PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, - "Filename '".$p_entry['filename']."' exists " - ."and is write protected"); + "Filename '".$p_entry['filename']."' exists " + ."and is write protected"); return PclZip::errorCode(); - } + } } // ----- Look if the extracted file is older @@ -3772,24 +3772,24 @@ { // ----- Change the file status if ( (isset($p_options[PCLZIP_OPT_REPLACE_NEWER])) - && ($p_options[PCLZIP_OPT_REPLACE_NEWER]===true)) { - } - else { + && ($p_options[PCLZIP_OPT_REPLACE_NEWER]===true)) { + } + else { $p_entry['status'] = "newer_exist"; // ----- Look for PCLZIP_OPT_STOP_ON_ERROR // For historical reason first PclZip implementation does not stop // when this kind of error occurs. if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) - && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) { + && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) { PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, - "Newer version of '".$p_entry['filename']."' exists " - ."and option PCLZIP_OPT_REPLACE_NEWER is not selected"); + "Newer version of '".$p_entry['filename']."' exists " + ."and option PCLZIP_OPT_REPLACE_NEWER is not selected"); return PclZip::errorCode(); - } - } + } + } } else { } @@ -3825,7 +3825,7 @@ // ----- Look for not compressed file if ($p_entry['compression'] == 0) { - // ----- Opening destination file + // ----- Opening destination file if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) { @@ -3930,11 +3930,11 @@ } } - // ----- Change abort status - if ($p_entry['status'] == "aborted") { + // ----- Change abort status + if ($p_entry['status'] == "aborted") { $p_entry['status'] = "skipped"; - } - + } + // ----- Look for post-extract callback elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) { @@ -3950,7 +3950,7 @@ // ----- Look for abort result if ($v_result == 2) { - $v_result = PCLZIP_ERR_USER_ABORTED; + $v_result = PCLZIP_ERR_USER_ABORTED; } } @@ -4078,7 +4078,7 @@ if ($v_result == 2) { // ----- This status is internal and will be changed in 'skipped' $p_entry['status'] = "aborted"; - $v_result = PCLZIP_ERR_USER_ABORTED; + $v_result = PCLZIP_ERR_USER_ABORTED; } // ----- Update the informations @@ -4119,10 +4119,10 @@ } } - // ----- Change abort status - if ($p_entry['status'] == "aborted") { + // ----- Change abort status + if ($p_entry['status'] == "aborted") { $p_entry['status'] = "skipped"; - } + } // ----- Look for post-extract callback elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) { @@ -4139,7 +4139,7 @@ // ----- Look for abort result if ($v_result == 2) { - $v_result = PCLZIP_ERR_USER_ABORTED; + $v_result = PCLZIP_ERR_USER_ABORTED; } } @@ -4193,7 +4193,7 @@ if ($v_result == 2) { // ----- This status is internal and will be changed in 'skipped' $p_entry['status'] = "aborted"; - $v_result = PCLZIP_ERR_USER_ABORTED; + $v_result = PCLZIP_ERR_USER_ABORTED; } // ----- Update the informations @@ -4233,11 +4233,11 @@ } - // ----- Change abort status - if ($p_entry['status'] == "aborted") { + // ----- Change abort status + if ($p_entry['status'] == "aborted") { $p_entry['status'] = "skipped"; - } - + } + // ----- Look for post-extract callback elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) { @@ -4261,7 +4261,7 @@ // ----- Look for abort result if ($v_result == 2) { - $v_result = PCLZIP_ERR_USER_ABORTED; + $v_result = PCLZIP_ERR_USER_ABORTED; } } @@ -4491,27 +4491,27 @@ { $v_result=1; - // ----- Check the static values - // TBC - if ($p_local_header['filename'] != $p_central_header['filename']) { - } - if ($p_local_header['version_extracted'] != $p_central_header['version_extracted']) { - } - if ($p_local_header['flag'] != $p_central_header['flag']) { - } - if ($p_local_header['compression'] != $p_central_header['compression']) { - } - if ($p_local_header['mtime'] != $p_central_header['mtime']) { - } - if ($p_local_header['filename_len'] != $p_central_header['filename_len']) { - } + // ----- Check the static values + // TBC + if ($p_local_header['filename'] != $p_central_header['filename']) { + } + if ($p_local_header['version_extracted'] != $p_central_header['version_extracted']) { + } + if ($p_local_header['flag'] != $p_central_header['flag']) { + } + if ($p_local_header['compression'] != $p_central_header['compression']) { + } + if ($p_local_header['mtime'] != $p_central_header['mtime']) { + } + if ($p_local_header['filename_len'] != $p_central_header['filename_len']) { + } - // ----- Look for flag bit 3 - if (($p_local_header['flag'] & 8) == 8) { + // ----- Look for flag bit 3 + if (($p_local_header['flag'] & 8) == 8) { $p_local_header['size'] = $p_central_header['size']; $p_local_header['compressed_size'] = $p_central_header['compressed_size']; $p_local_header['crc'] = $p_central_header['crc']; - } + } // ----- Return return $v_result; @@ -4637,19 +4637,19 @@ // ----- Check the global size if (($v_pos + $v_data['comment_size'] + 18) != $v_size) { - // ----- Removed in release 2.2 see readme file - // The check of the file size is a little too strict. - // Some bugs where found when a zip is encrypted/decrypted with 'crypt'. - // While decrypted, zip has training 0 bytes - if (0) { + // ----- Removed in release 2.2 see readme file + // The check of the file size is a little too strict. + // Some bugs where found when a zip is encrypted/decrypted with 'crypt'. + // While decrypted, zip has training 0 bytes + if (0) { // ----- Error log PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, - 'The central dir is not at the end of the archive.' - .' Some trailing bytes exists after the archive.'); + 'The central dir is not at the end of the archive.' + .' Some trailing bytes exists after the archive.'); // ----- Return return PclZip::errorCode(); - } + } } // ----- Get comment @@ -4811,7 +4811,7 @@ } } else { - $v_found = true; + $v_found = true; } // ----- Look for deletion @@ -4874,7 +4874,7 @@ // ----- Check that local file header is same as central file header if ($this->privCheckFileHeaders($v_local_header, - $v_header_list[$i]) != 1) { + $v_header_list[$i]) != 1) { // TBC } unset($v_local_header); @@ -5332,22 +5332,22 @@ // ----- Look if function exists if ( (!function_exists("get_magic_quotes_runtime")) - || (!function_exists("set_magic_quotes_runtime"))) { + || (!function_exists("set_magic_quotes_runtime"))) { return $v_result; - } + } // ----- Look if already done if ($this->magic_quotes_status != -1) { return $v_result; - } + } - // ----- Get and memorize the magic_quote value - $this->magic_quotes_status = @get_magic_quotes_runtime(); + // ----- Get and memorize the magic_quote value + $this->magic_quotes_status = @get_magic_quotes_runtime(); - // ----- Disable magic_quotes - if ($this->magic_quotes_status == 1) { - @set_magic_quotes_runtime(0); - } + // ----- Disable magic_quotes + if ($this->magic_quotes_status == 1) { + @set_magic_quotes_runtime(0); + } // ----- Return return $v_result; @@ -5366,19 +5366,19 @@ // ----- Look if function exists if ( (!function_exists("get_magic_quotes_runtime")) - || (!function_exists("set_magic_quotes_runtime"))) { + || (!function_exists("set_magic_quotes_runtime"))) { return $v_result; - } + } // ----- Look if something to do if ($this->magic_quotes_status != -1) { return $v_result; - } + } - // ----- Swap back magic_quotes - if ($this->magic_quotes_status == 1) { - @set_magic_quotes_runtime($this->magic_quotes_status); - } + // ----- Swap back magic_quotes + if ($this->magic_quotes_status == 1) { + @set_magic_quotes_runtime($this->magic_quotes_status); + } // ----- Return return $v_result; @@ -5413,37 +5413,37 @@ // Should be the first $i=0, but no check is done } else if ($v_list[$i] == "..") { - $v_skip++; + $v_skip++; } else if ($v_list[$i] == "") { - // ----- First '/' i.e. root slash - if ($i == 0) { + // ----- First '/' i.e. root slash + if ($i == 0) { $v_result = "/".$v_result; - if ($v_skip > 0) { - // ----- It is an invalid path, so the path is not modified - // TBC - $v_result = $p_dir; + if ($v_skip > 0) { + // ----- It is an invalid path, so the path is not modified + // TBC + $v_result = $p_dir; $v_skip = 0; - } - } - // ----- Last '/' i.e. indicates a directory - else if ($i == (sizeof($v_list)-1)) { + } + } + // ----- Last '/' i.e. indicates a directory + else if ($i == (sizeof($v_list)-1)) { $v_result = $v_list[$i]; - } - // ----- Double '/' inside the path - else { + } + // ----- Double '/' inside the path + else { // ----- Ignore only the double '//' in path, // but not the first and last '/' - } + } } else { - // ----- Look for item to skip - if ($v_skip > 0) { - $v_skip--; - } - else { + // ----- Look for item to skip + if ($v_skip > 0) { + $v_skip--; + } + else { $v_result = $v_list[$i].($i!=(sizeof($v_list)-1)?"/".$v_result:""); - } + } } } @@ -5650,13 +5650,13 @@ $v_list = get_defined_constants(); for (reset($v_list); $v_key = key($v_list); next($v_list)) { - $v_prefix = substr($v_key, 0, 10); - if (( ($v_prefix == 'PCLZIP_OPT') + $v_prefix = substr($v_key, 0, 10); + if (( ($v_prefix == 'PCLZIP_OPT') || ($v_prefix == 'PCLZIP_CB_') || ($v_prefix == 'PCLZIP_ATT')) - && ($v_list[$v_key] == $p_option)) { + && ($v_list[$v_key] == $p_option)) { return $v_key; - } + } } $v_result = 'Unknown'; diff --git a/system/sections/web/aes/free/connect.php b/system/sections/web/aes/free/connect.php index bb68efa..26ac934 100644 --- a/system/sections/web/aes/free/connect.php +++ b/system/sections/web/aes/free/connect.php @@ -1,30 +1,30 @@ 'Длина ключа не должна превышать 32 символа.'), $nmch); + if(isset($key[32])) + sys::outjs(array('e' => 'Длина ключа не должна превышать 32 символа.'), $nmch); - include(LIB.'web/free.php'); + include(LIB.'web/free.php'); - $aData = array(); + $aData = array(); - $aData['server'] = sys::int($url['server']); - $aData['type'] = $url['subsection']; - $aData['user'] = $server['user']; - $aData['file'] = 'cstrike/addons/amxmodx/configs/csstats_mysql.cfg'; - $aData['cfg'] = 'cstrike/server.cfg'; + $aData['server'] = sys::int($url['server']); + $aData['type'] = $url['subsection']; + $aData['user'] = $server['user']; + $aData['file'] = 'cstrike/addons/amxmodx/configs/csstats_mysql.cfg'; + $aData['cfg'] = 'cstrike/server.cfg'; - $aData['orcfg'] = array( - 'key' => $key - ); + $aData['orcfg'] = array( + 'key' => $key + ); - $aData['orsql'] = array(); + $aData['orsql'] = array(); - web::connect($aData, $nmch); + web::connect($aData, $nmch); ?> \ No newline at end of file diff --git a/system/sections/web/mysql/free/install.php b/system/sections/web/mysql/free/install.php index 4e0d6fa..3d05d32 100644 --- a/system/sections/web/mysql/free/install.php +++ b/system/sections/web/mysql/free/install.php @@ -1,99 +1,99 @@ 'Дополнительная услуга недоступна для установки.'), $nmch); + // Установка + if($go) + { + if(!$aWeb[$server['game']][$url['subsection']]) + sys::outjs(array('e' => 'Дополнительная услуга недоступна для установки.'), $nmch); - // Проверка на наличие уже установленной выбранной услуги - switch($aWebInstall[$server['game']][$url['subsection']]) - { - case 'server': - $sql->query('SELECT `id` FROM `web` WHERE `type`="'.$url['subsection'].'" AND `server`="'.$id.'" LIMIT 1'); - break; + // Проверка на наличие уже установленной выбранной услуги + switch($aWebInstall[$server['game']][$url['subsection']]) + { + case 'server': + $sql->query('SELECT `id` FROM `web` WHERE `type`="'.$url['subsection'].'" AND `server`="'.$id.'" LIMIT 1'); + break; - case 'user': - $sql->query('SELECT `id` FROM `web` WHERE `type`="'.$url['subsection'].'" AND `user`="'.$server['user'].'" LIMIT 1'); - break; + case 'user': + $sql->query('SELECT `id` FROM `web` WHERE `type`="'.$url['subsection'].'" AND `user`="'.$server['user'].'" LIMIT 1'); + break; - case 'unit': - $sql->query('SELECT `id` FROM `web` WHERE `type`="'.$url['subsection'].'" AND `user`="'.$server['user'].'" AND `unit`="'.$server['unit'].'" LIMIT 1'); - break; - } + case 'unit': + $sql->query('SELECT `id` FROM `web` WHERE `type`="'.$url['subsection'].'" AND `user`="'.$server['user'].'" AND `unit`="'.$server['unit'].'" LIMIT 1'); + break; + } - if($sql->num()) - sys::outjs(array('s' => 'ok'), $nmch); + if($sql->num()) + sys::outjs(array('s' => 'ok'), $nmch); - include(LIB.'ssh.php'); + include(LIB.'ssh.php'); - if($aWebUnit['unit'][$url['subsection']] == 'local') - { - $sql->query('SELECT `address`, `passwd`, `domain` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); - $unit = $sql->get(); + if($aWebUnit['unit'][$url['subsection']] == 'local') + { + $sql->query('SELECT `address`, `passwd`, `domain` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1'); + $unit = $sql->get(); - $pma = $unit['domain']; - }else{ - $unit = array( - 'address' => $aWebUnit['address'], - 'passwd' => $aWebUnit['passwd'], - ); + $pma = $unit['domain']; + }else{ + $unit = array( + 'address' => $aWebUnit['address'], + 'passwd' => $aWebUnit['passwd'], + ); - $pma = $aWebUnit['pma']; - } + $pma = $aWebUnit['pma']; + } - if(!$ssh->auth($unit['passwd'], $unit['address'])) - sys::outjs(array('e' => sys::text('ssh', 'error')), $nmch); + if(!$ssh->auth($unit['passwd'], $unit['address'])) + sys::outjs(array('e' => sys::text('ssh', 'error')), $nmch); - if(isset($_POST['passwd'])) - { - // Если не указан пароль сгенерировать - if($_POST['passwd'] == '') - $passwd = sys::passwd($aWebParam[$url['subsection']]['passwd']); - else{ - // Проверка длинны пароля - if(!isset($_POST['passwd'][5]) || isset($_POST['passwd'][16])) - sys::outjs(array('e' => 'Необходимо указать пароль длинной не менее 6-и символов и не более 16-и.'), $nmch); + if(isset($_POST['passwd'])) + { + // Если не указан пароль сгенерировать + if($_POST['passwd'] == '') + $passwd = sys::passwd($aWebParam[$url['subsection']]['passwd']); + else{ + // Проверка длинны пароля + if(!isset($_POST['passwd'][5]) || isset($_POST['passwd'][16])) + sys::outjs(array('e' => 'Необходимо указать пароль длинной не менее 6-и символов и не более 16-и.'), $nmch); - // Проверка валидности пароля - if(sys::valid($_POST['passwd'], 'other', "/^[A-Za-z0-9]{6,16}$/")) - sys::outjs(array('e' => 'Пароль должен состоять из букв a-z и цифр.'), $nmch); + // Проверка валидности пароля + if(sys::valid($_POST['passwd'], 'other', "/^[A-Za-z0-9]{6,16}$/")) + sys::outjs(array('e' => 'Пароль должен состоять из букв a-z и цифр.'), $nmch); - $passwd = $_POST['passwd']; - } - }else - $passwd = sys::passwd($aWebParam[$url['subsection']]['passwd']); + $passwd = $_POST['passwd']; + } + }else + $passwd = sys::passwd($aWebParam[$url['subsection']]['passwd']); - $sql->query('INSERT INTO `web` set `type`="'.$url['subsection'].'", `server`="'.$id.'", `user`="'.$server['user'].'", `unit`="'.$server['unit'].'", `config`=""'); - $wid = $sql->id(); - $uid = $wid+10000; + $sql->query('INSERT INTO `web` set `type`="'.$url['subsection'].'", `server`="'.$id.'", `user`="'.$server['user'].'", `unit`="'.$server['unit'].'", `config`=""'); + $wid = $sql->id(); + $uid = $wid+10000; - // Данные - $login = substr('sql_'.$wid.'_free', 0, 14); + // Данные + $login = substr('sql_'.$wid.'_free', 0, 14); - $sql_q = 'mysql --login-path=local -e "CREATE DATABASE '.$login.';' - ."CREATE USER '".$login."'@'%' IDENTIFIED BY '".$passwd."';" - .'GRANT ALL PRIVILEGES ON '.$login.' . * TO \''.$login.'\'@\'%\';";'; + $sql_q = 'mysql --login-path=local -e "CREATE DATABASE '.$login.';' + ."CREATE USER '".$login."'@'%' IDENTIFIED BY '".$passwd."';" + .'GRANT ALL PRIVILEGES ON '.$login.' . * TO \''.$login.'\'@\'%\';";'; - $ssh->set($sql_q); + $ssh->set($sql_q); - // Обновление данных - $sql->query('UPDATE `web` set `uid`="'.$uid.'",' - .'`domain`="'.$pma.'",' - .'`passwd`="'.$passwd.'",' - .'`login`="'.$login.'", `date`="'.$start_point.'" ' - .'WHERE `id`="'.$wid.'" LIMIT 1'); + // Обновление данных + $sql->query('UPDATE `web` set `uid`="'.$uid.'",' + .'`domain`="'.$pma.'",' + .'`passwd`="'.$passwd.'",' + .'`login`="'.$login.'", `date`="'.$start_point.'" ' + .'WHERE `id`="'.$wid.'" LIMIT 1'); - sys::outjs(array('s' => 'ok'), $nmch); - } + sys::outjs(array('s' => 'ok'), $nmch); + } - $html->nav('Установка '.$aWebname[$url['subsection']]); + $html->nav('Установка '.$aWebname[$url['subsection']]); - $html->get('install', 'sections/web/'.$url['subsection'].'/free'); + $html->get('install', 'sections/web/'.$url['subsection'].'/free'); - $html->set('id', $id); + $html->set('id', $id); - $html->pack('main'); + $html->pack('main'); ?> \ No newline at end of file diff --git a/system/sections/wiki/msearch.php b/system/sections/wiki/msearch.php index 98031d1..de5aa5f 100644 --- a/system/sections/wiki/msearch.php +++ b/system/sections/wiki/msearch.php @@ -1,156 +1,156 @@ ''))); + $text = isset($_POST['text']) ? $_POST['text'] : (isset($url['tag']) ? urldecode($url['tag']) : sys::outjs(array('none' => ''))); - $mkey = md5($text.'wiki'); + $mkey = md5($text.'wiki'); - if($mcache->get($mkey) != '' AND !isset($url['tag'])) - sys::outjs(array('s' => $mcache->get($mkey))); + if($mcache->get($mkey) != '' AND !isset($url['tag'])) + sys::outjs(array('s' => $mcache->get($mkey))); - if(!isset($text[2]) AND !isset($url['tag'])) - sys::outjs(array('s' => 'Для выполнения поиска, необходимо больше данных', $nmch)); + if(!isset($text[2]) AND !isset($url['tag'])) + sys::outjs(array('s' => 'Для выполнения поиска, необходимо больше данных', $nmch)); - $aWiki_q = array(); - $aNswer_q = array(); + $aWiki_q = array(); + $aNswer_q = array(); - // Поиск по вопросу - $wiki_q = $sql->query('SELECT `id` FROM `wiki` WHERE `name` LIKE FROM_BASE64(\''.base64_encode('%'.$text.'%').'\') OR `tags` LIKE FROM_BASE64(\''.base64_encode('%'.$text.'%').'\') LIMIT 3'); + // Поиск по вопросу + $wiki_q = $sql->query('SELECT `id` FROM `wiki` WHERE `name` LIKE FROM_BASE64(\''.base64_encode('%'.$text.'%').'\') OR `tags` LIKE FROM_BASE64(\''.base64_encode('%'.$text.'%').'\') LIMIT 3'); - // Поиск по тексту (ответу) - $answer_q = $sql->query('SELECT `wiki` FROM `wiki_answer` WHERE `text` LIKE FROM_BASE64(\''.base64_encode('%'.$text.'%').'\') LIMIT 5'); + // Поиск по тексту (ответу) + $answer_q = $sql->query('SELECT `wiki` FROM `wiki_answer` WHERE `text` LIKE FROM_BASE64(\''.base64_encode('%'.$text.'%').'\') LIMIT 5'); - // Если нет ниодного совпадения по вводимому тексту - if(!$sql->num($wiki_q) AND !$sql->num($answer_q) AND !isset($url['tag'])) - { - // Поиск по словам - if(!strpos($text, ' ')) - { - $mcache->set($mkey, 'По вашему запросу ничего не найдено', false, 15); + // Если нет ниодного совпадения по вводимому тексту + if(!$sql->num($wiki_q) AND !$sql->num($answer_q) AND !isset($url['tag'])) + { + // Поиск по словам + if(!strpos($text, ' ')) + { + $mcache->set($mkey, 'По вашему запросу ничего не найдено', false, 15); - sys::outjs(array('s' => 'По вашему запросу ничего не найдено')); - } + sys::outjs(array('s' => 'По вашему запросу ничего не найдено')); + } - // Массив слов - $aText = explode(' ', $text); + // Массив слов + $aText = explode(' ', $text); - // Метка, которая изменится в процессе, если будет найдено хоть одно совпадение - $sWord = false; + // Метка, которая изменится в процессе, если будет найдено хоть одно совпадение + $sWord = false; - foreach($aText as $word) - { - if($word == '' || !isset($word[2])) - continue; + foreach($aText as $word) + { + if($word == '' || !isset($word[2])) + continue; - // Поиск по вопросу - $wiki_q = $sql->query('SELECT `id` FROM `wiki` WHERE `name` LIKE FROM_BASE64(\''.base64_encode('%'.$word.'%').'\') OR `tags` LIKE FROM_BASE64(\''.base64_encode('%'.$word.'%').'\') LIMIT 3'); + // Поиск по вопросу + $wiki_q = $sql->query('SELECT `id` FROM `wiki` WHERE `name` LIKE FROM_BASE64(\''.base64_encode('%'.$word.'%').'\') OR `tags` LIKE FROM_BASE64(\''.base64_encode('%'.$word.'%').'\') LIMIT 3'); - // Поиск по тексту (ответу) - $answer_q = $sql->query('SELECT `wiki` FROM `wiki_answer` WHERE `text` LIKE FROM_BASE64(\''.base64_encode('%'.$word.'%').'\') LIMIT 5'); + // Поиск по тексту (ответу) + $answer_q = $sql->query('SELECT `wiki` FROM `wiki_answer` WHERE `text` LIKE FROM_BASE64(\''.base64_encode('%'.$word.'%').'\') LIMIT 5'); - if($sql->num($wiki_q)) - $aWiki_q[] = $wiki_q; + if($sql->num($wiki_q)) + $aWiki_q[] = $wiki_q; - if($sql->num($answer_q)) - $aNswer_q[] = $answer_q; - } + if($sql->num($answer_q)) + $aNswer_q[] = $answer_q; + } - }else{ - $aWiki_q[] = $wiki_q; - $aNswer_q[] = $answer_q; - } + }else{ + $aWiki_q[] = $wiki_q; + $aNswer_q[] = $answer_q; + } - if(!count($aWiki_q) AND !count($aNswer_q) AND !isset($url['tag'])) - { - $mcache->set($mkey, 'По вашему запросу ничего не найдено', false, 15); + if(!count($aWiki_q) AND !count($aNswer_q) AND !isset($url['tag'])) + { + $mcache->set($mkey, 'По вашему запросу ничего не найдено', false, 15); - sys::outjs(array('s' => 'По вашему запросу ничего не найдено')); - } + sys::outjs(array('s' => 'По вашему запросу ничего не найдено')); + } - // Защита от дублирования - $aResult = array(); + // Защита от дублирования + $aResult = array(); - foreach($aWiki_q as $index => $wiki_q) - { - // Генерация списка (совпадение по вопросу) - while($wiki = $sql->get($wiki_q)) - { - // Проверка дублирования - if(in_array($wiki['id'], $aResult)) - continue; + foreach($aWiki_q as $index => $wiki_q) + { + // Генерация списка (совпадение по вопросу) + while($wiki = $sql->get($wiki_q)) + { + // Проверка дублирования + if(in_array($wiki['id'], $aResult)) + continue; - $sql->query('SELECT `id`, `name`, `tags`, `date` FROM `wiki` WHERE `id`="'.$wiki['id'].'" LIMIT 1'); - $quest = $sql->get(); + $sql->query('SELECT `id`, `name`, `tags`, `date` FROM `wiki` WHERE `id`="'.$wiki['id'].'" LIMIT 1'); + $quest = $sql->get(); - $aTags = explode(',', $quest['tags']); + $aTags = explode(',', $quest['tags']); - $tags = ''; + $tags = ''; - foreach($aTags as $tag) - { - $tag = trim($tag); + foreach($aTags as $tag) + { + $tag = trim($tag); - $tags .= ''.$tag.''; - } + $tags .= ''.$tag.''; + } - $html->get('list', 'sections/wiki/question'); + $html->get('list', 'sections/wiki/question'); - $html->set('id', $quest['id']); - $html->set('name', sys::find($quest['name'], $text)); - $html->set('tags', $tags != '' ? $tags : 'Теги отсутствуют'); - $html->set('date', sys::today($quest['date'])); + $html->set('id', $quest['id']); + $html->set('name', sys::find($quest['name'], $text)); + $html->set('tags', $tags != '' ? $tags : 'Теги отсутствуют'); + $html->set('date', sys::today($quest['date'])); - $html->set('home', $cfg['http']); + $html->set('home', $cfg['http']); - $html->pack('question'); + $html->pack('question'); - array_push($aResult, $wiki['id']); - } - } + array_push($aResult, $wiki['id']); + } + } - foreach($aNswer_q as $index => $answer_q) - { - // Генерация списка (совпадение по ответу) - while($answer = $sql->get($answer_q)) - { - // Проверка дублирования - if(in_array($answer['wiki'], $aResult)) - continue; + foreach($aNswer_q as $index => $answer_q) + { + // Генерация списка (совпадение по ответу) + while($answer = $sql->get($answer_q)) + { + // Проверка дублирования + if(in_array($answer['wiki'], $aResult)) + continue; - $sql->query('SELECT `id`, `name`, `tags`, `date` FROM `wiki` WHERE `id`="'.$answer['wiki'].'" LIMIT 1'); - $quest = $sql->get(); + $sql->query('SELECT `id`, `name`, `tags`, `date` FROM `wiki` WHERE `id`="'.$answer['wiki'].'" LIMIT 1'); + $quest = $sql->get(); - $aTags = explode(',', $quest['tags']); + $aTags = explode(',', $quest['tags']); - $tags = ''; + $tags = ''; - foreach($aTags as $tag) - { - $tag = trim($tag); + foreach($aTags as $tag) + { + $tag = trim($tag); - $tags .= ''.$tag.''; - } + $tags .= ''.$tag.''; + } - $html->get('list', 'sections/wiki/question'); + $html->get('list', 'sections/wiki/question'); - $html->set('id', $quest['id']); - $html->set('name', sys::find($quest['name'], $text)); - $html->set('tags', $tags != '' ? $tags : 'Теги отсутствуют'); - $html->set('date', sys::today($quest['date'])); + $html->set('id', $quest['id']); + $html->set('name', sys::find($quest['name'], $text)); + $html->set('tags', $tags != '' ? $tags : 'Теги отсутствуют'); + $html->set('date', sys::today($quest['date'])); - $html->set('home', $cfg['http']); + $html->set('home', $cfg['http']); - $html->pack('question'); - } - } + $html->pack('question'); + } + } - $html->arr['question'] = isset($html->arr['question']) ? $html->arr['question'] : 'По вашему запросу ничего не найдено'; + $html->arr['question'] = isset($html->arr['question']) ? $html->arr['question'] : 'По вашему запросу ничего не найдено'; - $mcache->set($mkey, $html->arr['question'], false, 15); + $mcache->set($mkey, $html->arr['question'], false, 15); - sys::outjs(array('s' => $html->arr['question']), $nmch); + sys::outjs(array('s' => $html->arr['question']), $nmch); ?> \ No newline at end of file diff --git a/template/acp/all.html b/template/acp/all.html index ce763b9..8fece54 100644 --- a/template/acp/all.html +++ b/template/acp/all.html @@ -1,145 +1,145 @@ - - Панель администатора - - - - - - + + Панель администатора + + + + + + - - - - - + + + + + - - + setTimeout(function($){_item.removeClass("jmp"); _item.css({"left": '110%'})}, 150*i); + setTimeout(function($){_item.addClass("jmp"); _item.css({"left": '90%'})}, 1000 + 150*i); + }) + }, 1500); + }); + + - -
    - - |section| - - |_section| -
    - + +
    + + |section| + + |_section| + -
    + +
    +
    -
    - - |section||_section| + |section||_section| -
    -
    - [main] -
    -
    -
    +
    +
    + [main] +
    +
    + -
    +
    -
    -
    - - - - - - -
    -
    - +
    +
    + + + + + + +
    +
    + \ No newline at end of file diff --git a/template/acp/cashback.html b/template/acp/cashback.html index a62d9f8..732c8eb 100644 --- a/template/acp/cashback.html +++ b/template/acp/cashback.html @@ -1,9 +1,9 @@ - #[id] - USER_[user] - [mail] - [purse] - [money] (Выводить: [cashback]) - [type] - Вывести + #[id] + USER_[user] + [mail] + [purse] + [money] (Выводить: [cashback]) + [type] + Вывести \ No newline at end of file diff --git a/template/acp/css/bootbox.css b/template/acp/css/bootbox.css index 2e7cbcd..cd0b6f9 100644 --- a/template/acp/css/bootbox.css +++ b/template/acp/css/bootbox.css @@ -1,26 +1,26 @@ .fade { - opacity:0; - -webkit-transition:opacity .15s linear; - -moz-transition:opacity .15s linear; - -o-transition:opacity .15s linear; - transition:opacity .15s linear + opacity:0; + -webkit-transition:opacity .15s linear; + -moz-transition:opacity .15s linear; + -o-transition:opacity .15s linear; + transition:opacity .15s linear } .fade.in{ - opacity:1 + opacity:1 } .modal-backdrop { - position:fixed; - top:0; - right:0; - bottom:0; - left:0; - z-index:1040; - background-color:#000 + position:fixed; + top:0; + right:0; + bottom:0; + left:0; + z-index:1040; + background-color:#000 } .modal-backdrop.fade{ - opacity:0 + opacity:0 } .modal-backdrop,.modal-backdrop.fade.in { @@ -30,94 +30,94 @@ } .modal { - position:fixed; - top:40%; - left:45%; - z-index:1050; - width:560px; - margin-left:-280px; - background-color:#fff; - border:1px solid #EEE; - *border:1px solid #EEE; - outline:0; - -webkit-background-clip:padding-box; - -moz-background-clip:padding-box; - background-clip:padding-box + position:fixed; + top:40%; + left:45%; + z-index:1050; + width:560px; + margin-left:-280px; + background-color:#fff; + border:1px solid #EEE; + *border:1px solid #EEE; + outline:0; + -webkit-background-clip:padding-box; + -moz-background-clip:padding-box; + background-clip:padding-box } .modal.fade { - top:-25%; - -webkit-transition:opacity .3s linear,top .3s ease-out; - -moz-transition:opacity .3s linear,top .3s ease-out; - -o-transition:opacity .3s linear,top .3s ease-out; - transition:opacity .3s linear,top .3s ease-out + top:-25%; + -webkit-transition:opacity .3s linear,top .3s ease-out; + -moz-transition:opacity .3s linear,top .3s ease-out; + -o-transition:opacity .3s linear,top .3s ease-out; + transition:opacity .3s linear,top .3s ease-out } .modal.fade.in { - top:40%; - left: 50%; + top:40%; + left: 50%; } .modal-header { - padding:9px 15px; - border-bottom:1px solid #eee + padding:9px 15px; + border-bottom:1px solid #eee } .modal-header .close { - margin-top:2px + margin-top:2px } .modal-header h3 { - margin:0; - line-height:30px + margin:0; + line-height:30px } .modal-body { - position:relative; - max-height:400px; - padding:15px; - overflow-y:auto + position:relative; + max-height:400px; + padding:15px; + overflow-y:auto } .modal-form { - margin-bottom:0 + margin-bottom:0 } .modal-footer { - padding:14px 15px 15px; - margin-bottom:0; - text-align:right; - background-color:#f5f5f5; - border-top:1px solid #ddd; - -webkit-border-radius:0 0 6px 6px; - -moz-border-radius:0 0 6px 6px; - border-radius:0 0 6px 6px; - *zoom:1; - -webkit-box-shadow:inset 0 1px 0 #fff; - -moz-box-shadow:inset 0 1px 0 #fff; - box-shadow:inset 0 1px 0 #fff + padding:14px 15px 15px; + margin-bottom:0; + text-align:right; + background-color:#f5f5f5; + border-top:1px solid #ddd; + -webkit-border-radius:0 0 6px 6px; + -moz-border-radius:0 0 6px 6px; + border-radius:0 0 6px 6px; + *zoom:1; + -webkit-box-shadow:inset 0 1px 0 #fff; + -moz-box-shadow:inset 0 1px 0 #fff; + box-shadow:inset 0 1px 0 #fff } .modal-footer:before,.modal-footer:after { - display:table; - line-height:0; - content:"" + display:table; + line-height:0; + content:"" } .modal-footer:after { - clear:both + clear:both } .modal-footer .btn+.btn { - margin-bottom:0; - margin-left:5px + margin-bottom:0; + margin-left:5px } .modal-footer .btn-group .btn+.btn { - margin-left:-1px + margin-left:-1px } .modal-footer .btn-block+.btn-block { - margin-left:0 + margin-left:0 } diff --git a/template/acp/css/jquery.datetimepicker.css b/template/acp/css/jquery.datetimepicker.css index 4ed981a..4dd8d26 100644 --- a/template/acp/css/jquery.datetimepicker.css +++ b/template/acp/css/jquery.datetimepicker.css @@ -1,509 +1,509 @@ .xdsoft_datetimepicker { - box-shadow: 0 5px 15px -5px rgba(0, 0, 0, 0.506); - background: #fff; - border-bottom: 1px solid #bbb; - border-left: 1px solid #ccc; - border-right: 1px solid #ccc; - border-top: 1px solid #ccc; - color: #333; - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; - padding: 8px; - padding-left: 0; - padding-top: 2px; - position: absolute; - z-index: 9999; - -moz-box-sizing: border-box; - box-sizing: border-box; - display: none; + box-shadow: 0 5px 15px -5px rgba(0, 0, 0, 0.506); + background: #fff; + border-bottom: 1px solid #bbb; + border-left: 1px solid #ccc; + border-right: 1px solid #ccc; + border-top: 1px solid #ccc; + color: #333; + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + padding: 8px; + padding-left: 0; + padding-top: 2px; + position: absolute; + z-index: 9999; + -moz-box-sizing: border-box; + box-sizing: border-box; + display: none; } .xdsoft_datetimepicker.xdsoft_rtl { - padding: 8px 0 8px 8px; + padding: 8px 0 8px 8px; } .xdsoft_datetimepicker iframe { - position: absolute; - left: 0; - top: 0; - width: 75px; - height: 210px; - background: transparent; - border: none; + position: absolute; + left: 0; + top: 0; + width: 75px; + height: 210px; + background: transparent; + border: none; } /*For IE8 or lower*/ .xdsoft_datetimepicker button { - border: none !important; + border: none !important; } .xdsoft_noselect { - -webkit-touch-callout: none; - -webkit-user-select: none; - -khtml-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - -o-user-select: none; - user-select: none; + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + -o-user-select: none; + user-select: none; } .xdsoft_noselect::selection { background: transparent } .xdsoft_noselect::-moz-selection { background: transparent } .xdsoft_datetimepicker.xdsoft_inline { - display: inline-block; - position: static; - box-shadow: none; + display: inline-block; + position: static; + box-shadow: none; } .xdsoft_datetimepicker * { - -moz-box-sizing: border-box; - box-sizing: border-box; - padding: 0; - margin: 0; + -moz-box-sizing: border-box; + box-sizing: border-box; + padding: 0; + margin: 0; } .xdsoft_datetimepicker .xdsoft_datepicker, .xdsoft_datetimepicker .xdsoft_timepicker { - display: none; + display: none; } .xdsoft_datetimepicker .xdsoft_datepicker.active, .xdsoft_datetimepicker .xdsoft_timepicker.active { - display: block; + display: block; } .xdsoft_datetimepicker .xdsoft_datepicker { - width: 224px; - float: left; - margin-left: 8px; + width: 224px; + float: left; + margin-left: 8px; } .xdsoft_datetimepicker.xdsoft_rtl .xdsoft_datepicker { - float: right; - margin-right: 8px; - margin-left: 0; + float: right; + margin-right: 8px; + margin-left: 0; } .xdsoft_datetimepicker.xdsoft_showweeks .xdsoft_datepicker { - width: 256px; + width: 256px; } .xdsoft_datetimepicker .xdsoft_timepicker { - width: 58px; - float: left; - text-align: center; - margin-left: 8px; - margin-top: 0; + width: 58px; + float: left; + text-align: center; + margin-left: 8px; + margin-top: 0; } .xdsoft_datetimepicker.xdsoft_rtl .xdsoft_timepicker { - float: right; - margin-right: 8px; - margin-left: 0; + float: right; + margin-right: 8px; + margin-left: 0; } .xdsoft_datetimepicker .xdsoft_datepicker.active+.xdsoft_timepicker { - margin-top: 8px; - margin-bottom: 3px + margin-top: 8px; + margin-bottom: 3px } .xdsoft_datetimepicker .xdsoft_monthpicker { - position: relative; - text-align: center; + position: relative; + text-align: center; } .xdsoft_datetimepicker .xdsoft_label i, .xdsoft_datetimepicker .xdsoft_prev, .xdsoft_datetimepicker .xdsoft_next, .xdsoft_datetimepicker .xdsoft_today_button { - background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAAeCAYAAADaW7vzAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6Q0NBRjI1NjM0M0UwMTFFNDk4NkFGMzJFQkQzQjEwRUIiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6Q0NBRjI1NjQ0M0UwMTFFNDk4NkFGMzJFQkQzQjEwRUIiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpDQ0FGMjU2MTQzRTAxMUU0OTg2QUYzMkVCRDNCMTBFQiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpDQ0FGMjU2MjQzRTAxMUU0OTg2QUYzMkVCRDNCMTBFQiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PoNEP54AAAIOSURBVHja7Jq9TsMwEMcxrZD4WpBYeKUCe+kTMCACHZh4BFfHO/AAIHZGFhYkBBsSEqxsLCAgXKhbXYOTxh9pfJVP+qutnZ5s/5Lz2Y5I03QhWji2GIcgAokWgfCxNvcOCCGKqiSqhUp0laHOne05vdEyGMfkdxJDVjgwDlEQgYQBgx+ULJaWSXXS6r/ER5FBVR8VfGftTKcITNs+a1XpcFoExREIDF14AVIFxgQUS+h520cdud6wNkC0UBw6BCO/HoCYwBhD8QCkQ/x1mwDyD4plh4D6DDV0TAGyo4HcawLIBBSLDkHeH0Mg2yVP3l4TQMZQDDsEOl/MgHQqhMNuE0D+oBh0CIr8MAKyazBH9WyBuKxDWgbXfjNf32TZ1KWm/Ap1oSk/R53UtQ5xTh3LUlMmT8gt6g51Q9p+SobxgJQ/qmsfZhWywGFSl0yBjCLJCMgXail3b7+rumdVJ2YRss4cN+r6qAHDkPWjPjdJCF4n9RmAD/V9A/Wp4NQassDjwlB6XBiCxcJQWmZZb8THFilfy/lfrTvLghq2TqTHrRMTKNJ0sIhdo15RT+RpyWwFdY96UZ/LdQKBGjcXpcc1AlSFEfLmouD+1knuxBDUVrvOBmoOC/rEcN7OQxKVeJTCiAdUzUJhA2Oez9QTkp72OTVcxDcXY8iKNkxGAJXmJCOQwOa6dhyXsOa6XwEGAKdeb5ET3rQdAAAAAElFTkSuQmCC); + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAAeCAYAAADaW7vzAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6Q0NBRjI1NjM0M0UwMTFFNDk4NkFGMzJFQkQzQjEwRUIiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6Q0NBRjI1NjQ0M0UwMTFFNDk4NkFGMzJFQkQzQjEwRUIiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpDQ0FGMjU2MTQzRTAxMUU0OTg2QUYzMkVCRDNCMTBFQiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpDQ0FGMjU2MjQzRTAxMUU0OTg2QUYzMkVCRDNCMTBFQiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PoNEP54AAAIOSURBVHja7Jq9TsMwEMcxrZD4WpBYeKUCe+kTMCACHZh4BFfHO/AAIHZGFhYkBBsSEqxsLCAgXKhbXYOTxh9pfJVP+qutnZ5s/5Lz2Y5I03QhWji2GIcgAokWgfCxNvcOCCGKqiSqhUp0laHOne05vdEyGMfkdxJDVjgwDlEQgYQBgx+ULJaWSXXS6r/ER5FBVR8VfGftTKcITNs+a1XpcFoExREIDF14AVIFxgQUS+h520cdud6wNkC0UBw6BCO/HoCYwBhD8QCkQ/x1mwDyD4plh4D6DDV0TAGyo4HcawLIBBSLDkHeH0Mg2yVP3l4TQMZQDDsEOl/MgHQqhMNuE0D+oBh0CIr8MAKyazBH9WyBuKxDWgbXfjNf32TZ1KWm/Ap1oSk/R53UtQ5xTh3LUlMmT8gt6g51Q9p+SobxgJQ/qmsfZhWywGFSl0yBjCLJCMgXail3b7+rumdVJ2YRss4cN+r6qAHDkPWjPjdJCF4n9RmAD/V9A/Wp4NQassDjwlB6XBiCxcJQWmZZb8THFilfy/lfrTvLghq2TqTHrRMTKNJ0sIhdo15RT+RpyWwFdY96UZ/LdQKBGjcXpcc1AlSFEfLmouD+1knuxBDUVrvOBmoOC/rEcN7OQxKVeJTCiAdUzUJhA2Oez9QTkp72OTVcxDcXY8iKNkxGAJXmJCOQwOa6dhyXsOa6XwEGAKdeb5ET3rQdAAAAAElFTkSuQmCC); } .xdsoft_datetimepicker .xdsoft_label i { - opacity: 0.5; - background-position: -92px -19px; - display: inline-block; - width: 9px; - height: 20px; - vertical-align: middle; + opacity: 0.5; + background-position: -92px -19px; + display: inline-block; + width: 9px; + height: 20px; + vertical-align: middle; } .xdsoft_datetimepicker .xdsoft_prev { - float: left; - background-position: -20px 0; + float: left; + background-position: -20px 0; } .xdsoft_datetimepicker .xdsoft_today_button { - float: left; - background-position: -70px 0; - margin-left: 5px; + float: left; + background-position: -70px 0; + margin-left: 5px; } .xdsoft_datetimepicker .xdsoft_next { - float: right; - background-position: 0 0; + float: right; + background-position: 0 0; } .xdsoft_datetimepicker .xdsoft_next, .xdsoft_datetimepicker .xdsoft_prev , .xdsoft_datetimepicker .xdsoft_today_button { - background-color: transparent; - background-repeat: no-repeat; - border: 0 none; - cursor: pointer; - display: block; - height: 30px; - opacity: 0.5; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"; - outline: medium none; - overflow: hidden; - padding: 0; - position: relative; - text-indent: 100%; - white-space: nowrap; - width: 20px; - min-width: 0; + background-color: transparent; + background-repeat: no-repeat; + border: 0 none; + cursor: pointer; + display: block; + height: 30px; + opacity: 0.5; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"; + outline: medium none; + overflow: hidden; + padding: 0; + position: relative; + text-indent: 100%; + white-space: nowrap; + width: 20px; + min-width: 0; } .xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_prev, .xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_next { - float: none; - background-position: -40px -15px; - height: 15px; - width: 30px; - display: block; - margin-left: 14px; - margin-top: 7px; + float: none; + background-position: -40px -15px; + height: 15px; + width: 30px; + display: block; + margin-left: 14px; + margin-top: 7px; } .xdsoft_datetimepicker.xdsoft_rtl .xdsoft_timepicker .xdsoft_prev, .xdsoft_datetimepicker.xdsoft_rtl .xdsoft_timepicker .xdsoft_next { - float: none; - margin-left: 0; - margin-right: 14px; + float: none; + margin-left: 0; + margin-right: 14px; } .xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_prev { - background-position: -40px 0; - margin-bottom: 7px; - margin-top: 0; + background-position: -40px 0; + margin-bottom: 7px; + margin-top: 0; } .xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box { - height: 151px; - overflow: hidden; - border-bottom: 1px solid #ddd; + height: 151px; + overflow: hidden; + border-bottom: 1px solid #ddd; } .xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div >div { - background: #f5f5f5; - border-top: 1px solid #ddd; - color: #666; - font-size: 12px; - text-align: center; - border-collapse: collapse; - cursor: pointer; - border-bottom-width: 0; - height: 25px; - line-height: 25px; + background: #f5f5f5; + border-top: 1px solid #ddd; + color: #666; + font-size: 12px; + text-align: center; + border-collapse: collapse; + cursor: pointer; + border-bottom-width: 0; + height: 25px; + line-height: 25px; } .xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div > div:first-child { - border-top-width: 0; + border-top-width: 0; } .xdsoft_datetimepicker .xdsoft_today_button:hover, .xdsoft_datetimepicker .xdsoft_next:hover, .xdsoft_datetimepicker .xdsoft_prev:hover { - opacity: 1; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + opacity: 1; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; } .xdsoft_datetimepicker .xdsoft_label { - display: inline; - position: relative; - z-index: 9999; - margin: 0; - padding: 5px 3px; - font-size: 14px; - line-height: 20px; - font-weight: bold; - background-color: #fff; - float: left; - width: 182px; - text-align: center; - cursor: pointer; + display: inline; + position: relative; + z-index: 9999; + margin: 0; + padding: 5px 3px; + font-size: 14px; + line-height: 20px; + font-weight: bold; + background-color: #fff; + float: left; + width: 182px; + text-align: center; + cursor: pointer; } .xdsoft_datetimepicker .xdsoft_label:hover>span { - text-decoration: underline; + text-decoration: underline; } .xdsoft_datetimepicker .xdsoft_label:hover i { - opacity: 1.0; + opacity: 1.0; } .xdsoft_datetimepicker .xdsoft_label > .xdsoft_select { - border: 1px solid #ccc; - position: absolute; - right: 0; - top: 30px; - z-index: 101; - display: none; - background: #fff; - max-height: 160px; - overflow-y: hidden; + border: 1px solid #ccc; + position: absolute; + right: 0; + top: 30px; + z-index: 101; + display: none; + background: #fff; + max-height: 160px; + overflow-y: hidden; } .xdsoft_datetimepicker .xdsoft_label > .xdsoft_select.xdsoft_monthselect{ right: -7px } .xdsoft_datetimepicker .xdsoft_label > .xdsoft_select.xdsoft_yearselect{ right: 2px } .xdsoft_datetimepicker .xdsoft_label > .xdsoft_select > div > .xdsoft_option:hover { - color: #fff; - background: #ff8000; + color: #fff; + background: #ff8000; } .xdsoft_datetimepicker .xdsoft_label > .xdsoft_select > div > .xdsoft_option { - padding: 2px 10px 2px 5px; - text-decoration: none !important; + padding: 2px 10px 2px 5px; + text-decoration: none !important; } .xdsoft_datetimepicker .xdsoft_label > .xdsoft_select > div > .xdsoft_option.xdsoft_current { - background: #33aaff; - box-shadow: #178fe5 0 1px 3px 0 inset; - color: #fff; - font-weight: 700; + background: #33aaff; + box-shadow: #178fe5 0 1px 3px 0 inset; + color: #fff; + font-weight: 700; } .xdsoft_datetimepicker .xdsoft_month { - width: 100px; - text-align: right; + width: 100px; + text-align: right; } .xdsoft_datetimepicker .xdsoft_calendar { - clear: both; + clear: both; } .xdsoft_datetimepicker .xdsoft_year{ - width: 48px; - margin-left: 5px; + width: 48px; + margin-left: 5px; } .xdsoft_datetimepicker .xdsoft_calendar table { - border-collapse: collapse; - width: 100%; + border-collapse: collapse; + width: 100%; } .xdsoft_datetimepicker .xdsoft_calendar td > div { - padding-right: 5px; + padding-right: 5px; } .xdsoft_datetimepicker .xdsoft_calendar th { - height: 25px; + height: 25px; } .xdsoft_datetimepicker .xdsoft_calendar td,.xdsoft_datetimepicker .xdsoft_calendar th { - width: 14.2857142%; - background: #f5f5f5; - border: 1px solid #ddd; - color: #666; - font-size: 12px; - text-align: right; - vertical-align: middle; - padding: 0; - border-collapse: collapse; - cursor: pointer; - height: 25px; + width: 14.2857142%; + background: #f5f5f5; + border: 1px solid #ddd; + color: #666; + font-size: 12px; + text-align: right; + vertical-align: middle; + padding: 0; + border-collapse: collapse; + cursor: pointer; + height: 25px; } .xdsoft_datetimepicker.xdsoft_showweeks .xdsoft_calendar td,.xdsoft_datetimepicker.xdsoft_showweeks .xdsoft_calendar th { - width: 12.5%; + width: 12.5%; } .xdsoft_datetimepicker .xdsoft_calendar th { - background: #f1f1f1; + background: #f1f1f1; } .xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_today { - color: #33aaff; + color: #33aaff; } .xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_highlighted_default { - background: #ffe9d2; - box-shadow: #ffb871 0 1px 4px 0 inset; - color: #000; + background: #ffe9d2; + box-shadow: #ffb871 0 1px 4px 0 inset; + color: #000; } .xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_highlighted_mint { - background: #c1ffc9; - box-shadow: #00dd1c 0 1px 4px 0 inset; - color: #000; + background: #c1ffc9; + box-shadow: #00dd1c 0 1px 4px 0 inset; + color: #000; } .xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_default, .xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_current, .xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div >div.xdsoft_current { - background: #33aaff; - box-shadow: #178fe5 0 1px 3px 0 inset; - color: #fff; - font-weight: 700; + background: #33aaff; + box-shadow: #178fe5 0 1px 3px 0 inset; + color: #fff; + font-weight: 700; } .xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_other_month, .xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_disabled, .xdsoft_datetimepicker .xdsoft_time_box >div >div.xdsoft_disabled { - opacity: 0.5; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"; - cursor: default; + opacity: 0.5; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"; + cursor: default; } .xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_other_month.xdsoft_disabled { - opacity: 0.2; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=20)"; + opacity: 0.2; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=20)"; } .xdsoft_datetimepicker .xdsoft_calendar td:hover, .xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div >div:hover { - color: #fff !important; - background: #ff8000 !important; - box-shadow: none !important; + color: #fff !important; + background: #ff8000 !important; + box-shadow: none !important; } .xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_current.xdsoft_disabled:hover, .xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box>div>div.xdsoft_current.xdsoft_disabled:hover { - background: #33aaff !important; - box-shadow: #178fe5 0 1px 3px 0 inset !important; - color: #fff !important; + background: #33aaff !important; + box-shadow: #178fe5 0 1px 3px 0 inset !important; + color: #fff !important; } .xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_disabled:hover, .xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div >div.xdsoft_disabled:hover { - color: inherit !important; - background: inherit !important; - box-shadow: inherit !important; + color: inherit !important; + background: inherit !important; + box-shadow: inherit !important; } .xdsoft_datetimepicker .xdsoft_calendar th { - font-weight: 700; - text-align: center; - color: #999; - cursor: default; + font-weight: 700; + text-align: center; + color: #999; + cursor: default; } .xdsoft_datetimepicker .xdsoft_copyright { - color: #ccc !important; - font-size: 10px; - clear: both; - float: none; - margin-left: 8px; + color: #ccc !important; + font-size: 10px; + clear: both; + float: none; + margin-left: 8px; } .xdsoft_datetimepicker .xdsoft_copyright a { color: #eee !important } .xdsoft_datetimepicker .xdsoft_copyright a:hover { color: #aaa !important } .xdsoft_time_box { - position: relative; - border: 1px solid #ccc; + position: relative; + border: 1px solid #ccc; } .xdsoft_scrollbar >.xdsoft_scroller { - background: #ccc !important; - height: 20px; - border-radius: 3px; + background: #ccc !important; + height: 20px; + border-radius: 3px; } .xdsoft_scrollbar { - position: absolute; - width: 7px; - right: 0; - top: 0; - bottom: 0; - cursor: pointer; + position: absolute; + width: 7px; + right: 0; + top: 0; + bottom: 0; + cursor: pointer; } .xdsoft_datetimepicker.xdsoft_rtl .xdsoft_scrollbar { - left: 0; - right: auto; + left: 0; + right: auto; } .xdsoft_scroller_box { - position: relative; + position: relative; } .xdsoft_datetimepicker.xdsoft_dark { - box-shadow: 0 5px 15px -5px rgba(255, 255, 255, 0.506); - background: #000; - border-bottom: 1px solid #444; - border-left: 1px solid #333; - border-right: 1px solid #333; - border-top: 1px solid #333; - color: #ccc; + box-shadow: 0 5px 15px -5px rgba(255, 255, 255, 0.506); + background: #000; + border-bottom: 1px solid #444; + border-left: 1px solid #333; + border-right: 1px solid #333; + border-top: 1px solid #333; + color: #ccc; } .xdsoft_datetimepicker.xdsoft_dark .xdsoft_timepicker .xdsoft_time_box { - border-bottom: 1px solid #222; + border-bottom: 1px solid #222; } .xdsoft_datetimepicker.xdsoft_dark .xdsoft_timepicker .xdsoft_time_box >div >div { - background: #0a0a0a; - border-top: 1px solid #222; - color: #999; + background: #0a0a0a; + border-top: 1px solid #222; + color: #999; } .xdsoft_datetimepicker.xdsoft_dark .xdsoft_label { - background-color: #000; + background-color: #000; } .xdsoft_datetimepicker.xdsoft_dark .xdsoft_label > .xdsoft_select { - border: 1px solid #333; - background: #000; + border: 1px solid #333; + background: #000; } .xdsoft_datetimepicker.xdsoft_dark .xdsoft_label > .xdsoft_select > div > .xdsoft_option:hover { - color: #000; - background: #007fff; + color: #000; + background: #007fff; } .xdsoft_datetimepicker.xdsoft_dark .xdsoft_label > .xdsoft_select > div > .xdsoft_option.xdsoft_current { - background: #cc5500; - box-shadow: #b03e00 0 1px 3px 0 inset; - color: #000; + background: #cc5500; + box-shadow: #b03e00 0 1px 3px 0 inset; + color: #000; } .xdsoft_datetimepicker.xdsoft_dark .xdsoft_label i, .xdsoft_datetimepicker.xdsoft_dark .xdsoft_prev, .xdsoft_datetimepicker.xdsoft_dark .xdsoft_next, .xdsoft_datetimepicker.xdsoft_dark .xdsoft_today_button { - background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAAeCAYAAADaW7vzAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6QUExQUUzOTA0M0UyMTFFNDlBM0FFQTJENTExRDVBODYiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6QUExQUUzOTE0M0UyMTFFNDlBM0FFQTJENTExRDVBODYiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpBQTFBRTM4RTQzRTIxMUU0OUEzQUVBMkQ1MTFENUE4NiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpBQTFBRTM4RjQzRTIxMUU0OUEzQUVBMkQ1MTFENUE4NiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pp0VxGEAAAIASURBVHja7JrNSgMxEMebtgh+3MSLr1T1Xn2CHoSKB08+QmR8Bx9A8e7RixdB9CKCoNdexIugxFlJa7rNZneTbLIpM/CnNLsdMvNjM8l0mRCiQ9Ye61IKCAgZAUnH+mU3MMZaHYChBnJUDzWOFZdVfc5+ZFLbrWDeXPwbxIqrLLfaeS0hEBVGIRQCEiZoHQwtlGSByCCdYBl8g8egTTAWoKQMRBRBcZxYlhzhKegqMOageErsCHVkk3hXIFooDgHB1KkHIHVgzKB4ADJQ/A1jAFmAYhkQqA5TOBtocrKrgXwQA8gcFIuAIO8sQSA7hidvPwaQGZSaAYHOUWJABhWWw2EMIH9QagQERU4SArJXo0ZZL18uvaxejXt/Em8xjVBXmvFr1KVm/AJ10tRe2XnraNqaJvKE3KHuUbfK1E+VHB0q40/y3sdQSxY4FHWeKJCunP8UyDdqJZenT3ntVV5jIYCAh20vT7ioP8tpf6E2lfEMwERe+whV1MHjwZB7PBiCxcGQWwKZKD62lfGNnP/1poFAA60T7rF1UgcKd2id3KDeUS+oLWV8DfWAepOfq00CgQabi9zjcgJVYVD7PVzQUAUGAQkbNJTBICDhgwYTjDYD6XeW08ZKh+A4pYkzenOxXUbvZcWz7E8ykRMnIHGX1XPl+1m2vPYpL+2qdb8CDAARlKFEz/ZVkAAAAABJRU5ErkJggg==); + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAAeCAYAAADaW7vzAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6QUExQUUzOTA0M0UyMTFFNDlBM0FFQTJENTExRDVBODYiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6QUExQUUzOTE0M0UyMTFFNDlBM0FFQTJENTExRDVBODYiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpBQTFBRTM4RTQzRTIxMUU0OUEzQUVBMkQ1MTFENUE4NiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpBQTFBRTM4RjQzRTIxMUU0OUEzQUVBMkQ1MTFENUE4NiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pp0VxGEAAAIASURBVHja7JrNSgMxEMebtgh+3MSLr1T1Xn2CHoSKB08+QmR8Bx9A8e7RixdB9CKCoNdexIugxFlJa7rNZneTbLIpM/CnNLsdMvNjM8l0mRCiQ9Ye61IKCAgZAUnH+mU3MMZaHYChBnJUDzWOFZdVfc5+ZFLbrWDeXPwbxIqrLLfaeS0hEBVGIRQCEiZoHQwtlGSByCCdYBl8g8egTTAWoKQMRBRBcZxYlhzhKegqMOageErsCHVkk3hXIFooDgHB1KkHIHVgzKB4ADJQ/A1jAFmAYhkQqA5TOBtocrKrgXwQA8gcFIuAIO8sQSA7hidvPwaQGZSaAYHOUWJABhWWw2EMIH9QagQERU4SArJXo0ZZL18uvaxejXt/Em8xjVBXmvFr1KVm/AJ10tRe2XnraNqaJvKE3KHuUbfK1E+VHB0q40/y3sdQSxY4FHWeKJCunP8UyDdqJZenT3ntVV5jIYCAh20vT7ioP8tpf6E2lfEMwERe+whV1MHjwZB7PBiCxcGQWwKZKD62lfGNnP/1poFAA60T7rF1UgcKd2id3KDeUS+oLWV8DfWAepOfq00CgQabi9zjcgJVYVD7PVzQUAUGAQkbNJTBICDhgwYTjDYD6XeW08ZKh+A4pYkzenOxXUbvZcWz7E8ykRMnIHGX1XPl+1m2vPYpL+2qdb8CDAARlKFEz/ZVkAAAAABJRU5ErkJggg==); } .xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td, .xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar th { - background: #0a0a0a; - border: 1px solid #222; - color: #999; + background: #0a0a0a; + border: 1px solid #222; + color: #999; } .xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar th { - background: #0e0e0e; + background: #0e0e0e; } .xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td.xdsoft_today { - color: #cc5500; + color: #cc5500; } .xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td.xdsoft_highlighted_default { - background: #ffe9d2; - box-shadow: #ffb871 0 1px 4px 0 inset; - color:#000; + background: #ffe9d2; + box-shadow: #ffb871 0 1px 4px 0 inset; + color:#000; } .xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td.xdsoft_highlighted_mint { - background: #c1ffc9; - box-shadow: #00dd1c 0 1px 4px 0 inset; - color:#000; + background: #c1ffc9; + box-shadow: #00dd1c 0 1px 4px 0 inset; + color:#000; } .xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td.xdsoft_default, .xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td.xdsoft_current, .xdsoft_datetimepicker.xdsoft_dark .xdsoft_timepicker .xdsoft_time_box >div >div.xdsoft_current { - background: #cc5500; - box-shadow: #b03e00 0 1px 3px 0 inset; - color: #000; + background: #cc5500; + box-shadow: #b03e00 0 1px 3px 0 inset; + color: #000; } .xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td:hover, .xdsoft_datetimepicker.xdsoft_dark .xdsoft_timepicker .xdsoft_time_box >div >div:hover { - color: #000 !important; - background: #007fff !important; + color: #000 !important; + background: #007fff !important; } .xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar th { - color: #666; + color: #666; } .xdsoft_datetimepicker.xdsoft_dark .xdsoft_copyright { color: #333 !important } @@ -511,11 +511,11 @@ .xdsoft_datetimepicker.xdsoft_dark .xdsoft_copyright a:hover { color: #555 !important } .xdsoft_dark .xdsoft_time_box { - border: 1px solid #333; + border: 1px solid #333; } .xdsoft_dark .xdsoft_scrollbar >.xdsoft_scroller { - background: #333 !important; + background: #333 !important; } .xdsoft_datetimepicker .xdsoft_save_selected { display: block; @@ -526,27 +526,27 @@ font-size: 13px; } .xdsoft_datetimepicker .blue-gradient-button { - font-family: "museo-sans", "Book Antiqua", sans-serif; - font-size: 12px; - font-weight: 300; - color: #82878c; - height: 28px; - position: relative; - padding: 4px 17px 4px 33px; - border: 1px solid #d7d8da; - background: -moz-linear-gradient(top, #fff 0%, #f4f8fa 73%); - /* FF3.6+ */ - background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #fff), color-stop(73%, #f4f8fa)); - /* Chrome,Safari4+ */ - background: -webkit-linear-gradient(top, #fff 0%, #f4f8fa 73%); - /* Chrome10+,Safari5.1+ */ - background: -o-linear-gradient(top, #fff 0%, #f4f8fa 73%); - /* Opera 11.10+ */ - background: -ms-linear-gradient(top, #fff 0%, #f4f8fa 73%); - /* IE10+ */ - background: linear-gradient(to bottom, #fff 0%, #f4f8fa 73%); - /* W3C */ - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fff', endColorstr='#f4f8fa',GradientType=0 ); + font-family: "museo-sans", "Book Antiqua", sans-serif; + font-size: 12px; + font-weight: 300; + color: #82878c; + height: 28px; + position: relative; + padding: 4px 17px 4px 33px; + border: 1px solid #d7d8da; + background: -moz-linear-gradient(top, #fff 0%, #f4f8fa 73%); + /* FF3.6+ */ + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #fff), color-stop(73%, #f4f8fa)); + /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, #fff 0%, #f4f8fa 73%); + /* Chrome10+,Safari5.1+ */ + background: -o-linear-gradient(top, #fff 0%, #f4f8fa 73%); + /* Opera 11.10+ */ + background: -ms-linear-gradient(top, #fff 0%, #f4f8fa 73%); + /* IE10+ */ + background: linear-gradient(to bottom, #fff 0%, #f4f8fa 73%); + /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fff', endColorstr='#f4f8fa',GradientType=0 ); /* IE6-9 */ } .xdsoft_datetimepicker .blue-gradient-button:hover, .xdsoft_datetimepicker .blue-gradient-button:focus, .xdsoft_datetimepicker .blue-gradient-button:hover span, .xdsoft_datetimepicker .blue-gradient-button:focus span { diff --git a/template/acp/css/style.css b/template/acp/css/style.css index 9319cc2..a7914a3 100644 --- a/template/acp/css/style.css +++ b/template/acp/css/style.css @@ -24,7 +24,7 @@ } * { - padding: 0; + padding: 0; margin: 0; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; @@ -34,46 +34,46 @@ } html { - background-color: #252b30; + background-color: #252b30; } body, header, main, footer { - width: 1200px; + width: 1200px; } main { - display: flex + display: flex } html, body, main, .content, .sidebar, .sidebar-second, .height-max { - height: 100%; - font: 13px Cuprum; + height: 100%; + font: 13px Cuprum; } body { - margin: 0 auto + margin: 0 auto } main, header { - margin: 0 auto; + margin: 0 auto; } main { - display: table-cell; + display: table-cell; background-color: #eef0f2; } header { - height: 43px; + height: 43px; } a { - text-decoration: underline; - color: #222; + text-decoration: underline; + color: #222; } a:hover { - text-decoration: none; + text-decoration: none; } input::-webkit-input-placeholder {color: #d1d1d1; text-overflow: ellipsis; text-indent: 0px; transition: text-indent 0.3s ease;} input::-moz-placeholder {color: #d1d1d1; text-overflow: ellipsis; text-indent: 0px; transition: text-indent 0.3s ease;} @@ -90,78 +90,78 @@ textarea:-ms-input-placeholder {color: #d1d1d1;} .sidebar, .sidebar-second, .content { - padding: 5px; - float: left; + padding: 5px; + float: left; } .sidebar, .sidebar-second { - width: 200px; + width: 200px; } .content { - width: 1000px; + width: 1000px; } .content-mini { - width: 800px; + width: 800px; } .main { - margin: 5px; + margin: 5px; } .bg-gray { - background-color: #2e3439; - color: #8e9ca8; + background-color: #2e3439; + color: #8e9ca8; } .bg-gray-mild { - background-color: #3f464c; + background-color: #3f464c; } .bg-white { - background-color: #ffffff; + background-color: #ffffff; } .bg-green { - background-color: #00c09e; + background-color: #00c09e; } .br-gray-top { - border-top: 1px solid #282e33; + border-top: 1px solid #282e33; } .br-gray-bot { - border-bottom: 1px solid #282e33; + border-bottom: 1px solid #282e33; } .hr-gray, .hr-white { - margin: 15px 0; - width: 100%; - height: 1px; + margin: 15px 0; + width: 100%; + height: 1px; } .hr-gray { - background-color: #282e33; + background-color: #282e33; } .hr-white { - background-color: #f3f4f7; + background-color: #f3f4f7; } .sidebar > h3 { - font-size: 15px; + font-size: 15px; text-align: center; line-height: 33px; } .sidebar > h5, .sidebar-second > h5 { - padding: 5px 10px; + padding: 5px 10px; font-size: 11px; } .sidebar > ul li, .sidebar-second > ul li { - list-style: none; + list-style: none; } .sidebar > ul li a { @@ -174,17 +174,17 @@ textarea:-ms-input-placeholder {color: #d1d1d1;} .sidebar > ul li a:hover { background-color: #293035; - color: #c1d6e3; + color: #c1d6e3; } .sidebar > ul li a:active, .sidebar .active { background-color: #252b30; - color: #c1d6e3; + color: #c1d6e3; } .sidebar > ul li a i { - font-size: 14px; - width: 22px; + font-size: 14px; + width: 22px; } .sidebar-second > h3 { @@ -196,8 +196,8 @@ textarea:-ms-input-placeholder {color: #d1d1d1;} } .sidebar-second > h3 i { - font-size: 14px; - float: left; + font-size: 14px; + float: left; margin-top: 8px; } .sidebar-second > ul li a @@ -211,21 +211,21 @@ textarea:-ms-input-placeholder {color: #d1d1d1;} .sidebar-second > ul li a:hover { background-color: #fafbfc; - color: #78858f; + color: #78858f; } .sidebar-second > ul li a:active, .sidebar-second .active { background-color: #f3f4f7; - color: #78858f; + color: #78858f; } .sidebar-second > ul li a i { - font-size: 14px; - width: 22px; + font-size: 14px; + width: 22px; } .sidebar-second > ul li a span { - float: right; + float: right; font-size: 10px; background-color: #EEE; padding: 2px 5px; @@ -233,14 +233,14 @@ textarea:-ms-input-placeholder {color: #d1d1d1;} } .sidebar-second > h5 { - font-size: 14px; + font-size: 14px; color: #7e8890; } header > .content a { color: #7b8893; background-color: #2e3439; - padding: 5px 7px; + padding: 5px 7px; font-size: 14px; text-decoration: none; border-radius: 2px; @@ -248,7 +248,7 @@ header > .content a } header > .content a:hover { - color: #abb7bf; + color: #abb7bf; background-color: #2b3135; } header .fl-right @@ -273,13 +273,13 @@ header .fl-left } .inputs textarea { - resize: vertical; + resize: vertical; width: 100%; } .inputs-max input[type="text"], .inputs-max select { - width: 100%; + width: 100%; } label @@ -290,7 +290,7 @@ label border-radius: 10px; border: 1px solid #EEE; background-color: #FAFAFA; - margin-right: 5px; + margin-right: 5px; } label input @@ -305,7 +305,7 @@ table width: 100%; background-color: #ffffff; box-shadow: 1px 1px 10px #e0e0e0; - border-collapse: collapse; + border-collapse: collapse; } table th @@ -320,16 +320,16 @@ table th span } table td { - color: #000; + color: #000; } table th, table td { - padding: 8px; + padding: 8px; } table tr:nth-child(even) td { - background-color: #f7f8f8; + background-color: #f7f8f8; } table a @@ -339,12 +339,12 @@ table a .trh tr:hover td { - background-color: #f9fae5; + background-color: #f9fae5; } .search { - width: 300px; + width: 300px; float: right; margin-bottom: 10px; } @@ -353,7 +353,7 @@ table a padding: 5px; width: 300px; font-size: 12px; - color: #000; + color: #000; background-color: #fff; border: 1px solid #dedede; outline: 0; @@ -374,94 +374,94 @@ table a height: 24px; margin: -25px 0 0 274px; overflow: hidden; - line-height: 24px; + line-height: 24px; text-overflow: ellipsis; - transition: all 0.23s ease-in-out; + transition: all 0.23s ease-in-out; -moz-transition: all 0.23s ease-in-out; -webkit-transition: all 0.23s ease-in-out; -o-transition: all 0.23s ease-in-out; } .search button:hover { - width: 70px; - margin-left: 229px; + width: 70px; + margin-left: 229px; } .w5p { - width: 5% !important; + width: 5% !important; } .w10p { - width: 10% !important; + width: 10% !important; } .w15p { - width: 15% !important; + width: 15% !important; } .w20p { - width: 20% !important; + width: 20% !important; } .w25p { - width: 25% !important; + width: 25% !important; } .w35p { - width: 35% !important; + width: 35% !important; } .w50p { - width: 50% !important; + width: 50% !important; } .left { - float: left; + float: left; } .right { - float: right; + float: right; } .text-left { - text-align: left; + text-align: left; } .text-center { - text-align: center; + text-align: center; } .text-right { - text-align: right; + text-align: right; } .text-red { - color: #bd2727; + color: #bd2727; } .text-green { - color: #27bd32; + color: #27bd32; } .vtop { - vertical-align: top; + vertical-align: top; } .space { - clear: both; - margin-top: 15px; + clear: both; + margin-top: 15px; } .informer { - margin-bottom: 10px; + margin-bottom: 10px; border-left: 5px solid #29a3f2; padding: 5px; font-size: 14px; @@ -472,12 +472,12 @@ table a .informer.green { - border-color: #28b727; + border-color: #28b727; } .informer.red { - border-color: #f22929; + border-color: #f22929; } .pages @@ -492,7 +492,7 @@ table a } .pages > i { - margin: 0 2px; + margin: 0 2px; } .pages a { @@ -508,13 +508,13 @@ table a } .pages a:hover, .pages a.active { - background-color: #252b30; - color: #c1d6e3; + background-color: #252b30; + color: #c1d6e3; } #search_error { - display: none; + display: none; width: 100%; background-color: #dadde0; padding: 10px; @@ -578,21 +578,21 @@ table a .p_info p { - padding: 5px; - border-bottom: 1px dotted #EEE; + padding: 5px; + border-bottom: 1px dotted #EEE; } .pointer { - cursor: pointer; + cursor: pointer; } .none { - display: none; + display: none; } .btn { - font-size: 12px; + font-size: 12px; padding: 5px; background-color: #2e3439; border: 1px solid #3f464c; @@ -603,42 +603,42 @@ table a .btn:hover { - color: #abb7bf; + color: #abb7bf; background-color: #2b3135; } .btn-green { - background-color: #41d192; + background-color: #41d192; border: 1px solid #55ac5e; - color: #ffffff; + color: #ffffff; } .btn-green:hover { - background-color: #37da92; - border: 1px solid #55ac5e; - color: #ffffff; + background-color: #37da92; + border: 1px solid #55ac5e; + color: #ffffff; } .btn-red { background-color: #d14141; border: 1px solid #ac5555; - color: #ffffff; + color: #ffffff; } .btn-red:hover { background-color: #da1010; - border: 1px solid #ac5555; - color: #ffffff; + border: 1px solid #ac5555; + color: #ffffff; } .double-color td { - background-color: #ffffff !important; + background-color: #ffffff !important; } .double-color tr:nth-child(2n) td { - border-bottom: 2px solid #3f464c; + border-bottom: 2px solid #3f464c; } \ No newline at end of file diff --git a/template/acp/js/addons.js b/template/acp/js/addons.js index 4a0921a..5261338 100644 --- a/template/acp/js/addons.js +++ b/template/acp/js/addons.js @@ -1,233 +1,233 @@ $('#addons').ajaxForm({ - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить" - }] - ); + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить" + }] + ); - if(i == 's') - location.reload(); - }); + if(i == 's') + location.reload(); + }); - loading(0) - } + loading(0) + } }); function maps_reset_game() { - $('#game').prop('selectedIndex', 0); + $('#game').prop('selectedIndex', 0); } function maps_list() { - $.get(home+'addons/section/updmp/get/list/unit/'+$('#unit').val()+'/game/'+$('#game').val(), - function(data) - { - $('#maps').val(data); - }); + $.get(home+'addons/section/updmp/get/list/unit/'+$('#unit').val()+'/game/'+$('#game').val(), + function(data) + { + $('#maps').val(data); + }); - return false; + return false; } function maps_update() { - loading(1); + loading(1); - $.get(home+'addons/section/updmp/unit/'+$('#unit').val()+'/game/'+$('#game').val()+'/go', - function(data) - { - location.reload(); - }); + $.get(home+'addons/section/updmp/unit/'+$('#unit').val()+'/game/'+$('#game').val()+'/go', + function(data) + { + location.reload(); + }); - return false; + return false; } function plugins_category() { - $.get(home+'addons/section/addpl/get/cat/game/'+$('#game').val(), - function(data) - { - $('#category').html(''+data); - }); + $.get(home+'addons/section/addpl/get/cat/game/'+$('#game').val(), + function(data) + { + $('#category').html(''+data); + }); - return false; + return false; } function plugins_update_del(id) { - bootbox.dialog('

    Внимание

    Вы уверены, что хотите удалить обновление плагина?', - [{ - "label" : "Удалить", - callback : function(){plugins_update_del_go(id)} - },{ - "label" : "Отмена", - }] - ); + bootbox.dialog('

    Внимание

    Вы уверены, что хотите удалить обновление плагина?', + [{ + "label" : "Удалить", + callback : function(){plugins_update_del_go(id)} + },{ + "label" : "Отмена", + }] + ); - return false; + return false; } function plugins_update_del_go(id) { - $.get(home+'addons/section/delete/type/update/id/'+id, - function(data) - { - location.reload(); - }); + $.get(home+'addons/section/delete/type/update/id/'+id, + function(data) + { + location.reload(); + }); } function cats_delete(id) { - $.get(home+'addons/section/delete/type/cat/id/'+id, - function(data) - { - location.reload(); - }); + $.get(home+'addons/section/delete/type/cat/id/'+id, + function(data) + { + location.reload(); + }); - return false; + return false; } function plugins_sort(sort) { - switch(sort) - { - case 'id': - if(sort_id == 'asc') - sort_id = 'desc'; - else - sort_id = 'asc'; + switch(sort) + { + case 'id': + if(sort_id == 'asc') + sort_id = 'desc'; + else + sort_id = 'asc'; - sorting = sort_id; + sorting = sort_id; - break; + break; - case 'cat': - sort_cat = sort_cat == 'asc' ? 'desc' : 'asc'; - sorting = sort_cat; + case 'cat': + sort_cat = sort_cat == 'asc' ? 'desc' : 'asc'; + sorting = sort_cat; - break; + break; - case 'game': - sort_game = sort_game == 'asc' ? 'desc' : 'asc'; - sorting = sort_game; + case 'game': + sort_game = sort_game == 'asc' ? 'desc' : 'asc'; + sorting = sort_game; - } + } - location.href=home+'addons/sort/'+sort+'/sorting/'+sorting; + location.href=home+'addons/sort/'+sort+'/sorting/'+sorting; } function plugins_search(go) { - if($('#search').val() == '') - { - $('#search_error').css('display', 'none'); + if($('#search').val() == '') + { + $('#search_error').css('display', 'none'); - return; - } + return; + } - loading(1); + loading(1); - if(go) go = '/go'; else go = ''; + if(go) go = '/go'; else go = ''; - $.ajax({ - type: 'POST', - url: home+'addons/subsection/search'+go, - data: 'text='+$('#search').val(), - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - { - if(val != '') - { - $('#search_error').css('display', 'inline-block'); - $('#search_error').html(val); - }else - $('#search_error').css('display', 'none'); - } + $.ajax({ + type: 'POST', + url: home+'addons/subsection/search'+go, + data: 'text='+$('#search').val(), + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + { + if(val != '') + { + $('#search_error').css('display', 'inline-block'); + $('#search_error').html(val); + }else + $('#search_error').css('display', 'none'); + } - if(i == 's') - { - $('#search_error').css('display', 'none'); - $('#search_result').html(val); - } - }); + if(i == 's') + { + $('#search_error').css('display', 'none'); + $('#search_result').html(val); + } + }); - loading(0); - } - }); + loading(0); + } + }); } function plugins_delete(id) { - bootbox.dialog('

    Внимание

    Вы уверены, что хотите удалить плагин?', - [{ - "label" : "Удалить", - callback : function(){plugins_delete_go(id)} - },{ - "label" : "Отмена", - }] - ); + bootbox.dialog('

    Внимание

    Вы уверены, что хотите удалить плагин?', + [{ + "label" : "Удалить", + callback : function(){plugins_delete_go(id)} + },{ + "label" : "Отмена", + }] + ); - return false; + return false; } function plugins_delete_go(id) { - loading(1); + loading(1); - $.ajax({ - type: 'POST', - url: home+'addons/section/delete/type/plugin/id/'+id, - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить" - }] - ); + $.ajax({ + type: 'POST', + url: home+'addons/section/delete/type/plugin/id/'+id, + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить" + }] + ); - if(i == 's') - location.reload() - }); + if(i == 's') + location.reload() + }); - loading(0); - } - }); + loading(0); + } + }); } function add_plugin_type() { - if($("#update").val() == 0) - { - $('#new_plugin').css('display', 'table-row'); - $('#upd_plugin').css('display', 'none'); - }else{ - $('#new_plugin').css('display', 'none'); - $('#upd_plugin').css('display', 'table-row'); - } + if($("#update").val() == 0) + { + $('#new_plugin').css('display', 'table-row'); + $('#upd_plugin').css('display', 'none'); + }else{ + $('#new_plugin').css('display', 'none'); + $('#upd_plugin').css('display', 'table-row'); + } } function config_files_form() { - if(!$("#cfa").prop('checked')) - $('#config_files_form').css('display', 'table'); - else{ - $('#config_files_form').css('display', 'none'); - $('#config_files_all').html(''); - } + if(!$("#cfa").prop('checked')) + $('#config_files_form').css('display', 'table'); + else{ + $('#config_files_form').css('display', 'none'); + $('#config_files_all').html(''); + } } var cf = 999999; @@ -238,92 +238,92 @@ var fd = 999999; function config_files_add() { - cf += 1; + cf += 1; - $('#config_files_all').append('' - +'' - +'' - +'Удалить' - +''); + $('#config_files_all').append('' + +'' + +'' + +'Удалить' + +''); } function config_clear_add() { - cc += 1; + cc += 1; - $('#config_clear_all').append('' - +'' - +'' - +'' - +'Удалить' - +''); + $('#config_clear_all').append('' + +'' + +'' + +'' + +'Удалить' + +''); } function config_write_add() { - cw += 1; + cw += 1; - $('#config_write_all').append('' - +'' - +'' - +'' - +'Удалить' - +''); + $('#config_write_all').append('' + +'' + +'' + +'' + +'Удалить' + +''); } function config_write_del_add() { - cwe += 1; + cwe += 1; - $('#config_write_del_all').append('' - +'' - +'' - +'' - +'Удалить' - +''); + $('#config_write_del_all').append('' + +'' + +'' + +'' + +'Удалить' + +''); } function files_delete_add() { - fd += 1; + fd += 1; - $('#files_delete_all').append('' - +'' - +'Удалить' - +''); + $('#files_delete_all').append('' + +'' + +'Удалить' + +''); } function config_files_del(id) { - $('#cf_'+id).empty(); + $('#cf_'+id).empty(); - return false; + return false; } function config_clear_del(id) { - $('#cc_'+id).empty(); + $('#cc_'+id).empty(); - return false; + return false; } function config_write_del(id) { - $('#cw_'+id).empty(); + $('#cw_'+id).empty(); - return false; + return false; } function config_write_del_del(id) { - $('#cwe_'+id).empty(); + $('#cwe_'+id).empty(); - return false; + return false; } function files_delete_del(id) { - $('#fd_'+id).empty(); + $('#fd_'+id).empty(); - return false; + return false; } \ No newline at end of file diff --git a/template/acp/js/control.js b/template/acp/js/control.js index b273644..2014397 100644 --- a/template/acp/js/control.js +++ b/template/acp/js/control.js @@ -1,196 +1,196 @@ $('#control').ajaxForm({ - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить" - }] - ); + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить" + }] + ); - if(i == 's') - location.reload(); - }); + if(i == 's') + location.reload(); + }); - loading(0) - } + loading(0) + } }); function control_search(go) { - if($('#search').val() == '') - { - $('#search_error').css('display', 'none'); + if($('#search').val() == '') + { + $('#search_error').css('display', 'none'); - return; - } + return; + } - loading(1); + loading(1); - if(go) go = '/go'; else go = ''; + if(go) go = '/go'; else go = ''; - $.ajax({ - type: 'POST', - url: home+'control/subsection/search'+url_search+go, - data: 'text='+$('#search').val(), - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - { - if(val != '') - { - $('#search_error').css('display', 'inline-block'); - $('#search_error').html(val); - }else - $('#search_error').css('display', 'none'); - } + $.ajax({ + type: 'POST', + url: home+'control/subsection/search'+url_search+go, + data: 'text='+$('#search').val(), + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + { + if(val != '') + { + $('#search_error').css('display', 'inline-block'); + $('#search_error').html(val); + }else + $('#search_error').css('display', 'none'); + } - if(i == 's') - { - $('#search_error').css('display', 'none'); - $('#search_result').html(val); - } + if(i == 's') + { + $('#search_error').css('display', 'none'); + $('#search_result').html(val); + } - if(i == 'url') - url_search = val; - }); + if(i == 'url') + url_search = val; + }); - loading(0); - } - }); + loading(0); + } + }); } function control_overdue(id, time) { - bootbox.dialog('

    Установка даты:

    ', - [{ - "label" : "Установить", - callback : function(){control_overdue_go(id)} - },{ - "label" : "Отмена", - }] - ); + bootbox.dialog('

    Установка даты:

    ', + [{ + "label" : "Установить", + callback : function(){control_overdue_go(id)} + },{ + "label" : "Отмена", + }] + ); - return false; + return false; } function control_block(id, time) { - bootbox.dialog('

    Установка даты:

    ', - [{ - "label" : "Заблокировать", - callback : function(){control_block_go(id)} - },{ - "label" : "Отмена", - }] - ); + bootbox.dialog('

    Установка даты:

    ', + [{ + "label" : "Заблокировать", + callback : function(){control_block_go(id)} + },{ + "label" : "Отмена", + }] + ); - return false; + return false; } function datepick(input, time) { - if($('#'+input).val() != '') - time = $('#'+input).val(); + if($('#'+input).val() != '') + time = $('#'+input).val(); - $('#'+input).datetimepicker({value: time, format: 'd/m/Y H:i'}); + $('#'+input).datetimepicker({value: time, format: 'd/m/Y H:i'}); } function control_overdue_go(id) { - $.ajax({ - type: 'POST', - url: home+'control/type/overdue/id/'+id+'/go', - data: 'time='+$('#date_overdue').val(), - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить" - }] - ); + $.ajax({ + type: 'POST', + url: home+'control/type/overdue/id/'+id+'/go', + data: 'time='+$('#date_overdue').val(), + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить" + }] + ); - if(i == 's') - location.reload(); - }); - } - }); + if(i == 's') + location.reload(); + }); + } + }); } function control_block_go(id) { - $.ajax({ - type: 'POST', - url: home+'control/type/block/id/'+id+'/go', - data: 'time='+$('#date_block').val(), - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить" - }] - ); + $.ajax({ + type: 'POST', + url: home+'control/type/block/id/'+id+'/go', + data: 'time='+$('#date_block').val(), + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить" + }] + ); - if(i == 's') - location.reload(); - }); - } - }); + if(i == 's') + location.reload(); + }); + } + }); } function control_delete(id) { - bootbox.dialog('

    Внимание

    Вы уверены, что хотите удалить подключенный сервер?', - [{ - "label" : "Удалить", - callback : function(){control_delete_go(id)} - },{ - "label" : "Отмена", - }] - ); + bootbox.dialog('

    Внимание

    Вы уверены, что хотите удалить подключенный сервер?', + [{ + "label" : "Удалить", + callback : function(){control_delete_go(id)} + },{ + "label" : "Отмена", + }] + ); - return false; + return false; } function control_delete_go(id) { - - loading(1); + + loading(1); - $.ajax({ - type: 'POST', - url: home+'control/section/delete/id/'+id, - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить" - }] - ); + $.ajax({ + type: 'POST', + url: home+'control/section/delete/id/'+id, + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить" + }] + ); - if(i == 's') - location.reload() - }); + if(i == 's') + location.reload() + }); - loading(0); - } - }); + loading(0); + } + }); } \ No newline at end of file diff --git a/template/acp/js/date/jquery.datetimepicker.full.js b/template/acp/js/date/jquery.datetimepicker.full.js index ebed876..3ff99cf 100644 --- a/template/acp/js/date/jquery.datetimepicker.full.js +++ b/template/acp/js/date/jquery.datetimepicker.full.js @@ -581,1511 +581,1511 @@ var DateFormatter; */ /*global DateFormatter, document,window,jQuery,setTimeout,clearTimeout,HighlightedDate,getCurrentValue*/ ;(function (factory) { - if ( typeof define === 'function' && define.amd ) { - // AMD. Register as an anonymous module. - define(['jquery', 'jquery-mousewheel'], factory); - } else if (typeof exports === 'object') { - // Node/CommonJS style for Browserify - module.exports = factory; - } else { - // Browser globals - factory(jQuery); - } + if ( typeof define === 'function' && define.amd ) { + // AMD. Register as an anonymous module. + define(['jquery', 'jquery-mousewheel'], factory); + } else if (typeof exports === 'object') { + // Node/CommonJS style for Browserify + module.exports = factory; + } else { + // Browser globals + factory(jQuery); + } }(function ($) { - 'use strict'; - - var currentlyScrollingTimeDiv = false; - - var default_options = { - i18n: { - ar: { // Arabic - months: [ - "كانون الثاني", "شباط", "آذار", "نيسان", "مايو", "حزيران", "تموز", "آب", "أيلول", "تشرين الأول", "تشرين الثاني", "كانون الأول" - ], - dayOfWeekShort: [ - "ن", "ث", "ع", "خ", "ج", "س", "ح" - ], - dayOfWeek: ["الأحد", "الاثنين", "الثلاثاء", "الأربعاء", "الخميس", "الجمعة", "السبت", "الأحد"] - }, - ro: { // Romanian - months: [ - "Ianuarie", "Februarie", "Martie", "Aprilie", "Mai", "Iunie", "Iulie", "August", "Septembrie", "Octombrie", "Noiembrie", "Decembrie" - ], - dayOfWeekShort: [ - "Du", "Lu", "Ma", "Mi", "Jo", "Vi", "Sâ" - ], - dayOfWeek: ["Duminică", "Luni", "Marţi", "Miercuri", "Joi", "Vineri", "Sâmbătă"] - }, - id: { // Indonesian - months: [ - "Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember" - ], - dayOfWeekShort: [ - "Min", "Sen", "Sel", "Rab", "Kam", "Jum", "Sab" - ], - dayOfWeek: ["Minggu", "Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu"] - }, - is: { // Icelandic - months: [ - "Janúar", "Febrúar", "Mars", "Apríl", "Maí", "Júní", "Júlí", "Ágúst", "September", "Október", "Nóvember", "Desember" - ], - dayOfWeekShort: [ - "Sun", "Mán", "Þrið", "Mið", "Fim", "Fös", "Lau" - ], - dayOfWeek: ["Sunnudagur", "Mánudagur", "Þriðjudagur", "Miðvikudagur", "Fimmtudagur", "Föstudagur", "Laugardagur"] - }, - bg: { // Bulgarian - months: [ - "Януари", "Февруари", "Март", "Април", "Май", "Юни", "Юли", "Август", "Септември", "Октомври", "Ноември", "Декември" - ], - dayOfWeekShort: [ - "Нд", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб" - ], - dayOfWeek: ["Неделя", "Понеделник", "Вторник", "Сряда", "Четвъртък", "Петък", "Събота"] - }, - fa: { // Persian/Farsi - months: [ - 'فروردین', 'اردیبهشت', 'خرداد', 'تیر', 'مرداد', 'شهریور', 'مهر', 'آبان', 'آذر', 'دی', 'بهمن', 'اسفند' - ], - dayOfWeekShort: [ - 'یکشنبه', 'دوشنبه', 'سه شنبه', 'چهارشنبه', 'پنجشنبه', 'جمعه', 'شنبه' - ], - dayOfWeek: ["یک‌شنبه", "دوشنبه", "سه‌شنبه", "چهارشنبه", "پنج‌شنبه", "جمعه", "شنبه", "یک‌شنبه"] - }, - ru: { // Russian - months: [ - 'Январь', 'Февраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабрь' - ], - dayOfWeekShort: [ - "Вс", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб" - ], - dayOfWeek: ["Воскресенье", "Понедельник", "Вторник", "Среда", "Четверг", "Пятница", "Суббота"] - }, - uk: { // Ukrainian - months: [ - 'Січень', 'Лютий', 'Березень', 'Квітень', 'Травень', 'Червень', 'Липень', 'Серпень', 'Вересень', 'Жовтень', 'Листопад', 'Грудень' - ], - dayOfWeekShort: [ - "Ндл", "Пнд", "Втр", "Срд", "Чтв", "Птн", "Сбт" - ], - dayOfWeek: ["Неділя", "Понеділок", "Вівторок", "Середа", "Четвер", "П'ятниця", "Субота"] - }, - en: { // English - months: [ - "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" - ], - dayOfWeekShort: [ - "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" - ], - dayOfWeek: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"] - }, - el: { // Ελληνικά - months: [ - "Ιανουάριος", "Φεβρουάριος", "Μάρτιος", "Απρίλιος", "Μάιος", "Ιούνιος", "Ιούλιος", "Αύγουστος", "Σεπτέμβριος", "Οκτώβριος", "Νοέμβριος", "Δεκέμβριος" - ], - dayOfWeekShort: [ - "Κυρ", "Δευ", "Τρι", "Τετ", "Πεμ", "Παρ", "Σαβ" - ], - dayOfWeek: ["Κυριακή", "Δευτέρα", "Τρίτη", "Τετάρτη", "Πέμπτη", "Παρασκευή", "Σάββατο"] - }, - de: { // German - months: [ - 'Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember' - ], - dayOfWeekShort: [ - "So", "Mo", "Di", "Mi", "Do", "Fr", "Sa" - ], - dayOfWeek: ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"] - }, - nl: { // Dutch - months: [ - "januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus", "september", "oktober", "november", "december" - ], - dayOfWeekShort: [ - "zo", "ma", "di", "wo", "do", "vr", "za" - ], - dayOfWeek: ["zondag", "maandag", "dinsdag", "woensdag", "donderdag", "vrijdag", "zaterdag"] - }, - tr: { // Turkish - months: [ - "Ocak", "Şubat", "Mart", "Nisan", "Mayıs", "Haziran", "Temmuz", "Ağustos", "Eylül", "Ekim", "Kasım", "Aralık" - ], - dayOfWeekShort: [ - "Paz", "Pts", "Sal", "Çar", "Per", "Cum", "Cts" - ], - dayOfWeek: ["Pazar", "Pazartesi", "Salı", "Çarşamba", "Perşembe", "Cuma", "Cumartesi"] - }, - fr: { //French - months: [ - "Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre" - ], - dayOfWeekShort: [ - "Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam" - ], - dayOfWeek: ["dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi"] - }, - es: { // Spanish - months: [ - "Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre" - ], - dayOfWeekShort: [ - "Dom", "Lun", "Mar", "Mié", "Jue", "Vie", "Sáb" - ], - dayOfWeek: ["Domingo", "Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado"] - }, - th: { // Thai - months: [ - 'มกราคม', 'กุมภาพันธ์', 'มีนาคม', 'เมษายน', 'พฤษภาคม', 'มิถุนายน', 'กรกฎาคม', 'สิงหาคม', 'กันยายน', 'ตุลาคม', 'พฤศจิกายน', 'ธันวาคม' - ], - dayOfWeekShort: [ - 'อา.', 'จ.', 'อ.', 'พ.', 'พฤ.', 'ศ.', 'ส.' - ], - dayOfWeek: ["อาทิตย์", "จันทร์", "อังคาร", "พุธ", "พฤหัส", "ศุกร์", "เสาร์", "อาทิตย์"] - }, - pl: { // Polish - months: [ - "styczeń", "luty", "marzec", "kwiecień", "maj", "czerwiec", "lipiec", "sierpień", "wrzesień", "październik", "listopad", "grudzień" - ], - dayOfWeekShort: [ - "nd", "pn", "wt", "śr", "cz", "pt", "sb" - ], - dayOfWeek: ["niedziela", "poniedziałek", "wtorek", "środa", "czwartek", "piątek", "sobota"] - }, - pt: { // Portuguese - months: [ - "Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro" - ], - dayOfWeekShort: [ - "Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sab" - ], - dayOfWeek: ["Domingo", "Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado"] - }, - ch: { // Simplified Chinese - months: [ - "一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月" - ], - dayOfWeekShort: [ - "日", "一", "二", "三", "四", "五", "六" - ] - }, - se: { // Swedish - months: [ - "Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September", "Oktober", "November", "December" - ], - dayOfWeekShort: [ - "Sön", "Mån", "Tis", "Ons", "Tor", "Fre", "Lör" - ] - }, - kr: { // Korean - months: [ - "1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월" - ], - dayOfWeekShort: [ - "일", "월", "화", "수", "목", "금", "토" - ], - dayOfWeek: ["일요일", "월요일", "화요일", "수요일", "목요일", "금요일", "토요일"] - }, - it: { // Italian - months: [ - "Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre" - ], - dayOfWeekShort: [ - "Dom", "Lun", "Mar", "Mer", "Gio", "Ven", "Sab" - ], - dayOfWeek: ["Domenica", "Lunedì", "Martedì", "Mercoledì", "Giovedì", "Venerdì", "Sabato"] - }, - da: { // Dansk - months: [ - "January", "Februar", "Marts", "April", "Maj", "Juni", "July", "August", "September", "Oktober", "November", "December" - ], - dayOfWeekShort: [ - "Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør" - ], - dayOfWeek: ["søndag", "mandag", "tirsdag", "onsdag", "torsdag", "fredag", "lørdag"] - }, - no: { // Norwegian - months: [ - "Januar", "Februar", "Mars", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Desember" - ], - dayOfWeekShort: [ - "Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør" - ], - dayOfWeek: ['Søndag', 'Mandag', 'Tirsdag', 'Onsdag', 'Torsdag', 'Fredag', 'Lørdag'] - }, - ja: { // Japanese - months: [ - "1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月" - ], - dayOfWeekShort: [ - "日", "月", "火", "水", "木", "金", "土" - ], - dayOfWeek: ["日曜", "月曜", "火曜", "水曜", "木曜", "金曜", "土曜"] - }, - vi: { // Vietnamese - months: [ - "Tháng 1", "Tháng 2", "Tháng 3", "Tháng 4", "Tháng 5", "Tháng 6", "Tháng 7", "Tháng 8", "Tháng 9", "Tháng 10", "Tháng 11", "Tháng 12" - ], - dayOfWeekShort: [ - "CN", "T2", "T3", "T4", "T5", "T6", "T7" - ], - dayOfWeek: ["Chủ nhật", "Thứ hai", "Thứ ba", "Thứ tư", "Thứ năm", "Thứ sáu", "Thứ bảy"] - }, - sl: { // Slovenščina - months: [ - "Januar", "Februar", "Marec", "April", "Maj", "Junij", "Julij", "Avgust", "September", "Oktober", "November", "December" - ], - dayOfWeekShort: [ - "Ned", "Pon", "Tor", "Sre", "Čet", "Pet", "Sob" - ], - dayOfWeek: ["Nedelja", "Ponedeljek", "Torek", "Sreda", "Četrtek", "Petek", "Sobota"] - }, - cs: { // Čeština - months: [ - "Leden", "Únor", "Březen", "Duben", "Květen", "Červen", "Červenec", "Srpen", "Září", "Říjen", "Listopad", "Prosinec" - ], - dayOfWeekShort: [ - "Ne", "Po", "Út", "St", "Čt", "Pá", "So" - ] - }, - hu: { // Hungarian - months: [ - "Január", "Február", "Március", "Április", "Május", "Június", "Július", "Augusztus", "Szeptember", "Október", "November", "December" - ], - dayOfWeekShort: [ - "Va", "Hé", "Ke", "Sze", "Cs", "Pé", "Szo" - ], - dayOfWeek: ["vasárnap", "hétfő", "kedd", "szerda", "csütörtök", "péntek", "szombat"] - }, - az: { //Azerbaijanian (Azeri) - months: [ - "Yanvar", "Fevral", "Mart", "Aprel", "May", "Iyun", "Iyul", "Avqust", "Sentyabr", "Oktyabr", "Noyabr", "Dekabr" - ], - dayOfWeekShort: [ - "B", "Be", "Ça", "Ç", "Ca", "C", "Ş" - ], - dayOfWeek: ["Bazar", "Bazar ertəsi", "Çərşənbə axşamı", "Çərşənbə", "Cümə axşamı", "Cümə", "Şənbə"] - }, - bs: { //Bosanski - months: [ - "Januar", "Februar", "Mart", "April", "Maj", "Jun", "Jul", "Avgust", "Septembar", "Oktobar", "Novembar", "Decembar" - ], - dayOfWeekShort: [ - "Ned", "Pon", "Uto", "Sri", "Čet", "Pet", "Sub" - ], - dayOfWeek: ["Nedjelja","Ponedjeljak", "Utorak", "Srijeda", "Četvrtak", "Petak", "Subota"] - }, - ca: { //Català - months: [ - "Gener", "Febrer", "Març", "Abril", "Maig", "Juny", "Juliol", "Agost", "Setembre", "Octubre", "Novembre", "Desembre" - ], - dayOfWeekShort: [ - "Dg", "Dl", "Dt", "Dc", "Dj", "Dv", "Ds" - ], - dayOfWeek: ["Diumenge", "Dilluns", "Dimarts", "Dimecres", "Dijous", "Divendres", "Dissabte"] - }, - 'en-GB': { //English (British) - months: [ - "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" - ], - dayOfWeekShort: [ - "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" - ], - dayOfWeek: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"] - }, - et: { //"Eesti" - months: [ - "Jaanuar", "Veebruar", "Märts", "Aprill", "Mai", "Juuni", "Juuli", "August", "September", "Oktoober", "November", "Detsember" - ], - dayOfWeekShort: [ - "P", "E", "T", "K", "N", "R", "L" - ], - dayOfWeek: ["Pühapäev", "Esmaspäev", "Teisipäev", "Kolmapäev", "Neljapäev", "Reede", "Laupäev"] - }, - eu: { //Euskara - months: [ - "Urtarrila", "Otsaila", "Martxoa", "Apirila", "Maiatza", "Ekaina", "Uztaila", "Abuztua", "Iraila", "Urria", "Azaroa", "Abendua" - ], - dayOfWeekShort: [ - "Ig.", "Al.", "Ar.", "Az.", "Og.", "Or.", "La." - ], - dayOfWeek: ['Igandea', 'Astelehena', 'Asteartea', 'Asteazkena', 'Osteguna', 'Ostirala', 'Larunbata'] - }, - fi: { //Finnish (Suomi) - months: [ - "Tammikuu", "Helmikuu", "Maaliskuu", "Huhtikuu", "Toukokuu", "Kesäkuu", "Heinäkuu", "Elokuu", "Syyskuu", "Lokakuu", "Marraskuu", "Joulukuu" - ], - dayOfWeekShort: [ - "Su", "Ma", "Ti", "Ke", "To", "Pe", "La" - ], - dayOfWeek: ["sunnuntai", "maanantai", "tiistai", "keskiviikko", "torstai", "perjantai", "lauantai"] - }, - gl: { //Galego - months: [ - "Xan", "Feb", "Maz", "Abr", "Mai", "Xun", "Xul", "Ago", "Set", "Out", "Nov", "Dec" - ], - dayOfWeekShort: [ - "Dom", "Lun", "Mar", "Mer", "Xov", "Ven", "Sab" - ], - dayOfWeek: ["Domingo", "Luns", "Martes", "Mércores", "Xoves", "Venres", "Sábado"] - }, - hr: { //Hrvatski - months: [ - "Siječanj", "Veljača", "Ožujak", "Travanj", "Svibanj", "Lipanj", "Srpanj", "Kolovoz", "Rujan", "Listopad", "Studeni", "Prosinac" - ], - dayOfWeekShort: [ - "Ned", "Pon", "Uto", "Sri", "Čet", "Pet", "Sub" - ], - dayOfWeek: ["Nedjelja", "Ponedjeljak", "Utorak", "Srijeda", "Četvrtak", "Petak", "Subota"] - }, - ko: { //Korean (한국어) - months: [ - "1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월" - ], - dayOfWeekShort: [ - "일", "월", "화", "수", "목", "금", "토" - ], - dayOfWeek: ["일요일", "월요일", "화요일", "수요일", "목요일", "금요일", "토요일"] - }, - lt: { //Lithuanian (lietuvių) - months: [ - "Sausio", "Vasario", "Kovo", "Balandžio", "Gegužės", "Birželio", "Liepos", "Rugpjūčio", "Rugsėjo", "Spalio", "Lapkričio", "Gruodžio" - ], - dayOfWeekShort: [ - "Sek", "Pir", "Ant", "Tre", "Ket", "Pen", "Šeš" - ], - dayOfWeek: ["Sekmadienis", "Pirmadienis", "Antradienis", "Trečiadienis", "Ketvirtadienis", "Penktadienis", "Šeštadienis"] - }, - lv: { //Latvian (Latviešu) - months: [ - "Janvāris", "Februāris", "Marts", "Aprīlis ", "Maijs", "Jūnijs", "Jūlijs", "Augusts", "Septembris", "Oktobris", "Novembris", "Decembris" - ], - dayOfWeekShort: [ - "Sv", "Pr", "Ot", "Tr", "Ct", "Pk", "St" - ], - dayOfWeek: ["Svētdiena", "Pirmdiena", "Otrdiena", "Trešdiena", "Ceturtdiena", "Piektdiena", "Sestdiena"] - }, - mk: { //Macedonian (Македонски) - months: [ - "јануари", "февруари", "март", "април", "мај", "јуни", "јули", "август", "септември", "октомври", "ноември", "декември" - ], - dayOfWeekShort: [ - "нед", "пон", "вто", "сре", "чет", "пет", "саб" - ], - dayOfWeek: ["Недела", "Понеделник", "Вторник", "Среда", "Четврток", "Петок", "Сабота"] - }, - mn: { //Mongolian (Монгол) - months: [ - "1-р сар", "2-р сар", "3-р сар", "4-р сар", "5-р сар", "6-р сар", "7-р сар", "8-р сар", "9-р сар", "10-р сар", "11-р сар", "12-р сар" - ], - dayOfWeekShort: [ - "Дав", "Мяг", "Лха", "Пүр", "Бсн", "Бям", "Ням" - ], - dayOfWeek: ["Даваа", "Мягмар", "Лхагва", "Пүрэв", "Баасан", "Бямба", "Ням"] - }, - 'pt-BR': { //Português(Brasil) - months: [ - "Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro" - ], - dayOfWeekShort: [ - "Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sáb" - ], - dayOfWeek: ["Domingo", "Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado"] - }, - sk: { //Slovenčina - months: [ - "Január", "Február", "Marec", "Apríl", "Máj", "Jún", "Júl", "August", "September", "Október", "November", "December" - ], - dayOfWeekShort: [ - "Ne", "Po", "Ut", "St", "Št", "Pi", "So" - ], - dayOfWeek: ["Nedeľa", "Pondelok", "Utorok", "Streda", "Štvrtok", "Piatok", "Sobota"] - }, - sq: { //Albanian (Shqip) - months: [ - "Janar", "Shkurt", "Mars", "Prill", "Maj", "Qershor", "Korrik", "Gusht", "Shtator", "Tetor", "Nëntor", "Dhjetor" - ], - dayOfWeekShort: [ - "Die", "Hën", "Mar", "Mër", "Enj", "Pre", "Shtu" - ], - dayOfWeek: ["E Diel", "E Hënë", "E Martē", "E Mërkurë", "E Enjte", "E Premte", "E Shtunë"] - }, - 'sr-YU': { //Serbian (Srpski) - months: [ - "Januar", "Februar", "Mart", "April", "Maj", "Jun", "Jul", "Avgust", "Septembar", "Oktobar", "Novembar", "Decembar" - ], - dayOfWeekShort: [ - "Ned", "Pon", "Uto", "Sre", "čet", "Pet", "Sub" - ], - dayOfWeek: ["Nedelja","Ponedeljak", "Utorak", "Sreda", "Četvrtak", "Petak", "Subota"] - }, - sr: { //Serbian Cyrillic (Српски) - months: [ - "јануар", "фебруар", "март", "април", "мај", "јун", "јул", "август", "септембар", "октобар", "новембар", "децембар" - ], - dayOfWeekShort: [ - "нед", "пон", "уто", "сре", "чет", "пет", "суб" - ], - dayOfWeek: ["Недеља","Понедељак", "Уторак", "Среда", "Четвртак", "Петак", "Субота"] - }, - sv: { //Svenska - months: [ - "Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September", "Oktober", "November", "December" - ], - dayOfWeekShort: [ - "Sön", "Mån", "Tis", "Ons", "Tor", "Fre", "Lör" - ], - dayOfWeek: ["Söndag", "Måndag", "Tisdag", "Onsdag", "Torsdag", "Fredag", "Lördag"] - }, - 'zh-TW': { //Traditional Chinese (繁體中文) - months: [ - "一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月" - ], - dayOfWeekShort: [ - "日", "一", "二", "三", "四", "五", "六" - ], - dayOfWeek: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"] - }, - zh: { //Simplified Chinese (简体中文) - months: [ - "一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月" - ], - dayOfWeekShort: [ - "日", "一", "二", "三", "四", "五", "六" - ], - dayOfWeek: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"] - }, - he: { //Hebrew (עברית) - months: [ - 'ינואר', 'פברואר', 'מרץ', 'אפריל', 'מאי', 'יוני', 'יולי', 'אוגוסט', 'ספטמבר', 'אוקטובר', 'נובמבר', 'דצמבר' - ], - dayOfWeekShort: [ - 'א\'', 'ב\'', 'ג\'', 'ד\'', 'ה\'', 'ו\'', 'שבת' - ], - dayOfWeek: ["ראשון", "שני", "שלישי", "רביעי", "חמישי", "שישי", "שבת", "ראשון"] - }, - hy: { // Armenian - months: [ - "Հունվար", "Փետրվար", "Մարտ", "Ապրիլ", "Մայիս", "Հունիս", "Հուլիս", "Օգոստոս", "Սեպտեմբեր", "Հոկտեմբեր", "Նոյեմբեր", "Դեկտեմբեր" - ], - dayOfWeekShort: [ - "Կի", "Երկ", "Երք", "Չոր", "Հնգ", "Ուրբ", "Շբթ" - ], - dayOfWeek: ["Կիրակի", "Երկուշաբթի", "Երեքշաբթի", "Չորեքշաբթի", "Հինգշաբթի", "Ուրբաթ", "Շաբաթ"] - }, - kg: { // Kyrgyz - months: [ - 'Үчтүн айы', 'Бирдин айы', 'Жалган Куран', 'Чын Куран', 'Бугу', 'Кулжа', 'Теке', 'Баш Оона', 'Аяк Оона', 'Тогуздун айы', 'Жетинин айы', 'Бештин айы' - ], - dayOfWeekShort: [ - "Жек", "Дүй", "Шей", "Шар", "Бей", "Жум", "Ише" - ], - dayOfWeek: [ - "Жекшемб", "Дүйшөмб", "Шейшемб", "Шаршемб", "Бейшемби", "Жума", "Ишенб" - ] - }, - rm: { // Romansh - months: [ - "Schaner", "Favrer", "Mars", "Avrigl", "Matg", "Zercladur", "Fanadur", "Avust", "Settember", "October", "November", "December" - ], - dayOfWeekShort: [ - "Du", "Gli", "Ma", "Me", "Gie", "Ve", "So" - ], - dayOfWeek: [ - "Dumengia", "Glindesdi", "Mardi", "Mesemna", "Gievgia", "Venderdi", "Sonda" - ] - }, - ka: { // Georgian - months: [ - 'იანვარი', 'თებერვალი', 'მარტი', 'აპრილი', 'მაისი', 'ივნისი', 'ივლისი', 'აგვისტო', 'სექტემბერი', 'ოქტომბერი', 'ნოემბერი', 'დეკემბერი' - ], - dayOfWeekShort: [ - "კვ", "ორშ", "სამშ", "ოთხ", "ხუთ", "პარ", "შაბ" - ], - dayOfWeek: ["კვირა", "ორშაბათი", "სამშაბათი", "ოთხშაბათი", "ხუთშაბათი", "პარასკევი", "შაბათი"] - }, - }, - value: '', - rtl: false, - - format: 'Y/m/d H:i', - formatTime: 'H:i', - formatDate: 'Y/m/d', - - startDate: false, // new Date(), '1986/12/08', '-1970/01/05','-1970/01/05', - step: 60, - monthChangeSpinner: true, - - closeOnDateSelect: false, - closeOnTimeSelect: true, - closeOnWithoutClick: true, - closeOnInputClick: true, - - timepicker: true, - datepicker: true, - weeks: false, - - defaultTime: false, // use formatTime format (ex. '10:00' for formatTime: 'H:i') - defaultDate: false, // use formatDate format (ex new Date() or '1986/12/08' or '-1970/01/05' or '-1970/01/05') - - minDate: false, - maxDate: false, - minTime: false, - maxTime: false, - disabledMinTime: false, - disabledMaxTime: false, - - allowTimes: [], - opened: false, - initTime: true, - inline: false, - theme: '', - - onSelectDate: function () {}, - onSelectTime: function () {}, - onChangeMonth: function () {}, - onGetWeekOfYear: function () {}, - onChangeYear: function () {}, - onChangeDateTime: function () {}, - onShow: function () {}, - onClose: function () {}, - onGenerate: function () {}, - - withoutCopyright: true, - inverseButton: false, - hours12: false, - next: 'xdsoft_next', - prev : 'xdsoft_prev', - dayOfWeekStart: 0, - parentID: 'body', - timeHeightInTimePicker: 25, - timepickerScrollbar: true, - todayButton: true, - prevButton: true, - nextButton: true, - defaultSelect: true, - - scrollMonth: true, - scrollTime: true, - scrollInput: true, - - lazyInit: false, - mask: false, - validateOnBlur: true, - allowBlank: true, - yearStart: 1950, - yearEnd: 2050, - monthStart: 0, - monthEnd: 11, - style: '', - id: '', - fixed: false, - roundTime: 'round', // ceil, floor - className: '', - weekends: [], - highlightedDates: [], - highlightedPeriods: [], - allowDates : [], - allowDateRe : null, - disabledDates : [], - disabledWeekDays: [], - yearOffset: 0, - beforeShowDay: null, - - enterLikeTab: true, - showApplyButton: false - }; - - var dateHelper = null, - globalLocaleDefault = 'en', - globalLocale = 'en'; - - var dateFormatterOptionsDefault = { - meridiem: ['AM', 'PM'] - }; - - var initDateFormatter = function(){ - var locale = default_options.i18n[globalLocale], - opts = { - days: locale.dayOfWeek, - daysShort: locale.dayOfWeekShort, - months: locale.months, - monthsShort: $.map(locale.months, function(n){ return n.substring(0, 3) }), - }; - - dateHelper = new DateFormatter({ - dateSettings: $.extend({}, dateFormatterOptionsDefault, opts) - }); - }; - - // for locale settings - $.datetimepicker = { - setLocale: function(locale){ - var newLocale = default_options.i18n[locale]?locale:globalLocaleDefault; - if(globalLocale != newLocale){ - globalLocale = newLocale; - // reinit date formatter - initDateFormatter(); - } - }, - setDateFormatter: function(dateFormatter) { - dateHelper = dateFormatter; - }, - RFC_2822: 'D, d M Y H:i:s O', - ATOM: 'Y-m-d\TH:i:sP', - ISO_8601: 'Y-m-d\TH:i:sO', - RFC_822: 'D, d M y H:i:s O', - RFC_850: 'l, d-M-y H:i:s T', - RFC_1036: 'D, d M y H:i:s O', - RFC_1123: 'D, d M Y H:i:s O', - RSS: 'D, d M Y H:i:s O', - W3C: 'Y-m-d\TH:i:sP' - }; - - // first init date formatter - initDateFormatter(); - - // fix for ie8 - if (!window.getComputedStyle) { - window.getComputedStyle = function (el, pseudo) { - this.el = el; - this.getPropertyValue = function (prop) { - var re = /(\-([a-z]){1})/g; - if (prop === 'float') { - prop = 'styleFloat'; - } - if (re.test(prop)) { - prop = prop.replace(re, function (a, b, c) { - return c.toUpperCase(); - }); - } - return el.currentStyle[prop] || null; - }; - return this; - }; - } - if (!Array.prototype.indexOf) { - Array.prototype.indexOf = function (obj, start) { - var i, j; - for (i = (start || 0), j = this.length; i < j; i += 1) { - if (this[i] === obj) { return i; } - } - return -1; - }; - } - Date.prototype.countDaysInMonth = function () { - return new Date(this.getFullYear(), this.getMonth() + 1, 0).getDate(); - }; - $.fn.xdsoftScroller = function (percent) { - return this.each(function () { - var timeboxparent = $(this), - pointerEventToXY = function (e) { - var out = {x: 0, y: 0}, - touch; - if (e.type === 'touchstart' || e.type === 'touchmove' || e.type === 'touchend' || e.type === 'touchcancel') { - touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0]; - out.x = touch.clientX; - out.y = touch.clientY; - } else if (e.type === 'mousedown' || e.type === 'mouseup' || e.type === 'mousemove' || e.type === 'mouseover' || e.type === 'mouseout' || e.type === 'mouseenter' || e.type === 'mouseleave') { - out.x = e.clientX; - out.y = e.clientY; - } - return out; - }, - timebox, - parentHeight, - height, - scrollbar, - scroller, - maximumOffset = 100, - start = false, - startY = 0, - startTop = 0, - h1 = 0, - touchStart = false, - startTopScroll = 0, - calcOffset = function () {}; - if (percent === 'hide') { - timeboxparent.find('.xdsoft_scrollbar').hide(); - return; - } - if (!$(this).hasClass('xdsoft_scroller_box')) { - timebox = timeboxparent.children().eq(0); - parentHeight = timeboxparent[0].clientHeight; - height = timebox[0].offsetHeight; - scrollbar = $('
    '); - scroller = $('
    '); - scrollbar.append(scroller); - - timeboxparent.addClass('xdsoft_scroller_box').append(scrollbar); - calcOffset = function calcOffset(event) { - var offset = pointerEventToXY(event).y - startY + startTopScroll; - if (offset < 0) { - offset = 0; - } - if (offset + scroller[0].offsetHeight > h1) { - offset = h1 - scroller[0].offsetHeight; - } - timeboxparent.trigger('scroll_element.xdsoft_scroller', [maximumOffset ? offset / maximumOffset : 0]); - }; - - scroller - .on('touchstart.xdsoft_scroller mousedown.xdsoft_scroller', function (event) { - if (!parentHeight) { - timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percent]); - } - - startY = pointerEventToXY(event).y; - startTopScroll = parseInt(scroller.css('margin-top'), 10); - h1 = scrollbar[0].offsetHeight; - - if (event.type === 'mousedown' || event.type === 'touchstart') { - if (document) { - $(document.body).addClass('xdsoft_noselect'); - } - $([document.body, window]).on('touchend mouseup.xdsoft_scroller', function arguments_callee() { - $([document.body, window]).off('touchend mouseup.xdsoft_scroller', arguments_callee) - .off('mousemove.xdsoft_scroller', calcOffset) - .removeClass('xdsoft_noselect'); - }); - $(document.body).on('mousemove.xdsoft_scroller', calcOffset); - } else { - touchStart = true; - event.stopPropagation(); - event.preventDefault(); - } - }) - .on('touchmove', function (event) { - if (touchStart) { - event.preventDefault(); - calcOffset(event); - } - }) - .on('touchend touchcancel', function () { - touchStart = false; - startTopScroll = 0; - }); - - timeboxparent - .on('scroll_element.xdsoft_scroller', function (event, percentage) { - if (!parentHeight) { - timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percentage, true]); - } - percentage = percentage > 1 ? 1 : (percentage < 0 || isNaN(percentage)) ? 0 : percentage; - - scroller.css('margin-top', maximumOffset * percentage); - - setTimeout(function () { - timebox.css('marginTop', -parseInt((timebox[0].offsetHeight - parentHeight) * percentage, 10)); - }, 10); - }) - .on('resize_scroll.xdsoft_scroller', function (event, percentage, noTriggerScroll) { - var percent, sh; - parentHeight = timeboxparent[0].clientHeight; - height = timebox[0].offsetHeight; - percent = parentHeight / height; - sh = percent * scrollbar[0].offsetHeight; - if (percent > 1) { - scroller.hide(); - } else { - scroller.show(); - scroller.css('height', parseInt(sh > 10 ? sh : 10, 10)); - maximumOffset = scrollbar[0].offsetHeight - scroller[0].offsetHeight; - if (noTriggerScroll !== true) { - timeboxparent.trigger('scroll_element.xdsoft_scroller', [percentage || Math.abs(parseInt(timebox.css('marginTop'), 10)) / (height - parentHeight)]); - } - } - }); - - timeboxparent.on('mousewheel', function (event) { - var top = Math.abs(parseInt(timebox.css('marginTop'), 10)); - - top = top - (event.deltaY * 20); - if (top < 0) { - top = 0; - } - - timeboxparent.trigger('scroll_element.xdsoft_scroller', [top / (height - parentHeight)]); - event.stopPropagation(); - return false; - }); - - timeboxparent.on('touchstart', function (event) { - start = pointerEventToXY(event); - startTop = Math.abs(parseInt(timebox.css('marginTop'), 10)); - }); - - timeboxparent.on('touchmove', function (event) { - if (start) { - event.preventDefault(); - var coord = pointerEventToXY(event); - timeboxparent.trigger('scroll_element.xdsoft_scroller', [(startTop - (coord.y - start.y)) / (height - parentHeight)]); - } - }); - - timeboxparent.on('touchend touchcancel', function () { - start = false; - startTop = 0; - }); - } - timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percent]); - }); - }; - - $.fn.datetimepicker = function (opt, opt2) { - var result = this, - KEY0 = 48, - KEY9 = 57, - _KEY0 = 96, - _KEY9 = 105, - CTRLKEY = 17, - DEL = 46, - ENTER = 13, - ESC = 27, - BACKSPACE = 8, - ARROWLEFT = 37, - ARROWUP = 38, - ARROWRIGHT = 39, - ARROWDOWN = 40, - TAB = 9, - F5 = 116, - AKEY = 65, - CKEY = 67, - VKEY = 86, - ZKEY = 90, - YKEY = 89, - ctrlDown = false, - options = ($.isPlainObject(opt) || !opt) ? $.extend(true, {}, default_options, opt) : $.extend(true, {}, default_options), - - lazyInitTimer = 0, - createDateTimePicker, - destroyDateTimePicker, - - lazyInit = function (input) { - input - .on('open.xdsoft focusin.xdsoft mousedown.xdsoft touchstart', function initOnActionCallback() { - if (input.is(':disabled') || input.data('xdsoft_datetimepicker')) { - return; - } - clearTimeout(lazyInitTimer); - lazyInitTimer = setTimeout(function () { - - if (!input.data('xdsoft_datetimepicker')) { - createDateTimePicker(input); - } - input - .off('open.xdsoft focusin.xdsoft mousedown.xdsoft touchstart', initOnActionCallback) - .trigger('open.xdsoft'); - }, 100); - }); - }; - - createDateTimePicker = function (input) { - var datetimepicker = $('
    '), - xdsoft_copyright = $(''), - datepicker = $('
    '), - month_picker = $('
    ' + - '
    ' + - '
    ' + - '
    '), - calendar = $('
    '), - timepicker = $('
    '), - timeboxparent = timepicker.find('.xdsoft_time_box').eq(0), - timebox = $('
    '), - applyButton = $(''), - - monthselect = $('
    '), - yearselect = $('
    '), - triggerAfterOpen = false, - XDSoft_datetime, - - xchangeTimer, - timerclick, - current_time_index, - setPos, - timer = 0, - _xdsoft_datetime, - forEachAncestorOf, - throttle; - - if (options.id) { - datetimepicker.attr('id', options.id); - } - if (options.style) { - datetimepicker.attr('style', options.style); - } - if (options.weeks) { - datetimepicker.addClass('xdsoft_showweeks'); - } - if (options.rtl) { - datetimepicker.addClass('xdsoft_rtl'); - } - - datetimepicker.addClass('xdsoft_' + options.theme); - datetimepicker.addClass(options.className); - - month_picker - .find('.xdsoft_month span') - .after(monthselect); - month_picker - .find('.xdsoft_year span') - .after(yearselect); - - month_picker - .find('.xdsoft_month,.xdsoft_year') - .on('touchstart mousedown.xdsoft', function (event) { - var select = $(this).find('.xdsoft_select').eq(0), - val = 0, - top = 0, - visible = select.is(':visible'), - items, - i; - - month_picker - .find('.xdsoft_select') - .hide(); - if (_xdsoft_datetime.currentTime) { - val = _xdsoft_datetime.currentTime[$(this).hasClass('xdsoft_month') ? 'getMonth' : 'getFullYear'](); - } - - select[visible ? 'hide' : 'show'](); - for (items = select.find('div.xdsoft_option'), i = 0; i < items.length; i += 1) { - if (items.eq(i).data('value') === val) { - break; - } else { - top += items[0].offsetHeight; - } - } - - select.xdsoftScroller(top / (select.children()[0].offsetHeight - (select[0].clientHeight))); - event.stopPropagation(); - return false; - }); - - month_picker - .find('.xdsoft_select') - .xdsoftScroller() - .on('touchstart mousedown.xdsoft', function (event) { - event.stopPropagation(); - event.preventDefault(); - }) - .on('touchstart mousedown.xdsoft', '.xdsoft_option', function () { - if (_xdsoft_datetime.currentTime === undefined || _xdsoft_datetime.currentTime === null) { - _xdsoft_datetime.currentTime = _xdsoft_datetime.now(); - } - - var year = _xdsoft_datetime.currentTime.getFullYear(); - if (_xdsoft_datetime && _xdsoft_datetime.currentTime) { - _xdsoft_datetime.currentTime[$(this).parent().parent().hasClass('xdsoft_monthselect') ? 'setMonth' : 'setFullYear']($(this).data('value')); - } - - $(this).parent().parent().hide(); - - datetimepicker.trigger('xchange.xdsoft'); - if (options.onChangeMonth && $.isFunction(options.onChangeMonth)) { - options.onChangeMonth.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input')); - } - - if (year !== _xdsoft_datetime.currentTime.getFullYear() && $.isFunction(options.onChangeYear)) { - options.onChangeYear.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input')); - } - }); - - datetimepicker.getValue = function () { - return _xdsoft_datetime.getCurrentTime(); - }; - - datetimepicker.setOptions = function (_options) { - var highlightedDates = {}; - - options = $.extend(true, {}, options, _options); - - if (_options.allowTimes && $.isArray(_options.allowTimes) && _options.allowTimes.length) { - options.allowTimes = $.extend(true, [], _options.allowTimes); - } - - if (_options.weekends && $.isArray(_options.weekends) && _options.weekends.length) { - options.weekends = $.extend(true, [], _options.weekends); - } - - if (_options.allowDates && $.isArray(_options.allowDates) && _options.allowDates.length) { - options.allowDates = $.extend(true, [], _options.allowDates); - } - - if (_options.allowDateRe && Object.prototype.toString.call(_options.allowDateRe)==="[object String]") { - options.allowDateRe = new RegExp(_options.allowDateRe); - } - - if (_options.highlightedDates && $.isArray(_options.highlightedDates) && _options.highlightedDates.length) { - $.each(_options.highlightedDates, function (index, value) { - var splitData = $.map(value.split(','), $.trim), - exDesc, - hDate = new HighlightedDate(dateHelper.parseDate(splitData[0], options.formatDate), splitData[1], splitData[2]), // date, desc, style - keyDate = dateHelper.formatDate(hDate.date, options.formatDate); - if (highlightedDates[keyDate] !== undefined) { - exDesc = highlightedDates[keyDate].desc; - if (exDesc && exDesc.length && hDate.desc && hDate.desc.length) { - highlightedDates[keyDate].desc = exDesc + "\n" + hDate.desc; - } - } else { - highlightedDates[keyDate] = hDate; - } - }); - - options.highlightedDates = $.extend(true, [], highlightedDates); - } - - if (_options.highlightedPeriods && $.isArray(_options.highlightedPeriods) && _options.highlightedPeriods.length) { - highlightedDates = $.extend(true, [], options.highlightedDates); - $.each(_options.highlightedPeriods, function (index, value) { - var dateTest, // start date - dateEnd, - desc, - hDate, - keyDate, - exDesc, - style; - if ($.isArray(value)) { - dateTest = value[0]; - dateEnd = value[1]; - desc = value[2]; - style = value[3]; - } - else { - var splitData = $.map(value.split(','), $.trim); - dateTest = dateHelper.parseDate(splitData[0], options.formatDate); - dateEnd = dateHelper.parseDate(splitData[1], options.formatDate); - desc = splitData[2]; - style = splitData[3]; - } - - while (dateTest <= dateEnd) { - hDate = new HighlightedDate(dateTest, desc, style); - keyDate = dateHelper.formatDate(dateTest, options.formatDate); - dateTest.setDate(dateTest.getDate() + 1); - if (highlightedDates[keyDate] !== undefined) { - exDesc = highlightedDates[keyDate].desc; - if (exDesc && exDesc.length && hDate.desc && hDate.desc.length) { - highlightedDates[keyDate].desc = exDesc + "\n" + hDate.desc; - } - } else { - highlightedDates[keyDate] = hDate; - } - } - }); - - options.highlightedDates = $.extend(true, [], highlightedDates); - } - - if (_options.disabledDates && $.isArray(_options.disabledDates) && _options.disabledDates.length) { - options.disabledDates = $.extend(true, [], _options.disabledDates); - } - - if (_options.disabledWeekDays && $.isArray(_options.disabledWeekDays) && _options.disabledWeekDays.length) { - options.disabledWeekDays = $.extend(true, [], _options.disabledWeekDays); - } - - if ((options.open || options.opened) && (!options.inline)) { - input.trigger('open.xdsoft'); - } - - if (options.inline) { - triggerAfterOpen = true; - datetimepicker.addClass('xdsoft_inline'); - input.after(datetimepicker).hide(); - } - - if (options.inverseButton) { - options.next = 'xdsoft_prev'; - options.prev = 'xdsoft_next'; - } - - if (options.datepicker) { - datepicker.addClass('active'); - } else { - datepicker.removeClass('active'); - } - - if (options.timepicker) { - timepicker.addClass('active'); - } else { - timepicker.removeClass('active'); - } - - if (options.value) { - _xdsoft_datetime.setCurrentTime(options.value); - if (input && input.val) { - input.val(_xdsoft_datetime.str); - } - } - - if (isNaN(options.dayOfWeekStart)) { - options.dayOfWeekStart = 0; - } else { - options.dayOfWeekStart = parseInt(options.dayOfWeekStart, 10) % 7; - } - - if (!options.timepickerScrollbar) { - timeboxparent.xdsoftScroller('hide'); - } - - if (options.minDate && /^[\+\-](.*)$/.test(options.minDate)) { - options.minDate = dateHelper.formatDate(_xdsoft_datetime.strToDateTime(options.minDate), options.formatDate); - } - - if (options.maxDate && /^[\+\-](.*)$/.test(options.maxDate)) { - options.maxDate = dateHelper.formatDate(_xdsoft_datetime.strToDateTime(options.maxDate), options.formatDate); - } - - applyButton.toggle(options.showApplyButton); - - month_picker - .find('.xdsoft_today_button') - .css('visibility', !options.todayButton ? 'hidden' : 'visible'); - - month_picker - .find('.' + options.prev) - .css('visibility', !options.prevButton ? 'hidden' : 'visible'); - - month_picker - .find('.' + options.next) - .css('visibility', !options.nextButton ? 'hidden' : 'visible'); - - setMask(options); - - if (options.validateOnBlur) { - input - .off('blur.xdsoft') - .on('blur.xdsoft', function () { - if (options.allowBlank && (!$.trim($(this).val()).length || (typeof options.mask == "string" && $.trim($(this).val()) === options.mask.replace(/[0-9]/g, '_')))) { - $(this).val(null); - datetimepicker.data('xdsoft_datetime').empty(); - } else { - var d = dateHelper.parseDate($(this).val(), options.format); - if (d) { // parseDate() may skip some invalid parts like date or time, so make it clear for user: show parsed date/time - $(this).val(dateHelper.formatDate(d, options.format)); - } else { - var splittedHours = +([$(this).val()[0], $(this).val()[1]].join('')), - splittedMinutes = +([$(this).val()[2], $(this).val()[3]].join('')); - - // parse the numbers as 0312 => 03:12 - if (!options.datepicker && options.timepicker && splittedHours >= 0 && splittedHours < 24 && splittedMinutes >= 0 && splittedMinutes < 60) { - $(this).val([splittedHours, splittedMinutes].map(function (item) { - return item > 9 ? item : '0' + item; - }).join(':')); - } else { - $(this).val(dateHelper.formatDate(_xdsoft_datetime.now(), options.format)); - } - } - datetimepicker.data('xdsoft_datetime').setCurrentTime($(this).val()); - } - - datetimepicker.trigger('changedatetime.xdsoft'); - datetimepicker.trigger('close.xdsoft'); - }); - } - options.dayOfWeekStartPrev = (options.dayOfWeekStart === 0) ? 6 : options.dayOfWeekStart - 1; - - datetimepicker - .trigger('xchange.xdsoft') - .trigger('afterOpen.xdsoft'); - }; - - datetimepicker - .data('options', options) - .on('touchstart mousedown.xdsoft', function (event) { - event.stopPropagation(); - event.preventDefault(); - yearselect.hide(); - monthselect.hide(); - return false; - }); - - //scroll_element = timepicker.find('.xdsoft_time_box'); - timeboxparent.append(timebox); - timeboxparent.xdsoftScroller(); - - datetimepicker.on('afterOpen.xdsoft', function () { - timeboxparent.xdsoftScroller(); - }); - - datetimepicker - .append(datepicker) - .append(timepicker); - - if (options.withoutCopyright !== true) { - datetimepicker - .append(xdsoft_copyright); - } - - datepicker - .append(month_picker) - .append(calendar) - .append(applyButton); - - $(options.parentID) - .append(datetimepicker); - - XDSoft_datetime = function () { - var _this = this; - _this.now = function (norecursion) { - var d = new Date(), - date, - time; - - if (!norecursion && options.defaultDate) { - date = _this.strToDateTime(options.defaultDate); - d.setFullYear(date.getFullYear()); - d.setMonth(date.getMonth()); - d.setDate(date.getDate()); - } - - if (options.yearOffset) { - d.setFullYear(d.getFullYear() + options.yearOffset); - } - - if (!norecursion && options.defaultTime) { - time = _this.strtotime(options.defaultTime); - d.setHours(time.getHours()); - d.setMinutes(time.getMinutes()); - } - return d; - }; - - _this.isValidDate = function (d) { - if (Object.prototype.toString.call(d) !== "[object Date]") { - return false; - } - return !isNaN(d.getTime()); - }; - - _this.setCurrentTime = function (dTime, requireValidDate) { - if (typeof dTime === 'string') { - _this.currentTime = _this.strToDateTime(dTime); - } - else if (_this.isValidDate(dTime)) { - _this.currentTime = dTime; - } - else if (!dTime && !requireValidDate && options.allowBlank) { - _this.currentTime = null; - } - else { - _this.currentTime = _this.now(); - } - - datetimepicker.trigger('xchange.xdsoft'); - }; - - _this.empty = function () { - _this.currentTime = null; - }; - - _this.getCurrentTime = function (dTime) { - return _this.currentTime; - }; - - _this.nextMonth = function () { - - if (_this.currentTime === undefined || _this.currentTime === null) { - _this.currentTime = _this.now(); - } - - var month = _this.currentTime.getMonth() + 1, - year; - if (month === 12) { - _this.currentTime.setFullYear(_this.currentTime.getFullYear() + 1); - month = 0; - } - - year = _this.currentTime.getFullYear(); - - _this.currentTime.setDate( - Math.min( - new Date(_this.currentTime.getFullYear(), month + 1, 0).getDate(), - _this.currentTime.getDate() - ) - ); - _this.currentTime.setMonth(month); - - if (options.onChangeMonth && $.isFunction(options.onChangeMonth)) { - options.onChangeMonth.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input')); - } - - if (year !== _this.currentTime.getFullYear() && $.isFunction(options.onChangeYear)) { - options.onChangeYear.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input')); - } - - datetimepicker.trigger('xchange.xdsoft'); - return month; - }; - - _this.prevMonth = function () { - - if (_this.currentTime === undefined || _this.currentTime === null) { - _this.currentTime = _this.now(); - } - - var month = _this.currentTime.getMonth() - 1; - if (month === -1) { - _this.currentTime.setFullYear(_this.currentTime.getFullYear() - 1); - month = 11; - } - _this.currentTime.setDate( - Math.min( - new Date(_this.currentTime.getFullYear(), month + 1, 0).getDate(), - _this.currentTime.getDate() - ) - ); - _this.currentTime.setMonth(month); - if (options.onChangeMonth && $.isFunction(options.onChangeMonth)) { - options.onChangeMonth.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input')); - } - datetimepicker.trigger('xchange.xdsoft'); - return month; - }; - - _this.getWeekOfYear = function (datetime) { - if (options.onGetWeekOfYear && $.isFunction(options.onGetWeekOfYear)) { - var week = options.onGetWeekOfYear.call(datetimepicker, datetime); - if (typeof week !== 'undefined') { - return week; - } - } - var onejan = new Date(datetime.getFullYear(), 0, 1); - //First week of the year is th one with the first Thursday according to ISO8601 - if(onejan.getDay()!=4) - onejan.setMonth(0, 1 + ((4 - onejan.getDay()+ 7) % 7)); - return Math.ceil((((datetime - onejan) / 86400000) + onejan.getDay() + 1) / 7); - }; - - _this.strToDateTime = function (sDateTime) { - var tmpDate = [], timeOffset, currentTime; - - if (sDateTime && sDateTime instanceof Date && _this.isValidDate(sDateTime)) { - return sDateTime; - } - - tmpDate = /^(\+|\-)(.*)$/.exec(sDateTime); - if (tmpDate) { - tmpDate[2] = dateHelper.parseDate(tmpDate[2], options.formatDate); - } - if (tmpDate && tmpDate[2]) { - timeOffset = tmpDate[2].getTime() - (tmpDate[2].getTimezoneOffset()) * 60000; - currentTime = new Date((_this.now(true)).getTime() + parseInt(tmpDate[1] + '1', 10) * timeOffset); - } else { - currentTime = sDateTime ? dateHelper.parseDate(sDateTime, options.format) : _this.now(); - } - - if (!_this.isValidDate(currentTime)) { - currentTime = _this.now(); - } - - return currentTime; - }; - - _this.strToDate = function (sDate) { - if (sDate && sDate instanceof Date && _this.isValidDate(sDate)) { - return sDate; - } - - var currentTime = sDate ? dateHelper.parseDate(sDate, options.formatDate) : _this.now(true); - if (!_this.isValidDate(currentTime)) { - currentTime = _this.now(true); - } - return currentTime; - }; - - _this.strtotime = function (sTime) { - if (sTime && sTime instanceof Date && _this.isValidDate(sTime)) { - return sTime; - } - var currentTime = sTime ? dateHelper.parseDate(sTime, options.formatTime) : _this.now(true); - if (!_this.isValidDate(currentTime)) { - currentTime = _this.now(true); - } - return currentTime; - }; - - _this.str = function () { - return dateHelper.formatDate(_this.currentTime, options.format); - }; - _this.currentTime = this.now(); - }; - - _xdsoft_datetime = new XDSoft_datetime(); - - applyButton.on('touchend click', function (e) {//pathbrite - e.preventDefault(); - datetimepicker.data('changed', true); - _xdsoft_datetime.setCurrentTime(getCurrentValue()); - input.val(_xdsoft_datetime.str()); - datetimepicker.trigger('close.xdsoft'); - }); - month_picker - .find('.xdsoft_today_button') - .on('touchend mousedown.xdsoft', function () { - datetimepicker.data('changed', true); - _xdsoft_datetime.setCurrentTime(0, true); - datetimepicker.trigger('afterOpen.xdsoft'); - }).on('dblclick.xdsoft', function () { - var currentDate = _xdsoft_datetime.getCurrentTime(), minDate, maxDate; - currentDate = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate()); - minDate = _xdsoft_datetime.strToDate(options.minDate); - minDate = new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate()); - if (currentDate < minDate) { - return; - } - maxDate = _xdsoft_datetime.strToDate(options.maxDate); - maxDate = new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate()); - if (currentDate > maxDate) { - return; - } - input.val(_xdsoft_datetime.str()); - input.trigger('change'); - datetimepicker.trigger('close.xdsoft'); - }); - month_picker - .find('.xdsoft_prev,.xdsoft_next') - .on('touchend mousedown.xdsoft', function () { - var $this = $(this), - timer = 0, - stop = false; - - (function arguments_callee1(v) { - if ($this.hasClass(options.next)) { - _xdsoft_datetime.nextMonth(); - } else if ($this.hasClass(options.prev)) { - _xdsoft_datetime.prevMonth(); - } - if (options.monthChangeSpinner) { - if (!stop) { - timer = setTimeout(arguments_callee1, v || 100); - } - } - }(500)); - - $([document.body, window]).on('touchend mouseup.xdsoft', function arguments_callee2() { - clearTimeout(timer); - stop = true; - $([document.body, window]).off('touchend mouseup.xdsoft', arguments_callee2); - }); - }); - - timepicker - .find('.xdsoft_prev,.xdsoft_next') - .on('touchend mousedown.xdsoft', function () { - var $this = $(this), - timer = 0, - stop = false, - period = 110; - (function arguments_callee4(v) { - var pheight = timeboxparent[0].clientHeight, - height = timebox[0].offsetHeight, - top = Math.abs(parseInt(timebox.css('marginTop'), 10)); - if ($this.hasClass(options.next) && (height - pheight) - options.timeHeightInTimePicker >= top) { - timebox.css('marginTop', '-' + (top + options.timeHeightInTimePicker) + 'px'); - } else if ($this.hasClass(options.prev) && top - options.timeHeightInTimePicker >= 0) { - timebox.css('marginTop', '-' + (top - options.timeHeightInTimePicker) + 'px'); - } + 'use strict'; + + var currentlyScrollingTimeDiv = false; + + var default_options = { + i18n: { + ar: { // Arabic + months: [ + "كانون الثاني", "شباط", "آذار", "نيسان", "مايو", "حزيران", "تموز", "آب", "أيلول", "تشرين الأول", "تشرين الثاني", "كانون الأول" + ], + dayOfWeekShort: [ + "ن", "ث", "ع", "خ", "ج", "س", "ح" + ], + dayOfWeek: ["الأحد", "الاثنين", "الثلاثاء", "الأربعاء", "الخميس", "الجمعة", "السبت", "الأحد"] + }, + ro: { // Romanian + months: [ + "Ianuarie", "Februarie", "Martie", "Aprilie", "Mai", "Iunie", "Iulie", "August", "Septembrie", "Octombrie", "Noiembrie", "Decembrie" + ], + dayOfWeekShort: [ + "Du", "Lu", "Ma", "Mi", "Jo", "Vi", "Sâ" + ], + dayOfWeek: ["Duminică", "Luni", "Marţi", "Miercuri", "Joi", "Vineri", "Sâmbătă"] + }, + id: { // Indonesian + months: [ + "Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember" + ], + dayOfWeekShort: [ + "Min", "Sen", "Sel", "Rab", "Kam", "Jum", "Sab" + ], + dayOfWeek: ["Minggu", "Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu"] + }, + is: { // Icelandic + months: [ + "Janúar", "Febrúar", "Mars", "Apríl", "Maí", "Júní", "Júlí", "Ágúst", "September", "Október", "Nóvember", "Desember" + ], + dayOfWeekShort: [ + "Sun", "Mán", "Þrið", "Mið", "Fim", "Fös", "Lau" + ], + dayOfWeek: ["Sunnudagur", "Mánudagur", "Þriðjudagur", "Miðvikudagur", "Fimmtudagur", "Föstudagur", "Laugardagur"] + }, + bg: { // Bulgarian + months: [ + "Януари", "Февруари", "Март", "Април", "Май", "Юни", "Юли", "Август", "Септември", "Октомври", "Ноември", "Декември" + ], + dayOfWeekShort: [ + "Нд", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб" + ], + dayOfWeek: ["Неделя", "Понеделник", "Вторник", "Сряда", "Четвъртък", "Петък", "Събота"] + }, + fa: { // Persian/Farsi + months: [ + 'فروردین', 'اردیبهشت', 'خرداد', 'تیر', 'مرداد', 'شهریور', 'مهر', 'آبان', 'آذر', 'دی', 'بهمن', 'اسفند' + ], + dayOfWeekShort: [ + 'یکشنبه', 'دوشنبه', 'سه شنبه', 'چهارشنبه', 'پنجشنبه', 'جمعه', 'شنبه' + ], + dayOfWeek: ["یک‌شنبه", "دوشنبه", "سه‌شنبه", "چهارشنبه", "پنج‌شنبه", "جمعه", "شنبه", "یک‌شنبه"] + }, + ru: { // Russian + months: [ + 'Январь', 'Февраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабрь' + ], + dayOfWeekShort: [ + "Вс", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб" + ], + dayOfWeek: ["Воскресенье", "Понедельник", "Вторник", "Среда", "Четверг", "Пятница", "Суббота"] + }, + uk: { // Ukrainian + months: [ + 'Січень', 'Лютий', 'Березень', 'Квітень', 'Травень', 'Червень', 'Липень', 'Серпень', 'Вересень', 'Жовтень', 'Листопад', 'Грудень' + ], + dayOfWeekShort: [ + "Ндл", "Пнд", "Втр", "Срд", "Чтв", "Птн", "Сбт" + ], + dayOfWeek: ["Неділя", "Понеділок", "Вівторок", "Середа", "Четвер", "П'ятниця", "Субота"] + }, + en: { // English + months: [ + "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" + ], + dayOfWeekShort: [ + "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" + ], + dayOfWeek: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"] + }, + el: { // Ελληνικά + months: [ + "Ιανουάριος", "Φεβρουάριος", "Μάρτιος", "Απρίλιος", "Μάιος", "Ιούνιος", "Ιούλιος", "Αύγουστος", "Σεπτέμβριος", "Οκτώβριος", "Νοέμβριος", "Δεκέμβριος" + ], + dayOfWeekShort: [ + "Κυρ", "Δευ", "Τρι", "Τετ", "Πεμ", "Παρ", "Σαβ" + ], + dayOfWeek: ["Κυριακή", "Δευτέρα", "Τρίτη", "Τετάρτη", "Πέμπτη", "Παρασκευή", "Σάββατο"] + }, + de: { // German + months: [ + 'Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember' + ], + dayOfWeekShort: [ + "So", "Mo", "Di", "Mi", "Do", "Fr", "Sa" + ], + dayOfWeek: ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"] + }, + nl: { // Dutch + months: [ + "januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus", "september", "oktober", "november", "december" + ], + dayOfWeekShort: [ + "zo", "ma", "di", "wo", "do", "vr", "za" + ], + dayOfWeek: ["zondag", "maandag", "dinsdag", "woensdag", "donderdag", "vrijdag", "zaterdag"] + }, + tr: { // Turkish + months: [ + "Ocak", "Şubat", "Mart", "Nisan", "Mayıs", "Haziran", "Temmuz", "Ağustos", "Eylül", "Ekim", "Kasım", "Aralık" + ], + dayOfWeekShort: [ + "Paz", "Pts", "Sal", "Çar", "Per", "Cum", "Cts" + ], + dayOfWeek: ["Pazar", "Pazartesi", "Salı", "Çarşamba", "Perşembe", "Cuma", "Cumartesi"] + }, + fr: { //French + months: [ + "Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre" + ], + dayOfWeekShort: [ + "Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam" + ], + dayOfWeek: ["dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi"] + }, + es: { // Spanish + months: [ + "Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre" + ], + dayOfWeekShort: [ + "Dom", "Lun", "Mar", "Mié", "Jue", "Vie", "Sáb" + ], + dayOfWeek: ["Domingo", "Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado"] + }, + th: { // Thai + months: [ + 'มกราคม', 'กุมภาพันธ์', 'มีนาคม', 'เมษายน', 'พฤษภาคม', 'มิถุนายน', 'กรกฎาคม', 'สิงหาคม', 'กันยายน', 'ตุลาคม', 'พฤศจิกายน', 'ธันวาคม' + ], + dayOfWeekShort: [ + 'อา.', 'จ.', 'อ.', 'พ.', 'พฤ.', 'ศ.', 'ส.' + ], + dayOfWeek: ["อาทิตย์", "จันทร์", "อังคาร", "พุธ", "พฤหัส", "ศุกร์", "เสาร์", "อาทิตย์"] + }, + pl: { // Polish + months: [ + "styczeń", "luty", "marzec", "kwiecień", "maj", "czerwiec", "lipiec", "sierpień", "wrzesień", "październik", "listopad", "grudzień" + ], + dayOfWeekShort: [ + "nd", "pn", "wt", "śr", "cz", "pt", "sb" + ], + dayOfWeek: ["niedziela", "poniedziałek", "wtorek", "środa", "czwartek", "piątek", "sobota"] + }, + pt: { // Portuguese + months: [ + "Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro" + ], + dayOfWeekShort: [ + "Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sab" + ], + dayOfWeek: ["Domingo", "Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado"] + }, + ch: { // Simplified Chinese + months: [ + "一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月" + ], + dayOfWeekShort: [ + "日", "一", "二", "三", "四", "五", "六" + ] + }, + se: { // Swedish + months: [ + "Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September", "Oktober", "November", "December" + ], + dayOfWeekShort: [ + "Sön", "Mån", "Tis", "Ons", "Tor", "Fre", "Lör" + ] + }, + kr: { // Korean + months: [ + "1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월" + ], + dayOfWeekShort: [ + "일", "월", "화", "수", "목", "금", "토" + ], + dayOfWeek: ["일요일", "월요일", "화요일", "수요일", "목요일", "금요일", "토요일"] + }, + it: { // Italian + months: [ + "Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre" + ], + dayOfWeekShort: [ + "Dom", "Lun", "Mar", "Mer", "Gio", "Ven", "Sab" + ], + dayOfWeek: ["Domenica", "Lunedì", "Martedì", "Mercoledì", "Giovedì", "Venerdì", "Sabato"] + }, + da: { // Dansk + months: [ + "January", "Februar", "Marts", "April", "Maj", "Juni", "July", "August", "September", "Oktober", "November", "December" + ], + dayOfWeekShort: [ + "Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør" + ], + dayOfWeek: ["søndag", "mandag", "tirsdag", "onsdag", "torsdag", "fredag", "lørdag"] + }, + no: { // Norwegian + months: [ + "Januar", "Februar", "Mars", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Desember" + ], + dayOfWeekShort: [ + "Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør" + ], + dayOfWeek: ['Søndag', 'Mandag', 'Tirsdag', 'Onsdag', 'Torsdag', 'Fredag', 'Lørdag'] + }, + ja: { // Japanese + months: [ + "1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月" + ], + dayOfWeekShort: [ + "日", "月", "火", "水", "木", "金", "土" + ], + dayOfWeek: ["日曜", "月曜", "火曜", "水曜", "木曜", "金曜", "土曜"] + }, + vi: { // Vietnamese + months: [ + "Tháng 1", "Tháng 2", "Tháng 3", "Tháng 4", "Tháng 5", "Tháng 6", "Tháng 7", "Tháng 8", "Tháng 9", "Tháng 10", "Tháng 11", "Tháng 12" + ], + dayOfWeekShort: [ + "CN", "T2", "T3", "T4", "T5", "T6", "T7" + ], + dayOfWeek: ["Chủ nhật", "Thứ hai", "Thứ ba", "Thứ tư", "Thứ năm", "Thứ sáu", "Thứ bảy"] + }, + sl: { // Slovenščina + months: [ + "Januar", "Februar", "Marec", "April", "Maj", "Junij", "Julij", "Avgust", "September", "Oktober", "November", "December" + ], + dayOfWeekShort: [ + "Ned", "Pon", "Tor", "Sre", "Čet", "Pet", "Sob" + ], + dayOfWeek: ["Nedelja", "Ponedeljek", "Torek", "Sreda", "Četrtek", "Petek", "Sobota"] + }, + cs: { // Čeština + months: [ + "Leden", "Únor", "Březen", "Duben", "Květen", "Červen", "Červenec", "Srpen", "Září", "Říjen", "Listopad", "Prosinec" + ], + dayOfWeekShort: [ + "Ne", "Po", "Út", "St", "Čt", "Pá", "So" + ] + }, + hu: { // Hungarian + months: [ + "Január", "Február", "Március", "Április", "Május", "Június", "Július", "Augusztus", "Szeptember", "Október", "November", "December" + ], + dayOfWeekShort: [ + "Va", "Hé", "Ke", "Sze", "Cs", "Pé", "Szo" + ], + dayOfWeek: ["vasárnap", "hétfő", "kedd", "szerda", "csütörtök", "péntek", "szombat"] + }, + az: { //Azerbaijanian (Azeri) + months: [ + "Yanvar", "Fevral", "Mart", "Aprel", "May", "Iyun", "Iyul", "Avqust", "Sentyabr", "Oktyabr", "Noyabr", "Dekabr" + ], + dayOfWeekShort: [ + "B", "Be", "Ça", "Ç", "Ca", "C", "Ş" + ], + dayOfWeek: ["Bazar", "Bazar ertəsi", "Çərşənbə axşamı", "Çərşənbə", "Cümə axşamı", "Cümə", "Şənbə"] + }, + bs: { //Bosanski + months: [ + "Januar", "Februar", "Mart", "April", "Maj", "Jun", "Jul", "Avgust", "Septembar", "Oktobar", "Novembar", "Decembar" + ], + dayOfWeekShort: [ + "Ned", "Pon", "Uto", "Sri", "Čet", "Pet", "Sub" + ], + dayOfWeek: ["Nedjelja","Ponedjeljak", "Utorak", "Srijeda", "Četvrtak", "Petak", "Subota"] + }, + ca: { //Català + months: [ + "Gener", "Febrer", "Març", "Abril", "Maig", "Juny", "Juliol", "Agost", "Setembre", "Octubre", "Novembre", "Desembre" + ], + dayOfWeekShort: [ + "Dg", "Dl", "Dt", "Dc", "Dj", "Dv", "Ds" + ], + dayOfWeek: ["Diumenge", "Dilluns", "Dimarts", "Dimecres", "Dijous", "Divendres", "Dissabte"] + }, + 'en-GB': { //English (British) + months: [ + "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" + ], + dayOfWeekShort: [ + "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" + ], + dayOfWeek: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"] + }, + et: { //"Eesti" + months: [ + "Jaanuar", "Veebruar", "Märts", "Aprill", "Mai", "Juuni", "Juuli", "August", "September", "Oktoober", "November", "Detsember" + ], + dayOfWeekShort: [ + "P", "E", "T", "K", "N", "R", "L" + ], + dayOfWeek: ["Pühapäev", "Esmaspäev", "Teisipäev", "Kolmapäev", "Neljapäev", "Reede", "Laupäev"] + }, + eu: { //Euskara + months: [ + "Urtarrila", "Otsaila", "Martxoa", "Apirila", "Maiatza", "Ekaina", "Uztaila", "Abuztua", "Iraila", "Urria", "Azaroa", "Abendua" + ], + dayOfWeekShort: [ + "Ig.", "Al.", "Ar.", "Az.", "Og.", "Or.", "La." + ], + dayOfWeek: ['Igandea', 'Astelehena', 'Asteartea', 'Asteazkena', 'Osteguna', 'Ostirala', 'Larunbata'] + }, + fi: { //Finnish (Suomi) + months: [ + "Tammikuu", "Helmikuu", "Maaliskuu", "Huhtikuu", "Toukokuu", "Kesäkuu", "Heinäkuu", "Elokuu", "Syyskuu", "Lokakuu", "Marraskuu", "Joulukuu" + ], + dayOfWeekShort: [ + "Su", "Ma", "Ti", "Ke", "To", "Pe", "La" + ], + dayOfWeek: ["sunnuntai", "maanantai", "tiistai", "keskiviikko", "torstai", "perjantai", "lauantai"] + }, + gl: { //Galego + months: [ + "Xan", "Feb", "Maz", "Abr", "Mai", "Xun", "Xul", "Ago", "Set", "Out", "Nov", "Dec" + ], + dayOfWeekShort: [ + "Dom", "Lun", "Mar", "Mer", "Xov", "Ven", "Sab" + ], + dayOfWeek: ["Domingo", "Luns", "Martes", "Mércores", "Xoves", "Venres", "Sábado"] + }, + hr: { //Hrvatski + months: [ + "Siječanj", "Veljača", "Ožujak", "Travanj", "Svibanj", "Lipanj", "Srpanj", "Kolovoz", "Rujan", "Listopad", "Studeni", "Prosinac" + ], + dayOfWeekShort: [ + "Ned", "Pon", "Uto", "Sri", "Čet", "Pet", "Sub" + ], + dayOfWeek: ["Nedjelja", "Ponedjeljak", "Utorak", "Srijeda", "Četvrtak", "Petak", "Subota"] + }, + ko: { //Korean (한국어) + months: [ + "1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월" + ], + dayOfWeekShort: [ + "일", "월", "화", "수", "목", "금", "토" + ], + dayOfWeek: ["일요일", "월요일", "화요일", "수요일", "목요일", "금요일", "토요일"] + }, + lt: { //Lithuanian (lietuvių) + months: [ + "Sausio", "Vasario", "Kovo", "Balandžio", "Gegužės", "Birželio", "Liepos", "Rugpjūčio", "Rugsėjo", "Spalio", "Lapkričio", "Gruodžio" + ], + dayOfWeekShort: [ + "Sek", "Pir", "Ant", "Tre", "Ket", "Pen", "Šeš" + ], + dayOfWeek: ["Sekmadienis", "Pirmadienis", "Antradienis", "Trečiadienis", "Ketvirtadienis", "Penktadienis", "Šeštadienis"] + }, + lv: { //Latvian (Latviešu) + months: [ + "Janvāris", "Februāris", "Marts", "Aprīlis ", "Maijs", "Jūnijs", "Jūlijs", "Augusts", "Septembris", "Oktobris", "Novembris", "Decembris" + ], + dayOfWeekShort: [ + "Sv", "Pr", "Ot", "Tr", "Ct", "Pk", "St" + ], + dayOfWeek: ["Svētdiena", "Pirmdiena", "Otrdiena", "Trešdiena", "Ceturtdiena", "Piektdiena", "Sestdiena"] + }, + mk: { //Macedonian (Македонски) + months: [ + "јануари", "февруари", "март", "април", "мај", "јуни", "јули", "август", "септември", "октомври", "ноември", "декември" + ], + dayOfWeekShort: [ + "нед", "пон", "вто", "сре", "чет", "пет", "саб" + ], + dayOfWeek: ["Недела", "Понеделник", "Вторник", "Среда", "Четврток", "Петок", "Сабота"] + }, + mn: { //Mongolian (Монгол) + months: [ + "1-р сар", "2-р сар", "3-р сар", "4-р сар", "5-р сар", "6-р сар", "7-р сар", "8-р сар", "9-р сар", "10-р сар", "11-р сар", "12-р сар" + ], + dayOfWeekShort: [ + "Дав", "Мяг", "Лха", "Пүр", "Бсн", "Бям", "Ням" + ], + dayOfWeek: ["Даваа", "Мягмар", "Лхагва", "Пүрэв", "Баасан", "Бямба", "Ням"] + }, + 'pt-BR': { //Português(Brasil) + months: [ + "Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro" + ], + dayOfWeekShort: [ + "Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sáb" + ], + dayOfWeek: ["Domingo", "Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado"] + }, + sk: { //Slovenčina + months: [ + "Január", "Február", "Marec", "Apríl", "Máj", "Jún", "Júl", "August", "September", "Október", "November", "December" + ], + dayOfWeekShort: [ + "Ne", "Po", "Ut", "St", "Št", "Pi", "So" + ], + dayOfWeek: ["Nedeľa", "Pondelok", "Utorok", "Streda", "Štvrtok", "Piatok", "Sobota"] + }, + sq: { //Albanian (Shqip) + months: [ + "Janar", "Shkurt", "Mars", "Prill", "Maj", "Qershor", "Korrik", "Gusht", "Shtator", "Tetor", "Nëntor", "Dhjetor" + ], + dayOfWeekShort: [ + "Die", "Hën", "Mar", "Mër", "Enj", "Pre", "Shtu" + ], + dayOfWeek: ["E Diel", "E Hënë", "E Martē", "E Mërkurë", "E Enjte", "E Premte", "E Shtunë"] + }, + 'sr-YU': { //Serbian (Srpski) + months: [ + "Januar", "Februar", "Mart", "April", "Maj", "Jun", "Jul", "Avgust", "Septembar", "Oktobar", "Novembar", "Decembar" + ], + dayOfWeekShort: [ + "Ned", "Pon", "Uto", "Sre", "čet", "Pet", "Sub" + ], + dayOfWeek: ["Nedelja","Ponedeljak", "Utorak", "Sreda", "Četvrtak", "Petak", "Subota"] + }, + sr: { //Serbian Cyrillic (Српски) + months: [ + "јануар", "фебруар", "март", "април", "мај", "јун", "јул", "август", "септембар", "октобар", "новембар", "децембар" + ], + dayOfWeekShort: [ + "нед", "пон", "уто", "сре", "чет", "пет", "суб" + ], + dayOfWeek: ["Недеља","Понедељак", "Уторак", "Среда", "Четвртак", "Петак", "Субота"] + }, + sv: { //Svenska + months: [ + "Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September", "Oktober", "November", "December" + ], + dayOfWeekShort: [ + "Sön", "Mån", "Tis", "Ons", "Tor", "Fre", "Lör" + ], + dayOfWeek: ["Söndag", "Måndag", "Tisdag", "Onsdag", "Torsdag", "Fredag", "Lördag"] + }, + 'zh-TW': { //Traditional Chinese (繁體中文) + months: [ + "一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月" + ], + dayOfWeekShort: [ + "日", "一", "二", "三", "四", "五", "六" + ], + dayOfWeek: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"] + }, + zh: { //Simplified Chinese (简体中文) + months: [ + "一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月" + ], + dayOfWeekShort: [ + "日", "一", "二", "三", "四", "五", "六" + ], + dayOfWeek: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"] + }, + he: { //Hebrew (עברית) + months: [ + 'ינואר', 'פברואר', 'מרץ', 'אפריל', 'מאי', 'יוני', 'יולי', 'אוגוסט', 'ספטמבר', 'אוקטובר', 'נובמבר', 'דצמבר' + ], + dayOfWeekShort: [ + 'א\'', 'ב\'', 'ג\'', 'ד\'', 'ה\'', 'ו\'', 'שבת' + ], + dayOfWeek: ["ראשון", "שני", "שלישי", "רביעי", "חמישי", "שישי", "שבת", "ראשון"] + }, + hy: { // Armenian + months: [ + "Հունվար", "Փետրվար", "Մարտ", "Ապրիլ", "Մայիս", "Հունիս", "Հուլիս", "Օգոստոս", "Սեպտեմբեր", "Հոկտեմբեր", "Նոյեմբեր", "Դեկտեմբեր" + ], + dayOfWeekShort: [ + "Կի", "Երկ", "Երք", "Չոր", "Հնգ", "Ուրբ", "Շբթ" + ], + dayOfWeek: ["Կիրակի", "Երկուշաբթի", "Երեքշաբթի", "Չորեքշաբթի", "Հինգշաբթի", "Ուրբաթ", "Շաբաթ"] + }, + kg: { // Kyrgyz + months: [ + 'Үчтүн айы', 'Бирдин айы', 'Жалган Куран', 'Чын Куран', 'Бугу', 'Кулжа', 'Теке', 'Баш Оона', 'Аяк Оона', 'Тогуздун айы', 'Жетинин айы', 'Бештин айы' + ], + dayOfWeekShort: [ + "Жек", "Дүй", "Шей", "Шар", "Бей", "Жум", "Ише" + ], + dayOfWeek: [ + "Жекшемб", "Дүйшөмб", "Шейшемб", "Шаршемб", "Бейшемби", "Жума", "Ишенб" + ] + }, + rm: { // Romansh + months: [ + "Schaner", "Favrer", "Mars", "Avrigl", "Matg", "Zercladur", "Fanadur", "Avust", "Settember", "October", "November", "December" + ], + dayOfWeekShort: [ + "Du", "Gli", "Ma", "Me", "Gie", "Ve", "So" + ], + dayOfWeek: [ + "Dumengia", "Glindesdi", "Mardi", "Mesemna", "Gievgia", "Venderdi", "Sonda" + ] + }, + ka: { // Georgian + months: [ + 'იანვარი', 'თებერვალი', 'მარტი', 'აპრილი', 'მაისი', 'ივნისი', 'ივლისი', 'აგვისტო', 'სექტემბერი', 'ოქტომბერი', 'ნოემბერი', 'დეკემბერი' + ], + dayOfWeekShort: [ + "კვ", "ორშ", "სამშ", "ოთხ", "ხუთ", "პარ", "შაბ" + ], + dayOfWeek: ["კვირა", "ორშაბათი", "სამშაბათი", "ოთხშაბათი", "ხუთშაბათი", "პარასკევი", "შაბათი"] + }, + }, + value: '', + rtl: false, + + format: 'Y/m/d H:i', + formatTime: 'H:i', + formatDate: 'Y/m/d', + + startDate: false, // new Date(), '1986/12/08', '-1970/01/05','-1970/01/05', + step: 60, + monthChangeSpinner: true, + + closeOnDateSelect: false, + closeOnTimeSelect: true, + closeOnWithoutClick: true, + closeOnInputClick: true, + + timepicker: true, + datepicker: true, + weeks: false, + + defaultTime: false, // use formatTime format (ex. '10:00' for formatTime: 'H:i') + defaultDate: false, // use formatDate format (ex new Date() or '1986/12/08' or '-1970/01/05' or '-1970/01/05') + + minDate: false, + maxDate: false, + minTime: false, + maxTime: false, + disabledMinTime: false, + disabledMaxTime: false, + + allowTimes: [], + opened: false, + initTime: true, + inline: false, + theme: '', + + onSelectDate: function () {}, + onSelectTime: function () {}, + onChangeMonth: function () {}, + onGetWeekOfYear: function () {}, + onChangeYear: function () {}, + onChangeDateTime: function () {}, + onShow: function () {}, + onClose: function () {}, + onGenerate: function () {}, + + withoutCopyright: true, + inverseButton: false, + hours12: false, + next: 'xdsoft_next', + prev : 'xdsoft_prev', + dayOfWeekStart: 0, + parentID: 'body', + timeHeightInTimePicker: 25, + timepickerScrollbar: true, + todayButton: true, + prevButton: true, + nextButton: true, + defaultSelect: true, + + scrollMonth: true, + scrollTime: true, + scrollInput: true, + + lazyInit: false, + mask: false, + validateOnBlur: true, + allowBlank: true, + yearStart: 1950, + yearEnd: 2050, + monthStart: 0, + monthEnd: 11, + style: '', + id: '', + fixed: false, + roundTime: 'round', // ceil, floor + className: '', + weekends: [], + highlightedDates: [], + highlightedPeriods: [], + allowDates : [], + allowDateRe : null, + disabledDates : [], + disabledWeekDays: [], + yearOffset: 0, + beforeShowDay: null, + + enterLikeTab: true, + showApplyButton: false + }; + + var dateHelper = null, + globalLocaleDefault = 'en', + globalLocale = 'en'; + + var dateFormatterOptionsDefault = { + meridiem: ['AM', 'PM'] + }; + + var initDateFormatter = function(){ + var locale = default_options.i18n[globalLocale], + opts = { + days: locale.dayOfWeek, + daysShort: locale.dayOfWeekShort, + months: locale.months, + monthsShort: $.map(locale.months, function(n){ return n.substring(0, 3) }), + }; + + dateHelper = new DateFormatter({ + dateSettings: $.extend({}, dateFormatterOptionsDefault, opts) + }); + }; + + // for locale settings + $.datetimepicker = { + setLocale: function(locale){ + var newLocale = default_options.i18n[locale]?locale:globalLocaleDefault; + if(globalLocale != newLocale){ + globalLocale = newLocale; + // reinit date formatter + initDateFormatter(); + } + }, + setDateFormatter: function(dateFormatter) { + dateHelper = dateFormatter; + }, + RFC_2822: 'D, d M Y H:i:s O', + ATOM: 'Y-m-d\TH:i:sP', + ISO_8601: 'Y-m-d\TH:i:sO', + RFC_822: 'D, d M y H:i:s O', + RFC_850: 'l, d-M-y H:i:s T', + RFC_1036: 'D, d M y H:i:s O', + RFC_1123: 'D, d M Y H:i:s O', + RSS: 'D, d M Y H:i:s O', + W3C: 'Y-m-d\TH:i:sP' + }; + + // first init date formatter + initDateFormatter(); + + // fix for ie8 + if (!window.getComputedStyle) { + window.getComputedStyle = function (el, pseudo) { + this.el = el; + this.getPropertyValue = function (prop) { + var re = /(\-([a-z]){1})/g; + if (prop === 'float') { + prop = 'styleFloat'; + } + if (re.test(prop)) { + prop = prop.replace(re, function (a, b, c) { + return c.toUpperCase(); + }); + } + return el.currentStyle[prop] || null; + }; + return this; + }; + } + if (!Array.prototype.indexOf) { + Array.prototype.indexOf = function (obj, start) { + var i, j; + for (i = (start || 0), j = this.length; i < j; i += 1) { + if (this[i] === obj) { return i; } + } + return -1; + }; + } + Date.prototype.countDaysInMonth = function () { + return new Date(this.getFullYear(), this.getMonth() + 1, 0).getDate(); + }; + $.fn.xdsoftScroller = function (percent) { + return this.each(function () { + var timeboxparent = $(this), + pointerEventToXY = function (e) { + var out = {x: 0, y: 0}, + touch; + if (e.type === 'touchstart' || e.type === 'touchmove' || e.type === 'touchend' || e.type === 'touchcancel') { + touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0]; + out.x = touch.clientX; + out.y = touch.clientY; + } else if (e.type === 'mousedown' || e.type === 'mouseup' || e.type === 'mousemove' || e.type === 'mouseover' || e.type === 'mouseout' || e.type === 'mouseenter' || e.type === 'mouseleave') { + out.x = e.clientX; + out.y = e.clientY; + } + return out; + }, + timebox, + parentHeight, + height, + scrollbar, + scroller, + maximumOffset = 100, + start = false, + startY = 0, + startTop = 0, + h1 = 0, + touchStart = false, + startTopScroll = 0, + calcOffset = function () {}; + if (percent === 'hide') { + timeboxparent.find('.xdsoft_scrollbar').hide(); + return; + } + if (!$(this).hasClass('xdsoft_scroller_box')) { + timebox = timeboxparent.children().eq(0); + parentHeight = timeboxparent[0].clientHeight; + height = timebox[0].offsetHeight; + scrollbar = $('
    '); + scroller = $('
    '); + scrollbar.append(scroller); + + timeboxparent.addClass('xdsoft_scroller_box').append(scrollbar); + calcOffset = function calcOffset(event) { + var offset = pointerEventToXY(event).y - startY + startTopScroll; + if (offset < 0) { + offset = 0; + } + if (offset + scroller[0].offsetHeight > h1) { + offset = h1 - scroller[0].offsetHeight; + } + timeboxparent.trigger('scroll_element.xdsoft_scroller', [maximumOffset ? offset / maximumOffset : 0]); + }; + + scroller + .on('touchstart.xdsoft_scroller mousedown.xdsoft_scroller', function (event) { + if (!parentHeight) { + timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percent]); + } + + startY = pointerEventToXY(event).y; + startTopScroll = parseInt(scroller.css('margin-top'), 10); + h1 = scrollbar[0].offsetHeight; + + if (event.type === 'mousedown' || event.type === 'touchstart') { + if (document) { + $(document.body).addClass('xdsoft_noselect'); + } + $([document.body, window]).on('touchend mouseup.xdsoft_scroller', function arguments_callee() { + $([document.body, window]).off('touchend mouseup.xdsoft_scroller', arguments_callee) + .off('mousemove.xdsoft_scroller', calcOffset) + .removeClass('xdsoft_noselect'); + }); + $(document.body).on('mousemove.xdsoft_scroller', calcOffset); + } else { + touchStart = true; + event.stopPropagation(); + event.preventDefault(); + } + }) + .on('touchmove', function (event) { + if (touchStart) { + event.preventDefault(); + calcOffset(event); + } + }) + .on('touchend touchcancel', function () { + touchStart = false; + startTopScroll = 0; + }); + + timeboxparent + .on('scroll_element.xdsoft_scroller', function (event, percentage) { + if (!parentHeight) { + timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percentage, true]); + } + percentage = percentage > 1 ? 1 : (percentage < 0 || isNaN(percentage)) ? 0 : percentage; + + scroller.css('margin-top', maximumOffset * percentage); + + setTimeout(function () { + timebox.css('marginTop', -parseInt((timebox[0].offsetHeight - parentHeight) * percentage, 10)); + }, 10); + }) + .on('resize_scroll.xdsoft_scroller', function (event, percentage, noTriggerScroll) { + var percent, sh; + parentHeight = timeboxparent[0].clientHeight; + height = timebox[0].offsetHeight; + percent = parentHeight / height; + sh = percent * scrollbar[0].offsetHeight; + if (percent > 1) { + scroller.hide(); + } else { + scroller.show(); + scroller.css('height', parseInt(sh > 10 ? sh : 10, 10)); + maximumOffset = scrollbar[0].offsetHeight - scroller[0].offsetHeight; + if (noTriggerScroll !== true) { + timeboxparent.trigger('scroll_element.xdsoft_scroller', [percentage || Math.abs(parseInt(timebox.css('marginTop'), 10)) / (height - parentHeight)]); + } + } + }); + + timeboxparent.on('mousewheel', function (event) { + var top = Math.abs(parseInt(timebox.css('marginTop'), 10)); + + top = top - (event.deltaY * 20); + if (top < 0) { + top = 0; + } + + timeboxparent.trigger('scroll_element.xdsoft_scroller', [top / (height - parentHeight)]); + event.stopPropagation(); + return false; + }); + + timeboxparent.on('touchstart', function (event) { + start = pointerEventToXY(event); + startTop = Math.abs(parseInt(timebox.css('marginTop'), 10)); + }); + + timeboxparent.on('touchmove', function (event) { + if (start) { + event.preventDefault(); + var coord = pointerEventToXY(event); + timeboxparent.trigger('scroll_element.xdsoft_scroller', [(startTop - (coord.y - start.y)) / (height - parentHeight)]); + } + }); + + timeboxparent.on('touchend touchcancel', function () { + start = false; + startTop = 0; + }); + } + timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percent]); + }); + }; + + $.fn.datetimepicker = function (opt, opt2) { + var result = this, + KEY0 = 48, + KEY9 = 57, + _KEY0 = 96, + _KEY9 = 105, + CTRLKEY = 17, + DEL = 46, + ENTER = 13, + ESC = 27, + BACKSPACE = 8, + ARROWLEFT = 37, + ARROWUP = 38, + ARROWRIGHT = 39, + ARROWDOWN = 40, + TAB = 9, + F5 = 116, + AKEY = 65, + CKEY = 67, + VKEY = 86, + ZKEY = 90, + YKEY = 89, + ctrlDown = false, + options = ($.isPlainObject(opt) || !opt) ? $.extend(true, {}, default_options, opt) : $.extend(true, {}, default_options), + + lazyInitTimer = 0, + createDateTimePicker, + destroyDateTimePicker, + + lazyInit = function (input) { + input + .on('open.xdsoft focusin.xdsoft mousedown.xdsoft touchstart', function initOnActionCallback() { + if (input.is(':disabled') || input.data('xdsoft_datetimepicker')) { + return; + } + clearTimeout(lazyInitTimer); + lazyInitTimer = setTimeout(function () { + + if (!input.data('xdsoft_datetimepicker')) { + createDateTimePicker(input); + } + input + .off('open.xdsoft focusin.xdsoft mousedown.xdsoft touchstart', initOnActionCallback) + .trigger('open.xdsoft'); + }, 100); + }); + }; + + createDateTimePicker = function (input) { + var datetimepicker = $('
    '), + xdsoft_copyright = $(''), + datepicker = $('
    '), + month_picker = $('
    ' + + '
    ' + + '
    ' + + '
    '), + calendar = $('
    '), + timepicker = $('
    '), + timeboxparent = timepicker.find('.xdsoft_time_box').eq(0), + timebox = $('
    '), + applyButton = $(''), + + monthselect = $('
    '), + yearselect = $('
    '), + triggerAfterOpen = false, + XDSoft_datetime, + + xchangeTimer, + timerclick, + current_time_index, + setPos, + timer = 0, + _xdsoft_datetime, + forEachAncestorOf, + throttle; + + if (options.id) { + datetimepicker.attr('id', options.id); + } + if (options.style) { + datetimepicker.attr('style', options.style); + } + if (options.weeks) { + datetimepicker.addClass('xdsoft_showweeks'); + } + if (options.rtl) { + datetimepicker.addClass('xdsoft_rtl'); + } + + datetimepicker.addClass('xdsoft_' + options.theme); + datetimepicker.addClass(options.className); + + month_picker + .find('.xdsoft_month span') + .after(monthselect); + month_picker + .find('.xdsoft_year span') + .after(yearselect); + + month_picker + .find('.xdsoft_month,.xdsoft_year') + .on('touchstart mousedown.xdsoft', function (event) { + var select = $(this).find('.xdsoft_select').eq(0), + val = 0, + top = 0, + visible = select.is(':visible'), + items, + i; + + month_picker + .find('.xdsoft_select') + .hide(); + if (_xdsoft_datetime.currentTime) { + val = _xdsoft_datetime.currentTime[$(this).hasClass('xdsoft_month') ? 'getMonth' : 'getFullYear'](); + } + + select[visible ? 'hide' : 'show'](); + for (items = select.find('div.xdsoft_option'), i = 0; i < items.length; i += 1) { + if (items.eq(i).data('value') === val) { + break; + } else { + top += items[0].offsetHeight; + } + } + + select.xdsoftScroller(top / (select.children()[0].offsetHeight - (select[0].clientHeight))); + event.stopPropagation(); + return false; + }); + + month_picker + .find('.xdsoft_select') + .xdsoftScroller() + .on('touchstart mousedown.xdsoft', function (event) { + event.stopPropagation(); + event.preventDefault(); + }) + .on('touchstart mousedown.xdsoft', '.xdsoft_option', function () { + if (_xdsoft_datetime.currentTime === undefined || _xdsoft_datetime.currentTime === null) { + _xdsoft_datetime.currentTime = _xdsoft_datetime.now(); + } + + var year = _xdsoft_datetime.currentTime.getFullYear(); + if (_xdsoft_datetime && _xdsoft_datetime.currentTime) { + _xdsoft_datetime.currentTime[$(this).parent().parent().hasClass('xdsoft_monthselect') ? 'setMonth' : 'setFullYear']($(this).data('value')); + } + + $(this).parent().parent().hide(); + + datetimepicker.trigger('xchange.xdsoft'); + if (options.onChangeMonth && $.isFunction(options.onChangeMonth)) { + options.onChangeMonth.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input')); + } + + if (year !== _xdsoft_datetime.currentTime.getFullYear() && $.isFunction(options.onChangeYear)) { + options.onChangeYear.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input')); + } + }); + + datetimepicker.getValue = function () { + return _xdsoft_datetime.getCurrentTime(); + }; + + datetimepicker.setOptions = function (_options) { + var highlightedDates = {}; + + options = $.extend(true, {}, options, _options); + + if (_options.allowTimes && $.isArray(_options.allowTimes) && _options.allowTimes.length) { + options.allowTimes = $.extend(true, [], _options.allowTimes); + } + + if (_options.weekends && $.isArray(_options.weekends) && _options.weekends.length) { + options.weekends = $.extend(true, [], _options.weekends); + } + + if (_options.allowDates && $.isArray(_options.allowDates) && _options.allowDates.length) { + options.allowDates = $.extend(true, [], _options.allowDates); + } + + if (_options.allowDateRe && Object.prototype.toString.call(_options.allowDateRe)==="[object String]") { + options.allowDateRe = new RegExp(_options.allowDateRe); + } + + if (_options.highlightedDates && $.isArray(_options.highlightedDates) && _options.highlightedDates.length) { + $.each(_options.highlightedDates, function (index, value) { + var splitData = $.map(value.split(','), $.trim), + exDesc, + hDate = new HighlightedDate(dateHelper.parseDate(splitData[0], options.formatDate), splitData[1], splitData[2]), // date, desc, style + keyDate = dateHelper.formatDate(hDate.date, options.formatDate); + if (highlightedDates[keyDate] !== undefined) { + exDesc = highlightedDates[keyDate].desc; + if (exDesc && exDesc.length && hDate.desc && hDate.desc.length) { + highlightedDates[keyDate].desc = exDesc + "\n" + hDate.desc; + } + } else { + highlightedDates[keyDate] = hDate; + } + }); + + options.highlightedDates = $.extend(true, [], highlightedDates); + } + + if (_options.highlightedPeriods && $.isArray(_options.highlightedPeriods) && _options.highlightedPeriods.length) { + highlightedDates = $.extend(true, [], options.highlightedDates); + $.each(_options.highlightedPeriods, function (index, value) { + var dateTest, // start date + dateEnd, + desc, + hDate, + keyDate, + exDesc, + style; + if ($.isArray(value)) { + dateTest = value[0]; + dateEnd = value[1]; + desc = value[2]; + style = value[3]; + } + else { + var splitData = $.map(value.split(','), $.trim); + dateTest = dateHelper.parseDate(splitData[0], options.formatDate); + dateEnd = dateHelper.parseDate(splitData[1], options.formatDate); + desc = splitData[2]; + style = splitData[3]; + } + + while (dateTest <= dateEnd) { + hDate = new HighlightedDate(dateTest, desc, style); + keyDate = dateHelper.formatDate(dateTest, options.formatDate); + dateTest.setDate(dateTest.getDate() + 1); + if (highlightedDates[keyDate] !== undefined) { + exDesc = highlightedDates[keyDate].desc; + if (exDesc && exDesc.length && hDate.desc && hDate.desc.length) { + highlightedDates[keyDate].desc = exDesc + "\n" + hDate.desc; + } + } else { + highlightedDates[keyDate] = hDate; + } + } + }); + + options.highlightedDates = $.extend(true, [], highlightedDates); + } + + if (_options.disabledDates && $.isArray(_options.disabledDates) && _options.disabledDates.length) { + options.disabledDates = $.extend(true, [], _options.disabledDates); + } + + if (_options.disabledWeekDays && $.isArray(_options.disabledWeekDays) && _options.disabledWeekDays.length) { + options.disabledWeekDays = $.extend(true, [], _options.disabledWeekDays); + } + + if ((options.open || options.opened) && (!options.inline)) { + input.trigger('open.xdsoft'); + } + + if (options.inline) { + triggerAfterOpen = true; + datetimepicker.addClass('xdsoft_inline'); + input.after(datetimepicker).hide(); + } + + if (options.inverseButton) { + options.next = 'xdsoft_prev'; + options.prev = 'xdsoft_next'; + } + + if (options.datepicker) { + datepicker.addClass('active'); + } else { + datepicker.removeClass('active'); + } + + if (options.timepicker) { + timepicker.addClass('active'); + } else { + timepicker.removeClass('active'); + } + + if (options.value) { + _xdsoft_datetime.setCurrentTime(options.value); + if (input && input.val) { + input.val(_xdsoft_datetime.str); + } + } + + if (isNaN(options.dayOfWeekStart)) { + options.dayOfWeekStart = 0; + } else { + options.dayOfWeekStart = parseInt(options.dayOfWeekStart, 10) % 7; + } + + if (!options.timepickerScrollbar) { + timeboxparent.xdsoftScroller('hide'); + } + + if (options.minDate && /^[\+\-](.*)$/.test(options.minDate)) { + options.minDate = dateHelper.formatDate(_xdsoft_datetime.strToDateTime(options.minDate), options.formatDate); + } + + if (options.maxDate && /^[\+\-](.*)$/.test(options.maxDate)) { + options.maxDate = dateHelper.formatDate(_xdsoft_datetime.strToDateTime(options.maxDate), options.formatDate); + } + + applyButton.toggle(options.showApplyButton); + + month_picker + .find('.xdsoft_today_button') + .css('visibility', !options.todayButton ? 'hidden' : 'visible'); + + month_picker + .find('.' + options.prev) + .css('visibility', !options.prevButton ? 'hidden' : 'visible'); + + month_picker + .find('.' + options.next) + .css('visibility', !options.nextButton ? 'hidden' : 'visible'); + + setMask(options); + + if (options.validateOnBlur) { + input + .off('blur.xdsoft') + .on('blur.xdsoft', function () { + if (options.allowBlank && (!$.trim($(this).val()).length || (typeof options.mask == "string" && $.trim($(this).val()) === options.mask.replace(/[0-9]/g, '_')))) { + $(this).val(null); + datetimepicker.data('xdsoft_datetime').empty(); + } else { + var d = dateHelper.parseDate($(this).val(), options.format); + if (d) { // parseDate() may skip some invalid parts like date or time, so make it clear for user: show parsed date/time + $(this).val(dateHelper.formatDate(d, options.format)); + } else { + var splittedHours = +([$(this).val()[0], $(this).val()[1]].join('')), + splittedMinutes = +([$(this).val()[2], $(this).val()[3]].join('')); + + // parse the numbers as 0312 => 03:12 + if (!options.datepicker && options.timepicker && splittedHours >= 0 && splittedHours < 24 && splittedMinutes >= 0 && splittedMinutes < 60) { + $(this).val([splittedHours, splittedMinutes].map(function (item) { + return item > 9 ? item : '0' + item; + }).join(':')); + } else { + $(this).val(dateHelper.formatDate(_xdsoft_datetime.now(), options.format)); + } + } + datetimepicker.data('xdsoft_datetime').setCurrentTime($(this).val()); + } + + datetimepicker.trigger('changedatetime.xdsoft'); + datetimepicker.trigger('close.xdsoft'); + }); + } + options.dayOfWeekStartPrev = (options.dayOfWeekStart === 0) ? 6 : options.dayOfWeekStart - 1; + + datetimepicker + .trigger('xchange.xdsoft') + .trigger('afterOpen.xdsoft'); + }; + + datetimepicker + .data('options', options) + .on('touchstart mousedown.xdsoft', function (event) { + event.stopPropagation(); + event.preventDefault(); + yearselect.hide(); + monthselect.hide(); + return false; + }); + + //scroll_element = timepicker.find('.xdsoft_time_box'); + timeboxparent.append(timebox); + timeboxparent.xdsoftScroller(); + + datetimepicker.on('afterOpen.xdsoft', function () { + timeboxparent.xdsoftScroller(); + }); + + datetimepicker + .append(datepicker) + .append(timepicker); + + if (options.withoutCopyright !== true) { + datetimepicker + .append(xdsoft_copyright); + } + + datepicker + .append(month_picker) + .append(calendar) + .append(applyButton); + + $(options.parentID) + .append(datetimepicker); + + XDSoft_datetime = function () { + var _this = this; + _this.now = function (norecursion) { + var d = new Date(), + date, + time; + + if (!norecursion && options.defaultDate) { + date = _this.strToDateTime(options.defaultDate); + d.setFullYear(date.getFullYear()); + d.setMonth(date.getMonth()); + d.setDate(date.getDate()); + } + + if (options.yearOffset) { + d.setFullYear(d.getFullYear() + options.yearOffset); + } + + if (!norecursion && options.defaultTime) { + time = _this.strtotime(options.defaultTime); + d.setHours(time.getHours()); + d.setMinutes(time.getMinutes()); + } + return d; + }; + + _this.isValidDate = function (d) { + if (Object.prototype.toString.call(d) !== "[object Date]") { + return false; + } + return !isNaN(d.getTime()); + }; + + _this.setCurrentTime = function (dTime, requireValidDate) { + if (typeof dTime === 'string') { + _this.currentTime = _this.strToDateTime(dTime); + } + else if (_this.isValidDate(dTime)) { + _this.currentTime = dTime; + } + else if (!dTime && !requireValidDate && options.allowBlank) { + _this.currentTime = null; + } + else { + _this.currentTime = _this.now(); + } + + datetimepicker.trigger('xchange.xdsoft'); + }; + + _this.empty = function () { + _this.currentTime = null; + }; + + _this.getCurrentTime = function (dTime) { + return _this.currentTime; + }; + + _this.nextMonth = function () { + + if (_this.currentTime === undefined || _this.currentTime === null) { + _this.currentTime = _this.now(); + } + + var month = _this.currentTime.getMonth() + 1, + year; + if (month === 12) { + _this.currentTime.setFullYear(_this.currentTime.getFullYear() + 1); + month = 0; + } + + year = _this.currentTime.getFullYear(); + + _this.currentTime.setDate( + Math.min( + new Date(_this.currentTime.getFullYear(), month + 1, 0).getDate(), + _this.currentTime.getDate() + ) + ); + _this.currentTime.setMonth(month); + + if (options.onChangeMonth && $.isFunction(options.onChangeMonth)) { + options.onChangeMonth.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input')); + } + + if (year !== _this.currentTime.getFullYear() && $.isFunction(options.onChangeYear)) { + options.onChangeYear.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input')); + } + + datetimepicker.trigger('xchange.xdsoft'); + return month; + }; + + _this.prevMonth = function () { + + if (_this.currentTime === undefined || _this.currentTime === null) { + _this.currentTime = _this.now(); + } + + var month = _this.currentTime.getMonth() - 1; + if (month === -1) { + _this.currentTime.setFullYear(_this.currentTime.getFullYear() - 1); + month = 11; + } + _this.currentTime.setDate( + Math.min( + new Date(_this.currentTime.getFullYear(), month + 1, 0).getDate(), + _this.currentTime.getDate() + ) + ); + _this.currentTime.setMonth(month); + if (options.onChangeMonth && $.isFunction(options.onChangeMonth)) { + options.onChangeMonth.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input')); + } + datetimepicker.trigger('xchange.xdsoft'); + return month; + }; + + _this.getWeekOfYear = function (datetime) { + if (options.onGetWeekOfYear && $.isFunction(options.onGetWeekOfYear)) { + var week = options.onGetWeekOfYear.call(datetimepicker, datetime); + if (typeof week !== 'undefined') { + return week; + } + } + var onejan = new Date(datetime.getFullYear(), 0, 1); + //First week of the year is th one with the first Thursday according to ISO8601 + if(onejan.getDay()!=4) + onejan.setMonth(0, 1 + ((4 - onejan.getDay()+ 7) % 7)); + return Math.ceil((((datetime - onejan) / 86400000) + onejan.getDay() + 1) / 7); + }; + + _this.strToDateTime = function (sDateTime) { + var tmpDate = [], timeOffset, currentTime; + + if (sDateTime && sDateTime instanceof Date && _this.isValidDate(sDateTime)) { + return sDateTime; + } + + tmpDate = /^(\+|\-)(.*)$/.exec(sDateTime); + if (tmpDate) { + tmpDate[2] = dateHelper.parseDate(tmpDate[2], options.formatDate); + } + if (tmpDate && tmpDate[2]) { + timeOffset = tmpDate[2].getTime() - (tmpDate[2].getTimezoneOffset()) * 60000; + currentTime = new Date((_this.now(true)).getTime() + parseInt(tmpDate[1] + '1', 10) * timeOffset); + } else { + currentTime = sDateTime ? dateHelper.parseDate(sDateTime, options.format) : _this.now(); + } + + if (!_this.isValidDate(currentTime)) { + currentTime = _this.now(); + } + + return currentTime; + }; + + _this.strToDate = function (sDate) { + if (sDate && sDate instanceof Date && _this.isValidDate(sDate)) { + return sDate; + } + + var currentTime = sDate ? dateHelper.parseDate(sDate, options.formatDate) : _this.now(true); + if (!_this.isValidDate(currentTime)) { + currentTime = _this.now(true); + } + return currentTime; + }; + + _this.strtotime = function (sTime) { + if (sTime && sTime instanceof Date && _this.isValidDate(sTime)) { + return sTime; + } + var currentTime = sTime ? dateHelper.parseDate(sTime, options.formatTime) : _this.now(true); + if (!_this.isValidDate(currentTime)) { + currentTime = _this.now(true); + } + return currentTime; + }; + + _this.str = function () { + return dateHelper.formatDate(_this.currentTime, options.format); + }; + _this.currentTime = this.now(); + }; + + _xdsoft_datetime = new XDSoft_datetime(); + + applyButton.on('touchend click', function (e) {//pathbrite + e.preventDefault(); + datetimepicker.data('changed', true); + _xdsoft_datetime.setCurrentTime(getCurrentValue()); + input.val(_xdsoft_datetime.str()); + datetimepicker.trigger('close.xdsoft'); + }); + month_picker + .find('.xdsoft_today_button') + .on('touchend mousedown.xdsoft', function () { + datetimepicker.data('changed', true); + _xdsoft_datetime.setCurrentTime(0, true); + datetimepicker.trigger('afterOpen.xdsoft'); + }).on('dblclick.xdsoft', function () { + var currentDate = _xdsoft_datetime.getCurrentTime(), minDate, maxDate; + currentDate = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate()); + minDate = _xdsoft_datetime.strToDate(options.minDate); + minDate = new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate()); + if (currentDate < minDate) { + return; + } + maxDate = _xdsoft_datetime.strToDate(options.maxDate); + maxDate = new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate()); + if (currentDate > maxDate) { + return; + } + input.val(_xdsoft_datetime.str()); + input.trigger('change'); + datetimepicker.trigger('close.xdsoft'); + }); + month_picker + .find('.xdsoft_prev,.xdsoft_next') + .on('touchend mousedown.xdsoft', function () { + var $this = $(this), + timer = 0, + stop = false; + + (function arguments_callee1(v) { + if ($this.hasClass(options.next)) { + _xdsoft_datetime.nextMonth(); + } else if ($this.hasClass(options.prev)) { + _xdsoft_datetime.prevMonth(); + } + if (options.monthChangeSpinner) { + if (!stop) { + timer = setTimeout(arguments_callee1, v || 100); + } + } + }(500)); + + $([document.body, window]).on('touchend mouseup.xdsoft', function arguments_callee2() { + clearTimeout(timer); + stop = true; + $([document.body, window]).off('touchend mouseup.xdsoft', arguments_callee2); + }); + }); + + timepicker + .find('.xdsoft_prev,.xdsoft_next') + .on('touchend mousedown.xdsoft', function () { + var $this = $(this), + timer = 0, + stop = false, + period = 110; + (function arguments_callee4(v) { + var pheight = timeboxparent[0].clientHeight, + height = timebox[0].offsetHeight, + top = Math.abs(parseInt(timebox.css('marginTop'), 10)); + if ($this.hasClass(options.next) && (height - pheight) - options.timeHeightInTimePicker >= top) { + timebox.css('marginTop', '-' + (top + options.timeHeightInTimePicker) + 'px'); + } else if ($this.hasClass(options.prev) && top - options.timeHeightInTimePicker >= 0) { + timebox.css('marginTop', '-' + (top - options.timeHeightInTimePicker) + 'px'); + } /** * Fixed bug: * When using css3 transition, it will cause a bug that you cannot scroll the timepicker list. @@ -2100,874 +2100,874 @@ var DateFormatter; * Replace timebox.css('marginTop') with timebox[0].style.marginTop. */ timeboxparent.trigger('scroll_element.xdsoft_scroller', [Math.abs(parseInt(timebox[0].style.marginTop, 10) / (height - pheight))]); - period = (period > 10) ? 10 : period - 10; - if (!stop) { - timer = setTimeout(arguments_callee4, v || period); - } - }(500)); - $([document.body, window]).on('touchend mouseup.xdsoft', function arguments_callee5() { - clearTimeout(timer); - stop = true; - $([document.body, window]) - .off('touchend mouseup.xdsoft', arguments_callee5); - }); - }); - - xchangeTimer = 0; - // base handler - generating a calendar and timepicker - datetimepicker - .on('xchange.xdsoft', function (event) { - clearTimeout(xchangeTimer); - xchangeTimer = setTimeout(function () { - - if (_xdsoft_datetime.currentTime === undefined || _xdsoft_datetime.currentTime === null) { - //In case blanks are allowed, delay construction until we have a valid date - if (options.allowBlank) - return; - - _xdsoft_datetime.currentTime = _xdsoft_datetime.now(); - } - - var table = '', - start = new Date(_xdsoft_datetime.currentTime.getFullYear(), _xdsoft_datetime.currentTime.getMonth(), 1, 12, 0, 0), - i = 0, - j, - today = _xdsoft_datetime.now(), - maxDate = false, - minDate = false, - hDate, - day, - d, - y, - m, - w, - classes = [], - customDateSettings, - newRow = true, - time = '', - h = '', - line_time, - description; - - while (start.getDay() !== options.dayOfWeekStart) { - start.setDate(start.getDate() - 1); - } - - table += ''; - - if (options.weeks) { - table += ''; - } - - for (j = 0; j < 7; j += 1) { - table += ''; - } - - table += ''; - table += ''; - - if (options.maxDate !== false) { - maxDate = _xdsoft_datetime.strToDate(options.maxDate); - maxDate = new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate(), 23, 59, 59, 999); - } - - if (options.minDate !== false) { - minDate = _xdsoft_datetime.strToDate(options.minDate); - minDate = new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate()); - } - - while (i < _xdsoft_datetime.currentTime.countDaysInMonth() || start.getDay() !== options.dayOfWeekStart || _xdsoft_datetime.currentTime.getMonth() === start.getMonth()) { - classes = []; - i += 1; - - day = start.getDay(); - d = start.getDate(); - y = start.getFullYear(); - m = start.getMonth(); - w = _xdsoft_datetime.getWeekOfYear(start); - description = ''; - - classes.push('xdsoft_date'); - - if (options.beforeShowDay && $.isFunction(options.beforeShowDay.call)) { - customDateSettings = options.beforeShowDay.call(datetimepicker, start); - } else { - customDateSettings = null; - } - - if(options.allowDateRe && Object.prototype.toString.call(options.allowDateRe) === "[object RegExp]"){ - if(!options.allowDateRe.test(dateHelper.formatDate(start, options.formatDate))){ - classes.push('xdsoft_disabled'); - } - } else if(options.allowDates && options.allowDates.length>0){ - if(options.allowDates.indexOf(dateHelper.formatDate(start, options.formatDate)) === -1){ - classes.push('xdsoft_disabled'); - } - } else if ((maxDate !== false && start > maxDate) || (minDate !== false && start < minDate) || (customDateSettings && customDateSettings[0] === false)) { - classes.push('xdsoft_disabled'); - } else if (options.disabledDates.indexOf(dateHelper.formatDate(start, options.formatDate)) !== -1) { - classes.push('xdsoft_disabled'); - } else if (options.disabledWeekDays.indexOf(day) !== -1) { - classes.push('xdsoft_disabled'); - }else if (input.is('[readonly]')) { - classes.push('xdsoft_disabled'); - } - - if (customDateSettings && customDateSettings[1] !== "") { - classes.push(customDateSettings[1]); - } - - if (_xdsoft_datetime.currentTime.getMonth() !== m) { - classes.push('xdsoft_other_month'); - } - - if ((options.defaultSelect || datetimepicker.data('changed')) && dateHelper.formatDate(_xdsoft_datetime.currentTime, options.formatDate) === dateHelper.formatDate(start, options.formatDate)) { - classes.push('xdsoft_current'); - } - - if (dateHelper.formatDate(today, options.formatDate) === dateHelper.formatDate(start, options.formatDate)) { - classes.push('xdsoft_today'); - } - - if (start.getDay() === 0 || start.getDay() === 6 || options.weekends.indexOf(dateHelper.formatDate(start, options.formatDate)) !== -1) { - classes.push('xdsoft_weekend'); - } - - if (options.highlightedDates[dateHelper.formatDate(start, options.formatDate)] !== undefined) { - hDate = options.highlightedDates[dateHelper.formatDate(start, options.formatDate)]; - classes.push(hDate.style === undefined ? 'xdsoft_highlighted_default' : hDate.style); - description = hDate.desc === undefined ? '' : hDate.desc; - } - - if (options.beforeShowDay && $.isFunction(options.beforeShowDay)) { - classes.push(options.beforeShowDay(start)); - } - - if (newRow) { - table += ''; - newRow = false; - if (options.weeks) { - table += ''; - } - } - - table += ''; - - if (start.getDay() === options.dayOfWeekStartPrev) { - table += ''; - newRow = true; - } - - start.setDate(d + 1); - } - table += '
    ' + options.i18n[globalLocale].dayOfWeekShort[(j + options.dayOfWeekStart) % 7] + '
    ' + w + '' + - '
    ' + d + '
    ' + - '
    '; - - calendar.html(table); - - month_picker.find('.xdsoft_label span').eq(0).text(options.i18n[globalLocale].months[_xdsoft_datetime.currentTime.getMonth()]); - month_picker.find('.xdsoft_label span').eq(1).text(_xdsoft_datetime.currentTime.getFullYear()); - - // generate timebox - time = ''; - h = ''; - m = ''; - - line_time = function line_time(h, m) { - var now = _xdsoft_datetime.now(), optionDateTime, current_time, - isALlowTimesInit = options.allowTimes && $.isArray(options.allowTimes) && options.allowTimes.length; - now.setHours(h); - h = parseInt(now.getHours(), 10); - now.setMinutes(m); - m = parseInt(now.getMinutes(), 10); - optionDateTime = new Date(_xdsoft_datetime.currentTime); - optionDateTime.setHours(h); - optionDateTime.setMinutes(m); - classes = []; - if ((options.minDateTime !== false && options.minDateTime > optionDateTime) || (options.maxTime !== false && _xdsoft_datetime.strtotime(options.maxTime).getTime() < now.getTime()) || (options.minTime !== false && _xdsoft_datetime.strtotime(options.minTime).getTime() > now.getTime())) { - classes.push('xdsoft_disabled'); - } else if ((options.minDateTime !== false && options.minDateTime > optionDateTime) || ((options.disabledMinTime !== false && now.getTime() > _xdsoft_datetime.strtotime(options.disabledMinTime).getTime()) && (options.disabledMaxTime !== false && now.getTime() < _xdsoft_datetime.strtotime(options.disabledMaxTime).getTime()))) { - classes.push('xdsoft_disabled'); - } else if (input.is('[readonly]')) { - classes.push('xdsoft_disabled'); - } - - current_time = new Date(_xdsoft_datetime.currentTime); - current_time.setHours(parseInt(_xdsoft_datetime.currentTime.getHours(), 10)); - - if (!isALlowTimesInit) { - current_time.setMinutes(Math[options.roundTime](_xdsoft_datetime.currentTime.getMinutes() / options.step) * options.step); - } - - if ((options.initTime || options.defaultSelect || datetimepicker.data('changed')) && current_time.getHours() === parseInt(h, 10) && ((!isALlowTimesInit && options.step > 59) || current_time.getMinutes() === parseInt(m, 10))) { - if (options.defaultSelect || datetimepicker.data('changed')) { - classes.push('xdsoft_current'); - } else if (options.initTime) { - classes.push('xdsoft_init_time'); - } - } - if (parseInt(today.getHours(), 10) === parseInt(h, 10) && parseInt(today.getMinutes(), 10) === parseInt(m, 10)) { - classes.push('xdsoft_today'); - } - time += '
    ' + dateHelper.formatDate(now, options.formatTime) + '
    '; - }; - - if (!options.allowTimes || !$.isArray(options.allowTimes) || !options.allowTimes.length) { - for (i = 0, j = 0; i < (options.hours12 ? 12 : 24); i += 1) { - for (j = 0; j < 60; j += options.step) { - h = (i < 10 ? '0' : '') + i; - m = (j < 10 ? '0' : '') + j; - line_time(h, m); - } - } - } else { - for (i = 0; i < options.allowTimes.length; i += 1) { - h = _xdsoft_datetime.strtotime(options.allowTimes[i]).getHours(); - m = _xdsoft_datetime.strtotime(options.allowTimes[i]).getMinutes(); - line_time(h, m); - } - } - - timebox.html(time); - - opt = ''; - i = 0; - - for (i = parseInt(options.yearStart, 10) + options.yearOffset; i <= parseInt(options.yearEnd, 10) + options.yearOffset; i += 1) { - opt += '
    ' + i + '
    '; - } - yearselect.children().eq(0) - .html(opt); - - for (i = parseInt(options.monthStart, 10), opt = ''; i <= parseInt(options.monthEnd, 10); i += 1) { - opt += '
    ' + options.i18n[globalLocale].months[i] + '
    '; - } - monthselect.children().eq(0).html(opt); - $(datetimepicker) - .trigger('generate.xdsoft'); - }, 10); - event.stopPropagation(); - }) - .on('afterOpen.xdsoft', function () { - if (options.timepicker) { - var classType, pheight, height, top; - if (timebox.find('.xdsoft_current').length) { - classType = '.xdsoft_current'; - } else if (timebox.find('.xdsoft_init_time').length) { - classType = '.xdsoft_init_time'; - } - if (classType) { - pheight = timeboxparent[0].clientHeight; - height = timebox[0].offsetHeight; - top = timebox.find(classType).index() * options.timeHeightInTimePicker + 1; - if ((height - pheight) < top) { - top = height - pheight; - } - timeboxparent.trigger('scroll_element.xdsoft_scroller', [parseInt(top, 10) / (height - pheight)]); - } else { - timeboxparent.trigger('scroll_element.xdsoft_scroller', [0]); - } - } - }); - - timerclick = 0; - calendar - .on('touchend click.xdsoft', 'td', function (xdevent) { - xdevent.stopPropagation(); // Prevents closing of Pop-ups, Modals and Flyouts in Bootstrap - timerclick += 1; - var $this = $(this), - currentTime = _xdsoft_datetime.currentTime; - - if (currentTime === undefined || currentTime === null) { - _xdsoft_datetime.currentTime = _xdsoft_datetime.now(); - currentTime = _xdsoft_datetime.currentTime; - } - - if ($this.hasClass('xdsoft_disabled')) { - return false; - } - - currentTime.setDate(1); - currentTime.setFullYear($this.data('year')); - currentTime.setMonth($this.data('month')); - currentTime.setDate($this.data('date')); - - datetimepicker.trigger('select.xdsoft', [currentTime]); - - input.val(_xdsoft_datetime.str()); - - if (options.onSelectDate && $.isFunction(options.onSelectDate)) { - options.onSelectDate.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), xdevent); - } - - datetimepicker.data('changed', true); - datetimepicker.trigger('xchange.xdsoft'); - datetimepicker.trigger('changedatetime.xdsoft'); - if ((timerclick > 1 || (options.closeOnDateSelect === true || (options.closeOnDateSelect === false && !options.timepicker))) && !options.inline) { - datetimepicker.trigger('close.xdsoft'); - } - setTimeout(function () { - timerclick = 0; - }, 200); - }); - - timebox - .on('touchmove', 'div', function () { currentlyScrollingTimeDiv = true; }) - .on('touchend click.xdsoft', 'div', function (xdevent) { - xdevent.stopPropagation(); - if (currentlyScrollingTimeDiv) { - currentlyScrollingTimeDiv = false; - return; - } - var $this = $(this), - currentTime = _xdsoft_datetime.currentTime; - - if (currentTime === undefined || currentTime === null) { - _xdsoft_datetime.currentTime = _xdsoft_datetime.now(); - currentTime = _xdsoft_datetime.currentTime; - } - - if ($this.hasClass('xdsoft_disabled')) { - return false; - } - currentTime.setHours($this.data('hour')); - currentTime.setMinutes($this.data('minute')); - datetimepicker.trigger('select.xdsoft', [currentTime]); - - datetimepicker.data('input').val(_xdsoft_datetime.str()); - - if (options.onSelectTime && $.isFunction(options.onSelectTime)) { - options.onSelectTime.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), xdevent); - } - datetimepicker.data('changed', true); - datetimepicker.trigger('xchange.xdsoft'); - datetimepicker.trigger('changedatetime.xdsoft'); - if (options.inline !== true && options.closeOnTimeSelect === true) { - datetimepicker.trigger('close.xdsoft'); - } - }); - - datepicker - .on('mousewheel.xdsoft', function (event) { - if (!options.scrollMonth) { - return true; - } - if (event.deltaY < 0) { - _xdsoft_datetime.nextMonth(); - } else { - _xdsoft_datetime.prevMonth(); - } - return false; - }); - - input - .on('mousewheel.xdsoft', function (event) { - if (!options.scrollInput) { - return true; - } - if (!options.datepicker && options.timepicker) { - current_time_index = timebox.find('.xdsoft_current').length ? timebox.find('.xdsoft_current').eq(0).index() : 0; - if (current_time_index + event.deltaY >= 0 && current_time_index + event.deltaY < timebox.children().length) { - current_time_index += event.deltaY; - } - if (timebox.children().eq(current_time_index).length) { - timebox.children().eq(current_time_index).trigger('mousedown'); - } - return false; - } - if (options.datepicker && !options.timepicker) { - datepicker.trigger(event, [event.deltaY, event.deltaX, event.deltaY]); - if (input.val) { - input.val(_xdsoft_datetime.str()); - } - datetimepicker.trigger('changedatetime.xdsoft'); - return false; - } - }); - - datetimepicker - .on('changedatetime.xdsoft', function (event) { - if (options.onChangeDateTime && $.isFunction(options.onChangeDateTime)) { - var $input = datetimepicker.data('input'); - options.onChangeDateTime.call(datetimepicker, _xdsoft_datetime.currentTime, $input, event); - delete options.value; - $input.trigger('change'); - } - }) - .on('generate.xdsoft', function () { - if (options.onGenerate && $.isFunction(options.onGenerate)) { - options.onGenerate.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input')); - } - if (triggerAfterOpen) { - datetimepicker.trigger('afterOpen.xdsoft'); - triggerAfterOpen = false; - } - }) - .on('click.xdsoft', function (xdevent) { - xdevent.stopPropagation(); - }); - - current_time_index = 0; - - /** - * Runs the callback for each of the specified node's ancestors. - * - * Return FALSE from the callback to stop ascending. - * - * @param {DOMNode} node - * @param {Function} callback - * @returns {undefined} - */ - forEachAncestorOf = function (node, callback) { - do { - node = node.parentNode; - - if (callback(node) === false) { - break; - } - } while (node.nodeName !== 'HTML'); - }; - - /** - * Sets the position of the picker. - * - * @returns {undefined} - */ - setPos = function () { - var dateInputOffset, - dateInputElem, - verticalPosition, - left, - position, - datetimepickerElem, - dateInputHasFixedAncestor, - $dateInput, - windowWidth, - verticalAnchorEdge, - datetimepickerCss, - windowHeight, - windowScrollTop; - - $dateInput = datetimepicker.data('input'); - dateInputOffset = $dateInput.offset(); - dateInputElem = $dateInput[0]; - - verticalAnchorEdge = 'top'; - verticalPosition = (dateInputOffset.top + dateInputElem.offsetHeight) - 1; - left = dateInputOffset.left; - position = "absolute"; - - windowWidth = $(window).width(); - windowHeight = $(window).height(); - windowScrollTop = $(window).scrollTop(); - - if ((document.documentElement.clientWidth - dateInputOffset.left) < datepicker.parent().outerWidth(true)) { - var diff = datepicker.parent().outerWidth(true) - dateInputElem.offsetWidth; - left = left - diff; - } - - if ($dateInput.parent().css('direction') === 'rtl') { - left -= (datetimepicker.outerWidth() - $dateInput.outerWidth()); - } - - if (options.fixed) { - verticalPosition -= windowScrollTop; - left -= $(window).scrollLeft(); - position = "fixed"; - } else { - dateInputHasFixedAncestor = false; - - forEachAncestorOf(dateInputElem, function (ancestorNode) { - if (window.getComputedStyle(ancestorNode).getPropertyValue('position') === 'fixed') { - dateInputHasFixedAncestor = true; - return false; - } - }); - - if (dateInputHasFixedAncestor) { - position = 'fixed'; - - //If the picker won't fit entirely within the viewport then display it above the date input. - if (verticalPosition + datetimepicker.outerHeight() > windowHeight + windowScrollTop) { - verticalAnchorEdge = 'bottom'; - verticalPosition = (windowHeight + windowScrollTop) - dateInputOffset.top; - } else { - verticalPosition -= windowScrollTop; - } - } else { - if (verticalPosition + dateInputElem.offsetHeight > windowHeight + windowScrollTop) { - verticalPosition = dateInputOffset.top - dateInputElem.offsetHeight + 1; - } - } - - if (verticalPosition < 0) { - verticalPosition = 0; - } - - if (left + dateInputElem.offsetWidth > windowWidth) { - left = windowWidth - dateInputElem.offsetWidth; - } - } - - datetimepickerElem = datetimepicker[0]; - - forEachAncestorOf(datetimepickerElem, function (ancestorNode) { - var ancestorNodePosition; - - ancestorNodePosition = window.getComputedStyle(ancestorNode).getPropertyValue('position'); - - if (ancestorNodePosition === 'relative' && windowWidth >= ancestorNode.offsetWidth) { - left = left - ((windowWidth - ancestorNode.offsetWidth) / 2); - return false; - } - }); - - datetimepickerCss = { - position: position, - left: left, - top: '', //Initialize to prevent previous values interfering with new ones. - bottom: '' //Initialize to prevent previous values interfering with new ones. - }; - - datetimepickerCss[verticalAnchorEdge] = verticalPosition; - - datetimepicker.css(datetimepickerCss); - }; - - datetimepicker - .on('open.xdsoft', function (event) { - var onShow = true; - if (options.onShow && $.isFunction(options.onShow)) { - onShow = options.onShow.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), event); - } - if (onShow !== false) { - datetimepicker.show(); - setPos(); - $(window) - .off('resize.xdsoft', setPos) - .on('resize.xdsoft', setPos); - - if (options.closeOnWithoutClick) { - $([document.body, window]).on('touchstart mousedown.xdsoft', function arguments_callee6() { - datetimepicker.trigger('close.xdsoft'); - $([document.body, window]).off('touchstart mousedown.xdsoft', arguments_callee6); - }); - } - } - }) - .on('close.xdsoft', function (event) { - var onClose = true; - month_picker - .find('.xdsoft_month,.xdsoft_year') - .find('.xdsoft_select') - .hide(); - if (options.onClose && $.isFunction(options.onClose)) { - onClose = options.onClose.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), event); - } - if (onClose !== false && !options.opened && !options.inline) { - datetimepicker.hide(); - } - event.stopPropagation(); - }) - .on('toggle.xdsoft', function () { - if (datetimepicker.is(':visible')) { - datetimepicker.trigger('close.xdsoft'); - } else { - datetimepicker.trigger('open.xdsoft'); - } - }) - .data('input', input); - - timer = 0; - - datetimepicker.data('xdsoft_datetime', _xdsoft_datetime); - datetimepicker.setOptions(options); - - function getCurrentValue() { - var ct = false, time; - - if (options.startDate) { - ct = _xdsoft_datetime.strToDate(options.startDate); - } else { - ct = options.value || ((input && input.val && input.val()) ? input.val() : ''); - if (ct) { - ct = _xdsoft_datetime.strToDateTime(ct); - } else if (options.defaultDate) { - ct = _xdsoft_datetime.strToDateTime(options.defaultDate); - if (options.defaultTime) { - time = _xdsoft_datetime.strtotime(options.defaultTime); - ct.setHours(time.getHours()); - ct.setMinutes(time.getMinutes()); - } - } - } - - if (ct && _xdsoft_datetime.isValidDate(ct)) { - datetimepicker.data('changed', true); - } else { - ct = ''; - } - - return ct || 0; - } - - function setMask(options) { - - var isValidValue = function (mask, value) { - var reg = mask - .replace(/([\[\]\/\{\}\(\)\-\.\+]{1})/g, '\\$1') - .replace(/_/g, '{digit+}') - .replace(/([0-9]{1})/g, '{digit$1}') - .replace(/\{digit([0-9]{1})\}/g, '[0-$1_]{1}') - .replace(/\{digit[\+]\}/g, '[0-9_]{1}'); - return (new RegExp(reg)).test(value); - }, - getCaretPos = function (input) { - try { - if (document.selection && document.selection.createRange) { - var range = document.selection.createRange(); - return range.getBookmark().charCodeAt(2) - 2; - } - if (input.setSelectionRange) { - return input.selectionStart; - } - } catch (e) { - return 0; - } - }, - setCaretPos = function (node, pos) { - node = (typeof node === "string" || node instanceof String) ? document.getElementById(node) : node; - if (!node) { - return false; - } - if (node.createTextRange) { - var textRange = node.createTextRange(); - textRange.collapse(true); - textRange.moveEnd('character', pos); - textRange.moveStart('character', pos); - textRange.select(); - return true; - } - if (node.setSelectionRange) { - node.setSelectionRange(pos, pos); - return true; - } - return false; - }; - if(options.mask) { - input.off('keydown.xdsoft'); - } - if (options.mask === true) { - if (typeof moment != 'undefined') { - options.mask = options.format - .replace(/Y{4}/g, '9999') - .replace(/Y{2}/g, '99') - .replace(/M{2}/g, '19') - .replace(/D{2}/g, '39') - .replace(/H{2}/g, '29') - .replace(/m{2}/g, '59') - .replace(/s{2}/g, '59'); - } else { - options.mask = options.format - .replace(/Y/g, '9999') - .replace(/F/g, '9999') - .replace(/m/g, '19') - .replace(/d/g, '39') - .replace(/H/g, '29') - .replace(/i/g, '59') - .replace(/s/g, '59'); - } - } - - if ($.type(options.mask) === 'string') { - if (!isValidValue(options.mask, input.val())) { - input.val(options.mask.replace(/[0-9]/g, '_')); - setCaretPos(input[0], 0); - } - - input.on('keydown.xdsoft', function (event) { - var val = this.value, - key = event.which, - pos, - digit; - - if (((key >= KEY0 && key <= KEY9) || (key >= _KEY0 && key <= _KEY9)) || (key === BACKSPACE || key === DEL)) { - pos = getCaretPos(this); - digit = (key !== BACKSPACE && key !== DEL) ? String.fromCharCode((_KEY0 <= key && key <= _KEY9) ? key - KEY0 : key) : '_'; - - if ((key === BACKSPACE || key === DEL) && pos) { - pos -= 1; - digit = '_'; - } - - while (/[^0-9_]/.test(options.mask.substr(pos, 1)) && pos < options.mask.length && pos > 0) { - pos += (key === BACKSPACE || key === DEL) ? -1 : 1; - } - - val = val.substr(0, pos) + digit + val.substr(pos + 1); - if ($.trim(val) === '') { - val = options.mask.replace(/[0-9]/g, '_'); - } else { - if (pos === options.mask.length) { - event.preventDefault(); - return false; - } - } - - pos += (key === BACKSPACE || key === DEL) ? 0 : 1; - while (/[^0-9_]/.test(options.mask.substr(pos, 1)) && pos < options.mask.length && pos > 0) { - pos += (key === BACKSPACE || key === DEL) ? -1 : 1; - } - - if (isValidValue(options.mask, val)) { - this.value = val; - setCaretPos(this, pos); - } else if ($.trim(val) === '') { - this.value = options.mask.replace(/[0-9]/g, '_'); - } else { - input.trigger('error_input.xdsoft'); - } - } else { - if (([AKEY, CKEY, VKEY, ZKEY, YKEY].indexOf(key) !== -1 && ctrlDown) || [ESC, ARROWUP, ARROWDOWN, ARROWLEFT, ARROWRIGHT, F5, CTRLKEY, TAB, ENTER].indexOf(key) !== -1) { - return true; - } - } - - event.preventDefault(); - return false; - }); - } - } - - _xdsoft_datetime.setCurrentTime(getCurrentValue()); - - input - .data('xdsoft_datetimepicker', datetimepicker) - .on('open.xdsoft focusin.xdsoft mousedown.xdsoft touchstart', function () { - if (input.is(':disabled') || (input.data('xdsoft_datetimepicker').is(':visible') && options.closeOnInputClick)) { - return; - } - clearTimeout(timer); - timer = setTimeout(function () { - if (input.is(':disabled')) { - return; - } - - triggerAfterOpen = true; - _xdsoft_datetime.setCurrentTime(getCurrentValue(), true); - if(options.mask) { - setMask(options); - } - datetimepicker.trigger('open.xdsoft'); - }, 100); - }) - .on('keydown.xdsoft', function (event) { - var elementSelector, - key = event.which; - if ([ENTER].indexOf(key) !== -1 && options.enterLikeTab) { - elementSelector = $("input:visible,textarea:visible,button:visible,a:visible"); - datetimepicker.trigger('close.xdsoft'); - elementSelector.eq(elementSelector.index(this) + 1).focus(); - return false; - } - if ([TAB].indexOf(key) !== -1) { - datetimepicker.trigger('close.xdsoft'); - return true; - } - }) - .on('blur.xdsoft', function () { - datetimepicker.trigger('close.xdsoft'); - }); - }; - destroyDateTimePicker = function (input) { - var datetimepicker = input.data('xdsoft_datetimepicker'); - if (datetimepicker) { - datetimepicker.data('xdsoft_datetime', null); - datetimepicker.remove(); - input - .data('xdsoft_datetimepicker', null) - .off('.xdsoft'); - $(window).off('resize.xdsoft'); - $([window, document.body]).off('mousedown.xdsoft touchstart'); - if (input.unmousewheel) { - input.unmousewheel(); - } - } - }; - $(document) - .off('keydown.xdsoftctrl keyup.xdsoftctrl') - .on('keydown.xdsoftctrl', function (e) { - if (e.keyCode === CTRLKEY) { - ctrlDown = true; - } - }) - .on('keyup.xdsoftctrl', function (e) { - if (e.keyCode === CTRLKEY) { - ctrlDown = false; - } - }); - - this.each(function () { - var datetimepicker = $(this).data('xdsoft_datetimepicker'), $input; - if (datetimepicker) { - if ($.type(opt) === 'string') { - switch (opt) { - case 'show': - $(this).select().focus(); - datetimepicker.trigger('open.xdsoft'); - break; - case 'hide': - datetimepicker.trigger('close.xdsoft'); - break; - case 'toggle': - datetimepicker.trigger('toggle.xdsoft'); - break; - case 'destroy': - destroyDateTimePicker($(this)); - break; - case 'reset': - this.value = this.defaultValue; - if (!this.value || !datetimepicker.data('xdsoft_datetime').isValidDate(dateHelper.parseDate(this.value, options.format))) { - datetimepicker.data('changed', false); - } - datetimepicker.data('xdsoft_datetime').setCurrentTime(this.value); - break; - case 'validate': - $input = datetimepicker.data('input'); - $input.trigger('blur.xdsoft'); - break; - default: - if (datetimepicker[opt] && $.isFunction(datetimepicker[opt])) { - result = datetimepicker[opt](opt2); - } - } - } else { - datetimepicker - .setOptions(opt); - } - return 0; - } - if ($.type(opt) !== 'string') { - if (!options.lazyInit || options.open || options.inline) { - createDateTimePicker($(this)); - } else { - lazyInit($(this)); - } - } - }); - - return result; - }; - - $.fn.datetimepicker.defaults = default_options; - - function HighlightedDate(date, desc, style) { - "use strict"; - this.date = date; - this.desc = desc; - this.style = style; - } + period = (period > 10) ? 10 : period - 10; + if (!stop) { + timer = setTimeout(arguments_callee4, v || period); + } + }(500)); + $([document.body, window]).on('touchend mouseup.xdsoft', function arguments_callee5() { + clearTimeout(timer); + stop = true; + $([document.body, window]) + .off('touchend mouseup.xdsoft', arguments_callee5); + }); + }); + + xchangeTimer = 0; + // base handler - generating a calendar and timepicker + datetimepicker + .on('xchange.xdsoft', function (event) { + clearTimeout(xchangeTimer); + xchangeTimer = setTimeout(function () { + + if (_xdsoft_datetime.currentTime === undefined || _xdsoft_datetime.currentTime === null) { + //In case blanks are allowed, delay construction until we have a valid date + if (options.allowBlank) + return; + + _xdsoft_datetime.currentTime = _xdsoft_datetime.now(); + } + + var table = '', + start = new Date(_xdsoft_datetime.currentTime.getFullYear(), _xdsoft_datetime.currentTime.getMonth(), 1, 12, 0, 0), + i = 0, + j, + today = _xdsoft_datetime.now(), + maxDate = false, + minDate = false, + hDate, + day, + d, + y, + m, + w, + classes = [], + customDateSettings, + newRow = true, + time = '', + h = '', + line_time, + description; + + while (start.getDay() !== options.dayOfWeekStart) { + start.setDate(start.getDate() - 1); + } + + table += ''; + + if (options.weeks) { + table += ''; + } + + for (j = 0; j < 7; j += 1) { + table += ''; + } + + table += ''; + table += ''; + + if (options.maxDate !== false) { + maxDate = _xdsoft_datetime.strToDate(options.maxDate); + maxDate = new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate(), 23, 59, 59, 999); + } + + if (options.minDate !== false) { + minDate = _xdsoft_datetime.strToDate(options.minDate); + minDate = new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate()); + } + + while (i < _xdsoft_datetime.currentTime.countDaysInMonth() || start.getDay() !== options.dayOfWeekStart || _xdsoft_datetime.currentTime.getMonth() === start.getMonth()) { + classes = []; + i += 1; + + day = start.getDay(); + d = start.getDate(); + y = start.getFullYear(); + m = start.getMonth(); + w = _xdsoft_datetime.getWeekOfYear(start); + description = ''; + + classes.push('xdsoft_date'); + + if (options.beforeShowDay && $.isFunction(options.beforeShowDay.call)) { + customDateSettings = options.beforeShowDay.call(datetimepicker, start); + } else { + customDateSettings = null; + } + + if(options.allowDateRe && Object.prototype.toString.call(options.allowDateRe) === "[object RegExp]"){ + if(!options.allowDateRe.test(dateHelper.formatDate(start, options.formatDate))){ + classes.push('xdsoft_disabled'); + } + } else if(options.allowDates && options.allowDates.length>0){ + if(options.allowDates.indexOf(dateHelper.formatDate(start, options.formatDate)) === -1){ + classes.push('xdsoft_disabled'); + } + } else if ((maxDate !== false && start > maxDate) || (minDate !== false && start < minDate) || (customDateSettings && customDateSettings[0] === false)) { + classes.push('xdsoft_disabled'); + } else if (options.disabledDates.indexOf(dateHelper.formatDate(start, options.formatDate)) !== -1) { + classes.push('xdsoft_disabled'); + } else if (options.disabledWeekDays.indexOf(day) !== -1) { + classes.push('xdsoft_disabled'); + }else if (input.is('[readonly]')) { + classes.push('xdsoft_disabled'); + } + + if (customDateSettings && customDateSettings[1] !== "") { + classes.push(customDateSettings[1]); + } + + if (_xdsoft_datetime.currentTime.getMonth() !== m) { + classes.push('xdsoft_other_month'); + } + + if ((options.defaultSelect || datetimepicker.data('changed')) && dateHelper.formatDate(_xdsoft_datetime.currentTime, options.formatDate) === dateHelper.formatDate(start, options.formatDate)) { + classes.push('xdsoft_current'); + } + + if (dateHelper.formatDate(today, options.formatDate) === dateHelper.formatDate(start, options.formatDate)) { + classes.push('xdsoft_today'); + } + + if (start.getDay() === 0 || start.getDay() === 6 || options.weekends.indexOf(dateHelper.formatDate(start, options.formatDate)) !== -1) { + classes.push('xdsoft_weekend'); + } + + if (options.highlightedDates[dateHelper.formatDate(start, options.formatDate)] !== undefined) { + hDate = options.highlightedDates[dateHelper.formatDate(start, options.formatDate)]; + classes.push(hDate.style === undefined ? 'xdsoft_highlighted_default' : hDate.style); + description = hDate.desc === undefined ? '' : hDate.desc; + } + + if (options.beforeShowDay && $.isFunction(options.beforeShowDay)) { + classes.push(options.beforeShowDay(start)); + } + + if (newRow) { + table += ''; + newRow = false; + if (options.weeks) { + table += ''; + } + } + + table += ''; + + if (start.getDay() === options.dayOfWeekStartPrev) { + table += ''; + newRow = true; + } + + start.setDate(d + 1); + } + table += '
    ' + options.i18n[globalLocale].dayOfWeekShort[(j + options.dayOfWeekStart) % 7] + '
    ' + w + '' + + '
    ' + d + '
    ' + + '
    '; + + calendar.html(table); + + month_picker.find('.xdsoft_label span').eq(0).text(options.i18n[globalLocale].months[_xdsoft_datetime.currentTime.getMonth()]); + month_picker.find('.xdsoft_label span').eq(1).text(_xdsoft_datetime.currentTime.getFullYear()); + + // generate timebox + time = ''; + h = ''; + m = ''; + + line_time = function line_time(h, m) { + var now = _xdsoft_datetime.now(), optionDateTime, current_time, + isALlowTimesInit = options.allowTimes && $.isArray(options.allowTimes) && options.allowTimes.length; + now.setHours(h); + h = parseInt(now.getHours(), 10); + now.setMinutes(m); + m = parseInt(now.getMinutes(), 10); + optionDateTime = new Date(_xdsoft_datetime.currentTime); + optionDateTime.setHours(h); + optionDateTime.setMinutes(m); + classes = []; + if ((options.minDateTime !== false && options.minDateTime > optionDateTime) || (options.maxTime !== false && _xdsoft_datetime.strtotime(options.maxTime).getTime() < now.getTime()) || (options.minTime !== false && _xdsoft_datetime.strtotime(options.minTime).getTime() > now.getTime())) { + classes.push('xdsoft_disabled'); + } else if ((options.minDateTime !== false && options.minDateTime > optionDateTime) || ((options.disabledMinTime !== false && now.getTime() > _xdsoft_datetime.strtotime(options.disabledMinTime).getTime()) && (options.disabledMaxTime !== false && now.getTime() < _xdsoft_datetime.strtotime(options.disabledMaxTime).getTime()))) { + classes.push('xdsoft_disabled'); + } else if (input.is('[readonly]')) { + classes.push('xdsoft_disabled'); + } + + current_time = new Date(_xdsoft_datetime.currentTime); + current_time.setHours(parseInt(_xdsoft_datetime.currentTime.getHours(), 10)); + + if (!isALlowTimesInit) { + current_time.setMinutes(Math[options.roundTime](_xdsoft_datetime.currentTime.getMinutes() / options.step) * options.step); + } + + if ((options.initTime || options.defaultSelect || datetimepicker.data('changed')) && current_time.getHours() === parseInt(h, 10) && ((!isALlowTimesInit && options.step > 59) || current_time.getMinutes() === parseInt(m, 10))) { + if (options.defaultSelect || datetimepicker.data('changed')) { + classes.push('xdsoft_current'); + } else if (options.initTime) { + classes.push('xdsoft_init_time'); + } + } + if (parseInt(today.getHours(), 10) === parseInt(h, 10) && parseInt(today.getMinutes(), 10) === parseInt(m, 10)) { + classes.push('xdsoft_today'); + } + time += '
    ' + dateHelper.formatDate(now, options.formatTime) + '
    '; + }; + + if (!options.allowTimes || !$.isArray(options.allowTimes) || !options.allowTimes.length) { + for (i = 0, j = 0; i < (options.hours12 ? 12 : 24); i += 1) { + for (j = 0; j < 60; j += options.step) { + h = (i < 10 ? '0' : '') + i; + m = (j < 10 ? '0' : '') + j; + line_time(h, m); + } + } + } else { + for (i = 0; i < options.allowTimes.length; i += 1) { + h = _xdsoft_datetime.strtotime(options.allowTimes[i]).getHours(); + m = _xdsoft_datetime.strtotime(options.allowTimes[i]).getMinutes(); + line_time(h, m); + } + } + + timebox.html(time); + + opt = ''; + i = 0; + + for (i = parseInt(options.yearStart, 10) + options.yearOffset; i <= parseInt(options.yearEnd, 10) + options.yearOffset; i += 1) { + opt += '
    ' + i + '
    '; + } + yearselect.children().eq(0) + .html(opt); + + for (i = parseInt(options.monthStart, 10), opt = ''; i <= parseInt(options.monthEnd, 10); i += 1) { + opt += '
    ' + options.i18n[globalLocale].months[i] + '
    '; + } + monthselect.children().eq(0).html(opt); + $(datetimepicker) + .trigger('generate.xdsoft'); + }, 10); + event.stopPropagation(); + }) + .on('afterOpen.xdsoft', function () { + if (options.timepicker) { + var classType, pheight, height, top; + if (timebox.find('.xdsoft_current').length) { + classType = '.xdsoft_current'; + } else if (timebox.find('.xdsoft_init_time').length) { + classType = '.xdsoft_init_time'; + } + if (classType) { + pheight = timeboxparent[0].clientHeight; + height = timebox[0].offsetHeight; + top = timebox.find(classType).index() * options.timeHeightInTimePicker + 1; + if ((height - pheight) < top) { + top = height - pheight; + } + timeboxparent.trigger('scroll_element.xdsoft_scroller', [parseInt(top, 10) / (height - pheight)]); + } else { + timeboxparent.trigger('scroll_element.xdsoft_scroller', [0]); + } + } + }); + + timerclick = 0; + calendar + .on('touchend click.xdsoft', 'td', function (xdevent) { + xdevent.stopPropagation(); // Prevents closing of Pop-ups, Modals and Flyouts in Bootstrap + timerclick += 1; + var $this = $(this), + currentTime = _xdsoft_datetime.currentTime; + + if (currentTime === undefined || currentTime === null) { + _xdsoft_datetime.currentTime = _xdsoft_datetime.now(); + currentTime = _xdsoft_datetime.currentTime; + } + + if ($this.hasClass('xdsoft_disabled')) { + return false; + } + + currentTime.setDate(1); + currentTime.setFullYear($this.data('year')); + currentTime.setMonth($this.data('month')); + currentTime.setDate($this.data('date')); + + datetimepicker.trigger('select.xdsoft', [currentTime]); + + input.val(_xdsoft_datetime.str()); + + if (options.onSelectDate && $.isFunction(options.onSelectDate)) { + options.onSelectDate.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), xdevent); + } + + datetimepicker.data('changed', true); + datetimepicker.trigger('xchange.xdsoft'); + datetimepicker.trigger('changedatetime.xdsoft'); + if ((timerclick > 1 || (options.closeOnDateSelect === true || (options.closeOnDateSelect === false && !options.timepicker))) && !options.inline) { + datetimepicker.trigger('close.xdsoft'); + } + setTimeout(function () { + timerclick = 0; + }, 200); + }); + + timebox + .on('touchmove', 'div', function () { currentlyScrollingTimeDiv = true; }) + .on('touchend click.xdsoft', 'div', function (xdevent) { + xdevent.stopPropagation(); + if (currentlyScrollingTimeDiv) { + currentlyScrollingTimeDiv = false; + return; + } + var $this = $(this), + currentTime = _xdsoft_datetime.currentTime; + + if (currentTime === undefined || currentTime === null) { + _xdsoft_datetime.currentTime = _xdsoft_datetime.now(); + currentTime = _xdsoft_datetime.currentTime; + } + + if ($this.hasClass('xdsoft_disabled')) { + return false; + } + currentTime.setHours($this.data('hour')); + currentTime.setMinutes($this.data('minute')); + datetimepicker.trigger('select.xdsoft', [currentTime]); + + datetimepicker.data('input').val(_xdsoft_datetime.str()); + + if (options.onSelectTime && $.isFunction(options.onSelectTime)) { + options.onSelectTime.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), xdevent); + } + datetimepicker.data('changed', true); + datetimepicker.trigger('xchange.xdsoft'); + datetimepicker.trigger('changedatetime.xdsoft'); + if (options.inline !== true && options.closeOnTimeSelect === true) { + datetimepicker.trigger('close.xdsoft'); + } + }); + + datepicker + .on('mousewheel.xdsoft', function (event) { + if (!options.scrollMonth) { + return true; + } + if (event.deltaY < 0) { + _xdsoft_datetime.nextMonth(); + } else { + _xdsoft_datetime.prevMonth(); + } + return false; + }); + + input + .on('mousewheel.xdsoft', function (event) { + if (!options.scrollInput) { + return true; + } + if (!options.datepicker && options.timepicker) { + current_time_index = timebox.find('.xdsoft_current').length ? timebox.find('.xdsoft_current').eq(0).index() : 0; + if (current_time_index + event.deltaY >= 0 && current_time_index + event.deltaY < timebox.children().length) { + current_time_index += event.deltaY; + } + if (timebox.children().eq(current_time_index).length) { + timebox.children().eq(current_time_index).trigger('mousedown'); + } + return false; + } + if (options.datepicker && !options.timepicker) { + datepicker.trigger(event, [event.deltaY, event.deltaX, event.deltaY]); + if (input.val) { + input.val(_xdsoft_datetime.str()); + } + datetimepicker.trigger('changedatetime.xdsoft'); + return false; + } + }); + + datetimepicker + .on('changedatetime.xdsoft', function (event) { + if (options.onChangeDateTime && $.isFunction(options.onChangeDateTime)) { + var $input = datetimepicker.data('input'); + options.onChangeDateTime.call(datetimepicker, _xdsoft_datetime.currentTime, $input, event); + delete options.value; + $input.trigger('change'); + } + }) + .on('generate.xdsoft', function () { + if (options.onGenerate && $.isFunction(options.onGenerate)) { + options.onGenerate.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input')); + } + if (triggerAfterOpen) { + datetimepicker.trigger('afterOpen.xdsoft'); + triggerAfterOpen = false; + } + }) + .on('click.xdsoft', function (xdevent) { + xdevent.stopPropagation(); + }); + + current_time_index = 0; + + /** + * Runs the callback for each of the specified node's ancestors. + * + * Return FALSE from the callback to stop ascending. + * + * @param {DOMNode} node + * @param {Function} callback + * @returns {undefined} + */ + forEachAncestorOf = function (node, callback) { + do { + node = node.parentNode; + + if (callback(node) === false) { + break; + } + } while (node.nodeName !== 'HTML'); + }; + + /** + * Sets the position of the picker. + * + * @returns {undefined} + */ + setPos = function () { + var dateInputOffset, + dateInputElem, + verticalPosition, + left, + position, + datetimepickerElem, + dateInputHasFixedAncestor, + $dateInput, + windowWidth, + verticalAnchorEdge, + datetimepickerCss, + windowHeight, + windowScrollTop; + + $dateInput = datetimepicker.data('input'); + dateInputOffset = $dateInput.offset(); + dateInputElem = $dateInput[0]; + + verticalAnchorEdge = 'top'; + verticalPosition = (dateInputOffset.top + dateInputElem.offsetHeight) - 1; + left = dateInputOffset.left; + position = "absolute"; + + windowWidth = $(window).width(); + windowHeight = $(window).height(); + windowScrollTop = $(window).scrollTop(); + + if ((document.documentElement.clientWidth - dateInputOffset.left) < datepicker.parent().outerWidth(true)) { + var diff = datepicker.parent().outerWidth(true) - dateInputElem.offsetWidth; + left = left - diff; + } + + if ($dateInput.parent().css('direction') === 'rtl') { + left -= (datetimepicker.outerWidth() - $dateInput.outerWidth()); + } + + if (options.fixed) { + verticalPosition -= windowScrollTop; + left -= $(window).scrollLeft(); + position = "fixed"; + } else { + dateInputHasFixedAncestor = false; + + forEachAncestorOf(dateInputElem, function (ancestorNode) { + if (window.getComputedStyle(ancestorNode).getPropertyValue('position') === 'fixed') { + dateInputHasFixedAncestor = true; + return false; + } + }); + + if (dateInputHasFixedAncestor) { + position = 'fixed'; + + //If the picker won't fit entirely within the viewport then display it above the date input. + if (verticalPosition + datetimepicker.outerHeight() > windowHeight + windowScrollTop) { + verticalAnchorEdge = 'bottom'; + verticalPosition = (windowHeight + windowScrollTop) - dateInputOffset.top; + } else { + verticalPosition -= windowScrollTop; + } + } else { + if (verticalPosition + dateInputElem.offsetHeight > windowHeight + windowScrollTop) { + verticalPosition = dateInputOffset.top - dateInputElem.offsetHeight + 1; + } + } + + if (verticalPosition < 0) { + verticalPosition = 0; + } + + if (left + dateInputElem.offsetWidth > windowWidth) { + left = windowWidth - dateInputElem.offsetWidth; + } + } + + datetimepickerElem = datetimepicker[0]; + + forEachAncestorOf(datetimepickerElem, function (ancestorNode) { + var ancestorNodePosition; + + ancestorNodePosition = window.getComputedStyle(ancestorNode).getPropertyValue('position'); + + if (ancestorNodePosition === 'relative' && windowWidth >= ancestorNode.offsetWidth) { + left = left - ((windowWidth - ancestorNode.offsetWidth) / 2); + return false; + } + }); + + datetimepickerCss = { + position: position, + left: left, + top: '', //Initialize to prevent previous values interfering with new ones. + bottom: '' //Initialize to prevent previous values interfering with new ones. + }; + + datetimepickerCss[verticalAnchorEdge] = verticalPosition; + + datetimepicker.css(datetimepickerCss); + }; + + datetimepicker + .on('open.xdsoft', function (event) { + var onShow = true; + if (options.onShow && $.isFunction(options.onShow)) { + onShow = options.onShow.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), event); + } + if (onShow !== false) { + datetimepicker.show(); + setPos(); + $(window) + .off('resize.xdsoft', setPos) + .on('resize.xdsoft', setPos); + + if (options.closeOnWithoutClick) { + $([document.body, window]).on('touchstart mousedown.xdsoft', function arguments_callee6() { + datetimepicker.trigger('close.xdsoft'); + $([document.body, window]).off('touchstart mousedown.xdsoft', arguments_callee6); + }); + } + } + }) + .on('close.xdsoft', function (event) { + var onClose = true; + month_picker + .find('.xdsoft_month,.xdsoft_year') + .find('.xdsoft_select') + .hide(); + if (options.onClose && $.isFunction(options.onClose)) { + onClose = options.onClose.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), event); + } + if (onClose !== false && !options.opened && !options.inline) { + datetimepicker.hide(); + } + event.stopPropagation(); + }) + .on('toggle.xdsoft', function () { + if (datetimepicker.is(':visible')) { + datetimepicker.trigger('close.xdsoft'); + } else { + datetimepicker.trigger('open.xdsoft'); + } + }) + .data('input', input); + + timer = 0; + + datetimepicker.data('xdsoft_datetime', _xdsoft_datetime); + datetimepicker.setOptions(options); + + function getCurrentValue() { + var ct = false, time; + + if (options.startDate) { + ct = _xdsoft_datetime.strToDate(options.startDate); + } else { + ct = options.value || ((input && input.val && input.val()) ? input.val() : ''); + if (ct) { + ct = _xdsoft_datetime.strToDateTime(ct); + } else if (options.defaultDate) { + ct = _xdsoft_datetime.strToDateTime(options.defaultDate); + if (options.defaultTime) { + time = _xdsoft_datetime.strtotime(options.defaultTime); + ct.setHours(time.getHours()); + ct.setMinutes(time.getMinutes()); + } + } + } + + if (ct && _xdsoft_datetime.isValidDate(ct)) { + datetimepicker.data('changed', true); + } else { + ct = ''; + } + + return ct || 0; + } + + function setMask(options) { + + var isValidValue = function (mask, value) { + var reg = mask + .replace(/([\[\]\/\{\}\(\)\-\.\+]{1})/g, '\\$1') + .replace(/_/g, '{digit+}') + .replace(/([0-9]{1})/g, '{digit$1}') + .replace(/\{digit([0-9]{1})\}/g, '[0-$1_]{1}') + .replace(/\{digit[\+]\}/g, '[0-9_]{1}'); + return (new RegExp(reg)).test(value); + }, + getCaretPos = function (input) { + try { + if (document.selection && document.selection.createRange) { + var range = document.selection.createRange(); + return range.getBookmark().charCodeAt(2) - 2; + } + if (input.setSelectionRange) { + return input.selectionStart; + } + } catch (e) { + return 0; + } + }, + setCaretPos = function (node, pos) { + node = (typeof node === "string" || node instanceof String) ? document.getElementById(node) : node; + if (!node) { + return false; + } + if (node.createTextRange) { + var textRange = node.createTextRange(); + textRange.collapse(true); + textRange.moveEnd('character', pos); + textRange.moveStart('character', pos); + textRange.select(); + return true; + } + if (node.setSelectionRange) { + node.setSelectionRange(pos, pos); + return true; + } + return false; + }; + if(options.mask) { + input.off('keydown.xdsoft'); + } + if (options.mask === true) { + if (typeof moment != 'undefined') { + options.mask = options.format + .replace(/Y{4}/g, '9999') + .replace(/Y{2}/g, '99') + .replace(/M{2}/g, '19') + .replace(/D{2}/g, '39') + .replace(/H{2}/g, '29') + .replace(/m{2}/g, '59') + .replace(/s{2}/g, '59'); + } else { + options.mask = options.format + .replace(/Y/g, '9999') + .replace(/F/g, '9999') + .replace(/m/g, '19') + .replace(/d/g, '39') + .replace(/H/g, '29') + .replace(/i/g, '59') + .replace(/s/g, '59'); + } + } + + if ($.type(options.mask) === 'string') { + if (!isValidValue(options.mask, input.val())) { + input.val(options.mask.replace(/[0-9]/g, '_')); + setCaretPos(input[0], 0); + } + + input.on('keydown.xdsoft', function (event) { + var val = this.value, + key = event.which, + pos, + digit; + + if (((key >= KEY0 && key <= KEY9) || (key >= _KEY0 && key <= _KEY9)) || (key === BACKSPACE || key === DEL)) { + pos = getCaretPos(this); + digit = (key !== BACKSPACE && key !== DEL) ? String.fromCharCode((_KEY0 <= key && key <= _KEY9) ? key - KEY0 : key) : '_'; + + if ((key === BACKSPACE || key === DEL) && pos) { + pos -= 1; + digit = '_'; + } + + while (/[^0-9_]/.test(options.mask.substr(pos, 1)) && pos < options.mask.length && pos > 0) { + pos += (key === BACKSPACE || key === DEL) ? -1 : 1; + } + + val = val.substr(0, pos) + digit + val.substr(pos + 1); + if ($.trim(val) === '') { + val = options.mask.replace(/[0-9]/g, '_'); + } else { + if (pos === options.mask.length) { + event.preventDefault(); + return false; + } + } + + pos += (key === BACKSPACE || key === DEL) ? 0 : 1; + while (/[^0-9_]/.test(options.mask.substr(pos, 1)) && pos < options.mask.length && pos > 0) { + pos += (key === BACKSPACE || key === DEL) ? -1 : 1; + } + + if (isValidValue(options.mask, val)) { + this.value = val; + setCaretPos(this, pos); + } else if ($.trim(val) === '') { + this.value = options.mask.replace(/[0-9]/g, '_'); + } else { + input.trigger('error_input.xdsoft'); + } + } else { + if (([AKEY, CKEY, VKEY, ZKEY, YKEY].indexOf(key) !== -1 && ctrlDown) || [ESC, ARROWUP, ARROWDOWN, ARROWLEFT, ARROWRIGHT, F5, CTRLKEY, TAB, ENTER].indexOf(key) !== -1) { + return true; + } + } + + event.preventDefault(); + return false; + }); + } + } + + _xdsoft_datetime.setCurrentTime(getCurrentValue()); + + input + .data('xdsoft_datetimepicker', datetimepicker) + .on('open.xdsoft focusin.xdsoft mousedown.xdsoft touchstart', function () { + if (input.is(':disabled') || (input.data('xdsoft_datetimepicker').is(':visible') && options.closeOnInputClick)) { + return; + } + clearTimeout(timer); + timer = setTimeout(function () { + if (input.is(':disabled')) { + return; + } + + triggerAfterOpen = true; + _xdsoft_datetime.setCurrentTime(getCurrentValue(), true); + if(options.mask) { + setMask(options); + } + datetimepicker.trigger('open.xdsoft'); + }, 100); + }) + .on('keydown.xdsoft', function (event) { + var elementSelector, + key = event.which; + if ([ENTER].indexOf(key) !== -1 && options.enterLikeTab) { + elementSelector = $("input:visible,textarea:visible,button:visible,a:visible"); + datetimepicker.trigger('close.xdsoft'); + elementSelector.eq(elementSelector.index(this) + 1).focus(); + return false; + } + if ([TAB].indexOf(key) !== -1) { + datetimepicker.trigger('close.xdsoft'); + return true; + } + }) + .on('blur.xdsoft', function () { + datetimepicker.trigger('close.xdsoft'); + }); + }; + destroyDateTimePicker = function (input) { + var datetimepicker = input.data('xdsoft_datetimepicker'); + if (datetimepicker) { + datetimepicker.data('xdsoft_datetime', null); + datetimepicker.remove(); + input + .data('xdsoft_datetimepicker', null) + .off('.xdsoft'); + $(window).off('resize.xdsoft'); + $([window, document.body]).off('mousedown.xdsoft touchstart'); + if (input.unmousewheel) { + input.unmousewheel(); + } + } + }; + $(document) + .off('keydown.xdsoftctrl keyup.xdsoftctrl') + .on('keydown.xdsoftctrl', function (e) { + if (e.keyCode === CTRLKEY) { + ctrlDown = true; + } + }) + .on('keyup.xdsoftctrl', function (e) { + if (e.keyCode === CTRLKEY) { + ctrlDown = false; + } + }); + + this.each(function () { + var datetimepicker = $(this).data('xdsoft_datetimepicker'), $input; + if (datetimepicker) { + if ($.type(opt) === 'string') { + switch (opt) { + case 'show': + $(this).select().focus(); + datetimepicker.trigger('open.xdsoft'); + break; + case 'hide': + datetimepicker.trigger('close.xdsoft'); + break; + case 'toggle': + datetimepicker.trigger('toggle.xdsoft'); + break; + case 'destroy': + destroyDateTimePicker($(this)); + break; + case 'reset': + this.value = this.defaultValue; + if (!this.value || !datetimepicker.data('xdsoft_datetime').isValidDate(dateHelper.parseDate(this.value, options.format))) { + datetimepicker.data('changed', false); + } + datetimepicker.data('xdsoft_datetime').setCurrentTime(this.value); + break; + case 'validate': + $input = datetimepicker.data('input'); + $input.trigger('blur.xdsoft'); + break; + default: + if (datetimepicker[opt] && $.isFunction(datetimepicker[opt])) { + result = datetimepicker[opt](opt2); + } + } + } else { + datetimepicker + .setOptions(opt); + } + return 0; + } + if ($.type(opt) !== 'string') { + if (!options.lazyInit || options.open || options.inline) { + createDateTimePicker($(this)); + } else { + lazyInit($(this)); + } + } + }); + + return result; + }; + + $.fn.datetimepicker.defaults = default_options; + + function HighlightedDate(date, desc, style) { + "use strict"; + this.date = date; + this.desc = desc; + this.style = style; + } })); /*! * jQuery Mousewheel 3.1.13 diff --git a/template/acp/js/functions.js b/template/acp/js/functions.js index 57d1b69..e3f3f3f 100644 --- a/template/acp/js/functions.js +++ b/template/acp/js/functions.js @@ -1,64 +1,64 @@ function loading(show) { - if(show) - $('#loadinginfo').css('display', 'block'); - else - $('#loadinginfo').css('display', 'none'); + if(show) + $('#loadinginfo').css('display', 'block'); + else + $('#loadinginfo').css('display', 'none'); } function cashback_output(id, type) { - if(type == 'mm') - bootbox.dialog('Вы подтверждаете, что вывели деньги на эл. кошелек?', - [{ - "label" : "Подтверждаю", - callback: function() { - cashback_output_go(id) - } - },{ - "label" : "Отмена" - }] - ); - else - bootbox.dialog('Будет выполнен запрос через шлюз', - [{ - "label" : "Продолжить", - callback: function() { - cashback_output_go(id) - } - },{ - "label" : "Отмена" - }] - ); + if(type == 'mm') + bootbox.dialog('Вы подтверждаете, что вывели деньги на эл. кошелек?', + [{ + "label" : "Подтверждаю", + callback: function() { + cashback_output_go(id) + } + },{ + "label" : "Отмена" + }] + ); + else + bootbox.dialog('Будет выполнен запрос через шлюз', + [{ + "label" : "Продолжить", + callback: function() { + cashback_output_go(id) + } + },{ + "label" : "Отмена" + }] + ); } function cashback_output_go(id) { - $.getJSON(home+'cashback/id/'+id, function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); + $.getJSON(home+'cashback/id/'+id, function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); - if(i == 's') - { - bootbox.dialog(val, - [{ - "label" : "Продолжить", - callback: function() { - location.reload() - } - }] - ); - } - }); - }); + if(i == 's') + { + bootbox.dialog(val, + [{ + "label" : "Продолжить", + callback: function() { + location.reload() + } + }] + ); + } + }); + }); - return false + return false } \ No newline at end of file diff --git a/template/acp/js/letter.js b/template/acp/js/letter.js index a2124f2..c7bd4e9 100644 --- a/template/acp/js/letter.js +++ b/template/acp/js/letter.js @@ -1,49 +1,49 @@ $('#letter').ajaxForm({ - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить" - }] - ); + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить" + }] + ); - if(i == 's') - { - bootbox.dialog('

    Внимание

    Рассылка выполнена.
    Список почт, на которые не удалось отправить сообщение: '+val, - [{ - "label" : "Продолжить", - callback : function(){location.reload()} - }] - ); - } - }); + if(i == 's') + { + bootbox.dialog('

    Внимание

    Рассылка выполнена.
    Список почт, на которые не удалось отправить сообщение: '+val, + [{ + "label" : "Продолжить", + callback : function(){location.reload()} + }] + ); + } + }); - loading(0) - } + loading(0) + } }); function checked_all() { - if(letter_all) - { - for(i=0; i < document.letter.length; i++) - { - if(document.letter.elements[i].type == 'checkbox') - document.letter.elements[i].checked = false; - } + if(letter_all) + { + for(i=0; i < document.letter.length; i++) + { + if(document.letter.elements[i].type == 'checkbox') + document.letter.elements[i].checked = false; + } - letter_all = false; - }else{ - for(i=0; i < document.letter.length; i++) - { - if(document.letter.elements[i].type == 'checkbox') - document.letter.elements[i].checked = true; - } + letter_all = false; + }else{ + for(i=0; i < document.letter.length; i++) + { + if(document.letter.elements[i].type == 'checkbox') + document.letter.elements[i].checked = true; + } - letter_all = true; - } + letter_all = true; + } } diff --git a/template/acp/js/logs.js b/template/acp/js/logs.js index 461ae29..33e2b00 100644 --- a/template/acp/js/logs.js +++ b/template/acp/js/logs.js @@ -1,87 +1,87 @@ function logs_sys_search(go) { - if($('#search').val() == '') - { - $('#search_error').css('display', 'none'); + if($('#search').val() == '') + { + $('#search_error').css('display', 'none'); - return; - } + return; + } - loading(1); + loading(1); - if(go) go = '/go'; else go = ''; + if(go) go = '/go'; else go = ''; - $.ajax({ - type: 'POST', - url: home+'logs/subsection/search'+go, - data: 'text='+$('#search').val(), - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - { - if(val != '') - { - $('#search_error').css('display', 'inline-block'); - $('#search_error').html(val); - }else - $('#search_error').css('display', 'none'); - } + $.ajax({ + type: 'POST', + url: home+'logs/subsection/search'+go, + data: 'text='+$('#search').val(), + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + { + if(val != '') + { + $('#search_error').css('display', 'inline-block'); + $('#search_error').html(val); + }else + $('#search_error').css('display', 'none'); + } - if(i == 's') - { - $('#search_error').css('display', 'none'); - $('#search_result').html(val); - } - }); + if(i == 's') + { + $('#search_error').css('display', 'none'); + $('#search_result').html(val); + } + }); - loading(0); - } - }); + loading(0); + } + }); } function logs_search(go) { - if($('#search').val() == '') - { - $('#search_error').css('display', 'none'); + if($('#search').val() == '') + { + $('#search_error').css('display', 'none'); - return; - } + return; + } - loading(1); + loading(1); - if(go) go = '/go'; else go = ''; + if(go) go = '/go'; else go = ''; - $.ajax({ - type: 'POST', - url: home+'logs/section/search'+go, - data: 'text='+$('#search').val(), - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - { - if(val != '') - { - $('#search_error').css('display', 'inline-block'); - $('#search_error').html(val); - }else - $('#search_error').css('display', 'none'); - } + $.ajax({ + type: 'POST', + url: home+'logs/section/search'+go, + data: 'text='+$('#search').val(), + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + { + if(val != '') + { + $('#search_error').css('display', 'inline-block'); + $('#search_error').html(val); + }else + $('#search_error').css('display', 'none'); + } - if(i == 's') - { - $('#search_error').css('display', 'none'); - $('#search_result').html(val); - } - }); + if(i == 's') + { + $('#search_error').css('display', 'none'); + $('#search_result').html(val); + } + }); - loading(0); - } - }); + loading(0); + } + }); } \ No newline at end of file diff --git a/template/acp/js/news.js b/template/acp/js/news.js index 1e3c2aa..e0661bf 100644 --- a/template/acp/js/news.js +++ b/template/acp/js/news.js @@ -1,120 +1,120 @@ $('#news').ajaxForm({ - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить" - }] - ); + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить" + }] + ); - if(i == 's') - location.reload(); - }); + if(i == 's') + location.reload(); + }); - loading(0) - } + loading(0) + } }); function news_search(go) { - if($('#search').val() == '') - { - $('#search_error').css('display', 'none'); + if($('#search').val() == '') + { + $('#search_error').css('display', 'none'); - return; - } + return; + } - loading(1); + loading(1); - if(go) go = '/go'; else go = ''; + if(go) go = '/go'; else go = ''; - $.ajax({ - type: 'POST', - url: home+'news/subsection/search'+go, - data: 'text='+$('#search').val(), - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - { - if(val != '') - { - $('#search_error').css('display', 'inline-block'); - $('#search_error').html(val); - }else - $('#search_error').css('display', 'none'); - } + $.ajax({ + type: 'POST', + url: home+'news/subsection/search'+go, + data: 'text='+$('#search').val(), + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + { + if(val != '') + { + $('#search_error').css('display', 'inline-block'); + $('#search_error').html(val); + }else + $('#search_error').css('display', 'none'); + } - if(i == 's') - { - $('#search_error').css('display', 'none'); - $('#search_result').html(val); - } - }); + if(i == 's') + { + $('#search_error').css('display', 'none'); + $('#search_result').html(val); + } + }); - loading(0); - } - }); + loading(0); + } + }); } function news_delete(id) { - bootbox.dialog('

    Внимание

    Вы уверены, что хотите удалить новость?', - [{ - "label" : "Удалить", - callback : function(){news_delete_go(id)} - },{ - "label" : "Отмена", - }] - ); + bootbox.dialog('

    Внимание

    Вы уверены, что хотите удалить новость?', + [{ + "label" : "Удалить", + callback : function(){news_delete_go(id)} + },{ + "label" : "Отмена", + }] + ); - return false; + return false; } function news_delete_go(id) { - loading(1); + loading(1); - $.ajax({ - type: 'POST', - url: home+'news/section/delete/id/'+id, - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить" - }] - ); + $.ajax({ + type: 'POST', + url: home+'news/section/delete/id/'+id, + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить" + }] + ); - if(i == 's') - location.reload() - }); + if(i == 's') + location.reload() + }); - loading(0); - } - }); + loading(0); + } + }); } function bbcode(bbbegin, bbend, ta) { - form = document.getElementById(ta); - begin = form.value.substr(0, form.selectionStart); - end = form.value.substr(form.selectionEnd); - sel = form.value.substr(form.selectionStart, form.selectionEnd-form.selectionStart); - var text = form.firstChild; - form.value = begin+bbbegin+sel+bbend+end; - selPos = bbbegin.length+begin.length+sel.length+bbend.length; - form.setSelectionRange(begin.length, selPos); + form = document.getElementById(ta); + begin = form.value.substr(0, form.selectionStart); + end = form.value.substr(form.selectionEnd); + sel = form.value.substr(form.selectionStart, form.selectionEnd-form.selectionStart); + var text = form.firstChild; + form.value = begin+bbbegin+sel+bbend+end; + selPos = bbbegin.length+begin.length+sel.length+bbend.length; + form.setSelectionRange(begin.length, selPos); - return false; + return false; } \ No newline at end of file diff --git a/template/acp/js/notice.js b/template/acp/js/notice.js index 92aa0f4..557c4e0 100644 --- a/template/acp/js/notice.js +++ b/template/acp/js/notice.js @@ -1,118 +1,118 @@ $('#notice').ajaxForm({ - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить" - }] - ); + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить" + }] + ); - if(i == 's') - location.reload(); - }); + if(i == 's') + location.reload(); + }); - loading(0) - } + loading(0) + } }); function notice_search(go) { - if($('#search').val() == '') - { - $('#search_error').css('display', 'none'); + if($('#search').val() == '') + { + $('#search_error').css('display', 'none'); - return; - } + return; + } - loading(1); + loading(1); - if(go) go = '/go'; else go = ''; + if(go) go = '/go'; else go = ''; - $.ajax({ - type: 'POST', - url: home+'notice/subsection/search'+go, - data: 'text='+$('#search').val(), - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - { - if(val != '') - { - $('#search_error').css('display', 'inline-block'); - $('#search_error').html(val); - }else - $('#search_error').css('display', 'none'); - } + $.ajax({ + type: 'POST', + url: home+'notice/subsection/search'+go, + data: 'text='+$('#search').val(), + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + { + if(val != '') + { + $('#search_error').css('display', 'inline-block'); + $('#search_error').html(val); + }else + $('#search_error').css('display', 'none'); + } - if(i == 's') - { - $('#search_error').css('display', 'none'); - $('#search_result').html(val); - } - }); + if(i == 's') + { + $('#search_error').css('display', 'none'); + $('#search_result').html(val); + } + }); - loading(0); - } - }); + loading(0); + } + }); } function change_notice_type() { - if($('#type').val() == 'unit') - { - $('#notice_unit').css('display', 'block'); - $('#notice_server').css('display', 'none'); - }else{ - $('#notice_unit').css('display', 'none'); - $('#notice_server').css('display', 'block'); - } + if($('#type').val() == 'unit') + { + $('#notice_unit').css('display', 'block'); + $('#notice_server').css('display', 'none'); + }else{ + $('#notice_unit').css('display', 'none'); + $('#notice_server').css('display', 'block'); + } } function notice_delete(id) { - bootbox.dialog('

    Внимание

    Вы уверены, что хотите удалить уведомление?', - [{ - "label" : "Удалить", - callback : function(){notice_delete_go(id)} - },{ - "label" : "Отмена", - }] - ); + bootbox.dialog('

    Внимание

    Вы уверены, что хотите удалить уведомление?', + [{ + "label" : "Удалить", + callback : function(){notice_delete_go(id)} + },{ + "label" : "Отмена", + }] + ); - return false; + return false; } function notice_delete_go(id) { - loading(1); + loading(1); - $.ajax({ - type: 'POST', - url: home+'notice/section/delete/id/'+id, - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить" - }] - ); + $.ajax({ + type: 'POST', + url: home+'notice/section/delete/id/'+id, + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить" + }] + ); - if(i == 's') - location.reload() - }); + if(i == 's') + location.reload() + }); - loading(0); - } - }); + loading(0); + } + }); } \ No newline at end of file diff --git a/template/acp/js/pages.js b/template/acp/js/pages.js index 21e5fb1..3c3b450 100644 --- a/template/acp/js/pages.js +++ b/template/acp/js/pages.js @@ -1,62 +1,62 @@ $('#page').ajaxForm({ - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить" - }] - ); + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить" + }] + ); - if(i == 's') - location.reload(); - }); + if(i == 's') + location.reload(); + }); - loading(0) - } + loading(0) + } }); function page_delete(id) { - bootbox.dialog('

    Внимание

    Вы уверены, что хотите удалить страницу?', - [{ - "label" : "Удалить", - callback : function(){page_delete_go(id)} - },{ - "label" : "Отмена", - }] - ); + bootbox.dialog('

    Внимание

    Вы уверены, что хотите удалить страницу?', + [{ + "label" : "Удалить", + callback : function(){page_delete_go(id)} + },{ + "label" : "Отмена", + }] + ); - return false; + return false; } function page_delete_go(id) { - loading(1); + loading(1); - $.ajax({ - type: 'POST', - url: home+'pages/section/delete/id/'+id, - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить" - }] - ); + $.ajax({ + type: 'POST', + url: home+'pages/section/delete/id/'+id, + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить" + }] + ); - if(i == 's') - location.reload() - }); + if(i == 's') + location.reload() + }); - loading(0); - } - }); + loading(0); + } + }); } \ No newline at end of file diff --git a/template/acp/js/promo.js b/template/acp/js/promo.js index cd3c9a3..a7f1d5d 100644 --- a/template/acp/js/promo.js +++ b/template/acp/js/promo.js @@ -1,148 +1,148 @@ $('#promo').ajaxForm({ - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить" - }] - ); + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить" + }] + ); - if(i == 's') - location.reload(); - }); + if(i == 's') + location.reload(); + }); - loading(0) - } + loading(0) + } }); function promo_search(go) { - if($('#search').val() == '') - { - $('#search_error').css('display', 'none'); + if($('#search').val() == '') + { + $('#search_error').css('display', 'none'); - return; - } + return; + } - loading(1); + loading(1); - if(go) go = '/go'; else go = ''; + if(go) go = '/go'; else go = ''; - $.ajax({ - type: 'POST', - url: home+'promo/subsection/search'+go, - data: 'text='+$('#search').val(), - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - { - if(val != '') - { - $('#search_error').css('display', 'inline-block'); - $('#search_error').html(val); - }else - $('#search_error').css('display', 'none'); - } + $.ajax({ + type: 'POST', + url: home+'promo/subsection/search'+go, + data: 'text='+$('#search').val(), + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + { + if(val != '') + { + $('#search_error').css('display', 'inline-block'); + $('#search_error').html(val); + }else + $('#search_error').css('display', 'none'); + } - if(i == 's') - { - $('#search_error').css('display', 'none'); - $('#search_result').html(val); - } - }); + if(i == 's') + { + $('#search_error').css('display', 'none'); + $('#search_result').html(val); + } + }); - loading(0); - } - }); + loading(0); + } + }); } function promo_delete(id) { - bootbox.dialog('

    Внимание

    Вы уверены, что хотите удалить акцию?', - [{ - "label" : "Удалить", - callback : function(){promo_delete_go(id)} - },{ - "label" : "Отмена", - }] - ); + bootbox.dialog('

    Внимание

    Вы уверены, что хотите удалить акцию?', + [{ + "label" : "Удалить", + callback : function(){promo_delete_go(id)} + },{ + "label" : "Отмена", + }] + ); - return false; + return false; } function promo_delete_go(id) { - loading(1); + loading(1); - $.ajax({ - type: 'POST', - url: home+'promo/section/delete/id/'+id, - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить" - }] - ); + $.ajax({ + type: 'POST', + url: home+'promo/section/delete/id/'+id, + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить" + }] + ); - if(i == 's') - location.reload() - }); + if(i == 's') + location.reload() + }); - loading(0); - } - }); + loading(0); + } + }); } function promo_use_delete(id) { - bootbox.dialog('

    Внимание

    Вы уверены, что хотите удалить лог использования акции?', - [{ - "label" : "Удалить", - callback : function(){promo_use_delete_go(id)} - },{ - "label" : "Отмена", - }] - ); + bootbox.dialog('

    Внимание

    Вы уверены, что хотите удалить лог использования акции?', + [{ + "label" : "Удалить", + callback : function(){promo_use_delete_go(id)} + },{ + "label" : "Отмена", + }] + ); - return false; + return false; } function promo_use_delete_go(id) { - loading(1); + loading(1); - $.ajax({ - type: 'POST', - url: home+'promo/section/stats/delete/'+id, - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить" - }] - ); + $.ajax({ + type: 'POST', + url: home+'promo/section/stats/delete/'+id, + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить" + }] + ); - if(i == 's') - location.reload() - }); + if(i == 's') + location.reload() + }); - loading(0); - } - }); + loading(0); + } + }); } \ No newline at end of file diff --git a/template/acp/js/servers.js b/template/acp/js/servers.js index 3548690..41c71f9 100644 --- a/template/acp/js/servers.js +++ b/template/acp/js/servers.js @@ -1,224 +1,224 @@ $('#server').ajaxForm({ - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить" - }] - ); + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить" + }] + ); - if(i == 's') - location.reload(); - }); + if(i == 's') + location.reload(); + }); - loading(0) - } + loading(0) + } }); function servers_search(go) { - if($('#search').val() == '') - { - $('#search_error').css('display', 'none'); + if($('#search').val() == '') + { + $('#search_error').css('display', 'none'); - return; - } + return; + } - loading(1); + loading(1); - if(go) go = '/go'; else go = ''; + if(go) go = '/go'; else go = ''; - $.ajax({ - type: 'POST', - url: home+'servers/subsection/search'+url_search+go, - data: 'text='+$('#search').val(), - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - { - if(val != '') - { - $('#search_error').css('display', 'inline-block'); - $('#search_error').html(val); - }else - $('#search_error').css('display', 'none'); - } + $.ajax({ + type: 'POST', + url: home+'servers/subsection/search'+url_search+go, + data: 'text='+$('#search').val(), + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + { + if(val != '') + { + $('#search_error').css('display', 'inline-block'); + $('#search_error').html(val); + }else + $('#search_error').css('display', 'none'); + } - if(i == 's') - { - $('#search_error').css('display', 'none'); - $('#search_result').html(val); - } + if(i == 's') + { + $('#search_error').css('display', 'none'); + $('#search_result').html(val); + } - if(i == 'url') - url_search = val; - }); + if(i == 'url') + url_search = val; + }); - loading(0); - } - }); + loading(0); + } + }); } function servers_overdue(id, time) { - bootbox.dialog('

    Установка даты:

    ', - [{ - "label" : "Установить", - callback : function(){servers_overdue_go(id)} - },{ - "label" : "Отмена", - }] - ); + bootbox.dialog('

    Установка даты:

    ', + [{ + "label" : "Установить", + callback : function(){servers_overdue_go(id)} + },{ + "label" : "Отмена", + }] + ); - return false; + return false; } function servers_block(id, time) { - bootbox.dialog('

    Установка даты:

    ', - [{ - "label" : "Заблокировать", - callback : function(){servers_block_go(id)} - },{ - "label" : "Отмена", - }] - ); + bootbox.dialog('

    Установка даты:

    ', + [{ + "label" : "Заблокировать", + callback : function(){servers_block_go(id)} + },{ + "label" : "Отмена", + }] + ); - return false; + return false; } function datepick(input, time) { - if($('#'+input).val() != '') - time = $('#'+input).val(); + if($('#'+input).val() != '') + time = $('#'+input).val(); - $('#'+input).datetimepicker({value: time, format: 'd/m/Y H:i'}); + $('#'+input).datetimepicker({value: time, format: 'd/m/Y H:i'}); } function servers_overdue_go(id) { - $.ajax({ - type: 'POST', - url: home+'servers/type/overdue/id/'+id+'/go', - data: 'time='+$('#date_overdue').val(), - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить" - }] - ); + $.ajax({ + type: 'POST', + url: home+'servers/type/overdue/id/'+id+'/go', + data: 'time='+$('#date_overdue').val(), + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить" + }] + ); - if(i == 's') - location.reload(); - }); - } - }); + if(i == 's') + location.reload(); + }); + } + }); } function servers_block_go(id) { - $.ajax({ - type: 'POST', - url: home+'servers/type/block/id/'+id+'/go', - data: 'time='+$('#date_block').val(), - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить" - }] - ); + $.ajax({ + type: 'POST', + url: home+'servers/type/block/id/'+id+'/go', + data: 'time='+$('#date_block').val(), + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить" + }] + ); - if(i == 's') - location.reload(); - }); - } - }); + if(i == 's') + location.reload(); + }); + } + }); } function servers_delete(id) { - bootbox.dialog('

    Внимание

    Вы уверены, что хотите удалить сервер?', - [{ - "label" : "Удалить", - callback : function(){servers_delete_go(id)} - },{ - "label" : "Отмена", - }] - ); + bootbox.dialog('

    Внимание

    Вы уверены, что хотите удалить сервер?', + [{ + "label" : "Удалить", + callback : function(){servers_delete_go(id)} + },{ + "label" : "Отмена", + }] + ); - return false; + return false; } function servers_delete_go(id) { - - loading(1); + + loading(1); - $.ajax({ - type: 'POST', - url: home+'servers/section/delete/id/'+id, - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить" - }] - ); + $.ajax({ + type: 'POST', + url: home+'servers/section/delete/id/'+id, + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить" + }] + ); - if(i == 's') - location.reload() - }); + if(i == 's') + location.reload() + }); - loading(0); - } - }); + loading(0); + } + }); } function change_tarif(id) { - loading(1); + loading(1); - $.ajax({ - url: home+'servers/type/tarif/id/'+id+'/tarif/'+$('#tarif').val()+'/go', - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить" - }] - ); + $.ajax({ + url: home+'servers/type/tarif/id/'+id+'/tarif/'+$('#tarif').val()+'/go', + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить" + }] + ); - if(i == 's') - location.reload() - }); + if(i == 's') + location.reload() + }); - loading(0); - } - }); + loading(0); + } + }); } \ No newline at end of file diff --git a/template/acp/js/system.js b/template/acp/js/system.js index e6e90d3..fef9937 100644 --- a/template/acp/js/system.js +++ b/template/acp/js/system.js @@ -1,72 +1,72 @@ function system_load(go) { - if(go) - loading(1); + if(go) + loading(1); - $.getJSON(home+'system/go/', - function(data) - { - $.each(data, function(i, val) - { - $('#'+i).html(val); - }); + $.getJSON(home+'system/go/', + function(data) + { + $.each(data, function(i, val) + { + $('#'+i).html(val); + }); - loading(0); + loading(0); - if(!go) - setTimeout(function() {system_load(false)}, 3000); - }); + if(!go) + setTimeout(function() {system_load(false)}, 3000); + }); } function system_restart(service) { - switch(service) - { - case 'apache2': - type = 'apache2'; - break; - case 'nginx': - type = 'nginx'; - break; - case 'mysql': - type = 'mysql'; - break; - case 'unit': - type = 'локацию'; - break; - } + switch(service) + { + case 'apache2': + type = 'apache2'; + break; + case 'nginx': + type = 'nginx'; + break; + case 'mysql': + type = 'mysql'; + break; + case 'unit': + type = 'локацию'; + break; + } - bootbox.dialog('

    Внимание

    Вы уверены что хотите перезагруить '+type+'', - [{ - "label" : "Перезагрузить", - callback: function(){system_restart_go(service)} - },{ - "label" : "Отмена" - }]); + bootbox.dialog('

    Внимание

    Вы уверены что хотите перезагруить '+type+'', + [{ + "label" : "Перезагрузить", + callback: function(){system_restart_go(service)} + },{ + "label" : "Отмена" + }]); - return false; + return false; } function system_restart_go(id, service) { - loading(1); + loading(1); - $.getJSON(home+'system/service/'+service, - function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить" - }] - ); + $.getJSON(home+'system/service/'+service, + function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить" + }] + ); - if(i == 's') - system_load(true); - }); + if(i == 's') + system_load(true); + }); - loading(0); - }); + loading(0); + }); } \ No newline at end of file diff --git a/template/acp/js/tarifs.js b/template/acp/js/tarifs.js index 31a910b..90684f1 100644 --- a/template/acp/js/tarifs.js +++ b/template/acp/js/tarifs.js @@ -1,141 +1,141 @@ $('#tarif').ajaxForm({ - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить" - }] - ); + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить" + }] + ); - if(i == 's') - location.href=home+'tarifs/id/'+val - }); + if(i == 's') + location.href=home+'tarifs/id/'+val + }); - loading(0) - } + loading(0) + } }); function tarifs_ports(ports) { - $('#ports').val(ports); + $('#ports').val(ports); } function tarifs_sort(sort) { - switch(sort) - { - case 'id': - if(sort_id == 'asc') - sort_id = 'desc'; - else - sort_id = 'asc'; + switch(sort) + { + case 'id': + if(sort_id == 'asc') + sort_id = 'desc'; + else + sort_id = 'asc'; - sorting = sort_id; + sorting = sort_id; - break; + break; - case 'unit': - sort_unit = sort_unit == 'asc' ? 'desc' : 'asc'; - sorting = sort_unit; + case 'unit': + sort_unit = sort_unit == 'asc' ? 'desc' : 'asc'; + sorting = sort_unit; - break; + break; - case 'game': - sort_game = sort_game == 'asc' ? 'desc' : 'asc'; - sorting = sort_game; + case 'game': + sort_game = sort_game == 'asc' ? 'desc' : 'asc'; + sorting = sort_game; - } + } - location.href=home+'tarifs/sort/'+sort+'/sorting/'+sorting; + location.href=home+'tarifs/sort/'+sort+'/sorting/'+sorting; } function tarifs_search(go) { - if($('#search').val() == '') - { - $('#search_error').css('display', 'none'); + if($('#search').val() == '') + { + $('#search_error').css('display', 'none'); - return; - } + return; + } - loading(1); + loading(1); - if(go) go = '/go'; else go = ''; + if(go) go = '/go'; else go = ''; - $.ajax({ - type: 'POST', - url: home+'tarifs/subsection/search'+go, - data: 'text='+$('#search').val(), - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - { - if(val != '') - { - $('#search_error').css('display', 'inline-block'); - $('#search_error').html(val); - }else - $('#search_error').css('display', 'none'); - } + $.ajax({ + type: 'POST', + url: home+'tarifs/subsection/search'+go, + data: 'text='+$('#search').val(), + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + { + if(val != '') + { + $('#search_error').css('display', 'inline-block'); + $('#search_error').html(val); + }else + $('#search_error').css('display', 'none'); + } - if(i == 's') - { - $('#search_error').css('display', 'none'); - $('#search_result').html(val); - } - }); + if(i == 's') + { + $('#search_error').css('display', 'none'); + $('#search_result').html(val); + } + }); - loading(0); - } - }); + loading(0); + } + }); } function tarifs_delete(id) { - bootbox.dialog('

    Внимание

    Вы уверены, что хотите удалить тариф?', - [{ - "label" : "Удалить", - callback : function(){tarifs_delete_go(id)} - },{ - "label" : "Отмена", - }] - ); + bootbox.dialog('

    Внимание

    Вы уверены, что хотите удалить тариф?', + [{ + "label" : "Удалить", + callback : function(){tarifs_delete_go(id)} + },{ + "label" : "Отмена", + }] + ); - return false; + return false; } function tarifs_delete_go(id) { - - loading(1); + + loading(1); - $.ajax({ - type: 'POST', - url: home+'tarifs/section/delete/id/'+id, - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить" - }] - ); + $.ajax({ + type: 'POST', + url: home+'tarifs/section/delete/id/'+id, + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить" + }] + ); - if(i == 's') - location.reload() - }); + if(i == 's') + location.reload() + }); - loading(0); - } - }); + loading(0); + } + }); } \ No newline at end of file diff --git a/template/acp/js/units.js b/template/acp/js/units.js index b704c5c..45ac792 100644 --- a/template/acp/js/units.js +++ b/template/acp/js/units.js @@ -1,142 +1,142 @@ $('#unit').ajaxForm({ - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить" - }] - ); + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить" + }] + ); - if(i == 's') - location.href=home+'units/id/'+val; - }); + if(i == 's') + location.href=home+'units/id/'+val; + }); - loading(0) - } + loading(0) + } }); function units_load(id, go) { - if(go) - loading(1); + if(go) + loading(1); - $.getJSON(home+'units/section/loading/id/'+id, - function(data) - { - $.each(data, function(i, val) - { - $('#'+i+'_'+id).html(val); - }); + $.getJSON(home+'units/section/loading/id/'+id, + function(data) + { + $.each(data, function(i, val) + { + $('#'+i+'_'+id).html(val); + }); - loading(0); + loading(0); - if(!go) - setTimeout(function() {units_load(id, false)}, 3000); - }); + if(!go) + setTimeout(function() {units_load(id, false)}, 3000); + }); } function units_restart(id, service) { - switch(service) - { - case 'apache2': - type = 'apache2'; - break; - case 'nginx': - type = 'nginx'; - break; - case 'mysql': - type = 'mysql'; - break; - case 'unit': - type = 'локацию'; - break; - } + switch(service) + { + case 'apache2': + type = 'apache2'; + break; + case 'nginx': + type = 'nginx'; + break; + case 'mysql': + type = 'mysql'; + break; + case 'unit': + type = 'локацию'; + break; + } - bootbox.dialog('

    Внимание

    Вы уверены что хотите перезагруить '+type+'', - [{ - "label" : "Перезагрузить", - callback: function(){units_restart_go(id, service)} - },{ - "label" : "Отмена" - }]); + bootbox.dialog('

    Внимание

    Вы уверены что хотите перезагруить '+type+'', + [{ + "label" : "Перезагрузить", + callback: function(){units_restart_go(id, service)} + },{ + "label" : "Отмена" + }]); - return false; + return false; } function units_restart_go(id, service) { - loading(1); + loading(1); - $.getJSON(home+'units/section/loading/id/'+id+'/service/'+service, - function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить" - }] - ); + $.getJSON(home+'units/section/loading/id/'+id+'/service/'+service, + function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить" + }] + ); - if(i == 's') - units_load(id, true); - }); + if(i == 's') + units_load(id, true); + }); - loading(0); - }); + loading(0); + }); } function units_delete(id) { - bootbox.dialog('

    Внимание

    Вы уверены, что хотите удалить локацию?.
    ' - +'При "Удалить полностью" - удаляются все услуги и их логи, а также тарифы.', - [{ - "label" : "Удалить", - callback : function(){units_delete_go(id, false)} - },{ - "label" : "Удалить полностью", - callback : function(){units_delete_go(id, true)} - },{ - "label" : "Отмена", - }] - ); + bootbox.dialog('

    Внимание

    Вы уверены, что хотите удалить локацию?.
    ' + +'При "Удалить полностью" - удаляются все услуги и их логи, а также тарифы.', + [{ + "label" : "Удалить", + callback : function(){units_delete_go(id, false)} + },{ + "label" : "Удалить полностью", + callback : function(){units_delete_go(id, true)} + },{ + "label" : "Отмена", + }] + ); - return false; + return false; } function units_delete_go(id, all) { - - loading(1); + + loading(1); - if(all) go = '/delete/all'; else go = ''; + if(all) go = '/delete/all'; else go = ''; - $.ajax({ - type: 'POST', - url: home+'units/section/delete/id/'+id+go, - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить" - }] - ); + $.ajax({ + type: 'POST', + url: home+'units/section/delete/id/'+id+go, + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить" + }] + ); - if(i == 's') - location.reload() - }); + if(i == 's') + location.reload() + }); - loading(0); - } - }); + loading(0); + } + }); } \ No newline at end of file diff --git a/template/acp/js/users.js b/template/acp/js/users.js index c4b7d93..b30335f 100644 --- a/template/acp/js/users.js +++ b/template/acp/js/users.js @@ -1,179 +1,179 @@ $('#user').ajaxForm({ - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить" - }] - ); + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить" + }] + ); - if(i == 's') - { - bootbox.dialog('

    Внимание

    Внесенные изменения сохранены.', - [{ - "label" : "Продолжить", - callback : function(){location.reload()} - }] - ); - } - }); + if(i == 's') + { + bootbox.dialog('

    Внимание

    Внесенные изменения сохранены.', + [{ + "label" : "Продолжить", + callback : function(){location.reload()} + }] + ); + } + }); - loading(0) - } + loading(0) + } }); function users_sort(sort) { - switch(sort) - { - case 'id': - if(sort_id == 'asc') - sort_id = 'desc'; - else - sort_id = 'asc'; + switch(sort) + { + case 'id': + if(sort_id == 'asc') + sort_id = 'desc'; + else + sort_id = 'asc'; - sorting = sort_id; + sorting = sort_id; - break; + break; - case 'balance': - sort_balance = sort_balance == 'asc' ? 'desc' : 'asc'; - sorting = sort_balance; + case 'balance': + sort_balance = sort_balance == 'asc' ? 'desc' : 'asc'; + sorting = sort_balance; - break; + break; - case 'group': - sort_group = sort_group == 'asc' ? 'desc' : 'asc'; - sorting = sort_group; + case 'group': + sort_group = sort_group == 'asc' ? 'desc' : 'asc'; + sorting = sort_group; - } + } - location.href=home+'users/sort/'+sort+'/sorting/'+sorting; + location.href=home+'users/sort/'+sort+'/sorting/'+sorting; } function users_search(go) { - if($('#search').val() == '') - { - $('#search_error').css('display', 'none'); + if($('#search').val() == '') + { + $('#search_error').css('display', 'none'); - return; - } + return; + } - loading(1); + loading(1); - if(go) go = '/go'; else go = ''; + if(go) go = '/go'; else go = ''; - $.ajax({ - type: 'POST', - url: home+'users/subsection/search'+go, - data: 'text='+$('#search').val(), - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - { - if(val != '') - { - $('#search_error').css('display', 'inline-block'); - $('#search_error').html(val); - }else - $('#search_error').css('display', 'none'); - } + $.ajax({ + type: 'POST', + url: home+'users/subsection/search'+go, + data: 'text='+$('#search').val(), + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + { + if(val != '') + { + $('#search_error').css('display', 'inline-block'); + $('#search_error').html(val); + }else + $('#search_error').css('display', 'none'); + } - if(i == 's') - { - $('#search_error').css('display', 'none'); - $('#search_result').html(val); - } - }); + if(i == 's') + { + $('#search_error').css('display', 'none'); + $('#search_result').html(val); + } + }); - loading(0); - } - }); + loading(0); + } + }); } function users_delete(id) { - bootbox.dialog('

    Внимание

    Вы уверены, что хотите удалить этого пользователя?
    ' - +'При "Удалить полностью" - удаляются все логи, услуги поступают в поток удаления.', - [{ - "label" : "Удалить", - callback : function(){users_delete_go(id, false)} - },{ - "label" : "Удалить полностью", - callback : function(){users_delete_go(id, true)} - },{ - "label" : "Отмена", - }] - ); + bootbox.dialog('

    Внимание

    Вы уверены, что хотите удалить этого пользователя?
    ' + +'При "Удалить полностью" - удаляются все логи, услуги поступают в поток удаления.', + [{ + "label" : "Удалить", + callback : function(){users_delete_go(id, false)} + },{ + "label" : "Удалить полностью", + callback : function(){users_delete_go(id, true)} + },{ + "label" : "Отмена", + }] + ); - return false; + return false; } function users_delete_go(id, all) { - - loading(1); + + loading(1); - if(all) go = '/delete/all'; else go = ''; + if(all) go = '/delete/all'; else go = ''; - $.ajax({ - type: 'POST', - url: home+'users/section/delete/id/'+id+go, - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить" - }] - ); + $.ajax({ + type: 'POST', + url: home+'users/section/delete/id/'+id+go, + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить" + }] + ); - if(i == 's') - location.reload() - }); + if(i == 's') + location.reload() + }); - loading(0); - } - }); + loading(0); + } + }); } function users_delete_signup(id) { - bootbox.dialog('

    Внимание

    Вы уверены, что хотите удалить подачу регистрации?', - [{ - "label" : "Удалить", - callback : function(){users_delete_signup_go(id)} - },{ - "label" : "Отмена", - }] - ); + bootbox.dialog('

    Внимание

    Вы уверены, что хотите удалить подачу регистрации?', + [{ + "label" : "Удалить", + callback : function(){users_delete_signup_go(id)} + },{ + "label" : "Отмена", + }] + ); - return false; + return false; } function users_delete_signup_go(id) { - - loading(1); + + loading(1); - $.getJSON(home+'users/section/signup/delete/signup/id/'+id, - function(data) - { - $.each(data, function(i, val) - { - if(i == 's') - location.reload(); - }); - }); + $.getJSON(home+'users/section/signup/delete/signup/id/'+id, + function(data) + { + $.each(data, function(i, val) + { + if(i == 's') + location.reload(); + }); + }); } \ No newline at end of file diff --git a/template/acp/js/web.js b/template/acp/js/web.js index 01af6b7..3fbd08f 100644 --- a/template/acp/js/web.js +++ b/template/acp/js/web.js @@ -1,87 +1,87 @@ function web_search(go) { - if($('#search').val() == '') - { - $('#search_error').css('display', 'none'); + if($('#search').val() == '') + { + $('#search_error').css('display', 'none'); - return; - } + return; + } - loading(1); + loading(1); - if(go) go = '/go'; else go = ''; + if(go) go = '/go'; else go = ''; - $.ajax({ - type: 'POST', - url: home+'web/subsection/search'+go, - data: 'text='+$('#search').val(), - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - { - if(val != '') - { - $('#search_error').css('display', 'inline-block'); - $('#search_error').html(val); - }else - $('#search_error').css('display', 'none'); - } + $.ajax({ + type: 'POST', + url: home+'web/subsection/search'+go, + data: 'text='+$('#search').val(), + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + { + if(val != '') + { + $('#search_error').css('display', 'inline-block'); + $('#search_error').html(val); + }else + $('#search_error').css('display', 'none'); + } - if(i == 's') - { - $('#search_error').css('display', 'none'); - $('#search_result').html(val); - } - }); + if(i == 's') + { + $('#search_error').css('display', 'none'); + $('#search_result').html(val); + } + }); - loading(0); - } - }); + loading(0); + } + }); } function web_delete(server, type) { - bootbox.dialog('

    Внимание

    Вы уверены, что хотите удалить услугу?', - [{ - "label" : "Удалить", - callback : function(){web_delete_go(server, type)} - },{ - "label" : "Отмена", - }] - ); + bootbox.dialog('

    Внимание

    Вы уверены, что хотите удалить услугу?', + [{ + "label" : "Удалить", + callback : function(){web_delete_go(server, type)} + },{ + "label" : "Отмена", + }] + ); - return false; + return false; } function web_delete_go(server, type) { - loading(1); + loading(1); - $.getJSON('/servers/id/'+server+'/section/web/subsection/'+type+'/action/delete/go', function(arr) - { - $.each(arr, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + $.getJSON('/servers/id/'+server+'/section/web/subsection/'+type+'/action/delete/go', function(arr) + { + $.each(arr, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 'i') - bootbox.dialog('

    Внимание

    '+val, - [{ - "label" : "Продолжить", - }] - ); + if(i == 'i') + bootbox.dialog('

    Внимание

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 's') - location.reload(); - }); + if(i == 's') + location.reload(); + }); - loading(0) - }); + loading(0) + }); } \ No newline at end of file diff --git a/template/acp/js/wiki.js b/template/acp/js/wiki.js index d88d571..7f1c1f4 100644 --- a/template/acp/js/wiki.js +++ b/template/acp/js/wiki.js @@ -1,162 +1,162 @@ $('#wiki').ajaxForm({ - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить" - }] - ); + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить" + }] + ); - if(i == 's') - location.reload(); - }); + if(i == 's') + location.reload(); + }); - loading(0) - } + loading(0) + } }); function wiki_search(go) { - if($('#search').val() == '') - { - $('#search_error').css('display', 'none'); + if($('#search').val() == '') + { + $('#search_error').css('display', 'none'); - return; - } + return; + } - loading(1); + loading(1); - if(go) go = '/go'; else go = ''; + if(go) go = '/go'; else go = ''; - $.ajax({ - type: 'POST', - url: home+'wiki/subsection/search'+go, - data: 'text='+$('#search').val(), - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - { - if(val != '') - { - $('#search_error').css('display', 'inline-block'); - $('#search_error').html(val); - }else - $('#search_error').css('display', 'none'); - } + $.ajax({ + type: 'POST', + url: home+'wiki/subsection/search'+go, + data: 'text='+$('#search').val(), + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + { + if(val != '') + { + $('#search_error').css('display', 'inline-block'); + $('#search_error').html(val); + }else + $('#search_error').css('display', 'none'); + } - if(i == 's') - { - $('#search_error').css('display', 'none'); - $('#search_result').html(val); - } - }); + if(i == 's') + { + $('#search_error').css('display', 'none'); + $('#search_result').html(val); + } + }); - loading(0); - } - }); + loading(0); + } + }); } function wiki_delete(id) { - bootbox.dialog('

    Внимание

    Вы уверены, что хотите удалить ответ?', - [{ - "label" : "Удалить", - callback : function(){wiki_delete_go(id)} - },{ - "label" : "Отмена", - }] - ); + bootbox.dialog('

    Внимание

    Вы уверены, что хотите удалить ответ?', + [{ + "label" : "Удалить", + callback : function(){wiki_delete_go(id)} + },{ + "label" : "Отмена", + }] + ); - return false; + return false; } function wiki_delete_go(id) { - loading(1); + loading(1); - $.ajax({ - type: 'POST', - url: home+'wiki/section/delete/id/'+id, - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить" - }] - ); + $.ajax({ + type: 'POST', + url: home+'wiki/section/delete/id/'+id, + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить" + }] + ); - if(i == 's') - location.reload() - }); + if(i == 's') + location.reload() + }); - loading(0); - } - }); + loading(0); + } + }); } function wiki_cat_delete(id) { - bootbox.dialog('

    Внимание

    Вы уверены, что хотите удалить категорию?', - [{ - "label" : "Удалить", - callback : function(){wiki_cat_delete_go(id)} - },{ - "label" : "Отмена", - }] - ); + bootbox.dialog('

    Внимание

    Вы уверены, что хотите удалить категорию?', + [{ + "label" : "Удалить", + callback : function(){wiki_cat_delete_go(id)} + },{ + "label" : "Отмена", + }] + ); - return false; + return false; } function wiki_cat_delete_go(id) { - loading(1); + loading(1); - $.ajax({ - type: 'POST', - url: home+'wiki/section/delete/type/cat/id/'+id, - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить" - }] - ); + $.ajax({ + type: 'POST', + url: home+'wiki/section/delete/type/cat/id/'+id, + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить" + }] + ); - if(i == 's') - location.reload() - }); + if(i == 's') + location.reload() + }); - loading(0); - } - }); + loading(0); + } + }); } function bbcode(bbbegin, bbend) { - form = document.getElementById('text'); - begin = form.value.substr(0, form.selectionStart); - end = form.value.substr(form.selectionEnd); - sel = form.value.substr(form.selectionStart, form.selectionEnd-form.selectionStart); - var text = form.firstChild; - form.value = begin+bbbegin+sel+bbend+end; - selPos = bbbegin.length+begin.length+sel.length+bbend.length; - form.setSelectionRange(begin.length, selPos); + form = document.getElementById('text'); + begin = form.value.substr(0, form.selectionStart); + end = form.value.substr(form.selectionEnd); + sel = form.value.substr(form.selectionStart, form.selectionEnd-form.selectionStart); + var text = form.firstChild; + form.value = begin+bbbegin+sel+bbend+end; + selPos = bbbegin.length+begin.length+sel.length+bbend.length; + form.setSelectionRange(begin.length, selPos); - return false; + return false; } \ No newline at end of file diff --git a/template/acp/main.html b/template/acp/main.html index affcb97..68f7272 100644 --- a/template/acp/main.html +++ b/template/acp/main.html @@ -1,14 +1,14 @@ - - - - - - - - - - + + + + + + + + + +
    Пользователей в базе:[users] шт.
    Серверов в базе:[servers] шт.
    Пользователей в базе:[users] шт.
    Серверов в базе:[servers] шт.
    @@ -16,9 +16,9 @@
    Заявки на вывод денежных средств
    - - [cashback] - + + [cashback] +
    @@ -26,55 +26,55 @@
    Количество слот на серверах
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    ИграСерверовСлот
    Counter-Strike: 1.6[cs] шт.[slots_cs] шт.
    Counter-Strike: Source v34[cssold] шт.[slots_cssold] шт.
    Counter-Strike: Source[css] шт.[slots_css] шт.
    Counter-Strike: Global Offensive[csgo] шт.[slots_csgo] шт.
    GTA: SA-MP[samp] шт.[slots_samp] шт.
    GTA: CR-MP[crmp] шт.[slots_crmp] шт.
    GTA: MTA[mta] шт.[slots_mta] шт.
    Minecraft[mc] шт.[slots_mc] шт.
    ИграСерверовСлот
    Counter-Strike: 1.6[cs] шт.[slots_cs] шт.
    Counter-Strike: Source v34[cssold] шт.[slots_cssold] шт.
    Counter-Strike: Source[css] шт.[slots_css] шт.
    Counter-Strike: Global Offensive[csgo] шт.[slots_csgo] шт.
    GTA: SA-MP[samp] шт.[slots_samp] шт.
    GTA: CR-MP[crmp] шт.[slots_crmp] шт.
    GTA: MTA[mta] шт.[slots_mta] шт.
    Minecraft[mc] шт.[slots_mc] шт.
    @@ -82,18 +82,18 @@
    Состояние персонала
    - - - - - - - - - - - - - [staff] - + + + + + + + + + + + + + [staff] +
    ИмяГруппаАдресБраузерСостояниеАктивность
    ИмяГруппаАдресБраузерСостояниеАктивность
    diff --git a/template/acp/pages.html b/template/acp/pages.html index 486c2a8..7dd56a2 100644 --- a/template/acp/pages.html +++ b/template/acp/pages.html @@ -1,5 +1,5 @@
    -
    [pages]
    +
    [pages]
    \ No newline at end of file diff --git a/template/acp/sections/addons/addcat.html b/template/acp/sections/addons/addcat.html index b7d5f95..f003e49 100644 --- a/template/acp/sections/addons/addcat.html +++ b/template/acp/sections/addons/addcat.html @@ -1,54 +1,54 @@
    - - - - - - - - - - - - - - - - -
    Название:Положение:
    Игры: - - - - - - - - -
    + + + + + + + + + + + + + + + + +
    Название:Положение:
    Игры: + + + + + + + + +
    \ No newline at end of file diff --git a/template/acp/sections/addons/addpl.html b/template/acp/sections/addons/addpl.html index 2a166ae..986acf2 100644 --- a/template/acp/sections/addons/addpl.html +++ b/template/acp/sections/addons/addpl.html @@ -1,179 +1,179 @@
    -
    Основные настройки
    +
    Основные настройки
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Название:Игра: - - Категория: - -
    Статус: - - Положение:Сборки:
    Описание:
    Информация:
    Картинки:
    Требования:Несовместимости:Цена:
    Выборка:
    Версия: - - Обновление:Удаление:
    Архив:
    - Плагин: - - Обновление: - -
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Название:Игра: + + Категория: + +
    Статус: + + Положение:Сборки:
    Описание:
    Информация:
    Картинки:
    Требования:Несовместимости:Цена:
    Выборка:
    Версия: + + Обновление:Удаление:
    Архив:
    + Плагин: + + Обновление: + +
    -
    +
    - + -
    Редактируемые файлы
    +
    Редактируемые файлы
    - - - - - - -
    Файл - Положение -
    Добавить
    -
    + + + + + + +
    Файл + Положение +
    Добавить
    +
    -
    +
    -
    Удаление текста из файлов
    +
    Удаление текста из файлов
    - - - - - - -
    Файл - Текст - Regex -
    Добавить
    -
    + + + + + + +
    Файл + Текст + Regex +
    Добавить
    +
    -
    +
    -
    Добавление текста в файлы после установки плагина
    +
    Добавление текста в файлы после установки плагина
    - - - - - - -
    Файл - Текст - TOP -
    Добавить
    -
    + + + + + + +
    Файл + Текст + TOP +
    Добавить
    +
    -
    +
    -
    Добавление текста в файлы после удаления плагина
    +
    Добавление текста в файлы после удаления плагина
    - - - - - - -
    Файл - Текст - TOP -
    Добавить
    -
    + + + + + + +
    Файл + Текст + TOP +
    Добавить
    +
    -
    +
    -
    Удаление файлов после установки плагина
    +
    Удаление файлов после установки плагина
    - - - - - - -
    Файл -
    Добавить
    -
    + + + + + + +
    Файл +
    Добавить
    +
    \ No newline at end of file diff --git a/template/acp/sections/addons/cats.html b/template/acp/sections/addons/cats.html index 9758f97..25c7026 100644 --- a/template/acp/sections/addons/cats.html +++ b/template/acp/sections/addons/cats.html @@ -1,17 +1,17 @@ - - - - - - - - - - - - [list] - + + + + + + + + + + + + [list] +
    #НазваниеИграПлагиновПоложение
    #НазваниеИграПлагиновПоложение
    \ No newline at end of file diff --git a/template/acp/sections/addons/index.html b/template/acp/sections/addons/index.html index 405150c..d109e04 100644 --- a/template/acp/sections/addons/index.html +++ b/template/acp/sections/addons/index.html @@ -1,6 +1,6 @@
    @@ -8,31 +8,31 @@
    - - - - - - - - - - - - [list] - + + + + + + + + + + + + [list] +
    НазваниеКатегория СтатусИгра
    НазваниеКатегория СтатусИгра
    [pages] \ No newline at end of file diff --git a/template/acp/sections/addons/menu.html b/template/acp/sections/addons/menu.html index 29fa6c7..258db8d 100644 --- a/template/acp/sections/addons/menu.html +++ b/template/acp/sections/addons/menu.html @@ -1,9 +1,9 @@
    Управление
    \ No newline at end of file diff --git a/template/acp/sections/addons/plugin.html b/template/acp/sections/addons/plugin.html index e92e0eb..fa61ab7 100644 --- a/template/acp/sections/addons/plugin.html +++ b/template/acp/sections/addons/plugin.html @@ -1,130 +1,130 @@
    -
    Основные настройки
    +
    Основные настройки
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Название:Игра:[game]Категория:
    Статус:Положение:Сборки:
    Описание:
    Информация:
    Картинки:
    Требования:Несовместимости:Цена:
    Выборка:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Название:Игра:[game]Категория:
    Статус:Положение:Сборки:
    Описание:
    Информация:
    Картинки:
    Требования:Несовместимости:Цена:
    Выборка:
    -
    +
    -
    Редактируемые файлы
    +
    Редактируемые файлы
    - - - - - - [config_files_all] -
    Файл - Положение -
    Добавить
    -
    + + + + + + [config_files_all] +
    Файл + Положение +
    Добавить
    +
    -
    +
    -
    Удаление текста из файлов
    +
    Удаление текста из файлов
    - - - - - - [config_clear_all] -
    Файл - Текст - Regex -
    Добавить
    -
    + + + + + + [config_clear_all] +
    Файл + Текст + Regex +
    Добавить
    +
    -
    +
    -
    Добавление текста в файлы после установки плагина
    +
    Добавление текста в файлы после установки плагина
    - - - - - - [config_write_all] -
    Файл - Текст - TOP -
    Добавить
    -
    + + + + + + [config_write_all] +
    Файл + Текст + TOP +
    Добавить
    +
    -
    +
    -
    Добавление текста в файлы после удаления плагина
    +
    Добавление текста в файлы после удаления плагина
    - - - - - - [config_write_del_all] -
    Файл - Текст - TOP -
    Добавить
    -
    + + + + + + [config_write_del_all] +
    Файл + Текст + TOP +
    Добавить
    +
    -
    +
    -
    Удаление файлов после установки плагина
    +
    Удаление файлов после установки плагина
    - - - - - - [files_delete_all] -
    Файл -
    Добавить
    -
    + + + + + + [files_delete_all] +
    Файл +
    Добавить
    +
    @@ -132,14 +132,14 @@
    Новые версии плагина
    - - - - - [update] + + + + + [update]
    Название - Статус - -
    Название + Статус + +
    \ No newline at end of file diff --git a/template/acp/sections/addons/update.html b/template/acp/sections/addons/update.html index c95b270..f85524b 100644 --- a/template/acp/sections/addons/update.html +++ b/template/acp/sections/addons/update.html @@ -3,128 +3,128 @@
    -
    Основные настройки
    +
    Основные настройки
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Название:Требования:Несовместимости:
    Выборка:Цена:
    Статус:Положение:Сборки:
    Описание:
    Информация:
    Картинки:Цена:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Название:Требования:Несовместимости:
    Выборка:Цена:
    Статус:Положение:Сборки:
    Описание:
    Информация:
    Картинки:Цена:
    -
    +
    -
    Редактируемые файлы
    +
    Редактируемые файлы
    - - - - - - [config_files_all] -
    Файл - Положение -
    Добавить
    -
    + + + + + + [config_files_all] +
    Файл + Положение +
    Добавить
    +
    -
    +
    -
    Удаление текста из файлов
    +
    Удаление текста из файлов
    - - - - - - [config_clear_all] -
    Файл - Текст - Regex -
    Добавить
    -
    + + + + + + [config_clear_all] +
    Файл + Текст + Regex +
    Добавить
    +
    -
    +
    -
    Добавление текста в файлы после установки плагина
    +
    Добавление текста в файлы после установки плагина
    - - - - - - [config_write_all] -
    Файл - Текст - TOP -
    Добавить
    -
    + + + + + + [config_write_all] +
    Файл + Текст + TOP +
    Добавить
    +
    -
    +
    -
    Добавление текста в файлы после удаления плагина
    +
    Добавление текста в файлы после удаления плагина
    - - - - - - [config_write_del_all] -
    Файл - Текст - TOP -
    Добавить
    -
    + + + + + + [config_write_del_all] +
    Файл + Текст + TOP +
    Добавить
    +
    -
    +
    -
    Удаление файлов после установки плагина
    +
    Удаление файлов после установки плагина
    - - - - - - [files_delete_all] -
    Файл -
    Добавить
    -
    + + + + + + [files_delete_all] +
    Файл +
    Добавить
    +
    \ No newline at end of file diff --git a/template/acp/sections/addons/updmp.html b/template/acp/sections/addons/updmp.html index 5ed40f7..bf71600 100644 --- a/template/acp/sections/addons/updmp.html +++ b/template/acp/sections/addons/updmp.html @@ -1,30 +1,30 @@ - - - - - - - - - - - - - + + + + + + + + + + + + +
    Локация: - -
    Игра: - -
    Локация: + +
    Игра: + +
    @@ -32,13 +32,13 @@
    Список карт выбранной локации и игры
    - - - - - + + + + +
    - -
    + +
    \ No newline at end of file diff --git a/template/acp/sections/boost/index.html b/template/acp/sections/boost/index.html index f7b2754..d02ab48 100644 --- a/template/acp/sections/boost/index.html +++ b/template/acp/sections/boost/index.html @@ -1,16 +1,16 @@
    Статистика за все время
    - - - - - - - - - - + + + + + + + + + +
    Количесто купленных кругов:[all_num] шт.
    Затраченная сумма:[all_sum] [cur].
    Количесто купленных кругов:[all_num] шт.
    Затраченная сумма:[all_sum] [cur].
    @@ -18,16 +18,16 @@
    Статистика за предыдущий месяц [month_old]
    - - - - - - - - - - + + + + + + + + + +
    Количесто купленных кругов:[old_num] шт.
    Затраченная сумма:[old_sum] [cur].
    Количесто купленных кругов:[old_num] шт.
    Затраченная сумма:[old_sum] [cur].
    @@ -35,23 +35,23 @@
    Статистика за текущий месяц [month_now]
    - - - - - - - - - - + + + + + + + + + +
    Количесто купленных кругов:[now_num] шт.
    Затраченная сумма:[now_sum] [cur].
    Количесто купленных кругов:[now_num] шт.
    Затраченная сумма:[now_sum] [cur].
    @@ -59,26 +59,26 @@
    - - - - - - - - - - - [list] - + + + + + + + + + + + [list] +
    ОперацияПользовательСерверДата
    ОперацияПользовательСерверДата
    [pages] \ No newline at end of file diff --git a/template/acp/sections/boost/menu.html b/template/acp/sections/boost/menu.html index 0342045..db34e76 100644 --- a/template/acp/sections/boost/menu.html +++ b/template/acp/sections/boost/menu.html @@ -1,6 +1,6 @@
    Управление
    \ No newline at end of file diff --git a/template/acp/sections/control/index.html b/template/acp/sections/control/index.html index 8bd5d22..3dcd888 100644 --- a/template/acp/sections/control/index.html +++ b/template/acp/sections/control/index.html @@ -1,6 +1,6 @@
    @@ -8,28 +8,28 @@
    - - - - - - - - - - - [list] - + + + + + + + + + + + [list] +
    Номер / ВладелецАдрес / СтатусДобавлен / АрендаЛимит / Цена
    Номер / ВладелецАдрес / СтатусДобавлен / АрендаЛимит / Цена
    [pages] \ No newline at end of file diff --git a/template/acp/sections/control/menu.html b/template/acp/sections/control/menu.html index 314695b..7728adc 100644 --- a/template/acp/sections/control/menu.html +++ b/template/acp/sections/control/menu.html @@ -1,6 +1,6 @@
    Управление
    \ No newline at end of file diff --git a/template/acp/sections/control/server.html b/template/acp/sections/control/server.html index 003d734..c2e2b69 100644 --- a/template/acp/sections/control/server.html +++ b/template/acp/sections/control/server.html @@ -1,46 +1,46 @@
    ID: [id] / Арендован: [date] / Перейти к серверам
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Владелец:Адрес:Пароль:
    SQL_Логин:SQL_Пароль:SQL_FileTP:
    Лимит:Цена:
    Аренда: - - Удаление:[overdue]Блокировка:[block]
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Владелец:Адрес:Пароль:
    SQL_Логин:SQL_Пароль:SQL_FileTP:
    Лимит:Цена:
    Аренда: + + Удаление:[overdue]Блокировка:[block]
    @@ -49,10 +49,10 @@ \ No newline at end of file diff --git a/template/acp/sections/hosting/menu.html b/template/acp/sections/hosting/menu.html index 55d67be..316f99d 100644 --- a/template/acp/sections/hosting/menu.html +++ b/template/acp/sections/hosting/menu.html @@ -1,6 +1,6 @@
    Управление
    \ No newline at end of file diff --git a/template/acp/sections/jobs/add.html b/template/acp/sections/jobs/add.html index ea12794..0f6968d 100644 --- a/template/acp/sections/jobs/add.html +++ b/template/acp/sections/jobs/add.html @@ -1,58 +1,58 @@
    - - - - - - - - - - - - - - - -
    Название вакансииДолжность
    Описание:
    (Используйте HTML теги)
    - -
    + + + + + + + + + + + + + + + +
    Название вакансииДолжность
    Описание:
    (Используйте HTML теги)
    + +
    \ No newline at end of file diff --git a/template/acp/sections/jobs/edit.html b/template/acp/sections/jobs/edit.html index 5eebad8..7af983d 100644 --- a/template/acp/sections/jobs/edit.html +++ b/template/acp/sections/jobs/edit.html @@ -1,54 +1,54 @@
    - - - - - - - - - - - - - - - - - -
    НазваниеДолжность
    Описание:
    (Используйте HTML теги)
    - -
    + + + + + + + + + + + + + + + + + +
    НазваниеДолжность
    Описание:
    (Используйте HTML теги)
    + +
    \ No newline at end of file diff --git a/template/acp/sections/jobs/index.html b/template/acp/sections/jobs/index.html index 2a05bb2..a45eb8d 100644 --- a/template/acp/sections/jobs/index.html +++ b/template/acp/sections/jobs/index.html @@ -1,38 +1,38 @@ - - - - - - - - - - - - - - [list] - + + + + + + + + + + + + + + [list] +
    IDНазваниеДолжностьОписаниеСтатусСоздан
    IDНазваниеДолжностьОписаниеСтатусСоздан
    \ No newline at end of file diff --git a/template/acp/sections/jobs/menu.html b/template/acp/sections/jobs/menu.html index 16901fd..b1aaffb 100644 --- a/template/acp/sections/jobs/menu.html +++ b/template/acp/sections/jobs/menu.html @@ -1,7 +1,7 @@
    Управление
    \ No newline at end of file diff --git a/template/acp/sections/jobs/request.html b/template/acp/sections/jobs/request.html index ee7deb7..bc63adf 100644 --- a/template/acp/sections/jobs/request.html +++ b/template/acp/sections/jobs/request.html @@ -1,38 +1,38 @@ - - - - - - - - - - - - - - [list] - + + + + + + + + + + + + + + [list] +
    IDПользовательОтветКонтактыВакансияСоздан
    IDПользовательОтветКонтактыВакансияСоздан
    \ No newline at end of file diff --git a/template/acp/sections/jobs/request_edit.html b/template/acp/sections/jobs/request_edit.html index 9e61e6f..98162b2 100644 --- a/template/acp/sections/jobs/request_edit.html +++ b/template/acp/sections/jobs/request_edit.html @@ -1,52 +1,52 @@
    - - - - - - - - - - - - - - - - - - -
    ПользовательКонтакты
    Ответ
    Вакансия - -
    + + + + + + + + + + + + + + + + + + +
    ПользовательКонтакты
    Ответ
    Вакансия + +
    \ No newline at end of file diff --git a/template/acp/sections/letter/index.html b/template/acp/sections/letter/index.html index 9e82d69..941b100 100644 --- a/template/acp/sections/letter/index.html +++ b/template/acp/sections/letter/index.html @@ -1,39 +1,39 @@
    - - - - - - - - - - - - - -
    Заголовок:
    + + + + + + + + + + + + + +
    Заголовок:
    -
    +
    - - - - - - - - - - - - [list] - -
    ПользовательПочтаБалансАктивность
    + + + + + + + + + + + + [list] + +
    ПользовательПочтаБалансАктивность
    \ No newline at end of file diff --git a/template/acp/sections/letter/menu.html b/template/acp/sections/letter/menu.html index 023bfa3..7d91fcb 100644 --- a/template/acp/sections/letter/menu.html +++ b/template/acp/sections/letter/menu.html @@ -1,5 +1,5 @@
    Управление
    \ No newline at end of file diff --git a/template/acp/sections/logs/index.html b/template/acp/sections/logs/index.html index dc0d913..a5dfe80 100644 --- a/template/acp/sections/logs/index.html +++ b/template/acp/sections/logs/index.html @@ -1,6 +1,6 @@
    @@ -8,26 +8,26 @@
    - - - - - - - - - - - [list] - + + + + + + + + + + + [list] +
    ОперацияПользовательСерверДата
    ОперацияПользовательСерверДата
    [pages] \ No newline at end of file diff --git a/template/acp/sections/logs/logs.html b/template/acp/sections/logs/logs.html index e92722f..c8414be 100644 --- a/template/acp/sections/logs/logs.html +++ b/template/acp/sections/logs/logs.html @@ -1,6 +1,6 @@
    @@ -8,26 +8,26 @@
    - - - - - - - - - - - [list] - + + + + + + + + + + + [list] +
    ОперацияПользовательСуммаДата
    ОперацияПользовательСуммаДата
    [pages] \ No newline at end of file diff --git a/template/acp/sections/logs/menu.html b/template/acp/sections/logs/menu.html index 82ea3a9..cfed038 100644 --- a/template/acp/sections/logs/menu.html +++ b/template/acp/sections/logs/menu.html @@ -1,10 +1,10 @@
    Управление
    \ No newline at end of file diff --git a/template/acp/sections/news/add.html b/template/acp/sections/news/add.html index 762e292..4854d38 100644 --- a/template/acp/sections/news/add.html +++ b/template/acp/sections/news/add.html @@ -1,43 +1,43 @@
    - - - - - - - - - - - - - - - - - - - - - - - - -
    Заголовок: - - Теги: - -
    -
    Спойлер
    -
    Подсветка
    -
    Цитата
    -
    Ссылка
    -
    -
    Спойлер
    -
    Подсветка
    -
    Цитата
    -
    Ссылка
    -
    + + + + + + + + + + + + + + + + + + + + + + + + +
    Заголовок: + + Теги: + +
    +
    Спойлер
    +
    Подсветка
    +
    Цитата
    +
    Ссылка
    +
    +
    Спойлер
    +
    Подсветка
    +
    Цитата
    +
    Ссылка
    +
    \ No newline at end of file diff --git a/template/acp/sections/news/index.html b/template/acp/sections/news/index.html index e89602f..324d114 100644 --- a/template/acp/sections/news/index.html +++ b/template/acp/sections/news/index.html @@ -1,6 +1,6 @@
    @@ -8,27 +8,27 @@
    - - - - - - - - - - - - [list] - + + + + + + + + + + + + [list] +
    ЗаголовокТегиПросмотровДата
    ЗаголовокТегиПросмотровДата
    [pages] \ No newline at end of file diff --git a/template/acp/sections/news/menu.html b/template/acp/sections/news/menu.html index d902d0f..75abab0 100644 --- a/template/acp/sections/news/menu.html +++ b/template/acp/sections/news/menu.html @@ -1,6 +1,6 @@
    Управление
    \ No newline at end of file diff --git a/template/acp/sections/news/news.html b/template/acp/sections/news/news.html index 9df23ad..dab39b4 100644 --- a/template/acp/sections/news/news.html +++ b/template/acp/sections/news/news.html @@ -1,43 +1,43 @@
    - - - - - - - - - - - - - - - - - - - - - - - - -
    Заголовок: - - Теги: - -
    -
    Спойлер
    -
    Подсветка
    -
    Цитата
    -
    Ссылка
    -
    -
    Спойлер
    -
    Подсветка
    -
    Цитата
    -
    Ссылка
    -
    + + + + + + + + + + + + + + + + + + + + + + + + +
    Заголовок: + + Теги: + +
    +
    Спойлер
    +
    Подсветка
    +
    Цитата
    +
    Ссылка
    +
    +
    Спойлер
    +
    Подсветка
    +
    Цитата
    +
    Ссылка
    +
    \ No newline at end of file diff --git a/template/acp/sections/notice/add.html b/template/acp/sections/notice/add.html index d334457..07d362a 100644 --- a/template/acp/sections/notice/add.html +++ b/template/acp/sections/notice/add.html @@ -1,44 +1,44 @@
    - - - - - - - - - - - - - - - - - - - - - -
    Кому: - - Значение: -
    - -
    -
    - -
    -
    Цвет: - - Завершение:
    + + + + + + + + + + + + + + + + + + + + + +
    Кому: + + Значение: +
    + +
    +
    + +
    +
    Цвет: + + Завершение:
    @@ -47,10 +47,10 @@ \ No newline at end of file diff --git a/template/acp/sections/notice/index.html b/template/acp/sections/notice/index.html index 50505c6..46e2e7d 100644 --- a/template/acp/sections/notice/index.html +++ b/template/acp/sections/notice/index.html @@ -1,6 +1,6 @@
    @@ -8,25 +8,25 @@
    - - - - - - - - - - [list] - + + + + + + + + + + [list] +
    Уведомления
    Уведомления
    [pages] \ No newline at end of file diff --git a/template/acp/sections/notice/menu.html b/template/acp/sections/notice/menu.html index 588f5e0..7e3c340 100644 --- a/template/acp/sections/notice/menu.html +++ b/template/acp/sections/notice/menu.html @@ -1,7 +1,7 @@
    Управление
    \ No newline at end of file diff --git a/template/acp/sections/notice/notice.html b/template/acp/sections/notice/notice.html index ee964fd..f7ecae1 100644 --- a/template/acp/sections/notice/notice.html +++ b/template/acp/sections/notice/notice.html @@ -1,34 +1,34 @@
    - - - - - - - + + + + + + + + + + + + + + +
    Кому: - - Значение: -
    + + + + + + + - - - - - - - - - - - - - - -
    Кому: + + Значение: +
    -
    - -
    -
    Цвет:Завершение:
    +
    + +
    +
    Цвет:Завершение:
    @@ -37,10 +37,10 @@ \ No newline at end of file diff --git a/template/acp/sections/pages/add.html b/template/acp/sections/pages/add.html index 8a51f0f..02065a5 100644 --- a/template/acp/sections/pages/add.html +++ b/template/acp/sections/pages/add.html @@ -1,20 +1,20 @@
    - - - - - - - - - - - - - -
    Название: - -
    + + + + + + + + + + + + + +
    Название: + +
    \ No newline at end of file diff --git a/template/acp/sections/pages/index.html b/template/acp/sections/pages/index.html index d5856c9..ebb1a8f 100644 --- a/template/acp/sections/pages/index.html +++ b/template/acp/sections/pages/index.html @@ -1,16 +1,16 @@ - - - - - - - - - - - [list] - + + + + + + + + + + + [list] +
    НазваниеФайл
    НазваниеФайл
    [pages] diff --git a/template/acp/sections/pages/menu.html b/template/acp/sections/pages/menu.html index 7a7ebf1..dc6c433 100644 --- a/template/acp/sections/pages/menu.html +++ b/template/acp/sections/pages/menu.html @@ -1,6 +1,6 @@
    Управление
    \ No newline at end of file diff --git a/template/acp/sections/pages/page.html b/template/acp/sections/pages/page.html index 8f46188..3b1bdbe 100644 --- a/template/acp/sections/pages/page.html +++ b/template/acp/sections/pages/page.html @@ -1,20 +1,20 @@
    - - - - - - - - - - - - - -
    Название: - -
    + + + + + + + + + + + + + +
    Название: + +
    \ No newline at end of file diff --git a/template/acp/sections/promo/add.html b/template/acp/sections/promo/add.html index a262988..0382229 100644 --- a/template/acp/sections/promo/add.html +++ b/template/acp/sections/promo/add.html @@ -1,51 +1,51 @@
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Код:Значение:Акция: - -
    Совпадений:Использований:Тип: - -
    Пользователь:Сервер:Окончание:
    [tarifs]
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Код:Значение:Акция: + +
    Совпадений:Использований:Тип: + +
    Пользователь:Сервер:Окончание:
    [tarifs]
    @@ -53,18 +53,18 @@
    Информация по условиям
    - - - - - + + + + +
    -

    FPS: "fps":"1000" или "fps":"500:1000"

    -

    RAM: "ram":"50" или "fps":"50:80"

    -

    TickRate: "tickrate":"66" или "fps":"64:128"

    -

    Период: "time":"30" или "time":"30:90"

    -

    Слоты: "slots":"32" или "slots":"20:32" или "slots":"10-20"

    -

    Указывать несколько условий через запятые: "fps":"500:1000","slots":"10-32","time":"30"

    -
    +

    FPS: "fps":"1000" или "fps":"500:1000"

    +

    RAM: "ram":"50" или "fps":"50:80"

    +

    TickRate: "tickrate":"66" или "fps":"64:128"

    +

    Период: "time":"30" или "time":"30:90"

    +

    Слоты: "slots":"32" или "slots":"20:32" или "slots":"10-20"

    +

    Указывать несколько условий через запятые: "fps":"500:1000","slots":"10-32","time":"30"

    +
    @@ -73,10 +73,10 @@ \ No newline at end of file diff --git a/template/acp/sections/promo/index.html b/template/acp/sections/promo/index.html index aca9fdb..a22b37c 100644 --- a/template/acp/sections/promo/index.html +++ b/template/acp/sections/promo/index.html @@ -1,6 +1,6 @@
    @@ -8,30 +8,30 @@
    - - - - - - - - - - - - - - - [list] - + + + + + + + + + + + + + + + [list] +
    Промо-кодЗначениеТарифАкцияТипЛимитОкончание
    Промо-кодЗначениеТарифАкцияТипЛимитОкончание
    [pages] \ No newline at end of file diff --git a/template/acp/sections/promo/menu.html b/template/acp/sections/promo/menu.html index 0cc54df..0a95c45 100644 --- a/template/acp/sections/promo/menu.html +++ b/template/acp/sections/promo/menu.html @@ -1,8 +1,8 @@
    Управление
    \ No newline at end of file diff --git a/template/acp/sections/promo/promo.html b/template/acp/sections/promo/promo.html index abae1f7..691a7b6 100644 --- a/template/acp/sections/promo/promo.html +++ b/template/acp/sections/promo/promo.html @@ -1,41 +1,41 @@
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Акция для тарифа: [tarif]
    Код:Значение:Акция:
    Совпадений:Использований:Тип:
    Пользователь:Сервер:Окончание:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Акция для тарифа: [tarif]
    Код:Значение:Акция:
    Совпадений:Использований:Тип:
    Пользователь:Сервер:Окончание:
    @@ -43,18 +43,18 @@
    Информация по условиям
    - - - - - + + + + +
    -

    FPS: "fps":"1000" или "fps":"500:1000"

    -

    RAM: "ram":"50" или "fps":"50:80"

    -

    TickRate: "tickrate":"66" или "fps":"64:128"

    -

    Период: "time":"30" или "time":"30:90"

    -

    Слоты: "slots":"32" или "slots":"20:32" или "slots":"10-20"

    -

    Указывать несколько условий через запятые: "fps":"500:1000","slots":"10-32","time":"30"

    -
    +

    FPS: "fps":"1000" или "fps":"500:1000"

    +

    RAM: "ram":"50" или "fps":"50:80"

    +

    TickRate: "tickrate":"66" или "fps":"64:128"

    +

    Период: "time":"30" или "time":"30:90"

    +

    Слоты: "slots":"32" или "slots":"20:32" или "slots":"10-20"

    +

    Указывать несколько условий через запятые: "fps":"500:1000","slots":"10-32","time":"30"

    +
    @@ -63,10 +63,10 @@ \ No newline at end of file diff --git a/template/acp/sections/promo/stats.html b/template/acp/sections/promo/stats.html index 612d92a..35a72f7 100644 --- a/template/acp/sections/promo/stats.html +++ b/template/acp/sections/promo/stats.html @@ -1,17 +1,17 @@ - - - - - - - - - - - - [list] - + + + + + + + + + + + + [list] +
    АкцияКлиентОперацияДата
    АкцияКлиентОперацияДата
    \ No newline at end of file diff --git a/template/acp/sections/servers/index.html b/template/acp/sections/servers/index.html index 05f5793..377f7dd 100644 --- a/template/acp/sections/servers/index.html +++ b/template/acp/sections/servers/index.html @@ -1,6 +1,6 @@
    @@ -8,29 +8,29 @@
    - - - - - - - - - - - - [list] - + + + + + + + + + + + + [list] +
    Номер / ВладелецНазвание / АдресЛокация / ТарифСлоты / СтатусИгра / Аренда
    Номер / ВладелецНазвание / АдресЛокация / ТарифСлоты / СтатусИгра / Аренда
    [pages] \ No newline at end of file diff --git a/template/acp/sections/servers/menu.html b/template/acp/sections/servers/menu.html index 15b8524..9b62977 100644 --- a/template/acp/sections/servers/menu.html +++ b/template/acp/sections/servers/menu.html @@ -1,13 +1,13 @@
    Управление
    \ No newline at end of file diff --git a/template/acp/sections/servers/overdue.html b/template/acp/sections/servers/overdue.html index c95c96d..783cde0 100644 --- a/template/acp/sections/servers/overdue.html +++ b/template/acp/sections/servers/overdue.html @@ -1,14 +1,14 @@ - - - - - - - - - - - [list] - + + + + + + + + + + + [list] +
    Номер / ВладелецНазвание / АдресЛокация / ТарифСлоты / СтатусИгра / Удаление
    Номер / ВладелецНазвание / АдресЛокация / ТарифСлоты / СтатусИгра / Удаление
    \ No newline at end of file diff --git a/template/acp/sections/servers/server.html b/template/acp/sections/servers/server.html index 6898746..e4ef699 100644 --- a/template/acp/sections/servers/server.html +++ b/template/acp/sections/servers/server.html @@ -1,91 +1,91 @@
    ID: [id] / Название: [name] / Игра: [game] / FTP: [ftp_on] / Арендован: [date]
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Владелец:Адрес:Порт:
    Диск:Слоты:Сборка:
    FPS:TickRate:RAM:
    Ядро:Ядро:PingBoost:
    FileTP:Нагрузка:0 - лимит по умолчанию ([cpu_limi]%)
    Аренда: - - Удаление:[overdue]Блокировка:[block]
    Разделы: - - - - - - -
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Владелец:Адрес:Порт:
    Диск:Слоты:Сборка:
    FPS:TickRate:RAM:
    Ядро:Ядро:PingBoost:
    FileTP:Нагрузка:0 - лимит по умолчанию ([cpu_limi]%)
    Аренда: + + Удаление:[overdue]Блокировка:[block]
    Разделы: + + + + + + +
    @@ -93,10 +93,10 @@
    Текущий тарифный план: [tarif]
    - - - - + + + + @@ -105,10 +105,10 @@ \ No newline at end of file diff --git a/template/acp/sections/system/index.html b/template/acp/sections/system/index.html index 090a16f..9264d5d 100644 --- a/template/acp/sections/system/index.html +++ b/template/acp/sections/system/index.html @@ -1,34 +1,34 @@
    Изменить
    Изменить
    - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + +
    CPURAMHDDApacheNginxMySQLUptimeSSH
    Панель управления
    CPURAMHDDApacheNginxMySQLUptimeSSH
    Панель управления
    \ No newline at end of file diff --git a/template/acp/sections/tarifs/add.html b/template/acp/sections/tarifs/add.html index 53232a4..dfa0b6d 100644 --- a/template/acp/sections/tarifs/add.html +++ b/template/acp/sections/tarifs/add.html @@ -1,162 +1,162 @@
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Название:Локация: - - Игра: - -
    Слоты:Порты:Имя:
    Сборки:Обновления:Сервера:
    FPS:TickRate:RAM:
    Аренда:Продление:Фиксация: - -
    Тестирование: - - Тестов:Скидки: - -
    Диск:Карта:Выключение: - -
    Цена:Положение:Аренда: - -
    Ядра:
    Сборки:
    Адреса:
    Плагины:
    Разделы: - - - - - - -
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Название:Локация: + + Игра: + +
    Слоты:Порты:Имя:
    Сборки:Обновления:Сервера:
    FPS:TickRate:RAM:
    Аренда:Продление:Фиксация: + +
    Тестирование: + + Тестов:Скидки: + +
    Диск:Карта:Выключение: + +
    Цена:Положение:Аренда: + +
    Ядра:
    Сборки:
    Адреса:
    Плагины:
    Разделы: + + + + + + +
    @@ -164,20 +164,20 @@
    Информация по портам
    - - - - - + + + + +
    -

    Counter-Strike: 1.6 - по умолчанию: 27015 / для тарифов: 27016-27056 (40 шт.)

    -

    Counter-Strike: Source v34 - по умолчанию: 27015 / для тарифов: 27016-27056 (40 шт.)

    -

    Counter-Strike: Source - по умолчанию: 27015 / для тарифов: 27016-27056 (40 шт.)

    -

    Counter-Strike: Global Offensive - по умолчанию: 27015 / для тарифов: 27016-27036 (20 шт.)

    -

    San Andreas Multiplayer - по умолчанию: 7777 / для тарифов: 7778-7858 (80 шт.)

    -

    GTA: Criminal Russia - по умолчанию: 7777 / для тарифов: 7778-7858 (80 шт.)

    -

    Multi Theft Auto - по умолчанию: 22003 / для тарифов: 22004-22084 (80 шт.)

    -

    Minecraft - по умолчанию: 25565 / для тарифов: 25566-25606 (40 шт.)

    -
    +

    Counter-Strike: 1.6 - по умолчанию: 27015 / для тарифов: 27016-27056 (40 шт.)

    +

    Counter-Strike: Source v34 - по умолчанию: 27015 / для тарифов: 27016-27056 (40 шт.)

    +

    Counter-Strike: Source - по умолчанию: 27015 / для тарифов: 27016-27056 (40 шт.)

    +

    Counter-Strike: Global Offensive - по умолчанию: 27015 / для тарифов: 27016-27036 (20 шт.)

    +

    San Andreas Multiplayer - по умолчанию: 7777 / для тарифов: 7778-7858 (80 шт.)

    +

    GTA: Criminal Russia - по умолчанию: 7777 / для тарифов: 7778-7858 (80 шт.)

    +

    Multi Theft Auto - по умолчанию: 22003 / для тарифов: 22004-22084 (80 шт.)

    +

    Minecraft - по умолчанию: 25565 / для тарифов: 25566-25606 (40 шт.)

    +
    @@ -185,19 +185,19 @@
    Информация по полям
    - - - - - + + + + +
    -

    Фиксация - если установлено "фиксированные праметры", то например, указав 4000 Mb RAM - будут выделяться на 1 сервер

    -

    Скидки - если включено, то аренда / продление будут со скидками и наценками установленными в настройках

    -

    Выключение - если включено, то сервер будет выключаться автоматически (например для тарифа ClanWar)

    -

    Сборки - указывать в специальном формате перечисляя через запятую, пример: "name":"Название","name":"Название"

    -

    Ядра - если указаны ядра, то каждому серверу будет выдаваться выделенное ядро из списка

    -

    Адреса - если указаны адреса, то каждому серверу будет выдаваться выделенный адрес с стандартным портом игры

    -

    Плагины - плагины, которые установлены в сборке, указывать в специальном формате, пример: "name":"5,10,30,11","name":"10,7"

    -
    +

    Фиксация - если установлено "фиксированные праметры", то например, указав 4000 Mb RAM - будут выделяться на 1 сервер

    +

    Скидки - если включено, то аренда / продление будут со скидками и наценками установленными в настройках

    +

    Выключение - если включено, то сервер будет выключаться автоматически (например для тарифа ClanWar)

    +

    Сборки - указывать в специальном формате перечисляя через запятую, пример: "name":"Название","name":"Название"

    +

    Ядра - если указаны ядра, то каждому серверу будет выдаваться выделенное ядро из списка

    +

    Адреса - если указаны адреса, то каждому серверу будет выдаваться выделенный адрес с стандартным портом игры

    +

    Плагины - плагины, которые установлены в сборке, указывать в специальном формате, пример: "name":"5,10,30,11","name":"10,7"

    +
    \ No newline at end of file diff --git a/template/acp/sections/tarifs/copy.html b/template/acp/sections/tarifs/copy.html index 2e2857a..f412346 100644 --- a/template/acp/sections/tarifs/copy.html +++ b/template/acp/sections/tarifs/copy.html @@ -1,120 +1,120 @@
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Название:Локация:Игра:
    Слоты:Порты:Имя:
    Сборки:Обновления:Сервера:
    FPS:TickRate:RAM:
    Аренда:Продление:Фиксация:
    Тестирование:Тестов:Скидки:
    Диск:Карта:Выключение:
    Цена:Положение:Аренда:
    Ядра:
    Сборки:
    Адреса:
    Плагины:
    Разделы: - - - - - - -
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Название:Локация:Игра:
    Слоты:Порты:Имя:
    Сборки:Обновления:Сервера:
    FPS:TickRate:RAM:
    Аренда:Продление:Фиксация:
    Тестирование:Тестов:Скидки:
    Диск:Карта:Выключение:
    Цена:Положение:Аренда:
    Ядра:
    Сборки:
    Адреса:
    Плагины:
    Разделы: + + + + + + +
    \ No newline at end of file diff --git a/template/acp/sections/tarifs/index.html b/template/acp/sections/tarifs/index.html index 50e89f8..9d57be2 100644 --- a/template/acp/sections/tarifs/index.html +++ b/template/acp/sections/tarifs/index.html @@ -1,6 +1,6 @@
    @@ -8,33 +8,33 @@
    - - - - - - - - - - - - - - [list] - + + + + + + + + + + + + + + [list] +
    НазваниеЛокация СлотыПортыИгра
    НазваниеЛокация СлотыПортыИгра
    [pages] \ No newline at end of file diff --git a/template/acp/sections/tarifs/menu.html b/template/acp/sections/tarifs/menu.html index 66abcf3..82270b3 100644 --- a/template/acp/sections/tarifs/menu.html +++ b/template/acp/sections/tarifs/menu.html @@ -1,7 +1,7 @@
    Управление
    \ No newline at end of file diff --git a/template/acp/sections/tarifs/stats.html b/template/acp/sections/tarifs/stats.html index 0da2e30..64e78f6 100644 --- a/template/acp/sections/tarifs/stats.html +++ b/template/acp/sections/tarifs/stats.html @@ -3,18 +3,18 @@
    - - - - - - - - - - - - - [list] - + + + + + + + + + + + + + [list] +
    НазваниеЛокацияВсего/ПросроченныхЗа все времяЗа [month]Игра
    НазваниеЛокацияВсего/ПросроченныхЗа все времяЗа [month]Игра
    \ No newline at end of file diff --git a/template/acp/sections/tarifs/tarif.html b/template/acp/sections/tarifs/tarif.html index 37d7ba0..a973d02 100644 --- a/template/acp/sections/tarifs/tarif.html +++ b/template/acp/sections/tarifs/tarif.html @@ -1,120 +1,120 @@
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Название:Локация:Игра:
    Слоты:Порты:Имя:
    Сборки:Обновления:Сервера:
    FPS:TickRate:RAM:
    Аренда:Продление:Фиксация:
    Тестирование:Тестов:Скидки:
    Диск:Карта:Выключение:
    Цена:Положение:Аренда:
    Ядра:
    Сборки:
    Адреса:
    Плагины:
    Разделы: - - - - - - -
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Название:Локация:Игра:
    Слоты:Порты:Имя:
    Сборки:Обновления:Сервера:
    FPS:TickRate:RAM:
    Аренда:Продление:Фиксация:
    Тестирование:Тестов:Скидки:
    Диск:Карта:Выключение:
    Цена:Положение:Аренда:
    Ядра:
    Сборки:
    Адреса:
    Плагины:
    Разделы: + + + + + + +
    \ No newline at end of file diff --git a/template/acp/sections/units/add.html b/template/acp/sections/units/add.html index 670de57..65f15c1 100644 --- a/template/acp/sections/units/add.html +++ b/template/acp/sections/units/add.html @@ -1,85 +1,85 @@
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Название:Адрес:Пароль:
    SQL_Логин:SQL_Пароль:SQL_FileTP:
    SQL_Порт:RAM:Аренда: - -
    Тестов:Положение:Домен:
    Игры: - - - - - - - - -
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Название:Адрес:Пароль:
    SQL_Логин:SQL_Пароль:SQL_FileTP:
    SQL_Порт:RAM:Аренда: + +
    Тестов:Положение:Домен:
    Игры: + + + + + + + + +
    diff --git a/template/acp/sections/units/index.html b/template/acp/sections/units/index.html index f51aa84..e3f6bcc 100644 --- a/template/acp/sections/units/index.html +++ b/template/acp/sections/units/index.html @@ -1,17 +1,17 @@ - - - - - - - - - - - - [list] - + + + + + + + + + + + + [list] +
    НазваниеАдресАрендаДомен
    НазваниеАдресАрендаДомен
    \ No newline at end of file diff --git a/template/acp/sections/units/loading.html b/template/acp/sections/units/loading.html index 3a15bb5..51aa0d3 100644 --- a/template/acp/sections/units/loading.html +++ b/template/acp/sections/units/loading.html @@ -1,25 +1,25 @@ - - - - - - - - - - - - - - - - [list] - + + + + + + + + + + + + + + + + [list] +
    НазваниеCPURAMHDDApacheNginxMySQLUptimeSSH
    НазваниеCPURAMHDDApacheNginxMySQLUptimeSSH
    \ No newline at end of file diff --git a/template/acp/sections/units/menu.html b/template/acp/sections/units/menu.html index 495052c..a345e31 100644 --- a/template/acp/sections/units/menu.html +++ b/template/acp/sections/units/menu.html @@ -1,8 +1,8 @@
    Управление
    \ No newline at end of file diff --git a/template/acp/sections/units/stats.html b/template/acp/sections/units/stats.html index e87a6b3..f4f06f3 100644 --- a/template/acp/sections/units/stats.html +++ b/template/acp/sections/units/stats.html @@ -3,18 +3,18 @@
    - - - - - - - - - - - - - [list] - + + + + + + + + + + + + + [list] +
    НазваниеАрендаВсего серверовПросроченныхЗа все времяЗа [month]
    НазваниеАрендаВсего серверовПросроченныхЗа все времяЗа [month]
    \ No newline at end of file diff --git a/template/acp/sections/units/unit.html b/template/acp/sections/units/unit.html index e4fd740..30298ae 100644 --- a/template/acp/sections/units/unit.html +++ b/template/acp/sections/units/unit.html @@ -1,82 +1,82 @@
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Название:Адрес:Пароль:
    SQL_Логин:SQL_Пароль:SQL_FileTP:
    SQL_Порт:RAM:Аренда: - -
    Тестов:Положение:Домен:
    Игры: - - - - - - - - -
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Название:Адрес:Пароль:
    SQL_Логин:SQL_Пароль:SQL_FileTP:
    SQL_Порт:RAM:Аренда: + +
    Тестов:Положение:Домен:
    Игры: + + + + + + + + +
    \ No newline at end of file diff --git a/template/acp/sections/users/index.html b/template/acp/sections/users/index.html index 22d75fc..545e38a 100644 --- a/template/acp/sections/users/index.html +++ b/template/acp/sections/users/index.html @@ -1,6 +1,6 @@
    @@ -8,31 +8,31 @@
    - - - - - - - - - - - - [list] - + + + + + + + + + + + + [list] +
    # ЛогинПочтаБаланс Группа
    # ЛогинПочтаБаланс Группа
    [pages] \ No newline at end of file diff --git a/template/acp/sections/users/menu.html b/template/acp/sections/users/menu.html index aeb8210..90cbd7d 100644 --- a/template/acp/sections/users/menu.html +++ b/template/acp/sections/users/menu.html @@ -1,9 +1,9 @@
    Управление
    \ No newline at end of file diff --git a/template/acp/sections/users/offline.html b/template/acp/sections/users/offline.html index d393eb6..92b54a2 100644 --- a/template/acp/sections/users/offline.html +++ b/template/acp/sections/users/offline.html @@ -1,17 +1,17 @@ - - - - - - - - - - - - [list] - + + + + + + + + + + + + [list] +
    ЛогинПочтаГруппаПоследний визит
    ЛогинПочтаГруппаПоследний визит
    \ No newline at end of file diff --git a/template/acp/sections/users/online.html b/template/acp/sections/users/online.html index 4292148..3b82c47 100644 --- a/template/acp/sections/users/online.html +++ b/template/acp/sections/users/online.html @@ -1,18 +1,18 @@ - - - - - - - - - - - - - [list] - + + + + + + + + + + + + + [list] +
    ЛогинГруппаБраузерАдресСтрана
    ЛогинГруппаБраузерАдресСтрана
    \ No newline at end of file diff --git a/template/acp/sections/users/signup.html b/template/acp/sections/users/signup.html index c8eaa6a..1e726c7 100644 --- a/template/acp/sections/users/signup.html +++ b/template/acp/sections/users/signup.html @@ -1,16 +1,16 @@ - - - - - - - - - - - [list] - + + + + + + + + + + + [list] +
    ПочтаКлючВремя
    ПочтаКлючВремя
    \ No newline at end of file diff --git a/template/acp/sections/users/stats.html b/template/acp/sections/users/stats.html index bed19a3..0721738 100644 --- a/template/acp/sections/users/stats.html +++ b/template/acp/sections/users/stats.html @@ -1,14 +1,14 @@ - - - - - - - - - - + + + + + + + + + +
    Пользователей с положительным балансом:[users] шт.
    Cумма балансов пользователей:[money] [cur]
    Пользователей с положительным балансом:[users] шт.
    Cумма балансов пользователей:[money] [cur]
    @@ -16,16 +16,16 @@
    Пользователи с большим балансом
    - - - - - - - - - - - [list] - + + + + + + + + + + + [list] +
    ЛогинПочтаБалансСерверов
    ЛогинПочтаБалансСерверов
    \ No newline at end of file diff --git a/template/acp/sections/users/user.html b/template/acp/sections/users/user.html index c2bd951..d4fd99b 100644 --- a/template/acp/sections/users/user.html +++ b/template/acp/sections/users/user.html @@ -3,78 +3,78 @@
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
    Логин:Имя:Баланс:[balance] [cur]
    Пароль:Фамилия:Пополнить:
    Почта:Отчество:Изменить:
    Контакты:Номер:Тел:
    Персональные скидки нааренду:продление:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - |!support| - - - - - - |_!support| + |!support| + + + + + + |_!support| - |support| - - - - - - - - - |_support| + |support| + + + + + + + + + |_support| - - - - - - - - - - -
    Логин:Имя:Баланс:[balance] [cur]
    Пароль:Фамилия:Пополнить:
    Почта:Отчество:Изменить:
    Контакты:Номер:Тел:
    Персональные скидки нааренду:продление:
    Группа:
    Группа:
    Группа:Уровень:Подпись:
    Группа:Уровень:Подпись:
    Заработано:
    + + + + Заработано: + + + + + + +
    |support| @@ -83,15 +83,15 @@
    Информация по уровням технической поддержки
    - - - - - + + + + +
    -

    Уровень 0 - тех. поддержка не имеет доступа к игровым серверам.

    -

    Уровень 1 - тех. поддержка имеет доступа к игровому серверу только во время открытыго тикета по серверу.

    -

    Уровень 2 - тех. поддержка имеет постоянный доступ к игровым серверам.

    -
    +

    Уровень 0 - тех. поддержка не имеет доступа к игровым серверам.

    +

    Уровень 1 - тех. поддержка имеет доступа к игровому серверу только во время открытыго тикета по серверу.

    +

    Уровень 2 - тех. поддержка имеет постоянный доступ к игровым серверам.

    +
    |_support| @@ -101,12 +101,12 @@ - + - + @@ -120,24 +120,24 @@
    Финансовая статистика
    # Адрес Тариф СтатусИграИгра Аренда
    - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + +
    Затрачено за [month][money_month] [cur]
    Всего затрачено средств[money_all] [cur]
    Затрачено средств на продление[money_extend] [cur]
    Затрачено средств на аренду[money_buy] [cur]
    Затрачено за [month][money_month] [cur]
    Всего затрачено средств[money_all] [cur]
    Затрачено средств на продление[money_extend] [cur]
    Затрачено средств на аренду[money_buy] [cur]
    @@ -145,15 +145,15 @@
    Последние операции
    - - - - - - - - [logs] - + + + + + + + + [logs] +
    ОперацияДата
    ОперацияДата
    @@ -161,17 +161,17 @@
    Последние авторизации
    - - - - - - - - - - [auth] - + + + + + + + + + + [auth] +
    БраузерАдресСтранаДата
    БраузерАдресСтранаДата
    \ No newline at end of file diff --git a/template/acp/sections/web/index.html b/template/acp/sections/web/index.html index 4010761..7ef827b 100644 --- a/template/acp/sections/web/index.html +++ b/template/acp/sections/web/index.html @@ -1,6 +1,6 @@
    @@ -8,27 +8,27 @@
    - - - - - - - - - - - - [list] - + + + + + + + + + + + + [list] +
    Номер / УслугаВладелец / СерверАдрес / РасположениеЛогин / ПарольДата создания
    Номер / УслугаВладелец / СерверАдрес / РасположениеЛогин / ПарольДата создания
    [pages] \ No newline at end of file diff --git a/template/acp/sections/web/menu.html b/template/acp/sections/web/menu.html index a2a2846..c0539e8 100644 --- a/template/acp/sections/web/menu.html +++ b/template/acp/sections/web/menu.html @@ -1,11 +1,11 @@
    Управление
    \ No newline at end of file diff --git a/template/acp/sections/wiki/add.html b/template/acp/sections/wiki/add.html index f6ffbba..55af454 100644 --- a/template/acp/sections/wiki/add.html +++ b/template/acp/sections/wiki/add.html @@ -1,36 +1,36 @@
    - - - - - - - - - - - - - - - - - - - - -
    Вопрос: - - Категория: - - Теги: - -
    -
    Спойлер
    -
    Подсветка
    -
    Цитата
    -
    Ссылка
    -
    + + + + + + + + + + + + + + + + + + + + +
    Вопрос: + + Категория: + + Теги: + +
    +
    Спойлер
    +
    Подсветка
    +
    Цитата
    +
    Ссылка
    +
    \ No newline at end of file diff --git a/template/acp/sections/wiki/addcat.html b/template/acp/sections/wiki/addcat.html index d955dfd..e914474 100644 --- a/template/acp/sections/wiki/addcat.html +++ b/template/acp/sections/wiki/addcat.html @@ -1,17 +1,17 @@
    - - - - - - - - - - - - -
    Название:Положение:
    + + + + + + + + + + + + +
    Название:Положение:
    \ No newline at end of file diff --git a/template/acp/sections/wiki/cat.html b/template/acp/sections/wiki/cat.html index 1fc8a9a..a2d6a31 100644 --- a/template/acp/sections/wiki/cat.html +++ b/template/acp/sections/wiki/cat.html @@ -1,17 +1,17 @@
    - - - - - - - - - - - - -
    Название:Положение:
    + + + + + + + + + + + + +
    Название:Положение:
    \ No newline at end of file diff --git a/template/acp/sections/wiki/cats.html b/template/acp/sections/wiki/cats.html index be95ba4..7ab64ad 100644 --- a/template/acp/sections/wiki/cats.html +++ b/template/acp/sections/wiki/cats.html @@ -1,16 +1,16 @@ - - - - - - - - - - - [list] - + + + + + + + + + + + [list] +
    #НазваниеОтветовПоложение
    #НазваниеОтветовПоложение
    \ No newline at end of file diff --git a/template/acp/sections/wiki/index.html b/template/acp/sections/wiki/index.html index 980e7a3..34feb08 100644 --- a/template/acp/sections/wiki/index.html +++ b/template/acp/sections/wiki/index.html @@ -1,6 +1,6 @@
    @@ -8,26 +8,26 @@
    - - - - - - - - - - - [list] - + + + + + + + + + + + [list] +
    ВопросКатегорияДата
    ВопросКатегорияДата
    [pages] \ No newline at end of file diff --git a/template/acp/sections/wiki/menu.html b/template/acp/sections/wiki/menu.html index 11e3db9..1463fe9 100644 --- a/template/acp/sections/wiki/menu.html +++ b/template/acp/sections/wiki/menu.html @@ -1,8 +1,8 @@
    Управление
    \ No newline at end of file diff --git a/template/acp/sections/wiki/wiki.html b/template/acp/sections/wiki/wiki.html index 14ecfbf..8e7c285 100644 --- a/template/acp/sections/wiki/wiki.html +++ b/template/acp/sections/wiki/wiki.html @@ -1,36 +1,36 @@
    - - - - - - - - - - - - - - - - - - - - -
    Вопрос: - - Категория: - - Теги: - -
    -
    Спойлер
    -
    Подсветка
    -
    Цитата
    -
    Ссылка
    -
    + + + + + + + + + + + + + + + + + + + + +
    Вопрос: + + Категория: + + Теги: + +
    +
    Спойлер
    +
    Подсветка
    +
    Цитата
    +
    Ссылка
    +
    \ No newline at end of file diff --git a/template/css/bootbox.css b/template/css/bootbox.css index c683693..b3564da 100644 --- a/template/css/bootbox.css +++ b/template/css/bootbox.css @@ -1,26 +1,26 @@ .fade { - opacity:0; - -webkit-transition:opacity .15s linear; - -moz-transition:opacity .15s linear; - -o-transition:opacity .15s linear; - transition:opacity .15s linear + opacity:0; + -webkit-transition:opacity .15s linear; + -moz-transition:opacity .15s linear; + -o-transition:opacity .15s linear; + transition:opacity .15s linear } .fade.in{ - opacity:1 + opacity:1 } .modal-backdrop { - position:fixed; - top:0; - right:0; - bottom:0; - left:0; - z-index:1040; - background-color:#000 + position:fixed; + top:0; + right:0; + bottom:0; + left:0; + z-index:1040; + background-color:#000 } .modal-backdrop.fade{ - opacity:0 + opacity:0 } .modal-backdrop,.modal-backdrop.fade.in { @@ -30,94 +30,94 @@ } .modal { - position:fixed; - top:40%; - left:45%; - z-index:1050; - width:560px; - margin-left:-280px; - background-color:#fff; - border:1px solid #EEE; - *border:1px solid #EEE; - outline:0; - -webkit-background-clip:padding-box; - -moz-background-clip:padding-box; - background-clip:padding-box + position:fixed; + top:40%; + left:45%; + z-index:1050; + width:560px; + margin-left:-280px; + background-color:#fff; + border:1px solid #EEE; + *border:1px solid #EEE; + outline:0; + -webkit-background-clip:padding-box; + -moz-background-clip:padding-box; + background-clip:padding-box } .modal.fade { - top:-25%; - -webkit-transition:opacity .3s linear,top .3s ease-out; - -moz-transition:opacity .3s linear,top .3s ease-out; - -o-transition:opacity .3s linear,top .3s ease-out; - transition:opacity .3s linear,top .3s ease-out + top:-25%; + -webkit-transition:opacity .3s linear,top .3s ease-out; + -moz-transition:opacity .3s linear,top .3s ease-out; + -o-transition:opacity .3s linear,top .3s ease-out; + transition:opacity .3s linear,top .3s ease-out } .modal.fade.in { - top:25%; - left: 50%; + top:25%; + left: 50%; } .modal-header { - padding:9px 15px; - border-bottom:1px solid #eee + padding:9px 15px; + border-bottom:1px solid #eee } .modal-header .close { - margin-top:2px + margin-top:2px } .modal-header h3 { - margin:0; - line-height:30px + margin:0; + line-height:30px } .modal-body { - position:relative; - max-height:400px; - padding:15px; - overflow-y:auto + position:relative; + max-height:400px; + padding:15px; + overflow-y:auto } .modal-form { - margin-bottom:0 + margin-bottom:0 } .modal-footer { - padding:14px 15px 15px; - margin-bottom:0; - text-align:right; - background-color:#f5f5f5; - border-top:1px solid #ddd; - -webkit-border-radius:0 0 6px 6px; - -moz-border-radius:0 0 6px 6px; - border-radius:0 0 6px 6px; - *zoom:1; - -webkit-box-shadow:inset 0 1px 0 #fff; - -moz-box-shadow:inset 0 1px 0 #fff; - box-shadow:inset 0 1px 0 #fff + padding:14px 15px 15px; + margin-bottom:0; + text-align:right; + background-color:#f5f5f5; + border-top:1px solid #ddd; + -webkit-border-radius:0 0 6px 6px; + -moz-border-radius:0 0 6px 6px; + border-radius:0 0 6px 6px; + *zoom:1; + -webkit-box-shadow:inset 0 1px 0 #fff; + -moz-box-shadow:inset 0 1px 0 #fff; + box-shadow:inset 0 1px 0 #fff } .modal-footer:before,.modal-footer:after { - display:table; - line-height:0; - content:"" + display:table; + line-height:0; + content:"" } .modal-footer:after { - clear:both + clear:both } .modal-footer .btn+.btn { - margin-bottom:0; - margin-left:5px + margin-bottom:0; + margin-left:5px } .modal-footer .btn-group .btn+.btn { - margin-left:-1px + margin-left:-1px } .modal-footer .btn-block+.btn-block { - margin-left:0 + margin-left:0 } diff --git a/template/css/chat.css b/template/css/chat.css index 88f412a..7a13907 100644 --- a/template/css/chat.css +++ b/template/css/chat.css @@ -1,36 +1,36 @@ .chat_main_head span.chat_sender > a { - display: none; + display: none; } .chat_main_head:hover span.chat_sender > a { - display: initial; + display: initial; } .chat_data a { - - text-decoration: underline; + + text-decoration: underline; } .chat_data_foot { - padding: 5px 5px 0 5px; + padding: 5px 5px 0 5px; font-size: 10px; } .chat_data_foot > div { - display: inline-block; + display: inline-block; width: 100%; margin: 5px 0; } .chat_data_foot > div > div { - width: 88px; + width: 88px; float: left; margin-right: 5px; } .chat_data_foot > div > div > a .image { - position: relative; + position: relative; height: 80px; width: 80px; border: 4px solid #fff; @@ -57,7 +57,7 @@ overflow: hidden; margin-top: 5px; border-radius: 50%; - float: left; + float: left; } .chat_msg > .chat_main { @@ -81,7 +81,7 @@ } .chat_date { - color: #888; + color: #888; float: right; font-size: 10px; margin-top: 2px; @@ -102,7 +102,7 @@ } .chat_data { - background: #fff; + background: #fff; border: 1px solid rgba(196, 196, 196, 0.47); padding: 10px; color: #000; @@ -112,10 +112,10 @@ font-family: 'Exo 2', sans-serif; font-style: italic; font-weight: 300; - -webkit-box-shadow: 0 1px 1px rgba(0,0,0,0.05); + -webkit-box-shadow: 0 1px 1px rgba(0,0,0,0.05); -moz-box-shadow: 0 1px 1px rgba(0,0,0,0.05); box-shadow: 0 1px 1px rgba(0,0,0,0.05); - word-wrap: break-word; + word-wrap: break-word; } .chat_msg_ava img { @@ -126,109 +126,109 @@ } #dialog { - height: 500px; - overflow-y: scroll; + height: 500px; + overflow-y: scroll; } .emoji { - display: inline-block; - background: url(../images/emoji.png) no-repeat 0px 0px; - height: 16px; - width: 16px; + display: inline-block; + background: url(../images/emoji.png) no-repeat 0px 0px; + height: 16px; + width: 16px; } .emoji_1 { - background-position: 0px 0px; + background-position: 0px 0px; } .emoji_2 { - background-position: 0px -17px; + background-position: 0px -17px; } .emoji_3 { - background-position: 0px -34px; + background-position: 0px -34px; } .emoji_4 { - background-position: 0px -51px; + background-position: 0px -51px; } .emoji_5 { - background-position: 0px -68px; + background-position: 0px -68px; } .emoji_6 { - background-position: 0px -85px; + background-position: 0px -85px; } .emoji_7 { - background-position: 0px -102px; + background-position: 0px -102px; } .emoji_8 { - background-position: 0px -119px; + background-position: 0px -119px; } .emoji_9 { - background-position: 0px -136px; + background-position: 0px -136px; } .emoji_10 { - background-position: 0px -153px; + background-position: 0px -153px; } .emoji_11 { - background-position: 0px -170px; + background-position: 0px -170px; } .emoji_12 { - background-position: 0px -187px; + background-position: 0px -187px; } .emoji_13 { - background-position: 0px -204px; + background-position: 0px -204px; } .emoji_14 { - background-position: 0px -221px; + background-position: 0px -221px; } .emoji_15 { - background-position: 0px -238px; + background-position: 0px -238px; } .emoji_16 { - background-position: 0px -255px; + background-position: 0px -255px; } .emoji_17 { - background-position: 0px -272px; + background-position: 0px -272px; } .emoji_18 { - background-position: 0px -289px; + background-position: 0px -289px; } .emoji_19 { - background-position: 0px -306px; + background-position: 0px -306px; } .emoji_20 { - background-position: 0px -323px; + background-position: 0px -323px; } .emoji_21 { - background-position: 0px -340px; + background-position: 0px -340px; } .emoji_22 { - background-position: 0px -357px; + background-position: 0px -357px; } .emoji_23 { - background-position: 0px -374px; + background-position: 0px -374px; } .emoji_24 { - background-position: 0px -391px; + background-position: 0px -391px; } .emoji_25 { - background-position: 0px -408px; + background-position: 0px -408px; } .emoji_26 { - background-position: 0px -425px; + background-position: 0px -425px; } .emoji_27 { - background-position: 0px -442px; + background-position: 0px -442px; } .emoji_28 { - background-position: 0px -459px; + background-position: 0px -459px; } .emoji_29 { - background-position: 0px -476px; + background-position: 0px -476px; } .emoji_30 { - background-position: 0px -493px; + background-position: 0px -493px; } .emoji_31 { - background-position: 0px -510px; + background-position: 0px -510px; } .emoji_32 { - background-position: 0px -527px; + background-position: 0px -527px; } \ No newline at end of file diff --git a/template/css/date.css b/template/css/date.css index cda843a..27850b8 100644 --- a/template/css/date.css +++ b/template/css/date.css @@ -1,6 +1,6 @@ .dropdown-menu { - -webkit-border-radius: 0!important; + -webkit-border-radius: 0!important; -moz-border-radius: 0!important; border-radius: 0!important; -webkit-box-shadow: 0 2px 4px rgba(0,0,0,0.2); @@ -14,8 +14,8 @@ border-radius: 4px; direction: ltr; /*.dow { - border-top: 1px solid #ddd !important; - }*/ + border-top: 1px solid #ddd !important; + }*/ } .datepicker-inline { diff --git a/template/css/error.css b/template/css/error.css index e9d0176..705741d 100644 --- a/template/css/error.css +++ b/template/css/error.css @@ -1,102 +1,102 @@ * { - padding: 0; - margin: 0; - -webkit-box-sizing: content-box; - -moz-box-sizing: content-box; - -ms-box-sizing: content-box; - -o-box-sizing: content-box; - box-sizing: content-box; + padding: 0; + margin: 0; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + -ms-box-sizing: content-box; + -o-box-sizing: content-box; + box-sizing: content-box; } html { - font-family: 'Open Sans'; - font-size: 14px; - background-color: #c73f33; - color: #000; + font-family: 'Open Sans'; + font-size: 14px; + background-color: #c73f33; + color: #000; } html, body { - height: 100%; + height: 100%; } .error, .content { - width: 1000px; + width: 1000px; } .error { - width: 1000px; - height: 375px; - margin: 0 auto; + width: 1000px; + height: 375px; + margin: 0 auto; } .error-403 { - background: url('../images/error/403.jpg') center top no-repeat; + background: url('../images/error/403.jpg') center top no-repeat; } .error-404 { - background: url('../images/error/404.jpg') center top no-repeat; + background: url('../images/error/404.jpg') center top no-repeat; } .fail-replenish { - background: url('../images/error/fail.jpg') center top no-repeat; + background: url('../images/error/fail.jpg') center top no-repeat; } .info-403, .info-404, .info-fail { - padding: 5px; - text-align: center; - text-transform: uppercase; - border: 4px solid #000; - border-radius: 30px; - font-size: 33px; + padding: 5px; + text-align: center; + text-transform: uppercase; + border: 4px solid #000; + border-radius: 30px; + font-size: 33px; } .info-404 { - font-size: 28px; + font-size: 28px; } .info-fail { - font-size: 22px; + font-size: 22px; } .content { - margin: 0 auto; + margin: 0 auto; } .content ul { - margin-top: 15px; - text-align: center; + margin-top: 15px; + text-align: center; } .content ul li { - list-style-type: none; - display: inline-block; + list-style-type: none; + display: inline-block; } .content ul li a { - color: #000; - display: inline-block; - margin: 10px; - font-size: 21px; - text-transform: uppercase; + color: #000; + display: inline-block; + margin: 10px; + font-size: 21px; + text-transform: uppercase; } .content ul li a:hover { - text-decoration: none; + text-decoration: none; } \ No newline at end of file diff --git a/template/css/help.css b/template/css/help.css index 321cd95..2bc6a02 100644 --- a/template/css/help.css +++ b/template/css/help.css @@ -1,6 +1,6 @@ #drop-files { - position: relative; + position: relative; width: 99%; height: 56px; margin: 0 auto; @@ -11,28 +11,28 @@ } #drop-files p { - clear: none; - padding: 0; - margin: 0; + clear: none; + padding: 0; + margin: 0; } #uploaded-holder { - display: none; - position: relative; - margin: 0 auto 10px; - width: 100%; + display: none; + position: relative; + margin: 0 auto 10px; + width: 100%; } #dropped-files { - display: block; - margin: 0 auto; - width: 100% + display: block; + margin: 0 auto; + width: 100% } #upload-button { - z-index: 9999; - display: none; - margin: 5px 0; + z-index: 9999; + display: none; + margin: 5px 0; } .drop-button, .success-button { @@ -47,7 +47,7 @@ } .drop-button { - background-color: #b07474 + background-color: #b07474 } .success-button { @@ -64,62 +64,62 @@ float: left; overflow: hidden; background-size: contain !important; - background-repeat: no-repeat !important; + background-repeat: no-repeat !important; text-align: center; } #upload-button .ss-upload { - font-size: 0.7em; + font-size: 0.7em; } #upload-button span { - position: relative; - text-align: center; - background: white; - font-size: 15px; - padding: 5px; - margin-right: 8px; + position: relative; + text-align: center; + background: white; + font-size: 15px; + padding: 5px; + margin-right: 8px; } #loading { - width: 100%; - position: relative; - margin: 5px 0; + width: 100%; + position: relative; + margin: 5px 0; } #loading-bar { - width: 100%; - height: 16px; - background: #fff; - box-shadow: 0 0 15px rgba(0,0,0,0.1); - border-radius: 5px; - padding: 2px; + width: 100%; + height: 16px; + background: #fff; + box-shadow: 0 0 15px rgba(0,0,0,0.1); + border-radius: 5px; + padding: 2px; } .loading-color { - width: 0%; - height: 100%; - -webkit-transition: all 0.1s ease-in; - -moz-transition: all 0.1s ease-in; - -ms-transition: all 0.1s ease-in; - -o-transition: all 0.1s ease-in; - transition: all 0.1s ease-in; - border-radius: inherit; - background-color: #4edbf1; + width: 0%; + height: 100%; + -webkit-transition: all 0.1s ease-in; + -moz-transition: all 0.1s ease-in; + -ms-transition: all 0.1s ease-in; + -o-transition: all 0.1s ease-in; + transition: all 0.1s ease-in; + border-radius: inherit; + background-color: #4edbf1; } #loading-content { - position: relative; - font-size: 13px; - font-weight: bold; - text-align: center; - width: 100%; + position: relative; + font-size: 13px; + font-weight: bold; + text-align: center; + width: 100%; } #file-name-holder { - width: 100%; - float: left; + width: 100%; + float: left; } #file-name-holder h1 { @@ -130,52 +130,52 @@ #drop-files input { - border: 0; + border: 0; background-color: #ffffff; width: initial; } #uploaded-files .img-block:nth-child(8), #dropped-files .img-block:nth-child(9) { - margin-right: 0px; + margin-right: 0px; } .img-block { - width: 108px; + width: 108px; float: left; - margin-right: 12px + margin-right: 12px } .help_main_head span.help_sender > a { - display: none; + display: none; } .help_main_head:hover span.help_sender > a { - display: initial; + display: initial; } .help_data a { - text-decoration: underline; + text-decoration: underline; } .help_data_foot { - padding: 5px 5px 0 5px; + padding: 5px 5px 0 5px; font-size: 10px; } .help_data_foot > div { - display: inline-block; + display: inline-block; width: 100%; margin: 5px 0; } .help_data_foot > div > div { - width: 88px; + width: 88px; float: left; margin-right: 5px; } .help_data_foot > div > div > a .image { - position: relative; + position: relative; height: 80px; width: 80px; border: 4px solid #fff; @@ -202,7 +202,7 @@ overflow: hidden; margin-top: 5px; border-radius: 50%; - float: right; + float: right; } .help_msg > .help_main { @@ -226,7 +226,7 @@ } .help_date { - color: #888; + color: #888; float: right; font-size: 10px; margin-top: 2px; @@ -247,7 +247,7 @@ } .help_data { - background: #fff; + background: #fff; border: 1px solid rgba(196, 196, 196, 0.47); padding: 10px; color: #555; @@ -257,10 +257,10 @@ font-family: 'Exo 2', sans-serif; font-style: italic; font-weight: 300; - -webkit-box-shadow: 0 1px 1px rgba(0,0,0,0.05); + -webkit-box-shadow: 0 1px 1px rgba(0,0,0,0.05); -moz-box-shadow: 0 1px 1px rgba(0,0,0,0.05); box-shadow: 0 1px 1px rgba(0,0,0,0.05); - word-wrap: break-word; + word-wrap: break-word; } .help_msg_ava img { diff --git a/template/css/img.css b/template/css/img.css index 2293931..f214cff 100644 --- a/template/css/img.css +++ b/template/css/img.css @@ -1,320 +1,320 @@ #fancybox-loading { - position: fixed; - top: 50%; - left: 50%; - height: 40px; - width: 40px; - margin-top: -20px; - margin-left: -20px; - cursor: pointer; - overflow: hidden; - background: transparent; - z-index: 1104; - display: none; + position: fixed; + top: 50%; + left: 50%; + height: 40px; + width: 40px; + margin-top: -20px; + margin-left: -20px; + cursor: pointer; + overflow: hidden; + background: transparent; + z-index: 1104; + display: none; } * html #fancybox-loading { - position: absolute; - margin-top: 0; + position: absolute; + margin-top: 0; } #fancybox-loading div { - position: absolute; - top: 0; - left: 0; - width: 40px; - height: 480px; - background: transparent url('../images/icons/box/fancy_loading.png') no-repeat; + position: absolute; + top: 0; + left: 0; + width: 40px; + height: 480px; + background: transparent url('../images/icons/box/fancy_loading.png') no-repeat; } #fancybox-overlay { - position: fixed; - top: 0; - left: 0; - bottom: 0; - right: 0; - background: #000; - z-index: 1100; - display: none; + position: fixed; + top: 0; + left: 0; + bottom: 0; + right: 0; + background: #000; + z-index: 1100; + display: none; } * html #fancybox-overlay { - position: absolute; - width: 100%; + position: absolute; + width: 100%; } #fancybox-tmp { - padding: 0; - margin: 0; - border: 0; - overflow: auto; - display: none; + padding: 0; + margin: 0; + border: 0; + overflow: auto; + display: none; } #fancybox-wrap { - position: absolute; - top: 0; - left: 0; - margin: 0; - padding: 20px; - z-index: 1101; - display: none; + position: absolute; + top: 0; + left: 0; + margin: 0; + padding: 20px; + z-index: 1101; + display: none; } #fancybox-outer { - position: relative; - width: 100%; - height: 100%; - background: #FFF; + position: relative; + width: 100%; + height: 100%; + background: #FFF; } #fancybox-inner { - position: absolute; - top: 0; - left: 0; - width: 1px; - height: 1px; - padding: 0; - margin: 0; - outline: none; - overflow: hidden; + position: absolute; + top: 0; + left: 0; + width: 1px; + height: 1px; + padding: 0; + margin: 0; + outline: none; + overflow: hidden; } #fancybox-hide-sel-frame { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - background: transparent; + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + background: transparent; } #fancybox-close { - position: absolute; - top: -15px; - right: -15px; - width: 32px; - height: 32px; - background: url('../images/icons/box/fancy_close.png') top left no-repeat; - cursor: pointer; - z-index: 1103; - display: none; + position: absolute; + top: -15px; + right: -15px; + width: 32px; + height: 32px; + background: url('../images/icons/box/fancy_close.png') top left no-repeat; + cursor: pointer; + z-index: 1103; + display: none; } #fancybox_error { - color: #444; - font: normal 12px/20px Arial; + color: #444; + font: normal 12px/20px Arial; } #fancybox-content { - height: auto; - width: auto; - padding: 0; - margin: 0; + height: auto; + width: auto; + padding: 0; + margin: 0; } #fancybox-img { - width: 100%; - height: 100%; - padding: 0; - margin: 0; - border: none; - outline: none; - line-height: 0; - vertical-align: top; - -ms-interpolation-mode: bicubic; + width: 100%; + height: 100%; + padding: 0; + margin: 0; + border: none; + outline: none; + line-height: 0; + vertical-align: top; + -ms-interpolation-mode: bicubic; } #fancybox-frame { - position: relative; - width: 100%; - height: 100%; - border: none; - display: block; + position: relative; + width: 100%; + height: 100%; + border: none; + display: block; } #fancybox-title { - position: absolute; - bottom: 0; - left: 0; - font-family: Arial; - font-size: 12px; - z-index: 1102; + position: absolute; + bottom: 0; + left: 0; + font-family: Arial; + font-size: 12px; + z-index: 1102; } .fancybox-title-inside { - padding: 10px 0; - text-align: center; - color: #333; + padding: 10px 0; + text-align: center; + color: #333; } .fancybox-title-outside { - padding-top: 5px; - color: #FFF; - text-align: center; - font-weight: bold; + padding-top: 5px; + color: #FFF; + text-align: center; + font-weight: bold; } .fancybox-title-over { - color: #FFF; - text-align: left; + color: #FFF; + text-align: left; } #fancybox-title-over { - padding: 10px; - background: url('../images/icons/box/fancy_title_over.png'); - display: block; + padding: 10px; + background: url('../images/icons/box/fancy_title_over.png'); + display: block; } #fancybox-title-wrap { - display: inline-block; + display: inline-block; } #fancybox-title-wrap span { - height: 32px; - float: left; + height: 32px; + float: left; } #fancybox-title-left { - padding-left: 15px; - background: transparent url('../images/icons/box/fancy_title_left.png') repeat-x; + padding-left: 15px; + background: transparent url('../images/icons/box/fancy_title_left.png') repeat-x; } #fancybox-title-main { - font-weight: bold; - line-height: 29px; - background: transparent url('../images/icons/box/fancy_title_main.png') repeat-x; - color: #FFF; + font-weight: bold; + line-height: 29px; + background: transparent url('../images/icons/box/fancy_title_main.png') repeat-x; + color: #FFF; } #fancybox-title-right { - padding-left: 15px; - background: transparent url('../images/icons/box/fancy_title_right.png') repeat-x; + padding-left: 15px; + background: transparent url('../images/icons/box/fancy_title_right.png') repeat-x; } #fancybox-left, #fancybox-right { - position: absolute; - bottom: 0px; - height: 100%; - width: 35%; - cursor: pointer; - outline: none; - background-image: url('../images/icons/box/blank.gif'); - z-index: 1102; - display: none; + position: absolute; + bottom: 0px; + height: 100%; + width: 35%; + cursor: pointer; + outline: none; + background-image: url('../images/icons/box/blank.gif'); + z-index: 1102; + display: none; } #fancybox-left { - left: 0px; + left: 0px; } #fancybox-right { - right: 0px; + right: 0px; } #fancybox-left-ico, #fancybox-right-ico { - position: absolute; - top: 50%; - left: -9999px; - width: 30px; - height: 30px; - margin-top: -15px; - cursor: pointer; - z-index: 1102; - display: block; + position: absolute; + top: 50%; + left: -9999px; + width: 30px; + height: 30px; + margin-top: -15px; + cursor: pointer; + z-index: 1102; + display: block; } #fancybox-left-ico { - background: transparent url('../images/icons/box/fancy_nav_left.png') no-repeat; + background: transparent url('../images/icons/box/fancy_nav_left.png') no-repeat; } #fancybox-right-ico { - background: transparent url('../images/icons/box/fancy_nav_right.png') no-repeat; + background: transparent url('../images/icons/box/fancy_nav_right.png') no-repeat; } #fancybox-left:hover, #fancybox-right:hover { - visibility: visible; + visibility: visible; } #fancybox-left:hover span { - left: 20px; + left: 20px; } #fancybox-right:hover span { - left: auto; - right: 20px; + left: auto; + right: 20px; } div.fancy-bg { - position: absolute; - padding: 0; - margin: 0; - border: 0; - z-index: 1001; + position: absolute; + padding: 0; + margin: 0; + border: 0; + z-index: 1001; } div#fancy-bg-n { - top: -20px; - left: 0; - width: 100%; - height: 20px; - background: transparent url('../images/icons/box/fancy_shadow_n.png') repeat-x; + top: -20px; + left: 0; + width: 100%; + height: 20px; + background: transparent url('../images/icons/box/fancy_shadow_n.png') repeat-x; } div#fancy-bg-ne { - top: -20px; - right: -20px; - width: 20px; - height: 20px; - background: transparent url('../images/icons/box/fancy_shadow_ne.png') no-repeat; + top: -20px; + right: -20px; + width: 20px; + height: 20px; + background: transparent url('../images/icons/box/fancy_shadow_ne.png') no-repeat; } div#fancy-bg-e { - top: 0; - right: -20px; - height: 100%; - width: 20px; - background: transparent url('../images/icons/box/fancy_shadow_e.png') repeat-y; + top: 0; + right: -20px; + height: 100%; + width: 20px; + background: transparent url('../images/icons/box/fancy_shadow_e.png') repeat-y; } div#fancy-bg-se { - bottom: -20px; - right: -20px; - width: 20px; - height: 20px; - background: transparent url('../images/icons/box/fancy_shadow_se.png') no-repeat; + bottom: -20px; + right: -20px; + width: 20px; + height: 20px; + background: transparent url('../images/icons/box/fancy_shadow_se.png') no-repeat; } div#fancy-bg-s { - bottom: -20px; - left: 0; - width: 100%; - height: 20px; - background: transparent url('../images/icons/box/fancy_shadow_s.png') repeat-x; + bottom: -20px; + left: 0; + width: 100%; + height: 20px; + background: transparent url('../images/icons/box/fancy_shadow_s.png') repeat-x; } div#fancy-bg-sw { - bottom: -20px; - left: -20px; - width: 20px; - height: 20px; - background: transparent url('../images/icons/box/fancy_shadow_sw.png') no-repeat; + bottom: -20px; + left: -20px; + width: 20px; + height: 20px; + background: transparent url('../images/icons/box/fancy_shadow_sw.png') no-repeat; } div#fancy-bg-w { - top: 0; - left: -20px; - height: 100%; - width: 20px; - background: transparent url('../images/icons/box/fancy_shadow_w.png') repeat-y; + top: 0; + left: -20px; + height: 100%; + width: 20px; + background: transparent url('../images/icons/box/fancy_shadow_w.png') repeat-y; } div#fancy-bg-nw { - top: -20px; - left: -20px; - width: 20px; - height: 20px; - background: transparent url('../images/icons/box/fancy_shadow_nw.png') no-repeat; + top: -20px; + left: -20px; + width: 20px; + height: 20px; + background: transparent url('../images/icons/box/fancy_shadow_nw.png') no-repeat; } \ No newline at end of file diff --git a/template/css/pointer.css b/template/css/pointer.css index fb4d3ff..73ec276 100644 --- a/template/css/pointer.css +++ b/template/css/pointer.css @@ -1,47 +1,47 @@ .radio { - vertical-align: top; - width: 17px; - height: 17px; - margin: 0 3px 0 0; + vertical-align: top; + width: 17px; + height: 17px; + margin: 0 3px 0 0; } .radio + label { - cursor: pointer; + cursor: pointer; } .radio:not(checked) { - position: absolute; - opacity: 0; + position: absolute; + opacity: 0; } .radio:not(checked) + label { - position: relative; - padding: 0 0 0 35px; + position: relative; + padding: 0 0 0 35px; } .radio:not(checked) + label:before { - content: ''; - position: absolute; - top: -3px; - left: 0; - width: 22px; - height: 22px; - border: 1px solid #CDD1DA; - border-radius: 50%; - background: #FFF; + content: ''; + position: absolute; + top: -3px; + left: 0; + width: 22px; + height: 22px; + border: 1px solid #CDD1DA; + border-radius: 50%; + background: #FFF; } .radio:not(checked) + label:after { - content: ''; - position: absolute; - top: 1px; - left: 4px; - width: 16px; - height: 16px; - border-radius: 50%; - background: #9FD468; - box-shadow: inset 0 1px 1px rgba(0,0,0,.5); - opacity: 0; - transition: all .2s; + content: ''; + position: absolute; + top: 1px; + left: 4px; + width: 16px; + height: 16px; + border-radius: 50%; + background: #9FD468; + box-shadow: inset 0 1px 1px rgba(0,0,0,.5); + opacity: 0; + transition: all .2s; } .radio:checked + label:after { - opacity: 1; + opacity: 1; } .radio:focus + label:before { - box-shadow: 0 0 0 3px rgba(255,255,0,.5); + box-shadow: 0 0 0 3px rgba(255,255,0,.5); } \ No newline at end of file diff --git a/template/css/replenish.css b/template/css/replenish.css index 8894172..2f26b30 100644 --- a/template/css/replenish.css +++ b/template/css/replenish.css @@ -1,87 +1,87 @@ * { - padding: 0; - margin: 0; - -webkit-box-sizing: content-box; - -moz-box-sizing: content-box; - -ms-box-sizing: content-box; - -o-box-sizing: content-box; - box-sizing: content-box; + padding: 0; + margin: 0; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + -ms-box-sizing: content-box; + -o-box-sizing: content-box; + box-sizing: content-box; } html { - font-family: 'Open Sans'; - font-size: 14px; - background-color: #17a918; - color: #000; + font-family: 'Open Sans'; + font-size: 14px; + background-color: #17a918; + color: #000; } html, body { - height: 100%; + height: 100%; } .success, .content { - width: 1000px; + width: 1000px; } .success { - width: 1000px; - height: 375px; - margin: 0 auto; + width: 1000px; + height: 375px; + margin: 0 auto; } .success-replenish { - background: url('../images/error/success.jpg') center top no-repeat; + background: url('../images/error/success.jpg') center top no-repeat; } .info-success { - padding: 5px; - text-align: center; - text-transform: uppercase; - border: 4px solid #000; - border-radius: 30px; - font-size: 33px; + padding: 5px; + text-align: center; + text-transform: uppercase; + border: 4px solid #000; + border-radius: 30px; + font-size: 33px; } .info-success { - font-size: 28px; + font-size: 28px; } .content { - margin: 0 auto; + margin: 0 auto; } .content ul { - margin-top: 15px; - text-align: center; + margin-top: 15px; + text-align: center; } .content ul li { - list-style-type: none; - display: inline-block; + list-style-type: none; + display: inline-block; } .content ul li a { - color: #000; - display: inline-block; - margin: 10px; - font-size: 21px; - text-transform: uppercase; + color: #000; + display: inline-block; + margin: 10px; + font-size: 21px; + text-transform: uppercase; } .content ul li a:hover { - text-decoration: none; + text-decoration: none; } \ No newline at end of file diff --git a/template/css/style.css b/template/css/style.css index 4829612..f027e10 100644 --- a/template/css/style.css +++ b/template/css/style.css @@ -1,115 +1,115 @@ @font-face { - font-family: 'Open Sans'; - src: local('Open Sans Light'), local('OpenSans-Light'), url('../fonts/opensanslight.woff2') format('woff2'), url('../fonts/opensanslight.woff') format('woff'), url('../fonts/opensanslight.ttf') format('truetype'); - font-weight: 300; - font-style: normal + font-family: 'Open Sans'; + src: local('Open Sans Light'), local('OpenSans-Light'), url('../fonts/opensanslight.woff2') format('woff2'), url('../fonts/opensanslight.woff') format('woff'), url('../fonts/opensanslight.ttf') format('truetype'); + font-weight: 300; + font-style: normal } @font-face { - font-family: 'Open Sans'; - src: local('Open Sans Bold'), local('OpenSans-Bold'), url('../fonts/opensansbold.woff2') format('woff2'), url('../fonts/opensansbold.woff') format('woff'), url('../fonts/opensansbold.ttf') format('truetype'); - font-weight: 800; - font-style: normal + font-family: 'Open Sans'; + src: local('Open Sans Bold'), local('OpenSans-Bold'), url('../fonts/opensansbold.woff2') format('woff2'), url('../fonts/opensansbold.woff') format('woff'), url('../fonts/opensansbold.ttf') format('truetype'); + font-weight: 800; + font-style: normal } @font-face { - font-family: 'links'; - src: local('Airborne Pilot'), url('../fonts/airbornepilot.woff2') format('woff2'), url('../fonts/airbornepilot.woff') format('woff'), url('../fonts/airbornepilot.ttf') format('truetype'); - font-weight: 400; - font-style: normal + font-family: 'links'; + src: local('Airborne Pilot'), url('../fonts/airbornepilot.woff2') format('woff2'), url('../fonts/airbornepilot.woff') format('woff'), url('../fonts/airbornepilot.ttf') format('truetype'); + font-weight: 400; + font-style: normal } @font-face { - font-family: 'nav'; - src: local('Airborne'), url('../fonts/airborne.woff2') format('woff2'), url('../fonts/airborne.woff') format('woff'), url('../fonts/airborne.ttf') format('truetype'); - font-weight: 400; - font-style: normal + font-family: 'nav'; + src: local('Airborne'), url('../fonts/airborne.woff2') format('woff2'), url('../fonts/airborne.woff') format('woff'), url('../fonts/airborne.ttf') format('truetype'); + font-weight: 400; + font-style: normal } @font-face { - font-family: 'menu'; - src: local('Arimo'), url('../fonts/arimo.woff2') format('woff2'), url('../fonts/arimo.woff') format('woff'), url('../fonts/arimo.ttf') format('truetype'); - font-weight: 400; - font-style: normal + font-family: 'menu'; + src: local('Arimo'), url('../fonts/arimo.woff2') format('woff2'), url('../fonts/arimo.woff') format('woff'), url('../fonts/arimo.ttf') format('truetype'); + font-weight: 400; + font-style: normal } @font-face { - font-family: 'logo'; - src: local('Cantarell Regular'), local('Cantarell-Regular'), url('../fonts/cantarellregular.woff2') format('woff2'), url('../fonts/cantarellregular.woff') format('woff'), url('../fonts/cantarellregular.ttf') format('truetype'); - font-weight: 400; - font-style: normal + font-family: 'logo'; + src: local('Cantarell Regular'), local('Cantarell-Regular'), url('../fonts/cantarellregular.woff2') format('woff2'), url('../fonts/cantarellregular.woff') format('woff'), url('../fonts/cantarellregular.ttf') format('truetype'); + font-weight: 400; + font-style: normal } .miniscreen { - display: none + display: none } @media screen and (max-width: 1199px) { - .all - { - width: 1000px !important; - } - .main - { - width: 1000px !important; - } - .block - { - display: none !important; - } + .all + { + width: 1000px !important; + } + .main + { + width: 1000px !important; + } + .block + { + display: none !important; + } - .miniscreen - { - display: inline-block !important; - } + .miniscreen + { + display: inline-block !important; + } - .server_list table - { - width: 100% !important; - } - .server_img - { - display: none !important; - } + .server_list table + { + width: 100% !important; + } + .server_img + { + display: none !important; + } } * { - padding: 0; - margin: 0; - -webkit-box-sizing: content-box; - -moz-box-sizing: content-box; - -ms-box-sizing: content-box; - -o-box-sizing: content-box; - box-sizing: content-box + padding: 0; + margin: 0; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + -ms-box-sizing: content-box; + -o-box-sizing: content-box; + box-sizing: content-box } html { - background: #EEE url('../images/bg.png'); - font-family: 'Open Sans'; - font-size: 13px + background: #EEE url('../images/bg.png'); + font-family: 'Open Sans'; + font-size: 13px } html, body, .all { - height: 100% + height: 100% } a { - color: #333; - text-decoration: none + color: #333; + text-decoration: none } a:hover { - color: #222 + color: #222 } table { - border-collapse: collapse; - width: 100%; - font-size: 12px + border-collapse: collapse; + width: 100%; + font-size: 12px } input, select { /* width: 100%; */ @@ -118,32 +118,32 @@ input, select { } h1, h2, h3, h4, h5 { - display: inline-block; - font-weight: bold + display: inline-block; + font-weight: bold } .modal-body > h3 { - display: block + display: block } h1 { - font-size: 2em + font-size: 2em } h2 { - font-size: 1.5em + font-size: 1.5em } h3 { - font-size: 1.17em + font-size: 1.17em } h4 { - font-size: 0.9em + font-size: 0.9em } h5 { - font-size: 0.83em + font-size: 0.83em } #loadinginfo { display: none; @@ -157,446 +157,446 @@ h5 .left { - float: left + float: left } .right { - float: right + float: right } .center { - text-align: center + text-align: center } .text-left { - text-align: left + text-align: left } .text-right { - text-align: right + text-align: right } .margin-top { - margin-top: 5px + margin-top: 5px } .margin-bottom { - margin-bottom: 3px + margin-bottom: 3px } .margin-left { - margin-left: 5px + margin-left: 5px } .margin-right { - margin-right: 5px + margin-right: 5px } .vtop { - vertical-align: top + vertical-align: top } .vbot { - vertical-align: bottom + vertical-align: bottom } .vbottom { - vertical-align: bottom + vertical-align: bottom } .border-bottom { - border-bottom: 1px solid #DCDCDC + border-bottom: 1px solid #DCDCDC } .underline { - border-bottom: 1px dashed; - padding-bottom: 2px !important + border-bottom: 1px dashed; + padding-bottom: 2px !important } .none { - display: none + display: none } .hide { - display: none + display: none } .pointer { - cursor: pointer !important + cursor: pointer !important } .informer { - padding: 8px + padding: 8px } .informer.red { - color: #a94442; - background-color: #f2dede; - border-color: #ebccd1 + color: #a94442; + background-color: #f2dede; + border-color: #ebccd1 } .informer.blue { - color: #31708f; - background-color: #d9edf7; - border-color: #bce8f1 + color: #31708f; + background-color: #d9edf7; + border-color: #bce8f1 } .informer.green { - color: #3c763d; - background-color: #dff0d8; - border-color: #d6e9c6 + color: #3c763d; + background-color: #dff0d8; + border-color: #d6e9c6 } .informer.gray { - color: #8a6d3b; - background-color: #fcf8e3; - border-color: #faebcc + color: #8a6d3b; + background-color: #fcf8e3; + border-color: #faebcc } button, .btn { - opacity: 0.9; - border: 0; - background-color: #7f97b1; - color: #FFF !important; - outline: 0; - cursor: pointer; - display: inline-block; - text-align: center; - font: 11px/16px 'Open Sans'; - text-transform: uppercase; - box-sizing: border-box; - padding: 1px 5px + opacity: 0.9; + border: 0; + background-color: #7f97b1; + color: #FFF !important; + outline: 0; + cursor: pointer; + display: inline-block; + text-align: center; + font: 11px/16px 'Open Sans'; + text-transform: uppercase; + box-sizing: border-box; + padding: 1px 5px } button:hover, .btn:hover { - opacity: 1 + opacity: 1 } .btn-switch > .lcs_wrap { - display: block !important + display: block !important } .btn-max { - width: 100%; - box-sizing: border-box + width: 100%; + box-sizing: border-box } .btn-fix { - width: 90px + width: 90px } .btn-short { - padding: 1px 5px + padding: 1px 5px } .btn-shift { - padding: 1px 6px + padding: 1px 6px } .btn-success { - background-color: #82b17f + background-color: #82b17f } .btn-error { - background-color: #b17f7f + background-color: #b17f7f } .btn-info { - background-color: #33a9de + background-color: #33a9de } .btn-black { - background-color: #000 + background-color: #000 } .btn-gray { - background-color: #DDD; - color: #222 !important + background-color: #DDD; + color: #222 !important } .btn-gray:hover { - background-color: #CCC !important; - color: #222 !important + background-color: #CCC !important; + color: #222 !important } .btn-block { - background-color: #000000; - opacity: 0.1; - cursor: no-drop + background-color: #000000; + opacity: 0.1; + cursor: no-drop } .btn-none { - cursor: auto; - background: none !important; - color: #222 !important + cursor: auto; + background: none !important; + color: #222 !important } .btn-full { - width: 99% + width: 99% } .all { - width: 1200px; - margin: 0 auto + width: 1200px; + margin: 0 auto } .top { - width: 100%; - max-width: 1200px; - display: inline-block; - padding: 10px; - background-color: #fff; - border: 1px solid #e1e1e1; - margin-bottom: 10px; - box-sizing: border-box + width: 100%; + max-width: 1200px; + display: inline-block; + padding: 10px; + background-color: #fff; + border: 1px solid #e1e1e1; + margin-bottom: 10px; + box-sizing: border-box } .top a { - font: 12px 'Open Sans'; - font-weight: bold; - color: #000; - padding: 0 5px; - text-transform: uppercase + font: 12px 'Open Sans'; + font-weight: bold; + color: #000; + padding: 0 5px; + text-transform: uppercase } .top a:hover { - color: #000; - border-bottom: 1px solid + color: #000; + border-bottom: 1px solid } .header { - width: 100%; - display: inline-block; - height: 54px; - background-color: #FFF; - border: 1px solid #EBEBEB; - border-bottom: 0; - box-sizing: border-box + width: 100%; + display: inline-block; + height: 54px; + background-color: #FFF; + border: 1px solid #EBEBEB; + border-bottom: 0; + box-sizing: border-box } .logo { - font: 30px/30px 'logo'; - color: #191919; - display: inline-block; - padding: 12px + font: 30px/30px 'logo'; + color: #191919; + display: inline-block; + padding: 12px } .user { - padding: 5px + padding: 5px } .recsign a { - display: block; - color: #191919; - text-transform: uppercase; - font: 12px/12px 'Open Sans'; - font-weight: bold; - padding: 5px + display: block; + color: #191919; + text-transform: uppercase; + font: 12px/12px 'Open Sans'; + font-weight: bold; + padding: 5px } .recsign a:hover { - text-decoration: underline + text-decoration: underline } .user_lk { - margin: 11px 7px + margin: 11px 7px } .user_lk a { - padding: 5px; - text-transform: uppercase; - font: 11px 'Open Sans'; - font-weight: bold; - color: #191919 + padding: 5px; + text-transform: uppercase; + font: 11px 'Open Sans'; + font-weight: bold; + color: #191919 } .user_lk a:hover { - text-decoration: underline + text-decoration: underline } .nav { - height: 30px; - box-sizing: border-box; - padding: 9px; - background-color: #f0f2f2; - color: #888; - font: 11px 'menu'; - display: inline-block; - width: 100%; - border-left: 1px solid #EBEBEB; - border-right: 1px solid #EBEBEB + height: 30px; + box-sizing: border-box; + padding: 9px; + background-color: #f0f2f2; + color: #888; + font: 11px 'menu'; + display: inline-block; + width: 100%; + border-left: 1px solid #EBEBEB; + border-right: 1px solid #EBEBEB } .nav i { - padding: 0 3px + padding: 0 3px } .nav a { - color: #191919 + color: #191919 } .nav a:hover { - text-decoration: underline + text-decoration: underline } .wrapper { - display: table; - height: 100%; - border: 1px solid #E1E1E1; - border-top: 0 + display: table; + height: 100%; + border: 1px solid #E1E1E1; + border-top: 0 } .main { - background-color: #fff; - width: 1000px; - max-width: 1000px; - height: 100%; - box-sizing: border-box; - padding: 10px; - display: table-cell + background-color: #fff; + width: 1000px; + max-width: 1000px; + height: 100%; + box-sizing: border-box; + padding: 10px; + display: table-cell } .block { - background-color: #FFFFFF; - width: 200px; - min-width: 200px; - vertical-align: top; - display: table-cell; - border-right: 1px solid #E1E1E1 + background-color: #FFFFFF; + width: 200px; + min-width: 200px; + vertical-align: top; + display: table-cell; + border-right: 1px solid #E1E1E1 } .block .title { - text-align: right; - padding: 7px; - font: 13px 'Open Sans'; - text-align: center + text-align: right; + padding: 7px; + font: 13px 'Open Sans'; + text-align: center } .block .title::after { - content: ''; - border-bottom: 1px solid #191919; - display: block; - margin: 5px auto; - width: 70% + content: ''; + border-bottom: 1px solid #191919; + display: block; + margin: 5px auto; + width: 70% } .block ul { - list-style: none + list-style: none } .block ul li { - border-bottom: 1px solid rgb(225, 230, 234) + border-bottom: 1px solid rgb(225, 230, 234) } .block ul li a { - color: #191919; - font: 12px 'menu'; - padding: 8px 6px; - display: block; - transition: all 0.23s ease-in-out; - -moz-transition: all 0.23s ease-in-out; - -webkit-transition: all 0.23s ease-in-out; - -o-transition: all 0.23s ease-in-out + color: #191919; + font: 12px 'menu'; + padding: 8px 6px; + display: block; + transition: all 0.23s ease-in-out; + -moz-transition: all 0.23s ease-in-out; + -webkit-transition: all 0.23s ease-in-out; + -o-transition: all 0.23s ease-in-out } .block ul li a:hover, .block ul li .active { - background-color: #F0F2F5 + background-color: #F0F2F5 } .block ul li a > i:nth-child(1) { - margin-right: 4px; - width: 20px; - text-align: center + margin-right: 4px; + width: 20px; + text-align: center } .footer { - width: 100%; - display: inline-block; - height: 80px; - background-color: #FFF; - color: #DDD; - margin-bottom: 15px; - border: 1px solid #EBEBEB; - border-top: 0; - box-sizing: border-box + width: 100%; + display: inline-block; + height: 80px; + background-color: #FFF; + color: #DDD; + margin-bottom: 15px; + border: 1px solid #EBEBEB; + border-top: 0; + box-sizing: border-box } .footer > .menu { - text-align: left; - margin: 10px; - display: inline-block + text-align: left; + margin: 10px; + display: inline-block } .footer > .menu a { - color: #808CA0; - padding: 0 5px + color: #808CA0; + padding: 0 5px } .infoegp { - color: #555; - padding: 15px 15px 0 0; - text-align: center + color: #555; + padding: 15px 15px 0 0; + text-align: center } .copyright { - color: #777; - margin: 15px; - font: 14px 'Arial' + color: #777; + margin: 15px; + font: 14px 'Arial' } .social { - font-size: 25px; - color: #000 + font-size: 25px; + color: #000 } .social .fa-vk { - color: #597da3; - margin-right: 5px + color: #597da3; + margin-right: 5px } .service { - text-align: center; - width: 200px + text-align: center; + width: 200px } .service { - text-align: center; - width: 200px; - float: left; - margin: 10px 16px; - background-color: #f0f2f2; - border: 1px solid #e1e1e1; - padding: 4px + text-align: center; + width: 200px; + float: left; + margin: 10px 16px; + background-color: #f0f2f2; + border: 1px solid #e1e1e1; + padding: 4px } .service > .line { - border-top: 1px solid #222; - width: 200px; - position: relative; - top: 12px + border-top: 1px solid #222; + width: 200px; + position: relative; + top: 12px } .service > .title { - font: 11px 'nav'; - background-color: #f0f2f2; - display: inline-block; - position: relative; - padding: 5px; - z-index: 10 + font: 11px 'nav'; + background-color: #f0f2f2; + display: inline-block; + position: relative; + padding: 5px; + z-index: 10 } .service img { - opacity: 0.8 + opacity: 0.8 } .service a { @@ -615,53 +615,53 @@ button:hover, .btn:hover blockquote { - padding: 5px; - border-left: 1px solid #597da3; - background-color: #e8ebf0 + padding: 5px; + border-left: 1px solid #597da3; + background-color: #e8ebf0 } /* form */ .form { - margin: 0 auto + margin: 0 auto } .form td { - padding: 5px + padding: 5px } .form img, .form label { - cursor: pointer + cursor: pointer } .form label { - display: block; - margin-bottom: 3px; - font: 9px 'Open Sans'; - font-weight: bold + display: block; + margin-bottom: 3px; + font: 9px 'Open Sans'; + font-weight: bold } .form input, .form select, .form textarea { - border: 1px dashed #CCC; - padding: 5px; - width: 100%; - outline: 0; - box-sizing: border-box; - font: 12px 'Tahoma'; - background-color: #FFF + border: 1px dashed #CCC; + padding: 5px; + width: 100%; + outline: 0; + box-sizing: border-box; + font: 12px 'Tahoma'; + background-color: #FFF } .form textarea { - resize: vertical; - width: 100% + resize: vertical; + width: 100% } .form input:focus, .form select:focus, .form textarea:focus { - border-color: #222 + border-color: #222 } .form #captha { - text-transform: uppercase + text-transform: uppercase } .server_list { @@ -681,154 +681,154 @@ blockquote } .server_list table td { - padding: 2px; - border-bottom: 1px solid #E8EBF0 + padding: 2px; + border-bottom: 1px solid #E8EBF0 } .server_list table { - width: 80% + width: 80% } .server_list table tr:last-child td { - padding-bottom: 10px + padding-bottom: 10px } .server_list .btn { - position: relative; - bottom: -5px + position: relative; + bottom: -5px } .server_img { - display: inline-block; - float: left; - margin-right: 10px; - width: 160px; - height: 120px + display: inline-block; + float: left; + margin-right: 10px; + width: 160px; + height: 120px } .server_img img { - width: 150px; - height: 113px + width: 150px; + height: 113px } .server_name { - max-width: 210px; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap + max-width: 210px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap } .server_nav { - margin: 10px 0; - width: initial + margin: 10px 0; + width: initial } .server_nav i { - font-size: 24px; - display: block; - text-shadow: none + font-size: 24px; + display: block; + text-shadow: none } .server_nav td { - border-bottom: 1px solid #ccc; - padding: 3px; - text-align: center; - font: 7px/20px menu; - text-transform: uppercase; - text-shadow: 1px 0 1px rgba(25, 25, 25, 0.34) + border-bottom: 1px solid #ccc; + padding: 3px; + text-align: center; + font: 7px/20px menu; + text-transform: uppercase; + text-shadow: 1px 0 1px rgba(25, 25, 25, 0.34) } .server_nav td a { - color: #555; - background-color: #fcfcfc; - box-shadow: 0 0 2px #ccc; - padding: 5px; - width: 60px; - height: 35px; - display: block; - transition: all 0.23s ease-in-out; - -moz-transition: all 0.23s ease-in-out; - -webkit-transition: all 0.23s ease-in-out; - -o-transition: all 0.23s ease-in-out + color: #555; + background-color: #fcfcfc; + box-shadow: 0 0 2px #ccc; + padding: 5px; + width: 60px; + height: 35px; + display: block; + transition: all 0.23s ease-in-out; + -moz-transition: all 0.23s ease-in-out; + -webkit-transition: all 0.23s ease-in-out; + -o-transition: all 0.23s ease-in-out } .server_nav td a:hover, .server_nav .active { - color: #2196F3 + color: #2196F3 } .server_console pre { - width: 99%; - height: 350px; - overflow-y: scroll; - overflow-x: hidden; - border-radius: 0; - padding: 5px; - margin-bottom: 10px; - background-color: #191919; - color: #FFF + width: 99%; + height: 350px; + overflow-y: scroll; + overflow-x: hidden; + border-radius: 0; + padding: 5px; + margin-bottom: 10px; + background-color: #191919; + color: #FFF } .server_console table td { - border: 0 + border: 0 } #console_update { - font-size: 26px + font-size: 26px } .progress { - width: 185px + width: 185px } .progress > span { - position: relative; - float: left; - margin: 0 -1px; - min-width: 30px; - height: 16px; - line-height: 12px; - border-radius: 10px; - text-align: right; - border: 1px solid #FFF; - background: #DDD url(../images/progress.jpg) no-repeat; - -webkit-box-shadow: inset 0 1px rgba(255, 255, 255, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2); - box-shadow: inset 0 1px rgba(255, 255, 255, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2); - transition: all 0.20s ease-in-out; - -moz-transition: all 0.20s ease-in-out; - -webkit-transition: all 0.20s ease-in-out; - -o-transition: all 0.20s ease-in-out + position: relative; + float: left; + margin: 0 -1px; + min-width: 30px; + height: 16px; + line-height: 12px; + border-radius: 10px; + text-align: right; + border: 1px solid #FFF; + background: #DDD url(../images/progress.jpg) no-repeat; + -webkit-box-shadow: inset 0 1px rgba(255, 255, 255, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2); + box-shadow: inset 0 1px rgba(255, 255, 255, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2); + transition: all 0.20s ease-in-out; + -moz-transition: all 0.20s ease-in-out; + -webkit-transition: all 0.20s ease-in-out; + -o-transition: all 0.20s ease-in-out } .progress > span > span { - padding: 0 3px; - font: 10px 'menu'; - color: #FFF + padding: 0 3px; + font: 10px 'menu'; + color: #FFF } .progress > span:before { - content: ''; - position: absolute; - top: 0; - bottom: 0; - left: 0; - right: 0; - z-index: 1; - height: 18px; - background: url("../images/progress.png") 0 0 repeat-x; - border-radius: 10px + content: ''; + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 0; + z-index: 1; + height: 18px; + background: url("../images/progress.png") 0 0 repeat-x; + border-radius: 10px } .change_map { - display: none; - position: absolute; - width: 408px; - max-height: 370px; - overflow: hidden; - overflow-y: scroll; - background-color: #F8F8F8; - box-shadow: 1px 4px 20px #9B9B9B; - z-index: 999 + display: none; + position: absolute; + width: 408px; + max-height: 370px; + overflow: hidden; + overflow-y: scroll; + background-color: #F8F8F8; + box-shadow: 1px 4px 20px #9B9B9B; + z-index: 999 } .change_close { display: none; @@ -843,62 +843,62 @@ blockquote } .change_close:hover { - background-color: #323E53 + background-color: #323E53 } .change_map div { - cursor: pointer; - float: left; - padding: 4px; - border: 1px solid #EEE + cursor: pointer; + float: left; + padding: 4px; + border: 1px solid #EEE } .change_map div > i { - width: 20px; - float: right; - height: 20px; - line-height: 20px; - text-align: center; - background-color: #222; - color: #ffffff; - display: block; - box-sizing: border-box; - position: absolute; - margin-left: 100px + width: 20px; + float: right; + height: 20px; + line-height: 20px; + text-align: center; + background-color: #222; + color: #ffffff; + display: block; + box-sizing: border-box; + position: absolute; + margin-left: 100px } .change_map div:hover span { - background-color: #323E53 + background-color: #323E53 } .change_map span { - display: block; - text-align: center; - padding: 5px; - background-color: #3E4E68; - color: #F5F5F5; - font-size: 12px; - max-width: 110px; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap + display: block; + text-align: center; + padding: 5px; + background-color: #3E4E68; + color: #F5F5F5; + font-size: 12px; + max-width: 110px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap } .table_pad th { - padding: 5px; - border-bottom: 1px solid #DCDCDC; - background-color: #f0f2f2; - color: #191919; - font-weight: normal + padding: 5px; + border-bottom: 1px solid #DCDCDC; + background-color: #f0f2f2; + color: #191919; + font-weight: normal } .table_pad td { - padding: 5px; - border-bottom: 1px solid #DCDCDC + padding: 5px; + border-bottom: 1px solid #DCDCDC } .table_pad tr:nth-last-child(1) td { - border: 0 + border: 0 } .input_pad input, .input_pad select, .input_pad textarea { padding: 5px; @@ -909,23 +909,23 @@ blockquote } .input_pad textarea { - resize: vertical; - width: 100% + resize: vertical; + width: 100% } .adminflags { - display: table-cell !important + display: table-cell !important } .adminflags input { - width: 164px + width: 164px } .adminflags div { - position: absolute; - margin: -23px 145px 0; - padding: 0 5px; - cursor: pointer + position: absolute; + margin: -23px 145px 0; + padding: 0 5px; + cursor: pointer } .hblock_content { background-color: #7f97b1; @@ -938,512 +938,512 @@ blockquote } .block_content { - border: 2px solid #f0f2f5; - border-left-style: solid; - border-right-style: solid; - padding: 5px; - background-color: #ffffff; - box-shadow: 0px 3px 8px 0px rgba(33, 38, 45, 0.22) + border: 2px solid #f0f2f5; + border-left-style: solid; + border-right-style: solid; + padding: 5px; + background-color: #ffffff; + box-shadow: 0px 3px 8px 0px rgba(33, 38, 45, 0.22) } .help_question { - background-color: #fff; - padding: 10px; - border-bottom: 1px dashed #CCC + background-color: #fff; + padding: 10px; + border-bottom: 1px dashed #CCC } .space { - margin-top: 10px; - display: inline-block; - width: 100%; - clear: both + margin-top: 10px; + display: inline-block; + width: 100%; + clear: both } .height200 { - height: 200px; - overflow-y: scroll + height: 200px; + overflow-y: scroll } .width50p { - width: 49%; - display: inline-block + width: 49%; + display: inline-block } .width250 { - width: 250px + width: 250px } .width350 { - width: 350px + width: 350px } .width500 { - width: 500px + width: 500px } .width550 { - width: 550px + width: 550px } .spoiler_body { - display: none + display: none } .spoiler_links { - padding-left: 15px; - font-size: 14px; - padding-bottom: 5px; - border-bottom: 1px solid #DDD; - display: block + padding-left: 15px; + font-size: 14px; + padding-bottom: 5px; + border-bottom: 1px solid #DDD; + display: block } .spoiler_body { - display: none; - padding: 5px + display: none; + padding: 5px } .spoilerblock { - padding: 7px; - border-bottom: 1px solid #ddd + padding: 7px; + border-bottom: 1px solid #ddd } .icon { - font-weight: bold; - color: #CCC; - display: inline-block; - float: right; - position: relative; - + font-weight: bold; + color: #CCC; + display: inline-block; + float: right; + position: relative; + } .plugin_block { - border-bottom: 1px solid #DDD; - padding-bottom: 5px; - display: table; - width: 100% + border-bottom: 1px solid #DDD; + padding-bottom: 5px; + display: table; + width: 100% } .plugin_info { - display: table-cell; - width: 90%; - box-sizing: border-box; - padding: 5px; - border-bottom: 1px dashed #DDD + display: table-cell; + width: 90%; + box-sizing: border-box; + padding: 5px; + border-bottom: 1px dashed #DDD } .plugin_action { - display: table-cell; - width: 10%; - box-sizing: border-box; - padding: 5px; - text-align: center; - border-bottom: 1px dashed #DDD + display: table-cell; + width: 10%; + box-sizing: border-box; + padding: 5px; + text-align: center; + border-bottom: 1px dashed #DDD } .plugin_update { - cursor: pointer; - font-size: 12px; - color: #BCA744; - padding-left: 5px + cursor: pointer; + font-size: 12px; + color: #BCA744; + padding-left: 5px } .plugin_images { - display: table-row + display: table-row } .plugin_images a { - margin: 3px 3px 0 0; - display: inline-block; - box-sizing: border-box + margin: 3px 3px 0 0; + display: inline-block; + box-sizing: border-box } .plugin_images img { - height: 50px; - opacity: 0.7 + height: 50px; + opacity: 0.7 } .plugin_images img:hover { - opacity: 1 + opacity: 1 } .plugin_status_stable, .plugin_status_unstable, .plugin_status_testing { - font-size: 12px + font-size: 12px } .plugin_status_stable { - color: #74B084 + color: #74B084 } .plugin_status_unstable { - color: #B07474 + color: #B07474 } .plugin_status_testing { - color: #6E9FBC + color: #6E9FBC } #search_block { - display: none + display: none } .maps_types a > div { - cursor: pointer; - display: inline-block; - padding: 5px 5px 0 5px; - border: 1px solid #DCDCDC; - margin: 5px 5px 0 0; - box-sizing: border-box + cursor: pointer; + display: inline-block; + padding: 5px 5px 0 5px; + border: 1px solid #DCDCDC; + margin: 5px 5px 0 0; + box-sizing: border-box } .maps_types a:nth-child(8) > div { - margin-right: 0 + margin-right: 0 } .maps_types a > div > div { - text-align: center; - position: absolute; - margin-top: 30px; - background-color: rgba(0, 0, 0, 0.25); - width: 100px; - height: 20px; - line-height: 20px; - color: #FFF + text-align: center; + position: absolute; + margin-top: 30px; + background-color: rgba(0, 0, 0, 0.25); + width: 100px; + height: 20px; + line-height: 20px; + color: #FFF } .maps_types a > div > img { - width: 100px + width: 100px } .maps_types a > div:hover { - border-color: #999 + border-color: #999 } .maps > div { - display: inline-block; - padding: 5px; - border: 1px solid #DDD; - margin: 4px + display: inline-block; + padding: 5px; + border: 1px solid #DDD; + margin: 4px } .maps > div:nth-child(6n) { - margin-right: 0 + margin-right: 0 } .maps > div > div { - display: block; - cursor: pointer + display: block; + cursor: pointer } .maps > div > div i { - width: 20px; - float: right; - height: 20px; - line-height: 20px; - text-align: center; - background-color: #222; - color: #ffffff; - display: block; - box-sizing: border-box; - position: absolute; - margin-left: 120px + width: 20px; + float: right; + height: 20px; + line-height: 20px; + text-align: center; + background-color: #222; + color: #ffffff; + display: block; + box-sizing: border-box; + position: absolute; + margin-left: 120px } .maps div > span { - display: block; - text-align: center; - font-size: 13px; - max-width: 130px; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - background-color: #222; - color: #ffffff; - padding: 2px 5px + display: block; + text-align: center; + font-size: 13px; + max-width: 130px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + background-color: #222; + color: #ffffff; + padding: 2px 5px } .pages { - display: inline-block; - width: 100%; - text-align: center + display: inline-block; + width: 100%; + text-align: center } .pages > div { - margin-top: 10px + margin-top: 10px } .pages a { - display: inline-block; - transition: all 0.1s ease-in-out; - -moz-transition: all 0.1s ease-in-out; - -webkit-transition: all 0.1s ease-in-out; - -o-transition: all 0.1s ease-in-out; - background-color: #597da3; - color: #F8F8F8; - font-size: 13px; - font-family: nav; - padding: 2px 6px; - position: relative; - height: 15px; - margin-right: 2px + display: inline-block; + transition: all 0.1s ease-in-out; + -moz-transition: all 0.1s ease-in-out; + -webkit-transition: all 0.1s ease-in-out; + -o-transition: all 0.1s ease-in-out; + background-color: #597da3; + color: #F8F8F8; + font-size: 13px; + font-family: nav; + padding: 2px 6px; + position: relative; + height: 15px; + margin-right: 2px } .pages a:hover, .pages a.active { - background-color: #222 + background-color: #222 } .filetp { - padding-top: 15px + padding-top: 15px } .filetp_block { - height: 500px; - overflow-y: scroll; - overflow-x: hidden + height: 500px; + overflow-y: scroll; + overflow-x: hidden } .filetp_block table td:nth-child(1) p { - max-width: 210px; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap + max-width: 210px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap } #filetp_block > table { - width: 98%; - margin-top: 10px + width: 98%; + margin-top: 10px } #filetp_block > table td { - border-bottom: 3px solid #f5f5f5; - background-color: #dcdcdc; - color: #777; - padding: 3px + border-bottom: 3px solid #f5f5f5; + background-color: #dcdcdc; + color: #777; + padding: 3px } .filetp table:nth-child(1) tr:nth-child(1) td { - border-top: 1px solid #DCDCDC + border-top: 1px solid #DCDCDC } #filetp_edit { - padding-top: 10px + padding-top: 10px } #filetp td { - font: 14px 'menu'; - background-color: #FFF + font: 14px 'menu'; + background-color: #FFF } #filetp td p { - padding: 5px + padding: 5px } #filetp td:nth-child(1) { - padding: 0 + padding: 0 } #filetp tr:nth-child(2n) td { - background-color: #fbfbfb + background-color: #fbfbfb } #filetp tr:hover td { - background-color: #ededed + background-color: #ededed } .filetp_find { - width: 250px; - float: right + width: 250px; + float: right } .filetp_find input { - font-size: 14px; - height: 18px; - padding: 5px; - border: 1px solid #8ca1b9; - box-sizing: border-box; - outline: 0 + font-size: 14px; + height: 18px; + padding: 5px; + border: 1px solid #8ca1b9; + box-sizing: border-box; + outline: 0 } #infopath { - border-top: 3px solid #f5f5f5; - background-color: #dcdcdc; - color: #777; - padding: 3px + border-top: 3px solid #f5f5f5; + background-color: #dcdcdc; + color: #777; + padding: 3px } .CodeMirror { - max-width: 960px + max-width: 960px } .spoiler { - cursor: pointer; - display: block; - padding: 5px; - border: 1px solid #EEE; - background-color: #EAEAEA + cursor: pointer; + display: block; + padding: 5px; + border: 1px solid #EEE; + background-color: #EAEAEA } .spoiler_main { - display: none; - border: 1px solid #EEE; - padding: 5px; - border-top: 0; - background-color: #f4f4f4 + display: none; + border: 1px solid #EEE; + padding: 5px; + border-top: 0; + background-color: #f4f4f4 } #help_notice { - display: none; - float: right; - width: 12px; - height: 12px; - border-radius: 50%; - text-align: center; - background-color: #597da3; - color: #FFF; - font-size: 6px; - line-height: 12px; - margin-top: -1px + display: none; + float: right; + width: 12px; + height: 12px; + border-radius: 50%; + text-align: center; + background-color: #597da3; + color: #FFF; + font-size: 6px; + line-height: 12px; + margin-top: -1px } #help_notice_block { - display: none; - position: fixed; - bottom: 0; - padding: 3px; - width: 200px + display: none; + position: fixed; + bottom: 0; + padding: 3px; + width: 200px } #help_notice_block > a > div { - background-color: #597da3; - color: #FFF; - padding: 5px; - margin-top: 3px + background-color: #597da3; + color: #FFF; + padding: 5px; + margin-top: 3px } #help_notice_block > a > div > span { - font-size: 12px + font-size: 12px } #help_notice_block > a > div > p { - text-overflow: ellipsis; - white-space: nowrap; - max-width: 210px; - overflow: hidden + text-overflow: ellipsis; + white-space: nowrap; + max-width: 210px; + overflow: hidden } #help_notice_block > a > div > span > i { - font-size: 10px; - margin-top: 2px + font-size: 10px; + margin-top: 2px } .infoblock { - background-color: #F7F7F7; - padding: 10px; - border-left: 5px solid #e8ebf0; - color: #585757; - margin-top: 10px + background-color: #F7F7F7; + padding: 10px; + border-left: 5px solid #e8ebf0; + color: #585757; + margin-top: 10px } .help_category { - padding: 8px; - background-color: #FFF; - display: block; - margin-bottom: 3px + padding: 8px; + background-color: #FFF; + display: block; + margin-bottom: 3px } .help_question { - padding: 8px; - background-color: #fff; - margin-bottom: 8px + padding: 8px; + background-color: #fff; + margin-bottom: 8px } .help_question > a { - text-decoration: underline; - margin-bottom: 5px; - display: block + text-decoration: underline; + margin-bottom: 5px; + display: block } .help_question > a:hover { - text-decoration: none + text-decoration: none } .help_question > div > a { - padding: 5px; - background-color: #f0f2f2; - display: inline-block; - border-radius: 5px; - margin-right: 5px; - border: 1px solid #e1e1e1; - font: 11px/5px 'menu' + padding: 5px; + background-color: #f0f2f2; + display: inline-block; + border-radius: 5px; + margin-right: 5px; + border: 1px solid #e1e1e1; + font: 11px/5px 'menu' } .help_question > div > a:hover { - background-color: #c2cdde + background-color: #c2cdde } .news_block { - padding: 8px; - background-color: #fff; - margin-bottom: 8px + padding: 8px; + background-color: #fff; + margin-bottom: 8px } .news_block > h1, .news_block > h3 { - margin-bottom: 5px; - width: 100%; - font-size: 14px + margin-bottom: 5px; + width: 100%; + font-size: 14px } .news_block > h1 > a, .news_block > h3 > a { - text-decoration: underline; - margin-bottom: 5px; - display: block + text-decoration: underline; + margin-bottom: 5px; + display: block } .news_block > h1 span, .news_block > h3 span { - font-size: 13px; - font-weight: normal + font-size: 13px; + font-weight: normal } .news_block > h1 span:nth-child(2), .news_block > h3 span:nth-child(2) { - margin-right: 10px + margin-right: 10px } .news_block > h1 > a:hover, .news_block > h3 > a:hover { - text-decoration: none + text-decoration: none } .news_block > .tags { - font-size: 12px; - margin-top: 10px; - border-top: 1px dashed #CCC + font-size: 12px; + margin-top: 10px; + border-top: 1px dashed #CCC } .box-shadow { - box-shadow: 0 0 5px #CCC + box-shadow: 0 0 5px #CCC } .dblock { - display: block + display: block } #sum_info { - font-weight: bold + font-weight: bold } .loader @@ -1451,7 +1451,7 @@ blockquote z-index: 99; position: fixed; top: 10px; - width: 100% + width: 100% } .loader > span @@ -1495,47 +1495,47 @@ blockquote .outinfo { - text-align: center; - top: 47%; - position: absolute; - background-color: #191919; - padding: 15px; - font-size: 20px; - color: #fff; - border: 2px dashed #ffffff; - border-left: 0; - border-right: 0; - width: 100% + text-align: center; + top: 47%; + position: absolute; + background-color: #191919; + padding: 15px; + font-size: 20px; + color: #fff; + border: 2px dashed #ffffff; + border-left: 0; + border-right: 0; + width: 100% } .pretext { - white-space: pre-wrap; - white-space: -moz-pre-wrap; - white-space: -pre-wrap; - white-space: -o-pre-wrap; - word-wrap: break-word + white-space: pre-wrap; + white-space: -moz-pre-wrap; + white-space: -pre-wrap; + white-space: -o-pre-wrap; + word-wrap: break-word } /*Стилизация кнопки ВВЕРХ */ -#back-top{ - position:fixed; - bottom:30px; - left:50%; - margin-left:200px +#back-top{ + position:fixed; + bottom:30px; + left:50%; + margin-left:200px } #back-top a{ - width:64px; - display:block; - text-align:center; - font:11px/100% Arial, Helvetica, sans-serif; - text-transform:uppercase; - text-decoration:none; - color:#bbb; - /* background color transition */ - -webkit-transition:1s; - -moz-transition:1s; - transition:1s; + width:64px; + display:block; + text-align:center; + font:11px/100% Arial, Helvetica, sans-serif; + text-transform:uppercase; + text-decoration:none; + color:#bbb; + /* background color transition */ + -webkit-transition:1s; + -moz-transition:1s; + transition:1s; } #back-top a:hover{color:#000;} diff --git a/template/css/switch.css b/template/css/switch.css index 4dc8112..b30c2a5 100644 --- a/template/css/switch.css +++ b/template/css/switch.css @@ -1,68 +1,68 @@ .lcs_wrap { - display: inline-block; - direction: ltr; - height: 26px; + display: inline-block; + direction: ltr; + height: 26px; vertical-align: middle } .lcs_wrap input { - display: none; + display: none; } .lcs_switch { - display: inline-block; - position: relative; - width: 65px; - height: 20px; - background: #ddd; - overflow: hidden; - cursor: pointer; - -webkit-transition: all .2s ease-in-out; - -ms-transition: all .2s ease-in-out; - transition: all .2s ease-in-out + display: inline-block; + position: relative; + width: 65px; + height: 20px; + background: #ddd; + overflow: hidden; + cursor: pointer; + -webkit-transition: all .2s ease-in-out; + -ms-transition: all .2s ease-in-out; + transition: all .2s ease-in-out } .lcs_cursor { - display: inline-block; - position: absolute; - top: 1px; - width: 18px; - height: 18px; - background: #ffffff; - box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.2), 0 3px 4px 0 rgba(0, 0, 0, 0.1); - z-index: 10; - -webkit-transition: all .2s linear; - -ms-transition: all .2s linear; - transition: all .2s linear + display: inline-block; + position: absolute; + top: 1px; + width: 18px; + height: 18px; + background: #ffffff; + box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.2), 0 3px 4px 0 rgba(0, 0, 0, 0.1); + z-index: 10; + -webkit-transition: all .2s linear; + -ms-transition: all .2s linear; + transition: all .2s linear } .lcs_label { - font-family: "Trebuchet MS", Helvetica, sans-serif; - font-size: 12px; - letter-spacing: 1px; - line-height: 12px; - color: #fff; - font-weight: bold; - position: absolute; - width: 26px; - top: 5px; - overflow: hidden; - text-align: center; - opacity: 0; - -webkit-transition: all .2s ease-in-out .1s; - -ms-transition: all .2s ease-in-out .1s; - transition: all .2s ease-in-out .1s + font-family: "Trebuchet MS", Helvetica, sans-serif; + font-size: 12px; + letter-spacing: 1px; + line-height: 12px; + color: #fff; + font-weight: bold; + position: absolute; + width: 26px; + top: 5px; + overflow: hidden; + text-align: center; + opacity: 0; + -webkit-transition: all .2s ease-in-out .1s; + -ms-transition: all .2s ease-in-out .1s; + transition: all .2s ease-in-out .1s } .lcs_label.lcs_label_on { - left: -70px; - z-index: 6; + left: -70px; + z-index: 6; } .lcs_label.lcs_label_off { - right: -70px; - z-index: 5; + right: -70px; + z-index: 5; } /* on */ @@ -73,34 +73,34 @@ } .lcs_switch.lcs_on .lcs_cursor { - left: 46px + left: 46px } .lcs_switch.lcs_on .lcs_label_on { - left: 10px; - opacity: 1 + left: 10px; + opacity: 1 } /* off */ .lcs_switch.lcs_off { - background: #b2b2b2; - box-shadow: 0px 0px 2px #a4a4a4 inset; + background: #b2b2b2; + box-shadow: 0px 0px 2px #a4a4a4 inset; } .lcs_switch.lcs_off .lcs_cursor { - left: 2px + left: 2px } .lcs_switch.lcs_off .lcs_label_off { - right: 10px; - opacity: 1; + right: 10px; + opacity: 1; } /* disabled */ .lcs_switch.lcs_disabled { - opacity: 0.65; - filter: alpha(opacity=65); - cursor: default + opacity: 0.65; + filter: alpha(opacity=65); + cursor: default } \ No newline at end of file diff --git a/template/css/user.css b/template/css/user.css index 8d1e833..695f536 100644 --- a/template/css/user.css +++ b/template/css/user.css @@ -1,6 +1,6 @@ #drop-files { - position: relative; + position: relative; width: 99%; height: 56px; margin: 0 auto; @@ -11,41 +11,41 @@ } #drop-files p { - clear: none; - padding: 0; - margin: 0; + clear: none; + padding: 0; + margin: 0; } #uploaded-holder { - display: none; - position: relative; - margin: 0 auto 10px; - width: 100%; + display: none; + position: relative; + margin: 0 auto 10px; + width: 100%; } #dropped-files { - display: block; - margin: 0 auto; - width: 100% + display: block; + margin: 0 auto; + width: 100% } #upload-button { - z-index: 9999; - display: none; - margin: 5px 0; + z-index: 9999; + display: none; + margin: 5px 0; } #loading-content { - position: relative; - font-size: 13px; - font-weight: bold; - text-align: center; - width: 100%; + position: relative; + font-size: 13px; + font-weight: bold; + text-align: center; + width: 100%; } #file-name-holder { - width: 100%; - float: left; + width: 100%; + float: left; } #file-name-holder h1 { @@ -56,14 +56,14 @@ #drop-files input { - border: 0; + border: 0; background-color: #ffffff; width: initial; } .image { - width: 140px; + width: 140px; height: 140px; - background-repeat: no-repeat !important + background-repeat: no-repeat !important } \ No newline at end of file diff --git a/template/jobs/jobs.html b/template/jobs/jobs.html index acc616e..2294197 100644 --- a/template/jobs/jobs.html +++ b/template/jobs/jobs.html @@ -1,23 +1,23 @@
    [job]
    -
    [desc]
    -
    - |answer|
    Ответ от администрации: [text]
    |_answer| -
    -
    Подать заявку
    +
    [desc]
    +
    + |answer|
    Ответ от администрации: [text]
    |_answer| +
    +
    Подать заявку
    \ No newline at end of file diff --git a/template/js/ace-elements.js b/template/js/ace-elements.js index 30fd1fe..ea46c6d 100644 --- a/template/js/ace-elements.js +++ b/template/js/ace-elements.js @@ -1 +1 @@ -jQuery(function(){if(!("ace" in window)){window.ace={}}window.ace.click_event=$.fn.tap?"tap":"click"});(function(e,c){var d="multiple" in document.createElement("INPUT");var j="FileList" in window;var b="FileReader" in window;var f=function(l,m){var k=this;this.settings=e.extend({},e.fn.ace_file_input.defaults,m);this.$element=e(l);this.element=l;this.disabled=false;this.can_reset=true;this.$element.on("change.ace_inner_call",function(o,n){if(n===true){return}return a.call(k)});this.$element.wrap('
    ');this.apply_settings()};f.error={FILE_LOAD_FAILED:1,IMAGE_LOAD_FAILED:2,THUMBNAIL_FAILED:3};f.prototype.apply_settings=function(){var l=this;var k=!!this.settings.icon_remove;this.multi=this.$element.attr("multiple")&&d;this.well_style=this.settings.style=="well";if(this.well_style){this.$element.parent().addClass("ace-file-multiple")}else{this.$element.parent().removeClass("ace-file-multiple")}this.$element.parent().find(":not(input[type=file])").remove();this.$element.after('"+(k?'':""));this.$label=this.$element.next();this.$label.on("click",function(){if(!this.disabled&&!l.element.disabled&&!l.$element.attr("readonly")){l.$element.click()}});if(k){this.$label.next("a").on(ace.click_event,function(){if(!l.can_reset){return false}var m=true;if(l.settings.before_remove){m=l.settings.before_remove.call(l.element)}if(!m){return false}return l.reset_input()})}if(this.settings.droppable&&j){g.call(this)}};f.prototype.show_file_list=function(k){var n=typeof k==="undefined"?this.$element.data("ace_input_files"):k;if(!n||n.length==0){return}if(this.well_style){this.$label.find("span").remove();if(!this.settings.btn_change){this.$label.addClass("hide-placeholder")}}this.$label.attr("data-title",this.settings.btn_change).addClass("selected");for(var p=0;p');var r=e.trim(n[p].type);var o=b&&this.settings.thumbnail&&((r.length>0&&r.match("image"))||(r.length==0&&m=="icon-picture"));if(o){var s=this;e.when(i.call(this,n[p])).fail(function(t){if(s.settings.preview_error){s.settings.preview_error.call(s,l,t.code)}})}}}return true};f.prototype.reset_input=function(){this.$label.attr({"data-title":this.settings.btn_choose,"class":""}).find("span:first").attr({"data-title":this.settings.no_file,"class":""}).find('[class*="icon-"]').attr("class",this.settings.no_icon).prev("img").remove();if(!this.settings.no_icon){this.$label.find('[class*="icon-"]').remove()}this.$label.find("span").not(":first").remove();if(this.$element.data("ace_input_files")){this.$element.removeData("ace_input_files");this.$element.removeData("ace_input_method")}this.reset_input_field();return false};f.prototype.reset_input_field=function(){this.$element.wrap("
    ").closest("form").get(0).reset();this.$element.unwrap()};f.prototype.enable_reset=function(k){this.can_reset=k};f.prototype.disable=function(){this.disabled=true;this.$element.attr("disabled","disabled").addClass("disabled")};f.prototype.enable=function(){this.disabled=false;this.$element.removeAttr("disabled").removeClass("disabled")};f.prototype.files=function(){return e(this).data("ace_input_files")||null};f.prototype.method=function(){return e(this).data("ace_input_method")||""};f.prototype.update_settings=function(k){this.settings=e.extend({},this.settings,k);this.apply_settings()};var g=function(){var l=this;var k=this.element.parentNode;e(k).on("dragenter",function(m){m.preventDefault();m.stopPropagation()}).on("dragover",function(m){m.preventDefault();m.stopPropagation()}).on("drop",function(q){q.preventDefault();q.stopPropagation();var p=q.originalEvent.dataTransfer;var o=p.files;if(!l.multi&&o.length>1){var n=[];n.push(o[0]);o=n}var m=true;if(l.settings.before_change){m=l.settings.before_change.call(l.element,o,true)}if(!m||m.length==0){return false}if(m instanceof Array||(j&&m instanceof FileList)){o=m}l.$element.data("ace_input_files",o);l.$element.data("ace_input_method","drop");l.show_file_list(o);l.$element.triggerHandler("change",[true]);return true})};var a=function(){var l=true;if(this.settings.before_change){l=this.settings.before_change.call(this.element,this.element.files||[this.element.value],false)}if(!l||l.length==0){if(!this.$element.data("ace_input_files")){this.reset_input_field()}return false}var m=!j?null:((l instanceof Array||l instanceof FileList)?l:this.element.files);this.$element.data("ace_input_method","select");if(m&&m.length>0){this.$element.data("ace_input_files",m)}else{var k=e.trim(this.element.value);if(k&&k.length>0){m=[];m.push(k);this.$element.data("ace_input_files",m)}}if(!m||m.length==0){return false}this.show_file_list(m);return true};var i=function(o){var n=this;var l=n.$label.find("span:last");var m=new e.Deferred;var k=new FileReader();k.onload=function(q){l.prepend("");var p=l.find("img:last").get(0);e(p).one("load",function(){var t=50;if(n.settings.thumbnail=="large"){t=150}else{if(n.settings.thumbnail=="fit"){t=l.width()}}l.addClass(t>50?"large":"");var s=h(p,t,o.type);if(s==null){e(this).remove();m.reject({code:f.error.THUMBNAIL_FAILED});return}var r=s.w,u=s.h;if(n.settings.thumbnail=="small"){r=u=t}e(p).css({"background-image":"url("+s.src+")",width:r,height:u}).data("thumb",s.src).attr({src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWNgYGBgAAAABQABh6FO1AAAAABJRU5ErkJggg=="}).show();m.resolve()}).one("error",function(){l.find("img").remove();m.reject({code:f.error.IMAGE_LOAD_FAILED})});p.src=q.target.result};k.onerror=function(p){m.reject({code:f.error.FILE_LOAD_FAILED})};k.readAsDataURL(o);return m.promise()};var h=function(n,s,q){var r=n.width,o=n.height;if(r>s||o>s){if(r>o){o=parseInt(s/r*o);r=s}else{r=parseInt(s/o*r);o=s}}var m;try{var l=document.createElement("canvas");l.width=r;l.height=o;var k=l.getContext("2d");k.drawImage(n,0,0,n.width,n.height,0,0,r,o);m=l.toDataURL()}catch(p){m=null}if(!(/^data\:image\/(png|jpe?g|gif);base64,[0-9A-Za-z\+\/\=]+$/.test(m))){m=null}if(!m){return null}return{src:m,w:r,h:o}};e.fn.ace_file_input=function(m,n){var l;var k=this.each(function(){var q=e(this);var p=q.data("ace_file_input");var o=typeof m==="object"&&m;if(!p){q.data("ace_file_input",(p=new f(this,o)))}if(typeof m==="string"){l=p[m](n)}});return(l===c)?k:l};e.fn.ace_file_input.defaults={style:false,no_file:"No File ...",no_icon:"icon-upload-alt",btn_choose:"Choose",btn_change:"Change",icon_remove:"icon-remove",droppable:false,thumbnail:false,before_change:null,before_remove:null,preview_error:null}})(window.jQuery);(function(a,b){a.fn.ace_spinner=function(c){this.each(function(){var f=c.icon_up||"icon-chevron-up";var i=c.icon_down||"icon-chevron-down";var e=c.btn_up_class||"";var g=c.btn_down_class||"";var d=c.max||999;d=(""+d).length;var j=a(this).addClass("spinner-input").css("width",(d*10)+"px").wrap('
    ').after('
    ').closest(".ace-spinner").spinner(c).wrapInner("
    ");a(this).on("mousewheel DOMMouseScroll",function(k){var l=k.originalEvent.detail<0||k.originalEvent.wheelDelta>0?1:-1;j.spinner("step",l>0);j.spinner("triggerChangedEvent");return false});var h=a(this);j.on("changed",function(){h.trigger("change")})});return this}})(window.jQuery);(function(a,b){a.fn.ace_wizard=function(c){this.each(function(){var h=a(this);var d=h.find("li");var e=d.length;var f=parseFloat((100/e).toFixed(1))+"%";d.css({"min-width":f,"max-width":f});h.show().wizard();var g=h.siblings(".wizard-actions").eq(0);var i=h.data("wizard");i.$prevBtn.remove();i.$nextBtn.remove();i.$prevBtn=g.find(".btn-prev").eq(0).on(ace.click_event,function(){h.wizard("previous")}).attr("disabled","disabled");i.$nextBtn=g.find(".btn-next").eq(0).on(ace.click_event,function(){h.wizard("next")}).removeAttr("disabled");i.nextText=i.$nextBtn.text()});return this}})(window.jQuery);(function(a,b){a.fn.ace_colorpicker=function(c){var d=a.extend({pull_right:false,caret:true},c);this.each(function(){var g=a(this);var e="";var f="";a(this).hide().find("option").each(function(){var h="colorpick-btn";if(this.selected){h+=" selected";f=this.value}e+='
  • '}).end().on("change.ace_inner_call",function(){a(this).next().find(".btn-colorpicker").css("background-color",this.value)}).after('").next().find(".dropdown-menu").on(ace.click_event,function(j){var h=a(j.target);if(!h.is(".colorpick-btn")){return false}h.closest("ul").find(".selected").removeClass("selected");h.addClass("selected");var i=h.data("color");g.val(i).change();j.preventDefault();return true})});return this}})(window.jQuery);(function(a,b){a.fn.ace_tree=function(d){var c={"open-icon":"icon-folder-open","close-icon":"icon-folder-close",selectable:true,"selected-icon":"icon-ok","unselected-icon":"tree-dot"};c=a.extend({},c,d);this.each(function(){var e=a(this);e.html(' ');e.addClass(c.selectable==true?"tree-selectable":"tree-unselectable");e.tree(c)});return this}})(window.jQuery);(function(a,b){a.fn.ace_wysiwyg=function(c,h){var d=a.extend({speech_button:true,wysiwyg:{}},c);var e=["#ac725e","#d06b64","#f83a22","#fa573c","#ff7537","#ffad46","#42d692","#16a765","#7bd148","#b3dc6c","#fbe983","#fad165","#92e1c0","#9fe1e7","#9fc6e7","#4986e7","#9a9cff","#b99aff","#c2c2c2","#cabdbf","#cca6ac","#f691b2","#cd74e6","#a47ae2","#444444"];var g={font:{values:["Arial","Courier","Comic Sans MS","Helvetica","Open Sans","Tahoma","Verdana"],icon:"icon-font",title:"Font"},fontSize:{values:{5:"Huge",3:"Normal",1:"Small"},icon:"icon-text-height",title:"Font Size"},bold:{icon:"icon-bold",title:"Bold (Ctrl/Cmd+B)"},italic:{icon:"icon-italic",title:"Italic (Ctrl/Cmd+I)"},strikethrough:{icon:"icon-strikethrough",title:"Strikethrough"},underline:{icon:"icon-underline",title:"Underline"},insertunorderedlist:{icon:"icon-list-ul",title:"Bullet list"},insertorderedlist:{icon:"icon-list-ol",title:"Number list"},outdent:{icon:"icon-indent-left",title:"Reduce indent (Shift+Tab)"},indent:{icon:"icon-indent-right",title:"Indent (Tab)"},justifyleft:{icon:"icon-align-left",title:"Align Left (Ctrl/Cmd+L)"},justifycenter:{icon:"icon-align-center",title:"Center (Ctrl/Cmd+E)"},justifyright:{icon:"icon-align-right",title:"Align Right (Ctrl/Cmd+R)"},justifyfull:{icon:"icon-align-justify",title:"Justify (Ctrl/Cmd+J)"},createLink:{icon:"icon-link",title:"Hyperlink",button_text:"Add",placeholder:"URL"},unlink:{icon:"icon-unlink",title:"Remove Hyperlink"},insertImage:{icon:"icon-picture",title:"Insert picture",button_text:' Choose Image …',placeholder:"Image URL"},foreColor:{values:e,title:"Change Color"},backColor:{values:e,title:"Change Background Color"},undo:{icon:"icon-undo",title:"Undo (Ctrl/Cmd+Z)"},redo:{icon:"icon-repeat",title:"Redo (Ctrl/Cmd+Y)"}};var f=d.toolbar||["font",null,"fontSize",null,"bold","italic","strikethrough","underline",null,"insertunorderedlist","insertorderedlist","outdent","indent",null,"justifyleft","justifycenter","justifyright","justifyfull",null,"createLink","unlink",null,"insertImage",null,"foreColor",null,"undo","redo"];this.each(function(){var q='
    ';for(var m in f){if(f.hasOwnProperty(m)){var o=f[m];if(o===null){q+='
    ';continue}if(typeof o=="string"&&o in g){o=g[o];o.name=f[m]}else{if(typeof o=="object"&&o.name in g){o=a.extend(g[o.name],o)}else{continue}}var p="className" in o?o.className:"";switch(o.name){case"font":q+=' ';q+=' ";break;case"fontSize":q+='   ';q+=' ";break;case"createLink":q+=' ';q+=' ";break;case"insertImage":q+=' ';q+=' ";break;case"foreColor":case"backColor":q+=' ";q+=' ';break;default:q+=' ';break}}}q+="
    ";if(d.toolbar_place){q=d.toolbar_place.call(this,q)}else{q=a(this).before(q).prev()}q.find("a[title]").tooltip({animation:false});q.find(".dropdown-menu input:not([type=file])").on(ace.click_event,function(){return false}).on("change",function(){a(this).closest(".dropdown-menu").siblings(".dropdown-toggle").dropdown("toggle")}).on("keydown",function(s){if(s.which==27){this.value="";a(this).change()}});q.find("input[type=file]").prev().on(ace.click_event,function(s){a(this).next().click()});q.find(".wysiwyg_colorpicker").each(function(){a(this).ace_colorpicker({pull_right:true,caret:false}).change(function(){a(this).nextAll("input").eq(0).val(this.value).change()}).next().find(".btn-colorpicker").tooltip({title:this.title,animation:false})});var k;if(d.speech_button&&"onwebkitspeechchange" in (k=document.createElement("input"))){var i=a(this).offset();q.append(k);a(k).attr({type:"text","data-edit":"inserttext","x-webkit-speech":""}).addClass("wysiwyg-speech-input").css({position:"absolute"}).offset({top:i.top,left:i.left+a(this).innerWidth()-35})}else{k=null}var n=a.extend({},{activeToolbarClass:"active",toolbarSelector:q},d.wysiwyg||{});a(this).wysiwyg(n)});return this}})(window.jQuery); \ No newline at end of file +jQuery(function(){if(!("ace" in window)){window.ace={}}window.ace.click_event=$.fn.tap?"tap":"click"});(function(e,c){var d="multiple" in document.createElement("INPUT");var j="FileList" in window;var b="FileReader" in window;var f=function(l,m){var k=this;this.settings=e.extend({},e.fn.ace_file_input.defaults,m);this.$element=e(l);this.element=l;this.disabled=false;this.can_reset=true;this.$element.on("change.ace_inner_call",function(o,n){if(n===true){return}return a.call(k)});this.$element.wrap('
    ');this.apply_settings()};f.error={FILE_LOAD_FAILED:1,IMAGE_LOAD_FAILED:2,THUMBNAIL_FAILED:3};f.prototype.apply_settings=function(){var l=this;var k=!!this.settings.icon_remove;this.multi=this.$element.attr("multiple")&&d;this.well_style=this.settings.style=="well";if(this.well_style){this.$element.parent().addClass("ace-file-multiple")}else{this.$element.parent().removeClass("ace-file-multiple")}this.$element.parent().find(":not(input[type=file])").remove();this.$element.after('"+(k?'':""));this.$label=this.$element.next();this.$label.on("click",function(){if(!this.disabled&&!l.element.disabled&&!l.$element.attr("readonly")){l.$element.click()}});if(k){this.$label.next("a").on(ace.click_event,function(){if(!l.can_reset){return false}var m=true;if(l.settings.before_remove){m=l.settings.before_remove.call(l.element)}if(!m){return false}return l.reset_input()})}if(this.settings.droppable&&j){g.call(this)}};f.prototype.show_file_list=function(k){var n=typeof k==="undefined"?this.$element.data("ace_input_files"):k;if(!n||n.length==0){return}if(this.well_style){this.$label.find("span").remove();if(!this.settings.btn_change){this.$label.addClass("hide-placeholder")}}this.$label.attr("data-title",this.settings.btn_change).addClass("selected");for(var p=0;p');var r=e.trim(n[p].type);var o=b&&this.settings.thumbnail&&((r.length>0&&r.match("image"))||(r.length==0&&m=="icon-picture"));if(o){var s=this;e.when(i.call(this,n[p])).fail(function(t){if(s.settings.preview_error){s.settings.preview_error.call(s,l,t.code)}})}}}return true};f.prototype.reset_input=function(){this.$label.attr({"data-title":this.settings.btn_choose,"class":""}).find("span:first").attr({"data-title":this.settings.no_file,"class":""}).find('[class*="icon-"]').attr("class",this.settings.no_icon).prev("img").remove();if(!this.settings.no_icon){this.$label.find('[class*="icon-"]').remove()}this.$label.find("span").not(":first").remove();if(this.$element.data("ace_input_files")){this.$element.removeData("ace_input_files");this.$element.removeData("ace_input_method")}this.reset_input_field();return false};f.prototype.reset_input_field=function(){this.$element.wrap("").closest("form").get(0).reset();this.$element.unwrap()};f.prototype.enable_reset=function(k){this.can_reset=k};f.prototype.disable=function(){this.disabled=true;this.$element.attr("disabled","disabled").addClass("disabled")};f.prototype.enable=function(){this.disabled=false;this.$element.removeAttr("disabled").removeClass("disabled")};f.prototype.files=function(){return e(this).data("ace_input_files")||null};f.prototype.method=function(){return e(this).data("ace_input_method")||""};f.prototype.update_settings=function(k){this.settings=e.extend({},this.settings,k);this.apply_settings()};var g=function(){var l=this;var k=this.element.parentNode;e(k).on("dragenter",function(m){m.preventDefault();m.stopPropagation()}).on("dragover",function(m){m.preventDefault();m.stopPropagation()}).on("drop",function(q){q.preventDefault();q.stopPropagation();var p=q.originalEvent.dataTransfer;var o=p.files;if(!l.multi&&o.length>1){var n=[];n.push(o[0]);o=n}var m=true;if(l.settings.before_change){m=l.settings.before_change.call(l.element,o,true)}if(!m||m.length==0){return false}if(m instanceof Array||(j&&m instanceof FileList)){o=m}l.$element.data("ace_input_files",o);l.$element.data("ace_input_method","drop");l.show_file_list(o);l.$element.triggerHandler("change",[true]);return true})};var a=function(){var l=true;if(this.settings.before_change){l=this.settings.before_change.call(this.element,this.element.files||[this.element.value],false)}if(!l||l.length==0){if(!this.$element.data("ace_input_files")){this.reset_input_field()}return false}var m=!j?null:((l instanceof Array||l instanceof FileList)?l:this.element.files);this.$element.data("ace_input_method","select");if(m&&m.length>0){this.$element.data("ace_input_files",m)}else{var k=e.trim(this.element.value);if(k&&k.length>0){m=[];m.push(k);this.$element.data("ace_input_files",m)}}if(!m||m.length==0){return false}this.show_file_list(m);return true};var i=function(o){var n=this;var l=n.$label.find("span:last");var m=new e.Deferred;var k=new FileReader();k.onload=function(q){l.prepend("");var p=l.find("img:last").get(0);e(p).one("load",function(){var t=50;if(n.settings.thumbnail=="large"){t=150}else{if(n.settings.thumbnail=="fit"){t=l.width()}}l.addClass(t>50?"large":"");var s=h(p,t,o.type);if(s==null){e(this).remove();m.reject({code:f.error.THUMBNAIL_FAILED});return}var r=s.w,u=s.h;if(n.settings.thumbnail=="small"){r=u=t}e(p).css({"background-image":"url("+s.src+")",width:r,height:u}).data("thumb",s.src).attr({src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWNgYGBgAAAABQABh6FO1AAAAABJRU5ErkJggg=="}).show();m.resolve()}).one("error",function(){l.find("img").remove();m.reject({code:f.error.IMAGE_LOAD_FAILED})});p.src=q.target.result};k.onerror=function(p){m.reject({code:f.error.FILE_LOAD_FAILED})};k.readAsDataURL(o);return m.promise()};var h=function(n,s,q){var r=n.width,o=n.height;if(r>s||o>s){if(r>o){o=parseInt(s/r*o);r=s}else{r=parseInt(s/o*r);o=s}}var m;try{var l=document.createElement("canvas");l.width=r;l.height=o;var k=l.getContext("2d");k.drawImage(n,0,0,n.width,n.height,0,0,r,o);m=l.toDataURL()}catch(p){m=null}if(!(/^data\:image\/(png|jpe?g|gif);base64,[0-9A-Za-z\+\/\=]+$/.test(m))){m=null}if(!m){return null}return{src:m,w:r,h:o}};e.fn.ace_file_input=function(m,n){var l;var k=this.each(function(){var q=e(this);var p=q.data("ace_file_input");var o=typeof m==="object"&&m;if(!p){q.data("ace_file_input",(p=new f(this,o)))}if(typeof m==="string"){l=p[m](n)}});return(l===c)?k:l};e.fn.ace_file_input.defaults={style:false,no_file:"No File ...",no_icon:"icon-upload-alt",btn_choose:"Choose",btn_change:"Change",icon_remove:"icon-remove",droppable:false,thumbnail:false,before_change:null,before_remove:null,preview_error:null}})(window.jQuery);(function(a,b){a.fn.ace_spinner=function(c){this.each(function(){var f=c.icon_up||"icon-chevron-up";var i=c.icon_down||"icon-chevron-down";var e=c.btn_up_class||"";var g=c.btn_down_class||"";var d=c.max||999;d=(""+d).length;var j=a(this).addClass("spinner-input").css("width",(d*10)+"px").wrap('
    ').after('
    ').closest(".ace-spinner").spinner(c).wrapInner("
    ");a(this).on("mousewheel DOMMouseScroll",function(k){var l=k.originalEvent.detail<0||k.originalEvent.wheelDelta>0?1:-1;j.spinner("step",l>0);j.spinner("triggerChangedEvent");return false});var h=a(this);j.on("changed",function(){h.trigger("change")})});return this}})(window.jQuery);(function(a,b){a.fn.ace_wizard=function(c){this.each(function(){var h=a(this);var d=h.find("li");var e=d.length;var f=parseFloat((100/e).toFixed(1))+"%";d.css({"min-width":f,"max-width":f});h.show().wizard();var g=h.siblings(".wizard-actions").eq(0);var i=h.data("wizard");i.$prevBtn.remove();i.$nextBtn.remove();i.$prevBtn=g.find(".btn-prev").eq(0).on(ace.click_event,function(){h.wizard("previous")}).attr("disabled","disabled");i.$nextBtn=g.find(".btn-next").eq(0).on(ace.click_event,function(){h.wizard("next")}).removeAttr("disabled");i.nextText=i.$nextBtn.text()});return this}})(window.jQuery);(function(a,b){a.fn.ace_colorpicker=function(c){var d=a.extend({pull_right:false,caret:true},c);this.each(function(){var g=a(this);var e="";var f="";a(this).hide().find("option").each(function(){var h="colorpick-btn";if(this.selected){h+=" selected";f=this.value}e+='
  • '}).end().on("change.ace_inner_call",function(){a(this).next().find(".btn-colorpicker").css("background-color",this.value)}).after('").next().find(".dropdown-menu").on(ace.click_event,function(j){var h=a(j.target);if(!h.is(".colorpick-btn")){return false}h.closest("ul").find(".selected").removeClass("selected");h.addClass("selected");var i=h.data("color");g.val(i).change();j.preventDefault();return true})});return this}})(window.jQuery);(function(a,b){a.fn.ace_tree=function(d){var c={"open-icon":"icon-folder-open","close-icon":"icon-folder-close",selectable:true,"selected-icon":"icon-ok","unselected-icon":"tree-dot"};c=a.extend({},c,d);this.each(function(){var e=a(this);e.html(' ');e.addClass(c.selectable==true?"tree-selectable":"tree-unselectable");e.tree(c)});return this}})(window.jQuery);(function(a,b){a.fn.ace_wysiwyg=function(c,h){var d=a.extend({speech_button:true,wysiwyg:{}},c);var e=["#ac725e","#d06b64","#f83a22","#fa573c","#ff7537","#ffad46","#42d692","#16a765","#7bd148","#b3dc6c","#fbe983","#fad165","#92e1c0","#9fe1e7","#9fc6e7","#4986e7","#9a9cff","#b99aff","#c2c2c2","#cabdbf","#cca6ac","#f691b2","#cd74e6","#a47ae2","#444444"];var g={font:{values:["Arial","Courier","Comic Sans MS","Helvetica","Open Sans","Tahoma","Verdana"],icon:"icon-font",title:"Font"},fontSize:{values:{5:"Huge",3:"Normal",1:"Small"},icon:"icon-text-height",title:"Font Size"},bold:{icon:"icon-bold",title:"Bold (Ctrl/Cmd+B)"},italic:{icon:"icon-italic",title:"Italic (Ctrl/Cmd+I)"},strikethrough:{icon:"icon-strikethrough",title:"Strikethrough"},underline:{icon:"icon-underline",title:"Underline"},insertunorderedlist:{icon:"icon-list-ul",title:"Bullet list"},insertorderedlist:{icon:"icon-list-ol",title:"Number list"},outdent:{icon:"icon-indent-left",title:"Reduce indent (Shift+Tab)"},indent:{icon:"icon-indent-right",title:"Indent (Tab)"},justifyleft:{icon:"icon-align-left",title:"Align Left (Ctrl/Cmd+L)"},justifycenter:{icon:"icon-align-center",title:"Center (Ctrl/Cmd+E)"},justifyright:{icon:"icon-align-right",title:"Align Right (Ctrl/Cmd+R)"},justifyfull:{icon:"icon-align-justify",title:"Justify (Ctrl/Cmd+J)"},createLink:{icon:"icon-link",title:"Hyperlink",button_text:"Add",placeholder:"URL"},unlink:{icon:"icon-unlink",title:"Remove Hyperlink"},insertImage:{icon:"icon-picture",title:"Insert picture",button_text:' Choose Image …',placeholder:"Image URL"},foreColor:{values:e,title:"Change Color"},backColor:{values:e,title:"Change Background Color"},undo:{icon:"icon-undo",title:"Undo (Ctrl/Cmd+Z)"},redo:{icon:"icon-repeat",title:"Redo (Ctrl/Cmd+Y)"}};var f=d.toolbar||["font",null,"fontSize",null,"bold","italic","strikethrough","underline",null,"insertunorderedlist","insertorderedlist","outdent","indent",null,"justifyleft","justifycenter","justifyright","justifyfull",null,"createLink","unlink",null,"insertImage",null,"foreColor",null,"undo","redo"];this.each(function(){var q='
    ';for(var m in f){if(f.hasOwnProperty(m)){var o=f[m];if(o===null){q+='
    ';continue}if(typeof o=="string"&&o in g){o=g[o];o.name=f[m]}else{if(typeof o=="object"&&o.name in g){o=a.extend(g[o.name],o)}else{continue}}var p="className" in o?o.className:"";switch(o.name){case"font":q+=' ';q+=' ";break;case"fontSize":q+='   ';q+=' ";break;case"createLink":q+=' ';q+=' ";break;case"insertImage":q+=' ';q+=' ";break;case"foreColor":case"backColor":q+=' ";q+=' ';break;default:q+=' ';break}}}q+="
    ";if(d.toolbar_place){q=d.toolbar_place.call(this,q)}else{q=a(this).before(q).prev()}q.find("a[title]").tooltip({animation:false});q.find(".dropdown-menu input:not([type=file])").on(ace.click_event,function(){return false}).on("change",function(){a(this).closest(".dropdown-menu").siblings(".dropdown-toggle").dropdown("toggle")}).on("keydown",function(s){if(s.which==27){this.value="";a(this).change()}});q.find("input[type=file]").prev().on(ace.click_event,function(s){a(this).next().click()});q.find(".wysiwyg_colorpicker").each(function(){a(this).ace_colorpicker({pull_right:true,caret:false}).change(function(){a(this).nextAll("input").eq(0).val(this.value).change()}).next().find(".btn-colorpicker").tooltip({title:this.title,animation:false})});var k;if(d.speech_button&&"onwebkitspeechchange" in (k=document.createElement("input"))){var i=a(this).offset();q.append(k);a(k).attr({type:"text","data-edit":"inserttext","x-webkit-speech":""}).addClass("wysiwyg-speech-input").css({position:"absolute"}).offset({top:i.top,left:i.left+a(this).innerWidth()-35})}else{k=null}var n=a.extend({},{activeToolbarClass:"active",toolbarSelector:q},d.wysiwyg||{});a(this).wysiwyg(n)});return this}})(window.jQuery); \ No newline at end of file diff --git a/template/js/chat.js b/template/js/chat.js index bd48bad..23165b0 100644 --- a/template/js/chat.js +++ b/template/js/chat.js @@ -1,215 +1,215 @@ $('#send').ajaxForm({ - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); - if(i == 's') - { - chat_sound('send'); - $('#text').val(''); - $('#login').val('') - document.getElementById("text").removeAttribute("style"); - $('#img-input').html(''); - $('#uploaded-files').html(''); - $('#uploaded-files').css('display', 'none'); - $('#frm').html($('#frm').html());; - chat_dialog(false); - } - }); + if(i == 's') + { + chat_sound('send'); + $('#text').val(''); + $('#login').val('') + document.getElementById("text").removeAttribute("style"); + $('#img-input').html(''); + $('#uploaded-files').html(''); + $('#uploaded-files').css('display', 'none'); + $('#frm').html($('#frm').html());; + chat_dialog(false); + } + }); - loading(0); + loading(0); - return false; - } + return false; + } }); function chat_readers(go) { - $.get(home+'chat/section/read/id/1', - function(readers) - { - $('#chat_readers').html(readers); - $('#chat_readers_modal').html(readers); + $.get(home+'chat/section/read/id/1', + function(readers) + { + $('#chat_readers').html(readers); + $('#chat_readers_modal').html(readers); - if(!go) - setTimeout(function() {chat_readers(false)}, 3000); - }); + if(!go) + setTimeout(function() {chat_readers(false)}, 3000); + }); } function chat_writers(now) { - write = ''; + write = ''; - if(now) - write = '/write/1'; + if(now) + write = '/write/1'; - $.get(home+'chat/section/write/id/1'+write, - function(writers) - { - $('#chat_writers').html(writers); - - if(!now) - setTimeout(function() {chat_writers(false)}, 3000); - }); + $.get(home+'chat/section/write/id/1'+write, + function(writers) + { + $('#chat_writers').html(writers); + + if(!now) + setTimeout(function() {chat_writers(false)}, 3000); + }); } function chat_msg_send() { - if($('#text').val() == '') - { - chat_sound('err'); - return false; - } + if($('#text').val() == '') + { + chat_sound('err'); + return false; + } - loading(1); + loading(1); - return true; + return true; } function chat_msg_edit(id, type) { - if(type == 'edit') - { - $.get(home+'chat/section/edit/id/'+id, function(data){ - bootbox.dialog('

    Выбранное сообщение

    '+data+'
    Спойлер
    Подсветка
    Цитата
    Ссылка
    ', - [{ - "label" : "Продолжить", - callback : function(){chat_msg_edit(id, 'edit_go')}, - },{ - "label" : "Закрыть", - }] - ); - }); - }else{ - $.ajax({ - type: 'POST', - url: home+'chat/section/edit/go', - data: 'edit='+$('#edit').val()+'&id='+id, - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Внимание!

    '+val, - [{ - "label" : "OK", - }] - ); + if(type == 'edit') + { + $.get(home+'chat/section/edit/id/'+id, function(data){ + bootbox.dialog('

    Выбранное сообщение

    '+data+'
    Спойлер
    Подсветка
    Цитата
    Ссылка
    ', + [{ + "label" : "Продолжить", + callback : function(){chat_msg_edit(id, 'edit_go')}, + },{ + "label" : "Закрыть", + }] + ); + }); + }else{ + $.ajax({ + type: 'POST', + url: home+'chat/section/edit/go', + data: 'edit='+$('#edit').val()+'&id='+id, + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Внимание!

    '+val, + [{ + "label" : "OK", + }] + ); - if(i == 's') - { - chat_dialog(false); - loading(0) - } + if(i == 's') + { + chat_dialog(false); + loading(0) + } - }); - } - }); - } + }); + } + }); + } } function chat_msg_del(id, user) { - bootbox.dialog('

    Выберите операцию

    ', - [{ - "label" : "Удалить выбранное сообщение", - "class" : "btn-small btn-primary", - callback: function(){ - $('#msg_'+id).css('display', 'none'); - chat_msg_del_go(id, '?id=1') - } - },{ - "label" : "Удалить все отправленное сообщение", - "class" : "btn-small btn-primary", - callback: function(){ - $('.user_'+user).css('display', 'none'); - chat_msg_del_go(user, '?user=1') - } - },{ - "label" : "Отмена", - "class" : "btn-small btn-primary" - }] - ); + bootbox.dialog('

    Выберите операцию

    ', + [{ + "label" : "Удалить выбранное сообщение", + "class" : "btn-small btn-primary", + callback: function(){ + $('#msg_'+id).css('display', 'none'); + chat_msg_del_go(id, '?id=1') + } + },{ + "label" : "Удалить все отправленное сообщение", + "class" : "btn-small btn-primary", + callback: function(){ + $('.user_'+user).css('display', 'none'); + chat_msg_del_go(user, '?user=1') + } + },{ + "label" : "Отмена", + "class" : "btn-small btn-primary" + }] + ); - return false; + return false; } function chat_msg_del_go(id, type) { - $.getJSON(home+'chat/section/delete/id/'+id+'/go/'+type, function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); + $.getJSON(home+'chat/section/delete/id/'+id+'/go/'+type, function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); - if(i == 's') - chat_dialog(false); - }); - }); + if(i == 's') + chat_dialog(false); + }); + }); - return false; + return false; } function chat_dialog(go) { - var dialog_form = document.getElementById('dialog'); + var dialog_form = document.getElementById('dialog'); - $.get(home+'chat/section/dialog', function(data){ - $('#dialog').html(data) + $.get(home+'chat/section/dialog', function(data){ + $('#dialog').html(data) - $('.spoiler').click(function(){ - $(this).parent().children('div.spoiler_main').toggle(0); - }); + $('.spoiler').click(function(){ + $(this).parent().children('div.spoiler_main').toggle(0); + }); - $('pre code').each(function(i, block){ - hljs.highlightBlock(block); - }); - }); - notice_load(true); + $('pre code').each(function(i, block){ + hljs.highlightBlock(block); + }); + }); + notice_load(true); - if(chat_scroll_ativate) - setTimeout(function() {dialog_form.scrollTop = dialog_form.scrollHeight;}, 300); + if(chat_scroll_ativate) + setTimeout(function() {dialog_form.scrollTop = dialog_form.scrollHeight;}, 300); - if(chat_notice_ativate) - chat_dialog_info(); + if(chat_notice_ativate) + chat_dialog_info(); - if(go) - { - spoilers = $('.spoiler_main'); - update = true; - for(var i = 0; i < spoilers.length; i++) - { - if(spoilers[i].style.display == 'block') - { - setTimeout(function() {chat_dialog(true)}, 4000); + if(go) + { + spoilers = $('.spoiler_main'); + update = true; + for(var i = 0; i < spoilers.length; i++) + { + if(spoilers[i].style.display == 'block') + { + setTimeout(function() {chat_dialog(true)}, 4000); - return false; - } - } - setTimeout(function() {chat_dialog(true)}, 4000); - } + return false; + } + } + setTimeout(function() {chat_dialog(true)}, 4000); + } } function notice_load(go) { - $.get(home+'chat/section/notice/check', function(data) + $.get(home+'chat/section/notice/check', function(data) { if(data == 0) document.getElementById('notice_chat').className = 'notice_chat__check'; @@ -217,112 +217,112 @@ function notice_load(go) document.getElementById('notice_chat').className = ''; if(go) - notice_load(go); + notice_load(go); }); } function chat_dialog_info(go) { - $.get(home+'chat/section/dialog/go', function(data){ - if(data != chat_dialog_id && data != '') - { - chat_dialog_id = data; - chat_sound('notice') - } - }); + $.get(home+'chat/section/dialog/go', function(data){ + if(data != chat_dialog_id && data != '') + { + chat_dialog_id = data; + chat_sound('notice') + } + }); } function reply_chat(login) { - $('#login').val(login); - $('#text').val(login+', '+$('#text').val()); + $('#login').val(login); + $('#text').val(login+', '+$('#text').val()); - return false; + return false; } function chat_scroll_change() { - if(chat_scroll_ativate) - { - chat_scroll_ativate = false; - $('#chat_scroll').html('включить скроллинг'); - }else{ - chat_scroll_ativate = true; - $('#chat_scroll').html('отключить скроллинг'); - } + if(chat_scroll_ativate) + { + chat_scroll_ativate = false; + $('#chat_scroll').html('включить скроллинг'); + }else{ + chat_scroll_ativate = true; + $('#chat_scroll').html('отключить скроллинг'); + } } function chat_notice_change() { - if(chat_notice_ativate) - { - chat_notice_ativate = false; - $('#chat_notice').html('включить уведомления'); - }else{ - chat_notice_ativate = true; - $('#chat_notice').html('отключить уведомления'); - } + if(chat_notice_ativate) + { + chat_notice_ativate = false; + $('#chat_notice').html('включить уведомления'); + }else{ + chat_notice_ativate = true; + $('#chat_notice').html('отключить уведомления'); + } } function chat_sound_change() { - if(chat_sound_ativate) - { - chat_sound_ativate = false; - $('#chat_sound').html('включить звуки'); - }else{ - chat_sound_ativate = true; - $('#chat_sound').html('отключить звуки'); - } + if(chat_sound_ativate) + { + chat_sound_ativate = false; + $('#chat_sound').html('включить звуки'); + }else{ + chat_sound_ativate = true; + $('#chat_sound').html('отключить звуки'); + } } function chat_emoji(emoji) { - form = document.getElementById('text'); - begin = form.value.substr(0, form.selectionStart); - end = form.value.substr(form.selectionEnd); - var text = form.firstChild; - form.value = begin+'[emoji_'+emoji+']'+end; - selPos = '[emoji_'+emoji+']'.length+begin.length; - form.setSelectionRange(begin.length, selPos); + form = document.getElementById('text'); + begin = form.value.substr(0, form.selectionStart); + end = form.value.substr(form.selectionEnd); + var text = form.firstChild; + form.value = begin+'[emoji_'+emoji+']'+end; + selPos = '[emoji_'+emoji+']'.length+begin.length; + form.setSelectionRange(begin.length, selPos); - return false; + return false; } function chat_sound(track) { - if(!chat_sound_ativate) - return false; + if(!chat_sound_ativate) + return false; - var audio = new Audio(); - audio.preload = 'auto'; - audio.src = '/template/sections/chat/sound/chat_'+track+'.wav'; - audio.play(); + var audio = new Audio(); + audio.preload = 'auto'; + audio.src = '/template/sections/chat/sound/chat_'+track+'.wav'; + audio.play(); } function clearFileUpload(id) { - fileField = document.getElementById(id); - parentNod = fileField.parentNode; - tmpForm = document.createElement("form"); - parentNod.replaceChild(tmpForm,fileField); - tmpForm.appendChild(fileField); - tmpForm.reset(); - parentNod.replaceChild(fileField,tmpForm); + fileField = document.getElementById(id); + parentNod = fileField.parentNode; + tmpForm = document.createElement("form"); + parentNod.replaceChild(tmpForm,fileField); + tmpForm.appendChild(fileField); + tmpForm.reset(); + parentNod.replaceChild(fileField,tmpForm); } function bbcode(bbbegin, bbend, eID) { - form = document.getElementById(eID); - begin = form.value.substr(0, form.selectionStart); - end = form.value.substr(form.selectionEnd); - sel = form.value.substr(form.selectionStart, form.selectionEnd-form.selectionStart); - var text = form.firstChild; - form.value = begin+bbbegin+sel+bbend+end; - selPos = bbbegin.length+begin.length+sel.length+bbend.length; - form.setSelectionRange(begin.length, selPos); + form = document.getElementById(eID); + begin = form.value.substr(0, form.selectionStart); + end = form.value.substr(form.selectionEnd); + sel = form.value.substr(form.selectionStart, form.selectionEnd-form.selectionStart); + var text = form.firstChild; + form.value = begin+bbbegin+sel+bbend+end; + selPos = bbbegin.length+begin.length+sel.length+bbend.length; + form.setSelectionRange(begin.length, selPos); - return false; + return false; } jQuery.event.props.push('dataTransfer'); @@ -334,61 +334,61 @@ $('#uploaded-files').hide(); $('#drop-files').on('drop', function(e) { - var files = e.dataTransfer.files; + var files = e.dataTransfer.files; - if(files.length <= maxFiles) - { - for(i = 0; i < files.length; i++) - { - if(files[i].size < (1024*1024*1)) - loadInView(files[i]); - else - bootbox.dialog('

    Внимание!

    Слишком большой файл. Максимально 1024Kb.', - [{ - "label" : "Хорошо" - }] - ); - } - }else{ - bootbox.dialog('

    Внимание!

    Нельзя загружать больше '+maxFiles+' изображений.', - [{ - "label" : "Хорошо" - }] - ); - files.length = 0; - } + if(files.length <= maxFiles) + { + for(i = 0; i < files.length; i++) + { + if(files[i].size < (1024*1024*1)) + loadInView(files[i]); + else + bootbox.dialog('

    Внимание!

    Слишком большой файл. Максимально 1024Kb.', + [{ + "label" : "Хорошо" + }] + ); + } + }else{ + bootbox.dialog('

    Внимание!

    Нельзя загружать больше '+maxFiles+' изображений.', + [{ + "label" : "Хорошо" + }] + ); + files.length = 0; + } - return false; + return false; }); $('#img').on('change', function() { - var files = $(this)[0].files; + var files = $(this)[0].files; - if(files.length <= maxFiles) - { - for(i = 0; i < files.length; i++) - { - if(files[i].size < (1024*1024*1)) - loadInView(files[i]); - else - bootbox.dialog('

    Внимание!

    Слишком большой файл. Максимально 1024Kb.', - [{ - "label" : "Хорошо" - }] - ); - } - }else{ - // swal('Внимание!', 'Нельзя загружать больше '+maxFiles+' изображений.', 'warning'); - bootbox.dialog('

    Внимание!

    Нельзя загружать больше '+maxFiles+' изображений.', - [{ - "label" : "Хорошо" - }] - ); - files.length = 0; - } + if(files.length <= maxFiles) + { + for(i = 0; i < files.length; i++) + { + if(files[i].size < (1024*1024*1)) + loadInView(files[i]); + else + bootbox.dialog('

    Внимание!

    Слишком большой файл. Максимально 1024Kb.', + [{ + "label" : "Хорошо" + }] + ); + } + }else{ + // swal('Внимание!', 'Нельзя загружать больше '+maxFiles+' изображений.', 'warning'); + bootbox.dialog('

    Внимание!

    Нельзя загружать больше '+maxFiles+' изображений.', + [{ + "label" : "Хорошо" + }] + ); + files.length = 0; + } - clearFileUpload('img'); + clearFileUpload('img'); }); var upload = 0; @@ -396,157 +396,157 @@ var files = 0; function loadInView(file) { - if(files < 0) - files = 0; + if(files < 0) + files = 0; - $('#uploaded-holder').css('display', 'inline-block'); + $('#uploaded-holder').css('display', 'inline-block'); - if(!file.type.match('image.*')) - { - $('#drop-files p').html('Файл не является изображением.'); + if(!file.type.match('image.*')) + { + $('#drop-files p').html('Файл не является изображением.'); - return false; - } + return false; + } - files = files+1; + files = files+1; - if(files <= maxFiles) - $('#upload-button').css({'display' : 'block'}); - else{ - bootbox.dialog('

    Внимание!

    Нельзя загружать больше '+maxFiles+' изображений.', - [{ - "label" : "Хорошо" - }] - ); - - files = files-1; + if(files <= maxFiles) + $('#upload-button').css({'display' : 'block'}); + else{ + bootbox.dialog('

    Внимание!

    Нельзя загружать больше '+maxFiles+' изображений.', + [{ + "label" : "Хорошо" + }] + ); + + files = files-1; - return false; - } + return false; + } - var fileReader = new FileReader(); + var fileReader = new FileReader(); - fileReader.onload = (function(file){ - return function(e){ - dataArray.push({name : file.name, value : this.result, check : null, sel : null}); - addImage((dataArray.length-1)); - }; - })(file); + fileReader.onload = (function(file){ + return function(e){ + dataArray.push({name : file.name, value : this.result, check : null, sel : null}); + addImage((dataArray.length-1)); + }; + })(file); - fileReader.readAsDataURL(file); + fileReader.readAsDataURL(file); - return false; + return false; } function delImage(id) { - $(this).empty(); - dataArray.splice(id, 1); - $('#dropped-files > .img-block').remove(); - addImage(-1); + $(this).empty(); + dataArray.splice(id, 1); + $('#dropped-files > .img-block').remove(); + addImage(-1); - return false; + return false; } function addImage(ind) { - if(ind < 0 ) - { - start = 0; - end = dataArray.length; - files = files-1; - }else{ - start = ind; - end = ind+1; - } + if(ind < 0 ) + { + start = 0; + end = dataArray.length; + files = files-1; + }else{ + start = ind; + end = ind+1; + } - if(dataArray.length == 0) - { - $('#upload-button').hide(); - $('#uploaded-holder').hide(); - } + if(dataArray.length == 0) + { + $('#upload-button').hide(); + $('#uploaded-holder').hide(); + } - for(i = start; i < end; i++) - if($('#dropped-files > .img-block').length <= maxFiles) - $('#dropped-files').append(''); + for(i = start; i < end; i++) + if($('#dropped-files > .img-block').length <= maxFiles) + $('#dropped-files').append(''); - return false; + return false; } function restartFiles(go) { - $('#loading-bar .loading-color').css({'width' : '0%'}); - $('#loading').css({'display' : 'none'}); - $('#loading-content').html(' '); - $('#upload-button').hide(); - $('#dropped-files > .img-block').remove(); - $('#uploaded-holder').hide(); - dataArray.length = 0; - if(go != 1) - files = upload; + $('#loading-bar .loading-color').css({'width' : '0%'}); + $('#loading').css({'display' : 'none'}); + $('#loading-content').html(' '); + $('#upload-button').hide(); + $('#dropped-files > .img-block').remove(); + $('#uploaded-holder').hide(); + dataArray.length = 0; + if(go != 1) + files = upload; - return false; + return false; } $('#dropped-files #upload-button .delete').click(restartFiles); $('#upload-button .upload').click(function() { - $("#loading").show(); + $("#loading").show(); - var totalPercent = 100 / dataArray.length; - var x = 0; + var totalPercent = 100 / dataArray.length; + var x = 0; - $('#loading-content').html('Загружен '+dataArray[0].name); + $('#loading-content').html('Загружен '+dataArray[0].name); - $.each(dataArray, function(index, file) - { - upload = upload + 1; + $.each(dataArray, function(index, file) + { + upload = upload + 1; - $.post(home+'chat/section/upload', dataArray[index], function(data) - { - var fileName = dataArray[index].name; - ++x; + $.post(home+'chat/section/upload', dataArray[index], function(data) + { + var fileName = dataArray[index].name; + ++x; - $('#loading-bar .loading-color').css({'width' : totalPercent*(x)+'%'}); + $('#loading-bar .loading-color').css({'width' : totalPercent*(x)+'%'}); - if(totalPercent*(x) == 100) - { - $('#loading-content').html('Загрузка завершена.'); - setTimeout(restartFiles(1), 1000); - }else if(totalPercent*(x) < 100) - $('#loading-content').html('Загружается '+fileName); + if(totalPercent*(x) == 100) + { + $('#loading-content').html('Загрузка завершена.'); + setTimeout(restartFiles(1), 1000); + }else if(totalPercent*(x) < 100) + $('#loading-content').html('Загружается '+fileName); - var dataSplit = data.split(':'); + var dataSplit = data.split(':'); - if(dataSplit[1] == 'ok') - { - $('#uploaded-files').append(''); - $('#img-input').append('
    '); - }else - $('#uploaded-files').append(data); - }); + if(dataSplit[1] == 'ok') + { + $('#uploaded-files').append(''); + $('#img-input').append('
    '); + }else + $('#uploaded-files').append(data); + }); - if(upload == maxFiles) - $('#upload_block').hide(); - }); + if(upload == maxFiles) + $('#upload_block').hide(); + }); - $('#uploaded-files').show(); + $('#uploaded-files').show(); - return false; + return false; }); $('#drop-files').on('dragenter', function() { - $(this).css({'border-color' : '#74b084'}); + $(this).css({'border-color' : '#74b084'}); - return false; + return false; }); $('#drop-files').on('drop', function() { - $(this).css({'border-color' : '#dcdcdc'}); - files = files-1; + $(this).css({'border-color' : '#dcdcdc'}); + files = files-1; - return false; + return false; }); \ No newline at end of file diff --git a/template/js/functions.js b/template/js/functions.js index cf11ebe..e0e1150 100644 --- a/template/js/functions.js +++ b/template/js/functions.js @@ -1,123 +1,123 @@ function loading(show) { - if(show) - $('#loadinginfo').css('display', 'block'); - else - $('#loadinginfo').css('display', 'none'); + if(show) + $('#loadinginfo').css('display', 'block'); + else + $('#loadinginfo').css('display', 'none'); } function help_notice_check() { - $.getJSON(home+'help/section/notice/go', - function(data) - { - $.each(data, function(i, val) - { - if(i == 'empty') - { - hnt = false; help_notice_title(true); - $('#help_notice').css('display', 'none'); - } + $.getJSON(home+'help/section/notice/go', + function(data) + { + $.each(data, function(i, val) + { + if(i == 'empty') + { + hnt = false; help_notice_title(true); + $('#help_notice').css('display', 'none'); + } - if(i == 'reply') - { - if(val) - { - if(val > getCookie('help') || getCookie('help') == undefined) - { - setCookie('help', val, {expires: 86400}); - help_notice_sound(); - } - } + if(i == 'reply') + { + if(val) + { + if(val > getCookie('help') || getCookie('help') == undefined) + { + setCookie('help', val, {expires: 86400}); + help_notice_sound(); + } + } - $('#help_notice').css('display', 'inline-block'); - } + $('#help_notice').css('display', 'inline-block'); + } - if(i == 'notice') - { - help_notice_sound(); - $('#help_notice').css('display', 'block'); - $('#help_notice_block').css('display', 'block'); - $('#help_notice_block').html(val); - } - }); - }); + if(i == 'notice') + { + help_notice_sound(); + $('#help_notice').css('display', 'block'); + $('#help_notice_block').css('display', 'block'); + $('#help_notice_block').html(val); + } + }); + }); - setTimeout(function() {help_notice_check()}, 10000); + setTimeout(function() {help_notice_check()}, 10000); } function help_notice_sound() { - hnt = true; help_notice_title(); + hnt = true; help_notice_title(); - var audio = new Audio(); - audio.preload = 'auto'; - audio.src = '/notice.wav'; - audio.play(); + var audio = new Audio(); + audio.preload = 'auto'; + audio.src = '/notice.wav'; + audio.play(); } function help_notice_title(stop) { - if(document.title == title && !stop) - document.title = 'Новое сообщение'; - else - document.title = title; + if(document.title == title && !stop) + document.title = 'Новое сообщение'; + else + document.title = title; - if(hnt) - setTimeout(function() {help_notice_title()}, 1000); + if(hnt) + setTimeout(function() {help_notice_title()}, 1000); } function setCookie(name, value, options) { - options = options || {}; + options = options || {}; - var expires = options.expires; + var expires = options.expires; - if(typeof expires == 'number' && expires) - { - var d = new Date(); - d.setTime(d.getTime() + expires * 1000); - expires = options.expires = d; - } + if(typeof expires == 'number' && expires) + { + var d = new Date(); + d.setTime(d.getTime() + expires * 1000); + expires = options.expires = d; + } - if(expires && expires.toUTCString) - options.expires = expires.toUTCString(); + if(expires && expires.toUTCString) + options.expires = expires.toUTCString(); - value = encodeURIComponent(value); + value = encodeURIComponent(value); - var updatedCookie = name + '=' + value + '; path=/'; + var updatedCookie = name + '=' + value + '; path=/'; - for (var propName in options) - { - updatedCookie += '; ' + propName; - var propValue = options[propName]; + for (var propName in options) + { + updatedCookie += '; ' + propName; + var propValue = options[propName]; - if(propValue !== true) - updatedCookie += '=' + propValue; - } + if(propValue !== true) + updatedCookie += '=' + propValue; + } document.cookie = updatedCookie; } function getCookie(name) { - var matches = document.cookie.match(new RegExp( - "(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)" - )); + var matches = document.cookie.match(new RegExp( + "(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)" + )); - return matches ? decodeURIComponent(matches[1]) : undefined; + return matches ? decodeURIComponent(matches[1]) : undefined; } function deleteCookie(name) { - setCookie(name, '', {expires: -1}) + setCookie(name, '', {expires: -1}) } $(document).ready(function(){ - $('.spoiler').click(function(){ - $(this).parent().children('div.spoiler_main').toggle(0); - }); + $('.spoiler').click(function(){ + $(this).parent().children('div.spoiler_main').toggle(0); + }); - hljs.initHighlightingOnLoad(); + hljs.initHighlightingOnLoad(); }); \ No newline at end of file diff --git a/template/js/help.js b/template/js/help.js index 9e112b4..f4ca733 100644 --- a/template/js/help.js +++ b/template/js/help.js @@ -1,301 +1,301 @@ $('#create').ajaxForm({ - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); - if(i == 's') - location.href=home+'help/section/dialog/id/'+val; - }); + if(i == 's') + location.href=home+'help/section/dialog/id/'+val; + }); - loading(0); + loading(0); - return false; - } + return false; + } }); $('#reply').ajaxForm({ - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); - if(i == 'с') - { - bootbox.dialog('

    Внимание

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); + if(i == 'с') + { + bootbox.dialog('

    Внимание

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); - location.reload(); - } + location.reload(); + } - if(i == 'i') - { - bootbox.dialog('

    Внимание

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); + if(i == 'i') + { + bootbox.dialog('

    Внимание

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); - dialog_update(false); - } + dialog_update(false); + } - if(i == 's') - { - $('#text').val(''); - $('#text').html(''); - document.getElementById("text").removeAttribute("style"); - $('#img-input').html(''); - $('#uploaded-files').html(''); - $('#uploaded-files').css('display', 'none'); - $('#frm').html($('#frm').html()); + if(i == 's') + { + $('#text').val(''); + $('#text').html(''); + document.getElementById("text").removeAttribute("style"); + $('#img-input').html(''); + $('#uploaded-files').html(''); + $('#uploaded-files').css('display', 'none'); + $('#frm').html($('#frm').html()); - dialog_update(false); - } - }); + dialog_update(false); + } + }); - loading(0); + loading(0); - return false; - } + return false; + } }); function help_open(id) { - loading(1); + loading(1); - $.getJSON(home+'help/section/close/action/open/id/'+id, - function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); + $.getJSON(home+'help/section/close/action/open/id/'+id, + function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); - if(i == 's') - location.href=home+'help/section/dialog/id/'+id; + if(i == 's') + location.href=home+'help/section/dialog/id/'+id; - loading(0) - }); - }); + loading(0) + }); + }); } function help_msg_del(id, msg) { - loading(1); + loading(1); - $.getJSON(home+'help/section/dialog/action/remove/id/'+id+'/msg/'+msg, - function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); + $.getJSON(home+'help/section/dialog/action/remove/id/'+id+'/msg/'+msg, + function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); - if(i == 's') - dialog_update(false); + if(i == 's') + dialog_update(false); - loading(0) - }); - }); + loading(0) + }); + }); - return false; + return false; } function help_close(id) { - loading(1); + loading(1); - $.getJSON(home+'help/section/open/action/close/id/'+id, - function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); + $.getJSON(home+'help/section/open/action/close/id/'+id, + function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); - if(i == 's') - location.reload(); + if(i == 's') + location.reload(); - loading(0) - }); - }); + loading(0) + }); + }); } function help_readers() { - $.get(home+'help/section/dialog/action/read/id/'+help, - function(readers) - { - $('#help_readers').html(readers); + $.get(home+'help/section/dialog/action/read/id/'+help, + function(readers) + { + $('#help_readers').html(readers); - setTimeout(function() {help_readers()}, 9000); - }); + setTimeout(function() {help_readers()}, 9000); + }); } function help_writers(now) { - write = ''; + write = ''; - if($('#text').val() != '') - write = '/write/1'; + if($('#text').val() != '') + write = '/write/1'; - $.get(home+'help/section/dialog/action/write/id/'+help+write, - function(writers) - { - $('#help_writers').html(writers); + $.get(home+'help/section/dialog/action/write/id/'+help+write, + function(writers) + { + $('#help_writers').html(writers); - if(!now) - setTimeout(function() {help_writers(false)}, 9000); - }); + if(!now) + setTimeout(function() {help_writers(false)}, 9000); + }); } function dialog_update(go) { - if(go) - { - spoilers = $('.spoiler_main'); - update = true; - for(var i = 0; i < spoilers.length; i++) - { - if(spoilers[i].style.display == 'block') - { - setTimeout(function() {dialog_update(true)}, 15000); + if(go) + { + spoilers = $('.spoiler_main'); + update = true; + for(var i = 0; i < spoilers.length; i++) + { + if(spoilers[i].style.display == 'block') + { + setTimeout(function() {dialog_update(true)}, 15000); - return false; - } - } - } + return false; + } + } + } - loading(1); + loading(1); - $.getJSON(home+'help/section/dialog/id/'+help+'/ajax', - function(data) - { - $.each(data, function(i, val) - { - if(i == 'dialog') - { - $('#dialog').html(val); + $.getJSON(home+'help/section/dialog/id/'+help+'/ajax', + function(data) + { + $.each(data, function(i, val) + { + if(i == 'dialog') + { + $('#dialog').html(val); - $('.spoiler').click(function(){ - $(this).parent().children('div.spoiler_main').toggle(0); - }); + $('.spoiler').click(function(){ + $(this).parent().children('div.spoiler_main').toggle(0); + }); - $('pre code').each(function(i, block){ - hljs.highlightBlock(block); - }); - } + $('pre code').each(function(i, block){ + hljs.highlightBlock(block); + }); + } - if(i == 'status') - $('#status').html(val); - }); + if(i == 'status') + $('#status').html(val); + }); - loading(0); + loading(0); - if(go) - setTimeout(function() {dialog_update(true)}, 15000); - }); + if(go) + setTimeout(function() {dialog_update(true)}, 15000); + }); } // Переустановка сервера (подтверждение) function help_delete(id) { - bootbox.dialog('

    Внимание

    Вы уверены, что хотите удалить этот вопрос?', - [{ - "label" : "Подтвердить", - "class" : "btn-small btn-primary", - callback: function() {help_delete_go(id)} - },{ - "label" : "Отмена", - "class" : "btn-small btn-primary", - }] - ); + bootbox.dialog('

    Внимание

    Вы уверены, что хотите удалить этот вопрос?', + [{ + "label" : "Подтвердить", + "class" : "btn-small btn-primary", + callback: function() {help_delete_go(id)} + },{ + "label" : "Отмена", + "class" : "btn-small btn-primary", + }] + ); } function help_delete_go(id) { - loading(1); + loading(1); - $.getJSON(home+'help/section/open/action/delete/id/'+id, - function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); + $.getJSON(home+'help/section/open/action/delete/id/'+id, + function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); - if(i == 's') - location.reload(); + if(i == 's') + location.reload(); - loading(0) - }); - }); + loading(0) + }); + }); } function clearFileUpload(id) { - fileField = document.getElementById(id); - parentNod = fileField.parentNode; - tmpForm = document.createElement("form"); - parentNod.replaceChild(tmpForm,fileField); - tmpForm.appendChild(fileField); - tmpForm.reset(); - parentNod.replaceChild(fileField,tmpForm); + fileField = document.getElementById(id); + parentNod = fileField.parentNode; + tmpForm = document.createElement("form"); + parentNod.replaceChild(tmpForm,fileField); + tmpForm.appendChild(fileField); + tmpForm.reset(); + parentNod.replaceChild(fileField,tmpForm); } function bbcode(bbbegin, bbend) { - form = document.getElementById('text'); - begin = form.value.substr(0, form.selectionStart); - end = form.value.substr(form.selectionEnd); - sel = form.value.substr(form.selectionStart, form.selectionEnd-form.selectionStart); - var text = form.firstChild; - form.value = begin+bbbegin+sel+bbend+end; - selPos = bbbegin.length+begin.length+sel.length+bbend.length; - form.setSelectionRange(begin.length, selPos); + form = document.getElementById('text'); + begin = form.value.substr(0, form.selectionStart); + end = form.value.substr(form.selectionEnd); + sel = form.value.substr(form.selectionStart, form.selectionEnd-form.selectionStart); + var text = form.firstChild; + form.value = begin+bbbegin+sel+bbend+end; + selPos = bbbegin.length+begin.length+sel.length+bbend.length; + form.setSelectionRange(begin.length, selPos); - return false; + return false; } jQuery.event.props.push('dataTransfer'); @@ -307,44 +307,44 @@ $('#uploaded-files').hide(); $('#drop-files').on('drop', function(e) { - var files = e.dataTransfer.files; + var files = e.dataTransfer.files; - if(files.length <= maxFiles) - { - for(i = 0; i < files.length; i++) - { - if(files[i].size < (1024*1024*1)) - loadInView(files[i]); - else - alert('Слишком большой файл. Максимально 1024Kb.'); - } - }else{ - alert('Нельзя загружать больше '+maxFiles+' изображений.'); - files.length = 0; - } + if(files.length <= maxFiles) + { + for(i = 0; i < files.length; i++) + { + if(files[i].size < (1024*1024*1)) + loadInView(files[i]); + else + alert('Слишком большой файл. Максимально 1024Kb.'); + } + }else{ + alert('Нельзя загружать больше '+maxFiles+' изображений.'); + files.length = 0; + } - return false; + return false; }); $('#img').on('change', function() { - var files = $(this)[0].files; + var files = $(this)[0].files; - if(files.length <= maxFiles) - { - for(i = 0; i < files.length; i++) - { - if(files[i].size < (1024*1024*1)) - loadInView(files[i]); - else - alert('Слишком большой файл. Максимально 1024Kb.'); - } - }else{ - alert('Нельзя загружать больше '+maxFiles+' изображений.'); - files.length = 0; - } + if(files.length <= maxFiles) + { + for(i = 0; i < files.length; i++) + { + if(files[i].size < (1024*1024*1)) + loadInView(files[i]); + else + alert('Слишком большой файл. Максимально 1024Kb.'); + } + }else{ + alert('Нельзя загружать больше '+maxFiles+' изображений.'); + files.length = 0; + } - clearFileUpload('img'); + clearFileUpload('img'); }); var upload = 0; @@ -352,153 +352,153 @@ var files = 0; function loadInView(file) { - if(files < 0) - files = 0; + if(files < 0) + files = 0; - $('#uploaded-holder').css('display', 'inline-block'); + $('#uploaded-holder').css('display', 'inline-block'); - if(!file.type.match('image.*')) - { - $('#drop-files p').html('Файл не является изображением.'); + if(!file.type.match('image.*')) + { + $('#drop-files p').html('Файл не является изображением.'); - return false; - } + return false; + } - files = files+1; + files = files+1; - if(files <= maxFiles) - $('#upload-button').css({'display' : 'block'}); - else{ - alert('Нельзя загружать больше '+maxFiles+' изображений.'); - - files = files-1; + if(files <= maxFiles) + $('#upload-button').css({'display' : 'block'}); + else{ + alert('Нельзя загружать больше '+maxFiles+' изображений.'); + + files = files-1; - return false; - } + return false; + } - var fileReader = new FileReader(); + var fileReader = new FileReader(); - fileReader.onload = (function(file){ - return function(e){ - dataArray.push({name : file.name, value : this.result, check : null, sel : null}); - addImage((dataArray.length-1)); - }; - })(file); + fileReader.onload = (function(file){ + return function(e){ + dataArray.push({name : file.name, value : this.result, check : null, sel : null}); + addImage((dataArray.length-1)); + }; + })(file); - fileReader.readAsDataURL(file); + fileReader.readAsDataURL(file); - return false; + return false; } function delImage(id) { - $(this).empty(); - dataArray.splice(id, 1); - $('#dropped-files > .img-block').remove(); - addImage(-1); + $(this).empty(); + dataArray.splice(id, 1); + $('#dropped-files > .img-block').remove(); + addImage(-1); - return false; + return false; } function addImage(ind) { - if(ind < 0 ) - { - start = 0; - end = dataArray.length; - files = files-1; - }else{ - start = ind; - end = ind+1; - } + if(ind < 0 ) + { + start = 0; + end = dataArray.length; + files = files-1; + }else{ + start = ind; + end = ind+1; + } - if(dataArray.length == 0) - { - $('#upload-button').hide(); - $('#uploaded-holder').hide(); - } + if(dataArray.length == 0) + { + $('#upload-button').hide(); + $('#uploaded-holder').hide(); + } - for(i = start; i < end; i++) - if($('#dropped-files > .img-block').length <= maxFiles) - $('#dropped-files').append(''); + for(i = start; i < end; i++) + if($('#dropped-files > .img-block').length <= maxFiles) + $('#dropped-files').append(''); - return false; + return false; } function restartFiles(go) { - $('#loading-bar .loading-color').css({'width' : '0%'}); - $('#loading').css({'display' : 'none'}); - $('#loading-content').html(' '); - $('#upload-button').hide(); - $('#dropped-files > .img-block').remove(); - $('#uploaded-holder').hide(); - dataArray.length = 0; - if(go != 1) - files = upload; + $('#loading-bar .loading-color').css({'width' : '0%'}); + $('#loading').css({'display' : 'none'}); + $('#loading-content').html(' '); + $('#upload-button').hide(); + $('#dropped-files > .img-block').remove(); + $('#uploaded-holder').hide(); + dataArray.length = 0; + if(go != 1) + files = upload; - return false; + return false; } $('#dropped-files #upload-button .delete').click(restartFiles); $('#upload-button .upload').click(function() { - $("#loading").show(); + $("#loading").show(); - var totalPercent = 100 / dataArray.length; - var x = 0; + var totalPercent = 100 / dataArray.length; + var x = 0; - $('#loading-content').html('Загружен '+dataArray[0].name); + $('#loading-content').html('Загружен '+dataArray[0].name); - $.each(dataArray, function(index, file) - { - upload = upload + 1; + $.each(dataArray, function(index, file) + { + upload = upload + 1; - $.post(home+'help/section/upload', dataArray[index], function(data) - { - var fileName = dataArray[index].name; - ++x; + $.post(home+'help/section/upload', dataArray[index], function(data) + { + var fileName = dataArray[index].name; + ++x; - $('#loading-bar .loading-color').css({'width' : totalPercent*(x)+'%'}); + $('#loading-bar .loading-color').css({'width' : totalPercent*(x)+'%'}); - if(totalPercent*(x) == 100) - { - $('#loading-content').html('Загрузка завершена.'); - setTimeout(restartFiles(1), 1000); - }else if(totalPercent*(x) < 100) - $('#loading-content').html('Загружается '+fileName); + if(totalPercent*(x) == 100) + { + $('#loading-content').html('Загрузка завершена.'); + setTimeout(restartFiles(1), 1000); + }else if(totalPercent*(x) < 100) + $('#loading-content').html('Загружается '+fileName); - var dataSplit = data.split(':'); + var dataSplit = data.split(':'); - if(dataSplit[1] == 'ok') - { - $('#uploaded-files').append(''); - $('#img-input').append('
    '); - }else - $('#uploaded-files').append(data); - }); + if(dataSplit[1] == 'ok') + { + $('#uploaded-files').append(''); + $('#img-input').append('
    '); + }else + $('#uploaded-files').append(data); + }); - if(upload == maxFiles) - $('#upload_block').hide(); - }); + if(upload == maxFiles) + $('#upload_block').hide(); + }); - $('#uploaded-files').show(); + $('#uploaded-files').show(); - return false; + return false; }); $('#drop-files').on('dragenter', function() { - $(this).css({'border-color' : '#74b084'}); + $(this).css({'border-color' : '#74b084'}); - return false; + return false; }); $('#drop-files').on('drop', function() { - $(this).css({'border-color' : '#dcdcdc'}); - files = files-1; + $(this).css({'border-color' : '#dcdcdc'}); + files = files-1; - return false; + return false; }); diff --git a/template/js/jquery.js b/template/js/jquery.js index e6e07fc..c785d7e 100644 --- a/template/js/jquery.js +++ b/template/js/jquery.js @@ -13,893 +13,893 @@ */ (function( window, undefined ) { var - // A central reference to the root jQuery(document) - rootjQuery, + // A central reference to the root jQuery(document) + rootjQuery, - // The deferred used on DOM ready - readyList, + // The deferred used on DOM ready + readyList, - // Use the correct document accordingly with window argument (sandbox) - document = window.document, - location = window.location, - navigator = window.navigator, + // Use the correct document accordingly with window argument (sandbox) + document = window.document, + location = window.location, + navigator = window.navigator, - // Map over jQuery in case of overwrite - _jQuery = window.jQuery, + // Map over jQuery in case of overwrite + _jQuery = window.jQuery, - // Map over the $ in case of overwrite - _$ = window.$, + // Map over the $ in case of overwrite + _$ = window.$, - // Save a reference to some core methods - core_push = Array.prototype.push, - core_slice = Array.prototype.slice, - core_indexOf = Array.prototype.indexOf, - core_toString = Object.prototype.toString, - core_hasOwn = Object.prototype.hasOwnProperty, - core_trim = String.prototype.trim, + // Save a reference to some core methods + core_push = Array.prototype.push, + core_slice = Array.prototype.slice, + core_indexOf = Array.prototype.indexOf, + core_toString = Object.prototype.toString, + core_hasOwn = Object.prototype.hasOwnProperty, + core_trim = String.prototype.trim, - // Define a local copy of jQuery - jQuery = function( selector, context ) { - // The jQuery object is actually just the init constructor 'enhanced' - return new jQuery.fn.init( selector, context, rootjQuery ); - }, + // Define a local copy of jQuery + jQuery = function( selector, context ) { + // The jQuery object is actually just the init constructor 'enhanced' + return new jQuery.fn.init( selector, context, rootjQuery ); + }, - // Used for matching numbers - core_pnum = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source, + // Used for matching numbers + core_pnum = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source, - // Used for detecting and trimming whitespace - core_rnotwhite = /\S/, - core_rspace = /\s+/, + // Used for detecting and trimming whitespace + core_rnotwhite = /\S/, + core_rspace = /\s+/, - // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE) - rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, + // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE) + rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, - // A simple way to check for HTML strings - // Prioritize #id over to avoid XSS via location.hash (#9521) - rquickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/, + // A simple way to check for HTML strings + // Prioritize #id over to avoid XSS via location.hash (#9521) + rquickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/, - // Match a standalone tag - rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/, + // Match a standalone tag + rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/, - // JSON RegExp - rvalidchars = /^[\],:{}\s]*$/, - rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, - rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g, - rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g, + // JSON RegExp + rvalidchars = /^[\],:{}\s]*$/, + rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, + rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g, + rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g, - // Matches dashed string for camelizing - rmsPrefix = /^-ms-/, - rdashAlpha = /-([\da-z])/gi, + // Matches dashed string for camelizing + rmsPrefix = /^-ms-/, + rdashAlpha = /-([\da-z])/gi, - // Used by jQuery.camelCase as callback to replace() - fcamelCase = function( all, letter ) { - return ( letter + "" ).toUpperCase(); - }, + // Used by jQuery.camelCase as callback to replace() + fcamelCase = function( all, letter ) { + return ( letter + "" ).toUpperCase(); + }, - // The ready event handler and self cleanup method - DOMContentLoaded = function() { - if ( document.addEventListener ) { - document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); - jQuery.ready(); - } else if ( document.readyState === "complete" ) { - // we're here because readyState === "complete" in oldIE - // which is good enough for us to call the dom ready! - document.detachEvent( "onreadystatechange", DOMContentLoaded ); - jQuery.ready(); - } - }, + // The ready event handler and self cleanup method + DOMContentLoaded = function() { + if ( document.addEventListener ) { + document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); + jQuery.ready(); + } else if ( document.readyState === "complete" ) { + // we're here because readyState === "complete" in oldIE + // which is good enough for us to call the dom ready! + document.detachEvent( "onreadystatechange", DOMContentLoaded ); + jQuery.ready(); + } + }, - // [[Class]] -> type pairs - class2type = {}; + // [[Class]] -> type pairs + class2type = {}; jQuery.fn = jQuery.prototype = { - constructor: jQuery, - init: function( selector, context, rootjQuery ) { - var match, elem, ret, doc; + constructor: jQuery, + init: function( selector, context, rootjQuery ) { + var match, elem, ret, doc; - // Handle $(""), $(null), $(undefined), $(false) - if ( !selector ) { - return this; - } + // Handle $(""), $(null), $(undefined), $(false) + if ( !selector ) { + return this; + } - // Handle $(DOMElement) - if ( selector.nodeType ) { - this.context = this[0] = selector; - this.length = 1; - return this; - } + // Handle $(DOMElement) + if ( selector.nodeType ) { + this.context = this[0] = selector; + this.length = 1; + return this; + } - // Handle HTML strings - if ( typeof selector === "string" ) { - if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { - // Assume that strings that start and end with <> are HTML and skip the regex check - match = [ null, selector, null ]; + // Handle HTML strings + if ( typeof selector === "string" ) { + if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { + // Assume that strings that start and end with <> are HTML and skip the regex check + match = [ null, selector, null ]; - } else { - match = rquickExpr.exec( selector ); - } + } else { + match = rquickExpr.exec( selector ); + } - // Match html or make sure no context is specified for #id - if ( match && (match[1] || !context) ) { + // Match html or make sure no context is specified for #id + if ( match && (match[1] || !context) ) { - // HANDLE: $(html) -> $(array) - if ( match[1] ) { - context = context instanceof jQuery ? context[0] : context; - doc = ( context && context.nodeType ? context.ownerDocument || context : document ); + // HANDLE: $(html) -> $(array) + if ( match[1] ) { + context = context instanceof jQuery ? context[0] : context; + doc = ( context && context.nodeType ? context.ownerDocument || context : document ); - // scripts is true for back-compat - selector = jQuery.parseHTML( match[1], doc, true ); - if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) { - this.attr.call( selector, context, true ); - } + // scripts is true for back-compat + selector = jQuery.parseHTML( match[1], doc, true ); + if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) { + this.attr.call( selector, context, true ); + } - return jQuery.merge( this, selector ); + return jQuery.merge( this, selector ); - // HANDLE: $(#id) - } else { - elem = document.getElementById( match[2] ); + // HANDLE: $(#id) + } else { + elem = document.getElementById( match[2] ); - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE and Opera return items - // by name instead of ID - if ( elem.id !== match[2] ) { - return rootjQuery.find( selector ); - } + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + if ( elem && elem.parentNode ) { + // Handle the case where IE and Opera return items + // by name instead of ID + if ( elem.id !== match[2] ) { + return rootjQuery.find( selector ); + } - // Otherwise, we inject the element directly into the jQuery object - this.length = 1; - this[0] = elem; - } + // Otherwise, we inject the element directly into the jQuery object + this.length = 1; + this[0] = elem; + } - this.context = document; - this.selector = selector; - return this; - } + this.context = document; + this.selector = selector; + return this; + } - // HANDLE: $(expr, $(...)) - } else if ( !context || context.jquery ) { - return ( context || rootjQuery ).find( selector ); + // HANDLE: $(expr, $(...)) + } else if ( !context || context.jquery ) { + return ( context || rootjQuery ).find( selector ); - // HANDLE: $(expr, context) - // (which is just equivalent to: $(context).find(expr) - } else { - return this.constructor( context ).find( selector ); - } + // HANDLE: $(expr, context) + // (which is just equivalent to: $(context).find(expr) + } else { + return this.constructor( context ).find( selector ); + } - // HANDLE: $(function) - // Shortcut for document ready - } else if ( jQuery.isFunction( selector ) ) { - return rootjQuery.ready( selector ); - } + // HANDLE: $(function) + // Shortcut for document ready + } else if ( jQuery.isFunction( selector ) ) { + return rootjQuery.ready( selector ); + } - if ( selector.selector !== undefined ) { - this.selector = selector.selector; - this.context = selector.context; - } + if ( selector.selector !== undefined ) { + this.selector = selector.selector; + this.context = selector.context; + } - return jQuery.makeArray( selector, this ); - }, + return jQuery.makeArray( selector, this ); + }, - // Start with an empty selector - selector: "", + // Start with an empty selector + selector: "", - // The current version of jQuery being used - jquery: "1.8.3", + // The current version of jQuery being used + jquery: "1.8.3", - // The default length of a jQuery object is 0 - length: 0, + // The default length of a jQuery object is 0 + length: 0, - // The number of elements contained in the matched element set - size: function() { - return this.length; - }, + // The number of elements contained in the matched element set + size: function() { + return this.length; + }, - toArray: function() { - return core_slice.call( this ); - }, + toArray: function() { + return core_slice.call( this ); + }, - // Get the Nth element in the matched element set OR - // Get the whole matched element set as a clean array - get: function( num ) { - return num == null ? + // Get the Nth element in the matched element set OR + // Get the whole matched element set as a clean array + get: function( num ) { + return num == null ? - // Return a 'clean' array - this.toArray() : + // Return a 'clean' array + this.toArray() : - // Return just the object - ( num < 0 ? this[ this.length + num ] : this[ num ] ); - }, + // Return just the object + ( num < 0 ? this[ this.length + num ] : this[ num ] ); + }, - // Take an array of elements and push it onto the stack - // (returning the new matched element set) - pushStack: function( elems, name, selector ) { + // Take an array of elements and push it onto the stack + // (returning the new matched element set) + pushStack: function( elems, name, selector ) { - // Build a new jQuery matched element set - var ret = jQuery.merge( this.constructor(), elems ); + // Build a new jQuery matched element set + var ret = jQuery.merge( this.constructor(), elems ); - // Add the old object onto the stack (as a reference) - ret.prevObject = this; + // Add the old object onto the stack (as a reference) + ret.prevObject = this; - ret.context = this.context; + ret.context = this.context; - if ( name === "find" ) { - ret.selector = this.selector + ( this.selector ? " " : "" ) + selector; - } else if ( name ) { - ret.selector = this.selector + "." + name + "(" + selector + ")"; - } + if ( name === "find" ) { + ret.selector = this.selector + ( this.selector ? " " : "" ) + selector; + } else if ( name ) { + ret.selector = this.selector + "." + name + "(" + selector + ")"; + } - // Return the newly-formed element set - return ret; - }, + // Return the newly-formed element set + return ret; + }, - // Execute a callback for every element in the matched set. - // (You can seed the arguments with an array of args, but this is - // only used internally.) - each: function( callback, args ) { - return jQuery.each( this, callback, args ); - }, + // Execute a callback for every element in the matched set. + // (You can seed the arguments with an array of args, but this is + // only used internally.) + each: function( callback, args ) { + return jQuery.each( this, callback, args ); + }, - ready: function( fn ) { - // Add the callback - jQuery.ready.promise().done( fn ); + ready: function( fn ) { + // Add the callback + jQuery.ready.promise().done( fn ); - return this; - }, + return this; + }, - eq: function( i ) { - i = +i; - return i === -1 ? - this.slice( i ) : - this.slice( i, i + 1 ); - }, + eq: function( i ) { + i = +i; + return i === -1 ? + this.slice( i ) : + this.slice( i, i + 1 ); + }, - first: function() { - return this.eq( 0 ); - }, + first: function() { + return this.eq( 0 ); + }, - last: function() { - return this.eq( -1 ); - }, + last: function() { + return this.eq( -1 ); + }, - slice: function() { - return this.pushStack( core_slice.apply( this, arguments ), - "slice", core_slice.call(arguments).join(",") ); - }, + slice: function() { + return this.pushStack( core_slice.apply( this, arguments ), + "slice", core_slice.call(arguments).join(",") ); + }, - map: function( callback ) { - return this.pushStack( jQuery.map(this, function( elem, i ) { - return callback.call( elem, i, elem ); - })); - }, + map: function( callback ) { + return this.pushStack( jQuery.map(this, function( elem, i ) { + return callback.call( elem, i, elem ); + })); + }, - end: function() { - return this.prevObject || this.constructor(null); - }, + end: function() { + return this.prevObject || this.constructor(null); + }, - // For internal use only. - // Behaves like an Array's method, not like a jQuery method. - push: core_push, - sort: [].sort, - splice: [].splice + // For internal use only. + // Behaves like an Array's method, not like a jQuery method. + push: core_push, + sort: [].sort, + splice: [].splice }; // Give the init function the jQuery prototype for later instantiation jQuery.fn.init.prototype = jQuery.fn; jQuery.extend = jQuery.fn.extend = function() { - var options, name, src, copy, copyIsArray, clone, - target = arguments[0] || {}, - i = 1, - length = arguments.length, - deep = false; + var options, name, src, copy, copyIsArray, clone, + target = arguments[0] || {}, + i = 1, + length = arguments.length, + deep = false; - // Handle a deep copy situation - if ( typeof target === "boolean" ) { - deep = target; - target = arguments[1] || {}; - // skip the boolean and the target - i = 2; - } + // Handle a deep copy situation + if ( typeof target === "boolean" ) { + deep = target; + target = arguments[1] || {}; + // skip the boolean and the target + i = 2; + } - // Handle case when target is a string or something (possible in deep copy) - if ( typeof target !== "object" && !jQuery.isFunction(target) ) { - target = {}; - } + // Handle case when target is a string or something (possible in deep copy) + if ( typeof target !== "object" && !jQuery.isFunction(target) ) { + target = {}; + } - // extend jQuery itself if only one argument is passed - if ( length === i ) { - target = this; - --i; - } + // extend jQuery itself if only one argument is passed + if ( length === i ) { + target = this; + --i; + } - for ( ; i < length; i++ ) { - // Only deal with non-null/undefined values - if ( (options = arguments[ i ]) != null ) { - // Extend the base object - for ( name in options ) { - src = target[ name ]; - copy = options[ name ]; + for ( ; i < length; i++ ) { + // Only deal with non-null/undefined values + if ( (options = arguments[ i ]) != null ) { + // Extend the base object + for ( name in options ) { + src = target[ name ]; + copy = options[ name ]; - // Prevent never-ending loop - if ( target === copy ) { - continue; - } + // Prevent never-ending loop + if ( target === copy ) { + continue; + } - // Recurse if we're merging plain objects or arrays - if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { - if ( copyIsArray ) { - copyIsArray = false; - clone = src && jQuery.isArray(src) ? src : []; + // Recurse if we're merging plain objects or arrays + if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { + if ( copyIsArray ) { + copyIsArray = false; + clone = src && jQuery.isArray(src) ? src : []; - } else { - clone = src && jQuery.isPlainObject(src) ? src : {}; - } + } else { + clone = src && jQuery.isPlainObject(src) ? src : {}; + } - // Never move original objects, clone them - target[ name ] = jQuery.extend( deep, clone, copy ); + // Never move original objects, clone them + target[ name ] = jQuery.extend( deep, clone, copy ); - // Don't bring in undefined values - } else if ( copy !== undefined ) { - target[ name ] = copy; - } - } - } - } + // Don't bring in undefined values + } else if ( copy !== undefined ) { + target[ name ] = copy; + } + } + } + } - // Return the modified object - return target; + // Return the modified object + return target; }; jQuery.extend({ - noConflict: function( deep ) { - if ( window.$ === jQuery ) { - window.$ = _$; - } - - if ( deep && window.jQuery === jQuery ) { - window.jQuery = _jQuery; - } - - return jQuery; - }, - - // Is the DOM ready to be used? Set to true once it occurs. - isReady: false, - - // A counter to track how many items to wait for before - // the ready event fires. See #6781 - readyWait: 1, - - // Hold (or release) the ready event - holdReady: function( hold ) { - if ( hold ) { - jQuery.readyWait++; - } else { - jQuery.ready( true ); - } - }, - - // Handle when the DOM is ready - ready: function( wait ) { - - // Abort if there are pending holds or we're already ready - if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { - return; - } - - // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). - if ( !document.body ) { - return setTimeout( jQuery.ready, 1 ); - } - - // Remember that the DOM is ready - jQuery.isReady = true; - - // If a normal DOM Ready event fired, decrement, and wait if need be - if ( wait !== true && --jQuery.readyWait > 0 ) { - return; - } - - // If there are functions bound, to execute - readyList.resolveWith( document, [ jQuery ] ); - - // Trigger any bound ready events - if ( jQuery.fn.trigger ) { - jQuery( document ).trigger("ready").off("ready"); - } - }, - - // See test/unit/core.js for details concerning isFunction. - // Since version 1.3, DOM methods and functions like alert - // aren't supported. They return false on IE (#2968). - isFunction: function( obj ) { - return jQuery.type(obj) === "function"; - }, - - isArray: Array.isArray || function( obj ) { - return jQuery.type(obj) === "array"; - }, - - isWindow: function( obj ) { - return obj != null && obj == obj.window; - }, - - isNumeric: function( obj ) { - return !isNaN( parseFloat(obj) ) && isFinite( obj ); - }, - - type: function( obj ) { - return obj == null ? - String( obj ) : - class2type[ core_toString.call(obj) ] || "object"; - }, - - isPlainObject: function( obj ) { - // Must be an Object. - // Because of IE, we also have to check the presence of the constructor property. - // Make sure that DOM nodes and window objects don't pass through, as well - if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { - return false; - } - - try { - // Not own constructor property must be Object - if ( obj.constructor && - !core_hasOwn.call(obj, "constructor") && - !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { - return false; - } - } catch ( e ) { - // IE8,9 Will throw exceptions on certain host objects #9897 - return false; - } - - // Own properties are enumerated firstly, so to speed up, - // if last one is own, then all properties are own. - - var key; - for ( key in obj ) {} - - return key === undefined || core_hasOwn.call( obj, key ); - }, - - isEmptyObject: function( obj ) { - var name; - for ( name in obj ) { - return false; - } - return true; - }, - - error: function( msg ) { - throw new Error( msg ); - }, - - // data: string of html - // context (optional): If specified, the fragment will be created in this context, defaults to document - // scripts (optional): If true, will include scripts passed in the html string - parseHTML: function( data, context, scripts ) { - var parsed; - if ( !data || typeof data !== "string" ) { - return null; - } - if ( typeof context === "boolean" ) { - scripts = context; - context = 0; - } - context = context || document; - - // Single tag - if ( (parsed = rsingleTag.exec( data )) ) { - return [ context.createElement( parsed[1] ) ]; - } - - parsed = jQuery.buildFragment( [ data ], context, scripts ? null : [] ); - return jQuery.merge( [], - (parsed.cacheable ? jQuery.clone( parsed.fragment ) : parsed.fragment).childNodes ); - }, - - parseJSON: function( data ) { - if ( !data || typeof data !== "string") { - return null; - } - - // Make sure leading/trailing whitespace is removed (IE can't handle it) - data = jQuery.trim( data ); - - // Attempt to parse using the native JSON parser first - if ( window.JSON && window.JSON.parse ) { - return window.JSON.parse( data ); - } - - // Make sure the incoming data is actual JSON - // Logic borrowed from http://json.org/json2.js - if ( rvalidchars.test( data.replace( rvalidescape, "@" ) - .replace( rvalidtokens, "]" ) - .replace( rvalidbraces, "")) ) { - - return ( new Function( "return " + data ) )(); - - } - jQuery.error( "Invalid JSON: " + data ); - }, - - // Cross-browser xml parsing - parseXML: function( data ) { - var xml, tmp; - if ( !data || typeof data !== "string" ) { - return null; - } - try { - if ( window.DOMParser ) { // Standard - tmp = new DOMParser(); - xml = tmp.parseFromString( data , "text/xml" ); - } else { // IE - xml = new ActiveXObject( "Microsoft.XMLDOM" ); - xml.async = "false"; - xml.loadXML( data ); - } - } catch( e ) { - xml = undefined; - } - if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { - jQuery.error( "Invalid XML: " + data ); - } - return xml; - }, - - noop: function() {}, - - // Evaluates a script in a global context - // Workarounds based on findings by Jim Driscoll - // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context - globalEval: function( data ) { - if ( data && core_rnotwhite.test( data ) ) { - // We use execScript on Internet Explorer - // We use an anonymous function so that context is window - // rather than jQuery in Firefox - ( window.execScript || function( data ) { - window[ "eval" ].call( window, data ); - } )( data ); - } - }, - - // Convert dashed to camelCase; used by the css and data modules - // Microsoft forgot to hump their vendor prefix (#9572) - camelCase: function( string ) { - return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); - }, - - nodeName: function( elem, name ) { - return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); - }, - - // args is for internal usage only - each: function( obj, callback, args ) { - var name, - i = 0, - length = obj.length, - isObj = length === undefined || jQuery.isFunction( obj ); - - if ( args ) { - if ( isObj ) { - for ( name in obj ) { - if ( callback.apply( obj[ name ], args ) === false ) { - break; - } - } - } else { - for ( ; i < length; ) { - if ( callback.apply( obj[ i++ ], args ) === false ) { - break; - } - } - } - - // A special, fast, case for the most common use of each - } else { - if ( isObj ) { - for ( name in obj ) { - if ( callback.call( obj[ name ], name, obj[ name ] ) === false ) { - break; - } - } - } else { - for ( ; i < length; ) { - if ( callback.call( obj[ i ], i, obj[ i++ ] ) === false ) { - break; - } - } - } - } - - return obj; - }, - - // Use native String.trim function wherever possible - trim: core_trim && !core_trim.call("\uFEFF\xA0") ? - function( text ) { - return text == null ? - "" : - core_trim.call( text ); - } : - - // Otherwise use our own trimming functionality - function( text ) { - return text == null ? - "" : - ( text + "" ).replace( rtrim, "" ); - }, - - // results is for internal usage only - makeArray: function( arr, results ) { - var type, - ret = results || []; - - if ( arr != null ) { - // The window, strings (and functions) also have 'length' - // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930 - type = jQuery.type( arr ); - - if ( arr.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( arr ) ) { - core_push.call( ret, arr ); - } else { - jQuery.merge( ret, arr ); - } - } - - return ret; - }, - - inArray: function( elem, arr, i ) { - var len; - - if ( arr ) { - if ( core_indexOf ) { - return core_indexOf.call( arr, elem, i ); - } - - len = arr.length; - i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; - - for ( ; i < len; i++ ) { - // Skip accessing in sparse arrays - if ( i in arr && arr[ i ] === elem ) { - return i; - } - } - } - - return -1; - }, - - merge: function( first, second ) { - var l = second.length, - i = first.length, - j = 0; - - if ( typeof l === "number" ) { - for ( ; j < l; j++ ) { - first[ i++ ] = second[ j ]; - } - - } else { - while ( second[j] !== undefined ) { - first[ i++ ] = second[ j++ ]; - } - } - - first.length = i; - - return first; - }, - - grep: function( elems, callback, inv ) { - var retVal, - ret = [], - i = 0, - length = elems.length; - inv = !!inv; - - // Go through the array, only saving the items - // that pass the validator function - for ( ; i < length; i++ ) { - retVal = !!callback( elems[ i ], i ); - if ( inv !== retVal ) { - ret.push( elems[ i ] ); - } - } - - return ret; - }, - - // arg is for internal usage only - map: function( elems, callback, arg ) { - var value, key, - ret = [], - i = 0, - length = elems.length, - // jquery objects are treated as arrays - isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ; - - // Go through the array, translating each of the items to their - if ( isArray ) { - for ( ; i < length; i++ ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - - // Go through every key on the object, - } else { - for ( key in elems ) { - value = callback( elems[ key ], key, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - } - - // Flatten any nested arrays - return ret.concat.apply( [], ret ); - }, - - // A global GUID counter for objects - guid: 1, - - // Bind a function to a context, optionally partially applying any - // arguments. - proxy: function( fn, context ) { - var tmp, args, proxy; - - if ( typeof context === "string" ) { - tmp = fn[ context ]; - context = fn; - fn = tmp; - } - - // Quick check to determine if target is callable, in the spec - // this throws a TypeError, but we will just return undefined. - if ( !jQuery.isFunction( fn ) ) { - return undefined; - } - - // Simulated bind - args = core_slice.call( arguments, 2 ); - proxy = function() { - return fn.apply( context, args.concat( core_slice.call( arguments ) ) ); - }; - - // Set the guid of unique handler to the same of original handler, so it can be removed - proxy.guid = fn.guid = fn.guid || jQuery.guid++; - - return proxy; - }, - - // Multifunctional method to get and set values of a collection - // The value/s can optionally be executed if it's a function - access: function( elems, fn, key, value, chainable, emptyGet, pass ) { - var exec, - bulk = key == null, - i = 0, - length = elems.length; - - // Sets many values - if ( key && typeof key === "object" ) { - for ( i in key ) { - jQuery.access( elems, fn, i, key[i], 1, emptyGet, value ); - } - chainable = 1; - - // Sets one value - } else if ( value !== undefined ) { - // Optionally, function values get executed if exec is true - exec = pass === undefined && jQuery.isFunction( value ); - - if ( bulk ) { - // Bulk operations only iterate when executing function values - if ( exec ) { - exec = fn; - fn = function( elem, key, value ) { - return exec.call( jQuery( elem ), value ); - }; - - // Otherwise they run against the entire set - } else { - fn.call( elems, value ); - fn = null; - } - } - - if ( fn ) { - for (; i < length; i++ ) { - fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass ); - } - } - - chainable = 1; - } - - return chainable ? - elems : - - // Gets - bulk ? - fn.call( elems ) : - length ? fn( elems[0], key ) : emptyGet; - }, - - now: function() { - return ( new Date() ).getTime(); - } + noConflict: function( deep ) { + if ( window.$ === jQuery ) { + window.$ = _$; + } + + if ( deep && window.jQuery === jQuery ) { + window.jQuery = _jQuery; + } + + return jQuery; + }, + + // Is the DOM ready to be used? Set to true once it occurs. + isReady: false, + + // A counter to track how many items to wait for before + // the ready event fires. See #6781 + readyWait: 1, + + // Hold (or release) the ready event + holdReady: function( hold ) { + if ( hold ) { + jQuery.readyWait++; + } else { + jQuery.ready( true ); + } + }, + + // Handle when the DOM is ready + ready: function( wait ) { + + // Abort if there are pending holds or we're already ready + if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { + return; + } + + // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). + if ( !document.body ) { + return setTimeout( jQuery.ready, 1 ); + } + + // Remember that the DOM is ready + jQuery.isReady = true; + + // If a normal DOM Ready event fired, decrement, and wait if need be + if ( wait !== true && --jQuery.readyWait > 0 ) { + return; + } + + // If there are functions bound, to execute + readyList.resolveWith( document, [ jQuery ] ); + + // Trigger any bound ready events + if ( jQuery.fn.trigger ) { + jQuery( document ).trigger("ready").off("ready"); + } + }, + + // See test/unit/core.js for details concerning isFunction. + // Since version 1.3, DOM methods and functions like alert + // aren't supported. They return false on IE (#2968). + isFunction: function( obj ) { + return jQuery.type(obj) === "function"; + }, + + isArray: Array.isArray || function( obj ) { + return jQuery.type(obj) === "array"; + }, + + isWindow: function( obj ) { + return obj != null && obj == obj.window; + }, + + isNumeric: function( obj ) { + return !isNaN( parseFloat(obj) ) && isFinite( obj ); + }, + + type: function( obj ) { + return obj == null ? + String( obj ) : + class2type[ core_toString.call(obj) ] || "object"; + }, + + isPlainObject: function( obj ) { + // Must be an Object. + // Because of IE, we also have to check the presence of the constructor property. + // Make sure that DOM nodes and window objects don't pass through, as well + if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { + return false; + } + + try { + // Not own constructor property must be Object + if ( obj.constructor && + !core_hasOwn.call(obj, "constructor") && + !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { + return false; + } + } catch ( e ) { + // IE8,9 Will throw exceptions on certain host objects #9897 + return false; + } + + // Own properties are enumerated firstly, so to speed up, + // if last one is own, then all properties are own. + + var key; + for ( key in obj ) {} + + return key === undefined || core_hasOwn.call( obj, key ); + }, + + isEmptyObject: function( obj ) { + var name; + for ( name in obj ) { + return false; + } + return true; + }, + + error: function( msg ) { + throw new Error( msg ); + }, + + // data: string of html + // context (optional): If specified, the fragment will be created in this context, defaults to document + // scripts (optional): If true, will include scripts passed in the html string + parseHTML: function( data, context, scripts ) { + var parsed; + if ( !data || typeof data !== "string" ) { + return null; + } + if ( typeof context === "boolean" ) { + scripts = context; + context = 0; + } + context = context || document; + + // Single tag + if ( (parsed = rsingleTag.exec( data )) ) { + return [ context.createElement( parsed[1] ) ]; + } + + parsed = jQuery.buildFragment( [ data ], context, scripts ? null : [] ); + return jQuery.merge( [], + (parsed.cacheable ? jQuery.clone( parsed.fragment ) : parsed.fragment).childNodes ); + }, + + parseJSON: function( data ) { + if ( !data || typeof data !== "string") { + return null; + } + + // Make sure leading/trailing whitespace is removed (IE can't handle it) + data = jQuery.trim( data ); + + // Attempt to parse using the native JSON parser first + if ( window.JSON && window.JSON.parse ) { + return window.JSON.parse( data ); + } + + // Make sure the incoming data is actual JSON + // Logic borrowed from http://json.org/json2.js + if ( rvalidchars.test( data.replace( rvalidescape, "@" ) + .replace( rvalidtokens, "]" ) + .replace( rvalidbraces, "")) ) { + + return ( new Function( "return " + data ) )(); + + } + jQuery.error( "Invalid JSON: " + data ); + }, + + // Cross-browser xml parsing + parseXML: function( data ) { + var xml, tmp; + if ( !data || typeof data !== "string" ) { + return null; + } + try { + if ( window.DOMParser ) { // Standard + tmp = new DOMParser(); + xml = tmp.parseFromString( data , "text/xml" ); + } else { // IE + xml = new ActiveXObject( "Microsoft.XMLDOM" ); + xml.async = "false"; + xml.loadXML( data ); + } + } catch( e ) { + xml = undefined; + } + if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { + jQuery.error( "Invalid XML: " + data ); + } + return xml; + }, + + noop: function() {}, + + // Evaluates a script in a global context + // Workarounds based on findings by Jim Driscoll + // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context + globalEval: function( data ) { + if ( data && core_rnotwhite.test( data ) ) { + // We use execScript on Internet Explorer + // We use an anonymous function so that context is window + // rather than jQuery in Firefox + ( window.execScript || function( data ) { + window[ "eval" ].call( window, data ); + } )( data ); + } + }, + + // Convert dashed to camelCase; used by the css and data modules + // Microsoft forgot to hump their vendor prefix (#9572) + camelCase: function( string ) { + return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); + }, + + nodeName: function( elem, name ) { + return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); + }, + + // args is for internal usage only + each: function( obj, callback, args ) { + var name, + i = 0, + length = obj.length, + isObj = length === undefined || jQuery.isFunction( obj ); + + if ( args ) { + if ( isObj ) { + for ( name in obj ) { + if ( callback.apply( obj[ name ], args ) === false ) { + break; + } + } + } else { + for ( ; i < length; ) { + if ( callback.apply( obj[ i++ ], args ) === false ) { + break; + } + } + } + + // A special, fast, case for the most common use of each + } else { + if ( isObj ) { + for ( name in obj ) { + if ( callback.call( obj[ name ], name, obj[ name ] ) === false ) { + break; + } + } + } else { + for ( ; i < length; ) { + if ( callback.call( obj[ i ], i, obj[ i++ ] ) === false ) { + break; + } + } + } + } + + return obj; + }, + + // Use native String.trim function wherever possible + trim: core_trim && !core_trim.call("\uFEFF\xA0") ? + function( text ) { + return text == null ? + "" : + core_trim.call( text ); + } : + + // Otherwise use our own trimming functionality + function( text ) { + return text == null ? + "" : + ( text + "" ).replace( rtrim, "" ); + }, + + // results is for internal usage only + makeArray: function( arr, results ) { + var type, + ret = results || []; + + if ( arr != null ) { + // The window, strings (and functions) also have 'length' + // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930 + type = jQuery.type( arr ); + + if ( arr.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( arr ) ) { + core_push.call( ret, arr ); + } else { + jQuery.merge( ret, arr ); + } + } + + return ret; + }, + + inArray: function( elem, arr, i ) { + var len; + + if ( arr ) { + if ( core_indexOf ) { + return core_indexOf.call( arr, elem, i ); + } + + len = arr.length; + i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; + + for ( ; i < len; i++ ) { + // Skip accessing in sparse arrays + if ( i in arr && arr[ i ] === elem ) { + return i; + } + } + } + + return -1; + }, + + merge: function( first, second ) { + var l = second.length, + i = first.length, + j = 0; + + if ( typeof l === "number" ) { + for ( ; j < l; j++ ) { + first[ i++ ] = second[ j ]; + } + + } else { + while ( second[j] !== undefined ) { + first[ i++ ] = second[ j++ ]; + } + } + + first.length = i; + + return first; + }, + + grep: function( elems, callback, inv ) { + var retVal, + ret = [], + i = 0, + length = elems.length; + inv = !!inv; + + // Go through the array, only saving the items + // that pass the validator function + for ( ; i < length; i++ ) { + retVal = !!callback( elems[ i ], i ); + if ( inv !== retVal ) { + ret.push( elems[ i ] ); + } + } + + return ret; + }, + + // arg is for internal usage only + map: function( elems, callback, arg ) { + var value, key, + ret = [], + i = 0, + length = elems.length, + // jquery objects are treated as arrays + isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ; + + // Go through the array, translating each of the items to their + if ( isArray ) { + for ( ; i < length; i++ ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret[ ret.length ] = value; + } + } + + // Go through every key on the object, + } else { + for ( key in elems ) { + value = callback( elems[ key ], key, arg ); + + if ( value != null ) { + ret[ ret.length ] = value; + } + } + } + + // Flatten any nested arrays + return ret.concat.apply( [], ret ); + }, + + // A global GUID counter for objects + guid: 1, + + // Bind a function to a context, optionally partially applying any + // arguments. + proxy: function( fn, context ) { + var tmp, args, proxy; + + if ( typeof context === "string" ) { + tmp = fn[ context ]; + context = fn; + fn = tmp; + } + + // Quick check to determine if target is callable, in the spec + // this throws a TypeError, but we will just return undefined. + if ( !jQuery.isFunction( fn ) ) { + return undefined; + } + + // Simulated bind + args = core_slice.call( arguments, 2 ); + proxy = function() { + return fn.apply( context, args.concat( core_slice.call( arguments ) ) ); + }; + + // Set the guid of unique handler to the same of original handler, so it can be removed + proxy.guid = fn.guid = fn.guid || jQuery.guid++; + + return proxy; + }, + + // Multifunctional method to get and set values of a collection + // The value/s can optionally be executed if it's a function + access: function( elems, fn, key, value, chainable, emptyGet, pass ) { + var exec, + bulk = key == null, + i = 0, + length = elems.length; + + // Sets many values + if ( key && typeof key === "object" ) { + for ( i in key ) { + jQuery.access( elems, fn, i, key[i], 1, emptyGet, value ); + } + chainable = 1; + + // Sets one value + } else if ( value !== undefined ) { + // Optionally, function values get executed if exec is true + exec = pass === undefined && jQuery.isFunction( value ); + + if ( bulk ) { + // Bulk operations only iterate when executing function values + if ( exec ) { + exec = fn; + fn = function( elem, key, value ) { + return exec.call( jQuery( elem ), value ); + }; + + // Otherwise they run against the entire set + } else { + fn.call( elems, value ); + fn = null; + } + } + + if ( fn ) { + for (; i < length; i++ ) { + fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass ); + } + } + + chainable = 1; + } + + return chainable ? + elems : + + // Gets + bulk ? + fn.call( elems ) : + length ? fn( elems[0], key ) : emptyGet; + }, + + now: function() { + return ( new Date() ).getTime(); + } }); jQuery.ready.promise = function( obj ) { - if ( !readyList ) { + if ( !readyList ) { - readyList = jQuery.Deferred(); + readyList = jQuery.Deferred(); - // Catch cases where $(document).ready() is called after the browser event has already occurred. - // we once tried to use readyState "interactive" here, but it caused issues like the one - // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 - if ( document.readyState === "complete" ) { - // Handle it asynchronously to allow scripts the opportunity to delay ready - setTimeout( jQuery.ready, 1 ); + // Catch cases where $(document).ready() is called after the browser event has already occurred. + // we once tried to use readyState "interactive" here, but it caused issues like the one + // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 + if ( document.readyState === "complete" ) { + // Handle it asynchronously to allow scripts the opportunity to delay ready + setTimeout( jQuery.ready, 1 ); - // Standards-based browsers support DOMContentLoaded - } else if ( document.addEventListener ) { - // Use the handy event callback - document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); + // Standards-based browsers support DOMContentLoaded + } else if ( document.addEventListener ) { + // Use the handy event callback + document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); - // A fallback to window.onload, that will always work - window.addEventListener( "load", jQuery.ready, false ); + // A fallback to window.onload, that will always work + window.addEventListener( "load", jQuery.ready, false ); - // If IE event model is used - } else { - // Ensure firing before onload, maybe late but safe also for iframes - document.attachEvent( "onreadystatechange", DOMContentLoaded ); + // If IE event model is used + } else { + // Ensure firing before onload, maybe late but safe also for iframes + document.attachEvent( "onreadystatechange", DOMContentLoaded ); - // A fallback to window.onload, that will always work - window.attachEvent( "onload", jQuery.ready ); + // A fallback to window.onload, that will always work + window.attachEvent( "onload", jQuery.ready ); - // If IE and not a frame - // continually check to see if the document is ready - var top = false; + // If IE and not a frame + // continually check to see if the document is ready + var top = false; - try { - top = window.frameElement == null && document.documentElement; - } catch(e) {} + try { + top = window.frameElement == null && document.documentElement; + } catch(e) {} - if ( top && top.doScroll ) { - (function doScrollCheck() { - if ( !jQuery.isReady ) { + if ( top && top.doScroll ) { + (function doScrollCheck() { + if ( !jQuery.isReady ) { - try { - // Use the trick by Diego Perini - // http://javascript.nwbox.com/IEContentLoaded/ - top.doScroll("left"); - } catch(e) { - return setTimeout( doScrollCheck, 50 ); - } + try { + // Use the trick by Diego Perini + // http://javascript.nwbox.com/IEContentLoaded/ + top.doScroll("left"); + } catch(e) { + return setTimeout( doScrollCheck, 50 ); + } - // and execute any waiting functions - jQuery.ready(); - } - })(); - } - } - } - return readyList.promise( obj ); + // and execute any waiting functions + jQuery.ready(); + } + })(); + } + } + } + return readyList.promise( obj ); }; // Populate the class2type map jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) { - class2type[ "[object " + name + "]" ] = name.toLowerCase(); + class2type[ "[object " + name + "]" ] = name.toLowerCase(); }); // All jQuery objects should point back to these @@ -909,1729 +909,1729 @@ var optionsCache = {}; // Convert String-formatted options into Object-formatted ones and store in cache function createOptions( options ) { - var object = optionsCache[ options ] = {}; - jQuery.each( options.split( core_rspace ), function( _, flag ) { - object[ flag ] = true; - }); - return object; + var object = optionsCache[ options ] = {}; + jQuery.each( options.split( core_rspace ), function( _, flag ) { + object[ flag ] = true; + }); + return object; } /* * Create a callback list using the following parameters: * - * options: an optional list of space-separated options that will change how - * the callback list behaves or a more traditional option object + * options: an optional list of space-separated options that will change how + * the callback list behaves or a more traditional option object * * By default a callback list will act like an event callback list and can be * "fired" multiple times. * * Possible options: * - * once: will ensure the callback list can only be fired once (like a Deferred) + * once: will ensure the callback list can only be fired once (like a Deferred) * - * memory: will keep track of previous values and will call any callback added - * after the list has been fired right away with the latest "memorized" - * values (like a Deferred) + * memory: will keep track of previous values and will call any callback added + * after the list has been fired right away with the latest "memorized" + * values (like a Deferred) * - * unique: will ensure a callback can only be added once (no duplicate in the list) + * unique: will ensure a callback can only be added once (no duplicate in the list) * - * stopOnFalse: interrupt callings when a callback returns false + * stopOnFalse: interrupt callings when a callback returns false * */ jQuery.Callbacks = function( options ) { - // Convert options from String-formatted to Object-formatted if needed - // (we check in cache first) - options = typeof options === "string" ? - ( optionsCache[ options ] || createOptions( options ) ) : - jQuery.extend( {}, options ); + // Convert options from String-formatted to Object-formatted if needed + // (we check in cache first) + options = typeof options === "string" ? + ( optionsCache[ options ] || createOptions( options ) ) : + jQuery.extend( {}, options ); - var // Last fire value (for non-forgettable lists) - memory, - // Flag to know if list was already fired - fired, - // Flag to know if list is currently firing - firing, - // First callback to fire (used internally by add and fireWith) - firingStart, - // End of the loop when firing - firingLength, - // Index of currently firing callback (modified by remove if needed) - firingIndex, - // Actual callback list - list = [], - // Stack of fire calls for repeatable lists - stack = !options.once && [], - // Fire callbacks - fire = function( data ) { - memory = options.memory && data; - fired = true; - firingIndex = firingStart || 0; - firingStart = 0; - firingLength = list.length; - firing = true; - for ( ; list && firingIndex < firingLength; firingIndex++ ) { - if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) { - memory = false; // To prevent further calls using add - break; - } - } - firing = false; - if ( list ) { - if ( stack ) { - if ( stack.length ) { - fire( stack.shift() ); - } - } else if ( memory ) { - list = []; - } else { - self.disable(); - } - } - }, - // Actual Callbacks object - self = { - // Add a callback or a collection of callbacks to the list - add: function() { - if ( list ) { - // First, we save the current length - var start = list.length; - (function add( args ) { - jQuery.each( args, function( _, arg ) { - var type = jQuery.type( arg ); - if ( type === "function" ) { - if ( !options.unique || !self.has( arg ) ) { - list.push( arg ); - } - } else if ( arg && arg.length && type !== "string" ) { - // Inspect recursively - add( arg ); - } - }); - })( arguments ); - // Do we need to add the callbacks to the - // current firing batch? - if ( firing ) { - firingLength = list.length; - // With memory, if we're not firing then - // we should call right away - } else if ( memory ) { - firingStart = start; - fire( memory ); - } - } - return this; - }, - // Remove a callback from the list - remove: function() { - if ( list ) { - jQuery.each( arguments, function( _, arg ) { - var index; - while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { - list.splice( index, 1 ); - // Handle firing indexes - if ( firing ) { - if ( index <= firingLength ) { - firingLength--; - } - if ( index <= firingIndex ) { - firingIndex--; - } - } - } - }); - } - return this; - }, - // Control if a given callback is in the list - has: function( fn ) { - return jQuery.inArray( fn, list ) > -1; - }, - // Remove all callbacks from the list - empty: function() { - list = []; - return this; - }, - // Have the list do nothing anymore - disable: function() { - list = stack = memory = undefined; - return this; - }, - // Is it disabled? - disabled: function() { - return !list; - }, - // Lock the list in its current state - lock: function() { - stack = undefined; - if ( !memory ) { - self.disable(); - } - return this; - }, - // Is it locked? - locked: function() { - return !stack; - }, - // Call all callbacks with the given context and arguments - fireWith: function( context, args ) { - args = args || []; - args = [ context, args.slice ? args.slice() : args ]; - if ( list && ( !fired || stack ) ) { - if ( firing ) { - stack.push( args ); - } else { - fire( args ); - } - } - return this; - }, - // Call all the callbacks with the given arguments - fire: function() { - self.fireWith( this, arguments ); - return this; - }, - // To know if the callbacks have already been called at least once - fired: function() { - return !!fired; - } - }; + var // Last fire value (for non-forgettable lists) + memory, + // Flag to know if list was already fired + fired, + // Flag to know if list is currently firing + firing, + // First callback to fire (used internally by add and fireWith) + firingStart, + // End of the loop when firing + firingLength, + // Index of currently firing callback (modified by remove if needed) + firingIndex, + // Actual callback list + list = [], + // Stack of fire calls for repeatable lists + stack = !options.once && [], + // Fire callbacks + fire = function( data ) { + memory = options.memory && data; + fired = true; + firingIndex = firingStart || 0; + firingStart = 0; + firingLength = list.length; + firing = true; + for ( ; list && firingIndex < firingLength; firingIndex++ ) { + if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) { + memory = false; // To prevent further calls using add + break; + } + } + firing = false; + if ( list ) { + if ( stack ) { + if ( stack.length ) { + fire( stack.shift() ); + } + } else if ( memory ) { + list = []; + } else { + self.disable(); + } + } + }, + // Actual Callbacks object + self = { + // Add a callback or a collection of callbacks to the list + add: function() { + if ( list ) { + // First, we save the current length + var start = list.length; + (function add( args ) { + jQuery.each( args, function( _, arg ) { + var type = jQuery.type( arg ); + if ( type === "function" ) { + if ( !options.unique || !self.has( arg ) ) { + list.push( arg ); + } + } else if ( arg && arg.length && type !== "string" ) { + // Inspect recursively + add( arg ); + } + }); + })( arguments ); + // Do we need to add the callbacks to the + // current firing batch? + if ( firing ) { + firingLength = list.length; + // With memory, if we're not firing then + // we should call right away + } else if ( memory ) { + firingStart = start; + fire( memory ); + } + } + return this; + }, + // Remove a callback from the list + remove: function() { + if ( list ) { + jQuery.each( arguments, function( _, arg ) { + var index; + while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { + list.splice( index, 1 ); + // Handle firing indexes + if ( firing ) { + if ( index <= firingLength ) { + firingLength--; + } + if ( index <= firingIndex ) { + firingIndex--; + } + } + } + }); + } + return this; + }, + // Control if a given callback is in the list + has: function( fn ) { + return jQuery.inArray( fn, list ) > -1; + }, + // Remove all callbacks from the list + empty: function() { + list = []; + return this; + }, + // Have the list do nothing anymore + disable: function() { + list = stack = memory = undefined; + return this; + }, + // Is it disabled? + disabled: function() { + return !list; + }, + // Lock the list in its current state + lock: function() { + stack = undefined; + if ( !memory ) { + self.disable(); + } + return this; + }, + // Is it locked? + locked: function() { + return !stack; + }, + // Call all callbacks with the given context and arguments + fireWith: function( context, args ) { + args = args || []; + args = [ context, args.slice ? args.slice() : args ]; + if ( list && ( !fired || stack ) ) { + if ( firing ) { + stack.push( args ); + } else { + fire( args ); + } + } + return this; + }, + // Call all the callbacks with the given arguments + fire: function() { + self.fireWith( this, arguments ); + return this; + }, + // To know if the callbacks have already been called at least once + fired: function() { + return !!fired; + } + }; - return self; + return self; }; jQuery.extend({ - Deferred: function( func ) { - var tuples = [ - // action, add listener, listener list, final state - [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ], - [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ], - [ "notify", "progress", jQuery.Callbacks("memory") ] - ], - state = "pending", - promise = { - state: function() { - return state; - }, - always: function() { - deferred.done( arguments ).fail( arguments ); - return this; - }, - then: function( /* fnDone, fnFail, fnProgress */ ) { - var fns = arguments; - return jQuery.Deferred(function( newDefer ) { - jQuery.each( tuples, function( i, tuple ) { - var action = tuple[ 0 ], - fn = fns[ i ]; - // deferred[ done | fail | progress ] for forwarding actions to newDefer - deferred[ tuple[1] ]( jQuery.isFunction( fn ) ? - function() { - var returned = fn.apply( this, arguments ); - if ( returned && jQuery.isFunction( returned.promise ) ) { - returned.promise() - .done( newDefer.resolve ) - .fail( newDefer.reject ) - .progress( newDefer.notify ); - } else { - newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] ); - } - } : - newDefer[ action ] - ); - }); - fns = null; - }).promise(); - }, - // Get a promise for this deferred - // If obj is provided, the promise aspect is added to the object - promise: function( obj ) { - return obj != null ? jQuery.extend( obj, promise ) : promise; - } - }, - deferred = {}; + Deferred: function( func ) { + var tuples = [ + // action, add listener, listener list, final state + [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ], + [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ], + [ "notify", "progress", jQuery.Callbacks("memory") ] + ], + state = "pending", + promise = { + state: function() { + return state; + }, + always: function() { + deferred.done( arguments ).fail( arguments ); + return this; + }, + then: function( /* fnDone, fnFail, fnProgress */ ) { + var fns = arguments; + return jQuery.Deferred(function( newDefer ) { + jQuery.each( tuples, function( i, tuple ) { + var action = tuple[ 0 ], + fn = fns[ i ]; + // deferred[ done | fail | progress ] for forwarding actions to newDefer + deferred[ tuple[1] ]( jQuery.isFunction( fn ) ? + function() { + var returned = fn.apply( this, arguments ); + if ( returned && jQuery.isFunction( returned.promise ) ) { + returned.promise() + .done( newDefer.resolve ) + .fail( newDefer.reject ) + .progress( newDefer.notify ); + } else { + newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] ); + } + } : + newDefer[ action ] + ); + }); + fns = null; + }).promise(); + }, + // Get a promise for this deferred + // If obj is provided, the promise aspect is added to the object + promise: function( obj ) { + return obj != null ? jQuery.extend( obj, promise ) : promise; + } + }, + deferred = {}; - // Keep pipe for back-compat - promise.pipe = promise.then; + // Keep pipe for back-compat + promise.pipe = promise.then; - // Add list-specific methods - jQuery.each( tuples, function( i, tuple ) { - var list = tuple[ 2 ], - stateString = tuple[ 3 ]; + // Add list-specific methods + jQuery.each( tuples, function( i, tuple ) { + var list = tuple[ 2 ], + stateString = tuple[ 3 ]; - // promise[ done | fail | progress ] = list.add - promise[ tuple[1] ] = list.add; + // promise[ done | fail | progress ] = list.add + promise[ tuple[1] ] = list.add; - // Handle state - if ( stateString ) { - list.add(function() { - // state = [ resolved | rejected ] - state = stateString; + // Handle state + if ( stateString ) { + list.add(function() { + // state = [ resolved | rejected ] + state = stateString; - // [ reject_list | resolve_list ].disable; progress_list.lock - }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); - } + // [ reject_list | resolve_list ].disable; progress_list.lock + }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); + } - // deferred[ resolve | reject | notify ] = list.fire - deferred[ tuple[0] ] = list.fire; - deferred[ tuple[0] + "With" ] = list.fireWith; - }); + // deferred[ resolve | reject | notify ] = list.fire + deferred[ tuple[0] ] = list.fire; + deferred[ tuple[0] + "With" ] = list.fireWith; + }); - // Make the deferred a promise - promise.promise( deferred ); + // Make the deferred a promise + promise.promise( deferred ); - // Call given func if any - if ( func ) { - func.call( deferred, deferred ); - } + // Call given func if any + if ( func ) { + func.call( deferred, deferred ); + } - // All done! - return deferred; - }, + // All done! + return deferred; + }, - // Deferred helper - when: function( subordinate /* , ..., subordinateN */ ) { - var i = 0, - resolveValues = core_slice.call( arguments ), - length = resolveValues.length, + // Deferred helper + when: function( subordinate /* , ..., subordinateN */ ) { + var i = 0, + resolveValues = core_slice.call( arguments ), + length = resolveValues.length, - // the count of uncompleted subordinates - remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, + // the count of uncompleted subordinates + remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, - // the master Deferred. If resolveValues consist of only a single Deferred, just use that. - deferred = remaining === 1 ? subordinate : jQuery.Deferred(), + // the master Deferred. If resolveValues consist of only a single Deferred, just use that. + deferred = remaining === 1 ? subordinate : jQuery.Deferred(), - // Update function for both resolve and progress values - updateFunc = function( i, contexts, values ) { - return function( value ) { - contexts[ i ] = this; - values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value; - if( values === progressValues ) { - deferred.notifyWith( contexts, values ); - } else if ( !( --remaining ) ) { - deferred.resolveWith( contexts, values ); - } - }; - }, + // Update function for both resolve and progress values + updateFunc = function( i, contexts, values ) { + return function( value ) { + contexts[ i ] = this; + values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value; + if( values === progressValues ) { + deferred.notifyWith( contexts, values ); + } else if ( !( --remaining ) ) { + deferred.resolveWith( contexts, values ); + } + }; + }, - progressValues, progressContexts, resolveContexts; + progressValues, progressContexts, resolveContexts; - // add listeners to Deferred subordinates; treat others as resolved - if ( length > 1 ) { - progressValues = new Array( length ); - progressContexts = new Array( length ); - resolveContexts = new Array( length ); - for ( ; i < length; i++ ) { - if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { - resolveValues[ i ].promise() - .done( updateFunc( i, resolveContexts, resolveValues ) ) - .fail( deferred.reject ) - .progress( updateFunc( i, progressContexts, progressValues ) ); - } else { - --remaining; - } - } - } + // add listeners to Deferred subordinates; treat others as resolved + if ( length > 1 ) { + progressValues = new Array( length ); + progressContexts = new Array( length ); + resolveContexts = new Array( length ); + for ( ; i < length; i++ ) { + if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { + resolveValues[ i ].promise() + .done( updateFunc( i, resolveContexts, resolveValues ) ) + .fail( deferred.reject ) + .progress( updateFunc( i, progressContexts, progressValues ) ); + } else { + --remaining; + } + } + } - // if we're not waiting on anything, resolve the master - if ( !remaining ) { - deferred.resolveWith( resolveContexts, resolveValues ); - } + // if we're not waiting on anything, resolve the master + if ( !remaining ) { + deferred.resolveWith( resolveContexts, resolveValues ); + } - return deferred.promise(); - } + return deferred.promise(); + } }); jQuery.support = (function() { - var support, - all, - a, - select, - opt, - input, - fragment, - eventName, - i, - isSupported, - clickFn, - div = document.createElement("div"); + var support, + all, + a, + select, + opt, + input, + fragment, + eventName, + i, + isSupported, + clickFn, + div = document.createElement("div"); - // Setup - div.setAttribute( "className", "t" ); - div.innerHTML = "
    a"; + // Setup + div.setAttribute( "className", "t" ); + div.innerHTML = "
    a"; - // Support tests won't run in some limited or non-browser environments - all = div.getElementsByTagName("*"); - a = div.getElementsByTagName("a")[ 0 ]; - if ( !all || !a || !all.length ) { - return {}; - } + // Support tests won't run in some limited or non-browser environments + all = div.getElementsByTagName("*"); + a = div.getElementsByTagName("a")[ 0 ]; + if ( !all || !a || !all.length ) { + return {}; + } - // First batch of tests - select = document.createElement("select"); - opt = select.appendChild( document.createElement("option") ); - input = div.getElementsByTagName("input")[ 0 ]; + // First batch of tests + select = document.createElement("select"); + opt = select.appendChild( document.createElement("option") ); + input = div.getElementsByTagName("input")[ 0 ]; - a.style.cssText = "top:1px;float:left;opacity:.5"; - support = { - // IE strips leading whitespace when .innerHTML is used - leadingWhitespace: ( div.firstChild.nodeType === 3 ), + a.style.cssText = "top:1px;float:left;opacity:.5"; + support = { + // IE strips leading whitespace when .innerHTML is used + leadingWhitespace: ( div.firstChild.nodeType === 3 ), - // Make sure that tbody elements aren't automatically inserted - // IE will insert them into empty tables - tbody: !div.getElementsByTagName("tbody").length, + // Make sure that tbody elements aren't automatically inserted + // IE will insert them into empty tables + tbody: !div.getElementsByTagName("tbody").length, - // Make sure that link elements get serialized correctly by innerHTML - // This requires a wrapper element in IE - htmlSerialize: !!div.getElementsByTagName("link").length, + // Make sure that link elements get serialized correctly by innerHTML + // This requires a wrapper element in IE + htmlSerialize: !!div.getElementsByTagName("link").length, - // Get the style information from getAttribute - // (IE uses .cssText instead) - style: /top/.test( a.getAttribute("style") ), + // Get the style information from getAttribute + // (IE uses .cssText instead) + style: /top/.test( a.getAttribute("style") ), - // Make sure that URLs aren't manipulated - // (IE normalizes it by default) - hrefNormalized: ( a.getAttribute("href") === "/a" ), + // Make sure that URLs aren't manipulated + // (IE normalizes it by default) + hrefNormalized: ( a.getAttribute("href") === "/a" ), - // Make sure that element opacity exists - // (IE uses filter instead) - // Use a regex to work around a WebKit issue. See #5145 - opacity: /^0.5/.test( a.style.opacity ), + // Make sure that element opacity exists + // (IE uses filter instead) + // Use a regex to work around a WebKit issue. See #5145 + opacity: /^0.5/.test( a.style.opacity ), - // Verify style float existence - // (IE uses styleFloat instead of cssFloat) - cssFloat: !!a.style.cssFloat, + // Verify style float existence + // (IE uses styleFloat instead of cssFloat) + cssFloat: !!a.style.cssFloat, - // Make sure that if no value is specified for a checkbox - // that it defaults to "on". - // (WebKit defaults to "" instead) - checkOn: ( input.value === "on" ), + // Make sure that if no value is specified for a checkbox + // that it defaults to "on". + // (WebKit defaults to "" instead) + checkOn: ( input.value === "on" ), - // Make sure that a selected-by-default option has a working selected property. - // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) - optSelected: opt.selected, + // Make sure that a selected-by-default option has a working selected property. + // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) + optSelected: opt.selected, - // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) - getSetAttribute: div.className !== "t", + // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) + getSetAttribute: div.className !== "t", - // Tests for enctype support on a form (#6743) - enctype: !!document.createElement("form").enctype, + // Tests for enctype support on a form (#6743) + enctype: !!document.createElement("form").enctype, - // Makes sure cloning an html5 element does not cause problems - // Where outerHTML is undefined, this still works - html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav>", + // Makes sure cloning an html5 element does not cause problems + // Where outerHTML is undefined, this still works + html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav>", - // jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode - boxModel: ( document.compatMode === "CSS1Compat" ), + // jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode + boxModel: ( document.compatMode === "CSS1Compat" ), - // Will be defined later - submitBubbles: true, - changeBubbles: true, - focusinBubbles: false, - deleteExpando: true, - noCloneEvent: true, - inlineBlockNeedsLayout: false, - shrinkWrapBlocks: false, - reliableMarginRight: true, - boxSizingReliable: true, - pixelPosition: false - }; + // Will be defined later + submitBubbles: true, + changeBubbles: true, + focusinBubbles: false, + deleteExpando: true, + noCloneEvent: true, + inlineBlockNeedsLayout: false, + shrinkWrapBlocks: false, + reliableMarginRight: true, + boxSizingReliable: true, + pixelPosition: false + }; - // Make sure checked status is properly cloned - input.checked = true; - support.noCloneChecked = input.cloneNode( true ).checked; + // Make sure checked status is properly cloned + input.checked = true; + support.noCloneChecked = input.cloneNode( true ).checked; - // Make sure that the options inside disabled selects aren't marked as disabled - // (WebKit marks them as disabled) - select.disabled = true; - support.optDisabled = !opt.disabled; + // Make sure that the options inside disabled selects aren't marked as disabled + // (WebKit marks them as disabled) + select.disabled = true; + support.optDisabled = !opt.disabled; - // Test to see if it's possible to delete an expando from an element - // Fails in Internet Explorer - try { - delete div.test; - } catch( e ) { - support.deleteExpando = false; - } + // Test to see if it's possible to delete an expando from an element + // Fails in Internet Explorer + try { + delete div.test; + } catch( e ) { + support.deleteExpando = false; + } - if ( !div.addEventListener && div.attachEvent && div.fireEvent ) { - div.attachEvent( "onclick", clickFn = function() { - // Cloning a node shouldn't copy over any - // bound event handlers (IE does this) - support.noCloneEvent = false; - }); - div.cloneNode( true ).fireEvent("onclick"); - div.detachEvent( "onclick", clickFn ); - } + if ( !div.addEventListener && div.attachEvent && div.fireEvent ) { + div.attachEvent( "onclick", clickFn = function() { + // Cloning a node shouldn't copy over any + // bound event handlers (IE does this) + support.noCloneEvent = false; + }); + div.cloneNode( true ).fireEvent("onclick"); + div.detachEvent( "onclick", clickFn ); + } - // Check if a radio maintains its value - // after being appended to the DOM - input = document.createElement("input"); - input.value = "t"; - input.setAttribute( "type", "radio" ); - support.radioValue = input.value === "t"; + // Check if a radio maintains its value + // after being appended to the DOM + input = document.createElement("input"); + input.value = "t"; + input.setAttribute( "type", "radio" ); + support.radioValue = input.value === "t"; - input.setAttribute( "checked", "checked" ); + input.setAttribute( "checked", "checked" ); - // #11217 - WebKit loses check when the name is after the checked attribute - input.setAttribute( "name", "t" ); + // #11217 - WebKit loses check when the name is after the checked attribute + input.setAttribute( "name", "t" ); - div.appendChild( input ); - fragment = document.createDocumentFragment(); - fragment.appendChild( div.lastChild ); + div.appendChild( input ); + fragment = document.createDocumentFragment(); + fragment.appendChild( div.lastChild ); - // WebKit doesn't clone checked state correctly in fragments - support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; + // WebKit doesn't clone checked state correctly in fragments + support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; - // Check if a disconnected checkbox will retain its checked - // value of true after appended to the DOM (IE6/7) - support.appendChecked = input.checked; + // Check if a disconnected checkbox will retain its checked + // value of true after appended to the DOM (IE6/7) + support.appendChecked = input.checked; - fragment.removeChild( input ); - fragment.appendChild( div ); + fragment.removeChild( input ); + fragment.appendChild( div ); - // Technique from Juriy Zaytsev - // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/ - // We only care about the case where non-standard event systems - // are used, namely in IE. Short-circuiting here helps us to - // avoid an eval call (in setAttribute) which can cause CSP - // to go haywire. See: https://developer.mozilla.org/en/Security/CSP - if ( div.attachEvent ) { - for ( i in { - submit: true, - change: true, - focusin: true - }) { - eventName = "on" + i; - isSupported = ( eventName in div ); - if ( !isSupported ) { - div.setAttribute( eventName, "return;" ); - isSupported = ( typeof div[ eventName ] === "function" ); - } - support[ i + "Bubbles" ] = isSupported; - } - } + // Technique from Juriy Zaytsev + // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/ + // We only care about the case where non-standard event systems + // are used, namely in IE. Short-circuiting here helps us to + // avoid an eval call (in setAttribute) which can cause CSP + // to go haywire. See: https://developer.mozilla.org/en/Security/CSP + if ( div.attachEvent ) { + for ( i in { + submit: true, + change: true, + focusin: true + }) { + eventName = "on" + i; + isSupported = ( eventName in div ); + if ( !isSupported ) { + div.setAttribute( eventName, "return;" ); + isSupported = ( typeof div[ eventName ] === "function" ); + } + support[ i + "Bubbles" ] = isSupported; + } + } - // Run tests that need a body at doc ready - jQuery(function() { - var container, div, tds, marginDiv, - divReset = "padding:0;margin:0;border:0;display:block;overflow:hidden;", - body = document.getElementsByTagName("body")[0]; + // Run tests that need a body at doc ready + jQuery(function() { + var container, div, tds, marginDiv, + divReset = "padding:0;margin:0;border:0;display:block;overflow:hidden;", + body = document.getElementsByTagName("body")[0]; - if ( !body ) { - // Return for frameset docs that don't have a body - return; - } + if ( !body ) { + // Return for frameset docs that don't have a body + return; + } - container = document.createElement("div"); - container.style.cssText = "visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px"; - body.insertBefore( container, body.firstChild ); + container = document.createElement("div"); + container.style.cssText = "visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px"; + body.insertBefore( container, body.firstChild ); - // Construct the test element - div = document.createElement("div"); - container.appendChild( div ); + // Construct the test element + div = document.createElement("div"); + container.appendChild( div ); - // Check if table cells still have offsetWidth/Height when they are set - // to display:none and there are still other visible table cells in a - // table row; if so, offsetWidth/Height are not reliable for use when - // determining if an element has been hidden directly using - // display:none (it is still safe to use offsets if a parent element is - // hidden; don safety goggles and see bug #4512 for more information). - // (only IE 8 fails this test) - div.innerHTML = "
    t
    "; - tds = div.getElementsByTagName("td"); - tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none"; - isSupported = ( tds[ 0 ].offsetHeight === 0 ); + // Check if table cells still have offsetWidth/Height when they are set + // to display:none and there are still other visible table cells in a + // table row; if so, offsetWidth/Height are not reliable for use when + // determining if an element has been hidden directly using + // display:none (it is still safe to use offsets if a parent element is + // hidden; don safety goggles and see bug #4512 for more information). + // (only IE 8 fails this test) + div.innerHTML = "
    t
    "; + tds = div.getElementsByTagName("td"); + tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none"; + isSupported = ( tds[ 0 ].offsetHeight === 0 ); - tds[ 0 ].style.display = ""; - tds[ 1 ].style.display = "none"; + tds[ 0 ].style.display = ""; + tds[ 1 ].style.display = "none"; - // Check if empty table cells still have offsetWidth/Height - // (IE <= 8 fail this test) - support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); + // Check if empty table cells still have offsetWidth/Height + // (IE <= 8 fail this test) + support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); - // Check box-sizing and margin behavior - div.innerHTML = ""; - div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;"; - support.boxSizing = ( div.offsetWidth === 4 ); - support.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== 1 ); + // Check box-sizing and margin behavior + div.innerHTML = ""; + div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;"; + support.boxSizing = ( div.offsetWidth === 4 ); + support.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== 1 ); - // NOTE: To any future maintainer, we've window.getComputedStyle - // because jsdom on node.js will break without it. - if ( window.getComputedStyle ) { - support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%"; - support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px"; + // NOTE: To any future maintainer, we've window.getComputedStyle + // because jsdom on node.js will break without it. + if ( window.getComputedStyle ) { + support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%"; + support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px"; - // Check if div with explicit width and no margin-right incorrectly - // gets computed margin-right based on width of container. For more - // info see bug #3333 - // Fails in WebKit before Feb 2011 nightlies - // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right - marginDiv = document.createElement("div"); - marginDiv.style.cssText = div.style.cssText = divReset; - marginDiv.style.marginRight = marginDiv.style.width = "0"; - div.style.width = "1px"; - div.appendChild( marginDiv ); - support.reliableMarginRight = - !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight ); - } + // Check if div with explicit width and no margin-right incorrectly + // gets computed margin-right based on width of container. For more + // info see bug #3333 + // Fails in WebKit before Feb 2011 nightlies + // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right + marginDiv = document.createElement("div"); + marginDiv.style.cssText = div.style.cssText = divReset; + marginDiv.style.marginRight = marginDiv.style.width = "0"; + div.style.width = "1px"; + div.appendChild( marginDiv ); + support.reliableMarginRight = + !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight ); + } - if ( typeof div.style.zoom !== "undefined" ) { - // Check if natively block-level elements act like inline-block - // elements when setting their display to 'inline' and giving - // them layout - // (IE < 8 does this) - div.innerHTML = ""; - div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1"; - support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 ); + if ( typeof div.style.zoom !== "undefined" ) { + // Check if natively block-level elements act like inline-block + // elements when setting their display to 'inline' and giving + // them layout + // (IE < 8 does this) + div.innerHTML = ""; + div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1"; + support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 ); - // Check if elements with layout shrink-wrap their children - // (IE 6 does this) - div.style.display = "block"; - div.style.overflow = "visible"; - div.innerHTML = "
    "; - div.firstChild.style.width = "5px"; - support.shrinkWrapBlocks = ( div.offsetWidth !== 3 ); + // Check if elements with layout shrink-wrap their children + // (IE 6 does this) + div.style.display = "block"; + div.style.overflow = "visible"; + div.innerHTML = "
    "; + div.firstChild.style.width = "5px"; + support.shrinkWrapBlocks = ( div.offsetWidth !== 3 ); - container.style.zoom = 1; - } + container.style.zoom = 1; + } - // Null elements to avoid leaks in IE - body.removeChild( container ); - container = div = tds = marginDiv = null; - }); + // Null elements to avoid leaks in IE + body.removeChild( container ); + container = div = tds = marginDiv = null; + }); - // Null elements to avoid leaks in IE - fragment.removeChild( div ); - all = a = select = opt = input = fragment = div = null; + // Null elements to avoid leaks in IE + fragment.removeChild( div ); + all = a = select = opt = input = fragment = div = null; - return support; + return support; })(); var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/, - rmultiDash = /([A-Z])/g; + rmultiDash = /([A-Z])/g; jQuery.extend({ - cache: {}, + cache: {}, - deletedIds: [], + deletedIds: [], - // Remove at next major release (1.9/2.0) - uuid: 0, + // Remove at next major release (1.9/2.0) + uuid: 0, - // Unique for each copy of jQuery on the page - // Non-digits removed to match rinlinejQuery - expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ), + // Unique for each copy of jQuery on the page + // Non-digits removed to match rinlinejQuery + expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ), - // The following elements throw uncatchable exceptions if you - // attempt to add expando properties to them. - noData: { - "embed": true, - // Ban all objects except for Flash (which handle expandos) - "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", - "applet": true - }, + // The following elements throw uncatchable exceptions if you + // attempt to add expando properties to them. + noData: { + "embed": true, + // Ban all objects except for Flash (which handle expandos) + "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", + "applet": true + }, - hasData: function( elem ) { - elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; - return !!elem && !isEmptyDataObject( elem ); - }, + hasData: function( elem ) { + elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; + return !!elem && !isEmptyDataObject( elem ); + }, - data: function( elem, name, data, pvt /* Internal Use Only */ ) { - if ( !jQuery.acceptData( elem ) ) { - return; - } + data: function( elem, name, data, pvt /* Internal Use Only */ ) { + if ( !jQuery.acceptData( elem ) ) { + return; + } - var thisCache, ret, - internalKey = jQuery.expando, - getByName = typeof name === "string", + var thisCache, ret, + internalKey = jQuery.expando, + getByName = typeof name === "string", - // We have to handle DOM nodes and JS objects differently because IE6-7 - // can't GC object references properly across the DOM-JS boundary - isNode = elem.nodeType, + // We have to handle DOM nodes and JS objects differently because IE6-7 + // can't GC object references properly across the DOM-JS boundary + isNode = elem.nodeType, - // Only DOM nodes need the global jQuery cache; JS object data is - // attached directly to the object so GC can occur automatically - cache = isNode ? jQuery.cache : elem, + // Only DOM nodes need the global jQuery cache; JS object data is + // attached directly to the object so GC can occur automatically + cache = isNode ? jQuery.cache : elem, - // Only defining an ID for JS objects if its cache already exists allows - // the code to shortcut on the same path as a DOM node with no cache - id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey; + // Only defining an ID for JS objects if its cache already exists allows + // the code to shortcut on the same path as a DOM node with no cache + id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey; - // Avoid doing any more work than we need to when trying to get data on an - // object that has no data at all - if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && getByName && data === undefined ) { - return; - } + // Avoid doing any more work than we need to when trying to get data on an + // object that has no data at all + if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && getByName && data === undefined ) { + return; + } - if ( !id ) { - // Only DOM nodes need a new unique ID for each element since their data - // ends up in the global cache - if ( isNode ) { - elem[ internalKey ] = id = jQuery.deletedIds.pop() || jQuery.guid++; - } else { - id = internalKey; - } - } + if ( !id ) { + // Only DOM nodes need a new unique ID for each element since their data + // ends up in the global cache + if ( isNode ) { + elem[ internalKey ] = id = jQuery.deletedIds.pop() || jQuery.guid++; + } else { + id = internalKey; + } + } - if ( !cache[ id ] ) { - cache[ id ] = {}; + if ( !cache[ id ] ) { + cache[ id ] = {}; - // Avoids exposing jQuery metadata on plain JS objects when the object - // is serialized using JSON.stringify - if ( !isNode ) { - cache[ id ].toJSON = jQuery.noop; - } - } + // Avoids exposing jQuery metadata on plain JS objects when the object + // is serialized using JSON.stringify + if ( !isNode ) { + cache[ id ].toJSON = jQuery.noop; + } + } - // An object can be passed to jQuery.data instead of a key/value pair; this gets - // shallow copied over onto the existing cache - if ( typeof name === "object" || typeof name === "function" ) { - if ( pvt ) { - cache[ id ] = jQuery.extend( cache[ id ], name ); - } else { - cache[ id ].data = jQuery.extend( cache[ id ].data, name ); - } - } + // An object can be passed to jQuery.data instead of a key/value pair; this gets + // shallow copied over onto the existing cache + if ( typeof name === "object" || typeof name === "function" ) { + if ( pvt ) { + cache[ id ] = jQuery.extend( cache[ id ], name ); + } else { + cache[ id ].data = jQuery.extend( cache[ id ].data, name ); + } + } - thisCache = cache[ id ]; + thisCache = cache[ id ]; - // jQuery data() is stored in a separate object inside the object's internal data - // cache in order to avoid key collisions between internal data and user-defined - // data. - if ( !pvt ) { - if ( !thisCache.data ) { - thisCache.data = {}; - } + // jQuery data() is stored in a separate object inside the object's internal data + // cache in order to avoid key collisions between internal data and user-defined + // data. + if ( !pvt ) { + if ( !thisCache.data ) { + thisCache.data = {}; + } - thisCache = thisCache.data; - } + thisCache = thisCache.data; + } - if ( data !== undefined ) { - thisCache[ jQuery.camelCase( name ) ] = data; - } + if ( data !== undefined ) { + thisCache[ jQuery.camelCase( name ) ] = data; + } - // Check for both converted-to-camel and non-converted data property names - // If a data property was specified - if ( getByName ) { + // Check for both converted-to-camel and non-converted data property names + // If a data property was specified + if ( getByName ) { - // First Try to find as-is property data - ret = thisCache[ name ]; + // First Try to find as-is property data + ret = thisCache[ name ]; - // Test for null|undefined property data - if ( ret == null ) { + // Test for null|undefined property data + if ( ret == null ) { - // Try to find the camelCased property - ret = thisCache[ jQuery.camelCase( name ) ]; - } - } else { - ret = thisCache; - } + // Try to find the camelCased property + ret = thisCache[ jQuery.camelCase( name ) ]; + } + } else { + ret = thisCache; + } - return ret; - }, + return ret; + }, - removeData: function( elem, name, pvt /* Internal Use Only */ ) { - if ( !jQuery.acceptData( elem ) ) { - return; - } + removeData: function( elem, name, pvt /* Internal Use Only */ ) { + if ( !jQuery.acceptData( elem ) ) { + return; + } - var thisCache, i, l, + var thisCache, i, l, - isNode = elem.nodeType, + isNode = elem.nodeType, - // See jQuery.data for more information - cache = isNode ? jQuery.cache : elem, - id = isNode ? elem[ jQuery.expando ] : jQuery.expando; + // See jQuery.data for more information + cache = isNode ? jQuery.cache : elem, + id = isNode ? elem[ jQuery.expando ] : jQuery.expando; - // If there is already no cache entry for this object, there is no - // purpose in continuing - if ( !cache[ id ] ) { - return; - } + // If there is already no cache entry for this object, there is no + // purpose in continuing + if ( !cache[ id ] ) { + return; + } - if ( name ) { + if ( name ) { - thisCache = pvt ? cache[ id ] : cache[ id ].data; + thisCache = pvt ? cache[ id ] : cache[ id ].data; - if ( thisCache ) { + if ( thisCache ) { - // Support array or space separated string names for data keys - if ( !jQuery.isArray( name ) ) { + // Support array or space separated string names for data keys + if ( !jQuery.isArray( name ) ) { - // try the string as a key before any manipulation - if ( name in thisCache ) { - name = [ name ]; - } else { + // try the string as a key before any manipulation + if ( name in thisCache ) { + name = [ name ]; + } else { - // split the camel cased version by spaces unless a key with the spaces exists - name = jQuery.camelCase( name ); - if ( name in thisCache ) { - name = [ name ]; - } else { - name = name.split(" "); - } - } - } + // split the camel cased version by spaces unless a key with the spaces exists + name = jQuery.camelCase( name ); + if ( name in thisCache ) { + name = [ name ]; + } else { + name = name.split(" "); + } + } + } - for ( i = 0, l = name.length; i < l; i++ ) { - delete thisCache[ name[i] ]; - } + for ( i = 0, l = name.length; i < l; i++ ) { + delete thisCache[ name[i] ]; + } - // If there is no data left in the cache, we want to continue - // and let the cache object itself get destroyed - if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) { - return; - } - } - } + // If there is no data left in the cache, we want to continue + // and let the cache object itself get destroyed + if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) { + return; + } + } + } - // See jQuery.data for more information - if ( !pvt ) { - delete cache[ id ].data; + // See jQuery.data for more information + if ( !pvt ) { + delete cache[ id ].data; - // Don't destroy the parent cache unless the internal data object - // had been the only thing left in it - if ( !isEmptyDataObject( cache[ id ] ) ) { - return; - } - } + // Don't destroy the parent cache unless the internal data object + // had been the only thing left in it + if ( !isEmptyDataObject( cache[ id ] ) ) { + return; + } + } - // Destroy the cache - if ( isNode ) { - jQuery.cleanData( [ elem ], true ); + // Destroy the cache + if ( isNode ) { + jQuery.cleanData( [ elem ], true ); - // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080) - } else if ( jQuery.support.deleteExpando || cache != cache.window ) { - delete cache[ id ]; + // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080) + } else if ( jQuery.support.deleteExpando || cache != cache.window ) { + delete cache[ id ]; - // When all else fails, null - } else { - cache[ id ] = null; - } - }, + // When all else fails, null + } else { + cache[ id ] = null; + } + }, - // For internal use only. - _data: function( elem, name, data ) { - return jQuery.data( elem, name, data, true ); - }, + // For internal use only. + _data: function( elem, name, data ) { + return jQuery.data( elem, name, data, true ); + }, - // A method for determining if a DOM node can handle the data expando - acceptData: function( elem ) { - var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ]; + // A method for determining if a DOM node can handle the data expando + acceptData: function( elem ) { + var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ]; - // nodes accept data unless otherwise specified; rejection can be conditional - return !noData || noData !== true && elem.getAttribute("classid") === noData; - } + // nodes accept data unless otherwise specified; rejection can be conditional + return !noData || noData !== true && elem.getAttribute("classid") === noData; + } }); jQuery.fn.extend({ - data: function( key, value ) { - var parts, part, attr, name, l, - elem = this[0], - i = 0, - data = null; + data: function( key, value ) { + var parts, part, attr, name, l, + elem = this[0], + i = 0, + data = null; - // Gets all values - if ( key === undefined ) { - if ( this.length ) { - data = jQuery.data( elem ); + // Gets all values + if ( key === undefined ) { + if ( this.length ) { + data = jQuery.data( elem ); - if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) { - attr = elem.attributes; - for ( l = attr.length; i < l; i++ ) { - name = attr[i].name; + if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) { + attr = elem.attributes; + for ( l = attr.length; i < l; i++ ) { + name = attr[i].name; - if ( !name.indexOf( "data-" ) ) { - name = jQuery.camelCase( name.substring(5) ); + if ( !name.indexOf( "data-" ) ) { + name = jQuery.camelCase( name.substring(5) ); - dataAttr( elem, name, data[ name ] ); - } - } - jQuery._data( elem, "parsedAttrs", true ); - } - } + dataAttr( elem, name, data[ name ] ); + } + } + jQuery._data( elem, "parsedAttrs", true ); + } + } - return data; - } + return data; + } - // Sets multiple values - if ( typeof key === "object" ) { - return this.each(function() { - jQuery.data( this, key ); - }); - } + // Sets multiple values + if ( typeof key === "object" ) { + return this.each(function() { + jQuery.data( this, key ); + }); + } - parts = key.split( ".", 2 ); - parts[1] = parts[1] ? "." + parts[1] : ""; - part = parts[1] + "!"; + parts = key.split( ".", 2 ); + parts[1] = parts[1] ? "." + parts[1] : ""; + part = parts[1] + "!"; - return jQuery.access( this, function( value ) { + return jQuery.access( this, function( value ) { - if ( value === undefined ) { - data = this.triggerHandler( "getData" + part, [ parts[0] ] ); + if ( value === undefined ) { + data = this.triggerHandler( "getData" + part, [ parts[0] ] ); - // Try to fetch any internally stored data first - if ( data === undefined && elem ) { - data = jQuery.data( elem, key ); - data = dataAttr( elem, key, data ); - } + // Try to fetch any internally stored data first + if ( data === undefined && elem ) { + data = jQuery.data( elem, key ); + data = dataAttr( elem, key, data ); + } - return data === undefined && parts[1] ? - this.data( parts[0] ) : - data; - } + return data === undefined && parts[1] ? + this.data( parts[0] ) : + data; + } - parts[1] = value; - this.each(function() { - var self = jQuery( this ); + parts[1] = value; + this.each(function() { + var self = jQuery( this ); - self.triggerHandler( "setData" + part, parts ); - jQuery.data( this, key, value ); - self.triggerHandler( "changeData" + part, parts ); - }); - }, null, value, arguments.length > 1, null, false ); - }, + self.triggerHandler( "setData" + part, parts ); + jQuery.data( this, key, value ); + self.triggerHandler( "changeData" + part, parts ); + }); + }, null, value, arguments.length > 1, null, false ); + }, - removeData: function( key ) { - return this.each(function() { - jQuery.removeData( this, key ); - }); - } + removeData: function( key ) { + return this.each(function() { + jQuery.removeData( this, key ); + }); + } }); function dataAttr( elem, key, data ) { - // If nothing was found internally, try to fetch any - // data from the HTML5 data-* attribute - if ( data === undefined && elem.nodeType === 1 ) { + // If nothing was found internally, try to fetch any + // data from the HTML5 data-* attribute + if ( data === undefined && elem.nodeType === 1 ) { - var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); + var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); - data = elem.getAttribute( name ); + data = elem.getAttribute( name ); - if ( typeof data === "string" ) { - try { - data = data === "true" ? true : - data === "false" ? false : - data === "null" ? null : - // Only convert to a number if it doesn't change the string - +data + "" === data ? +data : - rbrace.test( data ) ? jQuery.parseJSON( data ) : - data; - } catch( e ) {} + if ( typeof data === "string" ) { + try { + data = data === "true" ? true : + data === "false" ? false : + data === "null" ? null : + // Only convert to a number if it doesn't change the string + +data + "" === data ? +data : + rbrace.test( data ) ? jQuery.parseJSON( data ) : + data; + } catch( e ) {} - // Make sure we set the data so it isn't changed later - jQuery.data( elem, key, data ); + // Make sure we set the data so it isn't changed later + jQuery.data( elem, key, data ); - } else { - data = undefined; - } - } + } else { + data = undefined; + } + } - return data; + return data; } // checks a cache object for emptiness function isEmptyDataObject( obj ) { - var name; - for ( name in obj ) { + var name; + for ( name in obj ) { - // if the public data object is empty, the private is still empty - if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { - continue; - } - if ( name !== "toJSON" ) { - return false; - } - } + // if the public data object is empty, the private is still empty + if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { + continue; + } + if ( name !== "toJSON" ) { + return false; + } + } - return true; + return true; } jQuery.extend({ - queue: function( elem, type, data ) { - var queue; + queue: function( elem, type, data ) { + var queue; - if ( elem ) { - type = ( type || "fx" ) + "queue"; - queue = jQuery._data( elem, type ); + if ( elem ) { + type = ( type || "fx" ) + "queue"; + queue = jQuery._data( elem, type ); - // Speed up dequeue by getting out quickly if this is just a lookup - if ( data ) { - if ( !queue || jQuery.isArray(data) ) { - queue = jQuery._data( elem, type, jQuery.makeArray(data) ); - } else { - queue.push( data ); - } - } - return queue || []; - } - }, + // Speed up dequeue by getting out quickly if this is just a lookup + if ( data ) { + if ( !queue || jQuery.isArray(data) ) { + queue = jQuery._data( elem, type, jQuery.makeArray(data) ); + } else { + queue.push( data ); + } + } + return queue || []; + } + }, - dequeue: function( elem, type ) { - type = type || "fx"; + dequeue: function( elem, type ) { + type = type || "fx"; - var queue = jQuery.queue( elem, type ), - startLength = queue.length, - fn = queue.shift(), - hooks = jQuery._queueHooks( elem, type ), - next = function() { - jQuery.dequeue( elem, type ); - }; + var queue = jQuery.queue( elem, type ), + startLength = queue.length, + fn = queue.shift(), + hooks = jQuery._queueHooks( elem, type ), + next = function() { + jQuery.dequeue( elem, type ); + }; - // If the fx queue is dequeued, always remove the progress sentinel - if ( fn === "inprogress" ) { - fn = queue.shift(); - startLength--; - } + // If the fx queue is dequeued, always remove the progress sentinel + if ( fn === "inprogress" ) { + fn = queue.shift(); + startLength--; + } - if ( fn ) { + if ( fn ) { - // Add a progress sentinel to prevent the fx queue from being - // automatically dequeued - if ( type === "fx" ) { - queue.unshift( "inprogress" ); - } + // Add a progress sentinel to prevent the fx queue from being + // automatically dequeued + if ( type === "fx" ) { + queue.unshift( "inprogress" ); + } - // clear up the last queue stop function - delete hooks.stop; - fn.call( elem, next, hooks ); - } + // clear up the last queue stop function + delete hooks.stop; + fn.call( elem, next, hooks ); + } - if ( !startLength && hooks ) { - hooks.empty.fire(); - } - }, + if ( !startLength && hooks ) { + hooks.empty.fire(); + } + }, - // not intended for public consumption - generates a queueHooks object, or returns the current one - _queueHooks: function( elem, type ) { - var key = type + "queueHooks"; - return jQuery._data( elem, key ) || jQuery._data( elem, key, { - empty: jQuery.Callbacks("once memory").add(function() { - jQuery.removeData( elem, type + "queue", true ); - jQuery.removeData( elem, key, true ); - }) - }); - } + // not intended for public consumption - generates a queueHooks object, or returns the current one + _queueHooks: function( elem, type ) { + var key = type + "queueHooks"; + return jQuery._data( elem, key ) || jQuery._data( elem, key, { + empty: jQuery.Callbacks("once memory").add(function() { + jQuery.removeData( elem, type + "queue", true ); + jQuery.removeData( elem, key, true ); + }) + }); + } }); jQuery.fn.extend({ - queue: function( type, data ) { - var setter = 2; + queue: function( type, data ) { + var setter = 2; - if ( typeof type !== "string" ) { - data = type; - type = "fx"; - setter--; - } + if ( typeof type !== "string" ) { + data = type; + type = "fx"; + setter--; + } - if ( arguments.length < setter ) { - return jQuery.queue( this[0], type ); - } + if ( arguments.length < setter ) { + return jQuery.queue( this[0], type ); + } - return data === undefined ? - this : - this.each(function() { - var queue = jQuery.queue( this, type, data ); + return data === undefined ? + this : + this.each(function() { + var queue = jQuery.queue( this, type, data ); - // ensure a hooks for this queue - jQuery._queueHooks( this, type ); + // ensure a hooks for this queue + jQuery._queueHooks( this, type ); - if ( type === "fx" && queue[0] !== "inprogress" ) { - jQuery.dequeue( this, type ); - } - }); - }, - dequeue: function( type ) { - return this.each(function() { - jQuery.dequeue( this, type ); - }); - }, - // Based off of the plugin by Clint Helfers, with permission. - // http://blindsignals.com/index.php/2009/07/jquery-delay/ - delay: function( time, type ) { - time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; - type = type || "fx"; + if ( type === "fx" && queue[0] !== "inprogress" ) { + jQuery.dequeue( this, type ); + } + }); + }, + dequeue: function( type ) { + return this.each(function() { + jQuery.dequeue( this, type ); + }); + }, + // Based off of the plugin by Clint Helfers, with permission. + // http://blindsignals.com/index.php/2009/07/jquery-delay/ + delay: function( time, type ) { + time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; + type = type || "fx"; - return this.queue( type, function( next, hooks ) { - var timeout = setTimeout( next, time ); - hooks.stop = function() { - clearTimeout( timeout ); - }; - }); - }, - clearQueue: function( type ) { - return this.queue( type || "fx", [] ); - }, - // Get a promise resolved when queues of a certain type - // are emptied (fx is the type by default) - promise: function( type, obj ) { - var tmp, - count = 1, - defer = jQuery.Deferred(), - elements = this, - i = this.length, - resolve = function() { - if ( !( --count ) ) { - defer.resolveWith( elements, [ elements ] ); - } - }; + return this.queue( type, function( next, hooks ) { + var timeout = setTimeout( next, time ); + hooks.stop = function() { + clearTimeout( timeout ); + }; + }); + }, + clearQueue: function( type ) { + return this.queue( type || "fx", [] ); + }, + // Get a promise resolved when queues of a certain type + // are emptied (fx is the type by default) + promise: function( type, obj ) { + var tmp, + count = 1, + defer = jQuery.Deferred(), + elements = this, + i = this.length, + resolve = function() { + if ( !( --count ) ) { + defer.resolveWith( elements, [ elements ] ); + } + }; - if ( typeof type !== "string" ) { - obj = type; - type = undefined; - } - type = type || "fx"; + if ( typeof type !== "string" ) { + obj = type; + type = undefined; + } + type = type || "fx"; - while( i-- ) { - tmp = jQuery._data( elements[ i ], type + "queueHooks" ); - if ( tmp && tmp.empty ) { - count++; - tmp.empty.add( resolve ); - } - } - resolve(); - return defer.promise( obj ); - } + while( i-- ) { + tmp = jQuery._data( elements[ i ], type + "queueHooks" ); + if ( tmp && tmp.empty ) { + count++; + tmp.empty.add( resolve ); + } + } + resolve(); + return defer.promise( obj ); + } }); var nodeHook, boolHook, fixSpecified, - rclass = /[\t\r\n]/g, - rreturn = /\r/g, - rtype = /^(?:button|input)$/i, - rfocusable = /^(?:button|input|object|select|textarea)$/i, - rclickable = /^a(?:rea|)$/i, - rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, - getSetAttribute = jQuery.support.getSetAttribute; + rclass = /[\t\r\n]/g, + rreturn = /\r/g, + rtype = /^(?:button|input)$/i, + rfocusable = /^(?:button|input|object|select|textarea)$/i, + rclickable = /^a(?:rea|)$/i, + rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, + getSetAttribute = jQuery.support.getSetAttribute; jQuery.fn.extend({ - attr: function( name, value ) { - return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 ); - }, + attr: function( name, value ) { + return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 ); + }, - removeAttr: function( name ) { - return this.each(function() { - jQuery.removeAttr( this, name ); - }); - }, + removeAttr: function( name ) { + return this.each(function() { + jQuery.removeAttr( this, name ); + }); + }, - prop: function( name, value ) { - return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 ); - }, + prop: function( name, value ) { + return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 ); + }, - removeProp: function( name ) { - name = jQuery.propFix[ name ] || name; - return this.each(function() { - // try/catch handles cases where IE balks (such as removing a property on window) - try { - this[ name ] = undefined; - delete this[ name ]; - } catch( e ) {} - }); - }, + removeProp: function( name ) { + name = jQuery.propFix[ name ] || name; + return this.each(function() { + // try/catch handles cases where IE balks (such as removing a property on window) + try { + this[ name ] = undefined; + delete this[ name ]; + } catch( e ) {} + }); + }, - addClass: function( value ) { - var classNames, i, l, elem, - setClass, c, cl; + addClass: function( value ) { + var classNames, i, l, elem, + setClass, c, cl; - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).addClass( value.call(this, j, this.className) ); - }); - } + if ( jQuery.isFunction( value ) ) { + return this.each(function( j ) { + jQuery( this ).addClass( value.call(this, j, this.className) ); + }); + } - if ( value && typeof value === "string" ) { - classNames = value.split( core_rspace ); + if ( value && typeof value === "string" ) { + classNames = value.split( core_rspace ); - for ( i = 0, l = this.length; i < l; i++ ) { - elem = this[ i ]; + for ( i = 0, l = this.length; i < l; i++ ) { + elem = this[ i ]; - if ( elem.nodeType === 1 ) { - if ( !elem.className && classNames.length === 1 ) { - elem.className = value; + if ( elem.nodeType === 1 ) { + if ( !elem.className && classNames.length === 1 ) { + elem.className = value; - } else { - setClass = " " + elem.className + " "; + } else { + setClass = " " + elem.className + " "; - for ( c = 0, cl = classNames.length; c < cl; c++ ) { - if ( setClass.indexOf( " " + classNames[ c ] + " " ) < 0 ) { - setClass += classNames[ c ] + " "; - } - } - elem.className = jQuery.trim( setClass ); - } - } - } - } + for ( c = 0, cl = classNames.length; c < cl; c++ ) { + if ( setClass.indexOf( " " + classNames[ c ] + " " ) < 0 ) { + setClass += classNames[ c ] + " "; + } + } + elem.className = jQuery.trim( setClass ); + } + } + } + } - return this; - }, + return this; + }, - removeClass: function( value ) { - var removes, className, elem, c, cl, i, l; + removeClass: function( value ) { + var removes, className, elem, c, cl, i, l; - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).removeClass( value.call(this, j, this.className) ); - }); - } - if ( (value && typeof value === "string") || value === undefined ) { - removes = ( value || "" ).split( core_rspace ); + if ( jQuery.isFunction( value ) ) { + return this.each(function( j ) { + jQuery( this ).removeClass( value.call(this, j, this.className) ); + }); + } + if ( (value && typeof value === "string") || value === undefined ) { + removes = ( value || "" ).split( core_rspace ); - for ( i = 0, l = this.length; i < l; i++ ) { - elem = this[ i ]; - if ( elem.nodeType === 1 && elem.className ) { + for ( i = 0, l = this.length; i < l; i++ ) { + elem = this[ i ]; + if ( elem.nodeType === 1 && elem.className ) { - className = (" " + elem.className + " ").replace( rclass, " " ); + className = (" " + elem.className + " ").replace( rclass, " " ); - // loop over each item in the removal list - for ( c = 0, cl = removes.length; c < cl; c++ ) { - // Remove until there is nothing to remove, - while ( className.indexOf(" " + removes[ c ] + " ") >= 0 ) { - className = className.replace( " " + removes[ c ] + " " , " " ); - } - } - elem.className = value ? jQuery.trim( className ) : ""; - } - } - } + // loop over each item in the removal list + for ( c = 0, cl = removes.length; c < cl; c++ ) { + // Remove until there is nothing to remove, + while ( className.indexOf(" " + removes[ c ] + " ") >= 0 ) { + className = className.replace( " " + removes[ c ] + " " , " " ); + } + } + elem.className = value ? jQuery.trim( className ) : ""; + } + } + } - return this; - }, + return this; + }, - toggleClass: function( value, stateVal ) { - var type = typeof value, - isBool = typeof stateVal === "boolean"; + toggleClass: function( value, stateVal ) { + var type = typeof value, + isBool = typeof stateVal === "boolean"; - if ( jQuery.isFunction( value ) ) { - return this.each(function( i ) { - jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); - }); - } + if ( jQuery.isFunction( value ) ) { + return this.each(function( i ) { + jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); + }); + } - return this.each(function() { - if ( type === "string" ) { - // toggle individual class names - var className, - i = 0, - self = jQuery( this ), - state = stateVal, - classNames = value.split( core_rspace ); + return this.each(function() { + if ( type === "string" ) { + // toggle individual class names + var className, + i = 0, + self = jQuery( this ), + state = stateVal, + classNames = value.split( core_rspace ); - while ( (className = classNames[ i++ ]) ) { - // check each className given, space separated list - state = isBool ? state : !self.hasClass( className ); - self[ state ? "addClass" : "removeClass" ]( className ); - } + while ( (className = classNames[ i++ ]) ) { + // check each className given, space separated list + state = isBool ? state : !self.hasClass( className ); + self[ state ? "addClass" : "removeClass" ]( className ); + } - } else if ( type === "undefined" || type === "boolean" ) { - if ( this.className ) { - // store className if set - jQuery._data( this, "__className__", this.className ); - } + } else if ( type === "undefined" || type === "boolean" ) { + if ( this.className ) { + // store className if set + jQuery._data( this, "__className__", this.className ); + } - // toggle whole className - this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; - } - }); - }, + // toggle whole className + this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; + } + }); + }, - hasClass: function( selector ) { - var className = " " + selector + " ", - i = 0, - l = this.length; - for ( ; i < l; i++ ) { - if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) { - return true; - } - } + hasClass: function( selector ) { + var className = " " + selector + " ", + i = 0, + l = this.length; + for ( ; i < l; i++ ) { + if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) { + return true; + } + } - return false; - }, + return false; + }, - val: function( value ) { - var hooks, ret, isFunction, - elem = this[0]; + val: function( value ) { + var hooks, ret, isFunction, + elem = this[0]; - if ( !arguments.length ) { - if ( elem ) { - hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; + if ( !arguments.length ) { + if ( elem ) { + hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; - if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { - return ret; - } + if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { + return ret; + } - ret = elem.value; + ret = elem.value; - return typeof ret === "string" ? - // handle most common string cases - ret.replace(rreturn, "") : - // handle cases where value is null/undef or number - ret == null ? "" : ret; - } + return typeof ret === "string" ? + // handle most common string cases + ret.replace(rreturn, "") : + // handle cases where value is null/undef or number + ret == null ? "" : ret; + } - return; - } + return; + } - isFunction = jQuery.isFunction( value ); + isFunction = jQuery.isFunction( value ); - return this.each(function( i ) { - var val, - self = jQuery(this); + return this.each(function( i ) { + var val, + self = jQuery(this); - if ( this.nodeType !== 1 ) { - return; - } + if ( this.nodeType !== 1 ) { + return; + } - if ( isFunction ) { - val = value.call( this, i, self.val() ); - } else { - val = value; - } + if ( isFunction ) { + val = value.call( this, i, self.val() ); + } else { + val = value; + } - // Treat null/undefined as ""; convert numbers to string - if ( val == null ) { - val = ""; - } else if ( typeof val === "number" ) { - val += ""; - } else if ( jQuery.isArray( val ) ) { - val = jQuery.map(val, function ( value ) { - return value == null ? "" : value + ""; - }); - } + // Treat null/undefined as ""; convert numbers to string + if ( val == null ) { + val = ""; + } else if ( typeof val === "number" ) { + val += ""; + } else if ( jQuery.isArray( val ) ) { + val = jQuery.map(val, function ( value ) { + return value == null ? "" : value + ""; + }); + } - hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; + hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; - // If set returns undefined, fall back to normal setting - if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { - this.value = val; - } - }); - } + // If set returns undefined, fall back to normal setting + if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { + this.value = val; + } + }); + } }); jQuery.extend({ - valHooks: { - option: { - get: function( elem ) { - // attributes.value is undefined in Blackberry 4.7 but - // uses .value. See #6932 - var val = elem.attributes.value; - return !val || val.specified ? elem.value : elem.text; - } - }, - select: { - get: function( elem ) { - var value, option, - options = elem.options, - index = elem.selectedIndex, - one = elem.type === "select-one" || index < 0, - values = one ? null : [], - max = one ? index + 1 : options.length, - i = index < 0 ? - max : - one ? index : 0; + valHooks: { + option: { + get: function( elem ) { + // attributes.value is undefined in Blackberry 4.7 but + // uses .value. See #6932 + var val = elem.attributes.value; + return !val || val.specified ? elem.value : elem.text; + } + }, + select: { + get: function( elem ) { + var value, option, + options = elem.options, + index = elem.selectedIndex, + one = elem.type === "select-one" || index < 0, + values = one ? null : [], + max = one ? index + 1 : options.length, + i = index < 0 ? + max : + one ? index : 0; - // Loop through all the selected options - for ( ; i < max; i++ ) { - option = options[ i ]; + // Loop through all the selected options + for ( ; i < max; i++ ) { + option = options[ i ]; - // oldIE doesn't update selected after form reset (#2551) - if ( ( option.selected || i === index ) && - // Don't return options that are disabled or in a disabled optgroup - ( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) && - ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) { + // oldIE doesn't update selected after form reset (#2551) + if ( ( option.selected || i === index ) && + // Don't return options that are disabled or in a disabled optgroup + ( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) && + ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) { - // Get the specific value for the option - value = jQuery( option ).val(); + // Get the specific value for the option + value = jQuery( option ).val(); - // We don't need an array for one selects - if ( one ) { - return value; - } + // We don't need an array for one selects + if ( one ) { + return value; + } - // Multi-Selects return an array - values.push( value ); - } - } + // Multi-Selects return an array + values.push( value ); + } + } - return values; - }, + return values; + }, - set: function( elem, value ) { - var values = jQuery.makeArray( value ); + set: function( elem, value ) { + var values = jQuery.makeArray( value ); - jQuery(elem).find("option").each(function() { - this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; - }); + jQuery(elem).find("option").each(function() { + this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; + }); - if ( !values.length ) { - elem.selectedIndex = -1; - } - return values; - } - } - }, + if ( !values.length ) { + elem.selectedIndex = -1; + } + return values; + } + } + }, - // Unused in 1.8, left in so attrFn-stabbers won't die; remove in 1.9 - attrFn: {}, + // Unused in 1.8, left in so attrFn-stabbers won't die; remove in 1.9 + attrFn: {}, - attr: function( elem, name, value, pass ) { - var ret, hooks, notxml, - nType = elem.nodeType; + attr: function( elem, name, value, pass ) { + var ret, hooks, notxml, + nType = elem.nodeType; - // don't get/set attributes on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return; - } + // don't get/set attributes on text, comment and attribute nodes + if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { + return; + } - if ( pass && jQuery.isFunction( jQuery.fn[ name ] ) ) { - return jQuery( elem )[ name ]( value ); - } + if ( pass && jQuery.isFunction( jQuery.fn[ name ] ) ) { + return jQuery( elem )[ name ]( value ); + } - // Fallback to prop when attributes are not supported - if ( typeof elem.getAttribute === "undefined" ) { - return jQuery.prop( elem, name, value ); - } + // Fallback to prop when attributes are not supported + if ( typeof elem.getAttribute === "undefined" ) { + return jQuery.prop( elem, name, value ); + } - notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); + notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); - // All attributes are lowercase - // Grab necessary hook if one is defined - if ( notxml ) { - name = name.toLowerCase(); - hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook ); - } + // All attributes are lowercase + // Grab necessary hook if one is defined + if ( notxml ) { + name = name.toLowerCase(); + hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook ); + } - if ( value !== undefined ) { + if ( value !== undefined ) { - if ( value === null ) { - jQuery.removeAttr( elem, name ); - return; + if ( value === null ) { + jQuery.removeAttr( elem, name ); + return; - } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) { - return ret; + } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) { + return ret; - } else { - elem.setAttribute( name, value + "" ); - return value; - } + } else { + elem.setAttribute( name, value + "" ); + return value; + } - } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) { - return ret; + } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) { + return ret; - } else { + } else { - ret = elem.getAttribute( name ); + ret = elem.getAttribute( name ); - // Non-existent attributes return null, we normalize to undefined - return ret === null ? - undefined : - ret; - } - }, + // Non-existent attributes return null, we normalize to undefined + return ret === null ? + undefined : + ret; + } + }, - removeAttr: function( elem, value ) { - var propName, attrNames, name, isBool, - i = 0; + removeAttr: function( elem, value ) { + var propName, attrNames, name, isBool, + i = 0; - if ( value && elem.nodeType === 1 ) { + if ( value && elem.nodeType === 1 ) { - attrNames = value.split( core_rspace ); + attrNames = value.split( core_rspace ); - for ( ; i < attrNames.length; i++ ) { - name = attrNames[ i ]; + for ( ; i < attrNames.length; i++ ) { + name = attrNames[ i ]; - if ( name ) { - propName = jQuery.propFix[ name ] || name; - isBool = rboolean.test( name ); + if ( name ) { + propName = jQuery.propFix[ name ] || name; + isBool = rboolean.test( name ); - // See #9699 for explanation of this approach (setting first, then removal) - // Do not do this for boolean attributes (see #10870) - if ( !isBool ) { - jQuery.attr( elem, name, "" ); - } - elem.removeAttribute( getSetAttribute ? name : propName ); + // See #9699 for explanation of this approach (setting first, then removal) + // Do not do this for boolean attributes (see #10870) + if ( !isBool ) { + jQuery.attr( elem, name, "" ); + } + elem.removeAttribute( getSetAttribute ? name : propName ); - // Set corresponding property to false for boolean attributes - if ( isBool && propName in elem ) { - elem[ propName ] = false; - } - } - } - } - }, + // Set corresponding property to false for boolean attributes + if ( isBool && propName in elem ) { + elem[ propName ] = false; + } + } + } + } + }, - attrHooks: { - type: { - set: function( elem, value ) { - // We can't allow the type property to be changed (since it causes problems in IE) - if ( rtype.test( elem.nodeName ) && elem.parentNode ) { - jQuery.error( "type property can't be changed" ); - } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { - // Setting the type on a radio button after the value resets the value in IE6-9 - // Reset value to it's default in case type is set after value - // This is for element creation - var val = elem.value; - elem.setAttribute( "type", value ); - if ( val ) { - elem.value = val; - } - return value; - } - } - }, - // Use the value property for back compat - // Use the nodeHook for button elements in IE6/7 (#1954) - value: { - get: function( elem, name ) { - if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { - return nodeHook.get( elem, name ); - } - return name in elem ? - elem.value : - null; - }, - set: function( elem, value, name ) { - if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { - return nodeHook.set( elem, value, name ); - } - // Does not return so that setAttribute is also used - elem.value = value; - } - } - }, + attrHooks: { + type: { + set: function( elem, value ) { + // We can't allow the type property to be changed (since it causes problems in IE) + if ( rtype.test( elem.nodeName ) && elem.parentNode ) { + jQuery.error( "type property can't be changed" ); + } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { + // Setting the type on a radio button after the value resets the value in IE6-9 + // Reset value to it's default in case type is set after value + // This is for element creation + var val = elem.value; + elem.setAttribute( "type", value ); + if ( val ) { + elem.value = val; + } + return value; + } + } + }, + // Use the value property for back compat + // Use the nodeHook for button elements in IE6/7 (#1954) + value: { + get: function( elem, name ) { + if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { + return nodeHook.get( elem, name ); + } + return name in elem ? + elem.value : + null; + }, + set: function( elem, value, name ) { + if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { + return nodeHook.set( elem, value, name ); + } + // Does not return so that setAttribute is also used + elem.value = value; + } + } + }, - propFix: { - tabindex: "tabIndex", - readonly: "readOnly", - "for": "htmlFor", - "class": "className", - maxlength: "maxLength", - cellspacing: "cellSpacing", - cellpadding: "cellPadding", - rowspan: "rowSpan", - colspan: "colSpan", - usemap: "useMap", - frameborder: "frameBorder", - contenteditable: "contentEditable" - }, + propFix: { + tabindex: "tabIndex", + readonly: "readOnly", + "for": "htmlFor", + "class": "className", + maxlength: "maxLength", + cellspacing: "cellSpacing", + cellpadding: "cellPadding", + rowspan: "rowSpan", + colspan: "colSpan", + usemap: "useMap", + frameborder: "frameBorder", + contenteditable: "contentEditable" + }, - prop: function( elem, name, value ) { - var ret, hooks, notxml, - nType = elem.nodeType; + prop: function( elem, name, value ) { + var ret, hooks, notxml, + nType = elem.nodeType; - // don't get/set properties on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return; - } + // don't get/set properties on text, comment and attribute nodes + if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { + return; + } - notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); + notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); - if ( notxml ) { - // Fix name and attach hooks - name = jQuery.propFix[ name ] || name; - hooks = jQuery.propHooks[ name ]; - } + if ( notxml ) { + // Fix name and attach hooks + name = jQuery.propFix[ name ] || name; + hooks = jQuery.propHooks[ name ]; + } - if ( value !== undefined ) { - if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { - return ret; + if ( value !== undefined ) { + if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { + return ret; - } else { - return ( elem[ name ] = value ); - } + } else { + return ( elem[ name ] = value ); + } - } else { - if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { - return ret; + } else { + if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { + return ret; - } else { - return elem[ name ]; - } - } - }, + } else { + return elem[ name ]; + } + } + }, - propHooks: { - tabIndex: { - get: function( elem ) { - // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set - // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ - var attributeNode = elem.getAttributeNode("tabindex"); + propHooks: { + tabIndex: { + get: function( elem ) { + // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set + // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ + var attributeNode = elem.getAttributeNode("tabindex"); - return attributeNode && attributeNode.specified ? - parseInt( attributeNode.value, 10 ) : - rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? - 0 : - undefined; - } - } - } + return attributeNode && attributeNode.specified ? + parseInt( attributeNode.value, 10 ) : + rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? + 0 : + undefined; + } + } + } }); // Hook for boolean attributes boolHook = { - get: function( elem, name ) { - // Align boolean attributes with corresponding properties - // Fall back to attribute presence where some booleans are not supported - var attrNode, - property = jQuery.prop( elem, name ); - return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ? - name.toLowerCase() : - undefined; - }, - set: function( elem, value, name ) { - var propName; - if ( value === false ) { - // Remove boolean attributes when set to false - jQuery.removeAttr( elem, name ); - } else { - // value is true since we know at this point it's type boolean and not false - // Set boolean attributes to the same name and set the DOM property - propName = jQuery.propFix[ name ] || name; - if ( propName in elem ) { - // Only set the IDL specifically if it already exists on the element - elem[ propName ] = true; - } + get: function( elem, name ) { + // Align boolean attributes with corresponding properties + // Fall back to attribute presence where some booleans are not supported + var attrNode, + property = jQuery.prop( elem, name ); + return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ? + name.toLowerCase() : + undefined; + }, + set: function( elem, value, name ) { + var propName; + if ( value === false ) { + // Remove boolean attributes when set to false + jQuery.removeAttr( elem, name ); + } else { + // value is true since we know at this point it's type boolean and not false + // Set boolean attributes to the same name and set the DOM property + propName = jQuery.propFix[ name ] || name; + if ( propName in elem ) { + // Only set the IDL specifically if it already exists on the element + elem[ propName ] = true; + } - elem.setAttribute( name, name.toLowerCase() ); - } - return name; - } + elem.setAttribute( name, name.toLowerCase() ); + } + return name; + } }; // IE6/7 do not support getting/setting some attributes with get/setAttribute if ( !getSetAttribute ) { - fixSpecified = { - name: true, - id: true, - coords: true - }; + fixSpecified = { + name: true, + id: true, + coords: true + }; - // Use this for any attribute in IE6/7 - // This fixes almost every IE6/7 issue - nodeHook = jQuery.valHooks.button = { - get: function( elem, name ) { - var ret; - ret = elem.getAttributeNode( name ); - return ret && ( fixSpecified[ name ] ? ret.value !== "" : ret.specified ) ? - ret.value : - undefined; - }, - set: function( elem, value, name ) { - // Set the existing or create a new attribute node - var ret = elem.getAttributeNode( name ); - if ( !ret ) { - ret = document.createAttribute( name ); - elem.setAttributeNode( ret ); - } - return ( ret.value = value + "" ); - } - }; + // Use this for any attribute in IE6/7 + // This fixes almost every IE6/7 issue + nodeHook = jQuery.valHooks.button = { + get: function( elem, name ) { + var ret; + ret = elem.getAttributeNode( name ); + return ret && ( fixSpecified[ name ] ? ret.value !== "" : ret.specified ) ? + ret.value : + undefined; + }, + set: function( elem, value, name ) { + // Set the existing or create a new attribute node + var ret = elem.getAttributeNode( name ); + if ( !ret ) { + ret = document.createAttribute( name ); + elem.setAttributeNode( ret ); + } + return ( ret.value = value + "" ); + } + }; - // Set width and height to auto instead of 0 on empty string( Bug #8150 ) - // This is for removals - jQuery.each([ "width", "height" ], function( i, name ) { - jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { - set: function( elem, value ) { - if ( value === "" ) { - elem.setAttribute( name, "auto" ); - return value; - } - } - }); - }); + // Set width and height to auto instead of 0 on empty string( Bug #8150 ) + // This is for removals + jQuery.each([ "width", "height" ], function( i, name ) { + jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { + set: function( elem, value ) { + if ( value === "" ) { + elem.setAttribute( name, "auto" ); + return value; + } + } + }); + }); - // Set contenteditable to false on removals(#10429) - // Setting to empty string throws an error as an invalid value - jQuery.attrHooks.contenteditable = { - get: nodeHook.get, - set: function( elem, value, name ) { - if ( value === "" ) { - value = "false"; - } - nodeHook.set( elem, value, name ); - } - }; + // Set contenteditable to false on removals(#10429) + // Setting to empty string throws an error as an invalid value + jQuery.attrHooks.contenteditable = { + get: nodeHook.get, + set: function( elem, value, name ) { + if ( value === "" ) { + value = "false"; + } + nodeHook.set( elem, value, name ); + } + }; } // Some attributes require a special call on IE if ( !jQuery.support.hrefNormalized ) { - jQuery.each([ "href", "src", "width", "height" ], function( i, name ) { - jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { - get: function( elem ) { - var ret = elem.getAttribute( name, 2 ); - return ret === null ? undefined : ret; - } - }); - }); + jQuery.each([ "href", "src", "width", "height" ], function( i, name ) { + jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { + get: function( elem ) { + var ret = elem.getAttribute( name, 2 ); + return ret === null ? undefined : ret; + } + }); + }); } if ( !jQuery.support.style ) { - jQuery.attrHooks.style = { - get: function( elem ) { - // Return undefined in the case of empty string - // Normalize to lowercase since IE uppercases css property names - return elem.style.cssText.toLowerCase() || undefined; - }, - set: function( elem, value ) { - return ( elem.style.cssText = value + "" ); - } - }; + jQuery.attrHooks.style = { + get: function( elem ) { + // Return undefined in the case of empty string + // Normalize to lowercase since IE uppercases css property names + return elem.style.cssText.toLowerCase() || undefined; + }, + set: function( elem, value ) { + return ( elem.style.cssText = value + "" ); + } + }; } // Safari mis-reports the default selected property of an option // Accessing the parent's selectedIndex property fixes it if ( !jQuery.support.optSelected ) { - jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, { - get: function( elem ) { - var parent = elem.parentNode; + jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, { + get: function( elem ) { + var parent = elem.parentNode; - if ( parent ) { - parent.selectedIndex; + if ( parent ) { + parent.selectedIndex; - // Make sure that it also works with optgroups, see #5701 - if ( parent.parentNode ) { - parent.parentNode.selectedIndex; - } - } - return null; - } - }); + // Make sure that it also works with optgroups, see #5701 + if ( parent.parentNode ) { + parent.parentNode.selectedIndex; + } + } + return null; + } + }); } // IE6/7 call enctype encoding if ( !jQuery.support.enctype ) { - jQuery.propFix.enctype = "encoding"; + jQuery.propFix.enctype = "encoding"; } // Radios and checkboxes getter/setter if ( !jQuery.support.checkOn ) { - jQuery.each([ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = { - get: function( elem ) { - // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified - return elem.getAttribute("value") === null ? "on" : elem.value; - } - }; - }); + jQuery.each([ "radio", "checkbox" ], function() { + jQuery.valHooks[ this ] = { + get: function( elem ) { + // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified + return elem.getAttribute("value") === null ? "on" : elem.value; + } + }; + }); } jQuery.each([ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], { - set: function( elem, value ) { - if ( jQuery.isArray( value ) ) { - return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); - } - } - }); + jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], { + set: function( elem, value ) { + if ( jQuery.isArray( value ) ) { + return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); + } + } + }); }); var rformElems = /^(?:textarea|input|select)$/i, - rtypenamespace = /^([^\.]*|)(?:\.(.+)|)$/, - rhoverHack = /(?:^|\s)hover(\.\S+|)\b/, - rkeyEvent = /^key/, - rmouseEvent = /^(?:mouse|contextmenu)|click/, - rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, - hoverHack = function( events ) { - return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" ); - }; + rtypenamespace = /^([^\.]*|)(?:\.(.+)|)$/, + rhoverHack = /(?:^|\s)hover(\.\S+|)\b/, + rkeyEvent = /^key/, + rmouseEvent = /^(?:mouse|contextmenu)|click/, + rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, + hoverHack = function( events ) { + return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" ); + }; /* * Helper functions for managing events -- not part of the public interface. @@ -2639,578 +2639,578 @@ var rformElems = /^(?:textarea|input|select)$/i, */ jQuery.event = { - add: function( elem, types, handler, data, selector ) { - - var elemData, eventHandle, events, - t, tns, type, namespaces, handleObj, - handleObjIn, handlers, special; - - // Don't attach events to noData or text/comment nodes (allow plain objects tho) - if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) { - return; - } - - // Caller can pass in an object of custom data in lieu of the handler - if ( handler.handler ) { - handleObjIn = handler; - handler = handleObjIn.handler; - selector = handleObjIn.selector; - } - - // Make sure that the handler has a unique ID, used to find/remove it later - if ( !handler.guid ) { - handler.guid = jQuery.guid++; - } - - // Init the element's event structure and main handler, if this is the first - events = elemData.events; - if ( !events ) { - elemData.events = events = {}; - } - eventHandle = elemData.handle; - if ( !eventHandle ) { - elemData.handle = eventHandle = function( e ) { - // Discard the second event of a jQuery.event.trigger() and - // when an event is called after a page has unloaded - return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ? - jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : - undefined; - }; - // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events - eventHandle.elem = elem; - } - - // Handle multiple events separated by a space - // jQuery(...).bind("mouseover mouseout", fn); - types = jQuery.trim( hoverHack(types) ).split( " " ); - for ( t = 0; t < types.length; t++ ) { - - tns = rtypenamespace.exec( types[t] ) || []; - type = tns[1]; - namespaces = ( tns[2] || "" ).split( "." ).sort(); - - // If event changes its type, use the special event handlers for the changed type - special = jQuery.event.special[ type ] || {}; - - // If selector defined, determine special event api type, otherwise given type - type = ( selector ? special.delegateType : special.bindType ) || type; - - // Update special based on newly reset type - special = jQuery.event.special[ type ] || {}; - - // handleObj is passed to all event handlers - handleObj = jQuery.extend({ - type: type, - origType: tns[1], - data: data, - handler: handler, - guid: handler.guid, - selector: selector, - needsContext: selector && jQuery.expr.match.needsContext.test( selector ), - namespace: namespaces.join(".") - }, handleObjIn ); - - // Init the event handler queue if we're the first - handlers = events[ type ]; - if ( !handlers ) { - handlers = events[ type ] = []; - handlers.delegateCount = 0; - - // Only use addEventListener/attachEvent if the special events handler returns false - if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { - // Bind the global event handler to the element - if ( elem.addEventListener ) { - elem.addEventListener( type, eventHandle, false ); - - } else if ( elem.attachEvent ) { - elem.attachEvent( "on" + type, eventHandle ); - } - } - } - - if ( special.add ) { - special.add.call( elem, handleObj ); - - if ( !handleObj.handler.guid ) { - handleObj.handler.guid = handler.guid; - } - } - - // Add to the element's handler list, delegates in front - if ( selector ) { - handlers.splice( handlers.delegateCount++, 0, handleObj ); - } else { - handlers.push( handleObj ); - } - - // Keep track of which events have ever been used, for event optimization - jQuery.event.global[ type ] = true; - } - - // Nullify elem to prevent memory leaks in IE - elem = null; - }, - - global: {}, - - // Detach an event or set of events from an element - remove: function( elem, types, handler, selector, mappedTypes ) { - - var t, tns, type, origType, namespaces, origCount, - j, events, special, eventType, handleObj, - elemData = jQuery.hasData( elem ) && jQuery._data( elem ); - - if ( !elemData || !(events = elemData.events) ) { - return; - } - - // Once for each type.namespace in types; type may be omitted - types = jQuery.trim( hoverHack( types || "" ) ).split(" "); - for ( t = 0; t < types.length; t++ ) { - tns = rtypenamespace.exec( types[t] ) || []; - type = origType = tns[1]; - namespaces = tns[2]; - - // Unbind all events (on this namespace, if provided) for the element - if ( !type ) { - for ( type in events ) { - jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); - } - continue; - } - - special = jQuery.event.special[ type ] || {}; - type = ( selector? special.delegateType : special.bindType ) || type; - eventType = events[ type ] || []; - origCount = eventType.length; - namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.|)") + "(\\.|$)") : null; - - // Remove matching events - for ( j = 0; j < eventType.length; j++ ) { - handleObj = eventType[ j ]; - - if ( ( mappedTypes || origType === handleObj.origType ) && - ( !handler || handler.guid === handleObj.guid ) && - ( !namespaces || namespaces.test( handleObj.namespace ) ) && - ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { - eventType.splice( j--, 1 ); - - if ( handleObj.selector ) { - eventType.delegateCount--; - } - if ( special.remove ) { - special.remove.call( elem, handleObj ); - } - } - } - - // Remove generic event handler if we removed something and no more handlers exist - // (avoids potential for endless recursion during removal of special event handlers) - if ( eventType.length === 0 && origCount !== eventType.length ) { - if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) { - jQuery.removeEvent( elem, type, elemData.handle ); - } - - delete events[ type ]; - } - } - - // Remove the expando if it's no longer used - if ( jQuery.isEmptyObject( events ) ) { - delete elemData.handle; - - // removeData also checks for emptiness and clears the expando if empty - // so use it instead of delete - jQuery.removeData( elem, "events", true ); - } - }, - - // Events that are safe to short-circuit if no handlers are attached. - // Native DOM events should not be added, they may have inline handlers. - customEvent: { - "getData": true, - "setData": true, - "changeData": true - }, - - trigger: function( event, data, elem, onlyHandlers ) { - // Don't do events on text and comment nodes - if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) { - return; - } - - // Event object or event type - var cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType, - type = event.type || event, - namespaces = []; - - // focus/blur morphs to focusin/out; ensure we're not firing them right now - if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { - return; - } - - if ( type.indexOf( "!" ) >= 0 ) { - // Exclusive events trigger only for the exact event (no namespaces) - type = type.slice(0, -1); - exclusive = true; - } - - if ( type.indexOf( "." ) >= 0 ) { - // Namespaced trigger; create a regexp to match event type in handle() - namespaces = type.split("."); - type = namespaces.shift(); - namespaces.sort(); - } - - if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) { - // No jQuery handlers for this event type, and it can't have inline handlers - return; - } - - // Caller can pass in an Event, Object, or just an event type string - event = typeof event === "object" ? - // jQuery.Event object - event[ jQuery.expando ] ? event : - // Object literal - new jQuery.Event( type, event ) : - // Just the event type (string) - new jQuery.Event( type ); - - event.type = type; - event.isTrigger = true; - event.exclusive = exclusive; - event.namespace = namespaces.join( "." ); - event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null; - ontype = type.indexOf( ":" ) < 0 ? "on" + type : ""; - - // Handle a global trigger - if ( !elem ) { - - // TODO: Stop taunting the data cache; remove global events and always attach to document - cache = jQuery.cache; - for ( i in cache ) { - if ( cache[ i ].events && cache[ i ].events[ type ] ) { - jQuery.event.trigger( event, data, cache[ i ].handle.elem, true ); - } - } - return; - } - - // Clean up the event in case it is being reused - event.result = undefined; - if ( !event.target ) { - event.target = elem; - } - - // Clone any incoming data and prepend the event, creating the handler arg list - data = data != null ? jQuery.makeArray( data ) : []; - data.unshift( event ); - - // Allow special events to draw outside the lines - special = jQuery.event.special[ type ] || {}; - if ( special.trigger && special.trigger.apply( elem, data ) === false ) { - return; - } - - // Determine event propagation path in advance, per W3C events spec (#9951) - // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) - eventPath = [[ elem, special.bindType || type ]]; - if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { - - bubbleType = special.delegateType || type; - cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode; - for ( old = elem; cur; cur = cur.parentNode ) { - eventPath.push([ cur, bubbleType ]); - old = cur; - } - - // Only add window if we got to document (e.g., not plain obj or detached DOM) - if ( old === (elem.ownerDocument || document) ) { - eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]); - } - } - - // Fire handlers on the event path - for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) { - - cur = eventPath[i][0]; - event.type = eventPath[i][1]; - - handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); - if ( handle ) { - handle.apply( cur, data ); - } - // Note that this is a bare JS function and not a jQuery handler - handle = ontype && cur[ ontype ]; - if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) { - event.preventDefault(); - } - } - event.type = type; - - // If nobody prevented the default action, do it now - if ( !onlyHandlers && !event.isDefaultPrevented() ) { - - if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) && - !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) { - - // Call a native DOM method on the target with the same name name as the event. - // Can't use an .isFunction() check here because IE6/7 fails that test. - // Don't do default actions on window, that's where global variables be (#6170) - // IE<9 dies on focus/blur to hidden element (#1486) - if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) { - - // Don't re-trigger an onFOO event when we call its FOO() method - old = elem[ ontype ]; - - if ( old ) { - elem[ ontype ] = null; - } - - // Prevent re-triggering of the same event, since we already bubbled it above - jQuery.event.triggered = type; - elem[ type ](); - jQuery.event.triggered = undefined; - - if ( old ) { - elem[ ontype ] = old; - } - } - } - } - - return event.result; - }, - - dispatch: function( event ) { - - // Make a writable jQuery.Event from the native event object - event = jQuery.event.fix( event || window.event ); - - var i, j, cur, ret, selMatch, matched, matches, handleObj, sel, related, - handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []), - delegateCount = handlers.delegateCount, - args = core_slice.call( arguments ), - run_all = !event.exclusive && !event.namespace, - special = jQuery.event.special[ event.type ] || {}, - handlerQueue = []; - - // Use the fix-ed jQuery.Event rather than the (read-only) native event - args[0] = event; - event.delegateTarget = this; - - // Call the preDispatch hook for the mapped type, and let it bail if desired - if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { - return; - } - - // Determine handlers that should run if there are delegated events - // Avoid non-left-click bubbling in Firefox (#3861) - if ( delegateCount && !(event.button && event.type === "click") ) { - - for ( cur = event.target; cur != this; cur = cur.parentNode || this ) { - - // Don't process clicks (ONLY) on disabled elements (#6911, #8165, #11382, #11764) - if ( cur.disabled !== true || event.type !== "click" ) { - selMatch = {}; - matches = []; - for ( i = 0; i < delegateCount; i++ ) { - handleObj = handlers[ i ]; - sel = handleObj.selector; - - if ( selMatch[ sel ] === undefined ) { - selMatch[ sel ] = handleObj.needsContext ? - jQuery( sel, this ).index( cur ) >= 0 : - jQuery.find( sel, this, null, [ cur ] ).length; - } - if ( selMatch[ sel ] ) { - matches.push( handleObj ); - } - } - if ( matches.length ) { - handlerQueue.push({ elem: cur, matches: matches }); - } - } - } - } - - // Add the remaining (directly-bound) handlers - if ( handlers.length > delegateCount ) { - handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) }); - } - - // Run delegates first; they may want to stop propagation beneath us - for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) { - matched = handlerQueue[ i ]; - event.currentTarget = matched.elem; - - for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) { - handleObj = matched.matches[ j ]; - - // Triggered event must either 1) be non-exclusive and have no namespace, or - // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). - if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) { - - event.data = handleObj.data; - event.handleObj = handleObj; - - ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) - .apply( matched.elem, args ); - - if ( ret !== undefined ) { - event.result = ret; - if ( ret === false ) { - event.preventDefault(); - event.stopPropagation(); - } - } - } - } - } - - // Call the postDispatch hook for the mapped type - if ( special.postDispatch ) { - special.postDispatch.call( this, event ); - } - - return event.result; - }, - - // Includes some event props shared by KeyEvent and MouseEvent - // *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 *** - props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), - - fixHooks: {}, - - keyHooks: { - props: "char charCode key keyCode".split(" "), - filter: function( event, original ) { - - // Add which for key events - if ( event.which == null ) { - event.which = original.charCode != null ? original.charCode : original.keyCode; - } - - return event; - } - }, - - mouseHooks: { - props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), - filter: function( event, original ) { - var eventDoc, doc, body, - button = original.button, - fromElement = original.fromElement; - - // Calculate pageX/Y if missing and clientX/Y available - if ( event.pageX == null && original.clientX != null ) { - eventDoc = event.target.ownerDocument || document; - doc = eventDoc.documentElement; - body = eventDoc.body; - - event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); - event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); - } - - // Add relatedTarget, if necessary - if ( !event.relatedTarget && fromElement ) { - event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; - } - - // Add which for click: 1 === left; 2 === middle; 3 === right - // Note: button is not normalized, so don't use it - if ( !event.which && button !== undefined ) { - event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); - } - - return event; - } - }, - - fix: function( event ) { - if ( event[ jQuery.expando ] ) { - return event; - } - - // Create a writable copy of the event object and normalize some properties - var i, prop, - originalEvent = event, - fixHook = jQuery.event.fixHooks[ event.type ] || {}, - copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; - - event = jQuery.Event( originalEvent ); - - for ( i = copy.length; i; ) { - prop = copy[ --i ]; - event[ prop ] = originalEvent[ prop ]; - } - - // Fix target property, if necessary (#1925, IE 6/7/8 & Safari2) - if ( !event.target ) { - event.target = originalEvent.srcElement || document; - } - - // Target should not be a text node (#504, Safari) - if ( event.target.nodeType === 3 ) { - event.target = event.target.parentNode; - } - - // For mouse/key events, metaKey==false if it's undefined (#3368, #11328; IE6/7/8) - event.metaKey = !!event.metaKey; - - return fixHook.filter? fixHook.filter( event, originalEvent ) : event; - }, - - special: { - load: { - // Prevent triggered image.load events from bubbling to window.load - noBubble: true - }, - - focus: { - delegateType: "focusin" - }, - blur: { - delegateType: "focusout" - }, - - beforeunload: { - setup: function( data, namespaces, eventHandle ) { - // We only want to do this special case on windows - if ( jQuery.isWindow( this ) ) { - this.onbeforeunload = eventHandle; - } - }, - - teardown: function( namespaces, eventHandle ) { - if ( this.onbeforeunload === eventHandle ) { - this.onbeforeunload = null; - } - } - } - }, - - simulate: function( type, elem, event, bubble ) { - // Piggyback on a donor event to simulate a different one. - // Fake originalEvent to avoid donor's stopPropagation, but if the - // simulated event prevents default then we do the same on the donor. - var e = jQuery.extend( - new jQuery.Event(), - event, - { type: type, - isSimulated: true, - originalEvent: {} - } - ); - if ( bubble ) { - jQuery.event.trigger( e, null, elem ); - } else { - jQuery.event.dispatch.call( elem, e ); - } - if ( e.isDefaultPrevented() ) { - event.preventDefault(); - } - } + add: function( elem, types, handler, data, selector ) { + + var elemData, eventHandle, events, + t, tns, type, namespaces, handleObj, + handleObjIn, handlers, special; + + // Don't attach events to noData or text/comment nodes (allow plain objects tho) + if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) { + return; + } + + // Caller can pass in an object of custom data in lieu of the handler + if ( handler.handler ) { + handleObjIn = handler; + handler = handleObjIn.handler; + selector = handleObjIn.selector; + } + + // Make sure that the handler has a unique ID, used to find/remove it later + if ( !handler.guid ) { + handler.guid = jQuery.guid++; + } + + // Init the element's event structure and main handler, if this is the first + events = elemData.events; + if ( !events ) { + elemData.events = events = {}; + } + eventHandle = elemData.handle; + if ( !eventHandle ) { + elemData.handle = eventHandle = function( e ) { + // Discard the second event of a jQuery.event.trigger() and + // when an event is called after a page has unloaded + return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ? + jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : + undefined; + }; + // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events + eventHandle.elem = elem; + } + + // Handle multiple events separated by a space + // jQuery(...).bind("mouseover mouseout", fn); + types = jQuery.trim( hoverHack(types) ).split( " " ); + for ( t = 0; t < types.length; t++ ) { + + tns = rtypenamespace.exec( types[t] ) || []; + type = tns[1]; + namespaces = ( tns[2] || "" ).split( "." ).sort(); + + // If event changes its type, use the special event handlers for the changed type + special = jQuery.event.special[ type ] || {}; + + // If selector defined, determine special event api type, otherwise given type + type = ( selector ? special.delegateType : special.bindType ) || type; + + // Update special based on newly reset type + special = jQuery.event.special[ type ] || {}; + + // handleObj is passed to all event handlers + handleObj = jQuery.extend({ + type: type, + origType: tns[1], + data: data, + handler: handler, + guid: handler.guid, + selector: selector, + needsContext: selector && jQuery.expr.match.needsContext.test( selector ), + namespace: namespaces.join(".") + }, handleObjIn ); + + // Init the event handler queue if we're the first + handlers = events[ type ]; + if ( !handlers ) { + handlers = events[ type ] = []; + handlers.delegateCount = 0; + + // Only use addEventListener/attachEvent if the special events handler returns false + if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { + // Bind the global event handler to the element + if ( elem.addEventListener ) { + elem.addEventListener( type, eventHandle, false ); + + } else if ( elem.attachEvent ) { + elem.attachEvent( "on" + type, eventHandle ); + } + } + } + + if ( special.add ) { + special.add.call( elem, handleObj ); + + if ( !handleObj.handler.guid ) { + handleObj.handler.guid = handler.guid; + } + } + + // Add to the element's handler list, delegates in front + if ( selector ) { + handlers.splice( handlers.delegateCount++, 0, handleObj ); + } else { + handlers.push( handleObj ); + } + + // Keep track of which events have ever been used, for event optimization + jQuery.event.global[ type ] = true; + } + + // Nullify elem to prevent memory leaks in IE + elem = null; + }, + + global: {}, + + // Detach an event or set of events from an element + remove: function( elem, types, handler, selector, mappedTypes ) { + + var t, tns, type, origType, namespaces, origCount, + j, events, special, eventType, handleObj, + elemData = jQuery.hasData( elem ) && jQuery._data( elem ); + + if ( !elemData || !(events = elemData.events) ) { + return; + } + + // Once for each type.namespace in types; type may be omitted + types = jQuery.trim( hoverHack( types || "" ) ).split(" "); + for ( t = 0; t < types.length; t++ ) { + tns = rtypenamespace.exec( types[t] ) || []; + type = origType = tns[1]; + namespaces = tns[2]; + + // Unbind all events (on this namespace, if provided) for the element + if ( !type ) { + for ( type in events ) { + jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); + } + continue; + } + + special = jQuery.event.special[ type ] || {}; + type = ( selector? special.delegateType : special.bindType ) || type; + eventType = events[ type ] || []; + origCount = eventType.length; + namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.|)") + "(\\.|$)") : null; + + // Remove matching events + for ( j = 0; j < eventType.length; j++ ) { + handleObj = eventType[ j ]; + + if ( ( mappedTypes || origType === handleObj.origType ) && + ( !handler || handler.guid === handleObj.guid ) && + ( !namespaces || namespaces.test( handleObj.namespace ) ) && + ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { + eventType.splice( j--, 1 ); + + if ( handleObj.selector ) { + eventType.delegateCount--; + } + if ( special.remove ) { + special.remove.call( elem, handleObj ); + } + } + } + + // Remove generic event handler if we removed something and no more handlers exist + // (avoids potential for endless recursion during removal of special event handlers) + if ( eventType.length === 0 && origCount !== eventType.length ) { + if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) { + jQuery.removeEvent( elem, type, elemData.handle ); + } + + delete events[ type ]; + } + } + + // Remove the expando if it's no longer used + if ( jQuery.isEmptyObject( events ) ) { + delete elemData.handle; + + // removeData also checks for emptiness and clears the expando if empty + // so use it instead of delete + jQuery.removeData( elem, "events", true ); + } + }, + + // Events that are safe to short-circuit if no handlers are attached. + // Native DOM events should not be added, they may have inline handlers. + customEvent: { + "getData": true, + "setData": true, + "changeData": true + }, + + trigger: function( event, data, elem, onlyHandlers ) { + // Don't do events on text and comment nodes + if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) { + return; + } + + // Event object or event type + var cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType, + type = event.type || event, + namespaces = []; + + // focus/blur morphs to focusin/out; ensure we're not firing them right now + if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { + return; + } + + if ( type.indexOf( "!" ) >= 0 ) { + // Exclusive events trigger only for the exact event (no namespaces) + type = type.slice(0, -1); + exclusive = true; + } + + if ( type.indexOf( "." ) >= 0 ) { + // Namespaced trigger; create a regexp to match event type in handle() + namespaces = type.split("."); + type = namespaces.shift(); + namespaces.sort(); + } + + if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) { + // No jQuery handlers for this event type, and it can't have inline handlers + return; + } + + // Caller can pass in an Event, Object, or just an event type string + event = typeof event === "object" ? + // jQuery.Event object + event[ jQuery.expando ] ? event : + // Object literal + new jQuery.Event( type, event ) : + // Just the event type (string) + new jQuery.Event( type ); + + event.type = type; + event.isTrigger = true; + event.exclusive = exclusive; + event.namespace = namespaces.join( "." ); + event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null; + ontype = type.indexOf( ":" ) < 0 ? "on" + type : ""; + + // Handle a global trigger + if ( !elem ) { + + // TODO: Stop taunting the data cache; remove global events and always attach to document + cache = jQuery.cache; + for ( i in cache ) { + if ( cache[ i ].events && cache[ i ].events[ type ] ) { + jQuery.event.trigger( event, data, cache[ i ].handle.elem, true ); + } + } + return; + } + + // Clean up the event in case it is being reused + event.result = undefined; + if ( !event.target ) { + event.target = elem; + } + + // Clone any incoming data and prepend the event, creating the handler arg list + data = data != null ? jQuery.makeArray( data ) : []; + data.unshift( event ); + + // Allow special events to draw outside the lines + special = jQuery.event.special[ type ] || {}; + if ( special.trigger && special.trigger.apply( elem, data ) === false ) { + return; + } + + // Determine event propagation path in advance, per W3C events spec (#9951) + // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) + eventPath = [[ elem, special.bindType || type ]]; + if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { + + bubbleType = special.delegateType || type; + cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode; + for ( old = elem; cur; cur = cur.parentNode ) { + eventPath.push([ cur, bubbleType ]); + old = cur; + } + + // Only add window if we got to document (e.g., not plain obj or detached DOM) + if ( old === (elem.ownerDocument || document) ) { + eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]); + } + } + + // Fire handlers on the event path + for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) { + + cur = eventPath[i][0]; + event.type = eventPath[i][1]; + + handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); + if ( handle ) { + handle.apply( cur, data ); + } + // Note that this is a bare JS function and not a jQuery handler + handle = ontype && cur[ ontype ]; + if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) { + event.preventDefault(); + } + } + event.type = type; + + // If nobody prevented the default action, do it now + if ( !onlyHandlers && !event.isDefaultPrevented() ) { + + if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) && + !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) { + + // Call a native DOM method on the target with the same name name as the event. + // Can't use an .isFunction() check here because IE6/7 fails that test. + // Don't do default actions on window, that's where global variables be (#6170) + // IE<9 dies on focus/blur to hidden element (#1486) + if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) { + + // Don't re-trigger an onFOO event when we call its FOO() method + old = elem[ ontype ]; + + if ( old ) { + elem[ ontype ] = null; + } + + // Prevent re-triggering of the same event, since we already bubbled it above + jQuery.event.triggered = type; + elem[ type ](); + jQuery.event.triggered = undefined; + + if ( old ) { + elem[ ontype ] = old; + } + } + } + } + + return event.result; + }, + + dispatch: function( event ) { + + // Make a writable jQuery.Event from the native event object + event = jQuery.event.fix( event || window.event ); + + var i, j, cur, ret, selMatch, matched, matches, handleObj, sel, related, + handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []), + delegateCount = handlers.delegateCount, + args = core_slice.call( arguments ), + run_all = !event.exclusive && !event.namespace, + special = jQuery.event.special[ event.type ] || {}, + handlerQueue = []; + + // Use the fix-ed jQuery.Event rather than the (read-only) native event + args[0] = event; + event.delegateTarget = this; + + // Call the preDispatch hook for the mapped type, and let it bail if desired + if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { + return; + } + + // Determine handlers that should run if there are delegated events + // Avoid non-left-click bubbling in Firefox (#3861) + if ( delegateCount && !(event.button && event.type === "click") ) { + + for ( cur = event.target; cur != this; cur = cur.parentNode || this ) { + + // Don't process clicks (ONLY) on disabled elements (#6911, #8165, #11382, #11764) + if ( cur.disabled !== true || event.type !== "click" ) { + selMatch = {}; + matches = []; + for ( i = 0; i < delegateCount; i++ ) { + handleObj = handlers[ i ]; + sel = handleObj.selector; + + if ( selMatch[ sel ] === undefined ) { + selMatch[ sel ] = handleObj.needsContext ? + jQuery( sel, this ).index( cur ) >= 0 : + jQuery.find( sel, this, null, [ cur ] ).length; + } + if ( selMatch[ sel ] ) { + matches.push( handleObj ); + } + } + if ( matches.length ) { + handlerQueue.push({ elem: cur, matches: matches }); + } + } + } + } + + // Add the remaining (directly-bound) handlers + if ( handlers.length > delegateCount ) { + handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) }); + } + + // Run delegates first; they may want to stop propagation beneath us + for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) { + matched = handlerQueue[ i ]; + event.currentTarget = matched.elem; + + for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) { + handleObj = matched.matches[ j ]; + + // Triggered event must either 1) be non-exclusive and have no namespace, or + // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). + if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) { + + event.data = handleObj.data; + event.handleObj = handleObj; + + ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) + .apply( matched.elem, args ); + + if ( ret !== undefined ) { + event.result = ret; + if ( ret === false ) { + event.preventDefault(); + event.stopPropagation(); + } + } + } + } + } + + // Call the postDispatch hook for the mapped type + if ( special.postDispatch ) { + special.postDispatch.call( this, event ); + } + + return event.result; + }, + + // Includes some event props shared by KeyEvent and MouseEvent + // *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 *** + props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), + + fixHooks: {}, + + keyHooks: { + props: "char charCode key keyCode".split(" "), + filter: function( event, original ) { + + // Add which for key events + if ( event.which == null ) { + event.which = original.charCode != null ? original.charCode : original.keyCode; + } + + return event; + } + }, + + mouseHooks: { + props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), + filter: function( event, original ) { + var eventDoc, doc, body, + button = original.button, + fromElement = original.fromElement; + + // Calculate pageX/Y if missing and clientX/Y available + if ( event.pageX == null && original.clientX != null ) { + eventDoc = event.target.ownerDocument || document; + doc = eventDoc.documentElement; + body = eventDoc.body; + + event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); + event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); + } + + // Add relatedTarget, if necessary + if ( !event.relatedTarget && fromElement ) { + event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; + } + + // Add which for click: 1 === left; 2 === middle; 3 === right + // Note: button is not normalized, so don't use it + if ( !event.which && button !== undefined ) { + event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); + } + + return event; + } + }, + + fix: function( event ) { + if ( event[ jQuery.expando ] ) { + return event; + } + + // Create a writable copy of the event object and normalize some properties + var i, prop, + originalEvent = event, + fixHook = jQuery.event.fixHooks[ event.type ] || {}, + copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; + + event = jQuery.Event( originalEvent ); + + for ( i = copy.length; i; ) { + prop = copy[ --i ]; + event[ prop ] = originalEvent[ prop ]; + } + + // Fix target property, if necessary (#1925, IE 6/7/8 & Safari2) + if ( !event.target ) { + event.target = originalEvent.srcElement || document; + } + + // Target should not be a text node (#504, Safari) + if ( event.target.nodeType === 3 ) { + event.target = event.target.parentNode; + } + + // For mouse/key events, metaKey==false if it's undefined (#3368, #11328; IE6/7/8) + event.metaKey = !!event.metaKey; + + return fixHook.filter? fixHook.filter( event, originalEvent ) : event; + }, + + special: { + load: { + // Prevent triggered image.load events from bubbling to window.load + noBubble: true + }, + + focus: { + delegateType: "focusin" + }, + blur: { + delegateType: "focusout" + }, + + beforeunload: { + setup: function( data, namespaces, eventHandle ) { + // We only want to do this special case on windows + if ( jQuery.isWindow( this ) ) { + this.onbeforeunload = eventHandle; + } + }, + + teardown: function( namespaces, eventHandle ) { + if ( this.onbeforeunload === eventHandle ) { + this.onbeforeunload = null; + } + } + } + }, + + simulate: function( type, elem, event, bubble ) { + // Piggyback on a donor event to simulate a different one. + // Fake originalEvent to avoid donor's stopPropagation, but if the + // simulated event prevents default then we do the same on the donor. + var e = jQuery.extend( + new jQuery.Event(), + event, + { type: type, + isSimulated: true, + originalEvent: {} + } + ); + if ( bubble ) { + jQuery.event.trigger( e, null, elem ); + } else { + jQuery.event.dispatch.call( elem, e ); + } + if ( e.isDefaultPrevented() ) { + event.preventDefault(); + } + } }; // Some plugins are using, but it's undocumented/deprecated and will be removed. @@ -3218,447 +3218,447 @@ jQuery.event = { jQuery.event.handle = jQuery.event.dispatch; jQuery.removeEvent = document.removeEventListener ? - function( elem, type, handle ) { - if ( elem.removeEventListener ) { - elem.removeEventListener( type, handle, false ); - } - } : - function( elem, type, handle ) { - var name = "on" + type; + function( elem, type, handle ) { + if ( elem.removeEventListener ) { + elem.removeEventListener( type, handle, false ); + } + } : + function( elem, type, handle ) { + var name = "on" + type; - if ( elem.detachEvent ) { + if ( elem.detachEvent ) { - // #8545, #7054, preventing memory leaks for custom events in IE6-8 - // detachEvent needed property on element, by name of that event, to properly expose it to GC - if ( typeof elem[ name ] === "undefined" ) { - elem[ name ] = null; - } + // #8545, #7054, preventing memory leaks for custom events in IE6-8 + // detachEvent needed property on element, by name of that event, to properly expose it to GC + if ( typeof elem[ name ] === "undefined" ) { + elem[ name ] = null; + } - elem.detachEvent( name, handle ); - } - }; + elem.detachEvent( name, handle ); + } + }; jQuery.Event = function( src, props ) { - // Allow instantiation without the 'new' keyword - if ( !(this instanceof jQuery.Event) ) { - return new jQuery.Event( src, props ); - } + // Allow instantiation without the 'new' keyword + if ( !(this instanceof jQuery.Event) ) { + return new jQuery.Event( src, props ); + } - // Event object - if ( src && src.type ) { - this.originalEvent = src; - this.type = src.type; + // Event object + if ( src && src.type ) { + this.originalEvent = src; + this.type = src.type; - // Events bubbling up the document may have been marked as prevented - // by a handler lower down the tree; reflect the correct value. - this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false || - src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; + // Events bubbling up the document may have been marked as prevented + // by a handler lower down the tree; reflect the correct value. + this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false || + src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; - // Event type - } else { - this.type = src; - } + // Event type + } else { + this.type = src; + } - // Put explicitly provided properties onto the event object - if ( props ) { - jQuery.extend( this, props ); - } + // Put explicitly provided properties onto the event object + if ( props ) { + jQuery.extend( this, props ); + } - // Create a timestamp if incoming event doesn't have one - this.timeStamp = src && src.timeStamp || jQuery.now(); + // Create a timestamp if incoming event doesn't have one + this.timeStamp = src && src.timeStamp || jQuery.now(); - // Mark it as fixed - this[ jQuery.expando ] = true; + // Mark it as fixed + this[ jQuery.expando ] = true; }; function returnFalse() { - return false; + return false; } function returnTrue() { - return true; + return true; } // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html jQuery.Event.prototype = { - preventDefault: function() { - this.isDefaultPrevented = returnTrue; + preventDefault: function() { + this.isDefaultPrevented = returnTrue; - var e = this.originalEvent; - if ( !e ) { - return; - } + var e = this.originalEvent; + if ( !e ) { + return; + } - // if preventDefault exists run it on the original event - if ( e.preventDefault ) { - e.preventDefault(); + // if preventDefault exists run it on the original event + if ( e.preventDefault ) { + e.preventDefault(); - // otherwise set the returnValue property of the original event to false (IE) - } else { - e.returnValue = false; - } - }, - stopPropagation: function() { - this.isPropagationStopped = returnTrue; + // otherwise set the returnValue property of the original event to false (IE) + } else { + e.returnValue = false; + } + }, + stopPropagation: function() { + this.isPropagationStopped = returnTrue; - var e = this.originalEvent; - if ( !e ) { - return; - } - // if stopPropagation exists run it on the original event - if ( e.stopPropagation ) { - e.stopPropagation(); - } - // otherwise set the cancelBubble property of the original event to true (IE) - e.cancelBubble = true; - }, - stopImmediatePropagation: function() { - this.isImmediatePropagationStopped = returnTrue; - this.stopPropagation(); - }, - isDefaultPrevented: returnFalse, - isPropagationStopped: returnFalse, - isImmediatePropagationStopped: returnFalse + var e = this.originalEvent; + if ( !e ) { + return; + } + // if stopPropagation exists run it on the original event + if ( e.stopPropagation ) { + e.stopPropagation(); + } + // otherwise set the cancelBubble property of the original event to true (IE) + e.cancelBubble = true; + }, + stopImmediatePropagation: function() { + this.isImmediatePropagationStopped = returnTrue; + this.stopPropagation(); + }, + isDefaultPrevented: returnFalse, + isPropagationStopped: returnFalse, + isImmediatePropagationStopped: returnFalse }; // Create mouseenter/leave events using mouseover/out and event-time checks jQuery.each({ - mouseenter: "mouseover", - mouseleave: "mouseout" + mouseenter: "mouseover", + mouseleave: "mouseout" }, function( orig, fix ) { - jQuery.event.special[ orig ] = { - delegateType: fix, - bindType: fix, + jQuery.event.special[ orig ] = { + delegateType: fix, + bindType: fix, - handle: function( event ) { - var ret, - target = this, - related = event.relatedTarget, - handleObj = event.handleObj, - selector = handleObj.selector; + handle: function( event ) { + var ret, + target = this, + related = event.relatedTarget, + handleObj = event.handleObj, + selector = handleObj.selector; - // For mousenter/leave call the handler if related is outside the target. - // NB: No relatedTarget if the mouse left/entered the browser window - if ( !related || (related !== target && !jQuery.contains( target, related )) ) { - event.type = handleObj.origType; - ret = handleObj.handler.apply( this, arguments ); - event.type = fix; - } - return ret; - } - }; + // For mousenter/leave call the handler if related is outside the target. + // NB: No relatedTarget if the mouse left/entered the browser window + if ( !related || (related !== target && !jQuery.contains( target, related )) ) { + event.type = handleObj.origType; + ret = handleObj.handler.apply( this, arguments ); + event.type = fix; + } + return ret; + } + }; }); // IE submit delegation if ( !jQuery.support.submitBubbles ) { - jQuery.event.special.submit = { - setup: function() { - // Only need this for delegated form submit events - if ( jQuery.nodeName( this, "form" ) ) { - return false; - } + jQuery.event.special.submit = { + setup: function() { + // Only need this for delegated form submit events + if ( jQuery.nodeName( this, "form" ) ) { + return false; + } - // Lazy-add a submit handler when a descendant form may potentially be submitted - jQuery.event.add( this, "click._submit keypress._submit", function( e ) { - // Node name check avoids a VML-related crash in IE (#9807) - var elem = e.target, - form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; - if ( form && !jQuery._data( form, "_submit_attached" ) ) { - jQuery.event.add( form, "submit._submit", function( event ) { - event._submit_bubble = true; - }); - jQuery._data( form, "_submit_attached", true ); - } - }); - // return undefined since we don't need an event listener - }, + // Lazy-add a submit handler when a descendant form may potentially be submitted + jQuery.event.add( this, "click._submit keypress._submit", function( e ) { + // Node name check avoids a VML-related crash in IE (#9807) + var elem = e.target, + form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; + if ( form && !jQuery._data( form, "_submit_attached" ) ) { + jQuery.event.add( form, "submit._submit", function( event ) { + event._submit_bubble = true; + }); + jQuery._data( form, "_submit_attached", true ); + } + }); + // return undefined since we don't need an event listener + }, - postDispatch: function( event ) { - // If form was submitted by the user, bubble the event up the tree - if ( event._submit_bubble ) { - delete event._submit_bubble; - if ( this.parentNode && !event.isTrigger ) { - jQuery.event.simulate( "submit", this.parentNode, event, true ); - } - } - }, + postDispatch: function( event ) { + // If form was submitted by the user, bubble the event up the tree + if ( event._submit_bubble ) { + delete event._submit_bubble; + if ( this.parentNode && !event.isTrigger ) { + jQuery.event.simulate( "submit", this.parentNode, event, true ); + } + } + }, - teardown: function() { - // Only need this for delegated form submit events - if ( jQuery.nodeName( this, "form" ) ) { - return false; - } + teardown: function() { + // Only need this for delegated form submit events + if ( jQuery.nodeName( this, "form" ) ) { + return false; + } - // Remove delegated handlers; cleanData eventually reaps submit handlers attached above - jQuery.event.remove( this, "._submit" ); - } - }; + // Remove delegated handlers; cleanData eventually reaps submit handlers attached above + jQuery.event.remove( this, "._submit" ); + } + }; } // IE change delegation and checkbox/radio fix if ( !jQuery.support.changeBubbles ) { - jQuery.event.special.change = { + jQuery.event.special.change = { - setup: function() { + setup: function() { - if ( rformElems.test( this.nodeName ) ) { - // IE doesn't fire change on a check/radio until blur; trigger it on click - // after a propertychange. Eat the blur-change in special.change.handle. - // This still fires onchange a second time for check/radio after blur. - if ( this.type === "checkbox" || this.type === "radio" ) { - jQuery.event.add( this, "propertychange._change", function( event ) { - if ( event.originalEvent.propertyName === "checked" ) { - this._just_changed = true; - } - }); - jQuery.event.add( this, "click._change", function( event ) { - if ( this._just_changed && !event.isTrigger ) { - this._just_changed = false; - } - // Allow triggered, simulated change events (#11500) - jQuery.event.simulate( "change", this, event, true ); - }); - } - return false; - } - // Delegated event; lazy-add a change handler on descendant inputs - jQuery.event.add( this, "beforeactivate._change", function( e ) { - var elem = e.target; + if ( rformElems.test( this.nodeName ) ) { + // IE doesn't fire change on a check/radio until blur; trigger it on click + // after a propertychange. Eat the blur-change in special.change.handle. + // This still fires onchange a second time for check/radio after blur. + if ( this.type === "checkbox" || this.type === "radio" ) { + jQuery.event.add( this, "propertychange._change", function( event ) { + if ( event.originalEvent.propertyName === "checked" ) { + this._just_changed = true; + } + }); + jQuery.event.add( this, "click._change", function( event ) { + if ( this._just_changed && !event.isTrigger ) { + this._just_changed = false; + } + // Allow triggered, simulated change events (#11500) + jQuery.event.simulate( "change", this, event, true ); + }); + } + return false; + } + // Delegated event; lazy-add a change handler on descendant inputs + jQuery.event.add( this, "beforeactivate._change", function( e ) { + var elem = e.target; - if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "_change_attached" ) ) { - jQuery.event.add( elem, "change._change", function( event ) { - if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { - jQuery.event.simulate( "change", this.parentNode, event, true ); - } - }); - jQuery._data( elem, "_change_attached", true ); - } - }); - }, + if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "_change_attached" ) ) { + jQuery.event.add( elem, "change._change", function( event ) { + if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { + jQuery.event.simulate( "change", this.parentNode, event, true ); + } + }); + jQuery._data( elem, "_change_attached", true ); + } + }); + }, - handle: function( event ) { - var elem = event.target; + handle: function( event ) { + var elem = event.target; - // Swallow native change events from checkbox/radio, we already triggered them above - if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { - return event.handleObj.handler.apply( this, arguments ); - } - }, + // Swallow native change events from checkbox/radio, we already triggered them above + if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { + return event.handleObj.handler.apply( this, arguments ); + } + }, - teardown: function() { - jQuery.event.remove( this, "._change" ); + teardown: function() { + jQuery.event.remove( this, "._change" ); - return !rformElems.test( this.nodeName ); - } - }; + return !rformElems.test( this.nodeName ); + } + }; } // Create "bubbling" focus and blur events if ( !jQuery.support.focusinBubbles ) { - jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { + jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { - // Attach a single capturing handler while someone wants focusin/focusout - var attaches = 0, - handler = function( event ) { - jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); - }; + // Attach a single capturing handler while someone wants focusin/focusout + var attaches = 0, + handler = function( event ) { + jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); + }; - jQuery.event.special[ fix ] = { - setup: function() { - if ( attaches++ === 0 ) { - document.addEventListener( orig, handler, true ); - } - }, - teardown: function() { - if ( --attaches === 0 ) { - document.removeEventListener( orig, handler, true ); - } - } - }; - }); + jQuery.event.special[ fix ] = { + setup: function() { + if ( attaches++ === 0 ) { + document.addEventListener( orig, handler, true ); + } + }, + teardown: function() { + if ( --attaches === 0 ) { + document.removeEventListener( orig, handler, true ); + } + } + }; + }); } jQuery.fn.extend({ - on: function( types, selector, data, fn, /*INTERNAL*/ one ) { - var origFn, type; + on: function( types, selector, data, fn, /*INTERNAL*/ one ) { + var origFn, type; - // Types can be a map of types/handlers - if ( typeof types === "object" ) { - // ( types-Object, selector, data ) - if ( typeof selector !== "string" ) { // && selector != null - // ( types-Object, data ) - data = data || selector; - selector = undefined; - } - for ( type in types ) { - this.on( type, selector, data, types[ type ], one ); - } - return this; - } + // Types can be a map of types/handlers + if ( typeof types === "object" ) { + // ( types-Object, selector, data ) + if ( typeof selector !== "string" ) { // && selector != null + // ( types-Object, data ) + data = data || selector; + selector = undefined; + } + for ( type in types ) { + this.on( type, selector, data, types[ type ], one ); + } + return this; + } - if ( data == null && fn == null ) { - // ( types, fn ) - fn = selector; - data = selector = undefined; - } else if ( fn == null ) { - if ( typeof selector === "string" ) { - // ( types, selector, fn ) - fn = data; - data = undefined; - } else { - // ( types, data, fn ) - fn = data; - data = selector; - selector = undefined; - } - } - if ( fn === false ) { - fn = returnFalse; - } else if ( !fn ) { - return this; - } + if ( data == null && fn == null ) { + // ( types, fn ) + fn = selector; + data = selector = undefined; + } else if ( fn == null ) { + if ( typeof selector === "string" ) { + // ( types, selector, fn ) + fn = data; + data = undefined; + } else { + // ( types, data, fn ) + fn = data; + data = selector; + selector = undefined; + } + } + if ( fn === false ) { + fn = returnFalse; + } else if ( !fn ) { + return this; + } - if ( one === 1 ) { - origFn = fn; - fn = function( event ) { - // Can use an empty set, since event contains the info - jQuery().off( event ); - return origFn.apply( this, arguments ); - }; - // Use same guid so caller can remove using origFn - fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); - } - return this.each( function() { - jQuery.event.add( this, types, fn, data, selector ); - }); - }, - one: function( types, selector, data, fn ) { - return this.on( types, selector, data, fn, 1 ); - }, - off: function( types, selector, fn ) { - var handleObj, type; - if ( types && types.preventDefault && types.handleObj ) { - // ( event ) dispatched jQuery.Event - handleObj = types.handleObj; - jQuery( types.delegateTarget ).off( - handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, - handleObj.selector, - handleObj.handler - ); - return this; - } - if ( typeof types === "object" ) { - // ( types-object [, selector] ) - for ( type in types ) { - this.off( type, selector, types[ type ] ); - } - return this; - } - if ( selector === false || typeof selector === "function" ) { - // ( types [, fn] ) - fn = selector; - selector = undefined; - } - if ( fn === false ) { - fn = returnFalse; - } - return this.each(function() { - jQuery.event.remove( this, types, fn, selector ); - }); - }, + if ( one === 1 ) { + origFn = fn; + fn = function( event ) { + // Can use an empty set, since event contains the info + jQuery().off( event ); + return origFn.apply( this, arguments ); + }; + // Use same guid so caller can remove using origFn + fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); + } + return this.each( function() { + jQuery.event.add( this, types, fn, data, selector ); + }); + }, + one: function( types, selector, data, fn ) { + return this.on( types, selector, data, fn, 1 ); + }, + off: function( types, selector, fn ) { + var handleObj, type; + if ( types && types.preventDefault && types.handleObj ) { + // ( event ) dispatched jQuery.Event + handleObj = types.handleObj; + jQuery( types.delegateTarget ).off( + handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, + handleObj.selector, + handleObj.handler + ); + return this; + } + if ( typeof types === "object" ) { + // ( types-object [, selector] ) + for ( type in types ) { + this.off( type, selector, types[ type ] ); + } + return this; + } + if ( selector === false || typeof selector === "function" ) { + // ( types [, fn] ) + fn = selector; + selector = undefined; + } + if ( fn === false ) { + fn = returnFalse; + } + return this.each(function() { + jQuery.event.remove( this, types, fn, selector ); + }); + }, - bind: function( types, data, fn ) { - return this.on( types, null, data, fn ); - }, - unbind: function( types, fn ) { - return this.off( types, null, fn ); - }, + bind: function( types, data, fn ) { + return this.on( types, null, data, fn ); + }, + unbind: function( types, fn ) { + return this.off( types, null, fn ); + }, - live: function( types, data, fn ) { - jQuery( this.context ).on( types, this.selector, data, fn ); - return this; - }, - die: function( types, fn ) { - jQuery( this.context ).off( types, this.selector || "**", fn ); - return this; - }, + live: function( types, data, fn ) { + jQuery( this.context ).on( types, this.selector, data, fn ); + return this; + }, + die: function( types, fn ) { + jQuery( this.context ).off( types, this.selector || "**", fn ); + return this; + }, - delegate: function( selector, types, data, fn ) { - return this.on( types, selector, data, fn ); - }, - undelegate: function( selector, types, fn ) { - // ( namespace ) or ( selector, types [, fn] ) - return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn ); - }, + delegate: function( selector, types, data, fn ) { + return this.on( types, selector, data, fn ); + }, + undelegate: function( selector, types, fn ) { + // ( namespace ) or ( selector, types [, fn] ) + return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn ); + }, - trigger: function( type, data ) { - return this.each(function() { - jQuery.event.trigger( type, data, this ); - }); - }, - triggerHandler: function( type, data ) { - if ( this[0] ) { - return jQuery.event.trigger( type, data, this[0], true ); - } - }, + trigger: function( type, data ) { + return this.each(function() { + jQuery.event.trigger( type, data, this ); + }); + }, + triggerHandler: function( type, data ) { + if ( this[0] ) { + return jQuery.event.trigger( type, data, this[0], true ); + } + }, - toggle: function( fn ) { - // Save reference to arguments for access in closure - var args = arguments, - guid = fn.guid || jQuery.guid++, - i = 0, - toggler = function( event ) { - // Figure out which function to execute - var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i; - jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 ); + toggle: function( fn ) { + // Save reference to arguments for access in closure + var args = arguments, + guid = fn.guid || jQuery.guid++, + i = 0, + toggler = function( event ) { + // Figure out which function to execute + var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i; + jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 ); - // Make sure that clicks stop - event.preventDefault(); + // Make sure that clicks stop + event.preventDefault(); - // and execute the function - return args[ lastToggle ].apply( this, arguments ) || false; - }; + // and execute the function + return args[ lastToggle ].apply( this, arguments ) || false; + }; - // link all the functions, so any of them can unbind this click handler - toggler.guid = guid; - while ( i < args.length ) { - args[ i++ ].guid = guid; - } + // link all the functions, so any of them can unbind this click handler + toggler.guid = guid; + while ( i < args.length ) { + args[ i++ ].guid = guid; + } - return this.click( toggler ); - }, + return this.click( toggler ); + }, - hover: function( fnOver, fnOut ) { - return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); - } + hover: function( fnOver, fnOut ) { + return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); + } }); jQuery.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 contextmenu").split(" "), function( i, name ) { + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + + "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) { - // Handle event binding - jQuery.fn[ name ] = function( data, fn ) { - if ( fn == null ) { - fn = data; - data = null; - } + // Handle event binding + jQuery.fn[ name ] = function( data, fn ) { + if ( fn == null ) { + fn = data; + data = null; + } - return arguments.length > 0 ? - this.on( name, null, data, fn ) : - this.trigger( name ); - }; + return arguments.length > 0 ? + this.on( name, null, data, fn ) : + this.trigger( name ); + }; - if ( rkeyEvent.test( name ) ) { - jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks; - } + if ( rkeyEvent.test( name ) ) { + jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks; + } - if ( rmouseEvent.test( name ) ) { - jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks; - } + if ( rmouseEvent.test( name ) ) { + jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks; + } }); /*! * Sizzle CSS Selector Engine @@ -3669,315 +3669,315 @@ jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblcl (function( window, undefined ) { var cachedruns, - assertGetIdNotName, - Expr, - getText, - isXML, - contains, - compile, - sortOrder, - hasDuplicate, - outermostContext, + assertGetIdNotName, + Expr, + getText, + isXML, + contains, + compile, + sortOrder, + hasDuplicate, + outermostContext, - baseHasDuplicate = true, - strundefined = "undefined", + baseHasDuplicate = true, + strundefined = "undefined", - expando = ( "sizcache" + Math.random() ).replace( ".", "" ), + expando = ( "sizcache" + Math.random() ).replace( ".", "" ), - Token = String, - document = window.document, - docElem = document.documentElement, - dirruns = 0, - done = 0, - pop = [].pop, - push = [].push, - slice = [].slice, - // Use a stripped-down indexOf if a native one is unavailable - indexOf = [].indexOf || function( elem ) { - var i = 0, - len = this.length; - for ( ; i < len; i++ ) { - if ( this[i] === elem ) { - return i; - } - } - return -1; - }, + Token = String, + document = window.document, + docElem = document.documentElement, + dirruns = 0, + done = 0, + pop = [].pop, + push = [].push, + slice = [].slice, + // Use a stripped-down indexOf if a native one is unavailable + indexOf = [].indexOf || function( elem ) { + var i = 0, + len = this.length; + for ( ; i < len; i++ ) { + if ( this[i] === elem ) { + return i; + } + } + return -1; + }, - // Augment a function for special use by Sizzle - markFunction = function( fn, value ) { - fn[ expando ] = value == null || value; - return fn; - }, + // Augment a function for special use by Sizzle + markFunction = function( fn, value ) { + fn[ expando ] = value == null || value; + return fn; + }, - createCache = function() { - var cache = {}, - keys = []; + createCache = function() { + var cache = {}, + keys = []; - return markFunction(function( key, value ) { - // Only keep the most recent entries - if ( keys.push( key ) > Expr.cacheLength ) { - delete cache[ keys.shift() ]; - } + return markFunction(function( key, value ) { + // Only keep the most recent entries + if ( keys.push( key ) > Expr.cacheLength ) { + delete cache[ keys.shift() ]; + } - // Retrieve with (key + " ") to avoid collision with native Object.prototype properties (see Issue #157) - return (cache[ key + " " ] = value); - }, cache ); - }, + // Retrieve with (key + " ") to avoid collision with native Object.prototype properties (see Issue #157) + return (cache[ key + " " ] = value); + }, cache ); + }, - classCache = createCache(), - tokenCache = createCache(), - compilerCache = createCache(), + classCache = createCache(), + tokenCache = createCache(), + compilerCache = createCache(), - // Regex + // Regex - // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace - whitespace = "[\\x20\\t\\r\\n\\f]", - // http://www.w3.org/TR/css3-syntax/#characters - characterEncoding = "(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+", + // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace + whitespace = "[\\x20\\t\\r\\n\\f]", + // http://www.w3.org/TR/css3-syntax/#characters + characterEncoding = "(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+", - // Loosely modeled on CSS identifier characters - // An unquoted value should be a CSS identifier (http://www.w3.org/TR/css3-selectors/#attribute-selectors) - // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier - identifier = characterEncoding.replace( "w", "w#" ), + // Loosely modeled on CSS identifier characters + // An unquoted value should be a CSS identifier (http://www.w3.org/TR/css3-selectors/#attribute-selectors) + // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier + identifier = characterEncoding.replace( "w", "w#" ), - // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors - operators = "([*^$|!~]?=)", - attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace + - "*(?:" + operators + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]", + // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors + operators = "([*^$|!~]?=)", + attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace + + "*(?:" + operators + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]", - // Prefer arguments not in parens/brackets, - // then attribute selectors and non-pseudos (denoted by :), - // then anything else - // These preferences are here to reduce the number of selectors - // needing tokenize in the PSEUDO preFilter - pseudos = ":(" + characterEncoding + ")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:" + attributes + ")|[^:]|\\\\.)*|.*))\\)|)", + // Prefer arguments not in parens/brackets, + // then attribute selectors and non-pseudos (denoted by :), + // then anything else + // These preferences are here to reduce the number of selectors + // needing tokenize in the PSEUDO preFilter + pseudos = ":(" + characterEncoding + ")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:" + attributes + ")|[^:]|\\\\.)*|.*))\\)|)", - // For matchExpr.POS and matchExpr.needsContext - pos = ":(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + - "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", + // For matchExpr.POS and matchExpr.needsContext + pos = ":(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", - // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter - rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), + // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter + rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), - rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), - rcombinators = new RegExp( "^" + whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*" ), - rpseudo = new RegExp( pseudos ), + rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), + rcombinators = new RegExp( "^" + whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*" ), + rpseudo = new RegExp( pseudos ), - // Easily-parseable/retrievable ID or TAG or CLASS selectors - rquickExpr = /^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/, + // Easily-parseable/retrievable ID or TAG or CLASS selectors + rquickExpr = /^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/, - rnot = /^:not/, - rsibling = /[\x20\t\r\n\f]*[+~]/, - rendsWithNot = /:not\($/, + rnot = /^:not/, + rsibling = /[\x20\t\r\n\f]*[+~]/, + rendsWithNot = /:not\($/, - rheader = /h\d/i, - rinputs = /input|select|textarea|button/i, + rheader = /h\d/i, + rinputs = /input|select|textarea|button/i, - rbackslash = /\\(?!\\)/g, + rbackslash = /\\(?!\\)/g, - matchExpr = { - "ID": new RegExp( "^#(" + characterEncoding + ")" ), - "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ), - "NAME": new RegExp( "^\\[name=['\"]?(" + characterEncoding + ")['\"]?\\]" ), - "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ), - "ATTR": new RegExp( "^" + attributes ), - "PSEUDO": new RegExp( "^" + pseudos ), - "POS": new RegExp( pos, "i" ), - "CHILD": new RegExp( "^:(only|nth|first|last)-child(?:\\(" + whitespace + - "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + - "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), - // For use in libraries implementing .is() - "needsContext": new RegExp( "^" + whitespace + "*[>+~]|" + pos, "i" ) - }, + matchExpr = { + "ID": new RegExp( "^#(" + characterEncoding + ")" ), + "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ), + "NAME": new RegExp( "^\\[name=['\"]?(" + characterEncoding + ")['\"]?\\]" ), + "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ), + "ATTR": new RegExp( "^" + attributes ), + "PSEUDO": new RegExp( "^" + pseudos ), + "POS": new RegExp( pos, "i" ), + "CHILD": new RegExp( "^:(only|nth|first|last)-child(?:\\(" + whitespace + + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), + // For use in libraries implementing .is() + "needsContext": new RegExp( "^" + whitespace + "*[>+~]|" + pos, "i" ) + }, - // Support + // Support - // Used for testing something on an element - assert = function( fn ) { - var div = document.createElement("div"); + // Used for testing something on an element + assert = function( fn ) { + var div = document.createElement("div"); - try { - return fn( div ); - } catch (e) { - return false; - } finally { - // release memory in IE - div = null; - } - }, + try { + return fn( div ); + } catch (e) { + return false; + } finally { + // release memory in IE + div = null; + } + }, - // Check if getElementsByTagName("*") returns only elements - assertTagNameNoComments = assert(function( div ) { - div.appendChild( document.createComment("") ); - return !div.getElementsByTagName("*").length; - }), + // Check if getElementsByTagName("*") returns only elements + assertTagNameNoComments = assert(function( div ) { + div.appendChild( document.createComment("") ); + return !div.getElementsByTagName("*").length; + }), - // Check if getAttribute returns normalized href attributes - assertHrefNotNormalized = assert(function( div ) { - div.innerHTML = ""; - return div.firstChild && typeof div.firstChild.getAttribute !== strundefined && - div.firstChild.getAttribute("href") === "#"; - }), + // Check if getAttribute returns normalized href attributes + assertHrefNotNormalized = assert(function( div ) { + div.innerHTML = ""; + return div.firstChild && typeof div.firstChild.getAttribute !== strundefined && + div.firstChild.getAttribute("href") === "#"; + }), - // Check if attributes should be retrieved by attribute nodes - assertAttributes = assert(function( div ) { - div.innerHTML = ""; - var type = typeof div.lastChild.getAttribute("multiple"); - // IE8 returns a string for some attributes even when not present - return type !== "boolean" && type !== "string"; - }), + // Check if attributes should be retrieved by attribute nodes + assertAttributes = assert(function( div ) { + div.innerHTML = ""; + var type = typeof div.lastChild.getAttribute("multiple"); + // IE8 returns a string for some attributes even when not present + return type !== "boolean" && type !== "string"; + }), - // Check if getElementsByClassName can be trusted - assertUsableClassName = assert(function( div ) { - // Opera can't find a second classname (in 9.6) - div.innerHTML = ""; - if ( !div.getElementsByClassName || !div.getElementsByClassName("e").length ) { - return false; - } + // Check if getElementsByClassName can be trusted + assertUsableClassName = assert(function( div ) { + // Opera can't find a second classname (in 9.6) + div.innerHTML = ""; + if ( !div.getElementsByClassName || !div.getElementsByClassName("e").length ) { + return false; + } - // Safari 3.2 caches class attributes and doesn't catch changes - div.lastChild.className = "e"; - return div.getElementsByClassName("e").length === 2; - }), + // Safari 3.2 caches class attributes and doesn't catch changes + div.lastChild.className = "e"; + return div.getElementsByClassName("e").length === 2; + }), - // Check if getElementById returns elements by name - // Check if getElementsByName privileges form controls or returns elements by ID - assertUsableName = assert(function( div ) { - // Inject content - div.id = expando + 0; - div.innerHTML = "
    "; - docElem.insertBefore( div, docElem.firstChild ); + // Check if getElementById returns elements by name + // Check if getElementsByName privileges form controls or returns elements by ID + assertUsableName = assert(function( div ) { + // Inject content + div.id = expando + 0; + div.innerHTML = "
    "; + docElem.insertBefore( div, docElem.firstChild ); - // Test - var pass = document.getElementsByName && - // buggy browsers will return fewer than the correct 2 - document.getElementsByName( expando ).length === 2 + - // buggy browsers will return more than the correct 0 - document.getElementsByName( expando + 0 ).length; - assertGetIdNotName = !document.getElementById( expando ); + // Test + var pass = document.getElementsByName && + // buggy browsers will return fewer than the correct 2 + document.getElementsByName( expando ).length === 2 + + // buggy browsers will return more than the correct 0 + document.getElementsByName( expando + 0 ).length; + assertGetIdNotName = !document.getElementById( expando ); - // Cleanup - docElem.removeChild( div ); + // Cleanup + docElem.removeChild( div ); - return pass; - }); + return pass; + }); // If slice is not available, provide a backup try { - slice.call( docElem.childNodes, 0 )[0].nodeType; + slice.call( docElem.childNodes, 0 )[0].nodeType; } catch ( e ) { - slice = function( i ) { - var elem, - results = []; - for ( ; (elem = this[i]); i++ ) { - results.push( elem ); - } - return results; - }; + slice = function( i ) { + var elem, + results = []; + for ( ; (elem = this[i]); i++ ) { + results.push( elem ); + } + return results; + }; } function Sizzle( selector, context, results, seed ) { - results = results || []; - context = context || document; - var match, elem, xml, m, - nodeType = context.nodeType; + results = results || []; + context = context || document; + var match, elem, xml, m, + nodeType = context.nodeType; - if ( !selector || typeof selector !== "string" ) { - return results; - } + if ( !selector || typeof selector !== "string" ) { + return results; + } - if ( nodeType !== 1 && nodeType !== 9 ) { - return []; - } + if ( nodeType !== 1 && nodeType !== 9 ) { + return []; + } - xml = isXML( context ); + xml = isXML( context ); - if ( !xml && !seed ) { - if ( (match = rquickExpr.exec( selector )) ) { - // Speed-up: Sizzle("#ID") - if ( (m = match[1]) ) { - if ( nodeType === 9 ) { - elem = context.getElementById( m ); - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE, Opera, and Webkit return items - // by name instead of ID - if ( elem.id === m ) { - results.push( elem ); - return results; - } - } else { - return results; - } - } else { - // Context is not a document - if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) && - contains( context, elem ) && elem.id === m ) { - results.push( elem ); - return results; - } - } + if ( !xml && !seed ) { + if ( (match = rquickExpr.exec( selector )) ) { + // Speed-up: Sizzle("#ID") + if ( (m = match[1]) ) { + if ( nodeType === 9 ) { + elem = context.getElementById( m ); + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + if ( elem && elem.parentNode ) { + // Handle the case where IE, Opera, and Webkit return items + // by name instead of ID + if ( elem.id === m ) { + results.push( elem ); + return results; + } + } else { + return results; + } + } else { + // Context is not a document + if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) && + contains( context, elem ) && elem.id === m ) { + results.push( elem ); + return results; + } + } - // Speed-up: Sizzle("TAG") - } else if ( match[2] ) { - push.apply( results, slice.call(context.getElementsByTagName( selector ), 0) ); - return results; + // Speed-up: Sizzle("TAG") + } else if ( match[2] ) { + push.apply( results, slice.call(context.getElementsByTagName( selector ), 0) ); + return results; - // Speed-up: Sizzle(".CLASS") - } else if ( (m = match[3]) && assertUsableClassName && context.getElementsByClassName ) { - push.apply( results, slice.call(context.getElementsByClassName( m ), 0) ); - return results; - } - } - } + // Speed-up: Sizzle(".CLASS") + } else if ( (m = match[3]) && assertUsableClassName && context.getElementsByClassName ) { + push.apply( results, slice.call(context.getElementsByClassName( m ), 0) ); + return results; + } + } + } - // All others - return select( selector.replace( rtrim, "$1" ), context, results, seed, xml ); + // All others + return select( selector.replace( rtrim, "$1" ), context, results, seed, xml ); } Sizzle.matches = function( expr, elements ) { - return Sizzle( expr, null, null, elements ); + return Sizzle( expr, null, null, elements ); }; Sizzle.matchesSelector = function( elem, expr ) { - return Sizzle( expr, null, null, [ elem ] ).length > 0; + return Sizzle( expr, null, null, [ elem ] ).length > 0; }; // Returns a function to use in pseudos for input types function createInputPseudo( type ) { - return function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && elem.type === type; - }; + return function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && elem.type === type; + }; } // Returns a function to use in pseudos for buttons function createButtonPseudo( type ) { - return function( elem ) { - var name = elem.nodeName.toLowerCase(); - return (name === "input" || name === "button") && elem.type === type; - }; + return function( elem ) { + var name = elem.nodeName.toLowerCase(); + return (name === "input" || name === "button") && elem.type === type; + }; } // Returns a function to use in pseudos for positionals function createPositionalPseudo( fn ) { - return markFunction(function( argument ) { - argument = +argument; - return markFunction(function( seed, matches ) { - var j, - matchIndexes = fn( [], seed.length, argument ), - i = matchIndexes.length; + return markFunction(function( argument ) { + argument = +argument; + return markFunction(function( seed, matches ) { + var j, + matchIndexes = fn( [], seed.length, argument ), + i = matchIndexes.length; - // Match elements found at the specified indexes - while ( i-- ) { - if ( seed[ (j = matchIndexes[i]) ] ) { - seed[j] = !(matches[j] = seed[j]); - } - } - }); - }); + // Match elements found at the specified indexes + while ( i-- ) { + if ( seed[ (j = matchIndexes[i]) ] ) { + seed[j] = !(matches[j] = seed[j]); + } + } + }); + }); } /** @@ -3985,667 +3985,667 @@ function createPositionalPseudo( fn ) { * @param {Array|Element} elem */ getText = Sizzle.getText = function( elem ) { - var node, - ret = "", - i = 0, - nodeType = elem.nodeType; + var node, + ret = "", + i = 0, + nodeType = elem.nodeType; - if ( nodeType ) { - if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { - // Use textContent for elements - // innerText usage removed for consistency of new lines (see #11153) - if ( typeof elem.textContent === "string" ) { - return elem.textContent; - } else { - // Traverse its children - for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { - ret += getText( elem ); - } - } - } else if ( nodeType === 3 || nodeType === 4 ) { - return elem.nodeValue; - } - // Do not include comment or processing instruction nodes - } else { + if ( nodeType ) { + if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { + // Use textContent for elements + // innerText usage removed for consistency of new lines (see #11153) + if ( typeof elem.textContent === "string" ) { + return elem.textContent; + } else { + // Traverse its children + for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { + ret += getText( elem ); + } + } + } else if ( nodeType === 3 || nodeType === 4 ) { + return elem.nodeValue; + } + // Do not include comment or processing instruction nodes + } else { - // If no nodeType, this is expected to be an array - for ( ; (node = elem[i]); i++ ) { - // Do not traverse comment nodes - ret += getText( node ); - } - } - return ret; + // If no nodeType, this is expected to be an array + for ( ; (node = elem[i]); i++ ) { + // Do not traverse comment nodes + ret += getText( node ); + } + } + return ret; }; isXML = Sizzle.isXML = function( elem ) { - // documentElement is verified for cases where it doesn't yet exist - // (such as loading iframes in IE - #4833) - var documentElement = elem && (elem.ownerDocument || elem).documentElement; - return documentElement ? documentElement.nodeName !== "HTML" : false; + // documentElement is verified for cases where it doesn't yet exist + // (such as loading iframes in IE - #4833) + var documentElement = elem && (elem.ownerDocument || elem).documentElement; + return documentElement ? documentElement.nodeName !== "HTML" : false; }; // Element contains another contains = Sizzle.contains = docElem.contains ? - function( a, b ) { - var adown = a.nodeType === 9 ? a.documentElement : a, - bup = b && b.parentNode; - return a === bup || !!( bup && bup.nodeType === 1 && adown.contains && adown.contains(bup) ); - } : - docElem.compareDocumentPosition ? - function( a, b ) { - return b && !!( a.compareDocumentPosition( b ) & 16 ); - } : - function( a, b ) { - while ( (b = b.parentNode) ) { - if ( b === a ) { - return true; - } - } - return false; - }; + function( a, b ) { + var adown = a.nodeType === 9 ? a.documentElement : a, + bup = b && b.parentNode; + return a === bup || !!( bup && bup.nodeType === 1 && adown.contains && adown.contains(bup) ); + } : + docElem.compareDocumentPosition ? + function( a, b ) { + return b && !!( a.compareDocumentPosition( b ) & 16 ); + } : + function( a, b ) { + while ( (b = b.parentNode) ) { + if ( b === a ) { + return true; + } + } + return false; + }; Sizzle.attr = function( elem, name ) { - var val, - xml = isXML( elem ); + var val, + xml = isXML( elem ); - if ( !xml ) { - name = name.toLowerCase(); - } - if ( (val = Expr.attrHandle[ name ]) ) { - return val( elem ); - } - if ( xml || assertAttributes ) { - return elem.getAttribute( name ); - } - val = elem.getAttributeNode( name ); - return val ? - typeof elem[ name ] === "boolean" ? - elem[ name ] ? name : null : - val.specified ? val.value : null : - null; + if ( !xml ) { + name = name.toLowerCase(); + } + if ( (val = Expr.attrHandle[ name ]) ) { + return val( elem ); + } + if ( xml || assertAttributes ) { + return elem.getAttribute( name ); + } + val = elem.getAttributeNode( name ); + return val ? + typeof elem[ name ] === "boolean" ? + elem[ name ] ? name : null : + val.specified ? val.value : null : + null; }; Expr = Sizzle.selectors = { - // Can be adjusted by the user - cacheLength: 50, - - createPseudo: markFunction, - - match: matchExpr, - - // IE6/7 return a modified href - attrHandle: assertHrefNotNormalized ? - {} : - { - "href": function( elem ) { - return elem.getAttribute( "href", 2 ); - }, - "type": function( elem ) { - return elem.getAttribute("type"); - } - }, - - find: { - "ID": assertGetIdNotName ? - function( id, context, xml ) { - if ( typeof context.getElementById !== strundefined && !xml ) { - var m = context.getElementById( id ); - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - return m && m.parentNode ? [m] : []; - } - } : - function( id, context, xml ) { - if ( typeof context.getElementById !== strundefined && !xml ) { - var m = context.getElementById( id ); - - return m ? - m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ? - [m] : - undefined : - []; - } - }, - - "TAG": assertTagNameNoComments ? - function( tag, context ) { - if ( typeof context.getElementsByTagName !== strundefined ) { - return context.getElementsByTagName( tag ); - } - } : - function( tag, context ) { - var results = context.getElementsByTagName( tag ); - - // Filter out possible comments - if ( tag === "*" ) { - var elem, - tmp = [], - i = 0; - - for ( ; (elem = results[i]); i++ ) { - if ( elem.nodeType === 1 ) { - tmp.push( elem ); - } - } - - return tmp; - } - return results; - }, - - "NAME": assertUsableName && function( tag, context ) { - if ( typeof context.getElementsByName !== strundefined ) { - return context.getElementsByName( name ); - } - }, - - "CLASS": assertUsableClassName && function( className, context, xml ) { - if ( typeof context.getElementsByClassName !== strundefined && !xml ) { - return context.getElementsByClassName( className ); - } - } - }, - - relative: { - ">": { dir: "parentNode", first: true }, - " ": { dir: "parentNode" }, - "+": { dir: "previousSibling", first: true }, - "~": { dir: "previousSibling" } - }, - - preFilter: { - "ATTR": function( match ) { - match[1] = match[1].replace( rbackslash, "" ); - - // Move the given value to match[3] whether quoted or unquoted - match[3] = ( match[4] || match[5] || "" ).replace( rbackslash, "" ); - - if ( match[2] === "~=" ) { - match[3] = " " + match[3] + " "; - } - - return match.slice( 0, 4 ); - }, - - "CHILD": function( match ) { - /* matches from matchExpr["CHILD"] - 1 type (only|nth|...) - 2 argument (even|odd|\d*|\d*n([+-]\d+)?|...) - 3 xn-component of xn+y argument ([+-]?\d*n|) - 4 sign of xn-component - 5 x of xn-component - 6 sign of y-component - 7 y of y-component - */ - match[1] = match[1].toLowerCase(); - - if ( match[1] === "nth" ) { - // nth-child requires argument - if ( !match[2] ) { - Sizzle.error( match[0] ); - } - - // numeric x and y parameters for Expr.filter.CHILD - // remember that false/true cast respectively to 0/1 - match[3] = +( match[3] ? match[4] + (match[5] || 1) : 2 * ( match[2] === "even" || match[2] === "odd" ) ); - match[4] = +( ( match[6] + match[7] ) || match[2] === "odd" ); - - // other types prohibit arguments - } else if ( match[2] ) { - Sizzle.error( match[0] ); - } - - return match; - }, - - "PSEUDO": function( match ) { - var unquoted, excess; - if ( matchExpr["CHILD"].test( match[0] ) ) { - return null; - } - - if ( match[3] ) { - match[2] = match[3]; - } else if ( (unquoted = match[4]) ) { - // Only check arguments that contain a pseudo - if ( rpseudo.test(unquoted) && - // Get excess from tokenize (recursively) - (excess = tokenize( unquoted, true )) && - // advance to the next closing parenthesis - (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { - - // excess is a negative index - unquoted = unquoted.slice( 0, excess ); - match[0] = match[0].slice( 0, excess ); - } - match[2] = unquoted; - } - - // Return only captures needed by the pseudo filter method (type and argument) - return match.slice( 0, 3 ); - } - }, - - filter: { - "ID": assertGetIdNotName ? - function( id ) { - id = id.replace( rbackslash, "" ); - return function( elem ) { - return elem.getAttribute("id") === id; - }; - } : - function( id ) { - id = id.replace( rbackslash, "" ); - return function( elem ) { - var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id"); - return node && node.value === id; - }; - }, - - "TAG": function( nodeName ) { - if ( nodeName === "*" ) { - return function() { return true; }; - } - nodeName = nodeName.replace( rbackslash, "" ).toLowerCase(); - - return function( elem ) { - return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; - }; - }, - - "CLASS": function( className ) { - var pattern = classCache[ expando ][ className + " " ]; - - return pattern || - (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && - classCache( className, function( elem ) { - return pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || "" ); - }); - }, - - "ATTR": function( name, operator, check ) { - return function( elem, context ) { - var result = Sizzle.attr( elem, name ); - - if ( result == null ) { - return operator === "!="; - } - if ( !operator ) { - return true; - } - - result += ""; - - return operator === "=" ? result === check : - operator === "!=" ? result !== check : - operator === "^=" ? check && result.indexOf( check ) === 0 : - operator === "*=" ? check && result.indexOf( check ) > -1 : - operator === "$=" ? check && result.substr( result.length - check.length ) === check : - operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 : - operator === "|=" ? result === check || result.substr( 0, check.length + 1 ) === check + "-" : - false; - }; - }, - - "CHILD": function( type, argument, first, last ) { - - if ( type === "nth" ) { - return function( elem ) { - var node, diff, - parent = elem.parentNode; - - if ( first === 1 && last === 0 ) { - return true; - } - - if ( parent ) { - diff = 0; - for ( node = parent.firstChild; node; node = node.nextSibling ) { - if ( node.nodeType === 1 ) { - diff++; - if ( elem === node ) { - break; - } - } - } - } - - // Incorporate the offset (or cast to NaN), then check against cycle size - diff -= last; - return diff === first || ( diff % first === 0 && diff / first >= 0 ); - }; - } - - return function( elem ) { - var node = elem; - - switch ( type ) { - case "only": - case "first": - while ( (node = node.previousSibling) ) { - if ( node.nodeType === 1 ) { - return false; - } - } - - if ( type === "first" ) { - return true; - } - - node = elem; - - /* falls through */ - case "last": - while ( (node = node.nextSibling) ) { - if ( node.nodeType === 1 ) { - return false; - } - } - - return true; - } - }; - }, - - "PSEUDO": function( pseudo, argument ) { - // pseudo-class names are case-insensitive - // http://www.w3.org/TR/selectors/#pseudo-classes - // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters - // Remember that setFilters inherits from pseudos - var args, - fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || - Sizzle.error( "unsupported pseudo: " + pseudo ); - - // The user may use createPseudo to indicate that - // arguments are needed to create the filter function - // just as Sizzle does - if ( fn[ expando ] ) { - return fn( argument ); - } - - // But maintain support for old signatures - if ( fn.length > 1 ) { - args = [ pseudo, pseudo, "", argument ]; - return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? - markFunction(function( seed, matches ) { - var idx, - matched = fn( seed, argument ), - i = matched.length; - while ( i-- ) { - idx = indexOf.call( seed, matched[i] ); - seed[ idx ] = !( matches[ idx ] = matched[i] ); - } - }) : - function( elem ) { - return fn( elem, 0, args ); - }; - } - - return fn; - } - }, - - pseudos: { - "not": markFunction(function( selector ) { - // Trim the selector passed to compile - // to avoid treating leading and trailing - // spaces as combinators - var input = [], - results = [], - matcher = compile( selector.replace( rtrim, "$1" ) ); - - return matcher[ expando ] ? - markFunction(function( seed, matches, context, xml ) { - var elem, - unmatched = matcher( seed, null, xml, [] ), - i = seed.length; - - // Match elements unmatched by `matcher` - while ( i-- ) { - if ( (elem = unmatched[i]) ) { - seed[i] = !(matches[i] = elem); - } - } - }) : - function( elem, context, xml ) { - input[0] = elem; - matcher( input, null, xml, results ); - return !results.pop(); - }; - }), - - "has": markFunction(function( selector ) { - return function( elem ) { - return Sizzle( selector, elem ).length > 0; - }; - }), - - "contains": markFunction(function( text ) { - return function( elem ) { - return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; - }; - }), - - "enabled": function( elem ) { - return elem.disabled === false; - }, - - "disabled": function( elem ) { - return elem.disabled === true; - }, - - "checked": function( elem ) { - // In CSS3, :checked should return both checked and selected elements - // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked - var nodeName = elem.nodeName.toLowerCase(); - return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); - }, - - "selected": function( elem ) { - // Accessing this property makes selected-by-default - // options in Safari work properly - if ( elem.parentNode ) { - elem.parentNode.selectedIndex; - } - - return elem.selected === true; - }, - - "parent": function( elem ) { - return !Expr.pseudos["empty"]( elem ); - }, - - "empty": function( elem ) { - // http://www.w3.org/TR/selectors/#empty-pseudo - // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)), - // not comment, processing instructions, or others - // Thanks to Diego Perini for the nodeName shortcut - // Greater than "@" means alpha characters (specifically not starting with "#" or "?") - var nodeType; - elem = elem.firstChild; - while ( elem ) { - if ( elem.nodeName > "@" || (nodeType = elem.nodeType) === 3 || nodeType === 4 ) { - return false; - } - elem = elem.nextSibling; - } - return true; - }, - - "header": function( elem ) { - return rheader.test( elem.nodeName ); - }, - - "text": function( elem ) { - var type, attr; - // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) - // use getAttribute instead to test this case - return elem.nodeName.toLowerCase() === "input" && - (type = elem.type) === "text" && - ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === type ); - }, - - // Input types - "radio": createInputPseudo("radio"), - "checkbox": createInputPseudo("checkbox"), - "file": createInputPseudo("file"), - "password": createInputPseudo("password"), - "image": createInputPseudo("image"), - - "submit": createButtonPseudo("submit"), - "reset": createButtonPseudo("reset"), - - "button": function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && elem.type === "button" || name === "button"; - }, - - "input": function( elem ) { - return rinputs.test( elem.nodeName ); - }, - - "focus": function( elem ) { - var doc = elem.ownerDocument; - return elem === doc.activeElement && (!doc.hasFocus || doc.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); - }, - - "active": function( elem ) { - return elem === elem.ownerDocument.activeElement; - }, - - // Positional types - "first": createPositionalPseudo(function() { - return [ 0 ]; - }), - - "last": createPositionalPseudo(function( matchIndexes, length ) { - return [ length - 1 ]; - }), - - "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { - return [ argument < 0 ? argument + length : argument ]; - }), - - "even": createPositionalPseudo(function( matchIndexes, length ) { - for ( var i = 0; i < length; i += 2 ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), - - "odd": createPositionalPseudo(function( matchIndexes, length ) { - for ( var i = 1; i < length; i += 2 ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), - - "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { - for ( var i = argument < 0 ? argument + length : argument; --i >= 0; ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), - - "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { - for ( var i = argument < 0 ? argument + length : argument; ++i < length; ) { - matchIndexes.push( i ); - } - return matchIndexes; - }) - } + // Can be adjusted by the user + cacheLength: 50, + + createPseudo: markFunction, + + match: matchExpr, + + // IE6/7 return a modified href + attrHandle: assertHrefNotNormalized ? + {} : + { + "href": function( elem ) { + return elem.getAttribute( "href", 2 ); + }, + "type": function( elem ) { + return elem.getAttribute("type"); + } + }, + + find: { + "ID": assertGetIdNotName ? + function( id, context, xml ) { + if ( typeof context.getElementById !== strundefined && !xml ) { + var m = context.getElementById( id ); + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + return m && m.parentNode ? [m] : []; + } + } : + function( id, context, xml ) { + if ( typeof context.getElementById !== strundefined && !xml ) { + var m = context.getElementById( id ); + + return m ? + m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ? + [m] : + undefined : + []; + } + }, + + "TAG": assertTagNameNoComments ? + function( tag, context ) { + if ( typeof context.getElementsByTagName !== strundefined ) { + return context.getElementsByTagName( tag ); + } + } : + function( tag, context ) { + var results = context.getElementsByTagName( tag ); + + // Filter out possible comments + if ( tag === "*" ) { + var elem, + tmp = [], + i = 0; + + for ( ; (elem = results[i]); i++ ) { + if ( elem.nodeType === 1 ) { + tmp.push( elem ); + } + } + + return tmp; + } + return results; + }, + + "NAME": assertUsableName && function( tag, context ) { + if ( typeof context.getElementsByName !== strundefined ) { + return context.getElementsByName( name ); + } + }, + + "CLASS": assertUsableClassName && function( className, context, xml ) { + if ( typeof context.getElementsByClassName !== strundefined && !xml ) { + return context.getElementsByClassName( className ); + } + } + }, + + relative: { + ">": { dir: "parentNode", first: true }, + " ": { dir: "parentNode" }, + "+": { dir: "previousSibling", first: true }, + "~": { dir: "previousSibling" } + }, + + preFilter: { + "ATTR": function( match ) { + match[1] = match[1].replace( rbackslash, "" ); + + // Move the given value to match[3] whether quoted or unquoted + match[3] = ( match[4] || match[5] || "" ).replace( rbackslash, "" ); + + if ( match[2] === "~=" ) { + match[3] = " " + match[3] + " "; + } + + return match.slice( 0, 4 ); + }, + + "CHILD": function( match ) { + /* matches from matchExpr["CHILD"] + 1 type (only|nth|...) + 2 argument (even|odd|\d*|\d*n([+-]\d+)?|...) + 3 xn-component of xn+y argument ([+-]?\d*n|) + 4 sign of xn-component + 5 x of xn-component + 6 sign of y-component + 7 y of y-component + */ + match[1] = match[1].toLowerCase(); + + if ( match[1] === "nth" ) { + // nth-child requires argument + if ( !match[2] ) { + Sizzle.error( match[0] ); + } + + // numeric x and y parameters for Expr.filter.CHILD + // remember that false/true cast respectively to 0/1 + match[3] = +( match[3] ? match[4] + (match[5] || 1) : 2 * ( match[2] === "even" || match[2] === "odd" ) ); + match[4] = +( ( match[6] + match[7] ) || match[2] === "odd" ); + + // other types prohibit arguments + } else if ( match[2] ) { + Sizzle.error( match[0] ); + } + + return match; + }, + + "PSEUDO": function( match ) { + var unquoted, excess; + if ( matchExpr["CHILD"].test( match[0] ) ) { + return null; + } + + if ( match[3] ) { + match[2] = match[3]; + } else if ( (unquoted = match[4]) ) { + // Only check arguments that contain a pseudo + if ( rpseudo.test(unquoted) && + // Get excess from tokenize (recursively) + (excess = tokenize( unquoted, true )) && + // advance to the next closing parenthesis + (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { + + // excess is a negative index + unquoted = unquoted.slice( 0, excess ); + match[0] = match[0].slice( 0, excess ); + } + match[2] = unquoted; + } + + // Return only captures needed by the pseudo filter method (type and argument) + return match.slice( 0, 3 ); + } + }, + + filter: { + "ID": assertGetIdNotName ? + function( id ) { + id = id.replace( rbackslash, "" ); + return function( elem ) { + return elem.getAttribute("id") === id; + }; + } : + function( id ) { + id = id.replace( rbackslash, "" ); + return function( elem ) { + var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id"); + return node && node.value === id; + }; + }, + + "TAG": function( nodeName ) { + if ( nodeName === "*" ) { + return function() { return true; }; + } + nodeName = nodeName.replace( rbackslash, "" ).toLowerCase(); + + return function( elem ) { + return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; + }; + }, + + "CLASS": function( className ) { + var pattern = classCache[ expando ][ className + " " ]; + + return pattern || + (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && + classCache( className, function( elem ) { + return pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || "" ); + }); + }, + + "ATTR": function( name, operator, check ) { + return function( elem, context ) { + var result = Sizzle.attr( elem, name ); + + if ( result == null ) { + return operator === "!="; + } + if ( !operator ) { + return true; + } + + result += ""; + + return operator === "=" ? result === check : + operator === "!=" ? result !== check : + operator === "^=" ? check && result.indexOf( check ) === 0 : + operator === "*=" ? check && result.indexOf( check ) > -1 : + operator === "$=" ? check && result.substr( result.length - check.length ) === check : + operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 : + operator === "|=" ? result === check || result.substr( 0, check.length + 1 ) === check + "-" : + false; + }; + }, + + "CHILD": function( type, argument, first, last ) { + + if ( type === "nth" ) { + return function( elem ) { + var node, diff, + parent = elem.parentNode; + + if ( first === 1 && last === 0 ) { + return true; + } + + if ( parent ) { + diff = 0; + for ( node = parent.firstChild; node; node = node.nextSibling ) { + if ( node.nodeType === 1 ) { + diff++; + if ( elem === node ) { + break; + } + } + } + } + + // Incorporate the offset (or cast to NaN), then check against cycle size + diff -= last; + return diff === first || ( diff % first === 0 && diff / first >= 0 ); + }; + } + + return function( elem ) { + var node = elem; + + switch ( type ) { + case "only": + case "first": + while ( (node = node.previousSibling) ) { + if ( node.nodeType === 1 ) { + return false; + } + } + + if ( type === "first" ) { + return true; + } + + node = elem; + + /* falls through */ + case "last": + while ( (node = node.nextSibling) ) { + if ( node.nodeType === 1 ) { + return false; + } + } + + return true; + } + }; + }, + + "PSEUDO": function( pseudo, argument ) { + // pseudo-class names are case-insensitive + // http://www.w3.org/TR/selectors/#pseudo-classes + // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters + // Remember that setFilters inherits from pseudos + var args, + fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || + Sizzle.error( "unsupported pseudo: " + pseudo ); + + // The user may use createPseudo to indicate that + // arguments are needed to create the filter function + // just as Sizzle does + if ( fn[ expando ] ) { + return fn( argument ); + } + + // But maintain support for old signatures + if ( fn.length > 1 ) { + args = [ pseudo, pseudo, "", argument ]; + return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? + markFunction(function( seed, matches ) { + var idx, + matched = fn( seed, argument ), + i = matched.length; + while ( i-- ) { + idx = indexOf.call( seed, matched[i] ); + seed[ idx ] = !( matches[ idx ] = matched[i] ); + } + }) : + function( elem ) { + return fn( elem, 0, args ); + }; + } + + return fn; + } + }, + + pseudos: { + "not": markFunction(function( selector ) { + // Trim the selector passed to compile + // to avoid treating leading and trailing + // spaces as combinators + var input = [], + results = [], + matcher = compile( selector.replace( rtrim, "$1" ) ); + + return matcher[ expando ] ? + markFunction(function( seed, matches, context, xml ) { + var elem, + unmatched = matcher( seed, null, xml, [] ), + i = seed.length; + + // Match elements unmatched by `matcher` + while ( i-- ) { + if ( (elem = unmatched[i]) ) { + seed[i] = !(matches[i] = elem); + } + } + }) : + function( elem, context, xml ) { + input[0] = elem; + matcher( input, null, xml, results ); + return !results.pop(); + }; + }), + + "has": markFunction(function( selector ) { + return function( elem ) { + return Sizzle( selector, elem ).length > 0; + }; + }), + + "contains": markFunction(function( text ) { + return function( elem ) { + return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; + }; + }), + + "enabled": function( elem ) { + return elem.disabled === false; + }, + + "disabled": function( elem ) { + return elem.disabled === true; + }, + + "checked": function( elem ) { + // In CSS3, :checked should return both checked and selected elements + // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked + var nodeName = elem.nodeName.toLowerCase(); + return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); + }, + + "selected": function( elem ) { + // Accessing this property makes selected-by-default + // options in Safari work properly + if ( elem.parentNode ) { + elem.parentNode.selectedIndex; + } + + return elem.selected === true; + }, + + "parent": function( elem ) { + return !Expr.pseudos["empty"]( elem ); + }, + + "empty": function( elem ) { + // http://www.w3.org/TR/selectors/#empty-pseudo + // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)), + // not comment, processing instructions, or others + // Thanks to Diego Perini for the nodeName shortcut + // Greater than "@" means alpha characters (specifically not starting with "#" or "?") + var nodeType; + elem = elem.firstChild; + while ( elem ) { + if ( elem.nodeName > "@" || (nodeType = elem.nodeType) === 3 || nodeType === 4 ) { + return false; + } + elem = elem.nextSibling; + } + return true; + }, + + "header": function( elem ) { + return rheader.test( elem.nodeName ); + }, + + "text": function( elem ) { + var type, attr; + // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) + // use getAttribute instead to test this case + return elem.nodeName.toLowerCase() === "input" && + (type = elem.type) === "text" && + ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === type ); + }, + + // Input types + "radio": createInputPseudo("radio"), + "checkbox": createInputPseudo("checkbox"), + "file": createInputPseudo("file"), + "password": createInputPseudo("password"), + "image": createInputPseudo("image"), + + "submit": createButtonPseudo("submit"), + "reset": createButtonPseudo("reset"), + + "button": function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && elem.type === "button" || name === "button"; + }, + + "input": function( elem ) { + return rinputs.test( elem.nodeName ); + }, + + "focus": function( elem ) { + var doc = elem.ownerDocument; + return elem === doc.activeElement && (!doc.hasFocus || doc.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); + }, + + "active": function( elem ) { + return elem === elem.ownerDocument.activeElement; + }, + + // Positional types + "first": createPositionalPseudo(function() { + return [ 0 ]; + }), + + "last": createPositionalPseudo(function( matchIndexes, length ) { + return [ length - 1 ]; + }), + + "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { + return [ argument < 0 ? argument + length : argument ]; + }), + + "even": createPositionalPseudo(function( matchIndexes, length ) { + for ( var i = 0; i < length; i += 2 ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "odd": createPositionalPseudo(function( matchIndexes, length ) { + for ( var i = 1; i < length; i += 2 ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { + for ( var i = argument < 0 ? argument + length : argument; --i >= 0; ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { + for ( var i = argument < 0 ? argument + length : argument; ++i < length; ) { + matchIndexes.push( i ); + } + return matchIndexes; + }) + } }; function siblingCheck( a, b, ret ) { - if ( a === b ) { - return ret; - } + if ( a === b ) { + return ret; + } - var cur = a.nextSibling; + var cur = a.nextSibling; - while ( cur ) { - if ( cur === b ) { - return -1; - } + while ( cur ) { + if ( cur === b ) { + return -1; + } - cur = cur.nextSibling; - } + cur = cur.nextSibling; + } - return 1; + return 1; } sortOrder = docElem.compareDocumentPosition ? - function( a, b ) { - if ( a === b ) { - hasDuplicate = true; - return 0; - } + function( a, b ) { + if ( a === b ) { + hasDuplicate = true; + return 0; + } - return ( !a.compareDocumentPosition || !b.compareDocumentPosition ? - a.compareDocumentPosition : - a.compareDocumentPosition(b) & 4 - ) ? -1 : 1; - } : - function( a, b ) { - // The nodes are identical, we can exit early - if ( a === b ) { - hasDuplicate = true; - return 0; + return ( !a.compareDocumentPosition || !b.compareDocumentPosition ? + a.compareDocumentPosition : + a.compareDocumentPosition(b) & 4 + ) ? -1 : 1; + } : + function( a, b ) { + // The nodes are identical, we can exit early + if ( a === b ) { + hasDuplicate = true; + return 0; - // Fallback to using sourceIndex (in IE) if it's available on both nodes - } else if ( a.sourceIndex && b.sourceIndex ) { - return a.sourceIndex - b.sourceIndex; - } + // Fallback to using sourceIndex (in IE) if it's available on both nodes + } else if ( a.sourceIndex && b.sourceIndex ) { + return a.sourceIndex - b.sourceIndex; + } - var al, bl, - ap = [], - bp = [], - aup = a.parentNode, - bup = b.parentNode, - cur = aup; + var al, bl, + ap = [], + bp = [], + aup = a.parentNode, + bup = b.parentNode, + cur = aup; - // If the nodes are siblings (or identical) we can do a quick check - if ( aup === bup ) { - return siblingCheck( a, b ); + // If the nodes are siblings (or identical) we can do a quick check + if ( aup === bup ) { + return siblingCheck( a, b ); - // If no parents were found then the nodes are disconnected - } else if ( !aup ) { - return -1; + // If no parents were found then the nodes are disconnected + } else if ( !aup ) { + return -1; - } else if ( !bup ) { - return 1; - } + } else if ( !bup ) { + return 1; + } - // Otherwise they're somewhere else in the tree so we need - // to build up a full list of the parentNodes for comparison - while ( cur ) { - ap.unshift( cur ); - cur = cur.parentNode; - } + // Otherwise they're somewhere else in the tree so we need + // to build up a full list of the parentNodes for comparison + while ( cur ) { + ap.unshift( cur ); + cur = cur.parentNode; + } - cur = bup; + cur = bup; - while ( cur ) { - bp.unshift( cur ); - cur = cur.parentNode; - } + while ( cur ) { + bp.unshift( cur ); + cur = cur.parentNode; + } - al = ap.length; - bl = bp.length; + al = ap.length; + bl = bp.length; - // Start walking down the tree looking for a discrepancy - for ( var i = 0; i < al && i < bl; i++ ) { - if ( ap[i] !== bp[i] ) { - return siblingCheck( ap[i], bp[i] ); - } - } + // Start walking down the tree looking for a discrepancy + for ( var i = 0; i < al && i < bl; i++ ) { + if ( ap[i] !== bp[i] ) { + return siblingCheck( ap[i], bp[i] ); + } + } - // We ended someplace up the tree so do a sibling check - return i === al ? - siblingCheck( a, bp[i], -1 ) : - siblingCheck( ap[i], b, 1 ); - }; + // We ended someplace up the tree so do a sibling check + return i === al ? + siblingCheck( a, bp[i], -1 ) : + siblingCheck( ap[i], b, 1 ); + }; // Always assume the presence of duplicates if sort doesn't // pass them to our comparison function (as in Google Chrome). @@ -4654,681 +4654,681 @@ baseHasDuplicate = !hasDuplicate; // Document sorting and removing duplicates Sizzle.uniqueSort = function( results ) { - var elem, - duplicates = [], - i = 1, - j = 0; + var elem, + duplicates = [], + i = 1, + j = 0; - hasDuplicate = baseHasDuplicate; - results.sort( sortOrder ); + hasDuplicate = baseHasDuplicate; + results.sort( sortOrder ); - if ( hasDuplicate ) { - for ( ; (elem = results[i]); i++ ) { - if ( elem === results[ i - 1 ] ) { - j = duplicates.push( i ); - } - } - while ( j-- ) { - results.splice( duplicates[ j ], 1 ); - } - } + if ( hasDuplicate ) { + for ( ; (elem = results[i]); i++ ) { + if ( elem === results[ i - 1 ] ) { + j = duplicates.push( i ); + } + } + while ( j-- ) { + results.splice( duplicates[ j ], 1 ); + } + } - return results; + return results; }; Sizzle.error = function( msg ) { - throw new Error( "Syntax error, unrecognized expression: " + msg ); + throw new Error( "Syntax error, unrecognized expression: " + msg ); }; function tokenize( selector, parseOnly ) { - var matched, match, tokens, type, - soFar, groups, preFilters, - cached = tokenCache[ expando ][ selector + " " ]; + var matched, match, tokens, type, + soFar, groups, preFilters, + cached = tokenCache[ expando ][ selector + " " ]; - if ( cached ) { - return parseOnly ? 0 : cached.slice( 0 ); - } + if ( cached ) { + return parseOnly ? 0 : cached.slice( 0 ); + } - soFar = selector; - groups = []; - preFilters = Expr.preFilter; + soFar = selector; + groups = []; + preFilters = Expr.preFilter; - while ( soFar ) { + while ( soFar ) { - // Comma and first run - if ( !matched || (match = rcomma.exec( soFar )) ) { - if ( match ) { - // Don't consume trailing commas as valid - soFar = soFar.slice( match[0].length ) || soFar; - } - groups.push( tokens = [] ); - } + // Comma and first run + if ( !matched || (match = rcomma.exec( soFar )) ) { + if ( match ) { + // Don't consume trailing commas as valid + soFar = soFar.slice( match[0].length ) || soFar; + } + groups.push( tokens = [] ); + } - matched = false; + matched = false; - // Combinators - if ( (match = rcombinators.exec( soFar )) ) { - tokens.push( matched = new Token( match.shift() ) ); - soFar = soFar.slice( matched.length ); + // Combinators + if ( (match = rcombinators.exec( soFar )) ) { + tokens.push( matched = new Token( match.shift() ) ); + soFar = soFar.slice( matched.length ); - // Cast descendant combinators to space - matched.type = match[0].replace( rtrim, " " ); - } + // Cast descendant combinators to space + matched.type = match[0].replace( rtrim, " " ); + } - // Filters - for ( type in Expr.filter ) { - if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || - (match = preFilters[ type ]( match ))) ) { + // Filters + for ( type in Expr.filter ) { + if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || + (match = preFilters[ type ]( match ))) ) { - tokens.push( matched = new Token( match.shift() ) ); - soFar = soFar.slice( matched.length ); - matched.type = type; - matched.matches = match; - } - } + tokens.push( matched = new Token( match.shift() ) ); + soFar = soFar.slice( matched.length ); + matched.type = type; + matched.matches = match; + } + } - if ( !matched ) { - break; - } - } + if ( !matched ) { + break; + } + } - // Return the length of the invalid excess - // if we're just parsing - // Otherwise, throw an error or return tokens - return parseOnly ? - soFar.length : - soFar ? - Sizzle.error( selector ) : - // Cache the tokens - tokenCache( selector, groups ).slice( 0 ); + // Return the length of the invalid excess + // if we're just parsing + // Otherwise, throw an error or return tokens + return parseOnly ? + soFar.length : + soFar ? + Sizzle.error( selector ) : + // Cache the tokens + tokenCache( selector, groups ).slice( 0 ); } function addCombinator( matcher, combinator, base ) { - var dir = combinator.dir, - checkNonElements = base && combinator.dir === "parentNode", - doneName = done++; + var dir = combinator.dir, + checkNonElements = base && combinator.dir === "parentNode", + doneName = done++; - return combinator.first ? - // Check against closest ancestor/preceding element - function( elem, context, xml ) { - while ( (elem = elem[ dir ]) ) { - if ( checkNonElements || elem.nodeType === 1 ) { - return matcher( elem, context, xml ); - } - } - } : + return combinator.first ? + // Check against closest ancestor/preceding element + function( elem, context, xml ) { + while ( (elem = elem[ dir ]) ) { + if ( checkNonElements || elem.nodeType === 1 ) { + return matcher( elem, context, xml ); + } + } + } : - // Check against all ancestor/preceding elements - function( elem, context, xml ) { - // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching - if ( !xml ) { - var cache, - dirkey = dirruns + " " + doneName + " ", - cachedkey = dirkey + cachedruns; - while ( (elem = elem[ dir ]) ) { - if ( checkNonElements || elem.nodeType === 1 ) { - if ( (cache = elem[ expando ]) === cachedkey ) { - return elem.sizset; - } else if ( typeof cache === "string" && cache.indexOf(dirkey) === 0 ) { - if ( elem.sizset ) { - return elem; - } - } else { - elem[ expando ] = cachedkey; - if ( matcher( elem, context, xml ) ) { - elem.sizset = true; - return elem; - } - elem.sizset = false; - } - } - } - } else { - while ( (elem = elem[ dir ]) ) { - if ( checkNonElements || elem.nodeType === 1 ) { - if ( matcher( elem, context, xml ) ) { - return elem; - } - } - } - } - }; + // Check against all ancestor/preceding elements + function( elem, context, xml ) { + // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching + if ( !xml ) { + var cache, + dirkey = dirruns + " " + doneName + " ", + cachedkey = dirkey + cachedruns; + while ( (elem = elem[ dir ]) ) { + if ( checkNonElements || elem.nodeType === 1 ) { + if ( (cache = elem[ expando ]) === cachedkey ) { + return elem.sizset; + } else if ( typeof cache === "string" && cache.indexOf(dirkey) === 0 ) { + if ( elem.sizset ) { + return elem; + } + } else { + elem[ expando ] = cachedkey; + if ( matcher( elem, context, xml ) ) { + elem.sizset = true; + return elem; + } + elem.sizset = false; + } + } + } + } else { + while ( (elem = elem[ dir ]) ) { + if ( checkNonElements || elem.nodeType === 1 ) { + if ( matcher( elem, context, xml ) ) { + return elem; + } + } + } + } + }; } function elementMatcher( matchers ) { - return matchers.length > 1 ? - function( elem, context, xml ) { - var i = matchers.length; - while ( i-- ) { - if ( !matchers[i]( elem, context, xml ) ) { - return false; - } - } - return true; - } : - matchers[0]; + return matchers.length > 1 ? + function( elem, context, xml ) { + var i = matchers.length; + while ( i-- ) { + if ( !matchers[i]( elem, context, xml ) ) { + return false; + } + } + return true; + } : + matchers[0]; } function condense( unmatched, map, filter, context, xml ) { - var elem, - newUnmatched = [], - i = 0, - len = unmatched.length, - mapped = map != null; + var elem, + newUnmatched = [], + i = 0, + len = unmatched.length, + mapped = map != null; - for ( ; i < len; i++ ) { - if ( (elem = unmatched[i]) ) { - if ( !filter || filter( elem, context, xml ) ) { - newUnmatched.push( elem ); - if ( mapped ) { - map.push( i ); - } - } - } - } + for ( ; i < len; i++ ) { + if ( (elem = unmatched[i]) ) { + if ( !filter || filter( elem, context, xml ) ) { + newUnmatched.push( elem ); + if ( mapped ) { + map.push( i ); + } + } + } + } - return newUnmatched; + return newUnmatched; } function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { - if ( postFilter && !postFilter[ expando ] ) { - postFilter = setMatcher( postFilter ); - } - if ( postFinder && !postFinder[ expando ] ) { - postFinder = setMatcher( postFinder, postSelector ); - } - return markFunction(function( seed, results, context, xml ) { - var temp, i, elem, - preMap = [], - postMap = [], - preexisting = results.length, + if ( postFilter && !postFilter[ expando ] ) { + postFilter = setMatcher( postFilter ); + } + if ( postFinder && !postFinder[ expando ] ) { + postFinder = setMatcher( postFinder, postSelector ); + } + return markFunction(function( seed, results, context, xml ) { + var temp, i, elem, + preMap = [], + postMap = [], + preexisting = results.length, - // Get initial elements from seed or context - elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), + // Get initial elements from seed or context + elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), - // Prefilter to get matcher input, preserving a map for seed-results synchronization - matcherIn = preFilter && ( seed || !selector ) ? - condense( elems, preMap, preFilter, context, xml ) : - elems, + // Prefilter to get matcher input, preserving a map for seed-results synchronization + matcherIn = preFilter && ( seed || !selector ) ? + condense( elems, preMap, preFilter, context, xml ) : + elems, - matcherOut = matcher ? - // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, - postFinder || ( seed ? preFilter : preexisting || postFilter ) ? + matcherOut = matcher ? + // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, + postFinder || ( seed ? preFilter : preexisting || postFilter ) ? - // ...intermediate processing is necessary - [] : + // ...intermediate processing is necessary + [] : - // ...otherwise use results directly - results : - matcherIn; + // ...otherwise use results directly + results : + matcherIn; - // Find primary matches - if ( matcher ) { - matcher( matcherIn, matcherOut, context, xml ); - } + // Find primary matches + if ( matcher ) { + matcher( matcherIn, matcherOut, context, xml ); + } - // Apply postFilter - if ( postFilter ) { - temp = condense( matcherOut, postMap ); - postFilter( temp, [], context, xml ); + // Apply postFilter + if ( postFilter ) { + temp = condense( matcherOut, postMap ); + postFilter( temp, [], context, xml ); - // Un-match failing elements by moving them back to matcherIn - i = temp.length; - while ( i-- ) { - if ( (elem = temp[i]) ) { - matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); - } - } - } + // Un-match failing elements by moving them back to matcherIn + i = temp.length; + while ( i-- ) { + if ( (elem = temp[i]) ) { + matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); + } + } + } - if ( seed ) { - if ( postFinder || preFilter ) { - if ( postFinder ) { - // Get the final matcherOut by condensing this intermediate into postFinder contexts - temp = []; - i = matcherOut.length; - while ( i-- ) { - if ( (elem = matcherOut[i]) ) { - // Restore matcherIn since elem is not yet a final match - temp.push( (matcherIn[i] = elem) ); - } - } - postFinder( null, (matcherOut = []), temp, xml ); - } + if ( seed ) { + if ( postFinder || preFilter ) { + if ( postFinder ) { + // Get the final matcherOut by condensing this intermediate into postFinder contexts + temp = []; + i = matcherOut.length; + while ( i-- ) { + if ( (elem = matcherOut[i]) ) { + // Restore matcherIn since elem is not yet a final match + temp.push( (matcherIn[i] = elem) ); + } + } + postFinder( null, (matcherOut = []), temp, xml ); + } - // Move matched elements from seed to results to keep them synchronized - i = matcherOut.length; - while ( i-- ) { - if ( (elem = matcherOut[i]) && - (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) { + // Move matched elements from seed to results to keep them synchronized + i = matcherOut.length; + while ( i-- ) { + if ( (elem = matcherOut[i]) && + (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) { - seed[temp] = !(results[temp] = elem); - } - } - } + seed[temp] = !(results[temp] = elem); + } + } + } - // Add elements to results, through postFinder if defined - } else { - matcherOut = condense( - matcherOut === results ? - matcherOut.splice( preexisting, matcherOut.length ) : - matcherOut - ); - if ( postFinder ) { - postFinder( null, results, matcherOut, xml ); - } else { - push.apply( results, matcherOut ); - } - } - }); + // Add elements to results, through postFinder if defined + } else { + matcherOut = condense( + matcherOut === results ? + matcherOut.splice( preexisting, matcherOut.length ) : + matcherOut + ); + if ( postFinder ) { + postFinder( null, results, matcherOut, xml ); + } else { + push.apply( results, matcherOut ); + } + } + }); } function matcherFromTokens( tokens ) { - var checkContext, matcher, j, - len = tokens.length, - leadingRelative = Expr.relative[ tokens[0].type ], - implicitRelative = leadingRelative || Expr.relative[" "], - i = leadingRelative ? 1 : 0, + var checkContext, matcher, j, + len = tokens.length, + leadingRelative = Expr.relative[ tokens[0].type ], + implicitRelative = leadingRelative || Expr.relative[" "], + i = leadingRelative ? 1 : 0, - // The foundational matcher ensures that elements are reachable from top-level context(s) - matchContext = addCombinator( function( elem ) { - return elem === checkContext; - }, implicitRelative, true ), - matchAnyContext = addCombinator( function( elem ) { - return indexOf.call( checkContext, elem ) > -1; - }, implicitRelative, true ), - matchers = [ function( elem, context, xml ) { - return ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( - (checkContext = context).nodeType ? - matchContext( elem, context, xml ) : - matchAnyContext( elem, context, xml ) ); - } ]; + // The foundational matcher ensures that elements are reachable from top-level context(s) + matchContext = addCombinator( function( elem ) { + return elem === checkContext; + }, implicitRelative, true ), + matchAnyContext = addCombinator( function( elem ) { + return indexOf.call( checkContext, elem ) > -1; + }, implicitRelative, true ), + matchers = [ function( elem, context, xml ) { + return ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( + (checkContext = context).nodeType ? + matchContext( elem, context, xml ) : + matchAnyContext( elem, context, xml ) ); + } ]; - for ( ; i < len; i++ ) { - if ( (matcher = Expr.relative[ tokens[i].type ]) ) { - matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ]; - } else { - matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); + for ( ; i < len; i++ ) { + if ( (matcher = Expr.relative[ tokens[i].type ]) ) { + matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ]; + } else { + matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); - // Return special upon seeing a positional matcher - if ( matcher[ expando ] ) { - // Find the next relative operator (if any) for proper handling - j = ++i; - for ( ; j < len; j++ ) { - if ( Expr.relative[ tokens[j].type ] ) { - break; - } - } - return setMatcher( - i > 1 && elementMatcher( matchers ), - i > 1 && tokens.slice( 0, i - 1 ).join("").replace( rtrim, "$1" ), - matcher, - i < j && matcherFromTokens( tokens.slice( i, j ) ), - j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), - j < len && tokens.join("") - ); - } - matchers.push( matcher ); - } - } + // Return special upon seeing a positional matcher + if ( matcher[ expando ] ) { + // Find the next relative operator (if any) for proper handling + j = ++i; + for ( ; j < len; j++ ) { + if ( Expr.relative[ tokens[j].type ] ) { + break; + } + } + return setMatcher( + i > 1 && elementMatcher( matchers ), + i > 1 && tokens.slice( 0, i - 1 ).join("").replace( rtrim, "$1" ), + matcher, + i < j && matcherFromTokens( tokens.slice( i, j ) ), + j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), + j < len && tokens.join("") + ); + } + matchers.push( matcher ); + } + } - return elementMatcher( matchers ); + return elementMatcher( matchers ); } function matcherFromGroupMatchers( elementMatchers, setMatchers ) { - var bySet = setMatchers.length > 0, - byElement = elementMatchers.length > 0, - superMatcher = function( seed, context, xml, results, expandContext ) { - var elem, j, matcher, - setMatched = [], - matchedCount = 0, - i = "0", - unmatched = seed && [], - outermost = expandContext != null, - contextBackup = outermostContext, - // We must always have either seed elements or context - elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ), - // Nested matchers should use non-integer dirruns - dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.E); + var bySet = setMatchers.length > 0, + byElement = elementMatchers.length > 0, + superMatcher = function( seed, context, xml, results, expandContext ) { + var elem, j, matcher, + setMatched = [], + matchedCount = 0, + i = "0", + unmatched = seed && [], + outermost = expandContext != null, + contextBackup = outermostContext, + // We must always have either seed elements or context + elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ), + // Nested matchers should use non-integer dirruns + dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.E); - if ( outermost ) { - outermostContext = context !== document && context; - cachedruns = superMatcher.el; - } + if ( outermost ) { + outermostContext = context !== document && context; + cachedruns = superMatcher.el; + } - // Add elements passing elementMatchers directly to results - for ( ; (elem = elems[i]) != null; i++ ) { - if ( byElement && elem ) { - for ( j = 0; (matcher = elementMatchers[j]); j++ ) { - if ( matcher( elem, context, xml ) ) { - results.push( elem ); - break; - } - } - if ( outermost ) { - dirruns = dirrunsUnique; - cachedruns = ++superMatcher.el; - } - } + // Add elements passing elementMatchers directly to results + for ( ; (elem = elems[i]) != null; i++ ) { + if ( byElement && elem ) { + for ( j = 0; (matcher = elementMatchers[j]); j++ ) { + if ( matcher( elem, context, xml ) ) { + results.push( elem ); + break; + } + } + if ( outermost ) { + dirruns = dirrunsUnique; + cachedruns = ++superMatcher.el; + } + } - // Track unmatched elements for set filters - if ( bySet ) { - // They will have gone through all possible matchers - if ( (elem = !matcher && elem) ) { - matchedCount--; - } + // Track unmatched elements for set filters + if ( bySet ) { + // They will have gone through all possible matchers + if ( (elem = !matcher && elem) ) { + matchedCount--; + } - // Lengthen the array for every element, matched or not - if ( seed ) { - unmatched.push( elem ); - } - } - } + // Lengthen the array for every element, matched or not + if ( seed ) { + unmatched.push( elem ); + } + } + } - // Apply set filters to unmatched elements - matchedCount += i; - if ( bySet && i !== matchedCount ) { - for ( j = 0; (matcher = setMatchers[j]); j++ ) { - matcher( unmatched, setMatched, context, xml ); - } + // Apply set filters to unmatched elements + matchedCount += i; + if ( bySet && i !== matchedCount ) { + for ( j = 0; (matcher = setMatchers[j]); j++ ) { + matcher( unmatched, setMatched, context, xml ); + } - if ( seed ) { - // Reintegrate element matches to eliminate the need for sorting - if ( matchedCount > 0 ) { - while ( i-- ) { - if ( !(unmatched[i] || setMatched[i]) ) { - setMatched[i] = pop.call( results ); - } - } - } + if ( seed ) { + // Reintegrate element matches to eliminate the need for sorting + if ( matchedCount > 0 ) { + while ( i-- ) { + if ( !(unmatched[i] || setMatched[i]) ) { + setMatched[i] = pop.call( results ); + } + } + } - // Discard index placeholder values to get only actual matches - setMatched = condense( setMatched ); - } + // Discard index placeholder values to get only actual matches + setMatched = condense( setMatched ); + } - // Add matches to results - push.apply( results, setMatched ); + // Add matches to results + push.apply( results, setMatched ); - // Seedless set matches succeeding multiple successful matchers stipulate sorting - if ( outermost && !seed && setMatched.length > 0 && - ( matchedCount + setMatchers.length ) > 1 ) { + // Seedless set matches succeeding multiple successful matchers stipulate sorting + if ( outermost && !seed && setMatched.length > 0 && + ( matchedCount + setMatchers.length ) > 1 ) { - Sizzle.uniqueSort( results ); - } - } + Sizzle.uniqueSort( results ); + } + } - // Override manipulation of globals by nested matchers - if ( outermost ) { - dirruns = dirrunsUnique; - outermostContext = contextBackup; - } + // Override manipulation of globals by nested matchers + if ( outermost ) { + dirruns = dirrunsUnique; + outermostContext = contextBackup; + } - return unmatched; - }; + return unmatched; + }; - superMatcher.el = 0; - return bySet ? - markFunction( superMatcher ) : - superMatcher; + superMatcher.el = 0; + return bySet ? + markFunction( superMatcher ) : + superMatcher; } compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) { - var i, - setMatchers = [], - elementMatchers = [], - cached = compilerCache[ expando ][ selector + " " ]; + var i, + setMatchers = [], + elementMatchers = [], + cached = compilerCache[ expando ][ selector + " " ]; - if ( !cached ) { - // Generate a function of recursive functions that can be used to check each element - if ( !group ) { - group = tokenize( selector ); - } - i = group.length; - while ( i-- ) { - cached = matcherFromTokens( group[i] ); - if ( cached[ expando ] ) { - setMatchers.push( cached ); - } else { - elementMatchers.push( cached ); - } - } + if ( !cached ) { + // Generate a function of recursive functions that can be used to check each element + if ( !group ) { + group = tokenize( selector ); + } + i = group.length; + while ( i-- ) { + cached = matcherFromTokens( group[i] ); + if ( cached[ expando ] ) { + setMatchers.push( cached ); + } else { + elementMatchers.push( cached ); + } + } - // Cache the compiled function - cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); - } - return cached; + // Cache the compiled function + cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); + } + return cached; }; function multipleContexts( selector, contexts, results ) { - var i = 0, - len = contexts.length; - for ( ; i < len; i++ ) { - Sizzle( selector, contexts[i], results ); - } - return results; + var i = 0, + len = contexts.length; + for ( ; i < len; i++ ) { + Sizzle( selector, contexts[i], results ); + } + return results; } function select( selector, context, results, seed, xml ) { - var i, tokens, token, type, find, - match = tokenize( selector ), - j = match.length; + var i, tokens, token, type, find, + match = tokenize( selector ), + j = match.length; - if ( !seed ) { - // Try to minimize operations if there is only one group - if ( match.length === 1 ) { + if ( !seed ) { + // Try to minimize operations if there is only one group + if ( match.length === 1 ) { - // Take a shortcut and set the context if the root selector is an ID - tokens = match[0] = match[0].slice( 0 ); - if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && - context.nodeType === 9 && !xml && - Expr.relative[ tokens[1].type ] ) { + // Take a shortcut and set the context if the root selector is an ID + tokens = match[0] = match[0].slice( 0 ); + if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && + context.nodeType === 9 && !xml && + Expr.relative[ tokens[1].type ] ) { - context = Expr.find["ID"]( token.matches[0].replace( rbackslash, "" ), context, xml )[0]; - if ( !context ) { - return results; - } + context = Expr.find["ID"]( token.matches[0].replace( rbackslash, "" ), context, xml )[0]; + if ( !context ) { + return results; + } - selector = selector.slice( tokens.shift().length ); - } + selector = selector.slice( tokens.shift().length ); + } - // Fetch a seed set for right-to-left matching - for ( i = matchExpr["POS"].test( selector ) ? -1 : tokens.length - 1; i >= 0; i-- ) { - token = tokens[i]; + // Fetch a seed set for right-to-left matching + for ( i = matchExpr["POS"].test( selector ) ? -1 : tokens.length - 1; i >= 0; i-- ) { + token = tokens[i]; - // Abort if we hit a combinator - if ( Expr.relative[ (type = token.type) ] ) { - break; - } - if ( (find = Expr.find[ type ]) ) { - // Search, expanding context for leading sibling combinators - if ( (seed = find( - token.matches[0].replace( rbackslash, "" ), - rsibling.test( tokens[0].type ) && context.parentNode || context, - xml - )) ) { + // Abort if we hit a combinator + if ( Expr.relative[ (type = token.type) ] ) { + break; + } + if ( (find = Expr.find[ type ]) ) { + // Search, expanding context for leading sibling combinators + if ( (seed = find( + token.matches[0].replace( rbackslash, "" ), + rsibling.test( tokens[0].type ) && context.parentNode || context, + xml + )) ) { - // If seed is empty or no tokens remain, we can return early - tokens.splice( i, 1 ); - selector = seed.length && tokens.join(""); - if ( !selector ) { - push.apply( results, slice.call( seed, 0 ) ); - return results; - } + // If seed is empty or no tokens remain, we can return early + tokens.splice( i, 1 ); + selector = seed.length && tokens.join(""); + if ( !selector ) { + push.apply( results, slice.call( seed, 0 ) ); + return results; + } - break; - } - } - } - } - } + break; + } + } + } + } + } - // Compile and execute a filtering function - // Provide `match` to avoid retokenization if we modified the selector above - compile( selector, match )( - seed, - context, - xml, - results, - rsibling.test( selector ) - ); - return results; + // Compile and execute a filtering function + // Provide `match` to avoid retokenization if we modified the selector above + compile( selector, match )( + seed, + context, + xml, + results, + rsibling.test( selector ) + ); + return results; } if ( document.querySelectorAll ) { - (function() { - var disconnectedMatch, - oldSelect = select, - rescape = /'|\\/g, - rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g, + (function() { + var disconnectedMatch, + oldSelect = select, + rescape = /'|\\/g, + rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g, - // qSa(:focus) reports false when true (Chrome 21), no need to also add to buggyMatches since matches checks buggyQSA - // A support test would require too much code (would include document ready) - rbuggyQSA = [ ":focus" ], + // qSa(:focus) reports false when true (Chrome 21), no need to also add to buggyMatches since matches checks buggyQSA + // A support test would require too much code (would include document ready) + rbuggyQSA = [ ":focus" ], - // matchesSelector(:active) reports false when true (IE9/Opera 11.5) - // A support test would require too much code (would include document ready) - // just skip matchesSelector for :active - rbuggyMatches = [ ":active" ], - matches = docElem.matchesSelector || - docElem.mozMatchesSelector || - docElem.webkitMatchesSelector || - docElem.oMatchesSelector || - docElem.msMatchesSelector; + // matchesSelector(:active) reports false when true (IE9/Opera 11.5) + // A support test would require too much code (would include document ready) + // just skip matchesSelector for :active + rbuggyMatches = [ ":active" ], + matches = docElem.matchesSelector || + docElem.mozMatchesSelector || + docElem.webkitMatchesSelector || + docElem.oMatchesSelector || + docElem.msMatchesSelector; - // Build QSA regex - // Regex strategy adopted from Diego Perini - assert(function( div ) { - // Select is set to empty string on purpose - // This is to test IE's treatment of not explictly - // setting a boolean content attribute, - // since its presence should be enough - // http://bugs.jquery.com/ticket/12359 - div.innerHTML = ""; + // Build QSA regex + // Regex strategy adopted from Diego Perini + assert(function( div ) { + // Select is set to empty string on purpose + // This is to test IE's treatment of not explictly + // setting a boolean content attribute, + // since its presence should be enough + // http://bugs.jquery.com/ticket/12359 + div.innerHTML = ""; - // IE8 - Some boolean attributes are not treated correctly - if ( !div.querySelectorAll("[selected]").length ) { - rbuggyQSA.push( "\\[" + whitespace + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)" ); - } + // IE8 - Some boolean attributes are not treated correctly + if ( !div.querySelectorAll("[selected]").length ) { + rbuggyQSA.push( "\\[" + whitespace + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)" ); + } - // Webkit/Opera - :checked should return selected option elements - // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked - // IE8 throws error here (do not put tests after this one) - if ( !div.querySelectorAll(":checked").length ) { - rbuggyQSA.push(":checked"); - } - }); + // Webkit/Opera - :checked should return selected option elements + // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked + // IE8 throws error here (do not put tests after this one) + if ( !div.querySelectorAll(":checked").length ) { + rbuggyQSA.push(":checked"); + } + }); - assert(function( div ) { + assert(function( div ) { - // Opera 10-12/IE9 - ^= $= *= and empty values - // Should not select anything - div.innerHTML = "

    "; - if ( div.querySelectorAll("[test^='']").length ) { - rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:\"\"|'')" ); - } + // Opera 10-12/IE9 - ^= $= *= and empty values + // Should not select anything + div.innerHTML = "

    "; + if ( div.querySelectorAll("[test^='']").length ) { + rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:\"\"|'')" ); + } - // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) - // IE8 throws error here (do not put tests after this one) - div.innerHTML = ""; - if ( !div.querySelectorAll(":enabled").length ) { - rbuggyQSA.push(":enabled", ":disabled"); - } - }); + // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) + // IE8 throws error here (do not put tests after this one) + div.innerHTML = ""; + if ( !div.querySelectorAll(":enabled").length ) { + rbuggyQSA.push(":enabled", ":disabled"); + } + }); - // rbuggyQSA always contains :focus, so no need for a length check - rbuggyQSA = /* rbuggyQSA.length && */ new RegExp( rbuggyQSA.join("|") ); + // rbuggyQSA always contains :focus, so no need for a length check + rbuggyQSA = /* rbuggyQSA.length && */ new RegExp( rbuggyQSA.join("|") ); - select = function( selector, context, results, seed, xml ) { - // Only use querySelectorAll when not filtering, - // when this is not xml, - // and when no QSA bugs apply - if ( !seed && !xml && !rbuggyQSA.test( selector ) ) { - var groups, i, - old = true, - nid = expando, - newContext = context, - newSelector = context.nodeType === 9 && selector; + select = function( selector, context, results, seed, xml ) { + // Only use querySelectorAll when not filtering, + // when this is not xml, + // and when no QSA bugs apply + if ( !seed && !xml && !rbuggyQSA.test( selector ) ) { + var groups, i, + old = true, + nid = expando, + newContext = context, + newSelector = context.nodeType === 9 && selector; - // qSA works strangely on Element-rooted queries - // We can work around this by specifying an extra ID on the root - // and working up from there (Thanks to Andrew Dupont for the technique) - // IE 8 doesn't work on object elements - if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { - groups = tokenize( selector ); + // qSA works strangely on Element-rooted queries + // We can work around this by specifying an extra ID on the root + // and working up from there (Thanks to Andrew Dupont for the technique) + // IE 8 doesn't work on object elements + if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { + groups = tokenize( selector ); - if ( (old = context.getAttribute("id")) ) { - nid = old.replace( rescape, "\\$&" ); - } else { - context.setAttribute( "id", nid ); - } - nid = "[id='" + nid + "'] "; + if ( (old = context.getAttribute("id")) ) { + nid = old.replace( rescape, "\\$&" ); + } else { + context.setAttribute( "id", nid ); + } + nid = "[id='" + nid + "'] "; - i = groups.length; - while ( i-- ) { - groups[i] = nid + groups[i].join(""); - } - newContext = rsibling.test( selector ) && context.parentNode || context; - newSelector = groups.join(","); - } + i = groups.length; + while ( i-- ) { + groups[i] = nid + groups[i].join(""); + } + newContext = rsibling.test( selector ) && context.parentNode || context; + newSelector = groups.join(","); + } - if ( newSelector ) { - try { - push.apply( results, slice.call( newContext.querySelectorAll( - newSelector - ), 0 ) ); - return results; - } catch(qsaError) { - } finally { - if ( !old ) { - context.removeAttribute("id"); - } - } - } - } + if ( newSelector ) { + try { + push.apply( results, slice.call( newContext.querySelectorAll( + newSelector + ), 0 ) ); + return results; + } catch(qsaError) { + } finally { + if ( !old ) { + context.removeAttribute("id"); + } + } + } + } - return oldSelect( selector, context, results, seed, xml ); - }; + return oldSelect( selector, context, results, seed, xml ); + }; - if ( matches ) { - assert(function( div ) { - // Check to see if it's possible to do matchesSelector - // on a disconnected node (IE 9) - disconnectedMatch = matches.call( div, "div" ); + if ( matches ) { + assert(function( div ) { + // Check to see if it's possible to do matchesSelector + // on a disconnected node (IE 9) + disconnectedMatch = matches.call( div, "div" ); - // This should fail with an exception - // Gecko does not error, returns false instead - try { - matches.call( div, "[test!='']:sizzle" ); - rbuggyMatches.push( "!=", pseudos ); - } catch ( e ) {} - }); + // This should fail with an exception + // Gecko does not error, returns false instead + try { + matches.call( div, "[test!='']:sizzle" ); + rbuggyMatches.push( "!=", pseudos ); + } catch ( e ) {} + }); - // rbuggyMatches always contains :active and :focus, so no need for a length check - rbuggyMatches = /* rbuggyMatches.length && */ new RegExp( rbuggyMatches.join("|") ); + // rbuggyMatches always contains :active and :focus, so no need for a length check + rbuggyMatches = /* rbuggyMatches.length && */ new RegExp( rbuggyMatches.join("|") ); - Sizzle.matchesSelector = function( elem, expr ) { - // Make sure that attribute selectors are quoted - expr = expr.replace( rattributeQuotes, "='$1']" ); + Sizzle.matchesSelector = function( elem, expr ) { + // Make sure that attribute selectors are quoted + expr = expr.replace( rattributeQuotes, "='$1']" ); - // rbuggyMatches always contains :active, so no need for an existence check - if ( !isXML( elem ) && !rbuggyMatches.test( expr ) && !rbuggyQSA.test( expr ) ) { - try { - var ret = matches.call( elem, expr ); + // rbuggyMatches always contains :active, so no need for an existence check + if ( !isXML( elem ) && !rbuggyMatches.test( expr ) && !rbuggyQSA.test( expr ) ) { + try { + var ret = matches.call( elem, expr ); - // IE 9's matchesSelector returns false on disconnected nodes - if ( ret || disconnectedMatch || - // As well, disconnected nodes are said to be in a document - // fragment in IE 9 - elem.document && elem.document.nodeType !== 11 ) { - return ret; - } - } catch(e) {} - } + // IE 9's matchesSelector returns false on disconnected nodes + if ( ret || disconnectedMatch || + // As well, disconnected nodes are said to be in a document + // fragment in IE 9 + elem.document && elem.document.nodeType !== 11 ) { + return ret; + } + } catch(e) {} + } - return Sizzle( expr, null, null, [ elem ] ).length > 0; - }; - } - })(); + return Sizzle( expr, null, null, [ elem ] ).length > 0; + }; + } + })(); } // Deprecated @@ -5352,149 +5352,149 @@ jQuery.contains = Sizzle.contains; })( window ); var runtil = /Until$/, - rparentsprev = /^(?:parents|prev(?:Until|All))/, - isSimple = /^.[^:#\[\.,]*$/, - rneedsContext = jQuery.expr.match.needsContext, - // methods guaranteed to produce a unique set when starting from a unique set - guaranteedUnique = { - children: true, - contents: true, - next: true, - prev: true - }; + rparentsprev = /^(?:parents|prev(?:Until|All))/, + isSimple = /^.[^:#\[\.,]*$/, + rneedsContext = jQuery.expr.match.needsContext, + // methods guaranteed to produce a unique set when starting from a unique set + guaranteedUnique = { + children: true, + contents: true, + next: true, + prev: true + }; jQuery.fn.extend({ - find: function( selector ) { - var i, l, length, n, r, ret, - self = this; + find: function( selector ) { + var i, l, length, n, r, ret, + self = this; - if ( typeof selector !== "string" ) { - return jQuery( selector ).filter(function() { - for ( i = 0, l = self.length; i < l; i++ ) { - if ( jQuery.contains( self[ i ], this ) ) { - return true; - } - } - }); - } + if ( typeof selector !== "string" ) { + return jQuery( selector ).filter(function() { + for ( i = 0, l = self.length; i < l; i++ ) { + if ( jQuery.contains( self[ i ], this ) ) { + return true; + } + } + }); + } - ret = this.pushStack( "", "find", selector ); + ret = this.pushStack( "", "find", selector ); - for ( i = 0, l = this.length; i < l; i++ ) { - length = ret.length; - jQuery.find( selector, this[i], ret ); + for ( i = 0, l = this.length; i < l; i++ ) { + length = ret.length; + jQuery.find( selector, this[i], ret ); - if ( i > 0 ) { - // Make sure that the results are unique - for ( n = length; n < ret.length; n++ ) { - for ( r = 0; r < length; r++ ) { - if ( ret[r] === ret[n] ) { - ret.splice(n--, 1); - break; - } - } - } - } - } + if ( i > 0 ) { + // Make sure that the results are unique + for ( n = length; n < ret.length; n++ ) { + for ( r = 0; r < length; r++ ) { + if ( ret[r] === ret[n] ) { + ret.splice(n--, 1); + break; + } + } + } + } + } - return ret; - }, + return ret; + }, - has: function( target ) { - var i, - targets = jQuery( target, this ), - len = targets.length; + has: function( target ) { + var i, + targets = jQuery( target, this ), + len = targets.length; - return this.filter(function() { - for ( i = 0; i < len; i++ ) { - if ( jQuery.contains( this, targets[i] ) ) { - return true; - } - } - }); - }, + return this.filter(function() { + for ( i = 0; i < len; i++ ) { + if ( jQuery.contains( this, targets[i] ) ) { + return true; + } + } + }); + }, - not: function( selector ) { - return this.pushStack( winnow(this, selector, false), "not", selector); - }, + not: function( selector ) { + return this.pushStack( winnow(this, selector, false), "not", selector); + }, - filter: function( selector ) { - return this.pushStack( winnow(this, selector, true), "filter", selector ); - }, + filter: function( selector ) { + return this.pushStack( winnow(this, selector, true), "filter", selector ); + }, - is: function( selector ) { - return !!selector && ( - typeof selector === "string" ? - // If this is a positional/relative selector, check membership in the returned set - // so $("p:first").is("p:last") won't return true for a doc with two "p". - rneedsContext.test( selector ) ? - jQuery( selector, this.context ).index( this[0] ) >= 0 : - jQuery.filter( selector, this ).length > 0 : - this.filter( selector ).length > 0 ); - }, + is: function( selector ) { + return !!selector && ( + typeof selector === "string" ? + // If this is a positional/relative selector, check membership in the returned set + // so $("p:first").is("p:last") won't return true for a doc with two "p". + rneedsContext.test( selector ) ? + jQuery( selector, this.context ).index( this[0] ) >= 0 : + jQuery.filter( selector, this ).length > 0 : + this.filter( selector ).length > 0 ); + }, - closest: function( selectors, context ) { - var cur, - i = 0, - l = this.length, - ret = [], - pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? - jQuery( selectors, context || this.context ) : - 0; + closest: function( selectors, context ) { + var cur, + i = 0, + l = this.length, + ret = [], + pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? + jQuery( selectors, context || this.context ) : + 0; - for ( ; i < l; i++ ) { - cur = this[i]; + for ( ; i < l; i++ ) { + cur = this[i]; - while ( cur && cur.ownerDocument && cur !== context && cur.nodeType !== 11 ) { - if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { - ret.push( cur ); - break; - } - cur = cur.parentNode; - } - } + while ( cur && cur.ownerDocument && cur !== context && cur.nodeType !== 11 ) { + if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { + ret.push( cur ); + break; + } + cur = cur.parentNode; + } + } - ret = ret.length > 1 ? jQuery.unique( ret ) : ret; + ret = ret.length > 1 ? jQuery.unique( ret ) : ret; - return this.pushStack( ret, "closest", selectors ); - }, + return this.pushStack( ret, "closest", selectors ); + }, - // Determine the position of an element within - // the matched set of elements - index: function( elem ) { + // Determine the position of an element within + // the matched set of elements + index: function( elem ) { - // No argument, return index in parent - if ( !elem ) { - return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1; - } + // No argument, return index in parent + if ( !elem ) { + return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1; + } - // index in selector - if ( typeof elem === "string" ) { - return jQuery.inArray( this[0], jQuery( elem ) ); - } + // index in selector + if ( typeof elem === "string" ) { + return jQuery.inArray( this[0], jQuery( elem ) ); + } - // Locate the position of the desired element - return jQuery.inArray( - // If it receives a jQuery object, the first element is used - elem.jquery ? elem[0] : elem, this ); - }, + // Locate the position of the desired element + return jQuery.inArray( + // If it receives a jQuery object, the first element is used + elem.jquery ? elem[0] : elem, this ); + }, - add: function( selector, context ) { - var set = typeof selector === "string" ? - jQuery( selector, context ) : - jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), - all = jQuery.merge( this.get(), set ); + add: function( selector, context ) { + var set = typeof selector === "string" ? + jQuery( selector, context ) : + jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), + all = jQuery.merge( this.get(), set ); - return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ? - all : - jQuery.unique( all ) ); - }, + return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ? + all : + jQuery.unique( all ) ); + }, - addBack: function( selector ) { - return this.add( selector == null ? - this.prevObject : this.prevObject.filter(selector) - ); - } + addBack: function( selector ) { + return this.add( selector == null ? + this.prevObject : this.prevObject.filter(selector) + ); + } }); jQuery.fn.andSelf = jQuery.fn.addBack; @@ -5502,192 +5502,192 @@ jQuery.fn.andSelf = jQuery.fn.addBack; // A painfully simple check to see if an element is disconnected // from a document (should be improved, where feasible). function isDisconnected( node ) { - return !node || !node.parentNode || node.parentNode.nodeType === 11; + return !node || !node.parentNode || node.parentNode.nodeType === 11; } function sibling( cur, dir ) { - do { - cur = cur[ dir ]; - } while ( cur && cur.nodeType !== 1 ); + do { + cur = cur[ dir ]; + } while ( cur && cur.nodeType !== 1 ); - return cur; + return cur; } jQuery.each({ - parent: function( elem ) { - var parent = elem.parentNode; - return parent && parent.nodeType !== 11 ? parent : null; - }, - parents: function( elem ) { - return jQuery.dir( elem, "parentNode" ); - }, - parentsUntil: function( elem, i, until ) { - return jQuery.dir( elem, "parentNode", until ); - }, - next: function( elem ) { - return sibling( elem, "nextSibling" ); - }, - prev: function( elem ) { - return sibling( elem, "previousSibling" ); - }, - nextAll: function( elem ) { - return jQuery.dir( elem, "nextSibling" ); - }, - prevAll: function( elem ) { - return jQuery.dir( elem, "previousSibling" ); - }, - nextUntil: function( elem, i, until ) { - return jQuery.dir( elem, "nextSibling", until ); - }, - prevUntil: function( elem, i, until ) { - return jQuery.dir( elem, "previousSibling", until ); - }, - siblings: function( elem ) { - return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); - }, - children: function( elem ) { - return jQuery.sibling( elem.firstChild ); - }, - contents: function( elem ) { - return jQuery.nodeName( elem, "iframe" ) ? - elem.contentDocument || elem.contentWindow.document : - jQuery.merge( [], elem.childNodes ); - } + parent: function( elem ) { + var parent = elem.parentNode; + return parent && parent.nodeType !== 11 ? parent : null; + }, + parents: function( elem ) { + return jQuery.dir( elem, "parentNode" ); + }, + parentsUntil: function( elem, i, until ) { + return jQuery.dir( elem, "parentNode", until ); + }, + next: function( elem ) { + return sibling( elem, "nextSibling" ); + }, + prev: function( elem ) { + return sibling( elem, "previousSibling" ); + }, + nextAll: function( elem ) { + return jQuery.dir( elem, "nextSibling" ); + }, + prevAll: function( elem ) { + return jQuery.dir( elem, "previousSibling" ); + }, + nextUntil: function( elem, i, until ) { + return jQuery.dir( elem, "nextSibling", until ); + }, + prevUntil: function( elem, i, until ) { + return jQuery.dir( elem, "previousSibling", until ); + }, + siblings: function( elem ) { + return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); + }, + children: function( elem ) { + return jQuery.sibling( elem.firstChild ); + }, + contents: function( elem ) { + return jQuery.nodeName( elem, "iframe" ) ? + elem.contentDocument || elem.contentWindow.document : + jQuery.merge( [], elem.childNodes ); + } }, function( name, fn ) { - jQuery.fn[ name ] = function( until, selector ) { - var ret = jQuery.map( this, fn, until ); + jQuery.fn[ name ] = function( until, selector ) { + var ret = jQuery.map( this, fn, until ); - if ( !runtil.test( name ) ) { - selector = until; - } + if ( !runtil.test( name ) ) { + selector = until; + } - if ( selector && typeof selector === "string" ) { - ret = jQuery.filter( selector, ret ); - } + if ( selector && typeof selector === "string" ) { + ret = jQuery.filter( selector, ret ); + } - ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret; + ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret; - if ( this.length > 1 && rparentsprev.test( name ) ) { - ret = ret.reverse(); - } + if ( this.length > 1 && rparentsprev.test( name ) ) { + ret = ret.reverse(); + } - return this.pushStack( ret, name, core_slice.call( arguments ).join(",") ); - }; + return this.pushStack( ret, name, core_slice.call( arguments ).join(",") ); + }; }); jQuery.extend({ - filter: function( expr, elems, not ) { - if ( not ) { - expr = ":not(" + expr + ")"; - } + filter: function( expr, elems, not ) { + if ( not ) { + expr = ":not(" + expr + ")"; + } - return elems.length === 1 ? - jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] : - jQuery.find.matches(expr, elems); - }, + return elems.length === 1 ? + jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] : + jQuery.find.matches(expr, elems); + }, - dir: function( elem, dir, until ) { - var matched = [], - cur = elem[ dir ]; + dir: function( elem, dir, until ) { + var matched = [], + cur = elem[ dir ]; - while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { - if ( cur.nodeType === 1 ) { - matched.push( cur ); - } - cur = cur[dir]; - } - return matched; - }, + while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { + if ( cur.nodeType === 1 ) { + matched.push( cur ); + } + cur = cur[dir]; + } + return matched; + }, - sibling: function( n, elem ) { - var r = []; + sibling: function( n, elem ) { + var r = []; - for ( ; n; n = n.nextSibling ) { - if ( n.nodeType === 1 && n !== elem ) { - r.push( n ); - } - } + for ( ; n; n = n.nextSibling ) { + if ( n.nodeType === 1 && n !== elem ) { + r.push( n ); + } + } - return r; - } + return r; + } }); // Implement the identical functionality for filter and not function winnow( elements, qualifier, keep ) { - // Can't pass null or undefined to indexOf in Firefox 4 - // Set to 0 to skip string check - qualifier = qualifier || 0; + // Can't pass null or undefined to indexOf in Firefox 4 + // Set to 0 to skip string check + qualifier = qualifier || 0; - if ( jQuery.isFunction( qualifier ) ) { - return jQuery.grep(elements, function( elem, i ) { - var retVal = !!qualifier.call( elem, i, elem ); - return retVal === keep; - }); + if ( jQuery.isFunction( qualifier ) ) { + return jQuery.grep(elements, function( elem, i ) { + var retVal = !!qualifier.call( elem, i, elem ); + return retVal === keep; + }); - } else if ( qualifier.nodeType ) { - return jQuery.grep(elements, function( elem, i ) { - return ( elem === qualifier ) === keep; - }); + } else if ( qualifier.nodeType ) { + return jQuery.grep(elements, function( elem, i ) { + return ( elem === qualifier ) === keep; + }); - } else if ( typeof qualifier === "string" ) { - var filtered = jQuery.grep(elements, function( elem ) { - return elem.nodeType === 1; - }); + } else if ( typeof qualifier === "string" ) { + var filtered = jQuery.grep(elements, function( elem ) { + return elem.nodeType === 1; + }); - if ( isSimple.test( qualifier ) ) { - return jQuery.filter(qualifier, filtered, !keep); - } else { - qualifier = jQuery.filter( qualifier, filtered ); - } - } + if ( isSimple.test( qualifier ) ) { + return jQuery.filter(qualifier, filtered, !keep); + } else { + qualifier = jQuery.filter( qualifier, filtered ); + } + } - return jQuery.grep(elements, function( elem, i ) { - return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep; - }); + return jQuery.grep(elements, function( elem, i ) { + return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep; + }); } function createSafeFragment( document ) { - var list = nodeNames.split( "|" ), - safeFrag = document.createDocumentFragment(); + var list = nodeNames.split( "|" ), + safeFrag = document.createDocumentFragment(); - if ( safeFrag.createElement ) { - while ( list.length ) { - safeFrag.createElement( - list.pop() - ); - } - } - return safeFrag; + if ( safeFrag.createElement ) { + while ( list.length ) { + safeFrag.createElement( + list.pop() + ); + } + } + return safeFrag; } var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + - "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", - rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, - rleadingWhitespace = /^\s+/, - rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, - rtagName = /<([\w:]+)/, - rtbody = /]", "i"), - rcheckableType = /^(?:checkbox|radio)$/, - // checked="checked" or checked - rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, - rscriptType = /\/(java|ecma)script/i, - rcleanScript = /^\s*\s*$/g, - wrapMap = { - option: [ 1, "" ], - legend: [ 1, "
    ", "
    " ], - thead: [ 1, "", "
    " ], - tr: [ 2, "", "
    " ], - td: [ 3, "", "
    " ], - col: [ 2, "", "
    " ], - area: [ 1, "", "" ], - _default: [ 0, "", "" ] - }, - safeFragment = createSafeFragment( document ), - fragmentDiv = safeFragment.appendChild( document.createElement("div") ); + "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", + rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, + rleadingWhitespace = /^\s+/, + rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, + rtagName = /<([\w:]+)/, + rtbody = /]", "i"), + rcheckableType = /^(?:checkbox|radio)$/, + // checked="checked" or checked + rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, + rscriptType = /\/(java|ecma)script/i, + rcleanScript = /^\s*\s*$/g, + wrapMap = { + option: [ 1, "" ], + legend: [ 1, "
    ", "
    " ], + thead: [ 1, "", "
    " ], + tr: [ 2, "", "
    " ], + td: [ 3, "", "
    " ], + col: [ 2, "", "
    " ], + area: [ 1, "", "" ], + _default: [ 0, "", "" ] + }, + safeFragment = createSafeFragment( document ), + fragmentDiv = safeFragment.appendChild( document.createElement("div") ); wrapMap.optgroup = wrapMap.option; wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; @@ -5696,781 +5696,781 @@ wrapMap.th = wrapMap.td; // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags, // unless wrapped in a div with non-breaking characters in front of it. if ( !jQuery.support.htmlSerialize ) { - wrapMap._default = [ 1, "X
    ", "
    " ]; + wrapMap._default = [ 1, "X
    ", "
    " ]; } jQuery.fn.extend({ - text: function( value ) { - return jQuery.access( this, function( value ) { - return value === undefined ? - jQuery.text( this ) : - this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) ); - }, null, value, arguments.length ); - }, + text: function( value ) { + return jQuery.access( this, function( value ) { + return value === undefined ? + jQuery.text( this ) : + this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) ); + }, null, value, arguments.length ); + }, - wrapAll: function( html ) { - if ( jQuery.isFunction( html ) ) { - return this.each(function(i) { - jQuery(this).wrapAll( html.call(this, i) ); - }); - } + wrapAll: function( html ) { + if ( jQuery.isFunction( html ) ) { + return this.each(function(i) { + jQuery(this).wrapAll( html.call(this, i) ); + }); + } - if ( this[0] ) { - // The elements to wrap the target around - var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true); + if ( this[0] ) { + // The elements to wrap the target around + var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true); - if ( this[0].parentNode ) { - wrap.insertBefore( this[0] ); - } + if ( this[0].parentNode ) { + wrap.insertBefore( this[0] ); + } - wrap.map(function() { - var elem = this; + wrap.map(function() { + var elem = this; - while ( elem.firstChild && elem.firstChild.nodeType === 1 ) { - elem = elem.firstChild; - } + while ( elem.firstChild && elem.firstChild.nodeType === 1 ) { + elem = elem.firstChild; + } - return elem; - }).append( this ); - } + return elem; + }).append( this ); + } - return this; - }, + return this; + }, - wrapInner: function( html ) { - if ( jQuery.isFunction( html ) ) { - return this.each(function(i) { - jQuery(this).wrapInner( html.call(this, i) ); - }); - } + wrapInner: function( html ) { + if ( jQuery.isFunction( html ) ) { + return this.each(function(i) { + jQuery(this).wrapInner( html.call(this, i) ); + }); + } - return this.each(function() { - var self = jQuery( this ), - contents = self.contents(); + return this.each(function() { + var self = jQuery( this ), + contents = self.contents(); - if ( contents.length ) { - contents.wrapAll( html ); + if ( contents.length ) { + contents.wrapAll( html ); - } else { - self.append( html ); - } - }); - }, + } else { + self.append( html ); + } + }); + }, - wrap: function( html ) { - var isFunction = jQuery.isFunction( html ); + wrap: function( html ) { + var isFunction = jQuery.isFunction( html ); - return this.each(function(i) { - jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html ); - }); - }, + return this.each(function(i) { + jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html ); + }); + }, - unwrap: function() { - return this.parent().each(function() { - if ( !jQuery.nodeName( this, "body" ) ) { - jQuery( this ).replaceWith( this.childNodes ); - } - }).end(); - }, + unwrap: function() { + return this.parent().each(function() { + if ( !jQuery.nodeName( this, "body" ) ) { + jQuery( this ).replaceWith( this.childNodes ); + } + }).end(); + }, - append: function() { - return this.domManip(arguments, true, function( elem ) { - if ( this.nodeType === 1 || this.nodeType === 11 ) { - this.appendChild( elem ); - } - }); - }, + append: function() { + return this.domManip(arguments, true, function( elem ) { + if ( this.nodeType === 1 || this.nodeType === 11 ) { + this.appendChild( elem ); + } + }); + }, - prepend: function() { - return this.domManip(arguments, true, function( elem ) { - if ( this.nodeType === 1 || this.nodeType === 11 ) { - this.insertBefore( elem, this.firstChild ); - } - }); - }, + prepend: function() { + return this.domManip(arguments, true, function( elem ) { + if ( this.nodeType === 1 || this.nodeType === 11 ) { + this.insertBefore( elem, this.firstChild ); + } + }); + }, - before: function() { - if ( !isDisconnected( this[0] ) ) { - return this.domManip(arguments, false, function( elem ) { - this.parentNode.insertBefore( elem, this ); - }); - } + before: function() { + if ( !isDisconnected( this[0] ) ) { + return this.domManip(arguments, false, function( elem ) { + this.parentNode.insertBefore( elem, this ); + }); + } - if ( arguments.length ) { - var set = jQuery.clean( arguments ); - return this.pushStack( jQuery.merge( set, this ), "before", this.selector ); - } - }, + if ( arguments.length ) { + var set = jQuery.clean( arguments ); + return this.pushStack( jQuery.merge( set, this ), "before", this.selector ); + } + }, - after: function() { - if ( !isDisconnected( this[0] ) ) { - return this.domManip(arguments, false, function( elem ) { - this.parentNode.insertBefore( elem, this.nextSibling ); - }); - } + after: function() { + if ( !isDisconnected( this[0] ) ) { + return this.domManip(arguments, false, function( elem ) { + this.parentNode.insertBefore( elem, this.nextSibling ); + }); + } - if ( arguments.length ) { - var set = jQuery.clean( arguments ); - return this.pushStack( jQuery.merge( this, set ), "after", this.selector ); - } - }, + if ( arguments.length ) { + var set = jQuery.clean( arguments ); + return this.pushStack( jQuery.merge( this, set ), "after", this.selector ); + } + }, - // keepData is for internal use only--do not document - remove: function( selector, keepData ) { - var elem, - i = 0; + // keepData is for internal use only--do not document + remove: function( selector, keepData ) { + var elem, + i = 0; - for ( ; (elem = this[i]) != null; i++ ) { - if ( !selector || jQuery.filter( selector, [ elem ] ).length ) { - if ( !keepData && elem.nodeType === 1 ) { - jQuery.cleanData( elem.getElementsByTagName("*") ); - jQuery.cleanData( [ elem ] ); - } + for ( ; (elem = this[i]) != null; i++ ) { + if ( !selector || jQuery.filter( selector, [ elem ] ).length ) { + if ( !keepData && elem.nodeType === 1 ) { + jQuery.cleanData( elem.getElementsByTagName("*") ); + jQuery.cleanData( [ elem ] ); + } - if ( elem.parentNode ) { - elem.parentNode.removeChild( elem ); - } - } - } + if ( elem.parentNode ) { + elem.parentNode.removeChild( elem ); + } + } + } - return this; - }, + return this; + }, - empty: function() { - var elem, - i = 0; + empty: function() { + var elem, + i = 0; - for ( ; (elem = this[i]) != null; i++ ) { - // Remove element nodes and prevent memory leaks - if ( elem.nodeType === 1 ) { - jQuery.cleanData( elem.getElementsByTagName("*") ); - } + for ( ; (elem = this[i]) != null; i++ ) { + // Remove element nodes and prevent memory leaks + if ( elem.nodeType === 1 ) { + jQuery.cleanData( elem.getElementsByTagName("*") ); + } - // Remove any remaining nodes - while ( elem.firstChild ) { - elem.removeChild( elem.firstChild ); - } - } + // Remove any remaining nodes + while ( elem.firstChild ) { + elem.removeChild( elem.firstChild ); + } + } - return this; - }, + return this; + }, - clone: function( dataAndEvents, deepDataAndEvents ) { - dataAndEvents = dataAndEvents == null ? false : dataAndEvents; - deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; + clone: function( dataAndEvents, deepDataAndEvents ) { + dataAndEvents = dataAndEvents == null ? false : dataAndEvents; + deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; - return this.map( function () { - return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); - }); - }, + return this.map( function () { + return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); + }); + }, - html: function( value ) { - return jQuery.access( this, function( value ) { - var elem = this[0] || {}, - i = 0, - l = this.length; + html: function( value ) { + return jQuery.access( this, function( value ) { + var elem = this[0] || {}, + i = 0, + l = this.length; - if ( value === undefined ) { - return elem.nodeType === 1 ? - elem.innerHTML.replace( rinlinejQuery, "" ) : - undefined; - } + if ( value === undefined ) { + return elem.nodeType === 1 ? + elem.innerHTML.replace( rinlinejQuery, "" ) : + undefined; + } - // See if we can take a shortcut and just use innerHTML - if ( typeof value === "string" && !rnoInnerhtml.test( value ) && - ( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) && - ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) && - !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) { + // See if we can take a shortcut and just use innerHTML + if ( typeof value === "string" && !rnoInnerhtml.test( value ) && + ( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) && + ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) && + !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) { - value = value.replace( rxhtmlTag, "<$1>" ); + value = value.replace( rxhtmlTag, "<$1>" ); - try { - for (; i < l; i++ ) { - // Remove element nodes and prevent memory leaks - elem = this[i] || {}; - if ( elem.nodeType === 1 ) { - jQuery.cleanData( elem.getElementsByTagName( "*" ) ); - elem.innerHTML = value; - } - } + try { + for (; i < l; i++ ) { + // Remove element nodes and prevent memory leaks + elem = this[i] || {}; + if ( elem.nodeType === 1 ) { + jQuery.cleanData( elem.getElementsByTagName( "*" ) ); + elem.innerHTML = value; + } + } - elem = 0; + elem = 0; - // If using innerHTML throws an exception, use the fallback method - } catch(e) {} - } + // If using innerHTML throws an exception, use the fallback method + } catch(e) {} + } - if ( elem ) { - this.empty().append( value ); - } - }, null, value, arguments.length ); - }, + if ( elem ) { + this.empty().append( value ); + } + }, null, value, arguments.length ); + }, - replaceWith: function( value ) { - if ( !isDisconnected( this[0] ) ) { - // Make sure that the elements are removed from the DOM before they are inserted - // this can help fix replacing a parent with child elements - if ( jQuery.isFunction( value ) ) { - return this.each(function(i) { - var self = jQuery(this), old = self.html(); - self.replaceWith( value.call( this, i, old ) ); - }); - } + replaceWith: function( value ) { + if ( !isDisconnected( this[0] ) ) { + // Make sure that the elements are removed from the DOM before they are inserted + // this can help fix replacing a parent with child elements + if ( jQuery.isFunction( value ) ) { + return this.each(function(i) { + var self = jQuery(this), old = self.html(); + self.replaceWith( value.call( this, i, old ) ); + }); + } - if ( typeof value !== "string" ) { - value = jQuery( value ).detach(); - } + if ( typeof value !== "string" ) { + value = jQuery( value ).detach(); + } - return this.each(function() { - var next = this.nextSibling, - parent = this.parentNode; + return this.each(function() { + var next = this.nextSibling, + parent = this.parentNode; - jQuery( this ).remove(); + jQuery( this ).remove(); - if ( next ) { - jQuery(next).before( value ); - } else { - jQuery(parent).append( value ); - } - }); - } + if ( next ) { + jQuery(next).before( value ); + } else { + jQuery(parent).append( value ); + } + }); + } - return this.length ? - this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ) : - this; - }, + return this.length ? + this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ) : + this; + }, - detach: function( selector ) { - return this.remove( selector, true ); - }, + detach: function( selector ) { + return this.remove( selector, true ); + }, - domManip: function( args, table, callback ) { + domManip: function( args, table, callback ) { - // Flatten any nested arrays - args = [].concat.apply( [], args ); + // Flatten any nested arrays + args = [].concat.apply( [], args ); - var results, first, fragment, iNoClone, - i = 0, - value = args[0], - scripts = [], - l = this.length; + var results, first, fragment, iNoClone, + i = 0, + value = args[0], + scripts = [], + l = this.length; - // We can't cloneNode fragments that contain checked, in WebKit - if ( !jQuery.support.checkClone && l > 1 && typeof value === "string" && rchecked.test( value ) ) { - return this.each(function() { - jQuery(this).domManip( args, table, callback ); - }); - } + // We can't cloneNode fragments that contain checked, in WebKit + if ( !jQuery.support.checkClone && l > 1 && typeof value === "string" && rchecked.test( value ) ) { + return this.each(function() { + jQuery(this).domManip( args, table, callback ); + }); + } - if ( jQuery.isFunction(value) ) { - return this.each(function(i) { - var self = jQuery(this); - args[0] = value.call( this, i, table ? self.html() : undefined ); - self.domManip( args, table, callback ); - }); - } + if ( jQuery.isFunction(value) ) { + return this.each(function(i) { + var self = jQuery(this); + args[0] = value.call( this, i, table ? self.html() : undefined ); + self.domManip( args, table, callback ); + }); + } - if ( this[0] ) { - results = jQuery.buildFragment( args, this, scripts ); - fragment = results.fragment; - first = fragment.firstChild; + if ( this[0] ) { + results = jQuery.buildFragment( args, this, scripts ); + fragment = results.fragment; + first = fragment.firstChild; - if ( fragment.childNodes.length === 1 ) { - fragment = first; - } + if ( fragment.childNodes.length === 1 ) { + fragment = first; + } - if ( first ) { - table = table && jQuery.nodeName( first, "tr" ); + if ( first ) { + table = table && jQuery.nodeName( first, "tr" ); - // Use the original fragment for the last item instead of the first because it can end up - // being emptied incorrectly in certain situations (#8070). - // Fragments from the fragment cache must always be cloned and never used in place. - for ( iNoClone = results.cacheable || l - 1; i < l; i++ ) { - callback.call( - table && jQuery.nodeName( this[i], "table" ) ? - findOrAppend( this[i], "tbody" ) : - this[i], - i === iNoClone ? - fragment : - jQuery.clone( fragment, true, true ) - ); - } - } + // Use the original fragment for the last item instead of the first because it can end up + // being emptied incorrectly in certain situations (#8070). + // Fragments from the fragment cache must always be cloned and never used in place. + for ( iNoClone = results.cacheable || l - 1; i < l; i++ ) { + callback.call( + table && jQuery.nodeName( this[i], "table" ) ? + findOrAppend( this[i], "tbody" ) : + this[i], + i === iNoClone ? + fragment : + jQuery.clone( fragment, true, true ) + ); + } + } - // Fix #11809: Avoid leaking memory - fragment = first = null; + // Fix #11809: Avoid leaking memory + fragment = first = null; - if ( scripts.length ) { - jQuery.each( scripts, function( i, elem ) { - if ( elem.src ) { - if ( jQuery.ajax ) { - jQuery.ajax({ - url: elem.src, - type: "GET", - dataType: "script", - async: false, - global: false, - "throws": true - }); - } else { - jQuery.error("no ajax"); - } - } else { - jQuery.globalEval( ( elem.text || elem.textContent || elem.innerHTML || "" ).replace( rcleanScript, "" ) ); - } + if ( scripts.length ) { + jQuery.each( scripts, function( i, elem ) { + if ( elem.src ) { + if ( jQuery.ajax ) { + jQuery.ajax({ + url: elem.src, + type: "GET", + dataType: "script", + async: false, + global: false, + "throws": true + }); + } else { + jQuery.error("no ajax"); + } + } else { + jQuery.globalEval( ( elem.text || elem.textContent || elem.innerHTML || "" ).replace( rcleanScript, "" ) ); + } - if ( elem.parentNode ) { - elem.parentNode.removeChild( elem ); - } - }); - } - } + if ( elem.parentNode ) { + elem.parentNode.removeChild( elem ); + } + }); + } + } - return this; - } + return this; + } }); function findOrAppend( elem, tag ) { - return elem.getElementsByTagName( tag )[0] || elem.appendChild( elem.ownerDocument.createElement( tag ) ); + return elem.getElementsByTagName( tag )[0] || elem.appendChild( elem.ownerDocument.createElement( tag ) ); } function cloneCopyEvent( src, dest ) { - if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { - return; - } + if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { + return; + } - var type, i, l, - oldData = jQuery._data( src ), - curData = jQuery._data( dest, oldData ), - events = oldData.events; + var type, i, l, + oldData = jQuery._data( src ), + curData = jQuery._data( dest, oldData ), + events = oldData.events; - if ( events ) { - delete curData.handle; - curData.events = {}; + if ( events ) { + delete curData.handle; + curData.events = {}; - for ( type in events ) { - for ( i = 0, l = events[ type ].length; i < l; i++ ) { - jQuery.event.add( dest, type, events[ type ][ i ] ); - } - } - } + for ( type in events ) { + for ( i = 0, l = events[ type ].length; i < l; i++ ) { + jQuery.event.add( dest, type, events[ type ][ i ] ); + } + } + } - // make the cloned public data object a copy from the original - if ( curData.data ) { - curData.data = jQuery.extend( {}, curData.data ); - } + // make the cloned public data object a copy from the original + if ( curData.data ) { + curData.data = jQuery.extend( {}, curData.data ); + } } function cloneFixAttributes( src, dest ) { - var nodeName; + var nodeName; - // We do not need to do anything for non-Elements - if ( dest.nodeType !== 1 ) { - return; - } + // We do not need to do anything for non-Elements + if ( dest.nodeType !== 1 ) { + return; + } - // clearAttributes removes the attributes, which we don't want, - // but also removes the attachEvent events, which we *do* want - if ( dest.clearAttributes ) { - dest.clearAttributes(); - } + // clearAttributes removes the attributes, which we don't want, + // but also removes the attachEvent events, which we *do* want + if ( dest.clearAttributes ) { + dest.clearAttributes(); + } - // mergeAttributes, in contrast, only merges back on the - // original attributes, not the events - if ( dest.mergeAttributes ) { - dest.mergeAttributes( src ); - } + // mergeAttributes, in contrast, only merges back on the + // original attributes, not the events + if ( dest.mergeAttributes ) { + dest.mergeAttributes( src ); + } - nodeName = dest.nodeName.toLowerCase(); + nodeName = dest.nodeName.toLowerCase(); - if ( nodeName === "object" ) { - // IE6-10 improperly clones children of object elements using classid. - // IE10 throws NoModificationAllowedError if parent is null, #12132. - if ( dest.parentNode ) { - dest.outerHTML = src.outerHTML; - } + if ( nodeName === "object" ) { + // IE6-10 improperly clones children of object elements using classid. + // IE10 throws NoModificationAllowedError if parent is null, #12132. + if ( dest.parentNode ) { + dest.outerHTML = src.outerHTML; + } - // This path appears unavoidable for IE9. When cloning an object - // element in IE9, the outerHTML strategy above is not sufficient. - // If the src has innerHTML and the destination does not, - // copy the src.innerHTML into the dest.innerHTML. #10324 - if ( jQuery.support.html5Clone && (src.innerHTML && !jQuery.trim(dest.innerHTML)) ) { - dest.innerHTML = src.innerHTML; - } + // This path appears unavoidable for IE9. When cloning an object + // element in IE9, the outerHTML strategy above is not sufficient. + // If the src has innerHTML and the destination does not, + // copy the src.innerHTML into the dest.innerHTML. #10324 + if ( jQuery.support.html5Clone && (src.innerHTML && !jQuery.trim(dest.innerHTML)) ) { + dest.innerHTML = src.innerHTML; + } - } else if ( nodeName === "input" && rcheckableType.test( src.type ) ) { - // IE6-8 fails to persist the checked state of a cloned checkbox - // or radio button. Worse, IE6-7 fail to give the cloned element - // a checked appearance if the defaultChecked value isn't also set + } else if ( nodeName === "input" && rcheckableType.test( src.type ) ) { + // IE6-8 fails to persist the checked state of a cloned checkbox + // or radio button. Worse, IE6-7 fail to give the cloned element + // a checked appearance if the defaultChecked value isn't also set - dest.defaultChecked = dest.checked = src.checked; + dest.defaultChecked = dest.checked = src.checked; - // IE6-7 get confused and end up setting the value of a cloned - // checkbox/radio button to an empty string instead of "on" - if ( dest.value !== src.value ) { - dest.value = src.value; - } + // IE6-7 get confused and end up setting the value of a cloned + // checkbox/radio button to an empty string instead of "on" + if ( dest.value !== src.value ) { + dest.value = src.value; + } - // IE6-8 fails to return the selected option to the default selected - // state when cloning options - } else if ( nodeName === "option" ) { - dest.selected = src.defaultSelected; + // IE6-8 fails to return the selected option to the default selected + // state when cloning options + } else if ( nodeName === "option" ) { + dest.selected = src.defaultSelected; - // IE6-8 fails to set the defaultValue to the correct value when - // cloning other types of input fields - } else if ( nodeName === "input" || nodeName === "textarea" ) { - dest.defaultValue = src.defaultValue; + // IE6-8 fails to set the defaultValue to the correct value when + // cloning other types of input fields + } else if ( nodeName === "input" || nodeName === "textarea" ) { + dest.defaultValue = src.defaultValue; - // IE blanks contents when cloning scripts - } else if ( nodeName === "script" && dest.text !== src.text ) { - dest.text = src.text; - } + // IE blanks contents when cloning scripts + } else if ( nodeName === "script" && dest.text !== src.text ) { + dest.text = src.text; + } - // Event data gets referenced instead of copied if the expando - // gets copied too - dest.removeAttribute( jQuery.expando ); + // Event data gets referenced instead of copied if the expando + // gets copied too + dest.removeAttribute( jQuery.expando ); } jQuery.buildFragment = function( args, context, scripts ) { - var fragment, cacheable, cachehit, - first = args[ 0 ]; + var fragment, cacheable, cachehit, + first = args[ 0 ]; - // Set context from what may come in as undefined or a jQuery collection or a node - // Updated to fix #12266 where accessing context[0] could throw an exception in IE9/10 & - // also doubles as fix for #8950 where plain objects caused createDocumentFragment exception - context = context || document; - context = !context.nodeType && context[0] || context; - context = context.ownerDocument || context; + // Set context from what may come in as undefined or a jQuery collection or a node + // Updated to fix #12266 where accessing context[0] could throw an exception in IE9/10 & + // also doubles as fix for #8950 where plain objects caused createDocumentFragment exception + context = context || document; + context = !context.nodeType && context[0] || context; + context = context.ownerDocument || context; - // Only cache "small" (1/2 KB) HTML strings that are associated with the main document - // Cloning options loses the selected state, so don't cache them - // IE 6 doesn't like it when you put or elements in a fragment - // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache - // Lastly, IE6,7,8 will not correctly reuse cached fragments that were created from unknown elems #10501 - if ( args.length === 1 && typeof first === "string" && first.length < 512 && context === document && - first.charAt(0) === "<" && !rnocache.test( first ) && - (jQuery.support.checkClone || !rchecked.test( first )) && - (jQuery.support.html5Clone || !rnoshimcache.test( first )) ) { + // Only cache "small" (1/2 KB) HTML strings that are associated with the main document + // Cloning options loses the selected state, so don't cache them + // IE 6 doesn't like it when you put or elements in a fragment + // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache + // Lastly, IE6,7,8 will not correctly reuse cached fragments that were created from unknown elems #10501 + if ( args.length === 1 && typeof first === "string" && first.length < 512 && context === document && + first.charAt(0) === "<" && !rnocache.test( first ) && + (jQuery.support.checkClone || !rchecked.test( first )) && + (jQuery.support.html5Clone || !rnoshimcache.test( first )) ) { - // Mark cacheable and look for a hit - cacheable = true; - fragment = jQuery.fragments[ first ]; - cachehit = fragment !== undefined; - } + // Mark cacheable and look for a hit + cacheable = true; + fragment = jQuery.fragments[ first ]; + cachehit = fragment !== undefined; + } - if ( !fragment ) { - fragment = context.createDocumentFragment(); - jQuery.clean( args, context, fragment, scripts ); + if ( !fragment ) { + fragment = context.createDocumentFragment(); + jQuery.clean( args, context, fragment, scripts ); - // Update the cache, but only store false - // unless this is a second parsing of the same content - if ( cacheable ) { - jQuery.fragments[ first ] = cachehit && fragment; - } - } + // Update the cache, but only store false + // unless this is a second parsing of the same content + if ( cacheable ) { + jQuery.fragments[ first ] = cachehit && fragment; + } + } - return { fragment: fragment, cacheable: cacheable }; + return { fragment: fragment, cacheable: cacheable }; }; jQuery.fragments = {}; jQuery.each({ - appendTo: "append", - prependTo: "prepend", - insertBefore: "before", - insertAfter: "after", - replaceAll: "replaceWith" + appendTo: "append", + prependTo: "prepend", + insertBefore: "before", + insertAfter: "after", + replaceAll: "replaceWith" }, function( name, original ) { - jQuery.fn[ name ] = function( selector ) { - var elems, - i = 0, - ret = [], - insert = jQuery( selector ), - l = insert.length, - parent = this.length === 1 && this[0].parentNode; + jQuery.fn[ name ] = function( selector ) { + var elems, + i = 0, + ret = [], + insert = jQuery( selector ), + l = insert.length, + parent = this.length === 1 && this[0].parentNode; - if ( (parent == null || parent && parent.nodeType === 11 && parent.childNodes.length === 1) && l === 1 ) { - insert[ original ]( this[0] ); - return this; - } else { - for ( ; i < l; i++ ) { - elems = ( i > 0 ? this.clone(true) : this ).get(); - jQuery( insert[i] )[ original ]( elems ); - ret = ret.concat( elems ); - } + if ( (parent == null || parent && parent.nodeType === 11 && parent.childNodes.length === 1) && l === 1 ) { + insert[ original ]( this[0] ); + return this; + } else { + for ( ; i < l; i++ ) { + elems = ( i > 0 ? this.clone(true) : this ).get(); + jQuery( insert[i] )[ original ]( elems ); + ret = ret.concat( elems ); + } - return this.pushStack( ret, name, insert.selector ); - } - }; + return this.pushStack( ret, name, insert.selector ); + } + }; }); function getAll( elem ) { - if ( typeof elem.getElementsByTagName !== "undefined" ) { - return elem.getElementsByTagName( "*" ); + if ( typeof elem.getElementsByTagName !== "undefined" ) { + return elem.getElementsByTagName( "*" ); - } else if ( typeof elem.querySelectorAll !== "undefined" ) { - return elem.querySelectorAll( "*" ); + } else if ( typeof elem.querySelectorAll !== "undefined" ) { + return elem.querySelectorAll( "*" ); - } else { - return []; - } + } else { + return []; + } } // Used in clean, fixes the defaultChecked property function fixDefaultChecked( elem ) { - if ( rcheckableType.test( elem.type ) ) { - elem.defaultChecked = elem.checked; - } + if ( rcheckableType.test( elem.type ) ) { + elem.defaultChecked = elem.checked; + } } jQuery.extend({ - clone: function( elem, dataAndEvents, deepDataAndEvents ) { - var srcElements, - destElements, - i, - clone; + clone: function( elem, dataAndEvents, deepDataAndEvents ) { + var srcElements, + destElements, + i, + clone; - if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) { - clone = elem.cloneNode( true ); + if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) { + clone = elem.cloneNode( true ); - // IE<=8 does not properly clone detached, unknown element nodes - } else { - fragmentDiv.innerHTML = elem.outerHTML; - fragmentDiv.removeChild( clone = fragmentDiv.firstChild ); - } + // IE<=8 does not properly clone detached, unknown element nodes + } else { + fragmentDiv.innerHTML = elem.outerHTML; + fragmentDiv.removeChild( clone = fragmentDiv.firstChild ); + } - if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) && - (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) { - // IE copies events bound via attachEvent when using cloneNode. - // Calling detachEvent on the clone will also remove the events - // from the original. In order to get around this, we use some - // proprietary methods to clear the events. Thanks to MooTools - // guys for this hotness. + if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) && + (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) { + // IE copies events bound via attachEvent when using cloneNode. + // Calling detachEvent on the clone will also remove the events + // from the original. In order to get around this, we use some + // proprietary methods to clear the events. Thanks to MooTools + // guys for this hotness. - cloneFixAttributes( elem, clone ); + cloneFixAttributes( elem, clone ); - // Using Sizzle here is crazy slow, so we use getElementsByTagName instead - srcElements = getAll( elem ); - destElements = getAll( clone ); + // Using Sizzle here is crazy slow, so we use getElementsByTagName instead + srcElements = getAll( elem ); + destElements = getAll( clone ); - // Weird iteration because IE will replace the length property - // with an element if you are cloning the body and one of the - // elements on the page has a name or id of "length" - for ( i = 0; srcElements[i]; ++i ) { - // Ensure that the destination node is not null; Fixes #9587 - if ( destElements[i] ) { - cloneFixAttributes( srcElements[i], destElements[i] ); - } - } - } + // Weird iteration because IE will replace the length property + // with an element if you are cloning the body and one of the + // elements on the page has a name or id of "length" + for ( i = 0; srcElements[i]; ++i ) { + // Ensure that the destination node is not null; Fixes #9587 + if ( destElements[i] ) { + cloneFixAttributes( srcElements[i], destElements[i] ); + } + } + } - // Copy the events from the original to the clone - if ( dataAndEvents ) { - cloneCopyEvent( elem, clone ); + // Copy the events from the original to the clone + if ( dataAndEvents ) { + cloneCopyEvent( elem, clone ); - if ( deepDataAndEvents ) { - srcElements = getAll( elem ); - destElements = getAll( clone ); + if ( deepDataAndEvents ) { + srcElements = getAll( elem ); + destElements = getAll( clone ); - for ( i = 0; srcElements[i]; ++i ) { - cloneCopyEvent( srcElements[i], destElements[i] ); - } - } - } + for ( i = 0; srcElements[i]; ++i ) { + cloneCopyEvent( srcElements[i], destElements[i] ); + } + } + } - srcElements = destElements = null; + srcElements = destElements = null; - // Return the cloned set - return clone; - }, + // Return the cloned set + return clone; + }, - clean: function( elems, context, fragment, scripts ) { - var i, j, elem, tag, wrap, depth, div, hasBody, tbody, len, handleScript, jsTags, - safe = context === document && safeFragment, - ret = []; + clean: function( elems, context, fragment, scripts ) { + var i, j, elem, tag, wrap, depth, div, hasBody, tbody, len, handleScript, jsTags, + safe = context === document && safeFragment, + ret = []; - // Ensure that context is a document - if ( !context || typeof context.createDocumentFragment === "undefined" ) { - context = document; - } + // Ensure that context is a document + if ( !context || typeof context.createDocumentFragment === "undefined" ) { + context = document; + } - // Use the already-created safe fragment if context permits - for ( i = 0; (elem = elems[i]) != null; i++ ) { - if ( typeof elem === "number" ) { - elem += ""; - } + // Use the already-created safe fragment if context permits + for ( i = 0; (elem = elems[i]) != null; i++ ) { + if ( typeof elem === "number" ) { + elem += ""; + } - if ( !elem ) { - continue; - } + if ( !elem ) { + continue; + } - // Convert html string into DOM nodes - if ( typeof elem === "string" ) { - if ( !rhtml.test( elem ) ) { - elem = context.createTextNode( elem ); - } else { - // Ensure a safe container in which to render the html - safe = safe || createSafeFragment( context ); - div = context.createElement("div"); - safe.appendChild( div ); + // Convert html string into DOM nodes + if ( typeof elem === "string" ) { + if ( !rhtml.test( elem ) ) { + elem = context.createTextNode( elem ); + } else { + // Ensure a safe container in which to render the html + safe = safe || createSafeFragment( context ); + div = context.createElement("div"); + safe.appendChild( div ); - // Fix "XHTML"-style tags in all browsers - elem = elem.replace(rxhtmlTag, "<$1>"); + // Fix "XHTML"-style tags in all browsers + elem = elem.replace(rxhtmlTag, "<$1>"); - // Go to html and back, then peel off extra wrappers - tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase(); - wrap = wrapMap[ tag ] || wrapMap._default; - depth = wrap[0]; - div.innerHTML = wrap[1] + elem + wrap[2]; + // Go to html and back, then peel off extra wrappers + tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase(); + wrap = wrapMap[ tag ] || wrapMap._default; + depth = wrap[0]; + div.innerHTML = wrap[1] + elem + wrap[2]; - // Move to the right depth - while ( depth-- ) { - div = div.lastChild; - } + // Move to the right depth + while ( depth-- ) { + div = div.lastChild; + } - // Remove IE's autoinserted from table fragments - if ( !jQuery.support.tbody ) { + // Remove IE's autoinserted from table fragments + if ( !jQuery.support.tbody ) { - // String was a , *may* have spurious - hasBody = rtbody.test(elem); - tbody = tag === "table" && !hasBody ? - div.firstChild && div.firstChild.childNodes : + // String was a
    , *may* have spurious + hasBody = rtbody.test(elem); + tbody = tag === "table" && !hasBody ? + div.firstChild && div.firstChild.childNodes : - // String was a bare or - wrap[1] === "
    " && !hasBody ? - div.childNodes : - []; + // String was a bare or + wrap[1] === "
    " && !hasBody ? + div.childNodes : + []; - for ( j = tbody.length - 1; j >= 0 ; --j ) { - if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) { - tbody[ j ].parentNode.removeChild( tbody[ j ] ); - } - } - } + for ( j = tbody.length - 1; j >= 0 ; --j ) { + if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) { + tbody[ j ].parentNode.removeChild( tbody[ j ] ); + } + } + } - // IE completely kills leading whitespace when innerHTML is used - if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { - div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild ); - } + // IE completely kills leading whitespace when innerHTML is used + if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { + div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild ); + } - elem = div.childNodes; + elem = div.childNodes; - // Take out of fragment container (we need a fresh div each time) - div.parentNode.removeChild( div ); - } - } + // Take out of fragment container (we need a fresh div each time) + div.parentNode.removeChild( div ); + } + } - if ( elem.nodeType ) { - ret.push( elem ); - } else { - jQuery.merge( ret, elem ); - } - } + if ( elem.nodeType ) { + ret.push( elem ); + } else { + jQuery.merge( ret, elem ); + } + } - // Fix #11356: Clear elements from safeFragment - if ( div ) { - elem = div = safe = null; - } + // Fix #11356: Clear elements from safeFragment + if ( div ) { + elem = div = safe = null; + } - // Reset defaultChecked for any radios and checkboxes - // about to be appended to the DOM in IE 6/7 (#8060) - if ( !jQuery.support.appendChecked ) { - for ( i = 0; (elem = ret[i]) != null; i++ ) { - if ( jQuery.nodeName( elem, "input" ) ) { - fixDefaultChecked( elem ); - } else if ( typeof elem.getElementsByTagName !== "undefined" ) { - jQuery.grep( elem.getElementsByTagName("input"), fixDefaultChecked ); - } - } - } + // Reset defaultChecked for any radios and checkboxes + // about to be appended to the DOM in IE 6/7 (#8060) + if ( !jQuery.support.appendChecked ) { + for ( i = 0; (elem = ret[i]) != null; i++ ) { + if ( jQuery.nodeName( elem, "input" ) ) { + fixDefaultChecked( elem ); + } else if ( typeof elem.getElementsByTagName !== "undefined" ) { + jQuery.grep( elem.getElementsByTagName("input"), fixDefaultChecked ); + } + } + } - // Append elements to a provided document fragment - if ( fragment ) { - // Special handling of each script element - handleScript = function( elem ) { - // Check if we consider it executable - if ( !elem.type || rscriptType.test( elem.type ) ) { - // Detach the script and store it in the scripts array (if provided) or the fragment - // Return truthy to indicate that it has been handled - return scripts ? - scripts.push( elem.parentNode ? elem.parentNode.removeChild( elem ) : elem ) : - fragment.appendChild( elem ); - } - }; + // Append elements to a provided document fragment + if ( fragment ) { + // Special handling of each script element + handleScript = function( elem ) { + // Check if we consider it executable + if ( !elem.type || rscriptType.test( elem.type ) ) { + // Detach the script and store it in the scripts array (if provided) or the fragment + // Return truthy to indicate that it has been handled + return scripts ? + scripts.push( elem.parentNode ? elem.parentNode.removeChild( elem ) : elem ) : + fragment.appendChild( elem ); + } + }; - for ( i = 0; (elem = ret[i]) != null; i++ ) { - // Check if we're done after handling an executable script - if ( !( jQuery.nodeName( elem, "script" ) && handleScript( elem ) ) ) { - // Append to fragment and handle embedded scripts - fragment.appendChild( elem ); - if ( typeof elem.getElementsByTagName !== "undefined" ) { - // handleScript alters the DOM, so use jQuery.merge to ensure snapshot iteration - jsTags = jQuery.grep( jQuery.merge( [], elem.getElementsByTagName("script") ), handleScript ); + for ( i = 0; (elem = ret[i]) != null; i++ ) { + // Check if we're done after handling an executable script + if ( !( jQuery.nodeName( elem, "script" ) && handleScript( elem ) ) ) { + // Append to fragment and handle embedded scripts + fragment.appendChild( elem ); + if ( typeof elem.getElementsByTagName !== "undefined" ) { + // handleScript alters the DOM, so use jQuery.merge to ensure snapshot iteration + jsTags = jQuery.grep( jQuery.merge( [], elem.getElementsByTagName("script") ), handleScript ); - // Splice the scripts into ret after their former ancestor and advance our index beyond them - ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) ); - i += jsTags.length; - } - } - } - } + // Splice the scripts into ret after their former ancestor and advance our index beyond them + ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) ); + i += jsTags.length; + } + } + } + } - return ret; - }, + return ret; + }, - cleanData: function( elems, /* internal */ acceptData ) { - var data, id, elem, type, - i = 0, - internalKey = jQuery.expando, - cache = jQuery.cache, - deleteExpando = jQuery.support.deleteExpando, - special = jQuery.event.special; + cleanData: function( elems, /* internal */ acceptData ) { + var data, id, elem, type, + i = 0, + internalKey = jQuery.expando, + cache = jQuery.cache, + deleteExpando = jQuery.support.deleteExpando, + special = jQuery.event.special; - for ( ; (elem = elems[i]) != null; i++ ) { + for ( ; (elem = elems[i]) != null; i++ ) { - if ( acceptData || jQuery.acceptData( elem ) ) { + if ( acceptData || jQuery.acceptData( elem ) ) { - id = elem[ internalKey ]; - data = id && cache[ id ]; + id = elem[ internalKey ]; + data = id && cache[ id ]; - if ( data ) { - if ( data.events ) { - for ( type in data.events ) { - if ( special[ type ] ) { - jQuery.event.remove( elem, type ); + if ( data ) { + if ( data.events ) { + for ( type in data.events ) { + if ( special[ type ] ) { + jQuery.event.remove( elem, type ); - // This is a shortcut to avoid jQuery.event.remove's overhead - } else { - jQuery.removeEvent( elem, type, data.handle ); - } - } - } + // This is a shortcut to avoid jQuery.event.remove's overhead + } else { + jQuery.removeEvent( elem, type, data.handle ); + } + } + } - // Remove cache only if it was not already removed by jQuery.event.remove - if ( cache[ id ] ) { + // Remove cache only if it was not already removed by jQuery.event.remove + if ( cache[ id ] ) { - delete cache[ id ]; + delete cache[ id ]; - // IE does not allow us to delete expando properties from nodes, - // nor does it have a removeAttribute function on Document nodes; - // we must handle all of these cases - if ( deleteExpando ) { - delete elem[ internalKey ]; + // IE does not allow us to delete expando properties from nodes, + // nor does it have a removeAttribute function on Document nodes; + // we must handle all of these cases + if ( deleteExpando ) { + delete elem[ internalKey ]; - } else if ( elem.removeAttribute ) { - elem.removeAttribute( internalKey ); + } else if ( elem.removeAttribute ) { + elem.removeAttribute( internalKey ); - } else { - elem[ internalKey ] = null; - } + } else { + elem[ internalKey ] = null; + } - jQuery.deletedIds.push( id ); - } - } - } - } - } + jQuery.deletedIds.push( id ); + } + } + } + } + } }); // Limit scope pollution from any deprecated API (function() { @@ -6481,851 +6481,851 @@ var matched, browser; // More details: http://api.jquery.com/jQuery.browser // jQuery.uaMatch maintained for back-compat jQuery.uaMatch = function( ua ) { - ua = ua.toLowerCase(); + ua = ua.toLowerCase(); - var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) || - /(webkit)[ \/]([\w.]+)/.exec( ua ) || - /(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) || - /(msie) ([\w.]+)/.exec( ua ) || - ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) || - []; + var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) || + /(webkit)[ \/]([\w.]+)/.exec( ua ) || + /(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) || + /(msie) ([\w.]+)/.exec( ua ) || + ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) || + []; - return { - browser: match[ 1 ] || "", - version: match[ 2 ] || "0" - }; + return { + browser: match[ 1 ] || "", + version: match[ 2 ] || "0" + }; }; matched = jQuery.uaMatch( navigator.userAgent ); browser = {}; if ( matched.browser ) { - browser[ matched.browser ] = true; - browser.version = matched.version; + browser[ matched.browser ] = true; + browser.version = matched.version; } // Chrome is Webkit, but Webkit is also Safari. if ( browser.chrome ) { - browser.webkit = true; + browser.webkit = true; } else if ( browser.webkit ) { - browser.safari = true; + browser.safari = true; } jQuery.browser = browser; jQuery.sub = function() { - function jQuerySub( selector, context ) { - return new jQuerySub.fn.init( selector, context ); - } - jQuery.extend( true, jQuerySub, this ); - jQuerySub.superclass = this; - jQuerySub.fn = jQuerySub.prototype = this(); - jQuerySub.fn.constructor = jQuerySub; - jQuerySub.sub = this.sub; - jQuerySub.fn.init = function init( selector, context ) { - if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) { - context = jQuerySub( context ); - } + function jQuerySub( selector, context ) { + return new jQuerySub.fn.init( selector, context ); + } + jQuery.extend( true, jQuerySub, this ); + jQuerySub.superclass = this; + jQuerySub.fn = jQuerySub.prototype = this(); + jQuerySub.fn.constructor = jQuerySub; + jQuerySub.sub = this.sub; + jQuerySub.fn.init = function init( selector, context ) { + if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) { + context = jQuerySub( context ); + } - return jQuery.fn.init.call( this, selector, context, rootjQuerySub ); - }; - jQuerySub.fn.init.prototype = jQuerySub.fn; - var rootjQuerySub = jQuerySub(document); - return jQuerySub; + return jQuery.fn.init.call( this, selector, context, rootjQuerySub ); + }; + jQuerySub.fn.init.prototype = jQuerySub.fn; + var rootjQuerySub = jQuerySub(document); + return jQuerySub; }; })(); var curCSS, iframe, iframeDoc, - ralpha = /alpha\([^)]*\)/i, - ropacity = /opacity=([^)]*)/, - rposition = /^(top|right|bottom|left)$/, - // swappable if display is none or starts with table except "table", "table-cell", or "table-caption" - // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display - rdisplayswap = /^(none|table(?!-c[ea]).+)/, - rmargin = /^margin/, - rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ), - rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ), - rrelNum = new RegExp( "^([-+])=(" + core_pnum + ")", "i" ), - elemdisplay = { BODY: "block" }, + ralpha = /alpha\([^)]*\)/i, + ropacity = /opacity=([^)]*)/, + rposition = /^(top|right|bottom|left)$/, + // swappable if display is none or starts with table except "table", "table-cell", or "table-caption" + // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display + rdisplayswap = /^(none|table(?!-c[ea]).+)/, + rmargin = /^margin/, + rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ), + rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ), + rrelNum = new RegExp( "^([-+])=(" + core_pnum + ")", "i" ), + elemdisplay = { BODY: "block" }, - cssShow = { position: "absolute", visibility: "hidden", display: "block" }, - cssNormalTransform = { - letterSpacing: 0, - fontWeight: 400 - }, + cssShow = { position: "absolute", visibility: "hidden", display: "block" }, + cssNormalTransform = { + letterSpacing: 0, + fontWeight: 400 + }, - cssExpand = [ "Top", "Right", "Bottom", "Left" ], - cssPrefixes = [ "Webkit", "O", "Moz", "ms" ], + cssExpand = [ "Top", "Right", "Bottom", "Left" ], + cssPrefixes = [ "Webkit", "O", "Moz", "ms" ], - eventsToggle = jQuery.fn.toggle; + eventsToggle = jQuery.fn.toggle; // return a css property mapped to a potentially vendor prefixed property function vendorPropName( style, name ) { - // shortcut for names that are not vendor prefixed - if ( name in style ) { - return name; - } + // shortcut for names that are not vendor prefixed + if ( name in style ) { + return name; + } - // check for vendor prefixed names - var capName = name.charAt(0).toUpperCase() + name.slice(1), - origName = name, - i = cssPrefixes.length; + // check for vendor prefixed names + var capName = name.charAt(0).toUpperCase() + name.slice(1), + origName = name, + i = cssPrefixes.length; - while ( i-- ) { - name = cssPrefixes[ i ] + capName; - if ( name in style ) { - return name; - } - } + while ( i-- ) { + name = cssPrefixes[ i ] + capName; + if ( name in style ) { + return name; + } + } - return origName; + return origName; } function isHidden( elem, el ) { - elem = el || elem; - return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); + elem = el || elem; + return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); } function showHide( elements, show ) { - var elem, display, - values = [], - index = 0, - length = elements.length; + var elem, display, + values = [], + index = 0, + length = elements.length; - for ( ; index < length; index++ ) { - elem = elements[ index ]; - if ( !elem.style ) { - continue; - } - values[ index ] = jQuery._data( elem, "olddisplay" ); - if ( show ) { - // Reset the inline display of this element to learn if it is - // being hidden by cascaded rules or not - if ( !values[ index ] && elem.style.display === "none" ) { - elem.style.display = ""; - } + for ( ; index < length; index++ ) { + elem = elements[ index ]; + if ( !elem.style ) { + continue; + } + values[ index ] = jQuery._data( elem, "olddisplay" ); + if ( show ) { + // Reset the inline display of this element to learn if it is + // being hidden by cascaded rules or not + if ( !values[ index ] && elem.style.display === "none" ) { + elem.style.display = ""; + } - // Set elements which have been overridden with display: none - // in a stylesheet to whatever the default browser style is - // for such an element - if ( elem.style.display === "" && isHidden( elem ) ) { - values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) ); - } - } else { - display = curCSS( elem, "display" ); + // Set elements which have been overridden with display: none + // in a stylesheet to whatever the default browser style is + // for such an element + if ( elem.style.display === "" && isHidden( elem ) ) { + values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) ); + } + } else { + display = curCSS( elem, "display" ); - if ( !values[ index ] && display !== "none" ) { - jQuery._data( elem, "olddisplay", display ); - } - } - } + if ( !values[ index ] && display !== "none" ) { + jQuery._data( elem, "olddisplay", display ); + } + } + } - // Set the display of most of the elements in a second loop - // to avoid the constant reflow - for ( index = 0; index < length; index++ ) { - elem = elements[ index ]; - if ( !elem.style ) { - continue; - } - if ( !show || elem.style.display === "none" || elem.style.display === "" ) { - elem.style.display = show ? values[ index ] || "" : "none"; - } - } + // Set the display of most of the elements in a second loop + // to avoid the constant reflow + for ( index = 0; index < length; index++ ) { + elem = elements[ index ]; + if ( !elem.style ) { + continue; + } + if ( !show || elem.style.display === "none" || elem.style.display === "" ) { + elem.style.display = show ? values[ index ] || "" : "none"; + } + } - return elements; + return elements; } jQuery.fn.extend({ - css: function( name, value ) { - return jQuery.access( this, function( elem, name, value ) { - return value !== undefined ? - jQuery.style( elem, name, value ) : - jQuery.css( elem, name ); - }, name, value, arguments.length > 1 ); - }, - show: function() { - return showHide( this, true ); - }, - hide: function() { - return showHide( this ); - }, - toggle: function( state, fn2 ) { - var bool = typeof state === "boolean"; + css: function( name, value ) { + return jQuery.access( this, function( elem, name, value ) { + return value !== undefined ? + jQuery.style( elem, name, value ) : + jQuery.css( elem, name ); + }, name, value, arguments.length > 1 ); + }, + show: function() { + return showHide( this, true ); + }, + hide: function() { + return showHide( this ); + }, + toggle: function( state, fn2 ) { + var bool = typeof state === "boolean"; - if ( jQuery.isFunction( state ) && jQuery.isFunction( fn2 ) ) { - return eventsToggle.apply( this, arguments ); - } + if ( jQuery.isFunction( state ) && jQuery.isFunction( fn2 ) ) { + return eventsToggle.apply( this, arguments ); + } - return this.each(function() { - if ( bool ? state : isHidden( this ) ) { - jQuery( this ).show(); - } else { - jQuery( this ).hide(); - } - }); - } + return this.each(function() { + if ( bool ? state : isHidden( this ) ) { + jQuery( this ).show(); + } else { + jQuery( this ).hide(); + } + }); + } }); jQuery.extend({ - // Add in style property hooks for overriding the default - // behavior of getting and setting a style property - cssHooks: { - opacity: { - get: function( elem, computed ) { - if ( computed ) { - // We should always get a number back from opacity - var ret = curCSS( elem, "opacity" ); - return ret === "" ? "1" : ret; + // Add in style property hooks for overriding the default + // behavior of getting and setting a style property + cssHooks: { + opacity: { + get: function( elem, computed ) { + if ( computed ) { + // We should always get a number back from opacity + var ret = curCSS( elem, "opacity" ); + return ret === "" ? "1" : ret; - } - } - } - }, + } + } + } + }, - // Exclude the following css properties to add px - cssNumber: { - "fillOpacity": true, - "fontWeight": true, - "lineHeight": true, - "opacity": true, - "orphans": true, - "widows": true, - "zIndex": true, - "zoom": true - }, + // Exclude the following css properties to add px + cssNumber: { + "fillOpacity": true, + "fontWeight": true, + "lineHeight": true, + "opacity": true, + "orphans": true, + "widows": true, + "zIndex": true, + "zoom": true + }, - // Add in properties whose names you wish to fix before - // setting or getting the value - cssProps: { - // normalize float css property - "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat" - }, + // Add in properties whose names you wish to fix before + // setting or getting the value + cssProps: { + // normalize float css property + "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat" + }, - // Get and set the style property on a DOM Node - style: function( elem, name, value, extra ) { - // Don't set styles on text and comment nodes - if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { - return; - } + // Get and set the style property on a DOM Node + style: function( elem, name, value, extra ) { + // Don't set styles on text and comment nodes + if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { + return; + } - // Make sure that we're working with the right name - var ret, type, hooks, - origName = jQuery.camelCase( name ), - style = elem.style; + // Make sure that we're working with the right name + var ret, type, hooks, + origName = jQuery.camelCase( name ), + style = elem.style; - name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) ); + name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) ); - // gets hook for the prefixed version - // followed by the unprefixed version - hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; + // gets hook for the prefixed version + // followed by the unprefixed version + hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; - // Check if we're setting a value - if ( value !== undefined ) { - type = typeof value; + // Check if we're setting a value + if ( value !== undefined ) { + type = typeof value; - // convert relative number strings (+= or -=) to relative numbers. #7345 - if ( type === "string" && (ret = rrelNum.exec( value )) ) { - value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) ); - // Fixes bug #9237 - type = "number"; - } + // convert relative number strings (+= or -=) to relative numbers. #7345 + if ( type === "string" && (ret = rrelNum.exec( value )) ) { + value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) ); + // Fixes bug #9237 + type = "number"; + } - // Make sure that NaN and null values aren't set. See: #7116 - if ( value == null || type === "number" && isNaN( value ) ) { - return; - } + // Make sure that NaN and null values aren't set. See: #7116 + if ( value == null || type === "number" && isNaN( value ) ) { + return; + } - // If a number was passed in, add 'px' to the (except for certain CSS properties) - if ( type === "number" && !jQuery.cssNumber[ origName ] ) { - value += "px"; - } + // If a number was passed in, add 'px' to the (except for certain CSS properties) + if ( type === "number" && !jQuery.cssNumber[ origName ] ) { + value += "px"; + } - // If a hook was provided, use that value, otherwise just set the specified value - if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) { - // Wrapped to prevent IE from throwing errors when 'invalid' values are provided - // Fixes bug #5509 - try { - style[ name ] = value; - } catch(e) {} - } + // If a hook was provided, use that value, otherwise just set the specified value + if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) { + // Wrapped to prevent IE from throwing errors when 'invalid' values are provided + // Fixes bug #5509 + try { + style[ name ] = value; + } catch(e) {} + } - } else { - // If a hook was provided get the non-computed value from there - if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) { - return ret; - } + } else { + // If a hook was provided get the non-computed value from there + if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) { + return ret; + } - // Otherwise just get the value from the style object - return style[ name ]; - } - }, + // Otherwise just get the value from the style object + return style[ name ]; + } + }, - css: function( elem, name, numeric, extra ) { - var val, num, hooks, - origName = jQuery.camelCase( name ); + css: function( elem, name, numeric, extra ) { + var val, num, hooks, + origName = jQuery.camelCase( name ); - // Make sure that we're working with the right name - name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) ); + // Make sure that we're working with the right name + name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) ); - // gets hook for the prefixed version - // followed by the unprefixed version - hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; + // gets hook for the prefixed version + // followed by the unprefixed version + hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; - // If a hook was provided get the computed value from there - if ( hooks && "get" in hooks ) { - val = hooks.get( elem, true, extra ); - } + // If a hook was provided get the computed value from there + if ( hooks && "get" in hooks ) { + val = hooks.get( elem, true, extra ); + } - // Otherwise, if a way to get the computed value exists, use that - if ( val === undefined ) { - val = curCSS( elem, name ); - } + // Otherwise, if a way to get the computed value exists, use that + if ( val === undefined ) { + val = curCSS( elem, name ); + } - //convert "normal" to computed value - if ( val === "normal" && name in cssNormalTransform ) { - val = cssNormalTransform[ name ]; - } + //convert "normal" to computed value + if ( val === "normal" && name in cssNormalTransform ) { + val = cssNormalTransform[ name ]; + } - // Return, converting to number if forced or a qualifier was provided and val looks numeric - if ( numeric || extra !== undefined ) { - num = parseFloat( val ); - return numeric || jQuery.isNumeric( num ) ? num || 0 : val; - } - return val; - }, + // Return, converting to number if forced or a qualifier was provided and val looks numeric + if ( numeric || extra !== undefined ) { + num = parseFloat( val ); + return numeric || jQuery.isNumeric( num ) ? num || 0 : val; + } + return val; + }, - // A method for quickly swapping in/out CSS properties to get correct calculations - swap: function( elem, options, callback ) { - var ret, name, - old = {}; + // A method for quickly swapping in/out CSS properties to get correct calculations + swap: function( elem, options, callback ) { + var ret, name, + old = {}; - // Remember the old values, and insert the new ones - for ( name in options ) { - old[ name ] = elem.style[ name ]; - elem.style[ name ] = options[ name ]; - } + // Remember the old values, and insert the new ones + for ( name in options ) { + old[ name ] = elem.style[ name ]; + elem.style[ name ] = options[ name ]; + } - ret = callback.call( elem ); + ret = callback.call( elem ); - // Revert the old values - for ( name in options ) { - elem.style[ name ] = old[ name ]; - } + // Revert the old values + for ( name in options ) { + elem.style[ name ] = old[ name ]; + } - return ret; - } + return ret; + } }); // NOTE: To any future maintainer, we've window.getComputedStyle // because jsdom on node.js will break without it. if ( window.getComputedStyle ) { - curCSS = function( elem, name ) { - var ret, width, minWidth, maxWidth, - computed = window.getComputedStyle( elem, null ), - style = elem.style; + curCSS = function( elem, name ) { + var ret, width, minWidth, maxWidth, + computed = window.getComputedStyle( elem, null ), + style = elem.style; - if ( computed ) { + if ( computed ) { - // getPropertyValue is only needed for .css('filter') in IE9, see #12537 - ret = computed.getPropertyValue( name ) || computed[ name ]; + // getPropertyValue is only needed for .css('filter') in IE9, see #12537 + ret = computed.getPropertyValue( name ) || computed[ name ]; - if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { - ret = jQuery.style( elem, name ); - } + if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { + ret = jQuery.style( elem, name ); + } - // A tribute to the "awesome hack by Dean Edwards" - // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right - // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels - // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values - if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) { - width = style.width; - minWidth = style.minWidth; - maxWidth = style.maxWidth; + // A tribute to the "awesome hack by Dean Edwards" + // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right + // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels + // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values + if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) { + width = style.width; + minWidth = style.minWidth; + maxWidth = style.maxWidth; - style.minWidth = style.maxWidth = style.width = ret; - ret = computed.width; + style.minWidth = style.maxWidth = style.width = ret; + ret = computed.width; - style.width = width; - style.minWidth = minWidth; - style.maxWidth = maxWidth; - } - } + style.width = width; + style.minWidth = minWidth; + style.maxWidth = maxWidth; + } + } - return ret; - }; + return ret; + }; } else if ( document.documentElement.currentStyle ) { - curCSS = function( elem, name ) { - var left, rsLeft, - ret = elem.currentStyle && elem.currentStyle[ name ], - style = elem.style; + curCSS = function( elem, name ) { + var left, rsLeft, + ret = elem.currentStyle && elem.currentStyle[ name ], + style = elem.style; - // Avoid setting ret to empty string here - // so we don't default to auto - if ( ret == null && style && style[ name ] ) { - ret = style[ name ]; - } + // Avoid setting ret to empty string here + // so we don't default to auto + if ( ret == null && style && style[ name ] ) { + ret = style[ name ]; + } - // From the awesome hack by Dean Edwards - // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 + // From the awesome hack by Dean Edwards + // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 - // If we're not dealing with a regular pixel number - // but a number that has a weird ending, we need to convert it to pixels - // but not position css attributes, as those are proportional to the parent element instead - // and we can't measure the parent instead because it might trigger a "stacking dolls" problem - if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) { + // If we're not dealing with a regular pixel number + // but a number that has a weird ending, we need to convert it to pixels + // but not position css attributes, as those are proportional to the parent element instead + // and we can't measure the parent instead because it might trigger a "stacking dolls" problem + if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) { - // Remember the original values - left = style.left; - rsLeft = elem.runtimeStyle && elem.runtimeStyle.left; + // Remember the original values + left = style.left; + rsLeft = elem.runtimeStyle && elem.runtimeStyle.left; - // Put in the new values to get a computed value out - if ( rsLeft ) { - elem.runtimeStyle.left = elem.currentStyle.left; - } - style.left = name === "fontSize" ? "1em" : ret; - ret = style.pixelLeft + "px"; + // Put in the new values to get a computed value out + if ( rsLeft ) { + elem.runtimeStyle.left = elem.currentStyle.left; + } + style.left = name === "fontSize" ? "1em" : ret; + ret = style.pixelLeft + "px"; - // Revert the changed values - style.left = left; - if ( rsLeft ) { - elem.runtimeStyle.left = rsLeft; - } - } + // Revert the changed values + style.left = left; + if ( rsLeft ) { + elem.runtimeStyle.left = rsLeft; + } + } - return ret === "" ? "auto" : ret; - }; + return ret === "" ? "auto" : ret; + }; } function setPositiveNumber( elem, value, subtract ) { - var matches = rnumsplit.exec( value ); - return matches ? - Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) : - value; + var matches = rnumsplit.exec( value ); + return matches ? + Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) : + value; } function augmentWidthOrHeight( elem, name, extra, isBorderBox ) { - var i = extra === ( isBorderBox ? "border" : "content" ) ? - // If we already have the right measurement, avoid augmentation - 4 : - // Otherwise initialize for horizontal or vertical properties - name === "width" ? 1 : 0, + var i = extra === ( isBorderBox ? "border" : "content" ) ? + // If we already have the right measurement, avoid augmentation + 4 : + // Otherwise initialize for horizontal or vertical properties + name === "width" ? 1 : 0, - val = 0; + val = 0; - for ( ; i < 4; i += 2 ) { - // both box models exclude margin, so add it if we want it - if ( extra === "margin" ) { - // we use jQuery.css instead of curCSS here - // because of the reliableMarginRight CSS hook! - val += jQuery.css( elem, extra + cssExpand[ i ], true ); - } + for ( ; i < 4; i += 2 ) { + // both box models exclude margin, so add it if we want it + if ( extra === "margin" ) { + // we use jQuery.css instead of curCSS here + // because of the reliableMarginRight CSS hook! + val += jQuery.css( elem, extra + cssExpand[ i ], true ); + } - // From this point on we use curCSS for maximum performance (relevant in animations) - if ( isBorderBox ) { - // border-box includes padding, so remove it if we want content - if ( extra === "content" ) { - val -= parseFloat( curCSS( elem, "padding" + cssExpand[ i ] ) ) || 0; - } + // From this point on we use curCSS for maximum performance (relevant in animations) + if ( isBorderBox ) { + // border-box includes padding, so remove it if we want content + if ( extra === "content" ) { + val -= parseFloat( curCSS( elem, "padding" + cssExpand[ i ] ) ) || 0; + } - // at this point, extra isn't border nor margin, so remove border - if ( extra !== "margin" ) { - val -= parseFloat( curCSS( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0; - } - } else { - // at this point, extra isn't content, so add padding - val += parseFloat( curCSS( elem, "padding" + cssExpand[ i ] ) ) || 0; + // at this point, extra isn't border nor margin, so remove border + if ( extra !== "margin" ) { + val -= parseFloat( curCSS( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0; + } + } else { + // at this point, extra isn't content, so add padding + val += parseFloat( curCSS( elem, "padding" + cssExpand[ i ] ) ) || 0; - // at this point, extra isn't content nor padding, so add border - if ( extra !== "padding" ) { - val += parseFloat( curCSS( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0; - } - } - } + // at this point, extra isn't content nor padding, so add border + if ( extra !== "padding" ) { + val += parseFloat( curCSS( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0; + } + } + } - return val; + return val; } function getWidthOrHeight( elem, name, extra ) { - // Start with offset property, which is equivalent to the border-box value - var val = name === "width" ? elem.offsetWidth : elem.offsetHeight, - valueIsBorderBox = true, - isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing" ) === "border-box"; + // Start with offset property, which is equivalent to the border-box value + var val = name === "width" ? elem.offsetWidth : elem.offsetHeight, + valueIsBorderBox = true, + isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing" ) === "border-box"; - // some non-html elements return undefined for offsetWidth, so check for null/undefined - // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 - // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 - if ( val <= 0 || val == null ) { - // Fall back to computed then uncomputed css if necessary - val = curCSS( elem, name ); - if ( val < 0 || val == null ) { - val = elem.style[ name ]; - } + // some non-html elements return undefined for offsetWidth, so check for null/undefined + // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 + // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 + if ( val <= 0 || val == null ) { + // Fall back to computed then uncomputed css if necessary + val = curCSS( elem, name ); + if ( val < 0 || val == null ) { + val = elem.style[ name ]; + } - // Computed unit is not pixels. Stop here and return. - if ( rnumnonpx.test(val) ) { - return val; - } + // Computed unit is not pixels. Stop here and return. + if ( rnumnonpx.test(val) ) { + return val; + } - // we need the check for style in case a browser which returns unreliable values - // for getComputedStyle silently falls back to the reliable elem.style - valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] ); + // we need the check for style in case a browser which returns unreliable values + // for getComputedStyle silently falls back to the reliable elem.style + valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] ); - // Normalize "", auto, and prepare for extra - val = parseFloat( val ) || 0; - } + // Normalize "", auto, and prepare for extra + val = parseFloat( val ) || 0; + } - // use the active box-sizing model to add/subtract irrelevant styles - return ( val + - augmentWidthOrHeight( - elem, - name, - extra || ( isBorderBox ? "border" : "content" ), - valueIsBorderBox - ) - ) + "px"; + // use the active box-sizing model to add/subtract irrelevant styles + return ( val + + augmentWidthOrHeight( + elem, + name, + extra || ( isBorderBox ? "border" : "content" ), + valueIsBorderBox + ) + ) + "px"; } // Try to determine the default display value of an element function css_defaultDisplay( nodeName ) { - if ( elemdisplay[ nodeName ] ) { - return elemdisplay[ nodeName ]; - } + if ( elemdisplay[ nodeName ] ) { + return elemdisplay[ nodeName ]; + } - var elem = jQuery( "<" + nodeName + ">" ).appendTo( document.body ), - display = elem.css("display"); - elem.remove(); + var elem = jQuery( "<" + nodeName + ">" ).appendTo( document.body ), + display = elem.css("display"); + elem.remove(); - // If the simple way fails, - // get element's real default display by attaching it to a temp iframe - if ( display === "none" || display === "" ) { - // Use the already-created iframe if possible - iframe = document.body.appendChild( - iframe || jQuery.extend( document.createElement("iframe"), { - frameBorder: 0, - width: 0, - height: 0 - }) - ); + // If the simple way fails, + // get element's real default display by attaching it to a temp iframe + if ( display === "none" || display === "" ) { + // Use the already-created iframe if possible + iframe = document.body.appendChild( + iframe || jQuery.extend( document.createElement("iframe"), { + frameBorder: 0, + width: 0, + height: 0 + }) + ); - // Create a cacheable copy of the iframe document on first call. - // IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML - // document to it; WebKit & Firefox won't allow reusing the iframe document. - if ( !iframeDoc || !iframe.createElement ) { - iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document; - iframeDoc.write(""); - iframeDoc.close(); - } + // Create a cacheable copy of the iframe document on first call. + // IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML + // document to it; WebKit & Firefox won't allow reusing the iframe document. + if ( !iframeDoc || !iframe.createElement ) { + iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document; + iframeDoc.write(""); + iframeDoc.close(); + } - elem = iframeDoc.body.appendChild( iframeDoc.createElement(nodeName) ); + elem = iframeDoc.body.appendChild( iframeDoc.createElement(nodeName) ); - display = curCSS( elem, "display" ); - document.body.removeChild( iframe ); - } + display = curCSS( elem, "display" ); + document.body.removeChild( iframe ); + } - // Store the correct default display - elemdisplay[ nodeName ] = display; + // Store the correct default display + elemdisplay[ nodeName ] = display; - return display; + return display; } jQuery.each([ "height", "width" ], function( i, name ) { - jQuery.cssHooks[ name ] = { - get: function( elem, computed, extra ) { - if ( computed ) { - // certain elements can have dimension info if we invisibly show them - // however, it must have a current display style that would benefit from this - if ( elem.offsetWidth === 0 && rdisplayswap.test( curCSS( elem, "display" ) ) ) { - return jQuery.swap( elem, cssShow, function() { - return getWidthOrHeight( elem, name, extra ); - }); - } else { - return getWidthOrHeight( elem, name, extra ); - } - } - }, + jQuery.cssHooks[ name ] = { + get: function( elem, computed, extra ) { + if ( computed ) { + // certain elements can have dimension info if we invisibly show them + // however, it must have a current display style that would benefit from this + if ( elem.offsetWidth === 0 && rdisplayswap.test( curCSS( elem, "display" ) ) ) { + return jQuery.swap( elem, cssShow, function() { + return getWidthOrHeight( elem, name, extra ); + }); + } else { + return getWidthOrHeight( elem, name, extra ); + } + } + }, - set: function( elem, value, extra ) { - return setPositiveNumber( elem, value, extra ? - augmentWidthOrHeight( - elem, - name, - extra, - jQuery.support.boxSizing && jQuery.css( elem, "boxSizing" ) === "border-box" - ) : 0 - ); - } - }; + set: function( elem, value, extra ) { + return setPositiveNumber( elem, value, extra ? + augmentWidthOrHeight( + elem, + name, + extra, + jQuery.support.boxSizing && jQuery.css( elem, "boxSizing" ) === "border-box" + ) : 0 + ); + } + }; }); if ( !jQuery.support.opacity ) { - jQuery.cssHooks.opacity = { - get: function( elem, computed ) { - // IE uses filters for opacity - return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ? - ( 0.01 * parseFloat( RegExp.$1 ) ) + "" : - computed ? "1" : ""; - }, + jQuery.cssHooks.opacity = { + get: function( elem, computed ) { + // IE uses filters for opacity + return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ? + ( 0.01 * parseFloat( RegExp.$1 ) ) + "" : + computed ? "1" : ""; + }, - set: function( elem, value ) { - var style = elem.style, - currentStyle = elem.currentStyle, - opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "", - filter = currentStyle && currentStyle.filter || style.filter || ""; + set: function( elem, value ) { + var style = elem.style, + currentStyle = elem.currentStyle, + opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "", + filter = currentStyle && currentStyle.filter || style.filter || ""; - // IE has trouble with opacity if it does not have layout - // Force it by setting the zoom level - style.zoom = 1; + // IE has trouble with opacity if it does not have layout + // Force it by setting the zoom level + style.zoom = 1; - // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652 - if ( value >= 1 && jQuery.trim( filter.replace( ralpha, "" ) ) === "" && - style.removeAttribute ) { + // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652 + if ( value >= 1 && jQuery.trim( filter.replace( ralpha, "" ) ) === "" && + style.removeAttribute ) { - // Setting style.filter to null, "" & " " still leave "filter:" in the cssText - // if "filter:" is present at all, clearType is disabled, we want to avoid this - // style.removeAttribute is IE Only, but so apparently is this code path... - style.removeAttribute( "filter" ); + // Setting style.filter to null, "" & " " still leave "filter:" in the cssText + // if "filter:" is present at all, clearType is disabled, we want to avoid this + // style.removeAttribute is IE Only, but so apparently is this code path... + style.removeAttribute( "filter" ); - // if there there is no filter style applied in a css rule, we are done - if ( currentStyle && !currentStyle.filter ) { - return; - } - } + // if there there is no filter style applied in a css rule, we are done + if ( currentStyle && !currentStyle.filter ) { + return; + } + } - // otherwise, set new filter values - style.filter = ralpha.test( filter ) ? - filter.replace( ralpha, opacity ) : - filter + " " + opacity; - } - }; + // otherwise, set new filter values + style.filter = ralpha.test( filter ) ? + filter.replace( ralpha, opacity ) : + filter + " " + opacity; + } + }; } // These hooks cannot be added until DOM ready because the support test // for it is not run until after DOM ready jQuery(function() { - if ( !jQuery.support.reliableMarginRight ) { - jQuery.cssHooks.marginRight = { - get: function( elem, computed ) { - // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right - // Work around by temporarily setting element display to inline-block - return jQuery.swap( elem, { "display": "inline-block" }, function() { - if ( computed ) { - return curCSS( elem, "marginRight" ); - } - }); - } - }; - } + if ( !jQuery.support.reliableMarginRight ) { + jQuery.cssHooks.marginRight = { + get: function( elem, computed ) { + // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right + // Work around by temporarily setting element display to inline-block + return jQuery.swap( elem, { "display": "inline-block" }, function() { + if ( computed ) { + return curCSS( elem, "marginRight" ); + } + }); + } + }; + } - // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 - // getComputedStyle returns percent when specified for top/left/bottom/right - // rather than make the css module depend on the offset module, we just check for it here - if ( !jQuery.support.pixelPosition && jQuery.fn.position ) { - jQuery.each( [ "top", "left" ], function( i, prop ) { - jQuery.cssHooks[ prop ] = { - get: function( elem, computed ) { - if ( computed ) { - var ret = curCSS( elem, prop ); - // if curCSS returns percentage, fallback to offset - return rnumnonpx.test( ret ) ? jQuery( elem ).position()[ prop ] + "px" : ret; - } - } - }; - }); - } + // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 + // getComputedStyle returns percent when specified for top/left/bottom/right + // rather than make the css module depend on the offset module, we just check for it here + if ( !jQuery.support.pixelPosition && jQuery.fn.position ) { + jQuery.each( [ "top", "left" ], function( i, prop ) { + jQuery.cssHooks[ prop ] = { + get: function( elem, computed ) { + if ( computed ) { + var ret = curCSS( elem, prop ); + // if curCSS returns percentage, fallback to offset + return rnumnonpx.test( ret ) ? jQuery( elem ).position()[ prop ] + "px" : ret; + } + } + }; + }); + } }); if ( jQuery.expr && jQuery.expr.filters ) { - jQuery.expr.filters.hidden = function( elem ) { - return ( elem.offsetWidth === 0 && elem.offsetHeight === 0 ) || (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || curCSS( elem, "display" )) === "none"); - }; + jQuery.expr.filters.hidden = function( elem ) { + return ( elem.offsetWidth === 0 && elem.offsetHeight === 0 ) || (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || curCSS( elem, "display" )) === "none"); + }; - jQuery.expr.filters.visible = function( elem ) { - return !jQuery.expr.filters.hidden( elem ); - }; + jQuery.expr.filters.visible = function( elem ) { + return !jQuery.expr.filters.hidden( elem ); + }; } // These hooks are used by animate to expand properties jQuery.each({ - margin: "", - padding: "", - border: "Width" + margin: "", + padding: "", + border: "Width" }, function( prefix, suffix ) { - jQuery.cssHooks[ prefix + suffix ] = { - expand: function( value ) { - var i, + jQuery.cssHooks[ prefix + suffix ] = { + expand: function( value ) { + var i, - // assumes a single number if not a string - parts = typeof value === "string" ? value.split(" ") : [ value ], - expanded = {}; + // assumes a single number if not a string + parts = typeof value === "string" ? value.split(" ") : [ value ], + expanded = {}; - for ( i = 0; i < 4; i++ ) { - expanded[ prefix + cssExpand[ i ] + suffix ] = - parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; - } + for ( i = 0; i < 4; i++ ) { + expanded[ prefix + cssExpand[ i ] + suffix ] = + parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; + } - return expanded; - } - }; + return expanded; + } + }; - if ( !rmargin.test( prefix ) ) { - jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; - } + if ( !rmargin.test( prefix ) ) { + jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; + } }); var r20 = /%20/g, - rbracket = /\[\]$/, - rCRLF = /\r?\n/g, - rinput = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i, - rselectTextarea = /^(?:select|textarea)/i; + rbracket = /\[\]$/, + rCRLF = /\r?\n/g, + rinput = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i, + rselectTextarea = /^(?:select|textarea)/i; jQuery.fn.extend({ - serialize: function() { - return jQuery.param( this.serializeArray() ); - }, - serializeArray: function() { - return this.map(function(){ - return this.elements ? jQuery.makeArray( this.elements ) : this; - }) - .filter(function(){ - return this.name && !this.disabled && - ( this.checked || rselectTextarea.test( this.nodeName ) || - rinput.test( this.type ) ); - }) - .map(function( i, elem ){ - var val = jQuery( this ).val(); + serialize: function() { + return jQuery.param( this.serializeArray() ); + }, + serializeArray: function() { + return this.map(function(){ + return this.elements ? jQuery.makeArray( this.elements ) : this; + }) + .filter(function(){ + return this.name && !this.disabled && + ( this.checked || rselectTextarea.test( this.nodeName ) || + rinput.test( this.type ) ); + }) + .map(function( i, elem ){ + var val = jQuery( this ).val(); - return val == null ? - null : - jQuery.isArray( val ) ? - jQuery.map( val, function( val, i ){ - return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; - }) : - { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; - }).get(); - } + return val == null ? + null : + jQuery.isArray( val ) ? + jQuery.map( val, function( val, i ){ + return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; + }) : + { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; + }).get(); + } }); //Serialize an array of form elements or a set of //key/values into a query string jQuery.param = function( a, traditional ) { - var prefix, - s = [], - add = function( key, value ) { - // If value is a function, invoke it and return its value - value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value ); - s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value ); - }; + var prefix, + s = [], + add = function( key, value ) { + // If value is a function, invoke it and return its value + value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value ); + s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value ); + }; - // Set traditional to true for jQuery <= 1.3.2 behavior. - if ( traditional === undefined ) { - traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional; - } + // Set traditional to true for jQuery <= 1.3.2 behavior. + if ( traditional === undefined ) { + traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional; + } - // If an array was passed in, assume that it is an array of form elements. - if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { - // Serialize the form elements - jQuery.each( a, function() { - add( this.name, this.value ); - }); + // If an array was passed in, assume that it is an array of form elements. + if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { + // Serialize the form elements + jQuery.each( a, function() { + add( this.name, this.value ); + }); - } else { - // If traditional, encode the "old" way (the way 1.3.2 or older - // did it), otherwise encode params recursively. - for ( prefix in a ) { - buildParams( prefix, a[ prefix ], traditional, add ); - } - } + } else { + // If traditional, encode the "old" way (the way 1.3.2 or older + // did it), otherwise encode params recursively. + for ( prefix in a ) { + buildParams( prefix, a[ prefix ], traditional, add ); + } + } - // Return the resulting serialization - return s.join( "&" ).replace( r20, "+" ); + // Return the resulting serialization + return s.join( "&" ).replace( r20, "+" ); }; function buildParams( prefix, obj, traditional, add ) { - var name; + var name; - if ( jQuery.isArray( obj ) ) { - // Serialize array item. - jQuery.each( obj, function( i, v ) { - if ( traditional || rbracket.test( prefix ) ) { - // Treat each array item as a scalar. - add( prefix, v ); + if ( jQuery.isArray( obj ) ) { + // Serialize array item. + jQuery.each( obj, function( i, v ) { + if ( traditional || rbracket.test( prefix ) ) { + // Treat each array item as a scalar. + add( prefix, v ); - } else { - // If array item is non-scalar (array or object), encode its - // numeric index to resolve deserialization ambiguity issues. - // Note that rack (as of 1.0.0) can't currently deserialize - // nested arrays properly, and attempting to do so may cause - // a server error. Possible fixes are to modify rack's - // deserialization algorithm or to provide an option or flag - // to force array serialization to be shallow. - buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add ); - } - }); + } else { + // If array item is non-scalar (array or object), encode its + // numeric index to resolve deserialization ambiguity issues. + // Note that rack (as of 1.0.0) can't currently deserialize + // nested arrays properly, and attempting to do so may cause + // a server error. Possible fixes are to modify rack's + // deserialization algorithm or to provide an option or flag + // to force array serialization to be shallow. + buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add ); + } + }); - } else if ( !traditional && jQuery.type( obj ) === "object" ) { - // Serialize object item. - for ( name in obj ) { - buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); - } + } else if ( !traditional && jQuery.type( obj ) === "object" ) { + // Serialize object item. + for ( name in obj ) { + buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); + } - } else { - // Serialize scalar item. - add( prefix, obj ); - } + } else { + // Serialize scalar item. + add( prefix, obj ); + } } var - // Document location - ajaxLocParts, - ajaxLocation, + // Document location + ajaxLocParts, + ajaxLocation, - rhash = /#.*$/, - rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL - // #7653, #8125, #8152: local protocol detection - rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/, - rnoContent = /^(?:GET|HEAD)$/, - rprotocol = /^\/\//, - rquery = /\?/, - rscript = /)<[^<]*)*<\/script>/gi, - rts = /([?&])_=[^&]*/, - rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/, + rhash = /#.*$/, + rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL + // #7653, #8125, #8152: local protocol detection + rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/, + rnoContent = /^(?:GET|HEAD)$/, + rprotocol = /^\/\//, + rquery = /\?/, + rscript = /)<[^<]*)*<\/script>/gi, + rts = /([?&])_=[^&]*/, + rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/, - // Keep a copy of the old load method - _load = jQuery.fn.load, + // Keep a copy of the old load method + _load = jQuery.fn.load, - /* Prefilters - * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) - * 2) These are called: - * - BEFORE asking for a transport - * - AFTER param serialization (s.data is a string if s.processData is true) - * 3) key is the dataType - * 4) the catchall symbol "*" can be used - * 5) execution will start with transport dataType and THEN continue down to "*" if needed - */ - prefilters = {}, + /* Prefilters + * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) + * 2) These are called: + * - BEFORE asking for a transport + * - AFTER param serialization (s.data is a string if s.processData is true) + * 3) key is the dataType + * 4) the catchall symbol "*" can be used + * 5) execution will start with transport dataType and THEN continue down to "*" if needed + */ + prefilters = {}, - /* Transports bindings - * 1) key is the dataType - * 2) the catchall symbol "*" can be used - * 3) selection will start with transport dataType and THEN go to "*" if needed - */ - transports = {}, + /* Transports bindings + * 1) key is the dataType + * 2) the catchall symbol "*" can be used + * 3) selection will start with transport dataType and THEN go to "*" if needed + */ + transports = {}, - // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression - allTypes = ["*/"] + ["*"]; + // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression + allTypes = ["*/"] + ["*"]; // #8138, IE may throw an exception when accessing // a field from window.location if document.domain has been set try { - ajaxLocation = location.href; + ajaxLocation = location.href; } catch( e ) { - // Use the href attribute of an A element - // since IE will modify it given document.location - ajaxLocation = document.createElement( "a" ); - ajaxLocation.href = ""; - ajaxLocation = ajaxLocation.href; + // Use the href attribute of an A element + // since IE will modify it given document.location + ajaxLocation = document.createElement( "a" ); + ajaxLocation.href = ""; + ajaxLocation = ajaxLocation.href; } // Segment location into parts @@ -7334,676 +7334,676 @@ ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || []; // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport function addToPrefiltersOrTransports( structure ) { - // dataTypeExpression is optional and defaults to "*" - return function( dataTypeExpression, func ) { + // dataTypeExpression is optional and defaults to "*" + return function( dataTypeExpression, func ) { - if ( typeof dataTypeExpression !== "string" ) { - func = dataTypeExpression; - dataTypeExpression = "*"; - } + if ( typeof dataTypeExpression !== "string" ) { + func = dataTypeExpression; + dataTypeExpression = "*"; + } - var dataType, list, placeBefore, - dataTypes = dataTypeExpression.toLowerCase().split( core_rspace ), - i = 0, - length = dataTypes.length; + var dataType, list, placeBefore, + dataTypes = dataTypeExpression.toLowerCase().split( core_rspace ), + i = 0, + length = dataTypes.length; - if ( jQuery.isFunction( func ) ) { - // For each dataType in the dataTypeExpression - for ( ; i < length; i++ ) { - dataType = dataTypes[ i ]; - // We control if we're asked to add before - // any existing element - placeBefore = /^\+/.test( dataType ); - if ( placeBefore ) { - dataType = dataType.substr( 1 ) || "*"; - } - list = structure[ dataType ] = structure[ dataType ] || []; - // then we add to the structure accordingly - list[ placeBefore ? "unshift" : "push" ]( func ); - } - } - }; + if ( jQuery.isFunction( func ) ) { + // For each dataType in the dataTypeExpression + for ( ; i < length; i++ ) { + dataType = dataTypes[ i ]; + // We control if we're asked to add before + // any existing element + placeBefore = /^\+/.test( dataType ); + if ( placeBefore ) { + dataType = dataType.substr( 1 ) || "*"; + } + list = structure[ dataType ] = structure[ dataType ] || []; + // then we add to the structure accordingly + list[ placeBefore ? "unshift" : "push" ]( func ); + } + } + }; } // Base inspection function for prefilters and transports function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR, - dataType /* internal */, inspected /* internal */ ) { + dataType /* internal */, inspected /* internal */ ) { - dataType = dataType || options.dataTypes[ 0 ]; - inspected = inspected || {}; + dataType = dataType || options.dataTypes[ 0 ]; + inspected = inspected || {}; - inspected[ dataType ] = true; + inspected[ dataType ] = true; - var selection, - list = structure[ dataType ], - i = 0, - length = list ? list.length : 0, - executeOnly = ( structure === prefilters ); + var selection, + list = structure[ dataType ], + i = 0, + length = list ? list.length : 0, + executeOnly = ( structure === prefilters ); - for ( ; i < length && ( executeOnly || !selection ); i++ ) { - selection = list[ i ]( options, originalOptions, jqXHR ); - // If we got redirected to another dataType - // we try there if executing only and not done already - if ( typeof selection === "string" ) { - if ( !executeOnly || inspected[ selection ] ) { - selection = undefined; - } else { - options.dataTypes.unshift( selection ); - selection = inspectPrefiltersOrTransports( - structure, options, originalOptions, jqXHR, selection, inspected ); - } - } - } - // If we're only executing or nothing was selected - // we try the catchall dataType if not done already - if ( ( executeOnly || !selection ) && !inspected[ "*" ] ) { - selection = inspectPrefiltersOrTransports( - structure, options, originalOptions, jqXHR, "*", inspected ); - } - // unnecessary when only executing (prefilters) - // but it'll be ignored by the caller in that case - return selection; + for ( ; i < length && ( executeOnly || !selection ); i++ ) { + selection = list[ i ]( options, originalOptions, jqXHR ); + // If we got redirected to another dataType + // we try there if executing only and not done already + if ( typeof selection === "string" ) { + if ( !executeOnly || inspected[ selection ] ) { + selection = undefined; + } else { + options.dataTypes.unshift( selection ); + selection = inspectPrefiltersOrTransports( + structure, options, originalOptions, jqXHR, selection, inspected ); + } + } + } + // If we're only executing or nothing was selected + // we try the catchall dataType if not done already + if ( ( executeOnly || !selection ) && !inspected[ "*" ] ) { + selection = inspectPrefiltersOrTransports( + structure, options, originalOptions, jqXHR, "*", inspected ); + } + // unnecessary when only executing (prefilters) + // but it'll be ignored by the caller in that case + return selection; } // A special extend for ajax options // that takes "flat" options (not to be deep extended) // Fixes #9887 function ajaxExtend( target, src ) { - var key, deep, - flatOptions = jQuery.ajaxSettings.flatOptions || {}; - for ( key in src ) { - if ( src[ key ] !== undefined ) { - ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; - } - } - if ( deep ) { - jQuery.extend( true, target, deep ); - } + var key, deep, + flatOptions = jQuery.ajaxSettings.flatOptions || {}; + for ( key in src ) { + if ( src[ key ] !== undefined ) { + ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; + } + } + if ( deep ) { + jQuery.extend( true, target, deep ); + } } jQuery.fn.load = function( url, params, callback ) { - if ( typeof url !== "string" && _load ) { - return _load.apply( this, arguments ); - } + if ( typeof url !== "string" && _load ) { + return _load.apply( this, arguments ); + } - // Don't do a request if no elements are being requested - if ( !this.length ) { - return this; - } + // Don't do a request if no elements are being requested + if ( !this.length ) { + return this; + } - var selector, type, response, - self = this, - off = url.indexOf(" "); + var selector, type, response, + self = this, + off = url.indexOf(" "); - if ( off >= 0 ) { - selector = url.slice( off, url.length ); - url = url.slice( 0, off ); - } + if ( off >= 0 ) { + selector = url.slice( off, url.length ); + url = url.slice( 0, off ); + } - // If it's a function - if ( jQuery.isFunction( params ) ) { + // If it's a function + if ( jQuery.isFunction( params ) ) { - // We assume that it's the callback - callback = params; - params = undefined; + // We assume that it's the callback + callback = params; + params = undefined; - // Otherwise, build a param string - } else if ( params && typeof params === "object" ) { - type = "POST"; - } + // Otherwise, build a param string + } else if ( params && typeof params === "object" ) { + type = "POST"; + } - // Request the remote document - jQuery.ajax({ - url: url, + // Request the remote document + jQuery.ajax({ + url: url, - // if "type" variable is undefined, then "GET" method will be used - type: type, - dataType: "html", - data: params, - complete: function( jqXHR, status ) { - if ( callback ) { - self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] ); - } - } - }).done(function( responseText ) { + // if "type" variable is undefined, then "GET" method will be used + type: type, + dataType: "html", + data: params, + complete: function( jqXHR, status ) { + if ( callback ) { + self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] ); + } + } + }).done(function( responseText ) { - // Save response for use in complete callback - response = arguments; + // Save response for use in complete callback + response = arguments; - // See if a selector was specified - self.html( selector ? + // See if a selector was specified + self.html( selector ? - // Create a dummy div to hold the results - jQuery("
    ") + // Create a dummy div to hold the results + jQuery("
    ") - // inject the contents of the document in, removing the scripts - // to avoid any 'Permission Denied' errors in IE - .append( responseText.replace( rscript, "" ) ) + // inject the contents of the document in, removing the scripts + // to avoid any 'Permission Denied' errors in IE + .append( responseText.replace( rscript, "" ) ) - // Locate the specified elements - .find( selector ) : + // Locate the specified elements + .find( selector ) : - // If not, just inject the full result - responseText ); + // If not, just inject the full result + responseText ); - }); + }); - return this; + return this; }; // Attach a bunch of functions for handling common AJAX events jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split( " " ), function( i, o ){ - jQuery.fn[ o ] = function( f ){ - return this.on( o, f ); - }; + jQuery.fn[ o ] = function( f ){ + return this.on( o, f ); + }; }); jQuery.each( [ "get", "post" ], function( i, method ) { - jQuery[ method ] = function( url, data, callback, type ) { - // shift arguments if data argument was omitted - if ( jQuery.isFunction( data ) ) { - type = type || callback; - callback = data; - data = undefined; - } + jQuery[ method ] = function( url, data, callback, type ) { + // shift arguments if data argument was omitted + if ( jQuery.isFunction( data ) ) { + type = type || callback; + callback = data; + data = undefined; + } - return jQuery.ajax({ - type: method, - url: url, - data: data, - success: callback, - dataType: type - }); - }; + return jQuery.ajax({ + type: method, + url: url, + data: data, + success: callback, + dataType: type + }); + }; }); jQuery.extend({ - getScript: function( url, callback ) { - return jQuery.get( url, undefined, callback, "script" ); - }, - - getJSON: function( url, data, callback ) { - return jQuery.get( url, data, callback, "json" ); - }, - - // Creates a full fledged settings object into target - // with both ajaxSettings and settings fields. - // If target is omitted, writes into ajaxSettings. - ajaxSetup: function( target, settings ) { - if ( settings ) { - // Building a settings object - ajaxExtend( target, jQuery.ajaxSettings ); - } else { - // Extending ajaxSettings - settings = target; - target = jQuery.ajaxSettings; - } - ajaxExtend( target, settings ); - return target; - }, - - ajaxSettings: { - url: ajaxLocation, - isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ), - global: true, - type: "GET", - contentType: "application/x-www-form-urlencoded; charset=UTF-8", - processData: true, - async: true, - /* - timeout: 0, - data: null, - dataType: null, - username: null, - password: null, - cache: null, - throws: false, - traditional: false, - headers: {}, - */ - - accepts: { - xml: "application/xml, text/xml", - html: "text/html", - text: "text/plain", - json: "application/json, text/javascript", - "*": allTypes - }, - - contents: { - xml: /xml/, - html: /html/, - json: /json/ - }, - - responseFields: { - xml: "responseXML", - text: "responseText" - }, - - // List of data converters - // 1) key format is "source_type destination_type" (a single space in-between) - // 2) the catchall symbol "*" can be used for source_type - converters: { - - // Convert anything to text - "* text": window.String, - - // Text to html (true = no transformation) - "text html": true, - - // Evaluate text as a json expression - "text json": jQuery.parseJSON, - - // Parse text as xml - "text xml": jQuery.parseXML - }, - - // For options that shouldn't be deep extended: - // you can add your own custom options here if - // and when you create one that shouldn't be - // deep extended (see ajaxExtend) - flatOptions: { - context: true, - url: true - } - }, - - ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), - ajaxTransport: addToPrefiltersOrTransports( transports ), - - // Main method - ajax: function( url, options ) { - - // If url is an object, simulate pre-1.5 signature - if ( typeof url === "object" ) { - options = url; - url = undefined; - } - - // Force options to be an object - options = options || {}; - - var // ifModified key - ifModifiedKey, - // Response headers - responseHeadersString, - responseHeaders, - // transport - transport, - // timeout handle - timeoutTimer, - // Cross-domain detection vars - parts, - // To know if global events are to be dispatched - fireGlobals, - // Loop variable - i, - // Create the final options object - s = jQuery.ajaxSetup( {}, options ), - // Callbacks context - callbackContext = s.context || s, - // Context for global events - // It's the callbackContext if one was provided in the options - // and if it's a DOM node or a jQuery collection - globalEventContext = callbackContext !== s && - ( callbackContext.nodeType || callbackContext instanceof jQuery ) ? - jQuery( callbackContext ) : jQuery.event, - // Deferreds - deferred = jQuery.Deferred(), - completeDeferred = jQuery.Callbacks( "once memory" ), - // Status-dependent callbacks - statusCode = s.statusCode || {}, - // Headers (they are sent all at once) - requestHeaders = {}, - requestHeadersNames = {}, - // The jqXHR state - state = 0, - // Default abort message - strAbort = "canceled", - // Fake xhr - jqXHR = { - - readyState: 0, - - // Caches the header - setRequestHeader: function( name, value ) { - if ( !state ) { - var lname = name.toLowerCase(); - name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name; - requestHeaders[ name ] = value; - } - return this; - }, - - // Raw string - getAllResponseHeaders: function() { - return state === 2 ? responseHeadersString : null; - }, - - // Builds headers hashtable if needed - getResponseHeader: function( key ) { - var match; - if ( state === 2 ) { - if ( !responseHeaders ) { - responseHeaders = {}; - while( ( match = rheaders.exec( responseHeadersString ) ) ) { - responseHeaders[ match[1].toLowerCase() ] = match[ 2 ]; - } - } - match = responseHeaders[ key.toLowerCase() ]; - } - return match === undefined ? null : match; - }, - - // Overrides response content-type header - overrideMimeType: function( type ) { - if ( !state ) { - s.mimeType = type; - } - return this; - }, - - // Cancel the request - abort: function( statusText ) { - statusText = statusText || strAbort; - if ( transport ) { - transport.abort( statusText ); - } - done( 0, statusText ); - return this; - } - }; - - // Callback for when everything is done - // It is defined here because jslint complains if it is declared - // at the end of the function (which would be more logical and readable) - function done( status, nativeStatusText, responses, headers ) { - var isSuccess, success, error, response, modified, - statusText = nativeStatusText; - - // Called once - if ( state === 2 ) { - return; - } - - // State is "done" now - state = 2; - - // Clear timeout if it exists - if ( timeoutTimer ) { - clearTimeout( timeoutTimer ); - } - - // Dereference transport for early garbage collection - // (no matter how long the jqXHR object will be used) - transport = undefined; - - // Cache response headers - responseHeadersString = headers || ""; - - // Set readyState - jqXHR.readyState = status > 0 ? 4 : 0; - - // Get response data - if ( responses ) { - response = ajaxHandleResponses( s, jqXHR, responses ); - } - - // If successful, handle type chaining - if ( status >= 200 && status < 300 || status === 304 ) { - - // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. - if ( s.ifModified ) { - - modified = jqXHR.getResponseHeader("Last-Modified"); - if ( modified ) { - jQuery.lastModified[ ifModifiedKey ] = modified; - } - modified = jqXHR.getResponseHeader("Etag"); - if ( modified ) { - jQuery.etag[ ifModifiedKey ] = modified; - } - } - - // If not modified - if ( status === 304 ) { - - statusText = "notmodified"; - isSuccess = true; - - // If we have data - } else { - - isSuccess = ajaxConvert( s, response ); - statusText = isSuccess.state; - success = isSuccess.data; - error = isSuccess.error; - isSuccess = !error; - } - } else { - // We extract error from statusText - // then normalize statusText and status for non-aborts - error = statusText; - if ( !statusText || status ) { - statusText = "error"; - if ( status < 0 ) { - status = 0; - } - } - } - - // Set data for the fake xhr object - jqXHR.status = status; - jqXHR.statusText = ( nativeStatusText || statusText ) + ""; - - // Success/Error - if ( isSuccess ) { - deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); - } else { - deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); - } - - // Status-dependent callbacks - jqXHR.statusCode( statusCode ); - statusCode = undefined; - - if ( fireGlobals ) { - globalEventContext.trigger( "ajax" + ( isSuccess ? "Success" : "Error" ), - [ jqXHR, s, isSuccess ? success : error ] ); - } - - // Complete - completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); - - if ( fireGlobals ) { - globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); - // Handle the global AJAX counter - if ( !( --jQuery.active ) ) { - jQuery.event.trigger( "ajaxStop" ); - } - } - } - - // Attach deferreds - deferred.promise( jqXHR ); - jqXHR.success = jqXHR.done; - jqXHR.error = jqXHR.fail; - jqXHR.complete = completeDeferred.add; - - // Status-dependent callbacks - jqXHR.statusCode = function( map ) { - if ( map ) { - var tmp; - if ( state < 2 ) { - for ( tmp in map ) { - statusCode[ tmp ] = [ statusCode[tmp], map[tmp] ]; - } - } else { - tmp = map[ jqXHR.status ]; - jqXHR.always( tmp ); - } - } - return this; - }; - - // Remove hash character (#7531: and string promotion) - // Add protocol if not provided (#5866: IE7 issue with protocol-less urls) - // We also use the url parameter if available - s.url = ( ( url || s.url ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" ); - - // Extract dataTypes list - s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( core_rspace ); - - // A cross-domain request is in order when we have a protocol:host:port mismatch - if ( s.crossDomain == null ) { - parts = rurl.exec( s.url.toLowerCase() ); - s.crossDomain = !!( parts && - ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] || - ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) != - ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) ) - ); - } - - // Convert data if not already a string - if ( s.data && s.processData && typeof s.data !== "string" ) { - s.data = jQuery.param( s.data, s.traditional ); - } - - // Apply prefilters - inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); - - // If request was aborted inside a prefilter, stop there - if ( state === 2 ) { - return jqXHR; - } - - // We can fire global events as of now if asked to - fireGlobals = s.global; - - // Uppercase the type - s.type = s.type.toUpperCase(); - - // Determine if request has content - s.hasContent = !rnoContent.test( s.type ); - - // Watch for a new set of requests - if ( fireGlobals && jQuery.active++ === 0 ) { - jQuery.event.trigger( "ajaxStart" ); - } - - // More options handling for requests with no content - if ( !s.hasContent ) { - - // If data is available, append data to url - if ( s.data ) { - s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data; - // #9682: remove data so that it's not used in an eventual retry - delete s.data; - } - - // Get ifModifiedKey before adding the anti-cache parameter - ifModifiedKey = s.url; - - // Add anti-cache in url if needed - if ( s.cache === false ) { - - var ts = jQuery.now(), - // try replacing _= if it is there - ret = s.url.replace( rts, "$1_=" + ts ); - - // if nothing was replaced, add timestamp to the end - s.url = ret + ( ( ret === s.url ) ? ( rquery.test( s.url ) ? "&" : "?" ) + "_=" + ts : "" ); - } - } - - // Set the correct header, if data is being sent - if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { - jqXHR.setRequestHeader( "Content-Type", s.contentType ); - } - - // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. - if ( s.ifModified ) { - ifModifiedKey = ifModifiedKey || s.url; - if ( jQuery.lastModified[ ifModifiedKey ] ) { - jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ ifModifiedKey ] ); - } - if ( jQuery.etag[ ifModifiedKey ] ) { - jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ ifModifiedKey ] ); - } - } - - // Set the Accepts header for the server, depending on the dataType - jqXHR.setRequestHeader( - "Accept", - s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ? - s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : - s.accepts[ "*" ] - ); - - // Check for headers option - for ( i in s.headers ) { - jqXHR.setRequestHeader( i, s.headers[ i ] ); - } - - // Allow custom headers/mimetypes and early abort - if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) { - // Abort if not done already and return - return jqXHR.abort(); - - } - - // aborting is no longer a cancellation - strAbort = "abort"; - - // Install callbacks on deferreds - for ( i in { success: 1, error: 1, complete: 1 } ) { - jqXHR[ i ]( s[ i ] ); - } - - // Get transport - transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); - - // If no transport, we auto-abort - if ( !transport ) { - done( -1, "No Transport" ); - } else { - jqXHR.readyState = 1; - // Send global event - if ( fireGlobals ) { - globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); - } - // Timeout - if ( s.async && s.timeout > 0 ) { - timeoutTimer = setTimeout( function(){ - jqXHR.abort( "timeout" ); - }, s.timeout ); - } - - try { - state = 1; - transport.send( requestHeaders, done ); - } catch (e) { - // Propagate exception as error if not done - if ( state < 2 ) { - done( -1, e ); - // Simply rethrow otherwise - } else { - throw e; - } - } - } - - return jqXHR; - }, - - // Counter for holding the number of active queries - active: 0, - - // Last-Modified header cache for next request - lastModified: {}, - etag: {} + getScript: function( url, callback ) { + return jQuery.get( url, undefined, callback, "script" ); + }, + + getJSON: function( url, data, callback ) { + return jQuery.get( url, data, callback, "json" ); + }, + + // Creates a full fledged settings object into target + // with both ajaxSettings and settings fields. + // If target is omitted, writes into ajaxSettings. + ajaxSetup: function( target, settings ) { + if ( settings ) { + // Building a settings object + ajaxExtend( target, jQuery.ajaxSettings ); + } else { + // Extending ajaxSettings + settings = target; + target = jQuery.ajaxSettings; + } + ajaxExtend( target, settings ); + return target; + }, + + ajaxSettings: { + url: ajaxLocation, + isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ), + global: true, + type: "GET", + contentType: "application/x-www-form-urlencoded; charset=UTF-8", + processData: true, + async: true, + /* + timeout: 0, + data: null, + dataType: null, + username: null, + password: null, + cache: null, + throws: false, + traditional: false, + headers: {}, + */ + + accepts: { + xml: "application/xml, text/xml", + html: "text/html", + text: "text/plain", + json: "application/json, text/javascript", + "*": allTypes + }, + + contents: { + xml: /xml/, + html: /html/, + json: /json/ + }, + + responseFields: { + xml: "responseXML", + text: "responseText" + }, + + // List of data converters + // 1) key format is "source_type destination_type" (a single space in-between) + // 2) the catchall symbol "*" can be used for source_type + converters: { + + // Convert anything to text + "* text": window.String, + + // Text to html (true = no transformation) + "text html": true, + + // Evaluate text as a json expression + "text json": jQuery.parseJSON, + + // Parse text as xml + "text xml": jQuery.parseXML + }, + + // For options that shouldn't be deep extended: + // you can add your own custom options here if + // and when you create one that shouldn't be + // deep extended (see ajaxExtend) + flatOptions: { + context: true, + url: true + } + }, + + ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), + ajaxTransport: addToPrefiltersOrTransports( transports ), + + // Main method + ajax: function( url, options ) { + + // If url is an object, simulate pre-1.5 signature + if ( typeof url === "object" ) { + options = url; + url = undefined; + } + + // Force options to be an object + options = options || {}; + + var // ifModified key + ifModifiedKey, + // Response headers + responseHeadersString, + responseHeaders, + // transport + transport, + // timeout handle + timeoutTimer, + // Cross-domain detection vars + parts, + // To know if global events are to be dispatched + fireGlobals, + // Loop variable + i, + // Create the final options object + s = jQuery.ajaxSetup( {}, options ), + // Callbacks context + callbackContext = s.context || s, + // Context for global events + // It's the callbackContext if one was provided in the options + // and if it's a DOM node or a jQuery collection + globalEventContext = callbackContext !== s && + ( callbackContext.nodeType || callbackContext instanceof jQuery ) ? + jQuery( callbackContext ) : jQuery.event, + // Deferreds + deferred = jQuery.Deferred(), + completeDeferred = jQuery.Callbacks( "once memory" ), + // Status-dependent callbacks + statusCode = s.statusCode || {}, + // Headers (they are sent all at once) + requestHeaders = {}, + requestHeadersNames = {}, + // The jqXHR state + state = 0, + // Default abort message + strAbort = "canceled", + // Fake xhr + jqXHR = { + + readyState: 0, + + // Caches the header + setRequestHeader: function( name, value ) { + if ( !state ) { + var lname = name.toLowerCase(); + name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name; + requestHeaders[ name ] = value; + } + return this; + }, + + // Raw string + getAllResponseHeaders: function() { + return state === 2 ? responseHeadersString : null; + }, + + // Builds headers hashtable if needed + getResponseHeader: function( key ) { + var match; + if ( state === 2 ) { + if ( !responseHeaders ) { + responseHeaders = {}; + while( ( match = rheaders.exec( responseHeadersString ) ) ) { + responseHeaders[ match[1].toLowerCase() ] = match[ 2 ]; + } + } + match = responseHeaders[ key.toLowerCase() ]; + } + return match === undefined ? null : match; + }, + + // Overrides response content-type header + overrideMimeType: function( type ) { + if ( !state ) { + s.mimeType = type; + } + return this; + }, + + // Cancel the request + abort: function( statusText ) { + statusText = statusText || strAbort; + if ( transport ) { + transport.abort( statusText ); + } + done( 0, statusText ); + return this; + } + }; + + // Callback for when everything is done + // It is defined here because jslint complains if it is declared + // at the end of the function (which would be more logical and readable) + function done( status, nativeStatusText, responses, headers ) { + var isSuccess, success, error, response, modified, + statusText = nativeStatusText; + + // Called once + if ( state === 2 ) { + return; + } + + // State is "done" now + state = 2; + + // Clear timeout if it exists + if ( timeoutTimer ) { + clearTimeout( timeoutTimer ); + } + + // Dereference transport for early garbage collection + // (no matter how long the jqXHR object will be used) + transport = undefined; + + // Cache response headers + responseHeadersString = headers || ""; + + // Set readyState + jqXHR.readyState = status > 0 ? 4 : 0; + + // Get response data + if ( responses ) { + response = ajaxHandleResponses( s, jqXHR, responses ); + } + + // If successful, handle type chaining + if ( status >= 200 && status < 300 || status === 304 ) { + + // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. + if ( s.ifModified ) { + + modified = jqXHR.getResponseHeader("Last-Modified"); + if ( modified ) { + jQuery.lastModified[ ifModifiedKey ] = modified; + } + modified = jqXHR.getResponseHeader("Etag"); + if ( modified ) { + jQuery.etag[ ifModifiedKey ] = modified; + } + } + + // If not modified + if ( status === 304 ) { + + statusText = "notmodified"; + isSuccess = true; + + // If we have data + } else { + + isSuccess = ajaxConvert( s, response ); + statusText = isSuccess.state; + success = isSuccess.data; + error = isSuccess.error; + isSuccess = !error; + } + } else { + // We extract error from statusText + // then normalize statusText and status for non-aborts + error = statusText; + if ( !statusText || status ) { + statusText = "error"; + if ( status < 0 ) { + status = 0; + } + } + } + + // Set data for the fake xhr object + jqXHR.status = status; + jqXHR.statusText = ( nativeStatusText || statusText ) + ""; + + // Success/Error + if ( isSuccess ) { + deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); + } else { + deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); + } + + // Status-dependent callbacks + jqXHR.statusCode( statusCode ); + statusCode = undefined; + + if ( fireGlobals ) { + globalEventContext.trigger( "ajax" + ( isSuccess ? "Success" : "Error" ), + [ jqXHR, s, isSuccess ? success : error ] ); + } + + // Complete + completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); + + if ( fireGlobals ) { + globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); + // Handle the global AJAX counter + if ( !( --jQuery.active ) ) { + jQuery.event.trigger( "ajaxStop" ); + } + } + } + + // Attach deferreds + deferred.promise( jqXHR ); + jqXHR.success = jqXHR.done; + jqXHR.error = jqXHR.fail; + jqXHR.complete = completeDeferred.add; + + // Status-dependent callbacks + jqXHR.statusCode = function( map ) { + if ( map ) { + var tmp; + if ( state < 2 ) { + for ( tmp in map ) { + statusCode[ tmp ] = [ statusCode[tmp], map[tmp] ]; + } + } else { + tmp = map[ jqXHR.status ]; + jqXHR.always( tmp ); + } + } + return this; + }; + + // Remove hash character (#7531: and string promotion) + // Add protocol if not provided (#5866: IE7 issue with protocol-less urls) + // We also use the url parameter if available + s.url = ( ( url || s.url ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" ); + + // Extract dataTypes list + s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( core_rspace ); + + // A cross-domain request is in order when we have a protocol:host:port mismatch + if ( s.crossDomain == null ) { + parts = rurl.exec( s.url.toLowerCase() ); + s.crossDomain = !!( parts && + ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] || + ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) != + ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) ) + ); + } + + // Convert data if not already a string + if ( s.data && s.processData && typeof s.data !== "string" ) { + s.data = jQuery.param( s.data, s.traditional ); + } + + // Apply prefilters + inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); + + // If request was aborted inside a prefilter, stop there + if ( state === 2 ) { + return jqXHR; + } + + // We can fire global events as of now if asked to + fireGlobals = s.global; + + // Uppercase the type + s.type = s.type.toUpperCase(); + + // Determine if request has content + s.hasContent = !rnoContent.test( s.type ); + + // Watch for a new set of requests + if ( fireGlobals && jQuery.active++ === 0 ) { + jQuery.event.trigger( "ajaxStart" ); + } + + // More options handling for requests with no content + if ( !s.hasContent ) { + + // If data is available, append data to url + if ( s.data ) { + s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data; + // #9682: remove data so that it's not used in an eventual retry + delete s.data; + } + + // Get ifModifiedKey before adding the anti-cache parameter + ifModifiedKey = s.url; + + // Add anti-cache in url if needed + if ( s.cache === false ) { + + var ts = jQuery.now(), + // try replacing _= if it is there + ret = s.url.replace( rts, "$1_=" + ts ); + + // if nothing was replaced, add timestamp to the end + s.url = ret + ( ( ret === s.url ) ? ( rquery.test( s.url ) ? "&" : "?" ) + "_=" + ts : "" ); + } + } + + // Set the correct header, if data is being sent + if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { + jqXHR.setRequestHeader( "Content-Type", s.contentType ); + } + + // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. + if ( s.ifModified ) { + ifModifiedKey = ifModifiedKey || s.url; + if ( jQuery.lastModified[ ifModifiedKey ] ) { + jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ ifModifiedKey ] ); + } + if ( jQuery.etag[ ifModifiedKey ] ) { + jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ ifModifiedKey ] ); + } + } + + // Set the Accepts header for the server, depending on the dataType + jqXHR.setRequestHeader( + "Accept", + s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ? + s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : + s.accepts[ "*" ] + ); + + // Check for headers option + for ( i in s.headers ) { + jqXHR.setRequestHeader( i, s.headers[ i ] ); + } + + // Allow custom headers/mimetypes and early abort + if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) { + // Abort if not done already and return + return jqXHR.abort(); + + } + + // aborting is no longer a cancellation + strAbort = "abort"; + + // Install callbacks on deferreds + for ( i in { success: 1, error: 1, complete: 1 } ) { + jqXHR[ i ]( s[ i ] ); + } + + // Get transport + transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); + + // If no transport, we auto-abort + if ( !transport ) { + done( -1, "No Transport" ); + } else { + jqXHR.readyState = 1; + // Send global event + if ( fireGlobals ) { + globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); + } + // Timeout + if ( s.async && s.timeout > 0 ) { + timeoutTimer = setTimeout( function(){ + jqXHR.abort( "timeout" ); + }, s.timeout ); + } + + try { + state = 1; + transport.send( requestHeaders, done ); + } catch (e) { + // Propagate exception as error if not done + if ( state < 2 ) { + done( -1, e ); + // Simply rethrow otherwise + } else { + throw e; + } + } + } + + return jqXHR; + }, + + // Counter for holding the number of active queries + active: 0, + + // Last-Modified header cache for next request + lastModified: {}, + etag: {} }); @@ -8014,1441 +8014,1441 @@ jQuery.extend({ */ function ajaxHandleResponses( s, jqXHR, responses ) { - var ct, type, finalDataType, firstDataType, - contents = s.contents, - dataTypes = s.dataTypes, - responseFields = s.responseFields; + var ct, type, finalDataType, firstDataType, + contents = s.contents, + dataTypes = s.dataTypes, + responseFields = s.responseFields; - // Fill responseXXX fields - for ( type in responseFields ) { - if ( type in responses ) { - jqXHR[ responseFields[type] ] = responses[ type ]; - } - } + // Fill responseXXX fields + for ( type in responseFields ) { + if ( type in responses ) { + jqXHR[ responseFields[type] ] = responses[ type ]; + } + } - // Remove auto dataType and get content-type in the process - while( dataTypes[ 0 ] === "*" ) { - dataTypes.shift(); - if ( ct === undefined ) { - ct = s.mimeType || jqXHR.getResponseHeader( "content-type" ); - } - } + // Remove auto dataType and get content-type in the process + while( dataTypes[ 0 ] === "*" ) { + dataTypes.shift(); + if ( ct === undefined ) { + ct = s.mimeType || jqXHR.getResponseHeader( "content-type" ); + } + } - // Check if we're dealing with a known content-type - if ( ct ) { - for ( type in contents ) { - if ( contents[ type ] && contents[ type ].test( ct ) ) { - dataTypes.unshift( type ); - break; - } - } - } + // Check if we're dealing with a known content-type + if ( ct ) { + for ( type in contents ) { + if ( contents[ type ] && contents[ type ].test( ct ) ) { + dataTypes.unshift( type ); + break; + } + } + } - // Check to see if we have a response for the expected dataType - if ( dataTypes[ 0 ] in responses ) { - finalDataType = dataTypes[ 0 ]; - } else { - // Try convertible dataTypes - for ( type in responses ) { - if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) { - finalDataType = type; - break; - } - if ( !firstDataType ) { - firstDataType = type; - } - } - // Or just use first one - finalDataType = finalDataType || firstDataType; - } + // Check to see if we have a response for the expected dataType + if ( dataTypes[ 0 ] in responses ) { + finalDataType = dataTypes[ 0 ]; + } else { + // Try convertible dataTypes + for ( type in responses ) { + if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) { + finalDataType = type; + break; + } + if ( !firstDataType ) { + firstDataType = type; + } + } + // Or just use first one + finalDataType = finalDataType || firstDataType; + } - // If we found a dataType - // We add the dataType to the list if needed - // and return the corresponding response - if ( finalDataType ) { - if ( finalDataType !== dataTypes[ 0 ] ) { - dataTypes.unshift( finalDataType ); - } - return responses[ finalDataType ]; - } + // If we found a dataType + // We add the dataType to the list if needed + // and return the corresponding response + if ( finalDataType ) { + if ( finalDataType !== dataTypes[ 0 ] ) { + dataTypes.unshift( finalDataType ); + } + return responses[ finalDataType ]; + } } // Chain conversions given the request and the original response function ajaxConvert( s, response ) { - var conv, conv2, current, tmp, - // Work with a copy of dataTypes in case we need to modify it for conversion - dataTypes = s.dataTypes.slice(), - prev = dataTypes[ 0 ], - converters = {}, - i = 0; + var conv, conv2, current, tmp, + // Work with a copy of dataTypes in case we need to modify it for conversion + dataTypes = s.dataTypes.slice(), + prev = dataTypes[ 0 ], + converters = {}, + i = 0; - // Apply the dataFilter if provided - if ( s.dataFilter ) { - response = s.dataFilter( response, s.dataType ); - } + // Apply the dataFilter if provided + if ( s.dataFilter ) { + response = s.dataFilter( response, s.dataType ); + } - // Create converters map with lowercased keys - if ( dataTypes[ 1 ] ) { - for ( conv in s.converters ) { - converters[ conv.toLowerCase() ] = s.converters[ conv ]; - } - } + // Create converters map with lowercased keys + if ( dataTypes[ 1 ] ) { + for ( conv in s.converters ) { + converters[ conv.toLowerCase() ] = s.converters[ conv ]; + } + } - // Convert to each sequential dataType, tolerating list modification - for ( ; (current = dataTypes[++i]); ) { + // Convert to each sequential dataType, tolerating list modification + for ( ; (current = dataTypes[++i]); ) { - // There's only work to do if current dataType is non-auto - if ( current !== "*" ) { + // There's only work to do if current dataType is non-auto + if ( current !== "*" ) { - // Convert response if prev dataType is non-auto and differs from current - if ( prev !== "*" && prev !== current ) { + // Convert response if prev dataType is non-auto and differs from current + if ( prev !== "*" && prev !== current ) { - // Seek a direct converter - conv = converters[ prev + " " + current ] || converters[ "* " + current ]; + // Seek a direct converter + conv = converters[ prev + " " + current ] || converters[ "* " + current ]; - // If none found, seek a pair - if ( !conv ) { - for ( conv2 in converters ) { + // If none found, seek a pair + if ( !conv ) { + for ( conv2 in converters ) { - // If conv2 outputs current - tmp = conv2.split(" "); - if ( tmp[ 1 ] === current ) { + // If conv2 outputs current + tmp = conv2.split(" "); + if ( tmp[ 1 ] === current ) { - // If prev can be converted to accepted input - conv = converters[ prev + " " + tmp[ 0 ] ] || - converters[ "* " + tmp[ 0 ] ]; - if ( conv ) { - // Condense equivalence converters - if ( conv === true ) { - conv = converters[ conv2 ]; + // If prev can be converted to accepted input + conv = converters[ prev + " " + tmp[ 0 ] ] || + converters[ "* " + tmp[ 0 ] ]; + if ( conv ) { + // Condense equivalence converters + if ( conv === true ) { + conv = converters[ conv2 ]; - // Otherwise, insert the intermediate dataType - } else if ( converters[ conv2 ] !== true ) { - current = tmp[ 0 ]; - dataTypes.splice( i--, 0, current ); - } + // Otherwise, insert the intermediate dataType + } else if ( converters[ conv2 ] !== true ) { + current = tmp[ 0 ]; + dataTypes.splice( i--, 0, current ); + } - break; - } - } - } - } + break; + } + } + } + } - // Apply converter (if not an equivalence) - if ( conv !== true ) { + // Apply converter (if not an equivalence) + if ( conv !== true ) { - // Unless errors are allowed to bubble, catch and return them - if ( conv && s["throws"] ) { - response = conv( response ); - } else { - try { - response = conv( response ); - } catch ( e ) { - return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current }; - } - } - } - } + // Unless errors are allowed to bubble, catch and return them + if ( conv && s["throws"] ) { + response = conv( response ); + } else { + try { + response = conv( response ); + } catch ( e ) { + return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current }; + } + } + } + } - // Update prev for next iteration - prev = current; - } - } + // Update prev for next iteration + prev = current; + } + } - return { state: "success", data: response }; + return { state: "success", data: response }; } var oldCallbacks = [], - rquestion = /\?/, - rjsonp = /(=)\?(?=&|$)|\?\?/, - nonce = jQuery.now(); + rquestion = /\?/, + rjsonp = /(=)\?(?=&|$)|\?\?/, + nonce = jQuery.now(); // Default jsonp settings jQuery.ajaxSetup({ - jsonp: "callback", - jsonpCallback: function() { - var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) ); - this[ callback ] = true; - return callback; - } + jsonp: "callback", + jsonpCallback: function() { + var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) ); + this[ callback ] = true; + return callback; + } }); // Detect, normalize options and install callbacks for jsonp requests jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { - var callbackName, overwritten, responseContainer, - data = s.data, - url = s.url, - hasCallback = s.jsonp !== false, - replaceInUrl = hasCallback && rjsonp.test( url ), - replaceInData = hasCallback && !replaceInUrl && typeof data === "string" && - !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && - rjsonp.test( data ); + var callbackName, overwritten, responseContainer, + data = s.data, + url = s.url, + hasCallback = s.jsonp !== false, + replaceInUrl = hasCallback && rjsonp.test( url ), + replaceInData = hasCallback && !replaceInUrl && typeof data === "string" && + !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && + rjsonp.test( data ); - // Handle iff the expected data type is "jsonp" or we have a parameter to set - if ( s.dataTypes[ 0 ] === "jsonp" || replaceInUrl || replaceInData ) { + // Handle iff the expected data type is "jsonp" or we have a parameter to set + if ( s.dataTypes[ 0 ] === "jsonp" || replaceInUrl || replaceInData ) { - // Get callback name, remembering preexisting value associated with it - callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ? - s.jsonpCallback() : - s.jsonpCallback; - overwritten = window[ callbackName ]; + // Get callback name, remembering preexisting value associated with it + callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ? + s.jsonpCallback() : + s.jsonpCallback; + overwritten = window[ callbackName ]; - // Insert callback into url or form data - if ( replaceInUrl ) { - s.url = url.replace( rjsonp, "$1" + callbackName ); - } else if ( replaceInData ) { - s.data = data.replace( rjsonp, "$1" + callbackName ); - } else if ( hasCallback ) { - s.url += ( rquestion.test( url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; - } + // Insert callback into url or form data + if ( replaceInUrl ) { + s.url = url.replace( rjsonp, "$1" + callbackName ); + } else if ( replaceInData ) { + s.data = data.replace( rjsonp, "$1" + callbackName ); + } else if ( hasCallback ) { + s.url += ( rquestion.test( url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; + } - // Use data converter to retrieve json after script execution - s.converters["script json"] = function() { - if ( !responseContainer ) { - jQuery.error( callbackName + " was not called" ); - } - return responseContainer[ 0 ]; - }; + // Use data converter to retrieve json after script execution + s.converters["script json"] = function() { + if ( !responseContainer ) { + jQuery.error( callbackName + " was not called" ); + } + return responseContainer[ 0 ]; + }; - // force json dataType - s.dataTypes[ 0 ] = "json"; + // force json dataType + s.dataTypes[ 0 ] = "json"; - // Install callback - window[ callbackName ] = function() { - responseContainer = arguments; - }; + // Install callback + window[ callbackName ] = function() { + responseContainer = arguments; + }; - // Clean-up function (fires after converters) - jqXHR.always(function() { - // Restore preexisting value - window[ callbackName ] = overwritten; + // Clean-up function (fires after converters) + jqXHR.always(function() { + // Restore preexisting value + window[ callbackName ] = overwritten; - // Save back as free - if ( s[ callbackName ] ) { - // make sure that re-using the options doesn't screw things around - s.jsonpCallback = originalSettings.jsonpCallback; + // Save back as free + if ( s[ callbackName ] ) { + // make sure that re-using the options doesn't screw things around + s.jsonpCallback = originalSettings.jsonpCallback; - // save the callback name for future use - oldCallbacks.push( callbackName ); - } + // save the callback name for future use + oldCallbacks.push( callbackName ); + } - // Call if it was a function and we have a response - if ( responseContainer && jQuery.isFunction( overwritten ) ) { - overwritten( responseContainer[ 0 ] ); - } + // Call if it was a function and we have a response + if ( responseContainer && jQuery.isFunction( overwritten ) ) { + overwritten( responseContainer[ 0 ] ); + } - responseContainer = overwritten = undefined; - }); + responseContainer = overwritten = undefined; + }); - // Delegate to script - return "script"; - } + // Delegate to script + return "script"; + } }); // Install script dataType jQuery.ajaxSetup({ - accepts: { - script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" - }, - contents: { - script: /javascript|ecmascript/ - }, - converters: { - "text script": function( text ) { - jQuery.globalEval( text ); - return text; - } - } + accepts: { + script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" + }, + contents: { + script: /javascript|ecmascript/ + }, + converters: { + "text script": function( text ) { + jQuery.globalEval( text ); + return text; + } + } }); // Handle cache's special case and global jQuery.ajaxPrefilter( "script", function( s ) { - if ( s.cache === undefined ) { - s.cache = false; - } - if ( s.crossDomain ) { - s.type = "GET"; - s.global = false; - } + if ( s.cache === undefined ) { + s.cache = false; + } + if ( s.crossDomain ) { + s.type = "GET"; + s.global = false; + } }); // Bind script tag hack transport jQuery.ajaxTransport( "script", function(s) { - // This transport only deals with cross domain requests - if ( s.crossDomain ) { + // This transport only deals with cross domain requests + if ( s.crossDomain ) { - var script, - head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement; + var script, + head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement; - return { + return { - send: function( _, callback ) { + send: function( _, callback ) { - script = document.createElement( "script" ); + script = document.createElement( "script" ); - script.async = "async"; + script.async = "async"; - if ( s.scriptCharset ) { - script.charset = s.scriptCharset; - } + if ( s.scriptCharset ) { + script.charset = s.scriptCharset; + } - script.src = s.url; + script.src = s.url; - // Attach handlers for all browsers - script.onload = script.onreadystatechange = function( _, isAbort ) { + // Attach handlers for all browsers + script.onload = script.onreadystatechange = function( _, isAbort ) { - if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) { + if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) { - // Handle memory leak in IE - script.onload = script.onreadystatechange = null; + // Handle memory leak in IE + script.onload = script.onreadystatechange = null; - // Remove the script - if ( head && script.parentNode ) { - head.removeChild( script ); - } + // Remove the script + if ( head && script.parentNode ) { + head.removeChild( script ); + } - // Dereference the script - script = undefined; + // Dereference the script + script = undefined; - // Callback if not abort - if ( !isAbort ) { - callback( 200, "success" ); - } - } - }; - // Use insertBefore instead of appendChild to circumvent an IE6 bug. - // This arises when a base node is used (#2709 and #4378). - head.insertBefore( script, head.firstChild ); - }, + // Callback if not abort + if ( !isAbort ) { + callback( 200, "success" ); + } + } + }; + // Use insertBefore instead of appendChild to circumvent an IE6 bug. + // This arises when a base node is used (#2709 and #4378). + head.insertBefore( script, head.firstChild ); + }, - abort: function() { - if ( script ) { - script.onload( 0, 1 ); - } - } - }; - } + abort: function() { + if ( script ) { + script.onload( 0, 1 ); + } + } + }; + } }); var xhrCallbacks, - // #5280: Internet Explorer will keep connections alive if we don't abort on unload - xhrOnUnloadAbort = window.ActiveXObject ? function() { - // Abort all pending requests - for ( var key in xhrCallbacks ) { - xhrCallbacks[ key ]( 0, 1 ); - } - } : false, - xhrId = 0; + // #5280: Internet Explorer will keep connections alive if we don't abort on unload + xhrOnUnloadAbort = window.ActiveXObject ? function() { + // Abort all pending requests + for ( var key in xhrCallbacks ) { + xhrCallbacks[ key ]( 0, 1 ); + } + } : false, + xhrId = 0; // Functions to create xhrs function createStandardXHR() { - try { - return new window.XMLHttpRequest(); - } catch( e ) {} + try { + return new window.XMLHttpRequest(); + } catch( e ) {} } function createActiveXHR() { - try { - return new window.ActiveXObject( "Microsoft.XMLHTTP" ); - } catch( e ) {} + try { + return new window.ActiveXObject( "Microsoft.XMLHTTP" ); + } catch( e ) {} } // Create the request object // (This is still attached to ajaxSettings for backward compatibility) jQuery.ajaxSettings.xhr = 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 !this.isLocal && createStandardXHR() || createActiveXHR(); - } : - // For all other browsers, use the standard XMLHttpRequest object - createStandardXHR; + /* 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 !this.isLocal && createStandardXHR() || createActiveXHR(); + } : + // For all other browsers, use the standard XMLHttpRequest object + createStandardXHR; // Determine support properties (function( xhr ) { - jQuery.extend( jQuery.support, { - ajax: !!xhr, - cors: !!xhr && ( "withCredentials" in xhr ) - }); + jQuery.extend( jQuery.support, { + ajax: !!xhr, + cors: !!xhr && ( "withCredentials" in xhr ) + }); })( jQuery.ajaxSettings.xhr() ); // Create transport if the browser can provide an xhr if ( jQuery.support.ajax ) { - jQuery.ajaxTransport(function( s ) { - // Cross domain only allowed if supported through XMLHttpRequest - if ( !s.crossDomain || jQuery.support.cors ) { + jQuery.ajaxTransport(function( s ) { + // Cross domain only allowed if supported through XMLHttpRequest + if ( !s.crossDomain || jQuery.support.cors ) { - var callback; + var callback; - return { - send: function( headers, complete ) { + return { + send: function( headers, complete ) { - // Get a new xhr - var handle, i, - xhr = s.xhr(); + // Get a new xhr + var handle, i, + xhr = s.xhr(); - // Open the socket - // Passing null username, generates a login popup on Opera (#2865) - if ( s.username ) { - xhr.open( s.type, s.url, s.async, s.username, s.password ); - } else { - xhr.open( s.type, s.url, s.async ); - } + // Open the socket + // Passing null username, generates a login popup on Opera (#2865) + if ( s.username ) { + xhr.open( s.type, s.url, s.async, s.username, s.password ); + } else { + xhr.open( s.type, s.url, s.async ); + } - // Apply custom fields if provided - if ( s.xhrFields ) { - for ( i in s.xhrFields ) { - xhr[ i ] = s.xhrFields[ i ]; - } - } + // Apply custom fields if provided + if ( s.xhrFields ) { + for ( i in s.xhrFields ) { + xhr[ i ] = s.xhrFields[ i ]; + } + } - // Override mime type if needed - if ( s.mimeType && xhr.overrideMimeType ) { - xhr.overrideMimeType( s.mimeType ); - } + // Override mime type if needed + if ( s.mimeType && xhr.overrideMimeType ) { + xhr.overrideMimeType( s.mimeType ); + } - // X-Requested-With header - // For cross-domain requests, seeing as conditions for a preflight are - // akin to a jigsaw puzzle, we simply never set it to be sure. - // (it can always be set on a per-request basis or even using ajaxSetup) - // For same-domain requests, won't change header if already provided. - if ( !s.crossDomain && !headers["X-Requested-With"] ) { - headers[ "X-Requested-With" ] = "XMLHttpRequest"; - } + // X-Requested-With header + // For cross-domain requests, seeing as conditions for a preflight are + // akin to a jigsaw puzzle, we simply never set it to be sure. + // (it can always be set on a per-request basis or even using ajaxSetup) + // For same-domain requests, won't change header if already provided. + if ( !s.crossDomain && !headers["X-Requested-With"] ) { + headers[ "X-Requested-With" ] = "XMLHttpRequest"; + } - // Need an extra try/catch for cross domain requests in Firefox 3 - try { - for ( i in headers ) { - xhr.setRequestHeader( i, headers[ i ] ); - } - } catch( _ ) {} + // Need an extra try/catch for cross domain requests in Firefox 3 + try { + for ( i in headers ) { + xhr.setRequestHeader( i, headers[ i ] ); + } + } catch( _ ) {} - // Do send the request - // This may raise an exception which is actually - // handled in jQuery.ajax (so no try/catch here) - xhr.send( ( s.hasContent && s.data ) || null ); + // Do send the request + // This may raise an exception which is actually + // handled in jQuery.ajax (so no try/catch here) + xhr.send( ( s.hasContent && s.data ) || null ); - // Listener - callback = function( _, isAbort ) { + // Listener + callback = function( _, isAbort ) { - var status, - statusText, - responseHeaders, - responses, - xml; + var status, + statusText, + responseHeaders, + responses, + xml; - // Firefox throws exceptions when accessing properties - // of an xhr when a network error occurred - // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE) - try { + // Firefox throws exceptions when accessing properties + // of an xhr when a network error occurred + // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE) + try { - // Was never called and is aborted or complete - if ( callback && ( isAbort || xhr.readyState === 4 ) ) { + // Was never called and is aborted or complete + if ( callback && ( isAbort || xhr.readyState === 4 ) ) { - // Only called once - callback = undefined; + // Only called once + callback = undefined; - // Do not keep as active anymore - if ( handle ) { - xhr.onreadystatechange = jQuery.noop; - if ( xhrOnUnloadAbort ) { - delete xhrCallbacks[ handle ]; - } - } + // Do not keep as active anymore + if ( handle ) { + xhr.onreadystatechange = jQuery.noop; + if ( xhrOnUnloadAbort ) { + delete xhrCallbacks[ handle ]; + } + } - // If it's an abort - if ( isAbort ) { - // Abort it manually if needed - if ( xhr.readyState !== 4 ) { - xhr.abort(); - } - } else { - status = xhr.status; - responseHeaders = xhr.getAllResponseHeaders(); - responses = {}; - xml = xhr.responseXML; + // If it's an abort + if ( isAbort ) { + // Abort it manually if needed + if ( xhr.readyState !== 4 ) { + xhr.abort(); + } + } else { + status = xhr.status; + responseHeaders = xhr.getAllResponseHeaders(); + responses = {}; + xml = xhr.responseXML; - // Construct response list - if ( xml && xml.documentElement /* #4958 */ ) { - responses.xml = xml; - } + // Construct response list + if ( xml && xml.documentElement /* #4958 */ ) { + responses.xml = xml; + } - // When requesting binary data, IE6-9 will throw an exception - // on any attempt to access responseText (#11426) - try { - responses.text = xhr.responseText; - } catch( e ) { - } + // When requesting binary data, IE6-9 will throw an exception + // on any attempt to access responseText (#11426) + try { + responses.text = xhr.responseText; + } catch( e ) { + } - // Firefox throws an exception when accessing - // statusText for faulty cross-domain requests - try { - statusText = xhr.statusText; - } catch( e ) { - // We normalize with Webkit giving an empty statusText - statusText = ""; - } + // Firefox throws an exception when accessing + // statusText for faulty cross-domain requests + try { + statusText = xhr.statusText; + } catch( e ) { + // We normalize with Webkit giving an empty statusText + statusText = ""; + } - // Filter status for non standard behaviors + // Filter status for non standard behaviors - // If the request is local and we have data: assume a success - // (success with no data won't get notified, that's the best we - // can do given current implementations) - if ( !status && s.isLocal && !s.crossDomain ) { - status = responses.text ? 200 : 404; - // IE - #1450: sometimes returns 1223 when it should be 204 - } else if ( status === 1223 ) { - status = 204; - } - } - } - } catch( firefoxAccessException ) { - if ( !isAbort ) { - complete( -1, firefoxAccessException ); - } - } + // If the request is local and we have data: assume a success + // (success with no data won't get notified, that's the best we + // can do given current implementations) + if ( !status && s.isLocal && !s.crossDomain ) { + status = responses.text ? 200 : 404; + // IE - #1450: sometimes returns 1223 when it should be 204 + } else if ( status === 1223 ) { + status = 204; + } + } + } + } catch( firefoxAccessException ) { + if ( !isAbort ) { + complete( -1, firefoxAccessException ); + } + } - // Call complete if needed - if ( responses ) { - complete( status, statusText, responses, responseHeaders ); - } - }; + // Call complete if needed + if ( responses ) { + complete( status, statusText, responses, responseHeaders ); + } + }; - if ( !s.async ) { - // if we're in sync mode we fire the callback - callback(); - } else if ( xhr.readyState === 4 ) { - // (IE6 & IE7) if it's in cache and has been - // retrieved directly we need to fire the callback - setTimeout( callback, 0 ); - } else { - handle = ++xhrId; - if ( xhrOnUnloadAbort ) { - // Create the active xhrs callbacks list if needed - // and attach the unload handler - if ( !xhrCallbacks ) { - xhrCallbacks = {}; - jQuery( window ).unload( xhrOnUnloadAbort ); - } - // Add to list of active xhrs callbacks - xhrCallbacks[ handle ] = callback; - } - xhr.onreadystatechange = callback; - } - }, + if ( !s.async ) { + // if we're in sync mode we fire the callback + callback(); + } else if ( xhr.readyState === 4 ) { + // (IE6 & IE7) if it's in cache and has been + // retrieved directly we need to fire the callback + setTimeout( callback, 0 ); + } else { + handle = ++xhrId; + if ( xhrOnUnloadAbort ) { + // Create the active xhrs callbacks list if needed + // and attach the unload handler + if ( !xhrCallbacks ) { + xhrCallbacks = {}; + jQuery( window ).unload( xhrOnUnloadAbort ); + } + // Add to list of active xhrs callbacks + xhrCallbacks[ handle ] = callback; + } + xhr.onreadystatechange = callback; + } + }, - abort: function() { - if ( callback ) { - callback(0,1); - } - } - }; - } - }); + abort: function() { + if ( callback ) { + callback(0,1); + } + } + }; + } + }); } var fxNow, timerId, - rfxtypes = /^(?:toggle|show|hide)$/, - rfxnum = new RegExp( "^(?:([-+])=|)(" + core_pnum + ")([a-z%]*)$", "i" ), - rrun = /queueHooks$/, - animationPrefilters = [ defaultPrefilter ], - tweeners = { - "*": [function( prop, value ) { - var end, unit, - tween = this.createTween( prop, value ), - parts = rfxnum.exec( value ), - target = tween.cur(), - start = +target || 0, - scale = 1, - maxIterations = 20; + rfxtypes = /^(?:toggle|show|hide)$/, + rfxnum = new RegExp( "^(?:([-+])=|)(" + core_pnum + ")([a-z%]*)$", "i" ), + rrun = /queueHooks$/, + animationPrefilters = [ defaultPrefilter ], + tweeners = { + "*": [function( prop, value ) { + var end, unit, + tween = this.createTween( prop, value ), + parts = rfxnum.exec( value ), + target = tween.cur(), + start = +target || 0, + scale = 1, + maxIterations = 20; - if ( parts ) { - end = +parts[2]; - unit = parts[3] || ( jQuery.cssNumber[ prop ] ? "" : "px" ); + if ( parts ) { + end = +parts[2]; + unit = parts[3] || ( jQuery.cssNumber[ prop ] ? "" : "px" ); - // We need to compute starting value - if ( unit !== "px" && start ) { - // Iteratively approximate from a nonzero starting point - // Prefer the current property, because this process will be trivial if it uses the same units - // Fallback to end or a simple constant - start = jQuery.css( tween.elem, prop, true ) || end || 1; + // We need to compute starting value + if ( unit !== "px" && start ) { + // Iteratively approximate from a nonzero starting point + // Prefer the current property, because this process will be trivial if it uses the same units + // Fallback to end or a simple constant + start = jQuery.css( tween.elem, prop, true ) || end || 1; - do { - // If previous iteration zeroed out, double until we get *something* - // Use a string for doubling factor so we don't accidentally see scale as unchanged below - scale = scale || ".5"; + do { + // If previous iteration zeroed out, double until we get *something* + // Use a string for doubling factor so we don't accidentally see scale as unchanged below + scale = scale || ".5"; - // Adjust and apply - start = start / scale; - jQuery.style( tween.elem, prop, start + unit ); + // Adjust and apply + start = start / scale; + jQuery.style( tween.elem, prop, start + unit ); - // Update scale, tolerating zero or NaN from tween.cur() - // And breaking the loop if scale is unchanged or perfect, or if we've just had enough - } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations ); - } + // Update scale, tolerating zero or NaN from tween.cur() + // And breaking the loop if scale is unchanged or perfect, or if we've just had enough + } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations ); + } - tween.unit = unit; - tween.start = start; - // If a +=/-= token was provided, we're doing a relative animation - tween.end = parts[1] ? start + ( parts[1] + 1 ) * end : end; - } - return tween; - }] - }; + tween.unit = unit; + tween.start = start; + // If a +=/-= token was provided, we're doing a relative animation + tween.end = parts[1] ? start + ( parts[1] + 1 ) * end : end; + } + return tween; + }] + }; // Animations created synchronously will run synchronously function createFxNow() { - setTimeout(function() { - fxNow = undefined; - }, 0 ); - return ( fxNow = jQuery.now() ); + setTimeout(function() { + fxNow = undefined; + }, 0 ); + return ( fxNow = jQuery.now() ); } function createTweens( animation, props ) { - jQuery.each( props, function( prop, value ) { - var collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ), - index = 0, - length = collection.length; - for ( ; index < length; index++ ) { - if ( collection[ index ].call( animation, prop, value ) ) { + jQuery.each( props, function( prop, value ) { + var collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ), + index = 0, + length = collection.length; + for ( ; index < length; index++ ) { + if ( collection[ index ].call( animation, prop, value ) ) { - // we're done with this property - return; - } - } - }); + // we're done with this property + return; + } + } + }); } function Animation( elem, properties, options ) { - var result, - index = 0, - tweenerIndex = 0, - length = animationPrefilters.length, - deferred = jQuery.Deferred().always( function() { - // don't match elem in the :animated selector - delete tick.elem; - }), - tick = function() { - var currentTime = fxNow || createFxNow(), - remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), - // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497) - temp = remaining / animation.duration || 0, - percent = 1 - temp, - index = 0, - length = animation.tweens.length; + var result, + index = 0, + tweenerIndex = 0, + length = animationPrefilters.length, + deferred = jQuery.Deferred().always( function() { + // don't match elem in the :animated selector + delete tick.elem; + }), + tick = function() { + var currentTime = fxNow || createFxNow(), + remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), + // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497) + temp = remaining / animation.duration || 0, + percent = 1 - temp, + index = 0, + length = animation.tweens.length; - for ( ; index < length ; index++ ) { - animation.tweens[ index ].run( percent ); - } + for ( ; index < length ; index++ ) { + animation.tweens[ index ].run( percent ); + } - deferred.notifyWith( elem, [ animation, percent, remaining ]); + deferred.notifyWith( elem, [ animation, percent, remaining ]); - if ( percent < 1 && length ) { - return remaining; - } else { - deferred.resolveWith( elem, [ animation ] ); - return false; - } - }, - animation = deferred.promise({ - elem: elem, - props: jQuery.extend( {}, properties ), - opts: jQuery.extend( true, { specialEasing: {} }, options ), - originalProperties: properties, - originalOptions: options, - startTime: fxNow || createFxNow(), - duration: options.duration, - tweens: [], - createTween: function( prop, end, easing ) { - var tween = jQuery.Tween( elem, animation.opts, prop, end, - animation.opts.specialEasing[ prop ] || animation.opts.easing ); - animation.tweens.push( tween ); - return tween; - }, - stop: function( gotoEnd ) { - var index = 0, - // if we are going to the end, we want to run all the tweens - // otherwise we skip this part - length = gotoEnd ? animation.tweens.length : 0; + if ( percent < 1 && length ) { + return remaining; + } else { + deferred.resolveWith( elem, [ animation ] ); + return false; + } + }, + animation = deferred.promise({ + elem: elem, + props: jQuery.extend( {}, properties ), + opts: jQuery.extend( true, { specialEasing: {} }, options ), + originalProperties: properties, + originalOptions: options, + startTime: fxNow || createFxNow(), + duration: options.duration, + tweens: [], + createTween: function( prop, end, easing ) { + var tween = jQuery.Tween( elem, animation.opts, prop, end, + animation.opts.specialEasing[ prop ] || animation.opts.easing ); + animation.tweens.push( tween ); + return tween; + }, + stop: function( gotoEnd ) { + var index = 0, + // if we are going to the end, we want to run all the tweens + // otherwise we skip this part + length = gotoEnd ? animation.tweens.length : 0; - for ( ; index < length ; index++ ) { - animation.tweens[ index ].run( 1 ); - } + for ( ; index < length ; index++ ) { + animation.tweens[ index ].run( 1 ); + } - // resolve when we played the last frame - // otherwise, reject - if ( gotoEnd ) { - deferred.resolveWith( elem, [ animation, gotoEnd ] ); - } else { - deferred.rejectWith( elem, [ animation, gotoEnd ] ); - } - return this; - } - }), - props = animation.props; + // resolve when we played the last frame + // otherwise, reject + if ( gotoEnd ) { + deferred.resolveWith( elem, [ animation, gotoEnd ] ); + } else { + deferred.rejectWith( elem, [ animation, gotoEnd ] ); + } + return this; + } + }), + props = animation.props; - propFilter( props, animation.opts.specialEasing ); + propFilter( props, animation.opts.specialEasing ); - for ( ; index < length ; index++ ) { - result = animationPrefilters[ index ].call( animation, elem, props, animation.opts ); - if ( result ) { - return result; - } - } + for ( ; index < length ; index++ ) { + result = animationPrefilters[ index ].call( animation, elem, props, animation.opts ); + if ( result ) { + return result; + } + } - createTweens( animation, props ); + createTweens( animation, props ); - if ( jQuery.isFunction( animation.opts.start ) ) { - animation.opts.start.call( elem, animation ); - } + if ( jQuery.isFunction( animation.opts.start ) ) { + animation.opts.start.call( elem, animation ); + } - jQuery.fx.timer( - jQuery.extend( tick, { - anim: animation, - queue: animation.opts.queue, - elem: elem - }) - ); + jQuery.fx.timer( + jQuery.extend( tick, { + anim: animation, + queue: animation.opts.queue, + elem: elem + }) + ); - // attach callbacks from options - return animation.progress( animation.opts.progress ) - .done( animation.opts.done, animation.opts.complete ) - .fail( animation.opts.fail ) - .always( animation.opts.always ); + // attach callbacks from options + return animation.progress( animation.opts.progress ) + .done( animation.opts.done, animation.opts.complete ) + .fail( animation.opts.fail ) + .always( animation.opts.always ); } function propFilter( props, specialEasing ) { - var index, name, easing, value, hooks; + var index, name, easing, value, hooks; - // camelCase, specialEasing and expand cssHook pass - for ( index in props ) { - name = jQuery.camelCase( index ); - easing = specialEasing[ name ]; - value = props[ index ]; - if ( jQuery.isArray( value ) ) { - easing = value[ 1 ]; - value = props[ index ] = value[ 0 ]; - } + // camelCase, specialEasing and expand cssHook pass + for ( index in props ) { + name = jQuery.camelCase( index ); + easing = specialEasing[ name ]; + value = props[ index ]; + if ( jQuery.isArray( value ) ) { + easing = value[ 1 ]; + value = props[ index ] = value[ 0 ]; + } - if ( index !== name ) { - props[ name ] = value; - delete props[ index ]; - } + if ( index !== name ) { + props[ name ] = value; + delete props[ index ]; + } - hooks = jQuery.cssHooks[ name ]; - if ( hooks && "expand" in hooks ) { - value = hooks.expand( value ); - delete props[ name ]; + hooks = jQuery.cssHooks[ name ]; + if ( hooks && "expand" in hooks ) { + value = hooks.expand( value ); + delete props[ name ]; - // not quite $.extend, this wont overwrite keys already present. - // also - reusing 'index' from above because we have the correct "name" - for ( index in value ) { - if ( !( index in props ) ) { - props[ index ] = value[ index ]; - specialEasing[ index ] = easing; - } - } - } else { - specialEasing[ name ] = easing; - } - } + // not quite $.extend, this wont overwrite keys already present. + // also - reusing 'index' from above because we have the correct "name" + for ( index in value ) { + if ( !( index in props ) ) { + props[ index ] = value[ index ]; + specialEasing[ index ] = easing; + } + } + } else { + specialEasing[ name ] = easing; + } + } } jQuery.Animation = jQuery.extend( Animation, { - tweener: function( props, callback ) { - if ( jQuery.isFunction( props ) ) { - callback = props; - props = [ "*" ]; - } else { - props = props.split(" "); - } + tweener: function( props, callback ) { + if ( jQuery.isFunction( props ) ) { + callback = props; + props = [ "*" ]; + } else { + props = props.split(" "); + } - var prop, - index = 0, - length = props.length; + var prop, + index = 0, + length = props.length; - for ( ; index < length ; index++ ) { - prop = props[ index ]; - tweeners[ prop ] = tweeners[ prop ] || []; - tweeners[ prop ].unshift( callback ); - } - }, + for ( ; index < length ; index++ ) { + prop = props[ index ]; + tweeners[ prop ] = tweeners[ prop ] || []; + tweeners[ prop ].unshift( callback ); + } + }, - prefilter: function( callback, prepend ) { - if ( prepend ) { - animationPrefilters.unshift( callback ); - } else { - animationPrefilters.push( callback ); - } - } + prefilter: function( callback, prepend ) { + if ( prepend ) { + animationPrefilters.unshift( callback ); + } else { + animationPrefilters.push( callback ); + } + } }); function defaultPrefilter( elem, props, opts ) { - var index, prop, value, length, dataShow, toggle, tween, hooks, oldfire, - anim = this, - style = elem.style, - orig = {}, - handled = [], - hidden = elem.nodeType && isHidden( elem ); + var index, prop, value, length, dataShow, toggle, tween, hooks, oldfire, + anim = this, + style = elem.style, + orig = {}, + handled = [], + hidden = elem.nodeType && isHidden( elem ); - // handle queue: false promises - if ( !opts.queue ) { - hooks = jQuery._queueHooks( elem, "fx" ); - if ( hooks.unqueued == null ) { - hooks.unqueued = 0; - oldfire = hooks.empty.fire; - hooks.empty.fire = function() { - if ( !hooks.unqueued ) { - oldfire(); - } - }; - } - hooks.unqueued++; + // handle queue: false promises + if ( !opts.queue ) { + hooks = jQuery._queueHooks( elem, "fx" ); + if ( hooks.unqueued == null ) { + hooks.unqueued = 0; + oldfire = hooks.empty.fire; + hooks.empty.fire = function() { + if ( !hooks.unqueued ) { + oldfire(); + } + }; + } + hooks.unqueued++; - anim.always(function() { - // doing this makes sure that the complete handler will be called - // before this completes - anim.always(function() { - hooks.unqueued--; - if ( !jQuery.queue( elem, "fx" ).length ) { - hooks.empty.fire(); - } - }); - }); - } + anim.always(function() { + // doing this makes sure that the complete handler will be called + // before this completes + anim.always(function() { + hooks.unqueued--; + if ( !jQuery.queue( elem, "fx" ).length ) { + hooks.empty.fire(); + } + }); + }); + } - // height/width overflow pass - if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) { - // Make sure that nothing sneaks out - // Record all 3 overflow attributes because IE does not - // change the overflow attribute when overflowX and - // overflowY are set to the same value - opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; + // height/width overflow pass + if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) { + // Make sure that nothing sneaks out + // Record all 3 overflow attributes because IE does not + // change the overflow attribute when overflowX and + // overflowY are set to the same value + opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; - // Set display property to inline-block for height/width - // animations on inline elements that are having width/height animated - if ( jQuery.css( elem, "display" ) === "inline" && - jQuery.css( elem, "float" ) === "none" ) { + // Set display property to inline-block for height/width + // animations on inline elements that are having width/height animated + if ( jQuery.css( elem, "display" ) === "inline" && + jQuery.css( elem, "float" ) === "none" ) { - // inline-level elements accept inline-block; - // block-level elements need to be inline with layout - if ( !jQuery.support.inlineBlockNeedsLayout || css_defaultDisplay( elem.nodeName ) === "inline" ) { - style.display = "inline-block"; + // inline-level elements accept inline-block; + // block-level elements need to be inline with layout + if ( !jQuery.support.inlineBlockNeedsLayout || css_defaultDisplay( elem.nodeName ) === "inline" ) { + style.display = "inline-block"; - } else { - style.zoom = 1; - } - } - } + } else { + style.zoom = 1; + } + } + } - if ( opts.overflow ) { - style.overflow = "hidden"; - if ( !jQuery.support.shrinkWrapBlocks ) { - anim.done(function() { - style.overflow = opts.overflow[ 0 ]; - style.overflowX = opts.overflow[ 1 ]; - style.overflowY = opts.overflow[ 2 ]; - }); - } - } + if ( opts.overflow ) { + style.overflow = "hidden"; + if ( !jQuery.support.shrinkWrapBlocks ) { + anim.done(function() { + style.overflow = opts.overflow[ 0 ]; + style.overflowX = opts.overflow[ 1 ]; + style.overflowY = opts.overflow[ 2 ]; + }); + } + } - // show/hide pass - for ( index in props ) { - value = props[ index ]; - if ( rfxtypes.exec( value ) ) { - delete props[ index ]; - toggle = toggle || value === "toggle"; - if ( value === ( hidden ? "hide" : "show" ) ) { - continue; - } - handled.push( index ); - } - } + // show/hide pass + for ( index in props ) { + value = props[ index ]; + if ( rfxtypes.exec( value ) ) { + delete props[ index ]; + toggle = toggle || value === "toggle"; + if ( value === ( hidden ? "hide" : "show" ) ) { + continue; + } + handled.push( index ); + } + } - length = handled.length; - if ( length ) { - dataShow = jQuery._data( elem, "fxshow" ) || jQuery._data( elem, "fxshow", {} ); - if ( "hidden" in dataShow ) { - hidden = dataShow.hidden; - } + length = handled.length; + if ( length ) { + dataShow = jQuery._data( elem, "fxshow" ) || jQuery._data( elem, "fxshow", {} ); + if ( "hidden" in dataShow ) { + hidden = dataShow.hidden; + } - // store state if its toggle - enables .stop().toggle() to "reverse" - if ( toggle ) { - dataShow.hidden = !hidden; - } - if ( hidden ) { - jQuery( elem ).show(); - } else { - anim.done(function() { - jQuery( elem ).hide(); - }); - } - anim.done(function() { - var prop; - jQuery.removeData( elem, "fxshow", true ); - for ( prop in orig ) { - jQuery.style( elem, prop, orig[ prop ] ); - } - }); - for ( index = 0 ; index < length ; index++ ) { - prop = handled[ index ]; - tween = anim.createTween( prop, hidden ? dataShow[ prop ] : 0 ); - orig[ prop ] = dataShow[ prop ] || jQuery.style( elem, prop ); + // store state if its toggle - enables .stop().toggle() to "reverse" + if ( toggle ) { + dataShow.hidden = !hidden; + } + if ( hidden ) { + jQuery( elem ).show(); + } else { + anim.done(function() { + jQuery( elem ).hide(); + }); + } + anim.done(function() { + var prop; + jQuery.removeData( elem, "fxshow", true ); + for ( prop in orig ) { + jQuery.style( elem, prop, orig[ prop ] ); + } + }); + for ( index = 0 ; index < length ; index++ ) { + prop = handled[ index ]; + tween = anim.createTween( prop, hidden ? dataShow[ prop ] : 0 ); + orig[ prop ] = dataShow[ prop ] || jQuery.style( elem, prop ); - if ( !( prop in dataShow ) ) { - dataShow[ prop ] = tween.start; - if ( hidden ) { - tween.end = tween.start; - tween.start = prop === "width" || prop === "height" ? 1 : 0; - } - } - } - } + if ( !( prop in dataShow ) ) { + dataShow[ prop ] = tween.start; + if ( hidden ) { + tween.end = tween.start; + tween.start = prop === "width" || prop === "height" ? 1 : 0; + } + } + } + } } function Tween( elem, options, prop, end, easing ) { - return new Tween.prototype.init( elem, options, prop, end, easing ); + return new Tween.prototype.init( elem, options, prop, end, easing ); } jQuery.Tween = Tween; Tween.prototype = { - constructor: Tween, - init: function( elem, options, prop, end, easing, unit ) { - this.elem = elem; - this.prop = prop; - this.easing = easing || "swing"; - this.options = options; - this.start = this.now = this.cur(); - this.end = end; - this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); - }, - cur: function() { - var hooks = Tween.propHooks[ this.prop ]; + constructor: Tween, + init: function( elem, options, prop, end, easing, unit ) { + this.elem = elem; + this.prop = prop; + this.easing = easing || "swing"; + this.options = options; + this.start = this.now = this.cur(); + this.end = end; + this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); + }, + cur: function() { + var hooks = Tween.propHooks[ this.prop ]; - return hooks && hooks.get ? - hooks.get( this ) : - Tween.propHooks._default.get( this ); - }, - run: function( percent ) { - var eased, - hooks = Tween.propHooks[ this.prop ]; + return hooks && hooks.get ? + hooks.get( this ) : + Tween.propHooks._default.get( this ); + }, + run: function( percent ) { + var eased, + hooks = Tween.propHooks[ this.prop ]; - if ( this.options.duration ) { - this.pos = eased = jQuery.easing[ this.easing ]( - percent, this.options.duration * percent, 0, 1, this.options.duration - ); - } else { - this.pos = eased = percent; - } - this.now = ( this.end - this.start ) * eased + this.start; + if ( this.options.duration ) { + this.pos = eased = jQuery.easing[ this.easing ]( + percent, this.options.duration * percent, 0, 1, this.options.duration + ); + } else { + this.pos = eased = percent; + } + this.now = ( this.end - this.start ) * eased + this.start; - if ( this.options.step ) { - this.options.step.call( this.elem, this.now, this ); - } + if ( this.options.step ) { + this.options.step.call( this.elem, this.now, this ); + } - if ( hooks && hooks.set ) { - hooks.set( this ); - } else { - Tween.propHooks._default.set( this ); - } - return this; - } + if ( hooks && hooks.set ) { + hooks.set( this ); + } else { + Tween.propHooks._default.set( this ); + } + return this; + } }; Tween.prototype.init.prototype = Tween.prototype; Tween.propHooks = { - _default: { - get: function( tween ) { - var result; + _default: { + get: function( tween ) { + var result; - if ( tween.elem[ tween.prop ] != null && - (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) { - return tween.elem[ tween.prop ]; - } + if ( tween.elem[ tween.prop ] != null && + (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) { + return tween.elem[ tween.prop ]; + } - // passing any value as a 4th parameter to .css will automatically - // attempt a parseFloat and fallback to a string if the parse fails - // so, simple values such as "10px" are parsed to Float. - // complex values such as "rotate(1rad)" are returned as is. - result = jQuery.css( tween.elem, tween.prop, false, "" ); - // Empty strings, null, undefined and "auto" are converted to 0. - return !result || result === "auto" ? 0 : result; - }, - set: function( tween ) { - // use step hook for back compat - use cssHook if its there - use .style if its - // available and use plain properties where available - if ( jQuery.fx.step[ tween.prop ] ) { - jQuery.fx.step[ tween.prop ]( tween ); - } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) { - jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); - } else { - tween.elem[ tween.prop ] = tween.now; - } - } - } + // passing any value as a 4th parameter to .css will automatically + // attempt a parseFloat and fallback to a string if the parse fails + // so, simple values such as "10px" are parsed to Float. + // complex values such as "rotate(1rad)" are returned as is. + result = jQuery.css( tween.elem, tween.prop, false, "" ); + // Empty strings, null, undefined and "auto" are converted to 0. + return !result || result === "auto" ? 0 : result; + }, + set: function( tween ) { + // use step hook for back compat - use cssHook if its there - use .style if its + // available and use plain properties where available + if ( jQuery.fx.step[ tween.prop ] ) { + jQuery.fx.step[ tween.prop ]( tween ); + } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) { + jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); + } else { + tween.elem[ tween.prop ] = tween.now; + } + } + } }; // Remove in 2.0 - this supports IE8's panic based approach // to setting things on disconnected nodes Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { - set: function( tween ) { - if ( tween.elem.nodeType && tween.elem.parentNode ) { - tween.elem[ tween.prop ] = tween.now; - } - } + set: function( tween ) { + if ( tween.elem.nodeType && tween.elem.parentNode ) { + tween.elem[ tween.prop ] = tween.now; + } + } }; jQuery.each([ "toggle", "show", "hide" ], function( i, name ) { - var cssFn = jQuery.fn[ name ]; - jQuery.fn[ name ] = function( speed, easing, callback ) { - return speed == null || typeof speed === "boolean" || - // special check for .toggle( handler, handler, ... ) - ( !i && jQuery.isFunction( speed ) && jQuery.isFunction( easing ) ) ? - cssFn.apply( this, arguments ) : - this.animate( genFx( name, true ), speed, easing, callback ); - }; + var cssFn = jQuery.fn[ name ]; + jQuery.fn[ name ] = function( speed, easing, callback ) { + return speed == null || typeof speed === "boolean" || + // special check for .toggle( handler, handler, ... ) + ( !i && jQuery.isFunction( speed ) && jQuery.isFunction( easing ) ) ? + cssFn.apply( this, arguments ) : + this.animate( genFx( name, true ), speed, easing, callback ); + }; }); jQuery.fn.extend({ - fadeTo: function( speed, to, easing, callback ) { + fadeTo: function( speed, to, easing, callback ) { - // show any hidden elements after setting opacity to 0 - return this.filter( isHidden ).css( "opacity", 0 ).show() + // show any hidden elements after setting opacity to 0 + return this.filter( isHidden ).css( "opacity", 0 ).show() - // animate to the value specified - .end().animate({ opacity: to }, speed, easing, callback ); - }, - animate: function( prop, speed, easing, callback ) { - var empty = jQuery.isEmptyObject( prop ), - optall = jQuery.speed( speed, easing, callback ), - doAnimation = function() { - // Operate on a copy of prop so per-property easing won't be lost - var anim = Animation( this, jQuery.extend( {}, prop ), optall ); + // animate to the value specified + .end().animate({ opacity: to }, speed, easing, callback ); + }, + animate: function( prop, speed, easing, callback ) { + var empty = jQuery.isEmptyObject( prop ), + optall = jQuery.speed( speed, easing, callback ), + doAnimation = function() { + // Operate on a copy of prop so per-property easing won't be lost + var anim = Animation( this, jQuery.extend( {}, prop ), optall ); - // Empty animations resolve immediately - if ( empty ) { - anim.stop( true ); - } - }; + // Empty animations resolve immediately + if ( empty ) { + anim.stop( true ); + } + }; - return empty || optall.queue === false ? - this.each( doAnimation ) : - this.queue( optall.queue, doAnimation ); - }, - stop: function( type, clearQueue, gotoEnd ) { - var stopQueue = function( hooks ) { - var stop = hooks.stop; - delete hooks.stop; - stop( gotoEnd ); - }; + return empty || optall.queue === false ? + this.each( doAnimation ) : + this.queue( optall.queue, doAnimation ); + }, + stop: function( type, clearQueue, gotoEnd ) { + var stopQueue = function( hooks ) { + var stop = hooks.stop; + delete hooks.stop; + stop( gotoEnd ); + }; - if ( typeof type !== "string" ) { - gotoEnd = clearQueue; - clearQueue = type; - type = undefined; - } - if ( clearQueue && type !== false ) { - this.queue( type || "fx", [] ); - } + if ( typeof type !== "string" ) { + gotoEnd = clearQueue; + clearQueue = type; + type = undefined; + } + if ( clearQueue && type !== false ) { + this.queue( type || "fx", [] ); + } - return this.each(function() { - var dequeue = true, - index = type != null && type + "queueHooks", - timers = jQuery.timers, - data = jQuery._data( this ); + return this.each(function() { + var dequeue = true, + index = type != null && type + "queueHooks", + timers = jQuery.timers, + data = jQuery._data( this ); - if ( index ) { - if ( data[ index ] && data[ index ].stop ) { - stopQueue( data[ index ] ); - } - } else { - for ( index in data ) { - if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { - stopQueue( data[ index ] ); - } - } - } + if ( index ) { + if ( data[ index ] && data[ index ].stop ) { + stopQueue( data[ index ] ); + } + } else { + for ( index in data ) { + if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { + stopQueue( data[ index ] ); + } + } + } - for ( index = timers.length; index--; ) { - if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) { - timers[ index ].anim.stop( gotoEnd ); - dequeue = false; - timers.splice( index, 1 ); - } - } + for ( index = timers.length; index--; ) { + if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) { + timers[ index ].anim.stop( gotoEnd ); + dequeue = false; + timers.splice( index, 1 ); + } + } - // start the next in the queue if the last step wasn't forced - // timers currently will call their complete callbacks, which will dequeue - // but only if they were gotoEnd - if ( dequeue || !gotoEnd ) { - jQuery.dequeue( this, type ); - } - }); - } + // start the next in the queue if the last step wasn't forced + // timers currently will call their complete callbacks, which will dequeue + // but only if they were gotoEnd + if ( dequeue || !gotoEnd ) { + jQuery.dequeue( this, type ); + } + }); + } }); // Generate parameters to create a standard animation function genFx( type, includeWidth ) { - var which, - attrs = { height: type }, - i = 0; + var which, + attrs = { height: type }, + i = 0; - // if we include width, step value is 1 to do all cssExpand values, - // if we don't include width, step value is 2 to skip over Left and Right - includeWidth = includeWidth? 1 : 0; - for( ; i < 4 ; i += 2 - includeWidth ) { - which = cssExpand[ i ]; - attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; - } + // if we include width, step value is 1 to do all cssExpand values, + // if we don't include width, step value is 2 to skip over Left and Right + includeWidth = includeWidth? 1 : 0; + for( ; i < 4 ; i += 2 - includeWidth ) { + which = cssExpand[ i ]; + attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; + } - if ( includeWidth ) { - attrs.opacity = attrs.width = type; - } + if ( includeWidth ) { + attrs.opacity = attrs.width = type; + } - return attrs; + return attrs; } // Generate shortcuts for custom animations jQuery.each({ - slideDown: genFx("show"), - slideUp: genFx("hide"), - slideToggle: genFx("toggle"), - fadeIn: { opacity: "show" }, - fadeOut: { opacity: "hide" }, - fadeToggle: { opacity: "toggle" } + slideDown: genFx("show"), + slideUp: genFx("hide"), + slideToggle: genFx("toggle"), + fadeIn: { opacity: "show" }, + fadeOut: { opacity: "hide" }, + fadeToggle: { opacity: "toggle" } }, function( name, props ) { - jQuery.fn[ name ] = function( speed, easing, callback ) { - return this.animate( props, speed, easing, callback ); - }; + jQuery.fn[ name ] = function( speed, easing, callback ) { + return this.animate( props, speed, easing, callback ); + }; }); jQuery.speed = function( speed, easing, fn ) { - var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { - complete: fn || !fn && easing || - jQuery.isFunction( speed ) && speed, - duration: speed, - easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing - }; + var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { + complete: fn || !fn && easing || + jQuery.isFunction( speed ) && speed, + duration: speed, + easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing + }; - opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration : - opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default; + opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration : + opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default; - // normalize opt.queue - true/undefined/null -> "fx" - if ( opt.queue == null || opt.queue === true ) { - opt.queue = "fx"; - } + // normalize opt.queue - true/undefined/null -> "fx" + if ( opt.queue == null || opt.queue === true ) { + opt.queue = "fx"; + } - // Queueing - opt.old = opt.complete; + // Queueing + opt.old = opt.complete; - opt.complete = function() { - if ( jQuery.isFunction( opt.old ) ) { - opt.old.call( this ); - } + opt.complete = function() { + if ( jQuery.isFunction( opt.old ) ) { + opt.old.call( this ); + } - if ( opt.queue ) { - jQuery.dequeue( this, opt.queue ); - } - }; + if ( opt.queue ) { + jQuery.dequeue( this, opt.queue ); + } + }; - return opt; + return opt; }; jQuery.easing = { - linear: function( p ) { - return p; - }, - swing: function( p ) { - return 0.5 - Math.cos( p*Math.PI ) / 2; - } + linear: function( p ) { + return p; + }, + swing: function( p ) { + return 0.5 - Math.cos( p*Math.PI ) / 2; + } }; jQuery.timers = []; jQuery.fx = Tween.prototype.init; jQuery.fx.tick = function() { - var timer, - timers = jQuery.timers, - i = 0; + var timer, + timers = jQuery.timers, + i = 0; - fxNow = jQuery.now(); + fxNow = jQuery.now(); - for ( ; i < timers.length; i++ ) { - timer = timers[ i ]; - // Checks the timer has not already been removed - if ( !timer() && timers[ i ] === timer ) { - timers.splice( i--, 1 ); - } - } + for ( ; i < timers.length; i++ ) { + timer = timers[ i ]; + // Checks the timer has not already been removed + if ( !timer() && timers[ i ] === timer ) { + timers.splice( i--, 1 ); + } + } - if ( !timers.length ) { - jQuery.fx.stop(); - } - fxNow = undefined; + if ( !timers.length ) { + jQuery.fx.stop(); + } + fxNow = undefined; }; jQuery.fx.timer = function( timer ) { - if ( timer() && jQuery.timers.push( timer ) && !timerId ) { - timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval ); - } + if ( timer() && jQuery.timers.push( timer ) && !timerId ) { + timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval ); + } }; jQuery.fx.interval = 13; jQuery.fx.stop = function() { - clearInterval( timerId ); - timerId = null; + clearInterval( timerId ); + timerId = null; }; jQuery.fx.speeds = { - slow: 600, - fast: 200, - // Default speed - _default: 400 + slow: 600, + fast: 200, + // Default speed + _default: 400 }; // Back Compat <1.8 extension point jQuery.fx.step = {}; if ( jQuery.expr && jQuery.expr.filters ) { - jQuery.expr.filters.animated = function( elem ) { - return jQuery.grep(jQuery.timers, function( fn ) { - return elem === fn.elem; - }).length; - }; + jQuery.expr.filters.animated = function( elem ) { + return jQuery.grep(jQuery.timers, function( fn ) { + return elem === fn.elem; + }).length; + }; } var rroot = /^(?:body|html)$/i; jQuery.fn.offset = function( options ) { - if ( arguments.length ) { - return options === undefined ? - this : - this.each(function( i ) { - jQuery.offset.setOffset( this, options, i ); - }); - } + if ( arguments.length ) { + return options === undefined ? + this : + this.each(function( i ) { + jQuery.offset.setOffset( this, options, i ); + }); + } - var docElem, body, win, clientTop, clientLeft, scrollTop, scrollLeft, - box = { top: 0, left: 0 }, - elem = this[ 0 ], - doc = elem && elem.ownerDocument; + var docElem, body, win, clientTop, clientLeft, scrollTop, scrollLeft, + box = { top: 0, left: 0 }, + elem = this[ 0 ], + doc = elem && elem.ownerDocument; - if ( !doc ) { - return; - } + if ( !doc ) { + return; + } - if ( (body = doc.body) === elem ) { - return jQuery.offset.bodyOffset( elem ); - } + if ( (body = doc.body) === elem ) { + return jQuery.offset.bodyOffset( elem ); + } - docElem = doc.documentElement; + docElem = doc.documentElement; - // Make sure it's not a disconnected DOM node - if ( !jQuery.contains( docElem, elem ) ) { - return box; - } + // Make sure it's not a disconnected DOM node + if ( !jQuery.contains( docElem, elem ) ) { + return box; + } - // If we don't have gBCR, just use 0,0 rather than error - // BlackBerry 5, iOS 3 (original iPhone) - if ( typeof elem.getBoundingClientRect !== "undefined" ) { - box = elem.getBoundingClientRect(); - } - win = getWindow( doc ); - clientTop = docElem.clientTop || body.clientTop || 0; - clientLeft = docElem.clientLeft || body.clientLeft || 0; - scrollTop = win.pageYOffset || docElem.scrollTop; - scrollLeft = win.pageXOffset || docElem.scrollLeft; - return { - top: box.top + scrollTop - clientTop, - left: box.left + scrollLeft - clientLeft - }; + // If we don't have gBCR, just use 0,0 rather than error + // BlackBerry 5, iOS 3 (original iPhone) + if ( typeof elem.getBoundingClientRect !== "undefined" ) { + box = elem.getBoundingClientRect(); + } + win = getWindow( doc ); + clientTop = docElem.clientTop || body.clientTop || 0; + clientLeft = docElem.clientLeft || body.clientLeft || 0; + scrollTop = win.pageYOffset || docElem.scrollTop; + scrollLeft = win.pageXOffset || docElem.scrollLeft; + return { + top: box.top + scrollTop - clientTop, + left: box.left + scrollLeft - clientLeft + }; }; jQuery.offset = { - bodyOffset: function( body ) { - var top = body.offsetTop, - left = body.offsetLeft; + bodyOffset: function( body ) { + var top = body.offsetTop, + left = body.offsetLeft; - if ( jQuery.support.doesNotIncludeMarginInBodyOffset ) { - top += parseFloat( jQuery.css(body, "marginTop") ) || 0; - left += parseFloat( jQuery.css(body, "marginLeft") ) || 0; - } + if ( jQuery.support.doesNotIncludeMarginInBodyOffset ) { + top += parseFloat( jQuery.css(body, "marginTop") ) || 0; + left += parseFloat( jQuery.css(body, "marginLeft") ) || 0; + } - return { top: top, left: left }; - }, + return { top: top, left: left }; + }, - setOffset: function( elem, options, i ) { - var position = jQuery.css( elem, "position" ); + setOffset: function( elem, options, i ) { + var position = jQuery.css( elem, "position" ); - // set position first, in-case top/left are set even on static elem - if ( position === "static" ) { - elem.style.position = "relative"; - } + // set position first, in-case top/left are set even on static elem + if ( position === "static" ) { + elem.style.position = "relative"; + } - var curElem = jQuery( elem ), - curOffset = curElem.offset(), - curCSSTop = jQuery.css( elem, "top" ), - curCSSLeft = jQuery.css( elem, "left" ), - calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1, - props = {}, curPosition = {}, curTop, curLeft; + var curElem = jQuery( elem ), + curOffset = curElem.offset(), + curCSSTop = jQuery.css( elem, "top" ), + curCSSLeft = jQuery.css( elem, "left" ), + calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1, + props = {}, curPosition = {}, curTop, curLeft; - // need to be able to calculate position if either top or left is auto and position is either absolute or fixed - if ( calculatePosition ) { - curPosition = curElem.position(); - curTop = curPosition.top; - curLeft = curPosition.left; - } else { - curTop = parseFloat( curCSSTop ) || 0; - curLeft = parseFloat( curCSSLeft ) || 0; - } + // need to be able to calculate position if either top or left is auto and position is either absolute or fixed + if ( calculatePosition ) { + curPosition = curElem.position(); + curTop = curPosition.top; + curLeft = curPosition.left; + } else { + curTop = parseFloat( curCSSTop ) || 0; + curLeft = parseFloat( curCSSLeft ) || 0; + } - if ( jQuery.isFunction( options ) ) { - options = options.call( elem, i, curOffset ); - } + if ( jQuery.isFunction( options ) ) { + options = options.call( elem, i, curOffset ); + } - if ( options.top != null ) { - props.top = ( options.top - curOffset.top ) + curTop; - } - if ( options.left != null ) { - props.left = ( options.left - curOffset.left ) + curLeft; - } + if ( options.top != null ) { + props.top = ( options.top - curOffset.top ) + curTop; + } + if ( options.left != null ) { + props.left = ( options.left - curOffset.left ) + curLeft; + } - if ( "using" in options ) { - options.using.call( elem, props ); - } else { - curElem.css( props ); - } - } + if ( "using" in options ) { + options.using.call( elem, props ); + } else { + curElem.css( props ); + } + } }; jQuery.fn.extend({ - position: function() { - if ( !this[0] ) { - return; - } + position: function() { + if ( !this[0] ) { + return; + } - var elem = this[0], + var elem = this[0], - // Get *real* offsetParent - offsetParent = this.offsetParent(), + // Get *real* offsetParent + offsetParent = this.offsetParent(), - // Get correct offsets - offset = this.offset(), - parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset(); + // Get correct offsets + offset = this.offset(), + parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset(); - // Subtract element margins - // note: when an element has margin: auto the offsetLeft and marginLeft - // are the same in Safari causing offset.left to incorrectly be 0 - offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0; - offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0; + // Subtract element margins + // note: when an element has margin: auto the offsetLeft and marginLeft + // are the same in Safari causing offset.left to incorrectly be 0 + offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0; + offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0; - // Add offsetParent borders - parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0; - parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0; + // Add offsetParent borders + parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0; + parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0; - // Subtract the two offsets - return { - top: offset.top - parentOffset.top, - left: offset.left - parentOffset.left - }; - }, + // Subtract the two offsets + return { + top: offset.top - parentOffset.top, + left: offset.left - parentOffset.left + }; + }, - offsetParent: function() { - return this.map(function() { - var offsetParent = this.offsetParent || document.body; - while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) { - offsetParent = offsetParent.offsetParent; - } - return offsetParent || document.body; - }); - } + offsetParent: function() { + return this.map(function() { + var offsetParent = this.offsetParent || document.body; + while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) { + offsetParent = offsetParent.offsetParent; + } + return offsetParent || document.body; + }); + } }); // Create scrollLeft and scrollTop methods jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) { - var top = /Y/.test( prop ); + var top = /Y/.test( prop ); - jQuery.fn[ method ] = function( val ) { - return jQuery.access( this, function( elem, method, val ) { - var win = getWindow( elem ); + jQuery.fn[ method ] = function( val ) { + return jQuery.access( this, function( elem, method, val ) { + var win = getWindow( elem ); - if ( val === undefined ) { - return win ? (prop in win) ? win[ prop ] : - win.document.documentElement[ method ] : - elem[ method ]; - } + if ( val === undefined ) { + return win ? (prop in win) ? win[ prop ] : + win.document.documentElement[ method ] : + elem[ method ]; + } - if ( win ) { - win.scrollTo( - !top ? val : jQuery( win ).scrollLeft(), - top ? val : jQuery( win ).scrollTop() - ); + if ( win ) { + win.scrollTo( + !top ? val : jQuery( win ).scrollLeft(), + top ? val : jQuery( win ).scrollTop() + ); - } else { - elem[ method ] = val; - } - }, method, val, arguments.length, null ); - }; + } else { + elem[ method ] = val; + } + }, method, val, arguments.length, null ); + }; }); function getWindow( elem ) { - return jQuery.isWindow( elem ) ? - elem : - elem.nodeType === 9 ? - elem.defaultView || elem.parentWindow : - false; + return jQuery.isWindow( elem ) ? + elem : + elem.nodeType === 9 ? + elem.defaultView || elem.parentWindow : + false; } // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { - jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) { - // margin is only for outerHeight, outerWidth - jQuery.fn[ funcName ] = function( margin, value ) { - var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), - extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); + jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) { + // margin is only for outerHeight, outerWidth + jQuery.fn[ funcName ] = function( margin, value ) { + var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), + extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); - return jQuery.access( this, function( elem, type, value ) { - var doc; + return jQuery.access( this, function( elem, type, value ) { + var doc; - if ( jQuery.isWindow( elem ) ) { - // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there - // isn't a whole lot we can do. See pull request at this URL for discussion: - // https://github.com/jquery/jquery/pull/764 - return elem.document.documentElement[ "client" + name ]; - } + if ( jQuery.isWindow( elem ) ) { + // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there + // isn't a whole lot we can do. See pull request at this URL for discussion: + // https://github.com/jquery/jquery/pull/764 + return elem.document.documentElement[ "client" + name ]; + } - // Get document width or height - if ( elem.nodeType === 9 ) { - doc = elem.documentElement; + // Get document width or height + if ( elem.nodeType === 9 ) { + doc = elem.documentElement; - // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest - // unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it. - return Math.max( - elem.body[ "scroll" + name ], doc[ "scroll" + name ], - elem.body[ "offset" + name ], doc[ "offset" + name ], - doc[ "client" + name ] - ); - } + // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest + // unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it. + return Math.max( + elem.body[ "scroll" + name ], doc[ "scroll" + name ], + elem.body[ "offset" + name ], doc[ "offset" + name ], + doc[ "client" + name ] + ); + } - return value === undefined ? - // Get width or height on the element, requesting but not forcing parseFloat - jQuery.css( elem, type, value, extra ) : + return value === undefined ? + // Get width or height on the element, requesting but not forcing parseFloat + jQuery.css( elem, type, value, extra ) : - // Set width or height on the element - jQuery.style( elem, type, value, extra ); - }, type, chainable ? margin : undefined, chainable, null ); - }; - }); + // Set width or height on the element + jQuery.style( elem, type, value, extra ); + }, type, chainable ? margin : undefined, chainable, null ); + }; + }); }); // Expose jQuery to the global object window.jQuery = window.$ = jQuery; @@ -9466,7 +9466,7 @@ window.jQuery = window.$ = jQuery; // Do this after creating the global so that if an AMD module wants to call // noConflict to hide this version of jQuery, it will work. if ( typeof define === "function" && define.amd && define.amd.jQuery ) { - define( "jquery", [], function () { return jQuery; } ); + define( "jquery", [], function () { return jQuery; } ); } })( window ); \ No newline at end of file diff --git a/template/js/load.js b/template/js/load.js index 743e419..3caa4f9 100644 --- a/template/js/load.js +++ b/template/js/load.js @@ -22,14 +22,14 @@ see the file license.txt that was included with the plugin bundle. gradient.src = imgdata; /** Percentage loader - * @param params Specify options in {}. May be on of width, height, progress or value. + * @param params Specify options in {}. May be on of width, height, progress or value. * * @example $("#myloader-container).percentageLoader({ - width : 256, // width in pixels - height : 256, // height in pixels - progress: 0, // initialise progress bar position, within the range [0..1] - value: '0kb' // initialise text label to this value - }); + width : 256, // width in pixels + height : 256, // height in pixels + progress: 0, // initialise progress bar position, within the range [0..1] + value: '0kb' // initialise text label to this value + }); */ $.fn.percentageLoader = function (params) { var settings, canvas, percentageText, valueText, items, i, item, selectors, s, ctx, progress, diff --git a/template/js/sections/servers/console.js b/template/js/sections/servers/console.js index ead3f87..ad0d652 100644 --- a/template/js/sections/servers/console.js +++ b/template/js/sections/servers/console.js @@ -1,59 +1,59 @@ $('#form_console').ajaxForm({ - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); - if(i == 's') - { - if(!update) - update_switch(); + if(i == 's') + { + if(!update) + update_switch(); - update_console(); - } - }); - } + update_console(); + } + }); + } }); function set_command(command) { - loading(1); + loading(1); - $.ajax({ - type: 'POST', - url: '/servers/section/console/id/'+server+'/go', - data: 'command='+command, - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); - - if(i == 's') - { - if(!update) - update_switch(); + $.ajax({ + type: 'POST', + url: '/servers/section/console/id/'+server+'/go', + data: 'command='+command, + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); + + if(i == 's') + { + if(!update) + update_switch(); - update_console(); - } - }); - } - }); + update_console(); + } + }); + } + }); } var update = true; @@ -61,39 +61,39 @@ var update = true; function update_console(go = false) { - if(!update) - return false; + if(!update) + return false; - loading(1); + loading(1); - $.get(home+"servers/section/console/go/1/id/"+server, function(data) - { - var console = document.getElementById("console"); - - if(data) - { - console.innerHTML = data - console.scrollTop = console.scrollHeight; + $.get(home+"servers/section/console/go/1/id/"+server, function(data) + { + var console = document.getElementById("console"); + + if(data) + { + console.innerHTML = data + console.scrollTop = console.scrollHeight; - loading(0); - } - - if(go && update) - setTimeout(function() {update_console(true)}, 2500); - }); + loading(0); + } + + if(go && update) + setTimeout(function() {update_console(true)}, 2500); + }); } function update_switch() { - if($('#console_update').html() == '') - { - $('#console_update').html(''); + if($('#console_update').html() == '') + { + $('#console_update').html(''); - update = false; - }else{ - $('#console_update').html(''); + update = false; + }else{ + $('#console_update').html(''); - update = true; - update_console(); - } + update = true; + update_console(); + } } diff --git a/template/js/sections/servers/copy.js b/template/js/sections/servers/copy.js index da0d952..8848f34 100644 --- a/template/js/sections/servers/copy.js +++ b/template/js/sections/servers/copy.js @@ -1,113 +1,113 @@ $('#copy').ajaxForm({ - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); - if(i == 's') - location.reload(); - }); + if(i == 's') + location.reload(); + }); - loading(0) - } + loading(0) + } }); function recfull(id) { - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/copy/subsection/recfull/cid/'+id+'/go', function(arr) - { - $.each(arr, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + $.getJSON(home+'servers/id/'+server+'/section/copy/subsection/recfull/cid/'+id+'/go', function(arr) + { + $.each(arr, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 's') - location.href=home+'servers/id/'+server; + if(i == 's') + location.href=home+'servers/id/'+server; - loading(0) - }); - }); + loading(0) + }); + }); } function fullcopy() { - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/copy/subsection/fullcopy/go', function(arr) - { - $.each(arr, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + $.getJSON(home+'servers/id/'+server+'/section/copy/subsection/fullcopy/go', function(arr) + { + $.each(arr, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 's') - location.reload(); + if(i == 's') + location.reload(); - loading(0) - }); - }); + loading(0) + }); + }); } function recpart(id) { - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/copy/subsection/recpart/cid/'+id+'/go', function(arr) - { - $.each(arr, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + $.getJSON(home+'servers/id/'+server+'/section/copy/subsection/recpart/cid/'+id+'/go', function(arr) + { + $.each(arr, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 's') - location.href=home+'servers/id/'+server; + if(i == 's') + location.href=home+'servers/id/'+server; - loading(0) - }); - }); + loading(0) + }); + }); } function remcopy(id) { - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/copy/subsection/remove/cid/'+id+'/go', function(arr) - { - $.each(arr, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + $.getJSON(home+'servers/id/'+server+'/section/copy/subsection/remove/cid/'+id+'/go', function(arr) + { + $.each(arr, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 's') - location.reload(); + if(i == 's') + location.reload(); - loading(0) - }); - }); + loading(0) + }); + }); } \ No newline at end of file diff --git a/template/js/sections/servers/filetp.js b/template/js/sections/servers/filetp.js index b609c9f..8713039 100644 --- a/template/js/sections/servers/filetp.js +++ b/template/js/sections/servers/filetp.js @@ -1,336 +1,336 @@ function open_path(path) -{ - path_open = path; +{ + path_open = path; - loading(1); + loading(1); - $.ajax({ - type: 'POST', - url: home+'servers/id/'+server+'/section/filetp/go', - data: 'path='+encodeURIComponent(JSON.stringify(path)), - dataType: 'html', - success: function(data) - { - $('#filetp').html(data); - $('#infopath').html(path_open); + $.ajax({ + type: 'POST', + url: home+'servers/id/'+server+'/section/filetp/go', + data: 'path='+encodeURIComponent(JSON.stringify(path)), + dataType: 'html', + success: function(data) + { + $('#filetp').html(data); + $('#infopath').html(path_open); - loading(0); - } - }); + loading(0); + } + }); - return false; + return false; } function cancel() { - $('#filetp_block').css('display', 'block'); - $('#filetp_edit').css('display', 'none'); + $('#filetp_block').css('display', 'block'); + $('#filetp_edit').css('display', 'none'); - loading(0); + loading(0); } function create(type) { - if(type == 'folder') - val = '
    '; - else - val = '
    '+ - '

    '+ - '
    '; - bootbox.dialog(val, - [{ - "label" : "Создать", - "class" : "btn-small btn-success", - callback: function() - { - loading(1); + if(type == 'folder') + val = '
    '; + else + val = '
    '+ + '

    '+ + '
    '; + bootbox.dialog(val, + [{ + "label" : "Создать", + "class" : "btn-small btn-success", + callback: function() + { + loading(1); - $.ajax({ - type: 'POST', - url: home+'servers/id/'+server+'/section/filetp/action/create/go/true/'+type, - data: 'path='+encodeURIComponent(JSON.stringify(path_open)) - +'&name='+encodeURIComponent(JSON.stringify($('#create_name').val())) - +'&text='+encodeURIComponent(JSON.stringify($('#create_text').val())), - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e' && val != '') - bootbox.dialog(val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); + $.ajax({ + type: 'POST', + url: home+'servers/id/'+server+'/section/filetp/action/create/go/true/'+type, + data: 'path='+encodeURIComponent(JSON.stringify(path_open)) + +'&name='+encodeURIComponent(JSON.stringify($('#create_name').val())) + +'&text='+encodeURIComponent(JSON.stringify($('#create_text').val())), + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e' && val != '') + bootbox.dialog(val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); - if(i == 's' && val != '') - open_path(path_open); - }); + if(i == 's' && val != '') + open_path(path_open); + }); - loading(0) - } - }); - } - },{ - "label" : "Отмена", - "class" : "btn-small btn-primary", - }] - ); + loading(0) + } + }); + } + },{ + "label" : "Отмена", + "class" : "btn-small btn-primary", + }] + ); } function del(type, name) { - loading(1); + loading(1); - $.ajax({ - type: 'POST', - url: home+'servers/id/'+server+'/section/filetp/action/delete/go/true/'+type, - data: 'path='+encodeURIComponent(JSON.stringify(path_open))+'&name='+encodeURIComponent(JSON.stringify(name)), - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e' && val != '') - bootbox.dialog(val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - //callback: function() {} - }] - ); - if(i == 's' && val != '') - open_path(path_open); - }); + $.ajax({ + type: 'POST', + url: home+'servers/id/'+server+'/section/filetp/action/delete/go/true/'+type, + data: 'path='+encodeURIComponent(JSON.stringify(path_open))+'&name='+encodeURIComponent(JSON.stringify(name)), + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e' && val != '') + bootbox.dialog(val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + //callback: function() {} + }] + ); + if(i == 's' && val != '') + open_path(path_open); + }); - loading(0) - } - }); + loading(0) + } + }); } function chmod(name) { - bootbox.dialog('
    ', - [{ - "label" : "Изменить", - "class" : "btn-small btn-success", - callback: function() - { - loading(1); + bootbox.dialog('
    ', + [{ + "label" : "Изменить", + "class" : "btn-small btn-success", + callback: function() + { + loading(1); - $.ajax({ - type: 'POST', - url: home+'servers/id/'+server+'/section/filetp/action/chmod/go/true/', - data: 'path='+encodeURIComponent(JSON.stringify(path_open)) - +'&name='+encodeURIComponent(JSON.stringify(name)) - +'&chmod='+$('#chmod').val(), - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e' && val != '') - bootbox.dialog(val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); + $.ajax({ + type: 'POST', + url: home+'servers/id/'+server+'/section/filetp/action/chmod/go/true/', + data: 'path='+encodeURIComponent(JSON.stringify(path_open)) + +'&name='+encodeURIComponent(JSON.stringify(name)) + +'&chmod='+$('#chmod').val(), + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e' && val != '') + bootbox.dialog(val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); - if(i == 's' && val != '') - open_path(path_open); - }); + if(i == 's' && val != '') + open_path(path_open); + }); - loading(0) - } - }); - } - },{ - "label" : "Отмена", - "class" : "btn-small btn-primary", - }] - ); + loading(0) + } + }); + } + },{ + "label" : "Отмена", + "class" : "btn-small btn-primary", + }] + ); } function edit(path, name) { - loading(1); + loading(1); - $.ajax({ - type: 'POST', - url: home+'servers/id/'+server+'/section/filetp/action/edit/go', - data: 'path='+encodeURIComponent(JSON.stringify(path))+'&name='+encodeURIComponent(JSON.stringify(name)), - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e' && val != '') - bootbox.dialog(val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); + $.ajax({ + type: 'POST', + url: home+'servers/id/'+server+'/section/filetp/action/edit/go', + data: 'path='+encodeURIComponent(JSON.stringify(path))+'&name='+encodeURIComponent(JSON.stringify(name)), + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e' && val != '') + bootbox.dialog(val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); - if(i == 's') - { - $('#filetp_block').css('display', 'none'); - $('#filetp_edit').css('display', 'block'); + if(i == 's') + { + $('#filetp_block').css('display', 'none'); + $('#filetp_edit').css('display', 'block'); - sl = '/'; - if(path.slice(-1) == '/') sl = ''; + sl = '/'; + if(path.slice(-1) == '/') sl = ''; - $('#filetp_file_name').html(path+sl+name); + $('#filetp_file_name').html(path+sl+name); - $('#filetp_data').val(val); - $('#filetp_path').val(path); - $('#filetp_file').val(name); + $('#filetp_data').val(val); + $('#filetp_path').val(path); + $('#filetp_file').val(name); editor.setValue(val); editor.refresh(); - } - }); + } + }); - loading(0); - } - }); + loading(0); + } + }); - return false; + return false; } function edit_go() { - loading(1); + loading(1); - $.ajax({ - type: 'POST', - url: home+'servers/id/'+server+'/section/filetp/action/create/go', - data: 'path='+encodeURIComponent(JSON.stringify($('#filetp_path').val())) - +'&name='+encodeURIComponent(JSON.stringify($('#filetp_file').val())) - +'&text='+encodeURIComponent(JSON.stringify(editor.getValue())), - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); + $.ajax({ + type: 'POST', + url: home+'servers/id/'+server+'/section/filetp/action/create/go', + data: 'path='+encodeURIComponent(JSON.stringify($('#filetp_path').val())) + +'&name='+encodeURIComponent(JSON.stringify($('#filetp_file').val())) + +'&text='+encodeURIComponent(JSON.stringify(editor.getValue())), + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); - if(i == 's') - { - bootbox.dialog('

    Внимание

    Внесенные изменения сохранены.', - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); + if(i == 's') + { + bootbox.dialog('

    Внимание

    Внесенные изменения сохранены.', + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); - $('#filetp_block').css('display', 'block'); - $('#filetp_edit').css('display', 'none'); + $('#filetp_block').css('display', 'block'); + $('#filetp_edit').css('display', 'none'); - if($('#filetp_find').val().length > 2) - find(); - else - open_path(path_open); - } - }); + if($('#filetp_find').val().length > 2) + find(); + else + open_path(path_open); + } + }); - loading(0); - } - }); + loading(0); + } + }); - return false; + return false; } function rename(name) { - bootbox.dialog('
    ', - [{ - "label" : "Сохранить", - "class" : "btn-small btn-success", - callback: function() - { - loading(1); - $.ajax({ - type: 'POST', - url: home+'servers/id/'+server+'/section/filetp/action/rename/go', - data: 'path='+encodeURIComponent(JSON.stringify(path_open))+'&name='+encodeURIComponent(JSON.stringify(name))+'&newname='+encodeURIComponent(JSON.stringify($('#rename_name').val())), - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e' && val != '') - bootbox.dialog(val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); + bootbox.dialog('
    ', + [{ + "label" : "Сохранить", + "class" : "btn-small btn-success", + callback: function() + { + loading(1); + $.ajax({ + type: 'POST', + url: home+'servers/id/'+server+'/section/filetp/action/rename/go', + data: 'path='+encodeURIComponent(JSON.stringify(path_open))+'&name='+encodeURIComponent(JSON.stringify(name))+'&newname='+encodeURIComponent(JSON.stringify($('#rename_name').val())), + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e' && val != '') + bootbox.dialog(val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); - if(i == 's' && val != '') - open_path(path_open); - }); - loading(0); - } - }); - } - },{ - "label" : "Отмена", - "class" : "btn-small btn-primary", - }] - ); + if(i == 's' && val != '') + open_path(path_open); + }); + loading(0); + } + }); + } + },{ + "label" : "Отмена", + "class" : "btn-small btn-primary", + }] + ); } function find() { - loading(1); + loading(1); - $.ajax({ - type: 'POST', - url: home+'servers/id/'+server+'/section/filetp/action/search/go', - data: 'find='+encodeURIComponent(JSON.stringify($('#filetp_find').val())), - dataType: 'html', - success: function(data) - { - $('#filetp').html(data); - $('#infopath').html('Поиск'); + $.ajax({ + type: 'POST', + url: home+'servers/id/'+server+'/section/filetp/action/search/go', + data: 'find='+encodeURIComponent(JSON.stringify($('#filetp_find').val())), + dataType: 'html', + success: function(data) + { + $('#filetp').html(data); + $('#infopath').html('Поиск'); - loading(0); - } - }); + loading(0); + } + }); } function logs() { - if(document.getElementById('filetp_logs').style.display == 'block') - { - $('#show_logs').html('показать логи операций'); + if(document.getElementById('filetp_logs').style.display == 'block') + { + $('#show_logs').html('показать логи операций'); - $('#filetp_logs').css('display', 'none'); - }else{ - loading(1); + $('#filetp_logs').css('display', 'none'); + }else{ + loading(1); - $.get(home+'servers/id/'+server+'/section/filetp/action/logs/go', function(data){ - $('#show_logs').html('скрыть логи операций'); - $('#filetp_logs').css('display', 'block'); - $('#filetp_logs_data').html(data); + $.get(home+'servers/id/'+server+'/section/filetp/action/logs/go', function(data){ + $('#show_logs').html('скрыть логи операций'); + $('#filetp_logs').css('display', 'block'); + $('#filetp_logs_data').html(data); - loading(0); - }); - } + loading(0); + }); + } } $('#filetp_find').keyup(function(){ - if($('#filetp_find').val().length > 2) - find(); - else - open_path(path_open); + if($('#filetp_find').val().length > 2) + find(); + else + open_path(path_open); }); \ No newline at end of file diff --git a/template/js/sections/servers/index.js b/template/js/sections/servers/index.js index e47f146..f9afc9a 100644 --- a/template/js/sections/servers/index.js +++ b/template/js/sections/servers/index.js @@ -1,337 +1,337 @@ // Запуск сервера function server_start(id) { - wait = true; + wait = true; - loading(1); + loading(1); - $('#status').html('Выполняется...'); + $('#status').html('Выполняется...'); - $.getJSON(home+'servers/section/action/id/'+id+'/action/start', - function(data) - { - wait = false; + $.getJSON(home+'servers/section/action/id/'+id+'/action/start', + function(data) + { + wait = false; - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); - update_info(id, false); - update_status(id, false); - update_resources(id, false); + update_info(id, false); + update_status(id, false); + update_resources(id, false); - loading(0) - }); - }); + loading(0) + }); + }); } // Перезапуск сервера function server_restart(id) { - wait = true; + wait = true; - loading(1); + loading(1); - $('#status').html('Выполняется...'); + $('#status').html('Выполняется...'); - $.getJSON(home+'servers/section/action/id/'+id+'/action/restart', - function(data) - { - wait = false; + $.getJSON(home+'servers/section/action/id/'+id+'/action/restart', + function(data) + { + wait = false; - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); - update_info(id, false); - update_status(id, false); - update_resources(id, false); + update_info(id, false); + update_status(id, false); + update_resources(id, false); - loading(0) - }); - }); + loading(0) + }); + }); } // Выключение сервера function server_stop(id) { - wait = true; + wait = true; - loading(1); + loading(1); - $('#status').html('Выполняется...'); + $('#status').html('Выполняется...'); - $.getJSON(home+'servers/section/action/id/'+id+'/action/stop', - function(data) - { - wait = false; + $.getJSON(home+'servers/section/action/id/'+id+'/action/stop', + function(data) + { + wait = false; - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); - update_info(id, false); - update_status(id, false); - update_resources(id, false); + update_info(id, false); + update_status(id, false); + update_resources(id, false); - loading(0) - }); - }); + loading(0) + }); + }); } // Смена карты (получение списка) function server_change(id) { - if($('#maps_list').html() != '') - { - $('#maps_close').css('display', 'block'); - $('#maps_list').css('display', 'block'); - }else{ - loading(1); + if($('#maps_list').html() != '') + { + $('#maps_close').css('display', 'block'); + $('#maps_list').css('display', 'block'); + }else{ + loading(1); - $.getJSON(home+'servers/section/action/id/'+id+'/action/change', - function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); + $.getJSON(home+'servers/section/action/id/'+id+'/action/change', + function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); - if(i == 'maps') - { - $('#maps_close').css('display', 'block'); - $('#maps_list').css('display', 'block'); - $('#maps_list').html(val); - } + if(i == 'maps') + { + $('#maps_close').css('display', 'block'); + $('#maps_list').css('display', 'block'); + $('#maps_list').html(val); + } - loading(0) - }); - }); - } + loading(0) + }); + }); + } } // Смена карты function server_change_map(id, map) { - wait = true; + wait = true; - loading(1); + loading(1); - $('#status').html('Выполняется...'); + $('#status').html('Выполняется...'); - server_change_close(); + server_change_close(); - $.getJSON(home+'servers/section/action/id/'+id+'/action/change/change/'+map, - function(data) - { - wait = false; + $.getJSON(home+'servers/section/action/id/'+id+'/action/change/change/'+map, + function(data) + { + wait = false; - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); - update_info(id, false); - update_status(id, false); - update_resources(id, false); + update_info(id, false); + update_status(id, false); + update_resources(id, false); - loading(0) - }); - }); + loading(0) + }); + }); } // Скрытие списка карт function server_change_close() { - $('#maps_close').css('display', 'none'); - $('#maps_list').css('display', 'none'); + $('#maps_close').css('display', 'none'); + $('#maps_list').css('display', 'none'); } // Переустановка сервера (подтверждение) function server_reinstall(id) { - bootbox.dialog('

    Внимание

    После переустановки, все текущие файлы будут удалены.', - [{ - "label" : "Подтвердить", - "class" : "btn-small btn-primary", - callback: function() {server_reinstall_go(id);} - },{ - "label" : "Отмена", - "class" : "btn-small btn-primary", - }] - - ); + bootbox.dialog('

    Внимание

    После переустановки, все текущие файлы будут удалены.', + [{ + "label" : "Подтвердить", + "class" : "btn-small btn-primary", + callback: function() {server_reinstall_go(id);} + },{ + "label" : "Отмена", + "class" : "btn-small btn-primary", + }] + + ); } // Переустановка сервера function server_reinstall_go(id) { - wait = true; + wait = true; - loading(1); + loading(1); - $('#status').html('Выполняется...'); + $('#status').html('Выполняется...'); - $.getJSON(home+'servers/section/action/id/'+id+'/action/reinstall', function(data) - { - wait = false; + $.getJSON(home+'servers/section/action/id/'+id+'/action/reinstall', function(data) + { + wait = false; - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); - update_info(id, false); - update_status(id, false); - update_resources(id, false); + update_info(id, false); + update_status(id, false); + update_resources(id, false); - loading(0) - }); - }); + loading(0) + }); + }); } // Обновление сервера function server_update(id) { - wait = true; + wait = true; - loading(1); + loading(1); - $('#status').html('Выполняется...'); + $('#status').html('Выполняется...'); - $.getJSON(home+'servers/section/action/id/'+id+'/action/update', function(data) - { - wait = false; + $.getJSON(home+'servers/section/action/id/'+id+'/action/update', function(data) + { + wait = false; - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); - update_info(id, false); - update_status(id, false); - update_resources(id, false); + update_info(id, false); + update_status(id, false); + update_resources(id, false); - loading(0) - }); - }); + loading(0) + }); + }); } // Обновление информации сервера function update_info(id, go) { - if(wait) - { - if(go) - setTimeout(function() {update_info(id, true)}, 3000); + if(wait) + { + if(go) + setTimeout(function() {update_info(id, true)}, 3000); - return false; - } + return false; + } - $.getJSON(home+'servers/section/scan/id/'+id+'/fmon', function(data) - { - $.each(data, function(i, val) - { - if(i == 'time' && $('#time').html() != val && val != '') - $('#time').html(val); + $.getJSON(home+'servers/section/scan/id/'+id+'/fmon', function(data) + { + $.each(data, function(i, val) + { + if(i == 'time' && $('#time').html() != val && val != '') + $('#time').html(val); - if(i == 'time_end' && $('#time_end').html() != val && val != '') - $('#time_end').html(val); + if(i == 'time_end' && $('#time_end').html() != val && val != '') + $('#time_end').html(val); - if(i == 'name' && $('#name').html() != val) - $('#name').html(val); + if(i == 'name' && $('#name').html() != val) + $('#name').html(val); - if(i == 'status' && $('#status').html() != val) - $('#status').html(val); + if(i == 'status' && $('#status').html() != val) + $('#status').html(val); - if(i == 'online' && $('#online').html() != val) - $('#online').html(val); + if(i == 'online' && $('#online').html() != val) + $('#online').html(val); - if(i == 'image' && $('#image').html() != val) - $('#image').html(val); + if(i == 'image' && $('#image').html() != val) + $('#image').html(val); - if(i == 'buttons' && $('#buttons').html() != val) - $('#buttons').html(val); + if(i == 'buttons' && $('#buttons').html() != val) + $('#buttons').html(val); - if(i == 'players' && $('#players').html() != val) - $('#players').html(val); + if(i == 'players' && $('#players').html() != val) + $('#players').html(val); - }); - - if(go) - setTimeout(function() {update_info(id, true)}, 2500); - }); + }); + + if(go) + setTimeout(function() {update_info(id, true)}, 2500); + }); } // Обновление информации нагрузки function update_resources(id, go) { - $.getJSON(home+'servers/section/scan/id/'+id+'/resources', function(data) - { - $.each(data, function(i, val) - { - if(i == 'usr') - $load_usr.setProgress(val/100); + $.getJSON(home+'servers/section/scan/id/'+id+'/resources', function(data) + { + $.each(data, function(i, val) + { + if(i == 'usr') + $load_usr.setProgress(val/100); - if(i == 'cpu') - $load_cpu.setProgress(val/100); + if(i == 'cpu') + $load_cpu.setProgress(val/100); - if(i == 'ram') - $load_ram.setProgress(val/100); + if(i == 'ram') + $load_ram.setProgress(val/100); - if(i == 'hdd') - $load_hdd.setProgress(val/100); - }); + if(i == 'hdd') + $load_hdd.setProgress(val/100); + }); - if(go) - setTimeout(function() {update_resources(id)}, 5000); - }); + if(go) + setTimeout(function() {update_resources(id)}, 5000); + }); } // Проверка статуса сервера function update_status(id, go) { - $.get(home+'servers/section/scan/id/'+id+'/status', function(data) - { - if(go) - setTimeout(function() {update_status(id, true)}, 5000); - }); + $.get(home+'servers/section/scan/id/'+id+'/status', function(data) + { + if(go) + setTimeout(function() {update_status(id, true)}, 5000); + }); } \ No newline at end of file diff --git a/template/js/sections/servers/maps.js b/template/js/sections/servers/maps.js index c75be0b..79d78cf 100644 --- a/template/js/sections/servers/maps.js +++ b/template/js/sections/servers/maps.js @@ -1,204 +1,204 @@ $('#maps').ajaxForm({ - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - { - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); - } - if(i == 's') - { bootbox.dialog('

    Внимание

    Выбранные карты удалены.', - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); - hidden_map_sel() - } - }); - loading(0); - } + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + { + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); + } + if(i == 's') + { bootbox.dialog('

    Внимание

    Выбранные карты удалены.', + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); + hidden_map_sel() + } + }); + loading(0); + } }); $('.install').ajaxForm({ - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - { - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); - } - if(i == 's') - { bootbox.dialog('

    Внимание

    Выбранные карты установлены.', - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); - hidden_map_sel() - } - }); - loading(0); - } + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + { + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); + } + if(i == 's') + { bootbox.dialog('

    Внимание

    Выбранные карты установлены.', + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); + hidden_map_sel() + } + }); + loading(0); + } }); $('.form').ajaxForm({ - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); - if(i == 's') - bootbox.dialog('

    Внимание

    Внесенные изменения сохранены.', - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); - }); + if(i == 's') + bootbox.dialog('

    Внимание

    Внесенные изменения сохранены.', + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); + }); - loading(0) - } + loading(0) + } }); function maps_search(go) { - if($('#search').val() == '') - { - $('#search_block').css('display', 'none'); - return; - } - loading(1); + if($('#search').val() == '') + { + $('#search_block').css('display', 'none'); + return; + } + loading(1); - if(go) go = '/go'; else go = ''; + if(go) go = '/go'; else go = ''; - $.ajax({ - type: 'POST', - url: home+'servers/id/'+server+'/section/maps/subsection/search'+go, - data: 'text='+$('#search').val(), - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - { - if(val != '') - { - $('#search_block').css('display', 'block'); - $('#search_result').html(val); - }else - $('#search_block').css('display', 'none'); - } + $.ajax({ + type: 'POST', + url: home+'servers/id/'+server+'/section/maps/subsection/search'+go, + data: 'text='+$('#search').val(), + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + { + if(val != '') + { + $('#search_block').css('display', 'block'); + $('#search_result').html(val); + }else + $('#search_block').css('display', 'none'); + } - if(i == 'maps') - { - $('#search_block').css('display', 'block'); - $('#search_result').html(val); - } + if(i == 'maps') + { + $('#search_block').css('display', 'block'); + $('#search_result').html(val); + } - if(i == 'mapsjs') - install = val; - }); + if(i == 'mapsjs') + install = val; + }); - loading(0); - } - }); + loading(0); + } + }); } function hidden_map_sel() { - $.each(maps, function(i, map) - { - if(!$('#block_'+map+' i').hasClass('fa fa-square-o')) - $('#form_'+map).css('display', 'none'); - }); + $.each(maps, function(i, map) + { + if(!$('#block_'+map+' i').hasClass('fa fa-square-o')) + $('#form_'+map).css('display', 'none'); + }); } function select_map(map) { - block = document.getElementById('block_'+map).getElementsByTagName('i')[0]; - if($('#block_'+map+' i').hasClass('fa fa-square-o')) - { - block.className = "fa fa-check-square-o"; - $('#'+map).val('1'); - }else{ - block.className = "fa fa-square-o"; - $('#'+map).val('0'); - } + block = document.getElementById('block_'+map).getElementsByTagName('i')[0]; + if($('#block_'+map+' i').hasClass('fa fa-square-o')) + { + block.className = "fa fa-check-square-o"; + $('#'+map).val('1'); + }else{ + block.className = "fa fa-square-o"; + $('#'+map).val('0'); + } } function select_map_all(arr) { - if(arr == 'search') array = install; else array = maps; + if(arr == 'search') array = install; else array = maps; - $.each(array, function(i, map) - { - block = document.getElementById('block_'+map).getElementsByTagName('i')[0]; - if($('#block_'+map+' i').hasClass('fa fa-square-o')) - { - block.className = "fa fa-check-square-o"; - $('#'+map).val('1'); - } - }); + $.each(array, function(i, map) + { + block = document.getElementById('block_'+map).getElementsByTagName('i')[0]; + if($('#block_'+map+' i').hasClass('fa fa-square-o')) + { + block.className = "fa fa-check-square-o"; + $('#'+map).val('1'); + } + }); } function diselect_map_all(arr) { - if(arr == 'search') array = install; else array = maps; + if(arr == 'search') array = install; else array = maps; - $.each(array, function(i, map) - { - block = document.getElementById('block_'+map).getElementsByTagName('i')[0]; - if(!$('#block_'+map+' i').hasClass('fa fa-square-o')) - { - block.className = "fa fa-square-o"; - $('#'+map).val('0'); - } - }); + $.each(array, function(i, map) + { + block = document.getElementById('block_'+map).getElementsByTagName('i')[0]; + if(!$('#block_'+map+' i').hasClass('fa fa-square-o')) + { + block.className = "fa fa-square-o"; + $('#'+map).val('0'); + } + }); } function genlist(form) { - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/maps/subsection/listing/gen/maps/go', function(arr) - { - $.each(arr, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + $.getJSON(home+'servers/id/'+server+'/section/maps/subsection/listing/gen/maps/go', function(arr) + { + $.each(arr, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 's') - $('#'+form).val(val); - }); + if(i == 's') + $('#'+form).val(val); + }); - loading(0) - }); + loading(0) + }); } \ No newline at end of file diff --git a/template/js/sections/servers/owners.js b/template/js/sections/servers/owners.js index d8045db..67780cb 100644 --- a/template/js/sections/servers/owners.js +++ b/template/js/sections/servers/owners.js @@ -1,44 +1,44 @@ $('#add').ajaxForm({ - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); - if(i == 's') - location.reload(); - }); + if(i == 's') + location.reload(); + }); - loading(0) - } + loading(0) + } }); function owner_rights(server, id) { - $.getJSON(home+'servers/id/'+server+'/section/owners/rights/'+id, function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); + $.getJSON(home+'servers/id/'+server+'/section/owners/rights/'+id, function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); - if(i == 's') - { - $('#rights_block').css('display', 'block'); - $('#rights').html(val); - } - }); - }); + if(i == 's') + { + $('#rights_block').css('display', 'block'); + $('#rights').html(val); + } + }); + }); } \ No newline at end of file diff --git a/template/js/sections/servers/plugins.js b/template/js/sections/servers/plugins.js index 3a3e301..d9e164e 100644 --- a/template/js/sections/servers/plugins.js +++ b/template/js/sections/servers/plugins.js @@ -1,231 +1,231 @@ function plugin_confirm(action, id) { - switch(action) - { - case 'install': - text = 'Вы уверены, что хотите установить данный плагин?'; - break; + switch(action) + { + case 'install': + text = 'Вы уверены, что хотите установить данный плагин?'; + break; - case 'update': - text = 'Вы уверены, что хотите обновить данный плагин?'; - break; + case 'update': + text = 'Вы уверены, что хотите обновить данный плагин?'; + break; - case 'delete': - text = 'Вы уверены, что хотите удалить данный плагин?'; - break; - } + case 'delete': + text = 'Вы уверены, что хотите удалить данный плагин?'; + break; + } - bootbox.dialog('

    Внимание

    '+text, - [{ - "label" : "Подтвердить", - "class" : "btn-success", - callback: function(){ - switch(action) - { - case 'install': - plugin_install(id); - break; + bootbox.dialog('

    Внимание

    '+text, + [{ + "label" : "Подтвердить", + "class" : "btn-success", + callback: function(){ + switch(action) + { + case 'install': + plugin_install(id); + break; - case 'update': - plugin_update(id); - break; + case 'update': + plugin_update(id); + break; - case 'delete': - plugin_delete(id); - } - } - },{ - "label" : "Отмена" - }] - ); + case 'delete': + plugin_delete(id); + } + } + },{ + "label" : "Отмена" + }] + ); } function plugin_install(id, next) { - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/plugins/subsection/install/plugin/'+id+'/go', function(arr) - { - $.each(arr, function(i, val) - { - if(i == 'e') - { - if(arr['pid'] !== undefined) - { - if(arr['required'] !== undefined) - bootbox.dialog('

    Ошибка

    '+val+'

    Родитель: '+arr['pname']+'

    ', - [{ - "label" : "Установить", - 'class' : 'btn-success', - callback: function(){plugin_install(arr['pid'], id)} - },{ - "label" : "Отмена" - }] - ); - else - bootbox.dialog('

    Ошибка

    '+val+'

    Плагин: '+arr['pname']+'

    ', - [{ - "label" : "Удалить", - 'class' : 'btn-error', - callback: function(){plugin_delete(arr['pid'], id)} - },{ - "label" : "Отмена" - }] - ); - }else - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); - } + $.getJSON(home+'servers/id/'+server+'/section/plugins/subsection/install/plugin/'+id+'/go', function(arr) + { + $.each(arr, function(i, val) + { + if(i == 'e') + { + if(arr['pid'] !== undefined) + { + if(arr['required'] !== undefined) + bootbox.dialog('

    Ошибка

    '+val+'

    Родитель: '+arr['pname']+'

    ', + [{ + "label" : "Установить", + 'class' : 'btn-success', + callback: function(){plugin_install(arr['pid'], id)} + },{ + "label" : "Отмена" + }] + ); + else + bootbox.dialog('

    Ошибка

    '+val+'

    Плагин: '+arr['pname']+'

    ', + [{ + "label" : "Удалить", + 'class' : 'btn-error', + callback: function(){plugin_delete(arr['pid'], id)} + },{ + "label" : "Отмена" + }] + ); + }else + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); + } - if(i == 's') - { - if(val == 'cfg') - { - $('#act_'+id).html('
    Настроить
    '); - $('#act_'+id).append('
    Удалить
    '); - }else - $('#act_'+id).html('
    Удалить
    '); + if(i == 's') + { + if(val == 'cfg') + { + $('#act_'+id).html('
    Настроить
    '); + $('#act_'+id).append('
    Удалить
    '); + }else + $('#act_'+id).html('
    Удалить
    '); - if(next) - plugin_install(next); - } - }); + if(next) + plugin_install(next); + } + }); - loading(0) - }); + loading(0) + }); } function plugin_update(id) { - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/plugins/subsection/update/plugin/'+id+'/go', function(arr) - { - $.each(arr, function(i, val) - { - if(i == 'e') - { - if(arr['pid'] !== undefined) - { - if(arr['required']) - bootbox.dialog('

    Ошибка

    '+val+'

    Родитель: '+arr['pname']+'

    ', - [{ - "label" : "Установить", - 'class' : 'btn-error', - callback: function(){plugin_install(arr['pid'], id)} - },{ - "label" : "Отмена" - }] - ); - else - bootbox.dialog('

    Ошибка

    '+val+'

    Плагин: '+arr['pname']+'

    ', - [{ - "label" : "Удалить", - 'class' : 'btn-error', - callback: function(){plugin_delete(arr['pid'], id)} - },{ - "label" : "Отмена" - }] - ); - }else - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); - } + $.getJSON(home+'servers/id/'+server+'/section/plugins/subsection/update/plugin/'+id+'/go', function(arr) + { + $.each(arr, function(i, val) + { + if(i == 'e') + { + if(arr['pid'] !== undefined) + { + if(arr['required']) + bootbox.dialog('

    Ошибка

    '+val+'

    Родитель: '+arr['pname']+'

    ', + [{ + "label" : "Установить", + 'class' : 'btn-error', + callback: function(){plugin_install(arr['pid'], id)} + },{ + "label" : "Отмена" + }] + ); + else + bootbox.dialog('

    Ошибка

    '+val+'

    Плагин: '+arr['pname']+'

    ', + [{ + "label" : "Удалить", + 'class' : 'btn-error', + callback: function(){plugin_delete(arr['pid'], id)} + },{ + "label" : "Отмена" + }] + ); + }else + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); + } - if(i == 's') - location.reload(); - }); + if(i == 's') + location.reload(); + }); - loading(0) - }); + loading(0) + }); } function plugin_delete(id, next) { - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/plugins/subsection/delete/plugin/'+id+'/go', function(arr) - { - $.each(arr, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + $.getJSON(home+'servers/id/'+server+'/section/plugins/subsection/delete/plugin/'+id+'/go', function(arr) + { + $.each(arr, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 'i') - { - bootbox.dialog('

    Внимание

    Необходимо установить следующий плагин: '+arr['pname']+'

    ', - [{ - "label" : "Установить", - 'class' : 'btn-success', - callback: function(){plugin_install(i)} - },{ - "label" : "Отмена" - }] - ); - } + if(i == 'i') + { + bootbox.dialog('

    Внимание

    Необходимо установить следующий плагин: '+arr['pname']+'

    ', + [{ + "label" : "Установить", + 'class' : 'btn-success', + callback: function(){plugin_install(i)} + },{ + "label" : "Отмена" + }] + ); + } - if(i == 's') - { - $('#act_'+id).html('
    Установить
    '); + if(i == 's') + { + $('#act_'+id).html('
    Установить
    '); - if(next) - plugin_install(next); - } - }); + if(next) + plugin_install(next); + } + }); - loading(0) - }); + loading(0) + }); } function plugins_search(go) { - if($('#search').val() == '') - { - $('#search_block').css('display', 'none'); - return; - } - loading(1); + if($('#search').val() == '') + { + $('#search_block').css('display', 'none'); + return; + } + loading(1); - if(go) go = '/go'; else go = ''; + if(go) go = '/go'; else go = ''; - $.ajax({ - type: 'POST', - url: home+'servers/id/'+server+'/section/plugins/subsection/search'+go, - data: 'text='+$('#search').val(), - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + $.ajax({ + type: 'POST', + url: home+'servers/id/'+server+'/section/plugins/subsection/search'+go, + data: 'text='+$('#search').val(), + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 's') - { - if(val != '') - { - $('#search_block').css('display', 'block'); - $('#search_result').html(val); - }else - $('#search_block').css('display', 'none'); - } - }); + if(i == 's') + { + if(val != '') + { + $('#search_block').css('display', 'block'); + $('#search_result').html(val); + }else + $('#search_block').css('display', 'none'); + } + }); - loading(0); - } - }); + loading(0); + } + }); } \ No newline at end of file diff --git a/template/js/sections/servers/rcon.js b/template/js/sections/servers/rcon.js index 0a9694e..b865213 100644 --- a/template/js/sections/servers/rcon.js +++ b/template/js/sections/servers/rcon.js @@ -1,181 +1,181 @@ function update_players_list() { - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/rcon/go', function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); + $.getJSON(home+'servers/id/'+server+'/section/rcon/go', function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); - if(i == 'r') - bootbox.dialog('

    Внимание

    '+val, - [{ - "label" : "Установить", - 'class' : 'btn-success', - callback: function(){location.href=data['url']} - },{ - "label" : "Отмена" - }] - ); + if(i == 'r') + bootbox.dialog('

    Внимание

    '+val, + [{ + "label" : "Установить", + 'class' : 'btn-success', + callback: function(){location.href=data['url']} + },{ + "label" : "Отмена" + }] + ); - if(i == 's') - { - $('#players').html(val); - $('#sel_player_info').html('____________'); - $('#sel_player').val('0'); - } - - }); + if(i == 's') + { + $('#players').html(val); + $('#sel_player_info').html('____________'); + $('#sel_player').val('0'); + } + + }); - loading(0) - }); + loading(0) + }); } function select_player(id, name) { - $('#sel_player_info').html('#'+id+' '+name); - $('#sel_player').val(id); + $('#sel_player_info').html('#'+id+' '+name); + $('#sel_player').val(id); } function firewall() { - id = $('#sel_player').val(); + id = $('#sel_player').val(); - if(id < 1) - return false; + if(id < 1) + return false; - loading(1); + loading(1); - $.ajax({ - type: 'POST', - url: home+'servers/id/'+server+'/section/settings/subsection/firewall/action/block/go', - data: 'address='+$('#address_'+id).val(), - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); + $.ajax({ + type: 'POST', + url: home+'servers/id/'+server+'/section/settings/subsection/firewall/action/block/go', + data: 'address='+$('#address_'+id).val(), + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); - if(i == 's') - rcon_kick(); - }); + if(i == 's') + rcon_kick(); + }); - loading(0) - } - }); + loading(0) + } + }); } function rcon_ban() { - id = $('#sel_player').val(); + id = $('#sel_player').val(); - if(id < 1) - return false; + if(id < 1) + return false; - loading(1); + loading(1); - $.ajax({ - type: 'POST', - url: home+'servers/id/'+server+'/section/settings/subsection/bans/action/ban/go', - data: 'amxbans=1&value='+$('#steamid_'+id).val()+'&userid='+$('#userid_'+id).val(), - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary" - }] - ); + $.ajax({ + type: 'POST', + url: home+'servers/id/'+server+'/section/settings/subsection/bans/action/ban/go', + data: 'amxbans=1&value='+$('#steamid_'+id).val()+'&userid='+$('#userid_'+id).val(), + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary" + }] + ); - if(i == 's') - update_players_list(); - }); + if(i == 's') + update_players_list(); + }); - loading(0) - } - }); + loading(0) + } + }); } function rcon_kick() { - id = $('#sel_player').val(); + id = $('#sel_player').val(); - if(id < 1) - return false; + if(id < 1) + return false; - loading(1); + loading(1); - $.ajax({ - type: 'POST', - url: home+'servers/id/'+server+'/section/rcon/action/kick/go', - data: 'player='+$('#steamid_'+id).val(), - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); + $.ajax({ + type: 'POST', + url: home+'servers/id/'+server+'/section/rcon/action/kick/go', + data: 'player='+$('#steamid_'+id).val(), + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); - if(i == 's') - update_players_list(); - }); - } - }); + if(i == 's') + update_players_list(); + }); + } + }); } function rcon_kill() { - id = $('#sel_player').val(); + id = $('#sel_player').val(); - if(id < 1) - return false; + if(id < 1) + return false; - loading(1); + loading(1); - $.ajax({ - type: 'POST', - url: home+'servers/id/'+server+'/section/rcon/action/kill/go', - data: 'player='+$('#nickname_'+id).val(), - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); + $.ajax({ + type: 'POST', + url: home+'servers/id/'+server+'/section/rcon/action/kill/go', + data: 'player='+$('#nickname_'+id).val(), + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); - if(i == 's') - update_players_list(); - }); - } - }); + if(i == 's') + update_players_list(); + }); + } + }); } \ No newline at end of file diff --git a/template/js/sections/servers/settings.js b/template/js/sections/servers/settings.js index 8110cbf..0e4a19f 100644 --- a/template/js/sections/servers/settings.js +++ b/template/js/sections/servers/settings.js @@ -1,92 +1,92 @@ $('#form').ajaxForm({ - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); - if(i == 's') - bootbox.dialog('

    Внимание

    Внесенные изменения сохранены.', - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); - }); - loading(0) - } + if(i == 's') + bootbox.dialog('

    Внимание

    Внесенные изменения сохранены.', + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); + }); + loading(0) + } }); function repack(id) { - $.getJSON(home+'servers/id/'+id+'/section/settings/subsection/pack/pack/'+$('#packs').val(), function(arr) - { - $.each(arr, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); - if(i == 's') - location.reload(); - }); - }); + $.getJSON(home+'servers/id/'+id+'/section/settings/subsection/pack/pack/'+$('#packs').val(), function(arr) + { + $.each(arr, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); + if(i == 's') + location.reload(); + }); + }); } function antiddos(id) { - $.getJSON(home+'servers/id/'+id+'/section/settings/subsection/antiddos/type/'+$('#rules').val()+'/go', function(arr) - { - $.each(arr, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); - if(i == 's') - location.reload(); - }); - }); + $.getJSON(home+'servers/id/'+id+'/section/settings/subsection/antiddos/type/'+$('#rules').val()+'/go', function(arr) + { + $.each(arr, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); + if(i == 's') + location.reload(); + }); + }); } function retop(id) { - bootbox.dialog('

    Внимание

    Вы уверены, что хотите сбросить статистику?', - [{ - "label" : "Сбросить", - "class" : "btn-success", - callback: function(){retop_go(id)} - },{ - "label" : "Отмена" - }] - ); + bootbox.dialog('

    Внимание

    Вы уверены, что хотите сбросить статистику?', + [{ + "label" : "Сбросить", + "class" : "btn-success", + callback: function(){retop_go(id)} + },{ + "label" : "Отмена" + }] + ); } function retop_go(id) { - $.getJSON(home+'servers/id/'+id+'/section/settings/subsection/top/', function(arr) - { - $.each(arr, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); - if(i == 's') - location.reload(); - }); - }); + $.getJSON(home+'servers/id/'+id+'/section/settings/subsection/top/', function(arr) + { + $.each(arr, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); + if(i == 's') + location.reload(); + }); + }); } \ No newline at end of file diff --git a/template/js/sections/servers/settings/admins.js b/template/js/sections/servers/settings/admins.js index 54a5d97..7200937 100644 --- a/template/js/sections/servers/settings/admins.js +++ b/template/js/sections/servers/settings/admins.js @@ -1,186 +1,186 @@ function addform() { - index = index+1; - form = '
    '; - form += ''; - form += ''; - form += ''; - form += ''; - form += ''; - form += ''; - form += ''; - form += ''; - form += ''; - $('#forms').append(form); + index = index+1; + form = ''; + form += ''; + form += ''; + form += ''; + form += ''; + form += ''; + form += ''; + form += ''; + form += ''; + form += ''; + $('#forms').append(form); - $('input').lc_switch(); - $('.date-picker').datepicker(); - return false; + $('input').lc_switch(); + $('.date-picker').datepicker(); + return false; } function delete_admin(id) { - $('#'+id).empty(); - return false; + $('#'+id).empty(); + return false; } $('#privilege').ajaxForm({ - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); - if(i == 's') - location.reload(); - }); - } + if(i == 's') + location.reload(); + }); + } }); function flags_admin(id) { - bootbox.dialog('
    '; - form += '
    '; + form += '
    ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +'

    Список флагов:

    ', - [{ - "label" : "Применить", - "class" : "btn-success", - callback: function() - { - var flags = []; + bootbox.dialog('' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +'

    Список флагов:

    ', + [{ + "label" : "Применить", + "class" : "btn-success", + callback: function() + { + var flags = []; - $("input[id^=sel_flag]:checked").each(function(){ - flags.push($(this).val()); - }); + $("input[id^=sel_flag]:checked").each(function(){ + flags.push($(this).val()); + }); - $('#flags_'+id).val(flags.join('')); - } - },{ - "label" : "Отмена" - }] - ); + $('#flags_'+id).val(flags.join('')); + } + },{ + "label" : "Отмена" + }] + ); - $('#sel_all_flags').click(function() - { - if(!$(this).attr('checked')) - $('.amxflag').removeAttr('checked'); - else - $('.amxflag:not(:last)').attr('checked', true); - }); + $('#sel_all_flags').click(function() + { + if(!$(this).attr('checked')) + $('.amxflag').removeAttr('checked'); + else + $('.amxflag:not(:last)').attr('checked', true); + }); - $('.amxflag').live('click', function() - { - var flags = $('.amxflag').size(); - var select = $('.amxflag:checked').size(); + $('.amxflag').live('click', function() + { + var flags = $('.amxflag').size(); + var select = $('.amxflag:checked').size(); - if(flags == select) - $('#sel_all_flags').attr('checked', true); - else - $('#sel_all_flags').removeAttr('checked'); - }); + if(flags == select) + $('#sel_all_flags').attr('checked', true); + else + $('#sel_all_flags').removeAttr('checked'); + }); } \ No newline at end of file diff --git a/template/js/sections/servers/settings/admins_css.js b/template/js/sections/servers/settings/admins_css.js index d3e10ea..0973e8b 100644 --- a/template/js/sections/servers/settings/admins_css.js +++ b/template/js/sections/servers/settings/admins_css.js @@ -1,159 +1,159 @@ function addform() { - index = index+1; - form = ''; - form += ''; - form += ''; - form += ''; - form += ''; - form += '
    '; - form += ''; - form += ''; - form += ''; - form += ''; - form += ''; - $('#forms').append(form); + index = index+1; + form = ''; + form += ''; + form += ''; + form += ''; + form += ''; + form += '
    '; + form += ''; + form += ''; + form += ''; + form += ''; + form += ''; + $('#forms').append(form); - $('input').lc_switch(); - $('.date-picker').datepicker(); - return false; + $('input').lc_switch(); + $('.date-picker').datepicker(); + return false; } function delete_admin(id) { - $('#'+id).empty(); - return false; + $('#'+id).empty(); + return false; } var flags = ''; function flags_admin(id) { - bootbox.dialog('

    Флаги:


    ' - +'
    a
    ' - +'
    b
    ' - +'
    c
    ' - +'
    d
    ' - +'
    e
    ' - +'
    f
    ' - +'
    g
    ' - +'
    h
    ' - +'
    i
    ' - +'
    j
    ' - +'
    k
    ' - +'
    l
    ' - +'
    m
    ' - +'
    n
    ' - +'
    o
    ' - +'
    p
    ' - +'
    q
    ' - +'
    r
    ' - +'
    s
    ' - +'
    t
    ' - +'
    u
    ' - +'
    z
    ' - +'
    ', - [{ - "label" : "Применить", - "class" : "btn-success", - callback: function(){ - $('#flags_'+id).val(flags); - flags = ''; - } - },{ - "label" : "Отмена" - }] - ); + bootbox.dialog('

    Флаги:


    ' + +'
    a
    ' + +'
    b
    ' + +'
    c
    ' + +'
    d
    ' + +'
    e
    ' + +'
    f
    ' + +'
    g
    ' + +'
    h
    ' + +'
    i
    ' + +'
    j
    ' + +'
    k
    ' + +'
    l
    ' + +'
    m
    ' + +'
    n
    ' + +'
    o
    ' + +'
    p
    ' + +'
    q
    ' + +'
    r
    ' + +'
    s
    ' + +'
    t
    ' + +'
    u
    ' + +'
    z
    ' + +'
    ', + [{ + "label" : "Применить", + "class" : "btn-success", + callback: function(){ + $('#flags_'+id).val(flags); + flags = ''; + } + },{ + "label" : "Отмена" + }] + ); } function flags_add(flag) { - if($('#flag_'+flag).hasClass('btn-success')) - flags_del(flag); - else{ - btn = document.getElementById('flag_'+flag); - flags += flag; - btn.className = btn.className.replace('btn-error', 'btn-success'); - $('#flags').html(flags); - } + if($('#flag_'+flag).hasClass('btn-success')) + flags_del(flag); + else{ + btn = document.getElementById('flag_'+flag); + flags += flag; + btn.className = btn.className.replace('btn-error', 'btn-success'); + $('#flags').html(flags); + } } function flags_del(flag) { - flags = flags.replace(flag, ''); - document.getElementById('flag_'+flag).className = btn.className.replace('btn-success', 'btn-error'); - $('#flags').html(flags); + flags = flags.replace(flag, ''); + document.getElementById('flag_'+flag).className = btn.className.replace('btn-success', 'btn-error'); + $('#flags').html(flags); } function flags_info(flag) { - switch(flag) - { - case 'a': - $('#flags_info').html('Иммунитет к командам: kick / ban / slay'); - break; - case 'b': - $('#flags_info').html('Резервный слот'); - break; - case 'c': - $('#flags_info').html('Доступ к команде amx_kick'); - break; - case 'd': - $('#flags_info').html('Доступ к командам amx_ban / amx_unban'); - break; - case 'e': - $('#flags_info').html('Доступ к командам amx_slay / amx_slap'); - break; - case 'f': - $('#flags_info').html('Доступ к команде amx_map'); - break; - case 'g': - $('#flags_info').html('Доступ к команде amx_cvar'); - break; - case 'h': - $('#flags_info').html('Доступ к команде amx_cfg'); - break; - case 'i': - $('#flags_info').html('Доступ к команде amx_chat'); - break; - case 'j': - $('#flags_info').html('Доступ к команде amx_vote'); - break; - case 'k': - $('#flags_info').html('Доступ к команде sv_passord'); - break; - case 'l': - $('#flags_info').html('Доступ к команде amx_rcon / rcon_password'); - break; - case 'm': - $('#flags_info').html('Пользоваельский уровень A'); - break; - case 'n': - $('#flags_info').html('Пользоваельский уровень B'); - break; - case 'o': - $('#flags_info').html('Пользоваельский уровень C'); - break; - case 'p': - $('#flags_info').html('Пользоваельский уровень D'); - break; - case 'q': - $('#flags_info').html('Пользоваельский уровень E'); - break; - case 'r': - $('#flags_info').html('Пользоваельский уровень F'); - break; - case 's': - $('#flags_info').html('Пользоваельский уровень G'); - break; - case 't': - $('#flags_info').html('Пользоваельский уровень H'); - break; - case 'u': - $('#flags_info').html('Доступ к AMXMODX MENU'); - break; - case 'z': - $('#flags_info').html('Полный доступ (Главный администратор)'); - break; - } + switch(flag) + { + case 'a': + $('#flags_info').html('Иммунитет к командам: kick / ban / slay'); + break; + case 'b': + $('#flags_info').html('Резервный слот'); + break; + case 'c': + $('#flags_info').html('Доступ к команде amx_kick'); + break; + case 'd': + $('#flags_info').html('Доступ к командам amx_ban / amx_unban'); + break; + case 'e': + $('#flags_info').html('Доступ к командам amx_slay / amx_slap'); + break; + case 'f': + $('#flags_info').html('Доступ к команде amx_map'); + break; + case 'g': + $('#flags_info').html('Доступ к команде amx_cvar'); + break; + case 'h': + $('#flags_info').html('Доступ к команде amx_cfg'); + break; + case 'i': + $('#flags_info').html('Доступ к команде amx_chat'); + break; + case 'j': + $('#flags_info').html('Доступ к команде amx_vote'); + break; + case 'k': + $('#flags_info').html('Доступ к команде sv_passord'); + break; + case 'l': + $('#flags_info').html('Доступ к команде amx_rcon / rcon_password'); + break; + case 'm': + $('#flags_info').html('Пользоваельский уровень A'); + break; + case 'n': + $('#flags_info').html('Пользоваельский уровень B'); + break; + case 'o': + $('#flags_info').html('Пользоваельский уровень C'); + break; + case 'p': + $('#flags_info').html('Пользоваельский уровень D'); + break; + case 'q': + $('#flags_info').html('Пользоваельский уровень E'); + break; + case 'r': + $('#flags_info').html('Пользоваельский уровень F'); + break; + case 's': + $('#flags_info').html('Пользоваельский уровень G'); + break; + case 't': + $('#flags_info').html('Пользоваельский уровень H'); + break; + case 'u': + $('#flags_info').html('Доступ к AMXMODX MENU'); + break; + case 'z': + $('#flags_info').html('Полный доступ (Главный администратор)'); + break; + } } \ No newline at end of file diff --git a/template/js/sections/servers/settings/bans.js b/template/js/sections/servers/settings/bans.js index 490ea38..629907a 100644 --- a/template/js/sections/servers/settings/bans.js +++ b/template/js/sections/servers/settings/bans.js @@ -1,78 +1,78 @@ function ban_action(type, val) { - loading(1); + loading(1); - value = $('#ban_val').val(); + value = $('#ban_val').val(); - if(val) - value = val; + if(val) + value = val; - switch(type) - { - case 'ban': - action = 'ban'; - break; - case 'unban': - action = 'unban'; - break; - case 'info': - action = 'info'; - break; - default: - return false; - } + switch(type) + { + case 'ban': + action = 'ban'; + break; + case 'unban': + action = 'unban'; + break; + case 'info': + action = 'info'; + break; + default: + return false; + } - amx = ''; + amx = ''; - if($('#webbans').is(':checked')) - amx = '&amxbans=1'; + if($('#webbans').is(':checked')) + amx = '&amxbans=1'; - $.ajax({ - type: 'POST', - url: home+'servers/id/'+server+'/section/settings/subsection/bans/action/'+action+'/go', - data: 'value='+value+amx, - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary" - }] - ); + $.ajax({ + type: 'POST', + url: home+'servers/id/'+server+'/section/settings/subsection/bans/action/'+action+'/go', + data: 'value='+value+amx, + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary" + }] + ); - if(i == 's') - location.reload(); + if(i == 's') + location.reload(); - if(i == 'ban') - bootbox.dialog('

    Информация

    '+val, - [{ - "label" : "Разбанить", - "class" : "btn-success", - callback: function(){ban_action('unban', value)} - },{ - "label" : "Закрыть", - "class" : "" - }] - ); + if(i == 'ban') + bootbox.dialog('

    Информация

    '+val, + [{ + "label" : "Разбанить", + "class" : "btn-success", + callback: function(){ban_action('unban', value)} + },{ + "label" : "Закрыть", + "class" : "" + }] + ); - if(i == 'unban') - bootbox.dialog('

    Информация

    '+val, - [{ - "label" : "Забанить", - "class" : "btn-error", - callback: function(){ban_action('ban', value)} - },{ - "label" : "Закрыть", - "class" : "" - }] - ); - }); + if(i == 'unban') + bootbox.dialog('

    Информация

    '+val, + [{ + "label" : "Забанить", + "class" : "btn-error", + callback: function(){ban_action('ban', value)} + },{ + "label" : "Закрыть", + "class" : "" + }] + ); + }); - loading(0) - } - }); + loading(0) + } + }); } \ No newline at end of file diff --git a/template/js/sections/servers/settings/crontab.js b/template/js/sections/servers/settings/crontab.js index 98d3182..8942d5f 100644 --- a/template/js/sections/servers/settings/crontab.js +++ b/template/js/sections/servers/settings/crontab.js @@ -1,58 +1,58 @@ $('#form').ajaxForm({ - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - { - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); - } - if(i == 's') - location.reload(); - }); - loading(0) - } + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + { + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); + } + if(i == 's') + location.reload(); + }); + loading(0) + } }); function crontab_delete(id) { - loading(1); + loading(1); - $.ajax({ - type: 'POST', - url: home+'servers/id/'+server+'/section/settings/subsection/crontab/action/delete/go', - data: 'task='+id, - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); - if(i == 's') - location.reload(); - }); + $.ajax({ + type: 'POST', + url: home+'servers/id/'+server+'/section/settings/subsection/crontab/action/delete/go', + data: 'task='+id, + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); + if(i == 's') + location.reload(); + }); - loading(0) - } - }); + loading(0) + } + }); } function cron_check_type() { - if($('#task').val() == 'console') - $('#console').css('display', 'table-row'); - else - $('#console').css('display', 'none'); + if($('#task').val() == 'console') + $('#console').css('display', 'table-row'); + else + $('#console').css('display', 'none'); } \ No newline at end of file diff --git a/template/js/sections/servers/settings/firewall.js b/template/js/sections/servers/settings/firewall.js index b8bfe68..3a8323e 100644 --- a/template/js/sections/servers/settings/firewall.js +++ b/template/js/sections/servers/settings/firewall.js @@ -1,73 +1,73 @@ function firewall(type, id) { - loading(1); + loading(1); - address = $('#'+type+'ip').val(); + address = $('#'+type+'ip').val(); - if(id) - address = id; + if(id) + address = id; - switch(type) - { - case 'info': - action = 'info'; - break; + switch(type) + { + case 'info': + action = 'info'; + break; - case 'block': case 'blocksub': - action = 'block'; - break; + case 'block': case 'blocksub': + action = 'block'; + break; - case 'unblock': - action = 'unblock'; - break; + case 'unblock': + action = 'unblock'; + break; - default: - return false; - } + default: + return false; + } - subnetwork = ''; + subnetwork = ''; - if(type == 'blocksub') - subnetwork = '&subnetwork=true'; + if(type == 'blocksub') + subnetwork = '&subnetwork=true'; - $.ajax({ - type: 'POST', - url: home+'servers/id/'+server+'/section/settings/subsection/firewall/action/'+action+'/go', - data: 'address='+address+subnetwork, - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); + $.ajax({ + type: 'POST', + url: home+'servers/id/'+server+'/section/settings/subsection/firewall/action/'+action+'/go', + data: 'address='+address+subnetwork, + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); - if(i == 'i') - { - bootbox.dialog('

    Внимание

    '+val, - [{ - "label" : "Разблокировать", - "class" : "btn-success", - callback: function(){firewall('unblock', data['id'])} - },{ - "label" : "Отмена" - }] - ); - } + if(i == 'i') + { + bootbox.dialog('

    Внимание

    '+val, + [{ + "label" : "Разблокировать", + "class" : "btn-success", + callback: function(){firewall('unblock', data['id'])} + },{ + "label" : "Отмена" + }] + ); + } - if(i == 's') - location.reload(); + if(i == 's') + location.reload(); - if(i == 'info') - $('#whois').html(val); - }); + if(i == 'info') + $('#whois').html(val); + }); - loading(0) - } - }); + loading(0) + } + }); } diff --git a/template/js/sections/servers/settings/start.js b/template/js/sections/servers/settings/start.js index 4aea7a1..814d950 100644 --- a/template/js/sections/servers/settings/start.js +++ b/template/js/sections/servers/settings/start.js @@ -1,39 +1,39 @@ function settings_save(type) { - loading(1); - $.getJSON(home+'servers/id/'+server+'/section/settings/subsection/start/save/'+type+'/value/'+$('#'+type).val()+'/go/', - function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); - if(i == 's') - bootbox.dialog('

    Внимание

    Внесенные изменения сохранены.', - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); + loading(1); + $.getJSON(home+'servers/id/'+server+'/section/settings/subsection/start/save/'+type+'/value/'+$('#'+type).val()+'/go/', + function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); + if(i == 's') + bootbox.dialog('

    Внимание

    Внесенные изменения сохранены.', + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); - loading(0) - }); - }); + loading(0) + }); + }); } function maplist() { - $.getJSON(home+'servers/id/'+server+'/section/settings/subsection/start/maps', function(data) - { - $.each(data, function(i, val) - { - if(i == 'maps') - $('#map').html(val); - }); - }); + $.getJSON(home+'servers/id/'+server+'/section/settings/subsection/start/maps', function(data) + { + $.each(data, function(i, val) + { + if(i == 'maps') + $('#map').html(val); + }); + }); } \ No newline at end of file diff --git a/template/js/sections/servers/tarif.js b/template/js/sections/servers/tarif.js index 89f9e80..9f4f0a3 100644 --- a/template/js/sections/servers/tarif.js +++ b/template/js/sections/servers/tarif.js @@ -1,372 +1,372 @@ $('#extend').ajaxForm({ - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); - if(i == 's') - location.reload(); - }); + if(i == 's') + location.reload(); + }); - loading(0) - } + loading(0) + } }); $('body').on('click', '.lcs_wrap', function(){ - if($('#address').prop('checked')) - { - $('#address').prop('checked', false); - upd_extend(false); - }else{ - $('#address').prop('checked', true); - upd_extend(true); - } + if($('#address').prop('checked')) + { + $('#address').prop('checked', false); + upd_extend(false); + }else{ + $('#address').prop('checked', true); + upd_extend(true); + } }); function upd_extend(add) { - time = $('#time').val(); + time = $('#time').val(); - if(time < 1) - { - $('#info_extend').html('0'); + if(time < 1) + { + $('#info_extend').html('0'); - return false; - } + return false; + } - loading(1); + loading(1); - address = ''; + address = ''; - if(add || $('#address').prop('checked')) - address = '&address=1'; + if(add || $('#address').prop('checked')) + address = '&address=1'; - $.ajax({ - type: 'POST', - url: home+'servers/id/'+server+'/section/tarif/subsection/extend', - data: 'time='+time+address, - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 's' && val != '') - $('#info_extend').html(val); - }); + $.ajax({ + type: 'POST', + url: home+'servers/id/'+server+'/section/tarif/subsection/extend', + data: 'time='+time+address, + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 's' && val != '') + $('#info_extend').html(val); + }); - promo(); + promo(); - loading(0) - } - }); + loading(0) + } + }); } function promo() { - time = $('#time').val(); + time = $('#time').val(); - if(time < 1) - { - $('#info_extend').html('0'); - $('#info_promo').css('display', 'none'); - $('#info_extend').css('text-decoration', 'none'); + if(time < 1) + { + $('#info_extend').html('0'); + $('#info_promo').css('display', 'none'); + $('#info_extend').css('text-decoration', 'none'); - return false; - } + return false; + } - if($('#promo').val() == '') - { - $('#info_promo').css('display', 'none'); - $('#info_extend').css('text-decoration', 'none'); - return false; - } + if($('#promo').val() == '') + { + $('#info_promo').css('display', 'none'); + $('#info_extend').css('text-decoration', 'none'); + return false; + } - address = ''; + address = ''; - if($('#address').prop('checked')) - address = '&address=1'; + if($('#address').prop('checked')) + address = '&address=1'; - $.ajax({ - type: 'POST', - url: home+'servers/id/'+server+'/section/tarif/subsection/extend/promo', - data: 'time='+time+'&promo='+$('#promo').val()+address, - dataType: 'json', - success: function(data) - { - $('#info_promo').css('display', 'inline-block'); + $.ajax({ + type: 'POST', + url: home+'servers/id/'+server+'/section/tarif/subsection/extend/promo', + data: 'time='+time+'&promo='+$('#promo').val()+address, + dataType: 'json', + success: function(data) + { + $('#info_promo').css('display', 'inline-block'); - if(data['e'] != undefined) - { - $('#info_promo').html(data['e']); - $('#info_extend').css('text-decoration', 'none'); - }else{ - if(data['discount'] == 1) - { - $('#info_extend').css('text-decoration', 'line-through'); - $('#info_promo').html('Цена с учетом промо-кода: '+data['sum']+' '+data['cur']); - }else{ - $('#info_extend').css('text-decoration', 'none'); - $('#info_promo').html('Подарочные дни: '+data['days']); - } - } - } - }); + if(data['e'] != undefined) + { + $('#info_promo').html(data['e']); + $('#info_extend').css('text-decoration', 'none'); + }else{ + if(data['discount'] == 1) + { + $('#info_extend').css('text-decoration', 'line-through'); + $('#info_promo').html('Цена с учетом промо-кода: '+data['sum']+' '+data['cur']); + }else{ + $('#info_extend').css('text-decoration', 'none'); + $('#info_promo').html('Подарочные дни: '+data['days']); + } + } + } + }); } function upd_plan() { - plan = $('#tarif').val(); + plan = $('#tarif').val(); - if(plan < 1) - { - $('#info_plan').html(''); + if(plan < 1) + { + $('#info_plan').html(''); - return false; - } + return false; + } - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/tarif/subsection/plan/plan/'+plan, function(data) - { - $.each(data, function(i, val) - { - if(i == 's' && val != '') - $('#info_plan').html('Сервер будет арендован до: '+val); - }); + $.getJSON(home+'servers/id/'+server+'/section/tarif/subsection/plan/plan/'+plan, function(data) + { + $.each(data, function(i, val) + { + if(i == 's' && val != '') + $('#info_plan').html('Сервер будет арендован до: '+val); + }); - loading(0) - }); + loading(0) + }); } function upd_plan_go() { - plan = $('#tarif').val(); + plan = $('#tarif').val(); - if(plan < 1) - return false; + if(plan < 1) + return false; - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/tarif/subsection/plan/plan/'+plan+'/go', function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + $.getJSON(home+'servers/id/'+server+'/section/tarif/subsection/plan/plan/'+plan+'/go', function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 's') - location.reload(); - }); + if(i == 's') + location.reload(); + }); - loading(0) - }); + loading(0) + }); } function upd_slots() { - slots = $('#slots').val(); + slots = $('#slots').val(); - if(slots < 1) - return false; + if(slots < 1) + return false; - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/tarif/subsection/slots/slots/'+slots, function(data) - { - $.each(data, function(i, val) - { - if(i == 's') - $('#info_slots').html(val); - }); + $.getJSON(home+'servers/id/'+server+'/section/tarif/subsection/slots/slots/'+slots, function(data) + { + $.each(data, function(i, val) + { + if(i == 's') + $('#info_slots').html(val); + }); - loading(0) - }); + loading(0) + }); } function upd_slots_add() { - slots = $('#slots').val(); + slots = $('#slots').val(); - if(slots < 1) - return false; + if(slots < 1) + return false; - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/tarif/subsection/slots/slots/'+slots, function(data) - { - $.each(data, function(i, val) - { - if(i == 's') - $('#info_slots').html(val); - }); + $.getJSON(home+'servers/id/'+server+'/section/tarif/subsection/slots/slots/'+slots, function(data) + { + $.each(data, function(i, val) + { + if(i == 's') + $('#info_slots').html(val); + }); - loading(0) - }); + loading(0) + }); } function upd_slots_go() { - slots = $('#slots').val(); + slots = $('#slots').val(); - if(slots < 1) - return false; + if(slots < 1) + return false; - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/tarif/subsection/slots/slots/'+slots+'/go', function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + $.getJSON(home+'servers/id/'+server+'/section/tarif/subsection/slots/slots/'+slots+'/go', function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 's') - location.reload(); - }); + if(i == 's') + location.reload(); + }); - loading(0) - }); + loading(0) + }); } function upd_address() { - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/tarif/subsection/address/aid/'+$('#address').val(), function(data) - { - $.each(data, function(i, val) - { - if(i == 's') - $('#info_address').html(val); - }); + $.getJSON(home+'servers/id/'+server+'/section/tarif/subsection/address/aid/'+$('#address').val(), function(data) + { + $.each(data, function(i, val) + { + if(i == 's') + $('#info_address').html(val); + }); - loading(0) - }); + loading(0) + }); } function upd_address_go() { - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/tarif/subsection/address/aid/'+$('#address').val()+'/go', function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + $.getJSON(home+'servers/id/'+server+'/section/tarif/subsection/address/aid/'+$('#address').val()+'/go', function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 's') - location.reload(); - }); + if(i == 's') + location.reload(); + }); - loading(0) - }); + loading(0) + }); } function upd_unit() { - unit = $('#unit').val(); + unit = $('#unit').val(); - if(unit < 1) - { - $('#packs').css('display', 'none'); - ('#info_unit').html(''); + if(unit < 1) + { + $('#packs').css('display', 'none'); + ('#info_unit').html(''); - return false; - } + return false; + } - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/tarif/subsection/unit/uid/'+unit, function(data) - { - $.each(data, function(i, val) - { - if(i == 's') - $('#info_unit').html('Сервер будет арендован до: '+val); + $.getJSON(home+'servers/id/'+server+'/section/tarif/subsection/unit/uid/'+unit, function(data) + { + $.each(data, function(i, val) + { + if(i == 's') + $('#info_unit').html('Сервер будет арендован до: '+val); - if(i == 'p') - { - $('#packs').css('display', 'table-row'); - $('#pack').html(val); - } - }); + if(i == 'p') + { + $('#packs').css('display', 'table-row'); + $('#pack').html(val); + } + }); - loading(0) - }); + loading(0) + }); } function upd_unit_go() { - unit = $('#unit').val(); + unit = $('#unit').val(); - if(unit < 1) - { - $('#packs').css('display', 'none'); - ('#info_unit').html(''); + if(unit < 1) + { + $('#packs').css('display', 'none'); + ('#info_unit').html(''); - return false; - } + return false; + } - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/tarif/subsection/unit/uid/'+unit+'/pack/'+$('#pack').val()+'/go', function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + $.getJSON(home+'servers/id/'+server+'/section/tarif/subsection/unit/uid/'+unit+'/pack/'+$('#pack').val()+'/go', function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 's') - location.href=home+'servers/id/'+server; - }); + if(i == 's') + location.href=home+'servers/id/'+server; + }); - loading(0) - }); + loading(0) + }); } function addextend() { - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/tarif/subsection/addextend/go', function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + $.getJSON(home+'servers/id/'+server+'/section/tarif/subsection/addextend/go', function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 's') - location.reload(); - }); + if(i == 's') + location.reload(); + }); - loading(0) - }); + loading(0) + }); } \ No newline at end of file diff --git a/template/js/sections/services/crmp.js b/template/js/sections/services/crmp.js index 84690cb..48952d6 100644 --- a/template/js/sections/services/crmp.js +++ b/template/js/sections/services/crmp.js @@ -1,77 +1,77 @@ $('#crmp').ajaxForm({ - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 's') - location.href = home+'servers/id/'+data['id']; - }); + if(i == 's') + location.href = home+'servers/id/'+data['id']; + }); - loading(0); - } + loading(0); + } }); function change_data(data) { - $.getJSON('services/section/crmp/id/'+$('#unit').val()+'/tarif/'+$('#tarifs').val()+'/get/'+data, function(arr) - { - $.each(arr, function(id, val) - { - $('#'+id).html(val); - }); + $.getJSON('services/section/crmp/id/'+$('#unit').val()+'/tarif/'+$('#tarifs').val()+'/get/'+data, function(arr) + { + $.each(arr, function(id, val) + { + $('#'+id).html(val); + }); - upd_price(); - promo(); - }); + upd_price(); + promo(); + }); } function upd_price() { - $.getJSON('services/section/crmp/id/'+$('#unit').val()+'/tarif/'+$('#tarifs').val()+'/slots/'+$('#slots').val()+'/time/'+$('#time').val()+'/get/price', function(arr) - { - $.each(arr, function(id, val) - { - $('#'+id).html(val); - }); + $.getJSON('services/section/crmp/id/'+$('#unit').val()+'/tarif/'+$('#tarifs').val()+'/slots/'+$('#slots').val()+'/time/'+$('#time').val()+'/get/price', function(arr) + { + $.each(arr, function(id, val) + { + $('#'+id).html(val); + }); - promo(); - }); + promo(); + }); } function promo() { - if($('#promo').val() == '') - { - $('#promo_tr').css('display', 'none'); - $('#sum_info').css('text-decoration', 'none'); - return false; - } + if($('#promo').val() == '') + { + $('#promo_tr').css('display', 'none'); + $('#sum_info').css('text-decoration', 'none'); + return false; + } - $.getJSON('services/section/crmp/id/'+$('#unit').val()+'/tarif/'+$('#tarifs').val()+'/slots/'+$('#slots').val()+'/time/'+$('#time').val()+'/cod/'+$('#promo').val()+'/get/promo', function(arr) - { - $('#promo_tr').css('display', 'table-row'); + $.getJSON('services/section/crmp/id/'+$('#unit').val()+'/tarif/'+$('#tarifs').val()+'/slots/'+$('#slots').val()+'/time/'+$('#time').val()+'/cod/'+$('#promo').val()+'/get/promo', function(arr) + { + $('#promo_tr').css('display', 'table-row'); - if(arr['e'] != undefined) - { - $('#promo_info').html(arr['e']); - $('#sum_info').css('text-decoration', 'none'); - }else{ - if(arr['discount'] == 1) - { - $('#sum_info').css('text-decoration', 'line-through'); - $('#promo_info').html('Цена с учетом промо-кода: '+arr['sum']+' '+arr['cur']); - }else{ - $('#sum_info').css('text-decoration', 'none'); - $('#promo_info').html('Подарочные дни: '+arr['days']); - } - } - }); + if(arr['e'] != undefined) + { + $('#promo_info').html(arr['e']); + $('#sum_info').css('text-decoration', 'none'); + }else{ + if(arr['discount'] == 1) + { + $('#sum_info').css('text-decoration', 'line-through'); + $('#promo_info').html('Цена с учетом промо-кода: '+arr['sum']+' '+arr['cur']); + }else{ + $('#sum_info').css('text-decoration', 'none'); + $('#promo_info').html('Подарочные дни: '+arr['days']); + } + } + }); } \ No newline at end of file diff --git a/template/js/sections/services/cs.js b/template/js/sections/services/cs.js index 3b2f30d..4eecb9b 100644 --- a/template/js/sections/services/cs.js +++ b/template/js/sections/services/cs.js @@ -1,77 +1,77 @@ $('#cs').ajaxForm({ - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 's') - location.href = home+'servers/id/'+data['id']; - }); + if(i == 's') + location.href = home+'servers/id/'+data['id']; + }); - loading(0); - } + loading(0); + } }); function change_data(data) { - $.getJSON('services/section/cs/id/'+$('#unit').val()+'/tarif/'+$('#tarifs').val()+'/get/'+data, function(arr) - { - $.each(arr, function(id, val) - { - $('#'+id).html(val); - }); + $.getJSON('services/section/cs/id/'+$('#unit').val()+'/tarif/'+$('#tarifs').val()+'/get/'+data, function(arr) + { + $.each(arr, function(id, val) + { + $('#'+id).html(val); + }); - upd_price(); - promo(); - }); + upd_price(); + promo(); + }); } function upd_price() { - $.getJSON('services/section/cs/id/'+$('#unit').val()+'/tarif/'+$('#tarifs').val()+'/slots/'+$('#slots').val()+'/time/'+$('#time').val()+'/fps/'+$('#fps').val()+'/get/price', function(arr) - { - $.each(arr, function(id, val) - { - $('#'+id).html(val); - }); - - promo(); - }); + $.getJSON('services/section/cs/id/'+$('#unit').val()+'/tarif/'+$('#tarifs').val()+'/slots/'+$('#slots').val()+'/time/'+$('#time').val()+'/fps/'+$('#fps').val()+'/get/price', function(arr) + { + $.each(arr, function(id, val) + { + $('#'+id).html(val); + }); + + promo(); + }); } function promo() { - if($('#promo').val() == '') - { - $('#promo_tr').css('display', 'none'); - $('#sum_info').css('text-decoration', 'none'); - return false; - } + if($('#promo').val() == '') + { + $('#promo_tr').css('display', 'none'); + $('#sum_info').css('text-decoration', 'none'); + return false; + } - $.getJSON('services/section/cs/id/'+$('#unit').val()+'/tarif/'+$('#tarifs').val()+'/slots/'+$('#slots').val()+'/time/'+$('#time').val()+'/fps/'+$('#fps').val()+'/cod/'+$('#promo').val()+'/get/promo', function(arr) - { - $('#promo_tr').css('display', 'table-row'); - - if(arr['e'] != undefined) - { - $('#promo_info').html(arr['e']); - $('#sum_info').css('text-decoration', 'none'); - }else{ - if(arr['discount'] == 1) - { - $('#sum_info').css('text-decoration', 'line-through'); - $('#promo_info').html('Цена с учетом промо-кода: '+arr['sum']+' '+arr['cur']); - }else{ - $('#sum_info').css('text-decoration', 'none'); - $('#promo_info').html('Подарочные дни: '+arr['days']); - } - } - }); + $.getJSON('services/section/cs/id/'+$('#unit').val()+'/tarif/'+$('#tarifs').val()+'/slots/'+$('#slots').val()+'/time/'+$('#time').val()+'/fps/'+$('#fps').val()+'/cod/'+$('#promo').val()+'/get/promo', function(arr) + { + $('#promo_tr').css('display', 'table-row'); + + if(arr['e'] != undefined) + { + $('#promo_info').html(arr['e']); + $('#sum_info').css('text-decoration', 'none'); + }else{ + if(arr['discount'] == 1) + { + $('#sum_info').css('text-decoration', 'line-through'); + $('#promo_info').html('Цена с учетом промо-кода: '+arr['sum']+' '+arr['cur']); + }else{ + $('#sum_info').css('text-decoration', 'none'); + $('#promo_info').html('Подарочные дни: '+arr['days']); + } + } + }); } \ No newline at end of file diff --git a/template/js/sections/services/csgo.js b/template/js/sections/services/csgo.js index 6f8f250..64f631a 100644 --- a/template/js/sections/services/csgo.js +++ b/template/js/sections/services/csgo.js @@ -1,77 +1,77 @@ $('#csgo').ajaxForm({ - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 's') - location.href = home+'servers/id/'+data['id']; - }); + if(i == 's') + location.href = home+'servers/id/'+data['id']; + }); - loading(0); - } + loading(0); + } }); function change_data(data) { - $.getJSON('services/section/csgo/id/'+$('#unit').val()+'/tarif/'+$('#tarifs').val()+'/get/'+data, function(arr) - { - $.each(arr, function(id, val) - { - $('#'+id).html(val); - }); + $.getJSON('services/section/csgo/id/'+$('#unit').val()+'/tarif/'+$('#tarifs').val()+'/get/'+data, function(arr) + { + $.each(arr, function(id, val) + { + $('#'+id).html(val); + }); - upd_price(); - promo(); - }); + upd_price(); + promo(); + }); } function upd_price() { - $.getJSON('services/section/csgo/id/'+$('#unit').val()+'/tarif/'+$('#tarifs').val()+'/slots/'+$('#slots').val()+'/time/'+$('#time').val()+'/tickrate/'+$('#tickrate').val()+'/get/price', function(arr) - { - $.each(arr, function(id, val) - { - $('#'+id).html(val); - }); + $.getJSON('services/section/csgo/id/'+$('#unit').val()+'/tarif/'+$('#tarifs').val()+'/slots/'+$('#slots').val()+'/time/'+$('#time').val()+'/tickrate/'+$('#tickrate').val()+'/get/price', function(arr) + { + $.each(arr, function(id, val) + { + $('#'+id).html(val); + }); - promo(); - }); + promo(); + }); } function promo() { - if($('#promo').val() == '') - { - $('#promo_tr').css('display', 'none'); - $('#sum_info').css('text-decoration', 'none'); - return false; - } + if($('#promo').val() == '') + { + $('#promo_tr').css('display', 'none'); + $('#sum_info').css('text-decoration', 'none'); + return false; + } - $.getJSON('services/section/csgo/id/'+$('#unit').val()+'/tarif/'+$('#tarifs').val()+'/slots/'+$('#slots').val()+'/time/'+$('#time').val()+'/tickrate/'+$('#tickrate').val()+'/cod/'+$('#promo').val()+'/get/promo', function(arr) - { - $('#promo_tr').css('display', 'table-row'); + $.getJSON('services/section/csgo/id/'+$('#unit').val()+'/tarif/'+$('#tarifs').val()+'/slots/'+$('#slots').val()+'/time/'+$('#time').val()+'/tickrate/'+$('#tickrate').val()+'/cod/'+$('#promo').val()+'/get/promo', function(arr) + { + $('#promo_tr').css('display', 'table-row'); - if(arr['e'] != undefined) - { - $('#promo_info').html(arr['e']); - $('#sum_info').css('text-decoration', 'none'); - }else{ - if(arr['discount'] == 1) - { - $('#sum_info').css('text-decoration', 'line-through'); - $('#promo_info').html('Цена с учетом промо-кода: '+arr['sum']+' '+arr['cur']); - }else{ - $('#sum_info').css('text-decoration', 'none'); - $('#promo_info').html('Подарочные дни: '+arr['days']); - } - } - }); + if(arr['e'] != undefined) + { + $('#promo_info').html(arr['e']); + $('#sum_info').css('text-decoration', 'none'); + }else{ + if(arr['discount'] == 1) + { + $('#sum_info').css('text-decoration', 'line-through'); + $('#promo_info').html('Цена с учетом промо-кода: '+arr['sum']+' '+arr['cur']); + }else{ + $('#sum_info').css('text-decoration', 'none'); + $('#promo_info').html('Подарочные дни: '+arr['days']); + } + } + }); } \ No newline at end of file diff --git a/template/js/sections/services/css.js b/template/js/sections/services/css.js index 68beafb..f923a5e 100644 --- a/template/js/sections/services/css.js +++ b/template/js/sections/services/css.js @@ -1,77 +1,77 @@ $('#css').ajaxForm({ - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 's') - location.href = home+'servers/id/'+data['id']; - }); + if(i == 's') + location.href = home+'servers/id/'+data['id']; + }); - loading(0); - } + loading(0); + } }); function change_data(data) { - $.getJSON('services/section/css/id/'+$('#unit').val()+'/tarif/'+$('#tarifs').val()+'/get/'+data, function(arr) - { - $.each(arr, function(id, val) - { - $('#'+id).html(val); - }); + $.getJSON('services/section/css/id/'+$('#unit').val()+'/tarif/'+$('#tarifs').val()+'/get/'+data, function(arr) + { + $.each(arr, function(id, val) + { + $('#'+id).html(val); + }); - upd_price(); - promo(); - }); + upd_price(); + promo(); + }); } function upd_price() { - $.getJSON('services/section/css/id/'+$('#unit').val()+'/tarif/'+$('#tarifs').val()+'/slots/'+$('#slots').val()+'/time/'+$('#time').val()+'/tickrate/'+$('#tickrate').val()+'/get/price', function(arr) - { - $.each(arr, function(id, val) - { - $('#'+id).html(val); - }); + $.getJSON('services/section/css/id/'+$('#unit').val()+'/tarif/'+$('#tarifs').val()+'/slots/'+$('#slots').val()+'/time/'+$('#time').val()+'/tickrate/'+$('#tickrate').val()+'/get/price', function(arr) + { + $.each(arr, function(id, val) + { + $('#'+id).html(val); + }); - promo(); - }); + promo(); + }); } function promo() { - if($('#promo').val() == '') - { - $('#promo_tr').css('display', 'none'); - $('#sum_info').css('text-decoration', 'none'); - return false; - } + if($('#promo').val() == '') + { + $('#promo_tr').css('display', 'none'); + $('#sum_info').css('text-decoration', 'none'); + return false; + } - $.getJSON('services/section/css/id/'+$('#unit').val()+'/tarif/'+$('#tarifs').val()+'/slots/'+$('#slots').val()+'/time/'+$('#time').val()+'/tickrate/'+$('#tickrate').val()+'/cod/'+$('#promo').val()+'/get/promo', function(arr) - { - $('#promo_tr').css('display', 'table-row'); + $.getJSON('services/section/css/id/'+$('#unit').val()+'/tarif/'+$('#tarifs').val()+'/slots/'+$('#slots').val()+'/time/'+$('#time').val()+'/tickrate/'+$('#tickrate').val()+'/cod/'+$('#promo').val()+'/get/promo', function(arr) + { + $('#promo_tr').css('display', 'table-row'); - if(arr['e'] != undefined) - { - $('#promo_info').html(arr['e']); - $('#sum_info').css('text-decoration', 'none'); - }else{ - if(arr['discount'] == 1) - { - $('#sum_info').css('text-decoration', 'line-through'); - $('#promo_info').html('Цена с учетом промо-кода: '+arr['sum']+' '+arr['cur']); - }else{ - $('#sum_info').css('text-decoration', 'none'); - $('#promo_info').html('Подарочные дни: '+arr['days']); - } - } - }); + if(arr['e'] != undefined) + { + $('#promo_info').html(arr['e']); + $('#sum_info').css('text-decoration', 'none'); + }else{ + if(arr['discount'] == 1) + { + $('#sum_info').css('text-decoration', 'line-through'); + $('#promo_info').html('Цена с учетом промо-кода: '+arr['sum']+' '+arr['cur']); + }else{ + $('#sum_info').css('text-decoration', 'none'); + $('#promo_info').html('Подарочные дни: '+arr['days']); + } + } + }); } \ No newline at end of file diff --git a/template/js/sections/services/cssold.js b/template/js/sections/services/cssold.js index 7be30d7..3a29db3 100644 --- a/template/js/sections/services/cssold.js +++ b/template/js/sections/services/cssold.js @@ -1,77 +1,77 @@ $('#cssold').ajaxForm({ - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 's') - location.href = home+'servers/id/'+data['id']; - }); + if(i == 's') + location.href = home+'servers/id/'+data['id']; + }); - loading(0); - } + loading(0); + } }); function change_data(data) { - $.getJSON('services/section/cssold/id/'+$('#unit').val()+'/tarif/'+$('#tarifs').val()+'/get/'+data, function(arr) - { - $.each(arr, function(id, val) - { - $('#'+id).html(val); - }); + $.getJSON('services/section/cssold/id/'+$('#unit').val()+'/tarif/'+$('#tarifs').val()+'/get/'+data, function(arr) + { + $.each(arr, function(id, val) + { + $('#'+id).html(val); + }); - upd_price(); - promo(); - }); + upd_price(); + promo(); + }); } function upd_price() { - $.getJSON('services/section/cssold/id/'+$('#unit').val()+'/tarif/'+$('#tarifs').val()+'/slots/'+$('#slots').val()+'/time/'+$('#time').val()+'/tickrate/'+$('#tickrate').val()+'/fps/'+$('#fps').val()+'/get/price', function(arr) - { - $.each(arr, function(id, val) - { - $('#'+id).html(val); - }); + $.getJSON('services/section/cssold/id/'+$('#unit').val()+'/tarif/'+$('#tarifs').val()+'/slots/'+$('#slots').val()+'/time/'+$('#time').val()+'/tickrate/'+$('#tickrate').val()+'/fps/'+$('#fps').val()+'/get/price', function(arr) + { + $.each(arr, function(id, val) + { + $('#'+id).html(val); + }); - promo(); - }); + promo(); + }); } function promo() { - if($('#promo').val() == '') - { - $('#promo_tr').css('display', 'none'); - $('#sum_info').css('text-decoration', 'none'); - return false; - } + if($('#promo').val() == '') + { + $('#promo_tr').css('display', 'none'); + $('#sum_info').css('text-decoration', 'none'); + return false; + } - $.getJSON('services/section/cssold/id/'+$('#unit').val()+'/tarif/'+$('#tarifs').val()+'/slots/'+$('#slots').val()+'/time/'+$('#time').val()+'/tickrate/'+$('#tickrate').val()+'/fps/'+$('#fps').val()+'/cod/'+$('#promo').val()+'/get/promo', function(arr) - { - $('#promo_tr').css('display', 'table-row'); + $.getJSON('services/section/cssold/id/'+$('#unit').val()+'/tarif/'+$('#tarifs').val()+'/slots/'+$('#slots').val()+'/time/'+$('#time').val()+'/tickrate/'+$('#tickrate').val()+'/fps/'+$('#fps').val()+'/cod/'+$('#promo').val()+'/get/promo', function(arr) + { + $('#promo_tr').css('display', 'table-row'); - if(arr['e'] != undefined) - { - $('#promo_info').html(arr['e']); - $('#sum_info').css('text-decoration', 'none'); - }else{ - if(arr['discount'] == 1) - { - $('#sum_info').css('text-decoration', 'line-through'); - $('#promo_info').html('Цена с учетом промо-кода: '+arr['sum']+' '+arr['cur']); - }else{ - $('#sum_info').css('text-decoration', 'none'); - $('#promo_info').html('Подарочные дни: '+arr['days']); - } - } - }); + if(arr['e'] != undefined) + { + $('#promo_info').html(arr['e']); + $('#sum_info').css('text-decoration', 'none'); + }else{ + if(arr['discount'] == 1) + { + $('#sum_info').css('text-decoration', 'line-through'); + $('#promo_info').html('Цена с учетом промо-кода: '+arr['sum']+' '+arr['cur']); + }else{ + $('#sum_info').css('text-decoration', 'none'); + $('#promo_info').html('Подарочные дни: '+arr['days']); + } + } + }); } \ No newline at end of file diff --git a/template/js/sections/services/mc.js b/template/js/sections/services/mc.js index 57b4643..cc8ca5c 100644 --- a/template/js/sections/services/mc.js +++ b/template/js/sections/services/mc.js @@ -1,77 +1,77 @@ $('#mc').ajaxForm({ - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 's') - location.href = home+'servers/id/'+data['id']; - }); + if(i == 's') + location.href = home+'servers/id/'+data['id']; + }); - loading(0); - } + loading(0); + } }); function change_data(data) { - $.getJSON('services/section/mc/id/'+$('#unit').val()+'/tarif/'+$('#tarifs').val()+'/get/'+data, function(arr) - { - $.each(arr, function(id, val) - { - $('#'+id).html(val); - }); + $.getJSON('services/section/mc/id/'+$('#unit').val()+'/tarif/'+$('#tarifs').val()+'/get/'+data, function(arr) + { + $.each(arr, function(id, val) + { + $('#'+id).html(val); + }); - upd_price(); - promo(); - }); + upd_price(); + promo(); + }); } function upd_price() { - $.getJSON('services/section/mc/id/'+$('#unit').val()+'/tarif/'+$('#tarifs').val()+'/slots/'+$('#slots').val()+'/time/'+$('#time').val()+'/ram/'+$('#ram').val()+'/get/price', function(arr) - { - $.each(arr, function(id, val) - { - $('#'+id).html(val); - }); + $.getJSON('services/section/mc/id/'+$('#unit').val()+'/tarif/'+$('#tarifs').val()+'/slots/'+$('#slots').val()+'/time/'+$('#time').val()+'/ram/'+$('#ram').val()+'/get/price', function(arr) + { + $.each(arr, function(id, val) + { + $('#'+id).html(val); + }); - promo(); - }); + promo(); + }); } function promo() { - if($('#promo').val() == '') - { - $('#promo_tr').css('display', 'none'); - $('#sum_info').css('text-decoration', 'none'); - return false; - } + if($('#promo').val() == '') + { + $('#promo_tr').css('display', 'none'); + $('#sum_info').css('text-decoration', 'none'); + return false; + } - $.getJSON('services/section/mc/id/'+$('#unit').val()+'/tarif/'+$('#tarifs').val()+'/slots/'+$('#slots').val()+'/time/'+$('#time').val()+'/ram/'+$('#ram').val()+'/cod/'+$('#promo').val()+'/get/promo', function(arr) - { - $('#promo_tr').css('display', 'table-row'); + $.getJSON('services/section/mc/id/'+$('#unit').val()+'/tarif/'+$('#tarifs').val()+'/slots/'+$('#slots').val()+'/time/'+$('#time').val()+'/ram/'+$('#ram').val()+'/cod/'+$('#promo').val()+'/get/promo', function(arr) + { + $('#promo_tr').css('display', 'table-row'); - if(arr['e'] != undefined) - { - $('#promo_info').html(arr['e']); - $('#sum_info').css('text-decoration', 'none'); - }else{ - if(arr['discount'] == 1) - { - $('#sum_info').css('text-decoration', 'line-through'); - $('#promo_info').html('Цена с учетом промо-кода: '+arr['sum']+' '+arr['cur']); - }else{ - $('#sum_info').css('text-decoration', 'none'); - $('#promo_info').html('Подарочные дни: '+arr['days']); - } - } - }); + if(arr['e'] != undefined) + { + $('#promo_info').html(arr['e']); + $('#sum_info').css('text-decoration', 'none'); + }else{ + if(arr['discount'] == 1) + { + $('#sum_info').css('text-decoration', 'line-through'); + $('#promo_info').html('Цена с учетом промо-кода: '+arr['sum']+' '+arr['cur']); + }else{ + $('#sum_info').css('text-decoration', 'none'); + $('#promo_info').html('Подарочные дни: '+arr['days']); + } + } + }); } \ No newline at end of file diff --git a/template/js/sections/services/mta.js b/template/js/sections/services/mta.js index 3f7662a..98cee7c 100644 --- a/template/js/sections/services/mta.js +++ b/template/js/sections/services/mta.js @@ -1,77 +1,77 @@ $('#mta').ajaxForm({ - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 's') - location.href = home+'servers/id/'+data['id']; - }); + if(i == 's') + location.href = home+'servers/id/'+data['id']; + }); - loading(0); - } + loading(0); + } }); function change_data(data) { - $.getJSON('services/section/mta/id/'+$('#unit').val()+'/tarif/'+$('#tarifs').val()+'/get/'+data, function(arr) - { - $.each(arr, function(id, val) - { - $('#'+id).html(val); - }); + $.getJSON('services/section/mta/id/'+$('#unit').val()+'/tarif/'+$('#tarifs').val()+'/get/'+data, function(arr) + { + $.each(arr, function(id, val) + { + $('#'+id).html(val); + }); - upd_price(); - promo(); - }); + upd_price(); + promo(); + }); } function upd_price() { - $.getJSON('services/section/mta/id/'+$('#unit').val()+'/tarif/'+$('#tarifs').val()+'/slots/'+$('#slots').val()+'/time/'+$('#time').val()+'/get/price', function(arr) - { - $.each(arr, function(id, val) - { - $('#'+id).html(val); - }); + $.getJSON('services/section/mta/id/'+$('#unit').val()+'/tarif/'+$('#tarifs').val()+'/slots/'+$('#slots').val()+'/time/'+$('#time').val()+'/get/price', function(arr) + { + $.each(arr, function(id, val) + { + $('#'+id).html(val); + }); - promo(); - }); + promo(); + }); } function promo() { - if($('#promo').val() == '') - { - $('#promo_tr').css('display', 'none'); - $('#sum_info').css('text-decoration', 'none'); - return false; - } + if($('#promo').val() == '') + { + $('#promo_tr').css('display', 'none'); + $('#sum_info').css('text-decoration', 'none'); + return false; + } - $.getJSON('services/section/mta/id/'+$('#unit').val()+'/tarif/'+$('#tarifs').val()+'/slots/'+$('#slots').val()+'/time/'+$('#time').val()+'/cod/'+$('#promo').val()+'/get/promo', function(arr) - { - $('#promo_tr').css('display', 'table-row'); + $.getJSON('services/section/mta/id/'+$('#unit').val()+'/tarif/'+$('#tarifs').val()+'/slots/'+$('#slots').val()+'/time/'+$('#time').val()+'/cod/'+$('#promo').val()+'/get/promo', function(arr) + { + $('#promo_tr').css('display', 'table-row'); - if(arr['e'] != undefined) - { - $('#promo_info').html(arr['e']); - $('#sum_info').css('text-decoration', 'none'); - }else{ - if(arr['discount'] == 1) - { - $('#sum_info').css('text-decoration', 'line-through'); - $('#promo_info').html('Цена с учетом промо-кода: '+arr['sum']+' '+arr['cur']); - }else{ - $('#sum_info').css('text-decoration', 'none'); - $('#promo_info').html('Подарочные дни: '+arr['days']); - } - } - }); + if(arr['e'] != undefined) + { + $('#promo_info').html(arr['e']); + $('#sum_info').css('text-decoration', 'none'); + }else{ + if(arr['discount'] == 1) + { + $('#sum_info').css('text-decoration', 'line-through'); + $('#promo_info').html('Цена с учетом промо-кода: '+arr['sum']+' '+arr['cur']); + }else{ + $('#sum_info').css('text-decoration', 'none'); + $('#promo_info').html('Подарочные дни: '+arr['days']); + } + } + }); } \ No newline at end of file diff --git a/template/js/sections/services/privileges.js b/template/js/sections/services/privileges.js index b0b30e4..cab5546 100644 --- a/template/js/sections/services/privileges.js +++ b/template/js/sections/services/privileges.js @@ -1,83 +1,83 @@ $('#privileges').ajaxForm({ - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 's') - { - $('#form_pay').css('display', 'block'); - $('#pay').html(val); - } - }); + if(i == 's') + { + $('#form_pay').css('display', 'block'); + $('#pay').html(val); + } + }); - loading(0); - } + loading(0); + } }); function find_server() { - loading(1); + loading(1); - $.ajax({ - type: 'POST', - url: home+'services/section/privileges/select/server', - data: 'address='+$('#server').val(), - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + $.ajax({ + type: 'POST', + url: home+'services/section/privileges/select/server', + data: 'address='+$('#server').val(), + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 's') - { - $('#form_privileges').css('display', 'block'); - $('#privileges').html(val); - } - }); + if(i == 's') + { + $('#form_privileges').css('display', 'block'); + $('#privileges').html(val); + } + }); - loading(0); - } - }); + loading(0); + } + }); } function change_time() { - $.get(home+'services/section/privileges/select/time/service/'+$('#service').val(), function(data) - { - $('#time').html(data) - }); + $.get(home+'services/section/privileges/select/time/service/'+$('#service').val(), function(data) + { + $('#time').html(data) + }); } function change_data() { - switch($('#type').val()) - { - case 'a': - $('#data').attr('placeholder', 'Введите ник'); - $('#form_passwd').css('display', 'table-row'); - break; + switch($('#type').val()) + { + case 'a': + $('#data').attr('placeholder', 'Введите ник'); + $('#form_passwd').css('display', 'table-row'); + break; - case 'ca': - $('#data').attr('placeholder', 'Введите SteamID'); - $('#form_passwd').css('display', 'table-row'); - break; + case 'ca': + $('#data').attr('placeholder', 'Введите SteamID'); + $('#form_passwd').css('display', 'table-row'); + break; - default: - $('#data').attr('placeholder', 'Введите IP'); - $('#form_passwd').css('display', 'none'); - } + default: + $('#data').attr('placeholder', 'Введите IP'); + $('#form_passwd').css('display', 'none'); + } } \ No newline at end of file diff --git a/template/js/sections/services/samp.js b/template/js/sections/services/samp.js index 77e1086..ab941b0 100644 --- a/template/js/sections/services/samp.js +++ b/template/js/sections/services/samp.js @@ -1,77 +1,77 @@ $('#samp').ajaxForm({ - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 's') - location.href = home+'servers/id/'+data['id']; - }); + if(i == 's') + location.href = home+'servers/id/'+data['id']; + }); - loading(0); - } + loading(0); + } }); function change_data(data) { - $.getJSON('services/section/samp/id/'+$('#unit').val()+'/tarif/'+$('#tarifs').val()+'/get/'+data, function(arr) - { - $.each(arr, function(id, val) - { - $('#'+id).html(val); - }); + $.getJSON('services/section/samp/id/'+$('#unit').val()+'/tarif/'+$('#tarifs').val()+'/get/'+data, function(arr) + { + $.each(arr, function(id, val) + { + $('#'+id).html(val); + }); - upd_price(); - promo(); - }); + upd_price(); + promo(); + }); } function upd_price() { - $.getJSON('services/section/samp/id/'+$('#unit').val()+'/tarif/'+$('#tarifs').val()+'/slots/'+$('#slots').val()+'/time/'+$('#time').val()+'/get/price', function(arr) - { - $.each(arr, function(id, val) - { - $('#'+id).html(val); - }); + $.getJSON('services/section/samp/id/'+$('#unit').val()+'/tarif/'+$('#tarifs').val()+'/slots/'+$('#slots').val()+'/time/'+$('#time').val()+'/get/price', function(arr) + { + $.each(arr, function(id, val) + { + $('#'+id).html(val); + }); - promo(); - }); + promo(); + }); } function promo() { - if($('#promo').val() == '') - { - $('#promo_tr').css('display', 'none'); - $('#sum_info').css('text-decoration', 'none'); - return false; - } + if($('#promo').val() == '') + { + $('#promo_tr').css('display', 'none'); + $('#sum_info').css('text-decoration', 'none'); + return false; + } - $.getJSON('services/section/samp/id/'+$('#unit').val()+'/tarif/'+$('#tarifs').val()+'/slots/'+$('#slots').val()+'/time/'+$('#time').val()+'/cod/'+$('#promo').val()+'/get/promo', function(arr) - { - $('#promo_tr').css('display', 'table-row'); + $.getJSON('services/section/samp/id/'+$('#unit').val()+'/tarif/'+$('#tarifs').val()+'/slots/'+$('#slots').val()+'/time/'+$('#time').val()+'/cod/'+$('#promo').val()+'/get/promo', function(arr) + { + $('#promo_tr').css('display', 'table-row'); - if(arr['e'] != undefined) - { - $('#promo_info').html(arr['e']); - $('#sum_info').css('text-decoration', 'none'); - }else{ - if(arr['discount'] == 1) - { - $('#sum_info').css('text-decoration', 'line-through'); - $('#promo_info').html('Цена с учетом промо-кода: '+arr['sum']+' '+arr['cur']); - }else{ - $('#sum_info').css('text-decoration', 'none'); - $('#promo_info').html('Подарочные дни: '+arr['days']); - } - } - }); + if(arr['e'] != undefined) + { + $('#promo_info').html(arr['e']); + $('#sum_info').css('text-decoration', 'none'); + }else{ + if(arr['discount'] == 1) + { + $('#sum_info').css('text-decoration', 'line-through'); + $('#promo_info').html('Цена с учетом промо-кода: '+arr['sum']+' '+arr['cur']); + }else{ + $('#sum_info').css('text-decoration', 'none'); + $('#promo_info').html('Подарочные дни: '+arr['days']); + } + } + }); } \ No newline at end of file diff --git a/template/js/sections/user/auth.js b/template/js/sections/user/auth.js index 4bcebe4..4eec672 100644 --- a/template/js/sections/user/auth.js +++ b/template/js/sections/user/auth.js @@ -1,42 +1,42 @@ $('#auth').ajaxForm({ - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - { - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + { + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - document.getElementById("captcha_img").src = home+'user/section/auth/captcha?'+Math.random(); + document.getElementById("captcha_img").src = home+'user/section/auth/captcha?'+Math.random(); - $('#captcha').val(''); - } + $('#captcha').val(''); + } - if(i == 'i') - { - bootbox.dialog('

    Внимание

    '+val, - [{ - "label" : "Продолжить", - }] - ); + if(i == 'i') + { + bootbox.dialog('

    Внимание

    '+val, + [{ + "label" : "Продолжить", + }] + ); - $('#security_code').css('display', 'table-row'); + $('#security_code').css('display', 'table-row'); - document.getElementById("captcha_img").src = home+'user/section/auth/captcha?'+Math.random(); + document.getElementById("captcha_img").src = home+'user/section/auth/captcha?'+Math.random(); - $('#captcha').val(''); - } + $('#captcha').val(''); + } - if(i == 's') - location.reload(); - }); - loading(0); - } + if(i == 's') + location.reload(); + }); + loading(0); + } }); $('#captcha')[0].onkeyup = function(){ diff --git a/template/js/sections/user/lk.js b/template/js/sections/user/lk.js index 925f6ef..649083d 100644 --- a/template/js/sections/user/lk.js +++ b/template/js/sections/user/lk.js @@ -1,231 +1,231 @@ function browser(data) { - bootbox.dialog('

    Подробная информация

    '+data, - [{ - "label" : "Продолжить", - }] - ); + bootbox.dialog('

    Подробная информация

    '+data, + [{ + "label" : "Продолжить", + }] + ); } function passwd() { - $.get(home+'user/section/lk/passwd/1', function(passwd) - { - $('#passwd').val(passwd); - }); + $.get(home+'user/section/lk/passwd/1', function(passwd) + { + $('#passwd').val(passwd); + }); } function mail_notice(ation) { - $.get(home+'user/section/lk/subsection/settings/action/'+ation, function(passwd) - { - location.reload(); - }); + $.get(home+'user/section/lk/subsection/settings/action/'+ation, function(passwd) + { + location.reload(); + }); } function lk(type) { - loading(1); + loading(1); - var url = ''; - var val = ''; + var url = ''; + var val = ''; - switch(type) - { - case 'mail': - url = 'user/section/lk/subsection/action/type/mail/go'; - val = 'mail='+$('#mail').val(); + switch(type) + { + case 'mail': + url = 'user/section/lk/subsection/action/type/mail/go'; + val = 'mail='+$('#mail').val(); - break; + break; - case 'passwd': - url = 'user/section/lk/subsection/action/type/passwd/go'; - val = 'passwd='+$('#passwd').val(); + case 'passwd': + url = 'user/section/lk/subsection/action/type/passwd/go'; + val = 'passwd='+$('#passwd').val(); - break; + break; - case 'phone': - url = 'user/section/lk/subsection/action/type/phone/go'; - val = 'phone='+$('#phone').val(); + case 'phone': + url = 'user/section/lk/subsection/action/type/phone/go'; + val = 'phone='+$('#phone').val(); - break; + break; - case 'confirm': - url = 'user/section/lk/subsection/action/type/confirm_phone/go'; - val = ''; - form = '
    '; + case 'confirm': + url = 'user/section/lk/subsection/action/type/confirm_phone/go'; + val = ''; + form = '
    '; - break; + break; - case 'confirm_end': - url = 'user/section/lk/subsection/action/type/confirm_phone_end/go'; - val = 'smscode='+$('#smscode').val(); + case 'confirm_end': + url = 'user/section/lk/subsection/action/type/confirm_phone_end/go'; + val = 'smscode='+$('#smscode').val(); - break; + break; - case 'contacts': - url = 'user/section/lk/subsection/action/type/contacts/go'; - val = 'contacts='+$('#contacts').val(); + case 'contacts': + url = 'user/section/lk/subsection/action/type/contacts/go'; + val = 'contacts='+$('#contacts').val(); - break; + break; - case 'wmr': - url = 'user/section/lk/subsection/action/type/wmr/go'; - val = 'wmr='+$('#wmr').val(); + case 'wmr': + url = 'user/section/lk/subsection/action/type/wmr/go'; + val = 'wmr='+$('#wmr').val(); - break; + break; - default: - loading(0); + default: + loading(0); - return false; - } - - $.ajax({ - type: 'POST', - url: home+url, - data: val, - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e' && val != '') - bootbox.dialog(val, - [{ - "label" : "Продолжить", - }] - ); + return false; + } + + $.ajax({ + type: 'POST', + url: home+url, + data: val, + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e' && val != '') + bootbox.dialog(val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 's' && val != '') - { - if(type == 'confirm' || type == 'mail') - { - if(type == 'confirm') - bootbox.dialog(form, - [{ - "label" : "Подтвердить", - callback: function() {lk('confirm_end');} - }] - ); - else - bootbox.dialog(val, - [{ - "label" : "Продолжить", - callback: function() { - location.href='http://'+data['mail']; - } - }] - ); - }else - location.reload(); - } - }); + if(i == 's' && val != '') + { + if(type == 'confirm' || type == 'mail') + { + if(type == 'confirm') + bootbox.dialog(form, + [{ + "label" : "Подтвердить", + callback: function() {lk('confirm_end');} + }] + ); + else + bootbox.dialog(val, + [{ + "label" : "Продолжить", + callback: function() { + location.href='http://'+data['mail']; + } + }] + ); + }else + location.reload(); + } + }); - loading(0) - } - }); + loading(0) + } + }); } function security(type, id) { - loading(1); + loading(1); - address = $('#'+type+'ip').val(); + address = $('#'+type+'ip').val(); - if(id) - address = id; + if(id) + address = id; - switch(type) - { - case 'on': - action = 'on'; - break; + switch(type) + { + case 'on': + action = 'on'; + break; - case 'off': - action = 'off'; - break; + case 'off': + action = 'off'; + break; - case 'on_code': - action = 'on_code'; - break; + case 'on_code': + action = 'on_code'; + break; - case 'off_code': - action = 'off_code'; - break; + case 'off_code': + action = 'off_code'; + break; - case 'info': - action = 'info'; - break; + case 'info': + action = 'info'; + break; - case 'add': case 'addsub': - action = 'add'; - break; + case 'add': case 'addsub': + action = 'add'; + break; - case 'del': - action = 'del'; - break; + case 'del': + action = 'del'; + break; - default: - return false; - } + default: + return false; + } - subnetwork = ''; + subnetwork = ''; - if(type == 'addsub') - subnetwork = '&subnetwork=true'; + if(type == 'addsub') + subnetwork = '&subnetwork=true'; - $.ajax({ - type: 'POST', - url: home+'user/section/lk/subsection/security/action/'+action, - data: 'address='+address+subnetwork, - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); + $.ajax({ + type: 'POST', + url: home+'user/section/lk/subsection/security/action/'+action, + data: 'address='+address+subnetwork, + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); - if(i == 'i') - { - bootbox.dialog('

    Внимание

    '+val, - [{ - "label" : "Удалить", - "class" : "btn-error", - callback: function(){security('del', data['id'])} - },{ - "label" : "Отмена" - }] - ); - } + if(i == 'i') + { + bootbox.dialog('

    Внимание

    '+val, + [{ + "label" : "Удалить", + "class" : "btn-error", + callback: function(){security('del', data['id'])} + },{ + "label" : "Отмена" + }] + ); + } - if(i == 's') - location.reload(); + if(i == 's') + location.reload(); - if(i == 'info') - $('#whois').html(val); - }); + if(i == 'info') + $('#whois').html(val); + }); - loading(0) - } - }); + loading(0) + } + }); } function clearFileUpload(id) { - fileField = document.getElementById(id); - parentNod = fileField.parentNode; - tmpForm = document.createElement("form"); - parentNod.replaceChild(tmpForm,fileField); - tmpForm.appendChild(fileField); - tmpForm.reset(); - parentNod.replaceChild(fileField,tmpForm); + fileField = document.getElementById(id); + parentNod = fileField.parentNode; + tmpForm = document.createElement("form"); + parentNod.replaceChild(tmpForm,fileField); + tmpForm.appendChild(fileField); + tmpForm.reset(); + parentNod.replaceChild(fileField,tmpForm); } jQuery.event.props.push('dataTransfer'); @@ -235,44 +235,44 @@ var dataArray = []; $('#drop-files').on('drop', function(e) { - var files = e.dataTransfer.files; + var files = e.dataTransfer.files; - if(files.length <= maxFiles) - { - for(i = 0; i < files.length; i++) - { - if(files[i].size < (1024*1024*1)) - loadInView(files[i]); - else - alert('Слишком большой файл. Максимально 1024Kb.'); - } - }else{ - alert('Нельзя загружать больше '+maxFiles+' изображения.'); - files.length = 0; - } + if(files.length <= maxFiles) + { + for(i = 0; i < files.length; i++) + { + if(files[i].size < (1024*1024*1)) + loadInView(files[i]); + else + alert('Слишком большой файл. Максимально 1024Kb.'); + } + }else{ + alert('Нельзя загружать больше '+maxFiles+' изображения.'); + files.length = 0; + } - return false; + return false; }); $('#img').on('change', function() { - var files = $(this)[0].files; + var files = $(this)[0].files; - if(files.length <= maxFiles) - { - for(i = 0; i < files.length; i++) - { - if(files[i].size < (1024*1024*1)) - loadInView(files[i]); - else - alert('Слишком большой файл. Максимально 1024Kb.'); - } - }else{ - alert('Нельзя загружать больше '+maxFiles+' изображения.'); - files.length = 0; - } + if(files.length <= maxFiles) + { + for(i = 0; i < files.length; i++) + { + if(files[i].size < (1024*1024*1)) + loadInView(files[i]); + else + alert('Слишком большой файл. Максимально 1024Kb.'); + } + }else{ + alert('Нельзя загружать больше '+maxFiles+' изображения.'); + files.length = 0; + } - clearFileUpload('img'); + clearFileUpload('img'); }); var upload = 0; @@ -280,156 +280,156 @@ var files = 0; function loadInView(file) { - if(files < 0) - files = 0; + if(files < 0) + files = 0; - $('#uploaded-holder').css('display', 'inline-block'); + $('#uploaded-holder').css('display', 'inline-block'); - if(!file.type.match('image.*')) - { - $('#drop-files p').html('Файл не является изображением.'); + if(!file.type.match('image.*')) + { + $('#drop-files p').html('Файл не является изображением.'); - return false; - } + return false; + } - files = files+1; + files = files+1; - if(files <= maxFiles) - $('#upload-button').css({'display' : 'block'}); - else{ - alert('Нельзя загружать больше '+maxFiles+' изображения.'); - - files = files-1; + if(files <= maxFiles) + $('#upload-button').css({'display' : 'block'}); + else{ + alert('Нельзя загружать больше '+maxFiles+' изображения.'); + + files = files-1; - return false; - } + return false; + } - var fileReader = new FileReader(); + var fileReader = new FileReader(); - fileReader.onload = (function(file){ - return function(e){ - dataArray.push({name : file.name, value : this.result, check : null, sel : null}); - addImage((dataArray.length-1)); - }; - })(file); + fileReader.onload = (function(file){ + return function(e){ + dataArray.push({name : file.name, value : this.result, check : null, sel : null}); + addImage((dataArray.length-1)); + }; + })(file); - fileReader.readAsDataURL(file); + fileReader.readAsDataURL(file); - return false; + return false; } function delImage(id) { - $(this).empty(); - dataArray.splice(id, 1); - $('#ava > div').remove(); - $('#avatar').css('display', 'block'); - addImage(-1); + $(this).empty(); + dataArray.splice(id, 1); + $('#ava > div').remove(); + $('#avatar').css('display', 'block'); + addImage(-1); - return false; + return false; } function addImage(ind) { - if(ind < 0 ) - { - start = 0; - end = dataArray.length; - files = files-1; - }else{ - start = ind; - end = ind+1; - } + if(ind < 0 ) + { + start = 0; + end = dataArray.length; + files = files-1; + }else{ + start = ind; + end = ind+1; + } - if(dataArray.length == 0) - { - $('#upload-button').hide(); - $('#uploaded-holder').hide(); - } + if(dataArray.length == 0) + { + $('#upload-button').hide(); + $('#uploaded-holder').hide(); + } - for(i = start; i < end; i++) - { - if($('#ava > div').length <= maxFiles) - { - $('#avatar').css('display', 'none'); - $('#ava').append('
    '); - } - } + for(i = start; i < end; i++) + { + if($('#ava > div').length <= maxFiles) + { + $('#avatar').css('display', 'none'); + $('#ava').append('
    '); + } + } - return false; + return false; } function restartFiles(go) { - $('#loading-bar .loading-color').css({'width' : '0%'}); - $('#loading').css({'display' : 'none'}); - $('#loading-content').html(' '); - $('#upload-button').hide(); - $('#ava > div').remove(); - $('#avatar').css('display', 'block'); - $('#uploaded-holder').hide(); + $('#loading-bar .loading-color').css({'width' : '0%'}); + $('#loading').css({'display' : 'none'}); + $('#loading-content').html(' '); + $('#upload-button').hide(); + $('#ava > div').remove(); + $('#avatar').css('display', 'block'); + $('#uploaded-holder').hide(); - dataArray.length = 0; + dataArray.length = 0; - if(go != 1) - files = upload; + if(go != 1) + files = upload; - return false; + return false; } $('#dropped-files #upload-button .delete').click(restartFiles); $('#upload-button .upload').click(function() { - $("#loading").show(); + $("#loading").show(); - var totalPercent = 100 / dataArray.length; - var x = 0; + var totalPercent = 100 / dataArray.length; + var x = 0; - $('#loading-content').html('Загружен '+dataArray[0].name); + $('#loading-content').html('Загружен '+dataArray[0].name); - $.each(dataArray, function(index, file) - { - upload = upload + 1; + $.each(dataArray, function(index, file) + { + upload = upload + 1; - $.post(home+'user/section/lk/subsection/settings/action/upload', dataArray[index], function(data) - { - var fileName = dataArray[index].name; - ++x; + $.post(home+'user/section/lk/subsection/settings/action/upload', dataArray[index], function(data) + { + var fileName = dataArray[index].name; + ++x; - $('#loading-bar .loading-color').css({'width' : totalPercent*(x)+'%'}); + $('#loading-bar .loading-color').css({'width' : totalPercent*(x)+'%'}); - if(totalPercent*(x) == 100) - { - $('#loading-content').html('Загрузка завершена.'); - setTimeout(restartFiles(1), 1000); - }else if(totalPercent*(x) < 100) - $('#loading-content').html('Загружается '+fileName); + if(totalPercent*(x) == 100) + { + $('#loading-content').html('Загрузка завершена.'); + setTimeout(restartFiles(1), 1000); + }else if(totalPercent*(x) < 100) + $('#loading-content').html('Загружается '+fileName); - var dataSplit = data.split(':'); + var dataSplit = data.split(':'); - if(dataSplit[1] == 'ok') - location.reload(); - else - alert(data); - }); + if(dataSplit[1] == 'ok') + location.reload(); + else + alert(data); + }); - }); + }); - return false; + return false; }); $('#drop-files').on('dragenter', function() { - $(this).css({'border-color' : '#74b084'}); + $(this).css({'border-color' : '#74b084'}); - return false; + return false; }); $('#drop-files').on('drop', function() { - $(this).css({'border-color' : '#dcdcdc'}); - files = files-1; + $(this).css({'border-color' : '#dcdcdc'}); + files = files-1; - return false; + return false; }); diff --git a/template/js/sections/user/recovery.js b/template/js/sections/user/recovery.js index f41963e..a362f79 100644 --- a/template/js/sections/user/recovery.js +++ b/template/js/sections/user/recovery.js @@ -1,35 +1,35 @@ $('#recovery').ajaxForm({ - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - { - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + { + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - document.getElementById("captcha_img").src = home+'user/section/recovery/captcha?'+Math.random(); + document.getElementById("captcha_img").src = home+'user/section/recovery/captcha?'+Math.random(); - $('#captcha').val(''); - } + $('#captcha').val(''); + } - if(i == 's') - bootbox.dialog('

    Внимание

    '+val, - [{ - "label" : "Продолжить", - callback: function() - { - location.href="http://"+data['mail']; - } - }] - ); - }); - loading(0); - } + if(i == 's') + bootbox.dialog('

    Внимание

    '+val, + [{ + "label" : "Продолжить", + callback: function() + { + location.href="http://"+data['mail']; + } + }] + ); + }); + loading(0); + } }); $('#captcha')[0].onkeyup = function(){ diff --git a/template/js/sections/user/signup.js b/template/js/sections/user/signup.js index 6af5890..9cfd735 100644 --- a/template/js/sections/user/signup.js +++ b/template/js/sections/user/signup.js @@ -1,34 +1,34 @@ $('#signup').ajaxForm({ - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - { - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + { + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - document.getElementById("captcha_img").src = home+'user/section/signup/captcha?'+Math.random(); + document.getElementById("captcha_img").src = home+'user/section/signup/captcha?'+Math.random(); - $('#captcha').val(''); - } - if(i == 's') - bootbox.dialog('

    Внимание

    '+val, - [{ - "label" : "Продолжить", - callback: function() - { - location.href="http://"+data['mail']; - } - }] - ); - }); - loading(0); - } + $('#captcha').val(''); + } + if(i == 's') + bootbox.dialog('

    Внимание

    '+val, + [{ + "label" : "Продолжить", + callback: function() + { + location.href="http://"+data['mail']; + } + }] + ); + }); + loading(0); + } }); diff --git a/template/js/sections/web/amxbans.js b/template/js/sections/web/amxbans.js index d44f55d..d1f44cb 100644 --- a/template/js/sections/web/amxbans.js +++ b/template/js/sections/web/amxbans.js @@ -1,234 +1,234 @@ $('#install').ajaxForm({ - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); - if(i == 'i') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Перейти", - callback: function(){ - location.href=home+'servers/id/'+server+'/section/web/subsection/'+data['type']+'/action/manage'; - } - }] - ); + if(i == 'i') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Перейти", + callback: function(){ + location.href=home+'servers/id/'+server+'/section/web/subsection/'+data['type']+'/action/manage'; + } + }] + ); - if(i == 's') - location.href=home+'servers/id/'+server+'/section/web/subsection/amxbans/action/manage'; - }); + if(i == 's') + location.href=home+'servers/id/'+server+'/section/web/subsection/amxbans/action/manage'; + }); - loading(0) - } + loading(0) + } }); function passwd() { - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/web/subsection/amxbans/action/passwd/go', function(arr) - { - $.each(arr, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + $.getJSON(home+'servers/id/'+server+'/section/web/subsection/amxbans/action/passwd/go', function(arr) + { + $.each(arr, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 's') - location.reload(); - }); + if(i == 's') + location.reload(); + }); - loading(0) - }); + loading(0) + }); } function update() { - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/web/subsection/amxbans/action/update/go', function(arr) - { - $.each(arr, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + $.getJSON(home+'servers/id/'+server+'/section/web/subsection/amxbans/action/update/go', function(arr) + { + $.each(arr, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 's') - bootbox.dialog('

    Внимание

    Запрос на обновление отправлен.', - [{ - "label" : "Продолжить", - }] - ); - }); + if(i == 's') + bootbox.dialog('

    Внимание

    Запрос на обновление отправлен.', + [{ + "label" : "Продолжить", + }] + ); + }); - loading(0) - }); + loading(0) + }); } function delweb() { - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/web/subsection/amxbans/action/delete/go', function(arr) - { - $.each(arr, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + $.getJSON(home+'servers/id/'+server+'/section/web/subsection/amxbans/action/delete/go', function(arr) + { + $.each(arr, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 'i') - bootbox.dialog('

    Внимание

    '+val, - [{ - "label" : "Продолжить", - }] - ); + if(i == 'i') + bootbox.dialog('

    Внимание

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 's') - location.href=home+'servers/id/'+server+'/section/web'; - }); + if(i == 's') + location.href=home+'servers/id/'+server+'/section/web'; + }); - loading(0) - }); + loading(0) + }); } function connect() { - ser = $('#server').val(); + ser = $('#server').val(); - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/web/subsection/amxbans/action/connect/server/'+ser+'/go', function(arr) - { - $.each(arr, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + $.getJSON(home+'servers/id/'+server+'/section/web/subsection/amxbans/action/connect/server/'+ser+'/go', function(arr) + { + $.each(arr, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 'i') - bootbox.dialog('

    Внимание

    '+val, - [{ - "label" : "Установить", - 'class' : 'btn-success', - callback: function(){plugin_install(arr['pid'], false)} - },{ - "label" : "Отмена" - }] - ); + if(i == 'i') + bootbox.dialog('

    Внимание

    '+val, + [{ + "label" : "Установить", + 'class' : 'btn-success', + callback: function(){plugin_install(arr['pid'], false)} + },{ + "label" : "Отмена" + }] + ); - if(i == 'r') - bootbox.dialog('

    Внимание

    '+val, - [{ - "label" : "Установить", - 'class' : 'btn-error', - callback: function(){location.href=arr['url']} - },{ - "label" : "Отмена" - }] - ); + if(i == 'r') + bootbox.dialog('

    Внимание

    '+val, + [{ + "label" : "Установить", + 'class' : 'btn-error', + callback: function(){location.href=arr['url']} + },{ + "label" : "Отмена" + }] + ); - if(i == 's') - bootbox.dialog('

    Внимание

    Игровой сервер подключен к веб части.', - [{ - "label" : "Продолжить", - callback: function(){location.href=home+'servers/id/'+server} - }] - ); - }); + if(i == 's') + bootbox.dialog('

    Внимание

    Игровой сервер подключен к веб части.', + [{ + "label" : "Продолжить", + callback: function(){location.href=home+'servers/id/'+server} + }] + ); + }); - loading(0) - }); + loading(0) + }); } function plugin_install(id, next) { - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/plugins/subsection/install/plugin/'+id+'/go', function(arr) - { - $.each(arr, function(i, val) - { - if(i == 'e') - { - if(arr['pid'] !== undefined) - { - if(arr['required'] !== undefined) - bootbox.dialog('

    Ошибка

    '+val+'

    Родитель: '+arr['pname']+'

    ', - [{ - "label" : "Установить", - 'class' : 'btn-success', - callback: function(){plugin_install(arr['pid'], id)} - },{ - "label" : "Отмена" - }] - ); - else - bootbox.dialog('

    Ошибка

    '+val+'

    Плагин: '+arr['pname']+'

    ', - [{ - "label" : "Удалить", - 'class' : 'btn-error', - callback: function(){plugin_delete(arr['pid'], id)} - },{ - "label" : "Отмена" - }] - ); - }else - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + $.getJSON(home+'servers/id/'+server+'/section/plugins/subsection/install/plugin/'+id+'/go', function(arr) + { + $.each(arr, function(i, val) + { + if(i == 'e') + { + if(arr['pid'] !== undefined) + { + if(arr['required'] !== undefined) + bootbox.dialog('

    Ошибка

    '+val+'

    Родитель: '+arr['pname']+'

    ', + [{ + "label" : "Установить", + 'class' : 'btn-success', + callback: function(){plugin_install(arr['pid'], id)} + },{ + "label" : "Отмена" + }] + ); + else + bootbox.dialog('

    Ошибка

    '+val+'

    Плагин: '+arr['pname']+'

    ', + [{ + "label" : "Удалить", + 'class' : 'btn-error', + callback: function(){plugin_delete(arr['pid'], id)} + },{ + "label" : "Отмена" + }] + ); + }else + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - loading(0); - } + loading(0); + } - if(i == 's') - connect(); - }); - }); + if(i == 's') + connect(); + }); + }); } function plugin_delete(id, next) { - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/plugins/subsection/delete/plugin/'+id+'/go', function(arr) - { - $.each(arr, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + $.getJSON(home+'servers/id/'+server+'/section/plugins/subsection/delete/plugin/'+id+'/go', function(arr) + { + $.each(arr, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 's' && next) - plugin_install(next); - }); + if(i == 's' && next) + plugin_install(next); + }); - loading(0); - }); + loading(0); + }); } \ No newline at end of file diff --git a/template/js/sections/web/astats.js b/template/js/sections/web/astats.js index fa7ac7f..f2e5643 100644 --- a/template/js/sections/web/astats.js +++ b/template/js/sections/web/astats.js @@ -1,124 +1,124 @@ $('#install').ajaxForm({ - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); - if(i == 'i') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Перейти", - callback: function(){ - location.href=home+'servers/id/'+server+'/section/web/subsection/'+data['type']+'/action/manage'; - } - }] - ); + if(i == 'i') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Перейти", + callback: function(){ + location.href=home+'servers/id/'+server+'/section/web/subsection/'+data['type']+'/action/manage'; + } + }] + ); - if(i == 's') - location.href=home+'servers/id/'+server+'/section/web/subsection/astats/action/manage'; - }); + if(i == 's') + location.href=home+'servers/id/'+server+'/section/web/subsection/astats/action/manage'; + }); - loading(0) - } + loading(0) + } }); $('#form').ajaxForm({ - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); - if(i == 'r') - bootbox.dialog('

    Внимание

    '+val, - [{ - "label" : "Продолжить", - callback: function(){location.href=data['url']} - },{ - "label" : "Отмена" - }] - ); + if(i == 'r') + bootbox.dialog('

    Внимание

    '+val, + [{ + "label" : "Продолжить", + callback: function(){location.href=data['url']} + },{ + "label" : "Отмена" + }] + ); - if(i == 's') - bootbox.dialog('

    Внимание

    Выбранные игровые сервера подключены к веб части.', - [{ - "label" : "Продолжить" - }] - ); - }); + if(i == 's') + bootbox.dialog('

    Внимание

    Выбранные игровые сервера подключены к веб части.', + [{ + "label" : "Продолжить" + }] + ); + }); - loading(0) - } + loading(0) + } }); function update() { - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/web/subsection/astats/action/update/go', function(arr) - { - $.each(arr, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + $.getJSON(home+'servers/id/'+server+'/section/web/subsection/astats/action/update/go', function(arr) + { + $.each(arr, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 's') - bootbox.dialog('

    Внимание

    Запрос на обновление отправлен.', - [{ - "label" : "Продолжить", - }] - ); - }); + if(i == 's') + bootbox.dialog('

    Внимание

    Запрос на обновление отправлен.', + [{ + "label" : "Продолжить", + }] + ); + }); - loading(0) - }); + loading(0) + }); } function delweb() { - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/web/subsection/astats/action/delete/go', function(arr) - { - $.each(arr, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + $.getJSON(home+'servers/id/'+server+'/section/web/subsection/astats/action/delete/go', function(arr) + { + $.each(arr, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 'i') - bootbox.dialog('

    Внимание

    '+val, - [{ - "label" : "Продолжить", - }] - ); + if(i == 'i') + bootbox.dialog('

    Внимание

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 's') - location.href=home+'servers/id/'+server+'/section/web'; - }); + if(i == 's') + location.href=home+'servers/id/'+server+'/section/web'; + }); - loading(0) - }); + loading(0) + }); } \ No newline at end of file diff --git a/template/js/sections/web/csbans.js b/template/js/sections/web/csbans.js index cc9f486..cff4b69 100644 --- a/template/js/sections/web/csbans.js +++ b/template/js/sections/web/csbans.js @@ -1,234 +1,234 @@ $('#install').ajaxForm({ - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); - if(i == 'i') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Перейти", - callback: function(){ - location.href=home+'servers/id/'+server+'/section/web/subsection/'+data['type']+'/action/manage'; - } - }] - ); + if(i == 'i') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Перейти", + callback: function(){ + location.href=home+'servers/id/'+server+'/section/web/subsection/'+data['type']+'/action/manage'; + } + }] + ); - if(i == 's') - location.href=home+'servers/id/'+server+'/section/web/subsection/csbans/action/manage'; - }); + if(i == 's') + location.href=home+'servers/id/'+server+'/section/web/subsection/csbans/action/manage'; + }); - loading(0) - } + loading(0) + } }); function passwd() { - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/web/subsection/csbans/action/passwd/go', function(arr) - { - $.each(arr, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + $.getJSON(home+'servers/id/'+server+'/section/web/subsection/csbans/action/passwd/go', function(arr) + { + $.each(arr, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 's') - location.reload(); - }); + if(i == 's') + location.reload(); + }); - loading(0) - }); + loading(0) + }); } function update() { - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/web/subsection/csbans/action/update/go', function(arr) - { - $.each(arr, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + $.getJSON(home+'servers/id/'+server+'/section/web/subsection/csbans/action/update/go', function(arr) + { + $.each(arr, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 's') - bootbox.dialog('

    Внимание

    Запрос на обновление отправлен.', - [{ - "label" : "Продолжить", - }] - ); - }); + if(i == 's') + bootbox.dialog('

    Внимание

    Запрос на обновление отправлен.', + [{ + "label" : "Продолжить", + }] + ); + }); - loading(0) - }); + loading(0) + }); } function delweb() { - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/web/subsection/csbans/action/delete/go', function(arr) - { - $.each(arr, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + $.getJSON(home+'servers/id/'+server+'/section/web/subsection/csbans/action/delete/go', function(arr) + { + $.each(arr, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 'i') - bootbox.dialog('

    Внимание

    '+val, - [{ - "label" : "Продолжить", - }] - ); + if(i == 'i') + bootbox.dialog('

    Внимание

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 's') - location.href=home+'servers/id/'+server+'/section/web'; - }); + if(i == 's') + location.href=home+'servers/id/'+server+'/section/web'; + }); - loading(0) - }); + loading(0) + }); } function connect() { - ser = $('#server').val(); + ser = $('#server').val(); - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/web/subsection/csbans/action/connect/server/'+ser+'/go', function(arr) - { - $.each(arr, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + $.getJSON(home+'servers/id/'+server+'/section/web/subsection/csbans/action/connect/server/'+ser+'/go', function(arr) + { + $.each(arr, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 'i') - bootbox.dialog('

    Внимание

    '+val, - [{ - "label" : "Установить", - 'class' : 'btn-success', - callback: function(){plugin_install(arr['pid'], false)} - },{ - "label" : "Отмена" - }] - ); + if(i == 'i') + bootbox.dialog('

    Внимание

    '+val, + [{ + "label" : "Установить", + 'class' : 'btn-success', + callback: function(){plugin_install(arr['pid'], false)} + },{ + "label" : "Отмена" + }] + ); - if(i == 'r') - bootbox.dialog('

    Внимание

    '+val, - [{ - "label" : "Установить", - 'class' : 'btn-error', - callback: function(){location.href=arr['url']} - },{ - "label" : "Отмена" - }] - ); + if(i == 'r') + bootbox.dialog('

    Внимание

    '+val, + [{ + "label" : "Установить", + 'class' : 'btn-error', + callback: function(){location.href=arr['url']} + },{ + "label" : "Отмена" + }] + ); - if(i == 's') - bootbox.dialog('

    Внимание

    Игровой сервер подключен к веб части.', - [{ - "label" : "Продолжить", - callback: function(){location.href=home+'servers/id/'+server} - }] - ); - }); + if(i == 's') + bootbox.dialog('

    Внимание

    Игровой сервер подключен к веб части.', + [{ + "label" : "Продолжить", + callback: function(){location.href=home+'servers/id/'+server} + }] + ); + }); - loading(0) - }); + loading(0) + }); } function plugin_install(id, next) { - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/plugins/subsection/install/plugin/'+id+'/go', function(arr) - { - $.each(arr, function(i, val) - { - if(i == 'e') - { - if(arr['pid'] !== undefined) - { - if(arr['required'] !== undefined) - bootbox.dialog('

    Ошибка

    '+val+'

    Родитель: '+arr['pname']+'

    ', - [{ - "label" : "Установить", - 'class' : 'btn-success', - callback: function(){plugin_install(arr['pid'], id)} - },{ - "label" : "Отмена" - }] - ); - else - bootbox.dialog('

    Ошибка

    '+val+'

    Плагин: '+arr['pname']+'

    ', - [{ - "label" : "Удалить", - 'class' : 'btn-error', - callback: function(){plugin_delete(arr['pid'], id)} - },{ - "label" : "Отмена" - }] - ); - }else - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + $.getJSON(home+'servers/id/'+server+'/section/plugins/subsection/install/plugin/'+id+'/go', function(arr) + { + $.each(arr, function(i, val) + { + if(i == 'e') + { + if(arr['pid'] !== undefined) + { + if(arr['required'] !== undefined) + bootbox.dialog('

    Ошибка

    '+val+'

    Родитель: '+arr['pname']+'

    ', + [{ + "label" : "Установить", + 'class' : 'btn-success', + callback: function(){plugin_install(arr['pid'], id)} + },{ + "label" : "Отмена" + }] + ); + else + bootbox.dialog('

    Ошибка

    '+val+'

    Плагин: '+arr['pname']+'

    ', + [{ + "label" : "Удалить", + 'class' : 'btn-error', + callback: function(){plugin_delete(arr['pid'], id)} + },{ + "label" : "Отмена" + }] + ); + }else + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - loading(0); - } + loading(0); + } - if(i == 's') - connect(); - }); - }); + if(i == 's') + connect(); + }); + }); } function plugin_delete(id, next) { - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/plugins/subsection/delete/plugin/'+id+'/go', function(arr) - { - $.each(arr, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + $.getJSON(home+'servers/id/'+server+'/section/plugins/subsection/delete/plugin/'+id+'/go', function(arr) + { + $.each(arr, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 's' && next) - plugin_install(next); - }); + if(i == 's' && next) + plugin_install(next); + }); - loading(0); - }); + loading(0); + }); } \ No newline at end of file diff --git a/template/js/sections/web/csstats.js b/template/js/sections/web/csstats.js index d39d6a5..ebc80d8 100644 --- a/template/js/sections/web/csstats.js +++ b/template/js/sections/web/csstats.js @@ -1,244 +1,244 @@ $('#install').ajaxForm({ - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); - if(i == 'i') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Перейти", - callback: function(){ - location.href=home+'servers/id/'+server+'/section/web/subsection/'+data['type']+'/action/manage'; - } - }] - ); + if(i == 'i') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Перейти", + callback: function(){ + location.href=home+'servers/id/'+server+'/section/web/subsection/'+data['type']+'/action/manage'; + } + }] + ); - if(i == 's') - location.href=home+'servers/id/'+server+'/section/web/subsection/csstats/action/manage'; - }); + if(i == 's') + location.href=home+'servers/id/'+server+'/section/web/subsection/csstats/action/manage'; + }); - loading(0) - } + loading(0) + } }); function passwd() { - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/web/subsection/csstats/action/passwd/go', function(arr) - { - $.each(arr, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + $.getJSON(home+'servers/id/'+server+'/section/web/subsection/csstats/action/passwd/go', function(arr) + { + $.each(arr, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 's') - location.reload(); - }); + if(i == 's') + location.reload(); + }); - loading(0) - }); + loading(0) + }); } function update() { - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/web/subsection/csstats/action/update/go', function(arr) - { - $.each(arr, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + $.getJSON(home+'servers/id/'+server+'/section/web/subsection/csstats/action/update/go', function(arr) + { + $.each(arr, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 's') - bootbox.dialog('

    Внимание

    Запрос на обновление отправлен.', - [{ - "label" : "Продолжить", - }] - ); - }); + if(i == 's') + bootbox.dialog('

    Внимание

    Запрос на обновление отправлен.', + [{ + "label" : "Продолжить", + }] + ); + }); - loading(0) - }); + loading(0) + }); } function delweb() { - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/web/subsection/csstats/action/delete/go', function(arr) - { - $.each(arr, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + $.getJSON(home+'servers/id/'+server+'/section/web/subsection/csstats/action/delete/go', function(arr) + { + $.each(arr, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 'i') - bootbox.dialog('

    Внимание

    '+val, - [{ - "label" : "Продолжить", - }] - ); + if(i == 'i') + bootbox.dialog('

    Внимание

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 's') - location.href=home+'servers/id/'+server+'/section/web'; - }); + if(i == 's') + location.href=home+'servers/id/'+server+'/section/web'; + }); - loading(0) - }); + loading(0) + }); } function connect(key) { - bootbox.dialog('
    ', - [{ - "label" : "Подключить", - 'class' : 'btn-success', - callback: function(){ - ser = $('#server').val(); + bootbox.dialog('
    ', + [{ + "label" : "Подключить", + 'class' : 'btn-success', + callback: function(){ + ser = $('#server').val(); - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/web/subsection/csstats/action/connect/server/'+ser+'/key/'+$('#key').val()+'/go', function(arr) - { - $.each(arr, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + $.getJSON(home+'servers/id/'+server+'/section/web/subsection/csstats/action/connect/server/'+ser+'/key/'+$('#key').val()+'/go', function(arr) + { + $.each(arr, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 'i') - bootbox.dialog('

    Внимание

    '+val, - [{ - "label" : "Установить", - 'class' : 'btn-success', - callback: function(){plugin_install(arr['pid'], false)} - },{ - "label" : "Отмена" - }] - ); + if(i == 'i') + bootbox.dialog('

    Внимание

    '+val, + [{ + "label" : "Установить", + 'class' : 'btn-success', + callback: function(){plugin_install(arr['pid'], false)} + },{ + "label" : "Отмена" + }] + ); - if(i == 'r') - bootbox.dialog('

    Внимание

    '+val, - [{ - "label" : "Установить", - 'class' : 'btn-error', - callback: function(){location.href=arr['url']} - },{ - "label" : "Отмена" - }] - ); + if(i == 'r') + bootbox.dialog('

    Внимание

    '+val, + [{ + "label" : "Установить", + 'class' : 'btn-error', + callback: function(){location.href=arr['url']} + },{ + "label" : "Отмена" + }] + ); - if(i == 's') - bootbox.dialog('

    Внимание

    Игровой сервер подключен к веб части.', - [{ - "label" : "Продолжить", - callback: function(){location.href=home+'servers/id/'+server} - }] - ); - }); + if(i == 's') + bootbox.dialog('

    Внимание

    Игровой сервер подключен к веб части.', + [{ + "label" : "Продолжить", + callback: function(){location.href=home+'servers/id/'+server} + }] + ); + }); - loading(0) - }); - } - },{ - "label" : "Отмена" - }] - ); + loading(0) + }); + } + },{ + "label" : "Отмена" + }] + ); } function plugin_install(id, next) { - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/plugins/subsection/install/plugin/'+id+'/go', function(arr) - { - $.each(arr, function(i, val) - { - if(i == 'e') - { - if(arr['pid'] !== undefined) - { - if(arr['required'] !== undefined) - bootbox.dialog('

    Ошибка

    '+val+'

    Родитель: '+arr['pname']+'

    ', - [{ - "label" : "Установить", - 'class' : 'btn-success', - callback: function(){plugin_install(arr['pid'], id)} - },{ - "label" : "Отмена" - }] - ); - else - bootbox.dialog('

    Ошибка

    '+val+'

    Плагин: '+arr['pname']+'

    ', - [{ - "label" : "Удалить", - 'class' : 'btn-error', - callback: function(){plugin_delete(arr['pid'], id)} - },{ - "label" : "Отмена" - }] - ); - }else - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + $.getJSON(home+'servers/id/'+server+'/section/plugins/subsection/install/plugin/'+id+'/go', function(arr) + { + $.each(arr, function(i, val) + { + if(i == 'e') + { + if(arr['pid'] !== undefined) + { + if(arr['required'] !== undefined) + bootbox.dialog('

    Ошибка

    '+val+'

    Родитель: '+arr['pname']+'

    ', + [{ + "label" : "Установить", + 'class' : 'btn-success', + callback: function(){plugin_install(arr['pid'], id)} + },{ + "label" : "Отмена" + }] + ); + else + bootbox.dialog('

    Ошибка

    '+val+'

    Плагин: '+arr['pname']+'

    ', + [{ + "label" : "Удалить", + 'class' : 'btn-error', + callback: function(){plugin_delete(arr['pid'], id)} + },{ + "label" : "Отмена" + }] + ); + }else + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - loading(0); - } + loading(0); + } - if(i == 's') - connect(); - }); - }); + if(i == 's') + connect(); + }); + }); } function plugin_delete(id, next) { - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/plugins/subsection/delete/plugin/'+id+'/go', function(arr) - { - $.each(arr, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + $.getJSON(home+'servers/id/'+server+'/section/plugins/subsection/delete/plugin/'+id+'/go', function(arr) + { + $.each(arr, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 's' && next) - plugin_install(next); - }); + if(i == 's' && next) + plugin_install(next); + }); - loading(0); - }); + loading(0); + }); } \ No newline at end of file diff --git a/template/js/sections/web/hosting.js b/template/js/sections/web/hosting.js index 234d6b6..133d069 100644 --- a/template/js/sections/web/hosting.js +++ b/template/js/sections/web/hosting.js @@ -1,84 +1,84 @@ $('#install').ajaxForm({ - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); - if(i == 'i') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Перейти", - callback: function(){ - location.href=home+'servers/id/'+server+'/section/web/subsection/'+data['type']+'/action/manage'; - } - }] - ); + if(i == 'i') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Перейти", + callback: function(){ + location.href=home+'servers/id/'+server+'/section/web/subsection/'+data['type']+'/action/manage'; + } + }] + ); - if(i == 's') - location.href=home+'servers/id/'+server+'/section/web/subsection/hosting/action/manage'; - }); + if(i == 's') + location.href=home+'servers/id/'+server+'/section/web/subsection/hosting/action/manage'; + }); - loading(0) - } + loading(0) + } }); function passwd() { - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/web/subsection/hosting/action/passwd/go', function(arr) - { - $.each(arr, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + $.getJSON(home+'servers/id/'+server+'/section/web/subsection/hosting/action/passwd/go', function(arr) + { + $.each(arr, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 's') - location.reload(); - }); + if(i == 's') + location.reload(); + }); - loading(0) - }); + loading(0) + }); } function delweb() { - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/web/subsection/hosting/action/delete/go', function(arr) - { - $.each(arr, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + $.getJSON(home+'servers/id/'+server+'/section/web/subsection/hosting/action/delete/go', function(arr) + { + $.each(arr, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 'i') - bootbox.dialog('

    Внимание

    '+val, - [{ - "label" : "Продолжить", - }] - ); + if(i == 'i') + bootbox.dialog('

    Внимание

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 's') - location.href=home+'servers/id/'+server+'/section/web'; - }); + if(i == 's') + location.href=home+'servers/id/'+server+'/section/web'; + }); - loading(0) - }); + loading(0) + }); } \ No newline at end of file diff --git a/template/js/sections/web/mysql.js b/template/js/sections/web/mysql.js index 688f395..9f33fd9 100644 --- a/template/js/sections/web/mysql.js +++ b/template/js/sections/web/mysql.js @@ -1,84 +1,84 @@ $('#install').ajaxForm({ - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); - if(i == 'i') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Перейти", - callback: function(){ - location.href=home+'servers/id/'+server+'/section/web/subsection/'+data['type']+'/action/manage'; - } - }] - ); + if(i == 'i') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Перейти", + callback: function(){ + location.href=home+'servers/id/'+server+'/section/web/subsection/'+data['type']+'/action/manage'; + } + }] + ); - if(i == 's') - location.href=home+'servers/id/'+server+'/section/web/subsection/mysql/action/manage'; - }); + if(i == 's') + location.href=home+'servers/id/'+server+'/section/web/subsection/mysql/action/manage'; + }); - loading(0) - } + loading(0) + } }); function passwd() { - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/web/subsection/mysql/action/passwd/go', function(arr) - { - $.each(arr, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + $.getJSON(home+'servers/id/'+server+'/section/web/subsection/mysql/action/passwd/go', function(arr) + { + $.each(arr, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 's') - location.reload(); - }); + if(i == 's') + location.reload(); + }); - loading(0) - }); + loading(0) + }); } function delweb() { - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/web/subsection/mysql/action/delete/go', function(arr) - { - $.each(arr, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + $.getJSON(home+'servers/id/'+server+'/section/web/subsection/mysql/action/delete/go', function(arr) + { + $.each(arr, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 'i') - bootbox.dialog('

    Внимание

    '+val, - [{ - "label" : "Продолжить", - }] - ); + if(i == 'i') + bootbox.dialog('

    Внимание

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 's') - location.href=home+'servers/id/'+server+'/section/web'; - }); + if(i == 's') + location.href=home+'servers/id/'+server+'/section/web'; + }); - loading(0) - }); + loading(0) + }); } \ No newline at end of file diff --git a/template/js/sections/web/psychostats.js b/template/js/sections/web/psychostats.js index 5502f39..b1d6314 100644 --- a/template/js/sections/web/psychostats.js +++ b/template/js/sections/web/psychostats.js @@ -1,150 +1,150 @@ $('#install').ajaxForm({ - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); - if(i == 'i') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Перейти", - callback: function(){ - location.href=home+'servers/id/'+server+'/section/web/subsection/'+data['type']+'/action/manage'; - } - }] - ); + if(i == 'i') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Перейти", + callback: function(){ + location.href=home+'servers/id/'+server+'/section/web/subsection/'+data['type']+'/action/manage'; + } + }] + ); - if(i == 's') - location.href=home+'servers/id/'+server+'/section/web/subsection/psychostats/action/manage'; - }); + if(i == 's') + location.href=home+'servers/id/'+server+'/section/web/subsection/psychostats/action/manage'; + }); - loading(0) - } + loading(0) + } }); function passwd() { - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/web/subsection/psychostats/action/passwd/go', function(arr) - { - $.each(arr, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + $.getJSON(home+'servers/id/'+server+'/section/web/subsection/psychostats/action/passwd/go', function(arr) + { + $.each(arr, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 's') - location.reload(); - }); + if(i == 's') + location.reload(); + }); - loading(0) - }); + loading(0) + }); } function update() { - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/web/subsection/psychostats/action/update/go', function(arr) - { - $.each(arr, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + $.getJSON(home+'servers/id/'+server+'/section/web/subsection/psychostats/action/update/go', function(arr) + { + $.each(arr, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 's') - bootbox.dialog('

    Внимание

    Запрос на обновление отправлен.', - [{ - "label" : "Продолжить", - }] - ); - }); + if(i == 's') + bootbox.dialog('

    Внимание

    Запрос на обновление отправлен.', + [{ + "label" : "Продолжить", + }] + ); + }); - loading(0) - }); + loading(0) + }); } function delweb() { - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/web/subsection/psychostats/action/delete/go', function(arr) - { - $.each(arr, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + $.getJSON(home+'servers/id/'+server+'/section/web/subsection/psychostats/action/delete/go', function(arr) + { + $.each(arr, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 'i') - bootbox.dialog('

    Внимание

    '+val, - [{ - "label" : "Продолжить", - }] - ); + if(i == 'i') + bootbox.dialog('

    Внимание

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 's') - location.href=home+'servers/id/'+server+'/section/web'; - }); + if(i == 's') + location.href=home+'servers/id/'+server+'/section/web'; + }); - loading(0) - }); + loading(0) + }); } function connect() { - ser = $('#server').val(); + ser = $('#server').val(); - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/web/subsection/psychostats/action/connect/server/'+ser+'/go', function(arr) - { - $.each(arr, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + $.getJSON(home+'servers/id/'+server+'/section/web/subsection/psychostats/action/connect/server/'+ser+'/go', function(arr) + { + $.each(arr, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 'r') - bootbox.dialog('

    Внимание

    '+val, - [{ - "label" : "Продолжить", - callback: function(){location.href=arr['url']} - },{ - "label" : "Отмена" - }] - ); + if(i == 'r') + bootbox.dialog('

    Внимание

    '+val, + [{ + "label" : "Продолжить", + callback: function(){location.href=arr['url']} + },{ + "label" : "Отмена" + }] + ); - if(i == 's') - bootbox.dialog('

    Внимание

    Игровой сервер подключен к веб части.', - [{ - "label" : "Продолжить" - }] - ); - }); + if(i == 's') + bootbox.dialog('

    Внимание

    Игровой сервер подключен к веб части.', + [{ + "label" : "Продолжить" + }] + ); + }); - loading(0) - }); + loading(0) + }); } \ No newline at end of file diff --git a/template/js/sections/web/rankme.js b/template/js/sections/web/rankme.js index d16cea5..5a78ed1 100644 --- a/template/js/sections/web/rankme.js +++ b/template/js/sections/web/rankme.js @@ -1,234 +1,234 @@ $('#install').ajaxForm({ - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); - if(i == 'i') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Перейти", - callback: function(){ - location.href=home+'servers/id/'+server+'/section/web/subsection/'+data['type']+'/action/manage'; - } - }] - ); + if(i == 'i') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Перейти", + callback: function(){ + location.href=home+'servers/id/'+server+'/section/web/subsection/'+data['type']+'/action/manage'; + } + }] + ); - if(i == 's') - location.href=home+'servers/id/'+server+'/section/web/subsection/rankme/action/manage'; - }); + if(i == 's') + location.href=home+'servers/id/'+server+'/section/web/subsection/rankme/action/manage'; + }); - loading(0) - } + loading(0) + } }); function passwd() { - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/web/subsection/rankme/action/passwd/go', function(arr) - { - $.each(arr, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + $.getJSON(home+'servers/id/'+server+'/section/web/subsection/rankme/action/passwd/go', function(arr) + { + $.each(arr, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 's') - location.reload(); - }); + if(i == 's') + location.reload(); + }); - loading(0) - }); + loading(0) + }); } function update() { - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/web/subsection/rankme/action/update/go', function(arr) - { - $.each(arr, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + $.getJSON(home+'servers/id/'+server+'/section/web/subsection/rankme/action/update/go', function(arr) + { + $.each(arr, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 's') - bootbox.dialog('

    Внимание

    Запрос на обновление отправлен.', - [{ - "label" : "Продолжить", - }] - ); - }); + if(i == 's') + bootbox.dialog('

    Внимание

    Запрос на обновление отправлен.', + [{ + "label" : "Продолжить", + }] + ); + }); - loading(0) - }); + loading(0) + }); } function delweb() { - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/web/subsection/rankme/action/delete/go', function(arr) - { - $.each(arr, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + $.getJSON(home+'servers/id/'+server+'/section/web/subsection/rankme/action/delete/go', function(arr) + { + $.each(arr, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 'i') - bootbox.dialog('

    Внимание

    '+val, - [{ - "label" : "Продолжить", - }] - ); + if(i == 'i') + bootbox.dialog('

    Внимание

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 's') - location.href=home+'servers/id/'+server+'/section/web'; - }); + if(i == 's') + location.href=home+'servers/id/'+server+'/section/web'; + }); - loading(0) - }); + loading(0) + }); } function connect() { - ser = $('#server').val(); + ser = $('#server').val(); - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/web/subsection/rankme/action/connect/server/'+ser+'/go', function(arr) - { - $.each(arr, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + $.getJSON(home+'servers/id/'+server+'/section/web/subsection/rankme/action/connect/server/'+ser+'/go', function(arr) + { + $.each(arr, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 'i') - bootbox.dialog('

    Внимание

    '+val, - [{ - "label" : "Установить", - 'class' : 'btn-success', - callback: function(){plugin_install(arr['pid'], false)} - },{ - "label" : "Отмена" - }] - ); + if(i == 'i') + bootbox.dialog('

    Внимание

    '+val, + [{ + "label" : "Установить", + 'class' : 'btn-success', + callback: function(){plugin_install(arr['pid'], false)} + },{ + "label" : "Отмена" + }] + ); - if(i == 'r') - bootbox.dialog('

    Внимание

    '+val, - [{ - "label" : "Установить", - 'class' : 'btn-error', - callback: function(){location.href=arr['url']} - },{ - "label" : "Отмена" - }] - ); + if(i == 'r') + bootbox.dialog('

    Внимание

    '+val, + [{ + "label" : "Установить", + 'class' : 'btn-error', + callback: function(){location.href=arr['url']} + },{ + "label" : "Отмена" + }] + ); - if(i == 's') - bootbox.dialog('

    Внимание

    Игровой сервер подключен к веб части.', - [{ - "label" : "Продолжить", - callback: function(){location.href=home+'servers/id/'+server} - }] - ); - }); + if(i == 's') + bootbox.dialog('

    Внимание

    Игровой сервер подключен к веб части.', + [{ + "label" : "Продолжить", + callback: function(){location.href=home+'servers/id/'+server} + }] + ); + }); - loading(0) - }); + loading(0) + }); } function plugin_install(id, next) { - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/plugins/subsection/install/plugin/'+id+'/go', function(arr) - { - $.each(arr, function(i, val) - { - if(i == 'e') - { - if(arr['pid'] !== undefined) - { - if(arr['required'] !== undefined) - bootbox.dialog('

    Ошибка

    '+val+'

    Родитель: '+arr['pname']+'

    ', - [{ - "label" : "Установить", - 'class' : 'btn-success', - callback: function(){plugin_install(arr['pid'], id)} - },{ - "label" : "Отмена" - }] - ); - else - bootbox.dialog('

    Ошибка

    '+val+'

    Плагин: '+arr['pname']+'

    ', - [{ - "label" : "Удалить", - 'class' : 'btn-error', - callback: function(){plugin_delete(arr['pid'], id)} - },{ - "label" : "Отмена" - }] - ); - }else - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + $.getJSON(home+'servers/id/'+server+'/section/plugins/subsection/install/plugin/'+id+'/go', function(arr) + { + $.each(arr, function(i, val) + { + if(i == 'e') + { + if(arr['pid'] !== undefined) + { + if(arr['required'] !== undefined) + bootbox.dialog('

    Ошибка

    '+val+'

    Родитель: '+arr['pname']+'

    ', + [{ + "label" : "Установить", + 'class' : 'btn-success', + callback: function(){plugin_install(arr['pid'], id)} + },{ + "label" : "Отмена" + }] + ); + else + bootbox.dialog('

    Ошибка

    '+val+'

    Плагин: '+arr['pname']+'

    ', + [{ + "label" : "Удалить", + 'class' : 'btn-error', + callback: function(){plugin_delete(arr['pid'], id)} + },{ + "label" : "Отмена" + }] + ); + }else + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - loading(0); - } + loading(0); + } - if(i == 's') - connect(); - }); - }); + if(i == 's') + connect(); + }); + }); } function plugin_delete(id, next) { - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/plugins/subsection/delete/plugin/'+id+'/go', function(arr) - { - $.each(arr, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + $.getJSON(home+'servers/id/'+server+'/section/plugins/subsection/delete/plugin/'+id+'/go', function(arr) + { + $.each(arr, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 's' && next) - plugin_install(next); - }); + if(i == 's' && next) + plugin_install(next); + }); - loading(0); - }); + loading(0); + }); } \ No newline at end of file diff --git a/template/js/sections/web/sourcebans.js b/template/js/sections/web/sourcebans.js index 4342132..f0d1259 100644 --- a/template/js/sections/web/sourcebans.js +++ b/template/js/sections/web/sourcebans.js @@ -1,234 +1,234 @@ $('#install').ajaxForm({ - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); - if(i == 'i') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Перейти", - callback: function(){ - location.href=home+'servers/id/'+server+'/section/web/subsection/'+data['type']+'/action/manage'; - } - }] - ); + if(i == 'i') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Перейти", + callback: function(){ + location.href=home+'servers/id/'+server+'/section/web/subsection/'+data['type']+'/action/manage'; + } + }] + ); - if(i == 's') - location.href=home+'servers/id/'+server+'/section/web/subsection/sourcebans/action/manage'; - }); + if(i == 's') + location.href=home+'servers/id/'+server+'/section/web/subsection/sourcebans/action/manage'; + }); - loading(0) - } + loading(0) + } }); function passwd() { - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/web/subsection/sourcebans/action/passwd/go', function(arr) - { - $.each(arr, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + $.getJSON(home+'servers/id/'+server+'/section/web/subsection/sourcebans/action/passwd/go', function(arr) + { + $.each(arr, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 's') - location.reload(); - }); + if(i == 's') + location.reload(); + }); - loading(0) - }); + loading(0) + }); } function update() { - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/web/subsection/sourcebans/action/update/go', function(arr) - { - $.each(arr, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + $.getJSON(home+'servers/id/'+server+'/section/web/subsection/sourcebans/action/update/go', function(arr) + { + $.each(arr, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 's') - bootbox.dialog('

    Внимание

    Запрос на обновление отправлен.', - [{ - "label" : "Продолжить", - }] - ); - }); + if(i == 's') + bootbox.dialog('

    Внимание

    Запрос на обновление отправлен.', + [{ + "label" : "Продолжить", + }] + ); + }); - loading(0) - }); + loading(0) + }); } function delweb() { - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/web/subsection/sourcebans/action/delete/go', function(arr) - { - $.each(arr, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + $.getJSON(home+'servers/id/'+server+'/section/web/subsection/sourcebans/action/delete/go', function(arr) + { + $.each(arr, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 'i') - bootbox.dialog('

    Внимание

    '+val, - [{ - "label" : "Продолжить", - }] - ); + if(i == 'i') + bootbox.dialog('

    Внимание

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 's') - location.href=home+'servers/id/'+server+'/section/web'; - }); + if(i == 's') + location.href=home+'servers/id/'+server+'/section/web'; + }); - loading(0) - }); + loading(0) + }); } function connect() { - ser = $('#server').val(); + ser = $('#server').val(); - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/web/subsection/sourcebans/action/connect/server/'+ser+'/go', function(arr) - { - $.each(arr, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + $.getJSON(home+'servers/id/'+server+'/section/web/subsection/sourcebans/action/connect/server/'+ser+'/go', function(arr) + { + $.each(arr, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 'i') - bootbox.dialog('

    Внимание

    '+val, - [{ - "label" : "Установить", - 'class' : 'btn-success', - callback: function(){plugin_install(arr['pid'], false)} - },{ - "label" : "Отмена" - }] - ); + if(i == 'i') + bootbox.dialog('

    Внимание

    '+val, + [{ + "label" : "Установить", + 'class' : 'btn-success', + callback: function(){plugin_install(arr['pid'], false)} + },{ + "label" : "Отмена" + }] + ); - if(i == 'r') - bootbox.dialog('

    Внимание

    '+val, - [{ - "label" : "Установить", - 'class' : 'btn-error', - callback: function(){location.href=arr['url']} - },{ - "label" : "Отмена" - }] - ); + if(i == 'r') + bootbox.dialog('

    Внимание

    '+val, + [{ + "label" : "Установить", + 'class' : 'btn-error', + callback: function(){location.href=arr['url']} + },{ + "label" : "Отмена" + }] + ); - if(i == 's') - bootbox.dialog('

    Внимание

    Игровой сервер подключен к веб части.', - [{ - "label" : "Продолжить", - callback: function(){location.href=home+'servers/id/'+server} - }] - ); - }); + if(i == 's') + bootbox.dialog('

    Внимание

    Игровой сервер подключен к веб части.', + [{ + "label" : "Продолжить", + callback: function(){location.href=home+'servers/id/'+server} + }] + ); + }); - loading(0) - }); + loading(0) + }); } function plugin_install(id, next) { - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/plugins/subsection/install/plugin/'+id+'/go', function(arr) - { - $.each(arr, function(i, val) - { - if(i == 'e') - { - if(arr['pid'] !== undefined) - { - if(arr['required'] !== undefined) - bootbox.dialog('

    Ошибка

    '+val+'

    Родитель: '+arr['pname']+'

    ', - [{ - "label" : "Установить", - 'class' : 'btn-success', - callback: function(){plugin_install(arr['pid'], id)} - },{ - "label" : "Отмена" - }] - ); - else - bootbox.dialog('

    Ошибка

    '+val+'

    Плагин: '+arr['pname']+'

    ', - [{ - "label" : "Удалить", - 'class' : 'btn-error', - callback: function(){plugin_delete(arr['pid'], id)} - },{ - "label" : "Отмена" - }] - ); - }else - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + $.getJSON(home+'servers/id/'+server+'/section/plugins/subsection/install/plugin/'+id+'/go', function(arr) + { + $.each(arr, function(i, val) + { + if(i == 'e') + { + if(arr['pid'] !== undefined) + { + if(arr['required'] !== undefined) + bootbox.dialog('

    Ошибка

    '+val+'

    Родитель: '+arr['pname']+'

    ', + [{ + "label" : "Установить", + 'class' : 'btn-success', + callback: function(){plugin_install(arr['pid'], id)} + },{ + "label" : "Отмена" + }] + ); + else + bootbox.dialog('

    Ошибка

    '+val+'

    Плагин: '+arr['pname']+'

    ', + [{ + "label" : "Удалить", + 'class' : 'btn-error', + callback: function(){plugin_delete(arr['pid'], id)} + },{ + "label" : "Отмена" + }] + ); + }else + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - loading(0); - } + loading(0); + } - if(i == 's') - connect(); - }); - }); + if(i == 's') + connect(); + }); + }); } function plugin_delete(id, next) { - loading(1); + loading(1); - $.getJSON(home+'servers/id/'+server+'/section/plugins/subsection/delete/plugin/'+id+'/go', function(arr) - { - $.each(arr, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "Продолжить", - }] - ); + $.getJSON(home+'servers/id/'+server+'/section/plugins/subsection/delete/plugin/'+id+'/go', function(arr) + { + $.each(arr, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "Продолжить", + }] + ); - if(i == 's' && next) - plugin_install(next); - }); + if(i == 's' && next) + plugin_install(next); + }); - loading(0); - }); + loading(0); + }); } \ No newline at end of file diff --git a/template/js/servers.js b/template/js/servers.js index f01025a..e1cd52c 100644 --- a/template/js/servers.js +++ b/template/js/servers.js @@ -1,302 +1,302 @@ // Запуск сервера function server_start(id) { - wait[id] = true; + wait[id] = true; - loading(1); + loading(1); - $('#status_'+id).html('Выполняется...'); + $('#status_'+id).html('Выполняется...'); - $.getJSON(home+'servers/section/action/id/'+id+'/action/start', - function(data) - { - wait[id] = false; + $.getJSON(home+'servers/section/action/id/'+id+'/action/start', + function(data) + { + wait[id] = false; - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); - update_info(id); - update_status(id); + update_info(id); + update_status(id); - loading(0) - }); - }); + loading(0) + }); + }); } // Перезапуск сервера function server_restart(id) { - wait[id] = true; + wait[id] = true; - loading(1); + loading(1); - $('#status_'+id).html('Выполняется...'); + $('#status_'+id).html('Выполняется...'); - $.getJSON(home+'servers/section/action/id/'+id+'/action/restart', - function(data) - { - wait[id] = false; + $.getJSON(home+'servers/section/action/id/'+id+'/action/restart', + function(data) + { + wait[id] = false; - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); - update_info(id); - update_status(id); + update_info(id); + update_status(id); - loading(0) - }); - }); + loading(0) + }); + }); } // Выключение сервера function server_stop(id) { - wait[id] = true; + wait[id] = true; - loading(1); + loading(1); - $('#status_'+id).html('Выполняется...'); + $('#status_'+id).html('Выполняется...'); - $.getJSON(home+'servers/section/action/id/'+id+'/action/stop', - function(data) - { - wait[id] = false; + $.getJSON(home+'servers/section/action/id/'+id+'/action/stop', + function(data) + { + wait[id] = false; - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); - update_info(id); - update_status(id); + update_info(id); + update_status(id); - loading(0) - }); - }); + loading(0) + }); + }); } // Смена карты (получение списка) function server_change(id) { - if($('#maps_list_'+id).html() != '') - { - $('#maps_close_'+id).css('display', 'block'); - $('#maps_list_'+id).css('display', 'block'); - }else{ - loading(1); + if($('#maps_list_'+id).html() != '') + { + $('#maps_close_'+id).css('display', 'block'); + $('#maps_list_'+id).css('display', 'block'); + }else{ + loading(1); - $.getJSON(home+'servers/section/action/id/'+id+'/action/change', - function(data) - { - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); + $.getJSON(home+'servers/section/action/id/'+id+'/action/change', + function(data) + { + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); - if(i == 'maps') - { - $('#maps_close_'+id).css('display', 'block'); - $('#maps_list_'+id).css('display', 'block'); - $('#maps_list_'+id).html(val); - } + if(i == 'maps') + { + $('#maps_close_'+id).css('display', 'block'); + $('#maps_list_'+id).css('display', 'block'); + $('#maps_list_'+id).html(val); + } - loading(0) - }); - }); - } + loading(0) + }); + }); + } } // Смена карты function server_change_map(id, map) { - wait[id] = true; + wait[id] = true; - loading(1); + loading(1); - $('#status_'+id).html('Выполняется...'); + $('#status_'+id).html('Выполняется...'); - server_change_close(id); + server_change_close(id); - $.getJSON(home+'servers/section/action/id/'+id+'/action/change/change/'+map, - function(data) - { - wait[id] = false; + $.getJSON(home+'servers/section/action/id/'+id+'/action/change/change/'+map, + function(data) + { + wait[id] = false; - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); - update_info(id); - update_status(id); + update_info(id); + update_status(id); - loading(0) - }); - }); + loading(0) + }); + }); } // Скрытие списка карт function server_change_close(id) { - $('#maps_close_'+id).css('display', 'none'); - $('#maps_list_'+id).css('display', 'none'); + $('#maps_close_'+id).css('display', 'none'); + $('#maps_list_'+id).css('display', 'none'); } // Переустановка сервера (подтверждение) function server_reinstall(id) { - bootbox.dialog('

    Внимание

    После переустановки, все текущие файлы будут удалены.', - [{ - "label" : "Подтвердить", - "class" : "btn-small btn-primary", - callback: function() {server_reinstall_go(id);} - },{ - "label" : "Отмена", - "class" : "btn-small btn-primary", - }] - - ); + bootbox.dialog('

    Внимание

    После переустановки, все текущие файлы будут удалены.', + [{ + "label" : "Подтвердить", + "class" : "btn-small btn-primary", + callback: function() {server_reinstall_go(id);} + },{ + "label" : "Отмена", + "class" : "btn-small btn-primary", + }] + + ); } // Переустановка сервера function server_reinstall_go(id) { - wait[id] = true; + wait[id] = true; - loading(1); + loading(1); - $('#status_'+id).html('Выполняется...'); + $('#status_'+id).html('Выполняется...'); - $.getJSON(home+'servers/section/action/id/'+id+'/action/reinstall', function(data) - { - wait[id] = false; + $.getJSON(home+'servers/section/action/id/'+id+'/action/reinstall', function(data) + { + wait[id] = false; - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); - update_info(id); - update_status(id); + update_info(id); + update_status(id); - loading(0) - }); - }); + loading(0) + }); + }); } // Обновление сервера function server_update(id) { - wait[id] = true; + wait[id] = true; - loading(1); + loading(1); - $('#status_'+id).html('Выполняется...'); + $('#status_'+id).html('Выполняется...'); - $.getJSON(home+'servers/section/action/id/'+id+'/action/update', function(data) - { - wait[id] = false; + $.getJSON(home+'servers/section/action/id/'+id+'/action/update', function(data) + { + wait[id] = false; - $.each(data, function(i, val) - { - if(i == 'e') - bootbox.dialog('

    Ошибка

    '+val, - [{ - "label" : "OK", - "class" : "btn-small btn-primary", - }] - ); + $.each(data, function(i, val) + { + if(i == 'e') + bootbox.dialog('

    Ошибка

    '+val, + [{ + "label" : "OK", + "class" : "btn-small btn-primary", + }] + ); - update_info(id); - update_status(id); + update_info(id); + update_status(id); - loading(0) - }); - }); + loading(0) + }); + }); } // Обновление информации сервера function update_info(id, go = false) { - if(wait[id] == true) - { - if(go) - setTimeout(function() {update_info(id, true)}, 3000); + if(wait[id] == true) + { + if(go) + setTimeout(function() {update_info(id, true)}, 3000); - return false; - } + return false; + } - $.getJSON(home+'servers/section/scan/id/'+id+'/mon', function(data) - { - $.each(data, function(i, val) - { - if(i == 'time' && $('#time_'+id).html() != val && val != '') - $('#time_'+id).html(val); + $.getJSON(home+'servers/section/scan/id/'+id+'/mon', function(data) + { + $.each(data, function(i, val) + { + if(i == 'time' && $('#time_'+id).html() != val && val != '') + $('#time_'+id).html(val); - if(i == 'time_end' && $('#time_end_'+id).html() != val && val != '') - $('#time_end_'+id).html(val); + if(i == 'time_end' && $('#time_end_'+id).html() != val && val != '') + $('#time_end_'+id).html(val); - if(i == 'name' && $('#name_'+id).html() != val) - $('#name_'+id).html(val); + if(i == 'name' && $('#name_'+id).html() != val) + $('#name_'+id).html(val); - if(i == 'status' && $('#status_'+id).html() != val) - $('#status_'+id).html(val); + if(i == 'status' && $('#status_'+id).html() != val) + $('#status_'+id).html(val); - if(i == 'online' && $('#online_'+id).html() != val) - $('#online_'+id).html(val); + if(i == 'online' && $('#online_'+id).html() != val) + $('#online_'+id).html(val); - if(i == 'image' && $('#image_'+id).html() != val) - $('#image_'+id).html(val); + if(i == 'image' && $('#image_'+id).html() != val) + $('#image_'+id).html(val); - if(i == 'buttons' && $('#buttons_'+id).html() != val) - $('#buttons_'+id).html(val); - }); - - if(go) - setTimeout(function() {update_info(id, true)}, 2000); - }); + if(i == 'buttons' && $('#buttons_'+id).html() != val) + $('#buttons_'+id).html(val); + }); + + if(go) + setTimeout(function() {update_info(id, true)}, 2000); + }); } // Проверка статуса сервера function update_status(id, go = false) { - $.get(home+'servers/section/scan/id/'+id+'/status', function(data) - { - if(go) - setTimeout(function() {update_status(id, true)}, 2000); - }); + $.get(home+'servers/section/scan/id/'+id+'/status', function(data) + { + if(go) + setTimeout(function() {update_status(id, true)}, 2000); + }); } \ No newline at end of file diff --git a/template/js/top.js b/template/js/top.js index dc2184b..c5fd924 100644 --- a/template/js/top.js +++ b/template/js/top.js @@ -1,23 +1,23 @@ $(document).ready(function(){ - // появление/затухание кнопки #back-top - $(function (){ - // прячем кнопку #back-top - $("#back-top").hide(); - - $(window).scroll(function (){ - if ($(this).scrollTop() > 100){ - $("#back-top").fadeIn(); - } else{ - $("#back-top").fadeOut(); - } - }); + // появление/затухание кнопки #back-top + $(function (){ + // прячем кнопку #back-top + $("#back-top").hide(); + + $(window).scroll(function (){ + if ($(this).scrollTop() > 100){ + $("#back-top").fadeIn(); + } else{ + $("#back-top").fadeOut(); + } + }); - // при клике на ссылку плавно поднимаемся вверх - $("#back-top a").click(function (){ - $("body,html").animate({ - scrollTop:0 - }, 800); - return false; - }); - }); + // при клике на ссылку плавно поднимаемся вверх + $("#back-top a").click(function (){ + $("body,html").animate({ + scrollTop:0 + }, 800); + return false; + }); + }); }); \ No newline at end of file diff --git a/template/js/wiki.js b/template/js/wiki.js index 5235f52..d9a3a35 100644 --- a/template/js/wiki.js +++ b/template/js/wiki.js @@ -1,35 +1,35 @@ function wiki_search(go) { - if($('#search').val() == '') - { - $('#search_result').css('display', 'none'); + if($('#search').val() == '') + { + $('#search_result').css('display', 'none'); - return; - } + return; + } - loading(1); + loading(1); - $.ajax({ - type: 'POST', - url: home+'wiki/section/search', - data: 'text='+$('#search').val(), - dataType: 'json', - success: function(data) - { - $.each(data, function(i, val) - { - if(i == 's') - { - if(val != '') - { - $('#search_result').css('display', 'block'); - $('#search_result').html(val); - }else - $('#search_result').css('display', 'none'); - } - }); + $.ajax({ + type: 'POST', + url: home+'wiki/section/search', + data: 'text='+$('#search').val(), + dataType: 'json', + success: function(data) + { + $.each(data, function(i, val) + { + if(i == 's') + { + if(val != '') + { + $('#search_result').css('display', 'block'); + $('#search_result').html(val); + }else + $('#search_result').css('display', 'none'); + } + }); - loading(0); - } - }); + loading(0); + } + }); } \ No newline at end of file diff --git a/template/sections/chat/messages_all.html b/template/sections/chat/messages_all.html index 42ef380..4f9e9c2 100644 --- a/template/sections/chat/messages_all.html +++ b/template/sections/chat/messages_all.html @@ -5,10 +5,10 @@
    - |me|Я|_me| |!me|[name]|_!me| - |!me|Профиль|_!me| + |me|Я|_me| |!me|[name]|_!me| + |!me|Профиль|_!me| |!me|(удалить соощение)|_!me| - + [date]
    diff --git a/template/sections/check/check.html b/template/sections/check/check.html index f647ca3..09074dd 100644 --- a/template/sections/check/check.html +++ b/template/sections/check/check.html @@ -2,7 +2,7 @@ |!auth|
    -

    Что бы проверить плагин, вам необходимо авторизоваться.

    +

    Что бы проверить плагин, вам необходимо авторизоваться.

    |_!auth| |auth| diff --git a/template/sections/check/list.html b/template/sections/check/list.html index 9521043..7d6fb91 100644 --- a/template/sections/check/list.html +++ b/template/sections/check/list.html @@ -1,4 +1,4 @@ - [n] - [text] + [n] + [text] \ No newline at end of file diff --git a/template/sections/help/close.html b/template/sections/help/close.html index baeb7cd..0650e33 100644 --- a/template/sections/help/close.html +++ b/template/sections/help/close.html @@ -7,20 +7,20 @@

    Список закрытых вопросов

    - - - - - - |support||_support| - - - - - - [question] - -
    ИнформацияСоздательСостояниеУправление
    + + + + + + |support||_support| + + + + + + [question] + +
    ИнформацияСоздательСостояниеУправление
    [pages] diff --git a/template/sections/help/close/question.html b/template/sections/help/close/question.html index f6b854f..dfcf9a6 100644 --- a/template/sections/help/close/question.html +++ b/template/sections/help/close/question.html @@ -1,25 +1,25 @@ - №[id] - - [name] -

    Создан: [date]

    - - |support| - - #[uid] [login] -

    Активность: [time]

    - - |_support| - - [status] - - - |user| -
    Открыть
    - |_user| - |admin| -
    Открыть
    -
    Удалить
    - |_admin| - + №[id] + + [name] +

    Создан: [date]

    + + |support| + + #[uid] [login] +

    Активность: [time]

    + + |_support| + + [status] + + + |user| +
    Открыть
    + |_user| + |admin| +
    Открыть
    +
    Удалить
    + |_admin| + \ No newline at end of file diff --git a/template/sections/help/create.html b/template/sections/help/create.html index c7024cb..72bb70d 100644 --- a/template/sections/help/create.html +++ b/template/sections/help/create.html @@ -7,82 +7,82 @@

    Форма создания вопроса

    - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    - - -
    -
    Выделете текст, после нажмите на одну из кнопок:
    -
    Спойлер
    -
    Подсветка
    -
    Цитата
    -
    Ссылка
    -
    - - -
    - -
    - -
    -
    - -
    -
    - +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    + + +
    + + +
    +
    Выделете текст, после нажмите на одну из кнопок:
    +
    Спойлер
    +
    Подсветка
    +
    Цитата
    +
    Ссылка
    +
    + + +
    + +
    + +
    +
    + +
    +
    +
    diff --git a/template/sections/help/dialog.html b/template/sections/help/dialog.html index 2a01f94..6760c4a 100644 --- a/template/sections/help/dialog.html +++ b/template/sections/help/dialog.html @@ -7,26 +7,26 @@

    Вопрос №[id]

    - - - - - - - - - - - - - - - - -
    Услуга:[service] - |open|
    Закрыть
    |_open| - |close|
    Открыть
    |_close| -
    Создан:[date]
    Статус:[status]
    + + + + + + + + + + + + + + + + +
    Услуга:[service] + |open|
    Закрыть
    |_open| + |close|
    Открыть
    |_close| +
    Создан:[date]
    Статус:[status]
    |open| @@ -35,16 +35,16 @@ |!user|

    Информация

    - - - - - - - - - -
    Кто читает:Кто пишет:
    Определяется...Определяется...
    + + + + + + + + + +
    Кто читает:Кто пишет:
    Определяется...Определяется...
    @@ -52,64 +52,64 @@

    Новое сообщение

    -
    - - - - - - - - - - - - - - - - - - -
    -
    Выделете текст, после нажмите на одну из кнопок:
    -
    Спойлер
    -
    Подсветка
    -
    Цитата
    -
    Ссылка
    -
    - - -
    - -
    - -
    -
    - -
    -
    -
    +
    + + + + + + + + + + + + + + + + + + +
    +
    Выделете текст, после нажмите на одну из кнопок:
    +
    Спойлер
    +
    Подсветка
    +
    Цитата
    +
    Ссылка
    +
    + + +
    + +
    + +
    +
    + +
    +
    +
    |_open| @@ -117,9 +117,9 @@

    Диалог

    - +
    @@ -127,11 +127,11 @@ diff --git a/template/sections/help/dialog/attachment.html b/template/sections/help/dialog/attachment.html index 927b255..76bfaf1 100644 --- a/template/sections/help/dialog/attachment.html +++ b/template/sections/help/dialog/attachment.html @@ -1,5 +1,5 @@ \ No newline at end of file diff --git a/template/sections/help/dialog/msg.html b/template/sections/help/dialog/msg.html index d872ada..5f608ca 100644 --- a/template/sections/help/dialog/msg.html +++ b/template/sections/help/dialog/msg.html @@ -1,28 +1,28 @@
    -
    - |admin||_admin||admin||_admin| -
    -
    -
    - [sender] |admin|(удалить соощение)|_admin| - [time] -
    -
    - -
    -
    - [text] +
    + |admin||_admin||admin||_admin| +
    +
    +
    + [sender] |admin|(удалить соощение)|_admin| + [time] +
    +
    + +
    +
    + [text] - |img| -
    - Прикрепленные изображения: -
    - [img] -
    -
    - |_img| -
    -
    -
    -
    + |img| +
    + Прикрепленные изображения: +
    + [img] +
    +
    + |_img| +
    +
    +
    +
    \ No newline at end of file diff --git a/template/sections/help/notice.html b/template/sections/help/notice.html index a66979e..7373f2a 100644 --- a/template/sections/help/notice.html +++ b/template/sections/help/notice.html @@ -1,6 +1,6 @@ -
    - Новое сообщение [ago] -

    [text]

    -
    +
    + Новое сообщение [ago] +

    [text]

    +
    \ No newline at end of file diff --git a/template/sections/help/open.html b/template/sections/help/open.html index 29e9b4d..fb83a5d 100644 --- a/template/sections/help/open.html +++ b/template/sections/help/open.html @@ -7,20 +7,20 @@

    Список открытых вопросов

    - - - - - - |support||_support| - - - - - - [question] - -
    ИнформацияСоздательСостояниеУправление
    + + + + + + |support||_support| + + + + + + [question] + +
    ИнформацияСоздательСостояниеУправление
    [pages] diff --git a/template/sections/help/open/question.html b/template/sections/help/open/question.html index bb0cf7a..3ab441a 100644 --- a/template/sections/help/open/question.html +++ b/template/sections/help/open/question.html @@ -1,25 +1,25 @@ - №[id] - - [name] -

    Создан: [date]

    - - |support| - - #[uid] [login] -

    Активность: [time]

    - - |_support| - - [status] - - - |user| -
    Закрыть
    - |_user| - |admin| -
    Закрыть
    -
    Удалить
    - |_admin| - + №[id] + + [name] +

    Создан: [date]

    + + |support| + + #[uid] [login] +

    Активность: [time]

    + + |_support| + + [status] + + + |user| +
    Закрыть
    + |_user| + |admin| +
    Закрыть
    +
    Удалить
    + |_admin| + \ No newline at end of file diff --git a/template/sections/monitoring/all.html b/template/sections/monitoring/all.html index 1297f1b..2f3fb82 100644 --- a/template/sections/monitoring/all.html +++ b/template/sections/monitoring/all.html @@ -1,56 +1,56 @@

    Категории серверов

    + +
    @@ -76,30 +76,30 @@
    [pages] - -
    +
    Теги: [tags]
    +
    + + +
    \ No newline at end of file diff --git a/template/sections/servers/crmp/console.html b/template/sections/servers/crmp/console.html index 9c195fd..fc1173e 100644 --- a/template/sections/servers/crmp/console.html +++ b/template/sections/servers/crmp/console.html @@ -1,50 +1,50 @@

    Консоль

    -
    - -
    ...
    +
    + +
    ...
    - +

    Цвет консоли:

    -
    +
    -
    +
    - - - -
    - - - - - - - - -
    Обновление
    -
    -
    + + + +
    + + + + + + + + +
    Обновление
    +
    +
    @@ -68,42 +68,42 @@ white-space: pre-wrap; word-break: break-all; } - + .console_hover { - background: #9b9f9e; + background: #9b9f9e; } .console_slategray { - background: #708090; + background: #708090; } .console_maroon { - background: #800000; + background: #800000; } .console_green { - background: #03aa46; + background: #03aa46; } .console_olive { - background: #808000; + background: #808000; } .console_yellow { - background: #ffcc3c; + background: #ffcc3c; } .console_tan { - background: #D2B48C; -} + background: #D2B48C; +} .console_red { - background: #f94747; + background: #f94747; } .console_blue { - background: #558efa; + background: #558efa; } .console_skyblue { - background: #87CEEB; -} + background: #87CEEB; +} .console_darkgreen { - background: #006400; -} + background: #006400; +} .console_lime { - background: #00FF00; + background: #00FF00; } \ No newline at end of file diff --git a/template/sections/servers/crmp/copy.html b/template/sections/servers/crmp/copy.html index aaa3b76..243beb1 100644 --- a/template/sections/servers/crmp/copy.html +++ b/template/sections/servers/crmp/copy.html @@ -1,19 +1,19 @@

    Создание полной копии

    - - - - - - - -
    - * -

    Все содержимое игрового сервера

    -
    -
    Создать полную резервную копию
    -
    + + + + + + + +
    + * +

    Все содержимое игрового сервера

    +
    +
    Создать полную резервную копию
    +
    @@ -21,19 +21,19 @@

    Создание копии

    -
    - - - [list] - - - - -
    - Перед созданием резервной копии, убедитесь что игровой север выключен. - -
    -
    +
    + + + [list] + + + + +
    + Перед созданием резервной копии, убедитесь что игровой север выключен. + +
    +
    @@ -41,29 +41,29 @@

    Созданные копии

    - - - [copy] - -
    + + + [copy] + +

    Информация

    -

    - - Полное восстановление - при восстановлении все директории в копии будут полностью заменена на имеющиеся. -

    -

    - - Частичное восстановление - при восстановлении происходит замена одинаковых файлов, не удаляются другие файлы и папки. -

    -

    - - Удаление копии - после удаление резервной копии, восстановить её будет невозможно. -

    +

    + + Полное восстановление - при восстановлении все директории в копии будут полностью заменена на имеющиеся. +

    +

    + + Частичное восстановление - при восстановлении происходит замена одинаковых файлов, не удаляются другие файлы и папки. +

    +

    + + Удаление копии - после удаление резервной копии, восстановить её будет невозможно. +

    @@ -74,11 +74,11 @@ diff --git a/template/sections/servers/crmp/gmenu.html b/template/sections/servers/crmp/gmenu.html index bc7135e..4379c0a 100644 --- a/template/sections/servers/crmp/gmenu.html +++ b/template/sections/servers/crmp/gmenu.html @@ -1,20 +1,20 @@ [notice]
    - - - - - |console_use||_console_use| - - |plugins_use||_plugins_use| - - |ftp_use||_ftp_use| - - |copy_use||_copy_use| - |graph_use||_graph_use| - |web_use||_web_use| - - -
    ОсновноеКонсольНастройкиПлагиныДрузьяFTPТарифКопииГрафикиWeb
    + + + + + |console_use||_console_use| + + |plugins_use||_plugins_use| + + |ftp_use||_ftp_use| + + |copy_use||_copy_use| + |graph_use||_graph_use| + |web_use||_web_use| + + +
    ОсновноеКонсольНастройкиПлагиныДрузьяFTPТарифКопииГрафикиWeb
    \ No newline at end of file diff --git a/template/sections/servers/crmp/index.html b/template/sections/servers/crmp/index.html index c25cba7..cf2c7f3 100644 --- a/template/sections/servers/crmp/index.html +++ b/template/sections/servers/crmp/index.html @@ -1,88 +1,88 @@

    Игровой сервер: #[id]

    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    [name]
    Игра: [game] (id: [id])Создан: [date]
    Адрес: [address]Локация: [unit]Арендован до: [time]
    [status]Сборка: [pack][time_end]
    - Онлайн: [online] / [slots] -
    x
    -
    -
    Тариф: [tarif]
    [btn]
    Продлить аренду
    -
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    [name]
    Игра: [game] (id: [id])Создан: [date]
    Адрес: [address]Локация: [unit]Арендован до: [time]
    [status]Сборка: [pack][time_end]
    + Онлайн: [online] / [slots] +
    x
    +
    +
    Тариф: [tarif]
    [btn]
    Продлить аренду
    +
    -

    Показатели нагрузки

    +

    Показатели нагрузки

    -
    - - - - - - - - - -
    -
    +
    + + + + + + + + + +
    +
    -

    Быстрый доступ

    +

    Быстрый доступ

    -
    - - - - - - - - - - - - -
    Основные настройки (server.cfg)
    Перейти
    Снимки консоли (StartLogs)
    Перейти
    -
    +
    + + + + + + + + + + + + +
    Основные настройки (server.cfg)
    Перейти
    Снимки консоли (StartLogs)
    Перейти
    +
    @@ -90,36 +90,36 @@

    Игроки онлайн

    - - - - - - - - - - - [players] - -
    #НикФрагиПинг
    + + + + + + + + + + + [players] + +
    #НикФрагиПинг
    \ No newline at end of file diff --git a/template/sections/servers/crmp/owners.html b/template/sections/servers/crmp/owners.html index 3dddc1d..a148b9a 100644 --- a/template/sections/servers/crmp/owners.html +++ b/template/sections/servers/crmp/owners.html @@ -1,76 +1,76 @@
    -

    Добавление совладельца

    +

    Добавление совладельца

    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Логин / Ид
    Включение сервера
    Выключение сервера
    Перезагрузка сервера
    Переустановка сервера
    Раздел "Консоль"
    Раздел "Настройки"
    Раздел "Плагины"
    Доступ выдан до - -
    + 60 мин.
    -
    -
    -
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Логин / Ид
    Включение сервера
    Выключение сервера
    Перезагрузка сервера
    Переустановка сервера
    Раздел "Консоль"
    Раздел "Настройки"
    Раздел "Плагины"
    Доступ выдан до + +
    + 60 мин.
    +
    +
    +
    -

    Список совладельцев

    +

    Список совладельцев

    -
    - - - [owners] - -
    -
    +
    + + + [owners] + +
    +
    -
    -
    +
    +
    -

    Выданные права

    +

    Выданные права

    -
    -
    +
    +
    @@ -83,9 +83,9 @@ diff --git a/template/sections/servers/crmp/settings.html b/template/sections/servers/crmp/settings.html index 046e0dd..392ee5f 100644 --- a/template/sections/servers/crmp/settings.html +++ b/template/sections/servers/crmp/settings.html @@ -1,37 +1,37 @@

    Основное

    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Параметры запуска игрового сервера
    Настроить
    Основные настройки (SERVER.CFG)
    Настроить
    Блокировка на оборудовании (FireWall)
    Настроить
    Планировщик задач (CronTab)
    Настроить

    Сборка игрового сервера

    (После изменения сборки, сервер необходимо переустановить, чтобы все изменения вступили в силу)
    - -
    Сохранить
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Параметры запуска игрового сервера
    Настроить
    Основные настройки (SERVER.CFG)
    Настроить
    Блокировка на оборудовании (FireWall)
    Настроить
    Планировщик задач (CronTab)
    Настроить

    Сборка игрового сервера

    (После изменения сборки, сервер необходимо переустановить, чтобы все изменения вступили в силу)
    + +
    Сохранить
    @@ -39,14 +39,14 @@

    Логи

    - - - - - - - -
    Снимки консоли (StartLogs)
    Посмотреть
    + + + + + + + +
    Снимки консоли (StartLogs)
    Посмотреть
    |edits| @@ -55,11 +55,11 @@

    Редактируемые файлы

    - - - [edits] - -
    + + + [edits] + +
    |_edits| diff --git a/template/sections/servers/crmp/settings/crontab.html b/template/sections/servers/crmp/settings/crontab.html index a67977a..9589d1e 100644 --- a/template/sections/servers/crmp/settings/crontab.html +++ b/template/sections/servers/crmp/settings/crontab.html @@ -1,119 +1,119 @@

    Планировщик задач

    -
    - - - - - - - - - - - - - - - - - - - - - -
    Задание: - -
    Время: - - -
    :
    - - - - |!autostop| -
    Выполнять задание каждый час:
    - - |_!autostop| - -
    Время на сайте: [time]
    -
    -
    Пн. - -
    - -
    Вт. - -
    - -
    Ср. - -
    - -
    Чт. - -
    - -
    Пт. - -
    - -
    Сб. - -
    - -
    Вс. - -
    -
    - -
    -
    +
    + + + + + + + + + + + + + + + + + + + + + +
    Задание: + +
    Время: + + +
    :
    + + + + |!autostop| +
    Выполнять задание каждый час:
    + + |_!autostop| + +
    Время на сайте: [time]
    +
    +
    Пн. + +
    + +
    Вт. + +
    + +
    Ср. + +
    + +
    Чт. + +
    + +
    Пт. + +
    + +
    Сб. + +
    + +
    Вс. + +
    +
    + +
    +
    @@ -121,27 +121,27 @@

    Список добавленных задач

    - - - - - - - - - - [crontab] - -
    ЗаданиеВремяДни недели
    + + + + + + + + + + [crontab] + +
    ЗаданиеВремяДни недели
    \ No newline at end of file diff --git a/template/sections/servers/crmp/settings/oldstart.html b/template/sections/servers/crmp/settings/oldstart.html index de601e4..e133991 100644 --- a/template/sections/servers/crmp/settings/oldstart.html +++ b/template/sections/servers/crmp/settings/oldstart.html @@ -1,5 +1,5 @@

    Снимок предудыщуего запуска игрового сервера

    - +
    \ No newline at end of file diff --git a/template/sections/servers/crmp/settings/servercfg.html b/template/sections/servers/crmp/settings/servercfg.html index fcadf5e..93d2269 100644 --- a/template/sections/servers/crmp/settings/servercfg.html +++ b/template/sections/servers/crmp/settings/servercfg.html @@ -1,23 +1,23 @@

    Параметры server.cfg

    -
    - - - [cfg] - - - - - - - -
    - -
    - -
    -
    +
    + + + [cfg] + + + + + + + +
    + +
    + +
    +
    diff --git a/template/sections/servers/crmp/settings/start.html b/template/sections/servers/crmp/settings/start.html index 61dd421..a338536 100644 --- a/template/sections/servers/crmp/settings/start.html +++ b/template/sections/servers/crmp/settings/start.html @@ -1,25 +1,25 @@

    Параметры запуска

    - - - - - - - - - - - -
    Количество слот
    - - - -
    + + + + + + + + + + + +
    Количество слот
    + + + +
    \ No newline at end of file diff --git a/template/sections/servers/crmp/vmenu.html b/template/sections/servers/crmp/vmenu.html index 05a4292..2b47208 100644 --- a/template/sections/servers/crmp/vmenu.html +++ b/template/sections/servers/crmp/vmenu.html @@ -1,15 +1,15 @@
    -
    Управление
    - +
    Управление
    +
    \ No newline at end of file diff --git a/template/sections/servers/cs/console.html b/template/sections/servers/cs/console.html index e9f3ea6..92de674 100644 --- a/template/sections/servers/cs/console.html +++ b/template/sections/servers/cs/console.html @@ -1,68 +1,68 @@

    Интерактивная консоль

    -
    - -
    ...
    - -
    - - - - - +
    + +
    ...
    + + +
    -
    stats
    -
    status
    -
    amxx list
    -
    meta list
    -
    amx modules
    -
    amx_off
    -
    amx_on
    -
    amx_reloadadmins
    -
    amxx version
    -
    version
    -
    restart
    -
    Очистка консоли
    -
    + + + + - + - - + + - - - - - - - -
    +
    stats
    +
    status
    +
    amxx list
    +
    meta list
    +
    amx modules
    +
    amx_off
    +
    amx_on
    +
    amx_reloadadmins
    +
    amxx version
    +
    version
    +
    restart
    +
    Очистка консоли
    +

    Цвет консоли:

    -
    +
    -
    +
    Обновление
    -
    -
    + +
    Обновление
    + + + + + + + +
    @@ -86,42 +86,42 @@ white-space: pre-wrap; word-break: break-all; } - + .console_hover { - background: #9b9f9e; + background: #9b9f9e; } .console_slategray { - background: #708090; + background: #708090; } .console_maroon { - background: #800000; + background: #800000; } .console_green { - background: #03aa46; + background: #03aa46; } .console_olive { - background: #808000; + background: #808000; } .console_yellow { - background: #ffcc3c; + background: #ffcc3c; } .console_tan { - background: #D2B48C; -} + background: #D2B48C; +} .console_red { - background: #f94747; + background: #f94747; } .console_blue { - background: #558efa; + background: #558efa; } .console_skyblue { - background: #87CEEB; -} + background: #87CEEB; +} .console_darkgreen { - background: #006400; -} + background: #006400; +} .console_lime { - background: #00FF00; + background: #00FF00; } \ No newline at end of file diff --git a/template/sections/servers/cs/copy.html b/template/sections/servers/cs/copy.html index a8ae57d..9de0f3c 100644 --- a/template/sections/servers/cs/copy.html +++ b/template/sections/servers/cs/copy.html @@ -1,19 +1,19 @@

    Создание полной копии

    - - - - - - - -
    - cstrike -

    Все содержимое директории cstrike

    -
    -
    Создать полную резервную копию
    -
    + + + + + + + +
    + cstrike +

    Все содержимое директории cstrike

    +
    +
    Создать полную резервную копию
    +
    @@ -21,19 +21,19 @@

    Создание копии

    -
    - - - [list] - - - - -
    - Перед созданием резервной копии, убедитесь что игровой север выключен. - -
    -
    +
    + + + [list] + + + + +
    + Перед созданием резервной копии, убедитесь что игровой север выключен. + +
    +
    @@ -41,29 +41,29 @@

    Созданные копии

    - - - [copy] - -
    + + + [copy] + +

    Информация

    -

    - - Полное восстановление - при восстановлении все директории в копии будут полностью заменена на имеющиеся. -

    -

    - - Частичное восстановление - при восстановлении происходит замена одинаковых файлов, не удаляются другие файлы и папки. -

    -

    - - Удаление копии - после удаление резервной копии, восстановить её будет невозможно. -

    +

    + + Полное восстановление - при восстановлении все директории в копии будут полностью заменена на имеющиеся. +

    +

    + + Частичное восстановление - при восстановлении происходит замена одинаковых файлов, не удаляются другие файлы и папки. +

    +

    + + Удаление копии - после удаление резервной копии, восстановить её будет невозможно. +

    @@ -74,11 +74,11 @@ diff --git a/template/sections/servers/cs/gmenu.html b/template/sections/servers/cs/gmenu.html index fec13aa..7476c16 100644 --- a/template/sections/servers/cs/gmenu.html +++ b/template/sections/servers/cs/gmenu.html @@ -1,21 +1,21 @@ [notice]
    - - - - - |console_use||_console_use| - - |plugins_use||_plugins_use| - - - |ftp_use||_ftp_use| - - |copy_use||_copy_use| - |graph_use||_graph_use| - |web_use||_web_use| - - -
    ОсновноеКонсольНастройкиПлагиныКартыДрузьяFTPТарифКопииГрафикиWeb
    + + + + + |console_use||_console_use| + + |plugins_use||_plugins_use| + + + |ftp_use||_ftp_use| + + |copy_use||_copy_use| + |graph_use||_graph_use| + |web_use||_web_use| + + +
    ОсновноеКонсольНастройкиПлагиныКартыДрузьяFTPТарифКопииГрафикиWeb
    \ No newline at end of file diff --git a/template/sections/servers/cs/index.html b/template/sections/servers/cs/index.html index ae2f4fc..6f1e4dd 100644 --- a/template/sections/servers/cs/index.html +++ b/template/sections/servers/cs/index.html @@ -1,88 +1,88 @@

    Игровой сервер: #[id]

    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    [name]
    Игра: [game] (id: [id])Создан: [date]
    Адрес: [address]Локация: [unit]Арендован до: [time]
    [status]Сборка: [pack][time_end]
    - Онлайн: [online] / [slots] -
    x
    -
    -
    Тариф: [tarif]
    [btn]
    Продлить аренду
    -
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    [name]
    Игра: [game] (id: [id])Создан: [date]
    Адрес: [address]Локация: [unit]Арендован до: [time]
    [status]Сборка: [pack][time_end]
    + Онлайн: [online] / [slots] +
    x
    +
    +
    Тариф: [tarif]
    [btn]
    Продлить аренду
    +
    -

    Показатели нагрузки

    +

    Показатели нагрузки

    -
    - - - - - - - - - -
    -
    +
    + + + + + + + + + +
    +
    -

    Быстрый доступ

    +

    Быстрый доступ

    -
    - - - - - - - - - - - - - - - - - - - -
    Админы на сервере (users.ini)
    Перейти
    Бан листы (banned.cfg / listip.cfg)
    Перейти
    Основные настройки (server.cfg)
    Перейти
    Снимки консоли (StartLogs)
    Перейти
    -
    +
    + + + + + + + + + + + + + + + + + + + +
    Админы на сервере (users.ini)
    Перейти
    Бан листы (banned.cfg / listip.cfg)
    Перейти
    Основные настройки (server.cfg)
    Перейти
    Снимки консоли (StartLogs)
    Перейти
    +
    @@ -94,36 +94,36 @@

    Игроки онлайн

    - - - - - - - - - - - [players] - -
    #НикФрагиВремя
    + + + + + + + + + + + [players] + +
    #НикФрагиВремя
    \ No newline at end of file diff --git a/template/sections/servers/cs/maps/listing.html b/template/sections/servers/cs/maps/listing.html index 8ac715b..618dcce 100644 --- a/template/sections/servers/cs/maps/listing.html +++ b/template/sections/servers/cs/maps/listing.html @@ -6,60 +6,60 @@
    -

    Файл: maps.ini

    +

    Файл: maps.ini

    -
    +
    -
    - - - - - - - - - - - - - -
    Путь: cstrike/addons/amxmodx/configs/maps.ini
    Сгенерировать
    -
    +
    + + + + + + + + + + + + + +
    Путь: cstrike/addons/amxmodx/configs/maps.ini
    Сгенерировать
    +
    -
    +
    -

    Файл: mapcycle.txt

    +

    Файл: mapcycle.txt

    -
    +
    -
    - - - - - - - - - - - - - -
    Путь: cstrike/mapcycle.txt
    Сгенерировать
    -
    +
    + + + + + + + + + + + + + +
    Путь: cstrike/mapcycle.txt
    Сгенерировать
    +
    -
    +
    \ No newline at end of file diff --git a/template/sections/servers/cs/maps/types.html b/template/sections/servers/cs/maps/types.html index a2106ee..d53a85a 100644 --- a/template/sections/servers/cs/maps/types.html +++ b/template/sections/servers/cs/maps/types.html @@ -1,108 +1,108 @@

    Тип карт

    \ No newline at end of file diff --git a/template/sections/servers/cs/rcon.html b/template/sections/servers/cs/rcon.html index 1ab2cf2..295dc25 100644 --- a/template/sections/servers/cs/rcon.html +++ b/template/sections/servers/cs/rcon.html @@ -1,48 +1,48 @@

    Управление игроками

    - - - - - - - - - - - -
    - Выбранный игрок: - ____________ - -
    Обновить список
    -
    -
    Убить
    -
    -
    Кикнуть
    -
    -
    Забанить
    -
    -
    Заблокировать
    -
    + + + + + + + + + + + +
    + Выбранный игрок: + ____________ + +
    Обновить список
    +
    +
    Убить
    +
    +
    Кикнуть
    +
    +
    Забанить
    +
    +
    Заблокировать
    +
    -
    +
    - - - - - - - - - - - - - -
    #НикSteamIDВремяПингАдресУправление
    + + + + + + + + + + + + + +
    #НикSteamIDВремяПингАдресУправление
    @@ -61,11 +61,11 @@ \ No newline at end of file diff --git a/template/sections/servers/cs/rcon/player.html b/template/sections/servers/cs/rcon/player.html index 577573c..4c0b989 100644 --- a/template/sections/servers/cs/rcon/player.html +++ b/template/sections/servers/cs/rcon/player.html @@ -1,17 +1,17 @@ - [i] - [name] - [steamid] - [time] - [ping]мс - - - [ip] - - - - - - - + [i] + [name] + [steamid] + [time] + [ping]мс + + + [ip] + + + + + + + \ No newline at end of file diff --git a/template/sections/servers/cs/settings.html b/template/sections/servers/cs/settings.html index 648857e..c405a39 100644 --- a/template/sections/servers/cs/settings.html +++ b/template/sections/servers/cs/settings.html @@ -1,80 +1,80 @@
    [start]
    -

    Основное

    +

    Основное

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Основные настройки (SERVER.CFG)
    Настроить
    Администраторы на сервере (USERS.INI)
    Настроить
    Забаненные на сервере (banned.cfg / listip.cfg)
    Настроить
    Блокировка на оборудовании (FireWall)
    Настроить
    Планировщик задач (CronTab)
    Настроить

    Защита от DDoS атак

    Информация
    - -
    Сохранить

    Сборка игрового сервера

    (После изменения сборки, сервер необходимо переустановить, чтобы все изменения вступили в силу)
    - -
    Сохранить

    TOP15

    (Если игровой сервер включен, то после выполнения сброса он будет перезагружен)
    - Обнуление статистики (/top15) -
    Обнулить

    API

    - |!api|Для получения ключа, необходимо активировать API|_!api| - |api|Индивидуальный ключ: [api]
    API интерфейс
    |_api| -
    - - |!api|
    Включить
    |_!api| - |api|
    Отключить
    |_api| -
    -
    -
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Основные настройки (SERVER.CFG)
    Настроить
    Администраторы на сервере (USERS.INI)
    Настроить
    Забаненные на сервере (banned.cfg / listip.cfg)
    Настроить
    Блокировка на оборудовании (FireWall)
    Настроить
    Планировщик задач (CronTab)
    Настроить

    Защита от DDoS атак

    Информация
    + +
    Сохранить

    Сборка игрового сервера

    (После изменения сборки, сервер необходимо переустановить, чтобы все изменения вступили в силу)
    + +
    Сохранить

    TOP15

    (Если игровой сервер включен, то после выполнения сброса он будет перезагружен)
    + Обнуление статистики (/top15) +
    Обнулить

    API

    + |!api|Для получения ключа, необходимо активировать API|_!api| + |api|Индивидуальный ключ: [api]
    API интерфейс
    |_api| +
    + + |!api|
    Включить
    |_!api| + |api|
    Отключить
    |_api| +
    +
    +
    @@ -82,26 +82,26 @@

    Логи

    - - - - - - - - - - - - - - - - - - - -
    Снимки консоли (StartLogs)
    Посмотреть
    Краш сервера (debug)
    Посмотреть
    Логи игрового сервера (logs/*.log)
    Посмотреть
    Логи AmxModx (addons/amxmodx/logs/*.log)
    Посмотреть
    + + + + + + + + + + + + + + + + + + + +
    Снимки консоли (StartLogs)
    Посмотреть
    Краш сервера (debug)
    Посмотреть
    Логи игрового сервера (logs/*.log)
    Посмотреть
    Логи AmxModx (addons/amxmodx/logs/*.log)
    Посмотреть
    |edits| @@ -110,11 +110,11 @@

    Редактируемые файлы

    - - - [edits] - -
    + + + [edits] + +
    |_edits| diff --git a/template/sections/servers/cs/settings/admins.html b/template/sections/servers/cs/settings/admins.html index 2e21f0b..df25b87 100644 --- a/template/sections/servers/cs/settings/admins.html +++ b/template/sections/servers/cs/settings/admins.html @@ -1,24 +1,24 @@

    Управление администраторами на сервере

    -
    - - - - - - - - - - - - - [admins] - -
    Ник / Steam / IpПарольФлаги доступаТип доступаИстекаетПримечание
    - -
    +
    + + + + + + + + + + + + + [admins] + +
    Ник / Steam / IpПарольФлаги доступаТип доступаИстекаетПримечание
    + +
    @@ -33,7 +33,7 @@ var server = '[id]'; var index = [index]; $(function(){ - $('.date-picker').datepicker(); + $('.date-picker').datepicker(); }); $(document).ready(function(e){$('input').lc_switch();}); diff --git a/template/sections/servers/cs/settings/admins/list.html b/template/sections/servers/cs/settings/admins/list.html index c52f4c8..29c936c 100644 --- a/template/sections/servers/cs/settings/admins/list.html +++ b/template/sections/servers/cs/settings/admins/list.html @@ -1,13 +1,13 @@ - - - - - -
    - - - - - + + + + + +
    + + + + + \ No newline at end of file diff --git a/template/sections/servers/cs/settings/bans.html b/template/sections/servers/cs/settings/bans.html index 505d6b2..b5c3c4d 100644 --- a/template/sections/servers/cs/settings/bans.html +++ b/template/sections/servers/cs/settings/bans.html @@ -1,29 +1,29 @@
    -

    Файл: banned.cfg

    +

    Файл: banned.cfg

    -
    -
    - - - [banned] - -
    -
    -
    +
    +
    + + + [banned] + +
    +
    +
    -

    Файл: listip.cfg

    +

    Файл: listip.cfg

    -
    -
    - - - [listip] - -
    -
    -
    +
    +
    + + + [listip] + +
    +
    +
    @@ -31,18 +31,18 @@

    Инструменты

    - - - - - - - - - - - -
    Разбанить
    Забанить
    Проверить
    AmxBans/ CSBans
    + + + + + + + + + + + +
    Разбанить
    Забанить
    Проверить
    AmxBans/ CSBans
    @@ -50,9 +50,9 @@ \ No newline at end of file diff --git a/template/sections/servers/cs/settings/crontab.html b/template/sections/servers/cs/settings/crontab.html index 16bb9f3..6577617 100644 --- a/template/sections/servers/cs/settings/crontab.html +++ b/template/sections/servers/cs/settings/crontab.html @@ -1,120 +1,120 @@

    Планировщик задач

    -
    - - - - - - - - - - - - - - - - - - - - - -
    Задание: - -
    Время: - - -
    :
    - - - - |!autostop| -
    Выполнять задание каждый час:
    - - |_!autostop| - -
    Время на сайте: [time]
    -
    -
    Пн. - -
    - -
    Вт. - -
    - -
    Ср. - -
    - -
    Чт. - -
    - -
    Пт. - -
    - -
    Сб. - -
    - -
    Вс. - -
    -
    - -
    -
    +
    + + + + + + + + + + + + + + + + + + + + + +
    Задание: + +
    Время: + + +
    :
    + + + + |!autostop| +
    Выполнять задание каждый час:
    + + |_!autostop| + +
    Время на сайте: [time]
    +
    +
    Пн. + +
    + +
    Вт. + +
    + +
    Ср. + +
    + +
    Чт. + +
    + +
    Пт. + +
    + +
    Сб. + +
    + +
    Вс. + +
    +
    + +
    +
    @@ -122,27 +122,27 @@

    Список добавленных задач

    - - - - - - - - - - [crontab] - -
    ЗаданиеВремяДни недели
    + + + + + + + + + + [crontab] + +
    ЗаданиеВремяДни недели
    \ No newline at end of file diff --git a/template/sections/servers/cs/settings/servercfg.html b/template/sections/servers/cs/settings/servercfg.html index fcadf5e..93d2269 100644 --- a/template/sections/servers/cs/settings/servercfg.html +++ b/template/sections/servers/cs/settings/servercfg.html @@ -1,23 +1,23 @@

    Параметры server.cfg

    -
    - - - [cfg] - - - - - - - -
    - -
    - -
    -
    +
    + + + [cfg] + + + + + + + +
    + +
    + +
    +
    diff --git a/template/sections/servers/cs/settings/start.html b/template/sections/servers/cs/settings/start.html index d5a7da4..e2a5d6f 100644 --- a/template/sections/servers/cs/settings/start.html +++ b/template/sections/servers/cs/settings/start.html @@ -1,106 +1,106 @@

    Параметры запуска

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |fps| - - - - - - - - - |_fps| - |pingboost| - - - - - - - - - |_pingboost| - -
    Стартовая карта
    - - - -
    Количество слот
    - - - -
    Античит VAC
    - - - -
    Быстрая скачка файлов с сервера (FastDL)
    - - - -
    Авторестарт при зависании
    - - - -
    Значение FPS
    - - - -
    Значение PINGBOOST
    - - - -
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + |fps| + + + + + + + + + |_fps| + |pingboost| + + + + + + + + + |_pingboost| + +
    Стартовая карта
    + + + +
    Количество слот
    + + + +
    Античит VAC
    + + + +
    Быстрая скачка файлов с сервера (FastDL)
    + + + +
    Авторестарт при зависании
    + + + +
    Значение FPS
    + + + +
    Значение PINGBOOST
    + + + +
    \ No newline at end of file diff --git a/template/sections/servers/cs/top.html b/template/sections/servers/cs/top.html index 1290ee9..becaaec 100644 --- a/template/sections/servers/cs/top.html +++ b/template/sections/servers/cs/top.html @@ -1,6 +1,6 @@ - [i] - [name] - [kills] - [deaths] + [i] + [name] + [kills] + [deaths] \ No newline at end of file diff --git a/template/sections/servers/cs/vmenu.html b/template/sections/servers/cs/vmenu.html index bf56fa1..9a326eb 100644 --- a/template/sections/servers/cs/vmenu.html +++ b/template/sections/servers/cs/vmenu.html @@ -1,25 +1,25 @@
    -
    Управление
    - +
    Управление
    +
    |plugins_use| -
    -
    Инструменты
    - +
    +
    Инструменты
    +
    |_plugins_use| \ No newline at end of file diff --git a/template/sections/servers/csgo/console.html b/template/sections/servers/csgo/console.html index b6109a3..b13c0e2 100644 --- a/template/sections/servers/csgo/console.html +++ b/template/sections/servers/csgo/console.html @@ -1,63 +1,63 @@

    Интерактивная консоль

    -
    - -
    ...
    - -
    - - - - - +
    + +
    ...
    + + +
    -
    status
    -
    stats
    -
    sm plugins list
    -
    meta list
    -
    sm_reloadadmins
    -
    sm version
    -
    Очистка консоли
    -
    + + + + - + - - + + - - - - - - - -
    +
    status
    +
    stats
    +
    sm plugins list
    +
    meta list
    +
    sm_reloadadmins
    +
    sm version
    +
    Очистка консоли
    +

    Цвет консоли:

    -
    +
    -
    +
    Обновление
    -
    -
    + +
    Обновление
    + + + + + + + +
    @@ -81,42 +81,42 @@ white-space: pre-wrap; word-break: break-all; } - + .console_hover { - background: #9b9f9e; + background: #9b9f9e; } .console_slategray { - background: #708090; + background: #708090; } .console_maroon { - background: #800000; + background: #800000; } .console_green { - background: #03aa46; + background: #03aa46; } .console_olive { - background: #808000; + background: #808000; } .console_yellow { - background: #ffcc3c; + background: #ffcc3c; } .console_tan { - background: #D2B48C; -} + background: #D2B48C; +} .console_red { - background: #f94747; + background: #f94747; } .console_blue { - background: #558efa; + background: #558efa; } .console_skyblue { - background: #87CEEB; -} + background: #87CEEB; +} .console_darkgreen { - background: #006400; -} + background: #006400; +} .console_lime { - background: #00FF00; + background: #00FF00; } \ No newline at end of file diff --git a/template/sections/servers/csgo/copy.html b/template/sections/servers/csgo/copy.html index 7281ede..d09e9fd 100644 --- a/template/sections/servers/csgo/copy.html +++ b/template/sections/servers/csgo/copy.html @@ -1,19 +1,19 @@

    Создание полной копии

    - - - - - - - -
    - csgo -

    Все содержимое директории csgo

    -
    -
    Создать полную резервную копию
    -
    + + + + + + + +
    + csgo +

    Все содержимое директории csgo

    +
    +
    Создать полную резервную копию
    +
    @@ -21,19 +21,19 @@

    Создание копии

    -
    - - - [list] - - - - -
    - Перед созданием резервной копии, убедитесь что игровой север выключен. - -
    -
    +
    + + + [list] + + + + +
    + Перед созданием резервной копии, убедитесь что игровой север выключен. + +
    +
    @@ -41,29 +41,29 @@

    Созданные копии

    - - - [copy] - -
    + + + [copy] + +

    Информация

    -

    - - Полное восстановление - при восстановлении все директории в копии будут полностью заменена на имеющиеся. -

    -

    - - Частичное восстановление - при восстановлении происходит замена одинаковых файлов, не удаляются другие файлы и папки. -

    -

    - - Удаление копии - после удаление резервной копии, восстановить её будет невозможно. -

    +

    + + Полное восстановление - при восстановлении все директории в копии будут полностью заменена на имеющиеся. +

    +

    + + Частичное восстановление - при восстановлении происходит замена одинаковых файлов, не удаляются другие файлы и папки. +

    +

    + + Удаление копии - после удаление резервной копии, восстановить её будет невозможно. +

    @@ -74,11 +74,11 @@ diff --git a/template/sections/servers/csgo/gmenu.html b/template/sections/servers/csgo/gmenu.html index fec13aa..7476c16 100644 --- a/template/sections/servers/csgo/gmenu.html +++ b/template/sections/servers/csgo/gmenu.html @@ -1,21 +1,21 @@ [notice]
    - - - - - |console_use||_console_use| - - |plugins_use||_plugins_use| - - - |ftp_use||_ftp_use| - - |copy_use||_copy_use| - |graph_use||_graph_use| - |web_use||_web_use| - - -
    ОсновноеКонсольНастройкиПлагиныКартыДрузьяFTPТарифКопииГрафикиWeb
    + + + + + |console_use||_console_use| + + |plugins_use||_plugins_use| + + + |ftp_use||_ftp_use| + + |copy_use||_copy_use| + |graph_use||_graph_use| + |web_use||_web_use| + + +
    ОсновноеКонсольНастройкиПлагиныКартыДрузьяFTPТарифКопииГрафикиWeb
    \ No newline at end of file diff --git a/template/sections/servers/csgo/index.html b/template/sections/servers/csgo/index.html index 72d64de..af3062f 100644 --- a/template/sections/servers/csgo/index.html +++ b/template/sections/servers/csgo/index.html @@ -1,88 +1,88 @@

    Игровой сервер: #[id]

    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    [name]
    Игра: [game] (id: [id])Создан: [date]
    Адрес: [address]Локация: [unit]Арендован до: [time]
    [status]Сборка: [pack][time_end]
    - Онлайн: [online] / [slots] -
    x
    -
    -
    Тариф: [tarif]
    [btn]
    Продлить аренду
    -
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    [name]
    Игра: [game] (id: [id])Создан: [date]
    Адрес: [address]Локация: [unit]Арендован до: [time]
    [status]Сборка: [pack][time_end]
    + Онлайн: [online] / [slots] +
    x
    +
    +
    Тариф: [tarif]
    [btn]
    Продлить аренду
    +
    -

    Показатели нагрузки

    +

    Показатели нагрузки

    -
    - - - - - - - - - -
    -
    +
    + + + + + + + + + +
    +
    -

    Быстрый доступ

    +

    Быстрый доступ

    -
    - - - - - - - - - - - - - - - - - - - -
    Админы на сервере (admins_simple.ini)
    Перейти
    Бан листы (banned_user.cfg / banned_ip.cfg)
    Перейти
    Основные настройки (server.cfg)
    Перейти
    Снимки консоли (StartLogs)
    Перейти
    -
    +
    + + + + + + + + + + + + + + + + + + + +
    Админы на сервере (admins_simple.ini)
    Перейти
    Бан листы (banned_user.cfg / banned_ip.cfg)
    Перейти
    Основные настройки (server.cfg)
    Перейти
    Снимки консоли (StartLogs)
    Перейти
    +
    @@ -94,36 +94,36 @@

    Игроки онлайн

    - - - - - - - - - - - [players] - -
    #НикФрагиВремя
    + + + + + + + + + + + [players] + +
    #НикФрагиВремя
    \ No newline at end of file diff --git a/template/sections/servers/csgo/maps/listing.html b/template/sections/servers/csgo/maps/listing.html index 21b397f..830d9e2 100644 --- a/template/sections/servers/csgo/maps/listing.html +++ b/template/sections/servers/csgo/maps/listing.html @@ -6,60 +6,60 @@
    -

    Файл: maplist.txt

    +

    Файл: maplist.txt

    -
    +
    -
    - - - - - - - - - - - - - -
    Путь: cstrike/maplist.txt
    Сгенерировать
    -
    +
    + + + + + + + + + + + + + +
    Путь: cstrike/maplist.txt
    Сгенерировать
    +
    -
    +
    -

    Файл: mapcycle.txt

    +

    Файл: mapcycle.txt

    -
    +
    -
    - - - - - - - - - - - - - -
    Путь: cstrike/mapcycle.txt
    Сгенерировать
    -
    +
    + + + + + + + + + + + + + +
    Путь: cstrike/mapcycle.txt
    Сгенерировать
    +
    -
    +
    \ No newline at end of file diff --git a/template/sections/servers/csgo/maps/map_server.html b/template/sections/servers/csgo/maps/map_server.html index fe1a524..a43c33f 100644 --- a/template/sections/servers/csgo/maps/map_server.html +++ b/template/sections/servers/csgo/maps/map_server.html @@ -1,18 +1,18 @@
    - |!workshop| -
    - - - [name] - -
    - |_!workshop| + |!workshop| +
    + + + [name] + +
    + |_!workshop| - |workshop| -
    - - - [name] -
    - |_workshop| + |workshop| +
    + + + [name] +
    + |_workshop|
    \ No newline at end of file diff --git a/template/sections/servers/csgo/maps/types.html b/template/sections/servers/csgo/maps/types.html index 1114f2c..e7793ab 100644 --- a/template/sections/servers/csgo/maps/types.html +++ b/template/sections/servers/csgo/maps/types.html @@ -2,61 +2,61 @@ diff --git a/template/sections/servers/csgo/owners.html b/template/sections/servers/csgo/owners.html index cd1711b..994fe8d 100644 --- a/template/sections/servers/csgo/owners.html +++ b/template/sections/servers/csgo/owners.html @@ -1,88 +1,88 @@
    -

    Добавление совладельца

    +

    Добавление совладельца

    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Логин / Ид
    Включение сервера
    Выключение сервера
    Перезагрузка сервера
    Смена карты сервера
    Переустановка сервера
    Обновление сервера
    Раздел "Консоль"
    Раздел "Настройки"
    Раздел "Плагины"
    Раздел "Карты"
    Доступ выдан до - -
    + 60 мин.
    -
    -
    -
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Логин / Ид
    Включение сервера
    Выключение сервера
    Перезагрузка сервера
    Смена карты сервера
    Переустановка сервера
    Обновление сервера
    Раздел "Консоль"
    Раздел "Настройки"
    Раздел "Плагины"
    Раздел "Карты"
    Доступ выдан до + +
    + 60 мин.
    +
    +
    +
    -

    Список совладельцев

    +

    Список совладельцев

    -
    - - - [owners] - -
    -
    +
    + + + [owners] + +
    +
    -
    -
    +
    +
    -

    Выданные права

    +

    Выданные права

    -
    -
    +
    +
    @@ -95,9 +95,9 @@ diff --git a/template/sections/servers/csgo/rcon.html b/template/sections/servers/csgo/rcon.html index b75a1fb..ca1031f 100644 --- a/template/sections/servers/csgo/rcon.html +++ b/template/sections/servers/csgo/rcon.html @@ -1,48 +1,48 @@

    Управление игроками

    - - - - - - - - - - - -
    - Выбранный игрок: - ____________ - -
    Обновить список
    -
    -
    Убить
    -
    -
    Кикнуть
    -
    -
    Забанить
    -
    -
    Заблокировать
    -
    + + + + + + + + + + + +
    + Выбранный игрок: + ____________ + +
    Обновить список
    +
    +
    Убить
    +
    +
    Кикнуть
    +
    +
    Забанить
    +
    +
    Заблокировать
    +
    -
    +
    - - - - - - - - - - - - - -
    #НикSteamIDВремяПингАдресУправление
    + + + + + + + + + + + + + +
    #НикSteamIDВремяПингАдресУправление
    @@ -60,11 +60,11 @@ \ No newline at end of file diff --git a/template/sections/servers/csgo/rcon/player.html b/template/sections/servers/csgo/rcon/player.html index e5c796f..35cd46c 100644 --- a/template/sections/servers/csgo/rcon/player.html +++ b/template/sections/servers/csgo/rcon/player.html @@ -1,18 +1,18 @@ - [i] - [name] - [steamid] - [time] - [ping]мс - - - [ip] - - - - - - - - + [i] + [name] + [steamid] + [time] + [ping]мс + + + [ip] + + + + + + + + \ No newline at end of file diff --git a/template/sections/servers/csgo/settings.html b/template/sections/servers/csgo/settings.html index 38ff095..e23c838 100644 --- a/template/sections/servers/csgo/settings.html +++ b/template/sections/servers/csgo/settings.html @@ -1,68 +1,68 @@
    [start]
    -

    Основное

    +

    Основное

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Основные настройки (SERVER.CFG)
    Настроить
    Администраторы на сервере (ADMINS_SIMPLE.INI)
    Настроить
    Забаненные на сервере (banned_user.cfg / banned_ip.cfg)
    Настроить
    Блокировка на оборудовании (FireWall)
    Настроить
    Планировщик задач (CronTab)
    Настроить

    Защита от DDoS атак

    Информация
    - -
    Сохранить

    Сборка игрового сервера

    (После изменения сборки, сервер необходимо переустановить, чтобы все изменения вступили в силу)
    - -
    Сохранить
    - |!api|Для получения ключа, необходимо активировать API|_!api| - |api|Индивидуальный ключ: [api]
    API интерфейс
    |_api| -
    - - |!api|
    Включить
    |_!api| - |api|
    Отключить
    |_api| -
    -
    -
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Основные настройки (SERVER.CFG)
    Настроить
    Администраторы на сервере (ADMINS_SIMPLE.INI)
    Настроить
    Забаненные на сервере (banned_user.cfg / banned_ip.cfg)
    Настроить
    Блокировка на оборудовании (FireWall)
    Настроить
    Планировщик задач (CronTab)
    Настроить

    Защита от DDoS атак

    Информация
    + +
    Сохранить

    Сборка игрового сервера

    (После изменения сборки, сервер необходимо переустановить, чтобы все изменения вступили в силу)
    + +
    Сохранить
    + |!api|Для получения ключа, необходимо активировать API|_!api| + |api|Индивидуальный ключ: [api]
    API интерфейс
    |_api| +
    + + |!api|
    Включить
    |_!api| + |api|
    Отключить
    |_api| +
    +
    +
    @@ -70,26 +70,26 @@

    Логи

    - - - - - - - - - - - - - - - - - - - -
    Снимки консоли (StartLogs)
    Посмотреть
    Краш сервера (debug)
    Посмотреть
    Логи игрового сервера (logs/*.log)
    Посмотреть
    Логи SourceMod (addons/sourcemod/logs/*.log)
    Посмотреть
    + + + + + + + + + + + + + + + + + + + +
    Снимки консоли (StartLogs)
    Посмотреть
    Краш сервера (debug)
    Посмотреть
    Логи игрового сервера (logs/*.log)
    Посмотреть
    Логи SourceMod (addons/sourcemod/logs/*.log)
    Посмотреть
    |edits| @@ -98,11 +98,11 @@

    Редактируемые файлы

    - - - [edits] - -
    + + + [edits] + +
    |_edits| diff --git a/template/sections/servers/csgo/settings/admins.html b/template/sections/servers/csgo/settings/admins.html index 722aba8..4e74f4a 100644 --- a/template/sections/servers/csgo/settings/admins.html +++ b/template/sections/servers/csgo/settings/admins.html @@ -1,24 +1,24 @@

    Управление администраторами на сервере

    -
    - - - - - - - - - - - - - [admins] - -
    Ник / Steam / IpПарольФлаги доступаИммунитетИстекаетПримечание
    - -
    +
    + + + + + + + + + + + + + [admins] + +
    Ник / Steam / IpПарольФлаги доступаИммунитетИстекаетПримечание
    + +
    @@ -32,7 +32,7 @@ diff --git a/template/sections/servers/csgo/settings/admins/list.html b/template/sections/servers/csgo/settings/admins/list.html index 41b6cfa..fdf8919 100644 --- a/template/sections/servers/csgo/settings/admins/list.html +++ b/template/sections/servers/csgo/settings/admins/list.html @@ -1,13 +1,13 @@ - - - - - -
    - - - - - + + + + + +
    + + + + + \ No newline at end of file diff --git a/template/sections/servers/csgo/settings/bans.html b/template/sections/servers/csgo/settings/bans.html index ed0cb40..0edf42d 100644 --- a/template/sections/servers/csgo/settings/bans.html +++ b/template/sections/servers/csgo/settings/bans.html @@ -1,29 +1,29 @@
    -

    Файл: banned_user.cfg

    +

    Файл: banned_user.cfg

    -
    -
    - - - [banned] - -
    -
    -
    +
    +
    + + + [banned] + +
    +
    +
    -

    Файл: banned_ip.cfg

    +

    Файл: banned_ip.cfg

    -
    -
    - - - [listip] - -
    -
    -
    +
    +
    + + + [listip] + +
    +
    +
    @@ -31,18 +31,18 @@

    Инструменты

    - - - - - - - - - - - -
    Разбанить
    Забанить
    Проверить
    SourceBans
    + + + + + + + + + + + +
    Разбанить
    Забанить
    Проверить
    SourceBans
    @@ -50,9 +50,9 @@ \ No newline at end of file diff --git a/template/sections/servers/csgo/settings/crontab.html b/template/sections/servers/csgo/settings/crontab.html index 68e2920..cec6945 100644 --- a/template/sections/servers/csgo/settings/crontab.html +++ b/template/sections/servers/csgo/settings/crontab.html @@ -1,121 +1,121 @@

    Планировщик задач

    -
    - - - - - - - - - - - - - - - - - - - - - -
    Задание: - -
    Время: - - -
    :
    - - - - |!autostop| -
    Выполнять задание каждый час:
    - - |_!autostop| - -
    Время на сайте: [time]
    -
    -
    Пн. - -
    - -
    Вт. - -
    - -
    Ср. - -
    - -
    Чт. - -
    - -
    Пт. - -
    - -
    Сб. - -
    - -
    Вс. - -
    -
    - -
    -
    +
    + + + + + + + + + + + + + + + + + + + + + +
    Задание: + +
    Время: + + +
    :
    + + + + |!autostop| +
    Выполнять задание каждый час:
    + + |_!autostop| + +
    Время на сайте: [time]
    +
    +
    Пн. + +
    + +
    Вт. + +
    + +
    Ср. + +
    + +
    Чт. + +
    + +
    Пт. + +
    + +
    Сб. + +
    + +
    Вс. + +
    +
    + +
    +
    @@ -123,27 +123,27 @@

    Список добавленных задач

    - - - - - - - - - - [crontab] - -
    ЗаданиеВремяДни недели
    + + + + + + + + + + [crontab] + +
    ЗаданиеВремяДни недели
    \ No newline at end of file diff --git a/template/sections/servers/csgo/settings/servercfg.html b/template/sections/servers/csgo/settings/servercfg.html index fcadf5e..93d2269 100644 --- a/template/sections/servers/csgo/settings/servercfg.html +++ b/template/sections/servers/csgo/settings/servercfg.html @@ -1,23 +1,23 @@

    Параметры server.cfg

    -
    - - - [cfg] - - - - - - - -
    - -
    - -
    -
    +
    + + + [cfg] + + + + + + + +
    + +
    + +
    +
    diff --git a/template/sections/servers/csgo/settings/start.html b/template/sections/servers/csgo/settings/start.html index 714e81d..726510a 100644 --- a/template/sections/servers/csgo/settings/start.html +++ b/template/sections/servers/csgo/settings/start.html @@ -1,92 +1,92 @@

    Параметры запуска

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |tickrate| - - - - - - - - - |_tickrate| - -
    Стартовая карта
    - - - -
    Количество слот
    - - - -
    Античит VAC
    - - - -
    Быстрая скачка файлов с сервера (FastDL)
    - - - -
    Авторестарт при зависании
    - - - -
    Значение TickRate
    - - - -
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + |tickrate| + + + + + + + + + |_tickrate| + +
    Стартовая карта
    + + + +
    Количество слот
    + + + +
    Античит VAC
    + + + +
    Быстрая скачка файлов с сервера (FastDL)
    + + + +
    Авторестарт при зависании
    + + + +
    Значение TickRate
    + + + +
    \ No newline at end of file diff --git a/template/sections/servers/csgo/vmenu.html b/template/sections/servers/csgo/vmenu.html index 2e81499..de4fa0c 100644 --- a/template/sections/servers/csgo/vmenu.html +++ b/template/sections/servers/csgo/vmenu.html @@ -1,16 +1,16 @@
    -
    Управление
    - +
    Управление
    +
    \ No newline at end of file diff --git a/template/sections/servers/css/console.html b/template/sections/servers/css/console.html index 926a2e2..9f8f094 100644 --- a/template/sections/servers/css/console.html +++ b/template/sections/servers/css/console.html @@ -1,63 +1,63 @@

    Интерактивная консоль

    -
    - -
    ...
    - -
    - - - - - +
    + +
    ...
    + + +
    -
    status
    -
    stats
    -
    sm plugins list
    -
    meta list
    -
    sm_reloadadmins
    -
    sm version
    -
    Очистка консоли
    -
    + + + + - + - - + + - - - - - - - -
    +
    status
    +
    stats
    +
    sm plugins list
    +
    meta list
    +
    sm_reloadadmins
    +
    sm version
    +
    Очистка консоли
    +

    Цвет консоли:

    -
    +
    -
    +
    Обновление
    -
    -
    + +
    Обновление
    + + + + + + + +
    @@ -81,42 +81,42 @@ white-space: pre-wrap; word-break: break-all; } - + .console_hover { - background: #9b9f9e; + background: #9b9f9e; } .console_slategray { - background: #708090; + background: #708090; } .console_maroon { - background: #800000; + background: #800000; } .console_green { - background: #03aa46; + background: #03aa46; } .console_olive { - background: #808000; + background: #808000; } .console_yellow { - background: #ffcc3c; + background: #ffcc3c; } .console_tan { - background: #D2B48C; -} + background: #D2B48C; +} .console_red { - background: #f94747; + background: #f94747; } .console_blue { - background: #558efa; + background: #558efa; } .console_skyblue { - background: #87CEEB; -} + background: #87CEEB; +} .console_darkgreen { - background: #006400; -} + background: #006400; +} .console_lime { - background: #00FF00; + background: #00FF00; } \ No newline at end of file diff --git a/template/sections/servers/css/copy.html b/template/sections/servers/css/copy.html index a8ae57d..9de0f3c 100644 --- a/template/sections/servers/css/copy.html +++ b/template/sections/servers/css/copy.html @@ -1,19 +1,19 @@

    Создание полной копии

    - - - - - - - -
    - cstrike -

    Все содержимое директории cstrike

    -
    -
    Создать полную резервную копию
    -
    + + + + + + + +
    + cstrike +

    Все содержимое директории cstrike

    +
    +
    Создать полную резервную копию
    +
    @@ -21,19 +21,19 @@

    Создание копии

    -
    - - - [list] - - - - -
    - Перед созданием резервной копии, убедитесь что игровой север выключен. - -
    -
    +
    + + + [list] + + + + +
    + Перед созданием резервной копии, убедитесь что игровой север выключен. + +
    +
    @@ -41,29 +41,29 @@

    Созданные копии

    - - - [copy] - -
    + + + [copy] + +

    Информация

    -

    - - Полное восстановление - при восстановлении все директории в копии будут полностью заменена на имеющиеся. -

    -

    - - Частичное восстановление - при восстановлении происходит замена одинаковых файлов, не удаляются другие файлы и папки. -

    -

    - - Удаление копии - после удаление резервной копии, восстановить её будет невозможно. -

    +

    + + Полное восстановление - при восстановлении все директории в копии будут полностью заменена на имеющиеся. +

    +

    + + Частичное восстановление - при восстановлении происходит замена одинаковых файлов, не удаляются другие файлы и папки. +

    +

    + + Удаление копии - после удаление резервной копии, восстановить её будет невозможно. +

    @@ -74,11 +74,11 @@ diff --git a/template/sections/servers/css/gmenu.html b/template/sections/servers/css/gmenu.html index fec13aa..7476c16 100644 --- a/template/sections/servers/css/gmenu.html +++ b/template/sections/servers/css/gmenu.html @@ -1,21 +1,21 @@ [notice]
    - - - - - |console_use||_console_use| - - |plugins_use||_plugins_use| - - - |ftp_use||_ftp_use| - - |copy_use||_copy_use| - |graph_use||_graph_use| - |web_use||_web_use| - - -
    ОсновноеКонсольНастройкиПлагиныКартыДрузьяFTPТарифКопииГрафикиWeb
    + + + + + |console_use||_console_use| + + |plugins_use||_plugins_use| + + + |ftp_use||_ftp_use| + + |copy_use||_copy_use| + |graph_use||_graph_use| + |web_use||_web_use| + + +
    ОсновноеКонсольНастройкиПлагиныКартыДрузьяFTPТарифКопииГрафикиWeb
    \ No newline at end of file diff --git a/template/sections/servers/css/index.html b/template/sections/servers/css/index.html index 72d64de..af3062f 100644 --- a/template/sections/servers/css/index.html +++ b/template/sections/servers/css/index.html @@ -1,88 +1,88 @@

    Игровой сервер: #[id]

    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    [name]
    Игра: [game] (id: [id])Создан: [date]
    Адрес: [address]Локация: [unit]Арендован до: [time]
    [status]Сборка: [pack][time_end]
    - Онлайн: [online] / [slots] -
    x
    -
    -
    Тариф: [tarif]
    [btn]
    Продлить аренду
    -
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    [name]
    Игра: [game] (id: [id])Создан: [date]
    Адрес: [address]Локация: [unit]Арендован до: [time]
    [status]Сборка: [pack][time_end]
    + Онлайн: [online] / [slots] +
    x
    +
    +
    Тариф: [tarif]
    [btn]
    Продлить аренду
    +
    -

    Показатели нагрузки

    +

    Показатели нагрузки

    -
    - - - - - - - - - -
    -
    +
    + + + + + + + + + +
    +
    -

    Быстрый доступ

    +

    Быстрый доступ

    -
    - - - - - - - - - - - - - - - - - - - -
    Админы на сервере (admins_simple.ini)
    Перейти
    Бан листы (banned_user.cfg / banned_ip.cfg)
    Перейти
    Основные настройки (server.cfg)
    Перейти
    Снимки консоли (StartLogs)
    Перейти
    -
    +
    + + + + + + + + + + + + + + + + + + + +
    Админы на сервере (admins_simple.ini)
    Перейти
    Бан листы (banned_user.cfg / banned_ip.cfg)
    Перейти
    Основные настройки (server.cfg)
    Перейти
    Снимки консоли (StartLogs)
    Перейти
    +
    @@ -94,36 +94,36 @@

    Игроки онлайн

    - - - - - - - - - - - [players] - -
    #НикФрагиВремя
    + + + + + + + + + + + [players] + +
    #НикФрагиВремя
    \ No newline at end of file diff --git a/template/sections/servers/css/maps/listing.html b/template/sections/servers/css/maps/listing.html index 21b397f..830d9e2 100644 --- a/template/sections/servers/css/maps/listing.html +++ b/template/sections/servers/css/maps/listing.html @@ -6,60 +6,60 @@
    -

    Файл: maplist.txt

    +

    Файл: maplist.txt

    -
    +
    -
    - - - - - - - - - - - - - -
    Путь: cstrike/maplist.txt
    Сгенерировать
    -
    +
    + + + + + + + + + + + + + +
    Путь: cstrike/maplist.txt
    Сгенерировать
    +
    -
    +
    -

    Файл: mapcycle.txt

    +

    Файл: mapcycle.txt

    -
    +
    -
    - - - - - - - - - - - - - -
    Путь: cstrike/mapcycle.txt
    Сгенерировать
    -
    +
    + + + + + + + + + + + + + +
    Путь: cstrike/mapcycle.txt
    Сгенерировать
    +
    -
    +
    \ No newline at end of file diff --git a/template/sections/servers/css/maps/types.html b/template/sections/servers/css/maps/types.html index 1114f2c..e7793ab 100644 --- a/template/sections/servers/css/maps/types.html +++ b/template/sections/servers/css/maps/types.html @@ -2,61 +2,61 @@ diff --git a/template/sections/servers/css/owners.html b/template/sections/servers/css/owners.html index cd1711b..994fe8d 100644 --- a/template/sections/servers/css/owners.html +++ b/template/sections/servers/css/owners.html @@ -1,88 +1,88 @@
    -

    Добавление совладельца

    +

    Добавление совладельца

    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Логин / Ид
    Включение сервера
    Выключение сервера
    Перезагрузка сервера
    Смена карты сервера
    Переустановка сервера
    Обновление сервера
    Раздел "Консоль"
    Раздел "Настройки"
    Раздел "Плагины"
    Раздел "Карты"
    Доступ выдан до - -
    + 60 мин.
    -
    -
    -
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Логин / Ид
    Включение сервера
    Выключение сервера
    Перезагрузка сервера
    Смена карты сервера
    Переустановка сервера
    Обновление сервера
    Раздел "Консоль"
    Раздел "Настройки"
    Раздел "Плагины"
    Раздел "Карты"
    Доступ выдан до + +
    + 60 мин.
    +
    +
    +
    -

    Список совладельцев

    +

    Список совладельцев

    -
    - - - [owners] - -
    -
    +
    + + + [owners] + +
    +
    -
    -
    +
    +
    -

    Выданные права

    +

    Выданные права

    -
    -
    +
    +
    @@ -95,9 +95,9 @@ diff --git a/template/sections/servers/css/rcon.html b/template/sections/servers/css/rcon.html index b75a1fb..ca1031f 100644 --- a/template/sections/servers/css/rcon.html +++ b/template/sections/servers/css/rcon.html @@ -1,48 +1,48 @@

    Управление игроками

    - - - - - - - - - - - -
    - Выбранный игрок: - ____________ - -
    Обновить список
    -
    -
    Убить
    -
    -
    Кикнуть
    -
    -
    Забанить
    -
    -
    Заблокировать
    -
    + + + + + + + + + + + +
    + Выбранный игрок: + ____________ + +
    Обновить список
    +
    +
    Убить
    +
    +
    Кикнуть
    +
    +
    Забанить
    +
    +
    Заблокировать
    +
    -
    +
    - - - - - - - - - - - - - -
    #НикSteamIDВремяПингАдресУправление
    + + + + + + + + + + + + + +
    #НикSteamIDВремяПингАдресУправление
    @@ -60,11 +60,11 @@ \ No newline at end of file diff --git a/template/sections/servers/css/rcon/player.html b/template/sections/servers/css/rcon/player.html index e5c796f..35cd46c 100644 --- a/template/sections/servers/css/rcon/player.html +++ b/template/sections/servers/css/rcon/player.html @@ -1,18 +1,18 @@ - [i] - [name] - [steamid] - [time] - [ping]мс - - - [ip] - - - - - - - - + [i] + [name] + [steamid] + [time] + [ping]мс + + + [ip] + + + + + + + + \ No newline at end of file diff --git a/template/sections/servers/css/settings.html b/template/sections/servers/css/settings.html index 38ff095..e23c838 100644 --- a/template/sections/servers/css/settings.html +++ b/template/sections/servers/css/settings.html @@ -1,68 +1,68 @@
    [start]
    -

    Основное

    +

    Основное

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Основные настройки (SERVER.CFG)
    Настроить
    Администраторы на сервере (ADMINS_SIMPLE.INI)
    Настроить
    Забаненные на сервере (banned_user.cfg / banned_ip.cfg)
    Настроить
    Блокировка на оборудовании (FireWall)
    Настроить
    Планировщик задач (CronTab)
    Настроить

    Защита от DDoS атак

    Информация
    - -
    Сохранить

    Сборка игрового сервера

    (После изменения сборки, сервер необходимо переустановить, чтобы все изменения вступили в силу)
    - -
    Сохранить
    - |!api|Для получения ключа, необходимо активировать API|_!api| - |api|Индивидуальный ключ: [api]
    API интерфейс
    |_api| -
    - - |!api|
    Включить
    |_!api| - |api|
    Отключить
    |_api| -
    -
    -
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Основные настройки (SERVER.CFG)
    Настроить
    Администраторы на сервере (ADMINS_SIMPLE.INI)
    Настроить
    Забаненные на сервере (banned_user.cfg / banned_ip.cfg)
    Настроить
    Блокировка на оборудовании (FireWall)
    Настроить
    Планировщик задач (CronTab)
    Настроить

    Защита от DDoS атак

    Информация
    + +
    Сохранить

    Сборка игрового сервера

    (После изменения сборки, сервер необходимо переустановить, чтобы все изменения вступили в силу)
    + +
    Сохранить
    + |!api|Для получения ключа, необходимо активировать API|_!api| + |api|Индивидуальный ключ: [api]
    API интерфейс
    |_api| +
    + + |!api|
    Включить
    |_!api| + |api|
    Отключить
    |_api| +
    +
    +
    @@ -70,26 +70,26 @@

    Логи

    - - - - - - - - - - - - - - - - - - - -
    Снимки консоли (StartLogs)
    Посмотреть
    Краш сервера (debug)
    Посмотреть
    Логи игрового сервера (logs/*.log)
    Посмотреть
    Логи SourceMod (addons/sourcemod/logs/*.log)
    Посмотреть
    + + + + + + + + + + + + + + + + + + + +
    Снимки консоли (StartLogs)
    Посмотреть
    Краш сервера (debug)
    Посмотреть
    Логи игрового сервера (logs/*.log)
    Посмотреть
    Логи SourceMod (addons/sourcemod/logs/*.log)
    Посмотреть
    |edits| @@ -98,11 +98,11 @@

    Редактируемые файлы

    - - - [edits] - -
    + + + [edits] + +
    |_edits| diff --git a/template/sections/servers/css/settings/admins.html b/template/sections/servers/css/settings/admins.html index 722aba8..4e74f4a 100644 --- a/template/sections/servers/css/settings/admins.html +++ b/template/sections/servers/css/settings/admins.html @@ -1,24 +1,24 @@

    Управление администраторами на сервере

    -
    - - - - - - - - - - - - - [admins] - -
    Ник / Steam / IpПарольФлаги доступаИммунитетИстекаетПримечание
    - -
    +
    + + + + + + + + + + + + + [admins] + +
    Ник / Steam / IpПарольФлаги доступаИммунитетИстекаетПримечание
    + +
    @@ -32,7 +32,7 @@ diff --git a/template/sections/servers/css/settings/admins/list.html b/template/sections/servers/css/settings/admins/list.html index 41b6cfa..fdf8919 100644 --- a/template/sections/servers/css/settings/admins/list.html +++ b/template/sections/servers/css/settings/admins/list.html @@ -1,13 +1,13 @@ - - - - - -
    - - - - - + + + + + +
    + + + + + \ No newline at end of file diff --git a/template/sections/servers/css/settings/bans.html b/template/sections/servers/css/settings/bans.html index ed0cb40..0edf42d 100644 --- a/template/sections/servers/css/settings/bans.html +++ b/template/sections/servers/css/settings/bans.html @@ -1,29 +1,29 @@
    -

    Файл: banned_user.cfg

    +

    Файл: banned_user.cfg

    -
    -
    - - - [banned] - -
    -
    -
    +
    +
    + + + [banned] + +
    +
    +
    -

    Файл: banned_ip.cfg

    +

    Файл: banned_ip.cfg

    -
    -
    - - - [listip] - -
    -
    -
    +
    +
    + + + [listip] + +
    +
    +
    @@ -31,18 +31,18 @@

    Инструменты

    - - - - - - - - - - - -
    Разбанить
    Забанить
    Проверить
    SourceBans
    + + + + + + + + + + + +
    Разбанить
    Забанить
    Проверить
    SourceBans
    @@ -50,9 +50,9 @@ \ No newline at end of file diff --git a/template/sections/servers/css/settings/crontab.html b/template/sections/servers/css/settings/crontab.html index 68e2920..cec6945 100644 --- a/template/sections/servers/css/settings/crontab.html +++ b/template/sections/servers/css/settings/crontab.html @@ -1,121 +1,121 @@

    Планировщик задач

    -
    - - - - - - - - - - - - - - - - - - - - - -
    Задание: - -
    Время: - - -
    :
    - - - - |!autostop| -
    Выполнять задание каждый час:
    - - |_!autostop| - -
    Время на сайте: [time]
    -
    -
    Пн. - -
    - -
    Вт. - -
    - -
    Ср. - -
    - -
    Чт. - -
    - -
    Пт. - -
    - -
    Сб. - -
    - -
    Вс. - -
    -
    - -
    -
    +
    + + + + + + + + + + + + + + + + + + + + + +
    Задание: + +
    Время: + + +
    :
    + + + + |!autostop| +
    Выполнять задание каждый час:
    + + |_!autostop| + +
    Время на сайте: [time]
    +
    +
    Пн. + +
    + +
    Вт. + +
    + +
    Ср. + +
    + +
    Чт. + +
    + +
    Пт. + +
    + +
    Сб. + +
    + +
    Вс. + +
    +
    + +
    +
    @@ -123,27 +123,27 @@

    Список добавленных задач

    - - - - - - - - - - [crontab] - -
    ЗаданиеВремяДни недели
    + + + + + + + + + + [crontab] + +
    ЗаданиеВремяДни недели
    \ No newline at end of file diff --git a/template/sections/servers/css/settings/servercfg.html b/template/sections/servers/css/settings/servercfg.html index fcadf5e..93d2269 100644 --- a/template/sections/servers/css/settings/servercfg.html +++ b/template/sections/servers/css/settings/servercfg.html @@ -1,23 +1,23 @@

    Параметры server.cfg

    -
    - - - [cfg] - - - - - - - -
    - -
    - -
    -
    +
    + + + [cfg] + + + + + + + +
    + +
    + +
    +
    diff --git a/template/sections/servers/css/settings/start.html b/template/sections/servers/css/settings/start.html index 714e81d..726510a 100644 --- a/template/sections/servers/css/settings/start.html +++ b/template/sections/servers/css/settings/start.html @@ -1,92 +1,92 @@

    Параметры запуска

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |tickrate| - - - - - - - - - |_tickrate| - -
    Стартовая карта
    - - - -
    Количество слот
    - - - -
    Античит VAC
    - - - -
    Быстрая скачка файлов с сервера (FastDL)
    - - - -
    Авторестарт при зависании
    - - - -
    Значение TickRate
    - - - -
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + |tickrate| + + + + + + + + + |_tickrate| + +
    Стартовая карта
    + + + +
    Количество слот
    + + + +
    Античит VAC
    + + + +
    Быстрая скачка файлов с сервера (FastDL)
    + + + +
    Авторестарт при зависании
    + + + +
    Значение TickRate
    + + + +
    \ No newline at end of file diff --git a/template/sections/servers/css/vmenu.html b/template/sections/servers/css/vmenu.html index 2e81499..de4fa0c 100644 --- a/template/sections/servers/css/vmenu.html +++ b/template/sections/servers/css/vmenu.html @@ -1,16 +1,16 @@
    -
    Управление
    - +
    Управление
    +
    \ No newline at end of file diff --git a/template/sections/servers/cssold/console.html b/template/sections/servers/cssold/console.html index 926a2e2..9f8f094 100644 --- a/template/sections/servers/cssold/console.html +++ b/template/sections/servers/cssold/console.html @@ -1,63 +1,63 @@

    Интерактивная консоль

    -
    - -
    ...
    - -
    - - - - - +
    + +
    ...
    + + +
    -
    status
    -
    stats
    -
    sm plugins list
    -
    meta list
    -
    sm_reloadadmins
    -
    sm version
    -
    Очистка консоли
    -
    + + + + - + - - + + - - - - - - - -
    +
    status
    +
    stats
    +
    sm plugins list
    +
    meta list
    +
    sm_reloadadmins
    +
    sm version
    +
    Очистка консоли
    +

    Цвет консоли:

    -
    +
    -
    +
    Обновление
    -
    -
    + +
    Обновление
    + + + + + + + +
    @@ -81,42 +81,42 @@ white-space: pre-wrap; word-break: break-all; } - + .console_hover { - background: #9b9f9e; + background: #9b9f9e; } .console_slategray { - background: #708090; + background: #708090; } .console_maroon { - background: #800000; + background: #800000; } .console_green { - background: #03aa46; + background: #03aa46; } .console_olive { - background: #808000; + background: #808000; } .console_yellow { - background: #ffcc3c; + background: #ffcc3c; } .console_tan { - background: #D2B48C; -} + background: #D2B48C; +} .console_red { - background: #f94747; + background: #f94747; } .console_blue { - background: #558efa; + background: #558efa; } .console_skyblue { - background: #87CEEB; -} + background: #87CEEB; +} .console_darkgreen { - background: #006400; -} + background: #006400; +} .console_lime { - background: #00FF00; + background: #00FF00; } \ No newline at end of file diff --git a/template/sections/servers/cssold/copy.html b/template/sections/servers/cssold/copy.html index a8ae57d..9de0f3c 100644 --- a/template/sections/servers/cssold/copy.html +++ b/template/sections/servers/cssold/copy.html @@ -1,19 +1,19 @@

    Создание полной копии

    - - - - - - - -
    - cstrike -

    Все содержимое директории cstrike

    -
    -
    Создать полную резервную копию
    -
    + + + + + + + +
    + cstrike +

    Все содержимое директории cstrike

    +
    +
    Создать полную резервную копию
    +
    @@ -21,19 +21,19 @@

    Создание копии

    -
    - - - [list] - - - - -
    - Перед созданием резервной копии, убедитесь что игровой север выключен. - -
    -
    +
    + + + [list] + + + + +
    + Перед созданием резервной копии, убедитесь что игровой север выключен. + +
    +
    @@ -41,29 +41,29 @@

    Созданные копии

    - - - [copy] - -
    + + + [copy] + +

    Информация

    -

    - - Полное восстановление - при восстановлении все директории в копии будут полностью заменена на имеющиеся. -

    -

    - - Частичное восстановление - при восстановлении происходит замена одинаковых файлов, не удаляются другие файлы и папки. -

    -

    - - Удаление копии - после удаление резервной копии, восстановить её будет невозможно. -

    +

    + + Полное восстановление - при восстановлении все директории в копии будут полностью заменена на имеющиеся. +

    +

    + + Частичное восстановление - при восстановлении происходит замена одинаковых файлов, не удаляются другие файлы и папки. +

    +

    + + Удаление копии - после удаление резервной копии, восстановить её будет невозможно. +

    @@ -74,11 +74,11 @@ diff --git a/template/sections/servers/cssold/gmenu.html b/template/sections/servers/cssold/gmenu.html index fec13aa..7476c16 100644 --- a/template/sections/servers/cssold/gmenu.html +++ b/template/sections/servers/cssold/gmenu.html @@ -1,21 +1,21 @@ [notice]
    - - - - - |console_use||_console_use| - - |plugins_use||_plugins_use| - - - |ftp_use||_ftp_use| - - |copy_use||_copy_use| - |graph_use||_graph_use| - |web_use||_web_use| - - -
    ОсновноеКонсольНастройкиПлагиныКартыДрузьяFTPТарифКопииГрафикиWeb
    + + + + + |console_use||_console_use| + + |plugins_use||_plugins_use| + + + |ftp_use||_ftp_use| + + |copy_use||_copy_use| + |graph_use||_graph_use| + |web_use||_web_use| + + +
    ОсновноеКонсольНастройкиПлагиныКартыДрузьяFTPТарифКопииГрафикиWeb
    \ No newline at end of file diff --git a/template/sections/servers/cssold/index.html b/template/sections/servers/cssold/index.html index 72d64de..af3062f 100644 --- a/template/sections/servers/cssold/index.html +++ b/template/sections/servers/cssold/index.html @@ -1,88 +1,88 @@

    Игровой сервер: #[id]

    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    [name]
    Игра: [game] (id: [id])Создан: [date]
    Адрес: [address]Локация: [unit]Арендован до: [time]
    [status]Сборка: [pack][time_end]
    - Онлайн: [online] / [slots] -
    x
    -
    -
    Тариф: [tarif]
    [btn]
    Продлить аренду
    -
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    [name]
    Игра: [game] (id: [id])Создан: [date]
    Адрес: [address]Локация: [unit]Арендован до: [time]
    [status]Сборка: [pack][time_end]
    + Онлайн: [online] / [slots] +
    x
    +
    +
    Тариф: [tarif]
    [btn]
    Продлить аренду
    +
    -

    Показатели нагрузки

    +

    Показатели нагрузки

    -
    - - - - - - - - - -
    -
    +
    + + + + + + + + + +
    +
    -

    Быстрый доступ

    +

    Быстрый доступ

    -
    - - - - - - - - - - - - - - - - - - - -
    Админы на сервере (admins_simple.ini)
    Перейти
    Бан листы (banned_user.cfg / banned_ip.cfg)
    Перейти
    Основные настройки (server.cfg)
    Перейти
    Снимки консоли (StartLogs)
    Перейти
    -
    +
    + + + + + + + + + + + + + + + + + + + +
    Админы на сервере (admins_simple.ini)
    Перейти
    Бан листы (banned_user.cfg / banned_ip.cfg)
    Перейти
    Основные настройки (server.cfg)
    Перейти
    Снимки консоли (StartLogs)
    Перейти
    +
    @@ -94,36 +94,36 @@

    Игроки онлайн

    - - - - - - - - - - - [players] - -
    #НикФрагиВремя
    + + + + + + + + + + + [players] + +
    #НикФрагиВремя
    \ No newline at end of file diff --git a/template/sections/servers/cssold/maps/listing.html b/template/sections/servers/cssold/maps/listing.html index 21b397f..830d9e2 100644 --- a/template/sections/servers/cssold/maps/listing.html +++ b/template/sections/servers/cssold/maps/listing.html @@ -6,60 +6,60 @@
    -

    Файл: maplist.txt

    +

    Файл: maplist.txt

    -
    +
    -
    - - - - - - - - - - - - - -
    Путь: cstrike/maplist.txt
    Сгенерировать
    -
    +
    + + + + + + + + + + + + + +
    Путь: cstrike/maplist.txt
    Сгенерировать
    +
    -
    +
    -

    Файл: mapcycle.txt

    +

    Файл: mapcycle.txt

    -
    +
    -
    - - - - - - - - - - - - - -
    Путь: cstrike/mapcycle.txt
    Сгенерировать
    -
    +
    + + + + + + + + + + + + + +
    Путь: cstrike/mapcycle.txt
    Сгенерировать
    +
    -
    +
    \ No newline at end of file diff --git a/template/sections/servers/cssold/maps/types.html b/template/sections/servers/cssold/maps/types.html index 1114f2c..e7793ab 100644 --- a/template/sections/servers/cssold/maps/types.html +++ b/template/sections/servers/cssold/maps/types.html @@ -2,61 +2,61 @@ diff --git a/template/sections/servers/cssold/owners.html b/template/sections/servers/cssold/owners.html index cd1711b..994fe8d 100644 --- a/template/sections/servers/cssold/owners.html +++ b/template/sections/servers/cssold/owners.html @@ -1,88 +1,88 @@
    -

    Добавление совладельца

    +

    Добавление совладельца

    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Логин / Ид
    Включение сервера
    Выключение сервера
    Перезагрузка сервера
    Смена карты сервера
    Переустановка сервера
    Обновление сервера
    Раздел "Консоль"
    Раздел "Настройки"
    Раздел "Плагины"
    Раздел "Карты"
    Доступ выдан до - -
    + 60 мин.
    -
    -
    -
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Логин / Ид
    Включение сервера
    Выключение сервера
    Перезагрузка сервера
    Смена карты сервера
    Переустановка сервера
    Обновление сервера
    Раздел "Консоль"
    Раздел "Настройки"
    Раздел "Плагины"
    Раздел "Карты"
    Доступ выдан до + +
    + 60 мин.
    +
    +
    +
    -

    Список совладельцев

    +

    Список совладельцев

    -
    - - - [owners] - -
    -
    +
    + + + [owners] + +
    +
    -
    -
    +
    +
    -

    Выданные права

    +

    Выданные права

    -
    -
    +
    +
    @@ -95,9 +95,9 @@ diff --git a/template/sections/servers/cssold/rcon.html b/template/sections/servers/cssold/rcon.html index b75a1fb..ca1031f 100644 --- a/template/sections/servers/cssold/rcon.html +++ b/template/sections/servers/cssold/rcon.html @@ -1,48 +1,48 @@

    Управление игроками

    - - - - - - - - - - - -
    - Выбранный игрок: - ____________ - -
    Обновить список
    -
    -
    Убить
    -
    -
    Кикнуть
    -
    -
    Забанить
    -
    -
    Заблокировать
    -
    + + + + + + + + + + + +
    + Выбранный игрок: + ____________ + +
    Обновить список
    +
    +
    Убить
    +
    +
    Кикнуть
    +
    +
    Забанить
    +
    +
    Заблокировать
    +
    -
    +
    - - - - - - - - - - - - - -
    #НикSteamIDВремяПингАдресУправление
    + + + + + + + + + + + + + +
    #НикSteamIDВремяПингАдресУправление
    @@ -60,11 +60,11 @@ \ No newline at end of file diff --git a/template/sections/servers/cssold/rcon/player.html b/template/sections/servers/cssold/rcon/player.html index e5c796f..35cd46c 100644 --- a/template/sections/servers/cssold/rcon/player.html +++ b/template/sections/servers/cssold/rcon/player.html @@ -1,18 +1,18 @@ - [i] - [name] - [steamid] - [time] - [ping]мс - - - [ip] - - - - - - - - + [i] + [name] + [steamid] + [time] + [ping]мс + + + [ip] + + + + + + + + \ No newline at end of file diff --git a/template/sections/servers/cssold/settings.html b/template/sections/servers/cssold/settings.html index 38ff095..e23c838 100644 --- a/template/sections/servers/cssold/settings.html +++ b/template/sections/servers/cssold/settings.html @@ -1,68 +1,68 @@
    [start]
    -

    Основное

    +

    Основное

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Основные настройки (SERVER.CFG)
    Настроить
    Администраторы на сервере (ADMINS_SIMPLE.INI)
    Настроить
    Забаненные на сервере (banned_user.cfg / banned_ip.cfg)
    Настроить
    Блокировка на оборудовании (FireWall)
    Настроить
    Планировщик задач (CronTab)
    Настроить

    Защита от DDoS атак

    Информация
    - -
    Сохранить

    Сборка игрового сервера

    (После изменения сборки, сервер необходимо переустановить, чтобы все изменения вступили в силу)
    - -
    Сохранить
    - |!api|Для получения ключа, необходимо активировать API|_!api| - |api|Индивидуальный ключ: [api]
    API интерфейс
    |_api| -
    - - |!api|
    Включить
    |_!api| - |api|
    Отключить
    |_api| -
    -
    -
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Основные настройки (SERVER.CFG)
    Настроить
    Администраторы на сервере (ADMINS_SIMPLE.INI)
    Настроить
    Забаненные на сервере (banned_user.cfg / banned_ip.cfg)
    Настроить
    Блокировка на оборудовании (FireWall)
    Настроить
    Планировщик задач (CronTab)
    Настроить

    Защита от DDoS атак

    Информация
    + +
    Сохранить

    Сборка игрового сервера

    (После изменения сборки, сервер необходимо переустановить, чтобы все изменения вступили в силу)
    + +
    Сохранить
    + |!api|Для получения ключа, необходимо активировать API|_!api| + |api|Индивидуальный ключ: [api]
    API интерфейс
    |_api| +
    + + |!api|
    Включить
    |_!api| + |api|
    Отключить
    |_api| +
    +
    +
    @@ -70,26 +70,26 @@

    Логи

    - - - - - - - - - - - - - - - - - - - -
    Снимки консоли (StartLogs)
    Посмотреть
    Краш сервера (debug)
    Посмотреть
    Логи игрового сервера (logs/*.log)
    Посмотреть
    Логи SourceMod (addons/sourcemod/logs/*.log)
    Посмотреть
    + + + + + + + + + + + + + + + + + + + +
    Снимки консоли (StartLogs)
    Посмотреть
    Краш сервера (debug)
    Посмотреть
    Логи игрового сервера (logs/*.log)
    Посмотреть
    Логи SourceMod (addons/sourcemod/logs/*.log)
    Посмотреть
    |edits| @@ -98,11 +98,11 @@

    Редактируемые файлы

    - - - [edits] - -
    + + + [edits] + +
    |_edits| diff --git a/template/sections/servers/cssold/settings/admins.html b/template/sections/servers/cssold/settings/admins.html index 722aba8..4e74f4a 100644 --- a/template/sections/servers/cssold/settings/admins.html +++ b/template/sections/servers/cssold/settings/admins.html @@ -1,24 +1,24 @@

    Управление администраторами на сервере

    -
    - - - - - - - - - - - - - [admins] - -
    Ник / Steam / IpПарольФлаги доступаИммунитетИстекаетПримечание
    - -
    +
    + + + + + + + + + + + + + [admins] + +
    Ник / Steam / IpПарольФлаги доступаИммунитетИстекаетПримечание
    + +
    @@ -32,7 +32,7 @@ diff --git a/template/sections/servers/cssold/settings/admins/list.html b/template/sections/servers/cssold/settings/admins/list.html index 41b6cfa..fdf8919 100644 --- a/template/sections/servers/cssold/settings/admins/list.html +++ b/template/sections/servers/cssold/settings/admins/list.html @@ -1,13 +1,13 @@ - - - - - -
    - - - - - + + + + + +
    + + + + + \ No newline at end of file diff --git a/template/sections/servers/cssold/settings/bans.html b/template/sections/servers/cssold/settings/bans.html index ed0cb40..0edf42d 100644 --- a/template/sections/servers/cssold/settings/bans.html +++ b/template/sections/servers/cssold/settings/bans.html @@ -1,29 +1,29 @@
    -

    Файл: banned_user.cfg

    +

    Файл: banned_user.cfg

    -
    -
    - - - [banned] - -
    -
    -
    +
    +
    + + + [banned] + +
    +
    +
    -

    Файл: banned_ip.cfg

    +

    Файл: banned_ip.cfg

    -
    -
    - - - [listip] - -
    -
    -
    +
    +
    + + + [listip] + +
    +
    +
    @@ -31,18 +31,18 @@

    Инструменты

    - - - - - - - - - - - -
    Разбанить
    Забанить
    Проверить
    SourceBans
    + + + + + + + + + + + +
    Разбанить
    Забанить
    Проверить
    SourceBans
    @@ -50,9 +50,9 @@ \ No newline at end of file diff --git a/template/sections/servers/cssold/settings/crontab.html b/template/sections/servers/cssold/settings/crontab.html index 16bb9f3..6577617 100644 --- a/template/sections/servers/cssold/settings/crontab.html +++ b/template/sections/servers/cssold/settings/crontab.html @@ -1,120 +1,120 @@

    Планировщик задач

    -
    - - - - - - - - - - - - - - - - - - - - - -
    Задание: - -
    Время: - - -
    :
    - - - - |!autostop| -
    Выполнять задание каждый час:
    - - |_!autostop| - -
    Время на сайте: [time]
    -
    -
    Пн. - -
    - -
    Вт. - -
    - -
    Ср. - -
    - -
    Чт. - -
    - -
    Пт. - -
    - -
    Сб. - -
    - -
    Вс. - -
    -
    - -
    -
    +
    + + + + + + + + + + + + + + + + + + + + + +
    Задание: + +
    Время: + + +
    :
    + + + + |!autostop| +
    Выполнять задание каждый час:
    + + |_!autostop| + +
    Время на сайте: [time]
    +
    +
    Пн. + +
    + +
    Вт. + +
    + +
    Ср. + +
    + +
    Чт. + +
    + +
    Пт. + +
    + +
    Сб. + +
    + +
    Вс. + +
    +
    + +
    +
    @@ -122,27 +122,27 @@

    Список добавленных задач

    - - - - - - - - - - [crontab] - -
    ЗаданиеВремяДни недели
    + + + + + + + + + + [crontab] + +
    ЗаданиеВремяДни недели
    \ No newline at end of file diff --git a/template/sections/servers/cssold/settings/servercfg.html b/template/sections/servers/cssold/settings/servercfg.html index fcadf5e..93d2269 100644 --- a/template/sections/servers/cssold/settings/servercfg.html +++ b/template/sections/servers/cssold/settings/servercfg.html @@ -1,23 +1,23 @@

    Параметры server.cfg

    -
    - - - [cfg] - - - - - - - -
    - -
    - -
    -
    +
    + + + [cfg] + + + + + + + +
    + +
    + +
    +
    diff --git a/template/sections/servers/cssold/settings/start.html b/template/sections/servers/cssold/settings/start.html index 8294540..0dcbac8 100644 --- a/template/sections/servers/cssold/settings/start.html +++ b/template/sections/servers/cssold/settings/start.html @@ -1,106 +1,106 @@

    Параметры запуска

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |tickrate| - - - - - - - - - |_tickrate| - |fps| - - - - - - - - - |_fps| - -
    Стартовая карта
    - - - -
    Количество слот
    - - - -
    Античит VAC
    - - - -
    Быстрая скачка файлов с сервера (FastDL)
    - - - -
    Авторестарт при зависании
    - - - -
    Значение TickRate
    - - - -
    Значение FPS
    - - - -
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + |tickrate| + + + + + + + + + |_tickrate| + |fps| + + + + + + + + + |_fps| + +
    Стартовая карта
    + + + +
    Количество слот
    + + + +
    Античит VAC
    + + + +
    Быстрая скачка файлов с сервера (FastDL)
    + + + +
    Авторестарт при зависании
    + + + +
    Значение TickRate
    + + + +
    Значение FPS
    + + + +
    \ No newline at end of file diff --git a/template/sections/servers/cssold/vmenu.html b/template/sections/servers/cssold/vmenu.html index 2e81499..de4fa0c 100644 --- a/template/sections/servers/cssold/vmenu.html +++ b/template/sections/servers/cssold/vmenu.html @@ -1,16 +1,16 @@
    -
    Управление
    - +
    Управление
    +
    \ No newline at end of file diff --git a/template/sections/servers/games/copy/copy.html b/template/sections/servers/games/copy/copy.html index e2f5cd1..794ede0 100644 --- a/template/sections/servers/games/copy/copy.html +++ b/template/sections/servers/games/copy/copy.html @@ -1,23 +1,23 @@ - - Игровой cервер: #[server] -

    Содержимое: [info]

    - - [date] - - |created| -
    - -
    -
    - -
    -
    - -
    - |_created| - |!created| - Создается... - |_!created| - + + Игровой cервер: #[server] +

    Содержимое: [info]

    + + [date] + + |created| +
    + +
    +
    + +
    +
    + +
    + |_created| + |!created| + Создается... + |_!created| + \ No newline at end of file diff --git a/template/sections/servers/games/copy/list.html b/template/sections/servers/games/copy/list.html index 558c7a0..753cfdb 100644 --- a/template/sections/servers/games/copy/list.html +++ b/template/sections/servers/games/copy/list.html @@ -1,9 +1,9 @@ - - [name] -

    [info]

    - - - - + + [name] +

    [info]

    + + + + \ No newline at end of file diff --git a/template/sections/servers/games/filetp/filetp_back.html b/template/sections/servers/games/filetp/filetp_back.html index bc6b709..f183257 100644 --- a/template/sections/servers/games/filetp/filetp_back.html +++ b/template/sections/servers/games/filetp/filetp_back.html @@ -1,3 +1,3 @@ -

    ..

    +

    ..

    \ No newline at end of file diff --git a/template/sections/servers/games/filetp/filetp_find.html b/template/sections/servers/games/filetp/filetp_find.html index 60ae5f8..9e4bab6 100644 --- a/template/sections/servers/games/filetp/filetp_find.html +++ b/template/sections/servers/games/filetp/filetp_find.html @@ -1,21 +1,21 @@ - - |file||edit||_edit||_file| - |folder||_folder| -

    - - [find] -

    - |folder|
    |_folder| - |file||edit||_edit||_file| - - [size] - [chmod] - [owner] / [group] - [time] - [day] [month] - -
    -
    -
    - + + |file||edit||_edit||_file| + |folder||_folder| +

    + + [find] +

    + |folder|
    |_folder| + |file||edit||_edit||_file| + + [size] + [chmod] + [owner] / [group] + [time] - [day] [month] + +
    +
    +
    + \ No newline at end of file diff --git a/template/sections/servers/games/filetp/filetp_list.html b/template/sections/servers/games/filetp/filetp_list.html index 9766391..abf413c 100644 --- a/template/sections/servers/games/filetp/filetp_list.html +++ b/template/sections/servers/games/filetp/filetp_list.html @@ -1,21 +1,21 @@ - - |file||edit||_edit||_file| - |folder||_folder| -

    - - [name] -

    - |folder|
    |_folder| - |file||edit||_edit||_file| - - [size] - [chmod] - [owner] / [group] - [time] - [day] [month] - -
    -
    -
    - + + |file||edit||_edit||_file| + |folder||_folder| +

    + + [name] +

    + |folder|
    |_folder| + |file||edit||_edit||_file| + + [size] + [chmod] + [owner] / [group] + [time] - [day] [month] + +
    +
    +
    + \ No newline at end of file diff --git a/template/sections/servers/games/filetp/filetp_logs.html b/template/sections/servers/games/filetp/filetp_logs.html index 98f8e89..8c4d9da 100644 --- a/template/sections/servers/games/filetp/filetp_logs.html +++ b/template/sections/servers/games/filetp/filetp_logs.html @@ -1,8 +1,8 @@ - [file] - [size] - [action] - [acticon] - [who] - [day].[month].[year] - [time] + [file] + [size] + [action] + [acticon] + [who] + [day].[month].[year] - [time] \ No newline at end of file diff --git a/template/sections/servers/games/filetp/filetp_off.html b/template/sections/servers/games/filetp/filetp_off.html index 5c41667..cd5fd75 100644 --- a/template/sections/servers/games/filetp/filetp_off.html +++ b/template/sections/servers/games/filetp/filetp_off.html @@ -1,16 +1,16 @@

    Информация

    - - - - - - - -
    -

    При включенном FTP, вы получаете данные для подключения к директории вашего игрового сервера через FTP-клиент, например FileZilla. - При обнаружении каких-либо проблем тех.поддержка вправе отказать в помощи, все проблемы с настройками сервера вам придется решать самостоятельно. - Если у вас недостаточно знаний в настройке игрового сервера, рекомендуем не включать FTP.

    -
    Включить
    + + + + + + + +
    +

    При включенном FTP, вы получаете данные для подключения к директории вашего игрового сервера через FTP-клиент, например FileZilla. + При обнаружении каких-либо проблем тех.поддержка вправе отказать в помощи, все проблемы с настройками сервера вам придется решать самостоятельно. + Если у вас недостаточно знаний в настройке игрового сервера, рекомендуем не включать FTP.

    +
    Включить
    diff --git a/template/sections/servers/games/filetp/filetp_on.html b/template/sections/servers/games/filetp/filetp_on.html index afb20ca..e9b1c50 100644 --- a/template/sections/servers/games/filetp/filetp_on.html +++ b/template/sections/servers/games/filetp/filetp_on.html @@ -1,56 +1,56 @@

    Информация

    - - - - - - - - - - - - - - - - - - + + +
    Сервер:[server]:21
    Выключить
    Логин:[login]
    Пароль: - [passwd] - сменить -
    Адрес: - [address]:21 + + + + + + + + + + + + + + + + + + - - -
    Сервер:[server]:21
    Выключить
    Логин:[login]
    Пароль: + [passwd] + сменить +
    Адрес: + [address]:21 - показать логи операций -
    + показать логи операций +
    -
    +
    -

    Последние операции

    +

    Последние операции

    -
    - - - - - - - - - - - - -
    ФайлРазмерДействиеИнициаторДата
    -
    +
    + + + + + + + + + + + + +
    ФайлРазмерДействиеИнициаторДата
    +
    @@ -58,62 +58,62 @@

    Файловый менеджер

    -
    Обновить
    +
    Обновить
    -
    Создать папку
    -
    Создать файл
    +
    Создать папку
    +
    Создать файл
    -
    - -
    +
    + +
    -
    - - - - - - - - - - - -
    НазваниеРазмерПраваВладелец / ГруппаПоследнее изменение
    +
    + + + + + + + + + + + +
    НазваниеРазмерПраваВладелец / ГруппаПоследнее изменение
    -
    - - -
    -
    +
    + + +
    +
    -
    -
    +
    +
    -
    -
    +
    +
    - - - - - - - - - - - - -
    Файл:
    - -
    - -
    Отмена
    -
    - - -
    + + + + + + + + + + + + +
    Файл:
    + +
    + +
    Отмена
    +
    + + +
    @@ -122,19 +122,19 @@ \ No newline at end of file diff --git a/template/sections/servers/games/graph.html b/template/sections/servers/games/graph.html index d649a1b..3cfa89b 100644 --- a/template/sections/servers/games/graph.html +++ b/template/sections/servers/games/graph.html @@ -1,7 +1,7 @@

    График за последние 24 часа

    - +
    @@ -9,7 +9,7 @@

    График за последние 7 дней

    - +
    @@ -17,7 +17,7 @@

    График за последние 30 дней

    - +
    @@ -25,52 +25,52 @@

    Баннеры 160x248

    - - - - - + + +
    - - - - + + + + + - - - - + + + + - - - - + + + + - - -
    + + + + -
    +
    - - -
    - - - - + + +
    + + + + -
    +
    - - -
    - - - - + + +
    + + + + -
    +
    - - -
    + + +
    @@ -78,58 +78,58 @@

    Баннеры 560x95

    - - - - - - - + + +
    - -
    - - + + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - -
    + +
    + + -
    +
    - - -
    - -
    - - + + +
    + +
    + + -
    +
    - - -
    - -
    - - + + +
    + +
    + + -
    +
    - - -
    + + +
    diff --git a/template/sections/servers/games/maps.html b/template/sections/servers/games/maps.html index 1d05c03..956ab78 100644 --- a/template/sections/servers/games/maps.html +++ b/template/sections/servers/games/maps.html @@ -6,24 +6,24 @@
    -
    Выделить все
    +
    Выделить все
    -
    Отменить выделение
    +
    Отменить выделение
    - + -
    +
    -

    Список установленных карт

    +

    Список установленных карт

    -
    [maps]
    +
    [maps]
    diff --git a/template/sections/servers/games/maps/install.html b/template/sections/servers/games/maps/install.html index 8173648..d8fcde9 100644 --- a/template/sections/servers/games/maps/install.html +++ b/template/sections/servers/games/maps/install.html @@ -9,36 +9,36 @@

    Поиск по картам

    - - - - - - - -
    Найти
    + + + + + + + +
    Найти
    -
    + -
    Выделить все
    +
    Выделить все
    -
    Отменить выделение
    +
    Отменить выделение
    - + -
    +
    -

    Результаты поиска

    +

    Результаты поиска

    -
    +
    -
    +
    -
    +
    @@ -64,13 +64,13 @@ [pages] diff --git a/template/sections/servers/games/maps/map_install.html b/template/sections/servers/games/maps/map_install.html index c92559b..7c4e5ad 100644 --- a/template/sections/servers/games/maps/map_install.html +++ b/template/sections/servers/games/maps/map_install.html @@ -1,8 +1,8 @@
    -
    - - - [name] - -
    +
    + + + [name] + +
    \ No newline at end of file diff --git a/template/sections/servers/games/maps/map_search.html b/template/sections/servers/games/maps/map_search.html index c92559b..7c4e5ad 100644 --- a/template/sections/servers/games/maps/map_search.html +++ b/template/sections/servers/games/maps/map_search.html @@ -1,8 +1,8 @@
    -
    - - - [name] - -
    +
    + + + [name] + +
    \ No newline at end of file diff --git a/template/sections/servers/games/maps/map_server.html b/template/sections/servers/games/maps/map_server.html index 72fd5e5..5c8e977 100644 --- a/template/sections/servers/games/maps/map_server.html +++ b/template/sections/servers/games/maps/map_server.html @@ -1,10 +1,10 @@
    -
    - - - [name] - -
    +
    + + + [name] + +
    \ No newline at end of file diff --git a/template/sections/servers/games/owners/access.html b/template/sections/servers/games/owners/access.html index 3baadd8..0f8ac33 100644 --- a/template/sections/servers/games/owners/access.html +++ b/template/sections/servers/games/owners/access.html @@ -1,4 +1,4 @@ - [info] - + [info] + \ No newline at end of file diff --git a/template/sections/servers/games/owners/index.html b/template/sections/servers/games/owners/index.html index 8b8b17b..07f25fd 100644 --- a/template/sections/servers/games/owners/index.html +++ b/template/sections/servers/games/owners/index.html @@ -1,49 +1,49 @@
    -

    Добавление совладельца

    +

    Добавление совладельца

    -
    -
    - - - - - - - [access] - - - - - - - - -
    Логин / Ид
    Доступ выдан до - -
    + 60 мин.
    -
    -
    -
    +
    +
    + + + + + + + [access] + + + + + + + + +
    Логин / Ид
    Доступ выдан до + +
    + 60 мин.
    +
    +
    +
    -

    Список совладельцев

    +

    Список совладельцев

    -
    - - - [owners] - -
    -
    +
    + + + [owners] + +
    +
    -
    -
    +
    +
    -

    Выданные права

    +

    Выданные права

    -
    -
    +
    +
    @@ -56,9 +56,9 @@ diff --git a/template/sections/servers/games/owners/owners.html b/template/sections/servers/games/owners/owners.html index c4889aa..1b46414 100644 --- a/template/sections/servers/games/owners/owners.html +++ b/template/sections/servers/games/owners/owners.html @@ -1,6 +1,6 @@ - [user] - [rights] - [time] -
    Удалить
    + [user] + [rights] + [time] +
    Удалить
    \ No newline at end of file diff --git a/template/sections/servers/games/plugins.html b/template/sections/servers/games/plugins.html index 71861e7..4d93934 100644 --- a/template/sections/servers/games/plugins.html +++ b/template/sections/servers/games/plugins.html @@ -1,30 +1,30 @@

    Поиск по плагинам

    - - - - - - - -
    Найти
    + + + + + + + +
    Найти
    -

    Результаты поиска

    -
    -
    +

    Результаты поиска

    +
    +

    Доступные плагины

    -
    -
    [addons]
    -
    +
    +
    [addons]
    +
    @@ -40,42 +40,42 @@ \ No newline at end of file diff --git a/template/sections/servers/games/plugins/category.html b/template/sections/servers/games/plugins/category.html index 7b486f0..434f6d8 100644 --- a/template/sections/servers/games/plugins/category.html +++ b/template/sections/servers/games/plugins/category.html @@ -1,4 +1,4 @@
    - [name] -
    [plugins]
    + [name] +
    [plugins]
    \ No newline at end of file diff --git a/template/sections/servers/games/plugins/config.html b/template/sections/servers/games/plugins/config.html index 924a7a3..39f6410 100644 --- a/template/sections/servers/games/plugins/config.html +++ b/template/sections/servers/games/plugins/config.html @@ -1,15 +1,15 @@
    -

    [name]

    +

    [name]

    -
    - -
    +
    + +
    -
    +
    -
    Вернуться к списку
    +
    Вернуться к списку
    - +
    \ No newline at end of file diff --git a/template/sections/servers/games/plugins/config_list.html b/template/sections/servers/games/plugins/config_list.html index 5ebf03d..9590dea 100644 --- a/template/sections/servers/games/plugins/config_list.html +++ b/template/sections/servers/games/plugins/config_list.html @@ -1,9 +1,9 @@ - - [name] -

    [file]

    - - -
    Редактировать
    - + + [name] +

    [file]

    + + +
    Редактировать
    + \ No newline at end of file diff --git a/template/sections/servers/games/plugins/configs.html b/template/sections/servers/games/plugins/configs.html index 5e24d02..e99d691 100644 --- a/template/sections/servers/games/plugins/configs.html +++ b/template/sections/servers/games/plugins/configs.html @@ -1,14 +1,14 @@

    Информация

    - Плагин: [name] -

    [info]

    + Плагин: [name] +

    [info]

    - |images| -
    + |images| +
    -
    [images]
    - |_images| +
    [images]
    + |_images|
    |configs| @@ -17,11 +17,11 @@

    Редактируемые файлы

    - - - [configs] - -
    + + + [configs] + +
    |_configs| @@ -34,15 +34,15 @@ \ No newline at end of file diff --git a/template/sections/servers/games/plugins/plugin.html b/template/sections/servers/games/plugins/plugin.html index bdd9e68..2b9d8a4 100644 --- a/template/sections/servers/games/plugins/plugin.html +++ b/template/sections/servers/games/plugins/plugin.html @@ -1,13 +1,13 @@
    -
    - [name] -

    [desc]

    - |stable| Стабильный|_stable| - |unstable| Нестабильный|_unstable| - |testing| Тестируемый|_testing| -
    -
    -
    Установить
    -
    - |images|
    [images]
    |_images| +
    + [name] +

    [desc]

    + |stable| Стабильный|_stable| + |unstable| Нестабильный|_unstable| + |testing| Тестируемый|_testing| +
    +
    +
    Установить
    +
    + |images|
    [images]
    |_images|
    \ No newline at end of file diff --git a/template/sections/servers/games/plugins/plugin_install.html b/template/sections/servers/games/plugins/plugin_install.html index fb75d8c..501b475 100644 --- a/template/sections/servers/games/plugins/plugin_install.html +++ b/template/sections/servers/games/plugins/plugin_install.html @@ -1,14 +1,14 @@
    -
    - [name] (Установлен: [time]) -

    [desc]

    - |stable| Стабильный|_stable| - |unstable| Нестабильный|_unstable| - |testing| Тестируемый|_testing| - |update| Есть обновление|_update| -
    -
    - |config|
    Настроить
    |_config| -
    Удалить
    -
    +
    + [name] (Установлен: [time]) +

    [desc]

    + |stable| Стабильный|_stable| + |unstable| Нестабильный|_unstable| + |testing| Тестируемый|_testing| + |update| Есть обновление|_update| +
    +
    + |config|
    Настроить
    |_config| +
    Удалить
    +
    \ No newline at end of file diff --git a/template/sections/servers/games/plugins/search.html b/template/sections/servers/games/plugins/search.html index ad06926..80d1821 100644 --- a/template/sections/servers/games/plugins/search.html +++ b/template/sections/servers/games/plugins/search.html @@ -1,19 +1,19 @@
    -
    - [name]|install| (Установлен: [time])|_install| -

    [desc]

    - |stable| Стабильный|_stable| - |unstable| Нестабильный|_unstable| - |testing| Тестируемый|_testing| - |install| - |update| Есть обновление|_update| - |_install| -
    -
    - |!install|
    Установить
    |_!install| - |install| - |config|
    Настроить
    |_config| -
    Удалить
    - |_install| -
    +
    + [name]|install| (Установлен: [time])|_install| +

    [desc]

    + |stable| Стабильный|_stable| + |unstable| Нестабильный|_unstable| + |testing| Тестируемый|_testing| + |install| + |update| Есть обновление|_update| + |_install| +
    +
    + |!install|
    Установить
    |_!install| + |install| + |config|
    Настроить
    |_config| +
    Удалить
    + |_install| +
    \ No newline at end of file diff --git a/template/sections/servers/games/settings/bans_list.html b/template/sections/servers/games/settings/bans_list.html index f8bb717..5206d5b 100644 --- a/template/sections/servers/games/settings/bans_list.html +++ b/template/sections/servers/games/settings/bans_list.html @@ -1,4 +1,4 @@ -
    [value]
    -
    Разбанить
    +
    [value]
    +
    Разбанить
    \ No newline at end of file diff --git a/template/sections/servers/games/settings/crontab_list.html b/template/sections/servers/games/settings/crontab_list.html index 60cae46..0675f98 100644 --- a/template/sections/servers/games/settings/crontab_list.html +++ b/template/sections/servers/games/settings/crontab_list.html @@ -1,8 +1,8 @@ - [task] - [time] - -
    [week]
    -
    Удалить
    - + [task] + [time] + +
    [week]
    +
    Удалить
    + \ No newline at end of file diff --git a/template/sections/servers/games/settings/debug.html b/template/sections/servers/games/settings/debug.html index 6b54f89..a9e6f07 100644 --- a/template/sections/servers/games/settings/debug.html +++ b/template/sections/servers/games/settings/debug.html @@ -1,7 +1,7 @@

    Отладочный лог (debug)

    - +
    diff --git a/template/sections/servers/games/settings/edits_list.html b/template/sections/servers/games/settings/edits_list.html index 2f65da0..c1761fe 100644 --- a/template/sections/servers/games/settings/edits_list.html +++ b/template/sections/servers/games/settings/edits_list.html @@ -1,7 +1,7 @@ - -
    [name]
    -

    [desc]

    - -
    Редактировать
    + +
    [name]
    +

    [desc]

    + +
    Редактировать
    \ No newline at end of file diff --git a/template/sections/servers/games/settings/file.html b/template/sections/servers/games/settings/file.html index 6209bbc..be626e7 100644 --- a/template/sections/servers/games/settings/file.html +++ b/template/sections/servers/games/settings/file.html @@ -1,13 +1,13 @@
    -

    [file]

    +

    [file]

    -
    - -
    +
    + +
    -
    +
    - +
    \ No newline at end of file diff --git a/template/sections/servers/games/settings/firewall.html b/template/sections/servers/games/settings/firewall.html index dd67839..8b88ec6 100644 --- a/template/sections/servers/games/settings/firewall.html +++ b/template/sections/servers/games/settings/firewall.html @@ -1,65 +1,65 @@

    Блокировка злоумышленников на оборудовании

    - - - - - - - -
    - - [firewall] -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - Блокировка одиночного адреса -
    - Блокировка подсети (автоопределение) -
    - Вывод информация об указанном адресе -
    -
    + + + + + + + +
    + + [firewall] +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + Блокировка одиночного адреса +
    + Блокировка подсети (автоопределение) +
    + Вывод информация об указанном адресе +
    +
    \ No newline at end of file diff --git a/template/sections/servers/games/settings/firewall/list.html b/template/sections/servers/games/settings/firewall/list.html index e717a4f..90b64c5 100644 --- a/template/sections/servers/games/settings/firewall/list.html +++ b/template/sections/servers/games/settings/firewall/list.html @@ -1,4 +1,4 @@ -
    [address]
    - +
    [address]
    + \ No newline at end of file diff --git a/template/sections/servers/games/settings/logs.html b/template/sections/servers/games/settings/logs.html index 0e11817..5ade93f 100644 --- a/template/sections/servers/games/settings/logs.html +++ b/template/sections/servers/games/settings/logs.html @@ -5,19 +5,19 @@

    Список лог файлов игрового сервера

    - - - - - - - - - - - [logs] - -
    Лог файлРазмерДата
    + + + + + + + + + + + [logs] + +
    Лог файлРазмерДата
    diff --git a/template/sections/servers/games/settings/logs/list.html b/template/sections/servers/games/settings/logs/list.html index 2e31a59..12cf3f2 100644 --- a/template/sections/servers/games/settings/logs/list.html +++ b/template/sections/servers/games/settings/logs/list.html @@ -1,10 +1,10 @@ - [name] - [size] - [date] - - -
    Подробнее
    -
    - + [name] + [size] + [date] + + +
    Подробнее
    +
    + \ No newline at end of file diff --git a/template/sections/servers/games/settings/logs/view.html b/template/sections/servers/games/settings/logs/view.html index b1c0180..658cd39 100644 --- a/template/sections/servers/games/settings/logs/view.html +++ b/template/sections/servers/games/settings/logs/view.html @@ -1,7 +1,7 @@

    Файл: [name]

    - +
    diff --git a/template/sections/servers/games/settings/servercfg_list.html b/template/sections/servers/games/settings/servercfg_list.html index 9daeb62..2c8a2b5 100644 --- a/template/sections/servers/games/settings/servercfg_list.html +++ b/template/sections/servers/games/settings/servercfg_list.html @@ -1,7 +1,7 @@ - - [name] -

    [desc] - - [form] + + [name] +

    [desc] + + [form] \ No newline at end of file diff --git a/template/sections/servers/games/settings/startlogs.html b/template/sections/servers/games/settings/startlogs.html index 296ff29..ce1aec8 100644 --- a/template/sections/servers/games/settings/startlogs.html +++ b/template/sections/servers/games/settings/startlogs.html @@ -5,17 +5,17 @@

    Снимки предудыщих запусков игрового сервера

    - - - - - - - - - - - [logs] - -
    Лог файлРазмерДата
    + + + + + + + + + + + [logs] + +
    Лог файлРазмерДата
    \ No newline at end of file diff --git a/template/sections/servers/games/settings/startlogs/list.html b/template/sections/servers/games/settings/startlogs/list.html index 0cb564a..c478034 100644 --- a/template/sections/servers/games/settings/startlogs/list.html +++ b/template/sections/servers/games/settings/startlogs/list.html @@ -1,10 +1,10 @@ - [name] - [size] - [date] - - |download|
    Посмотреть
    |_download| - |!download|
    Включите_FTP
    |_!download| - - + [name] + [size] + [date] + + |download|
    Посмотреть
    |_download| + |!download|
    Включите_FTP
    |_!download| + + \ No newline at end of file diff --git a/template/sections/servers/games/tarif.html b/template/sections/servers/games/tarif.html index 54c31a4..1c6b4b8 100644 --- a/template/sections/servers/games/tarif.html +++ b/template/sections/servers/games/tarif.html @@ -1,5 +1,5 @@ \ No newline at end of file diff --git a/template/sections/servers/games/tarif/addextend.html b/template/sections/servers/games/tarif/addextend.html index 4fc4e9b..3ce4ebe 100644 --- a/template/sections/servers/games/tarif/addextend.html +++ b/template/sections/servers/games/tarif/addextend.html @@ -1,27 +1,27 @@

    Продление выделенного адреса

    - - - - - - - - - - - - -
    - Осталось: [time] - Цена продления за 30 дней: [price] [cur] -
    - - -
    -
    Продлить аренду
    -
    + + + + + + + + + + + + +
    + Осталось: [time] + Цена продления за 30 дней: [price] [cur] +
    + + +
    +
    Продлить аренду
    +
    \ No newline at end of file diff --git a/template/sections/servers/games/tarif/address.html b/template/sections/servers/games/tarif/address.html index 1ecd87a..280658b 100644 --- a/template/sections/servers/games/tarif/address.html +++ b/template/sections/servers/games/tarif/address.html @@ -1,30 +1,30 @@

    Аренда выделенного адреса

    - - - - - - - - - - - - -
    - Текущий адрес: [address] - Цена аренды выделенного адреса |mounth|за 30 дней|_mounth|: 0 [cur] -
    - - -
    - |!mounth|Выделенный адрес будет установлен на весь период аренды игрового сервера.|_!mounth| -
    Арендовать адрес
    -
    + + + + + + + + + + + + +
    + Текущий адрес: [address] + Цена аренды выделенного адреса |mounth|за 30 дней|_mounth|: 0 [cur] +
    + + +
    + |!mounth|Выделенный адрес будет установлен на весь период аренды игрового сервера.|_!mounth| +
    Арендовать адрес
    +
    \ No newline at end of file diff --git a/template/sections/servers/games/tarif/address_extend.html b/template/sections/servers/games/tarif/address_extend.html index 4fc4e9b..3ce4ebe 100644 --- a/template/sections/servers/games/tarif/address_extend.html +++ b/template/sections/servers/games/tarif/address_extend.html @@ -1,27 +1,27 @@

    Продление выделенного адреса

    - - - - - - - - - - - - -
    - Осталось: [time] - Цена продления за 30 дней: [price] [cur] -
    - - -
    -
    Продлить аренду
    -
    + + + + + + + + + + + + +
    + Осталось: [time] + Цена продления за 30 дней: [price] [cur] +
    + + +
    +
    Продлить аренду
    +
    \ No newline at end of file diff --git a/template/sections/servers/games/tarif/extend.html b/template/sections/servers/games/tarif/extend.html index 1fb60b2..32eb54c 100644 --- a/template/sections/servers/games/tarif/extend.html +++ b/template/sections/servers/games/tarif/extend.html @@ -1,44 +1,44 @@

    Продление аренды сервера

    -
    - - - - - - - - - |extend_address| - [extend_address] - |_extend_address| - - - - - - - - -
    - Слот: [slots]шт. / Тариф: [tarif] / Осталось: [time] / [info] - Цена за выбранный период: 0 [cur] -
    - - -
    - - - -
    Проверить
    -
    - - -
    -
    +
    + + + + + + + + + |extend_address| + [extend_address] + |_extend_address| + + + + + + + + +
    + Слот: [slots]шт. / Тариф: [tarif] / Осталось: [time] / [info] + Цена за выбранный период: 0 [cur] +
    + + +
    + + + +
    Проверить
    +
    + + +
    +
    diff --git a/template/sections/servers/games/tarif/extend_address.html b/template/sections/servers/games/tarif/extend_address.html index 1a1c8f4..9ee455c 100644 --- a/template/sections/servers/games/tarif/extend_address.html +++ b/template/sections/servers/games/tarif/extend_address.html @@ -1,9 +1,9 @@ - - - - - - - + + + + + + + \ No newline at end of file diff --git a/template/sections/servers/games/tarif/extend_sp.html b/template/sections/servers/games/tarif/extend_sp.html index 7651741..46612bc 100644 --- a/template/sections/servers/games/tarif/extend_sp.html +++ b/template/sections/servers/games/tarif/extend_sp.html @@ -1,50 +1,50 @@

    Продление аренды сервера

    -
    - - - - - - - + + |extend_address| + [extend_address] + |_extend_address| + + + + + + + + +
    - Слот: [slots]шт. / Тариф: [tarif] / Осталось: [time] / [info] - Итого к оплате: 0 [cur] -
    -

    [date]

    -

    Цена за месяц: [sum] [cur]

    + + + + + + + + - - |extend_address| - [extend_address] - |_extend_address| - - - - - - - - -
    + Слот: [slots]шт. / Тариф: [tarif] / Осталось: [time] / [info] + Итого к оплате: 0 [cur] +
    +

    [date]

    +

    Цена за месяц: [sum] [cur]

    -
    +
    -
    -

    Система оплаты работает по расчетному периоду.

    -

    При оплате до 15-го числа взымается плата за остаток текущего месяца.

    -

    При оплате после 15-го числа взымается плата за остаток текущего месяца + следующий месяц.

    -
    -
    - - - -
    Проверить
    -
    - - -
    - +
    +

    Система оплаты работает по расчетному периоду.

    +

    При оплате до 15-го числа взымается плата за остаток текущего месяца.

    +

    При оплате после 15-го числа взымается плата за остаток текущего месяца + следующий месяц.

    +
    +
    + + + +
    Проверить
    +
    + + +
    +
    diff --git a/template/sections/servers/games/tarif/plan.html b/template/sections/servers/games/tarif/plan.html index 3f8171f..8dd70d9 100644 --- a/template/sections/servers/games/tarif/plan.html +++ b/template/sections/servers/games/tarif/plan.html @@ -1,30 +1,30 @@

    Смена тарифного плана

    - - - - - - - - - - - - - -
    - Текущий тарифный план: [tarif] / [info] - -
    - - -
    Внимание: при смене тарифного плана, вычитается дополнительный день. -
    Сменить план
    -
    + + + + + + + + + + + + + +
    + Текущий тарифный план: [tarif] / [info] + +
    + + +
    Внимание: при смене тарифного плана, вычитается дополнительный день. +
    Сменить план
    +
    \ No newline at end of file diff --git a/template/sections/servers/games/tarif/slots.html b/template/sections/servers/games/tarif/slots.html index b6f27c2..8e471a9 100644 --- a/template/sections/servers/games/tarif/slots.html +++ b/template/sections/servers/games/tarif/slots.html @@ -1,30 +1,30 @@

    Смена количества слот

    - - - - - - - - - - - - - -
    - Текущее количество слот: [slots]шт. - -
    - - -
    Внимание: при смене количества игровых слот, вычитается один дополнительный день аренды. -
    Сменить слоты
    -
    + + + + + + + + + + + + + +
    + Текущее количество слот: [slots]шт. + +
    + + +
    Внимание: при смене количества игровых слот, вычитается один дополнительный день аренды. +
    Сменить слоты
    +
    \ No newline at end of file diff --git a/template/sections/servers/games/tarif/slots_buy.html b/template/sections/servers/games/tarif/slots_buy.html index 23c67ae..c845779 100644 --- a/template/sections/servers/games/tarif/slots_buy.html +++ b/template/sections/servers/games/tarif/slots_buy.html @@ -1,29 +1,29 @@

    Добавление слот

    - - - - - - - - - - - - -
    - Текущее количество слот: [slots]шт. - -
    - - -
    -
    Добавить слоты
    -
    + + + + + + + + + + + + +
    + Текущее количество слот: [slots]шт. + +
    + + +
    +
    Добавить слоты
    +
    \ No newline at end of file diff --git a/template/sections/servers/games/tarif/unit.html b/template/sections/servers/games/tarif/unit.html index 4eb8eeb..f226570 100644 --- a/template/sections/servers/games/tarif/unit.html +++ b/template/sections/servers/games/tarif/unit.html @@ -1,36 +1,36 @@

    Смена физического расположения

    - - - - - - - - - - - - - - - - -
    - Текущая локация: [unit] / Слот: [slots]шт. / Тариф: [tarif] / [info] - -
    - - -
    - - -
    Внимание: при смене локации, вычитается один дополнительный день аренды.

    Меняется полностью адрес сервера, все файлы будут удалены.

    -
    Сменить локацию
    -
    + + + + + + + + + + + + + + + + +
    + Текущая локация: [unit] / Слот: [slots]шт. / Тариф: [tarif] / [info] + +
    + + +
    + + +
    Внимание: при смене локации, вычитается один дополнительный день аренды.

    Меняется полностью адрес сервера, все файлы будут удалены.

    +
    Сменить локацию
    +
    \ No newline at end of file diff --git a/template/sections/servers/games/web/block.html b/template/sections/servers/games/web/block.html index 82b3225..ba68a0d 100644 --- a/template/sections/servers/games/web/block.html +++ b/template/sections/servers/games/web/block.html @@ -1,11 +1,11 @@

    [name]

    - - - [list] - -
    + + + [list] + +
    \ No newline at end of file diff --git a/template/sections/servers/games/web/list.html b/template/sections/servers/games/web/list.html index 7d8f0be..7f8ce9e 100644 --- a/template/sections/servers/games/web/list.html +++ b/template/sections/servers/games/web/list.html @@ -1,4 +1,4 @@ - [name] - [desc] -
    Установить
    + [name] - [desc] +
    Установить
    \ No newline at end of file diff --git a/template/sections/servers/games/web/list_install.html b/template/sections/servers/games/web/list_install.html index ef6c13b..e54b90a 100644 --- a/template/sections/servers/games/web/list_install.html +++ b/template/sections/servers/games/web/list_install.html @@ -1,4 +1,4 @@ - [name] - [desc] -
    Управление
    + [name] - [desc] +
    Управление
    \ No newline at end of file diff --git a/template/sections/servers/list.html b/template/sections/servers/list.html index 9b1c5d4..ed87328 100644 --- a/template/sections/servers/list.html +++ b/template/sections/servers/list.html @@ -1,40 +1,40 @@

    Игровой сервер: #[id]

    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    [name]
    Игра: [game] (id: [id])Создан: [date]
    Адрес: [address]Локация: [unit]Арендован до: [time]
    [status]Сборка: [pack][time_end]
    - Онлайн: [online] / [slots] -
    x
    -
    -
    Тариф: [tarif]
    [btn]
    Управление сервером
    -
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    [name]
    Игра: [game] (id: [id])Создан: [date]
    Адрес: [address]Локация: [unit]Арендован до: [time]
    [status]Сборка: [pack][time_end]
    + Онлайн: [online] / [slots] +
    x
    +
    +
    Тариф: [tarif]
    [btn]
    Управление сервером
    +
    \ No newline at end of file diff --git a/template/sections/servers/mc/console.html b/template/sections/servers/mc/console.html index 2152793..eb3e6b2 100644 --- a/template/sections/servers/mc/console.html +++ b/template/sections/servers/mc/console.html @@ -1,51 +1,51 @@

    Интерактивная консоль

    -
    - -
    ...
    +
    + +
    ...
    - +

    Цвет консоли:

    -
    +
    -
    +
    - - - -
    - - - - - - - - - -
    Обновление
    -
    -
    + + + +
    + + + + + + + + + +
    Обновление
    +
    +
    @@ -69,42 +69,42 @@ white-space: pre-wrap; word-break: break-all; } - + .console_hover { - background: #9b9f9e; + background: #9b9f9e; } .console_slategray { - background: #708090; + background: #708090; } .console_maroon { - background: #800000; + background: #800000; } .console_green { - background: #03aa46; + background: #03aa46; } .console_olive { - background: #808000; + background: #808000; } .console_yellow { - background: #ffcc3c; + background: #ffcc3c; } .console_tan { - background: #D2B48C; -} + background: #D2B48C; +} .console_red { - background: #f94747; + background: #f94747; } .console_blue { - background: #558efa; + background: #558efa; } .console_skyblue { - background: #87CEEB; -} + background: #87CEEB; +} .console_darkgreen { - background: #006400; -} + background: #006400; +} .console_lime { - background: #00FF00; + background: #00FF00; } \ No newline at end of file diff --git a/template/sections/servers/mc/copy.html b/template/sections/servers/mc/copy.html index 7281ede..d09e9fd 100644 --- a/template/sections/servers/mc/copy.html +++ b/template/sections/servers/mc/copy.html @@ -1,19 +1,19 @@

    Создание полной копии

    - - - - - - - -
    - csgo -

    Все содержимое директории csgo

    -
    -
    Создать полную резервную копию
    -
    + + + + + + + +
    + csgo +

    Все содержимое директории csgo

    +
    +
    Создать полную резервную копию
    +
    @@ -21,19 +21,19 @@

    Создание копии

    -
    - - - [list] - - - - -
    - Перед созданием резервной копии, убедитесь что игровой север выключен. - -
    -
    +
    + + + [list] + + + + +
    + Перед созданием резервной копии, убедитесь что игровой север выключен. + +
    +
    @@ -41,29 +41,29 @@

    Созданные копии

    - - - [copy] - -
    + + + [copy] + +

    Информация

    -

    - - Полное восстановление - при восстановлении все директории в копии будут полностью заменена на имеющиеся. -

    -

    - - Частичное восстановление - при восстановлении происходит замена одинаковых файлов, не удаляются другие файлы и папки. -

    -

    - - Удаление копии - после удаление резервной копии, восстановить её будет невозможно. -

    +

    + + Полное восстановление - при восстановлении все директории в копии будут полностью заменена на имеющиеся. +

    +

    + + Частичное восстановление - при восстановлении происходит замена одинаковых файлов, не удаляются другие файлы и папки. +

    +

    + + Удаление копии - после удаление резервной копии, восстановить её будет невозможно. +

    @@ -74,11 +74,11 @@ diff --git a/template/sections/servers/mc/gmenu.html b/template/sections/servers/mc/gmenu.html index bc7135e..4379c0a 100644 --- a/template/sections/servers/mc/gmenu.html +++ b/template/sections/servers/mc/gmenu.html @@ -1,20 +1,20 @@ [notice]
    - - - - - |console_use||_console_use| - - |plugins_use||_plugins_use| - - |ftp_use||_ftp_use| - - |copy_use||_copy_use| - |graph_use||_graph_use| - |web_use||_web_use| - - -
    ОсновноеКонсольНастройкиПлагиныДрузьяFTPТарифКопииГрафикиWeb
    + + + + + |console_use||_console_use| + + |plugins_use||_plugins_use| + + |ftp_use||_ftp_use| + + |copy_use||_copy_use| + |graph_use||_graph_use| + |web_use||_web_use| + + +
    ОсновноеКонсольНастройкиПлагиныДрузьяFTPТарифКопииГрафикиWeb
    \ No newline at end of file diff --git a/template/sections/servers/mc/index.html b/template/sections/servers/mc/index.html index b7b1439..f6120b6 100644 --- a/template/sections/servers/mc/index.html +++ b/template/sections/servers/mc/index.html @@ -1,88 +1,88 @@

    Игровой сервер: #[id]

    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    [name]
    Игра: [game] (id: [id])Создан: [date]
    Адрес: [address]Локация: [unit]Арендован до: [time]
    [status]Сборка: [pack][time_end]
    - Онлайн: [online] / [slots] -
    x
    -
    -
    Тариф: [tarif]
    [btn]
    Продлить аренду
    -
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    [name]
    Игра: [game] (id: [id])Создан: [date]
    Адрес: [address]Локация: [unit]Арендован до: [time]
    [status]Сборка: [pack][time_end]
    + Онлайн: [online] / [slots] +
    x
    +
    +
    Тариф: [tarif]
    [btn]
    Продлить аренду
    +
    -

    Показатели нагрузки

    +

    Показатели нагрузки

    -
    - - - - - - - - - -
    -
    +
    + + + + + + + + + +
    +
    -

    Быстрый доступ

    +

    Быстрый доступ

    -
    - - - - - - - - - - - - -
    Основные настройки (server.properties)
    Перейти
    Снимки консоли (StartLogs)
    Перейти
    -
    +
    + + + + + + + + + + + + +
    Основные настройки (server.properties)
    Перейти
    Снимки консоли (StartLogs)
    Перейти
    +
    @@ -90,34 +90,34 @@

    Игроки онлайн

    - - - - - - - - - [players] - -
    #Ник
    + + + + + + + + + [players] + +
    #Ник
    \ No newline at end of file diff --git a/template/sections/servers/mc/owners.html b/template/sections/servers/mc/owners.html index 3c9edd0..ec1e2c9 100644 --- a/template/sections/servers/mc/owners.html +++ b/template/sections/servers/mc/owners.html @@ -1,80 +1,80 @@
    -

    Добавление совладельца

    +

    Добавление совладельца

    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Логин / Ид
    Включение сервера
    Выключение сервера
    Перезагрузка сервера
    Переустановка сервера
    Обновление сервера
    Раздел "Консоль"
    Раздел "Настройки"
    Раздел "Плагины"
    Доступ выдан до - -
    + 60 мин.
    -
    -
    -
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Логин / Ид
    Включение сервера
    Выключение сервера
    Перезагрузка сервера
    Переустановка сервера
    Обновление сервера
    Раздел "Консоль"
    Раздел "Настройки"
    Раздел "Плагины"
    Доступ выдан до + +
    + 60 мин.
    +
    +
    +
    -

    Список совладельцев

    +

    Список совладельцев

    -
    - - - [owners] - -
    -
    +
    + + + [owners] + +
    +
    -
    -
    +
    +
    -

    Выданные права

    +

    Выданные права

    -
    -
    +
    +
    @@ -87,9 +87,9 @@ diff --git a/template/sections/servers/mc/settings.html b/template/sections/servers/mc/settings.html index 4f83f32..604f8f8 100644 --- a/template/sections/servers/mc/settings.html +++ b/template/sections/servers/mc/settings.html @@ -1,49 +1,49 @@
    [start]
    -

    Основное

    +

    Основное

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Основные настройки (server.properties)
    Настроить
    Блокировка на оборудовании (FireWall)
    Настроить
    Планировщик задач (CronTab)
    Настроить

    Сборка игрового сервера

    (После изменения сборки, сервер необходимо переустановить, чтобы все изменения вступили в силу)
    - -
    Сохранить
    - |!api|Для получения ключа, необходимо активировать API|_!api| - |api|Индивидуальный ключ: [api]|_api| - - - |!api|
    Включить
    |_!api| - |api|
    Отключить
    |_api| -
    -
    -
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Основные настройки (server.properties)
    Настроить
    Блокировка на оборудовании (FireWall)
    Настроить
    Планировщик задач (CronTab)
    Настроить

    Сборка игрового сервера

    (После изменения сборки, сервер необходимо переустановить, чтобы все изменения вступили в силу)
    + +
    Сохранить
    + |!api|Для получения ключа, необходимо активировать API|_!api| + |api|Индивидуальный ключ: [api]|_api| + + + |!api|
    Включить
    |_!api| + |api|
    Отключить
    |_api| +
    +
    +
    @@ -51,14 +51,14 @@

    Логи

    - - - - - - - -
    Снимки консоли (StartLogs)
    Посмотреть
    + + + + + + + +
    Снимки консоли (StartLogs)
    Посмотреть
    |edits| @@ -67,11 +67,11 @@

    Редактируемые файлы

    - - - [edits] - -
    + + + [edits] + +
    |_edits| diff --git a/template/sections/servers/mc/settings/crontab.html b/template/sections/servers/mc/settings/crontab.html index 68e2920..cec6945 100644 --- a/template/sections/servers/mc/settings/crontab.html +++ b/template/sections/servers/mc/settings/crontab.html @@ -1,121 +1,121 @@

    Планировщик задач

    -
    - - - - - - - - - - - - - - - - - - - - - -
    Задание: - -
    Время: - - -
    :
    - - - - |!autostop| -
    Выполнять задание каждый час:
    - - |_!autostop| - -
    Время на сайте: [time]
    -
    -
    Пн. - -
    - -
    Вт. - -
    - -
    Ср. - -
    - -
    Чт. - -
    - -
    Пт. - -
    - -
    Сб. - -
    - -
    Вс. - -
    -
    - -
    -
    +
    + + + + + + + + + + + + + + + + + + + + + +
    Задание: + +
    Время: + + +
    :
    + + + + |!autostop| +
    Выполнять задание каждый час:
    + + |_!autostop| + +
    Время на сайте: [time]
    +
    +
    Пн. + +
    + +
    Вт. + +
    + +
    Ср. + +
    + +
    Чт. + +
    + +
    Пт. + +
    + +
    Сб. + +
    + +
    Вс. + +
    +
    + +
    +
    @@ -123,27 +123,27 @@

    Список добавленных задач

    - - - - - - - - - - [crontab] - -
    ЗаданиеВремяДни недели
    + + + + + + + + + + [crontab] + +
    ЗаданиеВремяДни недели
    \ No newline at end of file diff --git a/template/sections/servers/mc/settings/oldstart.html b/template/sections/servers/mc/settings/oldstart.html index de601e4..e133991 100644 --- a/template/sections/servers/mc/settings/oldstart.html +++ b/template/sections/servers/mc/settings/oldstart.html @@ -1,5 +1,5 @@

    Снимок предудыщуего запуска игрового сервера

    - +
    \ No newline at end of file diff --git a/template/sections/servers/mc/settings/servercfg.html b/template/sections/servers/mc/settings/servercfg.html index e96181a..e2acb7c 100644 --- a/template/sections/servers/mc/settings/servercfg.html +++ b/template/sections/servers/mc/settings/servercfg.html @@ -1,18 +1,18 @@

    Параметры server.properties

    -
    - - - [cfg] - - - - -
    - -
    -
    +
    + + + [cfg] + + + + +
    + +
    +
    diff --git a/template/sections/servers/mc/settings/start.html b/template/sections/servers/mc/settings/start.html index 61dd421..a338536 100644 --- a/template/sections/servers/mc/settings/start.html +++ b/template/sections/servers/mc/settings/start.html @@ -1,25 +1,25 @@

    Параметры запуска

    - - - - - - - - - - - -
    Количество слот
    - - - -
    + + + + + + + + + + + +
    Количество слот
    + + + +
    \ No newline at end of file diff --git a/template/sections/servers/mc/vmenu.html b/template/sections/servers/mc/vmenu.html index 05a4292..2b47208 100644 --- a/template/sections/servers/mc/vmenu.html +++ b/template/sections/servers/mc/vmenu.html @@ -1,15 +1,15 @@
    -
    Управление
    - +
    Управление
    +
    \ No newline at end of file diff --git a/template/sections/servers/mta/console.html b/template/sections/servers/mta/console.html index af8083e..534d0e8 100644 --- a/template/sections/servers/mta/console.html +++ b/template/sections/servers/mta/console.html @@ -1,51 +1,51 @@

    Интерактивная консоль

    -
    - -
    ...
    +
    + +
    ...
    - +

    Цвет консоли:

    -
    +
    -
    +
    - - - -
    - - - - - - - - - -
    Обновление
    -
    -
    + + + +
    + + + + + + + + + +
    Обновление
    +
    +
    @@ -69,42 +69,42 @@ white-space: pre-wrap; word-break: break-all; } - + .console_hover { - background: #9b9f9e; + background: #9b9f9e; } .console_slategray { - background: #708090; + background: #708090; } .console_maroon { - background: #800000; + background: #800000; } .console_green { - background: #03aa46; + background: #03aa46; } .console_olive { - background: #808000; + background: #808000; } .console_yellow { - background: #ffcc3c; + background: #ffcc3c; } .console_tan { - background: #D2B48C; -} + background: #D2B48C; +} .console_red { - background: #f94747; + background: #f94747; } .console_blue { - background: #558efa; + background: #558efa; } .console_skyblue { - background: #87CEEB; -} + background: #87CEEB; +} .console_darkgreen { - background: #006400; -} + background: #006400; +} .console_lime { - background: #00FF00; + background: #00FF00; } \ No newline at end of file diff --git a/template/sections/servers/mta/copy.html b/template/sections/servers/mta/copy.html index aaa3b76..243beb1 100644 --- a/template/sections/servers/mta/copy.html +++ b/template/sections/servers/mta/copy.html @@ -1,19 +1,19 @@

    Создание полной копии

    - - - - - - - -
    - * -

    Все содержимое игрового сервера

    -
    -
    Создать полную резервную копию
    -
    + + + + + + + +
    + * +

    Все содержимое игрового сервера

    +
    +
    Создать полную резервную копию
    +
    @@ -21,19 +21,19 @@

    Создание копии

    -
    - - - [list] - - - - -
    - Перед созданием резервной копии, убедитесь что игровой север выключен. - -
    -
    +
    + + + [list] + + + + +
    + Перед созданием резервной копии, убедитесь что игровой север выключен. + +
    +
    @@ -41,29 +41,29 @@

    Созданные копии

    - - - [copy] - -
    + + + [copy] + +

    Информация

    -

    - - Полное восстановление - при восстановлении все директории в копии будут полностью заменена на имеющиеся. -

    -

    - - Частичное восстановление - при восстановлении происходит замена одинаковых файлов, не удаляются другие файлы и папки. -

    -

    - - Удаление копии - после удаление резервной копии, восстановить её будет невозможно. -

    +

    + + Полное восстановление - при восстановлении все директории в копии будут полностью заменена на имеющиеся. +

    +

    + + Частичное восстановление - при восстановлении происходит замена одинаковых файлов, не удаляются другие файлы и папки. +

    +

    + + Удаление копии - после удаление резервной копии, восстановить её будет невозможно. +

    @@ -74,11 +74,11 @@ diff --git a/template/sections/servers/mta/gmenu.html b/template/sections/servers/mta/gmenu.html index bc7135e..4379c0a 100644 --- a/template/sections/servers/mta/gmenu.html +++ b/template/sections/servers/mta/gmenu.html @@ -1,20 +1,20 @@ [notice]
    - - - - - |console_use||_console_use| - - |plugins_use||_plugins_use| - - |ftp_use||_ftp_use| - - |copy_use||_copy_use| - |graph_use||_graph_use| - |web_use||_web_use| - - -
    ОсновноеКонсольНастройкиПлагиныДрузьяFTPТарифКопииГрафикиWeb
    + + + + + |console_use||_console_use| + + |plugins_use||_plugins_use| + + |ftp_use||_ftp_use| + + |copy_use||_copy_use| + |graph_use||_graph_use| + |web_use||_web_use| + + +
    ОсновноеКонсольНастройкиПлагиныДрузьяFTPТарифКопииГрафикиWeb
    \ No newline at end of file diff --git a/template/sections/servers/mta/index.html b/template/sections/servers/mta/index.html index 6ac288c..4e59524 100644 --- a/template/sections/servers/mta/index.html +++ b/template/sections/servers/mta/index.html @@ -1,88 +1,88 @@

    Игровой сервер: #[id]

    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    [name]
    Игра: [game] (id: [id])Создан: [date]
    Адрес: [address]Локация: [unit]Арендован до: [time]
    [status]Сборка: [pack][time_end]
    - Онлайн: [online] / [slots] -
    x
    -
    -
    Тариф: [tarif]
    [btn]
    Продлить аренду
    -
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    [name]
    Игра: [game] (id: [id])Создан: [date]
    Адрес: [address]Локация: [unit]Арендован до: [time]
    [status]Сборка: [pack][time_end]
    + Онлайн: [online] / [slots] +
    x
    +
    +
    Тариф: [tarif]
    [btn]
    Продлить аренду
    +
    -

    Показатели нагрузки

    +

    Показатели нагрузки

    -
    - - - - - - - - - -
    -
    +
    + + + + + + + + + +
    +
    -

    Быстрый доступ

    +

    Быстрый доступ

    -
    - - - - - - - - - - - - - - - - - - - -
    Основные настройки (mtaserver.conf)
    Перейти
    Настройки прав (acl.xml)
    Перейти
    Настройки цветов (vehiclecolors.conf)
    Перейти
    Снимки консоли (StartLogs)
    Перейти
    -
    +
    + + + + + + + + + + + + + + + + + + + +
    Основные настройки (mtaserver.conf)
    Перейти
    Настройки прав (acl.xml)
    Перейти
    Настройки цветов (vehiclecolors.conf)
    Перейти
    Снимки консоли (StartLogs)
    Перейти
    +
    @@ -90,36 +90,36 @@

    Игроки онлайн

    - - - - - - - - - - - [players] - -
    #НикФрагиПинг
    + + + + + + + + + + + [players] + +
    #НикФрагиПинг
    \ No newline at end of file diff --git a/template/sections/servers/mta/owners.html b/template/sections/servers/mta/owners.html index 3dddc1d..a148b9a 100644 --- a/template/sections/servers/mta/owners.html +++ b/template/sections/servers/mta/owners.html @@ -1,76 +1,76 @@
    -

    Добавление совладельца

    +

    Добавление совладельца

    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Логин / Ид
    Включение сервера
    Выключение сервера
    Перезагрузка сервера
    Переустановка сервера
    Раздел "Консоль"
    Раздел "Настройки"
    Раздел "Плагины"
    Доступ выдан до - -
    + 60 мин.
    -
    -
    -
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Логин / Ид
    Включение сервера
    Выключение сервера
    Перезагрузка сервера
    Переустановка сервера
    Раздел "Консоль"
    Раздел "Настройки"
    Раздел "Плагины"
    Доступ выдан до + +
    + 60 мин.
    +
    +
    +
    -

    Список совладельцев

    +

    Список совладельцев

    -
    - - - [owners] - -
    -
    +
    + + + [owners] + +
    +
    -
    -
    +
    +
    -

    Выданные права

    +

    Выданные права

    -
    -
    +
    +
    @@ -83,9 +83,9 @@ diff --git a/template/sections/servers/mta/settings.html b/template/sections/servers/mta/settings.html index da141ce..299c808 100644 --- a/template/sections/servers/mta/settings.html +++ b/template/sections/servers/mta/settings.html @@ -1,57 +1,57 @@
    [start]
    -

    Основное

    +

    Основное

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Основной конфигурационный файл сервера (mtaserver.conf)
    Настроить
    Настройки цветов автомобилей на игровом сервере (acl.xml)
    Настроить
    Настройки прав на игровом сервере (vehiclecolors.conf)
    Настроить
    Блокировка на оборудовании (FireWall)
    Настроить
    Планировщик задач (CronTab)
    Настроить

    Сборка игрового сервера

    (После изменения сборки, сервер необходимо переустановить, чтобы все изменения вступили в силу)
    - -
    Сохранить
    - |!api|Для получения ключа, необходимо активировать API|_!api| - |api|Индивидуальный ключ: [api]|_api| - - - |!api|
    Включить
    |_!api| - |api|
    Отключить
    |_api| -
    -
    -
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Основной конфигурационный файл сервера (mtaserver.conf)
    Настроить
    Настройки цветов автомобилей на игровом сервере (acl.xml)
    Настроить
    Настройки прав на игровом сервере (vehiclecolors.conf)
    Настроить
    Блокировка на оборудовании (FireWall)
    Настроить
    Планировщик задач (CronTab)
    Настроить

    Сборка игрового сервера

    (После изменения сборки, сервер необходимо переустановить, чтобы все изменения вступили в силу)
    + +
    Сохранить
    + |!api|Для получения ключа, необходимо активировать API|_!api| + |api|Индивидуальный ключ: [api]|_api| + + + |!api|
    Включить
    |_!api| + |api|
    Отключить
    |_api| +
    +
    +
    @@ -59,14 +59,14 @@

    Логи

    - - - - - - - -
    Снимки консоли (StartLogs)
    Посмотреть
    + + + + + + + +
    Снимки консоли (StartLogs)
    Посмотреть
    |edits| @@ -75,11 +75,11 @@

    Редактируемые файлы

    - - - [edits] - -
    + + + [edits] + +
    |_edits| diff --git a/template/sections/servers/mta/settings/crontab.html b/template/sections/servers/mta/settings/crontab.html index 16bb9f3..6577617 100644 --- a/template/sections/servers/mta/settings/crontab.html +++ b/template/sections/servers/mta/settings/crontab.html @@ -1,120 +1,120 @@

    Планировщик задач

    -
    - - - - - - - - - - - - - - - - - - - - - -
    Задание: - -
    Время: - - -
    :
    - - - - |!autostop| -
    Выполнять задание каждый час:
    - - |_!autostop| - -
    Время на сайте: [time]
    -
    -
    Пн. - -
    - -
    Вт. - -
    - -
    Ср. - -
    - -
    Чт. - -
    - -
    Пт. - -
    - -
    Сб. - -
    - -
    Вс. - -
    -
    - -
    -
    +
    + + + + + + + + + + + + + + + + + + + + + +
    Задание: + +
    Время: + + +
    :
    + + + + |!autostop| +
    Выполнять задание каждый час:
    + + |_!autostop| + +
    Время на сайте: [time]
    +
    +
    Пн. + +
    + +
    Вт. + +
    + +
    Ср. + +
    + +
    Чт. + +
    + +
    Пт. + +
    + +
    Сб. + +
    + +
    Вс. + +
    +
    + +
    +
    @@ -122,27 +122,27 @@

    Список добавленных задач

    - - - - - - - - - - [crontab] - -
    ЗаданиеВремяДни недели
    + + + + + + + + + + [crontab] + +
    ЗаданиеВремяДни недели
    \ No newline at end of file diff --git a/template/sections/servers/mta/settings/oldstart.html b/template/sections/servers/mta/settings/oldstart.html index de601e4..e133991 100644 --- a/template/sections/servers/mta/settings/oldstart.html +++ b/template/sections/servers/mta/settings/oldstart.html @@ -1,5 +1,5 @@

    Снимок предудыщуего запуска игрового сервера

    - +
    \ No newline at end of file diff --git a/template/sections/servers/mta/settings/servercfg.html b/template/sections/servers/mta/settings/servercfg.html index fcadf5e..93d2269 100644 --- a/template/sections/servers/mta/settings/servercfg.html +++ b/template/sections/servers/mta/settings/servercfg.html @@ -1,23 +1,23 @@

    Параметры server.cfg

    -
    - - - [cfg] - - - - - - - -
    - -
    - -
    -
    +
    + + + [cfg] + + + + + + + +
    + +
    + +
    +
    diff --git a/template/sections/servers/mta/settings/start.html b/template/sections/servers/mta/settings/start.html index 469bc77..3e26afe 100644 --- a/template/sections/servers/mta/settings/start.html +++ b/template/sections/servers/mta/settings/start.html @@ -1,37 +1,37 @@

    Параметры запуска

    - - - - - - - - - - - - - - - - - - - -
    Количество слот
    - - - -
    Авторестарт при зависании
    - - - -
    + + + + + + + + + + + + + + + + + + + +
    Количество слот
    + + + +
    Авторестарт при зависании
    + + + +
    \ No newline at end of file diff --git a/template/sections/servers/mta/vmenu.html b/template/sections/servers/mta/vmenu.html index 05a4292..2b47208 100644 --- a/template/sections/servers/mta/vmenu.html +++ b/template/sections/servers/mta/vmenu.html @@ -1,15 +1,15 @@
    -
    Управление
    - +
    Управление
    +
    \ No newline at end of file diff --git a/template/sections/servers/players/cs.html b/template/sections/servers/players/cs.html index 8633973..a79019d 100644 --- a/template/sections/servers/players/cs.html +++ b/template/sections/servers/players/cs.html @@ -1,6 +1,6 @@ - [i] - [name] - [score] - [time] + [i] + [name] + [score] + [time] \ No newline at end of file diff --git a/template/sections/servers/players/csgo.html b/template/sections/servers/players/csgo.html index 8633973..a79019d 100644 --- a/template/sections/servers/players/csgo.html +++ b/template/sections/servers/players/csgo.html @@ -1,6 +1,6 @@ - [i] - [name] - [score] - [time] + [i] + [name] + [score] + [time] \ No newline at end of file diff --git a/template/sections/servers/players/css.html b/template/sections/servers/players/css.html index 8633973..a79019d 100644 --- a/template/sections/servers/players/css.html +++ b/template/sections/servers/players/css.html @@ -1,6 +1,6 @@ - [i] - [name] - [score] - [time] + [i] + [name] + [score] + [time] \ No newline at end of file diff --git a/template/sections/servers/players/cssold.html b/template/sections/servers/players/cssold.html index 8633973..a79019d 100644 --- a/template/sections/servers/players/cssold.html +++ b/template/sections/servers/players/cssold.html @@ -1,6 +1,6 @@ - [i] - [name] - [score] - [time] + [i] + [name] + [score] + [time] \ No newline at end of file diff --git a/template/sections/servers/players/mc.html b/template/sections/servers/players/mc.html index 2caa38e..4520222 100644 --- a/template/sections/servers/players/mc.html +++ b/template/sections/servers/players/mc.html @@ -1,4 +1,4 @@ - [i] - [name] + [i] + [name] \ No newline at end of file diff --git a/template/sections/servers/players/mta.html b/template/sections/servers/players/mta.html index 6d69cdd..49fe070 100644 --- a/template/sections/servers/players/mta.html +++ b/template/sections/servers/players/mta.html @@ -1,6 +1,6 @@ - [i] - [name] - [score] - [ping] + [i] + [name] + [score] + [ping] \ No newline at end of file diff --git a/template/sections/servers/players/samp.html b/template/sections/servers/players/samp.html index 6d69cdd..49fe070 100644 --- a/template/sections/servers/players/samp.html +++ b/template/sections/servers/players/samp.html @@ -1,6 +1,6 @@ - [i] - [name] - [score] - [ping] + [i] + [name] + [score] + [ping] \ No newline at end of file diff --git a/template/sections/servers/samp/console.html b/template/sections/servers/samp/console.html index 72af8b2..c68758d 100644 --- a/template/sections/servers/samp/console.html +++ b/template/sections/servers/samp/console.html @@ -1,50 +1,50 @@

    Консоль

    -
    - -
    ...
    +
    + +
    ...
    - +

    Цвет консоли:

    -
    +
    -
    +
    - - - -
    - - - - - - - - -
    Обновление
    -
    -
    + + + +
    + + + + + + + + +
    Обновление
    +
    +
    @@ -68,42 +68,42 @@ white-space: pre-wrap; word-break: break-all; } - + .console_hover { - background: #9b9f9e; + background: #9b9f9e; } .console_slategray { - background: #708090; + background: #708090; } .console_maroon { - background: #800000; + background: #800000; } .console_green { - background: #03aa46; + background: #03aa46; } .console_olive { - background: #808000; + background: #808000; } .console_yellow { - background: #ffcc3c; + background: #ffcc3c; } .console_tan { - background: #D2B48C; -} + background: #D2B48C; +} .console_red { - background: #f94747; + background: #f94747; } .console_blue { - background: #558efa; + background: #558efa; } .console_skyblue { - background: #87CEEB; -} + background: #87CEEB; +} .console_darkgreen { - background: #006400; -} + background: #006400; +} .console_lime { - background: #00FF00; + background: #00FF00; } \ No newline at end of file diff --git a/template/sections/servers/samp/copy.html b/template/sections/servers/samp/copy.html index aaa3b76..243beb1 100644 --- a/template/sections/servers/samp/copy.html +++ b/template/sections/servers/samp/copy.html @@ -1,19 +1,19 @@

    Создание полной копии

    - - - - - - - -
    - * -

    Все содержимое игрового сервера

    -
    -
    Создать полную резервную копию
    -
    + + + + + + + +
    + * +

    Все содержимое игрового сервера

    +
    +
    Создать полную резервную копию
    +
    @@ -21,19 +21,19 @@

    Создание копии

    -
    - - - [list] - - - - -
    - Перед созданием резервной копии, убедитесь что игровой север выключен. - -
    -
    +
    + + + [list] + + + + +
    + Перед созданием резервной копии, убедитесь что игровой север выключен. + +
    +
    @@ -41,29 +41,29 @@

    Созданные копии

    - - - [copy] - -
    + + + [copy] + +

    Информация

    -

    - - Полное восстановление - при восстановлении все директории в копии будут полностью заменена на имеющиеся. -

    -

    - - Частичное восстановление - при восстановлении происходит замена одинаковых файлов, не удаляются другие файлы и папки. -

    -

    - - Удаление копии - после удаление резервной копии, восстановить её будет невозможно. -

    +

    + + Полное восстановление - при восстановлении все директории в копии будут полностью заменена на имеющиеся. +

    +

    + + Частичное восстановление - при восстановлении происходит замена одинаковых файлов, не удаляются другие файлы и папки. +

    +

    + + Удаление копии - после удаление резервной копии, восстановить её будет невозможно. +

    @@ -74,11 +74,11 @@ diff --git a/template/sections/servers/samp/gmenu.html b/template/sections/servers/samp/gmenu.html index bc7135e..4379c0a 100644 --- a/template/sections/servers/samp/gmenu.html +++ b/template/sections/servers/samp/gmenu.html @@ -1,20 +1,20 @@ [notice]
    - - - - - |console_use||_console_use| - - |plugins_use||_plugins_use| - - |ftp_use||_ftp_use| - - |copy_use||_copy_use| - |graph_use||_graph_use| - |web_use||_web_use| - - -
    ОсновноеКонсольНастройкиПлагиныДрузьяFTPТарифКопииГрафикиWeb
    + + + + + |console_use||_console_use| + + |plugins_use||_plugins_use| + + |ftp_use||_ftp_use| + + |copy_use||_copy_use| + |graph_use||_graph_use| + |web_use||_web_use| + + +
    ОсновноеКонсольНастройкиПлагиныДрузьяFTPТарифКопииГрафикиWeb
    \ No newline at end of file diff --git a/template/sections/servers/samp/index.html b/template/sections/servers/samp/index.html index c25cba7..cf2c7f3 100644 --- a/template/sections/servers/samp/index.html +++ b/template/sections/servers/samp/index.html @@ -1,88 +1,88 @@

    Игровой сервер: #[id]

    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    [name]
    Игра: [game] (id: [id])Создан: [date]
    Адрес: [address]Локация: [unit]Арендован до: [time]
    [status]Сборка: [pack][time_end]
    - Онлайн: [online] / [slots] -
    x
    -
    -
    Тариф: [tarif]
    [btn]
    Продлить аренду
    -
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    [name]
    Игра: [game] (id: [id])Создан: [date]
    Адрес: [address]Локация: [unit]Арендован до: [time]
    [status]Сборка: [pack][time_end]
    + Онлайн: [online] / [slots] +
    x
    +
    +
    Тариф: [tarif]
    [btn]
    Продлить аренду
    +
    -

    Показатели нагрузки

    +

    Показатели нагрузки

    -
    - - - - - - - - - -
    -
    +
    + + + + + + + + + +
    +
    -

    Быстрый доступ

    +

    Быстрый доступ

    -
    - - - - - - - - - - - - -
    Основные настройки (server.cfg)
    Перейти
    Снимки консоли (StartLogs)
    Перейти
    -
    +
    + + + + + + + + + + + + +
    Основные настройки (server.cfg)
    Перейти
    Снимки консоли (StartLogs)
    Перейти
    +
    @@ -90,36 +90,36 @@

    Игроки онлайн

    - - - - - - - - - - - [players] - -
    #НикФрагиПинг
    + + + + + + + + + + + [players] + +
    #НикФрагиПинг
    \ No newline at end of file diff --git a/template/sections/servers/samp/owners.html b/template/sections/servers/samp/owners.html index 3dddc1d..a148b9a 100644 --- a/template/sections/servers/samp/owners.html +++ b/template/sections/servers/samp/owners.html @@ -1,76 +1,76 @@
    -

    Добавление совладельца

    +

    Добавление совладельца

    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Логин / Ид
    Включение сервера
    Выключение сервера
    Перезагрузка сервера
    Переустановка сервера
    Раздел "Консоль"
    Раздел "Настройки"
    Раздел "Плагины"
    Доступ выдан до - -
    + 60 мин.
    -
    -
    -
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Логин / Ид
    Включение сервера
    Выключение сервера
    Перезагрузка сервера
    Переустановка сервера
    Раздел "Консоль"
    Раздел "Настройки"
    Раздел "Плагины"
    Доступ выдан до + +
    + 60 мин.
    +
    +
    +
    -

    Список совладельцев

    +

    Список совладельцев

    -
    - - - [owners] - -
    -
    +
    + + + [owners] + +
    +
    -
    -
    +
    +
    -

    Выданные права

    +

    Выданные права

    -
    -
    +
    +
    @@ -83,9 +83,9 @@ diff --git a/template/sections/servers/samp/settings.html b/template/sections/servers/samp/settings.html index 5dc0b8c..10e5bb2 100644 --- a/template/sections/servers/samp/settings.html +++ b/template/sections/servers/samp/settings.html @@ -1,49 +1,49 @@
    [start]
    -

    Основное

    +

    Основное

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Основные настройки (SERVER.CFG)
    Настроить
    Блокировка на оборудовании (FireWall)
    Настроить
    Планировщик задач (CronTab)
    Настроить

    Сборка игрового сервера

    (После изменения сборки, сервер необходимо переустановить, чтобы все изменения вступили в силу)
    - -
    Сохранить
    - |!api|Для получения ключа, необходимо активировать API|_!api| - |api|Индивидуальный ключ: [api]|_api| - - - |!api|
    Включить
    |_!api| - |api|
    Отключить
    |_api| -
    -
    -
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Основные настройки (SERVER.CFG)
    Настроить
    Блокировка на оборудовании (FireWall)
    Настроить
    Планировщик задач (CronTab)
    Настроить

    Сборка игрового сервера

    (После изменения сборки, сервер необходимо переустановить, чтобы все изменения вступили в силу)
    + +
    Сохранить
    + |!api|Для получения ключа, необходимо активировать API|_!api| + |api|Индивидуальный ключ: [api]|_api| + + + |!api|
    Включить
    |_!api| + |api|
    Отключить
    |_api| +
    +
    +
    @@ -51,14 +51,14 @@

    Логи

    - - - - - - - -
    Снимки консоли (StartLogs)
    Посмотреть
    + + + + + + + +
    Снимки консоли (StartLogs)
    Посмотреть
    |edits| @@ -67,11 +67,11 @@

    Редактируемые файлы

    - - - [edits] - -
    + + + [edits] + +
    |_edits| diff --git a/template/sections/servers/samp/settings/crontab.html b/template/sections/servers/samp/settings/crontab.html index a67977a..9589d1e 100644 --- a/template/sections/servers/samp/settings/crontab.html +++ b/template/sections/servers/samp/settings/crontab.html @@ -1,119 +1,119 @@

    Планировщик задач

    -
    - - - - - - - - - - - - - - - - - - - - - -
    Задание: - -
    Время: - - -
    :
    - - - - |!autostop| -
    Выполнять задание каждый час:
    - - |_!autostop| - -
    Время на сайте: [time]
    -
    -
    Пн. - -
    - -
    Вт. - -
    - -
    Ср. - -
    - -
    Чт. - -
    - -
    Пт. - -
    - -
    Сб. - -
    - -
    Вс. - -
    -
    - -
    -
    +
    + + + + + + + + + + + + + + + + + + + + + +
    Задание: + +
    Время: + + +
    :
    + + + + |!autostop| +
    Выполнять задание каждый час:
    + + |_!autostop| + +
    Время на сайте: [time]
    +
    +
    Пн. + +
    + +
    Вт. + +
    + +
    Ср. + +
    + +
    Чт. + +
    + +
    Пт. + +
    + +
    Сб. + +
    + +
    Вс. + +
    +
    + +
    +
    @@ -121,27 +121,27 @@

    Список добавленных задач

    - - - - - - - - - - [crontab] - -
    ЗаданиеВремяДни недели
    + + + + + + + + + + [crontab] + +
    ЗаданиеВремяДни недели
    \ No newline at end of file diff --git a/template/sections/servers/samp/settings/oldstart.html b/template/sections/servers/samp/settings/oldstart.html index de601e4..e133991 100644 --- a/template/sections/servers/samp/settings/oldstart.html +++ b/template/sections/servers/samp/settings/oldstart.html @@ -1,5 +1,5 @@

    Снимок предудыщуего запуска игрового сервера

    - +
    \ No newline at end of file diff --git a/template/sections/servers/samp/settings/servercfg.html b/template/sections/servers/samp/settings/servercfg.html index fcadf5e..93d2269 100644 --- a/template/sections/servers/samp/settings/servercfg.html +++ b/template/sections/servers/samp/settings/servercfg.html @@ -1,23 +1,23 @@

    Параметры server.cfg

    -
    - - - [cfg] - - - - - - - -
    - -
    - -
    -
    +
    + + + [cfg] + + + + + + + +
    + +
    + +
    +
    diff --git a/template/sections/servers/samp/settings/start.html b/template/sections/servers/samp/settings/start.html index 61dd421..a338536 100644 --- a/template/sections/servers/samp/settings/start.html +++ b/template/sections/servers/samp/settings/start.html @@ -1,25 +1,25 @@

    Параметры запуска

    - - - - - - - - - - - -
    Количество слот
    - - - -
    + + + + + + + + + + + +
    Количество слот
    + + + +
    \ No newline at end of file diff --git a/template/sections/servers/samp/vmenu.html b/template/sections/servers/samp/vmenu.html index 05a4292..2b47208 100644 --- a/template/sections/servers/samp/vmenu.html +++ b/template/sections/servers/samp/vmenu.html @@ -1,15 +1,15 @@
    -
    Управление
    - +
    Управление
    +
    \ No newline at end of file diff --git a/template/sections/servers/servers.html b/template/sections/servers/servers.html index 48e25f5..7fba077 100644 --- a/template/sections/servers/servers.html +++ b/template/sections/servers/servers.html @@ -1,11 +1,11 @@ [list] \ No newline at end of file diff --git a/template/sections/services/games/crmp.html b/template/sections/services/games/crmp.html index 0888c4f..d5cb9ae 100644 --- a/template/sections/services/games/crmp.html +++ b/template/sections/services/games/crmp.html @@ -2,91 +2,91 @@ |!informer|
    -
    - - - - - - - - - - - - - - - |!settlement_period| - - - - |_!settlement_period| - - - - - - - - |!settlement_period| - - - - |_!settlement_period| - |settlement_period| - - - - |_settlement_period| - - - - -
    - - -
    - - -
    - - -
    - - -
    - - -
    - - - -
    Проверить
    -
    Цена за выбранный период: ... [cur]
    -

    Текущая дата: [date]

    -

    Итого к оплате: ... [cur]

    - -
    -
    -

    Система оплаты работает по расчетному периоду.

    -

    При оплате до 15-го числа взымается плата за остаток текущего месяца.

    -

    При оплате после 15-го числа взымается плата за остаток текущего месяца + следующий месяц.

    -
    -
    - -
    -
    +
    + + + + + + + + + + + + + + + |!settlement_period| + + + + |_!settlement_period| + + + + + + + + |!settlement_period| + + + + |_!settlement_period| + |settlement_period| + + + + |_settlement_period| + + + + +
    + + +
    + + +
    + + +
    + + +
    + + +
    + + + +
    Проверить
    +
    Цена за выбранный период: ... [cur]
    +

    Текущая дата: [date]

    +

    Итого к оплате: ... [cur]

    + +
    +
    +

    Система оплаты работает по расчетному периоду.

    +

    При оплате до 15-го числа взымается плата за остаток текущего месяца.

    +

    При оплате после 15-го числа взымается плата за остаток текущего месяца + следующий месяц.

    +
    +
    + +
    +
    @@ -101,5 +101,5 @@ \ No newline at end of file diff --git a/template/sections/services/games/cs.html b/template/sections/services/games/cs.html index e2f9342..f7c732f 100644 --- a/template/sections/services/games/cs.html +++ b/template/sections/services/games/cs.html @@ -2,99 +2,99 @@ |!informer|
    -
    - - - - - - - - - - - - - - - - - - |!settlement_period| - - - - |_!settlement_period| - - - - - - - - |!settlement_period| - - - - |_!settlement_period| - |settlement_period| - - - - |_settlement_period| - - - - -
    - - -
    - - -
    - - -
    - - -
    - - -
    - - -
    - - - -
    Проверить
    -
    Цена за выбранный период: ... [cur]
    -

    Текущая дата: [date]

    -

    Итого к оплате: ... [cur]

    - -
    -
    -

    Система оплаты работает по расчетному периоду.

    -

    При оплате до 15-го числа взымается плата за остаток текущего месяца.

    -

    При оплате после 15-го числа взымается плата за остаток текущего месяца + следующий месяц.

    -
    -
    - -
    -
    +
    + + + + + + + + + + + + + + + + + + |!settlement_period| + + + + |_!settlement_period| + + + + + + + + |!settlement_period| + + + + |_!settlement_period| + |settlement_period| + + + + |_settlement_period| + + + + +
    + + +
    + + +
    + + +
    + + +
    + + +
    + + +
    + + + +
    Проверить
    +
    Цена за выбранный период: ... [cur]
    +

    Текущая дата: [date]

    +

    Итого к оплате: ... [cur]

    + +
    +
    +

    Система оплаты работает по расчетному периоду.

    +

    При оплате до 15-го числа взымается плата за остаток текущего месяца.

    +

    При оплате после 15-го числа взымается плата за остаток текущего месяца + следующий месяц.

    +
    +
    + +
    +
    @@ -111,5 +111,5 @@ \ No newline at end of file diff --git a/template/sections/services/games/csgo.html b/template/sections/services/games/csgo.html index 8e7f19d..3c8c149 100644 --- a/template/sections/services/games/csgo.html +++ b/template/sections/services/games/csgo.html @@ -2,99 +2,99 @@ |!informer|
    -
    - - - - - - - - - - - - - - - - - - |!settlement_period| - - - - |_!settlement_period| - - - - - - - - |!settlement_period| - - - - |_!settlement_period| - |settlement_period| - - - - |_settlement_period| - - - - -
    - - -
    - - -
    - - -
    - - -
    - - -
    - - -
    - - - -
    Проверить
    -
    Цена за выбранный период: ... [cur]
    -

    Текущая дата: [date]

    -

    Итого к оплате: ... [cur]

    - -
    -
    -

    Система оплаты работает по расчетному периоду.

    -

    При оплате до 15-го числа взымается плата за остаток текущего месяца.

    -

    При оплате после 15-го числа взымается плата за остаток текущего месяца + следующий месяц.

    -
    -
    - -
    -
    +
    + + + + + + + + + + + + + + + + + + |!settlement_period| + + + + |_!settlement_period| + + + + + + + + |!settlement_period| + + + + |_!settlement_period| + |settlement_period| + + + + |_settlement_period| + + + + +
    + + +
    + + +
    + + +
    + + +
    + + +
    + + +
    + + + +
    Проверить
    +
    Цена за выбранный период: ... [cur]
    +

    Текущая дата: [date]

    +

    Итого к оплате: ... [cur]

    + +
    +
    +

    Система оплаты работает по расчетному периоду.

    +

    При оплате до 15-го числа взымается плата за остаток текущего месяца.

    +

    При оплате после 15-го числа взымается плата за остаток текущего месяца + следующий месяц.

    +
    +
    + +
    +
    @@ -109,5 +109,5 @@ \ No newline at end of file diff --git a/template/sections/services/games/css.html b/template/sections/services/games/css.html index 9b0c7e4..8e24604 100644 --- a/template/sections/services/games/css.html +++ b/template/sections/services/games/css.html @@ -2,99 +2,99 @@ |!informer|
    -
    - - - - - - - - - - - - - - - - - - |!settlement_period| - - - - |_!settlement_period| - - - - - - - - |!settlement_period| - - - - |_!settlement_period| - |settlement_period| - - - - |_settlement_period| - - - - -
    - - -
    - - -
    - - -
    - - -
    - - -
    - - -
    - - - -
    Проверить
    -
    Цена за выбранный период: ... [cur]
    -

    Текущая дата: [date]

    -

    Итого к оплате: ... [cur]

    - -
    -
    -

    Система оплаты работает по расчетному периоду.

    -

    При оплате до 15-го числа взымается плата за остаток текущего месяца.

    -

    При оплате после 15-го числа взымается плата за остаток текущего месяца + следующий месяц.

    -
    -
    - -
    -
    +
    + + + + + + + + + + + + + + + + + + |!settlement_period| + + + + |_!settlement_period| + + + + + + + + |!settlement_period| + + + + |_!settlement_period| + |settlement_period| + + + + |_settlement_period| + + + + +
    + + +
    + + +
    + + +
    + + +
    + + +
    + + +
    + + + +
    Проверить
    +
    Цена за выбранный период: ... [cur]
    +

    Текущая дата: [date]

    +

    Итого к оплате: ... [cur]

    + +
    +
    +

    Система оплаты работает по расчетному периоду.

    +

    При оплате до 15-го числа взымается плата за остаток текущего месяца.

    +

    При оплате после 15-го числа взымается плата за остаток текущего месяца + следующий месяц.

    +
    +
    + +
    +
    @@ -109,5 +109,5 @@ \ No newline at end of file diff --git a/template/sections/services/games/cssold.html b/template/sections/services/games/cssold.html index ca0bb43..3aab808 100644 --- a/template/sections/services/games/cssold.html +++ b/template/sections/services/games/cssold.html @@ -2,107 +2,107 @@ |!informer|
    -
    - - - - - - - - - - - - - - - - - - - - - |!settlement_period| - - - - |_!settlement_period| - - - - - - - - |!settlement_period| - - - - |_!settlement_period| - |settlement_period| - - - - |_settlement_period| - - - - -
    - - -
    - - -
    - - -
    - - -
    - - -
    - - -
    - - -
    - - - -
    Проверить
    -
    Цена за выбранный период: ... [cur]
    -

    Текущая дата: [date]

    -

    Итого к оплате: ... [cur]

    - -
    -
    -

    Система оплаты работает по расчетному периоду.

    -

    При оплате до 15-го числа взымается плата за остаток текущего месяца.

    -

    При оплате после 15-го числа взымается плата за остаток текущего месяца + следующий месяц.

    -
    -
    - -
    -
    +
    + + + + + + + + + + + + + + + + + + + + + |!settlement_period| + + + + |_!settlement_period| + + + + + + + + |!settlement_period| + + + + |_!settlement_period| + |settlement_period| + + + + |_settlement_period| + + + + +
    + + +
    + + +
    + + +
    + + +
    + + +
    + + +
    + + +
    + + + +
    Проверить
    +
    Цена за выбранный период: ... [cur]
    +

    Текущая дата: [date]

    +

    Итого к оплате: ... [cur]

    + +
    +
    +

    Система оплаты работает по расчетному периоду.

    +

    При оплате до 15-го числа взымается плата за остаток текущего месяца.

    +

    При оплате после 15-го числа взымается плата за остаток текущего месяца + следующий месяц.

    +
    +
    + +
    +
    @@ -117,5 +117,5 @@ \ No newline at end of file diff --git a/template/sections/services/games/mc.html b/template/sections/services/games/mc.html index 87df020..2475ded 100644 --- a/template/sections/services/games/mc.html +++ b/template/sections/services/games/mc.html @@ -2,99 +2,99 @@ |!informer|
    -
    - - - - - - - - - - - - - - - - - - |!settlement_period| - - - - |_!settlement_period| - - - - - - - - |!settlement_period| - - - - |_!settlement_period| - |settlement_period| - - - - |_settlement_period| - - - - -
    - - -
    - - -
    - - -
    - - -
    - - -
    - - -
    - - - -
    Проверить
    -
    Цена за выбранный период: ... [cur]
    -

    Текущая дата: [date]

    -

    Итого к оплате: ... [cur]

    - -
    -
    -

    Система оплаты работает по расчетному периоду.

    -

    При оплате до 15-го числа взымается плата за остаток текущего месяца.

    -

    При оплате после 15-го числа взымается плата за остаток текущего месяца + следующий месяц.

    -
    -
    - -
    -
    +
    + + + + + + + + + + + + + + + + + + |!settlement_period| + + + + |_!settlement_period| + + + + + + + + |!settlement_period| + + + + |_!settlement_period| + |settlement_period| + + + + |_settlement_period| + + + + +
    + + +
    + + +
    + + +
    + + +
    + + +
    + + +
    + + + +
    Проверить
    +
    Цена за выбранный период: ... [cur]
    +

    Текущая дата: [date]

    +

    Итого к оплате: ... [cur]

    + +
    +
    +

    Система оплаты работает по расчетному периоду.

    +

    При оплате до 15-го числа взымается плата за остаток текущего месяца.

    +

    При оплате после 15-го числа взымается плата за остаток текущего месяца + следующий месяц.

    +
    +
    + +
    +
    @@ -109,5 +109,5 @@ \ No newline at end of file diff --git a/template/sections/services/games/mta.html b/template/sections/services/games/mta.html index dc333c4..f46f568 100644 --- a/template/sections/services/games/mta.html +++ b/template/sections/services/games/mta.html @@ -2,91 +2,91 @@ |!informer|
    -
    - - - - - - - - - - - - - - - |!settlement_period| - - - - |_!settlement_period| - - - - - - - - |!settlement_period| - - - - |_!settlement_period| - |settlement_period| - - - - |_settlement_period| - - - - -
    - - -
    - - -
    - - -
    - - -
    - - -
    - - - -
    Проверить
    -
    Цена за выбранный период: ... [cur]
    -

    Текущая дата: [date]

    -

    Итого к оплате: ... [cur]

    - -
    -
    -

    Система оплаты работает по расчетному периоду.

    -

    При оплате до 15-го числа взымается плата за остаток текущего месяца.

    -

    При оплате после 15-го числа взымается плата за остаток текущего месяца + следующий месяц.

    -
    -
    - -
    -
    +
    + + + + + + + + + + + + + + + |!settlement_period| + + + + |_!settlement_period| + + + + + + + + |!settlement_period| + + + + |_!settlement_period| + |settlement_period| + + + + |_settlement_period| + + + + +
    + + +
    + + +
    + + +
    + + +
    + + +
    + + + +
    Проверить
    +
    Цена за выбранный период: ... [cur]
    +

    Текущая дата: [date]

    +

    Итого к оплате: ... [cur]

    + +
    +
    +

    Система оплаты работает по расчетному периоду.

    +

    При оплате до 15-го числа взымается плата за остаток текущего месяца.

    +

    При оплате после 15-го числа взымается плата за остаток текущего месяца + следующий месяц.

    +
    +
    + +
    +
    @@ -101,5 +101,5 @@ \ No newline at end of file diff --git a/template/sections/services/games/samp.html b/template/sections/services/games/samp.html index 4a571e2..b8ea69c 100644 --- a/template/sections/services/games/samp.html +++ b/template/sections/services/games/samp.html @@ -2,91 +2,91 @@ |!informer|
    -
    - - - - - - - - - - - - - - - |!settlement_period| - - - - |_!settlement_period| - - - - - - - - |!settlement_period| - - - - |_!settlement_period| - |settlement_period| - - - - |_settlement_period| - - - - -
    - - -
    - - -
    - - -
    - - -
    - - -
    - - - -
    Проверить
    -
    Цена за выбранный период: ... [cur]
    -

    Текущая дата: [date]

    -

    Итого к оплате: ... [cur]

    - -
    -
    -

    Система оплаты работает по расчетному периоду.

    -

    При оплате до 15-го числа взымается плата за остаток текущего месяца.

    -

    При оплате после 15-го числа взымается плата за остаток текущего месяца + следующий месяц.

    -
    -
    - -
    -
    +
    + + + + + + + + + + + + + + + |!settlement_period| + + + + |_!settlement_period| + + + + + + + + |!settlement_period| + + + + |_!settlement_period| + |settlement_period| + + + + |_settlement_period| + + + + +
    + + +
    + + +
    + + +
    + + +
    + + +
    + + + +
    Проверить
    +
    Цена за выбранный период: ... [cur]
    +

    Текущая дата: [date]

    +

    Итого к оплате: ... [cur]

    + +
    +
    +

    Система оплаты работает по расчетному периоду.

    +

    При оплате до 15-го числа взымается плата за остаток текущего месяца.

    +

    При оплате после 15-го числа взымается плата за остаток текущего месяца + следующий месяц.

    +
    +
    + +
    +
    @@ -101,5 +101,5 @@ \ No newline at end of file diff --git a/template/sections/services/index.html b/template/sections/services/index.html index eac5a68..1f56442 100644 --- a/template/sections/services/index.html +++ b/template/sections/services/index.html @@ -1,59 +1,59 @@

    Аренда игровых серверов

    -
    - Counter-Strike: 1.6 - - Заказать +
    + Counter-Strike: 1.6 + + Заказать
    -
    - Counter-Strike: Source v34 - - Заказать +
    + Counter-Strike: Source v34 + + Заказать
    -
    - Counter-Strike: Source - - Заказать +
    + Counter-Strike: Source + + Заказать
    -
    - Counter-Strike: GO - - Заказать +
    + Counter-Strike: GO + + Заказать
    -
    - GTA: SA-MP - - Заказать +
    + GTA: SA-MP + + Заказать
    -
    - GTA: CR-MP - - Заказать +
    + GTA: CR-MP + + Заказать
    -
    - GTA: MTA - - Заказать +
    + GTA: MTA + + Заказать
    -
    - MineCraft - - Заказать +
    + MineCraft + + Заказать

    Дополнительные услуги

    diff --git a/template/sections/user/auth.html b/template/sections/user/auth.html index 7bbabf3..18cebdb 100644 --- a/template/sections/user/auth.html +++ b/template/sections/user/auth.html @@ -1,42 +1,42 @@
    - - - - - - - - - - - - - - - - - - - -
    - - -
    - - -
    - - - - -
    - - -
    - -
    Восстановить пароль
    -
    Зарегистрироваться
    -
    + + + + + + + + + + + + + + + + + + + +
    + + +
    + + +
    + + + + +
    + + +
    + +
    Восстановить пароль
    +
    Зарегистрироваться
    +
    diff --git a/template/sections/user/gmenu.html b/template/sections/user/gmenu.html index 8345ea3..727123c 100644 --- a/template/sections/user/gmenu.html +++ b/template/sections/user/gmenu.html @@ -1,13 +1,13 @@ diff --git a/template/sections/user/inputs/signup.html b/template/sections/user/inputs/signup.html index 163f460..c170c1b 100644 --- a/template/sections/user/inputs/signup.html +++ b/template/sections/user/inputs/signup.html @@ -1,6 +1,6 @@ - - - - + + + + \ No newline at end of file diff --git a/template/sections/user/lk/auth.html b/template/sections/user/lk/auth.html index d3a7151..9e673ab 100644 --- a/template/sections/user/lk/auth.html +++ b/template/sections/user/lk/auth.html @@ -1,16 +1,16 @@

    Информация об авторизациях

    - - - - - - - [auth] - -
    Браузер - АдресДата
    + + + + + + + [auth] + +
    Браузер + АдресДата
    \ No newline at end of file diff --git a/template/sections/user/lk/auth/list.html b/template/sections/user/lk/auth/list.html index 358cdbf..f2e2a57 100644 --- a/template/sections/user/lk/auth/list.html +++ b/template/sections/user/lk/auth/list.html @@ -1,5 +1,5 @@ - Авторизация через браузер: [browser] (подробнее) - [ip] - [date] + Авторизация через браузер: [browser] (подробнее) + [ip] + [date] \ No newline at end of file diff --git a/template/sections/user/lk/index.html b/template/sections/user/lk/index.html index c02cf85..1d703c7 100644 --- a/template/sections/user/lk/index.html +++ b/template/sections/user/lk/index.html @@ -1,60 +1,60 @@

    Персональная информация №[id]

    - - - - - |nlp| - - - - - |_nlp| - - - - - - - - - - - - - - - - - - - - - - -
    Логин:[login] Зарегистрирован: [date] -
    Ф.И.О.:|lastname|[lastname]|_lastname| |name|[name]|_name| |patronymic|[patronymic]|_patronymic|
    Почта: - - -
    Изменить
    -
    Пароль: - - -
    Придумать
    -
    -
    Изменить
    -
    Тел.: - - -
    Подтвердить
    -
    -
    Изменить
    -
    Контакты: - - -
    Изменить
    -
    + + + + + |nlp| + + + + + |_nlp| + + + + + + + + + + + + + + + + + + + + + + +
    Логин:[login] Зарегистрирован: [date] +
    Ф.И.О.:|lastname|[lastname]|_lastname| |name|[name]|_name| |patronymic|[patronymic]|_patronymic|
    Почта: + + +
    Изменить
    +
    Пароль: + + +
    Придумать
    +
    +
    Изменить
    +
    Тел.: + + +
    Подтвердить
    +
    +
    Изменить
    +
    Контакты: + + +
    Изменить
    +
    @@ -62,40 +62,40 @@

    Дополнительная информация

    - - - - - - - - - - - |!wmr| - - - |_!wmr| - |wmr| - - |_wmr| - - - - - - - - - - -
    Партнерская ссылка:[home]?account=[id]Привлечено:[part_users] чел.
    Кошелек WMR: - - -
    Сохранить
    -
    - [wmr] - Реф. баланс:[part_money] [cur]
    Скидка на аренду:[rental]Скидка на продление:[extend]
    + + + + + + + + + + + |!wmr| + + + |_!wmr| + |wmr| + + |_wmr| + + + + + + + + + + +
    Партнерская ссылка:[home]?account=[id]Привлечено:[part_users] чел.
    Кошелек WMR: + + +
    Сохранить
    +
    + [wmr] + Реф. баланс:[part_money] [cur]
    Скидка на аренду:[rental]Скидка на продление:[extend]
    @@ -108,7 +108,7 @@ # Логин Дата регистрации - Заказанных серверов + Заказанных серверов diff --git a/template/sections/user/lk/logs.html b/template/sections/user/lk/logs.html index 615413e..6f078aa 100644 --- a/template/sections/user/lk/logs.html +++ b/template/sections/user/lk/logs.html @@ -1,15 +1,15 @@

    Логи последних операций

    - - - [logs] - -
    + + + [logs] + +
    \ No newline at end of file diff --git a/template/sections/user/lk/logs/list.html b/template/sections/user/lk/logs/list.html index f7a60f8..eecfcf9 100644 --- a/template/sections/user/lk/logs/list.html +++ b/template/sections/user/lk/logs/list.html @@ -1,6 +1,6 @@ - -

    Операция совершена: [date]

    - [text] - + +

    Операция совершена: [date]

    + [text] + \ No newline at end of file diff --git a/template/sections/user/lk/logs/replenish.html b/template/sections/user/lk/logs/replenish.html index f7a60f8..eecfcf9 100644 --- a/template/sections/user/lk/logs/replenish.html +++ b/template/sections/user/lk/logs/replenish.html @@ -1,6 +1,6 @@ - -

    Операция совершена: [date]

    - [text] - + +

    Операция совершена: [date]

    + [text] + \ No newline at end of file diff --git a/template/sections/user/lk/security.html b/template/sections/user/lk/security.html index f2aa70d..e510ce8 100644 --- a/template/sections/user/lk/security.html +++ b/template/sections/user/lk/security.html @@ -1,85 +1,85 @@

    Защита по IP

    - - - - - - - -
    - - [security] -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Защита: - - |security_ip|включена|_security_ip| - |!security_ip|выключена|_!security_ip| - - - |security_ip|
    Выключить
    |_security_ip| - |!security_ip|
    Включить
    |_!security_ip| -
    -
    Если включена защита, то авторизоваться можно только с указанных одиночных ip или подсетей.
    -
    -

    Ваш ip адрес: [ip] -

    Ваша подсеть: [subnetwork] -

    - Добавление одиночного адреса -
    Добавить
    - Добавление подсети (автоопределение) -
    Добавить
    Удалить
    Информация
    - Вывод информации об указанном адресе -
    -
    + + + + + + + +
    + + [security] +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Защита: + + |security_ip|включена|_security_ip| + |!security_ip|выключена|_!security_ip| + + + |security_ip|
    Выключить
    |_security_ip| + |!security_ip|
    Включить
    |_!security_ip| +
    +
    Если включена защита, то авторизоваться можно только с указанных одиночных ip или подсетей.
    +
    +

    Ваш ip адрес: [ip] +

    Ваша подсеть: [subnetwork] +

    + Добавление одиночного адреса +
    Добавить
    + Добавление подсети (автоопределение) +
    Добавить
    Удалить
    Информация
    + Вывод информации об указанном адресе +
    +
    @@ -87,32 +87,32 @@

    Защита по коду

    - - - - - - - - - - - -
    Защита: - - |security_code|включена|_security_code| - |!security_code|выключена|_!security_code| - - - |security_code|
    Выключить
    |_security_code| - |!security_code|
    Включить
    |_!security_code| -
    -
    Если включена защита по коду, то при каждой авторизации нужно вводить код, который будет отправлен на почту.
    -
    + + + + + + + + + + + +
    Защита: + + |security_code|включена|_security_code| + |!security_code|выключена|_!security_code| + + + |security_code|
    Выключить
    |_security_code| + |!security_code|
    Включить
    |_!security_code| +
    +
    Если включена защита по коду, то при каждой авторизации нужно вводить код, который будет отправлен на почту.
    +
    \ No newline at end of file diff --git a/template/sections/user/lk/security/list.html b/template/sections/user/lk/security/list.html index 78d46c3..17badab 100644 --- a/template/sections/user/lk/security/list.html +++ b/template/sections/user/lk/security/list.html @@ -1,4 +1,4 @@ -
    [address]
    - +
    [address]
    + \ No newline at end of file diff --git a/template/sections/user/lk/settings.html b/template/sections/user/lk/settings.html index 27d2ab5..8af22d0 100644 --- a/template/sections/user/lk/settings.html +++ b/template/sections/user/lk/settings.html @@ -1,38 +1,38 @@

    Аватарка

    - - - - - + + +
    -
    -

    Перетащите изображение сюда или

    -
    -
    + + + + + - - -
    +
    +

    Перетащите изображение сюда или

    +
    +
    -
    +
    - -
    + +
    @@ -40,18 +40,18 @@

    Уведомления

    - - - - - - - - - - - -
    При ответах на вопросы отправлять уведомления на почту, если вы не авторизованы.
    Рассылка акций, новостей, розыгрышей на почту.
    + + + + + + + + + + + +
    При ответах на вопросы отправлять уведомления на почту, если вы не авторизованы.
    Рассылка акций, новостей, розыгрышей на почту.
    @@ -62,5 +62,5 @@ \ No newline at end of file diff --git a/template/sections/user/recovery.html b/template/sections/user/recovery.html index 20024a5..7e27ed7 100644 --- a/template/sections/user/recovery.html +++ b/template/sections/user/recovery.html @@ -1,30 +1,30 @@
    - - - - - - - - - - - - - -
    - - -
    - - - - -
    -
    Авторизоваться
    -
    Зарегистрироваться
    - -
    + + + + + + + + + + + + + +
    + + +
    + + + + +
    +
    Авторизоваться
    +
    Зарегистрироваться
    + +
    diff --git a/template/sections/user/replenish.html b/template/sections/user/replenish.html index 297c170..8ee9261 100644 --- a/template/sections/user/replenish.html +++ b/template/sections/user/replenish.html @@ -1,53 +1,53 @@

    Форма пополнения баланса

    -
    - - - - - - - - - - - - - - - -
    -
    Вы будете перенаправлены на платежный шлюз для проведения операции пополнения
    -
    Ваш текущий баланс:[balance] [cur]Сумма:[cur] -
    UnitPay
    -
    - -
    + + + + + + + + + + + + + + + + +
    +
    Вы будете перенаправлены на платежный шлюз для проведения операции пополнения
    +
    Ваш текущий баланс:[balance] [cur]Сумма:[cur] +
    UnitPay
    +
    + +
    - - - - - -
    -
    + + + + + + +
    - - - - - - - - - - - - - - -
    + + + + + + + + + + + + + + +
    @@ -55,40 +55,40 @@

    Логи последних пополнений

    - - - [logs] - -
    + + + [logs] + +
    \ No newline at end of file diff --git a/template/sections/user/signup.html b/template/sections/user/signup.html index d674b32..97acafb 100644 --- a/template/sections/user/signup.html +++ b/template/sections/user/signup.html @@ -1,24 +1,24 @@
    - - - [inputs] - - - - - - - - -
    - - - - -
    - -
    Восстановить доступ
    -
    + + + [inputs] + + + + + + + + +
    + + + + +
    + +
    Восстановить доступ
    +
    @@ -30,7 +30,7 @@ Регистрируясь, Вы даёте согласие на обработку персональных данных.

    - + \ No newline at end of file diff --git a/template/sections/user/vmenu.html b/template/sections/user/vmenu.html index 6f8d9e6..a776d96 100644 --- a/template/sections/user/vmenu.html +++ b/template/sections/user/vmenu.html @@ -1,10 +1,10 @@ \ No newline at end of file diff --git a/template/sections/web/astats/free/install.html b/template/sections/web/astats/free/install.html index 962d76a..0cbdb2d 100644 --- a/template/sections/web/astats/free/install.html +++ b/template/sections/web/astats/free/install.html @@ -1,38 +1,38 @@

    Параметры установки

    -
    - - - - - - - - - - - - - - - -
    Адрес: - -
    Шаблон: - -
    - -
    -
    +
    + + + + + + + + + + + + + + + +
    Адрес: + +
    Шаблон: + +
    + +
    +
    \ No newline at end of file diff --git a/template/sections/web/astats/free/manage.html b/template/sections/web/astats/free/manage.html index 57c96d1..ad40116 100644 --- a/template/sections/web/astats/free/manage.html +++ b/template/sections/web/astats/free/manage.html @@ -1,44 +1,44 @@

    Информация

    -
    - - - - - - - - - - - - - - - - -
    - Адрес услуги -

    http://[url]/

    -
    - Автоподключение игрового сервера - -
    -
    У подключаемого игрового сервера должен быть всегда включен FileTP.
    -
    - -
    - |update|
    Обновить
    |_update| -
    Удалить
    -
    -
    +
    + + + + + + + + + + + + + + + + +
    + Адрес услуги +

    http://[url]/

    +
    + Автоподключение игрового сервера + +
    +
    У подключаемого игрового сервера должен быть всегда включен FileTP.
    +
    + +
    + |update|
    Обновить
    |_update| +
    Удалить
    +
    +
    \ No newline at end of file diff --git a/template/sections/web/csbans/free/install.html b/template/sections/web/csbans/free/install.html index d99797c..8eeedeb 100644 --- a/template/sections/web/csbans/free/install.html +++ b/template/sections/web/csbans/free/install.html @@ -1,47 +1,47 @@

    Параметры установки

    -
    - - - - - - - - - - - - - - - - - - - - -
    Адрес: - -
    Шаблон: - -
    Пароль: - -
    -
    Если не указывать пароль, то система сгенерирует его автоматически.
    -
    - -
    -
    +
    + + + + + + + + + + + + + + + + + + + + +
    Адрес: + +
    Шаблон: + +
    Пароль: + +
    +
    Если не указывать пароль, то система сгенерирует его автоматически.
    +
    + +
    +
    \ No newline at end of file diff --git a/template/sections/web/csbans/free/manage.html b/template/sections/web/csbans/free/manage.html index 0033e17..a8e1ae3 100644 --- a/template/sections/web/csbans/free/manage.html +++ b/template/sections/web/csbans/free/manage.html @@ -1,59 +1,59 @@

    Информация

    - - - - - - - - - - - - - - - - - - - - - -
    - Адрес услуги -

    http://[url]/

    -
    - Логин -

    admin

    -
    - Пароль -
    - [passwd] -
    Сменить пароль
    -
    -
    - Данные для sql.cfg - -
    - Автоподключение игрового сервера - -
    -
    После автоподключения игровой сервер необходимо перезапустить, если он запущен.
    -
    -
    Подключить
    -
    - |update|
    Обновить
    |_update| -
    Удалить
    -
    + + + + + + + + + + + + + + + + + + + + + +
    + Адрес услуги +

    http://[url]/

    +
    + Логин +

    admin

    +
    + Пароль +
    + [passwd] +
    Сменить пароль
    +
    +
    + Данные для sql.cfg + +
    + Автоподключение игрового сервера + +
    +
    После автоподключения игровой сервер необходимо перезапустить, если он запущен.
    +
    +
    Подключить
    +
    + |update|
    Обновить
    |_update| +
    Удалить
    +
    \ No newline at end of file diff --git a/template/sections/web/csstats/free/install.html b/template/sections/web/csstats/free/install.html index 0abda13..7d1d034 100644 --- a/template/sections/web/csstats/free/install.html +++ b/template/sections/web/csstats/free/install.html @@ -1,38 +1,38 @@

    Параметры установки

    -
    - - - - - - - - - - - - - - - -
    Адрес: - -
    Шаблон: - -
    - -
    -
    +
    + + + + + + + + + + + + + + + +
    Адрес: + +
    Шаблон: + +
    + +
    +
    \ No newline at end of file diff --git a/template/sections/web/csstats/free/manage.html b/template/sections/web/csstats/free/manage.html index 961cde8..a69180f 100644 --- a/template/sections/web/csstats/free/manage.html +++ b/template/sections/web/csstats/free/manage.html @@ -1,48 +1,48 @@

    Информация

    - - - - - - - - - - - - - - - - - - - -
    - Адрес услуги -

    http://[url]/

    -
    - Данные для sql.cfg - -
    - Автоподключение игрового сервера - -
    -
    После автоподключения игровой сервер необходимо перезапустить, если он запущен.
    -
    -
    Подключить
    -
    - |update|
    Обновить
    |_update| -
    Удалить
    -
    + + + + + + + + + + + + + + + + + + + +
    + Адрес услуги +

    http://[url]/

    +
    + Данные для sql.cfg + +
    + Автоподключение игрового сервера + +
    +
    После автоподключения игровой сервер необходимо перезапустить, если он запущен.
    +
    +
    Подключить
    +
    + |update|
    Обновить
    |_update| +
    Удалить
    +
    \ No newline at end of file diff --git a/template/sections/web/hosting/free/install.html b/template/sections/web/hosting/free/install.html index 91f06be..6c8afab 100644 --- a/template/sections/web/hosting/free/install.html +++ b/template/sections/web/hosting/free/install.html @@ -1,39 +1,39 @@

    Параметры установки

    -
    - - - - - - - - - - - - - - - - -
    Адрес: - -
    Пароль: - -
    -
    Если не указывать пароль, то система сгенерирует его автоматически.
    -
    - -
    -
    +
    + + + + + + + + + + + + + + + + +
    Адрес: + +
    Пароль: + +
    +
    Если не указывать пароль, то система сгенерирует его автоматически.
    +
    + +
    +
    \ No newline at end of file diff --git a/template/sections/web/hosting/free/manage.html b/template/sections/web/hosting/free/manage.html index 1b60254..71c51f5 100644 --- a/template/sections/web/hosting/free/manage.html +++ b/template/sections/web/hosting/free/manage.html @@ -1,42 +1,42 @@

    Информация

    - - - - - - - - - - - - -
    - Адрес услуги -

    http://[url]/

    -
    - Создан -
    - [date] -
    -
    - Логин -

    [login]

    -
    - Пароль -
    - [passwd] -
    Сменить пароль
    -
    -
    -
    Удалить
    -
    + + + + + + + + + + + + +
    + Адрес услуги +

    http://[url]/

    +
    + Создан +
    + [date] +
    +
    + Логин +

    [login]

    +
    + Пароль +
    + [passwd] +
    Сменить пароль
    +
    +
    +
    Удалить
    +
    \ No newline at end of file diff --git a/template/sections/web/mysql/free/install.html b/template/sections/web/mysql/free/install.html index fc6be08..b29126c 100644 --- a/template/sections/web/mysql/free/install.html +++ b/template/sections/web/mysql/free/install.html @@ -1,29 +1,29 @@

    Параметры установки

    -
    - - - - - - - - + + +
    Пароль: - -
    -
    Если не указывать пароль, то система сгенерирует его автоматически.
    + + + + + + + + + - - -
    Пароль: + +
    +
    Если не указывать пароль, то система сгенерирует его автоматически.
    - -
    - + +
    +
    \ No newline at end of file diff --git a/template/sections/web/mysql/free/manage.html b/template/sections/web/mysql/free/manage.html index 93c7c29..a65553e 100644 --- a/template/sections/web/mysql/free/manage.html +++ b/template/sections/web/mysql/free/manage.html @@ -1,36 +1,36 @@

    Информация

    - - - - - - - - - - - -
    - Адрес PhpMyAdmin -

    http://[url]/pma

    -
    - Логин -

    [login]

    -
    - Пароль -
    - [passwd] -
    Сменить пароль
    -
    -
    -
    Удалить
    -
    + + + + + + + + + + + +
    + Адрес PhpMyAdmin +

    http://[url]/pma

    +
    + Логин +

    [login]

    +
    + Пароль +
    + [passwd] +
    Сменить пароль
    +
    +
    +
    Удалить
    +
    \ No newline at end of file diff --git a/template/sections/web/sourcebans/free/install.html b/template/sections/web/sourcebans/free/install.html index 4a061b4..19a3fba 100644 --- a/template/sections/web/sourcebans/free/install.html +++ b/template/sections/web/sourcebans/free/install.html @@ -1,47 +1,47 @@

    Параметры установки

    -
    - - - - - - - - - - - - - - - - - - - - -
    Адрес: - -
    Шаблон: - -
    Пароль: - -
    -
    Если не указывать пароль, то система сгенерирует его автоматически.
    -
    - -
    -
    +
    + + + + + + + + + + + + + + + + + + + + +
    Адрес: + +
    Шаблон: + +
    Пароль: + +
    +
    Если не указывать пароль, то система сгенерирует его автоматически.
    +
    + +
    +
    \ No newline at end of file diff --git a/template/sections/web/sourcebans/free/manage.html b/template/sections/web/sourcebans/free/manage.html index 7325075..052e8fa 100644 --- a/template/sections/web/sourcebans/free/manage.html +++ b/template/sections/web/sourcebans/free/manage.html @@ -1,59 +1,59 @@

    Информация

    - - - - - - - - - - - - - - - - - - - - - -
    - Адрес услуги -

    http://[url]/

    -
    - Логин -

    admin

    -
    - Пароль -
    - [passwd] -
    Сменить пароль
    -
    -
    - Данные для sql.cfg - -
    - Автоподключение игрового сервера - -
    -
    После автоподключения игровой сервер необходимо перезапустить, если он запущен.
    -
    -
    Подключить
    -
    - |update|
    Обновить
    |_update| -
    Удалить
    -
    + + + + + + + + + + + + + + + + + + + + + +
    + Адрес услуги +

    http://[url]/

    +
    + Логин +

    admin

    +
    + Пароль +
    + [passwd] +
    Сменить пароль
    +
    +
    + Данные для sql.cfg + +
    + Автоподключение игрового сервера + +
    +
    После автоподключения игровой сервер необходимо перезапустить, если он запущен.
    +
    +
    Подключить
    +
    + |update|
    Обновить
    |_update| +
    Удалить
    +
    \ No newline at end of file