Exemplo n.º 1
0
function Lenta_Show($page = 1)
{
    global $DB;
    session_start();
    require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/portfolio.php";
    require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/professions.php";
    require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/commune.php";
    require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/links.php";
    require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/lenta.php";
    require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/users.php";
    require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/blogs.php";
    /*require_once( $_SERVER['DOCUMENT_ROOT'] . '/classes/stop_words.php' );
        
    $stop_words = new stop_words( false );*/
    $yt_replace_id = array();
    $yt_replace_data = array();
    $uid = get_uid(false);
    $objResponse = new xajaxResponse();
    ob_start();
    if (!($groups = professions::GetAllGroupsLite())) {
        return;
    }
    if (!($lenta = lenta::GetUserLenta($uid))) {
    }
    $sort = $_COOKIE['lenta_fav_order'] != "" ? $_COOKIE['lenta_fav_order'] : "date";
    $favs = lenta::GetFavorites($uid, $sort);
    if (!($myComms = commune::GetCommunes(NULL, $uid, NULL, commune::OM_CM_MY))) {
        $myComms = array();
    }
    if (!($joinedComms = commune::GetCommunes(NULL, NULL, $uid, commune::OM_CM_JOINED))) {
        $joinedComms = array();
    }
    // Все сообщества, доступные пользователю.
    $communes = array();
    foreach ($myComms as $comm) {
        $communes[] = $comm;
    }
    foreach ($joinedComms as $comm) {
        $communes[] = $comm;
    }
    // Блоги
    if (!($blog_grs = blogs::GetThemes($error, 1))) {
        $blog_grs = array();
    }
    $blg = NULL;
    if ($lenta && $lenta['blog_grs'] && !empty($lenta['blog_grs'])) {
        $blg = implode(',', $lenta['blog_grs']);
    }
    $pgs = NULL;
    if ($lenta['all_profs_checked'] == 'f') {
        if ($lenta && $lenta['prof_groups'] && !empty($lenta['prof_groups'])) {
            $pgs = implode(',', $lenta['prof_groups']);
        }
    }
    $allThemesCount = 0;
    $cms = NULL;
    $user_comm_mods = array();
    // Отбираем среди выбранных ранее сообществ в ленте, те которые до сих пор остаются
    // доступными ему для просмотра в ленте (его могли удалить или забанить). А также заполняем массив user_mod-ов на каждое из сообществ.
    if ($lenta && $lenta['communes'] && !empty($lenta['communes'])) {
        $i = 0;
        $cms = '';
        foreach ($lenta['communes'] as $cm_id) {
            if ($uStatus = commune::GetUserCommuneRel($cm_id, $uid)) {
                $ucm = $user_mod;
                $ucm |= commune::MOD_COMM_MODERATOR * $uStatus['is_moderator'];
                $ucm |= commune::MOD_COMM_MANAGER * $uStatus['is_manager'];
                $ucm |= commune::MOD_COMM_ADMIN * ($uStatus['is_admin'] || $uStatus['is_moderator'] || $uStatus['is_manager']);
                $ucm |= commune::MOD_COMM_AUTHOR * $uStatus['is_author'];
                $ucm |= commune::MOD_COMM_ASKED * $uStatus['is_asked'];
                $ucm |= commune::MOD_COMM_ACCEPTED * ($uStatus['is_accepted'] || $ucm & commune::MOD_COMM_ADMIN);
                $ucm |= commune::MOD_COMM_BANNED * $uStatus['is_banned'];
                $ucm |= commune::MOD_COMM_DELETED * $uStatus['is_deleted'];
                $user_comm_mods[$cm_id] = $ucm;
                if (!$uStatus['is_deleted'] && !$uStatus['is_banned'] && $uStatus['is_blocked_commune'] == 0 && ($uStatus['is_accepted'] || $uStatus['is_author'])) {
                    $cms .= (!$i++ ? '' : ',') . $cm_id;
                }
            }
        }
    }
    //if($cms)
    //  $allThemesCount -= commune::GetMyThemesCount($cms, $uid);
    if ($lenta && $lenta['all_profs_checked'] == 't' || $cms || $pgs || $blg) {
        $items = lenta::GetLentaItems($uid, $lenta && $lenta['my_team_checked'] == 't', $lenta && $lenta['all_profs_checked'] == 't', $pgs, $cms, ($page - 1) * lenta::MAX_ON_PAGE, lenta::MAX_ON_PAGE, $allWorkCount, $blg);
    }
    if (!$items) {
        $items = array();
    }
    //    var_dump($favs);
    $stars = array(0 => 'bsg.png', 1 => 'bsgr.png', 2 => 'bsy.png', 3 => 'bsr.png');
    $i = 0;
    foreach ($items as $item) {
        switch ($item['item_type']) {
            case '2':
                // Сообщества
                $top = $item;
                $user_mod = $user_comm_mods[$top['commune_id']];
                if ($top['member_is_banned'] && !($user_mod & (commune::MOD_ADMIN | commune::MOD_COMM_AUTHOR | commune::MOD_COMM_MANAGER)) || $top['is_private'] == 't' && $top['user_id'] != $uid && !($user_mod & (commune::MOD_ADMIN | commune::MOD_COMM_AUTHOR | commune::MOD_COMM_MANAGER)) || $top['is_blocked'] && $top['commune_author_id'] != $uid) {
                    continue;
                }
                $aThemeId = is_array($top['theme_id']) ? $top['theme_id'] : array($top['theme_id']);
                $top['answers'] = $DB->rows("SELECT * FROM commune_poll_answers WHERE theme_id IN (?l) ORDER BY id", array($top['theme_id']));
                $GLOBALS[LINK_INSTANCE_NAME] = new links('commune');
                $user_id = $uid;
                $mod = $user_mod;
                $is_member = $mod & (commune::MOD_ADMIN | commune::MOD_COMM_ACCEPTED | commune::MOD_COMM_AUTHOR);
                $is_moder = $mod & (commune::MOD_ADMIN | commune::MOD_MODER | commune::MOD_COMM_MODERATOR | commune::MOD_COMM_AUTHOR);
                $commune_info = commune::getCommuneInfoByMsgID($top['id']);
                ?>
                                <style>
.lo-m .lo-i-my-d .ac-pro, .lo-m .lo-i-my-d .ac-epro {
margin-right: 0px;
}
.lo .utxt .b-layout__txt .b-icon__lprofi{ vertical-align:baseline !important; top:2px !important;}
.lo .utxt>.b-pic{ margin-right:10px !important;}
</style>
								<div class="lo lo-m" id='idTop_<?php 
                echo $top['id'];
                ?>
' style='margin-bottom:0px !important;'>
									<ul class="lo-p">
										<li class="lo-s">
											<div class="b-layout_bordrad_3">
												<a href="/commune" class="lnk-dot-666">Сообщества</a>
											</div>
										</li>
										<li class="post-f-fav">
                                            <?php 
                $msg_id = $top['id'];
                ?>
                                            <?php 
                if ($favs['CM' . $msg_id]) {
                    ?>
 
                                                <img src="/images/bookmarks/<?php 
                    echo $stars[$favs['CM' . $msg_id]['priority']];
                    ?>
" alt="" on="<?php 
                    echo $is_fav ? 1 : 0;
                    ?>
" id="favstar<?php 
                    echo 'CM' . $msg_id;
                    ?>
" <?php 
                    if ($uid) {
                        ?>
onclick="ShowFavFloatLenta(<?php 
                        echo $msg_id;
                        ?>
, <?php 
                        echo $uid;
                        ?>
, 'CM')" ><?php 
                    }
                    ?>
                                            <?php 
                } else {
                    ?>
                                                <img src="/images/bookmarks/bsw.png" alt="" on="<?php 
                    echo $is_fav ? 1 : 0;
                    ?>
" id="favstar<?php 
                    echo 'CM' . $msg_id;
                    ?>
" <?php 
                    if ($uid) {
                        ?>
onclick="ShowFavFloatLenta(<?php 
                        echo $msg_id;
                        ?>
, <?php 
                        echo $uid;
                        ?>
, 'CM')" ><?php 
                    }
                    ?>
                                            <?php 
                }
                ?>
                                            <ul class="post-f-fav-sel" style="display:none;" id="FavFloat<?php 
                echo $msg_id;
                ?>
"></ul>
										</li>
									</ul>
									<div class="utxt">
<?php 
                print __LentaPrntUsrInfo($top, 'user_', '', '', false, true);
                ?>
										<h3>
                                        <?php 
                if ($top['is_private'] == 't') {
                    ?>
                                        <img src="/images/icons/eye-hidden.png" alt="Скрытый пост" title="Скрытый пост">&nbsp;	            
                                        <?php 
                }
                //if
                ?>
                                        <?php 
                $sTitle = $top['title'];
                ?>
                                        <?php 
                $sMessage = $top['msgtext'];
                ?>
                                        <a href="<?php 
                echo getFriendlyURL('commune', $top['id']);
                ?>
?om=<?php 
                echo commune::OM_TH_NEW;
                ?>
"><?php 
                echo reformat2($sTitle, 30, 0, 1);
                ?>
</a>&nbsp;</h3>
										<p><?php 
                echo reformat2($sMessage, 46, 1, 0, 1);
                ?>
</p>

                                        <!-- Questions -->
			<?php 
                if ($top['question'] != '') {
                    ?>
			<div id="poll-<?php 
                    echo $top['theme_id'];
                    ?>
" class="commune-poll">
				<div class="commune-poll-theme"><?php 
                    echo reformat($top['question'], 43, 0, 1);
                    ?>
</div>
				<div id="poll-answers-<?php 
                    echo $top['theme_id'];
                    ?>
">
				<?php 
                    if ($top['poll_closed'] == 't') {
                        ?>
<table class="b-layout__table b-layout__table_width_full"><?php 
                    }
                    ?>
                <?php 
                    // если надо вывести только количество ответов
                    $showAnswers = $top['poll_votes'] || !$user_id || $top['commune_blocked'] == 't' || $top['user_is_banned'] || $top['member_is_banned'] || !$is_member;
                    if ($showAnswers) {
                        ?>
<table class="poll-variants"><?php 
                    }
                    ?>
				<?php 
                    $i = 0;
                    $max = 0;
                    if ($top['poll_closed'] == 't') {
                        foreach ($top['answers'] as $answer) {
                            $max = max($max, $answer['votes']);
                        }
                    }
                    foreach ($top['answers'] as $answer) {
                        ?>

						<?php 
                        if ($top['poll_closed'] == 't') {
                            ?>
                        	<tr class="b-layout__tr">
                              <td class="b-layout__left b-layout__left_width_50"><label class="b-layout__txt" for="poll_<?php 
                            echo $i;
                            ?>
"><?php 
                            echo reformat($answer['answer'], 30, 0, 1);
                            ?>
</label></td>
                              <td class="b-layout__middle b-layout__middle_width_30 b-layout__middle_center"><?php 
                            echo $answer['votes'];
                            ?>
</td>
                              <td class=" b-layout__right "><div class=" res-line rl1" style="width: <?php 
                            echo $max ? round(100 * $answer['votes'] / $max * 3) : 0;
                            ?>
px;"></div></td>
                            </tr>
                        <?php 
                        } else {
                            ?>
                            <?php 
                            if ($showAnswers) {
                                ?>
                                <tr>
                                    <td class="bp-gres"><?php 
                                echo $answer['votes'];
                                ?>
</td>
                                    <td>
                                        <label><?php 
                                echo $answer['answer'];
                                ?>
</label>
                                    </td>
                                </tr>
                            <?php 
                            } else {
                                ?>
                                <?php 
                                if ($top['poll_multiple'] == 't') {
                                    ?>
                                <div class="b-check b-check_padbot_10">
                                    <input id="poll-<?php 
                                    echo $top['theme_id'];
                                    ?>
_<?php 
                                    echo $i;
                                    ?>
" class="b-check__input" type="checkbox" name="poll_vote[]" value="<?php 
                                    echo $answer['id'];
                                    ?>
" />
                                    <label class="b-check__label b-check__label_fontsize_13" for="poll-<?php 
                                    echo $top['theme_id'];
                                    ?>
_<?php 
                                    echo $i++;
                                    ?>
"><?php 
                                    echo reformat($answer['answer'], 30, 0, 1);
                                    ?>
</label>
                                </div>
                                <?php 
                                } else {
                                    ?>
                                <div class="b-radio__item  b-radio__item_padbot_5">
                                    <table class="b-layout__table b-layout__table_width_full" cellpadding="0" cellspacing="0" border="0">
                                        <tr class="b-layout__tr">
                                            <td class="b-layout__left b-layout__left_width_15"><input id="poll-<?php 
                                    echo $top['theme_id'];
                                    ?>
_<?php 
                                    echo $i;
                                    ?>
" class="b-radio__input b-radio__input_top_-3" type="radio" name="poll_vote" value="<?php 
                                    echo $answer['id'];
                                    ?>
" /></td>
                                            <td class="b-layout__right"><label class="b-radio__label b-radio__label_fontsize_13" for="poll-<?php 
                                    echo $top['theme_id'];
                                    ?>
_<?php 
                                    echo $i++;
                                    ?>
"><?php 
                                    echo reformat($answer['answer'], 30, 0, 1);
                                    ?>
</label></td>
                                        </tr>
                                    </table>
                                </div>
                                <?php 
                                }
                                ?>
                            <?php 
                            }
                            ?>
                            
                        <?php 
                        }
                        ?>

				<?php 
                    }
                    ?>
                <?php 
                    if ($showAnswers) {
                        ?>
</table><?php 
                    }
                    ?>
				<?php 
                    if ($top['poll_closed'] == 't') {
                        ?>
</table><?php 
                    }
                    ?>
				</div>
				<?php 
                    if (!$top['poll_votes'] && $user_id && $top['poll_closed'] != 't' && $top['commune_blocked'] != 't' && !$top['user_is_banned'] && !$top['member_is_banned'] && $is_member) {
                        ?>
                
                <div class="b-buttons b-buttons_inline-block">
                    <span id="poll-btn-vote-<?php 
                        echo $top['theme_id'];
                        ?>
">
                        <a class="b-button b-button_flat b-button_flat_grey" href="javascript: return false;" onclick="poll.vote('Commune', <?php 
                        echo $top['theme_id'];
                        ?>
); return false;">Ответить</a>&nbsp;&nbsp;&nbsp;                
                    </span>                
					<span id="poll-btn-result-<?php 
                        echo $top['theme_id'];
                        ?>
" ><a class="b-buttons__link b-buttons__link_dot_0f71c8" href="javascript: return false;" onclick="poll.showResult('Commune', <?php 
                        echo $top['theme_id'];
                        ?>
); return false;">Посмотреть результаты</a></span>
                </div>
				<?php 
                    } else {
                        ?>
				<span id="poll-btn-vote-<?php 
                        echo $top['theme_id'];
                        ?>
"></span>
				<span id="poll-btn-result-<?php 
                        echo $top['theme_id'];
                        ?>
"></span>
				<?php 
                    }
                    ?>
			</div>
            <br />
			<?php 
                }
                ?>
                                        <!-- /Questions -->

                                        <!-- Youtube -->
