Пример #1
0
            $skills = $db->sql_fetchrow($result);
            $s_hidden_fields = '<input type="hidden" name="mode" value="save" /><input type="hidden" name="skill_id" value="' . $skills['skill_id'] . '" />';
            $template->assign_vars(array("SKILL_NAME" => $lang[$skills['skill_name']], "SKILL_DESC" => $skills['skill_desc'], "SKILL_DESC_EXPLAIN" => adr_get_lang($skills['skill_desc']), "SKILL_IMG" => $skills['skill_img'], "SKILL_IMG_EX" => $skills['skill_img'], "CHANCE" => $skills['skill_chance'], "REQ" => $skills['skill_req'], "L_SKILLS_TITLE" => $lang['Adr_skills_add_edit'], "L_SKILLS_EXPLAIN" => $lang['Adr_skills_explain'], "L_NAME" => $lang['Adr_races_name'], "L_NAME_EXPLAIN" => $lang['Adr_races_name_explain'], "L_DESC" => $lang['Adr_races_desc'], "L_CHANCE" => $lang['Adr_skills_chance'], "L_CHANCE_EXPLAIN" => $lang['Adr_skills_chance_explain'], "L_REQ" => $lang['Adr_skills_req'], "L_REQ_EXPLAIN" => $lang['Adr_skills_req_explain'], "L_IMG" => $lang['Adr_races_image'], "L_SUBMIT" => $lang['Submit'], "S_HIDDEN_FIELDS" => $s_hidden_fields));
            $template->pparse("body");
            break;
        case "save":
            $skill_id = !empty($_POST['skill_id']) ? intval($_POST['skill_id']) : intval($_GET['skill_id']);
            $skill_img = isset($_POST['skill_img']) ? trim($_POST['skill_img']) : trim($_GET['skill_img']);
            $skill_desc = isset($_POST['skill_desc']) ? trim($_POST['skill_desc']) : trim($_GET['skill_desc']);
            $skill_req = intval($_POST['skill_req']);
            $skill_chance = intval($_POST['skill_chance']);
            $sql = "UPDATE " . ADR_SKILLS_TABLE . "\n\t\t\t\tSET \tskill_desc = '" . str_replace("\\'", "''", $skill_desc) . "', \n\t\t\t\t\tskill_img = '" . str_replace("\\'", "''", $skill_img) . "',\n\t\t\t\t\tskill_req = {$skill_req} ,\n\t\t\t\t\tskill_chance = {$skill_chance}\n\t\t\t\tWHERE skill_id = " . $skill_id;
            if (!($result = $db->sql_query($sql))) {
                message_die(GENERAL_ERROR, "Couldn't update skills info", "", __LINE__, __FILE__, $sql);
            }
            adr_update_skills();
            adr_previous(Adr_skills_successful_edited, admin_adr_skills, '');
            break;
    }
} else {
    adr_template_file('admin/config_adr_skills_list_body.tpl');
    $sql = "SELECT * FROM " . ADR_SKILLS_TABLE . "\n\t\t\tWHERE skill_id != '5'";
    $result = $db->sql_query($sql);
    if (!$result) {
        message_die(GENERAL_ERROR, 'Could not obtain skills infos', "", __LINE__, __FILE__, $sql);
    }
    $skills = $db->sql_fetchrowset($result);
    for ($i = 0; $i < count($skills); $i++) {
        $row_class = !($i % 2) ? $theme['td_class1'] : $theme['td_class2'];
        $template->assign_block_vars("skills", array("ROW_CLASS" => $row_class, "NAME" => adr_get_lang($skills[$i]['skill_name']), "DESC" => adr_get_lang($skills[$i]['skill_desc']), "REQ" => $skills[$i]['skill_req'], "CHANCE" => $skills[$i]['skill_chance'], "IMG" => $skills[$i]['skill_img'], "U_SKILLS_EDIT" => append_sid("admin_adr_skills.{$phpEx}?mode=edit&amp;id=" . $skills[$i]['skill_id'])));
    }
Пример #2
0
function adr_get_skill_data($target_skill)
{
    global $db, $lang, $phpEx, $phpbb_root_path, $board_config;
    $target_skill = intval($target_skill);
    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[8]) {
        // All the following code has been made by Ptirhiik
        @(include $phpbb_root_path . './adr/cache/cache_skills.' . $phpEx);
        if (!empty($adr_skills)) {
            while (list($skill_id, $skill_data) = @each($adr_skills)) {
                $cached_adr_skills[$skill_id] = $skill_data;
            }
        } else {
            $sql = "SELECT * FROM  " . ADR_SKILLS_TABLE;
            if (!($result = $db->sql_query($sql))) {
                message_die(GENERAL_ERROR, 'Unable to query skill infos (cache)', '', __LINE__, __FILE__, $sql);
            }
            @(include $phpbb_root_path . './adr/cache/cache_skills.' . $phpEx);
            if (empty($adr_skills)) {
                adr_update_skills();
                include $phpbb_root_path . './adr/cache/cache_skills.' . $phpEx;
                while (list($skill_id, $skill_data) = @each($adr_skills)) {
                    $cached_adr_skills[$skill_id] = $skill_data;
                }
            }
        }
    } else {
        $skill_sql = "SELECT * FROM  " . ADR_SKILLS_TABLE;
        if (!($skill_result = $db->sql_query($skill_sql))) {
            message_die(GENERAL_ERROR, 'Unable to query skill infos (non-cache)', '', __LINE__, __FILE__, $sql);
        }
        $adr_skills = $db->sql_fetchrowset($skill_result);
        for ($s = 0; $s < count($adr_skills); $s++) {
            $cached_adr_skills[$s + 1] = $adr_skills[$s];
        }
    }
    if ($target_skill) {
        return $cached_adr_skills[$target_skill];
    } else {
        return $cached_adr_skills;
    }
}
Пример #3
0
function adr_get_skill_data($target_skill)
{
    global $db, $lang, $phpEx, $phpbb_root_path, $board_config;
    $target_skill = intval($target_skill);
    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_skills.' . $phpEx);
    if (!empty($adr_skills)) {
        while (list($skill_id, $skill_data) = @each($adr_skills)) {
            $cached_adr_skills[$skill_id] = $skill_data;
        }
    } else {
        adr_update_skills();
        include $phpbb_root_path . './adr/cache/cache_skills.' . $phpEx;
        while (list($skill_id, $skill_data) = @each($adr_skills)) {
            $cached_adr_skills[$skill_id] = $skill_data;
        }
    }
    if ($target_skill) {
        return $cached_adr_skills[$target_skill];
    } else {
        return $cached_adr_skills;
    }
}