phpDocumentor myPHP
[ class tree: myPHP ] [ index: myPHP ] [ all elements ]

Source for file init.php

Documentation is available at init.php

  1. <?
  2. /**
  3. * Init of the myPHP packages.
  4. * This is the global init file for all the packages in the myPHP system.
  5. * This is where all the different packages are initialized.
  6. *
  7. * @package myPHP
  8. * @filesource
  9. * @see PORTAL_PATH.CURRENT_MYPHP_VERSION/init.php
  10. * @copyright (c) http://Finn-Rasmussen.com
  11. * @license http://Finn-Rasmussen.com/license/ myPHP License conditions
  12. * @author http://Finn-Rasmussen.com
  13. * @version 1.9
  14. * @since 21-oct-2005
  15. */
  16.  
  17. /**
  18. * @global MYPHP_BASE_PATH The Base package is always REQUIRED. Defines the Include Path for each package, FIXED, do not change ...
  19. */
  20. define('MYPHP_BASE_PATH',MYPHP_BASE_NAME);
  21.  
  22. /**
  23. * This package is always required and MUST be run
  24. * Initialize the myPHP BASE Package, FIXED, do not change ...
  25. * @see MYPHP_BASE_PATH.'/init.php' The Base Package
  26. */
  27. if (defined('MYPHP_BASE_PATH')) {
  28. require_once(MYPHP_BASE_PATH.'/init.php');
  29. }
  30.  
  31. /**
  32. * The Init of the whole myPHP system, FIXED, do not change ...
  33. * @see PORTAL_PATH.CURRENT_MYPHP_VERSION.DEFAULT_PAGE_INIT_FILE_NAME The Init of the different myPHP modules
  34. */
  35. if (defined('DEFAULT_PAGE_INIT_FILE_NAME')) {
  36. require_once(PORTAL_PATH.CURRENT_MYPHP_VERSION.DEFAULT_PAGE_INIT_FILE_NAME); //
  37. }
  38.  
  39. /**
  40. * The Config File, if exists, search order
  41. * domain-language-config.php
  42. * domain-config.php
  43. * language-config.php
  44. * config.php
  45. * @see DEFAULT_CONFIG_FILE_NAME, The Config File
  46. */
  47. if (defined('DEFAULT_CONFIG_FILE_NAME')) {
  48. if (file_exists(DEFAULT_DOMAIN_NAME.'-'.LANGUAGE.'-'.DEFAULT_CONFIG_FILE_NAME)) {
  49. require(DEFAULT_DOMAIN_NAME.'-'.LANGUAGE.'-'.DEFAULT_CONFIG_FILE_NAME);
  50. } else {
  51. if (file_exists(DEFAULT_DOMAIN_NAME.'-'.DEFAULT_CONFIG_FILE_NAME)) {
  52. require(DEFAULT_DOMAIN_NAME.'-'.DEFAULT_CONFIG_FILE_NAME);
  53. } else {
  54. if (file_exists(LANGUAGE.'-'.DEFAULT_CONFIG_FILE_NAME)) {
  55. require(LANGUAGE.'-'.DEFAULT_CONFIG_FILE_NAME);
  56. } else {
  57. if (file_exists(DEFAULT_CONFIG_FILE_NAME)) {
  58. require(DEFAULT_CONFIG_FILE_NAME);
  59. } else {
  60. // Do nothing
  61. }
  62. }
  63. }
  64. }
  65. }
  66.  
  67. /**
  68. * root/tab/xx/config.php
  69. * Initialize the local tab config, FIXED, do not change ...
  70. * The DEFAULT_MENU_TAB_PATH.'/'.DEFAULT_CONFIG_FILE_NAME must come after the ./config.php
  71. * @see DEFAULT_MENU_TAB_PATH.'/'.DEFAULT_CONFIG_FILE_NAME The Local tab config for this page only
  72. */
  73. if (defined('DEFAULT_CONFIG_FILE_NAME') && !empty($_GET[REQUEST_TAB])) {
  74. if (defined('DEFAULT_MENU_TAB_PATH') && file_exists(DEFAULT_MENU_TAB_PATH.'/'.DEFAULT_CONFIG_FILE_NAME)) {
  75. require_once(DEFAULT_MENU_TAB_PATH.'/'.DEFAULT_CONFIG_FILE_NAME); // Overrule local ./config.php
  76. } else {
  77. // Ok, if no file exist
  78. }
  79. } else {
  80. // Ok, if no request tab
  81. }
  82.  
  83. /**
  84. * ./setup.php
  85. * Initialize the local setup, FIXED, do not change ...
  86. * The ./setup.php must come before root/setup-version.php
  87. * @see './setup.php' The Local setup for this page only
  88. */
  89. if (file_exists('./setup-'.CURRENT_VERSION.'.php')) {
  90. // Must be root
  91. //require_once('./setup-'.CURRENT_VERSION.'.php');
  92.  
  93. } else {
  94. if (file_exists('./setup.php')) {
  95. //require_once('./setup.php');
  96. } else {
  97. // Ok, if no file exist
  98. //die('MYPHP_PATH/init.php, Unable to include ./setup[-version].php from '.getcwd());
  99. }
  100. }
  101.  
  102. /**
  103. * root/site-version.php
  104. * Initialize the project site-version.php, FIXED, do not change ...
  105. * The root/site-version.php must come before Setup-version.php
  106. * @see PROJECT_PATH.'/site-version.php' The setup of the Site
  107. */
  108. if (file_exists(PROJECT_PATH.'/site-'.CURRENT_VERSION.'.php')) {
  109. require_once(PROJECT_PATH.'/site-'.CURRENT_VERSION.'.php'); // Project Site Setup
  110. } else {
  111. die('MYPHP_PATH/init.php, Unable to include '.PROJECT_PATH.'/site-'.CURRENT_VERSION.'.php from '.PROJECT_PATH);
  112. }
  113.  
  114. /**
  115. * root/setup-version.php
  116. * Initialize the project setup-version.php, FIXED, do not change ...
  117. * The root/setup-version.php must come before XXX_PATH/Setup.php
  118. * @see PROJECT_PATH.'/setup-version.php' The setup of the Site
  119. */
  120. if (file_exists(PROJECT_PATH.'/setup-'.CURRENT_VERSION.'.php')) {
  121. require_once(PROJECT_PATH.'/setup-'.CURRENT_VERSION.'.php'); // Project Setup
  122. } else {
  123. die('MYPHP_PATH/init.php, Unable to include '.PROJECT_PATH.'/setup-'.CURRENT_VERSION.'.php from '.PROJECT_PATH);
  124. }
  125.  
  126. /**
  127. * Language
  128. * Initialize the Language to use, FIXED, do not change ...
  129. * @see HTML_LANGUAGE_RESOURCE_PATH.'/Setup.php', The Language Setup Package
  130. */
  131. if (defined('HTML_LANGUAGE_RESOURCE_PATH')) {
  132. require_once(HTML_LANGUAGE_RESOURCE_PATH.'/Setup.php');
  133. } else {
  134. /**
  135. * LANGUAGE
  136. * This is the default language to use
  137. * @global LANGUAGE The Language to use
  138. */
  139. if (!defined('LANGUAGE')) {
  140. if (defined('DEFAULT_PAGE_LANGUAGE')) {
  141. define('LANGUAGE',DEFAULT_PAGE_LANGUAGE);
  142. } else {
  143. /**
  144. * @ignore
  145. */
  146. define('LANGUAGE','da'); // What else to do?
  147. }
  148. }
  149. }
  150.  
  151. /**
  152. * Setup of Base HTML
  153. * Initialize the final Base Setup, FIXED, do not change ...
  154. * @see HTML_BASE_RESOURCE_PATH.'/Setup.php', The Base Setup Package
  155. */
  156. if (defined('HTML_BASE_RESOURCE_PATH')) {
  157. require_once(HTML_BASE_RESOURCE_PATH.'/Setup.php');
  158. }
  159.  
  160. /**
  161. * Initialize the Inc Path, if not already done
  162. * The INC_PATH my already been defined as a request param
  163. * or may be defined in the local confi or setup file
  164. * @global INC_PATH Include Path for the templates
  165. */
  166. if (defined('PAGE_START_FILE_NAME') && !defined('INC_PATH')) {
  167. // Look for local templates
  168. if (file_exists('.'.PAGE_START_FILE_NAME)) {
  169. define('INC_PATH','.');
  170. } else {
  171. // Look for site templates at DOCUMENT_ROOT
  172. if (file_exists(PORTAL_PATH.PAGE_START_FILE_NAME)) {
  173. /**
  174. * @ignore
  175. */
  176. define('INC_PATH',PORTAL_PATH);
  177. } else {
  178. // Look for site templates at PROJECT_PATH/DEFAULT_INC_PATH
  179. if (file_exists(PROJECT_PATH.DEFAULT_INC_PATH.PAGE_START_FILE_NAME)) {
  180. /**
  181. * @ignore
  182. */
  183. define('INC_PATH',PROJECT_PATH.DEFAULT_INC_PATH);
  184. } else {
  185. // Look for Default templates in myPHP System
  186. if (defined('DEFAULT_INC_PATH')) {
  187. if (file_exists(MYPHP_TEMPLATE_PATH.DEFAULT_INC_PATH.PAGE_START_FILE_NAME)) {
  188. /**
  189. * @ignore
  190. */
  191. define('INC_PATH',MYPHP_TEMPLATE_PATH.DEFAULT_INC_PATH);
  192. } else {
  193. die('MYPHP_PATH/init.php, Unable to find a PAGE_START_FILE_NAME='.PAGE_START_FILE_NAME.' template for DEFAULT_INC_PATH='.DEFAULT_INC_PATH);
  194. }
  195. }
  196. }
  197. }
  198. }
  199. } else {
  200. // Already defined
  201. }
  202. ?>

Documentation generated on Thu, 22 Dec 2005 17:11:53 +0100 by phpDocumentor 1.3.0RC3