|
From: Jon O. <jon...@us...> - 2008-03-13 20:20:15
|
Update of /cvsroot/mxbb/mx_news/mx_news/includes In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv23356 Modified Files: functions.php functions_mx_news.php Log Message: making this module virtual id aware... Index: functions.php =================================================================== RCS file: /cvsroot/mxbb/mx_news/mx_news/includes/functions.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** functions.php 16 Feb 2008 00:14:04 -0000 1.3 --- functions.php 13 Mar 2008 20:19:55 -0000 1.4 *************** *** 332,335 **** --- 332,353 ---- $mx_news_cache->unload(); } + + /** + * Since we must a have scalar identity, with both block_id and virtual_id be create a composite. + * The first 4 digits are the block_id, the rest are the virtual id + * + * @param unknown_type $block_id + */ + function generate_virtualId($block_id) + { + global $mx_request_vars; + + if ($mx_request_vars->is_request('virtual')) + { + $key = -1000 - $block_id; // We support 8999 virtual blocks and unlimited virtual ids + return $key . $mx_request_vars->request('virtual', MX_TYPE_INT, '0'); + } + return $block_id; + } } Index: functions_mx_news.php =================================================================== RCS file: /cvsroot/mxbb/mx_news/mx_news/includes/functions_mx_news.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** functions_mx_news.php 8 Feb 2008 21:58:21 -0000 1.1 --- functions_mx_news.php 13 Mar 2008 20:19:58 -0000 1.2 *************** *** 40,43 **** --- 40,45 ---- { global $db, $userdata, $debug, $mx_news_config, $mx_block; + global $mx_news_functions; + unset( $this->block_id ); unset( $this->comments ); *************** *** 45,105 **** unset( $this->notification ); ! $this->block_id = $mx_block->block_id; ! ! /* ! $sql = 'SELECT * ! FROM ' . LINK_CATEGORIES_TABLE . ' ! ORDER BY cat_order ASC'; ! ! if ( !( $result = $db->sql_query( $sql ) ) ) ! { ! mx_message_die( GENERAL_ERROR, 'Couldnt Query categories info', '', __LINE__, __FILE__, $sql ); ! } ! $cat_rowset = $db->sql_fetchrowset( $result ); ! ! $db->sql_freeresult( $result ); ! ! $this->auth( AUTH_ALL, AUTH_LIST_ALL, $userdata, $cat_rowset ); ! ! for( $i = 0; $i < count( $cat_rowset ); $i++ ) ! { ! if ( $this->auth_user[$cat_rowset[$i]['cat_id']]['auth_view'] ) ! { ! $this->cat_rowset[$cat_rowset[$i]['cat_id']] = $cat_rowset[$i]; ! $this->subcat_rowset[$cat_rowset[$i]['cat_parent']][$cat_rowset[$i]['cat_id']] = $cat_rowset[$i]; ! $this->total_cat++; ! ! // ! // Comments ! // Note: some settings are category dependent, but may use default config settings ! // ! $this->comments[$cat_rowset[$i]['cat_id']]['activated'] = $cat_rowset[$i]['cat_allow_comments'] == -1 ? ($mx_news_config['use_comments'] == 1 ? true : false ) : ( $cat_rowset[$i]['cat_allow_comments'] == 1 ? true : false ); ! $this->comments[$cat_rowset[$i]['cat_id']]['internal_comments'] = $cat_rowset[$i]['internal_comments'] == -1 ? ($mx_news_config['internal_comments'] == 1 ? true : false ) : ( $cat_rowset[$i]['internal_comments'] == 1 ? true : false ); // phpBB or internal comments ! $this->comments[$cat_rowset[$i]['cat_id']]['autogenerate_comments'] = $cat_rowset[$i]['autogenerate_comments'] == -1 ? ($mx_news_config['autogenerate_comments'] == 1 ? true : false ) : ( $cat_rowset[$i]['autogenerate_comments'] == 1 ? true : false ); // autocreate comments when updated ! $this->comments[$cat_rowset[$i]['cat_id']]['comments_forum_id'] = $cat_rowset[$i]['comments_forum_id'] < 1 ? ( intval($mx_news_config['comments_forum_id']) ) : ( intval($cat_rowset[$i]['comments_forum_id']) ); // phpBB target forum (only used for phpBB comments) ! ! if ($this->comments[$cat_rowset[$i]['cat_id']]['activated'] && !$this->comments[$cat_rowset[$i]['cat_id']]['internal_comments'] && intval($this->comments[$cat_rowset[$i]['cat_id']]['comments_forum_id']) < 1) ! { ! mx_message_die(GENERAL_ERROR, 'Init Failure, phpBB comments with no target forum_id :(<br> Category: ' . $cat_rowset[$i]['cat_name'] . ' Forum_id: ' . $this->comments[$cat_rowset[$i]['cat_id']]['comments_forum_id']); ! } ! ! // ! // Ratings ! // ! $this->ratings[$cat_rowset[$i]['cat_id']]['activated'] = $cat_rowset[$i]['cat_allow_ratings'] == -1 ? ($mx_news_config['use_ratings'] == 1 ? true : false ) : ( $cat_rowset[$i]['cat_allow_ratings'] == 1 ? true : false ); ! ! // ! // Information ! // ! $this->information[$cat_rowset[$i]['cat_id']]['activated'] = $cat_rowset[$i]['show_pretext'] == -1 ? ($mx_news_config['show_pretext'] == 1 ? true : false ) : ( $cat_rowset[$i]['show_pretext'] == 1 ? true : false ); // phpBB or internal ratings ! ! // ! // Notification ! // ! $this->notification[$cat_rowset[$i]['cat_id']]['activated'] = $cat_rowset[$i]['notify'] == -1 ? (intval($mx_news_config['notify'])) : ( intval($cat_rowset[$i]['notify']) ); // -1, 0, 1, 2 ! $this->notification[$cat_rowset[$i]['cat_id']]['notify_group'] = $cat_rowset[$i]['notify_group'] == -1 || $cat_rowset[$i]['notify_group'] == 0 ? (intval($mx_news_config['notify_group'])) : ( intval($cat_rowset[$i]['notify_group']) ); // Group_id ! } ! } ! */ // --- 47,52 ---- unset( $this->notification ); ! $this->block_id = $mx_news_functions->generate_virtualId($mx_block->block_id); ! //$this->block_id = $mx_block->block_id; // |