- case 'edit': // Change entries
- foreach (REQUEST_POST('lvl') as $id => $value) {
- // Secure ID
- $id = bigintval($id);
-
- // Revert german commata
- REQUEST_SET_POST(array('perc', $id), convertCommaToDot(REQUEST_POST('perc', $id)));
+ case 'ref':
+ switch (getRequestElement('do'))
+ {
+ case 'add':
+ addSql("INSERT INTO `{?_MYSQL_PREFIX?}_refdepths` (`level`, `percents`) VALUES ('".postRequestElement('level')."','".postRequestElement('percents')."')");
+ break;
+
+ case 'edit': // Change entries
+ foreach (postRequestElement('level') as $id => $value) {
+ // Secure id
+ $id = bigintval($id);
+
+ // Revert german commata
+ setRequestPostElement('percents', array($id => convertCommaToDot(postRequestElement('percents', $id))));
+
+ // Update entry
+ SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_refdepths` SET `level`='%s', `percents`='%s' WHERE `id`=%s LIMIT 1",
+ array(bigintval($value), postRequestElement('percents', $id), $id), __FILE__, __LINE__);
+ }
+ $message = getMessage('REF_DEPTHS_SAVED');
+ break;
+
+ case 'del':
+ foreach (postRequestElement('id') as $id => $value) {
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_refdepths` WHERE `id`=%s LIMIT 1",
+ array(bigintval($id)), __FILE__, __LINE__);
+ }
+ $message = getMessage('REF_DEPTHS_DELETED');
+ break;
+ }