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.
* @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
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);
);
serendipity_updatePermalink($data, 'category');
-
}
/**
$_SESSION['save_entry'] = $entry;
$_SESSION['save_entry_POST'] = $serendipity['POST'];
-
+
$attr = '';
switch($mode) {
case 'save':
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']);
+ }
}
/**
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) . "'";
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;
}
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);
* Load Configuration options from the database
*/
+if (defined('USE_MEMSNAP')) {
+ memSnap('Framework init');
+}
+
serendipity_load_configuration();
$serendipity['lang'] = serendipity_getSessionLanguage();
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);
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);
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);
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;
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);
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 =
\ No newline at end of file