<?php 
                if ($top['yt_link']) {
                    $tmp_yt_id = $top['id'] . 'ytlink' . mt_rand(1, 1000000);
                    $tmp_yt_data = show_video($top['id'], $top['yt_link']);
                    array_push($yt_replace_id, '/' . $tmp_yt_id . '/');
                    array_push($yt_replace_data, $tmp_yt_data);
                    echo "<div style='padding-top: 20px'>" . $tmp_yt_id . "</div><br/>";
                }
                ?>


<?php 
                //            (($top['youtube_link'])? ("<div style='padding-top: 20px'>".show_video($top['id'], $top['youtube_link'])."</div><br/>"):"")
                ?>

                                        <!-- /Youtube -->

                                        <!-- Attach -->
<?php 
                if ($top['attach']) {
                    $attach = $top['attach'][0];
                    if ($attach['fname']) {
                        $att_ext = strtolower(CFile::getext($attach['fname']));
                        if ($att_ext == "swf") {
                            print "<br/>" . viewattachExternal($top['user_login'], $attach['fname'], "upload", "/blogs/view_attach.php?user="******"&attach=" . $attach['fname']) . "<br/>";
                        } elseif ($att_ext == 'flv') {
                            print "<br/>" . viewattachLeft($top['user_login'], $attach['fname'], "upload", $file, 1000, 470, 307200, true, $attach['small'] == 't' ? 1 : 0) . "<br/>";
                        } else {
                            print "<br/>" . viewattachLeft($top['user_login'], $attach['fname'], "upload", $file, 1000, 470, 307200, !($attach['small'] == 't'), $attach['small'] == 't' ? 1 : 0) . "<br/>";
                        }
                    }
                    echo '<br/>';
                    if (sizeof($top['attach']) > 1) {
                        echo "<a href=\"" . getFriendlyURL('commune', $top['id']) . "\"><b>" . blogs::ShowMoreAttaches(sizeof($top['attach'])) . "</b></a><br/><br/>";
                    }
                }
                ?>

                                        <!-- /Attach -->


									</div>
									<ul class="lo-i">
                                        <?php 
                $post_year = dateFormat('Y', $top['post_time']);
                ?>
                                        <li class="lo-i-cm">
                                            <a href="<?php 
                echo getFriendlyURL('commune', $top['id']);
                ?>
