Exemplo n.º 1
0
 public static function Delete($ID)
 {
     global $DB;
     $ID = intVal($ID);
     if ($ID <= 0) {
         return false;
     }
     /***************** Event onBeforeUserDelete ************************/
     foreach (GetModuleEvents("forum", "onBeforeUserDelete", true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array(&$ID));
     }
     /***************** /Event ******************************************/
     $strSql = "SELECT F.ID FROM b_forum_user FU, b_file F WHERE FU.ID = " . $ID . " AND FU.AVATAR = F.ID ";
     $z = $DB->Query($strSql, false, "FILE: " . __FILE__ . " LINE:" . __LINE__);
     while ($zr = $z->Fetch()) {
         CFile::Delete($zr["ID"]);
     }
     $arForumUser = CForumUser::GetByID($ID);
     $res = $DB->Query("DELETE FROM b_forum_user WHERE ID = " . $ID, True);
     /***************** Event onAfterUserDelete *************************/
     foreach (GetModuleEvents("forum", "onAfterUserDelete", true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array($ID));
     }
     /***************** /Event ******************************************/
     unset($GLOBALS["FORUM_CACHE"]["USER"][$ID]);
     unset($GLOBALS["FORUM_CACHE"]["USER_ID"][$arForumUser["USER_ID"]]);
     return $res;
 }
Exemplo n.º 2
0
							$arUserGroups[] = "administrators";
						elseif ($arG["GROUP_ID"] == 2)
							$arUserGroups[] = "everyone";
					}
					$arSaveUser["GROUP_ID"] = $arUserGroups;

					if (CModule::IncludeModule("blog"))
					{
						$arBlogUser = CBlogUser::GetByID($arUser['ID'], BLOG_BY_USER_ID);
						if (is_array($arBlogUser) && $arBlogUser["AVATAR"] > 0)
							$arSaveUser["BLOG_AVATAR"] = CFile::GetPath($arBlogUser["AVATAR"]);
					}

					if (CModule::IncludeModule("forum"))
					{
						$arForumUser = CForumUser::GetByID($arUser['ID'], BLOG_BY_USER_ID);
						if (is_array($arForumUser) && $arForumUser["AVATAR"] > 0)
							$arSaveUser["FORUM_AVATAR"] = CFile::GetPath($arForumUser["AVATAR"]);
					}

					$oResponse->status = "200 OK";
					$oResponse->arParameters['USER_INFO'] = $arSaveUser;
					if (defined("FORMAT_DATE"))
						$oResponse->arParameters['FORMAT_DATE'] = FORMAT_DATE;
					if (defined("FORMAT_DATETIME"))
						$oResponse->arParameters['FORMAT_DATETIME'] = FORMAT_DATETIME;
				}
				else
				{
					$oResponse->status = "443 Bad password.";
					$oResponse->text = GetMessage("CTRLR_WS_ERR_BAD_PASSW");