function validatelicense() { if (isset($_POST['instantcode'])) { ChronoFormsAdminVersion::validatelicensedata(); } else { $database = JFactory::getDBO(); $query = "SELECT * FROM `#__components` WHERE `option` = 'com_chronoforms' AND parent='0' AND admin_menu_link='option=com_chronoforms'"; $database->setQuery($query); $result = $database->loadObject(); $params = new JParameter($result->params); HTML_Admin_ChronoForms::validatelicense($params); } }
function validatelicense() { if (isset($_POST['instantcode'])) { ChronoFormsAdminVersion::validatelicensedata(); } else { $database =& JFactory::getDBO(); $query = "SELECT * FROM `#__extensions` WHERE `element` = 'com_chronoforms' AND `type` = 'component'"; $database->setQuery($query); $result = $database->loadObject(); $params = new JParameter($result->params); HTML_Admin_ChronoForms::validatelicense($params); } }
function create_table($task = 'create_table') { $mainframe =& JFactory::getApplication(); $database =& JFactory::getDBO(); //switch task if ($task == 'save_table') { if (isset($_POST['field_name']) && !empty($_POST['field_name']) && !empty($_POST['_cf_table_name'])) { $create = array("CREATE TABLE IF NOT EXISTS `" . $_POST['_cf_table_name'] . "` ("); $primary_key = ""; foreach ($_POST['field_name'] as $k => $name) { $name = trim($name); if (!empty($name) && isset($_POST['enabled'][$k]) && (int) $_POST['enabled'][$k] == 1) { $length = ""; if (!empty($_POST['field_length'][$k])) { $length = "(" . $_POST['field_length'][$k] . ")"; } $default = ""; if (!isset($_POST['nulled'][$k])) { $default = " NOT NULL"; } if (!empty($_POST['field_default'][$k])) { $default .= " default '" . $_POST['field_default'][$k] . "'"; } $extra = ""; if (!empty($_POST['field_extra'][$k])) { $extra = " " . $_POST['field_extra'][$k]; } $create[] = "`" . $name . "` " . $_POST['field_type'][$k] . $length . $default . $extra . ","; if (isset($_POST['field_key'][$k]) && (int) $_POST['field_key'][$k] == 1) { $primary_key = "PRIMARY KEY (`" . $name . "`)"; } } } if (!empty($primary_key)) { $create[] = $primary_key; } $create[] = ");"; $create = implode("\n", $create); $database->setQuery($create); if (!$database->query()) { JError::raiseWarning(100, $database->getError() . "<br /><br />Check table query below:<br /><br />" . $create); $mainframe->redirect("index.php?option=com_chronoforms"); } $mainframe->redirect("index.php?option=com_chronoforms", "Table successfully created."); } } else { $row =& JTable::getInstance('chronoforms', 'Table'); if (isset($_POST['cb']) && !empty($_POST['cb'])) { $row->load($_POST['cb'][0]); $form_code = $row->content; $fields_names = ChronoFormsAdmin::_getFormFieldsNames($form_code); } else { JError::raiseWarning(100, 'Invalid record!'); $mainframe->redirect("index.php?option=com_chronoforms"); } $defaults = array('cf_id' => array('type' => 'INT', 'length' => '11', 'default' => '', 'key' => 'PRI', 'extra' => 'auto_increment', 'enabled' => 1), 'cf_uid' => array('type' => 'VARCHAR', 'length' => '255', 'default' => '', 'key' => '', 'extra' => '', 'enabled' => 1), 'cf_created' => array('type' => 'DATETIME', 'length' => '', 'default' => '', 'key' => '', 'extra' => '', 'enabled' => 1), 'cf_modified' => array('type' => 'DATETIME', 'length' => '', 'default' => '', 'key' => '', 'extra' => '', 'enabled' => 1), 'cf_ipaddress' => array('type' => 'VARCHAR', 'length' => '255', 'default' => '', 'key' => '', 'extra' => '', 'enabled' => 1), 'cf_user_id' => array('type' => 'VARCHAR', 'length' => '255', 'default' => '', 'key' => '', 'extra' => '', 'enabled' => 1)); foreach ($fields_names as $name) { if ($name != 'cf_id') { $defaults[$name] = array('type' => 'VARCHAR', 'length' => '255', 'default' => '', 'key' => '', 'extra' => '', 'enabled' => 1); } } } HTML_Admin_ChronoForms::create_table($row, $defaults); }