" <?php 
                echo $top['current_count'] == NULL && intval($top['count_comments']) != 0 ? 'style="font-weight:bold;"' : '';
                ?>
><?php 
                echo $top['closed_comments'] == 't' ? "Комментирование закрыто" : "Комментарии (" . intval($top['count_comments']) . ")";
                ?>
</a>
                                            <?php 
                if ($top['closed_comments'] == 'f') {
                    $top['current_count'] = $top['current_count'] == '' ? $top['a_count'] - 1 : $top['current_count'];
                    if ($top['a_count'] > 1) {
                        $unread = $top['a_count'] - 1 - $top['current_count'];
                    }
                    if ($unread > 0) {
                        ?>
                                                <a href="<?php 
                        echo getFriendlyURL('commune', $top['id']);
                        ?>
#unread" style="color:#6BA813; font-weight:bold;">(<?php 
                        echo $unread;
                        ?>
 <?php 
                        echo $unread == 1 ? "новый" : "новых";
                        ?>
)</a>
                                                <?php 
                    }
                    $unread = 0;
                }
                ?>
                                        </li>
										<li class="lo-i-c"><a href="/commune/?id=<?php 
                echo $top['commune_id'];
                ?>
"><?php 
                echo $top['commune_name'];
                ?>
</a>, <a href="/commune/?gr=<?php 
                echo $top['commune_group_id'];
                ?>
"><?php 
                echo $top['commune_group_name'];
                ?>
</a></li>
										<li><?php 
                echo $post_year > 2000 ? dateFormat("d.m.Y H:i", $top['post_time']) : '';
                ?>
</li>
									</ul>
								</div>
                                <br>

                            <?php 
                break;
            case '1':
                // Портфолио
                $work = $item;
                if ($work['work_is_blocked']) {
                    continue;
                }
                $is_fav = isset($favs['PF' . $work['portfolio_id']]) ? 1 : 0;
                $msg_id = $work['portfolio_id'];
                ?>
								<div class="lo lo-m" style='margin-bottom:0px !important;'>
									<ul class="lo-p">
										<li class="lo-s">
											<div class="b-layout_bordrad_3">
												<a href="/portfolio" class="lnk-dot-666">Работы</a>
											</div>
										</li>
										<li class="post-f-fav">
                                            <?php 
                if ($favs['PF' . $msg_id]) {
                    ?>
 
                                                <img src="/images/bookmarks/<?php 
                    echo $stars[$favs['PF' . $msg_id]['priority']];
                    ?>
" alt="" on="<?php 
                    echo $is_fav ? 1 : 0;
                    ?>
" id="favstar<?php 
                    echo 'PF' . $msg_id;
                    ?>
" <?php 
                    if ($uid) {
                        ?>
onclick="ShowFavFloatLenta(<?php 
                        echo $msg_id;
                        ?>
, <?php 
                        echo $uid;
                        ?>
, 'PF')" ><?php 
                    }
                    ?>
                                            <?php 
                } else {
                    ?>
                                                <img src="/images/bookmarks/bsw.png" alt="" on="<?php 
                    echo $is_fav ? 1 : 0;
                    ?>
" id="favstar<?php 
                    echo 'PF' . $msg_id;
                    ?>
" <?php 
                    if ($uid) {
                        ?>
onclick="ShowFavFloatLenta(<?php 
                        echo $msg_id;
                        ?>
, <?php 
                        echo $uid;
                        ?>
, 'PF')" ><?php 
                    }
                    ?>
                                            <?php 
                }
                ?>
                                            <ul class="post-f-fav-sel" style="display:none;" id="FavFloat<?php 
                echo $msg_id;
                ?>
"></ul>
										</li>
									</ul>
									<div class="utxt">
                                        <?php 
                print __LentaPrntUsrInfo($work, 'user_', '', '', false, true);
                ?>
                                        <?php 
                $sTitle = $work['name'];
                ?>
										<h3><a href="/users/<?php 
                echo $work['user_login'];
                ?>
/viewproj.php?prjid=<?php 
                echo $work['portfolio_id'];
                ?>
"><?php 
                echo reformat2($sTitle, 40, 0, 1);
                ?>
</a>&nbsp;</h3>
                                        <?php 
                $is_preview = $work['pict'] || $work['prev_pict'];
                if ($is_preview && $work['prev_type'] != 1) {
                    echo view_preview($work['user_login'], $work['prev_pict'], "upload", $align, true, true, '', 200) . "<br/><br/>";
                }
                close_tags($work['descr'], array('b', 'i'));
                $sDescr = $work['descr'];
                ?>
										<p><?php 
                echo reformat($sDescr, 80, 0, 0, 1);
                ?>
</p>



									</div>
									<ul class="lo-i">
                                        <?php 
                $post_year = dateFormat('Y', $work['post_time']);
                ?>
										<li class="lo-i-c"><a href="/freelancers/?prof=<?php 
                echo $work['prof_id'];
                ?>
"><?php 
                echo $work['prof_name'];
                ?>
</a></li>
										<li><?php 
                echo $post_year > 2000 ? dateFormat("d.m.Y H:i", $work['post_time']) : '';
                ?>
</li>
									</ul>
								</div>
                                <br>
                            <?php 
                break;
            case '4':
                // Блоги
                $item['thread_id'] = $item['theme_id'];
                $item['answers'] = $DB->rows("SELECT * FROM blogs_poll_answers WHERE thread_id IN (?l) ORDER BY id", array($item['thread_id']));
                $GLOBALS[LINK_INSTANCE_NAME] = new links('blogs');
                $user_id = $uid;
                ?>
								<div class="lo lo-m" id='idBlog_<?php 
                echo $item['thread_id'];
                ?>
' style='margin-bottom:0px !important;'>
									<ul class="lo-p">
										<li class="lo-s">
											<div class="b-layout_bordrad_3">
												<a href="/blogs" class="lnk-dot-666">Блоги</a>
											</div>
										</li>
										<li class="post-f-fav">
                                            <?php 
                $msg_id = $item['theme_id'];
                ?>
                                            <?php 
                if ($favs['BL' . $msg_id]) {
                    ?>
 
                                                <img src="/images/bookmarks/<?php 
                    echo $stars[$favs['BL' . $msg_id]['priority']];
                    ?>
" alt="" on="<?php 
                    echo $is_fav ? 1 : 0;
                    ?>
" id="favstar<?php 
                    echo 'BL' . $msg_id;
                    ?>
" <?php 
                    if ($uid) {
                        ?>
onclick="ShowFavFloatLenta(<?php 
                        echo $msg_id;
                        ?>
, <?php 
                        echo $uid;
                        ?>
, 'BL')" ><?php 
                    }
                    ?>
                                            <?php 
                } else {
                    ?>
                                                <img src="/images/bookmarks/bsw.png" alt="" on="<?php 
                    echo $is_fav ? 1 : 0;
                    ?>
" id="favstar<?php 
                    echo 'BL' . $msg_id;
                    ?>
" <?php 
                    if ($uid) {
                        ?>
onclick="ShowFavFloatLenta(<?php 
                        echo $msg_id;
                        ?>
, <?php 
                        echo $uid;
                        ?>
, 'BL')" ><?php 
                    }
                    ?>
                                            <?php 
                }
                ?>
                                            <ul class="post-f-fav-sel" style="display:none;" id="FavFloat<?php 
                echo $msg_id;
                ?>
"></ul>
										</li>
									</ul>
									<div class="utxt">
                                        <?php 
                print __LentaPrntUsrInfo($item, 'user_', '', '', false, true);
                ?>
                                        <?php 
                $sTitle = $item['title'];
                ?>
                                        <?php 
                $sMessage = $item['msgtext'];
                ?>
										<h3><a href="<?php 
                echo getFriendlyURL("blog", $item['theme_id']);
                ?>
