Exemplo n.º 1
0
 /**
  * Метод, предназначенный для получения и вывода списка Запросов
  *
  * @param boolean $pagination признак формирования постраничного списка
  */
 function _requestListGet($pagination = true)
 {
     global $AVE_DB, $AVE_Template;
     $limit = '';
     // Если используется постраничная навигация
     if ($pagination) {
         // Определяем лимит записей на страницу и начало диапазона выборки
         $limit = $this->_limit;
         $start = get_current_page() * $limit - $limit;
         // Получаем общее количество запросов
         $num = $AVE_DB->Query("SELECT COUNT(*) FROM " . PREFIX . "_request")->GetCell();
         // Если количество больше, чем установленный лимит, тогда формируем постраничную навигацию
         if ($num > $limit) {
             $page_nav = " <a class=\"pnav\" href=\"index.php?do=request&page={s}&amp;cp=" . SESSION . "\">{t}</a> ";
             $page_nav = get_pagination(ceil($num / $limit), 'page', $page_nav);
             $AVE_Template->assign('page_nav', $page_nav);
         }
         $limit = $pagination ? "LIMIT " . $start . "," . $limit : '';
     }
     // Выполняем запрос к БД на получение списка запросов с учетом лимита вывода на страницу (если необходимо)
     $items = array();
     $sql = $AVE_DB->Query("\r\n\t\t\tSELECT *\r\n\t\t\tFROM " . PREFIX . "_request\r\n\t\t\tORDER BY Id ASC\r\n\t\t\t" . $limit . "\r\n\t\t");
     // Формируем массив из полученных данных
     while ($row = $sql->FetchRow()) {
         $row->request_author = get_username_by_id($row->request_author_id);
         array_push($items, $row);
     }
     // Возвращаем массив
     return $items;
 }
Exemplo n.º 2
0
 /**
  * Вывод списка системных блоков
  *
  */
 function sys_blockList()
 {
     global $AVE_DB, $AVE_Template;
     $sys_blocks = array();
     $sql = $AVE_DB->Query("SELECT * FROM " . PREFIX . "_sysblocks");
     // Формируем массив из полученных данных
     while ($result = $sql->FetchRow()) {
         $result->sysblock_author_id = get_username_by_id($result->sysblock_author_id);
         array_push($sys_blocks, $result);
     }
     $AVE_Template->assign('sys_blocks', $sys_blocks);
     $AVE_Template->assign('content', $AVE_Template->fetch('sysblocks/list.tpl'));
 }
Exemplo n.º 3
0
 /**
  * Метод, предназначенный для просмотра и добавления Заметок к Документу
  *
  * @param int $reply	признак ответа на Заметку
  */
 function documentRemarkNew($document_id = 0, $reply = 0)
 {
     global $AVE_DB, $AVE_Template;
     // Если id документа не число или 0, прерываем выполнение
     if (!(is_numeric($document_id) && $document_id > 0)) {
         exit;
     }
     // Если в запросе пришел параметр на Сохранение
     if (isset($_REQUEST['sub']) && $_REQUEST['sub'] == 'save') {
         // Если пользователь оставил комментарий и у него имеются права и это не ответ, а новая заметка, тогда
         if (!empty($_REQUEST['remark_text']) && check_permission('remarks') && empty($_REQUEST['reply'])) {
             // Выполняем запрос к БД на добавление новой заметки для документа
             $AVE_DB->Query("\n\t\t\t\t\tINSERT " . PREFIX . "_document_remarks\n\t\t\t\t\tSET\n\t\t\t\t\t\tdocument_id         = '" . $document_id . "',\n\t\t\t\t\t\tremark_title        = '" . clean_no_print_char($_REQUEST['remark_title']) . "',\n\t\t\t\t\t\tremark_text         = '" . substr(clean_no_print_char($_REQUEST['remark_text']), 0, $this->_max_remark_length) . "',\n\t\t\t\t\t\tremark_author_id    = '" . $_SESSION['user_id'] . "',\n\t\t\t\t\t\tremark_published    = '" . time() . "',\n\t\t\t\t\t\tremark_first        = '1',\n\t\t\t\t\t\tremark_author_email = '" . $_SESSION['user_email'] . "'\n\t\t\t\t");
         }
         // Выполняем обновление страницы
         header('Location:index.php?do=docs&action=remark_reply&Id=' . $document_id . '&pop=1&cp=' . SESSION);
     }
     // Если это ответ на уже существующую заметку
     if ($reply == 1) {
         if (isset($_REQUEST['sub']) && $_REQUEST['sub'] == 'save') {
             // Если пользователь оставил ответ и имеет на это права
             if (!empty($_REQUEST['remark_text']) && check_permission('remarks')) {
                 // Выполняем запрос на получение e-mail адреса автора заметки
                 $remark_author_email = $AVE_DB->Query("\n\t\t\t\t\t\tSELECT remark_author_email\n\t\t\t\t\t\tFROM  " . PREFIX . "_document_remarks\n\t\t\t\t\t\tWHERE remark_first = '1'\n\t\t\t\t\t\tAND document_id = '" . $document_id . "'\n\t\t\t\t\t")->GetCell();
                 // Выполняем запрос к БД на добавление заметки в БД
                 $AVE_DB->Query("\n\t\t\t\t\t\tINSERT " . PREFIX . "_document_remarks\n\t\t\t\t\t\tSET\n\t\t\t\t\t\t\tdocument_id         = '" . $document_id . "',\n\t\t\t\t\t\t\tremark_title        = '" . clean_no_print_char($_REQUEST['remark_title']) . "',\n\t\t\t\t\t\t\tremark_text         = '" . substr(clean_no_print_char($_REQUEST['remark_text']), 0, $this->_max_remark_length) . "',\n\t\t\t\t\t\t\tremark_author_id    = '" . $_SESSION['user_id'] . "',\n\t\t\t\t\t\t\tremark_published    = '" . time() . "',\n\t\t\t\t\t\t\tremark_first        = '0',\n\t\t\t\t\t\t\tremark_author_email = '" . $_SESSION['user_email'] . "'\n\t\t\t\t\t");
             }
             // Формируем сообщение и отправляем письмо автору, с информацией о том, что на его заметку есть ответ
             $system_mail = get_settings('mail_from');
             $system_mail_name = get_settings('mail_from_name');
             $link = get_home_link() . 'index.php?do=docs&doc_id=' . $document_id;
             $body_to_admin = $AVE_Template->get_config_vars('DOC_MAIL_BODY_NOTICE');
             $body_to_admin = str_replace('%N%', "\n", $body_to_admin);
             $body_to_admin = str_replace('%TITLE%', stripslashes($_POST['remark_title']), $body_to_admin);
             $body_to_admin = str_replace('%USER%', get_username_by_id($_SESSION['user_id']), $body_to_admin);
             $body_to_admin = str_replace('%LINK%', $link, $body_to_admin);
             send_mail($remark_author_email, $body_to_admin, $AVE_Template->get_config_vars('DOC_MAIL_SUBJECT_NOTICE'), $system_mail, $system_mail_name, 'text');
             // Выполняем обновление страницы
             header('Location:index.php?do=docs&action=remark_reply&Id=' . $document_id . '&pop=1&cp=' . SESSION);
         }
         // Получаем общее количество заметок для документа
         $num = $AVE_DB->Query("\n\t\t\t\tSELECT COUNT(*)\n\t\t\t\tFROM " . PREFIX . "_document_remarks\n\t\t\t\tWHERE document_id = '" . $document_id . "'\n\t\t\t")->GetCell();
         // Определяыем лимит заметок на 1 странице и подсчитываем количество страниц
         $limit = 10;
         $seiten = ceil($num / $limit);
         $start = get_current_page() * $limit - $limit;
         $answers = array();
         // Выполняем запрос к БД на получение заметок с учетом количества на 1 странцу
         $sql = $AVE_DB->Query("\n\t\t\t\tSELECT *\n\t\t\t\tFROM " . PREFIX . "_document_remarks\n\t\t\t\tWHERE document_id = '" . $document_id . "'\n\t\t\t\tORDER BY Id DESC\n\t\t\t\tLIMIT " . $start . "," . $limit);
         while ($row = $sql->FetchAssocArray()) {
             $row['remark_author'] = get_username_by_id($row['remark_author_id']);
             $row['remark_text'] = nl2br($row['remark_text']);
             array_push($answers, $row);
         }
         $remark_status = $AVE_DB->Query("\n\t\t\t\tSELECT remark_status\n\t\t\t\tFROM " . PREFIX . "_document_remarks\n\t\t\t\tWHERE document_id = '" . $document_id . "'\n\t\t\t\tAND remark_first = '1'\n\t\t\t")->GetCell();
         // Если количество заметок превышает допустимое значение, определенное в переменной $limit, тогда
         // формируем постраничную навигацию
         if ($num > $limit) {
             $page_nav = " <a class=\"pnav\" href=\"index.php?do=docs&action=remark_reply&Id=" . $document_id . "&page={s}&pop=1&cp=" . SESSION . "\">{t}</a> ";
             $page_nav = get_pagination($seiten, 'page', $page_nav);
             $AVE_Template->assign('page_nav', $page_nav);
         }
         // Передаем данные  в шаблон и отображаем страницу со списком заметок
         $AVE_Template->assign('remark_status', $remark_status);
         $AVE_Template->assign('answers', $answers);
         $AVE_Template->assign('reply', 1);
         $AVE_Template->assign('formaction', 'index.php?do=docs&action=remark_reply&sub=save&Id=' . $document_id . '&reply=1&cp=' . SESSION);
         $AVE_Template->assign('content', $AVE_Template->fetch('documents/newremark.tpl'));
     } else {
         // В противном случае, если заметок еще нет, открываем форму для добавление заметки
         $AVE_Template->assign('reply', 1);
         $AVE_Template->assign('new', 1);
         $AVE_Template->assign('formaction', 'index.php?do=docs&action=remark&sub=save&Id=' . $document_id . '&cp=' . SESSION);
         $AVE_Template->assign('content', $AVE_Template->fetch('documents/newremark.tpl'));
     }
 }
Exemplo n.º 4
0
/**
 * Обработка тега запроса.
 * Возвращает список документов удовлетворяющих параметрам запроса
 * оформленный с использованием шаблона
 *
 * @param int $id	идентификатор запроса
 * @return string
 */
