SystemConfiguration.php

Go to the documentation of this file.
00001 <?php
00002 
00003 class SystemConfiguration {
00004 
00005     # ---- PUBLIC INTERFACE --------------------------------------------------
00006 
00007     # object constructor
00008     function SystemConfiguration($DB = NULL)
00009     {
00010         # load current system config info from database
00011         $this->DB = new SPTDatabase();
00012         $this->DB->Query("SELECT * FROM SystemConfiguration");
00013         $Record = $this->DB->FetchRow();
00014         $this->DBFields = $Record;
00015         $this->TopLinkString = stripslashes($Record["TopLinkString"]);
00016         $this->TopLinkBeginLetter = stripslashes($Record["TopLinkBeginLetter"]);
00017         $this->TopLinkEndLetter = stripslashes($Record["TopLinkEndLetter"]);
00018         $this->AdminEmail = stripslashes($Record["AdminEmail"]);
00019         $this->PasswordMailSubject = stripslashes($Record["PasswordMailSubject"]);
00020         $this->PasswordMailBody = stripslashes($Record["PasswordMailBody"]);
00021         $this->PortalName = stripslashes($Record["PortalName"]);
00022         $this->DefaultActiveUI = stripslashes($Record["DefaultActiveUI"]);
00023         $this->CurrentTheme = stripslashes($Record["CurrentTheme"]);
00024         $this->DefaultCharacterSet = stripslashes($Record["DefaultCharacterSet"]);
00025         $this->NumClassesPerBrowsePage = $Record["NumClassesPerBrowsePage"];
00026         $this->NumColumnsPerBrowsePage = $Record["NumColumnsPerBrowsePage"];
00027         $this->BrowsingFieldId = $Record["BrowsingFieldId"];
00028         $this->SearchTermsRequired = $Record["SearchTermsRequired"];
00029         $this->AnnouncementsEnabled = $Record["AnnouncementsEnabled"];
00030         $this->ForumsEnabled = $Record["ForumsEnabled"];
00031         $this->AllowMultipleUIsEnabled = $Record["AllowMultipleUIsEnabled"];
00032         $this->ResourceLaunchesNewWindowEnabled =
00033             $Record["ResourceLaunchesNewWindowEnabled"];
00034         $this->UserAgentsEnabled = $Record["UserAgentsEnabled"];
00035         $this->ResourceRatingsEnabled = $Record["ResourceRatingsEnabled"];
00036         $this->ResourceCommentsEnabled = $Record["ResourceCommentsEnabled"];
00037         $this->AccessibilityWizardEnabled =
00038             $Record["AccessibilityWizardEnabled"];
00039         $this->ReleaseFlagApproved = $Record["ReleaseFlagApproved"];
00040         $this->SearchDBEnabled = $Record["SearchDBEnabled"];
00041         $this->RecommenderDBEnabled = $Record["RecommenderDBEnabled"];
00042         $this->OAISQEnabled = $Record["OAISQEnabled"];
00043         $this->NumAnnounceOnHomePage = $Record["NumAnnounceOnHomePage"];
00044         $this->NumResourcesOnHomePage = $Record["NumResourcesOnHomePage"];
00045         $this->LegalNotice = $Record["LegalNotice"];
00046         $this->OaiIdDomain = $Record["OaiIdDomain"];
00047         $this->OaiIdPrefix = $Record["OaiIdPrefix"];
00048         $this->OaiEarliestDate = $Record["OaiEarliestDate"];
00049         $this->OaiDateGranularity = $Record["OaiDateGranularity"];
00050         $this->SiteKeywords = $Record["SiteKeywords"];
00051         $this->AboutText = $Record["AboutText"];
00052         $this->ContactName = $Record["ContactName"];
00053         $this->ContactEmail = $Record["ContactEmail"];
00054         $this->Organization = $Record["Organization"];
00055         $this->OrganizationType = $Record["OrganizationType"];
00056         $this->SiteType = $Record["SiteType"];
00057         $this->OkayToListSite = $Record["OkayToListSite"];
00058         $this->LastRegisteredOn = $Record["LastRegisteredOn"];
00059         $this->AddAWStatsScript = $Record["AddAWStatsScript"];
00060         $this->AddGoogleAnalytics = $Record["AddGoogleAnalytics"];
00061         $this->GoogleAnalyticsCode = $Record["GoogleAnalyticsCode"];
00062         $this->DisplayLimitsByDefault = $Record["DisplayLimitsByDefault"];
00063 
00064         # load UI configuration info
00065         $this->DB->Query("SELECT * FROM UIStyleConfiguration");
00066         $Record = $this->DB->FetchRow();
00067         $this->LogoFileName = $Record["LogoFileName"];
00068         $this->LogoAltText = $Record["LogoAltText"];
00069         $this->LogoWidth = $Record["LogoWidth"];
00070         $this->LogoHeight = $Record["LogoHeight"];
00071     }
00072 
00073     # data access methods
00074     function TopLinkString($NewValue = NULL) {  return $this->AccessDBValue("TopLinkString", $NewValue);  }
00075     function TopLinkBeginLetter($NewValue = NULL) {  return $this->AccessDBValue("TopLinkBeginLetter", $NewValue);  }
00076     function TopLinkEndLetter($NewValue = NULL) {  return $this->AccessDBValue("TopLinkEndLetter", $NewValue);  }
00077     function AdminEmail($NewValue = NULL) {  return $this->AccessDBValue("AdminEmail", $NewValue);  }
00078     function PasswordMailSubject($NewValue = NULL) {  return $this->AccessDBValue("PasswordMailSubject", $NewValue);  }
00079     function PasswordMailBody($NewValue = NULL) {  return $this->AccessDBValue("PasswordMailBody", $NewValue);  }
00080     function PasswordResetMailSubject($NewValue = DB_NOVALUE) {  return $this->UpdateValue("PasswordResetMailSubject", $NewValue);  }
00081     function PasswordResetMailBody($NewValue = DB_NOVALUE) {  return $this->UpdateValue("PasswordResetMailBody", $NewValue);  }
00082     function PortalName($NewValue = NULL) {  return $this->AccessDBValue("PortalName", $NewValue);  }
00083     function DefaultActiveUI($NewValue = NULL) {  return $this->AccessDBValue("DefaultActiveUI", $NewValue);  }
00084     function CurrentTheme($NewValue = NULL) {  return $this->AccessDBValue("CurrentTheme", $NewValue);  }
00085     function DefaultCharacterSet($NewValue = NULL) {  return $this->AccessDBValue("DefaultCharacterSet", $NewValue);  }
00086     function SearchTermsRequired($NewValue = NULL) {  return $this->AccessDBValue("SearchTermsRequired", $NewValue);  }
00087     function AnnouncementsEnabled($NewValue = NULL) {  return $this->AccessDBValue("AnnouncementsEnabled", $NewValue);  }
00088     function ForumsEnabled($NewValue = NULL) {  return $this->AccessDBValue("ForumsEnabled", $NewValue);  }
00089     function AllowMultipleUIsEnabled($NewValue = NULL) {  return $this->AccessDBValue("AllowMultipleUIsEnabled", $NewValue);  }
00090     function ResourceLaunchesNewWindowEnabled($NewValue = NULL) {  return $this->AccessDBValue("ResourceLaunchesNewWindowEnabled", $NewValue);  }
00091     function UserAgentsEnabled($NewValue = NULL) {  return $this->AccessDBValue("UserAgentsEnabled", $NewValue);  }
00092     function ResourceRatingsEnabled($NewValue = NULL) {  return $this->AccessDBValue("ResourceRatingsEnabled", $NewValue);  }
00093     function ResourceCommentsEnabled($NewValue = NULL) {  return $this->AccessDBValue("ResourceCommentsEnabled", $NewValue);  }
00094     function AccessibilityWizardEnabled($NewValue = NULL) {  return $this->AccessDBValue("AccessibilityWizardEnabled", $NewValue);  }
00095     function ReleaseFlagApproved($NewValue = NULL) {  return $this->AccessDBValue("ReleaseFlagApproved", $NewValue);  }
00096     function SearchDBEnabled($NewValue = NULL) {  return $this->AccessDBValue("SearchDBEnabled", $NewValue);  }
00097     function RecommenderDBEnabled($NewValue = NULL) {  return $this->AccessDBValue("RecommenderDBEnabled", $NewValue);  }
00098     function OAISQEnabled($NewValue = NULL) {  return $this->AccessDBValue("OAISQEnabled", $NewValue);  }
00099     function NumAnnounceOnHomePage($NewValue = NULL) {  return $this->AccessDBValue("NumAnnounceOnHomePage", $NewValue);  }
00100     function NumResourcesOnHomePage($NewValue = NULL) {  return $this->AccessDBValue("NumResourcesOnHomePage", $NewValue);  }
00101     function LegalNotice($NewValue = NULL) {  return $this->AccessDBValue("LegalNotice", $NewValue);  }
00102     function NumClassesPerBrowsePage($NewValue = NULL)
00103     {
00104         # if new classes per browse page has been specified
00105         if (isset($NewValue) && ($NewValue != $this->NumClassesPerBrowsePage))
00106         {
00107             # clear all classification links
00108             $this->TopLinkString("");
00109             $DB = new SPTDatabase();
00110             $DB->Query("UPDATE Classifications SET LinkString=''");
00111         }
00112 
00113         return $this->AccessDBValue("NumClassesPerBrowsePage", $NewValue);
00114     }
00115     function NumColumnsPerBrowsePage($NewValue = NULL) {  return $this->AccessDBValue("NumColumnsPerBrowsePage", $NewValue);  }
00116     function BrowsingFieldId($NewValue = NULL) {  return $this->AccessDBValue("BrowsingFieldId", $NewValue);  }
00117     function OaiIdDomain($NewValue = NULL) {  return $this->AccessDBValue("OaiIdDomain", $NewValue);  }
00118     function OaiIdPrefix($NewValue = NULL) {  return $this->AccessDBValue("OaiIdPrefix", $NewValue);  }
00119     function OaiEarliestDate($NewValue = NULL) {  return $this->AccessDBValue("OaiEarliestDate", $NewValue);  }
00120     function OaiDateGranularity($NewValue = NULL) {  return $this->AccessDBValue("OaiDateGranularity", $NewValue);  }
00121     function SiteKeywords($NewValue = NULL) { return $this->AccessDBValue("SiteKeywords", $NewValue); }
00122     function AboutText($NewValue = NULL) { return $this->AccessDBValue("AboutText", $NewValue); }
00123 
00124     function ContactName($NewValue = NULL) { return $this->AccessDBValue("ContactName", $NewValue); }
00125     function ContactEmail($NewValue = NULL) { return $this->AccessDBValue("ContactEmail", $NewValue); }
00126     function Organization($NewValue = NULL) { return $this->AccessDBValue("Organization", $NewValue); }
00127     function OrganizationType($NewValue = NULL) { return $this->AccessDBValue("OrganizationType", $NewValue); }
00128     function SiteType($NewValue = NULL) { return $this->AccessDBValue("SiteType", $NewValue); }
00129     function OkayToListSite($NewValue = NULL) { return $this->AccessDBValue("OkayToListSite", $NewValue); }
00130     function LastRegisteredOn($NewValue = NULL) { return $this->AccessDBValue("LastRegisteredOn", $NewValue); }
00131     function AddAWStatsScript($NewValue = NULL) { return $this->AccessDBValue("AddAWStatsScript", $NewValue); }
00132     function AddGoogleAnalytics($NewValue = NULL) { return $this->AccessDBValue("AddGoogleAnalytics", $NewValue); }
00133     function GoogleAnalyticsCode($NewValue = NULL) { return $this->AccessDBValue("GoogleAnalyticsCode", $NewValue); }
00134     function DisplayLimitsByDefault($NewValue = NULL) { return $this->AccessDBValue("DisplayLimitsByDefault", $NewValue); }
00135 
00136     function LogoFileName() {  return $this->LogoFileName;  }
00137     function LogoAltText() {  return $this->LogoAltText;  }
00138     function LogoWidth() {  return $this->LogoWidth;  }
00139     function LogoHeight() {  return $this->LogoHeight;  }
00140 
00141     function HasRegistered() {  return strlen($this->LastRegisteredOn) ? TRUE : FALSE;  }
00142 
00143 
00144     # ---- PRIVATE INTERFACE -------------------------------------------------
00145 
00146     var $TopLinkString;
00147     var $TopLinkBeginLetter;
00148     var $TopLinkEndLetter;
00149     var $AdminEmail;
00150     var $PasswordMailSubject;
00151     var $PasswordMailBody;
00152     var $PortalName;
00153     var $DefaultActiveUI;
00154     var $CurrentTheme;
00155     var $DefaultCharacterSet;
00156     var $NumClassesPerBrowsePage;
00157     var $NumColumnsPerBrowsePage;
00158     var $BrowsingFieldId;
00159     var $SearchTermsRequired;
00160     var $AnnouncementsEnabled;
00161     var $ForumsEnabled;
00162     var $AllowMultipleUIsEnabled;
00163     var $ResourceLaunchesNewWindow;
00164     var $UserAgentsEnabled;
00165     var $ResourceRatingsEnabled;
00166     var $ResourceCommentsEnabled;
00167     var $AccessibilityWizardEnabled;
00168     var $ReleaseFlagApproved;
00169     var $SearchDBEnabled;
00170     var $RecommenderDBEnabled;
00171     var $OAISQEnabled;
00172     var $NumAnnounceOnHomePage;
00173     var $NumResourcesOnHomePage;
00174     var $LegalNotice;
00175     var $OaiIdDomain;
00176     var $OaiIdPrefix;
00177     var $OaiEarliestDate;
00178     var $OaiDateGranularity;
00179     var $LogoFileName;
00180     var $LogoAltText;
00181     var $LogoWidth;
00182     var $LogoHeight;
00183     var $SiteKeywords;
00184     var $AboutText;
00185     var $ContactName;
00186     var $ContactEmail;
00187     var $Organization;
00188     var $OrganizationType;
00189     var $SiteType;
00190     var $OkayToListSite;
00191     var $LastRegisteredOn;
00192     var $AddAWStatsScript;
00193     var $AddGoogleAnalytics;
00194     var $GoogleAnalyticsCode;
00195     var $DisplayLimitsByDefault;
00196     var $DBFields;
00197     var $DB;
00198 
00199     function UpdateValue($FieldName, $NewValue)
00200     {
00201         return $this->DB->UpdateValue("SystemConfiguration", $FieldName,
00202                 $NewValue, NULL, $this->DBFields);
00203     }
00204 
00205     function AccessDBValue($FieldName, $NewValue)
00206     {
00207         # if new value was passed in
00208         if ($NewValue !== NULL)
00209         {
00210             # set our copy to new value
00211             $this->{$FieldName} = $NewValue;
00212 
00213             # save new value in database
00214             $DB = new SPTDatabase();
00215             if (is_string($NewValue))
00216             {
00217                 $DB->Query("UPDATE SystemConfiguration SET "
00218                         .$FieldName."='".addslashes($NewValue)."' ");
00219             }
00220             else
00221             {
00222                 $DB->Query("UPDATE SystemConfiguration SET "
00223                         .$FieldName."=".$NewValue." ");
00224             }
00225         }
00226 
00227         # pass current value back to caller
00228         return $this->{$FieldName};
00229     }
00230 }
00231 
00232 
00233 ?>