MDL-15107 feedback dml conversion
[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
251387d0 445 _print_normal_error('notlocalisederrormessage', 'error', $message, $link, debug_backtrace(), true); // show debug warning
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
499function drop_table($table, $continue=true, $feedback=true) {
500 global $DB;
501 debugging('Deprecated ddllib function used!');
502 return $DB->get_manager()->drop_table($table, $continue, $feedback);
503}
504
505function install_from_xmldb_file($file) {
506 global $DB;
507 debugging('Deprecated ddllib function used!');
508 return $DB->get_manager()->install_from_xmldb_file($file);
509}
510
511function create_table($table, $continue=true, $feedback=true) {
512 global $DB;
513 debugging('Deprecated ddllib function used!');
514 return $DB->get_manager()->create_table($table, $continue, $feedback);
515}
516
517function create_temp_table($table, $continue=true, $feedback=true) {
518 global $DB;
519 debugging('Deprecated ddllib function used!');
520 return $DB->get_manager()->create_temp_table($table, $continue, $feedback);
521}
522
523function rename_table($table, $newname, $continue=true, $feedback=true) {
524 global $DB;
525 debugging('Deprecated ddllib function used!');
526 return $DB->get_manager()->rename_table($table, $newname, $continue, $feedback);
527}
528
529function add_field($table, $field, $continue=true, $feedback=true) {
530 global $DB;
531 debugging('Deprecated ddllib function used!');
532 return $DB->get_manager()->add_field($table, $field, $continue, $feedback);
533}
534
535function drop_field($table, $field, $continue=true, $feedback=true) {
536 global $DB;
537 debugging('Deprecated ddllib function used!');
538 return $DB->get_manager()->drop_field($table, $field, $continue, $feedback);
539}
540
541function change_field_type($table, $field, $continue=true, $feedback=true) {
542 global $DB;
543 debugging('Deprecated ddllib function used!');
544 return $DB->get_manager()->change_field_type($table, $field, $continue, $feedback);
545}
546
547function change_field_precision($table, $field, $continue=true, $feedback=true) {
548 global $DB;
549 debugging('Deprecated ddllib function used!');
550 return $DB->get_manager()->change_field_precision($table, $field, $continue, $feedback);
551}
552
553function change_field_unsigned($table, $field, $continue=true, $feedback=true) {
554 global $DB;
555 debugging('Deprecated ddllib function used!');
556 return $DB->get_manager()->change_field_unsigned($table, $field, $continue, $feedback);
557}
558
559function change_field_notnull($table, $field, $continue=true, $feedback=true) {
560 global $DB;
561 debugging('Deprecated ddllib function used!');
562 return $DB->get_manager()->change_field_notnull($table, $field, $continue, $feedback);
563}
564
565function change_field_enum($table, $field, $continue=true, $feedback=true) {
566 global $DB;
567 debugging('Deprecated ddllib function used!');
568 return $DB->get_manager()->change_field_enum($table, $field, $continue, $feedback);
569}
570
571function change_field_default($table, $field, $continue=true, $feedback=true) {
572 global $DB;
573 debugging('Deprecated ddllib function used!');
574 return $DB->get_manager()->change_field_default($table, $field, $continue, $feedback);
575}
576
577function rename_field($table, $field, $newname, $continue=true, $feedback=true) {
578 global $DB;
579 debugging('Deprecated ddllib function used!');
580 return $DB->get_manager()->rename_field($table, $field, $continue, $feedback);
581}
582
583function add_key($table, $key, $continue=true, $feedback=true) {
584 global $DB;
585 debugging('Deprecated ddllib function used!');
586 return $DB->get_manager()->add_key($table, $key, $continue, $feedback);
587}
588
589function drop_key($table, $key, $continue=true, $feedback=true) {
590 global $DB;
591 debugging('Deprecated ddllib function used!');
592 return $DB->get_manager()->drop_key($table, $key, $continue, $feedback);
593}
594
595function rename_key($table, $key, $newname, $continue=true, $feedback=true) {
596 global $DB;
597 debugging('Deprecated ddllib function used!');
598 return $DB->get_manager()->rename_key($table, $key, $newname, $continue, $feedback);
599}
600
601function add_index($table, $index, $continue=true, $feedback=true) {
602 global $DB;
603 debugging('Deprecated ddllib function used!');
604 return $DB->get_manager()->add_index($table, $index, $continue, $feedback);
605}
606
607function drop_index($table, $index, $continue=true, $feedback=true) {
608 global $DB;
609 debugging('Deprecated ddllib function used!');
610 return $DB->get_manager()->drop_index($table, $index, $continue, $feedback);
611}
612
613function rename_index($table, $index, $newname, $continue=true, $feedback=true) {
614 global $DB;
615 debugging('Deprecated ddllib function used!');
616 return $DB->get_manager()->rename_index($table, $index, $newname, $continue, $feedback);
617}
618
8ec50604 619
251387d0 620//////////////////////////
621/// removed functions ////
622//////////////////////////
294ce987 623
245ac557 624function addslashes_object($dataobject) {
294ce987 625 error('addslashes() not available anymore');
626}
627
628function addslashes_recursive($var) {
629 error('addslashes_recursive() not available anymore');
630}
631
245ac557 632function execute_sql($command, $feedback=true) {
633 error('execute_sql() not available anymore');
634}
635
636function record_exists_select($table, $select='') {
637 error('record_exists_select() not available anymore');
638}
639
640function record_exists_sql($sql) {
641 error('record_exists_sql() not available anymore');
642}
643
644function count_records_select($table, $select='', $countitem='COUNT(*)') {
645 error('count_records_select() not available anymore');
646}
647
648function count_records_sql($sql) {
649 error('count_records_sql() not available anymore');
650}
651
652function get_record_sql($sql, $expectmultiple=false, $nolimit=false) {
653 error('get_record_sql() not available anymore');
654}
655
656function get_record_select($table, $select='', $fields='*') {
657 error('get_record_select() not available anymore');
658}
659
660function get_recordset($table, $field='', $value='', $sort='', $fields='*', $limitfrom='', $limitnum='') {
661 error('get_recordset() not available anymore');
662}
663
664function get_recordset_sql($sql, $limitfrom=null, $limitnum=null) {
665 error('get_recordset_sql() not available anymore');
666}
667
668function rs_fetch_record(&$rs) {
669 error('rs_fetch_record() not available anymore');
670}
671
672function rs_next_record(&$rs) {
673 error('rs_next_record() not available anymore');
674}
675
676function rs_fetch_next_record(&$rs) {
677 error('rs_fetch_next_record() not available anymore');
678}
679
680function rs_EOF($rs) {
681 error('rs_EOF() not available anymore');
682}
683
684function rs_close(&$rs) {
685 error('rs_close() not available anymore');
686}
687
688function get_records_select($table, $select='', $sort='', $fields='*', $limitfrom='', $limitnum='') {
689 error('get_records_select() not available anymore');
690}
691
692function get_field_select($table, $return, $select) {
693 error('get_field_select() not available anymore');
694}
695
696function get_field_sql($sql) {
697 error('get_field_sql() not available anymore');
698}
294ce987 699
245ac557 700function delete_records_select($table, $select='') {
701 delete_records_select('get_field_sql() not available anymore');
702}
703
704
705function configure_dbconnection() {
706 error('configure_dbconnection() removed');
707}
708
709function sql_max($field) {
710 error('sql_max() removed - use normal sql MAX() instead');
711}
712
713function sql_as() {
714 error('sql_as() removed - do not use AS for tables at all');
715}
716
717function sql_paging_limit($page, $recordsperpage) {
718 error('Function sql_paging_limit() is deprecated. Replace it with the correct use of limitfrom, limitnum parameters');
719}
720
721function db_uppercase() {
722 error('upper() removed - use normal sql UPPER()');
723}
724
725function db_lowercase() {
726 error('upper() removed - use normal sql LOWER()');
727}
728
729function modify_database($sqlfile='', $sqlstring='') {
730 error('modify_database() removed - use new XMLDB functions');
731}
732
733function where_clause($field1='', $value1='', $field2='', $value2='', $field3='', $value3='') {
734 error('where_clause() removed - use new functions with $conditions parameter');
735}
736
737function execute_sql_arr($sqlarr, $continue=true, $feedback=true) {
738 error('execute_sql_arr() removed');
739}
740
741function get_records_list($table, $field='', $values='', $sort='', $fields='*', $limitfrom='', $limitnum='') {
742 error('get_records_list() removed');
743}
744
745function get_recordset_list($table, $field='', $values='', $sort='', $fields='*', $limitfrom='', $limitnum='') {
746 error('get_recordset_list() removed');
747}
748
749function get_records_menu($table, $field='', $value='', $sort='', $fields='*', $limitfrom='', $limitnum='') {
750 error('get_records_menu() removed');
751}
752
753function get_records_select_menu($table, $select='', $sort='', $fields='*', $limitfrom='', $limitnum='') {
754 error('get_records_select_menu() removed');
755}
756
757function get_records_sql_menu($sql, $limitfrom='', $limitnum='') {
758 error('get_records_sql_menu() removed');
759}
760
761function column_type($table, $column) {
762 error('column_type() removed');
763}
764
765function recordset_to_menu($rs) {
766 error('recordset_to_menu() removed');
767}
768
769function records_to_menu($records, $field1, $field2) {
770 error('records_to_menu() removed');
771}
772
773function set_field_select($table, $newfield, $newvalue, $select, $localcall = false) {
774 error('set_field_select() removed');
775}
776
777function get_fieldset_select($table, $return, $select) {
778 error('get_fieldset_select() removed');
779}
780
781function get_fieldset_sql($sql) {
782 error('get_fieldset_sql() removed');
783}
784
785function sql_ilike() {
786 error('sql_ilike() not available anymore');
787}
788
789function sql_fullname($first='firstname', $last='lastname') {
790 error('sql_fullname() not available anymore');
791}
792
793function sql_concat() {
794 error('sql_concat() not available anymore');
795}
796
797function sql_empty() {
798 error('sql_empty() not available anymore');
799}
800
801function sql_substr() {
802 error('sql_substr() not available anymore');
803}
804
805function sql_bitand($int1, $int2) {
806 error('sql_bitand() not available anymore');
807}
808
809function sql_bitnot($int1) {
810 error('sql_bitnot() not available anymore');
811}
812
813function sql_bitor($int1, $int2) {
814 error('sql_bitor() not available anymore');
815}
816
817function sql_bitxor($int1, $int2) {
818 error('sql_bitxor() not available anymore');
819}
820
821function sql_cast_char2int($fieldname, $text=false) {
822 error('sql_cast_char2int() not available anymore');
823}
824
825function sql_compare_text($fieldname, $numchars=32) {
826 error('sql_compare_text() not available anymore');
827}
828
829function sql_order_by_text($fieldname, $numchars=32) {
830 error('sql_order_by_text() not available anymore');
831}
832
833function sql_concat_join($separator="' '", $elements=array()) {
834 error('sql_concat_join() not available anymore');
835}
836
837function sql_isempty($tablename, $fieldname, $nullablefield, $textfield) {
838 error('sql_isempty() not available anymore');
839}
840
841function sql_isnotempty($tablename, $fieldname, $nullablefield, $textfield) {
842 error('sql_isnotempty() not available anymore');
843}
844
845function begin_sql() {
846 error('begin_sql() not available anymore');
847}
848
849function commit_sql() {
850 error('commit_sql() not available anymore');
851}
852
853function rollback_sql() {
854 error('rollback_sql() not available anymore');
855}
856
857function insert_record($table, $dataobject, $returnid=true, $primarykey='id') {
858 error('insert_record() not available anymore');
859}
860
861function update_record($table, $dataobject) {
862 error('update_record() not available anymore');
863}
864
865function get_records($table, $field='', $value='', $sort='', $fields='*', $limitfrom='', $limitnum='') {
866 error('get_records() not available anymore');
867}
868
869function get_record($table, $field1, $value1, $field2='', $value2='', $field3='', $value3='', $fields='*') {
870 error('get_record() not available anymore');
871}
872
873function set_field($table, $newfield, $newvalue, $field1, $value1, $field2='', $value2='', $field3='', $value3='') {
874 error('set_field() not available anymore');
875}
876
877function count_records($table, $field1='', $value1='', $field2='', $value2='', $field3='', $value3='') {
878 error('count_records() not available anymore');
879}
880
881function record_exists($table, $field1='', $value1='', $field2='', $value2='', $field3='', $value3='') {
882 error('record_exists() not available anymore');
883}
884
885function delete_records($table, $field1='', $value1='', $field2='', $value2='', $field3='', $value3='') {
886 error('delete_records() not available anymore');
887}
888
889function get_field($table, $return, $field1, $value1, $field2='', $value2='', $field3='', $value3='') {
890 error('get_field() not available anymore');
891}
294ce987 892
e6b4f00e 893function table_column($table, $oldfield, $field, $type='integer', $size='10',
894 $signed='unsigned', $default='0', $null='not null', $after='') {
895 error('table_column() was removed, please use new ddl functions');
896}
b1f93b15 897