]> git.mjollnir.org Git - moodle.git/commitdiff
removed unnecessary calls to get_site()
authorgustav_delius <gustav_delius>
Sun, 29 Aug 2004 14:15:40 +0000 (14:15 +0000)
committergustav_delius <gustav_delius>
Sun, 29 Aug 2004 14:15:40 +0000 (14:15 +0000)
26 files changed:
course/lib.php
course/mod.php
files/index.php
filter/activitynames/filter.php
lib/datalib.php
lib/editor/coursefiles.php
lib/editor/courseimages.php
lib/moodlelib.php
login/change_password.php
login/index.php
mod/assignment/lib.php
mod/attendance/lib.php
mod/dialogue/locallib.php
mod/exercise/locallib.php
mod/glossary/filter.php
mod/journal/lib.php
mod/resource/coursefiles.php
mod/resource/filter.php
mod/resource/version.php
mod/scorm/coursefiles.php
mod/wiki/filter.php
mod/wiki/lib.php
mod/wiki/wikifiles.php
mod/workshop/lib.php
mod/workshop/locallib.php
user/index.php

index cb5d3abd313139cde475e42971ca45f770903e2b..b8c4ac253432156c1d585d870e00fceee218d43d 100644 (file)
@@ -1252,11 +1252,6 @@ function print_course($course, $width="100%") {
         $enrol = new enrolment_plugin;
     }
 
-    if (! $site = get_site()) {
-        error("Could not find a site!");
-    }
-
-
     print_simple_box_start("center", "$width", $THEME->cellcontent, 5, "coursebox");
 
     $linkcss = $course->visible ? "" : " class=\"dimmed\" ";
@@ -1274,7 +1269,7 @@ function print_course($course, $width="100%") {
                     $teacher->role = $course->teacher;
                 }
                 $fullname = fullname($teacher, isteacher($course->id)); // is the USER a teacher of that course
-                echo "$teacher->role: <a href=\"$CFG->wwwroot/user/view.php?id=$teacher->id&course=$site->id\">$fullname</a><br />";
+                echo "$teacher->role: <a href=\"$CFG->wwwroot/user/view.php?id=$teacher->id&course=".SITEID."\">$fullname</a><br />";
             }
         }
         echo "</font></p>";
index 237c5208bd57492ad7c3b3bd573de2c4dce938cc..06924328640ce437f12c46cbb0b2dbd53fa9c8e2 100644 (file)
 
         rebuild_course_cache($cm->course);
 
