<?php
# Sequence if wiki initialization:
#   1. basic_config.inc - bare minimum of defitionitions to allow the following steps 
#   2. <wiki>/config.inc - wiki specific configuration, also defined wanted extensions
#   3. final_config.inc - final, system wide and farm-related configuration
#   4. extensions_config.inc - configure individual extensions and enable them as wanted
#
# In this file we overwrite some stuff from the wiki's LocalSettings, so that it does
# not hurt in this farm environment even if it is wrong
#

$wgShowExceptionDetails = true;

#$wgServer           = "http://kaip-intra5.net.plm.eds.com";
#$wgServer           = "http://dekltpl01info01.net.plm.eds.com";
$wgServer           = "http://info.net.plm.eds.com";

### watchout: currently (May 2022) we are restricted to http because we have no certificate installed to allow https
#$wgServer           = "//info.net.plm.eds.com";
#$wgServer           = "https://info.net.plm.eds.com";
#$wgForceHTTPS = true;

$wikidirname = strtolower($wgSitename);


$wgScriptExtension  = ".php";
$wgLogo             = "/wikis/sites/$Sitename/". basename($wgLogo);
$wgLocalInterwiki   = $wgSitename;


# enable short/pretty URLs
$wgUsePathInfo = true;

#$wgScriptPath  = "";
$wgStylePath   = "/wikis/sites/$Sitename/code/skins";
$wgArticlePath = "/$wikidirname/$1";
# IMPORTANT: we need to twiddle with this a bit, because otherwise
# extensions won't run anymore > 1.24
$wgExtensionAssetsPath = "/wikis/sites/$Sitename/code/extensions";


# The URL path to load.php.  Defaults to "{$wgScriptPath}/load{$wgScriptExtension}".
$wgLoadScript  = "/wikis/sites/$Sitename/code/load{$wgScriptExtension}";


$wgEnableEmail      = true;
$wgEnableUserEmail  = true; # UPO

$wgEmergencyContact = "www@lmsintl.com";
$wgPasswordSender   = "www@lmsintl.com";

$wgEnotifUserTalk      = true; # UPO
$wgEnotifWatchlist     = true; # UPO
$wgEmailAuthentication = true;

$wgEnableUploads  = true;
$wgUploadDirectory = "$siteDir/images";
$wgUploadPath = "/wikis/sites/$Sitename/images";


$wgUseImageMagick = true;
$wgImageMagickConvertCommand = "/usr/bin/convert";

$wgUseInstantCommons  = false;

$wgShellLocale = "en_US.utf8";
$wgLanguageCode = "en";

#$wgDefaultSkin = "vector";
#$wgDefaultSkin = "monobook";

## For attaching licensing metadata to pages, and displaying an
## appropriate copyright notice / icon. GNU Free Documentation
## License and Creative Commons licenses are supported so far.
$wgRightsPage = ""; # Set to the title of a wiki page that describes your license/copyright
$wgRightsUrl  = "";
$wgRightsText = "";
$wgRightsIcon = "";

# Path to the GNU diff3 utility. Used for conflict resolution.
$wgDiff3 = "/usr/bin/diff3";

# Query string length limit for ResourceLoader. You should only set this if
# your web server has a query string length limit (then set it to that limit),
# or if you have suhosin.get.max_value_length set in php.ini (then set it to
# that value)
$wgResourceLoaderMaxQueryLength = -1;


#-------------------------------------------------------------------------
# Define some system-wide options
# (not extensions, they go into extensions_config.inc)

# Break out of framesets. This can be used to prevent external
# sites from framing your site with ads
$wgBreakFrames = true;

# Have uncaught exceptions print a complete stack trace to output (debug only)
#$wgShowExceptionDetails = true;

# count any page with a comma as a valid article
#$wgUseCommaCount = true;

# enable file:// URLS
$wgUrlProtocols[] = "file://";

# Show watching users in Page views
$wgPageShowWatchingUsers =true;

# Show watching users in recent changes
$wgRCShowWatchingUsers = true;

# Allow subpages in main namespace
$wgNamespacesWithSubpages[NS_MAIN] = true;

# Disable "jump to" accessibility links
$wgDefaultUserOptions['showjumplinks'] = 0;

# Hide minor edits in recent changes
$wgDefaultUserOptions['hideminor'] = 1;

# Use new pages patrolling to check for vandalism
$wgUseNPPatrol = true;

# allows users to get some extra information about the page by specifying "action=info" in the URL.
$wgAllowPageInfo = true;

# When this option is enabled, users will be able to use the DISPLAYTITLE
# magic word to override the title of a page, provided the selected title
# normalises to the same title.
$wgRestrictDisplayTitle = false;

