/[libdata]/branches/pear-db/public_controls.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 /branches/pear-db/public_controls.php

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

revision 6 by dpavlin, Mon Dec 15 20:58:38 2003 UTC revision 42 by dpavlin, Thu Mar 4 22:43:50 2004 UTC
# Line 50  function displayCourseHeader($con, $page Line 50  function displayCourseHeader($con, $page
50                  WHERE                  WHERE
51                  page_id = " . $page_id;                  page_id = " . $page_id;
52                    
53          $rs = mysql_query($sql, $con);          $rs = xx_query($sql, $con);
54          $row = mysql_fetch_array ($rs);          $row = xx_fetch_array ($rs);
55    
56          $course_id = $row["course_id"];          $course_id = $row["course_id"];
57          $staff_id_created = $row["staff_id_created"];          $staff_id_created = $row["staff_id_created"];
# Line 150  function displayCoursePers($con, $page_i Line 150  function displayCoursePers($con, $page_i
150                  WHERE                  WHERE
151                  course_id = " . $course_id . " ORDER BY personnel_id";                  course_id = " . $course_id . " ORDER BY personnel_id";
152                    
153          $rs = mysql_query($sql, $con);          $rs = xx_query($sql, $con);
154                    
155          // See how many in this record set          // See how many in this record set
156          $num_personnel = mysql_num_rows($rs);          $num_personnel = xx_num_rows($rs);
157    
158          if ($num_personnel > 0) {          if ($num_personnel > 0) {
159    
# Line 162  function displayCoursePers($con, $page_i Line 162  function displayCoursePers($con, $page_i
162                  printf("<b>Personnel:</b><br>\n");                  printf("<b>Personnel:</b><br>\n");
163    
164    
165                  while ($row = mysql_fetch_array ($rs)) {                  while ($row = xx_fetch_array ($rs)) {
166    
167                          // Initialize                          // Initialize
168                          $last_name = "";                          $last_name = "";
# Line 242  function displayRelatedPages($con, $subj Line 242  function displayRelatedPages($con, $subj
242                          . $subject_id                          . $subject_id
243                          . " AND sp.page_id = p.page_id ORDER BY p.page_title";                          . " AND sp.page_id = p.page_id ORDER BY p.page_title";
244                    
245          $rs = mysql_query($sql, $con);          $rs = xx_query($sql, $con);
246          while ($row = mysql_fetch_array ($rs)) {          while ($row = xx_fetch_array ($rs)) {
247                  $page_id = $row["page_id"];                  $page_id = $row["page_id"];
248                  $page_title = $row["page_title"];                  $page_title = $row["page_title"];
249    
# Line 279  function displayRelatedSubjects($con, $s Line 279  function displayRelatedSubjects($con, $s
279                  . $subject_id                  . $subject_id
280                  . " AND so.othersub_id = s.subject_id ORDER BY s.subject";                  . " AND so.othersub_id = s.subject_id ORDER BY s.subject";
281                                    
282          $rs = mysql_query($sql, $con);          $rs = xx_query($sql, $con);
283          while ($row = mysql_fetch_array ($rs)) {          while ($row = xx_fetch_array ($rs)) {
284                  $othersub_id = $row["othersub_id"];                  $othersub_id = $row["othersub_id"];
285                  $subject = $row["subject"];                      $subject = $row["subject"];    
286    
# Line 311  function displayTOC($con, $page_id, $wra Line 311  function displayTOC($con, $page_id, $wra
311          // Calculate number of elements          // Calculate number of elements
312          $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 = "
313                  . $page_id;                  . $page_id;
314          $rs = mysql_query($sql, $con);          $rs = xx_query($sql, $con);
315          $row = mysql_fetch_array ($rs);          $row = xx_fetch_array ($rs);
316          $num_elements = $row["num_elements"];          $num_elements = $row["num_elements"];
317    
318          // Calculate midpoint element            // Calculate midpoint element  
# Line 351  function displayTOC($con, $page_id, $wra Line 351  function displayTOC($con, $page_id, $wra
351                          . $page_id                          . $page_id
352                          . " AND e.indent_level < 1 ORDER BY e.element_order";                          . " AND e.indent_level < 1 ORDER BY e.element_order";
353    
354                  $rs = mysql_query($sql, $con);                  $rs = xx_query($sql, $con);
355    
356                  // Build a general ToC anchor                  // Build a general ToC anchor
357                  printf("<a name=\"toc\"></a>\n");                  printf("<a name=\"toc\"></a>\n");
# Line 366  function displayTOC($con, $page_id, $wra Line 366  function displayTOC($con, $page_id, $wra
366                                    
367                  $row_num = 0;                  $row_num = 0;
368                                    
369                  while ($row = mysql_fetch_array ($rs)) {                  while ($row = xx_fetch_array ($rs)) {
370                                    
371                          // Check for the midpoint                          // Check for the midpoint
372                          if ($row_num  == $midpoint && $wrap_toc == 1) {                          if ($row_num  == $midpoint && $wrap_toc == 1) {
# Line 477  function dropDownCoursesubSelected($con, Line 477  function dropDownCoursesubSelected($con,
477  */  */
478                    
479                    
480          $rs = mysql_query($sql, $con);          $rs = xx_query($sql, $con);
481          while ($row = mysql_fetch_array ($rs)) {          while ($row = xx_fetch_array ($rs)) {
482                  $coursesub = $row["coursesub"];                  $coursesub = $row["coursesub"];
483                                    
484                  printf("<option value = \"%s\"", $coursesub);                  printf("<option value = \"%s\"", $coursesub);
# Line 534  function dropDownFacultySelected($con, $ Line 534  function dropDownFacultySelected($con, $
534                  . " ORDER BY faculty_lastname, faculty_firstname";                  . " ORDER BY faculty_lastname, faculty_firstname";
535  */  */
536                    
537          $rs = mysql_query($sql, $con);          $rs = xx_query($sql, $con);
538          while ($row = mysql_fetch_array ($rs)) {          while ($row = xx_fetch_array ($rs)) {
539                  $faculty_id = $row["faculty_id"];                  $faculty_id = $row["faculty_id"];
540                  $faculty_lastname = $row["faculty_lastname"];                  $faculty_lastname = $row["faculty_lastname"];
541                  $faculty_firstname = $row["faculty_firstname"];                  $faculty_firstname = $row["faculty_firstname"];
# Line 589  function dropDownFieldOmit($con, $table, Line 589  function dropDownFieldOmit($con, $table,
589                  . $where                  . $where
590                  . " ORDER BY "                  . " ORDER BY "
591                  . $field_display;                  . $field_display;
592          $rs = mysql_query($sql, $con);          $rs = xx_query($sql, $con);
593          while ($row = mysql_fetch_array ($rs)) {          while ($row = xx_fetch_array ($rs)) {
594                  $field_display_item = $row[$field_display];                  $field_display_item = $row[$field_display];
595                  if (strlen($field_display_item) > 40) $field_display_item = substr($field_display_item, 0, 39) . "...";                                  if (strlen($field_display_item) > 40) $field_display_item = substr($field_display_item, 0, 39) . "...";                
596                  $field_value_item = $row[$field_value];                  $field_value_item = $row[$field_value];
# Line 641  function dropDownFieldSelected($con, $ta Line 641  function dropDownFieldSelected($con, $ta
641          // Debugging          // Debugging
642          //printf("sql was: %s<BR>", $sql);          //printf("sql was: %s<BR>", $sql);
643                    
644          $rs = mysql_query($sql, $con);          $rs = xx_query($sql, $con);
645          while ($row = mysql_fetch_array ($rs)) {          while ($row = xx_fetch_array ($rs)) {
646                  $field_display_item = $row[$field_display];                  $field_display_item = $row[$field_display];
647                  $field_value_item = $row[$field_value];                  $field_value_item = $row[$field_value];
648                  if (strlen($field_display_item) > 50) $field_display_item = substr($field_display_item, 0, 49) . "...";                  if (strlen($field_display_item) > 50) $field_display_item = substr($field_display_item, 0, 49) . "...";
# Line 687  function existsRow($con, $table, $key_fi Line 687  function existsRow($con, $table, $key_fi
687                  . "="                  . "="
688                  . $limit_id;                  . $limit_id;
689    
690          $rs = mysql_query($sql, $con);          $rs = xx_query($sql, $con);
691          $rowcount = mysql_num_rows($rs);          $rowcount = xx_num_rows($rs);
692          if ($rowcount >= 1){          if ($rowcount >= 1){
693                  $rowcount = 1;                  $rowcount = 1;
694          }          }
# Line 723  function locationList($con, $resource_id Line 723  function locationList($con, $resource_id
723                  . $resource_id                  . $resource_id
724                  . " AND rl.location_id = l.location_id ORDER BY location";                  . " AND rl.location_id = l.location_id ORDER BY location";
725    
726          $rs = mysql_query($sql, $con);          $rs = xx_query($sql, $con);
727          while ($row = mysql_fetch_array ($rs)) {          while ($row = xx_fetch_array ($rs)) {
728                  $location = $row["location"];                  $location = $row["location"];
729                  if ($first == 1) {                  if ($first == 1) {
730                          $first = 0;                          $first = 0;
# Line 769  function lookupField($con, $table, $key_ Line 769  function lookupField($con, $table, $key_
769                  . "='"                  . "='"
770                  . $key_value                  . $key_value
771                  . "'";                  . "'";
772          $rs = mysql_query($sql, $con);          $rs = xx_query($sql, $con);
773          $row = mysql_fetch_array ($rs);          $row = xx_fetch_array ($rs);
774          if (mysql_num_rows($rs) == 1) $result = $row[$desc_field];          if (xx_num_rows($rs) == 1) $result = $row[$desc_field];
775          else $result = "";          else $result = "";
776                    
777          return $result;          return $result;
# Line 797  function lookupStaff($con, $staff_id){ Line 797  function lookupStaff($con, $staff_id){
797    
798          $sql = "SELECT first_name, last_name FROM staff WHERE staff_id = "          $sql = "SELECT first_name, last_name FROM staff WHERE staff_id = "
799                  . $staff_id;                  . $staff_id;
800          $rs = mysql_query($sql, $con);          $rs = xx_query($sql, $con);
801          $row = mysql_fetch_array ($rs);          $row = xx_fetch_array ($rs);
802          $last_name = $row["last_name"];          $last_name = $row["last_name"];
803          $first_name = $row["first_name"];          $first_name = $row["first_name"];
804                    
# Line 842  function pageLoadStats($con, $page_id){ Line 842  function pageLoadStats($con, $page_id){
842                          . $user_ip                          . $user_ip
843                          . "')";                          . "')";
844    
845          if (!mysql_query($sql, $con)){          if (!xx_query($sql, $con)){
846                  sql_err($con);                  sql_err($con);
847                  mysql_query ("UNLOCK TABLES", $con);                  xx_query ("UNLOCK TABLES", $con);
848                  bailout();                  bailout();
849          } // bad write          } // bad write
850          else {          else {
851                  mysql_query("UNLOCK TABLES", $con);                  xx_query("UNLOCK TABLES", $con);
852    
853          } // good write to the pagestats table          } // good write to the pagestats table
854    
# Line 911  function subLoadStats($con, $subject_id) Line 911  function subLoadStats($con, $subject_id)
911                          . $user_ip                          . $user_ip
912                          . "')";                          . "')";
913    
914          if (!mysql_query($sql, $con)){          if (!xx_query($sql, $con)){
915                  sql_err($con);                  sql_err($con);
916                  mysql_query ("UNLOCK TABLES", $con);                  xx_query ("UNLOCK TABLES", $con);
917                  bailout();                  bailout();
918          } // bad write          } // bad write
919          else {          else {
920                  mysql_query("UNLOCK TABLES", $con);                  xx_query("UNLOCK TABLES", $con);
921    
922          } // good write to the substats table          } // good write to the substats table
923    

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

  ViewVC Help
Powered by ViewVC 1.1.26