示例#1
0
                                 break;
                         }
                     }
                 }
             }
             if (strlen($warningMessage) > 0 && !in_array("USERS", $arResult["ErrorFields"])) {
                 $errorMessage .= $warningMessage . (!$bInvited ? "<br>" . GetMessage("SONET_GCE_NO_USERS") : "") . ".";
                 $warningMessage = "";
             }
         }
     }
     //if some e-mails belong to internal users and can't be used for invitation
     if (count($arIntranetUsersEmails) == 1) {
         $warningMessage .= str_replace("#EMAIL#", HtmlSpecialCharsEx(implode("", $arIntranetUsersEmails)), GetMessage("SONET_GCE_CANNOT_EMAIL_ADD"));
     } elseif (count($arIntranetUsersEmails) > 1) {
         $warningMessage .= str_replace("#EMAIL#", HtmlSpecialCharsEx(implode(", ", $arIntranetUsersEmails)), GetMessage("SONET_GCE_CANNOT_EMAILS_ADD"));
     }
     //if no users were invited
     if ($arResult["TAB"] == "invite" && (!is_array($arUserIDs) || count($arUserIDs) <= 0)) {
         $errorMessage .= GetMessage("SONET_GCE_NO_USERS") . ". ";
         $arResult["ErrorFields"][] = "USERS";
     }
 }
 if (strlen($errorMessage) <= 0 && strlen($warningMessage) <= 0) {
     if ($arResult["IS_IFRAME"]) {
         if ($arResult["IS_POPUP"]) {
             if (!array_key_exists("TAB", $arResult)) {
                 $redirectPath = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP"], array("group_id" => $arResult["GROUP_ID"], "user_id" => $USER->GetID()));
             } else {
                 $redirectPath = "";
             }
示例#2
0
             $arFields["GROUP_ID"] = array(2, CExtranet::GetExtranetUserGroupID());
         }
         $NEW_USER_ID = $user->Add($arFields);
         if (intval($NEW_USER_ID) > 0) {
             $arUserToRequest[] = array("NAME" => (strlen($email["NAME"]) > 0 ? $email["NAME"] . " " : "") . "&lt;" . $email["EMAIL"] . "&gt;", "ID" => $NEW_USER_ID);
             $event = new CEvent();
             $arFields = array("USER_ID" => $NEW_USER_ID, "CHECKWORD" => $checkword, "EMAIL" => $email["EMAIL"]);
             $event->Send("EXTRANET_INVITATION", SITE_ID, $arFields);
         } else {
             $strError = $user->LAST_ERROR;
             if ($GLOBALS['APPLICATION']->GetException()) {
                 $err = $GLOBALS['APPLICATION']->GetException();
                 $strError .= $err->GetString();
                 $GLOBALS['APPLICATION']->ResetException();
             }
             $warningMessage .= Str_Replace("#EMAIL#", HtmlSpecialCharsEx($email["EMAIL"]), GetMessage("SONET_C33_CANNOT_USER_ADD") . $strError);
         }
     }
 }
 if ((!is_array($arUsersFull) || count($arUsersFull) <= 0) && (!is_array($arUserToRequest) || count($arUserToRequest) <= 0)) {
     $errorMessage .= GetMessage("SONET_C33_NO_USERS") . ". ";
 } else {
     foreach ($arUserToRequest as $arUser) {
         if (CSocNetUserToGroup::SendRequestToJoinGroup($GLOBALS["USER"]->GetID(), $arUser["ID"], $arResult["Group"]["ID"], $_POST["MESSAGE"])) {
             $arSuccessUsers[] = array($arUser["NAME"], CSocNetUserPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), $arUser["ID"], "viewprofile", CSocNetUser::IsCurrentUserModuleAdmin()) ? CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arUser["ID"])) : "");
         } else {
             $arErrorUsers[] = array($arUser["NAME"], CSocNetUserPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), $arUser["ID"], "viewprofile", CSocNetUser::IsCurrentUserModuleAdmin()) ? CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arUser["ID"])) : "");
             if ($e = $APPLICATION->GetException()) {
                 $warningMessage .= $e->GetString();
             }
         }