[fusionregistry-commitlog] SF.net SVN: fusionregistry: [45] branches/stable_3_0_x/upload/sources
Brought to you by:
copland007
|
From: SVN c. <fus...@li...> - 2008-02-16 20:58:32
|
Revision: 45
http://fusionregistry.svn.sourceforge.net/fusionregistry/?rev=45&view=rev
Author: copland007
Date: 2008-02-16 12:58:37 -0800 (Sat, 16 Feb 2008)
Log Message:
-----------
The first level key returned from any of the cf cache get routines is no longer the field_id, it is just a reference number. Switch all post-get logic to use sub key 'field_id' as the guaranteed field_id of what was retrieved.
Modified Paths:
--------------
branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_custom_fields.php
branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/item.php
branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/content.php
branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/custom_fields.php
branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/functions.php
branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/main.php
Modified: branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_custom_fields.php
===================================================================
--- branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_custom_fields.php 2008-02-15 00:15:56 UTC (rev 44)
+++ branches/stable_3_0_x/upload/sources/components_acp/fusionscripts/fusionregistry/ad_custom_fields.php 2008-02-16 20:58:37 UTC (rev 45)
@@ -692,7 +692,7 @@
$this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Fusion Registry Custom Fields" );
// Loop through our custom field definitions we got from up above
- foreach ( $cf_defs as $cf_id => $cf_row )
+ foreach ( $cf_defs as $cf_rum => $cf_row )
{
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( '<center><a href="'.$this->ipsclass->base_url.'&act='.REGISTRY_URL.'§ion=components&menu=custom_fields&code=edit&f='.$cf_row['field_id'].'">'. $this->ad_registry_loader->imgs['edit'] .'</a></center>',
'<center><a href="javascript:confirm_delete_field( '.$cf_row['field_id'].' )">'. $this->ad_registry_loader->imgs['delete'] .'</a></center>',
Modified: branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/item.php
===================================================================
--- branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/item.php 2008-02-15 00:15:56 UTC (rev 44)
+++ branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/item.php 2008-02-16 20:58:37 UTC (rev 45)
@@ -333,18 +333,18 @@
$cf_required = array();
- foreach ( $cf_defs as $cf_id => $cf_row )
+ foreach ( $cf_defs as $cf_num => $cf_row )
{
if ( $cf_row['field_required'] == 1 )
{
- $cf_required[$cf_id] = $cf_row;
+ $cf_required[ $cf_row['field_id'] ] = $cf_row;
}
}
// Compile list of missing fields (if any)
$missing_fields = '';
- foreach ( $cf_required as $cf_id => $cf_row )
+ foreach ( $cf_required as $cf_num => $cf_row )
{
// We have to special case the make/model since they don't use the field_id as the field name
if ( $cf_row['field_options'] == 'make' or $cf_row['field_options'] == 'model' )
@@ -356,7 +356,7 @@
}
else
{
- if ( !isset($this->ipsclass->input[$cf_id]) or empty($this->ipsclass->input[$cf_id]) )
+ if ( !isset($this->ipsclass->input[ $cf_row['field_id'] ]) or empty($this->ipsclass->input[ $cf_row['field_id'] ]) )
{
$missing_fields .= $cf_row['field_name'] . ', ';
}
@@ -394,17 +394,17 @@
unset($db_string);
// Now save their custom field data
- foreach ( $cf_input as $cf_id => $cf_value )
+ foreach ( $cf_input as $cf_num => $cf_value )
{
// Determine if we need to update or insert row
- $rs = $this->ipsclass->DB->query("SELECT entry_id FROM ibf_registry_field_entries WHERE item_id = '". $this->ipsclass->input['CID'] ."' AND field_id = '$cf_id'");
+ $rs = $this->ipsclass->DB->query("SELECT entry_id FROM ibf_registry_field_entries WHERE item_id = '". $this->ipsclass->input['CID'] ."' AND field_id = '". $cf_row['field_id'] ."'");
$existing = $this->ipsclass->DB->fetch_row($rs);
if ( isset($existing['entry_id']) and !empty($existing['entry_id']) )
{
// Update existing entry
- $db_string = $this->ipsclass->DB->compile_db_update_string( array( 'field_id' => $cf_id,
+ $db_string = $this->ipsclass->DB->compile_db_update_string( array( 'field_id' => $cf_row['field_id'],
'item_id' => $this->ipsclass->input['CID'],
'field_value' => $cf_value,
) );
@@ -414,7 +414,7 @@
else
{
// Insert new entry
- $db_string = $this->ipsclass->DB->compile_db_insert_string( array( 'field_id' => $cf_id,
+ $db_string = $this->ipsclass->DB->compile_db_insert_string( array( 'field_id' => $cf_row['field_id'],
'item_id' => $this->ipsclass->input['CID'],
'field_value' => $cf_value,
) );
@@ -473,18 +473,18 @@
$cf_required = array();
- foreach ( $cf_defs as $cf_id => $cf_row )
+ foreach ( $cf_defs as $cf_num => $cf_row )
{
if ( $cf_row['field_required'] == 1 )
{
- $cf_required[$cf_id] = $cf_row;
+ $cf_required[ $cf_row['field_id'] ] = $cf_row;
}
}
// Compile list of missing fields (if any)
$missing_fields = '';
- foreach ( $cf_required as $cf_id => $cf_row )
+ foreach ( $cf_required as $cf_num => $cf_row )
{
// We have to special case the make/model since they don't use the field_id as the field name
if ( $cf_row['field_options'] == 'make' or $cf_row['field_options'] == 'model' )
@@ -496,7 +496,7 @@
}
else
{
- if ( !isset($this->ipsclass->input[$cf_id]) or empty($this->ipsclass->input[$cf_id]) )
+ if ( !isset($this->ipsclass->input[ $cf_row['field_id'] ]) or empty($this->ipsclass->input[ $cf_row['field_id'] ]) )
{
$missing_fields .= $cf_row['field_name'] . ', ';
}
@@ -545,9 +545,9 @@
$cid = $this->ipsclass->DB->get_insert_id();
// Now save their custom field data
- foreach ( $cf_input as $cf_id => $cf_value )
+ foreach ( $cf_input as $cf_num => $cf_value )
{
- $db_string = $this->ipsclass->DB->compile_db_insert_string( array( 'field_id' => $cf_id,
+ $db_string = $this->ipsclass->DB->compile_db_insert_string( array( 'field_id' => $cf_row['field_id'],
'item_id' => $cid,
'field_value' => $cf_value,
) );
Modified: branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/content.php
===================================================================
--- branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/content.php 2008-02-15 00:15:56 UTC (rev 44)
+++ branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/content.php 2008-02-16 20:58:37 UTC (rev 45)
@@ -132,7 +132,12 @@
$cf_highlight = $this->class->lib['custom_fields']->get_cf_highlight();
// Create our sql id list, this will be used when retrieving the custom field entries.
- $cf_ids = "'". implode( "','", array_keys($cf_highlight) ) . "'";
+ $cf_ids = "'";
+ foreach ( $cf_highlight as $cf_num => $cf_row )
+ {
+ $cf_ids .= $cf_row['field_id']. "','";
+ }
+ $cf_ids = substr($cf_ids, 0, -2);
// Grab the vehicle info and prep the HTML
$this->ipsclass->DB->query("SELECT g.id, g.image_id, g.member_id, images.attach_id, images.attach_hits,
@@ -256,9 +261,9 @@
// Process the highlight field values
$vehicle_data['highlight_fields'] = '';
- foreach ( $cf_highlight as $cf_id => $cf_row )
+ foreach ( $cf_highlight as $cf_num => $cf_row )
{
- $vehicle_data['highlight_fields'] .= $this->class->lib['custom_fields']->process_cf_value( array( 'def' => $cf_row, 'value' => $cf_entries[$cf_id]['field_value'], 'type' => 'view' ) );
+ $vehicle_data['highlight_fields'] .= $this->class->lib['custom_fields']->process_cf_value( array( 'def' => $cf_row, 'value' => $cf_entries[ $cf_row['field_id'] ]['field_value'], 'type' => 'view' ) );
$vehicle_data['highlight_fields'] .= ' ';
}
@@ -293,7 +298,12 @@
$cf_highlight = $this->class->lib['custom_fields']->get_cf_highlight();
// Create our sql id list, this will be used when retrieving the custom field entries.
- $cf_ids = "'". implode( "','", array_keys($cf_highlight) ) . "'";
+ $cf_ids = "'";
+ foreach ( $cf_highlight as $cf_num => $cf_row )
+ {
+ $cf_ids .= $cf_row['field_id']. "','";
+ }
+ $cf_ids = substr($cf_ids, 0, -2);
// What's the count? Default to 10
$limit = $this->class->registry_config['tmpl_lastcommented_limit'] ? $this->class->registry_config['tmpl_lastcommented_limit'] : 10;
@@ -314,9 +324,9 @@
// Process the highlight field values
$row['highlight_fields'] = '';
- foreach ( $cf_highlight as $cf_id => $cf_row )
+ foreach ( $cf_highlight as $cf_num => $cf_row )
{
- $row['highlight_fields'] .= $this->class->lib['custom_fields']->process_cf_value( array( 'def' => $cf_row, 'value' => $cf_entries[$cf_id]['field_value'], 'type' => 'view' ) );
+ $row['highlight_fields'] .= $this->class->lib['custom_fields']->process_cf_value( array( 'def' => $cf_row, 'value' => $cf_entries[ $cf_row['field_id'] ]['field_value'], 'type' => 'view' ) );
$row['highlight_fields'] .= ' ';
}
@@ -358,7 +368,12 @@
$cf_highlight = $this->class->lib['custom_fields']->get_cf_highlight();
// Create our sql id list, this will be used when retrieving the custom field entries.
- $cf_ids = "'". implode( "','", array_keys($cf_highlight) ) . "'";
+ $cf_ids = "'";
+ foreach ( $cf_highlight as $cf_num => $cf_row )
+ {
+ $cf_ids .= $cf_row['field_id']. "','";
+ }
+ $cf_ids = substr($cf_ids, 0, -2);
// What's the count? Default to 10
$limit = $this->class->registry_config['tmpl_lastupdateditems_limit'] ? $this->class->registry_config['tmpl_lastupdateditems_limit'] : 10;
@@ -378,9 +393,9 @@
// Process the highlight field values
$row['highlight_fields'] = '';
- foreach ( $cf_highlight as $cf_id => $cf_row )
+ foreach ( $cf_highlight as $cf_num => $cf_row )
{
- $row['highlight_fields'] .= $this->class->lib['custom_fields']->process_cf_value( array( 'def' => $cf_row, 'value' => $cf_entries[$cf_id]['field_value'], 'type' => 'view' ) );
+ $row['highlight_fields'] .= $this->class->lib['custom_fields']->process_cf_value( array( 'def' => $cf_row, 'value' => $cf_entries[ $cf_row['field_id'] ]['field_value'], 'type' => 'view' ) );
$row['highlight_fields'] .= ' ';
}
@@ -459,7 +474,12 @@
$cf_highlight = $this->class->lib['custom_fields']->get_cf_highlight();
// Create our sql id list, this will be used when retrieving the custom field entries.
- $cf_ids = "'". implode( "','", array_keys($cf_highlight) ) . "'";
+ $cf_ids = "'";
+ foreach ( $cf_highlight as $cf_num => $cf_row )
+ {
+ $cf_ids .= $cf_row['field_id']. "','";
+ }
+ $cf_ids = substr($cf_ids, 0, -2);
// What's the count? Default to 10
$limit = $this->class->registry_config['tmpl_mostmodded_limit'] ? $this->class->registry_config['tmpl_mostmodded_limit'] : 10;
@@ -481,9 +501,9 @@
// Process the highlight field values
$row['highlight_fields'] = '';
- foreach ( $cf_highlight as $cf_id => $cf_row )
+ foreach ( $cf_highlight as $cf_num => $cf_row )
{
- $row['highlight_fields'] .= $this->class->lib['custom_fields']->process_cf_value( array( 'def' => $cf_row, 'value' => $cf_entries[$cf_id]['field_value'], 'type' => 'view' ) );
+ $row['highlight_fields'] .= $this->class->lib['custom_fields']->process_cf_value( array( 'def' => $cf_row, 'value' => $cf_entries[ $cf_row['field_id'] ]['field_value'], 'type' => 'view' ) );
$row['highlight_fields'] .= ' ';
}
@@ -520,7 +540,12 @@
$cf_highlight = $this->class->lib['custom_fields']->get_cf_highlight();
// Create our sql id list, this will be used when retrieving the custom field entries.
- $cf_ids = "'". implode( "','", array_keys($cf_highlight) ) . "'";
+ $cf_ids = "'";
+ foreach ( $cf_highlight as $cf_num => $cf_row )
+ {
+ $cf_ids .= $cf_row['field_id']. "','";
+ }
+ $cf_ids = substr($cf_ids, 0, -2);
// What's the count? Default to 10
$limit = $this->class->registry_config['tmpl_mostmoneyspent_limit'] ? $this->class->registry_config['tmpl_mostmoneyspent_limit'] : 10;
@@ -542,9 +567,9 @@
// Process the highlight field values
$row['highlight_fields'] = '';
- foreach ( $cf_highlight as $cf_id => $cf_row )
+ foreach ( $cf_highlight as $cf_num => $cf_row )
{
- $row['highlight_fields'] .= $this->class->lib['custom_fields']->process_cf_value( array( 'def' => $cf_row, 'value' => $cf_entries[$cf_id]['field_value'], 'type' => 'view' ) );
+ $row['highlight_fields'] .= $this->class->lib['custom_fields']->process_cf_value( array( 'def' => $cf_row, 'value' => $cf_entries[ $cf_row['field_id'] ]['field_value'], 'type' => 'view' ) );
$row['highlight_fields'] .= ' ';
}
@@ -583,7 +608,12 @@
$cf_highlight = $this->class->lib['custom_fields']->get_cf_highlight();
// Create our sql id list, this will be used when retrieving the custom field entries.
- $cf_ids = "'". implode( "','", array_keys($cf_highlight) ) . "'";
+ $cf_ids = "'";
+ foreach ( $cf_highlight as $cf_num => $cf_row )
+ {
+ $cf_ids .= $cf_row['field_id']. "','";
+ }
+ $cf_ids = substr($cf_ids, 0, -2);
// What's the count? Default to 10
$limit = $this->class->registry_config['tmpl_mostviewed_limit'] ? $this->class->registry_config['tmpl_mostviewed_limit'] : 10;
@@ -603,9 +633,9 @@
// Process the highlight field values
$row['highlight_fields'] = '';
- foreach ( $cf_highlight as $cf_id => $cf_row )
+ foreach ( $cf_highlight as $cf_num => $cf_row )
{
- $row['highlight_fields'] .= $this->class->lib['custom_fields']->process_cf_value( array( 'def' => $cf_row, 'value' => $cf_entries[$cf_id]['field_value'], 'type' => 'view' ) );
+ $row['highlight_fields'] .= $this->class->lib['custom_fields']->process_cf_value( array( 'def' => $cf_row, 'value' => $cf_entries[ $cf_row['field_id'] ]['field_value'], 'type' => 'view' ) );
$row['highlight_fields'] .= ' ';
}
@@ -641,7 +671,12 @@
$cf_highlight = $this->class->lib['custom_fields']->get_cf_highlight();
// Create our sql id list, this will be used when retrieving the custom field entries.
- $cf_ids = "'". implode( "','", array_keys($cf_highlight) ) . "'";
+ $cf_ids = "'";
+ foreach ( $cf_highlight as $cf_num => $cf_row )
+ {
+ $cf_ids .= $cf_row['field_id']. "','";
+ }
+ $cf_ids = substr($cf_ids, 0, -2);
// What's the count? Default to 10
$limit = $this->class->registry_config['tmpl_newestitems_limit'] ? $this->class->registry_config['tmpl_newestitems_limit'] : 10;
@@ -661,9 +696,9 @@
// Process the highlight field values
$row['highlight_fields'] = '';
- foreach ( $cf_highlight as $cf_id => $cf_row )
+ foreach ( $cf_highlight as $cf_num => $cf_row )
{
- $row['highlight_fields'] .= $this->class->lib['custom_fields']->process_cf_value( array( 'def' => $cf_row, 'value' => $cf_entries[$cf_id]['field_value'], 'type' => 'view' ) );
+ $row['highlight_fields'] .= $this->class->lib['custom_fields']->process_cf_value( array( 'def' => $cf_row, 'value' => $cf_entries[ $cf_row['field_id'] ]['field_value'], 'type' => 'view' ) );
$row['highlight_fields'] .= ' ';
}
Modified: branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/custom_fields.php
===================================================================
--- branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/custom_fields.php 2008-02-15 00:15:56 UTC (rev 44)
+++ branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/custom_fields.php 2008-02-16 20:58:37 UTC (rev 45)
@@ -146,7 +146,7 @@
* @param array $opts Optional custom cmd/value pair attributes
* @return array An array of an array, outer key is field_id
*/
- function get_cf_defs($opts=array(), $live=0)
+ function get_cf_defs($opts=array())
{
$results = $this->ipsclass->cache['registry_field_defs'];
@@ -192,7 +192,7 @@
* @param array $opts Optional custom SQL cmd/value pair attributes
* @return array An array of an array, outer key is field_id
*/
- function get_cf_defs_live($opts=array(), $live=0)
+ function get_cf_defs_live($opts=array())
{
$query = "SELECT field_id, field_name, field_type, field_options,
field_default, field_required, field_size, field_rows,
@@ -328,7 +328,7 @@
if ( is_array($this->ipsclass->cache['registry_field_defs']) )
{
- foreach ($this->ipsclass->cache['registry_field_defs'] as $field_id => $field_row)
+ foreach ($this->ipsclass->cache['registry_field_defs'] as $field_num => $field_row)
{
if ( $field_row['field_highlight'] == 1 )
{
@@ -344,7 +344,7 @@
if ( count($this->_cf_highlight) < 1 )
{
$field_id = end(array_slice(array_keys($this->ipsclass->cache['registry_field_defs']), 0, 1));
- $this->_cf_highlight[$field_id] = $this->ipsclass->cache['registry_field_defs'][$field_id];
+ $this->_cf_highlight[ $field_row['field_id'] ] = $this->ipsclass->cache['registry_field_defs'][ $field_row['field_id'] ];
}
return $this->_cf_highlight;
@@ -728,7 +728,7 @@
if ( is_array($opts['cf_defs']) )
{
- foreach ( $opts['cf_defs'] as $cf_id => $cf_row )
+ foreach ( $opts['cf_defs'] as $cf_num => $cf_row )
{
if ( $cf_row['field_type'] == 'S' )
{
@@ -953,16 +953,16 @@
return $cf_input;
}
- foreach ( $cf_defs as $cf_id => $cf_row )
+ foreach ( $cf_defs as $cf_rum => $cf_row )
{
// This 'if' will fail for make & model, we need to special
// case them afterwards!
- if ( !empty( $this->ipsclass->input[$cf_id] ) )
+ if ( !empty( $this->ipsclass->input[ $cf_row['field_id'] ] ) )
{
if ( preg_match('/^(T|M)$/', $cf_row['field_type']) )
{
// Single line text, or Textarea
- $cf_input[$cf_id] = $this->class->lib['parser']->pre_db_parse( $this->ipsclass->input[$cf_id] );
+ $cf_input[ $cf_row['field_id'] ] = $this->class->lib['parser']->pre_db_parse( $this->ipsclass->input[ $cf_row['field_id'] ] );
}
elseif ( preg_match('/^(R|L)$/', $cf_row['field_type']) )
{
@@ -970,16 +970,16 @@
$valid_options = $this->explode_assoc('|', $cf_row['field_options']);
// Only configured values are valid!
- $cf_input[$cf_id] = ( in_array( $this->ipsclass->input[$cf_id], array_keys($valid_options) ) )
- ? htmlspecialchars( $this->ipsclass->input[$cf_id] )
- : '';
+ $cf_input[ $cf_row['field_id'] ] = ( in_array( $this->ipsclass->input[ $cf_row['field_id'] ], array_keys($valid_options) ) )
+ ? htmlspecialchars( $this->ipsclass->input[ $cf_row['field_id'] ] )
+ : '';
}
elseif ( $cf_row['field_type'] == 'F' )
{
// Money (floating point), make sure comma and dollar signs don't cause problems
- $this->ipsclass->input[$cf_id] = preg_replace('/(\,|$)/', '', $this->ipsclass->input[$cf_id]);
+ $this->ipsclass->input[ $cf_row['field_id'] ] = preg_replace('/(\,|$)/', '', $this->ipsclass->input[ $cf_row['field_id'] ]);
- $cf_input[$cf_id] = floatval( $this->ipsclass->input[$cf_id] );
+ $cf_input[ $cf_row['field_id'] ] = floatval( $this->ipsclass->input[ $cf_row['field_id'] ] );
}
elseif ( $cf_row['field_type'] == 'C' )
{
@@ -989,7 +989,7 @@
// We need to loop through and only allow valid options through
$options = array();
- foreach ( $this->ipsclass->input[$cf_id] as $cf_value )
+ foreach ( $this->ipsclass->input[ $cf_row['field_id'] ] as $cf_value )
{
$cf_value = htmlspecialchars( $cf_value );
@@ -1001,7 +1001,7 @@
}
// We are returning a serialized data structure to store to the DB
- $cf_input[$cf_id] = serialize($options);
+ $cf_input[ $cf_row['field_id'] ] = serialize($options);
}
elseif ( $cf_row['field_type'] == 'S' )
{
@@ -1010,9 +1010,9 @@
if ( $cf_row['field_options'] == 'year' )
{
// Validate year format
- if ( preg_match('/^\d{4}$/', $this->ipsclass->input[$cf_id]) )
+ if ( preg_match('/^\d{4}$/', $this->ipsclass->input[ $cf_row['field_id'] ]) )
{
- $cf_input[$cf_id] = htmlspecialchars( $this->ipsclass->input[$cf_id] );
+ $cf_input[ $cf_row['field_id'] ] = htmlspecialchars( $this->ipsclass->input[ $cf_row['field_id'] ] );
}
}
}
@@ -1024,7 +1024,7 @@
if ( !empty( $this->ipsclass->input[$cf_row['field_options']] ) )
{
// Type cast integer
- $cf_input[$cf_id] = intval( $this->ipsclass->input[$cf_row['field_options']] );
+ $cf_input[ $cf_row['field_id'] ] = intval( $this->ipsclass->input[$cf_row['field_options']] );
}
}
elseif ( $cf_row['field_type'] == 'C' )
@@ -1032,7 +1032,7 @@
// This elseif will catch any defined checkbox fields which did not
// have any selected values. In this case the field is not returned
// in the query string by the browser.
- $cf_input[$cf_id] = '';
+ $cf_input[ $cf_row['field_id'] ] = '';
}
}
Modified: branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/functions.php
===================================================================
--- branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/functions.php 2008-02-15 00:15:56 UTC (rev 44)
+++ branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/lib/functions.php 2008-02-16 20:58:37 UTC (rev 45)
@@ -249,7 +249,12 @@
$cf_highlight = $this->class->lib['custom_fields']->get_cf_highlight();
// Create our sql id list, this will be used when retrieving the custom field entries.
- $cf_ids = "'". implode( "','", array_keys($cf_highlight) ) . "'";
+ $cf_ids = "'";
+ foreach ( $cf_highlight as $cf_num => $cf_row )
+ {
+ $cf_ids .= $cf_row['field_id']. "','";
+ }
+ $cf_ids = substr($cf_ids, 0, -2);
// Get data
$query = $this->ipsclass->DB->query( "SELECT g.id, g.member_id, g.date_updated, m.members_display_name
@@ -266,9 +271,9 @@
// Process the highlight field values
$row['highlight_fields'] = '';
- foreach ( $cf_highlight as $cf_id => $cf_row )
+ foreach ( $cf_highlight as $cf_num => $cf_row )
{
- $row['highlight_fields'] .= $this->class->lib['custom_fields']->process_cf_value( array( 'def' => $cf_row, 'value' => $cf_entries[$cf_id]['field_value'], 'type' => 'view' ) );
+ $row['highlight_fields'] .= $this->class->lib['custom_fields']->process_cf_value( array( 'def' => $cf_row, 'value' => $cf_entries[ $cf_row['field_id'] ]['field_value'], 'type' => 'view' ) );
$row['highlight_fields'] .= ' ';
}
@@ -296,7 +301,12 @@
$cf_highlight = $this->class->lib['custom_fields']->get_cf_highlight();
// Create our sql id list, this will be used when retrieving the custom field entries.
- $cf_ids = "'". implode( "','", array_keys($cf_highlight) ) . "'";
+ $cf_ids = "'";
+ foreach ( $cf_highlight as $cf_num => $cf_row )
+ {
+ $cf_ids .= $cf_row['field_id']. "','";
+ }
+ $cf_ids = substr($cf_ids, 0, -2);
$show_add = 0;
@@ -325,9 +335,9 @@
// Process the highlight field values
$row['highlight_fields'] = '';
- foreach ( $cf_highlight as $cf_id => $cf_row )
+ foreach ( $cf_highlight as $cf_num => $cf_row )
{
- $row['highlight_fields'] .= $this->class->lib['custom_fields']->process_cf_value( array( 'def' => $cf_row, 'value' => $cf_entries[$cf_id]['field_value'], 'type' => 'view' ) );
+ $row['highlight_fields'] .= $this->class->lib['custom_fields']->process_cf_value( array( 'def' => $cf_row, 'value' => $cf_entries[ $cf_row['field_id'] ]['field_value'], 'type' => 'view' ) );
$row['highlight_fields'] .= ' ';
}
Modified: branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/main.php
===================================================================
--- branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/main.php 2008-02-15 00:15:56 UTC (rev 44)
+++ branches/stable_3_0_x/upload/sources/components_public/fusionscripts/fusionregistry/main.php 2008-02-16 20:58:37 UTC (rev 45)
@@ -290,9 +290,13 @@
if ( is_array($cf_defs) )
{
// Create our sql id list, this will be used when retrieving the custom field entries
- $cf_ids = "'". implode( "','", array_keys($cf_defs) ) . "'";
+ $cf_ids = "'";
+ foreach ( $cf_defs as $cf_num => $cf_row )
+ {
+ $cf_ids .= $cf_row['field_id'] ."','";
+ }
+ $cf_ids = substr($cf_ids, 0, -2);
-
// Build our <th>'s for the custom fields
$data['custom_field_th'] = '';
@@ -303,7 +307,7 @@
$cf_width .= '%';
// Loop through each one and add the <th> html to the output
- foreach ( $cf_defs as $cf_id => $cf_row )
+ foreach ( $cf_defs as $cf_num => $cf_row )
{
$cf_data['field_name'] = $cf_row['field_name'];
$cf_data['field_width'] = $cf_width;
@@ -340,7 +344,7 @@
// Build our <td>'s for the custom fields
$row['custom_fields'] = '';
- foreach ( $cf_defs as $cf_id => $cf_row )
+ foreach ( $cf_defs as $cf_num => $cf_row )
{
// Which css class should we be? This isn't perfect, but will have to do.
$cf_data['field_class'] = $total_cars_printed % 2 ? 'row2' : 'row1';
@@ -348,7 +352,7 @@
$cf_data['item_id'] = $row['id'];
$cf_data['field_value'] = $this->lib['custom_fields']->process_cf_value( array( 'def' => $cf_row,
- 'value' => $cf_entries[$cf_id]['field_value'],
+ 'value' => $cf_entries[ $cf_row['field_id'] ]['field_value'],
'type' => 'view',
) );
@@ -516,17 +520,17 @@
$where_sql = ' WHERE ';
- foreach ( $cf_defs as $cf_id => $cf_row )
+ foreach ( $cf_defs as $cf_num => $cf_row )
{
// Did they enter a keyword for this field, and did they choose this field?
- if ( !empty($cf_input[$cf_id]) AND $this->ipsclass->input['search_' . $cf_id] == 1 )
+ if ( !empty($cf_input[ $cf_row['field_id'] ]) AND $this->ipsclass->input['search_' . $cf_row['field_id']] == 1 )
{
- $where_sql .= " ( field_id = '$cf_id' AND field_value LIKE '%$cf_input[$cf_id]%' ) OR ";
+ $where_sql .= " ( field_id = '". $cf_row['field_id'] ."' AND field_value LIKE '%". $cf_input[ $cf_row['field_id'] ] ."%' ) OR ";
// This will be used later in our 'AND' logic
if ( $this->ipsclass->input['search_logic'] == 'AND' )
{
- array_push( $searched_fields, $cf_id );
+ array_push( $searched_fields, $cf_row['field_id'] );
}
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|