/**
  * @see parent::initHtmlData
  */
 public function initHtmlData()
 {
     require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/commune.php';
     $ids = $this->parseLinks();
     if ($ids) {
         $this->html_data = commune::getCommunePostByIds(array_map('intval', $ids));
     }
 }
Example #2
0
                    <?php 
    if ($top['title'] != '') {
        seo_start($ajax_view);
    }
    ?>
                        <?php 
    include TPL_COMMUNE_PATH . '/tpl.user_bar.php';
    ?>
                    <?php 
    if ($top['title'] != '') {
        print seo_end(false, $ajax_view);
    }
    ?>
                </ul>
                <?php 
    if (!commune::isBannedCommune($mod)) {
        include TPL_COMMUNE_PATH . '/admin_bar.php';
    }
    ?>
            <?php 
}
?>
        </div>
        <div class="b-post__time b-page__iphone">
            <?php 
echo date("d.m.Y в H:i", $created_time);
?>
        </div>
    </div><!-- конец топика -->
</div>
<style type="text/css">.msie .b-icon__ver{ position:relative; top:2px}</style>
Example #3
0
 ?>
 </td>
 <td style="padding:0 0 0 20px">
   <div>
     <?php 
 echo $name;
 ?>
   </div>
   <div>
     <?php 
 echo $descr;
 ?>
   </div>
   <div style="margin-top:10px">
     <?php 
 echo commune::GetJoinAccessStr($comm['restrict_type'], true);
 ?>
   </div>
   <div style="margin-top:25px">
     <?php 
 echo $mCnt;
 ?>
   </div>
   <div style="margin-top:4px">
     <?php 
 echo __commPrntAge($comm);
 ?>
   </div>
   <div style="margin-top:15px">
     <?php 
 echo __commPrntJoinButton($comm, $user->uid, 'users/' . $_SESSION['login'] . '/info/', 2);
 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";
 }
Example #5
0
</span><br>
            <table cellpadding="0" cellspacing="0" border="0" class="in-stat-menu" style="display: none; width: 160px" id="in-stat-menu3" onmouseover="hm_open(3)" onmouseout="hm_close(3)">
            <tr><td><a href="/siteadmin/ban-razban/?mode=offers">Жалобы на предложения</a></td></tr>
            </table>
        </td>
        <td><?php 
if ($mode == 'commune') {
    ?>
<strong>Сообщества</strong><?php 
} else {
    ?>
<a href="/siteadmin/ban-razban/?mode=commune">Сообщества</a><?php 
}
?>
 <span><?php 
echo commune::NumsBlockedCommunes();
?>
</span></td>
    </tr>
    </table>
    </td>
</tr>

