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 NoticeDirectory filter : [ all ] / postnuke_official / html / includes [ view in CVS ]
Date | Directory [filter] | File(s) [view] | Author [filter] |
30 Jul 2002 02:26:52 | postnuke_official/html/includes | pnBlocks.php,1.46,1.47 | Paul Rosania |
misc bugfixes |
Update of /home/cvsroot/postnuke_official/html/includes In directory ns7.hostnuke.net:/tmp/cvs-serv13885 Modified Files: pnBlocks.php Log Message: misc bugfixes Index: pnBlocks.php =================================================================== RCS file: /home/cvsroot/postnuke_official/html/includes/pnBlocks.php,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** pnBlocks.php 29 Jul 2002 04:35:04 -0000 1.46 --- pnBlocks.php 30 Jul 2002 02:26:49 -0000 1.47 *************** *** 64,67 **** --- 64,68 ---- inst.pn_content as content, inst.pn_last_update as last_update, + inst.pn_state as state, group_inst.pn_position as position, groups.pn_template as template *************** *** 74,77 **** --- 75,79 ---- ON types.pn_id = inst.pn_type_id WHERE groups.pn_name = '$group_name' + AND inst.pn_state > 0 ORDER BY group_inst.pn_position ASC"; *************** *** 90,94 **** $blockinfo['last_update'] = $result->UnixTimeStamp($blockinfo['last_update']); ! echo pnBlockShow($blockinfo['module'], $blockinfo['type'], $blockinfo); if (pnExceptionMajor() != PN_NO_EXCEPTION) { return NULL; // throw back exception --- 92,96 ---- $blockinfo['last_update'] = $result->UnixTimeStamp($blockinfo['last_update']); ! echo pnBlockShow($blockinfo); if (pnExceptionMajor() != PN_NO_EXCEPTION) { return NULL; // throw back exception *************** *** 108,119 **** * show a block * @access public - * @param the module name - * @param the name of the block * @param block information parameters * @return output the block to show * @raise BAD_PARAM, DATABASE_ERROR, ID_NOT_EXIST, MODULE_FILE_NOT_EXIST */ ! function pnBlockShow($modname, $block, $blockinfo = array()) { if (empty($modname) || empty($block)) { $msg = pnML('Empty modname (#(1)) or block (#(2)).', $modname, $block); --- 110,122 ---- * show a block * @access public * @param block information parameters * @return output the block to show * @raise BAD_PARAM, DATABASE_ERROR, ID_NOT_EXIST, MODULE_FILE_NOT_EXIST */ ! function pnBlockShow($blockinfo) { + $modname = $blockinfo['module']; + $block = $blockinfo['type']; + if (empty($modname) || empty($block)) { $msg = pnML('Empty modname (#(1)) or block (#(2)).', $modname, $block); *************** *** 394,397 **** --- 397,493 ---- return $block_info; + } + + /** + * get block group information + * @access public + * @param gid the group id + * @returns array + * @return resarray array of block information + * @raise DATABASE_ERROR, BAD_PARAM, ID_NOT_EXIST + */ + function pnBlockGroupGetInfo($gid) + { + if (empty($gid)) { + $msg = pnML('Empty group ID (gid).'); + pnExceptionSet(PN_SYSTEM_EXCEPTION, 'BAD_PARAM', + new SystemException(__FILE__.'('.__LINE__.'): '.$msg)); + return NULL; + } + + list ($dbconn) = pnDBGetConn(); + $pntable = pnDBGetTables(); + + $block_instances_table = $pntable['block_instances']; + $block_types_table = $pntable['block_types']; + $block_groups_table = $pntable['block_groups']; + $block_group_instances_table = $pntable['block_group_instances']; + + $query = "SELECT pn_id as id, + pn_name as name, + pn_template as template + FROM $block_groups_table + WHERE pn_id = $gid"; + + $result = $dbconn->Execute($query); + + // Check for db errors + if ($dbconn->ErrorNo() != 0) { + $msg = pnMLByKey('DATABASE_ERROR', $query); + pnExceptionSet(PN_SYSTEM_EXCEPTION, 'DATABASE_ERROR', + new SystemException(__FILE__.'('.__LINE__.'): '.$msg)); + return NULL; + } + + // Freak if we don't get one and only one result + if ($result->PO_RecordCount() != 1) { + $msg = pnMLByKey("Group ID $gid not found.", $query); + pnExceptionSet(PN_SYSTEM_EXCEPTION, 'BAD_PARAM', + new SystemException(__FILE__.'('.__LINE__.'): '.$msg)); + return NULL; + } + + $group = $result->GetRowAssoc(false); + + $result->Close(); + + // Query for instances in this group + $query = "SELECT inst.pn_id as id, + types.pn_type as type, + types.pn_module as module, + inst.pn_title as title, + group_inst.pn_position as position + FROM $block_group_instances_table as group_inst + LEFT JOIN $block_groups_table as groups + ON group_inst.pn_group_id = groups.pn_id + LEFT JOIN $block_instances_table as inst + ON inst.pn_id = group_inst.pn_instance_id + LEFT JOIN $block_types_table as types + ON types.pn_id = inst.pn_type_id + WHERE groups.pn_id = '$gid' + ORDER BY group_inst.pn_position ASC"; + + $result = $dbconn->Execute($query); + + // Check for db errors + if ($dbconn->ErrorNo() != 0) { + $msg = pnMLByKey('DATABASE_ERROR', $query); + pnExceptionSet(PN_SYSTEM_EXCEPTION, 'DATABASE_ERROR', + new SystemException(__FILE__.'('.__LINE__.'): '.$msg)); + return NULL; + } + + // Load up list of group's instances + $instances = array(); + while(!$result->EOF) { + $instances[] = $result->GetRowAssoc(false); + $result->MoveNext(); + } + + $result->Close(); + + $group['instances'] = $instances; + + return $group; }
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 |