Index: trunk/services/admins.php
===================================================================
--- trunk/services/admins.php	(revision 124)
+++ trunk/services/admins.php	(revision 136)
@@ -8,8 +8,8 @@
 
 $auth->requireLogin();
-App::sslOn();
+$app->sslOn();
 
 require_once 'codebase/lib/PageNumbers.inc.php';
-require_once 'codebase/lib/SessionCache.inc.php';
+require_once 'codebase/lib/Cache.inc.php';
 require_once 'codebase/lib/FormValidator.inc.php';
 require_once 'codebase/lib/SortOrder.inc.php';
@@ -29,4 +29,6 @@
 // The object to validate form input.
 $fv = new FormValidator();
+
+$cache =& Cache::getInstance();
 
 // Instantiate a sorting object with the default sort and order. Add SQL for each column.
@@ -54,5 +56,5 @@
 
 // Search limiters retain their values between page requests.
-App::carryQuery('search_query');
+$app->carryQuery('search_query');
 
 
@@ -64,10 +66,10 @@
 // allows us to remember which page we came from so we can go back there.
 if (getFormData('boomerang', false) && isset($_SERVER['HTTP_REFERER'])) {
-    App::setBoomerangURL($_SERVER['HTTP_REFERER'], 'admins');
+    $app->setBoomerangURL($_SERVER['HTTP_REFERER'], 'admins');
 }
 
 if (getFormData('break_list_cache', false)) {
     // Break the cache because we are changing the list data.
-    SessionCache::breakCache($_SERVER['PHP_SELF']);
+    $cache->delete($_SERVER['PHP_SELF']);
 }
 
@@ -91,20 +93,20 @@
 case 'del' :
     deleteRecord(getFormData('admin_id'));
