@@ -106,31 +106,55 @@ public function update_record_permissions($tablename, $index_field, $index_value
106106 /**
107107 Set a value in the system configuration
108108 @param int session id
109- @param int server id
110- @param string section of the config field in the server table. Could be 'web', 'dns', 'mail', 'dns', 'cron', etc
109+ @param string section of the config field in the table. Could be 'web', 'dns', 'mail', 'dns', 'cron', etc
111110 @param string key of the option that you want to set
112111 @param string option value that you want to set
113112 */
114-
115-
116113 public function system_config_set($session_id, $section, $key, $value) {
117- global $app;
118- if(!$this->checkPerm($session_id, 'system_config_set')) {
119- throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
120- return false;
121- }
122- if ($section != '' && $key != '') {
123- $app->uses('remoting_lib,getconf,ini_parser');
124- $system_config_array = $app->getconf->get_global_config();
125- $system_config_array[$section][$key] = $value;
126- $system_config_str = $app->ini_parser->get_ini_string($system_config_array);
127- $app->db->datalogUpdate('sys_ini', array("config" => $system_config_str), 'sysini_id', 1);
128- } else {
129- throw new SoapFault('invalid_function_parameter', 'Invalid function parameter.');
130- return false;
131- }
114+ global $app;
115+ if(!$this->checkPerm($session_id, 'system_config_set')) {
116+ throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
117+ return false;
118+ }
119+ if ($section != '' && $key != '') {
120+ $app->uses('remoting_lib,getconf,ini_parser');
121+ $system_config_array = $app->getconf->get_global_config();
122+ $system_config_array[$section][$key] = $value;
123+ $system_config_str = $app->ini_parser->get_ini_string($system_config_array);
124+ return $app->db->datalogUpdate('sys_ini', array("config" => $system_config_str), 'sysini_id', 1);
125+ } else {
126+ throw new SoapFault('invalid_function_parameter', 'Invalid function parameter.');
127+ return false;
128+ }
132129 }
133130
131+ /**
132+ Get the values of the system configuration
133+ @param int session id
134+ @param string section of the config field in the table. Could be 'web', 'dns', 'mail', 'dns', 'cron', etc
135+ @param string key of the option that you want to set
136+ @param string option value that you want to set
137+ */
138+ public function system_config_get($session_id, $section, $key) {
139+ global $app;
140+ if(!$this->checkPerm($session_id, 'system_config_get')) {
141+ throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
142+ return false;
143+ }
144+ if ($section != '') {
145+ $app->uses('remoting_lib,getconf,ini_parser');
146+ $system_config_array = $app->getconf->get_global_config();
147+ if($key != '') {
148+ if(isset($system_config_array[$section][$key])) return $system_config_array[$section][$key];
149+ else return false;
150+ } else {
151+ if(isset($system_config_array[$section])) return $system_config_array[$section];
152+ else return false;
153+ } else {
154+ throw new SoapFault('invalid_function_parameter', 'Invalid function parameter.');
155+ return false;
156+ }
157+ }
134158
135159}
136160
0 commit comments