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; }