@@ -103,6 +103,34 @@ public function update_record_permissions($tablename, $index_field, $index_value
103103 return $ app ->db ->datalogUpdate ( $ tablename , $ permissions , $ index_field , $ index_value ) ;
104104 }
105105
106+ /**
107+ Set a value in the system configuration
108+ @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
111+ @param string key of the option that you want to set
112+ @param string option value that you want to set
113+ */
114+
115+
116+ 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+ }
132+ }
133+
106134
107135}
108136
0 commit comments