</table>
<?php 
if ($mode == 'complain') {
    ?>
<!-- Группы "Новые|Принятые|Отклоненные" -->
<div class="b-menu b-menu_tabs b-menu_relative margtop_20 padtop_10 padbot_5">
	<ul class="b-menu__list">
		<li class="b-menu__item<?php 
Example #6
0
/**
 * Отключить все уведомления.
 * 
 * @param int $uid UID пользователя
 *
 * @return object xajaxResponse
 */
function stopNotifications($uid = 0, $role = 'flr')
{
    session_start();
    $objResponse = new xajaxResponse();
    if (hasPermissions('users')) {
        $sClass = $role == 'flr' ? 'freelancer' : 'employer';
        require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/' . $sClass . '.php';
        $users = new $sClass();
        $users->subscr = str_repeat('0', $GLOBALS['subscrsize']);
        if ($role == 'flr') {
            $users->mailer = 0;
            $users->mailer_str = '';
        }
        $sError = $users->Update($uid, $res);
        commune::clearSubscription($uid);
        if (empty($sError)) {
            $objResponse->alert('Уведомления отключены');
        } else {
            $objResponse->alert('Ошибка сохранения данных');
        }
    }
    return $objResponse;
}
                                            <?php 
            //= __commPrntSubmitButton($comm, $uid, null, 'green')
            ?>
                                            <?php 
            // подписка на рассылку
            $subs_mode = 'green';
            $subs_a_style = 'b-button b-button_flat b-button_flat_grey b-button_margbot_10_ipad';
            $subs_span_style = 'b-button__txt';
            if (!$subs_mode) {
                ?>
&nbsp;&nbsp;<?php 
            }
            if ($comm['is_banned'] === 't' || $comm['current_user_join_status'] != commune::JOIN_STATUS_ACCEPTED && $comm['author_uid'] != $uid) {
                // если пользователь забанен или еще не вступил в сообщество
            } else {
                if (commune::isCommuneSubscribed($comm['id'], $uid)) {
                    $subs_onclick = "xajax_SubscribeCommune(" . $comm['id'] . ",false,'{$subs_mode}'); return false;";
                    ?>
                                                    <a href="javascript:void(0)" onclick="<?php 
                    echo $subs_onclick;
                    ?>
" class="<?php 
                    echo $subs_a_style;
                    ?>
">Отписаться</a>
                                                <?php 
                } else {
                    $subs_onclick = "xajax_SubscribeCommune(" . $comm['id'] . ",true,'{$subs_mode}'); return false";
                    if ($subs_mode == 'green') {
                        ?>
                                                        <a href="javascript:void(0)" onclick="<?php 
Example #8
0
}
$utype = commune::MEMBER_ANY | ($mode == 'Asked' ? commune::JOIN_STATUS_ASKED : commune::JOIN_STATUS_ACCEPTED);
if ($user_filter) {
    switch ($user_filter) {
        case 0:
            $utype = commune::MEMBER_ANY | ($mode == 'Asked' ? commune::JOIN_STATUS_ASKED : commune::JOIN_STATUS_ACCEPTED);
            break;
        case 1:
            $utype = commune::MEMBER_ADMIN | commune::MEMBER_MANAGER | commune::MEMBER_MODERATOR;
            break;
        case 2:
            $utype = commune::MEMBER_SIMPLE | ($mode == 'Asked' ? commune::JOIN_STATUS_ASKED : commune::JOIN_STATUS_ACCEPTED);
            break;
    }
}
if (!($members = commune::GetMembers($id, $utype, ($page - 1) * commune::MAX_MEMBERS_ON_PAGE, commune::MAX_MEMBERS_ON_PAGE, pg_escape_string($user_login), $order_by))) {
    $members = array();
}
$uri_joined = '/commune/?id=' . $id . '&site=Admin.members' . ($user_login ? '&search=' . $user_login : '') . ($user_filter ? '&type=' . $user_filter : '');
$uri_ask = $uri_joined . '&mode=Asked';
list($field, $direction) = explode('_', $order_by);
$user_sort = $order_by == 'name_asc' ? 'name_desc' : 'name_asc';
$date_sort = $order_by == 'date_asc' ? 'date_desc' : 'date_asc';
$asked_sort = $order_by == 'asked_asc' ? 'asked_desc' : 'asked_asc';
$name_link = ($mode == 'Asked' ? $uri_ask : $uri_joined) . "&order={$user_sort}";
$date_link = ($mode == 'Asked' ? $uri_ask : $uri_joined) . "&order={$date_sort}";
$asked_link = ($mode == 'Asked' ? $uri_ask : $uri_joined) . "&order={$asked_sort}";
$arrow_name = $field == 'name' ? $direction == 'asc' ? '<img src="/images/sort-asc2.png" alt="">' : '<img src="/images/sort-desc2.png" alt="">' : '';
$arrow_date = $field == 'date' ? $direction == 'asc' ? '<img src="/images/sort-asc2.png" alt="">' : '<img src="/images/sort-desc2.png" alt="">' : '';
$arrow_asked = $field == 'asked' ? $direction == 'asc' ? '<img src="/images/sort-asc2.png" alt="">' : '<img src="/images/sort-desc2.png" alt="">' : '';
?>
Example #9
0
 /**
  * Сообщества. Утверждение/удаление записи
  * 
  * @param  string $stream_id идентификатор потока
  * @param  int $user_id идентификатор модератора
  * @param  int $from_id идентификатор пользователя
  * @param  int $rec_id идентификатор записи
  * @param  int $rec_type тип записи 
  * @param  int $action действие: 1 - утверждено, 2 - удалено
  * @param  string $is_sent было ли отправлено уведомление
  * @param  string $reason причина удаления
  * @return bool true - успех, false - провал
  */
 function resolveCommunity($stream_id = '', $user_id = 0, $from_id = 0, $rec_id = 0, $rec_type = 0, $action = 1, $is_sent = '', $reason = '')
 {
     $bRet = false;
     $sQuery = 'UPDATE moderation SET moder_num = ?i, status = ?i WHERE rec_id = ?i AND rec_type = ?i AND stream_id = ? RETURNING rec_id';
     $sRecId = $GLOBALS['DB']->val($sQuery, $this->nResolveCnt, $action, $rec_id, self::MODER_COMMUNITY, $stream_id);
     if ($sRecId) {
         $bRet = true;
         if ($rec_type == 1) {
             // топик
             $GLOBALS['DB']->update('commune_messages', array('moderator_status' => $user_id, 'mod_access' => 1), 'id = ?i', $rec_id);
             require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/commune.php';
             require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/admin_log.php';
             $commune = new commune();
             $topic = commune::GetTopMessageByAnyOther($rec_id, $user_id, commune::MOD_ADMIN);
             $sObjName = $topic['title'];
             $sObjLink = getFriendlyURL('commune', $rec_id);
             if ($action == 1 && $topic['is_blocked_s'] == 't') {
                 //утверждаем
                 $commune->unblockedCommuneTheme($topic['theme_id']);
                 admin_log::addLog(admin_log::OBJ_CODE_COMM, 16, $from_id, $topic['theme_id'], $sObjName, $sObjLink, 0, '', 0, '');
             } elseif ($action == 2 && $topic['is_blocked_s'] != 't') {
                 $commune->blockedCommuneTheme($topic, $reason, 0, $user_id, true);
                 admin_log::addLog(admin_log::OBJ_CODE_COMM, 15, $from_id, $topic['theme_id'], $sObjName, $sObjLink, 0, '', 0, $reason, $topic['theme_id']);
             }
         } else {
             // комментарий
             $aData = array('moderator_status' => $user_id, 'mod_access' => 1);
             if ($action == 1 && $is_sent == 'f') {
                 // отправка уведомления о новом сообщении
                 /*require_once( $_SERVER['DOCUMENT_ROOT'] . '/classes/pmail.php' );
                 
                                     $pmail = new pmail;
                                     $pmail->CommuneNewComment( $rec_id );*/
                 $aData['is_sent'] = true;
                 // устанавливаем флаг отправки
             }
             $aRow = $GLOBALS['DB']->row('SELECT theme_id, deleted_id FROM commune_messages WHERE id = ?i', $rec_id);
             require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/comments/CommentsCommune.php';
             $comments = new CommentsCommune($aRow['theme_id']);
             if ($action == 1 && $aRow['deleted_id'] && $aRow['deleted_id'] != $from_id) {
                 $comments->restore($rec_id);
             } elseif ($action == 2 && $aRow['deleted_id'] != $from_id) {
                 $comments->delete($rec_id, $from_id, true);
                 $aData['deleted_reason'] = $reason;
             }
             $GLOBALS['DB']->update('commune_messages', $aData, 'id = ?i', $rec_id);
         }
     }
     return $bRet;
 }
Example #10
0
        $vacancy = 0;
        if ($info['role'][0] == 0) {
            $class = 'freelancer';
            $vacancy = array();
        }
        $user = new $class();
        global $DB;
        if ($type == 'new_projects') {
            if ($info['role'][0] == 1) {
                //@todo: UpdateSubscr2 пока только для работодателей
                $info['subscr'][12] = 0;
                $user->UpdateSubscr2($info['uid'], $info['subscr']);
            } else {
                //@todo: жуть медот :)
                $user->UpdateSubscr($info['uid'], $info['subscr'][0], $vacancy, $info['subscr'][2], $info['subscr'][3], $info['subscr'][4], $info['subscr'][5], $info['subscr'][6], $info['subscr'][7], $info['subscr'][8], $info['subscr'][9], $info['subscr'][10], $info['subscr'][11], $info['subscr'][12], $info['subscr'][13], $info['subscr'][14], 0, $info['subscr'][15]);
            }
        } elseif ($type == 'mailer') {
            $info['subscr'][7] = 0;
            $user->UpdateSubscr2($info['uid'], $info['subscr']);
        } else {
            $user->UpdateSubscr($info['uid'], 0, $vacancy, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
            commune::clearSubscription($info['uid']);
        }
        $content = ABS_PATH . '/unsubscribe/success.php';
    }
}
if (!$captcha) {
    $captcha = new captcha($captchanum);
}
$css_file = '/css/block/b-captcha/b-captcha.css';
include ABS_PATH . '/template3.php';
Example #11
0
}
if (isset($_GET['bp'])) {
    $_GET['bp'] = intval($_GET['bp']);
}
if (isset($_GET['pagefrom'])) {
    $_GET['pagefrom'] = intval($_GET['pagefrom']);
}
if (isset($_POST['pagefrom'])) {
    $_POST['pagefrom'] = intval($_POST['pagefrom']);
}
if (BLOGS_CLOSED == true && $_GET['tr']) {
    require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/commune.php";
    $commune_theme = commune::getCommunePostByThreadID(intval($_GET['tr']));
    $http_query = "";
    if (isset($_GET['openlevel'])) {
        $comment_id = commune::getCommuneMessageByBlogID(intval($_GET['openlevel']));
        if ($comment_id) {
            $http_query = "#c_{$comment_id}";
        }
    }
    $url_redirect = getFriendlyUrl('commune', $commune_theme);
    if (trim($url_redirect) == "") {
        $url_redirect = "/404.php";
    } else {
        $url_redirect = $url_redirect . $http_query;
    }
    header("Location: " . $url_redirect);
    exit;
}
$action = trim($_POST['action']);
if (!$action) {
Example #12
0
 $attachedfiles_session = $_POST['attachedfiles_session'];
 $attachedfiles = new attachedfiles($attachedfiles_session);
 if ($draft_id) {
     if (!$attachedfiles_session) {
         $attachedfiles_tmpdraft_files = drafts::getAttachedFiles($draft_id, 2);
         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.post' && !$alert) {
         $attachedfiles_tmpblog_files = commune::getAttachedFiles($top['id']);
         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";
Example #13
0
 /**
  * Отсылаем уведомление о бане пользователя в сообществе
  * @see trigger "aIU commune_members/mail"
  * 
  * @param array $ids     Список заблокированных
  * @param type $connect
  */
 public function CommuneMemberBan($ids, $connect = NULL)
 {
     if (!is_array($ids)) {
         return;
     }
     require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/users.php';
     require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/commune.php';
     foreach ($ids as $id) {
         list($user_id, $commune_id) = explode("-", $id);
         $user = new users();
         $user->GetUserByUID($user_id);
         if (!$user->email || substr($user->subscr, 5, 1) != '1' || $user->is_banned == '1') {
             continue;
         }
         $comm_link = $GLOBALS['host'] . '/commune/?id=' . $commune_id;
         $comm = commune::getCommuneInfoForFriendlyURL($commune_id);
         $this->subject = "Вас заблокировали в сообществе ";
         $body = $this->subject . ' «<a href="' . $comm_link . $this->_addUrlParams('b', '&') . '">' . $this->ToHtml($comm['name'], 1) . '</a>». ';
         $this->subject .= "«{$comm['name']}»";
         $body .= "К сожалению, теперь вы не можете создавать новые темы и оставлять комментарии в сообществе.";
         $this->recipient = $user->uname . ' ' . $user->usurname . ' [' . $user->login . '] <' . $user->email . '>';
         $this->message = $this->GetHtml($user->uname, $body, array('header' => 'default', 'footer' => 'default'), array('login' => $user->login));
         $this->send('text/html');
     }
     return $this->sended;
 }
Example #14
0
<?php

global $id, $comm, $site, $page;
$user_login = __paramInit('string', 'search', NULL);
// Все админы (модераторы, упрявляторы).
if (!$page || (int) $page == 1) {
    if (!($admins = commune::GetMembers($id, commune::MEMBER_ADMIN | commune::JOIN_STATUS_ACCEPTED))) {
        // Хотя модераторы всегда is_accepted.
        $admins = array();
    }
}
$search_string = preg_replace("/\\s/i", "|", $user_login);
if (!($members = commune::GetMembers($id, $user_login == NULL ? commune::MEMBER_SIMPLE | commune::JOIN_STATUS_ACCEPTED : commune::MEMBER_ANY, ($page - 1) * commune::MAX_MEMBERS_ON_PAGE, commune::MAX_MEMBERS_ON_PAGE, $search_string))) {
    $members = array();
}
//  if(!($members_t = commune::GetMembers($id,
//                                      commune::MEMBER_ANY | commune::JOIN_STATUS_ACCEPTED,
//                                      //commune::MEMBER_SIMPLE | commune::JOIN_STATUS_ACCEPTED,
//                                      ($page-1) * commune::MAX_MEMBERS_ON_PAGE,
//                                      commune::MAX_MEMBERS_ON_PAGE,
//                                      $user_login
//                                     )))
//    $members_t = array();
//
//  $members = array();
//  foreach ($members_t as $member){
//      if($comm['user_id'] == $member['user_id']){
//          $members['creator'][] = $member;
//      }elseif($member['is_admin'] == 't' || $member['is_manager'] == 't' || $member['is_moderator'] == 't'){
//          $members['admins'][] = $member;
//      }else{
Example #15
0
    /**
     * Отправляет уведомления о новых темах в сообществе. Вызывается из hourly.php раз в час.
     */
    public function CommuneNewTopic()
    {
        require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/commune.php';
        if (!($topics = commune::GetTopic4Sending('ALL', true))) {
            return;
        }
        foreach ($topics as $top) {
            if (!($recs = commune::GetTopicSubscribers($top['commune_id']))) {
                continue;
            }
            $this->subject = 'Новая тема в сообществе «' . $top['commune_name'] . '»';
            $domain = $GLOBALS['host'];
            $body = "<a href=\"{$domain}/users/{$top['user_login']}\">{$top['user_uname']} {$top['user_usurname']}</a> [<a href=\"{$domain}/users/{$top['user_login']}\">{$top['user_login']}</a>] создал(-а) <a href=\"{$GLOBALS['host']}/commune/?id={$top['commune_id']}&site=Topic&post={$top['id']}{$this->_addUrlParams('b', '&')}\">новую тему</a> в сообществе «<a href=\"{$GLOBALS['host']}/commune/?id={$top['commune_id']}{$this->_addUrlParams('b', '&')}\">" . $this->ToHtml($top['commune_name'], 1) . '</a>».
<br/><br/>
--------
<br/>' . $top['title'] . '
<br/>' . reformat(LenghtFormatEx(strip_tags($top['msgtext'], '<br><p>'), 300)) . '
<br/>
<br/>
--------';
            if (commune::SetTopicIsSent($top['theme_id'])) {
                if (!$this->Connect()) {
                    return 'Невозможно соеденится с SMTP сервером';
                }
                foreach ($recs as $r) {
                    if ($top['user_login'] != $r['login']) {
                        $this->recipient = $r['uname'] . ' ' . $r['usurname'] . ' [' . $r['login'] . '] <' . $r['email'] . '>';
                        if (!$r['unsubscribe_key']) {
                            $r['unsubscribe_key'] = users::GetUnsubscribeKey($r['login']);
                        }
                        $this->message = $this->GetHtml($r['uname'], $body, array('header' => 'default', 'footer' => 'default'), array('login' => $r['login'], 'UNSUBSCRIBE_KEY' => $r['unsubscribe_key']));
                        $this->SmtpMail('text/html');
                    }
                }
            }
        }
    }
Example #16
0
<?php

if (!$_in_setup) {
    header('HTTP/1.0 403 Forbidden');
    exit;
}
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/commune.php';
$commune = new commune();
$uid = get_uid();
if (!($communes_my = commune::GetCommunes(NULL, $uid, NULL, commune::OM_CM_MY))) {
    $communes_my = array();
}
if (!($communes = commune::GetCommunes(NULL, NULL, $uid, commune::OM_CM_JOINED, $uid))) {
    $communes = array();
}
foreach ($communes_my as $cm) {
    $communes[] = $cm;
}
$c_signed = $commune->getSubscribedCommunes($uid);
?>
<form action="." method="post" id="subscr_form">
    <div class="b-layout b-layout_padtop_20">
        <h2 class="b-layout__title">Настройки уведомлений</h2>
        <?php 
echo view_info2($info_msg);
?>
        <p class="b-layout__txt b-layout__txt_padbot_10">Присылать по электронной почте следующие уведомления:</p>
        <input type="hidden" name="action" value="update_subscr" />
        <ul class="settings-subscribe">
            
            <li><label><input type="checkbox" id="ch13" name="spm" value="1" <?php 
    $question = $draft_data['poll_question'];
    $multiple = $draft_data['poll_type'] == 0 ? 'f' : 't';
    $draft_answers = $draft_data['poll_answers'];
    if (empty($draft_answers)) {
        $draft_answers = array('');
    }
    $edit_msg['poll'] = array();
    if ($draft_answers) {
        foreach ($draft_answers as $draft_answer) {
            array_push($edit_msg['poll'], array('answer' => htmlspecialchars($draft_answer)));
        }
    }
    $answers = $edit_msg['poll'];
}
if (!isset($user_mod)) {
    if ($uStatus = commune::GetUserCommuneRel($id, get_uid())) {
        $user_mod |= commune::MOD_COMM_MODERATOR * $uStatus['is_moderator'];
        $user_mod |= commune::MOD_COMM_MANAGER * $uStatus['is_manager'];
        $user_mod |= commune::MOD_COMM_ADMIN * ($uStatus['is_admin'] || $uStatus['is_moderator'] || $uStatus['is_manager']);
        $user_mod |= commune::MOD_COMM_AUTHOR * $uStatus['is_author'];
        $user_mod |= commune::MOD_COMM_ASKED * $uStatus['is_asked'];
        $user_mod |= commune::MOD_COMM_ACCEPTED * ($uStatus['is_accepted'] || $user_mod & commune::MOD_COMM_ADMIN);
        $user_mod |= commune::MOD_COMM_BANNED * $uStatus['is_banned'];
    }
    $mod = $user_mod;
}
$is_comm_admin = $user_mod & (commune::MOD_COMM_ADMIN | commune::MOD_COMM_MODERATOR);
$is_author = $user_mod & commune::MOD_COMM_AUTHOR;
?>

<form <?php 
Example #18
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;
}
Example #19
0
/**
* Восстановить удаленный пост.
*
* @param string $backto             идентификатор блока
* @param string $message_id         идентификатор записи в базе данных
* @param uint   $user_id            идентификатор пользователя
* @param string $mod                режим
* @param string $page               номер страницы
* @param string $om                 нужен для прохода по страницам, возвратам, переходам
* @param string $site               $site==NULL|'Commune' -- топик выводится на странице сообщества (/commune/),
*                                   $site=='Topic' -- на странице комментариев (/commune/?site=Topic),
*                                   $site=='Lenta' -- в ленте (/lenta/).
* @param string $isFav              находится в закладка пользователя $user_id или нет.
**/
function restoreDeletedPost($backto, $message_id, $user_id, $mod, $page, $om, $site, $is_fav)
{
    $objResponse = new xajaxResponse();
    if (hasPermissions('adm')) {
        commune::RestoreMessage($message_id);
        $objResponse->script("commune_RestoreMessage('{$backto}', '{$message_id}', '{$user_id}', '{$mod}', '{$page}', '{$om}', '{$site}', '{$is_fav}');");
    }
    return $objResponse;
}
Example #20
0
 /**
  * Пользовательский иммунитет у команды, топики нельзя заблокировать.
  * 
  * @staticvar array $is_immunity
  *
  * @param int   $uid    Ид Пользователя
  * @param array $data   Данные пользователя если имеются
  * @param int   $msg_id ID сообщения
  *
  * @return bool
  */
 public static function isImmunity($uid, $data = array(), $msg_id = null)
 {
     static $is_immunity;
     if (isset($is_immunity[$uid])) {
         return $is_immunity[$uid];
     }
     $commune_id = commune::getCommuneIDByMessageID($msg_id);
     $status = commune::GetUserCommuneRel($commune_id, $uid);
     if (empty($data)) {
         require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/users.php';
         $user = new users();
         $user->GetUserByUID($uid);
         $is_immunity[$uid] = $user->is_team == 't' || strtolower($user->login) == 'admin' || $status['is_moderator'] == 1 || $status['is_admin'] == 1 || $status['is_author'] == 1;
     } else {
         $is_immunity[$uid] = $data['is_team'] == 't' || strtolower($data['login']) == 'admin' || $status['is_moderator'] == 1 || $status['is_admin'] == 1 || $status['is_author'] == 1;
     }
     return $is_immunity[$uid];
 }
Example #21
0
}
//@todo: непон¤тно дл¤ чего?
//если юзер провисел 10 сек с момента публикации
//то помечаем его как просмотренный хот¤ его мог никто и неувидеть!
$pp = new pay_place();
$pp->getDoneShow(0);
$user_content = new user_content();
$user_content->releaseDelayedStreams();
$user_content->getQueueCounts();
$user_content->getStreamsQueueCounts();
if (date('i') % 5 == 0) {
    walletAlpha::checkProgressOrders();
}
//  аждые 20 минут пересчитываем счетчики остальных сообществ
if (date('i') % 20 == 0) {
    commune::recalcThemesCountCommunes(null, commune::COMMUNE_BLOGS_ID);
}
if (date('i') % 15 == 0) {
    // проверка статусов платежей paymaster при возврате
    require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/pmpay.php";
    $pm = new pmpay();
    if (DEBUG) {
        $pm->setDebugUrl($GLOBALS['host'] . '/norisk2/admin/pm-server-test.php');
    }
    $pm->checkRefund();
}
if (SERVER === 'release') {
    /*
     * @todo: https://beta.free-lance.ru/mantis/view.php?id=29134#c87337
     * 
    require_once($_SERVER['DOCUMENT_ROOT'] . "/classes/qiwipay.php");
Example #22
0
<?php

if (!defined('IS_SITE_ADMIN')) {
    header("Location: /404.php");
    exit;
}
$comm_obj = new commune();
$communes = $comm_obj->GetBlockedCommunes($nums, $error, $page, $sort, $search, $admin);
if ($action && $_POST["u_token_key"] != $_SESSION["rand"]) {
    header("Location: /404.php");
    exit;
}
switch ($action) {
    case 'unblocked':
        $comm_obj->UnBlocked(intval($_GET['comm']));
        header("Location: /siteadmin/ban-razban/?mode={$mode}" . ($page ? "&p={$page}" : '') . ($search ? "&search={$search}" : '') . ($admin ? "&admin={$admin}" : '') . ($sort ? "&sort={$sort}" : ''));
        exit;
        break;
}
$css_file = array('nav.css', 'moderation.css');
include $rpath . 'template.php';
Example #23
0
<?php

if (!defined('IS_SITE_ADMIN')) {
    header('Location: /404.php');
    exit;
}
if (!(hasPermissions('adm') && hasPermissions('communes'))) {
    exit;
}
if (!($groups = commune::GetGroups())) {
    $groups = array();
}
$grpCnt = count($groups);
?>
<script type="text/javascript">

  function reOrder(__this, direct)
  {
    var oCurr = __this.offsetParent.parentNode;
    var tbl = oCurr.parentNode;
    var thisIndex = oCurr.rowIndex;
    var prev = tbl.rows.item(thisIndex + direct);
    var nCurr = prev.cloneNode(true);
    tbl.replaceChild(oCurr, prev);
    var newx = tbl.insertRow(thisIndex);
    tbl.replaceChild(nCurr, newx);
    var oCells = oCurr.cells;
    var nCells = nCurr.cells;
    var oUp = oCells.item(2);
    var nUp = nCells.item(2);
    var oDown = oCells.item(3);
Example #24
0
<?php

////////////
global $id, $comm, $alert, $user_mod;
// Все админы (модераторы, упрявляторы).
if (!($admins = commune::GetMembers($id, commune::MEMBER_ADMIN | commune::JOIN_STATUS_ACCEPTED))) {
    // Хотя модераторы всегда is_accepted.
    $admins = array();
}
$adminCnt = count($admins);
?>

  <table border="0" width="100%" cellpadding="0" cellspacing="0">
    <tr valign="middle">
      <td>
        <h1><a style="color:#666" href="?id=<?php 
echo $comm['id'];
?>
">Сообщество &laquo;<?php 
echo $comm['name'];
?>
&raquo;</a></h1>
      </td>
    </tr>
  </table>

  <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr valign="top">
      <td height="400" bgcolor="#FFFFFF" class="box commune" style="padding:35px 25px 20px 30px">
        <table border="0" width="100%" cellpadding="0" cellspacing="0">
          <col style="width:100px"/>
/**
 * Отдает HTML для Редактирование поста в сообществах
 * 
 * @param  object $objResponse xajaxResponse
 * @param  string $rec_id идентификатор записи
 * @param  string $rec_type тип записи
 * @param  array $aParams дополнительные параметры с UID отправителя. остальные - опционально
 * @return string
 */
function _admEditCommunityPostParseForm(&$objResponse, $rec_id = '', $rec_type = '', $aParams = array())
{
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/commune.php';
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/attachedfiles.php';
    $mess = commune::GetMessage(intval($rec_id));
    $answers = $mess['answers'] ? $mess['answers'] : array(array('id' => 0, 'answer' => ''));
    $sub_cat = commune::getCategories($mess['commune_id'], true);
    $uid = $_SESSION['uid'];
    $id = $mess['commune_id'];
    $top_id = $rec_id;
    $site = 'Topic';
    $reloc = __commShaolin($error, $comm, $top, $restrict_type, $user_mod);
    $is_comm_admin = $user_mod & (commune::MOD_COMM_ADMIN | commune::MOD_COMM_MODERATOR);
    $is_author = $user_mod & commune::MOD_COMM_AUTHOR;
    $_SESSION['wysiwyg_inline_files'] = array();
    // !!!TODO: что то сделать, когда будут готовы новые сообщества
    ob_start();
    include_once $_SERVER['DOCUMENT_ROOT'] . '/user/adm_edit_tpl/community.php';
    $sHtml = ob_get_contents();
    ob_end_clean();
    // аттачи
    $sAttach = getAttachedFilesJs(commune::getAttachedFiles($rec_id), commune::MAX_FILES, commune::MAX_FILE_SIZE, 'commune');
    // опрос
    $sOnReady = "\n        if(document.getElementById('adm_edit_msg')) document.getElementById('adm_edit_msg').value = (\$('adm_edit_msg_source')? \$('adm_edit_msg_source').value : null);\n        parent.window['adm_edit_ckeditor'] = CKEDITOR.replace('adm_edit_msg');\n        document.getElementById('adm_edit_question').value = document.getElementById('adm_edit_question_source').value;\n        poll.init('Blogs', document.getElementById('div_adm_edit'), " . commune::POLL_ANSWERS_MAX . ", '" . $_SESSION['rand'] . "');\n        maxChars('adm_edit_question', 'adm_edit_question_warn', " . commune::POLL_ANSWER_CHARS_MAX . ");";
    $objResponse->assign('h4_adm_edit', 'innerHTML', 'Редактировать сообщение');
    $objResponse->assign('div_adm_edit', 'innerHTML', $sHtml);
    $objResponse->script("\$('div_adm_reason').setStyle('display', 'none');");
    $objResponse->script("adm_edit_content.editMenuItems = ['', 'Основное', 'Файлы', 'Опрос'];");
    $objResponse->script('adm_edit_content.edit();');
    $objResponse->script($sAttach);
    $objResponse->script($sOnReady);
    $objResponse->script('xajax_getAdmEditReasons(' . admin_log::ACT_ID_EDIT_COMMUNITY . ');');
}
Example #26
0
    /**
     * Сообщение автору комментария в сообществе об изменении комментария.
     *
     * @param type $w_msg
     */
    public function sendCommuneCommentEditedWarn($comment)
    {
        require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/users.php';
        require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/commune.php';
        $user_data = commune::GetUserCommuneRel($comment['resource_id'], get_uid(0));
        $f_user = new users();
        $f_user->GetUserByUID($comment['author']);
        if ($user_data['is_author']) {
            $deleter = 'создателем сообщества';
        } elseif ($user_data['is_moderator']) {
            $deleter = 'модератором сообщества';
        } else {
            $deleter = 'модератором сайта';
        }
        if (!$user_data['is_author'] && !$user_data['is_moderator']) {
            $attention = 'Мы призываем вас впредь не нарушать правила портала, иначе модераторы лишат ваш аккаунт доступа к сайту.
    
';
        }
        $message = "\nЗдравствуйте, {$f_user->uname} {$f_user->usurname}\n\nВаш комментарий {$comment['link']} от " . date('d.m.Y', strtotime($comment['created_time'])) . " был отредактирован {$deleter}.\n    \n" . $attention . 'Это сообщение было выслано автоматически, и ответ на него не будет рассматриваться.

Команда Free-lance.ru.';
        self::Add(users::GetUid($err, 'admin'), $f_user->login, $message, '', 1);
    }
Example #27
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;
}
Example #28
0
}
/*if($fuid)
  $uid = users::GetUidByFUID($fuid);
else {
  if($suid && ($fuid=users::SetUserFUID($suid)))
    header("Location: /rss/commune.php?id={$id}&u={$fuid}");
  exit;
}*/
//if(!$uid || !$fuid) exit;
//if($suid && $suid!=$uid) exit;
$reloc = __commShaolin($error, $comm, $top, $restrict_type, $user_mod);
if (!$comm || $comm['restrict_type'] !== '00' && !$suid) {
    exit;
}
if (!$reloc && !$error && $comm) {
    $topics = commune::GetTopMessages($id, NULL, NULL, 0, commune::OM_TH_NEW, 0, commune::MAX_TOP_ON_PAGE, false, false);
}
if (!$topics) {
    $topics = array();
}
header("Content-type: application/rss+xml");
print '<?xml version="1.0" encoding="windows-1251"?>';
?>
<!--  RSS generated by FL.ru RSS Generator on <?php 
echo gmdate("D, d M Y H:i:s");
?>
 GMT -->
