0 ) { $newZone = dbFetchOne('SELECT * FROM Zones WHERE MonitorId = ? AND Id = ?', NULL, array($mid, $zid)); } else { $view = 'error'; return; } $monitor = ZM\Monitor::find_one($mid); // Only allow certain filename characters (not including a period) to prevent directory traversal. $plugin = preg_replace('/[^-a-zA-Z0-9]/', '', $_REQUEST['pl']); $plugin_path = dirname(ZM_PLUGINS_CONFIG_PATH)."/".$plugin; $focusWindow = true; xhtmlHeaders(__FILE__, translate('Plugin') ); $pluginOptions=array( 'Enabled'=>array( 'Type'=>'select', 'Name'=>'Enabled', 'Choices'=>'yes,no', 'Value'=>'no' ) ); $optionNames=array(); if(file_exists($plugin_path."/config.php")) { include_once($plugin_path."/config.php"); } $sql='SELECT * FROM PluginsConfig WHERE MonitorId=? AND ZoneId=? AND pluginName=?'; foreach( dbFetchAll( $sql, NULL, array( $mid, $zid, $plugin ) ) as $popt ) { if(array_key_exists($popt['Name'], $pluginOptions) && $popt['Type']==$pluginOptions[$popt['Name']]['Type'] && $popt['Choices']==$pluginOptions[$popt['Name']]['Choices'] ) { $pluginOptions[$popt['Name']]=$popt; array_push($optionNames, $popt['Name']); } else { dbQuery('DELETE FROM PluginsConfig WHERE Id=?', array( $popt['Id'] ) ); } } foreach($pluginOptions as $name => $values) { if(!in_array($name, $optionNames)) { $popt=$pluginOptions[$name]; $sql="INSERT INTO PluginsConfig VALUES ('',?,?,?,?,?,?,?)"; dbQuery($sql, array( $popt['Name'], $popt['Value'], $popt['Type'], $popt['Choices'], $mid, $zid, $plugin ) ); } } $PLANG=array(); if(file_exists($plugin_path."/lang/".$user['Language'].".php")) { include_once($plugin_path."/lang/".$user['Language'].".php"); } function pLang($name) { global $PLANG; if(array_key_exists($name, $PLANG)) return $PLANG[$name]; else return $name; } ?>