Example #1
0
$from = -1;
$to = -1;
$pages = -1;
$cur_page = -1;
$need_pagination = true;
$head_addition = '';
//----D I S P L A Y----
//----A R T I C L E S----
if (!isset($_GET['content_type']) || $_GET['content_type'] == $content_types_short['articles']) {
    $size = Article::FetchCountOf();
    if ($size) {
        $head_addition = MakeScript('window_bottom_callbacks.push(Article.WindowBottomCallback);');
        $need_pagination = false;
        require $link_to_pagination_init_template;
        $limit = $to - $from + 1;
        $articles = Article::FetchBy(['limit' => $limit, 'offset' => $from, 'order_by' => 'id DESC']);
        $content .= '<div onscroll="scrolled(this);" id="articles_list">';
        for ($i = 0; $i < $limit; ++$i) {
            $atricle = $articles[$i];
            $content .= '<div class="pbl_article">' . $atricle->ToHTMLAutoShortForTable(GetUserPrivileges()) . '</div>';
            if ($i != $to) {
                $content .= '<hr><div style="background-color: #eeeeee;"><br></div><hr>';
            }
        }
        $content .= '</div>';
    } else {
        $content .= ToPageHeader(Language::Word('no news'), "h3", "black");
    }
    $header .= Language::PublicMenu('articles');
} else {
    if (isset($_GET['content_type'])) {
Example #2
0
                $content .= 'allowedContent: true, });';
                $content .= 'CKEDITOR.config.height = 400;';
                $content .= '</script>';
                $content .= '<div class="row">';
                $content .= '<input type="submit" class="btn btn-primary btn-lg" name="add" value="' . Language::Word('save') . '">';
                $content .= '</div>';
                $content .= '</form>';
                $title = Language::Word('language adding');
                $header = $title;
            }
        } else {
            if (!isset($_REQUEST['id'])) {
                echo 'user id is unset';
                exit;
            }
            $ob_id = $_REQUEST['id'];
            $ob = Article::FetchBy(['eq_conds' => array('id' => $ob_id), 'is_unique' => true]);
            if (Error::IsError($ob)) {
                $content = AlertMessage('alert-danger', Error::ToString($ob));
            } else {
                $title = '';
                $header = '';
                $content = '';
                $title = Language::Word('article');
                $header = htmlspecialchars($ob->GetName());
                $content = $ob->ToHTMLAutoFull(GetUserPrivileges());
            }
        }
    }
}
include_once $link_to_admin_template;
Example #3
0
    }
    $_SESSION['lang'] = $lang;
    header('Location: ' . Link::Get($link_to_admin));
}
//------------------------------------------------D E L E T I N G------------------------------------------------
if (isset($_REQUEST['del'])) {
    //if action is deleting
    if (isset($_REQUEST['type'])) {
        if (isset($_REQUEST['id'])) {
            $header = '';
            if (!isset($_REQUEST['info'])) {
                if ($_REQUEST['type'] === RequestOnRegister::$type) {
                    $_REQUEST['info'] = 'Вы уверены, что хотите отклонить запрос пользователя ' . RequestOnRegister::FetchByID($_REQUEST['id'])->name . '?';
                } else {
                    if ($_REQUEST['type'] === Article::$type) {
                        $ob = Article::FetchBy(['eq_conds' => array('id' => $_REQUEST['id']), 'is_unique' => true]);
                        $_REQUEST['info'] = 'Вы уверены, что хотите удалить новость с заголовком ' . $ob->GetName() . '?';
                    }
                }
            }
            if (!isset($_REQUEST['info'])) {
                $header = 'Вы уверены, что хотите удалить <b>' . $_REQUEST['type'] . '</b> с <b>id</b> = ' . $_REQUEST['id'] . '?';
            } else {
                $header = htmlspecialchars($_REQUEST['info']);
            }
            //form for agree or cancel
            $title = 'Подтверждение удаления';
            $content = DialogFormYesNo($link_to_utility_sql_worker, 'del', $_REQUEST['type'], $_REQUEST['id']);
            require_once $link_to_registering_template;
            exit;
        } else {
                 $content = json_encode(['error' => Error::ToString($link)]);
                 break;
             }
             global $link_prefix;
             $content = json_encode(['link' => 'http://' . $_SERVER["HTTP_HOST"] . $link_prefix . 'download/' . $link->GetPublicLink()]);
             break;
         default:
             break;
     }
     break;
 case 'more':
     switch ($_REQUEST['type']) {
         case Article::$type:
             $need_authorization = false;
             $offset = $_REQUEST['offset'];
             $res = Article::FetchBy(['order_by' => 'id DESC', 'limit' => $records_on_page, 'offset' => $offset, 'select_list' => 'id, name, annotation, creating_date, author_id', 'is_assoc' => true, 'special' => array('author_link', 'full_vers_link', 'path_to_image')]);
             if (Error::IsError($res)) {
                 $ret = array('error_msg' => Error::ToString($res));
                 $content = json_encode($ret);
                 break;
             }
             $content = json_encode($res);
             break;
         default:
             break;
     }
     break;
 case 'info':
     switch ($_REQUEST['type']) {
         case MyFile::$type:
             $optional_data = json_decode($_REQUEST['optional_data']);