Add new category property to hide blog postings made into sub-categories from the frontend view, per category. Thanks to netmorix from the forums!
This commit is contained in:
parent
a3dcf387fe
commit
39f6c69764
@ -3,6 +3,10 @@
|
||||
Version 1.2 ()
|
||||
------------------------------------------------------------------------
|
||||
|
||||
* Add new category property to hide blog postings made into sub-
|
||||
categories from the frontend view, per category. Thanks to
|
||||
netmorix from the forums! (garvinhicking)
|
||||
|
||||
* Move possible hazardous personal configuration options ("Rights:
|
||||
Publishing entries", "Forbid creating entries", "Access level";
|
||||
"Group memberships") to the user management section.
|
||||
|
@ -1035,9 +1035,11 @@ function serendipity_addCategory($name, $desc, $authorid, $icon, $parentid) {
|
||||
* @param int The new category owner
|
||||
* @param string The new category icon
|
||||
* @param int The new category parent ID
|
||||
* @param int The new category sort order
|
||||
* @param int The new category subcat hiding
|
||||
* @return null
|
||||
*/
|
||||
function serendipity_updateCategory($cid, $name, $desc, $authorid, $icon, $parentid) {
|
||||
function serendipity_updateCategory($cid, $name, $desc, $authorid, $icon, $parentid, $sort_order = 0, $hide_sub = 0) {
|
||||
global $serendipity;
|
||||
|
||||
$query = "UPDATE {$serendipity['dbPrefix']}category
|
||||
@ -1045,7 +1047,9 @@ function serendipity_updateCategory($cid, $name, $desc, $authorid, $icon, $paren
|
||||
category_description = '". serendipity_db_escape_string($desc) ."',
|
||||
authorid = ". (int)$authorid .",
|
||||
category_icon = '". serendipity_db_escape_string($icon) ."',
|
||||
parentid = ". (int)$parentid ."
|
||||
parentid = ". (int)$parentid .",
|
||||
sort_order = ". (int)$sort_order . ",
|
||||
hide_sub = ". (int)$hide_sub . "
|
||||
WHERE categoryid = ". (int)$cid ."
|
||||
$admin_category";
|
||||
serendipity_db_query($query);
|
||||
@ -1059,7 +1063,6 @@ function serendipity_updateCategory($cid, $name, $desc, $authorid, $icon, $paren
|
||||
);
|
||||
|
||||
serendipity_updatePermalink($data, 'category');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -733,7 +733,7 @@ function serendipity_iframe_create($mode, &$entry) {
|
||||
|
||||
$_SESSION['save_entry'] = $entry;
|
||||
$_SESSION['save_entry_POST'] = $serendipity['POST'];
|
||||
|
||||
|
||||
$attr = '';
|
||||
switch($mode) {
|
||||
case 'save':
|
||||
|
@ -41,12 +41,17 @@ function serendipity_deleteCategory($category_range, $admin_category) {
|
||||
function serendipity_fetchCategoryRange($categoryid) {
|
||||
global $serendipity;
|
||||
|
||||
$res =& serendipity_db_query("SELECT category_left, category_right FROM {$serendipity['dbPrefix']}category WHERE categoryid='". (int)$categoryid ."'");
|
||||
$res =& serendipity_db_query("SELECT category_left, category_right, hide_sub FROM {$serendipity['dbPrefix']}category WHERE categoryid='". (int)$categoryid ."'");
|
||||
if (!is_array($res) || !isset($res[0]['category_left']) || !isset($res[0]['category_right'])) {
|
||||
$res = array(array('category_left' => 0, 'category_right' => 0));
|
||||
}
|
||||
|
||||
return array('category_left' => $res[0]['category_left'], 'category_right' => $res[0]['category_right']);
|
||||
if ($res[0]['hide_sub'] == 1) {
|
||||
// Set ranges only to own category. Patch by netmorix
|
||||
return array('category_left' => $res[0]['category_left'], 'category_right' => $res[0]['category_left']);
|
||||
} else {
|
||||
return array('category_left' => $res[0]['category_left'], 'category_right' => $res[0]['category_right']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -98,7 +103,8 @@ function serendipity_fetchCategoryInfo($categoryid, $categoryname = '') {
|
||||
c.category_name,
|
||||
c.category_description,
|
||||
c.category_icon,
|
||||
c.parentid
|
||||
c.parentid,
|
||||
c.hide_sub
|
||||
FROM {$serendipity['dbPrefix']}category AS c
|
||||
WHERE category_name = '" . serendipity_db_escape_string($categoryname) . "'";
|
||||
|
||||
@ -111,7 +117,8 @@ function serendipity_fetchCategoryInfo($categoryid, $categoryname = '') {
|
||||
c.category_name,
|
||||
c.category_description,
|
||||
c.category_icon,
|
||||
c.parentid
|
||||
c.parentid,
|
||||
c.hide_sub
|
||||
FROM {$serendipity['dbPrefix']}category AS c
|
||||
WHERE categoryid = " . (int)$categoryid;
|
||||
|
||||
|
@ -25,9 +25,12 @@ if (!defined('IN_serendipity')) {
|
||||
}
|
||||
|
||||
include(S9Y_INCLUDE_PATH . 'include/compat.inc.php');
|
||||
if (defined('USE_MEMSNAP')) {
|
||||
memSnap('Framework init');
|
||||
}
|
||||
|
||||
// The version string
|
||||
$serendipity['version'] = '1.2-alpha2';
|
||||
$serendipity['version'] = '1.2-alpha3';
|
||||
|
||||
// Setting this to 'false' will enable debugging output. All alpa/beta/cvs snapshot versions will emit debug information by default. To increase the debug level (to enable Smarty debugging), set this flag to 'debug'.
|
||||
$serendipity['production'] = (preg_match('@\-(alpha|beta|cvs)@', $serendipity['version']) ? false : true);
|
||||
@ -250,6 +253,10 @@ if (!serendipity_db_connect()) {
|
||||
* Load Configuration options from the database
|
||||
*/
|
||||
|
||||
if (defined('USE_MEMSNAP')) {
|
||||
memSnap('Framework init');
|
||||
}
|
||||
|
||||
serendipity_load_configuration();
|
||||
$serendipity['lang'] = serendipity_getSessionLanguage();
|
||||
|
||||
|
@ -218,7 +218,8 @@ CREATE TABLE {PREFIX}category (
|
||||
category_left int(11) default '0',
|
||||
category_right int(11) default '0',
|
||||
parentid int(11) DEFAULT '0' NOT NULL,
|
||||
sort_order int(11)
|
||||
sort_order int(11),
|
||||
hide_sub int(1)
|
||||
) {UTF_8};
|
||||
|
||||
CREATE INDEX categorya_idx ON {PREFIX}category (authorid);
|
||||
|
@ -1,2 +1,3 @@
|
||||
ALTER TABLE {PREFIX}category ADD COLUMN sort_order int(11);
|
||||
ALTER TABLE {PREFIX}category ADD COLUMN hide_sub int(1);
|
||||
CREATE INDEX categoryso_idx ON {PREFIX}category (sort_order);
|
||||
|
@ -1,3 +1,4 @@
|
||||
ALTER TABLE {PREFIX}category ADD COLUMN sort_order int(11);
|
||||
ALTER TABLE {PREFIX}category ADD COLUMN hide_sub int(1);
|
||||
CREATE INDEX categoryso_idx ON {PREFIX}category (sort_order);
|
||||
|
||||
|
@ -7,7 +7,8 @@ CREATE TABLE {PREFIX}tempcategory (
|
||||
category_left int(11) default '0',
|
||||
category_right int(11) default '0',
|
||||
parentid int(11) DEFAULT '0' NOT NULL,
|
||||
sort_order int(11)
|
||||
sort_order int(11),
|
||||
hide_sub int(1)
|
||||
) {UTF_8};
|
||||
|
||||
INSERT INTO {PREFIX}tempcategory (categoryid, category_name, category_icon, category_description, authorid, category_left, category_right, parentid) SELECT categoryid, category_name, category_icon, category_description, authorid, category_left, category_right, parentid FROM {PREFIX}category;
|
||||
@ -22,7 +23,8 @@ CREATE TABLE {PREFIX}category (
|
||||
category_left int(11) default '0',
|
||||
category_right int(11) default '0',
|
||||
parentid int(11) DEFAULT '0' NOT NULL,
|
||||
sort_order int(11)
|
||||
sort_order int(11),
|
||||
hide_sub int(1)
|
||||
) {UTF_8};
|
||||
|
||||
CREATE INDEX categorya_idx ON {PREFIX}category (authorid);
|
||||
@ -34,3 +36,4 @@ CREATE INDEX categoryso_idx ON {PREFIX}category (sort_order);
|
||||
INSERT INTO {PREFIX}category (categoryid, category_name, category_icon, category_description, authorid, category_left, category_right, parentid) SELECT categoryid, category_name, category_icon, category_description, authorid, category_left, category_right, parentid FROM {PREFIX}tempcategory;
|
||||
DROP TABLE {PREFIX}tempcategory;
|
||||
|
||||
UPDATE {PREFIX}category SET hide_sub =
|
Loading…
x
Reference in New Issue
Block a user