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 / comments / common [ view in CVS ]

Date Directory [filter] File(s) [view] Author [filter]
26 Jul 2002 02:50:01postnuke_official/html/modules/comments/commonCommonFunctions.php,1.18,1.19Carl P. Corliss
 various bugfixes

Update of /home/cvsroot/postnuke_official/html/modules/comments/common
In directory ns7.hostnuke.net:/tmp/cvs-serv8228/html/modules/Comments/common

Modified Files:
	CommonFunctions.php 
Log Message:
various bugfixes


Index: CommonFunctions.php
===================================================================
RCS file: /home/cvsroot/postnuke_official/html/modules/comments/common/CommonFunctions.php,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** CommonFunctions.php	1 Jul 2002 04:18:12 -0000	1.18
--- CommonFunctions.php	26 Jul 2002 02:49:59 -0000	1.19
***************
*** 24,94 ****
  // ----------------------------------------------------------------------
  
!     // Max allowable comment depth
!     define('_COM_MAX_DEPTH',20);
! 
! 	// the following two defines specify the sorting direction which
!     // can be either ascending or descending
! 	define('_COM_SORT_ASC', 1);
! 	define('_COM_SORT_DESC', 0);
  	
!     // the following four defines specify the sort order which can be any of
!     // the following: author, date, topic, lineage 
!     // TODO: Add Rank sorting
!     define ('_COM_SORTBY_AUTHOR', 1);
!     define ('_COM_SORTBY_DATE', 2);
!     define ('_COM_SORTBY_LINEAGE', 3);
!     define ('_COM_SORTBY_TOPIC', 4);
  
! 	// the following define is for $cid when
! 	// you want to retrieve all comments as opposed
! 	// to entering in a real comment id and getting
! 	// just that specific comment
! 	define('_COM_RETRIEVE_ALL', 0);
! 	
!     define('_COM_VIEW_FLAT','flat');
!     define('_COM_VIEW_NESTED','nested');
!     define('_COM_VIEW_THREADED','threaded');
! 	// the following defines are for the $depth variable
! 	// the -1 (FULL_TREE) tells it to get the full
! 	// tree/branch and the the 0 (TREE_LEAF) tells the function
! 	// to acquire just that specific leaf on the tree.
! 	//
! 	define('_COM_FULL_TREE',((int) '-1'));
! 	define('_COM_TREE_LEAF',0);
  
!     // Maximum allowable branch depth
!     define('_COM_MAX_DEPTH',20);
!     
! 	//
! 	// This function returns the Parent Id of the Current Comment based on
! 	// it's lineage.
! 	// @access public
!     // @param Lineage string Lineage of comment
!     // @returns integer
!     // @return parent id of comment based on the lineage
  
!     function pnComments_Getpid($Lineage) {
  
!         // if the lineage is only a depth of one (ie,. Top level comment --
!         // $Lineage = "6"; for example) then we return zero.
!         if (!strstr($Lineage, ':')) { return 0; }
  
!         // explode the lineage into an indexed array.
!         $family = explode(':', $Lineage);
  
!         // need to subtract two here to get the previous id due to the fact
!         // that arrays start indexing at zero.
!         // for example: say you have lineage = "1:2:3:4:5" for cid = 5;
!         // When you explode the lineage into an array you get this:
!         // array(0=>"1", 1=>"2", 2=>"3",3=>"4", 4=>"5")
!         // so, being that there are 5 elements in this array and you want the
!         // value of element 3 (because element 3 is the parent of element 4),
!         // you would have to subtract 2 from the total number of elements (5) to
!         // get the element you want (3)... plz excuse my ramblings... ;)
          // lastly: we need to cast the return value to integer due to each 
          // comment id in the lineage containing a '|' to signify the end of that
          // particular ID.       
          return pnComments_Hex2Dec($family[count($family)-2]);
!     }
  
      //
--- 24,92 ----
  // ----------------------------------------------------------------------
  
! // the following two defines specify the sorting direction which
! // can be either ascending or descending
! define('_COM_SORT_ASC', 1);
! define('_COM_SORT_DESC', 0);
  	
! // the following four defines specify the sort order which can be any of
! // the following: author, date, topic, lineage 
! // TODO: Add Rank sorting
! define ('_COM_SORTBY_AUTHOR', 1);
! define ('_COM_SORTBY_DATE', 2);
! define ('_COM_SORTBY_LINEAGE', 3);
! define ('_COM_SORTBY_TOPIC', 4);
  
