{"id":5268,"date":"2013-05-08T11:50:32","date_gmt":"2013-05-08T15:50:32","guid":{"rendered":"https:\/\/www.caskeys.com\/dc\/?p=5268"},"modified":"2017-01-15T15:21:59","modified_gmt":"2017-01-15T20:21:59","slug":"class-config","status":"publish","type":"post","link":"https:\/\/www.caskeys.com\/dc\/class-config\/","title":{"rendered":"Class &#8211; Config"},"content":{"rendered":"<pre class=\"brush: php; title: Code:; notranslate\" title=\"Code:\">\r\n&lt;?php\t\r\n\t\r\n\t\/*\r\n\tConfiguration file. This should be added to all PHP scripts to set up commonly used includes, functions, objects, variables and so on.\r\n\t*\/\r\n\t\r\n\t$iReqTime \t= $_SERVER&#x5B;'REQUEST_TIME_FLOAT'];\r\n\t$cDocroot \t= NULL; \/\/Document root.\t\r\n\t$oDB\t\t= NULL;\t\/\/Database class object.\r\n\t$oErr\t\t= NULL;\t\/\/Error class object.\r\n\t$oMail\t\t= NULL;\t\/\/E-Mail handler class object.\r\n\t$oSes\t\t= NULL;\t\/\/Session handler class object.\r\n\t$oUtl\t\t= NULL;\t\/\/Utility class object.\r\n\t$oFrm\t\t= NULL;\t\/\/Forms class object.\r\n\t\t\r\n\t\/* Get needed includes. *\/\r\n\trequire_once(&quot;access.php&quot;);\t\t\/\/Account based access.\r\n\trequire_once(&quot;constants.php&quot;);\t\/\/Global constants.\r\n\trequire_once(&quot;database.php&quot;);\t\/\/Database handler.\r\n\trequire_once(&quot;forms.php&quot;);\t\t\/\/Forms handler.\r\n\trequire_once(&quot;error.php&quot;);\t\t\/\/Error handler.\r\n\trequire_once(&quot;mail.php&quot;);\t\t\/\/Mail handler.\r\n\trequire_once(&quot;sessions.php&quot;);\t\/\/Session handler.\r\n\trequire_once(&quot;tables.php&quot;);\t\t\/\/Table handler.\r\n\trequire_once(&quot;utility.php&quot;);\t\/\/Utility functions.\t\r\n\t\t\r\n\t\/* Initialize class objects *\/\r\n\t$oUtl\t= new class_utility();\t\t\t\t\t\t\t\t\t\t\t\t\t\t\/\/Utility functions.\r\n\t$oMail\t= new class_mail();\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\/\/E-Mail handler.\r\n\t$oErr \t= new class_error(array(&quot;Mail&quot; =&gt; $oMail, &quot;Utl&quot; =&gt; $oUtl));\t\t\t\t\t\/\/Error handler.\r\n\t$oDB\t= new class_db(array(&quot;Utl&quot; =&gt; $oUtl, &quot;Err&quot; =&gt; $oErr));\t\t\t\t\t\t\/\/Database handler.\r\n\t$oSes\t= new class_sessions(array(&quot;DB&quot; =&gt; $oDB));\t\t\t\t\t\t\t\t\t\/\/Session handler.\t\r\n\t$oAcc\t= new class_access(array(&quot;DB&quot; =&gt; $oDB, &quot;Ses&quot; =&gt; $oSes, &quot;Utl&quot; =&gt; $oUtl));\t\/\/Account based access.\r\n\t$oTbl \t= new class_tables(array(&quot;Utl&quot;=&gt;$oUtl));\t\t\t\t\t\t\t\t\t\/\/Tables handler.\r\n\t$oFrm \t= new class_forms(array(&quot;DB&quot;=&gt;$oDB));\t\t\t\t\t\t\t\t\t\t\/\/Forms handler.\r\n\t\t\r\n\t$cDocroot = $oUtl-&gt;utl_get_server_value('DOCUMENT_ROOT').&quot;\/&quot;;\r\n\t\r\n\t\/* Replace default session handler. *\/\r\n\tsession_set_save_handler($oSes, true);\r\n\t\r\n\t\/* If session not started, initialize. *\/\r\n\tif(session_status()==PHP_SESSION_NONE)\r\n\t{\t\t\t\t\t\r\n\t\tsession_start();\r\n\t}\r\n?&gt;\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Basic configuration class.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":true,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[71],"tags":[27,234],"class_list":["post-5268","post","type-post","status-publish","format-standard","hentry","category-technology-temerity","tag-coding","tag-coding-php"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p5lNM5-1mY","jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.caskeys.com\/dc\/wp-json\/wp\/v2\/posts\/5268","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.caskeys.com\/dc\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.caskeys.com\/dc\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.caskeys.com\/dc\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.caskeys.com\/dc\/wp-json\/wp\/v2\/comments?post=5268"}],"version-history":[{"count":2,"href":"https:\/\/www.caskeys.com\/dc\/wp-json\/wp\/v2\/posts\/5268\/revisions"}],"predecessor-version":[{"id":6188,"href":"https:\/\/www.caskeys.com\/dc\/wp-json\/wp\/v2\/posts\/5268\/revisions\/6188"}],"wp:attachment":[{"href":"https:\/\/www.caskeys.com\/dc\/wp-json\/wp\/v2\/media?parent=5268"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.caskeys.com\/dc\/wp-json\/wp\/v2\/categories?post=5268"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.caskeys.com\/dc\/wp-json\/wp\/v2\/tags?post=5268"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}