-    if (App::validBoomerangURL('admins')) {
+    if ($app->validBoomerangURL('admins')) {
         // Display boomerang page.
-        App::dieBoomerangURL('admins');
+        $app->dieBoomerangURL('admins');
     }
     // Display default page.
-    App::dieURL($_SERVER['PHP_SELF']);
+    $app->dieURL($_SERVER['PHP_SELF']);
     break;
 
 case 'insert' :
     if (getFormdata('cancel', false)) {
-        if (App::validBoomerangURL('admins')) {
+        if ($app->validBoomerangURL('admins')) {
             // Display boomerang page.
-            App::dieBoomerangURL('admins');
+            $app->dieBoomerangURL('admins');
         }
         // Display default page.
-        App::dieURL($_SERVER['PHP_SELF']);
+        $app->dieURL($_SERVER['PHP_SELF']);
     }
     validateInput();
@@ -118,11 +120,11 @@
         if (getFormdata('repeat', false)) {
             // Display function again.
-            App::dieURL($_SERVER['PHP_SELF'] . '?op=add');
-        } else if (App::validBoomerangURL('admins')) {
+            $app->dieURL($_SERVER['PHP_SELF'] . '?op=add');
+        } else if ($app->validBoomerangURL('admins')) {
             // Display boomerang page.
-            App::dieBoomerangURL('admins');
+            $app->dieBoomerangURL('admins');
         }
         // Display default page.
-        App::dieURL($_SERVER['PHP_SELF']);
+        $app->dieURL($_SERVER['PHP_SELF']);
     }
     break;
@@ -130,6 +132,6 @@
 case 'update' :
     if (getFormdata('reset', false)) {
-        App::raiseMsg(_("Saved values have been reloaded."), MSG_NOTICE, __FILE__, __LINE__);
-        App::dieURL($_SERVER['PHP_SELF'] . '?op=edit&admin_id=' . getFormData('admin_id'));
+        $app->raiseMsg(_("Saved values have been reloaded."), MSG_NOTICE, __FILE__, __LINE__);
+        $app->dieURL($_SERVER['PHP_SELF'] . '?op=edit&admin_id=' . getFormData('admin_id'));
     }
     if (getFormdata('cancel', false)) {
@@ -137,10 +139,10 @@
         $lock->select('admin_tbl', 'admin_id', getFormData('admin_id'));
         $lock->remove();
-        if (App::validBoomerangURL('admins')) {
+        if ($app->validBoomerangURL('admins')) {
             // Display boomerang page.
-            App::dieBoomerangURL('admins');
+            $app->dieBoomerangURL('admins');
         }
         // Display default page.
-        App::dieURL($_SERVER['PHP_SELF']);
+        $app->dieURL($_SERVER['PHP_SELF']);
     }
     validateInput();
@@ -154,16 +156,16 @@
         if (getFormdata('repeat', false)) {
             // Display edit function with next available ID.
-            $qid = DB::query("SELECT admin_id FROM admin_tbl WHERE admin_id > '" . DB::escapeString(getFormData('admin_id')) . "' ORDER BY admin_id ASC LIMIT 1");
+            $qid = $db->query("SELECT admin_id FROM admin_tbl WHERE admin_id > '" . $db->escapeString(getFormData('admin_id')) . "' ORDER BY admin_id ASC LIMIT 1");
             if (list($next_id) = mysql_fetch_row($qid)) {
-                App::dieURL($_SERVER['PHP_SELF'] . '?op=edit&admin_id=' . $next_id);
+                $app->dieURL($_SERVER['PHP_SELF'] . '?op=edit&admin_id=' . $next_id);
             } else {
-                App::raiseMsg(_("Cannot edit next, the end of the list was reached"), MSG_NOTICE, __FILE__, __LINE__);
+                $app->raiseMsg(_("Cannot edit next, the end of the list was reached"), MSG_NOTICE, __FILE__, __LINE__);
             }
-        } else if (App::validBoomerangURL('admins')) {
+        } else if ($app->validBoomerangURL('admins')) {
             // Display boomerang page.
-            App::dieBoomerangURL('admins');
+            $app->dieBoomerangURL('admins');
         }
         // Display default page.
-        App::dieURL($_SERVER['PHP_SELF']);
+        $app->dieURL($_SERVER['PHP_SELF']);
     }
     break;
@@ -258,5 +260,7 @@
 {
     global $lock;
-
+	$app =& App::getInstance();
+	$db =& DB::getInstance();
+	
     $lock->select('admin_tbl', 'admin_id', $id);
     if ($lock->isLocked() && !$lock->isMine()) {
@@ -265,13 +269,13 @@
 
     // Get the information for the form.
-    $qid = DB::query("
+    $qid = $db->query("
         SELECT *
         FROM admin_tbl
-        WHERE admin_id = '" . DB::escapeString($id) . "'
+        WHERE admin_id = '" . $db->escapeString($id) . "'
     ");
     if (!$frm = mysql_fetch_assoc($qid)) {
-        App::logMsg('Could not find record with admin_id: ' . $id, LOG_WARNING, __FILE__, __LINE__);
-        App::raiseMsg(sprintf(_("The requested record %s could not be found."), $id), MSG_ERR, __FILE__, __LINE__);
-        App::dieBoomerangURL();
+        $app->logMsg('Could not find record with admin_id: ' . $id, LOG_WARNING, __FILE__, __LINE__);
+        $app->raiseMsg(sprintf(_("The requested record %s could not be found."), $id), MSG_ERR, __FILE__, __LINE__);
+        $app->dieBoomerangURL();
     }
 
@@ -313,5 +317,8 @@
 {
     global $auth, $lock;
-
+	$app =& App::getInstance();
+	$db =& DB::getInstance();
+	$cache =& Cache::getInstance();
+	
     $lock->select('admin_tbl', 'admin_id', $id);
     if ($lock->isLocked() && !$lock->isMine()) {
@@ -320,33 +327,33 @@
 
     // Break the cache because we are changing the list data.
-    SessionCache::breakCache($_SERVER['PHP_SELF']);
+    $cache->delete($_SERVER['PHP_SELF']);
 
     // Get the information for this object.
-    $qid = DB::query("
+    $qid = $db->query("
         SELECT username, user_type from admin_tbl
-        WHERE admin_id = '" . DB::escapeString($id) . "'
+        WHERE admin_id = '" . $db->escapeString($id) . "'
     ");
     if (! list($name, $user_type) = mysql_fetch_row($qid)) {
-        App::logMsg('Could not find record with admin_id: ' . $id, LOG_WARNING, __FILE__, __LINE__);
-        App::raiseMsg(sprintf(_("The requested record %s could not be found."), $id), MSG_ERR, __FILE__, __LINE__);
-        App::dieBoomerangURL();
+        $app->logMsg('Could not find record with admin_id: ' . $id, LOG_WARNING, __FILE__, __LINE__);
+        $app->raiseMsg(sprintf(_("The requested record %s could not be found."), $id), MSG_ERR, __FILE__, __LINE__);
+        $app->dieBoomerangURL();
     }
 
     // Get the information for this object.
-    $qid = DB::query("SELECT COUNT(*) from admin_tbl");
+    $qid = $db->query("SELECT COUNT(*) from admin_tbl");
     list($num_admins) = mysql_fetch_row($qid);
     if ('root' == $user_type && 'root' != $auth->getVal('user_type')) {
         // Only root users can delete root users!
-        App::raiseMsg(_("You do not have clearance to delete a root administrator."), MSG_NOTICE, __FILE__, __LINE__);
+        $app->raiseMsg(_("You do not have clearance to delete a root administrator."), MSG_NOTICE, __FILE__, __LINE__);
     } else if ($num_admins <= 1) {
         // There must always be at least one admnistrator!
-        App::raiseMsg(_("You cannot delete the only administrator in the database. There must be at least one to log in and create other users."), MSG_NOTICE, __FILE__, __LINE__);
+        $app->raiseMsg(_("You cannot delete the only administrator in the database. There must be at least one to log in and create other users."), MSG_NOTICE, __FILE__, __LINE__);
     } else if ($auth->getVal('user_id') == $id) {
         // Do not delete yourself!
-        App::raiseMsg(_("You cannot delete yourself."), MSG_NOTICE, __FILE__, __LINE__);
+        $app->raiseMsg(_("You cannot delete yourself."), MSG_NOTICE, __FILE__, __LINE__);
     } else {
         // Delete the record.
-        DB::query("DELETE FROM admin_tbl WHERE admin_id = '" . DB::escapeString($id) . "'");
-        App::raiseMsg(sprintf(_("The admin <strong>%s</strong> has been deleted."), $name), MSG_SUCCESS, __FILE__, __LINE__);
+        $db->query("DELETE FROM admin_tbl WHERE admin_id = '" . $db->escapeString($id) . "'");
+        $app->raiseMsg(sprintf(_("The admin <strong>%s</strong> has been deleted."), $name), MSG_SUCCESS, __FILE__, __LINE__);
     }
 
@@ -358,10 +365,13 @@
 {
     global $auth;
-
+	$app =& App::getInstance();
+	$db =& DB::getInstance();
+	$cache =& Cache::getInstance();
+	
     // Break the cache because we are changing the list data.
-    SessionCache::breakCache($_SERVER['PHP_SELF']);
+    $cache->delete($_SERVER['PHP_SELF']);
 
     // Insert record data.
-    DB::query("
+    $db->query("
         INSERT INTO admin_tbl (
             username,
@@ -373,14 +383,14 @@
             added_datetime
         ) VALUES (
-            '" . DB::escapeString($frm['username']) . "',
-            '" . DB::escapeString($frm['first_name']) . "',
-            '" . DB::escapeString($frm['last_name']) . "',
-            '" . DB::escapeString($frm['email']) . "',
-            '" . DB::escapeString($frm['user_type']) . "',
-            '" . DB::escapeString($auth->getVal('user_id')) . "',
+            '" . $db->escapeString($frm['username']) . "',
+            '" . $db->escapeString($frm['first_name']) . "',
+            '" . $db->escapeString($frm['last_name']) . "',
+            '" . $db->escapeString($frm['email']) . "',
+            '" . $db->escapeString($frm['user_type']) . "',
+            '" . $db->escapeString($auth->getVal('user_id')) . "',
             NOW()
         )
     ");
-    $last_insert_id = mysql_insert_id(DB::getDBH());
+    $last_insert_id = mysql_insert_id($db->getDBH());
 
     // Set admin password.
@@ -391,5 +401,5 @@
     $version->create('admin_tbl', 'admin_id', $last_insert_id, $frm['username']);
 
-    App::raiseMsg(sprintf(_("The Admin <strong>%s</strong> has been added."), $frm['username']), MSG_SUCCESS, __FILE__, __LINE__);
+    $app->raiseMsg(sprintf(_("The Admin <strong>%s</strong> has been added."), $frm['username']), MSG_SUCCESS, __FILE__, __LINE__);
 
     return $last_insert_id;
@@ -399,5 +409,8 @@
 {
     global $auth, $lock;
-
+	$app =& App::getInstance();
+	$db =& DB::getInstance();
+	$cache =& Cache::getInstance();
+	
     $lock->select('admin_tbl', 'admin_id', $frm['admin_id']);
     if ($lock->isLocked() && !$lock->isMine()) {
@@ -406,5 +419,5 @@
 
     // Break the cache because we are changing the list data.
-    SessionCache::breakCache($_SERVER['PHP_SELF']);
+    $cache->delete($_SERVER['PHP_SELF']);
 
     // If the userpass is left blank or with the filler **** characters, we don't want to update it.
@@ -415,14 +428,14 @@
 
     // Update record data.
-    DB::query("
+    $db->query("
         UPDATE admin_tbl SET
-            username = '" . DB::escapeString($frm['username']) . "',
-            first_name = '" . DB::escapeString($frm['first_name']) . "',
-            last_name = '" . DB::escapeString($frm['last_name']) . "',
-            email = '" . DB::escapeString($frm['email']) . "',
-            user_type = '" . DB::escapeString($frm['user_type']) . "',
-            modified_by_user_id = '" . DB::escapeString($auth->getVal('user_id')) . "',
+            username = '" . $db->escapeString($frm['username']) . "',
+            first_name = '" . $db->escapeString($frm['first_name']) . "',
+            last_name = '" . $db->escapeString($frm['last_name']) . "',
+            email = '" . $db->escapeString($frm['email']) . "',
+            user_type = '" . $db->escapeString($frm['user_type']) . "',
+            modified_by_user_id = '" . $db->escapeString($auth->getVal('user_id')) . "',
             modified_datetime = NOW()
-        WHERE admin_id = '" . DB::escapeString($frm['admin_id']) . "'
+        WHERE admin_id = '" . $db->escapeString($frm['admin_id']) . "'
     ");
 
@@ -431,5 +444,5 @@
     $version->create('admin_tbl', 'admin_id', $frm['admin_id'], $frm['username']);
 
-    App::raiseMsg(sprintf(_("The Admin <strong>%s</strong> has been updated."), $frm['username']), MSG_SUCCESS, __FILE__, __LINE__);
+    $app->raiseMsg(sprintf(_("The Admin <strong>%s</strong> has been updated."), $frm['username']), MSG_SUCCESS, __FILE__, __LINE__);
 
     // Unlock record.
@@ -441,5 +454,8 @@
     global $page;
     global $so;
-
+	$db =& DB::getInstance();
+	$prefs =& Prefs::getInstance();
+	$cache =& Cache::getInstance();
+	
     $where_clause = '';
 
@@ -450,8 +466,8 @@
             $where_clause .= (empty($where_clause) ? 'WHERE' : 'AND') . "
                 (
-                    admin_tbl.username LIKE '%" . DB::escapeString($qry_words[$i]) . "%'
-                    OR admin_tbl.first_name LIKE '%" . DB::escapeString($qry_words[$i]) . "%'
-                    OR admin_tbl.last_name LIKE '%" . DB::escapeString($qry_words[$i]) . "%'
-                    OR admin_tbl.email LIKE '%" . DB::escapeString($qry_words[$i]) . "%'
+                    admin_tbl.username LIKE '%" . $db->escapeString($qry_words[$i]) . "%'
+                    OR admin_tbl.first_name LIKE '%" . $db->escapeString($qry_words[$i]) . "%'
+                    OR admin_tbl.last_name LIKE '%" . $db->escapeString($qry_words[$i]) . "%'
+                    OR admin_tbl.email LIKE '%" . $db->escapeString($qry_words[$i]) . "%'
                 )
             ";
@@ -460,5 +476,5 @@
 
     // Count the total number of records so we can do something about the page numbers.
-    $qid = DB::query("
+    $qid = $db->query("
         SELECT COUNT(*)
         FROM admin_tbl
@@ -491,15 +507,15 @@
     // without knowing the hash.
     $cache_hash = md5($sql . '|' . $page->total_items);
-    if (Prefs::getValue('cache_hash', $_SERVER['PHP_SELF']) != $cache_hash) {
-        SessionCache::breakCache($_SERVER['PHP_SELF']);
-        Prefs::setValue('cache_hash', $cache_hash, $_SERVER['PHP_SELF']);
-    }
-
-    if (SessionCache::isCached($_SERVER['PHP_SELF']) && false) {
+    if ($prefs->get('cache_hash', $_SERVER['PHP_SELF']) != $cache_hash) {
+        $cache->delete($_SERVER['PHP_SELF']);
+        $prefs->set('cache_hash', $cache_hash, $_SERVER['PHP_SELF']);
+    }
+
+    if ($cache->exists($_SERVER['PHP_SELF']) && false) {
         // Get the cached results.
-        $list = SessionCache::getCache($_SERVER['PHP_SELF']);
+        $list = $cache->get($_SERVER['PHP_SELF']);
     } else {
         // If the list is not already cached, query now.
-        $qid = DB::query($sql);
+        $qid = $db->query($sql);
         // Fill an array with the items for this page.
         while ($row = mysql_fetch_assoc($qid)) {
@@ -509,5 +525,5 @@
         if (isset($list) && !empty($list)) {
             // Cache the results.
-            SessionCache::putCache($list, $_SERVER['PHP_SELF']);
+            $cache->set($list, $_SERVER['PHP_SELF']);
         }
     }
Index: trunk/services/lock.php
===================================================================
--- trunk/services/lock.php	(revision 124)
+++ trunk/services/lock.php	(revision 136)
@@ -9,12 +9,12 @@
 
 $auth->requireLogin();
-App::sslOn();
+$app->sslOn();
 
 if (getFormData('boomerang', false)) {
     // We remember which page we came from so we can go back there.
     $boom_url = strpos(getFormData('boomerang'), '/') !== false ? getFormData('boomerang') : $_SERVER['HTTP_REFERER'];
-    App::setBoomerangURL($boom_url, 'lock');
+    $app->setBoomerangURL($boom_url, 'lock');
     if (isset($_SERVER['HTTP_REFERER'])) {
-        App::setBoomerangURL($_SERVER['HTTP_REFERER'], 'cancel-lock');
+        $app->setBoomerangURL($_SERVER['HTTP_REFERER'], 'cancel-lock');
     }
 }
@@ -26,6 +26,6 @@
 
 if (!$lock->isLocked()) {
-    App::logMsg('Lock not found with lock_id: ' . getFormData('lock_id') . ', from referrer: ' . $_SERVER['HTTP_REFERER'], LOG_WARNING, __FILE__, __LINE__);
-    App::dieBoomerangURL('lock');
+    $app->logMsg('Lock not found with lock_id: ' . getFormData('lock_id') . ', from referrer: ' . $_SERVER['HTTP_REFERER'], LOG_WARNING, __FILE__, __LINE__);
+    $app->dieBoomerangURL('lock');
 }
 
@@ -33,10 +33,10 @@
 if (getFormData('unlock', false)) {
     $lock->remove();
-    App::raiseMsg(sprintf(_("The record <strong>%s</strong> has been unlocked, and can now be modified."), $lock->getTitle('title')), MSG_NOTICE, __FILE__, __LINE__);
-    App::dieBoomerangURL('lock');
+    $app->raiseMsg(sprintf(_("The record <strong>%s</strong> has been unlocked, and can now be modified."), $lock->getTitle('title')), MSG_NOTICE, __FILE__, __LINE__);
+    $app->dieBoomerangURL('lock');
 } else if (getFormData('cancel', false)) {
     // Since the boomerang URL will go back to the locked record, and the record was not unlocked, we must delete the boomerang URL otherwise we'll come back here.
-    App::deleteBoomerangURL('lock');
-    App::dieBoomerangURL('cancel-lock');
+    $app->deleteBoomerangURL('lock');
+    $app->dieBoomerangURL('cancel-lock');
 }
 
Index: trunk/services/login.php
===================================================================
--- trunk/services/login.php	(revision 124)
+++ trunk/services/login.php	(revision 136)
@@ -8,7 +8,7 @@
 // allows us to remember which page we came from so we can go back there.
 if (getFormData('boomerang', false) && isset($_SERVER['HTTP_REFERER'])) {
-    App::setBoomerangURL($_SERVER['HTTP_REFERER'], 'login');
+    $app->setBoomerangURL($_SERVER['HTTP_REFERER'], 'login');
 }
-App::sslOn();
+$app->sslOn();
 
 $frm['username'] = getFormdata('username');
@@ -19,10 +19,10 @@
 
     if ($auth->login($frm['username'], $frm['password'])) {
-        App::raiseMsg(_("You are now logged in."), MSG_SUCCESS, __FILE__, __LINE__);
-        App::dieBoomerangURL('login');
-        App::logMsg(sprintf('%s %s successfully logged-in.', $auth->getVal('auth_name'), $frm['username']), LOG_INFO, __FILE__, __LINE__);
+        $app->raiseMsg(_("You are now logged in."), MSG_SUCCESS, __FILE__, __LINE__);
+        $app->dieBoomerangURL('login');
+        $app->logMsg(sprintf('%s %s successfully logged-in.', $auth->getVal('auth_name'), $frm['username']), LOG_INFO, __FILE__, __LINE__);
     } else {
-        App::raiseMsg(_("Login failed, please try again."), MSG_NOTICE, __FILE__, __LINE__);
-        App::logMsg(sprintf('%s %s failed login using (MD5ed) password: %s', ucfirst($auth->getVal('auth_name')), $frm['username'], md5($frm['password'])), LOG_NOTICE, __FILE__, __LINE__);
+        $app->raiseMsg(_("Login failed, please try again."), MSG_NOTICE, __FILE__, __LINE__);
+        $app->logMsg(sprintf('%s %s failed login using (MD5ed) password: %s', ucfirst($auth->getVal('auth_name')), $frm['username'], md5($frm['password'])), LOG_NOTICE, __FILE__, __LINE__);
     }
 }
Index: trunk/services/logout.php
===================================================================
--- trunk/services/logout.php	(revision 124)
+++ trunk/services/logout.php	(revision 136)
@@ -5,5 +5,5 @@
  */
 
-if (is_a($auth, 'Auth_SQL')) {
+if (isset($auth) && method_exists($auth, 'getVal')) {
     // Delete the current user's record locks.
     require_once 'codebase/lib/RecordLock.inc.php';
@@ -15,6 +15,6 @@
 $auth->clearAuth();
 
-App::raiseMsg(sprintf(_("Your session has been logged-out."), null), MSG_SUCCESS, __FILE__, __LINE__);
-App::dieURL(App::getParam('redirect_home_url'));
+$app->raiseMsg(sprintf(_("Your session has been logged-out."), null), MSG_SUCCESS, __FILE__, __LINE__);
+$app->dieURL($app->getParam('redirect_home_url'));
 
 ?>
Index: trunk/services/logs.php
===================================================================
--- trunk/services/logs.php	(revision 124)
+++ trunk/services/logs.php	(revision 136)
@@ -9,5 +9,5 @@
 $auth->requireLogin();
 // $auth->requireAccessClearance(ZONE_ADMIN_APPLOG);
-App::sslOn();
+$app->sslOn();
 
 require_once 'codebase/lib/PageNumbers.inc.php';
@@ -39,9 +39,10 @@
 
 // Set the defaults and catch incoming settings.
-Prefs::setDefault('log_file', App::getParam('log_filename'), 'logs_module');
-Prefs::setValue('log_file', getFormData('log'), 'logs_module');
+$prefs =& Prefs::getInstance();
+$prefs->setDefault('log_file', $app->getParam('log_filename'), 'logs_module');
+$prefs->set('log_file', getFormData('log'), 'logs_module');
 
 // Titles and navigation header.
-$nav->addPage(sprintf(_("Viewing log: <em>%s</em>"), Prefs::getValue('log_file', 'logs_module')), '/admin/logs.php');
+$nav->addPage(sprintf(_("Viewing log: <em>%s</em>"), $prefs->get('log_file', 'logs_module')), '/admin/logs.php');
 
 /******************************************************************************
@@ -56,37 +57,37 @@
 case 'delete' :
 //     $auth->requireAccessClearance(ZONE_ADMIN_APPLOG_FUNC_RESET);
-    deleteLog(Prefs::getValue('log_file', 'logs_module'));
-    Prefs::setValue('log_file', App::getParam('log_filename'), 'logs_module');
-    if (App::validBoomerangURL('app_log')) {
+    deleteLog($prefs->get('log_file', 'logs_module'));
+    $prefs->set('log_file', $app->getParam('log_filename'), 'logs_module');
+    if ($app->validBoomerangURL('app_log')) {
         // Display boomerang page.
-        App::dieBoomerangURL('app_log');
+        $app->dieBoomerangURL('app_log');
     }
     // Display default page.
-    App::dieURL($_SERVER['PHP_SELF']);
+    $app->dieURL($_SERVER['PHP_SELF']);
     break;
 
 case 'clear' :
 //     $auth->requireAccessClearance(ZONE_ADMIN_APPLOG_FUNC_RESET);
-    clearLog(Prefs::getValue('log_file', 'logs_module'));
-    if (App::validBoomerangURL('app_log')) {
+    clearLog($prefs->get('log_file', 'logs_module'));
+    if ($app->validBoomerangURL('app_log')) {
         // Display boomerang page.
-        App::dieBoomerangURL('app_log');
+        $app->dieBoomerangURL('app_log');
     }
     // Display default page.
-    App::dieURL($_SERVER['PHP_SELF']);
+    $app->dieURL($_SERVER['PHP_SELF']);
     break;
 
 case 'archive' :
 //     $auth->requireAccessClearance(ZONE_ADMIN_APPLOG_FUNC_RESET);
-    if (archiveLog(Prefs::getValue('log_file', 'logs_module'))) {
+    if (archiveLog($prefs->get('log_file', 'logs_module'))) {
         // Now flush current log.
-        App::dieURL($_SERVER['PHP_SELF'] . '?op=clear');
-    }
-    if (App::validBoomerangURL('app_log')) {
+        $app->dieURL($_SERVER['PHP_SELF'] . '?op=clear');
+    }
+    if ($app->validBoomerangURL('app_log')) {
         // Display boomerang page.
-        App::dieBoomerangURL('app_log');
+        $app->dieBoomerangURL('app_log');
     }
     // Display default page.
-    App::dieURL($_SERVER['PHP_SELF']);
+    $app->dieURL($_SERVER['PHP_SELF']);
     break;
 
@@ -97,11 +98,11 @@
 case 'download' :
     header('Content-Type: application/octet-stream');
-    header(sprintf('Content-Disposition: attachment; filename=%s.txt', Prefs::getValue('log_file', 'logs_module')));
-    printLog(Prefs::getValue('log_file', 'logs_module'));
+    header(sprintf('Content-Disposition: attachment; filename=%s.txt', $prefs->get('log_file', 'logs_module')));
+    printLog($prefs->get('log_file', 'logs_module'));
     die;
     break;
 
 default :
-    $list =& getLog(Prefs::getValue('log_file', 'logs_module'), getFormData('search_query'));
+    $list =& getLog($prefs->get('log_file', 'logs_module'), getFormData('search_query'));
     $main_template = 'log_list.ihtml';
     break;
@@ -125,5 +126,5 @@
 include 'header.ihtml';
 if ('output' == $main_template) {
-    printLog(Prefs::getValue('log_file', 'logs_module'));
+    printLog($prefs->get('log_file', 'logs_module'));
 } else {
     include 'codebase/services/templates/' . $main_template;
@@ -138,23 +139,25 @@
 function deleteLog($log_file)
 {
-    if (!file_exists(App::getParam('log_directory') . '/' . $log_file)) {
-        App::raiseMsg(sprintf(_("Log file %s does not exist."), $log_file), MSG_NOTICE, __FILE__, __LINE__);
-        App::logMsg(sprintf('Cannot delete nonexistent log file %s', App::getParam('log_directory') . '/' . $log_file), LOG_INFO, __FILE__, __LINE__);
-        return false;
-    }
-
-    if (!is_writable(App::getParam('log_directory') . '/' . $log_file) && !is_writable(App::getParam('log_directory'))) {
-        App::raiseMsg(sprintf(_("Log file %s could not be deleted."), $log_file), MSG_NOTICE, __FILE__, __LINE__);
-        App::logMsg(sprintf('Cannot delete log file %s, not writable.', App::getParam('log_directory') . '/' . $log_file), LOG_INFO, __FILE__, __LINE__);
-        return false;
-    }
-
-    if (unlink(App::getParam('log_directory') . '/' . $log_file)) {
-        App::raiseMsg(sprintf(_("Log file %s has been deleted."), $log_file), MSG_NOTICE, __FILE__, __LINE__);
-        App::logMsg(sprintf('Log file %s has been deleted', $log_file), LOG_INFO, __FILE__, __LINE__);
+	$app =& App::getInstance();
+
+    if (!file_exists($app->getParam('log_directory') . '/' . $log_file)) {
+        $app->raiseMsg(sprintf(_("Log file %s does not exist."), $log_file), MSG_NOTICE, __FILE__, __LINE__);
+        $app->logMsg(sprintf('Cannot delete nonexistent log file %s', $app->getParam('log_directory') . '/' . $log_file), LOG_INFO, __FILE__, __LINE__);
+        return false;
+    }
+
+    if (!is_writable($app->getParam('log_directory') . '/' . $log_file) && !is_writable($app->getParam('log_directory'))) {
+        $app->raiseMsg(sprintf(_("Log file %s could not be deleted."), $log_file), MSG_NOTICE, __FILE__, __LINE__);
+        $app->logMsg(sprintf('Cannot delete log file %s, not writable.', $app->getParam('log_directory') . '/' . $log_file), LOG_INFO, __FILE__, __LINE__);
+        return false;
+    }
+
+    if (unlink($app->getParam('log_directory') . '/' . $log_file)) {
+        $app->raiseMsg(sprintf(_("Log file %s has been deleted."), $log_file), MSG_NOTICE, __FILE__, __LINE__);
+        $app->logMsg(sprintf('Log file %s has been deleted', $log_file), LOG_INFO, __FILE__, __LINE__);
         return true;
     } else {
-        App::raiseMsg(sprintf(_("Log file %s could not be deleted."), $log_file), MSG_WARNING, __FILE__, __LINE__);
-        App::logMsg(sprintf('unlink failed on log file %s', App::getParam('log_directory') . '/' . $log_file), LOG_WARNING, __FILE__, __LINE__);
+        $app->raiseMsg(sprintf(_("Log file %s could not be deleted."), $log_file), MSG_WARNING, __FILE__, __LINE__);
+        $app->logMsg(sprintf('unlink failed on log file %s', $app->getParam('log_directory') . '/' . $log_file), LOG_WARNING, __FILE__, __LINE__);
         return false;
     }
@@ -163,7 +166,9 @@
 function clearLog($log_file)
 {
-    if (!$fp = fopen(App::getParam('log_directory') . '/' . $log_file, 'r+')) {
-        App::raiseMsg(sprintf(_("Log file %s could not be opened."), $log_file), MSG_NOTICE, __FILE__, __LINE__);
-        App::logMsg(sprintf('fopen failed on log file %s', App::getParam('log_directory') . '/' . $log_file), LOG_INFO, __FILE__, __LINE__);
+	$app =& App::getInstance();
+
+    if (!$fp = fopen($app->getParam('log_directory') . '/' . $log_file, 'r+')) {
+        $app->raiseMsg(sprintf(_("Log file %s could not be opened."), $log_file), MSG_NOTICE, __FILE__, __LINE__);
+        $app->logMsg(sprintf('fopen failed on log file %s', $app->getParam('log_directory') . '/' . $log_file), LOG_INFO, __FILE__, __LINE__);
         return false;
     }
@@ -174,10 +179,10 @@
     fclose($fp);
     if (!$ftruncate_return) {
-        App::raiseMsg(sprintf(_("Log file %s could not be cleared."), $log_file), MSG_WARNING, __FILE__, __LINE__);
-        App::logMsg(sprintf('ftruncate failed on log file %s', App::getParam('log_directory') . '/' . $log_file), LOG_WARNING, __FILE__, __LINE__);
+        $app->raiseMsg(sprintf(_("Log file %s could not be cleared."), $log_file), MSG_WARNING, __FILE__, __LINE__);
+        $app->logMsg(sprintf('ftruncate failed on log file %s', $app->getParam('log_directory') . '/' . $log_file), LOG_WARNING, __FILE__, __LINE__);
         return false;
     } else {
-        App::raiseMsg(sprintf(_("Log file %s has been cleared."), $log_file), MSG_NOTICE, __FILE__, __LINE__);
-        App::logMsg(sprintf('Log file %s has been cleared', $log_file), LOG_INFO, __FILE__, __LINE__);
+        $app->raiseMsg(sprintf(_("Log file %s has been cleared."), $log_file), MSG_NOTICE, __FILE__, __LINE__);
+        $app->logMsg(sprintf('Log file %s has been cleared', $log_file), LOG_INFO, __FILE__, __LINE__);
         return true;
     }
@@ -186,19 +191,21 @@
 function archiveLog($log_file)
 {
+	$app =& App::getInstance();
+
     $old_file_name = $log_file;
     $new_file_name = $log_file . '__' . date('Y-m-d');
-    If (!is_writable(App::getParam('log_directory') . '')) {
-        App::raiseMsg(sprintf('Cannot archive log, log directory not writable: %s', App::getParam('log_directory')), MSG_WARNING, __FILE__, __LINE__);
-        App::logMsg(sprintf('Cannot archive log, log directory not writable: %s', App::getParam('log_directory')), LOG_WARNING, __FILE__, __LINE__);
-        return false;
-    }
-    If (!copy(App::getParam('log_directory') . '/' . $old_file_name, App::getParam('log_directory') . '/' . $new_file_name)) {
-        App::raiseMsg(sprintf(_("Cannot archive log, copying old log file failed."), null), MSG_WARNING, __FILE__, __LINE__);
-        App::logMsg(sprintf('Cannot archive log, copying old log file failed.', null), LOG_WARNING, __FILE__, __LINE__);
-        return false;
-    }
-
-    App::raiseMsg(sprintf(_("Log file %s has been archived to %s."), $old_file_name, $new_file_name), MSG_NOTICE, __FILE__, __LINE__);
-    App::logMsg(sprintf('Log file %s has been archived to %s.', $old_file_name, $new_file_name), LOG_NOTICE, __FILE__, __LINE__);
+    If (!is_writable($app->getParam('log_directory') . '')) {
+        $app->raiseMsg(sprintf('Cannot archive log, log directory not writable: %s', $app->getParam('log_directory')), MSG_WARNING, __FILE__, __LINE__);
+        $app->logMsg(sprintf('Cannot archive log, log directory not writable: %s', $app->getParam('log_directory')), LOG_WARNING, __FILE__, __LINE__);
+        return false;
+    }
+    If (!copy($app->getParam('log_directory') . '/' . $old_file_name, $app->getParam('log_directory') . '/' . $new_file_name)) {
+        $app->raiseMsg(sprintf(_("Cannot archive log, copying old log file failed."), null), MSG_WARNING, __FILE__, __LINE__);
+        $app->logMsg(sprintf('Cannot archive log, copying old log file failed.', null), LOG_WARNING, __FILE__, __LINE__);
+        return false;
+    }
+
+    $app->raiseMsg(sprintf(_("Log file %s has been archived to %s."), $old_file_name, $new_file_name), MSG_NOTICE, __FILE__, __LINE__);
+    $app->logMsg(sprintf('Log file %s has been archived to %s.', $old_file_name, $new_file_name), LOG_NOTICE, __FILE__, __LINE__);
     return true;
 }
@@ -206,21 +213,25 @@
 function printLog($log_file)
 {
-    if (!is_file(App::getParam('log_directory') . '/' . $log_file)) {
-        App::raiseMsg(sprintf(_("Log file %s not found."), $log_file), MSG_WARNING, __FILE__, __LINE__);
-        App::logMsg(sprintf('Log file %s not found.', App::getParam('log_directory') . '/' . $log_file), LOG_WARNING, __FILE__, __LINE__);
-        return false;
-    }
-
-    readfile(App::getParam('log_directory') . '/' . $log_file);
+	$app =& App::getInstance();
+
+    if (!is_file($app->getParam('log_directory') . '/' . $log_file)) {
+        $app->raiseMsg(sprintf(_("Log file %s not found."), $log_file), MSG_WARNING, __FILE__, __LINE__);
+        $app->logMsg(sprintf('Log file %s not found.', $app->getParam('log_directory') . '/' . $log_file), LOG_WARNING, __FILE__, __LINE__);
+        return false;
+    }
+
+    readfile($app->getParam('log_directory') . '/' . $log_file);
 }
 
 function &getLog($log_file, $search_query='')
 {
-    if (!is_file(App::getParam('log_directory') . '/' . $log_file)) {
-        App::raiseMsg(sprintf(_("Log file %s not found."), $log_file), MSG_WARNING, __FILE__, __LINE__);
-        App::logMsg(sprintf('Log file %s not found.', App::getParam('log_directory') . '/' . $log_file), LOG_WARNING, __FILE__, __LINE__);
-        return false;
-    }
-    $log = file(App::getParam('log_directory') . '/' . $log_file);
+	$app =& App::getInstance();
+
+    if (!is_file($app->getParam('log_directory') . '/' . $log_file)) {
+        $app->raiseMsg(sprintf(_("Log file %s not found."), $log_file), MSG_WARNING, __FILE__, __LINE__);
+        $app->logMsg(sprintf('Log file %s not found.', $app->getParam('log_directory') . '/' . $log_file), LOG_WARNING, __FILE__, __LINE__);
+        return false;
+    }
+    $log = file($app->getParam('log_directory') . '/' . $log_file);
 
     if ('' != trim($search_query)) {
@@ -237,14 +248,15 @@
 {
     global $valid_file_extensions;
+	$app =& App::getInstance();
 
     // Get a list of all files in the log directory.
-    $dir_handle = opendir(App::getParam('log_directory'));
+    $dir_handle = opendir($app->getParam('log_directory'));
     $list = array();
     while ($dir_handle && ($file = readdir($dir_handle)) !== false) {
-        if (!preg_match('/^\./', $file) && is_file(App::getParam('log_directory') . '/' . $file) && in_array(strtolower(Upload::getFilenameExtension($file)), $valid_file_extensions)) {
+        if (!preg_match('/^\./', $file) && is_file($app->getParam('log_directory') . '/' . $file) && in_array(strtolower(Upload::getFilenameExtension($file)), $valid_file_extensions)) {
             $list[] = array(
                 'filename' => $file,
-                'filesize' => filesize(App::getParam('log_directory') . '/' . $file),
-                'modified' => filemtime(App::getParam('log_directory') . '/' . $file),
+                'filesize' => filesize($app->getParam('log_directory') . '/' . $file),
+                'modified' => filemtime($app->getParam('log_directory') . '/' . $file),
             );
         }
Index: trunk/services/password.php
===================================================================
--- trunk/services/password.php	(revision 124)
+++ trunk/services/password.php	(revision 136)
@@ -27,7 +27,7 @@
 if (getFormData('boomerang', false) && isset($_SERVER['HTTP_REFERER'])) {
     // We remember which page we came from so we can go back there.
-    App::setBoomerangURL($_SERVER['HTTP_REFERER'], 'admin_password');
+    $app->setBoomerangURL($_SERVER['HTTP_REFERER'], 'admin_password');
 }
-App::sslOn();
+$app->sslOn();
 
 switch (getFormData('op')) {
@@ -50,12 +50,12 @@
     if (!$fv->anyErrors() && false === $auth->authenticate($auth->getVal('username'), $frm['oldpassword'])) {
         $fv->addError('oldpassword', _("Your <strong>Old password</strong> failed authentication."));
-        App::logMsg(sprintf(_("Password change failed for %s, using (md5ed) password: %s"), $auth->getVal('username'), md5($frm['oldpassword'])), LOG_NOTICE, __FILE__, __LINE__);
+        $app->logMsg(sprintf(_("Password change failed for %s, using (md5ed) password: %s"), $auth->getVal('username'), md5($frm['oldpassword'])), LOG_NOTICE, __FILE__, __LINE__);
     }
 
     if (!$fv->anyErrors()) {
         $auth->setPassword(null, $frm['newpassword']);
-        App::logMsg(sprintf(_("Password change successful for %s"), $auth->getVal('username')), LOG_INFO, __FILE__, __LINE__);
-        App::raiseMsg(sprintf(_("Password change successful for %s"), $auth->getVal('username')), MSG_SUCCESS, __FILE__, __LINE__);
-        App::dieBoomerangURL('admin_password');
+        $app->logMsg(sprintf(_("Password change successful for %s"), $auth->getVal('username')), LOG_INFO, __FILE__, __LINE__);
+        $app->raiseMsg(sprintf(_("Password change successful for %s"), $auth->getVal('username')), MSG_SUCCESS, __FILE__, __LINE__);
+        $app->dieBoomerangURL('admin_password');
     }
     break;
Index: trunk/services/templates/admin_form.ihtml
===================================================================
--- trunk/services/templates/admin_form.ihtml	(revision 124)
+++ trunk/services/templates/admin_form.ihtml	(revision 136)
@@ -2,5 +2,5 @@
 
 <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
-<?php App::printHiddenSession(); ?>
+<?php $app->printHiddenSession(); ?>
 <input type="hidden" name="op" value="<?php echo $frm['new_op']; ?>" />
 <input type="hidden" name="admin_id" value="<?php echo $frm['admin_id']; ?>" />
Index: trunk/services/templates/admin_list.ihtml
===================================================================
--- trunk/services/templates/admin_list.ihtml	(revision 124)
+++ trunk/services/templates/admin_list.ihtml	(revision 136)
@@ -2,7 +2,7 @@
 <?php $fv->printErrorMessages(); ?>
 <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
-<?php App::printHiddenSession(false); ?>
+<?php $app->printHiddenSession(false); ?>
 <div id="commandbox">
-    <span class="sc-nowrap commandtext"><a href="<?php echo App::oHREF($_SERVER['PHP_SELF'] . '?op=add'); ?>"><?php echo _("Add administrator"); ?></a></span>
+    <span class="sc-nowrap commandtext"><a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?op=add'); ?>"><?php echo _("Add administrator"); ?></a></span>
     <br />
 
@@ -31,6 +31,6 @@
     <?php for ($i = 0; $i <= $page->last_item - $page->first_item && $page->total_items > 0; $i++) { ?>
     <tr>
-        <td class="sc-padleft sc-nowrap"><a title="<?php printf(_("Edit %s"), oTxt($list[$i]['username'])) ?>" href="<?php echo App::oHREF($_SERVER['PHP_SELF'] . '?op=edit&admin_id=' . $list[$i]['admin_id']); ?>"><img src="/admin/_widgets/edit.gif" alt="Edit" width="14" height="18" border="0"></a> &nbsp;</td>
-        <td class="sc-padleft sc-nowrap"><a title="<?php printf(_("Versions of %s"), oTxt($list[$i]['username'])) ?>" href="<?php echo App::oHREF('/admin/versions.php?record_table=admin_tbl&record_key=admin_id&boomerang=true&record_val=' . $list[$i]['admin_id']); ?>"><img src="/admin/_widgets/subcategory.gif" alt="" width="18" height="14" border="0" /></a> &nbsp;</td>
+        <td class="sc-padleft sc-nowrap"><a title="<?php printf(_("Edit %s"), oTxt($list[$i]['username'])) ?>" href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?op=edit&admin_id=' . $list[$i]['admin_id']); ?>"><img src="/admin/_widgets/edit.gif" alt="Edit" width="14" height="18" border="0"></a> &nbsp;</td>
+        <td class="sc-padleft sc-nowrap"><a title="<?php printf(_("Versions of %s"), oTxt($list[$i]['username'])) ?>" href="<?php echo $app->oHREF('/admin/versions.php?record_table=admin_tbl&record_key=admin_id&boomerang=true&record_val=' . $list[$i]['admin_id']); ?>"><img src="/admin/_widgets/subcategory.gif" alt="" width="18" height="14" border="0" /></a> &nbsp;</td>
         <td class="sc-nowrap"><?php echo oTxt($list[$i]['admin_id'], true); ?> &nbsp;</td>
         <td class="sc-nowrap"><?php echo oTxt($list[$i]['username'], true); ?> &nbsp;</td>
@@ -40,14 +40,14 @@
         <td class="sc-nowrap"><?php 
             if ($auth->isLoggedIn($list[$i]['admin_id'])) {
-                ?><strong><?php echo date(App::getParam('date_format'), strtotime($list[$i]['last_login_datetime'])) ?></strong><?php
+                ?><strong><?php echo date($app->getParam('date_format'), strtotime($list[$i]['last_login_datetime'])) ?></strong><?php
             } else {
-                echo '0000-00-00 00:00:00' == $list[$i]['last_login_datetime'] ? '' : date(App::getParam('date_format'), strtotime($list[$i]['last_login_datetime'])); 
+                echo '0000-00-00 00:00:00' == $list[$i]['last_login_datetime'] ? '' : date($app->getParam('date_format'), strtotime($list[$i]['last_login_datetime'])); 
             }
         ?> &nbsp;</td>
         <td class="sc-nowrap"><?php echo gethostbyaddr($list[$i]['last_login_ip']); ?> &nbsp;</td>
-        <td class="sc-nowrap"><?php echo '0000-00-00 00:00:00' == $list[$i]['added_datetime'] ? '' : date(App::getParam('date_format'), strtotime($list[$i]['added_datetime'])); ?> &nbsp;</td>
+        <td class="sc-nowrap"><?php echo '0000-00-00 00:00:00' == $list[$i]['added_datetime'] ? '' : date($app->getParam('date_format'), strtotime($list[$i]['added_datetime'])); ?> &nbsp;</td>
         <td class="sc-nowrap"><?php echo oTxt($list[$i]['added_admin_username'], true); ?> &nbsp;</td>
-        <td class="sc-nowrap"><?php echo '0000-00-00 00:00:00' == $list[$i]['modified_datetime'] ? '' : date(App::getParam('date_format'), strtotime($list[$i]['modified_datetime'])); ?> &nbsp;</td>
-        <td class="sc-padleft sc-nowrap" align="right"><a title="<?php printf(_("Delete %s"), oTxt($list[$i]['username'])) ?>" href="<?php echo App::oHREF($_SERVER['PHP_SELF'] . "?op=del&admin_id=" . $list[$i]['admin_id']); ?>" onClick="javascript:return confirm('<?php printf(_("Are you sure you want to delete the record %s? This action is permanent and cannot be undone."), oTxt($list[$i]['username'])) ?>')"><img src="/admin/_widgets/delete.gif" alt="Delete" width="16" height="17" border="0"></a> &nbsp;</td>
+        <td class="sc-nowrap"><?php echo '0000-00-00 00:00:00' == $list[$i]['modified_datetime'] ? '' : date($app->getParam('date_format'), strtotime($list[$i]['modified_datetime'])); ?> &nbsp;</td>
+        <td class="sc-padleft sc-nowrap" align="right"><a title="<?php printf(_("Delete %s"), oTxt($list[$i]['username'])) ?>" href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . "?op=del&admin_id=" . $list[$i]['admin_id']); ?>" onClick="javascript:return confirm('<?php printf(_("Are you sure you want to delete the record %s? This action is permanent and cannot be undone."), oTxt($list[$i]['username'])) ?>')"><img src="/admin/_widgets/delete.gif" alt="Delete" width="16" height="17" border="0"></a> &nbsp;</td>
     </tr>
     <?php } ?>
Index: trunk/services/templates/list_info.ihtml
===================================================================
--- trunk/services/templates/list_info.ihtml	(revision 124)
+++ trunk/services/templates/list_info.ihtml	(revision 136)
@@ -5,5 +5,5 @@
     <span class="sc-nowrap commanditem commandtext">
         <?php printf(_("Listing <strong>%s-%s</strong> of <strong>%s</strong> results on <strong>%s</strong> pages"), (0==$page->total_items ? 0 : $page->first_item+1), (0==$page->total_items ? 0 : $page->last_item+1), $page->total_items, $page->total_pages) ?>
-        &nbsp;&nbsp; <a href="<?php echo App::oHREF($_SERVER['PHP_SELF'], false); ?>"><?php echo _("List all"); ?></a>
+        &nbsp;&nbsp; <a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'], false); ?>"><?php echo _("List all"); ?></a>
         &nbsp;&nbsp; <?php echo _("Per page"); ?>:&nbsp;<?php $page->printPerPageLinks() ?>
     </span>
Index: trunk/services/templates/lock.ihtml
===================================================================
--- trunk/services/templates/lock.ihtml	(revision 124)
+++ trunk/services/templates/lock.ihtml	(revision 136)
@@ -5,5 +5,5 @@
 ?>
 <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
-    <?php App::printHiddenSession() ?>
+    <?php $app->printHiddenSession() ?>
     <input type="hidden" name="lock_id" value="<?php echo $lock->getID(); ?>" />
 
Index: trunk/services/templates/log_list.ihtml
===================================================================
--- trunk/services/templates/log_list.ihtml	(revision 124)
+++ trunk/services/templates/log_list.ihtml	(revision 136)
@@ -1,4 +1,4 @@
 <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
-<?php App::printHiddenSession(false); ?>
+<?php $app->printHiddenSession(false); ?>
 
 <div id="commandbox">
@@ -10,18 +10,18 @@
         <tr class="commandtext">
             <td>
-                <?php if ($l['filename'] == Prefs::getValue('log_file', 'logs_module')) { ?>
+                <?php if ($l['filename'] == $prefs->get('log_file', 'logs_module')) { ?>
                     <span class="commanditem"><strong><?php echo sprintf(_("%s"), $l['filename']); ?></strong></span>
                 <?php } else { ?>
-                    <span class="commanditem"><a href="<?php echo App::oHREF('/admin/logs.php?log=' . $l['filename']); ?>"><strong><?php echo sprintf(_("%s"), $l['filename']); ?></strong></a></span>
+                    <span class="commanditem"><a href="<?php echo $app->oHREF('/admin/logs.php?log=' . $l['filename']); ?>"><strong><?php echo sprintf(_("%s"), $l['filename']); ?></strong></a></span>
                 <?php } ?>
             </td>
             <td>
-                <span class="commanditem"><em><?php echo sprintf(_("%01.1f KB, last modified %s"), ($l['filesize']/1024), date(App::getParam('date_format'), $l['modified'])); ?></em></span>
+                <span class="commanditem"><em><?php echo sprintf(_("%01.1f KB, last modified %s"), ($l['filesize']/1024), date($app->getParam('date_format'), $l['modified'])); ?></em></span>
             </td>
             <td>
-                <?php if (!preg_match($no_download_files, $l['filename'])) { ?><span class="commanditem"><a href="<?php echo App::oHREF('/admin/logs.php?op=download&log=' . $l['filename']); ?>"><?php echo _("Download"); ?></a></span><?php } ?>
-                <?php if (!preg_match($no_archive_files, $l['filename'])) { ?><span class="commanditem"><a href="<?php echo App::oHREF('/admin/logs.php?op=archive&log=' . $l['filename']); ?>"><?php echo _("Archive"); ?></a></span><?php } ?>
-                <?php if (!preg_match($no_clear_files, $l['filename'])) { ?><span class="commanditem"><a href="<?php echo App::oHREF('/admin/logs.php?op=clear&log=' . $l['filename']); ?>" onClick="javascript:return confirm('<?php printf(_("Are you sure you want to clear the log file %s? This will empty this file of its contents. This action is not reversible."), $l['filename'])?>')"><?php echo _("Clear"); ?></a></span><?php } ?>
-                <?php if (!preg_match($no_delete_files, $l['filename'])) { ?><span class="commanditem"><a href="<?php echo App::oHREF('/admin/logs.php?op=delete&log=' . $l['filename']); ?>" onClick="javascript:return confirm('<?php printf(_("Are you sure you want to delete the log file %s? This will remove this log file permanently. This action is not reversible."), $l['filename'])?>')"><?php echo _("Delete"); ?></a></span><?php } ?>
+                <?php if (!preg_match($no_download_files, $l['filename'])) { ?><span class="commanditem"><a href="<?php echo $app->oHREF('/admin/logs.php?op=download&log=' . $l['filename']); ?>"><?php echo _("Download"); ?></a></span><?php } ?>
+                <?php if (!preg_match($no_archive_files, $l['filename'])) { ?><span class="commanditem"><a href="<?php echo $app->oHREF('/admin/logs.php?op=archive&log=' . $l['filename']); ?>"><?php echo _("Archive"); ?></a></span><?php } ?>
+                <?php if (!preg_match($no_clear_files, $l['filename'])) { ?><span class="commanditem"><a href="<?php echo $app->oHREF('/admin/logs.php?op=clear&log=' . $l['filename']); ?>" onClick="javascript:return confirm('<?php printf(_("Are you sure you want to clear the log file %s? This will empty this file of its contents. This action is not reversible."), $l['filename'])?>')"><?php echo _("Clear"); ?></a></span><?php } ?>
+                <?php if (!preg_match($no_delete_files, $l['filename'])) { ?><span class="commanditem"><a href="<?php echo $app->oHREF('/admin/logs.php?op=delete&log=' . $l['filename']); ?>" onClick="javascript:return confirm('<?php printf(_("Are you sure you want to delete the log file %s? This will remove this log file permanently. This action is not reversible."), $l['filename'])?>')"><?php echo _("Delete"); ?></a></span><?php } ?>
             </td>
         </tr><?php
Index: trunk/services/templates/login_form.ihtml
===================================================================
--- trunk/services/templates/login_form.ihtml	(revision 124)
+++ trunk/services/templates/login_form.ihtml	(revision 136)
@@ -1,4 +1,4 @@
 <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
-<?php App::printHiddenSession() ?>
+<?php $app->printHiddenSession() ?>
 <table>
     <tr>
Index: trunk/services/templates/password.ihtml
===================================================================
--- trunk/services/templates/password.ihtml	(revision 124)
+++ trunk/services/templates/password.ihtml	(revision 136)
@@ -2,5 +2,5 @@
 
 <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
-<?php App::printHiddenSession() ?>
+<?php $app->printHiddenSession() ?>
 <input type="hidden" name="op" value="update_password" />
 <table>
Index: trunk/services/templates/versions_diff.ihtml
===================================================================
--- trunk/services/templates/versions_diff.ihtml	(revision 124)
+++ trunk/services/templates/versions_diff.ihtml	(revision 136)
@@ -1,5 +1,5 @@
 <div id="commandbox">
 <?php if (!getFormData('current', false)) { ?>
-    <span class="sc-nowrap commandtext"><a href="<?php echo App::oHREF($_SERVER['PHP_SELF'] . '?op=restore', array('version_id', 'version_title')); ?>"><?php echo _("Restore this saved version"); ?></a></span>
+    <span class="sc-nowrap commandtext"><a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?op=restore', array('version_id', 'version_title')); ?>"><?php echo _("Restore this saved version"); ?></a></span>
 <?php } else { ?>
     <span class="sc-nowrap commandtext">&nbsp;</span>
Index: trunk/services/templates/versions_list.ihtml
===================================================================
--- trunk/services/templates/versions_list.ihtml	(revision 124)
+++ trunk/services/templates/versions_list.ihtml	(revision 136)
@@ -1,4 +1,4 @@
 <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
-<?php App::printHiddenSession() ?>
+<?php $app->printHiddenSession() ?>
 <input type="submit" name="op" value="<?php echo _("Cancel"); ?>" />
 <table class="list" border="0" cellspacing="0" cellpadding="4">
@@ -14,10 +14,10 @@
 <tr>
     <?php if ($first) { ?>
-    <td class="sc-padleft sc-nowrap">[<a href="<?php echo App::oHREF($_SERVER['PHP_SELF'] . '?op=view&current=true&version_id=' . $v['version_id']); ?>">view</a>]</td>
+    <td class="sc-padleft sc-nowrap">[<a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?op=view&current=true&version_id=' . $v['version_id']); ?>">view</a>]</td>
     <td class="sc-padleft sc-nowrap" colspan="2">(<?php echo _("Current record"); ?>)</td>
     <?php } else { ?>
-    <td class="sc-padleft sc-nowrap">[<a href="<?php echo App::oHREF($_SERVER['PHP_SELF'] . '?op=view&version_id=' . $v['version_id']); ?>">view</a>]</td>
-    <td class="sc-padleft sc-nowrap">[<a href="<?php echo App::oHREF($_SERVER['PHP_SELF'] . '?op=diff&version_id=' . $v['version_id']); ?>">diff</a>]</td>
-    <td class="sc-padleft sc-nowrap">[<a href="<?php echo App::oHREF($_SERVER['PHP_SELF'] . '?op=restore&version_id=' . $v['version_id']); ?>">restore</a>]</td>
+    <td class="sc-padleft sc-nowrap">[<a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?op=view&version_id=' . $v['version_id']); ?>">view</a>]</td>
+    <td class="sc-padleft sc-nowrap">[<a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?op=diff&version_id=' . $v['version_id']); ?>">diff</a>]</td>
+    <td class="sc-padleft sc-nowrap">[<a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?op=restore&version_id=' . $v['version_id']); ?>">restore</a>]</td>
     <?php } ?>
     <td class="sc-padleft sc-nowrap"><?php echo $v['version_id']; ?></td>
Index: trunk/services/templates/versions_view.ihtml
===================================================================
--- trunk/services/templates/versions_view.ihtml	(revision 124)
+++ trunk/services/templates/versions_view.ihtml	(revision 136)
@@ -1,5 +1,5 @@
 <div id="commandbox">
 <?php if (!getFormData('current', false)) { ?>
-    <span class="sc-nowrap commandtext"><a href="<?php echo App::oHREF($_SERVER['PHP_SELF'] . '?op=restore', array('version_id', 'version_title')); ?>"><?php echo _("Restore this saved version"); ?></a></span>
+    <span class="sc-nowrap commandtext"><a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?op=restore', array('version_id', 'version_title')); ?>"><?php echo _("Restore this saved version"); ?></a></span>
 <?php } else { ?>
     <span class="sc-nowrap commandtext">&nbsp;</span>
Index: trunk/services/versions.php
===================================================================
--- trunk/services/versions.php	(revision 124)
+++ trunk/services/versions.php	(revision 136)
@@ -8,5 +8,5 @@
 
 $auth->requireLogin();
-App::sslOn();
+$app->sslOn();
 
 require_once 'codebase/lib/RecordVersion.inc.php';
@@ -20,8 +20,8 @@
 
 // Query arguments to retain their values between page requests.
-App::carryQuery('record_table');
-App::carryQuery('record_key');
-App::carryQuery('record_val');
-App::carryQuery('version_title');
+$app->carryQuery('record_table');
+$app->carryQuery('record_key');
+$app->carryQuery('record_val');
+$app->carryQuery('version_title');
 
 // Titles and navigation header.
@@ -39,12 +39,12 @@
 
 if ('' == $version_id && ('' == $record_table || '' == $record_key || '' == $record_val)) {
-    App::raiseMsg(_("Record not specified for versioning."), MSG_WARNING, __FILE__, __LINE__);
-    App::logMsg('Record not specified for versioning.', LOG_WARNING, __FILE__, __LINE__);
-    App::dieBoomerangURL();
+    $app->raiseMsg(_("Record not specified for versioning."), MSG_WARNING, __FILE__, __LINE__);
+    $app->logMsg('Record not specified for versioning.', LOG_WARNING, __FILE__, __LINE__);
+    $app->dieBoomerangURL();
 }
 
 if (getFormData('boomerang', false) && isset($_SERVER['HTTP_REFERER'])) {
     // We remember which page we came from so we can go back there.
-    App::setBoomerangURL($_SERVER['HTTP_REFERER'], 'versions');
+    $app->setBoomerangURL($_SERVER['HTTP_REFERER'], 'versions');
 }
 
@@ -53,5 +53,5 @@
 
 case _("Cancel") :
-    App::dieBoomerangURL('versions', false);
+    $app->dieBoomerangURL('versions', false);
     break;
 
@@ -68,5 +68,5 @@
     $current = $version->getCurrent($record_table, $record_key, $record_val);
     if (serialize($data) == serialize($current)) {
-        App::raiseMsg(sprintf(_("Version <strong>%s</strong> is identical to the current record"), $version_id), MSG_NOTICE, __FILE__, __LINE__);
+        $app->raiseMsg(sprintf(_("Version <strong>%s</strong> is identical to the current record"), $version_id), MSG_NOTICE, __FILE__, __LINE__);
     }
     $nav->addPage(sprintf(_("Difference between version %s (%s) and current record."), $version_id, $versionrecord['version_datetime']));
@@ -86,9 +86,9 @@
         // Create version of this restored record as the "current" version.
         $version->create($record_table, $record_key, $record_val, $v['version_title']);
-        App::raiseMsg(sprintf(_("The record <strong>%s</strong> has been replaced with <strong>%s</strong> version <strong>%s</strong> from <strong>%s</strong>."), getFormData('version_title'), $v['version_title'], $version_id, $v['version_datetime']), MSG_SUCCESS, __FILE__, __LINE__);
-        App::dieBoomerangURL('versions', array('break_list_cache'=>'true', false));
+        $app->raiseMsg(sprintf(_("The record <strong>%s</strong> has been replaced with <strong>%s</strong> version <strong>%s</strong> from <strong>%s</strong>."), getFormData('version_title'), $v['version_title'], $version_id, $v['version_datetime']), MSG_SUCCESS, __FILE__, __LINE__);
+        $app->dieBoomerangURL('versions', array('break_list_cache'=>'true', false));
     } else {
-        App::raiseMsg(_("Version restoration failed."), MSG_ERR, __FILE__, __LINE__);
-        App::dieURL($_SERVER['PHP_SELF']);
+        $app->raiseMsg(_("Version restoration failed."), MSG_ERR, __FILE__, __LINE__);
+        $app->dieURL($_SERVER['PHP_SELF']);
     }
     break;
@@ -101,6 +101,6 @@
         $main_template = 'versions_list.ihtml';
     } else {
-        App::raiseMsg(sprintf(_("No saved versions available for this record"), null), MSG_NOTICE, __FILE__, __LINE__);
-        App::dieBoomerangURL('versions');
+        $app->raiseMsg(sprintf(_("No saved versions available for this record"), null), MSG_NOTICE, __FILE__, __LINE__);
+        $app->dieBoomerangURL('versions');
     }
 }
