|
From: Jon O. <jon...@us...> - 2006-08-01 20:48:44
|
Update of /cvsroot/mxbb/mx_kb/kb/includes In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv17041/modules/mx_kb/kb/includes Modified Files: functions_cache.php functions_field.php Log Message: before removing Index: functions_cache.php =================================================================== RCS file: /cvsroot/mxbb/mx_kb/kb/includes/functions_cache.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** functions_cache.php 7 Jun 2006 20:28:54 -0000 1.3 --- functions_cache.php 1 Aug 2006 20:48:36 -0000 1.4 *************** *** 15,19 **** /** ! * Enter description here... * */ --- 15,19 ---- /** ! * Generic module cache. * */ *************** *** 29,37 **** * @return mx_kb_cache */ ! function mx_kb_cache() { global $phpbb_root_path; global $mx_root_path, $module_root_path, $is_block, $phpEx; ! $this->cache_dir = $module_root_path . 'kb/cache/'; } --- 29,43 ---- * @return mx_kb_cache */ ! function mx_kb_cache($dir=false) { global $phpbb_root_path; global $mx_root_path, $module_root_path, $is_block, $phpEx; ! ! if (!$dir) ! { ! mx_message_die(GENERAL_ERROR, 'The module cache need a init dir.'); ! } ! ! $this->cache_dir = $dir . 'cache/'; } Index: functions_field.php =================================================================== RCS file: /cvsroot/mxbb/mx_kb/kb/includes/functions_field.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** functions_field.php 7 Jun 2006 20:28:54 -0000 1.3 --- functions_field.php 1 Aug 2006 20:48:36 -0000 1.4 *************** *** 15,19 **** /** ! * Enter description here... * */ --- 15,19 ---- /** ! * This is a generic class for custom fields. * */ *************** *** 23,28 **** var $field_data_rowset = array(); /** ! * Enter description here... * */ --- 23,31 ---- var $field_data_rowset = array(); + var $custom_table = KB_CUSTOM_TABLE; + var $custom_data_table = KB_CUSTOM_DATA_TABLE; + /** ! * prepare data * */ *************** *** 32,36 **** $sql = "SELECT * ! FROM " . KB_CUSTOM_TABLE . " ORDER BY field_order ASC"; --- 35,39 ---- $sql = "SELECT * ! FROM " . $this->custom_table . " ORDER BY field_order ASC"; *************** *** 48,52 **** $sql = "SELECT * ! FROM " . KB_CUSTOM_DATA_TABLE; if ( !( $result = $db->sql_query( $sql ) ) ) --- 51,55 ---- $sql = "SELECT * ! FROM " . $this->custom_data_table; if ( !( $result = $db->sql_query( $sql ) ) ) *************** *** 130,134 **** global $db; ! $sql = "DELETE FROM " . KB_CUSTOM_DATA_TABLE . " WHERE customdata_file = '$file_id' AND customdata_custom = '$field_id'"; --- 133,137 ---- global $db; ! $sql = "DELETE FROM " . $this->custom_data_table . " WHERE customdata_file = '$file_id' AND customdata_custom = '$field_id'"; *************** *** 184,190 **** } ! $template->assign_block_vars( 'custom_field', array( 'CUSTOM_NAME' => $this->field_rowset[$field_id]['custom_name'], ! 'DATA' => $field_data ) ! ); } else --- 187,194 ---- } ! $template->assign_block_vars( 'custom_field', array( ! 'CUSTOM_NAME' => $this->field_rowset[$field_id]['custom_name'], ! 'DATA' => $field_data ) ! ); } else *************** *** 192,196 **** global $db; ! $sql = "DELETE FROM " . KB_CUSTOM_DATA_TABLE . " WHERE customdata_file = '$file_id' AND customdata_custom = '$field_id'"; --- 196,200 ---- global $db; ! $sql = "DELETE FROM " . $this->custom_data_table . " WHERE customdata_file = '$file_id' AND customdata_custom = '$field_id'"; *************** *** 222,227 **** function display_edit( $file_id = false ) { - global $template; - $return = false; if ( $this->field_exist() ) --- 226,229 ---- *************** *** 266,277 **** function display_edit_input( $file_id, $field_id, $field_data ) { ! global $template, $_POST; $field_value_temp = (!empty( $this->field_data_rowset[$file_id][$field_id]['data'] )) ? $this->field_data_rowset[$file_id][$field_id]['data'] : ''; $field_value = !empty( $_POST['field'][$field_data['custom_id']] ) ? $_POST['field'][$field_data['custom_id']] : $field_value_temp ; ! $template->assign_block_vars( 'input', array( 'FIELD_NAME' => $field_data['custom_name'], ! 'FIELD_ID' => $field_data['custom_id'], ! 'FIELD_DESCRIPTION' => $field_data['custom_description'], ! 'FIELD_VALUE' => $field_value ) ! ); } --- 268,280 ---- function display_edit_input( $file_id, $field_id, $field_data ) { ! global $template; $field_value_temp = (!empty( $this->field_data_rowset[$file_id][$field_id]['data'] )) ? $this->field_data_rowset[$file_id][$field_id]['data'] : ''; $field_value = !empty( $_POST['field'][$field_data['custom_id']] ) ? $_POST['field'][$field_data['custom_id']] : $field_value_temp ; ! $template->assign_block_vars( 'input', array( ! 'FIELD_NAME' => $field_data['custom_name'], ! 'FIELD_ID' => $field_data['custom_id'], ! 'FIELD_DESCRIPTION' => $field_data['custom_description'], ! 'FIELD_VALUE' => $field_value ) ! ); } *************** *** 288,296 **** $field_value_temp = ( !empty( $this->field_data_rowset[$file_id][$field_id]['data'] ) ) ? $this->field_data_rowset[$file_id][$field_id]['data'] : ''; $field_value = !empty( $_POST['field'][$field_data['custom_id']] ) ? $_POST['field'][$field_data['custom_id']] : $field_value_temp ; ! $template->assign_block_vars( 'textarea', array( 'FIELD_NAME' => $field_data['custom_name'], ! 'FIELD_ID' => $field_data['custom_id'], ! 'FIELD_DESCRIPTION' => $field_data['custom_description'], ! 'FIELD_VALUE' => $field_value ) ! ); } --- 291,300 ---- $field_value_temp = ( !empty( $this->field_data_rowset[$file_id][$field_id]['data'] ) ) ? $this->field_data_rowset[$file_id][$field_id]['data'] : ''; $field_value = !empty( $_POST['field'][$field_data['custom_id']] ) ? $_POST['field'][$field_data['custom_id']] : $field_value_temp ; ! $template->assign_block_vars( 'textarea', array( ! 'FIELD_NAME' => $field_data['custom_name'], ! 'FIELD_ID' => $field_data['custom_id'], ! 'FIELD_DESCRIPTION' => $field_data['custom_description'], ! 'FIELD_VALUE' => $field_value ) ! ); } *************** *** 305,312 **** { global $template; ! $template->assign_block_vars( 'radio', array( 'FIELD_NAME' => $field_data['custom_name'], ! 'FIELD_ID' => $field_data['custom_id'], ! 'FIELD_DESCRIPTION' => $field_data['custom_description'] ) ! ); $data_temp = ( !empty( $this->field_data_rowset[$file_id][$field_id]['data'] ) ) ? $this->field_data_rowset[$file_id][$field_id]['data'] : array(); --- 309,317 ---- { global $template; ! $template->assign_block_vars( 'radio', array( ! 'FIELD_NAME' => $field_data['custom_name'], ! 'FIELD_ID' => $field_data['custom_id'], ! 'FIELD_DESCRIPTION' => $field_data['custom_description'] ) ! ); $data_temp = ( !empty( $this->field_data_rowset[$file_id][$field_id]['data'] ) ) ? $this->field_data_rowset[$file_id][$field_id]['data'] : array(); *************** *** 318,324 **** foreach( $field_datas as $key => $value ) { ! $template->assign_block_vars( 'radio.row', array( 'FIELD_VALUE' => $value, ! 'FIELD_SELECTED' => ( $data == $value ) ? ' checked="checked"' : '' ) ! ); } } --- 323,330 ---- foreach( $field_datas as $key => $value ) { ! $template->assign_block_vars( 'radio.row', array( ! 'FIELD_VALUE' => $value, ! 'FIELD_SELECTED' => ( $data == $value ) ? ' checked="checked"' : '' ) ! ); } } *************** *** 335,342 **** { global $template; ! $template->assign_block_vars( 'select', array( 'FIELD_NAME' => $field_data['custom_name'], ! 'FIELD_ID' => $field_data['custom_id'], ! 'FIELD_DESCRIPTION' => $field_data['custom_description'] ) ! ); $data_temp = ( !empty( $this->field_data_rowset[$file_id][$field_id]['data'] ) ) ? $this->field_data_rowset[$file_id][$field_id]['data'] : ''; --- 341,349 ---- { global $template; ! $template->assign_block_vars( 'select', array( ! 'FIELD_NAME' => $field_data['custom_name'], ! 'FIELD_ID' => $field_data['custom_id'], ! 'FIELD_DESCRIPTION' => $field_data['custom_description'] ) ! ); $data_temp = ( !empty( $this->field_data_rowset[$file_id][$field_id]['data'] ) ) ? $this->field_data_rowset[$file_id][$field_id]['data'] : ''; *************** *** 348,354 **** foreach( $field_datas as $key => $value ) { ! $template->assign_block_vars( 'select.row', array( 'FIELD_VALUE' => $value, ! 'FIELD_SELECTED' => ( $data == $value ) ? ' selected="selected"' : '' ) ! ); } } --- 355,362 ---- foreach( $field_datas as $key => $value ) { ! $template->assign_block_vars( 'select.row', array( ! 'FIELD_VALUE' => $value, ! 'FIELD_SELECTED' => ( $data == $value ) ? ' selected="selected"' : '' ) ! ); } } *************** *** 365,372 **** { global $template; ! $template->assign_block_vars( 'select_multiple', array( 'FIELD_NAME' => $field_data['custom_name'], ! 'FIELD_ID' => $field_data['custom_id'], ! 'FIELD_DESCRIPTION' => $field_data['custom_description'] ) ! ); $data_temp = ( !empty( $this->field_data_rowset[$file_id][$field_id]['data'] ) ) ? unserialize( $this->field_data_rowset[$file_id][$field_id]['data'] ) : array(); --- 373,381 ---- { global $template; ! $template->assign_block_vars( 'select_multiple', array( ! 'FIELD_NAME' => $field_data['custom_name'], ! 'FIELD_ID' => $field_data['custom_id'], ! 'FIELD_DESCRIPTION' => $field_data['custom_description'] ) ! ); $data_temp = ( !empty( $this->field_data_rowset[$file_id][$field_id]['data'] ) ) ? unserialize( $this->field_data_rowset[$file_id][$field_id]['data'] ) : array(); *************** *** 387,393 **** } } ! $template->assign_block_vars( 'select_multiple.row', array( 'FIELD_VALUE' => $value, ! 'FIELD_SELECTED' => $selected ) ! ); } } --- 396,403 ---- } } ! $template->assign_block_vars( 'select_multiple.row', array( ! 'FIELD_VALUE' => $value, ! 'FIELD_SELECTED' => $selected ) ! ); } } *************** *** 404,411 **** { global $template; ! $template->assign_block_vars( 'checkbox', array( 'FIELD_NAME' => $field_data['custom_name'], ! 'FIELD_ID' => $field_data['custom_id'], ! 'FIELD_DESCRIPTION' => $field_data['custom_description'] ) ! ); $data_temp = ( !empty( $this->field_data_rowset[$file_id][$field_id]['data'] ) ) ? unserialize( $this->field_data_rowset[$file_id][$field_id]['data'] ) : array(); --- 414,422 ---- { global $template; ! $template->assign_block_vars( 'checkbox', array( ! 'FIELD_NAME' => $field_data['custom_name'], ! 'FIELD_ID' => $field_data['custom_id'], ! 'FIELD_DESCRIPTION' => $field_data['custom_description'] ) ! ); $data_temp = ( !empty( $this->field_data_rowset[$file_id][$field_id]['data'] ) ) ? unserialize( $this->field_data_rowset[$file_id][$field_id]['data'] ) : array(); *************** *** 426,432 **** } } ! $template->assign_block_vars( 'checkbox.row', array( 'FIELD_VALUE' => $value, ! 'FIELD_CHECKED' => $checked ) ! ); } } --- 437,444 ---- } } ! $template->assign_block_vars( 'checkbox.row', array( ! 'FIELD_VALUE' => $value, ! 'FIELD_CHECKED' => $checked ) ! ); } } *************** *** 477,481 **** if ( !$field_id ) { ! $sql = "INSERT INTO " . KB_CUSTOM_TABLE . " (custom_name, custom_description, data, regex, field_type) VALUES('" . $field_name . "', '" . $field_desc . "', '" . $data . "', '" . $regex . "', '" . $field_type . "')"; --- 489,493 ---- if ( !$field_id ) { ! $sql = "INSERT INTO " . $this->custom_table . " (custom_name, custom_description, data, regex, field_type) VALUES('" . $field_name . "', '" . $field_desc . "', '" . $data . "', '" . $regex . "', '" . $field_type . "')"; *************** *** 487,491 **** $field_id = $db->sql_nextid(); ! $sql = "UPDATE " . KB_CUSTOM_TABLE . " SET field_order = '$field_id' WHERE custom_id = $field_id"; --- 499,503 ---- $field_id = $db->sql_nextid(); ! $sql = "UPDATE " . $this->custom_table . " SET field_order = '$field_id' WHERE custom_id = $field_id"; *************** *** 498,502 **** else { ! $sql = "UPDATE " . KB_CUSTOM_TABLE . " SET custom_name = '$field_name', custom_description = '$field_desc', data = '$data', regex = '$regex', field_order='$field_order' WHERE custom_id = $field_id"; --- 510,514 ---- else { ! $sql = "UPDATE " . $this->custom_table . " SET custom_name = '$field_name', custom_description = '$field_desc', data = '$data', regex = '$regex', field_order='$field_order' WHERE custom_id = $field_id"; *************** *** 518,522 **** global $db; ! $sql = "DELETE FROM " . KB_CUSTOM_DATA_TABLE . " WHERE customdata_custom = '$field_id'"; --- 530,534 ---- global $db; ! $sql = "DELETE FROM " . $this->custom_data_table . " WHERE customdata_custom = '$field_id'"; *************** *** 526,530 **** } ! $sql = "DELETE FROM " . KB_CUSTOM_TABLE . " WHERE custom_id = '$field_id'"; --- 538,542 ---- } ! $sql = "DELETE FROM " . $this->custom_table . " WHERE custom_id = '$field_id'"; *************** *** 583,587 **** } ! $sql = "DELETE FROM " . KB_CUSTOM_DATA_TABLE . " WHERE customdata_file = '$file_id' AND customdata_custom = '$field_id'"; --- 595,599 ---- } ! $sql = "DELETE FROM " . $this->custom_data_table . " WHERE customdata_file = '$file_id' AND customdata_custom = '$field_id'"; *************** *** 594,598 **** if ( !empty( $data ) ) { ! $sql = "INSERT INTO " . KB_CUSTOM_DATA_TABLE . " (customdata_file, customdata_custom, data) VALUES('$file_id', '$field_id', '$data')"; --- 606,610 ---- if ( !empty( $data ) ) { ! $sql = "INSERT INTO " . $this->custom_data_table . " (customdata_file, customdata_custom, data) VALUES('$file_id', '$field_id', '$data')"; |