root/modules/branches/2.10/dashboard/install.php

Revision 13091, 4.7 kB (checked in by p_lindheimer, 1 year ago)

adds FREEPBX_IS_AUTH checking to most module files re #5478

  • Property svn:mime-type set to text/html
  • Property svn:eol-style set to native
Line 
1 <?php
2 if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); }
3 //This file is part of FreePBX.
4 //
5 //    FreePBX is free software: you can redistribute it and/or modify
6 //    it under the terms of the GNU General Public License as published by
7 //    the Free Software Foundation, either version 2 of the License, or
8 //    (at your option) any later version.
9 //
10 //    FreePBX is distributed in the hope that it will be useful,
11 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
12 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 //    GNU General Public License for more details.
14 //
15 //    You should have received a copy of the GNU General Public License
16 //    along with FreePBX.  If not, see <http://www.gnu.org/licenses/>.
17 //
18 // Copyright (C) 2011 Philippe Lindheimer
19 //
20
21 $freepbx_conf =& freepbx_conf::create();
22
23 // DASHBOARD_STATS_UPDATE_TIME and DASHBOARD_INFO_UPDATE_TIME are initialized as CONF_TYPE_INT during migration. We need
24 // first time after upgrade we need to change to the proper type and set the value as close to what they had it before
25 // as we can come up with.
26 //
27 $stats_options = array(6,10,20,30,45,60,120,300,600);
28 $info_options = array(15,30,60,120,300,600);
29
30 $stats_value = 6;
31 $info_value = 30;
32
33 if ($freepbx_conf->conf_setting_exists('DASHBOARD_STATS_UPDATE_TIME') || $freepbx_conf->conf_setting_exists('DASHBOARD_INFO_UPDATE_TIME')) {
34   $full_settings =& $freepbx_conf->get_conf_settings();
35
36   if ($full_settings['DASHBOARD_STATS_UPDATE_TIME']['type'] != CONF_TYPE_SELECT) {
37     $old_val = $full_settings['DASHBOARD_STATS_UPDATE_TIME']['value'];
38     $freepbx_conf->remove_conf_setting('DASHBOARD_STATS_UPDATE_TIME');
39     $stats_value = $stats_options[0];
40     foreach ($stats_options as $val) {
41       if ($old_val < $val) {
42         break;
43       }
44       $stats_value = $val;
45     }
46     if ($stats_value != $old_val) {
47       out(sprintf(_("%s changed from %s to %s"),'DASHBOARD_STATS_UPDATE_TIME',$old_val,$stats_value));
48     }
49   }
50   if ($full_settings['DASHBOARD_INFO_UPDATE_TIME']['type'] != CONF_TYPE_SELECT) {
51     $old_val = $full_settings['DASHBOARD_INFO_UPDATE_TIME']['value'];
52     $freepbx_conf->remove_conf_setting('DASHBOARD_INFO_UPDATE_TIME');
53     $info_value = $info_options[0];
54     foreach ($info_options as $val) {
55       if ($old_val < $val) {
56         break;
57       }
58       $info_value = $val;
59     }
60     if ($info_value != $old_val) {
61       out(sprintf(_("%s changed from %s to %s"),'DASHBOARD_INFO_UPDATE_TIME',$old_val,$info_value));
62     }
63   }
64   unset($full_settings);
65 }
66
67 // DASHBOARD_STATS_UPDATE_TIME
68 //
69 $set['value'] = $stats_value;
70 $set['defaultval'] =& $set['value'];
71 $set['options'] = $stats_options;
72 $set['readonly'] = 0;
73 $set['hidden'] = 0;
74 $set['level'] = 0;
75 $set['module'] = 'dashboard';
76 $set['category'] = 'GUI Behavior';
77 $set['emptyok'] = 0;
78 $set['name'] = 'Dashboard Stats Update Frequency';
79 $set['description'] = 'Update rate in seconds of all sections of the System Status panel except the Info box.';
80 $set['type'] = CONF_TYPE_SELECT;
81 $freepbx_conf->define_conf_setting('DASHBOARD_STATS_UPDATE_TIME',$set);
82
83 // DASHBOARD_INFO_UPDATE_TIME
84 //
85 $set['value'] = $info_value;
86 $set['defaultval'] =& $set['value'];
87 $set['options'] = $info_options;
88 $set['readonly'] = 0;
89 $set['hidden'] = 0;
90 $set['level'] = 0;
91 $set['module'] = 'dashboard';
92 $set['category'] = 'GUI Behavior';
93 $set['emptyok'] = 0;
94 $set['name'] = 'Dashboard Info Update Frequency';
95 $set['description'] = 'Update rate in seconds of the Info section of the System Status panel.';
96 $set['type'] = CONF_TYPE_SELECT;
97 $freepbx_conf->define_conf_setting('DASHBOARD_INFO_UPDATE_TIME',$set);
98
99 // SSHPORT
100 //
101 $set['value'] = '';
102 $set['defaultval'] =& $set['value'];
103 $set['options'] = array(1,65535);
104 $set['readonly'] = 0;
105 $set['hidden'] = 0;
106 $set['level'] = 2;
107 $set['module'] = 'dashboard';
108 $set['category'] = 'System Setup';
109 $set['emptyok'] = 1;
110 $set['name'] = 'Dashboard Non-Std SSH Port';
111 $set['description'] = 'SSH port number configured on your system if not using the default port 22, this allows the dashboard monitoring to watch the poper port.';
112 $set['type'] = CONF_TYPE_INT;
113 $freepbx_conf->define_conf_setting('SSHPORT',$set);
114
115 // MAXCALLS
116 //
117 $set['value'] = '';
118 $set['defaultval'] =& $set['value'];
119 $set['options'] = array(0,3000);
120 $set['readonly'] = 0;
121 $set['hidden'] = 0;
122 $set['level'] = 2;
123 $set['module'] = 'dashboard';
124 $set['category'] = 'GUI Behavior';
125 $set['emptyok'] = 1;
126 $set['name'] = 'Dashboard Max Calls Initial Scale';
127 $set['description'] = 'Use this to pre-set the scale for maximum calls on the Dashboard display. If not set, the the scale is dynamically sized based on the active calls on the system.';
128 $set['type'] = CONF_TYPE_INT;
129 $freepbx_conf->define_conf_setting('MAXCALLS',$set);
130
131 $freepbx_conf->commit_conf_settings();
Note: See TracBrowser for help on using the browser.