function user_delete($userid) { user_delete_ext($userid, 2); }
function userDeleted($user, $success) { global $_CB_database,$_CB_framework; $params = $this->params; $pmsType = $params->get('pmsType', '1'); if (!$this->_checkPMSinstalled($pmsType)) { return false; } $pmsUserDeleteOption = $params->get('pmsUserDeleteOption', '3'); $pmsUserFunction = $params->get('pmsUserFunction','1'); $cb_extra_rules = 0; SWITCH($pmsType) { case 1: //MyPMS OS switch ($pmsUserDeleteOption) { case '1': // Keep all messages $query_pms_delete = ""; break; case '2': // Remove all messages (received and sent) case '3': // Remove received messages only case '4': // Remove sent message only $query_pms_delete = "DELETE FROM #__pms WHERE username='******'"; break; default: $query_pms_delete = "DELETE FROM #__pms WHERE username='******'"; break; } if(file_exists( $_CB_framework->getCfg('absolute_path') . "/components/com_pms/cb_extra.php")) { include_once( $_CB_framework->getCfg('absolute_path') . "/components/com_pms/cb_extra.php"); if (function_exists('user_delete')) { $cb_extra_rules = 1; } if (function_exists('user_delete_ext')) { $cb_extra_rules = 2; } } break; case 2: //PMS Pro switch ($pmsUserDeleteOption) { case '1': // Keep all messages $query_pms_delete = ""; break; case '2': // Remove all messages (received and sent) case '3': // Remove received messages only case '4': // Remove sent message only $query_pms_delete = "DELETE FROM #__mypms WHERE username='******'"; break; default: $query_pms_delete = "DELETE FROM #__mypms WHERE username='******'"; break; } if(file_exists( $_CB_framework->getCfg('absolute_path') . "/components/com_mypms/cb_extra.php")) { include_once( $_CB_framework->getCfg('absolute_path') . "/components/com_mypms/cb_extra.php"); if (function_exists('user_delete')) { $cb_extra_rules = 1; } if (function_exists('user_delete_ext')) { $cb_extra_rules = 2; } } break; case 3: //UddeIM 0.4 case 4: //UddeIM 1.0 switch ($pmsUserDeleteOption) { case '1': // Keep all messages $query_pms_delete = ""; break; case '2': // Remove all messages (received and sent) $query_pms_delete = "DELETE FROM #__uddeim WHERE fromid='" . (int) $user->id ."' OR toid='" . (int) $user->id . "'"; break; case '3': // Remove received messages only $query_pms_delete = "DELETE FROM #__uddeim WHERE toid='" . (int) $user->id . "'"; break; case '4': // Remove sent message only $query_pms_delete = "DELETE FROM #__uddeim WHERE fromid='" . (int) $user->id ."'"; break; default: $query_pms_delete = "DELETE FROM #__uddeim WHERE fromid='" . (int) $user->id ."' OR toid='" . (int) $user->id . "'"; break; } $query_pms_delete_extra1 = "DELETE FROM #__uddeim_emn WHERE userid='" . (int) $user->id . "'"; $query_pms_delete_extra2 = "DELETE FROM #__uddeim_blocks WHERE blocker='" . (int) $user->id . "' OR blocked='" . (int) $user->id . "'"; if(file_exists( $_CB_framework->getCfg('absolute_path') . "/components/com_uddeim/cb_extra.php")) { include_once( $_CB_framework->getCfg('absolute_path') . "/components/com_uddeim/cb_extra.php"); if (function_exists('user_delete')) { $cb_extra_rules = 1; } if (function_exists('user_delete_ext')) { $cb_extra_rules = 2; } } break; case 5: //PMS enhanced 2.x by Stefan Klingner switch ($pmsUserDeleteOption) { case '1': // Keep all messages $query_pms_delete = ""; break; case '2': // Remove all messages (received and sent) $query_pms_delete = "DELETE FROM #__pms WHERE recip_id='" . (int) $user->id . "' OR sender_id='" . (int) $user->id . "'"; break; case '3': // Remove received messages only $query_pms_delete = "DELETE FROM #__pms WHERE recip_id='" . (int) $user->id . "'"; break; case '4': // Remove sent message only $query_pms_delete = "DELETE FROM #__pms WHERE sender_id='" . (int) $user->id . "'"; break; default: $query_pms_delete = "DELETE FROM #__pms WHERE recip_id='" . (int) $user->id . "' OR sender_id='" . (int) $user->id . "'"; break; } if(file_exists( $_CB_framework->getCfg('absolute_path') . "/components/com_pms/cb_extra.php")) { include_once( $_CB_framework->getCfg('absolute_path') . "/components/com_pms/cb_extra.php"); if (function_exists('user_delete')) { $cb_extra_rules = 1; } if (function_exists('user_delete_ext')) { $cb_extra_rules = 2; } } break; case 6: //JIM 1.0.1 $query_pms_delete = "DELETE FROM #__jim WHERE username='******'"; if(file_exists( $_CB_framework->getCfg('absolute_path') . "/components/com_jim/cb_extra.php")) { include_once( $_CB_framework->getCfg('absolute_path') . "/components/com_jim/cb_extra.php"); if (function_exists('user_delete')) { $cb_extra_rules = 1; } if (function_exists('user_delete_ext')) { $cb_extra_rules = 2; } } break; default: $this->_setErrorMSG("Incorrect PMS type"); return false; break; } if (!$cb_extra_rules || $pmsUserFunction=='1') { // print "Deleting pms data for user ".$user->id; if ($pmsUserDeleteOption != 1) { $_CB_database->setQuery( $query_pms_delete ); if (!$_CB_database->query()) { $this->_setErrorMSG("SQL error " . $query_pms_delete . $_CB_database->stderr(true)); return false; } } if ($pmsType == 4 || $pmsType == 3) { $_CB_database->setQuery( $query_pms_delete_extra1 ); if (!$_CB_database->query()) { $this->_setErrorMSG("SQL error " . $query_pms_delete_extra1 . $_CB_database->stderr(true)); return false; } $_CB_database->setQuery( $query_pms_delete_extra2 ); if (!$_CB_database->query()) { $this->_setErrorMSG("SQL error " . $query_pms_delete_extra2 . $_CB_database->stderr(true)); return false; } } $cb_extra_return = true; } else { switch ($cb_extra_rules) { case 1: $cb_extra_return = user_delete($user->id); break; case 2: $cb_extra_return = user_delete_ext($user->id,$pmsUserDeleteOption); break; } } return $cb_extra_return; }