Example #1
0
function JS_Obj($login, $files)
{
    $CFile = new CFile();
    $result = '';
    if (is_array($files)) {
        for ($i = 0; $i < count($files); $i++) {
            $CFile->GetInfo('users/' . substr($login, 0, 2) . '/' . $login . '/upload/' . $files[$i]['fname']);
            $result .= ',{name: "' . addslashes($CFile->fname) . '", path: "' . addslashes($CFile->path) . '", user: "******", size: ' . $CFile->size . ', mb_size: "' . ConvertBtoMB($CFile->size) . '", ';
            $result .= 'ftype: "' . addslashes($CFile->getext()) . '", id: ' . intval($files[$i]['id']) . ' }';
        }
    } elseif ($files) {
        $CFile->GetInfo('users/' . substr($login, 0, 2) . '/' . $login . '/upload/' . $files);
        $result .= ',{name: "' . addslashes($CFile->fname) . '", path: "' . addslashes($CFile->path) . '", user: "******", size: ' . $CFile->size . ', mb_size: "' . ConvertBtoMB($CFile->size) . '", ';
        $result .= 'ftype: "' . addslashes($CFile->getext()) . '", id: ' . intval($CFile->id) . ' }';
    }
    return $result ? '[' . substr($result, 1) . ']' : '[]';
}
Example #2
0
 /**
  * Выводит икону и задданный внешний URL для определенного файла
  *
  * @param string  $ulogin   	Логин пользователя
  * @param string  $filename 	Имя файла 
  * @param string  $dir      	Папка файла
  * @param string  $url		 	Ссылка на файл
  * @param integer $bigtext  	Вместо иконкки будет большой текст расширения файла(TXT, PDF, etc...) если переменная принимает значение 1
  * @return string HTML-code
  */
 function viewattachExternal($ulogin, $filename, $dir, $url, $bigtext = 0)
 {
     $l_dir = substr($ulogin, 0, 2) . "/" . $ulogin;
     $cfile = new CFile("users/{$l_dir}/" . $dir . "/" . $filename);
     if (!$cfile->size) {
         return "";
     }
     $ext = $cfile->getext($filename);
     $ico = getICOFile($ext, true);
     echo $ico;
     $fsize = ConvertBtoMB($cfile->size);
     return '<p><img src="/pda/images/mime/' . $ico . '.png" alt="' . $ext . '" width="18" height="16"> <a href="' . $url . '" target="_blank">Скачать</a> | ' . ucfirst($ext) . ', ' . $fsize . ' </p>';
 }
Example #3
0
 if (!preg_match("/^[a-zA-Z0-9_-]*\$/", $frl->lj_1)) {
     $error_flag = 1;
     $alert[71] = "Поле заполнено некорректно";
 }
 $frl->lj_2 = change_q(substr(trim($_POST['lj_2']), 0, 64), true);
 if (!preg_match("/^[a-zA-Z0-9_-]*\$/", $frl->lj_2)) {
     $error_flag = 1;
     $alert[72] = "Поле заполнено некорректно";
 }
 $frl->lj_3 = change_q(substr(trim($_POST['lj_3']), 0, 64), true);
 if (!preg_match("/^[a-zA-Z0-9_-]*\$/", $frl->lj_3)) {
     $error_flag = 1;
     $alert[73] = "Поле заполнено некорректно";
 }
 // more lj
 $ext = $resume->getext();
 $frl->blocks = '1' . intval(trim($_POST['showkonk'])) . intval(trim($_POST['showcls'])) . intval(trim($_POST['showempl'])) . intval(trim($_POST['showfrl'])) . intval(trim($_POST['showmyrec'])) . intval(trim($_POST['showcommune'])) . intval(trim($_POST['showjoincommune']));
 //данные об языках пользователя
 $user_langs = array();
 if (is_array($_POST["langs"])) {
     foreach ($_POST["langs"] as $key => $item) {
         $user_lang["id"] = (int) $item;
         if ($user_lang["id"] == 0) {
             continue;
         }
         if (is_array($_POST["lang-q"])) {
             $user_lang["quality"] = (int) $_POST["lang-q"][$key] > 0 ? (int) $_POST["lang-q"][$key] : 2;
         }
         $user_langs[$user_lang["id"]] = $user_lang;
     }
 }
Example #4
0
 /**
  *  Добавление/удаление файлов к рассылке
  * @param array   $files   Список файлов
  * @param integer $id      Ид рассылки
  */
 public function addAttachedFiles($files, $id)
 {
     if ($files) {
         foreach ($files as $file) {
             switch ($file['status']) {
                 case 4:
                     // Удаляем файл
                     $this->delAttach($file['id']);
                     break;
                 case 1:
                     // Добавляем файл
                     $cFile = new CFile($file['id']);
                     $cFile->table = 'file_mailer';
                     $ext = $cFile->getext();
                     $tmp_name = $cFile->secure_tmpname(self::FILE_DIR, '.' . $ext);
                     $tmp_name = substr_replace($tmp_name, "", 0, strlen(self::FILE_DIR));
                     $cFile->_remoteCopy(self::FILE_DIR . $tmp_name, true);
                     $this->insertAttachedFile($cFile->id, $id);
                     break;
             }
         }
     }
 }
Example #5
0
 /**
  * Получает список приатаченных файлов к сообщению.
  *
  * @return array Информация о файлах
  */
 public function getAttachedFiles()
 {
     global $DB;
     $fList = array();
     if ($_SESSION['attachedfiles_contacts']['added']) {
         $login = $_SESSION['login'];
         $files = $_SESSION['attachedfiles_contacts']['added'] ? preg_split('/ /', trim($_SESSION['attachedfiles_contacts']['added'])) : array();
         $dfiles = $_SESSION['attachedfiles_contacts']['deleted'] ? preg_split('/ /', trim($_SESSION['attachedfiles_contacts']['deleted'])) : array();
         if (count($files)) {
             $sql = 'SELECT * FROM file WHERE MD5(id::text || fname) IN (?l);';
             $aFiles = $DB->rows($sql, $files);
             foreach ($aFiles as $f) {
                 $cFile = new CFile('users/' . substr($login, 0, 2) . '/' . $login . '/contacts/' . $f['fname']);
                 if ($cFile->id) {
                     if (in_array(md5($cFile->id . $cFile->name), $dfiles)) {
                         $is_deleted = 't';
                     } else {
                         $is_deleted = 'f';
                     }
                     array_push($fList, array('file_id' => $cFile->id, 'name' => $cFile->name, 'path' => $cFile->path, 'size' => $cFile->size, 'ftype' => $cFile->getext(), 'is_del' => $is_deleted));
                 }
             }
         }
     }
     return $fList;
 }
">
                                                            <input type="hidden" id="imain_file" name="main_file" value="<?php 
echo $work['pict'];
?>
">
                                                            <?php 
