Beispiel #1
0
         $arResult["Candidate"] = array();
         while ($arUsers = $dbUsers->GetNext()) {
             $arUsers["urlToUser"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arUsers["USER_ID"]));
             $arUsers["NameFormated"] = CBlogUser::GetUserName($arUsers["BLOG_USER_ALIAS"], $arUsers["USER_NAME"], $arUsers["USER_LAST_NAME"], $arUsers["USER_LOGIN"]);
             $arUsers["urlToEdit"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER_SETTINGS_EDIT"], array("user_id" => $arUsers["USER_ID"], "blog" => $arBlog["URL"]));
             $arUsers["urlToDelete"] = htmlspecialcharsex($APPLICATION->GetCurPageParam("del_id=" . $arUsers["USER_ID"] . '&' . bitrix_sessid_get(), array("del_id", "sessid")));
             $arResult["Candidate"][] = $arUsers;
         }
         $dbUsers = CBlogUser::GetList($arOrderBy, array("GROUP_BLOG_ID" => $arBlog["ID"]), array("ID", "USER_ID", "ALIAS", "USER_LOGIN", "USER_NAME", "USER_LAST_NAME"));
         $arResult["Users"] = array();
         while ($arUsers = $dbUsers->GetNext()) {
             $arUsers["urlToUser"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arUsers["USER_ID"]));
             $arUsers["NameFormated"] = CBlogUser::GetUserName($arUsers["BLOG_USER_ALIAS"], $arUsers["USER_NAME"], $arUsers["USER_LAST_NAME"], $arUsers["USER_LOGIN"]);
             $arUsers["urlToEdit"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER_SETTINGS_EDIT"], array("user_id" => $arUsers["USER_ID"], "blog" => $arBlog["URL"]));
             $arUsers["urlToDelete"] = htmlspecialcharsex($APPLICATION->GetCurPageParam("del_id=" . $arUsers["USER_ID"] . '&' . bitrix_sessid_get(), array("del_id", "sessid")));
             $dbUserGroups = CBlogUserGroup::GetList(array(), array("USER2GROUP_USER_ID" => $arUsers["USER_ID"], "BLOG_ID" => $arBlog["ID"]), false, false, array("ID", "NAME"));
             $bNeedComa = False;
             while ($arUserGroups = $dbUserGroups->GetNext()) {
                 if ($bNeedComa) {
                     $arUsers["groupsFormated"] .= ", ";
                 }
                 $arUsers["groups"][] = $arUserGroups;
                 $arUsers["groupsFormated"] .= $arUserGroups["NAME"];
                 $bNeedComa = True;
             }
             $arResult["Users"][] = $arUsers;
         }
     } else {
         $arResult["FATAL_ERROR"] = GetMessage("B_B_US_NO_RIGHT");
     }
 } else {
Beispiel #2
0
									<td><?php 
            echo GetMessage("BLOG_REG_USERS");
            ?>
</td>
									<td><?php 
            echo ShowSelectPerms('p', 2, $arUGperms_p[2]);
            ?>
</td>
									<td><?php 
            echo ShowSelectPerms('c', 2, $arUGperms_c[2]);
            ?>
</td>
								</tr>
								
						<?php 
            $res = CBlogUserGroup::GetList(array(), $arFilter = array("BLOG_ID" => $BLOG_ID));
            while ($aUGroup = $res->Fetch()) {
                print "\n\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<td>" . htmlspecialchars($aUGroup['NAME']) . "</td>\n\t\t\t\t\t\t\t\t\t<td>" . ShowSelectPerms('p', $aUGroup['ID'], $arUGperms_p[$aUGroup['ID']]) . "</td>\n\t\t\t\t\t\t\t\t\t<td>" . ShowSelectPerms('c', $aUGroup['ID'], $arUGperms_c[$aUGroup['ID']]) . "</td>\n\t\t\t\t\t\t\t\t</tr>";
            }
            ?>
							</table>
							</div>
					</td>
				</tr>

			<?php 
            if (COption::GetOptionString("blog", "enable_trackback", "N") == "Y" && $arBlog["ALLOW_TRACKBACK"] == "Y") {
                ?>
				<tr>
					<td class="blogtablehead" valign=top align=right nowrap>
					<font class="blogheadtext">
Beispiel #3
0
                        }
                    }
                    if (strlen($arResult["ERROR_MESSAGE"]) <= 0) {
                        LocalRedirect($_POST["BACK_URL"]);
                    }
                }
                if (strlen($_POST["BACK_URL"]) > 0) {
                    $arResult["BACK_URL"] = htmlspecialcharsbx($_POST["BACK_URL"]);
                } else {
                    $arResult["BACK_URL"] = htmlspecialcharsbx($APPLICATION->GetCurPageParam());
                }
                $res = CBlogUserGroup::GetList(array("NAME" => "ASC"), array("BLOG_ID" => $arBlog["ID"]), array("ID", "NAME", "BLOG_ID", "COUNT" => "USER2GROUP_ID"));
                while ($arGroup = $res->Fetch()) {
                    $arSumGroup[$arGroup["ID"]] = $arGroup["CNT"];
                }
                $res = CBlogUserGroup::GetList($arOrder = array("NAME" => "ASC"), $arFilter = array("BLOG_ID" => $arBlog["ID"]));
                while ($arGroupCount = $res->GetNext()) {
                    $arGroupCount['CNT'] = IntVal($arSumGroup[$arGroupCount["ID"]]);
                    $arGroupCnt[] = $arGroupCount;
                }
                $arResult["USER_GROUP"] = $arGroupCnt;
            } else {
                $arResult["FATAL_ERROR_MESSAGE"] = GetMessage("BLOG_ERR_NO_RIGHTS");
            }
        } else {
            $arResult["FATAL_ERROR_MESSAGE"] = GetMessage("BLOG_ERR_NO_BLOG");
        }
    } else {
        $arResult["FATAL_ERROR_MESSAGE"] = GetMessage("BLOG_ERR_NO_BLOG");
    }
} else {
Beispiel #4
0
 function AddToUserGroup($ID, $blogID, $arGroups = array(), $joinStatus = "Y", $selectType = BLOG_BY_BLOG_USER_ID, $action = BLOG_CHANGE)
 {
     global $DB;
     $ID = IntVal($ID);
     $blogID = IntVal($blogID);
     if (!is_array($arGroups)) {
         $arGroups = array($arGroups);
     }
     $joinStatus = $joinStatus == "Y" ? "Y" : "N";
     $selectType = $selectType == BLOG_BY_USER_ID ? BLOG_BY_USER_ID : BLOG_BY_BLOG_USER_ID;
     $action = $action == BLOG_ADD ? BLOG_ADD : BLOG_CHANGE;
     $bSuccess = True;
     $arResult = CBlog::GetByID($blogID);
     if (!$arResult) {
         $GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $blogID, GetMessage("BLG_GU_ERROR_NO_BLOG")), "ERROR_NO_BLOG");
         $bSuccess = False;
     }
     if ($bSuccess) {
         $arUser = CBlogUser::GetByID($ID, $selectType);
         $dbResult = CUser::GetByID($arUser["USER_ID"]);
         if (!$dbResult->Fetch()) {
             $GLOBALS["APPLICATION"]->ThrowException(GetMessage("BLG_GU_ERROR_NO_USER_ID"), "ERROR_NO_USER_ID");
             $bSuccess = False;
         }
     }
     if ($bSuccess) {
         if ($action == BLOG_CHANGE) {
             $DB->Query("DELETE FROM b_blog_user2user_group " . "WHERE USER_ID = " . IntVal($arUser["USER_ID"]) . " " . "\tAND BLOG_ID = " . $blogID . " ");
         }
         if (count($arGroups) > 0) {
             array_walk($arGroups, create_function("&\$item", "\$item=IntVal(\$item);"));
             $dbUserGroups = CBlogUserGroup::GetList(array(), array("ID" => $arGroups, "BLOG_ID" => $blogID), false, false, array("ID"));
             $arGroups = array();
             while ($arUserGroup = $dbUserGroups->Fetch()) {
                 $arGroups[] = IntVal($arUserGroup["ID"]);
             }
             if ($action == BLOG_ADD) {
                 $arCurrentGroups = CBlogUser::GetUserGroups($ID, $blogID, "", $selectType);
             }
             foreach ($arGroups as $val) {
                 if ($val != 1 && $val != 2) {
                     if ($action == BLOG_CHANGE || $action == BLOG_ADD && !in_array($val, $arCurrentGroups)) {
                         $DB->Query("INSERT INTO b_blog_user2user_group (USER_ID, BLOG_ID, USER_GROUP_ID) " . "VALUES (" . IntVal($arUser["USER_ID"]) . ", " . $blogID . ", " . IntVal($val) . ")");
                     }
                 }
             }
         }
         unset($GLOBALS["BLOG_USER"]["BLOG_USER2GROUP_CACHE_" . $arUser["ID"]]);
         unset($GLOBALS["BLOG_USER"]["BLOG_USER2GROUP1_CACHE_" . $arUser["USER_ID"]]);
     }
     return $bSuccess;
 }
            echo " selected";
        }
        ?>
