plugins->registerEvent('ftp_user_insert',$this->plugin_name,'insert'); $app->plugins->registerEvent('ftp_user_update',$this->plugin_name,'update'); $app->plugins->registerEvent('ftp_user_delete',$this->plugin_name,'delete'); } function insert($event_name,$data) { global $app, $conf; if(!is_dir($data['new']['dir'])) { $app->log("FTP User directory '".$data['new']['dir']."' does not exist. Creating it now.",LOGLEVEL_DEBUG); $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".intval($data['new']['parent_domain_id'])); exec('mkdir -p '.escapeshellcmd($data['new']['dir'])); exec('chown '.escapeshellcmd($web["system_user"]).':'.escapeshellcmd($web['system_group']).' '.$data['new']['dir']); $app->log("Added ftpuser_dir: ".$data['new']['dir'],LOGLEVEL_DEBUG); } } function update($event_name,$data) { global $app, $conf; if(!is_dir($data['new']['dir'])) { $app->log("FTP User directory '".$data['new']['dir']."' does not exist. Creating it now.",LOGLEVEL_DEBUG); $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".intval($data['new']['parent_domain_id'])); exec('mkdir -p '.escapeshellcmd($data['new']['dir'])); exec('chown '.escapeshellcmd($web["system_user"]).':'.escapeshellcmd($web['system_group']).' '.$data['new']['dir']); $app->log("Added ftpuser_dir: ".$data['new']['dir'],LOGLEVEL_DEBUG); } } function delete($event_name,$data) { global $app, $conf; $app->log("Ftpuser:".$data['new']['username']." deleted.",LOGLEVEL_DEBUG); } } // end class ?>