/**
  * @see parent::initHtmlData
  */
 public function initHtmlData()
 {
     require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/blogs.php';
     $ids = $this->parseLinks();
     if ($ids) {
         $this->html_data = blogs::getBlogsByIds(array_map("intval", $ids));
     }
 }
示例#2
0
function processForm($aFormValues)
{
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/smail.php';
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/blogs.php';
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/users.php';
    global $session;
    session_start();
    get_uid(false);
    $objResponse = new xajaxResponse();
    //$pname = change_q($_POST['name'], true);
    $msg = change_q($aFormValues['calltext'], false, 0);
    //$mail = trim($_POST['mail']);
    //$attach = $_FILES['attach'];
    $login = $_SESSION['login'] ? $_SESSION['login'] : '******';
    $tn = 0;
    $f_name = '';
    $uid = get_uid(false);
    $usr = new users($uid);
    $pname = $_SESSION['name'] . ' ' . $_SESSION['surname'];
    $mail = $usr->GetField($uid, $error, 'email');
    if (!$msg) {
        $alert['msg'] = 'Поле заполнено некорректно';
        $error_flag = 1;
    }
    if (!$error_flag) {
        $error .= blogs::NewThread($uid, 3, 0, $name, $msg, $f_name, getRemoteIP(), 1, $tn);
    }
    if (!$error && !$error_flag) {
        $sm = new smail();
        $error .= $sm->NewFeedbackPost($pname, $msg, $mail, $_SESSION['login'], 4);
        $msg = $name = $mail = '';
        $info_msg = '<br><center><table class="view_info" border="0" cellpadding="2" cellspacing="0"><tbody><tr class="n_qpr"><td height="20"><img src="/images/ico_ok.gif" alt="" border="0" height="18" width="19"></td><td nowrap>Ваше сообщение отправлено</td></tr></tbody></table>';
        $objResponse->assign('calltext', 'value', '');
        $objResponse->assign('cbok', 'innerHTML', $info_msg);
        //$objResponse->assign("submitButton","disabled",false);
        $objResponse->assign('submitButton', 'value', 'Отправить');
    }
    return $objResponse;
}
示例#3
0
<?php

require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/links.php";
$GLOBALS[LINK_INSTANCE_NAME] = new links('blogs');
$blog = new blogs();
$is_yt_link = $edit_msg['yt_link'] || $yt_link;
$uid = get_uid();
?>
<script type="text/javascript">
<!--
var yt_link = <?php 
if ($is_yt_link) {
    ?>
true<?php 
} else {
    ?>
false<?php 
}
?>
;
var blogs_max_desc_chars = <?php 
echo blogs::MAX_DESC_CHARS;
?>
;
//-->
</script>
<?php 
if ($uid) {
    if ($_COOKIE['blogs_favs_order'] != "") {
        ?>
<script type="text/javascript">
示例#4
0
/**
 * Генерирует ЧПУ ссылки
 *
 * @param    string    $type    Тип ссылки(project, blog и т.д.)
 * @param    integer|array   $data      Параметры для ссылки. Если целое, то id объекта в БД, иначе готовый массив $data (см. внутрь).
 * @return   string             ЧПУ ссылка
 */
function getFriendlyURL($type, $data = NULL)
{
    static $url_cache = array();
    $url = '';
    if (!is_array($data)) {
        $id = intval($data);
        $data = NULL;
    } else {
        $id = intval($data['id']);
    }
    if (!$id) {
        return NULL;
    }
    if ($url_cache[$type][$id]) {
        return $url_cache[$type][$id];
    }
    switch ($type) {
        case 'project':
            if (!$data) {
                require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/projects.php";
                $data = projects::getInfoForFriendlyURL($id);
            }
            if ($data) {
                $name = translit(strtolower(htmlspecialchars_decode($data['name'], ENT_QUOTES)));
                $url = "/projects/{$id}/" . ($name ? "{$name}.html" : "");
            }
            break;
        case 'blog':
            require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/blogs.php";
            $data = blogs::getMsgInfoForFriendlyURL($id);
            if ($data) {
                $name = translit(strtolower(htmlspecialchars_decode($data['name'], ENT_QUOTES)));
                $category = translit(strtolower(htmlspecialchars_decode($data['category'], ENT_QUOTES)));
                $url = "/blogs/{$category}/{$id}/" . ($name ? $name . ".html" : "");
            }
            break;
        case 'blog_group':
            require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/blogs.php";
            $data = blogs::GetGroupName($id);
            if ($data) {
                $category = translit(strtolower(htmlspecialchars_decode($data, ENT_QUOTES)));
                $url = "/blogs/" . ($category ? "{$category}/" : "");
            }
            break;
        case 'article':
            require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/articles.php";
            $data = articles::getInfoForFriendlyURL($id);
            if ($data) {
                $name = translit(strtolower(htmlspecialchars_decode($data['title'], ENT_QUOTES)));
                $url = "/articles/{$id}/" . ($name ? $name . ".html" : "");
            }
            break;
        case 'interview':
            require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/interview.php";
            $data = interview::getInfoForFriendlyURL($id);
            if ($data) {
                $name = translit(strtolower(htmlspecialchars_decode($data['uname'] . ' ' . $data['usurname'] . ' ' . $data['login'], ENT_QUOTES)));
                $url = "/interview/{$id}/" . ($name ? $name . ".html" : "");
            }
            break;
        case 'commune':
            require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/commune.php";
            $data = commune::getMsgInfoForFriendlyURL($id);
            if ($data) {
                $category = translit(strtolower(htmlspecialchars_decode($data['group_link'], ENT_QUOTES)));
                $commune = translit(strtolower(htmlspecialchars_decode($data['commune_name'], ENT_QUOTES)));
                $name = translit(strtolower(htmlspecialchars_decode($data['name'], ENT_QUOTES)));
                $commune_id = $data['commune_id'];
                $url = "/commune/{$category}/{$commune_id}/{$commune}/{$id}/" . ($name ? $name . ".html" : "");
            }
            break;
        case 'commune_group':
            require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/commune.php";
            $data = commune::getGroupInfoForFriendlyURL($id);
            if ($data) {
                $category = translit(strtolower(htmlspecialchars_decode($data['link'], ENT_QUOTES)));
                $url = "/commune/{$category}/";
            }
            break;
        case 'commune_commune':
            require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/commune.php";
            $data = commune::getCommuneInfoForFriendlyURL($id);
            if ($data) {
                $category = translit(strtolower(htmlspecialchars_decode($data['category_link'], ENT_QUOTES)));
                $commune = translit(strtolower(htmlspecialchars_decode($data['name'], ENT_QUOTES)));
                $commune = $commune ? $commune : 'commune';
                $url = "/commune/{$category}/{$id}/{$commune}/";
            }
            break;
    }
    if ($url) {
        $url_cache[$type][$id] = $url;
    }
    return $url;
}
示例#5
0
<?php

require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/blogs.php";
$blog = new blogs();
//blogs;
list($themes, $usr) = $blog->getCorporateBlog();
if ($themes) {
    header("Content-type: application/rss+xml");
    echo "<?xml version=\"1.0\" encoding=\"windows-1251\"?>\n<!--  RSS generated by FL.ru RSS Generator on " . gmdate("D, d M Y H:i:s") . " GMT -->\n";
    ?>
<rss version="2.0">
<channel>
<title>Корпоративный блог на FL.ru</title>
<link><?php 
    echo $host;
    ?>
/rss/corporative.php</link> 
<description>Корпоративный блог на сайте www.fl.ru</description> 
<language>ru-ru</language> 
<pubDate><?php 
    echo gmdate("D, d M Y H:i:s");
    ?>
</pubDate>
<lastBuildDate><?php 
    echo gmdate("D, d M Y H:i:s", strtotimeEx($themes[0]['date_create']));
    ?>
</lastBuildDate> 
<docs>http://blogs.law.harvard.edu/tech/rss</docs> 
<generator>FL.ru RSS Generator</generator>
<category>Корпоративный блог</category>
<ttl>30</ttl> 
示例#6
0
<?php

require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/blogs.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/employer.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/freelancer.php";
$blog = new blogs();
$gr = intval(trim($_GET['gr']));
$login = trim($_GET['user']);
$t = trim(__paramInit('string', 't'));
if (!$t) {
    $base = 0;
} else {
    $base = 1;
}
$page = intval(trim($_GET['page']));
$from = intval(trim($_GET['from']));
$from = 0;
//а нафига вообще тут это нужно?
if (!$page) {
    $page = 1;
}
if ($login) {
    // Ћичный блог пользовател¤
    $login = pg_escape_string($login);
    $user = new users();
    $user->GetUser($login);
    if ($user->uid && !$user->is_banned) {
        if (!is_emp($user->role)) {
            $user = new freelancer();
            $user->GetUser($login);
            $is_visible = substr($user->tabs, 3, 1);
 public function completeData($type_role = 1)
 {
     if ($this->isDisable()) {
         header("Location: /wizard/registration/?step=1");
         exit;
     }
     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/employer.php";
     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/freelancer.php";
     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/city.php";
     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/country.php";
     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/blogs.php";
     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/commune.php";
     $themes_blogs = blogs::getRandomThemes(5);
     $themes_commune = commune::getRandomCommunes(3);
     $month = array('1' => 'января', '2' => 'февраля', '3' => 'марта', '4' => 'апреля', '5' => 'мая', '6' => 'июня', '7' => 'июля', '8' => 'августа', '9' => 'сентября', '10' => 'октября', '11' => 'ноября', '12' => 'декабря');
     if ($type_role == step_wizard_registration::TYPE_WIZARD_EMP) {
         $user = new employer();
         $checkPRO = $this->checkWizardPRO(array(step_employer::OP_CODE_PRO));
         $pro_emp = $checkPRO['id'] > 0 ? 1 : 0;
         if ($pro_emp) {
             $week_pro = round($checkPRO['ammount'] / 10);
         }
     } else {
         $user = new freelancer();
         $checkPRO = $this->checkWizardPRO(step_freelancer::getOperationCodePRO());
         $pro_frl = $checkPRO['id'] > 0 ? 1 : 0;
         if ($pro_frl) {
             $op_code = $checkPRO['op_code'];
         }
     }
     $user->GetUserByUID(wizard::getUserIDReg());
     $info_for_reg = unserialize($user->info_for_reg);
     $uname = $user->uname;
     $usurname = $user->usurname;
     $sex = $user->sex == 't' ? 1 : ($user->sex == 'f' ? 0 : -1);
     $birthday = strtotime($user->birthday);
     if ($birthday) {
         $bday = date('d', $birthday);
         $bmonth = (int) date('m', $birthday);
         $bmonth_value = $month[$bmonth];
         $byear = date('Y', $birthday);
     } else {
         $bday = '';
         $bmonth = (int) date('m', $birthday);
         $bmonth_value = $month[$bmonth];
         $byear = '';
     }
     $city = $user->city;
     if ($city) {
         $city_value = city::GetCityName($city);
     }
     $country = $user->country;
     if ($country) {
         $country_value = country::GetCountryName($country);
     }
     if ($type_role == step_wizard_registration::TYPE_WIZARD_EMP) {
         $company = $user->compname;
         $about_company = $user->company;
         $logo_name = $user->logo;
         $dir = "users/" . substr($user->login, 0, 2) . "/" . $user->login . "/logo/";
         $logo_path = WDCPREFIX . "/" . $dir . $user->logo;
     }
     $info['site'] = $this->loadMultiVal('site', 'site', $user);
     $info['email'] = $this->loadMultiVal('second_email', 'email', $user);
     $info['phone'] = $this->loadMultiVal('phone', 'phone', $user);
     $info['icq'] = $this->loadMultiVal('icq', 'icq', $user);
     $info['skype'] = $this->loadMultiVal('skype', 'skype', $user);
     $info['jabber'] = $this->loadMultiVal('jabber', 'jabber', $user);
     $info['lj'] = $this->loadMultiVal('ljuser', 'lj', $user);
     $action = __paramInit('string', null, 'action');
     if ($action == 'upd_info') {
         $info_for_reg = $_POST['info_for_reg'];
         if ($info_for_reg['email_0'] !== null) {
             $info_for_reg['second_email'] = $info_for_reg['email_0'];
             unset($info_for_reg['email_0']);
         }
         if ($info_for_reg['phone_0'] !== null) {
             $info_for_reg['phone'] = $info_for_reg['phone_0'];
             unset($info_for_reg['phone_0']);
         }
         if ($info_for_reg['site_0'] !== null) {
             $info_for_reg['site'] = $info_for_reg['site_0'];
             unset($info_for_reg['site_0']);
         }
         if ($info_for_reg['lj_0'] !== null) {
             $info_for_reg['ljuser'] = $info_for_reg['lj_0'];
             unset($info_for_reg['lj_0']);
         }
         if ($info_for_reg['jabber_0'] !== null) {
             $info_for_reg['jabber'] = $info_for_reg['jabber_0'];
             unset($info_for_reg['jabber_0']);
         }
         if ($info_for_reg['skype_0'] !== null) {
             $info_for_reg['skype'] = $info_for_reg['skype_0'];
             unset($info_for_reg['skype_0']);
         }
         if ($info_for_reg['icq_0'] !== null) {
             $info_for_reg['icq'] = $info_for_reg['icq_0'];
             unset($info_for_reg['icq_0']);
         }
         if ($info_for_reg['compname'] !== null) {
             $info_for_reg['company'] = $info_for_reg['compname'];
             unset($info_for_reg['compname']);
         }
         $info_for_reg = array_map('intval', $info_for_reg);
         $user->info_for_reg = serialize($info_for_reg);
         $uname = __paramInit('string', null, 'uname', null, 21);
         $usurname = __paramInit('string', null, 'usurname', null, 21);
         if ($uname == '') {
             $error['uname'] = "Поле заполнено некорректно";
         }
         if ($usurname == '') {
             $error['usurname'] = "Поле заполнено некорректно";
         }
         if (!preg_match("/^[-a-zA-Zа-яёА-ЯЁ]+\$/", $uname)) {
             $error['uname'] = "Поле заполнено некорректно";
         } else {
             $user->uname = $uname;
         }
         if (!preg_match("/^[-a-zA-Zа-яёА-ЯЁ]+\$/", $usurname)) {
             $error['usurname'] = "Поле заполнено некорректно";
         } else {
             $user->usurname = $usurname;
         }
         $sex = __paramInit('int', null, 'sex', 1);
         // по умолчанию мужской пол
         $user->sex = $sex == 1 ? 't' : 'f';
         $bday = __paramInit('int', null, 'bday', null);
         $bmonth = __paramInit('int', null, 'bmonth_db_id', 1);
         $bmonth_value = __paramInit('string', null, 'bmonth');
         $byear = __paramInit('int', null, 'byear', null);
         if ($bday != null && $byear != null) {
             if (!is_numeric($bday) || !is_numeric($byear) || !checkdate($bmonth, $bday, $byear) || $byear < 1945 || $byear > date('Y')) {
                 $error['birthday'] = "Поле заполнено некорректно";
             } else {
                 $user->birthday = dateFormat("Y-m-d", $byear . "-" . $bmonth . "-" . $bday);
             }
         } else {
             $user->birthday = "1910-01-01";
         }
         if (!$error['birthday'] && $user->birthday && date("Y", strtotime($user->birthday)) >= date("Y")) {
             $error['birthday'] = "Поле заполнено некорректно";
         }
         $city = __paramInit('int', null, 'city_db_id', 0);
         $city_value = __paramInit('string', null, 'city', false);
         $country = __paramInit('int', null, 'country_db_id', 0);
         $country_value = __paramInit('string', null, 'country', false);
         if ($city == 0 && strlen($city_value) != 0) {
             $error['city'] = 'Поле заполнено некорректно';
         }
         if ($country == 0 && strlen($country_value) != 0) {
             $error['country'] = 'Поле заполнено некорректно';
         }
         $user->country = $country;
         $user->city = $city;
         $company = __paramInit('string', null, 'company') ? substr(__paramInit('string', null, 'company'), 0, 64) : '';
         $about_company = __paramInit('string', null, 'about_company');
         $user->compname = $company;
         if (strlen($about_company) > 500) {
             $error['company'] = "Количество знаков в тексте о компании превышает допустимое значение";
         } else {
             $user->company = $about_company;
         }
         $logo_id = __paramInit('int', null, 'logo_company');
         $logo_name = __paramInit('string', null, 'logo_name');
         if ($logo_name) {
             $user->logo = $logo_name;
             $user->Update(wizard::getUserIDReg(), $res);
         }
         $info['site'] = $this->initMultiVal('site');
         $info['email'] = $this->initMultiVal('email');
         $info['phone'] = $this->initMultiVal('phone');
         $info['icq'] = $this->initMultiVal('icq');
         $info['skype'] = $this->initMultiVal('skype');
         $info['jabber'] = $this->initMultiVal('jabber');
         $info['lj'] = $this->initMultiVal('lj');
         if (!empty($info['site'])) {
             foreach ($info['site'] as $i => $value) {
                 $name = 'site' . ($i != 0 ? "_{$i}" : "");
                 if (!url_validate(addhttp($value), true) && trimhttp($value) != '') {
                     $error[$name] = "Поле заполнено некорректно";
                 } else {
                     $user->{$name} = addhttp($value);
                 }
             }
         }
         if (!empty($info['email'])) {
             foreach ($info['email'] as $i => $value) {
                 if ($i == 0) {
                     $name_save = "second_email";
                 } else {
                     $name_save = "email_{$i}";
                 }
                 $name = 'email' . ($i != 0 ? "_{$i}" : "");
                 if (!is_email($value) && $value != '') {
                     $error[$name] = "Поле заполнено некорректно";
                 } else {
                     $user->{$name_save} = $value;
                 }
             }
         }
         if (!empty($info['phone'])) {
             foreach ($info['phone'] as $i => $value) {
                 $name = 'phone' . ($i != 0 ? "_{$i}" : "");
                 if (!preg_match("/^[-+0-9)( #]*\$/", $value)) {
                     $error[$name] = "Поле заполнено некорректно";
                 } else {
                     $user->{$name} = $value;
                 }
             }
         }
         if (!empty($info['icq'])) {
             foreach ($info['icq'] as $i => $value) {
                 $name = 'icq' . ($i != 0 ? "_{$i}" : "");
                 if (!preg_match("/^[-0-9\\s]*\$/", $value) && !is_email($value)) {
                     $error[$name] = "Поле заполнено некорректно";
                 } else {
                     $user->{$name} = $value;
                 }
             }
         }
         if (!empty($info['skype'])) {
             foreach ($info['skype'] as $i => $value) {
                 $name = 'skype' . ($i != 0 ? "_{$i}" : "");
                 $user->{$name} = $value;
             }
         }
         if (!empty($info['jabber'])) {
             foreach ($info['jabber'] as $i => $value) {
                 $name = 'jabber' . ($i != 0 ? "_{$i}" : "");
                 if (strlen($value) > 255) {
                     $error[$name] = "Количество знаков превышает допустимое значение";
                 } else {
                     $user->{$name} = $value;
                 }
             }
         }
         if (!empty($info['lj'])) {
             foreach ($info['lj'] as $i => $value) {
                 if ($i == 0) {
                     $name_save = "ljuser";
                 } else {
                     $name_save = "lj_{$i}";
                 }
                 $name = 'lj' . ($i != 0 ? "_{$i}" : "");
                 if (!preg_match("/^[a-zA-Z0-9_-]*\$/", $value)) {
                     $error[$name] = "Поле заполнено некорректно";
                 } else {
                     $user->{$name_save} = $value;
                 }
             }
         }
         if ($type_role == step_wizard_registration::TYPE_WIZARD_EMP) {
             $pro_emp = __paramInit('int', null, 'pro-emp', false);
             if ($pro_emp) {
                 $week_pro = round(__paramInit('int', null, 'week_pro', 0));
             }
         } else {
             $ammount = 0;
             $pro_frl = __paramInit('int', null, 'pro-frl', false);
             if ($pro_frl) {
                 $pro = __paramInit('string', null, 'pro', -1);
                 switch ($pro) {
                     case "1week":
                         $op_code = 76;
                         $ammount = 7;
                         break;
                     case "1":
                         $op_code = 48;
                         $ammount = 19;
                         break;
                     case "3":
                         $op_code = 49;
                         $ammount = 54;
                         break;
                     case "6":
                         $op_code = 50;
                         $ammount = 102;
                         break;
                     case "12":
                         $op_code = 51;
                         $ammount = 180;
                         break;
                     case "-1":
                     default:
                         $ammount = 0;
                         break;
                 }
             }
         }
         if (!$error && wizard::getUserIDReg()) {
             $error['save'] = $user->Update(wizard::getUserIDReg(), $res);
             if (!$error['save']) {
                 if ($type_role == step_wizard_registration::TYPE_WIZARD_EMP) {
                     $ammount = $week_pro * 10;
                     if ($ammount > 0) {
                         $checkPRO = $this->checkWizardPRO(step_employer::OP_CODE_PRO);
                         if ($checkPRO['id'] > 0) {
                             $update = array("ammount" => $ammount);
                             wizard_billing::editPaidOption($update, $checkPRO['id']);
                         } else {
                             $insert = array("wiz_uid" => step_wizard::getWizardUserID(), "op_code" => step_employer::OP_CODE_PRO, "type" => 3, "ammount" => $ammount, "parent" => wizard::getUserIDReg());
                             wizard_billing::addPaidOption($insert);
                         }
                     } else {
                         $sql = "DELETE FROM wizard_billing WHERE wiz_uid = ? AND op_code = ?";
                         $this->_db->query($sql, step_wizard::getWizardUserID(), step_employer::OP_CODE_PRO);
                     }
                 } else {
                     // Чистим
                     $sql = "DELETE FROM wizard_billing WHERE wiz_uid = ? AND op_code IN (?l)";
                     $this->_db->query($sql, step_wizard::getWizardUserID(), step_freelancer::getOperationCodePRO());
                     if ($ammount > 0) {
                         $insert = array("wiz_uid" => step_wizard::getWizardUserID(), "op_code" => $op_code, "type" => 4, "ammount" => $ammount, "parent" => wizard::getUserIDReg());
                         wizard_billing::addPaidOption($insert);
                     }
                 }
                 $this->parent->setCompliteStep(true);
                 $this->parent->setNextStep($this->parent->getPosition() + 1);
                 header("Location: /wizard/registration/");
                 exit;
             }
         }
         if ($logo_id > 0) {
             $file = new CFile($logo_id);
             $logo_path = WDCPREFIX . "/" . $file->path . $file->name;
         }
     }
     include $_SERVER['DOCUMENT_ROOT'] . "/wizard/registration/steps/tpl.step.info.php";
 }
示例#8
0
echo $ustat['warns'];
?>
</span></td></tr>
            </table>
        </td>
        <td><?php 
if ($mode == 'blogs') {
    ?>
<strong>Блоги</strong><?php 
} else {
    ?>
<a href="/siteadmin/ban-razban/?mode=blogs">Блоги</a><?php 
}
?>
 <span><?php 
echo blogs::NumsBlockedThreads();
?>
</span></td>
        <td>
            <?php 
if ($mode == 'projects') {
    ?>
<strong onmouseover="hm_open(2)" onmouseout="hm_close(2)">Проекты</strong><?php 
} else {
    ?>
<a href="/siteadmin/ban-razban/?mode=projects" onmouseover="hm_open(2)" onmouseout="hm_close(2)">Проекты</a><?php 
}
?>
 <span><?php 
echo projects::NumsBlockedProjects();
?>
示例#9
0
 /**
  * Возвращает список тем в разделе
  *
  * -------------------------------------------------------------------------------------
  * Внимание! Замечание к подзапросу на основные вкладки (новые, популярные, актуальные).
  *
  * Подзапрос настроен на работу индексов типа "ix blogs_themes/viewgroup*", поэтому любое
  * добавление условий или (тем более с привязкой дополнительных таблиц!) испортит его.
  * Суть заключается в том, что мы все условия копируем в таблицы blogs_themes из таблиц blogs_msgs и других,
  * для того, чтобы использовать индексы и не делать лишних джойнов, т.е. все проверки делаются в рамках 
  * единственной
  * таблицы. Поэтому мы быстро выбираем все необходимые N тем и только потом связываем их с остальными таблицами.
  * Чтобы добавить условие, нужно по аналогии, например, с deleted, is_blocked и т.п.), добавить клон 
  * необходимого
  * поля в blogs_themes и скорректировать индекс(ы) (протестировав предварительно).
  * -------------------------------------------------------------------------------------
  *
  *
  * @param integer $gr_num				идентификатор раздела
  * @param string  $gr_name				возвращает название раздела
  * @param integer $num_treads			возвращает кол-во тем в данном разделе
  * @param integer $page					номер страницы из списка тем, которую надо выводить [получает или возвращает, в зависимости от $having_message]
  * @param string  $error				возвращает сообщение об ошибке
  * @param integer $fid					UID текущего юзера
  * @param integer $mod					имеет ли текущий юзер права на просмотр данного раздела [1 - да, 0 - нет]
  * @param integer $having_message		УСТАРЕЛО. id сообщения, страницу с которым необходимо отобразить (0 - показать страницу $page)
  * @param integer $read_only			возвращает параметр - является ли данный раздел разделом "только для чтения"
  * @param string  $ord					параметр сортировки ("my", "relevant", "best", "new", "favs")
  * @param string  $sort_order           позволяет передать дополнительные условия сортировки
  * @return array						[[информация о сообщении]]
  */
 function GetGroup($gr_num, &$gr_name, &$num_treads, $page, &$error, $fid = 0, $mod = 1, $having_message = 0, &$read_only, $ord = "new", $is_ban = true, $sort_order = '')
 {
     global $DB;
     $cachedelay = 300;
     if (hasPermissions("blogs")) {
         $cachedelay = 0;
     }
     $memBuff = new memBuff();
     $fid = (int) $fid;
     $gr_num = (int) $gr_num;
     $num_treads = 0;
     $year = date('Y');
     $can_prevyear_ontops = date('n') <= 2;
     $limit = $GLOBALS['blogspp'];
     $group = $gr_num != 0 ? "id_gr = {$gr_num} " : "";
     $offset = $limit * ($page - 1);
     $offset = intvalPgSql((string) $offset);
     $limit_str = "LIMIT {$limit} OFFSET {$offset}";
     $order = "post_time DESC";
     $ids = array();
     $idx = array();
     $get_ontops = $ord == 'ontop';
     if (!$get_ontops) {
         if ($gr_num != 0) {
             $gr_name = $this->GetGroupName($gr_num, 0, $mod);
             if (!$gr_name) {
                 $error = "У вас недостаточно прав для просмотра этого форума";
                 return 0;
             }
         } else {
             $gr_name = "Все вместе";
         }
     }
     // смотрим баны
     if ($fid && $fid == $_SESSION['uid']) {
         $role = $_SESSION['role'];
     } else {
         if ($fid) {
             $users = new users();
             $role = $users->GetField($fid, $error, 'role');
         } else {
             $role = 0;
         }
     }
     $is_moder = hasPermissions('blogs', $fid);
     if ($is_moder) {
         $sel_blocked = ", moderators.login as moder_login, moderators.uname AS moder_name, moderators.usurname as moder_uname";
         $join_blocked = " LEFT JOIN users AS moderators ON blogs_blocked.admin = moderators.uid ";
     } else {
         $where_blocked = '(t.is_blocked = false) ';
         $where_private = ' AND (' . ($fid ? "t.fromuser_id = {$fid} OR " : '') . 't.is_private = false)';
         $where_deleted = ' AND (t.deleted IS NULL )';
         $where_deleted_my = ' AND t.deleted IS NULL AND m.deleted IS NULL';
         // контролим баны
         if (!$is_ban) {
             $where_is_blocked = $where_blocked;
         }
     }
     $_group = $group ? " {$group} AND " : '';
     switch ($ord) {
         case "my_all":
         case "my_posts":
         case "my_comments":
         case 'favs_list':
         case 'favs_std':
             if ($ord != 'favs_list' && $ord != 'favs_std') {
                 $sReplyTo = $ord != 'my_all' ? $ord == 'my_posts' ? ' AND m.reply_to IS NULL' : ' AND m.reply_to IS NOT NULL' : '';
                 $join_banned = $where_deleted ? 'INNER JOIN users mtu 
             	   ON mtu.uid = t.fromuser_id AND mtu.is_banned = 0::bit(1)' : '';
                 $where = 'WHERE';
                 $and = ' AND ';
                 /*if (!$where_blocked && !$_group && !$where_private && !$sReplyTo && !$where_deleted_my) {
                       $and = $where = '';
                   }*/
                 if (!$where_blocked) {
                     $and = '';
                 }
                 $sSelectQuery = "SELECT\n                        ontop, users.warn, msgs.id, messages_cnt as num, post_time, msgtext, yt_link, msgs.title, close_comments, is_private, users.uid,\n                        base as t, msgs.id_gr, users.uname, modified, modified_id, fromuser_id, users.usurname, users.login, users.email, users.photo, users.is_team,\n                        users.is_pro as payed, users.is_pro_test as payed_test, users.role, users.is_banned, users.ban_where, msgs.thread_id, users.reg_date, users.is_chuck,\n                        blogs_blocked.thread_id as is_blocked, blogs_blocked.reason, blogs_blocked.blocked_time,\n                        blogs_poll.thread_id::boolean as has_poll, blogs_poll.question as poll_question, blogs_poll.closed as poll_closed, blogs_poll.multiple as poll_multiple,\n\t\t\t\t\t\tvotes._cnt as poll_votes, reply_to, msgs.deleted, msgs.deluser_id, msgs.deleted_reason, fav_cnt, w.status, moderator_status, sbr_meta.completed_cnt\n                    FROM (\n                        SELECT m.*, t.messages_cnt, t.base, t.id_gr, t.close_comments , t.is_private, t.fav_cnt \n                        FROM blogs_themes as t\n                        INNER JOIN blogs_msgs as m ON t.thread_id = m.thread_id\n                        {$join_deleted}\n                        {$join_banned}\n                        {$where} {$where_blocked} {$and} ({$_group} m.fromuser_id = '{$fid}' {$where_private} {$sReplyTo}) {$where_deleted_my}\n                        ORDER BY {$order} {$limit_str}\n                    ) as msgs\n                    LEFT JOIN users ON fromuser_id=uid\n                    LEFT JOIN sbr_meta ON sbr_meta.user_id=uid\n                    LEFT JOIN blogs_blocked ON msgs.thread_id = blogs_blocked.thread_id\n                    LEFT JOIN blogs_poll ON blogs_poll.thread_id = msgs.thread_id\n\t\t\t\t\tLEFT JOIN (SELECT thread_id, COUNT(answer_id) AS _cnt FROM blogs_poll_votes WHERE user_id = '{$fid}' GROUP BY thread_id) AS votes ON votes.thread_id = msgs.thread_id\n                                        LEFT JOIN blogs_themes_watch w ON w.user_id = '{$fid}' AND w.theme_id = msgs.thread_id\n                    ORDER BY {$order}";
                 $sCountQuery = "\n                    SELECT COUNT(*) as num\n                    FROM blogs_msgs m \n                    LEFT JOIN blogs_themes t ON t.thread_id = m.thread_id\n                    {$join_deleted}\n                \t{$join_banned}\n                    {$where} {$where_blocked} {$and} ({$_group} m.fromuser_id = ?i {$where_private} {$sReplyTo}) {$where_deleted_my}";
             } else {
                 if ($sort_order == "priority") {
                     $order = " priority DESC";
                     // важности
                 } elseif ($sort_order == "abc") {
                     $order = " calc_title";
                     // алфавиту
                 } else {
                     $order = " add_time DESC NULLS LAST";
                     // дате
                 }
                 $where = 'WHERE';
                 $and = ' AND ';
                 /*if (!$where_blocked && !$_group && !$where_private  && !$where_deleted) {
                       $and = $where = '';
                   }*/
                 if (!$where_blocked) {
                     $and = '';
                 }
                 $sSelectQuery = "SELECT \n                        ontop, users.warn, msgs.id, messages_cnt as num, post_time, msgtext, yt_link, msgs.calc_title, close_comments, \n                        is_private, users.uid, base as t, msgs.id_gr, users.uname, modified, modified_id, users.is_team,\n                        fromuser_id, users.usurname, users.login, users.email, users.photo, users.is_pro as payed, reply_to, \n                        users.is_pro_test as payed_test, users.role, users.is_banned, users.ban_where, msgs.thread_id, users.reg_date, \n                        users.is_chuck, blogs_blocked.thread_id as is_blocked, blogs_blocked.reason, blogs_blocked.blocked_time, \n                        blogs_poll.thread_id::boolean as has_poll, blogs_poll.question as poll_question, blogs_poll.closed as poll_closed, blogs_poll.multiple as poll_multiple,\n                        votes._cnt as poll_votes, msgs.priority, msgs.add_time, msgs.deleted, msgs.deluser_id, msgs.deleted_reason, fav_cnt, w.status, moderator_status, sbr_meta.completed_cnt\n                    FROM ( \n                        SELECT m.*, COALESCE(NULLIF(f.title,''), m.title) as calc_title, t.messages_cnt, t.base, t.id_gr, t.close_comments , t.is_private, f.priority, f.add_time, t.fav_cnt  \n                        FROM blogs_fav f \n                        INNER JOIN blogs_themes as t ON f.thread_id = t.thread_id \n                        INNER JOIN blogs_msgs as m ON t.thread_id = m.thread_id \n                        {$where} {$where_blocked} {$and} ({$_group}  m.reply_to IS NULL AND f.user_id = '{$fid}' {$where_private}) {$where_deleted} \n                        ORDER BY {$order} " . ($ord == 'favs_std' ? $limit_str : '') . " \n                    ) as msgs \n                    LEFT JOIN users ON fromuser_id=uid \n                    LEFT JOIN blogs_blocked ON msgs.thread_id = blogs_blocked.thread_id \n                    LEFT JOIN blogs_poll ON blogs_poll.thread_id = msgs.thread_id\n                    LEFT JOIN sbr_meta ON sbr_meta.user_id=users.uid\n\t\t\t\t\tLEFT JOIN (SELECT thread_id, COUNT(answer_id) AS _cnt FROM blogs_poll_votes WHERE user_id = '{$fid}' GROUP BY thread_id) AS votes ON votes.thread_id = msgs.thread_id\n\t\t\t\t\tLEFT JOIN blogs_themes_watch w ON w.user_id = '{$fid}' AND w.theme_id = msgs.thread_id\n                    ORDER BY {$order}";
                 $sCountQuery = "\n                    SELECT COUNT(*) as num \n                    FROM blogs_fav f \n                    INNER JOIN blogs_themes as t ON f.thread_id = t.thread_id \n                    INNER JOIN blogs_msgs as m ON t.thread_id = m.thread_id \n                    {$where} {$where_blocked} {$and} ({$_group}  m.reply_to IS NULL AND f.user_id = ?i {$where_private}) {$where_deleted}";
             }
             $ret = $DB->rows($sSelectQuery);
             $error = $DB->error;
             if ($error) {
                 $error = parse_db_error($error);
             } else {
                 for ($i = 0, $max = count($ret); $i < $max; $i++) {
                     if ($ret[$i]['has_poll'] == 't') {
                         $ids[] = $ret[$i]['thread_id'];
                         $idx[$ret[$i]['thread_id']] =& $ret[$i];
                     }
                 }
                 $this->AddAttach($ret);
                 $num_treads = $DB->val($sCountQuery, $fid);
             }
             if ($ids) {
                 $res = $DB->rows("SELECT * FROM blogs_poll_answers WHERE thread_id IN (" . implode(',', $ids) . ") ORDER BY id");
                 if ($res) {
                     foreach ($res as $row) {
                         $idx[$row['thread_id']]['poll'][] = $row;
                     }
                 }
             }
             return $ret;
             break;
         case "new":
         case "relevant":
         case "best":
         case "ontop":
         default:
             $group = $group ? $group : "id_gr!=7 ";
             $_group = $group ? " AND {$group}" : '';
             if ($ord == 'relevant') {
                 $order = "last_activity DESC";
             } else {
                 if ($ord == 'best') {
                     $order = "messages_cnt DESC," . $order;
                 } else {
                     if (!$get_ontops) {
                         $y_start = $year;
                         $ycnt = 0;
                         $ylcnt = 0;
                         if (!$fid) {
                             for ($year, $ycnt = 0; $year >= 2008; $year--) {
                                 $ylcnt = blogs::getThemesCount($year, $gr_num);
                                 $ycnt += $ylcnt;
                                 if ($ycnt > $offset) {
                                     break;
                                 }
                             }
                         }
                         $ontops = $this->GetGroup($gr_num, $gr_name, $num_treads, 1, $error, $fid, $mod, 0, $read_only, 'ontop', $is_ban, $sort_order);
                         $ontops_cnt = $ontops ? count($ontops) : 0;
                         if ($offset >= $ontops_cnt) {
                             $offset -= $ontops_cnt;
                         }
                         $where_ontop_i = 'AND t.ontop = false';
                         if (!$group && !$where_is_blocked && !$where_private && !$where_deleted) {
                             $where_ontop_i = ' t.ontop = false';
                         }
                         if ($year >= 2008) {
                             $y_offset = $offset - ($ycnt - $ylcnt);
                             $y_offset = intvalPgSql((string) $y_offset);
                             $limit_str = "LIMIT {$limit} OFFSET {$y_offset}";
                         } else {
                             $sql = NULL;
                             // прыгаем на общий запрос.
                             break;
                         }
                     } else {
                         // берем только закрепленные.
                         $look_prev_year = $can_prevyear_ontops;
                         $where_ontop_i = 'AND t.ontop = true';
                         if (!$group && !$where_is_blocked && !$where_private && !$where_deleted) {
                             $where_ontop_i = ' t.ontop = true';
                         }
                     }
                 }
             }
             $where = 'WHERE';
             if (!$where_blocked && !$group && !$where_private && !$where_deleted && !$where_ontop_i) {
                 $where = '';
             }
             if (!$where_is_blocked) {
                 $_group = $group;
             }
             $sql = "\n                  SELECT ontop, users.warn, msgs.id, messages_cnt as num, last_activity, post_time, msgtext, yt_link, msgs.title, is_private, close_comments, users.uid,\n                         base as t, msgs.id_gr, users.uname, modified, modified_id, fromuser_id, users.usurname, users.login, users.email, users.photo, users.is_team,\n                         users.is_pro as payed, users.is_pro_test as payed_test, users.role, users.is_banned, users.ban_where, msgs.thread_id, users.reg_date, users.is_chuck,\n                         blogs_blocked.thread_id as is_blocked, blogs_blocked.reason, blogs_blocked.blocked_time, msgs.deleted_reason,\n\t\t\t\t\t\t blogs_poll.thread_id::boolean as has_poll, blogs_poll.question as poll_question, blogs_poll.closed as poll_closed, blogs_poll.multiple as poll_multiple,\n\t\t\t\t\t\t votes._cnt as poll_votes, msgs.deleted, msgs.deluser_id, fav_cnt, w.status, sbr_meta.completed_cnt, moderator_status {$sel_blocked}\n                    FROM (\n                       -- Внимание! Данный подзапрос заточен под индексы blogs_themes (см. замечание в описании функции).\n                       SELECT m.*, t.close_comments, t.is_private, t.messages_cnt, t.last_activity, t.base, t.id_gr, t.fav_cnt \n                        FROM (\n                          SELECT t.* FROM blogs_themes as t\n                          {$where} /*where_is_blocked*/{$where_is_blocked} /*group:*/{$_group} /*where_private*/{$where_private} /*where_deleted:*/{$where_deleted} /*where_ontop_i*/{$where_ontop_i}\n                          ORDER BY {$order} {$limit_str}\n                        ) as t\n                       INNER JOIN\n                         blogs_msgs" . (!$look_prev_year ? "_{$year}" : '') . " m\n                           ON t.thread_id = m.thread_id AND m.reply_to IS NULL\n                    ) as msgs\n\t\t\t\t\tLEFT JOIN users ON fromuser_id=users.uid\n\t\t\t\t\tLEFT JOIN sbr_meta ON sbr_meta.user_id=users.uid\n\t\t\t\t\tLEFT JOIN blogs_blocked ON msgs.thread_id = blogs_blocked.thread_id\n\t\t\t\t\tLEFT JOIN blogs_poll ON blogs_poll.thread_id = msgs.thread_id\n\t\t\t\t\tLEFT JOIN (SELECT thread_id, COUNT(answer_id) AS _cnt FROM blogs_poll_votes WHERE user_id = '{$fid}' GROUP BY thread_id) AS votes ON votes.thread_id = msgs.thread_id\n\t\t\t\t\tLEFT JOIN blogs_themes_watch" . (!$look_prev_year ? "_{$year}" : '') . " w ON w.user_id = '{$fid}' AND w.theme_id = msgs.thread_id\n                    {$join_blocked}\n                    ORDER BY {$order}\n\t\t\t\t";
             $ret = $DB->rows($sql);
             $error = $DB->error;
             if ($error || (!$ret || count($ret) < $limit) && !$get_ontops) {
                 $sql = '';
             }
             break;
     }
     if (!$sql) {
         $offset = intvalPgSql((string) $offset);
         $where = 'WHERE';
         if (!$where_blocked && !$group && !$where_private && !$where_deleted && !$where_ontop_i) {
             $where = '';
         }
         $sql = "\n              SELECT ontop, users.warn, msgs.id, messages_cnt as num, last_activity, post_time, msgtext, yt_link, msgs.title, is_private, close_comments, users.uid,\n                     base as t, msgs.id_gr, users.uname, modified, modified_id, fromuser_id, users.usurname, users.login, users.email, users.photo, users.is_team,\n                     users.is_pro as payed, users.is_pro_test as payed_test, users.role, users.is_banned, users.ban_where, msgs.thread_id, users.reg_date, users.is_chuck,\n                     blogs_blocked.thread_id as is_blocked, blogs_blocked.reason, blogs_blocked.blocked_time,\n\t\t\t\t\t blogs_poll.thread_id::boolean as has_poll, blogs_poll.question as poll_question, blogs_poll.closed as poll_closed, blogs_poll.multiple as poll_multiple,\n\t\t\t\t\t votes._cnt as poll_votes, msgs.deleted, msgs.deluser_id, msgs.deleted_reason, sbr_meta.completed_cnt, fav_cnt, w.status, moderator_status {$sel_blocked}\n                FROM (\n                  SELECT m.*, t.close_comments, t.is_private, t.messages_cnt, t.last_activity, t.base, t.id_gr, t.fav_cnt \n                   FROM (\n                     -- Внимание! Данный подзапрос заточен под индексы blogs_themes (см. замечание в описании функции).\n                     SELECT t.* FROM blogs_themes as t\n                     {$where} {$where_is_blocked} {$_group} {$where_private} {$where_deleted} {$where_ontop_i}\n                     ORDER BY {$order}\n                     LIMIT {$limit} OFFSET {$offset}\n                   ) as t\n                  INNER JOIN blogs_msgs as m ON t.thread_id = m.thread_id AND m.reply_to IS NULL\n                ) as msgs\n              LEFT JOIN users ON fromuser_id=uid\n              LEFT JOIN blogs_blocked ON msgs.thread_id = blogs_blocked.thread_id\n\t\t\t  LEFT JOIN blogs_poll ON blogs_poll.thread_id = msgs.thread_id\n\t\t\t  LEFT JOIN sbr_meta ON sbr_meta.user_id = users.uid\n\t  \t      LEFT JOIN (SELECT thread_id, COUNT(answer_id) AS _cnt FROM blogs_poll_votes WHERE user_id = '{$fid}' GROUP BY thread_id) AS votes ON votes.thread_id = msgs.thread_id\n              LEFT JOIN blogs_themes_watch w ON w.user_id = '{$fid}' AND w.theme_id = msgs.thread_id\n              {$join_blocked}\n               ORDER BY {$order}\n            ";
         $ret = $DB->rows($sql);
         $error = $DB->error;
         if ($error) {
             $error = parse_db_error($error);
         }
     }
     if (!$error && $ret && !$num_treads) {
         for ($i = 0, $max = count($ret); $i < $max; $i++) {
             if (!$is_moder && $ret[$i]['is_blocked'] && $fid && $ret[$i]['fromuser_id'] != $fid) {
                 unset($ret[$i]);
             }
             if ($ret[$i]['has_poll'] == 't') {
                 $ids[] = $ret[$i]['thread_id'];
                 $idx[$ret[$i]['thread_id']] =& $ret[$i];
             }
         }
         if ($ret) {
             $ret = array_values($ret);
         } else {
             $ret = array();
         }
         $this->AddAttach($ret);
         if (!$get_ontops) {
             // Из $where_private специально убрана проверка по $fid!
             // Иначе оно слишком затратно, т.к. не дает кэшировать этот запрос для всех юзеров сразу
             // при его довольно малой значимости.
             // То же с $where_is_blocked (убираем проверку fromuser_id).
             // Если в связи с этим будут выписаны баги в мантисе и т.п., нужно обсудить, прежде чем втыкать его обратно.
             if ($where_private) {
                 $where_private = ' AND t.is_private = false';
             }
             if ($where_is_blocked) {
                 $where_is_blocked = 't.is_blocked = false ';
             }
             $where_on_top = " AND t.ontop = false ";
             if (!$where_is_blocked && !$group && !$where_deleted && !$where_private) {
                 $where_on_top = " t.ontop = false ";
             }
             $where = 'WHERE';
             if (!$where_is_blocked && !$group && !$where_deleted && !$where_private && !$where_on_top) {
                 $where = '';
             }
             $sql = "SELECT COUNT(1) FROM blogs_themes t \n                    {$where} {$where_is_blocked} {$_group} {$where_deleted} {$where_private} {$where_on_top}";
             $num_treads = $DB->cache(1800)->val($sql);
         }
     }
     if ($ids) {
         $res = $DB->rows("SELECT * FROM blogs_poll_answers WHERE thread_id IN (" . implode(',', $ids) . ") ORDER BY id");
         if ($res) {
             foreach ($res as $row) {
                 $idx[$row['thread_id']]['poll'][] = $row;
             }
         }
     }
     if ($ontops) {
         if ($page == 1) {
             foreach ($ontops as $ot) {
                 array_unshift($ret, $ot);
             }
         }
         $c = count($ret);
         while ($c-- > $limit) {
             array_pop($ret);
         }
     }
     return $ret;
 }
示例#10
0
/**
 * Блокирование/разблокирование треда в блоге
 *
 * @param integer $thread_id     id треда
 * @param string  $reason        причина
 * @param int     $reason_id     ID причины, если она выбрана из списка (таблица admin_reasons, где act_id = 7)
 * @param string  $reason_name   Краткое описание причины действия (из селекта) для лога админских действий
 */
function BlockedThread($thread_id, $reason, $reason_id = null, $reason_name = '')
{
    global $DB;
    session_start();
    $objResponse = new xajaxResponse();
    if (hasPermissions('blogs')) {
        require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/blogs.php';
        $thread_id = intval($thread_id);
        if (is_string($reason) && $reason != '') {
            if (hasPermissions('blogs')) {
                $count = $DB->val("SELECT COUNT(*) FROM blogs_msgs WHERE thread_id = ? AND reply_to IS NULL", $thread_id);
                if ($count) {
                    $blogs = new blogs();
                    $thread = $blogs->GetThreadMsgInfo($thread_id, $error, $perm);
                    // лог админских действий
                    $sObjName = $thread['title'] ? $thread['title'] : '<без темы>';
                    $sObjLink = '/blogs/view.php?tr=' . $thread_id;
                    $reason_id = $reason_id ? $reason_id : null;
                    $reason = str_replace('%USERNAME%', $thread['uname'] . ' ' . $thread['usurname'], $reason);
                    $reason = change_q($reason, FALSE, 0, TRUE);
                    if ($thread['blocked_time']) {
                        $blogs->UnBlocked($thread_id);
                        // пишем лог админских действий
                        admin_log::addLog(admin_log::OBJ_CODE_BLOG, 8, $thread['fromuser_id'], $thread_id, $sObjName, $sObjLink, 0, '', $reason_id, $reason);
                        $objResponse->assign("thread-reason-{$thread_id}", 'innerHTML', '&nbsp;');
                        $objResponse->assign("thread-reason-{$thread_id}", 'style.display', 'none');
                        $objResponse->assign("thread-button-{$thread_id}", 'innerHTML', "<a style='color: Red; font-size:9px;' href='javascript: void(0);' onclick='banned.blockedThread({$thread_id}); return false;'>Блокировать</a>");
                    } else {
                        $sBlockId = $blogs->Blocked($thread_id, $reason, $reason_id, $_SESSION['uid'], false);
                        $thread = $blogs->GetThreadMsgInfo($thread_id, $error, $perm);
                        // пишем лог админских действий
                        admin_log::addLog(admin_log::OBJ_CODE_BLOG, 7, $thread['fromuser_id'], $thread_id, $sObjName, $sObjLink, 0, '', $reason_id, $reason, $sBlockId);
                        $reason = reformat($thread['reason'], 24, 0, 0, 1, 24);
                        $html = BlockedThreadHTML($reason, $thread['blocked_time'], $_SESSION['login'], "{$_SESSION['name']} {$_SESSION['surname']}");
                        $objResponse->assign("thread-reason-{$thread_id}", 'innerHTML', $html);
                        $objResponse->assign("thread-reason-{$thread_id}", 'style.display', 'block');
                        $objResponse->assign("thread-button-{$thread_id}", 'innerHTML', "<a style='color: Red; font-size:9px;' href='javascript: void(0);' onclick='banned.unblockedThread({$thread_id}); return false;'>Разблокировать</a>");
                    }
                } else {
                    $objResponse->alert('Несуществующий топик');
                }
            }
        }
    }
    return $objResponse;
}
示例#11
0
     $asid = $attachedfiles_session;
 }
 if ($draft_id) {
     if (!$attachedfiles_session) {
         $attachedfiles_tmpdraft_files = drafts::getAttachedFiles($draft_id, 1);
         if ($attachedfiles_tmpdraft_files) {
             $attachedfiles_prj_files = array();
             foreach ($attachedfiles_tmpdraft_files as $attachedfiles_draft_file) {
                 $attachedfiles_draft_files[] = $attachedfiles_draft_file;
             }
             $attachedfiles->setFiles($attachedfiles_draft_files, 1);
         }
     }
 } else {
     if ($action == 'edit' && !$alert) {
         $attachedfiles_tmpblog_files = blogs::getAttachedFiles($edit_tr);
         if ($attachedfiles_tmpblog_files) {
             $attachedfiles_blog_files = array();
             foreach ($attachedfiles_tmpblog_files as $attachedfiles_blog_file) {
                 $attachedfiles_blog_files[] = $attachedfiles_blog_file;
             }
             $attachedfiles->setFiles($attachedfiles_blog_files);
         }
     }
 }
 $attachedfiles_files = $attachedfiles->getFiles();
 if ($attachedfiles_files) {
     $n = 0;
     foreach ($attachedfiles_files as $attachedfiles_file) {
         echo "attachedfiles_list[{$n}] = new Object;\n";
         echo "attachedfiles_list[{$n}].id = '" . md5($attachedfiles_file['id']) . "';\n";
示例#12
0
/**
 * Парсит порцию HTML содержимого
 * Сборная: Блоги: посты и комментарии, Комментарии в Комментарии в статьях
 * 
 * @param  int $last_id возвращает последний Id проектов
 * @param  array $content массив данных из базы
 * @param  int $status статус: 0 - не проверенно, 1 - утверждено, 2 - удалено
 * @param  array $aStream данные о потоке
 * @return string HTML
 */
function _parseBlogsUnited(&$last_id, $content = array(), $status = 0, $aStream = array())
{
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/blogs.php';
    $blogs = new blogs();
    $groups = $blogs->GetThemes($error, 0);
    $sReturn = '';
    $nCnt = count($content);
    foreach ($content as $aOne) {
        $last_id = $aOne['moder_num'];
        switch ($aOne['content_id']) {
            case user_content::MODER_BLOGS:
                $sReturn .= _parseBlogOne($aOne, $status, $aStream, $nCnt, user_content::MODER_BLOGS_UNITED, $groups);
                break;
            case user_content::MODER_ART_COM:
                $sReturn .= _parseArticleCommentOne($aOne, $status, '0', $aStream, $nCnt, user_content::MODER_BLOGS_UNITED);
                break;
            default:
                $sReturn .= '';
                break;
        }
    }
    return $sReturn;
}
示例#13
0
function openlevel($thread, $mod, $begin, $end, $thispage, $blog_thread, $lastlink)
{
    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);
    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" style="width: ' . (670 - ($blog->level > 19 ? 380 : $blog->level * 20)) . 'px;">';
        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 . "&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" 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&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 . "#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;
}
示例#14
0
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();
示例#15
0
function DelBlogSubscribe($thread_id)
{
    require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/blogs.php";
    session_start();
    $uid = $_SESSION['uid'];
    $thread_id = intval($thread_id);
    $objResponse = new xajaxResponse();
    $blog = new blogs();
    if ($uid && $thread_id) {
        $blog->SetMail($thread_id, $uid, 'f');
        $objResponse->assign("blog_subscribe", "innerHTML", "Подписаться на тему");
        $objResponse->script("\$('blog_subscribe').onclick = function(){ xajax_SetBlogSubscribe({$thread_id}); }");
    }
    return $objResponse;
}
示例#16
0
/**
* Публикация черновика
*
* @param    int     $draft_id   ID черновика
* @param    int     $type       Тип черновика
* @param    bool    $is_edit    false - публикация нового поста/прокта, true - публикация существующего поста/проекта
*/
function PostDraft($draft_id, $type, $is_edit = false)
{
    $objResponse = new xajaxResponse();
    session_start();
    $draft_id = intval($draft_id);
    $uid = get_uid(false);
    if ($uid) {
        require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/drafts.php";
        $draft = drafts::getDraft($draft_id, $uid, $type);
        if ($draft) {
            switch ($type) {
                case 2:
                    // Личка
                    require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/attachedfiles.php";
                    $attachedfiles = new attachedfiles($attachedfiles_session);
                    $attachedfiles_tmpdraft_files = drafts::getAttachedFiles($draft_id, 3);
                    if ($attachedfiles_tmpdraft_files) {
                        $attachedfiles_draft_files = array();
                        foreach ($attachedfiles_tmpdraft_files as $attachedfiles_draft_file) {
                            $attachedfiles_draft_files[] = $attachedfiles_draft_file;
                        }
                        $attachedfiles->setFiles($attachedfiles_draft_files);
                    }
                    $objResponse->assign("f_attachedfiles_session", "value", $attachedfiles->getSession());
                    $objResponse->assign("f_msg", "innerHTML", $draft['msg']);
                    $objResponse->assign("f_msg_to", "value", $draft['to_login']);
                    $objResponse->assign("f_draft_id", "value", $draft['id']);
                    $objResponse->assign("f_to_login", "value", $draft['to_login']);
                    $objResponse->script("var attrAction = document.createAttribute('action'); attrAction.value='/contacts/?from=" . $draft['to_login'] . "'; \$('f_frm').setAttributeNode(attrAction);");
                    $objResponse->script('$("f_frm").submit();');
                    break;
                case 3:
                    // Блоги
                    require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/blogs.php";
                    $objResponse->assign("f_draft_id", "value", $draft['id']);
                    $objResponse->assign("f_msg", "value", $draft['msgtext']);
                    $objResponse->assign("f_yt_link", "value", $draft['yt_link']);
                    if ($draft['is_close_comments'] == 't') {
                        $objResponse->script('$("f_is_close_comments").set("checked",true);');
                    }
                    if ($draft['is_private'] == 't') {
                        $objResponse->script('$("f_is_private").set("checked",true);');
                    }
                    $objResponse->assign("f_category", "value", $draft['category'] . '|0');
                    if ($is_edit) {
                        $blogmsg = blogs::GetMsgInfo($draft['post_id'], $error, $perm);
                        $objResponse->assign("f_msg_name", "value", $draft['title']);
                        $objResponse->assign("f_tr", "value", $blogmsg['thread_id']);
                        $objResponse->assign("f_olduser", "value", $blogmsg['fromuser_id']);
                        $objResponse->assign("f_reply", "value", $draft['post_id']);
                        $objResponse->assign("f_action", "value", 'change');
                        $objResponse->assign("f_msg_name", "value", $draft['title']);
                        $objResponse->assign("f_draft_post_id", "value", $draft['post_id']);
                        $objResponse->script("var attrAction = document.createAttribute('action'); attrAction.value='/blogs/view.php?id=" . $draft['post_id'] . "'; \$('f_frm').setAttributeNode(attrAction);");
                    } else {
                        $objResponse->assign("f_name", "value", $draft['title']);
                        $objResponse->assign("f_sub_ord", "value", 'new');
                        $objResponse->assign("f_action", "value", 'new_tr');
                        $objResponse->script("var attrAction = document.createAttribute('action'); attrAction.value='/blogs/viewgroup.php?gr=" . $draft['category'] . "&ord=new&tr='; \$('f_frm').setAttributeNode(attrAction);");
                    }
                    require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/attachedfiles.php";
                    $attachedfiles = new attachedfiles($attachedfiles_session);
                    $attachedfiles_tmpdraft_files = drafts::getAttachedFiles($draft_id, 1);
                    if ($attachedfiles_tmpdraft_files) {
                        $attachedfiles_draft_files = array();
                        foreach ($attachedfiles_tmpdraft_files as $attachedfiles_draft_file) {
                            $attachedfiles_draft_files[] = $attachedfiles_draft_file;
                        }
                        $attachedfiles->setFiles($attachedfiles_draft_files, 1);
                    }
                    $objResponse->assign("f_attachedfiles_session", "value", $attachedfiles->getSession());
                    $objResponse->assign("f_poll_question", "value", $draft['poll_question']);
                    $objResponse->assign("f_poll_type", "value", $draft['poll_type']);
                    $answers = $draft['poll_answers'];
                    if (count($answers)) {
                        $out = '';
                        foreach ($answers as $answer) {
                            $out .= '<input type="hidden" value="' . htmlspecialchars($answer, ENT_QUOTES) . '" name="answers[]" />';
                        }
                        $objResponse->assign("f_poll_answers", "innerHTML", $out);
                    }
                    $objResponse->script('$("f_frm").submit();');
                    break;
                case 4:
                    // Сообщества
                    $objResponse->assign("f_id", "value", $draft['commune_id']);
                    $objResponse->assign("f_draft_id", "value", $draft['id']);
                    $objResponse->assign("f_category_id", "value", intval($draft['category']));
                    $objResponse->assign("f_title", "value", $draft['title']);
                    $objResponse->assign("f_msgtext", "value", $draft['msg']);
                    $objResponse->assign("f_youtube_link", "value", $draft['yt_link']);
                    if ($draft['close_comments'] == 't') {
                        $objResponse->script('$("f_close_comments").set("checked",true);');
                    }
                    if ($draft['is_private'] == 't') {
                        $objResponse->script('$("f_is_private").set("checked",true);');
                    }
                    if ($is_edit) {
                        $objResponse->assign("f_draft_post_id", "value", $draft['post_id']);
                        $objResponse->assign("f_top_id", "value", $draft['post_id']);
                        $objResponse->assign("f_message_id", "value", $draft['post_id']);
                        $objResponse->assign("f_page", "value", 0);
                        $objResponse->script("var attrAction = document.createAttribute('action'); attrAction.value='" . getFriendlyURL('commune', $draft['post_id']) . "'; \$('f_frm').setAttributeNode(attrAction);");
                        $objResponse->assign("f_action", "value", "do.Edit.post");
                    } else {
                        $objResponse->script("var attrAction = document.createAttribute('action'); attrAction.value='" . getFriendlyURL('commune_commune', $draft['commune_id']) . "#o'; \$('f_frm').setAttributeNode(attrAction);");
                        $objResponse->assign("f_action", "value", "do.Create.post");
                    }
                    require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/attachedfiles.php";
                    $attachedfiles = new attachedfiles($attachedfiles_session);
                    if (!$is_edit) {
                        $attachedfiles_tmpdraft_files = drafts::getAttachedFiles($draft_id, 2);
                        if ($attachedfiles_tmpdraft_files) {
                            $attachedfiles_draft_files = array();
                            foreach ($attachedfiles_tmpdraft_files as $attachedfiles_draft_file) {
                                $attachedfiles_draft_files[] = $attachedfiles_draft_file;
                            }
                            $attachedfiles->setFiles($attachedfiles_draft_files, 1);
                        }
                    }
                    $objResponse->assign("f_attachedfiles_session", "value", $attachedfiles->getSession());
                    $objResponse->assign("f_poll_question", "value", $draft['poll_question']);
                    $objResponse->assign("f_poll_type", "value", $draft['poll_type']);
                    $answers = $draft['poll_answers'];
                    if (count($answers)) {
                        $out = '';
                        foreach ($answers as $answer) {
                            $out .= '<input type="hidden" value="' . htmlspecialchars($answer, ENT_QUOTES) . '" name="answers[]" />';
                        }
                        $objResponse->assign("f_poll_answers", "innerHTML", $out);
                    }
                    $objResponse->script('$("f_frm").submit();');
                    break;
            }
        }
    }
    return $objResponse;
}
示例#17
0
            }
            $edit_tr = $edit_id = intval(trim($tr));
            if ($edit_tr) {
                $edit_msg = $blog_obj->GetMsgInfo($edit_tr, $error, $perm);
                if ($edit_msg['fromuser_id'] != get_uid() && $mod) {
                    unset($edit_msg);
                    unset($action);
                    header('Location: ' . getFriendlyURL('blog_group', $gr) . "?t={$t}{$ord_get_part}");
                }
            }
            break;
    }
}
stat_collector::setStamp();
// stamp
$blog = new blogs();
//$thread = $blog->GetThread($thread, $error);
if (!$page) {
    $page = intval(trim($_GET['page']));
}
if ($page < 0) {
    $page = 1;
}
if (!$from) {
    $from = intval(trim($_GET['from']));
}
if (!$page) {
    $page = intval(trim($_POST['page']));
}
if (!$page) {
    $page = 1;
示例#18
0
 /**
  * Отправляет уведомления о редактировании комментария в блоге.
  * 
  * @param   string|array   $message_ids  идентификаторы комментариев.
  * @param   resource       $connect      соединение к БД (необходимо в PgQ) или NULL -- создать новое.
  * @return  integer                      количество отправленных уведомлений.
  */
 function BlogUpdateComment($message_ids, $connect = NULL)
 {
     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/blogs.php";
     require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/messages.php';
     $blogs = new blogs();
     if (!($comments = $blogs->GetComments4Sending($message_ids, $connect))) {
         return NULL;
     }
     $this->subject = "Комментарии в сообществе на сайте FL.ru";
     $userSubscribe = $blogs->getUsersSubscribe($message_ids, $connect, true);
     foreach ($comments as $comment) {
         // Отправляем родителю.
         if (substr($comment['p_subscr'], 2, 1) == '1' && ($comment['p_uid'] != $comment['uid'] || $comment['uid'] != $comment['modified_id']) && $comment['p_email'] && $comment['p_banned'] == '0') {
             $this->message = $this->GetHtml($comment['p_uname'], "\n<a href='{$GLOBALS['host']}/users/{$comment['m_login']}/{$this->_addUrlParams('b')}'>{$comment['m_uname']} {$comment['m_usurname']}</a> [<a href='{$GLOBALS['host']}/users/{$comment['m_login']}{$this->_addUrlParams('b')}'>{$comment['m_login']}</a>]\nотредактировал(а) <a href='{$GLOBALS['host']}/blogs/view.php?tr={$comment['thread_id']}&openlevel={$comment['id']}{$this->_addUrlParams('b', '&')}#o{$comment['id']}'>комментарий</a> к вашим сообщениям/комментариям в сообществе на сайте FL.ru.\n<br /> --------\n<br />" . ($comment['title'] ? $this->ToHtml(LenghtFormatEx(strip_tags($comment['title']), 300)) . "<br />---<br />" : "") . $this->ToHtml(LenghtFormatEx(strip_tags($comment['msgtext']), 300)) . "\n<br /> --------\n<br />\n", array('header' => 'default', 'footer' => 'default'), array('login' => $comment['p_login']));
             $this->recipient = $comment['p_uname'] . " " . $comment['p_usurname'] . " [" . $comment['p_login'] . "] <" . $comment['p_email'] . ">";
             $this->SmtpMail('text/html');
             $notSend[$comment['p_uid']] = $comment['p_uid'];
         }
         // Отправляем автору топика.
         if (substr($comment['t_subscr'], 2, 1) == '1' && ($comment['t_uid'] != $comment['uid'] || $comment['t_uid'] != $comment['modified_id']) && ($comment['t_uid'] != $comment['p_uid'] || $comment['t_uid'] != $comment['modified_id']) && $comment['t_email'] && !$notSend[$comment['t_uid']] && $comment['t_banned'] == '0') {
             $post_type = "<a target='_blank' href='{$GLOBALS['host']}/blogs/view.php?tr={$comment['thread_id']}&openlevel={$comment['id']}{$this->_addUrlParams('b', '&')}#o{$comment['id']}'>комментарий</a> к вашим сообщениям/комментариям";
             if ($comment['reply_to'] == '') {
                 $post_type = "<a target='_blank' href='{$GLOBALS['host']}/blogs/view.php?tr={$comment['thread_id']}&openlevel={$comment['id']}{$this->_addUrlParams('b', '&')}#o{$comment['id']}'>ваше сообщение</a> ";
                 $this->subject = "Блоги FL.ru";
             }
             $this->message = $this->GetHtml($comment['t_uname'], "\n<a href='{$GLOBALS['host']}/users/{$comment['m_login']}{$this->_addUrlParams('b')}'>{$comment['m_uname']} {$comment['m_usurname']}</a> [<a href='{$GLOBALS['host']}/users/{$comment['m_login']}{$this->_addUrlParams('b')}'>{$comment['m_login']}</a>]\nотредактировал(а) {$post_type} в блогах на сайте FL.ru.\n<br /> --------\n<br />" . ($comment['title'] ? $this->ToHtml(LenghtFormatEx(strip_tags($comment['title']), 300)) . "<br />---<br />" : "") . $this->ToHtml(LenghtFormatEx(strip_tags($comment['msgtext']), 300)) . "\n<br /> --------\n<br />\n", array('header' => 'default', 'footer' => 'default'), array('login' => $comment['t_login']));
             $this->recipient = $comment['t_uname'] . " " . $comment['t_usurname'] . " [" . $comment['t_login'] . "] <" . $comment['t_email'] . ">";
             $this->SmtpMail('text/html');
             $notSend[$comment['t_uid']] = $comment['t_uid'];
             $message = "<a href='{$GLOBALS['host']}/users/{$comment['m_login']}{$this->_addUrlParams('b')}'>{$comment['m_uname']} {$comment['m_usurname']}</a> [<a href='{$GLOBALS['host']}/users/{$comment['m_login']}{$this->_addUrlParams('b')}'>{$comment['m_login']}</a>]\nотредактировал(а) {$post_type} в сообществе на сайте FL.ru.\n --------\n\n" . ($comment['title'] ? $this->ToHtml(LenghtFormatEx(strip_tags($comment['title']), 300)) . "\n---\n" : "") . $this->ToHtml(LenghtFormatEx(strip_tags($comment['msgtext']), 300)) . "\n --------";
             messages::Add(users::GetUid($err, 'admin'), $comment['t_login'], $message, '', 1);
         }
     }
     // Посылаем подписавшимся на темы
     if ($userSubscribe) {
         foreach ($userSubscribe as $comment) {
             $this->subject = "Комментарии в сообществе на сайте FL.ru";
             if (substr($comment['s_subscr'], 2, 1) == '1' && !$notSend[$comment['s_uid']] && $comment['s_email']) {
                 $post_type = "<a href='{$GLOBALS['host']}/blogs/view.php?tr={$comment['thread_id']}&openlevel={$comment['id']}{$this->_addUrlParams('b', '&')}#o{$comment['id']}'>комментарий</a> к сообщениям/комментариям в сообществе";
                 $message_template = "subscribe_edit_comment";
                 if ($comment['reply_to'] == '') {
                     $post_type = "<a href='{$GLOBALS['host']}/blogs/view.php?tr={$comment['thread_id']}&openlevel={$comment['id']}{$this->_addUrlParams('b', '&')}#o{$comment['id']}'>пост в сообществе</a> на который вы подписаны";
                     $message_template = "subscribe_edit_post";
                 }
                 $link_title = "<a href='{$GLOBALS['host']}/blogs/view.php?tr={$comment['thread_id']}{$this->_addUrlParams('b', '&')}' target='_blank'>" . ($comment['blog_title'] == '' ? 'Без названия' : $comment['blog_title']) . "</a>";
                 $this->message = $this->GetHtml($comment['s_uname'], "\n<a href='{$GLOBALS['host']}/users/{$comment['m_login']}/{$this->_addUrlParams('b')}'>{$comment['m_uname']} {$comment['m_usurname']}</a> [<a href='{$GLOBALS['host']}/users/{$comment['login']}{$this->_addUrlParams('b')}'>{$comment['m_login']}</a>]\nотредактровал(а) {$post_type} на сайте FL.ru.\n<br /> --------\n<br />" . ($comment['title'] ? $this->ToHtml(input_ref(LenghtFormatEx($comment['title'], 300), 1)) . "<br />---<br />" : "") . $this->ToHtml(input_ref(LenghtFormatEx($comment['msgtext'], 300), 1)) . "\n<br /> --------\n<br />\n", array('header' => $message_template, 'footer' => 'subscribe'), array('type' => 1, 'title' => $link_title));
                 $this->recipient = $comment['s_uname'] . " " . $comment['s_usurname'] . " [" . $comment['s_login'] . "] <" . $comment['s_email'] . ">";
                 $this->SmtpMail('text/html');
                 $message = "Здравствуйте, " . $comment['s_uname'] . ".                \n<a href='{$GLOBALS['host']}/users/{$comment['m_login']}/{$this->_addUrlParams('b')}'>{$comment['m_uname']} {$comment['m_usurname']}</a> [<a href='{$GLOBALS['host']}/users/{$comment['login']}{$this->_addUrlParams('b')}'>{$comment['m_login']}</a>]\nотредактровал(а) {$post_type} на сайте FL.ru.\n--------" . ($comment['title'] ? $this->ToHtml(input_ref(LenghtFormatEx($comment['title'], 300), 1)) . "\n---\n" : "") . $this->ToHtml(input_ref(LenghtFormatEx($comment['msgtext'], 300), 1)) . "\n --------\n ";
                 messages::Add(users::GetUid($err, 'admin'), $comment['s_login'], $message, '', 1);
             }
         }
     }
     return $this->sended;
 }
示例#19
0
    /**
     * Сообщение о блокировке треда в блогах.
     *
     * @param int    $thread_id id треда
     * @param string $reason    причина
     *
     * @return @see messages::Add()
     */
    public function SendBlockedThread($thread_id = 0, $reason)
    {
        require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/blogs.php';
        require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/users.php';
        $msg = new blogs();
        $w_msg = $msg->GetThreadMsgInfo($thread_id, $error, $perm);
        $f_user = new users();
        $f_user->GetUserByUID($w_msg['fromuser_id']);
        $message = "\n{$f_user->uname} {$f_user->usurname}!\n\nМодераторы нашего ресурса нашли ваш блог" . (trim($w_msg['title']) != '' ? ' &laquo;' . $w_msg['title'] . '&raquo;' : '') . ' от ' . date('d.m.Y', strtotimeEx($w_msg['post_time'])) . ' некорректным:

Причина: ' . $reason . '

Мы призываем вас впредь не создавать подобных блогов, иначе модераторы лишат ваш аккаунт доступа к сайту.

Это сообщение было выслано автоматически, и ответ на него не будет рассматриваться.

Надеемся на понимание, Команда Free-lance.ru.';
        self::Add(users::GetUid($err, 'admin'), $f_user->login, $message, '', 1);
    }
示例#20
0
 /**
  * Сообщение о блокировке треда в блогах
  *
  * @param integer  $thread_id   id треда
  * @param string   $reason      причина
  *
  * @return                      @see messages::Add()
  */
 function SendBlockedThread($thread_id = 0, $reason)
 {
     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/blogs.php";
     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/users.php";
     $msg = new blogs();
     $w_msg = $msg->GetThreadMsgInfo($thread_id, $error, $perm);
     $f_user = new users();
     $f_user->GetUserByUID($w_msg['fromuser_id']);
     $message = "\n{$f_user->uname} {$f_user->usurname}!\n\nМодераторы нашего ресурса нашли ваш блог" . (trim($w_msg["title"]) != "" ? " &laquo;" . $w_msg["title"] . "&raquo;" : "") . " от " . date("d.m.Y", strtotimeEx($w_msg["post_time"])) . " некорректным:\n\nПричина: " . $reason . "\n\nМы призываем вас впредь не создавать подобных блогов, иначе модераторы лишат ваш аккаунт доступа к сайту.\n\nЭто сообщение было выслано автоматически, и ответ на него не будет рассматриваться.\n\nНадеемся на понимание, Команда Free-lance.ru.";
     messages::Add(users::GetUid($err, "admin"), $f_user->login, $message, '', 1);
 }
/**
 * Отдает HTML для Редактирование Блоги: посты и комментарии
 * 
 * @param  object $objResponse xajaxResponse
 * @param  string $rec_id идентификатор записи
 * @param  string $rec_type тип записи
 * @param  array $aParams дополнительные параметры. остальные
 * @return string
 */
function _admEditBlogsParseForm(&$objResponse, $rec_id = '', $rec_type = '', $aParams = array())
{
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/blogs.php';
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/attachedfiles.php';
    $error = $perm = null;
    $blogs = new blogs();
    $edit_msg = $blogs->GetMsgInfo($rec_id, $error, $perm);
    $groups = $blogs->GetThemes($error, 1);
    $answers = $edit_msg['poll'] ? $edit_msg['poll'] : array(array('id' => 0, 'answer' => ''));
    ob_start();
    include_once $_SERVER['DOCUMENT_ROOT'] . '/user/adm_edit_tpl/blogs.php';
    $sHtml = ob_get_contents();
    ob_end_clean();
    // аттачи
    $sAttach = getAttachedFilesJs(blogs::getAttachedFiles($rec_id), blogs::MAX_FILES, blogs::MAX_FILE_SIZE, 'blog');
    // текст блога и опрос
    $sOnReady = "if (document.getElementById('adm_edit_question')) {\n        document.getElementById('adm_edit_question').value = document.getElementById('adm_edit_question_source').value;\n        if(document.getElementById('adm_edit_msg')) \n            document.getElementById('adm_edit_msg').value = (\$('adm_edit_msg_source')? \$('adm_edit_msg_source').value : null);\n        poll.init('Blogs', document.getElementById('div_adm_edit'), " . blogs::MAX_POLL_ANSWERS . ", '" . $_SESSION['rand'] . "');\n        maxChars('adm_edit_question', 'adm_edit_question_warn', " . blogs::MAX_POLL_CHARS . ");\n    }\n    else {\n        if(document.getElementById('adm_edit_msg')) \n            document.getElementById('adm_edit_msg').value = (\$('adm_edit_msg_source')? \$('adm_edit_msg_source').value : null);\n    }";
    $objResponse->assign('h4_adm_edit', 'innerHTML', 'Редактировать ' . ($rec_type == '2' ? 'комментарий' : 'сообщение'));
    $objResponse->assign('div_adm_edit', 'innerHTML', $sHtml);
    $objResponse->script("\$('div_adm_reason').setStyle('display', 'none');");
    $objResponse->script("adm_edit_content.editMenuItems = ['', 'Основное', 'Файлы'" . ($rec_type == 1 ? ", 'Опрос'" : '') . "];");
    $objResponse->script('adm_edit_content.edit();');
    $objResponse->script($sAttach);
    $objResponse->script($sOnReady);
    $objResponse->script('xajax_getAdmEditReasons(' . admin_log::ACT_ID_EDIT_BLOGS . ');');
}
示例#22
0
    include ABS_PATH . "/404.php";
    exit;
}
$sTitle = $blog->title;
$sMessage = $blog->msgtext;
if ($err || $blog->msg_num == 0 || $blog->is_private && $blog->deleted && $blog->fromuser_id != $_SESSION['uid'] && !hasPermissions('blogs')) {
    include ABS_PATH . "/404.php";
    exit;
} else {
    if ($blog->thread[0]['read_comments'] != $blog->msg_num - 1 && $uid > 0) {
        $error .= $blog->SetRead($thread, $uid, $blog->msg_num - 1);
    }
    $allow_del = 0;
    $cur_user_msgs = array();
    $multiattach_mode = 1;
    $blog_gr = new blogs();
    $groups = $blog_gr->GetThemes($error, 1);
    if (!$content) {
        $content = "view_cnt.php";
    }
    $FBShare = array("title" => $sTitle, "description" => "", "image" => HTTP_PREFIX . "www.free-lance.ru/images/free-lance_logo.jpg");
}
if ($PDA) {
    if (isset($_GET['newcnt'])) {
        $content = "new_cnt.php";
    }
    if (isset($_GET['editcnt'])) {
        $content = "edit_cnt.php";
    }
}
$footer = $rpath . "footer.html";
示例#23
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;
}
示例#24
0
 /**
  * Вспомогательная функция для получения аттачей и опросов для блогов
  * 
  * @param type $aReturn 
  */
 function _getBlogsAttachPoll(&$aReturn = array())
 {
     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/blogs.php";
     // прикрепленные файлы
     blogs::AddAttach($aReturn);
     // опросы
     foreach ($aReturn as $key => $aOne) {
         if ($aOne['poll_question'] && !$aOne['reply_to']) {
             $aOne['poll'] = $GLOBALS['DB']->rows('SELECT * FROM blogs_poll_answers WHERE thread_id = ? ORDER BY id', $aOne['src_id']);
             $aReturn[$key] = $aOne;
         }
     }
 }
示例#25
0
    	<table class="tbl-projects-draft">
            <colgroup>
        <col width="30" />
				<col width="" />
				<col width="200" />
				<col width="120" />
				<col width="80" />
				<col width="60" />
			</colgroup>
                <?php 
    foreach ($drafts as $draft) {
        ?>
                <?php 
        if ($draft['post_id']) {
            $blogmsg = blogs::GetMsgInfo($draft['post_id'], $error, $perm);
        }
        ?>
                <tr class="b-layout__tr">
					<td class="b-layout__one b-layout__one_bordbot_ccc b-layout__one_padtb_10"><div class="b-check b-check_padleft_10 b-check_top_2"><input id="del_draft_<?php 
        echo $draft['id'];
        ?>
" class="b-check__input" type="checkbox" name="del_draft[]" value="<?php 
        echo $draft['id'];
        ?>
" onClick="DraftsCheckToggleDeleteAll(this);" /></div></td>
					<td class="b-layout__one b-layout__one_bordbot_ccc b-layout__one_padtb_10"><div class="b-layout__txt">
                        <?php 
        if ($is_ban || $draft['is_blocked']) {
            ?>
                        <?php 
示例#26
0
&ord=<?php 
                    echo $bOrd;
                    ?>
">Редактировать</a> |
              <?php 
                }
                ?>
            <?php 
            }
            ?>
          <?php 
        }
        ?>
          <?php 
        $_i = '';
        if (blogs::isBlogSubscribe($thread, $uid) == true && $_SESSION["login"] != $blog->login && $uid && (!$blog->is_blocked && !$closed_comments)) {
            $_i = ' | ';
            ?>
          <a href="javascript:void(1)" id="blog_subscribe" onClick="xajax_DelBlogSubscribe(<?php 
            echo $thread;
            ?>
)">Отписаться от темы</a>
          <?php 
        } elseif ($uid && $_SESSION["login"] != $blog->login && (!$blog->is_blocked && !$closed_comments)) {
            $_i = ' | ';
            ?>
          <a href="javascript:void(1)" id="blog_subscribe" onClick="xajax_SetBlogSubscribe(<?php 
            echo $thread;
            ?>
, 1)">Подписаться на тему</a>
          <?php