Textpattern | PHP Cross Reference | Content Management Systems |
1 <?php 2 3 /* 4 * Textpattern Content Management System 5 * https://textpattern.com/ 6 * 7 * Copyright (C) 2020 The Textpattern Development Team 8 * 9 * This file is part of Textpattern. 10 * 11 * Textpattern is free software; you can redistribute it and/or 12 * modify it under the terms of the GNU General Public License 13 * as published by the Free Software Foundation, version 2. 14 * 15 * Textpattern is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU General Public License for more details. 19 * 20 * You should have received a copy of the GNU General Public License 21 * along with Textpattern. If not, see <https://www.gnu.org/licenses/>. 22 */ 23 24 if (!defined('TXP_UPDATE')) { 25 exit("Nothing here. You can't access this file directly."); 26 } 27 28 // Add dev support to Sections. 29 $cols = getThings('describe `'.PFX.'txp_section`'); 30 31 foreach (array('skin' => 63, 'page' => 255, 'css' => 255) as $field => $size) { 32 if (!in_array('dev_'.$field, $cols)) { 33 safe_alter('txp_section', 34 "ADD dev_{$field} VARCHAR($size) NOT NULL DEFAULT ''"); 35 } else { 36 safe_alter('txp_section', 37 "ALTER dev_{$field} SET DEFAULT ''"); 38 } 39 } 40 // Advanced options 41 if (false === get_pref('advanced_options', false, true)) { 42 set_pref('advanced_options', 0, 'admin', PREF_CORE, 'onoffRadio', 200, PREF_GLOBAL); 43 } 44 45 // Custom form types. 46 if (false === ($custom_types = get_pref('custom_form_types', false, true))) { 47 set_pref('custom_form_types', 48 ';[js] 49 ;mediatype="application/javascript" 50 ;title="JavaScript"', 51 'advanced_options', PREF_CORE, 'longtext_input', 100, PREF_GLOBAL); 52 } else { 53 $custom_types = preg_replace('/^(;?)mimetype\b/m', '$1mediatype', $custom_types); 54 safe_update('txp_prefs', "val='".doSlash($custom_types)."', event = 'advanced_options'", "name='custom_form_types'"); 55 } 56 57 if ($mimetypes = parse_ini_string(get_pref('assets_mimetypes', '', true))) { 58 $custom_types = parse_ini_string($custom_types); 59 60 foreach ($mimetypes as $ext => $type) { 61 if (!isset($custom_types[$ext])) { 62 $prefs['custom_form_types'] .= n."[$ext]".n.'mediatype="'.$type.'"'; 63 } 64 } 65 66 safe_update('txp_prefs', "val = '".doSlash($prefs['custom_form_types'])."'", "name='custom_form_types'"); 67 } 68 69 safe_delete('txp_prefs', "name='assets_mimetypes'");
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
title