Merge lp:~dangarner/xibo/server-170alpha into lp:xibo/1.7

Proposed by Dan Garner
Status: Merged
Merged at revision: 341
Proposed branch: lp:~dangarner/xibo/server-170alpha
Merge into: lp:xibo/1.7
Diff against target: 72436 lines (+29845/-33980)
454 files modified
.bzrignore (+3/-0)
Vagrantfile (+23/-0)
library/readme.txt (+1/-0)
server-tests/features/login-about-popup.feature (+9/-0)
server-tests/features/login-admin-user.feature (+10/-0)
server-tests/features/schedule_view.feature (+7/-0)
server-tests/features/step_definitions/generic.js (+97/-0)
server-tests/features/step_definitions/login-admin-user.js (+14/-0)
server-tests/features/support/teardown.js (+9/-0)
server-tests/features/support/testproperties.json (+9/-0)
server-tests/features/support/world.js (+37/-0)
server-tests/package.json (+16/-0)
server-tests/readme.md (+13/-0)
server/3rdparty/jquery-file-upload/UploadHandler.php (+1/-36)
server/3rdparty/jquery-file-upload/XiboUploadHandler.php (+38/-0)
server/config/client.config.php (+477/-0)
server/config/config.class.php (+218/-124)
server/install.php (+117/-719)
server/install/database/80.sql (+178/-0)
server/install/header_upgrade.inc (+0/-50)
server/install/master/data.sql (+97/-99)
server/install/master/structure.sql (+56/-14)
server/install/upgradestep.class.php (+51/-0)
server/lib/app/app_functions.php (+0/-171)
server/lib/app/datemanager.class.php (+1/-8)
server/lib/app/formmanager.class.php (+222/-132)
server/lib/app/helpmanager.class.php (+1/-17)
server/lib/app/kit.class.php (+13/-6)
server/lib/app/menumanager.class.php (+2/-12)
server/lib/app/pagemanager.class.php (+20/-9)
server/lib/app/pdoconnect.class.php (+44/-8)
server/lib/app/responsemanager.class.php (+40/-25)
server/lib/app/thememanager.class.php (+18/-14)
server/lib/app/translationengine.class.php (+9/-6)
server/lib/data/bandwidth.data.class.php (+62/-0)
server/lib/data/data.class.php (+3/-2)
server/lib/data/dataset.data.class.php (+2/-3)
server/lib/data/datasetdata.data.class.php (+1/-1)
server/lib/data/display.data.class.php (+325/-225)
server/lib/data/displaygroup.data.class.php (+15/-10)
server/lib/data/displaygroupsecurity.data.class.php (+3/-9)
server/lib/data/displayprofile.data.class.php (+213/-0)
server/lib/data/file.data.class.php (+6/-3)
server/lib/data/layout.data.class.php (+407/-19)
server/lib/data/media.data.class.php (+7/-0)
server/lib/data/nonce.data.class.php (+248/-0)
server/lib/data/region.data.class.php (+36/-17)
server/lib/data/resolution.data.class.php (+16/-6)
server/lib/data/schedule.data.class.php (+16/-49)
server/lib/data/template.data.class.php (+2/-3)
server/lib/data/userdata.data.class.php (+28/-0)
server/lib/data/usergroup.data.class.php (+1/-1)
server/lib/include.php (+25/-15)
server/lib/modules/module.class.php (+436/-259)
server/lib/modules/module.interface.php (+15/-3)
server/lib/pages/admin.class.php (+221/-422)
server/lib/pages/base.class.php (+44/-0)
server/lib/pages/campaign.class.php (+138/-28)
server/lib/pages/clock.class.php (+1/-16)
server/lib/pages/content.class.php (+124/-45)
server/lib/pages/dashboard.class.php (+1/-10)
server/lib/pages/dataset.class.php (+167/-70)
server/lib/pages/display.class.php (+409/-241)
server/lib/pages/displaygroup.class.php (+57/-36)
server/lib/pages/displayprofile.class.php (+352/-0)
server/lib/pages/error.class.php (+1/-21)
server/lib/pages/fault.class.php (+1/-10)
server/lib/pages/group.class.php (+59/-24)
server/lib/pages/help.class.php (+54/-30)
server/lib/pages/index.class.php (+210/-190)
server/lib/pages/install.class.php (+619/-0)
server/lib/pages/layout.class.php (+828/-676)
server/lib/pages/license.class.php (+1/-10)
server/lib/pages/log.class.php (+122/-55)
server/lib/pages/mediamanager.class.php (+63/-22)
server/lib/pages/module.class.php (+164/-30)
server/lib/pages/oauth.class.php (+51/-18)
server/lib/pages/preview.class.php (+1/-9)
server/lib/pages/resolution.class.php (+76/-54)
server/lib/pages/schedule.class.php (+668/-1660)
server/lib/pages/sessions.class.php (+55/-24)
server/lib/pages/stats.class.php (+196/-23)
server/lib/pages/statusdashboard.class.php (+165/-115)
server/lib/pages/template.class.php (+65/-48)
server/lib/pages/timeline.class.php (+120/-107)
server/lib/pages/transition.class.php (+30/-31)
server/lib/pages/upgrade.class.php (+301/-0)
server/lib/pages/user.class.php (+197/-101)
server/lib/service/rest.class.php (+2/-1)
server/lib/service/service.wsdl (+51/-24)
server/lib/service/xmdssoap.class.php (+842/-628)
server/lib/xmds.inc.php (+13/-2)
server/locale/dbtranslate.php (+112/-44)
server/maintenance.php (+2/-2)
server/manual/content/admin/api_layouts.php (+40/-16)
server/manual/content/admin/displayprofiles.php (+47/-0)
server/manual/content/admin/module_overview.php (+41/-0)
server/manual/content/admin/module_template.php (+229/-0)
server/manual/content/admin/modules.php (+10/-2)
server/manual/content/admin/release_notes_1.6.3.php (+83/-0)
server/manual/content/admin/release_notes_1.7.0-alpha.php (+82/-0)
server/manual/content/admin/settings.php (+84/-250)
server/manual/content/admin/settings_maintenance.php (+187/-0)
server/manual/content/install/install_client.php (+55/-73)
server/manual/content/layout/overview.php (+6/-1)
server/manual/content/routes.php (+10/-0)
server/manual/content/templates/overview.php (+2/-40)
server/manual/content/templates/template_resolution.php (+41/-2)
server/manual/content/toc_developer.php (+1/-0)
server/manual/content/toc_developer_module.php (+5/-0)
server/manual/content/toc_developer_releasenotes.php (+7/-1)
server/manual/content/toc_getting_started.php (+1/-0)
server/manual/content/toc_user_and_display.php (+1/-0)
server/manual/template.php (+1/-1)
server/modules/clock.module.php (+542/-0)
server/modules/counter.module.php (+31/-18)
server/modules/datasetview.module.php (+79/-64)
server/modules/embedded.module.php (+51/-30)
server/modules/flash.module.php (+0/-1)
server/modules/image.module.php (+76/-24)
server/modules/localvideo.module.php (+29/-48)
server/modules/module_template.php (+286/-0)
server/modules/module_user_general.php (+196/-28)
server/modules/powerpoint.module.php (+1/-2)
server/modules/preview/HtmlTemplate.html (+20/-0)
server/modules/preview/HtmlTemplateForGetResource.html (+10/-11)
server/modules/preview/HtmlTemplateSimple.html (+1/-1)
server/modules/preview/html-preview.js (+18/-4)
server/modules/preview/vendor/fittext.js (+43/-0)
server/modules/preview/vendor/flipclock.css (+430/-0)
server/modules/preview/vendor/flipclock.min.js (+2/-0)
server/modules/preview/vendor/moment.js (+7/-0)
server/modules/preview/xibo-text-render.js (+8/-4)
server/modules/preview/xibo-webpage-render.js (+6/-1)
server/modules/shellcommand.module.php (+24/-12)
server/modules/text.module.php (+86/-67)
server/modules/theme/HtmlTemplateForClock.html (+130/-0)
server/modules/theme/HtmlTemplateForFlipClock.html (+71/-0)
server/modules/ticker.module.php (+565/-464)
server/modules/video.module.php (+0/-1)
server/modules/webpage.module.php (+57/-56)
server/services.php (+44/-0)
server/theme/default/config.php (+6/-2)
server/theme/default/css/calendar.css (+11/-144)
server/theme/default/css/dashboard.css (+369/-0)
server/theme/default/css/install.css (+38/-19)
server/theme/default/css/timeline.css (+17/-14)
server/theme/default/css/xibo.css (+36/-22)
server/theme/default/fonts/montserrat-regular-webfont.eot (+568/-0)
server/theme/default/fonts/montserrat-regular-webfont.svg (+5835/-0)
server/theme/default/fonts/montserrat-regular-webfont.ttf (+553/-0)
server/theme/default/fonts/montserrat-regular-webfont.woff (+561/-0)
server/theme/default/html/about_page.php (+1/-10)
server/theme/default/html/application_form_register.php (+0/-57)
server/theme/default/html/applications_page.php (+0/-54)
server/theme/default/html/campaign_form_add.php (+0/-35)
server/theme/default/html/campaign_form_delete.php (+0/-31)
server/theme/default/html/campaign_form_edit.php (+0/-36)
server/theme/default/html/campaign_form_layout_assign.php (+2/-2)
server/theme/default/html/campaign_form_layout_assign_list.php (+2/-1)
server/theme/default/html/campaign_form_permissions.php (+0/-53)
server/theme/default/html/campaign_page.php (+0/-52)
server/theme/default/html/campaign_page_grid.php (+0/-60)
server/theme/default/html/dataset_dataentry_page.php (+0/-51)
server/theme/default/html/dataset_form_add.php (+0/-46)
server/theme/default/html/dataset_form_column_add.php (+0/-68)
server/theme/default/html/dataset_form_column_delete.php (+0/-31)
server/theme/default/html/dataset_form_column_edit.php (+0/-68)
server/theme/default/html/dataset_form_column_grid.php (+1/-1)
server/theme/default/html/dataset_form_csv_import.php (+0/-70)
server/theme/default/html/dataset_form_delete.php (+0/-31)
server/theme/default/html/dataset_form_edit.php (+0/-46)
server/theme/default/html/dataset_form_permissions.php (+0/-53)
server/theme/default/html/dataset_page.php (+0/-51)
server/theme/default/html/dataset_page_grid.php (+0/-65)
server/theme/default/html/display_form_default_layout.php (+0/-36)
server/theme/default/html/display_form_delete.php (+0/-31)
server/theme/default/html/display_form_edit.php (+0/-129)
server/theme/default/html/display_form_group_assign.php (+21/-15)
server/theme/default/html/display_form_wakeonlan.php (+0/-31)
server/theme/default/html/display_page.php (+0/-60)
server/theme/default/html/display_page_grid.php (+0/-85)
server/theme/default/html/displaygroup_fileassociations_form_assign.php (+2/-2)
server/theme/default/html/displaygroup_fileassociations_form_assign_list.php (+2/-1)
server/theme/default/html/displaygroup_form_add.php (+0/-39)
server/theme/default/html/displaygroup_form_delete.php (+0/-31)
server/theme/default/html/displaygroup_form_display_assign.php (+21/-15)
server/theme/default/html/displaygroup_form_edit.php (+0/-41)
server/theme/default/html/displaygroup_form_permissions.php (+0/-53)
server/theme/default/html/displaygroup_page.php (+0/-51)
server/theme/default/html/displaygroup_page_grid.php (+0/-60)
server/theme/default/html/fault_page.php (+1/-10)
server/theme/default/html/footer.php (+13/-8)
server/theme/default/html/form_file_upload_single.php (+6/-33)
server/theme/default/html/form_grid_pager.php (+41/-0)
server/theme/default/html/form_render.php (+279/-0)
server/theme/default/html/grid_pager.php (+7/-7)
server/theme/default/html/grid_render.php (+206/-0)
server/theme/default/html/header.php (+124/-58)
server/theme/default/html/help_form_add.php (+0/-43)
server/theme/default/html/help_form_delete.php (+0/-31)
server/theme/default/html/help_form_edit.php (+0/-44)
server/theme/default/html/help_page.php (+0/-51)
server/theme/default/html/help_page_grid.php (+0/-63)
server/theme/default/html/homepage_mediamanager.php (+0/-64)
server/theme/default/html/homepage_mediamanager_grid.php (+1/-1)
server/theme/default/html/install_footer.php (+9/-7)
server/theme/default/html/install_header.php (+30/-21)
server/theme/default/html/layout_designer.php (+17/-28)
server/theme/default/html/layout_designer_form_timeline.php (+1/-1)
server/theme/default/html/layout_form_add.php (+0/-56)
server/theme/default/html/layout_form_background.php (+0/-55)
server/theme/default/html/layout_form_copy.php (+0/-46)
server/theme/default/html/layout_form_delete.php (+0/-31)
server/theme/default/html/layout_form_edit.php (+0/-61)
server/theme/default/html/layout_form_retire.php (+0/-32)
server/theme/default/html/layout_jumplist_grid.php (+0/-40)
server/theme/default/html/layout_page.php (+0/-76)
server/theme/default/html/layout_page_grid.php (+0/-70)
server/theme/default/html/library_form_add.php (+3/-3)
server/theme/default/html/library_form_assign.php (+1/-1)
server/theme/default/html/library_form_assign_list.php (+1/-1)
server/theme/default/html/library_form_media_add.php (+8/-8)
server/theme/default/html/library_page.php (+0/-80)
server/theme/default/html/library_page_grid.php (+0/-90)
server/theme/default/html/log_form_display_last100.php (+0/-47)
server/theme/default/html/log_form_truncate.php (+0/-31)
server/theme/default/html/log_page.php (+0/-77)
server/theme/default/html/log_page_grid.php (+0/-47)
server/theme/default/html/login_page.php (+8/-8)
server/theme/default/html/media_form_counter_add.php (+0/-46)
server/theme/default/html/media_form_counter_edit.php (+0/-46)
server/theme/default/html/media_form_datasetview_add.php (+0/-40)
server/theme/default/html/media_form_datasetview_edit.php (+8/-77)
server/theme/default/html/media_form_embedded_add.php (+0/-63)
server/theme/default/html/media_form_embedded_edit.php (+0/-63)
server/theme/default/html/media_form_microblog_add.php (+28/-28)
server/theme/default/html/media_form_microblog_edit.php (+26/-26)
server/theme/default/html/media_form_shellcommand_add.php (+0/-42)
server/theme/default/html/media_form_shellcommand_edit.php (+0/-42)
server/theme/default/html/media_form_text_add.php (+0/-78)
server/theme/default/html/media_form_text_edit.php (+7/-52)
server/theme/default/html/media_form_ticker_add.php (+0/-57)
server/theme/default/html/media_form_ticker_dataset_edit.php (+8/-115)
server/theme/default/html/media_form_ticker_edit.php (+8/-121)
server/theme/default/html/media_form_webpage_add.php (+0/-67)
server/theme/default/html/media_form_webpage_edit.php (+0/-67)
server/theme/default/html/message_box.php (+23/-0)
server/theme/default/html/module_form_edit.php (+0/-47)
server/theme/default/html/module_page.php (+0/-50)
server/theme/default/html/module_page_grid.php (+0/-77)
server/theme/default/html/module_page_install_modules.php (+40/-0)
server/theme/default/html/new_user_welcome.php (+88/-0)
server/theme/default/html/region_form_options.php (+0/-64)
server/theme/default/html/region_form_options_no_transition.php (+0/-52)
server/theme/default/html/resolution_form_add.php (+0/-44)
server/theme/default/html/resolution_form_delete.php (+0/-31)
server/theme/default/html/resolution_form_edit.php (+0/-49)
server/theme/default/html/resolution_page.php (+0/-52)
server/theme/default/html/resolution_page_grid.php (+0/-67)
server/theme/default/html/schedule_form_add_event.php (+0/-96)
server/theme/default/html/schedule_form_edit_event.php (+0/-96)
server/theme/default/html/schedule_form_schedule_now.php (+0/-62)
server/theme/default/html/schedule_page.php (+54/-26)
server/theme/default/html/schedule_page_display_list.php (+0/-59)
server/theme/default/html/sessions_form_logout.php (+0/-31)
server/theme/default/html/sessions_page.php (+0/-61)
server/theme/default/html/sessions_page_grid.php (+0/-62)
server/theme/default/html/settings_page.php (+89/-21)
server/theme/default/html/stats_page.php (+0/-64)
server/theme/default/html/stats_page_bandwidth.php (+47/-0)
server/theme/default/html/stats_page_grid.php (+19/-92)
server/theme/default/html/status_dashboard.php (+184/-40)
server/theme/default/html/table_render.php (+76/-0)
server/theme/default/html/template_form_add.php (+0/-42)
server/theme/default/html/template_form_delete.php (+0/-31)
server/theme/default/html/template_form_permissions.php (+0/-53)
server/theme/default/html/template_page.php (+0/-66)
server/theme/default/html/template_page_grid.php (+0/-66)
server/theme/default/html/transition_form_edit.php (+0/-40)
server/theme/default/html/transition_page.php (+0/-50)
server/theme/default/html/transition_page_grid.php (+0/-66)
server/theme/default/html/upgrade_page.php (+35/-0)
server/theme/default/html/user_form_add.php (+0/-57)
server/theme/default/html/user_form_change_password.php (+0/-45)
server/theme/default/html/user_form_delete.php (+0/-32)
server/theme/default/html/user_form_edit.php (+0/-53)
server/theme/default/html/user_form_set_homepage.php (+0/-37)
server/theme/default/html/user_form_set_password.php (+0/-41)
server/theme/default/html/user_page.php (+0/-65)
server/theme/default/html/user_page_grid.php (+0/-63)
server/theme/default/html/usergroup_form_add.php (+0/-35)
server/theme/default/html/usergroup_form_delete.php (+0/-31)
server/theme/default/html/usergroup_form_edit.php (+0/-35)
server/theme/default/html/usergroup_form_pagesecurity.php (+1/-1)
server/theme/default/html/usergroup_form_user_assign.php (+21/-15)
server/theme/default/html/usergroup_page.php (+0/-62)
server/theme/default/html/usergroup_page_grid.php (+0/-58)
server/theme/default/js/install.js (+23/-0)
server/theme/default/js/xibo-calendar.js (+110/-150)
server/theme/default/js/xibo-cms.js (+175/-79)
server/theme/default/js/xibo-forms.js (+7/-36)
server/theme/default/js/xibo-layout-designer.js (+34/-57)
server/theme/default/js/xibo-preview-timeline.js (+7/-8)
server/theme/default/libraries/bootstrap-colorpicker/css/bootstrap-colorpicker.min.css (+9/-0)
server/theme/default/libraries/bootstrap-colorpicker/js/bootstrap-colorpicker.min.js (+1/-0)
server/theme/default/libraries/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css (+9/-0)
server/theme/default/libraries/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js (+1/-0)
server/theme/default/libraries/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.ar.js (+17/-0)
server/theme/default/libraries/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.bg.js (+16/-0)
server/theme/default/libraries/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.ca.js (+16/-0)
server/theme/default/libraries/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.cs.js (+19/-0)
server/theme/default/libraries/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.da.js (+16/-0)
server/theme/default/libraries/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.de.js (+18/-0)
server/theme/default/libraries/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.ee.js (+18/-0)
server/theme/default/libraries/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.el.js (+15/-0)
server/theme/default/libraries/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.es.js (+16/-0)
server/theme/default/libraries/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.fi.js (+16/-0)
server/theme/default/libraries/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.fr.js (+18/-0)
server/theme/default/libraries/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.he.js (+17/-0)
server/theme/default/libraries/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.hr.js (+15/-0)
server/theme/default/libraries/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.hu.js (+17/-0)
server/theme/default/libraries/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.id.js (+15/-0)
server/theme/default/libraries/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.is.js (+16/-0)
server/theme/default/libraries/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.it.js (+18/-0)
server/theme/default/libraries/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.ja.js (+16/-0)
server/theme/default/libraries/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.ko.js (+17/-0)
server/theme/default/libraries/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.lt.js (+18/-0)
server/theme/default/libraries/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.lv.js (+18/-0)
server/theme/default/libraries/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.ms.js (+16/-0)
server/theme/default/libraries/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.nb.js (+16/-0)
server/theme/default/libraries/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.nl.js (+16/-0)
server/theme/default/libraries/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.no.js (+16/-0)
server/theme/default/libraries/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.pl.js (+17/-0)
server/theme/default/libraries/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.pt-BR.js (+17/-0)
server/theme/default/libraries/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.pt.js (+17/-0)
server/theme/default/libraries/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.ro.js (+17/-0)
server/theme/default/libraries/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.rs-latin.js (+16/-0)
server/theme/default/libraries/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.rs.js (+16/-0)
server/theme/default/libraries/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.ru.js (+16/-0)
server/theme/default/libraries/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.sk.js (+17/-0)
server/theme/default/libraries/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.sl.js (+16/-0)
server/theme/default/libraries/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.sv.js (+16/-0)
server/theme/default/libraries/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.sw.js (+17/-0)
server/theme/default/libraries/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.th.js (+16/-0)
server/theme/default/libraries/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.tr.js (+17/-0)
server/theme/default/libraries/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.ua.js (+15/-0)
server/theme/default/libraries/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.uk.js (+16/-0)
server/theme/default/libraries/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js (+16/-0)
server/theme/default/libraries/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.zh-TW.js (+16/-0)
server/theme/default/libraries/bootstrap-select/css/bootstrap-select.css (+274/-0)
server/theme/default/libraries/bootstrap-select/js/bootstrap-select.js.map (+1/-0)
server/theme/default/libraries/bootstrap-select/js/bootstrap-select.min.js (+8/-0)
server/theme/default/libraries/bootstrap/css/bootstrap-datetimepicker.min.css (+0/-8)
server/theme/default/libraries/bootstrap/css/bootstrap-responsive.css (+0/-1109)
server/theme/default/libraries/bootstrap/css/bootstrap-responsive.min.css (+0/-9)
server/theme/default/libraries/bootstrap/css/bootstrap-theme.min.css (+5/-0)
server/theme/default/libraries/bootstrap/css/bootstrap.css (+0/-6158)
server/theme/default/libraries/bootstrap/css/bootstrap.min.css (+4/-8)
server/theme/default/libraries/bootstrap/fonts/glyphicons-halflings-regular.svg (+229/-0)
server/theme/default/libraries/bootstrap/js/bootbox.min.js (+2/-13)
server/theme/default/libraries/bootstrap/js/bootstrap-datetimepicker.min.js (+0/-26)
server/theme/default/libraries/bootstrap/js/bootstrap.js (+0/-2276)
server/theme/default/libraries/bootstrap/js/bootstrap.min.js (+5/-5)
server/theme/default/libraries/calendar/css/calendar.css (+506/-0)
server/theme/default/libraries/calendar/css/calendar.min.css (+1/-0)
server/theme/default/libraries/calendar/js/calendar.js (+1134/-0)
server/theme/default/libraries/calendar/js/language/ar-SA.js (+63/-0)
server/theme/default/libraries/calendar/js/language/bs-BA.js (+68/-0)
server/theme/default/libraries/calendar/js/language/cs-CZ.js (+109/-0)
server/theme/default/libraries/calendar/js/language/da-DK.js (+74/-0)
server/theme/default/libraries/calendar/js/language/de-AT.js (+79/-0)
server/theme/default/libraries/calendar/js/language/de-DE.js (+73/-0)
server/theme/default/libraries/calendar/js/language/el-GR.js (+80/-0)
server/theme/default/libraries/calendar/js/language/es-ES.js (+80/-0)
server/theme/default/libraries/calendar/js/language/es-MX.js (+73/-0)
server/theme/default/libraries/calendar/js/language/fi-FI.js (+109/-0)
server/theme/default/libraries/calendar/js/language/fr-FR.js (+75/-0)
server/theme/default/libraries/calendar/js/language/hr-HR.js (+61/-0)
server/theme/default/libraries/calendar/js/language/hu-HU.js (+78/-0)
server/theme/default/libraries/calendar/js/language/it-IT.js (+75/-0)
server/theme/default/libraries/calendar/js/language/ja-JP.js (+105/-0)
server/theme/default/libraries/calendar/js/language/ko-KR.js (+70/-0)
server/theme/default/libraries/calendar/js/language/nl-NL.js (+75/-0)
server/theme/default/libraries/calendar/js/language/no-NO.js (+64/-0)
server/theme/default/libraries/calendar/js/language/pl-PL.js (+77/-0)
server/theme/default/libraries/calendar/js/language/pt-BR.js (+72/-0)
server/theme/default/libraries/calendar/js/language/ro-RO.js (+91/-0)
server/theme/default/libraries/calendar/js/language/ru-RU.js (+74/-0)
server/theme/default/libraries/calendar/js/language/sl-SL.js (+109/-0)
server/theme/default/libraries/calendar/js/language/sv-SE.js (+75/-0)
server/theme/default/libraries/calendar/js/language/template.js (+109/-0)
server/theme/default/libraries/calendar/js/language/tr-TR.js (+71/-0)
server/theme/default/libraries/calendar/js/language/zh-CN.js (+70/-0)
server/theme/default/libraries/calendar/js/language/zh-TW.js (+66/-0)
server/theme/default/libraries/calendar/tmpls/day.html (+73/-0)
server/theme/default/libraries/calendar/tmpls/events-list.html (+13/-0)
server/theme/default/libraries/calendar/tmpls/modal.html (+10/-0)
server/theme/default/libraries/calendar/tmpls/month-day.html (+25/-0)
server/theme/default/libraries/calendar/tmpls/month.html (+19/-0)
server/theme/default/libraries/calendar/tmpls/week-days.html (+7/-0)
server/theme/default/libraries/calendar/tmpls/week.html (+18/-0)
server/theme/default/libraries/calendar/tmpls/year-month.html (+11/-0)
server/theme/default/libraries/calendar/tmpls/year.html (+20/-0)
server/theme/default/libraries/ckeditor/config.js (+3/-0)
server/theme/default/libraries/ckeditor/contents.css (+5/-0)
server/theme/default/libraries/flot/LICENSE.txt (+0/-22)
server/theme/default/libraries/flot/excanvas.js (+0/-1428)
server/theme/default/libraries/flot/excanvas.min.js (+0/-1)
server/theme/default/libraries/flot/jquery.colorhelpers.js (+0/-180)
server/theme/default/libraries/flot/jquery.colorhelpers.min.js (+0/-1)
server/theme/default/libraries/flot/jquery.flot.canvas.js (+0/-345)
server/theme/default/libraries/flot/jquery.flot.canvas.min.js (+0/-1)
server/theme/default/libraries/flot/jquery.flot.categories.js (+0/-190)
server/theme/default/libraries/flot/jquery.flot.categories.min.js (+0/-1)
server/theme/default/libraries/flot/jquery.flot.crosshair.js (+0/-176)
server/theme/default/libraries/flot/jquery.flot.crosshair.min.js (+0/-1)
server/theme/default/libraries/flot/jquery.flot.errorbars.js (+0/-353)
server/theme/default/libraries/flot/jquery.flot.errorbars.min.js (+0/-1)
server/theme/default/libraries/flot/jquery.flot.fillbetween.js (+0/-226)
server/theme/default/libraries/flot/jquery.flot.fillbetween.min.js (+0/-1)
server/theme/default/libraries/flot/jquery.flot.image.js (+0/-241)
server/theme/default/libraries/flot/jquery.flot.image.min.js (+0/-1)
server/theme/default/libraries/flot/jquery.flot.js (+0/-3137)
server/theme/default/libraries/flot/jquery.flot.min.js (+0/-2)
server/theme/default/libraries/flot/jquery.flot.navigate.js (+0/-346)
server/theme/default/libraries/flot/jquery.flot.navigate.min.js (+0/-1)
server/theme/default/libraries/flot/jquery.flot.pie.js (+0/-817)
server/theme/default/libraries/flot/jquery.flot.pie.min.js (+0/-1)
server/theme/default/libraries/flot/jquery.flot.resize.js (+0/-60)
server/theme/default/libraries/flot/jquery.flot.resize.min.js (+0/-1)
server/theme/default/libraries/flot/jquery.flot.selection.js (+0/-360)
server/theme/default/libraries/flot/jquery.flot.selection.min.js (+0/-1)
server/theme/default/libraries/flot/jquery.flot.stack.js (+0/-188)
server/theme/default/libraries/flot/jquery.flot.stack.min.js (+0/-1)
server/theme/default/libraries/flot/jquery.flot.symbol.js (+0/-71)
server/theme/default/libraries/flot/jquery.flot.symbol.min.js (+0/-1)
server/theme/default/libraries/flot/jquery.flot.threshold.js (+0/-142)
server/theme/default/libraries/flot/jquery.flot.threshold.min.js (+0/-1)
server/theme/default/libraries/flot/jquery.flot.time.js (+0/-431)
server/theme/default/libraries/flot/jquery.flot.time.min.js (+0/-1)
server/theme/default/libraries/font-awesome/css/font-awesome.min.css (+4/-0)
server/theme/default/libraries/font-awesome/fonts/fontawesome-webfont.svg (+504/-0)
server/theme/default/libraries/jquery/additional-methods.min.js (+4/-2)
server/theme/default/libraries/jquery/jquery-1.11.1.min.js (+4/-0)
server/theme/default/libraries/jquery/jquery.min.map (+1/-0)
server/theme/default/libraries/jquery/jquery.validate.min.js (+4/-2)
server/theme/default/libraries/jstimezonedetect/LICENCE.txt (+22/-0)
server/theme/default/libraries/jstimezonedetect/jstz.min.js (+2/-0)
server/theme/default/libraries/morrisjs/morris.css (+2/-0)
server/theme/default/libraries/morrisjs/morris.min.js (+7/-0)
server/theme/default/libraries/morrisjs/raphael.min.js (+11/-0)
server/theme/default/libraries/underscore/underscore-min.js (+1/-0)
server/upgrade.php (+0/-679)
To merge this branch: bzr merge lp:~dangarner/xibo/server-170alpha
Reviewer Review Type Date Requested Status
Xibo Maintainters Pending
Review via email: mp+235276@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2013-05-01 19:24:35 +0000
3+++ .bzrignore 2014-09-19 11:39:09 +0000
4@@ -2,3 +2,6 @@
5 .project
6 server/.project
7 Thumbs.db
8+.vagrant
9+library/*
10+server-tests/node_modules
11
12=== added file 'Vagrantfile'
13--- Vagrantfile 1970-01-01 00:00:00 +0000
14+++ Vagrantfile 2014-09-19 11:39:09 +0000
15@@ -0,0 +1,23 @@
16+# -*- mode: ruby -*-
17+# vi: set ft=ruby :
18+
19+# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
20+VAGRANTFILE_API_VERSION = "2"
21+
22+$script = <<SCRIPT
23+apt-get update
24+apt-get install libapache2-mod-xsendfile
25+SCRIPT
26+
27+$ip = <<IP
28+ifconfig
29+IP
30+
31+Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
32+ config.vm.box = "avenuefactory/lamp"
33+ config.vm.provision "shell", inline: $script
34+ config.vm.provision "shell", inline: $ip, run: "always"
35+ config.vm.network :private_network, type: "dhcp"
36+ config.vm.synced_folder "server/", "/var/www/html"
37+ config.vm.synced_folder "library/", "/var/www/library"
38+end
39
40=== added directory 'library'
41=== added file 'library/readme.txt'
42--- library/readme.txt 1970-01-01 00:00:00 +0000
43+++ library/readme.txt 2014-09-19 11:39:09 +0000
44@@ -0,0 +1,1 @@
45+This folder acts as a non-web serviceable location for the Xibo Library when using Vagrant.
46\ No newline at end of file
47
48=== added directory 'server-tests'
49=== added directory 'server-tests/features'
50=== added file 'server-tests/features/login-about-popup.feature'
51--- server-tests/features/login-about-popup.feature 1970-01-01 00:00:00 +0000
52+++ server-tests/features/login-about-popup.feature 2014-09-19 11:39:09 +0000
53@@ -0,0 +1,9 @@
54+Feature: About Popup
55+ While we are logged out
56+ We need to make sure the about link is visible
57+ And that the popup opens when we click it
58+
59+ Scenario: Visit the Xibo CMS
60+ Given I visit the Xibo CMS
61+ When I press the 'About' link
62+ Then I should see the dialog titled 'About'
63\ No newline at end of file
64
65=== added file 'server-tests/features/login-admin-user.feature'
66--- server-tests/features/login-admin-user.feature 1970-01-01 00:00:00 +0000
67+++ server-tests/features/login-admin-user.feature 2014-09-19 11:39:09 +0000
68@@ -0,0 +1,10 @@
69+Feature: Login
70+ I visit the Xibo CMS and want to login
71+
72+ Scenario: Login
73+ Given I visit the Xibo CMS
74+ When the 'login-form' form is visible
75+ And I enter 'dan' into 'username'
76+ And I enter 'dan' into 'password'
77+ And I press the login button
78+ Then I should see the dashboard
79\ No newline at end of file
80
81=== added file 'server-tests/features/schedule_view.feature'
82--- server-tests/features/schedule_view.feature 1970-01-01 00:00:00 +0000
83+++ server-tests/features/schedule_view.feature 2014-09-19 11:39:09 +0000
84@@ -0,0 +1,7 @@
85+Feature: View the Calendar
86+
87+ Scenario: View the Calendar without any Display Groups selected
88+ Given I visit the Xibo CMS
89+ And I am logged in as a 'super admin'
90+ And I visit 'the schedule'
91+ Then the 'Calendar' is visible
92
93=== added directory 'server-tests/features/step_definitions'
94=== added file 'server-tests/features/step_definitions/generic.js'
95--- server-tests/features/step_definitions/generic.js 1970-01-01 00:00:00 +0000
96+++ server-tests/features/step_definitions/generic.js 2014-09-19 11:39:09 +0000
97@@ -0,0 +1,97 @@
98+module.exports = function () {
99+
100+ this.World = require('../support/world.js');
101+ var PROPERTIES = require('../support/testproperties.json');
102+ var assert = require("assert");
103+
104+ /* "<Given> I visit <url>" */
105+ this.Given(/^I visit (.*)$/, function (url, callback) {
106+
107+ if (url == "the Xibo CMS") {
108+
109+ url = PROPERTIES.url;
110+ this
111+ .init()
112+ .url(url, callback);
113+
114+ return;
115+ }
116+ else if ("the schedule")
117+ url = PROPERTIES.url + "?p=schedule";
118+ else
119+ url = PROPERTIES.url + url;
120+
121+ this.url(url, callback);
122+ });
123+
124+ /* "<Given>I am logged in as a <usertype>" */
125+ this.Given(/^I am logged in as a (.*)$/, function (userType, callback) {
126+
127+ var username = "dan";
128+ var password = "dan";
129+
130+ this.waitFor("#login-form", 3000, function (err, found) {
131+
132+ if (!err) {
133+ this.setValue("#username", username);
134+ this.setValue("#password", password);
135+ this.click("#login-form button", callback);
136+ return;
137+ }
138+
139+ callback.fail(new Error('Login form was not found after 3s'));
140+ });
141+ });
142+
143+ /* "<When> I enter <text> into <inputId>" */
144+ this.When(/^I enter '(.*)' into '(.*)'$/, function (text, inputId, callback) {
145+
146+ inputId = '#' + inputId;
147+
148+ this.waitFor(inputId, 3000, function (err, found) {
149+
150+ if (!err) {
151+ this.setValue(inputId, text, callback);
152+ return;
153+ }
154+
155+ callback.fail(new Error('Element ' + inputId + ' was not found after 3s'));
156+ });
157+ });
158+
159+ /* "<When> I press the <id> link" */
160+ this.When(/^I press the '(.*)' link$/, function (link, callback) {
161+ this.click("=" + link, callback);
162+ });
163+
164+ /* "<When> I press the <id> button" */
165+ this.When(/^I press the '(.*)' button$/, function (link, callback) {
166+ this.click("#" + link, callback);
167+ });
168+
169+ this.When(/^the '(.*)' form is visible$/, function (link, callback) {
170+ this.isVisible("#" + link, callback);
171+ });
172+
173+ this.Then(/^the '(.*)' is visible$/, function (link, callback) {
174+ this.isVisible("#" + link, callback);
175+ });
176+
177+ /* "<Then>I should see the dialog titled <title>" */
178+ this.Then(/^I should see the dialog titled '(.*)'$/, function (title, callback) {
179+
180+ this.waitFor("h4.modal-title", 5000, function (err, found) {
181+
182+ if (!err) {
183+ this.getText("h4.modal-title", function (err, result) {
184+
185+ assert.equal(result, title, "Cannot find " + title + " form.");
186+ });
187+ this.call(callback);
188+ return;
189+ }
190+
191+ callback.fail(new Error('A form was not found after 3s'));
192+ });
193+ });
194+};
195\ No newline at end of file
196
197=== added file 'server-tests/features/step_definitions/login-admin-user.js'
198--- server-tests/features/step_definitions/login-admin-user.js 1970-01-01 00:00:00 +0000
199+++ server-tests/features/step_definitions/login-admin-user.js 2014-09-19 11:39:09 +0000
200@@ -0,0 +1,14 @@
201+module.exports = function () {
202+
203+ this.World = require('../support/world.js');
204+ var PROPERTIES = require('../support/testproperties.json');
205+ var assert = require("assert");
206+
207+ this.Then(/^I should see the dashboard$/, function (callback) {
208+ this.isVisible("li.sidebar-main", callback);
209+ });
210+
211+ this.When(/^I press the login button$/, function (link, callback) {
212+ this.click("#login-form button", callback);
213+ });
214+};
215\ No newline at end of file
216
217=== added directory 'server-tests/features/support'
218=== added file 'server-tests/features/support/teardown.js'
219--- server-tests/features/support/teardown.js 1970-01-01 00:00:00 +0000
220+++ server-tests/features/support/teardown.js 2014-09-19 11:39:09 +0000
221@@ -0,0 +1,9 @@
222+//module.exports = function () {
223+//
224+// this.After(function(callback) {
225+//
226+// this.end(callback);
227+//
228+// });
229+//
230+//};
231\ No newline at end of file
232
233=== added file 'server-tests/features/support/testproperties.json'
234--- server-tests/features/support/testproperties.json 1970-01-01 00:00:00 +0000
235+++ server-tests/features/support/testproperties.json 2014-09-19 11:39:09 +0000
236@@ -0,0 +1,9 @@
237+{
238+ "logLevel": "silent",
239+
240+ "host": "127.0.0.1",
241+
242+ "browser": "firefox",
243+
244+ "url": "http://172.28.128.4/index.php"
245+}
246\ No newline at end of file
247
248=== added file 'server-tests/features/support/world.js'
249--- server-tests/features/support/world.js 1970-01-01 00:00:00 +0000
250+++ server-tests/features/support/world.js 2014-09-19 11:39:09 +0000
251@@ -0,0 +1,37 @@
252+module.exports = function(callback) {
253+
254+ if ( callback ) {
255+
256+ // Get our test properties
257+ var PROPERTIES = require('./testproperties.json');
258+
259+ // Override any testproperty from command line with --[PROPERTY]=[VALUE]
260+ process.argv.forEach(function (arg) {
261+ arg = arg.match(/^--([A-Za-z]+)=(.*)/);
262+
263+ // Only look for --[PROPERTY] style args, everything else can be forgotten
264+ if (arg === null || !arg[1]) return;
265+
266+ // If the JSON file has the argument to override, then override it.
267+ if (PROPERTIES.hasOwnProperty(arg[1])) {
268+ PROPERTIES[arg[1]] = arg[2];
269+
270+ // Otherwise proclaim that it is an unrecognised argument
271+ } else {
272+ console.log('Unrecognised argument ' + arg[1]);
273+ }
274+
275+ });
276+
277+ var browser = require("webdriverio").remote({
278+ logLevel: PROPERTIES.logLevel || 'none',
279+ host: PROPERTIES.host,
280+ desiredCapabilities: {
281+ browserName: PROPERTIES.browser || 'firefox'
282+ }
283+ });
284+
285+ // Inject the browser into the callback, we don't need anything else
286+ callback(browser);
287+ }
288+};
289\ No newline at end of file
290
291=== added file 'server-tests/package.json'
292--- server-tests/package.json 1970-01-01 00:00:00 +0000
293+++ server-tests/package.json 2014-09-19 11:39:09 +0000
294@@ -0,0 +1,16 @@
295+{
296+ "name": "xibo",
297+ "version": "1.7.0-alpha",
298+ "description": "Xibo Digital Signage - Test Suite",
299+ "main": "xibo",
300+ "scripts": {
301+ "test": "echo \"Error: no test specified\" && exit 1"
302+ },
303+ "dependencies":{
304+ "webdriverio":"*",
305+ "cucumber":"*",
306+ "selenium-standalone":"*"
307+ },
308+ "author": "Spring Signage Ltd and the Xibo Developers",
309+ "license": "AGPL-3.0"
310+}
311
312=== added file 'server-tests/readme.md'
313--- server-tests/readme.md 1970-01-01 00:00:00 +0000
314+++ server-tests/readme.md 2014-09-19 11:39:09 +0000
315@@ -0,0 +1,13 @@
316+Tests written in:
317+
318+Nodejs
319+
320+With:
321+
322+https://github.com/webdriverio/webdriverio
323+https://github.com/cucumber/cucumber/wiki
324+
325+
326+Run npm install
327+node_modules/.bin/start-selenium
328+node_modules/.bin/cucumber
329\ No newline at end of file
330
331=== modified file 'server/3rdparty/jquery-file-upload/UploadHandler.php'
332--- server/3rdparty/jquery-file-upload/UploadHandler.php 2013-11-02 15:32:17 +0000
333+++ server/3rdparty/jquery-file-upload/UploadHandler.php 2014-09-19 11:39:09 +0000
334@@ -36,10 +36,7 @@
335 'min_height' => 'Image requires a minimum height'
336 );
337
338- function __construct($db, $user, $options = null, $initialize = true, $error_messages = null) {
339- $this->db =& $db;
340- $this->user =& $user;
341-
342+ function __construct($options = null, $initialize = true, $error_messages = null) {
343 $this->options = array(
344 'script_url' => $this->get_full_url().'/',
345 'upload_dir' => dirname($this->get_server_var('SCRIPT_FILENAME')).'/files/',
346@@ -508,38 +505,6 @@
347 );
348 }
349
350- protected function handle_form_data($file, $index) {
351- // Handle form data, e.g. $_REQUEST['description'][$index]
352-
353- // Link the file to the module
354- $name = $_REQUEST['name'][$index];
355- $duration = $_REQUEST['duration'][$index];
356-
357- $layoutid = Kit::GetParam('layoutid', _REQUEST, _INT);
358- $regionid = Kit::GetParam('regionid', _REQUEST, _STRING);
359- $type = Kit::GetParam('type', _REQUEST, _WORD);
360-
361- Debug::LogEntry('audit', 'Upload complete for Type: ' . $type . ' and file name: ' . $file->name . '. Name: ' . $name . '. Duration:' . $duration);
362-
363- // We want to create a module for each of the uploaded files.
364- // Do not pass in the region ID so that we only assign to the library and not to the layout
365- require_once("modules/$type.module.php");
366- if (!$module = new $type($this->db, $this->user, '', $layoutid, '', '')) {
367- $file->error = $module->GetErrorMessage();
368- }
369-
370- // We want to add this item to our library
371- if (!$storedAs = $module->AddLibraryMedia($file->name, $name, $duration, $file->name)) {
372- $file->error = $module->GetErrorMessage();
373- }
374-
375- // Set new file details
376- $file->storedas = $storedAs;
377-
378- // Delete the file
379- @unlink($this->get_upload_path($file->name));
380- }
381-
382 protected function orient_image($file_path) {
383 if (!function_exists('exif_read_data')) {
384 return false;
385
386=== added file 'server/3rdparty/jquery-file-upload/XiboUploadHandler.php'
387--- server/3rdparty/jquery-file-upload/XiboUploadHandler.php 1970-01-01 00:00:00 +0000
388+++ server/3rdparty/jquery-file-upload/XiboUploadHandler.php 2014-09-19 11:39:09 +0000
389@@ -0,0 +1,38 @@
390+<?php
391+
392+require_once("3rdparty/jquery-file-upload/UploadHandler.php");
393+
394+class XiboUploadHandler extends UploadHandler {
395+
396+ protected function handle_form_data($file, $index) {
397+ // Handle form data, e.g. $_REQUEST['description'][$index]
398+
399+ // Link the file to the module
400+ $name = $_REQUEST['name'][$index];
401+ $duration = $_REQUEST['duration'][$index];
402+
403+ $layoutid = Kit::GetParam('layoutid', _REQUEST, _INT);
404+ $regionid = Kit::GetParam('regionid', _REQUEST, _STRING);
405+ $type = Kit::GetParam('type', _REQUEST, _WORD);
406+
407+ Debug::LogEntry('audit', 'Upload complete for Type: ' . $type . ' and file name: ' . $file->name . '. Name: ' . $name . '. Duration:' . $duration);
408+
409+ // We want to create a module for each of the uploaded files.
410+ // Do not pass in the region ID so that we only assign to the library and not to the layout
411+ require_once("modules/$type.module.php");
412+ if (!$module = new $type($this->options['db'], $this->options['user'], '', $layoutid, '', '')) {
413+ $file->error = $module->GetErrorMessage();
414+ }
415+
416+ // We want to add this item to our library
417+ if (!$storedAs = $module->AddLibraryMedia($file->name, $name, $duration, $file->name)) {
418+ $file->error = $module->GetErrorMessage();
419+ }
420+
421+ // Set new file details
422+ $file->storedas = $storedAs;
423+
424+ // Delete the file
425+ @unlink($this->get_upload_path($file->name));
426+ }
427+}
428\ No newline at end of file
429
430=== added file 'server/config/client.config.php'
431--- server/config/client.config.php 1970-01-01 00:00:00 +0000
432+++ server/config/client.config.php 2014-09-19 11:39:09 +0000
433@@ -0,0 +1,477 @@
434+<?php
435+/*
436+ * Xibo - Digital Signage - http://www.xibo.org.uk
437+ * Copyright (C) 2006-2014 Daniel Garner
438+ *
439+ * This file is part of Xibo.
440+ *
441+ * Xibo is free software: you can redistribute it and/or modify
442+ * it under the terms of the GNU Affero General Public License as published by
443+ * the Free Software Foundation, either version 3 of the License, or
444+ * any later version.
445+ *
446+ * Xibo is distributed in the hope that it will be useful,
447+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
448+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
449+ * GNU Affero General Public License for more details.
450+ *
451+ * You should have received a copy of the GNU Affero General Public License
452+ * along with Xibo. If not, see <http://www.gnu.org/licenses/>.
453+ */
454+defined('XIBO') or die("Sorry, you are not allowed to directly access this page.<br /> Please press the back button in your browser.");
455+
456+// Client config
457+$CLIENT_CONFIG = array(
458+
459+ 'windows' => array(
460+ 'synonym' => 'dotnetclient',
461+ 'tabs' => array(
462+ array('id' => 'general', 'name' => __('General')),
463+ array('id' => 'location', 'name' => __('Location')),
464+ array('id' => 'trouble', 'name' => __('Troubleshooting')),
465+ array('id' => 'advanced', 'name' => __('Advanced')),
466+ ),
467+ 'settings' => array(
468+ array(
469+ 'name' => 'CollectInterval',
470+ 'tabId' => 'general',
471+ 'title' => __('Collection Interval (seconds)'),
472+ 'type' => _INT,
473+ 'fieldType' => 'number',
474+ 'default' => 900,
475+ 'helpText' => __('The number of seconds between connections to the CMS.'),
476+ 'validation' => 'numeric',
477+ 'enabled' => true,
478+ 'groupClass' => NULL
479+ ),
480+ array(
481+ 'name' => 'PowerpointEnabled',
482+ 'tabId' => 'general',
483+ 'title' => __('Enable PowerPoint?'),
484+ 'type' => _CHECKBOX,
485+ 'fieldType' => 'checkbox',
486+ 'default' => false,
487+ 'helpText' => __('Should Microsoft PowerPoint be Enabled?'),
488+ 'enabled' => true,
489+ 'groupClass' => NULL
490+ ),
491+ array(
492+ 'name' => 'StatsEnabled',
493+ 'tabId' => 'general',
494+ 'title' => __('Enable stats reporting?'),
495+ 'type' => _CHECKBOX,
496+ 'fieldType' => 'checkbox',
497+ 'default' => true,
498+ 'helpText' => __('Should the application send proof of play stats to the CMS.'),
499+ 'enabled' => true,
500+ 'groupClass' => NULL
501+ ),
502+ array(
503+ 'name' => 'SizeX',
504+ 'tabId' => 'location',
505+ 'title' => __('Width'),
506+ 'type' => _DOUBLE,
507+ 'fieldType' => 'number',
508+ 'default' => '0',
509+ 'helpText' => __('The Width of the Display Window. 0 means full width.'),
510+ 'enabled' => true,
511+ 'groupClass' => NULL
512+ ),
513+ array(
514+ 'name' => 'SizeY',
515+ 'tabId' => 'location',
516+ 'title' => __('Height'),
517+ 'type' => _DOUBLE,
518+ 'fieldType' => 'number',
519+ 'default' => '0',
520+ 'helpText' => __('The Height of the Display Window. 0 means full height.'),
521+ 'enabled' => true,
522+ 'groupClass' => NULL
523+ ),
524+ array(
525+ 'name' => 'OffsetX',
526+ 'tabId' => 'location',
527+ 'title' => __('Left Coordinate'),
528+ 'type' => _DOUBLE,
529+ 'fieldType' => 'number',
530+ 'default' => '0',
531+ 'helpText' => __('The left pixel position the display window should be sized from.'),
532+ 'enabled' => true,
533+ 'groupClass' => NULL
534+ ),
535+ array(
536+ 'name' => 'OffsetY',
537+ 'tabId' => 'location',
538+ 'title' => __('Top Coordinate'),
539+ 'type' => _DOUBLE,
540+ 'fieldType' => 'number',
541+ 'default' => '0',
542+ 'helpText' => __('The top pixel position the display window should be sized from.'),
543+ 'enabled' => true,
544+ 'groupClass' => NULL
545+ ),
546+ array(
547+ 'name' => 'ShowInTaskbar',
548+ 'tabId' => 'advanced',
549+ 'title' => __('Show the icon in the task bar?'),
550+ 'type' => _CHECKBOX,
551+ 'fieldType' => 'checkbox',
552+ 'default' => true,
553+ 'helpText' => __('Should the application icon be shown in the task bar?'),
554+ 'enabled' => true,
555+ 'groupClass' => NULL
556+ ),
557+ array(
558+ 'name' => 'ClientInfomationCtrlKey',
559+ 'tabId' => 'trouble',
560+ 'title' => __('CTRL Key required to access Client Information Screen?'),
561+ 'type' => _CHECKBOX,
562+ 'fieldType' => 'checkbox',
563+ 'default' => false,
564+ 'helpText' => __('Should the client information screen require the CTRL key?'),
565+ 'enabled' => true,
566+ 'groupClass' => NULL
567+ ),
568+ array(
569+ 'name' => 'ClientInformationKeyCode',
570+ 'tabId' => 'trouble',
571+ 'title' => __('Key for Client Information Screen'),
572+ 'type' => _WORD,
573+ 'fieldType' => 'text',
574+ 'default' => 'I',
575+ 'helpText' => __('Which key should activate the client information screen? A single character.'),
576+ 'enabled' => true,
577+ 'groupClass' => NULL
578+ ),
579+ array(
580+ 'name' => 'CursorStartPosition',
581+ 'tabId' => 'advanced',
582+ 'title' => __('Cursor Start Position'),
583+ 'type' => _STRING,
584+ 'fieldType' => 'dropdown',
585+ 'options' => array(
586+ array('id' => 'Top Left', 'value' => 'Top Left'),
587+ array('id' => 'Top Right', 'value' => 'Top Right'),
588+ array('id' => 'Bottom Left', 'value' => 'Bottom Left'),
589+ array('id' => 'Bottom Right', 'value' => 'Bottom Right'),
590+ ),
591+ 'default' => 'Bottom Right',
592+ 'helpText' => __('The position of the cursor when the client starts up.'),
593+ 'enabled' => true,
594+ 'groupClass' => NULL
595+ ),
596+ array(
597+ 'name' => 'DoubleBuffering',
598+ 'tabId' => 'advanced',
599+ 'title' => __('Enable Double Buffering'),
600+ 'type' => _CHECKBOX,
601+ 'fieldType' => 'checkbox',
602+ 'default' => true,
603+ 'helpText' => __('Double buffering helps smooth the playback but should be disabled if graphics errors occur'),
604+ 'enabled' => true,
605+ 'groupClass' => NULL
606+ ),
607+ array(
608+ 'name' => 'EmptyLayoutDuration',
609+ 'tabId' => 'advanced',
610+ 'title' => __('Duration for Empty Layouts'),
611+ 'type' => _INT,
612+ 'fieldType' => 'text',
613+ 'default' => 10,
614+ 'helpText' => __('If an empty layout is detected how long should it remain on screen. Must be greater then 1.'),
615+ 'validation' => 'number',
616+ 'enabled' => true,
617+ 'groupClass' => NULL
618+ ),
619+ array(
620+ 'name' => 'EnableMouse',
621+ 'tabId' => 'advanced',
622+ 'title' => __('Enable Mouse'),
623+ 'type' => _CHECKBOX,
624+ 'fieldType' => 'checkbox',
625+ 'default' => true,
626+ 'helpText' => __('Enable the mouse.'),
627+ 'enabled' => true,
628+ 'groupClass' => NULL
629+ ),
630+ array(
631+ 'name' => 'EnableShellCommands',
632+ 'tabId' => 'advanced',
633+ 'title' => __('Enable Shell Commands'),
634+ 'type' => _CHECKBOX,
635+ 'fieldType' => 'checkbox',
636+ 'default' => true,
637+ 'helpText' => __('Enable the Shell Command module.'),
638+ 'enabled' => true,
639+ 'groupClass' => NULL
640+ ),
641+ array(
642+ 'name' => 'ExpireModifiedLayouts',
643+ 'tabId' => 'advanced',
644+ 'title' => __('Expire Modified Layouts'),
645+ 'type' => _CHECKBOX,
646+ 'fieldType' => 'checkbox',
647+ 'default' => true,
648+ 'helpText' => __('Expire Modified Layouts immediately on change. This means a layout can be cut during playback if it receives an update from the CMS'),
649+ 'enabled' => true,
650+ 'groupClass' => NULL
651+ ),
652+ array(
653+ 'name' => 'LogLevel',
654+ 'tabId' => 'trouble',
655+ 'title' => __('Log Level'),
656+ 'type' => _WORD,
657+ 'fieldType' => 'dropdown',
658+ 'options' => array(
659+ array('id' => 'audit', 'value' => 'Audit'),
660+ array('id' => 'info', 'value' => 'Information'),
661+ array('id' => 'error', 'value' => 'Error'),
662+ array('id' => 'off', 'value' => 'Off')
663+ ),
664+ 'default' => 'error',
665+ 'helpText' => __('The position of the cursor when the client starts up.'),
666+ 'enabled' => true,
667+ 'groupClass' => NULL
668+ ),
669+ array(
670+ 'name' => 'LogToDiskLocation',
671+ 'tabId' => 'trouble',
672+ 'title' => __('Log file path name.'),
673+ 'type' => _STRING,
674+ 'fieldType' => 'text',
675+ 'default' => '',
676+ 'helpText' => __('Create a log file on disk in this location. Please enter a fully qualified path.'),
677+ 'enabled' => true,
678+ 'groupClass' => NULL
679+ ),
680+ array(
681+ 'name' => 'MaxConcurrentDownloads',
682+ 'tabId' => 'advanced',
683+ 'title' => __('Maximum concurrent downloads'),
684+ 'type' => _INT,
685+ 'fieldType' => 'text',
686+ 'default' => '2',
687+ 'helpText' => __('The maximum number of concurrent downloads the client will attempt.'),
688+ 'enabled' => true,
689+ 'groupClass' => NULL
690+ ),
691+ array(
692+ 'name' => 'ShellCommandAllowList',
693+ 'tabId' => 'advanced',
694+ 'title' => __('Shell Command Allow List'),
695+ 'type' => _STRING,
696+ 'fieldType' => 'text',
697+ 'default' => '',
698+ 'helpText' => __('Which shell commands should the client execute?'),
699+ 'enabled' => true,
700+ 'groupClass' => NULL
701+ ),
702+ array(
703+ 'name' => 'UseCefWebBrowser',
704+ 'tabId' => 'advanced',
705+ 'title' => __('Use CEF as the Web Browser'),
706+ 'type' => _CHECKBOX,
707+ 'fieldType' => 'checkbox',
708+ 'default' => 1,
709+ 'helpText' => __('CEF is Chrome Embedded and offers up to date web rendering. If unselected the default Internet Explorer control will be used.'),
710+ 'enabled' => true,
711+ 'groupClass' => NULL
712+ ),
713+ array(
714+ 'name' => 'SendCurrentLayoutAsStatusUpdate',
715+ 'tabId' => 'advanced',
716+ 'title' => __('Notify current layout'),
717+ 'type' => _CHECKBOX,
718+ 'fieldType' => 'checkbox',
719+ 'default' => 0,
720+ 'helpText' => __('When enabled the client will send the current layout to the CMS each time it changes. Warning: This is bandwidth intensive and should be disabled unless on a LAN.'),
721+ 'enabled' => true,
722+ 'groupClass' => NULL
723+ ),
724+ array(
725+ 'name' => 'ScreenShotRequestInterval',
726+ 'tabId' => 'advanced',
727+ 'title' => __('Screen shot interval'),
728+ 'type' => _INT,
729+ 'fieldType' => 'number',
730+ 'default' => 0,
731+ 'helpText' => __('The duration between status screen shots in minutes. 0 to disable. Warning: This is bandwidth intensive.'),
732+ 'enabled' => true,
733+ 'groupClass' => NULL
734+ )
735+ )
736+ ),
737+
738+ /*'ubuntu' => array(
739+ 'synonym' => 'python',
740+ 'settings' => array(
741+
742+ )
743+ ),*/
744+
745+ 'android' => array(
746+ 'synonym' => 'xiboforandroid',
747+ 'tabs' => array(
748+ array('id' => 'general', 'name' => __('General')),
749+ array('id' => 'location', 'name' => __('Location')),
750+ array('id' => 'trouble', 'name' => __('Troubleshooting')),
751+ array('id' => 'advanced', 'name' => __('Advanced')),
752+ ),
753+ 'settings' => array(
754+ array(
755+ 'name' => 'emailAddress',
756+ 'tabId' => 'general',
757+ 'title' => __('Email Address'),
758+ 'type' => _STRING,
759+ 'fieldType' => 'text',
760+ 'default' => '',
761+ 'helpText' => __('The email address will be used to license this client. This is the email address you provided when you purchased the licence.'),
762+ 'enabled' => true,
763+ 'groupClass' => NULL
764+ ),
765+ array(
766+ 'name' => 'settingsPassword',
767+ 'tabId' => 'general',
768+ 'title' => __('Password Protect Settings'),
769+ 'type' => _STRING,
770+ 'fieldType' => 'text',
771+ 'default' => '',
772+ 'helpText' => __('Provide a Password which will be required to access settings'),
773+ 'enabled' => true,
774+ 'groupClass' => NULL
775+ ),
776+ array(
777+ 'name' => 'collectInterval',
778+ 'tabId' => 'general',
779+ 'title' => __('Collect interval'),
780+ 'type' => _INT,
781+ 'fieldType' => 'dropdown',
782+ 'options' => array(
783+ array('id' => 60, 'value' => __('1 minute')),
784+ array('id' => 300, 'value' => __('5 minutes')),
785+ array('id' => 600, 'value' => __('10 minutes')),
786+ array('id' => 1800, 'value' => __('30 minutes')),
787+ array('id' => 3600, 'value' => __('1 hour')),
788+ array('id' => 14400, 'value' => __('4 hours')),
789+ array('id' => 43200, 'value' => __('12 hours'))
790+ ),
791+ 'default' => 900,
792+ 'helpText' => __('How often should the Player check for new content.'),
793+ 'validation' => 'numeric',
794+ 'enabled' => true,
795+ 'groupClass' => NULL
796+ ),
797+ array(
798+ 'name' => 'orientation',
799+ 'tabId' => 'location',
800+ 'title' => __('Orientation'),
801+ 'type' => _INT,
802+ 'fieldType' => 'dropdown',
803+ 'options' => array(
804+ array('id' => 0, 'value' => __('Landscape')),
805+ array('id' => 1, 'value' => __('Portrait')),
806+ array('id' => 8, 'value' => __('Reverse Landscape')),
807+ array('id' => 9, 'value' => __('Reverse Portrait'))
808+ ),
809+ 'default' => 0,
810+ 'helpText' => __('Set the orientation of the device (portrait mode will only work if supported by the hardware) Application Restart Required.'),
811+ 'enabled' => true,
812+ 'groupClass' => NULL
813+ ),
814+ array(
815+ 'name' => 'startOnBoot',
816+ 'tabId' => 'advanced',
817+ 'title' => __('Start during device start up?'),
818+ 'type' => _CHECKBOX,
819+ 'fieldType' => 'checkbox',
820+ 'default' => true,
821+ 'helpText' => __('When the device starts and Android finishes loading, should the client start up and come to the foreground?'),
822+ 'enabled' => true,
823+ 'groupClass' => NULL
824+ ),
825+ array(
826+ 'name' => 'actionBarMode',
827+ 'tabId' => 'advanced',
828+ 'title' => __('Action Bar Mode'),
829+ 'type' => _INT,
830+ 'fieldType' => 'dropdown',
831+ 'options' => array(
832+ array('id' => 0, 'value' => 'Hide'),
833+ array('id' => 1, 'value' => 'Timed')
834+ ),
835+ 'default' => 1,
836+ 'helpText' => __('How should the action bar behave?'),
837+ 'enabled' => true,
838+ 'groupClass' => NULL
839+ ),
840+ array(
841+ 'name' => 'actionBarDisplayDuration',
842+ 'tabId' => 'advanced',
843+ 'title' => __('Action Bar Display Duration'),
844+ 'type' => _INT,
845+ 'fieldType' => 'text',
846+ 'default' => 30,
847+ 'helpText' => __('How long should the Action Bar be shown for, in seconds?'),
848+ 'validation' => 'numeric',
849+ 'enabled' => true,
850+ 'groupClass' => NULL
851+ ),
852+ array(
853+ 'name' => 'screenDimensions',
854+ 'tabId' => 'location',
855+ 'title' => __('Screen Dimensions'),
856+ 'type' => _STRING,
857+ 'fieldType' => 'text',
858+ 'default' => '',
859+ 'helpText' => __('Override the screen dimensions (left,top,width,height). Requires restart. Care should be taken to ensure these are within the actual screen size.'),
860+ 'enabled' => true,
861+ 'groupClass' => NULL
862+ ),
863+ array(
864+ 'name' => 'autoRestart',
865+ 'tabId' => 'advanced',
866+ 'title' => __('Automatic Restart'),
867+ 'type' => _CHECKBOX,
868+ 'fieldType' => 'checkbox',
869+ 'default' => true,
870+ 'helpText' => __('Automatically Restart the application if we detect it is not visible.'),
871+ 'enabled' => true,
872+ 'groupClass' => NULL
873+ ),
874+ array(
875+ 'name' => 'startOnBootDelay',
876+ 'tabId' => 'advanced',
877+ 'title' => __('Start delay for device start up'),
878+ 'type' => _INT,
879+ 'fieldType' => 'text',
880+ 'default' => 60,
881+ 'helpText' => __('The number of seconds to wait before starting the application after the device has started. Minimum 10.'),
882+ 'validation' => 'numeric',
883+ 'enabled' => true,
884+ 'groupClass' => NULL
885+ ),
886+ array(
887+ 'name' => 'blacklistVideo',
888+ 'tabId' => 'trouble',
889+ 'title' => __('Blacklist Videos?'),
890+ 'type' => _CHECKBOX,
891+ 'fieldType' => 'checkbox',
892+ 'default' => true,
893+ 'helpText' => __('Should Videos we fail to play be blacklisted and no longer attempted?'),
894+ 'enabled' => true,
895+ 'groupClass' => NULL
896+ ),
897+ array(
898+ 'name' => 'storeHtmlOnInternal',
899+ 'tabId' => 'trouble',
900+ 'title' => __('Store HTML resources on the Internal Storage?'),
901+ 'type' => _CHECKBOX,
902+ 'fieldType' => 'checkbox',
903+ 'default' => false,
904+ 'helpText' => __('Store all HTML resources on the Internal Storage? Should be selected if the device cannot display text, ticker, dataset media.'),
905+ 'enabled' => true,
906+ 'groupClass' => NULL
907+ )
908+ )
909+ )
910+ );
911
912=== modified file 'server/config/config.class.php'
913--- server/config/config.class.php 2014-07-17 09:35:07 +0000
914+++ server/config/config.class.php 2014-09-19 11:39:09 +0000
915@@ -77,6 +77,42 @@
916 return false;
917 }
918 }
919+
920+ static function GetAll($sort_order = array('cat', 'ordering'), $filter_by = array()) {
921+
922+ if ($sort_order == NULL)
923+ $sort_order = array('cat', 'ordering');
924+
925+ try {
926+ $dbh = PDOConnect::init();
927+
928+ $SQL = 'SELECT * FROM setting WHERE 1 = 1 ';
929+ $params = array();
930+
931+ if (Kit::GetParam('userChange', $filter_by, _INT, -1) != -1) {
932+ $SQL .= ' AND userChange = :userChange ';
933+ $params['userChange'] = Kit::GetParam('userChange', $filter_by, _INT);
934+ }
935+
936+ if (Kit::GetParam('userSee', $filter_by, _INT, -1) != -1) {
937+ $SQL .= ' AND userSee = :userSee ';
938+ $params['userSee'] = Kit::GetParam('userSee', $filter_by, _INT);
939+ }
940+
941+ // Sorting?
942+ if (is_array($sort_order))
943+ $SQL .= 'ORDER BY ' . implode(',', $sort_order);
944+
945+ $sth = $dbh->prepare($SQL);
946+ $sth->execute($params);
947+
948+ return $sth->fetchAll();
949+ }
950+ catch (Exception $e) {
951+ trigger_error($e->getMessage());
952+ return false;
953+ }
954+ }
955
956 /**
957 * Defines the Version and returns it
958@@ -116,311 +152,365 @@
959 }
960
961 /**
962- * Checks the Environment and Determines if it is suitable for Xibo
963+ * Checks the Environment and Determines if it is suitable
964 * @return
965 */
966 public function CheckEnvironment()
967 {
968- $output = '';
969- $imgGood = '<img src="install/dot_green.gif"> ';
970- $imgBad = '<img src="install/dot_red.gif"> ';
971- $imgWarn = '<img src="install/dot_amber.gif"> ';
972-
973- $output .= '<div class="checks">';
974-
975+ $cols = array(
976+ array('name' => 'item', 'title' => __('Item')),
977+ array('name' => 'status', 'title' => __('Status'), 'icons' => true),
978+ array('name' => 'advice', 'title' => __('Advice'))
979+ );
980+ Theme::Set('table_cols', $cols);
981+
982+ $rows = array();
983+
984 // Check for PHP version
985- $message = __('PHP Version');
986-
987+ $advice = sprintf(__("PHP version %s or later required."), Config::$VERSION_REQUIRED) . ' Detected ' . phpversion();
988 if ($this->CheckPHP())
989 {
990- $output .= $imgGood.$message.'<br />';
991+ $status = 1;
992 }
993 else
994 {
995 $this->envFault = true;
996-
997- $output .= $imgBad.$message.'<br />';
998- $output .= '<div class="check_explain"> <p>' . sprintf(__("PHP version %s or later required."), Config::$VERSION_REQUIRED) . '. Detected ' . phpversion() . '</p></div>';
999+ $status = 0;
1000 }
1001+
1002+ $rows[] = array(
1003+ 'item' => __('PHP Version'),
1004+ 'status' => $status,
1005+ 'advice' => $advice
1006+ );
1007
1008 // Check for file system permissions
1009- $message = __('Filesystem Permissions');
1010-
1011+ $advice = __("Write access required for settings.php, install.php and upgrade.php");
1012 if ($this->CheckFsPermissions())
1013 {
1014- $output .= $imgGood.$message.'<br />';
1015+ $status = 1;
1016 }
1017 else
1018 {
1019 $this->envFault = true;
1020
1021- $output .= $imgBad.$message.'<br />';
1022- $output .= '<div class="check_explain"><p>' . __("Write access required for the following:");
1023- $output .= <<<END
1024- <ul>
1025- <li> settings.php
1026- <li> install.php
1027- <li> upgrade.php
1028- </ul>
1029-END;
1030- $output .= __('Please fix this, and retest.') . '</p></div>';
1031+ $status = 0;
1032 }
1033+
1034+ $rows[] = array(
1035+ 'item' => __('File System Permissions'),
1036+ 'status' => $status,
1037+ 'advice' => $advice
1038+ );
1039
1040 // Check for MySQL
1041- $message = __('MySQL database (PHP MySql)');
1042-
1043+ $advice = __('MySQL support must be enabled in PHP.');
1044 if ($this->CheckMySQL())
1045 {
1046- $output .= $imgGood.$message.'<br />';
1047+ $status = 1;
1048 }
1049 else
1050 {
1051 $this->envFault = true;
1052
1053- $output .= $imgBad.$message.'<br />';
1054- $output .= <<<END
1055- <div class="check_explain">
1056- <p>Xibo requires the PHP MySQL Extension to function.</p>
1057- </div>
1058-END;
1059+ $status = 0;
1060 }
1061
1062+ $rows[] = array(
1063+ 'item' => __('MySQL database (PHP MySql)'),
1064+ 'status' => $status,
1065+ 'advice' => $advice
1066+ );
1067+
1068 // Check for PDO
1069- $message = __('MySQL database (PDO MySql)');
1070-
1071+ $advice = __('PDO support with MySQL drivers must be enabled in PHP.');
1072 if ($this->CheckPDO())
1073 {
1074- $output .= $imgGood.$message.'<br />';
1075+ $status = 1;
1076 }
1077 else
1078 {
1079 $this->envFault = true;
1080
1081- $output .= $imgBad.$message.'<br />';
1082- $output .= <<<END
1083- <div class="check_explain">
1084- <p>Xibo requires the PHP PDO Extension to function.</p>
1085- </div>
1086-END;
1087+ $status = 0;
1088 }
1089+
1090+ $rows[] = array(
1091+ 'item' => __('MySQL database (PDO MySql)'),
1092+ 'status' => $status,
1093+ 'advice' => $advice
1094+ );
1095
1096 // Check for JSON
1097- $message = __('JSON Extension');
1098-
1099+ $advice = __('PHP JSON extension required to function.');
1100 if ($this->CheckJson())
1101 {
1102- $output .= $imgGood.$message.'<br />';
1103+ $status = 1;
1104 }
1105 else
1106 {
1107 $this->envFault = true;
1108
1109- $output .= $imgBad.$message.'<br />';
1110- $output .= '<div class="check_explain"><p>' . __('PHP JSON extension required to function.') . '</p></div>';
1111+ $status = 0;
1112 }
1113
1114- // Check for SOAP
1115- $message = __('SOAP Extension');
1116+ $rows[] = array(
1117+ 'item' => __('JSON Extension'),
1118+ 'status' => $status,
1119+ 'advice' => $advice
1120+ );
1121
1122+ // Check for SOAP
1123+ $advice = __('PHP SOAP extension required to function.');
1124 if ($this->CheckSoap())
1125 {
1126- $output .= $imgGood.$message.'<br />';
1127+ $status = 1;
1128 }
1129 else
1130 {
1131 $this->envFault = true;
1132
1133- $output .= $imgBad.$message.'<br />';
1134- $output .= '<div class="check_explain"><p>' . __('PHP SOAP extension required to function.') . '</p></div>';
1135+ $status = 0;
1136 }
1137+
1138+ $rows[] = array(
1139+ 'item' => __('SOAP Extension'),
1140+ 'status' => $status,
1141+ 'advice' => $advice
1142+ );
1143
1144 // Check for GD (graphics)
1145- $message = __('GD Extension');
1146-
1147+ $advice = __('PHP GD extension to function.');
1148 if ($this->CheckGd())
1149 {
1150- $output .= $imgGood.$message.'<br />';
1151+ $status = 1;
1152 }
1153 else
1154 {
1155 $this->envFault = true;
1156
1157- $output .= $imgBad.$message.'<br />';
1158- $output .= '<div class="check_explain"><p>' . __('PHP GD extension to function.') . '</p></div>';
1159+ $status = 0;
1160 }
1161
1162+ $rows[] = array(
1163+ 'item' => __('GD Extension'),
1164+ 'status' => $status,
1165+ 'advice' => $advice
1166+ );
1167+
1168 // Check for PHP Session
1169- $message = __('Session');
1170-
1171+ $advice = __('PHP session support to function.');
1172 if ($this->CheckSession())
1173 {
1174- $output .= $imgGood.$message.'<br />';
1175+ $status = 1;
1176 }
1177 else
1178 {
1179 $this->envFault = true;
1180
1181- $output .= $imgBad.$message.'<br />';
1182- $output .= '<div class="check_explain"><p>' . __('PHP session support to function.') . '</p></div>';
1183+ $status = 0;
1184 }
1185
1186+ $rows[] = array(
1187+ 'item' => __('Session'),
1188+ 'status' => $status,
1189+ 'advice' => $advice
1190+ );
1191+
1192 // Check for PHP FileInfo
1193- $message = __('FileInfo');
1194-
1195+ $advice = __('Requires PHP FileInfo support to function. If you are on Windows you need to enable the php_fileinfo.dll in your php.ini file.');
1196 if ($this->CheckFileInfo())
1197 {
1198- $output .= $imgGood.$message.'<br />';
1199+ $status = 1;
1200 }
1201 else
1202 {
1203 $this->envFault = true;
1204
1205- $output .= $imgBad.$message.'<br />';
1206- $output .= '<div class="check_explain"><p>' . __('Requires PHP FileInfo support to function. If you are on Windows you need to enable the php_fileinfo.dll in your php.ini file.') . '</p></div>';
1207+ $status = 0;
1208 }
1209+
1210+ $rows[] = array(
1211+ 'item' => __('FileInfo'),
1212+ 'status' => $status,
1213+ 'advice' => $advice
1214+ );
1215
1216 // Check for PHP PCRE
1217- $message = __('PCRE');
1218-
1219+ $advice = __('PHP PCRE support to function.');
1220 if ($this->CheckPCRE())
1221 {
1222- $output .= $imgGood.$message.'<br />';
1223+ $status = 1;
1224 }
1225 else
1226 {
1227 $this->envFault = true;
1228
1229- $output .= $imgBad.$message.'<br />';
1230- $output .= '<div class="check_explain"><p>' . __('PHP PCRE support to function.') . '</p></div>';
1231+ $status = 0;
1232 }
1233+
1234+ $rows[] = array(
1235+ 'item' => __('PCRE'),
1236+ 'status' => $status,
1237+ 'advice' => $advice
1238+ );
1239
1240 // Check for PHP Gettext
1241- $message = __('Gettext');
1242-
1243- /**
1244- * we now use PHP-Gettext which is shipped.
1245- */
1246+ $advice = __('PHP Gettext support to function.');
1247 if ($this->CheckGettext())
1248 {
1249- $output .= $imgGood.$message.'<br />';
1250+ $status = 1;
1251 }
1252 else
1253 {
1254 $this->envFault = true;
1255
1256- $output .= $imgBad.$message.'<br />';
1257- $output .= '<div class="check_explain"><p>' . __('PHP Gettext support to function.') . '</p></div>';
1258+ $status = 0;
1259 }
1260+
1261+ $rows[] = array(
1262+ 'item' => __('Gettext'),
1263+ 'status' => $status,
1264+ 'advice' => $advice
1265+ );
1266
1267 // Check for Calendar
1268- $message = __('Calendar Extension');
1269-
1270+ $advice = __('PHP Calendar extension to function.');
1271 if ($this->CheckCal())
1272 {
1273- $output .= $imgGood.$message.'<br />';
1274+ $status = 1;
1275 }
1276 else
1277 {
1278 $this->envFault = true;
1279
1280- $output .= $imgBad.$message.'<br />';
1281- $output .= '<div class="check_explain"><p>' . __('PHP Calendar extension to function.') . '</p></div>';
1282+ $status = 0;
1283 }
1284+
1285+ $rows[] = array(
1286+ 'item' => __('Calendar Extension'),
1287+ 'status' => $status,
1288+ 'advice' => $advice
1289+ );
1290
1291 // Check for DOM
1292- $message = __('DOM Extension');
1293-
1294+ $advice = __('PHP DOM core functionality enabled.');
1295 if ($this->CheckDom())
1296 {
1297- $output .= $imgGood.$message.'<br />';
1298+ $status = 1;
1299 }
1300 else
1301 {
1302 $this->envFault = true;
1303
1304- $output .= $imgBad.$message.'<br />';
1305- $output .= '<div class="check_explain"><p>' . __('PHP DOM core functionality enabled.') . '</p></div>';
1306+ $status = 0;
1307 }
1308+
1309+ $rows[] = array(
1310+ 'item' => __('DOM Extension'),
1311+ 'status' => $status,
1312+ 'advice' => $advice
1313+ );
1314
1315 // Check for DOM XML
1316- $message = __('DOM XML Extension');
1317-
1318+ $advice = __('PHP DOM XML extension to function.');
1319 if ($this->CheckDomXml())
1320 {
1321- $output .= $imgGood.$message.'<br />';
1322+ $status = 1;
1323 }
1324 else
1325 {
1326 $this->envFault = true;
1327
1328- $output .= $imgBad.$message.'<br />';
1329- $output .= '<div class="check_explain"><p>' . __('PHP DOM XML extension to function.') . '</p></div>';
1330+ $status = 0;
1331 }
1332+
1333+ $rows[] = array(
1334+ 'item' => __('DOM XML Extension'),
1335+ 'status' => $status,
1336+ 'advice' => $advice
1337+ );
1338
1339 // Check for Mcrypt
1340- $message = __('Mcrypt Extension');
1341-
1342+ $advice = __('PHP Mcrypt extension to function.');
1343 if ($this->CheckMcrypt())
1344 {
1345- $output .= $imgGood.$message.'<br />';
1346+ $status = 1;
1347 }
1348 else
1349 {
1350 $this->envFault = true;
1351
1352- $output .= $imgBad.$message.'<br />';
1353- $output .= '<div class="check_explain"><p>' . __('PHP Mcrypt extension to function.') . '</p></div>';
1354+ $status = 0;
1355 }
1356+
1357+ $rows[] = array(
1358+ 'item' => __('Mcrypt Extension'),
1359+ 'status' => $status,
1360+ 'advice' => $advice
1361+ );
1362
1363- // Check to see if we are allowed to open remote URLs (homecall will not work otherwise)
1364- $message = __('Allow PHP to open external URLs');
1365-
1366+ // Check to see if we are allowed to open remote URLs (home call will not work otherwise)
1367+ $advice = __('You must have allow_url_fopen = On in your PHP.ini file for RSS Feeds / Anonymous statistics gathering to function.');
1368 if (ini_get('allow_url_fopen'))
1369 {
1370- $output .= $imgGood.$message.'<br />';
1371+ $status = 1;
1372 }
1373 else
1374 {
1375- // Not a fault as this will not block installation/upgrade. Informational.
1376+ // Not a fault as this will not block installation / upgrade. Informational.
1377 $this->envWarning = true;
1378- $output .= $imgWarn.$message.'<br />';
1379- $output .= '<div class="check_explain"><p>' . __('You must have allow_url_fopen = On in your PHP.ini file for anonymous statistics gathering to function.') . '<br />';
1380- $output .= __('If you do not intend to enable anonymous statistics gathering you need not worry about this problem.') . '</p></div>';
1381+ $status = 2;
1382 }
1383
1384+ $rows[] = array(
1385+ 'item' => __('Allow PHP to open external URLs'),
1386+ 'status' => $status,
1387+ 'advice' => $advice
1388+ );
1389+
1390 // Check to see if timezone_identifiers_list exists
1391- $message = 'DateTimeZone';
1392-
1393+ $advice = __('This enables us to get a list of time zones supported by the hosting server.');
1394 if (function_exists('timezone_identifiers_list'))
1395 {
1396- $output .= $imgGood.$message.'<br />';
1397+ $status = 1;
1398 }
1399 else
1400 {
1401 $this->envWarning = true;
1402
1403- $output .= $imgWarn.$message.'<br />';
1404 }
1405+
1406+ $rows[] = array(
1407+ 'item' => __('DateTimeZone'),
1408+ 'status' => $status,
1409+ 'advice' => $advice
1410+ );
1411
1412 // Check to see if large file uploads enabled
1413- $message = 'Large File Uploads';
1414-
1415+ $advice = __('Support for uploading large files is recommended.');
1416 if ($this->CheckPHPUploads())
1417 {
1418- $output .= $imgGood.$message.'<br />';
1419+ $status = 1;
1420 }
1421 else
1422 {
1423 $this->envWarning = true;
1424- $output .= $imgWarn.$message.'<br />';
1425- $output .= '<div class="check_explain"><p>' . __('You probably want to allow larger files to be uploaded than is currently available with your PHP configuration.') . '<br />';
1426- $output .= __('We suggest setting your PHP post_max_size and upload_max_size to at least 128M, and also increasing your max_execution_time to at least 120 seconds.') . '</p></div>';
1427+ $status = 2;
1428+ $advice = __('You probably want to allow larger files to be uploaded than is currently available with your PHP configuration.') . '<br />';
1429+ $advice .= __('We suggest setting your PHP post_max_size and upload_max_size to at least 128M, and also increasing your max_execution_time to at least 120 seconds.');
1430 }
1431-
1432- $output .= '</div>';
1433+
1434+ $rows[] = array(
1435+ 'item' => __('Large File Uploads'),
1436+ 'status' => $status,
1437+ 'advice' => $advice
1438+ );
1439
1440 $this->envTested = true;
1441- return $output;
1442+
1443+ Theme::Set('table_rows', $rows);
1444+ return Theme::RenderReturn('table_render');
1445 }
1446
1447 /**
1448@@ -582,6 +672,10 @@
1449 {
1450 return extension_loaded("fileinfo");
1451 }
1452+
1453+ function CheckZip() {
1454+ return extension_loaded('zip');
1455+ }
1456
1457 /**
1458 * Check PHP is setup for large file uploads
1459
1460=== modified file 'server/install.php'
1461--- server/install.php 2014-09-18 17:14:29 +0000
1462+++ server/install.php 2014-09-19 11:39:09 +0000
1463@@ -1,7 +1,7 @@
1464 <?php
1465 /*
1466 * Xibo - Digital Signage - http://www.xibo.org.uk
1467- * Copyright (C) 2009-2013 Alex Harrington
1468+ * Copyright (C) 2009-2014 Alex Harrington and Daniel Garner
1469 *
1470 * This file is part of Xibo.
1471 *
1472@@ -19,726 +19,124 @@
1473 * along with Xibo. If not, see <http://www.gnu.org/licenses/>.
1474 */
1475 DEFINE('XIBO', true);
1476+DEFINE('MAX_EXECUTION', true);
1477
1478 error_reporting(0);
1479 ini_set('display_errors', 0);
1480
1481-include('lib/app/kit.class.php');
1482-include('install/header.inc');
1483-include('config/config.class.php');
1484-include('config/db_config.php');
1485-
1486-$config = new Config();
1487-
1488-if (!$config->CheckPHP()) {
1489- die(sprintf('Xibo required PHP version %s.', Config::$VERSION_REQUIRED));
1490-}
1491-
1492-// Setup for the Translations using Gettext.
1493-// There is normally a class that will do this for us - but it requires a DB object (which we do not have at install time)
1494-// Would be nice to include a method on the TranslationEngine that did this for us - but without the debugging
1495-// The actual translation function __() is included later in this file.
1496-$langs = Kit::GetParam('HTTP_ACCEPT_LANGUAGE', $_SERVER, _STRING);
1497-$lang = 'en-gb'; // Default language
1498-$encoding = ''; // We do not seem to need an encoding, but I read somewhere that we might - left as a reminder of this.
1499-
1500-if ($langs != '')
1501-{
1502- $langs = explode(',', $langs);
1503- $lang = $langs[0];
1504-}
1505-
1506-// For windows
1507-putenv('LANG='.$lang.'.'.$encoding);
1508-putenv('LANGUAGE='.$lang.'.'.$encoding);
1509-putenv('LC_ALL='.$lang.'.'.$encoding);
1510-
1511-// Set local
1512-setlocale(LC_ALL, $lang.'.'.$encoding);
1513-
1514-// Translations have been setup.
1515-
1516-$fault = false;
1517-
1518-$xibo_step = Kit::GetParam('xibo_step',_POST,_INT,'0');
1519-
1520-if (!isset($xibo_step) || $xibo_step == 0) {
1521- # First step of the process.
1522- # Show a welcome screen and next button
1523- ?>
1524- <?php echo __("Welcome to the Xibo Installer!"); ?><br /><br />
1525- <?php echo __("The installer will take you through setting up Xibo one step at a time."); ?><br /><br />
1526- <?php echo __("Lets get started!"); ?><br /><br />
1527- <form action="install.php" method="POST">
1528- <input type="hidden" name="xibo_step" value="1" />
1529- <div class="loginbutton"><button type="submit"><?php echo __("Next"); ?> ></button></div>
1530- </form>
1531- <?php
1532-}
1533-elseif ($xibo_step == 1) {
1534- # Check environment
1535- $db = new Database();
1536- $cObj = new Config();
1537- ?>
1538- <p><?php echo __("First we need to check if your server meets Xibo's requirements."); ?></p>
1539- <div class="checks">
1540- <?php
1541- echo $cObj->CheckEnvironment();
1542- if ($cObj->EnvironmentFault()) {
1543- ?>
1544- <form action="install.php" method="POST">
1545- <input type="hidden" name="xibo_step" value="1" />
1546- <div class="loginbutton"><button type="submit"><?php echo __("Retest"); ?></button></div>
1547- </form>
1548- <?php
1549- }
1550- else if ($cObj->EnvironmentWarning()) {
1551- ?>
1552- <form action="install.php" method="POST">
1553- <input type="hidden" name="xibo_step" value="1" />
1554- <div class="loginbutton"><button type="submit"><?php echo __("Retest"); ?></button></div>
1555- </form>
1556- <form action="install.php" method="POST">
1557- <input type="hidden" name="xibo_step" value="2" />
1558- <div class="loginbutton"><button type="submit"><?php echo __("Next"); ?> ></button></div>
1559- </form>
1560- <?php
1561- }
1562- else {
1563- ?>
1564- <form action="install.php" method="POST">
1565- <input type="hidden" name="xibo_step" value="2" />
1566- <div class="loginbutton"><button type="submit"><?php echo __("Next"); ?> ></button></div>
1567- </form>
1568- <?php
1569- }
1570-}
1571-elseif ($xibo_step == 2) {
1572-# Create database
1573-## Does database exist already?
1574-
1575- ?>
1576- <div class="info">
1577- <p><?php echo __("Xibo needs to setup a new database."); ?></p>
1578- <p><?php echo __("If you have not yet created an empty database and database user for Xibo to use, and know the username/password of a MySQL administrator, click the \"Create New\" button, otherwise click \"Use Existing\"."); ?></p>
1579- <p><i><?php echo __("Note that any existing database must be empty"); ?></i></p>
1580- </div>
1581- <form action="install.php" method="POST">
1582- <input type="hidden" name="xibo_step" value="3" />
1583- <button type="submit"><?php echo __("Create New"); ?></button>
1584- </form>
1585- <form action="install.php" method="POST">
1586- <input type="hidden" name="xibo_step" value="4" />
1587- <button type="submit"><?php echo __("Use Existing"); ?></button>
1588- </form>
1589- <?php
1590-}
1591-elseif ($xibo_step == 3) {
1592-## If not, gather admin password and use to create empty db and new user.
1593-?>
1594-<div class="info">
1595-<p><?php echo __("Since no empty database has been created for Xibo to use, we need the username and password of a MySQL administrator to create a new database, and database user for Xibo."); ?></p>
1596-<p><?php echo __("Additionally, please give us a new username and password to create in MySQL for Xibo to use. Xibo will create this automatically for you."); ?></p>
1597-<form action="install.php" method="POST">
1598-<input type="hidden" name="xibo_step" value="5" />
1599-<input type="hidden" name="db_create" value="On" />
1600-<div class="install_table">
1601- <p><label for="host"><?php echo __("Host:"); ?>&nbsp;</label><input class="username" type="text" id="host" name="host" size="12" value="localhost" /></p>
1602- <p><label for="admin_username"><?php echo __("Admin Username:"); ?>&nbsp;</label><input class="username" type="text" id="admin_username" name="admin_username" size="12" /></p>
1603- <p><label for="admin_password"><?php echo __("Admin Password:"); ?>&nbsp;</label><input class="username" type="password" id="admin_password" name="admin_password" size="12" /></p>
1604- <p><label for="db_name"><?php echo __("Xibo Database Name:"); ?>&nbsp;</label><input class="username" type="text" id="db_name" name="db_name" size="12" value="xibo" /></p>
1605- <p><label for="db_username"><?php echo __("Xibo Database Username:"); ?>&nbsp;</label><input class="username" type="text" id="db_username" name="db_username" size="12" value="xibo" /></p>
1606- <p><label for="db_password"><?php echo __("Xibo Database Password:"); ?>&nbsp;</label><input class="username" type="password" id="db_password" name="db_password" size="12" /></p>
1607-</div>
1608-</div>
1609-<button type="submit"><?php echo __("Create"); ?></button>
1610-</form>
1611-<?php
1612-}
1613-elseif ($xibo_step == 4) {
1614-## Get details of db that's been created already for us
1615-?>
1616-<div class="info">
1617-<p><?php echo __("Please enter the details of the database and user you have created for Xibo."); ?></p>
1618-<form action="install.php" method="POST">
1619-<input type="hidden" name="xibo_step" value="5" />
1620-<input type="hidden" name="db_create" value="Off" />
1621-<div class="install_table">
1622- <p><label for="host"><?php echo __("Host:"); ?>&nbsp;</label><input class="username" type="text" id="host" name="host" size="12" value="localhost" /></p>
1623- <p><label for="db_name"><?php echo __("Xibo Database Name:"); ?>&nbsp;</label><input class="username" type="text" id="db_name" name="db_name" size="12" value="xibo" /></p>
1624- <p><label for="db_username"><?php echo __("Xibo Database Username:"); ?>&nbsp;</label><input class="username" type="text" id="db_username" name="db_username" size="12" value="xibo" /></p>
1625- <p><label for="db_password"><?php echo __("Xibo Database Password:"); ?>&nbsp;</label><input class="username" type="password" id="db_password" name="db_password" size="12" /></p>
1626-</div>
1627-</div>
1628-<button type="submit"><?php echo __("Create"); ?></button>
1629-</form>
1630-<?php
1631-}
1632-elseif ($xibo_step == 5) {
1633-
1634- $db_create = Kit::GetParam('db_create',_POST,_STRING);
1635-
1636- if (!isset($db_create)) {
1637- reportError("2",__("Something went wrong"));
1638- }
1639- else {
1640- $db_host = Kit::GetParam('host',_POST,_STRING,'localhost');
1641- $db_user = Kit::GetParam('db_username',_POST,_PASSWORD);
1642- $db_pass = Kit::GetParam('db_password',_POST,_PASSWORD);
1643- $db_name = Kit::GetParam('db_name',_POST,_PASSWORD);
1644- ?>
1645- <div class="info">
1646- <?php
1647- if ($db_create == 'On') {
1648- $db_admin_user = Kit::GetParam('admin_username',_POST,_PASSWORD);
1649- $db_admin_pass = Kit::GetParam('admin_password',_POST,_PASSWORD);
1650-
1651- if (! ($db_host && $db_name && $db_user && $db_admin_user)) {
1652- # Something was blank.
1653- # Throw an error.
1654- reportError("3", __("A field was blank. Please fill in all fields."));
1655- }
1656-
1657- $db = @mysql_connect($db_host,$db_admin_user,$db_admin_pass);
1658-
1659- if (! $db) {
1660- reportError("3", __("Could not connect to MySQL with the administrator details. Please check and try again.") . "<br /><br />" . __("MySQL Error:") . "<br />" . mysql_error());
1661- }
1662-
1663- ?>
1664- <p><?php echo __("Creating new database."); ?></p>
1665- <?php
1666- flush();
1667-
1668- $SQL = sprintf("CREATE DATABASE `%s`",
1669- mysql_real_escape_string($db_name));
1670- if (! @mysql_query($SQL, $db)) {
1671- # Create database and user
1672- reportError("3", __("Could not create a new database with the administrator details. Please check and try again.") . "<br /><br />" . "MySQL Error:" . "<br />" . mysql_error());
1673- }
1674-
1675- # Choose the MySQL DB to create a user
1676- @mysql_select_db("mysql", $db);
1677-
1678- # Make $db_host lowercase so it matches "localhost" if required.
1679- $db_host = strtolower($db_host);
1680-
1681- ?>
1682- <p><?php echo __("Creating new user"); ?></p>
1683- <?php
1684- flush();
1685-
1686- if ($db_host == 'localhost') {
1687- $SQL = sprintf("GRANT ALL PRIVILEGES ON `%s`.* to '%s'@'%s' IDENTIFIED BY '%s'",
1688- mysql_real_escape_string($db_name),
1689- mysql_real_escape_string($db_user),
1690- mysql_real_escape_string($db_host),
1691- mysql_real_escape_string($db_pass));
1692- }
1693- else {
1694- $SQL = sprintf("GRANT ALL PRIVILEGES ON `%s`.* to '%s'@'%%' IDENTIFIED BY '%s'",
1695- mysql_real_escape_string($db_name),
1696- mysql_real_escape_string($db_user),
1697- mysql_real_escape_string($db_pass));
1698- }
1699- if (! @mysql_query($SQL, $db)) {
1700- reportError("3", __("Could not create a new user with the administrator details. Please check and try again.") . "<br /><br />" . __("MySQL Error:") . "<br />" . mysql_error());
1701- }
1702-
1703-
1704- @mysql_query("FLUSH PRIVILEGES", $db);
1705- @mysql_close($db);
1706-
1707- }
1708- else {
1709- if (! ($db_host && $db_name && $db_user && $db_pass)) {
1710- # Something was blank
1711- # Throw an error.
1712- reportError("4", __("A field was blank. Please fill in all fields.") . " " . $db_host . " " . $db_name . " " . $db_user . " " . $db_pass);
1713- }
1714- }
1715- ## Populate database
1716-
1717- $db = @mysql_connect($db_host,$db_user,$db_pass);
1718-
1719- if (! $db) {
1720- reportError("4", __("Could not connect to MySQL with the Xibo User account details. Please check and try again.") . "<br /><br />" . __("MySQL Error:") . "<br />" . mysql_error());
1721- }
1722-
1723- @mysql_select_db($db_name,$db);
1724-
1725- ?>
1726- <p>Populating the database</p>
1727- <?php
1728- flush();
1729-
1730- # Load from sql files to db - HOW?
1731- $sql_files = array('structure.sql', 'data.sql');
1732-
1733- $sqlStatementCount = 0;
1734-
1735- foreach ($sql_files as $filename) {
1736- ?>
1737- <p>Loading from <?php print $filename; ?>
1738- <?php
1739- flush();
1740-
1741- $delimiter = ';';
1742- $sql_file = @file_get_contents('install/master/' . $filename);
1743- $sql_file = remove_remarks($sql_file);
1744- $sql_file = split_sql_file($sql_file, $delimiter);
1745-
1746- foreach ($sql_file as $sql) {
1747- print ".";
1748- $sqlStatementCount++;
1749- flush();
1750- if (! @mysql_query($sql,$db)) {
1751- reportError("4", __("An error occured populating the database.") . "<br /><br />" . __("MySQL Error:") . "<br />" . mysql_error() . "<br /><br />SQL executed:<br />" . $sql . "<br /><br />Statement number: " . $sqlStatementCount);
1752- }
1753- }
1754- print "</p>";
1755- }
1756- @mysql_close($db);
1757- }
1758- # Write out a new settings.php
1759- $fh = fopen("settings.php", 'wt');
1760-
1761- if (! $fh) {
1762- reportError("0", __("Unable to write to settings.php. We already checked this was possible earlier, so something changed."));
1763- }
1764-
1765- settings_strings();
1766-
1767- $settings_content = '$dbhost = \'' . $db_host . '\';' . "\n";
1768- $settings_content .= '$dbuser = \'' . $db_user . '\';' . "\n";
1769- $settings_content .= '$dbpass = \'' . $db_pass . '\';' . "\n";
1770- $settings_content .= '$dbname = \'' . $db_name . '\';' . "\n\n";
1771- $settings_content .= 'define(\'SECRET_KEY\',\'' . gen_secret() . '\');' . "\n";
1772-
1773- if (! fwrite($fh, $settings_header . $settings_content . $settings_footer)) {
1774- reportError("0", __("Unable to write to settings.php. We already checked this was possible earlier, so something changed."));
1775- }
1776-
1777- fclose($fh);
1778-
1779- ?>
1780- </div>
1781- <div class="install_table">
1782- <form action="install.php" method="POST">
1783- <input type="hidden" name="xibo_step" value="6" />
1784- </div>
1785- <button type="submit"><?php echo __("Next"); ?> ></button>
1786- </form>
1787- <?php
1788-}
1789-elseif ($xibo_step == 6) {
1790- # Form to get new admin password
1791- ?>
1792- <div class="info">
1793- <p><?php echo __("Xibo needs to set the \"xibo_admin\" user password. Please enter a password for this account below."); ?></p>
1794- </div>
1795- <div class="install_table">
1796- <form action="install.php" method="POST">
1797- <input type="hidden" name="xibo_step" value="7" />
1798- <p><label for="password1"><?php echo __("Password:"); ?>&nbsp;</label><input type="password" name="password1" size="12" /></p>
1799- <p><label for="password2"><?php echo __("Retype Password:"); ?>&nbsp;</label><input type="password" name="password2" size="12" /></p>
1800- </div>
1801- <button type="submit"><?php echo __("Next"); ?> ></button>
1802- </form>
1803- <?php
1804-}
1805-elseif ($xibo_step == 7) {
1806- # Setup xibo_admin password
1807- $password1 = Kit::GetParam('password1',_POST,_PASSWORD);
1808- $password2 = Kit::GetParam('password2',_POST,_PASSWORD);
1809-
1810- if (!(($password1 && $password2) && ($password1 == $password2))) {
1811- reportError("6", __("Please input a new password. Ensure both password fields are identical."));
1812- }
1813-
1814- include('settings.php');
1815-
1816- $password_hash = md5($password1);
1817-
1818- $db = @mysql_connect($dbhost,$dbuser,$dbpass);
1819-
1820- if (! $db) {
1821- reportError("6", __("Could not connect to MySQL with the Xibo User account details saved in settings.php. Please check and try again.") . "<br /><br />" . __("MySQL Error:") . "<br />" . mysql_error());
1822- }
1823-
1824- @mysql_select_db($dbname,$db);
1825-
1826- $SQL = sprintf("UPDATE `user` SET UserPassword = '%s' WHERE UserID = 1 LIMIT 1",
1827- mysql_real_escape_string($password_hash));
1828- if (! @mysql_query($SQL, $db)) {
1829- reportError("6", __("An error occured changing the xibo_admin password.") . "<br /><br />" . __("MySQL Error:") . "<br />" . mysql_error());
1830- }
1831-
1832- @mysql_close($db);
1833-
1834- ?>
1835- <div class="info">
1836- <?php echo __("Successfully changed the xibo_admin password. We're nearly there now. Just a couple more steps!"); ?>
1837- </div>
1838- <form action="install.php" method="POST">
1839- <input type="hidden" name="xibo_step" value="8" />
1840- <button type="submit"><?php echo __("Next"); ?> ></button>
1841- </form>
1842- <?php
1843-}
1844-elseif ($xibo_step == 8) {
1845- # Configure paths and keys
1846- ## nuSoap
1847- ## libraries
1848- ## server_key
1849- ?>
1850- <div class="info">
1851- <p><b><?php echo __("Library Location"); ?></b></p>
1852- <p><?php echo __("Xibo needs somewhere to store the things you upload to be shown. Ideally, this should be somewhere outside the root of your webserver - that is such that is not accessible by a web browser. Please input the full path to this folder. If the folder does not already exist, Xibo will attempt to create it for you."); ?></p>
1853- <form action="install.php" method="POST">
1854- <div class="install_table">
1855- <p><label for="library_location"><?php echo __("Library Location:"); ?>&nbsp;</label><input type="text" name="library_location" value="" /></p>
1856- </div>
1857- <p><b><?php echo __("Server Key"); ?></b></p>
1858- <p><?php echo __("Xibo needs you to choose a \"key\". This will be required each time you setup a new client. It should be complicated, and hard to remember. It is visible in the admin interface, so it need not be written down separately."); ?></p>
1859- <div class="install_table">
1860- <p><label for="server_key"><?php echo __("Server Key:"); ?> </label><input type="text" name="server_key" value="" /></p>
1861- </div>
1862- <p><b><?php echo __("Statistics"); ?></b></p>
1863- <p><?php echo __("We'd love to know you're running Xibo. If you're happy for us to collect anonymous statistics (version number, number of displays) then please leave the box ticked. Please untick the box if your server does not have direct access to the internet."); ?></p>
1864- <div class="install_table">
1865- <p><label for="stats"><?php echo __("Anonymous Statistics:"); ?>&nbsp;</label><input type="checkbox" name="stats" value="true" checked /></p>
1866- </div>
1867- <input type="hidden" name="xibo_step" value="9" />
1868- </div>
1869- <button type="submit"><?php echo __("Next"); ?> ></button>
1870- </form>
1871- <?php
1872-}
1873-elseif ($xibo_step == 9) {
1874-
1875- $server_key = Kit::GetParam('server_key',_POST,_STRING);
1876- $library_location = Kit::GetParam('library_location',_POST,_STRING);
1877- $stats = Kit::GetParam('stats',_POST,_BOOL);
1878-
1879- // Remove trailing whitespace from the path given.
1880- $library_location = trim($library_location);
1881-
1882- // Check both fields were completed
1883- if (! ($server_key && $library_location)) {
1884- reportError("8", __("A field was blank. Please make sure you complete all fields"));
1885- }
1886-
1887- if ($stats) {
1888- $stats="On"; // Fixme: translate ?
1889- }
1890- else {
1891- $stats="Off"; //Fixme : translate ?
1892- }
1893-
1894- // Does library_location exist already?
1895- if (! is_dir($library_location)) {
1896- if (is_file($library_location)) {
1897- reportError("8", __("A file exists with the name you gave for the Library Location. Please choose another location"));
1898- }
1899-
1900- // Directory does not exist. Attempt to make it
1901- // Using mkdir recursively, so it will attempt to make any
1902- // intermediate folders required.
1903- if (! mkdir($library_location,0755,true)) {
1904- reportError("8", __("Could not create the Library Location directory for you. Please ensure the webserver has permission to create a folder in this location, or create the folder manually and grant permission for the webserver to write to the folder."));
1905- }
1906-
1907- }
1908-
1909- // Is library_location writable?
1910- if (! is_writable($library_location)) {
1911- // Directory is not writable.
1912- reportError("8", __("The Library Location you gave is not writable by the webserver. Please fix the permissions and try again."));
1913- }
1914-
1915- // Is library_location empty?
1916- if (count(ls("*",$library_location,true)) > 0) {
1917- reportError("8", __("The Library Location you gave is not empty. Please give the location of an empty folder"));
1918- }
1919-
1920- // Check if the user has added a trailing slash.
1921- // If not, add one.
1922- if (!((substr($library_location, -1) == '/') || (substr($library_location, -1) == '\\'))) {
1923- $library_location = $library_location . '/';
1924- }
1925-
1926- include('settings.php');
1927-
1928- $db = @mysql_connect($dbhost,$dbuser,$dbpass);
1929-
1930- if (! $db) {
1931- reportError("8", __("Could not connect to MySQL with the Xibo User account details saved in settings.php. Please check and try again.") . "<br /><br />" . __("MySQL Error:") . "<br />" . mysql_error());
1932- }
1933-
1934- @mysql_select_db($dbname,$db);
1935-
1936- $SQL = sprintf("UPDATE `setting` SET `value` = '%s' WHERE `setting`.`setting` = 'LIBRARY_LOCATION' LIMIT 1",
1937- mysql_real_escape_string($library_location));
1938- if (! @mysql_query($SQL, $db)) {
1939- reportError("8", __("An error occured changing the library location.") . "<br /><br />" . __("MySQL Error:") . "<br />" . mysql_error());
1940- }
1941-
1942- $SQL = sprintf("UPDATE `setting` SET `value` = '%s' WHERE `setting`.`setting` = 'SERVER_KEY' LIMIT 1",
1943- mysql_real_escape_string($server_key));
1944- if (! @mysql_query($SQL, $db)) {
1945- reportError("8", __("An error occured changing the server key.") . "<br /><br />" . __("MySQL Error:") . "<br />" . mysql_error());
1946- }
1947-
1948- $SQL = sprintf("UPDATE `setting` SET `value` = '%s' WHERE `setting`.`setting` = 'defaultTimezone' LIMIT 1",
1949- mysql_real_escape_string(date_default_timezone_get()));
1950- if (! @mysql_query($SQL, $db)) {
1951- reportError("8", __("An error occured setting the default timezone.") . "<br /><br />" . __("MySQL Error:") . "<br />" . mysql_error());
1952- }
1953-
1954- $SQL = sprintf("UPDATE `setting` SET `value` = '%s' WHERE `setting`.`setting` = 'PHONE_HOME' LIMIT 1",
1955- mysql_real_escape_string($stats));
1956- if (! @mysql_query($SQL, $db)) {
1957- reportError("8", __("An error occured setting anonymous statistics.") . "<br /><br />" . __("MySQL Error:") . "<br />" . mysql_error());
1958- }
1959- $SQL = "UPDATE `setting` SET `value` = '" . md5(uniqid(rand(), true)) . "' WHERE `setting`.`setting` = 'PHONE_HOME_KEY' LIMIT 1";
1960- if (! @mysql_query($SQL, $db)) {
1961- reportError("8", __("An error occured setting anonymous statistics.") . "<br /><br />" . __("MySQL Error:") . "<br />" . mysql_error());
1962- }
1963-
1964- @mysql_close($db);
1965-
1966- ?>
1967- <div class="info">
1968- <p><?php echo __("Successfully set library location and server key."); ?></p>
1969- </div>
1970- <form action="install.php" method="POST">
1971- <input type="hidden" name="xibo_step" value="10" />
1972- <button type="submit"><?php echo __("Next"); ?> ></button>
1973- </form>
1974- <?php
1975-}
1976-elseif ($xibo_step == 10) {
1977-# Delete install.php
1978-# Redirect to login page.
1979- if (! unlink('install.php')) {
1980- reportError("10", __("Unable to delete install.php. Please ensure the webserver has permission to unlink this file and retry"), __("Retry")); // Fixme : translate "Retry" ?
1981- }
1982- if (! unlink('upgrade.php')) {
1983- reportError("10", __("Unable to delete upgrade.php. Please ensure the webserver has permission to unlink this file and retry"), __("Retry")); // Fixme : translate "Retry" ?
1984- }
1985- ?>
1986- <div class="info">
1987- <p><b><?php echo __("Xibo was successfully installed."); ?></b></p>
1988- <p><?php echo __("Please click"); ?>&nbsp;<a href="index.php"><?php echo __("here"); ?></a>&nbsp;<?php echo __("to logon to Xibo as \"xibo_admin\" with the password you chose earlier."); ?></p>
1989- </div>
1990- <?php
1991-}
1992-else {
1993- reportError("0", __("A required parameter was missing. Please go through the installer sequentially!"), __("Start Again")); // Fixme : translate "Start Again" ?
1994-}
1995-
1996-include('install/footer.inc');
1997-
1998-# Functions
1999-function checkFsPermissions() {
2000- # Check for appropriate filesystem permissions
2001- return ((is_writable("install.php") && (is_writable("settings.php")) && (is_writable("upgrade.php")) || is_writable(".")));
2002-}
2003-
2004-function checkMySQL() {
2005- # Check PHP has MySQL module installed
2006- return extension_loaded("mysql");
2007-}
2008-
2009-function checkJson() {
2010- # Check PHP has JSON module installed
2011- return extension_loaded("json");
2012-}
2013-
2014-function checkGd() {
2015- # Check PHP has JSON module installed
2016- return extension_loaded("gd");
2017-}
2018-
2019-function checkCal() {
2020- # Check PHP has JSON module installed
2021- return extension_loaded("calendar");
2022-}
2023-
2024-function reportError($step, $message, $button_text="&lt; Back") { // fixme : translate ?
2025-?>
2026- <div class="info">
2027- <?php print $message; ?>
2028- </div>
2029- <form action="install.php" method="POST">
2030- <input type="hidden" name="xibo_step" value="<?php print $step; ?>"/>
2031- <button type="submit"><?php print $button_text; ?></button>
2032- </form>
2033- <?php
2034- include('install/footer.inc');
2035- die();
2036-}
2037-
2038-// Taken from http://forums.devshed.com/php-development-5/php-wont-load-sql-from-file-515902.html
2039-// By Crackster
2040-/**
2041- * remove_remarks will strip the sql comment lines out of an uploaded sql file
2042- */
2043-function remove_remarks($sql){
2044- $sql = preg_replace('/\n{2,}/', "\n", preg_replace('/^[-].*$/m', "\n", $sql));
2045- $sql = preg_replace('/\n{2,}/', "\n", preg_replace('/^#.*$/m', "\n", $sql));
2046- return $sql;
2047-}
2048-
2049-// Taken from http://forums.devshed.com/php-development-5/php-wont-load-sql-from-file-515902.html
2050-// By Crackster
2051-/**
2052- * split_sql_file will split an uploaded sql file into single sql statements.
2053- * Note: expects trim() to have already been run on $sql.
2054- */
2055-function split_sql_file($sql, $delimiter){
2056- $sql = str_replace("\r" , '', $sql);
2057- $data = preg_split('/' . preg_quote($delimiter, '/') . '$/m', $sql);
2058- $data = array_map('trim', $data);
2059- // The empty case
2060- $end_data = end($data);
2061- if (empty($end_data))
2062- {
2063- unset($data[key($data)]);
2064- }
2065- return $data;
2066-}
2067-
2068-/**
2069- * This funtion will take a pattern and a folder as the argument and go thru it(recursivly if needed)and return the list of
2070- * all files in that folder.
2071- * Link : http://www.bin-co.com/php/scripts/filesystem/ls/
2072- * License : BSD
2073- * Arguments : $pattern - The pattern to look out for [OPTIONAL]
2074- * $folder - The path of the directory of which's directory list you want [OPTIONAL]
2075- * $recursivly - The funtion will traverse the folder tree recursivly if this is true. Defaults to false. [OPTIONAL]
2076- * $options - An array of values 'return_files' or 'return_folders' or both
2077- * Returns : A flat list with the path of all the files(no folders) that matches the condition given.
2078- */
2079-function ls($pattern="*", $folder="", $recursivly=false, $options=array('return_files','return_folders')) {
2080- if($folder) {
2081- $current_folder = realpath('.');
2082- if(in_array('quiet', $options)) { // If quiet is on, we will suppress the 'no such folder' error
2083- if(!file_exists($folder)) return array();
2084- }
2085-
2086- if(!chdir($folder)) return array();
2087- }
2088-
2089-
2090- $get_files = in_array('return_files', $options);
2091- $get_folders= in_array('return_folders', $options);
2092- $both = array();
2093- $folders = array();
2094-
2095- // Get the all files and folders in the given directory.
2096- if($get_files) $both = glob($pattern, GLOB_BRACE + GLOB_MARK);
2097- if($recursivly or $get_folders) $folders = glob("*", GLOB_ONLYDIR + GLOB_MARK);
2098-
2099- //If a pattern is specified, make sure even the folders match that pattern.
2100- $matching_folders = array();
2101- if($pattern !== '*') $matching_folders = glob($pattern, GLOB_ONLYDIR + GLOB_MARK);
2102-
2103- //Get just the files by removing the folders from the list of all files.
2104- $all = array_values(array_diff($both,$folders));
2105-
2106- if($recursivly or $get_folders) {
2107- foreach ($folders as $this_folder) {
2108- if($get_folders) {
2109- //If a pattern is specified, make sure even the folders match that pattern.
2110- if($pattern !== '*') {
2111- if(in_array($this_folder, $matching_folders)) array_push($all, $this_folder);
2112- }
2113- else array_push($all, $this_folder);
2114- }
2115-
2116- if($recursivly) {
2117- // Continue calling this function for all the folders
2118- $deep_items = ls($pattern, $this_folder, $recursivly, $options); # :RECURSION:
2119- foreach ($deep_items as $item) {
2120- array_push($all, $this_folder . $item);
2121- }
2122- }
2123- }
2124- }
2125-
2126- if($folder) chdir($current_folder);
2127- return $all;
2128-}
2129-
2130-function gen_secret() {
2131- # Generates a random 12 character alphanumeric string to use as a salt
2132- mt_srand((double)microtime()*1000000);
2133- $key = "";
2134- for ($i=0; $i < 12; $i++) {
2135- $c = mt_rand(0,2);
2136- if ($c == 0) {
2137- $key .= chr(mt_rand(65,90));
2138- }
2139- elseif ($c == 1) {
2140- $key .= chr(mt_rand(97,122));
2141- }
2142- else {
2143- $key .= chr(mt_rand(48,57));
2144- }
2145- }
2146-
2147- return $key;
2148-}
2149-
2150-function CheckGettext()
2151-{
2152- return extension_loaded("gettext");
2153-}
2154-
2155-// Setup the translations for gettext
2156-function __($string)
2157-{
2158- if (CheckGettext())
2159- {
2160- return _($string);
2161- }
2162- else
2163- {
2164- return $string;
2165- }
2166-}
2167-
2168-function settings_strings() {
2169-global $settings_header;
2170-global $settings_footer;
2171-
2172- $settings_header = <<<END
2173-<?php
2174-
2175-/*
2176- * Xibo - Digital Signage - http://www.xibo.org.uk
2177- *
2178- * This file is part of Xibo - and is automatically generated by the installer
2179- *
2180- * You should not need to edit this file, unless your SQL connection details have changed.
2181- */
2182-
2183-defined('XIBO') or die(__("Sorry, you are not allowed to directly access this page.") . "<br />" . __("Please press the back button in your browser."));
2184-
2185-global \$dbhost;
2186-global \$dbuser;
2187-global \$dbpass;
2188-global \$dbname;
2189-
2190-
2191-END;
2192-
2193-$settings_footer = <<<END
2194-?>
2195-END;
2196-
2197- return;
2198-}
2199+require_once('lib/app/kit.class.php');
2200+require_once('config/config.class.php');
2201+require_once('config/db_config.php');
2202+require_once("lib/app/pdoconnect.class.php");
2203+require_once("lib/app/translationengine.class.php");
2204+require_once("lib/app/thememanager.class.php");
2205+require_once("lib/app/helpmanager.class.php");
2206+require_once("lib/app/datemanager.class.php");
2207+require_once("lib/app/formmanager.class.php");
2208+require_once('modules/module_user_general.php');
2209+require_once('lib/pages/install.class.php');
2210+require_once("lib/data/data.class.php");
2211+require_once('lib/app/debug.class.php');
2212+
2213+// Create a theme
2214+new Theme(new User(new Database()), 'default');
2215+Theme::SetPagename('install');
2216+
2217+// Set-up the translations for get text
2218+TranslationEngine::InitLocale('en_GB');
2219+
2220+$xibo_step = Kit::GetParam('step', _REQUEST, _INT, 1);
2221+
2222+$content = '';
2223+$install = new Install();
2224+
2225+switch ($xibo_step) {
2226+
2227+ case 1:
2228+ // Welcome to the installer (this should only show once)
2229+ // Checks environment
2230+ $content = $install->Step1();
2231+ break;
2232+
2233+ case 2:
2234+ // Collect details about the database
2235+ $content = $install->Step2();
2236+ break;
2237+
2238+ case 3:
2239+ // Check and validate DB details
2240+ if (defined('MAX_EXECUTION') && MAX_EXECUTION)
2241+ set_time_limit(0);
2242+
2243+ try {
2244+ $install->Step3();
2245+
2246+ // Redirect to step 4
2247+ header('Location: install.php?step=4');
2248+ }
2249+ catch (Exception $e) {
2250+ $install->errorMessage = $e->getMessage();
2251+
2252+ // Reload step 2
2253+ $content = $install->Step2();
2254+ }
2255+ break;
2256+
2257+ case 4:
2258+ // DB installed and we are ready to collect some more details
2259+ // We should get the admin username and password
2260+ $content = $install->Step4();
2261+ break;
2262+
2263+ case 5:
2264+ // Create a user account
2265+ include_once('settings.php');
2266+ try {
2267+ $install->Step5();
2268+
2269+ // Redirect to step 6
2270+ header('Location: install.php?step=6');
2271+ }
2272+ catch (Exception $e) {
2273+ $install->errorMessage = $e->getMessage();
2274+
2275+ // Reload step 4
2276+ $content = $install->Step4();
2277+ }
2278+ break;
2279+
2280+ case 6:
2281+ $content = $install->Step6();
2282+ break;
2283+
2284+ case 7:
2285+ // Create a user account
2286+ include_once('settings.php');
2287+ try {
2288+ $install->Step7();
2289+
2290+ // Redirect to step 6
2291+ header('Location: install.php?step=8');
2292+ }
2293+ catch (Exception $e) {
2294+ $install->errorMessage = $e->getMessage();
2295+
2296+ // Reload step 4
2297+ $content = $install->Step6();
2298+ }
2299+ break;
2300+
2301+ case 8:
2302+ include_once('settings.php');
2303+ // Step 8 ends the execution
2304+ $install->Step8();
2305+ break;
2306+}
2307+
2308+Theme::Set('step', $xibo_step);
2309+Theme::Set('stepContent', $content);
2310+
2311+// Include the header
2312+Theme::Render('install_header');
2313+Theme::Render('install_footer');
2314 ?>
2315
2316=== added file 'server/install/database/80.sql'
2317--- server/install/database/80.sql 1970-01-01 00:00:00 +0000
2318+++ server/install/database/80.sql 2014-09-19 11:39:09 +0000
2319@@ -0,0 +1,178 @@
2320+
2321+ALTER TABLE `module` ADD `render_as` VARCHAR( 10 ) NULL;
2322+ALTER TABLE `module` ADD `settings` TEXT NULL;
2323+
2324+UPDATE `resolution` SET enabled = 0;
2325+
2326+ALTER TABLE `resolution` ADD `version` TINYINT NOT NULL DEFAULT '1';
2327+ALTER TABLE `resolution` ADD `enabled` TINYINT NOT NULL DEFAULT '1';
2328+ALTER TABLE `resolution` CHANGE `resolution` `resolution` VARCHAR( 254 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
2329+
2330+INSERT INTO `resolution` (`resolutionID`, `resolution`, `width`, `height`, `intended_width`, `intended_height`, `version`, `enabled`) VALUES
2331+(9, '1080p HD Landscape', 800, 450, 1920, 1080, 2, 1),
2332+(10, '720p HD Landscape', 800, 450, 1280, 720, 2, 1),
2333+(11, '1080p HD Portrait', 450, 800, 1080, 1920, 2, 1),
2334+(12, '720p HD Portrait', 450, 800, 720, 1280, 2, 1),
2335+(13, '4k', 800, 450, 4096, 2304, 2, 1),
2336+(14, 'Common PC Monitor 4:3', 800, 600, 1024, 768, 2, 1);
2337+
2338+DELETE FROM `lktemplategroup` WHERE TemplateID IN (SELECT TemplateID FROM `template` WHERE isSystem = 1);
2339+DELETE FROM `template` WHERE isSystem = 1;
2340+
2341+ALTER TABLE `template` DROP `isSystem`;
2342+
2343+ALTER TABLE `display` ADD `displayprofileid` INT NULL;
2344+
2345+INSERT INTO `pages` (`name`, `pagegroupID`)
2346+SELECT 'displayprofile', pagegroupID FROM `pagegroup` WHERE pagegroup.pagegroup = 'Displays';
2347+
2348+INSERT INTO `menuitem` (MenuID, PageID, Args, Text, Class, Img, Sequence, External)
2349+SELECT 7, PageID, NULL, 'Display Settings', NULL, NULL, 4, 0
2350+ FROM `pages`
2351+ WHERE name = 'displayprofile';
2352+
2353+CREATE TABLE IF NOT EXISTS `displayprofile` (
2354+ `displayprofileid` int(11) NOT NULL AUTO_INCREMENT,
2355+ `name` varchar(50) NOT NULL,
2356+ `type` varchar(15) NOT NULL,
2357+ `config` text NOT NULL,
2358+ `isdefault` int(11) NOT NULL,
2359+ `userid` int(11) NOT NULL,
2360+ PRIMARY KEY (`displayprofileid`)
2361+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
2362+
2363+UPDATE layout SET background = SUBSTRING_INDEX(background, '.', 1) WHERE IFNULL(background, '') <> '';
2364+ALTER TABLE `layout` CHANGE `background` `backgroundImageId` INT( 11 ) NULL DEFAULT NULL;
2365+
2366+INSERT INTO `lklayoutmedia` (mediaid, layoutid, regionid)
2367+SELECT backgroundimageid, layoutid, 'background' FROM `layout` WHERE IFNULL(backgroundImageId, 0) <> 0;
2368+
2369+ALTER TABLE `setting` CHANGE `type` `fieldType` VARCHAR( 24 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
2370+
2371+ALTER TABLE `setting` ADD `title` VARCHAR( 254 ) NOT NULL ,
2372+ADD `type` VARCHAR( 50 ) NOT NULL,
2373+ADD `validation` VARCHAR( 50 ) NOT NULL ,
2374+ADD `ordering` INT NOT NULL,
2375+ADD `default` VARCHAR( 1000 ) NOT NULL,
2376+ADD `userSee` TINYINT NOT NULL DEFAULT '1';
2377+
2378+UPDATE `setting` SET type = fieldType;
2379+
2380+DELETE FROM `setting` WHERE setting IN ('BASE_URL', 'adminMessage', 'ppt_width', 'ppt_height');
2381+
2382+UPDATE `setting` SET cat = 'configuration', ordering = 10, usersee = '1', userchange = '1', `default` = '' WHERE setting = 'LIBRARY_LOCATION';
2383+UPDATE `setting` SET cat = 'configuration', ordering = 20, usersee = '1', userchange = '1', `default` = '' WHERE setting = 'SERVER_KEY';
2384+UPDATE `setting` SET cat = 'configuration', ordering = 30, usersee = '1', userchange = '1', `default` = 'default' WHERE setting = 'GLOBAL_THEME_NAME';
2385+UPDATE `setting` SET cat = 'content', ordering = 10, usersee = '1', userchange = '1', `default` = '10' WHERE setting = 'ppt_length';
2386+UPDATE `setting` SET cat = 'content', ordering = 20, usersee = '1', userchange = '1', `default` = '10' WHERE setting = 'swf_length';
2387+UPDATE `setting` SET cat = 'content', ordering = 30, usersee = '1', userchange = '1', `default` = '10' WHERE setting = 'jpg_length';
2388+UPDATE `setting` SET cat = 'defaults', ordering = 10, usersee = '1', userchange = '1', `default` = 'Unchecked' WHERE setting = 'LIBRARY_MEDIA_UPDATEINALL_CHECKB';
2389+UPDATE `setting` SET cat = 'defaults', ordering = 20, usersee = '1', userchange = '1', `default` = 'Unchecked' WHERE setting = 'LAYOUT_COPY_MEDIA_CHECKB';
2390+UPDATE `setting` SET cat = 'defaults', ordering = 30, usersee = '0', userchange = '0', `default` = 'Unchecked' WHERE setting = 'MODULE_CONFIG_LOCKED_CHECKB';
2391+UPDATE `setting` SET cat = 'defaults', ordering = 40, usersee = '1', userchange = '0', `default` = 'Unchecked' WHERE setting = 'TRANSITION_CONFIG_LOCKED_CHECKB';
2392+UPDATE `setting` SET cat = 'displays', ordering = 10, usersee = '1', userchange = '1', `default` = '51.504' WHERE setting = 'DEFAULT_LAT';
2393+UPDATE `setting` SET cat = 'displays', ordering = 20, usersee = '1', userchange = '1', `default` = '-0.104' WHERE setting = 'DEFAULT_LONG';
2394+UPDATE `setting` SET cat = 'displays', ordering = 30, usersee = '1', userchange = '1', `default` = '0' WHERE setting = 'SHOW_DISPLAY_AS_VNCLINK';
2395+UPDATE `setting` SET cat = 'displays', ordering = 40, usersee = '1', userchange = '1', `default` = '_top' WHERE setting = 'SHOW_DISPLAY_AS_VNC_TGT';
2396+UPDATE `setting` SET cat = 'displays', ordering = 50, usersee = '0', userchange = '0', `default` = '0' WHERE setting = 'MAX_LICENSED_DISPLAYS';
2397+UPDATE `setting` SET cat = 'general', ordering = 10, usersee = '1', userchange = '1', `default` = 'On' WHERE setting = 'PHONE_HOME';
2398+UPDATE `setting` SET cat = 'general', ordering = 20, usersee = '0', userchange = '0', `default` = '' WHERE setting = 'PHONE_HOME_KEY';
2399+UPDATE `setting` SET cat = 'general', ordering = 30, usersee = '0', userchange = '0', `default` = '0' WHERE setting = 'PHONE_HOME_DATE';
2400+UPDATE `setting` SET cat = 'general', ordering = 40, usersee = '1', userchange = '0', `default` = 'On' WHERE setting = 'SCHEDULE_LOOKAHEAD';
2401+UPDATE `setting` SET cat = 'general', ordering = 50, usersee = '1', userchange = '1', `default` = '172800' WHERE setting = 'REQUIRED_FILES_LOOKAHEAD';
2402+UPDATE `setting` SET cat = 'general', ordering = 60, usersee = '1', userchange = '1', `default` = 'Off' WHERE setting = 'SENDFILE_MODE';
2403+UPDATE `setting` SET cat = 'general', ordering = 70, usersee = '1', userchange = '0', `default` = '' WHERE setting = 'EMBEDDED_STATUS_WIDGET';
2404+UPDATE `setting` SET cat = 'general', ordering = 80, usersee = '1', userchange = '1', `default` = '1' WHERE setting = 'SETTING_IMPORT_ENABLED';
2405+UPDATE `setting` SET cat = 'general', ordering = 90, usersee = '1', userchange = '1', `default` = '1' WHERE setting = 'SETTING_LIBRARY_TIDY_ENABLED';
2406+UPDATE `setting` SET cat = 'general', ordering = 10, usersee = '1', userchange = '1', `default` = 'http://www.xibo.org.uk/manual/' WHERE setting = 'HELP_BASE';
2407+UPDATE `setting` SET cat = 'maintenance', ordering = 10, usersee = '1', userchange = '1', `default` = 'Off' WHERE setting = 'MAINTENANCE_ENABLED';
2408+UPDATE `setting` SET cat = 'maintenance', ordering = 20, usersee = '1', userchange = '1', `default` = 'On' WHERE setting = 'MAINTENANCE_EMAIL_ALERTS';
2409+UPDATE `setting` SET cat = 'maintenance', ordering = 30, usersee = '1', userchange = '1', `default` = 'mail@yoursite.com' WHERE setting = 'mail_to';
2410+UPDATE `setting` SET cat = 'maintenance', ordering = 40, usersee = '1', userchange = '1', `default` = 'mail@yoursite.com' WHERE setting = 'mail_from';
2411+UPDATE `setting` SET cat = 'maintenance', ordering = 50, usersee = '1', userchange = '1', `default` = 'changeme' WHERE setting = 'MAINTENANCE_KEY';
2412+UPDATE `setting` SET cat = 'maintenance', ordering = 60, usersee = '1', userchange = '1', `default` = '30' WHERE setting = 'MAINTENANCE_LOG_MAXAGE';
2413+UPDATE `setting` SET cat = 'maintenance', ordering = 70, usersee = '1', userchange = '1', `default` = '30' WHERE setting = 'MAINTENANCE_STAT_MAXAGE';
2414+UPDATE `setting` SET cat = 'maintenance', ordering = 80, usersee = '1', userchange = '1', `default` = '12' WHERE setting = 'MAINTENANCE_ALERT_TOUT';
2415+UPDATE `setting` SET cat = 'maintenance', ordering = 80, usersee = '1', userchange = '1', `default` = 'Off' WHERE setting = 'MAINTENANCE_ALWAYS_ALERT';
2416+UPDATE `setting` SET cat = 'network', ordering = 10, usersee = '1', userchange = '1', `default` = '' WHERE setting = 'PROXY_HOST';
2417+UPDATE `setting` SET cat = 'network', ordering = 20, usersee = '1', userchange = '1', `default` = '0' WHERE setting = 'PROXY_PORT';
2418+UPDATE `setting` SET cat = 'network', ordering = 30, usersee = '1', userchange = '1', `default` = '' WHERE setting = 'PROXY_AUTH';
2419+UPDATE `setting` SET cat = 'network', ordering = 40, usersee = '1', userchange = '0', `default` = '0' WHERE setting = 'MONTHLY_XMDS_TRANSFER_LIMIT_KB';
2420+UPDATE `setting` SET cat = 'network', ordering = 50, usersee = '1', userchange = '0', `default` = '0' WHERE setting = 'LIBRARY_SIZE_LIMIT_KB';
2421+UPDATE `setting` SET cat = 'network', ordering = 60, usersee = '0', userchange = '0', `default` = 'http://www.xibo.org.uk/stats/track.php' WHERE setting = 'PHONE_HOME_URL';
2422+UPDATE `setting` SET cat = 'permissions', ordering = 10, usersee = '1', userchange = '1', `default` = 'private' WHERE setting = 'LAYOUT_DEFAULT';
2423+UPDATE `setting` SET cat = 'permissions', ordering = 20, usersee = '1', userchange = '1', `default` = 'private' WHERE setting = 'MEDIA_DEFAULT';
2424+UPDATE `setting` SET cat = 'permissions', ordering = 30, usersee = '1', userchange = '1', `default` = 'Media Colouring' WHERE setting = 'REGION_OPTIONS_COLOURING';
2425+UPDATE `setting` SET cat = 'permissions', ordering = 40, usersee = '1', userchange = '1', `default` = 'No' WHERE setting = 'SCHEDULE_WITH_VIEW_PERMISSION';
2426+UPDATE `setting` SET cat = 'regional', ordering = 10, usersee = '1', userchange = '1', `default` = 'en_GB' WHERE setting = 'DEFAULT_LANGUAGE';
2427+UPDATE `setting` SET cat = 'regional', ordering = 20, usersee = '1', userchange = '1', `default` = 'Europe/London' WHERE setting = 'defaultTimezone';
2428+UPDATE `setting` SET cat = 'troubleshooting', ordering = 10, usersee = '1', userchange = '1', `default` = 'Off' WHERE setting = 'debug';
2429+UPDATE `setting` SET cat = 'troubleshooting', ordering = 20, usersee = '1', userchange = '1', `default` = 'Off' WHERE setting = 'audit';
2430+UPDATE `setting` SET cat = 'troubleshooting', ordering = 30, usersee = '1', userchange = '1', `default` = 'Production' WHERE setting = 'SERVER_MODE';
2431+UPDATE `setting` SET cat = 'users', ordering = 0, usersee = '0', userchange = '0', `default` = 'module_user_general.php' WHERE setting = 'userModule';
2432+UPDATE `setting` SET cat = 'users', ordering = 10, usersee = '1', userchange = '1', `default` = 'User' WHERE setting = 'defaultUsertype';
2433+UPDATE `setting` SET cat = 'users', ordering = 20, usersee = '1', userchange = '1', `default` = '' WHERE setting = 'USER_PASSWORD_POLICY';
2434+UPDATE `setting` SET cat = 'users', ordering = 30, usersee = '1', userchange = '1', `default` = '' WHERE setting = 'USER_PASSWORD_ERROR';
2435+
2436+ALTER TABLE `schedule` ADD `DisplayOrder` INT NOT NULL DEFAULT '0';
2437+
2438+UPDATE `schedule` SET DisplayOrder = (SELECT MAX(DisplayOrder) FROM `schedule_detail` WHERE schedule_detail.eventid = schedule.eventid);
2439+
2440+ALTER TABLE `schedule_detail` DROP FOREIGN KEY `schedule_detail_ibfk_9` ;
2441+ALTER TABLE `schedule_detail` DROP `CampaignID`;
2442+ALTER TABLE `schedule_detail` DROP `is_priority`;
2443+ALTER TABLE `schedule_detail` DROP `DisplayOrder`;
2444+
2445+ALTER TABLE `user` ADD `newUserWizard` TINYINT NOT NULL DEFAULT '0';
2446+
2447+CREATE TABLE IF NOT EXISTS `xmdsnonce` (
2448+ `nonceId` bigint(20) NOT NULL AUTO_INCREMENT,
2449+ `nonce` varchar(100) NOT NULL,
2450+ `expiry` int(11) NOT NULL,
2451+ `lastUsed` int(11) DEFAULT NULL,
2452+ `displayId` int(11) NOT NULL,
2453+ `fileId` int(11) DEFAULT NULL,
2454+ `size` bigint(20) DEFAULT NULL,
2455+ `storedAs` varchar(100) DEFAULT NULL,
2456+ `layoutId` int(11) DEFAULT NULL,
2457+ `regionId` varchar(100) DEFAULT NULL,
2458+ `mediaId` varchar(100) DEFAULT NULL,
2459+ PRIMARY KEY (`nonceId`)
2460+) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
2461+
2462+ALTER TABLE `schedule` CHANGE `recurrence_type` `recurrence_type` ENUM( 'Minute', 'Hour', 'Day', 'Week', 'Month', 'Year' ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;
2463+
2464+ALTER TABLE `display` CHANGE `client_version` `client_version` VARCHAR( 15 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;
2465+
2466+ALTER TABLE `display` ADD `currentLayoutId` INT NULL;
2467+
2468+CREATE TABLE IF NOT EXISTS `bandwidthtype` (
2469+ `bandwidthtypeid` int(11) NOT NULL AUTO_INCREMENT,
2470+ `name` varchar(25) NOT NULL,
2471+ PRIMARY KEY (`bandwidthtypeid`)
2472+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=12 ;
2473+
2474+INSERT INTO `bandwidthtype` (`bandwidthtypeid`, `name`) VALUES
2475+(1, 'Register'),
2476+(2, 'Required Files'),
2477+(3, 'Schedule'),
2478+(4, 'Get File'),
2479+(5, 'Get Resource'),
2480+(6, 'Media Inventory'),
2481+(7, 'Notify Status'),
2482+(8, 'Submit Stats'),
2483+(9, 'Submit Log'),
2484+(10, 'Blacklist'),
2485+(11, 'Screen Shot');
2486+
2487+ALTER TABLE `display` ADD `screenShotRequested` TINYINT NOT NULL DEFAULT '0';
2488+
2489+INSERT INTO `help` (`Topic`, `Category`, `Link`) VALUES
2490+('Displayprofile', 'General', 'manual/single.php?p=admin/displayprofiles'),
2491+('DisplayProfile', 'Edit', 'manual/single.php?p=admin/displayprofiles#edit'),
2492+('DisplayProfile', 'Delete', 'manual/single.php?p=admin/displayprofiles#delete');
2493+
2494+
2495+UPDATE `version` SET `app_ver` = '1.7.0-alpha', `XmdsVersion` = 4;
2496+UPDATE `setting` SET `value` = 0 WHERE `setting` = 'PHONE_HOME_DATE';
2497+UPDATE `version` SET `DBVersion` = '80';
2498
2499=== removed file 'server/install/dot_amber.gif'
2500Binary files server/install/dot_amber.gif 2010-10-03 16:14:21 +0000 and server/install/dot_amber.gif 1970-01-01 00:00:00 +0000 differ
2501=== removed file 'server/install/dot_green.gif'
2502Binary files server/install/dot_green.gif 2010-10-03 16:14:21 +0000 and server/install/dot_green.gif 1970-01-01 00:00:00 +0000 differ
2503=== removed file 'server/install/dot_red.gif'
2504Binary files server/install/dot_red.gif 2010-10-03 16:14:21 +0000 and server/install/dot_red.gif 1970-01-01 00:00:00 +0000 differ
2505=== removed file 'server/install/header_upgrade.inc'
2506--- server/install/header_upgrade.inc 2014-01-18 09:47:41 +0000
2507+++ server/install/header_upgrade.inc 1970-01-01 00:00:00 +0000
2508@@ -1,50 +0,0 @@
2509-<?php
2510-/*
2511- * Xibo - Digital Signage - http://www.xibo.org.uk
2512- * Copyright (C) 2006-2013 Daniel Garner
2513- *
2514- * This file is part of Xibo.
2515- *
2516- * Xibo is free software: you can redistribute it and/or modify
2517- * it under the terms of the GNU Affero General Public License as published by
2518- * the Free Software Foundation, either version 3 of the License, or
2519- * any later version.
2520- *
2521- * Xibo is distributed in the hope that it will be useful,
2522- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2523- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2524- * GNU Affero General Public License for more details.
2525- *
2526- * You should have received a copy of the GNU Affero General Public License
2527- * along with Xibo. If not, see <http://www.gnu.org/licenses/>.
2528- */
2529-defined('XIBO') or die("Sorry, you are not allowed to directly access this page.<br /> Please press the back button in your browser.");
2530-?><!DOCTYPE html>
2531-<html lang="en">
2532- <head>
2533- <title>Xibo Admin - Upgrade</title>
2534- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
2535- <meta name="viewport" content="width=device-width, initial-scale=1.0">
2536- <link rel="stylesheet" type="text/css" href="install/install.css" />
2537- <link rel="shortcut icon" href="theme/default/img/favicon.ico" />
2538- <link href="theme/default/libraries/bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
2539- <link href="theme/default/libraries/bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet">
2540-
2541- <script type="text/javascript">
2542- $(document).ready(function(){
2543-
2544- document.getElementById('username').focus();
2545-
2546- });
2547- </script>
2548- </head>
2549-
2550- <body>
2551-
2552- <!-- Copyright 2006-2013 Daniel Garner. Part of the Xibo Open Source Digital Signage Solution. Released under the AGPLv3 or later. -->
2553- <div class="container">
2554- <div class="form-signin text-center">
2555- <div class="row">
2556- <h1>Xibo Upgrade</h1>
2557- </div>
2558- <div class="row">
2559
2560=== modified file 'server/install/master/data.sql'
2561--- server/install/master/data.sql 2014-07-15 15:35:22 +0000
2562+++ server/install/master/data.sql 2014-09-19 11:39:09 +0000
2563@@ -1,5 +1,5 @@
2564 INSERT INTO `version` (`app_ver`, `XmdsVersion`, `XlfVersion`, `DBVersion`) VALUES
2565-('1.6.2', 3, 1, 70);
2566+('1.7.0-alpha', 4, 1, 80);
2567
2568 INSERT INTO `group` (`groupID`, `group`, `IsUserSpecific`, `IsEveryone`) VALUES
2569 (1, 'Users', 0, 0),
2570@@ -84,7 +84,10 @@
2571 (78, 'User', 'SetPassword', 'manual/single.php?p=users/users#Set_Password'),
2572 (79, 'DataSet', 'ImportCSV', 'manual/single.php?p=content/content_dataset#Import_CSV'),
2573 (80, 'DisplayGroup', 'FileAssociations', 'manual/single.php?p=admin/fileassociations'),
2574-(81, 'Statusdashboard', 'General', 'manual/single.php?p=coreconcepts/dashboard#Status_Dashboard');
2575+(81, 'Statusdashboard', 'General', 'manual/single.php?p=coreconcepts/dashboard#Status_Dashboard'),
2576+(82, 'Displayprofile', 'General', 'manual/single.php?p=admin/displayprofiles'),
2577+(83, 'DisplayProfile', 'Edit', 'manual/single.php?p=admin/displayprofiles#edit'),
2578+(84, 'DisplayProfile', 'Delete', 'manual/single.php?p=admin/displayprofiles#delete');
2579
2580 INSERT INTO `menu` (`MenuID`, `Menu`) VALUES
2581 (8, 'Administration Menu'),
2582@@ -108,8 +111,9 @@
2583 (10, 'Counter', 'Counter', 0, 1, 'Customer Counter connected to a Remote Control', 'forms/counter.gif', 1, NULL, 1, 1),
2584 (11, 'datasetview', 'Data Set', 1, 1, 'A view on a DataSet', 'forms/datasetview.gif', 1, NULL, 1, 1),
2585 (12, 'shellcommand', 'Shell Command', 1, 1, 'Execute a shell command on the client', 'forms/shellcommand.gif', 1, NULL, 1, 1),
2586-(13, 'localvideo', 'Local Video', 0, 1, 'Play a video locally stored on the client', 'forms/video.gif', 1, NULL, 1, 1),
2587-(14, 'genericfile', 'Generic File', 1, 0, 'A generic file to be stored in the library', 'forms/library.gif', 1, 'apk,js,html,htm', 0, 0);
2588+(13, 'localvideo', 'Local Video', 1, 1, 'Play a video locally stored on the client', 'forms/video.gif', 1, NULL, 1, 1),
2589+(14, 'genericfile', 'Generic File', 1, 0, 'A generic file to be stored in the library', 'forms/library.gif', 1, 'apk,js,html,htm', 0, 0),
2590+(15, 'clock', 'Clock', 1, 1, 'Display a Clock', 'forms/library.gif', 1, '', 1, 1, 'html', '[]');
2591
2592 INSERT INTO `pagegroup` (`pagegroupID`, `pagegroup`) VALUES
2593 (1, 'Schedule'),
2594@@ -157,7 +161,8 @@
2595 (39, 'timeline', 3),
2596 (40, 'sessions', 9),
2597 (41, 'preview', 3),
2598-(42, 'statusdashboard', 2);
2599+(42, 'statusdashboard', 2),
2600+(43, 'displayprofile', 7);
2601
2602 INSERT INTO `menuitem` (`MenuItemID`, `MenuID`, `PageID`, `Args`, `Text`, `Class`, `Img`, `Sequence`, `External`) VALUES
2603 (1, 1, 2, NULL, 'Schedule', NULL, NULL, 1, 0),
2604@@ -193,77 +198,72 @@
2605 (36, 8, 24, NULL, 'Modules', NULL, NULL, 5, 0),
2606 (37, 6, 37, NULL, 'Campaigns', NULL, NULL, 1, 0),
2607 (38, 8, 38, NULL, 'Transitions', NULL, NULL, 6, 0),
2608-(39, 9, 30, NULL, 'Help Links', NULL, NULL, 6, 0);
2609-
2610-
2611-INSERT INTO `resolution` (`resolutionID`, `resolution`, `width`, `height`, `intended_width`, `intended_height`) VALUES
2612-(1, '4:3 Monitor', 800, 600, 1024, 768),
2613-(2, '3:2 Tv', 720, 480, 1440, 960),
2614-(3, '16:10 Widescreen Mon', 800, 500, 1680, 1050),
2615-(4, '16:9 HD Widescreen', 800, 450, 1920, 1080),
2616-(5, '3:4 Monitor', 600, 800, 768, 1024),
2617-(6, '2:3 Tv', 480, 720, 960, 1440),
2618-(7, '10:16 Widescreen', 500, 800, 1050, 1680),
2619-(8, '9:16 HD Widescreen', 450, 800, 1080, 1920);
2620-
2621-INSERT INTO `setting` (`settingid`, `setting`, `value`, `type`, `helptext`, `options`, `cat`, `userChange`) VALUES
2622-(1, 'MEDIA_DEFAULT', 'private', 'dropdown', 'Media will be created with these settings. If public everyone will be able to view and use this media.', 'private|public', 'default', 1),
2623-(2, 'LAYOUT_DEFAULT', 'private', 'dropdown', 'New layouts will be created with these settings. If public everyone will be able to view and use this layout.', 'private|public', 'default', 1),
2624-(3, 'defaultUsertype', 'user', 'dropdown', 'Sets the default user type selected when creating a user.\r\n<br />\r\nWe recommend that this is set to "User"', 'User|Group Admin|Super Admin', 'default', 1),
2625-(5, 'debug', 'Off', 'dropdown', 'Sets whether debug information is recorded when an error occurs.\r\n<br />\r\nThis should be set to "off" to ensure smaller log sizes', 'On|Off', 'error', 1),
2626-(7, 'userModule', 'module_user_general.php', 'dirselect', 'This sets which user authentication module is currently being used.', NULL, 'user', 0),
2627-(10, 'adminMessage', '', 'text', 'Sets the admin message to be displayed on the client page at all times', NULL, 'general', 0),
2628-(11, 'defaultTimezone', 'UTC', 'timezone', 'Set the default timezone for the application', 'Europe/London', 'default', 1),
2629-(18, 'mail_to', 'admin@yoursite.com', 'text', 'Errors will be mailed here', NULL, 'maintenance', 1),
2630-(19, 'mail_from', 'mail@yoursite.com', 'text', 'Mail will be sent from this address', NULL, 'maintenance', 1),
2631-(20, 'BASE_URL', 'http://localhost/xibo/', 'text', 'This is the fully qualified URI of the site. e.g http://www.xibo.co.uk/', NULL, 'general', 0),
2632-(23, 'jpg_length', '10', 'text', 'Default length for JPG files (in seconds)', NULL, 'content', 1),
2633-(24, 'ppt_width', '1024', 'text', 'Default length for PPT files', NULL, 'content', 0),
2634-(25, 'ppt_height', '768', 'text', 'Default height for PPT files', NULL, 'content', 0),
2635-(26, 'ppt_length', '120', 'text', 'Default length for PPT files (in seconds)', NULL, 'content', 1),
2636-(29, 'swf_length', '60', 'text', 'Default length for SWF files', NULL, 'content', 1),
2637-(30, 'audit', 'Off', 'dropdown', 'Turn on the auditing information. Warning this will quickly fill up the log', 'On|Off', 'error', 1),
2638-(33, 'LIBRARY_LOCATION', 'C:\\Users\\dan\\Documents\\Xibo\\release140/', 'text', NULL, NULL, 'path', 1),
2639-(34, 'SERVER_KEY', 'xsm', 'text', NULL, NULL, 'general', 1),
2640-(35, 'HELP_BASE', 'http://www.xibo.org.uk/manual/', 'text', NULL, NULL, 'path', 0),
2641-(36, 'PHONE_HOME', 'Off', 'dropdown', 'Should the server send anonymous statistics back to the Xibo project?', 'On|Off', 'general', 1),
2642-(37, 'PHONE_HOME_KEY', 'b904d63cc837b2af0b033bfcd781f364', 'text', 'Key used to distinguish each Xibo instance. This is generated randomly based on the time you first installed Xibo, and is completely untraceable.', NULL, 'general', 0),
2643-(38, 'PHONE_HOME_URL', 'http://www.xibo.org.uk/stats/track.php', 'text', 'The URL to connect to to PHONE_HOME (if enabled)', NULL, 'path', 0),
2644-(39, 'PHONE_HOME_DATE', '0', 'text', 'The last time we PHONED_HOME in seconds since the epoch', NULL, 'general', 0),
2645-(40, 'SERVER_MODE', 'Production', 'dropdown', 'This should only be set if you want to display the maximum allowed error messaging through the user interface. <br /> Useful for capturing critical php errors and environment issues.', 'Production|Test', 'error', 1),
2646-(41, 'MAINTENANCE_ENABLED', 'Off', 'dropdown', 'Allow the maintenance script to run if it is called?', 'Protected|On|Off', 'maintenance', 1),
2647-(42, 'MAINTENANCE_EMAIL_ALERTS', 'On', 'dropdown', 'Global switch for email alerts to be sent', 'On|Off', 'maintenance', 1),
2648-(43, 'MAINTENANCE_KEY', 'changeme', 'text', 'String appended to the maintenance script to prevent malicious calls to the script.', NULL, 'maintenance', 1),
2649-(44, 'MAINTENANCE_LOG_MAXAGE', '30', 'text', 'Maximum age for log entries. Set to 0 to keep logs indefinitely.', NULL, 'maintenance', 1),
2650-(45, 'MAINTENANCE_STAT_MAXAGE', '30', 'text', 'Maximum age for statistics entries. Set to 0 to keep statistics indefinitely.', NULL, 'maintenance', 1),
2651-(46, 'MAINTENANCE_ALERT_TOUT', '12', 'text', 'How long in minutes after the last time a client connects should we send an alert? Can be overridden on a per client basis.', NULL, 'maintenance', 1),
2652-(47, 'SHOW_DISPLAY_AS_VNCLINK', '', 'text', 'Turn the display name in display management into a VNC link using the IP address last collected. The %s is replaced with the IP address. Leave blank to disable.', NULL, 'general', 1),
2653-(48, 'SHOW_DISPLAY_AS_VNC_TGT', '_top', 'text', 'If the display name is shown as a link in display management, what target should the link have? Set _top to open the link in the same window or _blank to open in a new window.', NULL, 'general', 1),
2654-(49, 'MAINTENANCE_ALWAYS_ALERT', 'Off', 'dropdown', 'Should Xibo send an email if a display is in an error state every time the maintenance script runs?', 'On|Off', 'maintenance', 1),
2655-(50, 'SCHEDULE_LOOKAHEAD', 'On', 'dropdown', 'Should Xibo send future schedule information to clients?', 'On|Off', 'general', 0),
2656-(51, 'REQUIRED_FILES_LOOKAHEAD', '172800', 'text', 'How many seconds in to the future should the calls to RequiredFiles look?', NULL, 'general', 1),
2657-(52, 'REGION_OPTIONS_COLOURING', 'Media Colouring', 'dropdown', NULL, 'Media Colouring|Permissions Colouring', 'permissions', 1),
2658-(53, 'LAYOUT_COPY_MEDIA_CHECKB', 'Unchecked', 'dropdown', 'Default the checkbox for making duplicates of media when copying layouts', 'Checked|Unchecked', 'default', 1),
2659-(54, 'MAX_LICENSED_DISPLAYS', '0', 'text', 'The maximum number of licensed clients for this server installation. 0 = unlimited', NULL, 'general', 0),
2660-(55, 'LIBRARY_MEDIA_UPDATEINALL_CHECKB', 'Unchecked', 'dropdown', 'Default the checkbox for updating media on all layouts when editing in the library', 'Checked|Unchecked', 'default', 1),
2661-(56, 'USER_PASSWORD_POLICY', '', 'text', 'Regular Expression for password complexity, leave blank for no policy.', '', 'permissions', 1),
2662-(57, 'USER_PASSWORD_ERROR', '', 'text', 'A text description of this password policy. Will be show to users when their password does not meet the required policy', '', 'permissions', 1),
2663-(58, 'MODULE_CONFIG_LOCKED_CHECKB', 'Unchecked', 'dropdown', 'Is the module config locked? Useful for Service providers.', 'Checked|Unchecked', 'general', 0),
2664-(59, 'LIBRARY_SIZE_LIMIT_KB', '0', 'text', 'The Limit for the Library Size in KB', NULL, 'content', 0),
2665-(60, 'MONTHLY_XMDS_TRANSFER_LIMIT_KB', '0', 'text', 'XMDS Transfer Limit in KB/month', NULL, 'general', 0),
2666-(61, 'DEFAULT_LANGUAGE', 'en_GB', 'text', 'The default language to use', NULL, 'general', 1),
2667-(62, 'TRANSITION_CONFIG_LOCKED_CHECKB', 'Unchecked', 'dropdown', 'Is the Transition config locked?', 'Checked|Unchecked', 'general', 0),
2668-(63, 'GLOBAL_THEME_NAME', 'default', 'text', 'The Theme to apply to all pages by default', NULL, 'general', 1),
2669-(64, 'DEFAULT_LAT', '51.504', 'text', 'The Latitude to apply for any Geo aware Previews', NULL, 'general', 1),
2670-(65, 'DEFAULT_LONG', '-0.104', 'text', 'The Longitude to apply for any Geo aware Previews', NULL, 'general', 1),
2671-(66, 'SCHEDULE_WITH_VIEW_PERMISSION', 'No', 'dropdown', 'Should users with View permissions on displays be allowed to schedule to them?', 'Yes|No', 'permissions', '1'),
2672-(67, 'SETTING_IMPORT_ENABLED', 'Off', 'dropdown', NULL , 'On|Off', 'general', '0'),
2673-(68, 'SETTING_LIBRARY_TIDY_ENABLED', 'Off', 'dropdown', NULL , 'On|Off', 'general', '0'),
2674-(69, 'SENDFILE_MODE', 'Off', 'dropdown', 'When a user downloads a file from the library or previews a layout, should we attempt to use Apache X-Sendfile, Nginx X-Accel, or PHP (Off) to return the file from the library?', 'Off|Apache|Nginx', 'general', '1'),
2675-(70, 'EMBEDDED_STATUS_WIDGET', '', 'text', 'HTML to embed in an iframe on the Status Dashboard' , NULL, 'general', '0'),
2676-(71, 'PROXY_HOST', '', 'text', 'The Proxy URL' , NULL, 'general', '1'),
2677-(72, 'PROXY_PORT', '', 'text', 'The Proxy Port' , NULL, 'general', '1'),
2678-(73, 'PROXY_AUTH', '', 'text', 'The Authentication information for this proxy. username:password' , NULL, 'general', '1');
2679+(39, 9, 30, NULL, 'Help Links', NULL, NULL, 6, 0),
2680+(40, 7, 43, NULL, 'Display Settings', NULL, NULL, 4, 0);
2681+
2682+
2683+INSERT INTO `resolution` (`resolutionID`, `resolution`, `width`, `height`, `intended_width`, `intended_height`, `version`, `enabled`) VALUES
2684+(9, '1080p HD Landscape', 800, 450, 1920, 1080, 2, 1),
2685+(10, '720p HD Landscape', 800, 450, 1280, 720, 2, 1),
2686+(11, '1080p HD Portrait', 450, 800, 1080, 1920, 2, 1),
2687+(12, '720p HD Portrait', 450, 800, 720, 1280, 2, 1),
2688+(13, '4k', 800, 450, 4096, 2304, 2, 1),
2689+(14, 'Common PC Monitor 4:3', 800, 600, 1024, 768, 2, 1);
2690+
2691+INSERT INTO `setting` (`settingid`, `setting`, `value`, `fieldType`, `helptext`, `options`, `cat`, `userChange`, `title`, `validation`, `ordering`, `default`, `userSee`, `type`) VALUES
2692+(1, 'MEDIA_DEFAULT', 'private', 'dropdown', 'Media will be created with these settings. If public everyone will be able to view and use this media.', 'private|public', 'permissions', 1, 'Media Permissions', '', 20, 'private', 1, 'word'),
2693+(2, 'LAYOUT_DEFAULT', 'private', 'dropdown', 'New layouts will be created with these settings. If public everyone will be able to view and use this layout.', 'private|public', 'permissions', 1, 'Layout Permissions', '', 10, 'private', 1, 'word'),
2694+(3, 'defaultUsertype', 'User', 'dropdown', 'Sets the default user type selected when creating a user.\r\n<br />\r\nWe recommend that this is set to "User"', 'User|Group Admin|Super Admin', 'users', 1, 'Default User Type', '', 10, 'User', 1, 'string'),
2695+(5, 'debug', 'Off', 'dropdown', 'Sets whether debug information is recorded when an error occurs.\r\n<br />\r\nThis should be set to "off" to ensure smaller log sizes', 'On|Off', 'troubleshooting', 1, 'Enable Debugging?', '', 10, 'Off', 1, 'word'),
2696+(7, 'userModule', 'module_user_general.php', 'dirselect', 'This sets which user authentication module is currently being used.', NULL, 'users', 0, 'User Module', '', 0, 'module_user_general.php', 0, 'string'),
2697+(11, 'defaultTimezone', 'Europe/London', 'timezone', 'Set the default timezone for the application', 'Europe/London', 'regional', 1, 'Timezone', '', 20, 'Europe/London', 1, 'string'),
2698+(18, 'mail_to', 'mail@yoursite.com', 'email', 'Errors will be mailed here', NULL, 'maintenance', 1, 'Admin email address', '', 30, 'mail@yoursite.com', 1, 'string'),
2699+(19, 'mail_from', 'mail@yoursite.com', 'email', 'Mail will be sent from this address', NULL, 'maintenance', 1, 'Sending email address', '', 40, 'mail@yoursite.com', 1, 'string'),
2700+(23, 'jpg_length', '10', 'number', 'Default length for JPG files (in seconds)', NULL, 'content', 1, 'Default Image Duration', '', 30, '10', 1, 'int'),
2701+(26, 'ppt_length', '10', 'number', 'Default length for PPT files (in seconds)', NULL, 'content', 1, 'Default PowerPoint Duration', '', 10, '10', 1, 'int'),
2702+(29, 'swf_length', '10', 'number', 'Default length for SWF files', NULL, 'content', 1, 'Default Flash Duration', '', 20, '10', 1, 'int'),
2703+(30, 'audit', 'Off', 'dropdown', 'Turn on the auditing information. Warning this will quickly fill up the log', 'On|Off', 'troubleshooting', 1, 'Enable Auditing?', '', 20, 'Off', 1, 'word'),
2704+(33, 'LIBRARY_LOCATION', '', 'text', 'The fully qualified path to the CMS library location.', NULL, 'configuration', 1, 'Library Location', 'required', 10, '', 1, 'string'),
2705+(34, 'SERVER_KEY', '', 'text', NULL, NULL, 'configuration', 1, 'CMS Secret Key', 'required', 20, '', 1, 'string'),
2706+(35, 'HELP_BASE', 'http://www.xibo.org.uk/manual/', 'text', NULL, NULL, 'general', 1, 'Location of the Manual', 'required', 10, 'http://www.xibo.org.uk/manual/', 1, 'string'),
2707+(36, 'PHONE_HOME', 'On', 'dropdown', 'Should the server send anonymous statistics back to the Xibo project?', 'On|Off', 'general', 1, 'Allow usage tracking?', '', 10, 'On', 1, 'word'),
2708+(37, 'PHONE_HOME_KEY', '', 'text', 'Key used to distinguish each Xibo instance. This is generated randomly based on the time you first installed Xibo, and is completely untraceable.', NULL, 'general', 0, 'Phone home key', '', 20, '', 0, 'string'),
2709+(38, 'PHONE_HOME_URL', 'http://www.xibo.org.uk/stats/track.php', 'text', 'The URL to connect to to PHONE_HOME (if enabled)', NULL, 'network', 0, 'Phone home URL', '', 60, 'http://www.xibo.org.uk/stats/track.php', 0, 'string'),
2710+(39, 'PHONE_HOME_DATE', '0', 'text', 'The last time we PHONED_HOME in seconds since the epoch', NULL, 'general', 0, 'Phone home time', '', 30, '0', 0, 'int'),
2711+(40, 'SERVER_MODE', 'Production', 'dropdown', 'This should only be set if you want to display the maximum allowed error messaging through the user interface. <br /> Useful for capturing critical php errors and environment issues.', 'Production|Test', 'troubleshooting', 1, 'Server Mode', '', 30, 'Production', 1, 'word'),
2712+(41, 'MAINTENANCE_ENABLED', 'Off', 'dropdown', 'Allow the maintenance script to run if it is called?', 'Protected|On|Off', 'maintenance', 1, 'Enable Maintenance?', '', 10, 'Off', 1, 'word'),
2713+(42, 'MAINTENANCE_EMAIL_ALERTS', 'On', 'dropdown', 'Global switch for email alerts to be sent', 'On|Off', 'maintenance', 1, 'Enable Email Alerts?', '', 20, 'On', 1, 'word'),
2714+(43, 'MAINTENANCE_KEY', 'changeme', 'text', 'String appended to the maintenance script to prevent malicious calls to the script.', NULL, 'maintenance', 1, 'Maintenance Key', '', 50, 'changeme', 1, 'string'),
2715+(44, 'MAINTENANCE_LOG_MAXAGE', '30', 'number', 'Maximum age for log entries. Set to 0 to keep logs indefinitely.', NULL, 'maintenance', 1, 'Max Log Age', '', 60, '30', 1, 'int'),
2716+(45, 'MAINTENANCE_STAT_MAXAGE', '30', 'number', 'Maximum age for statistics entries. Set to 0 to keep statistics indefinitely.', NULL, 'maintenance', 1, 'Max Statistics Age', '', 70, '30', 1, 'int'),
2717+(46, 'MAINTENANCE_ALERT_TOUT', '12', 'number', 'How long in minutes after the last time a client connects should we send an alert? Can be overridden on a per client basis.', NULL, 'maintenance', 1, 'Max Display Timeout', '', 80, '12', 1, 'int'),
2718+(47, 'SHOW_DISPLAY_AS_VNCLINK', '0', 'checkbox', 'Turn the display name in display management into a VNC link using the IP address last collected. The %s is replaced with the IP address. Leave blank to disable.', NULL, 'displays', 1, 'Display a VNC Link?', '', 30, '0', 1, 'checkbox'),
2719+(48, 'SHOW_DISPLAY_AS_VNC_TGT', '_top', 'text', 'If the display name is shown as a link in display management, what target should the link have? Set _top to open the link in the same window or _blank to open in a new window.', NULL, 'displays', 1, 'Open VNC Link in new window?', '', 40, '_top', 1, 'string'),
2720+(49, 'MAINTENANCE_ALWAYS_ALERT', 'Off', 'dropdown', 'Should Xibo send an email if a display is in an error state every time the maintenance script runs?', 'On|Off', 'maintenance', 1, 'Send repeat Display Timeouts', '', 80, 'Off', 1, 'word'),
2721+(50, 'SCHEDULE_LOOKAHEAD', 'On', 'dropdown', 'Should Xibo send future schedule information to clients?', 'On|Off', 'general', 0, 'Send Schedule in advance?', '', 40, 'On', 1, 'word'),
2722+(51, 'REQUIRED_FILES_LOOKAHEAD', '172800', 'number', 'How many seconds in to the future should the calls to RequiredFiles look?', NULL, 'general', 1, 'Send files in advance?', '', 50, '172800', 1, 'int'),
2723+(52, 'REGION_OPTIONS_COLOURING', 'Media Colouring', 'dropdown', NULL, 'Media Colouring|Permissions Colouring', 'permissions', 1, 'How to colour Media on the Region Timeline', '', 30, 'Media Colouring', 1, 'string'),
2724+(53, 'LAYOUT_COPY_MEDIA_CHECKB', 'Unchecked', 'dropdown', 'Default the checkbox for making duplicates of media when copying layouts', 'Checked|Unchecked', 'defaults', 1, 'Default copy media when copying a layout?', '', 20, 'Unchecked', 1, 'word'),
2725+(54, 'MAX_LICENSED_DISPLAYS', '0', 'number', 'The maximum number of licensed clients for this server installation. 0 = unlimited', NULL, 'displays', 0, 'Number of display slots', '', 50, '0', 0, 'int'),
2726+(55, 'LIBRARY_MEDIA_UPDATEINALL_CHECKB', 'Unchecked', 'dropdown', 'Default the checkbox for updating media on all layouts when editing in the library', 'Checked|Unchecked', 'defaults', 1, 'Default update media in all layouts', '', 10, 'Unchecked', 1, 'word'),
2727+(56, 'USER_PASSWORD_POLICY', '', 'text', 'Regular Expression for password complexity, leave blank for no policy.', '', 'users', 1, 'Password Policy Regular Expression', '', 20, '', 1, 'string'),
2728+(57, 'USER_PASSWORD_ERROR', '', 'text', 'A text description of this password policy. Will be show to users when their password does not meet the required policy', '', 'users', 1, 'Description of Password Policy', '', 30, '', 1, 'string'),
2729+(58, 'MODULE_CONFIG_LOCKED_CHECKB', 'Unchecked', 'dropdown', 'Is the module config locked? Useful for Service providers.', 'Checked|Unchecked', 'defaults', 0, 'Lock Module Config', '', 30, 'Unchecked', 0, 'word'),
2730+(59, 'LIBRARY_SIZE_LIMIT_KB', '0', 'number', 'The Limit for the Library Size in KB', NULL, 'network', 0, 'Library Size Limit', '', 50, '0', 1, 'int'),
2731+(60, 'MONTHLY_XMDS_TRANSFER_LIMIT_KB', '0', 'number', 'XMDS Transfer Limit in KB/month', NULL, 'network', 0, 'Monthly bandwidth Limit', '', 40, '0', 1, 'int'),
2732+(61, 'DEFAULT_LANGUAGE', 'en_GB', 'text', 'The default language to use', NULL, 'regional', 1, 'Default Language', '', 10, 'en_GB', 1, 'string'),
2733+(62, 'TRANSITION_CONFIG_LOCKED_CHECKB', 'Unchecked', 'dropdown', 'Is the Transition config locked?', 'Checked|Unchecked', 'defaults', 0, 'Allow modifications to the transition configuration?', '', 40, 'Unchecked', 1, 'word'),
2734+(63, 'GLOBAL_THEME_NAME', 'default', 'text', 'The Theme to apply to all pages by default', NULL, 'configuration', 1, 'CMS Theme', '', 30, 'default', 1, 'word'),
2735+(64, 'DEFAULT_LAT', '51.504', 'number', 'The Latitude to apply for any Geo aware Previews', NULL, 'displays', 1, 'Default Latitude', '', 10, '51.504', 1, 'double'),
2736+(65, 'DEFAULT_LONG', '-0.104', 'number', 'The Longitude to apply for any Geo aware Previews', NULL, 'displays', 1, 'Default Longitude', '', 20, '-0.104', 1, 'double'),
2737+(66, 'SCHEDULE_WITH_VIEW_PERMISSION', 'No', 'dropdown', 'Should users with View permissions on displays be allowed to schedule to them?', 'Yes|No', 'permissions', 1, 'Schedule with view permissions?', '', 40, 'No', 1, 'word'),
2738+(67, 'SETTING_IMPORT_ENABLED', '1', 'checkbox', NULL, NULL, 'general', 1, 'Allow Import?', '', 80, '1', 1, 'checkbox'),
2739+(68, 'SETTING_LIBRARY_TIDY_ENABLED', '1', 'checkbox', NULL, NULL, 'general', 1, 'Enable Library Tidy?', '', 90, '1', 1, 'checkbox'),
2740+(69, 'SENDFILE_MODE', 'Off', 'dropdown', 'When a user downloads a file from the library or previews a layout, should we attempt to use Apache X-Sendfile, Nginx X-Accel, or PHP (Off) to return the file from the library?', 'Off|Apache|Nginx', 'general', 1, 'File download mode', '', 60, 'Off', 1, 'word'),
2741+(70, 'EMBEDDED_STATUS_WIDGET', '', 'text', 'HTML to embed in an iframe on the Status Dashboard', NULL, 'general', 0, 'Status Dashboard Widget', '', 70, '', 1, 'htmlstring'),
2742+(71, 'PROXY_HOST', '', 'text', 'The Proxy URL', NULL, 'network', 1, 'Proxy URL', '', 10, '', 1, 'string'),
2743+(72, 'PROXY_PORT', '0', 'number', 'The Proxy Port', NULL, 'network', 1, 'Proxy Port', '', 20, '0', 1, 'int'),
2744+(73, 'PROXY_AUTH', '', 'text', 'The Authentication information for this proxy. username:password', NULL, 'network', 1, 'Proxy Credentials', '', 30, '', 1, 'string');
2745
2746 INSERT INTO `usertype` (`usertypeid`, `usertype`) VALUES
2747 (1, 'Super Admin'),
2748@@ -271,19 +271,10 @@
2749 (3, 'User');
2750
2751 INSERT INTO `user` (`UserID`, `usertypeid`, `UserName`, `UserPassword`, `loggedin`, `lastaccessed`, `email`, `homepage`, `Retired`) VALUES
2752-(1, 1, 'xibo_admin', '21232f297a57a5a743894a0e4a801fc3', 1, '2013-02-02 15:07:29', 'info@xibo.org.uk', 'statusdashboard', 0);
2753-
2754-INSERT INTO `template` (`templateID`, `template`, `xml`, `userID`, `createdDT`, `modifiedDT`, `description`, `tags`, `thumbnail`, `isSystem`, `retired`) VALUES
2755-(1, 'Full Screen 16:9', '<?xml version="1.0"?>\n<layout schemaVersion="1" width="800" height="450" bgcolor="#000000"><region id="47ff29524ce1b" width="800" height="450" top="0" left="0"/></layout>\n', 1, '2008-01-01 01:00:00', '2008-01-01 01:00:00', '', 'fullscreen', NULL, 1, 0),
2756-(2, 'Full Screen 16:10', '<?xml version="1.0"?>\n<layout schemaVersion="1" width="800" height="500" bgcolor="#000000"><region id="47ff29524ce1b" width="800" height="500" top="0" left="0"/></layout>\n', 1, '2008-01-01 01:00:00', '2008-01-01 01:00:00', '', 'fullscreen', NULL, 1, 0),
2757-(3, 'Full Screen 4:3', '<?xml version="1.0"?>\n<layout schemaVersion="1" width="800" height="600" bgcolor="#000000"><region id="47ff29524ce1b" width="800" height="600" top="0" left="0"/></layout>\n', 1, '2008-01-01 01:00:00', '2008-01-01 01:00:00', '', 'fullscreen', NULL, 1, 0),
2758-(4, 'Full Screen 3:2', '<?xml version="1.0"?>\n<layout schemaVersion="1" width="720" height="480" bgcolor="#000000"><region id="47ff29524ce1b" width="720" height="480" top="0" left="0"/></layout>\n', 1, '2008-01-01 01:00:00', '2008-01-01 01:00:00', '', 'fullscreen', NULL, 1, 0),
2759-(5, 'Portrait - 10:16', '<?xml version="1.0"?>\n<layout width="500" height="800" bgcolor="#000000" background="" schemaVersion="1"><region id="47ff2f524ae1b" width="500" height="800" top="0" left="0"/></layout>\n', 1, '2008-01-01 01:00:00', '2008-01-01 01:00:00', '', '', NULL, 1, 0),
2760-(6, 'Portrait - 9:16', '<?xml version="1.0"?>\n<layout width="450" height="800" bgcolor="#000000" background="" schemaVersion="1"><region id="47ff2f524be1b" width="450" height="800" top="0" left="0"/></layout>\n', 1, '2008-01-01 01:00:00', '2008-01-01 01:00:00', '', '', NULL, 1, 0),
2761-(7, 'Portrait - 3:4', '<?xml version="1.0"?>\n<layout width="600" height="800" bgcolor="#000000" background="" schemaVersion="1"><region id="47ff2f524ce1b" width="600" height="800" top="0" left="0"/></layout>\n', 1, '2008-01-01 01:00:00', '2008-01-01 01:00:00', '', '', NULL, 1, 0),
2762-(8, 'Portrait - 2:3', '<?xml version="1.0"?>\n<layout width="480" height="720" bgcolor="#000000" background="" schemaVersion="1"><region id="47ff2f524de1b" width="480" height="720" top="0" left="0"/></layout>\n', 1, '2008-01-01 01:00:00', '2008-01-01 01:00:00', '', '', NULL, 1, 0);
2763-
2764-INSERT INTO `layout` (`layoutID`, `layout`, `xml`, `userID`, `createdDT`, `modifiedDT`, `description`, `tags`, `templateID`, `retired`, `duration`, `background`) VALUES
2765+(1, 1, 'xibo_admin', '21232f297a57a5a743894a0e4a801fc3', 1, NOW(), '', 'statusdashboard', 0);
2766+
2767+
2768+INSERT INTO `layout` (`layoutID`, `layout`, `xml`, `userID`, `createdDT`, `modifiedDT`, `description`, `tags`, `templateID`, `retired`, `duration`, `backgroundImageId`) VALUES
2769 (4, 'Default Layout', '<?xml version="1.0"?><layout schemaVersion="1" width="800" height="450" bgcolor="#000000"><region id="47ff29524ce1b" width="800" height="401" top="0" left="0" userId="1"><media id="522caef6e13cb6c9fe5fac15dde59ef7" type="text" duration="15" lkid="" userId="1" schemaVersion="1">
2770 <options><xmds>1</xmds><direction>none</direction><scrollSpeed>2</scrollSpeed><fitText>0</fitText></options>
2771 <raw><text><![CDATA[<p style="text-align: center;"><strong><span style="font-family:arial,helvetica,sans-serif;"><span style="font-size:72px;"><span style="color:#FFFFFF;">Welcome to&nbsp;<br />
2772@@ -331,16 +322,6 @@
2773 (9, 41, 1),
2774 (10, 42, 1);
2775
2776-INSERT INTO `lktemplategroup` (`LkTemplateGroupID`, `TemplateID`, `GroupID`, `View`, `Edit`, `Del`) VALUES
2777-(1, 1, 2, 1, 0, 0),
2778-(2, 2, 2, 1, 0, 0),
2779-(3, 3, 2, 1, 0, 0),
2780-(4, 4, 2, 1, 0, 0),
2781-(5, 5, 2, 1, 0, 0),
2782-(6, 6, 2, 1, 0, 0),
2783-(7, 7, 2, 1, 0, 0),
2784-(8, 8, 2, 1, 0, 0);
2785-
2786 INSERT INTO `lkusergroup` (`LkUserGroupID`, `GroupID`, `UserID`) VALUES
2787 (10, 3, 1);
2788
2789@@ -357,3 +338,20 @@
2790 INSERT INTO `datasetcolumntype` (`DataSetColumnTypeID`, `DataSetColumnType`) VALUES
2791 (1, 'Value'),
2792 (2, 'Formula');
2793+
2794+INSERT INTO `displayprofile` (`displayprofileid`, `name`, `type`, `config`, `isdefault`, `userid`) VALUES
2795+(1, 'Production', 'windows', '[{"name":"collectInterval","value":"900","type":"int"},{"name":"powerpointEnabled","value":1,"type":"checkbox"},{"name":"statsEnabled","value":1,"type":"checkbox"},{"name":"sizeX","value":"1280","type":"double"},{"name":"sizeY","value":"720","type":"double"},{"name":"offsetX","value":0,"type":"double"},{"name":"offsetY","value":0,"type":"double"},{"name":"ShowInTaskbar","value":1,"type":"checkbox"},{"name":"ClientInfomationCtrlKey","value":0,"type":"checkbox"},{"name":"ClientInformationKeyCode","value":"I","type":"word"},{"name":"CursorStartPosition","value":"Bottom Right","type":"string"},{"name":"DoubleBuffering","value":1,"type":"checkbox"},{"name":"emptyLayoutDuration","value":"1","type":"int"},{"name":"EnableMouse","value":0,"type":"checkbox"},{"name":"EnableShellCommands","value":1,"type":"checkbox"},{"name":"expireModifiedLayouts","value":1,"type":"checkbox"},{"name":"LogLevel","value":"audit","type":"word"},{"name":"LogToDiskLocation","value":"","type":"string"},{"name":"MaxConcurrentDownloads","value":"2","type":"int"},{"name":"ShellCommandAllowList","value":"","type":"string"}]', 1, 1),
2796+(2, 'Production', 'android', '[{"name":"emailAddress","value":"dan@springsignage.com","type":"string"},{"name":"settingsPassword","value":"test2","type":"string"},{"name":"collectInterval","value":"600","type":"int"},{"name":"orientation","value":0,"type":"int"},{"name":"startOnBoot","value":0,"type":"checkbox"},{"name":"actionBarMode","value":"1","type":"int"},{"name":"actionBarDisplayDuration","value":"60","type":"int"},{"name":"screenDimensions","value":"","type":"string"},{"name":"autoRestart","value":0,"type":"checkbox"},{"name":"startOnBootDelay","value":"60","type":"int"},{"name":"blacklistVideo","value":1,"type":"checkbox"},{"name":"storeHtmlOnInternal","value":1,"type":"checkbox"}]', 1, 1);
2797+
2798+INSERT INTO `bandwidthtype` (`bandwidthtypeid`, `name`) VALUES
2799+(1, 'Register'),
2800+(2, 'Required Files'),
2801+(3, 'Schedule'),
2802+(4, 'Get File'),
2803+(5, 'Get Resource'),
2804+(6, 'Media Inventory'),
2805+(7, 'Notify Status'),
2806+(8, 'Submit Stats'),
2807+(9, 'Submit Log'),
2808+(10, 'Blacklist'),
2809+(11, 'Screen Shot');
2810
2811=== modified file 'server/install/master/structure.sql'
2812--- server/install/master/structure.sql 2014-07-18 22:43:48 +0000
2813+++ server/install/master/structure.sql 2014-09-19 11:39:09 +0000
2814@@ -88,11 +88,14 @@
2815 `GeoLocation` POINT NULL,
2816 `version_instructions` varchar(255) NULL,
2817 `client_type` VARCHAR( 20 ) NULL ,
2818- `client_version` VARCHAR( 5 ) NULL ,
2819+ `client_version` VARCHAR( 15 ) NULL ,
2820 `client_code` SMALLINT NULL,
2821+ `displayprofileid` int(11) NULL,
2822+ `currentLayoutId` int(11) NULL,
2823+ `screenShotRequested` tinyint(4) NOT NULL DEFAULT '0',
2824 PRIMARY KEY (`displayid`),
2825 KEY `defaultplaylistid` (`defaultlayoutid`)
2826-) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;
2827+) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
2828
2829 CREATE TABLE IF NOT EXISTS `displaygroup` (
2830 `DisplayGroupID` int(11) NOT NULL AUTO_INCREMENT,
2831@@ -138,7 +141,7 @@
2832 `templateID` int(11) DEFAULT NULL COMMENT 'The ID of the template',
2833 `retired` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'Is this layout retired',
2834 `duration` int(11) NOT NULL DEFAULT '0' COMMENT 'The duration in seconds',
2835- `background` varchar(254) DEFAULT NULL,
2836+ `backgroundImageId` int(11) DEFAULT NULL,
2837 `status` TINYINT NOT NULL DEFAULT '0',
2838 PRIMARY KEY (`layoutID`)
2839 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Layouts' AUTO_INCREMENT=5 ;
2840@@ -355,6 +358,8 @@
2841 `ValidExtensions` varchar(254) DEFAULT NULL,
2842 `PreviewEnabled` tinyint(4) NOT NULL DEFAULT '1',
2843 `assignable` tinyint(4) NOT NULL DEFAULT '1',
2844+ `render_as` varchar(10) DEFAULT NULL,
2845+ `settings` TEXT,
2846 PRIMARY KEY (`ModuleID`)
2847 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Functional Modules' AUTO_INCREMENT=14 ;
2848
2849@@ -448,11 +453,13 @@
2850
2851 CREATE TABLE IF NOT EXISTS `resolution` (
2852 `resolutionID` int(11) NOT NULL AUTO_INCREMENT,
2853- `resolution` varchar(20) NOT NULL,
2854+ `resolution` varchar(254) NOT NULL,
2855 `width` smallint(6) NOT NULL,
2856 `height` smallint(6) NOT NULL,
2857 `intended_width` smallint(6) NOT NULL,
2858 `intended_height` smallint(6) NOT NULL,
2859+ `version` tinyint(4) NOT NULL DEFAULT '1',
2860+ `enabled` tinyint(4) NOT NULL DEFAULT '1',
2861 PRIMARY KEY (`resolutionID`)
2862 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Supported Resolutions' AUTO_INCREMENT=9 ;
2863
2864@@ -460,13 +467,14 @@
2865 `eventID` int(11) NOT NULL AUTO_INCREMENT,
2866 `CampaignID` int(11) NOT NULL,
2867 `DisplayGroupIDs` varchar(254) NOT NULL COMMENT 'A list of the display group ids for this event',
2868- `recurrence_type` enum('Hour','Day','Week','Month','Year') DEFAULT NULL,
2869+ `recurrence_type` enum('Minute','Hour','Day','Week','Month','Year') DEFAULT NULL,
2870 `recurrence_detail` varchar(100) DEFAULT NULL,
2871 `userID` int(11) NOT NULL,
2872 `is_priority` tinyint(4) NOT NULL,
2873 `FromDT` bigint(20) NOT NULL DEFAULT '0',
2874 `ToDT` bigint(20) NOT NULL DEFAULT '0',
2875 `recurrence_range` bigint(20) DEFAULT NULL,
2876+ `DisplayOrder` int(11) NOT NULL DEFAULT '0',
2877 PRIMARY KEY (`eventID`),
2878 KEY `layoutID` (`CampaignID`)
2879 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='High level schedule information' AUTO_INCREMENT=2 ;
2880@@ -474,15 +482,11 @@
2881 CREATE TABLE IF NOT EXISTS `schedule_detail` (
2882 `schedule_detailID` int(11) NOT NULL AUTO_INCREMENT,
2883 `DisplayGroupID` int(11) NOT NULL,
2884- `CampaignID` int(11) NOT NULL,
2885 `userID` int(8) NOT NULL DEFAULT '1' COMMENT 'Owner of the Event',
2886- `is_priority` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'This scheduled event has priority and will take precidence over any others scheduled',
2887 `eventID` int(11) DEFAULT NULL,
2888 `FromDT` bigint(20) NOT NULL DEFAULT '0',
2889 `ToDT` bigint(20) NOT NULL DEFAULT '0',
2890- `DisplayOrder` int(11) NOT NULL DEFAULT '0',
2891 PRIMARY KEY (`schedule_detailID`),
2892- KEY `layoutID` (`CampaignID`),
2893 KEY `scheduleID` (`eventID`),
2894 KEY `DisplayGroupID` (`DisplayGroupID`)
2895 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Replicated schedule across displays and recurrence' AUTO_INCREMENT=6 ;
2896@@ -506,13 +510,19 @@
2897 `settingid` int(11) NOT NULL AUTO_INCREMENT,
2898 `setting` varchar(50) NOT NULL,
2899 `value` varchar(1000) NOT NULL,
2900- `type` varchar(24) NOT NULL,
2901- `helptext` text ,
2902+ `fieldType` varchar(24) NOT NULL,
2903+ `helptext` text,
2904 `options` varchar(254) DEFAULT NULL,
2905 `cat` varchar(24) NOT NULL DEFAULT 'general',
2906 `userChange` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Can the user change this setting',
2907+ `title` varchar(254) NOT NULL,
2908+ `validation` varchar(50) NOT NULL,
2909+ `ordering` int(11) NOT NULL,
2910+ `default` varchar(1000) NOT NULL,
2911+ `userSee` tinyint(4) NOT NULL DEFAULT '1',
2912+ `type` varchar(50) NOT NULL,
2913 PRIMARY KEY (`settingid`)
2914-) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=62 ;
2915+) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=74 ;
2916
2917 CREATE TABLE IF NOT EXISTS `stat` (
2918 `statID` bigint(20) NOT NULL AUTO_INCREMENT,
2919@@ -566,6 +576,7 @@
2920 `homepage` varchar(254) NOT NULL DEFAULT 'dashboard.php' COMMENT 'The users homepage',
2921 `Retired` tinyint(4) NOT NULL DEFAULT '0',
2922 `CSPRNG` tinyint(4) NOT NULL DEFAULT '0',
2923+ `newUserWizard` tinyint(4) NOT NULL DEFAULT '0',
2924 PRIMARY KEY (`UserID`),
2925 KEY `usertypeid` (`usertypeid`)
2926 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;
2927@@ -610,7 +621,39 @@
2928 `RegionID` varchar(50) NOT NULL,
2929 `MediaID` varchar(50) NOT NULL,
2930 PRIMARY KEY (`LkDataSetLayoutID`)
2931-) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
2932+) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
2933+
2934+CREATE TABLE IF NOT EXISTS `displayprofile` (
2935+ `displayprofileid` int(11) NOT NULL AUTO_INCREMENT,
2936+ `name` varchar(50) NOT NULL,
2937+ `type` varchar(15) NOT NULL,
2938+ `config` text NOT NULL,
2939+ `isdefault` int(11) NOT NULL,
2940+ `userid` int(11) NOT NULL,
2941+ PRIMARY KEY (`displayprofileid`)
2942+) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
2943+
2944+CREATE TABLE IF NOT EXISTS `xmdsnonce` (
2945+ `nonceId` bigint(20) NOT NULL AUTO_INCREMENT,
2946+ `nonce` varchar(100) NOT NULL,
2947+ `expiry` int(11) NOT NULL,
2948+ `lastUsed` int(11) DEFAULT NULL,
2949+ `displayId` int(11) NOT NULL,
2950+ `fileId` int(11) DEFAULT NULL,
2951+ `size` bigint(20) DEFAULT NULL,
2952+ `storedAs` varchar(100) DEFAULT NULL,
2953+ `layoutId` int(11) DEFAULT NULL,
2954+ `regionId` varchar(100) DEFAULT NULL,
2955+ `mediaId` varchar(100) DEFAULT NULL,
2956+ PRIMARY KEY (`nonceId`)
2957+) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
2958+
2959+CREATE TABLE IF NOT EXISTS `bandwidthtype` (
2960+ `bandwidthtypeid` int(11) NOT NULL AUTO_INCREMENT,
2961+ `name` varchar(25) NOT NULL,
2962+ PRIMARY KEY (`bandwidthtypeid`)
2963+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=12 ;
2964+
2965
2966 --
2967 -- Constraints for dumped tables
2968@@ -702,7 +745,6 @@
2969 ADD CONSTRAINT `schedule_ibfk_1` FOREIGN KEY (`CampaignID`) REFERENCES `campaign` (`CampaignID`);
2970
2971 ALTER TABLE `schedule_detail`
2972- ADD CONSTRAINT `schedule_detail_ibfk_9` FOREIGN KEY (`CampaignID`) REFERENCES `campaign` (`CampaignID`),
2973 ADD CONSTRAINT `schedule_detail_ibfk_7` FOREIGN KEY (`eventID`) REFERENCES `schedule` (`eventID`),
2974 ADD CONSTRAINT `schedule_detail_ibfk_8` FOREIGN KEY (`DisplayGroupID`) REFERENCES `displaygroup` (`DisplayGroupID`);
2975
2976
2977=== added file 'server/install/upgradestep.class.php'
2978--- server/install/upgradestep.class.php 1970-01-01 00:00:00 +0000
2979+++ server/install/upgradestep.class.php 2014-09-19 11:39:09 +0000
2980@@ -0,0 +1,51 @@
2981+<?php
2982+/*
2983+ * Xibo - Digital Signage - http://www.xibo.org.uk
2984+ * Copyright (C) 2006-2014 Daniel Garner
2985+ *
2986+ * This file is part of Xibo.
2987+ *
2988+ * Xibo is free software: you can redistribute it and/or modify
2989+ * it under the terms of the GNU Affero General Public License as published by
2990+ * the Free Software Foundation, either version 3 of the License, or
2991+ * any later version.
2992+ *
2993+ * Xibo is distributed in the hope that it will be useful,
2994+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2995+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2996+ * GNU Affero General Public License for more details.
2997+ *
2998+ * You should have received a copy of the GNU Affero General Public License
2999+ * along with Xibo. If not, see <http://www.gnu.org/licenses/>.
3000+ */
3001+defined('XIBO') or die("Sorry, you are not allowed to directly access this page.<br /> Please press the back button in your browser.");
3002+
3003+class UpgradeStep
3004+{
3005+ protected $db;
3006+ protected $q;
3007+ protected $a;
3008+
3009+ public function __construct($db)
3010+ {
3011+ $this->db =& $db;
3012+ $this->q = array();
3013+ $this->a = array();
3014+ }
3015+
3016+ public function Boot()
3017+ {
3018+
3019+ }
3020+
3021+ public function Questions()
3022+ {
3023+ return array();
3024+ }
3025+
3026+ public function ValidateQuestion($questionNumber,$response)
3027+ {
3028+ return true;
3029+ }
3030+}
3031+?>
3032
3033=== modified file 'server/lib/app/app_functions.php'
3034--- server/lib/app/app_functions.php 2014-01-18 09:47:41 +0000
3035+++ server/lib/app/app_functions.php 2014-09-19 11:39:09 +0000
3036@@ -40,112 +40,6 @@
3037 $_SESSION['message'] = $message;
3038 }
3039
3040-// Returns a drop down list based on the provided SQL - the ID should be the first field, and the name the second
3041-function dropdownlist($SQL, $list_name, $selected = "", $callback = "", $flat_list = false, $checkPermissions = false, $userid = "", $permissionLevel = "see", $useQueryId = false) {
3042- global $db;
3043- global $user;
3044-
3045- if (!$result = $db->query($SQL))
3046- {
3047- trigger_error($db->error());
3048- return "Query Error";
3049- }
3050-
3051- if ($db->num_rows($result)==0)
3052- {
3053- $list = "No selections available";
3054- return $list;
3055- }
3056-
3057- if ($flat_list)
3058- {
3059- //we want to generate a flat list of option | value pairs
3060- $list = "";
3061-
3062- while ($results = $db->get_row($result))
3063- {
3064- $col0 = $results[0];
3065- $col1 = $results[1];
3066-
3067- if ($checkPermissions)
3068- {
3069- $permissionid = $results[2];
3070- $ownerid = $results[3];
3071-
3072- if ($useQueryId)
3073- {
3074- list($see_permissions , $edit_permissions) = $user->eval_permission($ownerid, $permissionid, $col0);
3075- }
3076- else
3077- {
3078- list($see_permissions , $edit_permissions) = $user->eval_permission($ownerid, $permissionid, $userid);
3079- }
3080-
3081- if (($permissionLevel == "see" && $see_permissions) || $permissionLevel == "edit" && $edit_permissions) {
3082- $list .= "$col0|$col1,";
3083- }
3084- }
3085- else
3086- {
3087- $list .= "$col0|$col1,";
3088- }
3089- }
3090- //trim the commas
3091- $list = rtrim($list,",");
3092- }
3093- else
3094- {
3095- $list = <<<END
3096- <select name="$list_name" id="$list_name" $callback>
3097-END;
3098- while ($results = $db->get_row($result))
3099- {
3100- $col0 = $results[0];
3101- $col1 = $results[1];
3102-
3103- if ($checkPermissions)
3104- {
3105- $permissionid = $results[2];
3106- $ownerid = $results[3];
3107-
3108- if ($useQueryId)
3109- {
3110- list($see_permissions , $edit_permissions) = $user->eval_permission($ownerid, $permissionid, $col0);
3111- }
3112- else
3113- {
3114- list($see_permissions , $edit_permissions) = $user->eval_permission($ownerid, $permissionid, $userid);
3115- }
3116-
3117- if (($permissionLevel == "see" && $see_permissions) || $permissionLevel == "edit" && $edit_permissions)
3118- {
3119- if ($col0 == $selected)
3120- {
3121- $list .= "<option value='" . $col0 . "' selected>" . $col1 . "</option>\n";
3122- }
3123- else
3124- {
3125- $list .= "<option value='" . $col0 . "'>" . $col1 . "</option>\n";
3126- }
3127- }
3128- }
3129- else
3130- {
3131- if ($col0 == $selected)
3132- {
3133- $list .= "<option value='" . $col0 . "' selected>" . $col1 . "</option>\n";
3134- }
3135- else
3136- {
3137- $list .= "<option value='" . $col0 . "'>" . $col1 . "</option>\n";
3138- }
3139- }
3140- }
3141- $list .= "</select>\n";
3142- }
3143- return $list;
3144-}
3145-
3146 function listcontent($list_string, $list_name, $selected = "", $callback = "")
3147 {
3148 //generates a list based on a list option | value, list
3149@@ -181,47 +75,6 @@
3150 }
3151
3152
3153-//generates a list of all the users - assuming that the SQL given contains userid's
3154-function userlist($SQL)
3155-{
3156- global $db;
3157- global $user;
3158-
3159- if (!$result = $db->query($SQL))
3160- {
3161- trigger_error($db->error());
3162- return "Query Error";
3163- }
3164-
3165- if ($db->num_rows($result)==0)
3166- {
3167- $list = "No selections available";
3168- return $list;
3169- }
3170-
3171- while ($row = $db->get_row($result))
3172- {
3173-
3174- $userid = $row[0];
3175- $username = $user->getNameFromID($userid);
3176-
3177- $user_ids[] = array('id'=>$userid);
3178- $user_names[] = array('name'=>$username);
3179- }
3180-
3181- array_multisort($user_names, SORT_DESC, $user_ids, SORT_ASC); //sorts the two arrays, so that the usernames are Alpha sorted, and the ID's tag along
3182-
3183- $list = "";
3184- foreach ($user_names as $key => $row)
3185- {
3186-
3187- if($list != "") $list .= ","; //if we arnt equal to the first, append a seperator
3188-
3189- $list .= $user_ids[$key]['id']."|".$row['name'];
3190- }
3191- return $list;
3192-}
3193-
3194 /**
3195 * Sets a session variable from a javascript call (so when we XMLHTTPRequest we can set a sesson var)
3196 * @return
3197@@ -270,30 +123,6 @@
3198 }
3199
3200 /**
3201- * Gets web safe colors
3202- * @return
3203- */
3204-function gwsc()
3205-{
3206- $colors = array();
3207- $cs = array('00', '33', '66', '99', 'CC', 'FF');
3208-
3209- for($i=0; $i<6; $i++)
3210- {
3211- for($j=0; $j<6; $j++)
3212- {
3213- for($k=0; $k<6; $k++)
3214- {
3215- $c = $cs[$i] .$cs[$j] .$cs[$k];
3216- $colors[] = array('colorid' => $c, 'color' => '#' . $c, 'style' => 'background-color:#' . $c . ';color:#' . $c);
3217- }
3218- }
3219- }
3220-
3221- return $colors;
3222-}
3223-
3224-/**
3225 * Resizes the image
3226 * Based on code from the Web - cannot find source.
3227 * If this is your code please send a mail to info@xibo.org.uk
3228
3229=== modified file 'server/lib/app/datemanager.class.php'
3230--- server/lib/app/datemanager.class.php 2014-01-18 09:47:41 +0000
3231+++ server/lib/app/datemanager.class.php 2014-09-19 11:39:09 +0000
3232@@ -21,14 +21,7 @@
3233 defined('XIBO') or die("Sorry, you are not allowed to directly access this page.<br /> Please press the back button in your browser.");
3234
3235 class DateManager
3236-{
3237- private $db;
3238-
3239- public function __construct(database $db)
3240- {
3241- $this->db =& $db;
3242- }
3243-
3244+{
3245 public static function GetClock()
3246 {
3247 return date("H:i T");
3248
3249=== modified file 'server/lib/app/formmanager.class.php'
3250--- server/lib/app/formmanager.class.php 2014-01-18 09:47:41 +0000
3251+++ server/lib/app/formmanager.class.php 2014-09-19 11:39:09 +0000
3252@@ -1,7 +1,7 @@
3253 <?php
3254 /*
3255 * Xibo - Digital Signage - http://www.xibo.org.uk
3256- * Copyright (C) 2006,2007,2008 Daniel Garner
3257+ * Copyright (C) 2006-2014 Daniel Garner
3258 *
3259 * This file is part of Xibo.
3260 *
3261@@ -19,135 +19,225 @@
3262 * along with Xibo. If not, see <http://www.gnu.org/licenses/>.
3263 */
3264 defined('XIBO') or die("Sorry, you are not allowed to directly access this page.<br /> Please press the back button in your browser.");
3265-
3266-class FormManager
3267-{
3268- private $db;
3269- private $user;
3270-
3271- public function __construct(database $db, user $user)
3272- {
3273- $this->db =& $db;
3274- $this->user =& $user;
3275- }
3276-
3277- /**
3278- * Returns a drop down list based on the provided SQL - the ID should be the first field, and the name the second
3279- * @return
3280- * @param $SQL Object
3281- * @param $list_name Object
3282- * @param $selected Object[optional]
3283- * @param $callback Object[optional]
3284- * @param $flat_list Object[optional]
3285- * @param $checkPermissions Object[optional]
3286- * @param $userid Object[optional]
3287- * @param $permissionLevel Object[optional]
3288- * @param $useQueryId Object[optional]
3289- */
3290- public function DropDown($SQL, $list_name, $selected = "", $callback = "", $flat_list = false, $checkPermissions = false, $userid = "", $permissionLevel = "see", $useQueryId = false)
3291- {
3292- $db =& $this->db;
3293- $user =& $this->user;
3294-
3295- if (!$result = $db->query($SQL))
3296- {
3297- trigger_error($db->error());
3298- return __("Query Error");
3299- }
3300-
3301- if ($db->num_rows($result)==0)
3302- {
3303- $list = __("No selections available");
3304- return $list;
3305- }
3306-
3307- if ($flat_list)
3308- {
3309- //we want to generate a flat list of option | value pairs
3310- $list = "";
3311-
3312- while ($results = $db->get_row($result))
3313- {
3314- $col0 = $results[0];
3315- $col1 = $results[1];
3316-
3317- if ($checkPermissions)
3318- {
3319- $permissionid = $results[2];
3320- $ownerid = $results[3];
3321-
3322- if ($useQueryId)
3323- {
3324- list($see_permissions , $edit_permissions) = $user->eval_permission($ownerid, $permissionid, $col0);
3325- }
3326- else
3327- {
3328- list($see_permissions , $edit_permissions) = $user->eval_permission($ownerid, $permissionid, $userid);
3329- }
3330-
3331- if (($permissionLevel == "see" && $see_permissions) || $permissionLevel == "edit" && $edit_permissions) {
3332- $list .= "$col0|$col1,";
3333- }
3334- }
3335- else
3336- {
3337- $list .= "$col0|$col1,";
3338- }
3339- }
3340- //trim the commas
3341- $list = rtrim($list,",");
3342- }
3343- else
3344- {
3345- $list = <<<END
3346- <select name="$list_name" id="$list_name" $callback>
3347-END;
3348- while ($results = $db->get_row($result))
3349- {
3350- $col0 = $results[0];
3351- $col1 = $results[1];
3352-
3353- if ($checkPermissions)
3354- {
3355- $permissionid = $results[2];
3356- $ownerid = $results[3];
3357-
3358- if ($useQueryId)
3359- {
3360- list($see_permissions , $edit_permissions) = $user->eval_permission($ownerid, $permissionid, $col0);
3361- }
3362- else
3363- {
3364- list($see_permissions , $edit_permissions) = $user->eval_permission($ownerid, $permissionid, $userid);
3365- }
3366-
3367- if (($permissionLevel == "see" && $see_permissions) || $permissionLevel == "edit" && $edit_permissions)
3368- {
3369- if ($col0 == $selected)
3370- {
3371- $list .= "<option value='" . $col0 . "' selected>" . $col1 . "</option>\n";
3372- }
3373- else
3374- {
3375- $list .= "<option value='" . $col0 . "'>" . $col1 . "</option>\n";
3376- }
3377- }
3378- }
3379- else
3380- {
3381- if ($col0 == $selected)
3382- {
3383- $list .= "<option value='" . $col0 . "' selected>" . $col1 . "</option>\n";
3384- }
3385- else
3386- {
3387- $list .= "<option value='" . $col0 . "'>" . $col1 . "</option>\n";
3388- }
3389- }
3390- }
3391- $list .= "</select>\n";
3392- }
3393- return $list;
3394- }
3395+
3396+class FormManager {
3397+
3398+ public static function AddMessage($message, $groupClass = '') {
3399+ return array(
3400+ 'name' => NULL,
3401+ 'title' => NULL,
3402+ 'value' => NULL,
3403+ 'helpText' => $message,
3404+ 'fieldType' => 'message',
3405+ 'options' => NULL,
3406+ 'validation' => NULL,
3407+ 'accesskey' => NULL,
3408+ 'groupClass' => $groupClass,
3409+ 'enabled' => true
3410+ );
3411+ }
3412+
3413+ public static function AddRaw($raw) {
3414+ return array(
3415+ 'name' => NULL,
3416+ 'title' => NULL,
3417+ 'value' => NULL,
3418+ 'helpText' => $raw,
3419+ 'fieldType' => 'raw',
3420+ 'options' => NULL,
3421+ 'validation' => NULL,
3422+ 'accesskey' => NULL,
3423+ 'groupClass' => '',
3424+ 'enabled' => true
3425+ );
3426+ }
3427+
3428+ public static function AddHidden($name, $value) {
3429+ return array(
3430+ 'name' => $name,
3431+ 'value' => $value,
3432+ 'fieldType' => 'hidden',
3433+ 'enabled' => true
3434+ );
3435+ }
3436+
3437+ public static function AddButton($title, $type = 'submit', $link = '', $groupClass = '') {
3438+ return array(
3439+ 'title' => $title,
3440+ 'type' => $type,
3441+ 'link' => $link,
3442+ 'groupClass' => $groupClass,
3443+ 'fieldType' => 'button',
3444+ 'enabled' => true
3445+ );
3446+ }
3447+
3448+ public static function AddText($name, $title, $value, $helpText, $accessKey, $validation = '', $groupClass = '', $enabled = true) {
3449+ return array(
3450+ 'name' => $name,
3451+ 'title' => $title,
3452+ 'value' => $value,
3453+ 'helpText' => $helpText,
3454+ 'fieldType' => 'text',
3455+ 'options' => NULL,
3456+ 'validation' => $validation,
3457+ 'accesskey' => $accessKey,
3458+ 'groupClass' => $groupClass,
3459+ 'enabled' => $enabled
3460+ );
3461+ }
3462+
3463+ public static function AddMultiText($name, $title, $value, $helpText, $accessKey, $rows, $validation = '', $groupClass = '', $enabled = true) {
3464+ return array(
3465+ 'name' => $name,
3466+ 'title' => $title,
3467+ 'value' => $value,
3468+ 'helpText' => $helpText,
3469+ 'fieldType' => 'textarea',
3470+ 'options' => NULL,
3471+ 'validation' => $validation,
3472+ 'accesskey' => $accessKey,
3473+ 'groupClass' => $groupClass,
3474+ 'enabled' => $enabled,
3475+ 'rows' => $rows
3476+ );
3477+ }
3478+
3479+ public static function AddNumber($name, $title, $value, $helpText, $accessKey, $validation = '', $groupClass = '', $enabled = true) {
3480+ return array(
3481+ 'name' => $name,
3482+ 'title' => $title,
3483+ 'value' => $value,
3484+ 'helpText' => $helpText,
3485+ 'fieldType' => 'number',
3486+ 'options' => NULL,
3487+ 'validation' => $validation,
3488+ 'accesskey' => $accessKey,
3489+ 'groupClass' => $groupClass,
3490+ 'enabled' => $enabled
3491+ );
3492+ }
3493+
3494+ public static function AddEmail($name, $title, $value, $helpText, $accessKey, $validation = '', $groupClass = '', $enabled = true) {
3495+ return array(
3496+ 'name' => $name,
3497+ 'title' => $title,
3498+ 'value' => $value,
3499+ 'helpText' => $helpText,
3500+ 'fieldType' => 'email',
3501+ 'options' => NULL,
3502+ 'validation' => $validation,
3503+ 'accesskey' => $accessKey,
3504+ 'groupClass' => $groupClass,
3505+ 'enabled' => $enabled
3506+ );
3507+ }
3508+
3509+ public static function AddCheckbox($name, $title, $value, $helpText, $accessKey, $groupClass = '', $enabled = true) {
3510+ return array(
3511+ 'name' => $name,
3512+ 'title' => $title,
3513+ 'value' => $value,
3514+ 'helpText' => $helpText,
3515+ 'fieldType' => 'checkbox',
3516+ 'options' => NULL,
3517+ 'validation' => NULL,
3518+ 'accesskey' => $accessKey,
3519+ 'groupClass' => $groupClass,
3520+ 'enabled' => $enabled
3521+ );
3522+ }
3523+
3524+ public static function AddRadio($name, $id, $title, $value, $setValue, $helpText, $accessKey, $groupClass = '', $enabled = true) {
3525+ return array(
3526+ 'id' => $id,
3527+ 'name' => $name,
3528+ 'title' => $title,
3529+ 'value' => $value,
3530+ 'setValue' => $setValue,
3531+ 'helpText' => $helpText,
3532+ 'fieldType' => 'radio',
3533+ 'options' => NULL,
3534+ 'validation' => NULL,
3535+ 'accesskey' => $accessKey,
3536+ 'groupClass' => $groupClass,
3537+ 'enabled' => $enabled
3538+ );
3539+ }
3540+
3541+ public static function AddPassword($name, $title, $value, $helpText, $accessKey, $groupClass = '', $enabled = true) {
3542+ return array(
3543+ 'name' => $name,
3544+ 'title' => $title,
3545+ 'value' => $value,
3546+ 'helpText' => $helpText,
3547+ 'fieldType' => 'password',
3548+ 'options' => NULL,
3549+ 'validation' => NULL,
3550+ 'accesskey' => $accessKey,
3551+ 'groupClass' => $groupClass,
3552+ 'enabled' => $enabled
3553+ );
3554+ }
3555+
3556+ public static function AddCombo($name, $title, $value, $options, $optionId, $optionValue, $helpText, $accessKey, $groupClass = '', $enabled = true, $callBack = '', $classColumn = '', $styleColumn = '', $optionGroups = '', $attributes = array()) {
3557+ return array(
3558+ 'name' => $name,
3559+ 'title' => $title,
3560+ 'value' => $value,
3561+ 'helpText' => $helpText,
3562+ 'fieldType' => 'dropdown',
3563+ 'options' => $options,
3564+ 'optionId' => $optionId,
3565+ 'optionValue' => $optionValue,
3566+ 'validation' => NULL,
3567+ 'accesskey' => $accessKey,
3568+ 'groupClass' => $groupClass,
3569+ 'enabled' => $enabled,
3570+ 'callBack' => $callBack,
3571+ 'classColumn' => $classColumn,
3572+ 'styleColumn' => $styleColumn,
3573+ 'optionGroups' => $optionGroups,
3574+ 'dataAttributes' => $attributes
3575+ );
3576+ }
3577+
3578+ public static function AddMultiCombo($name, $title, $value, $options, $optionId, $optionValue, $helpText, $accessKey, $groupClass = '', $enabled = true, $callBack = '', $classColumn = '', $styleColumn = '', $optionGroups = '', $attributes = array()) {
3579+ return array(
3580+ 'name' => $name,
3581+ 'title' => $title,
3582+ 'value' => $value,
3583+ 'helpText' => $helpText,
3584+ 'fieldType' => 'dropdownmulti',
3585+ 'options' => $options,
3586+ 'optionId' => $optionId,
3587+ 'optionValue' => $optionValue,
3588+ 'validation' => NULL,
3589+ 'accesskey' => $accessKey,
3590+ 'groupClass' => $groupClass,
3591+ 'enabled' => $enabled,
3592+ 'callBack' => $callBack,
3593+ 'classColumn' => $classColumn,
3594+ 'styleColumn' => $styleColumn,
3595+ 'optionGroups' => $optionGroups,
3596+ 'dataAttributes' => $attributes
3597+ );
3598+ }
3599+
3600+ public static function AddPermissions($name, $options) {
3601+ return array(
3602+ 'name' => $name,
3603+ 'fieldType' => 'permissions',
3604+ 'options' => $options,
3605+ 'groupClass' => NULL,
3606+ 'enabled' => true
3607+ );
3608+ }
3609+
3610+ public static function AddTab($id, $name) {
3611+ return array(
3612+ 'id' => $id, 'name' => $name
3613+ );
3614+ }
3615 }
3616-?>
3617\ No newline at end of file
3618+?>
3619
3620=== modified file 'server/lib/app/helpmanager.class.php'
3621--- server/lib/app/helpmanager.class.php 2014-01-18 09:47:41 +0000
3622+++ server/lib/app/helpmanager.class.php 2014-09-19 11:39:09 +0000
3623@@ -20,23 +20,7 @@
3624 */
3625 defined('XIBO') or die("Sorry, you are not allowed to directly access this page.<br /> Please press the back button in your browser.");
3626
3627-class HelpManager
3628-{
3629- private $db;
3630- private $user;
3631-
3632- /**
3633- * Constructs the Module Manager.
3634- * @return
3635- * @param $db Object
3636- * @param $user Object
3637- */
3638- public function __construct(database $db, User $user)
3639- {
3640- $this->db =& $db;
3641- $this->user =& $user;
3642- }
3643-
3644+class HelpManager {
3645 /**
3646 * Help Button
3647 * @return
3648
3649=== modified file 'server/lib/app/kit.class.php'
3650--- server/lib/app/kit.class.php 2014-05-26 09:09:06 +0000
3651+++ server/lib/app/kit.class.php 2014-09-19 11:39:09 +0000
3652@@ -46,7 +46,7 @@
3653 class Kit
3654 {
3655 // Ends the current execution and issues a redirect - should only be called before headers have been sent (i.e. no output)
3656- static function Redirect($page, $message = '', $pageIsUrl = false)
3657+ static function Redirect($page, $message = '')
3658 {
3659 $url = $page;
3660 $ajax = Kit::GetParam('ajax', _REQUEST, _BOOL, false);
3661@@ -64,6 +64,7 @@
3662 }
3663 else
3664 {
3665+ header( 'HTTP/1.1 302 Moved Temporarily' );
3666 header( 'Location: ' . $url );
3667 }
3668
3669@@ -351,8 +352,14 @@
3670 break;
3671
3672 case _CHECKBOX:
3673- if ($return == 'on') $return = 1;
3674- if ($return == 'off' || $return == '') $return = 0;
3675+ if ($return == 'on') {
3676+ $return = 1;
3677+ }
3678+ if ($return == 'off' || $return == '') {
3679+ $return = 0;
3680+ }
3681+
3682+ break;
3683
3684 default :
3685 // No casting necessary
3686@@ -372,7 +379,7 @@
3687 */
3688 public static function GetURL($page = "")
3689 {
3690- $page = $this->ValidateParam($page, _WORD);
3691+ $page = Kit::ValidateParam($page, _WORD);
3692 $fullUrl = 'http';
3693
3694 if(isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on')
3695@@ -535,7 +542,7 @@
3696 */
3697 public static function SelectList($listName, $listValues, $idColumn, $nameColumn, $selectedId = '', $callBack = '', $classColumn = '')
3698 {
3699- $list = '<select name="' . $listName . '" id="' . $listName . '"' . $callBack . '>';
3700+ $list = '<select class="form-control" name="' . $listName . '" id="' . $listName . '"' . $callBack . '>';
3701
3702 foreach ($listValues as $listItem)
3703 {
3704@@ -586,7 +593,7 @@
3705 public static function Token($tokenName = "token")
3706 {
3707 //Store in the users session
3708- $token = md5(uniqid()."xsmsalt".time());
3709+ $token = md5(uniqid() . SECRET_KEY . time());
3710
3711 $_SESSION[$tokenName] = $token;
3712 $_SESSION[$tokenName.'_timeout'] = time();
3713
3714=== modified file 'server/lib/app/menumanager.class.php'
3715--- server/lib/app/menumanager.class.php 2014-01-18 09:47:41 +0000
3716+++ server/lib/app/menumanager.class.php 2014-09-19 11:39:09 +0000
3717@@ -22,27 +22,17 @@
3718
3719 class MenuManager
3720 {
3721- private $db;
3722 private $user;
3723- private $p;
3724- private $q;
3725-
3726- private $ajax;
3727- private $userid;
3728+
3729 public $message;
3730
3731 private $theMenu;
3732 private $current;
3733 private $numberItems;
3734
3735- public function __construct(database $db, User $user, $menu)
3736+ public function __construct(User $user, $menu)
3737 {
3738- $this->db =& $db;
3739 $this->user =& $user;
3740- $this->ajax = Kit::GetParam('ajax', _REQUEST, _BOOL, false);
3741- $this->q = Kit::GetParam('q', _REQUEST, _WORD);
3742- $this->userid = Kit::GetParam('userid', _SESSION, _INT);
3743- $usertypeid = Kit::GetParam('usertype', _SESSION, _INT);
3744
3745 if ($menu == '')
3746 {
3747
3748=== modified file 'server/lib/app/pagemanager.class.php'
3749--- server/lib/app/pagemanager.class.php 2014-03-08 11:39:48 +0000
3750+++ server/lib/app/pagemanager.class.php 2014-09-19 11:39:09 +0000
3751@@ -26,8 +26,8 @@
3752 private $db;
3753 private $user;
3754
3755- private $p;
3756- private $q;
3757+ public $p;
3758+ public $q;
3759
3760 private $page;
3761 private $path;
3762@@ -36,9 +36,13 @@
3763 private $authed;
3764 private $thePage;
3765
3766- // Maintain a list of pages/functions we are allowed to get to without going through the authentication system
3767- private $nonAuthedPages = array('index', 'clock');
3768+ // Maintain a list of pages / functions we are allowed to get to without going through the authentication system
3769+ private $nonAuthedPages = array('index', 'clock', 'error');
3770+ private $nonAuthedPagesWithoutFunctionCall = array('error');
3771 private $nonAuthedFunctions = array('login', 'logout', 'GetClock', 'About');
3772+
3773+ // Maintain a list of pages we can get to that are not checked in the database but require a valid login
3774+ private $nonPageAuthedPages = array('upgrade');
3775
3776 function __construct(database $db, user $user, $page)
3777 {
3778@@ -56,7 +60,7 @@
3779 $this->authed = false;
3780
3781 // Create a theme
3782- new Theme($db, $user);
3783+ new Theme($user);
3784 Theme::SetPagename($this->p);
3785 }
3786
3787@@ -69,10 +73,11 @@
3788 $user =& $this->user;
3789
3790 // The user MUST be logged in unless they are trying to assess some of the public facing pages
3791- if (in_array($this->p, $this->nonAuthedPages) && in_array($this->q, $this->nonAuthedFunctions))
3792+ if ((in_array($this->p, $this->nonAuthedPages) && in_array($this->q, $this->nonAuthedFunctions))
3793+ || (in_array($this->p, $this->nonAuthedPagesWithoutFunctionCall) && $this->q == ''))
3794 {
3795 // Automatically authed
3796- $this->authed = true;
3797+ $this->authed = true;
3798 }
3799 else
3800 {
3801@@ -80,7 +85,10 @@
3802 if (!$user->attempt_login($this->ajax))
3803 return false;
3804
3805- $this->authed = $user->PageAuth($this->p);
3806+ if (in_array($this->p, $this->nonPageAuthedPages))
3807+ $this->authed = true;
3808+ else
3809+ $this->authed = $user->PageAuth($this->p);
3810 }
3811 }
3812
3813@@ -130,6 +138,9 @@
3814 }
3815 else
3816 {
3817+ Theme::Set('sidebar_html', $this->thePage->sideBarContent());
3818+ Theme::Set('action_menu', $this->thePage->actionMenu());
3819+
3820 // Display a page instead
3821 Theme::Render('header');
3822
3823@@ -142,4 +153,4 @@
3824 $_SESSION['message'] = '';
3825 }
3826 }
3827-?>
3828\ No newline at end of file
3829+?>
3830
3831=== modified file 'server/lib/app/pdoconnect.class.php'
3832--- server/lib/app/pdoconnect.class.php 2014-07-17 10:37:47 +0000
3833+++ server/lib/app/pdoconnect.class.php 2014-09-19 11:39:09 +0000
3834@@ -44,13 +44,49 @@
3835 $dsn = 'mysql:host=' . $dbhost . ';dbname=' . $dbname . ';';
3836 }
3837
3838- // Open the connection and set the error mode
3839- self::$conn = new PDO($dsn, $dbuser, $dbpass);
3840- self::$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
3841-
3842- self::$conn->query("SET NAMES 'utf8'");
3843- }
3844-
3845- return self::$conn;
3846+ //echo 'init ' . $dsn , ' user ' . $dbuser . ' pass ' . $dbpass;
3847+
3848+ // Open the connection and set the error mode
3849+ self::$conn = new PDO($dsn, $dbuser, $dbpass);
3850+ self::$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
3851+
3852+ self::$conn->query("SET NAMES 'utf8'");
3853+ }
3854+
3855+ return self::$conn;
3856+ }
3857+
3858+ public static function connect($dbhost, $dbuser, $dbpass, $dbname = '') {
3859+ if (!self::$conn) {
3860+
3861+ $dbport = '';
3862+
3863+ if (strstr($dbhost, ':')) {
3864+ $hostParts = explode(':', $dbhost);
3865+ $dsn = 'mysql:host=' . $hostParts[0] . ';port=' . $hostParts[1] . ';';
3866+ }
3867+ else {
3868+ $dsn = 'mysql:host=' . $dbhost . ';';
3869+ }
3870+
3871+ if ($dbname != '')
3872+ $dsn .= 'dbname=' . $dbname . ';';
3873+
3874+ //echo 'connect ' . $dsn , ' user ' . $dbuser . ' pass ' . $dbpass;
3875+
3876+ // Open the connection and set the error mode
3877+ self::$conn = new PDO($dsn, $dbuser, $dbpass);
3878+ self::$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
3879+
3880+ self::$conn->query("SET NAMES 'utf8'");
3881+ }
3882+
3883+ return self::$conn;
3884+ }
3885+
3886+ public static function close() {
3887+ if (self::$conn) {
3888+ self::$conn = null;
3889+ }
3890 }
3891 }
3892\ No newline at end of file
3893
3894=== modified file 'server/lib/app/responsemanager.class.php'
3895--- server/lib/app/responsemanager.class.php 2014-01-18 09:47:41 +0000
3896+++ server/lib/app/responsemanager.class.php 2014-09-19 11:39:09 +0000
3897@@ -29,6 +29,7 @@
3898 public $html;
3899 public $callBack;
3900 public $buttons;
3901+ public $fieldActions;
3902
3903 public $sortable;
3904 public $sortingDiv;
3905@@ -73,6 +74,7 @@
3906 $this->appendHiddenSubmit = true;
3907 $this->uniqueReference = '';
3908 $this->buttons = '';
3909+ $this->fieldActions = '';
3910 $this->pageSize = 10;
3911 $this->pageNumber = 0;
3912 $this->initialSortColumn = 1;
3913@@ -150,6 +152,9 @@
3914 */
3915 public function SetFormRequestResponse($form, $title, $width = '', $height = '', $callBack = '')
3916 {
3917+ if ($form == NULL)
3918+ $form = Theme::RenderReturn('form_render');
3919+
3920 $this->html = $form;
3921 $this->dialogTitle = $title;
3922 $this->callBack = $callBack;
3923@@ -211,6 +216,26 @@
3924 return true;
3925 }
3926
3927+ /**
3928+ * Add a Field Action to a Field
3929+ * @param string $field The field name
3930+ * @param string $action The action name
3931+ * @param string $value The value to trigger on
3932+ * @param string $actions The actions (field => action)
3933+ * @param string $operation The Operation (optional)
3934+ */
3935+ public function AddFieldAction($field, $action, $value, $actions, $operation = "equals") {
3936+ $this->fieldActions[] = array(
3937+ 'field' => $field,
3938+ 'trigger' => $action,
3939+ 'value' => $value,
3940+ 'operation' => $operation,
3941+ 'actions' => $actions
3942+ );
3943+
3944+ return true;
3945+ }
3946+
3947 /**
3948 * Responds with an Error
3949 * @param <string> $message
3950@@ -255,6 +280,7 @@
3951 // General
3952 $response['html'] = $this->html;
3953 $response['buttons'] = $this->buttons;
3954+ $response['fieldActions'] = $this->fieldActions;
3955 $response['uniqueReference'] = $this->uniqueReference;
3956
3957 $response['success'] = $this->success;
3958@@ -307,42 +333,31 @@
3959 // End the execution
3960 die();
3961 }
3962- else
3963- {
3964+ else {
3965 // If the response does not equal success then output an error
3966- if (!$this->success)
3967- {
3968+ if (!$this->success) {
3969 // Store the message
3970 $_SESSION['ErrorMessage'] = $this->message;
3971
3972 // Redirect to the following
3973- $url = 'index.php?p=error';
3974-
3975- // Header or JS redirect
3976- if (headers_sent())
3977- {
3978- echo "<script>document.location.href='$url';</script>\n";
3979- }
3980- else
3981- {
3982- header( 'HTTP/1.1 301 Moved Permanently' );
3983- header( 'Location: ' . $url );
3984- }
3985-
3986- // End the execution
3987- die();
3988- }
3989+ $url = 'index.php?p=error';
3990+ }
3991+ else {
3992+ // Have we been asked to refresh?
3993+ $url = ($this->refresh) ? $this->refreshLocation : 'index.php?p=' . Kit::GetParam('p', _GET, _WORD, 'index');
3994+ }
3995+
3996+ // Redirect and end execution
3997+ Kit::Redirect($url);
3998 }
3999
4000 return;
4001 }
4002
4003- public static function Pager($id)
4004- {
4005+ public static function Pager($id, $type = 'grid_pager') {
4006 Theme::Set('pager_id', 'XiboPager_' . $id);
4007
4008- return Theme::RenderReturn('grid_pager');
4009+ return Theme::RenderReturn($type);
4010 }
4011 }
4012-
4013-?>
4014\ No newline at end of file
4015+?>
4016
4017=== modified file 'server/lib/app/thememanager.class.php'
4018--- server/lib/app/thememanager.class.php 2014-03-06 22:37:29 +0000
4019+++ server/lib/app/thememanager.class.php 2014-09-19 11:39:09 +0000
4020@@ -23,7 +23,6 @@
4021 class Theme {
4022 private static $instance = null;
4023
4024- private $db;
4025 private $user;
4026 private $helpManager;
4027 private $dateManager;
4028@@ -33,18 +32,15 @@
4029 private $vars = null;
4030 private $config = null;
4031
4032- public function __construct(database $db, user $user) {
4033+ public function __construct(user $user, $theme = NULL) {
4034
4035 // Store some things for the Theme engine to use
4036- $this->db =& $db;
4037 $this->user =& $user;
4038- $this->help = new HelpManager($db, $user);
4039- $this->dateManager = new DateManager($db);
4040-
4041- // TODO: Perhaps we also allow the user to configure their own theme for their session?
4042+ $this->help = new HelpManager();
4043+ $this->dateManager = new DateManager();
4044
4045 // What is the currently selected theme?
4046- $globalTheme = Config::GetSetting('GLOBAL_THEME_NAME');
4047+ $globalTheme = ($theme == NULL) ? Config::GetSetting('GLOBAL_THEME_NAME') : $theme;
4048
4049 // Is this theme valid?
4050 if (!is_dir('theme/' . $globalTheme))
4051@@ -85,8 +81,12 @@
4052 if (file_exists('theme/' . $theme->name . '/html/' . $item . '.php')) {
4053 include('theme/' . $theme->name . '/html/' . $item . '.php');
4054 }
4055+ // Check the module theme folder
4056+ else if (file_exists('modules/theme/' . $item . '.php')) {
4057+ include('modules/theme/' . $item . '.php');
4058+ }
4059 // If not, then use the default folder
4060- elseif (file_exists('theme/default/html/' . $item . '.php')) {
4061+ else if (file_exists('theme/default/html/' . $item . '.php')) {
4062 include('theme/default/html/' . $item . '.php');
4063 }
4064 else
4065@@ -156,8 +156,8 @@
4066 * @param string $string The String to Translate
4067 * @param array $args Variables to insert (will replace %d %s in order)
4068 */
4069- public static function Translate($string, $args = null) {
4070- return __($string, $args);
4071+ public static function Translate($string) {
4072+ return call_user_func_array('__', func_get_args());
4073 }
4074
4075 public static function Set($key, $value) {
4076@@ -217,6 +217,10 @@
4077 return Theme::GetInstance()->config['theme_name'];
4078 }
4079
4080+ public static function SourceLink() {
4081+ return (isset(Theme::GetInstance()->config['cms_source_url']) ? Theme::GetInstance()->config['cms_source_url'] : 'https://launchpad.net/xibo/1.7');
4082+ }
4083+
4084 public static function ThemeFolder() {
4085 return Theme::GetInstance()->name;
4086 }
4087@@ -240,7 +244,7 @@
4088 $theme = Theme::GetInstance();
4089 $array = array();
4090
4091- if (!$menu = new MenuManager($theme->db, $theme->user, $menu))
4092+ if (!$menu = new MenuManager($theme->user, $menu))
4093 trigger_error($menu->message, E_USER_ERROR);
4094
4095 while ($menuItem = $menu->GetNextMenuItem()) {
4096@@ -282,7 +286,7 @@
4097 */
4098 public static function SelectList($listName, $listValues, $idColumn, $nameColumn, $selectedId = null, $callBack = '', $classColumn = '', $styleColumn = '')
4099 {
4100- $list = '<select name="' . $listName . '" id="' . $listName . '"' . $callBack . '>';
4101+ $list = '<select class="form-control" name="' . $listName . '" id="' . $listName . '"' . $callBack . '>';
4102
4103 foreach ($listValues as $listItem)
4104 {
4105@@ -296,4 +300,4 @@
4106 return $list;
4107 }
4108 }
4109-?>
4110\ No newline at end of file
4111+?>
4112
4113=== modified file 'server/lib/app/translationengine.class.php'
4114--- server/lib/app/translationengine.class.php 2014-01-18 09:47:41 +0000
4115+++ server/lib/app/translationengine.class.php 2014-09-19 11:39:09 +0000
4116@@ -1,7 +1,7 @@
4117 <?php
4118 /*
4119 * Xibo - Digital Signage - http://www.xibo.org.uk
4120- * Copyright (C) 2009 Daniel Garner
4121+ * Copyright (C) 2009-14 Daniel Garner
4122 *
4123 * This file is part of Xibo.
4124 *
4125@@ -31,10 +31,10 @@
4126 * Gets and Sets the Local
4127 * @return
4128 */
4129- public static function InitLocale()
4130+ public static function InitLocale($language = NULL)
4131 {
4132 $localeDir = 'locale';
4133- $default = Config::GetSetting('DEFAULT_LANGUAGE');
4134+ $default = ($language == NULL) ? Config::GetSetting('DEFAULT_LANGUAGE') : $language;
4135
4136 global $transEngine;
4137 global $stream;
4138@@ -50,7 +50,7 @@
4139 if ($lang != '')
4140 {
4141 // Set the language
4142- Debug::LogEntry('audit', 'Set the Language from REQUEST [' . $lang . ']', 'TranslationEngine', 'InitLocal');
4143+ //Debug::LogEntry('audit', 'Set the Language from REQUEST [' . $lang . ']', 'TranslationEngine', 'InitLocal');
4144
4145 // Is this language supported?
4146 // if not just use the default (eb_GB).
4147@@ -113,16 +113,19 @@
4148 * @return
4149 * @param $string Object
4150 */
4151-function __($string, $args = null)
4152+function __($string)
4153 {
4154 global $transEngine;
4155
4156 if ($transEngine != '')
4157 $string = $transEngine->translate($string);
4158
4159+ $args = func_get_args();
4160+ array_shift($args);
4161+
4162 if (count($args) > 0)
4163 $string = vsprintf($string, $args);
4164
4165 return $string;
4166 }
4167-?>
4168\ No newline at end of file
4169+?>
4170
4171=== added file 'server/lib/data/bandwidth.data.class.php'
4172--- server/lib/data/bandwidth.data.class.php 1970-01-01 00:00:00 +0000
4173+++ server/lib/data/bandwidth.data.class.php 2014-09-19 11:39:09 +0000
4174@@ -0,0 +1,62 @@
4175+<?php
4176+/*
4177+ * Xibo - Digital Signage - http://www.xibo.org.uk
4178+ * Copyright (C) 2009-2012 Daniel Garner
4179+ *
4180+ * This file is part of Xibo.
4181+ *
4182+ * Xibo is free software: you can redistribute it and/or modify
4183+ * it under the terms of the GNU Affero General Public License as published by
4184+ * the Free Software Foundation, either version 3 of the License, or
4185+ * any later version.
4186+ *
4187+ * Xibo is distributed in the hope that it will be useful,
4188+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
4189+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4190+ * GNU Affero General Public License for more details.
4191+ *
4192+ * You should have received a copy of the GNU Affero General Public License
4193+ * along with Xibo. If not, see <http://www.gnu.org/licenses/>.
4194+ */
4195+defined('XIBO') or die("Sorry, you are not allowed to directly access this page.<br /> Please press the back button in your browser.");
4196+
4197+class Bandwidth extends Data {
4198+
4199+ public static $REGISTER = 1;
4200+ public static $RF = 2;
4201+ public static $SCHEDULE = 3;
4202+ public static $GETFILE = 4;
4203+ public static $GETRESOURCE = 5;
4204+ public static $MEDIAINVENTORY = 6;
4205+ public static $NOTIFYSTATUS = 7;
4206+ public static $SUBMITSTATS = 8;
4207+ public static $SUBMITLOG = 9;
4208+ public static $BLACKLIST = 10;
4209+ public static $SCREENSHOT = 11;
4210+
4211+ public function Log($displayId, $type, $sizeInBytes) {
4212+ try {
4213+ $dbh = PDOConnect::init();
4214+
4215+ $sth = $dbh->prepare('
4216+ INSERT INTO `bandwidth` (Month, Type, DisplayID, Size) VALUES (:month, :type, :displayid, :size)
4217+ ON DUPLICATE KEY UPDATE Size = Size + :size2
4218+ ');
4219+
4220+ $sth->execute(array(
4221+ 'month' => strtotime(date('m').'/02/'.date('Y').' 00:00:00'),
4222+ 'type' => $type,
4223+ 'displayid' => $displayId,
4224+ 'size' => $sizeInBytes,
4225+ 'size2' => $sizeInBytes
4226+ ));
4227+
4228+ return true;
4229+ }
4230+ catch (Exception $e) {
4231+ Debug::LogEntry('error', $e->getMessage());
4232+ return false;
4233+ }
4234+ }
4235+}
4236+?>
4237
4238=== modified file 'server/lib/data/data.class.php'
4239--- server/lib/data/data.class.php 2014-01-18 09:47:41 +0000
4240+++ server/lib/data/data.class.php 2014-09-19 11:39:09 +0000
4241@@ -31,9 +31,10 @@
4242 * Data Class
4243 * @param database $db
4244 */
4245- public function __construct(database $db)
4246+ public function __construct(database $db = null)
4247 {
4248- $this->db =& $db;
4249+ if ($db != null)
4250+ $this->db =& $db;
4251
4252 $this->error = false;
4253 $this->errorNo = 0;
4254
4255=== modified file 'server/lib/data/dataset.data.class.php'
4256--- server/lib/data/dataset.data.class.php 2014-07-08 14:45:16 +0000
4257+++ server/lib/data/dataset.data.class.php 2014-09-19 11:39:09 +0000
4258@@ -250,7 +250,7 @@
4259 try {
4260 $dbh = PDOConnect::init();
4261
4262- $sth = $dbh->prepare('SELECT `lkcampaignlayout`.CampaignID FROM `lkdatasetlayout` INNER JOIN `lkcampaignlayout` ON `lkcampaignlayout`.LayoutID = `lkdatasetlayout`.LayoutID WHERE DataSetID = :datasetid');
4263+ $sth = $dbh->prepare('SELECT DISTINCT `lkcampaignlayout`.CampaignID FROM `lkdatasetlayout` INNER JOIN `lkcampaignlayout` ON `lkcampaignlayout`.LayoutID = `lkdatasetlayout`.LayoutID WHERE DataSetID = :datasetid');
4264 $sth->execute(array(
4265 'datasetid' => $dataSetId
4266 ));
4267@@ -441,8 +441,7 @@
4268
4269 Debug::LogEntry('audit', $SQL);
4270
4271- if (!$rows = $db->GetArray($SQL, $associative))
4272- trigger_error($db->error());
4273+ $rows = $db->GetArray($SQL, $associative);
4274
4275 if (!is_array($rows))
4276 $rows = array();
4277
4278=== modified file 'server/lib/data/datasetdata.data.class.php'
4279--- server/lib/data/datasetdata.data.class.php 2014-07-12 13:54:51 +0000
4280+++ server/lib/data/datasetdata.data.class.php 2014-09-19 11:39:09 +0000
4281@@ -377,4 +377,4 @@
4282 }
4283 }
4284 }
4285-?>
4286\ No newline at end of file
4287+?>
4288
4289=== modified file 'server/lib/data/display.data.class.php'
4290--- server/lib/data/display.data.class.php 2014-03-09 14:41:56 +0000
4291+++ server/lib/data/display.data.class.php 2014-09-19 11:39:09 +0000
4292@@ -20,28 +20,134 @@
4293 */
4294 defined('XIBO') or die("Sorry, you are not allowed to directly access this page.<br /> Please press the back button in your browser.");
4295
4296-class Display extends Data
4297-{
4298- public function __construct(database $db)
4299- {
4300- include_once('lib/data/displaygroup.data.class.php');
4301-
4302- parent::__construct($db);
4303- }
4304-
4305- /**
4306- * Adds a Display
4307- * @return
4308- * @param $display Object
4309- * @param $isAuditing Object
4310- * @param $defaultLayoutID Object
4311- * @param $license Object
4312- * @param $licensed Object
4313- * @param $incSchedule Object
4314- */
4315- public function Add($display, $isAuditing, $defaultLayoutID, $license, $licensed, $incSchedule)
4316- {
4317- Debug::LogEntry('audit', 'IN', 'Display', 'Add');
4318+// Companion classes
4319+Kit::ClassLoader('displaygroup');
4320+
4321+class Display extends Data {
4322+
4323+ public $loaded;
4324+
4325+ public $displayId;
4326+ public $isAuditing;
4327+ public $display;
4328+ public $description;
4329+ public $defaultLayoutId;
4330+ public $license;
4331+ public $licensed;
4332+ public $currentLicensed;
4333+ public $loggedIn;
4334+ public $lastAccessed;
4335+ public $incSchedule;
4336+ public $emailAlert;
4337+ public $alertTimeout;
4338+ public $clientAddress;
4339+ public $mediaInventoryStatus;
4340+ public $mediaInventoryXml;
4341+ public $macAddress;
4342+ public $lastChanged;
4343+ public $numberOfMacAddressChanges;
4344+ public $lastWakeOnLanCommandSent;
4345+ public $wakeOnLanEnabled;
4346+ public $wakeOnLanTime;
4347+ public $broadCastAddress;
4348+ public $secureOn;
4349+ public $cidr;
4350+ public $latitude;
4351+ public $longitude;
4352+ public $versionInstructions;
4353+ public $clientType;
4354+ public $clientVersion;
4355+ public $clientCode;
4356+ public $displayProfileId;
4357+ public $currentLayoutId;
4358+ public $screenShotRequested;
4359+
4360+ public $displayGroupId;
4361+
4362+ public function Load() {
4363+ try {
4364+ $dbh = PDOConnect::init();
4365+
4366+ $sth = $dbh->prepare('
4367+ SELECT display.*, displaygroup.displaygroupid, displaygroup.description, X(display.GeoLocation) AS Latitude, Y(display.GeoLocation) AS Longitude
4368+ FROM `display`
4369+ INNER JOIN `lkdisplaydg`
4370+ ON lkdisplaydg.displayid = display.displayId
4371+ INNER JOIN `displaygroup`
4372+ ON displaygroup.displaygroupid = lkdisplaydg.displaygroupid
4373+ AND isdisplayspecific = 1
4374+ WHERE display.displayid = :display_id');
4375+
4376+ $sth->execute(array('display_id' => $this->displayId));
4377+
4378+ if (!$row = $sth->fetch())
4379+ $this->ThrowError(25004, __('Cannot find display record'));
4380+
4381+ $this->isAuditing = Kit::ValidateParam($row['isAuditing'], _INT);
4382+ $this->display = Kit::ValidateParam($row['display'], _STRING);
4383+ $this->description = Kit::ValidateParam($row['description'], _STRING);
4384+ $this->defaultLayoutId = Kit::ValidateParam($row['defaultlayoutid'], _INT);
4385+ $this->license = Kit::ValidateParam($row['license'], _STRING);
4386+ $this->licensed = Kit::ValidateParam($row['licensed'], _INT);
4387+ $this->loggedIn = Kit::ValidateParam($row['loggedin'], _INT);
4388+ $this->lastAccessed = Kit::ValidateParam($row['lastaccessed'], _INT);
4389+ $this->incSchedule = Kit::ValidateParam($row['inc_schedule'], _INT);
4390+ $this->emailAlert = Kit::ValidateParam($row['email_alert'], _INT);
4391+ $this->alertTimeout = Kit::ValidateParam($row['alert_timeout'], _INT);
4392+ $this->clientAddress = Kit::ValidateParam($row['ClientAddress'], _STRING);
4393+ $this->mediaInventoryStatus = Kit::ValidateParam($row['MediaInventoryStatus'], _INT);
4394+ $this->mediaInventoryXml = Kit::ValidateParam($row['MediaInventoryXml'], _HTMLSTRING);
4395+ $this->macAddress = Kit::ValidateParam($row['MacAddress'], _STRING);
4396+ $this->lastChanged = Kit::ValidateParam($row['LastChanged'], _INT);
4397+ $this->numberOfMacAddressChanges = Kit::ValidateParam($row['NumberOfMacAddressChanges'], _INT);
4398+ $this->lastWakeOnLanCommandSent = Kit::ValidateParam($row['LastWakeOnLanCommandSent'], _INT);
4399+ $this->wakeOnLanEnabled = Kit::ValidateParam($row['WakeOnLan'], _INT);
4400+ $this->wakeOnLanTime = Kit::ValidateParam($row['WakeOnLanTime'], _STRING);
4401+ $this->broadCastAddress = Kit::ValidateParam($row['BroadCastAddress'], _STRING);
4402+ $this->secureOn = Kit::ValidateParam($row['SecureOn'], _STRING);
4403+ $this->cidr = Kit::ValidateParam($row['Cidr'], _INT);
4404+ $this->latitude = Kit::ValidateParam($row['Latitude'], _DOUBLE);
4405+ $this->longitude = Kit::ValidateParam($row['Longitude'], _DOUBLE);
4406+ $this->versionInstructions = Kit::ValidateParam($row['version_instructions'], _STRING);
4407+ $this->clientType = Kit::ValidateParam($row['client_type'], _STRING);
4408+ $this->clientVersion = Kit::ValidateParam($row['client_version'], _STRING);
4409+ $this->clientCode = Kit::ValidateParam($row['client_code'], _INT);
4410+ $this->displayProfileId = Kit::ValidateParam($row['displayprofileid'], _INT);
4411+ $this->currentLayoutId = Kit::ValidateParam($row['currentLayoutId'], _INT);
4412+ $this->screenShotRequested = Kit::ValidateParam($row['screenShotRequested'], _INT);
4413+
4414+ $this->displayGroupId = Kit::ValidateParam($row['displaygroupid'], _INT);
4415+
4416+ // Store the current licensed flag, in case we are changing it and need to check it.
4417+ $this->currentLicensed = $this->licensed;
4418+
4419+ $this->loaded = true;
4420+
4421+ return true;
4422+ }
4423+ catch (Exception $e) {
4424+
4425+ Debug::LogEntry('error', $e->getMessage());
4426+
4427+ if (!$this->IsError())
4428+ $this->SetError(1, __('Unknown Error'));
4429+
4430+ return false;
4431+ }
4432+ }
4433+
4434+ /**
4435+ * Adds a Display
4436+ * @return
4437+ * @param $display Object
4438+ * @param $isAuditing Object
4439+ * @param $defaultLayoutID Object
4440+ * @param $license Object
4441+ * @param $licensed Object
4442+ * @param $incSchedule Object
4443+ */
4444+ public function Add($display, $isAuditing, $defaultLayoutID, $license, $licensed, $incSchedule) {
4445+ Debug::LogEntry('audit', 'IN', get_class(), __FUNCTION__);
4446
4447 try {
4448 $dbh = PDOConnect::init();
4449@@ -62,7 +168,7 @@
4450 'email_alert' => 0,
4451 'alert_timeout' => 0
4452 ));
4453-
4454+
4455 // Get the ID of the inserted record
4456 $displayId = $dbh->lastInsertId();
4457
4458@@ -89,20 +195,26 @@
4459
4460 return false;
4461 }
4462- }
4463-
4464- /**
4465- * Edits a Display
4466- * @return
4467- * @param $displayID Object
4468- * @param $isAuditing Object
4469- * @param $defaultLayoutID Object
4470- * @param $licensed Object
4471- * @param $incSchedule Object
4472- */
4473- public function Edit($displayID, $display, $isAuditing, $defaultLayoutID, $licensed, $incSchedule, $email_alert, $alert_timeout, $wakeOnLanEnabled, $wakeOnLanTime, $broadCastAddress, $secureOn, $cidr, $latitude, $longitude)
4474- {
4475- Debug::LogEntry('audit', 'IN', 'Display', 'Edit');
4476+ }
4477+
4478+ /**
4479+ * Edits a Display
4480+ * @return
4481+ * @param $displayID Object
4482+ * @param $isAuditing Object
4483+ * @param $defaultLayoutID Object
4484+ * @param $licensed Object
4485+ * @param $incSchedule Object
4486+ */
4487+ public function Edit() {
4488+ Debug::LogEntry('audit', 'IN', get_class(), __FUNCTION__);
4489+
4490+ // Validation
4491+ if ($this->display == '')
4492+ return $this->SetError(__("Can not have a display without a name"));
4493+
4494+ if ($this->wakeOnLanEnabled == 1 && $this->wakeOnLanTime == '')
4495+ return $this->SetError(__('Wake on Lan is enabled, but you have not specified a time to wake the display'));
4496
4497 try {
4498 $dbh = PDOConnect::init();
4499@@ -110,19 +222,10 @@
4500 // Check the number of licensed displays
4501 $maxDisplays = Config::GetSetting('MAX_LICENSED_DISPLAYS');
4502
4503- if ($maxDisplays > 0)
4504- {
4505+ if ($maxDisplays > 0) {
4506 // See if this is a license switch
4507- $sth = $dbh->prepare('SELECT licensed FROM display WHERE DisplayID = :displayid');
4508- $sth->execute(array(
4509- 'displayid' => $displayID
4510- ));
4511-
4512- if (!$row = $sth->fetch())
4513- $this->ThrowError(25004, __('Cannot find display record'));
4514-
4515 // Has the licence flag toggled?
4516- if (Kit::ValidateParam($row['licensed'], _INT) != $licensed && $licensed == 1)
4517+ if ($this->currentLicensed != $this->licensed && $this->licensed == 1)
4518 {
4519 // License change - test number of licensed displays.
4520 $sth = $dbh->prepare('SELECT COUNT(DisplayID) AS CountLicensed FROM display WHERE licensed = 1');
4521@@ -143,101 +246,106 @@
4522 // Validate some parameters
4523
4524 // Fill $addr with client's IP address, if $addr is empty
4525- if ($broadCastAddress != '')
4526+ if ($this->broadCastAddress != '')
4527 {
4528 // Resolve broadcast address
4529 // same as (but easier than): preg_match("/\b(([01]?\d?\d|2[0-4]\d|25[0-5])\.){3}([01]?\d?\d|2[0-4]\d|25[0-5])\b/",$addr)
4530- if (!filter_var($broadCastAddress, FILTER_VALIDATE_IP))
4531+ if (!filter_var($this->broadCastAddress, FILTER_VALIDATE_IP))
4532 $this->ThrowError(25015, __('BroadCast Address is not a valid IP Address'));
4533 }
4534
4535 // Check whether $cidr is valid
4536- if ($cidr != '')
4537+ if ($this->cidr != '')
4538 {
4539- if ((!is_numeric($cidr)) || ($cidr < 0) || ($cidr > 32))
4540+ if ((!is_numeric($this->cidr)) || ($this->cidr < 0) || ($this->cidr > 32))
4541 $this->ThrowError(25015, __('CIDR subnet mask is not a number within the range of 0 to 32.'));
4542 }
4543
4544 // Check whether $secureOn is valid
4545- if ($secureOn != '')
4546+ if ($this->secureOn != '')
4547 {
4548- $secureOn = strtoupper($secureOn);
4549- $secureOn = str_replace(":", "-", $secureOn);
4550+ $this->secureOn = strtoupper($this->secureOn);
4551+ $this->secureOn = str_replace(":", "-", $this->secureOn);
4552
4553- if ((!preg_match("/([A-F0-9]{2}[-]){5}([0-9A-F]){2}/", $secureOn)) || (strlen($secureOn) != 17))
4554+ if ((!preg_match("/([A-F0-9]{2}[-]){5}([0-9A-F]){2}/", $this->secureOn)) || (strlen($this->secureOn) != 17))
4555 $this->ThrowError(25015, __('Pattern of secureOn-password is not "xx-xx-xx-xx-xx-xx" (x = digit or CAPITAL letter)'));
4556 }
4557
4558 Debug::LogEntry('audit', 'Validation Complete and Passed', 'Display', 'Edit');
4559
4560- // Update the display record
4561- $SQL = "UPDATE display SET display = :display, ";
4562- $SQL .= " defaultlayoutid = :defaultlayoutid, ";
4563- $SQL .= " inc_schedule = :incschedule, ";
4564- $SQL .= " licensed = :licensed, ";
4565- $SQL .= " isAuditing = :isauditing, ";
4566- $SQL .= " email_alert = :emailalert, ";
4567- $SQL .= " alert_timeout = :alerttimeout, ";
4568- $SQL .= " WakeOnLan = :wakeonlan, ";
4569- $SQL .= " WakeOnLanTime = :wakeonlantime, ";
4570- $SQL .= " BroadCastAddress = :broadcastaddress, ";
4571- $SQL .= " SecureOn = :secureon, ";
4572- $SQL .= " Cidr = :cidr, ";
4573- $SQL .= " GeoLocation = POINT(:latitude, :longitude) ";
4574- $SQL .= " WHERE displayid = :displayid ";
4575+ // Update the display record
4576+ $SQL = '
4577+ UPDATE display
4578+ SET display = :display,
4579+ defaultlayoutid = :defaultlayoutid,
4580+ inc_schedule = :incschedule,
4581+ licensed = :licensed,
4582+ isAuditing = :isauditing,
4583+ email_alert = :emailalert,
4584+ alert_timeout = :alerttimeout,
4585+ WakeOnLan = :wakeonlan,
4586+ WakeOnLanTime = :wakeonlantime,
4587+ BroadCastAddress = :broadcastaddress,
4588+ SecureOn = :secureon,
4589+ Cidr = :cidr,
4590+ GeoLocation = POINT(:latitude, :longitude),
4591+ displayprofileid = :displayprofileid
4592+ WHERE displayid = :displayid';
4593
4594 $sth = $dbh->prepare($SQL);
4595 $sth->execute(array(
4596- 'display' => $display,
4597- 'defaultlayoutid' => $defaultLayoutID,
4598- 'incschedule' => $incSchedule,
4599- 'licensed' => $licensed,
4600- 'isauditing' => $isAuditing,
4601- 'emailalert' => $email_alert,
4602- 'alerttimeout' => $alert_timeout,
4603- 'wakeonlan' => $wakeOnLanEnabled,
4604- 'wakeonlantime' => $wakeOnLanTime,
4605- 'broadcastaddress' => $broadCastAddress,
4606- 'secureon' => $secureOn,
4607- 'cidr' => $cidr,
4608- 'latitude' => $latitude,
4609- 'longitude' => $longitude,
4610- 'displayid' => $displayID
4611+ 'display' => $this->display,
4612+ 'defaultlayoutid' => $this->defaultLayoutId,
4613+ 'incschedule' => $this->incSchedule,
4614+ 'licensed' => $this->licensed,
4615+ 'isauditing' => $this->isAuditing,
4616+ 'emailalert' => $this->emailAlert,
4617+ 'alerttimeout' => $this->alertTimeout,
4618+ 'wakeonlan' => $this->wakeOnLanEnabled,
4619+ 'wakeonlantime' => $this->wakeOnLanTime,
4620+ 'broadcastaddress' => $this->broadCastAddress,
4621+ 'secureon' => $this->secureOn,
4622+ 'cidr' => $this->cidr,
4623+ 'latitude' => $this->latitude,
4624+ 'longitude' => $this->longitude,
4625+ 'displayprofileid' => $this->displayProfileId,
4626+ 'displayid' => $this->displayId
4627 ));
4628
4629 Debug::LogEntry('audit', 'Display Edited', 'Display', 'Edit');
4630-
4631- // Use a DisplayGroup to handle the default layout and displaygroup name for this display
4632- $displayGroupObject = new DisplayGroup($this->db);
4633-
4634- // Do we also want to update the linked Display Groups name (seeing as that is what we will be presenting to everyone)
4635- if (!$displayGroupObject->EditDisplayGroup($displayID, $display)) {
4636+
4637+ // Use a DisplayGroup to handle the default layout and displaygroup name for this display
4638+ Kit::ClassLoader('displaygroup');
4639+ $displayGroupObject = new DisplayGroup();
4640+
4641+ // Do we also want to update the linked Display Groups name (seeing as that is what we will be presenting to everyone)
4642+ if (!$displayGroupObject->Edit($this->displayGroupId, $this->display, $this->description)) {
4643 $this->ThrowError(25002, __('Could not update this display with a new name.'));
4644 }
4645
4646- Debug::LogEntry('audit', 'OUT', 'DisplayGroup', 'Edit');
4647-
4648- return true;
4649+ Debug::LogEntry('audit', 'OUT', 'DisplayGroup', 'Edit');
4650+
4651+ return true;
4652 }
4653 catch (Exception $e) {
4654
4655- Debug::LogEntry('error', $e->getMessage());
4656+ Debug::LogEntry('error', $e->getMessage(), get_class(), __FUNCTION__);
4657
4658 if (!$this->IsError())
4659 $this->SetError(25000, __('Could not update display'));
4660
4661 return false;
4662 }
4663- }
4664-
4665- /**
4666- * Deletes a Display
4667- * @return
4668- * @param $displayID Object
4669- */
4670- public function Delete($displayID)
4671- {
4672- Debug::LogEntry('audit', 'IN', 'Display', 'Delete');
4673+ }
4674+
4675+ /**
4676+ * Deletes a Display
4677+ * @return
4678+ * @param $displayID Object
4679+ */
4680+ public function Delete($displayID)
4681+ {
4682+ Debug::LogEntry('audit', 'IN', get_class(), __FUNCTION__);
4683
4684 try {
4685 $dbh = PDOConnect::init();
4686@@ -276,17 +384,17 @@
4687
4688 return false;
4689 }
4690- }
4691-
4692- /**
4693- * Edits a Displays Name
4694- * @return
4695- * @param $license Object
4696- * @param $display Object
4697- */
4698- public function EditDisplayName($license, $display)
4699- {
4700- Debug::LogEntry('audit', 'IN', 'DisplayGroup', 'EditDisplayName');
4701+ }
4702+
4703+ /**
4704+ * Edits a Displays Name
4705+ * @return
4706+ * @param $license Object
4707+ * @param $display Object
4708+ */
4709+ public function EditDisplayName($license, $display)
4710+ {
4711+ Debug::LogEntry('audit', 'IN', get_class(), __FUNCTION__);
4712
4713 try {
4714 $dbh = PDOConnect::init();
4715@@ -297,17 +405,17 @@
4716 'display' => $display,
4717 'license' => $license
4718 ));
4719-
4720- // Also need to update the display group name here.
4721- $displayGroupObject = new DisplayGroup($this->db);
4722-
4723- // Do we also want to update the linked Display Groups name (seeing as that is what we will be presenting to everyone)
4724- if (!$displayGroupObject->EditDisplayGroup($displayID, $display))
4725- $this->ThrowError(25015, __('Could not update this display with a new name.'));
4726-
4727- Debug::LogEntry('audit', 'OUT', 'DisplayGroup', 'EditDisplayName');
4728-
4729- return true;
4730+
4731+ // Also need to update the display group name here.
4732+ $displayGroupObject = new DisplayGroup($this->db);
4733+
4734+ // Do we also want to update the linked Display Groups name (seeing as that is what we will be presenting to everyone)
4735+ if (!$displayGroupObject->EditDisplayGroup($displayID, $display))
4736+ $this->ThrowError(25015, __('Could not update this display with a new name.'));
4737+
4738+ Debug::LogEntry('audit', 'OUT', 'DisplayGroup', 'EditDisplayName');
4739+
4740+ return true;
4741 }
4742 catch (Exception $e) {
4743
4744@@ -318,106 +426,95 @@
4745
4746 return false;
4747 }
4748- }
4749-
4750- /**
4751+ }
4752+
4753+ /**
4754 * Sets the information required on the display to indicate that it is still logged in
4755- * @param string $license The display licence key
4756- * @param string $clientAddress The client IP address
4757- * @param integer $mediaInventoryComplete The Media Inventory Status
4758- * @param string $mediaInventoryXml The Media Inventory XML
4759- * @param string $macAddress The Client Mac Address
4760- * @param string $clientType The Client Type
4761- * @param string $clientVersion The Client Version
4762- * @param integer $clientCode The Client Version Code
4763+ * @param int $displayId The Display ID
4764+ * @param array $status The Display Status
4765 */
4766- public function Touch($license, $clientAddress = '', $mediaInventoryComplete = 0, $mediaInventoryXml = '', $macAddress = '', $clientType = '', $clientVersion = '', $clientCode = 0)
4767- {
4768- Debug::LogEntry('audit', 'IN', 'DisplayGroup', 'Touch');
4769+ public function Touch($displayId, $status = array())
4770+ {
4771+ Debug::LogEntry('audit', 'IN', get_class(), __FUNCTION__);
4772
4773 try {
4774 $dbh = PDOConnect::init();
4775
4776- // Set the last accessed flag on the display
4777- $SQL = "";
4778- $SQL .= "UPDATE display SET lastaccessed = :lastaccessed, loggedin = :loggedin ";
4779-
4780- $params = array();
4781- $params['lastaccessed'] = time();
4782- $params['loggedin'] = 1;
4783- $params['license'] = $license;
4784-
4785- // We will want to update the client Address if it is given
4786- if ($clientAddress != '') {
4787- $SQL .= " , ClientAddress = :clientaddress ";
4788- $params['clientaddress'] = $clientAddress;
4789- }
4790-
4791- // Media Inventory Settings (if appropriate)
4792- if ($mediaInventoryComplete != 0) {
4793- $SQL .= " , MediaInventoryStatus = :mediainventorystatus ";
4794- $params['mediainventorystatus'] = $mediaInventoryComplete;
4795- }
4796-
4797- if ($mediaInventoryXml != '') {
4798- $SQL .= " , MediaInventoryXml = :mediainventoryxml ";
4799- $params['mediainventoryxml'] = $mediaInventoryXml;
4800- }
4801-
4802- // Client information if present
4803- if ($clientType != '') {
4804- $SQL .= " , client_type = :client_type ";
4805- $params['client_type'] = $clientType;
4806- }
4807-
4808- if ($clientVersion != '') {
4809- $SQL .= " , client_version = :client_version ";
4810- $params['client_version'] = $clientVersion;
4811- }
4812-
4813- if ($clientCode != '') {
4814- $SQL .= " , client_code = :client_code ";
4815- $params['client_code'] = $clientCode;
4816- }
4817-
4818- // Mac address storage
4819- if ($macAddress != '')
4820- {
4821- // Address changed.
4822- $sth = $dbh->prepare('SELECT MacAddress FROM display WHERE license = :license');
4823- $sth->execute(array(
4824- 'license' => $license
4825- ));
4826-
4827- if (!$row = $sth->fetch())
4828- $currentAddress = '';
4829- else
4830- $currentAddress = $row['MacAddress'];
4831-
4832- if ($macAddress != $currentAddress)
4833- {
4834- $SQL .= " , MacAddress = :macaddress, LastChanged = :lastchanged, NumberOfMacAddressChanges = NumberOfMacAddressChanges + 1 ";
4835- $params['macaddress'] = $macAddress;
4836- $params['lastchanged'] = time();
4837+ $this->displayId = $displayId;
4838+ $this->Load();
4839+
4840+ // Update last accessed and set to be logged in
4841+ $this->lastAccessed = time();
4842+ $this->loggedIn = 1;
4843+
4844+ // Pull in any of the optional parameters from the status array
4845+ $this->clientAddress = (Kit::GetParam('clientAddress', $status, _STRING) == '') ? $this->clientAddress : Kit::GetParam('clientAddress', $status, _STRING);
4846+ $this->mediaInventoryStatus = (Kit::GetParam('mediaInventoryStatus', $status, _INT) == 0) ? $this->mediaInventoryStatus : Kit::GetParam('mediaInventoryStatus', $status, _INT);
4847+ $this->mediaInventoryXml = (Kit::GetParam('mediaInventoryXml', $status, _HTMLSTRING) == '') ? $this->mediaInventoryXml : Kit::GetParam('mediaInventoryXml', $status, _HTMLSTRING);
4848+ $this->clientType = (Kit::GetParam('clientType', $status, _STRING) == '') ? $this->clientType : Kit::GetParam('clientType', $status, _STRING);
4849+ $this->clientVersion = (Kit::GetParam('clientVersion', $status, _STRING) == '') ? $this->clientVersion : Kit::GetParam('clientVersion', $status, _STRING);
4850+ $this->clientCode = (Kit::GetParam('clientCode', $status, _INT) == 0) ? $this->clientCode : Kit::GetParam('clientCode', $status, _INT);
4851+ $this->currentLayoutId = (Kit::GetParam('currentLayoutId', $status, _INT) == 0) ? $this->currentLayoutId : Kit::GetParam('currentLayoutId', $status, _INT);
4852+ $this->screenShotRequested = (Kit::GetParam('screenShotRequested', $status, _INT, -1) == -1) ? $this->screenShotRequested : Kit::GetParam('screenShotRequested', $status, _INT);
4853+
4854+ // Has the mac address changed
4855+ if (Kit::GetParam('macAddress', $status, _STRING) != '') {
4856+ if ($this->macAddress != Kit::GetParam('macAddress', $status, _STRING)) {
4857+ // Mac address change detected
4858+ $this->macAddress = Kit::GetParam('macAddress', $status, _STRING);
4859+ $this->numberOfMacAddressChanges++;
4860+ $this->lastChanged = time();
4861 }
4862 }
4863
4864- // Restrict to the display license
4865- $SQL .= " WHERE license = :license";
4866+ // Save
4867+ $SQL = '
4868+ UPDATE display SET lastaccessed = :lastAccessed,
4869+ loggedin = :loggedIn,
4870+ ClientAddress = :clientAddress,
4871+ MediaInventoryStatus = :mediaInventoryStatus,
4872+ MediaInventoryXml = :mediaInventoryXml,
4873+ client_type = :clientType,
4874+ client_version = :clientVersion,
4875+ client_code = :clientCode,
4876+ MacAddress = :macAddress,
4877+ LastChanged = :lastChanged,
4878+ NumberOfMacAddressChanges = :numberOfMacAddressChanges,
4879+ currentLayoutId = :currentLayoutId,
4880+ screenShotRequested = :screenShotRequested
4881+ WHERE displayId = :displayId
4882+ ';
4883
4884- // Update the display with its new name (using the license as the key)
4885+ // Update the display
4886 $sth = $dbh->prepare($SQL);
4887- $sth->execute($params);
4888-
4889- Debug::LogEntry('audit', 'OUT', 'DisplayGroup', 'Touch');
4890-
4891- return true;
4892+ $sth->execute(array(
4893+ 'displayId' => $this->displayId,
4894+ 'lastAccessed' => $this->lastAccessed,
4895+ 'loggedIn' => $this->loggedIn,
4896+ 'clientAddress' => $this->clientAddress,
4897+ 'mediaInventoryStatus' => $this->mediaInventoryStatus,
4898+ 'mediaInventoryXml' => $this->mediaInventoryXml,
4899+ 'clientType' => $this->clientType,
4900+ 'clientVersion' => $this->clientVersion,
4901+ 'clientCode' => $this->clientCode,
4902+ 'macAddress' => $this->macAddress,
4903+ 'lastChanged' => $this->lastChanged,
4904+ 'numberOfMacAddressChanges' => $this->numberOfMacAddressChanges,
4905+ 'currentLayoutId' => $this->currentLayoutId,
4906+ 'screenShotRequested' => $this->screenShotRequested
4907+ ));
4908+
4909+ return true;
4910 }
4911 catch (Exception $e) {
4912 Debug::LogEntry('error', $e->getMessage());
4913 return $this->SetError(25002, __("Error updating this displays last accessed information."));
4914 }
4915- }
4916+ }
4917+
4918+ public function RequestScreenShot($displayId) {
4919+ return $this->Touch($displayId, array('screenShotRequested' => 1));
4920+ }
4921
4922 /**
4923 * Flags a display as being incomplete
4924@@ -460,12 +557,14 @@
4925
4926 // Which displays does a change to this layout effect?
4927 $SQL = " SELECT DISTINCT display.DisplayID ";
4928- $SQL .= " FROM schedule_detail ";
4929- $SQL .= " INNER JOIN lkdisplaydg ";
4930- $SQL .= " ON lkdisplaydg.DisplayGroupID = schedule_detail.DisplayGroupID ";
4931- $SQL .= " INNER JOIN display ";
4932- $SQL .= " ON lkdisplaydg.DisplayID = display.displayID ";
4933- $SQL .= " WHERE schedule_detail.CampaignID = :campaignid ";
4934+ $SQL .= " FROM schedule ";
4935+ $SQL .= " INNER JOIN schedule_detail ";
4936+ $SQL .= " ON schedule_detail.eventid = schedule.eventid ";
4937+ $SQL .= " INNER JOIN lkdisplaydg ";
4938+ $SQL .= " ON lkdisplaydg.DisplayGroupID = schedule_detail.DisplayGroupID ";
4939+ $SQL .= " INNER JOIN display ";
4940+ $SQL .= " ON lkdisplaydg.DisplayID = display.displayID ";
4941+ $SQL .= " WHERE schedule.CampaignID = :campaignid ";
4942 $SQL .= " AND schedule_detail.FromDT < :fromdt AND schedule_detail.ToDT > :todt ";
4943 $SQL .= " UNION ";
4944 $SQL .= " SELECT DISTINCT display.DisplayID ";
4945@@ -505,7 +604,7 @@
4946 */
4947 public function EditDefaultLayout($displayId, $defaultLayoutId)
4948 {
4949- Debug::LogEntry('audit', 'IN', 'Display', 'EditDefaultLayout');
4950+ Debug::LogEntry('audit', 'IN', get_class(), __FUNCTION__);
4951
4952 try {
4953 $dbh = PDOConnect::init();
4954@@ -567,7 +666,7 @@
4955 */
4956 public function WakeOnLan($displayId)
4957 {
4958- Debug::LogEntry('audit', 'IN', 'Display', 'WakeOnLan');
4959+ Debug::LogEntry('audit', 'IN', get_class(), __FUNCTION__);
4960
4961 try {
4962 $dbh = PDOConnect::init();
4963@@ -613,15 +712,16 @@
4964 * Wake On Lan Script
4965 * // Version: 2
4966 * // Author of this application:
4967- * // DS508_customer (http://www.synology.com/enu/forum/memberlist.php?mode=viewprofile&u=12636)
4968- * // Please inform the author of any suggestions on (the functionality, graphical design, ... of) this application.
4969- * // More info: http://wolviaphp.sourceforge.net
4970+ * // DS508_customer (http://www.synology.com/enu/forum/memberlist.php?mode=viewprofile&u=12636)
4971+ * // Please inform the author of any suggestions on (the functionality, graphical design, ... of) this application.
4972+ * // More info: http://wolviaphp.sourceforge.net
4973 * // License: GPLv2.0
4974 *
4975 * Modified for use with the Xibo project by Dan Garner.
4976 */
4977- function TransmitWakeOnLan($mac_address, $secureon, $addr, $cidr, $port)
4978- {
4979+ function TransmitWakeOnLan($mac_address, $secureon, $addr, $cidr, $port) {
4980+ Debug::LogEntry('audit', 'IN', get_class(), __FUNCTION__);
4981+
4982 // Prepare magic packet: part 1/3 (defined constant)
4983 $buf = "";
4984
4985
4986=== modified file 'server/lib/data/displaygroup.data.class.php'
4987--- server/lib/data/displaygroup.data.class.php 2014-04-19 09:11:34 +0000
4988+++ server/lib/data/displaygroup.data.class.php 2014-09-19 11:39:09 +0000
4989@@ -22,12 +22,12 @@
4990
4991 class DisplayGroup extends Data
4992 {
4993- public function __construct(database $db)
4994+ public function __construct()
4995 {
4996 include_once('lib/data/schedule.data.class.php');
4997 include_once('lib/data/displaygroupsecurity.data.class.php');
4998
4999- parent::__construct($db);
5000+ parent::__construct();
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches