diff --git a/modules/formulize/class/checkboxElement.php b/modules/formulize/class/checkboxElement.php index 68bc52913..69eb352db 100644 --- a/modules/formulize/class/checkboxElement.php +++ b/modules/formulize/class/checkboxElement.php @@ -608,19 +608,21 @@ function afterSavingLogic($value, $element_id, $entry_id) { // $handle is the element handle for the field that we're retrieving this for // $entry_id is the entry id of the entry in the form that we're retrieving this for function prepareDataForDataset($value, $handle, $entry_id) { - global $xoopsDB; - $newValueq = go("SELECT other_text FROM " . $xoopsDB->prefix("formulize_other")." as o, " . $xoopsDB->prefix("formulize")." as f WHERE o.ele_id = f.ele_id AND f.ele_handle=\"" . formulize_db_escape($handle) . "\" AND o.id_req='".intval($entry_id)."' LIMIT 0,1"); - // removing the "Other: " part...we just want to show what people actually typed...doesn't have to be flagged specifically as an "other" value - $value_other = $newValueq[0]['other_text']; + global $xoopsDB; + $newValueq = go("SELECT other_text FROM " . $xoopsDB->prefix("formulize_other")." as o, " . $xoopsDB->prefix("formulize")." as f WHERE o.ele_id = f.ele_id AND f.ele_handle=\"" . formulize_db_escape($handle) . "\" AND o.id_req='".intval($entry_id)."' LIMIT 0,1"); + // removing the "Other: " part...we just want to show what people actually typed...doesn't have to be flagged specifically as an "other" value + if (!empty($newValueq)) { + $value_other = $newValueq[0]['other_text']; $value = preg_replace('/\{OTHER\|+[0-9]+\}/', $value_other, $value); - $values = explode("*=+*:",$value); - $elementObject = $this->get($handle); - if($elementObject->getVar('ele_uitextshow')) { - foreach($values as $i=>$value) { - $values[$i] = formulize_swapUIText($value, $elementObject->getVar('ele_uitext')); - } + } + $values = explode("*=+*:",$value); + $elementObject = $this->get($handle); + if($elementObject->getVar('ele_uitextshow')) { + foreach($values as $i=>$value) { + $values[$i] = formulize_swapUIText($value, $elementObject->getVar('ele_uitext')); } - return $values; + } + return $values; } // this method will take a text value that the user has specified at some point, and convert it to a value that will work for comparing with values in the database. This is used primarily for preparing user submitted text values for saving in the database, or for comparing to values in the database, such as when users search for things. The typical user submitted values would be coming from a condition form (ie: fieldX = [term the user typed in]) or other situation where the user types in a value that needs to interact with the database. diff --git a/modules/formulize/class/fileUploadElement.php b/modules/formulize/class/fileUploadElement.php index b1bf7f1c5..c94019b80 100644 --- a/modules/formulize/class/fileUploadElement.php +++ b/modules/formulize/class/fileUploadElement.php @@ -104,9 +104,9 @@ function adminSave($element, $ele_value) { // $element is the element object function loadValue($value, $ele_value, $element) { $value = unserialize($value); // what we've got in the database is a serialized array, first key is filename, second key is flag for whether the filename is for real (might be an error message) - $ele_value[3] = $value['name']; // add additional keys to ele_value where we'll put the value that is coming from the database for user's to see, plus other flags and so on - $ele_value[4] = $this->getFileDisplayName($value['name']); - $ele_value[5] = $value['isfile']; + $ele_value[3] = $value['name'] ? $value['name'] : null; // add additional keys to ele_value where we'll put the value that is coming from the database for user's to see, plus other flags and so on + $ele_value[4] = $this->getFileDisplayName(strval($value['name'])); + $ele_value[5] = $value['isfile'] ? $value['name'] : null; return $ele_value; } @@ -410,8 +410,8 @@ function createDownloadLink($element, $url, $displayName) { // this method will return the displayName for a file (ie: remove the obscuring timestamp on the front, if any) function getFileDisplayName($fileName) { - $fileNameParts = explode("+---+",$fileName); - $displayName = isset($fileNameParts[1]) ? $fileNameParts[1] : $fileNameParts[0]; + $fileNameParts = explode("+---+",$fileName); + $displayName = isset($fileNameParts[1]) ? $fileNameParts[1] : $fileNameParts[0]; return $displayName; } diff --git a/modules/formulize/class/listOfEntriesScreen.php b/modules/formulize/class/listOfEntriesScreen.php index f1468066f..620c5179b 100644 --- a/modules/formulize/class/listOfEntriesScreen.php +++ b/modules/formulize/class/listOfEntriesScreen.php @@ -334,7 +334,7 @@ function cloneScreen($sid) { // $screen is a screen object // since the number of params for the render method can vary from screen type to screen type, this should take a single array that we unpack in the method, so the number of params is common to all types, ie: one array function render($screen, $entry, $loadThisView) { - $previouslyRenderingScreen = $GLOBALS['formulize_screenCurrentlyRendering']; + $previouslyRenderingScreen = $GLOBALS['formulize_screenCurrentlyRendering'] ? $GLOBALS['formulize_screenCurrentlyRendering'] : null; $formframe = $screen->getVar('frid') ? $screen->getVar('frid') : $screen->getVar('fid'); $mainform = $screen->getVar('frid') ? $screen->getVar('fid') : ""; include_once XOOPS_ROOT_PATH . "/modules/formulize/include/entriesdisplay.php"; diff --git a/modules/formulize/class/templateScreen.php b/modules/formulize/class/templateScreen.php index d501cf290..dd75e0d3f 100644 --- a/modules/formulize/class/templateScreen.php +++ b/modules/formulize/class/templateScreen.php @@ -136,7 +136,7 @@ function render($screen, $entry_id, $settings = "") { return; } - $previouslyRenderingScreen = $GLOBALS['formulize_screenCurrentlyRendering']; + $previouslyRenderingScreen = $GLOBALS['formulize_screenCurrentlyRendering'] ? $GLOBALS['formulize_screenCurrentlyRendering'] : null; // SOME STANDARDS FOR HOW TO HANDLE 'SAVE' AND 'SAVE AND LEAVE' BUTTONS AND THE DONE DEST NEED TO BE DEVISED FOR TEMPLATE SCREENS!!