function request_parse($id)
{
    global $AVE_Core, $AVE_DB, $request_documents;
    $return = '';
    if (is_array($id)) {
        $id = $id[1];
    }
    $row_ab = $AVE_DB->Query("\r\n\t\tSELECT *\r\n\t\tFROM " . PREFIX . "_request\r\n\t\tWHERE Id = '" . $id . "'\r\n\t")->FetchRow();
    if (is_object($row_ab)) {
        $ttl = (int) $row_ab->request_cache_lifetime;
        $limit = $row_ab->request_items_per_page < 1 ? 1 : $row_ab->request_items_per_page;
        $main_template = $row_ab->request_template_main;
        $item_template = $row_ab->request_template_item;
        $request_order_by = $row_ab->request_order_by;
        $request_asc_desc = $row_ab->request_asc_desc;
        $request_order = $request_order_by . " " . $request_asc_desc;
        $request_order_fields = '';
        $request_order_tables = '';
        if ($row_ab->request_order_by_nat) {
            $request_order_tables = "LEFT JOIN " . PREFIX . "_document_fields AS s" . $row_ab->request_order_by_nat . "\r\n\t\t\t    ON (s" . $row_ab->request_order_by_nat . ".document_id = a.Id and s" . $row_ab->request_order_by_nat . ".rubric_field_id=" . $row_ab->request_order_by_nat . ")";
            $request_order_fields = "s" . $row_ab->request_order_by_nat . ".field_value, ";
            $request_order = "s" . $row_ab->request_order_by_nat . ".field_value " . $row_ab->request_asc_desc;
        }
        $doctime = get_settings('use_doctime') ? "AND a.document_published <= UNIX_TIMESTAMP() AND\r\n \t\t         \t(a.document_expire = 0 OR a.document_expire >=UNIX_TIMESTAMP())" : '';
        $where_cond = empty($_POST['req_' . $id]) && empty($_SESSION['doc_' . $AVE_Core->curentdoc->Id]['req_' . $id]) ? unserialize($row_ab->request_where_cond) : unserialize(request_get_condition_sql_string($row_ab->Id));
        $where_cond['from'] = str_replace('%%PREFIX%%', PREFIX, $where_cond['from']);
        $where_cond['where'] = str_replace('%%PREFIX%%', PREFIX, $where_cond['where']);
        if ($row_ab->request_show_pagination == 1) {
            if (!empty($AVE_Core->install_modules['comment']->Status)) {
                $num = $AVE_DB->Query(eval2var(" ?> \r\n\t\t\t\t\tSELECT COUNT(*)\r\n\t\t\t\t\tFROM \r\n\t\t\t\t\t" . ($where_cond['from'] ? $where_cond['from'] : '') . "\r\n\t\t\t\t\t" . PREFIX . "_documents AS a\r\n\t\t\t\t\tWHERE\r\n\t\t\t\t\t\ta.Id != '1'\r\n\t\t\t\t\tAND a.Id != '" . PAGE_NOT_FOUND_ID . "'\r\n\t\t\t\t\tAND a.Id != '" . get_current_document_id() . "'\r\n\t\t\t\t\tAND a.rubric_id = '" . $row_ab->rubric_id . "'\r\n\t\t\t\t\tAND a.document_deleted != '1'\r\n\t\t\t\t\tAND a.document_status != '0'\r\n\t\t\t\t\t" . $where_cond['where'] . "\r\n\t\t\t\t\t" . $doctime . "\r\n\t\t\t\t<?php "), $ttl, 'rub_' . $row_ab->rubric_id)->GetCell();
            } else {
                $num = $AVE_DB->Query(eval2var(" ?>\r\n\t\t\t\t\tSELECT COUNT(*)\r\n\t\t\t\t\tFROM \r\n\t\t\t\t\t" . ($where_cond['from'] ? $where_cond['from'] : '') . "\r\n\t\t\t\t\t" . PREFIX . "_documents AS a\r\n\t\t\t\t\tWHERE\r\n\t\t\t\t\t\ta.Id != '1'\r\n\t\t\t\t\tAND a.Id != '" . PAGE_NOT_FOUND_ID . "'\r\n\t\t\t\t\tAND a.Id != '" . get_current_document_id() . "'\r\n\t\t\t\t\tAND a.rubric_id = '" . $row_ab->rubric_id . "'\r\n\t\t\t\t\tAND a.document_deleted != '1'\r\n\t\t\t\t\tAND a.document_status != '0'\r\n\t\t\t\t\t" . $where_cond['where'] . "\r\n\t\t\t\t\t" . $doctime . "\r\n\t\t\t\t<?php "), $ttl, 'rub_' . $row_ab->rubric_id)->GetCell();
            }
            $seiten = ceil($num / $limit);
            if (isset($_REQUEST['apage']) && is_numeric($_REQUEST['apage']) && $_REQUEST['apage'] > $seiten) {
                $redirect_link = rewrite_link('index.php?id=' . $AVE_Core->curentdoc->Id . '&amp;doc=' . (empty($AVE_Core->curentdoc->document_alias) ? prepare_url($AVE_Core->curentdoc->document_title) : $AVE_Core->curentdoc->document_alias) . (isset($_REQUEST['artpage']) && is_numeric($_REQUEST['artpage']) ? '&amp;artpage=' . $_REQUEST['artpage'] : '') . (isset($_REQUEST['page']) && is_numeric($_REQUEST['page']) ? '&amp;page=' . $_REQUEST['page'] : ''));
                header('Location:' . $redirect_link);
                exit;
            }
            $start = get_current_page('apage') * $limit - $limit;
        } else {
            $start = 0;
        }
        if ($row_ab->request_items_per_page != 0) {
            $filter_limit = "LIMIT " . $start . "," . $limit;
        }
        if (!empty($AVE_Core->install_modules['comment']->Status)) {
            $q = " ?>\r\n\t\t\t\tSELECT\r\n\t\t\t\t\t" . $request_order_fields . "\r\n\t\t\t\t\ta.Id,\r\n\t\t\t\t\ta.document_title,\r\n\t\t\t\t\ta.document_alias,\r\n\t\t\t\t\ta.document_author_id,\r\n\t\t\t\t\ta.document_count_view,\r\n\t\t\t\t\ta.document_published,\r\n\t\t\t\t\tCOUNT(b.document_id) AS nums\r\n\t\t\t\tFROM\r\n\t\t\t\t\t" . ($where_cond['from'] ? $where_cond['from'] : '') . "\r\n\t\t\t\t\t" . PREFIX . "_documents AS a\r\n\t\t\t\tLEFT JOIN\r\n\t\t\t\t\t" . PREFIX . "_modul_comment_info AS b\r\n\t\t\t\t\t\tON b.document_id = a.Id\r\n\t\t\t\t    " . ($request_order_tables > '' ? $request_order_tables : '') . "\t\r\n\t\t\t\tWHERE\r\n\t\t\t\t\ta.Id != '1'\r\n\t\t\t\tAND a.Id != '" . PAGE_NOT_FOUND_ID . "'\r\n\t\t\t\tAND a.Id != '" . get_current_document_id() . "'\r\n\t\t\t\tAND a.rubric_id = '" . $row_ab->rubric_id . "'\r\n\t\t\t\tAND a.document_deleted != '1'\r\n\t\t\t\tAND a.document_status != '0'\r\n\t\t\t\t" . $where_cond['where'] . "\r\n\t\t\t\t" . $doctime . "\r\n\t\t\t\tGROUP BY a.Id\r\n\t\t\t\tORDER BY " . $request_order . "\r\n\t\t\t\t" . $filter_limit . " <?php ";
        } else {
            $q = " ?>\r\n\t\t\t\tSELECT\r\n\t\t\t\t\t" . $request_order_fields . "\r\n\t\t\t\t\ta.Id,\r\n\t\t\t\t\ta.document_title,\r\n\t\t\t\t\ta.document_alias,\r\n\t\t\t\t\ta.document_author_id,\r\n\t\t\t\t\ta.document_count_view,\r\n\t\t\t\t\ta.document_published\r\n\t\t\t\tFROM\r\n\t\t\t\t\t" . ($where_cond['from'] ? $where_cond['from'] : '') . "\r\n\t\t\t\t\t\r\n\t\t\t\t\t" . PREFIX . "_documents AS a\r\n\t\t\t\t\t" . ($request_order_tables > '' ? $request_order_tables : "") . "\r\n\t\t\t\tWHERE\r\n\t\t\t\t\ta.Id != '1'\r\n\t\t\t\tAND a.Id != '" . PAGE_NOT_FOUND_ID . "'\r\n\t\t\t\tAND a.Id != '" . get_current_document_id() . "'\r\n\t\t\t\tAND a.rubric_id = '" . $row_ab->rubric_id . "'\r\n\t\t\t\tAND a.document_deleted != '1'\r\n\t\t\t\tAND a.document_status != '0'\r\n\t\t\t\t" . $where_cond['where'] . "\r\n\t\t\t\t" . $doctime . "\r\n\t\t\t\tORDER BY " . $request_order . "\r\n\t\t\t\t" . $filter_limit . " <?php ";
        }
        $q = eval2var($q);
        $q = $AVE_DB->Query($q, $ttl, 'rub_' . $row_ab->rubric_id);
        if ($q->NumRows() > 0) {
            $main_template = preg_replace('/\\[tag:if_empty](.*?)\\[\\/tag:if_empty]/si', '', $main_template);
            $main_template = str_replace(array('[tag:if_notempty]', '[/tag:if_notempty]'), '', $main_template);
        } else {
            $main_template = preg_replace('/\\[tag:if_notempty](.*?)\\[\\/tag:if_notempty]/si', '', $main_template);
            $main_template = str_replace(array('[tag:if_empty]', '[/tag:if_empty]'), '', $main_template);
        }
        $page_nav = '';
        if ($row_ab->request_show_pagination == 1 && $seiten > 1 && $row_ab->request_items_per_page != 0) {
            $page_nav = ' <a class="pnav" href="index.php?id=' . $AVE_Core->curentdoc->Id . '&amp;doc=' . (empty($AVE_Core->curentdoc->document_alias) ? prepare_url($AVE_Core->curentdoc->document_title) : $AVE_Core->curentdoc->document_alias) . (isset($_REQUEST['artpage']) && is_numeric($_REQUEST['artpage']) ? '&amp;artpage=' . $_REQUEST['artpage'] : '') . '&amp;apage={s}' . (isset($_REQUEST['page']) && is_numeric($_REQUEST['page']) ? '&amp;page=' . $_REQUEST['page'] : '') . '">{t}</a> ';
            $page_nav = get_pagination($seiten, 'apage', $page_nav, get_settings('navi_box'));
            $page_nav = rewrite_link($page_nav);
        }
        $rows = array();
        $request_documents = array();
        while ($row = $q->FetchRow()) {
            array_push($request_documents, $row->Id);
            array_push($rows, $row);
        }
        $items = '';
        foreach ($rows as $row) {
            $cachefile_docid = BASE_DIR . '/cache/sql/doc_' . $row->Id . '/request-' . $id . '.cache';
            if (!file_exists($cachefile_docid)) {
                $item = preg_replace('/\\[tag:rfld:(\\d+)]\\[(more|esc|[0-9-]+)]/e', "request_get_document_field(\"\$1\", {$row->Id}, \"\$2\")", $item_template);
                //if(!file_exists(dirname($cachefile_docid)))mkdir(dirname($cachefile_docid),0777,true);
                //file_put_contents($cachefile_docid,$item);
            } else {
                $item = file_get_contents($cachefile_docid);
            }
            $link = rewrite_link('index.php?id=' . $row->Id . '&amp;doc=' . (empty($row->document_alias) ? prepare_url($row->document_title) : $row->document_alias));
            $item = str_replace('[tag:link]', $link, $item);
            $item = str_replace('[tag:docid]', $row->Id, $item);
            $item = str_replace('[tag:doctitle]', $row->document_title, $item);
            $item = str_replace('[tag:docparent]', $row->document_parent, $item);
            $item = str_replace('[tag:docdate]', pretty_date(strftime(DATE_FORMAT, $row->document_published)), $item);
            $item = str_replace('[tag:doctime]', pretty_date(strftime(TIME_FORMAT, $row->document_published)), $item);
            $item = str_replace('[tag:docauthor]', get_username_by_id($row->document_author_id), $item);
            $item = str_replace('[tag:docviews]', $row->document_count_view, $item);
            $item = str_replace('[tag:doccomments]', isset($row->nums) ? $row->nums : '', $item);
            $items .= $item;
        }
        $main_template = str_replace('[tag:pages]', $page_nav, $main_template);
        $main_template = str_replace('[tag:doctotal]', $seiten * $q->NumRows(), $main_template);
        $main_template = str_replace('[tag:pagetitle]', $AVE_DB->Query("SELECT document_title FROM " . PREFIX . "_documents WHERE Id = '" . $AVE_Core->curentdoc->Id . "' ")->GetCell(), $main_template);
        $main_template = str_replace('[tag:docid]', $AVE_Core->curentdoc->Id, $main_template);
        $main_template = str_replace('[tag:docdate]', pretty_date(strftime(DATE_FORMAT, $AVE_Core->curentdoc->document_published)), $main_template);
        $main_template = str_replace('[tag:doctime]', pretty_date(strftime(TIME_FORMAT, $AVE_Core->curentdoc->document_published)), $main_template);
        $main_template = str_replace('[tag:docauthor]', get_username_by_id($AVE_Core->curentdoc->document_author_id), $main_template);
        $main_template = preg_replace('/\\[tag:dropdown:([,0-9]+)\\]/e', "request_get_dropdown(\"\$1\", " . $row_ab->rubric_id . ", " . $row_ab->Id . ");", $main_template);
        $return = str_replace('[tag:content]', $items, $main_template);
        $return = str_replace('[tag:path]', ABS_PATH, $return);
        $return = str_replace('[tag:mediapath]', ABS_PATH . 'templates/' . THEME_FOLDER . '/', $return);
        $return = $AVE_Core->coreModuleTagParse($return);
    }
    return $return;
}
Exemplo n.º 5
0
            $patient = get_patient_by_id($specimen->patientId);
            if ($patient != null && trim($patient->addlId) != "") {
                //echo " (Addl ID: $patient->addlId )";
            }
            ?>
				</td>
				<td>
					<?php 
            $patient = get_patient_by_id($specimen->patientId);
            echo $patient->getName();
            ?>
				</td>
				<td><?php 
            echo DateLib::mysqlToString($specimen->dateCollected);
            ?>
</td>
				<td><?php 
            echo get_username_by_id($specimen->userId);
            ?>
</td>
			</tr>
		<?php 
        }
        ?>
		</tbody>
	</table>
	<?php 
    }
    # TODO: Add paging to the above table
}
include "includes/footer.php";
Exemplo n.º 6
0
echo '<table class="admin_log">';
echo '	<tr>';
echo '		<td class="event" >Händelse</td>';
echo '		<td class="comment" >Info</td>';
echo '		<td class="time" >Tidpunkt</td>';
echo '		<td class="admin" >Admin</td>';
echo '		<td class="user" >Användare</td>';
echo '		<td class="item" >Item id</td>';
echo '	</tr>';
while ($data = mysql_fetch_assoc($result)) {
    echo '<tr>';
    echo '	<td class="event" >' . $data['event'] . '</td>';
    echo '	<td class="comment" >' . $data['value'] . '</td>';
    echo '	<td>' . fix_time($data['timestamp']) . '</td>';
    echo '	<td>' . ($numeric ? $data['admin_id'] : get_username_by_id($data['admin_id'])) . '</td>';
    echo '	<td>' . ($numeric ? $data['user_id'] : get_username_by_id($data['user_id'])) . '</td>';
    echo '	<td>' . $data['item_id'] . '</td>';
    echo '</tr>';
}
echo '</table>';
echo rounded_corners_bottom();
ui_bottom();
//functions used in this script
function get_userid_by_name($username)
{
    //hämta användarid
    $query = 'SELECT id FROM login WHERE username = "******"';
    $result = mysql_query($query) or die(report_sql_error($query));
    if ($data = mysql_fetch_assoc($result)) {
        $user_id = $data['id'];
    } else {
Exemplo n.º 7
0
        echo $row->posttype != 'upload' && $row->posttype != 'url' ? $row->posttype : 'photo';
        ?>

                                    </td>



                                    <td data-title="Type" class="numeric">

                                        <a href="<?php 
        echo site_url('admin/users/detail/' . $row->created_by);
        ?>
">

                                            <?php 
        echo get_username_by_id($row->created_by);
        ?>

                                        </a>

                                    </td>



                                    <td data-title="Email" class="numeric"><?php 
        echo $row->featured == 1 ? '<div class="alert alert-success" style="margin-top:5px;">Featured</div>' : '<div class="alert alert-info" style="margin-top:5px;">Not Featured</div>';
        ?>
</td>

                                
Exemplo n.º 8
0
    ?>
                                <tr>
					<td><?php 
    echo "User";
    ?>
 </td>
					<td>
						<select name='user_id' id='user_id' class='uniform_width'>
						<?php 
    foreach ($user_ids as $uid) {
        ?>
                                                    <option value='<?php 
        echo $uid;
        ?>
'><?php 
        echo get_username_by_id($uid);
        ?>
</option>	
						<?php 
    }
    ?>
                                                </select>
					</td>
				</tr>
                        <?php 
} else {
    ?>
				<tr>
					<td><?php 
    echo LangUtil::$generalTerms['FACILITY'];
    ?>
Exemplo n.º 9
0
        break;
}
while ($data = mysql_fetch_assoc($result)) {
    switch ($format) {
        case 'styled':
            $output .= '<tr>';
            $output .= '	<td class="event" >' . $data['event'] . '</td>';
            $output .= '	<td class="comment" >' . $data['value'] . '</td>';
            $output .= '	<td>' . fix_time($data['timestamp']) . '</td>';
            $output .= '	<td>' . ($numeric ? $data['admin_id'] : get_username_by_id($data['admin_id'])) . '</td>';
            $output .= '	<td>' . ($numeric ? $data['user_id'] : get_username_by_id($data['user_id'])) . '</td>';
            $output .= '	<td>' . $data['item_id'] . '</td>';
            $output .= '</tr>';
            break;
        case 'csv':
            $row = array('event' => $data['event'], 'comment' => $data['value'], 'timestamp' => date('Y-m-d H:i', $data['timestamp']), 'admin' => $numeric ? $data['admin_id'] : get_username_by_id($data['admin_id']), 'user' => $numeric ? $data['user_id'] : get_username_by_id($data['user_id']), 'item_id' => $data['item_id']);
            //$row = array_map('md5', $row);
            $output .= '' . implode("\t", $row) . '' . "\n";
            break;
    }
}
if ($format == 'styled') {
    $output .= '</table>';
    $output .= rounded_corners_bottom();
}
switch ($format) {
    case 'styled':
        ui_top($ui_options);
        echo $output;
        ui_bottom();
        break;
Exemplo n.º 10
0
function DisplayMainDocuments()
{
    global $AVE_DB, $AVE_Template;
    $doc_start = array();
    $sql = $AVE_DB->Query("\n\t\tSELECT \n\t\t\tdoc.*,\n\t\t\trub.rubric_admin_teaser_template\n\t\tFROM " . PREFIX . "_documents doc\n\t\tLEFT JOIN " . PREFIX . "_rubrics AS rub ON rub.Id = doc.rubric_id\n\t\tORDER BY doc.document_published DESC LIMIT 0,10");
    while ($row = $sql->fetchrow()) {
        $row->rubric_title = showrubricName($row->rubric_id);
        $row->document_author = get_username_by_id($row->document_author_id);
        // Получаем имя пользователя (Автора)
        $row->cantEdit = 0;
        $row->canDelete = 0;
        $row->canEndDel = 0;
        $row->canOpenClose = 0;
        $row->rubric_admin_teaser_template = @eval2var('?>' . ($row->rubric_admin_teaser_template > '' ? @showrequestelement($row, $row->rubric_admin_teaser_template) : '') . '<?');
        // разрешаем редактирование и удаление
        // если автор имеет право изменять свои документы в рубрике
        // или пользователю разрешено изменять все документы в рубрике
        if ($row->document_author_id == @$_SESSION['user_id'] && isset($_SESSION[$row->rubric_id . '_editown']) && @$_SESSION[$row->rubric_id . '_editown'] == 1 || isset($_SESSION[$row->rubric_id . '_editall']) && $_SESSION[$row->rubric_id . '_editall'] == 1) {
            $row->cantEdit = 1;
            $row->canDelete = 1;
        }
        // запрещаем редактирование главной страницы и страницу ошибки 404 если требуется одобрение Администратора
        if (($row->Id == 1 || $row->Id == PAGE_NOT_FOUND_ID) && isset($_SESSION[$row->rubric_id . '_newnow']) && @$_SESSION[$row->rubric_id . '_newnow'] != 1) {
            $row->cantEdit = 0;
        }
        // разрешаем автору блокировать и разблокировать свои документы если не требуется одобрение Администратора
        if ($row->document_author_id == @$_SESSION['user_id'] && isset($_SESSION[$row->rubric_id . '_newnow']) && @$_SESSION[$row->rubric_id . '_newnow'] == 1) {
            $row->canOpenClose = 1;
        }
        // разрешаем всё, если пользователь принадлежит группе Администраторов или имеет все права на рубрику
        if (UGROUP == 1 || @$_SESSION[$row->rubric_id . '_alles'] == 1) {
            $row->cantEdit = 1;
            $row->canDelete = 1;
            $row->canEndDel = 1;
            $row->canOpenClose = 1;
        }
        // Запрещаем удаление Главной страницы и страницы с 404 ошибкой
        if ($row->Id == 1 || $row->Id == PAGE_NOT_FOUND_ID) {
            $row->canDelete = 0;
            $row->canEndDel = 0;
        }
        array_push($doc_start, $row);
    }
    $AVE_Template->assign('doc_start', $doc_start);
}
Exemplo n.º 11
0
 /**
  * Метод, предназанченный для сборки всей страницы в единое целое.
  *
  * @param int $id идентификатор документа
  * @param int $rub_id идентификатор рубрики
  */
 function coreSiteFetch($id, $rub_id = '')
 {
     global $AVE_DB;
     // Если происходит вызов модуля, получаем соответствующие мета-теги и получаем шаблон модуля
     if (!empty($_REQUEST['module'])) {
         $out = $this->_coreModuleMetatagsFetch();
         $out = $this->_coreDocumentTemplateGet('', '', $this->_coreModuleTemplateGet());
     } else {
         if (!isset($this->curentdoc->Id) && !$this->_coreCurrentDocumentFetch($id, UGROUP)) {
             // Определяем документ с 404 ошиюкой, в случае, если документ не найден
             if ($this->_corePageNotFoundFetch(PAGE_NOT_FOUND_ID, UGROUP)) {
                 $_REQUEST['id'] = $_GET['id'] = $id = PAGE_NOT_FOUND_ID;
             }
         }
         // проверяем параметры публикации документа
         if (!$this->_coreDocumentIsPublished()) {
             $this->_coreErrorPage404();
         }
         // Определяем права доступа к документам рубрики
         define('RUB_ID', !empty($rub_id) ? $rub_id : $this->curentdoc->rubric_id);
         $this->_coreRubricPermissionFetch(RUB_ID);
         if (!(isset($_SESSION[RUB_ID . '_docread']) && $_SESSION[RUB_ID . '_docread'] == 1 || isset($_SESSION[RUB_ID . '_alles']) && $_SESSION[RUB_ID . '_alles'] == 1)) {
             // читать запрещено - извлекаем ругательство и отдаём вместо контента
             $main_content = get_settings('message_forbidden');
         } else {
             if (isset($_REQUEST['print']) && $_REQUEST['print'] == 1) {
                 // увеличиваем счетчик версий для печати
                 $AVE_DB->Query("\r\n\t\t\t\t\t\tUPDATE " . PREFIX . "_documents\r\n\t\t\t\t\t\tSET document_count_print = document_count_print+1\r\n\t\t\t\t\t\tWHERE Id = '" . $id . "'\r\n\t\t\t\t\t");
             } else {
                 if (!isset($_SESSION['doc_view[' . $id . ']'])) {
                     // увеличиваем счетчик просмотров (1 раз в пределах сессии)
                     $AVE_DB->Query("\r\n\t\t\t\t\t\t\tUPDATE " . PREFIX . "_documents\r\n\t\t\t\t\t\t\tSET document_count_view = document_count_view+1\r\n\t\t\t\t\t\t\tWHERE Id = '" . $id . "'\r\n\t\t\t\t\t\t");
                     $_SESSION['doc_view[' . $id . ']'] = 1;
                 }
             }
             if (CACHE_DOC_TPL && empty($_POST) && !(isset($_SESSION['user_adminmode']) && $_SESSION['user_adminmode'] == 1)) {
                 // кэширование разрешено
                 // извлекаем скомпилированный шаблон документа из кэша
                 $main_content = $AVE_DB->Query("\r\n\t\t\t\t\t\tSELECT compiled\r\n\t\t\t\t\t\tFROM " . PREFIX . "_rubric_template_cache\r\n\t\t\t\t\t\tWHERE hash  = '" . $this->_get_cache_hash() . "'\r\n\t\t\t\t\t\tLIMIT 1\r\n\t\t\t\t\t")->GetCell();
             } else {
                 // кэширование запрещено
                 $main_content = false;
             }
             if (empty($main_content)) {
                 // кэш пустой или отключен, извлекаем и компилируем шаблон
                 if (!empty($this->curentdoc->rubric_template)) {
                     $rubTmpl = $this->curentdoc->rubric_template;
                 } else {
                     $rubTmpl = $AVE_DB->Query("\r\n\t\t\t\t\t\t\tSELECT rubric_template\r\n\t\t\t\t\t\t\tFROM " . PREFIX . "_rubrics\r\n\t\t\t\t\t\t\tWHERE Id = '" . RUB_ID . "'\r\n\t\t\t\t\t\t\tLIMIT 1\r\n\t\t\t\t\t\t")->GetCell();
                 }
                 $rubTmpl = trim($rubTmpl);
                 if (empty($rubTmpl)) {
                     // не задан шаблон рубрики
                     $main_content = $this->_rubric_template_empty;
                 } else {
                     // парсим теги полей в шаблоне документа
                     $main_content = preg_replace_callback('/\\[tag:fld:(\\d+)\\]/', 'document_get_field', $rubTmpl);
                     // удаляем ошибочные теги полей
                     $main_content = preg_replace('/\\[tag:fld:\\d*\\]/', '', $main_content);
                     if (CACHE_DOC_TPL && empty($_POST) && !(isset($_SESSION['user_adminmode']) && $_SESSION['user_adminmode'] == 1)) {
                         // кэширование разрешено
                         // сохраняем скомпилированный шаблон в кэш
                         $AVE_DB->Query("\r\n\t\t\t\t\t\t\t\tINSERT " . PREFIX . "_rubric_template_cache\r\n\t\t\t\t\t\t\t\tSET\r\n\t\t\t\t\t\t\t\t\thash     = '" . $this->_get_cache_hash() . "',\r\n\t\t\t\t\t\t\t\t\trub_id   = '" . RUB_ID . "',\r\n\t\t\t\t\t\t\t\t\tgrp_id   = '" . UGROUP . "',\r\n\t\t\t\t\t\t\t\t\tdoc_id   = '" . $id . "',\r\n\t\t\t\t\t\t\t\t\tcompiled = '" . addslashes($main_content) . "'\r\n\t\t\t\t\t\t\t");
                     }
                 }
             }
             $main_content = str_replace('[tag:docdate]', pretty_date(strftime(DATE_FORMAT, $this->curentdoc->document_published)), $main_content);
             $main_content = str_replace('[tag:doctime]', pretty_date(strftime(TIME_FORMAT, $this->curentdoc->document_published)), $main_content);
             $main_content = str_replace('[tag:docauthor]', get_username_by_id($this->curentdoc->document_author_id), $main_content);
         }
         $out = str_replace('[tag:maincontent]', $main_content, $this->_coreDocumentTemplateGet(RUB_ID));
     }
     // /вывод документа
     // Если в запросе пришел параметр print, т.е. страница для печати, парсим контент, который обрамлен
     // тегами только для печати
     if (isset($_REQUEST['print']) && $_REQUEST['print'] == 1) {
         $out = str_replace(array('[tag:if_print]', '[/tag:if_print]'), '', $out);
         $out = preg_replace('/\\[tag:if_notprint\\](.*?)\\[\\/tag:if_notprint\\]/si', '', $out);
     } else {
         // В противном случае наоборот, парсим только тот контент, который предназначен НЕ для печати
         $out = preg_replace('/\\[tag:if_print\\](.*?)\\[\\/tag:if_print\\]/si', '', $out);
         $out = str_replace(array('[tag:if_notprint]', '[/tag:if_notprint]'), '', $out);
     }
     // получаем из шаблона системный тег, определяющий название темы дизайна
     $match = '';
     preg_match('/\\[tag:theme:(\\w+)]/', $out, $match);
     define('THEME_FOLDER', empty($match[1]) ? DEFAULT_THEME_FOLDER : $match[1]);
     $out = preg_replace('/\\[tag:theme:(.*?)]/', '', $out);
     // парсим теги модулей
     $out = $this->coreModuleTagParse($out);
     if (isset($_REQUEST['module']) && !(isset($this->install_modules[$_REQUEST['module']]) && '1' == $this->install_modules[$_REQUEST['module']]->Status)) {
         display_notice($this->_module_error);
     }
     // парсим теги системы внутренних запросов
     $out = preg_replace_callback('/\\[tag:request:(\\d+)\\]/', 'request_parse', $out);
     // парсим теги скрытого текста
     $out = parse_hide($out);
     // парсим остальные теги основного шаблона
     $search = array('[tag:mediapath]', '[tag:path]', '[tag:sitename]', '[tag:document]', '[tag:home]', '[tag:robots]', '[tag:docid]', '[tag:breadcrumb]');
     $replace = array(ABS_PATH . 'templates/' . THEME_FOLDER . '/', ABS_PATH, htmlspecialchars(get_settings('site_name'), ENT_QUOTES), get_redirect_link('print'), get_home_link(), isset($this->curentdoc->document_meta_robots) ? $this->curentdoc->document_meta_robots : '', isset($this->curentdoc->Id) ? $this->curentdoc->Id : '', get_breadcrumb());
     if (defined('MODULE_CONTENT')) {
         // парсинг тегов при выводе из модуля
         $search[] = '[tag:maincontent]';
         $replace[] = MODULE_CONTENT;
         $search[] = '[tag:title]';
         $replace[] = htmlspecialchars(defined('MODULE_SITE') ? MODULE_SITE : '', ENT_QUOTES);
         $search[] = '[tag:description]';
         $replace[] = htmlspecialchars(defined('MODULE_DESCRIPTION') ? MODULE_DESCRIPTION : '', ENT_QUOTES);
         $search[] = '[tag:keywords]';
         $replace[] = htmlspecialchars(defined('MODULE_KEYWORDS') ? MODULE_KEYWORDS : '', ENT_QUOTES);
     } else {
         $search[] = '[tag:keywords]';
         $replace[] = isset($this->curentdoc->document_meta_keywords) ? htmlspecialchars($this->curentdoc->document_meta_keywords, ENT_QUOTES) : '';
         $search[] = '[tag:description]';
         $replace[] = isset($this->curentdoc->document_meta_description) ? htmlspecialchars($this->curentdoc->document_meta_description, ENT_QUOTES) : '';
         $search[] = '[tag:title]';
         $replace[] = htmlspecialchars(pretty_chars($this->curentdoc->document_title), ENT_QUOTES);
     }
     $search[] = '[tag:maincontent]';
     $replace[] = '';
     $search[] = '[tag:printlink]';
     $replace[] = get_print_link();
     $search[] = '[tag:version]';
     $replace[] = APP_INFO;
     $search[] = '[tag:docviews]';
     $replace[] = isset($this->curentdoc->document_count_view) ? $this->curentdoc->document_count_view : '';
     $out = str_replace($search, $replace, $out);
     unset($search, $replace);
     // /парсим остальные теги основного шаблона
     // ЧПУ
     $out = rewrite_link($out);
     echo $out;
 }
Exemplo n.º 12
0
#
# Searches for lab configurations by search term
# Called via Ajax from lab_configs.php
#
session_start();
include "../includes/db_lib.php";
include "../includes/user_lib.php";
include "../includes/page_elems.php";
$page_elems = new PageElems();
$search_term = trim($_REQUEST['q']);
$admin_user_id = $_SESSION['user_id'];
$lab_config_list = get_lab_configs($admin_user_id);
if ($search_term == "") {
    # Return all entries
    $page_elems->getLabConfigTable($lab_config_list);
    return;
}
# Narrow down to matched configurations
$matched_lab_config_list = array();
foreach ($lab_config_list as $lab_config) {
    if (stripos($lab_config->getSiteName(), $search_term) !== false) {
        $matched_lab_config_list[] = $lab_config;
    } else {
        $username = get_username_by_id($lab_config->adminUserId);
        if (stripos($username, $search_term) !== false) {
            $matched_lab_config_list[] = $lab_config;
        }
    }
}
$page_elems->getLabConfigTable($matched_lab_config_list);
Exemplo n.º 13
0
 /**
  * Метод, предназначенный для смены автора документа
  *
  * @param int $doc_id		идентификатор документа
  * @param int $user_id		идентификатор пользователя
  */
 function changeAutorSave()
 {
     global $AVE_DB;
     // Если id документа число и оно больше 0, тогда
     if (is_numeric($_REQUEST['doc_id']) && $_REQUEST['doc_id'] > 0) {
         // Выполняем запрос к БД на обновление статуса у заметок
         $AVE_DB->Query("\n\t\t\t\tUPDATE " . PREFIX . "_documents\n\t\t\t\tSET document_author_id  = '" . $_REQUEST['user_id'] . "'\n\t\t\t\tWHERE Id = '" . $_REQUEST['doc_id'] . "'\n\t\t\t");
         $username = get_username_by_id($_REQUEST['user_id']);
         echo "\n\t\t\t\t<script>\n\t\t\t\t\twindow.opener.document.getElementById('doc_id_" . $_REQUEST['doc_id'] . "').textContent = '{$username}';\n\t\t\t\t\twindow.close();\n\t\t\t\t</script>\n\t\t\t";
     }
     exit;
 }
Exemplo n.º 14
0
	public function getTestInfoRow($test)
	{
		# Returns HTML table row containing specimen info
		# Called by getSpecimenTestsTable() function
		?>
		<tr valign='top'>
			<td>
				<?php echo get_test_name_by_id($test->testTypeId); ?>
			</td>
			<td>
				<?php
				if($test->isPending())
					echo LangUtil::$generalTerms['PENDING_RESULTS'];
				else
					echo $test->decodeResult();
				?>
			</td>
			<td>
				<?php echo $test->getComments(); ?>
			</td>
			<td>
				<?php echo get_username_by_id($test->userId); ?>
			</td>
			<td>
				<?php echo $test->getVerifiedBy(); ?>
			</td>
			<td>
			
			<?php
					if(check_removal_record($_SESSION['lab_config_id'], $test->testId) && is_admin(get_user_by_id($_SESSION['user_id']))!=1){
						echo "Test removed. Contact Lab admin";
					} else if(check_removal_record($_SESSION['lab_config_id'], $test->testId) && is_admin(get_user_by_id($_SESSION['user_id']))==1){
					?> <a href='javascript:retrieve_deleted(<?php echo $test->testId;?>, "test")' title='Click to retrieve deleted Test'>Retrieve Test</a>
					<?php 
					} else {
					?>
						<a href="javascript:delete_test(<?php echo  $test->testId ;?>)">Delete</a>
					<?php }
					?>
					
					
				
			</td>
			<?php
			$specimen_object=Specimen::getById($test->specimenId);
			$pid=$specimen_object->patientId;
			$sid=$test->specimenId;
				
			?>
			<!--<td><a href="javascript:get_report(<?php echo $pid;?>,<?php echo $sid;?> )">Report</a> </td>-->
			
		</tr>
		<?php
	}
Exemplo n.º 15
0
/**
 * Обработка тега запроса.
 * Возвращает список документов удовлетворяющих параметрам запроса
 * оформленный с использованием шаблона
 *
 * @param int $id	идентификатор запроса
 * @return string
 */
function request_parse($id, $params = array())
{
    global $AVE_Core, $AVE_DB, $request_documents;
    //Доберусь - надо сделать фишку чтобы если афтар не активен или удален то документы его в реквесте не выводятся
    //по идее это бы надстройкой к рекесту сделать чтобы новости не побить и т.д.
    $gen_time = microtime();
    $return = '';
    if (is_array($id)) {
        $id = $id[1];
    }
    $row_ab = $AVE_DB->Query("\n\t\tSELECT *\n\t\tFROM " . PREFIX . "_request\n\t\tWHERE Id = '" . $id . "'\n\t")->FetchRow();
    if (is_object($row_ab)) {
        $ttl = (int) $row_ab->request_cache_lifetime;
        $limit = isset($params['LIMIT']) && intval($params['LIMIT']) > 0 ? intval($params['LIMIT']) : ($row_ab->request_items_per_page > 0 ? $row_ab->request_items_per_page : 0);
        $main_template = $row_ab->request_template_main;
        $item_template = $row_ab->request_template_item;
        $request_order_by = $row_ab->request_order_by;
        $request_asc_desc = $row_ab->request_asc_desc;
        //строим списки подключаемых полей для сортировки
        $request_order = $request_order_by . " " . $request_asc_desc;
        $request_order_fields = '';
        $request_order_tables = '';
        $request_order1 = '';
        if ($row_ab->request_order_by_nat) {
            $request_order_tables = "LEFT JOIN " . PREFIX . "_document_fields AS s" . $row_ab->request_order_by_nat . "\n\t\t\t    ON (s" . $row_ab->request_order_by_nat . ".document_id = a.Id and s" . $row_ab->request_order_by_nat . ".rubric_field_id=" . $row_ab->request_order_by_nat . ")";
            $request_order_fields = "s" . $row_ab->request_order_by_nat . ".field_value, ";
            $request_order = "s" . $row_ab->request_order_by_nat . ".field_value " . $row_ab->request_asc_desc;
        }
        $x = 0;
        if (!empty($params['SORT']) && is_array($params['SORT'])) {
            foreach ($params['SORT'] as $k => $v) {
                if (intval($k) > 0) {
                    $x++;
                    $request_order_tables .= "LEFT JOIN " . PREFIX . "_document_fields AS s" . $k . "\n\t\t\t\t\t\tON (s" . $k . ".document_id = a.Id and s" . $k . ".rubric_field_id=" . $k . ")";
                    if (strpos($v, 'INT') === false) {
                        $request_order_fields .= "s" . $k . ".field_value, ";
                    } else {
                        $request_order_fields .= "s" . $k . ".field_number_value, ";
                        $v = str_replace('INT', '', $v);
                    }
                    $request_order1 .= $x . ' ' . $v . ', ';
                }
            }
        }
        /* ----------- */
        $request_order = addslashes($request_order1 . $request_order);
        $request_order2 = '';
        /* ----------- */
        //Этот кусок для того чтобы можно было параметрами попросить произвольный статус досумента
        //- например в личном кабинете попросить архивные документы
        $docstatus = "AND a.document_status != '0'";
        $docstatus = "AND a.document_status = '1'";
        if (isset($params['STATUS'])) {
            $docstatus = "AND a.document_status = '" . intval($params['STATUS']) . "'";
        }
        $doctime = get_settings('use_doctime') ? "AND a.document_published <= UNIX_TIMESTAMP() AND\n \t\t         \t(a.document_expire = 0 OR a.document_expire >=UNIX_TIMESTAMP())" : '';
        $where_cond = empty($_POST['req_' . $id]) && empty($_SESSION['doc_' . $AVE_Core->curentdoc->Id]['req_' . $id]) ? unserialize($row_ab->request_where_cond) : unserialize(request_get_condition_sql_string($row_ab->Id));
        $where_cond['from'] = str_replace('%%PREFIX%%', PREFIX, $where_cond['from']);
        @($where_cond['where'] = str_replace('%%PREFIX%%', PREFIX, $where_cond['where']));
        $whFromUser = (isset($params['USER_ID']) && intval($params['USER_ID']) > 0 ? ' AND a.document_author_id=' . intval($params['USER_ID']) : '') . (isset($params['USER_WHERE']) && $params['USER_WHERE'] > '' ? ' AND ' . $params['USER_WHERE'] : '') . (isset($params['PARENT']) && intval($params['PARENT']) > 0 ? ' AND a.document_parent=' . intval($params['PARENT']) : '');
        $other_fields = '';
        $other_tables = '';
        $other_fields .= $request_order_fields;
        $other_tables .= $request_order_tables;
        if (isset($params['VIEWS'])) {
            $other_fields .= "(SELECT sum(v1.`count`) FROM " . PREFIX . "_view_count AS v1 WHERE v1.document_id=a.Id AND v1.day_id>" . strtotime($params['VIEWS'] ? $params['VIEWS'] : '-30 years') . ") AS dayviews,\n\t\t\t\t";
            if ($params['VIEWS_ORDER'] > '') {
                $request_order1 = count(explode(',', $other_fields)) - 1 . ' ' . $params['VIEWS_ORDER'] . ',';
            }
        }
        if (isset($params['VOTE'])) {
            $other_fields .= "(SELECT " . $params['VOTE'] . "(v2.`vote`) FROM " . PREFIX . "_module_vote AS v2 WHERE type_of_doc='document' and v2.document_id=a.Id) AS votes,\n\t\t\t\t";
            if ($params['VOTE_ORDER'] > '') {
                $request_order2 = count(explode(',', $other_fields)) - 1 . ' ' . $params['VOTE_ORDER'];
            }
        }
        if (!empty($AVE_Core->install_modules['comment']->ModuleStatus)) {
            $other_tables .= "\n\t\t\t\t\tLEFT JOIN\n\t\t\t\t\t\t" . PREFIX . "_module_comment_info AS b\n\t\t\t\t\t\t\tON b.document_id = a.Id " . (!empty($params['COMMENT']) ? " and b.comment_published>" . strtotime($params['COMMENT']) : '') . "\n\t\t\t\t\t";
            $other_fields .= "COUNT(b.document_id) AS nums,\n\t\t\t\t";
            if (!empty($params['COMMENT_ORDER'])) {
                $request_order1 = count(explode(',', $other_fields)) - 1 . ' ' . $params['COMMENT_ORDER'] . ',';
            }
        }
        $request_order = addslashes($request_order1 . ($request_order2 > '' ? $request_order1 ? $request_order2 . ',' : $request_order2 : '') . $request_order);
        $num = $AVE_DB->Query(eval2var(" ?>\n\t\t\tSELECT COUNT(*)\n\t\t\tFROM\n\t\t\t" . ($where_cond['from'] ? $where_cond['from'] : '') . "\n\t\t\t" . PREFIX . "_documents AS a\n\t\t\tWHERE\n\t\t\t\ta.Id != '1'\n\t\t\tAND a.Id != '" . PAGE_NOT_FOUND_ID . "'\n\t\t\tAND a.rubric_id = '" . $row_ab->rubric_id . "'\n\t\t\tAND a.document_deleted != '1'\n\t\t\t" . $docstatus . "\n\t\t\t" . $whFromUser . "\n\t\t\t" . $where_cond['where'] . "\n\t\t\t" . ($row_ab->request_lang ? "AND a.document_lang='" . $_SESSION['user_language'] . "'" : "") . "\n\t\t\t" . $doctime . "\n\t\t<?php "), $ttl, 'rub_' . $row_ab->rubric_id)->GetCell();
        if ($row_ab->request_show_pagination == 1) {
            $num_pages = $limit > 0 ? ceil($num / $limit) : 0;
            @($GLOBALS['page_id'][$_REQUEST['id']]['apage'] = @$GLOBALS['page_id'][$_REQUEST['id']]['apage'] > $num_pages ? $GLOBALS['page_id'][$_REQUEST['id']]['apage'] : $num_pages);
            if (isset($_REQUEST['apage']) && is_numeric($_REQUEST['apage']) && $_REQUEST['apage'] > $num_pages) {
                $redirect_link = rewrite_link('index.php?id=' . $AVE_Core->curentdoc->Id . '&amp;doc=' . (empty($AVE_Core->curentdoc->document_alias) ? prepare_url($AVE_Core->curentdoc->document_title) : $AVE_Core->curentdoc->document_alias) . (isset($_REQUEST['artpage']) && is_numeric($_REQUEST['artpage']) ? '&amp;artpage=' . $_REQUEST['artpage'] : '') . (isset($_REQUEST['page']) && is_numeric($_REQUEST['page']) ? '&amp;page=' . $_REQUEST['page'] : ''));
                header('Location:' . $redirect_link);
                exit;
            }
            $start = get_current_page('apage') * $limit - $limit;
        } else {
            $start = 0;
        }
        $q = " ?>\n\t\t\tSELECT\n\t\t\t\t" . $other_fields . "\n\t\t\t\ta.Id,\n\t\t\t\ta.document_parent,\n\t\t\t\ta.document_title,\n\t\t\t\ta.document_alias,\n\t\t\t\ta.document_author_id,\n\t\t\t\ta.document_count_view,\n\t\t\t\ta.document_published,\n\t\t\t\ta.document_meta_keywords\n\t\t\tFROM\n\t\t\t\t" . ($where_cond['from'] ? $where_cond['from'] : '') . "\n\t\t\t\t" . PREFIX . "_documents AS a\n\t\t\t" . ($other_tables > '' ? $other_tables : '') . "\n\t\t\tWHERE\n\t\t\t\ta.Id != '1'\n\t\t\tAND a.Id != '" . PAGE_NOT_FOUND_ID . "'\n\t\t\tAND a.rubric_id = '" . $row_ab->rubric_id . "'\n\t\t\tAND a.document_deleted != '1'\n\t\t\t" . ($row_ab->request_lang ? "AND a.document_lang='" . $_SESSION['user_language'] . "'" : "") . "\n\t\t\t" . $whFromUser . "\n\t\t\t" . $docstatus . "\n\t\t\t" . $where_cond['where'] . "\n\t\t\t" . $doctime . "\n\t\t\tGROUP BY a.Id\n\t\t\tORDER BY " . $request_order . "\n\t\t\t" . ($limit > 0 ? "LIMIT " . $start . "," . $limit : '') . " <?php ";
        $q = eval2var($q);
        $q = $AVE_DB->Query($q, $ttl, 'rub_' . $row_ab->rubric_id);
        if ($q->NumRows() > 0) {
            $main_template = preg_replace('/\\[tag:if_empty](.*?)\\[\\/tag:if_empty]/si', '', $main_template);
            $main_template = str_replace(array('[tag:if_notempty]', '[/tag:if_notempty]'), '', $main_template);
        } else {
            $main_template = preg_replace('/\\[tag:if_notempty](.*?)\\[\\/tag:if_notempty]/si', '', $main_template);
            $main_template = str_replace(array('[tag:if_empty]', '[/tag:if_empty]'), '', $main_template);
        }
        $page_nav = '';
        if ($row_ab->request_show_pagination == 1 && $num_pages > 1) {
            $page_nav = ' <a class="pnav" href="index.php?id=' . $AVE_Core->curentdoc->Id . '&amp;doc=' . (empty($AVE_Core->curentdoc->document_alias) ? prepare_url($AVE_Core->curentdoc->document_title) : $AVE_Core->curentdoc->document_alias) . (isset($_REQUEST['artpage']) && is_numeric($_REQUEST['artpage']) ? '&amp;artpage=' . $_REQUEST['artpage'] : '') . '&amp;apage={s}' . (isset($_REQUEST['page']) && is_numeric($_REQUEST['page']) ? '&amp;page=' . $_REQUEST['page'] : '') . '">{t}</a> ';
            $page_nav = get_pagination($num_pages, 'apage', $page_nav, get_settings('navi_box'));
            //$page_nav = rewrite_link($page_nav);
            // Костыль
            $page_nav = str_ireplace('"//"', '"/"', str_ireplace('///', '/', rewrite_link($page_nav)));
        }
        $rows = array();
        $request_documents = array();
        while ($row = $q->FetchRow()) {
            array_push($request_documents, $row->Id);
            array_push($rows, $row);
        }
        $items = '';
        $x = 0;
        $items_count = count($rows);
        foreach ($rows as $row) {
            $x++;
            $item = showrequestelement($row, $item_template, $x, $x == $items_count ? true : false);
            $items .= $item;
        }
        //		$items = preg_replace_callback('/\[tag:teaser:(\d+)\]/', "showteaser", $items);
        $main_template = preg_replace_callback('/\\[tag:sysblock:([0-9-]+)\\]/', 'parse_sysblock', $main_template);
        $main_template = str_replace('[tag:pages]', $page_nav, $main_template);
        $main_template = preg_replace('/\\[tag:date:([a-zA-Z0-9-]+)\\]/e', "RusDate(date('\$1', " . $AVE_Core->curentdoc->document_published . "))", $main_template);
        $main_template = str_replace('[tag:docid]', $AVE_Core->curentdoc->Id, $main_template);
        $main_template = str_replace('[tag:docdate]', pretty_date(strftime(DATE_FORMAT, $AVE_Core->curentdoc->document_published)), $main_template);
        $main_template = str_replace('[tag:doctime]', pretty_date(strftime(TIME_FORMAT, $AVE_Core->curentdoc->document_published)), $main_template);
        $main_template = str_replace('[tag:docauthor]', get_username_by_id($AVE_Core->curentdoc->document_author_id), $main_template);
        $main_template = str_replace('[tag:doctotal]', $num, $main_template);
        $main_template = str_replace('[tag:pagetitle]', $AVE_Core->curentdoc->document_title, $main_template);
        $main_template = preg_replace('/\\[tag:dropdown:([,0-9]+)\\]/e', "request_get_dropdown(\"\$1\", " . $row_ab->rubric_id . ", " . $row_ab->Id . ");", $main_template);
        $return = str_replace('[tag:content]', $items, $main_template);
        // парсим тизер документа
        //$return = preg_replace_callback('/\[tag:teaser:(\d+)\]/e', "showteaser", $return);
        $return = str_replace('[tag:path]', ABS_PATH, $return);
        $return = str_replace('[tag:mediapath]', ABS_PATH . 'templates/' . THEME_FOLDER . '/', $return);
        $return = $AVE_Core->coreModuleTagParse($return);
    }
    $gen_time = microtime() - $gen_time;
    $GLOBALS['block_generate'][] = array('REQUEST_' . $id => $gen_time);
    return $return;
}
Exemplo n.º 16
0
 /**
  * Вывод списка галерей
  *
  * @param string $tpl_dir - путь к папке с шаблонами модуля
  */
 function galleryListShow($tpl_dir)
 {
     global $AVE_DB, $AVE_Template;
     if (!empty($_POST['create'])) {
         foreach ($_POST['create'] as $gallery_id) {
             $this->_galleryImageMove((int) $gallery_id);
         }
     }
     $limit = $this->_limit_galleries;
     $start = get_current_page() * $limit - $limit;
     $galleries = array();
     $sql = $AVE_DB->Query("\r\n\t\t\tSELECT SQL_CALC_FOUND_ROWS\r\n\t\t\t\tgal.*,\r\n\t\t\t\tCOUNT(img.id) AS image_count\r\n\t\t\tFROM\r\n\t\t\t\t" . PREFIX . "_modul_gallery AS gal\r\n\t\t\tLEFT JOIN\r\n\t\t\t\t" . PREFIX . "_modul_gallery_images AS img\r\n\t\t\t\t\tON img.gallery_id = gal.id\r\n\t\t\tGROUP BY gal.id\r\n\t\t\tORDER BY gal.gallery_created DESC\r\n\t\t\tLIMIT " . $start . "," . $limit . "\r\n\t\t");
     $num = $AVE_DB->Query("SELECT FOUND_ROWS()")->GetCell();
     while ($row = $sql->FetchAssocArray()) {
         $row['username'] = get_username_by_id($row['gallery_author_id']);
         array_push($galleries, $row);
     }
     if ($num > $limit) {
         $page_nav = ' <a class="pnav" href="index.php?do=modules&action=modedit&mod=gallery&moduleaction=1&cp=' . SESSION . '&page={s}">{t}</a> ';
         $page_nav = get_pagination(ceil($num / $limit), 'page', $page_nav);
         $AVE_Template->assign('page_nav', $page_nav);
     }
     if (!empty($_REQUEST['alert'])) {
         $AVE_Template->assign('alert', htmlspecialchars(stripslashes($_REQUEST['alert'])));
     }
     $AVE_Template->assign('galleries', $galleries);
     $AVE_Template->assign('formaction', 'index.php?do=modules&action=modedit&mod=gallery&moduleaction=new&sub=save&cp=' . SESSION);
     $AVE_Template->assign('content', $AVE_Template->fetch($tpl_dir . 'admin_gallery_list.tpl'));
 }
Exemplo n.º 17
0
 public function getLogsByID($id, $datefrom = NULL, $dateto = NULL)
 {
     $csvdata = apc_fetch('csvdata');
     $log = array();
     foreach ($csvdata as $data) {
         if ($data[1] == $id) {
             $level = get_level_by_id($data[4]);
             $uname = get_username_by_id($data[4]);
             $data[4] = $uname . "(" . $level . ")";
             $labconfig_obj = get_lab_config_by_id($data[5]);
             $data[5] = $labconfig_obj->name;
             array_push($log, $data);
         }
     }
     return $log;
 }
Exemplo n.º 18
0
			</tr>
			<tr>
				<td><?php 
echo "Country";
$page_elems->getAsterisk();
?>
</td>
				<!--<td><select name='country' id='country'> 
					<?php 
foreach ($labIdArray as $key => $value) {
    echo "<option value='{$key}'>{$key}</option>";
}
?>
				</select></td>-->
                                <td><?php 
$usr_c = get_username_by_id($_SESSION['user_id']);
$usr_c = strtolower($usr_c);
$usr_c = ucfirst($usr_c);
$usr_cs = substr($usr_c, 0, strpos($usr_c, "_"));
echo $usr_cs;
?>
                                <input type="hidden" name="country" value="<?php 
echo $usr_cs;
?>
">
                                </td>
			</tr>
			<?php 
//If user is superadmin
if (true) {
    ?>
Exemplo n.º 19
0
 /**
  * Метод, предназанченный для сборки всей страницы в единое целое.
  *
  * @param int $id идентификатор документа
  * @param int $rub_id идентификатор рубрики
  */
 function coreSiteFetch($id, $rub_id = '')
 {
     global $AVE_DB;
     // Если происходит вызов модуля, получаем соответствующие мета-теги и получаем шаблон модуля
     if (!empty($_REQUEST['module'])) {
         $out = $this->_coreModuleMetatagsFetch();
         $out = $this->_coreDocumentTemplateGet('', '', $this->_coreModuleTemplateGet());
     } else {
         if (!isset($this->curentdoc->Id) && !$this->_coreCurrentDocumentFetch($id, UGROUP)) {
             // Определяем документ с 404 ошиюкой, в случае, если документ не найден
             if ($this->_corePageNotFoundFetch(PAGE_NOT_FOUND_ID, UGROUP)) {
                 $_REQUEST['id'] = $_GET['id'] = $id = PAGE_NOT_FOUND_ID;
             }
         }
         // проверяем параметры публикации документа
         if (!$this->_coreDocumentIsPublished()) {
             $this->_coreErrorPage404();
         }
         // Определяем права доступа к документам рубрики
         define('RUB_ID', !empty($rub_id) ? $rub_id : $this->curentdoc->rubric_id);
         $this->_coreRubricPermissionFetch(RUB_ID);
         if (!(isset($_SESSION[RUB_ID . '_docread']) && $_SESSION[RUB_ID . '_docread'] == 1 || isset($_SESSION[RUB_ID . '_alles']) && $_SESSION[RUB_ID . '_alles'] == 1)) {
             // читать запрещено - извлекаем ругательство и отдаём вместо контента
             $main_content = get_settings('message_forbidden');
         } else {
             if (isset($_REQUEST['print']) && $_REQUEST['print'] == 1) {
                 // увеличиваем счетчик версий для печати
                 $AVE_DB->Query("\n\t\t\t\t\t\tUPDATE " . PREFIX . "_documents\n\t\t\t\t\t\tSET document_count_print = document_count_print+1\n\t\t\t\t\t\tWHERE Id = '" . $id . "'\n\t\t\t\t\t");
             } else {
                 if (!isset($_SESSION['doc_view'][$id])) {
                     // увеличиваем счетчик просмотров (1 раз в пределах сессии)
                     $AVE_DB->Query("\n\t\t\t\t\t\t\tUPDATE " . PREFIX . "_documents\n\t\t\t\t\t\t\tSET document_count_view = document_count_view+1\n\t\t\t\t\t\t\tWHERE Id = '" . $id . "'\n\t\t\t\t\t\t");
                     $_SESSION['doc_view'][$id] = time();
                 }
                 $curdate = mktime(0, 0, 0, date("m"), date("d"), date("Y"));
                 if (!isset($_SESSION['doc_view_dayly[' . $curdate . '][' . $id . ']'])) {
                     // и подневный счетчик просмотров тоже увеличиваем
                     $curdate = mktime(0, 0, 0, date("m"), date("d"), date("Y"));
                     $AVE_DB->Query("\n                            UPDATE\n                                " . PREFIX . "_view_count\n                            SET\n                                count = count + 1\n                            WHERE\n                                document_id = '" . $id . "' AND\n                                day_id = '" . $curdate . "'\n                        ");
                     if (!$AVE_DB->_handle->affected_rows) {
                         $AVE_DB->Query("\n                                INSERT INTO " . PREFIX . "_view_count (\n                                    document_id,\n                                    day_id,\n                                    count\n                                )\n                                VALUES (\n                                    '" . $id . "',  '" . $curdate . "', '1'\n                                )\n                            ");
                     }
                     $_SESSION['doc_view_dayly[' . $curdate . '][' . $id . ']'] = time();
                 }
             }
             if (CACHE_DOC_TPL && empty($_POST) && !(isset($_SESSION['user_adminmode']) && $_SESSION['user_adminmode'] == 1)) {
                 // кэширование разрешено
                 // извлекаем скомпилированный шаблон документа из кэша
                 $main_content = $AVE_DB->Query("\n\t\t\t\t\t\tSELECT compiled\n\t\t\t\t\t\tFROM " . PREFIX . "_rubric_template_cache\n\t\t\t\t\t\tWHERE hash  = '" . $this->_get_cache_hash() . "'\n\t\t\t\t\t\tLIMIT 1\n\t\t\t\t\t")->GetCell();
             } else {
                 // кэширование запрещено
                 $main_content = false;
             }
             if (empty($main_content)) {
                 // кэш пустой или отключен, извлекаем и компилируем шаблон
                 if (!empty($this->curentdoc->rubric_template)) {
                     $rubTmpl = $this->curentdoc->rubric_template;
                 } else {
                     $rubTmpl = $AVE_DB->Query("\n\t\t\t\t\t\t\tSELECT rubric_template\n\t\t\t\t\t\t\tFROM " . PREFIX . "_rubrics\n\t\t\t\t\t\t\tWHERE Id = '" . RUB_ID . "'\n\t\t\t\t\t\t\tLIMIT 1\n\t\t\t\t\t\t")->GetCell();
                 }
                 $rubTmpl = trim($rubTmpl);
                 if (empty($rubTmpl)) {
                     // не задан шаблон рубрики
                     $main_content = $this->_rubric_template_empty;
                 } else {
                     // парсим теги полей в шаблоне документа
                     $main_content = preg_replace_callback('/\\[tag:fld:([a-zA-Z0-9-_]+)\\]/', 'document_get_field', $rubTmpl);
                     $main_content = preg_replace_callback('/\\[tag:([r|c|f|t]\\d+x\\d+r*):(.+?)]/', 'callback_make_thumbnail', $main_content);
                     // удаляем ошибочные теги полей
                     $main_content = preg_replace('/\\[tag:fld:\\d*\\]/', '', $main_content);
                     if (CACHE_DOC_TPL && empty($_POST) && !(isset($_SESSION['user_adminmode']) && $_SESSION['user_adminmode'] == 1)) {
                         // кэширование разрешено
                         // сохраняем скомпилированный шаблон в кэш
                         $AVE_DB->Query("\n\t\t\t\t\t\t\t\tINSERT " . PREFIX . "_rubric_template_cache\n\t\t\t\t\t\t\t\tSET\n\t\t\t\t\t\t\t\t\thash     = '" . $this->_get_cache_hash() . "',\n\t\t\t\t\t\t\t\t\trub_id   = '" . RUB_ID . "',\n\t\t\t\t\t\t\t\t\tgrp_id   = '" . UGROUP . "',\n\t\t\t\t\t\t\t\t\tdoc_id   = '" . $id . "',\n\t\t\t\t\t\t\t\t\tcompiled = '" . addslashes($main_content) . "'\n\t\t\t\t\t\t\t");
                     }
                 }
             }
             $main_content = preg_replace('/\\[tag:date:([a-zA-Z0-9-]+)\\]/e', "RusDate(date('\$1', " . $this->curentdoc->document_published . "))", $main_content);
             $main_content = str_replace('[tag:docdate]', pretty_date(strftime(DATE_FORMAT, $this->curentdoc->document_published)), $main_content);
             $main_content = str_replace('[tag:doctime]', pretty_date(strftime(TIME_FORMAT, $this->curentdoc->document_published)), $main_content);
             $main_content = str_replace('[tag:docauthorid]', $this->curentdoc->document_author_id, $main_content);
             $main_content = str_replace('[tag:docauthor]', get_username_by_id($this->curentdoc->document_author_id), $main_content);
         }
         $out = str_replace('[tag:maincontent]', $main_content, $this->_coreDocumentTemplateGet(RUB_ID));
     }
     // /вывод документа
     //Работа с условиями
     /*
     		$out = preg_replace('/\[tag:if_exp:?(.*)\]/u', '<?php 
     	$my_exp000=true;
     	$my_exp0001=\'$my_exp000=\'. str_replace(\'#var#\',\'$\',<<<BLOCK
     $1;
     BLOCK
     );
     	@eval($my_exp0001);
     	if($my_exp000==true)
     		{
     ?>', $out);
     		$out = str_replace('[tag:if_exp_else]', '<?php }else{ ?>', $out);
     		$out = str_replace('[tag:/if_exp]', '<?php } ?>', $out);
     */
     // Тут мы вводим в хеадер иньекцию скриптов.
     if (defined('RUB_ID')) {
         $rubheader = $AVE_DB->Query("\n\t\t\t\t\t\t\tSELECT rubric_header_template\n\t\t\t\t\t\t\tFROM " . PREFIX . "_rubrics\n\t\t\t\t\t\t\tWHERE Id = '" . RUB_ID . "'\n\t\t\t\t\t\t\tLIMIT 1\n\t\t\t\t\t\t", CACHE_LIFETIME)->GetCell();
         $out = str_replace('[tag:rubheader]', $rubheader . '[tag:rubheader]', $out);
     }
     $out = preg_replace('/\\[tag:rfld:([a-zA-Z0-9-_]+)]\\[(more|esc|img|[0-9-]+)]/e', "request_get_document_field(\"\$1\", {$id}, \"\$2\")", $out);
     // Если в запросе пришел параметр print, т.е. страница для печати, парсим контент, который обрамлен
     // тегами только для печати
     if (isset($_REQUEST['print']) && $_REQUEST['print'] == 1) {
         $out = str_replace(array('[tag:if_print]', '[/tag:if_print]'), '', $out);
         $out = preg_replace('/\\[tag:if_notprint\\](.*?)\\[\\/tag:if_notprint\\]/si', '', $out);
     } else {
         // В противном случае наоборот, парсим только тот контент, который предназначен НЕ для печати
         $out = preg_replace('/\\[tag:if_print\\](.*?)\\[\\/tag:if_print\\]/si', '', $out);
         $out = str_replace(array('[tag:if_notprint]', '[/tag:if_notprint]'), '', $out);
     }
     // получаем из шаблона системный тег, определяющий название темы дизайна
     $match = '';
     preg_match('/\\[tag:theme:(\\w+)]/', $out, $match);
     define('THEME_FOLDER', empty($match[1]) ? DEFAULT_THEME_FOLDER : $match[1]);
     $out = preg_replace('/\\[tag:theme:(.*?)]/', '', $out);
     // парсим теги модулей
     $out = $this->coreModuleTagParse($out);
     if (isset($_REQUEST['module']) && !(isset($this->install_modules[$_REQUEST['module']]) && '1' == $this->install_modules[$_REQUEST['module']]->ModuleStatus)) {
         display_notice($this->_module_error);
     }
     // парсим теги системных блоков
     $out = preg_replace_callback('/\\[tag:sysblock:([0-9-]+)\\]/', 'parse_sysblock', $out);
     // парсим теги системы внутренних запросов
     $out = preg_replace_callback('/\\[tag:request:(\\d+)\\]/', 'request_parse', $out);
     // парсим теги навигации
     $out = preg_replace_callback('/\\[tag:navigation:(\\d+):?([0-9,]*)\\]/', 'parse_navigation', $out);
     // парсим теги скрытого текста
     $out = parse_hide($out);
     // парсим остальные теги основного шаблона
     $search = array('[tag:mediapath]', '[tag:path]', '[tag:sitename]', '[tag:document]', '[tag:alias]', '[tag:home]', '[tag:robots]', '[tag:canonical]', '[tag:docid]', '[tag:breadcrumb]');
     $replace = array(ABS_PATH . 'templates/' . THEME_FOLDER . '/', ABS_PATH, htmlspecialchars(get_settings('site_name'), ENT_QUOTES), get_redirect_link('print'), @$this->curentdoc->document_alias, get_home_link(), isset($this->curentdoc->document_meta_robots) ? $this->curentdoc->document_meta_robots : '', canonical($_SERVER['REQUEST_URI']), isset($this->curentdoc->Id) ? $this->curentdoc->Id : '', get_breadcrumb());
     if (defined('MODULE_CONTENT')) {
         // парсинг тегов при выводе из модуля
         $search[] = '[tag:maincontent]';
         $replace[] = MODULE_CONTENT;
         $search[] = '[tag:title]';
         $replace[] = htmlspecialchars(defined('MODULE_SITE') ? MODULE_SITE : '', ENT_QUOTES);
         $search[] = '[tag:description]';
         $replace[] = htmlspecialchars(defined('MODULE_DESCRIPTION') ? MODULE_DESCRIPTION : '', ENT_QUOTES);
         $search[] = '[tag:keywords]';
         $replace[] = htmlspecialchars(defined('MODULE_KEYWORDS') ? MODULE_KEYWORDS : '', ENT_QUOTES);
     } else {
         $search[] = '[tag:keywords]';
         $replace[] = isset($this->curentdoc->document_meta_keywords) ? htmlspecialchars($this->curentdoc->document_meta_keywords, ENT_QUOTES) : '';
         $search[] = '[tag:description]';
         $replace[] = isset($this->curentdoc->document_meta_description) ? htmlspecialchars($this->curentdoc->document_meta_description, ENT_QUOTES) : '';
         $search[] = '[tag:title]';
         $replace[] = htmlspecialchars(pretty_chars($this->curentdoc->document_title), ENT_QUOTES);
     }
     $search[] = '[tag:maincontent]';
     $replace[] = '';
     $search[] = '[tag:printlink]';
     $replace[] = get_print_link();
     $search[] = '[tag:version]';
     $replace[] = APP_INFO;
     $search[] = '[tag:docviews]';
     $replace[] = isset($this->curentdoc->document_count_view) ? $this->curentdoc->document_count_view : '';
     // парсим тизер документа
     $out = preg_replace('/\\[tag:teaser:(\\d+)\\]/e', "showteaser(\$1)", $out);
     if (defined('RUB_ID')) {
         $out = preg_replace('/\\[tag:docauthoravatar:(\\d+)\\]/e', "getAvatar(" . intval($this->curentdoc->document_author_id) . ",\"\$1\")", $out);
     }
     if (defined('RUB_ID')) {
         $out = preg_replace('/\\[tag:lang:([a-zA-Z0-9-_]+)\\]/', '<?php if($AVE_Core->curentdoc->document_lang=="$1") { ?>', $out);
     } else {
         $out = preg_replace('/\\[tag:lang:([a-zA-Z0-9-_]+)\\]/', '<?php if($_SESSION["user_language"]=="$1") { ?>', $out);
     }
     $out = str_replace('[tag:/lang]', '<?php } ?>', $out);
     // парсим остальные теги основного шаблона
     $out = str_replace($search, $replace, $out);
     unset($search, $replace);
     // парсим теги для combine.php
     $out = preg_replace_callback('/\\[tag:(css|js):([^ :\\/]+):?(\\S+)*\\]/', array($this, '_parse_combine'), $out);
     // ЧПУ
     $out = rewrite_link($out);
     echo $out;
 }
Exemplo n.º 20
0
echo LangUtil::$generalTerms['TESTS'];
?>
</b>:
<br>
<?php 
$test_list = get_tests_by_specimen_id($specimen_id);
foreach ($test_list as $test) {
    echo get_test_name_by_id($test->testTypeId) . " :- <br>";
    if ($test->isPending()) {
        echo "&nbsp;&nbsp;&nbsp;&nbsp;" . LangUtil::$generalTerms['PENDING_RESULTS'];
    } else {
        echo "&nbsp;&nbsp;&nbsp;&nbsp;" . LangUtil::$generalTerms['ENTERED_BY'] . ": " . get_username_by_id($test->userId) . " on: " . $test->timestamp;
    }
    echo "<br>";
    if ($test->isVerified()) {
        echo "&nbsp;&nbsp;&nbsp;&nbsp;" . LangUtil::$generalTerms['VERIFIED_BY'] . ": " . get_username_by_id($test->verifiedBy) . " on: " . $test->getDateVerified();
    } else {
        echo "&nbsp;&nbsp;&nbsp;&nbsp;" . LangUtil::$generalTerms['PENDING_VER'];
    }
    echo "<br>";
    if ($specimen->isReported()) {
        echo "&nbsp;&nbsp;&nbsp;&nbsp;" . LangUtil::$generalTerms['REPORTED'] . ": " . $specimen->getDateReported();
        echo "<br>";
        echo "&nbsp;&nbsp;&nbsp;&nbsp;" . LangUtil::$generalTerms['REPORT_TO'] . ": " . $specimen->getReportTo();
    } else {
        echo "&nbsp;&nbsp;&nbsp;&nbsp;" . LangUtil::$generalTerms['REPORTED_NOT'];
    }
    echo "<br>";
}
?>
</div>
Exemplo n.º 21
0
 function roadmapTaskShow($tpl_dir, $project_id, $status)
 {
     global $AVE_DB, $AVE_Template;
     $project_id = (int) $project_id;
     $status = (int) $status;
     $items = array();
     $sql = $AVE_DB->Query("\r\n\t\t\tSELECT *\r\n\t\t\tFROM " . PREFIX . "_modul_roadmap_tasks\r\n\t\t\tWHERE pid = '" . $project_id . "'\r\n\t\t\tAND task_status = '" . $status . "'\r\n\t\t\tORDER BY priority\r\n\t\t");
     while ($row = $sql->FetchRow()) {
         $row->username = get_username_by_id($row->uid);
         switch ($row->priority) {
             case '1':
                 $row->priority = $AVE_Template->get_config_vars('ROADMAP_TASK_HIGHEST');
                 $row->prio = 1;
                 break;
             case '2':
                 $row->priority = $AVE_Template->get_config_vars('ROADMAP_TASK_HIGH');
                 $row->prio = 2;
                 break;
             case '3':
                 $row->priority = $AVE_Template->get_config_vars('ROADMAP_TASK_NORMAL');
                 $row->prio = 3;
                 break;
             case '4':
                 $row->priority = $AVE_Template->get_config_vars('ROADMAP_TASK_LOW');
                 $row->prio = 4;
                 break;
             case '5':
                 $row->priority = $AVE_Template->get_config_vars('ROADMAP_TASK_LOWEST');
                 $row->prio = 5;
                 break;
         }
         array_push($items, $row);
     }
     $row_r = $AVE_DB->Query("\r\n\t\t\tSELECT *\r\n\t\t\tFROM " . PREFIX . "_modul_roadmap\r\n\t\t\tWHERE id = '" . $project_id . "'\r\n\t\t")->FetchRow();
     $AVE_Template->assign('row', $row_r);
     $AVE_Template->assign('items', $items);
     define('MODULE_CONTENT', $AVE_Template->fetch($tpl_dir . 'tasks.tpl'));
 }
Exemplo n.º 22
0
	public function getTestInfoRow($test)
	{
		# Returns HTML table row containing specimen info
		# Called by getSpecimenTestsTable() function
		?>
		<tr valign='top'>
			<td>
				<?php echo get_test_name_by_id($test->testTypeId); ?>
			</td>
			<td>
				<?php
				if($test->isPending())
					echo LangUtil::$generalTerms['PENDING_RESULTS'];
				else
					echo $test->decodeResult(); 
				?>
			</td>
			<td>
				<?php echo $test->getComments(); ?>
			</td>
			<td>
				<?php echo get_username_by_id($test->userId); ?>
			</td>
			<td>
				<?php echo $test->getVerifiedBy(); ?>
			</td>
			<?php
			$specimen_object=Specimen::getById($test->specimenId);
			$pid=$specimen_object->patientId;
			$sid=$test->specimenId;
				
			?>
			<!--<td><a href="javascript:get_report(<?php echo $pid;?>,<?php echo $sid;?> )">Report</a> </td>-->
			
		</tr>
		<?php
	}
Exemplo n.º 23
0

-->

</style>

<body bgcolor="#000000" text="#DDDDDD"  background="/gfx/bg_stars1.gif">

  <table class="style_outer" width="550" align="center" border="0" cellpadding="2" cellspacing="2">
    <tr>
      <td>
        <table class="style_inner" width="550" align="center" border="0" cellpadding="2" cellspacing="2">
    
';
if (isset($_GET['user'])) {
    $user_id = (int) $_GET['user'];
    echo '<td>&nbsp;</td><td><font size="3"><b>' . constant($game->sprache("TEXT1")) . '</b></font></td><td><font size="3"><b>' . get_username_by_id($user_id) . '</b></font></td></tr><tr><td>&nbsp;</td></tr><tr><td></td><td width="235"><b>' . constant($game->sprache("TEXT2")) . '</b></td><td width="200"><b>' . constant($game->sprache("TEXT3")) . '</b></td><td width="70"><b>' . constant($game->sprache("TEXT4")) . '</b></td></tr>';
    $config = $db->queryrow('SELECT * FROM config');
    $sql = 'SELECT * FROM ship_trade WHERE user = '******' AND end_time > ' . $config['tick_id'] . '';
    if (!($q_tradedata = $db->query($sql))) {
        message(DATABASE_ERROR, 'Could not query tradedata');
    }
    while ($tradedata = $db->fetchrow($q_tradedata)) {
        echo '<tr><td width="55" align="center">[<a onclick="opener.window.location=this.href;self.close();return false" href="/game/index.php?a=trade&view=view_bidding_detail&id=' . $tradedata['id'] . '">' . constant($game->sprache("TEXT5")) . '</a>]</td><td>' . $tradedata['header'] . '</td><td><img src="' . PROXY_GFX_PATH . '/skin1/menu_metal_small.gif">&nbsp;' . $tradedata['resource_1'] . '&nbsp;<img src="' . PROXY_GFX_PATH . '/skin1/menu_mineral_small.gif">&nbsp;' . $tradedata['resource_2'] . '&nbsp;<img src="' . PROXY_GFX_PATH . '/skin1/menu_latinum_small.gif">&nbsp;' . $tradedata['resource_3'] . '&nbsp;<br><img src="' . PROXY_GFX_PATH . '/skin1/menu_unit1_small.gif">&nbsp;' . $tradedata['unit_1'] . '&nbsp;<img src="' . PROXY_GFX_PATH . '/skin1/menu_unit2_small.gif">&nbsp;' . $tradedata['unit_2'] . '&nbsp;<img src="' . PROXY_GFX_PATH . '/skin1/menu_unit3_small.gif">&nbsp;' . $tradedata['unit_3'] . '&nbsp;<img src="' . PROXY_GFX_PATH . '/skin1/menu_unit4_small.gif">&nbsp;' . $tradedata['unit_4'] . '&nbsp;<img src="' . PROXY_GFX_PATH . '/skin1/menu_unit5_small.gif">&nbsp;' . $tradedata['unit_5'] . '&nbsp;<img src="' . PROXY_GFX_PATH . '/skin1/menu_unit6_small.gif">&nbsp;' . $tradedata['unit_6'] . '</td><td>' . Zeit(TICK_DURATION * ($tradedata['end_time'] - $config['tick_id'])) . '</td></tr>';
    }
} else {
    echo constant($game->sprache("TEXT6"));
}
echo '</table></td></tr></table></body>
</html>';
$db->close();
Exemplo n.º 24
0
 public function getVerifiedBy()
 {
     # Returns username of the technician who verified results
     # Or, "Not verified" if results are pending verification
     if ($this->isVerified()) {
         return get_username_by_id($this->verifiedBy);
     }
     return LangUtil::$generalTerms['PENDING_VER'];
 }
Exemplo n.º 25
0
         $num_tpl = $AVE_DB->Query("\r\n\t\t\t\tSELECT COUNT(*)\r\n\t\t\t\tFROM " . PREFIX . "_templates\r\n\t\t\t")->GetCell();
         $page_limit = isset($_REQUEST['set']) && is_numeric($_REQUEST['set']) ? (int) $_REQUEST['set'] : 30;
         $seiten = ceil($num_tpl / $page_limit);
         $set_start = get_current_page() * $page_limit - $page_limit;
         if ($num_tpl > $page_limit) {
             $page_nav = " <a class=\"pnav\" href=\"index.php?do=templates&page={s}&amp;cp=" . SESSION . "\">{t}</a> ";
             $page_nav = get_pagination($seiten, 'page', $page_nav);
             $AVE_Template->assign('page_nav', $page_nav);
         }
         $sql = $AVE_DB->Query("\r\n\t\t\t\tSELECT *\r\n\t\t\t\tFROM " . PREFIX . "_templates\r\n\t\t\t\tLIMIT " . $set_start . "," . $page_limit . "\r\n\t\t\t");
         while ($row = $sql->FetchRow()) {
             $inuse = $AVE_DB->Query("\r\n\t\t\t\t\tSELECT 1\r\n\t\t\t\t\tFROM\r\n\t\t\t\t\t\t" . PREFIX . "_rubrics AS rubric,\r\n\t\t\t\t\t\t" . PREFIX . "_module AS module\r\n\t\t\t\t\tWHERE\r\n\t\t\t\t\t\trubric.rubric_template_id = '" . $row->Id . "' OR\r\n\t\t\t\t\t\tmodule.ModuleTemplate = '" . $row->Id . "'\r\n\t\t\t\t\tLIMIT 1\r\n\t\t\t\t")->NumRows();
             if (!$inuse) {
                 $row->can_deleted = 1;
             }
             $row->template_author = get_username_by_id($row->template_author_id);
             array_push($items, $row);
             unset($row);
         }
         $AVE_Template->assign('items', $items);
         $AVE_Template->assign('content', $AVE_Template->fetch('templates/templates.tpl'));
     }
     break;
 case 'new':
     if (check_permission_acp('template_new')) {
         $_REQUEST['sub'] = isset($_REQUEST['sub']) ? $_REQUEST['sub'] : '';
         switch ($_REQUEST['sub']) {
             case 'savenew':
                 $save = true;
                 $row->template_text = pretty_chars($_REQUEST['template_text']);
                 $row->template_text = stripslashes($row->template_text);
Exemplo n.º 26
0
 /**
  * Метод управления комментариями к опросам
  *
  * @param string $tpl_dir	путь к папке с шаблонами модуля
  * @param string $lang_file	путь к языковому файлу модуля
  * @param int $pid			идентификатор опроса
  */
 function pollCommentEdit($tpl_dir, $lang_file, $pid)
 {
     global $AVE_DB, $AVE_Template;
     $AVE_Template->config_load($lang_file, 'showcomments');
     switch ($_REQUEST['sub']) {
         case '':
             $items = array();
             $sql = $AVE_DB->Query("\r\n\t\t\t\t\tSELECT *\r\n\t\t\t\t\tFROM " . PREFIX . "_modul_poll_comments\r\n\t\t\t\t\tWHERE poll_id = '" . $pid . "'\r\n\t\t\t\t");
             while ($row = $sql->FetchRow()) {
                 $row->poll_comment_author = get_username_by_id($row->poll_comment_author_id);
                 array_push($items, $row);
             }
             $AVE_Template->assign('items', $items);
             $AVE_Template->assign('tpl_dir', $tpl_dir);
             $AVE_Template->assign('content', $AVE_Template->fetch($tpl_dir . 'admin_comments.tpl'));
             break;
         case 'save':
             if (!empty($_POST['del'])) {
                 foreach ($_POST['del'] as $id => $val) {
                     $AVE_DB->Query("\r\n\t\t\t\t\t\t\tDELETE\r\n\t\t\t\t\t\t\tFROM " . PREFIX . "_modul_poll_comments\r\n\t\t\t\t\t\t\tWHERE id = '" . $id . "'\r\n\t\t\t\t\t\t");
                 }
             }
             foreach ($_POST['comment_text'] as $id => $comment) {
                 if (!empty($comment)) {
                     $AVE_DB->Query("\r\n\t\t\t\t\t\t\tUPDATE " . PREFIX . "_modul_poll_comments\r\n\t\t\t\t\t\t\tSET\r\n\t\t\t\t\t\t\t\tpoll_comment_title = '" . $_POST['comment_title'][$id] . "',\r\n\t\t\t\t\t\t\t\tpoll_comment_text  = '" . $comment . "'\r\n\t\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\t\tid = '" . $id . "'\r\n\t\t\t\t\t\t");
                 }
             }
             header('Location:index.php?do=modules&action=modedit&mod=poll&moduleaction=comments&id=' . $pid . '&pop=1&cp=' . SESSION);
             exit;
     }
 }
Exemplo n.º 27
0
                    }
                    ?>
					</select>
					</td>
					<?php 
                }
            }
            $measure_count++;
        }
        ?>
			<td><input name='comments[]' type='text' value='<?php 
        echo $test_entry->comments;
        ?>
