Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * @access Public
- * @method removeUserFromZnc
- * @return (bool) True if user was removed from ZNC successfully
- * Remove user from ZNC
- */
- public function removeUserFromZnc()
- {
- /*** Global Vars ***/
- global $bshell_cfg, $profile, $LightJet;
- $znc_file = '/home/znc/.znc/configs/znc.conf';
- $znc_config = $LightJet->openFile( $znc_file );
- /* Check for already configured ZNC user */
- $regex = "`^<User {$profile->currentProfile[ 'bs_userid' ]}>$`m";
- if ( !preg_match( $regex , $znc_config ) ) {
- return false;
- }
- $regex = "`^<User {$profile->currentProfile[ 'bs_userid' ]}>(.*)</User>`m";
- $znc_config = preg_replace( $regex , '' , $znc_config );
- $LightJet->writeFile( $znc_config, $znc_file , 'a' , null , $filename , true );
- /* rehash ZNC */
- /* Find ZNC PID */
- $procs = $this->getUserProcs( 'znc' );
- foreach( $procs as $proc ) {
- if ( $proc[ 'program' ] == 'znc' ) {
- exec( "kill -s 1 {$proc[ 'pid' ]}" );
- }
- }
- $this->printf( 'Removed user from ZNC' );
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement