Xaraya / Postnuke CVS Notices - Message

Note: this list is kept only as a demonstration for CVSNotice. For the latest CVS notices, see the Xaraya and Postnuke sites

View Statistics - Next Notice - Previous Notice

Directory filter : [ all ] / postnuke_official / html / modules / categories [ view in CVS ]

Date Directory [filter] File(s) [view] Author [filter]
28 Jul 2002 13:28:57postnuke_official/html/modules/categoriespnadminapi.php,1.5,1.6Mike
 re-add _create (parent model)

Update of /home/cvsroot/postnuke_official/html/modules/categories
In directory ns7.hostnuke.net:/tmp/cvs-serv1116

Modified Files:
	pnadminapi.php 
Log Message:
re-add _create (parent model)


Index: pnadminapi.php
===================================================================
RCS file: /home/cvsroot/postnuke_official/html/modules/categories/pnadminapi.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** pnadminapi.php	27 Jul 2002 20:42:25 -0000	1.5
--- pnadminapi.php	28 Jul 2002 13:28:55 -0000	1.6
***************
*** 220,223 ****
--- 220,300 ----
  }
  
+ /**
+  * creates a category using the parent model
+  *
+  *  -- INPUT --
+  * @param $args['name'] the name of the category
+  * @param $args['description'] the description of the category
+  * @param $args['image'] the (optional) image for the category
+  * @param $args['parent_id'] Parent Category ID (0 if root)
+  *
+  *  -- OUTPUT --
+  * @returns int
+  * @return category ID on success, false on failure
+  */
+ // Creates a category using the parent model
+ function categories_adminapi_create ($args)
+ {
+     // Get arguments from argument array
+     extract($args);
+     
+     // Argument check
+     if ((!isset($name))        ||
+         (!isset($description)) ||
+         (!isset($parent_id))   ||
+         (!is_numeric($parent_id))
+        )
+     {
+         pnSessionSetVar('errormsg', _MODARGSERROR);
+         return false;
+     }
+ 
+     if (!isset($image)) {
+         $image = '';
+     }
+ 
+     // Security check
+     // Has to be redone later
+ 
+     if (!pnSecAuthAction(0, "categories::category", "ID::", ACCESS_ADD))
+     {
+         pnSessionSetVar('errormsg', _CATEGORIESNOAUTH);
+         return false;
+     }
+ 
+     if (!pnModAPILoad('categories', 'user')) 
+     {
+         pnExceptionSet(PN_SYSTEM_EXCEPTION, 'MODULE_FILE_NOT_EXIST',
+                        new SystemException(__FILE__.'('.__LINE__.'): Unable to load the categories module´s user API'));
+         return;
+     }
+ 
+     if ($parent_id != 0) 
+     {
+        $cat = pnModAPIFunc('categories', 'user', 'getcatinfo', Array('cid'=>$parent_id));
+ 
+        if ($cat == false) 
+        {
+           pnExceptionSet(PN_USER_EXCEPTION, 'BAD_PARAM',
+                           new SystemException(__FILE__.'('.__LINE__.'): Unable to load the categories module´s user API'));
+           return false;
+        }
+        $point_of_insertion = $cat['left'] + 1;
+     } else {
+        $point_of_insertion = 1;    
+     }
+ 
+     return categories_adminapi_createcatdirectly
+            (
+                 Array
+                 (
+                     'point_of_insertion' => $point_of_insertion,
+                     'name' => $name,
+                     'description' => $description,
+                     'image' => $image
+                 )
+             );
+ }
+ 
  function categories_adminapi_createcatdirectly($args)
  {


Directory filter : [ all ] / postnuke_official / html / modules / categories [ view in CVS ]

View Statistics - Next Notice - Previous Notice


Visit Developer Site - Browse CVS Repository Syndicate via backend.rss
(max. once per hour please)
Powered by CVSNotice 0.1.3