[ Index ]
 

Code source de Mantis 1.1.0rc3

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/core/ -> prepare_api.php (source)

   1  <?php
   2  # Mantis - a php based bugtracking system
   3  
   4  # Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
   5  # Copyright (C) 2002 - 2007  Mantis Team   - mantisbt-dev@lists.sourceforge.net
   6  
   7  # Mantis is free software: you can redistribute it and/or modify
   8  # it under the terms of the GNU General Public License as published by
   9  # the Free Software Foundation, either version 2 of the License, or
  10  # (at your option) any later version.
  11  #
  12  # Mantis is distributed in the hope that it will be useful,
  13  # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15  # GNU General Public License for more details.
  16  #
  17  # You should have received a copy of the GNU General Public License
  18  # along with Mantis.  If not, see <http://www.gnu.org/licenses/>.
  19  
  20      # --------------------------------------------------------
  21      # $Id: prepare_api.php,v 1.2.2.1 2007-10-13 22:35:38 giallu Exp $
  22      # --------------------------------------------------------
  23  
  24      $t_core_dir = dirname( __FILE__ ).DIRECTORY_SEPARATOR;
  25  
  26      ### Prepare API ###
  27  
  28      # this file handles preparing of strings like to be printed
  29      # or stored.  print_api.php will gradually be replaced by
  30      # think calls to echo the results of functions implemented here.
  31  
  32      # --------------------
  33      # return the mailto: href string link
  34  	function prepare_email_link( $p_email, $p_text ) {
  35          if ( !access_has_project_level( config_get( 'show_user_email_threshold' ) ) ) {
  36              return $p_text;
  37          }
  38  
  39          # If we apply string_url() to the whole mailto: link then the @
  40          #  gets turned into a %40 and you can't right click in browsers to
  41          #  do Copy Email Address.
  42          $t_mailto    = string_attribute( "mailto:$p_email" );
  43          $p_text        = string_display( $p_text );
  44  
  45          return "<a href=\"$t_mailto\">$p_text</a>";
  46      }
  47  
  48      # --------------------
  49      # prepares the name of the user given the id.  also makes it an email link.
  50  	function prepare_user_name( $p_user_id ) {
  51          # Catch a user_id of NO_USER (like when a handler hasn't been assigned)
  52          if ( NO_USER == $p_user_id ) {
  53              return '';
  54          }
  55  
  56          $t_username = user_get_name( $p_user_id );
  57          if ( user_exists( $p_user_id ) && user_get_field( $p_user_id, 'enabled' ) ) {
  58              $t_email = user_get_email( $p_user_id );
  59              if ( !is_blank( $t_email ) ) {
  60                  return prepare_email_link( $t_email, $t_username );
  61              } else {
  62                  return string_display( $t_username );
  63              }
  64          } else {
  65              $t_result = '<font STYLE="text-decoration: line-through">';
  66              $t_result .= string_display( $t_username );
  67              $t_result .= '</font>';
  68              return $t_result;
  69          }
  70      }


Généré le : Thu Nov 29 09:42:17 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics