示例#1
0
        if ($i < $nbr_values && !empty($key)) {
            $Template->assign_block_vars('link.separation', array());
        }
        $Template->assign_block_vars('links_list', array('DM_A_CLASS' => ' style="background-image:url(' . $value[1] . ');"', 'U_ACTION' => $value[0], 'L_ACTION' => $key, 'ONCLICK' => array_key_exists(2, $value) ? $value[2] : ''));
        $i++;
    }
    if (!empty($redirect_title)) {
        $Template->assign_block_vars('redirect', array('REDIRECTED_FROM' => sprintf($LANG['pages_redirected_from'], $redirect_title), 'DELETE_REDIRECTION' => $special_auth && $User->check_auth($array_auth, EDIT_PAGE) || !$special_auth && $User->check_auth($_PAGES_CONFIG['auth'], EDIT_PAGE) ? '<a href="action.php?del=' . $redirect_id . '&amp;token=' . $Session->get_token() . '" onclick="return confirm(\'' . $LANG['pages_confirm_delete_redirection'] . '\');" title="' . $LANG['pages_delete_redirection'] . '"><img src="' . $Template->get_module_data_path('pages') . '/images/delete.png" alt="' . $LANG['pages_delete_redirection'] . '" /></a>' : ''));
    }
    if ($page_infos['activ_com'] == 1 && ($special_auth && $User->check_auth($array_auth, READ_COM) || !$special_auth && $User->check_auth($_PAGES_CONFIG['auth'], READ_COM))) {
        $Template->assign_vars(array('C_ACTIV_COM' => true, 'U_COM' => url('pages.php?id=' . $page_infos['id'] . '&amp;com=0'), 'L_COM' => $page_infos['nbr_com'] > 0 ? sprintf($LANG['pages_display_coms'], $page_infos['nbr_com']) : $LANG['pages_post_com']));
    }
    if ($page_infos['count_hits'] == 1) {
        $Sql->query_inject("UPDATE " . PREFIX . "pages SET hits = hits + 1 WHERE id = '" . $page_infos['id'] . "'", __LINE__, __FILE__);
    }
    $Template->assign_vars(array('TITLE' => $page_infos['title'], 'CONTENTS' => pages_second_parse($page_infos['contents']), 'COUNT_HITS' => $page_infos['count_hits'] ? sprintf($LANG['page_hits'], $page_infos['hits'] + 1) : '&nbsp;', 'PAGES_PATH' => $pages_data_path, 'L_LINKS' => $LANG['pages_links_list']));
    $Template->pparse('page');
} elseif ((!empty($encoded_title) || $id_com > 0) && $num_rows == 0) {
    redirect(HOST . DIR . url('/pages/pages.php?error=e_page_not_found'));
} elseif ($id_com > 0) {
    if ($page_infos['activ_com'] == 0) {
        redirect(HOST . DIR . '/pages/pages.php?error=e_unactiv_com');
    }
    $special_auth = !empty($page_infos['auth']);
    $array_auth = unserialize($page_infos['auth']);
    if ($special_auth && !$User->check_auth($array_auth, READ_PAGE) || !$special_auth && !$User->check_auth($_PAGES_CONFIG['auth'], READ_PAGE) && ($special_auth && !$User->check_auth($array_auth, READ_COM)) || !$special_auth && !$User->check_auth($_PAGES_CONFIG['auth'], READ_COM)) {
        redirect(HOST . DIR . '/pages/pages.php?error=e_auth_com');
    }
    $Template->set_filenames(array('com' => 'pages/com.tpl'));
    $Template->assign_vars(array('COMMENTS' => display_comments('pages', $id_com, url('pages.php?id=' . $id_com . '&amp;com=%s'))));
    $Template->pparse('com');
示例#2
0
        $Errorh->handler($LANG['pages_notice_previewing'], E_USER_NOTICE);
        $Template->assign_block_vars('previewing', array('PREVIEWING' => pages_second_parse(stripslashes(pages_parse($contents))), 'TITLE' => stripslashes($title)));
    }
    $cats = array();
    $id_cat_display = $page_infos['is_cat'] == 1 ? $_PAGES_CATS[$page_infos['id_cat']]['id_parent'] : $page_infos['id_cat'];
    $cat_list = display_cat_explorer($id_cat_display, $cats, 1);
    $Template->assign_vars(array('CONTENTS' => !empty($error) ? htmlspecialchars(stripslashes($contents), ENT_COMPAT, 'ISO-8859-1') : pages_unparse($page_infos['contents']), 'COUNT_HITS_CHECKED' => !empty($error) ? $count_hits == 1 ? 'checked="checked"' : '' : ($page_infos['count_hits'] == 1 ? 'checked="checked"' : ''), 'ACTIV_COM_CHECKED' => !empty($error) ? $enable_com == 1 ? 'checked="checked"' : '' : ($page_infos['activ_com'] == 1 ? 'checked="checked"' : ''), 'OWN_AUTH_CHECKED' => !empty($page_infos['auth']) ? 'checked="checked"' : '', 'CAT_0' => $id_cat_display == 0 ? 'pages_selected_cat' : '', 'ID_CAT' => $id_cat_display, 'SELECTED_CAT' => $id_cat_display, 'CHECK_IS_CAT' => 'disabled="disabled"' . ($page_infos['is_cat'] == 1 ? ' checked="checked"' : '')));
} else {
    if (!$User->check_auth($_PAGES_CONFIG['auth'], EDIT_PAGE)) {
        redirect(HOST . DIR . '/pages/pages.php?error=e_auth');
    }
    if ($error == 'page_already_exists') {
        $Errorh->handler($LANG['pages_already_exists'], E_USER_WARNING);
    } elseif ($error == 'preview') {
        $Errorh->handler($LANG['pages_notice_previewing'], E_USER_NOTICE);
        $Template->assign_block_vars('previewing', array('PREVIEWING' => pages_second_parse(stripslashes(pages_parse($contents))), 'TITLE' => stripslashes($title)));
    }
    if (!empty($error)) {
        $Template->assign_vars(array('CONTENTS' => htmlspecialchars(stripslashes($contents), ENT_COMPAT, 'ISO-8859-1'), 'PAGE_TITLE' => stripslashes($title)));
    }
    $Template->assign_block_vars('create', array());
    $cats = array();
    $cat_list = display_cat_explorer(0, $cats, 1);
    $current_cat = $LANG['pages_root'];
    $Template->assign_vars(array('COUNT_HITS_CHECKED' => !empty($error) ? $count_hits == 1 ? 'checked="checked"' : '' : ($_PAGES_CONFIG['count_hits'] == 1 ? 'checked="checked"' : ''), 'ACTIV_COM_CHECKED' => !empty($error) ? $enable_com == 1 ? 'checked="checked"' : '' : ($_PAGES_CONFIG['activ_com'] == 1 ? 'checked="checked"' : ''), 'OWN_AUTH_CHECKED' => '', 'CAT_0' => 'pages_selected_cat', 'ID_CAT' => '0', 'SELECTED_CAT' => '0'));
}
if (!empty($page_infos['auth'])) {
    $array_auth = unserialize($page_infos['auth']);
} else {
    $array_auth = !empty($_PAGES_CONFIG['auth']) ? $_PAGES_CONFIG['auth'] : array();
}
示例#3
0
    $auth = $special_auth && AppContext::get_current_user()->check_auth($array_auth, EDIT_PAGE) || !$special_auth && AppContext::get_current_user()->check_auth($config_authorizations, EDIT_PAGE);
    $tpl->put_all(array('C_TOOLS_AUTH' => $auth, 'C_PRINT' => $page_infos['display_print_link'], 'L_EDIT' => $LANG['pages_edit'], 'L_RENAME' => $LANG['pages_rename'], 'L_DELETE' => $LANG['pages_delete'], 'L_PRINT' => $LANG['printable_version'], 'U_EDIT' => url('post.php?id=' . $page_infos['id']), 'U_RENAME' => url('action.php?rename=' . $page_infos['id']), 'U_DELETE' => $page_infos['is_cat'] == 1 ? url('action.php?del_cat=' . $page_infos['id']) : url('post.php?del=' . $page_infos['id'] . '&amp;token=' . AppContext::get_session()->get_token()), 'U_PRINT' => url('print.php?title=' . $encoded_title)));
    //Redirections
    if (!empty($redirect_title)) {
        $tpl->assign_block_vars('redirect', array('REDIRECTED_FROM' => sprintf($LANG['pages_redirected_from'], $redirect_title), 'DELETE_REDIRECTION' => $special_auth && AppContext::get_current_user()->check_auth($array_auth, EDIT_PAGE) || !$special_auth && AppContext::get_current_user()->check_auth($config_authorizations, EDIT_PAGE) ? '<a href="action.php?del=' . $redirect_id . '&amp;token=' . AppContext::get_session()->get_token() . '" title="' . $LANG['pages_delete_redirection'] . '" class="fa fa-delete" data-confirmation="' . $LANG['pages_confirm_delete_redirection'] . '"></a>' : ''));
    }
    //Affichage des commentaires si il y en a la possibilité
    if ($page_infos['activ_com'] == 1 && ($special_auth && AppContext::get_current_user()->check_auth($array_auth, READ_COM) || !$special_auth && AppContext::get_current_user()->check_auth($config_authorizations, READ_COM))) {
        $number_comments = CommentsService::get_number_comments('pages', $page_infos['id']);
        $tpl->put_all(array('C_ACTIV_COM' => true, 'U_COM' => PagesUrlBuilder::get_link_item_com($page_infos['id']), 'L_COM' => $number_comments > 0 ? sprintf($LANG['pages_display_coms'], $number_comments) : $LANG['pages_post_com']));
    }
    //On compte le nombre de vus
    if ($page_infos['count_hits'] == 1) {
        PersistenceContext::get_querier()->inject("UPDATE " . PREFIX . "pages SET hits = hits + 1 WHERE id = " . $page_infos['id']);
    }
    $tpl->put_all(array('ID' => $page_infos['id'], 'TITLE' => stripslashes(stripslashes($page_infos['title'])), 'CONTENTS' => pages_second_parse($page_infos['contents']), 'COUNT_HITS' => $page_infos['count_hits'] ? sprintf($LANG['page_hits'], $page_infos['hits'] + 1) : '&nbsp;', 'L_LINKS' => $LANG['pages_links_list'], 'L_PAGE_OUTILS' => $LANG['pages_links_list']));
    $tpl->display();
} elseif ((!empty($encoded_title) || $id_com > 0) && $num_rows == 0) {
    $error_controller = PHPBoostErrors::unexisting_page();
    DispatchManager::redirect($error_controller);
} elseif ($id_com > 0) {
    //Commentaires activés pour cette page ?
    if ($page_infos['activ_com'] == 0) {
        DispatchManager::redirect(PHPBoostErrors::unexisting_page());
    }
    //Autorisation particulière ?
    $special_auth = !empty($page_infos['auth']);
    $array_auth = unserialize($page_infos['auth']);
    //Vérification de l'autorisation de voir la page
    if ($special_auth && !AppContext::get_current_user()->check_auth($array_auth, READ_PAGE) || !$special_auth && !AppContext::get_current_user()->check_auth($config_authorizations, READ_PAGE) && ($special_auth && !AppContext::get_current_user()->check_auth($array_auth, READ_COM)) || !$special_auth && !AppContext::get_current_user()->check_auth($config_authorizations, READ_COM)) {
        DispatchManager::redirect(PHPBoostErrors::user_not_authorized());