found missing argument in error func

found missing argument in error func

by William Wright -
Number of replies: 4

Hi i have phped for 14 days to try and work through thisproblem with moodle

Warning: Missing argument 1 for error() in C:\Inetpub\wwwroot\moodle\lib\weblib.php on line 1048

the argument is $message here is the code

function

error ($message, $link="") {
global$CFG, $SESSION;

print_header(get_string(
"error"));
echo"<BR>";
print_simple_box(
$message, "center", "", "#FFBBBB");

if (!$link) {
if ( !empty($SESSION->fromurl) ) {
$link = "$SESSION->fromurl";
unset($SESSION->fromurl);
save_session(
"SESSION");
}
else {
$link = "$CFG->wwwroot";
}
}
print_continue(
$link);
print_footer();
die;
}

martin if you see this what do you think is happening here



' + inobj[objprop] + '\n');
}
op.document.close();
}

function fillmessagebox(text) {
document.form.message.value = text;
}

function openpopup(url,name,height,width) {
fullurl = "http://192.168.1.3/moodle" + url;
options = "menubar=0,location=0,scrollbars,resizable,width="+width+",height="+height;
windowobj = window.open(fullurl,name, options);
windowobj.focus();
}

function copyrichtext(textname) {
textname.value = document.richedit.docHtml;
return true;
}


// done hiding -->

Average of ratings: -
In reply to William Wright

Re: found missing argument in error func

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
OK, the issue here is not so much the function itself, but the page from which the error function is being called (and causing that warning).

Where are you seeing this error message?
In reply to Martin Dougiamas

Re: found missing argument in error func

by William Wright -

the page that is being called is view.php  and just to mention i had been in weblib making adjustments to code  suggested in forum.  I am sure i removed the exact changes i made to get back where i was for welib.php.

To state again the url states i am calling view.php

<?

PHP // $Id: view.php,v 1.30 2003/01/05 14:19:18 moodler Exp $

// Display the course home page.

require_once("../config.php");
require_once("lib.php");

optional_variable(
$id);
optional_variable(
$name);

if (!$id and !$name) {
error(
"Must specify course id or short name");
}

if ($name) {
if (! $course = get_record("course", "shortname", $name) ) {
error(
"That's an invalid short course name");
}
}
else {
if (! $course = get_record("course", "id", $id) ) {
error(
"That's an invalid course id");
}
}

require_login(
$id);

add_to_log(
$course->id, "course", "view", "view.php?id=$course->id", "$course->id");

if (isset($edit)) {
if (isteacher($course->id)) {
if ($edit == "on") {
$USER->editing = true;
}
else if ($edit == "off") {
$USER->editing = false;
}
save_session(
"USER");
}
}

if (isset($help)) {
if ($help == "on") {
$USER->help = true;
}
else if ($help == "off") {
$USER->help = false;
}
save_session(
"USER");
}

$SESSION->fromdiscussion = "$CFG->wwwroot/moodle/course/view.php?id=$course->id";
save_session(
"SESSION");

if (! $course->category) { // This course is not a real course.
redirect(
"$CFG->wwwroot/");
}


$courseword = get_string("course");

print_header(
"$courseword: $course->fullname", "$course->fullname", "$course->shortname", "search.search", "", true,
update_course_icon(
$course->id));

get_all_mods(
$course->id, $mods, $modnames, $modnamesplural, $modnamesused);

if (! $sections = get_all_sections($course->id)) {
$section->course = $course->id; // Create a default section.
$section->section = 0;
$section->id = insert_record("course_sections", $section);
if (! $sections = get_all_sections($course->id) ) {
error(
"Error finding or creating section structures for this course");
}
}

switch ($course->format) {
case "weeks":
include("weeks.php");
break;
case "social":
include("social.php");
break;
case "topics":
include("topics.php");
break;
default:
error(
"Course format not defined yet!");
}

print_footer();

?>
In reply to William Wright

don't want to minimize your value in this project of mine

by William Wright -

i am thinking of asking permission of my supervisor for programmer monies to repair this problem  my class is important to the company i think.  what would be all involved in getting you some monies if you could get your program working.  I saw the paypal donations.  but i would need a concrete rate for what you think it would take to get the program running. if you are offended  than i'll just $50 ya out of my pocket to the pay pal.

but my bigger question is how i can get you exact code so you can proof it

In reply to William Wright

Re: don't want to minimize your value in this project of mine

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
I appreciate the offer - I'll email you privately about a "consulting visit" as it's not appropriate for this forum.