diff --git a/dev/Debug.php b/dev/Debug.php index 57aef510f..26d7f69ab 100644 --- a/dev/Debug.php +++ b/dev/Debug.php @@ -89,11 +89,12 @@ class Debug { */ public static function caller() { $bt = debug_backtrace(); - $caller = $bt[2]; + $caller = isset($bt[2]) ? $bt[2] : array(); $caller['line'] = $bt[1]['line']; $caller['file'] = $bt[1]['file']; if(!isset($caller['class'])) $caller['class'] = ''; if(!isset($caller['type'])) $caller['type'] = ''; + if(!isset($caller['function'])) $caller['function'] = ''; return $caller; } diff --git a/docs/en/02_Developer_Guides/00_Model/01_Data_Model_and_ORM.md b/docs/en/02_Developer_Guides/00_Model/01_Data_Model_and_ORM.md index 21acfce88..b02ef017c 100644 --- a/docs/en/02_Developer_Guides/00_Model/01_Data_Model_and_ORM.md +++ b/docs/en/02_Developer_Guides/00_Model/01_Data_Model_and_ORM.md @@ -268,10 +268,11 @@ However you might have several entries with the same `FirstName` and would like 'LastName'=>'ASC' )); -You can also sort randomly. +You can also sort randomly. Using the `DB` class, you can get the random sort method per database type. :::php - $players = Player::get()->sort('RAND()') + $random = DB::get_conn()->random(); + $players = Player::get()->sort($random) ## Filtering Results diff --git a/javascript/UploadField.js b/javascript/UploadField.js index 38cca8dd7..a7d00855c 100644 --- a/javascript/UploadField.js +++ b/javascript/UploadField.js @@ -263,8 +263,8 @@ }, openSelectDialog: function(uploadedFile) { // Create dialog and load iframe - var self = this, config = this.getConfig(), dialogId = 'ss-uploadfield-dialog-' + this.attr('id'), dialog = jQuery('#' + dialogId); - if(!dialog.length) dialog = jQuery('
'); + var self = this, config = this.getConfig(), dialogId = 'ss-uploadfield-dialog-' + this.attr('id'), dialog = $('#' + dialogId); + if(!dialog.length) dialog = $(''); // If user selected 'Choose another file', we need the ID of the file to replace var iframeUrl = config['urlSelectDialog'];