Source for file pnuser.php
Documentation is available at pnuser.php
* Zikula Application Framework
* @copyright Robert Gasch
* @link http://www.zikula.org
* @version $Id: pnuser.php 24342 2008-06-06 12:03:14Z markwest $
* @license GNU/GPL - http://www.gnu.org/copyleft/gpl.html
* @author Robert Gasch rgasch@gmail.com
if (strpos ($referer, 'module=Categories') === false) {
$pnRender->assign ('allowusercatedit', pnModGetVar('Categories', 'allowusercatedit', 0));
return $pnRender->fetch('categories_user_editcategories.htm');
* edit category for a simple, non-recursive set of categories
$url = pnModURL ('Categories', 'user', 'edit', array('dr' => $docroot));
if (strpos ($referer, 'module=Categories') === false) {
if (is_int((int) $docroot) && $docroot > 0) {
// now check if someone is trying edit another user's categories
$userRoot = pnModGetVar ('Categories', 'userrootcat', 0);
$userRootCatIPath = $userRootCat['ipath'];
$rootCatIPath = $rootCat['ipath'];
if (strpos($rootCatIPath, $userRootCatIPath) !== false) {
$thisUserRootCategoryName = pnModAPIFunc ('Categories', 'user', 'getusercategoryname');
$thisUserRootCatPath = $userRootCat['path'] . '/' . $thisUserRootCategoryName;
$userRootCatPath = $userRootCat['path'];
$rootCatPath = $rootCat['path'];
if (strpos($rootCatPath, $userRootCatPath) === false) {
if ($editCat['is_locked']) {
if ($editCat && !$editCat['is_leaf']) {
$pnRender->assign('rootCat', $rootCat);
$pnRender->assign('category', $editCat);
$pnRender->assign('allCats', $allCats);
return $pnRender->fetch('categories_user_edit.htm');
* edit categories for the currently logged in user
$allowUserEdit = pnModGetVar ('Categories', 'allowusercatedit', 0);
$userRoot = pnModGetVar ('Categories', 'userrootcat', 0);
$thisUserRootCatPath = $userRoot . '/' . $userCatName;
$autoCreate = pnModGetVar ('Categories', 'autocreateusercat', 0);
require_once ('system/Categories/pninit.php'); // need this for Categories_makeDisplayName() && Categories_makeDisplayDesc()
'parent_id' => $userRootCat['id'],
'security_domain' => 'Categories::',
'path' => $thisUserRootCatPath,
return pn_exit ("Unable to load class [category] ...");
// since the original insert can't construct the ipath (since
// the insert id is not known yet) we update the object here
$autoCreateDefaultUserCat = pnModGetVar ('Categories', 'autocreateuserdefaultcat', 0);
if ($autoCreateDefaultUserCat) {
'name' => $userdefaultcatname,
'security_domain' => 'Categories::',
'path' => $thisUserRootCatPath . '/' . $userdefaultcatname,
// since the original insert can't construct the ipath (since
// the insert id is not known yet) we update the object here
$dr = $thisUserRootCat['id'];
$url = pnModURL ('Categories', 'user', 'edit', array('dr' => $dr));
* refer the user back to the calling page
* return the categories for the currently logged in user, really only used for testing purposes
return pnModAPIFunc ('Categories', 'user', 'getusercategories');
* return the category name for a user, really only used for testing purposes
return pnModAPIFunc ('Categories', 'user', 'getusercategoryname');
|