|
From: Jon O. <jon...@us...> - 2006-08-01 21:03:29
|
Update of /cvsroot/mxbb/mx_pafiledb/pafiledb/includes In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv23242/modules/mx_pafiledb/pafiledb/includes Modified Files: functions.php functions_admin.php functions_auth.php functions_cache.php functions_comment.php functions_field.php functions_pafiledb.php Log Message: massive update Index: functions.php =================================================================== RCS file: /cvsroot/mxbb/mx_pafiledb/pafiledb/includes/functions.php,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** functions.php 5 Jul 2006 22:50:22 -0000 1.27 --- functions.php 1 Aug 2006 21:03:24 -0000 1.28 *************** *** 92,96 **** * @param unknown_type $page_id */ ! function pa_generate_smilies( $mode, $page_id ) { global $db, $board_config, $pafiledb_template, $lang, $images, $theme, $phpEx, $phpbb_root_path; --- 92,96 ---- * @param unknown_type $page_id */ ! function generate_smilies( $mode, $page_id ) { global $db, $board_config, $pafiledb_template, $lang, $images, $theme, $phpEx, $phpbb_root_path; *************** *** 248,252 **** function page_header( $page_title ) { ! global $pafiledb_config, $lang, $pafiledb_template, $userdata, $images, $action, $_REQUEST, $pafiledb; global $template, $db, $theme, $gen_simple_header, $starttime, $phpEx, $board_config, $user_ip, $phpbb_root_path; global $admin_level, $level_prior, $tree, $do_gzip_compress; --- 248,252 ---- function page_header( $page_title ) { ! global $pafiledb_config, $lang, $pafiledb_template, $userdata, $images, $action, $pafiledb; global $template, $db, $theme, $gen_simple_header, $starttime, $phpEx, $board_config, $user_ip, $phpbb_root_path; global $admin_level, $level_prior, $tree, $do_gzip_compress; *************** *** 263,268 **** $mcp_url = append_sid( $pafiledb->this_mxurl( "action=mcp&cat_id={$_REQUEST['cat_id']}" ) ); ! $upload_auth = $pafiledb->modules[$pafiledb->module_name]->auth[$_REQUEST['cat_id']]['auth_upload']; ! $mcp_auth = $pafiledb->modules[$pafiledb->module_name]->auth[$_REQUEST['cat_id']]['auth_mod']; } else --- 263,268 ---- $mcp_url = append_sid( $pafiledb->this_mxurl( "action=mcp&cat_id={$_REQUEST['cat_id']}" ) ); ! $upload_auth = $pafiledb->modules[$pafiledb->module_name]->auth_user[$_REQUEST['cat_id']]['auth_upload']; ! $mcp_auth = $pafiledb->modules[$pafiledb->module_name]->auth_user[$_REQUEST['cat_id']]['auth_mod']; } else *************** *** 285,291 **** 'IS_AUTH_UPLOAD' => $upload_auth, 'IS_ADMIN' => ( $userdata['user_level'] == ADMIN && $userdata['session_logged_in'] ) ? true : 0, ! 'IS_MOD' => $pafiledb->modules[$pafiledb->module_name]->auth[$_REQUEST['cat_id']]['auth_mod'], 'IS_AUTH_MCP' => $mcp_auth, ! 'MCP_LINK' => $lang['pa_MCP'], 'U_MCP' => $mcp_url, --- 285,291 ---- 'IS_AUTH_UPLOAD' => $upload_auth, 'IS_ADMIN' => ( $userdata['user_level'] == ADMIN && $userdata['session_logged_in'] ) ? true : 0, ! 'IS_MOD' => $pafiledb->modules[$pafiledb->module_name]->auth_user[$_REQUEST['cat_id']]['auth_mod'], 'IS_AUTH_MCP' => $mcp_auth, ! 'MCP_LINK' => $lang['MCP_title'], 'U_MCP' => $mcp_url, *************** *** 516,520 **** // if the file size is more than the allowed size another error message // ======================================================= ! if ( $userfile_size > $pafiledb_config['max_file_size'] && ( $pafiledb->modules[$pafiledb->module_name]->auth[$cat_id]['auth_mod'] || $userdata['user_level'] != ADMIN ) && $userdata['session_logged_in'] ) { $file_info['error'] = true; --- 516,520 ---- // if the file size is more than the allowed size another error message // ======================================================= ! if ( $userfile_size > $pafiledb_config['max_file_size'] && ( $pafiledb->modules[$pafiledb->module_name]->auth_user[$cat_id]['auth_mod'] || $userdata['user_level'] != ADMIN ) && $userdata['session_logged_in'] ) { $file_info['error'] = true; *************** *** 914,919 **** } - include_once( $mx_root_path . 'includes/mx_functions_tools.' . $phpEx ); - /** * mx_pa_notification. --- 914,917 ---- *************** *** 1045,1049 **** $this->data['item_editor'] = ( $userdata['user_id'] != '-1' ) ? $userdata['username'] : $lang['Guest']; ! $this->temp_url = PORTAL_URL . $pafiledb->this_mxurl("action=" . "link&link_id=" . $this->data['item_id'], false, true); } } --- 1043,1654 ---- $this->data['item_editor'] = ( $userdata['user_id'] != '-1' ) ? $userdata['username'] : $lang['Guest']; ! //$this->temp_url = PORTAL_URL . $pafiledb->this_mxurl("action=" . "link&link_id=" . $this->data['item_id'], false, true); ! } ! } ! ! /** ! * This is a generic class for custom fields. ! * ! * Note: This class doesn't differ from the core mx_custom_fields class, besides the templating. ! * ! */ ! class custom_field ! { ! var $field_rowset = array(); ! var $field_data_rowset = array(); ! ! var $custom_table = PA_CUSTOM_TABLE; ! var $custom_data_table = PA_CUSTOM_DATA_TABLE; ! ! /** ! * prepare data ! * ! */ ! function init() ! { ! global $db; ! ! $sql = "SELECT * ! FROM " . $this->custom_table . " ! ORDER BY field_order ASC"; ! ! if ( !( $result = $db->sql_query( $sql ) ) ) ! { ! mx_message_die( GENERAL_ERROR, 'Couldnt Query Custom field', '', __LINE__, __FILE__, $sql ); ! } ! ! while ( $row = $db->sql_fetchrow( $result ) ) ! { ! $this->field_rowset[$row['custom_id']] = $row; ! } ! unset( $row ); ! $db->sql_freeresult( $result ); ! ! $sql = "SELECT * ! FROM " . $this->custom_data_table; ! ! if ( !( $result = $db->sql_query( $sql ) ) ) ! { ! mx_message_die( GENERAL_ERROR, 'Couldnt Query Custom field', '', __LINE__, __FILE__, $sql ); ! } ! ! while ( $row = $db->sql_fetchrow( $result ) ) ! { ! $this->field_data_rowset[$row['customdata_file']][$row['customdata_custom']] = $row; ! } ! ! unset( $row ); ! ! $db->sql_freeresult( $result ); ! } ! ! /** ! * check if there is a data in the database. ! * ! * @return unknown ! */ ! function field_data_exist() ! { ! if ( !empty( $this->field_data_rowset ) ) ! { ! return true; ! } ! return false; ! } ! ! /** ! * Enter description here... ! * ! * @return unknown ! */ ! function field_exist() ! { ! if ( !empty( $this->field_rowset ) ) ! { ! return true; ! } ! return false; ! } ! ! /** ! * display data in the comment. ! * ! * @param unknown_type $file_id ! * @return unknown ! */ ! function add_comment( $file_id ) ! { ! global $pafiledb_template; ! if ( $this->field_data_exist() ) ! { ! if ( isset( $this->field_data_rowset[$file_id] ) ) ! { ! $message = ''; ! foreach( $this->field_data_rowset[$file_id] as $field_id => $data ) ! { ! if ( !empty( $data['data'] ) ) ! { ! switch ( $this->field_rowset[$field_id]['field_type'] ) ! { ! case INPUT: ! case TEXTAREA: ! case RADIO: ! case SELECT: ! $field_data = $data['data']; ! break; ! case SELECT_MULTIPLE: ! case CHECKBOX: ! $field_data = @implode( ', ', unserialize( $data['data'] ) ); ! break; ! } ! $message .= "\n" . "[b]" . $this->field_rowset[$field_id]['custom_name'] . ":[/b] " . $field_data . "\n"; ! } ! else ! { ! global $db; ! ! $sql = "DELETE FROM " . $this->custom_data_table . " ! WHERE customdata_file = '$file_id' ! AND customdata_custom = '$field_id'"; ! ! if ( !( $db->sql_query( $sql ) ) ) ! { ! mx_message_die( GENERAL_ERROR, 'Could not delete custom data', '', __LINE__, __FILE__, $sql ); ! } ! } ! } ! return $message; ! } ! else ! { ! return false; ! } ! } ! else ! { ! return false; ! } ! } ! ! /** ! * display data in the file page. ! * ! * @param unknown_type $file_id ! * @return unknown ! */ ! function display_data( $file_id ) ! { ! global $pafiledb_template; ! if ( $this->field_data_exist() ) ! { ! if ( isset( $this->field_data_rowset[$file_id] ) ) ! { ! foreach( $this->field_data_rowset[$file_id] as $field_id => $data ) ! { ! if ( !empty( $data['data'] ) ) ! { ! switch ( $this->field_rowset[$field_id]['field_type'] ) ! { ! case INPUT: ! case TEXTAREA: ! case RADIO: ! case SELECT: ! $field_data = $data['data']; ! break; ! case SELECT_MULTIPLE: ! case CHECKBOX: ! $field_data = @implode( ', ', unserialize( $data['data'] ) ); ! break; ! } ! ! $pafiledb_template->assign_block_vars( 'custom_field', array( ! 'CUSTOM_NAME' => $this->field_rowset[$field_id]['custom_name'], ! 'DATA' => $field_data ) ! ); ! } ! else ! { ! global $db; ! ! $sql = "DELETE FROM " . $this->custom_data_table . " ! WHERE customdata_file = '$file_id' ! AND customdata_custom = '$field_id'"; ! ! if ( !( $db->sql_query( $sql ) ) ) ! { ! mx_message_die( GENERAL_ERROR, 'Could not delete custom data', '', __LINE__, __FILE__, $sql ); ! } ! } ! } ! } ! else ! { ! return false; ! } ! } ! else ! { ! return false; ! } ! } ! ! /** ! * display custom field and data in the add/edit page. ! * ! * @param unknown_type $file_id ! * @return unknown ! */ ! function display_edit( $file_id = false ) ! { ! $return = false; ! if ( $this->field_exist() ) ! { ! foreach( $this->field_rowset as $field_id => $field_data ) ! { ! switch ( $field_data['field_type'] ) ! { ! case INPUT: ! $this->display_edit_input( $file_id, $field_id, $field_data ); ! break; ! case TEXTAREA: ! $this->display_edit_textarea( $file_id, $field_id, $field_data ); ! break; ! case RADIO: ! $this->display_edit_radio( $file_id, $field_id, $field_data ); ! break; ! case SELECT: ! $this->display_edit_select( $file_id, $field_id, $field_data ); ! break; ! case SELECT_MULTIPLE: ! $this->display_edit_select_multiple( $file_id, $field_id, $field_data ); ! break; ! case CHECKBOX: ! $this->display_edit_checkbox( $file_id, $field_id, $field_data ); ! break; ! } ! ! $return = true; ! } ! } ! return $return; ! } ! ! /** ! * Enter description here... ! * ! * @param unknown_type $file_id ! * @param unknown_type $field_id ! * @param unknown_type $field_data ! */ ! function display_edit_input( $file_id, $field_id, $field_data ) ! { ! global $pafiledb_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 ; ! $pafiledb_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 ) ! ); ! } ! ! /** ! * Enter description here... ! * ! * @param unknown_type $file_id ! * @param unknown_type $field_id ! * @param unknown_type $field_data ! */ ! function display_edit_textarea( $file_id, $field_id, $field_data ) ! { ! global $pafiledb_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 ; ! $pafiledb_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 ) ! ); ! } ! ! /** ! * Enter description here... ! * ! * @param unknown_type $file_id ! * @param unknown_type $field_id ! * @param unknown_type $field_data ! */ ! function display_edit_radio( $file_id, $field_id, $field_data ) ! { ! global $pafiledb_template; ! $pafiledb_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(); ! $data = !empty( $_POST['field'][$field_data['custom_id']] ) ? $_POST['field'][$field_data['custom_id']] : $data_temp ; ! $field_datas = ( !empty( $field_data['data'] ) ) ? unserialize( stripslashes( $field_data['data'] ) ) : array(); ! ! if ( !empty( $field_datas ) ) ! { ! foreach( $field_datas as $key => $value ) ! { ! $pafiledb_template->assign_block_vars( 'radio.row', array( ! 'FIELD_VALUE' => $value, ! 'FIELD_SELECTED' => ( $data == $value ) ? ' checked="checked"' : '' ) ! ); ! } ! } ! } ! ! /** ! * Enter description here... ! * ! * @param unknown_type $file_id ! * @param unknown_type $field_id ! * @param unknown_type $field_data ! */ ! function display_edit_select( $file_id, $field_id, $field_data ) ! { ! global $pafiledb_template; ! $pafiledb_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'] : ''; ! $data = !empty( $_POST['field'][$field_data['custom_id']] ) ? $_POST['field'][$field_data['custom_id']] : $data_temp ; ! $field_datas = ( !empty( $field_data['data'] ) ) ? unserialize( stripslashes( $field_data['data'] ) ) : array(); ! ! if ( !empty( $field_datas ) ) ! { ! foreach( $field_datas as $key => $value ) ! { ! $pafiledb_template->assign_block_vars( 'select.row', array( ! 'FIELD_VALUE' => $value, ! 'FIELD_SELECTED' => ( $data == $value ) ? ' selected="selected"' : '' ) ! ); ! } ! } ! } ! ! /** ! * Enter description here... ! * ! * @param unknown_type $file_id ! * @param unknown_type $field_id ! * @param unknown_type $field_data ! */ ! function display_edit_select_multiple( $file_id, $field_id, $field_data ) ! { ! global $pafiledb_template; ! $pafiledb_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(); ! $data = !empty( $_POST['field'][$field_data['custom_id']] ) ? $_POST['field'][$field_data['custom_id']] : $data_temp ; ! $field_datas = ( !empty( $field_data['data'] ) ) ? unserialize( stripslashes( $field_data['data'] ) ) : array(); ! ! if ( !empty( $field_datas ) ) ! { ! foreach( $field_datas as $key => $value ) ! { ! $selected = ''; ! foreach( $data as $field_value ) ! { ! if ( $field_value == $value ) ! { ! $selected = ' selected="selected"'; ! break; ! } ! } ! $pafiledb_template->assign_block_vars( 'select_multiple.row', array( ! 'FIELD_VALUE' => $value, ! 'FIELD_SELECTED' => $selected ) ! ); ! } ! } ! } ! ! /** ! * Enter description here... ! * ! * @param unknown_type $file_id ! * @param unknown_type $field_id ! * @param unknown_type $field_data ! */ ! function display_edit_checkbox( $file_id, $field_id, $field_data ) ! { ! global $pafiledb_template; ! $pafiledb_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(); ! $data = !empty( $_POST['field'][$field_data['custom_id']] ) ? $_POST['field'][$field_data['custom_id']] : $data_temp ; ! $field_datas = ( !empty( $field_data['data'] ) ) ? unserialize( stripslashes( $field_data['data'] ) ) : array(); ! ! if ( !empty( $field_datas ) ) ! { ! foreach( $field_datas as $key => $value ) ! { ! $checked = ''; ! foreach( $data as $field_value ) ! { ! if ( $field_value == $value ) ! { ! $checked = ' checked'; ! break; ! } ! } ! $pafiledb_template->assign_block_vars( 'checkbox.row', array( ! 'FIELD_VALUE' => $value, ! 'FIELD_CHECKED' => $checked ) ! ); ! } ! } ! } ! ! /** ! * Enter description here... ! * ! * @param unknown_type $field_type ! * @param unknown_type $field_id ! */ ! function update_add_field( $field_type, $field_id = false ) ! { ! global $db, $db, $_POST, $lang; ! ! $field_name = ( isset( $_POST['field_name'] ) ) ? htmlspecialchars( $_POST['field_name'] ) : ''; ! $field_desc = ( isset( $_POST['field_desc'] ) ) ? htmlspecialchars( $_POST['field_desc'] ) : ''; ! $regex = ( isset( $_POST['regex'] ) ) ? $_POST['regex'] : ''; ! $data = ( isset( $_POST['data'] ) ) ? $_POST['data'] : ''; ! $field_order = ( isset( $_POST['field_order'] ) ) ? $_POST['field_order'] : ''; ! ! if ( $field_id ) ! { ! $field_order = ( isset( $_POST['field_order'] ) ) ? intval( $_POST['field_order'] ) : ''; ! } ! ! if ( !empty( $data ) ) ! { ! $data = explode( "\n", htmlspecialchars( trim( $data ) ) ); ! ! foreach( $data as $key => $value ) ! { ! $data[$key] = trim( $value ); ! } ! $data = addslashes( serialize( $data ) ); ! } ! ! if ( empty( $field_name ) ) ! { ! mx_message_die( GENERAL_ERROR, $lang['Missing_field'] ); ! } ! ! if ( ( ( $field_type != INPUT && $field_type != TEXTAREA ) && empty( $data ) ) ) ! { ! mx_message_die( GENERAL_ERROR, $lang['Missing_field'] ); ! } ! ! 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 . "')"; ! ! if ( !( $db->sql_query( $sql ) ) ) ! { ! mx_message_die( GENERAL_ERROR, 'Could not add the new fields', '', __LINE__, __FILE__, $sql ); ! } ! ! $field_id = $db->sql_nextid(); ! ! $sql = "UPDATE " . $this->custom_table . " ! SET field_order = '$field_id' ! WHERE custom_id = $field_id"; ! ! if ( !( $db->sql_query( $sql ) ) ) ! { ! mx_message_die( GENERAL_ERROR, 'Could not set the order for the giving field', '', __LINE__, __FILE__, $sql ); ! } ! } ! 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"; ! ! if ( !( $db->sql_query( $sql ) ) ) ! { ! mx_message_die( GENERAL_ERROR, 'Could not update information for the giving field', '', __LINE__, __FILE__, $sql ); ! } ! } ! } ! ! /** ! * Enter description here... ! * ! * @param unknown_type $field_id ! */ ! function delete_field( $field_id ) ! { ! global $db; ! ! $sql = "DELETE FROM " . $this->custom_data_table . " ! WHERE customdata_custom = '$field_id'"; ! ! if ( !( $db->sql_query( $sql ) ) ) ! { ! mx_message_die( GENERAL_ERROR, 'Could not delete custom data', '', __LINE__, __FILE__, $sql ); ! } ! ! $sql = "DELETE FROM " . $this->custom_table . " ! WHERE custom_id = '$field_id'"; ! ! if ( !( $db->sql_query( $sql ) ) ) ! { ! mx_message_die( GENERAL_ERROR, 'Could not delete the selected field', '', __LINE__, __FILE__, $sql ); ! } ! } ! ! /** ! * Enter description here... ! * ! * @param unknown_type $field_id ! * @return unknown ! */ ! function get_field_data( $field_id ) ! { ! $return_array = $this->field_rowset[$field_id]; ! $return_array['data'] = !empty( $return_array['data'] ) ? implode( "\n", unserialize( stripslashes( $return_array['data'] ) ) ) : ''; ! return $return_array; ! } ! ! /** ! * file data in custom field operations. ! * ! * @param unknown_type $file_id ! */ ! function file_update_data( $file_id ) ! { ! global $_POST, $db; ! $field = ( isset( $_POST['field'] ) ) ? $_POST['field'] : ''; ! if ( !empty( $field ) ) ! { ! foreach( $field as $field_id => $field_data ) ! { ! if ( !empty( $this->field_rowset[$field_id]['regex'] ) ) ! { ! if ( !preg_match( '#' . $this->field_rowset[$field_id]['regex'] . '#siU', $field_data ) ) ! { ! $field_data = ''; ! } ! } ! ! switch ( $this->field_rowset[$field_id]['field_type'] ) ! { ! case INPUT: ! case TEXTAREA: ! case RADIO: ! case SELECT: ! $data = htmlspecialchars( $field_data ); ! break; ! case SELECT_MULTIPLE: ! case CHECKBOX: ! $data = addslashes( serialize( $field_data ) ); ! break; ! } ! ! $sql = "DELETE FROM " . $this->custom_data_table . " ! WHERE customdata_file = '$file_id' ! AND customdata_custom = '$field_id'"; ! ! if ( !$db->sql_query( $sql ) ) ! { ! mx_message_die( GENERAL_ERROR, 'Could not delete data from custom data table', '', __LINE__, __FILE__, $sql ); ! } ! ! if ( !empty( $data ) ) ! { ! $sql = "INSERT INTO " . $this->custom_data_table . " (customdata_file, customdata_custom, data) ! VALUES('$file_id', '$field_id', '$data')"; ! ! if ( !$db->sql_query( $sql ) ) ! { ! mx_message_die( GENERAL_ERROR, 'Could not add additional data', '', __LINE__, __FILE__, $sql ); ! } ! } ! } ! } } } Index: functions_admin.php =================================================================== RCS file: /cvsroot/mxbb/mx_pafiledb/pafiledb/includes/functions_admin.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** functions_admin.php 8 Jul 2006 16:28:46 -0000 1.6 --- functions_admin.php 1 Aug 2006 21:03:24 -0000 1.7 *************** *** 45,50 **** function admin_display_cat_auth( $cat_parent = 0, $depth = 0 ) { ! global $phpbb_root_path, $pafiledb_template, $phpEx; ! global $cat_auth_fields, $cat_auth_const, $cat_auth_levels, $lang; $pre = str_repeat( ' ', $depth ); if ( isset( $this->subcat_rowset[$cat_parent] ) ) --- 45,52 ---- function admin_display_cat_auth( $cat_parent = 0, $depth = 0 ) { ! global $lang, $phpbb_root_path, $pafiledb_template, $phpEx; ! global $cat_auth_fields, $cat_auth_const, $cat_auth_levels; ! global $cat_auth_approval_fields, $cat_auth_approval_const, $cat_auth_approval_levels; ! $pre = str_repeat( ' ', $depth ); if ( isset( $this->subcat_rowset[$cat_parent] ) ) *************** *** 72,75 **** --- 74,92 ---- $pafiledb_template->assign_block_vars( 'cat_row.cat_auth_data', array( 'S_AUTH_LEVELS_SELECT' => $custom_auth[$j] ) ); } + + for( $j = 0; $j < count( $cat_auth_approval_fields ); $j++ ) + { + $custom_auth_approval[$j] = ' <select name="' . $cat_auth_approval_fields[$j] . '[' . $sub_cat_id . ']' . '">'; + + for( $k = 0; $k < count( $cat_auth_approval_levels ); $k++ ) + { + $selected = ( $cat_data[$cat_auth_approval_fields[$j]] == $cat_auth_approval_const[$k] ) ? ' selected="selected"' : ''; + $custom_auth_approval[$j] .= '<option value="' . $cat_auth_approval_const[$k] . '"' . $selected . '>' . $lang['Category_' . $cat_auth_approval_levels[$k]] . '</option>'; + } + $custom_auth_approval[$j] .= '</select> '; + + $pafiledb_template->assign_block_vars( 'cat_row.cat_auth_data', array( 'S_AUTH_LEVELS_SELECT' => $custom_auth_approval[$j] ) ); + } + $this->admin_display_cat_auth( $sub_cat_id, $depth + 1 ); } *************** *** 82,86 **** { global $phpbb_root_path, $pafiledb_template, $phpEx; ! global $cat_auth_fields, $optionlist_mod, $optionlist_acl_adv; $pre = str_repeat( ' ', $depth ); if ( isset( $this->subcat_rowset[$cat_parent] ) ) --- 99,104 ---- { global $phpbb_root_path, $pafiledb_template, $phpEx; ! global $cat_auth_fields, $cat_auth_const, $cat_auth_levels, $optionlist_mod, $optionlist_acl_adv; ! $pre = str_repeat( ' ', $depth ); if ( isset( $this->subcat_rowset[$cat_parent] ) ) *************** *** 408,416 **** if ( $file_mode == 'delete' ) { ! $this->delete_files( $cat_id, 'category' ); } else { ! $this->move_files( $cat_id, $file_to_cat_id ); } --- 426,434 ---- if ( $file_mode == 'delete' ) { ! $this->delete_items( $cat_id, 'category' ); } else { ! $this->move_items( $cat_id, $file_to_cat_id ); } *************** *** 433,437 **** * @param unknown_type $to_cat */ ! function move_files( $from_cat, $to_cat ) { global $db; --- 451,455 ---- * @param unknown_type $to_cat */ ! function move_items( $from_cat, $to_cat ) { global $db; *************** *** 480,488 **** if ( $file_mode == 'delete' ) { ! $this->delete_files( $sub_cat_id, 'category' ); } else { ! $this->move_files( $sub_cat_id, $to_cat ); } } --- 498,506 ---- if ( $file_mode == 'delete' ) { ! $this->delete_items( $sub_cat_id, 'category' ); } else { ! $this->move_items( $sub_cat_id, $to_cat ); } } Index: functions_cache.php =================================================================== RCS file: /cvsroot/mxbb/mx_pafiledb/pafiledb/includes/functions_cache.php,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** functions_cache.php 7 Jun 2006 20:29:52 -0000 1.7 --- functions_cache.php 1 Aug 2006 21:03:24 -0000 1.8 *************** *** 15,19 **** /** ! * Enter description here... * */ --- 15,19 ---- /** ! * Generic module cache. * */ *************** *** 29,37 **** * @return pafiledb_cache */ ! function pafiledb_cache() { global $phpbb_root_path; global $mx_root_path, $module_root_path, $is_block, $phpEx; ! $this->cache_dir = $module_root_path . 'pafiledb/cache/'; } --- 29,43 ---- * @return pafiledb_cache */ ! function pafiledb_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_comment.php =================================================================== RCS file: /cvsroot/mxbb/mx_pafiledb/pafiledb/includes/functions_comment.php,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** functions_comment.php 5 Jul 2006 22:50:22 -0000 1.22 --- functions_comment.php 1 Aug 2006 21:03:24 -0000 1.23 *************** *** 91,99 **** $this->forum_id = $pafiledb->modules[$pafiledb->module_name]->comments[$this->cat_id]['comments_forum_id']; ! $this->auth['auth_view'] = $pafiledb->modules[$pafiledb->module_name]->auth[$this->cat_id]['auth_view_comment']; ! $this->auth['auth_post'] = $pafiledb->modules[$pafiledb->module_name]->auth[$this->cat_id]['auth_post_comment']; ! $this->auth['auth_edit'] = $pafiledb->modules[$pafiledb->module_name]->auth[$this->cat_id]['auth_edit_comment']; ! $this->auth['auth_delete'] = $pafiledb->modules[$pafiledb->module_name]->auth[$this->cat_id]['auth_delete_comment']; ! $this->auth['auth_mod'] = $pafiledb->modules[$pafiledb->module_name]->auth[$this->cat_id]['auth_mod']; // --- 91,99 ---- $this->forum_id = $pafiledb->modules[$pafiledb->module_name]->comments[$this->cat_id]['comments_forum_id']; ! $this->auth['auth_view'] = $pafiledb->modules[$pafiledb->module_name]->auth_user[$this->cat_id]['auth_view_comment']; ! $this->auth['auth_post'] = $pafiledb->modules[$pafiledb->module_name]->auth_user[$this->cat_id]['auth_post_comment']; ! $this->auth['auth_edit'] = $pafiledb->modules[$pafiledb->module_name]->auth_user[$this->cat_id]['auth_edit_comment']; ! $this->auth['auth_delete'] = $pafiledb->modules[$pafiledb->module_name]->auth_user[$this->cat_id]['auth_delete_comment']; ! $this->auth['auth_mod'] = $pafiledb->modules[$pafiledb->module_name]->auth_user[$this->cat_id]['auth_mod']; // Index: functions_auth.php =================================================================== RCS file: /cvsroot/mxbb/mx_pafiledb/pafiledb/includes/functions_auth.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** functions_auth.php 7 Jun 2006 20:29:52 -0000 1.3 --- functions_auth.php 1 Aug 2006 21:03:24 -0000 1.4 *************** *** 15,18 **** --- 15,43 ---- /** + * Auth API. + * + * $class->auth_user['auth_view']; + * $class->auth_user['auth_read']; + * $class->auth_user['auth_view_file']; + * $class->auth_user['auth_edit_file']; + * $class->auth_user['auth_delete_file']; + * $class->auth_user['auth_upload']; + * $class->auth_user['auth_download']; + * + * $class->auth_user['auth_approval']; + * $class->auth_user['auth_approval_edit']; + * + * $class->auth_user['auth_rate']; + * $class->auth_user['auth_email']; + * + * $class->auth_user['auth_view_comment']; + * $class->auth_user['auth_post_comment']; + * $class->auth_user['auth_edit_comment']; + * $class->auth_user['auth_delete_comment']; + * + * $class->auth_user['auth_mod']; + */ + + /** * pafiledb Auth class * *************** *** 20,24 **** class mx_pafiledb_auth { ! var $auth = array(); var $auth_global = array(); --- 45,49 ---- class mx_pafiledb_auth { ! var $auth_user = array(); var $auth_global = array(); *************** *** 35,40 **** global $db, $db, $lang, $userdata, $pafiledb_config; ! $a_sql = 'a.auth_view, a.auth_read, a.auth_view_file, a.auth_edit_file, a.auth_delete_file, a.auth_upload, a.auth_download, a.auth_rate, a.auth_email, a.auth_view_comment, a.auth_post_comment, a.auth_edit_comment, a.auth_delete_comment, a.auth_mod, a.auth_search, a.auth_stats, a.auth_toplist, a.auth_viewall, a.auth_approval'; ! $auth_fields = array( 'auth_view', 'auth_read', 'auth_view_file', 'auth_edit_file', 'auth_delete_file', 'auth_upload', 'auth_download', 'auth_rate', 'auth_email', 'auth_view_comment', 'auth_post_comment', 'auth_edit_comment', 'auth_delete_comment', 'auth_approval' ); $auth_fields_global = array( 'auth_search', 'auth_stats', 'auth_toplist', 'auth_viewall' ); --- 60,65 ---- global $db, $db, $lang, $userdata, $pafiledb_config; ! $a_sql = 'a.auth_view, a.auth_read, a.auth_view_file, a.auth_edit_file, a.auth_delete_file, a.auth_upload, a.auth_download, a.auth_rate, a.auth_email, a.auth_view_comment, a.auth_post_comment, a.auth_edit_comment, a.auth_delete_comment, a.auth_mod, a.auth_search, a.auth_stats, a.auth_toplist, a.auth_viewall, a.auth_approval, a.auth_approval_edit'; ! $auth_fields = array( 'auth_view', 'auth_read', 'auth_view_file', 'auth_edit_file', 'auth_delete_file', 'auth_upload', 'auth_download', 'auth_rate', 'auth_email', 'auth_view_comment', 'auth_post_comment', 'auth_edit_comment', 'auth_delete_comment', 'auth_approval', 'auth_approval_edit' ); $auth_fields_global = array( 'auth_search', 'auth_stats', 'auth_toplist', 'auth_viewall' ); *************** *** 99,128 **** { case AUTH_ALL: ! $this->auth[$c_cat_id][$key] = true; ! $this->auth[$c_cat_id][$key . '_type'] = $lang['Auth_Anonymous_users']; break; case AUTH_REG: ! $this->auth[$c_cat_id][$key] = ( $userdata['session_logged_in'] ) ? true : 0; ! $this->auth[$c_cat_id][$key . '_type'] = $lang['Auth_Registered_Users']; break; case AUTH_ACL: ! $this->auth[$c_cat_id][$key] = ( $userdata['session_logged_in'] ) ? $this->auth_check_user( AUTH_ACL, $key, $u_access[$c_cat_id], $is_admin ) : 0; ! $this->auth[$c_cat_id][$key . '_type'] = $lang['Auth_Users_granted_access']; break; case AUTH_MOD: ! $this->auth[$c_cat_id][$key] = ( $userdata['session_logged_in'] ) ? $this->auth_check_user( AUTH_MOD, 'auth_mod', $u_access[$c_cat_id], $is_admin ) : 0; ! $this->auth[$c_cat_id][$key . '_type'] = $lang['Auth_Moderators']; break; case AUTH_ADMIN: ! $this->auth[$c_cat_id][$key] = $is_admin; ! $this->auth[$c_cat_id][$key . '_type'] = $lang['Auth_Administrators']; break; default: ! $this->auth[$c_cat_id][$key] = 0; break; } --- 124,153 ---- { case AUTH_ALL: ! $this->auth_user[$c_cat_id][$key] = true; ! $this->auth_user[$c_cat_id][$key . '_type'] = $lang['Auth_Anonymous_users']; break; case AUTH_REG: ! $this->auth_user[$c_cat_id][$key] = ( $userdata['session_logged_in'] ) ? true : 0; ! $this->auth_user[$c_cat_id][$key . '_type'] = $lang['Auth_Registered_Users']; break; case AUTH_ACL: ! $this->auth_user[$c_cat_id][$key] = ( $userdata['session_logged_in'] ) ? $this->auth_check_user( AUTH_ACL, $key, $u_access[$c_cat_id], $is_admin ) : 0; ! $this->auth_user[$c_cat_id][$key . '_type'] = $lang['Auth_Users_granted_access']; break; case AUTH_MOD: ! $this->auth_user[$c_cat_id][$key] = ( $userdata['session_logged_in'] ) ? $this->auth_check_user( AUTH_MOD, 'auth_mod', $u_access[$c_cat_id], $is_admin ) : 0; ! $this->auth_user[$c_cat_id][$key . '_type'] = $lang['Auth_Moderators']; break; case AUTH_ADMIN: ! $this->auth_user[$c_cat_id][$key] = $is_admin; ! $this->auth_user[$c_cat_id][$key . '_type'] = $lang['Auth_Administrators']; break; default: ! $this->auth_user[$c_cat_id][$key] = 0; break; } *************** *** 132,136 **** { $c_cat_id = $c_access[$k]['cat_id']; ! $this->auth[$c_cat_id]['auth_mod'] = ( $userdata['session_logged_in'] ) ? $this->auth_check_user( AUTH_MOD, 'auth_mod', $u_access[$c_cat_id], $is_admin ) : 0; } --- 157,161 ---- { $c_cat_id = $c_access[$k]['cat_id']; ! $this->auth_user[$c_cat_id]['auth_mod'] = ( $userdata['session_logged_in'] ) ? $this->auth_check_user( AUTH_MOD, 'auth_mod', $u_access[$c_cat_id], $is_admin ) : 0; } *************** *** 263,269 **** function is_moderator() { ! if ( !empty( $this->auth ) ) { ! foreach( $this->auth as $cat_id => $auth_fields ) { if ( $auth_fileds['auth_mod'] ) --- 288,294 ---- function is_moderator() { ! if ( !empty( $this->auth_user ) ) { ! foreach( $this->auth_user as $cat_id => $auth_fields ) { if ( $auth_fileds['auth_mod'] ) Index: functions_field.php =================================================================== RCS file: /cvsroot/mxbb/mx_pafiledb/pafiledb/includes/functions_field.php,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** functions_field.php 7 Jun 2006 20:29:52 -0000 1.8 --- functions_field.php 1 Aug 2006 21:03:24 -0000 1.9 *************** *** 15,19 **** /** ! * Enter description here... * */ --- 15,19 ---- /** ! * This is a generic class for custom fields. * */ *************** *** 23,26 **** --- 23,29 ---- var $field_data_rowset = array(); + var $custom_table = PA_CUSTOM_TABLE; + var $custom_data_table = PA_CUSTOM_DATA_TABLE; + /** * prepare data *************** *** 32,36 **** $sql = "SELECT * ! FROM " . PA_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 " . PA_CUSTOM_DATA_TABLE; if ( !( $result = $db->sql_query( $sql ) ) ) --- 51,55 ---- $sql = "SELECT * ! FROM " . $this->custom_data_table; if ( !( $result = $db->sql_query( $sql ) ) ) *************** *** 66,70 **** /** ! * check if there is a data in the database * * @return unknown --- 69,73 ---- /** ! * check if there is a data in the database. * * @return unknown *************** *** 130,137 **** global $db; ! $sql = "DELETE FROM " . PA_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'"; *************** *** 157,161 **** /** ! * display data in the file page * * @param unknown_type $file_id --- 157,161 ---- /** ! * display data in the file page. * * @param unknown_type $file_id *************** *** 187,193 **** } ! $pafiledb_template->assign_block_vars( 'custom_field', array( 'CUSTOM_NAME' => $this->field_rowset[$field_id]['custom_name'], ! 'DATA' => $field_data ) ! ); } else --- 187,194 ---- } ! $pafiledb_template->assign_block_vars( 'custom_field', array( ! 'CUSTOM_NAME' => $this->field_rowset[$field_id]['custom_name'], ! 'DATA' => $field_data ) ! ); } else *************** *** 195,199 **** global $db; ! $sql = "DELETE FROM " . PA_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'"; *************** *** 218,222 **** /** ! * display custom field and data in the add/edit page * * @param unknown_type $file_id --- 219,223 ---- /** ! * display custom field and data in the add/edit page. * * @param unknown_type $file_id *************** *** 268,276 **** { global $pafiledb_template; ! $pafiledb_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' => ( !empty( $this->field_data_rowset[$file_id][$field_id]['data'] ) ) ? $this->field_data_rowset[$file_id][$field_id]['data'] : '' ) ! ); } --- 269,280 ---- { global $pafiledb_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 ; ! $pafiledb_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 ) ! ); } *************** *** 285,293 **** { global $pafiledb_template; ! $pafiledb_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' => ( !empty( $this->field_data_rowset[$file_id][$field_id]['data'] ) ) ? $this->field_data_rowset[$file_id][$field_id]['data'] : '' ) ! ); } --- 289,300 ---- { global $pafiledb_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 ; ! $pafiledb_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 ) ! ); } *************** *** 302,311 **** { global $pafiledb_template; ! $pafiledb_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 = ( !empty( $this->field_data_rowset[$file_id][$field_id]['data'] ) ) ? $this->field_data_rowset[$file_id][$field_id]['data'] : array(); $field_datas = ( !empty( $field_data['data'] ) ) ? unserialize( stripslashes( $field_data['data'] ) ) : array(); --- 309,320 ---- { global $pafiledb_template; ! $pafiledb_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(); ! $data = !empty( $_POST['field'][$field_data['custom_id']] ) ? $_POST['field'][$field_data['custom_id']] : $data_temp ; $field_datas = ( !empty( $field_data['data'] ) ) ? unserialize( stripslashes( $field_data['data'] ) ) : array(); *************** *** 314,320 **** foreach( $field_datas as $key => $value ) { ! $pafiledb_template->assign_block_vars( 'radio.row', array( 'FIELD_VALUE' => $value, ! 'FIELD_SELECTED' => ( $data == $value ) ? ' checked="checked"' : '' ) ! ); } } --- 323,330 ---- foreach( $field_datas as $key => $value ) { ! $pafiledb_template->assign_block_vars( 'radio.row', array( ! 'FIELD_VALUE' => $value, ! 'FIELD_SELECTED' => ( $data == $value ) ? ' checked="checked"' : '' ) ! ); } } *************** *** 331,340 **** { global $pafiledb_template; ! $pafiledb_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 = ( !empty( $this->field_data_rowset[$file_id][$field_id]['data'] ) ) ? $this->field_data_rowset[$file_id][$field_id]['data'] : ''; $field_datas = ( !empty( $field_data['data'] ) ) ? unserialize( stripslashes( $field_data['data'] ) ) : array(); --- 341,352 ---- { global $pafiledb_template; ! $pafiledb_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'] : ''; ! $data = !empty( $_POST['field'][$field_data['custom_id']] ) ? $_POST['field'][$field_data['custom_id']] : $data_temp ; $field_datas = ( !empty( $field_data['data'] ) ) ? unserialize( stripslashes( $field_data['data'] ) ) : array(); *************** *** 343,349 **** foreach( $field_datas as $key => $value ) { ! $pafiledb_template->assign_block_vars( 'select.row', array( 'FIELD_VALUE' => $value, ! 'FIELD_SELECTED' => ( $data == $value ) ? ' selected="selected"' : '' ) ! ); } } --- 355,362 ---- foreach( $field_datas as $key => $value ) { ! $pafiledb_template->assign_block_vars( 'select.row', array( ! 'FIELD_VALUE' => $value, ! 'FIELD_SELECTED' => ( $data == $value ) ? ' selected="selected"' : '' ) ! ); } } *************** *** 360,369 **** { global $pafiledb_template; ! $pafiledb_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 = ( !empty( $this->field_data_rowset[$file_id][$field_id]['data'] ) ) ? unserialize( $this->field_data_rowset[$file_id][$field_id]['data'] ) : array(); $field_datas = ( !empty( $field_data['data'] ) ) ? unserialize( stripslashes( $field_data['data'] ) ) : array(); --- 373,384 ---- { global $pafiledb_template; ! $pafiledb_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(); ! $data = !empty( $_POST['field'][$field_data['custom_id']] ) ? $_POST['field'][$field_data['custom_id']] : $data_temp ; $field_datas = ( !empty( $field_data['data'] ) ) ? unserialize( stripslashes( $field_data['data'] ) ) : array(); *************** *** 381,387 **** } } ! $pafiledb_template->assign_block_vars( 'select_multiple.row', array( 'FIELD_VALUE' => $value, ! 'FIELD_SELECTED' => $selected ) ! ); } } --- 396,403 ---- } } ! $pafiledb_template->assign_block_vars( 'select_multiple.row', array( ! 'FIELD_VALUE' => $value, ! 'FIELD_SELECTED' => $selected ) ! ); } } *************** *** 398,407 **** { global $pafiledb_template; ! $pafiledb_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 = ( !empty( $this->field_data_rowset[$file_id][$field_id]['data'] ) ) ? unserialize( $this->field_data_rowset[$file_id][$field_id]['data'] ) : array(); $field_datas = ( !empty( $field_data['data'] ) ) ? unserialize( stripslashes( $field_data['data'] ) ) : array(); --- 414,425 ---- { global $pafiledb_template; ! $pafiledb_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(); ! $data = !empty( $_POST['field'][$field_data['custom_id']] ) ? $_POST['field'][$field_data['custom_id']] : $data_temp ; $field_datas = ( !empty( $field_data['data'] ) ) ? unserialize( stripslashes( $field_data['data'] ) ) : array(); *************** *** 419,425 **** } } ! $pafiledb_template->assign_block_vars( 'checkbox.row', array( 'FIELD_VALUE' => $value, ! 'FIELD_CHECKED' => $checked ) ! ); } } --- 437,444 ---- } } ! $pafiledb_template->assign_block_vars( 'checkbox.row', array( ! 'FIELD_VALUE' => $value, ! 'FIELD_CHECKED' => $checked ) ! ); } } *************** *** 470,474 **** if ( !$field_id ) { ! $sql = "INSERT INTO " . PA_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 . "')"; *************** *** 480,484 **** $field_id = $db->sql_nextid(); ! $sql = "UPDATE " . PA_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"; *************** *** 491,495 **** else { ! $sql = "UPDATE " . PA_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"; *************** *** 511,515 **** global $db; ! $sql = "DELETE FROM " . PA_CUSTOM_DATA_TABLE . " WHERE customdata_custom = '$field_id'"; --- 530,534 ---- global $db; ! $sql = "DELETE FROM " . $this->custom_data_table . " WHERE customdata_custom = '$field_id'"; *************** *** 519,523 **** } ! $sql = "DELETE FROM " . PA_CUSTOM_TABLE . " WHERE custom_id = '$field_id'"; --- 538,542 ---- } ! $sql = "DELETE FROM " . $this->custom_table . " WHERE custom_id = '$field_id'"; *************** *** 542,546 **** /** ! * file data in custom field operations * * @param unknown_type $file_id --- 561,565 ---- /** ! * file data in custom field operations. * * @param unknown_type $file_id *************** *** 576,580 **** } ! $sql = "DELETE FROM " . PA_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'"; *************** *** 587,591 **** if ( !empty( $data ) ) { ! $sql = "INSERT INTO " . PA_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')"; Index: functions_pafiledb.php =================================================================== RCS file: /cvsroot/mxbb/mx_pafiledb/pafiledb/includes/functions_pafiledb.php,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** functions_pafiledb.php 8 Jul 2006 16:28:46 -0000 1.36 --- functions_pafiledb.php 1 Aug 2006 21:03:24 -0000 1.37 *************** *** 130,169 **** for( $i = 0; $i < count( $cat_rowset ); $i++ ) { ! if ( $this->auth[$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 ? ($pafiledb_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 ? ($pafiledb_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 ? ($pafiledb_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($pafiledb_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']]['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 ? ($pafiledb_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 ? ($pafiledb_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($pafiledb_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($pafiledb_config['notify_group'])) : ( intval($cat_rowset[$i]['notify_group']) ); // Group_id } } --- 130,169 ---- 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 ? ($pafiledb_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 ? ($pafiledb_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 ? ($pafiledb_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($pafiledb_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']]['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 ? ($pafiledb_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 ? ($pafiledb_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($pafiledb_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($pafiledb_config['notify_group'])) : ( intval($cat_rowset[$i]['notify_group']) ); // Group_id ! } } } *************** *** 313,317 **** * @return unknown */ ! function file_in_cat( $cat_id ) { if ( $this->cat_rowset[$cat_id]['cat_files'] == -1 || $this->modified ) --- 313,317 ---- * @return unknown */ ! function items_in_cat( $cat_id ) { if ( $this->cat_rowset[$cat_id]['cat_files'] == -1 || $this->modified ) *************** *** 330,341 **** } ! $files_no = 0; if ( $row = $db->sql_fetchrow( $result ) ) { ! $files_no = $row['total_files']; } $sql = 'UPDATE ' . PA_CATEGORY_TABLE . " ! SET cat_files = $files_no WHERE cat_id = $cat_id"; --- 330,341 ---- } ! $number_of_items = 0; if ( $row = $db->sql_fetchrow( $result ) ) { ! $number_of_items = $row['total_files']; } $sql = 'UPDATE ' . PA_CATEGORY_TABLE . " ! SET cat_files = $number_of_items WHERE cat_id = $cat_id"; *************** *** 347,354 **** else { ! $files_no = $this->cat_rowset[$cat_id]['cat_files']; } ! return $files_no; } --- 347,354 ---- else { ! $number_of_items = $this->cat_rowset[$cat_id]['cat_files']; } ! return $number_of_items; } *************** *** 363,370 **** * @return unknown */ ! function generate_jumpbox( $cat_id = 0, $depth = 0, $default = '', $for_file = false, $check_upload = false ) { global $page_id; ! static $cat_rowset = false; if ( !is_array( $cat_rowset ) ) --- 363,370 ---- * @return unknown */ ! function generate_jumpbox( $cat_id = 0, $depth = 0, $default = '', $for_file = false, $check_upload = true, $auth = 'auth_view' ) { global $page_id; ! //static $cat_rowset = false; if ( !is_array( $cat_rowset ) ) *************** *** 376,380 **** foreach( $this->cat_rowset as $row ) { ! if ( $this->auth[$row['cat_id']]['auth_upload'] ) { $cat_rowset[$row['cat_id']] = $row; --- 376,380 ---- foreach( $this->cat_rowset as $row ) { ! if ( $this->auth_user[$row['cat_id']][$auth] ) { $cat_rowset[$row['cat_id']] = $row; *************** *** 449,453 **** foreach( $this->subcat_rowset[$cat_id] as $cat_id => $cat_row ) { ! if ( $cat_row['cat_allow_file'] || !empty( $this->subcat_rowset[$cat_row['cat_id']] ) ) { $i++; --- 449,453 ---- foreach( $this->subcat_rowset[$cat_id] as $cat_id => $cat_row ) { ! if ( $this->auth_user[$cat_row['cat_id']]['auth_view'] && ( $cat_row['cat_allow_file'] || !empty( $this->subcat_rowset[$cat_row['cat_id']] ) ) ) { $i++; *************** *** 543,551 **** * @return unknown */ ! function new_file_in_cat( $cat_id ) { global $pafiledb_config, $board_config, $db, $_COOKIE; ! $cat_array = explode(',', $this->gen_cat_ids( $cat_id )); $files_new = 0; --- 543,551 ---- * @return unknown */ ! function new_item_in_cat( $cat_id ) { global $pafiledb_config, $board_config, $db, $_COOKIE; ! $cat_array = explode(', ', $this->gen_cat_ids( $cat_id )); $files_new = 0; *************** *** 554,558 **** foreach ( $cat_array as $key => $cat_id ) { ! if ( $this->auth[$cat_id]['auth_read'] && $this->cat_rowset[$cat_id]['cat_last_file_time'] > $time) ... [truncated message content] |