For running J!5.1 you must https://fabrikar.com/forums/index.php?wiki/update-from-github/ or include the new file manually https://fabrikar.com/forums/index.php?threads/joomla-5-1-and-fabrik-cannot-find-files-error.54473/post-285151 See also Announcements
Please see our announcement here.
<?php
/* MOS Intruder Alerts */
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
/*
* shared functions between the admin and front end
*/
/**
* switches the database depending on the table connection or fabrik id
* @param object table
* @param object connection
* @return array (database object, table name);
*/
function switchDatabase($oTable, $oConn){
global $database;
if( $oTable->connection_id != '-1'){
$fabrikDb = $oConn->loadTableConnectionDB( );
$table = $oTable->db_table_name;
}else{
$fabrikDb = $database;
$table = "#__fabrik_formdata_" . $oTable->form_id;
}
return array($fabrikDb, $table);
}
/**
* makes the table navigation html to traverse the table data
* @param int the total number of records in the table
* @param int number of records to show per page
* @param int which record number to start at
*/
global $mosConfig_absolute_path;
require_once( $mosConfig_absolute_path . '/administrator/includes/pageNavigation.php' );
/**
* extension to the normal pagenav functions
* @paraM int total
* @param int limitstart
* @param int limit
*/
class fabrikPageNav extends mosPageNav{
var $_formName = 'fabrikTable';
function getPagesLinks() {
$html = '';
$displayed_pages = 10;
$total_pages = ceil( $this->total / $this->limit );
$this_page = ceil( ($this->limitstart+1) / $this->limit );
$start_loop = (floor(($this_page-1)/$displayed_pages))*$displayed_pages+1;
if ($start_loop + $displayed_pages - 1 < $total_pages) {
$stop_loop = $start_loop + $displayed_pages - 1;
} else {
$stop_loop = $total_pages;
}
if ($this_page > 1) {
$page = ($this_page - 2) * $this->limit;
$html .= "\n<a href=\"#beg\" class=\"pagenav\" title=\"first page\" onclick=\"javascript:fabrikNav(0);return false;\"><< Start</a>";
$html .= "\n<a href=\"#prev\" class=\"pagenav\" title=\"previous page\" onclick=\"javascript:fabrikNav($page);return false;\">< Previous</a>";
} else {
$html .= "\n<span class=\"pagenav\"><< Start</span>";
$html .= "\n<span class=\"pagenav\">< Previous</span>";
}
for ($i=$start_loop; $i <= $stop_loop; $i++) {
$page = ($i - 1) * $this->limit;
if ($i == $this_page) {
$html .= "\n<span class=\"pagenav\"> $i </span>";
} else {
$html .= "\n<a href=\"#$i\" class=\"pagenav\" onclick=\"javascript:fabrikNav($page);return false;\"><strong>$i</strong></a>";
}
}
if ($this_page < $total_pages) {
$page = $this_page * $this->limit;
$end_page = ($total_pages-1) * $this->limit;
$html .= "\n<a href=\"#next\" class=\"pagenav\" title=\"next page\" onclick=\"javascript: fabrikNav($page);;return false;\"> Next ></a>";
$html .= "\n<a href=\"#end\" class=\"pagenav\" title=\"end page\" onclick=\"javascript: fabrikNav($end_page);return false;\"> End >></a>";
} else {
$html .= "\n<span class=\"pagenav\">Next ></span>";
$html .= "\n<span class=\"pagenav\">End >></span>";
}
return $html;
}
/**
* @return string The html for the limit # input box
*/
function getLimitBox () {
$limits = array();
for ($i=5; $i <= 30; $i+=5) {
$limits[] = mosHTML::makeOption( "$i" );
}
$limits[] = mosHTML::makeOption( "50" );
// build the html select list
$html = mosHTML::selectList( $limits, 'limit', 'class="inputbox" size="1" onchange="fabrikNavLimit(this.options[this.selectedIndex].value);"',
'value', 'text', $this->limit );
$html .= "\n<input type=\"hidden\" name=\"limitstart\" value=\"$this->limitstart\" />";
return $html;
}
}
/**
* maintains the session array that contains the state for the table's ordering
* @param string the current column to order on
* @param string the direction in which to order the current ordering column
*/
function updateOrderSession($orderBy, $orderDir){
if(!isset($_SESSION['aOrder'])){
$_SESSION['aOrder'] = array();
}
if($orderBy != ''){
$_SESSION['aOrder'][$orderBy] = $orderDir;
}
}
/** returns all elements in $all which are not in $used in O(n log n) time.
* elements from $all are prefixed with $prefix_all.
* elements from $used are prefixed with $prefix_used.
*/
function filter_unused( $all, $used, $prefix_all = "", $prefix_used = "" ) {
$unused = array();
/* prefixes are not needed for sorting */
sort( $all );
sort( $used );
$a = 0;
$u = 0;
$maxa = sizeof($all)-1;
$maxu = sizeof($used)-1;
while( true ) {
if( $a > $maxa ) {
break;
}
if( $u > $maxu ) {
/* rest of $all is unused */
for( ; $a <= $maxa; $a++ ) {
$unused[] = $all[$a];
}
break;
}
if( $prefix_all.$all[$a] > $prefix_used.$used[$u] ) {
$u++;
continue;
}
if( $prefix_all.$all[$a] == $prefix_used.$used[$u] ) {
$a++;
$u++;
continue;
}
$unused[] = $all[$a];
$a++;
}
return $unused;
}
?>