MDL-15919 minor tmpfile cleanup fixes
[moodle.git] / lib / deprecatedlib.php
CommitLineData
c4d0753b 1<?php // $Id$
2
3///////////////////////////////////////////////////////////////////////////
4// //
5// NOTICE OF COPYRIGHT //
6// //
7// Moodle - Modular Object-Oriented Dynamic Learning Environment //
8// http://moodle.org //
9// //
73f7ad71 10// Copyright (C) 1999 onwards Martin Dougiamas, Moodle http://moodle.com//
c4d0753b 11// //
12// This program is free software; you can redistribute it and/or modify //
13// it under the terms of the GNU General Public License as published by //
14// the Free Software Foundation; either version 2 of the License, or //
15// (at your option) any later version. //
16// //
17// This program is distributed in the hope that it will be useful, //
18// but WITHOUT ANY WARRANTY; without even the implied warranty of //
19// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
20// GNU General Public License for more details: //
21// //
22// http://www.gnu.org/copyleft/gpl.html //
23// //
24///////////////////////////////////////////////////////////////////////////
25
26/**
27 * deprecatedlib.php - Old functions retained only for backward compatibility
28 *
29 * Old functions retained only for backward compatibility. New code should not
30 * use any of these functions.
31 *
32 * @author Martin Dougiamas
33 * @version $Id$
34 * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
35 * @package moodlecore
36 */
37
c4d0753b 38/**
39 * Determines if a user is a teacher (or better)
40 *
c4d0753b 41 * @uses $CFG
42 * @param int $courseid The id of the course that is being viewed, if any
43 * @param int $userid The id of the user that is being tested against. Set this to 0 if you would just like to test against the currently logged in user.
44 * @param bool $obsolete_includeadmin Not used any more
45 * @return bool
46 */
47
48function isteacher($courseid=0, $userid=0, $obsolete_includeadmin=true) {
49/// Is the user able to access this course as a teacher?
c2da0757 50 global $CFG;
c4d0753b 51
52 if (empty($CFG->rolesactive)) { // Teachers are locked out during an upgrade to 1.7
53 return false;
54 }
55
56 if ($courseid) {
57 $context = get_context_instance(CONTEXT_COURSE, $courseid);
58 } else {
12d06877 59 $context = get_context_instance(CONTEXT_SYSTEM);
c4d0753b 60 }
61
c2da0757 62 return (has_capability('moodle/legacy:teacher', $context, $userid, false)
63 or has_capability('moodle/legacy:editingteacher', $context, $userid, false)
64 or has_capability('moodle/legacy:admin', $context, $userid, false));
c4d0753b 65}
66
67/**
68 * Determines if a user is a teacher in any course, or an admin
69 *
70 * @uses $USER
71 * @param int $userid The id of the user that is being tested against. Set this to 0 if you would just like to test against the currently logged in user.
c2da0757 72 * @param bool $includeadmin Include anyone wo is an admin as well
c4d0753b 73 * @return bool
74 */
c2da0757 75function isteacherinanycourse($userid=0, $includeadmin=true) {
79eaec48 76 global $USER, $CFG, $DB;
c4d0753b 77
78 if (empty($CFG->rolesactive)) { // Teachers are locked out during an upgrade to 1.7
79 return false;
80 }
81
82 if (!$userid) {
83 if (empty($USER->id)) {
84 return false;
85 }
86 $userid = $USER->id;
87 }
88
79eaec48 89 if (!$DB->record_exists('role_assignments', array('userid'=>$userid))) { // Has no roles anywhere
c4d0753b 90 return false;
91 }
92
93/// If this user is assigned as an editing teacher anywhere then return true
94 if ($roles = get_roles_with_capability('moodle/legacy:editingteacher', CAP_ALLOW)) {
95 foreach ($roles as $role) {
79eaec48 96 if ($DB->record_exists('role_assignments', array('roleid'=>$role->id, 'userid'=>$userid))) {
c4d0753b 97 return true;
98 }
99 }
100 }
101
102/// If this user is assigned as a non-editing teacher anywhere then return true
103 if ($roles = get_roles_with_capability('moodle/legacy:teacher', CAP_ALLOW)) {
104 foreach ($roles as $role) {
79eaec48 105 if ($DB->record_exists('role_assignments', array('roleid'=>$role->id, 'userid'=>$userid))) {
c4d0753b 106 return true;
107 }
108 }
109 }
110
c2da0757 111/// Include admins if required
112 if ($includeadmin) {
12d06877 113 $context = get_context_instance(CONTEXT_SYSTEM);
c2da0757 114 if (has_capability('moodle/legacy:admin', $context, $userid, false)) {
115 return true;
116 }
117 }
c4d0753b 118
119 return false;
120}
121
c4d0753b 122
123/**
124 * Determines if the specified user is logged in as guest.
125 *
c4d0753b 126 * @param int $userid The user being tested. You can set this to 0 or leave it blank to test the currently logged in user.
127 * @return bool
128 */
129function isguest($userid=0) {
c2da0757 130 global $CFG;
c4d0753b 131
132 if (empty($CFG->rolesactive)) {
133 return false;
134 }
135
364fffda 136 $context = get_context_instance(CONTEXT_SYSTEM);
c4d0753b 137
c2da0757 138 return has_capability('moodle/legacy:guest', $context, $userid, false);
c4d0753b 139}
140
613bbd7c 141
142/**
143 * Get the guest user information from the database
144 *
145 * @return object(user) An associative array with the details of the guest user account.
146 * @todo Is object(user) a correct return type? Or is array the proper return type with a note that the contents include all details for a user.
147 */
148function get_guest() {
149 return get_complete_user_data('username', 'guest');
150}
151
613bbd7c 152/**
153 * Returns $user object of the main teacher for a course
154 *
155 * @uses $CFG
156 * @param int $courseid The course in question.
157 * @return user|false A {@link $USER} record of the main teacher for the specified course or false if error.
158 * @todo Finish documenting this function
159 */
160function get_teacher($courseid) {
161
162 global $CFG;
163
888fb649 164 $context = get_context_instance(CONTEXT_COURSE, $courseid);
165
1113f800 166 // Pass $view=true to filter hidden caps if the user cannot see them
167 if ($users = get_users_by_capability($context, 'moodle/course:update', 'u.*', 'u.id ASC',
168 '', '', '', '', false, true)) {
b1469317 169 $users = sort_by_roleassignment_authority($users, $context);
1113f800 170 return array_shift($users);
613bbd7c 171 }
888fb649 172
173 return false;
613bbd7c 174}
175
176/**
177 * Searches logs to find all enrolments since a certain date
178 *
179 * used to print recent activity
180 *
181 * @uses $CFG
182 * @param int $courseid The course in question.
183 * @return object|false {@link $USER} records or false if error.
184 * @todo Finish documenting this function
185 */
186function get_recent_enrolments($courseid, $timestart) {
10df888a 187 global $DB;
364fffda 188
71dea306 189 $context = get_context_instance(CONTEXT_COURSE, $courseid);
613bbd7c 190
10df888a 191 $sql = "SELECT DISTINCT u.id, u.firstname, u.lastname, l.time
192 FROM {user} u, {role_assignments} ra, {log} l
193 WHERE l.time > ?
194 AND l.course = ?
195 AND l.module = 'course'
196 AND l.action = 'enrol'
9f43d70d 197 AND ".$DB->sql_cast_char2int('l.info')." = u.id
10df888a 198 AND u.id = ra.userid
199 AND ra.contextid ".get_related_contexts_string($context)."
200 ORDER BY l.time ASC";
201 $params = array($timestart, $courseid);
202 return $DB->get_records_sql($sql, $params);
613bbd7c 203}
204
2123b644 205########### FROM weblib.php ##########################################################################
206
207
208/**
209 * Print a message in a standard themed box.
364fffda 210 * This old function used to implement boxes using tables. Now it uses a DIV, but the old
2123b644 211 * parameters remain. If possible, $align, $width and $color should not be defined at all.
212 * Preferably just use print_box() in weblib.php
213 *
214 * @param string $align, alignment of the box, not the text (default center, left, right).
215 * @param string $width, width of the box, including units %, for example '100%'.
216 * @param string $color, background colour of the box, for example '#eee'.
217 * @param int $padding, padding in pixels, specified without units.
218 * @param string $class, space-separated class names.
219 * @param string $id, space-separated id names.
220 * @param boolean $return, return as string or just print it
221 */
222function print_simple_box($message, $align='', $width='', $color='', $padding=5, $class='generalbox', $id='', $return=false) {
223 $output = '';
224 $output .= print_simple_box_start($align, $width, $color, $padding, $class, $id, true);
294ce987 225 $output .= $message;
2123b644 226 $output .= print_simple_box_end(true);
227
228 if ($return) {
229 return $output;
230 } else {
231 echo $output;
232 }
233}
234
235
236
237/**
364fffda 238 * This old function used to implement boxes using tables. Now it uses a DIV, but the old
2123b644 239 * parameters remain. If possible, $align, $width and $color should not be defined at all.
240 * Even better, please use print_box_start() in weblib.php
241 *
242 * @param string $align, alignment of the box, not the text (default center, left, right). DEPRECATED
243 * @param string $width, width of the box, including % units, for example '100%'. DEPRECATED
244 * @param string $color, background colour of the box, for example '#eee'. DEPRECATED
245 * @param int $padding, padding in pixels, specified without units. OBSOLETE
246 * @param string $class, space-separated class names.
247 * @param string $id, space-separated id names.
248 * @param boolean $return, return as string or just print it
249 */
250function print_simple_box_start($align='', $width='', $color='', $padding=5, $class='generalbox', $id='', $return=false) {
251
252 $output = '';
253
8f36e33e 254 $divclasses = 'box '.$class.' '.$class.'content';
2123b644 255 $divstyles = '';
256
257 if ($align) {
258 $divclasses .= ' boxalign'.$align; // Implement alignment using a class
259 }
260 if ($width) { // Hopefully we can eliminate these in calls to this function (inline styles are bad)
8f36e33e 261 if (substr($width, -1, 1) == '%') { // Width is a % value
262 $width = (int) substr($width, 0, -1); // Extract just the number
263 if ($width < 40) {
264 $divclasses .= ' boxwidthnarrow'; // Approx 30% depending on theme
265 } else if ($width > 60) {
266 $divclasses .= ' boxwidthwide'; // Approx 80% depending on theme
267 } else {
268 $divclasses .= ' boxwidthnormal'; // Approx 50% depending on theme
269 }
270 } else {
271 $divstyles .= ' width:'.$width.';'; // Last resort
272 }
2123b644 273 }
274 if ($color) { // Hopefully we can eliminate these in calls to this function (inline styles are bad)
275 $divstyles .= ' background:'.$color.';';
276 }
277 if ($divstyles) {
278 $divstyles = ' style="'.$divstyles.'"';
279 }
280
281 if ($id) {
282 $id = ' id="'.$id.'"';
283 }
284
285 $output .= '<div'.$id.$divstyles.' class="'.$divclasses.'">';
286
287 if ($return) {
288 return $output;
289 } else {
290 echo $output;
291 }
292}
293
294
295/**
296 * Print the end portion of a standard themed box.
297 * Preferably just use print_box_end() in weblib.php
298 */
299function print_simple_box_end($return=false) {
300 $output = '</div>';
301 if ($return) {
302 return $output;
303 } else {
304 echo $output;
305 }
306}
307
ed5dd29f 308/**
309 * deprecated - use clean_param($string, PARAM_FILE); instead
310 * Check for bad characters ?
311 *
312 * @param string $string ?
313 * @param int $allowdots ?
314 * @todo Finish documenting this function - more detail needed in description as well as details on arguments
315 */
316function detect_munged_arguments($string, $allowdots=1) {
317 if (substr_count($string, '..') > $allowdots) { // Sometimes we allow dots in references
318 return true;
319 }
320 if (ereg('[\|\`]', $string)) { // check for other bad characters
321 return true;
322 }
323 if (empty($string) or $string == '/') {
324 return true;
325 }
326
327 return false;
328}
329
9152fc99 330
ed5dd29f 331/////////////////////////////////////////////////////////////
332/// Old functions not used anymore - candidates for removal
333/////////////////////////////////////////////////////////////
334
ed5dd29f 335
1d684195 336/** various deprecated groups function **/
337
338
5bf243d1 339/**
340 * Get the IDs for the user's groups in the given course.
341 *
342 * @uses $USER
343 * @param int $courseid The course being examined - the 'course' table id field.
344 * @return array An _array_ of groupids.
345 * (Was return $groupids[0] - consequences!)
346 */
347function mygroupid($courseid) {
348 global $USER;
349 if ($groups = groups_get_all_groups($courseid, $USER->id)) {
350 return array_keys($groups);
351 } else {
352 return false;
353 }
354}
355
5bf243d1 356
5bf243d1 357/**
358 * Returns the current group mode for a given course or activity module
364fffda 359 *
5bf243d1 360 * Could be false, SEPARATEGROUPS or VISIBLEGROUPS (<-- Martin)
361 */
362function groupmode($course, $cm=null) {
363
364 if (isset($cm->groupmode) && empty($course->groupmodeforce)) {
365 return $cm->groupmode;
366 }
367 return $course->groupmode;
368}
369
c584346c 370/**
371 * Sets the current group in the session variable
372 * When $SESSION->currentgroup[$courseid] is set to 0 it means, show all groups.
373 * Sets currentgroup[$courseid] in the session variable appropriately.
374 * Does not do any permission checking.
375 * @uses $SESSION
376 * @param int $courseid The course being examined - relates to id field in
377 * 'course' table.
378 * @param int $groupid The group being examined.
379 * @return int Current group id which was set by this function
380 */
381function set_current_group($courseid, $groupid) {
382 global $SESSION;
383 return $SESSION->currentgroup[$courseid] = $groupid;
384}
385
5bf243d1 386
5bf243d1 387/**
364fffda 388 * Gets the current group - either from the session variable or from the database.
5bf243d1 389 *
390 * @uses $USER
391 * @uses $SESSION
364fffda 392 * @param int $courseid The course being examined - relates to id field in
5bf243d1 393 * 'course' table.
364fffda 394 * @param bool $full If true, the return value is a full record object.
5bf243d1 395 * If false, just the id of the record.
396 */
397function get_current_group($courseid, $full = false) {
398 global $SESSION;
399
400 if (isset($SESSION->currentgroup[$courseid])) {
401 if ($full) {
402 return groups_get_group($SESSION->currentgroup[$courseid]);
403 } else {
404 return $SESSION->currentgroup[$courseid];
405 }
406 }
407
408 $mygroupid = mygroupid($courseid);
409 if (is_array($mygroupid)) {
410 $mygroupid = array_shift($mygroupid);
411 set_current_group($courseid, $mygroupid);
412 if ($full) {
413 return groups_get_group($mygroupid);
414 } else {
415 return $mygroupid;
416 }
417 }
418
419 if ($full) {
420 return false;
421 } else {
422 return 0;
423 }
424}
425
426
8ec50604 427/**
428 * Print an error page displaying an error message.
429 * Old method, don't call directly in new code - use print_error instead.
430 *
8ec50604 431 * @param string $message The message to display to the user about the error.
432 * @param string $link The url where the user will be prompted to continue. If no url is provided the user will be directed to the site index page.
251387d0 433 * @return terminates script, does not return!
8ec50604 434 */
245ac557 435function error($message, $link='') {
251387d0 436 global $UNITTEST;
8ec50604 437
251387d0 438 // If unittest running, throw exception instead
a230012c 439 if (!empty($UNITTEST->running)) {
73f7ad71 440 // Errors in unit test become exceptions, so you can unit test
441 // code that might call error().
251387d0 442 throw new moodle_exception('notlocalisederrormessage', 'error', $link, $message);
8ec50604 443 }
444
eee5d9bb 445 _print_normal_error('notlocalisederrormessage', 'error', $message, $link, debug_backtrace(), null, true); // show debug warning
251387d0 446}
8ec50604 447
8ec50604 448
b1f93b15 449/// Deprecated DDL functions, to be removed soon ///
450
451function table_exists($table) {
452 global $DB;
453 debugging('Deprecated ddllib function used!');
454 return $DB->get_manager()->table_exists($table);
455}
456
457function field_exists($table, $field) {
458 global $DB;
459 debugging('Deprecated ddllib function used!');
460 return $DB->get_manager()->field_exists($table, $field);
461}
462
463function find_index_name($table, $index) {
464 global $DB;
465 debugging('Deprecated ddllib function used!');
466 return $DB->get_manager()->find_index_name($table, $index);
467}
468
469function index_exists($table, $index) {
470 global $DB;
471 debugging('Deprecated ddllib function used!');
472 return $DB->get_manager()->index_exists($table, $index);
473}
474
475function find_check_constraint_name($table, $field) {
476 global $DB;
477 debugging('Deprecated ddllib function used!');
478 return $DB->get_manager()->find_check_constraint_name($table, $field);
479}
480
481function check_constraint_exists($table, $field) {
482 global $DB;
483 debugging('Deprecated ddllib function used!');
484 return $DB->get_manager()->check_constraint_exists($table, $field);
485}
486
487function find_key_name($table, $xmldb_key) {
488 global $DB;
489 debugging('Deprecated ddllib function used!');
490 return $DB->get_manager()->find_key_name($table, $xmldb_key);
491}
492
493function find_sequence_name($table) {
494 global $DB;
495 debugging('Deprecated ddllib function used!');
496 return $DB->get_manager()->find_sequence_name($table);
497}
498
eee5d9bb 499function drop_table($table) {
b1f93b15 500 global $DB;
501 debugging('Deprecated ddllib function used!');
eee5d9bb 502 $DB->get_manager()->drop_table($table);
503 return true;
b1f93b15 504}
505
506function install_from_xmldb_file($file) {
507 global $DB;
508 debugging('Deprecated ddllib function used!');
eee5d9bb 509 $DB->get_manager()->install_from_xmldb_file($file);
510 return true;
b1f93b15 511}
512
eee5d9bb 513function create_table($table) {
b1f93b15 514 global $DB;
515 debugging('Deprecated ddllib function used!');
eee5d9bb 516 $DB->get_manager()->create_table($table);
517 return true;
b1f93b15 518}
519
eee5d9bb 520function create_temp_table($table) {
b1f93b15 521 global $DB;
522 debugging('Deprecated ddllib function used!');
eee5d9bb 523 $DB->get_manager()->create_temp_table($table);
524 return true;
b1f93b15 525}
526
eee5d9bb 527function rename_table($table, $newname) {
b1f93b15 528 global $DB;
529 debugging('Deprecated ddllib function used!');
eee5d9bb 530 $DB->get_manager()->rename_table($table, $newname);
531 return true;
b1f93b15 532}
533
eee5d9bb 534function add_field($table, $field) {
b1f93b15 535 global $DB;
536 debugging('Deprecated ddllib function used!');
eee5d9bb 537 $DB->get_manager()->add_field($table, $field);
538 return true;
b1f93b15 539}
540
eee5d9bb 541function drop_field($table, $field) {
b1f93b15 542 global $DB;
543 debugging('Deprecated ddllib function used!');
eee5d9bb 544 $DB->get_manager()->drop_field($table, $field);
545 return true;
b1f93b15 546}
547
eee5d9bb 548function change_field_type($table, $field) {
b1f93b15 549 global $DB;
550 debugging('Deprecated ddllib function used!');
eee5d9bb 551 $DB->get_manager()->change_field_type($table, $field);
552 return true;
b1f93b15 553}
554
eee5d9bb 555function change_field_precision($table, $field) {
b1f93b15 556 global $DB;
557 debugging('Deprecated ddllib function used!');
eee5d9bb 558 $DB->get_manager()->change_field_precision($table, $field);
559 return true;
b1f93b15 560}
561
eee5d9bb 562function change_field_unsigned($table, $field) {
b1f93b15 563 global $DB;
564 debugging('Deprecated ddllib function used!');
eee5d9bb 565 $DB->get_manager()->change_field_unsigned($table, $field);
566 return true;
b1f93b15 567}
568
eee5d9bb 569function change_field_notnull($table, $field) {
b1f93b15 570 global $DB;
571 debugging('Deprecated ddllib function used!');
eee5d9bb 572 $DB->get_manager()->change_field_notnull($table, $field);
573 return true;
b1f93b15 574}
575
eee5d9bb 576function change_field_enum($table, $field) {
b1f93b15 577 global $DB;
578 debugging('Deprecated ddllib function used!');
eee5d9bb 579 $DB->get_manager()->change_field_enum($table, $field);
580 return true;
b1f93b15 581}
582
eee5d9bb 583function change_field_default($table, $field) {
b1f93b15 584 global $DB;
585 debugging('Deprecated ddllib function used!');
eee5d9bb 586 $DB->get_manager()->change_field_default($table, $field);
587 return true;
b1f93b15 588}
589
eee5d9bb 590function rename_field($table, $field, $newname) {
b1f93b15 591 global $DB;
592 debugging('Deprecated ddllib function used!');
eee5d9bb 593 $DB->get_manager()->rename_field($table, $field);
594 return true;
b1f93b15 595}
596
eee5d9bb 597function add_key($table, $key) {
b1f93b15 598 global $DB;
599 debugging('Deprecated ddllib function used!');
eee5d9bb 600 $DB->get_manager()->add_key($table, $key);
601 return true;
b1f93b15 602}
603
eee5d9bb 604function drop_key($table, $key) {
b1f93b15 605 global $DB;
606 debugging('Deprecated ddllib function used!');
eee5d9bb 607 $DB->get_manager()->drop_key($table, $key);
608 return true;
b1f93b15 609}
610
eee5d9bb 611function rename_key($table, $key, $newname) {
b1f93b15 612 global $DB;
613 debugging('Deprecated ddllib function used!');
eee5d9bb 614 $DB->get_manager()->rename_key($table, $key, $newname);
615 return true;
b1f93b15 616}
617
eee5d9bb 618function add_index($table, $index) {
b1f93b15 619 global $DB;
620 debugging('Deprecated ddllib function used!');
eee5d9bb 621 $DB->get_manager()->add_index($table, $index);
622 return true;
b1f93b15 623}
624
eee5d9bb 625function drop_index($table, $index) {
b1f93b15 626 global $DB;
627 debugging('Deprecated ddllib function used!');
eee5d9bb 628 $DB->get_manager()->drop_index($table, $index);
629 return true;
b1f93b15 630}
631
eee5d9bb 632function rename_index($table, $index, $newname) {
b1f93b15 633 global $DB;
634 debugging('Deprecated ddllib function used!');
eee5d9bb 635 $DB->get_manager()->rename_index($table, $index, $newname);
636 return true;
b1f93b15 637}
638
8ec50604 639
251387d0 640//////////////////////////
641/// removed functions ////
642//////////////////////////
294ce987 643
245ac557 644function addslashes_object($dataobject) {
294ce987 645 error('addslashes() not available anymore');
646}
647
648function addslashes_recursive($var) {
649 error('addslashes_recursive() not available anymore');
650}
651
245ac557 652function execute_sql($command, $feedback=true) {
653 error('execute_sql() not available anymore');
654}
655
656function record_exists_select($table, $select='') {
657 error('record_exists_select() not available anymore');
658}
659
660function record_exists_sql($sql) {
661 error('record_exists_sql() not available anymore');
662}
663
664function count_records_select($table, $select='', $countitem='COUNT(*)') {
665 error('count_records_select() not available anymore');
666}
667
668function count_records_sql($sql) {
669 error('count_records_sql() not available anymore');
670}
671
672function get_record_sql($sql, $expectmultiple=false, $nolimit=false) {
673 error('get_record_sql() not available anymore');
674}
675
676function get_record_select($table, $select='', $fields='*') {
677 error('get_record_select() not available anymore');
678}
679
680function get_recordset($table, $field='', $value='', $sort='', $fields='*', $limitfrom='', $limitnum='') {
681 error('get_recordset() not available anymore');
682}
683
684function get_recordset_sql($sql, $limitfrom=null, $limitnum=null) {
685 error('get_recordset_sql() not available anymore');
686}
687
688function rs_fetch_record(&$rs) {
689 error('rs_fetch_record() not available anymore');
690}
691
692function rs_next_record(&$rs) {
693 error('rs_next_record() not available anymore');
694}
695
696function rs_fetch_next_record(&$rs) {
697 error('rs_fetch_next_record() not available anymore');
698}
699
700function rs_EOF($rs) {
701 error('rs_EOF() not available anymore');
702}
703
704function rs_close(&$rs) {
705 error('rs_close() not available anymore');
706}
707
708function get_records_select($table, $select='', $sort='', $fields='*', $limitfrom='', $limitnum='') {
709 error('get_records_select() not available anymore');
710}
711
712function get_field_select($table, $return, $select) {
713 error('get_field_select() not available anymore');
714}
715
716function get_field_sql($sql) {
717 error('get_field_sql() not available anymore');
718}
294ce987 719
245ac557 720function delete_records_select($table, $select='') {
721 delete_records_select('get_field_sql() not available anymore');
722}
723
724
725function configure_dbconnection() {
726 error('configure_dbconnection() removed');
727}
728
729function sql_max($field) {
730 error('sql_max() removed - use normal sql MAX() instead');
731}
732
733function sql_as() {
734 error('sql_as() removed - do not use AS for tables at all');
735}
736
737function sql_paging_limit($page, $recordsperpage) {
738 error('Function sql_paging_limit() is deprecated. Replace it with the correct use of limitfrom, limitnum parameters');
739}
740
741function db_uppercase() {
742 error('upper() removed - use normal sql UPPER()');
743}
744
745function db_lowercase() {
746 error('upper() removed - use normal sql LOWER()');
747}
748
749function modify_database($sqlfile='', $sqlstring='') {
750 error('modify_database() removed - use new XMLDB functions');
751}
752
753function where_clause($field1='', $value1='', $field2='', $value2='', $field3='', $value3='') {
754 error('where_clause() removed - use new functions with $conditions parameter');
755}
756
757function execute_sql_arr($sqlarr, $continue=true, $feedback=true) {
758 error('execute_sql_arr() removed');
759}
760
761function get_records_list($table, $field='', $values='', $sort='', $fields='*', $limitfrom='', $limitnum='') {
762 error('get_records_list() removed');
763}
764
765function get_recordset_list($table, $field='', $values='', $sort='', $fields='*', $limitfrom='', $limitnum='') {
766 error('get_recordset_list() removed');
767}
768
769function get_records_menu($table, $field='', $value='', $sort='', $fields='*', $limitfrom='', $limitnum='') {
770 error('get_records_menu() removed');
771}
772
773function get_records_select_menu($table, $select='', $sort='', $fields='*', $limitfrom='', $limitnum='') {
774 error('get_records_select_menu() removed');
775}
776
777function get_records_sql_menu($sql, $limitfrom='', $limitnum='') {
778 error('get_records_sql_menu() removed');
779}
780
781function column_type($table, $column) {
782 error('column_type() removed');
783}
784
785function recordset_to_menu($rs) {
786 error('recordset_to_menu() removed');
787}
788
789function records_to_menu($records, $field1, $field2) {
790 error('records_to_menu() removed');
791}
792
793function set_field_select($table, $newfield, $newvalue, $select, $localcall = false) {
794 error('set_field_select() removed');
795}
796
797function get_fieldset_select($table, $return, $select) {
798 error('get_fieldset_select() removed');
799}
800
801function get_fieldset_sql($sql) {
802 error('get_fieldset_sql() removed');
803}
804
805function sql_ilike() {
806 error('sql_ilike() not available anymore');
807}
808
809function sql_fullname($first='firstname', $last='lastname') {
810 error('sql_fullname() not available anymore');
811}
812
813function sql_concat() {
814 error('sql_concat() not available anymore');
815}
816
817function sql_empty() {
818 error('sql_empty() not available anymore');
819}
820
821function sql_substr() {
822 error('sql_substr() not available anymore');
823}
824
825function sql_bitand($int1, $int2) {
826 error('sql_bitand() not available anymore');
827}
828
829function sql_bitnot($int1) {
830 error('sql_bitnot() not available anymore');
831}
832
833function sql_bitor($int1, $int2) {
834 error('sql_bitor() not available anymore');
835}
836
837function sql_bitxor($int1, $int2) {
838 error('sql_bitxor() not available anymore');
839}
840
841function sql_cast_char2int($fieldname, $text=false) {
842 error('sql_cast_char2int() not available anymore');
843}
844
845function sql_compare_text($fieldname, $numchars=32) {
846 error('sql_compare_text() not available anymore');
847}
848
849function sql_order_by_text($fieldname, $numchars=32) {
850 error('sql_order_by_text() not available anymore');
851}
852
853function sql_concat_join($separator="' '", $elements=array()) {
854 error('sql_concat_join() not available anymore');
855}
856
857function sql_isempty($tablename, $fieldname, $nullablefield, $textfield) {
858 error('sql_isempty() not available anymore');
859}
860
861function sql_isnotempty($tablename, $fieldname, $nullablefield, $textfield) {
862 error('sql_isnotempty() not available anymore');
863}
864
865function begin_sql() {
866 error('begin_sql() not available anymore');
867}
868
869function commit_sql() {
870 error('commit_sql() not available anymore');
871}
872
873function rollback_sql() {
874 error('rollback_sql() not available anymore');
875}
876
877function insert_record($table, $dataobject, $returnid=true, $primarykey='id') {
878 error('insert_record() not available anymore');
879}
880
881function update_record($table, $dataobject) {
882 error('update_record() not available anymore');
883}
884
885function get_records($table, $field='', $value='', $sort='', $fields='*', $limitfrom='', $limitnum='') {
886 error('get_records() not available anymore');
887}
888
889function get_record($table, $field1, $value1, $field2='', $value2='', $field3='', $value3='', $fields='*') {
890 error('get_record() not available anymore');
891}
892
893function set_field($table, $newfield, $newvalue, $field1, $value1, $field2='', $value2='', $field3='', $value3='') {
894 error('set_field() not available anymore');
895}
896
897function count_records($table, $field1='', $value1='', $field2='', $value2='', $field3='', $value3='') {
898 error('count_records() not available anymore');
899}
900
901function record_exists($table, $field1='', $value1='', $field2='', $value2='', $field3='', $value3='') {
902 error('record_exists() not available anymore');
903}
904
905function delete_records($table, $field1='', $value1='', $field2='', $value2='', $field3='', $value3='') {
906 error('delete_records() not available anymore');
907}
908
909function get_field($table, $return, $field1, $value1, $field2='', $value2='', $field3='', $value3='') {
910 error('get_field() not available anymore');
911}
294ce987 912
e6b4f00e 913function table_column($table, $oldfield, $field, $type='integer', $size='10',
914 $signed='unsigned', $default='0', $null='not null', $after='') {
915 error('table_column() was removed, please use new ddl functions');
916}
b1f93b15 917