-        $site = get_site();
-        if ($site->id == $cm->course) {
+        if (SITEID == $cm->course) {
             redirect($CFG->wwwroot);
         } else {
             redirect("view.php?id=$cm->course");
 
         rebuild_course_cache($section->course);
 
-        $site = get_site();
-        if ($site->id == $section->course) {
+        if (SITEID == $section->course) {
             redirect($CFG->wwwroot);
         } else {
             redirect("view.php?id=$section->course");
             error("Could not update the indent level on that course module");
         }
 
-        $site = get_site();
-        if ($site->id == $cm->course) {
+        if (SITEID == $cm->course) {
             redirect($CFG->wwwroot);
         } else {
             redirect("view.php?id=$cm->course");
 
         rebuild_course_cache($cm->course);
 
-        $site = get_site();
-        if ($site->id == $cm->course) {
+        if (SITEID == $cm->course) {
             redirect($CFG->wwwroot);
         } else {
             redirect("view.php?id=$cm->course");
             error("This module doesn't exist");
         }
 
-        $site = get_site();
-
-        if ($module->visible and ($section->visible or ($site->id == $cm->course))) {
+        if ($module->visible and ($section->visible or (SITEID == $cm->course))) {
             show_course_module($cm->id);
             rebuild_course_cache($cm->course);
         }
 
-        if ($site->id == $cm->course) {
+        if (SITEID == $cm->course) {
             redirect($CFG->wwwroot);
         } else {
             redirect("view.php?id=$cm->course");
 
         rebuild_course_cache($cm->course);
 
-        $site = get_site();
-        if ($site->id == $cm->course) {
+        if (SITEID == $cm->course) {
             redirect($CFG->wwwroot);
         } else {
             redirect("view.php?id=$cm->course");
index 287d59d1595efdee5938b163cf188c3c0c6f7b8c..216fd09904f793fbfaf8ed7c5e1c235f26deab5f 100644 (file)
 
         global $CFG;
 
-        if (! $site = get_site()) {
-            error("Invalid site!");
-        }
-
-        if ($course->id == $site->id) {
+        if ($course->id == SITEID) {
             $strfiles = get_string("sitefiles");
         } else {
             $strfiles = get_string("files");
@@ -59,7 +55,7 @@
             $fullnav = "<a href=\"index.php?id=$course->id&wdir=/\">$strfiles</a> $navigation -> ".$dirs[$numdirs-1];
         }
 
-        if ($course->id == $site->id) {
+        if ($course->id == SITEID) {
             print_header("$course->shortname: $strfiles", "$course->fullname", 
                          "<a href=\"../$CFG->admin/index.php\">".get_string("administration").
                          "</a> -> $fullnav", $formfield);
index 9e52f155c1cfa0eb28655267de9e7b9b60acf76b..5c5e6cc0be2ad92f8c568459b07916f291c79947 100644 (file)
@@ -9,9 +9,7 @@
         global $CFG;
 
         if (empty($courseid)) {
-            if ($site = get_site()) {
-                $courseid = $site->id;
-            }
+            $courseid = SITEID;
         }
 
         $course = get_record("course","id",$courseid);
index 9beec5446d784a847d201bbbe8f96620eb12aa88..16e172b485d7f1198bf6905aa9b1879de6efe107 100644 (file)
@@ -1,6 +1,12 @@
 <?PHP // $Id$
 
+/// CONSTANTS /////////////////////////////////////////////////////////////
+
+define('SITEID', 1);
+
+
 /// FUNCTIONS FOR DATABASE HANDLING  ////////////////////////////////
+
 /**
 * execute a given sql command string
 * 
@@ -947,9 +953,7 @@ function get_user_info_from_db($field, $value) {
         $user->admin = true;
     }
 
-    if ($site = get_site()) {
-        $user->student[$site->id] = isstudent($site->id, $user->id);
-    }
+    $user->student[SITEID] = isstudent(SITEID, $user->id);
 
 /// Determine enrolments based on current enrolment module
 
@@ -1173,8 +1177,7 @@ function get_course_students($courseid, $sort="s.timeaccess", $dir="", $page=0,
 
     // make sure it works on the site course
     $select = "s.course = '$courseid' AND ";
-    $site = get_site();
-    if ($courseid == $site->id) {
+    if ($courseid == SITEID) {
         $select = '';
     }
 
@@ -1367,8 +1370,7 @@ function search_users($courseid, $groupid, $searchtext, $sort='', $exceptions=''
         $order = '';
     }
     
-    $site = get_site();
-    if (!$courseid or $courseid == $site->id) {
+    if (!$courseid or $courseid == SITEID) {
         if (!$admins = get_records_sql("SELECT u.id, u.firstname, u.lastname, u.email
                       FROM {$CFG->prefix}user u, 
                            {$CFG->prefix}user_admins s
@@ -2279,9 +2281,9 @@ function add_to_log($courseid, $module, $action, $url="", $info="", $cm=0, $user
         echo "<P>Error: Could not insert a new entry to the Moodle log</P>";  // Don't throw an error
     }    
     if (!$user and isset($USER->id)) {
-        $site = get_site();
-        if ($courseid == $site->id) {
-            update_user_in_db();
+        if ($courseid == SITEID) {
+            $db->Execute("UPDATE {$CFG->prefix}user SET lastIP='$REMOTE_ADDR', lastaccess='$timenow' 
+                     WHERE id = '$USER->id' ");
         } else if (isstudent($courseid)) {
             $db->Execute("UPDATE {$CFG->prefix}user_students SET timeaccess = '$timenow' ".
                          "WHERE course = '$courseid' AND userid = '$userid'");
index be67d28320260a89ed73076ec723ec4095804ad7..517dd5c493f2af5646826c362abefcc4b5a290a9 100644 (file)
 
         global $CFG;
 
-        if (! $site = get_site()) {
-            error("Invalid site!");
-        }
-
         ?>
         <html>
         <head>
index a459d8ba8f73eda8943dc0897357cdddaed802b3..b2bb82dbe74d87676a8910adfae0ca32e025d2c5 100644 (file)
 
         global $CFG;
 
-        if (! $site = get_site()) {
-            error("Invalid site!");
-        }
-
-        if ($course->id == $site->id) {
+        if ($course->id == SITEID) {
             $strfiles = get_string("sitefiles");
         } else {
             $strfiles = get_string("files");
 
         print_header();
         ?>
-           <script language="javscript" type="text/javascript">
-           <!--
-           function set_value(url) {
-                   var str_url = url;
-                   //if(document.all) {
-                   //  window.returnValue = str_url;
-                  //   window.close();
-               //}
-               //else {
-                       window.opener.document.forms[0].url.value = str_url;
-                       window.close();
-               //}
-           }
+        <script language="javscript" type="text/javascript">
+        <!--
+        function set_value(url) {
+            var str_url = url;
+            //if(document.all) {
+            //  window.returnValue = str_url;
+           //   window.close();
+            //}
+            //else {
+                window.opener.document.forms[0].url.value = str_url;
+                window.close();
+            //}
+        }
         -->
-           </script>
+        </script>
         <?php
 
         echo '<table border="0" cellpadding="3" cellspacing="0" width="100%">';
@@ -89,7 +85,7 @@
         echo '</tr>';
         echo '</table>';
 
-        if ($course->id == $site->id) {
+        if ($course->id == SITEID) {
             print_heading(get_string("publicsitefileswarning"), "center", 2);
         }
 
             break;
 
         case "torte":
-               if($_POST)
-               {
-                       while(list($key, $val) = each($_POST))
-                       {
-                               if(ereg("file([0-9]+)", $key, $regs))
-                               {
-                                       $file = $val;
-                               }
-                       }
-                       if(@filetype($CFG->dataroot ."/". $course->id . $file) == "file")
-                       {
-                               if(mimeinfo("icon", $file) == "image.gif")
-                               {
-                                       $url = $CFG->wwwroot ."/file.php?file=/" .$course->id . $file;
-                                       runjavascript($url);
-                               }
-                               else
-                               {
-                                       print "File is not a image!";
-                               }
-                       }
-                       else
-                       {
-                               print "You cannot insert FOLDER into richtext editor!!!";
-                       }
-               }
-               break;
+            if($_POST)
+            {
+                while(list($key, $val) = each($_POST))
+                {
+                    if(ereg("file([0-9]+)", $key, $regs))
+                    {
+                        $file = $val;
+                    }
+                }
+                if(@filetype($CFG->dataroot ."/". $course->id . $file) == "file")
+                {
+                    if(mimeinfo("icon", $file) == "image.gif")
+                    {
+                        $url = $CFG->wwwroot ."/file.php?file=/" .$course->id . $file;
+                        runjavascript($url);
+                    }
+                    else
+                    {
+                        print "File is not a image!";
+                    }
+                }
+                else
+                {
+                    print "You cannot insert FOLDER into richtext editor!!!";
+                }
+            }
+            break;
         case "cancel";
             clearfilelist();
 
index 78865a8eb53ff557da2b3c73c59d667ae4556fc8..82bd6c09f384d38d7f282ec346e8817adc9df6ec 100644 (file)
@@ -383,8 +383,7 @@ function require_login($courseid=0, $autologinguest=true) {
 
     // Check that the user account is properly set up
     if (user_not_fully_set_up($USER)) {
-        $site = get_site();
-        redirect("$CFG->wwwroot/user/edit.php?id=$USER->id&course=$site->id");
+        redirect("$CFG->wwwroot/user/edit.php?id=$USER->id&course=SITEID");
         die;
     }
 
@@ -588,8 +587,7 @@ function isstudent($courseid, $userid=0) {
         return false;
     }
 
-    $site = get_site();
-    if ($courseid == $site->id) {
+    if ($courseid == SITEID) {
         if (!$userid) {
             $userid = $USER->id;
         }
@@ -968,9 +966,8 @@ function add_admin($userid) {
             $admin->userid = $userid;
             
             // any admin is also a teacher on the site course
-            $site = get_site();
-            if (!record_exists('user_teachers', 'course', $site->id, 'userid', $userid)) {
-                if (!add_teacher($userid, $site->id)) {
+            if (!record_exists('user_teachers', 'course', SITEID, 'userid', $userid)) {
+                if (!add_teacher($userid, SITEID)) {
                     return false;
                 }
             }
@@ -987,8 +984,7 @@ function remove_admin($userid) {
     global $db;
 
     // remove also from the list of site teachers
-    $site = get_site();
-    remove_teacher($userid, $site->id);
+    remove_teacher($userid, SITEID);
 
     return delete_records("user_admins", "userid", $userid);
 }
@@ -1534,8 +1530,7 @@ function email_to_user($user, $from, $subject, $messagetext, $messagehtml="", $a
         return true;
     } else {
         mtrace("ERROR: $mail->ErrorInfo");
-        $site = get_site();
-        add_to_log($site->id, "library", "mailer", $_SERVER["REQUEST_URI"], "ERROR: $mail->ErrorInfo");
+        add_to_log(SITEID, "library", "mailer", $_SERVER["REQUEST_URI"], "ERROR: $mail->ErrorInfo");
         return false;
     }
 }
index b31e8b4b859d00831c5e434623dce7f7b682e4c8..8b93c58c8b030ef7fec9855cbf798fdd3141d5a2 100644 (file)
@@ -53,8 +53,7 @@
                               <A HREF=\"$CFG->wwwroot/user/view.php?id=$USER->id&course=$course->id\">$fullname</A> -> $strpasswordchanged", $focus);
                 notice($strpasswordchanged, "$CFG->wwwroot/user/view.php?id=$USER->id&course=$id");
             } else {
-                $site = get_site();
-                add_to_log($site->id, "user", "change password", "view.php?id=$user->id&course=$site->id", "$course->id");
+                add_to_log(SITEID, "user", "change password", "view.php?id=$user->id&course=".SITEID, "$course->id");
                 print_header($strpasswordchanged, $strpasswordchanged, $strpasswordchanged, "");
                 notice($strpasswordchanged, "$CFG->wwwroot/");
             }
index 6a4df7f3d7ce6995b3a17aa0281ed683cb9724fb..0aca5724902c5ceae38ba5cddd6e4295539cd22c 100644 (file)
@@ -74,8 +74,7 @@
             $SESSION->justloggedin = true;
 
             if (user_not_fully_set_up($USER)) {
-                $site = get_site();
-                redirect("$CFG->wwwroot/user/edit.php?id=$USER->id&course=$site->id");
+                redirect("$CFG->wwwroot/user/edit.php?id=$USER->id&course=".SITEID);
 
             } else if (strpos($wantsurl, $CFG->wwwroot) === 0) {   /// Matches site address
                 redirect($wantsurl);
index 234c83daa98143851a984ea9a62da8c390f6ab8b..b5de966de9daf23ae55d82ded6097e90fe9d8729 100644 (file)
@@ -425,8 +425,7 @@ function assignment_count_real_submissions($assignment, $groupid=0) {
                                       AND a.userid = g.userid ");
     } else {
         $select = "s.course = '$assignment->course' AND";
-        $site = get_site();
-        if ($assignment->course == $site->id) {
+        if ($assignment->course == SITEID) {
             $select = '';
         }     
         return count_records_sql("SELECT COUNT(*)
@@ -451,8 +450,7 @@ function assignment_get_all_submissions($assignment, $sort="", $dir="DESC") {
     }
     
     $select = "s.course = '$assignment->course' AND";
-    $site = get_site();
-    if ($assignment->course == $site->id) {
+    if ($assignment->course == SITEID) {
         $select = '';
     }
     return get_records_sql("SELECT a.* 
@@ -470,8 +468,7 @@ function assignment_get_users_done($assignment) {
     global $CFG;
     
     $select = "s.course = '$assignment->course' AND";
-    $site = get_site();
-    if ($assignment->course == $site->id) {
+    if ($assignment->course == SITEID) {
         $select = '';
     }
     return get_records_sql("SELECT u.* 
@@ -497,8 +494,8 @@ function assignment_get_unmailed_submissions($cutofftime) {
                                AND s.assignment = a.id
                                AND s.userid = us.userid
                                AND a.course = us.course");
-    $site = get_site();
-    if (record_exists('assignment', 'course', $site->id)) {
+    $siteid = SITEID;
+    if (record_exists('assignment', 'course', $siteid)) {
         $records += get_records_sql("SELECT s.*, a.course, a.name
                               FROM {$CFG->prefix}assignment_submissions s, 
                                    {$CFG->prefix}assignment a,
@@ -508,7 +505,7 @@ function assignment_get_unmailed_submissions($cutofftime) {
                                AND s.timemarked > 0
                                AND s.assignment = a.id
                                AND s.userid = us.userid
-                               AND a.course = $site->id");
+                               AND a.course = $siteid");
     }
 }
 
index bee964aff23eb46e33fb913e92de4110a874c2ec..da704bef828cb536e72d1817f5bdc5a48453c3be 100755 (executable)
@@ -387,8 +387,7 @@ function attendance_get_course_students($courseid, $sort="u.lastaccess DESC") {
 
     // make sure it works on the site course
     $select = "s.course = '$courseid' AND";
-    $site = get_site();
-    if ($courseid == $site->id) {
+    if ($courseid == SITEID) {
         $select = '';
     }
     return get_records_sql("SELECT u.id, u.username, u.firstname, u.lastname, u.maildisplay, u.mailformat,
index 3db47524176f8796f28a0d6ff3f6c69bf818d4c0..c20294794e6c7b2c8773e006800ff8d1e9d6131a 100644 (file)
@@ -235,8 +235,7 @@ function dialogue_get_users_done($dialogue) {
 
     // make sure it works on the site course
     $select = "s.course = '$dialogue->course' AND";
-    $site = get_site();
-    if ($courseid == $site->id) {
+    if ($courseid == SITEID) {
         $select = '';
     }
     if (!$students = get_records_sql("SELECT u.* 
index 49d5bb86db2346fb8821ad04c53ec327db0f35ab..0d4a3ae6248875f2e6c844b52826585ac0d96bff 100644 (file)
@@ -239,8 +239,7 @@ function exercise_count_student_submissions($exercise) {
 
     // make sure it works on the site course
     $select = "u.course = '$exercise->course' AND";
-    $site = get_site();
-    if ($exercise->course == $site->id) {
+    if ($exercise->course == SITEID) {
         $select = '';
     }
 
@@ -489,8 +488,7 @@ function exercise_get_best_submission_grades($exercise) {
 
     // make sure it works on the site course
     $select = "u.course = '$exercise->course' AND";
-    $site = get_site();
-    if ($exercise->course == $site->id) {
+    if ($exercise->course == SITEID) {
         $select = '';
     }
 
@@ -543,8 +541,7 @@ function exercise_get_student_submissions($exercise, $order = "time", $groupid =
                     
             // make sure it works on the site course
             $select = "u.course = '$exercise->course' AND";
-            $site = get_site();
-            if ($exercise->course == $site->id) {
+            if ($exercise->course == SITEID) {
                 $select = '';
             }
 
@@ -570,8 +567,7 @@ function exercise_get_student_submissions($exercise, $order = "time", $groupid =
 
     // make sure it works on the site course
     $select = "u.course = '$exercise->course' AND";
-    $site = get_site();
-    if ($exercise->course == $site->id) {
+    if ($exercise->course == SITEID) {
         $select = '';
     }
 
@@ -591,8 +587,7 @@ function exercise_get_student_submissions($exercise, $order = "time", $groupid =
 
             // make sure it works on the site course
             $select = "u.course = '$exercise->course' AND";
-            $site = get_site();
-            if ($exercise->course == $site->id) {
+            if ($exercise->course == SITEID) {
                 $select = '';
             }
 
@@ -615,8 +610,7 @@ function exercise_get_student_submissions($exercise, $order = "time", $groupid =
 
         // make sure it works on the site course
         $select = "u.course = '$exercise->course' AND";
-        $site = get_site();
-        if ($exercise->course == $site->id) {
+        if ($exercise->course == SITEID) {
             $select = '';
         }
 
@@ -670,8 +664,7 @@ function exercise_get_ungraded_assessments_student($exercise) {
 
     // make sure it works on the site course
     $select = "u.course = '$exercise->course' AND";
-    $site = get_site();
-    if ($exercise->course == $site->id) {
+    if ($exercise->course == SITEID) {
         $select = '';
     }
 
index 3544778d4df7e92f5df6fd1883ea548597b2917f..05bd8baed9373ed9ee8fc28ee17bbb9f763c55cb 100644 (file)
@@ -4,9 +4,7 @@
         global $CFG;
 
         if (empty($courseid)) {
-            if ($site = get_site()) {
-                $courseid = $site->id;
-            }
+            $courseid = SITEID;
         }
 
         $GLOSSARY_CONCEPT_IS_ENTRY = 0;
index 073c75091c7121a377d9137dc870c5da89dc6f5b..f33270355ad9e0ebfa19a6b2b2394da1bc327353 100644 (file)
@@ -316,8 +316,7 @@ function journal_get_users_done($journal) {
 
     // make sure it works on the site course
     $select = "s.course = '$journal->course' AND";
-    $site = get_site();
-    if ($journal->course == $site->id) {
+    if ($journal->course == SITEID) {
         $select = '';
     }
 
@@ -369,8 +368,7 @@ function journal_count_entries($journal, $groupid=0) {
     
         // make sure it works on the site course
         $select = "s.course = '$journal->course' AND";
-        $site = get_site();
-        if ($journal->course == $site->id) {
+        if ($journal->course == SITEID) {
             $select = '';
         }
 
index f9d92a3b00105bf57566c942c54fe0a2b8042d1b..8dff0964c87c05767f10152eed59cb447031098c 100644 (file)
 
         global $CFG,$THEME;
 
-        if (! $site = get_site()) {
-            error("Invalid site!");
-        }
-
-        if ($course->id == $site->id) {
+        if ($course->id == SITEID) {
             $strfiles = get_string("sitefiles");
         } else {
             $strfiles = get_string("files");
 
         print_header();
         ?>
-           <script language="javascript" type="text/javascript">
-           <!--
-           function set_value(txt) {
-                   opener.document.forms['form'].reference.value = txt;
-                   window.close();
-           }
+        <script language="javascript" type="text/javascript">
+        <!--
+        function set_value(txt) {
+            opener.document.forms['form'].reference.value = txt;
+            window.close();
+        }
         -->
-           </script>
+        </script>
         <?php
 
         echo '<table border="0" cellpadding="3" cellspacing="0" width="100%">';
@@ -82,7 +78,7 @@
         echo '</tr>';
         echo '</table>';
 
-        if ($course->id == $site->id) {
+        if ($course->id == SITEID) {
             print_heading(get_string("publicsitefileswarning"), "center", 2);
         }
 
             break;
 
         case "torte":
-               if($_POST)
-               {
-                       while(list($key, $val) = each($_POST))
-                       {
-                               if(ereg("file([0-9]+)", $key, $regs))
-                               {
-                                       $file = $val;
-                               }
-                       }
-                       if(@filetype($CFG->dataroot ."/". $course->id . $file) == "file")
-                       {
-                               if(mimeinfo("icon", $file) == "image.gif")
-                               {
-                                       $url = $CFG->wwwroot ."/file.php?file=/" .$course->id . $file;
-                                       runjavascript($url);
-                               }
-                               else
-                               {
-                                       print "File is not a image!";
-                               }
-                       }
-                       else
-                       {
-                               print "You cannot insert FOLDER into richtext editor!!!";
-                       }
-               }
-               break;
+            if($_POST)
+            {
+                while(list($key, $val) = each($_POST))
+                {
+                    if(ereg("file([0-9]+)", $key, $regs))
+                    {
+                        $file = $val;
+                    }
+                }
+                if(@filetype($CFG->dataroot ."/". $course->id . $file) == "file")
+                {
+                    if(mimeinfo("icon", $file) == "image.gif")
+                    {
+                        $url = $CFG->wwwroot ."/file.php?file=/" .$course->id . $file;
+                        runjavascript($url);
+                    }
+                    else
+                    {
+                        print "File is not a image!";
+                    }
+                }
+                else
+                {
+                    print "You cannot insert FOLDER into richtext editor!!!";
+                }
+            }
+            break;
         case "cancel";
             clearfilelist();
 
index 4a9819811891d44e6e0ef2a888ac847ea1ac1473..5b59d5303d63ccb704a0f99ac5bc0b6fdc4a84ab 100644 (file)
@@ -9,9 +9,7 @@
         global $CFG;
 
         if (empty($courseid)) {
-            if ($site = get_site()) {
-                $courseid = $site->id;
-            }
+            $courseid = SITEID;
         }
 
         switch ($CFG->dbtype) {
index 2d3595a7c180babcba99184a641da6dbc05f43a6..af6468dcdc0e4e1e878128b24326976050606b21 100644 (file)
@@ -6,7 +6,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 
 $module->version  = 2004080801;
-$module->requires = 2004073000;  // Requires this Moodle version
+$module->requires = 2004092901;  // Requires this Moodle version
 $module->cron     = 0;
 
 ?>
index b514910f0536bb4692b1ea96fca4e6441fc985d6..b922736b978e6ee68ca3877a84ec570fcda3d20f 100755 (executable)
 
         global $CFG,$THEME,$ME;
 
-        if (! $site = get_site()) {
-            error("Invalid site!");
-        }
-
-        if ($course->id == $site->id) {
+        if ($course->id == SITEID) {
             $strfiles = get_string("sitefiles");
         } else {
             $strfiles = get_string("files");
 
         print_header();
         ?>
-           <script language="javascript" type="text/javascript">
-           <!--
-           function set_value(txt) {
-                   opener.document.forms['form'].reference.value = txt;
-                   window.close();
-           }
+        <script language="javascript" type="text/javascript">
+        <!--
+        function set_value(txt) {
+            opener.document.forms['form'].reference.value = txt;
+            window.close();
+        }
         -->
-           </script>
+        </script>
         <?php
 
         echo '<table border="0" cellpadding="3" cellspacing="0" width="100%">';
@@ -82,7 +78,7 @@
         echo '</tr>';
         echo '</table>';
 
-        if ($course->id == $site->id) {
+        if ($course->id == SITEID) {
             print_heading(get_string("publicsitefileswarning"), "center", 2);
         }
 
             break;
 
         case "torte":
-               if($_POST)
-               {
-                       while(list($key, $val) = each($_POST))
-                       {
-                               if(ereg("file([0-9]+)", $key, $regs))
-                               {
-                                       $file = $val;
-                               }
-                       }
-                       if(@filetype($CFG->dataroot ."/". $course->id . $file) == "file")
-                       {
-                               if(mimeinfo("icon", $file) == "image.gif")
-                               {
-                                       $url = $CFG->wwwroot ."/file.php?file=/" .$course->id . $file;
-                                       runjavascript($url);
-                               }
-                               else
-                               {
-                                       print "File is not a image!";
-                               }
-                       }
-                       else
-                       {
-                               print "You cannot insert FOLDER into richtext editor!!!";
-                       }
-               }
-               break;
+            if($_POST)
+            {
+                while(list($key, $val) = each($_POST))
+                {
+                    if(ereg("file([0-9]+)", $key, $regs))
+                    {
+                        $file = $val;
+                    }
+                }
+                if(@filetype($CFG->dataroot ."/". $course->id . $file) == "file")
+                {
+                    if(mimeinfo("icon", $file) == "image.gif")
+                    {
+                        $url = $CFG->wwwroot ."/file.php?file=/" .$course->id . $file;
+                        runjavascript($url);
+                    }
+                    else
+                    {
+                        print "File is not a image!";
+                    }
+                }
+                else
+                {
+                    print "You cannot insert FOLDER into richtext editor!!!";
+                }
+            }
+            break;
         case "cancel";
             clearfilelist();
 
@@ -684,7 +680,7 @@ function displaydir ($wdir) {
             $dirlist[] = $file;
         } else {
             if ((basename(strtolower($file),".zip") != basename(strtolower($file))) || (basename(strtolower($file),".pif") != basename(strtolower($file))))
-               $filelist[] = $file;
+            $filelist[] = $file;
         }
     }
     closedir($directory);
index 6243e5d361d3dd4f49d61966c86705c3882093ad..78a327c34c827fe8a3f5e90259e2b3fbaa17c8f0 100755 (executable)
@@ -1,126 +1 @@
-<?PHP // $Id$\r
-    //This function provides automatic linking to\r
-    //wiki pages when its page title is found inside every Moodle text\r
-    //It's based in the glosssary filter by Williams Castillo\r
-    //Modifications by mchurch. Enjoy! :-)\r
-\r
-    require_once($CFG->dirroot.'/mod/wiki/lib.php');\r
-\r
-    function wiki_filter($courseid, $text) {\r
-\r
-        global $CFG;\r
-\r
-        if (empty($courseid)) {\r
-            if ($site = get_site()) {\r
-                $courseid = $site->id;\r
-            }\r
-        }\r
-\r
-        if (!($course = get_record('course', 'id', $courseid))) {\r
-            return $text;\r
-        }\r
-\r
-//      Get all wikis for this course.\r
-        $wikis = wiki_get_course_wikis($courseid);\r
-        if (empty($wikis)) {\r
-            return $text;\r
-        }\r
-\r
-//      Walk through each wiki, and get entries.\r
-        foreach ($wikis as $wiki) {\r
-            if ($wiki_entries = wiki_get_entries($wiki)) {\r
-\r
-//              Walk through each entry and get the pages.\r
-                foreach ($wiki_entries as $wiki_entry) {\r
-                    if ($wiki_pages = get_records('wiki_pages', 'wiki', $wiki_entry->id)) {\r
-\r
-//                      Walk through each page and filter.\r
-                        foreach ($wiki_pages as $wiki_page) {\r
-                            $startlink = '<a class="autolink" title="Wiki" href="'\r
-                                        .$CFG->wwwroot.'/mod/wiki/view.php?wid='.$wiki->id\r
-                                        .'&userid='.$wiki_entry->userid\r
-                                        .'&groupid='.$wiki_entry->groupid\r
-                                        .'&wikipage='.$wiki_page->pagename.'">';\r
-                            $text = wiki_link_names($text, $wiki_page->pagename, $startlink, '</a>');\r
-                        }\r
-                    }\r
-                }\r
-            }\r
-        }\r
-\r
-        return $text;\r
-    }\r
-    \r
-    function wiki_link_names($text,$name,$href_tag_begin,$href_tag_end = "</a>") {\r
-\r
-        $list_of_words_cp = strip_tags($name);\r
-\r
-        $list_of_words_cp = trim($list_of_words_cp,'|');\r
-\r
-        $list_of_words_cp = trim($list_of_words_cp);\r
-\r
-        $list_of_words_cp = preg_quote($list_of_words_cp,'/');\r
-\r
-        $invalidprefixs = "([a-zA-Z0-9])";\r
-        $invalidsufixs  = "([a-zA-Z0-9])";\r
-\r
-        //Avoid seaching in the string if it's inside invalidprefixs and invalidsufixs\r
-        $words = array();\r
-        $regexp = '/'.$invalidprefixs.'('.$list_of_words_cp.')|('.$list_of_words_cp.')'.$invalidsufixs.'/is';\r
-        preg_match_all($regexp,$text,$list_of_words);\r
-\r
-        foreach (array_unique($list_of_words[0]) as $key=>$value) {\r
-            $words['<*'.$key.'*>'] = $value;\r
-        }\r
-        if (!empty($words)) {\r
-            $text = str_replace($words,array_keys($words),$text);\r
-        }\r
-\r
-        //Now avoid searching inside the <nolink>tag\r
-        $excludes = array();\r
-        preg_match_all('/<nolink>(.+?)<\/nolink>/is',$text,$list_of_excludes);\r
-        foreach (array_unique($list_of_excludes[0]) as $key=>$value) {\r
-            $excludes['<+'.$key.'+>'] = $value;\r
-        }\r
-        if (!empty($excludes)) {\r
-            $text = str_replace($excludes,array_keys($excludes),$text);\r
-        }\r
-\r
-        //Now avoid searching inside links\r
-        $links = array();\r
-        preg_match_all('/<A[\s](.+?)>(.+?)<\/A>/is',$text,$list_of_links);\r
-        foreach (array_unique($list_of_links[0]) as $key=>$value) {\r
-            $links['<@'.$key.'@>'] = $value;\r
-        }\r
-        if (!empty($links)) {\r
-            $text = str_replace($links,array_keys($links),$text);\r
-        }\r
-\r
-        //Now avoid searching inside every tag\r
-        $final = array();\r
-        preg_match_all('/<(.+?)>/is',$text,$list_of_tags);\r
-        foreach (array_unique($list_of_tags[0]) as $key=>$value) {\r
-            $final['<|'.$key.'|>'] = $value;\r
-        }\r
-        if (!empty($final)) {\r
-            $text = str_replace($final,array_keys($final),$text);\r
-        }\r
-\r
-        $text = preg_replace('/('.$list_of_words_cp.')/is', $href_tag_begin.'$1'.$href_tag_end,$text);\r
-\r
-        //Now rebuild excluded areas\r
-        if (!empty($final)) {\r
-            $text = str_replace(array_keys($final),$final,$text);\r
-        }\r
-        if (!empty($links)) {\r
-            $text = str_replace(array_keys($links),$links,$text);\r
-        }\r
-        if (!empty($excludes)) {\r
-            $text = str_replace(array_keys($excludes),$excludes,$text);\r
-        }\r
-        if (!empty($words)) {\r
-            $text = str_replace(array_keys($words),$words,$text);\r
-        }\r
-        return $text;\r
-    }\r
-?>\r
+<?PHP // $Id$\r\r    //This function provides automatic linking to\r\r    //wiki pages when its page title is found inside every Moodle text\r\r    //It's based in the glosssary filter by Williams Castillo\r\r    //Modifications by mchurch. Enjoy! :-)\r\r\r\r    require_once($CFG->dirroot.'/mod/wiki/lib.php');\r\r\r\r    function wiki_filter($courseid, $text) {\r\r\r\r        global $CFG;\r\r\r\r        if (empty($courseid)) {\r\r            $courseid = SITEID;\r\r            }\r\r        }\r\r\r\r        if (!($course = get_record('course', 'id', $courseid))) {\r\r            return $text;\r\r        }\r\r\r\r//      Get all wikis for this course.\r\r        $wikis = wiki_get_course_wikis($courseid);\r\r        if (empty($wikis)) {\r\r            return $text;\r\r        }\r\r\r\r//      Walk through each wiki, and get entries.\r\r        foreach ($wikis as $wiki) {\r\r            if ($wiki_entries = wiki_get_entries($wiki)) {\r\r\r\r//              Walk through each entry and get the pages.\r\r                foreach ($wiki_entries as $wiki_entry) {\r\r                    if ($wiki_pages = get_records('wiki_pages', 'wiki', $wiki_entry->id)) {\r\r\r\r//                      Walk through each page and filter.\r\r                        foreach ($wiki_pages as $wiki_page) {\r\r                            $startlink = '<a class="autolink" title="Wiki" href="'\r\r                                        .$CFG->wwwroot.'/mod/wiki/view.php?wid='.$wiki->id\r\r                                        .'&userid='.$wiki_entry->userid\r\r                                        .'&groupid='.$wiki_entry->groupid\r\r                                        .'&wikipage='.$wiki_page->pagename.'">';\r\r                            $text = wiki_link_names($text, $wiki_page->pagename, $startlink, '</a>');\r\r                        }\r\r                    }\r\r                }\r\r            }\r\r        }\r\r\r\r        return $text;\r\r    }\r\r    \r\r    function wiki_link_names($text,$name,$href_tag_begin,$href_tag_end = "</a>") {\r\r\r\r        $list_of_words_cp = strip_tags($name);\r\r\r\r        $list_of_words_cp = trim($list_of_words_cp,'|');\r\r\r\r        $list_of_words_cp = trim($list_of_words_cp);\r\r\r\r        $list_of_words_cp = preg_quote($list_of_words_cp,'/');\r\r\r\r        $invalidprefixs = "([a-zA-Z0-9])";\r\r        $invalidsufixs  = "([a-zA-Z0-9])";\r\r\r\r        //Avoid seaching in the string if it's inside invalidprefixs and invalidsufixs\r\r        $words = array();\r\r        $regexp = '/'.$invalidprefixs.'('.$list_of_words_cp.')|('.$list_of_words_cp.')'.$invalidsufixs.'/is';\r\r        preg_match_all($regexp,$text,$list_of_words);\r\r\r\r        foreach (array_unique($list_of_words[0]) as $key=>$value) {\r\r            $words['<*'.$key.'*>'] = $value;\r\r        }\r\r        if (!empty($words)) {\r\r            $text = str_replace($words,array_keys($words),$text);\r\r        }\r\r\r\r        //Now avoid searching inside the <nolink>tag\r\r        $excludes = array();\r\r        preg_match_all('/<nolink>(.+?)<\/nolink>/is',$text,$list_of_excludes);\r\r        foreach (array_unique($list_of_excludes[0]) as $key=>$value) {\r\r            $excludes['<+'.$key.'+>'] = $value;\r\r        }\r\r        if (!empty($excludes)) {\r\r            $text = str_replace($excludes,array_keys($excludes),$text);\r\r        }\r\r\r\r        //Now avoid searching inside links\r\r        $links = array();\r\r        preg_match_all('/<A[\s](.+?)>(.+?)<\/A>/is',$text,$list_of_links);\r\r        foreach (array_unique($list_of_links[0]) as $key=>$value) {\r\r            $links['<@'.$key.'@>'] = $value;\r\r        }\r\r        if (!empty($links)) {\r\r            $text = str_replace($links,array_keys($links),$text);\r\r        }\r\r\r\r        //Now avoid searching inside every tag\r\r        $final = array();\r\r        preg_match_all('/<(.+?)>/is',$text,$list_of_tags);\r\r        foreach (array_unique($list_of_tags[0]) as $key=>$value) {\r\r            $final['<|'.$key.'|>'] = $value;\r\r        }\r\r        if (!empty($final)) {\r\r            $text = str_replace($final,array_keys($final),$text);\r\r        }\r\r\r\r        $text = preg_replace('/('.$list_of_words_cp.')/is', $href_tag_begin.'$1'.$href_tag_end,$text);\r\r\r\r        //Now rebuild excluded areas\r\r        if (!empty($final)) {\r\r            $text = str_replace(array_keys($final),$final,$text);\r\r        }\r\r        if (!empty($links)) {\r\r            $text = str_replace(array_keys($links),$links,$text);\r\r        }\r\r        if (!empty($excludes)) {\r\r            $text = str_replace(array_keys($excludes),$excludes,$text);\r\r        }\r\r        if (!empty($words)) {\r\r            $text = str_replace(array_keys($words),$words,$text);\r\r        }\r\r        return $text;\r\r    }\r\r?>\r\r
\ No newline at end of file
index 5871d2db505b68886c801769ea198560e72e97cb..c8db5620d66da25054e87756f35e590667b1d75f 100644 (file)
@@ -407,18 +407,17 @@ function wiki_get_other_wikis(&$wiki, &$user, &$course, $currentid=0) {
     $mygroupid = mygroupid($course->id);
     $isteacher = isteacher($course->id, $user->id);
     $isteacheredit = isteacheredit($course->id, $user->id);
-    $site = get_site();
 
     switch ($wiki->wtype) {
 
     case 'student':
         /// Get all the existing entries for this wiki.
         $wiki_entries = wiki_get_entries($wiki, 'student');
-        if ($isteacher and ($site->id != $course->id)) {
+        if ($isteacher and (SITEID != $course->id)) {
 
             /// If the user is an editing teacher, or a non-editing teacher not assigned to a group, show all student
             /// wikis, regardless of creation.
-            if (($site->id != $course->id) and ($isteacheredit or ($groupmode == NOGROUPS))) {
+            if ((SITEID != $course->id) and ($isteacheredit or ($groupmode == NOGROUPS))) {
 
                 if ($students = get_course_students($course->id)) {
                     /// Default pagename is dependent on the wiki settings.
@@ -494,7 +493,7 @@ function wiki_get_other_wikis(&$wiki, &$user, &$course, $currentid=0) {
             /// group (for separate groups) or there are visible groups, or if this is
             /// a site-level wiki, and they are an administrator.
             if (($groupmode == VISIBLEGROUPS) or
-                (($site->id == $course->id) and isadmin())) {
+                ((SITEID == $course->id) and isadmin())) {
                 $viewall = true;
             }
             else if ($groupmode == SEPARATEGROUPS) {
@@ -706,7 +705,6 @@ function wiki_can_add_entry(&$wiki, &$user, &$course, $userid=0, $groupid=0) {
     /// Get the groupmode. It's been added to the wiki object.
     $groupmode = groupmode($course, $wiki);
     $mygroupid = mygroupid($course->id);
-    $site = get_site();
 
     switch ($wiki->wtype) {
 
@@ -715,7 +713,7 @@ function wiki_can_add_entry(&$wiki, &$user, &$course, $userid=0, $groupid=0) {
 ///     A user can create their own wiki at the site level.
         if ($userid == 0) {
             return (isstudent($course->id, $user->id) or
-                    (($site->id == $course->id) and !empty($user) and !isguest()));
+                    ((SITEID == $course->id) and !empty($user) and !isguest()));
         }
 ///     An editing teacher can create any student wiki, or
 ///     a non-editing teacher, if not assigned to a group can create any student wiki, or if assigned to a group can
@@ -730,7 +728,7 @@ function wiki_can_add_entry(&$wiki, &$user, &$course, $userid=0, $groupid=0) {
         /// If mode is 'nogroups', then all participants can add wikis.
         if (!$groupmode) {
             return (isstudent($course->id, $user->id) or isteacher($course->id, $user->id) or
-                    (($site->id == $course->id) and !empty($user) and !isguest()));
+                    ((SITEID == $course->id) and !empty($user) and !isguest()));
         }
         /// If not requesting a group, must be a member of a group.
         else if ($groupid == 0) {
@@ -747,7 +745,7 @@ function wiki_can_add_entry(&$wiki, &$user, &$course, $userid=0, $groupid=0) {
     case 'teacher':
         /// If mode is 'nogroups', then all teachers can add wikis.
         if (!$groupmode) {
-            return (isteacher($course->id, $user->id) or (($site->id == $course->id) and isadmin()));
+            return (isteacher($course->id, $user->id) or ((SITEID == $course->id) and isadmin()));
         }
         /// If not requesting a group, must be a member of a group.
         else if ($groupid == 0) {
@@ -771,7 +769,6 @@ function wiki_can_edit_entry(&$wiki_entry, &$wiki, &$user, &$course) {
     $can_edit = false;
     $groupmode = groupmode($course, $wiki);
     $mygroupid = mygroupid($course->id);
-    $site = get_site();
 
     /// Editing teacher's and admins can edit all wikis, non-editing teachers can edit wikis in their groups, 
     /// or all wikis if group mode is 'no groups' or they don't belong to a group.
@@ -798,7 +795,7 @@ function wiki_can_edit_entry(&$wiki_entry, &$wiki, &$user, &$course) {
             /// If mode is 'nogroups', then all participants can edit the wiki.
             else {
                 $can_edit = (isstudent($course->id, $user->id) or isteacher($course->id, $user->id) or
-                            (($site->id == $course->id) and !empty($user) and !isguest()));
+                            ((SITEID == $course->id) and !empty($user) and !isguest()));
             }
             break;
 
@@ -809,7 +806,7 @@ function wiki_can_edit_entry(&$wiki_entry, &$wiki, &$user, &$course) {
                 $can_edit = (isteacher($course->id, $user->id) and ismember($wiki_entry->groupid, $user->id));
             }
             else {
-                $can_edit = (isteacher($course->id, $user->id) or (($site->id == $course->id) and isadmin()));
+                $can_edit = (isteacher($course->id, $user->id) or ((SITEID == $course->id) and isadmin()));
             }
             break;
         }
index c903eff33acc7cc588c9ca167a9d31e4ce44fdcd..5fd2582cfe27e77db7cffd1ed9ed9ebf31973f4e 100755 (executable)
 
         global $CFG, $THEME, $ME;
 
-        if (! $site = get_site()) {
-            error("Invalid site!");
-        }
-
-        if ($course->id == $site->id) {
+        if ($course->id == SITEID) {
             $strfiles = get_string("sitefiles");
         } else {
             $strfiles = get_string("files");
 
         print_header();
         ?>
-           <script language="javascript" type="text/javascript">
-           <!--
-           function set_value(txt) {
-                   opener.document.forms['form'].initialcontent.value = txt;
-                   window.close();
-           }
+        <script language="javascript" type="text/javascript">
+        <!--
+        function set_value(txt) {
+            opener.document.forms['form'].initialcontent.value = txt;
+            window.close();
+        }
         -->
-           </script>
+        </script>
         <?php
 
         echo '<table border="0" cellpadding="3" cellspacing="0" width="100%">';
@@ -82,7 +78,7 @@
         echo '</tr>';
         echo '</table>';
 
-        if ($course->id == $site->id) {
+        if ($course->id == SITEID) {
             print_heading(get_string("publicsitefileswarning"), "center", 2);
         }
 
             break;
 
         case "torte":
-               if($_POST)
-               {
-                       while(list($key, $val) = each($_POST))
-                       {
-                               if(ereg("file([0-9]+)", $key, $regs))
-                               {
-                                       $file = $val;
-                               }
-                       }
-                       if(@filetype($CFG->dataroot ."/". $course->id . $file) == "file")
-                       {
-                               if(mimeinfo("icon", $file) == "image.gif")
-                               {
-                                       $url = $CFG->wwwroot ."/file.php?file=/" .$course->id . $file;
-                                       runjavascript($url);
-                               }
-                               else
-                               {
-                                       print "File is not a image!";
-                               }
-                       }
-                       else
-                       {
-                               print "You cannot insert FOLDER into richtext editor!!!";
-                       }
-               }
-               break;
+            if($_POST)
+            {
+                while(list($key, $val) = each($_POST))
+                {
+                    if(ereg("file([0-9]+)", $key, $regs))
+                    {
+                        $file = $val;
+                    }
+                }
+                if(@filetype($CFG->dataroot ."/". $course->id . $file) == "file")
+                {
+                    if(mimeinfo("icon", $file) == "image.gif")
+                    {
+                        $url = $CFG->wwwroot ."/file.php?file=/" .$course->id . $file;
+                        runjavascript($url);
+                    }
+                    else
+                    {
+                        print "File is not a image!";
+                    }
+                }
+                else
+                {
+                    print "You cannot insert FOLDER into richtext editor!!!";
+                }
+            }
+            break;
         case "cancel";
             clearfilelist();
 
index 93523ba13829d024eb22daae0969b333ec6d5374..b4bed7af64ac98ee2cea5cf9063d6ddd709ff2cd 100644 (file)
@@ -1205,8 +1205,7 @@ function workshop_get_student_submissions($workshop, $order = "title") {
 
     // make sure it works on the site course
     $select = "u.course = '$workshop->course' AND";
-    $site = get_site();
-    if ($workshop->course == $site->id) {
+    if ($workshop->course == SITEID) {
         $select = '';
     }
 
index d3d93ba39fa66cae689f158ed1fbc5303f581843..fb6f2702943a8c7a7aaa774a7fec779697871383 100644 (file)
@@ -250,8 +250,7 @@ function workshop_count_student_submissions($workshop) {
 
     // make sure it works on the site course
     $select = "s.course = '$workshop->course' AND";
-    $site = get_site();
-    if ($workshop->course == $site->id) {
+    if ($workshop->course == SITEID) {
         $select = '';
     }
 
@@ -515,8 +514,7 @@ function workshop_get_student_assessments($workshop, $user) {
 
     // make sure it works on the site course
     $select = "u.course = '$workshop->course' AND";
-    $site = get_site();
-    if ($workshop->course == $site->id) {
+    if ($workshop->course == SITEID) {
         $select = '';
     }
 
@@ -538,8 +536,7 @@ function workshop_get_student_submission_assessments($workshop) {
 
     // make sure it works on the site course
     $select = "u.course = '$workshop->course' AND";
-    $site = get_site();
-    if ($workshop->course == $site->id) {
+    if ($workshop->course == SITEID) {
         $select = '';
     }
 
@@ -608,8 +605,7 @@ function workshop_get_ungraded_assessments_student($workshop) {
 
     // make sure it works on the site course
     $select = "u.course = '$workshop->course' AND";
-    $site = get_site();
-    if ($workshop->course == $site->id) {
+    if ($workshop->course == SITEID) {
         $select = '';
     }
 
@@ -668,8 +664,7 @@ function workshop_get_users_done($workshop) {
 
     // make sure it works on the site course
     $select = "s.course = '$workshop->course' AND";
-    $site = get_site();
-    if ($workshop->course == $site->id) {
+    if ($workshop->course == SITEID) {
         $select = '';
     }
 
index 037e3b2dedc2ddf40a79e963acbc95cc67223db7..7f7d2ebd9c5217b1aa7b2356f627cd568646b4d5 100644 (file)
@@ -68,8 +68,7 @@
     $guest = get_guest();
     $exceptions .= $guest->id;
     
-    $site = get_site();
-    if ($course->id == $site->id) { // Show all site users (even unconfirmed)
+    if ($course->id == SITEID) { // Show all site users (even unconfirmed)
         $students = get_users(true, '', true, $exceptions, $sort.' '.$dir, $firstinitial, $lastinitial, $page*$perpage, $perpage);
         $totalcount = get_users(false, '', true, '', '', '', '') - 1; // -1 to not count guest user
         if ($firstinitial or $lastinitial) {