| @@ 1205-1223 (lines=19) @@ | ||
| 1202 | // add template assignments |
|
| 1203 | $assignments = explode(',', $assignments); |
|
| 1204 | ||
| 1205 | if (count($assignments) > 0) { |
|
| 1206 | ||
| 1207 | // remove existing tv -> template assignments |
|
| 1208 | $ds = mysqli_query($sqlParser->conn, |
|
| 1209 | "SELECT id FROM $dbase.`" . $table_prefix . "site_tmplvars` WHERE name='$name' AND description='$desc';"); |
|
| 1210 | $row = mysqli_fetch_assoc($ds); |
|
| 1211 | $id = $row["id"]; |
|
| 1212 | mysqli_query($sqlParser->conn, |
|
| 1213 | 'DELETE FROM ' . $dbase . '.`' . $table_prefix . 'site_tmplvar_templates` WHERE tmplvarid = \'' . $id . '\''); |
|
| 1214 | ||
| 1215 | // add tv -> template assignments |
|
| 1216 | foreach ($assignments as $assignment) { |
|
| 1217 | $template = mysqli_real_escape_string($conn, $assignment); |
|
| 1218 | $ts = mysqli_query($sqlParser->conn, |
|
| 1219 | "SELECT id FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$template';"); |
|
| 1220 | if ($ds && $ts) { |
|
| 1221 | $tRow = mysqli_fetch_assoc($ts); |
|
| 1222 | $templateId = $tRow['id']; |
|
| 1223 | mysqli_query($sqlParser->conn, |
|
| 1224 | "INSERT INTO $dbase.`" . $table_prefix . "site_tmplvar_templates` (tmplvarid, templateid) VALUES($id, $templateId)"); |
|
| 1225 | } |
|
| 1226 | } |
|
| @@ 394-412 (lines=19) @@ | ||
| 391 | // add template assignments |
|
| 392 | $assignments = explode(',', $assignments); |
|
| 393 | ||
| 394 | if (count($assignments) > 0) { |
|
| 395 | ||
| 396 | // remove existing tv -> template assignments |
|
| 397 | $ds=mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name' AND description='$desc';"); |
|
| 398 | $row = mysqli_fetch_assoc($ds); |
|
| 399 | $id = $row["id"]; |
|
| 400 | mysqli_query($sqlParser->conn, 'DELETE FROM ' . $dbase . '.`' . $table_prefix . 'site_tmplvar_templates` WHERE tmplvarid = \'' . $id . '\''); |
|
| 401 | ||
| 402 | // add tv -> template assignments |
|
| 403 | foreach ($assignments as $assignment) { |
|
| 404 | $template = mysqli_real_escape_string($conn, $assignment); |
|
| 405 | $ts = mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_templates` WHERE templatename='$template';"); |
|
| 406 | if ($ds && $ts) { |
|
| 407 | $tRow = mysqli_fetch_assoc($ts); |
|
| 408 | $templateId = $tRow['id']; |
|
| 409 | mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_tmplvar_templates` (tmplvarid, templateid) VALUES($id, $templateId)"); |
|
| 410 | } |
|
| 411 | } |
|
| 412 | } |
|
| 413 | } |
|
| 414 | } |
|
| 415 | } |
|