Exemple #1
0
if (!$uid && $om == commune::OM_TH_MY || !($topics = commune::GetTopMessages($id, $om == commune::OM_TH_MY ? $uid : NULL, $uid, $user_mod, $om, ($page - 1) * commune::MAX_TOP_ON_PAGE, commune::MAX_TOP_ON_PAGE))) {
    $topics = array();
}
// Стили закладок.
$bmCls = getBookmarksStyles(commune::OM_TH_COUNT, $om);
// Сколько участников (вместе с админами тут).
$mCnt = $comm['a_count'] - $comm['w_count'] + 1 . ' участник' . getSymbolicName($comm['a_count'] - $comm['w_count'] + 1, 'man');
// +1
//if ($thCnt = $themesCount - $bannedCount)
//$thCnt = $themesCount - $bannedCount;
if ($om == commune::OM_TH_MY) {
    $thCnt = $themesCount;
}
$thCntS = ending($thCnt, 'пост', 'поста', 'постов');
$sort = $_COOKIE['commune_fav_order'] != "" ? $_COOKIE['commune_fav_order'] : "date";
$favs = commune::GetFavorites($uid, NULL, $sort, $comm['id']);
// ACL
$is_site_admin = hasPermissions('communes');
$is_comm_admin = $user_mod & (commune::MOD_COMM_ADMIN | commune::MOD_COMM_MODERATOR);
$is_author = $user_mod & commune::MOD_COMM_AUTHOR;
$categories = commune::getCategories($id, hasPermissions('communes'));
/*require_once( $_SERVER['DOCUMENT_ROOT'] . '/classes/stop_words.php' );
$stop_words = new stop_words( hasPermissions("communes") );*/
?>
<script>
    var blockBoxContent = '';
    function __commDT(b,t,e,m,p,o,s,f)
    {
        if(warning(1)) {
            var tc=document.getElementById('idThCnt');
            xajax_DeleteTopic(b,t,e,m,p,o,s,f,(tc?tc.innerHTML:0));
function EditFav($msg_id, $priority = 0, $title = '', $action = 'edit')
{
    global $session;
    session_start();
    $user_id = $_SESSION['uid'];
    $objResponse = new xajaxResponse();
    $msg_id = intval($msg_id);
    $GLOBALS['xajax']->setCharEncoding('windows-1251');
    $sort = $_COOKIE['commune_fav_order'] != '' ? $_COOKIE['commune_fav_order'] : 'date';
    $action = trim($action);
    $title = trim($title);
    switch ($action) {
        case 'update':
            $title = substr($title, 0, 128);
            $updatefav = commune::AddFav($msg_id, $user_id, 0, $priority, $title);
            $editfav = current(commune::GetFavorites($user_id, $msg_id, $sort));
            $key = $msg_id;
            $om = '';
            $outHTML = __commPrntFavContent($editfav, $key, $user_id, $om);
            $objResponse->assign('fav' . $msg_id, 'innerHTML', $outHTML);
            break;
        case 'edit':
            $editfav = current(commune::GetFavorites($user_id, $msg_id, $sort));
            //$editfav = current($editfav);
            $editfav['title'] = preg_replace('/<br.*?>/mix', "\r\n", stripslashes(reformat2($editfav['title'], 20, 0, 1)));
            $outHTML = '<table border="0" cellpadding="1" cellspacing="0"><tbody><tr valign="top"><td style="padding-left: 3px;">';
            $outHTML .= '<ul class="post-f-fav-sel">';
            $outHTML .= "<li><IMG alt=\"\" border=\"0\" id='favpic" . $msg_id . "-0' width=\"15\" height=\"15\" src=\"" . ($editfav['priority'] == 0 ? commune::getStarByPR(0) : commune::getEmptyStarByPR(0)) . "\" hspace=\"1\" vspace=\"1\" onclick=\"FavPriority({$msg_id}, 0)\" style=\"cursor:pointer;\"></li>";
            $outHTML .= "<li><IMG alt=\"\" border=\"0\" id='favpic" . $msg_id . "-1' width=\"15\" height=\"15\" src=\"" . ($editfav['priority'] == 1 ? commune::getStarByPR(1) : commune::getEmptyStarByPR(1)) . "\" hspace=\"1\" vspace=\"1\" onclick=\"FavPriority({$msg_id}, 1)\" style=\"cursor:pointer;\"></li>";
            $outHTML .= "<li><IMG alt=\"\" border=\"0\" id='favpic" . $msg_id . "-2' width=\"15\" height=\"15\" src=\"" . ($editfav['priority'] == 2 ? commune::getStarByPR(2) : commune::getEmptyStarByPR(2)) . "\" hspace=\"1\" vspace=\"1\" onclick=\"FavPriority({$msg_id}, 2)\" style=\"cursor:pointer;\"></li>";
            $outHTML .= "<li><IMG alt=\"\" border=\"0\" id='favpic" . $msg_id . "-3' width=\"15\" height=\"15\" src=\"" . ($editfav['priority'] == 3 ? commune::getStarByPR(3) : commune::getEmptyStarByPR(3)) . "\" hspace=\"1\" vspace=\"1\" onclick=\"FavPriority({$msg_id}, 3)\" style=\"cursor:pointer;\"></li>";
            $outHTML .= '</ul></td><td>';
            $outHTML .= '<div class="fav-one-edit-txt">';
            $outHTML .= "<INPUT id='favpriority" . $msg_id . "' type='hidden' value='" . $editfav['priority'] . "'>";
            $outHTML .= "<INPUT id='currtitle' type='hidden' value='" . $editfav['title'] . "'>";
            $outHTML .= "<textarea rows=\"3\" cols=\"7\" id='favtext" . $msg_id . "'>{$editfav['title']}</textarea>";
            $outHTML .= '<div class="fav-one-edit-btns">';
            $outHTML .= "<INPUT type='button' value='Сохранить' onClick='if(document.getElementById(\"favtext" . $msg_id . '").value.length>128){alert("Слишком длинное название закладки!");return false;}else{xajax_EditFav(' . $msg_id . ', document.getElementById("favpriority' . $msg_id . '").value, document.getElementById("favtext' . $msg_id . "\").value, \"update\");}'>";
            $outHTML .= "<INPUT type='button' value='Отмена' onClick='xajax_EditFav(" . $msg_id . ', ' . $editfav['priority'] . ", document.getElementById(\"currtitle\").value, \"default\");'>";
            $outHTML .= '</div></td></tr></tbody></table>';
            $objResponse->assign('fav' . $msg_id, 'innerHTML', $outHTML);
            break;
        default:
            $editfav = current(commune::GetFavorites($user_id, $msg_id, $sort));
            $key = $msg_id;
            $om = '';
            $outHTML = __commPrntFavContent($editfav, $key, $user_id, $om);
            $objResponse->assign('fav' . $msg_id, 'innerHTML', $outHTML);
            break;
    }
    $objResponse->script('communeObj.initFavs();');
    return $objResponse;
}
Exemple #3
0
    $crumbs[] = array("title" => $comm['name'], "url" => getFriendlyURL('commune_commune', $comm['id']));
    $crumbs[] = array("title" => $top['category_name'], "url" => getFriendlyURL('commune_commune', $comm['id']) . "?om=" . (__paramInit("int", "om") ? __paramInit("int", "om") : '0') . '&cat=' . $top['category_id']);
    ?>

<div class="b-community-discussion">
<?php 
    echo getCrumbs($crumbs, "commune");
    $sTitle = $top['title'];
    ?>
<h1 class="b-page__title"><?php 
    echo $sTitle;
    ?>
                <?php 
    if ($_SESSION['login']) {
        if (!isset($favs)) {
            $favs = commune::GetFavorites(get_uid(false), NULL);
        }
        //$onclick = ($site == 'Lenta') ? "ShowFavFloatLenta($msg_id, $user_id, 'CM')" : "ShowFavFloat($msg_id, $user_id, $om)";
        //$ids = ($site == 'Lenta' ? 'CM' : '') . $msg_id;
        //$pr = ($favs[$msg_id] || ($site == 'Lenta' && $favs['CM' . $msg_id])) ? ($site == 'Lenta' ? $favs['CM' . $msg_id]['priority'] : $favs[$msg_id]['priority']) : '0_empty';
        //$alt_text = $favs[$msg_id] || ($site == 'Lenta' && $favs['CM' . $msg_id]) ? 'Редактировать приоритет' : 'Добавить в закладки';
        // с помощью id передаем параметры в js код
        ?>
                    <span id="fav_star_<?php 
        echo $msg_id;
        ?>
_<?php 
        echo $user_id;
        ?>
_<?php 
        echo $om;