From 98e4e884889ab18c8f73b3b65905df5901aabf77 Mon Sep 17 00:00:00 2001 From: garvinhicking Date: Mon, 23 May 2005 12:00:41 +0000 Subject: [PATCH] * New personal configuration item: "Forbid creating entries" to allow authors to be logged in, but not create any entries. Meant to be used in conjunction with serendipity_plugin_adduser for user self-registration where you want to allow posting comments to registered users only. (garvinhicking) --- docs/NEWS | 6 ++++++ include/admin/category.inc.php | 4 ++++ include/admin/comments.inc.php | 4 ++++ include/admin/entries.inc.php | 4 ++++ include/admin/images.inc.php | 4 ++++ include/admin/upgrader.inc.php | 4 ++++ include/tpl/config_personal.inc.php | 8 ++++++++ lang/serendipity_lang_bg.inc.php | 2 ++ lang/serendipity_lang_cn.inc.php | 2 ++ lang/serendipity_lang_cs.inc.php | 2 ++ lang/serendipity_lang_cz.inc.php | 2 ++ lang/serendipity_lang_da.inc.php | 2 ++ lang/serendipity_lang_de.inc.php | 2 ++ lang/serendipity_lang_en.inc.php | 2 ++ lang/serendipity_lang_es.inc.php | 2 ++ lang/serendipity_lang_fa.inc.php | 2 ++ lang/serendipity_lang_fi.inc.php | 2 ++ lang/serendipity_lang_fr.inc.php | 2 ++ lang/serendipity_lang_is.inc.php | 2 ++ lang/serendipity_lang_it.inc.php | 2 ++ lang/serendipity_lang_ja.inc.php | 2 ++ lang/serendipity_lang_ko.inc.php | 2 ++ lang/serendipity_lang_nl.inc.php | 2 ++ lang/serendipity_lang_no.inc.php | 2 ++ lang/serendipity_lang_pt.inc.php | 2 ++ lang/serendipity_lang_ro.inc.php | 2 ++ lang/serendipity_lang_ru.inc.php | 2 ++ lang/serendipity_lang_tn.inc.php | 2 ++ lang/serendipity_lang_tw.inc.php | 3 ++- lang/serendipity_lang_zh.inc.php | 2 ++ serendipity_admin.php | 8 ++++++-- 31 files changed, 86 insertions(+), 3 deletions(-) diff --git a/docs/NEWS b/docs/NEWS index dc38f06..da6c33e 100644 --- a/docs/NEWS +++ b/docs/NEWS @@ -3,6 +3,12 @@ Version 0.9 () ------------------------------------------------------------------------ + * New personal configuration item: "Forbid creating entries" to + allow authors to be logged in, but not create any entries. Meant + to be used in conjunction with serendipity_plugin_adduser for + user self-registration where you want to allow posting comments + to registered users only. (garvinhicking) + * Added Custom Permalink URL days, months, years, etc. to the Serendipity Configuration ("Paths") panel. If you use the external plugin serendipity_plugin_authors or diff --git a/include/admin/category.inc.php b/include/admin/category.inc.php index 172ddfb..5b92625 100644 --- a/include/admin/category.inc.php +++ b/include/admin/category.inc.php @@ -6,6 +6,10 @@ if (IN_serendipity !== true) { die ("Don't hack!"); } +if ($serendipity['no_create']) { + return; +} + $admin_category = ($serendipity['serendipityUserlevel'] < USERLEVEL_CHIEF ? "AND (authorid = 0 OR authorid = " . (int)$serendipity['authorid'] . ")" : ''); /* Add a new category */ diff --git a/include/admin/comments.inc.php b/include/admin/comments.inc.php index d71545d..32154a2 100644 --- a/include/admin/comments.inc.php +++ b/include/admin/comments.inc.php @@ -6,6 +6,10 @@ if (IN_serendipity !== true) { die ("Don't hack!"); } +if ($serendipity['no_create']) { + return; +} + $commentsPerPage = (!empty($serendipity['GET']['filter']['perpage']) ? $serendipity['GET']['filter']['perpage'] : 10); $summaryLength = 200; diff --git a/include/admin/entries.inc.php b/include/admin/entries.inc.php index 01b8f90..bb98e4e 100644 --- a/include/admin/entries.inc.php +++ b/include/admin/entries.inc.php @@ -6,6 +6,10 @@ if (IN_serendipity !== true) { die ("Don't hack!"); } +if ($serendipity['no_create']) { + return; +} + $sort_order = array('timestamp' => DATE, 'isdraft' => PUBLISH . '/' . DRAFT, 'a.realname' => AUTHOR, diff --git a/include/admin/images.inc.php b/include/admin/images.inc.php index 36523cd..e22f6e8 100644 --- a/include/admin/images.inc.php +++ b/include/admin/images.inc.php @@ -6,6 +6,10 @@ if (IN_serendipity !== true) { die ("Don't hack!"); } +if ($serendipity['no_create']) { + return; +} + switch ($serendipity['GET']['adminAction']) { case 'sync': set_time_limit(0); diff --git a/include/admin/upgrader.inc.php b/include/admin/upgrader.inc.php index 76e2d4f..406f44a 100644 --- a/include/admin/upgrader.inc.php +++ b/include/admin/upgrader.inc.php @@ -2,6 +2,10 @@ # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team) # All rights reserved. See LICENSE file for licensing details +if (IN_serendipity !== true) { + die ('Don\'t hack!'); +} + require_once(S9Y_INCLUDE_PATH . 'include/functions_installer.inc.php'); require_once(S9Y_INCLUDE_PATH . 'include/functions_upgrader.inc.php'); diff --git a/include/tpl/config_personal.inc.php b/include/tpl/config_personal.inc.php index 26f4f15..fb59d70 100644 --- a/include/tpl/config_personal.inc.php +++ b/include/tpl/config_personal.inc.php @@ -73,6 +73,14 @@ 'default' => true, 'userlevel' => USERLEVEL_EDITOR), + array('var' => 'no_create', + 'title' => USERCONF_CREATE, + 'description' => USERCONF_CREATE_DESC, + 'type' => 'bool', + 'default' => false, + 'userlevel' => USERLEVEL_CHIEF, + 'flags' => array('config')), + array('var' => 'right_publish', 'title' => USERCONF_ALLOWPUBLISH, 'description' => USERCONF_ALLOWPUBLISH_DESC, diff --git a/lang/serendipity_lang_bg.inc.php b/lang/serendipity_lang_bg.inc.php index e9e6af3..cd026b8 100644 --- a/lang/serendipity_lang_bg.inc.php +++ b/lang/serendipity_lang_bg.inc.php @@ -676,6 +676,8 @@ @define('INSTALL_PERMALINK_PLUGINPATH', 'Path to single plugin'); @define('INSTALL_PERMALINK_ADMINPATH', 'Path to admin'); @define('INSTALL_PERMALINK_SEARCHPATH', 'Path to search'); +@define('USERCONF_CREATE', 'Forbid creating entries?'); +@define('USERCONF_CREATE_DESC', 'If selected, the user may not create new entries'); /* vim: set sts=4 ts=4 expandtab : */ ?> diff --git a/lang/serendipity_lang_cn.inc.php b/lang/serendipity_lang_cn.inc.php index afc1037..078c607 100644 --- a/lang/serendipity_lang_cn.inc.php +++ b/lang/serendipity_lang_cn.inc.php @@ -690,6 +690,8 @@ @define('INSTALL_PERMALINK_PLUGINPATH', 'Path to single plugin'); @define('INSTALL_PERMALINK_ADMINPATH', 'Path to admin'); @define('INSTALL_PERMALINK_SEARCHPATH', 'Path to search'); +@define('USERCONF_CREATE', 'Forbid creating entries?'); +@define('USERCONF_CREATE_DESC', 'If selected, the user may not create new entries'); /* vim: set sts=4 ts=4 expandtab : */ ?> diff --git a/lang/serendipity_lang_cs.inc.php b/lang/serendipity_lang_cs.inc.php index 4590b8b..9d118f5 100644 --- a/lang/serendipity_lang_cs.inc.php +++ b/lang/serendipity_lang_cs.inc.php @@ -692,6 +692,8 @@ @define('INSTALL_PERMALINK_PLUGINPATH', 'Path to single plugin'); @define('INSTALL_PERMALINK_ADMINPATH', 'Path to admin'); @define('INSTALL_PERMALINK_SEARCHPATH', 'Path to search'); +@define('USERCONF_CREATE', 'Forbid creating entries?'); +@define('USERCONF_CREATE_DESC', 'If selected, the user may not create new entries'); /* vim: set sts=4 ts=4 expandtab : */ ?> \ No newline at end of file diff --git a/lang/serendipity_lang_cz.inc.php b/lang/serendipity_lang_cz.inc.php index 6231ad0..49b4e6f 100644 --- a/lang/serendipity_lang_cz.inc.php +++ b/lang/serendipity_lang_cz.inc.php @@ -692,6 +692,8 @@ @define('INSTALL_PERMALINK_PLUGINPATH', 'Path to single plugin'); @define('INSTALL_PERMALINK_ADMINPATH', 'Path to admin'); @define('INSTALL_PERMALINK_SEARCHPATH', 'Path to search'); +@define('USERCONF_CREATE', 'Forbid creating entries?'); +@define('USERCONF_CREATE_DESC', 'If selected, the user may not create new entries'); /* vim: set sts=4 ts=4 expandtab : */ ?> \ No newline at end of file diff --git a/lang/serendipity_lang_da.inc.php b/lang/serendipity_lang_da.inc.php index 71b98e9..c5e613d 100644 --- a/lang/serendipity_lang_da.inc.php +++ b/lang/serendipity_lang_da.inc.php @@ -692,6 +692,8 @@ @define('INSTALL_PERMALINK_PLUGINPATH', 'Path to single plugin'); @define('INSTALL_PERMALINK_ADMINPATH', 'Path to admin'); @define('INSTALL_PERMALINK_SEARCHPATH', 'Path to search'); +@define('USERCONF_CREATE', 'Forbid creating entries?'); +@define('USERCONF_CREATE_DESC', 'If selected, the user may not create new entries'); /* vim: set sts=4 ts=4 expandtab : */ ?> diff --git a/lang/serendipity_lang_de.inc.php b/lang/serendipity_lang_de.inc.php index 83f8b8a..825c0f4 100644 --- a/lang/serendipity_lang_de.inc.php +++ b/lang/serendipity_lang_de.inc.php @@ -691,6 +691,8 @@ @define('INSTALL_PERMALINK_PLUGINPATH', 'Path to single plugin'); @define('INSTALL_PERMALINK_ADMINPATH', 'Path to admin'); @define('INSTALL_PERMALINK_SEARCHPATH', 'Path to search'); +@define('USERCONF_CREATE', 'Forbid creating entries?'); +@define('USERCONF_CREATE_DESC', 'If selected, the user may not create new entries'); /* vim: set sts=4 ts=4 expandtab : */ ?> diff --git a/lang/serendipity_lang_en.inc.php b/lang/serendipity_lang_en.inc.php index cc46ad9..c90aef5 100644 --- a/lang/serendipity_lang_en.inc.php +++ b/lang/serendipity_lang_en.inc.php @@ -689,6 +689,8 @@ @define('INSTALL_PERMALINK_PLUGINPATH', 'Path to single plugin'); @define('INSTALL_PERMALINK_ADMINPATH', 'Path to admin'); @define('INSTALL_PERMALINK_SEARCHPATH', 'Path to search'); +@define('USERCONF_CREATE', 'Forbid creating entries?'); +@define('USERCONF_CREATE_DESC', 'If selected, the user may not create new entries'); /* vim: set sts=4 ts=4 expandtab : */ ?> diff --git a/lang/serendipity_lang_es.inc.php b/lang/serendipity_lang_es.inc.php index 00cc769..eb703dd 100644 --- a/lang/serendipity_lang_es.inc.php +++ b/lang/serendipity_lang_es.inc.php @@ -694,6 +694,8 @@ @define('INSTALL_PERMALINK_PLUGINPATH', 'Path to single plugin'); @define('INSTALL_PERMALINK_ADMINPATH', 'Path to admin'); @define('INSTALL_PERMALINK_SEARCHPATH', 'Path to search'); +@define('USERCONF_CREATE', 'Forbid creating entries?'); +@define('USERCONF_CREATE_DESC', 'If selected, the user may not create new entries'); /* vim: set sts=4 ts=4 expandtab : */ ?> \ No newline at end of file diff --git a/lang/serendipity_lang_fa.inc.php b/lang/serendipity_lang_fa.inc.php index 2bb4b6f..e5478c2 100644 --- a/lang/serendipity_lang_fa.inc.php +++ b/lang/serendipity_lang_fa.inc.php @@ -691,6 +691,8 @@ @define('INSTALL_PERMALINK_PLUGINPATH', 'Path to single plugin'); @define('INSTALL_PERMALINK_ADMINPATH', 'Path to admin'); @define('INSTALL_PERMALINK_SEARCHPATH', 'Path to search'); +@define('USERCONF_CREATE', 'Forbid creating entries?'); +@define('USERCONF_CREATE_DESC', 'If selected, the user may not create new entries'); /* vim: set sts=4 ts=4 expandtab : */ ?> diff --git a/lang/serendipity_lang_fi.inc.php b/lang/serendipity_lang_fi.inc.php index 12a6c6e..43629c5 100644 --- a/lang/serendipity_lang_fi.inc.php +++ b/lang/serendipity_lang_fi.inc.php @@ -689,6 +689,8 @@ @define('INSTALL_PERMALINK_PLUGINPATH', 'Path to single plugin'); @define('INSTALL_PERMALINK_ADMINPATH', 'Path to admin'); @define('INSTALL_PERMALINK_SEARCHPATH', 'Path to search'); +@define('USERCONF_CREATE', 'Forbid creating entries?'); +@define('USERCONF_CREATE_DESC', 'If selected, the user may not create new entries'); /* vim: set sts=4 ts=4 expandtab : */ ?> diff --git a/lang/serendipity_lang_fr.inc.php b/lang/serendipity_lang_fr.inc.php index 098ba95..258c5ef 100644 --- a/lang/serendipity_lang_fr.inc.php +++ b/lang/serendipity_lang_fr.inc.php @@ -697,6 +697,8 @@ @define('INSTALL_PERMALINK_PLUGINPATH', 'Path to single plugin'); @define('INSTALL_PERMALINK_ADMINPATH', 'Path to admin'); @define('INSTALL_PERMALINK_SEARCHPATH', 'Path to search'); +@define('USERCONF_CREATE', 'Forbid creating entries?'); +@define('USERCONF_CREATE_DESC', 'If selected, the user may not create new entries'); /* vim: set sts=4 ts=4 expandtab : */ ?> \ No newline at end of file diff --git a/lang/serendipity_lang_is.inc.php b/lang/serendipity_lang_is.inc.php index 25c0adb..fb3d437 100644 --- a/lang/serendipity_lang_is.inc.php +++ b/lang/serendipity_lang_is.inc.php @@ -689,6 +689,8 @@ @define('INSTALL_PERMALINK_PLUGINPATH', 'Path to single plugin'); @define('INSTALL_PERMALINK_ADMINPATH', 'Path to admin'); @define('INSTALL_PERMALINK_SEARCHPATH', 'Path to search'); +@define('USERCONF_CREATE', 'Forbid creating entries?'); +@define('USERCONF_CREATE_DESC', 'If selected, the user may not create new entries'); /* vim: set sts=4 ts=4 expandtab : */ ?> diff --git a/lang/serendipity_lang_it.inc.php b/lang/serendipity_lang_it.inc.php index 4737900..b71b545 100644 --- a/lang/serendipity_lang_it.inc.php +++ b/lang/serendipity_lang_it.inc.php @@ -691,6 +691,8 @@ @define('INSTALL_PERMALINK_PLUGINPATH', 'Path to single plugin'); @define('INSTALL_PERMALINK_ADMINPATH', 'Path to admin'); @define('INSTALL_PERMALINK_SEARCHPATH', 'Path to search'); +@define('USERCONF_CREATE', 'Forbid creating entries?'); +@define('USERCONF_CREATE_DESC', 'If selected, the user may not create new entries'); /* vim: set sts=4 ts=4 expandtab : */ ?> diff --git a/lang/serendipity_lang_ja.inc.php b/lang/serendipity_lang_ja.inc.php index 563b84e..8301750 100644 --- a/lang/serendipity_lang_ja.inc.php +++ b/lang/serendipity_lang_ja.inc.php @@ -691,6 +691,8 @@ Serendipity のアップグレードステージを無視しました。正し @define('INSTALL_PERMALINK_PLUGINPATH', 'Path to single plugin'); @define('INSTALL_PERMALINK_ADMINPATH', 'Path to admin'); @define('INSTALL_PERMALINK_SEARCHPATH', 'Path to search'); +@define('USERCONF_CREATE', 'Forbid creating entries?'); +@define('USERCONF_CREATE_DESC', 'If selected, the user may not create new entries'); /* vim: set sts=4 ts=4 expandtab : */ ?> diff --git a/lang/serendipity_lang_ko.inc.php b/lang/serendipity_lang_ko.inc.php index 2bd8a0b..9252390 100644 --- a/lang/serendipity_lang_ko.inc.php +++ b/lang/serendipity_lang_ko.inc.php @@ -694,6 +694,8 @@ @define('INSTALL_PERMALINK_PLUGINPATH', 'Path to single plugin'); @define('INSTALL_PERMALINK_ADMINPATH', 'Path to admin'); @define('INSTALL_PERMALINK_SEARCHPATH', 'Path to search'); +@define('USERCONF_CREATE', 'Forbid creating entries?'); +@define('USERCONF_CREATE_DESC', 'If selected, the user may not create new entries'); /* vim: set sts=4 ts=4 expandtab : */ ?> diff --git a/lang/serendipity_lang_nl.inc.php b/lang/serendipity_lang_nl.inc.php index 5cd4f57..849f6b4 100644 --- a/lang/serendipity_lang_nl.inc.php +++ b/lang/serendipity_lang_nl.inc.php @@ -693,6 +693,8 @@ @define('INSTALL_PERMALINK_PLUGINPATH', 'Path to single plugin'); @define('INSTALL_PERMALINK_ADMINPATH', 'Path to admin'); @define('INSTALL_PERMALINK_SEARCHPATH', 'Path to search'); +@define('USERCONF_CREATE', 'Forbid creating entries?'); +@define('USERCONF_CREATE_DESC', 'If selected, the user may not create new entries'); /* vim: set sts=4 ts=4 expandtab : */ ?> diff --git a/lang/serendipity_lang_no.inc.php b/lang/serendipity_lang_no.inc.php index d6d72cf..c92f593 100644 --- a/lang/serendipity_lang_no.inc.php +++ b/lang/serendipity_lang_no.inc.php @@ -692,5 +692,7 @@ @define('INSTALL_PERMALINK_PLUGINPATH', 'Path to single plugin'); @define('INSTALL_PERMALINK_ADMINPATH', 'Path to admin'); @define('INSTALL_PERMALINK_SEARCHPATH', 'Path to search'); +@define('USERCONF_CREATE', 'Forbid creating entries?'); +@define('USERCONF_CREATE_DESC', 'If selected, the user may not create new entries'); ?> diff --git a/lang/serendipity_lang_pt.inc.php b/lang/serendipity_lang_pt.inc.php index 8e7dfa7..3d35ca5 100644 --- a/lang/serendipity_lang_pt.inc.php +++ b/lang/serendipity_lang_pt.inc.php @@ -692,6 +692,8 @@ @define('INSTALL_PERMALINK_PLUGINPATH', 'Path to single plugin'); @define('INSTALL_PERMALINK_ADMINPATH', 'Path to admin'); @define('INSTALL_PERMALINK_SEARCHPATH', 'Path to search'); +@define('USERCONF_CREATE', 'Forbid creating entries?'); +@define('USERCONF_CREATE_DESC', 'If selected, the user may not create new entries'); /* vim: set sts=4 ts=4 expandtab : */ ?> diff --git a/lang/serendipity_lang_ro.inc.php b/lang/serendipity_lang_ro.inc.php index 80a3f13..85273a1 100644 --- a/lang/serendipity_lang_ro.inc.php +++ b/lang/serendipity_lang_ro.inc.php @@ -689,6 +689,8 @@ @define('INSTALL_PERMALINK_PLUGINPATH', 'Path to single plugin'); @define('INSTALL_PERMALINK_ADMINPATH', 'Path to admin'); @define('INSTALL_PERMALINK_SEARCHPATH', 'Path to search'); +@define('USERCONF_CREATE', 'Forbid creating entries?'); +@define('USERCONF_CREATE_DESC', 'If selected, the user may not create new entries'); /* vim: set sts=4 ts=4 expandtab : */ ?> diff --git a/lang/serendipity_lang_ru.inc.php b/lang/serendipity_lang_ru.inc.php index 27da55b..4dd99c9 100644 --- a/lang/serendipity_lang_ru.inc.php +++ b/lang/serendipity_lang_ru.inc.php @@ -692,6 +692,8 @@ @define('INSTALL_PERMALINK_PLUGINPATH', 'Path to single plugin'); @define('INSTALL_PERMALINK_ADMINPATH', 'Path to admin'); @define('INSTALL_PERMALINK_SEARCHPATH', 'Path to search'); +@define('USERCONF_CREATE', 'Forbid creating entries?'); +@define('USERCONF_CREATE_DESC', 'If selected, the user may not create new entries'); /* vim: set sts=4 ts=4 expandtab : */ ?> diff --git a/lang/serendipity_lang_tn.inc.php b/lang/serendipity_lang_tn.inc.php index cdb9762..1b819a3 100644 --- a/lang/serendipity_lang_tn.inc.php +++ b/lang/serendipity_lang_tn.inc.php @@ -690,6 +690,8 @@ @define('INSTALL_PERMALINK_PLUGINPATH', 'Path to single plugin'); @define('INSTALL_PERMALINK_ADMINPATH', 'Path to admin'); @define('INSTALL_PERMALINK_SEARCHPATH', 'Path to search'); +@define('USERCONF_CREATE', 'Forbid creating entries?'); +@define('USERCONF_CREATE_DESC', 'If selected, the user may not create new entries'); /* vim: set sts=4 ts=4 expandtab : */ ?> diff --git a/lang/serendipity_lang_tw.inc.php b/lang/serendipity_lang_tw.inc.php index da59212..4276827 100644 --- a/lang/serendipity_lang_tw.inc.php +++ b/lang/serendipity_lang_tw.inc.php @@ -690,6 +690,7 @@ @define('INSTALL_PERMALINK_PLUGINPATH', 'Path to single plugin'); @define('INSTALL_PERMALINK_ADMINPATH', 'Path to admin'); @define('INSTALL_PERMALINK_SEARCHPATH', 'Path to search'); +@define('USERCONF_CREATE', 'Forbid creating entries?'); +@define('USERCONF_CREATE_DESC', 'If selected, the user may not create new entries'); -/* vim: set sts=4 ts=4 expandtab : */ ?> diff --git a/lang/serendipity_lang_zh.inc.php b/lang/serendipity_lang_zh.inc.php index 3b95c73..5771899 100644 --- a/lang/serendipity_lang_zh.inc.php +++ b/lang/serendipity_lang_zh.inc.php @@ -690,6 +690,8 @@ @define('INSTALL_PERMALINK_PLUGINPATH', 'Path to single plugin'); @define('INSTALL_PERMALINK_ADMINPATH', 'Path to admin'); @define('INSTALL_PERMALINK_SEARCHPATH', 'Path to search'); +@define('USERCONF_CREATE', 'Forbid creating entries?'); +@define('USERCONF_CREATE_DESC', 'If selected, the user may not create new entries'); /* vim: set sts=4 ts=4 expandtab : */ ?> diff --git a/serendipity_admin.php b/serendipity_admin.php index 6ed3f47..bd2e6c0 100644 --- a/serendipity_admin.php +++ b/serendipity_admin.php @@ -135,6 +135,7 @@ if (!isset($serendipity['serendipityPath']) || IS_installed === false || IS_up2d

  • + - + + - + = USERLEVEL_CHIEF) { ?>
    -- 2.39.5