# Enable suggestions while typing in search boxes (results are passed
# around in OpenSearch format). You might have to comment out
# $wgScriptExtension = ".php5"; in your LocalSettings.php to make this work.
$wgEnableMWSuggest = true;

# Disable talk pages for anonymous users (IPs). 
$wgDisableAnonTalk = true;

# Show the IP in the user bar for anonymous users by default
$wgShowIPinHeader = false;

# Enable scary transclusion (transcluding pages or templates from
# another wiki).  This setting applies only to pages in the template:
# namespace; both $wgEnableScaryTranscluding and the iw_trans bit in
# the interwiki table must be set for this to be enabled.
$wgEnableScaryTranscluding = true;

# Expiry time for interwiki transclusion.
$wgTranscludeCacheExpiry = 60;

# Set to true to have nicer highlighted text in search results,
# by default off due to execution overhead
$wgAdvancedSearchHighlighting = true;

# enable inline images from an external URLs
$wgAllowExternalImages = true;

# Allows use of DISPLAYTITLE magic word
$wgAllowDisplayTitle=true;

# Restrict {{DISPLAYTITLE}} to titles that normalize to same canonical DB key
$wgRestrictDisplayTitle = false;


#-------------------------------------------------------------------------
# add page-refresh tab
#
#if ($wfLMSContentRefreshHook)
	#$wgHooks['SkinTemplateContentActions'][] = 'wfContentRefreshHook';


function wfContentRefreshHook( &$content_actions ) {
        global $wgRequest, $wgRequest, $wgTitle;

	$action = $wgRequest->getText( 'action' );

	if ( $wgTitle->getNamespace() != NS_SPECIAL ) {
		$content_actions['purge'] = array(
						'class' => false,
						'text' => "refresh", #'text' => wfMsg( 'refresh' ),
						'href' => $wgTitle->getLocalUrl( 'action=purge' )
						);
	}
	return true;
}


#-------------------------------------------------------------------------
#	Enable file upload of the filetypes we typically use
#
$wgEnableUploads       = true;
$wgUseImageResize      = true;

$wgFileExtensions = array('gif','png','jpg','jpeg','svg',
                'xls','doc','ppt',
		'xlsx','xlsm','docx','docm','pptx',
		'pdf','zip','chm','hg','msg',
		'avi','wmv','mpg','mpeg','mp4','mov',
		'wav','reg','sh','txt',
		);  #,'htm');

# enable svg files/avoid false positives
$wgAllowTitlesInSVG = true;

# NOTE some extensions are on the blacklist, so they need to be removed
# explicitely. See https://www.mediawiki.org/wiki/Manual:$wgFileBlacklist
#$wgFileBlacklist = array_diff( $wgFileBlacklist, array ('py') );

# Same for the mim etype.
# See https://www.mediawiki.org/wiki/Manual:$wgMimeTypeBlacklist
#$wgMimeTypeBlacklist = array_diff( $wgMimeTypeBlacklist, array ('text/x-python') );

# NOTE: blacklist overrides wgFileExtensions
#$wgFileBlacklist = array_diff( $wgFileBlacklist, array ('htm') );
$wgVerifyMimeType = false; 

#$wgDisableUploadScriptChecks = true;

#-------------------------------------------------------------------------
# Permission keys given to users in each group.
# All users are implicitly in the '*' group including anonymous visitors;
# logged-in users are all implicitly in the 'user' group. These will be
# combined with the permissions of all groups that a given user is listed
# in in the user_groups table.
#

# Possible right: edit editprotected delete createaccount createpage

# Disable anonymous editing
$wgGroupPermissions['*']['edit'] = false;

# Dez 24: new security policy - allow access only when logged in
$wgGroupPermissions['*']['read'] = true;
##$wgGroupPermissions['*']['read'] = false;
 
# Prevent new user registrations except by sysops
$wgGroupPermissions['*']['createaccount'] = false;
$wgGroupPermissions['sysop']['createaccount'] = true;

# logged-in users may delete pages
$wgGroupPermissions['user' ]['delete'] = true;

# Give operators some extra rights
$wgGroupPermissions['sysop']['deletelogentry'] = true;
$wgGroupPermissions['sysop']['deleterevision'] = true;


# disable all users from editing (for maintenance)
#$wgGroupPermissions['user']['edit']   = false;

#Special settings for private wikis
if (IsSet($wfLMSPrivateWiki) && $wfLMSPrivateWiki) {
	$wgGroupPermissions['*']['createaccount'] = false;
	$wgGroupPermissions['*']['edit'] = false;
	$wgGroupPermissions['*']['read'] = false;

}

?>
