Exemple #1
0
    $query = "SELECT `fk_module_code` FROM `{$dbtable_prefix}site_options3` WHERE `config_option`='skin_name' AND `config_value`='" . $input['skin_name'] . "'";
    if (!($res = @mysql_query($query))) {
        trigger_error(mysql_error(), E_USER_ERROR);
    }
    if (mysql_num_rows($res) && mysql_result($res, 0, 0) != $input['fk_module_code']) {
        $error = true;
        $topass['message']['type'] = MESSAGE_ERROR;
        $topass['message']['text'] = 'This skin name already exists! Please enter a unique name.';
        $input['error_skin_name'] = 'red_border';
    }
    if (!$error) {
        if (!empty($input['fk_module_code'])) {
            $fk_module_code = $input['fk_module_code'];
            unset($input['fk_module_code']);
            unset($input['skin_dir']);
            foreach ($input as $k => $v) {
                set_site_option($k, $fk_module_code, $v);
            }
            //			regenerate_langstrings_array();
            $topass['message']['type'] = MESSAGE_INFO;
            $topass['message']['text'] = 'Skin settings saved.';
        }
    } else {
        $nextpage = 'admin/site_skins_addedit.php';
        // 		you must re-read all textareas from $_POST like this:
        //		$input['x']=addslashes_mq($_POST['x']);
        $input = sanitize_and_format($input, TYPE_STRING, FORMAT_HTML2TEXT_FULL | FORMAT_STRIPSLASH);
        $topass['input'] = $input;
    }
}
redirect2page($nextpage, $topass, $qs);
Exemple #2
0
    if (!($res = @mysql_query($query))) {
        trigger_error(mysql_error(), E_USER_ERROR);
    }
    $query = "DELETE FROM `{$dbtable_prefix}modules` WHERE `module_code`='{$module_code}'";
    if (!($res = @mysql_query($query))) {
        trigger_error(mysql_error(), E_USER_ERROR);
    }
    $query = "DELETE FROM `{$dbtable_prefix}lang_strings` WHERE `skin`='{$module_code}'";
    if (!($res = @mysql_query($query))) {
        trigger_error(mysql_error(), E_USER_ERROR);
    }
    if (!empty($config['is_default'])) {
        $query = "SELECT `module_code` FROM `{$dbtable_prefix}modules` WHERE `module_type`=" . MODULE_SKIN . " LIMIT 1";
        if (!($res = @mysql_query($query))) {
            trigger_error(mysql_error(), E_USER_ERROR);
        }
        if (mysql_num_rows($res)) {
            $module_code = mysql_result($res, 0, 0);
            set_site_option('is_default', $module_code, 1);
        }
    }
    require_once '../../includes/classes/fileop.class.php';
    $fileop = new fileop();
    $fileop->delete(_BASEPATH_ . '/skins_site/' . $config['skin_dir']);
    $topass['message']['type'] = MESSAGE_INFO;
    $topass['message']['text'] = 'Skin deleted.';
} else {
    $topass['message']['type'] = MESSAGE_ERROR;
    $topass['message']['text'] = 'You can\'t delete the last skin of the site!';
}
redirect2page('admin/site_skins.php', $topass, $qs);
            // execute field related processor stuff
            $error = $new_field->admin_processor();
            if (!$error) {
                // save any custom configuration in profile_fields
                $query = "UPDATE `{$dbtable_prefix}profile_fields2` SET `custom_config`='" . $input['custom_config'] . "' WHERE `pfield_id`=" . $input['pfield_id'];
                if (!($res = @mysql_query($query))) {
                    trigger_error(mysql_error(), E_USER_ERROR);
                }
                // create the field in the user_profiles table
                $temp = $new_field->query_create($input['dbfield']);
                if (!empty($temp)) {
                    $query = "ALTER TABLE `{$dbtable_prefix}user_profiles` {$temp}";
                    if (!($res = @mysql_query($query))) {
                        trigger_error(mysql_error(), E_USER_ERROR);
                    }
                    set_site_option('dbfield_index', 'core', $dbfield_index + 1);
                }
                $topass['message']['type'] = MESSAGE_INFO;
                $topass['message']['text'] = 'Field added.';
            }
        }
        //		regenerate_langstrings_array();
        //		regenerate_fields_array();
    } else {
        $nextpage = 'profile_fields_addedit.php';
        // 		you must re-read all textareas from $_POST like this:
        //		$input['x']=addslashes_mq($_POST['x']);
        $input = sanitize_and_format($input, TYPE_STRING, FORMAT_HTML2TEXT_FULL | FORMAT_STRIPSLASH);
        $topass['input'] = $input;
    }
}