"><?php 
                echo reformat2($sTitle, 30, 0, 1);
                ?>
</a>&nbsp;</h3>
										<p><?php 
                echo reformat($sMessage, 46, 1, -($item['is_chuck'] == 't'), 1);
                ?>
</p>

                                        <!-- Questions -->
			<?php 
                if ($item['question'] != '') {
                    ?>
			<div id="poll-<?php 
                    echo $item['thread_id'];
                    ?>
" class="poll">
				<div class="commune-poll-theme"><?php 
                    echo reformat($item['question'], 43, 0, 1);
                    ?>
</div>
				<div id="poll-answers-<?php 
                    echo $item['thread_id'];
                    ?>
">
				<?php 
                    if ($item['poll_multiple'] != 't') {
                        ?>
<div class="b-radio b-radio_layout_vertical"><?php 
                    }
                    ?>
				<?php 
                    if ($item['poll_closed'] == 't') {
                        ?>
<table class="b-layout__table b-layout__table_width_full"><?php 
                    }
                    ?>
				<?php 
                    $i = 0;
                    $max = 0;
                    if ($item['poll_closed'] == 't') {
                        foreach ($item['answers'] as $answer) {
                            $max = max($max, $answer['votes']);
                        }
                    }
                    foreach ($item['answers'] as $answer) {
                        ?>
				
				<?php 
                        if ($item['poll_closed'] == 't') {
                            ?>
                    <tr class="b-layout__tr">
                      <td class="b-layout__left b-layout__left_width_50"><label class="b-layout__txt" for="poll_<?php 
                            echo $i;
                            ?>
"><?php 
                            echo reformat($answer['answer'], 30, 0, 1);
                            ?>
</label></td>
                      <td class="b-layout__middle b-layout__middle_width_30 b-layout__middle_center"><?php 
                            echo $answer['votes'];
                            ?>
</td>
                      <td class=" b-layout__right "><div class=" res-line rl1" style="width: <?php 
                            echo $max ? round(100 * $answer['votes'] / $max * 3) : 0;
                            ?>
px;"></div></td>
                    </tr>
				<?php 
                        } else {
                            ?>
					<?php 
                            if ($item['poll_votes'] || !$user_id) {
                                ?>
						<div class="bp-gres"><?php 
                                echo $answer['votes'];
                                ?>
</div>
					<?php 
                            } else {
                                ?>
						
						<?php 
                                if ($item['poll_multiple'] == 't') {
                                    ?>
                        	<div class="b-check b-check_padbot_10">
								<input id="poll-<?php 
                                    echo $item['thread_id'];
                                    ?>
_<?php 
                                    echo $i;
                                    ?>
" class="b-check__input" type="checkbox" name="poll_vote[]" value="<?php 
                                    echo $answer['id'];
                                    ?>
" />
                                <label class="b-check__label b-check__label_fontsize_13" for="poll-<?php 
                                    echo $item['thread_id'];
                                    ?>
_<?php 
                                    echo $i++;
                                    ?>
"><?php 
                                    echo reformat($answer['answer'], 30, 0, 1);
                                    ?>
</label>
                            </div>
						<?php 
                                } else {
                                    ?>
                        	<div class="b-radio__item  b-radio__item_padbot_5">
                            	<table class="b-layout__table b-layout__table_width_full" cellpadding="0" cellspacing="0" border="0">
                                	<tr class="b-layout__tr">
                                    	<td class="b-layout__left b-layout__left_width_15"><input id="poll-<?php 
                                    echo $item['thread_id'];
                                    ?>
_<?php 
                                    echo $i;
                                    ?>
" class="b-radio__input b-radio__input_top_-3" type="radio" name="poll_vote" value="<?php 
                                    echo $answer['id'];
                                    ?>
" /></td>
                                        <td class="b-layout__right"><label class="b-radio__label b-radio__label_fontsize_13" for="poll-<?php 
                                    echo $item['thread_id'];
                                    ?>
_<?php 
                                    echo $i++;
                                    ?>
"><?php 
                                    echo reformat($answer['answer'], 30, 0, 1);
                                    ?>
</label></td>
                                    </tr>
                                </table>
                            </div>
						<?php 
                                }
                                ?>
					<?php 
                            }
                            ?>
					
				<?php 
                        }
                        ?>
				
				<?php 
                    }
                    ?>
				<?php 
                    if ($item['poll_closed'] == 't') {
                        ?>
</table><?php 
                    }
                    ?>
				<?php 
                    if ($item['poll_multiple'] != 't') {
                        ?>
</div><?php 
                    }
                    ?>
				</div>
				<?php 
                    if (!$item['poll_votes'] && $user_id && $item['poll_closed'] != 't') {
                        ?>
                <div class="b-buttons b-buttons_inline-block">
                    <span id="poll-btn-vote-<?php 
                        echo $item['thread_id'];
                        ?>
">
                        <a class="b-button b-button_flat b-button_flat_grey" href="javascript: return false;"  onclick="poll.vote('Blogs', <?php 
                        echo $item['thread_id'];
                        ?>
); return false;">Ответить</a>                
                        &nbsp;&nbsp;&nbsp;
                    </span>                
                    <span id="poll-btn-result-<?php 
                        echo $item['thread_id'];
                        ?>
"><a class="b-buttons__link b-buttons__link_dot_0f71c8" href="javascript: return false;" onclick="poll.showResult('Blogs', <?php 
                        echo $item['thread_id'];
                        ?>
); return false;">Посмотреть результаты</a>&nbsp;&nbsp;&nbsp;</span>
                </div>
				<?php 
                    } else {
                        ?>
				<span id="poll-btn-vote-<?php 
                        echo $item['thread_id'];
                        ?>
"></span>
				<span id="poll-btn-result-<?php 
                        echo $item['thread_id'];
                        ?>
"></span>
				<?php 
                    }
                    ?>
			</div>
            <br/>
			<?php 
                }
                ?>
                                        <!-- /Questions -->

                                        <!-- Youtube -->
<?php 
                if ($item['yt_link']) {
                    $tmp_yt_id = $item['id'] . 'ytlink' . rand(1, 1000000);
                    $tmp_yt_data = show_video($item['id'], $item['yt_link']);
                    array_push($yt_replace_id, '/' . $tmp_yt_id . '/');
                    array_push($yt_replace_data, $tmp_yt_data);
                    echo "<div style='padding-top: 20px'>" . $tmp_yt_id . "</div><br/>";
                }
                //            =(($item['yt_link'])? ("<div style='padding-top: 20px'>".show_video($item['id'], $item['yt_link'])."</div>"):"")
                ?>
                                        <!-- /Youtube -->

                                        <!-- Attach -->
<?php 
                if ($item['attach']) {
                    $attach = $item['attach'][0];
                    if ($attach['fname']) {
                        $att_ext = strtolower(CFile::getext($attach['fname']));
                        if ($att_ext == "swf") {
                            print "<br/>" . viewattachExternal($item['user_login'], $attach['fname'], "upload", "/blogs/view_attach.php?user="******"&attach=" . $attach['fname']) . "<br/>";
                        } elseif ($att_ext == 'flv') {
                            print "<br/>" . viewattachLeft($item['user_login'], $attach['fname'], "upload", $file, 1000, 470, 307200, true, $attach['small'] == 2 ? 1 : 0) . "<br/>";
                        } else {
                            print "<br/>" . viewattachLeft($item['user_login'], $attach['fname'], "upload", $file, 1000, 470, 307200, !$attach['small'], $attach['small'] == 2 ? 1 : 0) . "<br/>";
                        }
                    }
                    echo '<br/>';
                    if (sizeof($item['attach']) > 1) {
                        echo "<a href=\"" . getFriendlyURL("blog", $item['theme_id']) . "\"><b>" . blogs::ShowMoreAttaches(sizeof($item['attach'])) . "</b></a><br/><br/>";
                    }
                }
                ?>

                                        <!-- /Attach -->
									</div>
									<ul class="lo-i">
                                        <?php 
                $post_year = dateFormat('Y', $item['post_time']);
                ?>
                                        <li class="lo-i-cm">
                                            <a href="<?php 
                echo getFriendlyURL("blog", $item['theme_id']);
                ?>
