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 ]


Deprecated: Function gmstrftime() is deprecated in /home/mikespub/www/list.php on line 509
Date Directory [filter] File(s) [view] Author [filter]
30 Jul 2002 22:14:21postnuke_official/html/modules/categoriespnuserapi.php,1.5,1.6Mike
 generalise leftjoin function

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

Modified Files:
	pnuserapi.php 
Log Message:
generalise leftjoin function


Index: pnuserapi.php
===================================================================
RCS file: /home/cvsroot/postnuke_official/html/modules/categories/pnuserapi.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** pnuserapi.php	30 Jul 2002 18:24:02 -0000	1.5
--- pnuserapi.php	30 Jul 2002 22:14:19 -0000	1.6
***************
*** 592,609 ****
  
  /**
!  * return the correct values for joining on categories table
!  * example : SELECT ...
   *           FROM ...
   *           LEFT JOIN $table
!  *               ON $field = <name of itemid field>
   *           WHERE ...
!  *               AND $where = <module ID>
   *
!  * @param $args['cids'] array of cids that we are selecting on
   * @returns array
!  * @return array('table' => 'categories_linkage',
!  *               'field' => 'categories_linkage.pn_iid',
!  *               'where' => 'categories_linkage.pn_cid IN (...)
!  *                           AND categories_linkage.pn_modid'
   */
  function categories_userapi_leftjoin($args)
--- 592,612 ----
  
  /**
!  * return the field names and correct values for joining on categories table
!  * example : SELECT ..., $cid, ...
   *           FROM ...
   *           LEFT JOIN $table
!  *               ON $field = <name of itemid field in your module>
   *           WHERE ...
!  *               AND $modid = <module ID> // this is *required* for categories
!  *               AND $where
   *
!  * @param $args['cids'] optional array of cids that we are selecting on
   * @returns array
!  * @return array('table' => 'nuke_categories_linkage',
!  *               'field' => 'nuke_categories_linkage.pn_iid',
!  *               'where' => 'nuke_categories_linkage.pn_cid IN (...)',
!  *               'cid'   => 'nuke_categories_linkage.pn_cid',
!  *               ...
!  *               'modid' => 'nuke_categories_linkage.pn_modid')
   */
  function categories_userapi_leftjoin($args)
***************
*** 612,626 ****
      extract($args);
  
!     // Required argument (otherwise you don't need this stuff)
!     if (!isset($cids) || !is_array($cids) || count($cids) == 0) {
!         $msg = pnML('Required parameter #(1) missing','cids');
!         pnExceptionSet(PN_SYSTEM_EXCEPTION, 'BAD_PARAM',
!                        new SystemException($msg));
!         return array();
      }
  
      // Security check
      if (!pnSecAuthAction(0, 'categories::category', '::', ACCESS_OVERVIEW)) {
!         $msg = pnML('Not authorized to view categories');
          pnExceptionSet(PN_SYSTEM_EXCEPTION, 'NO_PERMISSION',
                         new SystemException($msg));
--- 615,627 ----
      extract($args);
  
!     // Optional argument
!     if (!isset($cids)) {
!         $cids = array();
      }
  
      // Security check
      if (!pnSecAuthAction(0, 'categories::category', '::', ACCESS_OVERVIEW)) {
!         $msg = pnML('Not authorized to view #(1)',
!                     'categories');
          pnExceptionSet(PN_SYSTEM_EXCEPTION, 'NO_PERMISSION',
                         new SystemException($msg));
***************
*** 630,635 ****
      foreach ($cids as $cid) {
          if (!pnSecAuthAction(0, 'categories::category', 'ID::$cid', ACCESS_OVERVIEW)) {
!             $msg = pnML('Not authorized to view category #(1)',
!                         pnVarPrepForStore($cid));
              pnExceptionSet(PN_SYSTEM_EXCEPTION, 'NO_PERMISSION',
                             new SystemException($msg));
--- 631,636 ----
      foreach ($cids as $cid) {
          if (!pnSecAuthAction(0, 'categories::category', 'ID::$cid', ACCESS_OVERVIEW)) {
!             $msg = pnML('Not authorized to view #(1) #(2)',
!                         'category',pnVarPrepForStore($cid));
              pnExceptionSet(PN_SYSTEM_EXCEPTION, 'NO_PERMISSION',
                             new SystemException($msg));
***************
*** 641,652 ****
      $pntable = pnDBGetTables();
      $categorieslinkagetable = $pntable['categories_linkage'];
-     $categorieslinkagecolumn = &$pntable['categories_linkage_column'];
  
      $leftjoin = array();
      $leftjoin['table'] = $categorieslinkagetable;
!     $leftjoin['field'] = $categorieslinkagecolumn['iid'];
!     $allcids = join(', ', $cids);
!     $leftjoin['where'] = "$categorieslinkagecolumn[cid] IN (" . pnVarPrepForStore($allcids) . ")";
!     $leftjoin['where'] .= " AND $categorieslinkagecolumn[modid] ";
  
      return $leftjoin;
--- 642,664 ----
      $pntable = pnDBGetTables();
      $categorieslinkagetable = $pntable['categories_linkage'];
  
      $leftjoin = array();
+ 
+     // Specify LEFT JOIN ... ON ... [WHERE ...] parts
      $leftjoin['table'] = $categorieslinkagetable;
!     $leftjoin['field'] = $categorieslinkagetable . '.pn_iid';
!     if (count($cids) > 0) {
!         $allcids = join(', ', $cids);
!         $leftjoin['where'] = $categorieslinkagetable . '.pn_cid IN (' .
!                              pnVarPrepForStore($allcids) . ')';
!     } else {
!         $leftjoin['where'] = '';
!     }
! 
!     // Add available columns in the categories table
!     $columns = array('cid','iid','modid');
!     foreach ($columns as $column) {
!         $leftjoin[$column] = $categorieslinkagetable . '.pn_' . $column;
!     }
  
      return $leftjoin;


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