<rss version="2.0">
<channel>
  <title>Сообщество &#171;<?php 
echo xmloutofrangechars($comm['name']);
Example #29
0
$log->TRACE(payed::getPROEnding(false, 3));
// За 3 дня для тех у кого не включено автопродление
$log->TRACE(payed::getPROEnding(false, 1));
// За 1 день для тех у кого не включено автопродление
//@todo: пока отключаем уведомления об автопродлении ПРО так как отключили автопродление
//@todo: тут еще и пытается продлить
//$log->TRACE( payed::checkAutoPRO());
// рассылаем email для тех у кого включено автопродление PRO и он закончится через 1 день
// @todo: пока автопродление не используется
// @todo: кстати непонятно зачем отдельный метод если getPROEnding справяется с этой задачей?
//$log->TRACE( payed::AlertPROEnding() );
//------------------------------------------------------------------------------
// Функция автоподьема проектов если в них в течении 2х дней не было ни одного ответа
$log->TRACE(projects::autoSetTopProject());
// Раз в час пересчитываем счетчики сообществ (пересчитываем только сообщество "Общение")
$log->TRACE(commune::recalcThemesCountCommunes(commune::COMMUNE_BLOGS_ID));
if (date('H') == 1) {
    $log->TRACE($mail->SendWarnings());
    // Отправляет предупреждению юзеру о том, что аккаунт ПРО истекает в ближайшие дни.
    $temp = new users();
    $rpath = '';
    $log->TRACE($temp->DropInactive());
    // Пишем статистику для админки #0003426
    $log->TRACE(stats::writeGeneralStat());
    // Пересчет цен работ фрилансеров в портфолио
    $log->TRACE(professions::calcAvgPrices());
}
if (date('H') == 2) {
    $log->TRACE($mail->ContestReminder());
    $log->TRACE($mail->ContestEndReminder());
    // отмена не оплаченных заказов
Example #30
0
     //		else $vacan = 0;
     $vacan = array();
     if (is_array($_POST['cats'])) {
         foreach ($_POST['cats'] as $key => $value) {
             $vacan[] = array('category_id' => (int) $value, 'subcategory_id' => !empty($_POST['subcats'][$key]) ? (int) $_POST['subcats'][$key] : 0);
         }
     }
     // сообщества
     $comm = !empty($_POST['comm']) ? array_map('intvalPgSql', $_POST['comm']) : false;
     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/commune.php";
     if (!empty($_POST['commune_topics'])) {
         $cm = new commune();
         $cm->clearSubscription($uid);
         $cm->setCommunesSubscription($comm, $uid, true);
     } else {
         $cm = new commune();
         $cm->clearSubscription($uid);
     }
     // сообщества
     $frl = new freelancer();
     $error .= $frl->UpdateSubscr($uid, $newmsgs, $vacan, $comments, $opin, $prcomments, $commune_subscr, $commune_top_subscr, __paramInit('bool', NULL, 'adm_subscr'), __paramInit('bool', NULL, 'contest'), __paramInit('bool', NULL, 'team'), 0, $articlescomments, $massending, 0, $daily_news, __paramInit('bool', NULL, 'vacan'), __paramInit('bool', NULL, 'payment'));
     if (!$error) {
         $membuff = new memBuff();
         $membuff->flushGroup('massending_calc');
         $info_msg = "Изменения внесены";
     }
     break;
 case "inform_change":
     foreach ($_POST as $key => $value) {
         if (!is_array($value)) {
             $_POST[$key] = stripslashes($value);