golden hour
/home/phakp/public_html/formtools/global/code
⬆️ Go Up
Upload
File/Folder
Size
Actions
Accounts.class.php
14.56 KB
Del
OK
Administrator.class.php
32.41 KB
Del
OK
Clients.class.php
19.25 KB
Del
OK
Constants.class.php
51 B
Del
OK
Core.class.php
23.23 KB
Del
OK
CoreFieldTypes.class.php
11.16 KB
Del
OK
Database.class.php
6.34 KB
Del
OK
DatabaseSessions.class.php
3.09 KB
Del
OK
Emails.class.php
60.66 KB
Del
OK
Errors.class.php
4.78 KB
Del
OK
FieldOptions.class.php
1.1 KB
Del
OK
FieldSettings.class.php
1.25 KB
Del
OK
FieldSizes.class.php
2.9 KB
Del
OK
FieldTypes.class.php
61.04 KB
Del
OK
FieldValidation.class.php
11.7 KB
Del
OK
Fields.class.php
57.75 KB
Del
OK
Files.class.php
18.61 KB
Del
OK
Forms.class.php
63.07 KB
Del
OK
General.class.php
47.2 KB
Del
OK
Hooks.class.php
21.66 KB
Del
OK
Installation.class.php
57.45 KB
Del
OK
ListGroups.class.php
2.35 KB
Del
OK
Menus.class.php
36.83 KB
Del
OK
Module.abstract.class.php
8.29 KB
Del
OK
ModuleMenu.class.php
3.84 KB
Del
OK
Modules.class.php
30.52 KB
Del
OK
OmitLists.class.php
2.4 KB
Del
OK
OptionLists.class.php
28.04 KB
Del
OK
Pages.class.php
8.61 KB
Del
OK
Schemas.class.php
814 B
Del
OK
SecureSmarty.class.php
403 B
Del
OK
Sessions.class.php
4.01 KB
Del
OK
Settings.class.php
23.12 KB
Del
OK
Submissions.class.php
70.8 KB
Del
OK
Templates.class.php
6.64 KB
Del
OK
Themes.class.php
14.04 KB
Del
OK
Translations.class.php
3.54 KB
Del
OK
Upgrade.class.php
6.81 KB
Del
OK
User.class.php
14.47 KB
Del
OK
ViewColumns.class.php
3.06 KB
Del
OK
ViewFields.class.php
19.39 KB
Del
OK
ViewFilters.class.php
15.07 KB
Del
OK
ViewTabs.class.php
3.46 KB
Del
OK
Views.class.php
47.25 KB
Del
OK
actions.php
17.92 KB
Del
OK
field_types
-
Del
OK
index.php
35 B
Del
OK
polyfills.php
5.07 KB
Del
OK
validation.php
15.79 KB
Del
OK
Edit: Upgrade.class.php
<?php namespace FormTools; use Exception; class Upgrade { public static function upgrade() { $current_version_date = Core::getReleaseDate(); $last_version_in_db = Settings::get("program_version"); $last_version_date_in_db = Settings::get("release_date"); $is_upgraded = false; $success = true; $error_msg = ""; // any time the version changes, update the list of hooks in the DB if ($current_version_date > $last_version_date_in_db) { // always re-parse the database to get the latest list of hooks Hooks::updateAvailableHooks(); if (General::isVersionEarlierThan($last_version_in_db, "3.0.1")) { list ($success, $error_msg) = self::upgradeTo3_0_1(); self::patchFieldTypeOptionListSettingMapping(); self::fixEuropeanDateFormat(); } if (General::isVersionEarlierThan($last_version_in_db, "3.0.4")) { self::addCopySubmissionField(); } if (General::isVersionEarlierThan($last_version_in_db, "3.0.8")) { Settings::set(array("installation_complete" => "yes"), "core"); } if (General::isVersionEarlierThan($last_version_in_db, "3.0.10")) { self::addViewMappingViewId(); self::setCoreFieldsAsNotEditable(); } self::removeModulesTableDescCol(); self::removeModulesTableModuleKeyCol(); FieldTypes::resetFieldTypes(); if (General::isVersionEarlierThan($last_version_in_db, "3.0.15")) { General::createCacheFolder(); } if ($success) { Settings::set(array( "release_date" => $current_version_date, "program_version" => Core::getCoreVersion(), "release_type" => Core::getReleaseType() )); $is_upgraded = true; $success = true; } } return array( "upgraded" => $is_upgraded, "success" => $success, "error_msg" => $error_msg ); } /** * Handles upgrading from FT2 2.2.5, 2.2.6 or 2.2.7 to 3.0.0/3.0.1. * * These methods can safely be executed multiple times (but should still only fire once). */ private static function upgradeTo3_0_1() { $db = Core::$db; $success = true; $error_msg = ""; try { $db->query(" ALTER TABLE {PREFIX}forms CHANGE add_submission_button_label add_submission_button_label VARCHAR(255) "); $db->execute(); General::deleteColumnIfExists("modules", "is_premium"); Settings::set(array( "edit_submission_onload_resources" => Installation::getEditSubmissionOnloadResources() ), "core"); // reset all core field types to their factory defaults FieldTypes::resetFieldTypes(); } catch (Exception $e) { $success = false; $error_msg = $e->getMessage(); } return array($success, $error_msg); } /** * FT3 alpha/betas were failing to map the ID of the field type setting ID for select/checkboxes/multi-select/radios * that houses the option list info to the original field. This caused a few minor issues in the UI including * adding an external form. See: https://github.com/formtools/core/issues/166 (indirect issue) */ private static function patchFieldTypeOptionListSettingMapping () { $db = Core::$db; $field_types = FieldTypes::get(true); foreach ($field_types as $field_type) { if (!in_array($field_type["field_type_identifier"], array("dropdown", "multi_select_dropdown", "radio_buttons", "checkboxes"))) { continue; } // In the original data, the setting that's going to store the option list has a "use_for_option_list_map" // boolean, but that's not available here. Luckily all 4 of these field types have a field_type value of // "option_list_or_form_field" so we use that to locate the DB record here $setting_id = null; foreach ($field_type["settings"] as $setting_info) { if ($setting_info["field_type"] == "option_list_or_form_field") { $setting_id = $setting_info["setting_id"]; break; } } $db->query(" UPDATE {PREFIX}field_types SET raw_field_type_map_multi_select_id = :raw_field_type_map_multi_select_id WHERE field_type_id = :field_type_id "); $db->bind("raw_field_type_map_multi_select_id", $setting_id); $db->bind("field_type_id", $field_type["field_type_id"]); $db->execute(); } } private static function fixEuropeanDateFormat() { $db = Core::$db; $db->query(" UPDATE {PREFIX}field_type_setting_options SET option_text = '30. 08. 2011', option_value = 'dd. mm. yy' WHERE option_text = '30. 08. 2011.' AND option_value = 'dd. mm. yy.' "); $db->execute(); } // fix for missing may_copy_submissions DB field in 3.0.3 public static function addCopySubmissionField() { $db = Core::$db; if (!General::checkDbTableFieldExists("views", "may_copy_submissions")) { try { $db->query(" ALTER TABLE {PREFIX}views ADD may_copy_submissions ENUM('yes','no') NOT NULL DEFAULT 'no' AFTER may_add_submissions "); $db->execute(); } catch (Exception $e) { } } } // fix for https://github.com/formtools/core/issues/371 public static function addViewMappingViewId() { $db = Core::$db; if (!General::checkDbTableFieldExists("email_templates", "view_mapping_view_id")) { try { $db->query(" ALTER TABLE {PREFIX}email_templates ADD view_mapping_view_id MEDIUMINT(9) AFTER view_mapping_type "); $db->execute(); } catch (Exception $e) { } } } public static function setCoreFieldsAsNotEditable() { $db = Core::$db; try { $db->query(" UPDATE {PREFIX}field_types SET is_editable = 'no', non_editable_info = '{\$LANG.text_non_deletable_fields}' WHERE field_type_identifier IN ('textbox', 'textarea', 'password', 'dropdown', 'multi_select_dropdown', 'radio_buttons', 'checkboxes', 'date', 'time', 'phone', 'code_markup') "); $db->execute(); $db->query(" ALTER TABLE {PREFIX}field_types ADD is_enabled ENUM('yes','no') NOT NULL DEFAULT 'yes' AFTER is_editable "); $db->execute(); } catch (Exception $e) { } } public static function removeModulesTableDescCol() { General::deleteColumnIfExists("modules", "description"); } public static function removeModulesTableModuleKeyCol() { General::deleteColumnIfExists("modules", "module_key"); } }
Save