'></input></td>
			<td><?php 
        echo get_username_by_id($test_entry->userId);
        ?>
</td>
			<td>
				<center>
					<input type='checkbox' class='verify_flag' name='verify_flag_<?php 
        echo $i;
        ?>
' onchange='javascript:toggle_verify(<?php 
        echo $i;
        ?>
);' checked></input>
				</center>
			</td>
		</tr>
		<?php 
Exemplo n.º 28
0
echo LangUtil::$generalTerms['G_DATE'];
?>
: <?php 
echo date($_SESSION['dformat']);
?>
</h3>
<h3><?php 
echo $report_config->titleText;
?>
</h3>
<br>
<?php 
echo LangUtil::$generalTerms['TECHNICIAN'];
?>
: <?php 
echo get_username_by_id($_SESSION['user_id']);
if ($cat_code != 0) {
    echo " | " . LangUtil::$generalTerms['LAB_SECTION'] . ": " . get_test_category_name_by_id($cat_code);
}
?>
<br><br>
<?php 
# Build list of test types to handle
$test_type_list = array();
if ($test_type_id != 0) {
    # Only one test type selected
    $test_type_list[] = TestType::getById($test_type_id);
} else {
    # Fetch all test types belonging to this lab section
    $test_type_list = get_test_types_by_site_category($_SESSION['lab_config_id'], $cat_code);
}
Exemplo n.º 29
0
function check_special_fields($field_name, $source_object, $use_past_array = false, $context = null)
{
    global $locale;
    // FIXME: Special cases for known non-db but allowed fields
    if ($field_name == 'full_name') {
        if ($use_past_array == false) {
            //use the future value
            return $locale->formatName($source_object);
        } else {
            //use the past value
            return $locale->formatName($source_object, $source_object->fetched_row);
        }
    } elseif ($field_name == 'modified_by_name' && $use_past_array) {
        return $source_object->old_modified_by_name;
    } elseif ($field_name == 'assigned_user_name') {
        //load the user for either the current value or past value.
        // We have to load the user here since fetched_row only has the ID, not the name
        if ($use_past_array) {
            //return previous assigned user from fetched row
            return get_username_by_id($source_object->fetched_row['assigned_user_id']);
        }
        //return current assigned user in source object
        return get_username_by_id($source_object->assigned_user_id);
    } elseif ($field_name == 'team_name') {
        require_once 'modules/Teams/TeamSetManager.php';
        if ($use_past_array == false) {
            if (empty($source_object->team_set_id)) {
                if (!empty($source_object->teams)) {
                    $source_object->teams->save();
                }
            }
            $team_set_id = $source_object->team_set_id;
            $team_id = $source_object->team_id;
        } else {
            $team_set_id = $source_object->fetched_row['team_set_id'];
            $team_id = $source_object->fetched_row['team_id'];
        }
        return TeamSetManager::getCommaDelimitedTeams($team_set_id, $team_id, true);
    } else {
        /*One off exception for if we are getting future date_created value.
        		Use the fetched row for it. - jgreen
        		*/
        if ($use_past_array == false && $field_name != "date_entered") {
            //use the future value
            return get_display_text($source_object, $field_name, $source_object->{$field_name}, null, null, $context);
        } else {
            //use the past value
            return get_display_text($source_object, $field_name, $source_object->fetched_row[$field_name], null, null, $context);
        }
    }
    //In future, check for maybe currency type
    //end function check_special_fields
}