" <?php 
                echo $item['current_count'] == NULL && intval($item['count_comments']) != 0 ? 'style="font-weight:bold;"' : '';
                ?>
><?php 
                echo $item['closed_comments'] == 't' ? "Комментирование закрыто" : "Комментарии (" . intval($item['count_comments']) . ")";
                ?>
</a>
                                            <?php 
                if (isset($item['status_comments']) && $item['count_comments'] > 0 && $item['status_comments'] < $item['count_comments'] && $item['status_comments'] != -100 && $item['closed_comments'] == 'f') {
                    $new_comments_num = $item['count_comments'] - $item['status_comments'];
                    ?>
                                              <a href="<?php 
                    echo getFriendlyURL("blog", $item['theme_id']);
                    ?>
#unread" style="color:#6BA813; font-weight:bold;">(<?php 
                    echo $new_comments_num;
                    ?>
 <?php 
                    echo $new_comments_num == 1 ? "новый" : "новых";
                    ?>
)</a>
                                              <?php 
                } else {
                    if (isset($item['status_comments']) && $item['count_comments'] > 0 && $item['status_comments'] < $item['count_comments'] && $item['status_comments'] == -100 && $item['closed_comments'] == 'f') {
                        $new_comments_num = $item['count_comments'];
                        ?>
                                              <a href="<?php 
                        echo getFriendlyURL("blog", $item['theme_id']);
                        ?>
#unread" style="color:#6BA813; font-weight:bold;">(<?php 
                        echo $new_comments_num;
                        ?>
 <?php 
                        echo $new_comments_num == 1 ? "новый" : "новых";
                        ?>
)</a>
                                              <?php 
                    }
                }
                ?>
                                        </li>
										<li class="lo-i-c"><a href="<?php 
                echo getFriendlyURL("blog_group", $item['commune_group_id']);
                ?>
"><?php 
                echo $item['commune_group_name'];
                ?>
</a></li>
										<li><?php 
                echo $post_year > 2000 ? dateFormat("d.m.Y H:i", $item['post_time']) : '';
                ?>
</li>
									</ul>
								</div>
                                <br>
                                    <?php 
                break;
        }
        $i++;
    }
    ?>

                    <?php 
    //                      $allThemesCount = lenta::GetLentaThemesCount($cms);
    ?>


<br/>
                        <?php 
    // Страницы
    $count = 4;
    $pages = ceil(($allWorkCount + $allThemesCount) / lenta::MAX_ON_PAGE);
    $html = '<div class="b-pager" >';
    if (is_array($count)) {
        list($scount, $ecount) = $count;
    } else {
        $scount = $ecount = $count;
    }
    if ($pages > 1) {
        $start = $page - $scount;
        if ($start < 1) {
            $start = 1;
        }
        $end = $page + $ecount;
        if ($end > $pages) {
            $end = $pages;
        }
        $html .= '<ul class="b-pager__back-next">';
        if ($page < $pages) {
            $html .= "<input type=\"hidden\" id=\"next_navigation_link1\" value=\"" . ($page + 1) . "\">";
            $html .= '<li class="b-pager__next" id="nav_next_not_active1"><a class="b-pager__link" href="javascript:void(0)" onClick="document.location.href=\'#lentatop\'; spiner.show(); xajax_Lenta_Show(' . ($page + 1) . '); return false;" id="PrevLink"></a>&nbsp;&nbsp;</li>';
        }
        if ($page > 1) {
            $html .= "<input type=\"hidden\" id=\"pre_navigation_link1\" value=\"" . ($page - 1) . "\">";
            $html .= '<li class="b-pager__back">&nbsp;&nbsp;<a id="NextLink" class="b-pager__link" href="javascript:void(0)" onClick="document.location.href=\'#lentatop\'; spiner.show(); xajax_Lenta_Show(' . ($page - 1) . '); return false;"></a></li>';
        }
        $html .= '</ul>';
        $html .= '<ul class="b-pager__list">';
        for ($i = $start; $i <= $end; $i++) {
            if ($i == $start && $start > 1) {
                $html .= '<li class="b-pager__item"><a class="b-pager__link" href="javascript:void(0)" onClick="document.location.href=\'#lentatop\'; spiner.show(); xajax_Lenta_Show(1); return false;">1</a></li>';
                if ($i == 3) {
                    $html .= '<li class="b-pager__item"><a class="b-pager__link" href="javascript:void(0)" onClick="document.location.href=\'#lentatop\'; spiner.show(); xajax_Lenta_Show(2); return false;">2</a></li>';
                } elseif ($i != 2) {
                    $html .= "<li class='b-pager__item'>&hellip;</li>";
                }
            }
            $html .= $page == $i ? '<li class="b-pager__item b-pager__item_active"><span class="b-pager__b1"><span class="b-pager__b2">' . $i . '</span></span></li>' : '<li class="b-pager__item"><a class="b-pager__link" href="javascript:void(0)" onClick="document.location.href=\'#lentatop\'; spiner.show(); xajax_Lenta_Show(' . $i . '); return false;">' . $i . '</a></li>';
            if ($i == $end && $pages - 1 > $end) {
                $html .= '<li class="b-pager__item">&hellip;</li>';
            }
        }
        $html .= '</ul>';
    }
    echo $html . '</div>';
    // Страницы закончились
    ?>
    	                  
          
<?php 
    $content = ob_get_contents();
    ob_end_clean();
    $content_js = '';
    if ($yt_replace_data) {
        foreach ($yt_replace_data as $key => $value) {
            $yt_replace_data[$key] = preg_replace("/^(.*)<script.*\$/sm", "\$1", $value);
            $content_js .= preg_replace("/^(.*<script type='text\\/javascript'>)(.*)(<\\/script>)\$/sm", "\$2", $value);
        }
        $content = preg_replace($yt_replace_id, $yt_replace_data, $content);
        $objResponse->script($content_js);
    }
    $objResponse->assign('lenta-cnt', 'innerHTML', $content);
    $objResponse->script($content_js);
    $objResponse->script('spiner.hide();');
    $objResponse->script('$$("#lenta_cats_checkboxes input[type=checkbox]").each(function(el) { el.set("disabled", false); });');
    $objResponse->script('fix_banner();');
    return $objResponse;
}
Exemplo n.º 2
0
    }
    ?>

                    <?php 
    global $foto_alt;
    ?>
                    <?php 
    if ($data['attach']) {
        ?>
                        <?php 
        if (isset($data['attach']['id'])) {
            $data['attach'] = array($data['attach']);
        }
        foreach ($data['attach'] as $attach) {
            $maxwidth = $this->_options['maxwidth'] ? $this->_options['maxwidth'] - $data['level'] * $this->_options['minus_level_width'] : 600;
            echo '<div class = "flw_offer_attach b-page__desktop b-page__ipad">', viewattachLeft(null, $attach['fname'], $attach['path'], $file, 1000, $maxwidth, 307200, 0, $attach['small'] == 't' || $attach['small'] === null ? 1 : 0, 0, 0, "{$foto_alt} фото {$attach['fname']}"), '</div>';
            echo '<div class = "b-page__iphone"><a class="b-layout__link" target="_blank" href="', WDCPREFIX, '/', $attach['path'], $attach['fname'], '">', $attach['fname'], '</a></div>';
        }
        ?>
                    <?php 
    }
    ?>
                    <?php 
} elseif ($data['is_permission']) {
    ?>
                    <span class="b-post__txt b-post__txt_color_c10601">Удалено:</span> <?php 
    echo $sMsgText;
    ?>
                        <?php 
    if (get_uid(false) != $data['author']) {
        ?>
Exemplo n.º 3
0
          echo 'Нет прикрепленных файлов';
      }
      ?>
  	</td>
 	</tr>
 	    <?php 
      if (is_array($project_history['attach'])) {
          ?>
 	<tr>
      <td class="cell-number">&nbsp;</td>
  	<td class="cell-body">
          <strong>Первоначальная версия:</strong><br/><br/>
          <?php 
          $nn = 1;
          foreach ($project_history['attach'] as $attach) {
              $str = viewattachLeft(null, $attach['name'], $attach['path'], $file, 0, 0, 0, 0, 0, 0, $nn);
              echo '<div class="flw_offer_attach" style="padding:0;">', $str, '</div>';
              ++$nn;
          }
          ?>
  	</td>
  </tr>
 	    <?php 
      }
      ?>
 	<?php 
  }
  ?>
 	<tr>
  	<td class="cell-number">Действие:</td>
  	<td class="<?php 
