UPdate zu PHP 5.3: Farbe der Flags ändert nicht mehr [Gelöst]

  • mamo mamo
    R2-D2
    0 x
    113 Beiträge
    0 Hilfreiche Beiträge
    09. 01. 2011, 20:09

    Hallo
    Ich habe eine Website, die seit längere Zeit korrekt funktioniert hat. Nach dem Update auf PHP 5.3 erhielt ich folgende Fehlermeldung:

    t3lib_error_Exception
    PHP : mysql() [function.mysql.php]: This function is deprecated; use mysql_query() instead in /home/myDomain/public_html/t3/fileadmin/scripts/my_languageMenu.php line 40

    Nach längere Suche im Internet fand ich dazu folgende Lösung: Ich ersetzte in der Datei my_languageMenu.php Zeile 40

    1. $res = mysql(TYPO3_db,$query);

    mit
    1. $res = mysql_query(TYPO3_db,$query);

    Die Meldung ist weg, die Seiten werden sowohl in deutsch wie auch in englisch korrekt dargestellt, aber die Länderflagge ändert die Farbe nicht mehr. Deutsch bleibt farbig, ob gewählt oder nicht, englisch bleibt grau. Der Pfeil zeigt korrekt die aktive Seite an.

    Das ist die Datei my_languageMenu.php:

    1. <?php
    2. /***************************************************************
    3. * Copyright notice
    4. *
    5. * (c) 1999-2002 Kasper Skårhøj (kasper@typo3.com)
    6. * All rights reserved
    7. *
    8. * This script is part of the Typo3 project. The Typo3 project is
    9. * free software; you can redistribute it and/or modify
    10. * it under the terms of the GNU General Public License as published by
    11. * the Free Software Foundation; either version 2 of the License, or
    12. * (at your option) any later version.
    13. *
    14. * The GNU General Public License can be found at
    15. * http://www.gnu.org/copyleft/gpl.html.
    16. * A copy is found in the textfile GPL.txt and important notices to the license
    17. * from the author is found in LICENSE.txt distributed with these scripts.
    18. *
    19. *
    20. * This script is distributed in the hope that it will be useful,
    21. * but WITHOUT ANY WARRANTY; without even the implied warranty of
    22. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    23. * GNU General Public License for more details.
    24. *
    25. * This copyright notice MUST APPEAR in all copies of the script!
    26. ***************************************************************/
    27. /**
    28.  * example_languageMenu.php
    29.  *
    30.  * THIS IS AN EXAMPLE designed to work with the official Typo3 testsite, section "Another site in the ..."
    31.  *
    32.  * @author Kasper Skårhøj <kasper@typo3.com>
    33.  */
    34.  
    35.  
    36.  
    37. // First, select all pages_language_overlay records on the current page. Each represents a possibility for a language.
    38. $query = "SELECT * FROM pages_language_overlay WHERE pid=".$GLOBALS["TSFE"]->id.$GLOBALS["TSFE"]->sys_page->enableFields("pages_language_overlay")." GROUP BY sys_language_uid";
    39.  
    40. //$res = mysql(TYPO3_db,$query); //alt
    41. $res = mysql_query(TYPO3_db,$query); //neu
    42. $langArr=array();
    43. while($row=mysql_fetch_assoc($res)) {
    44. $langArr[$row["sys_language_uid"]]=$row["title"];
    45. }
    46.  
    47. // Little red arrow, which is inserted to the left of the flag-icon if the TSFE->sys_language_uid equals the language uid (notice that 0=english, 1=danish and 2=german is SPECIFIC to this database, because these numbers refer to uid's of the table sys_language)
    48. //$pointer = '<img src="t3lib/gfx/content_client.gif" width="7" height="10" align=middle>';
    49. $pointer = '<span class="pointer"><img src="fileadmin/template/images/flags/selected.gif" width="7" height="12"></span>'; //schwarzer Pfeil
    50.  
    51. // Set each icon. If the language is the current, red arrow is printed to the left. If the language is NOT found (represented by a pages_language_overlay record on this page), the icon is dimmed.
    52. //Variante mit Flaggen:
    53. $flags = array();
    54. $flags[] = ($GLOBALS["TSFE"]->sys_language_uid==0?$pointer:"").'<a href="index.php?id='.$GLOBALS["TSFE"]->id.'&L=0" target=_top><img src="fileadmin/template/images/flags/de.gif" width="20" height="12" alt="de"></a><span class="invis">.</span> ';
    55. $flags[] = ($GLOBALS["TSFE"]->sys_language_uid==1?$pointer:"").'<a href="index.php?id='.$GLOBALS["TSFE"]->id.'&L=1" target=_top><img src="fileadmin/template/images/flags/gb'.($langArr[1]?"":"_d").'.gif" width="20" height="12" alt="gb"></a><span class="invis">.</span> ';
    56. //$flags[] = ($GLOBALS["TSFE"]->sys_language_uid==2?$pointer:"").'<a href="index.php?id='.$GLOBALS["TSFE"]->id.'&L=2" target=_top><img src="fileadmin/template/images/flags/fr'.($langArr[2]?"":"_d").'.gif" width="20" height="12"></a></span></a><span class="invis">.</span> ';
    57. //$flags[] = ($GLOBALS["TSFE"]->sys_language_uid==3?$pointer:"").'<a href="index.php?id='.$GLOBALS["TSFE"]->id.'&L=3" target=_top><img src="fileadmin/template/images/flags/es'.($langArr[3]?"":"_d").'.gif" width="20" height="12"></a></span></a><span class="invis">.</span> ';
    58.  
    59. $content = '<span>'.implode("",$flags).'</span>';
    60.  
    61. ?>

    Das übersteigt meine PHP-Kenntnisse. Weiss jemand Rat?
    Besten Dank


  • 1
  • mamo mamo
    R2-D2
    0 x
    113 Beiträge
    0 Hilfreiche Beiträge
    10. 01. 2011, 14:38

    Nach langem Suchen habe ich eine andere Version des Scripts languageMenu.php gefunden. Nach Anpassen der Links funktioniert das bestens. Für alle, die dasselbe Problem haben, hier der neue Code:

    1. <?php
    2. /***************************************************************
    3. * Copyright notice
    4. *
    5. * (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
    6. * All rights reserved
    7. *
    8. * This script is part of the TYPO3 project. The TYPO3 project is
    9. * free software; you can redistribute it and/or modify
    10. * it under the terms of the GNU General Public License as published by
    11. * the Free Software Foundation; either version 2 of the License, or
    12. * (at your option) any later version.
    13. *
    14. * The GNU General Public License can be found at
    15. * http://www.gnu.org/copyleft/gpl.html.
    16. * A copy is found in the textfile GPL.txt and important notices to the license
    17. * from the author is found in LICENSE.txt distributed with these scripts.
    18. *
    19. *
    20. * This script is distributed in the hope that it will be useful,
    21. * but WITHOUT ANY WARRANTY; without even the implied warranty of
    22. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    23. * GNU General Public License for more details.
    24. *
    25. * This copyright notice MUST APPEAR in all copies of the script!
    26. ***************************************************************/
    27. if (!is_object($this)) die ('Error: No parent object present.');
    28.  
    29.  
    30.  
    31. // First, select all pages_language_overlay records on the current page. Each represents a possibility for a language.
    32. $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'pages_language_overlay', 'pid='.intval($GLOBALS['TSFE']->id).$GLOBALS['TSFE']->sys_page->enableFields('pages_language_overlay'), 'sys_language_uid');
    33.  
    34. $langArr = array();
    35. while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
    36. $langArr[$row['sys_language_uid']] = $row['title'];
    37. }
    38.  
    39. // Little red arrow, which is inserted to the left of the flag-icon if the TSFE->sys_language_uid equals the language uid (notice that 0=english, 1=danish and 2=german is SPECIFIC to this database, because these numbers refer to uid's of the table sys_language)
    40. $pointer = '<img src="'.t3lib_extMgm::siteRelPath('cms').'media/icons_misc/content_client.gif" width="7" height="10" align="middle" alt="" />';
    41.  
    42. // Set each icon. If the language is the current, red arrow is printed to the left. If the language is NOT found (represented by a pages_language_overlay record on this page), the icon is dimmed.
    43. $flags = array();
    44. $flags[] = ($GLOBALS['TSFE']->sys_language_uid==0?$pointer:'').'<a href="'.htmlspecialchars('index.php?id='.$GLOBALS['TSFE']->id.'&L=0').'" target="_top"><img src="media/uploads/flag_uk.gif" width="21" height="13" hspace="5" border="0" alt="" /></a>';
    45. $flags[] = ($GLOBALS['TSFE']->sys_language_uid==1?$pointer:'').'<a href="'.htmlspecialchars('index.php?id='.$GLOBALS['TSFE']->id.'&L=1').'" target="_top"><img src="media/uploads/flag_dk'.($langArr[1]?'':'_d').'.gif" width="21" height="13" hspace="5" border="0" alt="" /></a>';
    46. $flags[] = ($GLOBALS['TSFE']->sys_language_uid==2?$pointer:'').'<a href="'.htmlspecialchars('index.php?id='.$GLOBALS['TSFE']->id.'&L=2').'" target="_top"><img src="media/uploads/flag_de'.($langArr[2]?'':'_d').'.gif" width="21" height="13" hspace="5" border="0" alt="" /></a>';
    47.  
    48. // Make the little menu. Notice, the menu does ONLY transfer the page-id and the "L" variable (which is also SPECIFIC for this website because "L" has been used in the extension template used to control the language setup)
    49. $content = '<table border="0" cellpadding="0" cellspacing="0"><tr><td><img src="clear.gif" width="30" height="1" alt="" /></td><td>'.implode('',$flags).'</td></tr></table>';
    50.  
    51. ?>

  • 1