Browse Source

New: Add option MAIN_MOTD_SETUPPAGE to add a content onto setup page.
Also content for MAIN_MOTD_SETUPPAGE, MAIN_MOTD_SETUPPAGE, MAIN_HOME
now accept "|langfile" into translation key to use a specific language
file.

Laurent Destailleur 12 years ago
parent
commit
6f5a918373
4 changed files with 38 additions and 6 deletions
  1. 3 0
      ChangeLog
  2. 22 3
      htdocs/admin/index.php
  3. 4 3
      htdocs/core/lib/security2.lib.php
  4. 9 0
      htdocs/index.php

+ 3 - 0
ChangeLog

@@ -39,6 +39,9 @@ For developers:
 - New: Upgrade lib of TCPDF to 6.0
 - New: Add property "hidden" into module descriptors to allow to hide a module according to
   some dynamic conditions.
+- New: Add option MAIN_MOTD_SETUPPAGE to add a content onto setup page. Also content for
+  MAIN_MOTD_SETUPPAGE, MAIN_MOTD_SETUPPAGE, MAIN_HOME now accept "|langfile" into translation
+  key to use a specific language file.
  
 
 ***** ChangeLog for 3.4 compared to 3.3.2 *****

+ 22 - 3
htdocs/admin/index.php

@@ -28,8 +28,6 @@ $langs->load("companies");
 
 if (!$user->admin) accessforbidden();
 
-$mesg='';
-
 
 /*
  * View
@@ -43,7 +41,28 @@ $form = new Form($db);
 
 print_fiche_titre($langs->trans("SetupArea"),'','setup');
 
-if ($mesg) print $mesg.'<br>';
+
+if (! empty($conf->global->MAIN_MOTD_SETUPPAGE))
+{
+    $conf->global->MAIN_MOTD_SETUPPAGE=preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>/i','<br>',$conf->global->MAIN_MOTD_SETUPPAGE);
+    if (! empty($conf->global->MAIN_MOTD_SETUPPAGE))
+    {
+    	$i=0;
+    	while (preg_match('/__\(([a-zA-Z|@]+)\)__/i',$conf->global->MAIN_MOTD_SETUPPAGE,$reg) && $i < 100)
+    	{
+    		$tmp=explode('|',$reg[1]);
+    		if (! empty($tmp[1])) $langs->load($tmp[1]);
+    		$conf->global->MAIN_MOTD_SETUPPAGE=preg_replace('/__\('.preg_quote($reg[1]).'\)__/i',$langs->trans($tmp[0]),$conf->global->MAIN_MOTD_SETUPPAGE);
+    		$i++;
+    	}
+
+    	print "\n<!-- Start of welcome text for setup page -->\n";
+        print '<table width="100%" class="notopnoleftnoright"><tr><td>';
+        print dol_htmlentitiesbr($conf->global->MAIN_MOTD_SETUPPAGE);
+        print '</td></tr></table><br>';
+        print "\n<!-- End of welcome text for setup page -->\n";
+    }
+}
 
 print $langs->trans("SetupDescription1").' ';
 print $langs->trans("AreaForAdminOnly").' ';

+ 4 - 3
htdocs/core/lib/security2.lib.php

@@ -270,12 +270,13 @@ function dol_loginfunction($langs,$conf,$mysoc)
 	if (! empty($conf->global->MAIN_HOME))
 	{
 		$i=0;
-		while (preg_match('/__\(([a-zA-Z]+)\)__/i',$conf->global->MAIN_HOME,$reg) && $i < 100)
+		while (preg_match('/__\(([a-zA-Z|@]+)\)__/i',$conf->global->MAIN_HOME,$reg) && $i < 100)
 		{
-			$conf->global->MAIN_HOME=preg_replace('/__\('.$reg[1].'\)__/i',$langs->trans($reg[1]),$conf->global->MAIN_HOME);
+			$tmp=explode('|',$reg[1]);
+			if (! empty($tmp[1])) $langs->load($tmp[1]);
+			$conf->global->MAIN_HOME=preg_replace('/__\('.preg_quote($reg[1]).'\)__/i',$langs->trans($tmp[0]),$conf->global->MAIN_HOME);
 			$i++;
 		}
-
 		$main_home=dol_htmlcleanlastbr($conf->global->MAIN_HOME);
 	}
 

+ 9 - 0
htdocs/index.php

@@ -61,6 +61,15 @@ if (! empty($conf->global->MAIN_MOTD))
     $conf->global->MAIN_MOTD=preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>/i','<br>',$conf->global->MAIN_MOTD);
     if (! empty($conf->global->MAIN_MOTD))
     {
+    	$i=0;
+    	while (preg_match('/__\(([a-zA-Z|@]+)\)__/i',$conf->global->MAIN_MOTD,$reg) && $i < 100)
+    	{
+    		$tmp=explode('|',$reg[1]);
+    		if (! empty($tmp[1])) $langs->load($tmp[1]);
+    		$conf->global->MAIN_MOTD=preg_replace('/__\('.preg_quote($reg[1]).'\)__/i',$langs->trans($tmp[0]),$conf->global->MAIN_MOTD);
+    		$i++;
+    	}
+
         print "\n<!-- Start of welcome text -->\n";
         print '<table width="100%" class="notopnoleftnoright"><tr><td>';
         print dol_htmlentitiesbr($conf->global->MAIN_MOTD);