/[libdata]/trunk/admin/include/scribe_application.php
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/admin/include/scribe_application.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 41 by dpavlin, Tue Jan 27 20:42:02 2004 UTC revision 42 by dpavlin, Thu Mar 4 22:43:50 2004 UTC
# Line 92  function assignPageStaff($con, $page_id, Line 92  function assignPageStaff($con, $page_id,
92                  // Check to make sure that the staff isn't already assigned                  // Check to make sure that the staff isn't already assigned
93                  $sql = "SELECT * FROM page_staff where page_id = " . $page_id .                  $sql = "SELECT * FROM page_staff where page_id = " . $page_id .
94                  " AND staff_id = " . $staff_id_array[$subscript];                  " AND staff_id = " . $staff_id_array[$subscript];
95                  $rs = mysql_query($sql);                  $rs = xx_query($sql);
96                  if (mysql_num_rows($rs) == 0) {                  if (xx_num_rows($rs) == 0) {
97    
98                          $sql = "INSERT INTO page_staff (page_id, staff_id) VALUES ("                          $sql = "INSERT INTO page_staff (page_id, staff_id) VALUES ("
99                                  . $page_id                                  . $page_id
# Line 101  function assignPageStaff($con, $page_id, Line 101  function assignPageStaff($con, $page_id,
101                                  . $staff_id_array[$subscript]                                  . $staff_id_array[$subscript]
102                                  . ")";                                  . ")";
103                                                    
104                          if (!mysql_query($sql, $con)){                          if (!xx_query($sql, $con)){
105                                  sql_err($con);                                  sql_err($con);
106                                  mysql_query ("UNLOCK TABLES", $con);                                  xx_query ("UNLOCK TABLES", $con);
107                                  bailout();                                  bailout();
108                          } // bad write                          } // bad write
109                          else {                          else {
110                                  mysql_query("UNLOCK TABLES", $con);                                  xx_query("UNLOCK TABLES", $con);
111    
112                          } // good write of staff                          } // good write of staff
113                                                    
# Line 137  function assignStaffCoordinator($con, $p Line 137  function assignStaffCoordinator($con, $p
137                  . " WHERE page_id = "                  . " WHERE page_id = "
138                  . $page_id;                  . $page_id;
139                                    
140          if (!mysql_query ($sql, $con)){          if (!xx_query ($sql, $con)){
141                  sql_err($sql);                  sql_err($sql);
142                  mysql_query ("UNLOCK TABLES", $con);                  xx_query ("UNLOCK TABLES", $con);
143                  bailout();                  bailout();
144          }          }
145          else {  // Success call the page back          else {  // Success call the page back
146                  mysql_query ("UNLOCK TABLES", $con);                  xx_query ("UNLOCK TABLES", $con);
147                  header("Location: scribe.phtml?page_id=" . $page_id);                  header("Location: scribe.phtml?page_id=" . $page_id);
148          }          }
149  }  }
# Line 178  function copyPasteElement($con, $page_id Line 178  function copyPasteElement($con, $page_id
178          //printf("sql was: %s<BR>\n", $sql);          //printf("sql was: %s<BR>\n", $sql);
179                    
180                    
181          if (!mysql_query($sql, $con)){          if (!xx_query($sql, $con)){
182                  sql_err($con);                  sql_err($con);
183                  mysql_query ("UNLOCK TABLES", $con);                  xx_query ("UNLOCK TABLES", $con);
184                  $success = 0;                  $success = 0;
185                  bailout();                  bailout();
186          }          }
187          else {          else {
188                  mysql_query("UNLOCK TABLES", $con);                  xx_query("UNLOCK TABLES", $con);
189    
190          }          }
191    
# Line 208  function copyPasteElement($con, $page_id Line 208  function copyPasteElement($con, $page_id
208                          . " AND element_order > "                          . " AND element_order > "
209                          . $element_order                          . $element_order
210                          . " ORDER BY element_order";                          . " ORDER BY element_order";
211                  $rs = mysql_query($sql, $con);                  $rs = xx_query($sql, $con);
212    
213                  // Check for indent level                  // Check for indent level
214                  while (($row = mysql_fetch_array ($rs)) && ($end_found == 0)) {                  while (($row = xx_fetch_array ($rs)) && ($end_found == 0)) {
215    
216                          $probe_element_id = $row["element_id"];                          $probe_element_id = $row["element_id"];
217                          $probe_indent_level = $row["indent_level"];                          $probe_indent_level = $row["indent_level"];
# Line 272  function copyPasteElement($con, $page_id Line 272  function copyPasteElement($con, $page_id
272                  . $end_element_order                  . $end_element_order
273                  . " ORDER BY element_order";                  . " ORDER BY element_order";
274    
275          if (!mysql_query($sql, $con)){          if (!xx_query($sql, $con)){
276                  sql_err($con);                  sql_err($con);
277                  mysql_query ("UNLOCK TABLES", $con);                  xx_query ("UNLOCK TABLES", $con);
278                  $success = 0;                  $success = 0;
279                  bailout();                  bailout();
280          }          }
281          else {          else {
282                  mysql_query("UNLOCK TABLES", $con);                  xx_query("UNLOCK TABLES", $con);
283    
284          }          }
285                    
# Line 301  function deleteCopyBuffer($con, $page_id Line 301  function deleteCopyBuffer($con, $page_id
301          $sql = "DELETE from pastebuffer WHERE paste_staff_id = "          $sql = "DELETE from pastebuffer WHERE paste_staff_id = "
302                  . $paste_staff_id;                  . $paste_staff_id;
303    
304          if (!mysql_query ($sql, $con)){          if (!xx_query ($sql, $con)){
305                  sql_err($sql);                  sql_err($sql);
306                  mysql_query ("UNLOCK TABLES", $con);                  xx_query ("UNLOCK TABLES", $con);
307                  bailout();                  bailout();
308          }          }
309          else {          else {
310                  mysql_query ("UNLOCK TABLES", $con);                  xx_query ("UNLOCK TABLES", $con);
311          }          }
312    
313          header("Location: scribe.phtml?page_id=". $page_id);          header("Location: scribe.phtml?page_id=". $page_id);
# Line 330  function deleteCoursePers($con, $course_ Line 330  function deleteCoursePers($con, $course_
330                  . " AND course_id = "                  . " AND course_id = "
331                  . $course_id;                  . $course_id;
332    
333          if (!mysql_query ($sql, $con)){          if (!xx_query ($sql, $con)){
334                  sql_err($sql);                  sql_err($sql);
335                  mysql_query ("UNLOCK TABLES", $con);                  xx_query ("UNLOCK TABLES", $con);
336                  bailout();                  bailout();
337          }          }
338          else {          else {
339                  mysql_query ("UNLOCK TABLES", $con);                  xx_query ("UNLOCK TABLES", $con);
340          }          }
341    
342          header("Location: scribe.phtml?page_id=". $page_id);          header("Location: scribe.phtml?page_id=". $page_id);
# Line 392  function deleteElement($con, $page_id, $ Line 392  function deleteElement($con, $page_id, $
392                          . $page_id                          . $page_id
393                          . " AND element_id = "                          . " AND element_id = "
394                          . $element_id;                          . $element_id;
395                  if (!mysql_query($sql, $con)){                  if (!xx_query($sql, $con)){
396                          sql_err($con);                          sql_err($con);
397                          mysql_query ("UNLOCK TABLES", $con);                          xx_query ("UNLOCK TABLES", $con);
398                          $success = 0;                          $success = 0;
399                          bailout();                          bailout();
400                  }                  }
401                  else {                  else {
402                          mysql_query("UNLOCK TABLES", $con);                          xx_query("UNLOCK TABLES", $con);
403    
404                  }                        }      
405                                    
# Line 412  function deleteElement($con, $page_id, $ Line 412  function deleteElement($con, $page_id, $
412                                  . $element_order;                                  . $element_order;
413    
414                          // Make the change                          // Make the change
415                          if (!mysql_query($sql, $con)){                          if (!xx_query($sql, $con)){
416                                  sql_err($con);                                  sql_err($con);
417                                  mysql_query ("UNLOCK TABLES", $con);                                  xx_query ("UNLOCK TABLES", $con);
418                                  bailout();                                  bailout();
419                          }                          }
420                          else {                          else {
421                                  mysql_query("UNLOCK TABLES", $con);                                  xx_query("UNLOCK TABLES", $con);
422                                                                    
423                          } // end reordering                          } // end reordering
424                                                    
# Line 430  function deleteElement($con, $page_id, $ Line 430  function deleteElement($con, $page_id, $
430                                  . $page_id                                  . $page_id
431                                  . " AND element_id = "                                  . " AND element_id = "
432                                  . $element_id;                                  . $element_id;
433                          if (!mysql_query($sql, $con)){                          if (!xx_query($sql, $con)){
434                                  sql_err($con);                                  sql_err($con);
435                                  mysql_query ("UNLOCK TABLES", $con);                                  xx_query ("UNLOCK TABLES", $con);
436                                  $success = 0;                                  $success = 0;
437                                  bailout();                                  bailout();
438                          }                          }
439                          else {                          else {
440                                  mysql_query("UNLOCK TABLES", $con);                                  xx_query("UNLOCK TABLES", $con);
441    
442                                  // Done, return to page                                  // Done, return to page
443                                  if ($position > 2) $new_pos = $position - 1;                                  if ($position > 2) $new_pos = $position - 1;
# Line 474  function deleteElement($con, $page_id, $ Line 474  function deleteElement($con, $page_id, $
474                          . " AND element_order > "                          . " AND element_order > "
475                          . $element_order                          . $element_order
476                          . " ORDER BY element_order";                          . " ORDER BY element_order";
477                  $rs = mysql_query($sql, $con);                  $rs = xx_query($sql, $con);
478    
479                  // Check for and promote all descendants                  // Check for and promote all descendants
480                  while (($row = mysql_fetch_array ($rs)) && ($desc_indent_level > $indent_level)) {                  while (($row = xx_fetch_array ($rs)) && ($desc_indent_level > $indent_level)) {
481                          $desc_element_id = $row["element_id"];                          $desc_element_id = $row["element_id"];
482                          $desc_parent_id = $row["parent_id"];                          $desc_parent_id = $row["parent_id"];
483                          $desc_indent_level = $row["indent_level"];                          $desc_indent_level = $row["indent_level"];
# Line 489  function deleteElement($con, $page_id, $ Line 489  function deleteElement($con, $page_id, $
489                                          . " AND element_id = "                                          . " AND element_id = "
490                                          . $desc_element_id;                                          . $desc_element_id;
491                                                                                    
492                                  if (!mysql_query($promote_sql, $con)){                                  if (!xx_query($promote_sql, $con)){
493                                          sql_err($con);                                          sql_err($con);
494                                          mysql_query ("UNLOCK TABLES", $con);                                          xx_query ("UNLOCK TABLES", $con);
495                                          $success = 0;                                                                            $success = 0;                                  
496                                          bailout();                                          bailout();
497                                  }                                  }
498                                  else {                                  else {
499                                          mysql_query("UNLOCK TABLES", $con);                                          xx_query("UNLOCK TABLES", $con);
500    
501                                  } // end of a descendant promote                                  } // end of a descendant promote
502    
# Line 517  function deleteElement($con, $page_id, $ Line 517  function deleteElement($con, $page_id, $
517                                          . $page_id                                          . $page_id
518                                          . " AND element_id = "                                          . " AND element_id = "
519                                          . $desc_element_id;                                          . $desc_element_id;
520                                  if (!mysql_query($newparent_sql, $con)){                                  if (!xx_query($newparent_sql, $con)){
521                                          sql_err($con);                                          sql_err($con);
522                                          mysql_query ("UNLOCK TABLES", $con);                                          xx_query ("UNLOCK TABLES", $con);
523                                          $success = 0;                                                                            $success = 0;                                  
524                                          bailout();                                          bailout();
525                                  }                                  }
526                                  else {                                  else {
527                                          mysql_query("UNLOCK TABLES", $con);                                          xx_query("UNLOCK TABLES", $con);
528    
529                                  } // end of a first-generation parent reassignment                                  } // end of a first-generation parent reassignment
530                                                    
# Line 536  function deleteElement($con, $page_id, $ Line 536  function deleteElement($con, $page_id, $
536                  if ($success == 1) {                  if ($success == 1) {
537                          $parent_sql = "DELETE FROM element WHERE element_id = "                          $parent_sql = "DELETE FROM element WHERE element_id = "
538                                  . $element_id;                                  . $element_id;
539                          if (!mysql_query($parent_sql, $con)){                          if (!xx_query($parent_sql, $con)){
540                                  sql_err($con);                                  sql_err($con);
541                                  mysql_query ("UNLOCK TABLES", $con);                                  xx_query ("UNLOCK TABLES", $con);
542                                  bailout();                                  bailout();
543                                  $success = 0;                                  $success = 0;
544                          }                          }
545                          else {                          else {
546                                  mysql_query("UNLOCK TABLES", $con);                                  xx_query("UNLOCK TABLES", $con);
547    
548                                  // Increment the deleted counter to include the parent                                  // Increment the deleted counter to include the parent
549                                  $num_desc++;                                  $num_desc++;
# Line 558  function deleteElement($con, $page_id, $ Line 558  function deleteElement($con, $page_id, $
558                                  . $page_id                                  . $page_id
559                                  . " AND element_order > "                                  . " AND element_order > "
560                                  . $element_order;                                  . $element_order;
561                          if (!mysql_query($order_sql, $con)){                          if (!xx_query($order_sql, $con)){
562                                  sql_err($con);                                  sql_err($con);
563                                  mysql_query ("UNLOCK TABLES", $con);                                  xx_query ("UNLOCK TABLES", $con);
564                                  bailout();                                  bailout();
565                                  $success = 0;                                  $success = 0;
566                          }                          }
567                          else {                          else {
568                                  mysql_query("UNLOCK TABLES", $con);                                  xx_query("UNLOCK TABLES", $con);
569    
570                          } // end reordering                          } // end reordering
571    
# Line 578  function deleteElement($con, $page_id, $ Line 578  function deleteElement($con, $page_id, $
578                                  . $page_id                                  . $page_id
579                                  . " AND element_id = "                                  . " AND element_id = "
580                                  . $element_id;                                  . $element_id;
581                          if (!mysql_query($sql, $con)){                          if (!xx_query($sql, $con)){
582                                  sql_err($con);                                  sql_err($con);
583                                  mysql_query ("UNLOCK TABLES", $con);                                  xx_query ("UNLOCK TABLES", $con);
584                                  $success = 0;                                  $success = 0;
585                                  bailout();                                  bailout();
586                          }                          }
587                          else {                          else {
588                                  mysql_query("UNLOCK TABLES", $con);                                  xx_query("UNLOCK TABLES", $con);
589    
590                                  // Done, return to page                                  // Done, return to page
591                                  if ($position > 2) $new_pos = $position - 1;                                  if ($position > 2) $new_pos = $position - 1;
# Line 628  function deleteElement($con, $page_id, $ Line 628  function deleteElement($con, $page_id, $
628                          . " AND element_order > "                          . " AND element_order > "
629                          . $element_order                          . $element_order
630                          . " ORDER BY element_order";                          . " ORDER BY element_order";
631                  $rs = mysql_query($sql, $con);                  $rs = xx_query($sql, $con);
632                                    
633                  // Check for and delete all descendants                  // Check for and delete all descendants
634                  while (($row = mysql_fetch_array ($rs)) && ($desc_indent_level > $indent_level)) {                  while (($row = xx_fetch_array ($rs)) && ($desc_indent_level > $indent_level)) {
635                          $desc_element_id = $row["element_id"];                          $desc_element_id = $row["element_id"];
636                          $desc_parent_id = $row["parent_id"];                          $desc_parent_id = $row["parent_id"];
637                          $desc_indent_level = $row["indent_level"];                          $desc_indent_level = $row["indent_level"];
# Line 640  function deleteElement($con, $page_id, $ Line 640  function deleteElement($con, $page_id, $
640                          if ($desc_indent_level > $indent_level) {                          if ($desc_indent_level > $indent_level) {
641                                  $delete_sql = "DELETE FROM element WHERE element_id = "                                  $delete_sql = "DELETE FROM element WHERE element_id = "
642                                          . $desc_element_id;                                                      . $desc_element_id;            
643                                  if (!mysql_query($delete_sql, $con)){                                  if (!xx_query($delete_sql, $con)){
644                                          sql_err($con);                                          sql_err($con);
645                                          mysql_query ("UNLOCK TABLES", $con);                                          xx_query ("UNLOCK TABLES", $con);
646                                          bailout();                                          bailout();
647                                          $success = 0;                                          $success = 0;
648                                  }                                  }
649                                  else {                                  else {
650                                          mysql_query("UNLOCK TABLES", $con);                                          xx_query("UNLOCK TABLES", $con);
651    
652                                          // Increment the deleted descendant counter                                          // Increment the deleted descendant counter
653                                          $num_desc++;                                          $num_desc++;
# Line 662  function deleteElement($con, $page_id, $ Line 662  function deleteElement($con, $page_id, $
662                                          . $page_id                                          . $page_id
663                                          . " AND element_id = "                                          . " AND element_id = "
664                                          . $desc_element_id;                                          . $desc_element_id;
665                                  if (!mysql_query($sql, $con)){                                  if (!xx_query($sql, $con)){
666                                          sql_err($con);                                          sql_err($con);
667                                          mysql_query ("UNLOCK TABLES", $con);                                          xx_query ("UNLOCK TABLES", $con);
668                                          $success = 0;                                          $success = 0;
669                                          bailout();                                          bailout();
670                                  }                                  }
671                                  else {                                  else {
672                                          mysql_query("UNLOCK TABLES", $con);                                          xx_query("UNLOCK TABLES", $con);
673    
674                                  }                                  }
675                          } // end removal from stats database                          } // end removal from stats database
# Line 680  function deleteElement($con, $page_id, $ Line 680  function deleteElement($con, $page_id, $
680                  if ($success == 1) {                  if ($success == 1) {
681                          $parent_sql = "DELETE FROM element WHERE element_id = "                          $parent_sql = "DELETE FROM element WHERE element_id = "
682                                  . $element_id;                                  . $element_id;
683                          if (!mysql_query($parent_sql, $con)){                          if (!xx_query($parent_sql, $con)){
684                                  sql_err($con);                                  sql_err($con);
685                                  mysql_query ("UNLOCK TABLES", $con);                                  xx_query ("UNLOCK TABLES", $con);
686                                  bailout();                                  bailout();
687                                  $success = 0;                                  $success = 0;
688                          }                          }
689                          else {                          else {
690                                  mysql_query("UNLOCK TABLES", $con);                                  xx_query("UNLOCK TABLES", $con);
691    
692                                  // Increment the deleted counter to include the parent                                  // Increment the deleted counter to include the parent
693                                  $num_desc++;                                  $num_desc++;
# Line 704  function deleteElement($con, $page_id, $ Line 704  function deleteElement($con, $page_id, $
704                                  . $page_id                                  . $page_id
705                                  . " AND element_order > "                                  . " AND element_order > "
706                                  . $element_order;                                  . $element_order;
707                          if (!mysql_query($order_sql, $con)){                          if (!xx_query($order_sql, $con)){
708                                  sql_err($con);                                  sql_err($con);
709                                  mysql_query ("UNLOCK TABLES", $con);                                  xx_query ("UNLOCK TABLES", $con);
710                                  bailout();                                  bailout();
711                                  $success = 0;                                  $success = 0;
712                          }                          }
713                          else {                          else {
714                                  mysql_query("UNLOCK TABLES", $con);                                  xx_query("UNLOCK TABLES", $con);
715    
716                          } // end reordering                          } // end reordering
717    
# Line 725  function deleteElement($con, $page_id, $ Line 725  function deleteElement($con, $page_id, $
725                                  . " AND element_id = "                                  . " AND element_id = "
726                                  . $element_id;                                  . $element_id;
727    
728                          if (!mysql_query($sql, $con)){                          if (!xx_query($sql, $con)){
729                                  sql_err($con);                                  sql_err($con);
730                                  mysql_query ("UNLOCK TABLES", $con);                                  xx_query ("UNLOCK TABLES", $con);
731                                  $success = 0;                                  $success = 0;
732                                  bailout();                                  bailout();
733                          }                          }
734                          else {                          else {
735                                  mysql_query("UNLOCK TABLES", $con);                                  xx_query("UNLOCK TABLES", $con);
736    
737                                  // Done, return to page                                  // Done, return to page
738                                  if ($position > 2) $new_pos = $position - 1;                                  if ($position > 2) $new_pos = $position - 1;
# Line 800  function deletePage($con, $page_id){ Line 800  function deletePage($con, $page_id){
800                  $sql = "SELECT course_id FROM course WHERE page_id = "                  $sql = "SELECT course_id FROM course WHERE page_id = "
801                          . $page_id;                          . $page_id;
802                                                    
803                  $rs = mysql_query($sql, $con);                  $rs = xx_query($sql, $con);
804                  $row = mysql_fetch_array ($rs);                  $row = xx_fetch_array ($rs);
805    
806                  // Collect the access information                  // Collect the access information
807                  $course_id = $row["course_id"];                  $course_id = $row["course_id"];
# Line 809  function deletePage($con, $page_id){ Line 809  function deletePage($con, $page_id){
809                  // Delete all elements first                  // Delete all elements first
810                  $sql = "DELETE from element WHERE page_id =" . $page_id;                  $sql = "DELETE from element WHERE page_id =" . $page_id;
811                                    
812                  if (!mysql_query ($sql, $con)){                  if (!xx_query ($sql, $con)){
813                          $success = 0;                          $success = 0;
814                          sql_err($sql);                          sql_err($sql);
815                          mysql_query ("UNLOCK TABLES", $con);                          xx_query ("UNLOCK TABLES", $con);
816                          bailout();                          bailout();
817                  }                  }
818                  else {                  else {
819                          mysql_query ("UNLOCK TABLES", $con);                          xx_query ("UNLOCK TABLES", $con);
820                          printf("Removed this page's elements.<BR>\n");                          printf("Removed this page's elements.<BR>\n");
821                  }                  }
822                                    
# Line 825  function deletePage($con, $page_id){ Line 825  function deletePage($con, $page_id){
825    
826                          $sql = "DELETE from course WHERE page_id =" . $page_id;                          $sql = "DELETE from course WHERE page_id =" . $page_id;
827                                    
828                          if (!mysql_query ($sql, $con)){                          if (!xx_query ($sql, $con)){
829                                  $success = 0;                                  $success = 0;
830                                  sql_err($sql);                                  sql_err($sql);
831                                  mysql_query ("UNLOCK TABLES", $con);                                  xx_query ("UNLOCK TABLES", $con);
832                                  bailout();                                  bailout();
833                          }                          }
834                          else {                          else {
835                                  mysql_query ("UNLOCK TABLES", $con);                                  xx_query ("UNLOCK TABLES", $con);
836                                  printf("Removed course information (if any).<BR>\n");                                  printf("Removed course information (if any).<BR>\n");
837                          }                          }
838                  }                  }
# Line 842  function deletePage($con, $page_id){ Line 842  function deletePage($con, $page_id){
842    
843                          $sql = "DELETE from course_personnel WHERE course_id =" . $course_id;                          $sql = "DELETE from course_personnel WHERE course_id =" . $course_id;
844                                    
845                          if (!mysql_query ($sql, $con)){                          if (!xx_query ($sql, $con)){
846                                  $success = 0;                                  $success = 0;
847                                  sql_err($sql);                                  sql_err($sql);
848                                  mysql_query ("UNLOCK TABLES", $con);                                  xx_query ("UNLOCK TABLES", $con);
849                                  bailout();                                  bailout();
850                          }                          }
851                          else {                          else {
852                                  mysql_query ("UNLOCK TABLES", $con);                                  xx_query ("UNLOCK TABLES", $con);
853                                  printf("Removed assigned course personnel (if any).<BR>\n");                                  printf("Removed assigned course personnel (if any).<BR>\n");
854                          }                          }
855                  }                  }
# Line 859  function deletePage($con, $page_id){ Line 859  function deletePage($con, $page_id){
859    
860                          $sql = "DELETE from page_staff WHERE page_id =" . $page_id;                          $sql = "DELETE from page_staff WHERE page_id =" . $page_id;
861                                    
862                          if (!mysql_query ($sql, $con)){                          if (!xx_query ($sql, $con)){
863                                  $success = 0;                                  $success = 0;
864                                  sql_err($sql);                                  sql_err($sql);
865                                  mysql_query ("UNLOCK TABLES", $con);                                  xx_query ("UNLOCK TABLES", $con);
866                                  bailout();                                  bailout();
867                          }                          }
868                          else {                          else {
869                                  mysql_query ("UNLOCK TABLES", $con);                                  xx_query ("UNLOCK TABLES", $con);
870                                  printf("Removed assigned staff (if any).<BR>\n");                                  printf("Removed assigned staff (if any).<BR>\n");
871                          }                          }
872                  }                  }
# Line 876  function deletePage($con, $page_id){ Line 876  function deletePage($con, $page_id){
876    
877                          $sql = "DELETE from sub_page WHERE page_id =" . $page_id;                          $sql = "DELETE from sub_page WHERE page_id =" . $page_id;
878                                    
879                          if (!mysql_query ($sql, $con)){                          if (!xx_query ($sql, $con)){
880                                  $success = 0;                                  $success = 0;
881                                  sql_err($sql);                                  sql_err($sql);
882                                  mysql_query ("UNLOCK TABLES", $con);                                  xx_query ("UNLOCK TABLES", $con);
883                                  bailout();                                  bailout();
884                          }                          }
885                          else {                          else {
886                                  mysql_query ("UNLOCK TABLES", $con);                                  xx_query ("UNLOCK TABLES", $con);
887                                  printf("Removed assigned subjects (if any).<BR>\n");                                  printf("Removed assigned subjects (if any).<BR>\n");
888                          }                          }
889                  }                  }
# Line 893  function deletePage($con, $page_id){ Line 893  function deletePage($con, $page_id){
893    
894                          $sql = "DELETE from libstats.elementstats WHERE page_id =" . $page_id;                          $sql = "DELETE from libstats.elementstats WHERE page_id =" . $page_id;
895                                    
896                          if (!mysql_query ($sql, $con)){                          if (!xx_query ($sql, $con)){
897                                  $success = 0;                                  $success = 0;
898                                  sql_err($sql);                                  sql_err($sql);
899                                  mysql_query ("UNLOCK TABLES", $con);                                  xx_query ("UNLOCK TABLES", $con);
900                                  bailout();                                  bailout();
901                          }                          }
902                          else {                          else {
903                                  mysql_query ("UNLOCK TABLES", $con);                                  xx_query ("UNLOCK TABLES", $con);
904                                  printf("Removed page's element statistics (if any).<BR>\n");                                  printf("Removed page's element statistics (if any).<BR>\n");
905                          }                          }
906                  }                  }
# Line 910  function deletePage($con, $page_id){ Line 910  function deletePage($con, $page_id){
910    
911                          $sql = "DELETE from libstats.pagestats WHERE page_id =" . $page_id;                          $sql = "DELETE from libstats.pagestats WHERE page_id =" . $page_id;
912                                    
913                          if (!mysql_query ($sql, $con)){                          if (!xx_query ($sql, $con)){
914                                  $success = 0;                                  $success = 0;
915                                  sql_err($sql);                                  sql_err($sql);
916                                  mysql_query ("UNLOCK TABLES", $con);                                  xx_query ("UNLOCK TABLES", $con);
917                                  bailout();                                  bailout();
918                          }                          }
919                          else {                          else {
920                                  mysql_query ("UNLOCK TABLES", $con);                                  xx_query ("UNLOCK TABLES", $con);
921                                  printf("Removed page's overall statistics (if any).<BR>\n");                                  printf("Removed page's overall statistics (if any).<BR>\n");
922                          }                          }
923                  }                  }
# Line 927  function deletePage($con, $page_id){ Line 927  function deletePage($con, $page_id){
927    
928                          $sql = "DELETE from page WHERE page_id =" . $page_id;                          $sql = "DELETE from page WHERE page_id =" . $page_id;
929                                    
930                          if (!mysql_query ($sql, $con)){                          if (!xx_query ($sql, $con)){
931                                  sql_err($sql);                                  sql_err($sql);
932                                  mysql_query ("UNLOCK TABLES", $con);                                  xx_query ("UNLOCK TABLES", $con);
933                                  bailout();                                  bailout();
934                          }                          }
935                          else {                          else {
936                                  mysql_query ("UNLOCK TABLES", $con);                                  xx_query ("UNLOCK TABLES", $con);
937                                  printf("Removed page successfully.<BR><BR>\n");                                  printf("Removed page successfully.<BR><BR>\n");
938                          }                          }
939                  }                                }              
# Line 1057  function deletePageStaff($con, $page_id, Line 1057  function deletePageStaff($con, $page_id,
1057                  " AND staff_id = " . $staff_list_array[$element];                  " AND staff_id = " . $staff_list_array[$element];
1058    
1059                  // Failed                                                // Failed                              
1060                  if (!mysql_query ($sql, $con)){                  if (!xx_query ($sql, $con)){
1061                          sql_err($sql);                          sql_err($sql);
1062                          mysql_query ("UNLOCK TABLES", $con);                          xx_query ("UNLOCK TABLES", $con);
1063                          bailout();                          bailout();
1064                  }                  }
1065                                    
1066                  // Succeeded                  // Succeeded
1067                  else {                  else {
1068                          mysql_query ("UNLOCK TABLES", $con);                          xx_query ("UNLOCK TABLES", $con);
1069                  }                  }
1070          }          }
1071                    
# Line 1095  function displayCourseHeader($con, $page Line 1095  function displayCourseHeader($con, $page
1095                  WHERE                  WHERE
1096                  page_id = " . $page_id;                  page_id = " . $page_id;
1097                    
1098          $rs = mysql_query($sql, $con);          $rs = xx_query($sql, $con);
1099          $row = mysql_fetch_array ($rs);          $row = xx_fetch_array ($rs);
1100    
1101          $course_id = $row["course_id"];          $course_id = $row["course_id"];
1102          $staff_id_created = $row["staff_id_created"];          $staff_id_created = $row["staff_id_created"];
# Line 1199  function displayCoursePers($con, $page_i Line 1199  function displayCoursePers($con, $page_i
1199                  WHERE                  WHERE
1200                  course_id = " . $course_id . " ORDER BY personnel_id";                  course_id = " . $course_id . " ORDER BY personnel_id";
1201                    
1202          $rs = mysql_query($sql, $con);          $rs = xx_query($sql, $con);
1203                    
1204          // See how many in this record set          // See how many in this record set
1205          $num_personnel = mysql_num_rows($rs);          $num_personnel = xx_num_rows($rs);
1206    
1207          if ($num_personnel > 0) {          if ($num_personnel > 0) {
1208    
# Line 1211  function displayCoursePers($con, $page_i Line 1211  function displayCoursePers($con, $page_i
1211                  printf("<b>Personnel:</b><br>\n");                  printf("<b>Personnel:</b><br>\n");
1212    
1213    
1214                  while ($row = mysql_fetch_array ($rs)) {                  while ($row = xx_fetch_array ($rs)) {
1215    
1216                          // Initialize                          // Initialize
1217                          $last_name = "";                          $last_name = "";
# Line 1291  function displayTOC($con, $page_id, $wra Line 1291  function displayTOC($con, $page_id, $wra
1291          // Calculate number of elements          // Calculate number of elements
1292          $sql = "SELECT COUNT(*) as num_elements FROM element WHERE indent_level < 1 AND page_id = "          $sql = "SELECT COUNT(*) as num_elements FROM element WHERE indent_level < 1 AND page_id = "
1293                  . $page_id;                  . $page_id;
1294          $rs = mysql_query($sql, $con);          $rs = xx_query($sql, $con);
1295          $row = mysql_fetch_array ($rs);          $row = xx_fetch_array ($rs);
1296          $num_elements = $row["num_elements"];          $num_elements = $row["num_elements"];
1297    
1298          // Calculate midpoint element            // Calculate midpoint element  
# Line 1331  function displayTOC($con, $page_id, $wra Line 1331  function displayTOC($con, $page_id, $wra
1331                          . $page_id                          . $page_id
1332                          . " AND e.indent_level < 1 ORDER BY e.element_order";                          . " AND e.indent_level < 1 ORDER BY e.element_order";
1333    
1334                  $rs = mysql_query($sql, $con);                  $rs = xx_query($sql, $con);
1335    
1336                  // Build a general ToC anchor                  // Build a general ToC anchor
1337                  printf("<a name=\"toc\"></a>\n");                  printf("<a name=\"toc\"></a>\n");
# Line 1346  function displayTOC($con, $page_id, $wra Line 1346  function displayTOC($con, $page_id, $wra
1346                                    
1347                  $row_num = 0;                  $row_num = 0;
1348                                    
1349                  while ($row = mysql_fetch_array ($rs)) {                  while ($row = xx_fetch_array ($rs)) {
1350                                    
1351                          // Check for the midpoint                          // Check for the midpoint
1352                          if ($wrap_toc == 1)                          if ($wrap_toc == 1)
# Line 1447  function elementDecrease($con, $element_ Line 1447  function elementDecrease($con, $element_
1447                  . $element_id                  . $element_id
1448                  . " AND page_id = "                  . " AND page_id = "
1449                  . $page_id;                  . $page_id;
1450          $rs = mysql_query($sql, $con);          $rs = xx_query($sql, $con);
1451          $row = mysql_fetch_array ($rs);          $row = xx_fetch_array ($rs);    
1452          $element_size = $row["element_size"];          $element_size = $row["element_size"];
1453                    
1454          // Default to <H5> if nothing specified          // Default to <H5> if nothing specified
# Line 1467  function elementDecrease($con, $element_ Line 1467  function elementDecrease($con, $element_
1467                  . " AND element_id = "                  . " AND element_id = "
1468                  . $element_id;                  . $element_id;
1469                                    
1470          if (!mysql_query ($sql, $con)){          if (!xx_query ($sql, $con)){
1471                  sql_err($sql);                  sql_err($sql);
1472                  mysql_query ("UNLOCK TABLES", $con);                  xx_query ("UNLOCK TABLES", $con);
1473                  bailout();                  bailout();
1474          }          }
1475          else {  // Success call the page back          else {  // Success call the page back
1476                  mysql_query ("UNLOCK TABLES", $con);                  xx_query ("UNLOCK TABLES", $con);
1477                                                    
1478                  header("Location: scribe.phtml?page_id=" . $page_id . "#p" . $position);                  header("Location: scribe.phtml?page_id=" . $page_id . "#p" . $position);
1479          }                        }              
# Line 1517  function elementDown($con, $element_id, Line 1517  function elementDown($con, $element_id,
1517                  . $page_id                  . $page_id
1518                  . " AND element_id = "                  . " AND element_id = "
1519                  . $element_id;                  . $element_id;
1520          $rs = mysql_query($sql, $con);          $rs = xx_query($sql, $con);
1521          $row = mysql_fetch_array ($rs);          $row = xx_fetch_array ($rs);    
1522          $down_indent_level = $row["indent_level"];          $down_indent_level = $row["indent_level"];
1523          $down_element_order = $row["element_order"];          $down_element_order = $row["element_order"];
1524                    
# Line 1531  function elementDown($con, $element_id, Line 1531  function elementDown($con, $element_id,
1531                  . $down_element_order                  . $down_element_order
1532                  . " ORDER BY element_order";                  . " ORDER BY element_order";
1533    
1534          $rs = mysql_query($sql, $con);          $rs = xx_query($sql, $con);
1535          $row = mysql_fetch_array ($rs);          $row = xx_fetch_array ($rs);    
1536          $up_element_id = $row["element_id"];          $up_element_id = $row["element_id"];
1537          $up_element_order = $row["element_order"];          $up_element_order = $row["element_order"];
1538                    
# Line 1552  function elementDown($con, $element_id, Line 1552  function elementDown($con, $element_id,
1552                  . " AND element_order < "                  . " AND element_order < "
1553                  . $up_element_order;                  . $up_element_order;
1554                    
1555          $rs = mysql_query($sql, $con);          $rs = xx_query($sql, $con);
1556          $row = mysql_fetch_array ($rs);          $row = xx_fetch_array ($rs);    
1557          $down_num = $row["down_num"];          $down_num = $row["down_num"];
1558                    
1559          // Add the element itself          // Add the element itself
# Line 1570  function elementDown($con, $element_id, Line 1570  function elementDown($con, $element_id,
1570                  . $up_element_order                  . $up_element_order
1571                  . " ORDER BY element_order";                  . " ORDER BY element_order";
1572    
1573          $rs = mysql_query($sql, $con);          $rs = xx_query($sql, $con);
1574                    
1575          // Flag to determine the end of this element's lineage          // Flag to determine the end of this element's lineage
1576          $lineage = 1;          $lineage = 1;
# Line 1591  function elementDown($con, $element_id, Line 1591  function elementDown($con, $element_id,
1591          descendant affected by a move.          descendant affected by a move.
1592          */          */
1593                    
1594          while (($row = mysql_fetch_array ($rs)) && $lineage == 1) {          while (($row = xx_fetch_array ($rs)) && $lineage == 1) {
1595                  $desc_element_id = $row["element_id"];                  $desc_element_id = $row["element_id"];
1596                  $desc_indent_level = $row["indent_level"];                  $desc_indent_level = $row["indent_level"];
1597                  $desc_element_order = $row["element_order"];                  $desc_element_order = $row["element_order"];
# Line 1620  function elementDown($con, $element_id, Line 1620  function elementDown($con, $element_id,
1620                  . " AND element_order <= "                  . " AND element_order <= "
1621                  . $stop_element_order                  . $stop_element_order
1622                  . " ORDER BY element_order";                  . " ORDER BY element_order";
1623          $rs = mysql_query($sql, $con);          $rs = xx_query($sql, $con);
1624                                    
1625          while ($row = mysql_fetch_array ($rs)) {          while ($row = xx_fetch_array ($rs)) {
1626                  $mod_element_id = $row["element_id"];                  $mod_element_id = $row["element_id"];
1627                  $mod_indent_level = $row["indent_level"];                  $mod_indent_level = $row["indent_level"];
1628                  $mod_element_order = $row["element_order"];                  $mod_element_order = $row["element_order"];
# Line 1649  function elementDown($con, $element_id, Line 1649  function elementDown($con, $element_id,
1649                          . $page_id                          . $page_id
1650                          . " AND element_id = "                          . " AND element_id = "
1651                          . $mod_element_id;                          . $mod_element_id;
1652                  if (!mysql_query ($mod_sql, $con)){                  if (!xx_query ($mod_sql, $con)){
1653                          sql_err($sql);                          sql_err($sql);
1654                          mysql_query ("UNLOCK TABLES", $con);                          xx_query ("UNLOCK TABLES", $con);
1655                          bailout();                          bailout();
1656                  }                  }
1657                  else {  // Success                  else {  // Success
1658                          mysql_query ("UNLOCK TABLES", $con);                          xx_query ("UNLOCK TABLES", $con);
1659                  } // moved an element up or down                                          } // moved an element up or down                        
1660    
1661          } // all affected elements          } // all affected elements
# Line 1709  function elementIncrease($con, $element_ Line 1709  function elementIncrease($con, $element_
1709                  . $element_id                  . $element_id
1710                  . " AND page_id = "                  . " AND page_id = "
1711                  . $page_id;                  . $page_id;
1712          $rs = mysql_query($sql, $con);          $rs = xx_query($sql, $con);
1713          $row = mysql_fetch_array ($rs);          $row = xx_fetch_array ($rs);    
1714          $element_size = $row["element_size"];            $element_size = $row["element_size"];  
1715                    
1716          // Default to <H5> if nothing specified          // Default to <H5> if nothing specified
# Line 1726  function elementIncrease($con, $element_ Line 1726  function elementIncrease($con, $element_
1726                  . " AND element_id = "                  . " AND element_id = "
1727                  . $element_id;                  . $element_id;
1728                                    
1729          if (!mysql_query ($sql, $con)){          if (!xx_query ($sql, $con)){
1730                  sql_err($sql);                  sql_err($sql);
1731                  mysql_query ("UNLOCK TABLES", $con);                  xx_query ("UNLOCK TABLES", $con);
1732                  bailout();                  bailout();
1733          }          }
1734          else {  // Success call the page back          else {  // Success call the page back
1735                  mysql_query ("UNLOCK TABLES", $con);                  xx_query ("UNLOCK TABLES", $con);
1736                  header("Location: scribe.phtml?page_id=" . $page_id . "#p" . $position);                  header("Location: scribe.phtml?page_id=" . $page_id . "#p" . $position);
1737          }                        }              
1738    
# Line 1769  function elementMultiFormat($con, $auto_ Line 1769  function elementMultiFormat($con, $auto_
1769                  . " AND indent_level = "                  . " AND indent_level = "
1770                  . $auto_indent_level;                  . $auto_indent_level;
1771                                    
1772          if (!mysql_query ($sql, $con)){          if (!xx_query ($sql, $con)){
1773                  sql_err($sql);                  sql_err($sql);
1774                  mysql_query ("UNLOCK TABLES", $con);                  xx_query ("UNLOCK TABLES", $con);
1775                  bailout();                  bailout();
1776          }          }
1777          else {  // Success call the page back          else {  // Success call the page back
1778                  mysql_query ("UNLOCK TABLES", $con);                  xx_query ("UNLOCK TABLES", $con);
1779                                                    
1780                  header("Location: scribe.phtml?page_id=" . $page_id . "#p" . $position);                  header("Location: scribe.phtml?page_id=" . $page_id . "#p" . $position);
1781          }                        }              
# Line 1818  function elementSize($con, $element_id, Line 1818  function elementSize($con, $element_id,
1818                  . " AND element_id = "                  . " AND element_id = "
1819                  . $element_id;                  . $element_id;
1820                                    
1821          if (!mysql_query ($sql, $con)){          if (!xx_query ($sql, $con)){
1822                  sql_err($sql);                  sql_err($sql);
1823                  mysql_query ("UNLOCK TABLES", $con);                  xx_query ("UNLOCK TABLES", $con);
1824                  bailout();                  bailout();
1825          }          }
1826          else {  // Success call the page back          else {  // Success call the page back
1827                  mysql_query ("UNLOCK TABLES", $con);                  xx_query ("UNLOCK TABLES", $con);
1828                  header("Location: scribe.phtml?page_id=" . $page_id . "#p" . $position);                  header("Location: scribe.phtml?page_id=" . $page_id . "#p" . $position);
1829          }                        }              
1830    
# Line 1857  function elementUp($con, $element_id, $p Line 1857  function elementUp($con, $element_id, $p
1857                  . $page_id                  . $page_id
1858                  . " AND element_id = "                  . " AND element_id = "
1859                  . $element_id;                  . $element_id;
1860          $rs = mysql_query($sql, $con);          $rs = xx_query($sql, $con);
1861          $row = mysql_fetch_array ($rs);          $row = xx_fetch_array ($rs);    
1862          $up_indent_level = $row["indent_level"];          $up_indent_level = $row["indent_level"];
1863          $up_element_order = $row["element_order"];          $up_element_order = $row["element_order"];
1864                    
# Line 1871  function elementUp($con, $element_id, $p Line 1871  function elementUp($con, $element_id, $p
1871                  . $up_element_order                  . $up_element_order
1872                  . " ORDER BY element_order DESC";                  . " ORDER BY element_order DESC";
1873    
1874          $rs = mysql_query($sql, $con);          $rs = xx_query($sql, $con);
1875          $row = mysql_fetch_array ($rs);          $row = xx_fetch_array ($rs);    
1876          $down_element_id = $row["element_id"];          $down_element_id = $row["element_id"];
1877          $down_element_order = $row["element_order"];          $down_element_order = $row["element_order"];
1878                    
# Line 1892  function elementUp($con, $element_id, $p Line 1892  function elementUp($con, $element_id, $p
1892                  . " AND element_order < "                  . " AND element_order < "
1893                  . $up_element_order;                  . $up_element_order;
1894                    
1895          $rs = mysql_query($sql, $con);          $rs = xx_query($sql, $con);
1896          $row = mysql_fetch_array ($rs);          $row = xx_fetch_array ($rs);    
1897          $down_num = $row["down_num"];          $down_num = $row["down_num"];
1898                    
1899          // Add the element itself          // Add the element itself
# Line 1910  function elementUp($con, $element_id, $p Line 1910  function elementUp($con, $element_id, $p
1910                  . $up_element_order                  . $up_element_order
1911                  . " ORDER BY element_order";                  . " ORDER BY element_order";
1912    
1913          $rs = mysql_query($sql, $con);          $rs = xx_query($sql, $con);
1914                    
1915          // Flag to determine the end of this element's lineage          // Flag to determine the end of this element's lineage
1916          $lineage = 1;          $lineage = 1;
# Line 1931  function elementUp($con, $element_id, $p Line 1931  function elementUp($con, $element_id, $p
1931          descendant affected by a move.          descendant affected by a move.
1932          */          */
1933                    
1934          while (($row = mysql_fetch_array ($rs)) && $lineage == 1) {          while (($row = xx_fetch_array ($rs)) && $lineage == 1) {
1935                  $desc_element_id = $row["element_id"];                  $desc_element_id = $row["element_id"];
1936                  $desc_indent_level = $row["indent_level"];                  $desc_indent_level = $row["indent_level"];
1937                  $desc_element_order = $row["element_order"];                  $desc_element_order = $row["element_order"];
# Line 1960  function elementUp($con, $element_id, $p Line 1960  function elementUp($con, $element_id, $p
1960                  . " AND element_order <= "                  . " AND element_order <= "
1961                  . $stop_element_order                  . $stop_element_order
1962                  . " ORDER BY element_order";                  . " ORDER BY element_order";
1963          $rs = mysql_query($sql, $con);          $rs = xx_query($sql, $con);
1964                                    
1965          while ($row = mysql_fetch_array ($rs)) {          while ($row = xx_fetch_array ($rs)) {
1966                  $mod_element_id = $row["element_id"];                  $mod_element_id = $row["element_id"];
1967                  $mod_indent_level = $row["indent_level"];                  $mod_indent_level = $row["indent_level"];
1968                  $mod_element_order = $row["element_order"];                  $mod_element_order = $row["element_order"];
# Line 1990  function elementUp($con, $element_id, $p Line 1990  function elementUp($con, $element_id, $p
1990                          . " AND element_id = "                          . " AND element_id = "
1991                          . $mod_element_id;                          . $mod_element_id;
1992                                    
1993                  if (!mysql_query ($mod_sql, $con)){                  if (!xx_query ($mod_sql, $con)){
1994                          sql_err($sql);                          sql_err($sql);
1995                          mysql_query ("UNLOCK TABLES", $con);                          xx_query ("UNLOCK TABLES", $con);
1996                          bailout();                          bailout();
1997                  }                  }
1998                  else {  // Success                  else {  // Success
1999                          mysql_query ("UNLOCK TABLES", $con);                          xx_query ("UNLOCK TABLES", $con);
2000                  } // moved an element up or down                                          } // moved an element up or down                        
2001                                    
2002                                    
# Line 2027  function getMaxIndent($con, $page_id){ Line 2027  function getMaxIndent($con, $page_id){
2027          $sql = "SELECT MAX(indent_level) AS max_indent FROM element WHERE page_id = "          $sql = "SELECT MAX(indent_level) AS max_indent FROM element WHERE page_id = "
2028                  . $page_id;                  . $page_id;
2029                                    
2030          $rs = mysql_query($sql, $con);          $rs = xx_query($sql, $con);
2031          $row = mysql_fetch_array ($rs);          $row = xx_fetch_array ($rs);
2032          $max_indent = $row["max_indent"];          $max_indent = $row["max_indent"];
2033    
2034          return $max_indent;          return $max_indent;
# Line 2110  function insertCoursePers($con, $course_ Line 2110  function insertCoursePers($con, $course_
2110                                  . $pers_email                                  . $pers_email
2111                                  . "')";                                  . "')";
2112    
2113                          mysql_query ("LOCK TABLE faculty WRITE", $con);                          xx_query ("LOCK TABLE faculty WRITE", $con);
2114                          if (!mysql_query($sql, $con)){                          if (!xx_query($sql, $con)){
2115                                  sql_err($con);                                  sql_err($con);
2116                                  mysql_query ("UNLOCK TABLES", $con);                                  xx_query ("UNLOCK TABLES", $con);
2117                                  bailout();                                  bailout();
2118                          }                          }
2119                          else {                          else {
2120                                  $new_faculty_id = mysql_insert_id($con);                                  $new_faculty_id = xx_insert_id($con);
2121                                  mysql_query("UNLOCK TABLES", $con);                                  xx_query("UNLOCK TABLES", $con);
2122                          }                          }
2123    
2124                          // Now, build the SQL for the insert into course_personnel                          // Now, build the SQL for the insert into course_personnel
# Line 2165  function insertCoursePers($con, $course_ Line 2165  function insertCoursePers($con, $course_
2165          if ($err_code == 0) {          if ($err_code == 0) {
2166                    
2167                  // Failed                  // Failed
2168                  if (!mysql_query ($sql, $con)){                  if (!xx_query ($sql, $con)){
2169                          sql_err($sql);                          sql_err($sql);
2170                          mysql_query ("UNLOCK TABLES", $con);                          xx_query ("UNLOCK TABLES", $con);
2171                          bailout();                          bailout();
2172                  }                  }
2173    
2174                  // Succeeded                  // Succeeded
2175                  else {                  else {
2176                          mysql_query ("UNLOCK TABLES", $con);                          xx_query ("UNLOCK TABLES", $con);
2177                  }                  }
2178    
2179                  // Done. Call the PageScribe page back                  // Done. Call the PageScribe page back
# Line 2252  function insertScribeLabel($con, $elemen Line 2252  function insertScribeLabel($con, $elemen
2252                          . $page_id . " AND element_order >= " . $prev_element_order;                          . $page_id . " AND element_order >= " . $prev_element_order;
2253    
2254                  // Make the change                  // Make the change
2255                  if (!mysql_query($sql, $con)){                  if (!xx_query($sql, $con)){
2256                          sql_err($con);                          sql_err($con);
2257                          mysql_query ("UNLOCK TABLES", $con);                          xx_query ("UNLOCK TABLES", $con);
2258                          bailout();                          bailout();
2259                  }                  }
2260                  else {                  else {
2261                          mysql_query("UNLOCK TABLES", $con);                          xx_query("UNLOCK TABLES", $con);
2262                  }                  }
2263    
2264    
# Line 2272  function insertScribeLabel($con, $elemen Line 2272  function insertScribeLabel($con, $elemen
2272                          . $prev_indent_level . ", "                          . $prev_indent_level . ", "
2273                          . $parent_id . ")";                          . $parent_id . ")";
2274                                                    
2275                  if (!mysql_query ($sql, $con)){                  if (!xx_query ($sql, $con)){
2276                          sql_err($sql);                          sql_err($sql);
2277                          mysql_query ("UNLOCK TABLES", $con);                          xx_query ("UNLOCK TABLES", $con);
2278                          bailout();                          bailout();
2279                  }                  }
2280                  else {                  else {
2281                          // Success                          // Success
2282                          mysql_query ("UNLOCK TABLES", $con);                          xx_query ("UNLOCK TABLES", $con);
2283                  }                  }
2284          }          }
2285                    
# Line 2318  function insertScribeLocation($con, $loc Line 2318  function insertScribeLocation($con, $loc
2318                          . $page_id . " AND element_order >= " . $prev_element_order;                          . $page_id . " AND element_order >= " . $prev_element_order;
2319    
2320                  // Make the change                  // Make the change
2321                  if (!mysql_query($sql, $con)){                  if (!xx_query($sql, $con)){
2322                          sql_err($con);                          sql_err($con);
2323                          mysql_query ("UNLOCK TABLES", $con);                          xx_query ("UNLOCK TABLES", $con);
2324                          bailout();                          bailout();
2325                  }                  }
2326                  else {                  else {
2327                          mysql_query("UNLOCK TABLES", $con);                          xx_query("UNLOCK TABLES", $con);
2328                  }                  }
2329    
2330                  // Next insert the new location                  // Next insert the new location
# Line 2334  function insertScribeLocation($con, $loc Line 2334  function insertScribeLocation($con, $loc
2334                          . $prev_element_order . ", "                          . $prev_element_order . ", "
2335                          . $prev_indent_level . ", "                          . $prev_indent_level . ", "
2336                          . $parent_id . ")";                              . $parent_id . ")";    
2337                  if (!mysql_query ($sql, $con)){                  if (!xx_query ($sql, $con)){
2338                          sql_err($sql);                          sql_err($sql);
2339                          mysql_query ("UNLOCK TABLES", $con);                          xx_query ("UNLOCK TABLES", $con);
2340                          bailout();                          bailout();
2341                  }                  }
2342                  else {                  else {
2343                          // Success                          // Success
2344                          mysql_query ("UNLOCK TABLES", $con);                          xx_query ("UNLOCK TABLES", $con);
2345                  }                  }
2346                    
2347          }          }
# Line 2381  function insertScribeResource($con, $pla Line 2381  function insertScribeResource($con, $pla
2381                          . $page_id . " AND element_order >= " . $prev_element_order;                          . $page_id . " AND element_order >= " . $prev_element_order;
2382    
2383                  // Make the change                  // Make the change
2384                  if (!mysql_query($sql, $con)){                  if (!xx_query($sql, $con)){
2385                          sql_err($con);                          sql_err($con);
2386                          mysql_query ("UNLOCK TABLES", $con);                          xx_query ("UNLOCK TABLES", $con);
2387                          bailout();                          bailout();
2388                  }                  }
2389                  else {                  else {
2390                          mysql_query("UNLOCK TABLES", $con);                          xx_query("UNLOCK TABLES", $con);
2391                  }                  }
2392    
2393                  // Next insert the new resource                  // Next insert the new resource
# Line 2397  function insertScribeResource($con, $pla Line 2397  function insertScribeResource($con, $pla
2397                          . $prev_element_order . ", "                          . $prev_element_order . ", "
2398                          . $prev_indent_level . ", "                          . $prev_indent_level . ", "
2399                          . $parent_id . ")";                              . $parent_id . ")";    
2400                  if (!mysql_query ($sql, $con)){                  if (!xx_query ($sql, $con)){
2401                          sql_err($sql);                          sql_err($sql);
2402                          mysql_query ("UNLOCK TABLES", $con);                          xx_query ("UNLOCK TABLES", $con);
2403                          bailout();                          bailout();
2404                  }                  }
2405                  else {                  else {
2406                          // Success                          // Success
2407                          mysql_query ("UNLOCK TABLES", $con);                          xx_query ("UNLOCK TABLES", $con);
2408                  }                  }
2409    
2410          }          }
# Line 2443  function insertScribeRQS($con, $place_ar Line 2443  function insertScribeRQS($con, $place_ar
2443    
2444                  // Identify the number of new elements to add                  // Identify the number of new elements to add
2445                  $sql = "SELECT COUNT(*) as num_rqs from res_sub_infotype WHERE subject_id = " . $subject_id;                  $sql = "SELECT COUNT(*) as num_rqs from res_sub_infotype WHERE subject_id = " . $subject_id;
2446                  $rs = mysql_query($sql, $con);                  $rs = xx_query($sql, $con);
2447                  $row = mysql_fetch_array ($rs);                  $row = xx_fetch_array ($rs);
2448    
2449                  // Pull out the possible display values                  // Pull out the possible display values
2450                  $num_rqs = $row["num_rqs"];                  $num_rqs = $row["num_rqs"];
# Line 2459  function insertScribeRQS($con, $place_ar Line 2459  function insertScribeRQS($con, $place_ar
2459                                  . $page_id . " AND element_order >= " . $prev_element_order;                                  . $page_id . " AND element_order >= " . $prev_element_order;
2460    
2461                          // Make the change                          // Make the change
2462                          if (!mysql_query($sql, $con)){                          if (!xx_query($sql, $con)){
2463                                  sql_err($con);                                  sql_err($con);
2464                                  mysql_query ("UNLOCK TABLES", $con);                                  xx_query ("UNLOCK TABLES", $con);
2465                                  bailout();                                  bailout();
2466                          }                          }
2467                          else {                          else {
2468                                  mysql_query("UNLOCK TABLES", $con);                                  xx_query("UNLOCK TABLES", $con);
2469                          }                          }
2470    
2471                          // Cycle through the resources                          // Cycle through the resources
# Line 2475  function insertScribeRQS($con, $place_ar Line 2475  function insertScribeRQS($con, $place_ar
2475                                  WHERE subject_id = " . $subject_id .                                  WHERE subject_id = " . $subject_id .
2476                                  " ORDER BY r.title";                                  " ORDER BY r.title";
2477    
2478                          $rs = mysql_query($sql, $con);                          $rs = xx_query($sql, $con);
2479                          while ($row = mysql_fetch_array ($rs)) {                          while ($row = xx_fetch_array ($rs)) {
2480    
2481                                  // Fetch resource                                  // Fetch resource
2482                                  $resource_id = $row["resource_id"];                                  $resource_id = $row["resource_id"];
# Line 2488  function insertScribeRQS($con, $place_ar Line 2488  function insertScribeRQS($con, $place_ar
2488                                          . $prev_element_order . ", "                                          . $prev_element_order . ", "
2489                                          . $prev_indent_level . ", "                                          . $prev_indent_level . ", "
2490                                          . $parent_id . ")";                                              . $parent_id . ")";    
2491                                  if (!mysql_query ($i_sql, $con)){                                  if (!xx_query ($i_sql, $con)){
2492                                          sql_err($sql);                                          sql_err($sql);
2493                                          mysql_query ("UNLOCK TABLES", $con);                                          xx_query ("UNLOCK TABLES", $con);
2494                                          bailout();                                          bailout();
2495                                  }                                  }
2496                                  else {                                  else {
2497                                          // Success                                          // Success
2498                                          mysql_query ("UNLOCK TABLES", $con);                                          xx_query ("UNLOCK TABLES", $con);
2499                                  } // successful import                                  } // successful import
2500    
2501                                  // Increment element order                                  // Increment element order
# Line 2543  function insertScribeRQSLink($con, $plac Line 2543  function insertScribeRQSLink($con, $plac
2543                          . $page_id . " AND element_order >= " . $prev_element_order;                          . $page_id . " AND element_order >= " . $prev_element_order;
2544    
2545                  // Make the change                  // Make the change
2546                  if (!mysql_query($sql, $con)){                  if (!xx_query($sql, $con)){
2547                          sql_err($con);                          sql_err($con);
2548                          mysql_query ("UNLOCK TABLES", $con);                          xx_query ("UNLOCK TABLES", $con);
2549                          bailout();                          bailout();
2550                  }                  }
2551                  else {                  else {
2552                          mysql_query("UNLOCK TABLES", $con);                          xx_query("UNLOCK TABLES", $con);
2553                  }                  }
2554    
2555                  // Next insert the new resource                  // Next insert the new resource
# Line 2559  function insertScribeRQSLink($con, $plac Line 2559  function insertScribeRQSLink($con, $plac
2559                          . $prev_element_order . ", "                          . $prev_element_order . ", "
2560                          . $prev_indent_level . ", "                          . $prev_indent_level . ", "
2561                          . $parent_id . ")";                              . $parent_id . ")";    
2562                  if (!mysql_query ($sql, $con)){                  if (!xx_query ($sql, $con)){
2563                          sql_err($sql);                          sql_err($sql);
2564                          mysql_query ("UNLOCK TABLES", $con);                          xx_query ("UNLOCK TABLES", $con);
2565                          bailout();                          bailout();
2566                  }                  }
2567                  else {                  else {
2568                          // Success                          // Success
2569                          mysql_query ("UNLOCK TABLES", $con);                          xx_query ("UNLOCK TABLES", $con);
2570                  }                  }
2571    
2572          }          }
# Line 2606  function insertScribeService($con, $plac Line 2606  function insertScribeService($con, $plac
2606                          . $page_id . " AND element_order >= " . $prev_element_order;                          . $page_id . " AND element_order >= " . $prev_element_order;
2607    
2608                  // Make the change                  // Make the change
2609                  if (!mysql_query($sql, $con)){                  if (!xx_query($sql, $con)){
2610                          sql_err($con);                          sql_err($con);
2611                          mysql_query ("UNLOCK TABLES", $con);                          xx_query ("UNLOCK TABLES", $con);
2612                          bailout();                          bailout();
2613                  }                  }
2614                  else {                  else {
2615                          mysql_query("UNLOCK TABLES", $con);                          xx_query("UNLOCK TABLES", $con);
2616                  }                  }
2617    
2618                  // Next insert the new service                  // Next insert the new service
# Line 2622  function insertScribeService($con, $plac Line 2622  function insertScribeService($con, $plac
2622                          . $prev_element_order . ", "                          . $prev_element_order . ", "
2623                          . $prev_indent_level . ", "                          . $prev_indent_level . ", "
2624                          . $parent_id . ")";                              . $parent_id . ")";    
2625                  if (!mysql_query ($sql, $con)){                  if (!xx_query ($sql, $con)){
2626                          sql_err($sql);                          sql_err($sql);
2627                          mysql_query ("UNLOCK TABLES", $con);                          xx_query ("UNLOCK TABLES", $con);
2628                          bailout();                          bailout();
2629                  }                  }
2630                  else {                  else {
2631                          // Success                          // Success
2632                          mysql_query ("UNLOCK TABLES", $con);                          xx_query ("UNLOCK TABLES", $con);
2633                  }                  }
2634                    
2635          }          }
# Line 2666  function insertScribeStaff($con, $place_ Line 2666  function insertScribeStaff($con, $place_
2666                  . $page_id . " AND element_order >= " . $prev_element_order;                  . $page_id . " AND element_order >= " . $prev_element_order;
2667    
2668          // Make the change          // Make the change
2669          if (!mysql_query($sql, $con)){          if (!xx_query($sql, $con)){
2670                  sql_err($con);                  sql_err($con);
2671                  mysql_query ("UNLOCK TABLES", $con);                  xx_query ("UNLOCK TABLES", $con);
2672                  bailout();                  bailout();
2673          }          }
2674          else {          else {
2675                  mysql_query("UNLOCK TABLES", $con);                  xx_query("UNLOCK TABLES", $con);
2676          }          }
2677                                    
2678          // Next insert the new staff          // Next insert the new staff
# Line 2682  function insertScribeStaff($con, $place_ Line 2682  function insertScribeStaff($con, $place_
2682                  . $prev_element_order . ", "                  . $prev_element_order . ", "
2683                  . $prev_indent_level . ", "                  . $prev_indent_level . ", "
2684                  . $parent_id . ")";                      . $parent_id . ")";    
2685          if (!mysql_query ($sql, $con)){          if (!xx_query ($sql, $con)){
2686                  sql_err($sql);                  sql_err($sql);
2687                  mysql_query ("UNLOCK TABLES", $con);                  xx_query ("UNLOCK TABLES", $con);
2688                  bailout();                  bailout();
2689          }          }
2690          else {          else {
2691                  // Success                  // Success
2692                  mysql_query ("UNLOCK TABLES", $con);                  xx_query ("UNLOCK TABLES", $con);
2693          }          }
2694    
2695          header("Location: scribe.phtml?page_id=" . $page_id . "#p" . $position);          header("Location: scribe.phtml?page_id=" . $page_id . "#p" . $position);
# Line 2727  function pageLoadStats($con, $page_id){ Line 2727  function pageLoadStats($con, $page_id){
2727                          . $user_ip                          . $user_ip
2728                          . "')";                          . "')";
2729    
2730          if (!mysql_query($sql, $con)){          if (!xx_query($sql, $con)){
2731                  sql_err($con);                  sql_err($con);
2732                  mysql_query ("UNLOCK TABLES", $con);                  xx_query ("UNLOCK TABLES", $con);
2733                  bailout();                  bailout();
2734          } // bad write          } // bad write
2735          else {          else {
2736                  mysql_query("UNLOCK TABLES", $con);                  xx_query("UNLOCK TABLES", $con);
2737    
2738          } // good write to the pagestats table          } // good write to the pagestats table
2739    
# Line 2763  function pageTemplate($con, $page_id, $s Line 2763  function pageTemplate($con, $page_id, $s
2763          // First copy the page elements          // First copy the page elements
2764          $sql = "SELECT * FROM page WHERE page_id = "          $sql = "SELECT * FROM page WHERE page_id = "
2765                  . $page_id;                  . $page_id;
2766          $rs = mysql_query($sql, $con);          $rs = xx_query($sql, $con);
2767          $row = mysql_fetch_array ($rs);          $row = xx_fetch_array ($rs);
2768                    
2769          // Fetch results          // Fetch results
2770          $style_id = $row["style_id"];          $style_id = $row["style_id"];
# Line 2826  function pageTemplate($con, $page_id, $s Line 2826  function pageTemplate($con, $page_id, $s
2826    
2827          //printf("sql was: %s", $sql);          //printf("sql was: %s", $sql);
2828    
2829          mysql_query ("LOCK TABLE page WRITE", $con);          xx_query ("LOCK TABLE page WRITE", $con);
2830          if (!mysql_query($sql, $con)){          if (!xx_query($sql, $con)){
2831                  sql_err($con);                  sql_err($con);
2832                  mysql_query ("UNLOCK TABLES", $con);                  xx_query ("UNLOCK TABLES", $con);
2833                  bailout();                  bailout();
2834          }          }
2835          else {          else {
2836                  $new_page_id = mysql_insert_id($con);                  $new_page_id = xx_insert_id($con);
2837                  mysql_query("UNLOCK TABLES", $con);                  xx_query("UNLOCK TABLES", $con);
2838          }          }
2839    
2840    
# Line 2850  function pageTemplate($con, $page_id, $s Line 2850  function pageTemplate($con, $page_id, $s
2850                  // Copy the course elements                  // Copy the course elements
2851                  $sql = "SELECT * FROM course WHERE page_id = "                  $sql = "SELECT * FROM course WHERE page_id = "
2852                          . $page_id;                          . $page_id;
2853                  $rs = mysql_query($sql, $con);                  $rs = xx_query($sql, $con);
2854                  $row = mysql_fetch_array ($rs);                  $row = xx_fetch_array ($rs);
2855    
2856                  // Fetch results                  // Fetch results
2857                  $coursesub_id = $row["coursesub_id"];                  $coursesub_id = $row["coursesub_id"];
# Line 2916  function pageTemplate($con, $page_id, $s Line 2916  function pageTemplate($con, $page_id, $s
2916                          $introheader2 . "', '" .                          $introheader2 . "', '" .
2917                          $intromessage2 . "')";                          $intromessage2 . "')";
2918                                                    
2919                  if (!mysql_query($sql, $con)){                  if (!xx_query($sql, $con)){
2920                          sql_err($con);                          sql_err($con);
2921                          mysql_query ("UNLOCK TABLES", $con);                          xx_query ("UNLOCK TABLES", $con);
2922                          bailout();                          bailout();
2923                  }                  }
2924                  else {                  else {
2925                          mysql_query("UNLOCK TABLES", $con);                          xx_query("UNLOCK TABLES", $con);
2926                  }                  }
2927          } // was a CourseScribe type page          } // was a CourseScribe type page
2928    
# Line 2937  function pageTemplate($con, $page_id, $s Line 2937  function pageTemplate($con, $page_id, $s
2937                  . $page_id                  . $page_id
2938                  . " ORDER BY element_id";                  . " ORDER BY element_id";
2939    
2940          $rs = mysql_query($sql, $con);          $rs = xx_query($sql, $con);
2941          while ($row = mysql_fetch_array ($rs)) {          while ($row = xx_fetch_array ($rs)) {
2942    
2943                  // Fetch previous values                  // Fetch previous values
2944                  $element_id = $row["element_id"];                  $element_id = $row["element_id"];
# Line 3004  function pageTemplate($con, $page_id, $s Line 3004  function pageTemplate($con, $page_id, $s
3004                          $indent_level . ")";                          $indent_level . ")";
3005                                    
3006                  // Execute the query                  // Execute the query
3007                  if (!mysql_query($clone_sql, $con)){                  if (!xx_query($clone_sql, $con)){
3008                          sql_err($con);                          sql_err($con);
3009                          mysql_query ("UNLOCK TABLES", $con);                          xx_query ("UNLOCK TABLES", $con);
3010                          bailout();                          bailout();
3011                  }                  }
3012                  else {                  else {
3013                          mysql_query("UNLOCK TABLES", $con);                          xx_query("UNLOCK TABLES", $con);
3014                  }                  }
3015    
3016          }          }
# Line 3066  function pageTemplateConfirm($con, $page Line 3066  function pageTemplateConfirm($con, $page
3066                  . $page_id                  . $page_id
3067                  . " AND p.staff_coordinator = s.staff_id";                  . " AND p.staff_coordinator = s.staff_id";
3068    
3069          $rs = mysql_query($sql, $con);          $rs = xx_query($sql, $con);
3070          $row = mysql_fetch_array ($rs);          $row = xx_fetch_array ($rs);
3071                    
3072          $page_title = strip_tags($row["page_title"]);          $page_title = strip_tags($row["page_title"]);
3073          $first_name = $row["first_name"];          $first_name = $row["first_name"];
# Line 3118  function parentIs($con, $element_id, $pa Line 3118  function parentIs($con, $element_id, $pa
3118                  . $page_id                  . $page_id
3119                  . " AND parent_id = "                  . " AND parent_id = "
3120                  . $element_id;                    . $element_id;  
3121          $rs = mysql_query($sql, $con);          $rs = xx_query($sql, $con);
3122          $row = mysql_fetch_array ($rs);          $row = xx_fetch_array ($rs);
3123          $num_children = $row["num_children"];          $num_children = $row["num_children"];
3124                    
3125          return $num_children;          return $num_children;
# Line 3158  function parentProbe($con, $page_id, $pr Line 3158  function parentProbe($con, $page_id, $pr
3158                  // Found parent tag                  // Found parent tag
3159                  $found = 0;                  $found = 0;
3160                                    
3161                  $rs = mysql_query($sql, $con);                  $rs = xx_query($sql, $con);
3162                  while (($row = mysql_fetch_array ($rs)) && $found == 0) {                  while (($row = xx_fetch_array ($rs)) && $found == 0) {
3163    
3164                          /* Cycle through the list, looking for the first item with an indent                          /* Cycle through the list, looking for the first item with an indent
3165                          of less.  */                          of less.  */
# Line 3210  function pasteElement($con, $element_ord Line 3210  function pasteElement($con, $element_ord
3210          $sql = "SELECT COUNT(*) as buffer_size FROM pastebuffer WHERE paste_staff_id = "          $sql = "SELECT COUNT(*) as buffer_size FROM pastebuffer WHERE paste_staff_id = "
3211                  . $sess_staff_id                  . $sess_staff_id
3212                  . " ORDER BY element_order";                  . " ORDER BY element_order";
3213          $rs = mysql_query($sql, $con);          $rs = xx_query($sql, $con);
3214          $row = mysql_fetch_array ($rs);          $row = xx_fetch_array ($rs);
3215          $buffer_size = $row["buffer_size"];              $buffer_size = $row["buffer_size"];    
3216                    
3217          if ($debug == 1) printf("Number of elements in buffer: %s<BR>\n", $buffer_size);          if ($debug == 1) printf("Number of elements in buffer: %s<BR>\n", $buffer_size);
# Line 3222  function pasteElement($con, $element_ord Line 3222  function pasteElement($con, $element_ord
3222                  . $page_id                  . $page_id
3223                  . " AND element_order = "                  . " AND element_order = "
3224                  . $element_order;                  . $element_order;
3225          $rs = mysql_query($sql, $con);          $rs = xx_query($sql, $con);
3226          $row = mysql_fetch_array ($rs);          $row = xx_fetch_array ($rs);
3227          $adjust_parent_id = $row["element_id"];          $adjust_parent_id = $row["element_id"];
3228                    
3229          if ($debug == 1) printf("Parent of first element will be: %d<BR>", $adjust_parent_id);          if ($debug == 1) printf("Parent of first element will be: %d<BR>", $adjust_parent_id);
# Line 3240  function pasteElement($con, $element_ord Line 3240  function pasteElement($con, $element_ord
3240          if ($debug == 1) printf("bump down sql was: %s<BR>", $sql);              if ($debug == 1) printf("bump down sql was: %s<BR>", $sql);    
3241                    
3242    
3243          if (!mysql_query($sql, $con)){          if (!xx_query($sql, $con)){
3244                  sql_err($con);                  sql_err($con);
3245                  mysql_query ("UNLOCK TABLES", $con);                  xx_query ("UNLOCK TABLES", $con);
3246                  bailout();                  bailout();
3247          }          }
3248          else {          else {
3249                  mysql_query("UNLOCK TABLES", $con);                  xx_query("UNLOCK TABLES", $con);
3250          }          }
3251                    
3252          // Select from the paste buffer          // Select from the paste buffer
3253          $sql = "SELECT * FROM pastebuffer WHERE paste_staff_id = "          $sql = "SELECT * FROM pastebuffer WHERE paste_staff_id = "
3254                  . $sess_staff_id                  . $sess_staff_id
3255                  .  " ORDER BY element_order";                  .  " ORDER BY element_order";
3256          $rs = mysql_query($sql, $con);          $rs = xx_query($sql, $con);
3257    
3258          // row count          // row count
3259          $row_num = 0;          $row_num = 0;
3260    
3261          while ($row = mysql_fetch_array ($rs)) {          while ($row = xx_fetch_array ($rs)) {
3262    
3263                  // Load copy-paste buffer elements                  // Load copy-paste buffer elements
3264                  $copy_indent_level = $row["indent_level"];                  $copy_indent_level = $row["indent_level"];
# Line 3371  function pasteElement($con, $element_ord Line 3371  function pasteElement($con, $element_ord
3371                  if ($debug == 1) printf("insert sql was: %s<BR>\n", $p_sql);                              if ($debug == 1) printf("insert sql was: %s<BR>\n", $p_sql);            
3372    
3373                  // Perform the write                  // Perform the write
3374                  mysql_query ("LOCK TABLE element WRITE", $con);                  xx_query ("LOCK TABLE element WRITE", $con);
3375                  if (!mysql_query($p_sql, $con)){                  if (!xx_query($p_sql, $con)){
3376                          sql_err($con);                          sql_err($con);
3377                          mysql_query ("UNLOCK TABLES", $con);                          xx_query ("UNLOCK TABLES", $con);
3378                          bailout();                          bailout();
3379                  }                  }
3380                  else {                  else {
3381                          $paste_element_id = mysql_insert_id($con);                          $paste_element_id = xx_insert_id($con);
3382                          mysql_query("UNLOCK TABLES", $con);                          xx_query("UNLOCK TABLES", $con);
3383                  }                  }
3384    
3385                  // Debugging                  // Debugging
# Line 3426  function populateGenArray($con, &$genArr Line 3426  function populateGenArray($con, &$genArr
3426                  . $page_id                  . $page_id
3427                  . " ORDER BY element_order";                  . " ORDER BY element_order";
3428    
3429          $rs = mysql_query($sql, $con);          $rs = xx_query($sql, $con);
3430                    
3431          // Start populating generation array subscript [1]          // Start populating generation array subscript [1]
3432          $rowcount = 1;          $rowcount = 1;
3433                    
3434          while ($row = mysql_fetch_array ($rs)) {          while ($row = xx_fetch_array ($rs)) {
3435                    
3436                  // Fetch values                  // Fetch values
3437                  $element_order = $row["element_order"];                  $element_order = $row["element_order"];
# Line 3491  function scribePublish($con, $page_id) { Line 3491  function scribePublish($con, $page_id) {
3491                    
3492          // printf("sql was: %s", $sql);          // printf("sql was: %s", $sql);
3493                    
3494          $rs = mysql_query($sql, $con);          $rs = xx_query($sql, $con);
3495          $row = mysql_fetch_array ($rs);          $row = xx_fetch_array ($rs);
3496          $coursesub_id = $row["coursesub_id"];          $coursesub_id = $row["coursesub_id"];
3497          $pagetype_id = $row["pagetype_id"];          $pagetype_id = $row["pagetype_id"];
3498                    
# Line 3553  else { Line 3553  else {
3553                  // This is important, also, to get rid of a NULL value before performing a CONCAT below.                  // This is important, also, to get rid of a NULL value before performing a CONCAT below.
3554                  $sql = "UPDATE page set pageHTML = '' WHERE page_id = " . $page_id;                  $sql = "UPDATE page set pageHTML = '' WHERE page_id = " . $page_id;
3555    
3556                  if (!mysql_query($sql, $con)){                  if (!xx_query($sql, $con)){
3557                          sql_err($con);                          sql_err($con);
3558                          mysql_query ("UNLOCK TABLES", $con);                          xx_query ("UNLOCK TABLES", $con);
3559                          bailout();                          bailout();
3560                  } // bad write                  } // bad write
3561                  else {                  else {
3562                          mysql_query("UNLOCK TABLES", $con);                          xx_query("UNLOCK TABLES", $con);
3563                  }                  }
3564    
3565                  // Open the filepointer for a screen dump                  // Open the filepointer for a screen dump
# Line 3583  else { Line 3583  else {
3583                                  // Concatenate the stream into the pageHTML field                                  // Concatenate the stream into the pageHTML field
3584                                  $sql = "UPDATE page set pageHTML = CONCAT(pageHTML,'" . $iostream_fix . "') WHERE page_id = " . $page_id;                                  $sql = "UPDATE page set pageHTML = CONCAT(pageHTML,'" . $iostream_fix . "') WHERE page_id = " . $page_id;
3585    
3586                                  if (!mysql_query($sql, $con)){                                  if (!xx_query($sql, $con)){
3587                                          sql_err($con);                                          sql_err($con);
3588                                          mysql_query ("UNLOCK TABLES", $con);                                          xx_query ("UNLOCK TABLES", $con);
3589                                  printf("sql was: %s<BR>", $sql);                                                          printf("sql was: %s<BR>", $sql);                        
3590                                          bailout();                                          bailout();
3591                                  } // bad write                                  } // bad write
3592                                  else {                                  else {
3593                                          mysql_query("UNLOCK TABLES", $con);                                          xx_query("UNLOCK TABLES", $con);
3594                                  } // good write                                  } // good write
3595                          }                          }
3596    
# Line 3600  else { Line 3600  else {
3600                          // Set published flag to 1                          // Set published flag to 1
3601                          $sql = "UPDATE page set published = '1' WHERE page_id = " . $page_id;                          $sql = "UPDATE page set published = '1' WHERE page_id = " . $page_id;
3602    
3603                          if (!mysql_query($sql, $con)){                          if (!xx_query($sql, $con)){
3604                                  sql_err($con);                                  sql_err($con);
3605                                  mysql_query ("UNLOCK TABLES", $con);                                  xx_query ("UNLOCK TABLES", $con);
3606                                  bailout();                                  bailout();
3607                          } // bad write                          } // bad write
3608                          else {                          else {
3609                                  mysql_query("UNLOCK TABLES", $con);                                  xx_query("UNLOCK TABLES", $con);
3610    
3611                          } // good write                          } // good write
3612    
# Line 3621  else { Line 3621  else {
3621                  // Set published flag to 1                  // Set published flag to 1
3622                  $sql = "UPDATE page set published = '1' WHERE page_id = " . $page_id;                  $sql = "UPDATE page set published = '1' WHERE page_id = " . $page_id;
3623    
3624                  if (!mysql_query($sql, $con)){                  if (!xx_query($sql, $con)){
3625                          sql_err($con);                          sql_err($con);
3626                          mysql_query ("UNLOCK TABLES", $con);                          xx_query ("UNLOCK TABLES", $con);
3627                          bailout();                          bailout();
3628                  } // bad write                  } // bad write
3629                  else {                  else {
3630                          mysql_query("UNLOCK TABLES", $con);                          xx_query("UNLOCK TABLES", $con);
3631    
3632                  } // good write                  } // good write
3633    
# Line 3657  function scribeUnpublish($con, $page_id) Line 3657  function scribeUnpublish($con, $page_id)
3657          // Build the SQL          // Build the SQL
3658          $sql = "UPDATE page SET pageHTML = NULL, published = '0' WHERE page_id =" . $page_id;          $sql = "UPDATE page SET pageHTML = NULL, published = '0' WHERE page_id =" . $page_id;
3659    
3660          if (!mysql_query ($sql, $con)){          if (!xx_query ($sql, $con)){
3661                  sql_err($sql);                  sql_err($sql);
3662                  mysql_query ("UNLOCK TABLES", $con);                  xx_query ("UNLOCK TABLES", $con);
3663                  bailout();                  bailout();
3664          }          }
3665          else {          else {
3666                  mysql_query ("UNLOCK TABLES", $con);                  xx_query ("UNLOCK TABLES", $con);
3667          }          }
3668    
3669          header("Location: scribe.phtml?page_id=" . $page_id);          header("Location: scribe.phtml?page_id=" . $page_id);
# Line 3708  function siblingElderProbe($con, $page_i Line 3708  function siblingElderProbe($con, $page_i
3708                  . $prev_element_order                  . $prev_element_order
3709                  . " ORDER BY element_order DESC LIMIT 1";                  . " ORDER BY element_order DESC LIMIT 1";
3710    
3711          $rs = mysql_query($sql, $con);          $rs = xx_query($sql, $con);
3712          $row = mysql_fetch_array ($rs);          $row = xx_fetch_array ($rs);
3713          $element_id = $row["element_id"];          $element_id = $row["element_id"];
3714                    
3715          return $element_id;          return $element_id;
# Line 3754  function siblingYoungerProbe($con, $page Line 3754  function siblingYoungerProbe($con, $page
3754                  . $prev_element_order                  . $prev_element_order
3755                  . " ORDER BY element_order LIMIT 1";                  . " ORDER BY element_order LIMIT 1";
3756                                    
3757          $rs = mysql_query($sql, $con);          $rs = xx_query($sql, $con);
3758          $row = mysql_fetch_array ($rs);          $row = xx_fetch_array ($rs);
3759          $element_id = $row["element_id"];          $element_id = $row["element_id"];
3760                    
3761          return $element_id;          return $element_id;
# Line 3870  function toggleTOCDisplay($con, $display Line 3870  function toggleTOCDisplay($con, $display
3870                  . $page_id;                  . $page_id;
3871    
3872          // Failed                                        // Failed                              
3873          if (!mysql_query ($sql, $con)){          if (!xx_query ($sql, $con)){
3874                  sql_err($sql);                  sql_err($sql);
3875                  mysql_query ("UNLOCK TABLES", $con);                  xx_query ("UNLOCK TABLES", $con);
3876                  bailout();                  bailout();
3877          }          }
3878    
3879          // Succeeded          // Succeeded
3880          else {          else {
3881                  mysql_query ("UNLOCK TABLES", $con);                  xx_query ("UNLOCK TABLES", $con);
3882          }          }
3883                    
3884          // Call the PageScribe page back          // Call the PageScribe page back
# Line 3905  function toggleTOCWrap($con, $page_id, $ Line 3905  function toggleTOCWrap($con, $page_id, $
3905                  . $page_id;                  . $page_id;
3906    
3907          // Failed                                        // Failed                              
3908          if (!mysql_query ($sql, $con)){          if (!xx_query ($sql, $con)){
3909                  sql_err($sql);                  sql_err($sql);
3910                  mysql_query ("UNLOCK TABLES", $con);                  xx_query ("UNLOCK TABLES", $con);
3911                  bailout();                  bailout();
3912          }          }
3913    
3914          // Succeeded          // Succeeded
3915          else {          else {
3916                  mysql_query ("UNLOCK TABLES", $con);                  xx_query ("UNLOCK TABLES", $con);
3917          }          }
3918                    
3919          // Call the PageScribe page back          // Call the PageScribe page back
# Line 3946  function toggleUpDisplay($con, $display_ Line 3946  function toggleUpDisplay($con, $display_
3946                  . $page_id;                  . $page_id;
3947    
3948          // Failed                                        // Failed                              
3949          if (!mysql_query ($sql, $con)){          if (!xx_query ($sql, $con)){
3950                  sql_err($sql);                  sql_err($sql);
3951                  mysql_query ("UNLOCK TABLES", $con);                  xx_query ("UNLOCK TABLES", $con);
3952                  bailout();                  bailout();
3953          }          }
3954    
3955          // Succeeded          // Succeeded
3956          else {          else {
3957                  mysql_query ("UNLOCK TABLES", $con);                  xx_query ("UNLOCK TABLES", $con);
3958          }          }
3959                    
3960          /* If the current up_text is blank, and the user has          /* If the current up_text is blank, and the user has
# Line 3966  function toggleUpDisplay($con, $display_ Line 3966  function toggleUpDisplay($con, $display_
3966                          . $page_id;                          . $page_id;
3967    
3968                  // Failed                                                // Failed                              
3969                  if (!mysql_query ($sql, $con)){                  if (!xx_query ($sql, $con)){
3970                          sql_err($sql);                          sql_err($sql);
3971                          mysql_query ("UNLOCK TABLES", $con);                          xx_query ("UNLOCK TABLES", $con);
3972                          bailout();                          bailout();
3973                  }                  }
3974    
3975                  // Succeeded                  // Succeeded
3976                  else {                  else {
3977                          mysql_query ("UNLOCK TABLES", $con);                          xx_query ("UNLOCK TABLES", $con);
3978                  }                        }      
3979          }          }
3980                    
# Line 4004  function toggleUpText($con, $page_id, $u Line 4004  function toggleUpText($con, $page_id, $u
4004                  . $page_id;                  . $page_id;
4005    
4006          // Failed                                        // Failed                              
4007          if (!mysql_query ($sql, $con)){          if (!xx_query ($sql, $con)){
4008                  sql_err($sql);                  sql_err($sql);
4009                  mysql_query ("UNLOCK TABLES", $con);                  xx_query ("UNLOCK TABLES", $con);
4010                  bailout();                  bailout();
4011          }          }
4012    
4013          // Succeeded          // Succeeded
4014          else {          else {
4015                  mysql_query ("UNLOCK TABLES", $con);                  xx_query ("UNLOCK TABLES", $con);
4016          }          }
4017                    
4018          // Call the PageScribe page back          // Call the PageScribe page back
# Line 4048  function toggleURLDisplay($con, $display Line 4048  function toggleURLDisplay($con, $display
4048                  . $page_id;                  . $page_id;
4049    
4050          // Failed                                        // Failed                              
4051          if (!mysql_query ($sql, $con)){          if (!xx_query ($sql, $con)){
4052                  sql_err($sql);                  sql_err($sql);
4053                  mysql_query ("UNLOCK TABLES", $con);                  xx_query ("UNLOCK TABLES", $con);
4054                  bailout();                  bailout();
4055          }          }
4056    
4057          // Succeeded          // Succeeded
4058          else {          else {
4059                  mysql_query ("UNLOCK TABLES", $con);                  xx_query ("UNLOCK TABLES", $con);
4060          }          }
4061                    
4062          // Call the PageScribe page back          // Call the PageScribe page back
# Line 4079  function updatePageDebug($con, $page_deb Line 4079  function updatePageDebug($con, $page_deb
4079                  . $page_id;                  . $page_id;
4080    
4081          // Failed                                        // Failed                              
4082          if (!mysql_query ($sql, $con)){          if (!xx_query ($sql, $con)){
4083                  sql_err($sql);                  sql_err($sql);
4084                  mysql_query ("UNLOCK TABLES", $con);                  xx_query ("UNLOCK TABLES", $con);
4085                  bailout();                  bailout();
4086          }          }
4087    
4088          // Succeeded          // Succeeded
4089          else {          else {
4090                  mysql_query ("UNLOCK TABLES", $con);                  xx_query ("UNLOCK TABLES", $con);
4091          }          }
4092                    
4093          // Call the PageScribe page back          // Call the PageScribe page back
# Line 4114  function updatePageHeader($con, $page_id Line 4114  function updatePageHeader($con, $page_id
4114                  . $page_id;                  . $page_id;
4115    
4116          // Failed                                        // Failed                              
4117          if (!mysql_query ($sql, $con)){          if (!xx_query ($sql, $con)){
4118                  sql_err($sql);                  sql_err($sql);
4119                  mysql_query ("UNLOCK TABLES", $con);                  xx_query ("UNLOCK TABLES", $con);
4120                  bailout();                  bailout();
4121          }          }
4122    
4123          // Succeeded          // Succeeded
4124          else {          else {
4125                  mysql_query ("UNLOCK TABLES", $con);                  xx_query ("UNLOCK TABLES", $con);
4126          }          }
4127    
4128          // Call the PageScribe page back          // Call the PageScribe page back
# Line 4146  function updatePageTitleStyle($con, $pag Line 4146  function updatePageTitleStyle($con, $pag
4146                  . $page_id;                  . $page_id;
4147    
4148          // Failed                                        // Failed                              
4149          if (!mysql_query ($sql, $con)){          if (!xx_query ($sql, $con)){
4150                  sql_err($sql);                  sql_err($sql);
4151                  mysql_query ("UNLOCK TABLES", $con);                  xx_query ("UNLOCK TABLES", $con);
4152                  bailout();                  bailout();
4153          }          }
4154    
4155          // Succeeded          // Succeeded
4156          else {          else {
4157                  mysql_query ("UNLOCK TABLES", $con);                  xx_query ("UNLOCK TABLES", $con);
4158          }          }
4159                    
4160          // Call the PageScribe page back          // Call the PageScribe page back
# Line 4191  function updateScribeCourse($con, $cours Line 4191  function updateScribeCourse($con, $cours
4191                          . " AND page_id = "                          . " AND page_id = "
4192                          . $page_id;                          . $page_id;
4193    
4194                  if (!mysql_query ($sql, $con)){                  if (!xx_query ($sql, $con)){
4195                          sql_err($sql);                          sql_err($sql);
4196                          mysql_query ("UNLOCK TABLES", $con);                          xx_query ("UNLOCK TABLES", $con);
4197                          bailout();                          bailout();
4198                  }                  }
4199                  else {                  else {
4200                          mysql_query ("UNLOCK TABLES", $con);                          xx_query ("UNLOCK TABLES", $con);
4201                  }                  }
4202    
4203    
# Line 4214  function updateScribeCourse($con, $cours Line 4214  function updateScribeCourse($con, $cours
4214                          . ")";                          . ")";
4215                                    
4216                  // Write the new row to the database                  // Write the new row to the database
4217                  mysql_query ("LOCK TABLE course WRITE", $con);                  xx_query ("LOCK TABLE course WRITE", $con);
4218                  if (!mysql_query($sql, $con)){                  if (!xx_query($sql, $con)){
4219                          sql_err($con);                          sql_err($con);
4220                          mysql_query ("UNLOCK TABLES", $con);                          xx_query ("UNLOCK TABLES", $con);
4221                          bailout();                          bailout();
4222                  }                  }
4223                  else {                  else {
4224                          $course_id = mysql_insert_id($con);                          $course_id = xx_insert_id($con);
4225                          mysql_query("UNLOCK TABLES", $con);                          xx_query("UNLOCK TABLES", $con);
4226                  }                  }
4227    
4228          }          }
# Line 4260  function updateScribeCourseConcat($con, Line 4260  function updateScribeCourseConcat($con,
4260                  WHERE                  WHERE
4261                  course_id = " . $course_id;                  course_id = " . $course_id;
4262                    
4263          $rs = mysql_query($sql, $con);          $rs = xx_query($sql, $con);
4264          $row = mysql_fetch_array ($rs);          $row = xx_fetch_array ($rs);
4265    
4266          $page_title = $row["page_title"];          $page_title = $row["page_title"];
4267          $coursesub_id = $row["coursesub_id"];            $coursesub_id = $row["coursesub_id"];  
# Line 4294  function updateScribeCourseConcat($con, Line 4294  function updateScribeCourseConcat($con,
4294                  . "' WHERE course_id = "                  . "' WHERE course_id = "
4295                  . $course_id;                  . $course_id;
4296    
4297          if (!mysql_query ($sql, $con)){          if (!xx_query ($sql, $con)){
4298                  sql_err($sql);                  sql_err($sql);
4299                  mysql_query ("UNLOCK TABLES", $con);                  xx_query ("UNLOCK TABLES", $con);
4300                  bailout();                  bailout();
4301          }          }
4302          else {          else {
4303                  mysql_query ("UNLOCK TABLES", $con);                  xx_query ("UNLOCK TABLES", $con);
4304          }          }
4305                    
4306          header("Location: scribe.phtml?page_id=" . $page_id);          header("Location: scribe.phtml?page_id=" . $page_id);
# Line 4364  function updateScribeElement($con, $elem Line 4364  function updateScribeElement($con, $elem
4364                                  . " AND element_id = "                                  . " AND element_id = "
4365                                  . $element_id;                                  . $element_id;
4366    
4367                          if (!mysql_query ($sql, $con)){                          if (!xx_query ($sql, $con)){
4368                                  sql_err($sql);                                  sql_err($sql);
4369                                  mysql_query ("UNLOCK TABLES", $con);                                  xx_query ("UNLOCK TABLES", $con);
4370                                  bailout();                                  bailout();
4371                          }                          }
4372                          else {                          else {
4373                                  mysql_query ("UNLOCK TABLES", $con);                                  xx_query ("UNLOCK TABLES", $con);
4374                          }                                        }              
4375                                    
4376                                    
# Line 4390  function updateScribeElement($con, $elem Line 4390  function updateScribeElement($con, $elem
4390                                  . " AND element_id = "                                  . " AND element_id = "
4391                                  . $element_id;                                  . $element_id;
4392    
4393                          if (!mysql_query ($sql, $con)){                          if (!xx_query ($sql, $con)){
4394                                  sql_err($sql);                                  sql_err($sql);
4395                                  mysql_query ("UNLOCK TABLES", $con);                                  xx_query ("UNLOCK TABLES", $con);
4396                                  bailout();                                  bailout();
4397                          }                          }
4398                          else {                          else {
4399                                  mysql_query ("UNLOCK TABLES", $con);                                  xx_query ("UNLOCK TABLES", $con);
4400                          }                          }
4401    
4402                  }                  }
# Line 4415  function updateScribeElement($con, $elem Line 4415  function updateScribeElement($con, $elem
4415                                  . " AND element_id = "                                  . " AND element_id = "
4416                                  . $element_id;                                  . $element_id;
4417    
4418                          if (!mysql_query ($sql, $con)){                          if (!xx_query ($sql, $con)){
4419                                  sql_err($sql);                                  sql_err($sql);
4420                                  mysql_query ("UNLOCK TABLES", $con);                                  xx_query ("UNLOCK TABLES", $con);
4421                                  bailout();                                  bailout();
4422                          }                          }
4423                          else {                          else {
4424                                  mysql_query ("UNLOCK TABLES", $con);                                  xx_query ("UNLOCK TABLES", $con);
4425                          }                          }
4426    
4427                  }                  }
# Line 4452  function updateScribeHeader($con, $cours Line 4452  function updateScribeHeader($con, $cours
4452                  . "' WHERE page_id ="                  . "' WHERE page_id ="
4453                  . $page_id;                  . $page_id;
4454    
4455          if (!mysql_query ($sql, $con)){          if (!xx_query ($sql, $con)){
4456                  sql_err($sql);                  sql_err($sql);
4457                  mysql_query ("UNLOCK TABLES", $con);                  xx_query ("UNLOCK TABLES", $con);
4458                  bailout();                  bailout();
4459          }          }
4460          else {          else {
4461                  mysql_query ("UNLOCK TABLES", $con);                  xx_query ("UNLOCK TABLES", $con);
4462          }          }
4463    
4464          // Update the concatenated course title if this is a course page          // Update the concatenated course title if this is a course page
# Line 4485  function updateScribeStyle($con, $page_i Line 4485  function updateScribeStyle($con, $page_i
4485                  . " WHERE page_id ="                  . " WHERE page_id ="
4486                  . $page_id;                  . $page_id;
4487    
4488          if (!mysql_query ($sql, $con)){          if (!xx_query ($sql, $con)){
4489                  sql_err($sql);                  sql_err($sql);
4490                  mysql_query ("UNLOCK TABLES", $con);                  xx_query ("UNLOCK TABLES", $con);
4491                  bailout();                  bailout();
4492          }          }
4493          else {          else {
4494                  mysql_query ("UNLOCK TABLES", $con);                  xx_query ("UNLOCK TABLES", $con);
4495          }          }
4496    
4497          header("Location: scribe.phtml?page_id=" . $page_id);          header("Location: scribe.phtml?page_id=" . $page_id);
# Line 4515  function updateScribeUpdate($con, $page_ Line 4515  function updateScribeUpdate($con, $page_
4515                  . $page_id;                  . $page_id;
4516    
4517          // Failed                                        // Failed                              
4518          if (!mysql_query ($sql, $con)){          if (!xx_query ($sql, $con)){
4519                  sql_err($sql);                  sql_err($sql);
4520                  mysql_query ("UNLOCK TABLES", $con);                  xx_query ("UNLOCK TABLES", $con);
4521                  bailout();                  bailout();
4522          }          }
4523    
4524          // Succeeded          // Succeeded
4525          else {          else {
4526                  mysql_query ("UNLOCK TABLES", $con);                  xx_query ("UNLOCK TABLES", $con);
4527          }          }
4528  }  }
4529    
# Line 4570  function youngerProbe($page_id, $place_a Line 4570  function youngerProbe($page_id, $place_a
4570          // Younger found          // Younger found
4571          $younger = 0;          $younger = 0;
4572    
4573          if ($element_order <= mysql_num_rows($rs)) {                      if ($element_order <= xx_num_rows($rs)) {              
4574    
4575                  $row = mysql_fetch_array ($rs);                  $row = xx_fetch_array ($rs);
4576                  $probe_indent_level = $row["indent_level"];                  $probe_indent_level = $row["indent_level"];
4577                  $probe_element_id = $row["element_id"];                  $probe_element_id = $row["element_id"];
4578                                    
# Line 4583  function youngerProbe($page_id, $place_a Line 4583  function youngerProbe($page_id, $place_a
4583                  */                  */
4584                                    
4585                  if ($probe_indent_level > $indent_level) $younger = 1;                  if ($probe_indent_level > $indent_level) $younger = 1;
4586                  if ($element_order <= mysql_num_rows($rs)) mysql_data_seek($rs, $element_order - 1);                  if ($element_order <= xx_num_rows($rs)) xx_data_seek($rs, $element_order - 1);
4587    
4588          }                }      
4589                    

Legend:
Removed from v.41  
changed lines
  Added in v.42

  ViewVC Help
Powered by ViewVC 1.1.26