// Чтоб в него загрузить картинку. if (isset($request)) { // do... $name = stripslashes($request['name']); $descr = stripslashes($request['descr']); $image = !empty($comm['image']) ? $comm['image'] : false; $group_id = $request['group_id']; $restrict_type = $request['restrict_type']; $author_id = $request['author_id']; $author_login = $request['author_login']; } elseif ($id) { // edit $name = $comm['name']; $descr = $comm['descr']; $image = $comm['image']; $restrict_type = bitStr2Int($comm['restrict_type']); $group_id = $comm['group_id']; $author_id = $comm['author_id']; $author_login = $comm['author_login']; } if (!($commune_groups = commune::GetGroups())) { $commune_groups = array(); } $action = str_replace('do.', '', $action); $limit = commune::GetUserCommunesLimits(get_uid()); $count = $limit['user_communes_count'] ? "(у вас уже есть {$limit['user_communes_count']})" : ''; $header = $action == 'Create' ? 'Создание вашего сообщества' : '<a style="color:#666" href="?id=' . $comm['id'] . '">Сообщество «' . $comm['name'] . '»</a>'; $aCommExts = explode(',', commune::IMAGE_EXTENSIONS); $sCommExts = "var aCommExts = ['" . implode("','", $aCommExts) . "'];"; ?> <script type="text/javascript">
function OutCommune($commune_id, $mode = false) { session_start(); if (!isset($_SESSION['uid'])) { return; } $cm = new commune(); $objResponse = new xajaxResponse(); commune::Join($commune_id, $_SESSION['uid'], true); $comm = $cm->getCommune($commune_id, $_SESSION['uid']); $is_restricted = bitStr2Int($comm['restrict_type']) & commune::RESTRICT_JOIN_MASK; /*$url = substr($comm['restrict_type'], 1, 1) == '1' ? '/commune/?id='.$commune_id : 'document.location.href'; $objResponse->script("$('ov-commune-confirm').setStyle('display','none');"); $objResponse->script('document.location.href = '.$url);*/ if ($mode == 1 || $mode == 2) { $objResponse->script('document.location.href = document.location.href'); return $objResponse; } $html = '<a href="javascript:void(0)" onclick="xajax_JoinCommune(' . $comm['id'] . ', ' . $is_restricted . '); return false;"><img src="/images/btn-сgoin.png" alt="Вступить в сообщество"/></a>'; $objResponse->assign('join_' . $commune_id, 'innerHTML', $html); return $objResponse; }
/** * Проверка на тип группы(закрытая или открытая) * * @param bit $accessBits доступ * @param boolean $br Перенос если необходим * @return string Сообщает тип группы */ function GetJoinAccessStr($accessBits, $br = FALSE) { if (bitStr2Int($accessBits) & self::RESTRICT_JOIN_MASK) { return 'Закрытая группа.'; } return "Открытая группа." . ($br ? '<br/>' : ' ') . "Любой может присоединиться."; }