><?php 
        echo htmlspecialcharsex($val);
        ?>
</option><?php 
    }
}
?>
			</select>
		</td>
	</tr>
	<?php 
if (IntVal($ID) > 0) {
    $dbGroups = CBlogUserGroup::GetList(array("NAME" => "ASC"), array("BLOG_ID" => $ID));
    while ($arGroup = $dbGroups->Fetch()) {
        ?>
			<tr>
				<td><?php 
        echo htmlspecialcharsbx($arGroup["NAME"]);
        ?>
:</td>
				<td>
					<select name="PERMS_C[<?php 
        echo IntVal($arGroup["ID"]);
        ?>
]">
					<?php 
        reset($GLOBALS["AR_BLOG_PERMS"]);
        while (list($key, $val) = each($GLOBALS["AR_BLOG_PERMS"])) {
Beispiel #6
0
     if ($arBlogGroup["ID"] == $arResult["BLOG"]["GROUP_ID"]) {
         $arBlogGroup["SELECTED"] = "Y";
     }
     $arBlogGroupTmp[] = $arBlogGroup;
 }
 $arResult["GROUP"] = $arBlogGroupTmp;
 $arResult["AUTO_GROUPS"] = array();
 if (!empty($arBlog)) {
     $arResult["AUTO_GROUPS"] = unserialize($arBlog["AUTO_GROUPS"]);
 }
 if (!empty($arBlog)) {
     $res = CBlogUserGroup::GetList(array("NAME" => "ASC"), array("BLOG_ID" => $arBlog["ID"]), array("ID", "NAME", "BLOG_ID", "COUNT" => "USER2GROUP_ID"));
     while ($arGroup = $res->Fetch()) {
         $arSumGroup[$arGroup["ID"]] = $arGroup["CNT"];
     }
     $res = CBlogUserGroup::GetList(array("ID" => "ASC"), array("BLOG_ID" => $arBlog["ID"]));
     $arUGroupTmp = array();
     while ($arUGroup = $res->GetNext()) {
         if (is_array($arResult["AUTO_GROUPS"]) && in_array($arUGroup["ID"], $arResult["AUTO_GROUPS"])) {
             $arUGroup["CHECKED"] = "Y";
         }
         $arUGroup["CNT"] = IntVal($arSumGroup[$arUGroup["ID"]]);
         $arUGroupTmp[] = $arUGroup;
     }
     $arResult["USER_GROUP"] = $arUGroupTmp;
 } else {
     $arResult["USER_GROUP"][] = array("ID" => 0, "NAME" => GetMessage('BLOG_FRIENDS'), "CNT" => 0);
 }
 $arResult["BLOG_POST_PERMS"] = $GLOBALS["AR_BLOG_POST_PERMS"];
 $arResult["BLOG_COMMENT_PERMS"] = $GLOBALS["AR_BLOG_COMMENT_PERMS"];
 if (!$USER->IsAdmin() && $blogModulePermissions < "W") {
Beispiel #7
0
                     if (empty($arBlogUser)) {
                         CBlogUser::Add(array("USER_ID" => $arUser["ID"], "=LAST_VISIT" => $DB->GetNowFunction(), "=DATE_REG" => $DB->GetNowFunction(), "ALLOW_POST" => "Y"));
                     }
                     CBlogUser::AddToUserGroup($arUser["ID"], $arBlog["ID"], $GLOBALS["add2groups"], "", BLOG_BY_USER_ID, BLOG_CHANGE);
                     $dbCandidate = CBlogCandidate::GetList(array(), array("BLOG_ID" => $arBlog["ID"], "USER_ID" => $arUser["ID"]));
                     if ($arCandidate = $dbCandidate->Fetch()) {
                         CBlogCandidate::Delete($arCandidate["ID"]);
                     }
                     LocalRedirect(CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER_SETTINGS"], array("blog" => $arBlog["URL"])));
                 }
                 $arResult["ERROR_MESSAGE"] = $errorMessage;
                 $arResult["OK_MESSAGE"] = $okMessage;
                 $arResult["userName"] = CBlogUser::GetUserName($arBlogUser["ALIAS"], $arUser["NAME"], $arUser["LAST_NAME"], $arUser["LOGIN"]);
                 $arResult["urlToUser"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arUser["ID"]));
                 $arResult["arUserGroups"] = CBlogUser::GetUserGroups($arUser["ID"], $arBlog["ID"], "Y", BLOG_BY_USER_ID);
                 $dbBlogGroups = CBlogUserGroup::GetList(array("NAME" => "ASC"), array("BLOG_ID" => $arBlog["ID"]), false, false, array("ID", "NAME"));
                 while ($arBlogGroups = $dbBlogGroups->GetNext()) {
                     $arResult["Groups"][] = $arBlogGroups;
                 }
             } else {
                 $arResult["FATAL_ERROR"] = GetMessage("B_B_US_NO_RIGHT");
             }
         } else {
             $arResult["FATAL_ERROR"] = GetMessage("B_B_US_NO_BLOG");
         }
     } else {
         $arResult["FATAL_ERROR"] = GetMessage("B_B_US_NO_BLOG");
     }
 } else {
     $arResult["FATAL_ERROR"] = GetMessage("B_B_US_NO_BLOG");
 }