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] |
07 Aug 2002 03:20:19 | postnuke_official/html/includes | pnBlocks.php,1.49,1.50 | Paul Rosania |
the missing pnBlockType*() functions. please be patient with the installer, it is a work in progress and the SQL files should suffice for now |
Update of /home/cvsroot/postnuke_official/html/includes In directory ns7.hostnuke.net:/tmp/cvs-serv24314 Modified Files: pnBlocks.php Log Message: the missing pnBlockType*() functions. please be patient with the installer, it is a work in progress and the SQL files should suffice for now Index: pnBlocks.php =================================================================== RCS file: /home/cvsroot/postnuke_official/html/includes/pnBlocks.php,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** pnBlocks.php 7 Aug 2002 00:17:03 -0000 1.49 --- pnBlocks.php 7 Aug 2002 03:20:16 -0000 1.50 *************** *** 162,170 **** // Determine which block template to use ! if (isset($blockinfo['template'])) { $template = pnVarPrepForOS($blockinfo['template']); } else { $template = 'default'; ! } // Determine filenames; uses defaults if specified template is not found --- 162,170 ---- // Determine which block template to use ! if (isset($blockinfo['template']) && $blockinfo['template'] != '') { $template = pnVarPrepForOS($blockinfo['template']); } else { $template = 'default'; ! }echo $template; // Determine filenames; uses defaults if specified template is not found *************** *** 446,450 **** // 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)); --- 446,450 ---- // Freak if we don't get one and only one result if ($result->PO_RecordCount() != 1) { ! $msg = pnML("Group ID $gid not found.", $query); pnExceptionSet(PN_SYSTEM_EXCEPTION, 'BAD_PARAM', new SystemException(__FILE__.'('.__LINE__.'): '.$msg)); *************** *** 497,521 **** /** ! * get block group information * @access public * @param module the module name * @param type the block type * @returns void ! * @return when paul says how this is supposed to work * @raise DATABASE_ERROR, BAD_PARAM */ ! function pnBlockTypeRegister($module,$type) { ! if (empty($module)) { ! $msg = pnML('Empty module name.'); ! pnExceptionSet(PN_SYSTEM_EXCEPTION, 'BAD_PARAM', ! new SystemException(__FILE__.'('.__LINE__.'): '.$msg)); ! return NULL; ! } ! if (empty($type)) { ! $msg = pnML('Empty block type.'); pnExceptionSet(PN_SYSTEM_EXCEPTION, 'BAD_PARAM', new SystemException(__FILE__.'('.__LINE__.'): '.$msg)); ! return NULL; } --- 497,515 ---- /** ! * check for existance of a block type * @access public * @param module the module name * @param type the block type * @returns void ! * @return true if exists, false if not found * @raise DATABASE_ERROR, BAD_PARAM */ ! function pnBlockTypeExists($module, $type) { ! if (empty($module) || empty($type)) { ! $msg = pnML('Empty module name (#(0)) or type (#(1))', $module, $type); pnExceptionSet(PN_SYSTEM_EXCEPTION, 'BAD_PARAM', new SystemException(__FILE__.'('.__LINE__.'): '.$msg)); ! return; } *************** *** 525,532 **** $block_types_table = $pntable['block_types']; ! $query = "INSERT INTO $block_types_table ! (pn_module, pn_type) ! VALUES ('" . pnVarPrepForStore($module) . "', ! '" . pnVarPrepForStore($type) . "')"; $result = $dbconn->Execute($query); --- 519,526 ---- $block_types_table = $pntable['block_types']; ! $query = "SELECT pn_id as id ! FROM $block_types_table ! WHERE pn_module = '$module' ! AND pn_type = '$type'"; $result = $dbconn->Execute($query); *************** *** 537,550 **** pnExceptionSet(PN_SYSTEM_EXCEPTION, 'DATABASE_ERROR', new SystemException(__FILE__.'('.__LINE__.'): '.$msg)); ! return NULL; } } ! // TODO: pnBlockTypeUnregister (and all instances etc. too) ! // BTW: registration/unregistration should happen when modules are activated ! // resp. deactivated, not when they're initialised if you ask me... ! ?> --- 531,630 ---- pnExceptionSet(PN_SYSTEM_EXCEPTION, 'DATABASE_ERROR', new SystemException(__FILE__.'('.__LINE__.'): '.$msg)); ! return; ! } ! ! // Got exactly 1 result, it exists ! if ($result->PO_RecordCount() == 1) { ! return true; ! } ! ! // Freak if we don't get zero or one one result ! if ($result->PO_RecordCount() > 1) { ! $msg = pnML('Multiple instances of block type #(0) found in module #(1)!', $type, $module); ! pnExceptionSet(PN_SYSTEM_EXCEPTION, 'BAD_PARAM', ! new SystemException(__FILE__.'('.__LINE__.'): '.$msg)); ! return; } + return false; } ! /** ! * register block type ! * @access public ! * @param module the module name ! * @param type the block type ! * @returns void ! * @return true on success, false on failure ! * @raise DATABASE_ERROR, BAD_PARAM ! */ ! function pnBlockTypeRegister($module, $type) ! { ! if (empty($module) || empty($type)) { ! $msg = pnML('Empty module name (#(0)) or type (#(1))', $module, $type); ! pnExceptionSet(PN_SYSTEM_EXCEPTION, 'BAD_PARAM', ! new SystemException(__FILE__.'('.__LINE__.'): '.$msg)); ! return; ! } ! ! if (pnBlockTypeExists($module, $type)) { ! $msg = pnML('Block type $(0) already exists in the #(1) module', $type, $module); ! pnExceptionSet(PN_SYSTEM_EXCEPTION, 'BAD_PARAM', ! new SystemException(__FILE__.'('.__LINE__.'): '.$msg)); ! return; ! } ! ! list ($dbconn) = pnDBGetConn(); ! $pntable = pnDBGetTables(); ! $block_types_table = $pntable['block_types']; ! ! $query = "INSERT INTO $block_types_table (pn_module, pn_type) VALUES ('$module', '$type');"; ! $dbconn->Execute($query); + // Check for db errors + if ($dbconn->ErrorNo() != 0) { + $msg = pnMLByKey('DATABASE_ERROR', $dbconn->ErrorMsg(), $query); + pnExceptionSet(PN_SYSTEM_EXCEPTION, 'DATABASE_ERROR', + new SystemException(__FILE__.'('.__LINE__.'): '.$msg)); + return; + } + + return true; + } ! /** ! * unregister block type ! * @access public ! * @param module the module name ! * @param type the block type ! * @returns void ! * @return true on success, false on failure ! * @raise DATABASE_ERROR, BAD_PARAM ! */ ! function pnBlockTypeUnregister($module, $type) ! { ! if (!pnBlockTypeExists($module, $type)) { ! return true; ! } ! ! list ($dbconn) = pnDBGetConn(); ! $pntable = pnDBGetTables(); ! ! $block_types_table = $pntable['block_types']; ! ! $query = "DELETE FROM $block_types_table WHERE pn_module = '$module' AND pn_type = '$type';"; ! $dbconn->Execute(); ! ! // Check for db errors ! if ($dbconn->ErrorNo() != 0) { ! $msg = pnMLByKey('DATABASE_ERROR', $dbconn->ErrorMsg(), $query); ! pnExceptionSet(PN_SYSTEM_EXCEPTION, 'DATABASE_ERROR', ! new SystemException(__FILE__.'('.__LINE__.'): '.$msg)); ! return; ! } ! ! return true; ! } ! ! ?> \ No newline at end of file
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 |