$b_stone = intval($_POST['stone_bonus']); $b_forge = intval($_POST['forge_bonus']); $b_enchant = intval($_POST['enchant_bonus']); $b_trading = intval($_POST['trading_bonus']); $b_thief = intval($_POST['thief_bonus']); $race_id = $fields_data['race_id'] + 1; if ($race_name == '') { message_die(MESSAGE, $lang['Fields_empty']); } $sql = "INSERT INTO " . ADR_RACES_TABLE . " \n\t\t\t\t( race_id , race_name , race_desc , race_level , race_img , race_might_bonus , race_dexterity_bonus , race_constitution_bonus , race_intelligence_bonus , race_wisdom_bonus , race_charisma_bonus , race_magic_attack_bonus , race_magic_resistance_bonus , race_might_malus , race_dexterity_malus , race_constitution_malus , race_intelligence_malus , race_wisdom_malus , race_charisma_malus , race_magic_attack_malus , race_magic_resistance_malus , race_skill_mining_bonus , race_skill_stone_bonus , race_skill_forge_bonus , race_skill_enchantment_bonus , race_skill_trading_bonus , race_skill_thief_bonus )\n\t\t\t\tVALUES ( {$race_id},'" . str_replace("\\'", "''", $race_name) . "', '" . str_replace("\\'", "''", $race_desc) . "' , {$level} , '" . str_replace("\\'", "''", $race_img) . "' , {$b_might} , {$b_dext} , {$b_const} , {$b_int}, {$b_wis}, {$b_cha} , {$b_ma} , {$b_md} , {$m_might}, {$m_dext} ,{$m_const} , {$m_int}, {$m_wis} , {$m_cha} , {$m_ma} , {$m_md} , {$b_mining} , {$b_stone} , {$b_forge} ,{$b_enchant} , {$b_trading} ,{$b_thief} )"; $result = $db->sql_query($sql); if (!$result) { message_die(GENERAL_ERROR, "Couldn't insert new race", "", __LINE__, __FILE__, $sql); } // Update cache adr_update_race_infos(); adr_previous(Adr_race_successful_added, admin_adr_races, ''); break; } } else { adr_template_file('admin/config_adr_races_list_body.tpl'); $sql = "SELECT *\n\t\tFROM " . ADR_RACES_TABLE; $result = $db->sql_query($sql); if (!$result) { message_die(GENERAL_ERROR, 'Could not obtain races information', "", __LINE__, __FILE__, $sql); } $races = $db->sql_fetchrowset($result); for ($i = 0; $i < count($races); $i++) { $row_class = !($i % 2) ? $theme['td_class1'] : $theme['td_class2']; $level[0] = $lang['Adr_races_level_all']; $level[1] = $lang['Adr_races_level_admin'];
function adr_get_race_infos($race_id) { global $db, $lang, $phpEx, $phpbb_root_path, $board_config, $table_prefix; define('IN_ADR_CHARACTER', 1); include_once $phpbb_root_path . 'adr/includes/adr_constants.' . $phpEx; $cache_config = explode('-', $board_config['Adr_use_cache_system']); if ($cache_config[7]) { // All the following code has been made by Ptirhiik @(include $phpbb_root_path . './adr/cache/cache_races.' . $phpEx); if (!empty($adr_races)) { $cached_adr_races = $adr_races[$race_id]; } else { $sql = "SELECT * FROM " . ADR_RACES_TABLE . "\n\t\t\t\tWHERE race_id = '{$race_id}'"; if (!($result = $db->sql_query($sql))) { message_die(GENERAL_ERROR, 'Unable to query race infos (cache)', '', __LINE__, __FILE__, $sql); } @(include $phpbb_root_path . './adr/cache/cache_races.' . $phpEx); if (empty($adr_races)) { adr_update_race_infos(); include $phpbb_root_path . './adr/cache/cache_races.' . $phpEx; $cached_adr_races = $adr_races[$race_id]; } } } else { $race_sql = "SELECT * FROM " . ADR_RACES_TABLE . "\n\t\t\tWHERE race_id = '{$race_id}'"; if (!($race_result = $db->sql_query($race_sql))) { message_die(GENERAL_ERROR, 'Unable to query race infos (non-cache)', '', __LINE__, __FILE__, $sql); } $cached_adr_races = $db->sql_fetchrow($race_result); } return $cached_adr_races; }
function adr_get_race_infos($race_id) { global $db, $lang, $phpEx, $phpbb_root_path, $board_config, $table_prefix; redefine('IN_ADR_CHARACTER', 1); include_once $phpbb_root_path . 'adr/includes/adr_constants.' . $phpEx; // All the following code has been made by Ptirhiik @(include $phpbb_root_path . './adr/cache/cache_races.' . $phpEx); if (!empty($adr_races)) { $cached_adr_races = $adr_races[$race_id]; } else { adr_update_race_infos(); include $phpbb_root_path . './adr/cache/cache_races.' . $phpEx; $cached_adr_races = $adr_races[$race_id]; } return $cached_adr_races; }