I agree, but the SQL statement relies on variables that I don't know so I can't recreate the SQL statement to run it! I don't know why the author didn't just put it in seperate -- would have saved a lot of headaches!
In the file admin/includes/functions/extra_functions/recaptcha_functions.php we have this function:
Code:
function install_recaptcha() {
global $db;
$db->Execute("INSERT INTO " . TABLE_CONFIGURATION_GROUP . " VALUES ('', 'reCAPTCHA', 'Config options for reCAPTCHA text', '1', '1')");
$group_id = mysql_insert_id();
$db->Execute("UPDATE " . TABLE_CONFIGURATION_GROUP . " SET sort_order = " . $group_id . " WHERE configuration_group_id = " . $group_id);
$db->Execute("INSERT INTO " . TABLE_CONFIGURATION . " VALUES
('', 'Enable Contact Form', 'CONTACT_US_RECAPTCHA_STATUS', 'true', 'Disply reCAPTCHA text on contact form (default: true)', " . $group_id . ", '9', NULL, now(), NULL, 'zen_cfg_select_option(array(\"true\", \"false\"),'),
('', 'reCAPTCHA Public Key', 'CONTACT_US_RECAPTCHA_PUBLIC_KEY', '', 'Public key given from reCAPTCHA website (default: blank).', " . $group_id . ", '0', NULL, now(), NULL, NULL),
('', 'reCAPTCHA Private Key', 'CONTACT_US_RECAPTCHA_PRIVATE_KEY', '', 'Private key given from reCAPTCHA website (default: blank).', " . $group_id . ", '0', NULL, now(), NULL, NULL),
('', 'reCAPTCHA Theme', 'CONTACT_US_RECAPTCHA_THEME', 'white', 'Choose a theme option for the widget.', " . $group_id . ", '1', NULL, now(), NULL, 'zen_cfg_select_option(array(\"red\", \"white\", \"blackglass\", \"clean\"),')
");
}
So looking at the code I assume TABLE_CONFIGURATION_GROUP is a define for the zen_configuration_group table in the database. Also I would assume that TABLE_CONFIGURATION is the zen_configuration table.
With those assumptions, someone please tell me if this SQL looks right before I screw something up:
Code:
INSERT INTO 'zen_configuration_group' VALUES ('', 'reCAPTCHA', 'Config options for reCAPTCHA text', '1', '1');
UPDATE 'zen_configuration_group' SET sort_order = '$group_id' WHERE configuration_group_id = '$group_id';
INSERT INTO 'zen_configuration' VALUES
('', 'Enable Contact Form', 'CONTACT_US_RECAPTCHA_STATUS', 'true', 'Disply reCAPTCHA text on contact form (default: true)', $group_id, '9', NULL, now(), NULL, 'zen_cfg_select_option(array(\"true\", \"false\"),'),
('', 'reCAPTCHA Public Key', 'CONTACT_US_RECAPTCHA_PUBLIC_KEY', '', 'Public key given from reCAPTCHA website (default: blank).', $group_id, '0', NULL, now(), NULL, NULL),
('', 'reCAPTCHA Private Key', 'CONTACT_US_RECAPTCHA_PRIVATE_KEY', '', 'Private key given from reCAPTCHA website (default: blank).', $group_id, '0', NULL, now(), NULL, NULL),
('', 'reCAPTCHA Theme', 'CONTACT_US_RECAPTCHA_THEME', 'white', 'Choose a theme option for the widget.', $group_id, '1', NULL, now(), NULL, 'zen_cfg_select_option(array(\"red\", \"white\", \"blackglass\", \"clean\"),')
Things I must figure out in above code:
1. The $group_id variable is just the next available sort order, which is pulled from the SQL command mysql_insert_id()... how do I represent it in the SQL code properly? It's used in several places and I need to know how to write that properly in SQL.
2. In the last INSERT statement, we have one of the fields as the following: 'zen_cfg_select_option(array(\"red\", \"white\", \"blackglass\", \"clean\"),' -- MY QUESTION: Do I need to use the escape \ there or do I use double-single quotes to make it the right SQL syntax? Also, what about that loan ( before array, do I need to escape that so SQL doesn't think it has to do with my query string (it's just a part of what needs to be written in that field)?
3. In the last INSERT statement, I assume the use of the SQL function now() is indeed correct, right?
Thanks in advance for the help! Hopefully one of you SQL-gurus can let me know what to do to get this all fixed right so I can run it, and hence get this reCaptcha thng to install and work!