Removing PHP warnings/notices

skala
Julio Montoya 13 years ago
parent f5d9d34cb6
commit c33eb76639
  1. 66
      main/inc/lib/text.lib.php
  2. 7500
      main/inc/lib/tracking.lib.php
  3. 2
      main/newscorm/learnpath.class.php
  4. 20
      main/newscorm/lp_list.php
  5. 21
      main/pages/index.php
  6. 612
      main/work/work.lib.php

@ -396,10 +396,8 @@ function domesticate($input) {
* transformation if it already contains some "<a href:" or "<img src=".
* @param string $text text to be converted
* @return text after conversion
* @author Rewritten by Nathan Codding - Feb 6, 2001.
* completed by Hugues Peeters - July 22, 2002
* See http://php.net/manual/fr/function.eregi-replace.php
*
* Actually this function is taken from the PHP BB 1.4 script
* - Goes through the given string, and replaces xxxx://yyyy with an HTML <a> tag linking
* to that URL
* - Goes through the given string, and replaces www.xxxx.yyyy[zzzz] with an HTML <a> tag linking
@ -408,16 +406,12 @@ function domesticate($input) {
* to that email address
* - Only matches these 2 patterns either after a space, or at the beginning of a line
*
* Notes: the email one might get annoying - it's easy to make it more restrictive, though.. maybe
* have it require something like xxxx@yyyy.zzzz or such. We'll see.
*/
function make_clickable($string) {
// TODO: eregi_replace() is deprecated as of PHP 5.3
if (!stristr($string, ' src=') && !stristr($string, ' href=')) {
$string = eregi_replace("(https?|ftp)://([a-z0-9#?/&=._+:~%-]+)", "<a href=\"\\1://\\2\" target=\"_blank\">\\1://\\2</a>", $string);
$string = eregi_replace("([a-z0-9_.-]+@[a-z0-9.-]+)", "<a href=\"mailto:\\1\">\\1</a>", $string);
}
return $string;
function make_clickable($text) {
$regex = '/(\S+@\S+\.\S+)/i';
$replace = "<a href='mailto:$1'>$1</a>";
$result = preg_replace($regex, $replace, $text);
return preg_replace('@(https?://([-\w\.]+[-\w])+(:\d+)?(/([\w/_\.#-]*(\?\S+)?[^\.\s])?)?)@', '<a href="$1" target="_blank">$1</a>', $result);
}
/**
@ -431,38 +425,6 @@ function make_clickable($string) {
* @version March 2OO6
*/
function text_filter($input, $filter = true) {
//$input = stripslashes($input);
if ($filter) {
// *** parse [tex]...[/tex] tags *** //
// which will return techexplorer or image html depending on the capabilities of the
// browser of the user (using some javascript that checks if the browser has the TechExplorer plugin installed or not)
//$input = _text_parse_tex($input);
// *** parse [teximage]...[/teximage] tags *** //
// these force the gif rendering of LaTeX using the mimetex gif renderer
//$input=_text_parse_tex_image($input);
// *** parse [texexplorer]...[/texexplorer] tags *** //
// these force the texeplorer LaTeX notation
//$input = _text_parse_texexplorer($input);
// *** Censor Words *** //
// censor words. This function removes certain words by [censored]
// this can be usefull when the campus is open to the world.
// $input=text_censor_words($input);
// *** parse [?]...[/?] tags *** //
// for the glossary tool
//$input = _text_parse_glossary($input);
// parse [wiki]...[/wiki] tags
// this is for the coolwiki plugin.
// $input=text_parse_wiki($input);
// parse [tool]...[/tool] tags
// this parse function adds a link to a certain tool
// $input=text_parse_tool($input);
// parse [user]...[/user] tags
// parse [email]...[/email] tags
// parse [code]...[/code] tags
}
return $input;
}
@ -476,17 +438,12 @@ function text_filter($input, $filter = true) {
* @version June 2004
*/
function _text_parse_tex($textext) {
//$textext = str_replace(array ("[tex]", "[/tex]"), array ('[*****]', '[/*****]'), $textext);
//$textext = stripslashes($texttext);
$input_array = preg_split("/(\[tex]|\[\/tex])/", $textext, -1, PREG_SPLIT_DELIM_CAPTURE);
foreach ($input_array as $key => $value) {
if ($key > 0 && $input_array[$key - 1] == '[tex]' AND $input_array[$key + 1] == '[/tex]') {
$input_array[$key] = latex_gif_renderer($value);
unset($input_array[$key - 1]);
unset($input_array[$key + 1]);
//echo 'LaTeX: <embed type="application/x-techexplorer" texdata="'.stripslashes($value).'" autosize="true" pluginspage="http://www.integretechpub.com/techexplorer/"><br />';
}
}
@ -511,7 +468,6 @@ function _text_parse_tool($input) {
// An array with all the valid tools
$tools[] = array(TOOL_ANNOUNCEMENT, 'announcements/announcements.php');
$tools[] = array(TOOL_CALENDAR_EVENT, 'calendar/agenda.php');
// Check if the name between the [tool] [/tool] tags is a valid one
}
@ -664,12 +620,12 @@ function _text_parse_texexplorer($textext) {
}
/**
* This function splits the string into words and then joins them back together again one by one.
* Example: "Test example of a long string"
* substrwords(5) = Test ... *
* @param string
* This function splits the string into words and then joins them back together again one by one.
* Example: "Test example of a long string"
* substrwords(5) = Test ... *
* @param string
* @param int the max number of character
* @param string how the string will be end
* @param string how the string will be end
* @return a reduce string
*/
function substrwords($text, $maxchar, $end = '...') {

File diff suppressed because it is too large Load Diff

@ -2513,6 +2513,7 @@ class learnpath {
$sql = "SELECT count(*) FROM $table WHERE c_id = $course_id AND lp_iv_id = $lp_iv_id";
$res = Database::query($sql);
$res = 0;
$num = 0;
if (Database::num_rows($res)) {
$row = Database::fetch_array($res);
$num = $row[0];
@ -2576,6 +2577,7 @@ class learnpath {
//@todo seems that this always returns 0
$res = Database::query($sql);
$res = 0;
$num = 0;
if (Database::num_rows($res)) {
$row = Database :: fetch_array($res);
$num = $row[0];

@ -206,10 +206,15 @@ if (!empty($flat_list)) {
}
$counter++;
if (($counter % 2) == 0) { $oddclass = 'row_odd'; } else { $oddclass = 'row_even'; }
if (($counter % 2) == 0) {
$oddclass = 'row_odd';
} else {
$oddclass = 'row_even';
}
$url_start_lp = 'lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$id;
$name = Security::remove_XSS($details['lp_name']);
$extra = null;
if ($is_allowed_to_edit) {
$url_start_lp .= '&isStudentView=true';
$dsp_desc = '<em>'.$details['lp_maker'].'</em> '.(learnpath::is_lp_visible_for_student($id, api_get_user_id())?'':' - ('.get_lang('LPNotVisibleToStudent').')');
@ -380,19 +385,6 @@ if (!empty($flat_list)) {
}
}
/* Increase SCORM recording */
/*
if ($details['lp_force_commit'] == 1) {
$dsp_force_commit = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_force_commit&lp_id='.$id.'">' .
'<img src="../img/clock.gif" border="0" alt="Normal SCORM recordings" title="'.get_lang('MakeScormRecordingNormal').'"/>' .
'</a>&nbsp;';
}else{
$dsp_force_commit = '<a href="lp_controller.php?'.api_get_cidreq().'&action=switch_force_commit&lp_id='.$id.'">' .
'<img src="../img/clock_gray.gif" border="0" alt="Extra SCORM recordings" title="'.get_lang('MakeScormRecordingExtra').'"/>' .
'</a>&nbsp;';
}
*/
/* DEBUG */
if ($test_mode == 'test' or api_is_platform_admin()) {

@ -13,6 +13,10 @@ use Pagerfanta\View\TwitterBootstrapView;
//use Pagerfanta\View\DefaultView;
//use Pages\PagesAdmin;
use APY\DataGridBundle\Grid\Grid;
use APY\DataGridBundle\Grid\Source\Entity;
class PagesController {
/*
function indexAction(Application $app, $page) {
@ -83,11 +87,18 @@ class PagesController {
}
function listAction(Application $app, $page = 1) {
/*$app['sonata.crud_controller']->listAction();
require_once 'pageadmin.php';
$pages_admin = new PagesAdmin('a', 'b', 'Controller');
$html = $pages_admin->getDatagrid();
var_dump($html);*/
$source = new Entity('Entity\EntityPages');
$grid = new Grid();
// Attach the source to the grid
$grid->setSource($source);
// Return the response of the grid to the template
//return $grid->getGridResponse('MyProjectMyBundle::myGrid.html.twig');
$em = $app['orm.em'];
$dql = 'SELECT a FROM Entity\EntityPages a';

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save