//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 />';
}
//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 />';
}
//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 />';
}
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()) {
// 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 {
require_login($course->id);
- $CFG->debug = 0; /// Temporarily
$returntoview = false;
if (!$data = data_submitted("$CFG->wwwroot/mod/forum/discuss.php")) { // form submitted
//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 />';
}
//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 />';
}
//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
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 ";
}
}
}
//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
//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 />';
}
//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 />';
}
//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
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
$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 ";
}
}
}
//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
// 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);
$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");
}
}
}
//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 />';
}
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) {
}
print_footer($course);
-?>
\ No newline at end of file
+?>
//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 />';
}
//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 />';
}
return implode(',', $questionids);
}
-?>
\ No newline at end of file
+?>
$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 />';
/// 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) {
}
/// 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
}
/// 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) {
!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
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) {
/// 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) {
}
/// 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
}
/// 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) {
!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
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) {
//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 />';
}
//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 />';
}
//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 />';
}
//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 />';
}