|
From: Jon O. <jon...@us...> - 2006-06-17 20:12:04
|
Update of /cvsroot/mxbb/mx_linkdb/linkdb/includes In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv21784/modules/mx_linkdb/linkdb/includes Modified Files: functions_linkdb_field.php linkdb_constants.php Log Message: Syncronizing...and code cleanup Index: functions_linkdb_field.php =================================================================== RCS file: /cvsroot/mxbb/mx_linkdb/linkdb/includes/functions_linkdb_field.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** functions_linkdb_field.php 5 Apr 2006 22:35:24 -0000 1.4 --- functions_linkdb_field.php 17 Jun 2006 20:12:00 -0000 1.5 *************** *** 8,24 **** * */ ! class custom_field { var $field_rowset = array(); ! var $field_data_rowset = array(); ! // prepare data ! function init() { global $db; ! $sql = "SELECT * FROM " . LINK_CUSTOM_TABLE . " ORDER BY field_order ASC"; --- 8,29 ---- * */ ! ! if ( !defined( 'IN_PORTAL' ) ) ! { ! die( "Hacking attempt" ); ! } ! class custom_field { var $field_rowset = array(); ! var $field_data_rowset = array(); ! // prepare data ! function init() { global $db; ! $sql = "SELECT * FROM " . LINK_CUSTOM_TABLE . " ORDER BY field_order ASC"; *************** *** 36,40 **** $db->sql_freeresult( $result ); ! $sql = "SELECT * FROM " . LINK_CUSTOM_DATA_TABLE; --- 41,45 ---- $db->sql_freeresult( $result ); ! $sql = "SELECT * FROM " . LINK_CUSTOM_DATA_TABLE; *************** *** 52,59 **** $db->sql_freeresult( $result ); ! } ! // check if there is a data in the database ! function field_data_exist() { --- 57,64 ---- $db->sql_freeresult( $result ); ! } ! // check if there is a data in the database ! function field_data_exist() { *************** *** 72,79 **** } return false; ! } ! // display data in the file page ! function display_data( $file_id ) { --- 77,84 ---- } return false; ! } ! // display data in the file page ! function display_data( $file_id ) { *************** *** 102,106 **** $template->assign_block_vars( 'custom_field', array( 'CUSTOM_NAME' => $this->field_rowset[$field_id]['custom_name'], ! 'DATA' => $field_data ) ); } --- 107,111 ---- $template->assign_block_vars( 'custom_field', array( 'CUSTOM_NAME' => $this->field_rowset[$field_id]['custom_name'], ! 'DATA' => $field_data ) ); } *************** *** 109,114 **** global $db; ! $sql = "DELETE FROM " . LINK_CUSTOM_DATA_TABLE . " ! WHERE customdata_file = '$file_id' AND customdata_custom = '$field_id'"; --- 114,119 ---- global $db; ! $sql = "DELETE FROM " . LINK_CUSTOM_DATA_TABLE . " ! WHERE customdata_file = '$file_id' AND customdata_custom = '$field_id'"; *************** *** 129,136 **** return false; } ! } ! // display custom field and data in the add/edit page ! function display_edit( $file_id = false ) { --- 134,141 ---- return false; } ! } ! // display custom field and data in the add/edit page ! function display_edit( $file_id = false ) { *************** *** 174,178 **** 'FIELD_ID' => $field_data['custom_id'], 'FIELD_DESCRIPTION' => $field_data['custom_description'], ! 'FIELD_VALUE' => ( !empty( $this->field_data_rowset[$file_id][$field_id]['data'] ) ) ? $this->field_data_rowset[$file_id][$field_id]['data'] : '' ) ); } --- 179,183 ---- 'FIELD_ID' => $field_data['custom_id'], 'FIELD_DESCRIPTION' => $field_data['custom_description'], ! 'FIELD_VALUE' => ( !empty( $this->field_data_rowset[$file_id][$field_id]['data'] ) ) ? $this->field_data_rowset[$file_id][$field_id]['data'] : '' ) ); } *************** *** 184,188 **** 'FIELD_ID' => $field_data['custom_id'], 'FIELD_DESCRIPTION' => $field_data['custom_description'], ! 'FIELD_VALUE' => ( !empty( $this->field_data_rowset[$file_id][$field_id]['data'] ) ) ? $this->field_data_rowset[$file_id][$field_id]['data'] : '' ) ); } --- 189,193 ---- 'FIELD_ID' => $field_data['custom_id'], 'FIELD_DESCRIPTION' => $field_data['custom_description'], ! 'FIELD_VALUE' => ( !empty( $this->field_data_rowset[$file_id][$field_id]['data'] ) ) ? $this->field_data_rowset[$file_id][$field_id]['data'] : '' ) ); } *************** *** 193,197 **** $template->assign_block_vars( 'radio', array( 'FIELD_NAME' => $field_data['custom_name'], 'FIELD_ID' => $field_data['custom_id'], ! 'FIELD_DESCRIPTION' => $field_data['custom_description'] ) ); --- 198,202 ---- $template->assign_block_vars( 'radio', array( 'FIELD_NAME' => $field_data['custom_name'], 'FIELD_ID' => $field_data['custom_id'], ! 'FIELD_DESCRIPTION' => $field_data['custom_description'] ) ); *************** *** 204,208 **** { $template->assign_block_vars( 'radio.row', array( 'FIELD_VALUE' => $value, ! 'FIELD_SELECTED' => ( $data == $value ) ? ' checked="checked"' : '' ) ); } --- 209,213 ---- { $template->assign_block_vars( 'radio.row', array( 'FIELD_VALUE' => $value, ! 'FIELD_SELECTED' => ( $data == $value ) ? ' checked="checked"' : '' ) ); } *************** *** 215,219 **** $template->assign_block_vars( 'select', array( 'FIELD_NAME' => $field_data['custom_name'], 'FIELD_ID' => $field_data['custom_id'], ! 'FIELD_DESCRIPTION' => $field_data['custom_description'] ) ); --- 220,224 ---- $template->assign_block_vars( 'select', array( 'FIELD_NAME' => $field_data['custom_name'], 'FIELD_ID' => $field_data['custom_id'], ! 'FIELD_DESCRIPTION' => $field_data['custom_description'] ) ); *************** *** 226,230 **** { $template->assign_block_vars( 'select.row', array( 'FIELD_VALUE' => $value, ! 'FIELD_SELECTED' => ( $data == $value ) ? ' selected="selected"' : '' ) ); } --- 231,235 ---- { $template->assign_block_vars( 'select.row', array( 'FIELD_VALUE' => $value, ! 'FIELD_SELECTED' => ( $data == $value ) ? ' selected="selected"' : '' ) ); } *************** *** 237,241 **** $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'] ) ); --- 242,246 ---- $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'] ) ); *************** *** 257,261 **** } $template->assign_block_vars( 'select_multiple.row', array( 'FIELD_VALUE' => $value, ! 'FIELD_SELECTED' => $selected ) ); } --- 262,266 ---- } $template->assign_block_vars( 'select_multiple.row', array( 'FIELD_VALUE' => $value, ! 'FIELD_SELECTED' => $selected ) ); } *************** *** 268,272 **** $template->assign_block_vars( 'checkbox', array( 'FIELD_NAME' => $field_data['custom_name'], 'FIELD_ID' => $field_data['custom_id'], ! 'FIELD_DESCRIPTION' => $field_data['custom_description'] ) ); --- 273,277 ---- $template->assign_block_vars( 'checkbox', array( 'FIELD_NAME' => $field_data['custom_name'], 'FIELD_ID' => $field_data['custom_id'], ! 'FIELD_DESCRIPTION' => $field_data['custom_description'] ) ); *************** *** 288,292 **** } $template->assign_block_vars( 'checkbox.row', array( 'FIELD_VALUE' => $value, ! 'FIELD_CHECKED' => $checked ) ); } --- 293,297 ---- } $template->assign_block_vars( 'checkbox.row', array( 'FIELD_VALUE' => $value, ! 'FIELD_CHECKED' => $checked ) ); } *************** *** 342,346 **** $field_id = $db->sql_nextid(); ! $sql = "UPDATE " . LINK_CUSTOM_TABLE . " SET field_order = '$field_id' WHERE custom_id = $field_id"; --- 347,351 ---- $field_id = $db->sql_nextid(); ! $sql = "UPDATE " . LINK_CUSTOM_TABLE . " SET field_order = '$field_id' WHERE custom_id = $field_id"; *************** *** 353,357 **** else { ! $sql = "UPDATE " . LINK_CUSTOM_TABLE . " SET custom_name = '$field_name', custom_description = '$field_desc', data = '$data', regex = '$regex', field_order='$field_order' WHERE custom_id = $field_id"; --- 358,362 ---- else { ! $sql = "UPDATE " . LINK_CUSTOM_TABLE . " SET custom_name = '$field_name', custom_description = '$field_desc', data = '$data', regex = '$regex', field_order='$field_order' WHERE custom_id = $field_id"; *************** *** 376,380 **** } ! $sql = "DELETE FROM " . LINK_CUSTOM_TABLE . " WHERE custom_id = '$field_id'"; --- 381,385 ---- } ! $sql = "DELETE FROM " . LINK_CUSTOM_TABLE . " WHERE custom_id = '$field_id'"; *************** *** 390,397 **** $return_array['data'] = implode( "\n", unserialize( stripslashes( $return_array['data'] ) ) ); return $return_array; ! } ! // file data in custom field operations ! function file_update_data( $file_id ) { --- 395,402 ---- $return_array['data'] = implode( "\n", unserialize( stripslashes( $return_array['data'] ) ) ); return $return_array; ! } ! // file data in custom field operations ! function file_update_data( $file_id ) { *************** *** 424,429 **** } ! $sql = "DELETE FROM " . LINK_CUSTOM_DATA_TABLE . " ! WHERE customdata_file = '$file_id' AND customdata_custom = '$field_id'"; --- 429,434 ---- } ! $sql = "DELETE FROM " . LINK_CUSTOM_DATA_TABLE . " ! WHERE customdata_file = '$file_id' AND customdata_custom = '$field_id'"; *************** *** 435,439 **** if ( !empty( $data ) ) { ! $sql = "INSERT INTO " . LINK_CUSTOM_DATA_TABLE . " (customdata_file, customdata_custom, data) VALUES('$file_id', '$field_id', '$data')"; --- 440,444 ---- if ( !empty( $data ) ) { ! $sql = "INSERT INTO " . LINK_CUSTOM_DATA_TABLE . " (customdata_file, customdata_custom, data) VALUES('$file_id', '$field_id', '$data')"; Index: linkdb_constants.php =================================================================== RCS file: /cvsroot/mxbb/mx_linkdb/linkdb/includes/linkdb_constants.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** linkdb_constants.php 5 Apr 2006 22:35:24 -0000 1.6 --- linkdb_constants.php 17 Jun 2006 20:12:00 -0000 1.7 *************** *** 9,12 **** --- 9,17 ---- */ + if ( !defined( 'IN_PORTAL' ) ) + { + die( "Hacking attempt" ); + } + define( 'LINKDB_ROOT_CAT', 0 ); *************** *** 37,41 **** // ------------------------------------------------------------------------- $mx_user->extend(); ! $mx_page->add_copyright( 'mxBB LinkDb Module' ); } --- 42,46 ---- // ------------------------------------------------------------------------- $mx_user->extend(); ! $mx_page->add_copyright( 'mxBB LinkDb Module' ); } |