Added feature #7247: Add hook for warning messages within Help->About modules and...
authorJeff Segars <jsegars@alumni.rice.edu>
Fri, 22 Feb 2008 20:19:51 +0000 (20:19 +0000)
committerJeff Segars <jsegars@alumni.rice.edu>
Fri, 22 Feb 2008 20:19:51 +0000 (20:19 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@3260 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_befunc.php
typo3/sysext/lang/locallang_core.xml

index 7091c08..8e1a2c7 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2008-02-22  Jeff Segars  <jeff@webempoweredchurch.org>
+
+       * Added feature #7247: Add hook for warning messages within Help->About modules and improve existing warning messages
+
 2008-02-22  Ingo Renner  <ingo@typo3.org>
 
        * fixed bug #7587: Accesscheck for Workspaceselector, credits Steffen Kamper
index d631c55..17e829d 100755 (executable)
@@ -3838,46 +3838,76 @@ class t3lib_BEfunc      {
 
                                // Check if the Install Tool Password is still default: joh316
                        if ($GLOBALS['TYPO3_CONF_VARS']['BE']['installToolPassword']==md5('joh316'))    {
-                               $warnings[] = 'The password of your Install Tool is still using the default value "joh316"';
+                               $url = 'install/index.php?redirect_url=index.php'.urlencode('?TYPO3_INSTALL[type]=about');
+                               $warnings["install_password"] = sprintf(
+                                       $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:warning.install_password'),
+                                       '<a href="'.$url.'">',
+                                       '</a>');
                        }
 
                                // Check if there is still a default user 'admin' with password 'password' (MD5sum = 5f4dcc3b5aa765d61d8327deb882cf99)
                        $where_clause = 'username='.$GLOBALS['TYPO3_DB']->fullQuoteStr('admin','be_users').' AND password='.$GLOBALS['TYPO3_DB']->fullQuoteStr('5f4dcc3b5aa765d61d8327deb882cf99','be_users').t3lib_BEfunc::deleteClause('be_users');
-                       $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('username, password', 'be_users', $where_clause);
-                       if ($GLOBALS['TYPO3_DB']->sql_num_rows($res))   {
-                               $warnings[] = 'The backend user "admin" with password "password" is still existing';
+                       $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid, username, password', 'be_users', $where_clause);
+                       if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
+                               $url = "alt_doc.php?returnUrl=index.php&edit[be_users][".$row['uid']."]=edit";
+                               $warnings["backend_admin"] = sprintf(
+                                       $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:warning.backend_admin'),
+                                       '<a href="'.$url.'">',
+                                       '</a>');
+                               
                        }
 
                                // Check if the Install Tool is enabled
                        $enableInstallToolFile = PATH_site.'typo3conf/ENABLE_INSTALL_TOOL';
                        if (@is_file($enableInstallToolFile))   {
-                               $warnings[] = 'The Install Tool is enabled. Make sure to delete the file "'.$enableInstallToolFile.'" when you have finished setting up TYPO3';
+                               $warnings["install_enabled"] = sprintf(
+                                       $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:warning.install_enabled'),
+                                       $enableInstallToolFile);
                        }
 
                                // Check if the encryption key is empty
                        if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] == '')  {
                                $url = 'install/index.php?redirect_url=index.php'.urlencode('?TYPO3_INSTALL[type]=config#set_encryptionKey');
-                               $warnings[] = 'The encryption key is not set! Set it in <a href="'.$url.'">$TYPO3_CONF_VARS[SYS][encryptionKey]</a>';
+                               $warnings["install_encryption"] = sprintf(
+                                       $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:warning.install_encryption'),
+                                       '<a href="'.$url.'">',
+                                       '</a>');
                        }
 
                                // Check if there are still updates to perform
                        if (!t3lib_div::compat_version(TYPO3_branch))   {
                                $url = 'install/index.php?redirect_url=index.php'.urlencode('?TYPO3_INSTALL[type]=update');
-                               $warnings[] = 'This installation is not configured for the TYPO3 version it is running. You probably did so by intention, in this case you can safely ignore this message. If unsure, visit the <a href="'.$url.'" target="_blank">Update Wizard</a> in the Install Tool to see which changes would be affected.';
+                               $warnings["install_update"] = sprintf(
+                                       $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:warning.install_update'),
+                                       '<a href="'.$url.'">',
+                                       '</a>');
                        }
 
                                // Check if sys_refindex is empty
                        list($count) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('count(*) as rcount','sys_refindex','1=1');
                        if (!$count['rcount'])  {
-                               $warnings[] = 'The Reference Index table is empty which is likely to be the case because you just upgraded your TYPO3 source. Please go to Tools>DB Check and update the reference index.';
+                               $url = 'sysext/lowlevel/dbint/index.php?&id=0&SET[function]=refindex';
+                               $warnings["backend_reference"] = sprintf(
+                                       $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:warning.backend_reference'),
+                                       '<a href="'.$url.'">',
+                                       '</a>');
+                       }
+                       
+                       // Hook for additional warnings
+                       if (is_array ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['displayWarningMessages'])) {
+                               foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['displayWarningMessages'] as $classRef) {
+                                       $hookObj = &t3lib_div::getUserObj($classRef);
+                                       if (method_exists($hookObj, 'displayWarningMessages_postProcess')) {
+                                               $hookObj->displayWarningMessages_postProcess($warnings);
+                                       }
+                               }
                        }
-
+                       
                        if (count($warnings))   {
                                $style = ' style="margin-bottom:10px;"';
                                $content = '<table border="0" cellpadding="0" cellspacing="0" class="warningbox"><tr><td>'.
                                        $GLOBALS['TBE_TEMPLATE']->icons(3).'Important notice!<br /><ul><li'.$style.'>'.
                                        implode('</li><li'.$style.'>', $warnings).'</li></ul>'.
-                                       'It is highly recommended that you change this immediately.'.
                                        '</td></tr></table>';
 
                                unset($warnings);
index a382653..a00f231 100755 (executable)
@@ -187,6 +187,12 @@ Would you like to save now in order to refresh the display?</label>
                        <label index="cm.copyFolder_into">Copy folder into</label>
                        <label index="cm.moveFolder_into">Move folder into</label>
                        <label index="cm.createNewRelation">Create new relation</label>
+                       <label index="warning.install_password">The Install Tool is still using the default password &quot;joh316&quot;. Update this within the %sAbout section%s of the Install Tool.</label>
+                       <label index="warning.backend_admin">The default backend user "admin" with password &quot;password&quot; is still present. %sEdit this account%s, either deleting it completely or changing the username and password.</label>
+                       <label index="warning.install_enabled">The Install Tool is enabled. Delete the file &quot;%s&quot; when you have finished setting up TYPO3.</label>
+                       <label index="warning.install_encryption">The encryption key is not set. Set it in the %sBasic Configuration section%s of the Install Tool.</label>
+                       <label index="warning.install_update">This installation is not configured for the TYPO3 version it is running. If you did so intentionally, this message can be safely ignored. If you are unsure, visit the %sUpdate Wizard%s section of the Install Tool to see how TYPO3 would change.</label>
+                       <label index="warning.backend_reference">The Reference Index table is empty which is likely the result of a recent TYPO3 upgrade. Please go to %sTools&gt;DB Check%s and update the reference index.</label>
                </languageKey>
        </data>
 </T3locallang>