stdconfig.php 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <?php if (!defined('PmWiki')) exit();
  2. /* Copyright 2002-2019 Patrick R. Michaud (pmichaud@pobox.com)
  3. This file is part of PmWiki; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published
  5. by the Free Software Foundation; either version 2 of the License, or
  6. (at your option) any later version. See pmwiki.php for full details.
  7. This file allows features to be easily enabled/disabled in config.php.
  8. Simply set variables for the features to be enabled/disabled in config.php
  9. before including this file. For example:
  10. $EnableQAMarkup=0; #disable Q: and A: tags
  11. $EnableWikiStyles=1; #include default wikistyles
  12. Each feature has a default setting, if the corresponding $Enable
  13. variable is not set then you get the default.
  14. To avoid processing any of the features of this file, set
  15. $EnableStdConfig = 0;
  16. in config.php.
  17. Script maintained by Petko YOTOV www.pmwiki.org/petko
  18. */
  19. $pagename = ResolvePageName($pagename);
  20. if (!IsEnabled($EnableStdConfig,1)) return;
  21. if (!function_exists('session_start') && IsEnabled($EnableRequireSession, 1))
  22. Abort('PHP is lacking session support', 'session');
  23. if (IsEnabled($EnablePGCust,1))
  24. include_once("$FarmD/scripts/pgcust.php");
  25. if (isset($PostConfig) && is_array($PostConfig)) {
  26. asort($PostConfig, SORT_NUMERIC);
  27. foreach ($PostConfig as $k=>$v) {
  28. if (!$k || !$v || $v<0 || $v>=50) continue;
  29. if (function_exists($k)) $k($pagename);
  30. elseif (file_exists($k)) include_once($k);
  31. }
  32. }
  33. if (IsEnabled($EnableRobotControl,1))
  34. include_once("$FarmD/scripts/robots.php");
  35. if (IsEnabled($EnableCaches, 1))
  36. include_once("$FarmD/scripts/caches.php");
  37. ## Scripts that are part of a standard PmWiki distribution.
  38. if (IsEnabled($EnableAuthorTracking,1))
  39. include_once("$FarmD/scripts/author.php");
  40. if (IsEnabled($EnablePrefs, 1))
  41. include_once("$FarmD/scripts/prefs.php");
  42. if (IsEnabled($EnableSimulEdit, 1))
  43. include_once("$FarmD/scripts/simuledit.php");
  44. if (IsEnabled($EnableDrafts, 0))
  45. include_once("$FarmD/scripts/draft.php"); # after simuledit + prefs
  46. if (IsEnabled($EnableSkinLayout,1))
  47. include_once("$FarmD/scripts/skins.php"); # must come after prefs
  48. if (@$Transition || IsEnabled($EnableTransitions, 0))
  49. include_once("$FarmD/scripts/transition.php"); # must come after skins
  50. if (@$LinkWikiWords || IsEnabled($EnableWikiWords, 0))
  51. include_once("$FarmD/scripts/wikiwords.php"); # must come before stdmarkup
  52. if (IsEnabled($EnableStdMarkup,1))
  53. include_once("$FarmD/scripts/stdmarkup.php"); # must come after transition
  54. if (($action=='diff' && @!$HandleActions['diff'])
  55. || (IsEnabled($EnablePreviewChanges, 0) && @$_REQUEST['preview']>''))
  56. include_once("$FarmD/scripts/pagerev.php");
  57. if (IsEnabled($EnableWikiTrails,1))
  58. include_once("$FarmD/scripts/trails.php");
  59. if (IsEnabled($EnableWikiStyles,1))
  60. include_once("$FarmD/scripts/wikistyles.php");
  61. if (IsEnabled($EnableMarkupExpressions, 1)
  62. && !function_exists('MarkupExpression'))
  63. include_once("$FarmD/scripts/markupexpr.php");
  64. if (IsEnabled($EnablePageList,1))
  65. include_once("$FarmD/scripts/pagelist.php");
  66. if (IsEnabled($EnableVarMarkup,1))
  67. include_once("$FarmD/scripts/vardoc.php");
  68. if (!function_exists(@$DiffFunction))
  69. include_once("$FarmD/scripts/phpdiff.php");
  70. if ($action=='crypt')
  71. include_once("$FarmD/scripts/crypt.php");
  72. if ($action=='edit')
  73. include_once("$FarmD/scripts/guiedit.php");
  74. if (IsEnabled($EnableForms,1))
  75. include_once("$FarmD/scripts/forms.php"); # must come after prefs
  76. if (IsEnabled($EnableUpload,0))
  77. include_once("$FarmD/scripts/upload.php"); # must come after forms
  78. if (IsEnabled($EnableBlocklist, 0))
  79. include_once("$FarmD/scripts/blocklist.php");
  80. if (IsEnabled($EnableNotify,0))
  81. include_once("$FarmD/scripts/notify.php");
  82. if (IsEnabled($EnableDiag,0) || $action == 'recipecheck')
  83. include_once("$FarmD/scripts/diag.php");
  84. if (IsEnabled($PmTOC['Enable'],0) || IsEnabled($PmEmbed,0) || IsEnabled($EnableSortable,0)
  85. || $LinkFunctions['mailto:'] == 'ObfuscateLinkIMap' || IsEnabled($EnableHighlight, 0)
  86. || IsEnabled($ToggleNextSelector, 0)
  87. ) {
  88. $utils = "$FarmD/pub/pmwiki-utils.js";
  89. if(file_exists($utils)) {
  90. $mtime = filemtime($utils);
  91. $HTMLFooterFmt['pmwiki-utils'] =
  92. "<script type='text/javascript' src='\$FarmPubDirUrl/pmwiki-utils.js?st=$mtime'
  93. data-sortable='".@$EnableSortable."' data-highlight='".@$EnableHighlight."'
  94. data-pmtoc='".PHSC(json_encode(@$PmTOC), ENT_QUOTES)."'
  95. data-toggle='".PHSC(@$ToggleNextSelector, ENT_QUOTES)."'
  96. data-pmembed='".PHSC(json_encode(@$PmEmbed), ENT_QUOTES)."' async></script>";
  97. }
  98. }
  99. if (IsEnabled($EnableUpgradeCheck,1)) {
  100. SDV($StatusPageName, "$SiteAdminGroup.Status");
  101. $page = ReadPage($StatusPageName, READPAGE_CURRENT);
  102. if (@$page['updatedto'] != $VersionNum)
  103. { $action = 'upgrade'; include_once("$FarmD/scripts/upgrades.php"); }
  104. }