From d5bcf337c1d9443a9e60040c36e273e025b28577 Mon Sep 17 00:00:00 2001 From: David Cutting Date: Sat, 6 Feb 2016 20:42:29 +0000 Subject: [PATCH] initial trial commit for freenats build system --- .gitignore | 2 + build-config.php | 45 + build-tools/dbdump.sh | 6 + build-tools/dbupg.php | 98 + build-tools/myrug.cli.php | 116 + build-tools/myrug.inc.php | 99 + build-tools/myrug.sh | 4 + build-tools/pubdoc.php | 24 + build-tools/release.php | 103 + build.php | 241 ++ doc/html/LICENCE.TXT | 674 ++++++ doc/html/README.html | 14 + doc/html/THIS_IS_NOT_VMWARE.html | 7 + doc/html/install.html | 76 + doc/txt/README.txt | 12 + doc/txt/THIS_IS_NOT_VMWARE.txt | 5 + doc/txt/install.txt | 74 + freenats | 1 + pub/server/base/config.inc.php | 51 + sql/latest/default.sql | 48 + sql/latest/example.sql | 3 + sql/latest/schema.drop.sql | 494 ++++ sql/latest/schema.sql | 473 ++++ sql/latest/schema.upgrade.sql | 486 ++++ src/node/posix/config.inc.php | 53 + src/node/posix/freenats-node.php | 499 ++++ src/node/win32/node.vbs | 314 +++ src/node/win32/push.bat | 2 + src/server/base/.htaccess | 2 + src/server/base/config.inc.php | 64 + src/server/base/eval.inc.php | 66 + src/server/base/freenats.inc.php | 1081 +++++++++ src/server/base/help.inc.php | 214 ++ src/server/base/lang/English.en.lang.php | 608 +++++ src/server/base/lang/Italian.it.lang.php | 504 ++++ src/server/base/lang/Russian.ru.lang.php | 588 +++++ src/server/base/nats.cfg.inc.php | 70 + src/server/base/nats.db.inc.php | 126 + src/server/base/nats.lang.inc.php | 86 + src/server/base/nats.php | 69 + src/server/base/nats.tests.inc.php | 105 + src/server/base/node.xml.inc.php | 167 ++ src/server/base/phpmailer/LICENSE | 504 ++++ src/server/base/phpmailer/README | 218 ++ src/server/base/phpmailer/class.phpmailer.php | 2068 +++++++++++++++++ src/server/base/phpmailer/class.pop3.php | 407 ++++ src/server/base/phpmailer/class.smtp.php | 814 +++++++ src/server/base/rss.inc.php | 284 +++ src/server/base/schedule.inc.php | 101 + src/server/base/screen.inc.php | 647 ++++++ src/server/base/session.inc.php | 112 + src/server/base/site/events/console.php | 67 + .../base/site/events/detailed_alerts.php | 184 ++ src/server/base/site/events/file.php | 70 + src/server/base/site/events/generic.php | 54 + src/server/base/site/events/syslog.php | 80 + src/server/base/site/events/test.php | 74 + .../base/site/tests/advanced_page_test.php | 225 ++ .../base/site/tests/dynamic_dns_test.php | 160 ++ src/server/base/site/tests/ext.pagecheck.php | 223 ++ src/server/base/site/tests/page_load_sim.php | 156 ++ src/server/base/site/tests/page_load_sim.zip | Bin 0 -> 1747 bytes .../base/site/tests/proxy_page_load.php | 212 ++ src/server/base/site/tests/tcpdebug.php | 57 + src/server/base/sql/default.sql | 48 + src/server/base/sql/example.sql | 3 + src/server/base/sql/schema.drop.sql | 247 ++ src/server/base/sql/schema.sql | 224 ++ src/server/base/sql/schema.upgrade.sql | 241 ++ src/server/base/tests.inc.php | 374 +++ src/server/base/tests/dns.inc.php | 562 +++++ src/server/base/tests/imap.inc.php | 152 ++ src/server/base/tests/ldap.inc.php | 90 + src/server/base/tests/mysql.inc.php | 313 +++ src/server/base/tests/nats-dns.inc.php | 114 + src/server/base/tests/ppping.inc.php | 415 ++++ src/server/base/tests/smb.inc.php | 124 + src/server/base/tests/smtp.inc.php | 95 + src/server/base/tests/tcp.inc.php | 72 + src/server/base/tests/udp.inc.php | 122 + src/server/base/testtext.inc.php | 101 + src/server/base/timer.inc.php | 59 + src/server/base/view.inc.php | 111 + src/server/bin/.htaccess | 2 + src/server/bin/cleanup.php | 70 + src/server/bin/cleanup.sh | 3 + src/server/bin/clearalert.sh | 17 + src/server/bin/clearbigrecords.sh | 25 + src/server/bin/discover.php | 324 +++ src/server/bin/import.php | 342 +++ src/server/bin/include.php | 4 + src/server/bin/logwatch.php | 111 + src/server/bin/resettester.sh | 16 + src/server/bin/setvar.sh | 40 + src/server/bin/test-threaded.php | 50 + src/server/bin/test-threaded.sh | 3 + src/server/bin/tester.php | 510 ++++ src/server/bin/tester.sh | 3 + src/server/extras/events/console.php | 67 + src/server/extras/events/detailed_alerts.php | 184 ++ src/server/extras/events/file.php | 70 + src/server/extras/events/syslog.php | 80 + .../extras/tests/advanced_page_test.php | 225 ++ src/server/extras/tests/dynamic_dns_test.php | 160 ++ src/server/test/.htaccess | 2 + src/server/test/curl.sh | 65 + src/server/test/curl.txt | 791 +++++++ src/server/test/imap.sh | 36 + src/server/test/ip_lookup.sh | 15 + src/server/test/mysql.sh | 35 + src/server/test/phpmailer_test.php | 572 +++++ src/server/test/phpunit.php | 376 +++ src/server/test/ping.sh | 19 + src/server/test/smtp.sh | 20 + src/server/test/standalone/wspeed.sh | 86 + src/server/test/test.png | Bin 0 -> 1280 bytes src/server/test/test.sh | 17 + src/server/test/url_lookup.sh | 16 + src/server/test/url_lookup.sh~ | 16 + src/server/web/.htaccess | 2 + src/server/web/admin.backup.php | 235 ++ src/server/web/admin.dns.php | 211 ++ src/server/web/admin.php | 801 +++++++ src/server/web/admin.rss.php | 208 ++ src/server/web/admin.sql.php | 127 + src/server/web/api.php | 358 +++ src/server/web/confirm.php | 39 + src/server/web/css/iphone.css | 251 ++ src/server/web/css/main.css | 354 +++ src/server/web/css/mini.css | 14 + src/server/web/css/mobile.css | 117 + src/server/web/css/monitor.css | 70 + src/server/web/environment.test.php | 121 + src/server/web/eval.action.php | 74 + src/server/web/filemanager.php | 221 ++ src/server/web/firstrun.php | 180 ++ src/server/web/group.action.php | 139 ++ src/server/web/group.edit.php | 146 ++ src/server/web/group.php | 120 + src/server/web/help.php | 41 + src/server/web/history.alert.php | 141 ++ src/server/web/history.test.php | 527 +++++ src/server/web/icons/atom.png | Bin 0 -> 1770 bytes src/server/web/icons/default_group.gif | Bin 0 -> 1604 bytes src/server/web/icons/default_node.gif | Bin 0 -> 395 bytes src/server/web/icons/document.gif | Bin 0 -> 531 bytes src/server/web/icons/g_alarm.png | Bin 0 -> 5058 bytes src/server/web/icons/g_bino.png | Bin 0 -> 4761 bytes src/server/web/icons/g_cam.png | Bin 0 -> 4979 bytes src/server/web/icons/g_pda.png | Bin 0 -> 4843 bytes src/server/web/icons/globe.gif | Bin 0 -> 648 bytes src/server/web/icons/globe2.png | Bin 0 -> 2468 bytes src/server/web/icons/imageview.gif | Bin 0 -> 774 bytes src/server/web/icons/monitor.gif | Bin 0 -> 395 bytes src/server/web/icons/msw.png | Bin 0 -> 991 bytes src/server/web/icons/network.gif | Bin 0 -> 1604 bytes src/server/web/icons/personfile.gif | Bin 0 -> 317 bytes src/server/web/icons/special.gif | Bin 0 -> 713 bytes src/server/web/icons/textfile.gif | Bin 0 -> 333 bytes src/server/web/icons/workgroup.png | Bin 0 -> 1178 bytes .../web/images/arrows/off/arrow_back.png | Bin 0 -> 310 bytes .../web/images/arrows/off/arrow_down.png | Bin 0 -> 308 bytes .../web/images/arrows/off/arrow_next.png | Bin 0 -> 312 bytes .../web/images/arrows/off/arrow_top.png | Bin 0 -> 305 bytes .../web/images/arrows/on/arrow_back.png | Bin 0 -> 283 bytes .../web/images/arrows/on/arrow_down.png | Bin 0 -> 287 bytes .../web/images/arrows/on/arrow_next.png | Bin 0 -> 285 bytes src/server/web/images/arrows/on/arrow_top.png | Bin 0 -> 285 bytes src/server/web/images/comments.png | Bin 0 -> 319 bytes src/server/web/images/e0e0ff.10px.bl.jpg | Bin 0 -> 718 bytes src/server/web/images/e0e0ff.10px.br.jpg | Bin 0 -> 720 bytes src/server/web/images/e0e0ff.10px.tl.jpg | Bin 0 -> 711 bytes src/server/web/images/e0e0ff.10px.tr.jpg | Bin 0 -> 717 bytes src/server/web/images/graph.png | Bin 0 -> 446 bytes src/server/web/images/help16.png | Bin 0 -> 860 bytes src/server/web/images/help24.png | Bin 0 -> 1510 bytes src/server/web/images/help32.png | Bin 0 -> 2283 bytes src/server/web/images/info.gif | Bin 0 -> 166 bytes src/server/web/images/info12.gif | Bin 0 -> 163 bytes src/server/web/images/info12g.gif | Bin 0 -> 156 bytes src/server/web/images/info16.gif | Bin 0 -> 191 bytes src/server/web/images/info16g.gif | Bin 0 -> 176 bytes src/server/web/images/info8.gif | Bin 0 -> 139 bytes src/server/web/images/info8g.gif | Bin 0 -> 137 bytes src/server/web/images/iphone/back_button.png | Bin 0 -> 1192 bytes .../web/images/iphone/back_button_touched.png | Bin 0 -> 1141 bytes .../web/images/iphone/background_stripes.png | Bin 0 -> 2833 bytes src/server/web/images/iphone/chevron.png | Bin 0 -> 252 bytes .../web/images/iphone/chevron_touched.png | Bin 0 -> 333 bytes .../web/images/iphone/header_middle.png | Bin 0 -> 357 bytes .../images/iphone/item_background_touched.png | Bin 0 -> 183 bytes src/server/web/images/lights/Thumbs.db | Bin 0 -> 15872 bytes src/server/web/images/lights/a-1.png | Bin 0 -> 518 bytes src/server/web/images/lights/a0.png | Bin 0 -> 542 bytes src/server/web/images/lights/a1.png | Bin 0 -> 549 bytes src/server/web/images/lights/a2.png | Bin 0 -> 560 bytes src/server/web/images/loading/readme.txt | 2 + src/server/web/images/loading/small-bar.gif | Bin 0 -> 723 bytes .../web/images/loading/small-circle-dots.gif | Bin 0 -> 673 bytes .../web/images/loading/small-circle-lines.gif | Bin 0 -> 1849 bytes src/server/web/images/loading/small-kit.gif | Bin 0 -> 1079 bytes src/server/web/images/monitor_thumb/Thumbs.db | Bin 0 -> 7168 bytes .../web/images/monitor_thumb/alerting.png | Bin 0 -> 1570 bytes .../web/images/monitor_thumb/groups.png | Bin 0 -> 2553 bytes src/server/web/images/monitor_thumb/nodes.png | Bin 0 -> 1796 bytes .../web/images/monitor_thumb/standard.png | Bin 0 -> 2413 bytes src/server/web/images/options/Thumbs.db | Bin 0 -> 7168 bytes src/server/web/images/options/action_add.png | Bin 0 -> 288 bytes .../web/images/options/action_check.png | Bin 0 -> 344 bytes .../web/images/options/action_delete.png | Bin 0 -> 325 bytes .../web/images/options/action_remove.png | Bin 0 -> 195 bytes src/server/web/images/options/application.png | Bin 0 -> 267 bytes src/server/web/images/options/arrow_back.png | Bin 0 -> 283 bytes src/server/web/images/options/arrow_down.png | Bin 0 -> 287 bytes src/server/web/images/options/arrow_next.png | Bin 0 -> 285 bytes src/server/web/images/options/arrow_top.png | Bin 0 -> 285 bytes src/server/web/images/options/comments.png | Bin 0 -> 319 bytes src/server/web/images/options/download.png | Bin 0 -> 299 bytes src/server/web/images/options/file.png | Bin 0 -> 243 bytes src/server/web/images/options/folder.png | Bin 0 -> 293 bytes .../web/images/options/folder_files.png | Bin 0 -> 378 bytes src/server/web/images/options/folder_open.png | Bin 0 -> 337 bytes src/server/web/images/options/letter.png | Bin 0 -> 303 bytes src/server/web/images/options/letter_open.png | Bin 0 -> 315 bytes src/server/web/images/options/login.png | Bin 0 -> 352 bytes src/server/web/images/options/maximize.png | Bin 0 -> 298 bytes src/server/web/images/options/minimize.png | Bin 0 -> 276 bytes src/server/web/images/options/reply.png | Bin 0 -> 411 bytes src/server/web/images/options/rss.png | Bin 0 -> 568 bytes src/server/web/images/options/save.png | Bin 0 -> 415 bytes src/server/web/images/options/search.png | Bin 0 -> 391 bytes src/server/web/images/options/time.png | Bin 0 -> 453 bytes src/server/web/images/options/user.png | Bin 0 -> 416 bytes src/server/web/include.php | 25 + src/server/web/index.php | 99 + src/server/web/iphone.php | 295 +++ src/server/web/js/freenats.js | 50 + src/server/web/js/iphone.js | 88 + src/server/web/js/monitor.popup.js | 98 + src/server/web/localtest.action.php | 140 ++ src/server/web/localtest.edit.php | 246 ++ src/server/web/log.php | 152 ++ src/server/web/login.php | 69 + src/server/web/logout.php | 29 + src/server/web/main.php | 504 ++++ src/server/web/monitor.php | 293 +++ src/server/web/monitor.popup.php | 92 + src/server/web/node.action.php | 178 ++ src/server/web/node.edit.php | 711 ++++++ src/server/web/node.php | 224 ++ src/server/web/nodeside.edit.php | 242 ++ src/server/web/nodeside.push.php | 83 + src/server/web/pref.php | 80 + src/server/web/report.php | 725 ++++++ src/server/web/rss.php | 39 + src/server/web/schedule.php | 314 +++ src/server/web/summary.test.php | 185 ++ src/server/web/test.graph.php | 467 ++++ src/server/web/testrun.php | 101 + src/server/web/view.edit.php | 684 ++++++ src/server/web/view.link.php | 65 + src/server/web/view.php | 1100 +++++++++ src/server/web/welcome.php | 72 + src/shell-install.sh | 260 +++ src/vm-upgrade.sh | 131 ++ test/graphtest.php | 13 + test/split.php | 18 + test/versions.csv | 80 + test/versions.txt | 80 + 269 files changed, 34861 insertions(+) create mode 100644 .gitignore create mode 100644 build-config.php create mode 100755 build-tools/dbdump.sh create mode 100755 build-tools/dbupg.php create mode 100755 build-tools/myrug.cli.php create mode 100755 build-tools/myrug.inc.php create mode 100755 build-tools/myrug.sh create mode 100755 build-tools/pubdoc.php create mode 100644 build-tools/release.php create mode 100644 build.php create mode 100755 doc/html/LICENCE.TXT create mode 100755 doc/html/README.html create mode 100755 doc/html/THIS_IS_NOT_VMWARE.html create mode 100755 doc/html/install.html create mode 100755 doc/txt/README.txt create mode 100755 doc/txt/THIS_IS_NOT_VMWARE.txt create mode 100755 doc/txt/install.txt create mode 160000 freenats create mode 100755 pub/server/base/config.inc.php create mode 100755 sql/latest/default.sql create mode 100755 sql/latest/example.sql create mode 100755 sql/latest/schema.drop.sql create mode 100755 sql/latest/schema.sql create mode 100755 sql/latest/schema.upgrade.sql create mode 100755 src/node/posix/config.inc.php create mode 100755 src/node/posix/freenats-node.php create mode 100644 src/node/win32/node.vbs create mode 100755 src/node/win32/push.bat create mode 100755 src/server/base/.htaccess create mode 100755 src/server/base/config.inc.php create mode 100755 src/server/base/eval.inc.php create mode 100755 src/server/base/freenats.inc.php create mode 100755 src/server/base/help.inc.php create mode 100755 src/server/base/lang/English.en.lang.php create mode 100755 src/server/base/lang/Italian.it.lang.php create mode 100755 src/server/base/lang/Russian.ru.lang.php create mode 100755 src/server/base/nats.cfg.inc.php create mode 100755 src/server/base/nats.db.inc.php create mode 100755 src/server/base/nats.lang.inc.php create mode 100755 src/server/base/nats.php create mode 100755 src/server/base/nats.tests.inc.php create mode 100755 src/server/base/node.xml.inc.php create mode 100644 src/server/base/phpmailer/LICENSE create mode 100644 src/server/base/phpmailer/README create mode 100644 src/server/base/phpmailer/class.phpmailer.php create mode 100644 src/server/base/phpmailer/class.pop3.php create mode 100644 src/server/base/phpmailer/class.smtp.php create mode 100755 src/server/base/rss.inc.php create mode 100755 src/server/base/schedule.inc.php create mode 100755 src/server/base/screen.inc.php create mode 100755 src/server/base/session.inc.php create mode 100755 src/server/base/site/events/console.php create mode 100755 src/server/base/site/events/detailed_alerts.php create mode 100755 src/server/base/site/events/file.php create mode 100755 src/server/base/site/events/generic.php create mode 100755 src/server/base/site/events/syslog.php create mode 100755 src/server/base/site/events/test.php create mode 100755 src/server/base/site/tests/advanced_page_test.php create mode 100755 src/server/base/site/tests/dynamic_dns_test.php create mode 100755 src/server/base/site/tests/ext.pagecheck.php create mode 100755 src/server/base/site/tests/page_load_sim.php create mode 100644 src/server/base/site/tests/page_load_sim.zip create mode 100755 src/server/base/site/tests/proxy_page_load.php create mode 100755 src/server/base/site/tests/tcpdebug.php create mode 100755 src/server/base/sql/default.sql create mode 100755 src/server/base/sql/example.sql create mode 100755 src/server/base/sql/schema.drop.sql create mode 100755 src/server/base/sql/schema.sql create mode 100755 src/server/base/sql/schema.upgrade.sql create mode 100755 src/server/base/tests.inc.php create mode 100755 src/server/base/tests/dns.inc.php create mode 100755 src/server/base/tests/imap.inc.php create mode 100755 src/server/base/tests/ldap.inc.php create mode 100755 src/server/base/tests/mysql.inc.php create mode 100755 src/server/base/tests/nats-dns.inc.php create mode 100755 src/server/base/tests/ppping.inc.php create mode 100755 src/server/base/tests/smb.inc.php create mode 100755 src/server/base/tests/smtp.inc.php create mode 100755 src/server/base/tests/tcp.inc.php create mode 100755 src/server/base/tests/udp.inc.php create mode 100755 src/server/base/testtext.inc.php create mode 100755 src/server/base/timer.inc.php create mode 100755 src/server/base/view.inc.php create mode 100755 src/server/bin/.htaccess create mode 100755 src/server/bin/cleanup.php create mode 100755 src/server/bin/cleanup.sh create mode 100755 src/server/bin/clearalert.sh create mode 100755 src/server/bin/clearbigrecords.sh create mode 100755 src/server/bin/discover.php create mode 100755 src/server/bin/import.php create mode 100755 src/server/bin/include.php create mode 100755 src/server/bin/logwatch.php create mode 100755 src/server/bin/resettester.sh create mode 100755 src/server/bin/setvar.sh create mode 100755 src/server/bin/test-threaded.php create mode 100755 src/server/bin/test-threaded.sh create mode 100755 src/server/bin/tester.php create mode 100755 src/server/bin/tester.sh create mode 100755 src/server/extras/events/console.php create mode 100755 src/server/extras/events/detailed_alerts.php create mode 100755 src/server/extras/events/file.php create mode 100755 src/server/extras/events/syslog.php create mode 100755 src/server/extras/tests/advanced_page_test.php create mode 100755 src/server/extras/tests/dynamic_dns_test.php create mode 100755 src/server/test/.htaccess create mode 100755 src/server/test/curl.sh create mode 100755 src/server/test/curl.txt create mode 100755 src/server/test/imap.sh create mode 100755 src/server/test/ip_lookup.sh create mode 100755 src/server/test/mysql.sh create mode 100755 src/server/test/phpmailer_test.php create mode 100755 src/server/test/phpunit.php create mode 100755 src/server/test/ping.sh create mode 100755 src/server/test/smtp.sh create mode 100755 src/server/test/standalone/wspeed.sh create mode 100755 src/server/test/test.png create mode 100755 src/server/test/test.sh create mode 100755 src/server/test/url_lookup.sh create mode 100755 src/server/test/url_lookup.sh~ create mode 100755 src/server/web/.htaccess create mode 100755 src/server/web/admin.backup.php create mode 100755 src/server/web/admin.dns.php create mode 100755 src/server/web/admin.php create mode 100755 src/server/web/admin.rss.php create mode 100755 src/server/web/admin.sql.php create mode 100755 src/server/web/api.php create mode 100755 src/server/web/confirm.php create mode 100755 src/server/web/css/iphone.css create mode 100755 src/server/web/css/main.css create mode 100755 src/server/web/css/mini.css create mode 100755 src/server/web/css/mobile.css create mode 100755 src/server/web/css/monitor.css create mode 100755 src/server/web/environment.test.php create mode 100755 src/server/web/eval.action.php create mode 100755 src/server/web/filemanager.php create mode 100755 src/server/web/firstrun.php create mode 100755 src/server/web/group.action.php create mode 100755 src/server/web/group.edit.php create mode 100755 src/server/web/group.php create mode 100755 src/server/web/help.php create mode 100755 src/server/web/history.alert.php create mode 100755 src/server/web/history.test.php create mode 100755 src/server/web/icons/atom.png create mode 100755 src/server/web/icons/default_group.gif create mode 100755 src/server/web/icons/default_node.gif create mode 100755 src/server/web/icons/document.gif create mode 100755 src/server/web/icons/g_alarm.png create mode 100755 src/server/web/icons/g_bino.png create mode 100755 src/server/web/icons/g_cam.png create mode 100755 src/server/web/icons/g_pda.png create mode 100755 src/server/web/icons/globe.gif create mode 100755 src/server/web/icons/globe2.png create mode 100755 src/server/web/icons/imageview.gif create mode 100755 src/server/web/icons/monitor.gif create mode 100755 src/server/web/icons/msw.png create mode 100755 src/server/web/icons/network.gif create mode 100755 src/server/web/icons/personfile.gif create mode 100755 src/server/web/icons/special.gif create mode 100755 src/server/web/icons/textfile.gif create mode 100755 src/server/web/icons/workgroup.png create mode 100755 src/server/web/images/arrows/off/arrow_back.png create mode 100755 src/server/web/images/arrows/off/arrow_down.png create mode 100755 src/server/web/images/arrows/off/arrow_next.png create mode 100755 src/server/web/images/arrows/off/arrow_top.png create mode 100755 src/server/web/images/arrows/on/arrow_back.png create mode 100755 src/server/web/images/arrows/on/arrow_down.png create mode 100755 src/server/web/images/arrows/on/arrow_next.png create mode 100755 src/server/web/images/arrows/on/arrow_top.png create mode 100755 src/server/web/images/comments.png create mode 100755 src/server/web/images/e0e0ff.10px.bl.jpg create mode 100755 src/server/web/images/e0e0ff.10px.br.jpg create mode 100755 src/server/web/images/e0e0ff.10px.tl.jpg create mode 100755 src/server/web/images/e0e0ff.10px.tr.jpg create mode 100755 src/server/web/images/graph.png create mode 100755 src/server/web/images/help16.png create mode 100755 src/server/web/images/help24.png create mode 100755 src/server/web/images/help32.png create mode 100755 src/server/web/images/info.gif create mode 100755 src/server/web/images/info12.gif create mode 100755 src/server/web/images/info12g.gif create mode 100755 src/server/web/images/info16.gif create mode 100755 src/server/web/images/info16g.gif create mode 100755 src/server/web/images/info8.gif create mode 100755 src/server/web/images/info8g.gif create mode 100755 src/server/web/images/iphone/back_button.png create mode 100755 src/server/web/images/iphone/back_button_touched.png create mode 100755 src/server/web/images/iphone/background_stripes.png create mode 100755 src/server/web/images/iphone/chevron.png create mode 100755 src/server/web/images/iphone/chevron_touched.png create mode 100755 src/server/web/images/iphone/header_middle.png create mode 100755 src/server/web/images/iphone/item_background_touched.png create mode 100755 src/server/web/images/lights/Thumbs.db create mode 100755 src/server/web/images/lights/a-1.png create mode 100755 src/server/web/images/lights/a0.png create mode 100755 src/server/web/images/lights/a1.png create mode 100755 src/server/web/images/lights/a2.png create mode 100644 src/server/web/images/loading/readme.txt create mode 100644 src/server/web/images/loading/small-bar.gif create mode 100644 src/server/web/images/loading/small-circle-dots.gif create mode 100644 src/server/web/images/loading/small-circle-lines.gif create mode 100644 src/server/web/images/loading/small-kit.gif create mode 100755 src/server/web/images/monitor_thumb/Thumbs.db create mode 100755 src/server/web/images/monitor_thumb/alerting.png create mode 100755 src/server/web/images/monitor_thumb/groups.png create mode 100755 src/server/web/images/monitor_thumb/nodes.png create mode 100755 src/server/web/images/monitor_thumb/standard.png create mode 100755 src/server/web/images/options/Thumbs.db create mode 100755 src/server/web/images/options/action_add.png create mode 100755 src/server/web/images/options/action_check.png create mode 100755 src/server/web/images/options/action_delete.png create mode 100755 src/server/web/images/options/action_remove.png create mode 100755 src/server/web/images/options/application.png create mode 100755 src/server/web/images/options/arrow_back.png create mode 100755 src/server/web/images/options/arrow_down.png create mode 100755 src/server/web/images/options/arrow_next.png create mode 100755 src/server/web/images/options/arrow_top.png create mode 100755 src/server/web/images/options/comments.png create mode 100755 src/server/web/images/options/download.png create mode 100755 src/server/web/images/options/file.png create mode 100755 src/server/web/images/options/folder.png create mode 100755 src/server/web/images/options/folder_files.png create mode 100755 src/server/web/images/options/folder_open.png create mode 100755 src/server/web/images/options/letter.png create mode 100755 src/server/web/images/options/letter_open.png create mode 100755 src/server/web/images/options/login.png create mode 100755 src/server/web/images/options/maximize.png create mode 100755 src/server/web/images/options/minimize.png create mode 100755 src/server/web/images/options/reply.png create mode 100755 src/server/web/images/options/rss.png create mode 100755 src/server/web/images/options/save.png create mode 100755 src/server/web/images/options/search.png create mode 100755 src/server/web/images/options/time.png create mode 100755 src/server/web/images/options/user.png create mode 100755 src/server/web/include.php create mode 100755 src/server/web/index.php create mode 100755 src/server/web/iphone.php create mode 100755 src/server/web/js/freenats.js create mode 100755 src/server/web/js/iphone.js create mode 100755 src/server/web/js/monitor.popup.js create mode 100755 src/server/web/localtest.action.php create mode 100755 src/server/web/localtest.edit.php create mode 100755 src/server/web/log.php create mode 100755 src/server/web/login.php create mode 100755 src/server/web/logout.php create mode 100755 src/server/web/main.php create mode 100755 src/server/web/monitor.php create mode 100755 src/server/web/monitor.popup.php create mode 100755 src/server/web/node.action.php create mode 100755 src/server/web/node.edit.php create mode 100755 src/server/web/node.php create mode 100755 src/server/web/nodeside.edit.php create mode 100755 src/server/web/nodeside.push.php create mode 100755 src/server/web/pref.php create mode 100755 src/server/web/report.php create mode 100755 src/server/web/rss.php create mode 100755 src/server/web/schedule.php create mode 100755 src/server/web/summary.test.php create mode 100755 src/server/web/test.graph.php create mode 100755 src/server/web/testrun.php create mode 100755 src/server/web/view.edit.php create mode 100755 src/server/web/view.link.php create mode 100755 src/server/web/view.php create mode 100755 src/server/web/welcome.php create mode 100755 src/shell-install.sh create mode 100755 src/vm-upgrade.sh create mode 100644 test/graphtest.php create mode 100644 test/split.php create mode 100644 test/versions.csv create mode 100644 test/versions.txt diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fd914c5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +release/ + diff --git a/build-config.php b/build-config.php new file mode 100644 index 0000000..04dbc7e --- /dev/null +++ b/build-config.php @@ -0,0 +1,45 @@ + \ No newline at end of file diff --git a/build-tools/dbdump.sh b/build-tools/dbdump.sh new file mode 100755 index 0000000..86fff9a --- /dev/null +++ b/build-tools/dbdump.sh @@ -0,0 +1,6 @@ +#!/bin/bash +if [ "$5" == "drop" ]; then +/usr/bin/mysqldump -h $1 -u $3 -p$4 --add-drop-table -n -d $2 +else +/usr/bin/mysqldump -h $1 -u $3 -p$4 --skip-add-drop-table -n -d $2 +fi diff --git a/build-tools/dbupg.php b/build-tools/dbupg.php new file mode 100755 index 0000000..36ae913 --- /dev/null +++ b/build-tools/dbupg.php @@ -0,0 +1,98 @@ +3)) + { + echo "Usage: dbupg.sh database [filter]\n"; + exit(); + } + +if ($argc==3) + $filter=" LIKE \"".mysql_escape_string($argv[2])."%\""; +else + $filter=""; + +$sql=mysql_connect("localhost","root","marvin") + or die("Couldn't connect to MySQL"); +mysql_select_db($argv[1]) + or die("Couldn't select database"); + +function c($t="") +{ +echo "-- ".$t."\n"; +} + +c("dbupg.sh -- PurplePixie Systems"); +c(); + +$q="SHOW TABLES".$filter; +echo "-- ".$q."\n"; +$r=mysql_query($q); +while ($row=mysql_fetch_array($r)) + { + $table=$row[0]; + echo "-- Table: ".$table."\n"; + + //echo "DROP INDEX FROM ".$table."\n"; + + $tq="DESCRIBE ".$table; + c($tq); + $tr=mysql_query($tq); + while ($trow=mysql_fetch_array($tr)) + { + // Field Type Null Key Default Extra + + $f="ALTER TABLE `".$table."` CHANGE `".$trow['Field']."` `".$trow['Field']."` ".$trow['Type']; + if (($trow['Null']=="")||($trow['Null']=="NO")) $f.=" NOT NULL"; + if ($trow['Extra']!="") $f.=" ".$trow['Extra']; + if ($trow['Default']!="") $f.=" DEFAULT '".$trow['Default']."'"; + echo $f.";\n"; + + $f="ALTER TABLE `".$table."` ADD `".$trow['Field']."` ".$trow['Type']; + if (($trow['Null']=="")||($trow['Null']=="NO")) $f.=" NOT NULL"; + if ($trow['Extra']!="") $f.=" ".$trow['Extra']; + if ($trow['Default']!="") + { + /* + $typarr=explode("(",$trow['Type']); + $type=$typarr[0]; + $quot=true; + switch($type) + { + case "TINYINT": case "SMALLINT": case "MEDIUMINT": case "INT": case "INTEGER": case "BIGINT": + case "FLOAT": case "DOUBLE": + $quot=false; + break; + } + */ + $f.=" DEFAULT '".$trow['Default']."'"; + } + + echo $f.";\n"; + + if ($trow['Key']!="") + { + if ($trow['Key']=="PRI") + echo "ALTER TABLE `".$table."` ADD PRIMARY KEY( `".$trow['Field']."` );\n"; + else if ($trow['Key']=="MUL") + { + // the one at a time way + //echo "ALTER TABLE `".$table."` DROP INDEX `".$trow['Field']."` ;\n"; + //echo "ALTER TABLE `".$table."` ADD INDEX ( `".$trow['Field']."` );\n"; + echo "CREATE INDEX `".$trow['Field']."` ON `".$table."` ( `".$trow['Field']."` );\n"; + } + else + c("Unknown Key Type ".$trow['Key']); + //else if ($trow['Key']=="MUL") + // echo "ALTER TABLE `".$table."` ADD INDEX ( `".$trow['Field']."` );\n"; + } + } + mysql_free_result($tr); + c(); + } +mysql_close($sql); +?> diff --git a/build-tools/myrug.cli.php b/build-tools/myrug.cli.php new file mode 100755 index 0000000..e89ba9f --- /dev/null +++ b/build-tools/myrug.cli.php @@ -0,0 +1,116 @@ + "root", + 'password' => "", + 'database' => "", + 'host' => "127.0.0.1", + 'table' => "", + 'optimize' => false, + //'createtables' => false, // NYI + 'primarykey' => true, + 'createindex' => true, + 'createfield' => true, + 'alterfield' => true ); + +function display_help() +{ +echo "MySQL Rough Upgrader - outputs a SQL script which can be forced to\n"; +echo "upgrade a schema (with many errors). For more information please see\n"; +echo "http://www.purplepixie.org/myrug/\n\n"; +echo "Usage: myrug [options] database\n\n"; +echo "Where options are as follows:\n\n"; +echo "--username=X | -u=X Set username (default root)\n"; +echo "--password=X | -p=X Set password (default blank)\n"; +echo "--host=X | -h=X Connect to host (default 127.0.0.1)\n"; +echo "--table=X | -t=X Table name (can use % wildcard)\n"; +echo "database Database to connect to\n\n"; +echo "--primarykey | --noprimarykey\n"; +echo " Turns on or off PRIMARY KEY queries (default on)\n\n"; +echo "--createindex | --nocreateindex\n"; +echo " Turns on or off CREATE INDEX queries (default on)\n\n"; +echo "--createfield | --createfield\n"; +echo " Turns on or off new field queries (default on)\n\n"; +echo "--alterfield | --noalterfield\n"; +echo " Turns on or off update field queries (default on)\n\n"; +echo "--optimize | --nooptimize\n"; +echo " Turns on or off OPTIMIZE TABLE queries (default off)\n\n"; +exit(); +} + +if ($argc<2) display_help(); +if ($argv[1]=="help") display_help(); + +$cfg['database']=$argv[$argc-1]; + +for ($i=1; $i<($argc-1); $i++) + { + $opt=$argv[$i]; + if (strpos($opt,"=")!=false) + { + $cmd=substr($opt,0,strpos($opt,"=")); + $val=substr($opt,strpos($opt,"=")+1,128); + } + else $cmd=$opt; + + switch ($cmd) + { + case "-u": case "--username": case "--user": + $cfg['username']=$val; + break; + + case "-p": case "--password": case "--pass": + $cfg['password']=$val; + break; + + case "-t": case "--table": + $cfg['table']=$val; + break; + + case "-h": case "--host": + $cfg['host']=$val; + break; + + case "--optimize": case "--createtables": case "--primarykey": case "--createindex": + case "--createfield": case "--alterfield": + $name=substr($cmd,2,128); + $cfg[$name]=true; + break; + + case "--nooptimize": case "--nocreatetables": case "--noprimarykey": case "--nocreateindex": + case "--nocreatefield": case "--noalterfield": + $name=substr($cmd,4,128); + $cfg[$name]=false; + break; + + + default: + echo "Error parsing: ".$opt."\n"; + display_help(); + } + + } +myrug($cfg); +//print_r($cfg); + +?> diff --git a/build-tools/myrug.inc.php b/build-tools/myrug.inc.php new file mode 100755 index 0000000..262079e --- /dev/null +++ b/build-tools/myrug.inc.php @@ -0,0 +1,99 @@ + diff --git a/build-tools/myrug.sh b/build-tools/myrug.sh new file mode 100755 index 0000000..9b98eef --- /dev/null +++ b/build-tools/myrug.sh @@ -0,0 +1,4 @@ +#!/usr/bin/php -q + diff --git a/build-tools/pubdoc.php b/build-tools/pubdoc.php new file mode 100755 index 0000000..65bb2ec --- /dev/null +++ b/build-tools/pubdoc.php @@ -0,0 +1,24 @@ +Updated: ".date("H:i:s d/m/Y")."

\" > ".$fn; + $cmd[]="/bin/echo >> ".$fn; + $cmd[]="/bin/cat doc/txt/".$q." >> ".$fn; + foreach ($cmd as $c) + { + echo $c."\n"; + exec($c); + } + echo "\n"; + } +} +?> diff --git a/build-tools/release.php b/build-tools/release.php new file mode 100644 index 0000000..d0f234a --- /dev/null +++ b/build-tools/release.php @@ -0,0 +1,103 @@ +#!/usr/bin/php -q + + diff --git a/build.php b/build.php new file mode 100644 index 0000000..4fe33c1 --- /dev/null +++ b/build.php @@ -0,0 +1,241 @@ +Version.$_FREENATS->Release; + +for ($i=1; $i ".$BuildDir."/server/base/sql/schema.sql"; +$cmd[]="echo \"-- No DROP TABLES - suitable for upgrade\" >> ".$BuildDir."/server/base/sql/schema.sql"; +$cmd[]="./build-tools/dbdump.sh ".$_FREENATS_DB_SERVER." ".$_FREENATS_DB_DATABASE." ".$_FREENATS_DB_USERNAME." ".$_FREENATS_DB_PASSWORD." >> ".$BuildDir."/server/base/sql/schema.sql"; + +$cmd[]="echo \"-- FreeNATS ".$Build_ID." Schema\" > ".$BuildDir."/server/base/sql/schema.drop.sql"; +$cmd[]="echo \"-- With DROP TABLES - will clean database\" > ".$BuildDir."/server/base/sql/schema.drop.sql"; +$cmd[]="./build-tools/dbdump.sh ".$_FREENATS_DB_SERVER." ".$_FREENATS_DB_DATABASE." ".$_FREENATS_DB_USERNAME." ".$_FREENATS_DB_PASSWORD." drop >> ".$BuildDir."/server/base/sql/schema.drop.sql"; + +$cmd[]="echo \"-- FreeNATS ".$Build_ID." Schema\" > ".$BuildDir."/server/base/sql/schema.upgrade.sql"; +$cmd[]="echo \"-- Experimental Upgrade SQL - run after schema.sql (not drop!)\" >> ".$BuildDir."/server/base/sql/schema.upgrade.sql"; +$cmd[]="echo \"-- Both will generate many many errors - run with --force, ignore errors\" >> ".$BuildDir."/server/base/sql/schema.upgrade.sql"; +//$cmd[]="./dbupg.sh freenats fn >> ".$BuildDir."/server/base/sql/schema.upgrade.sql"; +$cmd[]="php build-tools/myrug.cli.php -h=".$_FREENATS_DB_SERVER." -u=".$_FREENATS_DB_USERNAME." -p=".$_FREENATS_DB_PASSWORD." ".$_FREENATS_DB_DATABASE." >> ".$BuildDir."/server/base/sql/schema.upgrade.sql"; + +$cmd[]="cp -Rf ".$BuildDir."/server/base/sql/* ./sql/latest/"; + +$Build_File = ""; +if (!$Config_Dummy) // Compress File +{ + if ($Config_Zip) + { + $Build_File = $BuildDir.".zip"; + $cmd[]="cd ".$Config_Dir." && zip -r ".$Build_ID.".zip ".$Build_ID; + } + else + { + $Build_File = $BuildDir.".tar"; + $cmd[]="tar -c -C ".$Config_Dir." ".$Build_ID." > ".$Build_File; + $cmd[]="gzip ".$Build_File; + $Build_File.=".gz"; + } +} + +if ($Config_Clean) +{ + $cmd[]="rm -Rf ".$BuildDir; +} + +if ($Config_Upload) +{ + $relscript="php build-tools/release.php ".$CompoundVersion." ".$Build_File; + if ($_FREENATS_UPLOAD_URL != "") + $relscript.=" ".$_FREENATS_UPLOAD_URL; + $cmd[]=$relscript; +} + +foreach($cmd as $c) + { + echo $c."\n"; + if ($Config_Exec === true) passthru($c); + } +?> \ No newline at end of file diff --git a/doc/html/LICENCE.TXT b/doc/html/LICENCE.TXT new file mode 100755 index 0000000..818433e --- /dev/null +++ b/doc/html/LICENCE.TXT @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/doc/html/README.html b/doc/html/README.html new file mode 100755 index 0000000..b162e75 --- /dev/null +++ b/doc/html/README.html @@ -0,0 +1,14 @@ +

Updated: 20:35:41 06/02/2016

+ +

FreeNATS

+ +Welcome to FreeNATS.

+FreeNATS is © Copyright 2008 PurplePixie Systems, all rights reserved. It is +released under the GNU General Public Licence.

+See install.html for the briefest of brief instructions. More (and up-to-date-ish) information +is available at the project homepage www.purplepixie.org/freenats. + +

+Good luck! +

+ diff --git a/doc/html/THIS_IS_NOT_VMWARE.html b/doc/html/THIS_IS_NOT_VMWARE.html new file mode 100755 index 0000000..26bfc6e --- /dev/null +++ b/doc/html/THIS_IS_NOT_VMWARE.html @@ -0,0 +1,7 @@ +

Updated: 20:35:41 06/02/2016

+ +This is NOT the VMWare Virtual Appliance it is just the PHP source code +

+Go to: the download page and download the VM +appliance if that is what you are after. +

diff --git a/doc/html/install.html b/doc/html/install.html new file mode 100755 index 0000000..dbb76a3 --- /dev/null +++ b/doc/html/install.html @@ -0,0 +1,76 @@ +

Updated: 20:35:41 06/02/2016

+ +

FreeNATS - Installation Documentation

+ +This brief installation document is the only documentation that comes with FreeNATS. For full up-to-date documentation and licence information visit the FreeNATS website at www.purplepixie.org/freenats. +

+There are two methods of installation available; automatic where a script does all the work creating the relevant database tables or you can import the SQL manually. +

+FreeNATS creates various tables in the database all prefixed with "fn". +

+Install PHP Source Code +

+Extract freenats-V.vv.sr.tar.gz

+"web" is the web interface directory and needs to be "published". Ideally the other dirs (base and bin) should be not published at all by apache but (a) it should be safe to call any of those scripts anyway and (b) there are .htaccess files in the dirs.

+If you have moved web somewhere (so the base dir is not ../base from the web dir) will need to edit the include.php file in the web dir and give it the base location (WITH TRAILING SLASH!). +

+You can do this automatically by running the "shell-install.sh" script in the root folder (copying and moving that is - not the DB setup etc). +

+Edit the base/config.inc.php file and put in your MySQL connection settings. +

+ +Upgrading +

+You can upgrade your system (files only - not schema) by using the "shell-install.sh" script. This will copy all files bar specific system config (the includes and config.inc files). +

+Feel free to try the experimental upgrade process to update the schema either by manually importing the +"schema.sql" and "schema.upgrade.sql" (one will create any missing tables and the other will +update any pre-existing tables) or by using the firstrun script (you will need to rename it from firstrun-.php and +then browse to it).

+Expect lots of errors with the update as it will try to recreate tables/fields/keys already in existance - don't +worry too much about it. You should be able to see any "serious" errors.

+ +Upgrading Virtual Appliance +

+Virtual Appliance users should use the "vm-upgrade.sh" script which will run the upgrade script with the correct default locations.

+Please note this will only upgrade FreeNATS - you should check for rPath upgrades through it's admin console. +

+Automatic Installation +

+Rename the web/firstrun-.php file to web/firstrun.php +

+Navigate to http://your.freenats.url/firstrun.php +

+Follow the instructions +

+Manual Installation +

+In the base/sql dir there are various .sql files - schema, schema.drop, schema.upgrade, default and example +

+You will need to run/import schema (the database table structure) and default (the admin user and some necessary default settings) for the system to work. +

+The example.sql file contains optional example node and group data and is recommended. +

+The schema.drop contains if table exists drop queries before trying to create the table so will clean out any +existing junk if required.

+The schema.upgrade contains upgrade instructions (see above) and not used for a fresh install. If you want to +upgrade you will need to run mysql (with --force) on schema.sql, upgrade.sql and default.sql in that order.

+The Tester Script +

+The tester script must be run (via cron or whatever) at regular intervals to poll the nodes. The recommended setting is five minutes.

+It requires the working directory to be the bin dir on startup. +

+There are two choices - either run bin/tester.sh which will test all enabled nodes waiting for each node/test in sequence and then raising the relevant +alerts and emails etc. The other option is to run bin/test-threaded.sh which will fork a background process for each node to test. This is better but will +send an alert email for each node that fails (rather than one with all the failures from that test run at the end). See the documentation for more information. +

+On many PHP/Linux security setups many of the low level tests (such as ping for example) can require root or some other special privs. You can always run the tester script manually from the console in different environments to test the output.

+Please note that a script crash for lack of privs may not be caught gracefully and may result in stuck monitor scripts and/or just an open monitor record in the database stopping other monitors from running. +

+In addition to the tester script you should run bin/cleanup.sh daily or so to clean out old sessions and data (inline with your retention settings). This doesn't +require any special privs unlike the tester. See the documentation for more information. +Troubleshooting +

+See www.purplepixie.org/freenats +

+ diff --git a/doc/txt/README.txt b/doc/txt/README.txt new file mode 100755 index 0000000..5012ea3 --- /dev/null +++ b/doc/txt/README.txt @@ -0,0 +1,12 @@ +

FreeNATS

+ +Welcome to FreeNATS.

+FreeNATS is © Copyright 2008 PurplePixie Systems, all rights reserved. It is +released under the GNU General Public Licence.

+See install.html for the briefest of brief instructions. More (and up-to-date-ish) information +is available at the project homepage www.purplepixie.org/freenats. + +

+Good luck! +

+ diff --git a/doc/txt/THIS_IS_NOT_VMWARE.txt b/doc/txt/THIS_IS_NOT_VMWARE.txt new file mode 100755 index 0000000..1b1c8fe --- /dev/null +++ b/doc/txt/THIS_IS_NOT_VMWARE.txt @@ -0,0 +1,5 @@ +This is NOT the VMWare Virtual Appliance it is just the PHP source code +

+Go to: the download page and download the VM +appliance if that is what you are after. +

diff --git a/doc/txt/install.txt b/doc/txt/install.txt new file mode 100755 index 0000000..04694c4 --- /dev/null +++ b/doc/txt/install.txt @@ -0,0 +1,74 @@ +

FreeNATS - Installation Documentation

+ +This brief installation document is the only documentation that comes with FreeNATS. For full up-to-date documentation and licence information visit the FreeNATS website at www.purplepixie.org/freenats. +

+There are two methods of installation available; automatic where a script does all the work creating the relevant database tables or you can import the SQL manually. +

+FreeNATS creates various tables in the database all prefixed with "fn". +

+Install PHP Source Code +

+Extract freenats-V.vv.sr.tar.gz

+"web" is the web interface directory and needs to be "published". Ideally the other dirs (base and bin) should be not published at all by apache but (a) it should be safe to call any of those scripts anyway and (b) there are .htaccess files in the dirs.

+If you have moved web somewhere (so the base dir is not ../base from the web dir) will need to edit the include.php file in the web dir and give it the base location (WITH TRAILING SLASH!). +

+You can do this automatically by running the "shell-install.sh" script in the root folder (copying and moving that is - not the DB setup etc). +

+Edit the base/config.inc.php file and put in your MySQL connection settings. +

+ +Upgrading +

+You can upgrade your system (files only - not schema) by using the "shell-install.sh" script. This will copy all files bar specific system config (the includes and config.inc files). +

+Feel free to try the experimental upgrade process to update the schema either by manually importing the +"schema.sql" and "schema.upgrade.sql" (one will create any missing tables and the other will +update any pre-existing tables) or by using the firstrun script (you will need to rename it from firstrun-.php and +then browse to it).

+Expect lots of errors with the update as it will try to recreate tables/fields/keys already in existance - don't +worry too much about it. You should be able to see any "serious" errors.

+ +Upgrading Virtual Appliance +

+Virtual Appliance users should use the "vm-upgrade.sh" script which will run the upgrade script with the correct default locations.

+Please note this will only upgrade FreeNATS - you should check for rPath upgrades through it's admin console. +

+Automatic Installation +

+Rename the web/firstrun-.php file to web/firstrun.php +

+Navigate to http://your.freenats.url/firstrun.php +

+Follow the instructions +

+Manual Installation +

+In the base/sql dir there are various .sql files - schema, schema.drop, schema.upgrade, default and example +

+You will need to run/import schema (the database table structure) and default (the admin user and some necessary default settings) for the system to work. +

+The example.sql file contains optional example node and group data and is recommended. +

+The schema.drop contains if table exists drop queries before trying to create the table so will clean out any +existing junk if required.

+The schema.upgrade contains upgrade instructions (see above) and not used for a fresh install. If you want to +upgrade you will need to run mysql (with --force) on schema.sql, upgrade.sql and default.sql in that order.

+The Tester Script +

+The tester script must be run (via cron or whatever) at regular intervals to poll the nodes. The recommended setting is five minutes.

+It requires the working directory to be the bin dir on startup. +

+There are two choices - either run bin/tester.sh which will test all enabled nodes waiting for each node/test in sequence and then raising the relevant +alerts and emails etc. The other option is to run bin/test-threaded.sh which will fork a background process for each node to test. This is better but will +send an alert email for each node that fails (rather than one with all the failures from that test run at the end). See the documentation for more information. +

+On many PHP/Linux security setups many of the low level tests (such as ping for example) can require root or some other special privs. You can always run the tester script manually from the console in different environments to test the output.

+Please note that a script crash for lack of privs may not be caught gracefully and may result in stuck monitor scripts and/or just an open monitor record in the database stopping other monitors from running. +

+In addition to the tester script you should run bin/cleanup.sh daily or so to clean out old sessions and data (inline with your retention settings). This doesn't +require any special privs unlike the tester. See the documentation for more information. +Troubleshooting +

+See www.purplepixie.org/freenats +

+ diff --git a/freenats b/freenats new file mode 160000 index 0000000..9e78964 --- /dev/null +++ b/freenats @@ -0,0 +1 @@ +Subproject commit 9e7896429a28c98492d3e3ac0f265c7192995ac4 diff --git a/pub/server/base/config.inc.php b/pub/server/base/config.inc.php new file mode 100755 index 0000000..91729d7 --- /dev/null +++ b/pub/server/base/config.inc.php @@ -0,0 +1,51 @@ + diff --git a/sql/latest/default.sql b/sql/latest/default.sql new file mode 100755 index 0000000..3dcefd6 --- /dev/null +++ b/sql/latest/default.sql @@ -0,0 +1,48 @@ +-- default.sql +-- FreeNATS Default Settings +INSERT INTO fnuser(username,password,realname,userlevel) VALUES("admin",MD5("admin"),"Administrator",10); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("site.name","FreeNATS"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("site.admin",""); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("site.email",""); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("site.enable.tester","1"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("site.enable.web","1"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("site.enable.adminsql","0"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("site.enable.interactive","1"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("site.popupmessage","0"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("site.graph.public","0"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("site.text.closed","Alert Closed"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("site.text.untested","Untested"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("site.text.passed","Passed"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("site.text.warning","Warning"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("site.text.failed","Failed"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("site.dtformat","H:i:s d/m/Y"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("site.include.tests","0"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("site.include.events","0"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("site.links.newwindow","1"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("log.level","5"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("freenats.firstrun","1"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("freenats.tracker","1"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("test.http.timeout","0"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("test.icmp.attempts","2"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("test.icmp.timeout","0"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("test.icmp.returnms","0"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("test.smtp.timeout","0"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("test.imap.timeout","0"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("test.mysql.timeout","0"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("test.tcp.timeout","0"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("test.udp.timeout","0"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("test.spawndelay","1"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("test.interval","0"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("retain.alert","0"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("retain.testrun","0"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("retain.record","0"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("retain.syslog","0"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("mail.fromname",""); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("mail.smtphostname",""); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("mail.smtpserver",""); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("mail.smtppassword",""); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("alert.body.footer",""); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("alert.body.header","FreeNATS Alert,"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("alert.subject.long","** FreeNATS Alert **"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("alert.subject.short","FreeNATS Alert"); + diff --git a/sql/latest/example.sql b/sql/latest/example.sql new file mode 100755 index 0000000..b5c95bf --- /dev/null +++ b/sql/latest/example.sql @@ -0,0 +1,3 @@ +-- example.sql +-- FreeNATS Example Settings +INSERT INTO fnnode(nodeid,nodename,nodedesc,hostname,nodeenabled,pingtest,weight) VALUES("freenats","FreeNATS","FreeNATS Server","127.0.0.1",1,1,10); \ No newline at end of file diff --git a/sql/latest/schema.drop.sql b/sql/latest/schema.drop.sql new file mode 100755 index 0000000..f7e09dc --- /dev/null +++ b/sql/latest/schema.drop.sql @@ -0,0 +1,494 @@ +-- With DROP TABLES - will clean database +-- MySQL dump 10.14 Distrib 5.5.43-MariaDB, for Linux (x86_64) +-- +-- Host: localhost Database: freenats +-- ------------------------------------------------------ +-- Server version 5.5.43-MariaDB + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `fnalert` +-- + +DROP TABLE IF EXISTS `fnalert`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `fnalert` ( + `alertid` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `nodeid` varchar(64) NOT NULL, + `alertlevel` int(11) NOT NULL DEFAULT '0', + `openedx` bigint(20) unsigned NOT NULL DEFAULT '0', + `closedx` bigint(20) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`alertid`), + KEY `nodeid` (`nodeid`), + KEY `closedx` (`closedx`) +) ENGINE=MyISAM AUTO_INCREMENT=2298 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `fnalertaction` +-- + +DROP TABLE IF EXISTS `fnalertaction`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `fnalertaction` ( + `aaid` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `atype` varchar(32) NOT NULL, + `efrom` varchar(250) NOT NULL, + `etolist` text NOT NULL, + `esubject` int(11) NOT NULL DEFAULT '0', + `etype` int(11) NOT NULL DEFAULT '0', + `awarnings` tinyint(1) NOT NULL DEFAULT '0', + `adecrease` tinyint(1) NOT NULL DEFAULT '0', + `mdata` text NOT NULL, + `aname` varchar(120) NOT NULL, + `ctrdate` varchar(8) NOT NULL, + `ctrlimit` int(10) unsigned NOT NULL DEFAULT '0', + `ctrtoday` int(10) unsigned NOT NULL DEFAULT '0', + `scheduleid` bigint(20) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`aaid`) +) ENGINE=MyISAM AUTO_INCREMENT=9 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `fnalertlog` +-- + +DROP TABLE IF EXISTS `fnalertlog`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `fnalertlog` ( + `alid` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `alertid` bigint(20) unsigned NOT NULL DEFAULT '0', + `postedx` bigint(20) unsigned NOT NULL DEFAULT '0', + `logentry` varchar(250) NOT NULL, + PRIMARY KEY (`alid`), + KEY `alertid` (`alertid`) +) ENGINE=MyISAM AUTO_INCREMENT=49727 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `fnconfig` +-- + +DROP TABLE IF EXISTS `fnconfig`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `fnconfig` ( + `fnc_var` varchar(64) NOT NULL, + `fnc_val` varchar(64) NOT NULL, + PRIMARY KEY (`fnc_var`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `fneval` +-- + +DROP TABLE IF EXISTS `fneval`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `fneval` ( + `evalid` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `testid` varchar(128) NOT NULL, + `weight` int(11) NOT NULL DEFAULT '0', + `eoperator` varchar(32) NOT NULL, + `evalue` varchar(128) NOT NULL, + `eoutcome` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`evalid`), + KEY `testid` (`testid`) +) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `fngroup` +-- + +DROP TABLE IF EXISTS `fngroup`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `fngroup` ( + `groupid` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `groupname` varchar(128) NOT NULL, + `groupdesc` varchar(250) NOT NULL, + `groupicon` varchar(64) NOT NULL, + `weight` int(10) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`groupid`) +) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `fngrouplink` +-- + +DROP TABLE IF EXISTS `fngrouplink`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `fngrouplink` ( + `glid` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `groupid` bigint(20) unsigned NOT NULL DEFAULT '0', + `nodeid` varchar(64) NOT NULL, + PRIMARY KEY (`glid`), + KEY `groupid` (`groupid`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `fnlocaltest` +-- + +DROP TABLE IF EXISTS `fnlocaltest`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `fnlocaltest` ( + `localtestid` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `nodeid` varchar(64) NOT NULL, + `alertlevel` int(11) NOT NULL DEFAULT '-1', + `lastrunx` bigint(20) unsigned NOT NULL DEFAULT '0', + `testtype` varchar(128) NOT NULL, + `testparam` varchar(250) DEFAULT NULL, + `testrecord` tinyint(1) NOT NULL DEFAULT '0', + `simpleeval` tinyint(1) NOT NULL DEFAULT '1', + `testname` varchar(64) NOT NULL, + `attempts` int(11) NOT NULL DEFAULT '0', + `timeout` int(11) NOT NULL DEFAULT '0', + `testenabled` tinyint(1) NOT NULL DEFAULT '1', + `testparam1` varchar(250) NOT NULL, + `testparam2` varchar(250) NOT NULL, + `testparam3` varchar(250) NOT NULL, + `testparam4` varchar(250) NOT NULL, + `testparam5` varchar(250) NOT NULL, + `testparam6` varchar(250) NOT NULL, + `testparam7` varchar(250) NOT NULL, + `testparam8` varchar(250) NOT NULL, + `testparam9` varchar(250) NOT NULL, + `lastvalue` float NOT NULL DEFAULT '0', + `testinterval` int(10) unsigned NOT NULL DEFAULT '0', + `nextrunx` bigint(20) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`localtestid`), + KEY `nodeid` (`nodeid`) +) ENGINE=MyISAM AUTO_INCREMENT=26 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `fnlog` +-- + +DROP TABLE IF EXISTS `fnlog`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `fnlog` ( + `logid` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `postedx` bigint(20) unsigned NOT NULL DEFAULT '0', + `modid` varchar(32) NOT NULL, + `catid` varchar(32) NOT NULL, + `username` varchar(64) NOT NULL, + `loglevel` int(11) NOT NULL DEFAULT '1', + `logevent` varchar(250) NOT NULL, + PRIMARY KEY (`logid`) +) ENGINE=MyISAM AUTO_INCREMENT=96829571 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `fnnalink` +-- + +DROP TABLE IF EXISTS `fnnalink`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `fnnalink` ( + `nalid` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `nodeid` varchar(64) NOT NULL, + `aaid` bigint(20) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`nalid`) +) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `fnnode` +-- + +DROP TABLE IF EXISTS `fnnode`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `fnnode` ( + `nodeid` varchar(64) NOT NULL, + `nodename` varchar(128) NOT NULL, + `nodedesc` varchar(254) NOT NULL, + `hostname` varchar(254) NOT NULL, + `nodeenabled` tinyint(1) NOT NULL DEFAULT '0', + `pingtest` tinyint(1) NOT NULL DEFAULT '0', + `pingfatal` tinyint(1) NOT NULL DEFAULT '0', + `alertlevel` int(11) NOT NULL DEFAULT '-1', + `nodeicon` varchar(64) NOT NULL, + `weight` int(10) unsigned NOT NULL DEFAULT '0', + `nodealert` tinyint(1) NOT NULL DEFAULT '1', + `scheduleid` bigint(20) NOT NULL DEFAULT '0', + `lastrunx` bigint(20) unsigned NOT NULL DEFAULT '0', + `testinterval` int(10) unsigned NOT NULL DEFAULT '5', + `nextrunx` bigint(20) unsigned NOT NULL DEFAULT '0', + `nsenabled` tinyint(1) NOT NULL DEFAULT '0', + `nsurl` varchar(254) NOT NULL, + `nskey` varchar(128) NOT NULL, + `nspullenabled` tinyint(1) NOT NULL DEFAULT '0', + `nspushenabled` tinyint(1) NOT NULL DEFAULT '0', + `nspuship` varchar(128) NOT NULL, + `nsinterval` int(10) unsigned NOT NULL DEFAULT '15', + `nslastx` bigint(20) unsigned NOT NULL DEFAULT '0', + `nsnextx` bigint(20) unsigned NOT NULL DEFAULT '0', + `nspullalert` tinyint(1) NOT NULL DEFAULT '0', + `nsfreshpush` tinyint(1) NOT NULL DEFAULT '0', + `masterid` varchar(64) NOT NULL, + `masterjustping` tinyint(1) NOT NULL DEFAULT '1', + `ulink0` tinyint(1) NOT NULL DEFAULT '0', + `ulink0_title` varchar(254) NOT NULL DEFAULT 'VNC', + `ulink0_url` varchar(254) NOT NULL DEFAULT 'http://{HOSTNAME}:5800/', + `ulink1` tinyint(1) NOT NULL DEFAULT '0', + `ulink1_title` varchar(254) NOT NULL DEFAULT 'SSH', + `ulink1_url` varchar(254) NOT NULL DEFAULT 'ssh://{HOSTNAME}', + `ulink2` tinyint(1) NOT NULL DEFAULT '0', + `ulink2_title` varchar(254) NOT NULL DEFAULT 'Web', + `ulink2_url` varchar(254) NOT NULL DEFAULT 'http://{HOSTNAME}', + PRIMARY KEY (`nodeid`), + KEY `masterid` (`masterid`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `fnnstest` +-- + +DROP TABLE IF EXISTS `fnnstest`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `fnnstest` ( + `nstestid` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `nodeid` varchar(64) NOT NULL DEFAULT '', + `alertlevel` int(11) NOT NULL DEFAULT '-1', + `lastrunx` bigint(20) unsigned NOT NULL DEFAULT '0', + `testtype` varchar(128) NOT NULL DEFAULT '', + `testdesc` varchar(250) DEFAULT NULL, + `testrecord` tinyint(1) NOT NULL DEFAULT '0', + `simpleeval` tinyint(1) NOT NULL DEFAULT '1', + `testname` varchar(64) NOT NULL DEFAULT '', + `testenabled` tinyint(1) NOT NULL DEFAULT '0', + `lastvalue` varchar(128) NOT NULL DEFAULT '', + `testalerts` tinyint(1) NOT NULL DEFAULT '1', + PRIMARY KEY (`nstestid`), + KEY `nodeid` (`nodeid`) +) ENGINE=MyISAM AUTO_INCREMENT=43486 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `fnrecord` +-- + +DROP TABLE IF EXISTS `fnrecord`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `fnrecord` ( + `recordid` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `testid` varchar(128) NOT NULL, + `alertlevel` int(11) NOT NULL DEFAULT '0', + `testvalue` float NOT NULL DEFAULT '0', + `recordx` bigint(20) unsigned NOT NULL DEFAULT '0', + `nodeid` varchar(64) NOT NULL, + PRIMARY KEY (`recordid`), + KEY `testid` (`testid`), + KEY `recordx` (`recordx`) +) ENGINE=MyISAM AUTO_INCREMENT=4768889 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `fnreport` +-- + +DROP TABLE IF EXISTS `fnreport`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `fnreport` ( + `reportid` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `reportname` varchar(128) NOT NULL DEFAULT '', + `reporttests` text NOT NULL, + PRIMARY KEY (`reportid`) +) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `fnrssfeed` +-- + +DROP TABLE IF EXISTS `fnrssfeed`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `fnrssfeed` ( + `feedid` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `feedkey` varchar(254) NOT NULL, + `feedname` varchar(254) NOT NULL, + `feedtype` varchar(32) NOT NULL, + `typeopt` varchar(254) NOT NULL, + `feedrange` varchar(32) NOT NULL, + `rangeopt` varchar(254) NOT NULL, + PRIMARY KEY (`feedid`) +) ENGINE=MyISAM AUTO_INCREMENT=12 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `fnscheditem` +-- + +DROP TABLE IF EXISTS `fnscheditem`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `fnscheditem` ( + `scheditemid` bigint(20) NOT NULL AUTO_INCREMENT, + `scheduleid` bigint(20) NOT NULL DEFAULT '0', + `dayofweek` varchar(8) NOT NULL DEFAULT '', + `dayofmonth` int(11) NOT NULL DEFAULT '0', + `monthofyear` int(11) NOT NULL DEFAULT '0', + `year` int(11) NOT NULL DEFAULT '0', + `starthour` int(11) NOT NULL DEFAULT '0', + `startmin` int(11) NOT NULL DEFAULT '0', + `finishhour` int(11) NOT NULL DEFAULT '23', + `finishmin` int(11) NOT NULL DEFAULT '59', + PRIMARY KEY (`scheditemid`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `fnschedule` +-- + +DROP TABLE IF EXISTS `fnschedule`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `fnschedule` ( + `scheduleid` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `schedulename` varchar(128) NOT NULL DEFAULT '', + `defaultaction` tinyint(1) NOT NULL DEFAULT '1', + PRIMARY KEY (`scheduleid`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `fnsession` +-- + +DROP TABLE IF EXISTS `fnsession`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `fnsession` ( + `sessionid` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `sessionkey` varchar(128) NOT NULL, + `ipaddress` varchar(128) NOT NULL, + `username` varchar(64) NOT NULL, + `startx` bigint(20) unsigned NOT NULL DEFAULT '0', + `updatex` bigint(20) unsigned NOT NULL DEFAULT '0', + `userlevel` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`sessionid`) +) ENGINE=MyISAM AUTO_INCREMENT=154 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `fntestrun` +-- + +DROP TABLE IF EXISTS `fntestrun`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `fntestrun` ( + `trid` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `startx` bigint(20) unsigned NOT NULL DEFAULT '0', + `finishx` bigint(20) unsigned NOT NULL DEFAULT '0', + `routput` text NOT NULL, + `fnode` varchar(64) NOT NULL, + PRIMARY KEY (`trid`), + KEY `finishx` (`finishx`), + KEY `fnode` (`fnode`) +) ENGINE=MyISAM AUTO_INCREMENT=3921917 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `fnuser` +-- + +DROP TABLE IF EXISTS `fnuser`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `fnuser` ( + `username` varchar(64) NOT NULL, + `password` varchar(64) NOT NULL, + `realname` varchar(128) NOT NULL, + `userlevel` int(11) NOT NULL DEFAULT '1', + PRIMARY KEY (`username`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `fnview` +-- + +DROP TABLE IF EXISTS `fnview`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `fnview` ( + `viewid` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `vtitle` varchar(128) NOT NULL DEFAULT '', + `vstyle` varchar(32) NOT NULL DEFAULT '', + `vpublic` tinyint(1) NOT NULL DEFAULT '0', + `vclick` varchar(32) NOT NULL DEFAULT '', + `vrefresh` int(11) NOT NULL DEFAULT '0', + `vlinkv` bigint(20) unsigned NOT NULL DEFAULT '0', + `vcolumns` smallint(6) NOT NULL DEFAULT '0', + `vcolon` tinyint(1) NOT NULL DEFAULT '1', + `vdashes` tinyint(1) NOT NULL DEFAULT '1', + `vtimeago` tinyint(1) NOT NULL DEFAULT '1', + PRIMARY KEY (`viewid`) +) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `fnviewitem` +-- + +DROP TABLE IF EXISTS `fnviewitem`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `fnviewitem` ( + `viewitemid` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `viewid` bigint(20) unsigned NOT NULL DEFAULT '0', + `itype` varchar(128) NOT NULL DEFAULT '', + `ioption` varchar(250) NOT NULL DEFAULT '', + `icolour` tinyint(1) NOT NULL DEFAULT '1', + `itextstatus` tinyint(1) NOT NULL DEFAULT '0', + `idetail` smallint(5) unsigned NOT NULL DEFAULT '0', + `iweight` int(10) unsigned NOT NULL DEFAULT '0', + `isize` smallint(6) NOT NULL DEFAULT '0', + `igraphic` smallint(6) NOT NULL DEFAULT '0', + `iname` varchar(64) NOT NULL DEFAULT '', + PRIMARY KEY (`viewitemid`), + KEY `viewid` (`viewid`) +) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2016-02-06 20:35:41 diff --git a/sql/latest/schema.sql b/sql/latest/schema.sql new file mode 100755 index 0000000..f0d005f --- /dev/null +++ b/sql/latest/schema.sql @@ -0,0 +1,473 @@ +-- FreeNATS freenats-1.14.2a Schema +-- No DROP TABLES - suitable for upgrade +-- MySQL dump 10.14 Distrib 5.5.43-MariaDB, for Linux (x86_64) +-- +-- Host: localhost Database: freenats +-- ------------------------------------------------------ +-- Server version 5.5.43-MariaDB + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `fnalert` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `fnalert` ( + `alertid` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `nodeid` varchar(64) NOT NULL, + `alertlevel` int(11) NOT NULL DEFAULT '0', + `openedx` bigint(20) unsigned NOT NULL DEFAULT '0', + `closedx` bigint(20) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`alertid`), + KEY `nodeid` (`nodeid`), + KEY `closedx` (`closedx`) +) ENGINE=MyISAM AUTO_INCREMENT=2298 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `fnalertaction` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `fnalertaction` ( + `aaid` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `atype` varchar(32) NOT NULL, + `efrom` varchar(250) NOT NULL, + `etolist` text NOT NULL, + `esubject` int(11) NOT NULL DEFAULT '0', + `etype` int(11) NOT NULL DEFAULT '0', + `awarnings` tinyint(1) NOT NULL DEFAULT '0', + `adecrease` tinyint(1) NOT NULL DEFAULT '0', + `mdata` text NOT NULL, + `aname` varchar(120) NOT NULL, + `ctrdate` varchar(8) NOT NULL, + `ctrlimit` int(10) unsigned NOT NULL DEFAULT '0', + `ctrtoday` int(10) unsigned NOT NULL DEFAULT '0', + `scheduleid` bigint(20) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`aaid`) +) ENGINE=MyISAM AUTO_INCREMENT=9 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `fnalertlog` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `fnalertlog` ( + `alid` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `alertid` bigint(20) unsigned NOT NULL DEFAULT '0', + `postedx` bigint(20) unsigned NOT NULL DEFAULT '0', + `logentry` varchar(250) NOT NULL, + PRIMARY KEY (`alid`), + KEY `alertid` (`alertid`) +) ENGINE=MyISAM AUTO_INCREMENT=49727 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `fnconfig` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `fnconfig` ( + `fnc_var` varchar(64) NOT NULL, + `fnc_val` varchar(64) NOT NULL, + PRIMARY KEY (`fnc_var`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `fneval` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `fneval` ( + `evalid` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `testid` varchar(128) NOT NULL, + `weight` int(11) NOT NULL DEFAULT '0', + `eoperator` varchar(32) NOT NULL, + `evalue` varchar(128) NOT NULL, + `eoutcome` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`evalid`), + KEY `testid` (`testid`) +) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `fngroup` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `fngroup` ( + `groupid` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `groupname` varchar(128) NOT NULL, + `groupdesc` varchar(250) NOT NULL, + `groupicon` varchar(64) NOT NULL, + `weight` int(10) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`groupid`) +) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `fngrouplink` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `fngrouplink` ( + `glid` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `groupid` bigint(20) unsigned NOT NULL DEFAULT '0', + `nodeid` varchar(64) NOT NULL, + PRIMARY KEY (`glid`), + KEY `groupid` (`groupid`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `fnlocaltest` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `fnlocaltest` ( + `localtestid` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `nodeid` varchar(64) NOT NULL, + `alertlevel` int(11) NOT NULL DEFAULT '-1', + `lastrunx` bigint(20) unsigned NOT NULL DEFAULT '0', + `testtype` varchar(128) NOT NULL, + `testparam` varchar(250) DEFAULT NULL, + `testrecord` tinyint(1) NOT NULL DEFAULT '0', + `simpleeval` tinyint(1) NOT NULL DEFAULT '1', + `testname` varchar(64) NOT NULL, + `attempts` int(11) NOT NULL DEFAULT '0', + `timeout` int(11) NOT NULL DEFAULT '0', + `testenabled` tinyint(1) NOT NULL DEFAULT '1', + `testparam1` varchar(250) NOT NULL, + `testparam2` varchar(250) NOT NULL, + `testparam3` varchar(250) NOT NULL, + `testparam4` varchar(250) NOT NULL, + `testparam5` varchar(250) NOT NULL, + `testparam6` varchar(250) NOT NULL, + `testparam7` varchar(250) NOT NULL, + `testparam8` varchar(250) NOT NULL, + `testparam9` varchar(250) NOT NULL, + `lastvalue` float NOT NULL DEFAULT '0', + `testinterval` int(10) unsigned NOT NULL DEFAULT '0', + `nextrunx` bigint(20) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`localtestid`), + KEY `nodeid` (`nodeid`) +) ENGINE=MyISAM AUTO_INCREMENT=26 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `fnlog` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `fnlog` ( + `logid` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `postedx` bigint(20) unsigned NOT NULL DEFAULT '0', + `modid` varchar(32) NOT NULL, + `catid` varchar(32) NOT NULL, + `username` varchar(64) NOT NULL, + `loglevel` int(11) NOT NULL DEFAULT '1', + `logevent` varchar(250) NOT NULL, + PRIMARY KEY (`logid`) +) ENGINE=MyISAM AUTO_INCREMENT=96829571 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `fnnalink` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `fnnalink` ( + `nalid` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `nodeid` varchar(64) NOT NULL, + `aaid` bigint(20) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`nalid`) +) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `fnnode` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `fnnode` ( + `nodeid` varchar(64) NOT NULL, + `nodename` varchar(128) NOT NULL, + `nodedesc` varchar(254) NOT NULL, + `hostname` varchar(254) NOT NULL, + `nodeenabled` tinyint(1) NOT NULL DEFAULT '0', + `pingtest` tinyint(1) NOT NULL DEFAULT '0', + `pingfatal` tinyint(1) NOT NULL DEFAULT '0', + `alertlevel` int(11) NOT NULL DEFAULT '-1', + `nodeicon` varchar(64) NOT NULL, + `weight` int(10) unsigned NOT NULL DEFAULT '0', + `nodealert` tinyint(1) NOT NULL DEFAULT '1', + `scheduleid` bigint(20) NOT NULL DEFAULT '0', + `lastrunx` bigint(20) unsigned NOT NULL DEFAULT '0', + `testinterval` int(10) unsigned NOT NULL DEFAULT '5', + `nextrunx` bigint(20) unsigned NOT NULL DEFAULT '0', + `nsenabled` tinyint(1) NOT NULL DEFAULT '0', + `nsurl` varchar(254) NOT NULL, + `nskey` varchar(128) NOT NULL, + `nspullenabled` tinyint(1) NOT NULL DEFAULT '0', + `nspushenabled` tinyint(1) NOT NULL DEFAULT '0', + `nspuship` varchar(128) NOT NULL, + `nsinterval` int(10) unsigned NOT NULL DEFAULT '15', + `nslastx` bigint(20) unsigned NOT NULL DEFAULT '0', + `nsnextx` bigint(20) unsigned NOT NULL DEFAULT '0', + `nspullalert` tinyint(1) NOT NULL DEFAULT '0', + `nsfreshpush` tinyint(1) NOT NULL DEFAULT '0', + `masterid` varchar(64) NOT NULL, + `masterjustping` tinyint(1) NOT NULL DEFAULT '1', + `ulink0` tinyint(1) NOT NULL DEFAULT '0', + `ulink0_title` varchar(254) NOT NULL DEFAULT 'VNC', + `ulink0_url` varchar(254) NOT NULL DEFAULT 'http://{HOSTNAME}:5800/', + `ulink1` tinyint(1) NOT NULL DEFAULT '0', + `ulink1_title` varchar(254) NOT NULL DEFAULT 'SSH', + `ulink1_url` varchar(254) NOT NULL DEFAULT 'ssh://{HOSTNAME}', + `ulink2` tinyint(1) NOT NULL DEFAULT '0', + `ulink2_title` varchar(254) NOT NULL DEFAULT 'Web', + `ulink2_url` varchar(254) NOT NULL DEFAULT 'http://{HOSTNAME}', + PRIMARY KEY (`nodeid`), + KEY `masterid` (`masterid`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `fnnstest` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `fnnstest` ( + `nstestid` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `nodeid` varchar(64) NOT NULL DEFAULT '', + `alertlevel` int(11) NOT NULL DEFAULT '-1', + `lastrunx` bigint(20) unsigned NOT NULL DEFAULT '0', + `testtype` varchar(128) NOT NULL DEFAULT '', + `testdesc` varchar(250) DEFAULT NULL, + `testrecord` tinyint(1) NOT NULL DEFAULT '0', + `simpleeval` tinyint(1) NOT NULL DEFAULT '1', + `testname` varchar(64) NOT NULL DEFAULT '', + `testenabled` tinyint(1) NOT NULL DEFAULT '0', + `lastvalue` varchar(128) NOT NULL DEFAULT '', + `testalerts` tinyint(1) NOT NULL DEFAULT '1', + PRIMARY KEY (`nstestid`), + KEY `nodeid` (`nodeid`) +) ENGINE=MyISAM AUTO_INCREMENT=43486 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `fnrecord` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `fnrecord` ( + `recordid` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `testid` varchar(128) NOT NULL, + `alertlevel` int(11) NOT NULL DEFAULT '0', + `testvalue` float NOT NULL DEFAULT '0', + `recordx` bigint(20) unsigned NOT NULL DEFAULT '0', + `nodeid` varchar(64) NOT NULL, + PRIMARY KEY (`recordid`), + KEY `testid` (`testid`), + KEY `recordx` (`recordx`) +) ENGINE=MyISAM AUTO_INCREMENT=4768889 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `fnreport` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `fnreport` ( + `reportid` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `reportname` varchar(128) NOT NULL DEFAULT '', + `reporttests` text NOT NULL, + PRIMARY KEY (`reportid`) +) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `fnrssfeed` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `fnrssfeed` ( + `feedid` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `feedkey` varchar(254) NOT NULL, + `feedname` varchar(254) NOT NULL, + `feedtype` varchar(32) NOT NULL, + `typeopt` varchar(254) NOT NULL, + `feedrange` varchar(32) NOT NULL, + `rangeopt` varchar(254) NOT NULL, + PRIMARY KEY (`feedid`) +) ENGINE=MyISAM AUTO_INCREMENT=12 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `fnscheditem` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `fnscheditem` ( + `scheditemid` bigint(20) NOT NULL AUTO_INCREMENT, + `scheduleid` bigint(20) NOT NULL DEFAULT '0', + `dayofweek` varchar(8) NOT NULL DEFAULT '', + `dayofmonth` int(11) NOT NULL DEFAULT '0', + `monthofyear` int(11) NOT NULL DEFAULT '0', + `year` int(11) NOT NULL DEFAULT '0', + `starthour` int(11) NOT NULL DEFAULT '0', + `startmin` int(11) NOT NULL DEFAULT '0', + `finishhour` int(11) NOT NULL DEFAULT '23', + `finishmin` int(11) NOT NULL DEFAULT '59', + PRIMARY KEY (`scheditemid`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `fnschedule` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `fnschedule` ( + `scheduleid` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `schedulename` varchar(128) NOT NULL DEFAULT '', + `defaultaction` tinyint(1) NOT NULL DEFAULT '1', + PRIMARY KEY (`scheduleid`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `fnsession` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `fnsession` ( + `sessionid` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `sessionkey` varchar(128) NOT NULL, + `ipaddress` varchar(128) NOT NULL, + `username` varchar(64) NOT NULL, + `startx` bigint(20) unsigned NOT NULL DEFAULT '0', + `updatex` bigint(20) unsigned NOT NULL DEFAULT '0', + `userlevel` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`sessionid`) +) ENGINE=MyISAM AUTO_INCREMENT=154 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `fntestrun` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `fntestrun` ( + `trid` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `startx` bigint(20) unsigned NOT NULL DEFAULT '0', + `finishx` bigint(20) unsigned NOT NULL DEFAULT '0', + `routput` text NOT NULL, + `fnode` varchar(64) NOT NULL, + PRIMARY KEY (`trid`), + KEY `finishx` (`finishx`), + KEY `fnode` (`fnode`) +) ENGINE=MyISAM AUTO_INCREMENT=3921917 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `fnuser` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `fnuser` ( + `username` varchar(64) NOT NULL, + `password` varchar(64) NOT NULL, + `realname` varchar(128) NOT NULL, + `userlevel` int(11) NOT NULL DEFAULT '1', + PRIMARY KEY (`username`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `fnview` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `fnview` ( + `viewid` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `vtitle` varchar(128) NOT NULL DEFAULT '', + `vstyle` varchar(32) NOT NULL DEFAULT '', + `vpublic` tinyint(1) NOT NULL DEFAULT '0', + `vclick` varchar(32) NOT NULL DEFAULT '', + `vrefresh` int(11) NOT NULL DEFAULT '0', + `vlinkv` bigint(20) unsigned NOT NULL DEFAULT '0', + `vcolumns` smallint(6) NOT NULL DEFAULT '0', + `vcolon` tinyint(1) NOT NULL DEFAULT '1', + `vdashes` tinyint(1) NOT NULL DEFAULT '1', + `vtimeago` tinyint(1) NOT NULL DEFAULT '1', + PRIMARY KEY (`viewid`) +) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `fnviewitem` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `fnviewitem` ( + `viewitemid` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `viewid` bigint(20) unsigned NOT NULL DEFAULT '0', + `itype` varchar(128) NOT NULL DEFAULT '', + `ioption` varchar(250) NOT NULL DEFAULT '', + `icolour` tinyint(1) NOT NULL DEFAULT '1', + `itextstatus` tinyint(1) NOT NULL DEFAULT '0', + `idetail` smallint(5) unsigned NOT NULL DEFAULT '0', + `iweight` int(10) unsigned NOT NULL DEFAULT '0', + `isize` smallint(6) NOT NULL DEFAULT '0', + `igraphic` smallint(6) NOT NULL DEFAULT '0', + `iname` varchar(64) NOT NULL DEFAULT '', + PRIMARY KEY (`viewitemid`), + KEY `viewid` (`viewid`) +) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2016-02-06 20:35:41 diff --git a/sql/latest/schema.upgrade.sql b/sql/latest/schema.upgrade.sql new file mode 100755 index 0000000..b358df2 --- /dev/null +++ b/sql/latest/schema.upgrade.sql @@ -0,0 +1,486 @@ +-- FreeNATS freenats-1.14.2a Schema +-- Experimental Upgrade SQL - run after schema.sql (not drop!) +-- Both will generate many many errors - run with --force, ignore errors +-- myrug -- PurplePixie Systems +-- http://www.purplepixie.org/myrug +-- +-- SHOW TABLES +-- Table: fnalert +-- DESCRIBE fnalert +ALTER TABLE `fnalert` CHANGE `alertid` `alertid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fnalert` ADD `alertid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fnalert` ADD PRIMARY KEY( `alertid` ); +ALTER TABLE `fnalert` CHANGE `nodeid` `nodeid` varchar(64) NOT NULL; +ALTER TABLE `fnalert` ADD `nodeid` varchar(64) NOT NULL; +CREATE INDEX `nodeid` ON `fnalert` ( `nodeid` ); +ALTER TABLE `fnalert` CHANGE `alertlevel` `alertlevel` int(11) NOT NULL DEFAULT '0'; +ALTER TABLE `fnalert` ADD `alertlevel` int(11) NOT NULL DEFAULT '0'; +ALTER TABLE `fnalert` CHANGE `openedx` `openedx` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnalert` ADD `openedx` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnalert` CHANGE `closedx` `closedx` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnalert` ADD `closedx` bigint(20) unsigned NOT NULL DEFAULT '0'; +CREATE INDEX `closedx` ON `fnalert` ( `closedx` ); +-- +-- Table: fnalertaction +-- DESCRIBE fnalertaction +ALTER TABLE `fnalertaction` CHANGE `aaid` `aaid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fnalertaction` ADD `aaid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fnalertaction` ADD PRIMARY KEY( `aaid` ); +ALTER TABLE `fnalertaction` CHANGE `atype` `atype` varchar(32) NOT NULL; +ALTER TABLE `fnalertaction` ADD `atype` varchar(32) NOT NULL; +ALTER TABLE `fnalertaction` CHANGE `efrom` `efrom` varchar(250) NOT NULL; +ALTER TABLE `fnalertaction` ADD `efrom` varchar(250) NOT NULL; +ALTER TABLE `fnalertaction` CHANGE `etolist` `etolist` text NOT NULL; +ALTER TABLE `fnalertaction` ADD `etolist` text NOT NULL; +ALTER TABLE `fnalertaction` CHANGE `esubject` `esubject` int(11) NOT NULL DEFAULT '0'; +ALTER TABLE `fnalertaction` ADD `esubject` int(11) NOT NULL DEFAULT '0'; +ALTER TABLE `fnalertaction` CHANGE `etype` `etype` int(11) NOT NULL DEFAULT '0'; +ALTER TABLE `fnalertaction` ADD `etype` int(11) NOT NULL DEFAULT '0'; +ALTER TABLE `fnalertaction` CHANGE `awarnings` `awarnings` tinyint(1) NOT NULL DEFAULT '0'; +ALTER TABLE `fnalertaction` ADD `awarnings` tinyint(1) NOT NULL DEFAULT '0'; +ALTER TABLE `fnalertaction` CHANGE `adecrease` `adecrease` tinyint(1) NOT NULL DEFAULT '0'; +ALTER TABLE `fnalertaction` ADD `adecrease` tinyint(1) NOT NULL DEFAULT '0'; +ALTER TABLE `fnalertaction` CHANGE `mdata` `mdata` text NOT NULL; +ALTER TABLE `fnalertaction` ADD `mdata` text NOT NULL; +ALTER TABLE `fnalertaction` CHANGE `aname` `aname` varchar(120) NOT NULL; +ALTER TABLE `fnalertaction` ADD `aname` varchar(120) NOT NULL; +ALTER TABLE `fnalertaction` CHANGE `ctrdate` `ctrdate` varchar(8) NOT NULL; +ALTER TABLE `fnalertaction` ADD `ctrdate` varchar(8) NOT NULL; +ALTER TABLE `fnalertaction` CHANGE `ctrlimit` `ctrlimit` int(10) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnalertaction` ADD `ctrlimit` int(10) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnalertaction` CHANGE `ctrtoday` `ctrtoday` int(10) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnalertaction` ADD `ctrtoday` int(10) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnalertaction` CHANGE `scheduleid` `scheduleid` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnalertaction` ADD `scheduleid` bigint(20) unsigned NOT NULL DEFAULT '0'; +-- +-- Table: fnalertlog +-- DESCRIBE fnalertlog +ALTER TABLE `fnalertlog` CHANGE `alid` `alid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fnalertlog` ADD `alid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fnalertlog` ADD PRIMARY KEY( `alid` ); +ALTER TABLE `fnalertlog` CHANGE `alertid` `alertid` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnalertlog` ADD `alertid` bigint(20) unsigned NOT NULL DEFAULT '0'; +CREATE INDEX `alertid` ON `fnalertlog` ( `alertid` ); +ALTER TABLE `fnalertlog` CHANGE `postedx` `postedx` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnalertlog` ADD `postedx` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnalertlog` CHANGE `logentry` `logentry` varchar(250) NOT NULL; +ALTER TABLE `fnalertlog` ADD `logentry` varchar(250) NOT NULL; +-- +-- Table: fnconfig +-- DESCRIBE fnconfig +ALTER TABLE `fnconfig` CHANGE `fnc_var` `fnc_var` varchar(64) NOT NULL; +ALTER TABLE `fnconfig` ADD `fnc_var` varchar(64) NOT NULL; +ALTER TABLE `fnconfig` ADD PRIMARY KEY( `fnc_var` ); +ALTER TABLE `fnconfig` CHANGE `fnc_val` `fnc_val` varchar(64) NOT NULL; +ALTER TABLE `fnconfig` ADD `fnc_val` varchar(64) NOT NULL; +-- +-- Table: fneval +-- DESCRIBE fneval +ALTER TABLE `fneval` CHANGE `evalid` `evalid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fneval` ADD `evalid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fneval` ADD PRIMARY KEY( `evalid` ); +ALTER TABLE `fneval` CHANGE `testid` `testid` varchar(128) NOT NULL; +ALTER TABLE `fneval` ADD `testid` varchar(128) NOT NULL; +CREATE INDEX `testid` ON `fneval` ( `testid` ); +ALTER TABLE `fneval` CHANGE `weight` `weight` int(11) NOT NULL DEFAULT '0'; +ALTER TABLE `fneval` ADD `weight` int(11) NOT NULL DEFAULT '0'; +ALTER TABLE `fneval` CHANGE `eoperator` `eoperator` varchar(32) NOT NULL; +ALTER TABLE `fneval` ADD `eoperator` varchar(32) NOT NULL; +ALTER TABLE `fneval` CHANGE `evalue` `evalue` varchar(128) NOT NULL; +ALTER TABLE `fneval` ADD `evalue` varchar(128) NOT NULL; +ALTER TABLE `fneval` CHANGE `eoutcome` `eoutcome` int(11) NOT NULL DEFAULT '0'; +ALTER TABLE `fneval` ADD `eoutcome` int(11) NOT NULL DEFAULT '0'; +-- +-- Table: fngroup +-- DESCRIBE fngroup +ALTER TABLE `fngroup` CHANGE `groupid` `groupid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fngroup` ADD `groupid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fngroup` ADD PRIMARY KEY( `groupid` ); +ALTER TABLE `fngroup` CHANGE `groupname` `groupname` varchar(128) NOT NULL; +ALTER TABLE `fngroup` ADD `groupname` varchar(128) NOT NULL; +ALTER TABLE `fngroup` CHANGE `groupdesc` `groupdesc` varchar(250) NOT NULL; +ALTER TABLE `fngroup` ADD `groupdesc` varchar(250) NOT NULL; +ALTER TABLE `fngroup` CHANGE `groupicon` `groupicon` varchar(64) NOT NULL; +ALTER TABLE `fngroup` ADD `groupicon` varchar(64) NOT NULL; +ALTER TABLE `fngroup` CHANGE `weight` `weight` int(10) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fngroup` ADD `weight` int(10) unsigned NOT NULL DEFAULT '0'; +-- +-- Table: fngrouplink +-- DESCRIBE fngrouplink +ALTER TABLE `fngrouplink` CHANGE `glid` `glid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fngrouplink` ADD `glid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fngrouplink` ADD PRIMARY KEY( `glid` ); +ALTER TABLE `fngrouplink` CHANGE `groupid` `groupid` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fngrouplink` ADD `groupid` bigint(20) unsigned NOT NULL DEFAULT '0'; +CREATE INDEX `groupid` ON `fngrouplink` ( `groupid` ); +ALTER TABLE `fngrouplink` CHANGE `nodeid` `nodeid` varchar(64) NOT NULL; +ALTER TABLE `fngrouplink` ADD `nodeid` varchar(64) NOT NULL; +-- +-- Table: fnlocaltest +-- DESCRIBE fnlocaltest +ALTER TABLE `fnlocaltest` CHANGE `localtestid` `localtestid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fnlocaltest` ADD `localtestid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fnlocaltest` ADD PRIMARY KEY( `localtestid` ); +ALTER TABLE `fnlocaltest` CHANGE `nodeid` `nodeid` varchar(64) NOT NULL; +ALTER TABLE `fnlocaltest` ADD `nodeid` varchar(64) NOT NULL; +CREATE INDEX `nodeid` ON `fnlocaltest` ( `nodeid` ); +ALTER TABLE `fnlocaltest` CHANGE `alertlevel` `alertlevel` int(11) NOT NULL DEFAULT '-1'; +ALTER TABLE `fnlocaltest` ADD `alertlevel` int(11) NOT NULL DEFAULT '-1'; +ALTER TABLE `fnlocaltest` CHANGE `lastrunx` `lastrunx` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnlocaltest` ADD `lastrunx` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnlocaltest` CHANGE `testtype` `testtype` varchar(128) NOT NULL; +ALTER TABLE `fnlocaltest` ADD `testtype` varchar(128) NOT NULL; +ALTER TABLE `fnlocaltest` CHANGE `testparam` `testparam` varchar(250); +ALTER TABLE `fnlocaltest` ADD `testparam` varchar(250); +ALTER TABLE `fnlocaltest` CHANGE `testrecord` `testrecord` tinyint(1) NOT NULL DEFAULT '0'; +ALTER TABLE `fnlocaltest` ADD `testrecord` tinyint(1) NOT NULL DEFAULT '0'; +ALTER TABLE `fnlocaltest` CHANGE `simpleeval` `simpleeval` tinyint(1) NOT NULL DEFAULT '1'; +ALTER TABLE `fnlocaltest` ADD `simpleeval` tinyint(1) NOT NULL DEFAULT '1'; +ALTER TABLE `fnlocaltest` CHANGE `testname` `testname` varchar(64) NOT NULL; +ALTER TABLE `fnlocaltest` ADD `testname` varchar(64) NOT NULL; +ALTER TABLE `fnlocaltest` CHANGE `attempts` `attempts` int(11) NOT NULL DEFAULT '0'; +ALTER TABLE `fnlocaltest` ADD `attempts` int(11) NOT NULL DEFAULT '0'; +ALTER TABLE `fnlocaltest` CHANGE `timeout` `timeout` int(11) NOT NULL DEFAULT '0'; +ALTER TABLE `fnlocaltest` ADD `timeout` int(11) NOT NULL DEFAULT '0'; +ALTER TABLE `fnlocaltest` CHANGE `testenabled` `testenabled` tinyint(1) NOT NULL DEFAULT '1'; +ALTER TABLE `fnlocaltest` ADD `testenabled` tinyint(1) NOT NULL DEFAULT '1'; +ALTER TABLE `fnlocaltest` CHANGE `testparam1` `testparam1` varchar(250) NOT NULL; +ALTER TABLE `fnlocaltest` ADD `testparam1` varchar(250) NOT NULL; +ALTER TABLE `fnlocaltest` CHANGE `testparam2` `testparam2` varchar(250) NOT NULL; +ALTER TABLE `fnlocaltest` ADD `testparam2` varchar(250) NOT NULL; +ALTER TABLE `fnlocaltest` CHANGE `testparam3` `testparam3` varchar(250) NOT NULL; +ALTER TABLE `fnlocaltest` ADD `testparam3` varchar(250) NOT NULL; +ALTER TABLE `fnlocaltest` CHANGE `testparam4` `testparam4` varchar(250) NOT NULL; +ALTER TABLE `fnlocaltest` ADD `testparam4` varchar(250) NOT NULL; +ALTER TABLE `fnlocaltest` CHANGE `testparam5` `testparam5` varchar(250) NOT NULL; +ALTER TABLE `fnlocaltest` ADD `testparam5` varchar(250) NOT NULL; +ALTER TABLE `fnlocaltest` CHANGE `testparam6` `testparam6` varchar(250) NOT NULL; +ALTER TABLE `fnlocaltest` ADD `testparam6` varchar(250) NOT NULL; +ALTER TABLE `fnlocaltest` CHANGE `testparam7` `testparam7` varchar(250) NOT NULL; +ALTER TABLE `fnlocaltest` ADD `testparam7` varchar(250) NOT NULL; +ALTER TABLE `fnlocaltest` CHANGE `testparam8` `testparam8` varchar(250) NOT NULL; +ALTER TABLE `fnlocaltest` ADD `testparam8` varchar(250) NOT NULL; +ALTER TABLE `fnlocaltest` CHANGE `testparam9` `testparam9` varchar(250) NOT NULL; +ALTER TABLE `fnlocaltest` ADD `testparam9` varchar(250) NOT NULL; +ALTER TABLE `fnlocaltest` CHANGE `lastvalue` `lastvalue` float NOT NULL DEFAULT '0'; +ALTER TABLE `fnlocaltest` ADD `lastvalue` float NOT NULL DEFAULT '0'; +ALTER TABLE `fnlocaltest` CHANGE `testinterval` `testinterval` int(10) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnlocaltest` ADD `testinterval` int(10) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnlocaltest` CHANGE `nextrunx` `nextrunx` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnlocaltest` ADD `nextrunx` bigint(20) unsigned NOT NULL DEFAULT '0'; +-- +-- Table: fnlog +-- DESCRIBE fnlog +ALTER TABLE `fnlog` CHANGE `logid` `logid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fnlog` ADD `logid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fnlog` ADD PRIMARY KEY( `logid` ); +ALTER TABLE `fnlog` CHANGE `postedx` `postedx` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnlog` ADD `postedx` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnlog` CHANGE `modid` `modid` varchar(32) NOT NULL; +ALTER TABLE `fnlog` ADD `modid` varchar(32) NOT NULL; +ALTER TABLE `fnlog` CHANGE `catid` `catid` varchar(32) NOT NULL; +ALTER TABLE `fnlog` ADD `catid` varchar(32) NOT NULL; +ALTER TABLE `fnlog` CHANGE `username` `username` varchar(64) NOT NULL; +ALTER TABLE `fnlog` ADD `username` varchar(64) NOT NULL; +ALTER TABLE `fnlog` CHANGE `loglevel` `loglevel` int(11) NOT NULL DEFAULT '1'; +ALTER TABLE `fnlog` ADD `loglevel` int(11) NOT NULL DEFAULT '1'; +ALTER TABLE `fnlog` CHANGE `logevent` `logevent` varchar(250) NOT NULL; +ALTER TABLE `fnlog` ADD `logevent` varchar(250) NOT NULL; +-- +-- Table: fnnalink +-- DESCRIBE fnnalink +ALTER TABLE `fnnalink` CHANGE `nalid` `nalid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fnnalink` ADD `nalid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fnnalink` ADD PRIMARY KEY( `nalid` ); +ALTER TABLE `fnnalink` CHANGE `nodeid` `nodeid` varchar(64) NOT NULL; +ALTER TABLE `fnnalink` ADD `nodeid` varchar(64) NOT NULL; +ALTER TABLE `fnnalink` CHANGE `aaid` `aaid` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnnalink` ADD `aaid` bigint(20) unsigned NOT NULL DEFAULT '0'; +-- +-- Table: fnnode +-- DESCRIBE fnnode +ALTER TABLE `fnnode` CHANGE `nodeid` `nodeid` varchar(64) NOT NULL; +ALTER TABLE `fnnode` ADD `nodeid` varchar(64) NOT NULL; +ALTER TABLE `fnnode` ADD PRIMARY KEY( `nodeid` ); +ALTER TABLE `fnnode` CHANGE `nodename` `nodename` varchar(128) NOT NULL; +ALTER TABLE `fnnode` ADD `nodename` varchar(128) NOT NULL; +ALTER TABLE `fnnode` CHANGE `nodedesc` `nodedesc` varchar(254) NOT NULL; +ALTER TABLE `fnnode` ADD `nodedesc` varchar(254) NOT NULL; +ALTER TABLE `fnnode` CHANGE `hostname` `hostname` varchar(254) NOT NULL; +ALTER TABLE `fnnode` ADD `hostname` varchar(254) NOT NULL; +ALTER TABLE `fnnode` CHANGE `nodeenabled` `nodeenabled` tinyint(1) NOT NULL DEFAULT '0'; +ALTER TABLE `fnnode` ADD `nodeenabled` tinyint(1) NOT NULL DEFAULT '0'; +ALTER TABLE `fnnode` CHANGE `pingtest` `pingtest` tinyint(1) NOT NULL DEFAULT '0'; +ALTER TABLE `fnnode` ADD `pingtest` tinyint(1) NOT NULL DEFAULT '0'; +ALTER TABLE `fnnode` CHANGE `pingfatal` `pingfatal` tinyint(1) NOT NULL DEFAULT '0'; +ALTER TABLE `fnnode` ADD `pingfatal` tinyint(1) NOT NULL DEFAULT '0'; +ALTER TABLE `fnnode` CHANGE `alertlevel` `alertlevel` int(11) NOT NULL DEFAULT '-1'; +ALTER TABLE `fnnode` ADD `alertlevel` int(11) NOT NULL DEFAULT '-1'; +ALTER TABLE `fnnode` CHANGE `nodeicon` `nodeicon` varchar(64) NOT NULL; +ALTER TABLE `fnnode` ADD `nodeicon` varchar(64) NOT NULL; +ALTER TABLE `fnnode` CHANGE `weight` `weight` int(10) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnnode` ADD `weight` int(10) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnnode` CHANGE `nodealert` `nodealert` tinyint(1) NOT NULL DEFAULT '1'; +ALTER TABLE `fnnode` ADD `nodealert` tinyint(1) NOT NULL DEFAULT '1'; +ALTER TABLE `fnnode` CHANGE `scheduleid` `scheduleid` bigint(20) NOT NULL DEFAULT '0'; +ALTER TABLE `fnnode` ADD `scheduleid` bigint(20) NOT NULL DEFAULT '0'; +ALTER TABLE `fnnode` CHANGE `lastrunx` `lastrunx` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnnode` ADD `lastrunx` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnnode` CHANGE `testinterval` `testinterval` int(10) unsigned NOT NULL DEFAULT '5'; +ALTER TABLE `fnnode` ADD `testinterval` int(10) unsigned NOT NULL DEFAULT '5'; +ALTER TABLE `fnnode` CHANGE `nextrunx` `nextrunx` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnnode` ADD `nextrunx` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnnode` CHANGE `nsenabled` `nsenabled` tinyint(1) NOT NULL DEFAULT '0'; +ALTER TABLE `fnnode` ADD `nsenabled` tinyint(1) NOT NULL DEFAULT '0'; +ALTER TABLE `fnnode` CHANGE `nsurl` `nsurl` varchar(254) NOT NULL; +ALTER TABLE `fnnode` ADD `nsurl` varchar(254) NOT NULL; +ALTER TABLE `fnnode` CHANGE `nskey` `nskey` varchar(128) NOT NULL; +ALTER TABLE `fnnode` ADD `nskey` varchar(128) NOT NULL; +ALTER TABLE `fnnode` CHANGE `nspullenabled` `nspullenabled` tinyint(1) NOT NULL DEFAULT '0'; +ALTER TABLE `fnnode` ADD `nspullenabled` tinyint(1) NOT NULL DEFAULT '0'; +ALTER TABLE `fnnode` CHANGE `nspushenabled` `nspushenabled` tinyint(1) NOT NULL DEFAULT '0'; +ALTER TABLE `fnnode` ADD `nspushenabled` tinyint(1) NOT NULL DEFAULT '0'; +ALTER TABLE `fnnode` CHANGE `nspuship` `nspuship` varchar(128) NOT NULL; +ALTER TABLE `fnnode` ADD `nspuship` varchar(128) NOT NULL; +ALTER TABLE `fnnode` CHANGE `nsinterval` `nsinterval` int(10) unsigned NOT NULL DEFAULT '15'; +ALTER TABLE `fnnode` ADD `nsinterval` int(10) unsigned NOT NULL DEFAULT '15'; +ALTER TABLE `fnnode` CHANGE `nslastx` `nslastx` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnnode` ADD `nslastx` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnnode` CHANGE `nsnextx` `nsnextx` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnnode` ADD `nsnextx` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnnode` CHANGE `nspullalert` `nspullalert` tinyint(1) NOT NULL DEFAULT '0'; +ALTER TABLE `fnnode` ADD `nspullalert` tinyint(1) NOT NULL DEFAULT '0'; +ALTER TABLE `fnnode` CHANGE `nsfreshpush` `nsfreshpush` tinyint(1) NOT NULL DEFAULT '0'; +ALTER TABLE `fnnode` ADD `nsfreshpush` tinyint(1) NOT NULL DEFAULT '0'; +ALTER TABLE `fnnode` CHANGE `masterid` `masterid` varchar(64) NOT NULL; +ALTER TABLE `fnnode` ADD `masterid` varchar(64) NOT NULL; +CREATE INDEX `masterid` ON `fnnode` ( `masterid` ); +ALTER TABLE `fnnode` CHANGE `masterjustping` `masterjustping` tinyint(1) NOT NULL DEFAULT '1'; +ALTER TABLE `fnnode` ADD `masterjustping` tinyint(1) NOT NULL DEFAULT '1'; +ALTER TABLE `fnnode` CHANGE `ulink0` `ulink0` tinyint(1) NOT NULL DEFAULT '0'; +ALTER TABLE `fnnode` ADD `ulink0` tinyint(1) NOT NULL DEFAULT '0'; +ALTER TABLE `fnnode` CHANGE `ulink0_title` `ulink0_title` varchar(254) NOT NULL DEFAULT 'VNC'; +ALTER TABLE `fnnode` ADD `ulink0_title` varchar(254) NOT NULL DEFAULT 'VNC'; +ALTER TABLE `fnnode` CHANGE `ulink0_url` `ulink0_url` varchar(254) NOT NULL DEFAULT 'http://{HOSTNAME}:5800/'; +ALTER TABLE `fnnode` ADD `ulink0_url` varchar(254) NOT NULL DEFAULT 'http://{HOSTNAME}:5800/'; +ALTER TABLE `fnnode` CHANGE `ulink1` `ulink1` tinyint(1) NOT NULL DEFAULT '0'; +ALTER TABLE `fnnode` ADD `ulink1` tinyint(1) NOT NULL DEFAULT '0'; +ALTER TABLE `fnnode` CHANGE `ulink1_title` `ulink1_title` varchar(254) NOT NULL DEFAULT 'SSH'; +ALTER TABLE `fnnode` ADD `ulink1_title` varchar(254) NOT NULL DEFAULT 'SSH'; +ALTER TABLE `fnnode` CHANGE `ulink1_url` `ulink1_url` varchar(254) NOT NULL DEFAULT 'ssh://{HOSTNAME}'; +ALTER TABLE `fnnode` ADD `ulink1_url` varchar(254) NOT NULL DEFAULT 'ssh://{HOSTNAME}'; +ALTER TABLE `fnnode` CHANGE `ulink2` `ulink2` tinyint(1) NOT NULL DEFAULT '0'; +ALTER TABLE `fnnode` ADD `ulink2` tinyint(1) NOT NULL DEFAULT '0'; +ALTER TABLE `fnnode` CHANGE `ulink2_title` `ulink2_title` varchar(254) NOT NULL DEFAULT 'Web'; +ALTER TABLE `fnnode` ADD `ulink2_title` varchar(254) NOT NULL DEFAULT 'Web'; +ALTER TABLE `fnnode` CHANGE `ulink2_url` `ulink2_url` varchar(254) NOT NULL DEFAULT 'http://{HOSTNAME}'; +ALTER TABLE `fnnode` ADD `ulink2_url` varchar(254) NOT NULL DEFAULT 'http://{HOSTNAME}'; +-- +-- Table: fnnstest +-- DESCRIBE fnnstest +ALTER TABLE `fnnstest` CHANGE `nstestid` `nstestid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fnnstest` ADD `nstestid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fnnstest` ADD PRIMARY KEY( `nstestid` ); +ALTER TABLE `fnnstest` CHANGE `nodeid` `nodeid` varchar(64) NOT NULL; +ALTER TABLE `fnnstest` ADD `nodeid` varchar(64) NOT NULL; +CREATE INDEX `nodeid` ON `fnnstest` ( `nodeid` ); +ALTER TABLE `fnnstest` CHANGE `alertlevel` `alertlevel` int(11) NOT NULL DEFAULT '-1'; +ALTER TABLE `fnnstest` ADD `alertlevel` int(11) NOT NULL DEFAULT '-1'; +ALTER TABLE `fnnstest` CHANGE `lastrunx` `lastrunx` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnnstest` ADD `lastrunx` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnnstest` CHANGE `testtype` `testtype` varchar(128) NOT NULL; +ALTER TABLE `fnnstest` ADD `testtype` varchar(128) NOT NULL; +ALTER TABLE `fnnstest` CHANGE `testdesc` `testdesc` varchar(250); +ALTER TABLE `fnnstest` ADD `testdesc` varchar(250); +ALTER TABLE `fnnstest` CHANGE `testrecord` `testrecord` tinyint(1) NOT NULL DEFAULT '0'; +ALTER TABLE `fnnstest` ADD `testrecord` tinyint(1) NOT NULL DEFAULT '0'; +ALTER TABLE `fnnstest` CHANGE `simpleeval` `simpleeval` tinyint(1) NOT NULL DEFAULT '1'; +ALTER TABLE `fnnstest` ADD `simpleeval` tinyint(1) NOT NULL DEFAULT '1'; +ALTER TABLE `fnnstest` CHANGE `testname` `testname` varchar(64) NOT NULL; +ALTER TABLE `fnnstest` ADD `testname` varchar(64) NOT NULL; +ALTER TABLE `fnnstest` CHANGE `testenabled` `testenabled` tinyint(1) NOT NULL DEFAULT '0'; +ALTER TABLE `fnnstest` ADD `testenabled` tinyint(1) NOT NULL DEFAULT '0'; +ALTER TABLE `fnnstest` CHANGE `lastvalue` `lastvalue` varchar(128) NOT NULL; +ALTER TABLE `fnnstest` ADD `lastvalue` varchar(128) NOT NULL; +ALTER TABLE `fnnstest` CHANGE `testalerts` `testalerts` tinyint(1) NOT NULL DEFAULT '1'; +ALTER TABLE `fnnstest` ADD `testalerts` tinyint(1) NOT NULL DEFAULT '1'; +-- +-- Table: fnrecord +-- DESCRIBE fnrecord +ALTER TABLE `fnrecord` CHANGE `recordid` `recordid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fnrecord` ADD `recordid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fnrecord` ADD PRIMARY KEY( `recordid` ); +ALTER TABLE `fnrecord` CHANGE `testid` `testid` varchar(128) NOT NULL; +ALTER TABLE `fnrecord` ADD `testid` varchar(128) NOT NULL; +CREATE INDEX `testid` ON `fnrecord` ( `testid` ); +ALTER TABLE `fnrecord` CHANGE `alertlevel` `alertlevel` int(11) NOT NULL DEFAULT '0'; +ALTER TABLE `fnrecord` ADD `alertlevel` int(11) NOT NULL DEFAULT '0'; +ALTER TABLE `fnrecord` CHANGE `testvalue` `testvalue` float NOT NULL DEFAULT '0'; +ALTER TABLE `fnrecord` ADD `testvalue` float NOT NULL DEFAULT '0'; +ALTER TABLE `fnrecord` CHANGE `recordx` `recordx` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnrecord` ADD `recordx` bigint(20) unsigned NOT NULL DEFAULT '0'; +CREATE INDEX `recordx` ON `fnrecord` ( `recordx` ); +ALTER TABLE `fnrecord` CHANGE `nodeid` `nodeid` varchar(64) NOT NULL; +ALTER TABLE `fnrecord` ADD `nodeid` varchar(64) NOT NULL; +-- +-- Table: fnreport +-- DESCRIBE fnreport +ALTER TABLE `fnreport` CHANGE `reportid` `reportid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fnreport` ADD `reportid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fnreport` ADD PRIMARY KEY( `reportid` ); +ALTER TABLE `fnreport` CHANGE `reportname` `reportname` varchar(128) NOT NULL; +ALTER TABLE `fnreport` ADD `reportname` varchar(128) NOT NULL; +ALTER TABLE `fnreport` CHANGE `reporttests` `reporttests` text NOT NULL; +ALTER TABLE `fnreport` ADD `reporttests` text NOT NULL; +-- +-- Table: fnrssfeed +-- DESCRIBE fnrssfeed +ALTER TABLE `fnrssfeed` CHANGE `feedid` `feedid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fnrssfeed` ADD `feedid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fnrssfeed` ADD PRIMARY KEY( `feedid` ); +ALTER TABLE `fnrssfeed` CHANGE `feedkey` `feedkey` varchar(254) NOT NULL; +ALTER TABLE `fnrssfeed` ADD `feedkey` varchar(254) NOT NULL; +ALTER TABLE `fnrssfeed` CHANGE `feedname` `feedname` varchar(254) NOT NULL; +ALTER TABLE `fnrssfeed` ADD `feedname` varchar(254) NOT NULL; +ALTER TABLE `fnrssfeed` CHANGE `feedtype` `feedtype` varchar(32) NOT NULL; +ALTER TABLE `fnrssfeed` ADD `feedtype` varchar(32) NOT NULL; +ALTER TABLE `fnrssfeed` CHANGE `typeopt` `typeopt` varchar(254) NOT NULL; +ALTER TABLE `fnrssfeed` ADD `typeopt` varchar(254) NOT NULL; +ALTER TABLE `fnrssfeed` CHANGE `feedrange` `feedrange` varchar(32) NOT NULL; +ALTER TABLE `fnrssfeed` ADD `feedrange` varchar(32) NOT NULL; +ALTER TABLE `fnrssfeed` CHANGE `rangeopt` `rangeopt` varchar(254) NOT NULL; +ALTER TABLE `fnrssfeed` ADD `rangeopt` varchar(254) NOT NULL; +-- +-- Table: fnscheditem +-- DESCRIBE fnscheditem +ALTER TABLE `fnscheditem` CHANGE `scheditemid` `scheditemid` bigint(20) NOT NULL auto_increment; +ALTER TABLE `fnscheditem` ADD `scheditemid` bigint(20) NOT NULL auto_increment; +ALTER TABLE `fnscheditem` ADD PRIMARY KEY( `scheditemid` ); +ALTER TABLE `fnscheditem` CHANGE `scheduleid` `scheduleid` bigint(20) NOT NULL DEFAULT '0'; +ALTER TABLE `fnscheditem` ADD `scheduleid` bigint(20) NOT NULL DEFAULT '0'; +ALTER TABLE `fnscheditem` CHANGE `dayofweek` `dayofweek` varchar(8) NOT NULL; +ALTER TABLE `fnscheditem` ADD `dayofweek` varchar(8) NOT NULL; +ALTER TABLE `fnscheditem` CHANGE `dayofmonth` `dayofmonth` int(11) NOT NULL DEFAULT '0'; +ALTER TABLE `fnscheditem` ADD `dayofmonth` int(11) NOT NULL DEFAULT '0'; +ALTER TABLE `fnscheditem` CHANGE `monthofyear` `monthofyear` int(11) NOT NULL DEFAULT '0'; +ALTER TABLE `fnscheditem` ADD `monthofyear` int(11) NOT NULL DEFAULT '0'; +ALTER TABLE `fnscheditem` CHANGE `year` `year` int(11) NOT NULL DEFAULT '0'; +ALTER TABLE `fnscheditem` ADD `year` int(11) NOT NULL DEFAULT '0'; +ALTER TABLE `fnscheditem` CHANGE `starthour` `starthour` int(11) NOT NULL DEFAULT '0'; +ALTER TABLE `fnscheditem` ADD `starthour` int(11) NOT NULL DEFAULT '0'; +ALTER TABLE `fnscheditem` CHANGE `startmin` `startmin` int(11) NOT NULL DEFAULT '0'; +ALTER TABLE `fnscheditem` ADD `startmin` int(11) NOT NULL DEFAULT '0'; +ALTER TABLE `fnscheditem` CHANGE `finishhour` `finishhour` int(11) NOT NULL DEFAULT '23'; +ALTER TABLE `fnscheditem` ADD `finishhour` int(11) NOT NULL DEFAULT '23'; +ALTER TABLE `fnscheditem` CHANGE `finishmin` `finishmin` int(11) NOT NULL DEFAULT '59'; +ALTER TABLE `fnscheditem` ADD `finishmin` int(11) NOT NULL DEFAULT '59'; +-- +-- Table: fnschedule +-- DESCRIBE fnschedule +ALTER TABLE `fnschedule` CHANGE `scheduleid` `scheduleid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fnschedule` ADD `scheduleid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fnschedule` ADD PRIMARY KEY( `scheduleid` ); +ALTER TABLE `fnschedule` CHANGE `schedulename` `schedulename` varchar(128) NOT NULL; +ALTER TABLE `fnschedule` ADD `schedulename` varchar(128) NOT NULL; +ALTER TABLE `fnschedule` CHANGE `defaultaction` `defaultaction` tinyint(1) NOT NULL DEFAULT '1'; +ALTER TABLE `fnschedule` ADD `defaultaction` tinyint(1) NOT NULL DEFAULT '1'; +-- +-- Table: fnsession +-- DESCRIBE fnsession +ALTER TABLE `fnsession` CHANGE `sessionid` `sessionid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fnsession` ADD `sessionid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fnsession` ADD PRIMARY KEY( `sessionid` ); +ALTER TABLE `fnsession` CHANGE `sessionkey` `sessionkey` varchar(128) NOT NULL; +ALTER TABLE `fnsession` ADD `sessionkey` varchar(128) NOT NULL; +ALTER TABLE `fnsession` CHANGE `ipaddress` `ipaddress` varchar(128) NOT NULL; +ALTER TABLE `fnsession` ADD `ipaddress` varchar(128) NOT NULL; +ALTER TABLE `fnsession` CHANGE `username` `username` varchar(64) NOT NULL; +ALTER TABLE `fnsession` ADD `username` varchar(64) NOT NULL; +ALTER TABLE `fnsession` CHANGE `startx` `startx` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnsession` ADD `startx` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnsession` CHANGE `updatex` `updatex` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnsession` ADD `updatex` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnsession` CHANGE `userlevel` `userlevel` int(11) NOT NULL DEFAULT '0'; +ALTER TABLE `fnsession` ADD `userlevel` int(11) NOT NULL DEFAULT '0'; +-- +-- Table: fntestrun +-- DESCRIBE fntestrun +ALTER TABLE `fntestrun` CHANGE `trid` `trid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fntestrun` ADD `trid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fntestrun` ADD PRIMARY KEY( `trid` ); +ALTER TABLE `fntestrun` CHANGE `startx` `startx` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fntestrun` ADD `startx` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fntestrun` CHANGE `finishx` `finishx` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fntestrun` ADD `finishx` bigint(20) unsigned NOT NULL DEFAULT '0'; +CREATE INDEX `finishx` ON `fntestrun` ( `finishx` ); +ALTER TABLE `fntestrun` CHANGE `routput` `routput` text NOT NULL; +ALTER TABLE `fntestrun` ADD `routput` text NOT NULL; +ALTER TABLE `fntestrun` CHANGE `fnode` `fnode` varchar(64) NOT NULL; +ALTER TABLE `fntestrun` ADD `fnode` varchar(64) NOT NULL; +CREATE INDEX `fnode` ON `fntestrun` ( `fnode` ); +-- +-- Table: fnuser +-- DESCRIBE fnuser +ALTER TABLE `fnuser` CHANGE `username` `username` varchar(64) NOT NULL; +ALTER TABLE `fnuser` ADD `username` varchar(64) NOT NULL; +ALTER TABLE `fnuser` ADD PRIMARY KEY( `username` ); +ALTER TABLE `fnuser` CHANGE `password` `password` varchar(64) NOT NULL; +ALTER TABLE `fnuser` ADD `password` varchar(64) NOT NULL; +ALTER TABLE `fnuser` CHANGE `realname` `realname` varchar(128) NOT NULL; +ALTER TABLE `fnuser` ADD `realname` varchar(128) NOT NULL; +ALTER TABLE `fnuser` CHANGE `userlevel` `userlevel` int(11) NOT NULL DEFAULT '1'; +ALTER TABLE `fnuser` ADD `userlevel` int(11) NOT NULL DEFAULT '1'; +-- +-- Table: fnview +-- DESCRIBE fnview +ALTER TABLE `fnview` CHANGE `viewid` `viewid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fnview` ADD `viewid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fnview` ADD PRIMARY KEY( `viewid` ); +ALTER TABLE `fnview` CHANGE `vtitle` `vtitle` varchar(128) NOT NULL; +ALTER TABLE `fnview` ADD `vtitle` varchar(128) NOT NULL; +ALTER TABLE `fnview` CHANGE `vstyle` `vstyle` varchar(32) NOT NULL; +ALTER TABLE `fnview` ADD `vstyle` varchar(32) NOT NULL; +ALTER TABLE `fnview` CHANGE `vpublic` `vpublic` tinyint(1) NOT NULL DEFAULT '0'; +ALTER TABLE `fnview` ADD `vpublic` tinyint(1) NOT NULL DEFAULT '0'; +ALTER TABLE `fnview` CHANGE `vclick` `vclick` varchar(32) NOT NULL; +ALTER TABLE `fnview` ADD `vclick` varchar(32) NOT NULL; +ALTER TABLE `fnview` CHANGE `vrefresh` `vrefresh` int(11) NOT NULL DEFAULT '0'; +ALTER TABLE `fnview` ADD `vrefresh` int(11) NOT NULL DEFAULT '0'; +ALTER TABLE `fnview` CHANGE `vlinkv` `vlinkv` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnview` ADD `vlinkv` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnview` CHANGE `vcolumns` `vcolumns` smallint(6) NOT NULL DEFAULT '0'; +ALTER TABLE `fnview` ADD `vcolumns` smallint(6) NOT NULL DEFAULT '0'; +ALTER TABLE `fnview` CHANGE `vcolon` `vcolon` tinyint(1) NOT NULL DEFAULT '1'; +ALTER TABLE `fnview` ADD `vcolon` tinyint(1) NOT NULL DEFAULT '1'; +ALTER TABLE `fnview` CHANGE `vdashes` `vdashes` tinyint(1) NOT NULL DEFAULT '1'; +ALTER TABLE `fnview` ADD `vdashes` tinyint(1) NOT NULL DEFAULT '1'; +ALTER TABLE `fnview` CHANGE `vtimeago` `vtimeago` tinyint(1) NOT NULL DEFAULT '1'; +ALTER TABLE `fnview` ADD `vtimeago` tinyint(1) NOT NULL DEFAULT '1'; +-- +-- Table: fnviewitem +-- DESCRIBE fnviewitem +ALTER TABLE `fnviewitem` CHANGE `viewitemid` `viewitemid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fnviewitem` ADD `viewitemid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fnviewitem` ADD PRIMARY KEY( `viewitemid` ); +ALTER TABLE `fnviewitem` CHANGE `viewid` `viewid` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnviewitem` ADD `viewid` bigint(20) unsigned NOT NULL DEFAULT '0'; +CREATE INDEX `viewid` ON `fnviewitem` ( `viewid` ); +ALTER TABLE `fnviewitem` CHANGE `itype` `itype` varchar(128) NOT NULL; +ALTER TABLE `fnviewitem` ADD `itype` varchar(128) NOT NULL; +ALTER TABLE `fnviewitem` CHANGE `ioption` `ioption` varchar(250) NOT NULL; +ALTER TABLE `fnviewitem` ADD `ioption` varchar(250) NOT NULL; +ALTER TABLE `fnviewitem` CHANGE `icolour` `icolour` tinyint(1) NOT NULL DEFAULT '1'; +ALTER TABLE `fnviewitem` ADD `icolour` tinyint(1) NOT NULL DEFAULT '1'; +ALTER TABLE `fnviewitem` CHANGE `itextstatus` `itextstatus` tinyint(1) NOT NULL DEFAULT '0'; +ALTER TABLE `fnviewitem` ADD `itextstatus` tinyint(1) NOT NULL DEFAULT '0'; +ALTER TABLE `fnviewitem` CHANGE `idetail` `idetail` smallint(5) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnviewitem` ADD `idetail` smallint(5) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnviewitem` CHANGE `iweight` `iweight` int(10) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnviewitem` ADD `iweight` int(10) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnviewitem` CHANGE `isize` `isize` smallint(6) NOT NULL DEFAULT '0'; +ALTER TABLE `fnviewitem` ADD `isize` smallint(6) NOT NULL DEFAULT '0'; +ALTER TABLE `fnviewitem` CHANGE `igraphic` `igraphic` smallint(6) NOT NULL DEFAULT '0'; +ALTER TABLE `fnviewitem` ADD `igraphic` smallint(6) NOT NULL DEFAULT '0'; +ALTER TABLE `fnviewitem` CHANGE `iname` `iname` varchar(64) NOT NULL; +ALTER TABLE `fnviewitem` ADD `iname` varchar(64) NOT NULL; +-- diff --git a/src/node/posix/config.inc.php b/src/node/posix/config.inc.php new file mode 100755 index 0000000..ef5418f --- /dev/null +++ b/src/node/posix/config.inc.php @@ -0,0 +1,53 @@ + \ No newline at end of file diff --git a/src/node/posix/freenats-node.php b/src/node/posix/freenats-node.php new file mode 100755 index 0000000..6002fa6 --- /dev/null +++ b/src/node/posix/freenats-node.php @@ -0,0 +1,499 @@ + +
+ something +
+ + testname + Test Description + return value + suggested alert level + + +*/ + +class FreeNATS_XML_Node +{ +var $xml=""; +var $Config; + +function AddLine($line) +{ +$this->xml.=$line."\n"; +} + +function AddTest($name,$desc,$val,$lvl=-1) +{ +$this->AddLine(""); +$this->AddLine(" "); +$this->AddLine(" ".$name.""); +$this->AddLine(" ".$desc.""); +$this->AddLine(" ".$val.""); +$this->AddLine(" ".$lvl.""); +$this->AddLine(" "); +$this->AddLine(""); +} + +function FreeNATS_XML_Node() +{ +global $nodeCfg; +$this->AddLine(""); +$this->Config=&$nodeCfg; +} + +function Start() +{ +$this->AddLine(""); +} + +function Stop() +{ +$this->AddLine(""); +} + +function DataHeader($is_header=true) +{ +if ($is_header) $this->AddLine("
"); +else $this->AddLine("
"); +} + +function HeaderItem($name,$value) +{ +$this->AddLine(" <".$name.">".$value.""); +} + +function ScreenOutput() +{ +header("Content-type: text/xml"); +echo $this->xml; +exit(); +} + +} + +$Node=new FreeNATS_XML_Node(); +$Node->Start(); + + +// How Were We Called +$pull=false; + +if (isset($_SERVER['REMOTE_ADDR'])) // called via HTTP + { + $pull=true; + if ($nodeCfg['restrict_pull_ip']!="") // check IP + { + if ($_SERVER['REMOTE_ADDR']!=$nodeCfg['restrict_pull_ip']) + { + echo "Authorisation Failure: IP Address Denied"; + exit(); + } + } + if ($nodeCfg['nodekey']!="") // check authorisation + { + if ( !(isset($_REQUEST['nodekey'])) || ($_REQUEST['nodekey']!=$nodeCfg['nodekey']) ) + { + echo "Authorisation Failure: Incorrect NODEKEY Configured"; + exit(); + } + } + if (isset($_REQUEST['noupdate']) && ($_REQUEST['noupdate']==1)) $fileUpdate=false; + } +else // called via CLI + { + $a=1; + for ($a=1; $a<$argc; $a++) + { + switch($argv[$a]) + { + case "-c": case "--c": case "-config": case "--config": + $configFile=$argv[++$a]; + break; + case "-d": case "--d": case "-debug": case "--debug": + $pull=true; // output to the console + break; + case "--noupdate": case "-noupdate": + $fileUpdate=false; + break; + } + } + } + +if ($configFile!="") require($configFile); + + +$Node->DataHeader(); +$Node->HeaderItem("name","FreeNATS Posix Node XML"); +$Node->HeaderItem("version",$nodeCfg['version']); +if (!$pull) // we are pushing instead + $Node->HeaderItem("nodekey",$nodeCfg['nodekey']); +$Node->DataHeader(false); + +// Node Type and Version Pseudo-Tests +$Node->AddTest("fnn.version","FreeNATS Node Version",$nodeCfg['version'],0); +$Node->AddTest("fnn.name","FreeNATS Node Type","Posix XML",0); + +//$Node->AddTest("bob.one","Bob One",10,0); +//$Node->AddTest("bob.two","Bob Two",11,0); + + +// Data from Uptime +if ($nodeCfg['uptime']) +{ +$uptime=exec("/usr/bin/uptime"); + +$ut=preg_split("/\s+/",$uptime); +//var_dump($ut); + + + +$Node->AddTest("uptime.1m","One Minute Load Average",substr($ut[count($ut)-3],0,strlen($ut[count($ut)-3])-1),0); +$Node->AddTest("uptime.5m","Five Minute Load Average",substr($ut[count($ut)-2],0,strlen($ut[count($ut)-2])-1),0); +$Node->AddTest("uptime.15m","Fifteen Minute Load Average",$ut[count($ut)-1],0); +$Node->AddTest("uptime.users","Logged in Users",$ut[count($ut)-7],0); +} + +// Data from Time +if ($nodeCfg['systime']) +{ +$nowx=time(); +$utf=date("Y-m-d H:i:s",$nowx); +$dts=date("H:i:s d/m/Y",$nowx); +$pasthour= (date("i",$nowx)*60)+date("s",$nowx); + +$Node->AddTest("systime.x","Node Time (Seconds Since Epoch)",$nowx,0); +$Node->AddTest("systime.utf","Node Time (UTF)",$utf,0); +$Node->AddTest("systime.dts","Note Time",$dts,0); +$Node->AddTest("systime.sph","Seconds Past Hour",$pasthour,0); +} + +// ------------------ DISK SPACE + +// Data from DF +if ($nodeCfg['disk']) +{ + $result=array(); + exec("/bin/df -P",$result); + + // filesystem blocks used available use% mount + for ($a=1; $a4) // not a duff line + { + $filesystem=$parts[0]; + $size=$parts[1]/1024; + $used=$parts[2]/1024; + $free=$parts[3]/1024; + $perc=substr($parts[4],0,(strlen($parts[4])-1)); + $percfree=100-$perc; + $mount=$parts[5]; + + if ($perc >= 90) $alertlevel=2; // failed + else if ($perc >= 80) $alertlevel=1; // warning + else $alertlevel=0; // passed + + //$nicefs=str_replace("/","_",$filesystem); + $name=$filesystem.".size"; + $desc="Total Size of ".$filesystem." (".$mount.") (Mb)"; + $Node->AddTest($name,$desc,round($size,2),$alertlevel); + + $name=$filesystem.".used"; + $desc="Space Used on ".$filesystem." (".$mount.") (Mb)"; + $Node->AddTest($name,$desc,round($used,2),$alertlevel); + + $name=$filesystem.".free"; + $desc="Space Free on ".$filesystem." (".$mount.") (Mb)"; + $Node->AddTest($name,$desc,round($free,2),$alertlevel); + + $name=$filesystem.".perc"; + $desc="Percentage Used on ".$filesystem." (".$mount.")"; + $Node->AddTest($name,$desc,$perc,$alertlevel); + + $name=$filesystem.".percfree"; + $desc="Percentage Free on ".$filesystem." (".$mount.")"; + $Node->AddTest($name,$desc,$percfree,$alertlevel); + } + } +} + + + +// ------------------ RAM +// Data from FREE +if ($nodeCfg['memory']) +{ + + + $free=array(); + exec("/usr/bin/free",$free); + + //unset($this->mm_elements); + + for ($fc=1; $fc< count($free); $fc++) + { + // Mem: Swap: -- total, used, free -- kb + $parts=preg_split("/\s+/",$free[$fc]); + $proc=false; + if ($parts[0]=="Mem:") { $proc=true; $type="System Memory"; $prefix="mem"; } + else if ($parts[0]=="Swap:") { $proc=true; $type="System Swap File"; $prefix="swap"; } + /* + else + { + echo $free[$fc]."\n"; + exit(); + }*/ + + if ($proc) + { + $total=round($parts[1]/1024,3); + $usedmb=round($parts[2]/1024,3); + $freemb=round($parts[3]/1024,3); + $used_perc=0; + $free_perc=0; + if ($total>0) + { + if ($used>0) $used_perc=round (($usedmb/$total)*100,2); + if ($free>0) $free_perc=round (($freemb/$total)*100,2); + } + $name=$prefix.".total"; + $Node->AddTest($name,$type." Total (Mb)",$total,0); + + + $name=$prefix.".used"; // parts[2] used kb + $Node->AddTest($name,$type." Used (Mb)",$usedmb,0); + + $name=$prefix.".free"; // parts[3] free kb + $Node->AddTest($name,$type." Free (Mb)",$freemb,0); + + $name=$prefix.".free.perc"; + $Node->AddTest($name,$type." Free (%)",$free_perc,0); + + $name=$prefix.".used.perc"; + $Node->AddTest($name,$type." Used (%)",$used_perc,0); + } // end of if $proc + + } // end of for + +} + + + +// ------------------ NETWORK USAGE +// Data from /proc/net/dev +if ($nodeCfg['net']) +{ +$netarr=@file("/proc/net/dev"); +for($a=2; $aAddTest("net.".$dev.".rxt","Total Received on Interface ".$dev." (bytes)",$rx,0); + $Node->AddTest("net.".$dev.".txt","Total Sent on Interface ".$dev." (bytes)",$tx,0); + $Node->AddTest("net.".$dev.".trt","Total Passed on Interface ".$dev." (bytes)",$tt,0); + + $trrx=0; + $trtx=0; + $trtt=0; + $trlvl=0; + + $nowx=time(); + // does the file exist + $fp=fopen($nodeCfg['tmp_dir']."fnnode.net.".$dev,"r"); + if ($fp>0) // yes + { + $lastx=trim(fgets($fp,128)); + $lrx=trim(fgets($fp,128)); + $ltx=trim(fgets($fp,128)); + $ltt=$lrx+$ltx; + // wrap checking and the like... + if ( ($lrx>$rx) ) //|| ($ltx>$tx) || ($ltt>$tt) ) + { + $trlvl=-1; // untested + $diffx=0; + //echo "untested ".trim($lrx)."-$rx"; + } + else // test it + { + $diffx=$nowx-$lastx; + if ($diffx>0) + { + $trrx=(($rx-$lrx)/$diffx)/1024; + $trtx=(($tx-$ltx)/$diffx)/1024; + $trtt=(($tt-$ltt)/$diffx)/1024; + } + if($trrx=="") $trrx=0; + if($trtx=="") $trtx=0; + if($trtt=="") $trtt=0; + } + } + else $trlvl=-1; + @fclose($fp); + + // write my file + if ($fileUpdate) + { + //echo "Writing Files!\n"; + $fp=fopen($nodeCfg['tmp_dir']."fnnode.net.".$dev,"w"); + fputs($fp,$nowx."\n"); + fputs($fp,$rx."\n"); + fputs($fp,$tx."\n"); + fclose($fp); + } + + $Node->AddTest("net.".$dev.".rx","Receive Speed on ".$dev." (kbyte/s)",$trrx,$trlvl); + $Node->AddTest("net.".$dev.".tx","Transmit Speed on ".$dev." (kbyte/s)",$trtx,$trlvl); + $Node->AddTest("net.".$dev,"Combined Speed on ".$dev." (kbyte/s)",$trtt,$trlvl); + $Node->AddTest("net.".$dev.".elapsed","Speed Sample Time on ".$dev." (secs)",$diffx,$trlvl); + } +} + +// ------------------ PROCESS INFORMATION +if ($nodeCfg['process']) + { + $ps=array(); + exec("/bin/ps -e -w",$ps); + + $pdata=array(); + //foreach($ps as $psl) + for ($z=1; $z$val) + { + $Node->AddTest("ps.".$key,"Number of ".$key." Processes",$val,0); + } + } + + +// ------------------ END OF TEST DATA + + +// End FreeNATS Data +$Node->Stop(); + +if ($pull) + { + // Output Data to Screen + $Node->ScreenOutput(); + } +else // push + { + // PHP 5 Required + $data=array( "nodeid" => $nodeCfg['nodeid'], + "nodekey" => $nodeCfg['nodekey'], + "xml" => $Node->xml ); + $data=http_build_query($data); + + $request=array( "http" => array( "method" => "POST", + "header" => "Content-type: application/x-www-form-urlencoded", "content" => $data ) ); + $context=stream_context_create($request); + $fp=fopen($nodeCfg['push_target'],'rb',false,$context); + if ($fp<=0) + { + echo "Push Failed to open URL\n"; + exit(); + } + $serverdata=@stream_get_contents($fp); + + if ($serverdata===false) + { + echo "Push Data is FALSE\n"; + exit(); + } + + if ($serverdata!="1") + { + echo "Server Returned Error: ".$serverdata."\n"; + exit(); + } + + echo "Push Succeeded\n"; + } + +?> diff --git a/src/node/win32/node.vbs b/src/node/win32/node.vbs new file mode 100644 index 0000000..356677b --- /dev/null +++ b/src/node/win32/node.vbs @@ -0,0 +1,314 @@ +' REM FreeNATS Windows Node Bogeroo +' +' This file is part of FreeNATS +' +' FreeNATS is (C) Copyright 2008-2010 PurplePixie Systems +' +' FreeNATS is free software: you can redistribute it and/or modify +' it under the terms of the GNU General Public License as published by +' the Free Software Foundation, either version 3 of the License, or +' (at your option) any later version. +' +' FreeNATS is distributed in the hope that it will be useful, +' but WITHOUT ANY WARRANTY; without even the implied warranty of +' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +' GNU General Public License for more details. +' +' You should have received a copy of the GNU General Public License +' along with FreeNATS. If not, see www.gnu.org/licenses +' +' For more information see www.purplepixie.org/freenats +' +' Release: 3 Alpha 06/04/2010 + +PushData=0 +PullData=1 +PushURL="" +NodeID="" +NodeKey="" 'for post only +strComputer="." +wmiUser="" +wmiPass="" +wmiDomain="" +wmiSimple=1 + +Set colNamedArguments= WScript.Arguments.Named + +If colNamedArguments.Exists("nooutput") Then + PullData=0 +End If +If colNamedArguments.Exists("pushurl") Then + PushData=1 + PushURL=colNamedArguments.Item("pushurl") +End If +If colNamedArguments.Exists("nodeid") Then + NodeID=colNamedArguments.Item("nodeid") +End If +If colNamedArguments.Exists("nodekey") Then + NodeKey=colNamedArguments.Item("nodekey") +End If +If colNamedArguments.Exists("host") Then + strComputer=colNamedArguments.Item("host") +End If +If colNamedArguments.Exists("user") Then + wmiUser=colNamedArguments.Item("user") + wmiSimple=0 +End If +If colNamedArguments.Exists("pass") Then + wmiPass=colNamedArguments.Item("pass") +End If +If colNamedArguments.Exists("domain") Then + wmiDomain=colNamedArguments.Item("domain") + wmiSimple=0 +End If + +OutputBuffer = "" + +OB "" +OB "" +OB "
" +OB " FreeNATS VBS Node XML" +OB " 0.03" +OB "
" + + + + + + +Function OB(text) + OutputBuffer = OutputBuffer & text & vbCrLf +End Function + +Function DumpOB() + Wscript.Echo OutputBuffer +End Function + +alloweds = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890!$%^*()[]{}?/+=-_ " + +Function SafeString(text) + text = Replace(text,"&","+") + output = "" + For position = 1 to Len(text) + character = Mid(text,position,1) + pos = InStr(alloweds,character) + If pos > 0 Then + output = output & character + Else + output = output & "_" + End If + Next + SafeString = output +End Function + +If wmiSimple = 1 Then + Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") +Else + set objLocator = CreateObject("WbemScripting.SWbemLocator") + set objWMIService = objLocator.ConnectServer(strComputer,"root/cimv2",wmiUser,wmiPass) + objWMIService.Security_.impersonationlevel=3 ' at level 3 you are impersonating the pope +End If + + +set objRefresher = CreateObject("WbemScripting.Swbemrefresher") +Set objProcessor = objRefresher.AddEnum (objWMIService, "Win32_PerfFormattedData_PerfOS_Processor").objectSet + +Set colRunningServices = objWMIService.ExecQuery("Select * from Win32_Service") +Set memItems = objRefresher.AddEnum (objWMIService, "Win32_PerfFormattedData_PerfOS_Memory").objectSet +Set colOperatingSystems = objWMIService.ExecQuery ("Select * from Win32_OperatingSystem") + +Set colRunningProcesses = objWMIService.ExecQuery("Select * from Win32_Process") + +Set WshNetwork = WScript.CreateObject("WScript.Network") +AddTest "system.name","Computer Name",SafeString(WshNetwork.ComputerName),0 + + +objRefresher.Refresh ' No I don't really get it either +WScript.Sleep 2000 ' but unless you do this you get even +objRefresher.Refresh ' weirder than usual values. + +int ServiceRunning=0 +int Alert=0 +For Each objService in colRunningServices + If objService.State = "Running" Then + ServiceRunning=1 + Alert=0 + Else + Alert=1 + ServiceRunning=0 + End If + TName = Replace(objService.Name," ","_") + TestName="srv." & SafeString(TName) + AddTest TestName, SafeString(objService.DisplayName) & " Service", ServiceRunning, Alert +Next + + +intThresholdViolations = 0 + + +Set colDisks = objWMIService.ExecQuery ("Select * from Win32_LogicalDisk") + +For Each objDisk in colDisks + +DiskSpace = objDisk.FreeSpace / 1024 / 1024 +DiskSize = objDisk.Size / 1024 / 1024 +DiskUsed = DiskSize - DiskSpace +DiskUsedPerc = ( DiskUsed / DiskSize ) * 100 +DiskInDrive = 1 +If IsNull(DiskSpace) Then + DiskSpace = "0" + DiskUsed = "0" + DiskUsedPerc = "0.00" + DiskInDrive = 0 +End If +DiskSpace = Round(DiskSpace,2) +DiskUsed = Round(DiskUsed,2) +DiskUsedPerc = Round(DiskUsedPerc,2) + +alertlevel = 0 +If DiskUsedPerc > 80 Then + alertlevel = 1 +End If +If DiskUsedPerc > 90 Then + alertlevel = 2 +End If + + +If DiskInDrive = 1 Then +TestName= "disk.free." & Left(objDisk.DeviceID,1) +AddTest TestName,"Space Free On " & objDisk.DeviceID & " (Mb)", DiskSpace, alertlevel +TestName= "disk.used." & Left(objDisk.DeviceID,1) +AddTest TestName,"Space Used On " & objDisk.DeviceID & " (Mb)", DiskUsed, alertlevel +TestName= "disk.used.perc." & Left(objDisk.DeviceID,1) +AddTest TestName,"Percent Disk Usage On " & objDisk.DeviceID & " (%)", DiskUsedPerc, alertlevel +End If + +Next + + + +For Each objItem in objProcessor + + If objItem.Name = "_Total" Then + AddTest "proc.load","Processor Load (%)",objItem.PercentProcessorTime,0 + End If +Next + + + +For Each objOS in colOperatingSystems + dtmBootup = objOS.LastBootUpTime + dtmLastBootupTime = WMIDateStringToDate(dtmBootup) + dtmSystemUptime = DateDiff("h", dtmLastBootUpTime, Now) + AddTest "uptime","Uptime (Hours)",dtmSystemUptime,0 +Next + +Function WMIDateStringToDate(dtmBootup) + WMIDateStringToDate = CDate(Mid(dtmBootup, 5, 2) & "/" & _ + Mid(dtmBootup, 7, 2) & "/" & Left(dtmBootup, 4) _ + & " " & Mid (dtmBootup, 9, 2) & ":" & _ + Mid(dtmBootup, 11, 2) & ":" & Mid(dtmBootup,13, 2)) +End Function + + + + +For Each objItem in memItems + TestName="mem." + If Len(objItem.Name) > 0 Then + TestName = TestName & objItem.Name & "." + End If + TestName = TestName & "free" + + AddTest TestName,"Memory Available (Kilobytes)",objItem.AvailableKBytes,0 + +Next + +' Running Processes + +Dim ProcArr(1024) +Dim CountArr(1024) +ProcCount=0 +pName="" +pDesc="" +ProcCount = 0 + + For Each objProc in colRunningProcesses + 'Wscript.Echo objProc.ProcessID & " " & objProc.Name & vbCrLf + pName = objProc.Name + NewProc = 1 ' Assume New Until Checked + FoundPos = 0 + For ProcTmp = 0 To ProcCount + If ( ProcArr(ProcTmp) = pName ) Then ' Exists + NewProc = 0 + FoundPos = ProcTmp + 'ProcTmp = UBound(ProcArr)+1 + End If + Next + + If NewProc = 0 Then ' Not a New Process + CountArr(FoundPos) = CountArr(FoundPos) + 1 + Else ' Does Not Exist + ProcArr(ProcCount) = pName + CountArr(ProcCount) = 1 + ProcCount = ProcCount + 1 + End If + + + Next + + +For ProcTmp = 0 To ProcCount-1 +' Wscript.Echo ProcArr(ProcTmp) & " " & CountArr(ProcTmp) + AddTest "proc." & SafeString(ProcArr(ProcTmp)), ProcArr(ProcTmp) & " Process", CountArr(ProcTmp), 0 +Next + +'Set listProc = Nothing +'set objWMIService = Nothing + + + +' Close Off + +OB "
" + +Function AddTest(testname,testdesc,testvalue,alertlevel) + OB "" + OB " " & testname & "" + OB " " & testdesc & "" + OB " " & testvalue & "" + OB " " & alertlevel & "" + OB "" +End Function + +If PullData=1 Then + DumpOB() +End If + +If PushData=1 Then + ' Push Da Data + WScript.Echo + WScript.Echo "Pushing Data..." + WScript.Echo "URL : " & PushURL + WScript.Echo "NodeID: " & NodeID + WScript.Echo "Key : " & NodeKey + + Set objHTTP = CreateObject("Microsoft.XMLHTTP") + objHTTP.open "POST", PushURL, False + + objHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" + http_request = "nodeid=" & Escape(NodeID) & "&nodekey=" & Escape(NodeKey) & "&xml=" & Escape(OutputBuffer) + objHTTP.send http_request + + response = objHTTP.responseText + + Set objHTTP = Nothing + + If Right(response,1) = "1" Then + WScript.Echo "Post Successful" + Else + WScript.Echo "Encountered An Error:" + WScript.Echo response + End If + +End If \ No newline at end of file diff --git a/src/node/win32/push.bat b/src/node/win32/push.bat new file mode 100755 index 0000000..72cdc95 --- /dev/null +++ b/src/node/win32/push.bat @@ -0,0 +1,2 @@ +@ECHO OFF +cscript node.vbs //nologo /pushurl:http://YOUR_NATS_WEB_URL/nodeside.push.php /nodeid:nodeid /nodekey:SomeKey diff --git a/src/server/base/.htaccess b/src/server/base/.htaccess new file mode 100755 index 0000000..ff2beb8 --- /dev/null +++ b/src/server/base/.htaccess @@ -0,0 +1,2 @@ +order deny,allow +deny from all diff --git a/src/server/base/config.inc.php b/src/server/base/config.inc.php new file mode 100755 index 0000000..3c13dcc --- /dev/null +++ b/src/server/base/config.inc.php @@ -0,0 +1,64 @@ + diff --git a/src/server/base/eval.inc.php b/src/server/base/eval.inc.php new file mode 100755 index 0000000..ba426c9 --- /dev/null +++ b/src/server/base/eval.inc.php @@ -0,0 +1,66 @@ +DB->Query($q); +//echo $q; +while ($row=$NATS->DB->Fetch_Array($r)) + { + //echo "\n".$row['eoperator']."\n"; + $nl=0; + switch ($row['eoperator']) + { + case "ET": + if ($row['evalue']==$value) $nl=$row['eoutcome']; + break; + case "GT": + if ($row['evalue']<$value) $nl=$row['eoutcome']; + break; + case "LT": + if ($row['evalue']>$value) $nl=$row['eoutcome']; + break; + } + if ($nl>$lvl) $lvl=$nl; + } +$NATS->DB->Free($r); +return $lvl; +} + +function eval_operator_text($operator) +{ +switch($operator) + { + case "ET": return "Equal To"; + case "GT": return "Greater Than"; + case "LT": return "Less Than"; + + default: return "Unknown"; + } +} + +?> \ No newline at end of file diff --git a/src/server/base/freenats.inc.php b/src/server/base/freenats.inc.php new file mode 100755 index 0000000..e29770e --- /dev/null +++ b/src/server/base/freenats.inc.php @@ -0,0 +1,1081 @@ +Tests=new TNATS_Tests(); // need this available during the include phase pre-start + } + +function Start() + { + if ($this->init) return 0; + global $BaseDir,$fnSkipSiteIncludes; + if ( (!isset($BaseDir)) || ($BaseDir=="") ) $BaseDir="./"; + $this->DB=new TNATS_DB(); + $this->Cfg=new TNATS_Cfg(); + $this->DB->Connect(); + $this->Cfg->Load($this->DB); + // Site Includes + // Tests + if ( (!isset($fnSkipSiteIncludes)) || ($fnSkipSiteIncludes === false) ) + { + + if ($this->Cfg->Get("site.include.tests",0)==1) + { + foreach(glob($BaseDir."site/tests/*.php") as $phpfile) + { + $this->Event("Including ".$phpfile,10,"NATS","Start"); + include_once($phpfile); + } + } + // Events + if ($this->Cfg->Get("site.include.events",0)==1) + { + foreach(glob($BaseDir."site/events/*.php") as $phpfile) + { + $this->Event("Including ".$phpfile,10,"NATS","Start"); + include_once($phpfile); + } + } + } + + // RSS + $this->RSS = new NATS_RSS(); + + // Language + $this->Lang=new TNATS_Lang(); + if (isset($_COOKIE['fn_lang']) && ($_COOKIE['fn_lang']!="") ) $l=$_COOKIE['fn_lang']; + else $l=$this->Cfg->Get("site.language",""); + $this->Lang->Load($l); + + + $this->init=true; + } + +function Stop() + { + $t=$this->Cfg->Get("freenats.tracker",""); + if ( ($t>0) && ($t!="") ) + { + $day=date("Ymd"); + if ($this->Cfg->Get("freenats.tracker.last","")!=$day) + { + $this->Cfg->Set("freenats.tracker.last",$day); + $this->PhoneHome(); + } + } + + $this->DB->Disconnect(); + $this->init=false; + } + +function Event($logevent,$loglevel=1,$modid="NONE",$catid="NONE") + { + global $NATS_Session; + if ((isset($NATS_Session))&&($NATS_Session->auth)) $username=$NATS_Session->username; + else $username=""; + $l=$this->Cfg->Get("log.level"); + //echo "** $l **\n"; + if ( $l=="" ) $l=10; // debug logging if no variable + if ( $l < $loglevel ) return false; + if (strlen($logevent)>249) $logevent=substr($logevent,0,245)."..."; + $q="INSERT INTO fnlog(postedx,modid,catid,loglevel,logevent,username) VALUES(".time().","; + $q.="\"".ss($modid)."\",\"".ss($catid)."\",".ss($loglevel).",\"".ss($logevent)."\",\"".ss($username)."\")"; + //echo $q; + $this->DB->Query($q,false); + } + +function AlertAction($nodeid,$alertlevel,$change,$alerttext) + { + //echo "Called for node: ".$nodeid."\n"; + if ($change==0) return false; // no change + if (trim($alerttext)=="") return false; // no text so a bogus event i.e. -1 to 0 + //echo $nodeid.":".$alertlevel.":".$change.":".$alerttext."\n"; + // get all the alertactions for this node id + $q="SELECT aaid FROM fnnalink WHERE nodeid=\"".ss($nodeid)."\""; + $r=$this->DB->Query($q); + while ($arow=$this->DB->Fetch_Array($r)) + { + // get details for this alert action + $aq="SELECT * FROM fnalertaction WHERE aaid=".$arow['aaid']." LIMIT 0,1"; + + $ar=$this->DB->Query($aq); + $aa=$this->DB->Fetch_Array($ar); + $this->DB->Free($ar); + + // UGGGGGGGG continue!! + // if the type is blank or disabled skip + if ( ($aa['atype']=="") || ($aa['atype']=="Disabled") ) continue; + // if warnings aren't set and it is a warning skip + if ( ($aa['awarnings']==0) && ($alertlevel==1) ) continue; + // if decreases aren't set and it is a decrease skip + if ( ($aa['adecrease']==0) && ($change<1) ) continue; + // if has a schedule and it dictates not to run now then skip + if (($aa['scheduleid']!=0)&&(!run_x_in_schedule(time(),$aa['scheduleid']))) continue; + + // made it this far + + $ndata=$nodeid.": ".$alerttext; + $this->ActionAddData($arow['aaid'],$ndata); + + /* // spun to ActionAddData + if ($aa['mdata']!="") $ndata=$aa['mdata']."\n".$nodeid.": ".$alerttext; + else $ndata=$nodeid.": ".$alerttext; + $uq="UPDATE fnalertaction SET mdata=\"".ss($ndata)."\" WHERE aaid=".$arow['aaid']; + //echo $uq."\n"; + $this->DB->Query($uq); + */ + } + } + +function ActionAddData($aaid, $newmdata) + { + $q="SELECT aaid,mdata FROM fnalertaction WHERE aaid=".ss($aaid)." LIMIT 0,1"; + $r=$this->DB->Query($q); + if (!$row=$this->DB->Fetch_Array($r)) return false; + $this->DB->Free($r); + + if ($row['mdata']!="") $ndata=$row['mdata']."\n".$newmdata; + else $ndata=$newmdata; + + $uq="UPDATE fnalertaction SET mdata=\"".ss($ndata)."\" WHERE aaid=".$row['aaid']; + $this->DB->Query($uq); + return true; + } + +function ActionFlush() + { + global $allowed,$BaseDir; // allowed chars from screen in YA BODGE + $q="SELECT * FROM fnalertaction WHERE mdata!=\"\""; + $r=$this->DB->Query($q); + while ($row=$this->DB->Fetch_Array($r)) + { + + $doalert=true; + + // clear mdata right at the start to get around duplicate emails whilst processing + $q="UPDATE fnalertaction SET mdata=\"\" WHERE aaid=".$row['aaid']; + $this->DB->Query($q); + + if ($this->DB->Affected_Rows()<=0) // already flushed or failed to flush + { + $doalert=false; + $this->Event("Alert Action Already Flushed - Skipping",8,"Flush","Action"); + } + + // alert counter + $td=date("Ymd"); + if ($td!=$row['ctrdate']) // new day or no flush record + { + $q="UPDATE fnalertaction SET ctrdate=\"".$td."\",ctrtoday=1 WHERE aaid=".$row['aaid']; + $this->DB->Query($q); + } + else + { + + if ( ($row['ctrlimit']==0) || ($row['ctrlimit']>$row['ctrtoday']) ) // no limit or below + { + $q="UPDATE fnalertaction SET ctrtoday=ctrtoday+1 WHERE aaid=".$row['aaid']; + $this->DB->Query($q); + } + else // at or over limit + { + $this->Event("Alert Action Limit Reached - Skipping",2,"Flush","Action"); + $doalert=false; + } + + } + + + if ($row['atype']=="email") + { + if ($row['esubject']==0) $sub=""; + else if ($row['esubject']==1) $sub=$this->Cfg->Get("alert.subject.short","FreeNATS Alert"); + else $sub=$this->Cfg->Get("alert.subject.long","** FreeNATS Alert **"); + $body=""; + if ($row['etype']==0) $body=$row['mdata']; + else + { + $body=$this->Cfg->Get("alert.body.header","FreeNATS Alert,"); + $body.="\r\n\r\n".$row['mdata']."\r\n\r\n"; + $body.=$this->Cfg->Get("alert.body.footer",""); + $body.="\r\n-- FreeNATS @ ".nicedt(time()); + } + //$tolist=preg_split("[\n\r]",$row['etolist']); + $tolist=array(); + $f=0; + $tolist[0]=""; + for ($a=0; $aCfg->Get("mail.smtpserver",""); + if ($smtpserver=="") + { + // mail() method - local delivery + $header="From: ".$row['efrom']."\r\n"; + if ($doalert) + { + mail($toaddr,$sub,$body,$header); + $this->Event("Sent alert email to ".$toaddr,4,"Flush","Email"); + } + } + else // use phpmailer direct SMTP delivery + { + include_once($BaseDir."phpmailer/class.phpmailer.php"); + $fromname=$this->Cfg->Get("mail.fromname",""); + if ($fromname=="") $fromname="FreeNATS"; + $smtpusername=$this->Cfg->Get("mail.smtpusername",""); // removed . + if ($smtpusername!="") $smtpauth=true; + else $smtpauth=false; + $smtppassword=$this->Cfg->Get("mail.smtppassword",""); // removed . + $smtphostname=$this->Cfg->Get("mail.smtphostname",""); // removed . + $smtpsec=$this->Cfg->Get("mail.smtpsecure",""); + $mail=new PHPMailer(); + $mail->IsSMTP(); + $mail->Host=$smtpserver; + $mail->From=$row['efrom']; + $mail->FromName=$fromname; + $mail->AddAddress($toaddr); + $mail->Subject=$sub; + $mail->Body=$body; + $mail->WordWrap=50; + if ($smtphostname!="") $mail->Hostname=$smtphostname; + if ($smtpauth) + { + $mail->SMTPAuth=true; + $mail->Username=$smtpusername; + $mail->Password=$smtppassword; + } + if ($smtpsec!="") $mail->SMTPSecure=$smtpsec; + if (!$mail->Send()) + { // failed + $this->Event("phpMailer to ".$toaddr." failed",1,"Flush","Email"); + $this->Event("phpMailer Error: ".$mail->ErrorInfo,1,"Flush","Email"); + } + else + { + $this->Event("phpMailer Sent Email To ".$toaddr,4,"Flush","Email"); + } + } + + } + } + + + + } + else if ($row['atype']=="url") + { + // url send + if ($row['etype']==0) $body=$row['mdata']; + else $body="FreeNATS Alert,\r\n".$row['mdata']."\r\n--FreeNATS @ ".nicedt(time()); + + $body=urlencode($body); + $tolist=array(); + $f=0; + $tolist[0]=""; + for ($a=0; $a0) fclose($fp); + else $this->Event("URL Alert Failed ".$url,1,"Flush","URL"); + $this->Event("URL Alert ".$url,4,"Flush","URL"); + } + } + + + } + else if ($row['atype']=="mqueue") + { + // message queue + $eventdata=array("aaid"=>$row['aaid'],"name"=>$row['aname'],"data"=>$row['mdata']); + $result=$this->EventHandler("alert_action",$eventdata); + if ($result===false) // put the data back into the queue + { + $q="UPDATE fnalertaction SET mdata=\"".$row['mdata']."\"+mdata WHERE aaid=".$row['aaid']; + $this->DB->Query($q); + if ($this->DB->Affected_Rows()<=0) + $this->Event("Persist MDATA Failed for AAID ".$row['aaid'],2,"Flush","MQueue"); + } + else $this->Event("Queue Cleared for AAID ".$row['aaid']." by Handler",4,"Flush","MQueue"); + } + + } + } + +function GetAlerts() + { + $q="SELECT nodeid,alertlevel FROM fnalert WHERE closedx=0"; + $r=$this->DB->Query($q); + $c=0; + $al=array(); + while ($row=$this->DB->Fetch_Array($r)) + { + $al[$c]['nodeid']=$row['nodeid']; + $al[$c]['alertlevel']=$row['alertlevel']; + $c++; + } + if ($c>0) return $al; + else return false; + } + +function SetAlerts($nodeid,$alertlevel,$alerts="") + { + if ($alerts=="") $alerts=array(); + // get current alert level + $q="SELECT alertlevel,nodealert FROM fnnode WHERE nodeid=\"".ss($nodeid)."\""; + $r=$this->DB->Query($q); + $row=$this->DB->Fetch_Array($r); + $this->DB->Free($r); + $cal=$row['alertlevel']; + + $eventdata=array("nodeid"=>$nodeid,"alertlevel"=>$alertlevel, + "oldalertlevel"=>$cal); + $this->EventHandler("set_alerts",$eventdata); + + if ($alertlevel!=$cal) + { + // update table + $q="UPDATE fnnode SET alertlevel=".ss($alertlevel)." WHERE nodeid=\"".ss($nodeid)."\""; + $this->DB->Query($q); + } + + // do not continue if node alert isn't set + if ($row['nodealert']!=1) return 0; + // or if untested + if ($alertlevel<0) return 0; + + // ALERTS + // is there an existing alert for this node + $q="SELECT alertid,alertlevel FROM fnalert WHERE nodeid=\"".ss($nodeid)."\" AND closedx=0"; + $r=$this->DB->Query($q); + if ($row=$this->DB->Fetch_Array($r)) + { // yes there is + // if new alert level is 0 let's close it + if ($alertlevel==0) + { + $alertid=$row['alertid']; + $q="UPDATE fnalert SET closedx=".time()." WHERE alertid=".$row['alertid']; + $this->DB->Query($q); + $closetext=$this->Cfg->Get("site.text.closed","Alert Closed"); + if (is_array($alerts)) $alerts[]=$closetext; + else + { + $alerts=array($alerts); // add as first element to new array + $alerts[]=$closetext; + } + $eventdata=array("nodeid"=>$nodeid); + $this->EventHandler("alert_close",$eventdata); + } + else + { + $alertid=$row['alertid']; + // otherwise update the alert to the new value (was: regardless, now just if not a 0) + $q="UPDATE fnalert SET alertlevel=".ss($alertlevel)." WHERE alertid=".$alertid; + $this->DB->Query($q); + } + } + else + { // no there's not + $cal=0; // the cal (current alert level) goes to zero if it's a new alert so alert_actions fire ok + if ($alertlevel>0) // only if an actual alert + { + $q="INSERT INTO fnalert(nodeid,alertlevel,openedx) VALUES("; + $q.="\"".ss($nodeid)."\",".ss($alertlevel).",".time().")"; + $this->DB->Query($q); + $alertid=$this->DB->Insert_Id(); + $eventdata=array("nodeid"=>$nodeid); + $this->EventHandler("alert_open",$eventdata); + } + } + // ALERT LOG with $alertid + $t=time(); + $at=""; + if (is_array($alerts)) + { + foreach($alerts as $alert) + { + if (isset($alertid)) // misses on manual runs methinx + { + if ($at!="") $at.=", "; + $at.=$alert; + //echo $at."\n"; + $iq="INSERT INTO fnalertlog(alertid,postedx,logentry) VALUES("; + $iq.=$alertid.",".$t.",\"".ss($alert)."\")"; + //echo $iq; + $this->DB->Query($iq); + } + } + } + + $this->AlertAction($nodeid,$alertlevel,$alertlevel-$cal,$at); + + + + } + +function NodeAlertLevel($nodeid) + { + $q="SELECT alertlevel FROM fnnode WHERE nodeid=\"".ss($nodeid)."\""; + $r=$this->DB->Query($q); + if ($row=$this->DB->Fetch_Array($r)) return $row['alertlevel']; + else return -1; + } + +function GroupAlertLevel($groupid) + { + $lvl=-1; + $q="SELECT nodeid FROM fngrouplink WHERE groupid=\"".ss($groupid)."\""; + $r=$this->DB->Query($q); + while ($row=$this->DB->Fetch_Array($r)) + { + $nl=$this->NodeAlertLevel($row['nodeid']); + if ($nl>$lvl) $lvl=$nl; + } + $this->DB->Free($r); + return $lvl; + } + +function PhoneHome($mode=0,$type="ping") // 0 - php, 1 - html, 2 - data +{ +if ($mode<2) + { + $qs="?type=".$type."&data=v=".$this->Version; + if (isset($_SERVER['REMOTE_ADDR'])) + $qs.=",ip=".$_SERVER['REMOTE_ADDR']; + $ploc="http://www.purplepixie.org/freenats/report/"; + if ($mode==1) $ploc.="ping.html"; + else $ploc.="ping.php"; + + $ploc.=$qs; + + $lp=@fopen($ploc,"r"); + if ($lp>0) @fclose($lp); + } +else + { + // data post -- !! + } +} + +function GetNode($nodeid) + { + $return_row=false; + $q="SELECT * FROM fnnode WHERE nodeid=\"".ss($nodeid)."\" LIMIT 0,1"; + $r=$this->DB->Query($q); + if ($row=$this->DB->Fetch_Array($r)) + $return_row=true; + + $this->DB->Free($r); + if ($return_row) // found a valid + { + if ($row['nodename']!="") $row['name']=$row['nodename']; // make a "nice" name for it + else $row['name']=$row['nodeid']; + + $row['alerttext']=oText($row['alertlevel']); // textual alert status + + $row['lastrundt']=nicedt($row['lastrunx']); // text date-time last run + $row['lastrunago']=dtago($row['lastrunx'],false); // last run ago + + // protection + $row['nskey']=""; + + return $row; + } + else + return false; // or failed + } + +function GetNodes() +{ + $out=array(); + $q="SELECT * FROM fnnode"; + $r=$this->DB->Query($q); + + while ($row=$this->DB->Fetch_Array($r)) + { + if ($row['nodename']!="") $row['name']=$row['nodename']; // make a "nice" name for it + else $row['name']=$row['nodeid']; + + $row['alerttext']=oText($row['alertlevel']); // textual alert status + + $row['lastrundt']=nicedt($row['lastrunx']); // text date-time last run + $row['lastrunago']=dtago($row['lastrunx'],false); // last run ago + + // protection + $row['nskey']=""; + + $out[$row['nodeid']]=$row; + } + $this->DB->Free($r); + + return $out; +} + + +function GetNodeTests($nodeid) + { // returns an array of testids for the node (enabled tests only) + $tests=array(); + + // local tests + $q="SELECT localtestid FROM fnlocaltest WHERE testenabled=1 AND nodeid=\"".ss($nodeid)."\" ORDER BY localtestid ASC"; + $r=$this->DB->Query($q); + while ($row=$this->DB->Fetch_Array($r)) + { + $tests[]="L".$row['localtestid']; + } + $this->DB->Free($r); + + // nodeside + $q="SELECT nstestid FROM fnnstest WHERE testenabled=1 AND nodeid=\"".ss($nodeid)."\" ORDER BY testtype ASC"; + $r=$this->DB->Query($q); + while ($row=$this->DB->Fetch_Array($r)) + { + $tests[]="N".$row['nstestid']; + } + $this->DB->Free($r); + + return $tests; + } + +function SetNode($nodeid,$data) + { + $q="UPDATE fnnode SET "; + $first=true; + foreach($data as $key => $val) + { + if ($first) $first=false; + else $q.=","; + $q.=ss($key)."=\"".ss($val)."\""; + } + $q.=" WHERE nodeid=\"".ss($nodeid)."\""; + $this->DB->Query($q); + if ($this->DB->Affected_Rows()>0) return true; + + if ($this->DB->Error()) // query failed + { + $errstr1="Query Failed: ".$q; + $errstr2="Query Failed: ".$this->DB->Error_String(); + $this->Event($errstr1,2,"Node","Set"); + $this->Event($errstr1,2,"Node","Set"); + return false; + } + return true; // query succeeded but nothing was updated + } + +function EnableNode($nodeid,$enabled=true) + { + if ($enabled) $ne=1; + else $ne=0; + $data=array("nodeenabled"=>$ne); + return $this->SetNode($nodeid,$data); + } + +function DisableNode($nodeid) + { + return $this->EnableNode($nodeid,false); + } + +function SetNodeSchedule($nodeid,$scheduleid) + { + $data=array("scheduleid"=>$scheduleid); + return $this->SetNode($nodeid,$data); + } + +function GetGroup($groupid) + { + $q="SELECT * FROM fngroup WHERE groupid=".ss($groupid)." LIMIT 0,1"; + $r=$this->DB->Query($q); + if (!$row=$this->DB->Fetch_Array($r)) return false; + + $this->DB->Free($r); + $row['alertlevel']=$this->GroupAlertLevel($groupid); + $row['alerttext']=oText($row['alertlevel']); + return $row; + } + +function GetGroups() +{ + $out=array(); + $q="SELECT * FROM fngroup"; + $r=$this->DB->Query($q); + + while ($row=$this->DB->Fetch_Array($r)) + { + $row['alertlevel']=$this->GroupAlertLevel($row['groupid']); + $row['alerttext']=oText($row['alertlevel']); + $out[$row['groupid']]=$row; + } + + $this->DB->Free($r); + return $out; +} + +function GetTest($testid,$protect=false) + { + if ($testid=="") return false; + $class=$testid[0]; + if (is_numeric($class)) + { + // test ID will stay the same + $class="L"; + $anytestid=$testid; + } + else + { + //$testid=substr($testid,1); // as it will here also so direct use to graphs can be made + $anytestid=substr($testid,1); // the classless version + } + + $q=""; + switch($class) + { + case "L": // local tests + $q="SELECT * FROM fnlocaltest WHERE localtestid=".ss($anytestid)." LIMIT 0,1"; + break; + case "N": // node-side test + $q="SELECT * FROM fnnstest WHERE nstestid=".ss($anytestid)." LIMIT 0,1"; + break; + default: + return false; // can't lookup this class + } + + if ($q=="") return false; + + $r=$this->DB->Query($q); + + if (!$row=$this->DB->Fetch_Array($r)) return false; + + $row['class']=$class; + $row['testid']=$testid; + $row['anytestid']=$anytestid; + $row['alerttext']=oText($row['alertlevel']); + $row['lastrundt']=nicedt($row['lastrunx']); + $row['lastrunago']=dtago($row['lastrunx'],false); + + if ($row['testname']!="") $row['name']=$row['testname']; + else + { + if ($class=="L") + { + $row['name']=lText($row['testtype']); // TODO OTHER TESTS + if ($row['testparam']!="") $row['name'].=" (".$row['testparam'].")"; + } + else if ($class=="N") + { + if ($row['testdesc']!="") $row['name']=$row['testdesc']; + else $row['name']=$row['testtype']; + } + } + + if ($protect&&($class=="L")) // module test protection + { + if ($this->Tests->Exists($row['testtype'])) // in the module register + { + $this->Tests->Tests[$row['testtype']]->Create(); + $this->Tests->Tests[$row['testtype']]->instance->ProtectOutput($row); + } + } + + $this->DB->Free($r); + + return $row; + } + + +function DeleteTest($testid) + { + if ($testid=="") return false; + $class=$testid[0]; + if (is_numeric($class)) + { + // test ID will stay the same + $class="L"; + $anytestid=$testid; + } + else + { + $anytestid=substr($testid,1); // the classless version + } + + $q=""; + switch($class) + { + case "L": // local tests + $q="DELETE FROM fnlocaltest WHERE localtestid=".ss($anytestid); + break; + case "N": // node-side test + $q="DELETE FROM fnnstest WHERE nstestid=".ss($anytestid); + break; + default: + return false; // can't lookup this class + } + + if ($q=="") return false; + + $this->DB->Query($q); + $tests=$this->DB->Affected_Rows(); + + $rq="DELETE FROM fnrecord WHERE testid=\"".ss($testid)."\""; + $this->DB->Query($rq); + $records=$this->DB->Affected_Rows(); + + $eq="DELETE FROM fneval WHERE testid=\"".ss($testid)."\""; + $this->DB->Query($eq); + $eval=$this->DB->Affected_Rows(); + + $s="Deleted test ".$testid." (".$tests." tests, ".$records." records, ".$eval." evaluators)"; + $this->Event($s,6,"Test","Delete"); + } + + + +function InvalidateTest($testid,$rightnow=false) + { + $class=$testid[0]; + if (is_numeric($class)) $class="L"; + else $testid=substr($testid,1); + if ($rightnow) + { + $nextx=time(); + $q="UPDATE "; + if ($class=="L") $q.="fnlocaltest"; + // other ones here + + $q.=" SET nextrunx=".$nextx." WHERE "; + + if ($class=="L") $q.="localtestid=".$testid; + // other ones here + + $this->DB->Query($q); + return true; + } + // otherwise use it's interval + $q="SELECT testinterval FROM "; + + if ($class=="L") $q.="fnlocaltest WHERE localtestid="; + // other ones here + + $q.=$testid; + $r=$this->DB->Query($q); + if ($row=$this->DB->Fetch_Array($r)) + { + $this->DB->Free($r); + $nextx=next_run_x($row['testinterval']); + $q="UPDATE "; + if ($class=="L") $q.="fnlocaltest"; + // other ones here + + $q.=" SET nextrunx=".$nextx." WHERE "; + + if ($class=="L") $q.="localtestid=".$testid; + // other ones here + + $this->DB->Query($q); + return true; + } + return false; + } + +function InvalidateNode($nodeid,$rightnow=false,$testsaswell=false) + { + if ($rightnow) + { + $nextx=time(); + $q="UPDATE fnnode SET nextrunx=".$nextx." WHERE nodeid=\"".ss($nodeid)."\""; + $this->DB->Query($q); + if ($testsaswell) + { + $q="UPDATE fnlocaltest SET nextrunx=".$nextx." WHERE nodeid=\"".ss($nodeid)."\""; + $this->DB->Query($q); + } + return true; + } + // otherwise set to it's interval + $q="SELECT testinterval FROM fnnode WHERE nodeid=\"".ss($nodeid)."\""; + $r=$this->DB->Query($q); + if ($row=$this->DB->Fetch_Array($r)) + { + $nextx=next_run_x($row['testinterval']); + $uq="UPDATE fnnode SET nextrunx=".$nextx." WHERE nodeid=\"".ss($nodeid)."\""; + $this->DB->Query($uq); + $this->DB->Free($r); + if ($testsaswell) + { + $uq="UPDATE fnlocaltest SET nextrunx=".$nextx." WHERE nodeid=\"".ss($nodeid)."\""; + $this->DB->Query($uq); + } + return true; + } + return false; + } + + +function NodeSide_Pull($nodeid) + { + $eventdata=array("nodeid"=>$nodeid,"success"=>false); + $q="SELECT nsenabled,nspullenabled,nsurl,nskey,nsinterval FROM fnnode WHERE nodeid=\"".ss($nodeid)."\" LIMIT 0,1"; + $r=$this->DB->Query($q); + if (!$row=$this->DB->Fetch_Array($r)) return false; + + $this->DB->Free($r); + + $url=$row['nsurl']; + if ($row['nskey']!="") $url.="?nodekey=".$row['nskey']; + //echo $url."\n"; + $this->Event("NodeSide_Pull Started for ".$nodeid,10,"Node","Pull"); + + $xmlobj=new TNodeXML(); + + $fp=@fopen($url,"r"); + if ($fp<=0) + { + $this->Event("Pull Failed URL ".$url,1,"Node","Pull"); + $this->EventHandler("nodeside_pull",$eventdata); + return false; + } + $xml=""; + while (!feof($fp)) + { + $xml.=fgets($fp,4096); + } + if ($xml=="") + { + $this->EventHandler("nodeside_pull",$eventdata); + return false; + } + + //echo $xml; + + $result=$xmlobj->Parse($xml); + + if ($xmlobj->Error()!="") + { + $this->Event("NodeXML Error: ".$xmlobj->Error(),1,"Node","Pull"); + $this->EventHandler("nodeside_pull",$eventdata); + return false; + } + $this->Event("NodeSide_Pull Fetched ".$xmlobj->Tests." tests for ".$nodeid,10,"Node","Pull"); + // Now just to actually process it... + $eventdata['success']=true; + $this->EventHandler("nodeside_pull",$eventdata); + $this->NodeSide_Process($nodeid,$xmlobj); + return true; + } + +function NodeSide_Process($nodeid,&$xmlobj) + { // nodeid + takes a TNodeXML Object + $alvl=0; + $this->Event("NodeSide_Process for ".$nodeid,10,"Node","Pull"); + $q="SELECT * FROM fnnstest WHERE nodeid=\"".ss($nodeid)."\""; + $r=$this->DB->Query($q); + $tests=array(); + while ($row=$this->DB->Fetch_Array($r)) + { + $tests[$row['testtype']]=$row; + if (isset($xmlobj->Catalogue[$row['testtype']])) + { // this test is in the DB and catalogue + $tests[$row['testtype']]['incat']=true; + if ($row['testenabled']==1) // it is enabled - so we test it + { + if ($row['simpleeval']==1) $level=$xmlobj->Catalogue[$row['testtype']]['ALERTLEVEL']; // use provided level + else $level=nats_eval("N".$row['nstestid'],$xmlobj->Catalogue[$row['testtype']]['VALUE']); + $dbs="Nodeside ".$row['testtype']." on ".$row['nodeid']." = ".$level; + if ($level==0) $debuglev=8; + else if ($level>0) $debuglev=5; + else $debuglev=2; + $this->Event($dbs,$debuglev,"Node","Process"); + + if ($level>$alvl) $alvl=$level; + + if ($row['testrecord']==1) // record it + { + $testvalue=$xmlobj->Catalogue[$row['testtype']]['VALUE']; + $testvalue=str_replace(",",".",$testvalue); + if (!is_numeric($testvalue)) $testvalue=0; + $iq="INSERT INTO fnrecord(testid,alertlevel,recordx,nodeid,testvalue) VALUES("; + $iq.="\"N".$row['nstestid']."\",".$level.",".time().",\"".$row['nodeid']."\",".$testvalue.")"; + $this->DB->Query($iq); + if ($this->DB->Affected_Rows()<=0) + $this->Event("Nodeside ".$row['testtype']." Failed to Record",1,"Node","Process"); + } + + // We don't do any alerting here - the tester will do that for us! + $uq="UPDATE fnnstest SET lastrunx=".time().",lastvalue=\"".ss($xmlobj->Catalogue[$row['testtype']]['VALUE'])."\",alertlevel=".$level." "; + $uq.="WHERE nstestid=".$row['nstestid']; + $this->DB->Query($uq); + if ($this->DB->Affected_Rows()<=0) + $this->Event("Nodeside ".$row['testtype']." Failed to Update or Same Values",5,"Node","Process"); + + } + + // check to see if the desc has changed + if ($row['testdesc']!=$xmlobj->Catalogue[$row['testtype']]['DESC']) + { + $duq="UPDATE fnnstest SET testdesc=\"".ss($xmlobj->Catalogue[$row['testtype']]['DESC'])."\" WHERE nstestid=".$row['nstestid']; + $this->DB->Query($duq); + } + + } + else + { + // test in the DB but NOT in the catalogue + //$xmlobj->Catalogue[$row['testtype']]['incat']=false; + if ($row['testenabled']==1) + { // enabled so shown in lists etc + // Update it to show failed status + $this->Event("No nodeside data for test N".$row['nstestid'],3,"Node","Process"); + $uq="UPDATE fnnstest SET alertlevel=2,lastvalue=-1 WHERE nstestid=".$row['nstestid']; + $this->DB->Query($uq); + $alvl=2; + if ($row['testrecord']==1) // record it + { + $testvalue=-1; + $iq="INSERT INTO fnrecord(testid,alertlevel,recordx,nodeid,testvalue) VALUES("; + $iq.="\"N".$row['nstestid']."\",2,".time().",\"".$row['nodeid']."\",".$testvalue.")"; + $this->DB->Query($iq); + if ($this->DB->Affected_Rows()<=0) + $this->Event("Nodeside ".$row['testtype']." Failed to Record",1,"Node","Process"); + } + } + else // not enabled so simply delete + { + $this->DeleteTest("N".$row['nstestid']); + } + } + } + $this->DB->Free($r); + + + // and finally we look for new tests i.e. in the cat but not in the DB + foreach($xmlobj->Catalogue as $val) + { + $key=$val['NAME']; + if (!isset($tests[$key])) // not in the DB + { + $q="INSERT INTO fnnstest(nodeid,testtype,testdesc,lastvalue,lastrunx,alertlevel) "; + $q.="VALUES(\"".ss($nodeid)."\",\"".$key."\",\"".ss($val['DESC'])."\",\"".ss($val['VALUE'])."\",".time().",".ss($val['ALERTLEVEL']).")"; + //echo $q."
"; + $this->DB->Query($q); + } + } + + $eventdata=array("nodeid"=>$nodeid,"alertlevel"=>$alvl); + $this->EventHandler("nodeside_process",$eventdata); + + + } + + +function AddEventHandler($event,$function) +{ + if (!isset($this->EventHandlers[$event])) $this->EventHandlers[$event]=array(); + $this->EventHandlers[$event][]=$function; +} + +function EventHandler($event,$data) +{ + $res=false; + if ( isset($data) && is_array($data) ) $data['event']=$event; + + if (isset($this->EventHandlers[$event])) // handler(s) exist + { + for($a=0; $aEventHandlers[$event]); $a++) + { + if (function_exists($this->EventHandlers[$event][$a])) + { + $this->Event("Event ".$event." -> ".$this->EventHandlers[$event][$a],6,"Event","Handler"); + if($this->EventHandlers[$event][$a]($data)) $res=true; // persist true only + } + else + { + $t="Illegal Handler ".$this->EventHandlers[$event][$a]." for ".$event; + $this->Event($t,2,"Event","Handler"); + //return false; + } + } + } + else return $res; +} + +function StripGPC($data) +{ + if (get_magic_quotes_gpc()) return stripslashes($data); + else return $data; +} + +function PageError($code,$desc) +{ +$this->PageErrors[]=array( "code" => $code, "desc" => $desc ); +} + +} +?> diff --git a/src/server/base/help.inc.php b/src/server/base/help.inc.php new file mode 100755 index 0000000..8c1bcc8 --- /dev/null +++ b/src/server/base/help.inc.php @@ -0,0 +1,214 @@ +Lang->Item("help.".strtoupper($id)); +$o=""; +$mode="text"; +$linktext=false; +for ($a=0; $a"; + $o.=$linktxt; + if ($html) $o.=""; + $mode="text"; + } + + else if ( $mode=="link" ) // in a link + { + if ($linktext) $linktxt.=$c; + else $linkid.=$c; + } + + else // in text + $o.=$c; + } +return $o; +} + +function hlink($id,$size=16) +{ +global $NATS; +if (isset($NATS->Lang->items["help.".strtoupper($id)])) + return ""; + +return "Lang->Item("nohelp")." (".$id.")\">"; +} + +function ph($id,$size=16) +{ +echo hlink($id,$size); +} +?> \ No newline at end of file diff --git a/src/server/base/lang/English.en.lang.php b/src/server/base/lang/English.en.lang.php new file mode 100755 index 0000000..ae418a7 --- /dev/null +++ b/src/server/base/lang/English.en.lang.php @@ -0,0 +1,608 @@ +website. It is recommended you check regularly.
You are currently running version"; +$lang['monitor.alerts']="Monitoring Alerts"; +$lang['no.monitor.alerts']="No Monitoring Alerts"; +$lang['check.updates']="Check for Updates"; +$lang['monitoring']="Monitoring"; +$lang['nodes.configured']="Nodes Configured"; +$lang['node.groups']="Node Groups"; +$lang['common.tasks']="Common Tasks"; +$lang['add.nodes']="Add Nodes"; +$lang['email.alerting']="Email Alerting"; +$lang['configure.tests']="Configure Tests"; +$lang['test.summaries']="Test Summaries"; +$lang['monitored.nodes']="Monitored Nodes"; +$lang['freenats.news']="FreeNATS News"; + +// nodes already +$lang['node']="Node"; +$lang['options']="Options"; +$lang['move']="Move"; +$lang['edit']="Edit Options"; +$lang['delete']="Delete"; +$lang['create.node']="Create Node"; +$lang['config']="Configuration"; +$lang['move.before']="Move Before"; +$lang['go']="Go"; +$lang['refresh.weight']="Refresh Weighting"; + +$lang['node.groups']="Node Groups"; +$lang['create.group']="Create Group"; + +$lang['views']="Views"; +$lang['create.view']="Create New View"; +$lang['reports']="Availability Reports"; +$lang['create.report']="Create a New Service Availability Report"; + +$lang['config.summary']="Configuration Summary / Overview"; +$lang['configuration']="Configuration"; +$lang['nodeid']="Node ID"; +$lang['name']="Name"; +$lang['hostname']="Hostname"; +$lang['schedule']="Schedule"; +$lang['enabled']="Enabled"; +$lang['ping']="Ping"; +$lang['required']="Required"; +$lang['interval']="Interval"; +$lang['nodeside']="Nodeside"; + +// Time Periods +$lang['today']="Today"; +$lang['last.24h']="Last 24 Hours"; +$lang['custom']="Custom"; +$lang['ago']="ago"; +$lang['never']="never"; + +// User Preferences +$lang['user.pref']="User Preferences"; +$lang['change.password']="Change Password"; +$lang['current']="Current"; +$lang['new']="New"; +$lang['confirm']="Confirm"; +$lang['pass.change.ok']="Password Changed"; +$lang['pass.change.fail']="Password Change Failed"; + +// Administration Settings +$lang['admin.interface']="Administration Interface"; +$lang['user.admin']="User Administration"; +$lang['event.log']="System Event Log"; +$lang['alert.actions']="Alert Actions"; +$lang['variables']="System Variables"; +$lang['sessions']="Test Sessions"; +$lang['schedules']="Test and Alert Schedules"; +$lang['file.manager']="File Manager"; +$lang['sql.console']="SQL Console"; +$lang['dns.console']="DNS Query Console"; +$lang['backup.restore']="Backup and Restore"; +$lang['sys.status']="System Status Report"; +$lang['sys.info']="System Information"; + +$lang['tests.alerting']="Tests and Alerting"; +$lang['tools']="Tools"; +$lang['logs.info']="Logs and System Information"; + +$lang['ul.admin']="Administrator"; +$lang['ul.power']="Power User"; +$lang['ul.normal']="Normal User"; +$lang['ul.disabled']="Disabled"; + +$lang['aae.short']="Short"; +$lang['aae.long']="Long"; + +$lang['unknown']="Unknown"; + +$lang['aae.sub.blank']="Blank"; +$lang['aae.sub.short']="Short"; +$lang['aae.sub.long']="Long"; + +$lang['aatype.email']="Email"; +$lang['aatype.mqueue']="Message Queue"; +$lang['aatype.url']="URL"; +$lang['aatype.disabled']="Disabled"; + +$lang['real.name']="Real Name"; +$lang['user.level']="User Level"; +$lang['create.user']="Create User"; + +$lang['save']="Save"; + +$lang['sessions.for']="Node test sessions for"; +$lang['sessions.running']="Running Test Sessions"; +$lang['sessions.running.for']="Running Test Sessions for"; +$lang['sessions.not.running']="No running test sessions"; +$lang['sessions.previous']="Previous Test Sessions for"; +$lang['sessions.previous.none']="No Previous Test Sessions"; +$lang['sessions.stillrunning']="Still Running"; +$lang['started']="Started"; +$lang['finished']="Finished"; +$lang['node.filter']="Node Filter"; +$lang['output']="Output"; +$lang['allnodes']="All Nodes"; + +$lang['test.run']="Test Run"; +$lang['testrun.manual.close']="Manually Close Test Session"; +$lang['testrun.manual.close.detail']="Are you sure you want to do this? Only close sessions that you're sure aren't still running in the background.
This does not kill processes - just marks the test session as complete."; +$lang['testrun.del.yes']="Yes - Delete"; +$lang['testrun.del.cancel']="No - Cancel"; +$lang['testrun.session.closed']="Test Session Closed"; +$lang['testrun.fetch.error']="Error Fetching Testrun Data"; + +$lang['confirm.action']="Confirm Action"; + + +$lang['alert.actions']="Alert Actions"; +$lang['id']="ID"; +$lang['aa.name']="Action Name"; +$lang['aa.type']="Action Type"; +$lang['aa.create']="Create New Alert Action"; +$lang['aa.limit']="Action Limit"; +$lang['aa.counter']="Action Counter"; +$lang['aa.efrom']="Email From"; +$lang['aa.esubj']="Email Subject"; +$lang['aa.mtype']="Msg Type"; +$lang['aa.eto']="Email To or URL"; +$lang['aa.update']="Update Action"; +$lang['aa.test']="Test Action"; +$lang['aa.cancel']="Cancel Update"; +$lang['aa.delete']="Delete Action"; +$lang['aa.testflush']="Alert Action Tested & Flushed"; + + +$lang['system.status']="System Status"; +$lang['status.size']="Table Sizes"; +$lang['status.tname']="Table Name"; +$lang['status.tsize']="Size (Rows)"; +$lang['status.tsize.kb']="Size (Kb)"; +$lang['status.tother']="Other Information"; +$lang['status.free']="Free"; +$lang['status.optimise']="Optimise"; + +$lang['notes']="Notes"; + +$lang['status.running']="Open/Running Test Sessions"; +$lang['status.run.warn']="Warning: Over 15 Minutes Old"; +$lang['status.run.error']="Error: Over 1 Hour Old"; + +$lang['status.env.http']="Environment: PHP Web (Apache Module/PHP-CGI)"; +$lang['status.env.cli']="Environment: PHP CLI (Command-Line Binary)"; + +$lang['status.disclaim']="Please note this merely displays FreeNATS software status - not
the status of the underlying Virtual Machine (if applicable).

You should monitor disk space and performance for the VM via
the relevant system (such as the rPath interface).

"; + +$lang['warnings']="Warnings"; +$lang['decreases']="Decreases"; +$lang['create']="Create"; + +$lang['version.info']="Version Information"; +$lang['version']="Version"; +$lang['release']="Release"; +$lang['compound']="Compound"; + +$lang['reg.modules']="Registered Test Modules"; +$lang['provides']="Provides"; +$lang['revision']="Revision"; +$lang['additional']="Additional"; +$lang['reg.events']="Registered Event Handlers"; +$lang['event']="Event"; +$lang['handlers']="Handler(s)"; +$lang['reg.languages']="Registered Languages"; + +$lang['back.to.admin']="Back to Main System Settings Menu"; + +$lang['save.user.fail']="Save User Failed or Nothing Changed"; +$lang['save.user.ok']="User Saved"; +$lang['create.user.fail']="Failed to Create User"; +$lang['create.user.ok']="User Created"; +$lang['delete.user']="Delete User"; +$lang['user.deleted']="User Deleted"; +$lang['save.var.ok']="Updated or Deleted Variable"; +$lang['save.var.fail']="Failed to Update Variable"; +$lang['new.var.ok']="Created Variable"; +$lang['new.var.fail']="Failed to Create Variable"; +$lang['optimised.ok']="Optimised Table"; + +$lang['changes.ok']="Changes Saved"; +$lang['changes.fail']="Failed to Save Changes or Nothing Changed"; +$lang['delete.ok']="Deleted Ok"; + +// System Event Log +$lang['filter']="Filter"; +$lang['show']="Show"; +$lang['filter.log']="Filter Log Entries and Display"; +$lang['reset']="Reset"; +$lang['next']="Next"; +$lang['prev']="Previous"; + + +// Live Monitor +$lang['live.monitor']="Live Monitor"; +$lang['mon.options']="options..."; +$lang['group.name']="Group Name"; +$lang['description']="Description"; +$lang['status']="Status"; +$lang['node.name']="Node Name"; +$lang['mon.std']="standard"; +$lang['mon.grp']="groups"; +$lang['mon.nodes']="nodes"; +$lang['mon.alerting']="alerting"; +$lang['mon.hide']="...hide..."; +$lang['mon.goto.node']="Goto Node"; +$lang['mon.goto.node.page']="Goto Node Page"; +$lang['mon.popup.error']="Invalid or Illegal Node"; + +// Node Page +$lang['viewing.node']="Viewing Node"; +$lang['no.node']="No such node"; +$lang['enabled']="Enabled"; +$lang['alert']="Alert"; +$lang['yes']="Yes"; +$lang['no']="No"; +$lang['alert.history']="Alert History"; +$lang['summary']="Summary"; +$lang['links']="Links"; +$lang['opened']="Opened"; +$lang['edit.node.options']="Edit Node Options"; +$lang['nodeside.tests']="Nodeside Tests"; + +$lang['local.tests']="Local Tests"; +$lang['history']="History"; + +$lang['email.alerting']="Email Alerting"; + +$lang['no.test']="No Tests Configured"; + +// Edit Node Options +$lang['node.editor']="Node Editor"; +$lang['editing']="Editing"; +$lang['node.settings']="Node Settings"; +$lang['show.hide.options']="Show / Hide Node Options"; +$lang['node.tests']="Node Tests"; +$lang['last.tested']="Last Tested"; +$lang['add.test']="Add Test"; +$lang['no.such.node']="No Such Node"; +$lang['create.test']="Create Test"; +$lang['update.alert.actions']="Update Alert Actions"; +$lang['add']="Add"; + +$lang['add.nodeside']="Add Nodeside Monitor"; + +$lang['web.time']="Web Time"; +$lang['web.size']="Web Size"; +$lang['host']="Simple DNS Host"; +$lang['remote.ping']="Remote Ping"; +$lang['test.loop']="Test Loop"; +$lang['test.random']="Test Random"; + +$lang['node.id']="Node ID"; +$lang['node.icon']="Node Icon"; +$lang['default']="Default"; +$lang['show.hide.icons']="Show/Hide Icons"; +$lang['master.node']="Master Node"; +$lang['no.master']="No Master Node"; +$lang['master.skip']="Skip if Master"; +$lang['fails.ping']="Fails Ping"; +$lang['fails.any.test']="Fails Any Test"; +$lang['node.enabled']="Node Enabled"; +$lang['test.schedule']="Test Schedule"; +$lang['test.interval']="Test Interval"; +$lang['test.due']="Test Due"; +$lang['check.asap']="Check ASAP"; +$lang['alerts.active']="Alerts Active"; +$lang['ping.test']="Ping Test"; +$lang['require.ping']="Require Ping"; +$lang['nodeside.testing']="Nodeside Testing"; +$lang['node.key']="Node Key"; +$lang['pull.enabled']="Pull Enabled"; +$lang['pull.url']="Pull URL"; +$lang['pull.interval']="Pull Interval"; +$lang['push.enabled']="Push Enabled"; +$lang['push.ip']="Push IP"; +$lang['last.date']="Last Data"; +$lang['next.pull.due']="Next Pull Due"; +$lang['catalogue']="Catalogue"; +$lang['nodeside.monitors']="Nodeside Monitors"; +$lang['refresh.now']="Refresh Now"; +$lang['nodeside.pull.now']="Refresh (Pull) Now"; +$lang['utility.links']="Utility Links"; +$lang['title']="Title"; +$lang['url']="URL"; +$lang['debug.raw']="Debug Raw Output"; +$lang['last.data']="Last Data"; +$lang['save.settings']="Save Settings"; +$lang['cancel']="Cancel"; + +$lang['nodeside.pull.disabled']="Nodeside Pull Disabled"; + +$lang['minutes']="Minutes"; +$lang['now']="Now"; +$lang['edit.options']="Edit Options"; + +$lang['save.ok']="Changes Saved"; +$lang['save.failed']="Changes Failed to Save or Nothing Changed"; +$lang['save.fail']=$lang['save.failed']; + +// Group +$lang['group.settings']="Group Settings"; + + +// Test Editing +$lang['local.test.editor']="Local Test Editor"; +$lang['editing.test']="Editing Test"; +$lang['test.settings']="Test Settings"; +$lang['test.type']="Test Type"; +$lang['test.options']="Test Options"; + +$lang['full.url']="Full URL including prefix e.g. http://www.somehost.com/"; +$lang['host.ip']="Host or IP"; +$lang['host.desc']="Hostname or IP to ping (DNS resolution not timed)"; +$lang['value']="Value"; +$lang['value.desc']="Value for Test Loop or Max Value for Test Random"; +$lang['host']="Host"; +$lang['host.desc']="Hostname to resolve or IP address to do reverse lookup of"; + +$lang['no.test.options']="No Options for Test"; + +$lang['custom.name']="Custom Name"; +$lang['test.enabled']="Test Enabled"; +$lang['recorded']="Recorded"; +$lang['simple.eval']="Simple Evaluation"; +$lang['test.interval']="Test Interval"; +$lang['test.due']="Test Due"; +$lang['last.tested']="Last Tested"; + +$lang['custom.attempts']="Custom Attempts"; +$lang['custom.timeout']="Custom Timeout"; + +$lang['test.save']="Save Test Settings"; +$lang['abandon.changes']="Abandon Changes"; + +$lang['seconds']="Seconds"; + +$lang['passed']="Passed"; +$lang['untested']="Untested"; +$lang['warning']="Warning"; +$lang['failed']="Failed"; +$lang['failure']="Failure"; + +$lang['test.evals']="Custom Test Evaluators"; +$lang['test.evals.simple']="Custom evaluators will not be parsed as Simple Evaluation is checked (above)"; +$lang['add.eval']="Add New"; +$lang['eval.equal']="Equal To"; +$lang['eval.lt']="Less Than"; +$lang['eval.gt']="Greater Than"; +$lang['eval.deleted']="Evaluator Deleted"; + + +$lang['edit.nodeside.test']="Nodeside Test Editor"; +$lang['ns.type']="Test Type / UID"; +$lang['nodeside.test']="Nodeside Test"; +$lang['test.alerts']="Test Alerts"; +$lang['last.checked']="Last Checked"; +$lang['last.result']="Last Result"; +$lang['last.value']="Last Value"; +$lang['save.changes']="Save Changes"; + +$lang['result']="Result"; + +$lang['edit.view']="Edit View"; +$lang['editing.view']="Editing View"; +$lang['no.such.view']="No Such View"; +$lang['preview']="Preview"; +$lang['linking']="Linking"; +$lang['unknown.action']="Unknown Action"; +$lang['expand.view.options']="Expand View Options"; + +$lang['node.ping']="Node Ping"; + +$lang['host.ip.lookup']="IP Address Lookup"; + +// Group Editor +$lang['group.editor']="Group Editor"; +$lang['no.group']="Group Not Found"; +$lang['group.id']="Group ID"; +$lang['group.name']="Group Name"; +$lang['group.icon']="Group Icon"; +$lang['group.save']="Save Group Settings"; +$lang['group.members']="Group Members"; +$lang['group.update']="Update Group Member List"; +$lang['group.updated']="Group Membership Updated"; +$lang['group']="Group"; +$lang['editing']="Editing"; + +$lang['show.icons']="Show Icons"; + +$lang['dns.host']="DNS Host Lookup"; + +// Security Warnings +$lang['sec.firstrun']="Security Warning: firstrun.php Script is Exposed"; +$lang['sec.firstrun.text']="The firstrun.php script in your web directory has not been renamed. This could be used to damage FreeNATS.
Please rename to firstrun-.php."; +$lang['sec.firstrun.ignore']="To stop this warning from being shown without renaming the script (not recommended) set site.firstrun.ignore to 1"; + +// RSS +$lang['rss.feed']="RSS Feed Management"; +$lang['rss.feed.name']="Feed Name"; +$lang['rss.feed.key']="Feed Key"; +$lang['rss.type']="Type of Feed"; +$lang['all.enabled.nodes']="All Enabled Nodes"; +$lang['one.node']="Single Node"; +$lang['rss.range']="Range/Scope of Feed"; +$lang['last.x.days']="Last X Days"; +$lang['last.x.alerts']="Last X Alerts"; +$lang['current.alerts']="Current Alerts"; +$lang['last.alerts.node']="Last Alert for Each Node"; +$lang['rss.feeds']="FreeNATS RSS Feeds"; +$lang['feed.url']="RSS Feed URL"; +$lang['feed.create']="Create New Feed"; +$lang['no.feeds']="No RSS Feeds Configured"; +$lang['open']="Open"; +$lang['closed']="Closed"; + + +$lang['help']="Help"; +// Help - Text support NATS_Help format strings i.e. {link} and {link|text} links +$lang['nohelp'] = "Sorry no help is available"; +$lang['help.FREENATS'] = "FreeNATS is a network monitoring package"; +$lang['help.NODE'] = "A node is a system or device which you are monitoring. Note that nodes can have tests pointing to different physical devices and vice-versa"; +$lang['help.NODE:CREATE'] = "Create a new {node} with this {node:id|NodeID}"; +$lang['help.NODE:ID'] = "The NodeID is a unique text name for a {node}. Maximum length 60 chars and only normal characters allowed."; +$lang['help.NODE:ENABLED'] = "The node is enabled for tests to be performed (and displayed in all applicable views)"; +$lang['help.NODE:ALERTACTIVE'] = "Alerts will be generated for this node and alert actions performed if selected"; +$lang['help.NODE:PINGTEST'] = "Do a ping (ICMP) test first before other tests - will always record results if enabled"; +$lang['help.NODE:REQUIREPING'] = "Require the ping to pass for other tests to even be tried - will always fail if {Node:PingTest|ping test} is disabled"; +$lang['help.NODE:MASTER'] = "Master Node to be Tested First"; +$lang['help.MASTERNODE:PING'] = "Tests required to pass on the {Node:Master|master node} for this node to be tested"; +$lang['help.NODE:TESTINTERVAL'] = "Interval (minutes) between tests on this node being carried out"; +$lang['help.NODESIDE'] = "Enable support for node-side scripts to gather data from this node"; +$lang['help.NODE:CHECKASAP'] = "Schedule node for immediate text in next test cycle"; +$lang['help.UTILLINKS'] = "Links to services on remote note for system administration"; +$lang['help.NODESIDE:KEY'] = "Key used to authenticate nodeside testing"; +$lang['help.NODESIDE:PULLENABLED'] = "Enable nodeside collection via http 'pull' from the node"; +$lang['help.NODESIDE:URL'] = "URL to 'pull' nodeside data from on the node"; +$lang['help.NODESIDE:INTERVAL'] = "Interval between 'pulling' (polling) data from the node"; +$lang['help.NODESIDE:PUSHENABLED'] = "Allow node to 'push' (post) data"; +$lang['help.NODESIDE:PUSHIP'] = "Limit node 'push' to this specific IP address for security"; +$lang['help.GROUP'] = "A group is a collection of one or more {node|nodes}. Note that nodes can be members of more than one group."; +$lang['help.GROUP:CREATE'] = "Create a new {group} with this name"; +$lang['help.TEST:NAME'] = "A custom name can be assigned to the test for use in displays and alerts. If blank an automated name will be generated."; +$lang['help.TEST:ATTEMPTS'] = "Number of times to attempt a test (will always try once). Defaults to 1 if zero or unset."; +$lang['help.TEST:TIMEOUT'] = "Timeout value for the test - alters the defaults or system-wide variable settings for the relevant test (seconds)"; +$lang['help.TEST:SIMPLEEVALUATION'] = "Use simple pass/fail evaluation (i.e. if a web test returns any data it passes else it fails)"; +$lang['help.TEST:RECORDED'] = "Record the results of this test for historic reports"; +$lang['help.TEST:ENABLED'] = "Perform the test or not (will update nothing if disabled)"; +$lang['help.TEST:INTERVAL'] = "Interval (minutes) between this test being performed. Will only ever be tested as quickly as the {Node:TestInterval|node interval} is set to"; +$lang['help.TEST:TESTALERTS'] = "Test will generate an alert on failure"; +$lang['help.HISTORY:SHOULD'] = "A rough calculation based on configured polling times (i.e. test interval or node interval) from the start to finish (or now if sooner)"; +$lang['help.VIEW'] = "A view is a custom set of nodes/groups/tests which can be used in a variety of ways"; +$lang['help.VIEW:CREATE'] = "Creates a {view} of the specified name"; +$lang['help.VIEW:PUBLIC'] = "The view can be seen by people not logged into FreeNATS"; +$lang['help.VIEW:COLONS'] = "If text status is selected for a view item a colon will be displayed before it"; +$lang['help.VIEW:DASHES'] = "Display a dash before a test last run time where applicable"; +$lang['help.VIEW:TIMEAGO'] = "Use XX:XX ago or normal datetime for test details"; +$lang['help.VIEW:COLUMNS'] = "Display list-type elements in this number of columns (0 for off)"; +$lang['help.VIEW:REFRESH'] = "Send a http-equv to refresh the page after this many seconds (0 for off)"; +$lang['help.VIEW:USECOLOUR'] = "Use colour for status display as in normal FreeNATS display"; +$lang['help.VIEW:SHOWDETAIL'] = "Show details of the test/object(s) such as node tests"; +$lang['help.VIEW:TEXTSTATUS'] = "Textual status such as passed, failed etc"; +$lang['help.REPORT'] = "Reports show the %age of service availability in a specified period"; +$lang['help.BACKUP:TRUNCATE'] = "Clears tables first when restored back (recommended) otherwise duplicates may fail"; +$lang['help.SCHEDULE'] = "A schedule controls what times a node is tested and are managed through the admin page"; +$lang['help.SCHEDULE:DEFAULTACTION'] = "What will happen if no exceptions are matched (the opposite will happen if one is matched)"; +$lang['help.ALERTACTION'] = "An alert action is performed when a node fails a test, they are configured through the admin page"; +$lang['help.AACTION:WARNINGS'] = "The action is triggered for warning level events as well as failures (including downgrading from failure to warning if {AAction:Decreases|decreases} is set)"; +$lang['help.AACTION:DECREASES'] = "The action is triggered when the level goes down to closed (or {AAction:Warnings|warnings} if set)"; +$lang['help.AACTION:LIMIT'] = "Max times this action can run in any one day (0 = unlimited) to avoid flooding"; +$lang['help.AACTION:COUNTER'] = "Number of times this action has run in the day shown - you can manually reset this here"; +$lang['help.VARIABLE'] = "System variables are used to control the system environment. To delete a variable just save it with a blank name."; +$lang['help.VAR:LOG.LEVEL'] = "The system log level - 10 is everything, 0 is fatal only. 5-6-ish is probably a good balance."; +$lang['help.VAR:API.PUBLIC'] = "The API interface is available to public users if 1 (also see {Var:api.key|api.key})"; +$lang['help.VAR:API.KEY'] = "Require this key from public users as apikey when accessing the API ({Var:api.public|api.public} must be set)"; +$lang['help.VAR:ALERT.BODY.FOOTER'] = "Footer to go at the end of system generated alerts"; +$lang['help.VAR:ALERT.BODY.HEADER'] = "Header to go at the start of system generated alerts"; +$lang['help.VAR:ALERT.SUBJECT.LONG'] = "Subject for email alerts of long format"; +$lang['help.VAR:ALERT.SUBJECT.SHORT'] = "Subject for email alerts of short format"; +$lang['help.VAR:FREENATS.FIRSTRUN'] = "System variable to indicate first use of FreeNATS"; +$lang['help.VAR:SITE.ENABLE.TESTS'] = "Enable testing"; +$lang['help.VAR:SITE.ENABLE.WEB'] = "Enable web interface"; +$lang['help.VAR:SITE.ENABLE.TESTER'] = "Enable Tester to Run"; +$lang['help.VAR:SITE.GRAPH.PUBLIC'] = "Graphs are available to public users for views etc if 1 (also see {Var:site.graph.key|site.graph.key})"; +$lang['help.VAR:SITE.GRAPH.KEY'] = "Require this key from public users as graphkey ({Var:site.graph.public|site.graph.public} must be set)"; +$lang['help.VAR:SITE.ENABLE.INTERACTIVE'] = "Must be set (1) to allow interactive web sessions (like this one)"; +$lang['help.VAR:SITE.POPUPMESSAGE'] = "If set (1) will show a popup message when saving changes etc"; +$lang['help.VAR:SITE.DTFORMAT'] = "Site-wide custom date time format (in PHP format) i.e. Y-m-d H:i:s"; +$lang['help.VAR:SITE.TEXT.FAILED'] = "Text to show for a failed status (defaults to Failed if unset)"; +$lang['help.VAR:SITE.TEXT.PASSED'] = "Text to show for a passed status (defaults to Passed if unset)"; +$lang['help.VAR:SITE.TEXT.UNTESTED'] = "Text to show for untested items (defaults to Untested if unset)"; +$lang['help.VAR:SITE.TEXT.WARNING'] = "Text to show for a warning status (defaults to Warning if unset)"; +$lang['help.VAR:SITE.TEXT.CLOSED'] = "Text to indicate alert closed (defaults to Alert Closed if unset)"; +$lang['help.VAR:SITE.INCLUDE.EVENTS'] = "Include *.php in the server/site/events directory if 1"; +$lang['help.VAR:SITE.INCLUDE.TESTS'] = "Include *.php in the server/site/tests directory if 1"; +$lang['help.VAR:SITE.ENABLE.ADMINSQL'] = "Enables the admin SQL console if 1"; +$lang['help.VAR:SITE.LINKS.NEWWINDOW'] = "Opens {UtilLinks|utility links} in new window if 1"; +$lang['help.VAR:SITE.MONITOR.POPUPS'] = "Opens a popup status window in live monitor unless set to 0"; +$lang['help.VAR:SITE.FIRSTRUN.IGNORE'] = "Ignores the existance of the firstrun.php script (dangerous)"; +$lang['help.VAR:SITE.AUTH'] = "If set to http will use HTTP-AUTH otherwises uses standard login form"; +$lang['help.VAR:MAIL.FROMNAME'] = "Textual from name to be used in SMTP mail (defaults to FreeNATS if unset)"; +$lang['help.VAR:MAIL.SMTPSERVER'] = "SMTP server to relay mail through (can be ; seperated list) uses internal mail() if unset or blank"; +$lang['help.VAR:MAIL.SMTPUSERNAME'] = "Username for SMTP AUTH (AUTH only used if username is set or provided)"; +$lang['help.VAR:MAIL.SMTPPASSWORD'] = "Password for SMTP AUTH"; +$lang['help.VAR:MAIL.SMTPHOSTNAME'] = "Hostname for HELO in SMTP transactions (may be required for strict mail servers)"; +$lang['help.VAR:TEST.ICMP.TIMEOUT'] = "Timeout in seconds to wait for an ICMP response before declaring a failure in seconds (default 10)"; +$lang['help.VAR:TEST.ICMP.TRYTWICE'] = "Depreciated - replaced with {Var:test.icmp.attempts|test.icmp.attempts}"; +$lang['help.VAR:TEST.ICMP.ATTEMPTS'] = "Number of times the main "require ping" test will attempt before failing (default 2)"; +$lang['help.VAR:TEST.ICMP.RETURNMS'] = "If set (1) returns ping results in MilliSeconds (ms) (default 0)"; +$lang['help.VAR:TEST.HTTP.TIMEOUT'] = "Default timeout for HTTP/s streams used in web tests (uses system default if unset or <1)"; +$lang['help.VAR:TEST.IMAP.TIMEOUT'] = "Default timeout for IMAP tests in seconds (uses environment default if unset or 0)"; +$lang['help.VAR:TEST.SMTP.TIMEOUT'] = "Default timeout for SMTP tests in seconds (uses 20 seconds if 0 or unset)"; +$lang['help.VAR:TEST.MYSQL.TIMEOUT'] = "Default timeout for MySQL tests in seconds (uses environmental default if unset or 0)"; +$lang['help.VAR:TEST.SPAWNDELAY'] = "Delay in seconds between node test threads being spawned by test-threaded.sh (no delay if 0 or unset), can be a decimal"; +$lang['help.VAR:TEST.INTERVAL'] = "Delay in seconds between tests on a node (no delay if 0 or unset), can be a decimal"; +$lang['help.VAR:TEST.TCP.TIMEOUT'] = "Default timeout for TCP tests (system default if 0 or unset) (seconds)"; +$lang['help.VAR:TEST.UDP.TIMEOUT'] = "Default timeout for UDP tests (system default if 0 or unset) (seconds)"; +$lang['help.VAR:RETAIN.ALERT'] = "Days to retain alert records for (default 356 if 0 or unset). Retain forever with value -1."; +$lang['help.VAR:RETAIN.RECORD'] = "Days to retain test result records for use in history and graphs (default 356 if 0 or unsert). Retain forever with value -1."; +$lang['help.VAR:RETAIN.TESTRUN'] = "Days to retain test run records for (default 30 if 0 or unset). Retain forever with value -1."; +$lang['help.VAR:RETAIN.SYSLOG'] = "Days to retain log entries for (default 30 if 0 or unset). Retain forever with value -1."; +$lang['help.VAR:FREENATS.TRACKER'] = "Participate in the automated feedback process - 1 for yes low level, 2 for detailed, 0 for disabled (default 0)"; +$lang['help.VAR:FREENATS.TRACKER.USID'] = "Unique Site ID for FreeNATS tracker to anonymise data capture (only if {Var:freenats.tracker|freenats.tracker} set to 1"; + + +?> \ No newline at end of file diff --git a/src/server/base/lang/Italian.it.lang.php b/src/server/base/lang/Italian.it.lang.php new file mode 100755 index 0000000..0061e10 --- /dev/null +++ b/src/server/base/lang/Italian.it.lang.php @@ -0,0 +1,504 @@ +sito. Effettuare questa verifica con regolarità.
La versione che si sta utilizzando in questo momento è la"; +$lang['monitor.alerts'] = "Situazione controlli"; +$lang['no.monitor.alerts'] = "Nessuna segnalazione"; +$lang['monitoring'] = "Controlli"; +$lang['nodes.configured'] = "Nodi configurati"; +$lang['node.groups'] = "Gruppi di nodi"; +$lang['common.tasks'] = "Operazioni comuni"; +$lang['add.nodes'] = "Aggiungi nodo"; +$lang['email.alerting'] = "Email segnalazioni"; +$lang['configure.tests'] = "Configurazione controlli"; +$lang['test.summaries'] = "Riepilogo controlli"; +$lang['monitored.nodes'] = "Nodi controllati"; +$lang['node'] = "Nodo"; +$lang['options'] = "Opzioni"; +$lang['move'] = "Sposta"; +$lang['edit'] = "Modifica opzioni"; +$lang['delete'] = "Elimina"; +$lang['create.node'] = "Crea nodo"; +$lang['config'] = "Configurazione"; +$lang['move.before'] = "Sposta prima"; +$lang['go'] = "Vai"; +$lang['refresh.weight'] = "Aggiorna indici ordinamento"; +$lang['create.group'] = "Crea gruppo"; +$lang['views'] = "Viste"; +$lang['create.view'] = "Crea nuova vista"; +$lang['reports'] = "Report disponibilità"; +$lang['create.report'] = "Crea nuovo report di disponibilità servizio"; +$lang['config.summary'] = "Riepilogo configurazione"; +$lang['nodeid'] = "ID Nodo"; +$lang['name'] = "Nome"; +$lang['hostname'] = "Nome host"; +$lang['schedule'] = "Pianificazione"; +$lang['enabled'] = "Abilitato"; +$lang['ping'] = "Ping"; +$lang['required'] = "Obbligatorio"; +$lang['interval'] = "Intervallo"; +$lang['nodeside'] = "Remoto"; +$lang['today'] = "Oggi"; +$lang['last.24h'] = "Ultime 24 ore"; +$lang['custom'] = "Personalizzato"; +$lang['ago'] = "fa"; +$lang['never'] = "mai"; +$lang['user.pref'] = "Impostazioni utente"; +$lang['change.password'] = "Cambia password"; +$lang['current'] = "Attuale"; +$lang['new'] = "Nuova"; +$lang['confirm'] = "Conferma"; +$lang['pass.change.ok'] = "Password modificata"; +$lang['pass.change.fail'] = "Cambio password fallito"; +$lang['admin.interface'] = "Interfaccia amministrazione"; +$lang['user.admin'] = "Amministrazione utenti"; +$lang['event.log'] = "Registro eventi di sistema"; +$lang['alert.actions'] = "Segnalazioni"; +$lang['variables'] = "Variabili di sistema"; +$lang['sessions'] = "Sessioni di controllo"; +$lang['schedules'] = "Pianificazione controlli e segnalazioni"; +$lang['file.manager'] = "Gestore file"; +$lang['sql.console'] = "Console SQL"; +$lang['dns.console'] = "Console interrogazioni DNS"; +$lang['backup.restore'] = "Backup e ripristino"; +$lang['sys.status'] = "Riepilogo stato sistema"; +$lang['sys.info'] = "Informazioni di sistema"; +$lang['tests.alerting'] = "Controlli e Segnalazioni"; +$lang['tools'] = "Strumenti"; +$lang['logs.info'] = "Registro e informazioni di sistema"; +$lang['ul.admin'] = "Amministratore"; +$lang['ul.power'] = "Utente privilegiato"; +$lang['ul.normal'] = "Utente normale"; +$lang['ul.disabled'] = "Disabilitato"; +$lang['aae.short'] = "Breve"; +$lang['aae.long'] = "Lungo"; +$lang['unknown'] = "Sconosciuto"; +$lang['aae.sub.blank'] = "Vuoto"; +$lang['aae.sub.short'] = "Breve"; +$lang['aae.sub.long'] = "Lungo"; +$lang['aatype.email'] = "Email"; +$lang['aatype.mqueue'] = "Coda messaggio"; +$lang['aatype.url'] = "URL"; +$lang['aatype.disabled'] = "Disabilitato"; +$lang['real.name'] = "Nome reale"; +$lang['user.level'] = "Livello utente"; +$lang['create.user'] = "Crea utente"; +$lang['save'] = "Salva"; +$lang['sessions.for'] = "Sessione di controllo Nodo per"; +$lang['sessions.running'] = "Sessioni di controllo attive"; +$lang['sessions.running.for'] = "Sessione di controllo Nodo per"; +$lang['sessions.not.running'] = "Nessuna sessione di controllo attiva"; +$lang['sessions.previous'] = "Precedenti sessioni di controllo per"; +$lang['sessions.previous.none'] = "Nessuna precedente sessione di controllo"; +$lang['sessions.stillrunning'] = "Ancora attiva"; +$lang['started'] = "Iniziato"; +$lang['finished'] = "Terminato"; +$lang['node.filter'] = "Filtro Nodo"; +$lang['output'] = "Risultato"; +$lang['allnodes'] = "Tutti i Nodi"; + +$lang['test.run'] = "Esecuzione controllo"; +$lang['testrun.manual.close'] = "Chiusura manuale controllo"; +$lang['testrun.manual.close.detail'] = "Confermi questa operazione? Chiudi solo le sessioni di controllo per le quali sei certo che non siano ancora in esecuzione in background.
Questa azione non terminerà il processo, ma etichetterà la sessione di controllo come terminata."; +$lang['testrun.del.yes'] = "Sì - Elimina"; +$lang['testrun.del.cancel'] = "No - Annulla"; +$lang['testrun.session.closed'] = "Sessione di controllo terminata"; +$lang['testrun.fetch.error'] = "Errore lettura dati controllo"; +$lang['confirm.action'] = "Conferma Azione"; +$lang['id'] = "ID"; + +$lang['aa.name'] = "Nome Azione"; +$lang['aa.type'] = "Tipo Azione"; +$lang['aa.create'] = "Crea una nuova azione"; +$lang['aa.limit'] = "Limite Azione"; +$lang['aa.counter'] = "Contatore Azione"; +$lang['aa.efrom'] = "Email da"; +$lang['aa.esubj'] = "Oggetto Email"; +$lang['aa.mtype'] = "Tipo Messaggio"; +$lang['aa.eto'] = "Email o URL"; +$lang['aa.update'] = "Aggiorna Azione"; +$lang['aa.test'] = "Verifica Azione"; +$lang['aa.cancel'] = "Cancella Aggiornamento"; +$lang['aa.delete'] = "Elimina Azione"; +$lang['aa.testflush'] = "Azione verificata ed eseguita"; + +$lang['system.status'] = "Stato Sistema"; +$lang['status.size'] = "Dimensioni Tabella"; +$lang['status.tname'] = "Nome Tabella"; +$lang['status.tsize'] = "Dimensione (Righe)"; +$lang['status.tsize.kb'] = "Dimensione (Kb)"; +$lang['status.tother'] = "Altre Informazioni"; +$lang['status.free'] = "Libero"; +$lang['status.optimise'] = "Ottimizza"; + +$lang['notes'] = "Note"; + +$lang['status.running'] = "Sessioni di controllo Aperte/Attive"; +$lang['status.run.warn'] = "Attenzione: dati di oltre 15 minuti fa"; +$lang['status.run.error'] = "Errore: dati di ontre 1 ora fa"; + +$lang['status.env.http'] = "Ambiente: PHP Web (Apache Module/PHP-CGI)"; +$lang['status.env.cli'] = "Ambiente: PHP CLI (Command-Line Binary)"; + +$lang['status.disclaim'] = "Viene indicato lo stato del software FreeNATS,
non quello della macchina sulla quale viene eseguito.

Spazio su disco e prestazioni dell'eventuale sistema VM devono essere controllati
tramite gli appositi strumenti dedicati."; + +$lang['warnings'] = "Allarmi"; +//$lang['decreases'] = "L'azione viene eseguita quando il livello di errore ritorna allo stato chiuso (o allarme se impostato)"; +$lang['decreases'] = "Rientro da allerta"; +$lang['create'] = "Crea"; +$lang['version.info'] = "Informazioni Versione"; +$lang['release'] = "Release"; +$lang['compound'] = "Composto"; +$lang['reg.modules'] = "Moduli di controllo registrati"; +$lang['provides'] = "Ambito"; +$lang['revision'] = "Revisione"; +$lang['additional'] = "Informazioni aggiuntive"; +$lang['reg.events'] = "Gestori eventi registrati"; +$lang['event'] = "Evento"; +$lang['handlers'] = "Gestore/i"; +$lang['reg.languages'] = "Lingue registrate"; + +$lang['back.to.admin'] = "Ritorna a menu Impostazioni di Sistema"; +$lang['save.user.fail'] = "Registrazione utente fallita o nessun cambiamento"; +$lang['save.user.ok'] = "Utente salvato"; +$lang['create.user.fail'] = "Creazione utente fallita"; +$lang['create.user.ok'] = "Utente creato"; +$lang['delete.user'] = "Cancella utente"; +$lang['user.deleted'] = "Utente cancellato"; +$lang['save.var.ok'] = "Variabile salvata o cancellata"; +$lang['save.var.fail'] = "Aggiornamento variabile fallito"; +$lang['new.var.ok'] = "Variabile creata"; +$lang['new.var.fail'] = "Creazione nuova variabile fallita"; +$lang['optimised.ok'] = "Tabella ottimizzata"; +$lang['changes.ok'] = "Cambiamenti registrati"; +$lang['changes.fail'] = "Registrazione cambiamenti fallita o nessun cambiamento"; +$lang['delete.ok'] = "Cancellazione eseguita"; + +// System Event Log +$lang['filter'] = "Filtro"; +$lang['show'] = "Mostra"; +$lang['filter.log'] = "Applica filtro e mostra risultati"; +$lang['reset'] = "Azzera filtro"; +$lang['next'] = "Successivo"; +$lang['prev'] = "Precedente"; + +//Live Monitor +$lang['mon.options'] = "opzioni..."; +$lang['group.name'] = "Nome Gruppo"; +$lang['status'] = "Stato"; +$lang['node.name'] = "Nome nodo"; +$lang['mon.std'] = "standard"; +$lang['mon.grp'] = "gruppi"; +$lang['mon.nodes'] = "nodi"; +$lang['mon.alerting'] = "segnalazioni"; +$lang['mon.hide'] = "...nascondi..."; +$lang['mon.goto.node'] = "Vai al Nodo"; +$lang['mon.goto.node.page'] = "Vai alla pagina del Nodo"; +$lang['mon.popup.error'] = "Nodo non valido"; + +// Node Page +$lang['viewing.node'] = "Vista Nodo"; +$lang['no.node'] = "Nodo non trovato"; +$lang['alert'] = "Segnalazioni"; +$lang['yes'] = "Sì"; +$lang['no'] = "No"; +$lang['alert.history'] = "Storico Segnalazioni"; +$lang['summary'] = "Riepilogo"; +$lang['links'] = "Indirizzo collegamento"; +$lang['opened'] = "Aperto"; +$lang['edit.node.options'] = "Modifica opzioni nodo"; +$lang['nodeside.tests'] = "Controllo residente sul Nodo"; +$lang['local.tests'] = "Controllo locale"; +$lang['history'] = "Storico"; +$lang['no.test'] = "Nessun controllo definito"; +$lang['node.editor'] = "Configurazione Nodo"; +$lang['editing'] = "Modifica"; +$lang['node.settings'] = "Impostazioni nodo"; +$lang['show.hide.options'] = "Mostra / Nascondi Opzioni Nodo"; +$lang['node.tests'] = "Controlli Nodo"; +$lang['last.tested'] = "Ultimo Controllo"; +$lang['add.test'] = "Aggiungi Controllo"; +$lang['no.such.node'] = "Nodo non trovato"; +$lang['create.test'] = "Crea Controllo"; +$lang['update.alert.actions'] = "Aggiorna Segnalazioni"; +$lang['add'] = "Aggiungi"; +$lang['add.nodeside'] = "Aggiungi controllo remoto sul nodo"; +$lang['web.time'] = "Tempo Web"; +$lang['web.size'] = "Dati Web"; +$lang['host'] = "Verifica Host DNS"; +$lang['remote.ping'] = "Ping remoto"; +$lang['test.loop'] = "Ciclo test"; +$lang['test.random'] = "Test casuale"; +$lang['node.id'] = "ID Nodo"; +$lang['node.icon'] = "Icona Nodo"; +$lang['default'] = "Default"; +$lang['show.hide.icons'] = "Mostra / Nascondi Icone"; +$lang['master.node'] = "Nodo Master"; +$lang['no.master'] = "Nessun nodo Master"; +$lang['master.skip'] = "Salta se Master"; +$lang['fails.ping'] = "Errore su ping"; +$lang['fails.any.test'] = "Errore su qualsiasi controllo"; +$lang['node.enabled'] = "Nodo attivo"; +$lang['test.schedule'] = "Pianificazione controlli"; +$lang['test.interval'] = "Intervallo controlli"; +$lang['test.due'] = "Prossimo controllo"; +$lang['check.asap'] = "Controllo urgente"; +$lang['alerts.active'] = "Segnalazioni attive"; +$lang['ping.test'] = "Verifica Ping"; +$lang['require.ping'] = "Ping obbligatorio"; +$lang['nodeside.testing'] = "Controllo lato nodo"; +$lang['node.key'] = "Chiave Nodo"; +$lang['pull.enabled'] = "Attiva raccolta dati (pull)"; +$lang['pull.url'] = "Indirizzo pull"; +$lang['pull.interval'] = "Intervallo pull"; +$lang['push.enabled'] = "Attiva invio dati (push)"; +$lang['push.ip'] = "Indirizzo push"; +$lang['last.date'] = "Ultimi dati"; +$lang['next.pull.due'] = "Prossima raccolta (pull)"; +$lang['catalogue'] = "Serie"; +$lang['nodeside.monitors'] = "Controlli remoti"; +$lang['refresh.now'] = "Aggiorna adesso"; +$lang['nodeside.pull.now'] = "Esegui raccolta (pull) adesso"; +$lang['utility.links'] = "Collegamenti Servizi"; +$lang['title'] = "Titolo"; +$lang['url'] = "URL"; +$lang['debug.raw'] = "Debug dati output"; +$lang['last.data'] = "Ultimi dati"; +$lang['save.settings'] = "Salva configurazione"; +$lang['cancel'] = "Annulla"; +$lang['nodeside.pull.disabled'] = "Raccolta dati disabilitata"; +$lang['minutes'] = "Minuti"; +$lang['now'] = "Adesso"; +$lang['edit.options'] = "Modifica Opzioni"; +$lang['save.ok'] = "Cambiamenti registrati"; +$lang['save.failed'] = "Salvataggio fallito o nessun cambiamento"; +$lang['save.fail'] = $lang['save.failed']; +$lang['group.settings'] = "Impostazioni Gruppo"; +$lang['local.test.editor'] = "Modifica controllo locale"; +$lang['editing.test'] = "Modifica controllo"; +$lang['test.settings'] = "Impostazioni controllo"; +$lang['test.type'] = "Tipo controllo"; +$lang['test.options'] = "Opzioni controlli"; +$lang['full.url'] = "URL completo e prefisso (es.: http://www.nomehost.com/)"; +$lang['host.ip'] = "Host o IP"; +$lang['host.desc'] = "Nome dell'host o indirizzo Ip sul quale effettuare il ping (risoluzione DNS non pianificata)"; +$lang['value'] = "Valore"; +$lang['value.desc'] = "Valore per il ciclo di controlli o valore massimo per il controllo casuale"; +$lang['no.test.options'] = "Nessuna opzione per il controllo"; +$lang['custom.name'] = "Nome personalizzato"; +$lang['test.enabled'] = "Controllo attivo"; +$lang['recorded'] = "Registrazione"; +$lang['simple.eval'] = "Verifica semplice"; +$lang['custom.attempts'] = "Numero di tentativi"; +$lang['custom.timeout'] = "Timeout personalizzato"; +$lang['test.save'] = "Salva impostazioni controllo"; +$lang['abandon.changes'] = "Annulla modifiche"; +$lang['seconds'] = "Secondi"; +$lang['passed'] = "Attivo"; +$lang['untested'] = "Non verificato"; +$lang['warning'] = "Attenzione"; +$lang['failed'] = "Fallito"; +$lang['failure'] = "Errore"; +$lang['test.evals'] = "Sistemi personalizzati controllo"; +$lang['test.evals.simple'] = "I sistemi personalizzati di controllo non verranno classificati come Verifica semplice se attivati (vedi sopra)"; +$lang['add.eval'] = "Aggiungi nuovo"; +$lang['eval.equal'] = "Uguale a"; +$lang['eval.lt'] = "Minore di"; +$lang['eval.gt'] = "Maggiore di"; +$lang['eval.deleted'] = "Controllo eliminato"; +$lang['edit.nodeside.test'] = "Editor controllo lato nodo"; +$lang['ns.type'] = "Tipo controllo / UID"; +$lang['nodeside.test'] = "Controllo lato nodo"; +$lang['test.alerts'] = "Verifica Segnalazioni"; +$lang['last.checked'] = "Ultimo controllo"; +$lang['last.result'] = "Ultimo risultato"; +$lang['last.value'] = "Ultimo valore"; +$lang['save.changes'] = "Salva cambiamenti"; +$lang['result'] = "Risultato"; +$lang['edit.view'] = "Modifica Vista"; +$lang['editing.view'] = "Modifica Vista"; +$lang['no.such.view'] = "Vista non trovata"; +$lang['preview'] = "Anteprima"; +$lang['linking'] = "Indirizzo Collegamento"; +$lang['unknown.action'] = "Azione non definita"; +$lang['expand.view.options'] = "Espandi Opzioni Vista"; +$lang['node.ping'] = "Ping su nodo"; +$lang['host.ip.lookup'] = "Controllo Indirizzo IP"; +$lang['group.editor'] = "Modifica Gruppo"; +$lang['no.group'] = "Gruppo non trovato"; +$lang['group.id'] = "ID Gruppo"; +$lang['group.icon'] = "Icona Gruppo"; +$lang['group.save'] = "Salva configurazione gruppo"; +$lang['group.members'] = "Elementi del Gruppo"; +$lang['group.update'] = "Aggiorna elementi Gruppo"; +$lang['group.updated'] = "Composizione gruppo aggiornata"; +$lang['group'] = "Gruppo"; +$lang['show.icons'] = "Mostra Icone"; +$lang['dns.host'] = "Verifica DNS"; + +// Security Warnings +$lang['sec.firstrun'] = "Avviso di sicurezza: lo script firstrun.php è accessibile dall'esterno"; +$lang['sec.firstrun.text'] = "Lo script firstrun.php della directory web non è stato rinominato. Ciò può causare problemi di sicurezza a FreeNATS.
Si consiglia di rinominare lo script firstrun.php"; +$lang['sec.firstrun.ignore'] = "Per disabilitare la visualizzazione di questo avviso senza rinominare lo script (non consigliato), impostare l'opzione site.firstrun.ignore a 1"; + +// RSS +$lang['rss.feed'] = "Gestione Feed RSS"; +$lang['rss.feed.name'] = "Nome Feed"; +$lang['rss.feed.key'] = "Feed Key"; +$lang['rss.type'] = "Tipo di Feed"; +$lang['all.enabled.nodes'] = "Tutti i Nodi attivi"; +$lang['one.node'] = "Nodo Singolo"; +$lang['rss.range'] = "Intervallo RSS"; +$lang['last.x.days'] = "Ultimi X Giorni"; +$lang['last.x.alerts'] = "Ultime X Segnalazioni"; +$lang['current.alerts'] = "Segnalazioni attuali"; +$lang['last.alerts.node'] = "Ultima segnalazione per ciascun nodo"; +$lang['rss.feeds'] = "Feed RSS FreeNATS "; +$lang['feed.url'] = "URL Feed RSS"; +$lang['feed.create'] = "Crea nuovo Feed"; +$lang['no.feeds'] = "Nessun Feed RSS Configurato"; +$lang['open'] = "Aperto"; +$lang['closed'] = "Chiuso"; + + +$lang['nohelp'] = "Guida non disponibile"; +$lang['help.FREENATS'] = "FreeNATS è uno strumento di controllo delle reti"; +$lang['help.NODE'] = "Un nodo è un sistema o un dispositivo che si desidera controllare. Un nodo può raggruppare controlli che fanno riferimento a dispositivi fisici diversi e viceversa"; +$lang['help.NODE:CREATE'] = "Crea un nuovo {node} con questo {node:id|NodeID}"; +$lang['help.NODE:ID'] = "Il NodeID è un testo univoco per {node}. Massima lunghezza 60 caratteri, sono permessi solo caratteri normali."; +$lang['help.NODE:ENABLED'] = "Il nodo è attivato e utilizzato nei controlli (e presentato nelle viste, ove configurate)"; +$lang['help.NODE:ALERTACTIVE'] = "Gli allarmi verranno generati per questo nodo e le segnalazioni eseguite se selezionate"; +$lang['help.NODE:PINGTEST'] = "Effettua un controllo ping (ICMP) prima delle altre verifiche. Il risultato viene sempre registrato se l'opzione è attiva"; +$lang['help.NODE:REQUIREPING'] = "Impone il superamento del controllo ping, prima di effettuare le altre verifiche. Fallisce sempre se {Node:PingTest|ping test} è disabilitato"; +$lang['help.NODE:MASTER'] = "Nodo Master da controllare prima di questo"; +$lang['help.MASTERNODE:PING'] = "Il controllo deve essere superato su {Node:Master|master node} perché questo nodo venga controllato"; +$lang['help.NODE:TESTINTERVAL'] = "Intervallo (minuti) tra due esecuzioni del controllo su questo nodo"; +$lang['help.NODESIDE'] = "Attiva il supporto per script lato nodo per la raccolta dati da questo nodo"; +$lang['help.NODE:CHECKASAP'] = "Imposta il controllo di questo nodo nel prossimo ciclo di verifiche"; +$lang['help.UTILLINKS'] = "Collegamenti a servizi di amministrazione su nodo remoto"; +$lang['help.NODESIDE:KEY'] = "Chiave utilizzata per l'autenticazione nei controlli remoti"; +$lang['help.NODESIDE:PULLENABLED'] = "Attiva la raccolta di dati tramite 'http pull' dal nodo remoto"; +$lang['help.NODESIDE:URL'] = "URL per la raccolta dei dati 'pull' dal nodo remoto"; +$lang['help.NODESIDE:INTERVAL'] = "Intervallo per la comunicazione dei dati da/verso il nodo remoto"; +$lang['help.NODESIDE:PUSHENABLED'] = "Attiva l'invio dei dati ('push' tramite post) verso il nodo"; +$lang['help.NODESIDE:PUSHIP'] = "Limita per sicurezza l'invio dei dati 'push' a questo specifico indirizzo IP"; +$lang['help.GROUP'] = "Un gruppo è un insieme di uno o più nodi. Un nodo può appartenere a più di un gruppo. "; +$lang['help.GROUP:CREATE'] = "Crea un nuovo {group} con questo nome"; +$lang['help.TEST:NAME'] = "Nome personalizzato attribuito al controllo in visualizzazioni e report. Se vuoto, verrà utilizzato un nome definito automaticamente."; +$lang['help.TEST:ATTEMPTS'] = "Numero di volte che il controllo viene eseguito (sempre almeno una volta). Predefinito a 1 se uguale a zero o non impostato."; +$lang['help.TEST:TIMEOUT'] = "Valore di timeout per il controllo: modifica i valori di default o di sistema per i controlli corrispondenti (secondi)"; +$lang['help.TEST:SIMPLEEVALUATION'] = "Usa una valutazione semplice passato/fallito (per esempio, un controllo web che restituisca qualsiasi dato viene considerato passato, altrimenti fallito)."; +$lang['help.TEST:RECORDED'] = "Registra il risultato di questo controllo sullo storico."; +$lang['help.TEST:ENABLED'] = "Esegue/non esegue il controllo (nessuna registrazione se disabilitato)."; +$lang['help.TEST:INTERVAL'] = "Intervallo (minuti) tra due esecuzioni di questo controllo. La massima frequenza è quella a cui è impostato {Node:TestInterval|node interval}"; +$lang['help.TEST:TESTALERTS'] = "Il controllo genera un allarme in caso di fallimento"; +$lang['help.HISTORY:SHOULD'] = "Valore risultante dagli intervalli di rilevamento (cioè intervallo di controllo o intervallo di nodo) dall'inizio alla fine (o fino a questo momento)"; +$lang['help.VIEW'] = "Una vista è un insieme personalizzato di nodi/gruppi/controlli"; +$lang['help.VIEW:CREATE'] = "Crea una {view} con questo nome"; +$lang['help.VIEW:PUBLIC'] = "La vista è accessibile agli utenti senza effettuare l'accesso a FreeNATS"; +$lang['help.VIEW:COLONS'] = "Se per l'elemento di una vista è selezionata la modalità testo, viene mostrato il simbolo di due punti prima del valore"; +$lang['help.VIEW:DASHES'] = "Visualizza un trattino prima dell'orario di ultima esecuzione del controllo, ove applicabile"; +$lang['help.VIEW:TIMEAGO'] = "Utilizza XX:XX fa o il normale orario per i dati di dettaglio del controllo"; +$lang['help.VIEW:COLUMNS'] = "Visualizza gli elementi con questo numero di colonne (0 per disabilitare)"; +$lang['help.VIEW:REFRESH'] = "Invia una segnale http-equv per l'aggiornamento della pagina dopo questo intervallo in secondi (0 per disabilitare)"; +$lang['help.VIEW:USECOLOUR'] = "Utilizza i colori per la visualizzazione dello stato come nella visualizzazione standard di FreeNATS"; +$lang['help.VIEW:SHOWDETAIL'] = "Mostra i dettagli di controlli/oggetti, come i controlli dei nodi"; +$lang['help.VIEW:TEXTSTATUS'] = "Descrizione dello stato (passato, fallito, etc.)"; +$lang['help.REPORT'] = "Il report mostra la percentuale di disponibilità nel periodo specificato"; +$lang['help.BACKUP:TRUNCATE'] = "Azzera le tabelle prima del ripristino (consigliato) altrimenti la presenza di duplicati potrebbe causare errori"; +$lang['help.SCHEDULE'] = "Le pianificazioni definiscono quando i nodi vengono controllati; sono configurate nella pagina di amministrazione"; +$lang['help.SCHEDULE:DEFAULTACTION'] = "Azione standard se non si verificano eccezioni (l'opposto viene eseguito in caso di eccezioni)"; +$lang['help.ALERTACTION'] = "Una segnalazione viene attivata se fallisce un controllo su un nodo; sono configurati nella pagina di amministrazione"; +$lang['help.AACTION:WARNINGS'] = "L'azione è attivata sia per gli allarmi sia per gli errori (compreso il passaggio da errore ad allarme se {AAction:Decreases|decreases} è attivato"; +$lang['help.AACTION:DECREASES'] = "L'azione è attivata quando il livello passa dallo stato di errore a chiuso (o {AAction:Warnings|warnings} se impostato)"; +$lang['help.AACTION:LIMIT'] = "Numero massimo di volte che l'azione può essere ripetuta in un giorno (0 = illimitato) per evitare eccessi di segnalazioni"; +$lang['help.AACTION:COUNTER'] = "Numero di volte che l'azione è stata eseguita nel giorno indicato - è possibile azzerare manualmente questo valore"; +$lang['help.VARIABLE'] = "Le variabili di sistema sono usate per controllare le funzionalità dell'ambiente. Per cancellare una variabile è sufficiente attribuirle un nome vuoto ed effettuare il salvataggio."; +$lang['help.VAR:LOG.LEVEL'] = "Livello del registro eventi - 10 equivale a tutto, 0 registra solo gli errori fatali. I valori 5-6 sono le impostazioni consigliate."; +$lang['help.VAR:API.PUBLIC'] = "L'interfaccia API è accessibile agli utenti pubblici se il valore è impostato a 1 (si veda {Var:api.key|api.key})"; +$lang['help.VAR:API.KEY'] = "Chiave richiesta per gli utenti pubblici nell'utilizzo dell'API ({Var:api.public|api.public} deve essere definito)"; +$lang['help.VAR:ALERT.BODY.FOOTER'] = "Nota aggiunta in calce alle segnalazioni generate dal sistema"; +$lang['help.VAR:ALERT.BODY.HEADER'] = "Intestazione inserita nelle segnalazioni generate dal sistema"; +$lang['help.VAR:ALERT.SUBJECT.LONG'] = "Oggetto per le segnalazioni via Email in formato lungo"; +$lang['help.VAR:ALERT.SUBJECT.SHORT'] = "Oggetto per le segnalazioni via Email in formato breve"; +$lang['help.VAR:FREENATS.FIRSTRUN'] = "Variabile di sistema che indica il primo accesso a FreeNATS"; +$lang['help.VAR:SITE.ENABLE.TESTS'] = "Controlli attivi"; +$lang['help.VAR:SITE.ENABLE.WEB'] = "Interfaccia Web attiva"; +$lang['help.VAR:SITE.ENABLE.TESTER'] = "Attiva sistema di test"; +$lang['help.VAR:SITE.GRAPH.PUBLIC'] = "I grafici sono accessibili agli utenti pubblici nelle viste se impostato a 1 (si veda {Var:site.graph.key|site.graph.key})"; +$lang['help.VAR:SITE.GRAPH.KEY'] = "Chiave richiesta per gli utenti pubblici ({Var:site.graph.public|site.graph.public} deve essere attivo)"; +$lang['help.VAR:SITE.ENABLE.INTERACTIVE'] = "Deve essere attivo (1) per consentire sessioni web interattive (come questa)"; +$lang['help.VAR:SITE.POPUPMESSAGE'] = "Se attivo (1) verrà mostrato un messaggio di avviso durante i salvataggi"; +$lang['help.VAR:SITE.DTFORMAT'] = "Formato della data utilizzato nel sito (secondo lo standard PHP), per esempio Y-m-d H:i:s"; +$lang['help.VAR:SITE.TEXT.FAILED'] = "Testo da mostrare per lo stato di errore ([Failed] se non definito)"; +$lang['help.VAR:SITE.TEXT.PASSED'] = "Testo da mostrare per lo stato attivo ([Passed] se non definito)"; +$lang['help.VAR:SITE.TEXT.UNTESTED'] = "Testo da mostrare per gli elementi non verificati ([Untested] se non definito)"; +$lang['help.VAR:SITE.TEXT.WARNING'] = "Testo da mostrare per lo stato di allarme ([Warning] se non definito)"; +$lang['help.VAR:SITE.TEXT.CLOSED'] = "Testo da mostrare per lo stato di errore chiuso ([Closed] se non definito)"; +$lang['help.VAR:SITE.INCLUDE.EVENTS'] = "Includi file *.php nella directory server/site/events se 1"; +$lang['help.VAR:SITE.INCLUDE.TESTS'] = "Includi file *.php nella directory server/site/tests se 1"; +$lang['help.VAR:SITE.ENABLE.ADMINSQL'] = "Abilita la console di amministrazione SQL se 1"; +$lang['help.VAR:SITE.LINKS.NEWWINDOW'] = "Apre {UtilLinks|utility links} in una nuova finestra se 1"; +$lang['help.VAR:SITE.MONITOR.POPUPS'] = "Apre una finestra popup nel Monitor in Tempo Reale se 0"; +$lang['help.VAR:SITE.FIRSTRUN.IGNORE'] = "Ignora l'esistenza dello script firstrun.php (pericoloso)"; +$lang['help.VAR:SITE.AUTH'] = "Se impostato a to http usa HTTP-AUTH altrimenti usa il modulo di accesso normale"; +$lang['help.VAR:MAIL.FROMNAME'] = "Nome utilizzato come mittente nei messaggi di posta inviati tramite SMTP (default FreeNATS se non impostato)"; +$lang['help.VAR:MAIL.SMTPSERVER'] = "Server SMTP utilizzato per l'invio della posta (può essere una lista di elementi separati da ';'). Viene usato il sistema interno mail() se non impostato"; +$lang['help.VAR:MAIL.SMTPUSERNAME'] = "Nome utente per il servizio SMTP (vien usato protocollo con autenticazione solo se il nome viene indicato)"; +$lang['help.VAR:MAIL.SMTPPASSWORD'] = "Password per il servizio SMTP con autenticazione"; +$lang['help.VAR:MAIL.SMTPHOSTNAME'] = "Nome host per le transazioni SMTP (potrebbe essere richiesto da alcuni server di posta)"; +$lang['help.VAR:TEST.ICMP.TIMEOUT'] = "Intervallo di attesa in secondi per le richieste ICMP prima di restituire risultato negativo (default 10 secondi)"; +$lang['help.VAR:TEST.ICMP.TRYTWICE'] = "Obsoleto: sostituito con {Var:test.icmp.attempts|test.icmp.attempts}"; +$lang['help.VAR:TEST.ICMP.ATTEMPTS'] = "Numero di esecuzioni che il test ping principale effettua prima di restituire risultato negativo (default 2)"; +$lang['help.VAR:TEST.ICMP.RETURNMS'] = "Se impostato a (1), i risultati del test ping vengono forniti in millisecondi (ms) (default 0)"; +$lang['help.VAR:TEST.HTTP.TIMEOUT'] = "Timeout di default in secondi per gli stream HTTP utilizzati nelle verifiche web (utilizza valori di default se non definito o <1)"; +$lang['help.VAR:TEST.IMAP.TIMEOUT'] = "Timeout di default in secondi per i controlli IMAP (utilizza valori di default se non definito o 0)"; +$lang['help.VAR:TEST.SMTP.TIMEOUT'] = "Timeout di default in secondi per i controlli SMTP (impostato a 20 secondi se non definito o 0)"; +$lang['help.VAR:TEST.MYSQL.TIMEOUT'] = "Timeout di default in secondi per i controlli MySQL (utilizza valori di default se non definito o 0)"; +$lang['help.VAR:TEST.SPAWNDELAY'] = "Intervallo in secondi prima che i thread di controllo di un nodo vengano separati (nessun ritardo o se non definito o 0)"; +$lang['help.VAR:TEST.INTERVAL'] = "Intervallo in secondi tra due esecuzioni del controllo su un nodo (nessun ritardo se non definitio o 0); può una valore decimale"; +$lang['help.VAR:TEST.TCP.TIMEOUT'] = "Timeout di default in secondi per i controlli TCP (valore di sistema o 0 se non impostato)"; +$lang['help.VAR:TEST.UDP.TIMEOUT'] = "Timeout di default in secondi per i controlli UDP (valore di sistema o 0 se non impostato)"; +$lang['help.VAR:RETAIN.ALERT'] = "Giorni di conservazione dei dati di allerta (default 365 se 0 o non impostato). Conserva per sempre se -1."; +$lang['help.VAR:RETAIN.RECORD'] = "Giorni di conservazione dei dati utilizzati in storici e grafici (default 365 se 0 o non impostato). Conserva per sempre se -1."; +$lang['help.VAR:RETAIN.TESTRUN'] = "Giorni di conservazione dei dati di esecuzioni dei controlli (default 30 se 0 o non impostato). Conserva per sempre se -1."; +$lang['help.VAR:RETAIN.SYSLOG'] = "Giorni di conservazione dei dati del registro eventi (default 30 se 0 o non impostato). Conserva per sempre se -1."; +$lang['help.VAR:FREENATS.TRACKER'] = "Partecipa al sistema automatico di feedback: -1 sì con volume dati minimo, 2 sì dettagliato, 0 disabilitato (0 default)."; +$lang['help.VAR:FREENATS.TRACKER.USID'] = "Identificativo sito utilizzato da FreeNATS per registrazione anonima dei dati (solo se {Var:freenats.tracker|freenats.tracker} impostato a 1"; +?> diff --git a/src/server/base/lang/Russian.ru.lang.php b/src/server/base/lang/Russian.ru.lang.php new file mode 100755 index 0000000..04f618c --- /dev/null +++ b/src/server/base/lang/Russian.ru.lang.php @@ -0,0 +1,588 @@ +сайте программы. Рекомендуем регулярно это делать.
Ваша текущая версия"; +$lang['monitor.alerts']="События мониторинга"; +$lang['no.monitor.alerts']="Проишествий не было"; +$lang['check.updates']="Проверить обновления"; +$lang['monitoring']="Monitoring"; +$lang['nodes.configured']="Узлы"; +$lang['node.groups']="Группы узлов"; +$lang['common.tasks']="Общие задачи"; +$lang['add.nodes']="Все узлы"; +$lang['email.alerting']="Email оповещения"; +$lang['configure.tests']="Создать узел"; +$lang['test.summaries']="Отчёт за период:"; +$lang['monitored.nodes']="Список контроллируемых узлов:"; + +// nodes already +$lang['node']="Узел"; +$lang['options']="Настройки"; +$lang['move']="Переместить"; +$lang['edit']="Редактировать"; +$lang['delete']="Удалить"; +$lang['create.node']="Создать узел"; +$lang['config']="Настройки"; +$lang['move.before']="Двигать вверх"; +$lang['go']="Go"; +$lang['refresh.weight']="Refresh Weighting"; + +$lang['node.groups']="Группы узлов"; +$lang['create.group']="Создать группу"; + +$lang['views']="Графики"; +$lang['create.view']="Создать график"; +$lang['reports']="Доступные отчеты"; +$lang['create.report']="Создать новый отчёт"; + +$lang['config.summary']="Configuration Summary / Overview"; +$lang['nodeid']="ID узла"; +$lang['name']="Имя"; +$lang['hostname']="Днс имя или ип"; +$lang['schedule']="Schedule"; +$lang['enabled']="Включен"; +$lang['ping']="Ping"; +$lang['required']="Required"; +$lang['interval']="Интервал"; +$lang['nodeside']="Nodeside"; + +// Time Periods +$lang['today']="Сегодня"; +$lang['last.24h']="Последние 24 часа"; +$lang['custom']="Задать период"; +$lang['ago']="ago"; +$lang['never']="never"; + +// User Preferences +$lang['user.pref']="Настройки пользователя"; +$lang['change.password']="Изменить пароль"; +$lang['current']="Текущий"; +$lang['new']="Новый"; +$lang['confirm']="Подтверждение"; +$lang['pass.change.ok']="Пароль изменен"; +$lang['pass.change.fail']="Пароль не изменен"; + +// Administration Settings +$lang['admin.interface']="Административная панель"; +$lang['user.admin']="Пользователи"; +$lang['event.log']="Системные события"; +$lang['alert.actions']="Alert Actions"; +$lang['variables']="Системные переменные"; +$lang['sessions']="Test Sessions"; +$lang['schedules']="Test and Alert Schedules"; +$lang['file.manager']="Файл-менеджер"; +$lang['sql.console']="SQL Console"; +$lang['dns.console']="DNS Query Console"; +$lang['backup.restore']="Backup and Restore"; +$lang['sys.status']="System Status Report"; +$lang['sys.info']="Информация о системе"; + +$lang['tests.alerting']="Tests and Alerting"; +$lang['tools']="Инструменты"; +$lang['logs.info']="Logs and System Information"; + +$lang['ul.admin']="Администратор"; +$lang['ul.power']="Продвинутый пользователь"; +$lang['ul.normal']="Обычный пользователь"; +$lang['ul.disabled']="Отключен"; + +$lang['aae.short']="Короткий"; +$lang['aae.long']="Длинный"; + +$lang['unknown']="Неизвестно"; + +$lang['aae.sub.blank']="Пустой"; +$lang['aae.sub.short']="Короткий"; +$lang['aae.sub.long']="Длинный"; + +$lang['aatype.email']="Email"; +$lang['aatype.mqueue']="Message Queue"; +$lang['aatype.url']="URL"; +$lang['aatype.disabled']="Disabled"; + +$lang['real.name']="Настоящее имя"; +$lang['user.level']="Уровень доступа"; +$lang['create.user']="Создать"; + +$lang['save']="Сохранить"; + +$lang['sessions.for']="Node test sessions for"; +$lang['sessions.running']="Running Test Sessions"; +$lang['sessions.running.for']="Running Test Sessions for"; +$lang['sessions.not.running']="No running test sessions"; +$lang['sessions.previous']="Previous Test Sessions for"; +$lang['sessions.previous.none']="No Previous Test Sessions"; +$lang['sessions.stillrunning']="Still Running"; +$lang['started']="Запущено"; +$lang['finished']="Завершено"; +$lang['node.filter']="Фильтр"; +$lang['output']="Выаод"; +$lang['allnodes']="Все"; + +$lang['test.run']="Test Run"; +$lang['testrun.manual.close']="Manually Close Test Session"; +$lang['testrun.manual.close.detail']="Are you sure you want to do this? Only close sessions that you're sure aren't still running in the background.
This does not kill processes - just marks the test session as complete."; +$lang['testrun.del.yes']="Да - удалить"; +$lang['testrun.del.cancel']="Нет - отмена"; +$lang['testrun.session.closed']="Test Session Closed"; +$lang['testrun.fetch.error']="Error Fetching Testrun Data"; + +$lang['confirm.action']="Подтвердить"; + + +$lang['alert.actions']="Alert Actions"; +$lang['id']="ID"; +$lang['aa.name']="Action Name"; +$lang['aa.type']="Action Type"; +$lang['aa.create']="Create New Alert Action"; +$lang['aa.limit']="Action Limit"; +$lang['aa.counter']="Action Counter"; +$lang['aa.efrom']="От"; +$lang['aa.esubj']="Тема"; +$lang['aa.mtype']="Тип"; +$lang['aa.eto']="Email To or URL"; +$lang['aa.update']="Сохранить"; +$lang['aa.test']="Тестировать"; +$lang['aa.cancel']="Отменить"; +$lang['aa.delete']="Удалить"; +$lang['aa.testflush']="Alert Action Tested & Flushed"; + + +$lang['system.status']="Статус"; +$lang['status.size']="Table Sizes"; +$lang['status.tname']="Table Name"; +$lang['status.tsize']="Size (Rows)"; +$lang['status.tsize.kb']="Size (Kb)"; +$lang['status.tother']="Other Information"; +$lang['status.free']="Free"; +$lang['status.optimise']="Optimise"; + +$lang['notes']="Notes"; + +$lang['status.running']="Open/Running Test Sessions"; +$lang['status.run.warn']="Warning: Over 15 Minutes Old"; +$lang['status.run.error']="Error: Over 1 Hour Old"; + +$lang['status.env.http']="Environment: PHP Web (Apache Module/PHP-CGI)"; +$lang['status.env.cli']="Environment: PHP CLI (Command-Line Binary)"; + +$lang['status.disclaim']="Please note this merely displays FreeNATS software status - not
the status of the underlying Virtual Machine (if applicable).

You should monitor disk space and performance for the VM via
the relevant system (such as the rPath interface).

"; + +$lang['warnings']="Warnings"; +$lang['decreases']="Decreases"; +$lang['create']="Создать"; + +$lang['version.info']="Version Information"; +$lang['version']="Version"; +$lang['release']="Release"; +$lang['compound']="Compound"; + +$lang['reg.modules']="Registered Test Modules"; +$lang['provides']="Provides"; +$lang['revision']="Revision"; +$lang['additional']="Additional"; +$lang['reg.events']="Registered Event Handlers"; +$lang['event']="Event"; +$lang['handlers']="Handler(s)"; +$lang['reg.languages']="Registered Languages"; + +$lang['back.to.admin']="Back to Main System Settings Menu"; + +$lang['save.user.fail']="Save User Failed or Nothing Changed"; +$lang['save.user.ok']="User Saved"; +$lang['create.user.fail']="Failed to Create User"; +$lang['create.user.ok']="Пользователь создан"; +$lang['delete.user']="Удалить пользователя"; +$lang['user.deleted']="Пользователь удален"; +$lang['save.var.ok']="Updated or Deleted Variable"; +$lang['save.var.fail']="Failed to Update Variable"; +$lang['new.var.ok']="Created Variable"; +$lang['new.var.fail']="Failed to Create Variable"; +$lang['optimised.ok']="Optimised Table"; + +$lang['changes.ok']="Изменения сохранены"; +$lang['changes.fail']="Failed to Save Changes or Nothing Changed"; + +// System Event Log +$lang['filter']="Фильтр"; +$lang['show']="Показать"; +$lang['filter.log']="Filter Log Entries and Display"; +$lang['reset']="Сбросить"; +$lang['next']="Следующий"; +$lang['prev']="Предыдущий"; + + +// Live Monitor +$lang['live.monitor']="Live Monitor"; +$lang['mon.options']="настройки..."; +$lang['group.name']="Имя группы"; +$lang['description']="Описание"; +$lang['status']="Статус"; +$lang['node.name']="Имя узла"; +$lang['mon.std']="по умолчанию"; +$lang['mon.grp']="группы"; +$lang['mon.nodes']="узлы"; +$lang['mon.alerting']="тревоги"; +$lang['mon.hide']="...скрыть..."; +$lang['mon.goto.node']="перейти"; +$lang['mon.goto.node.page']="перейти на страницу узла"; +$lang['mon.popup.error']="Invalid or Illegal Node"; + +// Node Page +$lang['viewing.node']="Просмотр узла"; +$lang['no.node']="Узла не существует"; +$lang['enabled']="Включен"; +$lang['alert']="Тревога"; +$lang['yes']="Да"; +$lang['no']="Нет"; +$lang['alert.history']="История тревог"; +$lang['summary']="Действия"; +$lang['links']="Ссылки"; +$lang['opened']="Открыто"; +$lang['edit.node.options']="Настройки узла"; +$lang['nodeside.tests']="Тесты на стороне узла"; + +$lang['local.tests']="Локальные тесты"; +$lang['history']="История"; + + +// Edit Node Options +$lang['node.editor']="Редактировать"; +$lang['editing']="Редактирование"; +$lang['node.settings']="настройки узла"; +$lang['show.hide.options']="Показать / Скрыть настройки"; +$lang['node.tests']="Тесты"; +$lang['last.tested']="Последний раз тестировалось"; +$lang['add.test']="Добавить тест"; +$lang['no.such.node']="Узел не существует"; +$lang['create.test']="Создать тест"; +$lang['update.alert.actions']="ОБновить действия по тревоге"; +$lang['add']="Добавить"; + +$lang['add.nodeside']="Добавить слежение со стороны узла"; + +$lang['web.time']="Web Time"; +$lang['web.size']="Web Size"; +$lang['host']="Simple DNS Host"; +$lang['remote.ping']="Remote Ping"; +$lang['test.loop']="Test Loop"; +$lang['test.random']="Test Random"; + +$lang['node.id']="Node ID"; +$lang['node.icon']="Node Icon"; +$lang['default']="Default"; +$lang['show.hide.icons']="Show/Hide Icons"; +$lang['master.node']="Master Node"; +$lang['no.master']="No Master Node"; +$lang['master.skip']="Skip if Master"; +$lang['fails.ping']="Fails Ping"; +$lang['fails.any.test']="Fails Any Test"; +$lang['node.enabled']="Node Enabled"; +$lang['test.schedule']="Test Schedule"; +$lang['test.interval']="Test Interval"; +$lang['test.due']="Test Due"; +$lang['check.asap']="Check ASAP"; +$lang['alerts.active']="Alerts Active"; +$lang['ping.test']="Ping Test"; +$lang['require.ping']="Require Ping"; +$lang['nodeside.testing']="Nodeside Testing"; +$lang['node.key']="Node Key"; +$lang['pull.enabled']="Pull Enabled"; +$lang['pull.url']="Pull URL"; +$lang['pull.interval']="Pull Interval"; +$lang['push.enabled']="Push Enabled"; +$lang['push.ip']="Push IP"; +$lang['last.date']="Last Data"; +$lang['next.pull.due']="Next Pull Due"; +$lang['catalogue']="Catalogue"; +$lang['nodeside.monitors']="Nodeside Monitors"; +$lang['refresh.now']="Обновить"; +$lang['nodeside.pull.now']="Refresh (Pull) Now"; +$lang['utility.links']="Utility Links"; +$lang['title']="Title"; +$lang['url']="URL"; +$lang['debug.raw']="Debug Raw Output"; +$lang['last.data']="Last Data"; +$lang['save.settings']="Сохранить"; +$lang['cancel']="Отменить"; + +$lang['minutes']="Минуты"; +$lang['now']="Сейчас"; +$lang['edit.options']="Редактировать"; + +$lang['save.ok']="Изменения сохранены"; +$lang['save.failed']="Изменения не сохранены"; + +// Test Editing +$lang['local.test.editor']="Local Test Editor"; +$lang['editing.test']="Редактировать"; +$lang['test.settings']="Настройки"; +$lang['test.type']="Тип"; +$lang['test.options']="Настройки"; + +$lang['full.url']="Full URL including prefix e.g. http://www.somehost.com/"; +$lang['host.ip']="Имя или IP"; +$lang['host.desc']="Имя или IP для пинга (DNS resolution not timed)"; +$lang['value']="Значение"; +$lang['value.desc']="Value for Test Loop or Max Value for Test Random"; +$lang['host']="Имя"; +$lang['host.desc']="Hostname to resolve or IP address to do reverse lookup of"; + +$lang['no.test.options']="No Options for Test"; + +$lang['custom.name']="Custom Name"; +$lang['test.enabled']="Test Enabled"; +$lang['recorded']="Recorded"; +$lang['simple.eval']="Simple Evaluation"; +$lang['test.interval']="Test Interval"; +$lang['test.due']="Test Due"; +$lang['last.tested']="Last Tested"; + +$lang['custom.attempts']="Custom Attempts"; +$lang['custom.timeout']="Custom Timeout"; + +$lang['test.save']="Save Test Settings"; +$lang['abandon.changes']="Abandon Changes"; + +$lang['seconds']="Seconds"; + +$lang['passed']="Passed"; +$lang['untested']="Untested"; +$lang['warning']="Warning"; +$lang['failed']="Failed"; +$lang['failure']="Failure"; + +$lang['test.evals']="Custom Test Evaluators"; +$lang['test.evals.simple']="Custom evaluators will not be parsed as Simple Evaluation is checked (above)"; +$lang['add.eval']="Add New"; +$lang['eval.equal']="Equal To"; +$lang['eval.lt']="Less Than"; +$lang['eval.gt']="Greater Than"; + +$lang['edit.nodeside.test']="Nodeside Test Editor"; +$lang['ns.type']="Test Type / UID"; +$lang['nodeside.test']="Nodeside Test"; +$lang['test.alerts']="Test Alerts"; +$lang['last.checked']="Last Checked"; +$lang['last.result']="Last Result"; +$lang['last.value']="Last Value"; +$lang['save.changes']="Save Changes"; + +$lang['result']="Result"; + +$lang['edit.view']="Edit View"; +$lang['editing.view']="Editing View"; +$lang['no.such.view']="No Such View"; +$lang['preview']="Preview"; +$lang['linking']="Linking"; +$lang['unknown.action']="Unknown Action"; +$lang['expand.view.options']="Expand View Options"; + +$lang['node.ping']="Node Ping"; + +// Group Editor +$lang['group.editor']="Редактор групп"; +$lang['no.group']="Группа не найдена"; +$lang['group.id']="ID группы"; +$lang['group.name']="Имя группы"; +$lang['group.icon']="Иконка группы"; +$lang['group.save']="Сохранить"; +$lang['group.members']="Члены группы"; +$lang['group.update']="Сохранить"; +$lang['group.updated']="Сохранено"; +$lang['group']="Группа"; +$lang['editing']="Редактировать"; + +$lang['show.icons']="Показать все иконки"; + +$lang['dns.host']="DNS Host Lookup"; + +// Security Warnings +$lang['sec.firstrun']="Security Warning: firstrun.php Script is Exposed"; +$lang['sec.firstrun.text']="The firstrun.php script in your web directory has not been renamed. This could be used to damage FreeNATS.
Please rename to firstrun-.php."; +$lang['sec.firstrun.ignore']="To stop this warning from being shown without renaming the script (not recommended) set site.firstrun.ignore to 1"; + +// RSS +$lang['rss.feed']="RSS Feed Management"; +$lang['rss.feed.name']="Feed Name"; +$lang['rss.feed.key']="Feed Key"; +$lang['rss.type']="Type of Feed"; +$lang['all.enabled.nodes']="All Enabled Nodes"; +$lang['one.node']="Single Node"; +$lang['rss.range']="Range/Scope of Feed"; +$lang['last.x.days']="Last X Days"; +$lang['last.x.alerts']="Last X Alerts"; +$lang['current.alerts']="Current Alerts"; +$lang['last.alerts.node']="Last Alert for Each Node"; +$lang['rss.feeds']="FreeNATS RSS Feeds"; +$lang['feed.url']="RSS Feed URL"; +$lang['feed.create']="Create New Feed"; +$lang['no.feeds']="No RSS Feeds Configured"; +$lang['open']="Open"; +$lang['closed']="Closed"; + +// Help - Text support NATS_Help format strings i.e. {link} and {link|text} links +$lang['nohelp'] = "Sorry no help is available"; +$lang['help.FREENATS'] = "FreeNATS is a network monitoring package"; +$lang['help.NODE'] = "A node is a system or device which you are monitoring. Note that nodes can have tests pointing to different physical devices and vice-versa"; +$lang['help.NODE:CREATE'] = "Create a new {node} with this {node:id|NodeID}"; +$lang['help.NODE:ID'] = "The NodeID is a unique text name for a {node}. Maximum length 60 chars and only normal characters allowed."; +$lang['help.NODE:ENABLED'] = "The node is enabled for tests to be performed (and displayed in all applicable views)"; +$lang['help.NODE:ALERTACTIVE'] = "Alerts will be generated for this node and alert actions performed if selected"; +$lang['help.NODE:PINGTEST'] = "Do a ping (ICMP) test first before other tests - will always record results if enabled"; +$lang['help.NODE:REQUIREPING'] = "Require the ping to pass for other tests to even be tried - will always fail if {Node:PingTest|ping test} is disabled"; +$lang['help.NODE:MASTER'] = "Master Node to be Tested First"; +$lang['help.MASTERNODE:PING'] = "Tests required to pass on the {Node:Master|master node} for this node to be tested"; +$lang['help.NODE:TESTINTERVAL'] = "Interval (minutes) between tests on this node being carried out"; +$lang['help.NODESIDE'] = "Enable support for node-side scripts to gather data from this node"; +$lang['help.NODE:CHECKASAP'] = "Schedule node for immediate text in next test cycle"; +$lang['help.UTILLINKS'] = "Links to services on remote note for system administration"; +$lang['help.NODESIDE:KEY'] = "Key used to authenticate nodeside testing"; +$lang['help.NODESIDE:PULLENABLED'] = "Enable nodeside collection via http 'pull' from the node"; +$lang['help.NODESIDE:URL'] = "URL to 'pull' nodeside data from on the node"; +$lang['help.NODESIDE:INTERVAL'] = "Interval between 'pulling' (polling) data from the node"; +$lang['help.NODESIDE:PUSHENABLED'] = "Allow node to 'push' (post) data"; +$lang['help.NODESIDE:PUSHIP'] = "Limit node 'push' to this specific IP address for security"; +$lang['help.GROUP'] = "A group is a collection of one or more {node|nodes}. Note that nodes can be members of more than one group."; +$lang['help.GROUP:CREATE'] = "Create a new {group} with this name"; +$lang['help.TEST:NAME'] = "A custom name can be assigned to the test for use in displays and alerts. If blank an automated name will be generated."; +$lang['help.TEST:ATTEMPTS'] = "Number of times to attempt a test (will always try once). Defaults to 1 if zero or unset."; +$lang['help.TEST:TIMEOUT'] = "Timeout value for the test - alters the defaults or system-wide variable settings for the relevant test (seconds)"; +$lang['help.TEST:SIMPLEEVALUATION'] = "Use simple pass/fail evaluation (i.e. if a web test returns any data it passes else it fails)"; +$lang['help.TEST:RECORDED'] = "Record the results of this test for historic reports"; +$lang['help.TEST:ENABLED'] = "Perform the test or not (will update nothing if disabled)"; +$lang['help.TEST:INTERVAL'] = "Interval (minutes) between this test being performed. Will only ever be tested as quickly as the {Node:TestInterval|node interval} is set to"; +$lang['help.TEST:TESTALERTS'] = "Test will generate an alert on failure"; +$lang['help.HISTORY:SHOULD'] = "A rough calculation based on configured polling times (i.e. test interval or node interval) from the start to finish (or now if sooner)"; +$lang['help.VIEW'] = "A view is a custom set of nodes/groups/tests which can be used in a variety of ways"; +$lang['help.VIEW:CREATE'] = "Creates a {view} of the specified name"; +$lang['help.VIEW:PUBLIC'] = "The view can be seen by people not logged into FreeNATS"; +$lang['help.VIEW:COLONS'] = "If text status is selected for a view item a colon will be displayed before it"; +$lang['help.VIEW:DASHES'] = "Display a dash before a test last run time where applicable"; +$lang['help.VIEW:TIMEAGO'] = "Use XX:XX ago or normal datetime for test details"; +$lang['help.VIEW:COLUMNS'] = "Display list-type elements in this number of columns (0 for off)"; +$lang['help.VIEW:REFRESH'] = "Send a http-equv to refresh the page after this many seconds (0 for off)"; +$lang['help.VIEW:USECOLOUR'] = "Use colour for status display as in normal FreeNATS display"; +$lang['help.VIEW:SHOWDETAIL'] = "Show details of the test/object(s) such as node tests"; +$lang['help.VIEW:TEXTSTATUS'] = "Textual status such as passed, failed etc"; +$lang['help.REPORT'] = "Reports show the %age of service availability in a specified period"; +$lang['help.BACKUP:TRUNCATE'] = "Clears tables first when restored back (recommended) otherwise duplicates may fail"; +$lang['help.SCHEDULE'] = "A schedule controls what times a node is tested and are managed through the admin page"; +$lang['help.SCHEDULE:DEFAULTACTION'] = "What will happen if no exceptions are matched (the opposite will happen if one is matched)"; +$lang['help.ALERTACTION'] = "An alert action is performed when a node fails a test, they are configured through the admin page"; +$lang['help.AACTION:WARNINGS'] = "The action is triggered for warning level events as well as failures (including downgrading from failure to warning if {AAction:Decreases|decreases} is set)"; +$lang['help.AACTION:DECREASES'] = "The action is triggered when the level goes down to closed (or {AAction:Warnings|warnings} if set)"; +$lang['help.AACTION:LIMIT'] = "Max times this action can run in any one day (0 = unlimited) to avoid flooding"; +$lang['help.AACTION:COUNTER'] = "Number of times this action has run in the day shown - you can manually reset this here"; +$lang['help.VARIABLE'] = "System variables are used to control the system environment. To delete a variable just save it with a blank name."; +$lang['help.VAR:LOG.LEVEL'] = "The system log level - 10 is everything, 0 is fatal only. 5-6-ish is probably a good balance."; +$lang['help.VAR:API.PUBLIC'] = "The API interface is available to public users if 1 (also see {Var:api.key|api.key})"; +$lang['help.VAR:API.KEY'] = "Require this key from public users as apikey when accessing the API ({Var:api.public|api.public} must be set)"; +$lang['help.VAR:ALERT.BODY.FOOTER'] = "Footer to go at the end of system generated alerts"; +$lang['help.VAR:ALERT.BODY.HEADER'] = "Header to go at the start of system generated alerts"; +$lang['help.VAR:ALERT.SUBJECT.LONG'] = "Subject for email alerts of long format"; +$lang['help.VAR:ALERT.SUBJECT.SHORT'] = "Subject for email alerts of short format"; +$lang['help.VAR:FREENATS.FIRSTRUN'] = "System variable to indicate first use of FreeNATS"; +$lang['help.VAR:SITE.ENABLE.TESTS'] = "Enable testing"; +$lang['help.VAR:SITE.ENABLE.WEB'] = "Enable web interface"; +$lang['help.VAR:SITE.ENABLE.TESTER'] = "Enable Tester to Run"; +$lang['help.VAR:SITE.GRAPH.PUBLIC'] = "Graphs are available to public users for views etc if 1 (also see {Var:site.graph.key|site.graph.key})"; +$lang['help.VAR:SITE.GRAPH.KEY'] = "Require this key from public users as graphkey ({Var:site.graph.public|site.graph.public} must be set)"; +$lang['help.VAR:SITE.ENABLE.INTERACTIVE'] = "Must be set (1) to allow interactive web sessions (like this one)"; +$lang['help.VAR:SITE.POPUPMESSAGE'] = "If set (1) will show a popup message when saving changes etc"; +$lang['help.VAR:SITE.DTFORMAT'] = "Site-wide custom date time format (in PHP format) i.e. Y-m-d H:i:s"; +$lang['help.VAR:SITE.TEXT.FAILED'] = "Text to show for a failed status (defaults to Failed if unset)"; +$lang['help.VAR:SITE.TEXT.PASSED'] = "Text to show for a passed status (defaults to Passed if unset)"; +$lang['help.VAR:SITE.TEXT.UNTESTED'] = "Text to show for untested items (defaults to Untested if unset)"; +$lang['help.VAR:SITE.TEXT.WARNING'] = "Text to show for a warning status (defaults to Warning if unset)"; +$lang['help.VAR:SITE.TEXT.CLOSED'] = "Text to indicate alert closed (defaults to Alert Closed if unset)"; +$lang['help.VAR:SITE.INCLUDE.EVENTS'] = "Include *.php in the server/site/events directory if 1"; +$lang['help.VAR:SITE.INCLUDE.TESTS'] = "Include *.php in the server/site/tests directory if 1"; +$lang['help.VAR:SITE.ENABLE.ADMINSQL'] = "Enables the admin SQL console if 1"; +$lang['help.VAR:SITE.LINKS.NEWWINDOW'] = "Opens {UtilLinks|utility links} in new window if 1"; +$lang['help.VAR:SITE.MONITOR.POPUPS'] = "Opens a popup status window in live monitor unless set to 0"; +$lang['help.VAR:SITE.FIRSTRUN.IGNORE'] = "Ignores the existance of the firstrun.php script (dangerous)"; +$lang['help.VAR:SITE.AUTH'] = "If set to http will use HTTP-AUTH otherwises uses standard login form"; +$lang['help.VAR:MAIL.FROMNAME'] = "Textual from name to be used in SMTP mail (defaults to FreeNATS if unset)"; +$lang['help.VAR:MAIL.SMTPSERVER'] = "SMTP server to relay mail through (can be ; seperated list) uses internal mail() if unset or blank"; +$lang['help.VAR:MAIL.SMTPUSERNAME'] = "Username for SMTP AUTH (AUTH only used if username is set or provided)"; +$lang['help.VAR:MAIL.SMTPPASSWORD'] = "Password for SMTP AUTH"; +$lang['help.VAR:MAIL.SMTPHOSTNAME'] = "Hostname for HELO in SMTP transactions (may be required for strict mail servers)"; +$lang['help.VAR:TEST.ICMP.TIMEOUT'] = "Timeout in seconds to wait for an ICMP response before declaring a failure in seconds (default 10)"; +$lang['help.VAR:TEST.ICMP.TRYTWICE'] = "Depreciated - replaced with {Var:test.icmp.attempts|test.icmp.attempts}"; +$lang['help.VAR:TEST.ICMP.ATTEMPTS'] = "Number of times the main "require ping" test will attempt before failing (default 2)"; +$lang['help.VAR:TEST.ICMP.RETURNMS'] = "If set (1) returns ping results in MilliSeconds (ms) (default 0)"; +$lang['help.VAR:TEST.HTTP.TIMEOUT'] = "Default timeout for HTTP/s streams used in web tests (uses system default if unset or <1)"; +$lang['help.VAR:TEST.IMAP.TIMEOUT'] = "Default timeout for IMAP tests in seconds (uses environment default if unset or 0)"; +$lang['help.VAR:TEST.SMTP.TIMEOUT'] = "Default timeout for SMTP tests in seconds (uses 20 seconds if 0 or unset)"; +$lang['help.VAR:TEST.MYSQL.TIMEOUT'] = "Default timeout for MySQL tests in seconds (uses environmental default if unset or 0)"; +$lang['help.VAR:TEST.SPAWNDELAY'] = "Delay in seconds between node test threads being spawned by test-threaded.sh (no delay if 0 or unset), can be a decimal"; +$lang['help.VAR:TEST.INTERVAL'] = "Delay in seconds between tests on a node (no delay if 0 or unset), can be a decimal"; +$lang['help.VAR:TEST.TCP.TIMEOUT'] = "Default timeout for TCP tests (system default if 0 or unset) (seconds)"; +$lang['help.VAR:TEST.UDP.TIMEOUT'] = "Default timeout for UDP tests (system default if 0 or unset) (seconds)"; +$lang['help.VAR:RETAIN.ALERT'] = "Days to retain alert records for (default 356 if 0 or unset). Retain forever with value -1."; +$lang['help.VAR:RETAIN.RECORD'] = "Days to retain test result records for use in history and graphs (default 356 if 0 or unsert). Retain forever with value -1."; +$lang['help.VAR:RETAIN.TESTRUN'] = "Days to retain test run records for (default 30 if 0 or unset). Retain forever with value -1."; +$lang['help.VAR:RETAIN.SYSLOG'] = "Days to retain log entries for (default 30 if 0 or unset). Retain forever with value -1."; +$lang['help.VAR:FREENATS.TRACKER'] = "Participate in the automated feedback process - 1 for yes low level, 2 for detailed, 0 for disabled (default 0)"; +$lang['help.VAR:FREENATS.TRACKER.USID'] = "Unique Site ID for FreeNATS tracker to anonymise data capture (only if {Var:freenats.tracker|freenats.tracker} set to 1"; + + +?> diff --git a/src/server/base/nats.cfg.inc.php b/src/server/base/nats.cfg.inc.php new file mode 100755 index 0000000..b32fe90 --- /dev/null +++ b/src/server/base/nats.cfg.inc.php @@ -0,0 +1,70 @@ +Query($q); + while ($row=$nats_db->Fetch_Array($r)) + { + $this->data[$row['fnc_var']]=$row['fnc_val']; + //echo $row['fnc_var']."=".$row['fnc_val']."\n
"; + } + $nats_db->Free($r); + } + + function Get($var,$def="") + { + if (isset($this->data[$var])) return $this->data[$var]; + return $def; + } + + function DumpToScreen() + { + $keys=array_keys($this->data); + foreach($keys as $key) + { + echo $key."=".$this->data[$key]."
\n"; + } + } + function Set($var,$val,$perm=true) + { + $this->data[$var]=$val; + if ($perm) + { + global $NATS; + $q="UPDATE fnconfig SET fnc_val=\"".ss($val)."\" WHERE fnc_var=\"".ss($var)."\""; + $NATS->DB->Query($q); + if ($NATS->DB->Affected_Rows()<=0) // not already existing + { + $q="INSERT INTO fnconfig(fnc_var,fnc_val) VALUES(\"".ss($var)."\",\"".ss($val)."\")"; + mysql_query($q); + } + } + } + } \ No newline at end of file diff --git a/src/server/base/nats.db.inc.php b/src/server/base/nats.db.inc.php new file mode 100755 index 0000000..faff03c --- /dev/null +++ b/src/server/base/nats.db.inc.php @@ -0,0 +1,126 @@ +sql=mysql_connect($fnCfg['db.server'],$fnCfg['db.username'],$fnCfg['db.password']) + or die("Cannot connect to MySQL server"); + mysql_select_db($fnCfg['db.database']) + or die("Cannot select MySQL database"); + $this->connected=true; + return $this->sql; + } + + function Disconnect() + { + mysql_close($this->sql); + $this->sql=0; + $this->connected=false; + } + + function Query($query,$debugerror=true) + { + global $NATS; + if (!$this->connected) return -1; + $result=mysql_query($query,$this->sql); + if ($debugerror) + { + // persist the last error state + $this->LastError=mysql_errno($this->sql); + if ($this->LastError>0) + { + $this->ErrorString=mysql_error($this->sql)." (".mysql_errno($this->sql).")"; + } + else $this->ErrorString=""; + } + + if (mysql_errno($this->sql)>0) + { + $err=mysql_error($this->sql)." (".mysql_errno($this->sql).")"; + if (isset($NATS)&&$debugerror) + { + $NATS->Event("Query Failed: ".$query,2,"DB","Query"); + $NATS->Event("Query Error: ".$err,2,"DB","Query"); + } + } + return $result; + } + + function Free(&$result) + { + mysql_free_result($result); + } + + function Fetch_Array(&$result) + { + return mysql_fetch_array($result); + } + + function Affected_Rows() + { + return mysql_affected_rows($this->sql); + } + + function Insert_Id() + { + return mysql_insert_id($this->sql); + } + + function Num_Rows(&$result) + { + return mysql_num_rows($result); + } + + function Error() + { + //if (mysql_errno($this->sql)==0) return false; + //return true; + if ($this->LastError==0) return false; + return true; + } + + function Error_Number() + { + //return mysql_errno($this->sql); + return $this->LastError; + } + + function Error_String() + { + return $this->ErrorString; + //return mysql_error($this->sql)." (".$this->Error_Number().")"; + } + } \ No newline at end of file diff --git a/src/server/base/nats.lang.inc.php b/src/server/base/nats.lang.inc.php new file mode 100755 index 0000000..d91ae30 --- /dev/null +++ b/src/server/base/nats.lang.inc.php @@ -0,0 +1,86 @@ +languages) ) + { + $pathlen=strlen($BaseDir."lang/"); + $this->languages=array(); + foreach(glob($BaseDir."lang/*.lang.php") as $langfile) + { + $langfile=substr($langfile,$pathlen); + $parts=explode(".",$langfile); + if (count($parts)==4) // valid language format Language.code.lang.php + { + $this->languages[$parts[1]]=$parts[0]; + } + } + } +return $this->languages; +} + +function Load($language="") +{ +global $BaseDir,$NATS; +$this->GetLanguages(); +if ($language == "") $language=$this->baselanguage; +if ($language != $this->baselanguage) $this->Load($this->baselanguage); +if (!is_array($this->items)) $this->items=array(); + +if ( isset($this->languages[$language]) ) + { + $file=$BaseDir."lang/".$this->languages[$language].".".$language.".lang.php"; + if (file_exists($file)) + { + $lang=array(); + include_once($file); + $this->items = array_merge($this->items, $lang); + } + else $NATS->Event("Language file ".$file." not found",5,"Language","Load"); + } +else $NATS->Event("Illegal Language ".$language,5,"Language","Load"); +} + +function Item($item) +{ +global $NATS; +//return "{".$item."}"; +if (isset($this->items[$item])) return $this->items[$item]; +else + { + $NATS->PageError("missing lang.element {ULE}",$item); + return "ULE{".$item."}"; + } +} + +} + +?> \ No newline at end of file diff --git a/src/server/base/nats.php b/src/server/base/nats.php new file mode 100755 index 0000000..03e2b31 --- /dev/null +++ b/src/server/base/nats.php @@ -0,0 +1,69 @@ +Start(); + +// Session Management +require($BaseDir."session.inc.php"); +$NATS_Session=new TNATS_Session(); + + + + + +// Screen and Stuff +require($BaseDir."screen.inc.php"); +require($BaseDir."testtext.inc.php"); +require($BaseDir."view.inc.php"); +?> \ No newline at end of file diff --git a/src/server/base/nats.tests.inc.php b/src/server/base/nats.tests.inc.php new file mode 100755 index 0000000..483a8e1 --- /dev/null +++ b/src/server/base/nats.tests.inc.php @@ -0,0 +1,105 @@ +type=$type; + $this->class=$class; + if ($name=="") $this->name=$type; + else $this->name=$name; + $this->revision=$revision; + $this->additional=$additional; + if ($parameters===false) $this->parameters=array(); + else $this->parameters=$parameters; + } + +function Create() + { + if ($this->instance===false) // doesn't exist + { + $this->instance=new $this->class(); + } + return $this->instance; + } +} + +class TNATS_Tests +{ +var $count=0; +var $Tests=array(); +var $QuickList=array(); // quick list to save doing it dynamically each time +var $UnitList=array(); // Unit list for easy reference + +function Register($type,$class,$parameters=false,$name="",$revision=0,$additional="") + { + if ($name=="") $name=$type; + $this->Tests[$type]=new TNATS_Test($type,$class,$parameters,$name,$revision,$additional); + $this->QuickList[$type]=$name; + $this->count++; + } + +function Get($type) + { + if (isset($this->Tests[$type])) return $this->Tests[$type]; + return -1; + } + +function QuickList() + { + return $this->QuickList; + } + +function Exists($type) + { + if (isset($this->Tests[$type])) return true; + return false; + } + +function SetUnits($type,$long,$short="") + { + if (!isset($this->UnitList[$type])) + $this->UnitList[$type]=array(); + + $this->UnitList[$type]['long']=$long; + $this->UnitList[$type]['short']=$short; + } + +function Units($type,$long=true) + { + if (!isset($this->UnitList[$type])) return ""; + if ($long) return $this->UnitList[$type]['long']; + else return $this->UnitList[$type]['short']; + } + + +} +?> \ No newline at end of file diff --git a/src/server/base/node.xml.inc.php b/src/server/base/node.xml.inc.php new file mode 100755 index 0000000..8b10363 --- /dev/null +++ b/src/server/base/node.xml.inc.php @@ -0,0 +1,167 @@ +debug_log) + $NATS->Event("Start Element: ".$name,10,"NodeXML","StartE"); +if ($name=="FREENATS-DATA") + { + $this->in_freenats=true; + if ($this->debug_log) + $NATS->Event("in_freenats set to true",10,"NodeXML","StartE"); + } +if (!$this->in_freenats) return 0; + +if ($this->debug_log) + $NATS->Event("startE passed in_freenats true",10,"NodeXML","StartE"); + +if ($name=="TEST") + { + $this->in_test=true; + $this->Tests++; + $this->cur_testname=$attrs['NAME']; + if ($this->debug_log) + $NATS->Event("Test Element: ".$this->cur_testname,10,"NodeXML","TestE"); + } +else if ($name=="HEADER") $in_header=true; +$this->last_element=$name; +$this->depth++; +$this->Elements++; +} + +function endElement($parser, $name) +{ +global $NATS; +$this->depth--; +if ($name=="TEST") $in_test=false; +else if ($name=="HEADER") $in_header=false; +else if ($name=="FREENATS-DATA") + { + $in_freenats=false; + if ($this->debug_log) + $NATS->Event("endE in_freenats set to false",10,"NodeXML","EndE"); + } +if ($this->debug_log) + $NATS->Event("End Element: ".$name,10,"NodeXML","EndE"); +} + +function charData($parser,$data) +{ +global $NATS; +if ($this->debug_log) $NATS->Event("Char Data Called",10,"NodeXML","CharData"); +if (!$this->in_freenats) + { + if ($this->debug_log) + $NATS->Event("Char Data in_freenats FALSE",10,"NodeXML","CharData"); + return 0; + } +if ($this->debug_log) + { + $NATS->Event("Char Data in FreeNATS",10,"NodeXML","CharData"); + $NATS->Event("Untrimmed Data: ".$data,10,"NodeXML","CharData"); + } + +$data=trim($data); +if ($data!="") + { + if ($this->debug_log) + $NATS->Event("Data: ".$data,10,"NodeXML","CharData"); + + if ($this->in_test) + { + $this->Catalogue[$this->cur_testname][$this->last_element]=$data; + } + else if ($this->in_header) + $this->Header[$this->last_element]=$data; + } +} + +function Error() +{ +return $this->LastError; +} + +function Parse($xml) +{ +if (get_magic_quotes_gpc()) $xml=stripslashes($xml); +$this->Init=true; +$parser=xml_parser_create(); +xml_set_element_handler($parser,Array( $this, "startElement" ), + Array( $this, "endElement" ) ); +xml_set_character_data_handler($parser,Array( $this, "charData" )); + +$return=true; + +if (!xml_parse($parser,$xml,true)) + { + $this->LastError="XML Error ".xml_error_string(xml_get_error_code($parser)); + $this->LastError.=" at line ".xml_get_current_line_number($parser); + if ($debug_log) $NATS->Event($this->LastError,5,"NodeXML","Parse"); + $return=false; + } + +xml_parser_free($parser); + +if ($return) return $this->Catalogue; +else return 0; +} + +function ParseFile($xmlfile) +{ +$fp=fopen($xmlfile,"r") + or die("Could not open XML file ".$xmlfile); +$data=""; +while (!feof($fp)) + $data.=fgets($fp,4096); +fclose($fp); +return $this->Parse($data); +} + + +} +?> \ No newline at end of file diff --git a/src/server/base/phpmailer/LICENSE b/src/server/base/phpmailer/LICENSE new file mode 100644 index 0000000..03851a3 --- /dev/null +++ b/src/server/base/phpmailer/LICENSE @@ -0,0 +1,504 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + diff --git a/src/server/base/phpmailer/README b/src/server/base/phpmailer/README new file mode 100644 index 0000000..2d79f38 --- /dev/null +++ b/src/server/base/phpmailer/README @@ -0,0 +1,218 @@ +/******************************************************************* +* The http://phpmailer.codeworxtech.com/ website now carries a few * +* advertisements through the Google Adsense network. Please visit * +* the advertiser sites and help us offset some of our costs. * +* Thanks .... * +********************************************************************/ + +PHPMailer +Full Featured Email Transfer Class for PHP +========================================== + +Version 5.0.0 (April 02, 2009) + +With the release of this version, we are initiating a new version numbering +system to differentiate from the PHP4 version of PHPMailer. + +Most notable in this release is fully object oriented code. + +We now have available the PHPDocumentor (phpdocs) documentation. This is +separate from the regular download to keep file sizes down. Please see the +download area of http://phpmailer.codeworxtech.com. + +We also have created a new test script (see /test_script) that you can use +right out of the box. Copy the /test_script folder directly to your server (in +the same structure ... with class.phpmailer.php and class.smtp.php in the +folder above it. Then launch the test script with: +http://www.yourdomain.com/phpmailer/test_script/index.php +from this one script, you can test your server settings for mail(), sendmail (or +qmail), and SMTP. This will email you a sample email (using contents.html for +the email body) and two attachments. One of the attachments is used as an inline +image to demonstrate how PHPMailer will automatically detect if attachments are +the same source as inline graphics and only include one version. Once you click +the Submit button, the results will be displayed including any SMTP debug +information and send status. We will also display a version of the script that +you can cut and paste to include in your projects. Enjoy! + +Version 2.3 (November 08, 2008) + +We have removed the /phpdoc from the downloads. All documentation is now on +the http://phpmailer.codeworxtech.com website. + +The phpunit.php has been updated to support PHP5. + +For all other changes and notes, please see the changelog. + +Donations are accepted at PayPal with our id "paypal@worxteam.com". + +Version 2.2 (July 15 2008) + +- see the changelog. + +Version 2.1 (June 04 2008) + +With this release, we are announcing that the development of PHPMailer for PHP5 +will be our focus from this date on. We have implemented all the enhancements +and fixes from the latest release of PHPMailer for PHP4. + +Far more important, though, is that this release of PHPMailer (v2.1) is +fully tested with E_STRICT error checking enabled. + +** NOTE: WE HAVE A NEW LANGUAGE VARIABLE FOR DIGITALLY SIGNED S/MIME EMAILS. + IF YOU CAN HELP WITH LANGUAGES OTHER THAN ENGLISH AND SPANISH, IT WOULD BE + APPRECIATED. + +We have now added S/MIME functionality (ability to digitally sign emails). +BIG THANKS TO "sergiocambra" for posting this patch back in November 2007. +The "Signed Emails" functionality adds the Sign method to pass the private key +filename and the password to read it, and then email will be sent with +content-type multipart/signed and with the digital signature attached. + +A quick note on E_STRICT: + +- In about half the test environments the development version was subjected + to, an error was thrown for the date() functions (used at line 1565 and 1569). + This is NOT a PHPMailer error, it is the result of an incorrectly configured + PHP5 installation. The fix is to modify your 'php.ini' file and include the + date.timezone = America/New York + directive, (for your own server timezone) +- If you do get this error, and are unable to access your php.ini file, there is + a workaround. In your PHP script, add + date_default_timezone_set('America/Toronto'); + + * do NOT try to use + $myVar = date_default_timezone_get(); + as a test, it will throw an error. + +We have also included more example files to show the use of "sendmail", "mail()", +"smtp", and "gmail". + +We are also looking for more programmers to join the volunteer development team. +If you have an interest in this, please let us know. + +Enjoy! + + +Version 2.1.0beta1 & beta2 + +please note, this is BETA software +** DO NOT USE THIS IN PRODUCTION OR LIVE PROJECTS +INTENDED STRICTLY FOR TESTING + +** NOTE: + +As of November 2007, PHPMailer has a new project team headed by industry +veteran Andy Prevost (codeworxtech). The first release in more than two +years will focus on fixes, adding ease-of-use enhancements, provide +basic compatibility with PHP4 and PHP5 using PHP5 backwards compatibility +features. A new release is planned before year-end 2007 that will provide +full compatiblity with PHP4 and PHP5, as well as more bug fixes. + +We are looking for project developers to assist in restoring PHPMailer to +its leadership position. Our goals are to simplify use of PHPMailer, provide +good documentation and examples, and retain backward compatibility to level +1.7.3 standards. + +If you are interested in helping out, visit http://sourceforge.net/projects/phpmailer +and indicate your interest. + +** + +http://phpmailer.sourceforge.net/ + +This software is licenced under the LGPL. Please read LICENSE for information on the +software availability and distribution. + +Class Features: +- Send emails with multiple TOs, CCs, BCCs and REPLY-TOs +- Redundant SMTP servers +- Multipart/alternative emails for mail clients that do not read HTML email +- Support for 8bit, base64, binary, and quoted-printable encoding +- Uses the same methods as the very popular AspEmail active server (COM) component +- SMTP authentication +- Native language support +- Word wrap, and more! + +Why you might need it: + +Many PHP developers utilize email in their code. The only PHP function +that supports this is the mail() function. However, it does not expose +any of the popular features that many email clients use nowadays like +HTML-based emails and attachments. There are two proprietary +development tools out there that have all the functionality built into +easy to use classes: AspEmail(tm) and AspMail. Both of these +programs are COM components only available on Windows. They are also a +little pricey for smaller projects. + +Since I do Linux development I�ve missed these tools for my PHP coding. +So I built a version myself that implements the same methods (object +calls) that the Windows-based components do. It is open source and the +LGPL license allows you to place the class in your proprietary PHP +projects. + + +Installation: + +Copy class.phpmailer.php into your php.ini include_path. If you are +using the SMTP mailer then place class.smtp.php in your path as well. +In the language directory you will find several files like +phpmailer.lang-en.php. If you look right before the .php extension +that there are two letters. These represent the language type of the +translation file. For instance "en" is the English file and "br" is +the Portuguese file. Chose the file that best fits with your language +and place it in the PHP include path. If your language is English +then you have nothing more to do. If it is a different language then +you must point PHPMailer to the correct translation. To do this, call +the PHPMailer SetLanguage method like so: + +// To load the Portuguese version +$mail->SetLanguage("br", "/optional/path/to/language/directory/"); + +That's it. You should now be ready to use PHPMailer! + + +A Simple Example: + +IsSMTP(); // set mailer to use SMTP +$mail->Host = "smtp1.example.com;smtp2.example.com"; // specify main and backup server +$mail->SMTPAuth = true; // turn on SMTP authentication +$mail->Username = "jswan"; // SMTP username +$mail->Password = "secret"; // SMTP password + +$mail->From = "from@example.com"; +$mail->FromName = "Mailer"; +$mail->AddAddress("josh@example.net", "Josh Adams"); +$mail->AddAddress("ellen@example.com"); // name is optional +$mail->AddReplyTo("info@example.com", "Information"); + +$mail->WordWrap = 50; // set word wrap to 50 characters +$mail->AddAttachment("/var/tmp/file.tar.gz"); // add attachments +$mail->AddAttachment("/tmp/image.jpg", "new.jpg"); // optional name +$mail->IsHTML(true); // set email format to HTML + +$mail->Subject = "Here is the subject"; +$mail->Body = "This is the HTML message body in bold!"; +$mail->AltBody = "This is the body in plain text for non-HTML mail clients"; + +if(!$mail->Send()) +{ + echo "Message could not be sent.

"; + echo "Mailer Error: " . $mail->ErrorInfo; + exit; +} + +echo "Message has been sent"; +?> + +CHANGELOG + +See ChangeLog.txt + +Download: http://sourceforge.net/project/showfiles.php?group_id=26031 + +Andy Prevost diff --git a/src/server/base/phpmailer/class.phpmailer.php b/src/server/base/phpmailer/class.phpmailer.php new file mode 100644 index 0000000..aeb4bc3 --- /dev/null +++ b/src/server/base/phpmailer/class.phpmailer.php @@ -0,0 +1,2068 @@ +exceptions = ($exceptions == true); + } + + /** + * Sets message type to HTML. + * @param bool $ishtml + * @return void + */ + public function IsHTML($ishtml = true) { + if ($ishtml) { + $this->ContentType = 'text/html'; + } else { + $this->ContentType = 'text/plain'; + } + } + + /** + * Sets Mailer to send message using SMTP. + * @return void + */ + public function IsSMTP() { + $this->Mailer = 'smtp'; + } + + /** + * Sets Mailer to send message using PHP mail() function. + * @return void + */ + public function IsMail() { + $this->Mailer = 'mail'; + } + + /** + * Sets Mailer to send message using the $Sendmail program. + * @return void + */ + public function IsSendmail() { + if (!stristr(ini_get('sendmail_path'), 'sendmail')) { + $this->Sendmail = '/var/qmail/bin/sendmail'; + } + $this->Mailer = 'sendmail'; + } + + /** + * Sets Mailer to send message using the qmail MTA. + * @return void + */ + public function IsQmail() { + if (stristr(ini_get('sendmail_path'), 'qmail')) { + $this->Sendmail = '/var/qmail/bin/sendmail'; + } + $this->Mailer = 'sendmail'; + } + + ///////////////////////////////////////////////// + // METHODS, RECIPIENTS + ///////////////////////////////////////////////// + + /** + * Adds a "To" address. + * @param string $address + * @param string $name + * @return boolean true on success, false if address already used + */ + public function AddAddress($address, $name = '') { + return $this->AddAnAddress('to', $address, $name); + } + + /** + * Adds a "Cc" address. + * Note: this function works with the SMTP mailer on win32, not with the "mail" mailer. + * @param string $address + * @param string $name + * @return boolean true on success, false if address already used + */ + public function AddCC($address, $name = '') { + return $this->AddAnAddress('cc', $address, $name); + } + + /** + * Adds a "Bcc" address. + * Note: this function works with the SMTP mailer on win32, not with the "mail" mailer. + * @param string $address + * @param string $name + * @return boolean true on success, false if address already used + */ + public function AddBCC($address, $name = '') { + return $this->AddAnAddress('bcc', $address, $name); + } + + /** + * Adds a "Reply-to" address. + * @param string $address + * @param string $name + * @return boolean + */ + public function AddReplyTo($address, $name = '') { + return $this->AddAnAddress('ReplyTo', $address, $name); + } + + /** + * Adds an address to one of the recipient arrays + * Addresses that have been added already return false, but do not throw exceptions + * @param string $kind One of 'to', 'cc', 'bcc', 'ReplyTo' + * @param string $address The email address to send to + * @param string $name + * @return boolean true on success, false if address already used or invalid in some way + * @access private + */ + private function AddAnAddress($kind, $address, $name = '') { + if (!preg_match('/^(to|cc|bcc|ReplyTo)$/', $kind)) { + echo 'Invalid recipient array: ' . kind; + return false; + } + $address = trim($address); + $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim + if (!self::ValidateAddress($address)) { + $this->SetError($this->Lang('invalid_address').': '. $address); + if ($this->exceptions) { + throw new phpmailerException($this->Lang('invalid_address').': '.$address); + } + echo $this->Lang('invalid_address').': '.$address; + return false; + } + if ($kind != 'ReplyTo') { + if (!isset($this->all_recipients[strtolower($address)])) { + array_push($this->$kind, array($address, $name)); + $this->all_recipients[strtolower($address)] = true; + return true; + } + } else { + if (!array_key_exists(strtolower($address), $this->ReplyTo)) { + $this->ReplyTo[strtolower($address)] = array($address, $name); + return true; + } + } + return false; + } + +/** + * Set the From and FromName properties + * @param string $address + * @param string $name + * @return boolean + */ + public function SetFrom($address, $name = '') { + $address = trim($address); + $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim + if (!self::ValidateAddress($address)) { + $this->SetError($this->Lang('invalid_address').': '. $address); + if ($this->exceptions) { + throw new phpmailerException($this->Lang('invalid_address').': '.$address); + } + echo $this->Lang('invalid_address').': '.$address; + return false; + } + $this->From = $address; + $this->FromName = $name; + return true; + } + + /** + * Check that a string looks roughly like an email address should + * Static so it can be used without instantiation + * Tries to use PHP built-in validator in the filter extension (from PHP 5.2), falls back to a reasonably competent regex validator + * Conforms approximately to RFC2822 + * @link http://www.hexillion.com/samples/#Regex Original pattern found here + * @param string $address The email address to check + * @return boolean + * @static + * @access public + */ + public static function ValidateAddress($address) { + if (function_exists('filter_var')) { //Introduced in PHP 5.2 + if(filter_var($address, FILTER_VALIDATE_EMAIL) === FALSE) { + return false; + } else { + return true; + } + } else { + return preg_match('/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9_](?:[a-zA-Z0-9_\-](?!\.)){0,61}[a-zA-Z0-9_-]?\.)+[a-zA-Z0-9_](?:[a-zA-Z0-9_\-](?!$)){0,61}[a-zA-Z0-9_]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/', $address); + } + } + + ///////////////////////////////////////////////// + // METHODS, MAIL SENDING + ///////////////////////////////////////////////// + + /** + * Creates message and assigns Mailer. If the message is + * not sent successfully then it returns false. Use the ErrorInfo + * variable to view description of the error. + * @return bool + */ + public function Send() { + try { + if ((count($this->to) + count($this->cc) + count($this->bcc)) < 1) { + throw new phpmailerException($this->Lang('provide_address'), self::STOP_CRITICAL); + } + + // Set whether the message is multipart/alternative + if(!empty($this->AltBody)) { + $this->ContentType = 'multipart/alternative'; + } + + $this->error_count = 0; // reset errors + $this->SetMessageType(); + $header = $this->CreateHeader(); + $body = $this->CreateBody(); + + if (empty($this->Body)) { + throw new phpmailerException($this->Lang('empty_message'), self::STOP_CRITICAL); + } + + // Choose the mailer and send through it + switch($this->Mailer) { + case 'sendmail': + return $this->SendmailSend($header, $body); + case 'smtp': + return $this->SmtpSend($header, $body); + case 'mail': + default: + return $this->MailSend($header, $body); + } + + } catch (phpmailerException $e) { + $this->SetError($e->getMessage()); + if ($this->exceptions) { + throw $e; + } + echo $e->getMessage()."\n"; + return false; + } + } + + /** + * Sends mail using the $Sendmail program. + * @param string $header The message headers + * @param string $body The message body + * @access protected + * @return bool + */ + protected function SendmailSend($header, $body) { + if ($this->Sender != '') { + $sendmail = sprintf("%s -oi -f %s -t", escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender)); + } else { + $sendmail = sprintf("%s -oi -t", escapeshellcmd($this->Sendmail)); + } + if(!@$mail = popen($sendmail, 'w')) { + throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL); + } + fputs($mail, $header); + fputs($mail, $body); + $result = pclose($mail); + if($result != 0) { + throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL); + } + return true; + } + + /** + * Sends mail using the PHP mail() function. + * @param string $header The message headers + * @param string $body The message body + * @access protected + * @return bool + */ + protected function MailSend($header, $body) { + $toArr = array(); + foreach($this->to as $t) { + $toArr[] = $this->AddrFormat($t); + } + $to = implode(', ', $toArr); + + $params = sprintf("-oi -f %s", $this->Sender); + if ($this->Sender != '' && strlen(ini_get('safe_mode'))< 1) { + $old_from = ini_get('sendmail_from'); + ini_set('sendmail_from', $this->Sender); + if ($this->SingleTo === true && count($toArr) > 1) { + foreach ($toArr as $key => $val) { + $rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params); + } + } else { + $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params); + } + } else { + if ($this->SingleTo === true && count($toArr) > 1) { + foreach ($toArr as $key => $val) { + $rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params); + } + } else { + $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header); + } + } + if (isset($old_from)) { + ini_set('sendmail_from', $old_from); + } + if(!$rt) { + throw new phpmailerException($this->Lang('instantiate'), self::STOP_CRITICAL); + } + return true; + } + + /** + * Sends mail via SMTP using PhpSMTP + * Returns false if there is a bad MAIL FROM, RCPT, or DATA input. + * @param string $header The message headers + * @param string $body The message body + * @uses SMTP + * @access protected + * @return bool + */ + protected function SmtpSend($header, $body) { + require_once $this->PluginDir . 'class.smtp.php'; + $bad_rcpt = array(); + + if(!$this->SmtpConnect()) { + throw new phpmailerException($this->Lang('smtp_connect_failed'), self::STOP_CRITICAL); + } + $smtp_from = ($this->Sender == '') ? $this->From : $this->Sender; + if(!$this->smtp->Mail($smtp_from)) { + throw new phpmailerException($this->Lang('from_failed') . $smtp_from, self::STOP_CRITICAL); + } + + // Attempt to send attach all recipients + foreach($this->to as $to) { + if (!$this->smtp->Recipient($to[0])) { + $bad_rcpt[] = $to[0]; + } + } + foreach($this->cc as $cc) { + if (!$this->smtp->Recipient($cc[0])) { + $bad_rcpt[] = $cc[0]; + } + } + foreach($this->bcc as $bcc) { + if (!$this->smtp->Recipient($bcc[0])) { + $bad_rcpt[] = $bcc[0]; + } + } + if (count($bad_rcpt) > 0 ) { //Create error message for any bad addresses + $badaddresses = implode(', ', $bad_rcpt); + throw new phpmailerException($this->Lang('recipients_failed') . $badaddresses); + } + if(!$this->smtp->Data($header . $body)) { + throw new phpmailerException($this->Lang('data_not_accepted'), self::STOP_CRITICAL); + } + if($this->SMTPKeepAlive == true) { + $this->smtp->Reset(); + } + return true; + } + + /** + * Initiates a connection to an SMTP server. + * Returns false if the operation failed. + * @uses SMTP + * @access public + * @return bool + */ + public function SmtpConnect() { + if(is_null($this->smtp)) { + $this->smtp = new SMTP(); + } + + $this->smtp->do_debug = $this->SMTPDebug; + $hosts = explode(';', $this->Host); + $index = 0; + $connection = $this->smtp->Connected(); + + // Retry while there is no connection + try { + while($index < count($hosts) && !$connection) { + $hostinfo = array(); + if (preg_match('/^(.+):([0-9]+)$/', $hosts[$index], $hostinfo)) { + $host = $hostinfo[1]; + $port = $hostinfo[2]; + } else { + $host = $hosts[$index]; + $port = $this->Port; + } + + $tls = ($this->SMTPSecure == 'tls'); + $ssl = ($this->SMTPSecure == 'ssl'); + + if ($this->smtp->Connect(($ssl ? 'ssl://':'').$host, $port, $this->Timeout)) { + + $hello = ($this->Helo != '' ? $this->Helo : $this->ServerHostname()); + $this->smtp->Hello($hello); + + if ($tls) { + if (!$this->smtp->StartTLS()) { + throw new phpmailerException($this->Lang('tls')); + } + + //We must resend HELO after tls negotiation + $this->smtp->Hello($hello); + } + + $connection = true; + if ($this->SMTPAuth) { + if (!$this->smtp->Authenticate($this->Username, $this->Password)) { + throw new phpmailerException($this->Lang('authenticate')); + } + } + } + $index++; + if (!$connection) { + throw new phpmailerException($this->Lang('connect_host')); + } + } + } catch (phpmailerException $e) { + $this->smtp->Reset(); + throw $e; + } + return true; + } + + /** + * Closes the active SMTP session if one exists. + * @return void + */ + public function SmtpClose() { + if(!is_null($this->smtp)) { + if($this->smtp->Connected()) { + $this->smtp->Quit(); + $this->smtp->Close(); + } + } + } + + /** + * Sets the language for all class error messages. + * Returns false if it cannot load the language file. The default language is English. + * @param string $langcode ISO 639-1 2-character language code (e.g. Portuguese: "br") + * @param string $lang_path Path to the language file directory + * @access public + */ + function SetLanguage($langcode = 'en', $lang_path = 'language/') { + //Define full set of translatable strings + $PHPMAILER_LANG = array( + 'provide_address' => 'You must provide at least one recipient email address.', + 'mailer_not_supported' => ' mailer is not supported.', + 'execute' => 'Could not execute: ', + 'instantiate' => 'Could not instantiate mail function.', + 'authenticate' => 'SMTP Error: Could not authenticate.', + 'from_failed' => 'The following From address failed: ', + 'recipients_failed' => 'SMTP Error: The following recipients failed: ', + 'data_not_accepted' => 'SMTP Error: Data not accepted.', + 'connect_host' => 'SMTP Error: Could not connect to SMTP host.', + 'file_access' => 'Could not access file: ', + 'file_open' => 'File Error: Could not open file: ', + 'encoding' => 'Unknown encoding: ', + 'signing' => 'Signing Error: ', + 'smtp_error' => 'SMTP server error: ', + 'empty_message' => 'Message body empty', + 'invalid_address' => 'Invalid address', + 'variable_set' => 'Cannot set or reset variable: ' + ); + //Overwrite language-specific strings. This way we'll never have missing translations - no more "language string failed to load"! + $l = true; + if ($langcode != 'en') { //There is no English translation file + $l = @include $lang_path.'phpmailer.lang-'.$langcode.'.php'; + } + $this->language = $PHPMAILER_LANG; + return ($l == true); //Returns false if language not found + } + + /** + * Return the current array of language strings + * @return array + */ + public function GetTranslations() { + return $this->language; + } + + ///////////////////////////////////////////////// + // METHODS, MESSAGE CREATION + ///////////////////////////////////////////////// + + /** + * Creates recipient headers. + * @access public + * @return string + */ + public function AddrAppend($type, $addr) { + $addr_str = $type . ': '; + $addresses = array(); + foreach ($addr as $a) { + $addresses[] = $this->AddrFormat($a); + } + $addr_str .= implode(', ', $addresses); + $addr_str .= $this->LE; + + return $addr_str; + } + + /** + * Formats an address correctly. + * @access public + * @return string + */ + public function AddrFormat($addr) { + if (empty($addr[1])) { + return $this->SecureHeader($addr[0]); + } else { + return $this->EncodeHeader($this->SecureHeader($addr[1]), 'phrase') . " <" . $this->SecureHeader($addr[0]) . ">"; + } + } + + /** + * Wraps message for use with mailers that do not + * automatically perform wrapping and for quoted-printable. + * Original written by philippe. + * @param string $message The message to wrap + * @param integer $length The line length to wrap to + * @param boolean $qp_mode Whether to run in Quoted-Printable mode + * @access public + * @return string + */ + public function WrapText($message, $length, $qp_mode = false) { + $soft_break = ($qp_mode) ? sprintf(" =%s", $this->LE) : $this->LE; + // If utf-8 encoding is used, we will need to make sure we don't + // split multibyte characters when we wrap + $is_utf8 = (strtolower($this->CharSet) == "utf-8"); + + $message = $this->FixEOL($message); + if (substr($message, -1) == $this->LE) { + $message = substr($message, 0, -1); + } + + $line = explode($this->LE, $message); + $message = ''; + for ($i=0 ;$i < count($line); $i++) { + $line_part = explode(' ', $line[$i]); + $buf = ''; + for ($e = 0; $e $length)) { + $space_left = $length - strlen($buf) - 1; + if ($e != 0) { + if ($space_left > 20) { + $len = $space_left; + if ($is_utf8) { + $len = $this->UTF8CharBoundary($word, $len); + } elseif (substr($word, $len - 1, 1) == "=") { + $len--; + } elseif (substr($word, $len - 2, 1) == "=") { + $len -= 2; + } + $part = substr($word, 0, $len); + $word = substr($word, $len); + $buf .= ' ' . $part; + $message .= $buf . sprintf("=%s", $this->LE); + } else { + $message .= $buf . $soft_break; + } + $buf = ''; + } + while (strlen($word) > 0) { + $len = $length; + if ($is_utf8) { + $len = $this->UTF8CharBoundary($word, $len); + } elseif (substr($word, $len - 1, 1) == "=") { + $len--; + } elseif (substr($word, $len - 2, 1) == "=") { + $len -= 2; + } + $part = substr($word, 0, $len); + $word = substr($word, $len); + + if (strlen($word) > 0) { + $message .= $part . sprintf("=%s", $this->LE); + } else { + $buf = $part; + } + } + } else { + $buf_o = $buf; + $buf .= ($e == 0) ? $word : (' ' . $word); + + if (strlen($buf) > $length and $buf_o != '') { + $message .= $buf_o . $soft_break; + $buf = $word; + } + } + } + $message .= $buf . $this->LE; + } + + return $message; + } + + /** + * Finds last character boundary prior to maxLength in a utf-8 + * quoted (printable) encoded string. + * Original written by Colin Brown. + * @access public + * @param string $encodedText utf-8 QP text + * @param int $maxLength find last character boundary prior to this length + * @return int + */ + public function UTF8CharBoundary($encodedText, $maxLength) { + $foundSplitPos = false; + $lookBack = 3; + while (!$foundSplitPos) { + $lastChunk = substr($encodedText, $maxLength - $lookBack, $lookBack); + $encodedCharPos = strpos($lastChunk, "="); + if ($encodedCharPos !== false) { + // Found start of encoded character byte within $lookBack block. + // Check the encoded byte value (the 2 chars after the '=') + $hex = substr($encodedText, $maxLength - $lookBack + $encodedCharPos + 1, 2); + $dec = hexdec($hex); + if ($dec < 128) { // Single byte character. + // If the encoded char was found at pos 0, it will fit + // otherwise reduce maxLength to start of the encoded char + $maxLength = ($encodedCharPos == 0) ? $maxLength : + $maxLength - ($lookBack - $encodedCharPos); + $foundSplitPos = true; + } elseif ($dec >= 192) { // First byte of a multi byte character + // Reduce maxLength to split at start of character + $maxLength = $maxLength - ($lookBack - $encodedCharPos); + $foundSplitPos = true; + } elseif ($dec < 192) { // Middle byte of a multi byte character, look further back + $lookBack += 3; + } + } else { + // No encoded character found + $foundSplitPos = true; + } + } + return $maxLength; + } + + + /** + * Set the body wrapping. + * @access public + * @return void + */ + public function SetWordWrap() { + if($this->WordWrap < 1) { + return; + } + + switch($this->message_type) { + case 'alt': + case 'alt_attachments': + $this->AltBody = $this->WrapText($this->AltBody, $this->WordWrap); + break; + default: + $this->Body = $this->WrapText($this->Body, $this->WordWrap); + break; + } + } + + /** + * Assembles message header. + * @access public + * @return string The assembled header + */ + public function CreateHeader() { + $result = ''; + + // Set the boundaries + $uniq_id = md5(uniqid(time())); + $this->boundary[1] = 'b1_' . $uniq_id; + $this->boundary[2] = 'b2_' . $uniq_id; + + $result .= $this->HeaderLine('Date', self::RFCDate()); + if($this->Sender == '') { + $result .= $this->HeaderLine('Return-Path', trim($this->From)); + } else { + $result .= $this->HeaderLine('Return-Path', trim($this->Sender)); + } + + // To be created automatically by mail() + if($this->Mailer != 'mail') { + if(count($this->to) > 0) { + $result .= $this->AddrAppend('To', $this->to); + } elseif (count($this->cc) == 0) { + $result .= $this->HeaderLine('To', 'undisclosed-recipients:;'); + } + } + + $from = array(); + $from[0][0] = trim($this->From); + $from[0][1] = $this->FromName; + $result .= $this->AddrAppend('From', $from); + + // sendmail and mail() extract Cc from the header before sending + if((($this->Mailer == 'sendmail') || ($this->Mailer == 'mail')) && (count($this->cc) > 0)) { + $result .= $this->AddrAppend('Cc', $this->cc); + } + + // sendmail and mail() extract Bcc from the header before sending + if((($this->Mailer == 'sendmail') || ($this->Mailer == 'mail')) && (count($this->bcc) > 0)) { + $result .= $this->AddrAppend('Bcc', $this->bcc); + } + + if(count($this->ReplyTo) > 0) { + $result .= $this->AddrAppend('Reply-to', $this->ReplyTo); + } + + // mail() sets the subject itself + if($this->Mailer != 'mail') { + $result .= $this->HeaderLine('Subject', $this->EncodeHeader($this->SecureHeader($this->Subject))); + } + + if($this->MessageID != '') { + $result .= $this->HeaderLine('Message-ID',$this->MessageID); + } else { + $result .= sprintf("Message-ID: <%s@%s>%s", $uniq_id, $this->ServerHostname(), $this->LE); + } + $result .= $this->HeaderLine('X-Priority', $this->Priority); + $result .= $this->HeaderLine('X-Mailer', 'PHPMailer ' . self::VERSION . ' (phpmailer.codeworxtech.com)'); + + if($this->ConfirmReadingTo != '') { + $result .= $this->HeaderLine('Disposition-Notification-To', '<' . trim($this->ConfirmReadingTo) . '>'); + } + + // Add custom headers + for($index = 0; $index < count($this->CustomHeader); $index++) { + $result .= $this->HeaderLine(trim($this->CustomHeader[$index][0]), $this->EncodeHeader(trim($this->CustomHeader[$index][1]))); + } + if (!$this->sign_key_file) { + $result .= $this->HeaderLine('MIME-Version', '1.0'); + $result .= $this->GetMailMIME(); + } + + return $result; + } + + /** + * Returns the message MIME. + * @access public + * @return string + */ + public function GetMailMIME() { + $result = ''; + switch($this->message_type) { + case 'plain': + $result .= $this->HeaderLine('Content-Transfer-Encoding', $this->Encoding); + $result .= sprintf("Content-Type: %s; charset=\"%s\"", $this->ContentType, $this->CharSet); + break; + case 'attachments': + case 'alt_attachments': + if($this->InlineImageExists()){ + $result .= sprintf("Content-Type: %s;%s\ttype=\"text/html\";%s\tboundary=\"%s\"%s", 'multipart/related', $this->LE, $this->LE, $this->boundary[1], $this->LE); + } else { + $result .= $this->HeaderLine('Content-Type', 'multipart/mixed;'); + $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"'); + } + break; + case 'alt': + $result .= $this->HeaderLine('Content-Type', 'multipart/alternative;'); + $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"'); + break; + } + + if($this->Mailer != 'mail') { + $result .= $this->LE.$this->LE; + } + + return $result; + } + + /** + * Assembles the message body. Returns an empty string on failure. + * @access public + * @return string The assembled message body + */ + public function CreateBody() { + $body = ''; + + if ($this->sign_key_file) { + $body .= $this->GetMailMIME(); + } + + $this->SetWordWrap(); + + switch($this->message_type) { + case 'alt': + $body .= $this->GetBoundary($this->boundary[1], '', 'text/plain', ''); + $body .= $this->EncodeString($this->AltBody, $this->Encoding); + $body .= $this->LE.$this->LE; + $body .= $this->GetBoundary($this->boundary[1], '', 'text/html', ''); + $body .= $this->EncodeString($this->Body, $this->Encoding); + $body .= $this->LE.$this->LE; + $body .= $this->EndBoundary($this->boundary[1]); + break; + case 'plain': + $body .= $this->EncodeString($this->Body, $this->Encoding); + break; + case 'attachments': + $body .= $this->GetBoundary($this->boundary[1], '', '', ''); + $body .= $this->EncodeString($this->Body, $this->Encoding); + $body .= $this->LE; + $body .= $this->AttachAll(); + break; + case 'alt_attachments': + $body .= sprintf("--%s%s", $this->boundary[1], $this->LE); + $body .= sprintf("Content-Type: %s;%s" . "\tboundary=\"%s\"%s", 'multipart/alternative', $this->LE, $this->boundary[2], $this->LE.$this->LE); + $body .= $this->GetBoundary($this->boundary[2], '', 'text/plain', '') . $this->LE; // Create text body + $body .= $this->EncodeString($this->AltBody, $this->Encoding); + $body .= $this->LE.$this->LE; + $body .= $this->GetBoundary($this->boundary[2], '', 'text/html', '') . $this->LE; // Create the HTML body + $body .= $this->EncodeString($this->Body, $this->Encoding); + $body .= $this->LE.$this->LE; + $body .= $this->EndBoundary($this->boundary[2]); + $body .= $this->AttachAll(); + break; + } + + if ($this->IsError()) { + $body = ''; + } elseif ($this->sign_key_file) { + try { + $file = tempnam('', 'mail'); + file_put_contents($file, $body); //TODO check this worked + $signed = tempnam("", "signed"); + if (@openssl_pkcs7_sign($file, $signed, "file://".$this->sign_cert_file, array("file://".$this->sign_key_file, $this->sign_key_pass), NULL)) { + @unlink($file); + @unlink($signed); + $body = file_get_contents($signed); + } else { + @unlink($file); + @unlink($signed); + throw new phpmailerException($this->Lang("signing").openssl_error_string()); + } + } catch (phpmailerException $e) { + $body = ''; + if ($this->exceptions) { + throw $e; + } + } + } + + return $body; + } + + /** + * Returns the start of a message boundary. + * @access private + */ + private function GetBoundary($boundary, $charSet, $contentType, $encoding) { + $result = ''; + if($charSet == '') { + $charSet = $this->CharSet; + } + if($contentType == '') { + $contentType = $this->ContentType; + } + if($encoding == '') { + $encoding = $this->Encoding; + } + $result .= $this->TextLine('--' . $boundary); + $result .= sprintf("Content-Type: %s; charset = \"%s\"", $contentType, $charSet); + $result .= $this->LE; + $result .= $this->HeaderLine('Content-Transfer-Encoding', $encoding); + $result .= $this->LE; + + return $result; + } + + /** + * Returns the end of a message boundary. + * @access private + */ + private function EndBoundary($boundary) { + return $this->LE . '--' . $boundary . '--' . $this->LE; + } + + /** + * Sets the message type. + * @access private + * @return void + */ + private function SetMessageType() { + if(count($this->attachment) < 1 && strlen($this->AltBody) < 1) { + $this->message_type = 'plain'; + } else { + if(count($this->attachment) > 0) { + $this->message_type = 'attachments'; + } + if(strlen($this->AltBody) > 0 && count($this->attachment) < 1) { + $this->message_type = 'alt'; + } + if(strlen($this->AltBody) > 0 && count($this->attachment) > 0) { + $this->message_type = 'alt_attachments'; + } + } + } + + /** + * Returns a formatted header line. + * @access public + * @return string + */ + public function HeaderLine($name, $value) { + return $name . ': ' . $value . $this->LE; + } + + /** + * Returns a formatted mail line. + * @access public + * @return string + */ + public function TextLine($value) { + return $value . $this->LE; + } + + ///////////////////////////////////////////////// + // CLASS METHODS, ATTACHMENTS + ///////////////////////////////////////////////// + + /** + * Adds an attachment from a path on the filesystem. + * Returns false if the file could not be found + * or accessed. + * @param string $path Path to the attachment. + * @param string $name Overrides the attachment name. + * @param string $encoding File encoding (see $Encoding). + * @param string $type File extension (MIME) type. + * @return bool + */ + public function AddAttachment($path, $name = '', $encoding = 'base64', $type = 'application/octet-stream') { + try { + if ( !@is_file($path) ) { + throw new phpmailerException($this->Lang('file_access') . $path, self::STOP_CONTINUE); + } + $filename = basename($path); + if ( $name == '' ) { + $name = $filename; + } + + $this->attachment[] = array( + 0 => $path, + 1 => $filename, + 2 => $name, + 3 => $encoding, + 4 => $type, + 5 => false, // isStringAttachment + 6 => 'attachment', + 7 => 0 + ); + + } catch (phpmailerException $e) { + $this->SetError($e->getMessage()); + if ($this->exceptions) { + throw $e; + } + echo $e->getMessage()."\n"; + if ( $e->getCode() == self::STOP_CRITICAL ) { + return false; + } + } + return true; + } + + /** + * Return the current array of attachments + * @return array + */ + public function GetAttachments() { + return $this->attachment; + } + + /** + * Attaches all fs, string, and binary attachments to the message. + * Returns an empty string on failure. + * @access private + * @return string + */ + private function AttachAll() { + // Return text of body + $mime = array(); + $cidUniq = array(); + $incl = array(); + + // Add all attachments + foreach ($this->attachment as $attachment) { + // Check for string attachment + $bString = $attachment[5]; + if ($bString) { + $string = $attachment[0]; + } else { + $path = $attachment[0]; + } + + if (in_array($attachment[0], $incl)) { continue; } + $filename = $attachment[1]; + $name = $attachment[2]; + $encoding = $attachment[3]; + $type = $attachment[4]; + $disposition = $attachment[6]; + $cid = $attachment[7]; + $incl[] = $attachment[0]; + if ( isset($cidUniq[$cid]) ) { continue; } + $cidUniq[$cid] = true; + + $mime[] = sprintf("--%s%s", $this->boundary[1], $this->LE); + $mime[] = sprintf("Content-Type: %s; name=\"%s\"%s", $type, $this->EncodeHeader($this->SecureHeader($name)), $this->LE); + $mime[] = sprintf("Content-Transfer-Encoding: %s%s", $encoding, $this->LE); + + if($disposition == 'inline') { + $mime[] = sprintf("Content-ID: <%s>%s", $cid, $this->LE); + } + + $mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s", $disposition, $this->EncodeHeader($this->SecureHeader($name)), $this->LE.$this->LE); + + // Encode as string attachment + if($bString) { + $mime[] = $this->EncodeString($string, $encoding); + if($this->IsError()) { + return ''; + } + $mime[] = $this->LE.$this->LE; + } else { + $mime[] = $this->EncodeFile($path, $encoding); + if($this->IsError()) { + return ''; + } + $mime[] = $this->LE.$this->LE; + } + } + + $mime[] = sprintf("--%s--%s", $this->boundary[1], $this->LE); + + return join('', $mime); + } + + /** + * Encodes attachment in requested format. + * Returns an empty string on failure. + * @param string $path The full path to the file + * @param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable' + * @see EncodeFile() + * @access private + * @return string + */ + private function EncodeFile($path, $encoding = 'base64') { + try { + if (!is_readable($path)) { + throw new phpmailerException($this->Lang('file_open') . $path, self::STOP_CONTINUE); + } + if (function_exists('get_magic_quotes')) { + function get_magic_quotes() { + return false; + } + } + if (PHP_VERSION < 6) { + $magic_quotes = get_magic_quotes_runtime(); + set_magic_quotes_runtime(0); + } + $file_buffer = file_get_contents($path); + $file_buffer = $this->EncodeString($file_buffer, $encoding); + if (PHP_VERSION < 6) { set_magic_quotes_runtime($magic_quotes); } + return $file_buffer; + } catch (Exception $e) { + $this->SetError($e->getMessage()); + return ''; + } + } + + /** + * Encodes string to requested format. + * Returns an empty string on failure. + * @param string $str The text to encode + * @param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable' + * @access public + * @return string + */ + public function EncodeString ($str, $encoding = 'base64') { + $encoded = ''; + switch(strtolower($encoding)) { + case 'base64': + $encoded = chunk_split(base64_encode($str), 76, $this->LE); + break; + case '7bit': + case '8bit': + $encoded = $this->FixEOL($str); + //Make sure it ends with a line break + if (substr($encoded, -(strlen($this->LE))) != $this->LE) + $encoded .= $this->LE; + break; + case 'binary': + $encoded = $str; + break; + case 'quoted-printable': + $encoded = $this->EncodeQP($str); + break; + default: + $this->SetError($this->Lang('encoding') . $encoding); + break; + } + return $encoded; + } + + /** + * Encode a header string to best (shortest) of Q, B, quoted or none. + * @access public + * @return string + */ + public function EncodeHeader($str, $position = 'text') { + $x = 0; + + switch (strtolower($position)) { + case 'phrase': + if (!preg_match('/[\200-\377]/', $str)) { + // Can't use addslashes as we don't know what value has magic_quotes_sybase + $encoded = addcslashes($str, "\0..\37\177\\\""); + if (($str == $encoded) && !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str)) { + return ($encoded); + } else { + return ("\"$encoded\""); + } + } + $x = preg_match_all('/[^\040\041\043-\133\135-\176]/', $str, $matches); + break; + case 'comment': + $x = preg_match_all('/[()"]/', $str, $matches); + // Fall-through + case 'text': + default: + $x += preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/', $str, $matches); + break; + } + + if ($x == 0) { + return ($str); + } + + $maxlen = 75 - 7 - strlen($this->CharSet); + // Try to select the encoding which should produce the shortest output + if (strlen($str)/3 < $x) { + $encoding = 'B'; + if (function_exists('mb_strlen') && $this->HasMultiBytes($str)) { + // Use a custom function which correctly encodes and wraps long + // multibyte strings without breaking lines within a character + $encoded = $this->Base64EncodeWrapMB($str); + } else { + $encoded = base64_encode($str); + $maxlen -= $maxlen % 4; + $encoded = trim(chunk_split($encoded, $maxlen, "\n")); + } + } else { + $encoding = 'Q'; + $encoded = $this->EncodeQ($str, $position); + $encoded = $this->WrapText($encoded, $maxlen, true); + $encoded = str_replace('='.$this->LE, "\n", trim($encoded)); + } + + $encoded = preg_replace('/^(.*)$/m', " =?".$this->CharSet."?$encoding?\\1?=", $encoded); + $encoded = trim(str_replace("\n", $this->LE, $encoded)); + + return $encoded; + } + + /** + * Checks if a string contains multibyte characters. + * @access public + * @param string $str multi-byte text to wrap encode + * @return bool + */ + public function HasMultiBytes($str) { + if (function_exists('mb_strlen')) { + return (strlen($str) > mb_strlen($str, $this->CharSet)); + } else { // Assume no multibytes (we can't handle without mbstring functions anyway) + return false; + } + } + + /** + * Correctly encodes and wraps long multibyte strings for mail headers + * without breaking lines within a character. + * Adapted from a function by paravoid at http://uk.php.net/manual/en/function.mb-encode-mimeheader.php + * @access public + * @param string $str multi-byte text to wrap encode + * @return string + */ + public function Base64EncodeWrapMB($str) { + $start = "=?".$this->CharSet."?B?"; + $end = "?="; + $encoded = ""; + + $mb_length = mb_strlen($str, $this->CharSet); + // Each line must have length <= 75, including $start and $end + $length = 75 - strlen($start) - strlen($end); + // Average multi-byte ratio + $ratio = $mb_length / strlen($str); + // Base64 has a 4:3 ratio + $offset = $avgLength = floor($length * $ratio * .75); + + for ($i = 0; $i < $mb_length; $i += $offset) { + $lookBack = 0; + + do { + $offset = $avgLength - $lookBack; + $chunk = mb_substr($str, $i, $offset, $this->CharSet); + $chunk = base64_encode($chunk); + $lookBack++; + } + while (strlen($chunk) > $length); + + $encoded .= $chunk . $this->LE; + } + + // Chomp the last linefeed + $encoded = substr($encoded, 0, -strlen($this->LE)); + return $encoded; + } + + /** + * Encode string to quoted-printable. + * Only uses standard PHP, slow, but will always work + * @access public + * @param string $string the text to encode + * @param integer $line_max Number of chars allowed on a line before wrapping + * @return string + */ + public function EncodeQPphp( $input = '', $line_max = 76, $space_conv = false) { + $hex = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'); + $lines = preg_split('/(?:\r\n|\r|\n)/', $input); + $eol = "\r\n"; + $escape = '='; + $output = ''; + while( list(, $line) = each($lines) ) { + $linlen = strlen($line); + $newline = ''; + for($i = 0; $i < $linlen; $i++) { + $c = substr( $line, $i, 1 ); + $dec = ord( $c ); + if ( ( $i == 0 ) && ( $dec == 46 ) ) { // convert first point in the line into =2E + $c = '=2E'; + } + if ( $dec == 32 ) { + if ( $i == ( $linlen - 1 ) ) { // convert space at eol only + $c = '=20'; + } else if ( $space_conv ) { + $c = '=20'; + } + } elseif ( ($dec == 61) || ($dec < 32 ) || ($dec > 126) ) { // always encode "\t", which is *not* required + $h2 = floor($dec/16); + $h1 = floor($dec%16); + $c = $escape.$hex[$h2].$hex[$h1]; + } + if ( (strlen($newline) + strlen($c)) >= $line_max ) { // CRLF is not counted + $output .= $newline.$escape.$eol; // soft line break; " =\r\n" is okay + $newline = ''; + // check if newline first character will be point or not + if ( $dec == 46 ) { + $c = '=2E'; + } + } + $newline .= $c; + } // end of for + $output .= $newline.$eol; + } // end of while + return $output; + } + + /** + * Encode string to RFC2045 (6.7) quoted-printable format + * Uses a PHP5 stream filter to do the encoding about 64x faster than the old version + * Also results in same content as you started with after decoding + * @see EncodeQPphp() + * @access public + * @param string $string the text to encode + * @param integer $line_max Number of chars allowed on a line before wrapping + * @param boolean $space_conv Dummy param for compatibility with existing EncodeQP function + * @return string + * @author Marcus Bointon + */ + public function EncodeQP($string, $line_max = 76, $space_conv = false) { + if (function_exists('quoted_printable_encode')) { //Use native function if it's available (>= PHP5.3) + return quoted_printable_encode($string); + } + $filters = stream_get_filters(); + if (!in_array('convert.*', $filters)) { //Got convert stream filter? + return $this->EncodeQPphp($string, $line_max, $space_conv); //Fall back to old implementation + } + $fp = fopen('php://temp/', 'r+'); + $string = preg_replace('/\r\n?/', $this->LE, $string); //Normalise line breaks + $params = array('line-length' => $line_max, 'line-break-chars' => $this->LE); + $s = stream_filter_append($fp, 'convert.quoted-printable-encode', STREAM_FILTER_READ, $params); + fputs($fp, $string); + rewind($fp); + $out = stream_get_contents($fp); + stream_filter_remove($s); + $out = preg_replace('/^\./m', '=2E', $out); //Encode . if it is first char on a line, workaround for bug in Exchange + fclose($fp); + return $out; + } + + /** + * Encode string to q encoding. + * @link http://tools.ietf.org/html/rfc2047 + * @param string $str the text to encode + * @param string $position Where the text is going to be used, see the RFC for what that means + * @access public + * @return string + */ + public function EncodeQ ($str, $position = 'text') { + // There should not be any EOL in the string + $encoded = preg_replace('/[\r\n]*/', '', $str); + + switch (strtolower($position)) { + case 'phrase': + $encoded = preg_replace("/([^A-Za-z0-9!*+\/ -])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded); + break; + case 'comment': + $encoded = preg_replace("/([\(\)\"])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded); + case 'text': + default: + // Replace every high ascii, control =, ? and _ characters + //TODO using /e (equivalent to eval()) is probably not a good idea + $encoded = preg_replace('/([\000-\011\013\014\016-\037\075\077\137\177-\377])/e', + "'='.sprintf('%02X', ord('\\1'))", $encoded); + break; + } + + // Replace every spaces to _ (more readable than =20) + $encoded = str_replace(' ', '_', $encoded); + + return $encoded; + } + + /** + * Adds a string or binary attachment (non-filesystem) to the list. + * This method can be used to attach ascii or binary data, + * such as a BLOB record from a database. + * @param string $string String attachment data. + * @param string $filename Name of the attachment. + * @param string $encoding File encoding (see $Encoding). + * @param string $type File extension (MIME) type. + * @return void + */ + public function AddStringAttachment($string, $filename, $encoding = 'base64', $type = 'application/octet-stream') { + // Append to $attachment array + $this->attachment[] = array( + 0 => $string, + 1 => $filename, + 2 => $filename, + 3 => $encoding, + 4 => $type, + 5 => true, // isStringAttachment + 6 => 'attachment', + 7 => 0 + ); + } + + /** + * Adds an embedded attachment. This can include images, sounds, and + * just about any other document. Make sure to set the $type to an + * image type. For JPEG images use "image/jpeg" and for GIF images + * use "image/gif". + * @param string $path Path to the attachment. + * @param string $cid Content ID of the attachment. Use this to identify + * the Id for accessing the image in an HTML form. + * @param string $name Overrides the attachment name. + * @param string $encoding File encoding (see $Encoding). + * @param string $type File extension (MIME) type. + * @return bool + */ + public function AddEmbeddedImage($path, $cid, $name = '', $encoding = 'base64', $type = 'application/octet-stream') { + + if ( !@is_file($path) ) { + $this->SetError($this->Lang('file_access') . $path); + return false; + } + + $filename = basename($path); + if ( $name == '' ) { + $name = $filename; + } + + // Append to $attachment array + $this->attachment[] = array( + 0 => $path, + 1 => $filename, + 2 => $name, + 3 => $encoding, + 4 => $type, + 5 => false, // isStringAttachment + 6 => 'inline', + 7 => $cid + ); + + return true; + } + + /** + * Returns true if an inline attachment is present. + * @access public + * @return bool + */ + public function InlineImageExists() { + foreach($this->attachment as $attachment) { + if ($attachment[6] == 'inline') { + return true; + } + } + return false; + } + + ///////////////////////////////////////////////// + // CLASS METHODS, MESSAGE RESET + ///////////////////////////////////////////////// + + /** + * Clears all recipients assigned in the TO array. Returns void. + * @return void + */ + public function ClearAddresses() { + foreach($this->to as $to) { + unset($this->all_recipients[strtolower($to[0])]); + } + $this->to = array(); + } + + /** + * Clears all recipients assigned in the CC array. Returns void. + * @return void + */ + public function ClearCCs() { + foreach($this->cc as $cc) { + unset($this->all_recipients[strtolower($cc[0])]); + } + $this->cc = array(); + } + + /** + * Clears all recipients assigned in the BCC array. Returns void. + * @return void + */ + public function ClearBCCs() { + foreach($this->bcc as $bcc) { + unset($this->all_recipients[strtolower($bcc[0])]); + } + $this->bcc = array(); + } + + /** + * Clears all recipients assigned in the ReplyTo array. Returns void. + * @return void + */ + public function ClearReplyTos() { + $this->ReplyTo = array(); + } + + /** + * Clears all recipients assigned in the TO, CC and BCC + * array. Returns void. + * @return void + */ + public function ClearAllRecipients() { + $this->to = array(); + $this->cc = array(); + $this->bcc = array(); + $this->all_recipients = array(); + } + + /** + * Clears all previously set filesystem, string, and binary + * attachments. Returns void. + * @return void + */ + public function ClearAttachments() { + $this->attachment = array(); + } + + /** + * Clears all custom headers. Returns void. + * @return void + */ + public function ClearCustomHeaders() { + $this->CustomHeader = array(); + } + + ///////////////////////////////////////////////// + // CLASS METHODS, MISCELLANEOUS + ///////////////////////////////////////////////// + + /** + * Adds the error message to the error container. + * @access protected + * @return void + */ + protected function SetError($msg) { + $this->error_count++; + if ($this->Mailer == 'smtp' and !is_null($this->smtp)) { + $lasterror = $this->smtp->getError(); + if (!empty($lasterror) and array_key_exists('smtp_msg', $lasterror)) { + $msg .= '

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

\n"; + } + } + $this->ErrorInfo = $msg; + } + + /** + * Returns the proper RFC 822 formatted date. + * @access public + * @return string + * @static + */ + public static function RFCDate() { + $tz = date('Z'); + $tzs = ($tz < 0) ? '-' : '+'; + $tz = abs($tz); + $tz = (int)($tz/3600)*100 + ($tz%3600)/60; + $result = sprintf("%s %s%04d", date('D, j M Y H:i:s'), $tzs, $tz); + + return $result; + } + + /** + * Returns the server hostname or 'localhost.localdomain' if unknown. + * @access private + * @return string + */ + private function ServerHostname() { + if (!empty($this->Hostname)) { + $result = $this->Hostname; + } elseif (isset($_SERVER['SERVER_NAME'])) { + $result = $_SERVER['SERVER_NAME']; + } else { + $result = 'localhost.localdomain'; + } + + return $result; + } + + /** + * Returns a message in the appropriate language. + * @access private + * @return string + */ + private function Lang($key) { + if(count($this->language) < 1) { + $this->SetLanguage('en'); // set the default language + } + + if(isset($this->language[$key])) { + return $this->language[$key]; + } else { + return 'Language string failed to load: ' . $key; + } + } + + /** + * Returns true if an error occurred. + * @access public + * @return bool + */ + public function IsError() { + return ($this->error_count > 0); + } + + /** + * Changes every end of line from CR or LF to CRLF. + * @access private + * @return string + */ + private function FixEOL($str) { + $str = str_replace("\r\n", "\n", $str); + $str = str_replace("\r", "\n", $str); + $str = str_replace("\n", $this->LE, $str); + return $str; + } + + /** + * Adds a custom header. + * @access public + * @return void + */ + public function AddCustomHeader($custom_header) { + $this->CustomHeader[] = explode(':', $custom_header, 2); + } + + /** + * Evaluates the message and returns modifications for inline images and backgrounds + * @access public + * @return $message + */ + public function MsgHTML($message, $basedir = '') { + preg_match_all("/(src|background)=\"(.*)\"/Ui", $message, $images); + if(isset($images[2])) { + foreach($images[2] as $i => $url) { + // do not change urls for absolute images (thanks to corvuscorax) + if (!preg_match('#^[A-z]+://#',$url)) { + $filename = basename($url); + $directory = dirname($url); + ($directory == '.')?$directory='':''; + $cid = 'cid:' . md5($filename); + $ext = pathinfo($filename, PATHINFO_EXTENSION); + $mimeType = self::_mime_types($ext); + if ( strlen($basedir) > 1 && substr($basedir,-1) != '/') { $basedir .= '/'; } + if ( strlen($directory) > 1 && substr($directory,-1) != '/') { $directory .= '/'; } + if ( $this->AddEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64',$mimeType) ) { + $message = preg_replace("/".$images[1][$i]."=\"".preg_quote($url, '/')."\"/Ui", $images[1][$i]."=\"".$cid."\"", $message); + } + } + } + } + $this->IsHTML(true); + $this->Body = $message; + $textMsg = trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/s','',$message))); + if (!empty($textMsg) && empty($this->AltBody)) { + $this->AltBody = html_entity_decode($textMsg); + } + if (empty($this->AltBody)) { + $this->AltBody = 'To view this email message, open it in a program that understands HTML!' . "\n\n"; + } + } + + /** + * Gets the MIME type of the embedded or inline image + * @param string File extension + * @access public + * @return string MIME type of ext + * @static + */ + public static function _mime_types($ext = '') { + $mimes = array( + 'hqx' => 'application/mac-binhex40', + 'cpt' => 'application/mac-compactpro', + 'doc' => 'application/msword', + 'bin' => 'application/macbinary', + 'dms' => 'application/octet-stream', + 'lha' => 'application/octet-stream', + 'lzh' => 'application/octet-stream', + 'exe' => 'application/octet-stream', + 'class' => 'application/octet-stream', + 'psd' => 'application/octet-stream', + 'so' => 'application/octet-stream', + 'sea' => 'application/octet-stream', + 'dll' => 'application/octet-stream', + 'oda' => 'application/oda', + 'pdf' => 'application/pdf', + 'ai' => 'application/postscript', + 'eps' => 'application/postscript', + 'ps' => 'application/postscript', + 'smi' => 'application/smil', + 'smil' => 'application/smil', + 'mif' => 'application/vnd.mif', + 'xls' => 'application/vnd.ms-excel', + 'ppt' => 'application/vnd.ms-powerpoint', + 'wbxml' => 'application/vnd.wap.wbxml', + 'wmlc' => 'application/vnd.wap.wmlc', + 'dcr' => 'application/x-director', + 'dir' => 'application/x-director', + 'dxr' => 'application/x-director', + 'dvi' => 'application/x-dvi', + 'gtar' => 'application/x-gtar', + 'php' => 'application/x-httpd-php', + 'php4' => 'application/x-httpd-php', + 'php3' => 'application/x-httpd-php', + 'phtml' => 'application/x-httpd-php', + 'phps' => 'application/x-httpd-php-source', + 'js' => 'application/x-javascript', + 'swf' => 'application/x-shockwave-flash', + 'sit' => 'application/x-stuffit', + 'tar' => 'application/x-tar', + 'tgz' => 'application/x-tar', + 'xhtml' => 'application/xhtml+xml', + 'xht' => 'application/xhtml+xml', + 'zip' => 'application/zip', + 'mid' => 'audio/midi', + 'midi' => 'audio/midi', + 'mpga' => 'audio/mpeg', + 'mp2' => 'audio/mpeg', + 'mp3' => 'audio/mpeg', + 'aif' => 'audio/x-aiff', + 'aiff' => 'audio/x-aiff', + 'aifc' => 'audio/x-aiff', + 'ram' => 'audio/x-pn-realaudio', + 'rm' => 'audio/x-pn-realaudio', + 'rpm' => 'audio/x-pn-realaudio-plugin', + 'ra' => 'audio/x-realaudio', + 'rv' => 'video/vnd.rn-realvideo', + 'wav' => 'audio/x-wav', + 'bmp' => 'image/bmp', + 'gif' => 'image/gif', + 'jpeg' => 'image/jpeg', + 'jpg' => 'image/jpeg', + 'jpe' => 'image/jpeg', + 'png' => 'image/png', + 'tiff' => 'image/tiff', + 'tif' => 'image/tiff', + 'css' => 'text/css', + 'html' => 'text/html', + 'htm' => 'text/html', + 'shtml' => 'text/html', + 'txt' => 'text/plain', + 'text' => 'text/plain', + 'log' => 'text/plain', + 'rtx' => 'text/richtext', + 'rtf' => 'text/rtf', + 'xml' => 'text/xml', + 'xsl' => 'text/xml', + 'mpeg' => 'video/mpeg', + 'mpg' => 'video/mpeg', + 'mpe' => 'video/mpeg', + 'qt' => 'video/quicktime', + 'mov' => 'video/quicktime', + 'avi' => 'video/x-msvideo', + 'movie' => 'video/x-sgi-movie', + 'doc' => 'application/msword', + 'word' => 'application/msword', + 'xl' => 'application/excel', + 'eml' => 'message/rfc822' + ); + return (!isset($mimes[strtolower($ext)])) ? 'application/octet-stream' : $mimes[strtolower($ext)]; + } + + /** + * Set (or reset) Class Objects (variables) + * + * Usage Example: + * $page->set('X-Priority', '3'); + * + * @access public + * @param string $name Parameter Name + * @param mixed $value Parameter Value + * NOTE: will not work with arrays, there are no arrays to set/reset + * @todo Should this not be using __set() magic function? + */ + public function set($name, $value = '') { + try { + if (isset($this->$name) ) { + $this->$name = $value; + } else { + throw new phpmailerException($this->Lang('variable_set') . $name, self::STOP_CRITICAL); + } + } catch (Exception $e) { + $this->SetError($e->getMessage()); + if ($e->getCode() == self::STOP_CRITICAL) { + return false; + } + } + return true; + } + + /** + * Strips newlines to prevent header injection. + * @access public + * @param string $str String + * @return string + */ + public function SecureHeader($str) { + $str = str_replace("\r", '', $str); + $str = str_replace("\n", '', $str); + return trim($str); + } + + /** + * Set the private key file and password to sign the message. + * + * @access public + * @param string $key_filename Parameter File Name + * @param string $key_pass Password for private key + */ + public function Sign($cert_filename, $key_filename, $key_pass) { + $this->sign_cert_file = $cert_filename; + $this->sign_key_file = $key_filename; + $this->sign_key_pass = $key_pass; + } +} + +class phpmailerException extends Exception { + public function errorMessage() { + $errorMsg = '' . $this->getMessage() . "
\n"; + return $errorMsg; + } +} +?> \ No newline at end of file diff --git a/src/server/base/phpmailer/class.pop3.php b/src/server/base/phpmailer/class.pop3.php new file mode 100644 index 0000000..de6e584 --- /dev/null +++ b/src/server/base/phpmailer/class.pop3.php @@ -0,0 +1,407 @@ +pop_conn = 0; + $this->connected = false; + $this->error = null; + } + + /** + * Combination of public events - connect, login, disconnect + * @access public + * @param string $host + * @param integer $port + * @param integer $tval + * @param string $username + * @param string $password + */ + public function Authorise ($host, $port = false, $tval = false, $username, $password, $debug_level = 0) { + $this->host = $host; + + // If no port value is passed, retrieve it + if ($port == false) { + $this->port = $this->POP3_PORT; + } else { + $this->port = $port; + } + + // If no port value is passed, retrieve it + if ($tval == false) { + $this->tval = $this->POP3_TIMEOUT; + } else { + $this->tval = $tval; + } + + $this->do_debug = $debug_level; + $this->username = $username; + $this->password = $password; + + // Refresh the error log + $this->error = null; + + // Connect + $result = $this->Connect($this->host, $this->port, $this->tval); + + if ($result) { + $login_result = $this->Login($this->username, $this->password); + + if ($login_result) { + $this->Disconnect(); + + return true; + } + + } + + // We need to disconnect regardless if the login succeeded + $this->Disconnect(); + + return false; + } + + /** + * Connect to the POP3 server + * @access public + * @param string $host + * @param integer $port + * @param integer $tval + * @return boolean + */ + public function Connect ($host, $port = false, $tval = 30) { + // Are we already connected? + if ($this->connected) { + return true; + } + + /* + On Windows this will raise a PHP Warning error if the hostname doesn't exist. + Rather than supress it with @fsockopen, let's capture it cleanly instead + */ + + set_error_handler(array(&$this, 'catchWarning')); + + // Connect to the POP3 server + $this->pop_conn = fsockopen($host, // POP3 Host + $port, // Port # + $errno, // Error Number + $errstr, // Error Message + $tval); // Timeout (seconds) + + // Restore the error handler + restore_error_handler(); + + // Does the Error Log now contain anything? + if ($this->error && $this->do_debug >= 1) { + $this->displayErrors(); + } + + // Did we connect? + if ($this->pop_conn == false) { + // It would appear not... + $this->error = array( + 'error' => "Failed to connect to server $host on port $port", + 'errno' => $errno, + 'errstr' => $errstr + ); + + if ($this->do_debug >= 1) { + $this->displayErrors(); + } + + return false; + } + + // Increase the stream time-out + + // Check for PHP 4.3.0 or later + if (version_compare(phpversion(), '5.0.0', 'ge')) { + stream_set_timeout($this->pop_conn, $tval, 0); + } else { + // Does not work on Windows + if (substr(PHP_OS, 0, 3) !== 'WIN') { + socket_set_timeout($this->pop_conn, $tval, 0); + } + } + + // Get the POP3 server response + $pop3_response = $this->getResponse(); + + // Check for the +OK + if ($this->checkResponse($pop3_response)) { + // The connection is established and the POP3 server is talking + $this->connected = true; + return true; + } + + } + + /** + * Login to the POP3 server (does not support APOP yet) + * @access public + * @param string $username + * @param string $password + * @return boolean + */ + public function Login ($username = '', $password = '') { + if ($this->connected == false) { + $this->error = 'Not connected to POP3 server'; + + if ($this->do_debug >= 1) { + $this->displayErrors(); + } + } + + if (empty($username)) { + $username = $this->username; + } + + if (empty($password)) { + $password = $this->password; + } + + $pop_username = "USER $username" . $this->CRLF; + $pop_password = "PASS $password" . $this->CRLF; + + // Send the Username + $this->sendString($pop_username); + $pop3_response = $this->getResponse(); + + if ($this->checkResponse($pop3_response)) { + // Send the Password + $this->sendString($pop_password); + $pop3_response = $this->getResponse(); + + if ($this->checkResponse($pop3_response)) { + return true; + } else { + return false; + } + } else { + return false; + } + } + + /** + * Disconnect from the POP3 server + * @access public + */ + public function Disconnect () { + $this->sendString('QUIT'); + + fclose($this->pop_conn); + } + + ///////////////////////////////////////////////// + // Private Methods + ///////////////////////////////////////////////// + + /** + * Get the socket response back. + * $size is the maximum number of bytes to retrieve + * @access private + * @param integer $size + * @return string + */ + private function getResponse ($size = 128) { + $pop3_response = fgets($this->pop_conn, $size); + + return $pop3_response; + } + + /** + * Send a string down the open socket connection to the POP3 server + * @access private + * @param string $string + * @return integer + */ + private function sendString ($string) { + $bytes_sent = fwrite($this->pop_conn, $string, strlen($string)); + + return $bytes_sent; + } + + /** + * Checks the POP3 server response for +OK or -ERR + * @access private + * @param string $string + * @return boolean + */ + private function checkResponse ($string) { + if (substr($string, 0, 3) !== '+OK') { + $this->error = array( + 'error' => "Server reported an error: $string", + 'errno' => 0, + 'errstr' => '' + ); + + if ($this->do_debug >= 1) { + $this->displayErrors(); + } + + return false; + } else { + return true; + } + + } + + /** + * If debug is enabled, display the error message array + * @access private + */ + private function displayErrors () { + echo '
';
+
+    foreach ($this->error as $single_error) {
+      print_r($single_error);
+    }
+
+    echo '
'; + } + + /** + * Takes over from PHP for the socket warning handler + * @access private + * @param integer $errno + * @param string $errstr + * @param string $errfile + * @param integer $errline + */ + private function catchWarning ($errno, $errstr, $errfile, $errline) { + $this->error[] = array( + 'error' => "Connecting to the POP3 server raised a PHP warning: ", + 'errno' => $errno, + 'errstr' => $errstr + ); + } + + // End of class +} +?> \ No newline at end of file diff --git a/src/server/base/phpmailer/class.smtp.php b/src/server/base/phpmailer/class.smtp.php new file mode 100644 index 0000000..fa84f3c --- /dev/null +++ b/src/server/base/phpmailer/class.smtp.php @@ -0,0 +1,814 @@ +smtp_conn = 0; + $this->error = null; + $this->helo_rply = null; + + $this->do_debug = 0; + } + + ///////////////////////////////////////////////// + // CONNECTION FUNCTIONS + ///////////////////////////////////////////////// + + /** + * Connect to the server specified on the port specified. + * If the port is not specified use the default SMTP_PORT. + * If tval is specified then a connection will try and be + * established with the server for that number of seconds. + * If tval is not specified the default is 30 seconds to + * try on the connection. + * + * SMTP CODE SUCCESS: 220 + * SMTP CODE FAILURE: 421 + * @access public + * @return bool + */ + public function Connect($host, $port = 0, $tval = 30) { + // set the error val to null so there is no confusion + $this->error = null; + + // make sure we are __not__ connected + if($this->connected()) { + // already connected, generate error + $this->error = array("error" => "Already connected to a server"); + return false; + } + + if(empty($port)) { + $port = $this->SMTP_PORT; + } + + // connect to the smtp server + $this->smtp_conn = @fsockopen($host, // the host of the server + $port, // the port to use + $errno, // error number if any + $errstr, // error message if any + $tval); // give up after ? secs + // verify we connected properly + if(empty($this->smtp_conn)) { + $this->error = array("error" => "Failed to connect to server", + "errno" => $errno, + "errstr" => $errstr); + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $this->error["error"] . ": $errstr ($errno)" . $this->CRLF . '
'; + } + return false; + } + + // SMTP server can take longer to respond, give longer timeout for first read + // Windows does not have support for this timeout function + if(substr(PHP_OS, 0, 3) != "WIN") + socket_set_timeout($this->smtp_conn, $tval, 0); + + // get any announcement + $announce = $this->get_lines(); + + if($this->do_debug >= 2) { + echo "SMTP -> FROM SERVER:" . $announce . $this->CRLF . '
'; + } + + return true; + } + + /** + * Initiate a TLS communication with the server. + * + * SMTP CODE 220 Ready to start TLS + * SMTP CODE 501 Syntax error (no parameters allowed) + * SMTP CODE 454 TLS not available due to temporary reason + * @access public + * @return bool success + */ + public function StartTLS() { + $this->error = null; # to avoid confusion + + if(!$this->connected()) { + $this->error = array("error" => "Called StartTLS() without being connected"); + return false; + } + + fputs($this->smtp_conn,"STARTTLS" . $this->CRLF); + + $rply = $this->get_lines(); + $code = substr($rply,0,3); + + if($this->do_debug >= 2) { + echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '
'; + } + + if($code != 220) { + $this->error = + array("error" => "STARTTLS not accepted from server", + "smtp_code" => $code, + "smtp_msg" => substr($rply,4)); + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '
'; + } + return false; + } + + // Begin encrypted connection + if(!stream_socket_enable_crypto($this->smtp_conn, true, STREAM_CRYPTO_METHOD_TLS_CLIENT)) { + return false; + } + + return true; + } + + /** + * Performs SMTP authentication. Must be run after running the + * Hello() method. Returns true if successfully authenticated. + * @access public + * @return bool + */ + public function Authenticate($username, $password) { + // Start authentication + fputs($this->smtp_conn,"AUTH LOGIN" . $this->CRLF); + + $rply = $this->get_lines(); + $code = substr($rply,0,3); + + if($code != 334) { + $this->error = + array("error" => "AUTH not accepted from server", + "smtp_code" => $code, + "smtp_msg" => substr($rply,4)); + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '
'; + } + return false; + } + + // Send encoded username + fputs($this->smtp_conn, base64_encode($username) . $this->CRLF); + + $rply = $this->get_lines(); + $code = substr($rply,0,3); + + if($code != 334) { + $this->error = + array("error" => "Username not accepted from server", + "smtp_code" => $code, + "smtp_msg" => substr($rply,4)); + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '
'; + } + return false; + } + + // Send encoded password + fputs($this->smtp_conn, base64_encode($password) . $this->CRLF); + + $rply = $this->get_lines(); + $code = substr($rply,0,3); + + if($code != 235) { + $this->error = + array("error" => "Password not accepted from server", + "smtp_code" => $code, + "smtp_msg" => substr($rply,4)); + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '
'; + } + return false; + } + + return true; + } + + /** + * Returns true if connected to a server otherwise false + * @access public + * @return bool + */ + public function Connected() { + if(!empty($this->smtp_conn)) { + $sock_status = socket_get_status($this->smtp_conn); + if($sock_status["eof"]) { + // the socket is valid but we are not connected + if($this->do_debug >= 1) { + echo "SMTP -> NOTICE:" . $this->CRLF . "EOF caught while checking if connected"; + } + $this->Close(); + return false; + } + return true; // everything looks good + } + return false; + } + + /** + * Closes the socket and cleans up the state of the class. + * It is not considered good to use this function without + * first trying to use QUIT. + * @access public + * @return void + */ + public function Close() { + $this->error = null; // so there is no confusion + $this->helo_rply = null; + if(!empty($this->smtp_conn)) { + // close the connection and cleanup + fclose($this->smtp_conn); + $this->smtp_conn = 0; + } + } + + ///////////////////////////////////////////////// + // SMTP COMMANDS + ///////////////////////////////////////////////// + + /** + * Issues a data command and sends the msg_data to the server + * finializing the mail transaction. $msg_data is the message + * that is to be send with the headers. Each header needs to be + * on a single line followed by a with the message headers + * and the message body being seperated by and additional . + * + * Implements rfc 821: DATA + * + * SMTP CODE INTERMEDIATE: 354 + * [data] + * . + * SMTP CODE SUCCESS: 250 + * SMTP CODE FAILURE: 552,554,451,452 + * SMTP CODE FAILURE: 451,554 + * SMTP CODE ERROR : 500,501,503,421 + * @access public + * @return bool + */ + public function Data($msg_data) { + $this->error = null; // so no confusion is caused + + if(!$this->connected()) { + $this->error = array( + "error" => "Called Data() without being connected"); + return false; + } + + fputs($this->smtp_conn,"DATA" . $this->CRLF); + + $rply = $this->get_lines(); + $code = substr($rply,0,3); + + if($this->do_debug >= 2) { + echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '
'; + } + + if($code != 354) { + $this->error = + array("error" => "DATA command not accepted from server", + "smtp_code" => $code, + "smtp_msg" => substr($rply,4)); + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '
'; + } + return false; + } + + /* the server is ready to accept data! + * according to rfc 821 we should not send more than 1000 + * including the CRLF + * characters on a single line so we will break the data up + * into lines by \r and/or \n then if needed we will break + * each of those into smaller lines to fit within the limit. + * in addition we will be looking for lines that start with + * a period '.' and append and additional period '.' to that + * line. NOTE: this does not count towards limit. + */ + + // normalize the line breaks so we know the explode works + $msg_data = str_replace("\r\n","\n",$msg_data); + $msg_data = str_replace("\r","\n",$msg_data); + $lines = explode("\n",$msg_data); + + /* we need to find a good way to determine is headers are + * in the msg_data or if it is a straight msg body + * currently I am assuming rfc 822 definitions of msg headers + * and if the first field of the first line (':' sperated) + * does not contain a space then it _should_ be a header + * and we can process all lines before a blank "" line as + * headers. + */ + + $field = substr($lines[0],0,strpos($lines[0],":")); + $in_headers = false; + if(!empty($field) && !strstr($field," ")) { + $in_headers = true; + } + + $max_line_length = 998; // used below; set here for ease in change + + while(list(,$line) = @each($lines)) { + $lines_out = null; + if($line == "" && $in_headers) { + $in_headers = false; + } + // ok we need to break this line up into several smaller lines + while(strlen($line) > $max_line_length) { + $pos = strrpos(substr($line,0,$max_line_length)," "); + + // Patch to fix DOS attack + if(!$pos) { + $pos = $max_line_length - 1; + $lines_out[] = substr($line,0,$pos); + $line = substr($line,$pos); + } else { + $lines_out[] = substr($line,0,$pos); + $line = substr($line,$pos + 1); + } + + /* if processing headers add a LWSP-char to the front of new line + * rfc 822 on long msg headers + */ + if($in_headers) { + $line = "\t" . $line; + } + } + $lines_out[] = $line; + + // send the lines to the server + while(list(,$line_out) = @each($lines_out)) { + if(strlen($line_out) > 0) + { + if(substr($line_out, 0, 1) == ".") { + $line_out = "." . $line_out; + } + } + fputs($this->smtp_conn,$line_out . $this->CRLF); + } + } + + // message data has been sent + fputs($this->smtp_conn, $this->CRLF . "." . $this->CRLF); + + $rply = $this->get_lines(); + $code = substr($rply,0,3); + + if($this->do_debug >= 2) { + echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '
'; + } + + if($code != 250) { + $this->error = + array("error" => "DATA not accepted from server", + "smtp_code" => $code, + "smtp_msg" => substr($rply,4)); + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '
'; + } + return false; + } + return true; + } + + /** + * Sends the HELO command to the smtp server. + * This makes sure that we and the server are in + * the same known state. + * + * Implements from rfc 821: HELO + * + * SMTP CODE SUCCESS: 250 + * SMTP CODE ERROR : 500, 501, 504, 421 + * @access public + * @return bool + */ + public function Hello($host = '') { + $this->error = null; // so no confusion is caused + + if(!$this->connected()) { + $this->error = array( + "error" => "Called Hello() without being connected"); + return false; + } + + // if hostname for HELO was not specified send default + if(empty($host)) { + // determine appropriate default to send to server + $host = "localhost"; + } + + // Send extended hello first (RFC 2821) + if(!$this->SendHello("EHLO", $host)) { + if(!$this->SendHello("HELO", $host)) { + return false; + } + } + + return true; + } + + /** + * Sends a HELO/EHLO command. + * @access private + * @return bool + */ + private function SendHello($hello, $host) { + fputs($this->smtp_conn, $hello . " " . $host . $this->CRLF); + + $rply = $this->get_lines(); + $code = substr($rply,0,3); + + if($this->do_debug >= 2) { + echo "SMTP -> FROM SERVER: " . $rply . $this->CRLF . '
'; + } + + if($code != 250) { + $this->error = + array("error" => $hello . " not accepted from server", + "smtp_code" => $code, + "smtp_msg" => substr($rply,4)); + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '
'; + } + return false; + } + + $this->helo_rply = $rply; + + return true; + } + + /** + * Starts a mail transaction from the email address specified in + * $from. Returns true if successful or false otherwise. If True + * the mail transaction is started and then one or more Recipient + * commands may be called followed by a Data command. + * + * Implements rfc 821: MAIL FROM: + * + * SMTP CODE SUCCESS: 250 + * SMTP CODE SUCCESS: 552,451,452 + * SMTP CODE SUCCESS: 500,501,421 + * @access public + * @return bool + */ + public function Mail($from) { + $this->error = null; // so no confusion is caused + + if(!$this->connected()) { + $this->error = array( + "error" => "Called Mail() without being connected"); + return false; + } + + $useVerp = ($this->do_verp ? "XVERP" : ""); + fputs($this->smtp_conn,"MAIL FROM:<" . $from . ">" . $useVerp . $this->CRLF); + + $rply = $this->get_lines(); + $code = substr($rply,0,3); + + if($this->do_debug >= 2) { + echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '
'; + } + + if($code != 250) { + $this->error = + array("error" => "MAIL not accepted from server", + "smtp_code" => $code, + "smtp_msg" => substr($rply,4)); + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '
'; + } + return false; + } + return true; + } + + /** + * Sends the quit command to the server and then closes the socket + * if there is no error or the $close_on_error argument is true. + * + * Implements from rfc 821: QUIT + * + * SMTP CODE SUCCESS: 221 + * SMTP CODE ERROR : 500 + * @access public + * @return bool + */ + public function Quit($close_on_error = true) { + $this->error = null; // so there is no confusion + + if(!$this->connected()) { + $this->error = array( + "error" => "Called Quit() without being connected"); + return false; + } + + // send the quit command to the server + fputs($this->smtp_conn,"quit" . $this->CRLF); + + // get any good-bye messages + $byemsg = $this->get_lines(); + + if($this->do_debug >= 2) { + echo "SMTP -> FROM SERVER:" . $byemsg . $this->CRLF . '
'; + } + + $rval = true; + $e = null; + + $code = substr($byemsg,0,3); + if($code != 221) { + // use e as a tmp var cause Close will overwrite $this->error + $e = array("error" => "SMTP server rejected quit command", + "smtp_code" => $code, + "smtp_rply" => substr($byemsg,4)); + $rval = false; + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $e["error"] . ": " . $byemsg . $this->CRLF . '
'; + } + } + + if(empty($e) || $close_on_error) { + $this->Close(); + } + + return $rval; + } + + /** + * Sends the command RCPT to the SMTP server with the TO: argument of $to. + * Returns true if the recipient was accepted false if it was rejected. + * + * Implements from rfc 821: RCPT TO: + * + * SMTP CODE SUCCESS: 250,251 + * SMTP CODE FAILURE: 550,551,552,553,450,451,452 + * SMTP CODE ERROR : 500,501,503,421 + * @access public + * @return bool + */ + public function Recipient($to) { + $this->error = null; // so no confusion is caused + + if(!$this->connected()) { + $this->error = array( + "error" => "Called Recipient() without being connected"); + return false; + } + + fputs($this->smtp_conn,"RCPT TO:<" . $to . ">" . $this->CRLF); + + $rply = $this->get_lines(); + $code = substr($rply,0,3); + + if($this->do_debug >= 2) { + echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '
'; + } + + if($code != 250 && $code != 251) { + $this->error = + array("error" => "RCPT not accepted from server", + "smtp_code" => $code, + "smtp_msg" => substr($rply,4)); + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '
'; + } + return false; + } + return true; + } + + /** + * Sends the RSET command to abort and transaction that is + * currently in progress. Returns true if successful false + * otherwise. + * + * Implements rfc 821: RSET + * + * SMTP CODE SUCCESS: 250 + * SMTP CODE ERROR : 500,501,504,421 + * @access public + * @return bool + */ + public function Reset() { + $this->error = null; // so no confusion is caused + + if(!$this->connected()) { + $this->error = array( + "error" => "Called Reset() without being connected"); + return false; + } + + fputs($this->smtp_conn,"RSET" . $this->CRLF); + + $rply = $this->get_lines(); + $code = substr($rply,0,3); + + if($this->do_debug >= 2) { + echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '
'; + } + + if($code != 250) { + $this->error = + array("error" => "RSET failed", + "smtp_code" => $code, + "smtp_msg" => substr($rply,4)); + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '
'; + } + return false; + } + + return true; + } + + /** + * Starts a mail transaction from the email address specified in + * $from. Returns true if successful or false otherwise. If True + * the mail transaction is started and then one or more Recipient + * commands may be called followed by a Data command. This command + * will send the message to the users terminal if they are logged + * in and send them an email. + * + * Implements rfc 821: SAML FROM: + * + * SMTP CODE SUCCESS: 250 + * SMTP CODE SUCCESS: 552,451,452 + * SMTP CODE SUCCESS: 500,501,502,421 + * @access public + * @return bool + */ + public function SendAndMail($from) { + $this->error = null; // so no confusion is caused + + if(!$this->connected()) { + $this->error = array( + "error" => "Called SendAndMail() without being connected"); + return false; + } + + fputs($this->smtp_conn,"SAML FROM:" . $from . $this->CRLF); + + $rply = $this->get_lines(); + $code = substr($rply,0,3); + + if($this->do_debug >= 2) { + echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '
'; + } + + if($code != 250) { + $this->error = + array("error" => "SAML not accepted from server", + "smtp_code" => $code, + "smtp_msg" => substr($rply,4)); + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '
'; + } + return false; + } + return true; + } + + /** + * This is an optional command for SMTP that this class does not + * support. This method is here to make the RFC821 Definition + * complete for this class and __may__ be implimented in the future + * + * Implements from rfc 821: TURN + * + * SMTP CODE SUCCESS: 250 + * SMTP CODE FAILURE: 502 + * SMTP CODE ERROR : 500, 503 + * @access public + * @return bool + */ + public function Turn() { + $this->error = array("error" => "This method, TURN, of the SMTP ". + "is not implemented"); + if($this->do_debug >= 1) { + echo "SMTP -> NOTICE: " . $this->error["error"] . $this->CRLF . '
'; + } + return false; + } + + /** + * Get the current error + * @access public + * @return array + */ + public function getError() { + return $this->error; + } + + ///////////////////////////////////////////////// + // INTERNAL FUNCTIONS + ///////////////////////////////////////////////// + + /** + * Read in as many lines as possible + * either before eof or socket timeout occurs on the operation. + * With SMTP we can tell if we have more lines to read if the + * 4th character is '-' symbol. If it is a space then we don't + * need to read anything else. + * @access private + * @return string + */ + private function get_lines() { + $data = ""; + while($str = @fgets($this->smtp_conn,515)) { + if($this->do_debug >= 4) { + echo "SMTP -> get_lines(): \$data was \"$data\"" . $this->CRLF . '
'; + echo "SMTP -> get_lines(): \$str is \"$str\"" . $this->CRLF . '
'; + } + $data .= $str; + if($this->do_debug >= 4) { + echo "SMTP -> get_lines(): \$data is \"$data\"" . $this->CRLF . '
'; + } + // if 4th character is a space, we are done reading, break the loop + if(substr($str,3,1) == " ") { break; } + } + return $data; + } + +} + +?> \ No newline at end of file diff --git a/src/server/base/rss.inc.php b/src/server/base/rss.inc.php new file mode 100755 index 0000000..37aef6e --- /dev/null +++ b/src/server/base/rss.inc.php @@ -0,0 +1,284 @@ +NATS = &$NATS; +} + +function Create($name) +{ + mt_srand(microtime()*1000000); + $allow="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; + $alen=strlen($allow); + $key=""; + $len=32; + for ($a=0; $a<$len; $a++) + { + $key.=$allow[mt_rand(0,$alen-1)]; + } + $q="INSERT INTO fnrssfeed(feedkey,feedname, feedtype, feedrange, rangeopt) " + ."VALUES(\"".$key."\",\"".ss($name)."\",\"all\"" + .",\"xdays\",30)"; + $this->NATS->DB->Query($q); + + return $this->NATS->DB->Insert_Id(); +} + +function Delete($id) +{ + $q="DELETE FROM fnrssfeed WHERE feedid=".ss($id); + $this->NATS->DB->Query($q); +} + +function GetTypes() +{ + return array( + "all" => $this->NATS->Lang->Item("all.enabled.nodes"), + "node" => $this->NATS->Lang->Item("one.node"), + "group" => $this->NATS->Lang->Item("group") ); +} + +function GetRanges() +{ + return array( + "xdays" => $this->NATS->Lang->Item("last.x.days"), + "xalerts" => $this->NATS->Lang->Item("last.x.alerts"), + "alerts" => $this->NATS->Lang->Item("current.alerts"), + "alertnode" => $this->NATS->Lang->Item("last.alerts.node") ); +} + +function GetFeeds($id=0) +{ + $q="SELECT * FROM fnrssfeed"; + if ($id!=0) $q.=" WHERE feedid=".ss($id)." LIMIT 0,1"; + + $out=array(); + + $r=$this->NATS->DB->Query($q); + + $types=$this->GetTypes(); + $ranges=$this->GetRanges(); + + while ($row=$this->NATS->DB->Fetch_Array($r)) + { + $out[]=$row; + } + + $this->NATS->DB->Free($r); + + return $out; +} + +function GetFeed($id) +{ + $feeds = $this->GetFeeds($id); + if (count($feeds)>0) return $feeds[0]; + else return $feeds; +} + +function SaveFeed($id, $data) +{ + $q="UPDATE fnrssfeed SET "; + $first=true; + + foreach($data as $field => $value) + { + if ($first) $first=false; + else $q.=","; + $q.=ss($field)."=\"".ss($value)."\""; + } + $q.=" WHERE feedid=".ss($id); + + $this->NATS->DB->Query($q); + + if ($this->NATS->DB->Affected_Rows()<=0) return false; + else return true; +} + +function GetIdFromCompound($compound) +{ + $parts=explode("-",$compound); + $key=$parts[0]; + $id=$parts[1]; + + $q="SELECT feedid FROM fnrssfeed WHERE feedid=".ss($id)." AND feedkey=\"".ss($key)."\" LIMIT 0,1"; + $r=$this->NATS->DB->Query($q); + + if ($row=$this->NATS->DB->Fetch_Array($r)) + { + $this->NATS->DB->Free($r); + return $row['feedid']; + } + else return false; +} + +function GetCompound($id, $key="") +{ + if ($key=="") + { + $feed=$this->GetFeed($id); + $key=$feed['feedkey']; + } + return $key."-".$id; +} + +function GetURL($id, $key="") +{ + $compound=$this->GetCompound($id, $key); + return GetAbsolute("rss.php?feed=".$compound); +} + +function Item($title, $link, $published, $desc) +{ + $out="\n" + ."<![CDATA[".$title."]]>\n" + ."\n" + ."\n" + ."\n" + ."\n" + ."\n"; + return $out; +} + +function Render($id) +{ + $feed=$this->GetFeed($id); + if (count($feed)<=0) return false; + $out="\n"; + $out.="\n"; + $out.="\n"; + $out.="<![CDATA["; + if ($feed['feedname']!="") $out.=$feed['feedname']; + else $out.="FreeNATS RSS Feed"; + $out.="]]>\n"; + $me=GetAbsolute("rss.php?feed=".$_REQUEST['feed']); + $out.="".$me."\n"; + $out.="\n"; + $out.="FreeNATS RSS Feed\n"; + $out.="".date("D, d M Y H:i:s")." GMT\n"; + $out.="en-us\n"; + + switch($feed['feedtype']) + { + case "all": + $nodes=$this->NATS->GetNodes(); + break; + case "node": + $nodes=array(); + $nodes[]['nodeid']=$feed['typeopt']; + break; + case "group": + $nodes=array(); + $q="SELECT nodeid FROM fngrouplink WHERE groupid=".ss($feed['typeopt']); + $r=$this->NATS->DB->Query($q); + while ($row=$this->NATS->DB->Fetch_Array($r)) + { + $nodes[]=$NATS->GetNode($row['nodeid']); + } + $this->NATS->DB->Free($r); + break; + default: $nodes=array(); + } + + $inlist=""; + $first=true; + foreach($nodes as $node) + { + if ($first) $first=false; + else $inlist.=","; + $inlist.="\"".ss($node['nodeid'])."\""; + } + + $alerts=array(); + switch($feed['feedrange']) + { + case "xdays": + if (!is_numeric($feed['rangeopt'])) $days=30; + else $days=$feed['rangeopt']; + $secs = $days * 24 * 60 * 60; + $from = time() - $secs; + $q="SELECT * FROM fnalert WHERE (closedx=0 OR closedx>".$from.") AND nodeid IN (".$inlist.") ORDER BY LENGTH(closedx) ASC, closedx DESC"; + break; + + case "xalerts": + if (!is_numeric($feed['rangeopt'])) $acount=30; + else $acount=$feed['rangeopt']; + $q="SELECT * FROM fnalert WHERE nodeid IN(".$inlist.") ORDER BY LENGTH(closedx) ASC, closedx DESC LIMIT 0,".$acount; + break; + + case "alerts": + $q="SELECT * FROM fnalert WHERE closedx=0 AND nodeid IN(".$inlist.")"; + break; + + case "alertnode": + $q=array(); + foreach($nodes as $node) + { + $q[]="SELECT * FROM fnalert WHERE nodeid=\"".ss($node['nodeid'])."\" ORDER BY LENGTH(closedx) ASC, closedx DESC LIMIT 0,1"; + } + break; + + } + if (!is_array($q)) $q=array($q); + foreach($q as $query) + { + $r=$this->NATS->DB->Query($query); + while ($row=$this->NATS->DB->Fetch_Array($r)) + { + $alerts[]=$row; + } + $this->NATS->DB->Free($r); + } + + foreach($alerts as $alert) + { + $title=$alert['nodeid']." ".$this->NATS->Lang->Item("alert"); + if ($alert['closedx']!=0) $title.=" (".$this->NATS->Lang->Item("closed").")"; + else $title.=" (".$this->NATS->Lang->Item("open").")"; + $link=GetAbsolute("node.php?nodeid=".$alert['nodeid']); + if ($alert['closedx']==0) $pubtime=$alert['openedx']; + else $pubtime=$alert['closedx']; + $pub=date("D, d M Y H:i:s",$pubtime)." GMT"; + + $q="SELECT logentry FROM fnalertlog WHERE alertid=".$alert['alertid']." ORDER BY alid ASC LIMIT 0,1"; + $r=$this->NATS->DB->Query($q); + if ($row=$this->NATS->DB->Fetch_Array($r)) $desc=$row['logentry']; + else $desc=""; + $this->NATS->DB->Free($r); + + $out.=$this->Item($title, $link, $pub, $desc); + } + + $out.="\n\n"; + + return $out; +} + + +} +?> \ No newline at end of file diff --git a/src/server/base/schedule.inc.php b/src/server/base/schedule.inc.php new file mode 100755 index 0000000..9d3db37 --- /dev/null +++ b/src/server/base/schedule.inc.php @@ -0,0 +1,101 @@ +0) + if ($period['monthofyear'] != $month) return false; + +if ($period['year']>0) + if ($period['year'] != $year) return false; + +if ($period['dayofmonth']>0) + if ($period['dayofmonth'] != $day) return false; + +// check against start/finish times + +if ($period['starthour'] > $hour) return false; // not yet the hour +if ( ($period['starthour']==$hour)&&($period['startmin']>$min) ) return false; // hour but not yet the minute + +if ($period['finishhour'] < $hour) return false; // past the finish hour +if ( ($period['finishhour']==$hour)&&($period['finishmin']<$min) ) return false; // finish hour equal but mins past + +// all non-range either match or universal - after or equal to start and equal or before finish so... +return true; +} + +function run_x_in_schedule($timex,$scheduleid) // note this is not is_x_in_schedule as we want to take into account default action! +{ +global $NATS; +if ($scheduleid==0) return true; // always run schedule +if ($scheduleid<0) return false; // never run schedule +$q="SELECT defaultaction FROM fnschedule WHERE scheduleid=".ss($scheduleid)." LIMIT 0,1"; +$r=$NATS->DB->Query($q); +if ($NATS->DB->Num_Rows($r)<=0) return true; // illegal schedule id so YES run +$srow=$NATS->DB->Fetch_Array($r); +if ($srow['defaultaction']==0) $default=false; +else $default=true; +$NATS->DB->Free($r); + +$q="SELECT * FROM fnscheditem WHERE scheduleid=".ss($scheduleid); +$match=false; + +$r=$NATS->DB->Query($q); +while ( ($row=$NATS->DB->Fetch_Array($r))&&(!$match) ) + { + $match=is_x_in_period($timex,$row); + } +$NATS->DB->Free($r); + +if ($match) // found in the schedule list so do the reverse of default + { + if ($default) return false; + else return true; + } +else // not found in schedule + return $default; // so use the default +} + +?> \ No newline at end of file diff --git a/src/server/base/screen.inc.php b/src/server/base/screen.inc.php new file mode 100755 index 0000000..dd033ea --- /dev/null +++ b/src/server/base/screen.inc.php @@ -0,0 +1,647 @@ +".$NATS->Lang->Item("homepage").""; +$menu[1]="".$NATS->Lang->Item("live.monitor")."   ".$NATS->Lang->Item("configuration")."   "; +$menu[1].="".$NATS->Lang->Item("help")."   ".$NATS->Lang->Item("logout").""; +$menu[2]=$menu[1]."   Admin"; + +$menu[3]="".$NATS->Lang->Item("iphone")."   ".$NATS->Lang->Item("homepage").""; +/* +$pagemenu['main']="Overview   Nodes   "; +$pagemenu['main'].="Groups   Views & Reports   "; +$pagemenu['main'].="User Options"; +*/ +$pagemenu=array(); +$pagemenu['main']=array( + array("overview","main.php?mode=overview",$NATS->Lang->Item("overview")), + array("nodes","main.php?mode=nodes",$NATS->Lang->Item("nodes")), + array("groups","main.php?mode=groups",$NATS->Lang->Item("groups")), + array("views","main.php?mode=views",$NATS->Lang->Item("views.reports")), + array("pref","pref.php?mode=pref",$NATS->Lang->Item("user.options")), + array("admin","admin.php",$NATS->Lang->Item("system.settings")) ); + +function PageMenu($name,$mode="") +{ +global $pagemenu; +if (($mode=="")&&isset($_REQUEST['mode'])) $mode=$_REQUEST['mode']; +$out=""; +$first=true; +foreach($pagemenu[$name] as $opt) + { + if ($first) $first=false; + else $out.=" "; + if ($mode!=$opt[0]) $out.=" "; + else $out.=" "; + $out.=$opt[2]; + if ($mode!=$opt[0]) $out.="  "; + else $out.=" "; + } +return $out; +} + +$poplist=array(); + +function Screen_Header($title,$menuindex=0,$alertpane=0,$ah="",$pagemenu="",$pagemenumode="") +{ +global $menu,$NATS,$NATS_Session; +if ($NATS->Cfg->Get("site.enable.interactive")!=1) + { + echo "Sorry but FreeNATS interactive is disabled.
"; + echo "site.enable.interactive != 1

"; + echo "To resolve this issue your system administrator needs to set the FreeNATS system variable site.enable.interactive to 1.

"; + $NATS->Stop(); + exit(); + } +if ($menuindex==1) $alertpane=1; // bodge + +if ( ($menuindex==1) && ($pagemenu=="main") ) $secCheckFirstrun=true; +else $secCheckFirstrun=false; // KLUDGE + +//if ($NATS_Session->userlevel>9) $menuindex=2; // further bodge! +echo ""; +echo "FreeNATS: ".$title."\n"; +echo "\n"; +echo "\n"; +/* +echo "\n"; +*/ +if ($ah!="") echo $ah; +echo "\n"; +echo "\n"; + +echo ""; + +echo "\n"; +echo "\n"; +echo "\n"; +//echo ""; +//echo "\n"; +echo "
\n"; +echo "".$title.""; +if ($pagemenu!="") echo "
  ".PageMenu($pagemenu,$pagemenumode).""; +echo "
\n"; +echo $menu[$menuindex]; +echo " 
\n"; + +if ($secCheckFirstrun && ( $NATS->Cfg->Get("site.firstrun.ignore",0) != 1 ) ) + { + if (file_exists("firstrun.php")) + { + echo "
"; + echo "".$NATS->Lang->Item("sec.firstrun")."
"; + echo $NATS->Lang->Item("sec.firstrun.text")."
"; + echo $NATS->Lang->Item("sec.firstrun.ignore")."
"; + echo "http://www.purplepixie.org/freenats/wiki/Firstrun_Warning"; + + echo "
"; + } + } + + +if ($alertpane==1) + { + $alerts=$NATS->GetAlerts(); + if (is_array($alerts)) + { + echo "
"; + echo "".$NATS->Lang->Item("nats.alerts")."

"; + foreach($alerts as $alert) + { + echo " "; + echo "".$alert['nodeid']."
"; + } + echo "
"; + echo "
"; + } + } + +} + +function Start_Round($title,$width="") +{ +if ($width!="") $w=" width=".$width; +else $w=""; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; + +echo "
\n"; +echo $title; +echo "\n
\n"; +} + +function End_Round() +{ +echo "\n
"; +} + +function Screen_Footer($track_if_enabled=true) +{ +global $NATS,$poplist; +echo "

\n"; +//$NATS->Cfg->DumpToScreen(); +echo "
"; +echo "
"; + +echo "
FreeNATS; © ".$NATS->Lang->Item("copyright")." 2008-2011 "; +echo "PurplePixie Systems"; +echo "
"; +echo $NATS->Lang->Item("version").": ".$NATS->Version; +if ($NATS->Release!="") echo "/".$NATS->Release; +echo "  
"; + +//echo "Hello"; +echo "
"; +echo "
"; +if (ini_get("freenats.rpath")==1) + { + echo "FreeNATS Virtual Server Powered By rPath LAMP Appliance
"; + } +//echo "This is alpha-test software - we would very much value your "; +//echo "feedback
"; + +$autofeedback=false; +if ($track_if_enabled) + { + $t=$NATS->Cfg->Get("freenats.tracker"); + if ( ($t!="") && ($t>0) ) + { + $autofeedback=true; + $usid=$NATS->Cfg->Get("freenats.tracker.usid",""); + if ($usid=="") + { // generate usid if not already set + // usid form XYZ-XYZ-XYZ... + $allow="abcdef0123456789"; + $allow_len=strlen($allow); + mt_srand(microtime()*1000000); + $first_set=1; + for ($a=0; $a<5; $a++) // blocks + { + if ($first_set==1) $first_set=0; + else $usid.="-"; + for ($b=0; $b<10; $b++) + { + $c=mt_rand(0,$allow_len-1); + $usid.=$allow[$c]; + } + } + $NATS->Cfg->Set("freenats.tracker.usid",$usid); + } + + // get some more data + $sn=explode("/",$_SERVER['SCRIPT_NAME']); + $script=$sn[count($sn)-1]; + + // show tracking image + echo "Version."+p=".$script."&type=ping&usid=".$usid."\" width=1 height=1>\n"; + } + } + +//$NATS->PageError("fish","swim in the sea"); +//$NATS->PageError("dogs","walk on the land"); +//$autofeedback=true; + +if (count($NATS->PageErrors)>0) // page errors reported + { + echo "
\n"; + echo "Errors detected on page: "; + $url=""; + $counter=0; + foreach($NATS->PageErrors as $PageError) + { + if ($counter>0) $url.="&"; + $url.="code[".$counter."]=".urlencode($PageError['code'])."&desc[".$counter."]=".urlencode($PageError['desc']); + $counter++; + } + $url.="&ver=".$NATS->Version; + + echo ""; + + echo ""; + if ($autofeedback) + { + echo "Reporting..."; + } + else + { + echo "Click to report to PurplePixie | "; + //echo "Click to show/hide details"; + } + echo "  "; + echo "Click to show/hide details"; + echo "
\n"; + foreach($NATS->PageErrors as $PageError) + { + echo "# ".$PageError['code']." : ".$PageError['desc']."
\n"; + } + echo "
"; + echo "
\n"; + + if ($autofeedback) + { + //echo "\n"; + echo "\n"; + } + + } + +if ($NATS->Cfg->Get("site.popupmessage")=="1") + { + if (count($poplist)>0) + { + echo "\n\n"; + } + } +echo "\n\n"; +} + +function UL_Error($task="") +{ +global $NATS; +Screen_Header($NATS->Lang->Item("access.error")); +echo "
".$NATS->Lang->Item("access.error.detail")." (".$task.").

"; +echo "".$NATS->Lang->Item("click.continue")."

"; +Screen_Footer(); +exit(); +} + +function Session_Error() +{ +global $REQUEST_URI; +header("Location: ./?login_msg=Invalid+or+Expired+Session&url=".urlencode($REQUEST_URI)); +exit(); +} + +function nicedt($ts) +{ +global $NATS; +$form="H:i:s d/m/Y"; +if (isset($NATS)) $form=$NATS->Cfg->Get("site.dtformat","H:i:s d/m/Y"); +if ($ts<=0) return $NATS->Lang->Item("never"); +return date($form,$ts); +} + +function enicedt($ts) +{ +echo nicedt($ts); +} + +function nicediff($diff) +{ +$hr=0; +$mn=0; +$se=0; +if ($diff>59) + { + $mn=round($diff/60,0); + $se=$diff%60; + if ($mn>59) + { + $hr=round($mn/60,0); + $mn=$mn%60; + } + } +else $se=$diff; +$s=""; +if ($hr<10) $s="0"; +$s.=$hr.":"; +if ($mn<10) $s.="0"; +$s.=$mn.":"; +if ($se<10) $s.="0"; +$s.=$se; +return $s; +} + +function dtago($ts,$sayago=true) +{ +global $NATS; +if ($ts<=0) return $NATS->Lang->Item("never"); +$now=time(); +$diff=$now-$ts; +$s=nicediff($diff); +if ($sayago) $s.=" ".$NATS->Lang->Item("ago"); +return $s; +} + +function nicenextx($nextx) +{ +if ($nextx<=0) return "Now"; +$diff=$nextx-time(); +if ($diff<0) + { + $sign=" ago"; + $diff=0-$diff; + } +else $sign=""; +return nicediff($diff).$sign; +} + +function edtago($ts) +{ +echo dtago($ts); +} + +function smartx($x) // smart handling of unixtime x variables +{ +if ($x==0) return time(); // 0 = now +else if ($x<0) // -z = now - z seconds + return (time()+$x); // negative number so + +else // positive number so is a unixtime + return $x; +} + +$allowed="00123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz@_-.,:&/~%=+(){}[]#?$"; + +function nices($s) +{ +global $allowed; +$o=""; +for ($a=0; $a"; +$cc=0; +for ($a=0; $a"; + echo "
".$fnIcons[$a]."
"; + if ($a==$fnIcon_DefNode) echo "Node Default "; + if ($a==$fnIcon_DefGroup) echo "Group Default"; + echo ""; + $cc++; + if ($cc>=5) + { + echo ""; + $cc=0; + } + } +if ($cc>0) echo ""; +echo ""; +} +*/ + +function GetIcons() +{ +$iconFiles=glob("icons/{*.gif,*.GIF,*.jpg,*.JPG,*.jpeg,*.JPEG,*.png,*.PNG}", GLOB_BRACE); +for($a=0;$a"; +$cc=0; +$iconFiles=GetIcons(); +for ($a=0; $a"; + echo "
".$icon."
"; + if ($icon==$fnIcons[$fnIcon_DefNode]) echo "".$NATS->Lang->Item("node.default")." "; + if ($a==$fnIcons[$fnIcon_DefGroup]) echo "".$NATS->Lang->Item("group.default").""; + echo ""; + $cc++; + if ($cc>=5) + { + echo ""; + $cc=0; + } + } +if ($cc>0) echo ""; +echo ""; +} + + + +function NodeIcon($nodeid) +{ +global $NATS,$fnIcons,$fnIcon_DefNode; +$q="SELECT nodeicon FROM fnnode WHERE nodeid=\"".ss($nodeid)."\""; +$r=$NATS->DB->Query($q); +if ($row=$NATS->DB->Fetch_Array($r)) + { + if ($row['nodeicon']!="") return $row['nodeicon']; + } +return $fnIcons[$fnIcon_DefNode]; +} + +function GroupIcon($groupid) +{ +global $NATS,$fnIcons,$fnIcon_DefGroup; +$q="SELECT groupicon FROM fngroup WHERE groupid=\"".ss($groupid)."\""; +$r=$NATS->DB->Query($q); +if ($row=$NATS->DB->Fetch_Array($r)) + { + if ($row['groupicon']!="") return $row['groupicon']; + } +return $fnIcons[$fnIcon_DefGroup]; +} + +function np_tiny($nodeid,$text=true,$nodename="",$jslink=false) +{ +global $NATS; +$al=$NATS->NodeAlertLevel($nodeid); +echo ""; +echo "
"; +if ($jslink) echo ""; +else echo ""; +echo ""; +echo ""; +if ($text) + { + if ($nodename=="") $nodename=$nodeid; + + //$words=explode(" ",$nodename); + + // messy but there you go... + + $max_on_line=7; + $max_lines=2; + $len=strlen($nodename); + $out=""; + $linecount=0; + $charcount=0; + for ($a=0; $a<$len; $a++) + { + + $char=$nodename[$a]; + + if ($char==" ") + { + $linecount++; + $charcount=0; + } + else $charcount++; + + if ($charcount>=$max_on_line) + { + $a=$len+10; + $out.=".."; + } + else if ($linecount>=$max_lines) + { + $a=$len+10; + $out.=".."; + } + else $out.=$char; + + } + //if ($a==($len+10)) $out.=".."; + $nodename=$out; + + $size=10; + +/* -- size-based + $len=strlen($nodename); + if ($len<9) $size=10; + else if ($len<15) $size=8; + else if ($len<20) $size=7; + else + { + $size=6; + $nodename=substr($nodename,0,18).".."; + } +*/ + + echo "
".$nodename.""; + } +echo "
"; +} + +function ng_tiny($groupid,$groupname="",$text=true) +{ +global $NATS; +// to do - get groupname if not sent but F--- it for now +$al=$NATS->GroupAlertLevel($groupid); +echo ""; +echo "
"; +echo ""; +echo ""; +echo ""; +if ($text) + { + echo "
".$groupname.""; + } +echo "
"; +} + +function ng_big($groupid,$groupname="",$groupdesc="",$groupicon="") +{ +global $NATS; +if ($groupicon=="") $groupicon=GroupIcon($groupid); +$al=$NATS->GroupAlertLevel($groupid); +echo ""; +echo ""; +//echo ""; +echo ""; +echo "
"; +echo ""; +echo ""; +echo ""; +echo ""; +echo "
".$NATS->Lang->Item("group.name")." :"; +echo "".$groupname."
".$NATS->Lang->Item("description")." :"; +echo "".$groupdesc."
".$NATS->Lang->Item("status").""; +echo "".oText($al)."
"; +//echo ""; +//echo "
"; +} + +function np_big($nodeid,$nodename="",$nodedesc="",$nodeicon="",$jslink=false) +{ +global $NATS; +if ($nodedesc=="") $nodedesc=" "; +if ($nodeicon=="") $nodeicon=NodeIcon($nodeid); +$al=$NATS->NodeAlertLevel($nodeid); +echo ""; +echo ""; +//echo ""; +echo ""; +echo "
"; +echo ""; +echo ""; +echo ""; +echo ""; +echo "
".$NATS->Lang->Item("node.name")." :"; +if ($nodename=="") $nodename=$nodeid; +echo ""; +if ($jslink) echo ""; +else echo ""; +echo $nodename."
".$NATS->Lang->Item("description")." :"; +echo "".$nodedesc."
".$NATS->Lang->item("status")." :"; +echo "".oText($al)."
"; +//echo ""; +//echo "
"; +} + +function GetAbsolute($filename="") +{ // sooooooooo messy but looks like the ONLY FRICKIN' WAY! +if ((isset($_SERVER['HTTPS']))&&($_SERVER['HTTPS']!="")) $uri="https://"; +else $uri="http://"; +$uri.=$_SERVER['HTTP_HOST']; +$uri.=$_SERVER['REQUEST_URI']; +$pos=strripos($uri,"/"); +$rdir=substr($uri,0,$pos+1); +return $rdir.$filename; +} + + +?> diff --git a/src/server/base/session.inc.php b/src/server/base/session.inc.php new file mode 100755 index 0000000..5843a6f --- /dev/null +++ b/src/server/base/session.inc.php @@ -0,0 +1,112 @@ +Query($q); + if ($row=$db->Fetch_Array($r)) + { // success + $db->Free($r); + return $this->Register($db,$uname); + } + return false; + } + +function Register(&$db,$uname) + { + $q="SELECT userlevel FROM fnuser WHERE username=\"".ss($uname)."\""; + $r=$db->Query($q); + if (!$row=$db->Fetch_Array($r)) return false; // invalid user + $db->Free($r); + mt_srand(microtime()*100000); + for ($a=0; $a<$this->slen; $a++) + { + $this->sessionkey.=$this->schrs[mt_rand(0,strlen($this->schrs)-1)]; + } + $q="INSERT INTO fnsession(sessionkey,ipaddress,username,startx,updatex,userlevel) "; + $q.="VALUES(\"".$this->sessionkey."\",\"".ss($_SERVER['REMOTE_ADDR'])."\",\"".ss($uname)."\","; + $q.=time().",".time().",".$row['userlevel'].")"; + $db->Query($q); + if ($db->Affected_Rows()<=0) die("Failed to create session record"); + $this->username=$uname; + $this->userlevel=$row['userlevel']; + $this->sessionid=$db->Insert_Id(); + $this->ipaddress=$_SERVER['REMOTE_ADDR']; + $this->auth=true; + setcookie("fn_sid",$this->sessionid); + setcookie("fn_skey",$this->sessionkey); + return $this->sessionid; + } + +function Check(&$db,$timeskip=false) // timeskip (1.02.1) avoids checking for or setting time (for live monitor) + { + if (!isset($_COOKIE['fn_sid'])) return false; + if (!isset($_COOKIE['fn_skey'])) return false; + + $q="SELECT username,userlevel FROM fnsession WHERE "; + $q.="sessionid=".ss($_COOKIE['fn_sid'])." AND sessionkey=\"".ss($_COOKIE['fn_skey'])."\" AND "; + $q.="ipaddress=\"".ss($_SERVER['REMOTE_ADDR'])."\""; + if (!$timeskip) $q.="AND updatex>".(time()-(30*60)); + $q.=" LIMIT 0,1"; + $r=$db->Query($q); + if (!$row=$db->Fetch_Array($r)) return false; + + $this->sessionid=$_COOKIE['fn_sid']; + $this->sessionkey=$_COOKIE['fn_skey']; + $this->username=$row['username']; + $this->userlevel=$row['userlevel']; + $this->ipaddress=$_SERVER['REMOTE_ADDR']; + $this->auth=true; + + if (!$timeskip) + { + $q="UPDATE fnsession SET updatex=".time()." WHERE sessionid=".ss($this->sessionid); + $db->Query($q); + } + + return true; + } + +function Destroy($db) + { + $q="DELETE FROM fnsession WHERE sessionid=".ss($this->sessionid)." AND sessionkey=\"".ss($this->sessionkey)."\""; + $db->Query($q); + setcookie("fn_sid",""); + setcookie("fn_skey",""); + return true; + } + +} \ No newline at end of file diff --git a/src/server/base/site/events/console.php b/src/server/base/site/events/console.php new file mode 100755 index 0000000..a684812 --- /dev/null +++ b/src/server/base/site/events/console.php @@ -0,0 +1,67 @@ + /dev/console"; + @exec($cmd); + return true; +} + +$NATS->AddEventHandler("alert_action","alert_action_console"); + + + + + +} // end of isset($NATS) block +?> \ No newline at end of file diff --git a/src/server/base/site/events/detailed_alerts.php b/src/server/base/site/events/detailed_alerts.php new file mode 100755 index 0000000..d814ccc --- /dev/null +++ b/src/server/base/site/events/detailed_alerts.php @@ -0,0 +1,184 @@ + "_detailtrigger", + "alertaction" => "_detailaction", + + "status_on_open" => true, // on an alert open include node status + "status_on_close" => true, // same for close + + "summary_on_open" => true, // on open show summary of other alerts + "summary_on_close" => true ); // same for close + // END OF CONFIGURATION + + + if ($data['event']=="alert_action") + { + if ($data['name']==$detail_alert_config["trigger"]) return true; // clear + else return false; // propgate + } + else if ($data['event']=="alert_open") + { + $open=true; + $close=false; + } + else if($data['event']=="alert_close") + { + $open=false; + $close=true; + } + else return false; + + // Does this node have the alert action of "trigger" + + // First what is the trigger aaid + $q="SELECT aaid FROM fnalertaction WHERE aname=\"".ss($detail_alert_config["trigger"])."\" LIMIT 0,1"; + //echo $q."\n"; + $r=$NATS->DB->Query($q); + if (!$aa=$NATS->DB->Fetch_Array($r)) + { + $NATS->Event("No trigger action ".$detail_alert_config["trigger"],10,"Extras","Detail Alert"); + return false; // no such trigger alert action + } + $NATS->DB->Free($r); + + $aaid=$aa['aaid']; + + // Second does the node have this alert action + $q="SELECT nalid FROM fnnalink WHERE aaid=".$aaid." AND nodeid=\"".ss($data['nodeid'])."\" LIMIT 0,1"; + //echo $q."\n"; + $r=$NATS->DB->Query($q); + if (!$link=$NATS->DB->Fetch_Array($r)) + { + $NATS->Event("Node does not have trigger action",10,"Extras","Detail Alert"); + return false; // no it does not + } + $NATS->DB->Free($r); + + + $msg=$data['nodeid']." : Alert "; + if ($open) $msg.="Opened"; + else $msg.="Closed"; + $msg.="\n\n"; + + if ( ( $open && $detail_alert_config['status_on_open'] ) || + ( $close && $detail_alert_config['status_on_close'] ) ) + { // include node status + + $tests=$NATS->GetNodeTests($data['nodeid']); + foreach($tests as $testid) + { + $test=$NATS->GetTest($testid); + if ($test!==false) // specific comparitor + { + $msg.=$test['name'].": ".$test['alerttext']." (".$test['lastrunago']." ago)\n"; + } + } + + $msg.="\n\n"; + } + + if ( ( $open && $detail_alert_config['summary_on_open'] ) || + ( $close && $detail_alert_config['summary_on_close'] ) ) + { // include alert summary + + $msg.="Current Alerts: "; + $alerts=$NATS->GetAlerts(); + if ( ($alerts===false) || (count($alerts)<=0) ) $msg.="No Alerts"; + else + { + $first=true; + foreach($alerts as $alert) + { + if ($first) $first=false; + else $msg.=", "; + $msg.=$alert['nodeid']; + } + } + + $msg.="\n\n"; + } + + // ok got this far so find output aaid and pass data + $q="SELECT aaid FROM fnalertaction WHERE aname=\"".ss($detail_alert_config["alertaction"])."\" LIMIT 0,1"; + $r=$NATS->DB->Query($q); + if ($row=$NATS->DB->Fetch_Array($r)) + { + $NATS->DB->Free($r); + $NATS->ActionAddData($row['aaid'],$msg); + } + else + { + $NATS->Event("Unable to find action ".$detail_alert_config["alertaction"],10,"Extras","Detail Alert"); + return false; // failed to find + } + +} + +$NATS->AddEventHandler("alert_open","detail_alert_handler"); +$NATS->AddEventHandler("alert_close","detail_alert_handler"); +$NATS->AddEventHandler("alert_action","detail_alert_handler"); // to clear the trigger + + +} // end of NATS block + +?> \ No newline at end of file diff --git a/src/server/base/site/events/file.php b/src/server/base/site/events/file.php new file mode 100755 index 0000000..d3f15d4 --- /dev/null +++ b/src/server/base/site/events/file.php @@ -0,0 +1,70 @@ +AddEventHandler("alert_action","alert_action_file"); + + + + +} // end of isset($NATS) block +?> \ No newline at end of file diff --git a/src/server/base/site/events/generic.php b/src/server/base/site/events/generic.php new file mode 100755 index 0000000..5d48ac1 --- /dev/null +++ b/src/server/base/site/events/generic.php @@ -0,0 +1,54 @@ + \ No newline at end of file diff --git a/src/server/base/site/events/syslog.php b/src/server/base/site/events/syslog.php new file mode 100755 index 0000000..632bf18 --- /dev/null +++ b/src/server/base/site/events/syslog.php @@ -0,0 +1,80 @@ +Event("Syslog AA Called for ".$data['name'],10,"Syslog","Start"); + if ($data['name']!="_syslog") return false; + $lvl=LOG_ERR; + + define_syslog_variables(); + openlog("FreeNATS", LOG_PID | LOG_PERROR, LOG_LOCAL0); + + if (syslog($lvl,$data['data'])===false) + $NATS->Event("Syslog Failed for ".$data['data'],2,"Syslog","Write"); + else + $NATS->Event("Syslog Succeeded for ".$data['data'],10,"Syslog","Write"); + closelog(); + + return true; +} + +$NATS->AddEventHandler("alert_action","alert_action_syslog"); + + + + +} // end of isset($NATS) block +?> \ No newline at end of file diff --git a/src/server/base/site/events/test.php b/src/server/base/site/events/test.php new file mode 100755 index 0000000..39d8716 --- /dev/null +++ b/src/server/base/site/events/test.php @@ -0,0 +1,74 @@ +Event("Included Event Tester",10); + +function my_node_test_start_handler($data) +{ + global $NATS; + if ($data['in_schedule']) $s=$data['nodeid']." is in the schedule and will be tested"; + else $s=$data['nodeid']." is NOT in the schedule and so won't be tested"; + $NATS->Event($s,10); +} + +$NATS->AddEventHandler("node_test_start","my_node_test_start_handler"); + +function my_alert_action($data) +{ + global $NATS; + if ($data['name']!="bob") return false; // only want my handler + + $NATS->Event("MyAction: ".$data['data'],10); + return true; +} + +$NATS->AddEventHandler("alert_action","my_alert_action"); + + +function alert_action_syslog($data) +{ + global $NATS; + $NATS->Event("Syslog AA Called for ".$data['name'],10,"Syslog","Start"); + if ($data['name']!="_syslog") return false; + $lvl=LOG_ERR; + + define_syslog_variables(); + openlog("FreeNATS", LOG_PID | LOG_PERROR, LOG_LOCAL0); + + if (syslog($lvl,$data['data'])===false) + $NATS->Event("Syslog Failed for ".$data['data'],2,"Syslog","Write"); + else + $NATS->Event("Syslog Succeeded for ".$data['data'],10,"Syslog","Write"); + closelog(); + + return true; +} + +$NATS->AddEventHandler("alert_action","alert_action_syslog"); + +function alert_action_console($data) +{ + if ($data['name']!="_console") return false; + $cmd="echo \"FreeNATS: ".$data['data']."\" > /dev/console"; + @exec($cmd); + return true; +} + +$NATS->AddEventHandler("alert_action","alert_action_console"); + +function alert_action_file($data) +{ + if ($data['name']=="mq") $file="/tmp/fndebug"; + else if ($data['name']=="_detailaction") $file="/tmp/fndetail"; + else return false; + $fp=fopen($file,"a"); + fputs($fp,"-- ".date("Y-m-d H:i:s")." --\n"); + fputs($fp,$data['data']); + fputs($fp,"\n-- ENDS --\n"); + fclose($fp); + return true; +} + +$NATS->AddEventHandler("alert_action","alert_action_file"); +*/ +?> \ No newline at end of file diff --git a/src/server/base/site/tests/advanced_page_test.php b/src/server/base/site/tests/advanced_page_test.php new file mode 100755 index 0000000..ddee20e --- /dev/null +++ b/src/server/base/site/tests/advanced_page_test.php @@ -0,0 +1,225 @@ +Cfg->Get("test.http.timeout",-1); + if ($nto>0) $timeout=$nto; // use NATS timeout + } + } + if ($timeout>0) // use the set timeout + $oldtimeout=ini_set("default_socket_timeout",$timeout); + + $timer->Start(); + + if (function_exists("curl_getinfo")) // use CURL if present + { + $ch=curl_init(); + curl_setopt($ch,CURLOPT_URL,$url); + curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); + curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,0); + curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,0); + curl_setopt($ch,CURLOPT_HEADER,1); + if ($timeout>0) curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout); + if ($timeout>0) curl_setopt($ch,CURLOPT_TIMEOUT,$timeout); + if (!$output=curl_exec($ch)) + { + $ctr=-1; // failed + } + else $ctr=round(curl_getinfo($ch,CURLINFO_SIZE_DOWNLOAD)/1024,2); + curl_close($ch); + + if ($ctr==0) $ctr="0.0001"; + + } + else + { // no CURL - use fopen() + $fp=@fopen($url,"r"); + if ($fp<=0) + { + if ($timeout>0) ini_set("default_socket_timeout",$oldtimeout); + return -1; + } + $ctr=0; + while ($output.=@fgets($fp,1024)) $ctr+=sizeof($body); + @fclose($fp); + } + + if ($ctr<0) return $ctr; // negative number (-1) failed to open + + $elapsed=$timer->Stop(); + + if ($timeout>0) ini_set("default_socket_timeout",$oldtimeout); + + // now to check the actual text + if (is_array($text)) + { + foreach($text as $findthis) + { + if ($findthis!="") + if (strpos($output,$findthis)===false) return -2; // text to be found not found + } + } + if (is_array($notext)) + { + foreach($notext as $donotfindthis) + { + if ($donotfindthis!="") + if (strpos($output,$donotfindthis)!==false) return -3; // text not to find found + } + } + + return $elapsed; + } + + +global $NATS; + +class Advanced_Pagecheck_Test extends FreeNATS_Local_Test +{ + + function DoTest($testname,$param,$hostname,$timeout,$params) + { + /* parameters: -- sadly very messy but to do otherwise would break plug+play + 0: url + 1: text + 4: notext + 2: user + 3: pass + + 5: text + 6: text + 7: notext + 8: notext + 9: NULL + */ + $text=array( $params[1], $params[5], $params[6] ); + $notext=array( $params[4], $params[7], $params[8] ); + + $result=extended_page_checker($params[0],$text,$notext,$params[2],$params[3],$timeout); + return $result; + } + + function Evaluate($result) + { + if ($result>0) return 0; // FreeNATS passed (0) flag if > 0 + return 2; // FreeNATS failed (2) flag ( <= 0 ) + } + + function ProtectOutput(&$test) + { + $test['testparam3']=""; // blank password for output + return true; + } + + function DisplayForm(&$test) + { + $out=""; + $out.=""; + $out.=""; + $out.=""; + $out.=""; + $out.=""; + $out.=""; + $out.=""; + + $out.=""; + $out.=""; + + $out.=""; + $out.=""; + echo $out; // output the buffer + } +} + +// Now we have defined the class we must register it with FreeNATS + +$params=array(); // blank parameters array as we have implemented DisplayForm above + +$NATS->Tests->Register( + "advpagecheck", // the internal simple test name (must not conflict with anything else) + "Advanced_Pagecheck_Test", // the class name (above) + $params, // parameters (blank for now) + "Web Content Test", // the display name of the test in the interface + 3, // the revision number of the test + "Advanced Page Checker"); // extended description for the test module used in overview + +?> diff --git a/src/server/base/site/tests/dynamic_dns_test.php b/src/server/base/site/tests/dynamic_dns_test.php new file mode 100755 index 0000000..865007a --- /dev/null +++ b/src/server/base/site/tests/dynamic_dns_test.php @@ -0,0 +1,160 @@ +0) return 0; // FreeNATS passed (0) flag if > 0 + return 2; // FreeNATS failed (2) flag ( <= 0 ) + } + + function ProtectOutput(&$test) + { + $test['testparam3']=""; // blank password for output + return true; + } + + function DisplayForm(&$test) + { + $out=""; + $out.="
URL :"; + $out.=""; + $out.="
Fully-qualified URL including http://"; + $out.="
Strings :"; + $out.="
"; + $out.="
"; + $out.=""; + $out.="
String(s) to search for - all defined must
be found for the test to pass
"; + $out.="Blank strings are ignored.
"; + $out.="
No Strings :"; + $out.="
"; + $out.="
"; + $out.=""; + $out.="
String(s) to NOT find - fails if any are present
Leave blank to not use this portion of the test
"; + $out.="
Username :"; + $out.=""; + $out.="
Specify to use HTTP-AUTH on the URL"; + $out.="
Password :"; + $out.=""; // dont display it + $out.=""; // don't update testparam3 (if blank) + $out.="
Enter a new password to set or... "; + $out.=" "; // clears testparam3 if set + $out.="clear it"; + $out.="
"; + $out.=""; + $out.=""; + $out.=""; + $out.=""; + $out.="
Hostname:"; + $out.=""; + $out.="
Dynamic DNS Hostname to Check (i.e. myhost.dyndns.org)"; + $out.="
IP:"; + $out.="
"; + $out.="This setting tells FreeNATS where to get your external IP from. You can either use "; + $out.="the PurplePixie XML App gateway or put in your own URL. The URL must return a plain IP."; + $out.="
"; + echo $out; // output the buffer + } +} + +// Now we have defined the class we must register it with FreeNATS + +$params=array(); // blank parameters array as we have implemented DisplayForm above + +$NATS->Tests->Register( + "dynamicdns", // the internal simple test name (must not conflict with anything else) + "Dynamic_DNS_Test", // the class name (above) + $params, // parameters (blank for now) + "Dynamic DNS Test", // the display name of the test in the interface + 1, // the revision number of the test + "Check Dyanamic DNS Host Against External IP"); // extended description for the test module used in overview + +?> diff --git a/src/server/base/site/tests/ext.pagecheck.php b/src/server/base/site/tests/ext.pagecheck.php new file mode 100755 index 0000000..dd85d4b --- /dev/null +++ b/src/server/base/site/tests/ext.pagecheck.php @@ -0,0 +1,223 @@ +Cfg->Get("test.http.timeout",-1); + if ($nto>0) $timeout=$nto; // use NATS timeout + } + } + if ($timeout>0) // use the set timeout + $oldtimeout=ini_set("default_socket_timeout",$timeout); + + $timer->Start(); + + if (function_exists("curl_getinfo")) // use CURL if present + { + $ch=curl_init(); + curl_setopt($ch,CURLOPT_URL,$url); + curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); + curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,0); + curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,0); + curl_setopt($ch,CURLOPT_HEADER,1); + if ($timeout>0) curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout); + if ($timeout>0) curl_setopt($ch,CURLOPT_TIMEOUT,$timeout); + if (!$output=curl_exec($ch)) + { + $ctr=-1; // failed + } + else $ctr=round(curl_getinfo($ch,CURLINFO_SIZE_DOWNLOAD)/1024,2); + curl_close($ch); + + if ($ctr==0) $ctr="0.0001"; + + } + else + { // no CURL - use fopen() + $fp=@fopen($url,"r"); + if ($fp<=0) + { + if ($timeout>0) ini_set("default_socket_timeout",$oldtimeout); + return -1; + } + $ctr=0; + while ($output.=@fgets($fp,1024)) $ctr+=sizeof($body); + @fclose($fp); + } + + if ($ctr<0) return $ctr; // negative number (-1) failed to open + + $elapsed=$timer->Stop(); + + if ($timeout>0) ini_set("default_socket_timeout",$oldtimeout); + + // now to check the actual text + if (is_array($text)) + { + foreach($text as $findthis) + { + if ($findthis!="") + if (strpos($output,$findthis)===false) return -2; // text to be found not found + } + } + if (is_array($notext)) + { + foreach($notext as $donotfindthis) + { + if ($donotfindthis!="") + if (strpos($output,$donotfindthis)!==false) return -3; // text not to find found + } + } + + return $elapsed; + } + + +/* // The old version +function extended_check_page_text($url,$text,$notext="",$user="",$pass="") +{ + $timer=new TFNTimer(); // initialise the timer + url_lookup($url); // pre-resolve the DNS into cache + + if ($user!="") // use HTTP-AUTH + { + $pos=strpos($url,"://"); + if ($pos===false) return -1; // not a valid URL + $protocol=substr($url,0,$pos+3); // protocol section + $uri=substr($url,$pos+3); // uri section + $url=$protocol.$user.":".$pass."@".$uri; // make http://user:pass@uri + } + $timer->Start(); // start the timer + $fp=fopen($url,"r"); // open the URL + if ($fp<=0) return false; // fail if can't open + // or we could start it here to not include opening times... + $body=""; + while (!feof($fp)) + $body.=fgets($fp,1024); // read into the body in 1k chunks + $elapsed=$timer->Stop(); // get the elapsed time at this point + fclose($fp); // finished with pointer + if (strpos($body,$text)===false) return -1; // not found + if ($notext!="") // the text we do NOT want to appear is $notext - check if set + { + if (strpos($body,$notext)!==false) return -2; // was found in the page + } + return $elapsed; // return a positive elapsed time on success +} +*/ + +global $NATS; + +class Ext_Pagecheck_Test extends FreeNATS_Local_Test +{ + + function DoTest($testname,$param,$hostname,$timeout,$params) + { + /* parameters: -- sadly very messy but to do otherwise would break plug+play + 0: url + 1: text + 4: notext + 2: user + 3: pass + + 5: text + 6: text + 7: notext + 8: notext + 9: NULL + */ + $text=array( $params[1], $params[5], $params[6] ); + $notext=array( $params[4], $params[7], $params[8] ); + + $result=extended_check_page_text_2($params[0],$text,$notext,$params[2],$params[3],$timeout); + return $result; + } + + function Evaluate($result) + { + if ($result>0) return 0; // FreeNATS passed (0) flag if > 0 + return 2; // FreeNATS failed (2) flag ( <= 0 ) + } + + function ProtectOutput(&$test) + { + $test['testparam3']=""; // blank password for output + return true; + } + + function DisplayForm(&$test) // nice user form (optional) + { + $out=""; // output buffer + $out.=""; + $out.=""; + $out.=""; + $out.=""; + $out.=""; + $out.=""; + $out.=""; + + $out.=""; + $out.=""; + + // so far so much the same... but... + $out.=""; + $out.=""; + echo $out; // output the buffer + } +} + +// Now we have defined the class we must register it with FreeNATS + +$params=array(); // blank parameters array as we have implemented DisplayForm above + +$NATS->Tests->Register( + "extpagecheck", // the internal simple test name (must not conflict with anything else) + "Ext_Pagecheck_Test", // the class name (above) + $params, // parameters (blank for now) + "Page Content Checker", // the display name of the test in the interface + 1, // the revision number of the test + "Extended Page Checker"); // extended description for the test module used in overview + +?> diff --git a/src/server/base/site/tests/page_load_sim.php b/src/server/base/site/tests/page_load_sim.php new file mode 100755 index 0000000..68c6e61 --- /dev/null +++ b/src/server/base/site/tests/page_load_sim.php @@ -0,0 +1,156 @@ +Start(); + + if (!$is_ip_address) // only do the DNS lookup if the URL isn't an IP address already + { + $answer=$dns_query->Query($hostname,$type); + //echo "DNS"; + + if ( ($answer===false) || ($dns_query->error) ) // query error + { + $udp=false; // switch to TCP + $dns_query->udp=$udp; + + // wait! + while ($timer->Stop() < $dns_delay) usleep(100); + + $answer=$dns_query->Query($hostname,$type); + //echo "DNS2"; + } + + if ($answer->count<=0) return -1; // no records returned + if ($answer===false) return -1; // object is false + if ($dns_query->error) return -1; // DNS object error + + $dns_time_taken=$timer->Stop(); + + // if we get this far the DNS has worked + + $ip_address=url_lookup($url); // pre-cache DNS + } + else $dns_time_taken=0; + + $ch=curl_init(); + curl_setopt($ch,CURLOPT_URL,$url); + curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); + curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,0); + curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,0); + curl_setopt($ch,CURLOPT_HEADER,1); + curl_setopt($ch,CURLOPT_FOLLOWLOCATION,1); + curl_setopt($ch,CURLOPT_MAXREDIRS,32); + if ($timeout>0) curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout); + if ($timeout>0) curl_setopt($ch,CURLOPT_TIMEOUT,$timeout); + + // restart timer + $timer->Start(); + + if (!$output=curl_exec($ch)) + { + $ctr=-1; // failed + } + else $ctr=round(curl_getinfo($ch,CURLINFO_SIZE_DOWNLOAD)/1024,2); + + $fetch_time_taken=$timer->Stop(); + + curl_close($ch); + + if ($ctr<=0) return -2; // URL request failed + + return $dns_time_taken + $fetch_time_taken; // return elapsed time taken + + } + function Evaluate($result) + { + if ($result<0) return 2; // failed + return 0; // passed + } + function DisplayForm(&$row) + { + echo "
URL :"; + $out.=""; + $out.="
Fully-qualified URL including http://"; + $out.="
Strings :"; + $out.="
"; + $out.="
"; + $out.=""; + $out.="
String(s) to search for - all defined must
be found for the test to pass
"; + $out.="Blank strings are ignored.
"; + $out.="
No Strings :"; + $out.="
"; + $out.="
"; + $out.=""; + $out.="
String(s) to NOT find - fails if any are present
Leave blank to not use this portion of the test
"; + $out.="
Username :"; + $out.=""; + $out.="
Specify to use HTTP-AUTH on the URL"; + $out.="
Password :"; + $out.=""; // dont display it + $out.=""; // don't update testparam3 (if blank) + $out.="
Enter a new password to set or... "; + $out.=" "; // clears testparam3 if set + $out.="clear it"; + $out.="
"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "
"; + echo "FQDN URL :"; + echo ""; + echo ""; + echo "
Include http[s]://
"; + echo "Nameserver :"; + echo ""; + echo ""; + echo "
DNS Server to perform lookup on
"; + echo "DNS Delay :"; + echo ""; + echo ""; + echo "
If UDP DNS fails wait until elapsed time is x seconds before doing TCP lookup
"; + } + + + } + +$params=array(); +$NATS->Tests->Register("loadsim","Page_Load_Sim_Test",$params,"Page Load Simulator",4,"Page Load Simulator"); +$NATS->Tests->SetUnits("loadsim","Seconds","s"); +} + +?> diff --git a/src/server/base/site/tests/page_load_sim.zip b/src/server/base/site/tests/page_load_sim.zip new file mode 100644 index 0000000000000000000000000000000000000000..53a42025ff979487e9419601df55729f15b1e025 GIT binary patch literal 1747 zcmV;^1}yndO9KQH000080Blb|J1_&PIxPkO06h-?01*Hc0B~VvWnXM>VPs!(X>BfW zXmC|j2>=6YZ^TM#Z^TMfcmx3S0rUZ_S8Z?FND%%E68~XpMOWNHc}eedN-${@Kt)PP z3gk|AZHhMb0(&*KZ+9J%Yx>`BX4eMOv}t=+$pU+4=k1x%FO1aSh$^TA; z;M&d_DvgO3s2?xZ)rpKTHE2RLaD4&Lmr@1A1-30SsREMsP7crSBGg z_eK+#aCyxot+cb1i{3f(c*t&1#1nYM^)e0)%B9mdexD{*#xhnqVk-{Uf|>nsWLT9I zRvOODYG_&JOoR#&mMRW9#z(Ud0@46C$l}LQKz{KEw7iAs$$7bSE_ofjjl*lcRfZan z!sR@cD{=$k1bJ8#z?^G;SuUM~vEt=&U&>g*H49UYzL)APV_R-N8p8uzZ5t6|#FZ<( zUEYUbgsdVcI`pJbE-%9P3hmw-9Zx5R7!)yws!)pSs#$W~O8G;j?1xM##C^eMr!fm= z6S102NddpnoctU}&S^iAeHI#8rCdVJ(maiPEeOe&R;zoOTgPjA3B|Ftmm^Wz(_+Qr zRA&^0x=Thz$xx&h@ij~bqbYq<-9secgE1ZmiMEJHXn{T|gDD^ahidVgtRk7&_!l^GOZHM3X0r1Y+%vN|;X$soeR-HE zwQB7K&uhAHcL&u+Ld~KSJrsU{?7HAWVR!Qo(D8uJSsH4HVv2-hHvdri#;pv}4oS~H zykDBeZ)0+hcv`01h|3Vf{LorN3!*2n)ZWhqg&f40LDmEVaehr71u$xcr4UQhP@A(* zao6aOX#{JbmuTu$x`22-w*kIQxaS-@IdCh6xz82G!UTYva1cA^uu_N>Mk^EKc@{8} z4@Ie*Y5-*d+HCXNte}9>2l_GLG`!X=1lnIxbu#6r7`}R!w$gsGi6Ezgv}Qs-qWAR@ z3rChd#@jfly3i?PpbM!AIZvvsX4Bos_&z9#ShP)`OCPhuG|6j))w_P2MmB}>W7#tP zVcJV9v=R%DB~Yy^vTl*wWwccRgaSh@)PPTr-ese*lCkEv=VyX|nrZf)N8T=I+bV@B z)*Kd`8lBNBO~)glOQv8Q%lF29lTuh`SP)>dP#z}orsm+gJw|vK>OS+AS^qG0_)E{H z&2)^j)HL6CoZ|#5ufMFFV0Sn>pU&{FW`#YpYuuk+j7QV)@n|yWk87=mcTXm#v)}sT z;oy&#XOn5I`K`Op`zZS>yI=N?ds_>Nm92|e@g=U4v(c!3GMx@z_0KM*o0{}}Lhf^K zB8uUmG5{vvpD7N7!~KX#Sb|l|sNpxEpX(iRKD)xf4pT!14{>!wgsB9kXKHNxV44~YR%XNi zCH~>weiK&gCgjmVFTGa#S35d-Zyo0uIq~N4X8+^MXUmgn3U|+^htBosdwpqqUzl-UkIh~hT(*G*HL2S)SUZQ zA1A-1SRxP+keG%{$I_|oe}4VGx(U}8*sxVm-Nbs1Z_03dr2Fzww^IHWP)h*<7XuUk z000O8Y)?TuFaxSOEd~GpJr4i?5daMU000000RR91?STLQ003}dXJub(Z((F#b7^fZ paAoFS7su literal 0 HcmV?d00001 diff --git a/src/server/base/site/tests/proxy_page_load.php b/src/server/base/site/tests/proxy_page_load.php new file mode 100755 index 0000000..ebe7046 --- /dev/null +++ b/src/server/base/site/tests/proxy_page_load.php @@ -0,0 +1,212 @@ +Cfg->Get("test.http.timeout",-1); + if ($nto>0) $timeout=$nto; // use NATS timeout + } + } + if ($timeout>0) // use the set timeout + $oldtimeout=ini_set("default_socket_timeout",$timeout); + + $timer->Start(); + + // Requires CURL Now + + $ch=curl_init(); + curl_setopt($ch,CURLOPT_URL,$url); + curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); + curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,0); + curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,0); + curl_setopt($ch,CURLOPT_HEADER,1); + if ($timeout>0) curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout); + if ($timeout>0) curl_setopt($ch,CURLOPT_TIMEOUT,$timeout); + if (!$output=curl_exec($ch)) + { + $ctr=-1; // failed + } + else $ctr=round(curl_getinfo($ch,CURLINFO_SIZE_DOWNLOAD)/1024,2); + curl_close($ch); + + if ($ctr==0) $ctr="0.0001"; + + + + if ($ctr<0) return $ctr; // negative number (-1) failed to open + + $elapsed=$timer->Stop(); + + if ($timeout>0) ini_set("default_socket_timeout",$oldtimeout); + + // now to check the actual text + if (is_array($text)) + { + foreach($text as $findthis) + { + if ($findthis!="") + if (strpos($output,$findthis)===false) return -2; // text to be found not found + } + } + if (is_array($notext)) + { + foreach($notext as $donotfindthis) + { + if ($donotfindthis!="") + if (strpos($output,$donotfindthis)!==false) return -3; // text not to find found + } + } + + return $elapsed; + } + + function Evaluate($result) + { + if ($result>0) return 0; // FreeNATS passed (0) flag if > 0 + return 2; // FreeNATS failed (2) flag ( <= 0 ) + } + + function ProtectOutput(&$test) + { + $test['testparam4']=""; // blank proxy password for output + return true; + } + + function DisplayForm(&$test) + { + $out=""; + $out.=""; + $out.=""; + $out.=""; + $out.=""; + $out.=""; + $out.=""; + $out.=""; + + $out.=""; + $out.=""; + + $out.=""; + $out.=""; + echo $out; // output the buffer + } +} + +// Now we have defined the class we must register it with FreeNATS + +$params=array(); // blank parameters array as we have implemented DisplayForm above + +if (function_exists("curl_getinfo")) // register if CURL exists +{ +$NATS->Tests->Register( + "proxypage", // the internal simple test name (must not conflict with anything else) + "Proxy_Page_Test", // the class name (above) + $params, // parameters (blank for now) + "Web Proxy Test", // the display name of the test in the interface + 3, // the revision number of the test + "Proxy Page Test"); // extended description for the test module used in overview +$NATS->Tests->SetUnits("proxypage","Seconds","s"); +} +else +{ // display appropriate error +$NATS->Event("Proxy Test Not Loaded as CURL Not Supported",3,"Proxy Test","Extras"); +} +?> diff --git a/src/server/base/site/tests/tcpdebug.php b/src/server/base/site/tests/tcpdebug.php new file mode 100755 index 0000000..13096f1 --- /dev/null +++ b/src/server/base/site/tests/tcpdebug.php @@ -0,0 +1,57 @@ + ".$ip."\n"; + if ($ip=="0") return -2; // lookup failed + echo "Lookup Successful\n"; + $errno=0; + $errstr=""; + $timer->Start(); + echo "Doing fsockopen()\n"; + $fp=@fsockopen($ip,$param,$errno,$errstr,$timeout); + $elapsed=$timer->Stop(); + echo "FP is : "; + echo $fp; + echo "\n"; + if ($fp===false) return -1; // open failed + echo "Closing\n"; + @fclose($fp); + return $elapsed; + } + + function Evaluate($result) + { + if ($result<0) return 2; // failure + return 0; // else success + } + + function DisplayForm(&$row) + { + echo "
URL :"; + $out.=""; + $out.="
Fully-qualified URL including http://"; + $out.="
Strings :"; + $out.="
"; + $out.="
"; + $out.=""; + $out.="
String(s) to search for - all defined must
be found for the test to pass
"; + $out.="Blank strings are ignored.
"; + $out.="
No Strings :"; + $out.="
"; + $out.="
"; + $out.=""; + $out.="
String(s) to NOT find - fails if any are present
Leave blank to not use this portion of the test
"; + $out.="
Username :"; + $out.=""; + $out.="
Specify to use HTTP-AUTH on the URL"; + $out.="
Password :"; + $out.=""; // dont display it + $out.=""; // don't update testparam3 (if blank) + $out.="
Enter a new password to set or... "; + $out.=" "; // clears testparam3 if set + $out.="clear it"; + $out.="
"; + echo ""; + echo "
"; + echo "TCP Port :"; + echo ""; + echo ""; + echo "
"; + } + + } + +$params=array(); +$NATS->Tests->Register("tcpdebug","FreeNATS_TCP_Debug",$params,"TCP Debug Connect",1,"FreeNATS TCP Debug"); +$NATS->Tests->SetUnits("tcpdebug","Seconds","s"); +} + + +?> \ No newline at end of file diff --git a/src/server/base/sql/default.sql b/src/server/base/sql/default.sql new file mode 100755 index 0000000..3dcefd6 --- /dev/null +++ b/src/server/base/sql/default.sql @@ -0,0 +1,48 @@ +-- default.sql +-- FreeNATS Default Settings +INSERT INTO fnuser(username,password,realname,userlevel) VALUES("admin",MD5("admin"),"Administrator",10); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("site.name","FreeNATS"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("site.admin",""); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("site.email",""); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("site.enable.tester","1"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("site.enable.web","1"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("site.enable.adminsql","0"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("site.enable.interactive","1"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("site.popupmessage","0"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("site.graph.public","0"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("site.text.closed","Alert Closed"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("site.text.untested","Untested"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("site.text.passed","Passed"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("site.text.warning","Warning"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("site.text.failed","Failed"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("site.dtformat","H:i:s d/m/Y"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("site.include.tests","0"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("site.include.events","0"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("site.links.newwindow","1"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("log.level","5"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("freenats.firstrun","1"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("freenats.tracker","1"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("test.http.timeout","0"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("test.icmp.attempts","2"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("test.icmp.timeout","0"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("test.icmp.returnms","0"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("test.smtp.timeout","0"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("test.imap.timeout","0"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("test.mysql.timeout","0"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("test.tcp.timeout","0"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("test.udp.timeout","0"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("test.spawndelay","1"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("test.interval","0"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("retain.alert","0"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("retain.testrun","0"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("retain.record","0"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("retain.syslog","0"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("mail.fromname",""); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("mail.smtphostname",""); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("mail.smtpserver",""); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("mail.smtppassword",""); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("alert.body.footer",""); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("alert.body.header","FreeNATS Alert,"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("alert.subject.long","** FreeNATS Alert **"); +INSERT INTO fnconfig(fnc_var,fnc_val) VALUES("alert.subject.short","FreeNATS Alert"); + diff --git a/src/server/base/sql/example.sql b/src/server/base/sql/example.sql new file mode 100755 index 0000000..b5c95bf --- /dev/null +++ b/src/server/base/sql/example.sql @@ -0,0 +1,3 @@ +-- example.sql +-- FreeNATS Example Settings +INSERT INTO fnnode(nodeid,nodename,nodedesc,hostname,nodeenabled,pingtest,weight) VALUES("freenats","FreeNATS","FreeNATS Server","127.0.0.1",1,1,10); \ No newline at end of file diff --git a/src/server/base/sql/schema.drop.sql b/src/server/base/sql/schema.drop.sql new file mode 100755 index 0000000..213265c --- /dev/null +++ b/src/server/base/sql/schema.drop.sql @@ -0,0 +1,247 @@ +-- With DROP TABLES - will clean database +-- MySQL dump 10.9 +-- +-- Host: localhost Database: freenats +-- ------------------------------------------------------ +-- Server version 4.1.14 + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `fnalert` +-- + +DROP TABLE IF EXISTS `fnalert`; +CREATE TABLE `fnalert` ( + `alertid` bigint(20) unsigned NOT NULL auto_increment, + `nodeid` varchar(64) NOT NULL default '', + `alertlevel` int(11) NOT NULL default '0', + `openedx` bigint(20) unsigned NOT NULL default '0', + `closedx` bigint(20) unsigned NOT NULL default '0', + PRIMARY KEY (`alertid`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Table structure for table `fnalertaction` +-- + +DROP TABLE IF EXISTS `fnalertaction`; +CREATE TABLE `fnalertaction` ( + `aaid` bigint(20) unsigned NOT NULL auto_increment, + `atype` varchar(32) NOT NULL default '', + `efrom` varchar(250) NOT NULL default '', + `etolist` text NOT NULL, + `esubject` int(11) NOT NULL default '0', + `etype` int(11) NOT NULL default '0', + `awarnings` tinyint(1) NOT NULL default '0', + `adecrease` tinyint(1) NOT NULL default '0', + `mdata` text NOT NULL, + `aname` varchar(120) NOT NULL default '', + `ctrdate` varchar(8) NOT NULL default '', + `ctrlimit` int(10) unsigned NOT NULL default '0', + `ctrtoday` int(10) unsigned NOT NULL default '0', + PRIMARY KEY (`aaid`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Table structure for table `fnalertlog` +-- + +DROP TABLE IF EXISTS `fnalertlog`; +CREATE TABLE `fnalertlog` ( + `alid` bigint(20) unsigned NOT NULL auto_increment, + `alertid` bigint(20) unsigned NOT NULL default '0', + `postedx` bigint(20) unsigned NOT NULL default '0', + `logentry` varchar(250) NOT NULL default '', + PRIMARY KEY (`alid`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Table structure for table `fnconfig` +-- + +DROP TABLE IF EXISTS `fnconfig`; +CREATE TABLE `fnconfig` ( + `fnc_var` varchar(64) NOT NULL default '', + `fnc_val` varchar(64) NOT NULL default '', + PRIMARY KEY (`fnc_var`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Table structure for table `fneval` +-- + +DROP TABLE IF EXISTS `fneval`; +CREATE TABLE `fneval` ( + `evalid` bigint(20) unsigned NOT NULL auto_increment, + `testid` varchar(128) NOT NULL default '', + `weight` int(11) NOT NULL default '0', + `eoperator` varchar(32) NOT NULL default '', + `evalue` varchar(128) NOT NULL default '', + `eoutcome` int(11) NOT NULL default '0', + PRIMARY KEY (`evalid`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Table structure for table `fngroup` +-- + +DROP TABLE IF EXISTS `fngroup`; +CREATE TABLE `fngroup` ( + `groupid` bigint(20) unsigned NOT NULL auto_increment, + `groupname` varchar(128) NOT NULL default '', + `groupdesc` varchar(250) NOT NULL default '', + `groupicon` varchar(64) NOT NULL default '', + `weight` int(10) unsigned NOT NULL default '0', + PRIMARY KEY (`groupid`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Table structure for table `fngrouplink` +-- + +DROP TABLE IF EXISTS `fngrouplink`; +CREATE TABLE `fngrouplink` ( + `glid` bigint(20) unsigned NOT NULL auto_increment, + `groupid` bigint(20) unsigned NOT NULL default '0', + `nodeid` varchar(64) NOT NULL default '', + PRIMARY KEY (`glid`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Table structure for table `fnlocaltest` +-- + +DROP TABLE IF EXISTS `fnlocaltest`; +CREATE TABLE `fnlocaltest` ( + `localtestid` bigint(20) unsigned NOT NULL auto_increment, + `nodeid` varchar(64) NOT NULL default '', + `alertlevel` int(11) NOT NULL default '-1', + `lastrunx` bigint(20) unsigned NOT NULL default '0', + `testtype` varchar(128) NOT NULL default '', + `testparam` varchar(250) default NULL, + `testrecord` tinyint(1) NOT NULL default '0', + `simpleeval` tinyint(1) NOT NULL default '1', + PRIMARY KEY (`localtestid`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Table structure for table `fnlog` +-- + +DROP TABLE IF EXISTS `fnlog`; +CREATE TABLE `fnlog` ( + `logid` bigint(20) unsigned NOT NULL auto_increment, + `postedx` bigint(20) unsigned NOT NULL default '0', + `modid` varchar(32) NOT NULL default '', + `catid` varchar(32) NOT NULL default '', + `username` varchar(64) NOT NULL default '', + `loglevel` int(11) NOT NULL default '1', + `logevent` varchar(250) NOT NULL default '', + PRIMARY KEY (`logid`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Table structure for table `fnnalink` +-- + +DROP TABLE IF EXISTS `fnnalink`; +CREATE TABLE `fnnalink` ( + `nalid` bigint(20) unsigned NOT NULL auto_increment, + `nodeid` varchar(64) NOT NULL default '', + `aaid` bigint(20) unsigned NOT NULL default '0', + PRIMARY KEY (`nalid`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Table structure for table `fnnode` +-- + +DROP TABLE IF EXISTS `fnnode`; +CREATE TABLE `fnnode` ( + `nodeid` varchar(64) NOT NULL default '', + `nodename` varchar(128) NOT NULL default '', + `nodedesc` varchar(254) NOT NULL default '', + `hostname` varchar(254) NOT NULL default '', + `nodeenabled` tinyint(1) NOT NULL default '0', + `pingtest` tinyint(1) NOT NULL default '0', + `pingfatal` tinyint(1) NOT NULL default '0', + `alertlevel` int(11) NOT NULL default '-1', + `nodeicon` varchar(64) NOT NULL default '', + `weight` int(10) unsigned NOT NULL default '0', + `nodealert` tinyint(1) NOT NULL default '1', + PRIMARY KEY (`nodeid`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Table structure for table `fnrecord` +-- + +DROP TABLE IF EXISTS `fnrecord`; +CREATE TABLE `fnrecord` ( + `recordid` bigint(20) unsigned NOT NULL auto_increment, + `testid` varchar(128) NOT NULL default '', + `alertlevel` int(11) NOT NULL default '0', + `testvalue` float NOT NULL default '0', + `recordx` bigint(20) unsigned NOT NULL default '0', + `nodeid` varchar(64) NOT NULL default '', + PRIMARY KEY (`recordid`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Table structure for table `fnsession` +-- + +DROP TABLE IF EXISTS `fnsession`; +CREATE TABLE `fnsession` ( + `sessionid` bigint(20) unsigned NOT NULL auto_increment, + `sessionkey` varchar(128) NOT NULL default '', + `ipaddress` varchar(128) NOT NULL default '', + `username` varchar(64) NOT NULL default '', + `startx` bigint(20) unsigned NOT NULL default '0', + `updatex` bigint(20) unsigned NOT NULL default '0', + `userlevel` int(11) NOT NULL default '0', + PRIMARY KEY (`sessionid`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Table structure for table `fntestrun` +-- + +DROP TABLE IF EXISTS `fntestrun`; +CREATE TABLE `fntestrun` ( + `trid` bigint(20) unsigned NOT NULL auto_increment, + `startx` bigint(20) unsigned NOT NULL default '0', + `finishx` bigint(20) unsigned NOT NULL default '0', + `routput` text NOT NULL, + `fnode` varchar(64) NOT NULL default '', + PRIMARY KEY (`trid`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Table structure for table `fnuser` +-- + +DROP TABLE IF EXISTS `fnuser`; +CREATE TABLE `fnuser` ( + `username` varchar(64) NOT NULL default '', + `password` varchar(64) NOT NULL default '', + `realname` varchar(128) NOT NULL default '', + `userlevel` int(11) NOT NULL default '1' +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + diff --git a/src/server/base/sql/schema.sql b/src/server/base/sql/schema.sql new file mode 100755 index 0000000..6d3b7ca --- /dev/null +++ b/src/server/base/sql/schema.sql @@ -0,0 +1,224 @@ +-- No DROP TABLES - suitable for upgrade +-- MySQL dump 10.9 +-- +-- Host: localhost Database: freenats +-- ------------------------------------------------------ +-- Server version 4.1.14 +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `fnalert` +-- + +CREATE TABLE `fnalert` ( + `alertid` bigint(20) unsigned NOT NULL auto_increment, + `nodeid` varchar(64) NOT NULL default '', + `alertlevel` int(11) NOT NULL default '0', + `openedx` bigint(20) unsigned NOT NULL default '0', + `closedx` bigint(20) unsigned NOT NULL default '0', + PRIMARY KEY (`alertid`) +); + +-- +-- Table structure for table `fnalertaction` +-- + +CREATE TABLE `fnalertaction` ( + `aaid` bigint(20) unsigned NOT NULL auto_increment, + `atype` varchar(32) NOT NULL default '', + `efrom` varchar(250) NOT NULL default '', + `etolist` text NOT NULL, + `esubject` int(11) NOT NULL default '0', + `etype` int(11) NOT NULL default '0', + `awarnings` tinyint(1) NOT NULL default '0', + `adecrease` tinyint(1) NOT NULL default '0', + `mdata` text NOT NULL, + `aname` varchar(120) NOT NULL default '', + `ctrdate` varchar(8) NOT NULL default '', + `ctrlimit` int(10) unsigned NOT NULL default '0', + `ctrtoday` int(10) unsigned NOT NULL default '0', + PRIMARY KEY (`aaid`) +); + +-- +-- Table structure for table `fnalertlog` +-- + +CREATE TABLE `fnalertlog` ( + `alid` bigint(20) unsigned NOT NULL auto_increment, + `alertid` bigint(20) unsigned NOT NULL default '0', + `postedx` bigint(20) unsigned NOT NULL default '0', + `logentry` varchar(250) NOT NULL default '', + PRIMARY KEY (`alid`) +); + +-- +-- Table structure for table `fnconfig` +-- + +CREATE TABLE `fnconfig` ( + `fnc_var` varchar(64) NOT NULL default '', + `fnc_val` varchar(64) NOT NULL default '', + PRIMARY KEY (`fnc_var`) +); + +-- +-- Table structure for table `fneval` +-- + +CREATE TABLE `fneval` ( + `evalid` bigint(20) unsigned NOT NULL auto_increment, + `testid` varchar(128) NOT NULL default '', + `weight` int(11) NOT NULL default '0', + `eoperator` varchar(32) NOT NULL default '', + `evalue` varchar(128) NOT NULL default '', + `eoutcome` int(11) NOT NULL default '0', + PRIMARY KEY (`evalid`) +); + +-- +-- Table structure for table `fngroup` +-- + +CREATE TABLE `fngroup` ( + `groupid` bigint(20) unsigned NOT NULL auto_increment, + `groupname` varchar(128) NOT NULL default '', + `groupdesc` varchar(250) NOT NULL default '', + `groupicon` varchar(64) NOT NULL default '', + `weight` int(10) unsigned NOT NULL default '0', + PRIMARY KEY (`groupid`) +); + +-- +-- Table structure for table `fngrouplink` +-- + +CREATE TABLE `fngrouplink` ( + `glid` bigint(20) unsigned NOT NULL auto_increment, + `groupid` bigint(20) unsigned NOT NULL default '0', + `nodeid` varchar(64) NOT NULL default '', + PRIMARY KEY (`glid`) +); + +-- +-- Table structure for table `fnlocaltest` +-- + +CREATE TABLE `fnlocaltest` ( + `localtestid` bigint(20) unsigned NOT NULL auto_increment, + `nodeid` varchar(64) NOT NULL default '', + `alertlevel` int(11) NOT NULL default '-1', + `lastrunx` bigint(20) unsigned NOT NULL default '0', + `testtype` varchar(128) NOT NULL default '', + `testparam` varchar(250) default NULL, + `testrecord` tinyint(1) NOT NULL default '0', + `simpleeval` tinyint(1) NOT NULL default '1', + PRIMARY KEY (`localtestid`) +); + +-- +-- Table structure for table `fnlog` +-- + +CREATE TABLE `fnlog` ( + `logid` bigint(20) unsigned NOT NULL auto_increment, + `postedx` bigint(20) unsigned NOT NULL default '0', + `modid` varchar(32) NOT NULL default '', + `catid` varchar(32) NOT NULL default '', + `username` varchar(64) NOT NULL default '', + `loglevel` int(11) NOT NULL default '1', + `logevent` varchar(250) NOT NULL default '', + PRIMARY KEY (`logid`) +); + +-- +-- Table structure for table `fnnalink` +-- + +CREATE TABLE `fnnalink` ( + `nalid` bigint(20) unsigned NOT NULL auto_increment, + `nodeid` varchar(64) NOT NULL default '', + `aaid` bigint(20) unsigned NOT NULL default '0', + PRIMARY KEY (`nalid`) +); + +-- +-- Table structure for table `fnnode` +-- + +CREATE TABLE `fnnode` ( + `nodeid` varchar(64) NOT NULL default '', + `nodename` varchar(128) NOT NULL default '', + `nodedesc` varchar(254) NOT NULL default '', + `hostname` varchar(254) NOT NULL default '', + `nodeenabled` tinyint(1) NOT NULL default '0', + `pingtest` tinyint(1) NOT NULL default '0', + `pingfatal` tinyint(1) NOT NULL default '0', + `alertlevel` int(11) NOT NULL default '-1', + `nodeicon` varchar(64) NOT NULL default '', + `weight` int(10) unsigned NOT NULL default '0', + `nodealert` tinyint(1) NOT NULL default '1', + PRIMARY KEY (`nodeid`) +); + +-- +-- Table structure for table `fnrecord` +-- + +CREATE TABLE `fnrecord` ( + `recordid` bigint(20) unsigned NOT NULL auto_increment, + `testid` varchar(128) NOT NULL default '', + `alertlevel` int(11) NOT NULL default '0', + `testvalue` float NOT NULL default '0', + `recordx` bigint(20) unsigned NOT NULL default '0', + `nodeid` varchar(64) NOT NULL default '', + PRIMARY KEY (`recordid`) +); + +-- +-- Table structure for table `fnsession` +-- + +CREATE TABLE `fnsession` ( + `sessionid` bigint(20) unsigned NOT NULL auto_increment, + `sessionkey` varchar(128) NOT NULL default '', + `ipaddress` varchar(128) NOT NULL default '', + `username` varchar(64) NOT NULL default '', + `startx` bigint(20) unsigned NOT NULL default '0', + `updatex` bigint(20) unsigned NOT NULL default '0', + `userlevel` int(11) NOT NULL default '0', + PRIMARY KEY (`sessionid`) +); + +-- +-- Table structure for table `fntestrun` +-- + +CREATE TABLE `fntestrun` ( + `trid` bigint(20) unsigned NOT NULL auto_increment, + `startx` bigint(20) unsigned NOT NULL default '0', + `finishx` bigint(20) unsigned NOT NULL default '0', + `routput` text NOT NULL, + `fnode` varchar(64) NOT NULL default '', + PRIMARY KEY (`trid`) +); + +-- +-- Table structure for table `fnuser` +-- + +CREATE TABLE `fnuser` ( + `username` varchar(64) NOT NULL default '', + `password` varchar(64) NOT NULL default '', + `realname` varchar(128) NOT NULL default '', + `userlevel` int(11) NOT NULL default '1' +); + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + diff --git a/src/server/base/sql/schema.upgrade.sql b/src/server/base/sql/schema.upgrade.sql new file mode 100755 index 0000000..c812783 --- /dev/null +++ b/src/server/base/sql/schema.upgrade.sql @@ -0,0 +1,241 @@ +-- Both will generate many many errors - run with --force, ignore errors +-- dbupg.sh -- PurplePixie Systems +-- +-- SHOW TABLES LIKE "fn%" +-- Table: fnalert +-- DESCRIBE fnalert +ALTER TABLE `fnalert` CHANGE `alertid` `alertid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fnalert` ADD `alertid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fnalert` ADD PRIMARY KEY( `alertid` ); +ALTER TABLE `fnalert` CHANGE `nodeid` `nodeid` varchar(64) NOT NULL; +ALTER TABLE `fnalert` ADD `nodeid` varchar(64) NOT NULL; +ALTER TABLE `fnalert` CHANGE `alertlevel` `alertlevel` int(11) NOT NULL DEFAULT '0'; +ALTER TABLE `fnalert` ADD `alertlevel` int(11) NOT NULL DEFAULT '0'; +ALTER TABLE `fnalert` CHANGE `openedx` `openedx` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnalert` ADD `openedx` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnalert` CHANGE `closedx` `closedx` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnalert` ADD `closedx` bigint(20) unsigned NOT NULL DEFAULT '0'; +-- +-- Table: fnalertaction +-- DESCRIBE fnalertaction +ALTER TABLE `fnalertaction` CHANGE `aaid` `aaid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fnalertaction` ADD `aaid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fnalertaction` ADD PRIMARY KEY( `aaid` ); +ALTER TABLE `fnalertaction` CHANGE `atype` `atype` varchar(32) NOT NULL; +ALTER TABLE `fnalertaction` ADD `atype` varchar(32) NOT NULL; +ALTER TABLE `fnalertaction` CHANGE `efrom` `efrom` varchar(250) NOT NULL; +ALTER TABLE `fnalertaction` ADD `efrom` varchar(250) NOT NULL; +ALTER TABLE `fnalertaction` CHANGE `etolist` `etolist` text NOT NULL; +ALTER TABLE `fnalertaction` ADD `etolist` text NOT NULL; +ALTER TABLE `fnalertaction` CHANGE `esubject` `esubject` int(11) NOT NULL DEFAULT '0'; +ALTER TABLE `fnalertaction` ADD `esubject` int(11) NOT NULL DEFAULT '0'; +ALTER TABLE `fnalertaction` CHANGE `etype` `etype` int(11) NOT NULL DEFAULT '0'; +ALTER TABLE `fnalertaction` ADD `etype` int(11) NOT NULL DEFAULT '0'; +ALTER TABLE `fnalertaction` CHANGE `awarnings` `awarnings` tinyint(1) NOT NULL DEFAULT '0'; +ALTER TABLE `fnalertaction` ADD `awarnings` tinyint(1) NOT NULL DEFAULT '0'; +ALTER TABLE `fnalertaction` CHANGE `adecrease` `adecrease` tinyint(1) NOT NULL DEFAULT '0'; +ALTER TABLE `fnalertaction` ADD `adecrease` tinyint(1) NOT NULL DEFAULT '0'; +ALTER TABLE `fnalertaction` CHANGE `mdata` `mdata` text NOT NULL; +ALTER TABLE `fnalertaction` ADD `mdata` text NOT NULL; +ALTER TABLE `fnalertaction` CHANGE `aname` `aname` varchar(120) NOT NULL; +ALTER TABLE `fnalertaction` ADD `aname` varchar(120) NOT NULL; +ALTER TABLE `fnalertaction` CHANGE `ctrdate` `ctrdate` varchar(8) NOT NULL; +ALTER TABLE `fnalertaction` ADD `ctrdate` varchar(8) NOT NULL; +ALTER TABLE `fnalertaction` CHANGE `ctrlimit` `ctrlimit` int(10) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnalertaction` ADD `ctrlimit` int(10) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnalertaction` CHANGE `ctrtoday` `ctrtoday` int(10) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnalertaction` ADD `ctrtoday` int(10) unsigned NOT NULL DEFAULT '0'; +-- +-- Table: fnalertlog +-- DESCRIBE fnalertlog +ALTER TABLE `fnalertlog` CHANGE `alid` `alid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fnalertlog` ADD `alid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fnalertlog` ADD PRIMARY KEY( `alid` ); +ALTER TABLE `fnalertlog` CHANGE `alertid` `alertid` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnalertlog` ADD `alertid` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnalertlog` CHANGE `postedx` `postedx` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnalertlog` ADD `postedx` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnalertlog` CHANGE `logentry` `logentry` varchar(250) NOT NULL; +ALTER TABLE `fnalertlog` ADD `logentry` varchar(250) NOT NULL; +-- +-- Table: fnconfig +-- DESCRIBE fnconfig +ALTER TABLE `fnconfig` CHANGE `fnc_var` `fnc_var` varchar(64) NOT NULL; +ALTER TABLE `fnconfig` ADD `fnc_var` varchar(64) NOT NULL; +ALTER TABLE `fnconfig` ADD PRIMARY KEY( `fnc_var` ); +ALTER TABLE `fnconfig` CHANGE `fnc_val` `fnc_val` varchar(64) NOT NULL; +ALTER TABLE `fnconfig` ADD `fnc_val` varchar(64) NOT NULL; +-- +-- Table: fneval +-- DESCRIBE fneval +ALTER TABLE `fneval` CHANGE `evalid` `evalid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fneval` ADD `evalid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fneval` ADD PRIMARY KEY( `evalid` ); +ALTER TABLE `fneval` CHANGE `testid` `testid` varchar(128) NOT NULL; +ALTER TABLE `fneval` ADD `testid` varchar(128) NOT NULL; +ALTER TABLE `fneval` CHANGE `weight` `weight` int(11) NOT NULL DEFAULT '0'; +ALTER TABLE `fneval` ADD `weight` int(11) NOT NULL DEFAULT '0'; +ALTER TABLE `fneval` CHANGE `eoperator` `eoperator` varchar(32) NOT NULL; +ALTER TABLE `fneval` ADD `eoperator` varchar(32) NOT NULL; +ALTER TABLE `fneval` CHANGE `evalue` `evalue` varchar(128) NOT NULL; +ALTER TABLE `fneval` ADD `evalue` varchar(128) NOT NULL; +ALTER TABLE `fneval` CHANGE `eoutcome` `eoutcome` int(11) NOT NULL DEFAULT '0'; +ALTER TABLE `fneval` ADD `eoutcome` int(11) NOT NULL DEFAULT '0'; +-- +-- Table: fngroup +-- DESCRIBE fngroup +ALTER TABLE `fngroup` CHANGE `groupid` `groupid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fngroup` ADD `groupid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fngroup` ADD PRIMARY KEY( `groupid` ); +ALTER TABLE `fngroup` CHANGE `groupname` `groupname` varchar(128) NOT NULL; +ALTER TABLE `fngroup` ADD `groupname` varchar(128) NOT NULL; +ALTER TABLE `fngroup` CHANGE `groupdesc` `groupdesc` varchar(250) NOT NULL; +ALTER TABLE `fngroup` ADD `groupdesc` varchar(250) NOT NULL; +ALTER TABLE `fngroup` CHANGE `groupicon` `groupicon` varchar(64) NOT NULL; +ALTER TABLE `fngroup` ADD `groupicon` varchar(64) NOT NULL; +ALTER TABLE `fngroup` CHANGE `weight` `weight` int(10) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fngroup` ADD `weight` int(10) unsigned NOT NULL DEFAULT '0'; +-- +-- Table: fngrouplink +-- DESCRIBE fngrouplink +ALTER TABLE `fngrouplink` CHANGE `glid` `glid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fngrouplink` ADD `glid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fngrouplink` ADD PRIMARY KEY( `glid` ); +ALTER TABLE `fngrouplink` CHANGE `groupid` `groupid` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fngrouplink` ADD `groupid` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fngrouplink` CHANGE `nodeid` `nodeid` varchar(64) NOT NULL; +ALTER TABLE `fngrouplink` ADD `nodeid` varchar(64) NOT NULL; +-- +-- Table: fnlocaltest +-- DESCRIBE fnlocaltest +ALTER TABLE `fnlocaltest` CHANGE `localtestid` `localtestid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fnlocaltest` ADD `localtestid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fnlocaltest` ADD PRIMARY KEY( `localtestid` ); +ALTER TABLE `fnlocaltest` CHANGE `nodeid` `nodeid` varchar(64) NOT NULL; +ALTER TABLE `fnlocaltest` ADD `nodeid` varchar(64) NOT NULL; +ALTER TABLE `fnlocaltest` CHANGE `alertlevel` `alertlevel` int(11) NOT NULL DEFAULT '-1'; +ALTER TABLE `fnlocaltest` ADD `alertlevel` int(11) NOT NULL DEFAULT '-1'; +ALTER TABLE `fnlocaltest` CHANGE `lastrunx` `lastrunx` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnlocaltest` ADD `lastrunx` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnlocaltest` CHANGE `testtype` `testtype` varchar(128) NOT NULL; +ALTER TABLE `fnlocaltest` ADD `testtype` varchar(128) NOT NULL; +ALTER TABLE `fnlocaltest` CHANGE `testparam` `testparam` varchar(250); +ALTER TABLE `fnlocaltest` ADD `testparam` varchar(250); +ALTER TABLE `fnlocaltest` CHANGE `testrecord` `testrecord` tinyint(1) NOT NULL DEFAULT '0'; +ALTER TABLE `fnlocaltest` ADD `testrecord` tinyint(1) NOT NULL DEFAULT '0'; +ALTER TABLE `fnlocaltest` CHANGE `simpleeval` `simpleeval` tinyint(1) NOT NULL DEFAULT '1'; +ALTER TABLE `fnlocaltest` ADD `simpleeval` tinyint(1) NOT NULL DEFAULT '1'; +-- +-- Table: fnlog +-- DESCRIBE fnlog +ALTER TABLE `fnlog` CHANGE `logid` `logid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fnlog` ADD `logid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fnlog` ADD PRIMARY KEY( `logid` ); +ALTER TABLE `fnlog` CHANGE `postedx` `postedx` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnlog` ADD `postedx` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnlog` CHANGE `modid` `modid` varchar(32) NOT NULL; +ALTER TABLE `fnlog` ADD `modid` varchar(32) NOT NULL; +ALTER TABLE `fnlog` CHANGE `catid` `catid` varchar(32) NOT NULL; +ALTER TABLE `fnlog` ADD `catid` varchar(32) NOT NULL; +ALTER TABLE `fnlog` CHANGE `username` `username` varchar(64) NOT NULL; +ALTER TABLE `fnlog` ADD `username` varchar(64) NOT NULL; +ALTER TABLE `fnlog` CHANGE `loglevel` `loglevel` int(11) NOT NULL DEFAULT '1'; +ALTER TABLE `fnlog` ADD `loglevel` int(11) NOT NULL DEFAULT '1'; +ALTER TABLE `fnlog` CHANGE `logevent` `logevent` varchar(250) NOT NULL; +ALTER TABLE `fnlog` ADD `logevent` varchar(250) NOT NULL; +-- +-- Table: fnnalink +-- DESCRIBE fnnalink +ALTER TABLE `fnnalink` CHANGE `nalid` `nalid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fnnalink` ADD `nalid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fnnalink` ADD PRIMARY KEY( `nalid` ); +ALTER TABLE `fnnalink` CHANGE `nodeid` `nodeid` varchar(64) NOT NULL; +ALTER TABLE `fnnalink` ADD `nodeid` varchar(64) NOT NULL; +ALTER TABLE `fnnalink` CHANGE `aaid` `aaid` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnnalink` ADD `aaid` bigint(20) unsigned NOT NULL DEFAULT '0'; +-- +-- Table: fnnode +-- DESCRIBE fnnode +ALTER TABLE `fnnode` CHANGE `nodeid` `nodeid` varchar(64) NOT NULL; +ALTER TABLE `fnnode` ADD `nodeid` varchar(64) NOT NULL; +ALTER TABLE `fnnode` ADD PRIMARY KEY( `nodeid` ); +ALTER TABLE `fnnode` CHANGE `nodename` `nodename` varchar(128) NOT NULL; +ALTER TABLE `fnnode` ADD `nodename` varchar(128) NOT NULL; +ALTER TABLE `fnnode` CHANGE `nodedesc` `nodedesc` varchar(254) NOT NULL; +ALTER TABLE `fnnode` ADD `nodedesc` varchar(254) NOT NULL; +ALTER TABLE `fnnode` CHANGE `hostname` `hostname` varchar(254) NOT NULL; +ALTER TABLE `fnnode` ADD `hostname` varchar(254) NOT NULL; +ALTER TABLE `fnnode` CHANGE `nodeenabled` `nodeenabled` tinyint(1) NOT NULL DEFAULT '0'; +ALTER TABLE `fnnode` ADD `nodeenabled` tinyint(1) NOT NULL DEFAULT '0'; +ALTER TABLE `fnnode` CHANGE `pingtest` `pingtest` tinyint(1) NOT NULL DEFAULT '0'; +ALTER TABLE `fnnode` ADD `pingtest` tinyint(1) NOT NULL DEFAULT '0'; +ALTER TABLE `fnnode` CHANGE `pingfatal` `pingfatal` tinyint(1) NOT NULL DEFAULT '0'; +ALTER TABLE `fnnode` ADD `pingfatal` tinyint(1) NOT NULL DEFAULT '0'; +ALTER TABLE `fnnode` CHANGE `alertlevel` `alertlevel` int(11) NOT NULL DEFAULT '-1'; +ALTER TABLE `fnnode` ADD `alertlevel` int(11) NOT NULL DEFAULT '-1'; +ALTER TABLE `fnnode` CHANGE `nodeicon` `nodeicon` varchar(64) NOT NULL; +ALTER TABLE `fnnode` ADD `nodeicon` varchar(64) NOT NULL; +ALTER TABLE `fnnode` CHANGE `weight` `weight` int(10) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnnode` ADD `weight` int(10) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnnode` CHANGE `nodealert` `nodealert` tinyint(1) NOT NULL DEFAULT '1'; +ALTER TABLE `fnnode` ADD `nodealert` tinyint(1) NOT NULL DEFAULT '1'; +-- +-- Table: fnrecord +-- DESCRIBE fnrecord +ALTER TABLE `fnrecord` CHANGE `recordid` `recordid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fnrecord` ADD `recordid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fnrecord` ADD PRIMARY KEY( `recordid` ); +ALTER TABLE `fnrecord` CHANGE `testid` `testid` varchar(128) NOT NULL; +ALTER TABLE `fnrecord` ADD `testid` varchar(128) NOT NULL; +ALTER TABLE `fnrecord` CHANGE `alertlevel` `alertlevel` int(11) NOT NULL DEFAULT '0'; +ALTER TABLE `fnrecord` ADD `alertlevel` int(11) NOT NULL DEFAULT '0'; +ALTER TABLE `fnrecord` CHANGE `testvalue` `testvalue` float NOT NULL DEFAULT '0'; +ALTER TABLE `fnrecord` ADD `testvalue` float NOT NULL DEFAULT '0'; +ALTER TABLE `fnrecord` CHANGE `recordx` `recordx` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnrecord` ADD `recordx` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnrecord` CHANGE `nodeid` `nodeid` varchar(64) NOT NULL; +ALTER TABLE `fnrecord` ADD `nodeid` varchar(64) NOT NULL; +-- +-- Table: fnsession +-- DESCRIBE fnsession +ALTER TABLE `fnsession` CHANGE `sessionid` `sessionid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fnsession` ADD `sessionid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fnsession` ADD PRIMARY KEY( `sessionid` ); +ALTER TABLE `fnsession` CHANGE `sessionkey` `sessionkey` varchar(128) NOT NULL; +ALTER TABLE `fnsession` ADD `sessionkey` varchar(128) NOT NULL; +ALTER TABLE `fnsession` CHANGE `ipaddress` `ipaddress` varchar(128) NOT NULL; +ALTER TABLE `fnsession` ADD `ipaddress` varchar(128) NOT NULL; +ALTER TABLE `fnsession` CHANGE `username` `username` varchar(64) NOT NULL; +ALTER TABLE `fnsession` ADD `username` varchar(64) NOT NULL; +ALTER TABLE `fnsession` CHANGE `startx` `startx` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnsession` ADD `startx` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnsession` CHANGE `updatex` `updatex` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnsession` ADD `updatex` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fnsession` CHANGE `userlevel` `userlevel` int(11) NOT NULL DEFAULT '0'; +ALTER TABLE `fnsession` ADD `userlevel` int(11) NOT NULL DEFAULT '0'; +-- +-- Table: fntestrun +-- DESCRIBE fntestrun +ALTER TABLE `fntestrun` CHANGE `trid` `trid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fntestrun` ADD `trid` bigint(20) unsigned NOT NULL auto_increment; +ALTER TABLE `fntestrun` ADD PRIMARY KEY( `trid` ); +ALTER TABLE `fntestrun` CHANGE `startx` `startx` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fntestrun` ADD `startx` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fntestrun` CHANGE `finishx` `finishx` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fntestrun` ADD `finishx` bigint(20) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `fntestrun` CHANGE `routput` `routput` text NOT NULL; +ALTER TABLE `fntestrun` ADD `routput` text NOT NULL; +ALTER TABLE `fntestrun` CHANGE `fnode` `fnode` varchar(64) NOT NULL; +ALTER TABLE `fntestrun` ADD `fnode` varchar(64) NOT NULL; +-- +-- Table: fnuser +-- DESCRIBE fnuser +ALTER TABLE `fnuser` CHANGE `username` `username` varchar(64) NOT NULL; +ALTER TABLE `fnuser` ADD `username` varchar(64) NOT NULL; +ALTER TABLE `fnuser` CHANGE `password` `password` varchar(64) NOT NULL; +ALTER TABLE `fnuser` ADD `password` varchar(64) NOT NULL; +ALTER TABLE `fnuser` CHANGE `realname` `realname` varchar(128) NOT NULL; +ALTER TABLE `fnuser` ADD `realname` varchar(128) NOT NULL; +ALTER TABLE `fnuser` CHANGE `userlevel` `userlevel` int(11) NOT NULL DEFAULT '1'; +ALTER TABLE `fnuser` ADD `userlevel` int(11) NOT NULL DEFAULT '1'; +-- diff --git a/src/server/base/tests.inc.php b/src/server/base/tests.inc.php new file mode 100755 index 0000000..089935c --- /dev/null +++ b/src/server/base/tests.inc.php @@ -0,0 +1,374 @@ +Cfg->Get("test.interval",0); +if ($sleep<=0) return false; +$sleep=$sleep*1000000; // convert to usec +usleep($sleep); +return true; +} + +function url_lookup($url) +{ +// Sod regular expressions here as we'd have to do it twice or with cleverness I lack +// Is it a URL? +$colon=strpos($url,":"); +if ($colon != 0) // exists so it a URL + { + $out=preg_match("@^(?:http[s]*://)?([^/|\?|:]+)@i",$url,$matches); + $hostname=$matches[1]; + } +else $hostname=$url; // try direct + +return ip_lookup($hostname); +} + + +function bin_str_dump($s,$count=0) +{ +//$s = base_convert($s,10,2); +$data = unpack('C*',$s); +foreach($data as $item) + { + echo ord($item)." "; + } +echo "\n"; +} + + + +function PingTest($host,$ctimeout=-1) + { + global $NATS; + + $returnsecs=true; + if (isset($NATS)) + { + if ($NATS->Cfg->Get("test.icmp.returnms",0)==1) $returnsecs=false; + } + + // Timeout Values + if (isset($NATS)) $timeout=$NATS->Cfg->Get("test.icmp.timeout",10); + else $timeout=10; + if ($ctimeout>0) $timeout=$ctimeout; // use custom timeout if passed + if ($timeout<=0) $timeout=10; // catch-all for defaults bug + + $ping = new PPPing(); + $ping->hostname = $host; + $ping->timeout = $timeout; + + $result=$ping->Ping(); + + if ($result<0) // error condition + { + return $result; + } + else if ($result==0) // zero time + { + $result="0.0001"; + } + + if ($returnsecs) + { + $result = round($result/1000,3); // convert to seconds + if ($result==0) $result=0.0001; + } + + return $result; + } + +function WebTest($url,$timeout=-1) + { + global $NATS; + if ($timeout<=0) // use NATS or env + { + if (isset($NATS)) + { + $nto=$NATS->Cfg->Get("test.http.timeout",-1); + if ($nto>0) $timeout=$nto; // use NATS timeout + } + } + if ($timeout>0) // use the set timeout + $oldtimeout=ini_set("default_socket_timeout",$timeout); + + if (function_exists("curl_getinfo")) // use CURL if present + { + $ch=curl_init(); + curl_setopt($ch,CURLOPT_URL,$url); + curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); + curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,0); + curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,0); + curl_setopt($ch,CURLOPT_HEADER,1); + if ($timeout>0) curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout); + if ($timeout>0) curl_setopt($ch,CURLOPT_TIMEOUT,$timeout); + if (!$output=curl_exec($ch)) + { + $ctr=-1; // failed + } + else $ctr=round(curl_getinfo($ch,CURLINFO_SIZE_DOWNLOAD)/1024,2); + curl_close($ch); + + if ($ctr==0) $ctr="0.0001"; + + } + else + { // no CURL - use fopen() + $oldagent=ini_set("user_agent","MSIE 4\.0b2;"); // MSIE 4.0b2 is HTTP/1.0 only just like fopen http wrapper + $fp=@fopen($url,"r"); + if ($fp<=0) + { + if ($timeout>0) ini_set("default_socket_timeout",$oldtimeout); + ini_set("user_agent",$oldagent); + return -1; + } + $ctr=0; + while ($body=@fgets($fp,1024)) $ctr+=sizeof($body); + @fclose($fp); + ini_set("user_agent",$oldagent); + } + + + + if ($timeout>0) ini_set("default_socket_timeout",$oldtimeout); + return $ctr; + } + +function DoTest($test,$param,$hostname="",$timeout=-1,$params=0,$nodeid="") +{ +global $NATS; +if (!is_array($params)) + { + $params=array(); + for ($a=0; $a<10; $a++) $params[$a]=""; + } + +switch ($test) + { + case "web": case "wsize": + // Don't bother with pre-resolution as size only + return WebTest($param,$timeout); + break; + /* -- modularised + case "tcp": // nb TCP does not support timeouts currently + $ip=ip_lookup($hostname); + if ($ip=="0") return 0; + $fp=@fsockopen($ip,$param); + if ($fp<=0) return 0; + @fclose($fp); + return 1; + break; + */ + case "wtime": + $timer=new TFNTimer(); + // Do a pre-lookup + $ip=url_lookup($param); + if ($ip=="0") return -1; // dns lookup failed + $timer->Start(); + $r=WebTest($param,$timeout); + $elapsedTime=$timer->Stop(); + $elapsedTime=round($elapsedTime,4); + if ($r<0) return -1; // open failed + if ($r==0) return -2; // no chars shown as returned + if ($elapsedTime<=0) return 0.0001; + return $elapsedTime; + break; + + case "host": + $timer=new TFNTimer(); + if (preg_match("/[a-zA-Z]/",$param)>0) $is_ip=false; + else $is_ip=true; + + $timer->Start(); + if ($is_ip) $result=gethostbyaddr($param); + else $result=gethostbyname($param); + $elapsedTime=$timer->Stop(); + + if ($result==$param) // lookup failed + return -1; + + if ($result=="") // lookup failed + return -1; + + $elapsedTime=round($elapsedTime,4); + if ($elapsedTime<=0) return 0.0001; + return $elapsedTime; + break; + + case "testloop": + return $param; + break; + + case "testrand": + mt_srand(microtime()*1000000); + if ( ($param=="") || ($param==0) ) $param=100; + return mt_rand(0,$param); + break; + + case "ping": + return PingTest($param,$timeout); + break; + + default: + if (isset($NATS)) // try and see if a test is registered + { + if (isset($NATS->Tests->QuickList[$test])) // exists + { + $NATS->Tests->Tests[$test]->Create(); + return $NATS->Tests->Tests[$test]->instance->DoTest($test,$param,$hostname,$timeout,$params); + } + } + + } +return -1; // did not run any test so untested +} + +function SimpleEval($test,$result) +{ +global $NATS; +switch($test) + { + case "ping": // handles both types of simple evaluation (inbuilt ICMP and remote ping) + if ($result<=0) return 2; + return 0; + case "web": case "wsize": + if ($result<=0) return 2; + return 0; + /* + case "tcp": + if ($result==1) return 0; + return 2; + */ + case "wtime": + if ($result<0) return 2; + return 0; + /* + case "mysql": + if ($result<=0) return 2; + return 0; + + case "mysqlrows": + if ($result<=0) return 2; // no rows returned or error + return 0; + */ + case "host": case "dns": + if ($result<=0) return 2; // no records returned or error + + case "testloop": + return 0; + case "testrand": + return 0; + + default: + if (isset($NATS)) + { + if (isset($NATS->Tests->QuickList[$test])) + { + $NATS->Tests->Tests[$test]->Create(); + return $NATS->Tests->Tests[$test]->instance->Evaluate($result); + } + } + } +return -1; // untested if we don't know WTF the result was +} + +function aText($al) +{ +return oText($al); // uses function in tests.inc.php with site config support +/* -- depreciated +switch($al) + { + case -1: return "Untested"; + case 0: return "Passed"; + case 1: return "Warning"; + case 2: return "Failed"; + default: return "Unknown"; + } +*/ +} +?> \ No newline at end of file diff --git a/src/server/base/tests/dns.inc.php b/src/server/base/tests/dns.inc.php new file mode 100755 index 0000000..824dbc2 --- /dev/null +++ b/src/server/base/tests/dns.inc.php @@ -0,0 +1,562 @@ +types_by_id[$id]=$name; + $this->types_by_name[$name]=$id; + } + + function DNSTypes() + { + $this->types_by_id=array(); + $this->types_by_name=array(); + + $this->AddType(1,"A"); + $this->AddType(2,"NS"); + $this->AddType(5,"CNAME"); + $this->AddType(6,"SOA"); + $this->AddType(12,"PTR"); + $this->AddType(15,"MX"); + $this->AddType(16,"TXT"); + $this->AddType(255,"ANY"); + } + + function GetByName($name) + { + if (isset($this->types_by_name[$name])) return $this->types_by_name[$name]; + return 0; + } + + function GetById($id) + { + if (isset($this->types_by_id[$id])) return $this->types_by_id[$id]; + return ""; + } +} + +class DNSResult +{ + var $type; + var $typeid; + var $class; + var $ttl; + var $data; + var $domain; + var $string; + var $extas=array(); +} + +class DNSAnswer +{ + var $count=0; + var $results=array(); + + function AddResult($type,$typeid,$class,$ttl,$data,$domain="",$string="",$extras=array()) + { + $this->results[$this->count]=new DNSResult(); + $this->results[$this->count]->type=$type; + $this->results[$this->count]->typeid=$typeid; + $this->results[$this->count]->class=$class; + $this->results[$this->count]->ttl=$ttl; + $this->results[$this->count]->data=$data; + $this->results[$this->count]->domain=$domain; + $this->results[$this->count]->string=$string; + $this->results[$this->count]->extras=$extras; + $this->count++; + return ($this->count-1); + } +} + + +class DNSQuery +{ + var $server=""; + var $port; + var $timeout; + var $udp; + var $debug; + var $binarydebug=false; + + var $types; + + var $rawbuffer=""; + var $rawheader=""; + var $rawresponse=""; + var $header; + var $responsecounter=0; + + var $lastnameservers; + var $lastadditional; + + var $error=false; + var $lasterror=""; + + function ReadResponse($count=1,$offset="") + { + if ($offset=="") // no offset so use and increment the ongoing counter + { + $return=substr($this->rawbuffer,$this->responsecounter,$count); + $this->responsecounter+=$count; + } + else + { + $return=substr($this->rawbuffer,$offset,$count); + } + return $return; + } + + function ReadDomainLabels($offset,&$counter=0) + { + $labels=array(); + $startoffset=$offset; + $return=false; + while (!$return) + { + $label_len=ord($this->ReadResponse(1,$offset++)); + if ($label_len<=0) $return=true; // end of data + else if ($label_len<64) // uncompressed data + { + $labels[]=$this->ReadResponse($label_len,$offset); + $offset+=$label_len; + } + else // label_len>=64 -- pointer + { + $nextitem=$this->ReadResponse(1,$offset++); + $pointer_offset = ( ($label_len & 0x3f) << 8 ) + ord($nextitem); + // Branch Back Upon Ourselves... + $this->Debug("Label Offset: ".$pointer_offset); + $pointer_labels=$this->ReadDomainLabels($pointer_offset); + foreach($pointer_labels as $ptr_label) + $labels[]=$ptr_label; + $return=true; + } + } + $counter=$offset-$startoffset; + return $labels; + } + + function ReadDomainLabel() + { + $count=0; + $labels=$this->ReadDomainLabels($this->responsecounter,$count); + $domain=implode(".",$labels); + $this->responsecounter+=$count; + $this->Debug("Label ".$domain." len ".$count); + return $domain; + } + + function Debug($text) + { + if ($this->debug) echo $text."\n"; + } + + function DebugBinary($data) + { + if ($this->binarydebug) + { + for ($a=0; $a30)&&($dec<150)) echo $data[$a]; + echo "\n"; + } + } + } + + function SetError($text) + { + $this->error=true; + $this->lasterror=$text; + $this->Debug("Error: ".$text); + } + + function ClearError() + { + $this->error=false; + $this->lasterror=""; + } + + function DNSQuery($server,$port=53,$timeout=60,$udp=true,$debug=false) + { + $this->server=$server; + $this->port=$port; + $this->timeout=$timeout; + $this->udp=$udp; + $this->debug=$debug; + + $this->types=new DNSTypes(); + $this->Debug("DNSQuery Class Initialised"); + } + + + function ReadRecord() + { + // First the pesky domain names - maybe not so pesky though I suppose + + $domain=$this->ReadDomainLabel(); + + + + $ans_header_bin=$this->ReadResponse(10); // 10 byte header + $ans_header=unpack("ntype/nclass/Nttl/nlength",$ans_header_bin); + $this->Debug("Record Type ".$ans_header['type']." Class ".$ans_header['class']." TTL ".$ans_header['ttl']." Length ".$ans_header['length']); + + $typeid=$this->types->GetById($ans_header['type']); + $extras=array(); + $data=""; + $string=""; + + switch($typeid) + { + case "A": + $ip=implode(".",unpack("Ca/Cb/Cc/Cd",$this->ReadResponse(4))); + $data=$ip; + $string=$domain." has address ".$ip; + break; + + case "NS": + $nameserver=$this->ReadDomainLabel(); + $data=$nameserver; + $string=$domain." nameserver ".$nameserver; + break; + + case "PTR": + $data=$this->ReadDomainLabel(); + $string=$domain." points to ".$data; + break; + + case "CNAME": + $data=$this->ReadDomainLabel(); + $string=$domain." alias of ".$data; + break; + + case "MX": + $prefs=$this->ReadResponse(2); + $prefs=unpack("nlevel",$prefs); + $extras['level']=$prefs['level']; + $data=$this->ReadDomainLabel(); + $string=$domain." mailserver ".$data." (pri=".$extras['level'].")"; + break; + + case "SOA": + // Label First + $data=$this->ReadDomainLabel(); + $responsible=$this->ReadDomainLabel(); + + $buffer=$this->ReadResponse(20); + $extras=unpack("nserial/nrefresh/Nretry/Nexpiry/Nminttl",$buffer); + $dot=strpos($responsible,"."); + $responsible[$dot]="@"; + $extras['responsible']=$responsible; + $string=$domain." SOA ".$data." Serial ".$extras['serial']; + break; + + case "TXT": + $data=$this->ReadResponse($ans_header['length']); + $string=$domain." TEXT ".$data; + break; + + default: // something we can't deal with + $stuff=$this->ReadResponse($ans_header['length']); + break; + + } + + //$dns_answer->AddResult($ans_header['type'],$typeid,$ans_header['class'],$ans_header['ttl'],$data,$domain,$string,$extras); + $return=array( + "header" => $ans_header, + "typeid" => $typeid, + "data" => $data, + "domain" => $domain, + "string" => $string, + "extras" => $extras ); + return $return; + } + + + + + + + function Query($question,$type="A") + { + $this->ClearError(); + $typeid=$this->types->GetByName($type); + if ($typeid===false) + { + $this->SetError("Invalid Query Type ".$type); + return false; + } + + if ($this->udp) $host="udp://".$this->server; + else $host=$this->server; + + if (!$socket=fsockopen($host,$this->port,$this->timeout)) + { + $this->SetError("Failed to Open Socket"); + return false; + } + + // Split Into Labels + if (preg_match("/[a-z|A-Z]/",$question)==0) // IP Address + { + $labeltmp=explode(".",$question); // reverse ARPA format + for ($i=count($labeltmp)-1; $i>=0; $i--) + $labels[]=$labeltmp[$i]; + $labels[]="IN-ADDR"; + $labels[]="ARPA"; + } + else // hostname + $labels=explode(".",$question); + + $question_binary=""; + for ($a=0; $aDebug("Question: ".$question." (type=".$type."/".$typeid.")"); + + $id=rand(1,255)|(rand(0,255)<<8); // generate the ID + + // Set standard codes and flags + $flags=0x0100 & 0x0300; // recursion & queryspecmask + $opcode=0x0000; // opcode + + // Build the header + $header=""; + $header.=pack("n",$id); + $header.=pack("n",$opcode | $flags); + $header.=pack("nnnn",1,0,0,0); + $header.=$question_binary; + $header.=pack("n",$typeid); + $header.=pack("n",0x0001); // internet class + $headersize=strlen($header); + $headersizebin=pack("n",$headersize); + + $this->Debug("Header Length: ".$headersize." Bytes"); + $this->DebugBinary($header); + + if ( ($this->udp) && ($headersize>=512) ) + { + $this->SetError("Question too big for UDP (".$headersize." bytes)"); + fclose($socket); + return false; + } + + if ($this->udp) // UDP method + { + if (!fwrite($socket,$header,$headersize)) + { + $this->SetError("Failed to write question to socket"); + fclose($socket); + return false; + } + if (!$this->rawbuffer=fread($socket,4096)) // read until the end with UDP + { + $this->SetError("Failed to write read data buffer"); + fclose($socket); + return false; + } + } + else // TCP + { + if (!fwrite($socket,$headersizebin)) // write the socket + { + $this->SetError("Failed to write question length to TCP socket"); + fclose($socket); + return false; + } + if (!fwrite($socket,$header,$headersize)) + { + $this->SetError("Failed to write question to TCP socket"); + fclose($socket); + return false; + } + if (!$returnsize=fread($socket,2)) + { + $this->SetError("Failed to read size from TCP socket"); + fclose($socket); + return false; + } + $tmplen=unpack("nlength",$returnsize); + $datasize=$tmplen['length']; + $this->Debug("TCP Stream Length Limit ".$datasize); + if (!$this->rawbuffer=fread($socket,$datasize)) + { + $this->SetError("Failed to read data buffer"); + fclose($socket); + return false; + } + } + fclose($socket); + + $buffersize=strlen($this->rawbuffer); + $this->Debug("Read Buffer Size ".$buffersize); + + if ($buffersize<12) + { + $this->SetError("Return Buffer too Small"); + return false; + } + + $this->rawheader=substr($this->rawbuffer,0,12); // first 12 bytes is the header + $this->rawresponse=substr($this->rawbuffer,12); // after that the response + + $this->responsecounter=12; // start parsing response counter from 12 - no longer using response so can do pointers + + $this->DebugBinary($this->rawbuffer); + + $this->header=unpack("nid/nspec/nqdcount/nancount/nnscount/narcount",$this->rawheader); + + $answers=$this->header['ancount']; + $this->Debug("Query Returned ".$answers." Answers"); + + $dns_answer=new DNSAnswer(); + + // Deal with the header question data + if ($this->header['qdcount']>0) + { + $this->Debug("Found ".$this->header['qdcount']." Questions"); + for ($a=0; $a<$this->header['qdcount']; $a++) + { + $c=1; + while ($c!=0) + { + $c=hexdec(bin2hex($this->ReadResponse(1))); + } + $extradata=$this->ReadResponse(4); + } + } + + // New Functional Method + for ($a=0; $a<$this->header['ancount']; $a++) + { + $record=$this->ReadRecord(); + $dns_answer->AddResult($record['header']['type'],$record['typeid'],$record['header']['class'],$record['header']['ttl'], + $record['data'],$record['domain'],$record['string'],$record['extras']); + } + + $this->lastnameservers=new DNSAnswer(); + for ($a=0; $a<$this->header['nscount']; $a++) + { + $record=$this->ReadRecord(); + $this->lastnameservers->AddResult($record['header']['type'],$record['typeid'],$record['header']['class'],$record['header']['ttl'], + $record['data'],$record['domain'],$record['string'],$record['extras']); + } + + $this->lastadditional=new DNSAnswer(); + for ($a=0; $a<$this->header['arcount']; $a++) + { + $record=$this->ReadRecord(); + $this->lastadditional->AddResult($record['header']['type'],$record['typeid'],$record['header']['class'],$record['header']['ttl'], + $record['data'],$record['domain'],$record['string'],$record['extras']); + } + + + + + return $dns_answer; + } + + +function SmartALookup($hostname,$depth=0) + { + $this->Debug("SmartALookup for ".$hostname." depth ".$depth); + if ($depth>5) return ""; // avoid recursive lookups + // The SmartALookup function will resolve CNAMES using the additional properties if possible + $answer=$this->Query($hostname,"A"); + + if ($answer===false) return ""; // failed totally + if ($answer->count<=0) return ""; // no records at all returned + + $best_answer=""; + $best_answer_typeid=0; + + $records=$answer->count; + for ($a=0; $a<$records; $a++) + { + $data=$answer->results[$a]->data; + $answer_typeid=$answer->results[$a]->typeid; + + if ($answer_typeid=="A") // found it + { + $best_answer=$data; + $best_answer_typeid="A"; + $a=$records+10; + } + else if ($answer_typeid=="CNAME") // alias + { + $best_answer=$data; + $best_answer_typeid="CNAME"; + // and keep going + } + + } + + if ( ($best_answer=="") || ($best_answer_typeid=="") ) return ""; + + if ($best_answer_typeid=="A") return $best_answer; // got an IP ok + + if ($best_answer_typeid!="CNAME") return ""; // shouldn't ever happen + + $newtarget=$best_answer; // this is what we now need to resolve + + // First is it in the additional section + for ($a=0; $a<$this->lastadditional->count; $a++) + { + if ( ($this->lastadditional->results[$a]->domain==$hostname) && + ($this->lastadditional->results[$a]->typeid=="A") ) + return $this->lastadditional->results[$a]->data; + } + + // Not in the results + + return $this->SmartALookup($newtarget,++$depth); + } + +} + +?> \ No newline at end of file diff --git a/src/server/base/tests/imap.inc.php b/src/server/base/tests/imap.inc.php new file mode 100755 index 0000000..888bea1 --- /dev/null +++ b/src/server/base/tests/imap.inc.php @@ -0,0 +1,152 @@ +0) $timeout=$timeout; // use specific for test if set +else + { + // otherwise use system if available + if (isset($NATS)) $timeout=$NATS->Cfg->Get("test.imap.timeout",0); + if ($timeout<=0) $timeout=0; // unset specifically or in environment + } + +if ($timeout>0) imap_timeout(IMAP_OPENTIMEOUT,$timeout); + +if ($port<=0) + { + $port=143; // default + if ( ($protocol=="imap") && ($ssl) ) $port=993; + else if ($protocol=="pop3") + { + if ($ssl) $port=995; + else $port=110; + } + } + +$mailbox="{".$host.":".$port."/service=".$protocol; +if ($ssl) $mailbox.="/ssl"; +$mailbox.="/novalidate-cert"; +$mailbox.="}INBOX"; +if ($debug) echo $user.":".$pass."@".$mailbox."\n"; +$imap=@imap_open($mailbox,$user,$pass); +if ($imap===false) return -1; // failed to connect/open + +@imap_close($imap); +return 1; +} + +function imap_test_time($host,$user,$pass,$timeout=-1,$protocol="imap",$port=-1,$ssl=false,$debug=false) +{ +$timer=new TFNTimer(); +$timer->Start(); +$res=imap_test_connect($host,$user,$pass,$timeout,$protocol,$port,$ssl,$debug); +$time=$timer->Stop(); +if ($res<=0) return $res; // test failed to connect +$time=round($time,4); +if ($time==0) $time=0.0001; +return $time; +} + +if (isset($NATS)) +{ +class FreeNATS_IMAP_Test extends FreeNATS_Local_Test + { + function DoTest($testname,$param,$hostname,$timeout,$params) + { // 0: host, 1: user, 2: pass, 3: protocol, 4: port, 5: ssl (1/0) + if ($params[5]==1) $ssl=true; + else $ssl=false; + + $ip=ip_lookup($params[0]); + if ($ip=="0") return -1; + + return imap_test_time($ip,$params[1],$params[2],$timeout,$params[3],$params[4],$ssl); + + } + function Evaluate($result) + { + if ($result<=0) return 2; // failed + return 0; // passed + } + + function ProtectOutput(&$test) + { + $test['testparam2']=""; + } + + function DisplayForm(&$row) + { + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "
"; + echo "Hostname :"; + echo ""; + echo ""; + echo "
"; + echo "Username :"; + echo ""; + echo ""; + echo "
"; + echo "Password :"; + echo ""; + //echo ""; // debug + echo ""; + echo ""; + echo "
Leave blank to not change or click to clear
"; + echo "Protocol :"; + echo ""; + if ($row['testparam3']=="") $protocol="imap"; + else $protocol=$row['testparam3']; + echo ""; + echo "
"; + echo "Port :"; + echo ""; + echo ""; + echo "
Leave blank use protocol default port (110, 143 etc)
"; + echo "SSL :"; + echo ""; + if ($row['testparam5']==1) $s=" checked"; + else $s=""; + echo ""; + echo "
"; + } + + } +$params=array(); +$NATS->Tests->Register("imap","FreeNATS_IMAP_Test",$params,"IMAP Connect",2,"FreeNATS IMAP/POP Tester"); +$NATS->Tests->SetUnits("imap","Seconds","s"); +} + + +?> \ No newline at end of file diff --git a/src/server/base/tests/ldap.inc.php b/src/server/base/tests/ldap.inc.php new file mode 100755 index 0000000..4d2605f --- /dev/null +++ b/src/server/base/tests/ldap.inc.php @@ -0,0 +1,90 @@ +"; + echo ""; + echo "LDAP URL:"; + echo ""; + echo ""; + echo ""; + + echo ""; + echo "Bind DN:"; + echo ""; + echo ""; + echo "Leave empty for anonymous bind"; + + echo ""; + echo "Bind Password:"; + echo ""; + echo ""; + echo "Leave empty for anonymous bind"; + + echo ""; + echo "Search Base:"; + echo ""; + echo ""; + echo "Leave empty for only test bind"; + + echo ""; + echo "Search Filter:"; + echo ""; + echo ""; + echo "Leave empty for only test bind"; + + echo ""; + } +} + +$params=array(); +$NATS->Tests->Register("ldap","LDAP_Test",$params,"LDAP Bind",1,"FreeNATS LDAP Test"); + +?> diff --git a/src/server/base/tests/mysql.inc.php b/src/server/base/tests/mysql.inc.php new file mode 100755 index 0000000..3456d6f --- /dev/null +++ b/src/server/base/tests/mysql.inc.php @@ -0,0 +1,313 @@ +Event("MySQL Test: ".$error,2,"Test","MySQL"); +} + + + +// Data Test +function mysql_test_data($host,$user,$pass,$database="",$timeout=0,$query="",$column=0,$debug=false) +{ +global $NATS; +if ($timeout>0) $timeout=$timeout; // use specific for test if set +else + { + // otherwise use system if available + if (isset($NATS)) $timeout=$NATS->Cfg->Get("test.mysql.timeout",0); + if ($timeout<=0) $timeout=0; // unset specifically or in environment + } +// this will return a 0 at any stage if connect etc is ok but no rows are returned +// negative if something actually fails +if ($timeout>0) + { + $oldtimeout=ini_get("mysql.timeout"); + ini_set("mysql.timeout",$timeout); + } + +if (!is_numeric($column)) $column=0; +if ($column<0) $column=0; + +$sql=@mysql_connect($host,$user,$pass,true); + +if ((!$sql)||($database=="")) + { + if ($timeout>0) ini_set("mysql.timeout",$oldtimeout); + if (!$sql) + { + if ($debug) echo "Connect Error: Failed to Connect\n"; + fnmysql_error("Failed to Connect"); + return -1; // total connect failed + } + // otherwise is no database so close and return -1 to indicate failure (for the data requires a DB+qry etc) + @mysql_close($sql); + return -1; + } + +@mysql_select_db($database,$sql); + +if (mysql_errno($sql)!=0) // failed to select DB + { + if ($timeout>0) ini_set("mysql.timeout",$oldtimeout); + fnmysql_error(mysql_error($sql)); + @mysql_close($sql); + return -2; // select database failed + } + +if ($query=="") + { // no query to perform + if ($timeout>0) ini_set("mysql.timeout",$oldtimeout); + @mysql_close($sql); + return -1; // all ok but no query/rows + } + +$r=@mysql_query($query,$sql); +if (mysql_errno($sql)==0) // successful query + { + if (is_bool($r)) // didn't return any data + { + $return=-4; // so for this purpose (data) the query failed + } + else + { + if ($row=mysql_fetch_array($r)) + { // got data ok + if (isset($row[$column])) $return=$row[$column]; + else $return=$row[0]; + } + else $return=-5; // query seemed to succeed but no data at all here + @mysql_free_result($r,$sql); // free if a result + } + } +else + { + fnmysql_error(mysql_error($sql)); + $return=-3; // query failed + } + +@mysql_close($sql); +if ($timeout>0) ini_set("mysql.timeout",$oldtimeout); +return $return; +} + + + +// Row Test +function mysql_test_rows($host,$user,$pass,$database="",$timeout=0,$query="",$debug=false) +{ +global $NATS; +if ($timeout>0) $timeout=$timeout; // use specific for test if set +else + { + // otherwise use system if available + if (isset($NATS)) $timeout=$NATS->Cfg->Get("test.mysql.timeout",0); + if ($timeout<=0) $timeout=0; // unset specifically or in environment + } +// this will return a 0 at any stage if connect etc is ok but no rows are returned +// negative if something actually fails +if ($timeout>0) + { + $oldtimeout=ini_get("mysql.timeout"); + ini_set("mysql.timeout",$timeout); + } + +if ($debug) echo "mysql://".$user.":".$pass."@".$host."/".$database."\n"; + +$sql=@mysql_connect($host,$user,$pass,true); + +if ((!$sql)||($database=="")) + { + if ($timeout>0) ini_set("mysql.timeout",$oldtimeout); + if (!$sql) + { + if ($debug) echo "Connect Error: Failed to Connect\n"; + fnmysql_error("Failed to Connect"); + return -1; // total connect failed + } + // otherwise is no database so close and return 0 + @mysql_close($sql); + return 0; + } + +@mysql_select_db($database,$sql); + +if (mysql_errno($sql)!=0) // failed to select DB + { + if ($timeout>0) ini_set("mysql.timeout",$oldtimeout); + fnmysql_error(mysql_error($sql)); + @mysql_close($sql); + return -2; // select database failed + } + +if ($query=="") + { // no query to perform + if ($timeout>0) ini_set("mysql.timeout",$oldtimeout); + @mysql_close($sql); + return 0; // all ok but no query/rows + } + +$r=@mysql_query($query,$sql); +if (mysql_errno($sql)==0) // successful query + { + if (is_bool($r)) // didn't return any daya + { + $return=mysql_affected_rows($sql); + } + else + { + $return=mysql_num_rows($r); + @mysql_free_result($r,$sql); // free if a result + } + } +else + { + fnmysql_error(mysql_error($sql)); + $return=-3; // query failed + } + +@mysql_close($sql); +if ($timeout>0) ini_set("mysql.timeout",$oldtimeout); +return $return; +} + +function mysql_test_time($host,$user,$pass,$database="",$timeout=0,$query="",$debug=false) +{ +$timer=new TFNTimer(); +$timer->Start(); +$val=mysql_test_rows($host,$user,$pass,$database,$timeout,$query,$debug); +$time=$timer->Stop(); + +if ($val<0) return $val; // connect/select/query failed + +// if $val is 0 then nothing was returned - maybe check the query here? Complicates the idea +// though for the user so left. Will have to do two tests for both time and rows 0 as fails + +$time=round($time,4); +if ($time==0) return "0.0001"; +return $time; +} + + +if (isset($NATS)) +{ +class FreeNATS_MySQL_Test extends FreeNATS_Local_Test + { + function DoTest($testname,$param,$hostname,$timeout,$params) + { // 0: host, 1: user, 2: pass, 3: database, 4: query + + if ($testname=="mysql") + { + $ip=ip_lookup($param); + if ($ip=="0") return -1; // cache only as 127.0.0.1 is not the same connection as localhost for MySQL auth! + + return mysql_test_time($param,$params[1],$params[2],$params[3],$timeout,$params[4]); + } + + else if ($testname=="mysqlrows") + { + $ip=ip_lookup($param); + if ($ip=="0") return -1; // cache only - see above + return mysql_test_rows($param,$params[1],$params[2],$params[3],$timeout,$params[4]); + } + + else if ($testname=="mysqldata") + { + $ip=ip_lookup($param); + if ($ip=="0") return -1; + return mysql_test_data($param,$params[1],$params[2],$params[3],$timeout,$params[4],$params[5]); + } + + else return -1; + + } + function Evaluate($result) + { // same for all types + if ($result<0) return 2; // failed + return 0; // passed + } + + function ProtectOutput(&$test) + { + $test['testparam2']=""; + } + + function DisplayForm(&$row) + { + $optional=true; + if ($row['testtype']=="mysqldata") $optional=false; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + if ($optional) echo ""; + echo ""; + if ($optional) echo ""; + if ($row['testtype']=="mysqldata") + { + echo ""; + echo ""; + } + echo "
"; + echo "Hostname :"; + echo ""; + echo ""; + echo "
"; + echo "Username :"; + echo ""; + echo ""; + echo "
"; + echo "Password :"; + echo ""; + echo ""; + echo ""; + echo "
Leave blank to not change or click to clear
"; + echo "Database :"; + echo ""; + echo ""; + echo "
Optional - leave blank to not bother with select_db
"; + echo "Query :"; + echo ""; + echo ""; + echo "
Optional - leave blank to not bother with a query
"; + echo "Column :"; + echo ""; + echo ""; + echo "
Which field (0 is first and the default) of the first record to use
"; + } + + } +$params=array(); +$NATS->Tests->Register("mysql","FreeNATS_MySQL_Test",$params,"MySQL Connect",2,"FreeNATS MySQL Tester"); +$NATS->Tests->SetUnits("mysql","Seconds","s"); +$NATS->Tests->Register("mysqlrows","FreeNATS_MySQL_Test",$params,"MySQL Rows",2,"FreeNATS MySQL Tester"); +$NATS->Tests->SetUnits("mysqlrows","Rows","rows"); +$NATS->Tests->Register("mysqldata","FreeNATS_MySQL_Test",$params,"MySQL Data",2,"FreeNATS MySQL Tester"); +} + + +?> \ No newline at end of file diff --git a/src/server/base/tests/nats-dns.inc.php b/src/server/base/tests/nats-dns.inc.php new file mode 100755 index 0000000..c1c88ad --- /dev/null +++ b/src/server/base/tests/nats-dns.inc.php @@ -0,0 +1,114 @@ +Start(); + $answer=$dns_query->Query($query,$type); + $elapsedTime=$timer->Stop(); + + if ( ($answer===false) || ($dns_query->error) ) return -2; // query error + if ($answer->count<=0) return -1; // no records returned + + // otherwise we've got some results ok + $elapsedTime=round($elapsedTime,4); + if ($elapsedTime<=0) return 0.0001; + return $elapsedTime; + break; + } + function Evaluate($result) + { + if ($result<0) return 2; // failed + return 0; // passed + } + function DisplayForm(&$row) + { + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "
"; + echo "Host/Domain/IP :"; + echo ""; + echo ""; + echo "
"; + echo "Nameserver :"; + echo ""; + echo ""; + echo "
Leave blank to use the node's hostname
"; + echo "Query Type :"; + echo ""; + echo ""; + echo "
"; + echo "Port :"; + echo ""; + echo ""; + echo "
Leave blank to use protocol default port (53)
"; + echo "TCP :"; + echo ""; + if ($row['testparam4']==1) $s=" checked"; + else $s=""; + echo ""; + echo "
Uses UDP if unchecked
"; + } + + + } + +$params=array(); +$NATS->Tests->Register("dns","FreeNATS_DNSAPI_Test",$params,"DNS Query",2,"FreeNATS DNS Tester"); +$NATS->Tests->SetUnits("dns","Seconds","s"); +} + +?> diff --git a/src/server/base/tests/ppping.inc.php b/src/server/base/tests/ppping.inc.php new file mode 100755 index 0000000..04476ae --- /dev/null +++ b/src/server/base/tests/ppping.inc.php @@ -0,0 +1,415 @@ +last = array( + "set" => false, + "result" => 0, + "ttl" => 0, + "hops" => 0, + "source" => "", + "destination" => "" ); + } +/** + * Get a padded hex identifier +**/ +function getIdentity() + { + if ( (is_numeric($this->identity)) && ($this->identity>=0) && ($this->identity<65535) ) + $id=$this->identity; + else $id=0; + + $id=dechex($id); + $id=str_pad($id,4,"0",STR_PAD_LEFT); + $id=pack("H*",$id); + + return $id; + } + +/** + * Get a padded hex sequence +**/ +function getSequence() + { + if ( (is_numeric($this->sequence)) && ($this->sequence>=0) && ($this->sequence<65535) ) + $seq=$this->sequence; + else $seq=0; + $seq=dechex($seq); + $seq=str_pad($seq,4,"0",STR_PAD_LEFT); + $seq=pack("H*",$seq); + + return $seq; + } + +/** + * Returns a hex string of the binary data for debug purposes +**/ +function getHex($data) + { + $parts=unpack("H*",$data); + return $parts[1]; + } + +/** + * Randomise identity and/or sequence within 16 bit parameters +**/ +function Randomise($identity=true,$sequence=false) + { + mt_srand(microtime()*1000000); + if ($identity) $this->identity=mt_rand(0,65534); + if ($sequence) $this->sequence=mt_rand(0,65534); + } + +/** + * Start timer (reset values) +**/ +function startTimer() + { + $now=microtime(); + $timearray=explode(" ",$now); + $this->timer_start_sec=$timearray[1]; + $this->timer_start_msec=$timearray[0]; + } + +/** + * Stop timer (return result) +**/ +function stopTimer() + { + $now=microtime(); + $timearray=explode(" ",$now); + + $finish_secs=$timearray[1]; + $finish_msecs=$timearray[0]; + + $elapsed_seconds = $finish_secs - $this->timer_start_sec; + $elapsed_time = $elapsed_seconds + $finish_msecs - $this->timer_start_msec; + + $elapsed_ms = $elapsed_time * 1000; + + $elapsed_ms = round($elapsed_ms,3); + + return $elapsed_ms; + } + + +/** + * Constructor - randomises ID +**/ +function PPPing() + { + $this->Randomise(); + } + +/** + * Returns a dotted quad from hex format IPv4 address +**/ +function ipAddress($hexip) + { + $quad=""; + for($a=0; $a<=6; $a+=2) + { + $portion=substr($hexip,$a,2); + $decimal=hexdec($portion); + if ($quad!="") $quad.="."; + $quad.=$decimal; + } + return $quad; + } + +/** + * Generate an ICMP checksum +**/ +function Checksum($data) + { + if (strlen($data)%2) + $data .= "\x00"; + + $bit = unpack('n*', $data); + $sum = array_sum($bit); + + while ($sum >> 16) + $sum = ($sum >> 16) + ($sum & 0xffff); + + return pack('n*', ~$sum); + } + +/** + * Do a ping of the set hostname + * + * @return float + * Returns a negative number of failure which can be turned into text with + * the strError method. A positive number is a response in milliseconds (ms) +**/ +function Ping() + { + $this->clearLast(); + $type = "\x08"; // icmp echo + $code = "\x00"; + $checksum = "\x00\x00"; // initial + $identifier = $this->getIdentity(); + $dec_identity = $this->identity; + //$identifier = "\x00\x00"; + //$seqNumber = "\x00\x00"; + $seqNumber = $this->getSequence(); + $dec_sequence = $this->sequence; + $data = $this->data_package; + $package = $type.$code.$checksum.$identifier.$seqNumber.$data; + $checksum = $this->Checksum($package); // proper checksum + $package = $type.$code.$checksum.$identifier.$seqNumber.$data; + + $ip_protocol_code = getprotobyname("ip"); + $ip_ttl_code = 7; + + // Lookup hostname + $ips=str_replace(".","",$this->hostname); + if (!is_numeric($ips)) + { + $host=gethostbyname($this->hostname); + if ($host==$this->hostname) return -5; + } + else $host=$this->hostname; + + // Create Socket + $socket = socket_create(AF_INET, SOCK_RAW, 1); // @ + //or die(socket_strerror(socket_last_error())); + if (!$socket) return -3; + + // Set Non-Blocking + socket_set_nonblock($socket); // @ + + $socket_ttl = socket_get_option($socket,$ip_protocol_code,$ip_ttl_code); + + //for ($a=0; $a<64; $a++) + // echo $a." - ".@socket_get_option($socket,$ip_protocol_code,$a)."\n"; + + if ($this->ttl>0) + { + socket_set_option($socket,$ip_protocol_code,$ip_ttl_code,128); + $socket_ttl = socket_get_option($socket,$ip_protocol_code,$ip_ttl_code); + //socket_set_option($socket,Socket::IPPROTO_IP,Socket::IP_TTL,128); + //$socket_ttl = socket_get_option($socket,Socket::IPPROTO_IP,Socket::IP_TTL); + + } + else $socket_ttl = 64; // standard TTL + + + // Connect Socket + $sconn=socket_connect($socket, $host, null); // @ + if (!$sconn) return 0; + + // Package Size + //$package_size = 8+strlen($data); + $package_size = strlen($package); + + // Send Data + socket_send($socket, $package, $package_size, 0); // @ + + // Start Timer + $this->startTimer(); + $startTime = microtime(true); // need this for the looping section + + + // Read Data + $keepon=true; + + while( (false===($echo_reply=socket_read($socket, 255))) && $keepon) // @socket_read + { + + if ( (microtime(true) - $startTime) > $this->timeout ) + $keepon=false; + + } + + + if ($keepon) // didn't time out - read data + { + $elapsed=$this->stopTimer(); + + socket_close($socket); // @ + + if ( $echo_reply === false ) return -4; + else if (strlen($echo_reply)<2) return -2; + + $rx_parts = unpack("C*",$echo_reply); + $tx_parts = unpack("C*",$package); + $ipheader=""; + $ipheader_hex=""; + + if ($rx_parts[1] == 0x45) // IP Header Information + { + $ipheader=substr($echo_reply,0,20); + $ipheader_hex = $this->getHex($ipheader); + $echo_reply=substr($echo_reply,20); + $rx_parts = unpack("C*",$echo_reply); + } + + if ($this->debug) + { + echo "\n"; + echo " TyCoChksIdenSequData\n"; + echo "TX: ".$this->getHex($package)."\n"; + echo "RX: ".$this->getHex($echo_reply)."\n"; + if ($ipheader!="") echo "HR: ".$ipheader_hex."\n"; + } + + $echo_reply_hex = $this->getHex($echo_reply); + $reply_type = $rx_parts[1]; + $reply_code = $rx_parts[2]; + $reply_identity = hexdec(substr($echo_reply_hex,8,4)); + $reply_sequence = hexdec(substr($echo_reply_hex,12,4)); + + $match=true; + if ($ipheader!="") + { + $source=substr($ipheader_hex,24,8); + $dest=substr($ipheader_hex,32,8); + $ttl=hexdec(substr($ipheader_hex,16,2)); + if ($this->debug) echo $this->ipAddress($source)." => ".$this->ipAddress($dest)." | ttl: ".$ttl."\n"; + if ($source==$dest) $match=true; + else $match=false; + + $this->last["set"]=true; + $this->last["source"]=$this->ipAddress($source); + $this->last["destination"]=$this->ipAddress($dest); + $this->last["ttl"]=$ttl; + $this->last["hops"]=$socket_ttl - $ttl; + + + } + + if ( (($rx_parts[1]==0) || (($rx_parts[1]==8)&&($match))) && ($rx_parts[2]==0) ) + { // is echo_reply (0) or is echo_request (8) AND match (from same host) + // and has code of 0 + // valid response + if ($reply_identity != $dec_identity) return -8; // ID mismatch + else if ($reply_sequence != $dec_sequence) return -7; // sequence mismatch + else + { + $this->last["result"]=$elapsed; + return $elapsed; + } + } + else + { // ICMP Error + return -9; + } + + } + socket_close($socket); // @ + return -1; // timeout + } + +/** + * Returns textual error for code +**/ +function strError($code) + { + switch($code) + { + case -1: return "Timed Out"; break; + case -2: return "Reply Too Short"; break; + case -3: return "Failed to Open Socket"; break; + case -4: return "Invalid (false) Response"; break; + case -5: return "Hostname Lookup Failed"; break; + case -7: return "Sequence Mismatch"; break; + case -8: return "Identity Mismatch"; break; + case -9: return "ICMP Generic Error"; break; + + default: return "Unknown Error"; break; + } + } + + +} + +?> \ No newline at end of file diff --git a/src/server/base/tests/smb.inc.php b/src/server/base/tests/smb.inc.php new file mode 100755 index 0000000..6967859 --- /dev/null +++ b/src/server/base/tests/smb.inc.php @@ -0,0 +1,124 @@ +Start(); +//echo $cmd; +$output=array(); +$line=exec($cmd); +//echo $line; +$time=$timer->Stop(); +// Domain= +if ( (strlen($line)>7) ) + { + $dom=substr($line,0,7); + if ($dom=="Domain=") + { + $result=true; + } + else $result=false; + } +else if ($line=="") + { + $result=true; // blank weird output + } +else + { + $result=false; + if (isset($NATS)) + { + $NATS->Event("SMB Failed: ".$line,2,"Test","SMB"); + } + } + + +if (!$result) return -1; // connect failed +$time=round($time,4); +if ($time==0) $time=0.0001; +return $time; +} + +if (isset($NATS)) +{ +class FreeNATS_SMB_Test extends FreeNATS_Local_Test + { + function DoTest($testname,$param,$hostname,$timeout,$params) + { + return smb_connect_time($params[0],$params[1],$params[2]); + } + function Evaluate($result) + { + if ($result<0) return 2; // failed + return 0; // passed + } + function DisplayForm(&$row) + { + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "
"; + echo "Share :"; + echo ""; + echo ""; + echo "
Use full share with forward slashes i.e. //server/sharename
"; + echo "Username :"; + echo ""; + echo ""; + echo "
Leave username blank to attempt anonymous authentication
"; + echo "Password :"; + echo ""; + echo ""; + echo ""; + echo "
Leave blank to not change or click to clear
"; + } + + function ProtectOutput(&$test) + { + $test['testparam2']=""; + } + + } +$params=array(); +$NATS->Tests->Register("smb","FreeNATS_SMB_Test",$params,"SMB Connect",1,"FreeNATS SMB Tester"); +$NATS->Tests->SetUnits("smb","Seconds","s"); +} + + +?> \ No newline at end of file diff --git a/src/server/base/tests/smtp.inc.php b/src/server/base/tests/smtp.inc.php new file mode 100755 index 0000000..cb667cf --- /dev/null +++ b/src/server/base/tests/smtp.inc.php @@ -0,0 +1,95 @@ +0) $timeout=$timeout; // use specific for test if set +else + { + // otherwise use system if available + if (isset($NATS)) $timeout=$NATS->Cfg->Get("test.smtp.timeout",0); + if ($timeout<=0) $timeout=20; // unset specifically or in environment + } + +if ($port=="") $port=25; +$errno=0; +$errstr=0; +$fp=@fsockopen($hostname,$port,$errno,$errstr,$timeout); +if ($errno!=0) return -1; // socket error on open +if ($fp<=0) return -2; // socket failed to open but no errno +stream_set_timeout($fp,$timeout); +$header=@fgets($fp,128); +if ($debug) echo $header."\n"; +if (substr($header,0,3)!="220") return -3; // incorrect SMTP response +if (@fputs($fp,"HELO freenats\n")===false) return -4; // unable to write HELO +$body=@fgets($fp,128); +if ($debug) echo $body."\n"; +if ($body=="") return -5; // nothing back from the server +if (@fputs($fp,"QUIT\n")===false) return -6; // cannot write QUIT +@fclose($fp); +return 1; +} + +function smtp_test_time($hostname,$port=25,$timeout=-1,$debug=false) +{ +$timer=new TFNTimer(); +$timer->Start(); +$res=smtp_test_connect($hostname,$port,$timeout,$debug); +$time=$timer->Stop(); +if ($res<=0) return $res; // connect failed +$time=round($time,4); +if ($time==0) $time=0.0001; +return $time; +} + +if (isset($NATS)) +{ +class FreeNATS_SMTP_Test extends FreeNATS_Local_Test + { + function DoTest($testname,$param,$hostname,$timeout,$params) + { + // Pre-resolve DNS + $ip=ip_lookup($params[0]); + if ($ip=="0") return -1; + // Do the test + return smtp_test_time($ip,$params[1],$timeout); + } + function Evaluate($result) + { + if ($result<=0) return 2; // failed + return 0; // passed + } + /* // -- this was put in as a test, code left to easily retest with if required - denies host to API + function ProtectOutput(&$test) + { + $test['testparam']=""; + } + */ + } +$params=array( "Hostname", "Port/Defaults to 25 if 0 or unset" ); +$NATS->Tests->Register("smtp","FreeNATS_SMTP_Test",$params,"SMTP Connect",2,"FreeNATS SMTP Tester"); +$NATS->Tests->SetUnits("smtp","Seconds","s"); +} + + +?> \ No newline at end of file diff --git a/src/server/base/tests/tcp.inc.php b/src/server/base/tests/tcp.inc.php new file mode 100755 index 0000000..43fc442 --- /dev/null +++ b/src/server/base/tests/tcp.inc.php @@ -0,0 +1,72 @@ +Cfg->Get("test.tcp.timeout",0); // if no test-specific param use sys default + if ($timeout<=0) $timeout=60; // if sys default is <=0 then default to 60 seconds + $ip=ip_lookup($hostname); + if ($ip=="0") return -2; // lookup failed + $errno=0; + $errstr=""; + $timer->Start(); + $fp=@fsockopen($ip,$param,$errno,$errstr,$timeout); + $elapsed=$timer->Stop(); + if ($fp===false) return -1; // open failed + @fclose($fp); + return $elapsed; + } + + function Evaluate($result) + { + if ($result<0) return 2; // failure + return 0; // else success + } + + function DisplayForm(&$row) + { + echo ""; + echo ""; + echo "
"; + echo "TCP Port :"; + echo ""; + echo ""; + echo "
"; + } + + } + +$params=array(); +$NATS->Tests->Register("tcp","FreeNATS_TCP_Test",$params,"TCP Connect",1,"FreeNATS TCP Tester"); +$NATS->Tests->SetUnits("tcp","Seconds","s"); +} + + +?> \ No newline at end of file diff --git a/src/server/base/tests/udp.inc.php b/src/server/base/tests/udp.inc.php new file mode 100755 index 0000000..d091f46 --- /dev/null +++ b/src/server/base/tests/udp.inc.php @@ -0,0 +1,122 @@ +Cfg->Get("test.udp.timeout",0); // if no test-specific param use sys default + if ($timeout<=0) $timeout=20; // if sys default is <=0 then default to 60 seconds + + if ($params[1]!="") $package = $params[1]; + else $package="\x00"; + + if ($params[2]==1) $reqresponse=true; + else $reqresponse=false; + + $timer=new TFNTimer(); + + $ip=ip_lookup($hostname); + if ($ip=="0") return -2; // lookup failed + + $connstr="udp://".$ip; + $errno=0; + $errstr=""; + + $timer->Start(); + + $fp=@fsockopen($connstr,$param,$errno,$errstr,$timeout); + if ($fp===false) return -1; // open failed + + stream_set_timeout($fp, $timeout); + + $write = fwrite($fp, $package); // send some data + if (!$write) return -3; // failed to send data + + $read = fgets($fp); + + @fclose($fp); + + $elapsed = $timer->Stop(); + + if (!$read) + { + if ($reqresponse) return -4; // no response and one was required + else if (round($elapsed,0) < $timeout) + { + return -5; // looks like a hard reject e.g. ICMP port unreachable + } + } + + if ($elapsed==0) $elapsed="0.001"; + return $elapsed; + } + + function Evaluate($result) + { + if ($result<=0) return 2; // failure + return 0; // else success + } + + function DisplayForm(&$row) + { + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "
"; + echo "UDP Port :"; + echo ""; + echo ""; + echo "
"; + echo "Send Data :"; + echo ""; + echo ""; + echo "
 (optional, blank for default)
"; + echo "Require Response :"; + echo ""; + if ($row['testparam2']==1) $s=" checked"; + else $s=""; + echo ""; + echo "
 Requires data response from the server (usually leave unchecked)
"; + } + + } + +$params=array(); +$NATS->Tests->Register("udp","FreeNATS_UDP_Test",$params,"UDP Connect",2,"FreeNATS UDP Tester"); +$NATS->Tests->SetUnits("udp","Seconds","s"); +} + + +?> \ No newline at end of file diff --git a/src/server/base/testtext.inc.php b/src/server/base/testtext.inc.php new file mode 100755 index 0000000..522b8d6 --- /dev/null +++ b/src/server/base/testtext.inc.php @@ -0,0 +1,101 @@ +Lang->Item("web.size"); + //case "tcp": return "TCP Port Test"; + case "testloop": return $NATS->Lang->Item("test.loop"); + case "wtime": return $NATS->Lang->Item("web.time"); + case "ICMP": return $NATS->Lang->Item("node.ping"); + case "ping": return $NATS->Lang->Item("remote.ping"); + case "testrand": return $NATS->Lang->Item("test.random"); + //case "mysql": return "MySQL"; + //case "mysqlrows": return "MySQL Rows"; + //case "imap": return "IMAP"; + //case "smtp": return "SMTP"; + case "host": return $NATS->Lang->Item("dns.host"); + //case "dns": return "DNS Query"; + default: + if (isset($NATS)) + { + if (isset($NATS->Tests->QuickList[$test])) return $NATS->Tests->QuickList[$test]; + } + return $test; + } +} + +function lUnit($test) +{ +global $NATS; +switch ($test) + { + case "web": case "wsize": return "KiloBytes"; + //case "tcp": return "Pass/Fail"; + case "testloop": return ""; + case "wtime": return "Seconds"; + case "ICMP": case "ping": + if ($NATS->Cfg->Get("test.icmp.returnms",0)==1) return "Milliseconds"; + else return "Seconds"; + + case "testrand": return ""; + //case "imap": return "Seconds"; + //case "smtp": return "Seconds"; + //case "mysql": return "Seconds"; + //case "mysqlrows": return "Rows"; + case "host": return "Seconds"; + //case "dns": return "Seconds"; + default: + if (isset($NATS)) + return $NATS->Tests->Units($test); + return ""; + } +} + +function oText($val) +{ +global $NATS; +if (isset($NATS)) $n=true; +else $n=false; +switch ($val) + { + case -1: + if ($n) return $NATS->Cfg->Get("site.text.untested",$NATS->Lang->Item("untested")); + return $NATS->Lang->Item("untested"); + case 0: + if ($n) return $NATS->Cfg->Get("site.text.passed",$NATS->Lang->Item("passed")); + return $NATS->Lang->Item("passed"); + case 1: + if ($n) return $NATS->Cfg->Get("site.text.warning",$NATS->Lang->Item("warning")); + return $NATS->Lang->Item("warning"); + case 2: + if ($n) return $NATS->Cfg->Get("site.text.failed",$NATS->Lang->Item("failed")); + return $NATS->Lang->Item("failed"); + default: + if ($n) return $NATS->Cfg->Get("site.text.unknown",$NATS->Lang->Item("unknown")); + return $NATS->Lang->Item("unknown"); + } +} +?> \ No newline at end of file diff --git a/src/server/base/timer.inc.php b/src/server/base/timer.inc.php new file mode 100755 index 0000000..979c80c --- /dev/null +++ b/src/server/base/timer.inc.php @@ -0,0 +1,59 @@ +StartSecs=$timeArray[1]; + $this->StartMSecs=$timeArray[0]; + } + +function Stop() + { + $timeString=microtime(); + $timeArray=explode(" ",$timeString); + $this->FinishSecs=$timeArray[1]; + $this->FinishMSecs=$timeArray[0]; + + $elapSecs=$this->FinishSecs-$this->StartSecs; + //$newFinish=$elapSecs.substr($this->FinishMSecs,1,128); + $newFinish=$elapSecs+$this->FinishMSecs; + + $this->Elapsed=$newFinish-$this->StartMSecs; + $this->SafeElapsed=round($this->Elapsed,3); + if ($this->SafeElapsed<=0) $this->SafeElapsed="0.0001"; + + return $this->SafeElapsed; + } +} + +?> \ No newline at end of file diff --git a/src/server/base/view.inc.php b/src/server/base/view.inc.php new file mode 100755 index 0000000..a82a67d --- /dev/null +++ b/src/server/base/view.inc.php @@ -0,0 +1,111 @@ +DB->Query($q); +if ($row=$NATS->DB->Fetch_Array($r)) + { + if ($row['testname']!="") $ret=$row['testname']; + else + { + $ret=lText($row['testtype']); + //if ($row['testparam']!="") $ret.=" (".substr($row['testparam'],0,20).")"; + if ($row['testparam']!="") $ret.=" (".$row['testparam'].")"; + } + $ret.=" on ".$row['nodeid']; + } +else $ret="Unknown2 on Unknown".$ltid; +return $ret; +} + +function GetTestDesc($tid) +{ +global $NATS; +$class=$tid[0]; +if (is_numeric($class)) $class="L"; +else $tid=substr($tid,1); + +if ($class=="L") return LocalTestDesc($tid); +else if ($class=="N") + { + $q="SELECT nodeid,testtype,testname,testdesc FROM fnnstest WHERE nstestid=".ss($tid)." LIMIT 0,1"; + $r=$NATS->DB->Query($q); + if (!$row=$NATS->DB->Fetch_Array($r)) return "Unknown on Unknown"; + $t=""; + if ($row['testname']!="") $t=$row['testname']; + else if ($row['testdesc']!="") $t=$row['testdesc']; + else $t=$row['testtype']; + $t.=" on ".$row['nodeid']; + return $t; + } + +return "Unknown on Unknown"; +} + +function ViewItemTxt($type,$option) +{ +global $NATS; // must be set if you're using a view! +switch ($type) + { + case "node": return "Node - ".$option; + case "allnodes": return "All Active Nodes"; + case "alertnodes": return "All Alerting Nodes"; + + case "group": + $q="SELECT groupname FROM fngroup WHERE groupid=".ss($option)." LIMIT 0,1"; + $r=$NATS->DB->Query($q); + if ($row=$NATS->DB->Fetch_Array($r)) $ret="Group - ".$row['groupname']; + else $ret="Group (".$option.")"; + $NATS->DB->Free($r); + return $ret; + + case "allgroups": return "All Groups"; + case "alertgroups": return "All Alerting Groups"; + case "alerts": return "Current Alerts"; + case "title": return "Title (".$option.")"; + case "testdetail": + //$tt=substr($option,0,1); + //$tid=substr($option,1,128); + return "Test Detail for ".GetTestDesc($option); + //return "Detail for Test (".$option.")"; + case "testgraph": + + $tid=$option; + + $sl=strpos($tid,"/"); + if ($sl===false) return "Test Graph for ".GetTestDesc($tid)." (default)"; // will break on non-local sets, refine logic here + // otherwise as a return + $hrs=substr($tid,$sl+1,32); + $tid=substr($tid,0,$sl); + if ($hrs=="") $hrs="default"; + return "Test Graph for ".GetTestDesc($tid)." (".$hrs." hours)"; + //return "History Graph for Test (".$option.")"; + default: return "Unknown Item Type (".$type."/".$option.")"; + } +} + + + +?> \ No newline at end of file diff --git a/src/server/bin/.htaccess b/src/server/bin/.htaccess new file mode 100755 index 0000000..ff2beb8 --- /dev/null +++ b/src/server/bin/.htaccess @@ -0,0 +1,2 @@ +order deny,allow +deny from all diff --git a/src/server/bin/cleanup.php b/src/server/bin/cleanup.php new file mode 100755 index 0000000..c7b648b --- /dev/null +++ b/src/server/bin/cleanup.php @@ -0,0 +1,70 @@ +#!/usr/bin/php -q +Start(); + +$day=60*60*24; +$nowx=time(); + +$ret_alert=$NATS->Cfg->Get("retain.alert",356); +if ($ret_alert==0) $ret_alert=356; +$ret_testrun=$NATS->Cfg->Get("retain.testrun",30); +if ($ret_testrun==0) $ret_testrun=30; +$ret_records=$NATS->Cfg->Get("retain.record",356); +if ($ret_records==0) $ret_records=356; +$ret_syslog=$NATS->Cfg->Get("retain.syslog",30); +if ($ret_syslog==0) $ret_syslog=30; + +if ($ret_alert>0) + { + $q="SELECT alertid FROM fnalert WHERE closedx<".($nowx-($day*$ret_alert))." AND closedx>0"; + $r=$NATS->DB->Query($q); + $del_alert=0; + $del_aa=0; + while ($row=$NATS->DB->Fetch_Array($r)) + { + $alid=$row['alertid']; + $q="DELETE FROM fnalertlog WHERE alertid=".$row['alertid']; + $NATS->DB->Query($q); + $del_aa+=$NATS->DB->Affected_Rows(); + $q="DELETE FROM fnalert WHERE alertid=".$row['alertid']; + $NATS->DB->Query($q); + $del_alert++; + } + echo "Deleted ".$del_alert." Alerts\n"; + echo "Deleted ".$del_aa." Alert Log Entries\n"; + } + +if ($ret_testrun>0) + { + $q="DELETE FROM fntestrun WHERE startx<".($nowx-($day*$ret_testrun)); + $NATS->DB->Query($q); + $del_testrun=$NATS->DB->Affected_Rows(); + echo "Deleted ".$del_testrun." Test Runs\n"; + } + +if ($ret_records>0) + { + $q="DELETE FROM fnrecord WHERE recordx<".($nowx-($day*$ret_records)); + $NATS->DB->Query($q); + $del_records=$NATS->DB->Affected_Rows(); + echo "Deleted ".$del_records." Result Records\n"; + } + +if ($ret_syslog>0) + { + $q="DELETE FROM fnlog WHERE postedx<".($nowx-($day*$ret_syslog)); + $NATS->DB->Query($q); + $del_syslog=$NATS->DB->Affected_Rows(); + echo "Deleted ".$del_syslog." System Log Entries\n"; + } + +$q="DELETE FROM fnsession WHERE updatex<".($nowx-$day); // live unaffected +$NATS->DB->Query($q); +$del_sessions=$NATS->DB->Affected_Rows(); +echo "Deleted ".$del_sessions." Stale Sessions\n"; + +$NATS->Stop(); + +?> + diff --git a/src/server/bin/cleanup.sh b/src/server/bin/cleanup.sh new file mode 100755 index 0000000..6ab5104 --- /dev/null +++ b/src/server/bin/cleanup.sh @@ -0,0 +1,3 @@ +#!/bin/sh +php -f cleanup.php + diff --git a/src/server/bin/clearalert.sh b/src/server/bin/clearalert.sh new file mode 100755 index 0000000..5cde851 --- /dev/null +++ b/src/server/bin/clearalert.sh @@ -0,0 +1,17 @@ +#!/usr/bin/php -q +Start(); + +$q="UPDATE fnalert SET closedx=".time()." WHERE closedx=0"; +$NATS->DB->Query($q); +echo "Closed ".$NATS->DB->Affected_Rows()." Alerts\n"; + +$q="UPDATE fnnode SET alertlevel=0 WHERE alertlevel>1"; +$NATS->DB->Query($q); +echo "Closed ".$NATS->DB->Affected_Rows()." Node Alerts\n"; + +$NATS->Stop(); + +?> + diff --git a/src/server/bin/clearbigrecords.sh b/src/server/bin/clearbigrecords.sh new file mode 100755 index 0000000..2fd1cb6 --- /dev/null +++ b/src/server/bin/clearbigrecords.sh @@ -0,0 +1,25 @@ +#!/usr/bin/php -q +Start(); + +$q="SELECT testid,AVG(testvalue) FROM fnrecord GROUP BY testid"; +$r=$NATS->DB->Query($q); + +echo $q."\n"; + +while ($row=$NATS->DB->Fetch_Array($r)) +{ +$limit=100*$row['AVG(testvalue)']; +if ($limit>1) + { + $q="DELETE FROM fnrecord WHERE testid=\"".$row['testid']."\" AND testvalue>".$limit; + $NATS->DB->Query($q); + echo $row['testid']." - deleted ".$NATS->DB->Affected_Rows()."\n"; + } +} + +$NATS->Stop(); + +?> + diff --git a/src/server/bin/discover.php b/src/server/bin/discover.php new file mode 100755 index 0000000..e89db78 --- /dev/null +++ b/src/server/bin/discover.php @@ -0,0 +1,324 @@ +\n"; +$output.=" ".$nodeid."\n"; +$output.=" ".$hostname."\n"; +$output.=" ".$description."\n"; +$output.="\n\n"; +} + +function AddLocaltest($nodeid,$testtype,$param) +{ +global $output,$recorded; +$output.="\n"; +$output.=" ".$nodeid."\n"; +$output.=" ".$testtype."\n"; +$output.=" ".$param."\n"; +$output.="\n\n"; +} + + function DiscovericmpChecksum($data) + { + if (strlen($data)%2) + $data .= "\x00"; + + $bit = unpack('n*', $data); + $sum = array_sum($bit); + + while ($sum >> 16) + $sum = ($sum >> 16) + ($sum & 0xffff); + + return pack('n*', ~$sum); + } + +function DiscoverPing($host) + { + // Make Package + $type= "\x08"; + $code= "\x00"; + $checksum= "\x00\x00"; + $identifier = "\x00\x00"; + $seqNumber = "\x00\x00"; + $data= "FreeNATS"; + $package = $type.$code.$checksum.$identifier.$seqNumber.$data; + $checksum = DiscovericmpChecksum($package); // Calculate the checksum + $package = $type.$code.$checksum.$identifier.$seqNumber.$data; + + // Return s or ms(s*1000) + $returnsecs=true; + + + // Timeout Values + $timeout=10; + + // Create Socket + $socket = @socket_create(AF_INET, SOCK_RAW, 1); + //or die(socket_strerror(socket_last_error())); + if (!$socket) return -1; + + // Set Non-Blocking + @socket_set_nonblock($socket); + + // Connect Socket + $sconn=@socket_connect($socket, $host, null); + if (!$sconn) return -1; + + // Send Data + @socket_send($socket, $package, strLen($package), 0); + + $startTime=microtime(true); + + + // Read Data + $keepon=true; + + while( (!(@socket_read($socket, 255))) && $keepon) + { // basically just kill time + // consider putting some sort of sleepy thing here to lower load but would f* with figures! + + if ( (microtime(true) - $startTime) > $timeout ) + $keepon=false; + } + + if ($keepon) // didn't time out - read data + { + + @socket_close($socket); + + return 1; + + } + + // Socket timed out + @socket_close($socket); + return 0; + } + + +function ddt($txt) // discovery debug text +{ +global $debug; +if ($debug) echo $txt."\n"; +} + +if ($argc<2) + { + echo "FreeNATS Discovery Tool\n"; + echo "Usage: php discover.php [ ...] [options]\n\n"; + echo "Goes through IPs or ranges and discovers nodes, outputting an XML file for\n"; + echo "import to FreeNATS with the bulk importer.\n\n"; + echo "IPs or Ranges are Specified as:"; + echo " 10.0.10.1 - single IP address\n"; + echo " 10.0.10.1-10.0.10.254 - range of IP addresses\n"; + echo " 10.0.10.0/24 - network with numeric netmask\n"; + echo " 10.0.10.0/255.255.255.0 - network with IPv4 netmask\n\n"; + echo "Options are:"; + echo " --file - output XML file (defaults to discover.xml)\n"; + echo " --webprobe - do a web probe and add the test if found\n"; + echo " --recorded - set the record data flag for any discovered tests by default\n\n"; + echo "See www.purplepixie.org/freenats for more information.\n\n"; + exit(); + } + +for ($ac=1; $ac<$argc; $ac++) + { + $arg=$argv[$ac]; + if ($arg=="--live") $live=true; + else if ($arg=="--debug") $debug=true; + else if ($arg=="--file") $outfile=$argv[++$ac]; + else if ($arg=="--webprobe") $webprobe=true; + else if ($arg=="--recorded") $recorded=1; + else + { + $ranges[$rangecount]=$arg; + $actranges[$rangecount]['start']=0; + $actranges[$rangecount]['finish']=0; + + if (strpos($arg,"-")!==false) // range + { + $pos=strpos($arg,"-"); + $from=substr($arg,0,$pos); + $to=substr($arg,$pos+1); + $actranges[$rangecount]['start']=ip2long($from); + $actranges[$rangecount]['finish']=ip2long($to); + } + else if (strpos($arg,"/")!==false) // mask delimited + { + $pos=strpos($arg,"/"); + $ip=substr($arg,0,$pos); + $mask=substr($arg,$pos+1); + if (is_numeric($mask)) // numeric mask + { + ddt("Numeric Netmask ".$mask); + $netmask=0; + for ($a=0; $a<$mask; $a++) + { + $val=pow(2,(32-$a-1)); + ddt("Numeric Netmask: Pos ".$a." Adding ".$val); + $netmask+=$val; + } + ddt("Numeric Netmask ".long2ip($netmask)." ".$netmask); + $netmask=ip2long(long2ip($netmask)); // weirdness avoidance!! + // + } + else $netmask=ip2long($mask); + ddt("Netmask ".$netmask); + $ipaddr=ip2long($ip); + ddt("IP ".$ipaddr." (".$ip.")"); + $network=($ipaddr & $netmask); + $firsthost=$network+1; + + $broadcast=($network | (~$netmask)); + $lasthost=$broadcast-1; + + $actranges[$rangecount]['start']=$firsthost; + + $actranges[$rangecount]['finish']=$lasthost; + + } + else + { // single host + $actranges[$rangecount]['start']=ip2long($arg); + $actranges[$rangecount]['finish']=ip2long($arg); + } + + $rangecount++; + } + } + + +$output.="\n"; +$output.="\n\n"; + +$output.="\n"; +$output.=" 1\n"; +$output.=" 0\n"; +$output.="\n\n"; + +$output.="\n"; +$output.=" 1\n"; +$output.=" ".$recorded."\n"; +$output.="\n\n"; + + + +echo "FreeNATS Discover Started\n"; +echo " Live: "; +if ($live) echo "Yes"; +else echo "No"; +echo " Debug: "; +if ($debug) echo "Yes"; +else echo "No"; +echo "\n File: ".$outfile; +echo "\n\n"; +echo "Ranges: ".$rangecount."\n"; +if ($rangecount<=0) + { + echo "\nNo ranges or IP addresses specified\n"; + } + +for($a=0; $a<$rangecount; $a++) + { + echo " ".$ranges[$a]." ".$actranges[$a]['start']."-".$actranges[$a]['finish']." ".long2ip($actranges[$a]['start'])."-".long2ip($actranges[$a]['finish'])."\n"; + } +echo "\n"; + +for($a=0; $a<$rangecount; $a++) + { + $start=$actranges[$a]['start']; + $finish=$actranges[$a]['finish']; + echo "+ ".long2ip($start)." - ".long2ip($finish)."\n"; + for ($ip=$start; $ip<=$finish; $ip++) + { + ddt("- ".long2ip($ip)." (".$ip.")"); + $res=DiscoverPing(long2ip($ip)); + if ($res<0) + { + echo "Fatal Error: Could Not Open ICMP Connection (Ping Send Failed)\n\n"; + exit(); + } + else if ($res==0) + { + ddt("- No Reply for Ping"); + } + else + { + echo "- Ping Returned - Host Active\n"; + $hostname=gethostbyaddr(long2ip($ip)); + echo "- Name: ".$hostname."\n"; + $ipaddr=long2ip($ip); + if ($hostname==$ipaddr) + { + $nodeid=$ipaddr; + } + else + { + $exp=explode(".",$hostname); + $nodeid=$exp[0]; + } + echo "- NodeID: ".$nodeid."\n"; + AddNode($nodeid,$ipaddr,$hostname); + if ($webprobe) + { + $url="http://".$ipaddr."/"; + echo "- Web Probe: ".$url."... "; + $fp=@fopen($url,"r"); + if ($fp<=0) echo "Failed\n"; + else + { + echo "Succeeded\n"; + fclose($fp); + AddLocaltest($nodeid,"webtime",$url); + echo "- Adding Web Test ".$url."\n"; + } + } + } + echo "\n"; + } + echo "\n"; + } + +$output.="\n"; + +echo "\nFinish... Writing File... "; +$fp=fopen($outfile,"w"); +fputs($fp,$output,strlen($output)); +fclose($fp); +echo "\n"; + +?> \ No newline at end of file diff --git a/src/server/bin/import.php b/src/server/bin/import.php new file mode 100755 index 0000000..a8e5884 --- /dev/null +++ b/src/server/bin/import.php @@ -0,0 +1,342 @@ + Live Import: "; +if ($live) echo "Yes"; +else echo "No"; +echo "\n\n"; + + +class TImportXML +{ +var $Init=false; +var $Elements=0; +var $Nodes=0; +var $NodeList=array(); +var $Localtests=0; +var $LocaltestList=array(); + +var $NodeDefaults=array(); +var $LocaltestDefaults=array(); + +var $in_freenats=false; +var $in_node=false; +var $in_localtest=false; +var $in_nodedefault=false; +var $in_localtestdefault=false; +var $in_test=false; +var $depth=0; +var $last_element=""; +var $cur_id=""; + +function startElement($parser, $name, $attrs) +{ +if ($name=="FREENATS-DATA") $this->in_freenats=true; +if (!$this->in_freenats) return 0; + +if ($name=="NODE") + { + $this->in_node=true; + $this->Nodes++; + $this->NodeList[$attrs['NODEID']]=$this->NodeDefaults; + $this->cur_id=$attrs['NODEID']; + } +else if ($name=="DEFAULT") + { + if ($attrs['TYPE']=="node") + { + echo "Node Default Section Starting\n"; + $this->in_nodedefault=true; + } + else if ($attrs['TYPE']=="localtest") + { + echo "Localtest Default Section Starting\n"; + $this->in_localtestdefault=true; + } + } +else if ($name=="LOCALTEST") + { + $this->in_localtest=true; + //echo "In Local Test\n"; + $this->LocaltestList[$this->Localtests]=$this->LocaltestDefaults; + $this->Localtests; + } +$this->last_element=$name; +$this->depth++; +$this->Elements++; +} + +function endElement($parser, $name) +{ +$this->depth--; +if ($name=="LOCALTEST") + { + //echo "Finished Localtest\n"; + $this->in_localtest=false; + $this->Localtests++; + } +else if ($name=="NODE") $this->in_node=false; +else if ($name=="DEFAULT") + { + $this->in_nodedefault=false; + $this->in_localtestdefault=false; + echo "Default Section End\n\n"; + } +else if ($name=="FREENATS-DATA") $in_freenats=false; +} + +function charData($parser,$data) +{ +if (!$this->in_freenats) return 0; +$data=trim($data); +if ($data!="") + { + if ($this->in_node) + { + $this->NodeList[$this->cur_id][strtolower($this->last_element)]=$data; + echo "Node Data: ".$data."\n"; + } + else if ($this->in_nodedefault) + { + echo " Default: ".strtolower($this->last_element)." => ".$data."\n"; + $this->NodeDefaults[strtolower($this->last_element)]=$data; + } + else if ($this->in_localtestdefault) + { + echo " Default: ".strtolower($this->last_element)." => ".$data."\n"; + $this->LocaltestDefaults[strtolower($this->last_element)]=$data; + } + else if ($this->in_localtest) + { + $test=$this->Localtests; + //echo "***".$data; + $this->LocaltestList[$test][strtolower($this->last_element)]=$data; + } + //else echo $data; + + } +} + +function Error() +{ +return $this->LastError; +} + +function Parse($xml) +{ +$this->Init=true; +if (get_magic_quotes_gpc()) $xml=stripslashes($xml); +$parser=xml_parser_create(); +xml_set_element_handler($parser,Array( $this, "startElement" ), + Array( $this, "endElement" ) ); +xml_set_character_data_handler($parser,Array( $this, "charData" )); + +$return=true; + +if (!xml_parse($parser,$xml,true)) + { + $this->LastError="XML Error ".xml_error_string(xml_get_error_code($parser)); + $this->LastError.=" at line ".xml_get_current_line_number($parser); + $return=false; + } + +xml_parser_free($parser); + +return true; +} + +function ParseFile($xmlfile) +{ +$fp=fopen($xmlfile,"r") + or die("Could not open XML file ".$xmlfile); +$data=""; +while (!feof($fp)) + $data.=fgets($fp,4096); +fclose($fp); +return $this->Parse($data); +} + + +} + + +$xml=new TImportXML(); +if ($xml->ParseFile($file)===false) + { + echo "Error Encountered!\n"; + echo $xml->LastError; + echo "\n\n"; + exit(); + } + +echo "Nodes: ".$xml->Nodes." Local Tests: ".$xml->Localtests."\n"; +if ($live) + { + echo "Starting FreeNATS for live import... "; + @include("include.php"); + if (!isset($BaseDir)) $BaseDir="../base/"; + + //require($BaseDir."nats.php"); -- BID 263 + $NATS->Start(); + echo "Ok\n"; + } +foreach($xml->NodeList as $nodeid=>$node) + { + + echo "NodeID: ".$nodeid." - Parsing Properties...\n"; + $fields="("; + $values="("; + $first=true; + foreach($node as $key=>$val) + { + if ($first) $first=false; + else + { + $fields.=","; + $values.=","; + } + $fields.=$key; + $values.="\"".$val."\""; + echo " ".$key." => ".$val."\n"; + } + $fields.=")"; + $values.=")"; + + $q="INSERT INTO fnnode".$fields." VALUES".$values; + if ($debug) echo " SQL: ".$q."\n"; + + if ($live) + { // actual import + $NATS->DB->Query($q); + if ($NATS->DB->Error()) + { + echo "Failed: SQL Error: ".$NATS->DB->Error_String()."\n"; + $xml->NodeList[$nodeid]['import_success']=false; + } + else if ($NATS->DB->Affected_Rows()<=0) + { + echo "Failed: SQL INSERT Failed: Duplicate or Blank?\n"; + $xml->NodeList[$nodeid]['import_success']=false; + } + else + { + echo "Succeeded: SQL INSERT Success\n"; + $xml->NodeList[$nodeid]['import_success']=true; + } + } + else + { // dummy run + echo " Live Import: No\n"; + $xml->NodeList[$nodeid]['import_success']=true; + } + echo "\n"; + } + +foreach($xml->LocaltestList as $test) + { + //print_r($test); + //exit(); + echo "Test ".$test['testtype']." for ".$test['nodeid']."\n"; + $process=false; + if (isset($xml->NodeList[$test['nodeid']])) + { + if ( isset($xml->NodeList[$test['nodeid']]['import_success']) && $xml->NodeList[$test['nodeid']]['import_success'] ) + { + echo "Processing Test\n"; + $process=true; + } + else + { + echo "Skipping Test: Node failed to import in this data\n"; + } + } + else + { + echo "WARNING: Node not created in this script for this test\n"; + $process=true; + } + if ($process) + { + $fields="("; + $values="("; + $first=true; + foreach($test as $key=>$val) + { + if ($first) $first=false; + else { $fields.=","; $values.=","; } + $fields.=$key; + $values.="\"".$val."\""; + echo " ".$key." => ".$val."\n"; + } + $fields.=")"; + $values.=")"; + $q="INSERT INTO fnlocaltest".$fields." VALUES".$values; + if ($debug) echo " SQL: ".$q."\n"; + if ($live) + { // actual import + $NATS->DB->Query($q); + if ($NATS->DB->Error()) + { + echo "Failed: SQL Error: ".$NATS->DB->Error_String()."\n"; + + } + else if ($NATS->DB->Affected_Rows()<=0) + { + echo "Failed: SQL INSERT Failed: Duplicate or Blank?\n"; + + } + else + { + echo "Succeeded: SQL INSERT Success\n"; + + } + } + } + echo "\n"; + } + +if ($live) $NATS->Stop(); +?> \ No newline at end of file diff --git a/src/server/bin/include.php b/src/server/bin/include.php new file mode 100755 index 0000000..2d0ab7e --- /dev/null +++ b/src/server/bin/include.php @@ -0,0 +1,4 @@ + diff --git a/src/server/bin/logwatch.php b/src/server/bin/logwatch.php new file mode 100755 index 0000000..4c019ba --- /dev/null +++ b/src/server/bin/logwatch.php @@ -0,0 +1,111 @@ +Start(); +$min_delay=2; +$first=true; +$lastlog=0; +$pull=20; +$continue=false; +$level=0; + +for ($a=1; $a<$argc; $a++) + { + switch($argv[$a]) + { + case "-f": + $continue=true; + break; + case "-c": + $pull=$argv[++$a]; + break; + case "-l": + $level=$argv[++$a]; + break; + case "-d": case "-s": + $min_delay=$argv[++$a]; + break; + default: + +echo "FreeNATS logwatch System Log Watcher Tool\n"; +echo "Usage: php logwatch.php [-f] [-c count] [-l level] [-d delay]\n"; +echo "\n"; +echo "Displays the last system event log items and optionally will\n"; +echo "continue to monitor the log for new events.\n"; +echo "\n"; +echo "Options:\n"; +echo " -f follow - continue to display output\n"; +echo " -c count - display this many previous entries initially\n"; +echo " defaults to 20\n"; +echo " -l level - only displays log levels of this level or below\n"; +echo " -d delay - pause this many seconds between database fetches\n"; +echo " when using -f (defaults to 2 seconds)\n\n"; + exit(); + break; + + } + } +$loop=true; +while ($loop) + { + $start=time(); + $q="SELECT * FROM fnlog"; + $wc=""; + if ($lastlog>0) + { + $wc.="logid>".$lastlog; + } + if ($level>0) + { + if ($lastlog>0) $wc.=" AND "; + $wc.="loglevel<=".ss($level); + } + if ($wc!="") $q.=" WHERE ".$wc; + $q.=" ORDER BY logid"; + if ($first) + { + $q.=" DESC LIMIT 0,".$pull; + //$first=false; + } + else $q.=" ASC"; + $r=$NATS->DB->Query($q); + if ($first) $s=array(); + while ($row=$NATS->DB->Fetch_Array($r)) + { + $line=nicedt($row['postedx'])."\t".$row['loglevel']."\t".$row['modid'].":".$row['catid']."\t".$row['logevent']."\n"; + if ($first) $s[]=$line; + else echo $line; + if ($row['logid']>$lastlog) $lastlog=$row['logid']; + } + $NATS->DB->Free($r); + if ($first) + { + for ($a=count($s)-1; $a>=0; $a--) + { + echo $s[$a]; + } + } + if (!$continue) $loop=false; + if ($first) $first=false; + if ($loop) while ( (time()-$start)<$min_delay ) sleep(1); + } +?> \ No newline at end of file diff --git a/src/server/bin/resettester.sh b/src/server/bin/resettester.sh new file mode 100755 index 0000000..4c51b73 --- /dev/null +++ b/src/server/bin/resettester.sh @@ -0,0 +1,16 @@ +#!/usr/bin/php -q +Start(); +if ( ($argc>1) && ($argv[1]=="-f") ) + $startx=time(); +else $startx=time()-(5*60); + +$q="UPDATE fntestrun SET finishx=1 WHERE finishx=0 AND startx<".$startx; +$NATS->DB->Query($q); +echo "Reset ".$NATS->DB->Affected_Rows()." Test Runs\n"; + +$NATS->Stop(); + +?> + diff --git a/src/server/bin/setvar.sh b/src/server/bin/setvar.sh new file mode 100755 index 0000000..f09e1c7 --- /dev/null +++ b/src/server/bin/setvar.sh @@ -0,0 +1,40 @@ +#!/usr/bin/php -q +Start(); + + +if ($argc!=3) + { + echo "Usage: setvar.sh var.name value\n"; + echo " set var.name to var.value (create if new)\n"; + echo "Usage: setvar.sh -d var.name\n"; + echo " delete var.name\n"; + $NATS->Stop(); + exit(); + } + +if ($argv[1]=="-d") // delete + { + $q="DELETE FROM fnconfig WHERE fnc_var=\"".ss($argv[2])."\""; + $r=$NATS->DB->Query($q); + echo "Deleted ".$NATS->DB->Affected_Rows()." Variables\n"; + } +else // update/create + { + $q="UPDATE fnconfig SET fnc_val=\"".ss($argv[2])."\" WHERE fnc_var=\"".ss($argv[1])."\""; + $r=$NATS->DB->Query($q); + $res=$NATS->DB->Affected_Rows(); + if ($res>0) echo "Updated ".$res." Variables\n"; + else + { // doesn't exist or the same value + $q="INSERT INTO fnconfig(fnc_var,fnc_val) VALUES(\"".ss($argv[1])."\",\"".ss($argv[2])."\")"; + $r=$NATS->DB->Query($q); + if ($NATS->DB->Affected_Rows()>0) echo "Inserted ".$NATS->DB->Affected_Rows()." Variables\n"; + else echo "Failed to update - value the same?\n"; + } + } + +$NATS->Stop(); + +?> diff --git a/src/server/bin/test-threaded.php b/src/server/bin/test-threaded.php new file mode 100755 index 0000000..e68f6bd --- /dev/null +++ b/src/server/bin/test-threaded.php @@ -0,0 +1,50 @@ +Start(); + +$nodelist=array(); +for ($a=1; $a<$argc; $a++) + $nodelist[]=$argv[$a]; + + +echo "test-threaded.sh: spawning node tester processes\n"; + +$q="SELECT nodeid FROM fnnode WHERE nodeenabled>0"; +if (count($nodelist)>0) + { + $q.=" AND nodeid IN("; + $first=true; + foreach($nodelist as $node) + { + if ($first) $first=false; + else $q.=","; + $q.="\"".ss($node)."\""; + } + $q.=")"; + } +else $q.=" AND masterid=\"\""; + +$q.=" ORDER BY weight ASC"; + +$r=$NATS->DB->Query($q); +$spawn_delay=$NATS->Cfg->Get("test.spawndelay",0); +//echo "Delay: ".$spawn_delay."\n"; +if ($spawn_delay>0) $spawn_delay=$spawn_delay*1000000; // convert to us (microseconds / millionths) +//echo "Delay: ".$spawn_delay."\n"; +$first=true; +while ($row=$NATS->DB->Fetch_Array($r)) + { + if ($first) $first=false; + else + { + // Test Execution Delay / test.spawndelay + if ($spawn_delay>0) usleep($spawn_delay); + } + $cmd="php ./tester.php ".$row['nodeid']." > /tmp/nr.".$row['nodeid']." &"; + echo $cmd."\n"; + exec($cmd); + } +$NATS->DB->Free($r); +$NATS->Stop(); +?> + diff --git a/src/server/bin/test-threaded.sh b/src/server/bin/test-threaded.sh new file mode 100755 index 0000000..7a865f2 --- /dev/null +++ b/src/server/bin/test-threaded.sh @@ -0,0 +1,3 @@ +#!/bin/sh +php -f test-threaded.php + diff --git a/src/server/bin/tester.php b/src/server/bin/tester.php new file mode 100755 index 0000000..3e6efb6 --- /dev/null +++ b/src/server/bin/tester.php @@ -0,0 +1,510 @@ +1) + { + $nfilter=$argv[1]; + } + else $nfilter=""; + } + +require("include.php"); + +$dbt=""; + +function db($txt,$nl=true) // debug text +{ +global $dbt; +echo $txt; +$dbt.=$txt; +if ($nl) + { + echo "\n"; + $dbt.="
\n"; + } +} + +$NATS->Start(); +if ($nfilter!="") $st=": Node ".$nfilter; +else $st=""; +db("NATS Tester Script Starting".$st); + +$highalertlevel=-1; +$talertc=0; + +// check if already running +$still_running=false; +$cq="SELECT trid,startx FROM fntestrun WHERE fnode=\"".ss($nfilter)."\" AND finishx=0 LIMIT 0,1"; +$cr=$NATS->DB->Query($cq); + +if ($runrow=$NATS->DB->Fetch_Array($cr)) + { // yes there is a testrun session for this node(s) + $timelimit=$NATS->Cfg->Get("test.session.limit",60*60); + if ( (!is_numeric($timelimit)) || ($timelimit<0) ) $timelimit=60*60; // bogus config value + + // n.b. a timelimit of 0 means the session will never expire so... + if ( ($timelimit>0) && ((time()-$runrow['startx'])>$timelimit) ) + { + // valid time limit and the difference is more than the limit so close it + $uq="UPDATE fntestrun SET finishx=1 WHERE trid=".$runrow['trid']; + $NATS->DB->Query($uq); + if ($NATS->DB->Affected_Rows()>0) + { + $NATS->Event("Tester Already Running: Cleared",3,"Tester","Stale"); + db("Tester Already Running: Cleared"); + } + else $NATS->Event("Tester Already Running: Failed to Clear",1,"Tester","Stale"); // weirdness... run anyway + } + else $still_running=true; // either never timesout or newer than timelimit ago + } +$NATS->DB->Free($cr); + +// and if it is then don't continue +if ($still_running) + { + $NATS->Event("Tester Already Running: Aborted",1,"Tester","Error"); + db("Tester Already Running: Aborted"); + $NATS->Stop(); + exit(); + } + + +$gq="INSERT INTO fntestrun(startx,fnode) VALUES(".time().",\"".ss($nfilter)."\")"; +$NATS->DB->Query($gq); +$trid=$NATS->DB->Insert_Id(); +db("Test ID: ".$trid." (Started at ".nicedt(time()).")"); +$NATS->Event("Tester ".$trid." Started",5,"Tester","Start"); + +db(" "); + +// Find node to test - must be enabled, have id if set, and be due to be tested (nextrunx) + +$q="SELECT * FROM fnnode WHERE nodeenabled=1"; +if ($nfilter!="") $q.=" AND nodeid=\"".ss($nfilter)."\""; +$q.=" AND nextrunx<=".time(); + +$r=$NATS->DB->Query($q); + + +while ($row=$NATS->DB->Fetch_Array($r)) + { + $dotests=true; + $alertlevel=0; + $alerts=array(); + $alertc=0; + db("NodeID: ".$row['nodeid']); + $NATS->Event("Tester ".$trid." Node ".$row['nodeid'],10,"Tester","Node"); + + // Scheduling Test In Here - sets dotests to false and alertlevel to -1 untested + if ($row['scheduleid']!=0) // has a schedule + { + db(" Has Schedule: Yes - Checking"); + $run=run_x_in_schedule(time(),$row['scheduleid']); + if (!$run) + { + db(" In Schedule: No - Skipping Tests"); + $NATS->Event("Tester ".$trid." Skipped by Schedule",5,"Tester","Node"); + $dotests=false; + $alertlevel=-1; + } + else db(" In Schedule: Yes"); + } + + $eventdata=array( "nodeid" => $row['nodeid'], "in_schedule" => $dotests ); + $NATS->EventHandler("node_test_start",$eventdata); + + + $ptr=0; + $pal=0; + + + // Update lastrun and nextrun regardless of dotests + $q="UPDATE fnnode SET lastrunx=".time().",nextrunx=".next_run_x($row['testinterval'])." WHERE nodeid=\"".ss($row['nodeid'])."\""; + $NATS->DB->Query($q); + + $pingpassed=false; // this will only be set to true if a test is done and passes - for the "child" nodes + if ($row['pingtest']&&$dotests) + { + db(" Ping Test: Yes"); + $NATS->Event("Tester ".$trid." Pinging Node ".$row['nodeid'],10,"Tester","Ping"); + $ptr=PingTest($row['hostname']); + $NATS->Event("Tester ".$trid." Ping Node ".$row['nodeid']." Returned ".$ptr,10,"Tester","Ping"); + db(" Ping Returned: ".$ptr); + if ( ($ptr<=0) && ($NATS->Cfg->Get("test.icmp.attempts","2")>1) ) + { + $att=$NATS->Cfg->Get("test.icmp.attempts","2"); + for ($a=2; $a<=$att; $a++) // starting on second attempt + { + // try again... + test_sleep(); + db(" Trying Ping Again - X".$a); + $NATS->Event("Tester ".$trid." Ping X".$a." Node ".$row['nodeid'],10,"Tester","Ping"); + $ptr=PingTest($row['hostname']); + $NATS->Event("Tester ".$trid." Ping Node ".$row['nodeid']." Returned ".$ptr,10,"Tester","Ping"); + db(" Ping Returned: ".$ptr); + if ($ptr>0) $a=$att+1; // break out of the loop + } + } + + if ($ptr<=0) + { + $alertlevel=2; + db(" Ping Test: Failed"); + $alerts[$alertc++]="ping failed"; + $pal=2; + } + else + { + db(" Ping Test: Passed"); + $pingpassed=true; + } + + // pingtest output bodge + // is there a test entry for ICMP + $fq="SELECT localtestid FROM fnlocaltest WHERE nodeid=\"".$row['nodeid']."\" AND testtype=\"ICMP\""; + $fr=$NATS->DB->Query($fq); + $ltid_icmp=""; + if ($irow=$NATS->DB->Fetch_Array($fr)) + { // exists + $uq="UPDATE fnlocaltest SET alertlevel=".$pal.",lastrunx=".time().",lastvalue=".$ptr.",testrecord=1,testinterval=0 WHERE localtestid=".$irow['localtestid']; + $ltid_icmp=$irow['localtestid']; + //echo $uq; + $NATS->DB->Query($uq); + } + else + { // doesn't exist + $uq="INSERT INTO fnlocaltest(nodeid,testrecord,testinterval,testtype,alertlevel,lastrunx,lastvalue) VALUES(\"".$row['nodeid']."\",1,0,\"ICMP\",".$pal.",".time().",".$ptr.")"; + //echo $uq; + $NATS->DB->Query($uq); + $ltid_icmp=$NATS->DB->Insert_Id(); + } + $NATS->DB->Free($fr); + + // record the ICMP bodge-test here + $rq="INSERT INTO fnrecord(testid,recordx,testvalue,alertlevel,nodeid) VALUES(\"L".$ltid_icmp."\",".time().",".$ptr.",".$pal.",\"".$row['nodeid']."\")"; + $NATS->DB->Query($rq); + //echo $rq." ".$NATS->DB->Affected_Rows()."\n"; + + } + else + { // further ICMP bodge - update to -1 or do nothing if the test doesn't exist + $uq="UPDATE fnlocaltest SET alertlevel=-1,lastrunx=".time()." WHERE nodeid=\"".$row['nodeid']."\" AND testtype=\"ICMP\""; + $NATS->DB->Query($uq); + } + + if ($dotests&&($row['pingfatal'])&&($ptr<=0)) + { + db(" Ping Fatal: Yes - Not Continuing"); + $NATS->Event("Tester ".$trid." Ping Fatal for Node ".$row['nodeid'],10,"Tester","Ping"); + $dotests=false; + } + + // do the tests - only actually exec if dotests true + + $first_test=true; + + db("Doing Local Tests"); + $NATS->Event("Tester ".$trid." Testing Node ".$row['nodeid'],10,"Tester","Test"); + $q="SELECT * FROM fnlocaltest WHERE nodeid=\"".$row['nodeid']."\" AND testtype!=\"ICMP\" AND testenabled=1 ORDER BY localtestid ASC"; + $res=$NATS->DB->Query($q); + while ($lrow=$NATS->DB->Fetch_Array($res)) + { + if ($lrow['nextrunx']<=time()) $testdue=true; + else $testdue=false; + + if ($first_test) + { + $first_test=false; + if ($row['pingtest']==1) test_sleep(); // sleep if has done a ping + } + else test_sleep(); + + if ($testdue) + { + + $eventdata=array("nodeid"=>$row['nodeid'],"testid"=>"L".$lrow['testparam'],"testtype"=>$lrow['testtype']); + $NATS->EventHandler("localtest_start",$eventdata); + + db(" Test: ".$lrow['testtype']." (".$lrow['testparam'].")"); + + // Build parameter array + $params=array(); + $params[0]=$lrow['testparam']; // pass standard param in as 0 + for ($a=1; $a<10; $a++) + { + $parstr="testparam".$a; + $params[$a]=$lrow[$parstr]; + } + + if ($dotests) + { + $NATS->Event("Tester ".$trid." Node ".$row['nodeid']." Doing ".$lrow['testtype']."(".$lrow['testparam'].")",10,"Tester","Test"); + $result=DoTest($lrow['testtype'],$lrow['testparam'],$row['hostname'],$lrow['timeout'],$params,$row['nodeid']); + $NATS->Event("Tester ".$trid." Node ".$row['nodeid']." Result ".$result." from ".$lrow['testtype']."(".$lrow['testparam'].")",10,"Tester","Test"); + db(" Result: ".$result); + } + else $result=0; + + if ($dotests) + { + // evaluation + if ($lrow['simpleeval']==1) $lvl=SimpleEval($lrow['testtype'],$result); + else $lvl=nats_eval("L".$lrow['localtestid'],$result); + db(" Eval: ".$lvl); + + // put in the custom retries based on attempts here - we KNOW dotests is on so don't need to worry about untested status + $att=$lrow['attempts']; + if ( ($lvl!=0) && (is_numeric($att)) && ($att>1) ) + { + for ($a=2; $a<=$att; $a++) + { + test_sleep(); + db(" Test: ".$lrow['testtype']." (".$lrow['testparam'].") X".$a); + $NATS->Event("Tester ".$trid." Node ".$row['nodeid']." X".$a." Doing ".$lrow['testtype']."(".$lrow['testparam'].")",10,"Tester","Test"); + $result=DoTest($lrow['testtype'],$lrow['testparam'],$row['hostname'],$lrow['timeout'],$params,$row['nodeid']); + db(" Result: ".$result); + if ($lrow['simpleeval']==1) $lvl=SimpleEval($lrow['testtype'],$result); + else $lvl=nats_eval("L".$lrow['localtestid'],$result); + db(" Eval: ".$lvl); + if ($lvl==0) $a=$att+1; // test passed + } + } + + // $lvl is now the last lvl regardless of where it came from + + if ($lvl>$alertlevel) $alertlevel=$lvl; + if ($lvl>0) + { + if ($lrow['testname']=="") $s=$lrow['testtype']."/".substr($lrow['testparam'],0,5)." "; + else $s=$lrow['testname']." "; + /* + if ($lvl>1) $s.=$NATS->Cfg->Get("site.text.failed","failed"); + else $s.=$NATS->Cfg->Get("site.text.warning","warning"); + */ + $s.=oText($lvl); + // site.alert.showvalue -- includes value in alert messages if numeric + // site.alert.showtext -- includes value in alert messages if textual + if (is_numeric($result)) + { + if ($NATS->Cfg->Get("site.alert.showvalue",0)==1) $s.=" (".$result.")"; + } + else // non-numeric + { + if ($NATS->Cfg->Get("site.alert.showtext",0)==1) $s.=" (".$result.")"; + } + $alerts[$alertc++]=$s; + } + } else $lvl=-1; + + // record it + if ($lrow['testrecord']==1) + { + $tid="L".$lrow['localtestid']; + $iq="INSERT INTO fnrecord(testid,nodeid,alertlevel,testvalue,recordx) VALUES("; + $iq.="\"".$tid."\",\"".$row['nodeid']."\",".$lvl.",".$result.",".time().")"; + $NATS->DB->Query($iq); + db(" Recording Test"); + } + if ((!isset($result))||(!is_numeric($result))) $result=0; // safety net + + // update localtest record + $uq="UPDATE fnlocaltest SET lastrunx=".time().",nextrunx=".next_run_x($lrow['testinterval']).",alertlevel=".$lvl.",lastvalue=".$result." WHERE localtestid=".$lrow['localtestid']; + $NATS->DB->Query($uq); + + $eventdata=array("nodeid"=>$row['nodeid'],"testid"=>"L".$lrow['testparam'],"testtype"=>$lrow['testtype'],"alertlevel"=>$lvl); + $NATS->EventHandler("localtest_finish",$eventdata); + } + + else // test not due so take pre-existing level for it + { + $lvl=$lrow['alertlevel']; + if (($lvl>0)&&($lvl>$alertlevel)) $alertlevel=$lvl; + } + + + } + + // Node-side testy magic + db("Nodeside Testing"); + $freshdata=false; + if ( $dotests && ($row['nsenabled']==1) && ($row['nspullenabled']==1) ) // should be doing a pull + { + $pullalert=$row['nspullalert']; // what happened the last time we tried + + if ($row['nsnextx']<=time()) // the time is right + { + db(" Pulling Data"); + $pull_result=$NATS->Nodeside_Pull($row['nodeid']); + + if ($pull_result===false) // Pull Failed + { + db(" Pull Failed"); + $pullalert=1; // alert + $alerts[$alertc++]="pull failed"; + $alertlevel=2; + } + else // Pull Worked + { + $freshdata=true; + $pullalert=0; // ok + db(" Pull Succeeded"); + } + + + db(" Updating Pull nslast/nextx and nspullalert"); + $uq="UPDATE fnnode SET nsnextx=".next_run_x($row['nsinterval']).",nspullalert=".$pullalert.",nslastx=".time()." WHERE nodeid=\"".$row['nodeid']."\""; + $NATS->DB->Query($uq); + if ($NATS->DB->Affected_Rows()<=0) db(" - Failed"); + } + /* + // Process for alerts in here - whether pulled or not! + $tq="SELECT testtype,testname,alertlevel FROM fnnstest WHERE nodeid=\"".$row['nodeid']."\" AND testenabled=1 AND testalerts=1 AND alertlevel>0"; + $tr=$NATS->DB->Query($tq); + while ($trow=$NATS->DB->Fetch_Array($tr)) + { + if ($trow['testname']=="") $tname=$trow['testtype']; + else $tname=$trow['testname']; + if ($freshdata) $alerts[$alertc++]=$tname." ".oText($trow['alertlevel']); // only record text to log if fresh + if ($trow['alertlevel']>$alertlevel) $alertlevel=$trow['alertlevel']; + } + */ + + // and finally again use pullalert - this is either the new value if a pull was attempted or just remains the same as the old one + // if pull not scheduled yet + if ($pullalert>0) $alertlevel=2; // so mark a failure + + } + + if ( ($dotests && ($row['nsenabled']==1) && ($row['nspullenabled']==1)) || // pull and tests are on + (($row['nsenabled']==1)&&($row['nspushenabled']==1)) ) // or pushed + { + if ($row['nsfreshpush']==1) + { + $freshdata=true; + $uq="UPDATE fnnode SET nsfreshpush=0 WHERE nodeid=\"".$row['nodeid']."\""; + $NATS->DB->Query($uq); + } + // Process for alerts in here - whether pulled or not! + $tq="SELECT testtype,testname,alertlevel,lastvalue FROM fnnstest WHERE nodeid=\"".$row['nodeid']."\" AND testenabled=1 AND testalerts=1 AND alertlevel>0"; + $tr=$NATS->DB->Query($tq); + while ($trow=$NATS->DB->Fetch_Array($tr)) + { + if ($trow['testname']=="") $tname=$trow['testtype']; + else $tname=$trow['testname']; + if ($freshdata) // only record text to log if fresh + { + $s=$tname." ".oText($trow['alertlevel']); + $result=$trow['lastvalue']; + if (is_numeric($result)) + { + if ($NATS->Cfg->Get("site.alert.showvalue",0)==1) $s.=" (".$result.")"; + } + else // non-numeric + { + if ($NATS->Cfg->Get("site.alert.showtext",0)==1) $s.=" (".$result.")"; + } + $alerts[$alertc++]=$s; + } + if ($trow['alertlevel']>$alertlevel) $alertlevel=$trow['alertlevel']; + } + } + + $NATS->Event("Tester ".$trid." Finished Node ".$row['nodeid'],10,"Tester","Node"); + + $eventdata=array( "nodeid" => $row['nodeid'], "alertlevel" => $alertlevel ); + $NATS->EventHandler("node_test_finish",$eventdata); + + db("Highest Alert Level: ".$alertlevel); + db("Alert Count : ".$alertc); + $als=""; + foreach($alerts as $al) $als.=$al.", "; + db("Alerts: ".$als); + + $NATS->SetAlerts($row['nodeid'],$alertlevel,$alerts); + + // This is where child/slave nodes spawn + + // $pingpassed bool holds if pingtest has passed + // $alertlevel holds the overall status + $chq="SELECT nodeid,masterjustping FROM fnnode WHERE masterid=\"".$row['nodeid']."\""; + //echo $chq; + + $chr=$NATS->DB->Query($chq); + $spawnlist=array(); + + while ($child=$NATS->DB->Fetch_Array($chr)) + { + if (($child['masterjustping']==1)&&($pingpassed)) $spawnlist[]=$child['nodeid']; + else if ($alertlevel==0) $spawnlist[]=$child['nodeid']; + // logic: if the child requires a ping and ping has passed ok then spawn it + // otherwise (pass on any alert) if everything has passed spawn it + } + $NATS->DB->Free($chr); + + if (count($spawnlist)>0) + { + $cmd="php ./test-threaded.php"; + foreach($spawnlist as $child) + $cmd.=" ".$child; + $cmd.=" > /tmp/ns.master.".$row['nodeid']." &"; + db("Children Spawning: ".$cmd); + exec($cmd); + } + + + // End of the node... carry forward highest level + + db(" "); + + if ($alertlevel>$highalertlevel) $highalertlevel=$alertlevel; + $talertc+=$alertc; + + } + + + +db("Finished Tests... Finishing Off"); +db("Summary: Tester ".$trid." Highest Level ".$highalertlevel.", Alerts ".$talertc); +if ($highalertlevel>-1) + { + $uq="UPDATE fntestrun SET finishx=".time().",routput=\"".ss($dbt)."\" WHERE trid=".$trid; + $NATS->DB->Query($uq); + } +else + { + $uq="DELETE FROM fntestrun WHERE trid=".$trid; + $NATS->DB->Query($uq); + } + + +$NATS->Event("Tester ".$trid." Highest Level ".$highalertlevel.", Alerts ".$talertc,7,"Tester","Stat"); +$NATS->Event("Tester ".$trid." Finished",5,"Tester","Stop"); + +// in here for now... +$NATS->ActionFlush(); + +$NATS->Stop(); +db("NATS Stopped... Finished"); +?> + diff --git a/src/server/bin/tester.sh b/src/server/bin/tester.sh new file mode 100755 index 0000000..e969e03 --- /dev/null +++ b/src/server/bin/tester.sh @@ -0,0 +1,3 @@ +#!/bin/sh +php -f tester.php $1 + diff --git a/src/server/extras/events/console.php b/src/server/extras/events/console.php new file mode 100755 index 0000000..a684812 --- /dev/null +++ b/src/server/extras/events/console.php @@ -0,0 +1,67 @@ + /dev/console"; + @exec($cmd); + return true; +} + +$NATS->AddEventHandler("alert_action","alert_action_console"); + + + + + +} // end of isset($NATS) block +?> \ No newline at end of file diff --git a/src/server/extras/events/detailed_alerts.php b/src/server/extras/events/detailed_alerts.php new file mode 100755 index 0000000..d814ccc --- /dev/null +++ b/src/server/extras/events/detailed_alerts.php @@ -0,0 +1,184 @@ + "_detailtrigger", + "alertaction" => "_detailaction", + + "status_on_open" => true, // on an alert open include node status + "status_on_close" => true, // same for close + + "summary_on_open" => true, // on open show summary of other alerts + "summary_on_close" => true ); // same for close + // END OF CONFIGURATION + + + if ($data['event']=="alert_action") + { + if ($data['name']==$detail_alert_config["trigger"]) return true; // clear + else return false; // propgate + } + else if ($data['event']=="alert_open") + { + $open=true; + $close=false; + } + else if($data['event']=="alert_close") + { + $open=false; + $close=true; + } + else return false; + + // Does this node have the alert action of "trigger" + + // First what is the trigger aaid + $q="SELECT aaid FROM fnalertaction WHERE aname=\"".ss($detail_alert_config["trigger"])."\" LIMIT 0,1"; + //echo $q."\n"; + $r=$NATS->DB->Query($q); + if (!$aa=$NATS->DB->Fetch_Array($r)) + { + $NATS->Event("No trigger action ".$detail_alert_config["trigger"],10,"Extras","Detail Alert"); + return false; // no such trigger alert action + } + $NATS->DB->Free($r); + + $aaid=$aa['aaid']; + + // Second does the node have this alert action + $q="SELECT nalid FROM fnnalink WHERE aaid=".$aaid." AND nodeid=\"".ss($data['nodeid'])."\" LIMIT 0,1"; + //echo $q."\n"; + $r=$NATS->DB->Query($q); + if (!$link=$NATS->DB->Fetch_Array($r)) + { + $NATS->Event("Node does not have trigger action",10,"Extras","Detail Alert"); + return false; // no it does not + } + $NATS->DB->Free($r); + + + $msg=$data['nodeid']." : Alert "; + if ($open) $msg.="Opened"; + else $msg.="Closed"; + $msg.="\n\n"; + + if ( ( $open && $detail_alert_config['status_on_open'] ) || + ( $close && $detail_alert_config['status_on_close'] ) ) + { // include node status + + $tests=$NATS->GetNodeTests($data['nodeid']); + foreach($tests as $testid) + { + $test=$NATS->GetTest($testid); + if ($test!==false) // specific comparitor + { + $msg.=$test['name'].": ".$test['alerttext']." (".$test['lastrunago']." ago)\n"; + } + } + + $msg.="\n\n"; + } + + if ( ( $open && $detail_alert_config['summary_on_open'] ) || + ( $close && $detail_alert_config['summary_on_close'] ) ) + { // include alert summary + + $msg.="Current Alerts: "; + $alerts=$NATS->GetAlerts(); + if ( ($alerts===false) || (count($alerts)<=0) ) $msg.="No Alerts"; + else + { + $first=true; + foreach($alerts as $alert) + { + if ($first) $first=false; + else $msg.=", "; + $msg.=$alert['nodeid']; + } + } + + $msg.="\n\n"; + } + + // ok got this far so find output aaid and pass data + $q="SELECT aaid FROM fnalertaction WHERE aname=\"".ss($detail_alert_config["alertaction"])."\" LIMIT 0,1"; + $r=$NATS->DB->Query($q); + if ($row=$NATS->DB->Fetch_Array($r)) + { + $NATS->DB->Free($r); + $NATS->ActionAddData($row['aaid'],$msg); + } + else + { + $NATS->Event("Unable to find action ".$detail_alert_config["alertaction"],10,"Extras","Detail Alert"); + return false; // failed to find + } + +} + +$NATS->AddEventHandler("alert_open","detail_alert_handler"); +$NATS->AddEventHandler("alert_close","detail_alert_handler"); +$NATS->AddEventHandler("alert_action","detail_alert_handler"); // to clear the trigger + + +} // end of NATS block + +?> \ No newline at end of file diff --git a/src/server/extras/events/file.php b/src/server/extras/events/file.php new file mode 100755 index 0000000..d3f15d4 --- /dev/null +++ b/src/server/extras/events/file.php @@ -0,0 +1,70 @@ +AddEventHandler("alert_action","alert_action_file"); + + + + +} // end of isset($NATS) block +?> \ No newline at end of file diff --git a/src/server/extras/events/syslog.php b/src/server/extras/events/syslog.php new file mode 100755 index 0000000..632bf18 --- /dev/null +++ b/src/server/extras/events/syslog.php @@ -0,0 +1,80 @@ +Event("Syslog AA Called for ".$data['name'],10,"Syslog","Start"); + if ($data['name']!="_syslog") return false; + $lvl=LOG_ERR; + + define_syslog_variables(); + openlog("FreeNATS", LOG_PID | LOG_PERROR, LOG_LOCAL0); + + if (syslog($lvl,$data['data'])===false) + $NATS->Event("Syslog Failed for ".$data['data'],2,"Syslog","Write"); + else + $NATS->Event("Syslog Succeeded for ".$data['data'],10,"Syslog","Write"); + closelog(); + + return true; +} + +$NATS->AddEventHandler("alert_action","alert_action_syslog"); + + + + +} // end of isset($NATS) block +?> \ No newline at end of file diff --git a/src/server/extras/tests/advanced_page_test.php b/src/server/extras/tests/advanced_page_test.php new file mode 100755 index 0000000..ddee20e --- /dev/null +++ b/src/server/extras/tests/advanced_page_test.php @@ -0,0 +1,225 @@ +Cfg->Get("test.http.timeout",-1); + if ($nto>0) $timeout=$nto; // use NATS timeout + } + } + if ($timeout>0) // use the set timeout + $oldtimeout=ini_set("default_socket_timeout",$timeout); + + $timer->Start(); + + if (function_exists("curl_getinfo")) // use CURL if present + { + $ch=curl_init(); + curl_setopt($ch,CURLOPT_URL,$url); + curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); + curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,0); + curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,0); + curl_setopt($ch,CURLOPT_HEADER,1); + if ($timeout>0) curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout); + if ($timeout>0) curl_setopt($ch,CURLOPT_TIMEOUT,$timeout); + if (!$output=curl_exec($ch)) + { + $ctr=-1; // failed + } + else $ctr=round(curl_getinfo($ch,CURLINFO_SIZE_DOWNLOAD)/1024,2); + curl_close($ch); + + if ($ctr==0) $ctr="0.0001"; + + } + else + { // no CURL - use fopen() + $fp=@fopen($url,"r"); + if ($fp<=0) + { + if ($timeout>0) ini_set("default_socket_timeout",$oldtimeout); + return -1; + } + $ctr=0; + while ($output.=@fgets($fp,1024)) $ctr+=sizeof($body); + @fclose($fp); + } + + if ($ctr<0) return $ctr; // negative number (-1) failed to open + + $elapsed=$timer->Stop(); + + if ($timeout>0) ini_set("default_socket_timeout",$oldtimeout); + + // now to check the actual text + if (is_array($text)) + { + foreach($text as $findthis) + { + if ($findthis!="") + if (strpos($output,$findthis)===false) return -2; // text to be found not found + } + } + if (is_array($notext)) + { + foreach($notext as $donotfindthis) + { + if ($donotfindthis!="") + if (strpos($output,$donotfindthis)!==false) return -3; // text not to find found + } + } + + return $elapsed; + } + + +global $NATS; + +class Advanced_Pagecheck_Test extends FreeNATS_Local_Test +{ + + function DoTest($testname,$param,$hostname,$timeout,$params) + { + /* parameters: -- sadly very messy but to do otherwise would break plug+play + 0: url + 1: text + 4: notext + 2: user + 3: pass + + 5: text + 6: text + 7: notext + 8: notext + 9: NULL + */ + $text=array( $params[1], $params[5], $params[6] ); + $notext=array( $params[4], $params[7], $params[8] ); + + $result=extended_page_checker($params[0],$text,$notext,$params[2],$params[3],$timeout); + return $result; + } + + function Evaluate($result) + { + if ($result>0) return 0; // FreeNATS passed (0) flag if > 0 + return 2; // FreeNATS failed (2) flag ( <= 0 ) + } + + function ProtectOutput(&$test) + { + $test['testparam3']=""; // blank password for output + return true; + } + + function DisplayForm(&$test) + { + $out=""; + $out.=""; + $out.=""; + $out.=""; + $out.=""; + $out.=""; + $out.=""; + $out.=""; + + $out.=""; + $out.=""; + + $out.=""; + $out.=""; + echo $out; // output the buffer + } +} + +// Now we have defined the class we must register it with FreeNATS + +$params=array(); // blank parameters array as we have implemented DisplayForm above + +$NATS->Tests->Register( + "advpagecheck", // the internal simple test name (must not conflict with anything else) + "Advanced_Pagecheck_Test", // the class name (above) + $params, // parameters (blank for now) + "Web Content Test", // the display name of the test in the interface + 3, // the revision number of the test + "Advanced Page Checker"); // extended description for the test module used in overview + +?> diff --git a/src/server/extras/tests/dynamic_dns_test.php b/src/server/extras/tests/dynamic_dns_test.php new file mode 100755 index 0000000..865007a --- /dev/null +++ b/src/server/extras/tests/dynamic_dns_test.php @@ -0,0 +1,160 @@ +0) return 0; // FreeNATS passed (0) flag if > 0 + return 2; // FreeNATS failed (2) flag ( <= 0 ) + } + + function ProtectOutput(&$test) + { + $test['testparam3']=""; // blank password for output + return true; + } + + function DisplayForm(&$test) + { + $out=""; + $out.="
URL :"; + $out.=""; + $out.="
Fully-qualified URL including http://"; + $out.="
Strings :"; + $out.="
"; + $out.="
"; + $out.=""; + $out.="
String(s) to search for - all defined must
be found for the test to pass
"; + $out.="Blank strings are ignored.
"; + $out.="
No Strings :"; + $out.="
"; + $out.="
"; + $out.=""; + $out.="
String(s) to NOT find - fails if any are present
Leave blank to not use this portion of the test
"; + $out.="
Username :"; + $out.=""; + $out.="
Specify to use HTTP-AUTH on the URL"; + $out.="
Password :"; + $out.=""; // dont display it + $out.=""; // don't update testparam3 (if blank) + $out.="
Enter a new password to set or... "; + $out.=" "; // clears testparam3 if set + $out.="clear it"; + $out.="
"; + $out.=""; + $out.=""; + $out.=""; + $out.=""; + $out.="
Hostname:"; + $out.=""; + $out.="
Dynamic DNS Hostname to Check (i.e. myhost.dyndns.org)"; + $out.="
IP:"; + $out.="
"; + $out.="This setting tells FreeNATS where to get your external IP from. You can either use "; + $out.="the PurplePixie XML App gateway or put in your own URL. The URL must return a plain IP."; + $out.="
"; + echo $out; // output the buffer + } +} + +// Now we have defined the class we must register it with FreeNATS + +$params=array(); // blank parameters array as we have implemented DisplayForm above + +$NATS->Tests->Register( + "dynamicdns", // the internal simple test name (must not conflict with anything else) + "Dynamic_DNS_Test", // the class name (above) + $params, // parameters (blank for now) + "Dynamic DNS Test", // the display name of the test in the interface + 1, // the revision number of the test + "Check Dyanamic DNS Host Against External IP"); // extended description for the test module used in overview + +?> diff --git a/src/server/test/.htaccess b/src/server/test/.htaccess new file mode 100755 index 0000000..ff2beb8 --- /dev/null +++ b/src/server/test/.htaccess @@ -0,0 +1,2 @@ +order deny,allow +deny from all diff --git a/src/server/test/curl.sh b/src/server/test/curl.sh new file mode 100755 index 0000000..87581cd --- /dev/null +++ b/src/server/test/curl.sh @@ -0,0 +1,65 @@ +#!/usr/bin/php -q +Start(); +passthru($cmd); +$curl=$timer->Stop(); +echo "\n"; +echo "FN Timer : ".$curl." (".($curl*1000)." ms)\n\n"; + +$timer->Start(); +$wtime=DoTest("wtime",$argv[1]); +$wtimer=$timer->Stop(); +echo "WTime : ".$wtime."\n"; +echo "Timer : ".$wtimer."\n"; +echo "\n"; + + +$timer->Start(); +$ch=curl_init(); +curl_setopt($ch,CURLOPT_URL,$argv[1]); +curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); +curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,0); +curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,0); +if (!$output=curl_exec($ch)) + { + echo "CURL Error\n"; + $size=0; + } +else $size=curl_getinfo($ch,CURLINFO_SIZE_DOWNLOAD); +curl_close($ch); +$curltime=$timer->Stop(); + +echo "PHP CURL : ".$curltime."\n"; +echo "Size : ".$size."\n"; +echo "\n"; + +$timer->Start(); +$fp=fopen($argv[1],"r") + or die("fopen failed"); +$fopen=$timer->Stop(); +while (!feof($fp)) + { + $s=fgets($fp,1024); + } +$fgets=$timer->Stop(); +fclose($fp); + +echo "fopen : ".$fopen."\n"; +echo "fopen Tot : ".$fgets."\n"; +echo "\n"; + +?> diff --git a/src/server/test/curl.txt b/src/server/test/curl.txt new file mode 100755 index 0000000..79f867a --- /dev/null +++ b/src/server/test/curl.txt @@ -0,0 +1,791 @@ + + + + + +Welcome to Demon.net + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + +
+ + + + + + + + +
+
About usContact usSite help
+
Quick links
+
+
+
+
+ Search this site
+ +
+
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Faster Demon Business Broadband solutions
+
+ + + + + + + + + + + + +
+ + +

Business Broadband

+
+ +

+Utilise the enhanced speeds and lower contention ratios offered as part of our business broadband range. +


+ + + Special offer available
+ From £34.00 a month
exc VAT
+ + +
+ + More info  + + + Buy now +
+
+ + + +
+ +

Home/HomeOffice Broadband

+
+
+
+ Our Home/HomeOffice products now support speeds of up to 8Mbps. They are tailored to meet the needs of both small businesses and professionals working from home.
+
+ + Free set up and router
+ From £17.99 a month inc VAT

+
+ + More info  + + Buy now +
+ + + +
+ +
+

Help and Support

+ + + + + +
helpsupportbutton
+
+Visit our support pages to get your questions answered +and your problems solved. Whatever your enquiry, there will be an FAQ or tutorial to help.

+ +
+
+

My Broadband Order Status

+ + + + +
+
Demon Order Status - image
+
+Our new online tracking tool is now live. We have improved your ability to track the status of your broadband order. +

+
+ +
+ +
+ + + +
+ +
+

Customer Satisfaction Survey

+

+Win an iPod!
+Your feedback is important to us. Please spare a few minutes to fill in our customer satisfaction survey so that we can continue to improve our service to you. +

+ +
+
+

Move to Demon Broadband

+ +

+If you have broadband lines with another provider, click here to take advantage of our great offer when you switch to Demon Business 8000. +


+

+ +
+ + + + + +
+ + + + + + + + + + + + +
+ + +

+Find out more about our Demon Voice over Broadband products - cut the cost of your calls
+

+ + + + + +

 BlackBerry Launch

+

Find out how our BlackBerry can keep you connected.

+

Find out more

+

*

+ + + + + + + +

 Online payment

+

For a simple and secure way to make a payment to Demon.

+

Click here

+

*

+ + + + + + + + + +

 Demon Weblog

+

Our point of view on hot industry issues.

+

Read More Here

+

*

+ + + + + + + + + +

 Text Chat

+

Chat online with our Customer Service or Product Advisors.

+

Find out more

+

*

+ + +
+ + + + + + + + + + + + + + + + +



+ +
+
+ * +
+ + + + + + + + + + + + + + + + + + + +
+ + +
+
+ + + + + + + + + + + + + + + diff --git a/src/server/test/imap.sh b/src/server/test/imap.sh new file mode 100755 index 0000000..206928b --- /dev/null +++ b/src/server/test/imap.sh @@ -0,0 +1,36 @@ +#!/usr/bin/php -q +4) $prot=$argv[4]; +if ($argc>5) $port=$argv[5]; +if ($argc>6) $ssl=true; + +echo "Host: ".$argv[1]."\n"; +echo "User: ".$argv[2]."\n"; +echo "Prot: ".$prot."\n"; +echo "Port: ".$port."\n"; +echo "SSL : "; +if ($ssl) echo "Yes"; +else echo "No"; +echo "\n\nConnection Test\n"; + +$r=imap_test_connect($argv[1],$argv[2],$argv[3],10,$prot,$port,$ssl,true); + +echo "Result: ".$r."\n"; + +echo "\nConnection Timer\n"; + +$r=imap_test_time($argv[1],$argv[2],$argv[3],10,$prot,$port,$ssl,true); + +echo "Result: ".$r."\n"; +?> diff --git a/src/server/test/ip_lookup.sh b/src/server/test/ip_lookup.sh new file mode 100755 index 0000000..6b963b6 --- /dev/null +++ b/src/server/test/ip_lookup.sh @@ -0,0 +1,15 @@ +#!/usr/bin/php -q + "; +echo ip_lookup($argv[1]); +echo "\n"; + + +?> diff --git a/src/server/test/mysql.sh b/src/server/test/mysql.sh new file mode 100755 index 0000000..0b228b2 --- /dev/null +++ b/src/server/test/mysql.sh @@ -0,0 +1,35 @@ +#!/usr/bin/php -q +4) $database=$argv[4]; +if ($argc>5) $query=$argv[5]; +if ($argc>6) $timeout=$argv[6]; + +echo "Host: ".$argv[1]."\n"; +echo "User: ".$argv[2]."\n"; +echo "DB : ".$database."\n"; +echo "Qry : ".$query."\n"; +echo "Time: ".$timeout."s\n"; + +echo "\nRows Test:\n"; + +$res=mysql_test_rows($argv[1],$argv[2],$argv[3],$database,$timeout,$query,true); + +echo "\nResult: ".$res."\n"; + +echo "\nTimer Test:\n"; + +$time=mysql_test_time($argv[1],$argv[2],$argv[3],$database,$timeout,$query,true); + +echo "\nResult: ".$time."\n"; +?> diff --git a/src/server/test/phpmailer_test.php b/src/server/test/phpmailer_test.php new file mode 100755 index 0000000..22d6f42 --- /dev/null +++ b/src/server/test/phpmailer_test.php @@ -0,0 +1,572 @@ +TestCase( $name ); + } + + /** + * Run before each test is started. + */ + function setUp() { + global $global_vars; + global $INCLUDE_DIR; + + $this->Mail = new PHPMailer(); + + $this->Mail->Priority = 3; + $this->Mail->Encoding = "8bit"; + $this->Mail->CharSet = "iso-8859-1"; + $this->Mail->From = "unit_test@phpmailer.sf.net"; + $this->Mail->FromName = "Unit Tester"; + $this->Mail->Sender = ""; + $this->Mail->Subject = "Unit Test"; + $this->Mail->Body = ""; + $this->Mail->AltBody = ""; + $this->Mail->WordWrap = 0; + $this->Mail->Host = $global_vars["mail_host"]; + $this->Mail->Port = 25; + $this->Mail->Helo = "localhost.localdomain"; + $this->Mail->SMTPAuth = false; + $this->Mail->Username = ""; + $this->Mail->Password = ""; + $this->Mail->PluginDir = $INCLUDE_DIR; + $this->Mail->AddReplyTo("no_reply@phpmailer.sf.net", "Reply Guy"); + $this->Mail->Sender = "unit_test@phpmailer.sf.net"; + + if(strlen($this->Mail->Host) > 0) + $this->Mail->Mailer = "smtp"; + else + { + $this->Mail->Mailer = "mail"; + $this->Sender = "unit_test@phpmailer.sf.net"; + } + + global $global_vars; + $this->SetAddress($global_vars["mail_to"], "Test User"); + if(strlen($global_vars["mail_cc"]) > 0) + $this->SetAddress($global_vars["mail_cc"], "Carbon User", "cc"); + } + + /** + * Run after each test is completed. + */ + function tearDown() { + // Clean global variables + $this->Mail = NULL; + $this->ChangeLog = array(); + $this->NoteLog = array(); + } + + + /** + * Build the body of the message in the appropriate format. + * @private + * @returns void + */ + function BuildBody() { + $this->CheckChanges(); + + // Determine line endings for message + if($this->Mail->ContentType == "text/html" || strlen($this->Mail->AltBody) > 0) + { + $eol = "
"; + $bullet = "
  • "; + $bullet_start = "
      "; + $bullet_end = "
    "; + } + else + { + $eol = "\n"; + $bullet = " - "; + $bullet_start = ""; + $bullet_end = ""; + } + + $ReportBody = ""; + + $ReportBody .= "---------------------" . $eol; + $ReportBody .= "Unit Test Information" . $eol; + $ReportBody .= "---------------------" . $eol; + $ReportBody .= "phpmailer version: " . $this->Mail->Version . $eol; + $ReportBody .= "Content Type: " . $this->Mail->ContentType . $eol; + + if(strlen($this->Mail->Host) > 0) + $ReportBody .= "Host: " . $this->Mail->Host . $eol; + + // If attachments then create an attachment list + if(count($this->Mail->attachment) > 0) + { + $ReportBody .= "Attachments:" . $eol; + $ReportBody .= $bullet_start; + for($i = 0; $i < count($this->Mail->attachment); $i++) + { + $ReportBody .= $bullet . "Name: " . $this->Mail->attachment[$i][1] . ", "; + $ReportBody .= "Encoding: " . $this->Mail->attachment[$i][3] . ", "; + $ReportBody .= "Type: " . $this->Mail->attachment[$i][4] . $eol; + } + $ReportBody .= $bullet_end . $eol; + } + + // If there are changes then list them + if(count($this->ChangeLog) > 0) + { + $ReportBody .= "Changes" . $eol; + $ReportBody .= "-------" . $eol; + + $ReportBody .= $bullet_start; + for($i = 0; $i < count($this->ChangeLog); $i++) + { + $ReportBody .= $bullet . $this->ChangeLog[$i][0] . " was changed to [" . + $this->ChangeLog[$i][1] . "]" . $eol; + } + $ReportBody .= $bullet_end . $eol . $eol; + } + + // If there are notes then list them + if(count($this->NoteLog) > 0) + { + $ReportBody .= "Notes" . $eol; + $ReportBody .= "-----" . $eol; + + $ReportBody .= $bullet_start; + for($i = 0; $i < count($this->NoteLog); $i++) + { + $ReportBody .= $bullet . $this->NoteLog[$i] . $eol; + } + $ReportBody .= $bullet_end; + } + + // Re-attach the original body + $this->Mail->Body .= $eol . $eol . $ReportBody; + } + + /** + * Check which default settings have been changed for the report. + * @private + * @returns void + */ + function CheckChanges() { + if($this->Mail->Priority != 3) + $this->AddChange("Priority", $this->Mail->Priority); + if($this->Mail->Encoding != "8bit") + $this->AddChange("Encoding", $this->Mail->Encoding); + if($this->Mail->CharSet != "iso-8859-1") + $this->AddChange("CharSet", $this->Mail->CharSet); + if($this->Mail->Sender != "") + $this->AddChange("Sender", $this->Mail->Sender); + if($this->Mail->WordWrap != 0) + $this->AddChange("WordWrap", $this->Mail->WordWrap); + if($this->Mail->Mailer != "mail") + $this->AddChange("Mailer", $this->Mail->Mailer); + if($this->Mail->Port != 25) + $this->AddChange("Port", $this->Mail->Port); + if($this->Mail->Helo != "localhost.localdomain") + $this->AddChange("Helo", $this->Mail->Helo); + if($this->Mail->SMTPAuth) + $this->AddChange("SMTPAuth", "true"); + } + + /** + * Adds a change entry. + * @private + * @returns void + */ + function AddChange($sName, $sNewValue) { + $cur = count($this->ChangeLog); + $this->ChangeLog[$cur][0] = $sName; + $this->ChangeLog[$cur][1] = $sNewValue; + } + + /** + * Adds a simple note to the message. + * @public + * @returns void + */ + function AddNote($sValue) { + $this->NoteLog[] = $sValue; + } + + /** + * Adds all of the addresses + * @public + * @returns void + */ + function SetAddress($sAddress, $sName = "", $sType = "to") { + switch($sType) + { + case "to": + $this->Mail->AddAddress($sAddress, $sName); + break; + case "cc": + $this->Mail->AddCC($sAddress, $sName); + break; + case "bcc": + $this->Mail->AddBCC($sAddress, $sName); + break; + } + } + + ///////////////////////////////////////////////// + // UNIT TESTS + ///////////////////////////////////////////////// + + /** + * Try a plain message. + */ + function test_WordWrap() { + + $this->Mail->WordWrap = 40; + $my_body = "Here is the main body of this message. It should " . + "be quite a few lines. It should be wrapped at the " . + "40 characters. Make sure that it is."; + $nBodyLen = strlen($my_body); + $my_body .= "\n\nThis is the above body length: " . $nBodyLen; + + $this->Mail->Body = $my_body; + $this->Mail->Subject .= ": Wordwrap"; + + $this->BuildBody(); + $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo); + } + + /** + * Try a plain message. + */ + function test_Low_Priority() { + + $this->Mail->Priority = 5; + $this->Mail->Body = "Here is the main body. There should be " . + "a reply to address in this message."; + $this->Mail->Subject .= ": Low Priority"; + $this->Mail->AddReplyTo("nobody@nobody.com", "Nobody (Unit Test)"); + + $this->BuildBody(); + $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo); + } + + /** + * Simple plain file attachment test. + */ + function test_Multiple_Plain_FileAttachment() { + + $this->Mail->Body = "Here is the text body"; + $this->Mail->Subject .= ": Plain + Multiple FileAttachments"; + + if(!$this->Mail->AddAttachment("test.png")) + { + $this->assert(false, $this->Mail->ErrorInfo); + return; + } + + if(!$this->Mail->AddAttachment("phpmailer_test.php", "test.txt")) + { + $this->assert(false, $this->Mail->ErrorInfo); + return; + } + + $this->BuildBody(); + $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo); + } + + /** + * Simple plain string attachment test. + */ + function test_Plain_StringAttachment() { + + $this->Mail->Body = "Here is the text body"; + $this->Mail->Subject .= ": Plain + StringAttachment"; + + $sAttachment = "These characters are the content of the " . + "string attachment.\nThis might be taken from a ". + "database or some other such thing. "; + + $this->Mail->AddStringAttachment($sAttachment, "string_attach.txt"); + + $this->BuildBody(); + $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo); + } + + /** + * Plain quoted-printable message. + */ + function test_Quoted_Printable() { + + $this->Mail->Body = "Here is the main body"; + $this->Mail->Subject .= ": Plain + Quoted-printable"; + $this->Mail->Encoding = "quoted-printable"; + + $this->BuildBody(); + $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo); + } + + /** + * Try a plain message. + */ + function test_Html() { + + $this->Mail->IsHTML(true); + $this->Mail->Subject .= ": HTML only"; + + $this->Mail->Body = "This is a test message written in HTML.
    " . + "Go to " . + "http://phpmailer.sourceforge.net/ for new versions of " . + "phpmailer.

    Thank you!"; + + $this->BuildBody(); + $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo); + } + + /** + * Simple HTML and attachment test + */ + function test_HTML_Attachment() { + + $this->Mail->Body = "This is the HTML part of the email."; + $this->Mail->Subject .= ": HTML + Attachment"; + $this->Mail->IsHTML(true); + + if(!$this->Mail->AddAttachment("phpmailer_test.php", "test_attach.txt")) + { + $this->assert(false, $this->Mail->ErrorInfo); + return; + } + + $this->BuildBody(); + $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo); + } + + /** + * An embedded attachment test. + */ + function test_Embedded_Image() { + + $this->Mail->Body = "Embedded Image: \"phpmailer\"" . + "Here is an image!"; + $this->Mail->Subject .= ": Embedded Image"; + $this->Mail->IsHTML(true); + + if(!$this->Mail->AddEmbeddedImage("test.png", "my-attach", "test.png", + "base64", "image/png")) + { + $this->assert(false, $this->Mail->ErrorInfo); + return; + } + + $this->BuildBody(); + $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo); + } + + /** + * An embedded attachment test. + */ + function test_Multi_Embedded_Image() { + + $this->Mail->Body = "Embedded Image: \"phpmailer\"" . + "Here is an image!"; + $this->Mail->Subject .= ": Embedded Image + Attachment"; + $this->Mail->IsHTML(true); + + if(!$this->Mail->AddEmbeddedImage("test.png", "my-attach", "test.png", + "base64", "image/png")) + { + $this->assert(false, $this->Mail->ErrorInfo); + return; + } + + if(!$this->Mail->AddAttachment("phpmailer_test.php", "test.txt")) + { + $this->assert(false, $this->Mail->ErrorInfo); + return; + } + + $this->BuildBody(); + $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo); + } + + /** + * Simple multipart/alternative test. + */ + function test_AltBody() { + + $this->Mail->Body = "This is the HTML part of the email."; + $this->Mail->AltBody = "Here is the text body of this message. " . + "It should be quite a few lines. It should be wrapped at the " . + "40 characters. Make sure that it is."; + $this->Mail->WordWrap = 40; + $this->AddNote("This is a mulipart alternative email"); + $this->Mail->Subject .= ": AltBody + Word Wrap"; + + $this->BuildBody(); + $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo); + } + + /** + * Simple HTML and attachment test + */ + function test_AltBody_Attachment() { + + $this->Mail->Body = "This is the HTML part of the email."; + $this->Mail->AltBody = "This is the text part of the email."; + $this->Mail->Subject .= ": AltBody + Attachment"; + $this->Mail->IsHTML(true); + + if(!$this->Mail->AddAttachment("phpmailer_test.php", "test_attach.txt")) + { + $this->assert(false, $this->Mail->ErrorInfo); + return; + } + + $this->BuildBody(); + $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo); + + $fp = fopen("message.txt", "w"); + fwrite($fp, $this->Mail->CreateHeader() . $this->Mail->CreateBody()); + fclose($fp); + } + + function test_MultipleSend() { + $this->Mail->Body = "Sending two messages without keepalive"; + $this->BuildBody(); + $subject = $this->Mail->Subject; + + $this->Mail->Subject = $subject . ": SMTP 1"; + $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo); + + $this->Mail->Subject = $subject . ": SMTP 2"; + $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo); + } + + function test_SmtpKeepAlive() { + $this->Mail->Body = "This was done using the SMTP keep-alive."; + $this->BuildBody(); + $subject = $this->Mail->Subject; + + $this->Mail->SMTPKeepAlive = true; + $this->Mail->Subject = $subject . ": SMTP keep-alive 1"; + $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo); + + $this->Mail->Subject = $subject . ": SMTP keep-alive 2"; + $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo); + $this->Mail->SmtpClose(); + } + + /** + * Tests this denial of service attack: + * http://www.cybsec.com/vuln/PHPMailer-DOS.pdf + */ + function test_DenialOfServiceAttack() { + $this->Mail->Body = "This should no longer cause a denial of service."; + $this->BuildBody(); + + $this->Mail->Subject = str_repeat("A", 998); + $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo); + } + + function test_Error() { + $this->Mail->Subject .= ": This should be sent"; + $this->BuildBody(); + $this->Mail->ClearAllRecipients(); // no addresses should cause an error + $this->assert($this->Mail->IsError() == false, "Error found"); + $this->assert($this->Mail->Send() == false, "Send succeeded"); + $this->assert($this->Mail->IsError(), "No error found"); + $this->assertEquals('You must provide at least one ' . + 'recipient email address.', $this->Mail->ErrorInfo); + $this->Mail->AddAddress(get("mail_to")); + $this->assert($this->Mail->Send(), "Send failed"); + } +} + +/** + * Create and run test instance. + */ + +if(isset($HTTP_GET_VARS)) + $global_vars = $HTTP_GET_VARS; +else + $global_vars = $_REQUEST; + +if(isset($global_vars["submitted"])) +{ + echo "Test results:
    "; + $suite = new TestSuite( "phpmailerTest" ); + + $testRunner = new TestRunner; + $testRunner->run($suite); + echo "


    "; +} + +function get($sName) { + global $global_vars; + if(isset($global_vars[$sName])) + return $global_vars[$sName]; + else + return ""; +} + +?> + + + +

    phpmailer Unit Test

    +By entering a SMTP hostname it will automatically perform tests with SMTP. + +
    + +To Address: "/> +
    +Cc Address: "/> +
    +SMTP Hostname: "/> +

    + + +

    + + diff --git a/src/server/test/phpunit.php b/src/server/test/phpunit.php new file mode 100755 index 0000000..1d50868 --- /dev/null +++ b/src/server/test/phpunit.php @@ -0,0 +1,376 @@ + +// OntoSys, Inc +// +// $Id: phpunit.php,v 1.1 2002/03/30 19:32:17 bmatzelle Exp $ + +// Copyright (c) 2000 Fred Yankowski + +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, copy, +// modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS +// BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. +// +error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE | + E_CORE_ERROR | E_CORE_WARNING); + +/* +interface Test { + function run(&$aTestResult); + function countTestCases(); +} +*/ + +function trace($msg) { + return; + print($msg); + flush(); +} + + +class Exception { + /* Emulate a Java exception, sort of... */ + var $message; + function Exception($message) { + $this->message = $message; + } + function getMessage() { + return $this->message; + } +} + +class Assert { + function assert($boolean, $message=0) { + if (! $boolean) + $this->fail($message); + } + + function assertEquals($expected, $actual, $message=0) { + if ($expected != $actual) { + $this->failNotEquals($expected, $actual, "expected", $message); + } + } + + function assertRegexp($regexp, $actual, $message=false) { + if (! preg_match($regexp, $actual)) { + $this->failNotEquals($regexp, $actual, "pattern", $message); + } + } + + function failNotEquals($expected, $actual, $expected_label, $message=0) { + // Private function for reporting failure to match. + $str = $message ? ($message . ' ') : ''; + $str .= "($expected_label/actual)
    "; + $htmlExpected = htmlspecialchars($expected); + $htmlActual = htmlspecialchars($actual); + $str .= sprintf("
    %s\n--------\n%s
    ", + $htmlExpected, $htmlActual); + $this->fail($str); + } +} + +class TestCase extends Assert /* implements Test */ { + /* Defines context for running tests. Specific context -- such as + instance variables, global variables, global state -- is defined + by creating a subclass that specializes the setUp() and + tearDown() methods. A specific test is defined by a subclass + that specializes the runTest() method. */ + var $fName; + var $fResult; + var $fExceptions = array(); + + function TestCase($name) { + $this->fName = $name; + } + + function run($testResult=0) { + /* Run this single test, by calling the run() method of the + TestResult object which will in turn call the runBare() method + of this object. That complication allows the TestResult object + to do various kinds of progress reporting as it invokes each + test. Create/obtain a TestResult object if none was passed in. + Note that if a TestResult object was passed in, it must be by + reference. */ + if (! $testResult) + $testResult = $this->_createResult(); + $this->fResult = $testResult; + $testResult->run(&$this); + $this->fResult = 0; + return $testResult; + } + + function countTestCases() { + return 1; + } + + function runTest() { + $name = $this->name(); + // Since isset($this->$name) is false, no way to run defensive checks + $this->$name(); + } + + function setUp() /* expect override */ { + //print("TestCase::setUp()
    \n"); + } + + function tearDown() /* possible override */ { + //print("TestCase::tearDown()
    \n"); + } + + //////////////////////////////////////////////////////////////// + + + function _createResult() /* protected */ { + /* override this to use specialized subclass of TestResult */ + return new TestResult; + } + + function fail($message=0) { + //printf("TestCase::fail(%s)
    \n", ($message) ? $message : ''); + /* JUnit throws AssertionFailedError here. We just record the + failure and carry on */ + $this->fExceptions[] = new Exception(&$message); + } + + function error($message) { + /* report error that requires correction in the test script + itself, or (heaven forbid) in this testing infrastructure */ + printf('ERROR: ' . $message . '
    '); + $this->fResult->stop(); + } + + function failed() { + return count($this->fExceptions); + } + + function getExceptions() { + return $this->fExceptions; + } + + function name() { + return $this->fName; + } + + function runBare() { + $this->setup(); + $this->runTest(); + $this->tearDown(); + } +} + + +class TestSuite /* implements Test */ { + /* Compose a set of Tests (instances of TestCase or TestSuite), and + run them all. */ + var $fTests = array(); + + function TestSuite($classname=false) { + if ($classname) { + // Find all methods of the given class whose name starts with + // "test" and add them to the test suite. We are just _barely_ + // able to do this with PHP's limited introspection... Note + // that PHP seems to store method names in lower case, and we + // have to avoid the constructor function for the TestCase class + // superclass. This will fail when $classname starts with + // "Test" since that will have a constructor method that will + // get matched below and then treated (incorrectly) as a test + // method. So don't name any TestCase subclasses as "Test..."! + if (floor(phpversion()) >= 4) { + // PHP4 introspection, submitted by Dylan Kuhn + $names = get_class_methods($classname); + while (list($key, $method) = each($names)) { + if (preg_match('/^test/', $method) && $method != "testcase") { + $this->addTest(new $classname($method)); + } + } + } + else { + $dummy = new $classname("dummy"); + $names = (array) $dummy; + while (list($key, $value) = each($names)) { + $type = gettype($value); + if ($type == "user function" && preg_match('/^test/', $key) + && $key != "testcase") { + $this->addTest(new $classname($key)); + } + } + } + } + } + + function addTest($test) { + /* Add TestCase or TestSuite to this TestSuite */ + $this->fTests[] = $test; + } + + function run(&$testResult) { + /* Run all TestCases and TestSuites comprising this TestSuite, + accumulating results in the given TestResult object. */ + reset($this->fTests); + while (list($na, $test) = each($this->fTests)) { + if ($testResult->shouldStop()) + break; + $test->run(&$testResult); + } + } + + function countTestCases() { + /* Number of TestCases comprising this TestSuite (including those + in any constituent TestSuites) */ + $count = 0; + reset($fTests); + while (list($na, $test_case) = each($this->fTests)) { + $count += $test_case->countTestCases(); + } + return $count; + } +} + + +class TestFailure { + /* Record failure of a single TestCase, associating it with the + exception(s) that occurred */ + var $fFailedTestName; + var $fExceptions; + + function TestFailure(&$test, &$exceptions) { + $this->fFailedTestName = $test->name(); + $this->fExceptions = $exceptions; + } + + function getExceptions() { + return $this->fExceptions; + } + function getTestName() { + return $this->fFailedTestName; + } +} + + +class TestResult { + /* Collect the results of running a set of TestCases. */ + var $fFailures = array(); + var $fRunTests = 0; + var $fStop = false; + + function TestResult() { } + + function _endTest($test) /* protected */ { + /* specialize this for end-of-test action, such as progress + reports */ + } + + function getFailures() { + return $this->fFailures; + } + + function run($test) { + /* Run a single TestCase in the context of this TestResult */ + $this->_startTest($test); + $this->fRunTests++; + + $test->runBare(); + + /* this is where JUnit would catch AssertionFailedError */ + $exceptions = $test->getExceptions(); + if ($exceptions) + $this->fFailures[] = new TestFailure(&$test, &$exceptions); + $this->_endTest($test); + } + + function countTests() { + return $this->fRunTests; + } + + function shouldStop() { + return $this->fStop; + } + + function _startTest($test) /* protected */ { + /* specialize this for start-of-test actions */ + } + + function stop() { + /* set indication that the test sequence should halt */ + $fStop = true; + } + + function countFailures() { + return count($this->fFailures); + } +} + + +class TextTestResult extends TestResult { + /* Specialize TestResult to produce text/html report */ + function TextTestResult() { + $this->TestResult(); // call superclass constructor + } + + function report() { + /* report result of test run */ + $nRun = $this->countTests(); + $nFailures = $this->countFailures(); + printf("

    %s test%s run
    ", $nRun, ($nRun == 1) ? '' : 's'); + printf("%s failure%s.
    \n", $nFailures, ($nFailures == 1) ? '' : 's'); + if ($nFailures == 0) + return; + + print("

      \n"); + $failures = $this->getFailures(); + while (list($i, $failure) = each($failures)) { + $failedTestName = $failure->getTestName(); + printf("
    1. %s\n", $failedTestName); + + $exceptions = $failure->getExceptions(); + print("
        "); + while (list($na, $exception) = each($exceptions)) + printf("
      • %s\n", $exception->getMessage()); + print("
      "); + } + print("
    \n"); + } + + function _startTest($test) { + printf("%s ", $test->name()); + flush(); + } + + function _endTest($test) { + $outcome = $test->failed() + ? "FAIL" + : "ok"; + printf("$outcome
    \n"); + flush(); + } +} + + +class TestRunner { + /* Run a suite of tests and report results. */ + function run($suite) { + $result = new TextTestResult; + $suite->run($result); + $result->report(); + } +} + +?> diff --git a/src/server/test/ping.sh b/src/server/test/ping.sh new file mode 100755 index 0000000..2c90ae9 --- /dev/null +++ b/src/server/test/ping.sh @@ -0,0 +1,19 @@ +#!/usr/bin/php -q + diff --git a/src/server/test/smtp.sh b/src/server/test/smtp.sh new file mode 100755 index 0000000..373b2ba --- /dev/null +++ b/src/server/test/smtp.sh @@ -0,0 +1,20 @@ +#!/usr/bin/php -q + diff --git a/src/server/test/standalone/wspeed.sh b/src/server/test/standalone/wspeed.sh new file mode 100755 index 0000000..c3b666b --- /dev/null +++ b/src/server/test/standalone/wspeed.sh @@ -0,0 +1,86 @@ +#!/usr/bin/php -q +4) ) + { + echo "FreeNATS wspeed.sh Debug Checker\n"; + echo "Usage: wspeed.sh URI iterations [delay]\n"; + echo "Example: wspeed.sh http://www.google.co.uk/ 100 60\n"; + echo " - get google 100 times with a 60 second sleep each time\n"; + echo "(default delay is 60 seconds if not specified)\n\n"; + exit(); + } + +$uri=$argv[1]; +$count=$argv[2]; +if ($argc>3) $delay=$argv[3]; +else $delay=60; + +function fge($fp) +{ +global $cfgQuiet,$cfgReadSize; +if ($cfgQuiet) return @fgets($fp,$cfgReadSize); +return fgets($fp,$cfgReadSize); +} + +$tries=0; +$opened=0; +$unopened=0; +$readok=0; +$readfail=0; + +echo "FreeNATS Web Speed Debug Checker - ".$uri."\n"; +echo "Iterations: ".$count." Delay: ".$delay."s\n\n"; + + +for ($i=0; $i<$count; $i++) + { + $startTime=microtime(true); + $tries++; + echo $i.". fopen: "; + if ($cfgQuiet) $fp=@fopen($uri,"r"); + else $fp=fopen($uri,"r"); + if ($fp>0) // opened ok + { + $opened++; + $size=0; + echo round(microtime(true)-$startTime,4)." "; + echo "ok, fgets: "; + while ($body=fge($fp)) + { + echo "."; + $size+=strlen($body); + } + echo " ".$size.", closing: "; + if ($size>0) $readok++; + else $readfail++; + if ($cfgQuiet) @fclose($fp); + else fclose($fp); + echo "ok"; + } + else + { + echo "FAILED"; + $unopened++; + } + echo " ".round(microtime(true)-$startTime,4); + echo "\n"; + + if ($i<($count-1)) + sleep($delay); + } + +echo "Finished.\n\n"; +echo "Tries: ".$tries."\n"; +echo $opened." Opened Ok, ".$unopened." FAILED to fopen()\n"; +echo $readok." Read Ok, ".$readfail." FAILED to fgets()\n"; +?> + diff --git a/src/server/test/test.png b/src/server/test/test.png new file mode 100755 index 0000000000000000000000000000000000000000..02de5a7aa3507dcec1e4349520ba3e8d8f7da4d6 GIT binary patch literal 1280 zcmeAS@N?(olHy`uVBq!ia0vp^tw5~K!2~4N<;e5_DVB6cUq=Rpjs4tz5?O(Kwj^(N z7lt)J7K6`}lP`c2XMsm#F#`j)5C}6~x?A@LD9B#o>FdgViCLDPN5AUi^*W$IwVp1H zAr*7p&f1@M+e+k^|GQka$^gd77pzXAva3|tw#@qU#D{GY+ZFCDwG1cEE579X#FX@$ z>FgwH&r=2B{84unZkVCiZ2N-g>I8;;hdm>XmCd=c^yvZlCI_MawKnqnCmAdw)?ZJ! z(AIo@e{`ec)BgLq2R?8-ZjY0&|8nTZLh)n#dkyMdw0?Bf?~$)c{BwaDo7B9IhZmN_ zh%E0uYH;3Pyt^=vfg$lt&fag6k0_-)7M*|G)$q*c&0lYID|HLld!D2e%F$=%SRuTY%I{2>Z{`vAZ>PV)}|}nN;w+U!QCIM z%dF3Q&h>n}=zwNb};ib(x>mdBz9tFM3#&2Z?-_RqK4ZYm+e055CrlA)a-UVpFR%v^PFVTssrYu_S`qZP4zZaccRhpt_9sylhjwpf+< z?Unnqytf|Oq_caOTOat-{V}jySM+ZLcry9!jFnfUInkZcQYhKM%L?N z&;!?rRVNa)m=6Fgxg2tDuEA9ET|#r_i?D{h*tzce28%w4!-tRgPZEBrw|%nx;k`%s zmfAYKyY+2b?$bqXn&r8-ISa3Ed-Xbga%WV_rQePT^77kD|K`Wu-}?6KQP#RWxwn}c zwyiVVWYOa4alSPF_O^E6V7L1351I46v}`n=eDeF}VulLinF~}7&9IfYQ}efLn#`@T z=<5}~4|Vgtn(q9aBQi8J`g;4eTzYtu=Z+lD zh7)#nVsqqgZL{jmKBw#CAyMYrd^hQ7_PL8!4qsoNfBW0BM@jw%&i;>o+4}Q$48E+4 clFJ|2pD+7py#+`y85}Sb4q9e08zkVlmGw# literal 0 HcmV?d00001 diff --git a/src/server/test/test.sh b/src/server/test/test.sh new file mode 100755 index 0000000..0e33b50 --- /dev/null +++ b/src/server/test/test.sh @@ -0,0 +1,17 @@ +#!/usr/bin/php -q + diff --git a/src/server/test/url_lookup.sh b/src/server/test/url_lookup.sh new file mode 100755 index 0000000..dcdc068 --- /dev/null +++ b/src/server/test/url_lookup.sh @@ -0,0 +1,16 @@ +#!/usr/bin/php -q + "; +echo url_lookup($argv[1]); +echo "\n"; + + +?> diff --git a/src/server/test/url_lookup.sh~ b/src/server/test/url_lookup.sh~ new file mode 100755 index 0000000..d013e07 --- /dev/null +++ b/src/server/test/url_lookup.sh~ @@ -0,0 +1,16 @@ +#!/usr/bin/php -q + "; +echo ip_loo url_$argv[1]); +echo "\n"; + + +?> diff --git a/src/server/web/.htaccess b/src/server/web/.htaccess new file mode 100755 index 0000000..d3947d3 --- /dev/null +++ b/src/server/web/.htaccess @@ -0,0 +1,2 @@ +order allow,deny +allow from all diff --git a/src/server/web/admin.backup.php b/src/server/web/admin.backup.php new file mode 100755 index 0000000..6a3ae6d --- /dev/null +++ b/src/server/web/admin.backup.php @@ -0,0 +1,235 @@ +Start(); +if (!$NATS_Session->Check($NATS->DB)) + { + header("Location: ./?login_msg=Invalid+Or+Expired+Session"); + exit(); + } +if ($NATS_Session->userlevel<9) UL_Error("Backup Manager"); + +if (isset($_REQUEST['action'])) + { + switch ($_REQUEST['action']) + { + case "backup": + + header("Content-type: text/sql"); + if (isset($_REQUEST['filename'])) $filename=$_REQUEST['filename']; + else $filename="freenats-".date("Ymd").".sql"; + header("Content-Disposition: attachment; filename=".$filename); + + echo "-- FreeNATS SQL Data Backup\n"; + echo "-- ".date("Y-m-d H:i:s")."\n\n"; + echo "-- Warning: Only use on FreeNATS ".$NATS->Version." or later schemas!\n\n"; + foreach($_REQUEST['table'] as $table) + { + echo "-- ".$table."\n"; + if (isset($_REQUEST['truncate_'.$table])) + echo "TRUNCATE TABLE `".$table."`;\n"; + $q="SELECT * FROM ".ss($table); + $r=$NATS->DB->Query($q); + while ($row=$NATS->DB->Fetch_Array($r)) + { + $keys=array(); + $vals=array(); + foreach($row as $key => $val) + { + if (!is_numeric($key)) + { + $keys[]=$key; + $vals[]=$val; + } + } + $uq="INSERT INTO `".$table."`("; + $first=true; + foreach($keys as $key) + { + if ($first) $first=false; + else $uq.=","; + $uq.="`".$key."`"; + } + $uq.=") VALUES("; + $first=true; + foreach($vals as $val) + { + if ($first) $first=false; + else $uq.=","; + $uq.="\"".$val."\""; + } + $uq.=");"; + echo $uq."\n"; + } + echo "\n"; + } + echo "\n-- End of Backup\n"; + ob_end_flush(); + exit(); + break; + + case "restore": + if (isset($_REQUEST['live_run'])) $live=true; + else $live=false; + Screen_Header("Restoration",1,1,"","main","admin"); + if ($live) echo "Live Data Restore...

    "; + else echo "Dummy Run - Show What Will be Done

    "; + + $data=file_get_contents($_FILES['uploadfile']['tmp_name']); + $lines=explode("\n",$data); + $errctr=0; + foreach($lines as $line) + { + $line=trim($line); + if ( ($line!="") && ($line[0]!="-") ) + { + if (!$live) echo $line."
    "; + else + { + $NATS->DB->Query($line); + if ($NATS->DB->Error()) + { + echo "
    ".$line."
    "; + echo "Error: ".$NATS->DB->Error_String()."

    "; + $errctr++; + } + else + echo "".$line."
    "; + } + + } + } + echo "

    "; + if ($live) + { + echo "Import Complete: ".$errctr." Errors
    "; + echo "Please see the detail of any errors above

    "; + echo "Click here to continue

    "; + } + else + { + echo "Dummy Import Complete

    "; + echo "Click here to continue


    "; + } + Screen_Footer(); + exit(); + break; + + default: + echo "Unknown Action

    "; + break; + } + + } + +ob_end_flush(); +Screen_Header("Backup and Restore",1,1,"","main","admin"); + +echo "
    Make a Backup

    "; +echo "
    "; +echo ""; +$q="SHOW TABLE STATUS"; +if (!isset($_REQUEST['show_all_tables'])) + { + echo "Show All Tables in Database (not just fn*)

    "; + $q.=" LIKE \"fn%\""; + } +$defs=array(); +function addt($name,$def,$desc) +{ +global $defs; +$defs[$name]=array( "def" => $def, "desc" => $desc); +} + +addt("fnalert",true,"Alert History for Nodes"); +addt("fnalertaction",true,"Alert Actions e.g. Email Lists"); +addt("fnalertlog",false,"Log Events for Alerts"); +addt("fnconfig",true,"System-Wide Configuration"); +addt("fneval",true,"Custom Test Evaluators"); +addt("fngroup",true,"Node Groups"); +addt("fngrouplink",true,"Links Nodes to Groups"); +addt("fnlocaltest",true,"Configured Local/Server Tests"); +addt("fnlog",false,"System Event Log"); +addt("fnnalink",true,"Node to Alert Action Links"); +addt("fnnode",true,"Nodes"); +addt("fnnstest",true,"Nodeside Test Configurations"); +addt("fnrecord",false,"Historic Test Information"); +addt("fnreport",true,"Saved Availability Reports"); +addt("fnscheditem",true,"Schedule Ranges"); +addt("fnschedule",true,"Test Schedules"); +addt("fnsession",false,"User Sessions"); +addt("fntestrun",false,"Historic Test Runs"); +addt("fnuser",true,"Users"); +addt("fnview",true,"Views"); +addt("fnviewitem",true,"View Items"); + +echo ""; +echo ""; +function tdc($t) +{ +echo ""; +} +tdc("Backup"); +tdc("Clear ".hlink("Backup:Truncate",12).""); +tdc("Table"); +tdc("Size"); +tdc("Description"); +echo ""; + +$count=0; +$r=$NATS->DB->Query($q); +while ($row=$NATS->DB->Fetch_Array($r)) + { + echo ""; + if (isset($defs[$row['Name']]) && ($defs[$row['Name']]['def']===true) ) + $s=" checked"; + else $s=""; + tdc(""); + tdc(""); + tdc($row['Name']); + tdc($row['Rows']." Rows, ".(round($row['Data_length']/1024,2))." KB"); + if (isset($defs[$row['Name']])) + tdc($defs[$row['Name']]['desc']); + else + tdc("Unknown"); + echo ""; + $count++; + } + +echo "
    ".$t."
    "; +echo ""; +echo "  "; +echo ""; +echo "


    "; + + +echo "Restore from Backup

    "; +echo "
    "; +echo ""; +echo "Backup File:
    "; +echo " Actually Perform Changes to Database (Live Import)"; + + +Screen_Footer(); +?> diff --git a/src/server/web/admin.dns.php b/src/server/web/admin.dns.php new file mode 100755 index 0000000..f932771 --- /dev/null +++ b/src/server/web/admin.dns.php @@ -0,0 +1,211 @@ +Start(); +if (!$NATS_Session->Check($NATS->DB)) + { + header("Location: ./?login_msg=Invalid+Or+Expired+Session"); + exit(); + } +if ($NATS_Session->userlevel<9) UL_Error("Admin DNS Console"); + +Screen_Header("DNS Console",1,1); + +echo "
    Simple DNS Query

    "; + +echo ""; + +if (isset($_REQUEST['question'])) $hostname=$_REQUEST['question']; +else $hostname=""; + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +echo "
    Get host by name : "; +echo ""; +echo "
    Get host by address : "; +echo ""; +echo "
    "; + +if (isset($_REQUEST['gethostbyname'])) + { + $result=gethostbyname($hostname); + echo "
    ".$hostname." => ".$result; + if ($result==$hostname) echo " -- Lookup Failed"; + } + +if (isset($_REQUEST['gethostbyaddr'])) + { + $result=gethostbyaddr($hostname); + echo "
    ".$hostname." => ".$result; + if ($result=="") echo " -- Lookup Failed"; + } + + +echo "

    Complex DNS Query

    "; +// ** IGNORE THIS - It's just the web form ** // +if (isset($_REQUEST['server'])) $server=$_REQUEST['server']; +else $server="127.0.0.1"; +if (isset($_REQUEST['port'])) $port=$_REQUEST['port']; +else $port=53; +if (isset($_REQUEST['timeout'])) $timeout=$_REQUEST['timeout']; +else $timeout=60; +if (isset($_REQUEST['tcp'])) $udp=false; +else $udp=true; +if (isset($_REQUEST['debug'])) $debug=true; +else $debug=false; +if (isset($_REQUEST['binarydebug'])) $binarydebug=true; +else $binarydebug=false; +if (isset($_REQUEST['extendanswer'])) $extendanswer=true; +else $extendanswer=false; +if (isset($_REQUEST['type'])) $type=$_REQUEST['type']; +else $type="A"; +if (isset($_REQUEST['question'])) $question=$_REQUEST['question']; +else $question="www.purplepixie.org"; + +echo ""; +echo ""; +echo ""; +echo ""; +echo "
    "; +echo "Query :"; +echo ""; +echo " "; +echo ""; +echo "
    "; +echo "Nameserver :"; +echo ""; +echo " "; +echo "port "; +echo "
    Options :"; + +if (!$udp) $s=" checked"; +else $s=""; +echo " Use TCP
    "; + +if ($debug) $s=" checked"; +else $s=""; +echo " Debug Data
    "; + +if ($binarydebug) $s=" checked"; +else $s=""; +echo " Binary Debug
    "; + +if ($extendanswer) $s=" checked"; +else $s=""; +echo " Show Detail
    "; +echo "
     "; +echo "
    "; +echo "
    "; + +// ** HERE IS THE QUERY SECTION ** // + +if (isset($_REQUEST['doquery'])) +{ +echo "
    ";
    +$query=new DNSQuery($server,$port,$timeout,$udp,$debug);
    +if ($binarydebug) $query->binarydebug=true;
    +
    +if ($type=="SMARTA")
    +	{
    +	echo "Smart A Lookup for ".$question."\n\n";
    +	$hostname=$query->SmartALookup($question);
    +	echo "Result: ".$hostname."\n\n";
    +	echo "
    "; + Screen_Footer(); + exit(); + } + +echo "Querying: ".$question." -t ".$type." @".$server."\n"; + +$result=$query->Query($question,$type); + +if ($query->error) + { + echo "\nQuery Error: ".$query->lasterror."\n\n"; + exit(); + } +echo "Returned ".$result->count." Answers\n\n"; + +function ShowSection($result) +{ +global $extendanswer; +for ($i=0; $i<$result->count; $i++) + { + echo $i.". "; + if ($result->results[$i]->string=="") + echo $result->results[$i]->typeid."(".$result->results[$i]->type.") => ".$result->results[$i]->data; + else echo $result->results[$i]->string; + echo "\n"; + if ($extendanswer) + { + echo " - record type = ".$result->results[$i]->typeid." (# ".$result->results[$i]->type.")\n"; + echo " - record data = ".$result->results[$i]->data."\n"; + echo " - record ttl = ".$result->results[$i]->ttl."\n"; + if (count($result->results[$i]->extras)>0) // additional data + { + foreach($result->results[$i]->extras as $key => $val) + { + echo " + ".$key." = ".$val."\n"; + } + } + } + echo "\n"; + } +} +ShowSection($result); + +if ($extendanswer) + { + echo "\nNameserver Records: ".$query->lastnameservers->count."\n"; + ShowSection($query->lastnameservers); + + echo "\nAdditional Records: ".$query->lastadditional->count."\n"; + ShowSection($query->lastadditional); + } + +echo ""; +} + + +Screen_Footer(); +?> diff --git a/src/server/web/admin.php b/src/server/web/admin.php new file mode 100755 index 0000000..21d9f8f --- /dev/null +++ b/src/server/web/admin.php @@ -0,0 +1,801 @@ +Start(); +if (!$NATS_Session->Check($NATS->DB)) + { + header("Location: ./?login_msg=Invalid+Or+Expired+Session"); + exit(); + } +if ($NATS_Session->userlevel<9) UL_Error($NATS->Lang->Item("admin.interface")); + +if (isset($_REQUEST['action'])) + { + switch($_REQUEST['action']) + { + case "save_user": + $q="UPDATE fnuser SET realname=\"".ss($_REQUEST['realname'])."\",userlevel=".ss($_REQUEST['userlevel']); + if ((isset($_REQUEST['pword']))&&($_REQUEST['pword']!="_NOTTHIS_")) $q.=",password=MD5(\"".ss($_REQUEST['pword'])."\")"; + $q.=" WHERE username=\"".ss($_REQUEST['username'])."\""; + $NATS->DB->Query($q); + if ($NATS->DB->Affected_Rows()<=0) $amsg=$NATS->Lang->Item("save.user.fail"); + else $amsg=$NATS->Lang->Item("save.user.ok"); + break; + + case "create_user": + $q="INSERT INTO fnuser(username,password,realname,userlevel) VALUES(\"".ss($_REQUEST['username'])."\","; + $q.="MD5(\"".ss($_REQUEST['pword'])."\"),\"".ss($_REQUEST['realname'])."\",".ss($_REQUEST['userlevel']).")"; + $NATS->DB->Query($q); + //echo $q; + if ($NATS->DB->Affected_Rows()<=0) $amsg=$NATS->Lang->Item("create.user.fail"); + else $amsg=$NATS->Lang->Item("create.user.ok"); + break; + + case "delete_user": + /* - disabled for 0.02.44 to allow duplicate deletion + if ($_REQUEST['username']=="admin") + { + $amsg="Can't delete the admin user"; + break; + } + */ + if (!isset($_REQUEST['confirmed'])) + { + $back=urlencode("admin.php?action=delete_user&mode=users&username=".$_REQUEST['username']."&confirmed=1"); + $url="confirm.php?action=".urlencode($NATS->Lang->Item("delete.user"))."+".$_REQUEST['username']."&back=".$back; + header("Location: ".$url); + exit(); + } + $q="DELETE FROM fnuser WHERE username=\"".ss($_REQUEST['username'])."\""; + $NATS->DB->Query($q); + $amsg=$_REQUEST['username'].$NATS->Lang->Item("user.deleted"); + break; + + case "var_save": + if ($_REQUEST['new_var']=="") // delete + { + $q="DELETE FROM fnconfig WHERE fnc_var=\"".ss($_REQUEST['orig_var'])."\""; + } + else // update + { + $q="UPDATE fnconfig SET fnc_var=\"".ss($_REQUEST['new_var'])."\",fnc_val=\"".ss($_REQUEST['new_val'])."\" "; + $q.="WHERE fnc_var=\"".ss($_REQUEST['orig_var'])."\""; + } + $NATS->DB->Query($q); + if ($NATS->DB->Affected_Rows()<=0) $amsg=$NATS->Lang->Item("save.var.fail"); + else $amsg=$NATS->Lang->Item("save.var.ok"); + break; + case "var_new": + $q="INSERT INTO fnconfig(fnc_var,fnc_val) VALUES(\"".ss($_REQUEST['new_var'])."\",\"".ss($_REQUEST['new_val'])."\")"; + //echo $q; + $NATS->DB->Query($q); + if ($NATS->DB->Affected_Rows()<=0) $amsg=$NATS->Lang->Item("new.var.fail"); + else $amsg=$NATS->Lang->Item("new.var.ok"); + break; + + case "save_aa": + $q="UPDATE fnalertaction SET "; + $q.="atype=\"".ss($_REQUEST['atype'])."\","; + $q.="ctrlimit=".ss($_REQUEST['ctrlimit']).","; + $q.="ctrtoday=".ss($_REQUEST['ctrtoday']).","; + $q.="aname=\"".ss($_REQUEST['aname'])."\","; + $q.="scheduleid=".ss($_REQUEST['scheduleid']).","; + if (isset($_REQUEST['efrom'])) $q.="efrom=\"".ss($_REQUEST['efrom'])."\","; + $q.="etolist=\"".ss($_REQUEST['etolist'])."\","; + if (isset($_REQUEST['esubject'])) $q.="esubject=".ss($_REQUEST['esubject']).","; + $q.="etype=".ss($_REQUEST['etype']); + if (isset($_REQUEST['awarnings'])) $q.=",awarnings=".ss($_REQUEST['awarnings']); + else $q.=",awarnings=0"; + if (isset($_REQUEST['adecrease'])) $q.=",adecrease=".ss($_REQUEST['adecrease']); + else $q.=",adecrease=0"; + $q.=" WHERE aaid=".ss($_REQUEST['aaid']); + //echo $q; + $NATS->DB->Query($q); + if ($NATS->DB->Affected_Rows()<=0) $NATS->Lang->Item("changes.fail"); + else $amsg=$NATS->Lang->Item("changes.ok"); + break; + + case "action_test": + $q="SELECT mdata FROM fnalertaction WHERE aaid=".ss($_REQUEST['aaid'])." LIMIT 0,1"; + $r=$NATS->DB->Query($q); + $row=$NATS->DB->Fetch_Array($r); + $oldm=$row['mdata']; + $q="UPDATE fnalertaction SET mdata=\"** ACTION TEST **\" WHERE aaid=".ss($_REQUEST['aaid']); + $NATS->DB->Query($q); + $NATS->ActionFlush(); + $q="UPDATE fnalertaction SET mdata=\"".ss($oldm)."\" WHERE aaid=".ss($_REQUEST['aaid']); + $NATS->DB->Query($q); + $amsg=$NATS->Lang->Item("aa.testflush"); + break; + + case "action_create": + $q="INSERT INTO fnalertaction(atype) VALUES(\"\")"; + $NATS->DB->Query($q); + $amsg=$NATS->Lang->Item("changes.ok"); + $_REQUEST['aaid']=$NATS->DB->Insert_Id(); + break; + + case "action_delete": + if (!isset($_REQUEST['confirmed'])) + { + $back=urlencode("admin.php?mode=alertactions&aaid_del=".$_REQUEST['aaid_del']."&action=action_delete&confirmed=1"); + $url="confirm.php?action=".urlencode($NATS->Lang->Item("aa.delete"))."&back=".$back; + header("Location: ".$url); + exit(); + } + // otherwise confirmed + $q="DELETE FROM fnalertaction WHERE aaid=".ss($_REQUEST['aaid_del']); + $NATS->DB->Query($q); + if ($NATS->DB->Affected_Rows()>0) $amsg=$NATS->Lang->Item("changes.ok"); + else $amsg=$NATS->Lang->Item("changes.fail"); + $q="DELETE FROM fnnalink WHERE aaid=".ss($_REQUEST['aaid_del']); + $NATS->DB->Query($q); + break; + + case "optimize": + $q="OPTIMIZE TABLE ".ss($_REQUEST['table']); + $NATS->DB->Query($q); + $amsg=$NATS->Lang->Item("optimised.ok")." ".$_REQUEST['table']; + break; + + } + } + +ob_end_flush(); +Screen_Header($NATS->Lang->Item("admin.interface"),1,1,"","main","admin"); + +if (isset($_REQUEST['mode'])) $mode=$_REQUEST['mode']; +else $mode=""; + +if (isset($_REQUEST['message'])) echo "
    ".$_REQUEST['message']."
    "; +if (isset($amsg)) echo "
    ".$amsg."
    "; + +echo "
    "; +if (isset($_REQUEST['updatecheck'])) + { + // check for updates + $dq="?CheckVersion=".$NATS->Version."&JSMode=1"; + $dl="http://www.purplepixie.org/freenats/download.php"; + $du=$dl.$dq; + /* old method + $cp=@fopen($du,"r"); + if ($cp>0) + { + $cs=@fgets($cp,128); + @fclose($cp); + if ($cs=="0") echo "System Up to Date
    "; + else echo "Update Available: ".$cs."
    "; + } + else echo "Error Checking for Updates
    "; + */ + echo $NATS->Lang->Item("checking.updates").": "; + echo "\n"; + echo "

    "; + } +else if ($mode=="") + { + echo "".$NATS->Lang->Item("check.updates")."

    "; + } + +function tul($l) +{ +global $NATS; +if ($l>9) return $NATS->Lang->Item("ul.admin"); +if ($l>4) return $NATS->Lang->Item("ul.power"); +if ($l>0) return $NATS->Lang->Item("ul.normal"); +return $NATS->Lang->Item("ul.disabled"); +} + +function aat_etype($type) +{ +global $NATS; +switch ($type) + { + case 0: return $NATS->Lang->Item("aae.short"); + case 1: return $NATS->Lang->Item("aae.long"); + default: return $NATS->Lang->Item("Unknown"); + } +} + +function aat_esub($type) +{ +global $NATS; +switch ($type) + { + case 0: return $NATS->Lang->Item("aae.sub.blank"); + case 1: return $NATS->Lang->Item("aae.sub.short"); + case 2: return $NATS->Lang->Item("aae.sub.long"); + default: return $NATS->Lang->Item("unknown"); + } +} + +function aat_atype($type) +{ +global $NATS; +switch($type) + { + case "": case "Disabled": return $NATS->Lang->Item("aatype.disabled"); + case "email": return $NATS->Lang->Item("aatype.email"); + case "url": return $NATS->Lang->Item("aatype.url"); + case "mqueue": return $NATS->Lang->Item("aatype.mqueue"); + default: return $NATS->Lang->Item("unknown")." (".$type.")"; + } +} + +if ($mode=="users") +{ +echo "".$NATS->Lang->Item("user.admin")."

    "; + + + + +$q="SELECT username,realname,userlevel FROM fnuser"; +$r=$NATS->DB->Query($q); +echo ""; +echo ""; +echo ""; +echo ""; +while ($row=$NATS->DB->Fetch_Array($r)) + { + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + } +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo "
    ".$NATS->Lang->Item("username")." ".$NATS->Lang->Item("real.name")."".$NATS->Lang->Item("user.level")."".$NATS->Lang->Item("password")."".$NATS->Lang->Item("options")."
    ".$row['username'].""; + echo "Lang->Item("save")."\"> ".$NATS->Lang->Item("delete")."
    Lang->Item("create.user")."\">

    "; +echo "
    "; +$NATS->DB->Free($r); +} +else if ($mode=="nodetestsessions") +{ +echo "".$NATS->Lang->Item("sessions.for")." ".$_REQUEST['nodeid']."

    "; +echo "".$NATS->Lang->Item("sessions.running.for")." ".$_REQUEST['nodeid']."
    "; +$q="SELECT * FROM fntestrun WHERE fnode=\"".ss($_REQUEST['nodeid'])."\" AND finishx=0 ORDER BY trid DESC"; +$r=$NATS->DB->Query($q); +if ($NATS->DB->Num_Rows($r)==0) echo "".$NATS->Lang->Item("sessions.not.running")."
    "; +echo ""; +while ($row=$NATS->DB->Fetch_Array($r)) + { + echo ""; + echo ""; + } +echo "
    run/".$row['trid']."".nicedt($row['startx'])." - "; + if ($row['finishx']>0) echo nicedt($row['finishx']); + else echo $NATS->Lang->Item("sessions.stillrunning"); + echo " (".$NATS->Lang->Item("event.log").")"; + echo "
    "; +$NATS->DB->Free($r); +echo "
    "; +echo "
    "; + +echo "100 ".$NATS->Lang->Item("sessions.previous")." ".$_REQUEST['nodeid']."
    "; +$q="SELECT * FROM fntestrun WHERE fnode=\"".ss($_REQUEST['nodeid'])."\" ORDER BY trid DESC LIMIT 0,100"; +$r=$NATS->DB->Query($q); +if ($NATS->DB->Num_Rows($r)==0) echo "".$NATS->Lang->Item("sessions.previous.none")."
    "; +echo ""; +while ($row=$NATS->DB->Fetch_Array($r)) + { + echo ""; + echo ""; + } +echo "
    run/".$row['trid']."".nicedt($row['startx'])." - "; + if ($row['finishx']>0) echo nicedt($row['finishx']); + else echo $NATS->Lang->Item("sessions.stillrunning"); + echo " (".$NATS->Lang->Item("event.log").")"; + echo "
    "; +$NATS->DB->Free($r); +echo "
    "; +echo "
    "; + +} +else if ($mode=="testsessions") +{ +echo "".$NATS->Lang->Item("sessions.running")."

    "; +$q="SELECT * FROM fntestrun WHERE finishx=0 ORDER BY trid DESC"; +$r=$NATS->DB->Query($q); +if ($NATS->DB->Num_Rows($r)==0) echo "".$NATS->Lang->Item("sessions.not.running")."
    "; +echo ""; +while ($row=$NATS->DB->Fetch_Array($r)) + { + echo ""; + echo ""; + } +echo "
    run/".$row['trid']."".nicedt($row['startx'])." - "; + if ($row['finishx']>0) echo nicedt($row['finishx']); + else echo $NATS->Lang->Item("sessions.stillrunning"); + echo " (".$NATS->Lang->Item("event.log").")"; + echo "
    "; +$NATS->DB->Free($r); +echo "
    "; +echo "
    "; +echo ""; +echo "100 ".$NATS->Lang->Item("sessions.previous")." "; +$q="SELECT nodeid,nodename FROM fnnode ORDER BY weight ASC"; +$r=$NATS->DB->Query($q); +echo "

    "; +} +else if ($mode=="alertactions") +{ +echo "".$NATS->Lang->Item("alert.actions")."

    "; + +if (isset($_REQUEST['aaid'])) + { // view/edit aaid + $q="SELECT * FROM fnalertaction WHERE aaid=".ss($_REQUEST['aaid']); + $r=$NATS->DB->Query($q); + if (!$row=$NATS->DB->Fetch_Array($r)) + { + echo "Error Fetching AAID

    "; + Screen_Footer(); + exit(); + } + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + echo ""; + echo ""; + + echo ""; + + echo ""; + + + echo ""; + if ($row['awarnings']==1) $s=" checked"; + else $s=""; + echo ""; + + echo ""; + if ($row['adecrease']==1) $s=" checked"; + else $s=""; + echo ""; + + echo ""; + echo ""; + + echo ""; + echo ""; + +if ($row['atype']!="url") + { + + echo ""; + echo ""; + + echo ""; + + } + + echo ""; + + echo ""; + + echo ""; + + echo "
    ".$NATS->Lang->Item("id")." : action/".$_REQUEST['aaid']."
    ".$NATS->Lang->Item("aa.name")." : "; + echo ""; + echo "
    ".$NATS->Lang->Item("aa.type")." : "; + echo ""; + echo "
    ".$NATS->Lang->Item("schedule")." : "; + echo ""; + $NATS->DB->Free($sr); + echo " ".hlink("AlertSchedule"); + echo "
    ".$NATS->Lang->Item("warnings")." : ".hlink("AAction:Warnings")."
    ".$NATS->Lang->Item("decreases")." : ".hlink("AAction:Decreases")."
    ".$NATS->Lang->Item("aa.limit")." : "; + echo " "; + echo hlink("AAction:Limit"); + echo "
    ".$NATS->Lang->Item("aa.counter")." : "; + echo " "; + echo hlink("AAction:Counter"); + echo " (for "; + if ($row['ctrdate']=="") echo "unknown"; + else echo substr($row['ctrdate'],6,2)."/".substr($row['ctrdate'],4,2)."/".substr($row['ctrdate'],0,4); + echo ")"; + echo "
    ".$NATS->Lang->Item("aa.efrom")." : "; + echo ""; + echo "
    ".$NATS->Lang->Item("aa.esubj")." : "; + echo ""; + echo "
    ".$NATS->Lang->Item("aa.mtype")." : "; + echo ""; + echo "
    ".$NATS->Lang->Item("aa.eto")." : "; + echo ""; + echo "
    Lang->Item("aa.update")."\">   ".$NATS->Lang->Item("aa.cancel")." | "; + echo "".$NATS->Lang->Item("aa.test")." | "; + echo "".$NATS->Lang->Item("aa.delete").""; + echo "


    "; + $NATS->DB->Free($r); + } + +$q="SELECT aaid,atype,aname FROM fnalertaction"; +$r=$NATS->DB->Query($q); +echo ""; +echo ""; +while ($row=$NATS->DB->Fetch_Array($r)) + { + echo ""; + echo ""; + } +echo "
    ".$NATS->Lang->Item("id")."".$NATS->Lang->Item("aa.name")."".$NATS->Lang->Item("aa.type")."
    "; + echo "".$row['aaid']."".$row['aname'].""; + echo aat_atype($row['atype']); + echo "
    "; + +echo "
    ".$NATS->Lang->Item("aa.create")."
    "; +echo "

    "; +} +else if ($mode=="logs") +{ +// Que ??!? +echo "System Logs

    "; +echo "System Event Log

    "; + +echo "

    "; +} +else if ($mode=="status") +{ +// system healthcheck + +// usage data +//$q="SELECT COUNT(fnnode.nodeid),COUNT(fngroup.groupid),COUNT( FROM fnnode,fngroup"; +$q="SHOW TABLE STATUS LIKE \"fn%\""; +$r=$NATS->DB->Query($q); + +echo "FreeNATS ".$NATS->Lang->Item("system.status")."

    "; + +$tinfo=array(); + +echo "".$NATS->Lang->Item("status.size")."

    "; + +echo ""; +echo ""; +echo ""; +while ($row=$NATS->DB->Fetch_Array($r)) + { + echo ""; + echo ""; + } +echo "
    ".$NATS->Lang->Item("status.tname")."".$NATS->Lang->Item("status.tsize")."".$NATS->Lang->Item("status.tsize.kb")."".$NATS->Lang->Item("status.tother")."
    ".$row['Name']."".$row['Rows']."".round($row['Data_length']/1024,0).""; + if (isset($tinfo[$row['Name']])) echo $tinfo[$row['Name']]; + else echo " "; + if ($row['Data_free']>0) + { + echo " [".round($row['Data_free']/1024,0)."kb ".$NATS->Lang->Item("status.free")." - "; + echo "".$NATS->Lang->Item("status.optimise")."]"; + } + echo "
    "; +$NATS->DB->Free($r); +echo "

    "; + +echo "".$NATS->Lang->Item("status.running")."

    "; +$q="SELECT * FROM fntestrun WHERE finishx=0"; +$r=$NATS->DB->Query($q); +echo "".$NATS->DB->Num_Rows($r)." ".$NATS->Lang->Item("status.running")."

    "; +if ($NATS->DB->Num_Rows($r)>0) + { + echo ""; + echo ""; + $nowx=time(); + $fifteenx=$nowx-(15*60); + $hourx=$nowx-(60*60); + while ($row=$NATS->DB->Fetch_Array($r)) + { + echo ""; + echo ""; + echo ""; + echo ""; + } + echo "
    ID".$NATS->Lang->Item("node")."".$NATS->Lang->Item("started")."".$NATS->Lang->Item("notes")."
    "; + echo $row['trid']."".nicedt($row['startx'])." - ".dtago($row['startx']).""; + if ($row['startx']<$hourx) echo $NATS->Lang->Item("status.run.error"); + else if($row['startx']<$fifteenx) echo $NATS->Lang->Item("status.run.warn"); + else echo " "; + echo "
    "; + } +$NATS->DB->Free($r); +echo "

    "; + +echo "".$NATS->Lang->Item("status.env.http")."

    "; +$env_test_web=1; +include("environment.test.php"); +echo "
    "; +echo "".$NATS->Lang->Item("status.env.cli")."

    "; +$output=array(); +$return=0; +exec("php -q environment.test.php",$output,$return); +if ($return!=1) + { + echo "Error: PHP CLI Script did not seem to execute. PHP-CLI is required for FreeNATS (fatal error)
    "; + } +foreach($output as $line) + echo $line; + +echo "
    "; +echo "Click here for very detailed PHP environment information for web and CLI"; + +echo "

    "; +echo $NATS->Lang->Item("status.disclaim"); +echo "

    "; + +} +else if ($mode=="phpinfo") +{ + echo "

    ".$NATS->Lang->Item("status.env.http")."


    "; + $env_test_web=1; + include("environment.test.php"); + echo "
    "; + ob_start(); + phpinfo(); + $info=ob_get_contents(); + ob_end_clean(); + $info=preg_replace("//is","",$info); + echo "
    "; + echo nl2br(strip_tags($info)); + echo "



    \n"; + + echo "

    ".$NATS->Lang->Item("status.env.cli")."


    "; + $output=array(); + $return=0; + exec("php -q environment.test.php full",$output,$return); + if ($return!=1) + { + echo "Error: PHP CLI Script did not seem to execute. PHP-CLI is required for FreeNATS (fatal error)
    "; + } + foreach($output as $line) + echo $line; +} +else if ($mode=="variables") +{ +echo "".$NATS->Lang->Item("variables")." ".hlink("Variable")."

    "; +$q="SELECT * FROM fnconfig ORDER BY fnc_var ASC"; +$r=$NATS->DB->Query($q); +echo ""; +while ($row=$NATS->DB->Fetch_Array($r)) + { + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + } +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo "
    "; + echo "=Lang->Item("save")."\"> "; + echo hlink("Var:".$row['fnc_var']); + echo "
    =Lang->Item("create")."\">


    "; +} +else if ($mode=="sysinfo") +{ +echo "FreeNATS ".$NATS->Lang->Item("sys.info")."

    "; + +echo "Version Information

    "; +echo ""; +echo ""; +echo ""; +echo ""; +echo "
    ".$NATS->Lang->Item("version").":".$NATS->Version."
    ".$NATS->Lang->Item("release").":".$NATS->Release."
    ".$NATS->Lang->Item("compound").":".$NATS->Version.$NATS->Release."


    "; + +echo "".$NATS->Lang->Item("reg.modules")."

    "; +echo ""; +echo ""; +echo ""; +foreach($NATS->Tests->QuickList as $key => $val) + { + echo ""; + } +echo "
    ".$NATS->Lang->Item("name")."".$NATS->Lang->Item("provides")."".$NATS->Lang->Item("revision")."".$NATS->Lang->Item("additional")."
    "; + echo $NATS->Tests->Tests[$key]->name; + echo ""; + echo $NATS->Tests->Tests[$key]->type; + echo ""; + echo $NATS->Tests->Tests[$key]->revision; + echo ""; + echo $NATS->Tests->Tests[$key]->additional; + echo "


    "; + +echo "".$NATS->Lang->Item("reg.events")."

    "; +echo ""; +echo ""; +foreach($NATS->EventHandlers as $key => $val) + { + echo ""; + } +echo "
    ".$NATS->Lang->Item("event")."".$NATS->Lang->Item("handlers")."
    ".$key.""; + foreach($NATS->EventHandlers[$key] as $handler) + echo $handler."
    "; + echo "


    "; +echo "".$NATS->Lang->Item("reg.languages")."

    "; +$langs=$NATS->Lang->GetLanguages(); +foreach($langs as $code => $lang) + { + echo $code.": ".$lang."
    "; + } +echo "

    "; +} +else // catch-all +{ +echo "

    ".$NATS->Lang->Item("tests.alerting")."

    \n"; + +echo "  "; +echo "".$NATS->Lang->Item("alert.actions")."

    "; + +echo "  "; +echo "".$NATS->Lang->Item("sessions")."

    "; + +echo "  "; +echo "".$NATS->Lang->Item("schedules")."

    "; + +echo "  "; +echo "".$NATS->Lang->Item("rss.feed")."

    "; + +echo "

    ".$NATS->Lang->Item("system.settings")."

    \n"; + +echo "  "; +echo "".$NATS->Lang->Item("user.admin")."

    "; + +echo "  "; +echo "".$NATS->Lang->Item("variables")."

    "; + +echo "

    ".$NATS->Lang->Item("tools")."

    \n"; + +echo "  "; +echo "".$NATS->Lang->Item("file.manager")."

    "; + +if ($NATS->Cfg->Get("site.enable.adminsql",0)==1) + { + echo "  "; + echo "".$NATS->Lang->Item("sql.console")."

    "; + } + +echo "  "; +echo "".$NATS->Lang->Item("dns.console")."

    "; + +echo "  "; +echo "".$NATS->Lang->Item("backup.restore")."

    "; + +echo "

    ".$NATS->Lang->Item("logs.info")."

    \n"; + +echo "  "; +echo "".$NATS->Lang->Item("event.log")."

    "; + +echo "  "; +echo "".$NATS->Lang->Item("sys.status")."

    "; + +echo "  "; +echo "".$NATS->Lang->Item("sys.info")."

    "; + +/* +echo "  "; +echo "".$NATS->Lang->Item("user.admin")."

    "; +echo "  "; +echo "".$NATS->Lang->Item("event.log")."

    "; +echo "  "; +echo "".$NATS->Lang->Item("alert.actions")."

    "; +echo "  "; +echo "".$NATS->Lang->Item("variables")."

    "; +echo "  "; +echo "".$NATS->Lang->Item("sessions")."

    "; +echo "  "; +echo "".$NATS->Lang->Item("schedules")."

    "; +echo "  "; +echo "".$NATS->Lang->Item("file.manager")."

    "; + +if ($NATS->Cfg->Get("site.enable.adminsql",0)==1) + { + echo "  "; + echo "".$NATS->Lang->Item("sql.console")."

    "; + } +echo "  "; +echo "".$NATS->Lang->Item("dns.console")."

    "; +echo "  "; +echo "".$NATS->Lang->Item("backup.restore")."

    "; +echo "  "; +echo "".$NATS->Lang->Item("sys.status")."

    "; +echo "  "; +echo "".$NATS->Lang->Item("sys.info")."

    "; +echo "  "; +echo "".$NATS->Lang->Item("rss.feed")."

    "; +*/ +} + +if ($mode!="") echo "".$NATS->Lang->Item("back.to.admin")."

    "; +?> + + + diff --git a/src/server/web/admin.rss.php b/src/server/web/admin.rss.php new file mode 100755 index 0000000..ff7ba31 --- /dev/null +++ b/src/server/web/admin.rss.php @@ -0,0 +1,208 @@ +Start(); +if (!$NATS_Session->Check($NATS->DB)) + { + header("Location: ./?login_msg=Invalid+Or+Expired+Session"); + exit(); + } +if ($NATS_Session->userlevel<9) UL_Error($NATS->Lang->Item("admin.interface")); + +if (isset($_REQUEST['action'])) +{ + switch ($_REQUEST['action']) + { + case "create": + $id=$NATS->RSS->Create($_REQUEST['feedname']); + $_REQUEST['edit']=1; + $_REQUEST['id']=$id; + break; + + case "update": + $id=$_REQUEST['feedid']; + $opts=array(); + $opts['feedname']=$_REQUEST['feedname']; + $opts['feedkey']=$_REQUEST['feedkey']; + $opts['feedtype']=$_REQUEST['feedtype']; + if ($_REQUEST['feedtype']=="node") $opts['typeopt']=$_REQUEST['nodeid']; + else if ($_REQUEST['feedtype']=="group") $opts['typeopt']=$_REQUEST['groupid']; + $opts['feedrange']=$_REQUEST['feedrange']; + if (isset($_REQUEST[$_REQUEST['feedrange']])) $opts['rangeopt']=$_REQUEST[$_REQUEST['feedrange']]; + + $NATS->RSS->SaveFeed($id,$opts); + break; + + case "delete": + $NATS->RSS->Delete($_REQUEST['id']); + break; + } +} + +Screen_Header($NATS->Lang->Item("rss.feed"),1,1,"","main","admin"); + +echo "
    ".$NATS->Lang->Item("system.settings")." > ".$NATS->Lang->Item("rss.feed")."

    "; + +$types = $NATS->RSS->GetTypes(); +$ranges = $NATS->RSS->GetRanges(); + +if (isset($_REQUEST['edit'])) +{ + $nodes=$NATS->GetNodes(); + $groups=$NATS->GetGroups(); + + $feed = $NATS->RSS->GetFeed($_REQUEST['id']); + if (count($feed)>0) + { + echo "
    \n"; + echo "\n"; + echo "\n"; + echo "

    ".$NATS->Lang->Item("edit").": ".$feed['feedname']."

    \n"; + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + + echo "\n"; + + echo "
    "; + echo $NATS->Lang->Item("rss.feed.name"); + echo ""; + echo ""; + echo "
    "; + echo $NATS->Lang->Item("rss.feed.key"); + echo ""; + echo ""; + echo "
    "; + echo $NATS->Lang->Item("rss.type"); + echo ""; + foreach($types as $type => $desc) + { + if ($type==$feed['feedtype']) $s=" CHECKED"; + else $s=""; + echo " ".$desc." "; + + if ($type=="node") + { + echo "\n"; + } + else if ($type=="group") + { + echo "\n"; + } + + echo "
    \n"; + } + echo "
    "; + echo $NATS->Lang->Item("rss.range"); + echo ""; + foreach($ranges as $range => $desc) + { + if ($range==$feed['feedrange']) $s=" CHECKED"; + else $s=""; + echo " ".$desc." "; + + if ($range[0]=="x") + { + $var=$range; + if ($range==$feed['feedrange']) $val=$feed['rangeopt']; + else $val=""; + echo ""; + } + + echo "
    \n"; + } + echo "
     "; + echo "Lang->Item("save.changes")."\">"; + echo "
    \n"; + echo "
    \n"; + } + else + { + echo "".$NATS->Lang->Item("rss.error").""; + } + echo "

    "; +} + +echo "

    ".$NATS->Lang->Item("rss.feeds")."

    \n"; + +$feeds = $NATS->RSS->GetFeeds(); +if (count($feeds)<=0) echo "".$NATS->Lang->Item("no.feeds")."

    \n"; +else +{ + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + foreach($feeds as $feed) + { + echo "\n"; + echo "\n"; + echo "\n"; + $url=$NATS->RSS->GetURL($feed['feedid'],$feed['feedkey']); + echo "\n"; + } + echo "
    ".$NATS->Lang->Item("rss.feed.name")."".$NATS->Lang->Item("options")."".$NATS->Lang->Item("feed.url")."
    ".$feed['feedname'].""; + echo ""; + echo ""; + echo ""; + echo "  Lang->Item("delete")."?','admin.rss.php?action=delete&id=".$feed['feedid']."');\">"; + echo ""; + echo ""; + echo ""; + echo "".$url.""; + echo "
    \n"; + echo "

    "; +} +echo "
    \n"; +echo "\n"; +echo " "; +echo "Lang->Item("feed.create")."\">\n"; +echo "
    "; + + + +Screen_Footer(); +?> diff --git a/src/server/web/admin.sql.php b/src/server/web/admin.sql.php new file mode 100755 index 0000000..c25249c --- /dev/null +++ b/src/server/web/admin.sql.php @@ -0,0 +1,127 @@ +Start(); +if (!$NATS_Session->Check($NATS->DB)) + { + header("Location: ./?login_msg=Invalid+Or+Expired+Session"); + exit(); + } +if ($NATS_Session->userlevel<9) UL_Error("Admin SQL Interface"); +if ($NATS->Cfg->Get("site.enable.adminsql",0)!=1) + { + header("Location: main.php?message=Admin+SQL+Console+Disabled"); + exit(); + } + + + +ob_end_flush(); +Screen_Header("Admin SQL Interface",1); +echo "WARNING: This is advanced and unprotected functionality - proceed with caution!

    "; + +if (isset($_REQUEST['query'])) $query=$NATS->StripGPC($_REQUEST['query']); +else $query=""; + +echo "
    "; +echo ""; +if ($query!="") $t=htmlspecialchars($query); +else $t="SELECT * FROM fnnode LIMIT 0,10"; +echo "
    "; +echo " Show Data | Abandon / Return to Admin Page"; +echo "

    "; + +if ( (isset($_REQUEST['action'])) && ($_REQUEST['action']=="sql") ) + { + $q=$query; + $type=strtoupper(substr($q,0,strpos($q," "))); + echo "Query: ".$q."
    "; + + // sod the NATS-specific DB stuff here... + echo "Executing: "; + $res=mysql_query($q); + if (mysql_errno()==0) + { + echo "Success"; + $ok=true; + } + else + { + echo "Error: ".mysql_error()." (".mysql_errno().")"; + $ok=false; + } + echo "

    "; + + + if ($ok) + { + if (($type=="SELECT")||($type=="SHOW")||($type=="DESCRIBE")) + { + echo "Returned: "; + echo mysql_num_rows($res); + echo " Rows

    "; + if (isset($_REQUEST['show_data'])) + { + // show the data here + echo ""; + $first=true; + $keys=array(); + while ($row=mysql_fetch_array($res)) + { + if ($first) + { + echo ""; + foreach($row as $key => $value) + { + if (!is_numeric($key)) + { + echo ""; + $keys[]=$key; + } + } + echo ""; + $first=false; + } + echo ""; + foreach($keys as $key) + { + echo ""; + } + echo ""; + } + echo "
    ".$key."
    ".$row[$key]."
    "; + + } + } + else + { + echo "Affected: "; + echo mysql_affected_rows(); + echo " Rows

    "; + } + } + + } +Screen_Footer(); +?> diff --git a/src/server/web/api.php b/src/server/web/api.php new file mode 100755 index 0000000..d0bd293 --- /dev/null +++ b/src/server/web/api.php @@ -0,0 +1,358 @@ +Start(); +$session=true; +if (!$NATS_Session->Check($NATS->DB)) + { + $session=false; + } + +$abs=GetAbsolute(); + +if (isset($_REQUEST['mode'])) $mode=$_REQUEST['mode']; +else $mode="xml"; + +// api.public - is available without session auth +// api.key - usage key used if public and no session (if set) + +if ($NATS->Cfg->Get("api.public",0)!=1) // NOT public + { + if (!$session) + { + echo "Error: Public API Access Disabled"; + exit(); + } + } +else if (!$session) // IS PUBLIC and not logged in + { + $key=$NATS->Cfg->Get("api.key",""); + if ($key!="") // require a key + { + if ( (!isset($_REQUEST['apikey'])) || ($_REQUEST['apikey'] != $key) ) + { + // No key or doesn't match + echo "Error: Public API Key Mismatch"; + exit(); + } + } + } + +// Got this far so it must be a winner (either public or no key or correct key) + + + +function lo($text) // line out +{ +echo $text."\n"; +} + +// Header +ob_clean(); +switch($mode) + { + case "xml": + header("Content-type: text/xml"); + lo(""); + lo(""); + break; + + case "js": + if (isset($_REQUEST['dataid'])) $dataid=$_REQUEST['dataid']; + else + { + $allow="abcdef0123456789"; + $allow_len=strlen($allow); + mt_srand(microtime()*1000000); + $id_len=10; + $dataid="fnd_"; + for ($a=0; $a<$id_len; $a++) + { + $dataid.=$allow[mt_rand(0,$allow_len-1)]; + } + } + lo("var ".$dataid."=new Array();"); + break; + + + } +ob_end_flush(); + +// Queries +$query_count=count($_REQUEST['query']); +for ($a=0; $a<$query_count; $a++) + { + switch($_REQUEST['query'][$a]) + { + case "nodelist": + $q="SELECT nodeid FROM fnnode"; + if ((!isset($_REQUEST['param'][$a])) || ($_REQUEST['param'][$a]!=1)) $q.=" WHERE nodeenabled=1"; + $q.=" ORDER BY weight ASC"; + $r=$NATS->DB->Query($q); + if ($mode=="js") + { + lo($dataid."[".$a."]=new Array();"); + } + else if ($mode=="xml") lo("DB->Num_Rows($r)."\" query=\"".$a."\">"); + $ctr=0; + while ($row=$NATS->DB->Fetch_Array($r)) + { + $nodealert=$NATS->NodeAlertLevel($row['nodeid']); + if ($mode=="xml") lo("".$row['nodeid'].""); + else if ($mode=="js") + { + lo($dataid."[".$a."][".$ctr."]=new Array();"); + lo($dataid."[".$a."][".$ctr."][0]='".$row['nodeid']."';"); + lo($dataid."[".$a."][".$ctr."][1]='".$nodealert."';"); + } + $ctr++; + } + if ($mode=="xml") lo(""); + $NATS->DB->Free($r); + break; + + + case "node": + $nodedata=$NATS->GetNode($_REQUEST['param'][$a]); + if ($nodedata) // got a valid response + { + if ($mode=="js") + { + lo($dataid."[".$a."]=new Array();"); + } + else if ($mode=="xml") lo(""); + $ctr=0; + foreach($nodedata as $key => $val) + { + if (!is_numeric($key)) // pesky double-arrays avoided + { + if ($mode=="xml") lo(" <".$key.">".$val.""); + else if ($mode=="js") + { + lo($dataid."[".$a."][".$ctr."]=new Array;"); + lo($dataid."[".$a."][".$ctr."][0]='".$key."';"); + lo($dataid."[".$a."][".$ctr."][1]='".$val."';"); + } + $ctr++; + } + } + if ($mode=="xml") lo(""); + } + break; + + case "group": + $groupdata=$NATS->GetGroup($_REQUEST['param'][$a]); + if ($groupdata) // got a valid response + { + if ($mode=="js") + { + lo($dataid."[".$a."]=new Array();"); + } + else if ($mode=="xml") lo(""); + $ctr=0; + foreach($groupdata as $key => $val) + { + if (!is_numeric($key)) // pesky double-arrays avoided + { + if ($mode=="xml") lo(" <".$key.">".$val.""); + else if ($mode=="js") + { + lo($dataid."[".$a."][".$ctr."]=new Array;"); + lo($dataid."[".$a."][".$ctr."][0]='".$key."';"); + lo($dataid."[".$a."][".$ctr."][1]='".$val."';"); + } + $ctr++; + } + } + if ($mode=="xml") lo(""); + } + break; + + + case "test": + $testdata=$NATS->GetTest($_REQUEST['param'][$a],true); + if ($testdata) // got a valid response + { + + if ( (isset($_REQUEST['param1'][$a])) && (isset($_REQUEST['param2'][$a])) ) + { // get data + $testdata['period.startx']=0; + $testdata['period.finishx']=0; + $testdata['period.tested']=0; + $testdata['period.passed']=0; + $testdata['period.warning']=0; + $testdata['period.failed']=0; + $testdata['period.untested']=0; + $testdata['period.average']=0; + + if (($testdata['testrecord']==1)||($testdata['testtype']=="ICMP")) + { + $sx=smartx($_REQUEST['param1'][$a]); + $fx=smartx($_REQUEST['param2'][$a]); + $testdata['period.startx']=$sx; + $testdata['period.finishx']=$fx; + + $q="SELECT alertlevel,COUNT(recordid) AS counter FROM fnrecord WHERE testid=\"".ss($testdata['testid'])."\" AND "; + $q.="recordx>=".ss($sx)." AND recordx<=".ss($fx)." GROUP BY alertlevel"; + //echo $q; + $r=$NATS->DB->Query($q); + while ($row=$NATS->DB->Fetch_Array($r)) + { + switch ($row['alertlevel']) + { + case -1: $testdata['period.untested']+=$row['counter']; + break; + case 0: $testdata['period.passed']+=$row['counter']; + break; + case 1: $testdata['period.warning']+=$row['counter']; + break; + case 2: $testdata['period.failed']+=$row['counter']; + break; + } + $testdata['period.tested']+=$row['counter']; + } + $NATS->DB->Free($r); + + $q="SELECT AVG(testvalue) FROM fnrecord WHERE testid=\"".ss($testdata['testid'])."\" AND "; + $q.="recordx>=".ss($sx)." AND recordx<=".ss($fx); //." AND alertlevel IN (0,1)"; // warnings and passes only + + $r=$NATS->DB->Query($q); + + if ($row=$NATS->DB->Fetch_Array($r)) + { + $testdata['period.average']=round($row['AVG(testvalue)'],4); + } + + $NATS->DB->Free($r); + + } + } + + + // header + + if ($mode=="js") + { + lo($dataid."[".$a."]=new Array();"); + lo($dataid."[".$a."][0]=new Array();"); // Keys + lo($dataid."[".$a."][1]=new Array();"); // Values + } + else if ($mode=="xml") lo(""); + $ctr=0; + foreach($testdata as $key => $val) + { + if (!is_numeric($key)) // pesky double-arrays avoided + { + if ($mode=="xml") lo(" <".$key.">".$val.""); + else if ($mode=="js") + { + lo($dataid."[".$a."][0][".$ctr."]='".$key."';"); + lo($dataid."[".$a."][1][".$ctr."]='".$val."';"); + } + $ctr++; + } + } + if ($mode=="xml") lo(""); + } + break; + + case "alerts": + $alerts=$NATS->GetAlerts(); + + $count=count($alerts); + if ($alerts===false) $count=0; // as showing a 1 in count otherwise + if ($mode=="xml") lo(""); + else if ($mode=="js") lo($dataid."[".$a."]=new Array();"); + + if ($alerts) // some were returned + { + // nodeid alertlevel + for ($alctr=0; $alctr<$count; $alctr++) + { + if ($mode=="xml") lo(" ".$alerts[$alctr]['nodeid'].""); + else if ($mode=="js") lo($dataid."[".$a."][".$alctr."]='".$alerts[$alctr]['nodeid']."';"); + } + } + + if ($mode=="xml") lo(""); + + break; + + + case "testdata": + // param = testid + // param1 = startx + // param2 = finishx + + $q="SELECT recordx,testvalue,alertlevel FROM fnrecord WHERE testid=\"".ss($_REQUEST['param'][$a])."\" AND "; + $sx=smartx($_REQUEST['param1'][$a]); + $fx=smartx($_REQUEST['param2'][$a]); + $q.="recordx>=".ss($sx)." AND recordx<=".ss($fx)." ORDER BY recordx ASC"; + + $r=$NATS->DB->Query($q); + $count=$NATS->DB->Num_Rows($r); + + if ($mode=="xml") lo(""); + else if ($mode=="js") + { + lo($dataid."[".$a."]=new Array();"); + } + + $ctr=0; + while ($row=$NATS->DB->Fetch_Array($r)) + { + if ($mode=="xml") + { + lo(" ".$row['testvalue'].""); + } + else + { + lo($dataid."[".$a."][".$ctr."]=new Array();"); + lo($dataid."[".$a."][".$ctr."][0]=".$row['recordx'].";"); + lo($dataid."[".$a."][".$ctr."][1]=".$row['testvalue'].";"); + lo($dataid."[".$a."][".$ctr."][2]=".$row['alertlevel'].";"); + } + $ctr++; + } + $NATS->DB->Free($r); + + if ($mode=="xml") lo(""); + + break; + + } + } + +// Footer and Finish + +if ($mode=="xml") lo(""); +else if ($mode=="js") + { + if(isset($_REQUEST['callback'])) + { + lo($_REQUEST['callback']."(".$dataid.");"); + } + } + +?> \ No newline at end of file diff --git a/src/server/web/confirm.php b/src/server/web/confirm.php new file mode 100755 index 0000000..152a739 --- /dev/null +++ b/src/server/web/confirm.php @@ -0,0 +1,39 @@ +Start(); +if (!$NATS_Session->Check($NATS->DB)) + { + header("Location: ./?login_msg=Invalid+Or+Expired+Session"); + exit(); + } + +ob_end_flush(); +Screen_Header("Confirm ".$_REQUEST['action'],1); + +echo "
    Please Confirm You Wish to Continue

    "; +echo "Action: ".$_REQUEST['action']."
    "; +echo "Confirm Action | Abort Action

    "; +Screen_Footer(); +?> diff --git a/src/server/web/css/iphone.css b/src/server/web/css/iphone.css new file mode 100755 index 0000000..c26672b --- /dev/null +++ b/src/server/web/css/iphone.css @@ -0,0 +1,251 @@ +/* + + File:browser.css + + Abstract: Style rules for the Simple Browser sample - Modified for FreeNATS Sept 08 + + Version: 1.0 + + Disclaimer: IMPORTANT: This Apple software is supplied to you by + Apple Inc. ("Apple") in consideration of your agreement to the + following terms, and your use, installation, modification or + redistribution of this Apple software constitutes acceptance of these + terms. If you do not agree with these terms, please do not use, + install, modify or redistribute this Apple software. + + In consideration of your agreement to abide by the following terms, and + subject to these terms, Apple grants you a personal, non-exclusive + license, under Apple's copyrights in this original Apple software (the + "Apple Software"), to use, reproduce, modify and redistribute the Apple + Software, with or without modifications, in source and/or binary forms; + provided that if you redistribute the Apple Software in its entirety and + without modifications, you must retain this notice and the following + text and disclaimers in all such redistributions of the Apple Software. + Neither the name, trademarks, service marks or logos of Apple Inc. + may be used to endorse or promote products derived from the Apple + Software without specific prior written permission from Apple. Except + as expressly stated in this notice, no other rights or licenses, express + or implied, are granted by Apple herein, including but not limited to + any patent rights that may be infringed by your derivative works or by + other works in which the Apple Software may be incorporated. + + The Apple Software is provided by Apple on an "AS IS" basis. APPLE + MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION + THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS + FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND + OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. + + IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, + MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED + AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), + STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + + Copyright (C) 2008 Apple Inc. All Rights Reserved. + + */ + +/* ==================== TOP-LEVEL CONTAINERS ==================== */ + +body { + width: 320px; + margin: 0px; + padding: 0px; + background-image: url('../images/iphone/background_stripes.png'); + background-repeat: repeat; + font-family: Helvetica; + /* ensure that we don't get the default callout following a long touch on + an element, which is a default behavior in Mobile Safari */ + -webkit-touch-callout: none; + /* disable the Mobile Safari default behavior to adjust font size automatically + to improve readability */ + -webkit-text-size-adjust: none; +} + +/* +when the orientation changes to landscape mode, the body is assigned the .landscape +class so that we can easily change metrics and other properties via simple CSS matching +*/ +body.landscape { + width: 480px; +} + +#browser { + /* ensure we always fill the whole screen */ + min-height: 416px; +} + +body.landscape #browser { + min-height: 268px; +} + +/* ==================== HEADER ==================== */ + +#header { + position: relative; + height: 40px; + background-image: url('../images/iphone/header_middle.png'); + border-bottom: 1px solid rgb(45, 54, 66); +} + +.button { + /* use absolute positioning and transforms as these will be subject to hardware transitions */ + position: absolute; + -webkit-transform: translate(0px, 0px); + /* the buttons should be displayed on top of the titles so that they can always receive touches */ + z-index: 1; + /* set up the font appearance */ + font-size: 12px; + font-weight: bold; + text-align: center; + color: white; + text-shadow: rgba(0, 0, 0, .6) 0px -1px 0px; + /* set up the chrome background */ + -webkit-border-image : url('../images/iphone/back_button.png') 0 4 0 13; + border-width : 0 4px 0 13px; + padding-top: 7px; + top: 5px; + padding-right: 4px; + /* base metrics used to ensure a minumum size and specify a max size that can be used to trim the contents */ + min-width: 40px; + max-width: 60px; + height: 23px; + /* enfore trimming if the label is too long */ + white-space : nowrap; + overflow : hidden; + text-overflow: ellipsis; +} + +body.landscape .button { + max-width: 90px; +} + +/* touched state for the buttons */ +.button:active { + -webkit-border-image : url('../images/iphone/back_button_touched.png') 0 4 0 13; +} + +.title { + /* use absolute positioning and transforms as these will be subject to hardware transitions */ + position: absolute; + -webkit-transform: translate(0px, 0px); + /* base metrics */ + left: 75px; + height: 31px; + margin-top: 7px; + /* the titles should be displayed below the button so that they don't receive touches */ + z-index: 0; + /* set up the font appearance */ + font-size: 16pt; + font-weight: bold; + color: white; + text-shadow: rgba(0, 0, 0, .6) 0px -1px 0px; + /* enfore trimming if the label is too long */ + white-space : nowrap; + overflow : hidden; + text-overflow: ellipsis; +} + +/* ==================== MAIN PAGES CONTENT ==================== */ + +#pages_container > div { + position: absolute; + /* + add a default transform so that the contents of the pages + are already composited as hardware elements and will animate + smoothly later on when we launch transitions + */ + -webkit-transform: translate(0px,0px); +} + +ul { + width: 300px; + padding: 0px; + margin: 10px 0px 6px 10px; + font-size: 18px; + font-weight: bold; +} + +body.landscape ul { + width: 460px; +} + +li { + /* height: 32px; */ + list-style-type: none; + background-color: white; + border-style: solid; + border-width: 1px 1px 0px 1px; + border-color: rgb(171,173,176); + margin: 0px; + padding-top: 14px; + padding-left: 10px; + padding-right: 20px; + padding-bottom: 14px; + /* ensure that long pieces of text get trimmed */ + white-space : nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +/* +this matches the first list item, which needs rounding in the top corners +and no bottom border as the item below will already draw a border at its top +*/ +li:first-child { + -webkit-border-top-left-radius: 8px; + -webkit-border-top-right-radius: 8px; + border: 1px solid rgb(171,173,176); + border-bottom-width: 0; +} + +/* +this matches the last list item, which needs rounding in the bottom corners +and a bottom border +*/ +li:last-child { + -webkit-border-bottom-left-radius: 8px; + -webkit-border-bottom-right-radius: 8px; + border: 1px solid rgb(171,173,176); + margin-bottom: 5px; +} + +/* +list items with the .group class are those that can be tapped to drill +further down and therefore need an arrow in the background to indicate that +*/ +li.group { + background-image: url('../images/iphone/chevron.png'); + background-repeat: no-repeat; + background-position: 280px 18px; +} + +li.grouptitle { + font-weight: bold; + /* background-image: url('../images/iphone/header_middle.png'); */ + background: #a0a0e0; + color: white; + font-size: 14pt; + } + +body.landscape li.group { + background-position: 440px 18px; +} + + + +body.landscape li.group:active { + background-position: 440px 18px, 0 0; +} + +b.al-1 { color: black; } +b.al0 { color: green; } +b.al1 { color: orange; } +b.al2 { color: red; } + +i.subtext { font-size: 8pt; color: #909090; } + +div.sectitle { font-size: 10pt; color: black; font-weight: bold; margin-top: 10px; } diff --git a/src/server/web/css/main.css b/src/server/web/css/main.css new file mode 100755 index 0000000..8e693c9 --- /dev/null +++ b/src/server/web/css/main.css @@ -0,0 +1,354 @@ + diff --git a/src/server/web/css/mini.css b/src/server/web/css/mini.css new file mode 100755 index 0000000..e9ec4cd --- /dev/null +++ b/src/server/web/css/mini.css @@ -0,0 +1,14 @@ + \ No newline at end of file diff --git a/src/server/web/css/mobile.css b/src/server/web/css/mobile.css new file mode 100755 index 0000000..613a473 --- /dev/null +++ b/src/server/web/css/mobile.css @@ -0,0 +1,117 @@ + diff --git a/src/server/web/css/monitor.css b/src/server/web/css/monitor.css new file mode 100755 index 0000000..a48dbaa --- /dev/null +++ b/src/server/web/css/monitor.css @@ -0,0 +1,70 @@ + diff --git a/src/server/web/environment.test.php b/src/server/web/environment.test.php new file mode 100755 index 0000000..f0258e0 --- /dev/null +++ b/src/server/web/environment.test.php @@ -0,0 +1,121 @@ +".$mod." - Ok
    "; + return true; + } +else + { + echo "".$mod." - ".$text."
    "; + return false; + } +} + +if (!isset($env_test_web)) // PHP CLI Test +{ +if (!test_mod("IMAP","imap_open")) + { + echo "IMAP is not supported - don't configure IMAP tests or your environment will hang
    "; + } +if (!test_mod("Sockets","fsockopen")) + { + echo "Sockets are not supported - fatal error
    "; + } +if (!test_mod("Streams","fopen")) + { + echo "Streams are not supported - fatal error
    "; + } +if (!test_mod("MySQL","mysql_connect")) + { + echo "MySQL is not supported - fatal error
    "; + } +if (!test_mod("Mail","mail")) + { + echo "mail() not supported, may have to use direct SMTP or maybe no mail will work!
    "; + } +if (!test_mod("PHP5","str_split")) + { + echo "Don't appear to be running PHP5 - FreeNATS may not work on PHP4
    "; + } +if (!test_mod("XML","xml_parser_create")) + { + echo "XML Parser not present in PHP CLI - nodeside testing and anything else dependent on XML (discovery/import tools etc) will fail!
    "; + } + +if (isset($_SERVER['argv'][1]) && ($_SERVER['argv'][1]=="full")) + { + echo "

    "; + ob_start(); + phpinfo(); + $info=ob_get_contents(); + ob_clean(); + $info=nl2br($info); + echo $info; + echo "

    "; + } +exit(1); +} +else // PHP Web/Apache Module Test +{ +if (!test_mod("MySQL","mysql_connect")) + { + echo "MySQL is not supported - fatal error
    "; + } +if (!test_mod("Mail","mail")) + { + echo "mail() not supported, may have to use direct SMTP or maybe no mail will work!
    "; + } +if (!test_mod("PHP5","str_split")) + { + echo "Don't appear to be running PHP5 - FreeNATS may not work on PHP4
    "; + } +if (!test_mod("GD Graphics",array("imagecreate","imagepng"))) + { + echo "GD Graphics does not appear to be supported or does not support PNG - historic graphs will not work!
    "; + } +if (!test_mod("XML","xml_parser_create")) + { + echo "XML Parser not present in PHP web - nodeside and other functions from within the web interface will fail
    "; + } +} + +?> diff --git a/src/server/web/eval.action.php b/src/server/web/eval.action.php new file mode 100755 index 0000000..5391c36 --- /dev/null +++ b/src/server/web/eval.action.php @@ -0,0 +1,74 @@ +Start(); +if (!$NATS_Session->Check($NATS->DB)) + { + header("Location: ./?login_msg=Invalid+Or+Expired+Session"); + exit(); + } +if ($NATS_Session->userlevel<5) UL_Error("Action Test Eval"); + +function BackIfSet() +{ +if (isset($_REQUEST['back'])) + { + header("Location: ".$_REQUEST['back']); + exit(); + } +} + +switch ($_REQUEST['action']) + { + case "create": + // screw this for the moment + // get the highest weight for this testid + //$q="SELECT weight FROM fneval WHERE testid=\"".ss($_REQUEST['testid'])." + $q="INSERT INTO fneval(testid,eoperator,evalue,eoutcome) VALUES(\"".ss($_REQUEST['testid'])."\","; + $q.="\"".ss($_REQUEST['eoperator'])."\",\"".ss($_REQUEST['evalue'])."\",\"".ss($_REQUEST['eoutcome'])."\")"; + $NATS->DB->Query($q); + //echo $q; + //exit(); + if ($_REQUEST['testid'][0]=="L") + { + $ltid=substr($_REQUEST['testid'],1,128); + header("Location: localtest.edit.php?localtestid=".$ltid); + exit(); + } + BackIfSet(); + header("Location: main.php"); + exit(); + case "delete": + $q="DELETE FROM fneval WHERE evalid=".ss($_REQUEST['evalid']); + $NATS->DB->Query($q); + BackIfSet(); + if (isset($_REQUEST['back'])) header("Location: ".$_REQUEST['back']); + else header("Location: main.php?message=Evaluator+Deleted"); + exit(); + default: + header("Location: main.php?message=Unknown+Test+Eval+Action"); + exit(); + } + +?> diff --git a/src/server/web/filemanager.php b/src/server/web/filemanager.php new file mode 100755 index 0000000..ec04409 --- /dev/null +++ b/src/server/web/filemanager.php @@ -0,0 +1,221 @@ +Start(); +if (!$NATS_Session->Check($NATS->DB)) + { + header("Location: ./?login_msg=Invalid+Or+Expired+Session"); + exit(); + } +if ($NATS_Session->userlevel<9) UL_Error("Filemanager Interface"); + +$dirs=array(); +$dircount=0; +function add_dir($name,$path) +{ +global $dirs,$dircount; +$dirs[$dircount]['name']=$name; +$dirs[$dircount]['path']=$path; +$dircount++; +return ($dircount-1); +} + +add_dir("Site Tests",$BaseDir."site/tests/"); +add_dir("Site Events",$BaseDir."site/events/"); + +// Actions Here +if (isset($_REQUEST['action'])) + { + switch ($_REQUEST['action']) + { + case "save": + $fp=@fopen($dirs[$dirindex]['path'].$filename,"w"); + if ($fp<=0) + { + $msg="Failed to Open File to Save"; + } + else + { + $size=strlen($_REQUEST['content']); + fputs($fp,$_REQUEST['content'],$size); + fclose($fp); + $msg="File Saved"; + } + break; + + case "delete": + $fn=$dirs[$dirindex]['path'].$filename; + if (!isset($_REQUEST['confirmed'])) + { + $cl="filemanager.php?dirindex=".$dirindex."&filename=".$filename."&action=delete&confirmed=1"; + $loc="confirm.php?action=Delete+file+".$filename."&back=".urlencode($cl); + header("Location: ".$loc); + exit(); + } + $res=@unlink($fn); + if ($res) $msg="Deleted File ".$filename; + else $msg="Failed to Delete ".$fn; + break; + + case "download": + + $fn=$dirs[$dirindex]['path'].$filename; + if (file_exists($fn)) + { + header("Content-type: application/octet-stream"); + header("Content-Length: ".filesize($fn)); + header("Content-Disposition: attachment; filename=".$filename); + header("Content-Transfer-Encoding: binary"); + $fp=@fopen($fn,"rb"); + if ($fp) + { + fpassthru($fp); + fclose($fp); + } + exit(); + } + $msg="File Download Failed"; + break; + + case "upload": + $uploadfn = $dirs[$dirindex]['path'] . basename($_FILES['uploadfile']['name']); + + if (move_uploaded_file($_FILES['uploadfile']['tmp_name'], $uploadfn)) + { + $msg="File Uploaded Ok"; + } + else $msg="File Upload Failed"; + + break; + + } + } + +Screen_Header("File Manager",1,1,"","main","admin"); +if ($msg!="") echo "".$msg."

    "; + +echo "
    System Settings > File Manager

    "; + +echo "
    "; +echo "Change Directory: "; +echo "

    "; + +echo "".$dirs[$dirindex]['name']." Directory: ".$dirs[$dirindex]['path']."

    "; + +if ($handle=opendir($dirs[$dirindex]['path'])) + { + echo ""; + while (false !== ($file = readdir($handle))) + { + if ( ($file!=".l") && ($file!=".l.") ) + { + echo ""; + + echo ""; + + echo ""; + + + echo ""; + } + } + + echo "
    "; + if (is_dir($dirs[$dirindex]['path'].$file)) + { + echo $file; + $isfile=false; + } + else + { + $isfile=true; + echo ""; + echo $file; + echo ""; + } + echo ""; + if ($isfile) + { + echo ""; + echo " "; + echo ""; + echo ""; + } + else echo " "; + echo ""; + if ($isfile) + { + echo filesize($dirs[$dirindex]['path'].$file)." bytes"; + } + else echo " "; + echo "
    "; + closedir($handle); + } + +echo "
    "; +echo ""; +echo ""; +echo "Upload File:


    "; + +echo "
    "; +echo ""; +echo "Create File Named: "; +echo "
    "; + +echo "

    "; + +if ( isset($_REQUEST['action']) && ($_REQUEST['action']=="edit") ) + { + $text=@file_get_contents($dirs[$dirindex]['path'].$filename); + echo "
    "; + echo ""; + echo ""; + echo ""; + echo "Editing ".$dirs[$dirindex]['path'].$filename."

    "; + echo "
    "; + echo " Abandon Changes"; + echo "


    "; + } + +Screen_Footer(); +?> diff --git a/src/server/web/firstrun.php b/src/server/web/firstrun.php new file mode 100755 index 0000000..2ba28d1 --- /dev/null +++ b/src/server/web/firstrun.php @@ -0,0 +1,180 @@ +0; $a--) + { + $c=$sn[$a]; + if ($c=="/") $a=-1; + else $script=$c.$script; + } +if ($script!="firstrun.php") + { + echo "Error: This script is not correctly named. In order to run it please rename "".$script."" to "firstrun.php"."; + echo "

    "; + exit(); + } +if (isset($_REQUEST['stage'])) $stage=$_REQUEST['stage']; +else $stage=0; + +function sqlfile($file) +{ +global $BaseDir; +$fn=$BaseDir."sql/".$file.".sql"; +echo "Processing ".$fn."

    "; +$fp=fopen($fn,"r"); +if ($fp<=0) + { + echo "ERROR: Cannot Open File!

    "; + return false; + } +$q=""; +$qc=0; +$qok=0; +$qerr=0; +while ($s=fgets($fp,1024)) + { + if ($s[0]!="-") + { + for ($a=0; $aWarning/Error

    "; + echo "SQL: ".$q."
    "; + echo "Error: ".mysql_error()." (Code ".mysql_errno().")

    "; + $qerr++; + } + else $qok++; + $q=""; + } + else + $q.=$c; + } + } + } +echo "Finished Processing: ".$qc." queries (".$qok." ok, ".$qerr." warnings/errors)

    "; +fclose($fp); +} + +echo "FreeNATS Setup\n"; +echo "

    First Run Setup: Stage ".$stage."

    "; + +echo "Testing database connectivity...
    "; + $sql=mysql_connect($fnCfg['db.server'],$fnCfg['db.username'],$fnCfg['db.password']) + or die("Failed to connect to database server ".$fnCfg['db.server']." with username ".$fnCfg['db.username']."
    Details: ".mysql_error()); + mysql_select_db($fnCfg['db.database']) + or die("Connected ok but failed to select database ".$fnCfg['db.database']."
    Details: ".mysql_error()); + echo "Database connection succeeded!

    "; + +switch($stage) + { + case 0: + echo "Users Performing an Upgrade Please Note:
    this will only update the database and not "; + echo "the files which you must do manually or with the shell-install/vm-upgrade scripts.

    "; + echo "
    "; + echo ""; + echo "Setup Database Schema and Defaults

    "; + echo "Select installation/update type...

    "; + echo ""; + echo "
    "; + echo ""; + echo ""; + echo "Fresh Install/Upgrade
    "; + echo "First time users should select this. For upgrades this is
    "; + echo "the recommended choice and should work but will loose your
    "; + echo "data and configuration.

    "; + echo "
    "; + echo ""; + echo ""; + echo "Database Upgrade (highly experimental)
    "; + echo "Select this to attempt to update your schema (add new tables
    "; + echo "and fields etc keeping your data and config intact. You may
    "; + echo "need to come back and do a fresh update or update the schema
    "; + echo "by hand if it fails."; + echo "

    "; + echo " Submit Anonymous Usage Data Automatically
    "; + echo "This will help us track use of the product and aid future development.

    "; + echo " Include Example Setup (Recommended) (n/a if upgrade selected)

    "; + echo ""; + echo "
    "; + exit(); + break; + + case 1: + if ($_REQUEST['insttype']=="fresh") + { + echo "Fresh Install or Clean Update

    "; + echo "Setting Up Schema...

    "; + sqlfile("schema.drop"); + echo "Setting Up Defaults...

    "; + sqlfile("default"); + if (isset($_REQUEST['example'])) + { + echo "Setting Up Examples...

    "; + sqlfile("example"); + } + } + else if ($_REQUEST['insttype']=="upgrade") + { + echo "Experimental Upgrade... Expect to See Errors
    "; + echo "Doesn't mean it hasn't worked if you see already exists/duplicate errors

    "; + echo "Basically ignore errors: 1050, 1060, 1068 and 1054

    "; + echo "Importing New Schema (sans drop tables)

    "; + sqlfile("schema"); + echo "

    Doing Schema Upgrade

    "; + sqlfile("schema.upgrade"); + echo "

    "; + } + else echo "Error: Incorrect or Unknown Installation Type!

    "; + + if (isset($_REQUEST['tracker'])) + { + echo "Enabling Usage Tracker

    "; + $q="INSERT INTO fnconfig(fnc_var,fnc_val) VALUES(\"freenats.tracker\",\"1\")"; + mysql_query($q); + } + echo "

    "; + echo "CONGRATULATIONS!!

    "; + echo "Setup should now be complete. If you saw errors etc above please see the "; + echo "project homepage for help.

    "; + echo "RENAME THIS FILE "firstrun.php" TO SOMETHING ELSE LIKE "firstrun-.php" TO STOP OTHERS RUNNING IT"; + echo "

    "; + echo "Click here to continue - login admin password admin (click settings once logged in to change)

    "; + + + exit(); + break; + + default: + echo "Sorry - unknown step in setup process!

    "; + exit(); + } + +?> \ No newline at end of file diff --git a/src/server/web/group.action.php b/src/server/web/group.action.php new file mode 100755 index 0000000..0e8449b --- /dev/null +++ b/src/server/web/group.action.php @@ -0,0 +1,139 @@ +Start(); +if (!$NATS_Session->Check($NATS->DB)) + { + header("Location: ./?login_msg=Invalid+Or+Expired+Session"); + exit(); + } +if ($NATS_Session->userlevel<5) UL_Error("Action Group"); +$msg=""; + +switch($_REQUEST['action']) + { + case "delete": + if (!isset($_REQUEST['confirm'])) + { + $go="confirm.php?action=Delete+Group&back="; + $go.=urlencode("group.action.php?action=delete&groupid=".$_REQUEST['groupid']."&confirm=1"); + header("Location: ".$go); + exit(); + } + // delete it and shit! + + // group + links + lt results + $q="DELETE FROM fngroup WHERE groupid=".ss($_REQUEST['groupid']); + $NATS->DB->Query($q); + $q="DELETE FROM fngrouplink WHERE groupid=".ss($_REQUEST['groupid']); + $NATS->DB->Query($q); + $msg="Group Deleted"; + break; + + case "create": + // get highest weight + $wq="SELECT weight FROM fngroup ORDER BY weight DESC LIMIT 0,1"; + $wr=$NATS->DB->Query($wq); + if ($wrow=$NATS->DB->Fetch_Array($wr)) $we=($wrow['weight'])+10; + else $we=10; + + $q="INSERT INTO fngroup(groupname,weight) VALUES(\"".ss($_REQUEST['groupname'])."\",".$we.")"; + if ($_REQUEST['groupname']!="") + { + $NATS->DB->Query($q); + $msg="Created New Group"; + } + else $msg="Invalid Group Name"; + break; + + case "save_edit": + $q="UPDATE fngroup SET "; + $q.="groupname=\"".ss($_REQUEST['groupname'])."\","; + $q.="groupdesc=\"".ss($_REQUEST['groupdesc'])."\","; + $q.="groupicon=\"".ss($_REQUEST['groupicon'])."\""; + $q.=" WHERE groupid=".ss($_REQUEST['groupid']); + $NATS->DB->Query($q); + $msg="Saved Group Changes"; + break; + + case "save_members": + + // da two list nonsense again + /* + $nl=array(); + $nc=0; + $cur=array(); + $cc=0; + + foreach($_REQUEST['members'] as $newmem) + { + $nl[$newmem]['proc']=false; + $nl[$newmem]['nodeid']=$newmem; + $nl++; + } + */ // no let's try this and see if we get any errors and stuff + + $q="DELETE FROM fngrouplink WHERE groupid=".ss($_REQUEST['groupid']); + $NATS->DB->Query($q); + foreach($_REQUEST['members'] as $newmem) + { + $q="INSERT INTO fngrouplink(groupid,nodeid) VALUES(".ss($_REQUEST['groupid']).",\"".ss($newmem)."\")"; + $NATS->DB->Query($q); + } + $msg="Updated Group Membership"; + break; + + case "move": + // get my weight + $q="SELECT weight FROM fngroup WHERE groupid=\"".ss($_REQUEST['groupid'])."\""; + $r=$NATS->DB->Query($q); + $row=$NATS->DB->Fetch_Array($r); + $myweight=$row['weight']; + $NATS->DB->Free($r); + + // get next/prev one + $q="SELECT groupid,weight FROM fngroup WHERE "; + if ($_REQUEST['dir']=="up") $q.="weight<".$myweight." ORDER BY weight DESC LIMIT 0,1"; + else $q.="weight>".$myweight." ORDER BY weight ASC LIMIT 0,1"; + $r=$NATS->DB->Query($q); + if ($row=$NATS->DB->Fetch_Array($r)) + { + // swap 'em + $uq="UPDATE fngroup SET weight=".$myweight." WHERE groupid=".$row['groupid']; + $NATS->DB->Query($uq); + $uq="UPDATE fngroup SET weight=".$row['weight']." WHERE groupid=".ss($_REQUEST['groupid']); + $NATS->DB->Query($uq); + $msg="Updated Group Display Order"; + } + else $msg="No Higher/Lower Group"; + break; + + + + default: $msg="Unknown Group Action"; + } +header("Location: main.php?mode=groups&message=".urlencode($msg)); +exit(); + +?> diff --git a/src/server/web/group.edit.php b/src/server/web/group.edit.php new file mode 100755 index 0000000..3eefd4e --- /dev/null +++ b/src/server/web/group.edit.php @@ -0,0 +1,146 @@ +Start(); +if (!$NATS_Session->Check($NATS->DB)) + { + header("Location: ./?login_msg=Invalid+Or+Expired+Session"); + exit(); + } +if ($NATS_Session->userlevel<5) UL_Error($NATS->Lang->Item("group.editor")); +ob_end_flush(); +Screen_Header($NATS->Lang->Item("group.editor"),1,1,"","main","groups"); +echo "\n\n\n"; +?> +
    +DB->Query($q); +if (!$row=$NATS->DB->Fetch_Array($r)) + { + echo $NATS->Lang->Item("no.group")."

    "; + Screen_Footer(); + exit(); + } +$NATS->DB->Free($r); +echo "".$NATS->Lang->Item("editing")." ".$NATS->Lang->Item("editing").":"; +echo " ".$row['groupname']."

    "; + +$t="".$NATS->Lang->Item("group.settings").""; +Start_Round($t,600); +echo ""; +echo ""; +echo ""; +echo ""; + + +echo ""; + +echo ""; + +echo ""; + +echo ""; + + +echo ""; +echo ""; +echo "
    "; +echo $NATS->Lang->Item("group.id"); +echo " :"; +echo $row['groupid']; +echo "
    "; +echo $NATS->Lang->Item("group.name"); +echo " :"; +echo ""; +echo "
    "; +echo $NATS->Lang->Item("description"); +echo " :"; +echo ""; +echo "
    "; +echo $NATS->Lang->Item("group.icon"); +echo " :"; +echo " [ Show Icons ]"; +echo " [ ".$NATS->Lang->Item("show.icons")." ]"; +echo "
    "; +echo "Lang->Item("group.save")."\"> ".$NATS->Lang->Item("cancel").""; +echo "

    "; +echo "
    "; +End_Round(); + +if (isset($_REQUEST['show_icons'])) + { + echo "

    "; + ShowIcons(); + echo "

    "; + } + +echo "
    "; + +echo "
    "; +$t="".$NATS->Lang->Item("group.members").""; +Start_Round($t,600); + +echo ""; +echo ""; +echo ""; +$q="SELECT nodeid,nodename FROM fnnode ORDER BY weight ASC"; +$r=$NATS->DB->Query($q); +$c=0; +while ($row=$NATS->DB->Fetch_Array($r)) + { + // has link? + $lq="SELECT glid FROM fngrouplink WHERE groupid=\"".ss($_REQUEST['groupid'])."\" AND nodeid=\"".ss($row['nodeid'])."\" LIMIT 0,1"; + $lr=$NATS->DB->Query($lq); + if ($NATS->DB->Num_Rows($lr)>0) $s=" checked"; + else $s=""; + $NATS->DB->Free($lr); + echo ""; + } +$NATS->DB->Free($r); +echo ""; +echo "
    "; + echo "".$row['nodeid']." - ".$row['nodename']."
    Lang->Item("group.update")."\">
    "; +End_Round(); +?> + + + diff --git a/src/server/web/group.php b/src/server/web/group.php new file mode 100755 index 0000000..8f183b3 --- /dev/null +++ b/src/server/web/group.php @@ -0,0 +1,120 @@ +Start(); +if (!$NATS_Session->Check($NATS->DB)) + { + header("Location: ./?login_msg=Invalid+Or+Expired+Session"); + exit(); + } +if ($NATS_Session->userlevel<1) UL_Error("View Group"); +ob_end_flush(); +Screen_Header("Viewing Group",1); +?> +
    +DB->Query($q); +if (!$row=$NATS->DB->Fetch_Array($r)) + { + echo "No such group.

    "; + Screen_Footer(); + exit(); + } +$NATS->DB->Free($r); + +echo "
    "; + +echo "Group: ".$row['groupname']."

    "; + +echo ""; + +echo ""; + +echo ""; + +echo ""; + +if ($NATS_Session->userlevel>4) + echo ""; + +echo "
    +Group Name +:"; +echo $row['groupname']; +echo "
    +Description +:"; +echo $row['groupdesc']; +echo "
    +Status +:"; +$al=$NATS->GroupAlertLevel($_REQUEST['groupid']); +echo ""; +echo oText($al); +echo ""; +echo "
    Settings :Group Options
    "; +echo "
     "; +ng_tiny($_REQUEST['groupid'],$row['groupname']); +echo "
    "; + +echo "

    "; +echo ""; +$a=0; +$q="SELECT nodeid FROM fngrouplink WHERE groupid=".ss($_REQUEST['groupid']); +$r=$NATS->DB->Query($q); +while ($row=$NATS->DB->Fetch_Array($r)) + { + if ($a==0) echo ""; + echo ""; + $a++; + if ($a>=5) + { + echo ""; + $a=0; + } + } +if ($a>0) echo ""; +/* +if ($a>0) // otherwise at the first row anyway + { + while ($a<5) + { + echo ""; + $a++; + } + echo ""; + } +*/ +echo "
    "; + np_tiny($row['nodeid']); + echo "
     
    "; + +?> + + + diff --git a/src/server/web/help.php b/src/server/web/help.php new file mode 100755 index 0000000..707b5be --- /dev/null +++ b/src/server/web/help.php @@ -0,0 +1,41 @@ +Start(); +//$NATS_Session->Check($NATS->DB); +// stuff it... hackers can see our help!! woo-hoo!! + +echo "FreeNATS Help\n"; +echo "\n"; +echo ""; + + +echo hdisp($_REQUEST['id']); + +echo "

    "; +echo "For more information see www.purplepixie.org/freenats

    "; + +echo "Close Window"; + +echo ""; +?> diff --git a/src/server/web/history.alert.php b/src/server/web/history.alert.php new file mode 100755 index 0000000..d7b2ceb --- /dev/null +++ b/src/server/web/history.alert.php @@ -0,0 +1,141 @@ +Start(); +if (!$NATS_Session->Check($NATS->DB)) + { + header("Location: ./?login_msg=Invalid+Or+Expired+Session"); + exit(); + } +if ($NATS_Session->userlevel<1) UL_Error("View Alert"); +ob_end_flush(); +Screen_Header("Alert History for ".$_REQUEST['nodeid'],1); +?> +
    +Node Alerts for: ".$_REQUEST['nodeid']."

    "; + +function dal($arow) +{ +global $NATS; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +if ($arow['closedx']>0) + { + $st="Resolved"; + $ct=nicedt($arow['closedx'])." (Open for ".nicediff($arow['closedx']-$arow['openedx']).")"; + } +else + { + $st="Open"; + $ct="n/a"; + } + +echo ""; +echo ""; +echo ""; +echo ""; + +echo ""; +echo ""; + +echo ""; + +$hq="SELECT * FROM fnalertlog WHERE alertid=".$arow['alertid']." ORDER BY postedx DESC"; +$px=0; +$first=true; +$hr=$NATS->DB->Query($hq); +while ($hrow=$NATS->DB->Fetch_Array($hr)) + { + if ($hrow['postedx']!=$px) // first entry for that px + { + if (!$first) echo ""; // first ever px or not + else $first=false; + echo ""; + + +echo "
    Alert : ".$arow['nodeid']."/".$arow['alertid']."
    Opened : ".nicedt($arow['openedx'])."
    Status : ".$st."
    Closed : ".$ct."
    Level : ".aText($arow['alertlevel'])."
     
    Alert Log
    "; + $px=$hrow['postedx']; + echo nicedt($px); + echo " : "; + echo ""; + } + echo $hrow['logentry']."
    "; + } +if (!$first) echo "
    "; +} + +if (isset($_REQUEST['alertid'])) + { // display this one + $q="SELECT * FROM fnalert WHERE alertid=".ss($_REQUEST['alertid']); + $r=$NATS->DB->Query($q); + if ($row=$NATS->DB->Fetch_Array($r)) dal($row); + else echo "Error Fetching AlertID

    "; + } +else + { // see if one is open + $q="SELECT * FROM fnalert WHERE nodeid=\"".ss($_REQUEST['nodeid'])."\" AND closedx=0"; + $r=$NATS->DB->Query($q); + if ($row=$NATS->DB->Fetch_Array($r)) dal($row); + // otherwise nothing open... + } + +echo "

    "; +echo "Alert History for ".$_REQUEST['nodeid']."

    "; +// display history + +$hq="SELECT * FROM fnalert WHERE nodeid=\"".ss($_REQUEST['nodeid'])."\" ORDER BY alertid DESC"; +$hr=$NATS->DB->Query($hq); +//echo $hq; + +echo ""; +while ($hrow=$NATS->DB->Fetch_Array($hr)) + { + echo ""; + echo ""; + echo ""; + + echo ""; + } +echo "
    "; + echo $_REQUEST['nodeid']."/".$hrow['alertid']; + echo ""; + if ($hrow['closedx']<=0) echo "Open"; + else echo "Resolved"; + echo ""; + echo nicedt($hrow['openedx'])." - "; + if ($hrow['closedx']<=0) echo "n/a"; + else echo nicedt($hrow['closedx']); + echo "
    "; + +?> + + + diff --git a/src/server/web/history.test.php b/src/server/web/history.test.php new file mode 100755 index 0000000..c8dcb5f --- /dev/null +++ b/src/server/web/history.test.php @@ -0,0 +1,527 @@ +Start(); +if (!$NATS_Session->Check($NATS->DB)) + { + header("Location: ./?login_msg=Invalid+Or+Expired+Session"); + exit(); + } +if ($NATS_Session->userlevel<1) UL_Error("View Test History"); + +$tmode=""; +switch($_REQUEST['testid'][0]) + { + case "L": $tmode="local"; + break; + case "N": $tmode="nodeside"; + break; + default: $tmode="unknown"; + } +$stid=substr($_REQUEST['testid'],1,128); + +// get test info +$tnode=""; +$tname=""; +$ttype=""; +$tparam=""; +$tlastrunx=""; +$trecord=1; + +$q=""; +if ($tmode=="local") $q="SELECT * FROM fnlocaltest WHERE localtestid=".ss($stid); +else if ($tmode=="nodeside") $q="SELECT * FROM fnnstest WHERE nstestid=".ss($stid); + +$r=$NATS->DB->Query($q); + +if (!$row=$NATS->DB->Fetch_Array($r)) + { + header("main.php?message=Error+opening+test+history"); + exit(); + } + + +// This bit handles up-front the test interval stuff i.e. which is the interval that +// the test "should run" at + +$nodedata=$NATS->GetNode($row['nodeid']); // first load the data for the node +$show_expected_number=false; // show the expected number or not +$tinterval=0; // fallback zero +if ($tmode=="local") + { + $tinterval=$row['testinterval']; + if ($nodedata['testinterval']>$tinterval) $tinvteral=$ndoedata['testinterval']; + // for a local test use the test's interval or the node's, whichever is higher + $show_expected_number=true; + } +else if ($tmode=="nodeside") + { + if ( ($nodedata['nsenabled']==1) && ($nodedata['nspullenabled']==1) ) + { // is nodedside and test is PULLED + $tinterval=$nodedata['nsinterval']; + $show_expected_number=true; + } + } +if ($tinterval<1) $tinterval=1; // default one minute assumption + +// End of test interval bits + +$tnode=$row['nodeid']; +$ttype=$row['testtype']; +if ($tmode=="local") + { + $tparam=$row['testparam']; + $tlastrunx=$row['lastrunx']; + $tname=lText($ttype); + $tunit=lUnit($ttype); + if ($tparam!="") $tname.=" (".$tparam.")"; + if ($row['testname']!="") + { + $subtname=$tname; + $tname=$row['testname']; + $usesubname=true; + } + else $usesubname=false; + } +else if ($tmode=="nodeside") + { + $tlastrunx=$row['lastrunx']; + if ($row['testname']!="") $tname=$row['testname']; + else $tname=$row['testtype']; + $subtname=$row['testdesc']; + $usesubname=true; + $tunit=""; + } +$NATS->DB->Free($r); +Screen_Header("History for ".$tname." on ".$tnode,1); +ob_end_flush(); + +$td_day=date("d"); +$td_mon=date("m"); +$td_yr=date("Y"); + +$start=array(); +$finish=array(); +if (isset($_REQUEST['st_day'])) $start['day']=$_REQUEST['st_day']; +else $start['day']=$td_day; +if (isset($_REQUEST['st_mon'])) $start['mon']=$_REQUEST['st_mon']; +else $start['mon']=$td_mon; +if (isset($_REQUEST['st_yr'])) $start['yr']=$_REQUEST['st_yr']; +else $start['yr']=$td_yr; +if (isset($_REQUEST['st_hour'])) $start['hour']=$_REQUEST['st_hour']; +else $start['hour']=0; +if (isset($_REQUEST['st_min'])) $start['min']=$_REQUEST['st_min']; +else $start['min']=0; +if (isset($_REQUEST['st_sec'])) $start['sec']=$_REQUEST['st_sec']; +else $start['sec']=0; + +if (isset($_REQUEST['fi_day'])) $finish['day']=$_REQUEST['fi_day']; +else $finish['day']=$td_day; +if (isset($_REQUEST['fi_mon'])) $finish['mon']=$_REQUEST['fi_mon']; +else $finish['mon']=$td_mon; +if (isset($_REQUEST['fi_yr'])) $finish['yr']=$_REQUEST['fi_yr']; +else $finish['yr']=$td_yr; +if (isset($_REQUEST['fi_hour'])) $finish['hour']=$_REQUEST['fi_hour']; +else $finish['hour']=23; +if (isset($_REQUEST['fi_min'])) $finish['min']=$_REQUEST['fi_min']; +else $finish['min']=59; +if (isset($_REQUEST['fi_sec'])) $finish['sec']=$_REQUEST['fi_sec']; +else $finish['sec']=59; + +if (isset($_REQUEST['startx'])) + { + $start['day']=date("d",$_REQUEST['startx']); + $start['mon']=date("m",$_REQUEST['startx']); + $start['yr']=date("Y",$_REQUEST['startx']); + $start['hour']=date("H",$_REQUEST['startx']); + $start['min']=date("i",$_REQUEST['startx']); + $start['sec']=date("s",$_REQUEST['startx']); + $startx=$_REQUEST['startx']; + } +else + $startx=mktime($start['hour'],$start['min'],$start['sec'],$start['mon'],$start['day'],$start['yr']); + +if (isset($_REQUEST['finishx'])) + { + $finish['day']=date("d",$_REQUEST['finishx']); + $finish['mon']=date("m",$_REQUEST['finishx']); + $finish['yr']=date("Y",$_REQUEST['finishx']); + $finish['hour']=date("H",$_REQUEST['finishx']); + $finish['min']=date("i",$_REQUEST['finishx']); + $finish['sec']=date("s",$_REQUEST['finishx']); + $finishx=$_REQUEST['finishx']; + } +else + $finishx=mktime($finish['hour'],$finish['min'],$finish['sec'],$finish['mon'],$finish['day'],$finish['yr']); +//echo $startx." ".nicedt($startx)."
    "; +//echo $finishx." ".nicedt($finishx)."
    "; + +$diffx=$finishx-$startx; +$periods=8; +$periodx=$diffx/$periods; +$hperiodx=round($periodx/2,0); +$periodx=round($periodx,0); +$iwid=700; +$ihei=150; +$istart=50; +$iend=$iwid-5; +$idwid=$iend-$istart; +$iscale=$idwid/$periods; + +$zoom=array(); +for ($a=0; $a<$periods; $a++) + { + $x=($a*$periodx)+$hperiodx+$startx; + $zoom[$a]['startx']=$x-$periodx; + $zoom[$a]['finishx']=$x+$periodx; + $zoom[$a]['istart']=round($istart+($a*$iscale),0); + $zoom[$a]['ifinish']=round($istart+($a*$iscale)+$iscale,0); + } + +echo "
    "; +echo "
    "; + +echo "\n"; +for ($a=0; $a<$periods; $a++) + { + //echo $a." s ".nicedt($zoom[$a]['startx'])." f ".nicedt($zoom[$a]['finishx'])." x ".$zoom[$a]['istart']." - ".$zoom[$a]['ifinish']."
    "; + $s="history.test.php?nodeid=".$tnode."&testid=".$_REQUEST['testid']."&startx=".$zoom[$a]['startx']."&finishx=".$zoom[$a]['finishx']; + + echo "\n"; + + + } +echo "
    \n\n"; + +echo "".$tname."
    "; +if ($usesubname) echo "".$subtname."
    "; + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo "
    Node :".$tnode.""; +echo "
    Last Run :"; +if ($tlastrunx>0) + { + echo nicedt($tlastrunx)."
    "; + echo dtago($tlastrunx); + } +else echo "Never"; +echo "
    "; + +echo "
     "; + +echo "Reporting Period
    "; + +echo ""; +echo ""; +echo ""; +echo ""; + +function slist($var,$min,$max,$val) +{ +echo "\n\n"; +} + + +echo ""; +echo ""; + +echo ""; + +echo ""; + +echo ""; + +echo ""; + +echo ""; + +echo ""; + +// ----- finish + +echo ""; +echo ""; + +echo ""; + +echo ""; + +echo ""; + +echo ""; + +echo ""; + +echo ""; + +// 7 +echo ""; +echo ""; + +echo ""; +echo "
     HourMinSecDayMonYear
    Start:"; +slist("st_hour",0,23,$start['hour']); +echo ":"; +echo ""; +slist("st_min",0,59,$start['min']); +echo ":"; +echo ""; +slist("st_sec",0,59,$start['sec']); +echo "  "; +echo ""; +slist("st_day",1,31,$start['day']); +echo "/"; +echo ""; +slist("st_mon",1,12,$start['mon']); +echo "/"; +echo ""; +echo ""; + +echo " Today"; + +echo "
    Finish:"; +slist("fi_hour",0,23,$finish['hour']); +echo ":"; +echo ""; +slist("fi_min",0,59,$finish['min']); +echo ":"; +echo ""; +slist("fi_sec",0,59,$finish['sec']); +echo "  "; +echo ""; +slist("fi_day",1,31,$finish['day']); +echo "/"; +echo ""; +slist("fi_mon",1,12,$finish['mon']); +echo "/"; +echo ""; +echo ""; + +echo " "; + +echo "
    Opts:"; +function cbd($var,$name) +{ +if (isset($_REQUEST[$var])) $s=" checked"; +else $s=""; +echo " ".$name; +} +cbd("disp_hdata","Hide Data"); +echo " "; +cbd("disp_pass","Show Passed"); +echo " "; +cbd("hide_graph","Hide Graph"); +echo "
    "; + +echo "
    "; + +echo "

    "; + +echo "".$tname." from ".nicedt($startx)." to ".nicedt($finishx); +if ($tunit!="") echo " (".$tunit.")"; +// echo " (".nicediff($finishx-$startx).")"; +echo "

    "; + +// graph data +if (!isset($_REQUEST['hide_graph'])) + { + mt_srand(microtime()*1000000); + $i=mt_rand(1000,1000000); + echo "

    "; + } + +// table data + + +$q="SELECT alertlevel,testvalue,recordx FROM fnrecord WHERE "; +$q.="testid=\"".ss($_REQUEST['testid'])."\" AND recordx>=".ss($startx)." AND recordx<=".ss($finishx); +//if (!isset($_REQUEST['disp_pass'])) $q.=" AND alertlevel!=0"; +$q.=" ORDER BY recordx DESC"; +//echo $q; +$r=$NATS->DB->Query($q); + +$testc=0; +$tested=0; +$untested=0; +$passc=0; +$warnc=0; +$failc=0; +$levelt=0; + +echo ""; +while ($row=$NATS->DB->Fetch_Array($r)) + { + if ( (isset($_REQUEST['disp_pass']) || ($row['alertlevel']!=0) ) && (!isset($_REQUEST['disp_hdata'])) ) + { + echo ""; + echo ""; + echo ""; + echo ""; + } + $testc++; + switch ($row['alertlevel']) + { + case 0: + $passc++; + $tested++; + $levelt+=$row['testvalue']; // for passed only + break; + case 1: + $warnc++; + $tested++; + //$levelt+=$row['testvalue']; + break; + case 2: + $failc++; + $tested++; + //$levelt+=$row['testvalue']; + break; + case -1: + $untested++; + break; + } + } + +echo ""; +echo "
    ".nicedt($row['recordx'])."".oText($row['alertlevel'])."".$row['testvalue']."
    "; + +echo "

    "; +echo ""; + +function np($big,$part) +{ +if ($big==0) return "n/a"; +if ($part==0) return "0%"; + +$p=($part/$big)*100; +$p=round($p,2); +return $p."%"; +} + + +echo ""; + +$notpass=$tested-$passc; + +echo ""; + +echo ""; + +echo ""; + +echo ""; + +echo ""; + +echo ""; + +echo ""; + +echo ""; +echo ""; + +echo ""; + +$utt=$untested+$tested; +echo ""; +echo ""; + +$npt=$untested+$notpass; +echo ""; +echo ""; + +echo ""; +echo ""; + +echo ""; + +echo ""; + +if ($show_expected_number) + { + $nowx=time(); + if ($finishx>$nowx) $fx=$nowx; + else $fx=$finishx; + $p=$fx-$startx; + $interval_min=60*$tinterval; + $shouldhave=floor($p/$interval_min); + + + echo ""; + } + +echo "
    ".$passc." passed out of ".$tested." valid tests"; +echo " "; +echo np($tested,$passc); +echo "
    ".$notpass." did not pass out of ".$tested." valid tests"; +echo " "; +echo np($tested,$notpass); +echo "
     
    ".$warnc." generated warnings out of ".$tested." valid tests"; +echo " "; +echo np($tested,$warnc); +echo "
    ".$failc." generated failures out of ".$tested." valid tests"; +echo " "; +echo np($tested,$failc); +echo "
    ".$warnc." generated warnings out of ".$notpass." unpassed tests"; +echo " "; +echo np($notpass,$warnc); +echo "
    ".$failc." generated failures out of ".$notpass." unpassed tests"; +echo " "; +echo np($notpass,$failc); +echo "
     
    the average test value returned by passed tests was "; +if ($passc<=0) echo "n/a"; +else if ($levelt==0) echo "0"; +else echo round($levelt/$passc,4); +if ($tunit!="") echo " ".$tunit; +echo "
     
    ".$untested." tests were untested (of ".$utt.") "; +echo np($utt,$untested); +echo "
    of these (".$utt.") ".$npt." did not pass "; +echo np($utt,$npt); +echo "
    of these (".$utt.") ".$passc." did pass "; +echo np($utt,$passc); +echo "
     
    ".$testc." records of which ".$tested." returned a valid alert level"; +echo " "; +echo np($testc,$tested); +echo "
    ".$testc." records and you should have ".hlink("History:Should",12)." ".$shouldhave; + echo " "; + echo np($shouldhave,$testc); + echo "

    "; + +/* - zoom period debugging +echo "Period: $p s (".($p/$five_min).")
    "; +echo "sx: ".$startx." fx: ".$finishx."
    "; +echo "diffx: ".($finishx-$startx)."
    "; +echo "fx2: ".$fx." p: ".$p."
    "; +*/ +Screen_Footer(); +?> diff --git a/src/server/web/icons/atom.png b/src/server/web/icons/atom.png new file mode 100755 index 0000000000000000000000000000000000000000..4427226c731d4e347134f115cd776aced6c4ff2a GIT binary patch literal 1770 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 literal 0 HcmV?d00001 diff --git a/src/server/web/icons/document.gif b/src/server/web/icons/document.gif new file mode 100755 index 0000000000000000000000000000000000000000..a983734e1ba108a8aff54858fc260c9163418412 GIT binary patch literal 531 zcmZ?wbhEHb)L_tHIKsdn6>>>>@$=Z&g#Z8lPoFX4`SZt>GjH}?d-dtl$5W?HuAS-j z{Q33&|9|{?wczc$w@0r$`~Lkq11Ui9Ckt4)4u}NV$-w&mfkIzO=Ddtm>vCT2(^NcP zVtaU5z?+));w+4PDm5p&oE4K#=2&rZGA3FCSgrRtq-1q8a^rQ)rq{9!8-p67xPBY) z7B~wF#jL)a_Us`;hx8c%0cJjaPWOuHYKCrpB}R50fr$dq?fOjo-Lq!#^Dr}bHwtjH zI_l4?oz1|=$S}8PQX}7zK)n?VHM7>NSvPUA0N>`VI;`DnoU2y%uU**4aWL9LtDA*) zmQQzo4d2E)eB2jx1Q@PfU&PbRzGwfz`-d-cT{}5@H^ZX058i7swSC_Ge?bFd^aHfO+9yeFn`BHiG)OK7Fd*Ol!FB8~<8-zU^AY4^RpD3H%` zT>!H~!>X!PayGX+j8wU1GfdFE^X0%z&ndtBIAjG_U)XqXm|1Cj@O{?hs+41Om8ISB zWI_nH!rKfd#W{8?e@bLo7BVo&*-l>6!JN>tTrl_krxjLW{p(lcmizoYw*CFm`1qqj r?@mVO9qGEjW!&doHoy1u3}4BOhj(s%ek#PNTh4damX|_`3=Gx)QNhzg literal 0 HcmV?d00001 diff --git a/src/server/web/icons/g_alarm.png b/src/server/web/icons/g_alarm.png new file mode 100755 index 0000000000000000000000000000000000000000..01f83265e38b9f86fb2010ed2fdc74a5d250a4cd GIT binary patch literal 5058 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 Y0C|dZT4p-l#{d8T07*qoM6N<$f|mJyivR!s literal 0 HcmV?d00001 diff --git a/src/server/web/icons/g_bino.png b/src/server/web/icons/g_bino.png new file mode 100755 index 0000000000000000000000000000000000000000..7d9b67f3226353033590da4311c31f7e51c47a87 GIT binary patch literal 4761 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 literal 0 HcmV?d00001 diff --git a/src/server/web/icons/g_cam.png b/src/server/web/icons/g_cam.png new file mode 100755 index 0000000000000000000000000000000000000000..33e71571ab920143f2bd618b264613c9e867d7fe GIT binary patch literal 4979 zcmV-(6O8PMP)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U!4 zfg=2N-7=cNnjjOr{yriy6mMFgG#l znCF=fnQv8CDz++o6_Lscl}eQ+l^ZHARH>?_s@|##Rr6KLRFA1%Q+=*RRWnoLsR`7U zt5vFIcfW3@?wFpwUVxrVZ>QdQz32KIeJ}k~{cZZE^+ya? z2D1z#2HOnI7(B%_ac?{wFUQ;QQA1tBKtrWrm0_3Rgps+?Jfqb{jYbcQX~taRB;#$y zZN{S}1|}gUOHJxc?wV3fxuz+mJ4`!F$IZ;mqRrNsHJd##*D~ju=bP7?-?v~|cv>vB zsJ6IeNwVZxrdjT`yl#bBIa#GxRa#xMMy;K#CDyyGyQdMSxlWT#tDe?p!?5wT$+oGt z8L;Kp2HUQ-ZMJ=3XJQv;x5ci*?vuTfeY$;({XGW_huIFR9a(?@3)XSs8O^N5RyOM=TTmp(3=8^+zpz2r)C z^>JO{deZfso3oq3?Wo(Y?l$ge?uXo;%ru`Vo>?<<(8I_>;8Eq#KMS9gFl*neeosSB zfoHYnBQIkwkyowPu(zdms`p{<7e4kra-ZWq<2*OsGTvEV%s0Td$hXT+!*8Bnh2KMe zBmZRodjHV?r+_5^X9J0WL4jKW`}lf%A-|44I@@LTvf1rHjG(ze6+w@Jt%Bvjts!X0 z?2xS?_ve_-kiKB_KiJlZ$9G`c^=E@oNG)mWWaNo-3TIW8)$Hg0Ub-~8?KhvJ>$ z3*&nim@mj(aCxE5!t{lw7O5^0EIO7zOo&c6l<+|iDySBWCGrz@C5{St!X3hAA}`T4 z(TLbXTq+(;@<=L8dXnssyft|w#WSTW<++3>sgS%(4NTpeI-VAqb|7ssJvzNHgOZVu zaYCvgO_R1~>SyL=cFU|~g|hy|Zi}}s9+d~lYqOB71z9Z$wnC=pR9Yz4DhIM>Wmjgu z&56o6maCpC&F##y%G;1PobR9i?GnNg;gYtchD%p19a!eQtZF&3JaKv33gZ<8D~47E ztUS1iwkmDaPpj=$m#%)jCVEY4fnLGNg2A-`YwHVD3gv};>)hAvT~AmqS>Lr``i7kw zJ{5_It`yrBmlc25DBO7E8;5VoznR>Ww5hAaxn$2~(q`%A-YuS64wkBy=9dm`4cXeX z4c}I@?e+FW+b@^RDBHV(wnMq2zdX3SWv9u`%{xC-q*U}&`cyXV(%rRT*Z6MH?i+i& z_B8C(+grT%{XWUQ+f@NoP1R=AW&26{v-dx)iK^-Nmiuj8txj!m?Z*Ss1N{dh4z}01 z)YTo*JycSU)+_5r4#yw9{+;i4Ee$peRgIj+;v;ZGdF1K$3E%e~4LaI(jC-u%2h$&R z9cLXcYC@Xwnns&bn)_Q~Te?roKGD|d-g^8;+aC{{G(1^(O7m37Y1-+6)01cN&y1aw zoqc{T`P^XJqPBbIW6s}d4{z_f5Om?vMgNQEJG?v2T=KYd^0M3I6IZxbny)%vZR&LD zJpPl@Psh8QyPB@KTx+@RdcC!KX7}kEo;S|j^u2lU7XQ}Oo;f|;z4Ll+_r>@1-xl3| zawq-H%e&ckC+@AhPrP6BKT#_XdT7&;F71j}Joy zkC~6lh7E@6o;W@^IpRNZ{ptLtL(gQ-CY~4mqW;US7Zxvm_|@yz&e53Bp_lTPlfP|z zrTyx_>lv@x#=^!PzR7qqF<$gm`|ZJZ+;<)Cqu&ot2z=00004XF*Lt006O$eEU(80000WV@Og>004R=004l4008;_004mL004C` z008P>0026e000+nl3&F}000P%Nkl1+U8HS&8X1}YiuYGODaT3Qa2_z;2 zlM)q@K!B(v5@k^-qCY613q`8ZHl@%_Efp;gL914!5>gQrh)Si3C@F0f0)#>WA;bx5 zHpt?T1l#!9zSo{RGk2ELAEA&H0#xezbGGl9cfNVQbA(cgkJ3P}BlDKG_Plbu{p|6i zzhr1ul+!02%4(gjO)(brO)<|IeeY5MeDnj4koYhFKbhbkgFm}r%lQ4@mwI((*0it< z4P;0x>i7y`B@eV4iyv8#zU8;w=EeKpyHy?oqCPf2fBCJ(N6RiguB# zna0!vN=^_kN`S|NnxIxoZsy}W?V@CHQ2Wp8agv1{*}*4}-0+R1OW zMZRpw+=wM}RYTa(M>_E14ZRp~uBE&2ybYVfd%7G$P)aq?mhPa{o=(u|IZLg)nX1RnG(q z$Mqv=_C{N{r17TT42u`Lg3u>tW-z6OB@ImBP|$jCv=T1c5u-CGMVB*L{2Olt_uC-c{wU8iR}`FZ1NzU+4LCKHplp=eCbnf)r z{A+eqp2d_BAryiTR7g(mLK8OQ$#!bKOS*a?6!x&M{wIpsWE!**jxY$-LHuMlDUqc~ zn?^~W!DM3&Q|-CDyf$F#6CtTY@XU^f#DBZ>eN9V!_PPl*Al!N#p#&<4i4&iKJ_Ds9 z%HbwPqL+w=yGhwa_NxaGN@0>k!$8Bpz#&d5RO8o>NGy>dXEw6_g{^Gd^g6kwghGkB zA9;T{4xq{EJiqMkLn%;6LKyor=rfU+3DsM%W?@HV2W97+jPqEPB^ ze+#AK$7RN%H!uuI-5mtlw(Qk^@4SDP>qYC61o!=PI2K^QeI@8DU4|*aAj5bt zMm4ISY2%ntfJKg$N(V#vSJ_?JiLE(|`7V}jV(12jZXl(G(4ZO}q%~Oj@D)9GeO*Y{ zy6u6eto+#3Op4dxqFxbSXTf@;4G_8iN zY3RC!rb#qS5(<}GFniNAXW#oxAt6!m;V3*o=pNOCwJ>~fPkAG))(oP!hFACTf)FoA zmU>LkQ}1{Gg5-c#Qiss@?>{wK8#~z$Hz$-Jh{@E`Su01v9>el=8y? z0-r|@`F-FulDACaIHn#Z1a*ZUK;UWAYBehU04jkfPKctIFpTm2kXjHj$?4#N_OEzz zr!IW*$Z@b__6jAW3UNF@ttL^5C%u~ZQ50onOB zmOjd8;4ss=akZ}NYfm=+dpnoV+qvY#pCF6`Q7i}oamTKHf5o%gb_XrdO?aVB-UQnj z#mjByjKX;wsw-U0#Wp=cZH#^O8XeY8_O@hZef#6AijEq`3x55cAxcnl1(mUI-WR&A zys5R#K6|tG=h;#s9o5P;t-t5-=y7&7JjSe&PD!@2P+#$Shr8g~m-=3K&GWodDt`U- z*B=d#Zu`Ixm4H8?a4dssuUz(vxbx60gW5K;8jg@n+F9DYjBt{VVQI`x%~QLc?_as% z*5$X3k5^B5J*bpA8bFAnQ>wYxa>i9xfAPWg&*XYF+r`O-1eFvoKR3qou6Abj8srLD z>JgZtg*P_ue`@8OcVAbjj2%2x0C}>L#bU8z**C6xtn>8NUS+umD@5pmd?7{q)GUP- z9X*#IQXzKEz{)0EeCg*dy7>ny9+Xn1Pt}E!0fAC#V0_5kMdFJALzJZjT#n#i9MjFF# z&~*o?SvXdKj;6WH>bQu`mb1vF8?h~iTsB9~nLX#9Du8~H zT7<4?*k+ct##u~lJ_|#$sniCMLc=yp3}NAUp8shb7~QgE%Zs*UGi^#YlS|!X%~ott z#1sV#*?@{A!_|WfjP1qsC(vm{AXXu!Ws-8zWYQTNE6x7?x5sb4{g=O6y?XUZp!z?_0RYEwrp!BM-n9!C zExfF|yL)D#P-w7iOBkj>5+~l^;9&py^&6gEwQAKvLqkIwKhDPVlmL!U%C_w(g+ie% xola-sII34F)xnXGk^R63pFqa}{6F-c0RXc6%Sku)jwk>C002ovPDHLkV1n7eb7lYl literal 0 HcmV?d00001 diff --git a/src/server/web/icons/g_pda.png b/src/server/web/icons/g_pda.png new file mode 100755 index 0000000000000000000000000000000000000000..d52e91939c0992964ac47487570e61a4b125dc14 GIT binary patch literal 4843 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 RsYU<*002ovPDHLkV1oAk1+oAD literal 0 HcmV?d00001 diff --git a/src/server/web/icons/globe.gif b/src/server/web/icons/globe.gif new file mode 100755 index 0000000000000000000000000000000000000000..97aa7687d80eac66ddfcd3a2aa3e78520c72a83a GIT binary patch literal 648 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 HnB=Vi8chlp literal 0 HcmV?d00001 diff --git a/src/server/web/icons/monitor.gif b/src/server/web/icons/monitor.gif new file mode 100755 index 0000000000000000000000000000000000000000..8fdec6dad0275d2ffd351639b218f87a88c605c6 GIT binary patch literal 395 zcmV;60d)RHNk%w1VITk?05bppA^8LW000dDEC2ui03ZM$0D}Mk0GXMY%*@Q)-Q9P0 zcL13)|Ns9pGc&5HsxxNHnVHO0RaJBV8UvIur-fr%)pR06Us}s>}cY literal 0 HcmV?d00001 diff --git a/src/server/web/icons/msw.png b/src/server/web/icons/msw.png new file mode 100755 index 0000000000000000000000000000000000000000..421b4e732ea213633b097475e0c9986045931729 GIT binary patch literal 991 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 ZA5JwjirulC(~v)VZ>Pxgjt&L}YXH2)heQAX literal 0 HcmV?d00001 diff --git a/src/server/web/icons/workgroup.png b/src/server/web/icons/workgroup.png new file mode 100755 index 0000000000000000000000000000000000000000..612f060b0f733da259b5524692c00421f1329e33 GIT binary patch literal 1178 zcmV;L1ZDe)P)OBwX!A{Z}dl0<11x+)r-h1`c z_v(Gs13Vu8_d%ZLjaMp_ca>6RXdAwXh(zRs4FL6ez3bI#bvd4>TrR)r`~KzAzQaVZ zJOltD!nIoMD^n;GUV3_R^0WDwnN)}y4<2H*zOx441OV&oC-bk&zo<#4%Co+@4&V3x zFd{C{iFK z=V4)lE<`9Hm?H+H+X8Pl!9*aXKuX2V5+KYFc7O;}-@!RQ5x~}93m5>36g24*n-LMP zFjyD@fq?-ti(zImBFMu50>DMjBZg0$Tmoj;tWDj1iqvrlM1(vr##FlCyuu?(;Cz=F z04s)YbOt;K#`W1<34j$8(AOCZS3JUE@<`< zawuesdD9s4U6Rw{;vzcXB;I-N(~%|i#~-fY_S%;yl}f19Y6!#djE}YUiecuTthFBl z&=Gk8KxZU(x%0G&gDi0swt^@4~zaL#=#BE493Ei?aWn7PT!SBHVQ zTyAD|cJ}*XvAEc1G%&D&on1FFfc6m~m&;u!l}hkDuM&pg2i0ozt;55^n*ewS!kiA& zTE7+q0fHd7?VQVIi!yg-+aZ@#P?T=*{y-441k&vuHJi;HB9iD*dIP{605)oNHqlAW zMkP?)Zg;uc?fwG5C!%>Zj&HYi34lOrf>s2jfVg0a96yc)&PBg_8e<}B&1UmTjP|(7 z2mlNj;FytP&dfrvblhH+W1i<;@&Hi=e5_c#^IT1|SU+Yv0uTTorBsH6z&bzrhla|4 zndP7SOwzp*dkYJJ)#v~eWfK)M4S*9HVIi;?`%f8&-(aNWPfWPgkpVcqn|NuB$^f{1 z6SV$z;@sTa99pdw_V)IY(Eob|0MxCu>(<)B>9YX<+uPf7)>;>a;pVCNh(P%{MZ=6< z-b$siFg-o}(fKA*q3v9a-ayWKvB0Z5lD#k?1Z6ai4a?_Zvpnp*ZeZ_GId zB7)W$olfUoyz#T20>KqJve-I3<^TWy07*qoM6N<$g2SR6HUIzs literal 0 HcmV?d00001 diff --git a/src/server/web/images/arrows/off/arrow_back.png b/src/server/web/images/arrows/off/arrow_back.png new file mode 100755 index 0000000000000000000000000000000000000000..8263674edc290f49a7cc223eeba16278e1dea951 GIT binary patch literal 310 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`oCO|{#S9GG!XV7ZFl&wkP>?0v z(btiIVPjv-@4(4GzCyA`kS_y6l_~>6Lo)-z&;LOBB?CjL0RzLU1O^7H84L{K`IF+0 zx&hU$@pN$vskn7zvLWAL1s+%X(EdjgRh`dG=)CC411OCt3|(thXu!&fb!^ zO4U2z@%nbdHkGJ1ZEo3OJFd?bIAr&K&-|6mtA2?x{@(Y$cY)r!U3^QY*m8bzdC!uu z*7ckuL&Dm-D$`RfRTdQUz1|g9$7@f1PFMR`vepOCHY|Ra4fVY5e(r{{@{75)6yfQYsQS*53fSo59o7&t;ucLK6Ui C4s*Q# literal 0 HcmV?d00001 diff --git a/src/server/web/images/arrows/off/arrow_down.png b/src/server/web/images/arrows/off/arrow_down.png new file mode 100755 index 0000000000000000000000000000000000000000..8c73d102a7c276c78ab37c895e908d0297db8052 GIT binary patch literal 308 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`oCO|{#S9GG!XV7ZFl&wkP>?0v z(btiIVPjv-@4(4GzCyA`kS_y6l_~>6Lo)-z&;LOBB?CjL0RzLU1O^7H84L{K`IF+0 zx&hU$@^oskcny_>4X#E=#ze5T+W@BS&9t{?2VcI&%Pouk2)ZVoZSUly$I zZP#pFv6XN0wL{hWP2IW-oitemC6`Tc>iM|#S1S7%A5GPawTem?qLi1iq%C{vnv{0R z@~}knoXo`cGbcXlUo8H~^kBW*?0v z(btiIVPjv-@4(4GzCyA`kS_y6l_~>6Lo)-z&;LOBB?CjL0RzLU1O^7H84L{K`IF+0 zx&hU$^K@|xskn6|*pch7g1{Wz%GPv$L(3-*j6cn;ZQC!{^2fQRhcm}t*G)L;)k^N_ z8G>yy?@o1LvHj|hUdqj*T5#^_`}H*;lg|9v%bcC7`Ngm)r1!DK2A$JuPXq{GHktcj z-}`*KV;ZG%)SS-!+;+V*ca90)mTT&Bf|wY39&@~}HNN1c&{A;7OY_X<9s#BqGhg{$ zWeQn$!czU1M9yutv}LOmgDOw$zr*bP0l+XkK DxC?Q& literal 0 HcmV?d00001 diff --git a/src/server/web/images/arrows/off/arrow_top.png b/src/server/web/images/arrows/off/arrow_top.png new file mode 100755 index 0000000000000000000000000000000000000000..2694fc58eca83378a60abecb12ab21752c5f9745 GIT binary patch literal 305 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`oCO|{#S9GG!XV7ZFl&wkP>?0v z(btiIVPjv-@4(4GzCyA`kS_y6l_~>6Lo)-z&;LOBB?CjL0RzLU1O^7H84L{K`IF+0 zx&hTL_jGX#skn7z@2|PqsNfpb3{VlTHt+c^PRdTi{}T<6rB6px`rWXEvxbO4cF#5 zr8Tq&ESTc7c58bOmtu?RlNrL6=?o3meyNuqWjrdud0=|8|JTfa6PGqGEBhEG-(z&_ vOR45l5r@Y*JiS|1S*(@noM-Rzo{`}Pk7w&7A!Zw(lNmf+{an^LB{Ts5{bp$M literal 0 HcmV?d00001 diff --git a/src/server/web/images/arrows/on/arrow_back.png b/src/server/web/images/arrows/on/arrow_back.png new file mode 100755 index 0000000000000000000000000000000000000000..2a8890eb4deeb20b9f16cc988d86a8757f74d66c GIT binary patch literal 283 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Ea{HEjtmUzPnffIy#(?lOI#yL zg7ec#$`gxH85~pclTsBta}(23gHjVyDhp4h+5i=;^>lFzskoK&=l_3uX4QtyMkj}j zj5;Ug>{z+`;?u-`$u43sQ{H+_;r_RJ#_mbam{QJix%u(b*Zp@b=Vad1y+QIryw~w* z53jGkpTO7A%QG+5vgbPM|HZa%B+Ksn^eodc(7RhW;h<|{>%-^$_Y-)Ml#`nh8F&)i z5_10V7j8(pQSp`g@G0B$kJgM+gc2>vPU)q5`~P*i-Cy>LJFYYsC>I5(smmJh{oMm} d6ayn0!x8zEX&aVI$^bf?!PC{xWt~$(698bLZ>|6U literal 0 HcmV?d00001 diff --git a/src/server/web/images/arrows/on/arrow_down.png b/src/server/web/images/arrows/on/arrow_down.png new file mode 100755 index 0000000000000000000000000000000000000000..12ba77067f7ff2a40772b7109492fe50962abf2f GIT binary patch literal 287 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Ea{HEjtmUzPnffIy#(?lOI#yL zg7ec#$`gxH85~pclTsBta}(23gHjVyDhp4h+5i=8^mK6yskoK&=l_3uX4QtyMkj}j zj5;Ug>{z)w(I@9$5{qE>rr1L12A+^Jf?V(C-0_{mJ>lT}{r^3_Ga3E({98Yg?ZDrE zzrV|~$rSZeBp*C}wa+o)Xw$>*>+K789yK57>~uS(yPMx|#)(Y^f0(jb5(VT{`tq#9 z#2FTM7C!%{%#-#hC*iiENe91>x|L$1$a~wGo`X)ElNnteU*ahfDvERP@;JeGyd%vb gkGU-^jfum6A^N^obBSMU4bbrnp00i_>zopr0B_lC>Hq)$ literal 0 HcmV?d00001 diff --git a/src/server/web/images/arrows/on/arrow_next.png b/src/server/web/images/arrows/on/arrow_next.png new file mode 100755 index 0000000000000000000000000000000000000000..a1dafb9612cd62b092237f39801c41a2c9f3aa17 GIT binary patch literal 285 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Ea{HEjtmUzPnffIy#(?lOI#yL zg7ec#$`gxH85~pclTsBta}(23gHjVyDhp4h+5i=;_jGX#skoK&=l_3uX4QtyMkj}j zj5;Ug>{z+`;?u-`$u43sQ{H;*;SM{iTW{~)eG=$&22WQ%mvv4FO#qW%cP{_{ literal 0 HcmV?d00001 diff --git a/src/server/web/images/arrows/on/arrow_top.png b/src/server/web/images/arrows/on/arrow_top.png new file mode 100755 index 0000000000000000000000000000000000000000..f65b7036398edca2ebc6ac57ff85acc8a0d90c86 GIT binary patch literal 285 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Ea{HEjtmUzPnffIy#(?lOI#yL zg7ec#$`gxH85~pclTsBta}(23gHjVyDhp4h+5i=;_jGX#skoK&=l_3uX4QtyMkj}j zj5;Ug>{z+`;#0?e$u43MQ{H-Q;r_RJ#_mHriZ{9ci~7!y{P*wgafU@7C7aGR{NMD8 zkEg!we`~UU{B*?^Y=8Q{mZcO-NKEoVE=MxOMLBlK0_W9ih-Et7yd| z(YTO@?`!=2e+LXrzDQn7W?9Xh@W4Do+4CiXWX0;@LpQVIADA@=TIwsPs^lo1>(Es+ g547?>G8yia?Zv-g4z P&~pr)u6{1-oD!M<&+viw literal 0 HcmV?d00001 diff --git a/src/server/web/images/e0e0ff.10px.bl.jpg b/src/server/web/images/e0e0ff.10px.bl.jpg new file mode 100755 index 0000000000000000000000000000000000000000..cc1f38da6aec684a02a11f8c1cfe1f421180de49 GIT binary patch literal 718 zcmex=_1P|rX?qqI0P zFI~aY%U!`Mz|~!$%*;qrMU_b4?usLlYAdd38%$3nLpnV-q8g zA&i`yoIKn-61=<;Mv5|uMkIs(2N(o77`Pa?m>HEAm;@P_1sVSzVUP#6M4GWKmj7kOu zR(eKeR&hybS$RceRdY*gTYE=m*QCi)rcRqaW9F z9X@jO*zpr5PhGlvWX5a=%^78Yg}c96dqnaY8fS&)TQ(U48ZF_1m6P*};Rkwe63;=+vwIhBorK8Pk2 zUE~r|F?p!^5#%+n&xrF_6Inikdko>PTMRtRjKIia7G$tz_}00|(Cg&w?Uxp>wLZ#r Wvy)j_!fwvB)Y3ySr=D#7e-i*0jqij2 literal 0 HcmV?d00001 diff --git a/src/server/web/images/e0e0ff.10px.br.jpg b/src/server/web/images/e0e0ff.10px.br.jpg new file mode 100755 index 0000000000000000000000000000000000000000..8464b6f8c120df2e10c38196e6621b974d3a3f5e GIT binary patch literal 720 zcmex=_1P|rX?qqI0P zFI~aY%U!`Mz|~!$%*;qrMU_b4?usLlYAdd38%$3nLpnV-q8g zA&i`yoIKn-61=<;Mv5|uMkIs(2N(o77`Pa?m>HEAm;@P_1sVSzVUP#6M4GWKmj7kOu zR(eKeR&hybS$RceRdY*gTYE=m*QCi)rcRqaW9F z9X@jO*zpr5PhGlvWX5a=%^78Yg}c96dqnaY8fS&)TQ(U48ZF_1m6P*};Rkwe63;=+vwIhBorK8Pk2 zUE~r|F?p!^5#%+n&xrF_6Inikdko>PTMRtRjKIia7G$tz_~x}~o6)A`sgjZh&x&bD X6;I$3SGEs~3cVPVr*~pX|Nol+w_xn9 literal 0 HcmV?d00001 diff --git a/src/server/web/images/e0e0ff.10px.tl.jpg b/src/server/web/images/e0e0ff.10px.tl.jpg new file mode 100755 index 0000000000000000000000000000000000000000..74753f0752c630c66eb6549dcc0e889286cfa4c6 GIT binary patch literal 711 zcmex=_1P|rX?qqI0P zFI~aY%U!`Mz|~!$%*;qrMU_b4?usLlYAdd38%$3nLpnV-q8g zA&i`yoIKn-61=<;Mv5|uMkIs(2N(o77`Pa?m>HEAm;@P_1sVSzVUP#6M4GWKmj7kOu zR(eKeR&hybS$RceRdY*gTYE=m*QCi)rcRqaW9F z9X@jO*zpr5PhGlvWX5a=%^78Yg}c96dqnaY8fS&)TQ(U48ZF_1m6P*};Rkwe63;=+vwIhBorK8Pk2 zUE~r|F?p!^5#%+n&xrF_6Inikdko>PTMRtRjKIia7G$tz`1X7C^3Pn#xq%0jSDFTO OX>T$N40D literal 0 HcmV?d00001 diff --git a/src/server/web/images/e0e0ff.10px.tr.jpg b/src/server/web/images/e0e0ff.10px.tr.jpg new file mode 100755 index 0000000000000000000000000000000000000000..2dfeab3a61f7d1e441fbb1cf5365444136b540db GIT binary patch literal 717 zcmex=_1P|rX?qqI0P zFI~aY%U!`Mz|~!$%*;qrMU_b4?usLlYAdd38%$3nLpnV-q8g zA&i`yoIKn-61=<;Mv5|uMkIs(2N(o77`Pa?m>HEAm;@P_1sVSzVUP#6M4GWKmj7kOu zR(eKeR&hybS$RceRdY*gTYE=m*QCi)rcRqaW9F z9X@jO*zpr5PhGlvWX5a=%^78Yg}c96dqnaY8fS&)TQ(U48ZF_1m6P*};Rkwe63;=+vwIhBorK8Pk2 zUE~r|F?p!^5#%+n&xrF_6Inikdko>PTMRtRjKIia7G$tz_|~y(lJX~Wxw)%;-E#^N Vx?%Ao;bY{K@Q?*de9!;C2>>YYFc2LV<4p;LLfV4_yjCCqFS7L+as;2DSLhYI&B6{)4?;7#?`IV*u!SvFL-*w$lkv?54Fquwry)+;u{mddig7133-9&H418W3SUZjwj&By6h#BivW$_|fCkMMw?G2( zeVptR7&#~)&+X~LVlfv&0D*?#QXbcc+XA9#Sg=|h_-4ZboH^&vG|jL^oU}q59T2w# zzV~|w>e}Iy#2ao49304zgV7m$?sjmu-8!5rbiiE)XV2gZlc1^`E^dY0g6U2TP0sKe z%{?I7pdA=41J^Dkklwf^Znq$)lRg8()l^xrNj|-aUXmo^$MN^qh?pZLhl6#0B<``mco#R{r~^~07*qoM6N<$f~1(fhX4Qo literal 0 HcmV?d00001 diff --git a/src/server/web/images/help16.png b/src/server/web/images/help16.png new file mode 100755 index 0000000000000000000000000000000000000000..1ea4400e4e037b1cb4978d0ba7c18a6be7f0ab6c GIT binary patch literal 860 zcmV-i1Ec(jP)J<^u4$aOjXz@N&hghB3j;#k;2D3zGd(}}kBEN{ z^Yio3Cr`~?G>q^fLgWYnf`GE`55K=tEL`8%*l0dfAcT;wzP9{!EbhD~goyPA1N@(a-Llel!;?crvoIZmJBNThJvg8o63*x@f^ zI=3)%4Mnp0+3F{6RIAlM0a#vsefg1G?)^RjckyMgXG!k;mRM@}(z>vK~61BzoWP)|L>1VtWieu_4J zf^j*hsq?*s?v+=kyWWM*gB*OJI-sNO$= zDE)wCS-GX9rAJlUwqv@k(;fQM>jvr&hBAvUJ3LlcVKSG(%b&%ZdzKLiLp6j}ji81? z%+8(|m4m^6k;n)kDF`1u!0UieAgp_s=``)wILg!KNu(vV0~1yqLlH!6n`W~ylDwY1++utjUjg3#K zhc#ZZzNU~|q#u2Pt~rTjD6~5eaa*K*-^S>)anfn_DwVtI>+5$^V7Rlhb45sHbs{xE zx9gIqev8siFc`!TLZaVpA=@oXpltN+o#cnHClnqUSF>cQKI|T{KNIHxdbpP)I9# mp1XPD%P+34t*tfrKluxGbtTaz{Khr_0000ZrBFoz{h*Ss)u<5*q9}bqHq{iHu()oTENNypO?PLrlVt9l**i1$<@jNn#fp|F z^nt_qa(I6H|L2_N51(*}dpV?(l9Q8@Ua3^7NGS<|;MVf;@|`dY)BhV#EEY45Jo@ON zTCIN4%4EKnv8+)cmBbj5G)bc*FV$`pNi? z$!Fpy!Wcs@@6x}2KVsrx2AwRS51U=+^bI0Dx zs<)3gZBth*l$5yc(Cp02jQ`eK=l-${s8lM|Ck`AuV>{WrNmKmMouqr8AzAk+&b`ci zWkbo1>EsF+5hKW!2%d46ukYw%Nmfj?d%XjB7~st)al&b@-C%H-&BbV$fQku;Rif0?yz%u znx$*Y$cLVwFgZa!0VBYO5p;M7trSXGyS5c*t(1}yr4%AI_?wWkL23{REDgCUudu@n zkvh-92ODG#eiKpfC^--hpw|bx2TE&{rO9ZewgK5})+i-WN>UxH(+#&2*z!Y&h9NJD z7Dc*og8cF!#E3^Z50fU< z2^kwK`rx=|*8|hR9Reo{QbA&%jgo>dB(G5| z_ZY-r06PnAxXwgQF`Bh7!7ZeOD1sn>G>xdw{~5>9s7oq?gl&ywT@3>0{k8l4VAz|g>__P2BBZh)1~GhD6G z_I+9#8*glXw6(Rh<=NT$zGi3ae5q6-Nm6t&px#;H)8zoSVxj883`!;X1rMzRS^p;W z#w7}Wzkrj(IF3WDHcYSAV|~5ZKKtumeQRZ9CDZ_|R%>H^{^AP{KJ@uh?I2+Hu4#Nf zAWaj*#tq!oDh7kH9fT01(Ev*+gb*ml#?EA@)rRr?0N)Q-ZZuw)o11HWWEL$fEL@nH znwrv9X3yGMli}eiBefbzYlIMJrO-m4fQ)5fX-(dBsgKksm&^EmK)2iFy{lKxoI3U6 z?{&Lf^AP}$Ub%Al_v7Q^m3-d)+|8RCqS;)>v2BV)kD^z^^9mF_k7Cio^E|SSL%-jr z*Y6WYF^m6LIDPu`&z@~G8u7;l&WRIG9i7}c{bH$9-fdYHw&Rd>9300Xn{{w(8{6Kp zCSzwUn28Ag}$1ankp2F#fp?tbUK|@qtUph(Er5ipQ2ni9;dK{{Qv*} M07*qoM6N<$f{hF35&!@I literal 0 HcmV?d00001 diff --git a/src/server/web/images/help32.png b/src/server/web/images/help32.png new file mode 100755 index 0000000000000000000000000000000000000000..d073505f1a57861bd204857321184e14d032f1be GIT binary patch literal 2283 zcmV{tQIA`+B#0csXVRYHNZRh!VL(9+O4ty3p)ni#)s{C>>bJ9B5|uoz>tG%YQ# zgCm_8X=XI%_nq&5zVkouzuv^h{N5fI7}&OHQ_n!5SnLr(l!OpyrI(ghmd5@zHumPw z(9nf244eN=0JU%b{{7pw^?xmw%O7mX<+`Ml#BqX25)xz59|?h!f=0bQ8^`f8*REbU zdg|1vmw@Eo1rURSgZp>w-t*)3_R1YX2oWbSah#AOX*b5KcYyR}Fo0v*L{a$i_}JL@ zPM$pR(g#L&!;yt>K7Z)Y4{zN&cqCsa_9Z3}%_t&@BjP9qAuvD`#~5RfN+PAgm;?j} z0dW!|q}+362~ivqMG?jr{6;`? z<7R?tA5FJPVwGryf^c~mu~H+qe3iodCGxIKk|anWky4V)W(XSf-~H~H-#&cd!UgZc z0Gz{zA3e5h$BswiwSl83CWvCZ?R(IlI7l3~6Rtp5hoBCPIs^fP0W=dpE>o!efqw5* za<)pfp%mFn25)uwNW1u^e{e*}Is|-%PGCLaSqtQX+()SSs~z+OVPd z$}4|9^FDw|rLyI-2S4|#OeX6Z3??ynmQ8f%8%VJcv#3gfc9vd55csGDJc<`PdZ0+BE zr!j`aBs3Gl%4fcSF&jw&h+p_Qdpa{@G8qu?+DyRgjzcWB-%Ndcn5;|?QesDQ!e(@Oqxdza(sb}*8=^{!m{^ou{y_Kk*=DXle z5GM&i5HLM8%}mFAT$|s)gnt_=Eqf@nwo)pVD3(f;l5vWyP%4A8I=EIEL`sDa5|bDT z#o{C7a@hvZ0PXGVTiPp?o_}c42!Xd@FTo;+7@`oCZ+?I`Rg*A*s32G|od^kT{TiF% zi&Ux={JM|pIE;%nN@a+eAQdb`drAB^uw}X`%B`jLojZ39oIQK?H4RX$R{IOZqVWAX zLV!^UPj?e6gESCF;5!Ehnh?bh8;~NVaP=vA>#uVA?SnMxbv)l^bm}_gdkbs^A66Z?!($NK*NT-14=>AfO-R3RE$f4QVOLd zj^hvnLAVYO$1#~qhSk;8R4h?M*(^}=b4Zy^qtqZJ2njk_K?*^m?qlMJW@j%+-vEva zt_zNn3fTbKfvQ+S#Z8pfD5c5ga@75L{O%br*=!c66e>wDD7H4=Vn}Qx2taADR0<$1 zuq&Ok-}w+NmcdbwR5}s)bYRB;tx~NZK)BFZyND$vT5Gh{zO2ILfA}&hX8Fs@b+_*C(e_f9HBTn#>y)%;5cAeDP)|aBM0j)QGk zC@D$e2r1L;I1It_V8w^5YEXXpMO-Oy9T(Tl(AimKZf>5TH{KXoPr=;W+?C16iEFLp z^5*uoHfCmL5kg>mkA3oKI(OX7>+>B5QbAVlxEHBvxON(GU$%v%Fpaz!K~q6TyhzKL z)5yAqa$U66bX3||T3TjmYHD_5WaRuh0N`C58Trkop5Dju`5f)#HWrtbQlk+z=(%)) z-rk*zS8rjO7Mh}!u}mwD3reodW0(rHO$QV&4a4P&XdzH;2CWsXr4mXh78Vzoot-(p zu&@xmXFIM`DqFtwo$sE@W^=`kY6rQN7Ut&{*4@sUQ^Bov5p+}u3PobePSX-KaaUJx zXJ={7)UZ@q@syM(t!Zm3qoiW=$~!a~e&g6LkM25q_Ux7S?1sMYFJ>}sv!|!`u3GIn z2I$?~Lma1a)>>m}g$Np03v*$xlzH}SYfb5v)?~9;Hr&)rk|az_ zOd^2S|9b96$B!R>`i7S5(xpr1I;+*KZIzDQ3kwU>u3x9SyPM8x$GeQ@T69XSKNCWv z!c_`OYg$@b=<4dEt*wovrDYZum%tc?hu=DR^vEy1>3LrAp_c67M-CtB>Fs+kNfLw* zAWV0C@+a@uFRnMathD1?J*bF)M+FySEc0fp}q9|f+ZjPy`Y3AnViNXlSws9Q?$92$_CXQk} z&u4YjqtU3RrCTZLz90Yb%$c7ZJ#yshqobpZkK~Gh_`>k;3t`YW)!N#+wNNPZXsv}* zseK5;CZ6xJ>UsFSPoohK$EoX4N};tTNfO?^aN$qKk3aRr#~*+E$c-HFM?RPwIB?+h z!F~I`+FCB(Q>k=x=5jfdRA|e>acmsN!F3#xIOh7y_1U@E*=L@A{<)(kPMr9U4kjOT zH0$5Kef#bW8#eYhu3J)43NTCK;}h40hu`|xN3;L8zXKf5$_~ly%bNfI002ovPDHLk FV1g24Qd0l` literal 0 HcmV?d00001 diff --git a/src/server/web/images/info.gif b/src/server/web/images/info.gif new file mode 100755 index 0000000000000000000000000000000000000000..13b16470805148c73a2bcf41b9d44934586dc323 GIT binary patch literal 166 zcmZ?wbhEHb6krfwc+AeQ|NK)1+ZhX9{eS-J|EVwk^9u4A&iuy%6o0ZXGB9v3=r8~Q z$P5OSV1b2BtCtqd+spW%IWXf6Bg;XvHA#W9UToZSC3+pp#eL~kPj*GEEN5VgRamsq vG+LAO!nA`P9~{;%>O9zRw`#MH*O#V~J}e2FcQweZyx;nz+BV#sfx#L8_K8-S literal 0 HcmV?d00001 diff --git a/src/server/web/images/info12.gif b/src/server/web/images/info12.gif new file mode 100755 index 0000000000000000000000000000000000000000..2f3000b67ef64f055c2d33509dd76412af24ac86 GIT binary patch literal 163 zcmZ?wbhEHbDxO@5rFev_HVPs(7V9;Rz0+8VhEan1JJvAq(Hw&DTI5tH#`a|QR8MQ7E qJ*tYk4b-<^mgIKokYJN5h}hv%HT99JQh?rc*89b;<|rvKSOWmd225T6 literal 0 HcmV?d00001 diff --git a/src/server/web/images/info12g.gif b/src/server/web/images/info12g.gif new file mode 100755 index 0000000000000000000000000000000000000000..86620055ff02a0c582b9bf84cb7c63f550900950 GIT binary patch literal 156 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 literal 0 HcmV?d00001 diff --git a/src/server/web/images/iphone/chevron_touched.png b/src/server/web/images/iphone/chevron_touched.png new file mode 100755 index 0000000000000000000000000000000000000000..a63fa2e295250bc83d2b4c2eef9c7b236f217339 GIT binary patch literal 333 zcmV-T0kZyyP)wH;FB2#k*@?MLz!c z&j16APv3l&66OK2Y!4@49Q3>xl%MZq3?^y)KQ^wD>Ic#tr!W+}9g{Ng|L)#GpcAHV%) f{LcVE009O72SsfQ1oXDV00000NkvXXu0mjf$BUGF literal 0 HcmV?d00001 diff --git a/src/server/web/images/iphone/header_middle.png b/src/server/web/images/iphone/header_middle.png new file mode 100755 index 0000000000000000000000000000000000000000..f18815b7a963e57b0f7a7553439df4b218ed2b61 GIT binary patch literal 357 zcmV-r0h<1aP)GZs%Gd;JL&t-;lZU;v|#eu+fP{!6}z@9(M zkgWIfAk}=h8C^~%)H#HZtV_;T1yDSr z1<%~X^wgl##FWaylc_d9MUkE^jv*DdLe6>fH8^lEUzjHO_@(VSY5TQYi#xSHX$ahy zZp!c_t@W+NIZfMa|NNdc6E>TDRp;MvX7~JS*~@CPzMS4;>}fe&tghP3-hO-L72AX} foBwIVGx0E_%Q-I(Tr7PBXbFR-tDnm{r-UW|L+3!7 literal 0 HcmV?d00001 diff --git a/src/server/web/images/lights/Thumbs.db b/src/server/web/images/lights/Thumbs.db new file mode 100755 index 0000000000000000000000000000000000000000..eabaaf472f2d6fbc8f56616edf84c40fc5551149 GIT binary patch literal 15872 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 Syn~W|w=iD719*olGJ`u;t`yNl;=&&qe^akU zr5EDB*znR#)vK4(tB!WPUg@2sL7?S+tFbDh$!IXFTWrV}F#3$qo!E6g$iU%pxlp}c zC*SvN!!SC9LZO(?=P8{|3vsjASj*+o3d7Joolb4$_LwU<5#S(so@bk;=~gNg%H?vB zJfF|9CzDAkm&*_=PN!3sxd`|0&~L=5rfHp0sYIz%N(7$)IdH&5%|qaLJT|l0Y!Pqb z^GkpOE@~bEtlr3EGITf`{uBTQT+}=~;Dj}w&uP2e68j(o?D2S9JV4QIx1;rXEjwC4 zjVd69tyU`vg5c%cW3d<|5(%kM1%|9@ac>yeO971b_60+Aj01kNg(N#Hjz3#`N2E1; zC2G_u^cTF)2Gjw#t>PXB2VB&s_h1x7QF}6((0;#{K4Bns^^6=i;G#wyBh_lP9=q&} z$K%CpHj|0yx-P&OG33Aj_ui)bOrI_HUq91V*ZCEAXZ;8;02?$hzPLAPUH||907*qo IM6N<$f*?ZUEC2ui literal 0 HcmV?d00001 diff --git a/src/server/web/images/lights/a0.png b/src/server/web/images/lights/a0.png new file mode 100755 index 0000000000000000000000000000000000000000..08f8b8c25a23734b28abe4b90f809d770d592600 GIT binary patch literal 542 zcmV+(0^$9MP)&_j|AFb@eFc^O>F*3Ix($Y4ciwBgc{D&@XEZjtWPaqjd$=UTUNw zIh{_F$z-Tntr}LVwHS>?BjIqE{C>XxXS10;91itaTUOVB>f^CM*_9F&2xF&*!7V;cz#w2Mn;_fGYxA zRxTI}M!a4x@`nKou;APTSUsz08trzwKLvmR794QZO9lF9G@@>|OHQYg_%39&+wI~V zr1g3Y?=rhwF5#F3a1XRtENDC)KkU2BW+R8gAsn+ngHO}pZ?#%I6mYxUQW-cm0rpej z9_yh{h!jPU8^1SHRTXQD6^^-ra&}-Jh*itu-R;gu>){!U10yM?RHzZ zJQDGVGBKNT>;VHTIOaA|GMOy#lg&4q%|WNrq4|6+ry`JJ4ST=$Jq?-|0H^Tzy ziGbX$BfV(UpbAG~akV1KE5K}J2=;uK_5;l8tq&a@65Aveaz85&9or6SV!GULmbV~F zOJmzjJ1rznmoWWyou*Ciz(8^$NwAg*@5ou&fSf4U3jiD^yCU$3#qE^)D-kD7e^68to4iv(0b0h zFYndTf(ro;X_}7zyOeM|iO$Qr_2f_CtnCMWJcz-|rY_;CAL1D0n6YeZZ{_G7+(eN% zY&`}T^g_5YfpRpI%tYTD;~X>0vL}CxSYJo8*ERL~JMFigBlNp5C5Pf~j&Y6|X0^^e nrmMZbJ*Lgm>@ECfdgmOg-u*x8Gng`$XHRtZt! zYRvBJkLQkYi4aogz#-Y0@0`6ecSq%Uj{gj01NJtC=a#8$YK!s*bC=W!bxd6q1iFFx38+z1vNhp%*=d)udjao{OsqgRvpGP$TrDB|5Om~tP56GmCB*B zv;;jjH?rKU(?NQDjXVr@`PeKSo!bzk#w=&RzEi6~S1LdpkCdzlBdmDDYXeLiZ)0|L zK~GKs{r*^4hOG5)*fU7tc&j`$1$=xkQjb6OEQ3q7M-QJGHo!!YZyp~JF+i8gaHUkf zNtH_0le7GkYe^U)>-B6E;wdUHvPWZ(bi2sf?Xd-DhL$MnDFUMCQhA>5F*#9cY=FxO z$y(3w8JvVc;7_yfYVci*e7obonV3K~2&`wg3&$@(@MO3@kLgx~e`zo;jAiL50@%~5 z`17;Ty1z%C2jy`aE=?{wVkH5blQm(46;Bb6BnehmR+{hp!tQQvo>~tN=)Ju`vt=Ur yFLSacjIiP3UH!ouR`=lAT{vl};VeEIUl!ouRtojadCecHBd+kyoPPMtdS z?%g|}ArPSWpWDwhB-q(8z|~04fSC~}s`yXJxhOTUBsE2$JhLQ2Au%hlA}2pFMK3ci zEuTU0CkrPxP?ZiyKgf{`thx#ceJPpqmMq|Ubc$)6gFv&z8PkHx)%R}in9s-lM6i9! zBZm__dd2Imak;LY=7h}zm4rkI)`WR0GG*E)?mKYn(8@QLmiIn?v-kDx2z`w?tc})! zof1sgG@1de?oQNs+@Zp$B*l}wBx#YxN$K-jdS4q!9hlC1plNUP#}nRyjb|@j-XZKa z^H3#V%=s`!CV{ zGZTv~S)?jgU+dnbH8)5Rn@L8H@VK@q;+ad}wo4-xl69peI z>rMAn>7QZ36tBx*W_EhPz6U`Z*qo#fG3yD?Ju5c7TU8{Z8nlJ?f$93++hq!-bARhP dGOMsv=2x69g9)2++Z`3#dv5h=E26FfcG1 zbL_hF&)}42ws10s6^G;;cE1^EoUR)U5A70}d2pLv!jVIT7j&Z~EblI3x0K*v_sV|m z0kj3v921Z^em#l`(k(o@H$3ZdDRc@9NidXDNbqrumReCGv$gd8+e8WW28HVqkJ_9i zH>s*<31KtHjANIPvi2#*6BEu%3Dak5O_t&NBI)H?V$TxT}#l{vOTn5naXTfF^&~Hhq+NX@#Ccc>y7T?;vjI&jdhsDsPJyAw*m0Qz>i}K7# zL9w50Ng{fT}A5JUe8lRK1h7_Y2;BWJDd=c6f&i?Wv5(5q?6|P zQw{>maxZP<537OA37Uk}7@%_$4o$EWe_Zl>&#id|lE-BpDC#+Fn|msJ%_2h{Hg1vP z#N8WAzfWasG}yq|xqE)DrWaOofX=z|?*pgc%{ig5vl!pqDlC|q&~Z0$&Rvsft&VO- z4MZj+%-+Vx%W}v;V76hyp=;+R;x+~t^Q%*xuFTQAF2})fSfTHDAs>sO!OBw`)&)o$ c0!CNZt))x~rAZP^^P&YOFfdqy5)K#u0POD40{{R3 literal 0 HcmV?d00001 diff --git a/src/server/web/images/loading/small-circle-lines.gif b/src/server/web/images/loading/small-circle-lines.gif new file mode 100644 index 0000000000000000000000000000000000000000..5b33f7e54f4e55b6b8774d86d96895db9af044b4 GIT binary patch literal 1849 zcma*odr(tX9tZI2z31lM+(&YVk%mZ}5P~KlG2s=WSbGzm0!x7^P##Mnh7t-jP!X0Q zk_SQ}Po-L1tlDK;6l?(>v)e5ZBQx4|Y-Q?nr@Px3?9h(3ZWr3^tj=`TP57gKr87N$ zp2wWee1GRRCwo_xahnw)5cxNPJbCg2L6DV|6`#+yw6v6!mDS$f9-JvFD^n;GQ&UrZ zzh5jCkByB101O60U0q#p_1BM>Cv-vP?&s4@g_((4_1L=L$(a91)0=J91Gas#R{McE znYG^9*0A5YZ>#;~+Wkn(W5B0^yELIYLP!K}mB~<)AM@1&nqekynuaEGqPrzoH|KodRXJy)%+w_fu3nE5>@Bd_b zqC$EQ;{c`T&?EsNO|igL9gC7Ygxv?aQUEXMq?~>wg{EyW;VcJ37CUF#HjrT=KQO_* zS>M9yydXk18D(+QDJ1>r);Lav_uYKp$T?4vr{Q$lTo&pKv^?(>L-)G2*lwH!Ah7k? z7oH<8h-(KTKt5V6$8gF)C7Io&P5=SjTh)=zV=E2EUhQZP##L8S{d%UK>>+y82>+FV+#^BzW7u3F)Bb>=lYQ%%j`F>ASe zo*cw@V#u6T`A2He;70mR(V&iV&-7{qP~=SRf&jm9-T{*ZeZ}$rd0#6c&fLG^xJcf5 z+p<`wJYgW+_s*V{uI$nMB;%8`S_3>PfGOj3Rq}@Cx^+j?rk92fANSFDBYnOqQ>Vdj z)(|$AhP4t&Lb=Gvo2#3Gl%9<=Gv`Mz?Po@P4iLF!x}GUWJICDlFk-hS^Whyh7x~VH z@0vD1>HYD4&e+~yzS*-sFR{9`{QEEZO1zg7>R&7cHts-6j!xHVdA8eI+ZlVzd%`es zJT@$#GX(gvCJ1oJN%yLBK}{V=V;seo;!w|Yte!W1%5qLNFWqvZW>h&IiH+oPT=b@E zPhGzv5=(Un*X>v`>%8h_nj^NdYcE6NHS_ifkCV$*D)Tqrbu`s;<=t<4 zAHNqNV?6(g<1PY-w@#I-WYFViz?9TrkMr)u0g`O`u|>T;k|2sV*YF^punvT;$SuTy{j3Gv)yqD!R_CF>yR)MzmmYS5v+~R zXAdD%ng9?df;wd8GxR#%3O+gz};Vo;)sK%Bj-q>Oq%R7JU-KD?vYu>#2UjaDo z&8$>5xW~?KPD_#XFToU1hIb*VOMidUr6iYiO0N|i-7s`T8!cFT`rN!^1Pt78J93i6 z5HI1wIM$94m{3SLDvISDe6$ZG1;eq_D9RTaaC>=cO{@Bs>$IlPCPJJ$h$)-3vzNUQ6OsN#_zWxey!_9%hxwH2_dEJi=yY|1c7nDm2_Lm!Cof8-R_+9UkS zcBE(o47yE)oMR(Q=dp1a2wTX5KvvGyLqlWTa7V&!A*|w|)ax~1_~aJ0=_Lilg*0iQk7#ZD EAHN$8j{pDw literal 0 HcmV?d00001 diff --git a/src/server/web/images/loading/small-kit.gif b/src/server/web/images/loading/small-kit.gif new file mode 100644 index 0000000000000000000000000000000000000000..408af5cf25eabba6e9081adb5cba2755c2b9323c GIT binary patch literal 1079 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 P00000NkvXXu0mjfopRh) literal 0 HcmV?d00001 diff --git a/src/server/web/images/monitor_thumb/nodes.png b/src/server/web/images/monitor_thumb/nodes.png new file mode 100755 index 0000000000000000000000000000000000000000..1267d2378b139e052e538710216756f0f64c806d GIT binary patch literal 1796 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 literal 0 HcmV?d00001 diff --git a/src/server/web/images/options/Thumbs.db b/src/server/web/images/options/Thumbs.db new file mode 100755 index 0000000000000000000000000000000000000000..d49541bceac99384ee95b5c94651f84799c3b0cd GIT binary patch literal 7168 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 literal 0 HcmV?d00001 diff --git a/src/server/web/images/options/action_check.png b/src/server/web/images/options/action_check.png new file mode 100755 index 0000000000000000000000000000000000000000..fdff9338580ad20a4d05ee9919e0bc90097a4f69 GIT binary patch literal 344 zcmV-e0jK_nP)PbXFRCwBA z{Qv(y10{fofkHsB0W2`a+?}b!sE7HNG1+}K$u9V><1Whp!bk=oTmS+vQ_%s?b^kS7 zq!|AE{mUT3Xv%Pf;W6=H0Me}NAjzN7rKSlj*mbqfJ^>lFzskoK&=l_3uX4QtyMyCTz z$y?T0yH5&U)!ZWy$iu)`=9{|653mdKI;Vst0QV|k1poj5 literal 0 HcmV?d00001 diff --git a/src/server/web/images/options/arrow_back.png b/src/server/web/images/options/arrow_back.png new file mode 100755 index 0000000000000000000000000000000000000000..2a8890eb4deeb20b9f16cc988d86a8757f74d66c GIT binary patch literal 283 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Ea{HEjtmUzPnffIy#(?lOI#yL zg7ec#$`gxH85~pclTsBta}(23gHjVyDhp4h+5i=;^>lFzskoK&=l_3uX4QtyMkj}j zj5;Ug>{z+`;?u-`$u43sQ{H+_;r_RJ#_mbam{QJix%u(b*Zp@b=Vad1y+QIryw~w* z53jGkpTO7A%QG+5vgbPM|HZa%B+Ksn^eodc(7RhW;h<|{>%-^$_Y-)Ml#`nh8F&)i z5_10V7j8(pQSp`g@G0B$kJgM+gc2>vPU)q5`~P*i-Cy>LJFYYsC>I5(smmJh{oMm} d6ayn0!x8zEX&aVI$^bf?!PC{xWt~$(698bLZ>|6U literal 0 HcmV?d00001 diff --git a/src/server/web/images/options/arrow_down.png b/src/server/web/images/options/arrow_down.png new file mode 100755 index 0000000000000000000000000000000000000000..12ba77067f7ff2a40772b7109492fe50962abf2f GIT binary patch literal 287 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Ea{HEjtmUzPnffIy#(?lOI#yL zg7ec#$`gxH85~pclTsBta}(23gHjVyDhp4h+5i=8^mK6yskoK&=l_3uX4QtyMkj}j zj5;Ug>{z)w(I@9$5{qE>rr1L12A+^Jf?V(C-0_{mJ>lT}{r^3_Ga3E({98Yg?ZDrE zzrV|~$rSZeBp*C}wa+o)Xw$>*>+K789yK57>~uS(yPMx|#)(Y^f0(jb5(VT{`tq#9 z#2FTM7C!%{%#-#hC*iiENe91>x|L$1$a~wGo`X)ElNnteU*ahfDvERP@;JeGyd%vb gkGU-^jfum6A^N^obBSMU4bbrnp00i_>zopr0B_lC>Hq)$ literal 0 HcmV?d00001 diff --git a/src/server/web/images/options/arrow_next.png b/src/server/web/images/options/arrow_next.png new file mode 100755 index 0000000000000000000000000000000000000000..a1dafb9612cd62b092237f39801c41a2c9f3aa17 GIT binary patch literal 285 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Ea{HEjtmUzPnffIy#(?lOI#yL zg7ec#$`gxH85~pclTsBta}(23gHjVyDhp4h+5i=;_jGX#skoK&=l_3uX4QtyMkj}j zj5;Ug>{z+`;?u-`$u43sQ{H;*;SM{iTW{~)eG=$&22WQ%mvv4FO#qW%cP{_{ literal 0 HcmV?d00001 diff --git a/src/server/web/images/options/arrow_top.png b/src/server/web/images/options/arrow_top.png new file mode 100755 index 0000000000000000000000000000000000000000..f65b7036398edca2ebc6ac57ff85acc8a0d90c86 GIT binary patch literal 285 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Ea{HEjtmUzPnffIy#(?lOI#yL zg7ec#$`gxH85~pclTsBta}(23gHjVyDhp4h+5i=;_jGX#skoK&=l_3uX4QtyMkj}j zj5;Ug>{z+`;#0?e$u43MQ{H-Q;r_RJ#_mHriZ{9ci~7!y{P*wgafU@7C7aGR{NMD8 zkEg!we`~UU{B*?^Y=8Q{mZcO-NKEoVE=MxOMLBlK0_W9ih-Et7yd| z(YTO@?`!=2e+LXrzDQn7W?9Xh@W4Do+4CiXWX0;@LpQVIADA@=TIwsPs^lo1>(Es+ g547?>G8yia?Zv-g4z P&~pr)u6{1-oD!M<&+viw literal 0 HcmV?d00001 diff --git a/src/server/web/images/options/download.png b/src/server/web/images/options/download.png new file mode 100755 index 0000000000000000000000000000000000000000..7e6636ede6c5613eea10eee08c10d4d9783997ac GIT binary patch literal 299 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Ea{HEjtmUzPnffIy#(?lOI#yL zg7ec#$`gxH85~pclTsBta}(23gHjVyDhp4h+5i>p^>lFzskoK&=l_3uX4MAP*$?i_ zT`93lZTI;!m0Jt~7Ye7hZeIVU#%C6{!-Mnp_dls-WU2fA({~DE&xyv4H|3Gpbvu4M zUMyeO#wxt4b6c4sPtvkEJofc}o00|ORs1fn8iYsO`e7XNdy}NzvZIer7yLQl_QsIW zh(Y%J&557>UpmhFf4ZF?!(|0Kv(kjqg`N#2u@(Ep)~D@ZJHT^Lo&S(UGNZTyKf73s urhsgM_e7l|8cJ4*6Pag7Xs|FavN3RMxp1PFWs)DzBMhFdelF{r5}E*R>TyQ^ literal 0 HcmV?d00001 diff --git a/src/server/web/images/options/file.png b/src/server/web/images/options/file.png new file mode 100755 index 0000000000000000000000000000000000000000..ad16a6cf3b5a8b19597df6ef6d9925c58a644e32 GIT binary patch literal 243 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Ea{HEjtmUzPnffIy#(?lOI#yL zg7ec#$`gxH85~pclTsBta}(23gHjVyDhp4h+5i=`db&7aERXy*M9v!8E4ZqL`* z-kSY^qRA>=E3*!L;R>~Up7>6&<*W1=hN#!Kzunu<9OQL>^#}d~?~XrOY_y2Mi9^Q0 otCQK{`8EcT+r2#sr5pwfRl6M?C(Wom3v>{Jr>mdKI;Vst0Co3UlK=n! literal 0 HcmV?d00001 diff --git a/src/server/web/images/options/folder.png b/src/server/web/images/options/folder.png new file mode 100755 index 0000000000000000000000000000000000000000..2190ddd62749df545a3434193f7b8bbfe3b7f506 GIT binary patch literal 293 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Ea{HEjtmUzPnffIy#(?lOI#yL zg7ec#$`gxH85~pclTsBta}(23gHjVyDhp4h+5i=8_jGX#skoK&=l_3uX4QtyMkj+0 zY#SOnE_>@Zh!iCl2wlpMDrQP#@YtN`V;1x2%cPY*oTdpLW>xs``><_W{r+`LH`(mw zS(L`#*!0(alVSn$znZ#Z1y3I+YrGfCOk`jR=Zi~m_{L_(@Ks53z=miE(S3j3^P6%j(NGX&WS z|Dl-S_wU~*7@zB4F8FU6lMPX{nt|chuU{yN+}zy2^sZgI7;qWD@cY9(hJU}V0$HIb zwqgMwS1@82@aOY0hQHtLf!X(W_+ZtkfW;8F0gOy642;aIpwMQ3c?Tajy<{rb5QG7& zTnyLt|7Xy#*Jt>0b0SWS%v{C{R}Nlez;FQ*8xMqL=L0%W2zSZ@$zuz|3tP4`7zITz z{QrB4ftgbUt7b-KHHLHRR)7)^BP{W;pgK<&NLrGVlo>&p32GX#xrz}vDKiduZUhK0 Y0PX%_PSS-n2><{907*qoM6N<$f=@Zh!iCl2ra&8@{HvO!-TZUGjetud8r!wu~kR8joabD_x5U@|8=pfn|W(& z3SaHpkovnm#rXl-pPzqv9=_jRo$&4J<$jKxa(Ntg7~Isv*xb^>+OpOE87ow?i#JqF z7EEN&7C*f8?|;dXH(w?9-I>!7tZY2p@bJ`TaY=)i14oWAFTDA)fluU+?0bdEoJI~F z8Meg>INJW#=NlRnuS(#rOEYaNejV1Zs9#X(D+jZ}IbpU*(^OPd+yc@LO`0Il;mN+B h<%q?Doq`Gn7<%rzyvsiAt_bulgQu&X%Q~loCIB-#gYEzT literal 0 HcmV?d00001 diff --git a/src/server/web/images/options/letter.png b/src/server/web/images/options/letter.png new file mode 100755 index 0000000000000000000000000000000000000000..82be979fa12ad0d987783c18d72f53aa628b7804 GIT binary patch literal 303 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Ea{HEjtmUzPnffIy#(?lOI#yL zg7ec#$`gxH85~pclTsBta}(23gHjVyDhp4h+5iFV&G`2n`Lqy)B>rTdn_P6WMx4P0^#Nk@MI}-e`YQXmJSgGCFqTk6}Q2-<}ME z^Tj>OGEYR!wqTO^I#+(yj{6KB?g>AiGp9K7^0|#-%Nf?Z_Ihj)6now9_^j*)2IpUw yvsvi0R9G^;IBYP5*I-tS&HSdn|C4ud8Zdk-ZR_$;{KE+J41=eupUXO@geCyCEOo^I literal 0 HcmV?d00001 diff --git a/src/server/web/images/options/letter_open.png b/src/server/web/images/options/letter_open.png new file mode 100755 index 0000000000000000000000000000000000000000..0af42f9c5cfd98cfbd93ace136f0b51104dcd7e9 GIT binary patch literal 315 zcmV-B0mS}^P)cAhA4?f_QNOhGcykf$gH&#Q{VT# z(Y7t4lmNK8>pC0im!q?f%TJK38-&ZV2_&xJMs#6kv>T=A4t1(q|YM_eT!(3BLeZmW8USqIsVE(2;RoEGt^ryZ83;-!tog795&Hn%Z N002ovPDHLkV1i@Dfp`D_ literal 0 HcmV?d00001 diff --git a/src/server/web/images/options/login.png b/src/server/web/images/options/login.png new file mode 100755 index 0000000000000000000000000000000000000000..613e70073163e54b2789902390db30084630ded6 GIT binary patch literal 352 zcmV-m0iXVfP)${{Aa)p7-5X)P(Luuf<@7Pm?Sy?TJj&+5U`0b7o1*V!ElSc>c5w_ z517Ag>lPHv$l_{0+Zat_PGEPzwVRI_9^APIR)j3RZ7ain1r>b^S23XroIG=r0T;j~ zhhe~t+fQ&BfK3i14Df_LhCXaz@ZU71izwZvmz2R{10@jue0<38`@7GY3Cj13+qU8op@pN$vskoK&=l_3uX4QtyMyCTz z$v$^$doz}&?9MVwl3-wJYdghaI^Vutd^fklgYVbndD!LZj;y@tI8VM_;?KX2vmgF$ zUtbWDuik!${p4dFW`Ts1l$3-dC*JTBI}f?_j6OO(JZIkM@SI)Ou_5DgAp7O5yWclG z<&-*b=-{af6+Z-L#OG_Xr#BzzG-!}qF@ZOfQAl3J{{lnU0$+m*r9XAK<}YCEIl!=a s;uA%E)g*6~BMiqF&-;i-GYBLwbh}ycM1S7>6zC5IPgg&ebxsLQ0J!>YcK`qY literal 0 HcmV?d00001 diff --git a/src/server/web/images/options/minimize.png b/src/server/web/images/options/minimize.png new file mode 100755 index 0000000000000000000000000000000000000000..92526844c9ddb2a802b735486a6b198265278e31 GIT binary patch literal 276 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Ea{HEjtmUzPnffIy#(?lOI#yL zg7ec#$`gxH85~pclTsBta}(23gHjVyDhp4h+5iSem6e%=h2Isho_uWD(AnDAICF06!kePTI$7oSSx*a_G_*EPUHI{X zvQMi+p%PC5n^wx^Z=&W#SV>ebppyl_Lzt7|;8NNHYi|Fi2cd VTA^$F?>x}O44$rjF6*2UngBlbWY_=z literal 0 HcmV?d00001 diff --git a/src/server/web/images/options/reply.png b/src/server/web/images/options/reply.png new file mode 100755 index 0000000000000000000000000000000000000000..4cc0c3ebb495b47d019decb847cb0bdaad77baeb GIT binary patch literal 411 zcmV;M0c8G(P)0M^;q17nyZ^tAS<6j0Hpx6}#uxl6zh5<;kk(NHgjq9%&4oCGd zT;XSCkP=ZPE)YSQ^;NYQ9=!a<@aN}mFus%8&#>$FJqC0yFd|1IC=5g;+5Q`88!$Zi z@Ea~JBf!dV?&<}G*Ux`3B6|_T1t87lCT0w;elsz!akGQ5q9iw1^P+55M!e}@_wL>Q zn|;(6PM$f%pdii#)XV{Ne4%c9AU7rv0=D%>lT<#$Y!juFd&(UVgmpI3;=^sd5#UthH(G@002ovPDHLk FV1gkYtpET3 literal 0 HcmV?d00001 diff --git a/src/server/web/images/options/rss.png b/src/server/web/images/options/rss.png new file mode 100755 index 0000000000000000000000000000000000000000..5b41c908524c02c600ef863bdfb7a4fa11811b1b GIT binary patch literal 568 zcmV-80>}M{P)n?{?u1mNz%Yt-v+rHrahY=Dp8+-)u&OVMrrS(~XmRt^SMD^Db1z zDx<(O_w*TD3VNSG+_6=cKI|<+`R_eIZr4I;3Wy1CzZ0HkZdaalgLeeq1aw{n4Vq7Q zdjt|O2u|=nyb#|iP})U5own<(?eJv*E(DS=>M!pAnj{%lIQg$O{&P?P-@wQuJa`mU zD^&-eJ79Ry`o^Xt4h!gVK2jJ4)#9KIpnOX3`K?_xwsc~ferECJ2cVdX{Nqn`{zB-Z z;~Bj5EN!N7dvG)j=_Hedg_;~O#!=Cf^{{t;zgvm3(7`HzBV>ojDCd2RFzfth%vlqb_#0JR+ z1^9t1{Ey-V5cu~OLjU>m2dnd8;xKhs41mbw&)kZtf=wJn9HtJ#fWLqLGw9m*5e#*Z zIvg(e$8h<`CV~byy7=L8!9OrPs~`lY=ClcG;Oa08_yd*r_wOIW@#DuaG+SC)qNu|# z;QzmWP?!8=Ff%j5;`hHO>M+CL-+#EmvuDp@7+`E{jG_+101XK?hLcb)7#bR481N5j zGf3S*bOS(nVCK4=K$?MJ_wL7o5*XX>Md2K}#3a79trxM25xpd2HbC8#cdy5fIr ztP8`L*MCtIfW$y@xLm>nb9Pmv6T|VRzZiag|AT@-VjwvzUPE=kpFjT?zJL3T)tP_( zFyRkG5cv1^AH%O7f3Pb0_m`Cj1OEMI`1|`Gb_4$5j%t|O82dIHW^mHrW?*G!M!_I4 zkesjB2mCI8M%Dl7C?^yJt;_Z?wE1f?aB^}oFznm+fAcE=MqJSdb_q}eihDsei;9Xe zyng+f!O6)9!w_u2%ZQ9YiZ^ZA1UBUR_wQgsfQJ6ZX8;C3HiVa#7kd~GV+g~hP5)u+ lP?&Qm&5cY96as(%0|3%>f*s=jxY+;z002ovPDHLkV1hj5rU?K5 literal 0 HcmV?d00001 diff --git a/src/server/web/images/options/time.png b/src/server/web/images/options/time.png new file mode 100755 index 0000000000000000000000000000000000000000..67176824857edc4734aa45e7c1058ef53b4113f6 GIT binary patch literal 453 zcmV;$0XqJPP)GYt{31wz{fSBRU%Ne0xDH zc9vxQdHiHv-(CVuJqhK)-vUGqIq~}bQIghImg71JX$X->RS2LmlbML)G0rb;MF=1f z$0yM#M>82jCLbJ~h!_I<>4eNv8Vy5rhWB0~{|+HY4)Rl@qmtq3z0FnSoRf&{PjhQ+ z+|N#7iY5X`s^jqZG>-dw+v+zo3iNk-jpBR-N53a_cyRTgtg}-C`^ZB+cu@cjqu)|g znidS?vorY$9wveM<=vMLHr6^q7>>r`gH+uYJ%A~aRmCjBQR&2FX|8U5G!gcM!zkig vU{X$Od<%S%bVp0^=W7J2++qL0rvL*0K|<@ia>>+D00000NkvXXu0mjfDEYrn literal 0 HcmV?d00001 diff --git a/src/server/web/images/options/user.png b/src/server/web/images/options/user.png new file mode 100755 index 0000000000000000000000000000000000000000..c7a27fdfe49c71e27f7383083e1cfc92ce6f2fae GIT binary patch literal 416 zcmV;R0bl-!P)1RCwBA z{Qv(y10{e3#+W%J1}@0QuZCgjr;oQ7VeIsrC71@FYj$^#f{X1u@C+=DYzPc6VRIHp z^PML=aExpiQ3l+6$indV?+*rTT^leB;u8!5Brh;%YUzR5zkhuKvdzHkckehr;Xs@V zjvl!LBpKlt!YAMY895&?z2So(Lx8}0pr(r`3c=z~H8{NhRP(Z29OGv7$^h)0R{kXvVr4 \ No newline at end of file diff --git a/src/server/web/index.php b/src/server/web/index.php new file mode 100755 index 0000000..b7243da --- /dev/null +++ b/src/server/web/index.php @@ -0,0 +1,99 @@ +Start(); +$session=$NATS_Session->Check($NATS->DB); +if ($session) + { + header("Location: main.php"); + exit(); + } + +if ( ($NATS->Cfg->Get("site.auth","")=="http") && + ( (!isset($_REQUEST['auth'])) || ($_REQUEST['auth']!="basic") ) ) +{ + header("Location: login.php"); + exit(); +} + + +Screen_Header($NATS->Lang->Item("welcome"),3); +ob_end_flush(); +?> +
    + diff --git a/src/server/web/iphone.php b/src/server/web/iphone.php new file mode 100755 index 0000000..f3760b3 --- /dev/null +++ b/src/server/web/iphone.php @@ -0,0 +1,295 @@ + + + + + + FreeNATS iPhone + + + + + + + + + +
    + + \n"; + ?> +
    + +
    + + + + + + + + + + + +".$text."
    +".$_REQUEST['login_msg']."

    "; +$mesg=array( + 0 => "msg.logout", + 1 => "msg.session", + 2 => "msg.loginfailed" ); +if (isset($_REQUEST['msg'])) $msg=$_REQUEST['msg']; +else if (isset($_REQUEST['login_msg'])) // legacy support + { + if ($_REQUEST['login_msg']=="Invalid Or Expired Session") $msg=1; + } + +if (isset($msg) && isset($mesg[$msg])) + { + echo "".$NATS->Lang->Item($mesg[$msg])."

    "; + } +else echo "".$NATS->Lang->Item("welcome")."

    "; + +$t="Login..."; + Start_Round($NATS->Lang->Item("auth"),300); +?>

    + + +"; +?> + + + + +
    +Lang->Item("username"); ?>:
    Lang->Item("password"); ?>:
    Lang->Item("language"); ?>:

    +Lang->Item("login")."\" style=\"font-size: 11pt;\">\n"; +?> + + +

    + + +

    +
  • \n"; +$lic++; +} + +function lititled($text,$under) + { + echo "
  • ".$text."
    "; + echo "".$under."
  • "; + } + +// Actual FreeNATS Interface... + +require("include.php"); +$NATS->Start(); +if (!$NATS_Session->Check($NATS->DB)) + { + $mode="login"; + } +else if (isset($_REQUEST['mode'])) $mode=$_REQUEST['mode']; +else $mode="main"; + +switch($mode) + { + case "main": + ipScreenHeader("FreeNATS"); + echo "
      \n"; + + $alerts=$NATS->GetAlerts(); + if ($alerts===false) $alerts=array(); + + if (count($alerts)>0) + { + $alt="Alerts (".count($alerts).")"; + $alt.="
      "; + $first=true; + foreach($alerts as $alert) + { + if ($first) $first=false; + else $alt.=", "; + $alt.=$alert['nodeid']; + } + $alt.=""; + } + else $alt="No Alerts"; + + li($alt,"iphone.php?mode=alerts"); + li("Groups","iphone.php?mode=groups"); + li("Nodes","iphone.php?mode=nodes"); + li("Views","iphone.php?mode=views"); + echo "
    \n"; + + //echo "
    Stuff
    \n"; + echo "
      \n"; + //echo "
    • Stuff
    • \n"; + li("Standard Interface","monitor.php"); + echo "
    \n"; + echo "
      \n"; + //li("Login","iphone.php?mode=login"); + li("Logoff","logout.php"); + echo "
    \n"; + break; + + case "alerts": + ipScreenHeader("FreeNATS Alerts","iphone.php"); + echo "
      \n"; + $alerts=$NATS->GetAlerts(); + if ($alerts===false) li("No Alerts"); + else + { + foreach($alerts as $alert) + { + $link="iphone.php?mode=node&nodeid=".$alert['nodeid']."&back=".urlencode("iphone.php?mode=alerts"); + $txt="".$alert['nodeid'].""; + li($txt,$link); + } + } + echo "
    "; + break; + + case "views": + ipScreenHeader("Views","iphone.php"); + $q="SELECT viewid,vtitle FROM fnview"; + $r=$NATS->DB->Query($q); + echo "
      \n"; + while ($row=$NATS->DB->Fetch_Array($r)) + { + li($row['vtitle'],"view.php?viewid=".$row['viewid']); + } + echo "
    \n"; + break; + + case "groups": + ipScreenHeader("Groups","iphone.php"); + $q="SELECT groupname,groupid FROM fngroup ORDER BY weight ASC"; + $r=$NATS->DB->Query($q); + echo "
      "; + while ($row=$NATS->DB->Fetch_Array($r)) + { + $lvl=$NATS->GroupAlertLevel($row['groupid']); + $txt="".$groupname.""; + $lnk=""; // for later + li($txt,$lnk); + } + echo "
    "; + break; + + case "nodes": + ipScreenHeader("Nodes","iphone.php"); + $q="SELECT nodeid,nodename,alertlevel FROM fnnode WHERE nodeenabled=1 ORDER BY alertlevel DESC,weight ASC"; + $r=$NATS->DB->Query($q); + echo "
      "; + while ($row=$NATS->DB->Fetch_Array($r)) + { + if ($row['nodename']=="") $nodename=$row['nodeid']; + else $nodename=$row['nodename']; + $lvl=$row['alertlevel']; + $txt="".$nodename.""; + $lnk="iphone.php?mode=node&nodeid=".$row['nodeid']; + li($txt,$lnk); + } + echo "
    "; + break; + + case "node": + if (isset($_REQUEST['nodeid'])) $nodeid=$_REQUEST['nodeid']; + else $nodeid=""; + if (isset($_REQUEST['back'])) $back=$_REQUEST['back']; + else $back="iphone.php?mode=nodes"; + ipScreenHeader($nodeid,$back); + + $node=$NATS->GetNode($nodeid); + if ($node===false) echo "
    • Invalid NodeID
    "; + else + { + echo "
      "; + li("Configuration"); + //lititled($node['nodeid'],"nodeid"); + //lititled($node['nodename'],"node name"); + //lititled($node['hostname'],"hostname"); + echo "
    • "; + echo ""; + echo ""; + echo ""; + echo "
      Node ID: ".$node['nodeid']."
      Node Name: ".$node['nodename']."
      Hostname: ".$node['hostname']."
    • \n"; + echo "
    "; + + echo "
      \n"; + $t="Status: "; + $t.=""; + $t.=oText($node['alertlevel']); + $t.=""; + li($t); + lititled($node['lastrunago']." ago",$node['lastrundt']); + + echo "
    "; + + echo "\n
      \n"; + li("Standard Interface"); + li("Node View","node.php?nodeid=".$node['nodeid']); + li("Todays Summary","summary.test.php?nodeid=".$node['nodeid']); + li("Node Edit","node.edit.php?nodeid=".$node['nodeid']); + echo "
    \n"; + + + + + } + break; + + case "login": + ipScreenHeader("FreeNATS"); + echo "
    "; + echo ""; + echo "
      \n"; + li("Username"); + echo "
    • \n"; + echo "
      \n"; + li("Password"); + echo "
    • \n"; + echo "
      \n"; + echo "
    • "; + echo "Login to FreeNATS"; + echo "
    • \n"; + echo "
    "; + break; + + default: + ipScreenHeader("FreeNATS","iphone.php"); + echo "
      "; + li("Error Occured"); + echo "
    \n"; + echo "\n"; + break; + } + + +ipScreenFooter(); +$NATS->Stop(); +?> + diff --git a/src/server/web/js/freenats.js b/src/server/web/js/freenats.js new file mode 100755 index 0000000..7e147e5 --- /dev/null +++ b/src/server/web/js/freenats.js @@ -0,0 +1,50 @@ + \ No newline at end of file diff --git a/src/server/web/js/iphone.js b/src/server/web/js/iphone.js new file mode 100755 index 0000000..28e3e25 --- /dev/null +++ b/src/server/web/js/iphone.js @@ -0,0 +1,88 @@ +/* + + File:iphone.js + + Abstract: Some simple browser rules. [Modified for FreeNATS] + + + Disclaimer: IMPORTANT: This Apple software is supplied to you by + Apple Inc. ("Apple") in consideration of your agreement to the + following terms, and your use, installation, modification or + redistribution of this Apple software constitutes acceptance of these + terms. If you do not agree with these terms, please do not use, + install, modify or redistribute this Apple software. + + In consideration of your agreement to abide by the following terms, and + subject to these terms, Apple grants you a personal, non-exclusive + license, under Apple's copyrights in this original Apple software (the + "Apple Software"), to use, reproduce, modify and redistribute the Apple + Software, with or without modifications, in source and/or binary forms; + provided that if you redistribute the Apple Software in its entirety and + without modifications, you must retain this notice and the following + text and disclaimers in all such redistributions of the Apple Software. + Neither the name, trademarks, service marks or logos of Apple Inc. + may be used to endorse or promote products derived from the Apple + Software without specific prior written permission from Apple. Except + as expressly stated in this notice, no other rights or licenses, express + or implied, are granted by Apple herein, including but not limited to + any patent rights that may be infringed by your derivative works or by + other works in which the Apple Software may be incorporated. + + The Apple Software is provided by Apple on an "AS IS" basis. APPLE + MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION + THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS + FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND + OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. + + IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, + MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED + AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), + STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + + Copyright (C) 2008 Apple Inc. All Rights Reserved. + + + Modified for FreeNATS - September 2008 + + + + */ + + + function pagego(url) + { + document.location.href=url; + } + + function liclick(index,url) + { + document.getElementById(index).style.background="#8080f0"; + pagego(url); + } + + function backbuttonclick(url) + { + pagego(url); + } + +// called when orientation changes +function orientation_changed () { + // update the global variable for tracking current orientation + is_portrait = (window.orientation == 0 || window.orientation == null); + // update the styles + document.body.className = is_portrait ? 'portrait' : 'landscape'; + // update the screen width + screen_width = is_portrait ? 320 : 480; + // ensure the canvas is positioned at top-left + window.setTimeout(function() { window.scrollTo(0, 1); }, 0); +}; + +var is_portrait=false; +window.addEventListener('orientationchange', orientation_changed, false); + // set up vars based on orientation + orientation_changed(); + \ No newline at end of file diff --git a/src/server/web/js/monitor.popup.js b/src/server/web/js/monitor.popup.js new file mode 100755 index 0000000..4ee79f3 --- /dev/null +++ b/src/server/web/js/monitor.popup.js @@ -0,0 +1,98 @@ +var openNode = ""; + +function nodeClick(nodeid) +{ +if (openNode==nodeid) + { // already open so goto node page... + window.location.href = "node.php?nodeid=" + nodeid; + return 0; + } +openNode = nodeid; +popup = document.getElementById('popup_div'); +popup.innerHTML = popupTop + "Loading..." + popupBottom; +popup.style.left = (MouseX-10) + 'px'; +popup.style.top = MouseY + 'px'; +popup.style.display = 'block'; + +var xmlhttp=false; +if (window.XMLHttpRequest) + { + xmlhttp=new XMLHttpRequest(); + if (xmlhttp.overrideMimeType) xmlhttp.overrideMimeType('text/xml'); + } +else if (window.ActiveXObject) + { + try + { + xmlhttp = new ActiveXObject("Msxml2.HTTP"); + } + catch(e) + { + xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); + } + } + +if (!xmlhttp) + { + alert("Cannot Create XML HTTP Request Object"); + return false; + } + +xmlhttp.onreadystatechange = function() + { + if (xmlhttp.readyState == 4) + { + if (xmlhttp.status == 200) + { + popup.innerHTML = popupTop + xmlhttp.responseText + popupBottom; + } + else + { + popup.innerHTML = popupTop + "Error Code Returned: " + xmlhttp.status + popupBottom; + } + } + } + +var url="monitor.popup.php?type=node&nodeid="+nodeid; +xmlhttp.open("GET",url,true); +xmlhttp.send(null); + + +} + +function closePopup() +{ +openNode=""; +document.getElementById('popup_div').style.display = 'none'; +} + +var popupTop = ""; +var popupBottom = ""; + +var isIE = false; +if (document.all) isIE=true; + +var MouseX=0; +var MouseY=0; + +function recordMouse(e) +{ +if (!e) e=window.event; +if (isIE) + { + MouseX = e.clientX + document.body.scrollLeft; + MouseY = e.clientY + document.body.scrollTop; + } +else + { + MouseX = e.pageX; + MouseY = e.pageY; + } +} + +if (!isIE) document.captureEvents(Event.MOUSEMOVE); + +if (window.addEventListener) document.addEventListener("mousemove",recordMouse,false); +else if (window.attachEvent) document.attachEvent("onmousemove",recordMouse); +else document.onmousemove = recordMouse; + diff --git a/src/server/web/localtest.action.php b/src/server/web/localtest.action.php new file mode 100755 index 0000000..42fc5c4 --- /dev/null +++ b/src/server/web/localtest.action.php @@ -0,0 +1,140 @@ +Start(); +if (!$NATS_Session->Check($NATS->DB)) + { + header("Location: ./?login_msg=Invalid+Or+Expired+Session"); + exit(); + } +if ($NATS_Session->userlevel<5) UL_Error("Action Local Test"); + +switch ($_REQUEST['action']) + { + case "create": + if (isset($_REQUEST['testcreatedisabled'])) $tenable=0; + else $tenable=1; + $q="INSERT INTO fnlocaltest(nodeid,testtype,testparam,testenabled) VALUES("; + $q.="\"".ss($_REQUEST['nodeid'])."\",\"".ss($_REQUEST['testtype'])."\",\"".ss($_REQUEST['testparam'])."\",".$tenable.")"; + //echo $q; + //exit(); + $NATS->DB->Query($q); + //echo $q; + //exit(); + // Following user feedback (added to 0.02.35a) + //$loc="localtest.edit.php?localtestid=".$NATS->DB->Insert_Id(); + +/* -- the old code just to appear in the list, now opens like a node create for the options + $loc="node.edit.php?nodeid=".$_REQUEST['nodeid']; // no message - just appears in list like evals +*/ + $loc="localtest.edit.php?localtestid=".$NATS->DB->Insert_Id(); + header("Location: ".$loc); + exit(); + + break; + case "save_form": + if (isset($_REQUEST['testrecord'])) $tr=$_REQUEST['testrecord']; + else $tr=0; + if (isset($_REQUEST['simpleeval'])) $se=$_REQUEST['simpleeval']; + else $se=0; + if (isset($_REQUEST['testenabled'])) $te=1; + else $te=0; + if (isset($_REQUEST['clearparam'])) $_REQUEST['testparam']=""; + if (isset($_REQUEST['testinterval'])) $interval=$_REQUEST['testinterval']; + else $interval=0; + if (!is_numeric($interval)) $interval=0; + $q="UPDATE fnlocaltest SET testparam=\"".ss($_REQUEST['testparam'])."\",testrecord=".ss($tr).",simpleeval=".ss($se).",testenabled=".$te.","; + $q.="testname=\"".ss($_REQUEST['testname'])."\",attempts=".ss($_REQUEST['attempts']).",timeout=".ss($_REQUEST['timeout']); + $q.=",testinterval=".ss($interval); + + // get and update parameters if available + for ($a=1; $a<10; $a++) // 1 to 9 - "0" taken care of + { + $paramstr="testparam".$a; + if (isset($_REQUEST[$paramstr])) $val=ss($_REQUEST[$paramstr]); + else $val=""; + $clearstr="clearparam".$a; + $keepstr="keepparam".$a; + if ( (isset($_REQUEST[$clearstr]))&&($_REQUEST[$clearstr]==1) ) + { // wants cleared so do for sure + $val=""; + $q.=",".$paramstr."=\"".$val."\""; + } + else if (isset($_REQUEST[$keepstr])) + { + // keep if new input is blank + if ($val!="") $q.=",".$paramstr."=\"".$val."\""; + } + else + { // otherwise update unless cleared + $q.=",".$paramstr."=\"".$val."\""; + } + } + + $q.=" WHERE localtestid=".ss($_REQUEST['localtestid']); + //echo $q; + //exit(); + $NATS->DB->Query($q); + if ($NATS->DB->Affected_Rows()<=0) $msg="Save+Failed+or+Nothing+Changed"; + else $msg="Changes+Saved"; + + // Handle Invalidation + if ( isset($_REQUEST['testinterval']) && isset($_REQUEST['original_testinterval']) && + ($_REQUEST['testinterval'] != $_REQUEST['original_testinterval']) ) + $NATS->InvalidateTest("L".$_REQUEST['localtestid']); + + header("Location: localtest.edit.php?localtestid=".$_REQUEST['localtestid']."&message=".$msg); + exit(); + case "invalidate": + $tid="L".$_REQUEST['localtestid']; + $NATS->InvalidateTest($tid,true); + $msg="Test+Scheduled+for+ASAP"; + header("Location: localtest.edit.php?localtestid=".$_REQUEST['localtestid']."&message=".$msg); + exit(); + case "delete": + if (!isset($_REQUEST['confirmed'])) + { + $back="localtest.action.php?action=delete&localtestid=".$_REQUEST['localtestid']."&confirmed=1"; + $back=urlencode($back); + $url="confirm.php?action=Delete+test+and+all+historical+data&back=".$back; + header("Location: ".$url); + exit(); + } + // history + $q="DELETE FROM fnrecord WHERE testid=\"L".ss($_REQUEST['localtestid'])."\""; + $NATS->DB->Query($q); + $hdel=$NATS->DB->Affected_Rows(); + // test itself + $q="DELETE FROM fnlocaltest WHERE localtestid=".ss($_REQUEST['localtestid']); + $NATS->DB->Query($q); + $m="Deleted ".$NATS->DB->Affected_Rows()." test and ".$hdel." history items"; + header("Location: main.php?message=".urlencode($m)); + exit(); + + default: + header("Location: main.php?message=Unknown+Local+Test+Action"); + exit(); + } + +?> diff --git a/src/server/web/localtest.edit.php b/src/server/web/localtest.edit.php new file mode 100755 index 0000000..467b130 --- /dev/null +++ b/src/server/web/localtest.edit.php @@ -0,0 +1,246 @@ +Start(); +if (!$NATS_Session->Check($NATS->DB)) + { + header("Location: ./?login_msg=Invalid+Or+Expired+Session"); + exit(); + } +if ($NATS_Session->userlevel<5) UL_Error($NATS->Lang->Item("local.test.editor")); +ob_end_flush(); +Screen_Header($NATS->Lang->Item("local.test.editor"),1,1,"","main","nodes"); +?> +
    +DB->Query($q); +if (!$row=$NATS->DB->Fetch_Array($r)) + { + echo $NATS->Lang->Item("no.test")."

    "; + Screen_Footer(); + exit(); + } +if ($row['testname']!="") $nicename=$row['testname']; +else $nicename=lText($row['testtype']); + +echo "".$NATS->Lang->Item("editing.test").": ".$row['nodeid']." > ".$nicename."

    "; + +if (isset($_REQUEST['message'])) + { + echo "".$_REQUEST['message']."

    "; + $poplist[]=$_REQUEST['message']; + } +$title="".$NATS->Lang->Item("test.settings").""; +Start_Round($title,600); + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo "
    ".$NATS->Lang->Item("test.type").": ".lText($row['testtype']); +echo "

    ".$NATS->Lang->Item("test.options").":"; // new style multi-param options + +switch ($row['testtype']) + { + case "web": case "wsize": case "wtime": + echo $NATS->Lang->Item("url").":
    "; + echo "".$NATS->Lang->Item("full.url").""; + break; + + case "icmp": case "ping": + echo $NATS->Lang->Item("host.ip").":
    "; + echo "".$NATS->Lang->Item("host.ip.lookup").""; + break; + + case "testloop": case "testrand": + echo $NATS->Lang->Item("value").":
    "; + echo "".$NATS->Lang->Item("value.desc").""; + break; + + case "host": + echo $NATS->Lang->Item("host").":
    "; + echo "".$NATS->Lang->Item("host.desc").""; + break; + + default: + + $idx=$NATS->Tests->Get($row['testtype']); + if (is_object($idx)) + { + // Test-specific formatting here + + $pcount=0; // param count + //echo $NATS->Tests->Tests[$row['testtype']]->parameters; + if (isset($NATS->Tests->Tests[$row['testtype']]->parameters) && is_array($NATS->Tests->Tests[$row['testtype']]->parameters) + && (count($NATS->Tests->Tests[$row['testtype']]->parameters)>0) ) + { + echo ""; + foreach($NATS->Tests->Tests[$row['testtype']]->parameters as $param) + { + $pname="testparam"; + if ($pcount>0) $pname.=$pcount; + $undertext=""; + $pos=strpos($param,"/"); + if ($pos>0) + { + $undertext=substr($param,$pos+1); + $param=substr($param,0,$pos); + } + echo ""; + if ($undertext!="") + { + echo ""; + } + $pcount++; + } + echo "
    "; + echo $param; + echo " :"; + echo ""; + echo "
     ".$undertext."
    "; + } + else + { + $NATS->Tests->Tests[$row['testtype']]->Create(); + $out=$NATS->Tests->Tests[$row['testtype']]->instance->DisplayForm($row); + if ($out===false) echo "".$NATS->Lang->Item("no.test.options").""; + else echo $out; + } + + + + + } + + + // And the catch-all of catch-alls + else echo ""; + } + +echo "

    ".$NATS->Lang->Item("custom.name").": ".hlink("Test:Name"); +echo "
    ".$NATS->Lang->Item("test.enabled").":"; +if ($row['testenabled']==1) $s=" checked"; +else $s=""; +echo " "; +echo hlink("Test:Enabled"); +echo "
    ".$NATS->Lang->Item("recorded").":"; +if ($row['testrecord']==1) $s=" checked"; +else $s=""; +echo " ".hlink("Test:Recorded"); +echo "
    ".$NATS->Lang->Item("simple.eval").":"; +if ($row['simpleeval']==1) $s=" checked"; +else $s=""; +echo " ".hlink("Test:SimpleEvaluation"); +echo "

    ".$NATS->Lang->Item("test.interval").": ".$NATS->Lang->Item("minutes")." ".hlink("Test:Interval"); +echo "
    ".$NATS->Lang->Item("test.due").":"; +if ($row['nextrunx']>0) echo nicedt($row['nextrunx'])." - ".nicenextx($row['nextrunx']); +else echo $NATS->Lang->Item("now"); +echo "
    ".$NATS->Lang->Item("last.tested").":".nicedt($row['lastrunx'])." - ".dtago($row['lastrunx'])."
    "; +echo "".$NATS->Lang->Item("check.asap").""; +echo "

    ".$NATS->Lang->Item("custom.attempts").": ".hlink("Test:Attempts"); +echo "
    ".$NATS->Lang->Item("custom.timeout").": ".$NATS->Lang->Item("seconds")." ".hlink("Test:Timeout"); +echo "

     Lang->Item("test.save")."\"> "; +echo "".$NATS->Lang->Item("abandon.changes").""; +echo "
    "; +End_Round(); +echo "

    "; + + + +$t="".$NATS->Lang->Item("test.evals").""; +Start_Round($t,600); + + +echo ""; +echo ""; + +$q="SELECT * FROM fneval WHERE testid=\"L".ss($_REQUEST['localtestid'])."\" ORDER BY weight ASC"; +$r=$NATS->DB->Query($q); +while ($row=$NATS->DB->Fetch_Array($r)) + { + echo ""; + //echo ""; + } + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + + +echo "
     
    "; +if ($row['simpleeval']==1) + { + echo "".$NATS->Lang->Item("test.evals.simple")."
    "; + } +echo "
    "; + echo "Lang->Item("eval.deleted"))."&evalid=".$row['evalid']."\">"; + echo "  "; + echo $NATS->Lang->Item("result")." ".eval_operator_text($row['eoperator'])." ".$row['evalue']." => ".oText($row['eoutcome']).""; + //echo " | Up/Down"; + echo "
     
     
    ".$NATS->Lang->Item("add.eval")." : => "; +echo " Lang->Item("add")."\">
    "; +End_Round(); + +?> + + diff --git a/src/server/web/log.php b/src/server/web/log.php new file mode 100755 index 0000000..e5c73bc --- /dev/null +++ b/src/server/web/log.php @@ -0,0 +1,152 @@ +Start(); +if (!$NATS_Session->Check($NATS->DB)) + { + header("Location: ./?login_msg=Invalid+Or+Expired+Session"); + exit(); + } +if ($NATS_Session->userlevel<9) UL_Error($NATS->Lang->Item("event.log")); + + +ob_end_flush(); +Screen_Header($NATS->Lang->Item("event.log"),1); +?> + +
    +Lang->Item("event.log"); ?>

    + +"; +echo "
    "; +// posted mod cat lvl entry +echo ""; +echo "".$NATS->Lang->Item("filter").":"; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +echo "".$NATS->Lang->Item("show").":"; +echo ""; +echo " entries from "; +echo ""; +echo ""; +echo "Lang->Item("filter.log")."\"> Reset"; +echo ""; + +echo ""; +$dto=$d_from-$d_show; +if ($dto<0) $dto=0; +echo ""; +echo "<< ".$NATS->Lang->Item("prev"); +echo ""; +echo ""; +$dto=$d_from+$d_show; +if ($dto<0) $dto=0; +echo ""; +echo $NATS->Lang->Item("next")." >>"; +echo ""; + +//echo "".$q.""; +// +$r=$NATS->DB->Query($q); +while ($row=$NATS->DB->Fetch_Array($r)) + { + echo "".nicedt($row['postedx']).""; + echo ""; + echo ""; + echo $row['modid'].""; + echo ""; + echo ""; + echo $row['catid'].""; + echo ""; + echo ""; + echo $row['loglevel'].""; + echo "".$row['logevent'].""; + echo ""; + } +$NATS->DB->Free($r); + +echo ""; +$dto=$d_from-$d_show; +if ($dto<0) $dto=0; +echo ""; +echo "<< ".$NATS->Lang->Item("prev"); +echo ""; +echo ""; +$dto=$d_from+$d_show; +if ($dto<0) $dto=0; +echo ""; +echo $NATS->Lang->Item("next")." >>"; +echo ""; + + +echo ""; + +//echo $q; + +?> + + + diff --git a/src/server/web/login.php b/src/server/web/login.php new file mode 100755 index 0000000..8e4a098 --- /dev/null +++ b/src/server/web/login.php @@ -0,0 +1,69 @@ +Start(); + +if ($NATS->Cfg->Get("site.auth","")=="http") // HTTP-AUTH +{ + if (!isset($_SERVER['PHP_AUTH_USER'])) + { + $realm="FreeNATS ".date("Y-m-d H:i:s"); + header("WWW-Authenticate: Basic realm=\"".$realm."\""); + header("HTTP/1.0 401 Unauthorized"); + echo $NATS->Lang->Item("msg.loginfailed"); + exit(); + } + else + { + $username = $_SERVER['PHP_AUTH_USER']; + $password = $_SERVER['PHP_AUTH_PW']; + } +} +else +{ + if (isset($_REQUEST['naun'])) $username=$_REQUEST['naun']; + else $username=""; + if (isset($_REQUEST['napw'])) $password=$_REQUEST['napw']; + else $password=""; +} + +if ($NATS_Session->Create($NATS->DB,$username,$password)) + { + if ( isset($_REQUEST['nala']) && ($_REQUEST['nala']!="") ) + setcookie("fn_lang",$_REQUEST['nala']); + + $loc="main.php"; + if ($NATS->Cfg->Get("site.login.nocheck",0)!="1") + $loc.="?check_updates=1&quiet_check=1"; + if (isset($_REQUEST['url'])) $loc=$_REQUEST['url']; + + if ($NATS->Cfg->Get("freenats.firstrun")=="1") $loc="welcome.php"; + + header("Location: ".$loc); + exit(); + } + +header("Location: ./?msg=2"); +exit(); +?> \ No newline at end of file diff --git a/src/server/web/logout.php b/src/server/web/logout.php new file mode 100755 index 0000000..4260a66 --- /dev/null +++ b/src/server/web/logout.php @@ -0,0 +1,29 @@ +Start(); +if (!$NATS_Session->Check($NATS->DB)) + { + header("Location: ./?login_msg=Invalid+Or+Expired+Session"); + exit(); + } + + +if (($NATS->Cfg->Get("site.auth")=="http") && isset($_SERVER['PHP_AUTH_USER'])) +{ + Screen_Header($NATS->Lang->Item("httpa.logout"),1); + echo "

    ".$NATS->Lang->Item("httpa.logout")."

    \n"; + echo $NATS->Lang->Item("httpa.logout.desc")."

    \n"; + echo "".$NATS->Lang->Item("click.continue")."

    \n"; + Screen_Footer(); + exit(); +} + + +$NATS_Session->Destroy($NATS->DB); +setcookie("fn_lang",""); + + +header("Location: ./?msg=0"); +exit(); +?> diff --git a/src/server/web/main.php b/src/server/web/main.php new file mode 100755 index 0000000..4457c26 --- /dev/null +++ b/src/server/web/main.php @@ -0,0 +1,504 @@ +Start(); +if (!$NATS_Session->Check($NATS->DB)) + { + header("Location: ./?login_msg=Invalid+Or+Expired+Session"); + exit(); + } +ob_end_flush(); + +if (isset($_REQUEST['mode'])) $mode=$_REQUEST['mode']; +else + { + $mode="overview"; + $_REQUEST['mode']="overview"; + } + +Screen_Header($NATS->Lang->Item("overview.title"),1,0,"","main"); + +if (isset($_REQUEST['message'])) + { + echo "".$_REQUEST['message']."
    "; + $poplist[]=$_REQUEST['message']; + } + +if (isset($_REQUEST['nodemove'])) $nm=true; +else $nm=false; + +function dispyn($val) +{ +if ($val==0) return "N"; +else if ($val==1) return "Y"; +else return $val."?"; +} + +?> +
    +".$NATS->Lang->Item("checking.updates").": "; + echo " 
    "; + if (!$quiet_check) + { + echo "
    "; + echo $NATS->Lang->Item("update.desc")." "; + echo $NATS->Version.$NATS->Release."."; + echo "
    "; + } + echo "
    \n"; +} + + +if ($mode=="overview") + { + $t="".$NATS->Lang->Item("overview.subtitle").""; + Start_Round($t,600); + echo ""; + + echo ""; + $fx=time(); + $sx=$fx-(60*60*24); + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "
    "; + $al=$NATS->GetAlerts(); + if (($al===false)||(count($al)==0)) + { + echo "".$NATS->Lang->Item("no.monitor.alerts").""; + } + else + { + echo ""; + echo "".$NATS->Lang->Item("monitor.alerts").""; + echo ""; + } + echo "".$NATS->Lang->Item("check.updates")."

    "; + echo "".$NATS->Lang->Item("monitoring")."

    "; + $nq="SELECT COUNT(nodeid) FROM fnnode"; + $nr=$NATS->DB->Query($nq); + if ($nrow=$NATS->DB->Fetch_Array($nr)) $nodecount=$nrow['COUNT(nodeid)']; + else $nodecount=0; + $NATS->DB->Free($nr); + $gq="SELECT COUNT(groupid) FROM fngroup"; + $gr=$NATS->DB->Query($gq); + if ($nrow=$NATS->DB->Fetch_Array($gr)) $groupcount=$nrow['COUNT(groupid)']; + else $groupcount=0; + $NATS->DB->Free($gr); + echo "".$nodecount." ".$NATS->Lang->Item("nodes.configured")."

    "; + echo "".$groupcount." ".$NATS->Lang->Item("node.groups")."
    "; + echo "
    "; + echo "".$NATS->Lang->Item("common.tasks")."

    "; + echo "".$NATS->Lang->Item("add.nodes")."
    "; + echo "".$NATS->Lang->Item("email.alerting")."
    "; + echo "".$NATS->Lang->Item("configure.tests")."
    "; + echo "

    ".$NATS->Lang->Item("test.summaries")."

    "; + echo "".$NATS->Lang->Item("today")." - "; + echo "".$NATS->Lang->Item("last.24h")." - "; + echo "".$NATS->Lang->Item("custom").""; + echo "

    "; + /* + echo "Installed Test Modules

    "; + echo ""; + echo ""; + foreach($NATS->Tests->QuickList as $key => $val) + { + echo ""; + } + echo "
    NameProvidesRevisionAdditional
    "; + echo $NATS->Tests->Tests[$key]->name; + echo ""; + echo $NATS->Tests->Tests[$key]->type; + echo ""; + echo $NATS->Tests->Tests[$key]->revision; + echo ""; + echo $NATS->Tests->Tests[$key]->additional; + echo "
    "; + */ + echo "".$NATS->Lang->Item("monitored.nodes")."

    "; + $q="SELECT nodeid,nodename,alertlevel FROM fnnode WHERE nodeenabled=1 ORDER BY alertlevel DESC, weight ASC"; + $r=$NATS->DB->Query($q); + $first=true; + while ($row=$NATS->DB->Fetch_Array($r)) + { + if ($first) $first=false; + else echo ", "; + echo ""; + echo ""; + if ($row['nodename']!="") echo $row['nodename']; + else echo $row['nodeid']; + echo ""; + } + echo "
    "; + echo "
    "; + End_Round(); + echo "

    "; + + if ($NATS->Cfg->Get("site.nonews",0)!=1) + { + $t="".$NATS->Lang->Item("freenats.news").""; + Start_Round($t,600); + + echo "
    "; + echo ""; + echo "
    \n"; + + echo "Want to disable news? Set variable site.nonews to 1"; + + End_Round(); + + echo "\n"; + + } + + } + +else if ($mode=="nodes") +{ + + if ($nm) + { + $q="SELECT nodeid,weight FROM fnnode ORDER BY weight ASC"; + $r=$NATS->DB->Query($q); + $nml="".$NATS->Lang->Item("move.before")." "; + $NATS->DB->Free($r); + } + + Start_Round("".$NATS->Lang->Item("nodes")." ".hlink("Node",12),600); + $q="SELECT nodeid,nodename,alertlevel,weight FROM fnnode ORDER BY weight ASC"; + $r=$NATS->DB->Query($q); + + echo ""; + echo ""; + $f=0; + $l=$NATS->DB->Num_Rows($r); + while ($row=$NATS->DB->Fetch_Array($r)) + { + //echo ""; + + if ($nm) + { + echo ""; + echo ""; + echo ""; + } + + echo ""; + + if ($nm) echo ""; + $f++; + + echo ""; + } + echo ""; + echo ""; + echo ""; + + $fx=time(); + $sx=$fx-(60*60*24); + echo ""; + + echo "
    ".$NATS->Lang->Item("node")."".$NATS->Lang->Item("options").""; + echo "".$NATS->Lang->Item("move")."
    "; + echo "
    "; + echo ""; + + echo ""; + echo $row['nodename']; + echo ""; + + echo " "; + echo "(".$row['nodeid'].")"; + echo ""; + echo " Lang->Item("edit")."\">"; + echo " "; + echo "Lang->Item("delete")."\"> "; + echo ""; + if ($f==0) echo ""; + else + { + echo ""; + echo ""; + echo ""; + } + + if ($f>=($l-1)) echo ""; + else + { + echo ""; + echo ""; + echo ""; + } + + if ($nm) + { + echo " [".$row['weight']."] "; + echo $nml; + echo " "; + } + + echo "
     
    Lang->Item("create.node")."\"> "; + echo hlink("Node:Create"); + if ($nm) echo " ".$NATS->Lang->Item("refresh.weight").""; + echo "
    Summary: ".$NATS->Lang->Item("today")." - "; + echo "".$NATS->Lang->Item("last.24h")." - "; + echo "".$NATS->Lang->Item("custom")." - "; + echo "".$NATS->Lang->Item("config")."
    "; + End_Round(); + } + +else if ($mode=="groups") + { + + $t="".$NATS->Lang->Item("node.groups")." ".hlink("Group",12); + Start_Round($t,600); + + $q="SELECT groupid,groupname FROM fngroup ORDER BY weight ASC"; + $r=$NATS->DB->Query($q); + $f=0; + echo ""; + $l=$NATS->DB->Num_Rows($r); + while ($row=$NATS->DB->Fetch_Array($r)) + { + echo ""; + echo ""; + echo ""; + echo ""; + $f++; + + echo ""; + } + echo ""; + echo ""; + echo ""; + echo ""; + echo "
    GroupAlertLevel($row['groupid'])."\">".$row['groupname']."Lang->Item("edit")."\">"; + echo " "; + echo "Lang->Item("delete")."\">"; + + if ($f==0) echo ""; + else + { + echo ""; + echo ""; + echo ""; + } + + if ($f>=($l-1)) echo ""; + else + { + echo ""; + echo ""; + echo ""; + } + + echo "
     
    Lang->Item("create.group")."\">"; + echo " ".hlink("Group:Create")."
    "; + End_Round(); + } + +else if ($mode=="views") + { + $t="".$NATS->Lang->Item("views")." ".hlink("View",12); + Start_Round($t,600); + echo ""; + // get views... + $q="SELECT viewid,vtitle FROM fnview"; + $r=$NATS->DB->Query($q); + while ($row=$NATS->DB->Fetch_Array($r)) + { + echo ""; + } + + echo ""; + echo ""; + echo ""; + echo "
    "; + echo "".$row['vtitle'].""; + echo ""; + echo "Lang->Item("edit")."\">"; + echo " "; + echo "Lang->Item("delete")."\">"; + echo "
     
    Lang->Item("create.view")."\"> "; + echo hlink("View:Create")."
    "; + End_Round(); + + echo "

    "; + $t="".$NATS->Lang->Item("reports")." ".hlink("Report",12).""; + Start_Round($t,600); + echo "".$NATS->Lang->Item("create.report")." ".hlink("Report",12); + echo "

    "; + + // reports in here + $rq="SELECT reportid,reportname FROM fnreport"; + $rr=$NATS->DB->Query($rq); + if ($NATS->DB->Num_Rows($rr)>0) + { + echo ""; + while ($rep=$NATS->DB->Fetch_Array($rr)) + { + echo ""; + echo ""; + } + echo "
    "; + echo "".$rep['reportname'].""; + echo ""; + echo ""; + echo "Lang->Item("delete").": ".$rep['reportname']."\">"; + echo ""; + echo "  "; + echo "
    "; + } + + End_Round(); + + } + +else if ($mode=="configsummary") + { + $scheds=array(); + $q="SELECT scheduleid,schedulename FROM fnschedule"; + $r=$NATS->DB->Query($q); + while ($row=$NATS->DB->Fetch_Array($r)) + { + $scheds[$row['scheduleid']]=$row['schedulename']; + } + $NATS->DB->Free($r); + + echo "".$NATS->Lang->Item("config.summary")."

    "; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + $q="SELECT * FROM fnnode ORDER BY weight ASC"; + $r=$NATS->DB->Query($q); + while ($row=$NATS->DB->Fetch_Array($r)) + { + echo ""; + + echo ""; + } + $NATS->DB->Free($r); + echo "
    "; + echo $NATS->Lang->Item("nodeid"); + echo ""; + echo $NATS->Lang->Item("name"); + echo ""; + echo $NATS->Lang->Item("hostname"); + echo ""; + echo $NATS->Lang->Item("schedule"); + echo ""; + echo $NATS->Lang->Item("enabled"); + echo ""; + echo $NATS->Lang->Item("ping")." / ".$NATS->Lang->Item("required");; + echo ""; + echo $NATS->Lang->Item("interval"); + echo ""; + echo $NATS->Lang->Item("nodeside"); + echo "
    "; + echo $row['nodeid']; + echo ""; + echo $row['nodename']; + echo ""; + echo $row['hostname']; + echo ""; + if ($row['scheduleid']==0) $s="All Times"; + else if (isset($scheds[$row['scheduleid']])) $s=$scheds[$row['scheduleid']]; + else $s="UNKNOWN"; + echo $s; + echo ""; + echo dispyn($row['nodeenabled']); + echo ""; + echo dispyn($row['pingtest'])." / ".dispyn($row['pingfatal']); + echo ""; + echo $row['testinterval']; + echo ""; + echo dispyn($row['nsenabled']); + echo "


    "; + + } + +else + { + echo "Sorry - unknown mode for main.php"; + } + + +echo "

    "; + +?> + + +\n"; + //echo "alert('check');\n"; + echo "var url='http://www.purplepixie.org/freenats/download.php?CheckVersion2=".$NATS->Version."';\n"; + echo "var us=document.createElement('script');\n"; + echo "us.type='text/javascript';\n"; + echo "us.src=url;\n"; + echo "us.async=true;\n"; + echo "var fs=document.getElementsByTagName('script')[0];\n"; + echo "fs.parentNode.insertBefore(us, fs);\n"; + echo "\n"; +} +Screen_Footer(); +/* old PhoneHome Ping Tracker - now in screen as a png +$t=$NATS->Cfg->Get("freenats.tracker"); +if ( ($t!="") && ($t>0) ) + $NATS->PhoneHome(); +*/ +?> diff --git a/src/server/web/monitor.php b/src/server/web/monitor.php new file mode 100755 index 0000000..85fb1a7 --- /dev/null +++ b/src/server/web/monitor.php @@ -0,0 +1,293 @@ +Start(); + +// Timeskip check - means this page skips timecheck/reset if site.monitor.keepalive is 0 +if ($NATS->Cfg->Get("site.monitor.keepalive",1)==0) $timeskip=true; +else $timeskip=false; + +if (!$NATS_Session->Check($NATS->DB,$timeskip)) + { + header("Location: ./?login_msg=Invalid+Or+Expired+Session"); + exit(); + } +if ($NATS_Session->userlevel<1) UL_Error($NATS->Lang->Item("live.monitor")); + +if (isset($_REQUEST['style'])) + { + $style=$_REQUEST['style']; + setcookie("fn_monitorstyle",$style); + } +else if (isset($_COOKIE['fn_monitorstyle'])) + { + $style=$_COOKIE['fn_monitorstyle']; + } +else $style="standard"; + +if ($style=="") $style="standard"; + +Screen_Header($NATS->Lang->Item("live.monitor"),1,1,""); +?> +
    + + + +\n"; +include("css/monitor.css"); +echo "\n\n"; +*/ +?> + +Cfg->Get("site.monitor.popup",1)==0) $monpopup=false; +else $monpopup=true; + +if ($monpopup) +{ +echo "
    "; +echo "\n"; +} +?> + + + +DB->Query($q); + +if ($NATS->DB->Num_Rows($r)>0) + { + echo ""; + $a=0; + while ($row=$NATS->DB->Fetch_Array($r)) + { + if ($a==0) echo ""; + echo ""; + $a++; + if ($a==2) + { + $a=0; + echo ""; + } + } + if ($a>0) echo ""; + echo "
    "; + ng_big($row['groupid'],$row['groupname'],$row['groupdesc'],$row['groupicon']); + echo "
    "; + echo "

    "; + } + + +$NATS->DB->Free($r); + + +$q="SELECT * FROM fnnode ORDER BY alertlevel DESC, weight ASC"; +$r=$NATS->DB->Query($q); + +echo ""; +$a=0; +while ($row=$NATS->DB->Fetch_Array($r)) + { + if ($a==0) echo ""; + echo ""; + $a++; + if ($a==5) + { + $a=0; + echo ""; + } + } +if ($a>0) echo ""; +echo "
    "; + np_tiny($row['nodeid'],true,$row['nodename'],$monpopup); + echo "
    "; +$NATS->DB->Free($r); +} + +else if ($style=="alerting") +{ +$q="SELECT * FROM fngroup ORDER BY weight ASC"; +$r=$NATS->DB->Query($q); + +echo ""; +$a=0; +while ($row=$NATS->DB->Fetch_Array($r)) + { + if ($NATS->GroupAlertLevel($row['groupid'])>0) + { + if ($a==0) echo ""; + echo ""; + $a++; + if ($a==2) + { + $a=0; + echo ""; + } + } + } +if ($a>0) echo ""; +echo "
    "; + ng_big($row['groupid'],$row['groupname'],$row['groupdesc'],$row['groupicon']); + echo "
    "; + + +$NATS->DB->Free($r); + +echo "

    "; + +$q="SELECT * FROM fnnode WHERE alertlevel!=0 ORDER BY alertlevel DESC, weight ASC"; +$r=$NATS->DB->Query($q); + +echo ""; +$a=0; +while ($row=$NATS->DB->Fetch_Array($r)) + { + if ($a==0) echo ""; + echo ""; + $a++; + if ($a==5) + { + $a=0; + echo ""; + } + } +if ($a>0) echo ""; +echo "
    "; + np_tiny($row['nodeid'],true,$row['nodename'],$monpopup); + echo "
    "; +$NATS->DB->Free($r); +} + +else if ($style=="groups") +{ +$q="SELECT * FROM fngroup ORDER BY weight ASC"; +$r=$NATS->DB->Query($q); + +echo ""; +$a=0; +while ($row=$NATS->DB->Fetch_Array($r)) + { + if ($a==0) echo ""; + echo ""; + $a++; + if ($a==2) + { + $a=0; + echo ""; + } + } +if ($a>0) echo ""; +echo "
    "; + ng_big($row['groupid'],$row['groupname'],$row['groupdesc'],$row['groupicon'],$monpopup); + echo "
    "; + + +$NATS->DB->Free($r); +} + +else if ($style=="nodes") +{ +$q="SELECT * FROM fnnode ORDER BY alertlevel DESC, weight ASC"; +$r=$NATS->DB->Query($q); + +echo ""; +$a=0; +while ($row=$NATS->DB->Fetch_Array($r)) + { + if ($a==0) echo ""; + echo ""; + $a++; + if ($a==2) + { + $a=0; + echo ""; + } + } +if ($a>0) echo ""; +echo "
    "; + np_big($row['nodeid'],$row['nodename'],$row['nodedesc'],$row['nodeicon'],$monpopup); + echo "
    "; + + +$NATS->DB->Free($r); +} + +else +{ +echo "Sorry - unknown display style type

    "; +} + +mt_srand(microtime()*1000000); +if (mt_rand(0,100)==50) $track_if_enabled=true; +else $track_if_enabled=false; + +Screen_Footer($track_if_enabled); +?> diff --git a/src/server/web/monitor.popup.php b/src/server/web/monitor.popup.php new file mode 100755 index 0000000..c154d0f --- /dev/null +++ b/src/server/web/monitor.popup.php @@ -0,0 +1,92 @@ +Start(); + +// Timeskip check - means this page skips timecheck/reset if site.monitor.keepalive is 0 +if ($NATS->Cfg->Get("site.monitor.keepalive",1)==0) $timeskip=true; +else $timeskip=false; + +if (!$NATS_Session->Check($NATS->DB,$timeskip)) + { + header("Location: ./?login_msg=Invalid+Or+Expired+Session"); + exit(); + } +if ($NATS_Session->userlevel<1) UL_Error("Monitor Popup"); + +if (isset($_REQUEST['type'])) $type=$_REQUEST['type']; +else $type=""; + +echo "
    "; + +switch ($type) +{ +case "node": // a node details +if (isset($_REQUEST['nodeid'])) + { + $nodeid=ss($_REQUEST['nodeid']); + $node=$NATS->GetNode($nodeid); + if ($node===false) echo $NATS->Lang->Item("mon.popup.error"); + else + { + echo ""; + echo $node['name']; + echo ""; + echo " (".$NATS->Lang->Item("mon.goto.node").")"; + + echo "

    "; + $tests = $NATS->GetNodeTests($nodeid); + echo ""; + foreach($tests as $testid) + { + echo "\n"; + } + echo "
    "; + $test=$NATS->GetTest($testid); + echo ""; + echo $test['name']; + echo ":"; + echo ""; + if (is_numeric($test['lastvalue'])) echo round($test['lastvalue'],2); + else echo $test['lastvalue']; + $c=$testid[0]; + if ( is_numeric($c) || ($c=="L") ) echo " ".lUnit($test['testtype']); + echo "

    \n"; + + echo "".$NATS->Lang->Item("mon.goto.node.page")."
    "; + + } + } +else echo $NATS->Lang->Item("mon.popup.error"); +break; +default: +echo "Incorrect or invalid request type to popup framework"; +break; +} + +echo "
    "; +?> \ No newline at end of file diff --git a/src/server/web/node.action.php b/src/server/web/node.action.php new file mode 100755 index 0000000..69908d7 --- /dev/null +++ b/src/server/web/node.action.php @@ -0,0 +1,178 @@ +Start(); +if (!$NATS_Session->Check($NATS->DB)) + { + header("Location: ./?login_msg=Invalid+Or+Expired+Session"); + exit(); + } +if ($NATS_Session->userlevel<5) UL_Error("Action Node"); +$msg=""; + +switch($_REQUEST['action']) + { + case "delete": + if (!isset($_REQUEST['confirm'])) + { + $go="confirm.php?action=Delete+Node+".$_REQUEST['nodeid']."+and+all+associated+data&back="; + $go.=urlencode("node.action.php?action=delete&nodeid=".$_REQUEST['nodeid']."&confirm=1"); + header("Location: ".$go); + exit(); + } + // delete it and shit! + + // node + localtests + lt results + + $dnc=0; + $dnt=0; + $dnd=0; + $q="SELECT localtestid FROM fnlocaltest WHERE nodeid=\"".ss($_REQUEST['nodeid'])."\""; + $r=$NATS->DB->Query($q); + while ($row=$NATS->DB->Fetch_Array($r)) + { + $NATS->DeleteTest("L".$row['localtestid']); + /* + $dq="DELETE FROM fnrecord WHERE testid=\"L".$row['localtestid']."\""; + $NATS->DB->Query($dq); + $dnd+=$NATS->DB->Affected_Rows(); + $dq="DELETE FROM fnlocaltest WHERE localtestid=".$row['localtestid']; + $NATS->DB->Query($dq); + $dnt+=$NATS->DB->Affected_Rows(); + */ + } + $NATS->DB->Free($r); + $q="SELECT nstestid FROM fnnstest WHERE nodeid=\"".ss($_REQUEST['nodeid'])."\""; + $r=$NATS->DB->Query($q); + while ($row=$NATS->DB->Fetch_Array($r)) + { + $NATS->DeleteTest("N".$row['nstestid']); + } + $NATS->DB->Free($r); + + // node record + $dq="DELETE FROM fnnode WHERE nodeid=\"".ss($_REQUEST['nodeid'])."\""; + $NATS->DB->Query($dq); + $dnc+=$NATS->DB->Affected_Rows(); + + // group links + $q="DELETE FROM fngrouplink WHERE nodeid=\"".ss($_REQUEST['nodeid'])."\""; + $NATS->DB->Query($q); + + // alerts + $q="DELETE FROM fnalert WHERE nodeid=\"".ss($_REQUEST['nodeid'])."\""; + $NATS->DB->Query($q); + + // test runs + $q="DELETE FROM fntestrun WHERE fnode=\"".ss($_REQUEST['nodeid'])."\""; + $NATS->DB->Query($q); + + // node to alert action links + $q="DELETE FROM fnnalink WHERE nodeid=\"".ss($_REQUEST['nodeid'])."\""; + $NATS->DB->Query($q); + + // remove from any other nodes with it as a parents + $q="UPDATE fnnode SET masterid=\"\" WHERE masterid=\"".ss($_REQUEST['nodeid'])."\""; + $NATS->DB->Query($q); + + $msg="Node ".$_REQUEST['nodeid']." deleted (".$dnc." node)"; + break; + + case "create": + // get highest weight + $hw=0; + $hq="SELECT weight FROM fnnode ORDER BY weight DESC LIMIT 0,1"; + $hr=$NATS->DB->Query($hq); + if ($hrow=$NATS->DB->Fetch_Array($hr)) $hw=($hrow['weight'])+10; + else $hw=10; + $NATS->DB->Free($hr); + $nodename=$NATS->StripGPC(strtolower($_REQUEST['nodeid'])); + $nodename=str_replace(" ","_",$nodename); + if (strlen($nodename)>0) + { + $q="INSERT INTO fnnode(nodeid,weight) VALUES(\"".ss($nodename)."\",".$hw.")"; + $NATS->DB->Query($q); + if ($NATS->DB->Affected_Rows()>0) + { + header("Location: node.edit.php?nodeid=".$nodename."&showoptions=1"); + exit(); + } + } + $msg="Failed to Create Node"; + break; + + case "move": + // get my weight + $q="SELECT weight FROM fnnode WHERE nodeid=\"".ss($_REQUEST['nodeid'])."\""; + $r=$NATS->DB->Query($q); + $row=$NATS->DB->Fetch_Array($r); + $myweight=$row['weight']; + $NATS->DB->Free($r); + + // get next/prev one + $q="SELECT nodeid,weight FROM fnnode WHERE "; + if ($_REQUEST['dir']=="up") $q.="weight<".$myweight." ORDER BY weight DESC LIMIT 0,1"; + else $q.="weight>".$myweight." ORDER BY weight ASC LIMIT 0,1"; + $r=$NATS->DB->Query($q); + if ($row=$NATS->DB->Fetch_Array($r)) + { + // swap 'em + $uq="UPDATE fnnode SET weight=".$myweight." WHERE nodeid=\"".$row['nodeid']."\""; + $NATS->DB->Query($uq); + $uq="UPDATE fnnode SET weight=".$row['weight']." WHERE nodeid=\"".ss($_REQUEST['nodeid'])."\""; + $NATS->DB->Query($uq); + $msg="Updated Node Display Order"; + } + else $msg="No Higher/Lower Node"; + break; + + case "move_before": + // get nodeid of what to move before the and movebefore weight + $q="UPDATE fnnode SET weight=weight+1 WHERE weight>=".ss($_REQUEST['move_before']); + $msg=$q; + $NATS->DB->Query($q); + $q="UPDATE fnnode SET weight=".ss($_REQUEST['move_before'])." WHERE nodeid=\"".ss($_REQUEST['nodeid'])."\""; + $NATS->DB->Query($q); + //$msg="Moved Node"; + break; + + case "reorderweight": + $q="SELECT nodeid,weight FROM fnnode ORDER BY weight ASC"; + $r=$NATS->DB->Query($q); + $p=1; + while ($row=$NATS->DB->Fetch_Array($r)) + { + $uq="UPDATE fnnode SET weight=".$p." WHERE nodeid=\"".$row['nodeid']."\""; + $NATS->DB->Query($uq); + $p++; + } + $msg="Reorder Completed"; + break; + + default: $msg="Unknown Node Action"; + } +header("Location: main.php?mode=nodes&message=".urlencode($msg)); +exit(); + +?> diff --git a/src/server/web/node.edit.php b/src/server/web/node.edit.php new file mode 100755 index 0000000..92a7051 --- /dev/null +++ b/src/server/web/node.edit.php @@ -0,0 +1,711 @@ +Start(); +if (!$NATS_Session->Check($NATS->DB)) + { + header("Location: ./?login_msg=Invalid+Or+Expired+Session"); + exit(); + } +if ($NATS_Session->userlevel<5) UL_Error($NATS->Lang->Item("node.editor")); +ob_end_flush(); +Screen_Header($NATS->Lang->Item("node.editor"),1,1,"","main","nodes"); +echo "\n\n\n"; +?> +
    +StripGPC($_REQUEST['nodename']))."\","; + $q.="nodedesc=\"".ss($NATS->StripGPC($_REQUEST['nodedesc']))."\","; + $q.="testinterval=".ss($interval).","; + if (isset($_REQUEST['scheduleid'])) $q.="scheduleid=".ss($_REQUEST['scheduleid']).","; + $q.="nodeicon=\"".ss($_REQUEST['nodeicon'])."\","; + $q.="nodealert=".ss($nodealert).","; + $q.="nodeenabled=".ss($nodeenabled).",pingtest=".ss($pingtest).",pingfatal=".ss($pingfatal).","; + $q.="nsenabled=".ss($nsenabled).","; + + $q.="masterid=\"".ss($_REQUEST['masterid'])."\","; + $q.="masterjustping=".ss($_REQUEST['masterjustping']).","; + + if (isset($_REQUEST['nsurl'])) $q.="nsurl=\"".ss($NATS->StripGPC($_REQUEST['nsurl']))."\","; + if (isset($_REQUEST['nskey'])) $q.="nskey=\"".ss($NATS->StripGPC($_REQUEST['nskey']))."\","; + if (isset($_REQUEST['nspuship'])) $q.="nspuship=\"".ss($_REQUEST['nspuship'])."\","; + if (isset($_REQUEST['nsinterval'])) + { + $q.="nsinterval=".ss($_REQUEST['nsinterval']).","; + // Also use this text field as the indication that ns data is provided at all + if (isset($_REQUEST['nspullenabled'])) $set=1; + else $set=0; + $q.="nspullenabled=".$set.","; + if (isset($_REQUEST['nspushenabled'])) $set=1; + else $set=0; + $q.="nspushenabled=".$set.","; + } + + $q.="hostname=\"".ss($_REQUEST['hostname'])."\""; + + //if ($NATS->Cfg->Get("dev.links",0)==1) + //{ + // Utility Links + for ($a=0; $a<3; $a++) + { + $ulink="ulink".$a; + $utitle=$ulink."_title"; + $uurl=$ulink."_url"; + if (isset($_REQUEST[$ulink])) $ulinkv=1; + else $ulinkv=0; + $q.=",".$ulink."=".$ulinkv.","; + $q.=$utitle."=\"".ss($_REQUEST[$utitle])."\","; + $q.=$uurl."=\"".ss($_REQUEST[$uurl])."\""; + } + //} + + + + $q.=" WHERE nodeid=\"".ss($_REQUEST['nodeid'])."\""; + //echo $q; + $NATS->DB->Query($q); + + if ($NATS->DB->Affected_Rows()<=0) + { + echo "".$NATS->Lang->Item("save.failed")."
    "; + $poplist[]=$NATS->Lang->Item("save.failed"); + } + else + { + echo "".$NATS->Lang->Item("save.ok")."
    "; + $poplist[]=$NATS->Lang->Item("save.ok"); + } + + // Update Interval If Changed + if ( isset($_REQUEST['testinterval']) && isset($_REQUEST['original_testinterval']) && + ( $_REQUEST['testinterval'] != $_REQUEST['original_testinterval'] ) ) + $NATS->InvalidateNode($_REQUEST['nodeid']); + + // Update Nodeside if Newly Enabled and empty... + if ( isset($_REQUEST['original_nsenabled']) && ($_REQUEST['original_nsenabled']==0) && ($nsenabled==1) ) + { + $q="SELECT nskey FROM fnnode WHERE nodeid=\"".ss($_REQUEST['nodeid'])."\""; + $r=$NATS->DB->Query($q); + if ($row=$NATS->DB->Fetch_Array($r)) + { + if ($row['nskey']=="") // generate one + { + $allow="abcdef0123456789"; + $len=64; + $alen=strlen($allow); + mt_srand(microtime()*1000000); + $key=""; + for ($a=0; $a<$len; $a++) + $key.=$allow[mt_rand(0,$alen-1)]; + $uq="UPDATE fnnode SET nskey=\"".$key."\" WHERE nodeid=\"".ss($_REQUEST['nodeid'])."\""; + $NATS->DB->Query($uq); + } + $NATS->DB->Free($r); + } + } + + } + else if ($_REQUEST['action']=="invalidate") + { + $_REQUEST['showoptions']=1; + $NATS->InvalidateNode($_REQUEST['nodeid'],true); + } + else if ($_REQUEST['action']=="nodesiderefresh") + { + $_REQUEST['showoptions']=1; + $res=$NATS->NodeSide_Pull($_REQUEST['nodeid']); + if ($res===false) + { + $poplist[]=$NATS->Lang->Item("nodeside.fetch.error"); + echo "".$NATS->Lang->Item("nodeside.fetch.error")."

    "; + } + else + { + $poplist[]=$NATS->Lang->Item("nodeside.refreshed"); + echo "".$NATS->Lang->Item("nodeside.refreshed")."

    "; + } + } + else if ($_REQUEST['action']=="save_actions") + { + // build the two lists... + $cur=array(); + $cc=0; + $nl=array(); + $nc=0; + + if (isset($_REQUEST['links'])) + { + foreach($_REQUEST['links'] as $link) + { + $nl[$link]['proc']=false; // not processed or existing i.e. outstanding + $nl[$link]['aaid']=$link; + $nc++; + } + } + + $q="SELECT nalid,aaid FROM fnnalink WHERE nodeid=\"".ss($_REQUEST['nodeid'])."\""; + $r=$NATS->DB->Query($q); + while ($row=$NATS->DB->Fetch_Array($r)) + { + //echo $row['aaid'].":"; + $cur[$row['aaid']]['proc']=false; + $cur[$row['aaid']]['nalid']=$row['nalid']; + $cur[$row['aaid']]['aaid']=$row['aaid']; + $cc++; + } + + // now we have the two lists lets process them + foreach($nl as $newone) + { + if (isset($cur[$newone['aaid']])) // exists - do nothing to both + { + //echo "
    ".$newone['aaid'].":"; + $cur[$newone['aaid']]['proc']=true; + $nl[$newone['aaid']]['proc']=true; + } + // otherwise news are left false to insert and curs false to delete + } + + // so lets do that + foreach($nl as $newone) + { + if ($newone['proc']==false) + { + //echo $q; + $q="INSERT INTO fnnalink(aaid,nodeid) VALUES(".ss($newone['aaid']).",\"".ss($_REQUEST['nodeid'])."\")"; + $NATS->DB->Query($q); + } + } + foreach($cur as $curone) + { + if ($curone['proc']==false) + { + $q="DELETE FROM fnnalink WHERE nalid=".$curone['nalid']; + $NATS->DB->Query($q); + //echo $q; + } + } + + echo $NATS->Lang->Item("save.ok")."

    "; + $poplist[]=$NATS->Lang->Item("save.ok"); + + + } + + } + + + +echo "".$NATS->Lang->Item("editing")." ".$NATS->Lang->Item("node").": "; +echo "".$_REQUEST['nodeid']."

    "; + + +$q="SELECT * FROM fnnode WHERE nodeid=\"".ss($_REQUEST['nodeid'])."\" LIMIT 0,1"; +$r=$NATS->DB->Query($q); +if (!$row=$NATS->DB->Fetch_Array($r)) + { + echo $NATS->Lang->Item("no.such.node")."

    "; + Screen_Footer(); + exit(); + } +$NATS->DB->Free($r); + +$title="".$NATS->Lang->Item("node.settings").""; +Start_Round($title,600); +echo "
    "; +echo "
    "; +echo ""; + +echo ""; +echo ""; + +echo ""; + +echo ""; + +echo ""; + +echo ""; + +echo ""; + +echo ""; + +echo ""; + +echo ""; +echo ""; + +echo ""; + +echo ""; + +echo ""; +echo ""; + +echo ""; + +echo ""; + +echo ""; + +echo ""; + +echo ""; + +echo ""; +echo ""; + +if ($nodeside) + { + echo ""; + + echo ""; + if ($row['nspullenabled']==1) $s=" checked"; + else $s=""; + echo ""; + + echo ""; + + echo ""; + + echo ""; + if ($row['nspushenabled']==1) $s=" checked"; + else $s=""; + echo ""; + + echo ""; + + echo ""; + + if ($row['nspullenabled']==1) + { + echo ""; + } + + echo ""; + + echo ""; + + } + +echo ""; + +// New Utility Links +//if ($NATS->Cfg->Get("dev.links",0)==1) // ABOVE AS WELL!! +//{ +echo ""; + + +echo ""; +//} + + +echo ""; +echo "
    "; +echo $NATS->Lang->Item("node.id"); +echo " :"; +echo $row['nodeid']; +echo "
    "; +echo $NATS->Lang->Item("node.name"); +echo " :"; +echo ""; +echo "
    "; +echo $NATS->Lang->Item("hostname"); +echo " :"; +echo ""; +echo "
    "; +echo $NATS->Lang->Item("description"); +echo " :"; +echo ""; +echo "
    "; +echo $NATS->Lang->Item("node.icon"); +echo " :"; +echo " [ Show Icons ]"; +echo " [ ".$NATS->Lang->Item("show.hide.icons")." ]"; +echo "
    "; +echo "
    "; +echo "
    "; +echo $NATS->Lang->Item("master.node"); +echo " :"; +echo " ".hlink("Node:Master")."\n"; +echo "
    "; +echo $NATS->Lang->Item("master.skip"); +echo " :"; +echo " ".hlink("MasterNode:Ping")."\n"; +echo "

    "; +echo $NATS->Lang->Item("node.enabled"); +echo " :"; +if ($row['nodeenabled']==1) $s=" checked"; +else $s=""; +echo ""; +echo " ".hlink("Node:Enabled"); +echo "
    "; +echo $NATS->Lang->Item("test.schedule"); +echo " :"; +echo ""; +$NATS->DB->Free($sr); +echo " ".hlink("Schedule"); +echo "
    "; +echo $NATS->Lang->Item("test.interval"); +echo " :"; +echo " "; +echo $NATS->Lang->Item("minutes")." ".hlink("Node:TestInterval"); +echo "
    "; +echo $NATS->Lang->Item("test.due"); +echo " :"; +if ($row['nextrunx']>0) echo nicedt($row['nextrunx']); +else echo $NATS->Lang->Item("now"); +echo "
    "; +echo nicenextx($row['nextrunx']); +echo " ".$NATS->Lang->Item("check.asap")." "; +echo hlink("Node:CheckASAP",12); +echo "
    "; +echo $NATS->Lang->Item("alerts.active"); +echo " :"; +if ($row['nodealert']==1) $s=" checked"; +else $s=""; +echo ""; +echo " ".hlink("Node:AlertActive"); +echo "

    "; +echo $NATS->Lang->Item("ping.test"); +echo " :"; +if ($row['pingtest']==1) $s=" checked"; +else $s=""; +echo ""; +echo " ".hlink("Node:PingTest"); +echo "
    "; +echo $NATS->Lang->Item("require.ping"); +echo " :"; +if ($row['pingfatal']==1) $s=" checked"; +else $s=""; +echo ""; +echo " ".hlink("Node:RequirePing"); +echo "

    "; +echo $NATS->Lang->Item("nodeside.testing"); +echo " :"; +if ($row['nsenabled']==1) $nodeside=true; +else $nodeside=false; +if ($nodeside) $s=" checked"; +else $s=""; +echo ""; +echo " ".hlink("Nodeside"); +echo "
    ".$NATS->Lang->Item("node.key")." :"; + echo ""; + echo " ".hlink("Nodeside:Key"); + echo "
    ".$NATS->Lang->Item("pull.enabled")." : "; + echo hlink("Nodeside:PullEnabled"); + echo "
    ".$NATS->Lang->Item("pull.url")." :"; + echo ""; + if ($row['nsurl']!="") + { + $uri=$row['nsurl']."?nodekey=".$row['nskey']."&noupdates=1"; + echo " ".$NATS->Lang->Item("debug.raw").""; + } + echo " ".hlink("Nodeside:URL"); + echo "
    ".$NATS->Lang->Item("pull.interval")." :"; + echo ""; + echo " ".$NATS->Lang->Item("minutes")." ".hlink("Nodeside:Interval"); + echo "
    ".$NATS->Lang->Item("push.enabled")." : "; + echo hlink("Nodeside:PushEnabled"); + echo "
    ".$NATS->Lang->Item("push.ip")." :"; + echo ""; + echo " ".hlink("Nodeside:PushIP"); + echo "
    ".$NATS->Lang->Item("last.data")." :"; + echo nicedt($row['nslastx'])." - ".dtago($row['nslastx'])."
    ".$NATS->Lang->Item("next.pull.due")." :"; + if ($row['nsnextx']>0) echo nicedt($row['nsnextx'])." - ".nicenextx($row['nsnextx']); + else echo $NATS->Lang->Item("now"); + echo "
    ".$NATS->Lang->Item("catalogue")." :"; + $nsq="SELECT COUNT(nstestid) FROM fnnstest WHERE nodeid=\"".ss($_REQUEST['nodeid'])."\""; + $nsr=$NATS->DB->Query($nsq); + if ($nsrow=$NATS->DB->Fetch_Array($nsr)) + { + echo $nsrow['COUNT(nstestid)']." ".$NATS->Lang->Item("nodeside.monitors"); + } + $NATS->DB->Free($nsr); + echo "
    ".$NATS->Lang->Item("refresh.now").":"; + if ($row['nspullenabled']==1) echo "".$NATS->Lang->Item("nodeside.pull.now").""; + else echo "".$NATS->Lang->Item("nodeside.pull.disabled").""; + echo "

    ".$NATS->Lang->Item("utility.links")." ".hlink("UtilLinks",12)." :"; +echo ""; +echo ""; +for ($a=0; $a<3; $a++) // auto loop through them + { + $ulink="ulink".$a; + $utitle=$ulink."_title"; + $uurl=$ulink."_url"; + echo "\n"; + } +echo "
     ".$NATS->Lang->Item("title")."".$NATS->Lang->Item("url")."
    "; + if ($row[$ulink]) $s=" checked"; + else $s=""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "
    "; +echo "

    "; +echo "Lang->Item("save.settings")."\"> ".$NATS->Lang->Item("cancel").""; +echo "

    "; +echo "
    "; +echo "
    "; +echo "".$NATS->Lang->Item("show.hide.options").""; +echo "\n"; +End_Round(); + +if (isset($_REQUEST['show_icons'])) + { + echo "

    "; + ShowIcons(); + echo "

    "; + } + +//echo "
    "; + +echo "

    "; +$title="".$NATS->Lang->Item("node.tests").""; +Start_Round($title,600); +echo ""; +$q="SELECT * FROM fnlocaltest WHERE nodeid=\"".ss($_REQUEST['nodeid'])."\" AND testtype!=\"ICMP\" ORDER BY localtestid ASC"; +$r=$NATS->DB->Query($q); +while ($row=$NATS->DB->Fetch_Array($r)) + { + echo ""; + + echo ""; + } + +if ($nodeside) + { + $q="SELECT * FROM fnnstest WHERE nodeid=\"".ss($_REQUEST['nodeid'])."\" AND testenabled=1 ORDER BY testtype"; + $r=$NATS->DB->Query($q); + while ($row=$NATS->DB->Fetch_Array($r)) + { + echo ""; + + echo ""; + } + $NATS->DB->Free($r); + } + +echo ""; +echo "\n"; +echo ""; +echo ""; +echo ""; + +if ($nodeside) + { + echo ""; + echo ""; + echo ""; + echo ""; + } + +echo "
    "; + + echo ""; + if (strlen($row['testparam'])>10) $tp=substr($row['testparam'],0,8).".."; + else $tp=$row['testparam']; + if ($row['testname']=="") echo lText($row['testtype'])." (".$tp.")"; + else echo $row['testname']; + echo ""; + echo " "; + echo "Lang->Item("edit.options")."\"> "; + echo ""; + echo "Lang->Item("delete")."\">"; + + echo "  ".$NATS->Lang->Item("last.tested").": ".dtago($row['lastrunx']).""; + echo "
    "; + + echo ""; + if ($row['testname']=="") echo $row['testdesc']; + else echo $row['testname']; + echo ""; + echo " "; + echo "Lang->Item("edit.options")."\"> "; + echo ""; + echo "Lang->Item("delete")."\">"; + + echo "  ".$NATS->Lang->Item("last.tested").": ".dtago($row['lastrunx']).""; + echo "
     
    ".$NATS->Lang->Item("add.test")." : "; + +// one day will do fancy JS option here but for now moved to the edit +//echo " "; +echo ""; +echo ""; + +echo "Lang->Item("create.test")."\">"; +echo "
    ".$NATS->Lang->Item("add.nodeside")." :"; + echo " Lang->Item("add")."\">"; + echo "
    "; +End_Round(); +echo "

    "; + +$title="".$NATS->Lang->Item("alert.actions")." ".hlink("AlertAction",12); +Start_Round($title,600); +echo ""; +echo ""; +echo ""; +$q="SELECT aaid,aname FROM fnalertaction"; +$r=$NATS->DB->Query($q); +$c=0; +while ($row=$NATS->DB->Fetch_Array($r)) + { + // has link? + $lq="SELECT nalid FROM fnnalink WHERE nodeid=\"".ss($_REQUEST['nodeid'])."\" AND aaid=".ss($row['aaid'])." LIMIT 0,1"; + $lr=$NATS->DB->Query($lq); + if ($NATS->DB->Num_Rows($lr)>0) $s=" checked"; + else $s=""; + $NATS->DB->Free($lr); + echo ""; + } +$NATS->DB->Free($r); +echo ""; +echo "
    "; + echo "".$row['aaid']." - ".$row['aname']."
    Lang->Item("update.alert.actions")."\">
    "; +End_Round(); +?> +

    + + diff --git a/src/server/web/node.php b/src/server/web/node.php new file mode 100755 index 0000000..b5ffd39 --- /dev/null +++ b/src/server/web/node.php @@ -0,0 +1,224 @@ +Start(); +if (!$NATS_Session->Check($NATS->DB)) + { + $p = $_SERVER['HTTPS']=="on" ? "https" : "http"; + $url = $p."://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; + header("Location: ./?login_msg=Invalid+Or+Expired+Session&url=".urlencode($url)); + exit(); + } +if ($NATS_Session->userlevel<1) UL_Error($NATS->Lang->Item("viewing.node")); +ob_end_flush(); +Screen_Header($NATS->Lang->Item("viewing.node")." ".$_REQUEST['nodeid'],1); +?> +
    +Node: ".$_REQUEST['nodeid']."

    "; + +echo "
    "; + +$q="SELECT * FROM fnnode WHERE nodeid=\"".ss($_REQUEST['nodeid'])."\" LIMIT 0,1"; +$r=$NATS->DB->Query($q); +if (!$row=$NATS->DB->Fetch_Array($r)) + { + echo $NATS->Lang->Item("no.node")."

    "; + Screen_Footer(); + exit(); + } +$NATS->DB->Free($r); +$node=$row; + +echo ""; + +echo ""; + +echo ""; + +echo ""; + +echo ""; + +echo ""; + +$aq="SELECT alertid,alertlevel,openedx FROM fnalert WHERE nodeid=\"".ss($_REQUEST['nodeid'])."\" AND closedx=0 LIMIT 0,1"; +//echo $aq; +$ar=$NATS->DB->Query($aq); +echo ""; + +if ($NATS_Session->userlevel>4) echo ""; +echo ""; + +echo ""; + +// Utility Links +//if ($NATS->Cfg->Get("dev.links",0)==1) +//{ +$shown_header=false; +for ($a=0; $a<3; $a++) + { + $ulink="ulink".$a; + $utitle=$ulink."_title"; + $uurl=$ulink."_url"; + if ($row[$ulink]==1) + { // link is enabled + if (!$shown_header) // first one + { + echo ""; // if shown any +//} + +echo "
    "; +echo $NATS->Lang->Item("node.name"); +echo " :"; +echo $row['nodename']; +echo "
    "; +echo $NATS->Lang->Item("status"); +echo " :"; +echo ""; +echo oText($row['alertlevel']); +echo ""; +echo "
    "; +echo $NATS->Lang->Item("hostname"); +echo ": "; +echo $row['hostname']; +echo " 
    "; +echo $NATS->Lang->Item("description"); +echo " :"; +echo $row['nodedesc']; +echo " 
    "; +echo $NATS->Lang->Item("enabled"); +echo ": "; +if ($row['nodeenabled']==1) $s=$NATS->Lang->Item("yes"); +else $s=$NATS->Lang->Item("no"); +echo $s; +echo "
    +Alert +:"; +if ($arow=$NATS->DB->Fetch_Array($ar)) + { + echo "".$NATS->Lang->Item("yes")." - ".oText($arow['alertlevel'])." "; + echo "(".$NATS->Lang->Item("opened")." ".dtago($arow['openedx']).")"; + } +else echo "".$NATS->Lang->Item("no")." [ ".$NATS->Lang->Item("alert.history")." ]"; +echo "
    ".$NATS->Lang->Item("edit")." :".$NATS->Lang->Item("edit.node.options")."
    ".$NATS->Lang->Item("summary")." :"; +$finishx=time(); +$startx=$finishx-(60*60*24); +echo "".$NATS->Lang->Item("last.24h")." | "; +echo "".$NATS->Lang->Item("today").""; +echo "
    ".$NATS->Lang->Item("links")." :"; + $shown_header=true; + } + $url=$row[$uurl]; + $url=str_replace("{HOSTNAME}",$row['hostname'],$url); + $url=str_replace("{NODENAME}",$row['nodename'],$url); + $url=str_replace("{NODEID}",$row['nodeid'],$url); + if ($NATS->Cfg->Get("site.links.newwindow",0)==1) $tgt=" target=\"top\""; + else $tgt=""; + echo "".$row[$utitle]." "; + } + } +if ($shown_header) echo "
    "; + +echo "
     "; +np_tiny($_REQUEST['nodeid']); +echo "
    "; + +echo "

    "; + +echo "".$NATS->Lang->Item("local.tests")."

    "; + +echo ""; + +$q="SELECT * FROM fnlocaltest WHERE nodeid=\"".ss($_REQUEST['nodeid'])."\" ORDER BY localtestid ASC"; +$r=$NATS->DB->Query($q); +while ($row=$NATS->DB->Fetch_Array($r)) + { + echo ""; + + echo ""; + + echo ""; + + echo ""; + + echo ""; + } + +echo "
    "; + + if ($row['testname']=="") + { + if (strlen($row['testparam'])>10) $tp=substr($row['testparam'],0,8).".."; + else $tp=$row['testparam']; + echo lText($row['testtype']); + if ($tp!="") echo " (".$tp.")"; + } + else echo $row['testname']; + echo "".oText($row['alertlevel'])."(".dtago($row['lastrunx']).")"; + if (($row['testrecord']==1)||($row['testtype']=="ICMP")) + echo "[ ".$NATS->Lang->Item("history")." ]"; + else echo " "; + echo "
    "; +echo "

    "; +if ($node['nsenabled']==1) + { + echo "".$NATS->Lang->Item("nodeside.tests")."

    "; + + echo ""; + + $q="SELECT * FROM fnnstest WHERE nodeid=\"".ss($_REQUEST['nodeid'])."\" AND testenabled=1 ORDER BY testtype"; + $r=$NATS->DB->Query($q); + while ($row=$NATS->DB->Fetch_Array($r)) + { + echo ""; + + echo ""; + + echo ""; + + echo ""; + + echo ""; + } + + echo "
    "; + + if ($row['testname']=="") + { + echo $row['testdesc']; + } + else echo $row['testname']; + echo "".oText($row['alertlevel'])."(".dtago($row['lastrunx']).")"; + if (($row['testrecord']==1)) + echo "[ ".$NATS->Lang->Item("history")." ]"; + else echo " "; + echo "
    "; + } +?> + + + diff --git a/src/server/web/nodeside.edit.php b/src/server/web/nodeside.edit.php new file mode 100755 index 0000000..455c0bb --- /dev/null +++ b/src/server/web/nodeside.edit.php @@ -0,0 +1,242 @@ +Start(); +if (!$NATS_Session->Check($NATS->DB)) + { + header("Location: ./?login_msg=Invalid+Or+Expired+Session"); + exit(); + } +if ($NATS_Session->userlevel<5) UL_Error($NATS->Lang->Item("edit.nodeside.test")); + +if (isset($_REQUEST['action'])) + { + switch($_REQUEST['action']) + { + case "enable": + $q="UPDATE fnnstest SET testenabled=1 WHERE nstestid=".ss($_REQUEST['nstestid']); + //echo $q; + $NATS->DB->Query($q); + //exit(); + header("Location: node.edit.php?nodeid=".$_REQUEST['nodeid']); + exit(); + case "disable": + $q="UPDATE fnnstest SET testenabled=0 WHERE nstestid=".ss($_REQUEST['nstestid']); + //echo $q; + $NATS->DB->Query($q); + //exit(); + header("Location: node.edit.php?nodeid=".$_REQUEST['nodeid']); + exit(); + case "save_form": + if (isset($_REQUEST['testalerts'])) $testalerts=1; + else $testalerts=0; + if (isset($_REQUEST['simpleeval'])) $simpleeval=1; + else $simpleeval=0; + if (isset($_REQUEST['testrecord'])) $testrecord=1; + else $testrecord=0; + $q="UPDATE fnnstest SET testalerts=".$testalerts.",simpleeval=".$simpleeval.",testname=\"".ss($_REQUEST['testname'])."\",testrecord=".$testrecord." "; + $q.="WHERE nstestid=".ss($_REQUEST['nstestid']); + //echo $q; + $NATS->DB->Query($q); + if ($NATS->DB->Affected_Rows()>0) $_REQUEST['message']=$NATS->Lang->Item("save.ok"); + else $_REQUEST['message']=$NATS->Lang->Item("save.fail"); + break; + } + } + +ob_end_flush(); +Screen_Header($NATS->Lang->Item("edit.nodeside.test"),1,1,"","main","nodes"); +if (isset($_REQUEST['message'])) echo "
    ".$_REQUEST['message']."
    "; + +$q="SELECT * FROM fnnstest WHERE nstestid=".ss($_REQUEST['nstestid'])." LIMIT 0,1"; +$r=$NATS->DB->Query($q); + +if (!$row=$NATS->DB->Fetch_Array($r)) + { + echo $NATS->Lang->Item("no.test"); + Screen_Footer(); + exit(); + } +$NATS->DB->Free($r); + +echo "
    "; +echo "".$NATS->Lang->Item("editing.test").": ".$row['nodeid']." > "; +if ($row['testname']=="") echo $row['testtype']; +else echo $row['testname']; +echo "

    "; + +$t="".$NATS->Lang->Item("nodeside.test")." ".$row['testtype']." on ".$row['nodeid'].""; +Start_Round($t,600); + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +if ($row['testalerts']==1) $s=" checked"; +else $s=""; +echo ""; +echo ""; + +if ($row['testrecord']==1) $s=" checked"; +else $s=""; +echo ""; +echo ""; + +if ($row['simpleeval']==1) $s=" checked"; +else $s=""; +echo ""; +echo ""; + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +echo ""; +echo "
    ".$NATS->Lang->Item("ns.type")." :".$row['testtype']."
    ".$NATS->Lang->Item("description")." :".$row['testdesc']."
    ".$NATS->Lang->Item("custom.name")." :
    ".$NATS->Lang->Item("test.alerts")." :"; +echo " ".hlink("Test:TestAlerts"); +echo "
    ".$NATS->Lang->Item("recorded")." :"; +echo " ".hlink("Test:Recorded"); +echo "
    ".$NATS->Lang->Item("simple.eval")." :"; +echo " ".hlink("Test:SimpleEvaluation"); +echo "

    ".$NATS->Lang->Item("last.checked")." :".nicedt($row['lastrunx'])." - ".dtago($row['lastrunx'])."
    ".$NATS->Lang->Item("last.result")." :"; +echo ""; +echo oText($row['alertlevel']); +echo ""; +echo "
    ".$NATS->Lang->Item("last.value")." :".$row['lastvalue']."

     Lang->Item("save.changes")."\"> "; +echo "".$NATS->Lang->Item("abandon.changes").""; +echo "
    "; + +End_Round(); + + +echo "

    "; + + +/* +$t="Test Evaluators"; +Start_Round($t,600); + + +echo ""; +echo ""; + +$q="SELECT * FROM fneval WHERE testid=\"N".ss($_REQUEST['nstestid'])."\" ORDER BY weight ASC"; +$r=$NATS->DB->Query($q); +while ($row=$NATS->DB->Fetch_Array($r)) + { + echo ""; + //echo ""; + } + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + + +echo "
     
    "; +if ($row['simpleeval']==1) + { + echo "Custom evaluators will not be processed as
    Simple Evaluation is checked (above)

    "; + } +echo "
    "; + echo ""; + echo "  "; + echo "Result ".eval_operator_text($row['eoperator'])." ".$row['evalue']." => ".oText($row['eoutcome']).""; + //echo " | Up/Down"; + echo "
     
     
    Add New : => "; +echo "
    "; +End_Round(); +*/ + + +$t="".$NATS->Lang->Item("test.evals").""; +Start_Round($t,600); + + +echo ""; +echo ""; + +$q="SELECT * FROM fneval WHERE testid=\"N".ss($_REQUEST['nstestid'])."\" ORDER BY weight ASC"; +$r=$NATS->DB->Query($q); +while ($row=$NATS->DB->Fetch_Array($r)) + { + echo ""; + //echo ""; + } + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + + +echo "
     
    "; +if ($row['simpleeval']==1) + { + echo "".$NATS->Lang->Item("test.evals.simple")."
    "; + } +echo "
    "; + echo "Lang->Item("eval.deleted"))."&evalid=".$row['evalid']."\">"; + echo "  "; + echo $NATS->Lang->Item("result")." ".eval_operator_text($row['eoperator'])." ".$row['evalue']." => ".oText($row['eoutcome']).""; + //echo " | Up/Down"; + echo "
     
     
    ".$NATS->Lang->Item("add.eval")." : => "; +echo " Lang->Item("add")."\">
    "; +End_Round(); + + +Screen_Footer(); +?> diff --git a/src/server/web/nodeside.push.php b/src/server/web/nodeside.push.php new file mode 100755 index 0000000..87f99d9 --- /dev/null +++ b/src/server/web/nodeside.push.php @@ -0,0 +1,83 @@ +Start(); + +// From Client - nodeid, nodekey, xml +// From Server - REMOTE_ADDR +$nodeid=$_REQUEST['nodeid']; +$nodekey=$_REQUEST['nodekey']; +$xml=$_REQUEST['xml']; +$remoteip=$_SERVER['REMOTE_ADDR']; + +$q="SELECT nskey,nsenabled,nspushenabled,nspuship FROM fnnode WHERE nodeid=\"".ss($nodeid)."\""; +$r=$NATS->DB->Query($q); +if (!$node=$NATS->DB->Fetch_Array($r)) + { + echo "Invalid nodeid"; + exit(); + } +if ($node['nsenabled']!=1) + { + echo "Nodeside Disabled for Node"; + exit(); + } +if ($node['nspushenabled']!=1) + { + echo "Nodeside Push Disabled for Node"; + exit(); + } +if ( ($node['nspuship']!="") && ($node['nspuship'] != $remoteip) ) + { + echo "Remote IP Not Allowed for Push"; + exit(); + } +if ( ($node['nskey']!="") && ($node['nskey'] != $nodekey) ) + { + echo "Nodekey Failure"; + exit(); + } + +// Got here so ok! + +$xmlobj=new TNodeXML(); + +$xmlobj->Parse($xml); + +if ($xmlobj->Error()!="") + { + echo "XML Error: ".$xmlobj->Error(); + exit(); + } + +$eventdata=array("nodeid"=>$nodeid); +$NATS->EventHandler("nodeside_push",$eventdata); + +$NATS->Nodeside_Process($nodeid,$xmlobj); + +$uq="UPDATE fnnode SET nsfreshpush=1,nslastx=".time()." WHERE nodeid=\"".ss($nodeid)."\""; +$NATS->DB->Query($uq); + +echo "1"; +$NATS->Stop(); +exit(); +?> \ No newline at end of file diff --git a/src/server/web/pref.php b/src/server/web/pref.php new file mode 100755 index 0000000..fbcb230 --- /dev/null +++ b/src/server/web/pref.php @@ -0,0 +1,80 @@ +Start(); +if (!$NATS_Session->Check($NATS->DB)) + { + header("Location: ./?login_msg=Invalid+Or+Expired+Session"); + exit(); + } +ob_end_flush(); + +if (isset($_REQUEST['action'])) + { + switch ($_REQUEST['action']) + { + case "password": + if ($_REQUEST['p_new']!=$_REQUEST['p_confirm']) $message="Passwords Do Not Match"; + else if ($_REQUEST['p_new']=="") $message="Illegal New Password"; + else + { + $q="UPDATE fnuser SET password=MD5(\"".ss($_REQUEST['p_new'])."\") WHERE username=\"".ss($NATS_Session->username)."\""; + $q.=" AND password=MD5(\"".ss($_REQUEST['p_current'])."\")"; + $NATS->DB->Query($q); + if ($NATS->DB->Affected_Rows()>0) $message=$NATS->Lang->Item("pass.change.ok"); + else $message=$NATS->Lang->Item("pass.change.fail"); + } + break; + + } + } + +Screen_Header($NATS->Lang->Item("user.pref"),1,0,"","main","pref"); + +if (isset($_REQUEST['message'])) echo "
    ".$_REQUEST['message']."
    "; +if (isset($message)) echo "
    ".$message."
    "; + +?> +
    +Lang->Item("user.pref"); ?>

    + + + + + + + + + + + + + +
    Lang->Item("change.password"); ?>
    Lang->Item("current"); ?> :
    Lang->Item("new"); ?> :
    Lang->Item("confirm"); ?> :
    ">
    +

    + + + diff --git a/src/server/web/report.php b/src/server/web/report.php new file mode 100755 index 0000000..1397670 --- /dev/null +++ b/src/server/web/report.php @@ -0,0 +1,725 @@ +Start(); +if (!$NATS_Session->Check($NATS->DB)) + { + header("Location: ./?login_msg=Invalid+Or+Expired+Session"); + exit(); + } +if ($NATS_Session->userlevel<1) UL_Error("View Report"); + +if (isset($_REQUEST['mode'])) $mode=$_REQUEST['mode']; +else $mode=""; + +if ($mode=="savereport") + { + if ($NATS_Session->userlevel<5) UL_Error("Save Report"); + $q="INSERT INTO fnreport(reportname,reporttests) VALUES(\"".ss($_REQUEST['reportname'])."\",\"".ss($_REQUEST['reporttests'])."\")"; + $NATS->DB->Query($q); + header("Location: main.php?mode=views&message=Saved+Report"); + exit(); + } + +if ($mode=="delete") + { + if ($NATS_Session->userlevel<5) UL_Error("Delete Report"); + if (!isset($_REQUEST['confirmed'])) + { + $back="report.php?mode=delete&reportid=".$_REQUEST['reportid']."&confirmed=1"; + $back=urlencode($back); + $msg=urlencode("Delete availability report"); + header("Location: confirm.php?action=".$msg."&back=".$back); + exit(); + } + $q="DELETE FROM fnreport WHERE reportid=".ss($_REQUEST['reportid']); + $NATS->DB->Query($q); + $message=urlencode("Report Deleted"); + header("Location: main.php?mode=views&message=".$message); + exit(); + } + +$testlist=array(); +if (isset($_REQUEST['reportid'])) + { + $q="SELECT * FROM fnreport WHERE reportid=".ss($_REQUEST['reportid'])." LIMIT 0,1"; + $r=$NATS->DB->Query($q); + if ($rep=$NATS->DB->Fetch_Array($r)) + { + $testlist=explode(":",$rep['reporttests']); + } + } + + +function slist($var,$min,$max,$val) + { + echo "\n\n"; + } + +function cbd($var,$name) + { + if (isset($_REQUEST[$var])) $s=" checked"; + else $s=""; + echo " ".$name; + } + +function np($big,$part) + { + if ($big==0) return "n/a"; + if ($part==0) return "0%"; + + $p=($part/$big)*100; + $p=round($p,2); + return $p."%"; + } + +$td_day=date("d"); +$td_mon=date("m"); +$td_yr=date("Y"); + +$start=array(); +$finish=array(); +if (isset($_REQUEST['st_day'])) $start['day']=$_REQUEST['st_day']; +else $start['day']=$td_day; +if (isset($_REQUEST['st_mon'])) $start['mon']=$_REQUEST['st_mon']; +else $start['mon']=$td_mon; +if (isset($_REQUEST['st_yr'])) $start['yr']=$_REQUEST['st_yr']; +else $start['yr']=$td_yr; +if (isset($_REQUEST['st_hour'])) $start['hour']=$_REQUEST['st_hour']; +else $start['hour']=0; +if (isset($_REQUEST['st_min'])) $start['min']=$_REQUEST['st_min']; +else $start['min']=0; +if (isset($_REQUEST['st_sec'])) $start['sec']=$_REQUEST['st_sec']; +else $start['sec']=0; + +if (isset($_REQUEST['fi_day'])) $finish['day']=$_REQUEST['fi_day']; +else $finish['day']=$td_day; +if (isset($_REQUEST['fi_mon'])) $finish['mon']=$_REQUEST['fi_mon']; +else $finish['mon']=$td_mon; +if (isset($_REQUEST['fi_yr'])) $finish['yr']=$_REQUEST['fi_yr']; +else $finish['yr']=$td_yr; +if (isset($_REQUEST['fi_hour'])) $finish['hour']=$_REQUEST['fi_hour']; +else $finish['hour']=23; +if (isset($_REQUEST['fi_min'])) $finish['min']=$_REQUEST['fi_min']; +else $finish['min']=59; +if (isset($_REQUEST['fi_sec'])) $finish['sec']=$_REQUEST['fi_sec']; +else $finish['sec']=59; + +if (isset($_REQUEST['startx'])) + { + $start['day']=date("d",$_REQUEST['startx']); + $start['mon']=date("m",$_REQUEST['startx']); + $start['yr']=date("Y",$_REQUEST['startx']); + $start['hour']=date("H",$_REQUEST['startx']); + $start['min']=date("i",$_REQUEST['startx']); + $start['sec']=date("s",$_REQUEST['startx']); + $startx=$_REQUEST['startx']; + } +else + $startx=mktime($start['hour'],$start['min'],$start['sec'],$start['mon'],$start['day'],$start['yr']); + +if (isset($_REQUEST['finishx'])) + { + $finish['day']=date("d",$_REQUEST['finishx']); + $finish['mon']=date("m",$_REQUEST['finishx']); + $finish['yr']=date("Y",$_REQUEST['finishx']); + $finish['hour']=date("H",$_REQUEST['finishx']); + $finish['min']=date("i",$_REQUEST['finishx']); + $finish['sec']=date("s",$_REQUEST['finishx']); + $finishx=$_REQUEST['finishx']; + } +else + $finishx=mktime($finish['hour'],$finish['min'],$finish['sec'],$finish['mon'],$finish['day'],$finish['yr']); +//echo $startx." ".nicedt($startx)."
    "; +//echo $finishx." ".nicedt($finishx)."
    "; + + +if ($mode=="") + { + Screen_Header("Service Availability Report",1); + ob_end_flush(); + + + + + + + + + + echo "Reporting Period

    "; + echo "
    "; + echo ""; + echo "
    "; + echo " Custom Period"; + echo ""; + echo ""; + echo ""; + + + + + + echo ""; + echo ""; + + echo ""; + + echo ""; + + echo ""; + + echo ""; + + echo ""; + + echo ""; + + // ----- finish + + echo ""; + echo ""; + + echo ""; + + echo ""; + + echo ""; + + echo ""; + + echo ""; + + echo ""; + + + + echo "
     HourMinSecDayMonYear
    Start:"; + slist("st_hour",0,23,$start['hour']); + echo ":"; + echo ""; + slist("st_min",0,59,$start['min']); + echo ":"; + echo ""; + slist("st_sec",0,59,$start['sec']); + echo "  "; + echo ""; + slist("st_day",1,31,$start['day']); + echo "/"; + echo ""; + slist("st_mon",1,12,$start['mon']); + echo "/"; + echo ""; + echo ""; + + echo " "; + + echo "
    Finish:"; + slist("fi_hour",0,23,$finish['hour']); + echo ":"; + echo ""; + slist("fi_min",0,59,$finish['min']); + echo ":"; + echo ""; + slist("fi_sec",0,59,$finish['sec']); + echo "  "; + echo ""; + slist("fi_day",1,31,$finish['day']); + echo "/"; + echo ""; + slist("fi_mon",1,12,$finish['mon']); + echo "/"; + echo ""; + echo ""; + + echo " "; + + echo "
    "; + + + echo "
    "; + echo "Pre-defined "; + echo ""; + $now=time(); + /* + // td_day mon yr + + // mktime h mi s mo d y + + // last 30 days + $fx=mktime(0,0,0,$td_mon,$td_day,$td_yr); + $sx=$fx-(60*60*24*30); + echo ""; + echo "Last 30 Days"; + echo " "; + + // last 28 days + $fx=mktime(0,0,0,$td_mon,$td_day,$td_yr); + $sx=$fx-(60*60*24*28); + echo ""; + echo "Last 28 Days"; + echo " "; + + // last calendar month + $prev_mon=$td_mon-1; + $prev_yr=$td_yr; + if ($prev_mon<1) + { + $prev_mon=12; + $prev_yr--; + } + $fx=mktime(0,0,0,$td_mon,1,$td_yr); + $sx=mktime(0,0,0,$prev_mon,1,$prev_yr); + echo ""; + echo "Previous Month"; + echo " "; + + + // this month + $sx=mktime(0,0,0,$td_mon,1,$td_yr); + $sx=$now; + echo ""; + echo "This Month"; + echo " "; + */ + + echo " Last 30 Days
    "; + echo " Last 28 Days
    "; + echo " Last Calendar Month
    "; + echo " This Month
    "; + + echo "
    "; + echo "

    "; + + echo "Reported Tests
    "; + + $q="SELECT localtestid,nodeid,testname,testtype,testparam,testrecord FROM fnlocaltest WHERE testrecord>0 OR testtype=\"ICMP\" ORDER BY nodeid"; + $r=$NATS->DB->Query($q); + $lastnode=""; + while ($row=$NATS->DB->Fetch_Array($r)) + { + if ($row['nodeid']!=$lastnode) + { + echo "
    ".$row['nodeid']."
    "; + $lastnode=$row['nodeid']; + + // Bodge in node-side tests here + $nq="SELECT nstestid,testname,testtype,testdesc FROM fnnstest WHERE testrecord>0 AND nodeid=\"".ss($row['nodeid'])."\""; + $nr=$NATS->DB->Query($nq); + while ($nrow=$NATS->DB->Fetch_Array($nr)) + { + if (in_array("N".$nrow['nstestid'],$testlist)) $s=" checked"; + else $s=""; + echo " "; + if ($nrow['testname']!="") echo $nrow['testname']; + else if ($nrow['testdesc']!="") echo $nrow['testdesc']; + else echo $nrow['testtype']; + echo " on ".$row['nodeid']."
    "; + } + $NATS->DB->Free($nr); + + + } + if (in_array("L".$row['localtestid'],$testlist)) $s=" checked"; + else $s=""; + echo " "; + if ($row['testname']!="") echo $row['testname']; + else + { + echo lText($row['testtype']); + if ($row['testparam']!="") echo " (".$row['testparam'].")"; + } + echo " on ".$row['nodeid']; + echo "
    "; + } + $NATS->DB->Free($r); + + echo "

    "; + echo ""; + echo "
    "; + echo " Show breakdown details
    "; + echo ""; + Screen_Footer(); + exit(); + + + } + +if ($mode!="report") + { + Screen_Header("Error"); + echo "Sorry - illegal mode specified

    "; + Screen_Footer(); + exit(); + } + + + + + +// the actual run + +Screen_Header("Availability Report"); +ob_end_flush(); + +if (isset($_REQUEST['period'])) $period=$_REQUEST['period']; +else $period=""; +$now=time(); +$nowx=$now; +switch ($period) + { + // td_day mon yr + + // mktime h mi s mo d y + + case "last30days": + // last 30 days + $finishx=mktime(0,0,0,$td_mon,$td_day,$td_yr); + $startx=$finishx-(60*60*24*30); + break; + + case "last28days": + $fx=mktime(0,0,0,$td_mon,$td_day,$td_yr); + $sx=$finishx-(60*60*24*28); + break; + + case "lastcalmonth": + // last calendar month + $prev_mon=$td_mon-1; + $prev_yr=$td_yr; + if ($prev_mon<1) + { + $prev_mon=12; + $prev_yr--; + } + $finishx=mktime(0,0,0,$td_mon,1,$td_yr); + $startx=mktime(0,0,0,$prev_mon,1,$prev_yr); + break; + + case "thiscalmonth": case "thismonth": + // this month + $startx=mktime(0,0,0,$td_mon,1,$td_yr); + $finishx=$now; + break; + } + +echo "Reporting from ".nicedt($startx)." to ".nicedt($finishx)."

    "; + +foreach($_REQUEST['testlist'] as $testid) +{ + +$tmode=""; +switch($testid[0]) + { + case "L": $tmode="local"; + break; + case "N": $tmode="nodeside"; + break; + default: $tmode="unknown"; + } +$stid=substr($testid,1,128); + +// get test info +$tnode=""; +$tname=""; +$ttype=""; +$tparam=""; +$tlastrunx=""; +$trecord=1; + +$q=""; +if ($tmode=="local") $q="SELECT * FROM fnlocaltest WHERE localtestid=".ss($stid); +else if ($tmode=="nodeside") $q="SELECT * FROM fnnstest WHERE nstestid=".ss($stid); + +$r=$NATS->DB->Query($q); + +if (!$row=$NATS->DB->Fetch_Array($r)) + { + header("main.php?message=Error+opening+test+history"); + exit(); + } + + + +$tnode=$row['nodeid']; +$ttype=$row['testtype']; +if (isset($row['testparam'])) $tparam=$row['testparam']; +else $tparam=""; +$tlastrunx=$row['lastrunx']; +$tunit=""; + +if ($tmode=="local") + { + $tname=lText($ttype); + $tunit=lUnit($ttype); + if ($tparam!="") $tname.=" (".$tparam.")"; + if ($row['testname']!="") + { + $subtname=$tname; + $tname=$row['testname']; + $usesubname=true; + } + else $usesubname=false; + } +else if ($tmode=="nodeside") + { + if ($row['testname']!="") $tname=$row['testname']; + else $tname=$row['testtype']; + $subtname=$row['testdesc']; + $usesubname=true; + } +$NATS->DB->Free($r); + + + + +$diffx=$finishx-$startx; +$periods=8; +$periodx=$diffx/$periods; +$hperiodx=round($periodx/2,0); +$periodx=round($periodx,0); +$iwid=700; +$ihei=150; +$istart=50; +$iend=$iwid-5; +$idwid=$iend-$istart; +$iscale=$idwid/$periods; + + + + +echo "".$tname.""; +if ($usesubname) echo " - ".$subtname.""; +echo " on ".$tnode.""; +echo "
    "; + +//echo "node "; +//echo "".$tnode.""; +//echo " - "; +echo ""; +echo "Last Run : "; + +if ($tlastrunx>0) + { + echo nicedt($tlastrunx)." - "; + echo dtago($tlastrunx); + } +else echo "Never"; +echo "
    "; + + +//echo "".$tname." from ".nicedt($startx)." to ".nicedt($finishx); +//if ($tunit!="") echo " (".$tunit.")"; +// echo " (".nicediff($finishx-$startx).")"; +//echo "

    "; + + + +// table data + + +$q="SELECT alertlevel,testvalue,recordx FROM fnrecord WHERE "; +$q.="testid=\"".ss($testid)."\" AND recordx>=".ss($startx)." AND recordx<=".ss($finishx); +//if (!isset($_REQUEST['disp_pass'])) $q.=" AND alertlevel!=0"; +$q.=" ORDER BY recordx ASC"; + +$firstx=0; +$lastx=0; +$records=0; + +//echo $q; +$r=$NATS->DB->Query($q); + +$testc=0; +$tested=0; +$untested=0; +$passc=0; +$warnc=0; +$failc=0; +$levelt=0; + +while ($row=$NATS->DB->Fetch_Array($r)) + { + $testc++; + $records++; + if ($firstx==0) $firstx=$row['recordx']; + $lastx=$row['recordx']; + switch ($row['alertlevel']) + { + case 0: + $passc++; + $tested++; + $levelt+=$row['testvalue']; + break; + case 1: + $warnc++; + $tested++; + //$levelt+=$row['testvalue']; + break; + case 2: + $failc++; + $tested++; + //$levelt+=$row['testvalue']; + break; + case -1: + $untested++; + break; + } + } + + +echo ""; + +if (isset($_REQUEST['showdetail'])) + { + echo ""; + + $notpass=$tested-$passc; + + echo ""; + + echo ""; + + echo ""; + + echo ""; + + echo ""; + + echo ""; + + echo ""; + + echo ""; + echo ""; + + echo ""; + + $utt=$untested+$tested; + echo ""; + echo ""; + + $npt=$untested+$notpass; + echo ""; + echo ""; + + echo ""; + echo ""; + + echo ""; + + echo ""; + + $nowx=time(); + if ($finishx>$nowx) $fx=$nowx; + else $fx=$finishx; + $p=$fx-$startx; + $five_min=60*5; + $shouldhave=floor($p/$five_min); + + } + +echo ""; +echo ""; + +echo ""; + +echo ""; +echo ""; + +echo "
    ".$passc." passed out of ".$tested." valid tests"; + echo " "; + echo np($tested,$passc); + echo "
    ".$notpass." did not pass out of ".$tested." valid tests"; + echo " "; + echo np($tested,$notpass); + echo "
     
    ".$warnc." generated warnings out of ".$tested." valid tests"; + echo " "; + echo np($tested,$warnc); + echo "
    ".$failc." generated failures out of ".$tested." valid tests"; + echo " "; + echo np($tested,$failc); + echo "
    ".$warnc." generated warnings out of ".$notpass." unpassed tests"; + echo " "; + echo np($notpass,$warnc); + echo "
    ".$failc." generated failures out of ".$notpass." unpassed tests"; + echo " "; + echo np($notpass,$failc); + echo "
     
    the average test value returned by passed tests was "; + if ($passc<=0) echo "n/a"; + else if ($levelt==0) echo "0"; + else echo round($levelt/$passc,4); + if ($tunit!="") echo " ".$tunit; + echo "
     
    ".$untested." tests were untested (of ".$utt.") "; + echo np($utt,$untested); + echo "
    of these (".$utt.") ".$npt." did not pass "; + echo np($utt,$npt); + echo "
    of these (".$utt.") ".$passc." did pass "; + echo np($utt,$passc); + echo "
     
    ".$testc." records of which ".$tested." returned a valid alert level"; + echo " "; + echo np($testc,$tested); + echo "
     
    First Test Record"; +echo " "; +echo nicedt($firstx); +echo "
    Last Test Record"; +echo " "; +echo nicedt($lastx); +echo "
     
    Service Availability"; +echo " "; +// Service level is tested-failed +echo np($tested,$tested-$failc); +echo "

    "; + +/* - zoom period debugging +echo "Period: $p s (".($p/$five_min).")
    "; +echo "sx: ".$startx." fx: ".$finishx."
    "; +echo "diffx: ".($finishx-$startx)."
    "; +echo "fx2: ".$fx." p: ".$p."
    "; +*/ + + +echo "


    "; +} + +$savestring=""; +$first=true; +foreach($_REQUEST['testlist'] as $testid) + { + if ($first) $first=false; + else $savestring.=":"; + $savestring.=$testid; + } +echo "
    "; +echo ""; +echo ""; +echo "Save Report As "; +echo "


    "; + +Screen_Footer(); +?> diff --git a/src/server/web/rss.php b/src/server/web/rss.php new file mode 100755 index 0000000..9433f9e --- /dev/null +++ b/src/server/web/rss.php @@ -0,0 +1,39 @@ +Start(); + +$id = $NATS->RSS->GetIdFromCompound($_REQUEST['feed']); + +if ($id===false) +{ + echo "Error: Invalid Feed Specified"; + exit(); +} + +ob_clean(); +header("Content-type: text/xml"); +echo $NATS->RSS->Render($id); +ob_end_flush(); +?> \ No newline at end of file diff --git a/src/server/web/schedule.php b/src/server/web/schedule.php new file mode 100755 index 0000000..bbdc5eb --- /dev/null +++ b/src/server/web/schedule.php @@ -0,0 +1,314 @@ +Start(); +if (!$NATS_Session->Check($NATS->DB)) + { + header("Location: ./?login_msg=Invalid+Or+Expired+Session"); + exit(); + } +if ($NATS_Session->userlevel<9) UL_Error("Admin Interface"); + +// Actions Here +if (isset($_REQUEST['action'])) + { + switch($_REQUEST['action']) + { // create delete save_edit + // create_item delete_item save_item + case "create": + $q="INSERT INTO fnschedule(schedulename) VALUES(\"".ss($_REQUEST['schedulename'])."\")"; + $NATS->DB->Query($q); + $_REQUEST['scheduleid']=$NATS->DB->Insert_Id(); + break; + + case "delete": + if (!isset($_REQUEST['confirmed'])) + { + $back="schedule.php?delscheduleid=".$_REQUEST['delscheduleid']."&action=delete&confirmed=1"; + $msg="Delete Schedule and All Associated Items"; + $u="confirm.php?action=".urlencode($msg)."&back=".urlencode($back); + header("Location: ".$u); + exit(); + } + $q="DELETE FROM fnscheditem WHERE scheduleid=".ss($_REQUEST['delscheduleid']); + $NATS->DB->Query($q); + $q="UPDATE fnnode SET scheduleid=0 WHERE scheduleid=".ss($_REQUEST['delscheduleid']); + $NATS->DB->Query($q); + $q="DELETE FROM fnschedule WHERE scheduleid=".ss($_REQUEST['delscheduleid']); + $NATS->DB->Query($q); + break; + + case "save_edit": + $q="UPDATE fnschedule SET schedulename=\"".ss($_REQUEST['schedulename'])."\",defaultaction=".ss($_REQUEST['defaultaction'])." "; + $q.="WHERE scheduleid=".ss($_REQUEST['scheduleid']); + $NATS->DB->Query($q); + break; + + case "create_item": + if ($_REQUEST['year']=="") $year=0; + else $year=ss($_REQUEST['year']); + $q="INSERT INTO fnscheditem(scheduleid,dayofweek,dayofmonth,monthofyear,year,starthour,startmin,finishhour,finishmin) VALUES("; + $q.=ss($_REQUEST['scheduleid']).",\"".ss($_REQUEST['dayofweek'])."\",".ss($_REQUEST['dayofmonth']).",".ss($_REQUEST['monthofyear']).",".$year.","; + $q.=ss($_REQUEST['starthour']).",".ss($_REQUEST['startmin']).",".ss($_REQUEST['finishhour']).",".ss($_REQUEST['finishmin']).")"; + $NATS->DB->Query($q); + break; + //echo $q; + + case "save_item": + if ($_REQUEST['year']=="") $year=0; + else $year=ss($_REQUEST['year']); + $q="UPDATE fnscheditem SET "; + //(scheduleid,dayofweek,dayofmonth,monthofyear,year,starthour,startmin,finishhour,finishmin) VALUES("; + $q.="dayofweek=\"".ss($_REQUEST['dayofweek'])."\","; + $q.="dayofmonth=".ss($_REQUEST['dayofmonth']).",monthofyear=".ss($_REQUEST['monthofyear']).",year=".$year.","; + $q.="starthour=".ss($_REQUEST['starthour']).",startmin=".ss($_REQUEST['startmin']).","; + $q.="finishhour=".ss($_REQUEST['finishhour']).",finishmin=".ss($_REQUEST['finishmin'])." WHERE scheditemid=".ss($_REQUEST['scheditemid']); + $NATS->DB->Query($q); + break; + + case "delete_item"; + $q="DELETE FROM fnscheditem WHERE scheditemid=".ss($_REQUEST['scheditemid']); + $NATS->DB->Query($q); + break; + } + + } + + +Screen_Header("Schedule Management",1,1,"","main","admin"); + +echo "
    System Settings > Schedule Manager

    "; +$q="SELECT scheduleid,schedulename FROM fnschedule"; +$r=$NATS->DB->Query($q); +if ($NATS->DB->Num_Rows($r)<=0) echo "No Schedules
    "; +else + { + echo ""; + while ($row=$NATS->DB->Fetch_Array($r)) + { + echo ""; + echo ""; + } + echo "
    ".$row['schedulename']."  Edit | "; + echo "Delete
    "; + } +$NATS->DB->Free($r); +echo "
    "; +echo "
    Create: "; +echo "

    "; + +$days_of_week=array( '', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun' ); + +function tt($a) // "to ten" +{ +if ($a<10) return "0".$a; +else return $a; +} + +// view a specific schedule +if (isset($_REQUEST['scheduleid'])) + { + $q="SELECT * FROM fnschedule WHERE scheduleid=".ss($_REQUEST['scheduleid'])." LIMIT 0,1"; + $r=$NATS->DB->Query($q); + if ($row=$NATS->DB->Fetch_Array($r)) + { + echo "Editing Schedule: ".$row['schedulename']."

    "; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + $o_on=""; + $o_off=""; + echo ""; + echo ""; + echo ""; + echo "
    Schedule Name :"; + echo "
    Default Action : ".hlink("Schedule:DefaultAction")."
     

    "; + + echo "Exceptions

    "; + echo "Exceptions are the times when your schedule will not perform its default action i.e. not test the node or send the alert.
    "; + echo "See the documentation for more information.

    "; + + echo ""; + echo ""; + echo ""; + + $q="SELECT * FROM fnscheditem WHERE scheduleid=".ss($_REQUEST['scheduleid']); + $r=$NATS->DB->Query($q); + while ($row=$NATS->DB->Fetch_Array($r)) + { + echo ""; + + echo ""; + echo ""; + echo ""; + echo ""; + + echo ""; + echo ""; + echo ""; + if ($row['year']==0) $year=""; + else $year=$row['year']; + echo ""; + + echo ""; + + echo ""; + echo ""; + echo ""; + echo ""; + } + + echo ""; + + echo ""; + echo ""; + echo ""; + + echo ""; + echo ""; + echo ""; + echo ""; + + echo ""; + + echo ""; + echo ""; + echo ""; + echo "
    WeekdayDayMonthYear  From (HH:MM) =>To HH:MM 
     
    "; + echo ":: "; + echo ""; + echo "Delete"; + echo "
     
    "; + echo "::
    "; + + echo "

    "; + echo "Test a Date and Time

    "; + echo "
    "; + echo ""; + echo ""; + echo "Test: "; + + // persist tested date/time + if (isset($_REQUEST['test_schedule'])) + { + $day=$_REQUEST['testday']; + $month=$_REQUEST['testmonth']; + $year=$_REQUEST['testyear']; + $hour=$_REQUEST['testhour']; + $min=$_REQUEST['testmin']; + } + else + { + $day=date("d"); + $month=date("m"); + $year=date("Y"); + $hour=date("H"); + $min=date("i"); + } + + echo ""; + echo ""; + echo "  "; + echo ":"; + echo " "; + echo "

    "; + + // mktime(hr mi se mo do yr + if (isset($_REQUEST['test_schedule'])) + { + $tx=mktime($_REQUEST['testhour'],$_REQUEST['testmin'],0,$_REQUEST['testmonth'],$_REQUEST['testday'],$_REQUEST['testyear']); + echo "Testing ".date("Y-m-d H:i",$tx)."... "; + $wouldrun=run_x_in_schedule($tx,$_REQUEST['scheduleid']); + echo ""; + if ($wouldrun) echo "Yes - TESTS WOULD RUN"; + else echo "No - TESTS WOULD NOT RUN"; + echo "
    "; + } + + } + else echo "Error fetching schedule information"; + } + +Screen_Footer(); +?> diff --git a/src/server/web/summary.test.php b/src/server/web/summary.test.php new file mode 100755 index 0000000..1251650 --- /dev/null +++ b/src/server/web/summary.test.php @@ -0,0 +1,185 @@ +Start(); +if (!$NATS_Session->Check($NATS->DB)) + { + header("Location: ./?login_msg=Invalid+Or+Expired+Session"); + exit(); + } +if ($NATS_Session->userlevel<1) UL_Error("View Test Summary"); + +if (isset($_REQUEST['nodeid'])) $nodeid=$_REQUEST['nodeid']; +else $nodeid=""; + + +Screen_Header("Summary for ".$nodeid,1); +ob_end_flush(); + +$td_day=date("d"); +$td_mon=date("m"); +$td_yr=date("Y"); + +function gtinfo($testid) +{ +global $NATS; +$o="Error fetching test"; + +$test=$NATS->GetTest($testid); +if ($test['class']=="L") + { + $o=lText($test['testtype']); + if ($test['testparam']!="") $o.=" (".$test['testparam'].")"; + + if ($test['testname']!="") $o=$test['testname']; + + $u=lUnit($test['testtype']); + if ($u!="") $o.=" (".$u.")"; + } +else if ($test['name']!="") $o=$test['name']; +else $o=$test['testtype']; +/* +if ($testid[0]=="L") + { // local test + $q="SELECT testtype,testparam,testname FROM fnlocaltest WHERE localtestid=".ss(substr($testid,1,128)); + $r=$NATS->DB->Query($q); + if ($row=$NATS->DB->Fetch_Array($r)) + { + $o=lText($row['testtype']); + if ($row['testparam']!="") $o.=" (".$row['testparam'].")"; + + if ($row['testname']!="") $o=$row['testname']; + + $u=lUnit($row['testtype']); + if ($u!="") $o.=" (".$u.")"; + } + else $o="Error fetching test"; + } +*/ +return $o; +} + +function outTime($timex,$name,$start=true,$checked=false) +{ +echo " ".$name."
    "; +} + +if (isset($_REQUEST['mode'])&&($_REQUEST['mode']=="custom")) + { + echo "
    Custom Summary

    "; + echo ""; + echo ""; + echo ""; // note the space - invalid normal nodeid + echo ""; + echo "
    "; + echo "Nodes

    "; + $q="SELECT nodeid,nodename FROM fnnode ORDER BY weight ASC"; + $r=$NATS->DB->Query($q); + while ($row=$NATS->DB->Fetch_Array($r)) + { + echo " "; + if ($row['nodename']=="") echo $row['nodeid']; + else echo $row['nodename']; + echo "
    "; + } + $NATS->DB->Free($r); + echo "
    "; + echo "Start Time

    "; + outTime(mktime(0,0,0,$td_mon,$td_day,$td_yr),"0:00 Today",true,true); + outTime(time()-(60*60*24),"24 Hours Ago"); + outTime(time()-(60*60),"1 Hour Ago"); + + echo "
    Finish Time

    "; + outTime(mktime(23,59,59,$td_mon,$td_day,$td_yr),"23:59:59 Today",false,true); + outTime(time(),"Now",false); + + echo "
    "; + echo "
    "; + } + +if (isset($_REQUEST['startx'])) $startx=$_REQUEST['startx']; +else $startx=mktime(0,0,0,$td_mon,$td_day,$td_yr); +if (isset($_REQUEST['finishx'])) $finishx=$_REQUEST['finishx']; +else $finishx=mktime(23,59,59,$td_mon,$td_day,$td_yr); + +echo "
    From ".nicedt($startx)." to ".nicedt($finishx)."

    "; + +if ($nodeid=="*") + { + // + $q="SELECT testid,nodeid FROM fnrecord WHERE recordx>=".ss($startx)." AND recordx<=".ss($finishx); + $q.=" GROUP BY testid ORDER BY nodeid"; + } +else if ($nodeid==" custom") // use nodelist + { + $q="SELECT testid,nodeid FROM fnrecord WHERE recordx>=".ss($startx)." AND recordx<=".ss($finishx)." "; + $q.="AND nodeid IN ( "; + $first=true; + foreach($_REQUEST['nodelist'] as $node) + { + if ($first) $first=false; + else $q.=","; + $q.="\"".ss($node)."\""; + } + $q.=" ) GROUP BY testid ORDER BY nodeid"; + //echo $q; + //exit(); + } +else + { + $q="SELECT testid,nodeid FROM fnrecord WHERE nodeid=\"".ss($nodeid)."\" AND recordx>=".ss($startx)." AND recordx<=".ss($finishx); + $q.=" GROUP BY testid"; + } +$r=$NATS->DB->Query($q); + + +$name=""; +$first=true; + +while ($row=$NATS->DB->Fetch_Array($r)) + { + if ($name!=$row['nodeid']) + { + if ($first) $first=false; + else echo "

    "; + echo "Node: ".$row['nodeid']."

    "; + $name=$row['nodeid']; + } + echo "".gtinfo($row['testid'])." on ".$row['nodeid']."
    "; + //echo "img src=\"test.graph.php?testid=".$row['testid']."&startx=".$startx."&finishx=".$finishx."\"
    "; + echo ""; + echo ""; + echo ""; + echo "

     
    "; + } + +$NATS->DB->Free($r); + +Screen_Footer(); +?> diff --git a/src/server/web/test.graph.php b/src/server/web/test.graph.php new file mode 100755 index 0000000..1991c7e --- /dev/null +++ b/src/server/web/test.graph.php @@ -0,0 +1,467 @@ +Start(); + + + + +function ty($y) +{ +global $height; +return $height-$y; +} + +//if (!isset($_REQUEST['testid'])) $_REQUEST['testid']="L26"; + +// width height suid startx finishx + +if (isset($_REQUEST['width'])) $width=$_REQUEST['width']; +else $width=700; +if (isset($_REQUEST['height'])) $height=$_REQUEST['height']; +else $height=150; + +// other incoming stuff +if (isset($_REQUEST['draw_spike'])) $draw_spike=$_REQUEST['draw_spike']; +else $draw_spike=1; +if (isset($_REQUEST['draw_track'])) $draw_track=$_REQUEST['draw_track']; +else $draw_track=1; +if (isset($_REQUEST['draw_under'])) $draw_under=$_REQUEST['draw_under']; +else $draw_under=1; +if (isset($_REQUEST['draw_under_pass'])) $draw_under=$_REQUEST['draw_under_pass']; +else $draw_under_pass=0; + +// Transparent logic (1.14.1/2) +// options in order of presidence (URI, Config, Default): +// transparent=1 in URI: transparent, transparent=0 in URI: non-transparent, +// site.graph.transparent=1: transparent, default: non-transparent +if (isset($_REQUEST['transparent']) && $_REQUEST['transparent']==1) + $transparent=1; +else if (isset($_REQUEST['transparent']) && $_REQUEST['transparent']==0) + $transparent=0; +else if ($NATS->Cfg->Get("site.graph.transparent",0)==1) + $transparent=1; +else + $transparent=0; + +$draw_x_grid=true; +$draw_y_grid=true; + +if (isset($_REQUEST['no_x_grid'])) $draw_x_grid=false; +if (isset($_REQUEST['no_y_grid'])) $graw_y_grid=false; +if (isset($_REQUEST['no_grid'])) + { + $draw_x_grid=false; + $draw_y_grid=false; + } + +// start image +$im=@imagecreate($width,$height) + or die("Cannot create image"); + +// setup colours +$col=array(); +$col['white']=imagecolorallocate($im,255,255,255); +$col['black']=imagecolorallocate($im,0,0,0); +$col['red']=imagecolorallocate($im,250,50,50); +$col['lightgrey']=imagecolorallocate($im,200,200,200); +$col['verylightgrey']=imagecolorallocate($im,240,240,240); +$col['blue']=imagecolorallocate($im,150,150,255); +$col['green']=imagecolorallocate($im,0,200,0); +$col['lightgreen']=imagecolorallocate($im,150,250,150); +$col['grey']=imagecolorallocate($im,150,150,150); +$col['orange']=imagecolorallocate($im,200,200,0); + +if (isset($_REQUEST['bgcol'])) $c_bg=$col[$_REQUEST['bgcol']]; +else $c_bg=$col['white']; + +if (isset($_REQUEST['txtcol'])) $c_txt=$col[$_REQUEST['txtcol']]; +else $c_txt=$col['black']; + +if (isset($_REQUEST['axescol'])) $c_axes=$col[$_REQUEST['axescol']]; +else $c_axes=$col['lightgrey']; + +if (isset($_REQUEST['trackcol'])) $c_track=$col[$_REQUEST['trackcol']]; +else $c_track=$col['blue']; + +if (isset($_REQUEST['gridcol'])) $c_grid=$col[$_REQUEST['gridcol']]; +else $c_grid=$col['verylightgrey']; + +// transparent check 1.14.1 +if ($transparent == 1) + imagecolortransparent($im, $c_bg); + +// fill background +imagefill($im,1,1,$c_bg); + +function ierror($t) +{ +global $im,$width,$height,$col; +ob_clean(); +header("Content-type: image/png"); +imagestring($im,2,($width/2)-20,$height/2,"ERROR: ".$t,$col['red']); +imagepng($im); +imagedestroy($im); +exit(); +} + +//ierror("Test"); + +$session=$NATS_Session->Check($NATS->DB); + +if (!$session) + { + if ($NATS->Cfg->Get("site.graph.public",0)!=1) + { + ierror("Authorisation Failure"); + exit(); + } + $key=$NATS->Cfg->Get("site.graph.key",""); + if (isset($_REQUEST['graphkey'])) $userkey=$_REQUEST['graphkey']; + else $userkey=""; + + if ( ($key!="") && ($key!=$userkey) ) + { + ierror("Graph Key Failure"); + exit(); + } + } + + +if (!isset($_REQUEST['nodeid'])) $nodeid=""; +else $nodeid=$_REQUEST['nodeid']; + +if (!isset($_REQUEST['testid'])) ierror("No test ID"); + +$day=date("d"); +$month=date("m"); +$year=date("Y"); + +if (isset($_REQUEST['startx'])) $startx=$_REQUEST['startx']; +else + { // 0:00 today HMS mo da yr + $startx=mktime(0,0,0,$month,$day,$year); + //$startx=1203451396; + } + +if (isset($_REQUEST['finishx'])) $finishx=$_REQUEST['finishx']; +else $finishx=mktime(23,59,59,$month,$day,$year); + +if ($startx<=0) $startx=time()+$startx; +if ($finishx<=0) $finishx=time()+$finishx; + +//$finishx=1203454996; +$periodx=$finishx-$startx; +$startt=date("H:i:s d/m/y",$startx); +$finisht=date("H:i:s d/m/y",$finishx); + + +// titles and stuff +imagestring($im,2,2,2,$startt,$c_txt); +// -90 for size 1 +imagestring($im,2,$width-108,2,$finisht,$c_txt); + +if (isset($_REQUEST['title'])) $title=$_REQUEST['title']; +else $title=$nodeid; +$len=strlen($title)*4; +imagestring($im,4,($width/2)-$len,2,$title,$c_txt); + +// offsets and lengths +$xoff=50+1; +$xlen=$width-$xoff-5; + +$yoff=1; +$ylen=$height-$yoff-20; + + +// v-axes +imageline($im,50,ty(1),50,ty($height-20),$c_axes); +imageline($im,$width-5,ty(1),$width-5,ty($height-20),$c_axes); +// y-axes +imageline($im,50,ty(1),$width-5,ty(1),$c_axes); +imageline($im,$width-5,ty($height-20),50,ty($height-20),$c_axes); +//ierror("hello"); + + +// range data + +// Lowest + +if (isset($_REQUEST['rangemin'])) $dlow=$_REQUEST['rangemin']; +else + { + $dlow=0; + /* + $q="SELECT testvalue FROM fnrecord WHERE testid=\"".ss($_REQUEST['testid'])."\""; + $q.=" AND recordx>=".ss($startx)." AND recordx<=".ss($finishx)." "; + $q.="ORDER BY testvalue ASC LIMIT 0,1"; // lowest + $r=$NATS->DB->Query($q); + //ierror($q); + if (!$row=$NATS->DB->Fetch_Array($r)) ierror("No data for test"); + $lowest=$row['testvalue']; + $dlow=$lowest; + if ($dlow>0) $dlow=0; + $NATS->DB->Free($r); + */ + } + + +// Highest + +if (isset($_REQUEST['rangemax'])) $dhigh=$_REQUEST['rangemax']; +else +{ + $q="SELECT testvalue FROM fnrecord WHERE testid=\"".ss($_REQUEST['testid'])."\""; + $q.=" AND recordx>=".ss($startx)." AND recordx<=".ss($finishx)." "; + $q.= "ORDER BY testvalue DESC LIMIT 0,1"; //highest + + $r=$NATS->DB->Query($q); + $row=$NATS->DB->Fetch_Array($r); + $highest=$row['testvalue']; + $dhigh=$highest; + $NATS->DB->Free($r); + if (isset($_REQUEST['rangemaxmin'])) + { + if ($dhigh<$_REQUEST['rangemaxmin']) $dhigh=$_REQUEST['rangemaxmin']; + } +} + +$drange=$dhigh-$dlow; + +// calculate scales +$xscale=$xlen/$periodx; +if ($drange>0) $yscale=$ylen/$drange; +else $yscale=1; // doesn't display but no change! + +// Grid Lines + +// Grid X - the X values + +/* Oh if only I was actually any good at programming. There MUST be soooo many better ways to do these ranges +with all sorts of calculations to round to the nearest power of ten etc etc. Unfortunately I have the programming +skill of a walrus and typing code with tusks is difficult! */ + +/* TODO: Make this all like really elegant and stuff */ + +if ($draw_x_grid) + { + $xg_step=1; + $xg_scale=1; + if ($drange<0.001) $xg_scale=0.0001; + else if ($drange<0.01) $xg_scale=0.001; + else if ($drange<0.1) $xg_scale=0.01; + else if ($drange<1) $xg_scale=0.1; + else if ($drange<6) $xg_scale=1; + else if ($drange<11) $xg_scale=2; + else if ($drange<16) $xg_scale=4; + else if ($drange<21) $xg_scale=5; + else if ($drange<51) $xg_scale=10; + else if ($drange<101) $xg_scale=20; + else if ($drange<201) $xg_scale=50; + else if ($drange<501) $xg_scale=100; + else if ($drange<1001) $xg_scale=250; + else if ($drange<10001) $xg_scale=1000; + else if ($drange<100001) $xg_scale=10000; + else if ($drange<1000001) $xg_scale=100000; + else $draw_x_grid=false; + + if ($xg_scale<0) $xg_step=($xg_scale); + } + +if ($draw_x_grid) + { + //imagestring($im,1,2,ty(50),"Drawing X Grid ".$xg_scale,$c_txt); + for ($a=$dlow; $a<=$dhigh; $a+=$xg_scale) + { + if (($a!=0)&&( ($a % $xg_scale) == 0)) + { + //imagestring($im,1,2,ty(50+($a*5)),"Drawing X Grid ".$a,$c_txt); + // draw a line + imageline($im,posx($startx),ty(posy($a)),posx($finishx),ty(posy($a)),$c_grid); +// imageline($im,$lastx,ty($lasty),$x,ty($y),$c_track); + } + } + } + +// Grid Y - the time values + +if ($draw_y_grid) + { + $min=60; + $hour=$min*60; + $day=$hour*24; + + $syr=date("Y",$startx); + $smo=date("m",$startx); + $sda=date("d",$startx); + $shr=date("H",$startx); + // h m s mo da yr + $lhr=mktime($shr,0,0,$smo,$sda,$syr); + $lda=mktime(0,0,0,$smo,$sda,$syr); + + if ($periodx< (($hour*2)+1) ) + { + $yg_scale=$min; + $yg_start=$lhr; + } + else if ($periodx< (($day*2)+1) ) + { + $yg_scale=$hour; + $yg_start=$lhr; + } + else if ($periodx < ($day*32) ) + { + $yg_scale=$day; + $yg_start=$lda; + } + else $draw_y_grid=false; + } + +if ($draw_y_grid) + { + //imagestring($im,1,2,ty(50),"Drawing Y Grid ",$c_txt); + for ($a=$yg_start; $a<$finishx; $a+=$yg_scale) + { + if ($a>$startx) + { + // draw line + imageline($im,posx($a),ty(posy($dlow)),posx($a),ty(posy($dhigh)),$c_grid); + } + } + } +function posx($time) // timex +{ +global $xscale,$startx,$xoff; +$drawx=$xscale*($time-$startx); +$screenx=$drawx+$xoff; +$screenx=floor($screenx); +return $screenx; +} + +function posy($value) +{ +global $yscale,$dlow,$yoff,$dhigh; +if ($value>$dhigh) $value=$dhigh; +$drawy=$yscale*($value-$dlow); +$screeny=$drawy+$yoff; +$screeny=floor($screeny); +return $screeny; +} + + + +// show axes scales +imagestring($im,1,2,ty(10),$dlow,$c_txt); +imagestring($im,1,2,ty($height-18),$dhigh,$c_txt); + + +if (isset($_REQUEST['units'])) + { + if (strpos($_REQUEST['units'],"/")===false) + imagestring($im,1,2,ty($height-28),$_REQUEST['units'],$c_txt); + + + else + { + $unit_array=explode("/",$_REQUEST['units']); + $a=0; + foreach($unit_array as $unit_string) + { + imagestring($im,1,2,ty($height-28-($a*8)),$unit_string,$c_txt); + $a++; + } + } + } + + +// get data and draw +$q="SELECT testvalue,alertlevel,recordx FROM fnrecord WHERE testid=\"".ss($_REQUEST['testid'])."\" "; +$q.="AND recordx>=".ss($startx)." AND recordx<=".ss($finishx)." ORDER BY recordx ASC"; +//$q.="LIMIT 0,100"; +$r=$NATS->DB->Query($q); +$lastx=0; +$lasty=0; + +$startval=0; +$finishval=0; + +while ($row=mysql_fetch_array($r)) + { + $x=posx($row['recordx']); + //$y=posy($row['testvalue']); + $val=$row['testvalue']; + if ($val<0) $y=posy(0); + else $y=posy($val); + + if ($row['alertlevel']==-1) $c=$col['grey']; + else if ($row['alertlevel']==0) $c=$col['lightgreen']; + else if ($row['alertlevel']==1) $c=$col['orange']; + else if ($row['alertlevel']==2) $c=$col['red']; + else $c=$col['black']; + + // up lines + if ($draw_spike==1) imageline($im,$x,ty(0),$x,ty($y),$c); + + + + if ($lastx!=0) + { + + // join-the-dots + if ($draw_track==1) imageline($im,$lastx,ty($lasty),$x,ty($y),$c_track); + + // fill -- DOES NOT WORK + //if (($draw_fill==1)&&($draw_spike==1)&&($draw_track==1)) + //imagefill($im,$x-1,ty(1),$c); + + // bottom line + if ($draw_under==1) + { + if (($row['alertlevel']>0)|| + (($row['alertlevel']==0)&&($draw_under_pass==1)) ) + { + imageline($im,$lastx,ty(1),$x,ty(1),$c); + imageline($im,$lastx,ty(2),$x,ty(2),$c); + } + } + } + + //imageellipse($im,$x,ty($y),1,1,$c_red); + + $lastx=$x; + $lasty=$y; + + } +mysql_free_result($r); + + + +// output image +ob_clean(); +header("Content-type: image/png"); +imagepng($im); +imagedestroy($im); +exit(); // just in case + +?> diff --git a/src/server/web/testrun.php b/src/server/web/testrun.php new file mode 100755 index 0000000..4d05704 --- /dev/null +++ b/src/server/web/testrun.php @@ -0,0 +1,101 @@ +Start(); +if (!$NATS_Session->Check($NATS->DB)) + { + header("Location: ./?login_msg=Invalid+Or+Expired+Session"); + exit(); + } +if ($NATS_Session->userlevel<9) UL_Error($NATS->Lang->Item("test.run")); + + + +ob_end_flush(); +Screen_Header($NATS->Lang->Item("test.run").": test/".$_REQUEST['trid'],1); + +if (isset($_REQUEST['message'])) echo "".$_REQUEST['message']."
    "; +if (isset($amsg)) echo "".$amsg."
    "; + +if ( (isset($_REQUEST['action'])) && ($_REQUEST['action']=="finish") ) + { + if (!isset($_REQUEST['confirmed'])) + { + echo "".$NATS->Lang->Item("testrun.manual.close")."
    "; + echo $NATS->Lang->Item("testrun.manual.close.detail"); + echo "

    "; + echo "".$NATS->Lang->Item("confirm.action").": "; + echo "".$NATS->Lang->Item("testrun.del.yes")." | ".$NATS->Lang->Item("testrun.del.cancel").""; + echo "

    "; + } + else + { + $q="UPDATE fntestrun SET finishx=".time()." WHERE trid=".ss($_REQUEST['trid']); + $NATS->DB->Query($q); + echo "".$NATS->Lang->Item("testrun.session.closed")."

    "; + } + } + +echo "
    ".$NATS->Lang->Item("test.run")." test/".$_REQUEST['trid']."

    "; + +$q="SELECT * FROM fntestrun WHERE trid=".ss($_REQUEST['trid'])." LIMIT 0,1"; +$r=$NATS->DB->Query($q); +if (!$row=$NATS->DB->Fetch_Array($r)) + { + echo "".$NATS->Lang->Item("testrun.fetch.error")."

    "; + Screen_Footer(); + exit(); + } +$NATS->DB->Free($r); + +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +echo ""; +echo ""; + +echo ""; +echo ""; + +echo "
    ".$NATS->Lang->Item("started")." : ".nicedt($row['startx'])." (".dtago($row['startx']).")
    ".$NATS->Lang->Item("finished")." : "; +if ($row['finishx']>0) echo nicedt($row['finishx'])." (".dtago($row['finishx']).")"; +else echo $NATS->Lang->Item("sessions.stillrunning")." (".$NATS->Lang->Item("testrun.manual.close").")"; +echo "
    ".$NATS->Lang->Item("node.filter")." :"; +if ($row['fnode']=="") echo $NATS->Lang->Item("allnodes"); +else echo "".$row['fnode'].""; +echo "
    ".$NATS->Lang->Item("event.log")." :Log Events for Tester ".$row['trid'].""; +echo "
    Output : "; +echo $row['routput']; +echo "
    "; +?> + + + diff --git a/src/server/web/view.edit.php b/src/server/web/view.edit.php new file mode 100755 index 0000000..3d61b45 --- /dev/null +++ b/src/server/web/view.edit.php @@ -0,0 +1,684 @@ +Start(); +if (!$NATS_Session->Check($NATS->DB)) + { + header("Location: ./?login_msg=Invalid+Or+Expired+Session"); + exit(); + } +if ($NATS_Session->userlevel<5) UL_Error($NATS->Lang->Item("edit.view")); + +function chs($var,$def=0) +{ +if (isset($_REQUEST[$var])) return ss($_REQUEST[$var]); +else return $def; +} + + +if (isset($_REQUEST['action'])) + { + switch ($_REQUEST['action']) + { + case "create": + $q="INSERT INTO fnview(vtitle,vclick,vstyle) VALUES(\"".ss($_REQUEST['vtitle'])."\",\"standard\",\"standard\")"; + $NATS->DB->Query($q); + $_REQUEST['viewid']=$NATS->DB->Insert_Id(); + $_REQUEST['show_options']=1; + $msg="Created View"; + break; + + case "delete": + if (!isset($_REQUEST['confirmed'])) + { + $back=urlencode("view.edit.php?action=delete&confirmed=1&viewid=".$_REQUEST['viewid']); + $link="confirm.php?action=Delete+View&back=".$back; + header("Location: ".$link); + exit(); + } + // otherwise delete + $qi="DELETE FROM fnviewitem WHERE viewid=".ss($_REQUEST['viewid']); + $NATS->DB->Query($qi); + $idel=$NATS->DB->Affected_Rows(); + $q="DELETE FROM fnview WHERE viewid=".ss($_REQUEST['viewid']); + $NATS->DB->Query($q); + $vdel=$NATS->DB->Affected_Rows(); + $msg="Deleted ".$vdel." Views (".$idel." Items)"; + header("Location: main.php?message=".urlencode($msg)); + exit(); + break; + + case "save_edit": + if (isset($_REQUEST['vpublic'])) $public=1; + else $public=0; + if (isset($_REQUEST['vcolon'])) $colon=1; + else $colon=0; + if (isset($_REQUEST['vdashes'])) $dashes=1; + else $dashes=0; + if (isset($_REQUEST['vtimeago'])) $ago=1; + else $ago=0; + if (!is_numeric($_REQUEST['vrefresh'])) $vref=0; + else $vref=ss($_REQUEST['vrefresh']); + $q="UPDATE fnview SET vtitle=\"".ss($_REQUEST['vtitle'])."\",vstyle=\"".ss($_REQUEST['vstyle'])."\","; + $q.="vclick=\"".ss($_REQUEST['vclick'])."\",vpublic=".$public.",vlinkv=".ss($_REQUEST['vlinkv']).",vrefresh=".$vref; + $q.=",vcolumns=".ss($_REQUEST['vcolumns']).",vdashes=".$dashes.",vcolon=".$colon.",vtimeago=".$ago; + $q.=" WHERE viewid=".ss($_REQUEST['viewid']); + $NATS->DB->Query($q); + if ($NATS->DB->Affected_Rows()<=0) $msg=$NATS->Lang->Item("save.ok"); + else $msg=$NATS->Lang->Item("save.failed"); + break; + + case "create_item": + $wq="SELECT iweight FROM fnviewitem WHERE viewid=".ss($_REQUEST['viewid'])." ORDER BY iweight DESC LIMIT 0,1"; + $wr=$NATS->DB->Query($wq); + if ($row=$NATS->DB->Fetch_Array($wr)) + { + $iweight=$row['iweight']+10; + } + else $iweight=10; + $NATS->DB->Free($wr); + + if (isset($_REQUEST['iname'])) $iname=ss($_REQUEST['iname']); + else $iname=""; + + $itype=ss($_REQUEST['itype']); + if ($itype=="node") $ioption=ss($_REQUEST['ioption_node']); + else if($itype=="group") $ioption=ss($_REQUEST['ioption_group']); + else if($itype=="testgraph") $ioption=ss($_REQUEST['ioption_testgraph']."/".$_REQUEST['ioption_testgraph_time']); + else if($itype=="testdetail") + { + $ioption=ss($_REQUEST['ioption_testdetail']); + $iname=ss($_REQUEST['iname_testdetail']); + } + else if($itype=="title") $ioption=ss($_REQUEST['ioption_title']); + else $ioption=""; + $q="INSERT INTO fnviewitem(viewid,itype,ioption,iweight,iname) VALUES(".ss($_REQUEST['viewid']).","; + $q.="\"".$itype."\",\"".$ioption."\",".$iweight.",\"".$iname."\")"; + $NATS->DB->Query($q); + if ($NATS->DB->Affected_Rows()>0) $msg="Created Item"; + else $msg="Create Item Failed"; + break; + + case "del_item": + $q="DELETE FROM fnviewitem WHERE viewitemid=".ss($_REQUEST['viewitemid']); + $NATS->DB->Query($q); + if ($NATS->DB->Affected_Rows()>0) $msg=$NATS->Lang->Item("delete.ok"); + else $msg=$NATS->Lang->Item("delete.fail"); + break; + + case "save_view_item": + $icol=chs("icolour",0); + $itxt=chs("itextstatus",0); + $isize=chs("isize",0); + $igraphic=chs("igraphic",0); + $idetail=chs("idetail",0); + $q="UPDATE fnviewitem SET "; + $q.="icolour=".$icol.","; + $q.="itextstatus=".$itxt.","; + $q.="isize=".$isize.","; + $q.="igraphic=".$igraphic.","; + $q.="idetail=".$idetail." "; + $q.="WHERE viewitemid=".ss($_REQUEST['viewitemid']); + $NATS->DB->Query($q); + //echo $q; + if ($NATS->DB->Affected_Rows()<=0) $msg=$NATS->Lang->Item("save.failed"); + else $msg=$NATS->Lang->Item("save.ok"); + break; + + case "move_item": + if (isset($_REQUEST['dir'])) $dir=$_REQUEST['dir']; + else $dir="up"; + + $mywq="SELECT iweight FROM fnviewitem WHERE viewitemid=".ss($_REQUEST['viewitemid']); + $mywr=$NATS->DB->Query($mywq); + $row=$NATS->DB->Fetch_Array($mywr); + $myweight=$row['iweight']; + $NATS->DB->Free($mywr); + + if ($dir=="up") // get the next lowest one down + { + $q="SELECT viewitemid,iweight FROM fnviewitem WHERE viewid=".ss($_REQUEST['viewid'])." AND iweight<".$myweight." "; + $q.="ORDER BY iweight DESC LIMIT 0,1"; + $r=$NATS->DB->Query($q); + if ($row=$NATS->DB->Fetch_Array($r)) // found one to swap with + { + $uq="UPDATE fnviewitem SET iweight=".$myweight." WHERE viewitemid=".$row['viewitemid']; + $NATS->DB->Query($uq); + $uq="UPDATE fnviewitem SET iweight=".$row['iweight']." WHERE viewitemid=".ss($_REQUEST['viewitemid']); + $NATS->DB->Query($uq); + //$msg="Moved Item"; + } + //else $msg="Nowhere to Move Item To"; + } + else if ($dir=="down") // get the next highest + { + $q="SELECT viewitemid,iweight FROM fnviewitem WHERE viewid=".ss($_REQUEST['viewid'])." AND iweight>".$myweight." "; + $q.="ORDER BY iweight DESC LIMIT 0,1"; + $r=$NATS->DB->Query($q); + if ($row=$NATS->DB->Fetch_Array($r)) // found one to swap with + { + $uq="UPDATE fnviewitem SET iweight=".$myweight." WHERE viewitemid=".$row['viewitemid']; + $NATS->DB->Query($uq); + $uq="UPDATE fnviewitem SET iweight=".$row['iweight']." WHERE viewitemid=".ss($_REQUEST['viewitemid']); + $NATS->DB->Query($uq); + //$msg="Moved Item"; + } + //else $msg="Nowhere to Move Item To"; + } + + break; + + case "moveitembefore": + // viewitemid newweight + $q="UPDATE fnviewitem SET iweight=iweight+1 WHERE viewid=".ss($_REQUEST['viewid'])." AND iweight>=".ss($_REQUEST['newweight']); + $NATS->DB->Query($q); + $q="UPDATE fnviewitem SET iweight=".ss($_REQUEST['newweight'])." WHERE viewitemid=".ss($_REQUEST['viewitemid']); + //$NATS-DB->Query($q); + $NATS->DB->Query($q); + break; + + default: $msg=$NATS->Lang->Item("unknown.action"); + } + } + +ob_end_flush(); +Screen_Header($NATS->Lang->Item("edit.view"),1,1,"","main","views"); + + +$q="SELECT * FROM fnview WHERE viewid=".ss($_REQUEST['viewid'])." LIMIT 0,1"; +$r=$NATS->DB->Query($q); +if (!$row=$NATS->DB->Fetch_Array($r)) + { + echo $NATS->Lang->Item("no.such.view")."

    "; + Screen_Footer(); + exit(); + } + +$NATS->DB->Free($r); +if (isset($msg)) + { + echo "".$msg."

    "; + $poplist[]=$msg; + } + +//echo "
    "; +echo "".$NATS->Lang->Item("editing.view").": ".$row['vtitle'].""; +//echo "Preview View / "; +//echo "Link to View"; +//echo "
    "; +echo " [ ".$NATS->Lang->Item("preview")." | "; +echo "".$NATS->Lang->Item("linking")." ]"; +echo "
    "; + +echo "
    "; +echo "
    "; +echo ""; + +echo ""; +echo ""; + +echo ""; +echo ""; + +echo ""; +echo ""; +echo ""; + +echo ""; +echo ""; + +echo ""; +echo ""; + +echo ""; +echo ""; + +echo ""; +echo ""; + +echo ""; +echo ""; + +echo ""; +echo ""; +echo ""; +echo "
    View Title"; +echo ""; +echo ""; +echo "
     
    Public View"; +if ($row['vpublic']==1) $s=" checked"; +else $s=""; +echo " ".hlink("View:Public"); +echo "
     
    Page Style"; +if ($row['vstyle']=="standard") $s=" checked"; +else $s=""; +echo " Standard
    "; +echo "Standard full-page headers and footers with "local" page and style includes

    "; +if ($row['vstyle']=="mobile") $s=" checked"; +else $s=""; +echo " Mobile/Minimal
    "; +echo "Very minimal and absolute page style suitable for mobile browser and/or inline JS usage

    "; +if ($row['vstyle']=="plain") $s=" checked"; +else $s=""; +echo " Plain
    "; +echo "Totally plain output

    "; + +echo "
    Link Types"; +if ($row['vclick']=="standard") $s=" checked"; +else $s=""; +echo " Standard
    "; +echo "Standard a href links for same window/frame

    "; +if ($row['vclick']=="frametop") $s=" checked"; +else $s=""; +echo " Same Window (Frame Top)
    "; +echo "a href link to the window/frame top

    "; +if ($row['vclick']=="newwindow") $s=" checked"; +else $s=""; +echo " New Window
    "; +echo "Open a New Window

    "; +if ($row['vclick']=="disabled") $s=" checked"; +else $s=""; +echo " Disabled
    "; +echo "No links (disabled)

    "; +if ($row['vlinkv']==0) $s=""; else $s=" selected"; +$lq="SELECT viewid,vtitle FROM fnview WHERE viewid!=".ss($_REQUEST['viewid']); +$lr=$NATS->DB->Query($lq); +echo "Links to Another View: "; +echo " ".hlink("View:LinkAnotherView")."

    "; +$NATS->DB->Free($lr); +echo "
    Colons (before text status)"; +if ($row['vcolon']==1) $s=" checked"; +else $s=""; +echo " ".hlink("View:Colons"); +echo "
    Dashes (before times)"; +if ($row['vdashes']==1) $s=" checked"; +else $s=""; +echo " ".hlink("View:Dashes"); +echo "
    Times use XX:XX ago"; +if ($row['vtimeago']==1) $s=" checked"; +else $s=""; +echo " ".hlink("View:TimeAgo"); +echo "
    Columns"; +echo ""; +echo " ".hlink("View:Columns"); +echo "
    Refresh"; +echo ""; +echo " ".hlink("View:Refresh"); +echo "
    Save "; +echo "Cancel / Abandon Changes"; +echo "
    "; +echo "
    "; +echo "
    "; +echo "\n\n"; + +// movement list +$movs=array(); +$movc=0; +$q="SELECT itype,ioption,iweight FROM fnviewitem WHERE viewid=".ss($_REQUEST['viewid'])." ORDER BY iweight ASC"; +$r=$NATS->DB->Query($q); +while ($row=$NATS->DB->Fetch_Array($r)) + { + $movs[$movc]['name']=substr(ViewItemTxt($row['itype'],$row['ioption']),0,32)."..."; + $movs[$movc]['weight']=$row['iweight']; + $movc++; + } +$NATS->DB->Free($r); + +//echo "

    "; +$q="SELECT * FROM fnviewitem WHERE viewid=".ss($_REQUEST['viewid'])." ORDER BY iweight ASC"; +$r=$NATS->DB->Query($q); +if ($NATS->DB->Num_Rows($r)<=0) echo "No view objects yet defined.

    "; +else $l=$NATS->DB->Num_Rows($r); +$f=0; + +$pitem=0; +echo "\n"; + + +while ($row=$NATS->DB->Fetch_Array($r)) + { + echo "
    "; + echo ""; + + echo ""; + echo ViewItemTxt($row['itype'],$row['ioption']); + echo ""; + //echo " (show/hide options)"; + //echo "
    "; + echo "
    "; + //echo ""; + echo "
    "; + echo "
    "; + + echo ""; + echo ""; + echo ""; + echo ""; + + echo ""; + + echo ""; + echo ""; + + echo ""; + + echo ""; + + echo "
    "; + echo "
    "; + echo "Use Colour :"; + echo ""; + if ($row['icolour']==1) $s=" checked"; + else $s=""; + echo ""; + echo " ".hlink("View:UseColour"); + echo ""; + echo "Text Status :"; + echo ""; + if ($row['itextstatus']==1) $s=" checked"; + else $s=""; + echo ""; + echo " ".hlink("View:TextStatus"); + echo "
    "; + echo "Item Size :"; + echo ""; + echo ""; + echo ""; + echo "Graphics :"; + echo ""; + echo ""; + echo "
    "; + echo "Show Detail :"; + echo ""; + if ($row['idetail']>0) $s=" checked"; + else $s=""; + echo ""; + echo " ".hlink("View:ShowDetail"); + echo "
    "; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + echo ""; + echo ""; + echo "
    Move: "; + + if ($f==0) echo ""; + else + { + echo ""; + echo ""; + echo ""; + } + + if ($f>=($l-1)) echo ""; + else + { + echo ""; + echo ""; + echo ""; + } + + $f++; + + echo " Before: "; + + echo ""; + echo "item options  "; + echo ""; + echo ""; + echo "
    "; + echo "\n"; + echo "
    "; + //echo "
    "; + echo "
    "; + } + +$NATS->DB->Free($r); + + +echo "\n\n"; + +echo "

    "; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +echo ""; +/* + id=\"newitem_node\" + onchange=\"view_radio_select('node')\" +*/ +echo ""; + +$tests=array(); +$tq="SELECT localtestid,nodeid,testname,testtype,testparam,testrecord FROM fnlocaltest ORDER BY nodeid"; +$tr=$NATS->DB->Query($tq); +while ($test=$NATS->DB->Fetch_Array($tr)) + { + $tid="L".$test['localtestid']; + $tests[$tid]=$test; + $tests[$tid]['testid']=$tid; + } +$NATS->DB->Free($tr); + +$tq="SELECT nstestid,nodeid,testname,testtype,testdesc,testrecord FROM fnnstest WHERE testenabled=1 ORDER BY nodeid"; +$tr=$NATS->DB->Query($tq); +while ($test=$NATS->DB->Fetch_Array($tr)) + { + $tid="N".$test['nstestid']; + $tests[$tid]=$test; + $tests[$tid]['testid']=$tid; + $tests[$tid]['testparam']=$test['testdesc']; + if ($test['testname']=="") + { + if ($test['testdesc']=="") $tests[$tid]['testname']=$test['testtype']; + else $tests[$tid]['testname']=$test['testdesc']; + } + } +$NATS->DB->Free($tr); + + +echo ""; + +echo ""; + +echo ""; + +echo ""; + +echo ""; + +echo ""; + +echo ""; + +echo ""; + +echo ""; +/* TODO - if ok don't be lazy and put the def options in here */ + +echo "
    Create New Item
    "; +echo ""; +echo ""; +echo "Individual Node: "; +echo ""; +echo "
    "; +echo ""; +echo ""; +echo "Individual Group: "; +echo ""; +echo "
    "; +echo ""; +echo ""; +echo "List All (Enabled) Nodes"; +echo "
    "; +echo ""; +echo ""; +echo "List All Groups"; +echo "
    "; +echo ""; +echo ""; +echo "List Alerting Nodes"; +echo "
    "; +echo ""; +echo ""; +echo "List Alerting Groups"; +echo "
    "; +echo ""; +echo ""; +echo "List All Current Alerts"; +echo "
    "; +echo ""; +echo ""; +echo "Detail for Test "; +echo ""; +echo "
    "; +echo "Display Name:
    "; +echo ""; +echo ""; +echo "Graph for Test "; +echo "
    "; +echo "Show Last Hours"; +echo "
    "; +echo ""; +echo ""; +echo "Title: "; +echo "
     "; +echo " "; +//echo ""; +echo "
    "; +?> + + + diff --git a/src/server/web/view.link.php b/src/server/web/view.link.php new file mode 100755 index 0000000..d005be0 --- /dev/null +++ b/src/server/web/view.link.php @@ -0,0 +1,65 @@ +Start(); +if (!$NATS_Session->Check($NATS->DB)) + { + header("Location: ./?login_msg=Invalid+Or+Expired+Session"); + exit(); + } +if ($NATS_Session->userlevel<1) UL_Error("View Link"); +ob_end_flush(); +Screen_Header("View Links",1); +$vid=$_REQUEST['viewid']; +echo "Linking to View # ".$vid."
    "; +echo "Preview View | Edit View Settings

    "; + +$base=GetAbsolute("view.php?viewid=".$vid); +echo "URL: ".$base."
    "; +echo "URL:

    "; + +echo "JavaScript Include Example (Copy and paste into your page)
    "; +echo ""; +if (!isset($_REQUEST['jsdemo'])) + { + echo "

    Demo this working

    "; + } +else + { + echo "

    "; + echo "\n"; + echo "

    "; + } +/* +echo "
    ";
    +var_dump($_SERVER);
    +echo "
    "; +*/ + +echo "

    "; +Screen_Footer(); +?> \ No newline at end of file diff --git a/src/server/web/view.php b/src/server/web/view.php new file mode 100755 index 0000000..38e971f --- /dev/null +++ b/src/server/web/view.php @@ -0,0 +1,1100 @@ +Start(); +$session=true; +if (!$NATS_Session->Check($NATS->DB)) + { + $session=false; + } + +$abs=GetAbsolute(); + +if (isset($_REQUEST['mode'])) $mode=$_REQUEST['mode']; +else $mode=""; + +$items=array(); // items +$ob=array(); // output buffer + +function show_output() +{ +global $ob,$view,$mode; +foreach($ob as $oline) + { + echo $oline."
    "; + } +ob_end_flush(); +exit(); +} + +$q="SELECT * FROM fnview WHERE viewid=".ss($_REQUEST['viewid']); +$r=$NATS->DB->Query($q); +if ($NATS->DB->Num_Rows($r)<=0) + { + $ob[]="Invalid View ".$_REQUEST['viewid']; + show_output(); + } +$view=$NATS->DB->Fetch_Array($r); +if ($view['vpublic']!=1) // requires auth + { + if (!$session) + { + $ob[]="Sorry not a public view"; + show_output(); + } + } + +if ($view['vcolon']>0) $colon=":"; +else $colon=""; +if ($view['vdashes']>0) $dash=" -"; +else $dash=""; +if ($view['vtimeago']>0) $ago=true; +else $ago=false; + +function vdt($dt) +{ +global $ago; +if ($ago) return dtago($dt); +return nicedt($dt); +} + +function ViewNode($nodeid,$detail=true) +{ +global $NATS; +$ret=array(); +$q="SELECT * FROM fnnode WHERE nodeid=\"".ss($nodeid)."\""; +$r=$NATS->DB->Query($q); +if ($NATS->DB->Num_Rows($r)<=0) return $ret; +$row=$NATS->DB->Fetch_Array($r); +if ($row['nodename']!="") $ret['name']=$row['nodename']; +else $ret['name']=$nodeid; +$ret['item']=$ret['name']; +$ret['nodeid']=$nodeid; +$ret['status']=$row['alertlevel']; +$ret['link']="node.php?nodeid=".$nodeid; +$NATS->DB->Free($r); + +$ret['detail']=array(); + +if ($detail) +{ +// get detail +$q="SELECT testtype,testparam,testname,alertlevel FROM fnlocaltest WHERE nodeid=\"".ss($nodeid)."\" ORDER BY alertlevel DESC"; +$r=$NATS->DB->Query($q); +$a=0; +while ($row=$NATS->DB->Fetch_Array($r)) + { + $an=$row['testtype']; + if ($row['testparam']!="") $an.=" (".$row['testparam'].")"; + if ($row['testname']=="") $nn=$an; // textify! + else $nn=$row['testname']; + $ret['detail'][$a]['item']=$nn; + $ret['detail'][$a]['status']=$row['alertlevel']; + $ret['detail'][$a]['link']=$ret['link']; + $a++; + } +$NATS->DB->Free($r); +// get detail +$q="SELECT testtype,testdesc,testname,alertlevel FROM fnnstest WHERE nodeid=\"".ss($nodeid)."\" AND testenabled=1 ORDER BY alertlevel DESC"; +$r=$NATS->DB->Query($q); +$a=0; +while ($row=$NATS->DB->Fetch_Array($r)) + { + if ($row['testname']!="") $nn=$row['testname']; + else if ($row['testdesc']!="") $nn=$row['testdesc']; + else $nn=$row['testtype']; + $ret['detail'][$a]['item']=$nn; + $ret['detail'][$a]['status']=$row['alertlevel']; + $ret['detail'][$a]['link']=$ret['link']; + $a++; + } +$NATS->DB->Free($r); +} +return $ret; +} + +function ViewGroup($groupid,$detail=true) +{ +global $NATS; +$ret=array(); +// Get Group Info +$ret['status']=$NATS->GroupAlertLevel($groupid); +$gq="SELECT * FROM fngroup WHERE groupid=".ss($groupid)." LIMIT 0,1"; +$gr=$NATS->DB->Query($gq); +$grow=$NATS->DB->Fetch_Array($gr); +$NATS->DB->Free($gr); +$ret['name']=$grow['groupname']; +$ret['desc']=$grow['groupdesc']; +$ret['icon']=$grow['groupicon']; +$ret['link']="group.php?groupid=".$groupid; + +// Node Detail +if ($detail) + { + $ret['detail']=array(); + $a=0; + $lq="SELECT nodeid FROM fngrouplink WHERE groupid=".ss($groupid); + $lr=$NATS->DB->Query($lq); + while ($link=$NATS->DB->Fetch_Array($lr)) + { + $nq="SELECT nodename,alertlevel FROM fnnode WHERE nodeid=\"".$link['nodeid']."\" AND nodeenabled=1 ORDER BY alertlevel DESC, weight ASC"; + //$nq="SELECT nodename,alertlevel FROM fnnode"; + $nq.=" LIMIT 0,1"; + $nr=$NATS->DB->Query($nq); + $node=$NATS->DB->Fetch_Array($nr); + $ret['detail'][$a]['nodeid']=$link['nodeid']; + $ret['detail'][$a]['nodename']=$node['nodename']; + $ret['detail'][$a]['status']=$node['alertlevel']; + $ret['detail'][$a]['link']="node.php?nodeid=".$link['nodeid']; + $a++; + $NATS->DB->Free($nr); + } + $NATS->DB->Free($lr); + } + +return $ret; +} + +$q="SELECT * FROM fnviewitem WHERE viewid=".ss($_REQUEST['viewid'])." ORDER BY iweight ASC"; +$r=$NATS->DB->Query($q); +while ($row=$NATS->DB->Fetch_Array($r)) + { + $id=$row['viewitemid']; + $items[$id]=$row; + // get name (varying), status and detail dependent... + switch ($row['itype']) + { + case "node": + $items[$id]['data']=ViewNode($row['ioption']); + break; + + case "allnodes": case "alertnodes": + $items[$id]['detail']=array(); + if ($row['itype']=="allnodes") $q="SELECT nodeid FROM fnnode WHERE nodeenabled=1 ORDER BY `weight` ASC"; + else if ($row['itype']=="alertnodes") $q="SELECT nodeid FROM fnnode WHERE nodeenabled=1 AND alertlevel>0 ORDER BY `weight` ASC"; + $ret=$NATS->DB->Query($q); + //echo "!".$q."
    "; + $a=0; + while ($noderow=$NATS->DB->Fetch_Array($ret)) + { + if ($row['idetail']==1) $det=true; + else $det=false; + $items[$id]['detail'][$a]['data']=ViewNode($noderow['nodeid'],$det); + $items[$id]['detail'][$a]['icolour']=$row['icolour']; + $items[$id]['detail'][$a]['idetail']=$row['idetail']; + $items[$id]['detail'][$a]['igraphic']=$row['igraphic']; + $items[$id]['detail'][$a++]['itextstatus']=$row['itextstatus']; + } + $NATS->DB->Free($ret); + break; + + case "allgroups": case "alertgroups": + $items[$id]['detail']=array(); + $q="SELECT groupid FROM fngroup ORDER BY weight ASC"; + $ret=$NATS->DB->Query($q); + $a=0; + while ($grouprow=$NATS->DB->Fetch_Array($ret)) + { + if ( ($row['itype']=="allgroups") || ($NATS->GroupAlertLevel($grouprow['groupid'])>0) ) + { + $items[$id]['detail'][$a]['data']=ViewGroup($grouprow['groupid'],$row['idetail']); + $items[$id]['detail'][$a]['icolour']=$row['icolour']; + $items[$id]['detail'][$a]['ioption']=$grouprow['groupid']; + $items[$id]['detail'][$a]['idetail']=$row['idetail']; + $items[$id]['detail'][$a]['igraphic']=$row['igraphic']; + $items[$id]['detail'][$a++]['itextstatus']=$row['itextstatus']; + } + } + $NATS->DB->Free($ret); + break; + + case "group": + $items[$id]['data']=ViewGroup($row['ioption'],$row['idetail']); + break; + + case "testgraph": + // can't be arsed to do link here + break; + + case "alerts": + $c=0; + $alev=0; + $items[$id]['detail']=array(); + $alq="SELECT nodeid,openedx,alertlevel FROM fnalert WHERE closedx=0"; + $alr=$NATS->DB->Query($alq); + while ($al=$NATS->DB->Fetch_Array($alr)) + { + $items[$id]['detail'][$c]['nodeid']=$al['nodeid']; + $items[$id]['detail'][$c]['link']="node.php?nodeid=".$al['nodeid']; + if ($al['alertlevel']>$alev) $alev=$al['alertlevel']; + $items[$id]['detail'][$c]['status']=$al['alertlevel']; + $c++; + } + $items[$id]['data']['status']=$alev; + $items[$id]['data']['alerts']=$c; + $NATS->DB->Free($alr); + break; + + case "testdetail": + // localtest only thus far + $tclass=$row['ioption'][0]; + //$tid=substr($row['ioption'],1,128); + + /* + $tquery="SELECT * FROM fnlocaltest WHERE localtestid=\"".ss($tid)."\" LIMIT 0,1"; + $tres=$NATS->DB->Query($tquery); + if ($trow=$NATS->DB->Fetch_Array($tres)) + { + $items[$id]['status']=$trow['alertlevel']; + $items[$id]['lastrunx']=$trow['lastrunx']; + $items[$id]['dtago']=dtago($trow['lastrunx']); + $items[$id]['vtime']=vdt($trow['lastrunx']); + $items[$id]['nodeid']=$trow['nodeid']; + } + $NATS->DB->Free($tres); + */ + + $test=$NATS->GetTest($row['ioption']); + if ($test!==false) + { + $items[$id]['status']=$test['alertlevel']; + $items[$id]['lastrunx']=$test['lastrunx']; + $items[$id]['dtago']=dtago($test['lastrunx']); + $items[$id]['vtime']=vdt($test['lastrunx']); + $items[$id]['nodeid']=$test['nodeid']; + } + break; + + } + + } + +// begin the buffering of output... + +// title and header +if ($view['vstyle']=="plain") + { + $ob[]=""; + $ob[]=""; + $ob[]=""; + } +else if ($view['vstyle']=="mobile") + { + $ob[]=""; + if ($view['vrefresh']>0) $ob[]=""; + $ob[]=""; + $ob[]=""; + } +else // standard and catch-all + { + $ob[]=""; + if ($view['vrefresh']>0) $ob[]=""; + $ob[]="FreeNATS: ".$view['vtitle'].""; + $ob[]=""; + $ob[]=""; + $ob[]=""; + $ob[]=""; + $ob[]="
    "; + $ob[]="FreeNATS: ".$view['vtitle']."
    "; + $ob[]="
    "; + } + +// now the items + +function small_node($item) +{ +global $abs,$view,$colon,$dashes; +$ob=array(); // our local copy +$uri=$abs.$item['data']['link']; +if ($view['vlinkv']!=0) + { + $uri=$abs."view.php?viewid=".$view['vlinkv']; + } +$link=$view['vclick']; +if ($link=="disabled") $l=""; +else if ($link=="standard") $l=""; +else if ($link=="frametop") $l=""; +else if ($link=="newwindow") $l=""; +else $l=""; + +// alert lights only as no fancy full-on tables etc yet +if ($item['igraphic']>0) // actually therefore should only be ==1 with 2 being the "proper" one + { + $is=" "; + $ob[]=$is; + } + +$ob[]=$l; + +if ($item['icolour']==1) $ob[]=""; + +$out=$item['data']['name']; +if ($item['itextstatus']==1) $out.=$colon." ".oText($item['data']['status']); +$ob[]=$out.""; + +if ($item['icolour']==1) $ob[]=""; + +// detail like tests etc... +if ($item['idetail']>0) + { + $a=0; + foreach($item['data']['detail'] as $dline) + { + $a++; + $ob[]="
     - "; + if ($item['icolour']==1) $ob[]=""; + $out=$dline['item']; + if ($item['itextstatus']==1) $out.=$colon." ".oText($dline['status']); + $ob[]=$out; + if ($item['icolour']==1) $ob[]=""; + } + //if ($a>0) $ob[]="
    "; + } + +return $ob; +} + +function large_node($item) +{ +global $abs,$view,$colon,$dashes; +$ob=array(); // our local copy +$uri=$abs.$item['data']['link']; +if ($view['vlinkv']!=0) + { + $uri=$abs."view.php?viewid=".$view['vlinkv']; + } +$link=$view['vclick']; +if ($link=="disabled") $l=""; +else if ($link=="standard") $l=""; +else if ($link=="frametop") $l=""; +else if ($link=="newwindow") $l=""; +else $l=""; + +if ($item['icolour']==1) $col=true; +else $col=false; + +if ($col) + { + switch($item['data']['status']) + { + case -1: $c="#a0a0a0"; break; + case 0: $c="green"; break; + case 1: $c="orange"; break; + case 2: $c="red"; break; + default: $c="black"; break; + } + } +else $c="#a0a0a0"; +$ss="width: 250; border: dotted 1px ".$c.";"; + +$ob[]=""; + +if ($item['igraphic']==1) + { + $is=" "; + } +else if ($item['igraphic']>0) + { + $is=" "; + } +else $is=" "; + +$ob[]=""; +// detail like tests etc... +if ($item['idetail']>0) + { + $ob[]=""; + //if ($a>0) $ob[]="
    "; + } + + +$ob[]="
    "; +$ob[]=$l; +if ($item['icolour']==1) $ob[]=""; + +$out=$item['data']['name']; +if ($item['itextstatus']==1) $out.=$colon." ".oText($item['data']['status']); +$ob[]=$out.""; + +if ($item['icolour']==1) $ob[]=""; +$ob[]=""; +$ob[]=$is; +$ob[]="
    "; + $a=0; + foreach($item['data']['detail'] as $dline) + { + $a++; + $ob[]=" - "; + if ($item['icolour']==1) $ob[]=""; + $out=$dline['item']; + if ($item['itextstatus']==1) $out.=$colon." ".oText($dline['status']); + $ob[]=$out; + if ($item['icolour']==1) $ob[]=""; + $ob[]="
    "; + } + $ob[]="
    "; +return $ob; +} + +function large_group($item) + { + global $abs,$view,$colon,$dashes; + $ob=array(); // our local copy + $uri=$abs.$item['data']['link']; + if ($view['vlinkv']!=0) + { + $uri=$abs."view.php?viewid=".$view['vlinkv']; + } + $link=$view['vclick']; + if ($link=="disabled") $l="
    "; + else if ($link=="standard") $l=""; + else if ($link=="frametop") $l=""; + else if ($link=="newwindow") $l=""; + else $l=""; + + if ($item['icolour']==1) $col=true; + else $col=false; + + if ($col) + { + switch($item['data']['status']) + { + case -1: $c="#a0a0a0"; break; + case 0: $c="green"; break; + case 1: $c="orange"; break; + case 2: $c="red"; break; + default: $c="black"; break; + } + } + else $c="#a0a0a0"; + $ss="width: 250; border: dotted 1px ".$c.";"; + + $ob[]=""; + + if ($item['igraphic']==1) + { + $is=" "; + } + else if ($item['igraphic']>0) + { + $is=" "; + } + else $is=" "; + + $ob[]=""; + + if ($item['data']['desc']!="") $ob[]=""; + + // detail like tests etc... + if ($item['idetail']>0) + { + $ob[]=""; + //if ($a>0) $ob[]="
    "; + } + + + $ob[]="
    "; + $ob[]=$l; + if ($item['icolour']==1) $ob[]=""; + + $out=$item['data']['name']; + if ($item['itextstatus']==1) $out.=$colon." ".oText($item['data']['status']); + $ob[]=$out.""; + + if ($item['icolour']==1) $ob[]=""; + $ob[]=""; + $ob[]=$is; + $ob[]="
    ".$item['data']['desc']."
    "; + $a=0; + foreach($item['data']['detail'] as $dline) + { + $a++; + $ob[]=" - "; + + $uri=$abs.$item['data']['link']; + if ($view['vlinkv']!=0) + { + $uri=$abs."view.php?viewid=".$view['vlinkv']; + } + $link=$view['vclick']; + if ($link=="disabled") $l=""; + else if ($link=="standard") $l=""; + else if ($link=="frametop") $l=""; + else if ($link=="newwindow") $l=""; + else $l=""; + $ob[]=$l; + if ($item['icolour']==1) $ob[]=""; + if ($dline['nodename']!="") $out=$dline['nodename']; + else $out=$dline['nodeid']; + if ($item['itextstatus']==1) $out.=$colon." ".oText($dline['status']); + $ob[]=$out.""; + if ($item['icolour']==1) $ob[]=""; + $ob[]="
    "; + } + $ob[]="
    "; + return $ob; +} + +function small_group($item) + { + global $abs,$view,$colon,$dashes; + $ob=array(); // our local copy + $uri=$abs.$item['data']['link']; + if ($view['vlinkv']!=0) + { + $uri=$abs."view.php?viewid=".$view['vlinkv']; + } + $link=$view['vclick']; + if ($link=="disabled") $l="
    "; + else if ($link=="standard") $l=""; + else if ($link=="frametop") $l=""; + else if ($link=="newwindow") $l=""; + else $l=""; + + // alert lights only as no fancy full-on tables etc yet + if ($item['igraphic']>0) // actually therefore should only be ==1 with 2 being the "proper" one + { + $is=" "; + $ob[]=$is; + } + + $ob[]=$l; + + if ($item['icolour']==1) $ob[]=""; + + $out=$item['data']['name']; + if ($item['itextstatus']==1) $out.=$colon." ".oText($item['data']['status']); + $ob[]=$out.""; + + if ($item['icolour']==1) $ob[]=""; + + // detail like tests etc... + if ($item['idetail']>0) + { + $a=0; + foreach($item['data']['detail'] as $dline) + { + $a++; + $uri=$abs.$item['data']['link']; + if ($view['vlinkv']!=0) + { + $uri=$abs."view.php?viewid=".$view['vlinkv']; + } + $link=$view['vclick']; + if ($link=="disabled") $l=""; + else if ($link=="standard") $l=""; + else if ($link=="frametop") $l=""; + else if ($link=="newwindow") $l=""; + else $l=""; + $ob[]="
     - "; + $ob[]=$l; + if ($item['icolour']==1) $ob[]=""; + if ($dline['nodename']=="") $out=$dline['nodeid']; + else $out=$dline['nodename']; + if ($item['itextstatus']==1) $out.=$colon." ".oText($dline['status']); + $ob[]=$out."
    "; + if ($item['icolour']==1) $ob[]=""; + } + //if ($a>0) $ob[]="
    "; + } + + return $ob; + } + +function small_alerts($item) + { + global $abs,$view,$colon,$dashes; + $ob=array(); // our local copy + $uri=$abs."monitor.php"; + if ($view['vlinkv']!=0) + { + $uri=$abs."view.php?viewid=".$view['vlinkv']; + } + $link=$view['vclick']; + if ($link=="disabled") $l=""; + else if ($link=="standard") $l=""; + else if ($link=="frametop") $l=""; + else if ($link=="newwindow") $l=""; + else $l=""; + + // alert lights only as no fancy full-on tables etc yet + if ($item['igraphic']>0) // actually therefore should only be ==1 with 2 being the "proper" one + { + $is=" "; + //$ob[]=$is; + } + + $ob[]=$l; + + if ($item['icolour']==1) $ob[]=""; + + if ($item['data']['alerts']==0) $out="No System Alerts"; + else $out="System Alerts (".$item['data']['alerts'].")"; + $ob[]=$out.""; + + if ($item['icolour']==1) $ob[]=""; + + // detail like tests etc... + if ($item['idetail']>0) + { + $a=0; + if ($item['data']['alerts']==0) + { + $ob[]="
     - There are no alerts"; + } + else + { + foreach($item['detail'] as $dline) + { + $a++; + $ob[]="
     - "; + $uri=$abs.$dline['link']; + if ($view['vlinkv']!=0) + { + $uri=$abs."view.php?viewid=".$view['vlinkv']; + } + $link=$view['vclick']; + if ($link=="disabled") $l=""; + else if ($link=="standard") $l=""; + else if ($link=="frametop") $l=""; + else if ($link=="newwindow") $l=""; + else $l=""; + $ob[]=$l; + + if ($item['icolour']==1) $ob[]=""; + $out=$dline['nodeid']; + if ($item['itextstatus']==1) $out.=$colon." ".oText($dline['status']); + $ob[]=$out.""; + if ($item['icolour']==1) $ob[]=""; + } + //if ($a>0) $ob[]="
    "; + } + } + $ob[]="
    "; + + return $ob; +} + + +function large_alerts($item) + { + global $abs,$view,$colon,$dashes; + $ob=array(); // our local copy + $uri=$abs."monitor.php"; + if ($view['vlinkv']!=0) + { + $uri=$abs."view.php?viewid=".$view['vlinkv']; + } + $link=$view['vclick']; + if ($link=="disabled") $l=""; + else if ($link=="standard") $l=""; + else if ($link=="frametop") $l=""; + else if ($link=="newwindow") $l=""; + else $l=""; + + if ($item['icolour']==1) $col=true; + else $col=false; + + if ($col) + { + switch($item['data']['status']) + { + case -1: $c="#a0a0a0"; break; + case 0: $c="green"; break; + case 1: $c="orange"; break; + case 2: $c="red"; break; + default: $c="black"; break; + } + } + else $c="#a0a0a0"; + $ss="width: 250; border: dotted 1px ".$c.";"; + + $ob[]=""; + + + + // alert lights only as no fancy full-on tables etc yet + if ($item['igraphic']>0) // actually therefore should only be ==1 with 2 being the "proper" one + { + $is=" "; + //$ob[]=$is; + } + else $is=" "; + + $ob[]=""; + + // detail like tests etc... + if ($item['idetail']>0) + { + $a=0; + if ($item['data']['alerts']==0) + { + $ob[]=""; + } + else + { + foreach($item['detail'] as $dline) + { + $a++; + $ob[]=""; + } + //if ($a>0) $ob[]="
    "; + } + } + $ob[]="
    "; + + if ($item['icolour']==1) $ob[]=""; + + if ($item['data']['alerts']==0) $out="No System Alerts"; + else $out="System Alerts (".$item['data']['alerts'].")"; + $ob[]=$out.""; + + if ($item['icolour']==1) $ob[]=""; + + $ob[]=""; + $ob[]=$is; + $ob[]="
     - There are no alerts
     - "; + $uri=$abs.$dline['link']; + if ($view['vlinkv']!=0) + { + $uri=$abs."view.php?viewid=".$view['vlinkv']; + } + $link=$view['vclick']; + if ($link=="disabled") $l=""; + else if ($link=="standard") $l=""; + else if ($link=="frametop") $l=""; + else if ($link=="newwindow") $l=""; + else $l=""; + $ob[]=$l; + + if ($item['icolour']==1) $ob[]=""; + $out=$dline['nodeid']; + if ($item['itextstatus']==1) $out.=$colon." ".oText($dline['status']); + $ob[]=$out.""; + if ($item['icolour']==1) $ob[]=""; + $ob[]="
    "; + + return $ob; + + + + } + + + + + +if ($view['vcolumns']>1) + { + $usecols=true; + $colcount=$view['vcolumns']; + } +else $usecols=false; + +foreach($items as $item) + { + switch ($item['itype']) + { + case "node": + if ($item['isize']>0) $output=large_node($item); + else $output=small_node($item); + foreach($output as $line) $ob[]=$line; + + break; + + case "group": + if ($item['isize']>0) $output=large_group($item); + else $output=small_group($item); + foreach($output as $line) $ob[]=$line; + break; + + case "alerts": + if ($item['isize']>0) $output=large_alerts($item); + else $output=small_alerts($item); + foreach($output as $line) $ob[]=$line; + break; + + case "allnodes": case "alertnodes": + $c=0; + if ($usecols) $ob[]=""; + foreach($item['detail'] as $node) + { + if ($usecols) + { + if ($c==0) $ob[]=""; + $ob[]=""; + $c++; + if ($c>=$colcount) + { + $ob[]=""; + $ob[]=""; + $c=0; + } + } + else $ob[]="
    "; + } + if (($usecols) && ($c<3)) $ob[]=""; + if ($usecols) $ob[]="
    "; + } + if ($item['isize']==1) $output=large_node($node); + else $output=small_node($node); + foreach($output as $line) $ob[]=$line; + + if ($usecols) + { + $ob[]="
     
    "; + break; + + case "allgroups": case "alertgroups": + $c=0; + if ($usecols) $ob[]=""; + foreach($item['detail'] as $group) + { + if ($usecols) + { + if ($c==0) $ob[]=""; + $ob[]=""; + $c++; + if ($c>=$colcount) + { + $ob[]=""; + $ob[]=""; + $c=0; + } + } + else $ob[]="
    "; + } + if (($usecols) && ($c<3)) $ob[]=""; + if ($usecols) $ob[]="
    "; + } + if ($item['isize']==1) $output=large_group($group); + else $output=small_group($group); + foreach($output as $line) $ob[]=$line; + + if ($usecols) + { + $ob[]="
     
    "; + break; + + case "title": + if ($item['isize']>0) $ob[]=""; + else if ($item['icolour']==1) $ob[]=""; + $ob[]=$item['ioption']; + if ( ($item['isize']>0) || ($item['icolour']==1) ) $ob[]=""; + break; + + case "testdetail": + + $is=""; + if ($item['igraphic']>0) + { + $is=" "; + } + + if ($is!="") $ob[]=$is; + + $uri=$abs."node.php?nodeid=".$item['nodeid']; + if ($view['vlinkv']!=0) + { + $uri=$abs."view.php?viewid=".$view['vlinkv']; + } + $link=$view['vclick']; + if ($link=="disabled") $l="
    "; + else if ($link=="standard") $l=""; + else if ($link=="frametop") $l=""; + else if ($link=="newwindow") $l=""; + else $l=""; + $ob[]=$l; + + if ($item['icolour']==1) $ob[]=""; + else $ob[]=""; + + $s=$item['iname']; + if ($item['itextstatus']==1) $s.=$colon." ".oText($item['status']); + $s.=""; + $ob[]=$s; + if ($item['idetail']>0) + { + if ($item['isize']>0) $ob[]="
     ".$dash." tested "; + else $ob[]=$dash." "; + $ob[]=$item['vtime']; + } + $ob[]="
    "; + + break; + + case "testgraph": + $p=strpos($item['ioption'],"/"); + if ($p===false) + { + $hrs=24; + $tid=$item['ioption']; + } + else + { + $tid=substr($item['ioption'],0,$p); + $hrs=substr($item['ioption'],$p+1,20); + if ($hrs=="") $hrs=24; + } + if ($item['isize']>0) + { + $width=700; + $height=150; + } + else + { + $width=350; + $height=100; + } + // colours eventually... + + $uri=$abs."history.test.php?testid=".$tid; + if ($view['vlinkv']!=0) + { + $uri=$abs."view.php?viewid=".$view['vlinkv']; + } + $link=$view['vclick']; + if ($link=="disabled") $l=""; + else if ($link=="standard") $l=""; + else if ($link=="frametop") $l=""; + else if ($link=="newwindow") $l=""; + else $l=""; + + + $i=$abs."test.graph.php?testid=".$tid; + $graphkey=$NATS->Cfg->Get("site.graph.key",""); + if ($graphkey!="") $i.="&graphkey=".$graphkey; + $i.="&startx="; + $now=time(); + $startx=$now-($hrs*60*60); + $i.=$startx."&finishx=".$now."&width=".$width."&height=".$height; + $ob[]=$l.""; + break; + + } + $ob[]="
    "; + + } + +// footer +if ($view['vstyle']=="mobile") + { + $ob[]=""; + } +else if ($view['vstyle']=="plain") + { + $ob[]=""; + } +else // standard and catch-all + { + $ob[]=""; + $ob[]=""; + $ob[]="
    Powered by FreeNATS"; + $ob[]=""; + $ob[]="Login to System"; + $ob[]="
    "; + } + + + +// finally the output +switch ($mode) + { + case "debug": + echo "
    ";
    +	var_dump($items);
    +	echo "

    "; + foreach($ob as $l) + echo htmlspecialchars($l)."\n"; + break; + + case "js": + //echo "\n"; + echo "\n"; + break; + + default: + foreach($ob as $l) + { + echo $l; + echo "\n"; + } + } + +?> \ No newline at end of file diff --git a/src/server/web/welcome.php b/src/server/web/welcome.php new file mode 100755 index 0000000..f4ca8b1 --- /dev/null +++ b/src/server/web/welcome.php @@ -0,0 +1,72 @@ +Start(); +if (!$NATS_Session->Check($NATS->DB)) + { + header("Location: ./?login_msg=Invalid+Or+Expired+Session"); + exit(); + } +if ($NATS_Session->userlevel<5) UL_Error("Welcome Page"); + + +$NATS->Cfg->Set("freenats.firstrun","0"); + +if (isset($_REQUEST['process'])) + { + if (isset($_REQUEST['set_tracker'])) $NATS->Cfg->Set("freenats.tracker","1"); + else $NATS->Cfg->Set("freenats.tracker","0"); + if (isset($_REQUEST['send_confirm'])) $NATS->PhoneHome(0,"firstrun.conf"); + } + +if (($NATS->Cfg->Get("freenats.tracker")!="")&&($NATS->Cfg->Get("freenats.tracker")>0)) + { + $NATS->PhoneHome(0,"firstrun"); + } + +if (isset($_REQUEST['process'])) + { + $s="main.php?message=Ready+to+setup+nodes"; + if (isset($_REQUEST['check_updates'])) $s.="&check_updates=1"; + header("Location: ".$s); + exit(); + } +ob_end_flush(); +Screen_Header("Welcome to FreeNATS",1); + +echo "
    Please take a moment to complete setup of FreeNATS

    "; +echo "
    "; +echo ""; +echo " Check Now for Updates

    "; +echo " Participate in Automated Feedback Program

    "; +echo " Confirm FreeNATS Installation with PurplePixie Systems
    "; +echo "
    "; +echo ""; +echo "


    "; + +?> + + diff --git a/src/shell-install.sh b/src/shell-install.sh new file mode 100755 index 0000000..471eafd --- /dev/null +++ b/src/shell-install.sh @@ -0,0 +1,260 @@ +#!/bin/bash + +# FreeNATS shell-install.sh : Installer/Upgrader +# Version 0.00 +# Copyright 2008 PurplePixie Systems, All Rights Reserved +# Part of the FreeNATS Package released under the GNU GPL v3 +# See http://www.purplepixie.org/freenats for more information +# + +if [ "$1" == "dummy" ]; then + FN_DUMMY="1" +else + FN_DUMMY="0" +fi + +if [ "$FN_BASE" == "" ]; then + FN_BASE="/opt/freenats/server/base/" +fi +if [ "$FN_BIN" == "" ]; then + FN_BIN="/opt/freenats/server/bin/" +fi +if [ "$FN_WEB" == "" ]; then + FN_WEB="/opt/freenats/server/web/" +fi + +# FN_BASE="/tmp/freenats/server/base/" +# FN_BIN="/tmp/freenats/server/bin/" +# FN_WEB="/tmp/freenats/server/web/" + +echo +echo FreeNATS Shell Install/Upgrade 0.00 +echo http://www.purplepixie.org/freenats +echo +if [ "$FN_DUMMY" == "1" ]; then + echo "Dummy Run" + echo +fi + +function domv + { + echo "/bin/mv $1 $2" + if [ "$FN_DUMMY" != "1" ]; then + /bin/mv $1 $2 + fi + } + +function docp + { + echo "/bin/cp -Rf -v $1 $2" + if [ "$FN_DUMMY" != "1" ]; then + /bin/cp -Rf -v $1 $2 + fi + } + +function docpa + { + echo "/bin/cp -Rf -v $1* $2" + if [ "$FN_DUMMY" != "1" ]; then + /bin/cp -Rf -v $1* $2 + fi + } + +function domkdir + { + echo "/bin/mkdir -p $1" + if [ "$FN_DUMMY" != "1" ]; then + /bin/mkdir -p $1 + fi + } + + + +if [ ! -f "server/base/nats.php" ]; then + echo "Error: server/base/nats.php not found" + echo + echo "You must run this script from within the freenats directory i.e." + echo "the working directory is /downloads/freenats-xxx/" + echo + exit 0 +fi + +echo -n "Is this an Upgrade or Install [U/i]: " +read itype + +if [ "$itype" == "i" ]; then + echo "Performing Fresh Installation" + + +else + echo "Performing System Upgrade" + +fi + +echo +echo "Directory locations - INCLUDE TRAILING SLASH!" +echo -n "Base [$FN_BASE]: " +read ubase +echo -n "Bin [$FN_BIN]: " +read ubin +echo -n "Web [$FN_WEB]: " +read uweb + +if [ "$ubase" != "" ]; then + FN_BASE="$ubase" +fi +if [ "$ubin" != "" ]; then + FN_BIN="$ubin" +fi +if [ "$uweb" != "" ]; then + FN_WEB="$uweb" +fi + +echo +echo "Using Installation Directories:" +echo "Base: $FN_BASE" +echo "Bin : $FN_BIN" +echo "Web : $FN_WEB" + +if [ "$itype" != "i" ]; then + if [ ! -d "$FN_BASE" ]; then + echo "Upgrade Error: $FN_BASE does not exist" + exit 0 + fi + if [ ! -d "$FN_WEB" ]; then + echo "Upgrade Error: $FN_WEB does not exist" + exit 0 + fi + if [ ! -d "$FN_BIN" ]; then + echo "Upgrade Error: $FN_BIN does not exist" + exit 0 + fi +else + if [ -d "$FN_BASE" ]; then + echo "Install Error: $FN_BASE exists" + exit 0 + fi + if [ -d "$FN_WEB" ]; then + echo "Install Error: $FN_WEB exists" + exit 0 + fi + if [ -d "$FN_BIN" ]; then + echo "Install Error: $FN_BIN exists" + exit 0 + fi +fi + +echo +echo "Installing/Upgrading ---" + +function cleanup +{ +echo "- Cleaning Up" +if [ -f "server/web/firstrun.php" ]; then +CMD="server/web/firstrun.php server/web/firstrun-.php" +domv $CMD +fi +if [ -f "server/web/include-.php" ]; then +CMD="server/web/include-.php server/web/include.php" +domv $CMD +fi +if [ -f "server/bin/include-.php" ]; then +CMD="server/bin/include-.php server/bin/include.php" +domv $CMD +fi +if [ -f "server/base/config-.inc.php" ]; then +CMD="server/base/config-.inc.php server/base/config.inc.php" +domv $CMD +fi +} + +cleanup + + +if [ "$itype" == "i" ]; then +echo "- Fresh Install" +echo "- Creating Directories" + +CMD="$FN_BASE" +domkdir $CMD +CMD="$FN_WEB" +domkdir $CMD +CMD="$FN_BIN" +domkdir $CMD + +echo "- Enabling First Run Script" +CMD="server/web/firstrun-.php server/web/firstrun.php"; +domv $CMD + +else + +echo "- Upgrade" +echo "- Protecting Existing Config" +CMD="server/web/include.php server/web/include-.php" +domv $CMD +CMD="server/bin/include.php server/bin/include-.php" +domv $CMD +CMD="server/base/config.inc.php server/base/config-.inc.php" +domv $CMD + + +fi + +echo "- Copying Files" +CMD="server/base/ $FN_BASE" +docpa $CMD +CMD="server/web/ $FN_WEB" +docpa $CMD +CMD="server/bin/ $FN_BIN" +docpa $CMD + + +cleanup +echo "--- Complete" +echo + +echo "**** THE NEXT STEP ****" +echo + +if [ "$itype" == "i" ]; then + echo "If you have moved the directories in relation to each other" + echo "i.e. base DOESN\'T lie at ../base from bin and/or web you will" + echo "need to edit the following files and change the BaseDir value:" + echo -n "$FN_WEB" + echo "include.php" + echo -n "$FN_BIN" + echo "include.php" + echo + echo "You will also need to edit the following file:" + echo -n "$FN_BASE" + echo "config.inc.php" + echo "and put in your MySQL connection information" + echo + echo "Once that is done you should browse to http://WEBINSTALL/firstrun.php" + echo "to complete database schema setup etc.." + echo + echo "You will also need to setup the CRON system processes to run the various" + echo "scripts as described in the install.html document and online at" + echo "http://www.purplepixie.org/freenats" +else + echo "The files should now have been upgraded and your include" + echo "and config.inc files not changed." + echo + echo "If you need to update the database schema (almost certainly) there are" + echo "three ways of doing this - creating fresh (recommended), manually" + echo "updating the or you can try the new (pre-pre-pre-alpha) update method." + echo + echo "To create fresh (reset the database to the current schema) you should" + echo "rename the web/firstrun-.php file to web/firstrun.php and browse to" + echo "it. Follow the instructions for a clean setup. (You can also manually" + echo "import the files see install.html for details)." + echo + echo "To try the experimental upgrade process see the install.html file." + echo + echo "If you need to update the schema manually the current schema is in:" + echo -n "$FN_BASE" + echo "sql/schema.sql" +fi + +echo + diff --git a/src/vm-upgrade.sh b/src/vm-upgrade.sh new file mode 100755 index 0000000..f87df6e --- /dev/null +++ b/src/vm-upgrade.sh @@ -0,0 +1,131 @@ +#!/bin/bash +# FreeNATS vm-upgade.sh : VM Specific Upgrader +# Copyright 2008 PurplePixie Systems, All Rights Reserved +# Part of the FreeNATS Package released under the GNU GPL v3 +# See http://www.purplepixie.org/freenats for more information +# + +if [ "$1" == "dummy" ]; then + VM_DUMMY="1" +else + VM_DUMMY="0" +fi + +echo "Upgrading Virtual Machine..." +if [ "$VM_DUMMY" == "1" ]; then + echo "-- Dummy Run --" +fi + +echo + +if [ ! -f "shell-install.sh" ]; then + echo "shell-install.sh not found - must be in the same directory" + echo "and have the same working directory!" + echo + exit 0 +fi + +FN_WEB="/srv/www/html/" +export FN_WEB + +echo +echo "**************** FreeNATS Virtual Appliance Upgrade ****************" +echo +echo "The upgrade process will now call the file upgrade script with values" +echo "pre-set for the FreeNATS rPath Virtual Appliance. You to just select" +echo "upgrade (press return) and accept the default directory locations" +echo "(by pressing return)." +echo +echo "Once the file upgrade is complete you will be prompted to upgrade or" +echo "refresh the database schema and configuration." +echo +echo -n "Proceed with upgrade (y/N): " +read proccheck +if [ "$proccheck" != "y" ]; then + echo + echo "Upgrade Aborted at User Request" + echo + FN_WEB="" + export FN_WEB + exit 0 +fi +echo +echo "**************** FreeNATS Virtual Appliance Upgrade ****************" +echo +echo "Proceeding with upgrade..." +echo + + +if [ "$VM_DUMMY" == "1" ]; then + ./shell-install.sh dummy +else + ./shell-install.sh +fi + +FN_WEB="" +export FN_WEB + +echo +echo "**************** FreeNATS Virtual Appliance Upgrade ****************" +echo +echo "File structure update completed." +echo + +echo "You must now decide whether to update the database schema (recommended)" +echo "and how to do this." +echo +echo -n "Update database schema [Y/n]: " +read updatesch +if [ "$updatesch" == "n" ]; then + echo "You have chosen not to update the schema. Please be aware this can" + echo "cause adverse affects and failures." + echo + exit 0 +fi +echo +echo "Please select the update method - fresh (recommended) will wipe all" +echo "existing data from the FreeNATS system. Alternatively you can try" +echo "the update method (experimental) to upgrade the schema with the data" +echo "and configuration kept intact." +echo + +UDMETH=0 +while [ "$UDMETH" == 0 ]; do + echo -n "Update Method [Fresh/Upgrade]: " + read udinp + if [ "$udinp" == "f" ]; then + UDMETH=1 + elif [ "$udinp" == "u" ]; then + UDMETH=2 + else + echo "Please enter f for fresh or u for upgrade (Control-C to abort)" + echo + fi +done + +function mysql + { + if [ "$VM_DUMMY" == 1 ]; then + echo "/usr/bin/mysql -u freenats -pfreenats -h localhost --force freenats < server/base/sql/$1" + else + /usr/bin/mysql -u freenats -pfreenats -h localhost --force freenats < server/base/sql/$1 + fi + } + +if [ "$UDMETH" == 1 ]; then + echo "Importing Fresh Schema" + mysql schema.drop.sql + mysql default.sql + mysql example.sql +else + echo "Upgrading Database Schema - Please Ignore Errors" + mysql schema.sql + mysql schema.upgrade.sql + mysql default.sql +fi + +echo "Virtual Machine Configuration Complete" +echo +echo +echo "**************** FreeNATS Virtual Appliance Complete ****************" +echo diff --git a/test/graphtest.php b/test/graphtest.php new file mode 100644 index 0000000..3929687 --- /dev/null +++ b/test/graphtest.php @@ -0,0 +1,13 @@ + + + + + + +

    +

    diff --git a/test/split.php b/test/split.php new file mode 100644 index 0000000..59746d1 --- /dev/null +++ b/test/split.php @@ -0,0 +1,18 @@ + diff --git a/test/versions.csv b/test/versions.csv new file mode 100644 index 0000000..328642c --- /dev/null +++ b/test/versions.csv @@ -0,0 +1,80 @@ +0.04.26a,2008-07-01,155399 +0.04.27a,2008-09-04,155409 +0.04.28a,2008-09-05,155397 +0.04.29a,2008-09-11,155411 +0.04.30a,2008-09-12,155452 +0.04.31b,2008-09-13,155437 +1.00.0a,2008-07-04,190790 +1.00.10a,2008-08-12,250299 +1.00.11a,2008-08-13,250302 +1.00.12a,2008-08-18,250314 +1.00.13a,2008-08-31,250542 +1.00.1a,2008-07-10,192848 +1.00.2a,2008-07-14,238683 +1.00.3a,2008-07-15,240142 +1.00.4a,2008-07-16,244201 +1.00.5a,2008-07-16,244200 +1.00.6a,2008-07-20,246862 +1.00.7a,2008-07-28,247700 +1.00.8a,2008-07-29,249930 +1.00.9a,2008-07-29,249991 +1.01.0a,2008-09-13,250788 +1.01.10a,2008-10-29,265742 +1.01.1a,2008-09-14,251150 +1.01.2a,2008-09-17,251223 +1.01.3b,2008-09-19,251225 +1.01.4b,2008-09-21,251248 +1.01.5b,2008-09-23,264577 +1.01.6b,2008-09-24,265138 +1.01.7b,2008-09-25,265043 +1.01.8a,2008-10-03,265493 +1.01.9a,2008-10-15,265696 +1.02.0a,2008-11-08,265777 +1.02.1a,2008-11-12,266199 +1.02.2a,2008-11-13,266248 +1.02.3a,2008-11-13,266559 +1.02.4b,2008-12-08,266561 +1.03.0a,2008-12-13,267303 +1.03.1a,2008-12-13,267293 +1.04.0a,2009-04-28,261927 +1.04.1a,2009-04-30,266051 +1.04.2a,2009-05-07,265717 +1.04.3a,2009-05-21,271553 +1.04.4a,2009-05-22,271537 +1.04.5a,2009-05-24,271603 +1.04.6b,2009-06-04,271619 +1.04.7a,2009-06-27,272099 +1.04.8a,2009-06-27,272103 +1.05.1a,2009-07-28,272249 +1.06.1a,2009-10-01,277792 +1.06.2a,2009-11-20,278122 +1.06.3a,2009-11-22,278198 +1.07.0a,2009-11-23,278159 +1.08.0a,2009-11-24,278777 +1.08.1a,2010-01-22,279128 +1.08.2a,2010-02-01,279492 +1.09.0a,2010-02-28,281746 +1.09.1a,2010-04-05,281728 +1.09.2b,2010-04-10,281734 +1.09.3a,2010-07-10,282940 +1.09.4a,2010-07-10,285368 +1.09.5a,2010-08-13,285364 +1.09.6a,2010-08-13,285463 +1.10.0a,2010-10-17,294892 +1.10.1a,2010-11-14,295727 +1.10.2a,2010-11-14,296473 +1.10.3a,2011-01-11,296532 +1.11.0a,2011-01-11,297090 +1.11.1b,2011-01-29,297075 +1.11.2a,2011-01-29,297633 +1.12.0a,2011-01-30,301312 +1.12.1a,2011-01-30,305233 +1.12.2b,2011-02-20,305253 +1.13.0a,2011-03-02,305836 +1.13.1a,2011-04-13,305894 +1.13.2b,2011-07-08,305924 +1.13.3b,2011-07-09,306001 +1.14.0a,2011-11-11,322466 +1.14.1a,2014-04-16,322533 +1.14.2a,2014-04-16,322773 +2.00.0a,2011-07-10,306400 diff --git a/test/versions.txt b/test/versions.txt new file mode 100644 index 0000000..efed8ae --- /dev/null +++ b/test/versions.txt @@ -0,0 +1,80 @@ +-rwxr--r--. 1 dcutting dcutting 155399 2008-07-01 freenats-0.04.26a.tar.gz +-rwxr--r--. 1 dcutting dcutting 155409 2008-09-04 freenats-0.04.27a.tar.gz +-rwxr--r--. 1 dcutting dcutting 155397 2008-09-05 freenats-0.04.28a.tar.gz +-rwxr--r--. 1 dcutting dcutting 155411 2008-09-11 freenats-0.04.29a.tar.gz +-rwxr--r--. 1 dcutting dcutting 155452 2008-09-12 freenats-0.04.30a.tar.gz +-rwxr--r--. 1 dcutting dcutting 155437 2008-09-13 freenats-0.04.31b.tar.gz +-rwxr--r--. 1 dcutting dcutting 190790 2008-07-04 freenats-1.00.0a.tar.gz +-rwxr--r--. 1 dcutting dcutting 250299 2008-08-12 freenats-1.00.10a.tar.gz +-rwxr--r--. 1 dcutting dcutting 250302 2008-08-13 freenats-1.00.11a.tar.gz +-rwxr--r--. 1 dcutting dcutting 250314 2008-08-18 freenats-1.00.12a.tar.gz +-rwxr--r--. 1 dcutting dcutting 250542 2008-08-31 freenats-1.00.13a.tar.gz +-rwxr--r--. 1 dcutting dcutting 192848 2008-07-10 freenats-1.00.1a.tar.gz +-rwxr--r--. 1 dcutting dcutting 238683 2008-07-14 freenats-1.00.2a.tar.gz +-rwxr--r--. 1 dcutting dcutting 240142 2008-07-15 freenats-1.00.3a.tar.gz +-rwxr--r--. 1 dcutting dcutting 244201 2008-07-16 freenats-1.00.4a.tar.gz +-rwxr--r--. 1 dcutting dcutting 244200 2008-07-16 freenats-1.00.5a.tar.gz +-rwxr--r--. 1 dcutting dcutting 246862 2008-07-20 freenats-1.00.6a.tar.gz +-rwxr--r--. 1 dcutting dcutting 247700 2008-07-28 freenats-1.00.7a.tar.gz +-rwxr--r--. 1 dcutting dcutting 249930 2008-07-29 freenats-1.00.8a.tar.gz +-rwxr--r--. 1 dcutting dcutting 249991 2008-07-29 freenats-1.00.9a.tar.gz +-rwxr--r--. 1 dcutting dcutting 250788 2008-09-13 freenats-1.01.0a.tar.gz +-rwxr--r--. 1 dcutting dcutting 265742 2008-10-29 freenats-1.01.10a.tar.gz +-rwxr--r--. 1 dcutting dcutting 251150 2008-09-14 freenats-1.01.1a.tar.gz +-rwxr--r--. 1 dcutting dcutting 251223 2008-09-17 freenats-1.01.2a.tar.gz +-rwxr--r--. 1 dcutting dcutting 251225 2008-09-19 freenats-1.01.3b.tar.gz +-rwxr--r--. 1 dcutting dcutting 251248 2008-09-21 freenats-1.01.4b.tar.gz +-rwxr--r--. 1 dcutting dcutting 264577 2008-09-23 freenats-1.01.5b.tar.gz +-rwxr--r--. 1 dcutting dcutting 265138 2008-09-24 freenats-1.01.6b.tar.gz +-rwxr--r--. 1 dcutting dcutting 265043 2008-09-25 freenats-1.01.7b.tar.gz +-rwxr--r--. 1 dcutting dcutting 265493 2008-10-03 freenats-1.01.8a.tar.gz +-rwxr--r--. 1 dcutting dcutting 265696 2008-10-15 freenats-1.01.9a.tar.gz +-rwxr--r--. 1 dcutting dcutting 265777 2008-11-08 freenats-1.02.0a.tar.gz +-rwxr--r--. 1 dcutting dcutting 266199 2008-11-12 freenats-1.02.1a.tar.gz +-rwxr--r--. 1 dcutting dcutting 266248 2008-11-13 freenats-1.02.2a.tar.gz +-rwxr--r--. 1 dcutting dcutting 266559 2008-11-13 freenats-1.02.3a.tar.gz +-rwxr--r--. 1 dcutting dcutting 266561 2008-12-08 freenats-1.02.4b.tar.gz +-rwxr--r--. 1 dcutting dcutting 267303 2008-12-13 freenats-1.03.0a.tar.gz +-rwxr--r--. 1 dcutting dcutting 267293 2008-12-13 freenats-1.03.1a.tar.gz +-rw-rw-r--. 1 dcutting dcutting 261927 2009-04-28 freenats-1.04.0a.tar.gz +-rw-rw-r--. 1 dcutting dcutting 266051 2009-04-30 freenats-1.04.1a.tar.gz +-rw-rw-r--. 1 dcutting dcutting 265717 2009-05-07 freenats-1.04.2a.tar.gz +-rw-rw-r--. 1 dcutting dcutting 271553 2009-05-21 freenats-1.04.3a.tar.gz +-rw-rw-r--. 1 dcutting dcutting 271537 2009-05-22 freenats-1.04.4a.tar.gz +-rw-rw-r--. 1 dcutting dcutting 271603 2009-05-24 freenats-1.04.5a.tar.gz +-rw-rw-r--. 1 dcutting dcutting 271619 2009-06-04 freenats-1.04.6b.tar.gz +-rw-rw-r--. 1 dcutting dcutting 272099 2009-06-27 freenats-1.04.7a.tar.gz +-rw-rw-r--. 1 dcutting dcutting 272103 2009-06-27 freenats-1.04.8a.tar.gz +-rw-rw-r--. 1 dcutting dcutting 272249 2009-07-28 freenats-1.05.1a.tar.gz +-rw-rw-r--. 1 dcutting dcutting 277792 2009-10-01 freenats-1.06.1a.tar.gz +-rw-rw-r--. 1 dcutting dcutting 278122 2009-11-20 freenats-1.06.2a.tar.gz +-rw-rw-r--. 1 dcutting dcutting 278198 2009-11-22 freenats-1.06.3a.tar.gz +-rw-rw-r--. 1 dcutting dcutting 278159 2009-11-23 freenats-1.07.0a.tar.gz +-rw-rw-r--. 1 dcutting dcutting 278777 2009-11-24 freenats-1.08.0a.tar.gz +-rw-rw-r--. 1 dcutting dcutting 279128 2010-01-22 freenats-1.08.1a.tar.gz +-rw-rw-r--. 1 dcutting dcutting 279492 2010-02-01 freenats-1.08.2a.tar.gz +-rw-rw-r--. 1 dcutting dcutting 281746 2010-02-28 freenats-1.09.0a.tar.gz +-rw-rw-r--. 1 dcutting dcutting 281728 2010-04-05 freenats-1.09.1a.tar.gz +-rw-rw-r--. 1 dcutting dcutting 281734 2010-04-10 freenats-1.09.2b.tar.gz +-rw-rw-r--. 1 dcutting dcutting 282940 2010-07-10 freenats-1.09.3a.tar.gz +-rw-rw-r--. 1 dcutting dcutting 285368 2010-07-10 freenats-1.09.4a.tar.gz +-rw-rw-r--. 1 dcutting dcutting 285364 2010-08-13 freenats-1.09.5a.tar.gz +-rw-rw-r--. 1 dcutting dcutting 285463 2010-08-13 freenats-1.09.6a.tar.gz +-rw-rw-r--. 1 dcutting dcutting 294892 2010-10-17 freenats-1.10.0a.tar.gz +-rw-rw-r--. 1 dcutting dcutting 295727 2010-11-14 freenats-1.10.1a.tar.gz +-rw-rw-r--. 1 dcutting dcutting 296473 2010-11-14 freenats-1.10.2a.tar.gz +-rw-rw-r--. 1 dcutting dcutting 296532 2011-01-11 freenats-1.10.3a.tar.gz +-rw-rw-r--. 1 dcutting dcutting 297090 2011-01-11 freenats-1.11.0a.tar.gz +-rw-rw-r--. 1 dcutting dcutting 297075 2011-01-29 freenats-1.11.1b.tar.gz +-rw-rw-r--. 1 dcutting dcutting 297633 2011-01-29 freenats-1.11.2a.tar.gz +-rw-rw-r--. 1 dcutting dcutting 301312 2011-01-30 freenats-1.12.0a.tar.gz +-rw-rw-r--. 1 dcutting dcutting 305233 2011-01-30 freenats-1.12.1a.tar.gz +-rw-rw-r--. 1 dcutting dcutting 305253 2011-02-20 freenats-1.12.2b.tar.gz +-rw-rw-r--. 1 dcutting dcutting 305836 2011-03-02 freenats-1.13.0a.tar.gz +-rw-rw-r--. 1 dcutting dcutting 305894 2011-04-13 freenats-1.13.1a.tar.gz +-rw-rw-r--. 1 dcutting dcutting 305924 2011-07-08 freenats-1.13.2b.tar.gz +-rw-rw-r--. 1 dcutting dcutting 306001 2011-07-09 freenats-1.13.3b.tar.gz +-rw-rw-r--. 1 dcutting dcutting 322466 2011-11-11 freenats-1.14.0a.tar.gz +-rw-rw-r--. 1 dcutting dcutting 322533 2014-04-16 freenats-1.14.1a.tar.gz +-rw-rw-r--. 1 dcutting dcutting 322773 2014-04-16 freenats-1.14.2a.tar.gz +-rw-rw-r--. 1 dcutting dcutting 306400 2011-07-10 freenats-2.00.0a.tar.gz