Search:

# CWIS Developers Documentation

- Main Page
- Classes
- Files

- Search for |

- File List
- File Members

# 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
    00063         # load UI configuration info
    00064         $this->DB->Query("SELECT * FROM UIStyleConfiguration");
    00065         $Record = $this->DB->FetchRow();
    00066         $this->LogoFileName = $Record["LogoFileName"];
    00067         $this->LogoAltText = $Record["LogoAltText"];
    00068         $this->LogoWidth = $Record["LogoWidth"];
    00069         $this->LogoHeight = $Record["LogoHeight"];
    00070     }
    00071
    00072     # data access methods
    00073     function TopLinkString($NewValue = NULL) {  return $this->AccessDBValue("TopLinkString", $NewValue);  }
    00074     function TopLinkBeginLetter($NewValue = NULL) {  return $this->AccessDBValue("TopLinkBeginLetter", $NewValue);  }
    00075     function TopLinkEndLetter($NewValue = NULL) {  return $this->AccessDBValue("TopLinkEndLetter", $NewValue);  }
    00076     function AdminEmail($NewValue = NULL) {  return $this->AccessDBValue("AdminEmail", $NewValue);  }
    00077     function PasswordMailSubject($NewValue = NULL) {  return $this->AccessDBValue("PasswordMailSubject", $NewValue);  }
    00078     function PasswordMailBody($NewValue = NULL) {  return $this->AccessDBValue("PasswordMailBody", $NewValue);  }
    00079     function PasswordResetMailSubject($NewValue = DB_NOVALUE) {  return $this->UpdateValue("PasswordResetMailSubject", $NewValue);  }
    00080     function PasswordResetMailBody($NewValue = DB_NOVALUE) {  return $this->UpdateValue("PasswordResetMailBody", $NewValue);  }
    00081     function PortalName($NewValue = NULL) {  return $this->AccessDBValue("PortalName", $NewValue);  }
    00082     function DefaultActiveUI($NewValue = NULL) {  return $this->AccessDBValue("DefaultActiveUI", $NewValue);  }
    00083     function CurrentTheme($NewValue = NULL) {  return $this->AccessDBValue("CurrentTheme", $NewValue);  }
    00084     function DefaultCharacterSet($NewValue = NULL) {  return $this->AccessDBValue("DefaultCharacterSet", $NewValue);  }
    00085     function SearchTermsRequired($NewValue = NULL) {  return $this->AccessDBValue("SearchTermsRequired", $NewValue);  }
    00086     function AnnouncementsEnabled($NewValue = NULL) {  return $this->AccessDBValue("AnnouncementsEnabled", $NewValue);  }
    00087     function ForumsEnabled($NewValue = NULL) {  return $this->AccessDBValue("ForumsEnabled", $NewValue);  }
    00088     function AllowMultipleUIsEnabled($NewValue = NULL) {  return $this->AccessDBValue("AllowMultipleUIsEnabled", $NewValue);  }
    00089     function ResourceLaunchesNewWindowEnabled($NewValue = NULL) {  return $this->AccessDBValue("ResourceLaunchesNewWindowEnabled", $NewValue);  }
    00090     function UserAgentsEnabled($NewValue = NULL) {  return $this->AccessDBValue("UserAgentsEnabled", $NewValue);  }
    00091     function ResourceRatingsEnabled($NewValue = NULL) {  return $this->AccessDBValue("ResourceRatingsEnabled", $NewValue);  }
    00092     function ResourceCommentsEnabled($NewValue = NULL) {  return $this->AccessDBValue("ResourceCommentsEnabled", $NewValue);  }
    00093     function AccessibilityWizardEnabled($NewValue = NULL) {  return $this->AccessDBValue("AccessibilityWizardEnabled", $NewValue);  }
    00094     function ReleaseFlagApproved($NewValue = NULL) {  return $this->AccessDBValue("ReleaseFlagApproved", $NewValue);  }
    00095     function SearchDBEnabled($NewValue = NULL) {  return $this->AccessDBValue("SearchDBEnabled", $NewValue);  }
    00096     function RecommenderDBEnabled($NewValue = NULL) {  return $this->AccessDBValue("RecommenderDBEnabled", $NewValue);  }
    00097     function OAISQEnabled($NewValue = NULL) {  return $this->AccessDBValue("OAISQEnabled", $NewValue);  }
    00098     function NumAnnounceOnHomePage($NewValue = NULL) {  return $this->AccessDBValue("NumAnnounceOnHomePage", $NewValue);  }
    00099     function NumResourcesOnHomePage($NewValue = NULL) {  return $this->AccessDBValue("NumResourcesOnHomePage", $NewValue);  }
    00100     function LegalNotice($NewValue = NULL) {  return $this->AccessDBValue("LegalNotice", $NewValue);  }
    00101     function NumClassesPerBrowsePage($NewValue = NULL)
    00102     {
    00103         # if new classes per browse page has been specified
    00104         if (isset($NewValue) && ($NewValue != $this->NumClassesPerBrowsePage))
    00105         {
    00106             # clear all classification links
    00107             $this->TopLinkString("");
    00108             $DB = new SPTDatabase();
    00109             $DB->Query("UPDATE Classifications SET LinkString=''");
    00110         }
    00111
    00112         return $this->AccessDBValue("NumClassesPerBrowsePage", $NewValue);
    00113     }
    00114     function NumColumnsPerBrowsePage($NewValue = NULL) {  return $this->AccessDBValue("NumColumnsPerBrowsePage", $NewValue);  }
    00115     function BrowsingFieldId($NewValue = NULL) {  return $this->AccessDBValue("BrowsingFieldId", $NewValue);  }
    00116     function OaiIdDomain($NewValue = NULL) {  return $this->AccessDBValue("OaiIdDomain", $NewValue);  }
    00117     function OaiIdPrefix($NewValue = NULL) {  return $this->AccessDBValue("OaiIdPrefix", $NewValue);  }
    00118     function OaiEarliestDate($NewValue = NULL) {  return $this->AccessDBValue("OaiEarliestDate", $NewValue);  }
    00119     function OaiDateGranularity($NewValue = NULL) {  return $this->AccessDBValue("OaiDateGranularity", $NewValue);  }
    00120     function SiteKeywords($NewValue = NULL) { return $this->AccessDBValue("SiteKeywords", $NewValue); }
    00121     function AboutText($NewValue = NULL) { return $this->AccessDBValue("AboutText", $NewValue); }
    00122
    00123     function ContactName($NewValue = NULL) { return $this->AccessDBValue("ContactName", $NewValue); }
    00124     function ContactEmail($NewValue = NULL) { return $this->AccessDBValue("ContactEmail", $NewValue); }
    00125     function Organization($NewValue = NULL) { return $this->AccessDBValue("Organization", $NewValue); }
    00126     function OrganizationType($NewValue = NULL) { return $this->AccessDBValue("OrganizationType", $NewValue); }
    00127     function SiteType($NewValue = NULL) { return $this->AccessDBValue("SiteType", $NewValue); }
    00128     function OkayToListSite($NewValue = NULL) { return $this->AccessDBValue("OkayToListSite", $NewValue); }
    00129     function LastRegisteredOn($NewValue = NULL) { return $this->AccessDBValue("LastRegisteredOn", $NewValue); }
    00130     function AddAWStatsScript($NewValue = NULL) { return $this->AccessDBValue("AddAWStatsScript", $NewValue); }
    00131     function AddGoogleAnalytics($NewValue = NULL) { return $this->AccessDBValue("AddGoogleAnalytics", $NewValue); }
    00132     function GoogleAnalyticsCode($NewValue = NULL) { return $this->AccessDBValue("GoogleAnalyticsCode", $NewValue); }
    00133
    00134     function LogoFileName() {  return $this->LogoFileName;  }
    00135     function LogoAltText() {  return $this->LogoAltText;  }
    00136     function LogoWidth() {  return $this->LogoWidth;  }
    00137     function LogoHeight() {  return $this->LogoHeight;  }
    00138
    00139     function HasRegistered() {  return strlen($this->LastRegisteredOn) ? TRUE : FALSE;  }
    00140
    00141
    00142     # ---- PRIVATE INTERFACE -------------------------------------------------
    00143
    00144     var $TopLinkString;
    00145     var $TopLinkBeginLetter;
    00146     var $TopLinkEndLetter;
    00147     var $AdminEmail;
    00148     var $PasswordMailSubject;
    00149     var $PasswordMailBody;
    00150     var $PortalName;
    00151     var $DefaultActiveUI;
    00152     var $CurrentTheme;
    00153     var $DefaultCharacterSet;
    00154     var $NumClassesPerBrowsePage;
    00155     var $NumColumnsPerBrowsePage;
    00156     var $BrowsingFieldId;
    00157     var $SearchTermsRequired;
    00158     var $AnnouncementsEnabled;
    00159     var $ForumsEnabled;
    00160     var $AllowMultipleUIsEnabled;
    00161     var $ResourceLaunchesNewWindow;
    00162     var $UserAgentsEnabled;
    00163     var $ResourceRatingsEnabled;
    00164     var $ResourceCommentsEnabled;
    00165     var $AccessibilityWizardEnabled;
    00166     var $ReleaseFlagApproved;
    00167     var $SearchDBEnabled;
    00168     var $RecommenderDBEnabled;
    00169     var $OAISQEnabled;
    00170     var $NumAnnounceOnHomePage;
    00171     var $NumResourcesOnHomePage;
    00172     var $LegalNotice;
    00173     var $OaiIdDomain;
    00174     var $OaiIdPrefix;
    00175     var $OaiEarliestDate;
    00176     var $OaiDateGranularity;
    00177     var $LogoFileName;
    00178     var $LogoAltText;
    00179     var $LogoWidth;
    00180     var $LogoHeight;
    00181     var $SiteKeywords;
    00182     var $AboutText;
    00183     var $ContactName;
    00184     var $ContactEmail;
    00185     var $Organization;
    00186     var $OrganizationType;
    00187     var $SiteType;
    00188     var $OkayToListSite;
    00189     var $LastRegisteredOn;
    00190     var $AddAWStatsScript;
    00191     var $AddGoogleAnalytics;
    00192     var $GoogleAnalyticsCode;
    00193     var $DBFields;
    00194     var $DB;
    00195
    00196     function UpdateValue($FieldName, $NewValue)
    00197     {
    00198         return $this->DB->UpdateValue("SystemConfiguration", $FieldName,
    00199                 $NewValue, NULL, $this->DBFields);
    00200     }
    00201
    00202     function AccessDBValue($FieldName, $NewValue)
    00203     {
    00204         # if new value was passed in
    00205         if ($NewValue !== NULL)
    00206         {
    00207             # set our copy to new value
    00208             $this->{$FieldName} = $NewValue;
    00209
    00210             # save new value in database
    00211             $DB = new SPTDatabase();
    00212             if (is_string($NewValue))
    00213             {
    00214                 $DB->Query("UPDATE SystemConfiguration SET "
    00215                         .$FieldName."='".addslashes($NewValue)."' ");
    00216             }
    00217             else
    00218             {
    00219                 $DB->Query("UPDATE SystemConfiguration SET "
    00220                         .$FieldName."=".$NewValue." ");
    00221             }
    00222         }
    00223
    00224         # pass current value back to caller
    00225         return $this->{$FieldName};
    00226     }
    00227 }
    00228
    00229
    00230 ?>

Copyright 2009 Internet Scout