// check if the user has permission to edit the form if (!$gperm_handler->checkRight("edit_form", $fid, $groups, $mid)) { return; } $ele_value = $element->getVar('ele_value'); $ele_encrypt = $_POST['elements-ele_encrypt']; $databaseElement = ($ele_type == "areamodif" or $ele_type == "ib" or $ele_type == "sep" or $ele_type == "subform" or $ele_type == "grid" or property_exists($element, 'hasData') and $element->hasData == false) ? false : true; $reloadneeded = false; if ($ele_encrypt != $element->getVar('ele_encrypt') and $databaseElement and !$_GET['ele_id']) { // the setting has changed on this pageload, and it's a database element, and it's not new $reloadneeded = true; // display of data type goes on/off when encryption is off/on // if the encryption setting changed, then we need to encrypt/decrypt all the existing data include_once XOOPS_ROOT_PATH . "/modules/formulize/class/data.php"; $data_handler = new formulizeDataHandler($fid); if (!$data_handler->toggleEncryption($_POST['original_handle'], $element->getVar('ele_encrypt'))) { print "Warning: unable to toggle the encryption of the '" . $_POST['original_handle'] . "' field on/off!"; } } if ($databaseElement and $_GET['ele_id']) { // ele_id is only in the URL when we're on the first save for a new element global $xoopsDB; // figure out what the data type should be. // the rules: // if it's encrypted, it's a BLOB, otherwise... // date fields get 'date' // colorpicker gets 'text' // for text element types... // if 'text' is the specified type, and it's numbers only with a decimal, then use decimal with that number of spaces // if 'text' is the specified type, and it's numbers only with 0 decimals, then use int // all other cases, use the specified type