! // the following define is for $cid when
! // you want to retrieve all comments as opposed
! // to entering in a real comment id and getting
! // just that specific comment
! define('_COM_RETRIEVE_ALL', 0);
! define('_COM_VIEW_FLAT','flat');
! define('_COM_VIEW_NESTED','nested');
! define('_COM_VIEW_THREADED','threaded');
  
! // the following defines are for the $depth variable
! // the -1 (FULL_TREE) tells it to get the full
! // tree/branch and the the 0 (TREE_LEAF) tells the function
! // to acquire just that specific leaf on the tree.
! //
! define('_COM_FULL_TREE',((int) '-1'));
! define('_COM_TREE_LEAF',0);
  
! // Maximum allowable branch depth
! define('_COM_MAX_DEPTH',20);
!    
! //
! // This function returns the Parent Id of the Current Comment based on
! // it's lineage.
! // @access public
! // @param Lineage string Lineage of comment
! // @returns integer
! // @return parent id of comment based on the lineage
  
! function pnComments_Getpid($Lineage) {
  
!     // if the lineage is only a depth of one (ie,. Top level comment --
!     // $Lineage = "6"; for example) then we return zero.
!     if (!strstr($Lineage, ':')) { 
!         return 0; 
!     }
!     // explode the lineage into an indexed array.
!     $family = explode(':', $Lineage);
  
!     // need to subtract two here to get the previous id due to the fact
!     // that arrays start indexing at zero.
!     // for example: say you have lineage = "1:2:3:4:5" for cid = 5;
!     // When you explode the lineage into an array you get this:
!     // array(0=>"1", 1=>"2", 2=>"3",3=>"4", 4=>"5")
!     // so, being that there are 5 elements in this array and you want the
!     // value of element 3 (because element 3 is the parent of element 4),
!     // you would have to subtract 2 from the total number of elements (5) to
!     // get the element you want (3)... plz excuse my ramblings... ;)
          // lastly: we need to cast the return value to integer due to each 
          // comment id in the lineage containing a '|' to signify the end of that
          // particular ID.       
          return pnComments_Hex2Dec($family[count($family)-2]);
! }
  
      //
***************
*** 99,103 ****
      // @returns string
      // @return Empty string if cid==0, or the lineage of the comment
!     function pnComments_GetLineage($cid) {
  
          // return an empty string if cid equals zero..
--- 97,101 ----
      // @returns string
      // @return Empty string if cid==0, or the lineage of the comment
!     function pnComments_GetLineage( $cid ) {
  
          // return an empty string if cid equals zero..
***************
*** 264,267 ****
--- 262,266 ----
              default:
              case _COM_SORTBY_LINEAGE:
+ 
                      // Here we just create the lineage of each comment as it's key -- allows us 
                      // to sort by the lineage using the Lineage_Cmp function below
***************
*** 269,274 ****
                          $key = $comment['lineage'];
                          $PreSortList[$key] = $comment;
!                         $PreSortList[$key]['depth'] =
!                         pnComments_GetDepth($comment['lineage']);
                      }
  
--- 268,272 ----
                          $key = $comment['lineage'];
                          $PreSortList[$key] = $comment;
!                         $PreSortList[$key]['depth'] = pnComments_GetDepth($comment['lineage']);
                      }
  
***************
*** 278,297 ****
                      // then sort using our own personal comparison function
                      uksort($PreSortList, 'pnComments_LineageCmp');
! 
                      // we took care of the depth earlier in this function -- 
                      // now we are setting the HasChildren field for each comment
                      // which is true if the next comment has the current comments' 
                      // lineage in it's lineage string.
!                     for ($i = 0; $PreSortList[$i]; $i++) {
!                         if (stristr($PreSortList[($i + 1)]['lineage'], $PreSortList[$i]['lineage']) {
!                             $PreSortList[$i]['HasChildren'] = true;
                          } else {
!                             $PreSortList[$i]['HasChildren'] = false;                                
                      }                           
                      break;
          }
              
!         
!         return $PreSortList;
      }
      
--- 276,303 ----
                      // then sort using our own personal comparison function
                      uksort($PreSortList, 'pnComments_LineageCmp');
!                     
                      // we took care of the depth earlier in this function -- 
                      // now we are setting the HasChildren field for each comment
                      // which is true if the next comment has the current comments' 
                      // lineage in it's lineage string.
