Commit 770923bb authored by François Jacquet's avatar François Jacquet
Browse files

PHP 7.3 count() compatibility

Use ! empty() instead, or cast variable to array.
parent 5c933534
......@@ -7,6 +7,7 @@ Changes in 4.6
- CSS display accessibility link on focus in stylesheet.css
- Accessibility: Add "Skip to main content" link in Bottom.php
- JS Reset focus after AJAX so "Skip to main content" a11y link has focus first in warehouse.js
- PHP 7.3 compat: use count() for array variables only, program wide
Changes in 4.5.1
----------------
......
......@@ -65,11 +65,10 @@ function CustomFields( $location, $type = 'student', $extra = array() )
$cust_end = isset( $_REQUEST['cust_end'] ) ? $_REQUEST['cust_end'] : null;
// Get custom (staff) fields.
if ( count( $cust )
|| count( $cust_begin )
|| count( $cust_end )
|| ( isset( $_REQUEST['cust_null'] )
&& count( (array) $_REQUEST['cust_null'] ) ) )
if ( ! empty( $cust )
|| ! empty( $cust_begin )
|| ! empty( $cust_end )
|| ! empty( $_REQUEST['cust_null'] ) )
{
$fields = ParseMLArray( DBGet( "SELECT TITLE,'CUSTOM_'||ID AS COLUMN,
TYPE,SELECT_OPTIONS
......
......@@ -97,7 +97,7 @@ if ( ! $_REQUEST['modfunc'] )
$i++;
}
if (count($RET) && ! $_REQUEST['print_statements'] && AllowEdit())
if (! empty( $RET ) && ! $_REQUEST['print_statements'] && AllowEdit())
$columns = array('REMOVE' => '');
else
$columns = array();
......
......@@ -91,7 +91,7 @@ if ( ! $_REQUEST['modfunc'] )
$i++;
}
if (count($RET) && ! $_REQUEST['print_statements'] && AllowEdit() && !isset($_REQUEST['_ROSARIO_PDF']))
if (! empty( $RET ) && ! $_REQUEST['print_statements'] && AllowEdit() && !isset($_REQUEST['_ROSARIO_PDF']))
$columns = array('REMOVE' => '');
else
$columns = array();
......
......@@ -89,7 +89,7 @@ if (UserStaffID() && ! $_REQUEST['modfunc'])
$i++;
}
if (count($RET) && ! $_REQUEST['print_statements'] && AllowEdit() && !isset($_REQUEST['_ROSARIO_PDF']))
if (! empty( $RET ) && ! $_REQUEST['print_statements'] && AllowEdit() && !isset($_REQUEST['_ROSARIO_PDF']))
$columns = array('REMOVE' => '');
else
$columns = array();
......
......@@ -106,7 +106,7 @@ if (UserStaffID() && ! $_REQUEST['modfunc'])
$i++;
}
if (count($RET) && ! $_REQUEST['print_statements'] && AllowEdit())
if (! empty( $RET ) && ! $_REQUEST['print_statements'] && AllowEdit())
$columns = array('REMOVE' => '');
else
$columns = array();
......
......@@ -17,7 +17,7 @@ else
$RET = GetStaffList($extra);
if (count($RET))
if (! empty( $RET ))
{
$SESSION_staff_id_save = UserStaffID();
$handle = PDFStart();
......
......@@ -174,7 +174,7 @@ if ( $_REQUEST['attendance']
RedirectURL( 'attendance' );
}
if ( count( $_REQUEST['attendance_day'] ) )
if ( ! empty( $_REQUEST['attendance_day'] ) )
{
foreach ( (array) $_REQUEST['attendance_day'] as $student_id => $comment )
{
......@@ -200,7 +200,7 @@ ORDER BY SORT_ORDER" );
$categories_RET = DBGet( "SELECT ID,TITLE FROM ATTENDANCE_CODE_CATEGORIES WHERE SYEAR='".UserSyear()."' AND SCHOOL_ID='".UserSchool()."'" );
if (count($categories_RET))
if (! empty( $categories_RET ))
{
$tmp_PHP_SELF = PreparePHP_SELF( $_REQUEST, array( 'table', 'codes' ) );
......@@ -305,8 +305,7 @@ else
AND ac.SYEAR=ssm.SYEAR " . str_replace( 'TABLE_NAME', 'ac.TABLE_NAME', $extra_sql );
}
if ( isset( $_REQUEST['codes'] )
&& count( $_REQUEST['codes'] ) )
if ( ! empty( $_REQUEST['codes'] ) )
{
$REQ_codes = $_REQUEST['codes'];
......@@ -327,7 +326,7 @@ else
$abs = ($_REQUEST['table']=='0'); //true;
}
if (count($REQ_codes) && ! $abs)
if (! empty( $REQ_codes ) && ! $abs)
{
$extra['WHERE'] .= "AND ac.ID IN (";
foreach ( (array) $REQ_codes as $code)
......@@ -340,7 +339,7 @@ else
elseif ( $abs)
{
$RET = DBGet( "SELECT ID FROM ATTENDANCE_CODES WHERE SYEAR='".UserSyear()."' AND SCHOOL_ID='".UserSchool()."' AND (DEFAULT_CODE!='Y' OR DEFAULT_CODE IS NULL) AND TABLE_NAME='".$_REQUEST['table']."'" );
if (count($RET))
if (! empty( $RET ))
{
$extra['WHERE'] .= "AND ac.ID IN (";
foreach ( (array) $RET as $code)
......@@ -511,7 +510,7 @@ function _makeCodeSearch($value='')
$return = '<select name=codes[]><option value="">'._('All').'</option>';
if ( $_REQUEST['table']=='0')
$return .= '<option value="A"'.(($value=='A')?' selected':'').'>'._('Not Present').'</option>';
if (count($codes_RET))
if (! empty( $codes_RET ))
{
foreach ( (array) $codes_RET as $code)
$return .= '<option value="'.$code['ID'].'"'.($value==$code['ID']?' selected':'').'>'.$code['TITLE'].'</option>';
......
......@@ -97,7 +97,7 @@ else
$extra['WHERE'] = " AND EXISTS (SELECT '' FROM ATTENDANCE_PERIOD ap,ATTENDANCE_CODES ac WHERE ap.SCHOOL_DATE='".$date."' AND ap.STUDENT_ID=ssm.STUDENT_ID AND ap.ATTENDANCE_CODE=ac.ID AND ac.SCHOOL_ID=ssm.SCHOOL_ID AND ac.SYEAR=ssm.SYEAR ";
if ( isset( $_REQUEST['codes'] )
&& count( $_REQUEST['codes'] ) )
&& ! empty( $_REQUEST['codes'] ) )
{
$REQ_codes = $_REQUEST['codes'];
......@@ -118,7 +118,7 @@ else
$abs = true;
}
if (count($REQ_codes) && ! $abs)
if (! empty( $REQ_codes ) && ! $abs)
{
$extra['WHERE'] .= "AND ac.ID IN (";
foreach ( (array) $REQ_codes as $code)
......@@ -128,7 +128,7 @@ else
elseif ( $abs)
{
$RET = DBGet( "SELECT ID FROM ATTENDANCE_CODES WHERE SYEAR='".UserSyear()."' AND SCHOOL_ID='".UserSchool()."' AND (DEFAULT_CODE!='Y' OR DEFAULT_CODE IS NULL)" );
if (count($RET))
if (! empty( $RET ))
{
$extra['WHERE'] .= "AND ac.ID IN (";
foreach ( (array) $RET as $code)
......@@ -249,7 +249,7 @@ function _makeCodeSearch($value='')
{ global $codes_RET,$code_search_selected;
$return = '<select name=codes[]><option value="">All</option><option value="A"'.(($value=='A')?' selected':'').'>NP</option>';
if (count($codes_RET))
if (! empty( $codes_RET ))
{
foreach ( (array) $codes_RET as $code)
{
......
......@@ -2,7 +2,7 @@
DrawHeader( ProgramTitle() );
if (count($_REQUEST['mp_arr']))
if (! empty( $_REQUEST['mp_arr'] ))
{
foreach ( (array) $_REQUEST['mp_arr'] as $mp )
{
......@@ -116,7 +116,7 @@ if ( isset( $_REQUEST['search_modfunc'] )
$startrow = $endrow - $rows_per_page;
//echo "Startrow: $startrow Endrow: $endrow <br />";
if (count($RET))
if (! empty( $RET ))
{
unset($extra);
......
......@@ -233,7 +233,7 @@ function _make( $value, $column )
break;
case 'GRADE_ID':
return GetGrade( $value ) . ( count( $cal_days ) > 1 ? ' - ' . $calendars_RET[$THIS_RET['CALENDAR_ID']][1]['TITLE'] : '' );
return GetGrade( $value ) . ( count( (array) $cal_days ) > 1 ? ' - ' . $calendars_RET[$THIS_RET['CALENDAR_ID']][1]['TITLE'] : '' );
}
}
......
......@@ -33,7 +33,7 @@ if ( $_REQUEST['search_modfunc'] || $_REQUEST['student_id'] || User('PROFILE')==
ORDER BY sp.SORT_ORDER" );
$period_select = '<select name="period_id" onchange="ajaxPostForm(this.form,true);"><option value="">'._('Daily').'</option>';
if (count($periods_RET))
if (! empty($periods_RET))
{
//FJ All periods
if (count($periods_RET) > 1)
......@@ -98,7 +98,7 @@ if ( ! empty( $_REQUEST['period_id'] ) )
$extra['columns_after']['STATE_ABS'] = _('State Abs');
$codes_RET = DBGet( "SELECT ID,TITLE FROM ATTENDANCE_CODES WHERE SYEAR='".UserSyear()."' AND SCHOOL_ID='".UserSchool()."' AND TABLE_NAME='0' AND (DEFAULT_CODE!='Y' OR DEFAULT_CODE IS NULL)" );
if (count($codes_RET)>1)
if (! empty($codes_RET) && count($codes_RET)>1)
{
foreach ( (array) $codes_RET as $code)
{
......
......@@ -35,7 +35,7 @@ if ( $cp_title )
DrawHeader( $cp_title );
}
if ( count( $categories_RET ) == 0 )
if ( empty( $categories_RET ) )
{
echo '<form action="Modules.php?modname=' . $_REQUEST['modname'] . '&table=' . $_REQUEST['table'] . '" method="POST">';
DrawHeader( PrepareDate( $date, '_date', false, array( 'submit' => true ) ) );
......@@ -106,7 +106,7 @@ else
// Instead of displaying a fatal error which could confuse user, display a warning and exit.
$fatal_warning = array();
if ( ! count( $course_RET ) )
if ( empty( $course_RET ) )
{
$fatal_warning[] = _( 'You cannot take attendance for this period on this day.' );
}
......@@ -237,7 +237,7 @@ if ( ! empty( $_REQUEST['attendance'] )
AND PERIOD_ID='" . UserPeriod() . "'
AND TABLE_NAME='" . $_REQUEST['table'] . "'" );
if ( ! count( $completed_RET ) )
if ( empty( $completed_RET ) )
{
DBQuery( "INSERT INTO ATTENDANCE_COMPLETED (STAFF_ID,SCHOOL_DATE,PERIOD_ID,TABLE_NAME)
values(
......@@ -380,7 +380,7 @@ foreach ( (array) $categories_RET as $category )
);
}
if ( count( $categories_RET ) )
if ( ! empty( $categories_RET ) )
{
$LO_options = array(
'download' => false,
......
......@@ -85,11 +85,11 @@ function UpdateAttendanceDaily( $student_id, $date = '', $comment = false )
$length = '0.0';
$current_RET = DBGet( "SELECT MINUTES_PRESENT,STATE_VALUE,COMMENT FROM ATTENDANCE_DAY WHERE STUDENT_ID='".$student_id."' AND SCHOOL_DATE='".$date."'" );
if (count($current_RET) && ($current_RET[1]['MINUTES_PRESENT']!=$total || $current_RET[1]['STATE_VALUE']!=$length))
if (! empty( $current_RET ) && ($current_RET[1]['MINUTES_PRESENT']!=$total || $current_RET[1]['STATE_VALUE']!=$length))
DBQuery("UPDATE ATTENDANCE_DAY SET MINUTES_PRESENT='".$total."',STATE_VALUE='".$length."'".($comment!==false?",COMMENT='".$comment."'":'')." WHERE STUDENT_ID='".$student_id."' AND SCHOOL_DATE='".$date."'");
elseif (count($current_RET) && $comment!==false && $current_RET[1]['COMMENT']!=$comment)
elseif (! empty( $current_RET ) && $comment!==false && $current_RET[1]['COMMENT']!=$comment)
DBQuery("UPDATE ATTENDANCE_DAY SET COMMENT='".$comment."' WHERE STUDENT_ID='".$student_id."' AND SCHOOL_DATE='".$date."'");
elseif (count($current_RET)==0)
elseif (empty( $current_RET ))
{
DBQuery( "INSERT INTO ATTENDANCE_DAY (SYEAR,STUDENT_ID,SCHOOL_DATE,MINUTES_PRESENT,STATE_VALUE,MARKING_PERIOD_ID,COMMENT)
values('" . UserSyear() . "','" . $student_id . "','" . $date . "','" . $total . "','" .
......
......@@ -2,7 +2,7 @@
if ( $_REQUEST['modfunc'] === 'save' )
{
if ( count( $_REQUEST['st_arr'] ) )
if ( ! empty( $_REQUEST['st_arr'] ) )
{
$st_list = "'" . implode( "','", $_REQUEST['st_arr'] ) . "'";
......@@ -48,7 +48,7 @@ if ( $_REQUEST['modfunc'] === 'save' )
$RET = GetStuList( $extra );
if ( count( $RET ) )
if ( ! empty( $RET ) )
{
//change orientation to landscape
$_SESSION['orientation'] = 'landscape';
......
......@@ -124,7 +124,7 @@ if ( $_REQUEST['modfunc'] === 'save'
$message['new'] = str_replace( "''", "'", $_REQUEST['inputcreateparentstext_new'] );
$message['old'] = str_replace( "''", "'", $_REQUEST['inputcreateparentstext_old'] );
if ( count( $_REQUEST['student'] ) )
if ( ! empty( $_REQUEST['student'] ) )
{
$st_list = "'" . implode( "','", $_REQUEST['student'] ) . "'";
......@@ -172,7 +172,7 @@ if ( $_REQUEST['modfunc'] === 'save'
$user = $user[1];
//FJ change parent password generation
//$password = $passwords[rand(0,count($passwords)-1)];
//$password = $passwords[rand(0,count( $passwords )-1)];
$password = $username . rand( 100, 999 );
// FJ Moodle integrator / password.
......@@ -468,7 +468,7 @@ function _makeContactSelect( $value, $column )
STAFF_ID='" . $THIS_RET['STAFF_ID'] . "'" );
}
if ( count( $RET ) )
if ( ! empty( $RET ) )
{
$checked = ' checked';
......
......@@ -198,7 +198,7 @@ function _makeTV( $value, $column )
WHERE PERSON_ID='" . $THIS_RET['PERSON_ID'] . "'
LIMIT 10" );
if ( count( $person_RET ) > $maxTV )
if ( count( (array) $person_RET ) > $maxTV )
{
$maxTV = count( $person_RET );
}
......
......@@ -35,7 +35,7 @@ if ( $_REQUEST['modfunc'] === 'save' )
$message = str_replace( "''", "'", $_REQUEST['inputnotifyparentstext'] );
if ( count( $_REQUEST['staff'] ) )
if ( ! empty( $_REQUEST['staff'] ) )
{
$st_list = "'" . implode( "','", $_REQUEST['staff'] ) . "'";
......
......@@ -196,7 +196,7 @@ if ( ! $_REQUEST['modfunc'] )
}
}
if ( count( $referrals_RET ) )
if ( ! empty( $referrals_RET ) )
{
$columns = array( 'REMOVE' => '' );
}
......
......@@ -11,7 +11,7 @@ AddRequestedDates( 'values', 'post' );
if ( $_REQUEST['modfunc'] === 'save' )
{
if ( count( $_REQUEST['st_arr'] ) )
if ( ! empty( $_REQUEST['st_arr'] ) )
{
$email_sent = false;
......
......@@ -9,8 +9,7 @@ DrawHeader( ProgramTitle() );
// Add eventual Dates to $_REQUEST['values'].
AddRequestedDates( 'values', 'post' );
if ( isset( $_POST['values'] )
&& count( $_POST['values'] )
if ( ! empty( $_POST['values'] )
&& AllowEdit() )
{
$sql = "UPDATE DISCIPLINE_REFERRALS SET ";
......@@ -152,7 +151,7 @@ if ( ! $_REQUEST['modfunc']
$RET = DBGet( "SELECT * FROM DISCIPLINE_REFERRALS WHERE ID='".$_REQUEST['referral_id']."'" . $where );
if (count($RET))
if (! empty( $RET ))
{
$RET = $RET[1];
......
......@@ -41,7 +41,7 @@ function EmailReferral( $referral_id, $emails )
AND u.SYEAR='" . UserSyear() . "'
ORDER BY " . db_case( array( 'DATA_TYPE', "'textarea'", "'1'", "'0'" ) ) . ",SORT_ORDER", array(), array( 'ID' ) );
if ( count( $referral_RET ) )
if ( ! empty( $referral_RET ) )
{
$referral = $referral_RET[1];
......
......@@ -6,7 +6,7 @@ if ( $_REQUEST['modfunc'] === 'save' )
{
if ( ! empty( $_REQUEST['activity_id'] ) )
{
if ( count( $_REQUEST['student'] ) )
if ( ! empty( $_REQUEST['student'] ) )
{
// FJ fix bug add the same activity more than once
// $current_RET = DBGet( "SELECT STUDENT_ID FROM STUDENT_ELIGIBILITY_ACTIVITIES WHERE ACTIVITY_ID='".$_SESSION['activity_id']."' AND SYEAR='".UserSyear()."'",array(),array('STUDENT_ID'));
......@@ -67,12 +67,9 @@ if ( $_REQUEST['search_modfunc'] == 'list' )
AND SCHOOL_ID='" . UserSchool() . "'" );
echo '<select name="activity_id"><option value="">' . _( 'N/A' ) . '</option>';
if ( count( $activities_RET ) )
foreach ( (array) $activities_RET as $activity )
{
foreach ( (array) $activities_RET as $activity )
{
echo '<option value="' . $activity['ID'] . '">' . $activity['TITLE'] . '</option>';
}
echo '<option value="' . $activity['ID'] . '">' . $activity['TITLE'] . '</option>';
}
echo '</select>';
......
......@@ -79,7 +79,7 @@ if ( $_REQUEST['modfunc']=='gradebook')
AND (ga.DUE_DATE IS NULL OR CURRENT_DATE>=ga.DUE_DATE) OR gg.POINTS IS NOT NULL)
GROUP BY s.STUDENT_ID,ss.START_DATE",array(),array('STUDENT_ID'));
if (count($points_RET))
if (! empty( $points_RET ))
{
foreach ( (array) $points_RET as $student_id => $student)
{
......@@ -125,7 +125,7 @@ if ( ! empty( $_REQUEST['values'] )
DBQuery($sql);
}
$RET = DBGet( "SELECT 'completed' AS COMPLETED FROM ELIGIBILITY_COMPLETED WHERE STAFF_ID='".User('STAFF_ID')."' AND SCHOOL_DATE BETWEEN '".$start_date."' AND '".$end_date."' AND PERIOD_ID='".UserPeriod()."'" );
if ( !count($RET))
if ( ! empty( $RET ))
DBQuery("INSERT INTO ELIGIBILITY_COMPLETED (STAFF_ID,SCHOOL_DATE,PERIOD_ID) values('".User('STAFF_ID')."','".DBDate()."','".UserPeriod()."')");
$current_RET = DBGet( "SELECT ELIGIBILITY_CODE,STUDENT_ID FROM ELIGIBILITY WHERE SCHOOL_DATE BETWEEN '".$start_date."' AND '".$end_date."' AND PERIOD_ID='".UserPeriod()."'",array(),array('STUDENT_ID'));
......
......@@ -19,7 +19,7 @@ if ( $_REQUEST['modfunc'] === 'add'
AND ACTIVITY_ID='" . $_REQUEST['new_activity'] . "'
AND SYEAR='" . UserSyear() . "'" );
if (count($activity_RET))
if (! empty( $activity_RET ))
echo ErrorMessage(array(_('The activity you selected is already assigned to this student!')));
else
DBQuery("INSERT INTO STUDENT_ELIGIBILITY_ACTIVITIES (STUDENT_ID,ACTIVITY_ID,SYEAR) values('".UserStudentID()."','".$_REQUEST['new_activity']."','".UserSyear()."')");
......@@ -132,10 +132,10 @@ if ( UserStudentID()
ORDER BY ea.START_DATE",array('START_DATE' => 'ProperDate','END_DATE' => 'ProperDate'));
$activities_RET = DBGet( "SELECT ID,TITLE FROM ELIGIBILITY_ACTIVITIES WHERE SYEAR='".UserSyear()."' AND SCHOOL_ID='".UserSchool()."'" );
if (count($activities_RET))
foreach ( (array) $activities_RET as $value)
{
foreach ( (array) $activities_RET as $value)
$activities[$value['ID']] = $value['TITLE'];
$activities[$value['ID']] = $value['TITLE'];
}
$link['remove']['link'] = 'Modules.php?modname='.$_REQUEST['modname'].'&modfunc=remove&start_date='.$_REQUEST['start_date'];
......
......@@ -50,7 +50,7 @@ $menus_RET = DBGet( "SELECT MENU_ID,TITLE
if ( empty( $_REQUEST['menu_id'] ) )
if ( ! $_SESSION['FSA_menu_id'])
if (count($menus_RET))
if (! empty( $menus_RET ))
$_REQUEST['menu_id'] = $_SESSION['FSA_menu_id'] = key($menus_RET);
else
ErrorMessage(array(_('There are no menus yet setup.')),'fatal');
......@@ -156,7 +156,7 @@ if ( ! empty( $_REQUEST['submit']['print'] ) )
$day_inner_classes = 'width-100p';
if ( count( $events_RET[ $date ] ) )
if ( ! empty( $events_RET[ $date ] ) )
{
$day_inner_classes .= ' hover';
}
......@@ -164,19 +164,19 @@ if ( ! empty( $_REQUEST['submit']['print'] ) )
$day_number_classes = 'number';
// Bold class
if ( count( $events_RET[ $date ] )
|| count( $assignments_RET[ $date ] ) )
if ( ! empty( $events_RET[ $date ] )
|| ! empty( $assignments_RET[ $date ] ) )
{
$day_number_classes .= ' bold';
}
echo '<td class="calendar-day' . $day_classes . '" style="background-color:' . ( count( $events_RET[ $date ] ) ? '#ffaaaa;' : '#fff' ) . '">
echo '<td class="calendar-day' . $day_classes . '" style="background-color:' . ( ! empty( $events_RET[ $date ] ) ? '#ffaaaa;' : '#fff' ) . '">
<table class="' . $day_inner_classes . '">
<tr><td class="' . $day_number_classes . '">' . $i . '</td></tr>';
echo '<tr><td class="calendar-menu">';
if (count($events_RET[ $date ]))
if (! empty( $events_RET[ $date ] ))
{
foreach ( (array) $events_RET[ $date ] as $event)
{
......@@ -207,7 +207,7 @@ else
if (AllowEdit())
{
$description_RET = DBGet( "SELECT DISTINCT DESCRIPTION FROM CALENDAR_EVENTS WHERE SYEAR='".UserSyear()."' AND SCHOOL_ID='".UserSchool()."' AND TITLE='".$menus_RET[$_REQUEST['menu_id']][1]['TITLE']."' AND DESCRIPTION IS NOT NULL ORDER BY DESCRIPTION" );
if (count($description_RET))
if (! empty( $description_RET ))
{
$description_select = '<option value="">'._('or select previous meal').'</option>';
foreach ( (array) $description_RET as $description)
......
......@@ -10,11 +10,11 @@ if ( ! empty( $_REQUEST['menu_id'] ) )
if ( $_REQUEST['menu_id']!='new')
if ( $menus_RET[$_REQUEST['menu_id']])
$_SESSION['FSA_menu_id'] = $_REQUEST['menu_id'];
elseif (count($menus_RET))
elseif (! empty( $menus_RET ))
$_REQUEST['menu_id'] = $_SESSION['FSA_menu_id'] = key($menus_RET);
else
ErrorMessage(array(_('There are no menus yet setup.')),'fatal');
elseif (count($menus_RET))
elseif (! empty( $menus_RET ))
$_REQUEST['menu_id'] = $_SESSION['FSA_menu_id'] = key($menus_RET);
else
ErrorMessage(array(_('There are no menus yet setup.')),'fatal');
......@@ -24,12 +24,12 @@ else
if ( $_SESSION['FSA_menu_id'])
if ( $menus_RET[$_SESSION['FSA_menu_id']])
$_REQUEST['menu_id'] = $_SESSION['FSA_menu_id'];
elseif (count($menus_RET))
elseif (! empty( $menus_RET ))
$_REQUEST['menu_id'] = $_SESSION['FSA_menu_id'] = key($menus_RET);
else
ErrorMessage(array(_('There are no menus yet setup.')),'fatal');
else
if (count($menus_RET))
if (! empty( $menus_RET ))
$_REQUEST['menu_id'] = $_SESSION['FSA_menu_id'] = key($menus_RET);
else
ErrorMessage(array(_('There are no menus yet setup.')),'fatal');
......@@ -63,7 +63,7 @@ echo '<br />';
echo '<div class="center">' . WrapTabs($meals,'Modules.php?modname='.$_REQUEST['modname'].'&menu_id='.$_REQUEST['menu_id']) . '</div>';
if (count($items_RET))
if (! empty( $items_RET ))
{
$per_row = ceil(sqrt(count($items_RET)));
//FJ css WPadmin
......
......@@ -172,7 +172,7 @@ if ( ! $_REQUEST['modfunc'] )
{
$_SESSION['FSA_menu_id'] = $_REQUEST['tab_id'];
}
elseif ( count( $menus_RET ) )
elseif ( ! empty( $menus_RET ) )
{
$_REQUEST['tab_id'] = $_SESSION['FSA_menu_id'] = key( $menus_RET );
}
......@@ -190,7 +190,7 @@ if ( ! $_REQUEST['modfunc'] )
{
$_REQUEST['tab_id'] = $_SESSION['FSA_menu_id'];
}
elseif ( count( $menus_RET ) )
elseif ( ! empty( $menus_RET ) )
{
$_REQUEST['tab_id'] = $_SESSION['FSA_menu_id'] = key( $menus_RET );
}
......@@ -199,7 +199,7 @@ if ( ! $_REQUEST['modfunc'] )
$_REQUEST['tab_id'] = 'new';
}
}
elseif ( count( $menus_RET ) )