Source for file FrontendController.php

Documentation is available at FrontendController.php

  1. <?php
  2.  
  3. /**
  4.  * @package inc
  5.  * @subpackage controller
  6.  */
  7.  
  8. /**
  9.  * Imports
  10.  */
  11. require_once BASEDIR.'/inc/utility/SimpleXMLExtended.php';
  12. require_once BASEDIR.'/inc/utility/CaramelException.php';
  13. require_once BASEDIR.'/inc/model/DatabaseModel.php';
  14. require_once BASEDIR.'/inc/model/ConfigurationModel.php';
  15. require_once BASEDIR.'/inc/view/TemplateView.php';
  16.  
  17. /**
  18.  *
  19.  * FrontendController class
  20.  * 
  21.  * @author Felix Rupp <kontakt@felixrupp.com>
  22.  * @version $Id$
  23.  * @copyright Copyright (c) 2011, Felix Rupp, Nicole Reinhardt
  24.  * @license http://www.opensource.org/licenses/mit-license.php MIT-License
  25.  * @license http://www.gnu.org/licenses/gpl.html GNU GPL
  26.  * 
  27.  * @package inc
  28.  * @subpackage controller
  29.  */
  30.  
  31.     /**
  32.      * @var ConfigurationModel $_config Holds an instance of a Config
  33.      */
  34.     private $_config;
  35.  
  36.     /**
  37.      * @var DatabaseModel $_dataBase Holds the Database
  38.      */
  39.     private $_dataBase;
  40.     
  41.     /**
  42.      * @var TemplateView $_templateView Holds an instance of our TemplatingEngine
  43.      */
  44.     private $_templateView;
  45.     
  46.     /**
  47.      * @var String VERSION Constant for system version
  48.      */
  49.     const VERSION "0.3.0";
  50.     
  51.     /**
  52.      * @var String VERSION Constant for version date
  53.      */
  54.     const VERSION_DATE "2012-09-10";
  55.         
  56.  
  57.     /**
  58.      * Constructor
  59.      * 
  60.      * @return void 
  61.      */
  62.     public function FrontendController({
  63.  
  64.         # Get Configurator 
  65.         $this->_config ConfigurationModel::getConfigurationModel();
  66.         
  67.         # Get TemplatingEngine
  68.         try {
  69.             $this->_templateView new TemplateView($this->_config->getTemplateAction());
  70.         }
  71.         catch(CaramelException $e{
  72.             $e->getDetails();
  73.         }
  74.     
  75.         # Get Database 
  76.         $this->_dataBase DatabaseModel::getDatabaseModel();        
  77.                 
  78.     // End of constructor declaration
  79.     
  80.     
  81.     
  82. # Main content actions:
  83.  
  84.     /**
  85.      * This method assigns needed content to our template engine and renders the template.
  86.      * 
  87.      * @return void 
  88.      */
  89.     public function frontendOutputAction({
  90.         
  91.         $lang $this->getLanguage();
  92.         $pageName $this->getDisplay();
  93.         
  94.         try {
  95.             if(!$pageName// no page is set for display
  96.                 $pageId $this->_config->getConfigStringAction("STARTPAGE");
  97.             }
  98.             else {
  99.                 $pageId $this->_dataBase->getPageId($pageName);
  100.             }
  101.         }
  102.         catch(CaramelException $e{
  103.             $e->getDetails();
  104.         }
  105.         
  106.         try {
  107.             $navigation $this->_dataBase->frontendGetWebsiteNavigationAction($lang)# This is an array with to much information for navigation
  108.             
  109.             # Build navigation links from given information. Returned array is very compact
  110.             $navigation $this->getNavigationLinks($navigation);
  111.             
  112.             $content $this->_dataBase->frontendGetWebsiteContentAction($lang$pageId)# This is a string with our content
  113.         }
  114.         catch(CaramelException $e{
  115.             $e->getDetails();
  116.         }
  117.                 
  118.         $this->_templateView->assign("content"$content);
  119.         $this->_templateView->assign("navigation"$navigation);
  120.         $this->_templateView->assign("languageSelector"$this->getLanguageSelector());
  121.         $this->_templateView->assign("footer"$this->getFooter());
  122.         
  123.         $this->_templateView->renderGzipped();
  124.         
  125.     // End of method declaration
  126.     
  127.     
  128.     
  129.     /**
  130.      * Redirects the user to the language set in browser
  131.      * 
  132.      * @return void 
  133.      */
  134.     public function languageRedirectAction({
  135.         
  136.         if(!isset($_GET['lang'])) {
  137.             
  138.             try {
  139.                 $speakingUrls $this->_config->getConfigStringAction("SPEAKING_URLS");
  140.                 $defaultLanguage $this->_config->getConfigStringAction("DEFAULT_LANGUAGE");
  141.             }
  142.             catch(CaramelException $e{
  143.                 $e->getDetails();
  144.             }
  145.         
  146.             if($speakingUrls == "false"{
  147.         
  148.                 $language explode(',',$_SERVER['HTTP_ACCEPT_LANGUAGE']);
  149.                 $language strtolower(substr(chop($language[0]),0,2));
  150.         
  151.         
  152.                 if(preg_match("/[a-z]{2}/"$language&& in_array($language$this->_dataBase->frontendGetAllLanguagesAction())) {
  153.                     header("Location: ./?lang=".$language);
  154.                 }
  155.                 else {
  156.                     header("Location: ./?lang=".$defaultLanguage);
  157.                 }
  158.         
  159.             }
  160.             elseif($speakingUrls == "true"){
  161.         
  162.                 $language explode(',',$_SERVER['HTTP_ACCEPT_LANGUAGE']);
  163.                 $language strtolower(substr(chop($language[0]),0,2));
  164.         
  165.                 if(preg_match("/[a-z]{2}/"$language&& in_array($language$this->_dataBase->frontendGetAllLanguagesAction())) {
  166.                     header("Location: ./".$language."/");
  167.                 }
  168.                 else {
  169.                     header("Location: ./".$defaultLanguage."/");
  170.                 }
  171.         
  172.             }
  173.         
  174.         }
  175.         
  176.     // End of method declaration
  177.     
  178.     
  179.     
  180.     /**
  181.      * Print out version-information in index.php
  182.      * 
  183.      * @return Version information comment
  184.      */
  185.     public function versionInformationAction({
  186.         
  187.         $comment "<!-- \n######### Caramel CMS\n######### Version: ".self::VERSION."\n######### Release: ".self::VERSION_DATE."\n\n######### Dual-licensed under the MIT-License: http://www.opensource.org/licenses/mit-license.php and the GNU GPL: http://www.gnu.org/licenses/gpl.html\n\n######### Copyright (c) Felix Rupp, Nicole Reinhardt\n\n######### http://www.caramel-cms.com/\n -->\n";
  188.                 
  189.         return $comment;
  190.     
  191.     // End of method declaration
  192.     
  193.     
  194.     
  195.     /**
  196.      * Print out current language code in index.php
  197.      * 
  198.      * @return Language code for current language
  199.      */
  200.     public function languageCodeAction({
  201.      
  202.         return $this->getLanguage();
  203.          
  204.     // End of method declaration
  205.     
  206.      
  207.     
  208.     /**
  209.      * Print out head-tag in index.php
  210.      * 
  211.      * @return Whole head-tag
  212.      */    
  213.     public function headTagAction({
  214.         
  215.         $metaGenerator "<meta name=\"generator\" content=\"Caramel CMS\">";
  216.         
  217.         $lang $this->getLanguage();
  218.         $pageName $this->getDisplay();
  219.         
  220.         try {
  221.             
  222.             $metaRobots '<meta name="robots" content="'.$this->_config->getConfigStringAction('ROBOTS').'">';
  223.                         
  224.             if(!$pageName// no page is set for display
  225.                 $pageId $this->_config->getConfigStringAction("STARTPAGE");
  226.             else {
  227.                 $pageId $this->_dataBase->getPageId($pageName);
  228.             }
  229.             
  230.             $meta $this->_dataBase->frontendGetAllMetaTagsAction($lang$pageId).$metaRobots."\n".$metaGenerator."\n";
  231.         
  232.             $title $this->_config->getConfigStringAction("WEBSITE_TITLE").$this->_config->getConfigStringAction("WEBSITE_TITLE_SEPERATOR").$this->_dataBase->frontendGetWebsiteTitleAction($lang$pageId);
  233.         
  234.         }
  235.         catch(CaramelException $e{
  236.             $e->getDetails();
  237.         }
  238.         
  239.         $headTag $this->getBaseUrl()."\n<meta charset=\"utf-8\">\n\n".$meta."\n\n<title>".$title."</title>\n\n";
  240.         
  241.         
  242.         try {
  243.         
  244.             $additionalCssFile $this->_dataBase->frontendGetPageAdditionalCss($pageId);
  245.             if(strlen($additionalCssFile1{        
  246.                 $this->_templateView->addCssFile($additionalCssFile);
  247.             }
  248.         
  249.         
  250.             $additionalJsFile $this->_dataBase->frontendGetPageAdditionalJs($pageId);
  251.             if(strlen($additionalJsFile1{
  252.                 $this->_templateView->addJsFile($additionalJsFile);
  253.             }
  254.         }
  255.         catch(CaramelException $e{
  256.             $e->getDetails();
  257.         }
  258.         
  259.         
  260.         $headTag .= $this->_templateView->addCssJs();
  261.         
  262.         return $headTag;
  263.         
  264.     // End of method declaration
  265.  
  266.  
  267.     
  268.     
  269.     
  270.     
  271. ##################################################
  272. ### Helper functions:
  273. ##################################################
  274.  
  275.     
  276.     /**
  277.      * This method build our navigation links from given information
  278.      * Note: Navigation is restricted to one sublevel
  279.      * 
  280.      * @param array $navigationArray Array with detailed navigation information
  281.      * 
  282.      * @return Array with link information for navigation
  283.      */
  284.     private function getNavigationLinks($navigationArray{
  285.         
  286.         $navigation array();
  287.         
  288.         # Get Parameters before ampersand
  289.         $newQueryString $this->getParametersBefore();
  290.             
  291.         # Concatenate link for navigation
  292.         $naviLink (empty($_SERVER['QUERY_STRING']'?' $newQueryString).'display=';
  293.     
  294.         # Set navigation class
  295.         try {
  296.             $navClass $this->_config->getConfigStringAction("NAVIGATION_CLASS");
  297.             
  298.             if($navClass !=""{
  299.                 $navigationClass ' class="'.$this->_config->getConfigStringAction("NAVIGATION_CLASS");
  300.             else {
  301.                 $navigationClass "";
  302.             }
  303.             
  304.         }
  305.         catch(CaramelException $e{
  306.             $e->getDetails();
  307.         }
  308.         
  309.         
  310.         # Test if STARTPAGE is active or not
  311.         $pageName $this->getDisplay();
  312.                 
  313.         try {
  314.             if(!$pageName{
  315.                 // no page is set for display
  316.                 $pageId intval($this->_config->getConfigStringAction("STARTPAGE"));
  317.             }
  318.             else {
  319.                 $pageId intval($this->_dataBase->getPageId($pageName));
  320.             }
  321.         }
  322.         catch(CaramelException $e{
  323.             $e->getDetails();
  324.         }
  325.  
  326.         
  327.         
  328.         # For loop to build nav links
  329.         foreach($navigationArray as $navPageId => $page{
  330.             
  331.             # Active Marker
  332.             if(intval($navPageId== $pageId{
  333.             
  334.                 try {
  335.                     $active $this->_config->getConfigStringAction("NAVIGATION_ACTIVE_MARKER");
  336.                     
  337.                     if(strlen($navigationClass)<1# No navigationClass set
  338.                         $activeClass ' class="'.$this->_config->getConfigStringAction("NAVIGATION_ACTIVE_CLASS").'"';
  339.                     }
  340.                     else # navigationClass set
  341.                         $activeClass " ".$this->_config->getConfigStringAction("NAVIGATION_ACTIVE_CLASS").'"';
  342.                     }
  343.                 }
  344.                 catch(CaramelException $e{
  345.                     $e->getDetails();
  346.                 }
  347.                 
  348.             
  349.             else {
  350.                 $active "";
  351.                 
  352.                 if(strlen($navigationClass)<1{
  353.                     # No navigationClass set
  354.                     $activeClass "";
  355.                 }
  356.                 else # navigationClass set
  357.                     $activeClass '"';
  358.                 }
  359.                 
  360.             }
  361.             
  362.             # Build navigation link
  363.             if($page["visible"]=="true"# false values are not appearing in standard navigation
  364.                 
  365.                 $link "<a";
  366.                 
  367.                 # Set navigation class
  368.                 $link .= $navigationClass.$activeClass;
  369.                 
  370.                 # Define link-syntax (speaking urls or not)
  371.                 try {
  372.                     if($this->_config->getConfigStringAction("SPEAKING_URLS"== "false"{
  373.                         $link .= " href=\"".$naviLink.$page["path"]."\"";
  374.                     }
  375.                     elseif($this->_config->getConfigStringAction("SPEAKING_URLS"== "true"{
  376.                         $link .= " href=\"".$this->getParametersBefore().'/'.$page["path"]."/\"";
  377.                     }
  378.                 }
  379.                 catch(CaramelException $e{
  380.                     $e->getDetails();
  381.                 }
  382.                 
  383.                 # Set rel-attribute
  384.                 # DEACTIVATED BECAUSE OF HTML5 DOCTYPE
  385.                 #if($this->_config->getConfigStringAction("NAVIGATION_REL") !="disabled") {
  386.                 #    $link .= $this->_config->getConfigStringAction("NAVIGATION_REL");
  387.                 #}
  388.                 
  389.                 $link .= " title=\"".$page["titletag"]."\">";
  390.                 
  391.                 # Evaluate position of NAVIGATION_ACTIVE_MARKER
  392.                 try {
  393.                     if($this->_config->getConfigStringAction("NAVIGATION_ACTIVE_MARKER_POSITION"== "before"{
  394.                         $link .= $active.$page["navigation"];
  395.                     }
  396.                     elseif($this->_config->getConfigStringAction("NAVIGATION_ACTIVE_MARKER_POSITION"== "after"{
  397.                         $link .= $page["navigation"].$active;
  398.                     }
  399.                     elseif($this->_config->getConfigStringAction("NAVIGATION_ACTIVE_MARKER_POSITION"== "disabled"{
  400.                         $link .= $page["navigation"];
  401.                     }
  402.                 }
  403.                 catch(CaramelException $e{
  404.                     $e->getDetails();
  405.                 }
  406.                 
  407.                 $link .="</a>";
  408.                 
  409.                 $navigation[$navPageId]["path"$page["path"];
  410.                 $navigation[$navPageId]["link"$link;
  411.                 
  412.                 
  413.                 # Subpage links
  414.                 
  415.                 foreach($page["subpages"as $subPageId => $page{
  416.                     
  417.                     # Active Marker
  418.                     if(intval($subPageId== $pageId{
  419.                     
  420.                         try {
  421.                             $active $this->_config->getConfigStringAction("NAVIGATION_ACTIVE_MARKER");
  422.                             
  423.                             if(strlen($navigationClass)<1# No navigationClass set
  424.                                 $activeClass ' class="'.$this->_config->getConfigStringAction("NAVIGATION_ACTIVE_CLASS").'"';
  425.                             }
  426.                             else # navigationClass set
  427.                                 $activeClass " ".$this->_config->getConfigStringAction("NAVIGATION_ACTIVE_CLASS").'"';
  428.                             }
  429.                         }
  430.                         catch(CaramelException $e{
  431.                             $e->getDetails();
  432.                         }
  433.                         
  434.                     
  435.                     else {
  436.                         $active "";
  437.                         
  438.                         if(strlen($navigationClass)<1{
  439.                             # No navigationClass set
  440.                             $activeClass "";
  441.                         }
  442.                         else # navigationClass set
  443.                             $activeClass '"';
  444.                         }
  445.                         
  446.                     }
  447.                         
  448.                     # Build navigation link
  449.                     if($page["visible"]=="true"# false values are not appearing in standard navigation
  450.                     
  451.                         $link "<a";
  452.                     
  453.                         # Set navigation class
  454.                         $link .= $navigationClass;
  455.                     
  456.                         # Define link-syntax (speaking urls or not)
  457.                         try {
  458.                             if($this->_config->getConfigStringAction("SPEAKING_URLS"== "false"{
  459.                                 $link .= " href=\"".$naviLink.$page["path"]."\"";
  460.                             }
  461.                             elseif($this->_config->getConfigStringAction("SPEAKING_URLS"== "true"{
  462.                                 $link .= " href=\"".$this->getParametersBefore().'/'.$page["path"]."/\"";
  463.                             }
  464.                         }
  465.                         catch(CaramelException $e{
  466.                             $e->getDetails();
  467.                         }
  468.                     
  469.                                     
  470.                         # Set rel-attribute
  471.                         # DEACTIVATED BECAUSE OF HTML5 DOCTYPE
  472.                         #if($this->_config->getConfigStringAction("NAVIGATION_REL") !="disabled") {
  473.                         #    $link .= $this->_config->getConfigStringAction("NAVIGATION_REL");
  474.                         #}
  475.                     
  476.                         $link .= " title=\"".$page["titletag"]."\">";
  477.                     
  478.                         # Evaluate position of NAVIGATION_ACTIVE_MARKER
  479.                         try {
  480.                             if($this->_config->getConfigStringAction("NAVIGATION_ACTIVE_MARKER_POSITION"== "before"{
  481.                                 $link .= $active.$page["navigation"];
  482.                             }
  483.                             elseif($this->_config->getConfigStringAction("NAVIGATION_ACTIVE_MARKER_POSITION"== "after"{
  484.                                 $link .= $page["navigation"].$active;
  485.                             }
  486.                             elseif($this->_config->getConfigStringAction("NAVIGATION_ACTIVE_MARKER_POSITION"== "disabled"{
  487.                                 $link .= $page["navigation"];
  488.                             }
  489.                         }
  490.                         catch(CaramelException $e{
  491.                             $e->getDetails();
  492.                         }
  493.                     
  494.                         $link .="</a>";
  495.                     
  496.                         $navigation[$pageId]["subpages"][$subPageId]["path"$page["path"];
  497.                         $navigation[$pageId]["subpages"][$subPageId]["link"$link;
  498.                     
  499.                     }
  500.                 }
  501.                 
  502.                 
  503.             }            
  504.             
  505.         }
  506.                 
  507.         return $navigation;
  508.         
  509.     // End of method declaration
  510.     
  511.         
  512.     
  513.     /**
  514.      * Print out language selector in index.php
  515.      * 
  516.      * @return All language selectors
  517.      */
  518.     private function getLanguageSelector({
  519.         
  520.         $selectorLinks array();
  521.         
  522.         try {
  523.             $allLangs $this->_dataBase->frontendGetAllLanguagesAction();
  524.         }
  525.         catch(CaramelException $e{
  526.             $e->getDetails();
  527.         }
  528.         
  529.         foreach($allLangs as $langCode{
  530.             
  531.             if($this->getLanguage(!= $langCode{
  532.             
  533.                 # Get Parameters before ampersand
  534.                 $newQueryString $this->getParametersBehind();
  535.                 
  536.                 try {
  537.                     $speakingUrls $this->_config->getConfigStringAction("SPEAKING_URLS");
  538.                 }
  539.                 catch(CaramelException $e{
  540.                     $e->getDetails();
  541.                 }
  542.                 
  543.                 if($speakingUrls == "false"{
  544.                     array_push($selectorLinks'<a title="" href="?lang=en'.$newQueryString.'">'.strtoupper($langCode).'</a>');
  545.                 }
  546.                 elseif($speakingUrls == "true"{
  547.                     array_push($selectorLinks'<a title="" href="'.substr($_SERVER['REQUEST_URI']0strpos($_SERVER['REQUEST_URI']$this->getLanguage())).$langCode.$newQueryString.'">'.strtoupper($langCode).'</a>');
  548.                 }    
  549.  
  550.             else {
  551.                 array_push($selectorLinksstrtoupper($langCode));
  552.             }
  553.         }
  554.         
  555.         $languageSelector "";
  556.         
  557.         if(count($selectorLinks1{
  558.             foreach($selectorLinks as $key => $link{
  559.             
  560.                 if($key == count($selectorLinks)-1{
  561.                     $languageSelector .= $link;
  562.                 else {
  563.                     
  564.                     try {
  565.                         $languageSelector .= $link.$this->_config->getConfigStringAction("LANGUAGE_SELECTOR_SEPERATOR");
  566.                     }
  567.                     catch(CaramelException $e{
  568.                         $e->getDetails();
  569.                     }
  570.                 }
  571.             }
  572.         }
  573.         
  574.         return "\t".$languageSelector."\n";    
  575.         
  576.     // End of method declaration
  577.     
  578.     
  579.     
  580.     /**
  581.      * Print out footer in footer of index.php
  582.      * 
  583.      * @return Website footer
  584.      */
  585.     private function getFooter({
  586.  
  587.         $languageSelector "";
  588.         
  589.         try {
  590.             $langSelectInFooter $this->_config->getConfigStringAction("LANGUAGE_SELECTOR_IN_FOOTER");
  591.         }
  592.         catch(CaramelException $e{
  593.             $e->getDetails();
  594.         }
  595.         
  596.         if($langSelectInFooter == 'true'{
  597.             $languageSelector $this->getLanguageSelector()."&nbsp;";
  598.         }
  599.         
  600.         $footer $languageSelector;
  601.         
  602.         return $footer;
  603.     
  604.     // End of method declaration
  605.     
  606.  
  607.  
  608.     /**
  609.      * Extract language from GET-query
  610.      * 
  611.      * @return Actual language
  612.      */
  613.     private function getLanguage({
  614.         
  615.         try {
  616.             $allLangs $this->_dataBase->frontendGetAllLanguagesAction();
  617.             $defaultLanguage $this->_config->getConfigStringAction("DEFAULT_LANGUAGE");
  618.         }
  619.         catch(CaramelException $e{
  620.             $e->getDetails();
  621.         }
  622.             
  623.         if(isset($_GET['lang']&& in_array($_GET['lang']$allLangs)) # Test if set language is in our language array
  624.             $language $_GET['lang'];
  625.         }
  626.         else {
  627.             $language $defaultLanguage;
  628.         }
  629.         
  630.         return $language;
  631.         
  632.     // End of method declaration
  633.     
  634.     
  635.     
  636.     /**
  637.      * Get display from GET-query
  638.      * 
  639.      * @return Actual page displayed
  640.      */
  641.     private function getDisplay({
  642.         
  643.         if(isset($_GET['display'])) {
  644.             
  645.             $display $_GET['display'];
  646.             
  647.         }
  648.         else {
  649.             $display FALSE;
  650.         }
  651.         
  652.         return $display;
  653.         
  654.     // End of method declaration
  655.     
  656.     
  657.     
  658.     /**
  659.      * Get parameters of GET-query before ampersand
  660.      * 
  661.      * @return New querystring for building correct URL
  662.      */
  663.     private function getParametersBefore({
  664.         $serverQueryString $_SERVER['QUERY_STRING'];
  665.                     
  666.         try {
  667.             $speakingUrls $this->_config->getConfigStringAction("SPEAKING_URLS");
  668.         }
  669.         catch(CaramelException $e{
  670.             $e->getDetails();
  671.         }
  672.             
  673.         if($speakingUrls == "false"{
  674.                 
  675.             if(preg_match('/lang/',$serverQueryString)) {        
  676.                 $newQueryString '?'.substr($serverQueryString,0,7).'&amp;';
  677.             }
  678.             elseif (!preg_match('/lang/',$serverQueryStringand preg_match('/display/',$serverQueryString)) {
  679.                 $newQueryString '?';
  680.             }
  681.             else {
  682.                 $newQueryString '';
  683.             }
  684.             
  685.         }
  686.         
  687.         if($speakingUrls == "true"{
  688.             $newQueryString substr($_SERVER['REQUEST_URI']0strpos($_SERVER['REQUEST_URI']$this->getLanguage())+strlen($this->getLanguage()));
  689.         }
  690.         
  691.         return $newQueryString;
  692.         
  693.     // End of method declaration
  694.     
  695.     
  696.     
  697.     /**
  698.      * Get parameters of GET-query behind ampersand
  699.      * 
  700.      * @return New querystring for building correct URL
  701.      */
  702.     private function getParametersBehind({
  703.         $serverQueryString $_SERVER['QUERY_STRING'];
  704.                     
  705.         try {
  706.             $speakingUrls $this->_config->getConfigStringAction("SPEAKING_URLS");
  707.         }
  708.         catch(CaramelException $e{
  709.             $e->getDetails();
  710.         }
  711.             
  712.         if($speakingUrls == "false"{
  713.         
  714.             if(preg_match('/lang/',$serverQueryString)) {                
  715.                         
  716.                 if(preg_match('/display/',$serverQueryString)) {
  717.                     $ampZeichen '&amp;';
  718.                 }
  719.                 else {
  720.                     $ampZeichen '';
  721.                 }
  722.                 $newQueryString $ampZeichen.substr($serverQueryString,8);
  723.             }
  724.             elseif (preg_match('/display/',$serverQueryStringAND !preg_match('/lang/',$serverQueryString)) {
  725.                 $newQueryString '&amp;'.substr($serverQueryString,0);
  726.             }
  727.             else {
  728.                 $newQueryString '';
  729.             }
  730.             
  731.             return $newQueryString;
  732.             
  733.         }
  734.         
  735.         elseif($speakingUrls == "true"{
  736.                 
  737.             if(isset($_GET['display'])) {
  738.                 $newQueryString '/'.substr($serverQueryString,16).'/';
  739.             else {
  740.                 $newQueryString '/'.substr($serverQueryString,16);
  741.             }
  742.             
  743.             return $newQueryString;
  744.             
  745.         }
  746.         
  747.     // End of method declaration
  748.     
  749.     
  750.     
  751.     /**
  752.      * Print out base url in index.php
  753.      * 
  754.      * @return The Base-URL
  755.      */
  756.     private function getBaseUrl({
  757.     
  758.         try {
  759.             $speakingUrls $this->_config->getConfigStringAction("SPEAKING_URLS");
  760.         }
  761.         catch(CaramelException $e{
  762.             $e->getDetails();
  763.         }
  764.             
  765.         if($speakingUrls == "true"{
  766.             
  767.             try {
  768.                 return "<base href=\"".$this->_config->getConfigStringAction('BASE')."\">\n";
  769.             }
  770.             catch(CaramelException $e{
  771.                 $e->getDetails();
  772.             }
  773.             
  774.         else {
  775.             return "";
  776.         }
  777.         
  778.     // End of method declaration
  779.  
  780.  
  781. // End of class declaration
  782.  
  783. ?>