[svn r20682] FS#306 - Replacing some natural language unsafe occurrences of the functions strlen() and substr(). Fixing a call to a non-existing function.

skala
Ivan Tcholakov 16 years ago
parent ccacc9fa78
commit e5b8c9b669
  1. 4
      main/admin/calendar.lib.php
  2. 2
      main/forum/viewforumcategory.php
  3. 4
      main/inc/lib/pear/HTML/QuickForm/date.php
  4. 10
      main/inc/lib/text.lib.php
  5. 2
      main/mySpace/user_import.php
  6. 6
      main/survey/survey.php

@ -2008,7 +2008,7 @@ function get_day_agendaitems($courses_dbs, $month, $year, $day)
if ($setting_agenda_link == 'coursecode')
{
$title=$array_course_info['title'];
$agenda_link = substr($title, 0, 14);
$agenda_link = api_substr($title, 0, 14);
}
else
{
@ -2110,7 +2110,7 @@ function get_week_agendaitems($courses_dbs, $month, $year, $week = '')
if ($setting_agenda_link == 'coursecode')
{
$title=$array_course_info['title'];
$agenda_link = substr($title, 0, 14);
$agenda_link = api_substr($title, 0, 14);
}
else
{

@ -350,7 +350,7 @@ if ($action_forums!='add') {
{
$my_all_groups_forum_name=isset($all_groups[$forum['forum_of_group']]['name']) ? $all_groups[$forum['forum_of_group']]['name'] : null;
$my_all_groups_forum_id=isset($all_groups[$forum['forum_of_group']]['id']) ? $all_groups[$forum['forum_of_group']]['id'] : null;
$group_title=substr($my_all_groups_forum_name,0,30);
$group_title=api_substr($my_all_groups_forum_name,0,30);
$forum_title_group_addition=' (<a href="../group/group_space.php?'.api_get_cidreq().'&gidReq='.$my_all_groups_forum_id.'" class="forum_group_link">'.get_lang('GoTo').' '.$group_title.'</a>)';
}
else

@ -18,7 +18,7 @@
// | Bertrand Mansion <bmansion@mamasam.com> |
// +----------------------------------------------------------------------+
//
// $Id: date.php 20456 2009-05-10 17:27:44Z ivantcholakov $
// $Id: date.php 20682 2009-05-15 11:11:07Z ivantcholakov $
require_once 'HTML/QuickForm/group.php';
require_once 'HTML/QuickForm/select.php';
@ -299,7 +299,7 @@ class HTML_QuickForm_date extends HTML_QuickForm_group
$backslash = false;
for ($i = 0, $length = api_strlen($this->_options['format']); $i < $length; $i++) {
//$sign = $this->_options['format']{$i};
$sign = api_get_character($this->_options['format'], $i);
$sign = api_substr($this->_options['format'], $i, 1);
if ($backslash) {
$backslash = false;
$separator .= $sign;

@ -1,4 +1,4 @@
<?php // $Id: text.lib.php 20574 2009-05-13 00:06:48Z cfasanando $
<?php // $Id: text.lib.php 20682 2009-05-15 11:11:07Z ivantcholakov $
/* For licensing terms, see /dokeos_license.txt */
/**
==============================================================================
@ -398,11 +398,11 @@ function date_to_str_ago($date)
* */
function cut($text,$maxchar,$embed=false)
{
if (strlen($text) > $maxchar) {
if (api_strlen($text) > $maxchar) {
if ($embed==true) {
return '<span title="'.$text.'">'.substr($text, 0, $maxchar).'...</span>';
return '<span title="'.$text.'">'.api_substr($text, 0, $maxchar).'...</span>';
}
return substr($text, 0, $maxchar).'...' ;
return api_substr($text, 0, $maxchar).'...' ;
} else {
return $text;
}
@ -430,4 +430,4 @@ function float_format($number, $flag = 1)
}
}
?>
?>

@ -43,7 +43,7 @@ function make_login($firstname,$lastname)
}
else
{
$desired_username = api_substr($firstname,0,1).substr($lastname,0,16);
$desired_username = api_substr($firstname,0,1).api_substr($lastname,0,16);
}
return api_strtolower($desired_username);
}

@ -1,4 +1,4 @@
<?php // $Id: survey.php 20494 2009-05-11 20:41:53Z juliomontoya $
<?php // $Id: survey.php 20682 2009-05-15 11:11:07Z ivantcholakov $
/*
==============================================================================
Dokeos - elearning and course management software
@ -23,7 +23,7 @@
* @package dokeos.survey
* @author unknown
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University: cleanup, refactoring and rewriting large parts of the code
* @version $Id: survey.php 20494 2009-05-11 20:41:53Z juliomontoya $
* @version $Id: survey.php 20682 2009-05-15 11:11:07Z ivantcholakov $
*
* @todo use quickforms for the forms
*/
@ -78,7 +78,7 @@ if (isset($_GET['survey_id'])) {
if (api_substr($survey_data['title'],0,3)!='<p>'){
$tool_name = strip_tags(api_substr(api_html_entity_decode($survey_data['title'],ENT_QUOTES,$charset), 0, 40));
}else{
$tool_name = strip_tags(api_substr(api_html_entity_decode(substr($survey_data['title'],3,-4),ENT_QUOTES,$charset), 0, 40));
$tool_name = strip_tags(api_substr(api_html_entity_decode(api_substr($survey_data['title'],3,-4),ENT_QUOTES,$charset), 0, 40));
}
$is_survey_type_1 = ($survey_data['survey_type']==1)?true:false;
if (api_strlen(strip_tags($survey_data['title'])) > 40)

Loading…
Cancel
Save