Example #1
0
 public function initialize()
 {
     $this->addPrettyName('general', _('General configuration'));
     $c = new ConfigElement_select('system_in_maintenance', _('System on maintenance mode'), _('System on maintenance mode'), _('System on maintenance mode'), 0);
     $c->setContentAvailable(array(0 => _('no'), 1 => _('yes')));
     $this->add($c, 'general');
     $c = new ConfigElement_select('admin_language', _('Administration console language'), _('Administration console language'), _('Administration console language'), 'auto');
     $c->setContentAvailable(array('auto' => _('Autodetect'), 'ar_AE' => 'العربي', 'ca-es' => 'Català', 'cs_CZ' => 'Česky', 'de_DE' => 'Deutsch', 'en_GB' => 'English', 'es_ES' => 'Español', 'fr_FR' => 'Français', 'hu_HU' => 'Magyar', 'it_IT' => 'Italiano', 'ja_JP' => '日本語', 'nl_NL' => 'Nederlands', 'pt_BR' => 'Português (Brasil)', 'sk_SK' => 'Slovenčina', 'ro_RO' => 'Română', 'ru_RU' => 'Русский', 'zh_CN' => '中文简体'));
     $this->add($c, 'general');
     $c = new ConfigElement_multiselect('log_flags', _('Debug options list'), _('Select debug options you want to enable.'), _('Select debug options you want to enable.'), array('info', 'warning', 'error', 'critical'));
     $c->setContentAvailable(array('debug' => _('debug'), 'info' => _('info'), 'warning' => _('warning'), 'error' => _('error'), 'critical' => _('critical')));
     $this->add($c, 'general');
     $c = new ConfigElement_select('cache_update_interval', _('Cache logs update interval'), _('Cache logs update interval'), _('Cache logs update interval'), 30);
     $c->setContentAvailable(array(30 => _('30 seconds'), 60 => _('1 minute'), 300 => _('5 minutes'), 900 => _('15 minutes'), 1800 => _('30 minutes'), 3600 => _('1 hour'), 7200 => _('2 hours')));
     $this->add($c, 'general');
     $c = new ConfigElement_select('cache_expire_time', _('Cache logs expiry time'), _('Cache logs expiry time'), _('Cache logs expiry time'), 86400 * 366);
     $c->setContentAvailable(array(86400 => _('A day'), 86400 * 7 => _('A week'), 86400 * 31 => _('A month'), 86400 * 366 => _('A year')));
     $this->add($c, 'general');
     // 		$c = new ConfigElement_input('start_app','start_app','start_app_des','');
     // 		$this->add('general',$c);
     $c = new ConfigElement_text('user_default_group', _('Default user group'), _('Default user group'), _('Default user group'), '');
     $this->add($c, 'general');
     $c = new ConfigElement_select('domain_integration', _('Domain integration'), _('Domain integration'), _('Domain integration'), 'internal');
     $domain_integration_select = array();
     if (function_exists('get_classes_startwith_admin')) {
         // are we on /admin ?
         $domain_integration_classes = get_classes_startwith_admin('Configuration_mode_');
         foreach ($domain_integration_classes as $a_class) {
             if (class_exists($a_class)) {
                 // can not call class->getPrettyName(); because we might be on the admin
                 $b = new $a_class();
                 $name = substr($a_class, strlen('Configuration_mode_'));
                 $domain_integration_select[$name] = $b->getPrettyName();
             } else {
                 $name = substr($a_class, strlen('Configuration_mode_'));
                 $domain_integration_select[$name] = $name;
             }
         }
     } else {
         $domain_integration_select['internal'] = _('Internal');
     }
     $c->setContentAvailable($domain_integration_select);
     $this->add($c, 'general');
     $c = new ConfigElement_input('max_items_per_page', _('Maximum items per page'), _('The maximum number of items that can be displayed.'), _('The maximum number of items that can be displayed.'), 100);
     $this->add($c, 'general');
     $c = new ConfigElement_multiselect('default_policy', _('Default policy'), _('Default policy'), _('Default policy'), array());
     $c->setContentAvailable(array('canUseAdminPanel' => _('use Admin panel'), 'viewServers' => _('view Servers'), 'manageServers' => _('manage Servers'), 'viewSharedFolders' => _('view Shared folders'), 'manageSharedFolders' => _('manage Shared folders'), 'viewUsers' => _('view Users'), 'manageUsers' => _('manage Users'), 'viewUsersGroups' => _('view Usergroups'), 'manageUsersGroups' => _('manage Usergroups'), 'viewApplications' => _('view Applications'), 'manageApplications' => _('manage Applications'), 'viewApplicationsGroups' => _('view Application groups'), 'manageApplicationsGroups' => _('manage Application groups'), 'viewPublications' => _('view Publications'), 'managePublications' => _('manage Publications'), 'viewConfiguration' => _('view Configuration'), 'manageConfiguration' => _('manage Configuration'), 'viewStatus' => _('view Status'), 'viewSummary' => _('view Summary'), 'viewNews' => _('view News'), 'manageNews' => _('manage News')));
     $this->add($c, 'general', 'policy');
     $this->addPrettyName('policy', _('Policy for administration delegation'));
     $this->addPrettyName('sql', _('SQL configuration'));
     $c = new ConfigElement_select('type', _('Database type'), _('The type of your database.'), _('The type of your database.'), 'mysql');
     $c->setContentAvailable(array('mysql' => _('MySQL')));
     $this->add($c, 'general', 'sql');
     $c = new ConfigElement_input('host', _('Database host address'), _('The address of your database host. This database contains adminstration console data. Example: localhost or db.mycorporate.com.'), _('The address of your database host. This database contains adminstration console data. Example: localhost or db.mycorporate.com.'), 'localhost');
     $this->add($c, 'general', 'sql');
     $c = new ConfigElement_input('user', _('Database username'), _('The username that must be used to access the database.'), _('The user name that must be used to access the database.'), '');
     $this->add($c, 'general', 'sql');
     $c = new ConfigElement_password('password', _('Database password'), _('The user password that must be used to access the database.'), _('The user password that must be used to access the database.'), '');
     $this->add($c, 'general', 'sql');
     $c = new ConfigElement_input('database', _('Database name'), _('The name of the database.'), _('The name of the database.'), 'ovd');
     $this->add($c, 'general', 'sql');
     $c = new ConfigElement_input('prefix', _('Table prefix'), _('The table prefix for the database.'), _('The table prefix for the database.'), 'ulteo_');
     $this->add($c, 'general', 'sql');
     $this->addPrettyName('mails_settings', _('Email settings'));
     $c_mail_type = new ConfigElement_select('send_type', _('Mail server type'), _('Mail server type'), _('Mail server type'), 'mail');
     $c_mail_type->setContentAvailable(array('mail' => _('Local'), 'smtp' => _('SMTP server')));
     $this->add($c_mail_type, 'general', 'mails_settings');
     $c = new ConfigElement_input('send_from', _('From'), _('From'), _('From'), 'no-reply@' . @$_SERVER['SERVER_NAME']);
     $this->add($c, 'general', 'mails_settings');
     // SMTP conf
     $c = new ConfigElement_input('send_host', _('Host'), _('Host'), _('Host'), '');
     $this->add($c, 'general', 'mails_settings');
     $c_mail_type->addReference('smtp', $c);
     $c = new ConfigElement_input('send_port', _('Port'), _('Port'), _('Port'), 25);
     $this->add($c, 'general', 'mails_settings');
     $c_mail_type->addReference('smtp', $c);
     $c = new ConfigElement_select('send_ssl', _('Use SSL with SMTP'), _('Use SSL with SMTP'), _('Use SSL with SMTP'), 0);
     $c->setContentAvailable(array(0 => _('no'), 1 => _('yes')));
     $this->add($c, 'general', 'mails_settings');
     $c_mail_type->addReference('smtp', $c);
     $c = new ConfigElement_select('send_auth', _('Authentication'), _('Authentication'), _('Authentication'), 0);
     $c->setContentAvailable(array(0 => _('no'), 1 => _('yes')));
     $this->add($c, 'general', 'mails_settings');
     $c_mail_type->addReference('smtp', $c);
     $c = new ConfigElement_input('send_username', _('SMTP username'), _('SMTP username'), _('SMTP username'), '');
     $this->add($c, 'general', 'mails_settings');
     $c_mail_type->addReference('smtp', $c);
     $c = new ConfigElement_password('send_password', _('SMTP password'), _('SMTP password'), _('SMTP password'), '');
     $this->add($c, 'general', 'mails_settings');
     $c_mail_type->addReference('smtp', $c);
     $this->addPrettyName('slave_server_settings', _('Slave Server settings'));
     $c = new ConfigElement_list('authorized_fqdn', _('Authorized machines (FQDN or IP - the use of wildcards (*.) is allowed)'), _('Authorized machines (FQDN or IP - the use of wildcards (*.) is allowed)'), _('Authorized machines (FQDN or IP - the use of wildcards (*.) is allowed)'), array('*'));
     $this->add($c, 'general', 'slave_server_settings');
     $c = new ConfigElement_select('disable_fqdn_check', _('Disable reverse FQDN checking'), _('Enable this option if you don\'t want to check that the result of the reverse FQDN address fits the one that was registered.'), _('Enable this option if you don\'t want to check that the result of the reverse FQDN address fits the one that was registered.'), 0);
     $c->setContentAvailable(array(0 => _('no'), 1 => _('yes')));
     $this->add($c, 'general', 'slave_server_settings');
     $c = new ConfigElement_select('action_when_as_not_ready', _('Action when a server status is not ready anymore'), _('Action when a server status is not ready anymore'), _('Action when an server status is not ready anymore'), 0);
     $c->setContentAvailable(array(0 => _('Do nothing'), 1 => _('Switch to maintenance')));
     $this->add($c, 'general', 'slave_server_settings');
     $c = new ConfigElement_select('auto_recover', _('Auto-recover server'), _('When a server status is down or broken, and it is sending monitoring, try to switch it back to ready ?'), _('When a server status is down or broken, and it is sending monitoring, try to switch it back to ready ?'), 1);
     $c->setContentAvailable(array(0 => _('no'), 1 => _('yes')));
     $this->add($c, 'general', 'slave_server_settings');
     $c = new ConfigElement_select('remove_orphan', _('Remove orphan applications when the application server is deleted'), _('Remove orphan applications when the application server is deleted'), _('Remove orphan applications when the application server is deleted'), 0);
     $c->setContentAvailable(array(0 => _('no'), 1 => _('yes')));
     $this->add($c, 'general', 'slave_server_settings');
     $c = new ConfigElement_select('auto_register_new_servers', _('Auto register new servers'), _('Auto register new servers'), _('Auto register new servers'), 0);
     $c->setContentAvailable(array(0 => _('no'), 1 => _('yes')));
     $this->add($c, 'general', 'slave_server_settings');
     $c = new ConfigElement_select('auto_switch_new_servers_to_production', _('Auto switch new servers to production mode'), _('Auto switch new servers to production mode'), _('Auto switch new servers to production mode'), 0);
     $c->setContentAvailable(array(0 => _('no'), 1 => _('yes')));
     $this->add($c, 'general', 'slave_server_settings');
     $c = new ConfigElement_select('use_max_sessions_limit', _('When an Application Server have reached its "max sessions" limit, disable session launch on it ?'), _('When an Application Server have reached its "max sessions" limit, disable session launch on it ?'), _('When an Application Server have reached its "max sessions" limit, disable session launch on it ?'), 1);
     $c->setContentAvailable(array(0 => _('no'), 1 => _('yes')));
     $this->add($c, 'general', 'slave_server_settings');
     $roles = array(Server::SERVER_ROLE_APS => _('Load Balancing policy for Application Servers'), Server::SERVER_ROLE_FS => _('Load Balancing policy for File Servers'));
     foreach ($roles as $role => $text) {
         $decisionCriterion = get_classes_startwith('DecisionCriterion_');
         $content_load_balancing = array();
         foreach ($decisionCriterion as $criterion_class_name) {
             $c = new $criterion_class_name(NULL);
             // ugly
             if ($c->applyOnRole($role)) {
                 $content_load_balancing[substr($criterion_class_name, strlen('DecisionCriterion_'))] = $c->default_value();
             }
         }
         $c = new ConfigElement_sliders_loadbalancing('load_balancing_' . $role, $text, $text, $text, $content_load_balancing);
         $this->add($c, 'general', 'slave_server_settings');
     }
     $this->addPrettyName('remote_desktop_settings', _('Remote Desktop settings'));
     $c_desktop_mode = new ConfigElement_select('enabled', _('Enable Remote Desktop'), _('Enable Remote Desktop'), _('Enable Remote Desktop'), 1);
     $c_desktop_mode->setContentAvailable(array(0 => _('no'), 1 => _('yes')));
     $this->add($c_desktop_mode, 'general', 'remote_desktop_settings');
     $c = new ConfigElement_select('persistent', _('Sessions are persistent'), _('Sessions are persistent'), _('Sessions are persistent'), 0);
     $c->setContentAvailable(array(0 => _('no'), 1 => _('yes')));
     $c_desktop_mode->addReference('1', $c);
     $this->add($c, 'general', 'remote_desktop_settings');
     $c = new ConfigElement_select('desktop_icons', _('Show icons on user desktop'), _('Show icons on user desktop'), _('Show icons on user desktop'), 1);
     $c->setContentAvailable(array(0 => _('no'), 1 => _('yes')));
     $c_desktop_mode->addReference('1', $c);
     $this->add($c, 'general', 'remote_desktop_settings');
     $c = new ConfigElement_select('allow_external_applications', _('Allow external applications in Desktop'), _('Allow external applications in Desktop'), _('Allow external applications in Desktop'), 1);
     $c->setContentAvailable(array(0 => _('no'), 1 => _('yes')));
     $c_desktop_mode->addReference('1', $c);
     $this->add($c, 'general', 'remote_desktop_settings');
     $c = new ConfigElement_select('desktop_type', _('Desktop type'), _('Desktop type'), _('Desktop type'), 'any');
     $c->setContentAvailable(array('any' => _('Any'), 'linux' => _('Linux'), 'windows' => _('Windows')));
     $c_desktop_mode->addReference('1', $c);
     $this->add($c, 'general', 'remote_desktop_settings');
     $c = new ConfigElement_list('allowed_desktop_servers', _('Servers which are allowed to start desktop'), _('An empty list means all servers can host a desktop (no restriction on desktop server choice)'), _('An empty list means all servers can host a desktop (no restriction on desktop server choice)'), array());
     $c_desktop_mode->addReference('1', $c);
     $this->add($c, 'general', 'remote_desktop_settings');
     $this->addPrettyName('remote_applications_settings', _('Remote Applications settings'));
     $c = new ConfigElement_select('enabled', _('Enable Remote Applications'), _('Enable Remote Applications'), _('Enable Remote Applications'), 1);
     $c->setContentAvailable(array(0 => _('no'), 1 => _('yes')));
     $this->add($c, 'general', 'remote_applications_settings');
     $this->addPrettyName('session_settings_defaults', _('Sessions settings'));
     $c = new ConfigElement_select('session_mode', _('Default mode for session'), _('Default mode for session'), _('Default mode for session'), Session::MODE_APPLICATIONS);
     $c->setContentAvailable(array(Session::MODE_DESKTOP => _('Desktop'), Session::MODE_APPLICATIONS => _('Applications')));
     $this->add($c, 'general', 'session_settings_defaults');
     $c = new ConfigElement_select('language', _('Default language for session'), _('Default language for session'), _('Default language for session'), 'en_GB');
     $c->setContentAvailable(array('ar_AE' => 'العربي', 'bg_BG' => 'Български', 'ca-es' => 'Català', 'cs_CZ' => 'Česky', 'da-dk' => 'Dansk', 'de_DE' => 'Deutsch', 'en_GB' => 'English', 'el_GR' => 'Ελληνικά', 'es_ES' => 'Español', 'fa_IR' => 'فارسی', 'fi_FI' => 'Suomi', 'fr_FR' => 'Français', 'he_IL' => 'עברית', 'hu_HU' => 'Magyar', 'id_ID' => 'Bahasa Indonesia', 'is_IS' => 'Icelandic', 'it_IT' => 'Italiano', 'ja_JP' => '日本語', 'ko_KR' => '한국어', 'nb_NO' => 'Norsk (bokmål)', 'nl_NL' => 'Nederlands', 'pl_PL' => 'Polski', 'pt_PT' => 'Português', 'pt_BR' => 'Português (Brasil)', 'ro_RO' => 'Română', 'ru_RU' => 'Русский', 'sk_SK' => 'Slovenčina', 'zh_CN' => '中文简体'));
     $this->add($c, 'general', 'session_settings_defaults');
     $c = new ConfigElement_select('timeout', _('Default timeout for session'), _('Default timeout for session'), _('Default timeout for session'), -1);
     $c->setContentAvailable(array(60 => _('1 minute'), 120 => _('2 minutes'), 300 => _('5 minutes'), 600 => _('10 minutes'), 900 => _('15 minutes'), 1800 => _('30 minutes'), 3600 => _('1 hour'), 7200 => _('2 hours'), 18000 => _('5 hours'), 43200 => _('12 hours'), 86400 => _('1 day'), 172800 => _('2 days'), 604800 => _('1 week'), 2764800 => _('1 month'), -1 => _('None')));
     $this->add($c, 'general', 'session_settings_defaults');
     $c = new ConfigElement_input('max_sessions_number', _('Maximum number of running sessions'), _('The maximum number of session that can be started on the farm (0 is unlimited).'), _('The maximum number of session that can be started on the farm (0 is unlimited).'), 0);
     $this->add($c, 'general');
     $c = new ConfigElement_select('launch_without_apps', _('User can launch a session even if some of his published applications are not available'), _('User can launch a session even if some of his published applications are not available'), _('User can launch a session even if some of his published applications are not available'), 0);
     $c->setContentAvailable(array(0 => _('no'), 1 => _('yes')));
     $this->add($c, 'general', 'session_settings_defaults');
     $c = new ConfigElement_select('allow_shell', _('User can use a console in the session'), _('User can use a console in the session'), _('User can use a console in the session'), 0);
     $c->setContentAvailable(array(0 => _('no'), 1 => _('yes')));
     $this->add($c, 'general', 'session_settings_defaults');
     $c = new ConfigElement_select('multimedia', _('Multimedia'), _('Multimedia'), _('Multimedia'), 1);
     $c->setContentAvailable(array(0 => _('no'), 1 => _('yes')));
     $this->add($c, 'general', 'session_settings_defaults');
     $c = new ConfigElement_select('redirect_client_drives', _('Redirect client drives'), _('Redirect client drives'), _("- None: none of the client drives will be used in the OVD session<br />- Partial: Desktop and My Documents user directories will be available in the OVD session<br />- Full: all client drives (including Desktop and My Documents) will be available in the OVD session"), 'full');
     $c->setContentAvailable(array('no' => _('no'), 'partial' => _('partial'), 'full' => _('full')));
     $this->add($c, 'general', 'session_settings_defaults');
     $c = new ConfigElement_select('redirect_client_printers', _('Redirect client printers'), _('Redirect client printers'), _('Redirect client printers'), 1);
     $c->setContentAvailable(array(0 => _('no'), 1 => _('yes')));
     $this->add($c, 'general', 'session_settings_defaults');
     $c = new ConfigElement_select('rdp_bpp', _('RDP bpp'), _('RDP color depth'), _('RDP color depth'), 16);
     $c->setContentAvailable(array(16 => '16', 24 => '24', 32 => '32'));
     $this->add($c, 'general', 'session_settings_defaults');
     $c = new ConfigElement_select('enhance_user_experience', _('Enhance user experience'), _('Enhance user experience: graphic effects and optimizations (It decreases performances if used in a Wide Area Network)'), _('Enhance user experience: graphic effects and optimizations (It decreases performances if used in a Wide Area Network)'), 1);
     $c->setContentAvailable(array(0 => _('no'), 1 => _('yes')));
     $this->add($c, 'general', 'session_settings_defaults');
     $c_user_profile = new ConfigElement_select('enable_profiles', _('Enable user profiles'), _('Enable user profiles'), _('Enable user profiles'), 1);
     $c_user_profile->setContentAvailable(array(0 => _('no'), 1 => _('yes')));
     $this->add($c_user_profile, 'general', 'session_settings_defaults');
     $c = new ConfigElement_select('auto_create_profile', _('Auto-create user profiles when non-existant'), _('Auto-create user profile when non-existant'), _('Auto-create user profile when nonexistant'), 1);
     $c->setContentAvailable(array(0 => _('no'), 1 => _('yes')));
     $c_user_profile->addReference('1', $c);
     $this->add($c, 'general', 'session_settings_defaults');
     $c = new ConfigElement_select('start_without_profile', _('Launch a session without a valid profile'), _('Launch a session without a valid profile'), _('Launch a session without a valid profile'), 1);
     $c->setContentAvailable(array(0 => _('no'), 1 => _('yes')));
     $c_user_profile->addReference('1', $c);
     $this->add($c, 'general', 'session_settings_defaults');
     $c_shared_folder = new ConfigElement_select('enable_sharedfolders', _('Enable shared folders'), _('Enable shared folders'), _('Enable shared folders'), 1);
     $c_shared_folder->setContentAvailable(array(0 => _('no'), 1 => _('yes')));
     $this->add($c_shared_folder, 'general', 'session_settings_defaults');
     $c = new ConfigElement_select('start_without_all_sharedfolders', _('Launch a session even when a shared folder\'s fileserver is missing'), _('Launch a session even when a shared folder\'s fileserver is missing'), _('Launch a session even when a shared folder\'s fileserver is missing'), 1);
     $c->setContentAvailable(array(0 => _('no'), 1 => _('yes')));
     $c_shared_folder->addReference('1', $c);
     $this->add($c, 'general', 'session_settings_defaults');
     $c = new ConfigElement_multiselect('advanced_settings_startsession', _('Forceable paramaters by users'), _('Choose Advanced Settings options you want to make available to users before they launch a session.'), _('Choose Advanced Settings options you want to make available to users before they launch a session.'), array('session_mode', 'language'));
     $c->setContentAvailable(array('session_mode' => _('session mode'), 'language' => _('language'), 'server' => _('server'), 'timeout' => _('timeout')));
     $this->add($c, 'general', 'session_settings_defaults');
     $this->addPrettyName('web_interface_settings', _('Web interface settings'));
     $c = new ConfigElement_select('show_list_users', _('Display users list'), _('Display the list of users from the corporate directory in the login box. If the list is not displayed, the user must provide his login name.'), _('Display the list of users from the corporate directory in the login box. If the list is not displayed, the user must provide his login name.'), 1);
     $c->setContentAvailable(array(0 => _('no'), 1 => _('yes')));
     $this->add($c, 'general', 'web_interface_settings');
     $c = new ConfigElement_select('public_webservices_access', _('Public Webservices access'), _('Authorize non authenticated requests to get information about users authorized applications or get applications icons.'), _('Authorize non authenticated requests to get information about users authorized applications or get applications icons.'), 0);
     $c->setContentAvailable(array(0 => _('no'), 1 => _('yes')));
     $this->add($c, 'general', 'web_interface_settings');
     $this->getPrefsModules();
     $this->getPrefsEvents();
 }