!                     $i = 0;
!                     $sorted = array();
! 
!                     foreach($PreSortList as $comment) {
!                         $nextcomment = next($PreSortList);
!                         
!                         if (stristr($nextcomment['lineage'], $comment['lineage'])) {
!                             $sorted[$i] = $comment;
!                             $sorted[$i]['HasChildren'] = true;
                          } else {
!                             $sorted[$i] = $comment;
!                             $sorted[$i]['HasChildren'] = false;
!                         }  
!                         $i++;                              
                      }                           
                      break;
          }
              
!         return $sorted;
      }
      
***************
*** 336,350 ****
          // change the id's contained in the lineage to their
          // decimal equivalents to make for easier sorting.
          foreach ($Family_A as $id) {
!             $id = pnComments_Hex2Dec($id);
          }
          
          $Family_B = explode(':',$b);
          $Family_B_count = count($Family_B);
! 
          foreach ($Family_B as $id) {
!             $id = pnComments_Hex2Dec($id);
          }
!         
  
          // We need the lineage with the least amount of id's in
--- 342,359 ----
          // change the id's contained in the lineage to their
          // decimal equivalents to make for easier sorting.
+         $newfama = array();
          foreach ($Family_A as $id) {
!             $newfama[] = pnComments_Hex2Dec($id);
          }
+         $Family_A = $newfama;
          
          $Family_B = explode(':',$b);
          $Family_B_count = count($Family_B);
!         
!         $newfamb = array();
          foreach ($Family_B as $id) {
!             $newfamb[] = pnComments_Hex2Dec($id);
          }
!         $Family_B = $newfamb;
  
          // We need the lineage with the least amount of id's in
***************
*** 515,519 ****
      }
  
!     
      /*
  
--- 524,537 ----
      }
  
!     function pnComments_ConvertLineage2Dec($lineage) {
!         $family = explode(':',$lineage);
!         
!         $converted = array();
!         foreach ($family as $key => $child) {
!             $converted[$key] = pnComments_Hex2Dec($child);
!         }
!         
!         return implode(':',$converted);
!     }
      /*
  
***************
*** 575,581 ****
      */
  
!     function BuildUpgradeList($args, &$CommentList=array(), $pid=0, $lineage='') { 
      
!         if (count($args) <> 13) // too few arguments
              $msg = pnML('Could not upgrade - too few arguments!');
              pnExceptionSet(PN_SYSTEM_EXCEPTION, 'UNKNOWN',
--- 593,602 ----
      */
  
!     function BuildUpgradeList($args, &$CommentList, $pid=0, $lineage='') { 
      
!         if (empty($CommentList)) {
!             $CommentList = array();
!         }
!         if (count($args) <> 13) {  // too few arguments
              $msg = pnML('Could not upgrade - too few arguments!');
              pnExceptionSet(PN_SYSTEM_EXCEPTION, 'UNKNOWN',
***************
*** 599,603 ****
          $sql = "SELECT * FROM {$args[Table]} WHERE {$args[pidfield]}='$pid' ORDER BY {$cidfield} ASC";
          $result = $dbconn->Execute($sql);
!     
          if ($dbconn->ErrorNo() != 0) {
              $msg = pnMLByKey('DATABASE_ERROR', $query);
--- 620,624 ----
          $sql = "SELECT * FROM {$args[Table]} WHERE {$args[pidfield]}='$pid' ORDER BY {$cidfield} ASC";
          $result = $dbconn->Execute($sql);
!         
          if ($dbconn->ErrorNo() != 0) {
              $msg = pnMLByKey('DATABASE_ERROR', $query);
***************
*** 649,653 ****
              // create the lineage for this comment
      		if ($pid = 0) {
!     			$comment['lineage'] = $row[$args['cid']
      		} else {
                  // if the depth of the lineage exceeds the allowed amount,
--- 670,674 ----
              // create the lineage for this comment
      		if ($pid = 0) {
!     			$comment['lineage'] = $row[$args['cid']];
      		} else {
                  // if the depth of the lineage exceeds the allowed amount,
***************
*** 680,686 ****
              $result->MoveNext();
      	}
-      
  	    return $CommentList;
      }
!     
! ?>
--- 701,705 ----
              $result->MoveNext();
      	}
  	    return $CommentList;
      }
! ?>
\ No newline at end of file


Directory filter : [ all ] / postnuke_official / html / modules / comments / common [ 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