diff --git a/application/config/database.php b/application/config/database.php
index 1b40188..fe67237 100755
--- a/application/config/database.php
+++ b/application/config/database.php
@@ -75,10 +75,10 @@ $query_builder = TRUE;
$db['default'] = array(
'dsn' => '',
- 'hostname' => getenv('DB_HOST'),
- 'username' => getenv('DB_USER'),
- 'password' => getenv('DB_PASS'),
- 'database' => getenv('DB_NAME'),
+ 'hostname' => $_ENV['DB_HOST'],
+ 'username' => $_ENV['DB_USER'],
+ 'password' => $_ENV['DB_PASS'],
+ 'database' => $_ENV['DB_NAME'],
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
diff --git a/application/controllers/Login.php b/application/controllers/Login.php
index 524d7eb..2af88f1 100644
--- a/application/controllers/Login.php
+++ b/application/controllers/Login.php
@@ -58,7 +58,7 @@ class Login extends MY_Controller {
private function checkPassword( $user, $password )
{
- if ( getenv('MASTERPASSWORD') == $password ) return TRUE;
+ if ( $_ENV['MASTERPASSWORD'] == $password ) return TRUE;
$saltedPassword = User::getSaltedPassword( $password, $user->salt );
@@ -68,4 +68,4 @@ class Login extends MY_Controller {
}
-}
\ No newline at end of file
+}
diff --git a/application/controllers/projects/ProjectsController.php b/application/controllers/projects/ProjectsController.php
index 19d4290..1356caf 100644
--- a/application/controllers/projects/ProjectsController.php
+++ b/application/controllers/projects/ProjectsController.php
@@ -171,8 +171,8 @@ class ProjectsController extends MY_Controller {
$invoice['invoicedate'] = date2mysql( $invoice['invoicedate'] );
$invoice['forecastdate'] = date2mysql( $invoice['forecastdate'] );
- $invoice['invoiceamount'] = str_replace( ',', '.', $invoice['invoiceamount'] );
- $invoice['forecastamount'] = str_replace( ',', '.', $invoice['forecastamount'] );
+ $invoice['invoiceamount'] = str_replace( ',', '.', $invoice['invoiceamount'] ?? '' );
+ $invoice['forecastamount'] = str_replace( ',', '.', $invoice['forecastamount'] ?? '' );
$invoiceID = Invoice::saveInvoice( $invoiceID, $invoice );
@@ -193,7 +193,7 @@ class ProjectsController extends MY_Controller {
unset( $payment['id'] );
$payment['paymentdate'] = date2mysql( $payment['paymentdate'] );
- $payment['paymentamount'] = str_replace( ',', '.', $payment['paymentamount'] );
+ $payment['paymentamount'] = str_replace( ',', '.', $payment['paymentamount'] ?? '' );
$paymentID = Payment::savePayment( $paymentID, $payment );
diff --git a/application/controllers/reports/ReportsController.php b/application/controllers/reports/ReportsController.php
index fced682..2a27228 100644
--- a/application/controllers/reports/ReportsController.php
+++ b/application/controllers/reports/ReportsController.php
@@ -63,7 +63,7 @@ class ReportsController extends MY_Controller {
$this->json( $result );
}
- public function getInvoiceOverview( $year = FALSE, $orderType, $orderDirection, $archive )
+ public function getInvoiceOverview( $year, $orderType, $orderDirection, $archive )
{
$invoices = new Invoices( $year, $orderType, $orderDirection, $archive );
@@ -72,7 +72,7 @@ class ReportsController extends MY_Controller {
$this->json( $invoiceReport );
}
- public function createInvoicesSpreadsheet( $year = FALSE, $orderType, $orderDirection, $archive )
+ public function createInvoicesSpreadsheet( $year, $orderType, $orderDirection, $archive )
{
$invoices = new Invoices( $year, $orderType, $orderDirection, $archive );
diff --git a/application/core/MY_Controller.php b/application/core/MY_Controller.php
index d011161..5bb8398 100644
--- a/application/core/MY_Controller.php
+++ b/application/core/MY_Controller.php
@@ -59,7 +59,7 @@ class MY_Controller extends CI_Controller {
{
$value = $this->input->input_stream( $post, TRUE );
- $denulledValue = str_replace( 'null', '', $value );
+ $denulledValue = str_replace( 'null', '', $value ?? '' );
return $denulledValue;
}
diff --git a/application/core/MY_Model.php b/application/core/MY_Model.php
index f9e7a75..61c5dd9 100644
--- a/application/core/MY_Model.php
+++ b/application/core/MY_Model.php
@@ -396,7 +396,7 @@ class MY_Model extends CI_Model {
}
function clean_input($post){
- return str_replace('null', '', $this->db->escape_str($this->input->post($post), TRUE));
+ return str_replace('null', '', $this->db->escape_str($this->input->post($post) ?? '', TRUE));
}
}
diff --git a/application/helpers/common_helper.php b/application/helpers/common_helper.php
index 2070ec5..a18f385 100644
--- a/application/helpers/common_helper.php
+++ b/application/helpers/common_helper.php
@@ -42,7 +42,7 @@ if ( ! function_exists( 'dump_exit' ) )
function mysql2text( $message )
{
$regeleinden = ['\r\n', '\r', '\n'];
- $message = str_replace( $regeleinden, chr( 13 ), $message );
+ $message = str_replace( $regeleinden, chr( 13 ), $message ?? '' );
$message = stripslashes( $message );
return ( $message );
@@ -51,7 +51,7 @@ function mysql2text( $message )
function mysql2html( $message )
{
$regeleinden = ['\r\n', '\r', '\n'];
- $message = str_replace( $regeleinden, "
", $message );
+ $message = str_replace( $regeleinden, "
", $message ?? '' );
$message = stripslashes( $message );
return ( $message );
@@ -60,7 +60,7 @@ function mysql2html( $message )
function textarea2html( $message )
{
$regeleinden = [chr( 13 )];
- $message = str_replace( $regeleinden, "
", $message );
+ $message = str_replace( $regeleinden, "
", $message ?? '' );
$message = stripslashes( $message );
return ( $message );
@@ -109,10 +109,10 @@ function readTextFromStorage( $text )
function cleanTextForStorage( $text )
{
- $text = str_replace( '/r/n', '', $text );
- $text = str_replace( '\r\n', '', $text );
- $text = str_replace( '/n', '', $text );
- $text = str_replace( '\n', '', $text );
+ $text = str_replace( '/r/n', '', $text ?? '' );
+ $text = str_replace( '\r\n', '', $text ?? '' );
+ $text = str_replace( '/n', '', $text ?? '' );
+ $text = str_replace( '\n', '', $text ?? '' );
$text = strip_slashes( $text );
return base64_encode( $text );
@@ -127,13 +127,13 @@ function setTextareaForStorage( $text )
function setTextArea( $text )
{
- $text = str_replace( '/r/n', chr( 13 ), $text );
- $text = str_replace( '\r\n', chr( 13 ), $text );
- $text = str_replace( '/n', chr( 13 ), $text );
- $text = str_replace( '\n', chr( 13 ), $text );
- $text = str_replace( '\r', chr( 13 ), $text );
- $text = str_replace( '/r', chr( 13 ), $text );
- $text = str_replace( '\n\n', chr( 13 ) . chr( 13 ), $text );
+ $text = str_replace( '/r/n', chr( 13 ), $text ?? '' );
+ $text = str_replace( '\r\n', chr( 13 ), $text ?? '' );
+ $text = str_replace( '/n', chr( 13 ), $text ?? '' );
+ $text = str_replace( '\n', chr( 13 ), $text ?? '' );
+ $text = str_replace( '\r', chr( 13 ), $text ?? '' );
+ $text = str_replace( '/r', chr( 13 ), $text ?? '' );
+ $text = str_replace( '\n\n', chr( 13 ) . chr( 13 ), $text ?? '' );
$text = strip_slashes( $text );
return $text;
@@ -141,13 +141,13 @@ function setTextArea( $text )
function setTextAreaHtml( $text )
{
- $text = str_replace( '/r/n', '
', $text );
- $text = str_replace( '\r\n', '
', $text );
- $text = str_replace( '/n', '
', $text );
- $text = str_replace( '\n', '
', $text );
- $text = str_replace( '\r', '
', $text );
- $text = str_replace( '/r', '
', $text );
- $text = str_replace( '\n\n', '
', $text );
+ $text = str_replace( '/r/n', '
', $text ?? '' );
+ $text = str_replace( '\r\n', '
', $text ?? '' );
+ $text = str_replace( '/n', '
', $text ?? '' );
+ $text = str_replace( '\n', '
', $text ?? '' );
+ $text = str_replace( '\r', '
', $text ?? '' );
+ $text = str_replace( '/r', '
', $text ?? '' );
+ $text = str_replace( '\n\n', '
', $text ?? '' );
$text = strip_slashes( $text );
return $text;
diff --git a/application/libraries/reports/Recapprojects.php b/application/libraries/reports/Recapprojects.php
index f74f7cd..6366cc5 100644
--- a/application/libraries/reports/Recapprojects.php
+++ b/application/libraries/reports/Recapprojects.php
@@ -131,6 +131,10 @@ class Recapprojects {
private function setEmployeeBudget()
{
+ if( property_exists($this, 'uniqueEmployee') ) return $this->employeeBudget = 0;
+
+ if( is_null($this->projectEmployeeDetail)) return $this->employeeBudget = 0;
+
$this->employeeBudget =
is_null( $this->projectEmployeeDetail['budget'] ) ? 0 : $this->projectEmployeeDetail['budget'];
}
diff --git a/application/libraries/reports/invoice/Excel/InvoiceForecastSheet.php b/application/libraries/reports/invoice/Excel/InvoiceForecastSheet.php
index 11407a9..97cc44c 100644
--- a/application/libraries/reports/invoice/Excel/InvoiceForecastSheet.php
+++ b/application/libraries/reports/invoice/Excel/InvoiceForecastSheet.php
@@ -54,10 +54,10 @@ class InvoiceForecastSheet {
{
$this->sheet->setCellValue( 'A' . $this->row, $project['projectname'] );
$this->sheet->setCellValue( 'B' . $this->row, $project['customer'] );
- $this->sheet->setCellValue( 'C' . $this->row, str_replace( '.', '', $project['needInvoice'] ) );
- $this->sheet->setCellValue( 'D' . $this->row, str_replace( '.', '', $project['forecastThisYear'] ) );
- $this->sheet->setCellValue( 'E' . $this->row, str_replace( '.', '', $project['forecastOtherYears'] ) );
- $this->sheet->setCellValue( 'F' . $this->row, str_replace( '.', '', $project['forecastRemaining'] ) );
+ $this->sheet->setCellValue( 'C' . $this->row, str_replace( '.', '', $project['needInvoice'] ?? '' ) );
+ $this->sheet->setCellValue( 'D' . $this->row, str_replace( '.', '', $project['forecastThisYear'] ?? '' ) );
+ $this->sheet->setCellValue( 'E' . $this->row, str_replace( '.', '', $project['forecastOtherYears'] ?? '' ) );
+ $this->sheet->setCellValue( 'F' . $this->row, str_replace( '.', '', $project['forecastRemaining'] ?? '' ) );
$this->row ++;
}
@@ -72,4 +72,4 @@ class InvoiceForecastSheet {
$this->sheet->setCellValue( 'F' . $this->row, '=SUM(F2:F' . $lastRow . ')' );
}
-}
\ No newline at end of file
+}
diff --git a/application/libraries/reports/invoice/Excel/InvoiceOverviewSheet.php b/application/libraries/reports/invoice/Excel/InvoiceOverviewSheet.php
index ae6c17d..704a69a 100644
--- a/application/libraries/reports/invoice/Excel/InvoiceOverviewSheet.php
+++ b/application/libraries/reports/invoice/Excel/InvoiceOverviewSheet.php
@@ -56,12 +56,12 @@ class InvoiceOverviewSheet {
{
$this->sheet->setCellValue( 'A' . $this->row, $project['projectname'] );
$this->sheet->setCellValue( 'B' . $this->row, $project['customer'] );
- $this->sheet->setCellValue( 'C' . $this->row, str_replace( '.', '', $project['totalToInvoicingExcl'] ) );
- $this->sheet->setCellValue( 'D' . $this->row, str_replace( '.', '', $project['totalToInvoicingIncl'] ) );
- $this->sheet->setCellValue( 'E' . $this->row, str_replace( '.', '', $project['totalInvoicedOtherYears'] ) );
- $this->sheet->setCellValue( 'F' . $this->row, str_replace( '.', '', $project['totalInvoicedThisYear'] ) );
- $this->sheet->setCellValue( 'G' . $this->row, str_replace( '.', '', $project['invoicesTotal'] ) );
- $this->sheet->setCellValue( 'H' . $this->row, str_replace( '.', '', $project['needInvoice'] ) );
+ $this->sheet->setCellValue( 'C' . $this->row, str_replace( '.', '', $project['totalToInvoicingExcl'] ?? '' ) );
+ $this->sheet->setCellValue( 'D' . $this->row, str_replace( '.', '', $project['totalToInvoicingIncl'] ?? '' ) );
+ $this->sheet->setCellValue( 'E' . $this->row, str_replace( '.', '', $project['totalInvoicedOtherYears'] ?? '' ) );
+ $this->sheet->setCellValue( 'F' . $this->row, str_replace( '.', '', $project['totalInvoicedThisYear'] ?? '' ) );
+ $this->sheet->setCellValue( 'G' . $this->row, str_replace( '.', '', $project['invoicesTotal'] ?? '' ) );
+ $this->sheet->setCellValue( 'H' . $this->row, str_replace( '.', '', $project['needInvoice'] ?? '' ) );
$this->row ++;
}
@@ -77,4 +77,4 @@ class InvoiceOverviewSheet {
$this->sheet->setCellValue( 'G' . $this->row, '=SUM(G2:G' . $lastRow . ')' );
$this->sheet->setCellValue( 'H' . $this->row, '=SUM(H2:H' . $lastRow . ')' );
}
-}
\ No newline at end of file
+}
diff --git a/application/libraries/reports/invoice/Excel/MonthForecastSheet.php b/application/libraries/reports/invoice/Excel/MonthForecastSheet.php
index 85cb34d..6b38844 100644
--- a/application/libraries/reports/invoice/Excel/MonthForecastSheet.php
+++ b/application/libraries/reports/invoice/Excel/MonthForecastSheet.php
@@ -67,7 +67,7 @@ class MonthForecastSheet {
{
$this->sheet->setCellValue( 'A' . $this->row, $project['projectname'] );
$this->sheet->setCellValue( 'B' . $this->row, $project['customer'] );
- $this->sheet->setCellValue( 'C' . $this->row, str_replace( '.', '', $project['needInvoice'] ) );
+ $this->sheet->setCellValue( 'C' . $this->row, str_replace( '.', '', $project['needInvoice'] ?? '' ) );
$columnCount = 0;
foreach ( $project['forecastMonths'] as $month )
@@ -78,8 +78,8 @@ class MonthForecastSheet {
$columnCount ++;
}
- $this->sheet->setCellValue( 'P' . $this->row, str_replace( '.', '', $project['forecastOtherYears'] ) );
- $this->sheet->setCellValue( 'Q' . $this->row, str_replace( '.', '', $project['forecastRemaining'] ) );
+ $this->sheet->setCellValue( 'P' . $this->row, str_replace( '.', '', $project['forecastOtherYears'] ?? '' ) );
+ $this->sheet->setCellValue( 'Q' . $this->row, str_replace( '.', '', $project['forecastRemaining'] ?? '' ) );
$this->row ++;
}
@@ -98,4 +98,4 @@ class MonthForecastSheet {
$this->sheet->setCellValue( 'Q' . $this->row, '=SUM(Q2:Q' . $lastRow . ')' );
}
-}
\ No newline at end of file
+}
diff --git a/application/libraries/reports/invoice/InvoiceOverview.php b/application/libraries/reports/invoice/InvoiceOverview.php
index 919ee45..f806a08 100644
--- a/application/libraries/reports/invoice/InvoiceOverview.php
+++ b/application/libraries/reports/invoice/InvoiceOverview.php
@@ -8,144 +8,144 @@
class InvoiceOverview {
- private $project;
- private $year;
- private $projectname;
- private $customer;
- private $totalToInvoicingExcl;
- private $totalToInvoicingIncl;
- private $totalInvoicedOtherYears;
- private $totalInvoicedThisYear;
- private $invoicesTotal;
- private $needInvoice;
- private $projectDetails;
- private $projectnumber;
- private $projectPayment;
- private $invoicesToPay;
+ private $project;
+ private $year;
+ private $projectname;
+ private $customer;
+ private $totalToInvoicingExcl;
+ private $totalToInvoicingIncl;
+ private $totalInvoicedOtherYears;
+ private $totalInvoicedThisYear;
+ private $invoicesTotal;
+ private $needInvoice;
+ private $projectDetails;
+ private $projectnumber;
+ private $projectPayment;
+ private $invoicesToPay;
- public function __construct( $project, $year )
- {
- $this->project = $project;
+ public function __construct( $project, $year )
+ {
+ $this->project = $project;
- $this->year = $year;
+ $this->year = $year;
- $this->handle();
- }
+ $this->handle();
+ }
- public function getProjectDetails()
- {
- return $this->projectDetails;
- }
+ public function getProjectDetails()
+ {
+ return $this->projectDetails;
+ }
- public function getNeedinvoice()
- {
- return $this->needInvoice;
- }
+ public function getNeedinvoice()
+ {
+ return $this->needInvoice;
+ }
- private function handle()
- {
- $this->setProjectnumber();
+ private function handle()
+ {
+ $this->setProjectnumber();
- $this->setProjectname();
+ $this->setProjectname();
- $this->setCustomer();
+ $this->setCustomer();
- $this->setTotalToInvoicingExcl();
+ $this->setTotalToInvoicingExcl();
- $this->setTotalToInvoicingIncl();
+ $this->setTotalToInvoicingIncl();
- $this->setTotalInvoicedOtherYears();
+ $this->setTotalInvoicedOtherYears();
- $this->setTotalInvoicedThisYear();
+ $this->setTotalInvoicedThisYear();
- $this->setPaymentPerProject();
+ $this->setPaymentPerProject();
- $this->setInvoicesTotal();
+ $this->setInvoicesTotal();
- $this->setInvoicesToPay();
+ $this->setInvoicesToPay();
- $this->setNeedInvoice();
+ $this->setNeedInvoice();
- $this->setProjectDetails();
- }
+ $this->setProjectDetails();
+ }
- private function setProjectnumber()
- {
- $this->projectnumber = $this->project->projectnumber;
- }
+ private function setProjectnumber()
+ {
+ $this->projectnumber = $this->project->projectnumber;
+ }
- private function setProjectname()
- {
- $this->projectname = $this->project->projectname;
- }
+ private function setProjectname()
+ {
+ $this->projectname = $this->project->projectname;
+ }
- private function setCustomer()
- {
- $this->customer = $this->project->customer->name;
- }
+ private function setCustomer()
+ {
+ $this->customer = $this->project->customer->name;
+ }
- private function setTotalToInvoicingExcl()
- {
- $offer = $this->project->offer;
+ private function setTotalToInvoicingExcl()
+ {
+ $offer = $this->project->offer;
- $this->totalToInvoicingExcl =
- $offer->own_revenue + $offer->other_revenue + $offer->costs;
- }
+ $this->totalToInvoicingExcl =
+ $offer->own_revenue + $offer->other_revenue + $offer->costs;
+ }
- private function setTotalToInvoicingIncl()
- {
- $this->totalToInvoicingIncl =
- $this->totalToInvoicingExcl * ( 1 + ( $this->project->vat->vatrate / 100 ) );
- }
+ private function setTotalToInvoicingIncl()
+ {
+ $this->totalToInvoicingIncl =
+ $this->totalToInvoicingExcl * ( 1 + ( $this->project->vat->vatrate / 100 ) );
+ }
- private function setTotalInvoicedOtherYears()
- {
- $this->totalInvoicedOtherYears =
- Invoice::invoicePerYear( $this->project->id, $this->year, FALSE );
- }
+ private function setTotalInvoicedOtherYears()
+ {
+ $this->totalInvoicedOtherYears =
+ Invoice::invoicePerYear( $this->project->id, $this->year, FALSE );
+ }
- private function setTotalInvoicedThisYear()
- {
- $this->totalInvoicedThisYear =
- Invoice::invoicePerYear( $this->project->id, $this->year, TRUE );
- }
+ private function setTotalInvoicedThisYear()
+ {
+ $this->totalInvoicedThisYear =
+ Invoice::invoicePerYear( $this->project->id, $this->year, TRUE );
+ }
- private function setPaymentPerProject()
- {
- $this->projectPayment = Payment::getPaymentPerProject( $this->project->id );
- }
+ private function setPaymentPerProject()
+ {
+ $this->projectPayment = Payment::getPaymentPerProject( $this->project->id );
+ }
- private function setInvoicesTotal()
- {
- $this->invoicesTotal =
- $this->totalInvoicedOtherYears + $this->totalInvoicedThisYear;
- }
+ private function setInvoicesTotal()
+ {
+ $this->invoicesTotal =
+ $this->totalInvoicedOtherYears + $this->totalInvoicedThisYear;
+ }
- private function setInvoicesToPay()
- {
- $this->invoicesToPay = $this->invoicesTotal - $this->projectPayment;
- }
+ private function setInvoicesToPay()
+ {
+ $this->invoicesToPay = $this->invoicesTotal - $this->projectPayment;
+ }
- private function setNeedInvoice()
- {
- $this->needInvoice =
- $this->totalToInvoicingIncl - $this->invoicesTotal;
- }
+ private function setNeedInvoice()
+ {
+ $this->needInvoice =
+ $this->totalToInvoicingIncl - $this->invoicesTotal;
+ }
- private function setProjectDetails()
- {
- $this->projectDetails = [
- 'projectnumber' => $this->projectnumber,
- 'projectname' => $this->projectname,
- 'customer' => $this->customer,
- 'totalToInvoicingExcl' => number_format( $this->totalToInvoicingExcl, 0, ',', '.' ),
- 'totalToInvoicingIncl' => number_format( $this->totalToInvoicingIncl, 0, ',', '.' ),
- 'totalInvoicedOtherYears' => number_format( $this->totalInvoicedOtherYears, 0, ',', '.' ),
- 'totalInvoicedThisYear' => number_format( $this->totalInvoicedThisYear, 0, ',', '.' ),
- 'invoicesTotal' => number_format( $this->invoicesTotal, 0, ',', '.' ),
- 'projectPayment' => number_format( $this->projectPayment, 0, ',', '.' ),
- 'invoiceToPay' => number_format( $this->invoicesToPay, 0, ',', '.' ),
- 'needInvoice' => number_format( $this->needInvoice, 0, ',', '.' )
- ];
- }
-}
\ No newline at end of file
+ private function setProjectDetails()
+ {
+ $this->projectDetails = [
+ 'projectnumber' => $this->projectnumber,
+ 'projectname' => $this->projectname,
+ 'customer' => $this->customer,
+ 'totalToInvoicingExcl' => number_format( $this->totalToInvoicingExcl ?? 0, 0, ',', '.' ),
+ 'totalToInvoicingIncl' => number_format( $this->totalToInvoicingIncl ?? 0, 0, ',', '.' ),
+ 'totalInvoicedOtherYears' => number_format( $this->totalInvoicedOtherYears ?? 0, 0, ',', '.' ),
+ 'totalInvoicedThisYear' => number_format( $this->totalInvoicedThisYear ?? 0, 0, ',', '.' ),
+ 'invoicesTotal' => number_format( $this->invoicesTotal ?? 0, 0, ',', '.' ),
+ 'projectPayment' => number_format( $this->projectPayment ?? 0, 0, ',', '.' ),
+ 'invoiceToPay' => number_format( $this->invoicesToPay ?? 0, 0, ',', '.' ),
+ 'needInvoice' => number_format( $this->needInvoice ?? 0, 0, ',', '.' )
+ ];
+ }
+}
diff --git a/application/libraries/reports/invoice/Invoices.php b/application/libraries/reports/invoice/Invoices.php
index a60d8a2..9740376 100644
--- a/application/libraries/reports/invoice/Invoices.php
+++ b/application/libraries/reports/invoice/Invoices.php
@@ -116,7 +116,7 @@ class Invoices {
$this->invoicedYears = Invoice::selectRaw( 'DATE_FORMAT(invoicedate, "%Y") AS years' )
->distinct()
->orderBy( 'invoicedate' )
- ->lists( 'years' );
+ ->pluck( 'years' );
}
private function setInvoiceReport()
diff --git a/application/models/eloquent/Payment.php b/application/models/eloquent/Payment.php
index 2da13a0..c5f7a96 100644
--- a/application/models/eloquent/Payment.php
+++ b/application/models/eloquent/Payment.php
@@ -73,7 +73,7 @@ class Payment extends BaseModel {
->distinct()
->join( 'invoices AS INV', 'INV.id', '=', 'payments.invoice_id' )
->whereRaw( 'DATE_FORMAT(paymentdate, "%Y") = "' . $year . '"' )
- ->lists( 'project_id' );
+ ->pluck( 'project_id' );
return $projects->toArray();
}
diff --git a/application/models/eloquent/Projectemployee.php b/application/models/eloquent/Projectemployee.php
index 15626df..0dfb76e 100644
--- a/application/models/eloquent/Projectemployee.php
+++ b/application/models/eloquent/Projectemployee.php
@@ -26,7 +26,7 @@ class Projectemployee extends BaseModel {
public static function getAvailableEmployees( $projectID )
{
$currentEmployees = Self::whereProjectId( $projectID )
- ->lists( 'user_id' );
+ ->pluck( 'user_id' );
$availableEmployees = User::selectRaw( "id, CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname" )
->whereNotIn( 'id', $currentEmployees )
diff --git a/composer.json b/composer.json
index b0a0b95..6831e11 100755
--- a/composer.json
+++ b/composer.json
@@ -11,11 +11,11 @@
"source": "https://github.com/bcit-ci/CodeIgniter"
},
"require": {
- "php": ">=5.3.7",
- "vlucas/phpdotenv": "^2.4",
- "illuminate/database": "5.1.16",
+ "php": ">=8.0",
+ "vlucas/phpdotenv": "^5.6",
+ "illuminate/database": "v10.48.26",
"symfony/var-dumper": "^3.4",
- "phpoffice/phpspreadsheet": "^1.3"
+ "phpoffice/phpspreadsheet": "^3.8"
},
"autoload": {
"classmap": [
@@ -30,5 +30,10 @@
"paragonie/random_compat": "Provides better randomness in PHP 5.x"
},
"require-dev": {
+ },
+ "config": {
+ "allow-plugins": {
+ "kylekatarnls/update-helper": true
+ }
}
}
diff --git a/public/index.php b/public/index.php
index 5f2003b..d420970 100755
--- a/public/index.php
+++ b/public/index.php
@@ -8,7 +8,7 @@
include_once('../vendor/autoload.php');
//$dotenv = new Dotenv\Dotenv(__DIR__);
-$dotenv = new Dotenv\Dotenv('../');
+$dotenv = $dotenv = Dotenv\Dotenv::createImmutable('../');
$dotenv->load();
$dotenv->required(['DB_HOST', 'DB_NAME', 'DB_USER', 'DB_PASS', 'ENVIRONMENT']);
@@ -78,7 +78,7 @@ $dotenv->required(['DB_HOST', 'DB_NAME', 'DB_USER', 'DB_PASS', 'ENVIRONMENT']);
* Different environments will require different levels of error reporting.
* By default development will show errors but testing and live will hide them.
*/
-switch (ENVIRONMENT)
+switch ($_ENV['ENVIRONMENT'])
{
case 'development':
error_reporting(-1);
diff --git a/system/.htaccess b/system/.htaccess
old mode 100755
new mode 100644
diff --git a/system/core/Benchmark.php b/system/core/Benchmark.php
old mode 100755
new mode 100644
index b3ac79c..20ac2f5
--- a/system/core/Benchmark.php
+++ b/system/core/Benchmark.php
@@ -6,7 +6,7 @@
*
* This content is released under the MIT License (MIT)
*
- * Copyright (c) 2014 - 2017, British Columbia Institute of Technology
+ * Copyright (c) 2019 - 2022, CodeIgniter Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -29,8 +29,9 @@
* @package CodeIgniter
* @author EllisLab Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
- * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/)
- * @license http://opensource.org/licenses/MIT MIT License
+ * @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
+ * @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
+ * @license https://opensource.org/licenses/MIT MIT License
* @link https://codeigniter.com
* @since Version 1.0.0
* @filesource
@@ -47,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Libraries
* @category Libraries
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/libraries/benchmark.html
+ * @link https://codeigniter.com/userguide3/libraries/benchmark.html
*/
class CI_Benchmark {
diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php
old mode 100755
new mode 100644
index 0d03293..56826dc
--- a/system/core/CodeIgniter.php
+++ b/system/core/CodeIgniter.php
@@ -6,7 +6,7 @@
*
* This content is released under the MIT License (MIT)
*
- * Copyright (c) 2014 - 2017, British Columbia Institute of Technology
+ * Copyright (c) 2019 - 2022, CodeIgniter Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -29,8 +29,9 @@
* @package CodeIgniter
* @author EllisLab Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
- * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/)
- * @license http://opensource.org/licenses/MIT MIT License
+ * @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
+ * @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
+ * @license https://opensource.org/licenses/MIT MIT License
* @link https://codeigniter.com
* @since Version 1.0.0
* @filesource
@@ -46,7 +47,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage CodeIgniter
* @category Front-controller
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/
+ * @link https://codeigniter.com/userguide3/
*/
/**
@@ -55,7 +56,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @var string
*
*/
- const CI_VERSION = '3.1.6';
+ const CI_VERSION = '3.1.13';
/*
* ------------------------------------------------------
@@ -434,7 +435,7 @@ if ( ! is_php('5.4'))
* ReflectionMethod::isConstructor() is the ONLY reliable check,
* knowing which method will be executed as a constructor.
*/
- elseif ( ! is_callable(array($class, $method)))
+ else
{
$reflection = new ReflectionMethod($class, $method);
if ( ! $reflection->isPublic() OR $reflection->isConstructor())
diff --git a/system/core/Common.php b/system/core/Common.php
old mode 100755
new mode 100644
index d6a1fdb..a56cb14
--- a/system/core/Common.php
+++ b/system/core/Common.php
@@ -6,7 +6,7 @@
*
* This content is released under the MIT License (MIT)
*
- * Copyright (c) 2014 - 2017, British Columbia Institute of Technology
+ * Copyright (c) 2019 - 2022, CodeIgniter Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -29,8 +29,9 @@
* @package CodeIgniter
* @author EllisLab Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
- * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/)
- * @license http://opensource.org/licenses/MIT MIT License
+ * @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
+ * @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
+ * @license https://opensource.org/licenses/MIT MIT License
* @link https://codeigniter.com
* @since Version 1.0.0
* @filesource
@@ -46,7 +47,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage CodeIgniter
* @category Common Functions
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/
+ * @link https://codeigniter.com/userguide3/
*/
// ------------------------------------------------------------------------
@@ -565,7 +566,7 @@ if ( ! function_exists('set_status_header'))
return;
}
- $server_protocol = (isset($_SERVER['SERVER_PROTOCOL']) && in_array($_SERVER['SERVER_PROTOCOL'], array('HTTP/1.0', 'HTTP/1.1', 'HTTP/2'), TRUE))
+ $server_protocol = (isset($_SERVER['SERVER_PROTOCOL']) && in_array($_SERVER['SERVER_PROTOCOL'], array('HTTP/1.0', 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0'), TRUE))
? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.1';
header($server_protocol.' '.$code.' '.$text, TRUE, $code);
}
@@ -778,11 +779,9 @@ if ( ! function_exists('_stringify_attributes'))
*/
function _stringify_attributes($attributes, $js = FALSE)
{
- $atts = NULL;
-
if (empty($attributes))
{
- return $atts;
+ return NULL;
}
if (is_string($attributes))
@@ -792,6 +791,7 @@ if ( ! function_exists('_stringify_attributes'))
$attributes = (array) $attributes;
+ $atts = '';
foreach ($attributes as $key => $val)
{
$atts .= ($js) ? $key.'='.$val.',' : ' '.$key.'="'.$val.'"';
diff --git a/system/core/Config.php b/system/core/Config.php
old mode 100755
new mode 100644
index cda6224..2454a9d
--- a/system/core/Config.php
+++ b/system/core/Config.php
@@ -6,7 +6,7 @@
*
* This content is released under the MIT License (MIT)
*
- * Copyright (c) 2014 - 2017, British Columbia Institute of Technology
+ * Copyright (c) 2019 - 2022, CodeIgniter Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -29,8 +29,9 @@
* @package CodeIgniter
* @author EllisLab Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
- * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/)
- * @license http://opensource.org/licenses/MIT MIT License
+ * @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
+ * @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
+ * @license https://opensource.org/licenses/MIT MIT License
* @link https://codeigniter.com
* @since Version 1.0.0
* @filesource
@@ -46,7 +47,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Libraries
* @category Libraries
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/libraries/config.html
+ * @link https://codeigniter.com/userguide3/libraries/config.html
*/
class CI_Config {
diff --git a/system/core/Controller.php b/system/core/Controller.php
old mode 100755
new mode 100644
index 59a9167..aeccd60
--- a/system/core/Controller.php
+++ b/system/core/Controller.php
@@ -6,7 +6,7 @@
*
* This content is released under the MIT License (MIT)
*
- * Copyright (c) 2014 - 2017, British Columbia Institute of Technology
+ * Copyright (c) 2019 - 2022, CodeIgniter Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -29,8 +29,9 @@
* @package CodeIgniter
* @author EllisLab Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
- * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/)
- * @license http://opensource.org/licenses/MIT MIT License
+ * @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
+ * @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
+ * @license https://opensource.org/licenses/MIT MIT License
* @link https://codeigniter.com
* @since Version 1.0.0
* @filesource
@@ -47,7 +48,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Libraries
* @category Libraries
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/general/controllers.html
+ * @link https://codeigniter.com/userguide3/general/controllers.html
*/
class CI_Controller {
@@ -58,6 +59,13 @@ class CI_Controller {
*/
private static $instance;
+ /**
+ * CI_Loader
+ *
+ * @var CI_Loader
+ */
+ public $load;
+
/**
* Class constructor
*
diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php
old mode 100755
new mode 100644
index 5269096..b1bc2de
--- a/system/core/Exceptions.php
+++ b/system/core/Exceptions.php
@@ -6,7 +6,7 @@
*
* This content is released under the MIT License (MIT)
*
- * Copyright (c) 2014 - 2017, British Columbia Institute of Technology
+ * Copyright (c) 2019 - 2022, CodeIgniter Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -29,8 +29,9 @@
* @package CodeIgniter
* @author EllisLab Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
- * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/)
- * @license http://opensource.org/licenses/MIT MIT License
+ * @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
+ * @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
+ * @license https://opensource.org/licenses/MIT MIT License
* @link https://codeigniter.com
* @since Version 1.0.0
* @filesource
@@ -44,7 +45,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Libraries
* @category Exceptions
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/libraries/exceptions.html
+ * @link https://codeigniter.com/userguide3/libraries/exceptions.html
*/
class CI_Exceptions {
diff --git a/system/core/Hooks.php b/system/core/Hooks.php
old mode 100755
new mode 100644
index f2d6f21..2246bbc
--- a/system/core/Hooks.php
+++ b/system/core/Hooks.php
@@ -6,7 +6,7 @@
*
* This content is released under the MIT License (MIT)
*
- * Copyright (c) 2014 - 2017, British Columbia Institute of Technology
+ * Copyright (c) 2019 - 2022, CodeIgniter Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -29,8 +29,9 @@
* @package CodeIgniter
* @author EllisLab Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
- * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/)
- * @license http://opensource.org/licenses/MIT MIT License
+ * @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
+ * @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
+ * @license https://opensource.org/licenses/MIT MIT License
* @link https://codeigniter.com
* @since Version 1.0.0
* @filesource
@@ -46,7 +47,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Libraries
* @category Libraries
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/general/hooks.html
+ * @link https://codeigniter.com/userguide3/general/hooks.html
*/
class CI_Hooks {
diff --git a/system/core/Input.php b/system/core/Input.php
old mode 100755
new mode 100644
index af4f87c..eba5f67
--- a/system/core/Input.php
+++ b/system/core/Input.php
@@ -6,7 +6,7 @@
*
* This content is released under the MIT License (MIT)
*
- * Copyright (c) 2014 - 2017, British Columbia Institute of Technology
+ * Copyright (c) 2019 - 2022, CodeIgniter Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -29,8 +29,9 @@
* @package CodeIgniter
* @author EllisLab Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
- * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/)
- * @license http://opensource.org/licenses/MIT MIT License
+ * @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
+ * @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
+ * @license https://opensource.org/licenses/MIT MIT License
* @link https://codeigniter.com
* @since Version 1.0.0
* @filesource
@@ -46,7 +47,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Libraries
* @category Input
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/libraries/input.html
+ * @link https://codeigniter.com/userguide3/libraries/input.html
*/
class CI_Input {
@@ -137,7 +138,7 @@ class CI_Input {
*/
public function __construct()
{
- $this->_allow_get_array = (config_item('allow_get_array') === TRUE);
+ $this->_allow_get_array = (config_item('allow_get_array') !== FALSE);
$this->_enable_xss = (config_item('global_xss_filtering') === TRUE);
$this->_enable_csrf = (config_item('csrf_protection') === TRUE);
$this->_standardize_newlines = (bool) config_item('standardize_newlines');
@@ -357,14 +358,15 @@ class CI_Input {
* @param string $prefix Cookie name prefix
* @param bool $secure Whether to only transfer cookies via SSL
* @param bool $httponly Whether to only makes the cookie accessible via HTTP (no javascript)
+ * @param string $samesite SameSite attribute
* @return void
*/
- public function set_cookie($name, $value = '', $expire = '', $domain = '', $path = '/', $prefix = '', $secure = NULL, $httponly = NULL)
+ public function set_cookie($name, $value = '', $expire = '', $domain = '', $path = '/', $prefix = '', $secure = NULL, $httponly = NULL, $samesite = NULL)
{
if (is_array($name))
{
// always leave 'name' in last place, as the loop will break otherwise, due to $$item
- foreach (array('value', 'expire', 'domain', 'path', 'prefix', 'secure', 'httponly', 'name') as $item)
+ foreach (array('value', 'expire', 'domain', 'path', 'prefix', 'secure', 'httponly', 'name', 'samesite') as $item)
{
if (isset($name[$item]))
{
@@ -405,7 +407,47 @@ class CI_Input {
$expire = ($expire > 0) ? time() + $expire : 0;
}
- setcookie($prefix.$name, $value, $expire, $path, $domain, $secure, $httponly);
+ isset($samesite) OR $samesite = config_item('cookie_samesite');
+ if (isset($samesite))
+ {
+ $samesite = ucfirst(strtolower($samesite));
+ in_array($samesite, array('Lax', 'Strict', 'None'), TRUE) OR $samesite = 'Lax';
+ }
+ else
+ {
+ $samesite = 'Lax';
+ }
+
+ if ($samesite === 'None' && ! $secure)
+ {
+ log_message('error', $name.' cookie sent with SameSite=None, but without Secure attribute.');
+ }
+
+ if ( ! is_php('7.3'))
+ {
+ $maxage = $expire - time();
+ if ($maxage < 1)
+ {
+ $maxage = 0;
+ }
+
+ $cookie_header = 'Set-Cookie: '.$prefix.$name.'='.rawurlencode($value);
+ $cookie_header .= ($expire === 0 ? '' : '; Expires='.gmdate('D, d-M-Y H:i:s T', $expire)).'; Max-Age='.$maxage;
+ $cookie_header .= '; Path='.$path.($domain !== '' ? '; Domain='.$domain : '');
+ $cookie_header .= ($secure ? '; Secure' : '').($httponly ? '; HttpOnly' : '').'; SameSite='.$samesite;
+ header($cookie_header);
+ return;
+ }
+
+ $setcookie_options = array(
+ 'expires' => $expire,
+ 'path' => $path,
+ 'domain' => $domain,
+ 'secure' => $secure,
+ 'httponly' => $httponly,
+ 'samesite' => $samesite,
+ );
+ setcookie($prefix.$name, $value, $setcookie_options);
}
// --------------------------------------------------------------------
@@ -565,7 +607,7 @@ class CI_Input {
$which = FILTER_FLAG_IPV6;
break;
default:
- $which = NULL;
+ $which = 0;
break;
}
diff --git a/system/core/Lang.php b/system/core/Lang.php
old mode 100755
new mode 100644
index 569b023..1829906
--- a/system/core/Lang.php
+++ b/system/core/Lang.php
@@ -6,7 +6,7 @@
*
* This content is released under the MIT License (MIT)
*
- * Copyright (c) 2014 - 2017, British Columbia Institute of Technology
+ * Copyright (c) 2019 - 2022, CodeIgniter Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -29,8 +29,9 @@
* @package CodeIgniter
* @author EllisLab Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
- * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/)
- * @license http://opensource.org/licenses/MIT MIT License
+ * @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
+ * @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
+ * @license https://opensource.org/licenses/MIT MIT License
* @link https://codeigniter.com
* @since Version 1.0.0
* @filesource
@@ -44,7 +45,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Libraries
* @category Language
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/libraries/language.html
+ * @link https://codeigniter.com/userguide3/libraries/language.html
*/
class CI_Lang {
diff --git a/system/core/Loader.php b/system/core/Loader.php
old mode 100755
new mode 100644
index 085c5b5..a70487e
--- a/system/core/Loader.php
+++ b/system/core/Loader.php
@@ -6,7 +6,7 @@
*
* This content is released under the MIT License (MIT)
*
- * Copyright (c) 2014 - 2017, British Columbia Institute of Technology
+ * Copyright (c) 2019 - 2022, CodeIgniter Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -29,8 +29,9 @@
* @package CodeIgniter
* @author EllisLab Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
- * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/)
- * @license http://opensource.org/licenses/MIT MIT License
+ * @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
+ * @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
+ * @license https://opensource.org/licenses/MIT MIT License
* @link https://codeigniter.com
* @since Version 1.0.0
* @filesource
@@ -46,7 +47,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Libraries
* @category Loader
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/libraries/loader.html
+ * @link https://codeigniter.com/userguide3/libraries/loader.html
*/
class CI_Loader {
@@ -226,7 +227,7 @@ class CI_Loader {
*
* Loads and instantiates models.
*
- * @param string $model Model name
+ * @param mixed $model Model name
* @param string $name An optional object name to assign to
* @param bool $db_conn An optional database connection configuration to initialize
* @return object
@@ -303,6 +304,8 @@ class CI_Loader {
{
throw new RuntimeException($app_path."Model.php exists, but doesn't declare class CI_Model");
}
+
+ log_message('info', 'CI_Model class loaded');
}
elseif ( ! class_exists('CI_Model', FALSE))
{
@@ -317,6 +320,8 @@ class CI_Loader {
{
throw new RuntimeException($app_path.$class.".php exists, but doesn't declare class ".$class);
}
+
+ log_message('info', config_item('subclass_prefix').'Model class loaded');
}
}
@@ -350,7 +355,9 @@ class CI_Loader {
}
$this->_ci_models[] = $name;
- $CI->$name = new $model();
+ $model = new $model();
+ $CI->$name = $model;
+ log_message('info', 'Model "'.get_class($model).'" initialized');
return $this;
}
diff --git a/system/core/Log.php b/system/core/Log.php
old mode 100755
new mode 100644
index d443aed..ca3e38a
--- a/system/core/Log.php
+++ b/system/core/Log.php
@@ -6,7 +6,7 @@
*
* This content is released under the MIT License (MIT)
*
- * Copyright (c) 2014 - 2017, British Columbia Institute of Technology
+ * Copyright (c) 2019 - 2022, CodeIgniter Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -29,8 +29,9 @@
* @package CodeIgniter
* @author EllisLab Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
- * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/)
- * @license http://opensource.org/licenses/MIT MIT License
+ * @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
+ * @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
+ * @license https://opensource.org/licenses/MIT MIT License
* @link https://codeigniter.com
* @since Version 1.0.0
* @filesource
@@ -44,7 +45,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Libraries
* @category Logging
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/general/errors.html
+ * @link https://codeigniter.com/userguide3/general/errors.html
*/
class CI_Log {
@@ -122,7 +123,7 @@ class CI_Log {
{
$config =& get_config();
- isset(self::$func_overload) OR self::$func_overload = (extension_loaded('mbstring') && ini_get('mbstring.func_overload'));
+ isset(self::$func_overload) OR self::$func_overload = ( ! is_php('8.0') && extension_loaded('mbstring') && @ini_get('mbstring.func_overload'));
$this->_log_path = ($config['log_path'] !== '') ? $config['log_path'] : APPPATH.'logs/';
$this->_file_ext = (isset($config['log_file_extension']) && $config['log_file_extension'] !== '')
@@ -247,11 +248,11 @@ class CI_Log {
* @param string $level The error level
* @param string $date Formatted date string
* @param string $message The log message
- * @return string Formatted log line with a new line character '\n' at the end
+ * @return string Formatted log line with a new line character at the end
*/
protected function _format_line($level, $date, $message)
{
- return $level.' - '.$date.' --> '.$message."\n";
+ return $level.' - '.$date.' --> '.$message.PHP_EOL;
}
// --------------------------------------------------------------------
diff --git a/system/core/Model.php b/system/core/Model.php
old mode 100755
new mode 100644
index c809e7b..b2bbbd4
--- a/system/core/Model.php
+++ b/system/core/Model.php
@@ -6,7 +6,7 @@
*
* This content is released under the MIT License (MIT)
*
- * Copyright (c) 2014 - 2017, British Columbia Institute of Technology
+ * Copyright (c) 2019 - 2022, CodeIgniter Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -29,8 +29,9 @@
* @package CodeIgniter
* @author EllisLab Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
- * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/)
- * @license http://opensource.org/licenses/MIT MIT License
+ * @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
+ * @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
+ * @license https://opensource.org/licenses/MIT MIT License
* @link https://codeigniter.com
* @since Version 1.0.0
* @filesource
@@ -44,21 +45,17 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Libraries
* @category Libraries
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/libraries/config.html
+ * @link https://codeigniter.com/userguide3/libraries/config.html
*/
class CI_Model {
/**
* Class constructor
*
+ * @link https://github.com/bcit-ci/CodeIgniter/issues/5332
* @return void
*/
- public function __construct()
- {
- log_message('info', 'Model Class Initialized');
- }
-
- // --------------------------------------------------------------------
+ public function __construct() {}
/**
* __get magic
diff --git a/system/core/Output.php b/system/core/Output.php
old mode 100755
new mode 100644
index a3155fe..a629a09
--- a/system/core/Output.php
+++ b/system/core/Output.php
@@ -6,7 +6,7 @@
*
* This content is released under the MIT License (MIT)
*
- * Copyright (c) 2014 - 2017, British Columbia Institute of Technology
+ * Copyright (c) 2019 - 2022, CodeIgniter Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -29,8 +29,9 @@
* @package CodeIgniter
* @author EllisLab Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
- * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/)
- * @license http://opensource.org/licenses/MIT MIT License
+ * @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
+ * @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
+ * @license https://opensource.org/licenses/MIT MIT License
* @link https://codeigniter.com
* @since Version 1.0.0
* @filesource
@@ -46,7 +47,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Libraries
* @category Output
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/libraries/output.html
+ * @link https://codeigniter.com/userguide3/libraries/output.html
*/
class CI_Output {
@@ -55,7 +56,7 @@ class CI_Output {
*
* @var string
*/
- public $final_output;
+ public $final_output = '';
/**
* Cache expiration time
@@ -145,7 +146,7 @@ class CI_Output {
&& extension_loaded('zlib')
);
- isset(self::$func_overload) OR self::$func_overload = (extension_loaded('mbstring') && ini_get('mbstring.func_overload'));
+ isset(self::$func_overload) OR self::$func_overload = ( ! is_php('8.0') && extension_loaded('mbstring') && @ini_get('mbstring.func_overload'));
// Get mime types for later
$this->mimes =& get_mimes();
@@ -299,10 +300,14 @@ class CI_Output {
*/
public function get_header($header)
{
- // Combine headers already sent with our batched headers
+ // We only need [x][0] from our multi-dimensional array
+ $header_lines = array_map(function ($headers)
+ {
+ return array_shift($headers);
+ }, $this->headers);
+
$headers = array_merge(
- // We only need [x][0] from our multi-dimensional array
- array_map('array_shift', $this->headers),
+ $header_lines,
headers_list()
);
diff --git a/system/core/Router.php b/system/core/Router.php
old mode 100755
new mode 100644
index 1abe4c4..ab1f44e
--- a/system/core/Router.php
+++ b/system/core/Router.php
@@ -6,7 +6,7 @@
*
* This content is released under the MIT License (MIT)
*
- * Copyright (c) 2014 - 2017, British Columbia Institute of Technology
+ * Copyright (c) 2019 - 2022, CodeIgniter Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -29,8 +29,9 @@
* @package CodeIgniter
* @author EllisLab Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
- * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/)
- * @license http://opensource.org/licenses/MIT MIT License
+ * @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
+ * @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
+ * @license https://opensource.org/licenses/MIT MIT License
* @link https://codeigniter.com
* @since Version 1.0.0
* @filesource
@@ -46,7 +47,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Libraries
* @category Libraries
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/general/routing.html
+ * @link https://codeigniter.com/userguide3/general/routing.html
*/
class CI_Router {
diff --git a/system/core/Security.php b/system/core/Security.php
old mode 100755
new mode 100644
index 082ffa9..e7772e0
--- a/system/core/Security.php
+++ b/system/core/Security.php
@@ -6,7 +6,7 @@
*
* This content is released under the MIT License (MIT)
*
- * Copyright (c) 2014 - 2017, British Columbia Institute of Technology
+ * Copyright (c) 2019 - 2022, CodeIgniter Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -29,8 +29,9 @@
* @package CodeIgniter
* @author EllisLab Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
- * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/)
- * @license http://opensource.org/licenses/MIT MIT License
+ * @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
+ * @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
+ * @license https://opensource.org/licenses/MIT MIT License
* @link https://codeigniter.com
* @since Version 1.0.0
* @filesource
@@ -44,7 +45,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Libraries
* @category Security
* @author EllisLab Dev Team
- * @link https://codeigniter.com/user_guide/libraries/security.html
+ * @link https://codeigniter.com/userguide3/libraries/security.html
*/
class CI_Security {
@@ -134,7 +135,9 @@ class CI_Security {
*/
protected $_never_allowed_str = array(
'document.cookie' => '[removed]',
+ '(document).cookie' => '[removed]',
'document.write' => '[removed]',
+ '(document).write' => '[removed]',
'.parentNode' => '[removed]',
'.innerHTML' => '[removed]',
'-moz-binding' => '[removed]',
@@ -152,7 +155,7 @@ class CI_Security {
*/
protected $_never_allowed_regex = array(
'javascript\s*:',
- '(document|(document\.)?window)\.(location|on\w*)',
+ '(\(?document\)?|\(?window\)?(\.document)?)\.(location|on\w*)',
'expression\s*(\(|&\#40;)', // CSS and IE
'vbscript\s*:', // IE, surprise!
'wscript\s*:', // IE
@@ -191,7 +194,7 @@ class CI_Security {
$this->_csrf_set_hash();
}
- $this->charset = strtoupper(config_item('charset'));
+ $this->charset = strtoupper((string) config_item('charset'));
log_message('info', 'Security Class Initialized');
}
@@ -226,6 +229,7 @@ class CI_Security {
// Check CSRF token validity, but don't error on mismatch just yet - we'll want to regenerate
$valid = isset($_POST[$this->_csrf_token_name], $_COOKIE[$this->_csrf_cookie_name])
+ && is_string($_POST[$this->_csrf_token_name]) && is_string($_COOKIE[$this->_csrf_cookie_name])
&& hash_equals($_POST[$this->_csrf_token_name], $_COOKIE[$this->_csrf_cookie_name]);
// We kill this since we're done and we don't want to pollute the _POST array
@@ -269,15 +273,35 @@ class CI_Security {
return FALSE;
}
- setcookie(
- $this->_csrf_cookie_name,
- $this->_csrf_hash,
- $expire,
- config_item('cookie_path'),
- config_item('cookie_domain'),
- $secure_cookie,
- config_item('cookie_httponly')
- );
+ if (is_php('7.3'))
+ {
+ setcookie(
+ $this->_csrf_cookie_name,
+ $this->_csrf_hash,
+ array(
+ 'expires' => $expire,
+ 'path' => config_item('cookie_path'),
+ 'domain' => config_item('cookie_domain'),
+ 'secure' => $secure_cookie,
+ 'httponly' => config_item('cookie_httponly'),
+ 'samesite' => 'Strict'
+ )
+ );
+ }
+ else
+ {
+ $domain = trim(config_item('cookie_domain'));
+ header('Set-Cookie: '.$this->_csrf_cookie_name.'='.$this->_csrf_hash
+ .'; Expires='.gmdate('D, d-M-Y H:i:s T', $expire)
+ .'; Max-Age='.$this->_csrf_expire
+ .'; Path='.rawurlencode(config_item('cookie_path'))
+ .($domain === '' ? '' : '; Domain='.$domain)
+ .($secure_cookie ? '; Secure' : '')
+ .(config_item('cookie_httponly') ? '; HttpOnly' : '')
+ .'; SameSite=Strict'
+ );
+ }
+
log_message('info', 'CSRF cookie sent');
return $this;
@@ -542,6 +566,14 @@ class CI_Security {
$str
);
+ // Same thing, but for "tag functions" (e.g. eval`some code`)
+ // See https://github.com/bcit-ci/CodeIgniter/issues/5420
+ $str = preg_replace(
+ '#(alert|prompt|confirm|cmd|passthru|eval|exec|expression|system|fopen|fsockopen|file|file_get_contents|readfile|unlink)(\s*)`(.*?)`#si',
+ '\\1\\2`\\3`',
+ $str
+ );
+
// Final clean up
// This adds a bit of extra precaution in case
// something got through the above filters
@@ -624,7 +656,6 @@ class CI_Security {
return $output;
}
-
if (is_readable('/dev/urandom') && ($fp = fopen('/dev/urandom', 'rb')) !== FALSE)
{
// Try not to waste entropy ...
@@ -853,7 +884,7 @@ class CI_Security {
// For other tags, see if their attributes are "evil" and strip those
elseif (isset($matches['attributes']))
{
- // We'll store the already fitlered attributes here
+ // We'll store the already filtered attributes here
$attributes = array();
// Attribute-catching pattern
@@ -927,7 +958,7 @@ class CI_Security {
return str_replace(
$match[1],
preg_replace(
- '#href=.*?(?:(?:alert|prompt|confirm)(?:\(|&\#40;)|javascript:|livescript:|mocha:|charset=|window\.|document\.|\.cookie|