Example #2
0
 public function initialize()
 {
     $c = new ConfigElement_select('system_in_maintenance', 0);
     $c->setContentAvailable(array(0, 1));
     $this->add($c, 'general');
     $c = new ConfigElement_select('admin_language', 'auto');
     $c->setContentAvailable(array('auto', 'ar_AE', 'ca_ES', 'de_DE', 'en_GB', 'es_ES', 'fr_FR', 'hu_HU', 'it_IT', 'ja_JP', 'nl_NL', 'pt_BR', 'sk_SK', 'ro_RO', 'ru_RU', 'zh_CN'));
     $this->add($c, 'general');
     $c = new ConfigElement_multiselect('log_flags', array('info', 'warning', 'error', 'critical'));
     $c->setContentAvailable(array('debug', 'info', 'warning', 'error', 'critical'));
     $this->add($c, 'general');
     $c = new ConfigElement_select('cache_update_interval', 30);
     $c->setContentAvailable(array(30, 60, 300, 900, 1800, 3600, 7200));
     $this->add($c, 'general');
     $c = new ConfigElement_select('cache_expire_time', 86400 * 366);
     $c->setContentAvailable(array(86400, 86400 * 7, 86400 * 31, 86400 * 366));
     $this->add($c, 'general');
     // 		$c = new ConfigElement_input('start_app','');
     // 		$this->add('general',$c);
     $c = new ConfigElement_text('user_default_group', '');
     $this->add($c, 'general');
     $c = new ConfigElement_select('domain_integration', 'internal');
     $c->setContentAvailable(array('internal', 'microsoft', 'ldap', 'novell'));
     $this->add($c, 'general');
     $c = new ConfigElement_input('max_items_per_page', 15);
     $this->add($c, 'general');
     $c = new ConfigElement_inputlist('default_browser', array('linux' => NULL, 'windows' => NULL));
     $this->add($c, 'general');
     $c = new ConfigElement_dictionary('liaison', array());
     $this->add($c, 'general');
     $c = new ConfigElement_multiselect('default_policy', array());
     $c->setContentAvailable(array('canUseAdminPanel', 'viewServers', 'manageServers', 'viewSharedFolders', 'manageSharedFolders', 'viewUsers', 'manageUsers', 'viewUsersGroups', 'manageUsersGroups', 'viewApplications', 'manageApplications', 'viewApplicationsGroups', 'manageApplicationsGroups', 'viewPublications', 'managePublications', 'viewConfiguration', 'manageConfiguration', 'viewStatus', 'manageSession', 'manageReporting', 'viewSummary', 'viewNews', 'manageNews', 'manageScripts', 'viewScripts', 'manageScriptsGroups', 'viewScriptsGroups'));
     $this->add($c, 'general', 'policy');
     $c = new ConfigElement_select('type', 'mysql');
     $c->setContentAvailable(array('mysql'));
     $this->add($c, 'general', 'sql');
     $c = new ConfigElement_input('host', 'localhost');
     $this->add($c, 'general', 'sql');
     $c = new ConfigElement_input('user', '');
     $this->add($c, 'general', 'sql');
     $c = new ConfigElement_password('password', '');
     $this->add($c, 'general', 'sql');
     $c = new ConfigElement_input('database', 'ovd');
     $this->add($c, 'general', 'sql');
     $c = new ConfigElement_input('prefix', 'ulteo_');
     $this->add($c, 'general', 'sql');
     $c_mail_type = new ConfigElement_select('send_type', 'mail');
     $c_mail_type->setContentAvailable(array('mail', 'smtp'));
     $this->add($c_mail_type, 'general', 'mails_settings');
     $c = new ConfigElement_input('send_from', 'no-reply@' . @$_SERVER['SERVER_NAME']);
     $this->add($c, 'general', 'mails_settings');
     // SMTP conf
     $c = new ConfigElement_input('send_host', '');
     $this->add($c, 'general', 'mails_settings');
     $c_mail_type->addReference('smtp', $c);
     $c = new ConfigElement_input('send_port', 25);
     $this->add($c, 'general', 'mails_settings');
     $c_mail_type->addReference('smtp', $c);
     $c = new ConfigElement_select('send_ssl', 0);
     $c->setContentAvailable(array(0, 1));
     $this->add($c, 'general', 'mails_settings');
     $c_mail_type->addReference('smtp', $c);
     $c = new ConfigElement_select('send_auth', 0);
     $c->setContentAvailable(array(0, 1));
     $this->add($c, 'general', 'mails_settings');
     $c_mail_type->addReference('smtp', $c);
     $c = new ConfigElement_input('send_username', '');
     $this->add($c, 'general', 'mails_settings');
     $c_mail_type->addReference('smtp', $c);
     $c = new ConfigElement_password('send_password', '');
     $this->add($c, 'general', 'mails_settings');
     $c_mail_type->addReference('smtp', $c);
     $c = new ConfigElement_list('authorized_fqdn', array('*'));
     $this->add($c, 'general', 'slave_server_settings');
     $c = new ConfigElement_select('disable_fqdn_check', 0);
     $c->setContentAvailable(array(0, 1));
     $this->add($c, 'general', 'slave_server_settings');
     $c = new ConfigElement_select('use_reverse_dns', true);
     $c->setContentAvailable(array(false, true));
     $this->add($c, 'general', 'slave_server_settings');
     $c = new ConfigElement_select('action_when_as_not_ready', 0);
     $c->setContentAvailable(array(0, 1));
     $this->add($c, 'general', 'slave_server_settings');
     $c = new ConfigElement_select('auto_recover', 1);
     $c->setContentAvailable(array(0, 1));
     $this->add($c, 'general', 'slave_server_settings');
     $c = new ConfigElement_select('remove_orphan', 0);
     $c->setContentAvailable(array(0, 1));
     $this->add($c, 'general', 'slave_server_settings');
     $c = new ConfigElement_select('auto_register_new_servers', 0);
     $c->setContentAvailable(array(0, 1));
     $this->add($c, 'general', 'slave_server_settings');
     $c = new ConfigElement_select('auto_switch_new_servers_to_production', 0);
     $c->setContentAvailable(array(0, 1));
     $this->add($c, 'general', 'slave_server_settings');
     $c = new ConfigElement_select('use_max_sessions_limit', 1);
     $c->setContentAvailable(array(0, 1));
     $this->add($c, 'general', 'slave_server_settings');
     $roles = array(Server::SERVER_ROLE_APS, Server::SERVER_ROLE_FS);
     foreach ($roles as $role) {
         $decisionCriterion = get_classes_startwith('DecisionCriterion_');
         $content_load_balancing = array();
         foreach ($decisionCriterion as $criterion_class_name) {
             $c = new $criterion_class_name(NULL);
             // ugly
             if ($c->applyOnRole($role)) {
                 $content_load_balancing[substr($criterion_class_name, strlen('DecisionCriterion_'))] = $c->default_value();
             }
         }
         $c = new ConfigElement_sliders_loadbalancing('load_balancing_' . $role, $content_load_balancing);
         $this->add($c, 'general', 'slave_server_settings');
     }
     $c_desktop_mode = new ConfigElement_select('enabled', 1);
     $c_desktop_mode->setContentAvailable(array(0, 1));
     $this->add($c_desktop_mode, 'general', 'remote_desktop_settings');
     $c = new ConfigElement_select('desktop_icons', 1);
     $c->setContentAvailable(array(0, 1));
     $c_desktop_mode->addReference('1', $c);
     $this->add($c, 'general', 'remote_desktop_settings');
     $c = new ConfigElement_select('allow_external_applications', 1);
     $c->setContentAvailable(array(0, 1));
     $c_desktop_mode->addReference('1', $c);
     $this->add($c, 'general', 'remote_desktop_settings');
     $c = new ConfigElement_select('desktop_type', 'any');
     $c->setContentAvailable(array('any', 'linux', 'windows'));
     $c_desktop_mode->addReference('1', $c);
     $this->add($c, 'general', 'remote_desktop_settings');
     $c = new ConfigElement_list('allowed_desktop_servers', array());
     $c_desktop_mode->addReference('1', $c);
     $this->add($c, 'general', 'remote_desktop_settings');
     $c = new ConfigElement_select('authorize_no_desktop', 1);
     $c->setContentAvailable(array(0, 1));
     $this->add($c, 'general', 'remote_desktop_settings');
     $c = new ConfigElement_select('enabled', 1);
     $c->setContentAvailable(array(0, 1));
     $this->add($c, 'general', 'remote_applications_settings');
     $c = new ConfigElement_select('session_mode', Session::MODE_APPLICATIONS);
     $c->setContentAvailable(array(Session::MODE_DESKTOP, Session::MODE_APPLICATIONS));
     $this->add($c, 'general', 'session_settings_defaults');
     $c = new ConfigElement_select('language', 'en_GB');
     $c->setContentAvailable(array('ar_AE', 'bg_BG', 'ca_ES', 'da-dk', 'de_DE', 'en_GB', 'el_GR', 'es_ES', 'eu_ES', 'fa_IR', 'fi_FI', 'fr_FR', 'he_IL', 'hu_HU', 'id_ID', 'is_IS', 'it_IT', 'ja_JP', 'nb_NO', 'nl_NL', 'pl_PL', 'pt_BR', 'ro_RO', 'ru_RU', 'sk_SK', 'sl', 'sv_SE', 'zh_CN'));
     $this->add($c, 'general', 'session_settings_defaults');
     $c = new ConfigElement_select('timeout', -1);
     $c->setContentAvailable(array(60, 120, 300, 600, 900, 1800, 3600, 7200, 18000, 43200, 86400, 172800, 604800, 2764800, -1));
     $this->add($c, 'general', 'session_settings_defaults');
     $c = new ConfigElement_week_time_select('time_restriction', str_repeat("FF", 3 * 7));
     $this->add($c, 'general', 'session_settings_defaults');
     $c = new ConfigElement_input('max_sessions_number', 0);
     $this->add($c, 'general');
     $c = new ConfigElement_select('launch_without_apps', 0);
     $c->setContentAvailable(array(0, 1));
     $this->add($c, 'general', 'session_settings_defaults');
     $c = new ConfigElement_select('allow_shell', 0);
     $c->setContentAvailable(array(0, 1));
     $this->add($c, 'general', 'session_settings_defaults');
     $c = new ConfigElement_select('use_known_drives', 0);
     $c->setContentAvailable(array(0, 1));
     $this->add($c, 'general', 'session_settings_defaults');
     $c = new ConfigElement_select('bypass_servers_restrictions', 1);
     $c->setContentAvailable(array(0, 1));
     $this->add($c, 'general', 'session_settings_defaults');
     $c = new ConfigElement_select('multimedia', 1);
     $c->setContentAvailable(array(0, 1));
     $this->add($c, 'general', 'session_settings_defaults');
     $c = new ConfigElement_select('redirect_client_drives', 'full');
     $c->setContentAvailable(array('no', 'partial', 'full'));
     $this->add($c, 'general', 'session_settings_defaults');
     $c = new ConfigElement_select('redirect_client_printers', 1);
     $c->setContentAvailable(array(0, 1));
     $this->add($c, 'general', 'session_settings_defaults');
     if (class_exists("PremiumManager") && PremiumManager::is_premium()) {
         $c = new ConfigElement_select('redirect_smartcards_readers', 0);
         $c->setContentAvailable(array(0, 1));
         $this->add($c, 'general', 'session_settings_defaults');
     }
     $c = new ConfigElement_select('rdp_bpp', 16);
     $c->setContentAvailable(array(16, 24, 32));
     $this->add($c, 'general', 'session_settings_defaults');
     $c = new ConfigElement_select('enhance_user_experience', 1);
     $c->setContentAvailable(array(0, 1));
     $this->add($c, 'general', 'session_settings_defaults');
     $c = new ConfigElement_select('use_local_ime', 0);
     $c->setContentAvailable(array(0, 1));
     $this->add($c, 'general', 'session_settings_defaults');
     $c = new ConfigElement_select('persistent', 1);
     $c->setContentAvailable(array(0, 1));
     $this->add($c, 'general', 'session_settings_defaults');
     $c = new ConfigElement_select('followme', 1);
     $c->setContentAvailable(array(0, 1));
     $this->add($c, 'general', 'session_settings_defaults');
     $c_user_profile = new ConfigElement_select('enable_profiles', 1);
     $c_user_profile->setContentAvailable(array(0, 1));
     $this->add($c_user_profile, 'general', 'session_settings_defaults');
     $c = new ConfigElement_input('quota', 0);
     $c_user_profile->addReference('1', $c);
     $this->add($c, 'general', 'session_settings_defaults');
     $c = new ConfigElement_select('profile_mode', 'advanced');
     $c->setContentAvailable(array('standard', 'advanced'));
     $this->add($c, 'general', 'session_settings_defaults');
     $c = new ConfigElement_select('auto_create_profile', 1);
     $c->setContentAvailable(array(0, 1));
     $c_user_profile->addReference('1', $c);
     $this->add($c, 'general', 'session_settings_defaults');
     $c = new ConfigElement_select('start_without_profile', 1);
     $c->setContentAvailable(array(0, 1));
     $c_user_profile->addReference('1', $c);
     $this->add($c, 'general', 'session_settings_defaults');
     $c_shared_folder = new ConfigElement_select('enable_sharedfolders', 1);
     $c_shared_folder->setContentAvailable(array(0, 1));
     $this->add($c_shared_folder, 'general', 'session_settings_defaults');
     $c = new ConfigElement_select('start_without_all_sharedfolders', 1);
     $c->setContentAvailable(array(0, 1));
     $c_shared_folder->addReference('1', $c);
     $this->add($c, 'general', 'session_settings_defaults');
     $c = new ConfigElement_select('can_force_sharedfolders', 1);
     $c->setContentAvailable(array(0, 1));
     $this->add($c, 'general', 'session_settings_defaults');
     $c = new ConfigElement_multiselect('advanced_settings_startsession', array('session_mode', 'language'));
     $c->setContentAvailable(array('session_mode', 'language', 'server', 'timeout', 'persistent'));
     $this->add($c, 'general', 'session_settings_defaults');
     $c = new ConfigElement_select('show_list_users', 0);
     $c->setContentAvailable(array(0, 1));
     $this->add($c, 'general', 'web_interface_settings');
     $c = new ConfigElement_select('public_webservices_access', 0);
     $c->setContentAvailable(array(0, 1));
     $this->add($c, 'general', 'web_interface_settings');
     $this->getPrefsModules();
     $this->getPrefsEvents();
 }
