function pack() { return expstring($this->title) . '&' . expstring($this->name) . '&' . expstring($this->class1) . '&' . expstring($this->class2) . '&' . expstring($this->class3) . '&' . expstring($this->width) . '&' . expstring($this->widthmd) . '&' . expstring($this->thspan) . '&' . expstring($this->thalign) . '&' . expstring($this->thvalign) . '&' . expstring($this->thwrap) . '&' . expstring($this->align) . '&' . expstring($this->valign) . '&' . expstring($this->wrap) . '&' . expstring($this->value); }
function view() { global $ff_mospath, $ff_mossite, $database, $my; global $ff_config, $ff_version, $ff_comsite, $ff_otherparams; $is_mobile_type = ''; if (trim($this->formrow->template_code_processed) == 'QuickMode') { if (isset($_GET['non_mobile']) && JRequest::getBool('non_mobile', 0)) { JFactory::getSession()->clear('com_breezingforms.mobile'); } else { if (isset($_GET['mobile']) && JRequest::getBool('mobile', 0)) { JFactory::getSession()->set('com_breezingforms.mobile', true); } } require_once JPATH_SITE . '/administrator/components/com_breezingforms/libraries/Zend/Json/Decoder.php'; require_once JPATH_SITE . '/administrator/components/com_breezingforms/libraries/Zend/Json/Encoder.php'; require_once JPATH_SITE . '/administrator/components/com_breezingforms/libraries/crosstec/functions/helpers.php'; $dataObject = Zend_Json::decode(base64_decode($this->formrow->template_code)); $rootMdata = $dataObject['properties']; $is_device = false; $useragent = $_SERVER['HTTP_USER_AGENT']; if (JRequest::getVar('ff_applic', '') != 'mod_facileforms' && JRequest::getInt('ff_frame', 0) != 1 && bf_is_mobile()) { $is_device = true; $this->isMobile = isset($rootMdata['mobileEnabled']) && isset($rootMdata['forceMobile']) && $rootMdata['mobileEnabled'] && $rootMdata['forceMobile'] ? true : (isset($rootMdata['mobileEnabled']) && isset($rootMdata['forceMobile']) && $rootMdata['mobileEnabled'] && JFactory::getSession()->get('com_breezingforms.mobile', false) ? true : false); } else { $this->isMobile = false; if (isset($rootMdata['themebootstrapThemeEngine']) && $rootMdata['themebootstrapThemeEngine'] == 'bootstrap') { $this->legacy_wrap = false; } } if ($is_device && isset($rootMdata['mobileEnabled']) && isset($rootMdata['forceMobile']) && $rootMdata['mobileEnabled'] && !$rootMdata['forceMobile']) { $is_mobile_type = 'choose'; } if (!$this->isMobile || $this->isMobile && JRequest::getVar('ff_task', '') == 'submit') { // nothing } else { // transforming recaptcha into captcha due to compatibility on mobiles if ($this->isMobile) { for ($i = 0; $i < $this->rowcount; $i++) { $row = $this->rows[$i]; if ($row->type == "ReCaptcha") { $this->rows[$i]->type = 'Captcha'; break; } } ob_end_clean(); ob_start(); require_once JPATH_SITE . '/administrator/components/com_breezingforms/libraries/crosstec/classes/BFQuickModeMobile.php'; $quickMode = new BFQuickModeMobile($this); if (isset($rootMdata['mobileEnabled']) && isset($rootMdata['forceMobile']) && $rootMdata['mobileEnabled'] && $rootMdata['forceMobile']) { $quickMode->forceMobileUrl = isset($rootMdata['forceMobileUrl']) ? $rootMdata['forceMobileUrl'] : 'index.php'; } } } } // CONTENTBUILDER BEGIN $cbResult = $this->cbCheckPermissions(); $cbForm = $cbResult['form']; $cbRecord = $cbResult['record']; $cbFrontend = $cbResult['frontend']; $cbFull = $cbResult['full']; // CONTENTBUILDER END $database = JFactory::getDBO(); $mainframe = JFactory::getApplication(); if (!$this->okrun) { return; } set_error_handler('_ff_errorHandler'); ob_start(); echo $this->header(); $this->queryCols = array(); $this->queryRows = array(); if ($this->runmode == _FF_RUNMODE_PREVIEW) { echo '<script type="text/javascript" src="' . JURI::root() . 'administrator/components/com_breezingforms/libraries/wz_dragdrop/wz_dragdrop.js"></script>'; } if (trim($this->formrow->template_code_processed) == 'QuickMode' && $this->legacy_wrap) { echo '<table style="display:none;width:100%;" border="" id="bfReCaptchaWrap"><tr><td><div id="bfReCaptchaDiv"></div></td></tr></table>'; } echo '<div id="ff_formdiv' . $this->form . '"'; echo ' class="bfFormDiv' . ($this->formrow->class1 != '' ? ' ' . $this->getClassName($this->formrow->class1) : '') . '"'; if ($this->legacy_wrap) { echo '><div class="bfPage-tl"><div class="bfPage-tr"><div class="bfPage-t"></div></div></div><div class="bfPage-l"><div class="bfPage-r"><div class="bfPage-m bfClearfix">' . nl(); } else { echo '>'; } $this->status = JRequest::getCmd('ff_status', ''); $this->message = JRequest::getVar('ff_message', ''); // handle Before Form piece $code = ''; switch ($this->formrow->piece1cond) { case 1: // library $database->setQuery('select name, code from #__facileforms_pieces ' . 'where id=' . $this->formrow->piece1id . ' and published=1 '); $rows = $database->loadObjectList(); if (count($rows)) { echo $this->execPiece($rows[0]->code, BFText::_('COM_BREEZINGFORMS_PROCESS_BFPIECE') . " " . $rows[0]->name, 'p', $this->formrow->piece1id, null); } break; case 2: // custom code echo $this->execPiece($this->formrow->piece1code, BFText::_('COM_BREEZINGFORMS_PROCESS_BFPIECEC'), 'f', $this->form, 2); break; default: break; } // switch if ($this->bury()) { return; } $cntFiles = 0; $fileExtensionsCheck = 'function checkFileExtensions(){'; for ($i = 0; $i < $this->rowcount; $i++) { $row = $this->rows[$i]; if ($row->type == 'File Upload' && trim($this->formrow->template_code) != '') { if (trim($row->data2) != '') { $exts = explode(',', $row->data2); $extsCount = count($exts); $fileExtensionsCheck .= 'var ff_elem' . $row->id . 'Exts = false;'; for ($x = 0; $x < $extsCount; $x++) { $fileExtensionsCheck .= ' if(!ff_elem' . $row->id . 'Exts && document.getElementById("ff_elem' . $row->id . '").value.toLowerCase().lastIndexOf(".' . strtolower(trim($exts[$x])) . '") != -1){ ff_elem' . $row->id . 'Exts = true; }else if(!ff_elem' . $row->id . 'Exts && document.getElementById("ff_elem' . $row->id . '").value == ""){ ff_elem' . $row->id . 'Exts = true; }'; } $fileExtensionsCheck .= ' if(!ff_elem' . $row->id . 'Exts){ if(typeof bfUseErrorAlerts == "undefined"){ alert("' . addslashes(BFText::_('COM_BREEZINGFORMS_FILE_EXTENSION_NOT_ALLOWED')) . '"); } else { bfShowErrors("' . addslashes(BFText::_('COM_BREEZINGFORMS_FILE_EXTENSION_NOT_ALLOWED')) . '"); } if(ff_currentpage != ' . $row->page . ')ff_switchpage(' . $row->page . '); if(document.getElementById("bfSubmitButton")){ document.getElementById("bfSubmitButton").disabled = false; } return false; } '; $cntFiles++; } } } $fileExtensionsCheck .= ' return true; } '; $capFunc = 'function bfCheckCaptcha(){if(checkFileExtensions())ff_submitForm2();}'; for ($i = 0; $i < $this->rowcount; $i++) { $row = $this->rows[$i]; if ($row->type == "Captcha") { $capFunc = ' function bfAjaxObject101() { this.createRequestObject = function() { try { var ro = new XMLHttpRequest(); } catch (e) { var ro = new ActiveXObject("Microsoft.XMLHTTP"); } return ro; } this.sndReq = function(action, url, data) { if (action.toUpperCase() == "POST") { this.http.open(action,url,true); this.http.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); this.http.onreadystatechange = this.handleResponse; this.http.send(data); } else { this.http.open(action,url + "?" + data,true); this.http.onreadystatechange = this.handleResponse; this.http.send(null); } } this.handleResponse = function() { if ( me.http.readyState == 4) { if (typeof me.funcDone == "function") { me.funcDone();} var rawdata = me.http.responseText.split("|"); for ( var i = 0; i < rawdata.length; i++ ) { var item = (rawdata[i]).split("=>"); if (item[0] != "") { if (item[1].substr(0,3) == "%V%" ) { document.getElementById(item[0]).value = item[1].substring(3); } else { if(item[1] == "true"){ if(typeof bfDoFlashUpload != \'undefined\'){ bfDoFlashUpload(); } else { ff_submitForm2(); } } else { if(typeof JQuery != "undefined" && JQuery("#bfSubmitMessage")) { JQuery("#bfSubmitMessage").css("visibility","hidden"); } if(typeof bfUseErrorAlerts == "undefined"){ alert("' . addslashes(BFText::_('COM_BREEZINGFORMS_CAPTCHA_MISSING_WRONG')) . '"); } else { if(typeof inlineErrorElements != "undefined"){ inlineErrorElements.push(["bfCaptchaEntry","' . addslashes(BFText::_('COM_BREEZINGFORMS_CAPTCHA_MISSING_WRONG')) . '"]); } bfShowErrors("' . addslashes(BFText::_('COM_BREEZINGFORMS_CAPTCHA_MISSING_WRONG')) . '"); } document.getElementById(\'ff_capimgValue\').src = \'' . JURI::root(true) . (JFactory::getApplication()->isAdmin() ? '/administrator' : '') . '/components/com_breezingforms/images/captcha/securimage_show.php?bfMathRandom=\' + Math.random(); document.getElementById(\'bfCaptchaEntry\').value = ""; if(ff_currentpage != ' . $row->page . ')ff_switchpage(' . $row->page . '); document.getElementById(\'bfCaptchaEntry\').focus(); if(document.getElementById("bfSubmitButton")){ document.getElementById("bfSubmitButton").disabled = false; } } } } } } if ((me.http.readyState == 1) && (typeof me.funcWait == "function")) { me.funcWait(); } } var me = this; this.http = this.createRequestObject(); var funcWait = null; var funcDone = null; } function bfCheckCaptcha(){ if(checkFileExtensions()){ var ao = new bfAjaxObject101(); ao.sndReq("get","' . JURI::root(true) . (JFactory::getApplication()->isAdmin() ? '/administrator/' : (BFJoomlaConfig::get('config.sef') && !BFJoomlaConfig::get('config.sef_rewrite') ? '/index.php/' : '/') . (JRequest::getCmd('lang', '') && BFJoomlaConfig::get('config.sef') ? JRequest::getCmd('lang', '') . (BFJoomlaConfig::get('config.sef_rewrite') ? '/index.php' : '/') : 'index.php')) . '?lang=' . JRequest::getCmd('lang', '') . '&raw=true&option=com_breezingforms&checkCaptcha=true&Itemid=0&tmpl=component&value="+document.getElementById("bfCaptchaEntry").value,""); } }'; break; } else { if ($row->type == "ReCaptcha") { $capFunc = 'var bfReCaptchaLoaded = true; function bfCheckCaptcha(){ if(checkFileExtensions()){ function bfValidateCaptcha() { challengeField = JQuery("input#recaptcha_challenge_field").val(); responseField = JQuery("input#recaptcha_response_field").val(); var html = JQuery.ajax({ type: "POST", url: "' . JURI::root(true) . (JFactory::getApplication()->isAdmin() ? '/administrator/' : (BFJoomlaConfig::get('config.sef') && !BFJoomlaConfig::get('config.sef_rewrite') ? '/index.php/' : '/') . (JRequest::getCmd('lang', '') && BFJoomlaConfig::get('config.sef') ? JRequest::getCmd('lang', '') . (BFJoomlaConfig::get('config.sef_rewrite') ? '/index.php' : '/') : 'index.php')) . '?lang=' . JRequest::getCmd('lang', '') . '&raw=true&option=com_breezingforms&bfReCaptcha=true&form=' . $this->form . '&Itemid=0&tmpl=component", data: "recaptcha_challenge_field=" + challengeField + "&recaptcha_response_field=" + responseField, async: false }).responseText; if (html.replace(/^\\s+|\\s+$/, "") == "success") { if(typeof bfDoFlashUpload != \'undefined\'){ bfDoFlashUpload(); } else { ff_submitForm2(); } } else { if(typeof bfUseErrorAlerts == "undefined"){ alert("' . addslashes(BFText::_('COM_BREEZINGFORMS_CAPTCHA_MISSING_WRONG')) . '"); } else { if(typeof inlineErrorElements != "undefined"){ inlineErrorElements.push(["bfReCaptchaEntry","' . addslashes(BFText::_('COM_BREEZINGFORMS_CAPTCHA_MISSING_WRONG')) . '"]); } bfShowErrors("' . addslashes(BFText::_('COM_BREEZINGFORMS_CAPTCHA_MISSING_WRONG')) . '"); } if(ff_currentpage != ' . $row->page . ')ff_switchpage(' . $row->page . '); Recaptcha.focus_response_field(); Recaptcha.reload(); if(document.getElementById("bfSubmitButton")){ document.getElementById("bfSubmitButton").disabled = false; } } } bfValidateCaptcha(); } }'; } } } echo '<script type="text/javascript">' . nl() . '<!--' . nl() . '' . nl() . $fileExtensionsCheck . $capFunc; // create library list $library = array(); $this->loadBuiltins($library); $this->loadScripts($library); // start linking $linked = array(); if ($this->status == '') { $code = "onload = function()" . nl() . "{" . nl() . " ff_initialize('formentry');" . nl() . " ff_initialize('pageentry');" . nl(); if ($this->formrow->heightmode) { $code .= " ff_resizepage(" . $this->formrow->heightmode . ", " . $this->formrow->height . ");" . nl(); } if ($this->showgrid) { $code .= " ff_showgrid();" . nl(); } $code .= " if (ff_processor && ff_processor.traceBuffer) ff_traceWindow();" . nl() . "} // onload"; $this->linkcode('onload', $library, $linked, $code); } else { $funcname = ""; switch ($this->formrow->script2cond) { case 1: $database->setQuery("select name from #__facileforms_scripts " . "where id=" . $this->formrow->script2id . " and published=1 "); $funcname = $database->loadResult(); break; case 2: $funcname = "ff_" . $this->formrow->name . "_submitted"; break; default: break; } // switch if ($funcname != '' || $this->formrow->heightmode || $this->showgrid) { $code = "onload = function()" . nl() . "{" . nl(); if ($this->formrow->heightmode) { $code .= " ff_resizepage(" . $this->formrow->heightmode . ", " . $this->formrow->height . ");" . nl(); } if ($this->showgrid) { $code .= " ff_showgrid();" . nl(); } if ($funcname != '') { $code .= " " . $funcname . "(" . $this->status . ",\"" . str_replace("\n", '', str_replace("\r", '', stripcslashes($this->message))) . "\");" . nl(); } $code .= "} // onload"; $this->linkcode('onload', $library, $linked, $code); } // if } // if if ($this->bury()) { return; } // add form scripts $this->addFunction($this->formrow->script1cond, $this->formrow->script1id, 'ff_' . $this->formrow->name . '_init', $this->formrow->script1code, $library, $linked, 'f', $this->form, 1); if ($this->bury()) { return; } $this->addFunction($this->formrow->script2cond, $this->formrow->script2id, 'ff_' . $this->formrow->name . '_submitted', $this->formrow->script2code, $library, $linked, 'f', $this->form, 1); if ($this->bury()) { return; } // all element scripts & static text/HTML $icons = 0; $tooltips = 0; $qcheckboxes = 0; $qcode = ''; for ($i = 0; $i < $this->rowcount; $i++) { $row =& $this->rows[$i]; $this->draggableDivIds[] = 'ff_div' . $row->id; if ($row->type == "Icon") { $icons++; } if ($row->type == "Tooltip") { $tooltips++; } if ($row->type == "Query List") { if ($row->flag2) { $qcheckboxes++; } // load column definitions $this->queryCols['ff_' . $row->id] = array(); $cols =& $this->queryCols['ff_' . $row->id]; if ($this->trim($row->data3)) { $cls = explode("\n", $row->data3); for ($c = 0; $c < count($cls); $c++) { if ($cls[$c] != '') { $col = ''; // instead of unset $col = new facileFormsQuerycols(); $col->unpack($cls[$c]); $this->compileQueryCol($row, $col); $cols[] = $col; } // if } // for } // if $colcnt = count($cols); $checkbox = 0; if ($row->flag2) { $checkbox = $row->flag2; } $header = 0; if ($row->flag1) { $header = 1; } // get pagenav $pagenav = 1; $settings = explode("\n", $row->data1); if (count($settings) > 8 && $this->trim($settings[8])) { $pagenav = $settings[8]; } // export the javascript parameters $qcode .= nl() . 'ff_queryCurrPage[' . $row->id . '] = 1;' . nl() . 'ff_queryPageSize[' . $row->id . '] = ' . $row->height . ';' . nl() . 'ff_queryCheckbox[' . $row->id . '] = ' . $checkbox . ';' . nl() . 'ff_queryHeader[' . $row->id . '] = ' . $header . ';' . nl() . 'ff_queryPagenav[' . $row->id . '] = ' . $pagenav . ';' . nl() . 'ff_queryCols[' . $row->id . '] = ['; for ($c = 0; $c < $colcnt; $c++) { if ($cols[$c]->thspan > 0) { $qcode .= '1'; } else { $qcode .= '0'; } if ($c < $colcnt - 1) { $qcode .= ','; } } // for $qcode .= '];' . nl(); // execute the query and export it to javascript $this->queryRows['ff_' . $row->id] = array(); $this->execQuery($row, $this->queryRows['ff_' . $row->id], $cols); $qcode .= 'ff_queryRows[' . $row->id . '] = ' . $this->expJsValue($this->queryRows['ff_' . $row->id]) . ';' . nl(); unset($cols); if ($this->bury()) { return; } } // if $this->addFunction($row->script1cond, $row->script1id, 'ff_' . $row->name . '_init', $row->script1code, $library, $linked, 'e', $row->id, 1); if ($this->bury()) { unset($row); return; } $this->addFunction($row->script2cond, $row->script2id, 'ff_' . $row->name . '_action', $row->script2code, $library, $linked, 'e', $row->id, 1); if ($this->bury()) { unset($row); return; } $this->addFunction($row->script3cond, $row->script3id, 'ff_' . $row->name . '_validate', $row->script3code, $library, $linked, 'e', $row->id, 1); if ($this->bury()) { ob_end_clean(); return; } if ($row->type == 'Static Text/HTML') { $this->linkcode('#scanonly', $library, $linked, $row->data1); } unset($row); if ($this->bury()) { return; } } // for if ($icons > 0) { $this->linkcode('ff_hideIconBorder', $library, $linked, 'function ff_hideIconBorder(element)' . nl() . '{' . nl() . ' element.style.border = "none";' . nl() . '} // ff_hideIconBorder'); if ($this->bury()) { return; } $this->linkcode('ff_dispIconBorder', $library, $linked, 'function ff_dispIconBorder(element)' . nl() . '{' . nl() . ' element.style.border = "1px outset";' . nl() . '} // ff_dispIconBorder'); if ($this->bury()) { return; } } // if if ($qcode != '') { $library[] = array('ff_queryCurrPage', 'var ff_queryCurrPage = new Array();'); $library[] = array('ff_queryPageSize', 'var ff_queryPageSize = new Array();'); $library[] = array('ff_queryCols', 'var ff_queryCols = new Array();'); $library[] = array('ff_queryCheckbox', 'var ff_queryCheckbox = new Array();'); $library[] = array('ff_queryHeader', 'var ff_queryHeader = new Array();'); $library[] = array('ff_queryPagenav', 'var ff_queryPagenav = new Array();'); $library[] = array('ff_queryRows', 'var ff_queryRows = new Array();' . nl() . $qcode); $library[] = array('ff_selectAllQueryRows', 'function ff_selectAllQueryRows(id,checked)' . nl() . '{' . nl() . ' if (!ff_queryCheckbox[id]) return;' . nl() . ' var cnt = ff_queryRows[id].length;' . nl() . ' var pagesize = ff_queryPageSize[id];' . nl() . ' if (pagesize > 0) {' . nl() . ' lastpage = parseInt((cnt+pagesize-1)/pagesize);' . nl() . ' if (lastpage == 1)' . nl() . ' pagesize = cnt;' . nl() . ' else {' . nl() . ' var currpage = ff_queryCurrPage[id];' . nl() . ' var p;' . nl() . ' for (p = 1; p < currpage; p++) cnt -= pagesize;' . nl() . ' if (cnt > pagesize) cnt = pagesize;' . nl() . ' } // if' . nl() . ' } // if' . nl() . ' var curr;' . nl() . ' for (curr = 0; curr < cnt; curr++)' . nl() . ' document.getElementById(\'ff_cb\'+id+\'_\'+curr).checked = checked;' . nl() . ' for (curr = cnt; curr < pagesize; curr++)' . nl() . ' document.getElementById(\'ff_cb\'+id+\'_\'+curr).checked = false;' . nl() . ' if (ff_queryCheckbox[id]==1)' . nl() . ' document.getElementById(\'ff_cb\'+id).checked = checked;' . nl() . '} // ff_selectAllQueryRows'); $code = 'function ff_dispQueryPage(id,page)' . nl() . '{' . nl() . ' var forced = false;' . nl() . ' if (arguments.length>2) forced = arguments[2];' . nl() . ' var qrows = ff_queryRows[id];' . nl() . ' var cnt = qrows.length;' . nl() . ' var currpage = ff_queryCurrPage[id];' . nl() . ' var pagesize = ff_queryPageSize[id];' . nl() . ' var pagenav = ff_queryPagenav[id];' . nl() . ' var lastpage = 1;' . nl() . ' if (pagesize > 0) {' . nl() . ' lastpage = parseInt((cnt+pagesize-1)/pagesize);' . nl() . ' if (lastpage == 1) pagesize = cnt;' . nl() . ' } // if' . nl() . ' if (page < 1) page = 1;' . nl() . ' if (page > lastpage) page = lastpage;' . nl() . ' if (!forced && page == currpage) return;' . nl() . ' var p, c;' . nl() . ' for (p = 1; p < page; p++) cnt -= pagesize;' . nl() . ' if (cnt > pagesize) cnt = pagesize;' . nl() . ' var start = (page-1) * pagesize;' . nl() . ' var rows = document.getElementById(\'ff_elem\'+id).rows;' . nl() . ' var cols = ff_queryCols[id];' . nl() . ' var checkbox = ff_queryCheckbox[id];' . nl() . ' var header = ff_queryHeader[id];' . nl() . ' for (p = 0; p < cnt; p++) {' . nl() . ' var qrow = qrows[start+p];' . nl() . ' var row = rows[header+p];' . nl() . ' var cc = 0;' . nl() . ' for (c = 0; c < cols.length; c++)' . nl() . ' if (cols[c]) {' . nl() . ' if (c==0 && checkbox>0) {' . nl() . ' document.getElementById(\'ff_cb\'+id+\'_\'+p).value = qrow[c];' . nl() . ' cc++;' . nl() . ' } else' . nl() . ' row.cells[cc++].innerHTML = qrow[c];' . nl() . ' } // if' . nl() . ' row.style.display = \'\';' . nl() . ' } // for' . nl() . ' for (p = cnt; p < pagesize; p++) {' . nl() . ' var row = rows[p+header];' . nl() . ' row.style.display = \'none\';' . nl() . ' } // for' . nl() . ' if (pagenav > 0 && pagesize > 0) {' . nl() . ' var navi = \'\';' . nl() . ' if (pagenav<=4) {' . nl() . ' if (page>1) navi += \'<a href="javascript:ff_dispQueryPage(\'+id+\',1);">\';' . nl() . ' navi += \'<<\';' . nl() . ' if (pagenav<=2) navi += \' ' . BFText::_('COM_BREEZINGFORMS_PROCESS_PAGESTART') . '\';' . nl() . ' if (page>1) navi += \'<\\/a>\';' . nl() . ' navi += \' \';' . nl() . ' if (page>1) navi += \'<a href="javascript:ff_dispQueryPage(\'+id+\',\'+(page-1)+\');">\';' . nl() . ' navi += \'<\';' . nl() . ' if (pagenav<=2) navi += \' ' . BFText::_('COM_BREEZINGFORMS_PROCESS_PAGEPREV') . '\';' . nl() . ' if (page>1) navi += \'<\\/a>\';' . nl() . ' navi += \' \';' . nl() . ' } // if' . nl() . ' if (pagenav % 2) {' . nl() . ' for (p = 1; p <= lastpage; p++)' . nl() . ' if (p == page) ' . nl() . ' navi += p+\' \';' . nl() . ' else' . nl() . ' navi += \'<a href="javascript:ff_dispQueryPage(\'+id+\',\'+p+\');">\'+p+\'<\\/a> \';' . nl() . ' } // if' . nl() . ' if (pagenav<=4) {' . nl() . ' if (page<lastpage) navi += \'<a href="javascript:ff_dispQueryPage(\'+id+\',\'+(page+1)+\');">\';' . nl() . ' if (pagenav<=2) navi += \'' . BFText::_('COM_BREEZINGFORMS_PROCESS_PAGENEXT') . ' \';' . nl() . ' navi += \'>\';' . nl() . ' if (page<lastpage) navi += \'<\\/a>\';' . nl() . ' navi += \' \';' . nl() . ' if (page<lastpage) navi += \'<a href="javascript:ff_dispQueryPage(\'+id+\',\'+lastpage+\');">\';' . nl() . ' if (pagenav<=2) navi += \'' . BFText::_('COM_BREEZINGFORMS_PROCESS_PAGEEND') . ' \';' . nl() . ' navi += \'>>\';' . nl() . ' if (page<lastpage) navi += \'<\\/a>\';' . nl() . ' } // if' . nl() . ' rows[header+pagesize].cells[0].innerHTML = navi;' . nl() . ' } // if' . nl() . ' ff_queryCurrPage[id] = page;' . nl(); if ($qcheckboxes) { $code .= ' if (checkbox) ff_selectAllQueryRows(id, false);' . nl(); } if ($this->formrow->heightmode > 0) { $code .= ' ff_resizepage(' . $this->formrow->heightmode . ', ' . $this->formrow->height . ');' . nl(); } if ($this->inframe) { $code .= ' parent.window.scrollTo(0,0);' . nl(); } $code .= ' window.scrollTo(0,0);' . nl() . '} // ff_dispQueryPage'; $this->linkcode('ff_dispQueryPage', $library, $linked, $code); if ($this->bury()) { return; } } // if echo '//-->' . nl() . '</script>' . nl(); if ($icons > 0) { echo '<script language="JavaScript" src="' . $ff_mossite . '/components/com_breezingforms/libraries/js/joomla.javascript.js" type="text/javascript"></script>' . nl(); } if ($tooltips > 0) { echo '<script language="Javascript" src="' . $ff_mossite . '/components/com_breezingforms/libraries/js/overlib_mini.js" type="text/javascript"></script>' . nl(); if ($this->inframe) { echo '<div id="overDiv" style="position:absolute;visibility:hidden;z-index:1000;"></div>' . nl(); } } // if if (!$this->inline) { $url = $this->inframe ? $ff_mossite . '/index.php?format=html&tmpl=component' : ($this->runmode == _FF_RUNMODE_FRONTEND ? JURI::getInstance()->toString() : 'index.php?format=html' . (JRequest::getCmd('tmpl', '') ? '&tmpl=' . JRequest::getCmd('tmpl', '') : JURI::getInstance()->toString())); $params = ' action="' . $url . '"' . ' method="post"' . ' name="' . $this->form_id . '"' . ' id="' . $this->form_id . '"' . ' enctype="multipart/form-data"'; if ($this->formrow->class2 != '') { $params .= ' class="' . $this->getClassName($this->formrow->class2) . '"'; } echo '<form data-ajax="false" ' . $params . ' accept-charset="utf-8" onsubmit="return false;" class="bfQuickMode">' . nl(); } // if $js = ''; $cbJs = ''; if ($this->editable && $cbRecord === null) { $db = JFactory::getDBO(); $db->setQuery("Select id, form From #__facileforms_records Where form = " . $db->Quote($this->form) . " And user_id = " . $db->Quote(JFactory::getUser()->get('id', -1)) . " And user_id <> 0 And archived = 0 Order By id Desc Limit 1"); $recordsResult = $db->loadObjectList(); if (count($recordsResult) != 0) { $db->setQuery("Select * From #__facileforms_subrecords Where record = " . $recordsResult[0]->id . ""); $recordEntries = $db->loadObjectList(); $js = ''; foreach ($recordEntries as $recordEntry) { switch ($recordEntry->type) { case 'Textarea': case 'Text': case 'Hidden Input': case 'Calendar': $js .= 'if(typeof JQuery != "undefined"){JQuery("[name=\\"ff_nm_' . $recordEntry->name . '[]\\"]").val("' . str_replace("\n", "\\n", str_replace("\r", "\\r", addslashes($recordEntry->value))) . '");}else{'; $js .= 'if(document.getElementById("ff_elem' . $recordEntry->element . '"))document.getElementById("ff_elem' . $recordEntry->element . '").value="' . str_replace("\n", "\\n", str_replace("\r", "\\r", addslashes($recordEntry->value))) . '";' . "\n"; $js .= '}'; break; case 'Checkbox': if (!empty($recordEntry->value)) { $js .= 'if(document.getElementById("ff_elem' . $recordEntry->element . '"))document.getElementById("ff_elem' . $recordEntry->element . '").checked = true;' . "\n"; } break; case 'Checkbox Group': $js .= ' for(var i = 0;i < document.ff_form' . $this->form . '.elements.length;i++){ if(document.ff_form' . $this->form . '.elements[i].type == "checkbox" && document.ff_form' . $this->form . '.elements[i].name == "ff_nm_' . $recordEntry->name . '[]" && document.ff_form' . $this->form . '.elements[i].value == "' . str_replace("\n", "\\n", str_replace("\r", "\\r", addslashes($recordEntry->value))) . '"){ document.ff_form' . $this->form . '.elements[i].checked = true; } }' . "\n"; break; case 'Radio Button': case 'Radio Group': $js .= ' for(var i = 0;i < document.ff_form' . $this->form . '.elements.length;i++){ if(document.ff_form' . $this->form . '.elements[i].type == "radio" && document.ff_form' . $this->form . '.elements[i].name == "ff_nm_' . $recordEntry->name . '[]" && document.ff_form' . $this->form . '.elements[i].value == "' . str_replace("\n", "\\n", str_replace("\r", "\\r", addslashes($recordEntry->value))) . '"){ document.ff_form' . $this->form . '.elements[i].checked = true; } }' . "\n"; break; case 'Select List': $js .= 'for(var i = 0; i < document.getElementById("ff_elem' . $recordEntry->element . '").options.length; i++){ if(document.getElementById("ff_elem' . $recordEntry->element . '").options[i].value == "' . str_replace("\n", "\\n", str_replace("\r", "\\r", addslashes($recordEntry->value))) . '"){ document.getElementById("ff_elem' . $recordEntry->element . '").options[i].selected = true; } }' . "\n"; break; } } echo ' <script type="text/javascript"> <!--' . nl() . ' function bfLoadEditable(){ ' . $js . ' // legacy seccode removal for(var i = 0;i < document.ff_form' . $this->form . '.elements.length;i++){ if(document.ff_form' . $this->form . '.elements[i].name == "ff_nm_seccode[]"){ document.ff_form' . $this->form . '.elements[i].value = ""; } } } ' . nl() . '//--> </script> ' . nl(); } } // CONTENTBUILDER BEGIN if ($cbRecord !== null) { require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_contentbuilder' . DS . 'classes' . DS . 'contentbuilder.php'; $cbNonEditableFields = contentbuilder::getListNonEditableElements($cbResult['data']['id']); $cbFlashUploadValidationOverride = ''; foreach ($cbRecord as $cbEntry) { if (!in_array($cbEntry->recElementId, $cbNonEditableFields)) { switch ($cbEntry->recType) { case 'File Upload': if (trim($this->formrow->template_code_processed) == 'QuickMode') { if ($cbFlashUploadValidationOverride == '') { $cbJs .= ' function ff_flashupload_not_empty(element, message) { if(typeof bfSummarizers == "undefined") { alert("Flash upload validation only available in QuickMode!"); return ""} if(JQuery("#bfFlashFileQueue"+element.id.split("ff_elem")[1]).html() != "" || cbFlashElemCnt[element.id] != 0 ) return ""; if (message=="") message = "Please enter "+element.name+".\\n"; ff_validationFocus(element.name); return message; } '; } require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'classes' . DS . 'contentbuilder_helpers.php'; $cbOut = ''; $cbFiles = explode("\n", str_replace("\r", "", $cbEntry->recValue)); $i = 0; $cnt = count($cbFiles); $cbJs .= ' cbFlashElemCnt["ff_elem' . $cbEntry->recElementId . '"] = ' . $cnt . '; '; $cbDeac = ''; foreach ($cbFiles as $cbFile) { if (trim($cbFile)) { $cbOut .= '<div><input type=\\"checkbox\\" onchange=\\"bfCheckUploadValidation(\'ff_elem' . $cbEntry->recElementId . '\', this, \'ff_nm_' . $cbEntry->recName . '[]\')\\" value=\\"1\\" name=\\"cb_delete_' . $cbEntry->recElementId . '[' . $i . ']\\" id=\\"cb_delete_' . $cbEntry->recElementId . '_' . $i . '\\"/> <label style=\\"margin-left: 5px; float: none !important; display: inline !important;\\" for=\\"cb_delete_' . $cbEntry->recElementId . '_' . $i . '\\">' . addslashes(basename(contentbuilder_wordwrap($cbFile, 150, "<br>", true))) . '</label></div>'; if ($cbDeac == '') { $cbDeac = 'bfDeactivateField["ff_nm_' . $cbEntry->recName . '[]"]=true;' . nl(); } $i++; } } $js .= $cbDeac; $js .= ' if (document.createTextNode){ if(!document.getElementById("bfFlashFileQueue' . $cbEntry->recElementId . '")){ var mydiv = document.createElement("div"); mydiv.innerHTML = "<br/>' . $cbOut . '"; JQuery("#ff_elem' . $cbEntry->recElementId . '_files").append(mydiv); } else { var mydiv = document.createElement("div"); mydiv.innerHTML = "' . $cbOut . '"; mydiv.innerHTML = "<br/>" + mydiv.innerHTML; JQuery("#bfFlashFileQueue' . $cbEntry->recElementId . '").after(mydiv); } }' . nl(); } break; case 'Textarea': case 'Text': case 'Hidden Input': case 'Calendar': $js .= 'if(typeof JQuery != "undefined"){'; $js .= 'JQuery("[name=\\"ff_nm_' . $cbEntry->recName . '[]\\"]").val("' . str_replace("\n", "\\n", str_replace("\r", "\\r", addslashes($cbEntry->recValue))) . '")'; $js .= '}else{if(document.getElementById("ff_elem' . $cbEntry->recElementId . '"))document.getElementById("ff_elem' . $cbEntry->recElementId . '").value="' . str_replace("\n", "\\n", str_replace("\r", "\\r", addslashes($cbEntry->recValue))) . '";}' . nl(); break; case 'Checkbox': case 'Checkbox Group': $cbValues = explode(',', $cbEntry->recValue); foreach ($cbValues as $cbValue) { $cbValue = trim($cbValue); $js .= ' for(var i = 0;i < document.ff_form' . $this->form . '.elements.length;i++){ if(document.ff_form' . $this->form . '.elements[i].type == "checkbox" && document.ff_form' . $this->form . '.elements[i].name == "ff_nm_' . $cbEntry->recName . '[]" && document.ff_form' . $this->form . '.elements[i].value == "' . str_replace("\n", "\\n", str_replace("\r", "\\r", addslashes($cbValue))) . '"){ document.ff_form' . $this->form . '.elements[i].checked = true; } }' . nl(); } break; case 'Radio Button': case 'Radio Group': $cbValues = explode(',', $cbEntry->recValue); foreach ($cbValues as $cbValue) { $cbValue = trim($cbValue); $js .= ' for(var i = 0;i < document.ff_form' . $this->form . '.elements.length;i++){ if(document.ff_form' . $this->form . '.elements[i].type == "radio" && document.ff_form' . $this->form . '.elements[i].name == "ff_nm_' . $cbEntry->recName . '[]" && document.ff_form' . $this->form . '.elements[i].value == "' . str_replace("\n", "\\n", str_replace("\r", "\\r", addslashes($cbValue))) . '"){ document.ff_form' . $this->form . '.elements[i].checked = true; } }' . nl(); } break; case 'Select List': $cbValues = explode(',', $cbEntry->recValue); foreach ($cbValues as $cbValue) { $cbValue = trim($cbValue); $js .= 'for(var i = 0; i < document.getElementById("ff_elem' . $cbEntry->recElementId . '").options.length; i++){ if(document.getElementById("ff_elem' . $cbEntry->recElementId . '").options[i].value == "' . str_replace("\n", "\\n", str_replace("\r", "\\r", addslashes($cbValue))) . '"){ document.getElementById("ff_elem' . $cbEntry->recElementId . '").options[i].selected = true; } }' . nl(); } break; } } } echo ' <script type="text/javascript"> <!--' . nl() . ' var cbFlashElemCnt = new Array(); function bfCheckUploadValidation(id, obj, deactivatable){ if(obj.checked){ cbFlashElemCnt[id]--; }else{ cbFlashElemCnt[id]++; } if(cbFlashElemCnt[id] == 0){ bfDeactivateField[deactivatable]=false; }else{ bfDeactivateField[deactivatable]=true; } } ' . $cbJs . ' function bfLoadContentBuilderEditable(){ ' . $js . ' // legacy seccode removal for(var i = 0;i < document.ff_form' . $this->form . '.elements.length;i++){ if(document.ff_form' . $this->form . '.elements[i].name == "ff_nm_seccode[]"){ document.ff_form' . $this->form . '.elements[i].value = ""; } } } ' . nl() . '//--> </script> ' . nl(); } $cbNonEditableFields = array(); if ($cbForm !== null) { require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_contentbuilder' . DS . 'classes' . DS . 'contentbuilder.php'; $cbNonEditableFields = contentbuilder::getListNonEditableElements($cbResult['data']['id']); if (count($cbNonEditableFields)) { JFactory::getDocument()->addScriptDeclaration('<!--' . nl() . 'var bfDeactivateField = new Array();' . nl() . '//-->'); echo '<script type="text/javascript">' . nl(); echo '<!--' . nl(); echo 'function bfDisableContentBuilderFields(){' . nl(); } foreach ($cbNonEditableFields as $cbNonEditableField) { echo 'if(typeof document.getElementById("ff_elem' . $cbNonEditableField . '").disabled != "undefined"){' . nl(); echo 'bfCbName = document.getElementById("ff_elem' . $cbNonEditableField . '").name;' . nl(); echo 'if(typeof document.getElementsByName != "undefined"){' . nl(); echo 'bfCbElements = document.getElementsByName(bfCbName);' . nl(); echo 'for(var i = 0; i < bfCbElements.length; i++){' . nl(); echo 'if(typeof bfCbElements[i].disabled != "undefined"){' . nl(); echo 'bfCbElements[i].disabled = true;' . nl(); echo '}' . nl(); echo 'bfDeactivateField[bfCbName]=true;' . nl(); echo 'if(typeof JQuery != "undefined"){ JQuery("#bfElemWrap' . $cbNonEditableField . '").css("display", "none"); }' . nl(); echo '}' . nl(); echo '}else{' . nl(); echo 'document.getElementById("ff_elem' . $cbNonEditableField . '").disabled = true;' . nl(); echo 'bfDeactivateField[bfCbName]=true;' . nl(); echo 'if(typeof JQuery != "undefined"){ JQuery("#bfElemWrap' . $cbNonEditableField . '").css("display", "none"); }' . nl(); echo '}' . nl(); echo '}' . nl(); } if (count($cbNonEditableFields)) { echo '}' . nl(); echo '//-->' . nl(); echo '</script>' . nl(); } } // CONTENTBUILDER END if (trim($this->formrow->template_code_processed) == '') { for ($i = 0; $i < $this->rowcount; $i++) { $row =& $this->rows[$i]; if (!is_numeric($row->width)) { $row->width = 0; } if (!is_numeric($row->height)) { $row->height = 0; } if ($row->type != 'Query List') { $data1 = $this->replaceCode($row->data1, "data1 of {$row->name}", 'e', $row->id, 0); if ($this->bury()) { return; } $data2 = $this->replaceCode($row->data2, "data2 of {$row->name}", 'e', $row->id, 0); if ($this->bury()) { return; } $data3 = $this->replaceCode($row->data3, "data3 of {$row->name}", 'e', $row->id, 0); if ($this->bury()) { return; } } // if $attribs = 'position:absolute;z-index:' . $i . ';'; if ($row->posx >= 0) { $attribs .= 'left:' . $row->posx; } else { $attribs .= 'right:' . -$row->posx; } if ($row->posxmode) { $attribs .= '%;'; } else { $attribs .= 'px;'; } if ($row->posy >= 0) { $attribs .= 'top:' . $row->posy; } else { $attribs .= 'bottom:' . -$row->posy; } if ($row->posymode) { $attribs .= '%;'; } else { $attribs .= 'px;'; } $class1 = ''; $class2 = ''; if ($row->type == 'Select List') { if ($row->class1 != '') { $class1 = ' class="' . $this->getClassName($row->class1) . '"'; } if ($row->class2 != '') { $class2 = ' class="' . $this->getClassName($row->class2) . ' chzn-done"'; } else { $class2 = ' class="chzn-done"'; } } else { if ($row->class1 != '') { $class1 = ' class="' . $this->getClassName($row->class1) . '"'; } if ($row->class2 != '') { $class2 = ' class="' . $this->getClassName($row->class2) . '"'; } } switch ($row->type) { case 'Static Text/HTML': case 'Rectangle': case 'Image': if ($row->height > 0) { $attribs .= 'height:' . $row->height; if ($row->heightmode) { $attribs .= '%;'; } else { $attribs .= 'px;'; } } // if // if case 'Query List': if ($row->width > 0) { $attribs .= 'width:' . $row->width; if ($row->widthmode) { $attribs .= '%;'; } else { $attribs .= 'px;'; } } // if // if default: break; } // switch if ($row->page != $this->page) { $attribs .= 'visibility:hidden;'; } switch ($row->type) { case 'Static Text/HTML': echo indentc(1) . '<div id="ff_div' . $row->id . '" style="' . $attribs . '"' . $class1 . '>' . $data1 . '</div>' . nl(); break; case 'Rectangle': if ($data1 != '') { $attribs .= 'border:' . $data1 . ';'; } if ($data2 != '') { $attribs .= 'background-color:' . $data2 . ';'; } echo indentc(1) . '<div id="ff_div' . $row->id . '" style="font-size:0px;' . $attribs . '"' . $class1 . '></div>' . nl(); break; case 'Image': echo indentc(1) . '<div id="ff_div' . $row->id . '" style="' . $attribs . '"' . $class1 . '>' . nlc(); $attribs = ''; if ($row->width > 0) { $attribs .= 'width="' . $row->width . '" '; } if ($row->height > 0) { $attribs .= 'height="' . $row->height . '" '; } echo indentc(2) . '<img id="ff_elem' . $row->id . '" src="' . $data1 . '" alt="' . $data2 . '" border="0" ' . $attribs . $class2 . '/>' . nlc(); echo indentc(1) . '</div>' . nl(); break; case 'Tooltip': echo indentc(1) . '<div id="ff_div' . $row->id . '" style="' . $attribs . '" onMouseOver="return overlib(\'' . expstring($data2) . '\',CAPTION,\'' . $row->title . '\',BELOW,RIGHT);" onMouseOut="return nd();"' . $class1 . '>' . nlc(); switch ($row->flag1) { case 0: $url = $ff_mossite . '/components/com_breezingforms/images/tooltip.png'; break; case 1: $url = $ff_mossite . '/components/com_breezingforms/images/warning.png'; break; default: $url = $data1; } // switch echo indentc(2) . '<img src="' . $url . '" alt="" border="0"' . $class2 . '/>' . nlc(); echo indentc(1) . '</div>' . nl(); break; case 'Hidden Input': echo indentc(1) . '<input id="ff_elem' . $row->id . '" type="hidden" name="ff_nm_' . $row->name . '[]" value="' . $data1 . '" />' . nl(); break; case 'Checkbox': echo indentc(1) . '<div id="ff_div' . $row->id . '" style="' . $attribs . '"' . $class1 . '>' . nlc(); $attribs = ''; if ($row->flag1) { $attribs .= ' checked="checked"'; } if ($row->flag2) { $attribs .= ' disabled="disabled"'; } $attribs .= $this->script2clause($row); echo indentc(2) . '<input id="ff_elem' . $row->id . '" type="checkbox" name="ff_nm_' . $row->name . '[]" value="' . $data1 . '"' . $attribs . $class2 . '/><label id="ff_lbl' . $row->id . '" for="ff_elem' . $row->id . '"> ' . $data2 . '</label>' . nlc(); echo indentc(1) . '</div>' . nl(); break; case 'Radio Button': echo indentc(1) . '<div id="ff_div' . $row->id . '" style="' . $attribs . '"' . $class1 . '>' . nlc(); $attribs = ''; if ($row->flag1) { $attribs .= ' checked="checked"'; } if ($row->flag2) { $attribs .= ' disabled="disabled"'; } $attribs .= $this->script2clause($row); echo indentc(2) . '<input id="ff_elem' . $row->id . '" type="radio" name="ff_nm_' . $row->name . '[]" value="' . $data1 . '"' . $attribs . $class2 . '/><label id="ff_lbl' . $row->id . '" for="ff_elem' . $row->id . '"> ' . $data2 . '</label>' . nlc(); echo indentc(1) . '</div>' . nl(); break; case 'Regular Button': echo indentc(1) . '<div id="ff_div' . $row->id . '" style="' . $attribs . '"' . $class1 . '>' . nlc(); $attribs = ''; if ($row->flag2) { $attribs .= ' disabled="disabled"'; } $attribs .= $this->script2clause($row); echo indentc(2) . '<input id="ff_elem' . $row->id . '" type="button" name="ff_nm_' . $row->name . '" value="' . $data2 . '"' . $attribs . $class2 . '/>' . nlc(); echo indentc(1) . '</div>' . nl(); break; case 'Graphic Button': echo indentc(1) . '<div id="ff_div' . $row->id . '" style="' . $attribs . '"' . $class1 . '>' . nlc(); $attribs = ''; if ($row->flag2) { $attribs .= ' disabled="disabled"'; } $attribs .= $this->script2clause($row); echo indentc(2) . '<button id="ff_elem' . $row->id . '" type="button" name="ff_nm_' . $row->name . '" value="' . $data2 . '"' . $attribs . $class2 . '>' . nlc(); $attribs = ''; if ($row->width > 0) { $attribs .= 'width="' . $row->width . '" '; } if ($row->height > 0) { $attribs .= 'height="' . $row->height . '" '; } switch ($row->flag1) { case 0: // none echo indentc(3) . '<table cellpadding="0" cellspacing="6" border="0">' . nlc(); echo indentc(4) . '<tr><td>' . nlc(); echo indentc(5) . '<img id="ff_img' . $row->id . '" src="' . $data1 . '" alt="' . $data2 . '" border="0" ' . $attribs . '/>' . nlc(); echo indentc(4) . '</td></tr>' . nlc(); echo indentc(3) . '</table>' . nlc(); break; case 1: // below echo indentc(3) . '<table cellpadding="0" cellspacing="6" border="0">' . nlc(); echo indentc(4) . '<tr><td nowrap style="text-align:center">' . nlc(); echo indentc(5) . '<img id="ff_img' . $row->id . '" src="' . $data1 . '" alt="" border="0" ' . $attribs . '/><br/>' . nlc(); echo indentc(5) . $data2 . nlc(); echo indentc(4) . '</td></tr>' . nlc(); echo indentc(3) . '</table>' . nlc(); break; case 2: // above echo indentc(3) . '<table cellpadding="0" cellspacing="6" border="0">' . nlc(); echo indentc(4) . '<tr><td nowrap style="text-align:center">' . nlc(); echo indentc(5) . $data2 . '<br/>' . nlc(); echo indentc(5) . '<img id="ff_img' . $row->id . '" src="' . $data1 . '" alt="" border="0" ' . $attribs . '/>' . nlc(); echo indentc(4) . '</td></tr>' . nlc(); echo indentc(3) . '</table>.nlc()'; break; case 3: // left echo indentc(3) . '<table cellpadding="0" cellspacing="6" border="0">' . nlc(); echo indentc(4) . '<tr>' . nlc(); echo indentc(5) . '<td>' . $data2 . '</td>' . nlc(); echo indentc(5) . '<td><img id="ff_img' . $row->id . '" src="' . $data1 . '" alt="" border="0" ' . $attribs . '/></td>' . nlc(); echo indentc(4) . '</tr>' . nlc(); echo indentc(3) . '</table>' . nlc(); break; default: // assume right echo indentc(3) . '<table cellpadding="0" cellspacing="6" border="0">' . nlc(); echo indentc(4) . '<tr>' . nlc(); echo indentc(5) . '<td><img id="ff_img' . $row->id . '" src="' . $data1 . '" alt="" border="0" ' . $attribs . '/></td>' . nlc(); echo indentc(5) . '<td>' . $data2 . '</td>' . nlc(); echo indentc(4) . '</tr>' . nlc(); echo indentc(3) . '</table>' . nlc(); break; } // switch echo indentc(2) . '</button>' . nlc(); echo indentc(1) . '</div>' . nl(); break; case 'Icon': if ($row->flag2) { echo indentc(1) . '<div id="ff_div' . $row->id . '" onmouseout="ff_hideIconBorder(this);" onmouseover="ff_dispIconBorder(this);" style="padding:3px;' . $attribs . '"' . $class1 . '>' . nlc(); } else { echo indentc(1) . '<div id="ff_div' . $row->id . '" style="' . $attribs . '"' . $class1 . '>' . nlc(); } $swap = ''; if ($data3 != '') { $swap = 'onmouseout="MM_swapImgRestore();" onmouseover="MM_swapImage(\'ff_img' . $row->id . '\',\'\',\'' . $data3 . '\',1);" '; } $swap .= $this->script2clause($row); $attribs = ''; if ($row->width > 0) { $attribs .= 'width="' . $row->width . '" '; } if ($row->height > 0) { $attribs .= 'height="' . $row->height . '" '; } switch ($row->flag1) { case 0: // none echo indentc(2) . '<span id="ff_elem' . $row->id . '" ' . $swap . '>' . nlc(); echo indentc(3) . '<img id="ff_img' . $row->id . '" src="' . $data1 . '" alt="" border="0" align="middle" ' . $attribs . $class2 . '/>' . nlc(); echo indentc(2) . '</span>' . nlc(); break; case 1: // below echo indentc(2) . '<table id="ff_elem' . $row->id . '" cellpadding="1" cellspacing="0" border="0" ' . $swap . '>' . nlc(); echo indentc(3) . '<tr><td style="text-align:center;"><img id="ff_img' . $row->id . '" src="' . $data1 . '" alt="" border="0" align="middle" ' . $attribs . $class2 . '/></td></tr>' . nlc(); echo indentc(3) . '<tr><td style="text-align:center;">' . $data2 . '</td></tr>' . nlc(); echo indentc(2) . '</table>' . nlc(); break; case 2: // above echo indentc(2) . '<table id="ff_elem' . $row->id . '" cellpadding="2" cellspacing="0" border="0" ' . $swap . '>' . nlc(); echo indentc(3) . '<tr><td style="text-align:center;">' . $data2 . '</td></tr>' . nlc(); echo indentc(3) . '<tr><td style="text-align:center;"><img id="ff_img' . $row->id . '" src="' . $data1 . '" alt="" border="0" align="middle" ' . $attribs . $class2 . '/></td></tr>' . nlc(); echo indentc(2) . '</table>' . nlc(); break; case 3: // left echo indentc(2) . '<span id="ff_elem' . $row->id . '" ' . $swap . ' style="vertical-align:middle;">' . nlc(); echo indentc(3) . $data2 . ' <img id="ff_img' . $row->id . '" src="' . $data1 . '" alt="" border="0" align="middle" ' . $attribs . $class2 . '/>' . nlc(); echo indentc(2) . '</span>' . nlc(); break; default: // assume right echo indentc(2) . '<span id="ff_elem' . $row->id . '" ' . $swap . ' style="vertical-align:middle;">' . nlc(); echo indentc(3) . '<img id="ff_img' . $row->id . '" src="' . $data1 . '" alt="" border="0" align="middle" ' . $attribs . $class2 . '/> ' . $data2 . nlc(); echo indentc(2) . '</span>' . nlc(); break; } // switch echo indentc(1) . '</div>' . nl(); break; case 'Select List': echo indentc(1) . '<div id="ff_div' . $row->id . '" style="' . $attribs . '"' . $class1 . '>' . nlc(); $attribs = ''; $styles = ''; if ($row->width > 0) { $styles .= 'width:' . $row->width . 'px;'; } if ($row->height > 0) { $styles .= 'height:' . $row->height . 'px;'; } if ($row->flag1) { $attribs .= ' multiple="multiple"'; } if ($row->flag2) { $attribs .= ' disabled="disabled"'; } $attribs .= $this->script2clause($row); if ($data1 != '') { $attribs .= ' size="' . $data1 . '"'; } if ($styles != '') { $attribs .= ' style="' . $styles . '"'; } echo indentc(2) . '<select id="ff_elem' . $row->id . '" name="ff_nm_' . $row->name . '[]" ' . $attribs . $class2 . '>' . nlc(); $options = explode('\\n', preg_replace('/([\\r\\n])/s', '\\n', $data2)); $cnt = count($options); for ($o = 0; $o < $cnt; $o++) { $opt = explode(";", $options[$o]); $selected = ''; switch (count($opt)) { case 0: break; case 1: if ($this->trim($opt[0])) { $selected = '0'; $value = $text = $opt[0]; } // if break; case 2: $selected = $opt[0]; $value = $text = $opt[1]; break; default: $selected = $opt[0]; $text = $opt[1]; $value = $opt[2]; } // switch if ($this->trim($selected)) { $attribs = ''; if ($this->trim($value)) { if ($value == '""' || $value == "''") { $value = ''; } $attribs .= ' value="' . htmlspecialchars($value, ENT_QUOTES) . '"'; } // if if ($selected == 1) { $attribs .= ' selected="selected"'; } echo indentc(3) . '<option' . $attribs . '>' . htmlspecialchars(trim($text), ENT_QUOTES) . '</option>' . nlc(); } // if } // for echo indentc(2) . '</select>' . nlc(); echo indentc(1) . '</div>' . nl(); break; case 'Text': echo indentc(1) . '<div id="ff_div' . $row->id . '" style="' . $attribs . '"' . $class1 . '>' . nlc(); $attribs = ''; if ($row->width > 0) { if ($row->widthmode > 0) { $attribs .= ' style="width:' . $row->width . 'px;"'; } else { $attribs .= ' size="' . $row->width . '"'; } } // if if ($row->height > 0) { $attribs .= ' maxlength="' . $row->height . '"'; } if ($row->flag1) { $attribs .= ' type="password"'; } else { $attribs .= ' type="text"'; } switch ($row->flag2) { case 1: $attribs .= ' disabled="disabled"'; break; case 2: $attribs .= ' readonly="readonly"'; break; default: break; } // switch $attribs .= $this->script2clause($row); echo indentc(2) . '<input id="ff_elem' . $row->id . '"' . $attribs . ' name="ff_nm_' . $row->name . '[]" value="' . $data1 . '"' . $class2 . '/>' . nlc(); echo indentc(1) . '</div>' . nl(); break; case 'Textarea': echo indentc(1) . '<div id="ff_div' . $row->id . '" style="' . $attribs . '"' . $class1 . '>' . nlc(); $attribs = ''; $styles = ''; switch ($row->flag2) { case 1: $attribs .= ' disabled="disabled"'; break; case 2: $attribs .= ' readonly="readonly"'; break; default: break; } // switch if ($row->width > 0) { if ($row->widthmode > 0) { $styles .= 'width:' . $row->width . 'px;'; } else { $attribs .= ' cols="' . $row->width . '"'; } } // if if ($row->height > 0) { if ($row->heightmode > 0) { $styles .= 'height:' . $row->height . 'px;'; } else { $height = $row->height; if ($height > 1 && stristr($this->browser, 'mozilla')) { $height--; } $attribs .= ' rows="' . $height . '"'; } // if } // if if ($styles != '') { $attribs .= ' style="' . $styles . '"'; } $attribs .= $this->script2clause($row); echo indentc(2) . '<textarea id="ff_elem' . $row->id . '" name="ff_nm_' . $row->name . '[]"' . $attribs . $class2 . '>' . $data1 . '</textarea>' . nlc(); echo indentc(1) . '</div>' . nl(); break; case 'File Upload': echo indentc(1) . '<div id="ff_div' . $row->id . '" style="' . $attribs . '"' . $class1 . '>' . nlc(); $attribs = ''; if ($row->width > 0) { $attribs .= ' size="' . $row->width . '"'; } if ($row->height > 0) { $attribs .= ' maxlength="' . $row->height . '"'; } if ($row->flag2) { $attribs .= ' disabled="disabled"'; } if ($row->data2 != '') { $attribs .= ' accept="' . $data2 . '"'; } $attribs .= $this->script2clause($row); echo indentc(2) . '<input id="ff_elem' . $row->id . '"' . $attribs . ' type="file" name="ff_nm_' . $row->name . '[]"' . $class2 . '/>' . nlc(); echo indentc(1) . '</div>' . nl(); break; case 'Captcha': if (JFactory::getApplication()->isSite()) { $captcha_url = JURI::root(true) . '/components/com_breezingforms/images/captcha/securimage_show.php'; } else { $captcha_url = JURI::root(true) . '/administrator/components/com_breezingforms/images/captcha/securimage_show.php'; } echo indentc(1) . '<div id="ff_div' . $row->id . '" style="' . $attribs . '"' . $class1 . '>' . nlc(); $attribs = ''; if ($row->width > 0) { $attribs .= 'width:' . $row->width . 'px;'; } if ($row->height > 0) { $attribs .= 'height:' . $row->height . 'px;'; } echo '<img id="ff_capimgValue" class="ff_capimg" src="' . $captcha_url . '"/>'; echo '<br/>'; echo '<input type="text" style="' . $attribs . '" name="bfCaptchaEntry" id="bfCaptchaEntry" />'; //echo '<br/>'; echo '<a href="#" onclick="document.getElementById(\'bfCaptchaEntry\').value=\'\';document.getElementById(\'bfCaptchaEntry\').focus();document.getElementById(\'ff_capimgValue\').src = \'' . $captcha_url . '?bfCaptcha=true&bfMathRandom=\' + Math.random(); return false"><img src="' . JURI::root() . 'components/com_breezingforms/images/captcha/refresh-captcha.png" border="0" /></a>'; echo indentc(1) . '</div>' . nl(); break; case 'Query List': echo indentc(1) . '<div id="ff_div' . $row->id . '" style="' . $attribs . '"' . $class1 . '>' . nlc(); // unpack settings $settings = explode("\n", $row->data1); $scnt = count($settings); for ($s = 0; $s < $scnt; $s++) { $this->trim($settings[$s]); } $trhclass = ''; $tr1class = ''; $tr2class = ''; $trfclass = ''; $tdfclass = ''; $pagenav = 1; $attribs = ''; if ($scnt > 0 && $settings[0] != '') { $attribs .= ' border="' . $settings[0] . '"'; } if ($scnt > 1 && $settings[1] != '') { $attribs .= ' cellspacing="' . $settings[1] . '"'; } if ($scnt > 2 && $settings[2] != '') { $attribs .= ' cellpadding="' . $settings[2] . '"'; } if ($scnt > 3 && $settings[3] != '') { $trhclass = ' class="' . $this->getClassName($settings[3]) . '"'; } if ($scnt > 4 && $settings[4] != '') { $tr1class = ' class="' . $this->getClassName($settings[4]) . '"'; } if ($scnt > 5 && $settings[5] != '') { $tr2class = ' class="' . $this->getClassName($settings[5]) . '"'; } if ($scnt > 6 && $settings[6] != '') { $trfclass = ' class="' . $this->getClassName($settings[6]) . '"'; } if ($scnt > 7 && $settings[7] != '') { $tdfclass = ' class="' . $this->getClassName($settings[7]) . '"'; } if ($scnt > 8 && $settings[8] != '') { $pagenav = $settings[8]; } if ($row->width > 0) { $attribs .= ' width="100%"'; } // display 1st page of table echo indentc(2) . '<table id="ff_elem' . $row->id . '"' . $attribs . $class2 . '>' . nl(); $cols =& $this->queryCols['ff_' . $row->id]; $colcnt = count($cols); // display header if ($row->flag1) { echo indentc(3) . '<tr' . $trhclass . '>' . nlc(); $skip = 0; for ($c = 0; $c < $colcnt; $c++) { if ($skip > 0) { $skip--; } else { $col =& $cols[$c]; if ($col->thspan > 0) { $attribs = ''; $style = ''; switch ($col->thalign) { case 1: $style .= 'text-align:left;'; break; case 2: $style .= 'text-align:center;'; break; case 3: $style .= 'text-align:right;'; break; case 4: $style .= 'text-align:justify;'; break; default: } // switch switch ($col->thvalign) { case 1: $attribs .= ' valign="top"'; break; case 2: $attribs .= ' valign="middle"'; break; case 3: $attribs .= ' valign="bottom"'; break; case 4: $attribs .= ' valign="baseline"'; break; default: } // switch if ($col->thwrap == 1) { $attribs .= ' nowrap="nowrap"'; } if ($col->thspan > 1) { $attribs .= ' colspan="' . $col->thspan . '"'; $skip = $col->thspan - 1; } // if if ($col->class1 != '') { $attribs .= ' class="' . $this->getClassName($col->class1) . '"'; } if (intval($col->width) > 0 && !$skip) { $style .= 'width:' . $col->width; if ($col->widthmd) { $style .= '%;'; } else { $style .= 'px;'; } } // if if ($style != '') { $attribs .= ' style="' . $style . '"'; } if ($c == 0 && $row->flag2 > 0) { if ($row->flag2 == 1) { echo indentc(4) . '<th' . $attribs . '><input type="checkbox" id="ff_cb' . $row->id . '" onclick="ff_selectAllQueryRows(' . $row->id . ',this.checked);" /></th>' . nlc(); } else { echo indentc(4) . '<th' . $attribs . '></th>' . nlc(); } } else { echo indentc(4) . '<th' . $attribs . '>' . $this->replaceCode($col->title, BFText::_('COM_BREEZINGFORMS_PROCESS_QTITLEOF') . " {$row->name}::{$col->name}", 'e', $row->id, 2) . '</th>' . nlc(); } } // if unset($col); } } // if echo indentc(3) . '</tr>' . nl(); } // if // display data rows $qrows =& $this->queryRows['ff_' . $row->id]; $qcnt = count($qrows); $k = 1; if ($row->height > 0 && $qcnt > $row->height) { $qcnt = $row->height; } for ($q = 0; $q < $qcnt; $q++) { $qrow =& $qrows[$q]; if ($k == 1) { $cl = $tr1class; } else { $cl = $tr2class; } echo indentc(3) . '<tr' . $cl . '>' . nlc(); $skip = 0; for ($c = 0; $c < $colcnt; $c++) { $col =& $cols[$c]; if ($col->thspan > 0) { $attribs = ''; $style = ''; switch ($col->align) { case 1: $style .= 'text-align:left;'; break; case 2: $style .= 'text-align:center;'; break; case 3: $style .= 'text-align:right;'; break; case 4: $style .= 'text-align:justify;'; break; default: } // switch switch ($col->valign) { case 1: $attribs .= ' valign="top"'; break; case 2: $attribs .= ' valign="middle"'; break; case 3: $attribs .= ' valign="bottom"'; break; case 4: $attribs .= ' valign="baseline"'; break; default: } // switch if ($col->wrap == 1) { $attribs .= ' nowrap="nowrap"'; } if ($k == 1) { $cl = $col->class2; } else { $cl = $col->class3; } if ($cl != '') { $attribs .= ' class="' . $this->getClassName($cl) . '"'; } if (!$skip && $col->thspan > 1) { $skip = $col->thspan; } if ($skip && $q == 0) { if (intval($col->width) > 0) { $style .= 'width:' . $col->width; if ($col->widthmd) { $style .= '%;'; } else { $style .= 'px;'; } } } // if if ($skip > 0) { $skip--; } if ($style != '') { $attribs .= ' style="' . $style . '"'; } if ($c == 0 && $row->flag2 > 0) { if ($row->flag2 == 1) { echo indentc(4) . '<td' . $attribs . '><input type="checkbox" id="ff_cb' . $row->id . '_' . $q . '" value="' . $qrow[$c] . '" name="ff_nm_' . $row->name . '[]"/></td>' . nlc(); } else { echo indentc(4) . '<td' . $attribs . '><input type="radio" id="ff_cb' . $row->id . '_' . $q . '" value="' . $qrow[$c] . '" name="ff_nm_' . $row->name . '[]"/></td>' . nlc(); } } else { echo indentc(4) . '<td' . $attribs . '>' . $qrow[$c] . '</td>' . nlc(); } } // if unset($col); if ($this->dying) { break; } } // for echo indentc(3) . '</tr>' . nl(); $k = 3 - $k; unset($qrow); if ($this->dying) { break; } } // for if ($this->bury()) { return; } // display footer if ($row->height > 0 && $pagenav > 0) { $span = 0; for ($c = 0; $c < $colcnt; $c++) { if ($cols[$c]->thspan > 0) { $span++; } } $pages = intval((count($qrows) + $row->height - 1) / $row->height); echo indentc(3) . '<tr' . $trfclass . '>' . nlc(); echo indentc(4) . '<td colspan="' . $span . '"' . $tdfclass . '>' . nlc(); if ($pages > 1) { echo indentc(5); if ($pagenav <= 4) { echo '<< '; } if ($pagenav <= 2) { echo BFText::_('COM_BREEZINGFORMS_PROCESS_PAGESTART') . ' '; } if ($pagenav <= 4) { echo '< '; } if ($pagenav <= 2) { echo BFText::_('COM_BREEZINGFORMS_PROCESS_PAGEPREV') . ' '; } echo nlc(); if ($pagenav % 2) { echo indentc(5); echo '1 '; for ($p = 2; $p <= $pages; $p++) { echo indentc(5) . '<a href="javascript:ff_dispQueryPage(' . $row->id . ',' . $p . ');">' . $p . '</a> ' . nlc(); } echo nlc(); } // if if ($pagenav <= 4) { echo indentc(5) . '<a href="javascript:ff_dispQueryPage(' . $row->id . ',2);">'; if ($pagenav <= 2) { echo BFText::_('COM_BREEZINGFORMS_PROCESS_PAGENEXT') . ' '; } echo '></a> ' . nlc(); echo indentc(5) . '<a href="javascript:ff_dispQueryPage(' . $row->id . ',' . $pages . ');">'; if ($pagenav <= 2) { echo BFText::_('COM_BREEZINGFORMS_PROCESS_PAGEEND') . ' '; } echo '>></a>' . nlc(); } // if } // if echo indentc(4) . '</td>' . nlc(); echo indentc(3) . '</tr>' . nl(); } // if // table end echo indentc(2) . '</table>' . nlc(); echo indentc(1) . '</div>' . nl(); unset($qrows); unset($cols); break; default: break; } // switch unset($row); } // for } else { if (trim($this->formrow->template_code_processed) == 'QuickMode') { if ($this->isMobile) { // nothing } else { if (isset($rootMdata['themebootstrapThemeEngine']) && $rootMdata['themebootstrapThemeEngine'] == 'bootstrap') { require_once JPATH_SITE . '/administrator/components/com_breezingforms/libraries/crosstec/classes/BFQuickModeBootstrap.php'; $quickMode = new BFQuickModeBootstrap($this); $this->quickmode = $quickMode; } else { require_once JPATH_SITE . '/administrator/components/com_breezingforms/libraries/crosstec/classes/BFQuickMode.php'; $quickMode = new BFQuickMode($this); $this->quickmode = $quickMode; } } if ($is_mobile_type == 'choose') { $return_url = JURI::getInstance()->toString(); $return_url = strstr($return_url, '?non_mobile=1') !== false ? str_replace('?non_mobile=1', '', $return_url) : str_replace('&non_mobile=1', '', $return_url); $return_url = $return_url . (strstr($return_url, '?') !== false ? '&' : '?') . 'mobile=1'; echo '<div style="display: block; text-align: center;"><button class="ff_elem btn btn-primary" onclick="location.href=\'' . $return_url . '\';"><span>' . JText::_('COM_BREEZINGFORMS_MOBILE_VERSION') . '</span></button></div><div></div>'; } $quickMode->render(); } else { // case if forms done with the easy mode // always load calendar JHTML::_('behavior.calendar'); echo ' <style type="text/css"> ul.droppableArea, ul.droppableArea li { background-image: none; list-style: none; } li.ff_listItem { width: auto; list-style: none; } li.ff_listItem .ff_div { width: auto; float: left; } .ff_label { outline: none; } .ff_elem { float: left; } .ff_dragBox { display: none; } </style> ' . nl(); echo $this->formrow->template_code_processed; $visPages = ''; $pagesSize = isset($this->formrow->pages) ? intval($this->formrow->pages) : 1; for ($pageCnt = 1; $pageCnt <= $pagesSize; $pageCnt++) { $visPages .= 'if(document.getElementById("bfPage' . $pageCnt . '"))document.getElementById("bfPage' . $pageCnt . '").style.display = "none";'; } echo '<script type="text/javascript"> <!-- ' . $visPages . '; if(document.getElementById("bfPage' . $this->page . '"))document.getElementById("bfPage' . $this->page . '").style.display = ""; //--> </script>' . nl(); } } if ($this->editable) { echo '<script type="text/javascript"><!--' . nl() . 'if(typeof bfLoadEditable != "undefined") { bfLoadEditable(); }' . nl() . '//--></script>' . nl(); } if ($cbRecord !== null) { echo '<script type="text/javascript"><!--' . nl() . 'bfLoadContentBuilderEditable();' . nl() . '//--></script>' . nl(); } if ($cbForm !== null && count($cbNonEditableFields)) { echo '<script type="text/javascript"><!--' . nl() . 'bfDisableContentBuilderFields();' . nl() . '//--></script>' . nl(); } // CONTENTBUILDER // writing hidden input for groups. helps on recording updates, otherwise no value would be transferred. // the "cbGroupMark" won't be stored. if ($cbForm !== null) { for ($i = 0; $i < $this->rowcount; $i++) { $row = $this->rows[$i]; switch ($row->type) { case 'Checkbox': case 'Checkbox Group': case 'Radio Button': case 'Radio Group': case 'Select List': // temporary removed until further clarification if needed or not as this will interfere with javasripts on group elements (loosing their type) //echo '<input type="hidden" name="ff_nm_' . $row->name . '[]" value="cbGroupMark"/>' . nl(); break; } } } $paymentMethod = ''; for ($i = 0; $i < $this->rowcount; $i++) { $row = $this->rows[$i]; if ($row->type == "PayPal" || $row->type == "Sofortueberweisung") { echo indentc(1) . '<input type="hidden" name="ff_payment_method" id="bfPaymentMethod" value=""/>' . nl(); break; } } switch ($this->runmode) { case _FF_RUNMODE_FRONTEND: echo indentc(1) . '<input type="hidden" name="ff_contentid" value="' . JRequest::getInt('ff_contentid', 0) . '"/>' . nl() . indentc(1) . '<input type="hidden" name="ff_applic" value="' . JRequest::getWord('ff_applic', '') . '"/>' . nl() . indentc(1) . '<input type="hidden" name="ff_module_id" value="' . JRequest::getInt('ff_module_id', 0) . '"/>' . nl(); echo indentc(1) . '<input type="hidden" name="ff_form" value="' . htmlentities($this->form, ENT_QUOTES, 'UTF-8') . '"/>' . nl() . indentc(1) . '<input type="hidden" name="ff_task" value="submit"/>' . nl(); if ($this->target > 1) { echo indentc(1) . '<input type="hidden" name="ff_target" value="' . htmlentities($this->target, ENT_QUOTES, 'UTF-8') . '"/>' . nl(); } if ($this->inframe) { echo indentc(1) . '<input type="hidden" name="ff_frame" value="1"/>' . nl(); } if ($this->border) { echo indentc(1) . '<input type="hidden" name="ff_border" value="1"/>' . nl(); } if ($this->page != 1) { echo indentc(1) . '<input type="hidden" name="ff_page" value="' . htmlentities($this->page, ENT_QUOTES, 'UTF-8') . '"/>' . nl(); } if ($this->align != 1) { echo indentc(1) . '<input type="hidden" name="ff_align" value="' . htmlentities($this->align, ENT_QUOTES, 'UTF-8') . '"/>' . nl(); } if ($this->top != 0) { echo indentc(1) . '<input type="hidden" name="ff_top" value="' . htmlentities($this->top, ENT_QUOTES, 'UTF-8') . '"/>' . nl(); } reset($ff_otherparams); while (list($prop, $val) = each($ff_otherparams)) { echo indentc(1) . '<input type="hidden" name="' . htmlentities($prop, ENT_QUOTES, 'UTF-8') . '" value="' . htmlentities(urlencode($val), ENT_QUOTES, 'UTF-8') . '"/>' . nl(); } if (isset($_REQUEST['cb_form_id']) && isset($_REQUEST['cb_record_id'])) { echo '<input type="hidden" name="cb_form_id" value="' . JRequest::getInt('cb_form_id', 0) . '"/>' . nl(); echo '<input type="hidden" name="cb_record_id" value="' . JRequest::getInt('cb_record_id', 0) . '"/>' . nl(); echo '<input type="hidden" name="return" value="' . htmlentities(JRequest::getVar('return', ''), ENT_QUOTES, 'UTF-8') . '"/>' . nl(); } if (JRequest::getVar('tmpl') == 'component') { echo '<input type="hidden" name="tmpl" value="component"/>' . nl(); } echo '</form>' . nl(); break; case _FF_RUNMODE_BACKEND: echo indentc(1) . '<input type="hidden" name="option" value="com_breezingforms"/>' . nl() . indentc(1) . '<input type="hidden" name="act" value="run"/>' . nl() . indentc(1) . '<input type="hidden" name="ff_form" value="' . htmlentities($this->form, ENT_QUOTES, 'UTF-8') . '"/>' . nl() . indentc(1) . '<input type="hidden" name="ff_task" value="submit"/>' . nl() . indentc(1) . '<input type="hidden" name="ff_contentid" value="' . JRequest::getInt('ff_contentid', 0) . '"/>' . nl() . indentc(1) . '<input type="hidden" name="ff_applic" value="' . JRequest::getWord('ff_applic', '') . '"/>' . nl() . indentc(1) . '<input type="hidden" name="ff_module_id" value="' . JRequest::getInt('ff_module_id', 0) . '"/>' . nl() . indentc(1) . '<input type="hidden" name="ff_runmode" value="' . htmlentities($this->runmode, ENT_QUOTES, 'UTF-8') . '"/>' . nl(); if ($this->target > 1) { echo indentc(1) . '<input type="hidden" name="ff_target" value="' . htmlentities($this->target, ENT_QUOTES, 'UTF-8') . '"/>' . nl(); } if ($this->inframe) { echo indentc(1) . '<input type="hidden" name="ff_frame" value="1"/>' . nl(); } if ($this->border) { echo indentc(1) . '<input type="hidden" name="ff_border" value="1"/>' . nl(); } if ($this->page != 1) { echo indentc(1) . '<input type="hidden" name="ff_page" value="' . htmlentities($this->page, ENT_QUOTES, 'UTF-8') . '"/>' . nl(); } if ($this->align != 1) { echo indentc(1) . '<input type="hidden" name="ff_align" value="' . htmlentities($this->align, ENT_QUOTES, 'UTF-8') . '"/>' . nl(); } if ($this->top != 0) { echo indentc(1) . '<input type="hidden" name="ff_top" value="' . htmlentities($this->top, ENT_QUOTES, 'UTF-8') . '"/>' . nl(); } if (isset($_REQUEST['cb_form_id']) && isset($_REQUEST['cb_record_id'])) { echo '<input type="hidden" name="cb_form_id" value="' . JRequest::getInt('cb_form_id', 0) . '"/>' . nl(); echo '<input type="hidden" name="cb_record_id" value="' . JRequest::getInt('cb_record_id', 0) . '"/>' . nl(); echo '<input type="hidden" name="return" value="' . htmlentities(JRequest::getVar('return', ''), ENT_QUOTES, 'UTF-8') . '"/>' . nl(); } //echo '<input type="hidden" name="tmpl" value="' . JRequest::getCmd('tmpl', '') . '"/>' . nl(); if (JRequest::getVar('tmpl') == 'component') { echo '<input type="hidden" name="tmpl" value="component"/>' . nl(); } echo '</form>' . nl(); break; default: // _FF_RUNMODE_PREVIEW: if ($this->inframe) { echo indentc(1) . '<input type="hidden" name="option" value="com_breezingforms"/>' . nl() . indentc(1) . '<input type="hidden" name="ff_frame" value="1"/>' . nl() . indentc(1) . '<input type="hidden" name="ff_form" value="' . htmlentities($this->form, ENT_QUOTES, 'UTF-8') . '"/>' . nl() . indentc(1) . '<input type="hidden" name="ff_task" value="submit"/>' . nl() . indentc(1) . '<input type="hidden" name="ff_contentid" value="' . JRequest::getInt('ff_contentid', 0) . '"/>' . nl() . indentc(1) . '<input type="hidden" name="ff_applic" value="' . JRequest::getWord('ff_applic', '') . '"/>' . nl() . indentc(1) . '<input type="hidden" name="ff_module_id" value="' . JRequest::getInt('ff_module_id', 0) . '"/>' . nl() . indentc(1) . '<input type="hidden" name="ff_runmode" value="' . htmlentities($this->runmode, ENT_QUOTES, 'UTF-8') . '"/>' . nl(); if ($this->page != 1) { echo indentc(1) . '<input type="hidden" name="ff_page" value="' . htmlentities($this->page, ENT_QUOTES, 'UTF-8') . '"/>' . nl(); } if (isset($_REQUEST['cb_form_id']) && isset($_REQUEST['cb_record_id'])) { echo '<input type="hidden" name="cb_form_id" value="' . JRequest::getInt('cb_form_id', 0) . '"/>' . nl(); echo '<input type="hidden" name="cb_record_id" value="' . JRequest::getInt('cb_record_id', 0) . '"/>' . nl(); echo '<input type="hidden" name="return" value="' . htmlentities(JRequest::getVar('return', ''), ENT_QUOTES, 'UTF-8') . '"/>' . nl(); } if (JRequest::getVar('tmpl') == 'component') { echo '<input type="hidden" name="tmpl" value="component"/>' . nl(); } echo '</form>' . nl(); } // if } // if // handle After Form piece $code = ''; switch ($this->formrow->piece2cond) { case 1: // library $database->setQuery("select name, code from #__facileforms_pieces " . "where id=" . $this->formrow->piece2id . " and published=1 "); $rows = $database->loadObjectList(); if (count($rows)) { echo $this->execPiece($rows[0]->code, BFText::_('COM_BREEZINGFORMS_PROCESS_AFPIECE') . " " . $rows[0]->name, 'p', $this->formrow->piece2id, null); } break; case 2: // custom code echo $this->execPiece($this->formrow->piece2code, BFText::_('COM_BREEZINGFORMS_PROCESS_AFPIECEC'), 'f', $this->form, 2); break; default: break; } // switch if ($this->bury()) { return; } if ($this->legacy_wrap) { echo '</div></div></div><div class="bfPage-bl"><div class="bfPage-br"><div class="bfPage-b"></div></div></div></div><!-- form end -->' . nl(); } else { echo '</div><!-- form end -->' . nl(); } if ($this->traceMode & _FF_TRACEMODE_DIRECT) { $this->dumpTrace(); ob_end_flush(); echo '</pre>'; } else { ob_end_flush(); $this->dumpTrace(); } // if restore_error_handler(); if (trim($this->formrow->template_code_processed) == 'QuickMode' && $this->isMobile) { $contents = ob_get_contents(); $ob = 0; while (ob_get_level() > 0 && $ob <= 32) { ob_end_clean(); $ob++; } echo '<!DOCTYPE html> <html> <head> <title>' . JFactory::getDocument()->getTitle() . '</title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1">'; echo $quickMode->headers(); echo $quickMode->fetchHead(JFactory::getDocument()->getHeadData()); echo '</head>' . "\n"; echo '<body>' . "\n"; echo $contents; echo ' </body>' . "\n" . '</html>'; exit; } }
function mkPackage($option, $caller, $pkg) { global $ff_admpath, $ff_version, $mosConfig_fileperms; $id = $pkg; $name = JRequest::getVar( 'pkg_name', ''); $title = JRequest::getVar( 'pkg_title', ''); $version = JRequest::getVar( 'pkg_version', ''); $created = date('Y-m-d H:i:s'); $author = JRequest::getVar( 'pkg_author', ''); $email = JRequest::getVar( 'pkg_email', ''); $url = JRequest::getVar( 'pkg_url', ''); $description = JRequest::getVar( 'pkg_description', ''); $copyright = JRequest::getVar( 'pkg_copyright', ''); savePackage($id, $name, $title, $version, $created, $author, $email, $url, $description, $copyright); $xmlname = $ff_admpath.'/packages/'.$name.'.xml'; $existed = file_exists($xmlname); if ($existed) if (!is_writable($xmlname)) die('XML file is not writable!'); $file= fopen($xmlname, "w"); $xml = '<?xml version="1.0" encoding="utf-8" ?>'.nl(). '<FacileFormsPackage'; if ($id != '') $xml .= ' id="'.$id.'"'; if ($id == '') $xml .= ' id="'.$name.'"'; $xml .= ' type="autoincrement" version="'.$ff_version.'">'.nl(). indent(1).'<name>'.expstring($name).'</name>'.nl(). indent(1).'<title>'.expstring($title).'</title>'.nl(). indent(1).'<version>'.expstring($version).'</version>'.nl(). indent(1).'<creationDate>'.$created.'</creationDate>'.nl(). indent(1).'<author>'.expstring($author).'</author>'.nl(). indent(1).'<authorEmail>'.expstring($email).'</authorEmail>'.nl(). indent(1).'<authorUrl>'.expstring($url).'</authorUrl>'.nl(). indent(1).'<description>'.expstring($description).'</description>'.nl(). indent(1).'<copyright>'.expstring($copyright).'</copyright>'.nl(); if ($id == '') $ids = JRequest::getVar( 'scriptsel', array()); else { $ids = array(); $rows = _ff_select( "select id from #__facileforms_scripts ". "where package = '$id' ". "order by id" ); if (count($rows)) foreach ($rows as $row) $ids[] = $row->id; } // if if (count($ids) > 0) { $ids = implode(',', $ids); $scripts = _ff_select( "select * from #__facileforms_scripts where id in ($ids) order by package, name, id" ); for ($s = 0; $s < count($scripts); $s++) { $script = $scripts[$s]; $xml .= indent(1).'<script id="'.$script->id.'">'.nl(); if ($script->published != 1) $xml .= indent(2).'<published>'.$script->published.'</published>'.nl(); if ($script->package != '') $xml .= indent(2).'<package>'.expstring($script->package).'</package>'.nl(); $xml .= indent(2).'<name>'.expstring($script->name).'</name>'.nl(). indent(2).'<title>'.expstring($script->title).'</title>'.nl(); if ($script->type != 'Untyped') $xml .= indent(2).'<type>'.expstring($script->type).'</type>'.nl(); $script->description = trim($script->description); if ($script->description != '') $xml .= indent(2).'<description>'.expstring($script->description).'</description>'.nl(); $script->code = trim($script->code); if ($script->code != '') $xml .= indent(2).'<code>'.expstring($script->code).'</code>'.nl(); $xml .= indent(1).'</script>'.nl(); } // for } // if if ($id == '') $ids = JRequest::getVar( 'piecesel', array()); else { $ids = array(); $rows = _ff_select( "select id from #__facileforms_pieces ". "where package = '$id' ". "order by id" ); if (count($rows)) foreach ($rows as $row) $ids[] = $row->id; } // if if (count($ids) > 0) { $ids = implode(',', $ids); $pieces = _ff_select( "select * from #__facileforms_pieces where id in ($ids) order by package, name, id" ); for ($p = 0; $p < count($pieces); $p++) { $piece = $pieces[$p]; $xml .= indent(1).'<piece id="'.$piece->id.'">'.nl(); if ($piece->published != 1) $xml .= indent(2).'<published>'.$piece->published.'</published>'.nl(); if ($piece->package != '') $xml .= indent(2).'<package>'.expstring($piece->package).'</package>'.nl(); $xml .= indent(2).'<name>'.expstring($piece->name).'</name>'.nl(). indent(2).'<title>'.expstring($piece->title).'</title>'.nl(); if ($piece->type != 'Untyped') $xml .= indent(2).'<type>'.expstring($piece->type).'</type>'.nl(); $piece->description = trim($piece->description); if ($piece->description != '') $xml .= indent(2).'<description>'.expstring($piece->description).'</description>'.nl(); $piece->code = trim($piece->code); if ($piece->code != '') $xml .= indent(2).'<code>'.expstring($piece->code).'</code>'.nl(); $xml .= indent(1).'</piece>'.nl(); } // for } // if if ($id == '') $ids = JRequest::getVar( 'formsel', array()); else { $ids = array(); $rows = _ff_select( "select id from #__facileforms_forms ". "where package = '$id' ". "order by id" ); if (count($rows)) foreach ($rows as $row) $ids[] = $row->id; } // if if (count($ids) > 0) { $ids = implode(',', $ids); $forms = _ff_select( "select * from #__facileforms_forms where id in ($ids) order by package, ordering, id" ); for ($f = 0; $f < count($forms); $f++) { $form = $forms[$f]; $xml .= indent(1).'<form id="'.$form->id.'">'.nl(); if ($form->published != 1) $xml .= indent(2).'<published>'.$form->published.'</published>'.nl(); if ($form->runmode != 0) $xml .= indent(2).'<runmode>'.$form->runmode.'</runmode>'.nl(); if ($form->package != '') $xml .= indent(2).'<package>'.expstring($form->package).'</package>'.nl(); $xml .= indent(2).'<name>'.expstring($form->name).'</name>'.nl(). indent(2).'<title>'.expstring($form->title).'</title>'.nl(); if ($form->description != '') $xml .= indent(2).'<description>'.expstring($form->description).'</description>'.nl(); if ($form->class1 != '') $xml .= indent(2).'<class1>'.expstring($form->class1).'</class1>'.nl(); if ($form->class2 != '') $xml .= indent(2).'<class2>'.expstring($form->class2).'</class2>'.nl(); $xml .= indent(2).'<width>'.$form->width.'</width>'.nl(); if ($form->widthmode != 0) $xml .= indent(2).'<widthmode>'.$form->widthmode.'</widthmode>'.nl(); $xml .= indent(2).'<height>'.$form->height.'</height>'.nl(); if ($form->heightmode != 0) $xml .= indent(2).'<heightmode>'.$form->heightmode.'</heightmode>'.nl(); if ($form->pages != 1) $xml .= indent(2).'<pages>'.$form->pages.'</pages>'.nl(); if ($form->emailntf != 1) $xml .= indent(2).'<emailntf>'.$form->emailntf.'</emailntf>'.nl(); if ($form->emaillog != 1) $xml .= indent(2).'<emaillog>'.$form->emaillog.'</emaillog>'.nl(); if ($form->emailxml != 0) $xml .= indent(2).'<emailxml>'.$form->emailxml.'</emailxml>'.nl(); if ($form->emailntf == 2) { $form->emailadr = expstring($form->emailadr); if ($form->emailadr != '') $xml .= indent(2).'<emailadr>'.$form->emailadr.'</emailadr>'.nl(); } // if if($form->template_code != '')$xml.=indent(2).'<template_code>'.base64_encode($form->template_code).'</template_code>'; if($form->template_code_processed != '')$xml.=indent(2).'<template_code_processed>'.base64_encode($form->template_code_processed).'</template_code_processed>'; if($form->template_areas != '')$xml.=indent(2).'<template_areas>'.base64_encode($form->template_areas).'</template_areas>'; if ($form->dblog != 1) $xml .= indent(2).'<dblog>'.$form->dblog.'</dblog>'.nl(); $form->description = trim($form->description); if ($form->prevmode != 2) $xml .= indent(2).'<prevmode>'.$form->prevmode.'</prevmode>'.nl(); if ($form->prevmode != 0 && $form->widthmode != 0 && $form->prevwidth != '') $xml .= indent(2).'<prevwidth>'.$form->prevwidth.'</prevwidth>'.nl(); $this->exportScript( 'script1', '#__facileforms_scripts', $form->script1cond, $form->script1id, $form->script1code, 2, $xml ); $this->exportScript( 'script2', '#__facileforms_scripts', $form->script2cond, $form->script2id, $form->script2code, 2, $xml ); $this->exportScript( 'piece1', '#__facileforms_pieces', $form->piece1cond, $form->piece1id, $form->piece1code, 2, $xml ); $this->exportScript( 'piece2', '#__facileforms_pieces', $form->piece2cond, $form->piece2id, $form->piece2code, 2, $xml ); $this->exportScript( 'piece3', '#__facileforms_pieces', $form->piece3cond, $form->piece3id, $form->piece3code, 2, $xml ); $this->exportScript( 'piece4', '#__facileforms_pieces', $form->piece4cond, $form->piece4id, $form->piece4code, 2, $xml ); $elems = _ff_select( "select * from #__facileforms_elements where form=$form->id order by page, ordering, id" ); for ($e = 0; $e < count($elems); $e++) { $elem = $elems[$e]; $xml .= indent(2).'<element id="'.$elem->id.'">'.nl(); if ($elem->page != 1) $xml .= indent(3).'<page>'.$elem->page.'</page>'.nl(); if ($elem->published != 1) $xml .= indent(3).'<published>'.$elem->published.'</published>'.nl(); $xml .= indent(3).'<name>'.expstring($elem->name).'</name>'.nl(). indent(3).'<title>'.expstring($elem->title).'</title>'.nl(); if ($elem->type != 'Static Text/HTML') $xml .= indent(3).'<type>'.$elem->type.'</type>'.nl(); if ($elem->class1 != '') $xml .= indent(3).'<class1>'.expstring($elem->class1).'</class1>'.nl(); if ($elem->class2 != '') $xml .= indent(3).'<class2>'.expstring($elem->class2).'</class2>'.nl(); if (isInputElement($elem->type)) { if ($elem->logging != 1) $xml .= indent(3).'<logging>'.$elem->logging.'</logging>'.nl(); } // if if (isVisibleElement($elem->type)) { if ($elem->posx != NULL) $xml .= indent(3).'<posx>'.$elem->posx.'</posx>'.nl(); if ($elem->posx != NULL && $elem->posxmode!=0) $xml .= indent(3).'<posxmode>'.$elem->posxmode.'</posxmode>'.nl(); if ($elem->posy != NULL) $xml .= indent(3).'<posy>'.$elem->posy.'</posy>'.nl(); if ($elem->posy != NULL && $elem->posymode!=0) $xml .= indent(3).'<posymode>'.$elem->posymode.'</posymode>'.nl(); if ($elem->width != NULL) $xml .= indent(3).'<width>'.$elem->width.'</width>'.nl(); if ($elem->width != NULL && $elem->widthmode!=0) $xml .= indent(3).'<widthmode>'.$elem->widthmode.'</widthmode>'.nl(); if ($elem->height != NULL) $xml .= indent(3).'<height>'.$elem->height.'</height>'.nl(); if ($elem->height != NULL && $elem->heightmode!=0) $xml .= indent(3).'<heightmode>'.$elem->heightmode.'</heightmode>'.nl(); } // if $xml .= indent(3).'<mailback>'.$elem->mailback.'</mailback>'.nl(); $xml .= indent(3).'<mailbackfile>'.$elem->mailbackfile.'</mailbackfile>'.nl(); if ($elem->flag1) $xml .= indent(3).'<flag1>'.$elem->flag1.'</flag1>'.nl(); if ($elem->flag2) $xml .= indent(3).'<flag2>'.$elem->flag2.'</flag2>'.nl(); $elem->data1 = expstring($elem->data1); if ($elem->data1 != '') $xml .= indent(3).'<data1>'.$elem->data1.'</data1>'.nl(); $elem->data2 = expstring($elem->data2); if ($elem->data2 != '') $xml .= indent(3).'<data2>'.$elem->data2.'</data2>'.nl(); $elem->data3 = expstring($elem->data3); if ($elem->data3 != '') $xml .= indent(3).'<data3>'.$elem->data3.'</data3>'.nl(); $this->exportScript( 'script1', '#__facileforms_scripts', $elem->script1cond, $elem->script1id, $elem->script1code, 3, $xml ); if ($elem->script1cond > 0) { if ($elem->script1flag1) $xml .= indent(3).'<script1flag1>'.$elem->script1flag1.'</script1flag1>'.nl(); if ($elem->script1flag2) $xml .= indent(3).'<script1flag2>'.$elem->script1flag2.'</script1flag2>'.nl(); } // if $this->exportScript( 'script2', '#__facileforms_scripts', $elem->script2cond, $elem->script2id, $elem->script2code, 3, $xml ); if ($elem->script2cond > 0) { if ($elem->script2flag1) $xml .= indent(3).'<script2flag1>'.$elem->script2flag1.'</script2flag1>'.nl(); if ($elem->script2flag2) $xml .= indent(3).'<script2flag2>'.$elem->script2flag2.'</script2flag2>'.nl(); if ($elem->script2flag3) $xml .= indent(3).'<script2flag3>'.$elem->script2flag3.'</script2flag3>'.nl(); if ($elem->script2flag4) $xml .= indent(3).'<script2flag4>'.$elem->script2flag4.'</script2flag4>'.nl(); if ($elem->script2flag5) $xml .= indent(3).'<script2flag5>'.$elem->script2flag5.'</script2flag5>'.nl(); } // if $this->exportScript( 'script3', '#__facileforms_scripts', $elem->script3cond, $elem->script3id, $elem->script3code, 3, $xml ); if ($elem->script3cond > 0) { if ($elem->script3msg != '') $xml .= indent(3).'<script3msg>'.expstring($elem->script3msg).'</script3msg>'.nl(); } // if $xml .= indent(2).'</element>'.nl(); } // for $xml .= indent(1).'</form>'.nl(); } // for } // if if ($id == '') $ids = JRequest::getVar( 'menusel', array()); else { $ids = array(); $rows = _ff_select( "select id from #__facileforms_compmenus ". "where package = '$id' and parent = 0 ". "order by id" ); if (count($rows)) foreach ($rows as $row) $ids[] = $row->id; } // if if (count($ids) > 0) { $ids = implode(',', $ids); $menus = _ff_select( "select * from #__facileforms_compmenus where id in ($ids) order by package, ordering, id" ); for ($m = 0; $m < count($menus); $m++) { $menu = $menus[$m]; $xml .= indent(1).'<compmenu id="'.$menu->id.'">'.nl(); if ($menu->published != 1) $xml .= indent(2).'<published>'.$menu->published.'</published>'.nl(); $menu->img = trim($menu->img); if ($menu->img != '') $xml .= indent(2).'<img>'.expstring($menu->img).'</img>'.nl(); if ($menu->package != '') $xml .= indent(2).'<package>'.expstring($menu->package).'</package>'.nl(); $xml .= indent(2).'<title>'.expstring($menu->title).'</title>'.nl(); $menu->name = trim($menu->name); if ($menu->name != '') $xml .= indent(2).'<name>'.expstring($menu->name).'</name>'.nl(); if ($menu->page != 1 && $menu->page!='') $xml .= indent(2).'<page>'.$menu->page.'</page>'.nl(); if ($menu->frame != 0) $xml .= indent(2).'<frame>'.$menu->frame.'</frame>'.nl(); if ($menu->border != 0) $xml .= indent(2).'<border>'.$menu->border.'</border>'.nl(); $menu->params = trim($menu->params); if ($menu->params != '') $xml .= indent(2).'<params>'.expstring($menu->params).'</params>'.nl(); $submenus = _ff_select( "select * from #__facileforms_compmenus where parent=$menu->id order by ordering, id" ); for ($s = 0; $s < count($submenus); $s++) { $submenu = $submenus[$s]; $xml .= indent(2).'<compmenu id="'.$submenu->id.'">'.nl(); if ($submenu->published != 1) $xml .= indent(3).'<published>'.$submenu->published.'</published>'.nl(); $submenu->img = trim($submenu->img); if ($submenu->img != '') $xml .= indent(3).'<img>'.expstring($submenu->img).'</img>'.nl(); if ($menu->package != '') $xml .= indent(3).'<package>'.expstring($submenu->package).'</package>'.nl(); $xml .= indent(3).'<title>'.expstring($submenu->title).'</title>'.nl(); $submenu->name = trim($submenu->name); if ($submenu->name != '') $xml .= indent(3).'<name>'.expstring($submenu->name).'</name>'.nl(); if ($submenu->page != 1 && $submenu->page!='') $xml .= indent(3).'<page>'.$submenu->page.'</page>'.nl(); if ($submenu->frame != 0) $xml .= indent(3).'<frame>'.$submenu->frame.'</frame>'.nl(); if ($submenu->border != 0) $xml .= indent(3).'<border>'.$submenu->border.'</border>'.nl(); $submenu->params = trim($submenu->params); if ($submenu->params != '') $xml .= indent(3).'<params>'.expstring($submenu->params).'</params>'.nl(); $xml .= indent(2).'</compmenu>'.nl(); } // for $xml .= indent(1).'</compmenu>'.nl(); } // for } // if $xml .= '</FacileFormsPackage>'.nl(); fwrite($file, $xml); fclose($file); if (!$existed) { $filemode = NULL; if (isset($mosConfig_fileperms)) { if ($mosConfig_fileperms!='') $filemode = octdec($mosConfig_fileperms); } else $filemode = 0644; if (isset($filemode)) @chmod($xmlname, $filemode); } // if HTML_facileFormsConf::edit($option, $caller, $pkg, $xmlname); } // mkPackage
function view() { global $ff_mospath, $ff_mossite, $database, $my; global $ff_config, $ff_version, $ff_comsite, $ff_otherparams; $database = JFactory::getDBO(); $mainframe = JFactory::getApplication(); if (!$this->okrun) return; set_error_handler('_ff_errorHandler'); ob_start(); echo $this->header(); $this->queryCols = array(); $this->queryRows = array(); if($this->runmode == _FF_RUNMODE_PREVIEW){ echo '<script type="text/javascript" src="'.JURI::root() . 'administrator/components/com_breezingforms/libraries/wz_dragdrop/wz_dragdrop.js"></script>'; } if(trim($this->formrow->template_code_processed) == 'QuickMode') echo '<table width="100%" style="display:none" border="0" id="bfReCaptchaWrap"><tr><td><div id="bfReCaptchaDiv"></div></td></tr></table>'; echo '<div id="ff_formdiv'.$this->form.'"'; if ($this->formrow->class1 != '' && $this->formrow->template_code == '') echo ' class="'.$this->getClassName($this->formrow->class1).'"'; echo '><div class="bfPage-tl"><div class="bfPage-tr"><div class="bfPage-t"></div></div></div><div class="bfPage-l"><div class="bfPage-r"><div class="bfPage-m bfClearfix">'.nl(); $this->status = JRequest::getCmd( 'ff_status', ''); $this->message = JRequest::getCmd( 'ff_message', ''); // handle Before Form piece $code = ''; switch ($this->formrow->piece1cond) { case 1: // library $database->setQuery( 'select name, code from #__facileforms_pieces '. 'where id='.$this->formrow->piece1id.' and published=1 ' ); $rows = $database->loadObjectList(); if (count($rows)) echo $this->execPiece($rows[0]->code, BFText::_('COM_BREEZINGFORMS_PROCESS_BFPIECE')." ".$rows[0]->name, 'p', $this->formrow->piece1id, null); break; case 2: // custom code echo $this->execPiece($this->formrow->piece1code, BFText::_('COM_BREEZINGFORMS_PROCESS_BFPIECEC'), 'f', $this->form, 2); break; default: break; } // switch if ($this->bury()) return; $cntFiles = 0; $fileExtensionsCheck = 'function checkFileExtensions(){'; for($i = 0; $i < $this->rowcount; $i++) { $row = $this->rows[$i]; if ($row->type=='File Upload' && trim($this->formrow->template_code) != '') { if(trim($row->data2) != ''){ $exts = explode(',', $row->data2); $extsCount = count($exts); $fileExtensionsCheck .= 'var ff_elem'.$row->id.'Exts = false;'; for($x = 0;$x < $extsCount; $x++){ $fileExtensionsCheck .= ' if(!ff_elem'.$row->id.'Exts && document.getElementById("ff_elem'.$row->id.'").value.toLowerCase().lastIndexOf(".'.strtolower(trim($exts[$x])).'") != -1){ ff_elem'.$row->id.'Exts = true; }else if(!ff_elem'.$row->id.'Exts && document.getElementById("ff_elem'.$row->id.'").value == ""){ ff_elem'.$row->id.'Exts = true; }'; } $fileExtensionsCheck .= ' if(!ff_elem'.$row->id.'Exts){ if(typeof bfUseErrorAlerts == "undefined"){ alert("'.addslashes(BFText::_('COM_BREEZINGFORMS_File extension not allowed!')).'"); } else { bfShowErrors("'.addslashes(BFText::_('COM_BREEZINGFORMS_File extension not allowed!')).'"); } if(ff_currentpage != '.$row->page.')ff_switchpage('.$row->page.'); return false; } '; $cntFiles++; } } } $fileExtensionsCheck .= ' return true; } '; $capFunc = 'function bfCheckCaptcha(){if(checkFileExtensions())ff_submitForm2();}'; for($i = 0; $i < $this->rowcount; $i++) { $row = $this->rows[$i]; if ($row->type=="Captcha") { $capFunc = ' function bfAjaxObject101() { this.createRequestObject = function() { try { var ro = new XMLHttpRequest(); } catch (e) { var ro = new ActiveXObject("Microsoft.XMLHTTP"); } return ro; } this.sndReq = function(action, url, data) { if (action.toUpperCase() == "POST") { this.http.open(action,url,true); this.http.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); this.http.onreadystatechange = this.handleResponse; this.http.send(data); } else { this.http.open(action,url + "?" + data,true); this.http.onreadystatechange = this.handleResponse; this.http.send(null); } } this.handleResponse = function() { if ( me.http.readyState == 4) { if (typeof me.funcDone == "function") { me.funcDone();} var rawdata = me.http.responseText.split("|"); for ( var i = 0; i < rawdata.length; i++ ) { var item = (rawdata[i]).split("=>"); if (item[0] != "") { if (item[1].substr(0,3) == "%V%" ) { document.getElementById(item[0]).value = item[1].substring(3); } else { if(item[1] == "true"){ if(typeof bfDoFlashUpload != \'undefined\'){ bfDoFlashUpload(); } else { ff_submitForm2(); } } else { if(typeof JQuery != "undefined" && JQuery("#bfSubmitMessage")) { JQuery("#bfSubmitMessage").css("visibility","hidden"); } if(typeof bfUseErrorAlerts == "undefined"){ alert("'.addslashes(BFText::_('COM_BREEZINGFORMS_CAPTCHA_MISSING_WRONG')).'"); } else { if(typeof inlineErrorElements != "undefined"){ inlineErrorElements.push(["bfCaptchaEntry","'.addslashes(BFText::_('COM_BREEZINGFORMS_CAPTCHA_MISSING_WRONG')).'"]); } bfShowErrors("'.addslashes(BFText::_('COM_BREEZINGFORMS_CAPTCHA_MISSING_WRONG')).'"); } document.getElementById(\'ff_capimgValue\').src = \''.JURI::root(true).'/index.php?raw=true&option=com_breezingforms&bfCaptcha=true&Itemid='.JRequest::getInt('Itemid',0).'&bfMathRandom=\' + Math.random(); document.getElementById(\'bfCaptchaEntry\').value = ""; if(ff_currentpage != '.$row->page.')ff_switchpage('.$row->page.'); document.getElementById(\'bfCaptchaEntry\').focus(); } } } } } if ((me.http.readyState == 1) && (typeof me.funcWait == "function")) { me.funcWait(); } } var me = this; this.http = this.createRequestObject(); var funcWait = null; var funcDone = null; } function bfCheckCaptcha(){ if(checkFileExtensions()){ var ao = new bfAjaxObject101(); ao.sndReq("get","'.JURI::root(true).'/index.php?raw=true&option=com_breezingforms&checkCaptcha=true&Itemid='.JRequest::getInt('Itemid',0).'&value="+document.getElementById("bfCaptchaEntry").value,""); } }'; break; } else if ($row->type=="ReCaptcha") { $capFunc = 'var bfReCaptchaLoaded = true; function bfCheckCaptcha(){ if(checkFileExtensions()){ function bfValidateCaptcha() { challengeField = JQuery("input#recaptcha_challenge_field").val(); responseField = JQuery("input#recaptcha_response_field").val(); var html = JQuery.ajax({ type: "POST", url: "'.JURI::root(true).'/index.php?raw=true&option=com_breezingforms&bfReCaptcha=true&form='.$this->form.'&Itemid='.JRequest::getInt('Itemid',0).'", data: "recaptcha_challenge_field=" + challengeField + "&recaptcha_response_field=" + responseField, async: false }).responseText; if (html.replace(/^\s+|\s+$/, "") == "success") { if(typeof bfDoFlashUpload != \'undefined\'){ bfDoFlashUpload(); } else { ff_submitForm2(); } } else { if(typeof bfUseErrorAlerts == "undefined"){ alert("'.addslashes(BFText::_('COM_BREEZINGFORMS_CAPTCHA_MISSING_WRONG')).'"); } else { if(typeof inlineErrorElements != "undefined"){ inlineErrorElements.push(["bfReCaptchaEntry","'.addslashes(BFText::_('COM_BREEZINGFORMS_CAPTCHA_MISSING_WRONG')).'"]); } bfShowErrors("'.addslashes(BFText::_('COM_BREEZINGFORMS_CAPTCHA_MISSING_WRONG')).'"); } if(ff_currentpage != '.$row->page.')ff_switchpage('.$row->page.'); Recaptcha.focus_response_field(); Recaptcha.reload(); } } bfValidateCaptcha(); } }'; } } for($i = 0; $i < $this->rowcount; $i++) { $row = $this->rows[$i]; if ($row->type=="Calendar") { $locale = $mainframe->getCfg( 'language' ); $lang = JLanguage::getInstance( $locale ); $mylang = JURI::root(true).'/components/com_breezingforms/libraries/js/calendar/lang/calendar-en-GB.js'; if(JFile::exists(JPATH_SITE . '/components/com_breezingforms/libraries/js/calendar/lang/calendar-'.$lang->getTag().'.js')){ $mylang = JURI::root(true).'/components/com_breezingforms/libraries/js/calendar/lang/calendar-'.$lang->getTag().'.js'; } echo ' <script language="JavaScript" src="'.JURI::root(true).'/components/com_breezingforms/libraries/js/joomla.javascript.js" type="text/javascript"></script> <!-- import the calendar script --> <script type="text/javascript" src="'.JURI::root(true).'/components/com_breezingforms/libraries/js/calendar/calendar.js"></script> <!-- import the language module --> <script type="text/javascript" src="'.$mylang.'"></script> '; JFactory::getDocument()->addStyleSheet( JURI::root(true) . '/components/com_breezingforms/libraries/js/calendar/calendar-mos.css' ); break; } } echo '<script type="text/javascript">'.nl(). '<!--'.nl(). ''.nl(). $fileExtensionsCheck. $capFunc; // create library list $library = array(); $this->loadBuiltins($library); $this->loadScripts($library); // start linking $linked = array(); if ($this->status == '') { $code = "onload = function()".nl(). "{".nl(). " ff_initialize('formentry');".nl(). " ff_initialize('pageentry');".nl(); if ($this->formrow->heightmode) $code .= " ff_resizepage(".$this->formrow->heightmode.", ".$this->formrow->height.");".nl(); if ($this->showgrid) $code .= " ff_showgrid();".nl(); $code .= " if (ff_processor && ff_processor.traceBuffer) ff_traceWindow();".nl(). "} // onload"; $this->linkcode('onload', $library, $linked, $code); } else { $funcname = ""; switch ($this->formrow->script2cond) { case 1: $database->setQuery( "select name from #__facileforms_scripts ". "where id=".$this->formrow->script2id." and published=1 " ); $funcname = $database->loadResult(); break; case 2: $funcname = "ff_".$this->formrow->name."_submitted"; break; default: break; } // switch if ($funcname != '' || $this->formrow->heightmode || $this->showgrid) { $code = "onload = function()".nl(). "{".nl(); if ($this->formrow->heightmode) $code .=" ff_resizepage(".$this->formrow->heightmode.", ".$this->formrow->height.");".nl(); if ($this->showgrid) $code .=" ff_showgrid();".nl(); if ($funcname != '') $code .=" ".$funcname."(".$this->status.",\"".str_replace("\n",'',str_replace("\r",'',stripcslashes($this->message)))."\");".nl(); $code .= "} // onload"; $this->linkcode('onload', $library, $linked, $code); } // if } // if if ($this->bury()) return; // add form scripts $this->addFunction( $this->formrow->script1cond, $this->formrow->script1id, 'ff_'.$this->formrow->name.'_init', $this->formrow->script1code, $library, $linked, 'f', $this->form, 1 ); if ($this->bury()) return; $this->addFunction( $this->formrow->script2cond, $this->formrow->script2id, 'ff_'.$this->formrow->name.'_submitted', $this->formrow->script2code, $library, $linked, 'f', $this->form, 1 ); if ($this->bury()) return; // all element scripts & static text/HTML $icons = 0; $tooltips = 0; $qcheckboxes = 0; $qcode = ''; for($i = 0; $i < $this->rowcount; $i++) { $row =& $this->rows[$i]; $this->draggableDivIds[] = 'ff_div'.$row->id; if ($row->type == "Icon") $icons++; if ($row->type == "Tooltip") $tooltips++; if ($row->type == "Query List") { if ($row->flag2) $qcheckboxes++; // load column definitions $this->queryCols['ff_'.$row->id] = array(); $cols =& $this->queryCols['ff_'.$row->id]; if ($this->trim($row->data3)) { $cls = explode("\n",$row->data3); for ($c = 0; $c < count($cls); $c++) { if ($cls[$c] != '') { $col = ''; // instead of unset $col = new facileFormsQuerycols; $col->unpack($cls[$c]); $this->compileQueryCol($row, $col); $cols[] = $col; } // if } // for } // if $colcnt = count($cols); $checkbox = 0; if ($row->flag2) $checkbox = $row->flag2; $header = 0; if ($row->flag1) $header = 1; // get pagenav $pagenav = 1; $settings = explode("\n",$row->data1); if (count($settings)>8 && $this->trim($settings[8])) $pagenav = $settings[8]; // export the javascript parameters $qcode .= nl(). 'ff_queryCurrPage['.$row->id.'] = 1;'.nl(). 'ff_queryPageSize['.$row->id.'] = '.$row->height.';'.nl(). 'ff_queryCheckbox['.$row->id.'] = '.$checkbox.';'.nl(). 'ff_queryHeader['.$row->id.'] = '.$header.';'.nl(). 'ff_queryPagenav['.$row->id.'] = '.$pagenav.';'.nl(). 'ff_queryCols['.$row->id.'] = ['; for ($c = 0; $c < $colcnt; $c++) { if ($cols[$c]->thspan>0) $qcode .= '1'; else $qcode .= '0'; if ($c < $colcnt-1) $qcode .= ','; } // for $qcode .= '];'.nl(); // execute the query and export it to javascript $this->queryRows['ff_'.$row->id] = array(); $this->execQuery($row, $this->queryRows['ff_'.$row->id], $cols); $qcode .= 'ff_queryRows['.$row->id.'] = '.$this->expJsValue($this->queryRows['ff_'.$row->id]).';'.nl(); unset($cols); if ($this->bury()) return; } // if $this->addFunction( $row->script1cond, $row->script1id, 'ff_'.$row->name.'_init', $row->script1code, $library, $linked, 'e', $row->id, 1 ); if ($this->bury()) { unset($row); return; } $this->addFunction( $row->script2cond, $row->script2id, 'ff_'.$row->name.'_action', $row->script2code, $library, $linked, 'e', $row->id, 1 ); if ($this->bury()) { unset($row); return; } $this->addFunction( $row->script3cond, $row->script3id, 'ff_'.$row->name.'_validate', $row->script3code, $library, $linked, 'e', $row->id, 1 ); if ($this->bury()) { ob_end_clean(); return; } if ($row->type == 'Static Text/HTML') $this->linkcode('#scanonly', $library, $linked, $row->data1); unset($row); if ($this->bury()) return; } // for if ($icons > 0) { $this->linkcode('ff_hideIconBorder', $library, $linked, 'function ff_hideIconBorder(element)'.nl(). '{'.nl(). ' element.style.border = "none";'.nl(). '} // ff_hideIconBorder' ); if ($this->bury()) return; $this->linkcode('ff_dispIconBorder', $library, $linked, 'function ff_dispIconBorder(element)'.nl(). '{'.nl(). ' element.style.border = "1px outset";'.nl(). '} // ff_dispIconBorder' ); if ($this->bury()) return; } // if if ($qcode != '') { $library[] = array('ff_queryCurrPage', 'var ff_queryCurrPage = new Array();'); $library[] = array('ff_queryPageSize', 'var ff_queryPageSize = new Array();'); $library[] = array('ff_queryCols', 'var ff_queryCols = new Array();'); $library[] = array('ff_queryCheckbox', 'var ff_queryCheckbox = new Array();'); $library[] = array('ff_queryHeader', 'var ff_queryHeader = new Array();'); $library[] = array('ff_queryPagenav', 'var ff_queryPagenav = new Array();'); $library[] = array('ff_queryRows', 'var ff_queryRows = new Array();'.nl().$qcode); $library[] = array('ff_selectAllQueryRows', 'function ff_selectAllQueryRows(id,checked)'.nl(). '{'.nl(). ' if (!ff_queryCheckbox[id]) return;'.nl(). ' var cnt = ff_queryRows[id].length;'.nl(). ' var pagesize = ff_queryPageSize[id];'.nl(). ' if (pagesize > 0) {'.nl(). ' lastpage = parseInt((cnt+pagesize-1)/pagesize);'.nl(). ' if (lastpage == 1)'.nl(). ' pagesize = cnt;'.nl(). ' else {'.nl(). ' var currpage = ff_queryCurrPage[id];'.nl(). ' var p;'.nl(). ' for (p = 1; p < currpage; p++) cnt -= pagesize;'.nl(). ' if (cnt > pagesize) cnt = pagesize;'.nl(). ' } // if'.nl(). ' } // if'.nl(). ' var curr;'.nl(). ' for (curr = 0; curr < cnt; curr++)'.nl(). ' document.getElementById(\'ff_cb\'+id+\'_\'+curr).checked = checked;'.nl(). ' for (curr = cnt; curr < pagesize; curr++)'.nl(). ' document.getElementById(\'ff_cb\'+id+\'_\'+curr).checked = false;'.nl(). ' if (ff_queryCheckbox[id]==1)'.nl(). ' document.getElementById(\'ff_cb\'+id).checked = checked;'.nl(). '} // ff_selectAllQueryRows' ); $code = 'function ff_dispQueryPage(id,page)'.nl(). '{'.nl(). ' var forced = false;'.nl(). ' if (arguments.length>2) forced = arguments[2];'.nl(). ' var qrows = ff_queryRows[id];'.nl(). ' var cnt = qrows.length;'.nl(). ' var currpage = ff_queryCurrPage[id];'.nl(). ' var pagesize = ff_queryPageSize[id];'.nl(). ' var pagenav = ff_queryPagenav[id];'.nl(). ' var lastpage = 1;'.nl(). ' if (pagesize > 0) {'.nl(). ' lastpage = parseInt((cnt+pagesize-1)/pagesize);'.nl(). ' if (lastpage == 1) pagesize = cnt;'.nl(). ' } // if'.nl(). ' if (page < 1) page = 1;'.nl(). ' if (page > lastpage) page = lastpage;'.nl(). ' if (!forced && page == currpage) return;'.nl(). ' var p, c;'.nl(). ' for (p = 1; p < page; p++) cnt -= pagesize;'.nl(). ' if (cnt > pagesize) cnt = pagesize;'.nl(). ' var start = (page-1) * pagesize;'.nl(). ' var rows = document.getElementById(\'ff_elem\'+id).rows;'.nl(). ' var cols = ff_queryCols[id];'.nl(). ' var checkbox = ff_queryCheckbox[id];'.nl(). ' var header = ff_queryHeader[id];'.nl(). ' for (p = 0; p < cnt; p++) {'.nl(). ' var qrow = qrows[start+p];'.nl(). ' var row = rows[header+p];'.nl(). ' var cc = 0;'.nl(). ' for (c = 0; c < cols.length; c++)'.nl(). ' if (cols[c]) {'.nl(). ' if (c==0 && checkbox>0) {'.nl(). ' document.getElementById(\'ff_cb\'+id+\'_\'+p).value = qrow[c];'.nl(). ' cc++;'.nl(). ' } else'.nl(). ' row.cells[cc++].innerHTML = qrow[c];'.nl(). ' } // if'.nl(). ' row.style.display = \'\';'.nl(). ' } // for'.nl(). ' for (p = cnt; p < pagesize; p++) {'.nl(). ' var row = rows[p+header];'.nl(). ' row.style.display = \'none\';'.nl(). ' } // for'.nl(). ' if (pagenav > 0 && pagesize > 0) {'.nl(). ' var navi = \'\';'.nl(). ' if (pagenav<=4) {'.nl(). ' if (page>1) navi += \'<a href="javascript:ff_dispQueryPage(\'+id+\',1);">\';'.nl(). ' navi += \'<<\';'.nl(). ' if (pagenav<=2) navi += \' '.BFText::_('COM_BREEZINGFORMS_PROCESS_PAGESTART').'\';'.nl(). ' if (page>1) navi += \'<\/a>\';'.nl(). ' navi += \' \';'.nl(). ' if (page>1) navi += \'<a href="javascript:ff_dispQueryPage(\'+id+\',\'+(page-1)+\');">\';'.nl(). ' navi += \'<\';'.nl(). ' if (pagenav<=2) navi += \' '.BFText::_('COM_BREEZINGFORMS_PROCESS_PAGEPREV').'\';'.nl(). ' if (page>1) navi += \'<\/a>\';'.nl(). ' navi += \' \';'.nl(). ' } // if'.nl(). ' if (pagenav % 2) {'.nl(). ' for (p = 1; p <= lastpage; p++)'.nl(). ' if (p == page) '.nl(). ' navi += p+\' \';'.nl(). ' else'.nl(). ' navi += \'<a href="javascript:ff_dispQueryPage(\'+id+\',\'+p+\');">\'+p+\'<\/a> \';'.nl(). ' } // if'.nl(). ' if (pagenav<=4) {'.nl(). ' if (page<lastpage) navi += \'<a href="javascript:ff_dispQueryPage(\'+id+\',\'+(page+1)+\');">\';'.nl(). ' if (pagenav<=2) navi += \''.BFText::_('COM_BREEZINGFORMS_PROCESS_PAGENEXT').' \';'.nl(). ' navi += \'>\';'.nl(). ' if (page<lastpage) navi += \'<\/a>\';'.nl(). ' navi += \' \';'.nl(). ' if (page<lastpage) navi += \'<a href="javascript:ff_dispQueryPage(\'+id+\',\'+lastpage+\');">\';'.nl(). ' if (pagenav<=2) navi += \''.BFText::_('COM_BREEZINGFORMS_PROCESS_PAGEEND').' \';'.nl(). ' navi += \'>>\';'.nl(). ' if (page<lastpage) navi += \'<\/a>\';'.nl(). ' } // if'.nl(). ' rows[header+pagesize].cells[0].innerHTML = navi;'.nl(). ' } // if'.nl(). ' ff_queryCurrPage[id] = page;'.nl(); if ($qcheckboxes) $code .= ' if (checkbox) ff_selectAllQueryRows(id, false);'.nl(); if ($this->formrow->heightmode>0) $code .= ' ff_resizepage('.$this->formrow->heightmode.', '.$this->formrow->height.');'.nl(); if ($this->inframe) $code .= ' parent.window.scrollTo(0,0);'.nl(); $code .= ' window.scrollTo(0,0);'.nl(). '} // ff_dispQueryPage'; $this->linkcode('ff_dispQueryPage', $library, $linked, $code); if ($this->bury()) return; } // if echo '//-->'.nl(). '</script>'.nl(); if ($icons > 0) echo '<script language="JavaScript" src="'.$ff_mossite.'/components/com_breezingforms/libraries/js/joomla.javascript.js" type="text/javascript"></script>'.nl(); if ($tooltips > 0) { echo '<script language="Javascript" src="'.$ff_mossite.'/components/com_breezingforms/libraries/js/overlib_mini.js" type="text/javascript"></script>'.nl(); if ($this->inframe) echo '<div id="overDiv" style="position:absolute;visibility:hidden;z-index:1000;"></div>'.nl(); } // if if (!$this->inline) { $url = ($this->inframe) ? $ff_mossite.'/index.php?format=html&tmpl=component' : (($this->runmode==_FF_RUNMODE_FRONTEND) ? '' : 'index.php?format=html&tmpl=component'); $params = ' action="'.$url.'"'. ' method="post"'. ' name="'.$this->form_id.'"'. ' id="'.$this->form_id.'"'. ' enctype="multipart/form-data"'; if ($this->formrow->class2 != '') $params .= ' class="'.$this->getClassName($this->formrow->class2).'"'; echo '<form'.$params.' onsubmit="return false;" class="bfQuickMode">'.nl(); } // if if(trim($this->formrow->template_code_processed) == ''){ for($i = 0; $i < $this->rowcount; $i++) { $row =& $this->rows[$i]; if (!is_numeric($row->width)) $row->width = 0; if (!is_numeric($row->height)) $row->height = 0; if ($row->type != 'Query List') { $data1 = $this->replaceCode($row->data1, "data1 of $row->name", 'e', $row->id, 0); if ($this->bury()) return; $data2 = $this->replaceCode($row->data2, "data2 of $row->name", 'e', $row->id, 0); if ($this->bury()) return; $data3 = $this->replaceCode($row->data3, "data3 of $row->name", 'e', $row->id, 0); if ($this->bury()) return; } // if $attribs = 'position:absolute;z-index:'.$i.';'; if ($row->posx >= 0) $attribs .= 'left:'.$row->posx; else $attribs .= 'right:'.(-$row->posx); if ($row->posxmode ) $attribs .= '%;'; else $attribs .= 'px;'; if ($row->posy >= 0) $attribs .= 'top:'.$row->posy; else $attribs .= 'bottom:'.(-$row->posy); if ($row->posymode ) $attribs .= '%;'; else $attribs .= 'px;'; $class1 = ''; if ($row->class1 != '') $class1 = ' class="'.$this->getClassName($row->class1).'"'; $class2 = ''; if ($row->class2 != '') $class2 = ' class="'.$this->getClassName($row->class2).'"'; switch ($row->type) { case 'Static Text/HTML': case 'Rectangle': case 'Image': if ($row->height > 0) { $attribs .= 'height:'.$row->height; if ($row->heightmode ) $attribs .= '%;'; else $attribs .= 'px;'; } // if case 'Query List': if ($row->width > 0) { $attribs .= 'width:'.$row->width; if ($row->widthmode ) $attribs .= '%;'; else $attribs .= 'px;'; } // if default: break; } // switch if ($row->page != $this->page) $attribs .= 'visibility:hidden;'; switch ($row->type) { case 'Static Text/HTML': echo indentc(1).'<div id="ff_div'.$row->id.'" style="'.$attribs.'"'.$class1.'>'.$data1.'</div>'.nl(); break; case 'Rectangle': if ($data1 != '') $attribs .= 'border:'.$data1.';'; if ($data2 != '') $attribs .= 'background-color:'.$data2.';'; echo indentc(1).'<div id="ff_div'.$row->id.'" style="font-size:0px;'.$attribs.'"'.$class1.'></div>'.nl(); break; case 'Image': echo indentc(1).'<div id="ff_div'.$row->id.'" style="'.$attribs.'"'.$class1.'>'.nlc(); $attribs = ''; if ($row->width > 0) $attribs .= 'width="'.$row->width.'" '; if ($row->height > 0) $attribs .= 'height="'.$row->height.'" '; echo indentc(2).'<img id="ff_elem'.$row->id.'" src="'.$data1.'" alt="'.$data2.'" border="0" '.$attribs.$class2.'/>'.nlc(); echo indentc(1).'</div>'.nl(); break; case 'Tooltip': echo indentc(1).'<div id="ff_div'.$row->id.'" style="'.$attribs.'" onMouseOver="return overlib(\''.expstring($data2).'\',CAPTION,\''.$row->title.'\',BELOW,RIGHT);" onMouseOut="return nd();"'.$class1.'>'.nlc(); switch ($row->flag1) { case 0: $url = $ff_mossite.'/components/com_breezingforms/images/tooltip.png'; break; case 1: $url = $ff_mossite.'/components/com_breezingforms/images/warning.png'; break; default: $url = $data1; } // switch echo indentc(2).'<img src="'.$url.'" alt="" border="0"'.$class2.'/>'.nlc(); echo indentc(1).'</div>'.nl(); break; case 'Hidden Input': echo indentc(1).'<input id="ff_elem'.$row->id.'" type="hidden" name="ff_nm_'.$row->name.'[]" value="'.$data1.'" />'.nl(); break; case 'Checkbox': echo indentc(1).'<div id="ff_div'.$row->id.'" style="'.$attribs.'"'.$class1.'>'.nlc(); $attribs = ''; if ($row->flag1) $attribs .= ' checked="checked"'; if ($row->flag2) $attribs .= ' disabled="disabled"'; $attribs .= $this->script2clause($row); echo indentc(2).'<input id="ff_elem'.$row->id.'" type="checkbox" name="ff_nm_'.$row->name.'[]" value="'.$data1.'"'.$attribs.$class2.'/><label id="ff_lbl'.$row->id.'" for="ff_elem'.$row->id.'"> '.$data2.'</label>'.nlc(); echo indentc(1).'</div>'.nl(); break; case 'Radio Button': echo indentc(1).'<div id="ff_div'.$row->id.'" style="'.$attribs.'"'.$class1.'>'.nlc(); $attribs = ''; if ($row->flag1) $attribs .= ' checked="checked"'; if ($row->flag2) $attribs .= ' disabled="disabled"'; $attribs .= $this->script2clause($row); echo indentc(2).'<input id="ff_elem'.$row->id.'" type="radio" name="ff_nm_'.$row->name.'[]" value="'.$data1.'"'.$attribs.$class2.'/><label id="ff_lbl'.$row->id.'" for="ff_elem'.$row->id.'"> '.$data2.'</label>'.nlc(); echo indentc(1).'</div>'.nl(); break; case 'Regular Button': echo indentc(1).'<div id="ff_div'.$row->id.'" style="'.$attribs.'"'.$class1.'>'.nlc(); $attribs = ''; if ($row->flag2) $attribs .= ' disabled="disabled"'; $attribs .= $this->script2clause($row); echo indentc(2).'<input id="ff_elem'.$row->id.'" type="button" name="ff_nm_'.$row->name.'" value="'.$data2.'"'.$attribs.$class2.'/>'.nlc(); echo indentc(1).'</div>'.nl(); break; case 'Graphic Button': echo indentc(1).'<div id="ff_div'.$row->id.'" style="'.$attribs.'"'.$class1.'>'.nlc(); $attribs = ''; if ($row->flag2) $attribs .= ' disabled="disabled"'; $attribs .= $this->script2clause($row); echo indentc(2).'<button id="ff_elem'.$row->id.'" type="button" name="ff_nm_'.$row->name.'" value="'.$data2.'"'.$attribs.$class2.'>'.nlc(); $attribs = ''; if ($row->width > 0) $attribs .= 'width="'.$row->width.'" '; if ($row->height > 0) $attribs .= 'height="'.$row->height.'" '; switch ($row->flag1) { case 0: // none echo indentc(3).'<table cellpadding="0" cellspacing="6" border="0">'.nlc(); echo indentc(4).'<tr><td>'.nlc(); echo indentc(5).'<img id="ff_img'.$row->id.'" src="'.$data1.'" alt="'.$data2.'" border="0" '.$attribs.'/>'.nlc(); echo indentc(4).'</td></tr>'.nlc(); echo indentc(3).'</table>'.nlc(); break; case 1: // below echo indentc(3).'<table cellpadding="0" cellspacing="6" border="0">'.nlc(); echo indentc(4).'<tr><td nowrap style="text-align:center">'.nlc(); echo indentc(5).'<img id="ff_img'.$row->id.'" src="'.$data1.'" alt="" border="0" '.$attribs.'/><br/>'.nlc(); echo indentc(5).$data2.nlc(); echo indentc(4).'</td></tr>'.nlc(); echo indentc(3).'</table>'.nlc(); break; case 2: // above echo indentc(3).'<table cellpadding="0" cellspacing="6" border="0">'.nlc(); echo indentc(4).'<tr><td nowrap style="text-align:center">'.nlc(); echo indentc(5).$data2.'<br/>'.nlc(); echo indentc(5).'<img id="ff_img'.$row->id.'" src="'.$data1.'" alt="" border="0" '.$attribs.'/>'.nlc(); echo indentc(4).'</td></tr>'.nlc(); echo indentc(3).'</table>.nlc()'; break; case 3: // left echo indentc(3).'<table cellpadding="0" cellspacing="6" border="0">'.nlc(); echo indentc(4).'<tr>'.nlc(); echo indentc(5).'<td>'.$data2.'</td>'.nlc(); echo indentc(5).'<td><img id="ff_img'.$row->id.'" src="'.$data1.'" alt="" border="0" '.$attribs.'/></td>'.nlc(); echo indentc(4).'</tr>'.nlc(); echo indentc(3).'</table>'.nlc(); break; default: // assume right echo indentc(3).'<table cellpadding="0" cellspacing="6" border="0">'.nlc(); echo indentc(4).'<tr>'.nlc(); echo indentc(5).'<td><img id="ff_img'.$row->id.'" src="'.$data1.'" alt="" border="0" '.$attribs.'/></td>'.nlc(); echo indentc(5).'<td>'.$data2.'</td>'.nlc(); echo indentc(4).'</tr>'.nlc(); echo indentc(3).'</table>'.nlc(); break; } // switch echo indentc(2).'</button>'.nlc(); echo indentc(1).'</div>'.nl(); break; case 'Icon': if ($row->flag2) echo indentc(1).'<div id="ff_div'.$row->id.'" onmouseout="ff_hideIconBorder(this);" onmouseover="ff_dispIconBorder(this);" style="padding:3px;'.$attribs.'"'.$class1.'>'.nlc(); else echo indentc(1).'<div id="ff_div'.$row->id.'" style="'.$attribs.'"'.$class1.'>'.nlc(); $swap = ''; if ($data3 != '') $swap = 'onmouseout="MM_swapImgRestore();" onmouseover="MM_swapImage(\'ff_img'.$row->id.'\',\'\',\''.$data3.'\',1);" '; $swap .= $this->script2clause($row); $attribs = ''; if ($row->width > 0) $attribs .= 'width="'.$row->width.'" '; if ($row->height > 0) $attribs .= 'height="'.$row->height.'" '; switch ($row->flag1) { case 0: // none echo indentc(2).'<span id="ff_elem'.$row->id.'" '.$swap.'>'.nlc(); echo indentc(3).'<img id="ff_img'.$row->id.'" src="'.$data1.'" alt="" border="0" align="middle" '.$attribs.$class2.'/>'.nlc(); echo indentc(2).'</span>'.nlc(); break; case 1: // below echo indentc(2).'<table id="ff_elem'.$row->id.'" cellpadding="1" cellspacing="0" border="0" '.$swap.'>'.nlc(); echo indentc(3).'<tr><td style="text-align:center;"><img id="ff_img'.$row->id.'" src="'.$data1.'" alt="" border="0" align="middle" '.$attribs.$class2.'/></td></tr>'.nlc(); echo indentc(3).'<tr><td style="text-align:center;">'.$data2.'</td></tr>'.nlc(); echo indentc(2).'</table>'.nlc(); break; case 2: // above echo indentc(2).'<table id="ff_elem'.$row->id.'" cellpadding="2" cellspacing="0" border="0" '.$swap.'>'.nlc(); echo indentc(3).'<tr><td style="text-align:center;">'.$data2.'</td></tr>'.nlc(); echo indentc(3).'<tr><td style="text-align:center;"><img id="ff_img'.$row->id.'" src="'.$data1.'" alt="" border="0" align="middle" '.$attribs.$class2.'/></td></tr>'.nlc(); echo indentc(2).'</table>'.nlc(); break; case 3: // left echo indentc(2).'<span id="ff_elem'.$row->id.'" '.$swap.' style="vertical-align:middle;">'.nlc(); echo indentc(3).$data2.' <img id="ff_img'.$row->id.'" src="'.$data1.'" alt="" border="0" align="middle" '.$attribs.$class2.'/>'.nlc(); echo indentc(2).'</span>'.nlc(); break; default: // assume right echo indentc(2).'<span id="ff_elem'.$row->id.'" '.$swap.' style="vertical-align:middle;">'.nlc(); echo indentc(3).'<img id="ff_img'.$row->id.'" src="'.$data1.'" alt="" border="0" align="middle" '.$attribs.$class2.'/> '.$data2.nlc(); echo indentc(2).'</span>'.nlc(); break; } // switch echo indentc(1).'</div>'.nl(); break; case 'Select List': echo indentc(1).'<div id="ff_div'.$row->id.'" style="'.$attribs.'"'.$class1.'>'.nlc(); $attribs = ''; $styles = ''; if ($row->width > 0) $styles .= 'width:'.$row->width.'px;'; if ($row->height > 0) $styles .= 'height:'.$row->height.'px;'; if ($row->flag1) $attribs .= ' multiple="multiple"'; if ($row->flag2) $attribs .= ' disabled="disabled"'; $attribs .= $this->script2clause($row); if ($data1 != '') $attribs .= ' size="'.$data1.'"'; if ($styles != '') $attribs .= ' style="'.$styles.'"'; echo indentc(2).'<select id="ff_elem'.$row->id.'" name="ff_nm_'.$row->name.'[]" '.$attribs.$class2.'>'.nlc(); $options = explode('\n', preg_replace('/([\\r\\n])/s', '\n', $data2)); $cnt = count($options); for ($o = 0; $o < $cnt; $o++) { $opt = explode(";",$options[$o]); $selected = ''; switch (count($opt)) { case 0: break; case 1: if ($this->trim($opt[0])) { $selected = '0'; $value = $text = $opt[0]; } // if break; case 2: $selected = $opt[0]; $value = $text = $opt[1]; break; default: $selected = $opt[0]; $text = $opt[1]; $value = $opt[2]; } // switch if ($this->trim($selected)) { $attribs = ''; if ($this->trim($value)) { if ($value=='""' || $value=="''") $value = ''; $attribs .= ' value="'.htmlspecialchars($value,ENT_QUOTES).'"'; } // if if ($selected == 1) $attribs .= ' selected="selected"'; echo indentc(3).'<option'.$attribs.'>'.htmlspecialchars(trim($text),ENT_QUOTES).'</option>'.nlc(); } // if } // for echo indentc(2).'</select>'.nlc(); echo indentc(1).'</div>'.nl(); break; case 'Text': echo indentc(1).'<div id="ff_div'.$row->id.'" style="'.$attribs.'"'.$class1.'>'.nlc(); $attribs = ''; if ($row->width > 0) { if ($row->widthmode > 0) $attribs .= ' style="width:'.$row->width.'px;"'; else $attribs .= ' size="'.$row->width.'"'; } // if if ($row->height > 0) $attribs .= ' maxlength="'.$row->height.'"'; if ($row->flag1) $attribs .= ' type="password"'; else $attribs .= ' type="text"'; switch ($row->flag2) { case 1: $attribs .= ' disabled="disabled"'; break; case 2: $attribs .= ' readonly="readonly"'; break; default: break; } // switch $attribs .= $this->script2clause($row); echo indentc(2).'<input id="ff_elem'.$row->id.'"'.$attribs.' name="ff_nm_'.$row->name.'[]" value="'.$data1.'"'.$class2.'/>'.nlc(); echo indentc(1).'</div>'.nl(); break; case 'Textarea': echo indentc(1).'<div id="ff_div'.$row->id.'" style="'.$attribs.'"'.$class1.'>'.nlc(); $attribs = ''; $styles = ''; switch ($row->flag2) { case 1: $attribs .= ' disabled="disabled"'; break; case 2: $attribs .= ' readonly="readonly"'; break; default: break; } // switch if ($row->width > 0) { if ($row->widthmode > 0) $styles .= 'width:'.$row->width.'px;'; else $attribs .= ' cols="'.$row->width.'"'; } // if if ($row->height > 0) { if ($row->heightmode > 0) $styles .= 'height:'.$row->height.'px;'; else { $height = $row->height; if ($height>1 && stristr($this->browser,'mozilla')) $height--; $attribs .= ' rows="'.$height.'"'; } // if } // if if ($styles != '') $attribs .= ' style="'.$styles.'"'; $attribs .= $this->script2clause($row); echo indentc(2).'<textarea id="ff_elem'.$row->id.'" name="ff_nm_'.$row->name.'[]"'.$attribs.$class2.'>'.$data1.'</textarea>'.nlc(); echo indentc(1).'</div>'.nl(); break; case 'File Upload': echo indentc(1).'<div id="ff_div'.$row->id.'" style="'.$attribs.'"'.$class1.'>'.nlc(); $attribs = ''; if ($row->width > 0) $attribs .= ' size="'.$row->width.'"'; if ($row->height > 0) $attribs .= ' maxlength="'.$row->height.'"'; if ($row->flag2) $attribs .= ' disabled="disabled"'; if ($row->data2 != '') $attribs .= ' accept="'.$data2.'"'; $attribs .= $this->script2clause($row); echo indentc(2).'<input id="ff_elem'.$row->id.'"'.$attribs.' type="file" name="ff_nm_'.$row->name.'[]"'.$class2.'/>'.nlc(); echo indentc(1).'</div>'.nl(); break; case 'Captcha': echo indentc(1).'<div id="ff_div'.$row->id.'" style="'.$attribs.'"'.$class1.'>'.nlc(); $attribs = ''; if($row->width > 0) $attribs .= 'width:'.$row->width.'px;'; if($row->height > 0) $attribs .= 'height:'.$row->height.'px;'; echo '<img id="ff_capimgValue" class="ff_capimg" src="'.JURI::root(true) . '/index.php?raw=true&option=com_breezingforms&bfCaptcha=true&Itemid='.JRequest::getInt('Itemid',0).'"/>'; echo '<br/>'; echo '<input type="text" style="'.$attribs.'" name="bfCaptchaEntry" id="bfCaptchaEntry" />'; //echo '<br/>'; echo '<a href="#" onclick="document.getElementById(\'bfCaptchaEntry\').value=\'\';document.getElementById(\'bfCaptchaEntry\').focus();document.getElementById(\'ff_capimgValue\').src = \''.JURI::root(true).'/index.php?raw=true&option=com_breezingforms&Itemid='.JRequest::getInt('Itemid',99999).'&bfCaptcha=true&bfMathRandom=\' + Math.random(); return false"><img src="'.JURI::root().'components/com_breezingforms/images/captcha/refresh-captcha.png" border="0" /></a>'; echo indentc(1).'</div>'.nl(); break; case 'Query List': echo indentc(1).'<div id="ff_div'.$row->id.'" style="'.$attribs.'"'.$class1.'>'.nlc(); // unpack settings $settings = explode("\n",$row->data1); $scnt = count($settings); for ($s = 0; $s < $scnt; $s++) $this->trim($settings[$s]); $trhclass = ''; $tr1class = ''; $tr2class = ''; $trfclass = ''; $tdfclass = ''; $pagenav = 1; $attribs = ''; if ($scnt>0 && $settings[0]!='') $attribs .= ' border="'.$settings[0].'"'; if ($scnt>1 && $settings[1]!='') $attribs .= ' cellspacing="'.$settings[1].'"'; if ($scnt>2 && $settings[2]!='') $attribs .= ' cellpadding="'.$settings[2].'"'; if ($scnt>3 && $settings[3]!='') $trhclass = ' class="'.$this->getClassName($settings[3]).'"'; if ($scnt>4 && $settings[4]!='') $tr1class = ' class="'.$this->getClassName($settings[4]).'"'; if ($scnt>5 && $settings[5]!='') $tr2class = ' class="'.$this->getClassName($settings[5]).'"'; if ($scnt>6 && $settings[6]!='') $trfclass = ' class="'.$this->getClassName($settings[6]).'"'; if ($scnt>7 && $settings[7]!='') $tdfclass = ' class="'.$this->getClassName($settings[7]).'"'; if ($scnt>8 && $settings[8]!='') $pagenav = $settings[8]; if ($row->width > 0) $attribs .= ' width="100%"'; // display 1st page of table echo indentc(2).'<table id="ff_elem'.$row->id.'"'.$attribs.$class2.'>'.nl(); $cols =& $this->queryCols['ff_'.$row->id]; $colcnt = count($cols); // display header if ($row->flag1) { echo indentc(3).'<tr'.$trhclass.'>'.nlc(); $skip = 0; for ($c = 0; $c < $colcnt; $c++) if ($skip > 0) $skip--; else { $col =& $cols[$c]; if ($col->thspan>0) { $attribs = ''; $style = ''; switch ($col->thalign) { case 1: $style .= 'text-align:left;'; break; case 2: $style .= 'text-align:center;'; break; case 3: $style .= 'text-align:right;'; break; case 4: $style .= 'text-align:justify;'; break; default:; } // switch switch ($col->thvalign) { case 1: $attribs .= ' valign="top"'; break; case 2: $attribs .= ' valign="middle"'; break; case 3: $attribs .= ' valign="bottom"'; break; case 4: $attribs .= ' valign="baseline"'; break; default:; } // switch if ($col->thwrap==1) $attribs .= ' nowrap="nowrap"'; if ($col->thspan >1) { $attribs .= ' colspan="'.$col->thspan.'"'; $skip = $col->thspan-1; } // if if ($col->class1!='') $attribs .= ' class="'.$this->getClassName($col->class1).'"'; if (intval($col->width) > 0 && !$skip) { $style .= 'width:'.$col->width; if ($col->widthmd) $style .= '%;'; else $style .= 'px;'; } // if if ($style != '') $attribs .= ' style="'.$style.'"'; if ($c==0 && $row->flag2>0) { if ($row->flag2==1) echo indentc(4).'<th'.$attribs.'><input type="checkbox" id="ff_cb'.$row->id.'" onclick="ff_selectAllQueryRows('.$row->id.',this.checked);" /></th>'.nlc(); else echo indentc(4).'<th'.$attribs.'></th>'.nlc(); } else echo indentc(4).'<th'.$attribs.'>'.$this->replaceCode($col->title, BFText::_('COM_BREEZINGFORMS_PROCESS_QTITLEOF')." $row->name::$col->name", 'e', $row->id, 2).'</th>'.nlc(); } // if unset($col); } // if echo indentc(3).'</tr>'.nl(); } // if // display data rows $qrows =& $this->queryRows['ff_'.$row->id]; $qcnt = count($qrows); $k = 1; if ($row->height>0 && $qcnt>$row->height) $qcnt = $row->height; for ($q = 0; $q < $qcnt; $q++) { $qrow =& $qrows[$q]; $rowvals = get_object_vars($qrow); if ($k == 1) $cl = $tr1class; else $cl = $tr2class; echo indentc(3).'<tr'.$cl.'>'.nlc(); $skip = 0; for ($c = 0; $c < $colcnt; $c++) { $col =& $cols[$c]; if ($col->thspan>0) { $attribs = ''; $style = ''; switch ($col->align) { case 1: $style .= 'text-align:left;'; break; case 2: $style .= 'text-align:center;'; break; case 3: $style .= 'text-align:right;'; break; case 4: $style .= 'text-align:justify;'; break; default:; } // switch switch ($col->valign) { case 1: $attribs .= ' valign="top"'; break; case 2: $attribs .= ' valign="middle"'; break; case 3: $attribs .= ' valign="bottom"'; break; case 4: $attribs .= ' valign="baseline"'; break; default:; } // switch if ($col->wrap==1) $attribs .= ' nowrap="nowrap"'; if ($k == 1) $cl = $col->class2; else $cl = $col->class3; if ($cl != '') $attribs .= ' class="'.$this->getClassName($cl).'"'; if (!$skip && $col->thspan>1) $skip = $col->thspan; if ($skip && $q == 0) if (intval($col->width) > 0) { $style .= 'width:'.$col->width; if ($col->widthmd) $style .= '%;'; else $style .= 'px;'; } // if if ($skip > 0) $skip--; if ($style != '') $attribs .= ' style="'.$style.'"'; if ($c == 0 && $row->flag2 > 0) { if ($row->flag2==1) echo indentc(4).'<td'.$attribs.'><input type="checkbox" id="ff_cb'.$row->id.'_'.$q.'" value="'.$qrow[$c].'" name="ff_nm_'.$row->name.'[]"/></td>'.nlc(); else echo indentc(4).'<td'.$attribs.'><input type="radio" id="ff_cb'.$row->id.'_'.$q.'" value="'.$qrow[$c].'" name="ff_nm_'.$row->name.'[]"/></td>'.nlc(); } else echo indentc(4).'<td'.$attribs.'>'.$qrow[$c].'</td>'.nlc(); } // if unset($col); if ($this->dying) break; } // for echo indentc(3).'</tr>'.nl(); $k = 3-$k; unset($qrow); if ($this->dying) break; } // for if ($this->bury()) return; // display footer if ($row->height > 0 && $pagenav > 0) { $span = 0; for ($c = 0; $c < $colcnt; $c++) if ($cols[$c]->thspan>0) $span++; $pages = intval((count($qrows)+$row->height-1)/$row->height); echo indentc(3).'<tr'.$trfclass.'>'.nlc(); echo indentc(4).'<td colspan="'.$span.'"'.$tdfclass.'>'.nlc(); if ($pages > 1) { echo indentc(5); if ($pagenav<=4) echo '<< '; if ($pagenav<=2) echo BFText::_('COM_BREEZINGFORMS_PROCESS_PAGESTART').' '; if ($pagenav<=4) echo '< '; if ($pagenav<=2) echo BFText::_('COM_BREEZINGFORMS_PROCESS_PAGEPREV').' '; echo nlc(); if ($pagenav % 2) { echo indentc(5); echo '1 '; for ($p = 2; $p <= $pages; $p++) echo indentc(5).'<a href="javascript:ff_dispQueryPage('.$row->id.','.$p.');">'.$p.'</a> '.nlc(); echo nlc(); } // if if ($pagenav<=4) { echo indentc(5).'<a href="javascript:ff_dispQueryPage('.$row->id.',2);">'; if ($pagenav<=2) echo BFText::_('COM_BREEZINGFORMS_PROCESS_PAGENEXT').' '; echo '></a> '.nlc(); echo indentc(5).'<a href="javascript:ff_dispQueryPage('.$row->id.','.$pages.');">'; if ($pagenav<=2) echo BFText::_('COM_BREEZINGFORMS_PROCESS_PAGEEND').' '; echo '>></a>'.nlc(); } // if } // if echo indentc(4).'</td>'.nlc(); echo indentc(3).'</tr>'.nl(); } // if // table end echo indentc(2).'</table>'.nlc(); echo indentc(1).'</div>'.nl(); unset($qrows); unset($cols); break; default: break; } // switch unset($row); } // for } else if(trim($this->formrow->template_code_processed) == 'QuickMode') { require_once(JPATH_SITE.'/administrator/components/com_breezingforms/libraries/crosstec/classes/BFQuickMode.php'); $quickMode = new BFQuickMode($this); $quickMode->render(); } else { // case of forms done with the easy mode echo ' <style type="text/css"> ul.droppableArea, ul.droppableArea li { background-image: none; list-style: none; } li.ff_listItem { width: auto; list-style: none; } li.ff_listItem .ff_div { width: auto; float: left; } .ff_label { outline: none; } .ff_elem { float: left; } .ff_dragBox { display: none; } </style> '; echo $this->formrow->template_code_processed; $visPages = ''; $pagesSize = isset($this->formrow->pages) ? intval($this->formrow->pages) : 1; for($pageCnt = 1; $pageCnt <= $pagesSize;$pageCnt++){ $visPages .= 'if(document.getElementById("bfPage'.$pageCnt.'"))document.getElementById("bfPage'.$pageCnt.'").style.display = "none";'; } echo '<script> '.$visPages.'; if(document.getElementById("bfPage'.$this->page.'"))document.getElementById("bfPage'.$this->page.'").style.display = ""; </script>'; } if($this->editable){ $db = JFactory::getDBO(); $db->setQuery("Select id, form From #__facileforms_records Where form = ".$db->Quote($this->form)." And user_id = ".$db->Quote(JFactory::getUser()->get('id', -1))." And user_id <> 0 And archived = 0 Order By id Desc Limit 1"); $recordsResult = $db->loadObjectList(); if(count($recordsResult) != 0){ $db->setQuery("Select * From #__facileforms_subrecords Where record = ".$recordsResult[0]->id.""); $recordEntries = $db->loadObjectList(); $js = ''; foreach($recordEntries As $recordEntry){ switch( $recordEntry->type ){ case 'Textarea': case 'Text': case 'Hidden Input': case 'Calendar': $js .= 'if(document.getElementById("ff_elem'.$recordEntry->element.'"))document.getElementById("ff_elem'.$recordEntry->element.'").value="'.str_replace("\n","\\n",str_replace("\r","\\r",addslashes($recordEntry->value))).'";'."\n"; break; case 'Checkbox': $js .= 'if(document.getElementById("ff_elem'.$recordEntry->element.'"))document.getElementById("ff_elem'.$recordEntry->element.'").checked = true;'."\n"; break; case 'Checkbox Group': $js .= ' for(var i = 0;i < document.ff_form'.$this->form.'.elements.length;i++){ if(document.ff_form'.$this->form.'.elements[i].type == "checkbox" && document.ff_form'.$this->form.'.elements[i].name == "ff_nm_'.$recordEntry->name.'[]" && document.ff_form'.$this->form.'.elements[i].value == "'.str_replace("\n","\\n",str_replace("\r","\\r",addslashes($recordEntry->value))).'"){ document.ff_form'.$this->form.'.elements[i].checked = true; } }'."\n"; break; case 'Radio Button': case 'Radio Group': $js .= ' for(var i = 0;i < document.ff_form'.$this->form.'.elements.length;i++){ if(document.ff_form'.$this->form.'.elements[i].type == "radio" && document.ff_form'.$this->form.'.elements[i].name == "ff_nm_'.$recordEntry->name.'[]" && document.ff_form'.$this->form.'.elements[i].value == "'.str_replace("\n","\\n",str_replace("\r","\\r",addslashes($recordEntry->value))).'"){ document.ff_form'.$this->form.'.elements[i].checked = true; } }'."\n"; break; case 'Select List': $js .= 'for(var i = 0; i < document.getElementById("ff_elem'.$recordEntry->element.'").options.length; i++){ if(document.getElementById("ff_elem'.$recordEntry->element.'").options[i].value == "'.str_replace("\n","\\n",str_replace("\r","\\r",addslashes($recordEntry->value))).'"){ document.getElementById("ff_elem'.$recordEntry->element.'").options[i].selected = true; } }'; break; } } echo ' <script> '.$js.' // legacy seccode removal for(var i = 0;i < document.ff_form'.$this->form.'.elements.length;i++){ if(document.ff_form'.$this->form.'.elements[i].name == "ff_nm_seccode[]"){ document.ff_form'.$this->form.'.elements[i].value = ""; } } </script> '; } } $paymentMethod = ''; for($i = 0; $i < $this->rowcount; $i++) { $row = $this->rows[$i]; if ($row->type=="PayPal" || $row->type=="Sofortueberweisung") { echo indentc(1).'<input type="hidden" name="ff_payment_method" id="bfPaymentMethod" value=""/>'.nl(); break; } } switch ($this->runmode) { case _FF_RUNMODE_FRONTEND: echo indentc(1).'<input type="hidden" name="ff_contentid" value="'.JRequest::getInt('ff_contentid',0).'"/>'.nl(). indentc(1).'<input type="hidden" name="ff_applic" value="'.JRequest::getWord('ff_applic','').'"/>'.nl(). indentc(1).'<input type="hidden" name="ff_module_id" value="'.JRequest::getInt('ff_module_id',0).'"/>'.nl(); echo indentc(1).'<input type="hidden" name="ff_form" value="'.$this->form.'"/>'.nl(). indentc(1).'<input type="hidden" name="ff_task" value="submit"/>'.nl(); if ($this->target > 1) echo indentc(1).'<input type="hidden" name="ff_target" value="'.$this->target.'"/>'.nl(); if ($this->inframe) echo indentc(1).'<input type="hidden" name="ff_frame" value="1"/>'.nl(); if ($this->border) echo indentc(1).'<input type="hidden" name="ff_border" value="1"/>'.nl(); if ($this->page != 1) echo indentc(1).'<input type="hidden" name="ff_page" value="'.$this->page.'"/>'.nl(); if ($this->align != 1) echo indentc(1).'<input type="hidden" name="ff_align" value="'.$this->align.'"/>'.nl(); if ($this->top != 0) echo indentc(1).'<input type="hidden" name="ff_top" value="'.$this->top.'"/>'.nl(); reset($ff_otherparams); while (list($prop, $val) = each($ff_otherparams)) echo indentc(1).'<input type="hidden" name="'.$prop.'" value="'.$val.'"/>'.nl(); echo '</form>'.nl(); break; case _FF_RUNMODE_BACKEND: echo indentc(1).'<input type="hidden" name="option" value="com_breezingforms"/>'.nl(). indentc(1).'<input type="hidden" name="act" value="run"/>'.nl(). indentc(1).'<input type="hidden" name="ff_form" value="'.$this->form.'"/>'.nl(). indentc(1).'<input type="hidden" name="ff_task" value="submit"/>'.nl(). indentc(1).'<input type="hidden" name="ff_contentid" value="'.JRequest::getInt('ff_contentid',0).'"/>'.nl(). indentc(1).'<input type="hidden" name="ff_applic" value="'.JRequest::getWord('ff_applic','').'"/>'.nl(). indentc(1).'<input type="hidden" name="ff_module_id" value="'.JRequest::getInt('ff_module_id',0).'"/>'.nl(). indentc(1).'<input type="hidden" name="ff_runmode" value="'.$this->runmode.'"/>'.nl(); if ($this->target > 1) echo indentc(1).'<input type="hidden" name="ff_target" value="'.$this->target.'"/>'.nl(); if ($this->inframe) echo indentc(1).'<input type="hidden" name="ff_frame" value="1"/>'.nl(); if ($this->border) echo indentc(1).'<input type="hidden" name="ff_border" value="1"/>'.nl(); if ($this->page != 1) echo indentc(1).'<input type="hidden" name="ff_page" value="'.$this->page.'"/>'.nl(); if ($this->align != 1) echo indentc(1).'<input type="hidden" name="ff_align" value="'.$this->align.'"/>'.nl(); if ($this->top != 0) echo indentc(1).'<input type="hidden" name="ff_top" value="'.$this->top.'"/>'.nl(); echo '</form>'.nl(); break; default: // _FF_RUNMODE_PREVIEW: if ($this->inframe) { echo indentc(1).'<input type="hidden" name="option" value="com_breezingforms"/>'.nl(). indentc(1).'<input type="hidden" name="ff_frame" value="1"/>'.nl(). indentc(1).'<input type="hidden" name="ff_form" value="'.$this->form.'"/>'.nl(). indentc(1).'<input type="hidden" name="ff_task" value="submit"/>'.nl(). indentc(1).'<input type="hidden" name="ff_contentid" value="'.JRequest::getInt('ff_contentid',0).'"/>'.nl(). indentc(1).'<input type="hidden" name="ff_applic" value="'.JRequest::getWord('ff_applic','').'"/>'.nl(). indentc(1).'<input type="hidden" name="ff_module_id" value="'.JRequest::getInt('ff_module_id',0).'"/>'.nl(). indentc(1).'<input type="hidden" name="ff_runmode" value="'.$this->runmode.'"/>'.nl(); if ($this->page != 1) echo indentc(1).'<input type="hidden" name="ff_page" value="'.$this->page.'"/>'.nl(); echo '</form>'.nl(); } // if } // if // handle After Form piece $code = ''; switch ($this->formrow->piece2cond) { case 1: // library $database->setQuery( "select name, code from #__facileforms_pieces ". "where id=".$this->formrow->piece2id." and published=1 " ); $rows = $database->loadObjectList(); if (count($rows)) echo $this->execPiece( $rows[0]->code, BFText::_('COM_BREEZINGFORMS_PROCESS_AFPIECE')." ".$rows[0]->name, 'p', $this->formrow->piece2id, null ); break; case 2: // custom code echo $this->execPiece( $this->formrow->piece2code, BFText::_('COM_BREEZINGFORMS_PROCESS_AFPIECEC'), 'f', $this->form, 2 ); break; default: break; } // switch if ($this->bury()) return; echo '</div></div></div><div class="bfPage-bl"><div class="bfPage-br"><div class="bfPage-b"></div></div></div></div><!-- form end -->'.nl(); if ($this->traceMode & _FF_TRACEMODE_DIRECT) { $this->dumpTrace(); ob_end_flush(); echo '</pre>'; } else { ob_end_flush(); $this->dumpTrace(); } // if restore_error_handler(); } // view