Exemplo n.º 4
0
</p>
            
            <?php 
        // прикрепленные файлы ------------------
        if ($aOne['files']) {
            $nn = 1;
            ?>
		    <div class="filesize1">
                <div class="attachments attachments-p">
    		    <?php 
            foreach ($aOne['files'] as $attach) {
                $att_ext = CFile::getext($attach['fname']);
                $aData = getAttachDisplayData($aOne['spamer_login'], $attach['fname'], 'contacts', 1000, 600, 307200, 0);
                if ($aData && $aData['success']) {
                    if ($aData['file_mode'] || $aData['virus_flag'] || $att_ext == "swf") {
                        $str = viewattachLeft($aOne['spamer_login'], $attach['fname'], 'contacts', $file, 0, 0, 0, 0, 0, 0, $nn);
                        echo '<div class = "flw_offer_attach">', $str, '</div>';
                    } else {
                        echo "<div class = \"flw_offer_attach\"><div style=\"float: left; margin-right:7px;\">{$nn}.</div><img src=\"" . WDCPREFIX . '/users/' . $aOne['spamer_login'] . '/contacts/' . $aData['file_name'] . "\" alt=\"{$aData['file_name']}\" title=\"{$aData['file_name']}\" width=\"{$aData['img_width']}\" height=\"{$aData['img_height']}\" /></div>";
                    }
                }
                $nn++;
            }
            ?>
                </div>
			</div>
			<?php 
        }
        //----------------------------------
        ?>
            
Exemplo n.º 5
0
                                    <h1 class="b-page__title"><?php 
    echo reformat($project_history['name'], 30, 0, 1);
    ?>