Example #3
0
             popup_error(_('The file was corrupted while upload'));
             redirect();
             break;
         case 4:
             // UPLOAD_ERR_NO_FILE
             $have_file = false;
             break;
     }
 }
 if ($have_file) {
     $source_file = $upload['tmp_name'];
     if (!is_readable($source_file)) {
         popup_error(_('The file is not readable'));
         redirect();
     }
     if (get_classes_startwith('Imagick') != array()) {
         $path_rw = $app->getIconPathRW();
         if (is_writable2($path_rw)) {
             try {
                 $mypicture = new Imagick();
                 $mypicture->readImage($source_file);
                 $mypicture->scaleImage(32, 0);
                 $mypicture->writeImage($app->getIconPathRW());
             } catch (Exception $e) {
                 popup_error(_('The icon is not an image'));
                 redirect();
             }
         } else {
             Logger::error('main', 'getIconPathRW (' . $path_rw . ') is not writeable');
             redirect();
         }
Example #4
0
function show_manage($id, $applicationDB)
{
    global $types;
    $applicationsGroupDB = ApplicationsGroupDB::getInstance();
    $app = $applicationDB->import($id);
    if (!is_object($app)) {
        return false;
    }
    $is_rw = $applicationDB->isWriteable();
    $can_manage_applications = isAuthorized('manageApplications');
    // App groups
    $appgroups = $applicationsGroupDB->getList();
    $groups_id = array();
    $liaisons = Abstract_Liaison::load('AppsGroup', $app->getAttribute('id'), NULL);
    foreach ($liaisons as $liaison) {
        $groups_id[] = $liaison->group;
    }
    $groups = array();
    $groups_available = array();
    foreach ($appgroups as $group) {
        if (in_array($group->id, $groups_id)) {
            $groups[] = $group;
        } else {
            $groups_available[] = $group;
        }
    }
    $servers_all = Abstract_Server::load_available_by_role(Server::SERVER_ROLE_APS, true);
    $liaisons = Abstract_Liaison::load('ApplicationServer', $app->getAttribute('id'), NULL);
    $servers_id = array();
    foreach ($liaisons as $liaison) {
        $servers_id[] = $liaison->group;
    }
    $servers = array();
    $servers_available = array();
    foreach ($servers_all as $server) {
        if (in_array($server->fqdn, $servers_id)) {
            $servers[] = $server;
        } elseif (!$server->isOnline()) {
            continue;
        } elseif ($server->type != $app->getAttribute('type')) {
            continue;
        } else {
            $servers_available[] = $server;
        }
    }
    $mimes = $applicationDB->getAllMimeTypes();
    $mimeliste1 = $app->getMimeTypes();
    $mimeliste2 = array();
    foreach ($mimes as $mime) {
        if (!in_array($mime, $mimeliste1)) {
            $mimeliste2[] = $mime;
        }
    }
    $can_manage_server = isAuthorized('manageServers');
    page_header();
    echo '<div>';
    echo '<h1><img src="media/image/cache.php?id=' . $app->getAttribute('id') . '" alt="" title="" /> ' . $app->getAttribute('name') . '</h1>';
    echo '<table class="main_sub" border="0" cellspacing="1" cellpadding="3">';
    echo '<tr class="title">';
    // 	echo '<th>'._('Package').'</th>';
    echo '<th>' . _('Type') . '</th>';
    echo '<th>' . _('Description') . '</th>';
    echo '<th>' . _('Command') . '</th>';
    if ($is_rw and $can_manage_applications) {
        echo '<th></th>';
    }
    echo '</tr>';
    echo '<tr class="content1">';
    // 		echo '<td>'.$app->getAttribute('package').'</td>';
    echo '<td style="text-align: center;"><img src="media/image/server-' . $app->getAttribute('type') . '.png" alt="' . $app->getAttribute('type') . '" title="' . $app->getAttribute('type') . '" /><br />' . $app->getAttribute('type') . '</td>';
    echo '<td>' . $app->getAttribute('description') . '</td>';
    echo '<td>';
    echo $app->getAttribute('executable_path');
    echo '</td>';
    if ($is_rw and $can_manage_applications) {
        echo '<td>';
        echo '<form action="actions.php" method="post" onsubmit="return confirm(\'' . _('Are you sure you want to delete this application?') . '\');">';
        echo '<input type="hidden" name="name" value="Application_static" />';
        echo '<input type="hidden" name="action" value="del" />';
        echo '<input type="hidden" name="checked_applications[]" value="' . $app->getAttribute('id') . '" />';
        echo '<input type="submit"  value="' . _('Delete') . '" />';
        echo '</form>';
        echo '</td>';
    }
    echo '</tr>';
    echo '</table>';
    if ($is_rw and $can_manage_applications) {
        echo '<br />';
        echo '<form action="actions.php" method="post"">';
        echo '<input type="hidden" name="name" value="Application" />';
        echo '<input type="hidden" name="action" value="clone" />';
        echo '<input type="hidden" name="id" value="' . $app->getAttribute('id') . '" />';
        echo '<input type="submit" value="' . _('Clone to new application') . '"/>';
        echo '</form>';
        echo '<br />';
        echo '<h2>' . _('Modify') . '</h2>';
        echo '<div id="application_modify">';
        echo '<form id="delete_icon" action="actions.php" method="post" style="display: none;">';
        echo '<input type="hidden" name="name" value="Application_static" />';
        echo '<input type="hidden" name="action" value="del_icon" />';
        echo '<input type="hidden" name="checked_applications[]" value="' . $app->getAttribute('id') . '" />';
        echo '</form>';
        echo '<form action="actions.php" method="post" enctype="multipart/form-data" >';
        // form A
        echo '<input type="hidden" name="name" value="Application_static" />';
        echo '<input type="hidden" name="action" value="modify" />';
        echo '<input type="hidden" name="published" value="1" />';
        echo '<input type="hidden" name="static" value="1" />';
        echo '<input type="hidden" name="id" value="' . $app->getAttribute('id') . '" />';
        echo '<table class="main_sub" border="0" cellspacing="1" cellpadding="5">';
        $count = 1;
        $app->setAttribute('application_name', $app->getAttribute('name'));
        // ugly hack
        $app->unsetAttribute('name');
        $attr_list = $app->getAttributesList();
        foreach ($attr_list as $k => $v) {
            if (in_array($v, array('id', 'type', 'static', 'published', 'desktopfile', 'package', 'revision'))) {
                unset($attr_list[$k]);
            }
        }
        asort($attr_list);
        foreach ($attr_list as $attr_name) {
            $content = 'content' . ($count++ % 2 == 0 ? 1 : 2);
            echo '<tr class="' . $content . '">';
            echo '<td style="text-transform: capitalize;">';
            if ($attr_name == 'executable_path') {
                echo _('Command');
            } else {
                if ($attr_name == 'application_name') {
                    echo _('Name');
                } else {
                    echo _($attr_name);
                }
            }
            echo '</td>';
            echo '<td>';
            echo '<input type="text" name="' . $attr_name . '" value="' . htmlspecialchars($app->getAttribute($attr_name)) . '" style="with:100%;"/>';
            echo '<input type="hidden" name="attributes_send[]" value="' . $attr_name . '" />';
            echo '</td>';
            echo '</tr>';
        }
        if (get_classes_startwith('Imagick') != array()) {
            $content = 'content' . ($count++ % 2 == 0 ? 1 : 2);
            echo '<tr class="' . $content . '">';
            echo '<td>' . _('Icon') . '</td>';
            echo '<td>';
            if ($app->getIconPath() != $app->getDefaultIconPath() && file_exists($app->getIconPath())) {
                echo '<img src="media/image/cache.php?id=' . $app->getAttribute('id') . '" alt="" title="" /> ';
                echo '<input type="button" value="' . _('Delete this icon') . '" onclick="return confirm(\'' . _('Are you sure you want to delete this icon?') . '\') && $(\'delete_icon\').submit();"/>';
                echo '<br />';
            }
            echo '<input type="file"  name="file_icon" /> ';
            echo '</td>';
            echo '</tr>';
        } else {
            Logger::info('main', 'No Imagick support found');
        }
        $content = 'content' . ($count++ % 2 == 0 ? 1 : 2);
        echo '<tr class="' . $content . '">';
        echo '<td colspan="2">';
        echo '<input type="submit" value="' . _('Modify') . '" />';
        echo '</td>';
        echo '</tr>';
        echo '</table>';
        echo '</form>';
        // form A
        echo '</div>';
        // application_modify
    }
    if (count($servers) + count($servers_available) > 0) {
        echo '<div>';
        echo '<h2>' . _('Servers with this application') . '</h2>';
        echo '<table border="0" cellspacing="1" cellpadding="3">';
        foreach ($servers as $server) {
            echo '<tr><td>';
            echo '<a href="servers.php?action=manage&fqdn=' . $server->fqdn . '">' . $server->fqdn . '</a>';
            echo '</td>';
            echo '<td>';
            if ($server->isOnline() and $can_manage_server) {
                echo '<form action="actions.php" method="post" onsubmit="return confirm(\'' . _('Are you sure you want to remove this application from this server?') . '\');">';
                echo '<input type="hidden" name="action" value="del" />';
                echo '<input type="hidden" name="name" value="Application_Server" />';
                echo '<input type="hidden" name="application" value="' . $id . '" />';
                echo '<input type="hidden" name="server" value="' . $server->fqdn . '" />';
                echo '<input type="submit" value="' . _('Remove from this server') . '"/>';
                echo '</form>';
            }
            echo '</td>';
            echo '</tr>';
        }
        if (count($servers_available) > 0 and $can_manage_server) {
            echo '<tr>';
            echo '<form action="actions.php" method="post"><td>';
            echo '<input type="hidden" name="name" value="Application_Server" />';
            echo '<input type="hidden" name="action" value="add" />';
            echo '<input type="hidden" name="application" value="' . $id . '" />';
            echo '<select name="server">';
            foreach ($servers_available as $server) {
                echo '<option value="' . $server->fqdn . '">' . $server->fqdn . '</option>';
            }
            echo '</select>';
            echo '</td><td><input type="submit" value="' . _('Add to this server') . '" /></td>';
            echo '</form>';
            echo '</tr>';
        }
        echo '</table>';
        echo "<div>\n";
    }
    if (count($appgroups) > 0) {
        echo '<div>';
        echo '<h2>' . _('Groups with this application') . '</h2>';
        echo '<table border="0" cellspacing="1" cellpadding="3">';
        foreach ($groups as $group) {
            echo '<tr>';
            echo '<td>';
            echo '<a href="appsgroup.php?action=manage&id=' . $group->id . '">' . $group->name . '</a>';
            echo '</td>';
            echo '<td><form action="actions.php" method="post" onsubmit="return confirm(\'' . _('Are you sure you want to delete this application from this group?') . '\');">';
            echo '<input type="hidden" name="name" value="Application_ApplicationGroup" />';
            echo '<input type="hidden" name="action" value="del" />';
            echo '<input type="hidden" name="element" value="' . $id . '" />';
            echo '<input type="hidden" name="group" value="' . $group->id . '" />';
            echo '<input type="submit" value="' . _('Delete from this group') . '" />';
            echo '</form></td>';
            echo '</tr>';
        }
        if (count($groups_available) > 0) {
            echo '<tr>';
            echo '<form action="actions.php" method="post"><td>';
            echo '<input type="hidden" name="name" value="Application_ApplicationGroup" />';
            echo '<input type="hidden" name="action" value="add" />';
            echo '<input type="hidden" name="element" value="' . $id . '" />';
            echo '<select name="group">';
            foreach ($groups_available as $group) {
                echo '<option value="' . $group->id . '">' . $group->name . '</option>';
            }
            echo '</select>';
            echo '</td><td><input type="submit" value="' . _('Add to this group') . '" /></td>';
            echo '</form>';
            echo '</tr>';
        }
        echo '</table>';
        echo "<div>\n";
    }
    // Mime-Type part
    echo '<div>';
    echo '<h2>' . _('Mime-Types') . '</h2>';
    echo '<div>';
    echo '<table border="0" cellspacing="1" cellpadding="3">';
    foreach ($mimeliste1 as $mime) {
        echo '<tr><td>';
        echo '<a href="mimetypes.php?action=manage&id=' . urlencode($mime) . '">' . $mime . '</a>';
        echo '</td>';
        echo '<td>';
        echo '<form action="actions.php" method="post">';
        echo '<input type="hidden" name="name" value="Application_MimeType" />';
        echo '<input type="hidden" name="action" value="del" />';
        echo '<input type="hidden" name="id" value="' . $app->getAttribute('id') . '" />';
        echo '<input type="hidden" name="mime" value="' . $mime . '" />';
        echo '<input type="submit" value="' . _('Del') . '"/>';
        echo '</form>';
        echo '</td>';
        echo '</tr>';
    }
    if (is_array($mimeliste2) && count($mimeliste2) > 0) {
        echo '<tr>';
        echo '<form action="actions.php" method="post">';
        echo '<input type="hidden" name="name" value="Application_MimeType" />';
        echo '<input type="hidden" name="action" value="add" />';
        echo '<input type="hidden" name="id" value="' . $app->getAttribute('id') . '" />';
        echo '<td>';
        echo '<select name="mime">';
        foreach ($mimeliste2 as $mime) {
            echo '<option>' . $mime . '</option>';
        }
        echo '</select>';
        echo '</td>';
        echo '<td>';
        echo '<input type="submit" value="' . _('Add') . '"/>';
        echo '</td>';
        echo '</form>';
        echo '</tr>';
    }
    echo '<tr>';
    echo '<form action="actions.php" method="post">';
    echo '<input type="hidden" name="name" value="Application_MimeType" />';
    echo '<input type="hidden" name="action" value="add" />';
    echo '<input type="hidden" name="id" value="' . $app->getAttribute('id') . '" />';
    echo '<td>' . _('Custom Mime-Type: ') . '<input type="text" name="mime" /></td>';
    echo '<td>';
    echo '<input type="submit" value="' . _('Add') . '"/>';
    echo '</td>';
    echo '</form>';
    echo '</tr>';
    echo '</table>';
    echo '</div>';
    echo '</div>';
    // mime div
    echo '</div>';
    echo '</div>';
    echo '</div>';
    echo '</div>';
    echo '</div>';
    echo '</div>';
    page_footer();
    die;
}
Example #5
0
 public function application_icon_set($id_, $icon_)
 {
     $this->check_authorized('manageApplications');
     $applicationDB = ApplicationDB::getInstance();
     if (!$applicationDB->isWriteable()) {
         Logger::error('api', 'ApplicationDB is not writable');
         return false;
     }
     $app = $applicationDB->import($id_);
     if (!is_object($app)) {
         Logger::error('api', 'Unknown application "' . $id_ . '"');
         return false;
     }
     if (get_classes_startwith('Imagick') == array()) {
         Logger::error('api', 'Unable to setApplicationIcon: Imagick is not available');
         return false;
     }
     $path_rw = $app->getIconPathRW();
     if (!is_writable2($path_rw)) {
         Logger::error('api', 'Unable to write icon file for application ' . $app->getAttribute('id') . ': ' . $path_rw . ' is not writable');
         return false;
     }
     try {
         $mypicture = new Imagick();
         $mypicture->readImageBlob(base64_decode($icon_));
         $mypicture->scaleImage(32, 0);
         $mypicture->writeImage($app->getIconPathRW());
     } catch (Exception $e) {
         Logger::error('api', 'Given icon for application ' . $app->getAttribute('id') . ': ' . $path_rw . ' is not a valid image');
     }
     if ($app->getAttribute('static')) {
         $app->setAttribute('revision', $app->getAttribute('revision') + 1);
         $applicationDB->update($app);
     }
     $this->log_action('application_icon_set', array('application_id' => $app->getAttribute('id'), 'application_name' => $app->getAttribute('name')));
     return true;
 }