70 |
if ($err_code == 0) { |
if ($err_code == 0) { |
71 |
|
|
72 |
// Clean up strings |
// Clean up strings |
|
if (strlen($coursesub) > 0) $coursesub = textInmySQL($coursesub); |
|
|
if (strlen($coursesub_descr) > 0) $coursesub_descr = textInmySQL($coursesub_descr); |
|
|
if (strlen($cip_code) > 0) $cip_code = textInmySQL($cip_code); |
|
73 |
|
|
74 |
// Set up SQL |
// Set up SQL |
75 |
$sql = "INSERT INTO coursesub (coursesub, coursesub_descr, cip_code, campus_id) VALUES ('" |
$sql = "INSERT INTO coursesub (coursesub, coursesub_descr, cip_code, campus_id) VALUES ( ? , ? , ? , ? )"; |
|
. $coursesub |
|
|
. "', '" |
|
|
. $coursesub_descr |
|
|
. "', '" |
|
|
. $cip_code |
|
|
. "', " |
|
|
. $campus_id |
|
|
. ")"; |
|
76 |
|
|
77 |
// Write the new row to the database |
// Write the new row to the database |
78 |
if (!xx_query($sql, $con)){ |
if (!xx_prepare_execute($sql, $coursesub, $coursesub_descr, $cip_code, $campus_id)){ |
79 |
sql_err($con); |
sql_err($con); |
80 |
xx_query ("UNLOCK TABLES", $con); |
xx_query ("UNLOCK TABLES", $con); |
81 |
bailout(); |
bailout(); |
136 |
if ($err_code == 0) { |
if ($err_code == 0) { |
137 |
|
|
138 |
// Clean up strings |
// Clean up strings |
|
if (strlen($faculty_lastname) > 0) $faculty_lastname = textInmySQL($faculty_lastname); |
|
|
if (strlen($faculty_firstname) > 0) $faculty_firstname = textInmySQL($faculty_firstname); |
|
|
if (strlen($faculty_email) > 0) $faculty_email = textInmySQL($faculty_email); |
|
|
if (strlen($faculty_account) > 0) $faculty_account = textInmySQL($faculty_account); |
|
139 |
|
|
140 |
// Set up SQL |
// Set up SQL |
141 |
$sql = "INSERT INTO faculty (faculty_lastname, faculty_firstname, |
$sql = "INSERT INTO faculty (faculty_lastname, faculty_firstname, |
142 |
faculty_email, faculty_account) VALUES ('" |
faculty_email, faculty_account) VALUES ( ? , ? , ? , ? )"; |
|
. $faculty_lastname |
|
|
. "', '" |
|
|
. $faculty_firstname |
|
|
. "', '" |
|
|
. $faculty_email |
|
|
. "', '" |
|
|
. $faculty_account |
|
|
. "')"; |
|
143 |
|
|
144 |
// Write the new row to the database |
// Write the new row to the database |
145 |
if (!xx_query($sql, $con)){ |
if (!xx_prepare_execute($sql, $faculty_lastname, $faculty_firstname, $faculty_email, $faculty_account)){ |
146 |
sql_err($con); |
sql_err($con); |
147 |
xx_query ("UNLOCK TABLES", $con); |
xx_query ("UNLOCK TABLES", $con); |
148 |
bailout(); |
bailout(); |
201 |
if ($err_code == 0) { |
if ($err_code == 0) { |
202 |
|
|
203 |
// Clean up strings |
// Clean up strings |
|
if (strlen($feature) > 0) $feature = textInmySQL($feature); |
|
|
if (strlen($image_alt) > 0) $image_alt = textInmySQL($image_alt); |
|
|
if (strlen($image_path) >0) $image_path = textInmySQL($image_path); |
|
204 |
|
|
205 |
// Set up SQL |
// Set up SQL |
206 |
$sql = "INSERT INTO feature (feature, image_alt, image_path) VALUES ('" |
$sql = "INSERT INTO feature (feature, image_alt, image_path) VALUES ( ? , ? , ? )"; |
|
. $feature |
|
|
. "', '" |
|
|
. $image_alt |
|
|
. "', '" |
|
|
. $image_path |
|
|
. "')"; |
|
207 |
|
|
208 |
// Write the new row to the database |
// Write the new row to the database |
209 |
if (!xx_query($sql, $con)){ |
if (!xx_prepare_execute($sql, $feature, $image_alt, $image_path)){ |
210 |
sql_err($con); |
sql_err($con); |
211 |
xx_query ("UNLOCK TABLES", $con); |
xx_query ("UNLOCK TABLES", $con); |
212 |
bailout(); |
bailout(); |
267 |
if ($err_code == 0) { |
if ($err_code == 0) { |
268 |
|
|
269 |
// Clean up strings |
// Clean up strings |
|
if (strlen($infotype) > 0) $infotype = textInmySQL($infotype); |
|
270 |
|
|
271 |
// Set up SQL |
// Set up SQL |
272 |
$sql = "INSERT INTO infotype (infotype, masterinfotype_id, mastersubject_id) VALUES ('" |
$sql = "INSERT INTO infotype (infotype, masterinfotype_id, mastersubject_id) VALUES ( ? , ? , ? )"; |
|
. $infotype |
|
|
. "', " |
|
|
. $masterinfotype_id |
|
|
. ", " |
|
|
. $mastersubject_id |
|
|
. ")"; |
|
273 |
|
|
274 |
// Write the new row to the database |
// Write the new row to the database |
275 |
if (!xx_query($sql, $con)){ |
if (!xx_prepare_execute($sql, $infotype, $masterinfotype_id, $mastersubject_id)){ |
276 |
sql_err($con); |
sql_err($con); |
277 |
xx_query ("UNLOCK TABLES", $con); |
xx_query ("UNLOCK TABLES", $con); |
278 |
bailout(); |
bailout(); |
348 |
// Add only if no errors encountered |
// Add only if no errors encountered |
349 |
if ($err_code == 0) { |
if ($err_code == 0) { |
350 |
|
|
|
if (strlen($libunit) > 0) $libunit = textInmySQL($libunit); |
|
|
if (strlen($libunit_abbrev) > 0) $libunit_abbrev = textInmySQL($libunit_abbrev); |
|
351 |
|
|
352 |
$sql = "INSERT INTO libunit (libunit, libunit_abbrev, head_staff_id) VALUES ('" |
$sql = "INSERT INTO libunit (libunit, libunit_abbrev, head_staff_id) VALUES ( ? , ? , ? )"; |
|
. $libunit |
|
|
. "', '" |
|
|
. $libunit_abbrev |
|
|
. "', " |
|
|
. $head_staff_id |
|
|
. ")"; |
|
353 |
|
|
354 |
// Write the new row to the database |
// Write the new row to the database |
355 |
xx_query ("LOCK TABLE libunit WRITE", $con); |
xx_query ("LOCK TABLE libunit WRITE", $con); |
356 |
if (!xx_query($sql, $con)){ |
if (!xx_prepare_execute($sql, $libunit, $libunit_abbrev, $head_staff_id)){ |
357 |
sql_err($con); |
sql_err($con); |
358 |
xx_query ("UNLOCK TABLES", $con); |
xx_query ("UNLOCK TABLES", $con); |
359 |
bailout(); |
bailout(); |
360 |
} |
} |
361 |
else { |
else { |
362 |
$libunit_id = xx_insert_id($con); |
// $libunit_id = xx_insert_id($con) |
363 |
|
$insert_res = xx_prepare_execute("select 1 as id from libunit where libunit = ? and libunit_abbrev = ? and head_staff_id = ?", $libunit, $libunit_abbrev, $head_staff_id); |
364 |
|
list($libunit_id) = $insert_res->fetchRow(DB_FETCHMODE_ORDERED); |
365 |
xx_query("UNLOCK TABLES", $con); |
xx_query("UNLOCK TABLES", $con); |
366 |
formLibunit($con, $libunit_id); |
formLibunit($con, $libunit_id); |
367 |
} |
} |
425 |
if ($err_code == 0) { |
if ($err_code == 0) { |
426 |
|
|
427 |
// Clean up strings |
// Clean up strings |
|
if (strlen($location) > 0) $location = textInmySQL($location); |
|
|
if (strlen($location_descr) > 0) $location_descr = textInmySQL($location_descr); |
|
|
if (strlen($campus) > 0) $campus = textInmySQL($campus); |
|
|
if (strlen($address1) > 0) $address1 = textInmySQL($address1); |
|
|
if (strlen($address2) > 0) $address2 = textInmySQL($address2); |
|
|
if (strlen($address3) > 0) $address3 = textInmySQL($address3); |
|
|
if (strlen($address4) > 0) $address4 = textInmySQL($address4); |
|
|
if (strlen($telephone) > 0) $telephone = textInmySQL($telephone); |
|
|
if (strlen($mainURL) > 0) $mainURL = textInmySQL($mainURL); |
|
|
if (strlen($referenceURL) > 0) $referenceURL = textInmySQL($referenceURL); |
|
|
if (strlen($mapURL) > 0) $mapURL = textInmySQL($mapURL); |
|
|
if (strlen($hoursURL) > 0) $hoursURL = textInmySQL($hoursURL); |
|
428 |
|
|
429 |
// Set up SQL |
// Set up SQL |
430 |
$sql = "INSERT INTO location (location, location_descr, campus, address1, |
$sql = "INSERT INTO location (location, location_descr, campus, address1, |
431 |
address2, address3, address4, telephone, mainURL, referenceURL, |
address2, address3, address4, telephone, mainURL, referenceURL, |
432 |
mapURL, hoursURL) VALUES ('" |
mapURL, hoursURL) VALUES ( ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? )"; |
|
. $location |
|
|
. "', '" |
|
|
. $location_descr |
|
|
. "', '" |
|
|
. $campus |
|
|
. "', '" |
|
|
. $address1 |
|
|
. "', '" |
|
|
. $address2 |
|
|
. "', '" |
|
|
. $address3 |
|
|
. "', '" |
|
|
. $address4 |
|
|
. "', '" |
|
|
. $telephone |
|
|
. "', '" |
|
|
. $mainURL |
|
|
. "', '" |
|
|
. $referenceURL |
|
|
. "', '" |
|
|
. $mapURL |
|
|
. "', '" |
|
|
. $hoursURL |
|
|
. "')"; |
|
433 |
|
|
434 |
// Write the new row to the database |
// Write the new row to the database |
435 |
if (!xx_query($sql, $con)){ |
if (!xx_prepare_execute($sql, $location, $location_descr, $campus, $address1, $address2, $address3, $address4, $telephone, $mainURL, $referenceURL, $mapURL, $hoursURL)){ |
436 |
sql_err($con); |
sql_err($con); |
437 |
xx_query ("UNLOCK TABLES", $con); |
xx_query ("UNLOCK TABLES", $con); |
438 |
bailout(); |
bailout(); |
486 |
if ($err_code == 0) { |
if ($err_code == 0) { |
487 |
|
|
488 |
// Clean up strings |
// Clean up strings |
|
if (strlen($annotation) > 0) $annotation = textInmySQL($annotation); |
|
|
if (strlen($author) > 0) $author = textInmySQL($author); |
|
|
if (strlen($call_no) > 0) $call_no = textInmySQL($call_no); |
|
|
if (strlen($cat_num) > 0) $cat_num = textInmySQL($cat_num); |
|
|
if (strlen($coverage_detail) > 0) $coverage_detail = textInmySQL($coverage_detail); |
|
|
if (strlen($edition) > 0) $edition = textInmySQL($edition); |
|
|
if (strlen($other_title) > 0) $other_title = textInmySQL($other_title); |
|
|
if (strlen($pub_date) > 0) $pub_date = textInmySQL($pub_date); |
|
|
if (strlen($publisher) > 0) $publisher = textInmySQL($publisher); |
|
|
if (strlen($sources_indexed) > 0) $sources_indexed = textInmySQL($sources_indexed); |
|
|
if (strlen($title) > 0) $title = textInmySQL($title); |
|
|
if (strlen($url) > 0) $url = textInmySQL($url); |
|
489 |
|
|
490 |
// Build the SQL |
// Build the SQL |
491 |
$sql = "INSERT INTO resource (annotation, author, call_no, cat_num, |
$sql = "INSERT INTO resource (annotation, author, call_no, cat_num, |
492 |
coverage_detail, date_created, date_modified, edition, |
coverage_detail, date_created, date_modified, edition, |
493 |
infotype_id, other_title, pub_date, publisher, sources_indexed, |
infotype_id, other_title, pub_date, publisher, sources_indexed, |
494 |
title, url, account_created) VALUES ('" |
title, url, account_created) VALUES ( ? , ? , ? , ? , ? , now(), now(), ? , ? , ? , ? , ? , ? , ? , ? , ? )"; |
|
. $annotation |
|
|
. "', '" |
|
|
. $author |
|
|
. "', '" |
|
|
. $call_no |
|
|
. "', '" |
|
|
. $cat_num |
|
|
. "', '" |
|
|
. $coverage_detail |
|
|
. "', now(), now(), '" |
|
|
. $edition |
|
|
. "', " |
|
|
. $infotype_id |
|
|
. ", '" |
|
|
. $other_title |
|
|
. "', '" |
|
|
. $pub_date |
|
|
. "', '" |
|
|
. $publisher |
|
|
. "', '" |
|
|
. $sources_indexed |
|
|
. "', '" |
|
|
. $title |
|
|
. "', '" |
|
|
. $url |
|
|
. "', '" |
|
|
. $sess_staff_account |
|
|
. "')"; |
|
495 |
|
|
496 |
// Debugging |
// Debugging |
497 |
// printf("sql was: %s<BR>", $sql); |
// printf("sql was: %s<BR>", $sql); |
498 |
|
|
499 |
// Write the new record to the database |
// Write the new record to the database |
500 |
xx_query ("LOCK TABLE resource WRITE", $con); |
xx_query ("LOCK TABLE resource WRITE", $con); |
501 |
if (!xx_query($sql, $con)){ |
if (!xx_prepare_execute($sql, $annotation, $author, $call_no, $cat_num, $coverage_detail, $edition, $infotype_id, $other_title, $pub_date, $publisher, $sources_indexed, $title, $url, $sess_staff_account)){ |
502 |
sql_err($con); |
sql_err($con); |
503 |
xx_query ("UNLOCK TABLES", $con); |
xx_query ("UNLOCK TABLES", $con); |
504 |
bailout(); |
bailout(); |
505 |
} |
} |
506 |
else { |
else { |
507 |
$resource_id = xx_insert_id($con); |
// $resource_id = xx_insert_id($con) |
508 |
|
$insert_res = xx_prepare_execute("select 1 as id from resource where annotation = ? and author = ? and call_no = ? and cat_num = ? and coverage_detail = ? and date_created = ? and date_modified = ? and edition = ? and infotype_id = ? and other_title = ? and pub_date = ? and publisher = ? and sources_indexed = ? and title = ? and url = ? and account_created = ?", $annotation, $author, $call_no, $cat_num, $coverage_detail, $edition, $infotype_id, $other_title, $pub_date, $publisher, $sources_indexed, $title, $url, $sess_staff_account); |
509 |
|
list($resource_id) = $insert_res->fetchRow(DB_FETCHMODE_ORDERED); |
510 |
xx_query("UNLOCK TABLES", $con); |
xx_query("UNLOCK TABLES", $con); |
511 |
|
|
512 |
// Now set up this resource with its first mastersubject |
// Now set up this resource with its first mastersubject |
513 |
// Note that id#1 = N/A and id#2 = (All), and are not used here. |
// Note that id#1 = N/A and id#2 = (All), and are not used here. |
514 |
if ($mastersubject_id > 2) { |
if ($mastersubject_id > 2) { |
515 |
$sql = "INSERT INTO res_mastersubject (resource_id, mastersubject_id) VALUES (" |
$sql = "INSERT INTO res_mastersubject (resource_id, mastersubject_id) VALUES ( ? , ? )"; |
|
. $resource_id |
|
|
. ", " |
|
|
. $mastersubject_id |
|
|
. ")"; |
|
516 |
|
|
517 |
// Write the new res_mastersubject to the database |
// Write the new res_mastersubject to the database |
518 |
xx_query ("LOCK TABLE res_mastersubject WRITE", $con); |
xx_query ("LOCK TABLE res_mastersubject WRITE", $con); |
519 |
if (!xx_query($sql, $con)){ |
if (!xx_prepare_execute($sql, $resource_id, $mastersubject_id)){ |
520 |
sql_err($con); |
sql_err($con); |
521 |
xx_query ("UNLOCK TABLES", $con); |
xx_query ("UNLOCK TABLES", $con); |
522 |
bailout(); |
bailout(); |
594 |
if ($err_code == 0){ |
if ($err_code == 0){ |
595 |
|
|
596 |
// Clean up strings |
// Clean up strings |
|
$newValue = textInmySQL($newValue); |
|
597 |
|
|
598 |
// Build the SQL |
// Build the SQL |
599 |
$sql = "INSERT INTO " |
$sql = "INSERT INTO ? ( ? ) VALUES ( ? )"; |
|
. $table |
|
|
." (" |
|
|
. $field |
|
|
. ") VALUES ('" |
|
|
. $newValue |
|
|
. "')"; |
|
600 |
|
|
601 |
// Debugging |
// Debugging |
602 |
// printf("sql was: %s<br>", $sql); |
// printf("sql was: %s<br>", $sql); |
603 |
|
|
604 |
if (!xx_query ($sql, $con)){ |
if (!xx_prepare_execute($sql, $table, $field, $newValue)){ |
605 |
sql_err($sql); |
sql_err($sql); |
606 |
xx_query ("UNLOCK TABLES", $con); |
xx_query ("UNLOCK TABLES", $con); |
607 |
bailout(); |
bailout(); |
608 |
} |
} |
609 |
else { |
else { |
610 |
$new_id = xx_insert_id($con); |
// $new_id = xx_insert_id($con) |
611 |
|
$insert_res = xx_prepare_execute("select 1 as id from ? where ? = ?", $table, $field, $newValue); |
612 |
|
list($new_id) = $insert_res->fetchRow(DB_FETCHMODE_ORDERED); |
613 |
xx_query ("UNLOCK TABLES", $con); |
xx_query ("UNLOCK TABLES", $con); |
614 |
printf("%s <b>%s</b> successfully added.\n", $display, $newValue_display); |
printf("%s <b>%s</b> successfully added.\n", $display, $newValue_display); |
615 |
} |
} |
656 |
if ($err_code == 0) { |
if ($err_code == 0) { |
657 |
|
|
658 |
// Clean up strings |
// Clean up strings |
|
if (strlen($address1) > 0) $address1 = textInmySQL($address1); |
|
|
if (strlen($address2) > 0) $address2 = textInmySQL($address2); |
|
|
if (strlen($address3) > 0) $address3 = textInmySQL($address3); |
|
|
if (strlen($address4) > 0) $address4 = textInmySQL($address4); |
|
|
if (strlen($email) > 0) $email = textInmySQL($email); |
|
|
if (strlen($fax) > 0) $fax = textInmySQL($fax); |
|
|
if (strlen($service) > 0) $service = textInmySQL($service); |
|
|
if (strlen($serviceDescr) > 0) $serviceDescr = textInmySQL($serviceDescr); |
|
|
if (strlen($serviceURL) > 0) $serviceURL = textInmySQL($serviceURL); |
|
|
if (strlen($telephone) > 0) $telephone = textInmySQL($telephone); |
|
659 |
|
|
660 |
// Set up SQL |
// Set up SQL |
661 |
$sql = "INSERT INTO service (address1, address2, address3, address4, |
$sql = "INSERT INTO service (address1, address2, address3, address4, |
662 |
email, fax, nonaff, service, serviceDescr, serviceURL, |
email, fax, nonaff, service, serviceDescr, serviceURL, |
663 |
telephone) VALUES ('" |
telephone) VALUES ( ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? )"; |
|
. $address1 |
|
|
. "', '" |
|
|
. $address2 |
|
|
. "', '" |
|
|
. $address3 |
|
|
. "', '" |
|
|
. $address4 |
|
|
. "', '" |
|
|
. $email |
|
|
. "', '" |
|
|
. $fax |
|
|
. "', '" |
|
|
. $nonaff |
|
|
. "', '" |
|
|
. $service |
|
|
. "', '" |
|
|
. $serviceDescr |
|
|
. "', '" |
|
|
. $serviceURL |
|
|
. "', '" |
|
|
. $telephone |
|
|
. "')"; |
|
664 |
|
|
665 |
// Write the new row to the database |
// Write the new row to the database |
666 |
xx_query ("LOCK TABLE service WRITE", $con); |
xx_query ("LOCK TABLE service WRITE", $con); |
667 |
if (!xx_query($sql, $con)){ |
if (!xx_prepare_execute($sql, $address1, $address2, $address3, $address4, $email, $fax, $nonaff, $service, $serviceDescr, $serviceURL, $telephone)){ |
668 |
sql_err($con); |
sql_err($con); |
669 |
xx_query ("UNLOCK TABLES", $con); |
xx_query ("UNLOCK TABLES", $con); |
670 |
bailout(); |
bailout(); |
671 |
} |
} |
672 |
else { |
else { |
673 |
$service_id = xx_insert_id($con); |
// $service_id = xx_insert_id($con) |
674 |
|
$insert_res = xx_prepare_execute("select 1 as id from service where address1 = ? and address2 = ? and address3 = ? and address4 = ? and email = ? and fax = ? and nonaff = ? and service = ? and serviceDescr = ? and serviceURL = ? and telephone = ?", $address1, $address2, $address3, $address4, $email, $fax, $nonaff, $service, $serviceDescr, $serviceURL, $telephone); |
675 |
|
list($service_id) = $insert_res->fetchRow(DB_FETCHMODE_ORDERED); |
676 |
xx_query("UNLOCK TABLES", $con); |
xx_query("UNLOCK TABLES", $con); |
677 |
formService($con, $service_id); |
formService($con, $service_id); |
678 |
} |
} |
746 |
if ($err_code == 0) { |
if ($err_code == 0) { |
747 |
|
|
748 |
// Clean up strings |
// Clean up strings |
|
if (strlen($first_name) > 0) $first_name = textInmySQL($first_name); |
|
|
if (strlen($last_name) > 0) $last_name = textInmySQL($last_name); |
|
|
if (strlen($staff_account) > 0) $staff_account = textInmySQL($staff_account); |
|
|
if (strlen($staff_email) > 0) $staff_email = textInmySQL($staff_email); |
|
749 |
|
|
750 |
// Set up SQL |
// Set up SQL |
751 |
$sql = "INSERT INTO staff (access_id, first_name, last_name, stafftitle_id, |
$sql = "INSERT INTO staff (access_id, first_name, last_name, stafftitle_id, |
752 |
staff_account, staff_email) VALUES (" |
staff_account, staff_email) VALUES ( ? , ? , ? , ? , ? , ? )"; |
|
. $access_id |
|
|
. ", '" |
|
|
. $first_name |
|
|
. "', '" |
|
|
. $last_name |
|
|
. "', " |
|
|
. $stafftitle_id |
|
|
. ", '" |
|
|
. $staff_account |
|
|
. "', '" |
|
|
. $staff_email |
|
|
. "')"; |
|
753 |
|
|
754 |
// Debugging |
// Debugging |
755 |
// printf("sql was: %s<br><br>\n", $sql); |
// printf("sql was: %s<br><br>\n", $sql); |
756 |
|
|
757 |
// Write the new row to the database |
// Write the new row to the database |
758 |
xx_query ("LOCK TABLE staff WRITE", $con); |
xx_query ("LOCK TABLE staff WRITE", $con); |
759 |
if (!xx_query($sql, $con)){ |
if (!xx_prepare_execute($sql, $access_id, $first_name, $last_name, $stafftitle_id, $staff_account, $staff_email)){ |
760 |
sql_err($con); |
sql_err($con); |
761 |
xx_query ("UNLOCK TABLES", $con); |
xx_query ("UNLOCK TABLES", $con); |
762 |
bailout(); |
bailout(); |
764 |
else { |
else { |
765 |
|
|
766 |
// Success, call formStaff back. |
// Success, call formStaff back. |
767 |
$staff_id = xx_insert_id($con); |
// $staff_id = xx_insert_id($con) |
768 |
|
$insert_res = xx_prepare_execute("select 1 as id from staff where access_id = ? and first_name = ? and last_name = ? and stafftitle_id = ? and staff_account = ? and staff_email = ?", $access_id, $first_name, $last_name, $stafftitle_id, $staff_account, $staff_email); |
769 |
|
list($staff_id) = $insert_res->fetchRow(DB_FETCHMODE_ORDERED); |
770 |
xx_query("UNLOCK TABLES", $con); |
xx_query("UNLOCK TABLES", $con); |
771 |
formStaff($con, $staff_id); |
formStaff($con, $staff_id); |
772 |
} |
} |
830 |
if ($err_code == 0) { |
if ($err_code == 0) { |
831 |
|
|
832 |
// Clean up strings |
// Clean up strings |
|
if (strlen($css_file) > 0) $css_file = textInmySQL($css_file); |
|
|
if (strlen($footer_file) > 0) $footer_file = textInmySQL($footer_file); |
|
|
if (strlen($header_file) > 0) $header_file = textInmySQL($header_file); |
|
|
if (strlen($style_title) > 0) $style_title = textInmySQL($style_title); |
|
833 |
|
|
834 |
// Set up SQL |
// Set up SQL |
835 |
$sql = "INSERT INTO style (css_file, footer_file, header_file, style_title) VALUES ('" |
$sql = "INSERT INTO style (css_file, footer_file, header_file, style_title) VALUES ( ? , ? , ? , ? )"; |
|
. $css_file |
|
|
. "', '" |
|
|
. $footer_file |
|
|
. "', '" |
|
|
. $header_file |
|
|
. "', '" |
|
|
. $style_title |
|
|
. "')"; |
|
836 |
|
|
837 |
// Write the new row to the database |
// Write the new row to the database |
838 |
if (!xx_query($sql, $con)){ |
if (!xx_prepare_execute($sql, $css_file, $footer_file, $header_file, $style_title)){ |
839 |
sql_err($con); |
sql_err($con); |
840 |
xx_query ("UNLOCK TABLES", $con); |
xx_query ("UNLOCK TABLES", $con); |
841 |
bailout(); |
bailout(); |
887 |
if ($err_code == 0) { |
if ($err_code == 0) { |
888 |
|
|
889 |
// Clean up strings |
// Clean up strings |
|
$subject = textInmySQL($subject); |
|
|
if (strlen($subject_descr) > 0) $subject_descr = textInmySQL($subject_descr); |
|
890 |
|
|
891 |
// Set up SQL |
// Set up SQL |
892 |
$sql = "INSERT INTO subject (subject, subject_descr, sublocation_id, rqs_date_created, rqs_account_created) VALUES ('" |
$sql = "INSERT INTO subject (subject, subject_descr, sublocation_id, rqs_date_created, rqs_account_created) VALUES ( ? , ? , ? , now(), ? )"; |
|
. $subject |
|
|
. "', '" |
|
|
. $subject_descr |
|
|
. "', " |
|
|
. $sublocation_id |
|
|
. ", now(), '" |
|
|
. $sess_staff_account |
|
|
. "')"; |
|
893 |
|
|
894 |
// Write the new row to the database |
// Write the new row to the database |
895 |
xx_query ("LOCK TABLE subject WRITE", $con); |
xx_query ("LOCK TABLE subject WRITE", $con); |
896 |
if (!xx_query($sql, $con)){ |
if (!xx_prepare_execute($sql, $subject, $subject_descr, $sublocation_id, $sess_staff_account)){ |
897 |
sql_err($con); |
sql_err($con); |
898 |
xx_query ("UNLOCK TABLES", $con); |
xx_query ("UNLOCK TABLES", $con); |
899 |
bailout(); |
bailout(); |
900 |
} |
} |
901 |
else { |
else { |
902 |
$subject_id = xx_insert_id($con); |
// $subject_id = xx_insert_id($con) |
903 |
|
$insert_res = xx_prepare_execute("select 1 as id from subject where subject = ? and subject_descr = ? and sublocation_id = ? and rqs_account_created = ?", $subject, $subject_descr, $sublocation_id, $sess_staff_account); |
904 |
|
list($subject_id) = $insert_res->fetchRow(DB_FETCHMODE_ORDERED); |
905 |
xx_query("UNLOCK TABLES", $con); |
xx_query("UNLOCK TABLES", $con); |
906 |
|
|
907 |
// Insert this staff person as an assigned staff member to this subject |
// Insert this staff person as an assigned staff member to this subject |
908 |
$sql = "INSERT INTO sub_staff (subject_id, staff_id) VALUES (" |
$sql = "INSERT INTO sub_staff (subject_id, staff_id) VALUES ( ? , ? )"; |
|
. $subject_id |
|
|
. ", " |
|
|
. $sess_staff_id |
|
|
. ")"; |
|
909 |
|
|
910 |
if (!xx_query($sql, $con)){ |
if (!xx_prepare_execute($sql, $subject_id, $sess_staff_id)){ |
911 |
sql_err($con); |
sql_err($con); |
912 |
xx_query ("UNLOCK TABLES", $con); |
xx_query ("UNLOCK TABLES", $con); |
913 |
bailout(); |
bailout(); |