</h1>
                                    <div class="prj_text">
                                        <?php 
    echo reformat($project_history['descr'], 70, 0, 0, 1);
    ?>
                                    </div>
                                    <?php 
    if (isset($project_history['attach']) && is_array($project_history['attach'])) {
        ?>
<br/><div class="attachments attachments-p"><?php 
        $nn = 1;
        foreach ($project_history['attach'] as $attach) {
            $str = viewattachLeft(NULL, $attach["name"], $attach['path'], $file, 0, 0, 0, 0, 0, 0, $nn);
            echo '<div class = "b-layout__txt b-layout__txt_padbot_5">', $str, '</div>';
            $nn++;
        }
        ?>
</div><?php 
    }
    ?>
  
                                    <div class="std prjh_section">
                                        <table border="0" width="100%">
                                        <tr valign="top">
                                        <td align="left">
                                        <?php 
    if ($project_history['pro_only'] == 't') {
        ?>
Exemplo n.º 6
0
 <?php 
     }
     ?>
 <?php 
     if ($theme['attach']) {
         $attach = $theme['attach'][0];
         if ($attach['fname']) {
             $att_ext = strtolower(CFile::getext($attach['fname']));
             /*if ($att_ext == "swf") {
                   print("<br />".viewattachExternal($theme['login'], $attach['fname'], "upload", "/blogs/view_attach.php?user="******"&attach=".$attach['fname'])."<br />");
               } elseif($att_ext == 'flv') {
                   print("<br />".viewattachLeft($theme['login'], $attach['fname'], "upload", $file, 1000, 470, 307200, false, (($attach['small']==2)?1:0))."<br />");
               } else {
                   print('<div class="flw_offer_attach">'.viewattachLeft($theme['login'], $attach['fname'], "upload", $file, 1000, 470, 307200, false, (($attach['small']==2)?1:0))."</div>");
               }*/
             print '<div class="flw_offer_attach">' . viewattachLeft($theme['login'], $attach['fname'], "upload", $file, blogs::MAX_IMAGE_HEIGHT, blogs::MAX_IMAGE_WIDTH, 307200, false, $attach['small'] == 2 ? 1 : 0, 1, 0, $theme['title']) . "</div>";
         }
         if (sizeof($theme['attach']) > 1) {
             echo "<br /><a href=\"" . getFriendlyURL("blog", $theme['thread_id']) . "\"><b>" . $blog->ShowMoreAttaches(sizeof($theme['attach'])) . "</b></a>";
         }
     }
     ?>
 <?php 
     echo seo_end();
     ?>
 <?php 
     if ($theme['yt_link']) {
         // Не понял зачем это надо, всеравно ничего здесь не выводится
         show_video($theme['id'], $theme['yt_link']);
     }
     if ($ord == 'relevant') {
Exemplo n.º 7
0
function openlevel($thread, $mod, $begin, $end, $thispage, $blog_thread, $lastlink, $ord)
{
    require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/blogs.php";
    global $session;
    session_start();
    $uid = $_SESSION['uid'];
    $objResponse = new xajaxResponse();
    $blog = new blogs();
    $ret = '';
    $cur_user_msgs = array();
    list($gr_name, $gr_id, $gr_base) = $blog->GetThread($thread, $err, $mod, get_uid(false));
    $blog->GetThreeId($begin, $threearr, 0);
    $parent_login = $blog->login;
    while ($blog->GetNext()) {
        $stopwrite = true;
        foreach ($threearr as $temp) {
            if ($blog->id == $temp) {
                $stopwrite = false;
                break;
            }
        }
        if ($stopwrite) {
            continue;
        }
        $msg_num++;
        $allow_del = 0;
        if ($last_id == $blog->id) {
            print "<a name=\"post\" id=\"post\"></a>";
        }
        if ($blog->id == $edit_id && $blog->login == $_SESSION['login']) {
            print "<a name=\"edit\" id=\"edit\"></a>";
        }
        if ($blog->attach) {
            $str = viewattachLeft($blog->login, $blog->attach, "upload", $file, 1000, 600, 307200, !$blog->small, $blog->small == 2 ? 1 : 0);
        }
        $padding = $blog->level > 19 ? 380 : $blog->level * 20;
        if (in_array($blog->reply, $cur_user_msgs)) {
            $allow_del = 1;
        }
        if ($blog->login == $_SESSION['login']) {
            $cur_user_msgs[] = $blog->id;
        }
        $ret .= '<table width="100%" border="0" cellspacing="0" cellpadding="0">
		<tr valign="top" ';
        $ret .= '><td style="';
        if ($blog->level) {
            $ret .= 'padding-left: ' . $padding . 'px;';
        }
        $ret .= 'padding-right: 10px;">' . view_avatar($blog->login, $blog->photo) . '
			</td>
			<td class="bl_text" width="100%">';
        if ($winner == $blog->id) {
            $ret .= '<a name="winner" id="winner"></a> ';
        }
        if ($blog->payed) {
            $ret .= view_pro();
        }
        $ret .= $session->view_online_status($blog->login);
        $ret .= '<font class="' . $blog->cnt_role . 'name11"><a href="/users/' . $blog->login . '" class="' . $blog->cnt_role . 'name11" title="' . ($blog->uname . " " . $blog->usurname) . '">' . ($blog->uname . " " . $blog->usurname) . '</a> [<a href="/users/' . $blog->login . '" class="' . $blog->cnt_role . 'name11" title="' . $blog->login . '">' . $blog->login . '</a>]</font>&nbsp;&nbsp;' . date("[d.m.Y | H:i]", strtotimeEx($blog->post_time));
        if ($blog->deleted) {
            if (isset($blog->thread) && is_array($blog->thread) && count($blog->thread) > 0) {
                $buser_id = $blog->thread;
                $buser_id = array_pop($buser_id);
                $buser_id = $buser_id['fromuser_id'];
            }
            if ($blog->deluser_id == $blog->fromuser_id) {
                $ret .= '<br><br>Комментарий удален автором ' . date("[d.m.Y | H:i]", strtotimeEx($blog->deleted));
            } elseif ($blog->deluser_id == $buser_id) {
                $ret .= '<br><br>Комментарий удален автором темы ' . date("[d.m.Y | H:i]", strtotimeEx($blog->deleted));
            } else {
                $ret .= '<br><br>Комментарий удален модератором';
                if (!$mod) {
                    $ret .= '( ';
                    $del_user = $user->GetName($blog->deluser_id, $err);
                    $ret .= $del_user['login'] . ' : ' . $del_user['usurname'] . ' ' . $del_user['uname'];
                    $ret .= ' ) ';
                }
                $ret .= date("[d.m.Y | H:i]", strtotimeEx($blog->deleted));
            }
            $ret .= '<br><br>';
        } else {
            if ($blog->modified) {
                $ret .= '&nbsp; &nbsp;';
                if ($blog->modified_id == $blog->fromuser_id) {
                    $ret .= '[внесены изменения: ' . date("d.m.Y | H:i]", strtotimeEx($blog->modified));
                } else {
                    $ret .= 'Отредактировано модератором';
                    if (!$mod) {
                        $ret .= '( ';
                        $mod_user = $user->GetName($blog->modified_id, $err);
                        $ret .= $mod_user['login'] . ' : ' . $mod_user['usurname'] . ' ' . $mod_user['uname'];
                        $ret .= ' ) ';
                    }
                    $ret .= ' ' . date("[d.m.Y | H:i]", strtotimeEx($blog->modified));
                }
            }
            $ret .= '<br>';
            if ($winner == $blog->id) {
                $ret .= '<font color="#000099" style="font-size:20px">Победитель</font>';
            }
            $ret .= '<br>';
            if ($blog->new == 't') {
                $ret .= '<img src="/images/ico_new_blog.gif" alt="" width="44" height="12" border="0"><br>';
            }
            if ($blog->title) {
                $ret .= ' <font class="bl_name">';
                if ($blog->login == "Anonymous") {
                    list($name, $mail) = sscanf($blog->title, "%s @@@: %s");
                    $ret .= $name . " " . $mail;
                } else {
                    $ret .= reformat($blog->title, 30);
                }
                $ret .= '</font><br>';
            }
            $ret .= reformat($blog->msgtext, 50) . '<br>';
            if ($blog->attach) {
                if ($file) {
                    $ret .= "<br>" . $str . "<br>";
                } else {
                    $ret .= "</td></tr><tr class=\"qpr\"><td colspan=\"2\"><br>" . $str;
                }
            }
            $ret .= '<br>';
            if ($gr_base == 5 && !$winner && $parent_login == $_SESSION['login']) {
                $ret .= "<input type=\"submit\" name=\"btn\" value=\"Это победитель\" onClick=\"if (warning(0)) window.location.replace('./view.php?tr=" . $thread . "&ord='.{$ord}.'&winner=" . $blog->id . "'); else return false;\">";
            }
            $ret .= '<div style="color: #D75A29;font-size:9px;';
            if ($blog->attach && !$file) {
                $ret .= ' padding-left: ' . ($padding + 60) . 'px;';
            }
            $ret .= '">';
            if ($blog->login == $_SESSION['login'] || $parent_login == $_SESSION['login'] || $allow_del || !$mod) {
                $ret .= ' <a href="' . $form_uri . '?id=' . $blog->id . '&amp;action=delete&ord=' . $ord . '" style="color: #D75A29;" onclick="return warning(1);">Удалить</a> |';
            }
            if ($blog->login == $_SESSION['login'] || !$mod) {
                $ret .= '<a href="' . $form_uri . '?id=' . $blog->id . '&amp;action=edit&ord=' . $ord . '&amp;tr=' . $thread . '" style="color: #D75A29;">Редактировать</a> |';
            }
            $ret .= "<a href=\"javascript: void(0);\" onclick=\"javascript: answer('" . $blog->id . "', '" . ($blog->attach ? $blog->attach : '') . "', '" . get_login($_SESSION["uid"]) . "'); document.getElementById('frm').olduser.value = '" . $_SESSION["uid"] . "'; \" ";
            $ret .= 'style="color: #D75A29">Комментировать</a> |
  			<a href="/blogs/view.php' . "?tr=" . $blog_thread . ($thispage ? "&pagefrom=" . $thispage : "") . "&openlevel=" . $blog->id . "&ord=" . $ord . "#o" . $blog->id . '" style="color: #D75A29">Ссылка</a> 
  			</div>
						</td>
		</tr>
		<tr';
            if (!$blog->level || $lastlink == $blog->id) {
                $ret .= ' class="qpr"';
            }
            $ret .= '><td colspan="2" ><br></td></tr>
		</table>
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
		<tr class="n_qpr"><td colspan="3" id="form' . $blog->id . '">';
            if ($blog->id == $edit_id && ($blog->login == $_SESSION['login'] || !$mod)) {
                $ret .= "\n\t\t\t<script language=\"JavaScript\" type=\"text/javascript\">\n\t\t\t<!--\n\t\t\tanswer(" . $blog->id . ", '" . ($blog->attach ? $blog->attach : '') . "', '" . get_login($_SESSION["uid"]) . "');\n\t\t\tdocument.getElementById('frm').olduser.value = '" . $_SESSION["uid"] . "';\n\t\t\tdocument.getElementById('frm').msg_name.value = '" . $error_flag ? input_ref_scr($msg_name) : input_ref_scr($blog->title) . "';\n\t\t\tdocument.getElementById('frm').msg.value = '" . $error_flag ? input_ref_scr($msg) : input_ref_scr($blog->msgtext) . "';\n\t\t\tdocument.getElementById('frm').btn.value = 'Сохранить';\n\t\t\tdocument.getElementById('frm').action.value = 'change';\n\t\t\t//-->\n\t\t\t</script>";
            }
        }
        $ret .= "</td></tr>\n\t\t</table>";
    }
    $objResponse->assign($begin, "innerHTML", $ret);
    return $objResponse;
}
Exemplo n.º 8
0
/**
 * Возвращает диалог при чтении переписки в заблокированных личных сообщениях
 * 
 * @param  int $nFromId uid отправиля (то есть одного)
 * @param  int $nToId uid получателя (то есть другого)
 * @param  int $nCurpage номер страницы
 * @return object xajaxResponse
 */
function getBlockedLetters($nFromId = 0, $nToId = 0, $nCurpage = 1)
{
    global $user_content, $stop_words;
    $objResponse = new xajaxResponse();
    $objResponse->script('user_content.spinner.hide(true);');
    if (hasPermissions('users')) {
        require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/users.php';
        $aDialog = array();
        $nDialog = 0;
        $sDialog = '';
        $oFromUser = new users();
        $oFromUser->GetUserByUID($nFromId);
        $oToUser = new users();
        $oToUser->GetUserByUID($nToId);
        if ($oFromUser->login && $oToUser->login) {
            require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/messages.php';
            $oMsgs = new messages();
            $aDialog = $oMsgs->GetMessagesForModers($nFromId, $oToUser->login, $nCurpage, 20);
            if ($aDialog) {
                foreach ($aDialog as $aOne) {
                    $sClass = $aOne['from_id'] == $nFromId ? 'b-post__txt_color_a7a7a6' : '';
                    $sLogin = $aOne['from_id'] == $nFromId ? $oFromUser->login : $oToUser->login;
                    $sName = $aOne['from_id'] == $nFromId ? $oFromUser->uname : $oToUser->uname;
                    $sSurname = $aOne['from_id'] == $nFromId ? $oFromUser->usurname : $oToUser->usurname;
                    $sIsChuck = $aOne['from_id'] == $nFromId ? $oFromUser->is_chuck : $oToUser->is_chuck;
                    $sAttach = '';
                    $sAction = $aOne['deleted'] ? 'user_content.updateLetter(' . $aOne['id'] . ', ' . $aOne['from_id'] . ', 1)' : 'parent.banned.delReason(\'1_' . $aOne['id'] . '_0\', ' . $aOne['from_id'] . ', \'updateLetter\', {})';
                    $sIcon = $aOne['deleted'] ? 'ok' : 'del';
                    if ($aOne['files']) {
                        $nn = 1;
                        foreach ($aOne['files'] as $attach) {
                            $str = viewattachLeft($sLogin, $attach["fname"], 'contacts', $file, 0, 0, 0, 0, 0, 0, $nn);
                            $sAttach .= '<div class = "flw_offer_attach">' . $str . '</div>';
                            $nn++;
                        }
                        $sAttach = '<div class="b-icon-layout b-icon-layout_padtop_5">' . $sAttach . '</div>';
                    }
                    $msg_text = $stop_words->replace($aOne['msg_text']);
                    $msg_text = reformat($msg_text, 50, 0, -($sIsChuck == 't'), 1);
                    $sDeleted = $aOne['deleted'] ? ' [Сообщение удалено модератором]' : '';
                    $sDialog .= '
<div class="b-post b-post_bordtop_dfe3e4 b-post_padtop_15 b-post_marg_20_10" id="my_div_content_' . $aOne['id'] . '">
    <span id="my_action_' . $aOne['id'] . '" class="b-button_float_right">
    ' . ($aOne['moderator_status'] !== '0' ? '<a onclick="' . $sAction . '" class="b-button b-button_float_right b-button_mini" href="javascript:void(0);"><span class="b-button__icon b-button__icon_' . $sIcon . '"></span></a>' : '') . '
    </span>

    <div class="b-post__txt ' . $sClass . '"><span class="b-post__txt b-post__txt_bold ' . $sClass . '">' . $sName . ' ' . $sSurname . ' [' . $sLogin . ']</span> ' . date("d.m.y в H:i", strtotimeEx($aOne['post_time'])) . '<span id="my_deleted_' . $aOne['id'] . '" style="color:red;">' . $sDeleted . '</span>:</div>
    <div class="b-post__txt ' . $sClass . '">
       ' . $msg_text . '
    </div>

    ' . $sAttach . '
</div>
';
                }
                $objResponse->append('my_div_contents', 'innerHTML', $sDialog);
                $objResponse->script("user_content.afterScroll();");
                $objResponse->script("user_content.getLettersPage++;");
            }
        }
        $objResponse->script('$("my_div_wait").destroy();');
    }
    $objResponse->script('user_content.spinner.resize();');
    return $objResponse;
}
Exemplo n.º 9
0
        if ($comment['user_is_banned'] || $comment['member_is_banned']) {
            print '<font color="#000000"><b>Пользователь забанен' . (!$top['user_is_banned'] ? ' в сообществе' : '') . '.</b></font><br/><br/>';
        }
        if ($comment['title']) {
            print '<font class="bl_name">' . reformat2($comment['title'], 25, 0, 1) . '</font><br>';
        }
        print reformat2($comment['msgtext'], 82 - round((($level > 19 ? 19 : $level) - 1) * 1.9), 0, -($comment['user_is_chuck'] == 't'), 1) . '<br/>';
        if ($comment['youtube_link']) {
            print show_video($comment['id'], $comment['youtube_link']);
        }
        if ($comment['attach']) {
            //$commune['attach'] = array_reverse($commune['attach']);
            foreach ($comment['attach'] as $attach) {
                $att_ext = CFile::getext($attach['fname']);
                $str = '';
                $str = viewattachLeft($comment['user_login'], $attach['fname'], 'upload', $file, commune::MSG_IMAGE_MAX_HEIGHT, commune::_MSG_IMAGE_MAX_WIDTH, commune::MSG_IMAGE_MAX_SIZE, !($attach['small'] == 't'), (int) ($attach['small'] == 't'));
                print "<br/><br/>" . $str . "<br/>";
            }
        }
        if ($is_deleted) {
            print '</font>';
        }
        print '<br/>';
        if (!$is_deleted && !$comment['member_is_banned']) {
            ?>

                        <table width="100%" border="0" cellpadding="0" cellspacing="0">
                            <tr valign="middle" class="red-link vv">
                                <td align="left" nowrap width="100%">
            <?php 
            if (($comment['user_id'] == $user_id || $user_id == $top['user_id']) && $comment['member_is_accepted'] || $mod & (commune::MOD_ADMIN | commune::MOD_MODER | commune::MOD_COMM_ADMIN | commune::MOD_COMM_MODERATOR | commune::MOD_COMM_AUTHOR)) {
Exemplo n.º 10
0
    echo $ps['id'];
    ?>
" style="padding-top:5px">
          <?php 
    $msg_text = !$om && $ps['user_is_pro'] != 't' ? $stop_words->replace($ps['msgtext']) : $ps['msgtext'];
    ?>
          <?php 
    echo reformat($msg_text, 30, 0, 0, 1);
    ?>
        </div>
		<div style="margin-top: 10px">
		<?php 
    if (!empty($ps['files'])) {
        $fl = '<div class="attachments attachments-p">';
        foreach ($ps['files'] as $file) {
            $fl .= '<div class = "flw_offer_attach">' . viewattachLeft(null, $file['fname'], $file['path'], $file, 0, 0, 0, 0, 0, 0, $nn) . '</div>';
        }
        $fl .= '</div>';
        echo '<b>Файлы:</b></br>' . $fl;
    }
    ?>
		</div>
      </td>
    </tr>
    <tr valign="top">
      <td>&nbsp;</td>
      <td style="padding:15px 0 0 10px">
        <table border="0" cellspacing="0" cellpadding="0" width="100%">
          <tr valign="middle">
            <td  style="padding:15px 0 15px 0;width:160px;background:#f0f0f0;font-size:18px; text-align:center">
              <span>Сумма:</span>
Exemplo n.º 11
0
           } else {
               $attach_html .= '<div class="flw_offer_attach">'.viewattachLeft($blog->login, $attach['fname'], "upload", $file, 1000, 600, 307200, false, (($attach['small']==2)?1:0)).'</div>';
           }*/
         $attach_html .= '<div class="flw_offer_attach">' . viewattachLeft($blog->login, $attach['fname'], "upload", $file, 1000, 600, 307200, false, $attach['small'] == 2 ? 1 : 0, 1, 0, "{$foto_alt} фото {$attach['fname']}") . '</div>';
     }
 } else {
     if ($blog->attach) {
         $att_ext = CFile::getext($blog->attach);
         /*if ($att_ext == "swf") {
               $attach_html = viewattachExternal($blog->login, $blog->attach, "upload", "/blogs/view_attach.php?user="******"&attach=".$blog->attach);
           } elseif($att_ext == 'flv') {
               $attach_html = viewattachLeft($blog->login, $blog->attach, "upload", $file, 1000, 470, 307200, true);
           } else {
               $attach_html = '<div class="flw_offer_attach">'.viewattachLeft($blog->login, $blog->attach, "upload", $file, 1000, 600, 307200, false, (($blog->small==2)?1:0)).'</div>';
           }*/
         $attach_html = '<div class="flw_offer_attach">' . viewattachLeft($blog->login, $blog->attach, "upload", $file, 1000, 600, 307200, false, $blog->small == 2 ? 1 : 0, 1, 0, "{$foto_alt} фото {$blog->attach}") . '</div>';
     }
 }
 $padding = $blog->level > 18 ? 380 : ($blog->level + 1) * 20;
 //if (in_array($blog->reply, $cur_user_msgs)) $allow_del = 1;
 //if ($blog->login == $_SESSION['login']) $cur_user_msgs[] = $blog->id;
 if ($blog->level <= $OpenLevelFrom) {
     $OpenLevelFrom = 999;
 }
 if ($openlevel && $openlevel == $blog->id) {
     $OpenLevelFrom = $blog->level;
 }
 if (!$OpenAllLevels && $blog->level) {
     if ($blog->level < $OpenLevelFrom && $blog->level > $MinOpenLevel) {
         // закрытые треды
         if (!$blog->deleted) {
Exemplo n.º 12
0
             <br/>
             <div class="filesize1">
                       <div class="attachments attachments-p">
                   <?php 
     foreach ($frase['files'] as $attach) {
         /*
         $str =   viewattachLeft( $login, $attach['fname'], 'contacts', $file, 0, 0, 0, 0, 0, 0, $nn );
         echo '<div class = "flw_offer_attach">', $str, '</div>';
         $nn++;
         */
         $att_ext = CFile::getext($attach['fname']);
         //$str = viewattachLeft( $login, $attach['fname'], "contacts", $tmp, 1000, 600, 307200, true);
         $aData = getAttachDisplayData($login, $attach['fname'], 'contacts', 1000, 600, 307200, 0);
         if ($aData && $aData['success']) {
             if ($aData['file_mode'] || $aData['virus_flag'] || $att_ext == "swf") {
                 $str = viewattachLeft($login, $attach['fname'], 'contacts', $file, 0, 0, 0, 0, 0, 0, $nn);
                 echo '<div class = "flw_offer_attach">', $str, '</div>';
             } else {
                 echo "<div class = \"flw_offer_attach\"><div style=\"float: left; margin-right:7px;\">{$nn}.</div><img src=\"" . WDCPREFIX . '/users/' . $login . '/contacts/' . $aData['file_name'] . "\" alt=\"{$aData['file_name']}\" title=\"{$aData['file_name']}\" width=\"{$aData['img_width']}\" height=\"{$aData['img_height']}\" /></div>";
             }
         }
         $nn++;
     }
     ?>
                       </div>
                   </div>
                   <?php 
 }
 ?>
               <br /><br />
               </div>