[geeklog-cvs] Geeklog-1.x/public_html lib-common.php,1.651,1.652
Blaine Lang
blaine at qs1489.pair.com
Sat Sep 1 22:18:43 EDT 2007
Update of /cvsroot/geeklog/Geeklog-1.x/public_html
In directory qs1489.pair.com:/tmp/cvs-serv91362
Modified Files:
lib-common.php
Log Message:
Added support to COM_startBlock to set a unique {blockid} in the blockheader templates. Handles the case if there are multiple blocks of the same name - as in multiple polls.
Index: lib-common.php
===================================================================
RCS file: /cvsroot/geeklog/Geeklog-1.x/public_html/lib-common.php,v
retrieving revision 1.651
retrieving revision 1.652
diff -C2 -d -r1.651 -r1.652
*** lib-common.php 1 Sep 2007 20:23:45 -0000 1.651
--- lib-common.php 2 Sep 2007 02:18:41 -0000 1.652
***************
*** 1359,1362 ****
--- 1359,1382 ----
$block->set_var( 'block_title', stripslashes( $title ));
+ // Set a blockid
+ if (!isset($GLOBALS['siteblocks'])) $GLOBALS['siteblocks'] = array();
+ $blockid = stripslashes ($title);
+ $blockid = strtr($blockid, "!@#$%^&*()'\"\\/?~`.,;: ", "________________________");
+ // Check if there is already a block of the same name
+ if (in_array($blockid,$GLOBALS['siteblocks'])) {
+ // Now, in the unlikely chance there are multiple matching blocks
+ for ($i=2; $i <= 5; $i++) { // there can't be more then 5 blocks of the same name
+ $nblockid = "{$blockid}{$i}";
+ if (!in_array($nblockid,$GLOBALS['siteblocks'])) {
+ $blockid = $nblockid;
+ $GLOBALS['siteblocks'][] = $blockid;
+ break;
+ }
+ }
+ } else {
+ $GLOBALS['siteblocks'][] = $blockid;
+ }
+ $block->set_var( 'blockid', $blockid);
+
if( !empty( $helpfile ))
{
More information about the geeklog-cvs
mailing list