linea21-utils
[ class tree: linea21-utils ] [ index: linea21-utils ] [ all elements ]

Source for file items.php

Documentation is available at items.php

  1. <?php
  2. /**
  3.  * @package linea21.utils
  4.  * @subpackage lib
  5.  * @author linea21 <info@linea21.com>
  6.  * @version $id SVN
  7.  * @access public
  8.  * @license http://opensource.org/licenses/gpl-3.0.html
  9.  */
  10.  
  11.  
  12. /**
  13.  * MyAccount()
  14.  * Renvoie les liens de creation de compte ou de déconnexion
  15.  * suivant le statut de l'utilisateur
  16.  *
  17.  * @return string content
  18.  */
  19. function MyAccount()
  20. {
  21.   $link_account array('rub' => $GLOBALS['links'][LANGUAGE]['user-prefs']['linkvalue']);
  22.   $content  '<div id="myaccount">' END_LINE;
  23.   $content .= '<div id="tologin">' END_LINE;
  24.   $content .= '<a href="' HrefMaker($link_account'" accesskey="u" title="'.$GLOBALS['lang']['header']['myaccount_title'].'"><img src="../gfx/' .THEME_PUBLIC'/images/public/' .LANGUAGE'/menu_myaccount.png" alt="'.$GLOBALS['lang']['header']['myaccount_title'].'" /><span>' $GLOBALS['lang']['header']['myaccount''</span></a>';
  25.   $content .= '</div>' END_LINE;
  26.   $link_create array('rub' => $GLOBALS['links'][LANGUAGE]['user-registration']['linkvalue']);
  27.   $link_logout array('rub' => $GLOBALS['links'][LANGUAGE]['logout']['linkvalue']);
  28.   $content .= '<div id="logout">' END_LINE;
  29.   if (isset($_COOKIE['linea21']['whois'])) $content .= '<a href="' HrefMaker($link_logout'" accesskey="l" title="'.$GLOBALS['lang']['header']['deconnexion_title'].'">' $GLOBALS['lang']['header']['deconnexion''</a>';
  30.   else $content .= '<a href="' HrefMaker($link_create'" accesskey="c" title="'.$GLOBALS['lang']['divers']['user_inscription_title'].'">' $GLOBALS['lang']['divers']['user_inscription''</a>';
  31.   $content .= '</div>' END_LINE;
  32.   $content .= '</div>' END_LINE;
  33.  
  34.   echo $content;
  35. }
  36.  
  37. /**
  38.  * AuthForm()
  39.  * Formulaire d'authentification pour login ou inscription
  40.  *
  41.  * @param string $todo 
  42.  * @return void (echo string)
  43.  */
  44. function AuthForm($todo 'LOGON')
  45. {
  46.  
  47.   if ($todo == 'LOGON'{
  48.     $input_hidden $GLOBALS['links'][LANGUAGE]['user-prefs']['linkvalue'];
  49.     $div_id 'logon';
  50.   else {
  51.     $input_hidden $GLOBALS['links'][LANGUAGE]['user-registration']['linkvalue'];
  52.     $div_id 'subscribe';
  53.   }
  54.   $form '<form action="index.php" method="post">' END_LINE;
  55.   $form .= '<div id="' $div_id '">' END_LINE;
  56.   $form .= '<label for="login" class="labelised">' $GLOBALS['lang']['divers']['login'' : </label>' END_LINE;
  57.   $form .= '<input type="text" maxlength="20" class="shorttextfield" name="login" id="login" />' END_LINE;
  58.   $form .= '<br />'.END_LINE;
  59.   if ($todo == 'LOGON'{
  60.     $form .= '<label for="password" class="labelised">' $GLOBALS['lang']['divers']['password'' : </label>' END_LINE;
  61.     $form .= '<input type="password" maxlength="20" class="shorttextfield" name="password" id="password" />' END_LINE;
  62.   else {
  63.     $form .= '<label for="email" class="labelised">' $GLOBALS['lang']['divers']['email'' : </label>' END_LINE;
  64.     $form .= '<input type="text" maxlength="100" class="shorttextfield" name="email" id="email" />' END_LINE;
  65.   }
  66.   $form .= '<br />'.END_LINE;
  67.   $form .= '<input type="hidden" name="rub" id="rub" value="' $input_hidden '" />' END_LINE;
  68.   $form .= '<input type="image" src="../gfx/' .THEME_PUBLIC'/images/public/btn_go.gif" value="'.$GLOBALS['lang']['btn']['valid'].'" alt="'.$GLOBALS['lang']['btn']['valid'].'" title="'.$GLOBALS['lang']['btn']['valid'].'" size="15" name="valid" id="valid" style="margin-left:30em" />'.END_LINE;
  69.   $form .= '</div>' END_LINE;
  70.   $form .= '</form>' END_LINE;
  71.  
  72.   echo $form;
  73. }
  74.  
  75. /**
  76.  * SetHTMLTitle()
  77.  * Aggregate string
  78.  * to the global array $GLOBALS['current_title']
  79.  * @param $str string
  80.  * @return void 
  81.  */
  82. function SetHTMLTitle($str)
  83. {
  84.   if(count($GLOBALS['current_title']== 0array_push($GLOBALS['current_title']SITE_CITY_NAME);
  85.   array_push($GLOBALS['current_title']$str);
  86. }
  87.  
  88. /**
  89.  * DisplayMenu()
  90.  * Affichage du menu
  91.  *
  92.  * @return void ( echo string )
  93.  */
  94. function DisplayMenu()
  95. {
  96.   $content '<div id="menu">'.END_LINE;
  97.   $content .= '<a href="#contenu" class="semnone" title="'.$GLOBALS['lang']['header']['goto_contents'].'" accesskey="2">'.$GLOBALS['lang']['header']['goto_contents'].'</a>'.END_LINE;
  98.   $content .= '<ul>'.END_LINE;
  99.   while (list($key$valueeach ($GLOBALS['menuitems'])) {
  100.  
  101.     (ActiveItemAlias($GLOBALS['activeitem']== $value$classe ' class="actif"' $classe '' ;
  102.     $current_link array('rub' => $GLOBALS['links'][LANGUAGE][$value]['linkvalue']);
  103.     $content .= '<li id="menu_'.$value.'">';
  104.     $content .= '<a href="' HrefMaker($current_link'" title="' $GLOBALS['links'][LANGUAGE][$value]['desc''" accesskey="' $GLOBALS['links'][LANGUAGE][$value]['accesskey''" id="amenu_'.$value.'"'.$classe.'>' $GLOBALS['links'][LANGUAGE][$value]['title''</a>';
  105.     $content .= '</li>' END_LINE;
  106.   }
  107.   $content .= "</ul>";
  108.   $content .= "</div>";
  109.   echo $content;
  110. }
  111.  
  112.  
  113. /**
  114.  * HrefMaker()
  115.  * Generated a well-formed string URL for SEO
  116.  * if MOD_REWRITE is set to 1
  117.  * Can be override if the given array contains a key
  118.  * named 'rewrite_override'
  119.  * @param array $array 
  120.  * @return string $url_maked
  121.  ***/
  122. function HrefMaker($array)
  123. {
  124.   $url_maked '';
  125.  
  126.   if (defined("MOD_REWRITE"&& MOD_REWRITE == true && !in_array('rewrite_override'$array)) {
  127.     if (array_key_exists('rub'$array)) {
  128.       $url_maked .= $array['rub'];
  129.     }
  130.     if (array_key_exists('filter'$array)) {
  131.       $url_maked .= URI_SEPARATOR '@@'.$array['filter'];
  132.     }
  133.     if (array_key_exists('name'$array)) {
  134.       $url_maked .= URI_SEPARATOR stripText(stripAccents($array['name']))','$array['id'];
  135.     }
  136.     else {
  137.       if (array_key_exists('id'$array)) {
  138.  
  139.         $url_maked .= URI_SEPARATOR $array['id'];
  140.       }
  141.     }
  142.     if (array_key_exists('parentid'$array)) {
  143.       $url_maked .= URI_SEPARATOR $array['parentid'];
  144.     }
  145.     if (array_key_exists('parentparentid'$array)) {
  146.       $url_maked .= URI_SEPARATOR $array['parentparentid'];
  147.     }
  148.     if (array_key_exists('debut'$array)) {
  149.       $url_maked .= URI_SEPARATOR '-' $array['debut''-' ;
  150.     }
  151.     $url_maked .= '.html';
  152.   }
  153.   else
  154.   {
  155.     if(isset($array['name'])) $array['name'stripText(stripAccents($array['name']));
  156.     if(isset($array['rewrite_override'])) unset($array['rewrite_override']);
  157.     if (function_exists('http_build_query')) $url_string http_build_query($array);
  158.     else {
  159.       $url_string '';
  160.       $sep '';
  161.       while (list($key$valueeach ($array)) {
  162.         if (!empty($value)) {
  163.           $url_string .= $sep $key '=' $value;
  164.           $sep OUTPUT_SEP;
  165.         }
  166.       }
  167.     }
  168.     $url_maked 'index.php?' $url_string;
  169.   }
  170.   return $url_maked;
  171. }
  172.  
  173.  
  174. /**
  175.  * DisplayTemplate()
  176.  * Include the required template
  177.  * if no user template is found in /public/
  178.  * includes the /public/dist/ version.
  179.  *
  180.  * @return void 
  181.  ***/
  182. function DisplayTemplate()
  183. {
  184.   $key ActiveItemKey($GLOBALS['activeitem']);
  185.   $current_template $GLOBALS['links'][LANGUAGE][$key]['template'];
  186.   distInclude('tpl_' $current_template '.php');
  187. }
  188.  
  189. /**
  190.  * ActiveItem()
  191.  * Détermine l'item actif et le place en var global
  192.  *
  193.  * @return void 
  194.  */
  195. function ActiveItem()
  196. {
  197.   if (array_key_exists('rub'$_REQUEST)) $GLOBALS['activeitem'$_REQUEST['rub'];
  198.   else $GLOBALS['activeitem'$GLOBALS['links'][LANGUAGE]['home']['linkvalue'];
  199. }
  200.  
  201. /**
  202.  * KeyActiveItems()
  203.  * Return the Active item key
  204.  * @param string $item 
  205.  * @return string 
  206.  ***/
  207. function ActiveItemKey($item)
  208. {
  209.   foreach ($GLOBALS['links'][LANGUAGEas $key => $value{
  210.     if ($GLOBALS['links'][LANGUAGE][$key]['linkvalue'== $item)  return $key;
  211.   }
  212.   return false;
  213. }
  214.  
  215. /**
  216.  * ActiveItemAlias()
  217.  * Return the active item
  218.  * or its alias
  219.  * @param string $item 
  220.  * @return string 
  221.  ***/
  222. function ActiveItemAlias($item)
  223. {
  224.   $key ActiveItemKey($item);
  225.   if ($GLOBALS['links'][LANGUAGE][$key]['alias'=== falsereturn $key;
  226.   else return $GLOBALS['links'][LANGUAGE][$key]['alias'];
  227. }
  228.  
  229. ?>

Documentation generated on Sat, 08 Nov 2008 14:52:41 +0100 by phpDocumentor 1.4.1