static function save($option, $pkg, $form, $page) { global $database; $database = JFactory::getDBO(); $row = new facileFormsElements($database); // bind it to the table if (!$row->bind($_POST)) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } // if if ($row->script1flag1 == null) { $row->script1flag1 = 0; } if ($row->script1flag2 == null) { $row->script1flag2 = 0; } if ($row->script2flag1 == null) { $row->script2flag1 = 0; } if ($row->script2flag2 == null) { $row->script2flag2 = 0; } if ($row->script2flag3 == null) { $row->script2flag3 = 0; } if ($row->script2flag4 == null) { $row->script2flag4 = 0; } if ($row->script2flag5 == null) { $row->script2flag5 = 0; } // store it in the db if (!$row->store()) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } // if $row->reorder("form={$form} and page={$page}"); // CONTENTBUILDER jimport('joomla.filesystem.file'); jimport('joomla.filesystem.folder'); if (JFile::exists(JPATH_SITE . DS . 'administrator' . DS . 'components' . DS . 'com_contentbuilder' . DS . 'classes' . DS . 'contentbuilder.php')) { $formId = $form; require_once JPATH_SITE . DS . 'administrator' . DS . 'components' . DS . 'com_contentbuilder' . DS . 'classes' . DS . 'contentbuilder.php'; $cbForm = contentbuilder::getForm('com_breezingforms', $formId); $db = JFactory::getDBO(); $db->setQuery("Select id From #__contentbuilder_forms Where `type` = 'com_breezingforms' And `reference_id` = " . intval($formId)); jimport('joomla.version'); $version = new JVersion(); if (version_compare($version->getShortVersion(), '3.0', '>=')) { $cbForms = $db->loadColumn(); } else { $cbForms = $db->loadResultArray(); } if (is_object($cbForm) && count($cbForms)) { require_once JPATH_SITE . DS . 'administrator' . DS . 'components' . DS . 'com_contentbuilder' . DS . 'tables' . DS . 'elements.php'; foreach ($cbForms as $dataId) { contentbuilder::synchElements($dataId, $cbForm); $elements_table = new TableElements($db); $elements_table->reorder('form_id=' . $dataId); } } } // CONTENTBUILDER END JFactory::getApplication()->redirect("index.php?option={$option}&act=editpage&form={$form}&page={$page}&pkg={$pkg}", BFText::_('COM_BREEZINGFORMS_ELEMENTS_SAVED')); }
if (JFile::exists(JPATH_SITE . DS . 'administrator' . DS . 'components' . DS . 'com_contentbuilder' . DS . 'classes' . DS . 'contentbuilder.php')) { require_once JPATH_SITE . DS . 'administrator' . DS . 'components' . DS . 'com_contentbuilder' . DS . 'classes' . DS . 'contentbuilder.php'; $cbForm = contentbuilder::getForm('com_breezingforms', $formId); $db = JFactory::getDBO(); $db->setQuery("Select id From #__contentbuilder_forms Where `type` = 'com_breezingforms' And `reference_id` = " . intval($formId)); jimport('joomla.version'); $version = new JVersion(); if (version_compare($version->getShortVersion(), '3.0', '>=')) { $cbForms = $db->loadColumn(); } else { $cbForms = $db->loadResultArray(); } if (is_object($cbForm) && count($cbForms)) { require_once JPATH_SITE . DS . 'administrator' . DS . 'components' . DS . 'com_contentbuilder' . DS . 'tables' . DS . 'elements.php'; foreach ($cbForms as $dataId) { contentbuilder::synchElements($dataId, $cbForm); $elements_table = new TableElements($db); $elements_table->reorder('form_id=' . $dataId); } } } ob_end_clean(); echo $formId; exit; // CONTENTBUILDER END } exit; break; case 'save': $formId = JRequest::getInt('form', 0); $fOptions = $quickMode->getFormOptions($formId);
function getForm() { $query = ' Select * From #__contentbuilder_forms ' . ' Where id = ' . $this->_id; $this->_db->setQuery($query); $data = $this->_db->loadObject(); if (!$data) { $data = new stdClass(); $data->id = 0; $data->type = null; $data->reference_id = null; $data->name = null; $data->tag = null; $data->details_template = null; $data->details_prepare = null; $data->intro_text = null; $data->title = null; $data->created = null; $data->modified = null; $data->metadata = true; $data->export_xls = null; $data->print_button = true; $data->created_by = null; $data->modified_by = null; $data->published = null; $data->display_in = null; $data->published_only = null; $data->show_id_column = true; $data->select_column = false; $data->edit_button = false; $data->list_states = false; $data->config = null; $data->editable_prepare = null; $data->editable_template = null; $data->use_view_name_as_title = false; $data->list_states = $this->_default_list_states; $data->own_only = false; $data->own_only_fe = false; $data->list_state = false; $data->list_publish = false; $data->initial_sort_order = -1; $data->initial_sort_order2 = -1; $data->initial_sort_order3 = -1; $data->initial_order_dir = 'desc'; $data->default_section = 0; $data->default_category = 0; $data->create_articles = 1; $data->title_field = 0; $data->delete_articles = 1; $data->edit_by_type = 0; $data->email_notifications = 1; $data->email_update_notifications = 0; $data->limited_article_options = 1; $data->limited_article_options_fe = 1; $data->upload_directory = JPATH_SITE . DS . 'media' . DS . 'contentbuilder' . DS . 'upload'; $data->protect_upload_directory = 1; $data->limit_add = 0; $data->limit_edit = 0; $data->verification_required_view = 0; $data->verification_days_view = 0; $data->verification_required_new = 0; $data->verification_days_new = 0; $data->verification_required_edit = 0; $data->verification_days_edit = 0; $data->verification_url_new = ''; $data->verification_url_view = ''; $data->verification_url_edit = ''; $data->default_lang_code = '*'; $data->default_lang_code_ignore = 0; $data->show_all_languages_fe = 1; $data->list_language = 0; $data->default_publish_up_days = 0; $data->default_publish_down_days = 0; $data->default_access = 0; $data->default_featured = 0; $data->list_article = 0; $data->list_author = 0; $data->list_rating = 0; $data->email_template = ''; $data->email_subject = ''; $data->email_alternative_from = ''; $data->email_alternative_fromname = ''; $data->email_recipients = ''; $data->email_recipients_attach_uploads = ''; $data->email_html = ''; $data->email_admin_template = ''; $data->email_admin_subject = ''; $data->email_admin_alternative_from = ''; $data->email_admin_alternative_fromname = ''; $data->email_admin_recipients = ''; $data->email_admin_recipients_attach_uploads = ''; $data->email_admin_html = ''; $data->act_as_registration = 0; $data->registration_username_field = ''; $data->registration_password_field = ''; $data->registration_password_repeat_field = ''; $data->registration_email_field = ''; $data->registration_email_repeat_field = ''; $data->registration_name_field = ''; $data->auto_publish = 0; $data->force_login = 0; $data->force_url = ''; $data->registration_bypass_plugin = ''; $data->registration_bypass_plugin_params = ''; $data->registration_bypass_verification_name = ''; $data->registration_bypass_verify_view = ''; $data->theme_plugin = ''; $data->rating_slots = 5; $data->rand_date_update = '0000-00-00 00:00:00'; $data->rand_update = '86400'; $data->article_record_impact_publish = 0; $data->article_record_impact_language = 0; $data->allow_external_filter = 0; $data->show_filter = 1; $data->show_records_per_page = 1; $data->initial_list_limit = 20; $data->save_button_title = ''; $data->apply_button_title = ''; $data->filter_exact_match = 0; $data->ordering = 0; } $data->forms = array(); $data->types = contentbuilder::getTypes(); if ($data->type) { $data->forms = contentbuilder::getForms($data->type); } $data->form = null; if ($data->type && $data->reference_id) { $data->form = contentbuilder::getForm($data->type, $data->reference_id); if (!$data->form->exists) { JFactory::getApplication()->redirect('index.php?option=com_contentbuilder&controller=forms&limitstart=' . $this->getState('limitstart', 0), JText::_('COM_CONTENTBUILDER_FORM_NOT_FOUND'), 'error'); } if (isset($data->form->properties) && isset($data->form->properties->name)) { $data->type_name = $data->form->properties->name; } else { $data->type_name = ''; } $data->title = $data->form->getPageTitle(); if (is_object($data->form)) { contentbuilder::synchElements($data->id, $data->form); $elements_table = $this->getTable('elements'); $elements_table->reorder('form_id=' . $data->id); } } $db = JFactory::getDBO(); $db->setQuery("Select * From #__contentbuilder_list_states Where form_id = " . $this->_id . " Order By id"); $list_states = $db->loadAssocList(); if (count($list_states)) { $data->list_states = $list_states; } else { $data->list_states = $this->_default_list_states; } $data->language_codes = contentbuilder::getLanguageCodes(); $version = new JVersion(); if (version_compare($version->getShortVersion(), '1.6', '>=')) { $data->sectioncategories = $this->getOptions(); $data->accesslevels = array(); } else { $db->setQuery("Select * From #__groups"); $data->accesslevels = $db->loadAssocList(); // Joomla 1.5 begin // get sections and categories $db->setQuery("Select `title`, `id` From #__sections Where published = 1 Order By ordering"); $sections = $db->loadAssocList(); $i = 0; foreach ($sections as $section) { if (!isset($sections['categories'])) { $sections[$i]['categories'] = array(); } $db->setQuery("Select `title`, `id` From #__categories Where section = {$section['id']} And published = 1 Order By ordering"); $cats = $db->loadAssocList(); foreach ($cats as $cat) { if ($cat) { $sections[$i]['categories'][] = $cat; } } if (!count($cats)) { unset($sections[$i]); } $i++; } $sections = array_merge(array(), $sections); $data->sectioncategories = $sections; // Joomla 1.5 end } $this->_form_data = $data; return $data; }