if ($work['pict']) {
    if ($width && $height && $cfile->image_size['type'] != 13 && $cfile->image_size['type'] != 4) {
        print view_image_file($work['pict'], $_SESSION['login'], "upload", array('max_dim' => 200, 'class' => 'b-prev__pic', 'id' => 'work_image'));
    } else {
        ?>
                                                                <div id="work_image" class="b-layout b-layout_padtop_20 b-layout_padlr_10">
                                                                    <table cellspacing="0" cellpadding="0" border="0" class="b-layout__table b-layout__table_width_full">
                                                                            <tr class="b-layout__tr">
                                                                                <td class="b-icon-layout__icon"><i class="b-icon b-icon_attach_<?php 
        echo getICOFile($cfile->getext());
        ?>
"></i></td>
                                                                                <td class="b-icon-layout__files"><div class="b-layout__txt b-layout__txt_padtop_5"><a href="<?php 
        echo WDCPREFIX . '/' . $cfile->path . $cfile->name;
        ?>
" class="b-icon-layout__link b-icon-layout__link_fontsize_13"><?php 
        echo uploader::cutNameFile($cfile->original_name, portfolio::FILE_NAME_LENGTH_EDIT);
        ?>
</a></div></td>
                                                                                <td class="b-icon-layout__size" style="padding-right:0;"><div class="b-layout__txt b-layout__txt_padtop_5">,<?php 
        echo ConvertBtoMB($cfile->size);
        ?>
</div></td>
                                                                            </tr>
                                                                    </table>
 /**
  * Перенос файлов в рабочие папки сайта
  * 
  * @param array  $files   Массив файлов
  * @param string $table   Таблица для переноса
  * @param string $dir     Директория для переноса
  * @param bool = true $newName  Генерировать новое имя файла
  * @return array 
  */
 function transferFiles($files, $table, $dir, $newName = true)
 {
     foreach ($files as $key => $file) {
         $objFile = new CFile($file['id']);
         $ext = $objFile->getext();
         if (!$newName) {
             $tmp_name = $objFile->name;
         } else {
             $tmp_name = $objFile->secure_tmpname($dir, '.' . $ext);
             $tmp_name = substr_replace($tmp_name, "", 0, strlen($dir));
         }
         $objFile->table = $table;
         $copy = $objFile->_remoteCopy($dir . $tmp_name);
         $data[] = array('fname' => $objFile->name, 'id' => $objFile->id, 'orig_name' => $objFile->original_name, 'file_id' => $objFile->id);
         unset($objFile);
     }
     return $data;
 }
Example #8
0
 $dir = "wizard/";
 $img->max_size = 5242880;
 $img->proportional = 1;
 $img->server_root = 1;
 $pictname = $img->MoveUploadedFile($dir);
 $id_upload = $img->id;
 if (!isNulArray($img->error)) {
     if (is_array($img->error)) {
         $err = $img->error[0];
     } else {
         $err = $img->error;
     }
     $error = true;
     $pictname = $prevname = '';
 } else {
     if (in_array($img->getext(), $GLOBALS['disallowed_array'])) {
         $err = 'Недопустимый тип файла';
         $error = true;
     } else {
         if (in_array($img->getext(), $GLOBALS['graf_array']) && strtolower($img->getext()) != "swf" && strtolower($img->getext()) != "flv") {
             // Делаем превью.
             $pict_added = $img->img_to_small("sm_" . $pictname, array('width' => 200, 'height' => 200, 'less' => 0));
             if (!isNulArray($img->error)) {
                 $error = true;
                 $pictname = $prevname = '';
             } elseif ($pict_added) {
                 $prevname = 'sm_' . $pictname;
             }
         } else {
             $pict_added = true;
         }
Example #9
0
 /**
  * Обработка и оплата операций
  * 
  * @global type $DB
  * @param type $option
  * @return boolean 
  */
 function billingOperation($option, $transaction_id)
 {
     global $DB;
     $ok = false;
     $account = new account();
     switch ($option['op_code']) {
         // Аккаунт ПРО у фрилансера
         case 48:
         case 49:
         case 50:
         case 51:
         case 76:
             // Удаляем операции по покупке ответов - публикуем ответы
             $prof = new payed();
             $ok = $prof->SetOrderedTarif($this->uid, $transaction_id, 1, "Аккаунт PRO", $option['op_code'], $error);
             if ($ok) {
                 $_SESSION['pro_last'] = payed::ProLast($_SESSION['login']);
                 $_SESSION['pro_last'] = $_SESSION['pro_last']['freeze_to'] ? false : $_SESSION['pro_last']['cnt'];
                 $userdata = new users();
                 $_SESSION['pro_test'] = $userdata->GetField($this->uid, $error2, 'is_pro_test', false);
                 $this->clearBlockedOperations(step_freelancer::OFFERS_OP_CODE);
                 $step_frl = new step_freelancer();
                 $offers = $step_frl->getWizardOffers($this->uid, 'all', false);
                 if ($offers) {
                     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/users.php";
                     $step_frl->log = $this->log;
                     $step_frl->user = new users();
                     $step_frl->user->GetUserByUID($this->uid);
                     $step_frl->transferOffers($offers);
                 }
                 $this->showProjectsFeedbacks();
             }
             break;
             // Аккаунт ПРО у работодателя
         // Аккаунт ПРО у работодателя
         case 15:
             $prof = new payed();
             $ok = $prof->SetOrderedTarif($this->uid, $transaction_id, 1, "Аккаунт PRO", $option['op_code'], $error);
             if ($ok) {
                 $_SESSION['pro_last'] = payed::ProLast($_SESSION['login']);
                 $_SESSION['pro_last'] = $_SESSION['pro_last']['freeze_to'] ? false : $_SESSION['pro_last']['cnt'];
                 $userdata = new users();
                 $_SESSION['pro_test'] = $userdata->GetField($this->uid, $error2, 'is_pro_test', false);
             }
             // Обновляем выбор цвета для проектов тк он для ПРО бесплатный
             $colorProjects = $this->updateColorProject();
             $prj = new new_projects();
             foreach ($colorProjects as $k => $project) {
                 $delete_color[] = $project['op_id'];
                 if ($project['country'] == null) {
                     $project['country'] = 'null';
                 }
                 if ($project['city'] == null) {
                     $project['city'] = 'null';
                 }
                 $project['name'] = addslashes($project['name']);
                 $project['descr'] = addslashes($project['descr']);
                 if ($project['logo_id'] <= 0) {
                     $project['logo_id'] = 'null';
                 }
                 $project['payed_items'] = $project['payed_items'] | '010';
                 $project['is_color'] = 't';
                 $prj->editPrj($project, false);
             }
             // Удаляем данные операции
             if ($delete_color) {
                 $this->deleteDraftAccountOperation($delete_color);
             }
             break;
             // Публикация конкурса
         // Публикация конкурса
         case new_projects::OPCODE_KON:
         case new_projects::OPCODE_KON_NOPRO:
             require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/wizard/step_wizard_registration.php';
             $drafts = new drafts();
             $draft = $drafts->getDraft($option['parent_id'], $this->uid, 1);
             // Если еще не опубликован
             if (!$draft['prj_id']) {
                 $project_id = $draft['id'];
                 $error = $account->Buy($bill_id, $transaction_id, $option['op_code'], $this->uid, $option['descr'], $option['comment'], 1, 0);
                 $ok = $bill_id > 0;
                 if ($bill_id) {
                     $color = $DB->val("SELECT id FROM draft_account_operations WHERE parent_id = ? AND op_type = 'contest' AND option = 'color' AND uid = ?", $project_id, wizard::getUserIDReg());
                     $draft['billing_id'] = $bill_id;
                     $draft['folder_id'] = 'null';
                     $draft['payed'] = '0';
                     $draft['payed_items'] = '000';
                     if (is_pro() && $color > 0) {
                         $draft['is_color'] = 't';
                     } else {
                         $draft['is_color'] = 'f';
                     }
                     $draft['win_date'] = date('d-m-Y', strtotime($draft['win_date']));
                     $draft['end_date'] = date('d-m-Y', strtotime($draft['end_date']));
                     $draft['is_bold'] = 'f';
                     $draft['user_id'] = $this->uid;
                     if ($draft['country'] == null) {
                         $draft['country'] = 'null';
                     }
                     if ($draft['city'] == null) {
                         $draft['city'] = 'null';
                     }
                     $draft['name'] = addslashes($draft['name']);
                     $draft['descr'] = addslashes($draft['descr']);
                     if ($draft['logo_id'] <= 0) {
                         $draft['logo_id'] = 'null';
                     }
                     $prj = new new_projects();
                     $attachedfiles_tmpdraft_files = drafts::getAttachedFiles($option['parent_id'], 4);
                     if ($attachedfiles_tmpdraft_files) {
                         $attachedfiles_tmpdraft_files = array_map(create_function('$a', 'return array("id" => $a);'), $attachedfiles_tmpdraft_files);
                     }
                     if ($attachedfiles_tmpdraft_files) {
                         $month = date('Ym');
                         $dir = 'projects/upload/' . $month . '/';
                         $files = step_wizard_registration::transferFiles($attachedfiles_tmpdraft_files, 'file_projects', $dir);
                     }
                     $spec = $draft["categories"];
                     $spec = explode("|", $spec);
                     $spec = array(array('category_id' => $spec[0], 'subcategory_id' => $spec[1]));
                     $prj->addPrj($draft, $files);
                     $prj->saveSpecs($draft["id"], $spec);
                     // смотрим были ли выбраны платные опции для опубликованного конкурса
                     if ($draft['id'] != $project_id && $draft['id'] > 0) {
                         if ($this->sleep[$project_id]) {
                             foreach ($this->sleep[$project_id] as $k => $opt) {
                                 $opt['parent_id'] = $draft['id'];
                                 $this->billingOperation($opt);
                             }
                         } else {
                             //Обновляем родителя на всякий случай
                             $update = array("parent_id" => $draft['id']);
                             $DB->update("draft_account_operations", $update, "parent_id = ? AND op_type = 'contest' AND uid = ?", $project_id, wizard::getUserIDReg());
                             $this->sleep_parent[$project_id] = $draft['id'];
                         }
                         $DB->update("draft_projects", array('prj_id' => $draft['id']), "id = ? AND uid = ?", $project_id, wizard::getUserIDReg());
                     }
                 }
             }
             break;
             // Платный проект/конкурс
         // Платный проект/конкурс
         case 53:
             $prj = new new_projects();
             if ($this->sleep_parent[$option['parent_id']]) {
                 $option['parent_id'] = $this->sleep_parent[$option['parent_id']];
             }
             $project = $prj->getProject($option['parent_id']);
             if (!$project['id']) {
                 $this->sleep[$option['parent_id']][$option['id']] = $option;
                 return true;
             } else {
                 unset($this->sleep[$option['parent_id']]);
             }
             if ($project['country'] == null) {
                 $project['country'] = 'null';
             }
             if ($project['city'] == null) {
                 $project['city'] = 'null';
             }
             $project['name'] = addslashes($project['name']);
             $project['descr'] = addslashes($project['descr']);
             if ($project['logo_id'] <= 0) {
                 $project['logo_id'] = 'null';
             }
             $project['folder_id'] = 'null';
             $items = array();
             switch ($option['option']) {
                 case 'top':
                     $project['top_days'] = $option['op_count'];
                     break;
                 case 'color':
                     $is_pay = $project['payed_items'] & '010';
                     if ($is_pay != '010') {
                         $project['payed_items'] = $project['payed_items'] | '010';
                         $project['is_color'] = 't';
                         $items['color'] = true;
                         if (is_pro()) {
                             $is_payed = true;
                             $prj->SavePayedInfo($items, $project['id'], null, $project['top_days']);
                             $prj->editPrj($project, false);
                         }
                     } else {
                         $is_payed = true;
                     }
                     break;
                 case 'bold':
                     $is_pay = $project['payed_items'] & '001';
                     if ($is_pay != '001') {
                         $project['payed_items'] = $project['payed_items'] | '001';
                         $project['is_bold'] = 't';
                         $items['bold'] = true;
                     } else {
                         $is_payed = true;
                     }
                     break;
                 case 'logo':
                     $is_pay = $project['payed_items'] & '100';
                     if ($is_pay != '100') {
                         $key = md5(microtime());
                         $prj = new tmp_project($key);
                         $prj->init(1);
                         $fu = new CFile($option['src_id']);
                         $ext = $fu->getext();
                         $tmp_dir = $prj->getDstAbsDir();
                         $tmp_name = $fu->secure_tmpname($tmp_dir, '.' . $ext);
                         $tmp_name = substr_replace($tmp_name, "", 0, strlen($tmp_dir));
                         $fu->table = 'file_projects';
                         $r = $fu->_remoteCopy($tmp_dir . $tmp_name);
                         $project['payed_items'] = $project['payed_items'] | '100';
                         $project['logo_id'] = $fu->id;
                         $items['logo'] = true;
                         if ($option['extra']) {
                             $project['link'] = $option['extra'];
                         }
                     } else {
                         $is_payed = true;
                     }
                     break;
             }
             if (!$is_payed) {
                 $error = $account->Buy($bill_id, $transaction_id, $option['op_code'], $this->uid, $option['descr'], $option['comment'], $option['ammount'], 0);
                 $ok = $bill_id > 0;
                 $project['billing_id'] = $bill_id;
                 $prj->SavePayedInfo($items, $project['id'], $bill_id, $project['top_days']);
                 $prj->editPrj($project, false);
             } else {
                 $ok = true;
             }
             break;
             // Платные ответы на проекты
         // Платные ответы на проекты
         case 61:
             $answers = new projects_offers_answers();
             $error = $answers->BuyByFM($this->uid, $option['op_count'], $transaction_id, 0);
             if (!$error) {
                 $ok = true;
                 $_SESSION['answers_ammount'] = $option['op_count'];
                 // Публикуем ответы
                 $step_frl = new step_freelancer();
                 $offers = $step_frl->getWizardOffers($this->uid, $option['op_count']);
                 if ($offers) {
                     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/users.php";
                     $step_frl->log = $this->log;
                     $step_frl->user = new users();
                     $step_frl->user->GetUserByUID($this->uid);
                     $step_frl->transferOffers($offers);
                 }
             }
             break;
     }
     return $ok;
 }
Example #10
0
 /**
  * Возвращает все вложения текущего этапа по переданным идентификаторам.
  *
  * @param integer|string $attach_id   один или несколько ид., разделенных запятыми. Если NULL, то вернуть все.
  * @param boolean $get_deleted   взять удаленные?
  * @return array   массив объектов CFile, индексированный ид. аттачей.
  */
 function _new_getAttach($attach_id = NULL, $get_deleted = false)
 {
     $ret = NULL;
     $where = "sa.stage_id = {$this->data['id']}" . ($attach_id == NULL ? '' : " AND sa.id IN ({$attach_id})");
     $where_deleted = $get_deleted !== NULL ? " AND sa.is_deleted = '" . (int) $get_deleted . "'" : '';
     $sql = "\n          SELECT sa.stage_id, sa.file_id as id, f.original_name as name, f.fname as file_name, f.path as file_path, f.size as file_size, f.modified as sign_time\n          FROM sbr_stages_attach sa\n          INNER JOIN file_sbr f ON f.id = sa.file_id\n          WHERE {$where} {$where_deleted}\n          \n          UNION \n\n          SELECT sm.stage_id, sma.file_id as id, f.original_name as name, f.fname as file_name, f.path as file_path, f.size as file_size, f.modified as sign_time\n          FROM sbr_stages_msgs sm\n          INNER JOIN sbr_stages_msgs_attach sma ON sma.msg_id = sm.id\n          INNER JOIN file_sbr f ON f.id = sma.file_id\n          WHERE sm.stage_id = {$this->data['id']}\n          \n          ORDER BY sign_time ASC\n        ";
     if (($res = pg_query(DBConnect(), $sql)) && pg_num_rows($res)) {
         while ($row = pg_fetch_assoc($res)) {
             $row['ftype'] = CFile::getext($row['name']);
             $ret[$row['id']] = $row;
         }
     }
     return $ret;
 }
Example #11
0
/**
 * Генерирует список файлов с иконками для комментариев (новая версия)
 *
 * @param array $attaches Массив с информацией о файле/файлах (напр. результат выборки из таблицы file)
 * @return string HTML код
 */
function viewattachListNew($attaches)
{
    if (!$attaches || !count($attaches)) {
        return '';
    }
    $thumbs = '';
    $list = '';
    if (isset($attaches['id'])) {
        $attaches = array($attaches);
    }
    foreach ($attaches as $attach) {
        $cfile = new CFile();
        $ext = $cfile->getext($attach['fname']);
        $ico = getICOFile($ext);
        $fsize = ConvertBtoMB($attach['size']);
        $path = WDCPREFIX . "/{$attach['path']}{$attach['fname']}";
        if ($attach['size'] < 300 * 1024 && in_array($ext, $GLOBALS['graf_array']) && $ext != 'swf') {
            $path_th = WDCPREFIX . "/{$attach['path']}sm_{$attach['fname']}";
            $th = new CFile("{$attach['path']}sm_{$attach['fname']}");
            if (!$th->id) {
                $path_th = $path;
            }
            $thumbs .= "<li class='afl-img c'><a href='{$path}' title='{$ext}, {$fsize}'><img src='{$path_th}' alt='{$ext}, {$fsize}' /></a></li>\n";
        } else {
            $list .= "<li class='{$ico}'><a href='{$path}'>{$ext}, {$fsize}</a></li>\n";
        }
    }
    return "<ul class='added-files-list c'>{$thumbs}{$list}</ul>";
}
                                    ?>
 <?php 
                                    echo $aData['file_size_str'];
                                    ?>
&nbsp;&nbsp;</div>
                                                                </div>
                                                                <?php 
                                } else {
                                    echo '<div>';
                                    if ($value['portf_id' . $i] == 0) {
                                        ?>
                                                                            
                                                                            
                                                                            
                                                                                <?php 
                                        if (in_array(CFile::getext($value['pict' . $i]), $GLOBALS['graf_array']) || strtolower(CFile::getext($value['pict' . $i])) == "mp3") {
                                            ?>
                                                                                    <?php 
                                            if ($value['prev_pict' . $i] != '') {
                                                ?>
                                                                            <div ><a href="/projects/viewwork.php?pid=<?php 
                                                echo $value['project_id'];
                                                ?>
&user=<?php 
                                                echo $value['login'];
                                                ?>
&wid=<?php 
                                                echo $i;
                                                ?>
" target="_blank" class="blue" title="" style="text-decoration:none"><?php 
                                                echo view_preview($value['login'], $value['prev_pict' . $i], "upload", $align, false, true);
Example #13
0
 function saveAction()
 {
     $db = front::og("db");
     $form = front::$_req["form"];
     $id_comm = front::$_req["comment"];
     $parent = front::$_req["parent"];
     if (!$id_comm) {
         $id_comm = false;
     }
     //    global $session;
     $validate_errors = array();
     $save = array();
     if (($str = trim($form['title'])) && mb_strlen($str) >= 3) {
         $save['title'] = change_q_x_a(antispam($str), 0, 96);
     } else {
         $validate_errors['title'] = 'Заголовок короче 3 символов';
     }
     if (($str = trim($form['msg'])) && mb_strlen($str) >= 3) {
         $save['msg'] = change_q_x_a(antispam($str), false, false);
     } else {
         $validate_errors['msg'] = 'Текст короче 3 символов';
     }
     if (strlen($form['msg']) > blogs::MAX_DESC_CHARS) {
         $validate_errors['msg'] = "Максимальный размер сообщения " . blogs::MAX_DESC_CHARS . " символов!";
     } else {
         $save['msg'] = change_q_x_a(antispam($form['msg']), false, false);
     }
     $yt_link = substr(change_q_x(antispam(str_replace('watch?v=', 'v/', $form['yt_link'])), true), 0, 128);
     if ($yt_link != '') {
         if (strpos($yt_link, 'http://ru.youtube.com/v/') !== 0 && strpos($yt_link, 'http://youtube.com/v/') !== 0 && strpos($yt_link, 'http://www.youtube.com/v/') !== 0) {
             $validate_errors['yt_link'] = "Неверная ссылка.";
         }
     }
     if (sizeof($validate_errors) > 0) {
         echo json_encode(array("success" => 0, "validate" => $validate_errors));
         exit(1);
     }
     $save = front::toWin(array("title" => $form["title"], "msg" => $form["msg"], "yt_link" => $yt_link));
     $id = intval($id = front::$_req["id"]);
     if ($id_comm) {
         // if($parent > 0) {
         //
         //  } else {
         $save["id_blog"] = $parent;
         $save["id_reply"] = $id;
         $save["id_user"] = get_uid();
         $id = $db->insert("corporative_blog", $save);
         //  }
         //if($id_comm && $id > 0) {
         //  $save["id_blog"] = $id;
         //      $save["id_reply"] = $id;
         //                }
     } else {
         if ($id > 0) {
             $save["id_modified"] = get_uid();
             $save["id_deleted"] = 0;
             $save["date_change"] = date("Y-m-d H:i:s");
             $aff = $db->update("UPDATE corporative_blog SET ?s WHERE (id = ?n)", $save, $id);
         } else {
             $save["id_user"] = get_uid();
             $id = $db->insert("corporative_blog", $save);
         }
     }
     if ($form["files_deleted"] != "") {
         $form["files_deleted"] = preg_replace('/\\\\\\"/', '"', $form["files_deleted"]);
         $filesBefore = json_decode($form["files_deleted"]);
         $login = $_SESSION['login'];
         foreach ($filesBefore as $file) {
             if (!$file->db_id) {
                 continue;
             }
             front::og("db")->delete("DELETE FROM corporative_blog_attach WHERE id = ?n", $file->db_id);
         }
     }
     if ($form["files"] != "") {
         //$filesBefore = explode(";", $form["files"]);
         //  vardump($form["files"]);
         $form["files"] = preg_replace('/\\\\\\"/', '"', $form["files"]);
         $filesBefore = json_decode($form["files"]);
         if ($group == 7) {
             $max_image_size = array('width' => 400, 'height' => 600, 'less' => 0);
         } else {
             $max_image_size = array('width' => 470, 'height' => 1000, 'less' => 0);
         }
         $login = $_SESSION["login"];
         if ($filesBefore) {
             foreach ($filesBefore as $file) {
                 if (!$file->temp) {
                     continue;
                 }
                 $b_file = new CFile("temp/" . $file->id);
                 if ($b_file->id > 0) {
                     $b_file->Rename("users/" . substr($login, 0, 2) . "/" . $login . "/upload" . "/" . $file->id);
                     $ext = $b_file->getext();
                     if (in_array($ext, $GLOBALS['graf_array'])) {
                         $is_image = TRUE;
                     } else {
                         $is_image = FALSE;
                     }
                     $b_file->max_size = blogs::MAX_FILE_SIZE;
                     $b_file->proportional = 1;
                     if (!isNulArray($file->error)) {
                         //  $error_flag = 1;
                         //print_r($file->error);
                         $alert[3] = "Один или несколько файлов не удовлетворяют условиям загрузки.";
                         // break;
                     } else {
                         if ($is_image && $ext != 'swf' && $ext != 'flv') {
                             if (!$b_file->image_size['width'] || !$b_file->image_size['height']) {
                                 // $error_flag = 1;
                                 $alert[3] = 'Невозможно уменьшить картинку';
                                 break;
                             }
                             if (!$error_flag && ($b_file->image_size['width'] > $max_image_size['width'] || $b_file->image_size['height'] > $max_image_size['height'])) {
                                 if (!$b_file->img_to_small("sm_" . $file->id, $max_image_size)) {
                                     //  $error_flag = 1;
                                     $alert[3] = 'Невозможно уменьшить картинку.';
                                     break;
                                 } else {
                                     $b_file->tn = 2;
                                     $b_file->p_name = "sm_" . $file->id;
                                 }
                             } else {
                                 $b_file->tn = 1;
                             }
                         } else {
                             if ($ext == 'flv') {
                                 $b_file->tn = 2;
                             } else {
                                 $b_file->tn = 0;
                             }
                         }
                         if ($alert[3]) {
                             $validate_errors['files'] = $alert[3];
                         }
                         $files[] = $b_file;
                     }
                 }
             }
         }
     }
     //global $session;
     if (is_array($files) && sizeof($files)) {
         $asql = '';
         foreach ($files as $file) {
             //currval('corporative_blog_id_seq')
             if ($file->name) {
                 $asql .= ", ({$id}, '{$file->name}', '{$file->tn}')";
             }
         }
         if ($asql) {
             $asql = substr($asql, 2);
         }
     }
     //echo $asql;
     if ($asql) {
         pg_query(DBConnect(), "INSERT INTO corporative_blog_attach(msg_id, \"name\", small) VALUES {$asql}");
     }
     $htmlMode = front::$_req["htmlMode"];
     if ($htmlMode == "inPostPage") {
         front::og("tpl")->blog = front::og("db")->select("SELECT cb.*, u.login, u.uname, u.usurname, u.role, u.is_pro, u.is_pro_test, u.boss_rate FROM corporative_blog as cb, users as u WHERE cb.id = ? AND u.uid = cb.id_user;", $id)->fetchRow();
         $attach_blog = front::og("db")->select("SELECT * FROM corporative_blog_attach WHERE msg_id = ?", $id)->fetchAll();
         if ($attach_blog) {
             front::og("tpl")->attach_blog = $attach_blog;
         }
         // front::og("tpl")->usbank  = $usr;
         //  front::og("tpl")->comment = $comm;
         //front::og("tpl")->blog   = $blog;
         $html = front::og("tpl")->fetch("my_corporative_post_item.tpl");
     } elseif ($htmlMode == "normal") {
         $blog = front::og("db")->select("SELECT * FROM corporative_blog WHERE id_blog = 0 AND (id_deleted IS NULL OR id_deleted = 0) AND id = ?n", $id)->fetchRow();
         $bids = array($id => $id);
         $uids = array($blog["id_user"] => $blog["id_user"]);
         $comm = front::get_hash(front::og("db")->select("SELECT COUNT(id_blog) as count, id_blog FROM corporative_blog WHERE id_blog IN(?a) GROUP BY id_blog", $bids)->fetchAll(), "id_blog", "count");
         $user = front::og("db")->select("SELECT uname, usurname, login, uid, role, is_pro, is_pro_test, boss_rate FROM users WHERE uid IN(?a)", $uids)->fetchAll();
         //, "uid", "usname");
         $cid[$blog['id']] = $blog['id'];
         if ($cid) {
             $attach = front::og("db")->select("SELECT * FROM corporative_blog_attach WHERE msg_id IN(?a)", $cid)->fetchAll();
         }
         if ($attach) {
             foreach ($attach as $key => $val) {
                 $res_attach[$val['msg_id']][] = $val;
             }
             front::og("tpl")->attach = $res_attach;
         }
         foreach ($user as $k => $v) {
             $usr[$v['uid']] = $v;
         }
         front::og("tpl")->usbank = $usr;
         front::og("tpl")->comment = $comm;
         front::og("tpl")->blog = $blog;
         $html = front::og("tpl")->fetch("my_corporative_item.tpl");
     }
     echo json_encode(array("success" => true, "id" => $id, "html" => front::toUtf($html)));
 }
Example #14
0
 function set_loaded_attach($type, $id, $name, $link = false)
 {
     global $_attached;
     $_attached['ids'][$type] = $id;
     $_attached['ext'][$type] = getICOFile(CFile::getext($name));
     if (strlen($name) > 40) {
         $name = substr($name, 0, 18) . '...' . substr($name, strlen($name) - 18, 18);
     }
     $_attached['name'][$type] = $name;
     $_attached['link'][$type] = $link;
 }
Example #15
0
         $file->prefix_file_name = 'sm_';
         $file->max_size = 102400;
     }
     // если заданы типы графических файлов
     if ($imageTypes) {
         // то файл должен быть графическим
         $file->_getImageSize($file->tmp_name);
         if (!$file->image_size['type'] || !in_array($file->image_size['type'], $imageTypes)) {
             $err = 'Недопустимый формат файла';
         }
     }
     if (!$err) {
         $filename = $file->MoveUploadedFile($sFullDir);
         $fileid = $file->id;
         $err = $file->StrError();
         if (!$err && $type == 'work_prev' && (!in_array($file->getext(), $GLOBALS['graf_array']) || strtolower($file->getext()) == 'swf' || strtolower($file->getext()) == 'flv')) {
             $err = 'Недопустимый тип файла';
         }
         if ($type == 'photo' || $type == 'logo') {
             if (!$err && !$file->img_to_small('sm_' . $filename, array('width' => 50, 'height' => 50))) {
                 $err .= 'Невозможно уменьшить картинку.';
             }
         }
     }
 } elseif (!$err) {
     // логотип проекта
     require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/projects.php';
     $tmpPrj = new tmp_project($pkey);
     $prj = $tmpPrj->init(1);
     $err = $tmpPrj->setLogo($file);
     $tmpPrj->fix();
Example #16
0
 if (!isset($file['error'])) {
     $cFile->max_size = $max_files_size;
     $cFile->MoveUploadedFile($dir);
     if ($cFile->id) {
         $files_info = $attachedfiles->calcFiles();
         $files_count = $files_info['count'];
         $files_size = $files_info['size'];
         if ($files_count + 1 > $max_files) {
             $file['error'] = "Максимальное количество файлов: {$max_files}";
             $file['errno'] = 2;
         }
         if ($files_size + $cFile->size > $max_files_size) {
             $file['error'] = 'Максимальный объем файлов: ' . ConvertBtoMB($max_files_size);
             $file['errno'] = 3;
         }
         if (in_array($cFile->getext(), $GLOBALS['disallowed_array']) || $type == 'wd' && (!in_array($cFile->image_size['type'], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG)) || $cFile->image_size['width'] > 2000 || $cFile->image_size['height'] > 2000)) {
             $file['error'] = 'Недопустимый формат файла';
             $file['errno'] = 4;
         }
         if ($file['error']) {
             $cFile->Delete($cFile->id);
         } else {
             $fileinfo = $attachedfiles->add($cFile);
             $file['id'] = md5($fileinfo['id']);
             //@todo: автоматически сгенерированное имя файла
             // пока не используется в интерфейсе
             $file['name'] = $fileinfo['name'];
             //@todo: оригинально имя файла выводим в интерфейс
             $file['orig_name'] = $fileinfo['orig_name'];
             //@todo: тут теперь полный путь к файлу
             $file['path'] = WDCPREFIX . '/' . $fileinfo['path'] . $fileinfo['name'];
            // сокращаем название файла, сохраняя расширение
            if (strlen($name) > $maxLen) {
                $arr = explode('.', $name);
                $ext = array_pop($arr);
                $name = preg_replace("/.{$ext}\$/", '', $name);
                $name = substr($name, 0, $maxLen) . '...';
                $name = $name . '.' . $ext;
            }
            ?>
                                <span>
                                    <div class="b-layout__txt b-layout__txt_inline-block  b-layout__txt_valign_top b-layout__txt_padtop_7">
                                        <a class="b-layout__link" href="<?php 
            echo WDCPREFIX . '/wizard/' . $pict->name;
            ?>
"><span class="b-icon b-icon_margtop_-3 b-icon_mid_<?php 
            echo getICOFile($pict->getext());
            ?>
"></span><?php 
            echo $name;
            ?>
</a>&nbsp;&nbsp;
                                    </div><a href="javascript:void(0)" onclick="upload.remove(this);" class="b-button b-button_margtop_10 b-button_admin_del"></a>&nbsp;&nbsp;&nbsp;&nbsp;
                                </span>
                                <?php 
        }
        //if
        ?>
                                
                                <input type="hidden" name="pict_id[<?php 
        echo $k;
        ?>
 }
 $cFile->max_size = $max_files_size;
 $cFile->server_root = 1;
 $cFile->MoveUploadedFile($dir);
 if ($cFile->id) {
     $attachedfiles = new attachedfiles($sess);
     $files_info = $attachedfiles->calcFiles();
     $files_count = $files_info['count'];
     $files_size = $files_info['size'];
     if ($files_count + 1 > $max_files) {
         $file['error'] = "Максимальное количество файлов: {$max_files}";
     }
     if ($files_size + $cFile->size > $max_files_size) {
         $file['error'] = 'Максимальный объем файлов: ' . ConvertBtoMB($max_files_size);
     }
     if (in_array($cFile->getext(), $GLOBALS['disallowed_array'])) {
         $file['error'] = 'Недопустимый формат файла';
     }
     if ($file['error']) {
         $cFile->Delete($cFile->id);
     } else {
         $fileinfo = $attachedfiles->add($cFile);
         $file['id'] = md5($fileinfo['id']);
         $file['name'] = $fileinfo['name'];
         $file['path'] = WDCPREFIX . '/' . $fileinfo['path'];
         $file['size'] = ConvertBtoMB($fileinfo['size']);
         $file['type'] = $fileinfo['type'];
     }
 } else {
     if ($_FILES['attachedfiles_file']['size'] > $max_files_size) {
         $file['error'] = 'Максимальный объем файлов: ' . ConvertBtoMB($max_files_size);
Example #19
0
" target="_blank">Загрузить</a> (<?php 
            echo CFile::getext($a['name']);
            ?>
; <?php 
            echo ConvertBtoMB($a['size']);
            ?>
 )
                            <?php 
        }
        ?>

                            <?php 
        if ($a['virus'] & 1 == 1) {
            ?>
(<?php 
            echo CFile::getext($a['name']);
            ?>
; <?php 
            echo ConvertBtoMB($a['size']);
            ?>
 )
                            <span class="avs-err"><span>Обнаружен вирус.</span> Файл удален с сервера.</span>
                            <?php 
        } else {
            if ($a['virus'] === 0) {
                ?>
                            <span class="avs-ok">Проверено антивирусом.</span>
                            <?php 
            } else {
                if ($a['virus'] == 2) {
                    ?>
Example #20
0
</div>
                
                <?php 
if ($attachedfiles_files) {
    ?>
                <div class="b-fon b-fon_padbot_20 b-fon_width_full b-file">
                    <div class="b-fon__body b-fon__body_pad_10 b-fon__body_fontsize_13 b-fon__body_bg_f0ffdf i-button">
                        <table cellspacing="0" cellpadding="0" border="0" class="b-icon-layout__table">
                            <tbody>
                                <?php 
    foreach ($attachedfiles_files as $file) {
        $cFile = new CFile($file['fid']);
        ?>
                                <tr class="b-icon-layout__tr">
                                    <td class="b-icon-layout__icon b-icon-layout__icon_height_25"><i class="b-icon b-icon_attach_<?php 
        echo $cFile->getext();
        ?>
"></i></td>
                                    <td class="b-icon-layout__files b-icon-layout__files_fontsize_13"><a href="<?php 
        echo WDCPREFIX . "/{$cFile->path}/{$cFile->name}";
        ?>
" class="b-icon-layout__link b-icon-layout__link_fontsize_13"><?php 
        echo $cFile->original_name;
        ?>
</a>, <?php 
        echo ConvertBtoMB($cFile->size);
        ?>
</td>
                                </tr>
                                <?php 
    }
Example #21
0
 * */
 $path = __paramInit("string", null, "path");
 $path = trim($path, '/');
 $info = '';
 $old_link = '';
 $rename_name = '';
 $name = '';
 $link = '';
 $error_folder = '';
 $cf = new CFile($_FILES['document'], dav_file_upload::FILE_TABLE);
 if ($cf->CheckPath($path)) {
     $destname = dav_file_upload_createDestName($cf);
     //check existing file
     $existingFile = new CFile("{$path}/{$destname}");
     if ($existingFile->id > 0) {
         $ext = $existingFile->getext($existingFile->name);
         $tmp = $existingFile->secure_tmpname($path . '/', '.' . $ext);
         $rename_name = substr_replace($tmp, "", 0, strlen($path) + 1);
         $s = preg_replace("#\\." . $ext . "\$#", "", $destname);
         $length = strlen($s . '_' . $rename_name);
         if ($length > 64 && strlen($rename_name) < 64) {
             $s = substr($s, 0, 63 - strlen($rename_name));
             $rename_name = $s . "_" . $rename_name;
         }
         $existingFile->Rename("{$path}/{$rename_name}");
         $info = 'Файл был заменен';
         $old_link = WDCPREFIX . '/' . $path . '/' . $rename_name;
     }
     $cf->server_root = 1;
     $cf->max_size = dav_file_upload::MAX_FILE_SIZE;
     $cf->MoveUploadedFile($path . '/', true, $destname);
Example #22
0
            
            <p><?php 
        echo reformat($aOne['msg_text'], 45);
        ?>
</p>
            
            <?php 
        // прикрепленные файлы ------------------
        if ($aOne['files']) {
            $nn = 1;
            ?>
		    <div class="filesize1">
                <div class="attachments attachments-p">
    		    <?php 
            foreach ($aOne['files'] as $attach) {
                $att_ext = CFile::getext($attach['fname']);
                $aData = getAttachDisplayData($aOne['spamer_login'], $attach['fname'], 'contacts', 1000, 600, 307200, 0);
                if ($aData && $aData['success']) {
                    if ($aData['file_mode'] || $aData['virus_flag'] || $att_ext == "swf") {
                        $str = viewattachLeft($aOne['spamer_login'], $attach['fname'], 'contacts', $file, 0, 0, 0, 0, 0, 0, $nn);
                        echo '<div class = "flw_offer_attach">', $str, '</div>';
                    } else {
                        echo "<div class = \"flw_offer_attach\"><div style=\"float: left; margin-right:7px;\">{$nn}.</div><img src=\"" . WDCPREFIX . '/users/' . $aOne['spamer_login'] . '/contacts/' . $aData['file_name'] . "\" alt=\"{$aData['file_name']}\" title=\"{$aData['file_name']}\" width=\"{$aData['img_width']}\" height=\"{$aData['img_height']}\" /></div>";
                    }
                }
                $nn++;
            }
            ?>
                </div>
			</div>
			<?php 
Example #23
0
 $dir = 'wizard/';
 $img->max_size = 5242880;
 $img->proportional = 1;
 $img->server_root = 1;
 $pictname = $img->MoveUploadedFile($dir);
 $id_upload = $img->id;
 if (!isNulArray($img->error)) {
     if (is_array($img->error)) {
         $err = $img->error[0];
     } else {
         $err = $img->error;
     }
     $error = true;
     $pictname = $prevname = '';
 } else {
     if (in_array($img->getext(), $GLOBALS['disallowed_array'])) {
         $err = 'Недопустимый тип файла';
         $error = true;
     } else {
         if (in_array($img->getext(), $GLOBALS['graf_array']) && strtolower($img->getext()) != 'swf' && strtolower($img->getext()) != 'flv') {
             // Делаем превью.
             $pict_added = $img->img_to_small('sm_' . $pictname, array('width' => 200, 'height' => 200, 'less' => 0));
             if (!isNulArray($img->error)) {
                 $error = true;
                 $pictname = $prevname = '';
             } elseif ($pict_added) {
                 $prevname = 'sm_' . $pictname;
             }
         } else {
             $pict_added = true;
         }
Example #24
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 #25
0
function aEditDocument($stage_id, $doc_id)
{
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/sbr_meta.php';
    $stage_id = __paramValue('int', $stage_id);
    $doc_id = __paramValue('int', $doc_id);
    $objResponse = new xajaxResponse();
    if (!hasPermissions('sbr')) {
        return $objResponse;
    }
    $sbr = sbr_meta::getInstance();
    $sbr_id = $sbr->getSbrIdFromStage($stage_id);
    $sbr->initFromId($sbr_id, true, false, false);
    if ($sbr->error) {
        return $objResponse;
    }
    if ($sbr->getDocs($doc_id)) {
        $doc = current($sbr->docs);
        $stage = $sbr->initFromStage($stage_id, false);
        $doc_info = '<i class="b-icon b-icon_attach_' . getICOFile(CFile::getext($doc['file_name'])) . '"></i> <a class="b-layout__link" href="' . WDCPREFIX . '/' . $doc['file_path'] . $doc['file_name'] . '">' . $doc['name'] . '</a>, ' . ConvertBtoMB($doc['file_size']);
        ob_start();
        include $_SERVER['DOCUMENT_ROOT'] . '/sbr/admin/tpl.popup-doc.php';
        $html = ob_get_clean();
        //$objResponse->script("$('popup_admin_files').addClass('b-shadow_hide');");
        $objResponse->assign('popup_admin_files_edit', 'innerHTML', $html);
        $objResponse->script("\n        new attachedFiles2( \$('popup_admin_files{$doc['id']}').getElement('.attachedfiles_admin_sbr{$doc['id']}'), {\n            'hiddenName':   'attaches[]',\n            'files':        '',\n            'selectors': {'template' : '.attachedfiles_admin_sbr-tpl'}\n        });");
        $objResponse->call('shadow_popup');
    }
    return $objResponse;
}
function ChangeGrPrev($prof_id, $check)
{
    session_start();
    $objResponse = new xajaxResponse();
    $portf = new portfolio();
    if (!$portf->ChangeGrPrev($_SESSION['uid'], intval($prof_id), $projs)) {
        if ($projs) {
            foreach ($projs as $id => $prj) {
                if ($check != 0) {
                    if ($prj['prev_type'] == 1) {
                        $text = '<div style="width:200px">' . reformat2($prj['prev_data'], 37) . '</div>';
                    } else {
                        if (in_array(strtolower(CFile::getext($prj['prev_data'])), $GLOBALS['graf_array']) && strtolower(CFile::getext($prj['prev_data'])) != 'swf') {
                            $text = '<div align="left" style="width:200px;"><a href="/users/' . $_SESSION['login'] . '/viewproj.php?prjid=' . $id . '" target="_blank" class="blue">
    				' . viewattach($_SESSION['login'], $prj['prev_data'], 'upload', $file, 500, 200, 307200, 0, 0, 'left') . '</a></div>';
                        } else {
                            $text = viewattach($_SESSION['login'], $prj['prev_data'], 'upload', $file, 500, 200, 307200, 0, 0, 'left');
                        }
                        #				$script .= "document.getElementById('prev".$id."').checked = true;";
                    }
                } else {
                    #				$script = "document.getElementById('prev".$id."').checked = false;";
                    $text = '<div style="width:200px">&nbsp;</div>';
                }
                $objResponse->assign('previmg' . intval($id), 'innerHTML', $text);
                $objResponse->script($script);
            }
        }
        $script = "document.getElementById('grprev" . $prof_id . "').disabled = false;";
    } else {
        $script = "document.getElementById('grprev" . $prof_id . "').disabled = false;";
    }
    $objResponse->script($script);
    return $objResponse;
}
Example #27
0
 /**
  * Заполняет класс данными из базы.
  *
  * @param integer $prj_id   ид. проекта.
  * @return boolean true - если все инициализация прошла успешно
  */
 private function _initFromDB($prj_id)
 {
     if ($this->_project = $this->getPrj($prj_id)) {
         $this->_setPath();
         $this->_attach = $this->getAllAttach($prj_id);
         $this->_categories = $this->getSpecs($prj_id);
         if ($this->_project['logo_id']) {
             $file = new CFile($this->_project['logo_id']);
             if ($file->name) {
                 $this->_logo = array('id' => $file->id, 'path' => $file->path, 'name' => $file->name, 'size' => $file->size, 'ftype' => $file->getext());
             }
         }
         return true;
     }
     return false;
 }
Example #28
0
                                <div class="b-post__txt b-post__txt_padbot_5 b-post__txt_bold">Менеджер арбитража</div>
                                <div class="b-post__txt b-post__txt_fontsize_15"><?php 
        echo reformat2($current['msg'], 40);
        ?>
</div>
                                <?php 
        if ($current['src_id'] > 0) {
            $attach = $stage->getMsgAttach($current['own_id']);
            ?>
                                <table class="b-layout__table b-layout__table_margtop_10" cellpadding="0" cellspacing="0" border="0">
                                    <?php 
            foreach ($attach as $src) {
                ?>
                                    <tr class="b-layout__tr">
                                        <td class="b-layout__middle b-layout__middle_padbot_5"><div class="b-layout__txt"><i class="b-icon b-icon_attach_<?php 
                echo getICOFile(CFile::getext($src['name']));
                ?>
"></i> <a class="b-layout__link" href="<?php 
                echo WDCPREFIX;
                ?>
/<?php 
                echo $src['path'] . $src['name'];
                ?>
" target="_blank"><?php 
                echo $src['orig_name'];
                ?>
</a>, <?php 
                echo ConvertBtoMB($src['size']);
                ?>
</div></td>
                                        <td class="b-layout__right b-layout__right_padleft_20 b-layout__right_padbot_5"><div class="b-layout__txt"><a class="b-layout__link" href="<?php 
Example #29
0
 /**
  * Получить текущий список файлов.
  *
  * @param array $status Статус файлов которые надо получить
  *
  * @return array Текущий список файлов
  */
 public function getFiles($status = array(1, 3), $md5key = false, $md5id = false, $skey = false)
 {
     global $DB;
     $files = array();
     $sql = 'SELECT * FROM attachedfiles WHERE session ' . ($skey ? ' = ?u' : 'IN (?l)') . ' AND status IN (?l) ORDER BY DATE, file_id;';
     $qFiles = $DB->rows($sql, $skey ? $this->session[$skey] : $this->session, $status);
     if ($qFiles) {
         foreach ($qFiles as $file) {
             $cFile = new CFile($file['file_id']);
             if ($cFile->id) {
                 $arr = array('id' => $md5id ? md5($cFile->id) : $cFile->id, 'name' => $cFile->name, 'path' => $cFile->path, 'size' => $cFile->size, 'tsize' => ConvertBtoMB($cFile->size), 'orig_name' => $cFile->original_name, 'type' => $cFile->getext(), 'status' => $file['status']);
                 if (!$md5key) {
                     array_push($files, $arr);
                 } else {
                     $files[md5($cFile->id)] = $arr;
                 }
             }
         }
     }
     return $files;
 }
 **/
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/stdf.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/CFile.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/dav_file_upload.php';
if (!hasPermissions('admin')) {
    header('Location: /404.php');
    exit;
}
$srcdir = $_SERVER['DOCUMENT_ROOT'] . '/about';
$ls = scandir($srcdir);
foreach ($ls as $item) {
    if ($item != '.' && $item !== '..' && !is_dir("{$srcdir}/{$item}")) {
        $filedata = array('name' => $item, 'tmp_name' => "{$srcdir}/{$item}", 'size' => filesize("{$srcdir}/{$item}"));
        $srcfile = new CFile($filedata);
        $srcfile->unlinkOff = true;
        $path = 'about/documents';
        $destfile = new CFile("{$path}/{$item}", dav_file_upload::FILE_TABLE);
        $rename_name = '';
        if ($destfile->id) {
            $ext = $destfile->getext($destfile->name);
            $tmp = $destfile->secure_tmpname($path . '/', '.' . $ext);
            $rename_name = substr_replace($tmp, '', 0, strlen($path) + 1);
            $destfile->Rename("{$path}/{$rename_name}");
        }
        $srcfile->server_root = 1;
        $srcfile->max_size = dav_file_upload::MAX_FILE_SIZE;
        $r = $srcfile->MoveUploadedFile($path . '/', true, $item);
        dav_file_upload::addRecord($srcfile->id, $srcfile->name, $rename_name);
        echo "Copy {$srcdir}/{$item} " . WDCPREFIX . '/' . $path . '/' . $item . '<br><br>';
    }
}