FIxed to use the new debugging function

This commit is contained in:
moodler
2006-09-18 09:13:04 +00:00
parent 65becbc3ef
commit fdb1cf2cc1
21 changed files with 50 additions and 96 deletions
+1 -1
View File
@@ -338,7 +338,7 @@
//Update record
$assignment->description = addslashes($result);
$status = update_record("assignment",$assignment);
if ($CFG->debug>7) {
if (debugging()) {
if (!defined('RESTORE_SILENTLY')) {
echo '<br /><hr />'.s($content).'<br />changed to<br />'.s($result).'<hr /><br />';
}
+1 -1
View File
@@ -231,7 +231,7 @@
//Update record
$chat->intro = addslashes($result);
$status = update_record("chat",$chat);
if ($CFG->debug>7) {
if (debugging()) {
if (!defined('RESTORE_SILENTLY')) {
echo '<br /><hr />'.s($content).'<br />changed to<br />'.s($result).'<hr /><br />';
}
+1 -1
View File
@@ -363,7 +363,7 @@ function choice_options_restore_mods($choiceid,$info,$restore) {
//Update record
$choice->text = addslashes($result);
$status = update_record("choice",$choice);
if ($CFG->debug>7) {
if (debugging()) {
if (!defined('RESTORE_SILENTLY')) {
echo '<br /><hr />'.s($content).'<br />changed to<br />'.s($result).'<hr /><br />';
}
-2
View File
@@ -14,8 +14,6 @@
error("Guests are not allowed to rate posts.", $_SERVER["HTTP_REFERER"]);
}
$CFG->debug = 0; /// Temporarily
$returntoview = false;
if (($data = data_submitted($CFG->wwwroot.'/mod/data/view.php')) and confirm_sesskey()) {
+2 -8
View File
@@ -13,17 +13,11 @@
// Check CFG->enablerssfeeds.
if (empty($CFG->enablerssfeeds)) {
//Some debug...
if ($CFG->debug > 7) {
echo "DISABLED (admin variables)";
}
debugging("DISABLED (admin variables)");
}
// Check CFG->data_enablerssfeeds.
else if (empty($CFG->data_enablerssfeeds)) {
//Some debug...
if ($CFG->debug > 7) {
echo "DISABLED (module configuration)";
}
debugging("DISABLED (module configuration)");
}
// It's working so we start...
else {
-1
View File
@@ -27,7 +27,6 @@
require_login($course->id);
$CFG->debug = 0; /// Temporarily
$returntoview = false;
if (!$data = data_submitted("$CFG->wwwroot/mod/forum/discuss.php")) { // form submitted
+2 -2
View File
@@ -1134,7 +1134,7 @@
//Update record
$post->message = addslashes($result);
$status = update_record("forum_posts",$post);
if ($CFG->debug>7) {
if (debugging()) {
if (!defined('RESTORE_SILENTLY')) {
echo '<br /><hr />'.s($content).'<br />changed to<br />'.s($result).'<hr /><br />';
}
@@ -1168,7 +1168,7 @@
//Update record
$forum->intro = addslashes($result);
$status = update_record("forum",$forum);
if ($CFG->debug>7) {
if (debugging()) {
if (!defined('RESTORE_SILENTLY')) {
echo '<br /><hr />'.s($content).'<br />changed to<br />'.s($result).'<hr /><br />';
}
+8 -25
View File
@@ -12,16 +12,10 @@
//Check CFG->enablerssfeeds
if (empty($CFG->enablerssfeeds)) {
//Some debug...
if ($CFG->debug > 7) {
echo "DISABLED (admin variables)";
}
debugging('DISABLED (admin variables)');
//Check CFG->forum_enablerssfeeds
} else if (empty($CFG->forum_enablerssfeeds)) {
//Some debug...
if ($CFG->debug > 7) {
echo "DISABLED (module configuration)";
}
debugging('DISABLED (module configuration)');
//It's working so we start...
} else {
//Iterate over all forums
@@ -50,25 +44,20 @@
mtrace("Updating RSS feed for ".format_string($forum->name,true).", ID: $forum->id");
//Some debug...
if ($CFG->debug > 7) {
echo "ID: $forum->id->";
}
//Get the XML contents
$result = forum_rss_feed($forum);
//Save the XML contents to file
if (!empty($result)) {
$status = rss_save_file("forum",$forum,$result);
}
//Some debug...
if ($CFG->debug > 7) {
if (debugging()) {
if (empty($result)) {
echo "(empty) ";
echo "ID: $forum->id-> (empty) ";
} else {
if (!empty($status)) {
echo "OK ";
echo "ID: $forum->id-> OK ";
} else {
echo "FAIL ";
echo "ID: $forum->id-> FAIL ";
}
}
}
@@ -100,16 +89,10 @@
//Check CFG->enablerssfeeds
if (empty($CFG->enablerssfeeds)) {
//Some debug...
if ($CFG->debug > 7) {
echo "DISABLED (admin variables)";
}
debugging("DISABLED (admin variables)");
//Check CFG->forum_enablerssfeeds
} else if (empty($CFG->forum_enablerssfeeds)) {
//Some debug...
if ($CFG->debug > 7) {
echo "DISABLED (module configuration)";
}
debugging("DISABLED (module configuration)");
//It's working so we start...
} else {
//Check the forum has rss activated
+2 -2
View File
@@ -632,7 +632,7 @@
//Update record
$entry->definition = addslashes($result);
$status = update_record("glossary_entries",$entry);
if ($CFG->debug>7) {
if (debugging()) {
if (!defined('RESTORE_SILENTLY')) {
echo '<br /><hr />'.s($content).'<br />changed to<br />'.s($result).'<hr /><br />';
}
@@ -666,7 +666,7 @@
//Update record
$glossary->intro = addslashes($result);
$status = update_record("glossary",$glossary);
if ($CFG->debug>7) {
if (debugging()) {
if (!defined('RESTORE_SILENTLY')) {
echo '<br /><hr />'.s($content).'<br />changed to<br />'.s($result).'<hr /><br />';
}
+8 -24
View File
@@ -12,16 +12,10 @@
//Check CFG->enablerssfeeds
if (empty($CFG->enablerssfeeds)) {
//Some debug...
if ($CFG->debug > 7) {
echo "DISABLED (admin variables)";
}
debugging("DISABLED (admin variables)");
//Check CFG->glossary_enablerssfeeds
} else if (empty($CFG->glossary_enablerssfeeds)) {
//Some debug...
if ($CFG->debug > 7) {
echo "DISABLED (module configuration)";
}
debugging("DISABLED (module configuration)");
//It's working so we start...
} else {
//Iterate over all glossaries
@@ -50,10 +44,6 @@
mtrace("Updating RSS feed for ".format_string($glossary->name,true).", ID: $glossary->id");
//Some debug...
if ($CFG->debug > 7) {
echo "ID: $glossary->id->";
}
//Get the XML contents
$result = glossary_rss_feed($glossary);
//Save the XML contents to file
@@ -61,14 +51,14 @@
$status = rss_save_file("glossary",$glossary,$result);
}
//Some debug...
if ($CFG->debug > 7) {
if (debugging()) {
if (empty($result)) {
echo "(empty) ";
echo "ID: $glossary->id-> (empty) ";
} else {
if (!empty($status)) {
echo "OK ";
echo "ID: $glossary->id-> OK ";
} else {
echo "FAIL ";
echo "ID: $glossary->id-> FAIL ";
}
}
}
@@ -100,16 +90,10 @@
//Check CFG->enablerssfeeds
if (empty($CFG->enablerssfeeds)) {
//Some debug...
if ($CFG->debug > 7) {
echo "DISABLED (admin variables)";
}
debugging("DISABLED (admin variables)");
//Check CFG->glossary_enablerssfeeds
} else if (empty($CFG->glossary_enablerssfeeds)) {
//Some debug...
if ($CFG->debug > 7) {
echo "DISABLED (module configuration)";
}
debugging("DISABLED (module configuration)");
//It's working so we start...
} else {
//Check the glossary has rss activated
+2 -4
View File
@@ -1076,7 +1076,7 @@ function hotpot_db_object_exists($table, $field='', $feedback=false) {
// restore SQL message echo setting
$db->debug = $debug;
// report error if required
if (empty($rs) && isset($CFG->debug) and $CFG->debug > 7) {
if (empty($rs) && debugging()) {
notify($db->ErrorMsg()."<br /><br />$sql");
}
return ($rs && $rs->RecordCount()>0);
@@ -1336,9 +1336,7 @@ function hotpot_db_update_record($table, $record, $forcenull=false) {
$rs = $db->Execute($sql);
if (empty($rs)) {
$ok = false;
if (isset($CFG->debug) and $CFG->debug > 7) {
notify($db->ErrorMsg()."<br /><br />$sql");
}
debugging($db->ErrorMsg()."<br /><br />$sql");
}
}
}
+1 -1
View File
@@ -81,7 +81,7 @@
//Update record
$label->content = addslashes($result);
$status = update_record("label", $label);
if ($CFG->debug>7) {
if (debugging()) {
if (!defined('RESTORE_SILENTLY')) {
echo '<br /><hr />'.s($content).'<br />changed to<br />'.s($result).'<hr /><br />';
}
+2 -4
View File
@@ -272,9 +272,7 @@
if ($page->prevpageid != $prevpageid) {
// fix it
set_field("lesson_pages", "prevpageid", $prevpageid, "id", $page->id);
if ($CFG->debug) {
echo "<p>***prevpageid of page $page->id set to $prevpageid***";
}
debugging("<p>***prevpageid of page $page->id set to $prevpageid***");
}
if (count($pages) == 1) {
@@ -290,4 +288,4 @@
}
print_footer($course);
?>
?>
+1 -1
View File
@@ -801,7 +801,7 @@
//Update record
$page->contents = addslashes($result);
$status = update_record("lesson_pages",$page);
if ($CFG->debug>7) {
if (debugging()) {
if (!defined('RESTORE_SILENTLY')) {
echo '<br /><hr />'.s($content).'<br />changed to<br />'.s($result).'<hr /><br />';
}
+2 -2
View File
@@ -556,7 +556,7 @@
//Update record
$quiz->intro = addslashes($result);
$status = update_record("quiz",$quiz);
if ($CFG->debug>7) {
if (debugging()) {
if (!defined('RESTORE_SILENTLY')) {
echo '<br /><hr />'.s($content).'<br />changed to<br />'.s($result).'<hr /><br />';
}
@@ -845,4 +845,4 @@
return implode(',', $questionids);
}
?>
?>
+1 -1
View File
@@ -200,7 +200,7 @@
$resource->summary = addslashes($result2);
$resource->reference = addslashes($result3);
$status = update_record("resource",$resource);
if ($CFG->debug>7) {
if (debugging()) {
if (!defined('RESTORE_SILENTLY')) {
echo '<br /><hr />'.s($content1).'<br />changed to<br />'.s($result1).'<hr /><br />';
echo '<br /><hr />'.s($content2).'<br />changed to<br />'.s($result2).'<hr /><br />';
+6 -6
View File
@@ -277,14 +277,14 @@
/// Get the default organization
$default_organization = $data['@']['default'];
if ($CFG->debug > 7) print_object('default_organization: '.$default_organization);
debugging('default_organization: '.$default_organization);
/// Iterate (reverse) over organizations until we find the default one
if (empty($data['#']['organization'])) { /// Verify <organization> exists
return false;
}
$count_organizations = count($data['#']['organization']);
if ($CFG->debug > 7) print_object('count_organizations: '.$count_organizations);
debugging('count_organizations: '.$count_organizations);
$current_organization = $count_organizations - 1;
while ($current_organization >= 0) {
@@ -297,7 +297,7 @@
}
/// At this point we MUST have the final organization
if ($CFG->debug > 7) print_object('final organization: '.$organization['#']['title'][0]['#']);
debugging('final organization: '.$organization['#']['title'][0]['#']);
if (empty($organization)) {
return false; //Error, no organization found
}
@@ -323,7 +323,7 @@
/// Iterate over items from start to end
$count_items = count($items);
if ($CFG->debug > 7) print_object('level '.$level.'-count_items: '.$count_items);
debugging('level '.$level.'-count_items: '.$count_items);
$current_item = 0;
while ($current_item < $count_items) {
@@ -341,7 +341,7 @@
!empty($obj_item->identifier)) {
/// Add to itemmap
$itemmap[$id] = $obj_item;
if ($CFG->debug > 7) print_object('level '.$level.'-id '.$id.'-parent '.$parent.'-'.$obj_item->title);
debugging('level '.$level.'-id '.$id.'-parent '.$parent.'-'.$obj_item->title);
/// Counters go up
$id++;
/// Check for subitems recursively
@@ -377,7 +377,7 @@
return false;
}
$count_resources = count($data);
if ($CFG->debug > 7) print_object('count_resources: '.$count_resources);
debugging('count_resources: '.$count_resources);
$current_resource = 0;
while ($current_resource < $count_resources) {
+6 -6
View File
@@ -265,14 +265,14 @@
/// Get the default organization
$default_organization = $data['@']['default'];
if ($CFG->debug > 7) print_object('default_organization: '.$default_organization);
debugging('default_organization: '.$default_organization);
/// Iterate (reverse) over organizations until we find the default one
if (empty($data['#']['organization'])) { /// Verify <organization> exists
return false;
}
$count_organizations = count($data['#']['organization']);
if ($CFG->debug > 7) print_object('count_organizations: '.$count_organizations);
debugging('count_organizations: '.$count_organizations);
$current_organization = $count_organizations - 1;
while ($current_organization >= 0) {
@@ -285,7 +285,7 @@
}
/// At this point we MUST have the final organization
if ($CFG->debug > 7) print_object('final organization: '.$organization['#']['title'][0]['#']);
debugging('final organization: '.$organization['#']['title'][0]['#']);
if (empty($organization)) {
return false; //Error, no organization found
}
@@ -311,7 +311,7 @@
/// Iterate over items from start to end
$count_items = count($items);
if ($CFG->debug > 7) print_object('level '.$level.'-count_items: '.$count_items);
debugging('level '.$level.'-count_items: '.$count_items);
$current_item = 0;
while ($current_item < $count_items) {
@@ -329,7 +329,7 @@
!empty($obj_item->identifier)) {
/// Add to itemmap
$itemmap[$id] = $obj_item;
if ($CFG->debug > 7) print_object('level '.$level.'-id '.$id.'-parent '.$parent.'-'.$obj_item->title);
debugging('level '.$level.'-id '.$id.'-parent '.$parent.'-'.$obj_item->title);
/// Counters go up
$id++;
/// Check for subitems recursively
@@ -365,7 +365,7 @@
return false;
}
$count_resources = count($data);
if ($CFG->debug > 7) print_object('count_resources: '.$count_resources);
debugging('count_resources: '.$count_resources);
$current_resource = 0;
while ($current_resource < $count_resources) {
+1 -1
View File
@@ -286,7 +286,7 @@
//Update record
$survey->intro = addslashes($result);
$status = update_record("survey",$survey);
if ($CFG->debug>7) {
if (debugging()) {
if (!defined('RESTORE_SILENTLY')) {
echo '<br /><hr />'.s($content).'<br />changed to<br />'.s($result).'<hr /><br />';
}
+2 -2
View File
@@ -376,7 +376,7 @@
//Update record
$page->content = addslashes($result);
$status = update_record("wiki_pages",$page);
if ($CFG->debug>7) {
if (debugging()) {
if (!defined('RESTORE_SILENTLY')) {
echo '<br /><hr />'.s($content).'<br />changed to<br />'.s($result).'<hr /><br />';
}
@@ -410,7 +410,7 @@
//Update record
$wiki->summary = addslashes($result);
$status = update_record("wiki",$wiki);
if ($CFG->debug>7) {
if (debugging()) {
if (!defined('RESTORE_SILENTLY')) {
echo '<br /><hr />'.s($content).'<br />changed to<br />'.s($result).'<hr /><br />';
}
+1 -1
View File
@@ -790,7 +790,7 @@
//Update record
$workshop->description = addslashes($result);
$status = update_record("workshop",$workshop);
if ($CFG->debug>7) {
if (debugging()) {
if (!defined('RESTORE_SILENTLY')) {
echo '<br /><hr />'.s($content).'<br />changed to<br />'.s($result).'<hr /><br />';
}