Quantcast
Channel: CodeIgniter Forums - All Forums
Viewing all 14343 articles
Browse latest View live

Public folder and assets for each module

$
0
0
Hey guys. Have the next problem.
I have several projects on my CMF based on CI4, I want to reconfigure it so that the root is in public as specified in the documentation.
But the problem is that my CMF consists of modules (./modules), in which each module has its own assets folder (./modules/Test/Assets/jquery.min.js).
I tried to switch the loading of these files through the php controller, but even on a local server there is a big delay. In Assets are: stylesheet, javascript, images.
So when i switching to ./public as root folder, i can't access my modules assets..

CodeIgniter 3.13 Output class

$
0
0
I have an issue where CodeIgniter's Output class that serves the cached files always (even if the user isnt logged in), we are caching an output data on a certain amount of time (1h to 2h) on the end of the controller method we call $this->output->set_output($data). User can access the data by typing the URL of the controller method in the address bar and Output class returns the data. Output class first checks if there is a cached file for typed in method and then serves it if it exists (this happens before CI even boots up) and if it doesn't exist it triggers the controller and then does all the unnecessary checks (check for authentication, authorization etc), I have tried overriding the _display_cache method but you can't access controller nor session there since, as I already said, CI hasn't booted yet. Anyone knows how can I solve this problem, to forbid users from displaying the data when typing full url of the controller method.

Thanks in advance,
All the best!

Flashdata is cached and repeat with refresh

$
0
0
Hi, I am using ci4 and made a project on it, now i have added cache filter to it and cache is working fine, but the issue is i have some forms in various places of project, where user can send query, but the issue is the flashdata which is showing after submitting the form is displaying with refresh means 1st time showing, which is good but when you refresh the page its showing again and is being cached, if i remove cache filter then its working fine, I tried many solutions but still no luck, added cache clear in before method, but its not working, its same, check the code,

    
PHP Code:
public function before(RequestInterface $request$arguments null)
{
    $cache Services::cache();
    $response service('response');
    $uri $request->uri->getPath();
    $cacheKey $this->sanitizeCacheKey($uri);
    // ✅ If Flashdata exists, clear cache for this page & disable caching
    if (session()->getFlashdata('success') || session()->getFlashdata('error')) {
        $cache->delete($cacheKey); // Clear cache for this page
        log_message('info'"? Cache Cleared due to Flashdata for: " $cacheKey);
        $response->setHeader('Cache-Control''no-store, no-cache, must-revalidate, max-age=0');
        $response->setHeader('Pragma''no-cache');
        return;
    }
    // ✅ Proceed with cache check
    $cachedResponse $cache->get($cacheKey);
    if ($cachedResponse instanceof ResponseInterface) {
        log_message('info'"? Cache HIT: " $cacheKey);
        return $cachedResponse;
    }
    log_message('info'"❌ Cache MISS: " $cacheKey);

Bonfire 2 Shield Config Files are incorrect

$
0
0
To test Bonfire 2 which has installation guide here: https://lonnieezell.github.io/Bonfire2/i...tallation/
I followed every step proposed by the document. First I created a CI4 AppStarter project. Then configured the .json file. Finally installed bonfire with composer. However I realized that bonfire installation modifies the Shield configuration files in Config wrongly. Therefore "php spark bf:install --continue" gives below error:
Code:
CodeIgniter v4.6.0 Command Line Tool - Server Time: 2025-02-25 08:32:54 UTC+00:00

Running all new migrations...
[Error]
Class "Config\BonfireAuth" not found
at APPPATH\Config\Auth.php:19

Backtrace:
  1    VENDORPATH\composer\ClassLoader.php:576
      include()

  2    VENDORPATH\composer\ClassLoader.php:427
      Composer\Autoload\{closure}('C:\\..\\Desktop\\Github\\bf2test\\vendor\\composer/../../app/Config\\Auth.php')

  3    [internal function]
      Composer\Autoload\ClassLoader()->loadClass('Config\\Auth')

  4    SYSTEMPATH\Config\Factories.php:290
      class_exists('Config\\Auth')

  5    SYSTEMPATH\Config\Factories.php:216
      CodeIgniter\Config\Factories::locateClass([...], 'Auth')

  6    SYSTEMPATH\Config\Factories.php:159
      CodeIgniter\Config\Factories::getDefinedInstance([...], 'Auth', [])

  7    SYSTEMPATH\Config\Factories.php:188
      CodeIgniter\Config\Factories::__callStatic('config', [])

  8    SYSTEMPATH\Common.php:210
      CodeIgniter\Config\Factories::get('config', 'Auth')

  9    VENDORPATH\codeigniter4\shield\src\Database\Migrations\2020-12-28-223112_create_auth_tables.php:32
      config('Auth')

10    SYSTEMPATH\Database\MigrationRunner.php:837
      CodeIgniter\Shield\Database\Migrations\CreateAuthTables()->__construct(Object(CodeIgniter\Database\MySQLi\Forge))

11    SYSTEMPATH\Database\MigrationRunner.php:182
      CodeIgniter\Database\MigrationRunner()->migrate('up', Object(stdClass))

12    SYSTEMPATH\Commands\Database\Migrate.php:85
      CodeIgniter\Database\MigrationRunner()->latest(null)

13    SYSTEMPATH\CLI\Commands.php:70
      CodeIgniter\Commands\Database\Migrate()->run([...])

14    SYSTEMPATH\Common.php:190
      CodeIgniter\CLI\Commands()->run('migrate', [...])

15    VENDORPATH\lonnieezell\bonfire\src\Commands\Install.php:272
      command('migrate')

16    VENDORPATH\lonnieezell\bonfire\src\Commands\Install.php:132
      Bonfire\Commands\Install()->migrate()

17    SYSTEMPATH\CLI\Commands.php:70
      Bonfire\Commands\Install()->run([...])

18    SYSTEMPATH\CLI\Console.php:48
      CodeIgniter\CLI\Commands()->run('bf:install', [...])

19    SYSTEMPATH\Boot.php:360
      CodeIgniter\CLI\Console()->run()

20    SYSTEMPATH\Boot.php:104
      CodeIgniter\Boot::runCommand(Object(CodeIgniter\CLI\Console))

21    ROOTPATH\spark:84
      CodeIgniter\Boot::bootSpark(Object(Config\Paths))

Finally I realized this issue:
Auth, AuthGroups and AuthToken Config classes are defined this way:

PHP Code:
use CodeIgniter\Shield\Config\AuthGroups as ShieldAuthGroups;
class 
AuthGroups extends BonfireAuthGroups
-----
use 
CodeIgniter\Shield\Config\Auth as ShieldAuth;
class 
Auth extends BonfireAuth
-----
use 
CodeIgniter\Shield\Config\AuthToken as ShieldAuthToken;
/**
 * Configuration for Token Auth and HMAC Auth
 */
class AuthToken extends BonfireAuthToken 

Those classes must extend "Shield" I guess. Because there is no BonfireAuth related class. I dont know why I face this issue. Maybe it is because of first initialization of bonfire with "
Code:
php spark bf:install". Any help will be appreciated. Thanks.

p.s. Should I create an issue in bonfire github repo instead of posting here? Please inform.

PAypal implementation, error with json response on develompment

$
0
0
Hi , starting by this code:
https://www.codexworld.com/paypal-standa...on-in-php/
 i try to implement paypal payment on ci4 ,
this is my form :
Code:
<?= $this->extend('vetrina/templates/layout_home') ?>
<?= $this->section('custom_css') ?>

<style type="text/css">

.header-style1{

    background-color: black;
}

.video-overlay, .video-placeholder{

    z-index: -1;
}

.input-group:not(.has-validation) > :not(:last-child):not(.dropdown-toggle):not(.dropdown-menu) {
    -webkit-border-top-left-radius: 1.2rem;
-webkit-border-bottom-left-radius: 1.2rem;
-moz-border-radius-topleft: 1.2rem;
-moz-border-radius-bottomleft: 1.2rem;
border-top-left-radius: 1.2rem;
border-bottom-left-radius: 1.2rem;
}


#buttons-container{

    text-align: center !important;
}

</style>

<?= $this->endSection() ?>

<?= $this->section('content') ?>

<div class="container mt-5 ">
   
    <div class="row mt-5">
          <div class="col-md-12 text-center">



                <div class="card mt-5 mb-5">
                    <div class="overlay hidden"><div class="overlay-content"><i class="fa-solid fa-spinner"></i></div></div>

                    <div class="card-header">
                        <h3 class="panel-title"><?=lang('Clienti_ricerca_tratte.paga') ?> <?=$totale_da_pagare; ?> <?=lang('Clienti_ricerca_tratte.con_paypal') ?></h3>
                       
                        <!-- Product Info -->
                        <p><b><?=lang('Clienti_ricerca_tratte.tratta') ?> <?= $tratta_acquistata_andata->punto_partenza; ?> -> <?= $tratta_acquistata_andata->punto_arrivo; ?> </p>
                        <p><b><?=lang('Clienti_ricerca_tratte.prezzo') ?>:</b> <?php echo 'EUR '.$totale_da_pagare ?></p>
                    </div>

                    <div class="card-body text-center">
                        <!-- Display status message -->
                        <div id="paymentResponse" class="hidden"></div>
                       
                        <!-- Set up a container element for the button -->                                       
                        <center><div id="paypal-button-container" ></div></center>         
                                   
                    </div>
                </div>


           
          </div>
         
    </div>
       


</div>









<?= $this->endSection() ?>

<?= $this->section('script') ?>
<script src="https://www.paypal.com/sdk/js?client-id=<?=$paypal_client_id ?>&currency=EUR"></script>

<script>
paypal.Buttons({
    // Sets up the transaction when a payment button is clicked
    createOrder: (data, actions) => {

        console.log('create_order');

        return actions.order.create({
            "purchase_units": [{
                "custom_id": "<?=$tratta_acquistata_andata->id; ?>",
                //"description": "<?php  ?>",
                "amount": {
                    "currency_code": "EUR",
                    "value": "<?= $totale_da_pagare; ?>",
                    "breakdown": {
                        "item_total": {
                            "currency_code": "EUR",
                            "value": "<?= $totale_da_pagare; ?>"
                        }
                    }
                },
               
               
                "items": [
                    {
                        "name": "<?= $tratta_acquistata_andata->id; ?>",
                        "description": "<?= $tratta_acquistata_andata->punto_partenza.'->'.$tratta_acquistata_andata->punto_arrivo ?>",
                        "unit_amount": {
                            "currency_code": "EUR",
                            "value": "<?=$totale_da_pagare; ?>"
                        },
                        "quantity": "1",
                        "category": "DIGITAL_GOODS"
                    },
                ]
               
            }]
        });
    },
    // Finalize the transaction after payer approval
    onApprove: (data, actions) => {

        console.log('onApprove');


        return actions.order.capture().then(function(orderData) {
            setProcessing(true);

            console.log('orderData'+JSON.stringify(orderData));

            var postData = {paypal_order_check: 1, order_id: orderData.id};
            fetch(' <?=base_url('paypal/check_validate') ?>', {
                method: 'POST',
                headers: {'Accept': 'application/json'},
                body: encodeFormData(postData)
            })
            .then( 
                    response =>{return  response.json() }
                    //console.log('response'+ JSON.stringify(response)),

            )
            .then((result) => {

                console.log('result:'+ JSON.stringify(result) );
               
                if(result.status == 1){

                    console.log('resultStatus-if');

                    window.location.href = "<?=base_url('paypal/success_pagamento_tratta/') ?>"+result.ref_id;
               
                }else{
                   
                    console.log('resultStatus-else');


                    const messageContainer = document.querySelector("#paymentResponse");
                    messageContainer.classList.remove("hidden");
                    messageContainer.textContent = result.msg;
                   
                    setTimeout(function () {
                        messageContainer.classList.add("hidden");
                        messageText.textContent = "";
                    }, 5000);
                }
               
                setProcessing(false);
            })
            .catch(error => console.log(error));
        });
       


    }
}).render('#paypal-button-container');

const encodeFormData = (data) => {

    console.log('encodeFormData');

    var form_data = new FormData();

    for ( var key in data ) {
        form_data.append(key, data[key]);
    }
   
    return form_data; 
}

// Show a loader on payment form processing
const setProcessing = (isProcessing) => {

    console.log('setProcessing');


    if (isProcessing) {
        document.querySelector(".overlay").classList.remove("hidden");
    } else {
        document.querySelector(".overlay").classList.add("hidden");
    }
}   
</script>

<?= $this->endSection() ?>
This is my method check_validate:
Code:
public function check_validate()
    {

        //log_message('debug','inside check_validate');

        $pagamenti_paypal_model = new Pagamenti_paypalModel();
        $tratte_acquistate_model = new Tratte_acquistateModel();

        $paypal = new PaypalCheckout;


       
        $response = array('status' => 0, 'msg' => 'Transaction Failed!');

        if(!empty($_POST['paypal_order_check']) && !empty($_POST['order_id'])){
            // Validate and get order details with PayPal API
            try { 
                $order = $paypal->validate($_POST['order_id']);
            } catch(Exception $e) { 
                $api_error = $e->getMessage(); 
            }

            //log_message('debug','Order:'.print_r($order,true));
           
            if(!empty($order)){
                $order_id = $order['id'];
                $intent = $order['intent'];
                $order_status = $order['status'];
                $order_time = date("Y-m-d H:i:s", strtotime($order['create_time']));
       
                if(!empty($order['purchase_units'][0])){



                    $purchase_unit = $order['purchase_units'][0];
       
                    $id_tratta_acquistata = $purchase_unit['custom_id'];

                    $item = $purchase_unit['items'][0];

                    //log_message('debug','items'.json_encode($item));

                    $category = $item['category'];

                    $item_name = $item['description'];
                   

                    if(!empty($purchase_unit['amount'])){
                        $currency_code = $purchase_unit['amount']['currency_code'];
                        $amount_value = $purchase_unit['amount']['value'];
                    }
       
                    if(!empty($purchase_unit['payments']['captures'][0])){
                        $payment_capture = $purchase_unit['payments']['captures'][0];
                        $transaction_id = $payment_capture['id'];
                        $payment_status = $payment_capture['status'];

                        $seller_receivable_breakdown = $payment_capture['seller_receivable_breakdown'];


                        //log_message('debug','seller_receivable_breakdown'.print_r($seller_receivable_breakdown,true));

                        $paid_fee = $seller_receivable_breakdown['paypal_fee']['value'];

                        log_message('debug','seller_receivable_breakdown'.print_r($seller_receivable_breakdown['paypal_fee'],true));


                    }


                    /*
                    if(!empty($purchase_unit['payee'])){
                        $payee = $purchase_unit['payee'];
                        $payee_email_address = $payee['email_address'];
                    }
                    */
                }
       
                $payment_source = '';

                if(!empty($order['payment_source'])){
                    foreach($order['payment_source'] as $key=>$value){
                        $payment_source = $key;
                    }
                }
       
                if(!empty($order['payer'])){
                    $payer = $order['payer'];
                    $payer_id = $payer['payer_id'];
                    $payer_name = $payer['name'];
                    $payer_given_name = !empty($payer_name['given_name'])?$payer_name['given_name']:'';
                    $payer_surname = !empty($payer_name['surname'])?$payer_name['surname']:'';
                    $payer_full_name = trim($payer_given_name.' '.$payer_surname);
                    $payer_full_name = htmlspecialchars($payer_full_name);

                    //log_message('debug','payer_full_name:'.$payer_full_name);
       
                    $payer_email_address = $payer['email_address'];
                    $payer_address = $payer['address'];
                    $payer_country_code = !empty($payer_address['country_code'])?$payer_address['country_code']:'';
                }
       
                if(!empty($order_id) && $order_status == 'COMPLETED'){


                    $db = \Config\Database::connect();
                   
                    $db->transStart();
                       
                   


                    // Check if any transaction data is exists already with the same TXN ID
                    $pagamenti_paypal_model->where('transaction_id',$transaction_id)
                                            ->first();

                    log_message('debug','pagamenti_paypal_model:'.$pagamenti_paypal_model->getLastQuery());

                    if(!empty($row_id)){
                   
                        $payment_id = $row_id;
                   
                    }else{
                       
                        // Insert transaction data into the database
                        $data_to_insert_pagamenti = [

                            'id_tratte_acquistate' => $id_tratta_acquistata,
                            'payer_id' => $payer_id,
                            'payer_name' => $payer_full_name,
                            'payer_email' => $payer_email_address,
                            'payer_country' => $payer_country_code,
                            'order_id' => $order_id,
                            'transaction_id' => $transaction_id,
                            'paid_amount' => $amount_value,
                            'paid_fee' => $paid_fee,
                            'paid_amount_currency' => $currency_code,
                            'payment_source' => $payment_source,
                            'payment_status' => $payment_status,

                        ];

                        log_message('debug','data_to_insert_pagamenti'.json_encode($data_to_insert_pagamenti));


                        $pagamenti_paypal_model->insert($data_to_insert_pagamenti);


                        if($pagamenti_paypal_model->getInsertID()){

                            $data_to_update_tratta_acquistata=[

                                'deleted_at' =>NULL

                            ];

                            $tratte_acquistate_model->update($id_tratta_acquistata,$data_to_update_tratta_acquistata);

                        }
                    }
       
                    $db->transComplete();



                    if($db->transStatus()!==false) {

                        $ref_id_enc = base64_encode($transaction_id);
                        $response = array('status' => 1, 'msg' => 'Transaction completed!', 'ref_id' => $ref_id_enc);
                   
                    }



                }


            }else{

                $response['msg'] = $api_error;
            }
        }
       
        // Make sure file is not cached (as it happens for example on iOS devices)
        header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
        header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
        header("Cache-Control: no-store, no-cache, must-revalidate");
        header("Cache-Control: post-check=0, pre-check=0", false);
        header("Pragma: no-cache");

        log_message('debug','response:'.json_encode($response));
        echo json_encode($response);
   
    }
   
I spend several hours tofind the error and the error was debug bar on     CI_ENVIRONMENT = development
Why?


ANother question how can i resend transaction encoded on url ? because base64_encode($transaction_id);  return equal at and of string ...

Shield Login possible on active = 0

$
0
0
Hey guys,
as the title says, its possible to login with Shield although active flag is set to 0 in users table.
I can activate/deactivate user with the corresponding functions ($user->activate() / $user->activate() ), the status in the database gets updated correctly but the function $user->isActivated() always returns true.
My version is 4.6.0
There are several existig threads about this bug, but none of them addresses the problem.
Thanks!

connecting db2 database

$
0
0
Please help me connect CI4 to a db2 database.
I need to be able to read data from this database.

Add initController section in spark make:controller

$
0
0
Hello, in my personal opinion
It would be logical for
Code:
php spark make:controller

to include the

Code:
initController()

skeleton as part of its default template, similar to how it handles models with make:model . 

The parallel with

Code:
make:model

is fitting: when you generate a model with PHP Spark, it comes populated with various default settings that you can adapt or remove based on your needs. Applying the same approach to controllers would make sense.
Considering that:
  • Most controllers end up needing at least one model
  • The implementation of initController() follows a fairly standard pattern
  • It's easier to remove unnecessary code than to remember to add important code
This would help developers adopt the best practices suggested by the framework.

Regards
R.

SELECT FROM DATABASE CI 3

$
0
0
hello everyone, I am using CI 3 and want to do multiple insert forms, this form contains select input from the database, after we select it will display the stock of the item we selected, when we press the (+) blue button to add a row using javascript, we must fill the select input with the same item data from the previous select input, now what I want to ask, is it possible that the select data that has been used will not be in the display of other select options.

if you see from the example, row 1 I select apple, and in row 2 I don't want the apple item to be option selected in row 2.

[Image: select.jpg]

Here my view code : 
PHP Code:
<button type="button" class="btn btn-info tambah-form" disabled><class="fa fa-plus"></i></button>
                                            <button type="button" class="btn btn-warning del-elements" disabled><class="fa fa-minus"></i></button>
                                            <div class="row" style="margin-top:20px;">
                                                <div class="col-8">
                                                    <div class="form-group">
                                                        <div class="controls">
                                                            <label>Nama Resep</label>
                                                            <select class="form-control select2 product" name="id_liquid1" id="id_liquid1" onchange="cari(1)" required>
                                                                <option>-- Nama Resep --</option>
                                                                <?php
                                                                
foreach ($resep as $value) {
                                                                    echo "<option value='$value->id_liquid'>$value->nama_resep ($value->ukuran mL)</option>";
                                                                }
                                                                ?>
                                                            </select>
                                                        </div>
                                                    </div>
                                                </div> 

My function javascript :
PHP Code:
$(".tambah-form").on('click', function(){
                
                
var jumlahkolom = $('#jumlahkolom').val();
                if(jumlahkolom == 5){
                    $(".tambah-form").attr('disabled','disabled');
                }
                
                row 
'<div class="rec-element'+i+'">'+
                        '<div class="row">'+
                            '<div class="col-8">'+
                                '<div class="form-group">'+
                                    '<div class="controls">'+
                                        '<label>Nama Resep</label>'+
                                        '<select class="form-control select2 product" name="id_liquid'+i+'" id="id_liquid'+i+'" onchange="cari('+i+')"  required>'+
                                            '<option>-- Nama Resep --</option>'+
                                            <?php foreach ($resep as $value) { ?>
                                                '<option value="<?php echo $value->id_liquid;?>"><?php echo $value->nama_resep." (".$value->ukuran." mL)";?></option>;'+
                                            <?php ?>
                                        '</select>'+
                                    '</div>'+
                                '</div>'+
                            '</div>'+ 

Understanding the Basics of GitHub: An Introduction for Beginners

CI4.6 Error Pages

$
0
0
Since upgrading to CI4.6 I have noticed that the error pages thrown in Development aren't formatted like they were previously. Prior to 4.6 they were neatly organized and should the full error messages. Now I am getting a brown bar at the top with version info (which is very helpful) and then a bunch of truncated lines of the error messages in a large font. Then at the bottom is one window with some code related to the part of CI that has the error (not the code I wrote, but the CI Code). What happened to the old, helpful error pages? Did I do something wrong in the install? Can they be restored?[Image: screenshot-2025-02-26-at-1-20-07%E2%80%AFpm.png]

After some more digging, I found a tab at the very bottom called "response" and this was in it. Seems related, but no idea how to fix:

Code:
Fatal error: Uncaught Error: Class "Services" not found in /Users/marcpinnell/Sites/cattle/app/Views/errors/html/error_exception.php:228 Stack trace: #0 /Users/marcpinnell/Sites/cattle/vendor/codeigniter4/framework/system/Debug/BaseExceptionHandler.php(266): include() #1 /Users/marcpinnell/Sites/cattle/vendor/codeigniter4/framework/system/Debug/BaseExceptionHandler.php(269): CodeIgniter\Debug\BaseExceptionHandler->CodeIgniter\Debug\{closure}() #2 /Users/marcpinnell/Sites/cattle/vendor/codeigniter4/framework/system/Debug/ExceptionHandler.php(116): CodeIgniter\Debug\BaseExceptionHandler->render(Object(ErrorException), 500, '/Users/marcpinn...') #3 /Users/marcpinnell/Sites/cattle/vendor/codeigniter4/framework/system/Debug/Exceptions.php(162): CodeIgniter\Debug\ExceptionHandler->handle(Object(ErrorException), Object(CodeIgniter\HTTP\IncomingRequest), Object(CodeIgniter\HTTP\Response), 500, 1) #4 /Users/marcpinnell/Sites/cattle/vendor/codeigniter4/framework/system/Debug/Exceptions.php(317): CodeIgniter\Debug\Exceptions->exceptionHandler(Object(ErrorException)) #5 [internal function]: CodeIgniter\Debug\Exceptions->shutdownHandler() #6 {main} thrown in /Users/marcpinnell/Sites/cattle/app/Views/errors/html/error_exception.php on line 228

datbaase migration

$
0
0
Does CI not have the concept of make migrations / migrate for syncing database models to the database tables ?

Help shield prevent bot registration

$
0
0
Hello,

I am geting many fake registrations using shield, How can I prevent shield from creating a registration record if it is a bot?

Thanks

fork tattersoftware/codeigniter4-relations

$
0
0
Hi guys, I want to do some changes to tattersoftware/codeigniter4-relations ... it is good / secure practice to create fork on github and use it as dependency in my app?

How to fix codeigniter 4.6 run xampp with php 8.4.4

$
0
0
today i test codeigniter 4.6 on xampp with php 8.4.4 , it show error below:
Code:
Fatal error: Uncaught Error: Call to undefined function CodeIgniter\Autoloader\mb_strpos() in E:\HELPER\SERVER\XAPP8212\htdocs\upload\landsoft\vendor\codeigniter4\framework\system\Autoloader\FileLocator.php:292 Stack trace: #0 E:\HELPER\SERVER\XAPP8212\htdocs\upload\landsoft\vendor\codeigniter4\framework\system\Config\BaseService.php(417): CodeIgniter\Autoloader\FileLocator->findQualifiedNameFromPath() #1 E:\HELPER\SERVER\XAPP8212\htdocs\upload\landsoft\vendor\codeigniter4\framework\system\Config\BaseService.php(330): CodeIgniter\Config\BaseService::buildServicesCache() #2 E:\HELPER\SERVER\XAPP8212\htdocs\upload\landsoft\vendor\codeigniter4\framework\system\Config\BaseService.php(315): CodeIgniter\Config\BaseService::serviceExists() #3 E:\HELPER\SERVER\XAPP8212\htdocs\upload\landsoft\vendor\codeigniter4\framework\system\Config\BaseService.php(202): CodeIgniter\Config\BaseService::__callStatic() #4 E:\HELPER\SERVER\XAPP8212\htdocs\upload\landsoft\vendor\codeigniter4\framework\system\Common.php(1000): CodeIgniter\Config\BaseService::get() #5 E:\HELPER\SERVER\XAPP8212\htdocs\upload\landsoft\vendor\codeigniter4\framework\system\Boot.php(263): service() #6 E:\HELPER\SERVER\XAPP8212\htdocs\upload\landsoft\vendor\codeigniter4\framework\system\Boot.php(55): CodeIgniter\Boot::setExceptionHandler() #7 E:\HELPER\SERVER\XAPP8212\htdocs\upload\landsoft\index.php(56): CodeIgniter\Boot::bootWeb() #8 {main} thrown in E:\HELPER\SERVER\XAPP8212\htdocs\upload\landsoft\vendor\codeigniter4\framework\system\Autoloader\FileLocator.php on line 292
can someone show me fix?
thank your for your helping

Should CodeIgniter Shield include customizable view Tags for user access?

$
0
0
Hey everyone!

I’m considering adding a new feature to CodeIgniter Shield that allows customizable view tags for user access and status checks. Before proceeding, I’d love to hear your thoughts!

If you have a moment, please participate in the poll to help determine whether this feature would be useful. Your feedback is greatly appreciated!

Poll link.

Thanks in advance!?

integrating parcel.js

$
0
0
Hi,
I'm a complete newbie to CI and looking forward to using it in my first project. Just wondered if there is any support for using it with Parcel.js bundler or maybe webpack though I'd prefer parcel.

feat: Separate unused lists in classes

$
0
0
Hi. Don't you think that some of the infrequently used data in classes can be optimized?
For example, in the Entity, DataCaster:
Code:
private defaultCastHandlers -> array (15)
array => string (33) "CodeIgniter\Entity\Cast\ArrayCast"
...
I think it's redundant to have 1000 copies of a list in 1000 entities. At least it affects memory. Can we put this in a separate class, enum?
I add class and replace instance DataCaster (this is not a complete solution.):
PHP Code:
class CastHandlers {
    public const array DefaultCastHandlers = [
        'array'    => ArrayCast::class,
        // ...
    ];
}

public function 
__construct(?array $data null)
{
    $this->dataCaster = new DataCaster(
        array_merge(CastHandlers::DefaultCastHandlers$this->castHandlers),
        null,
        null,
        false,
    );
    // ...


A quick test shows an improvement of 15-25% (appstarter on build-in server, opcache, PHP 8.4.4):
Before: 100ms 5.641 MB
After: 81ms  4.904 MB, 72ms  4.904 MB

The difference between 21 entities and 42 is the same:
Before: 180ms 10.300 MB
After: 156ms 8.880 MB

Update CI to last version problem with multiple db

$
0
0
Hi , i updated a project to last version.
In this project i use two db , but in this versione hi have this error: 
Code:
CRITICAL - 2025-03-03 07:05:15 --> CodeIgniter\Exceptions\InvalidArgumentException: "magazzinoes" is not a valid database connection group.

this is env file :

Code:
database.default.hostname = localhost
database.default.database = stampa_etichette_zebra
database.default.username = ****
database.default.password = ****
database.default.DBDriver = MySQLi
#database.default.DBPrefix =
database.default.port = 3307
//db magazzino es per i materiali
database.magazzinoes.hostname = localhost
database.magazzinoes.database = my_magazzinoes
database.magazzinoes.username = ****
database.magazzinoes.password = ****
database.magazzinoes.DBDriver = MySQLi
database.magazzinoes.port = 3307
And in my model : 
Code:
<?php

  namespace App\Models;

  use CodeIgniter\Model;


  class MaterialeModel extends Model {
   
    //SCELGO  IL DATABASE DEL MAGAZZINO PER RECUPERE I MATERIALI     
    protected $DBGroup = 'magazzinoes'; // default database group
How can i solve it ?

HI , with multiple db it's not enough to insert it into the env file but we have to add it in App\Config\Database
In my case : 
Code:
    /**
    * The default database connection.
    *
    * @var array<string, mixed>
    */
    public array $default = [
        'DSN'          => '',
        'hostname'    => 'localhost',
        'username'    => '',
        'password'    => '',
        'database'    => '',
        'DBDriver'    => 'MySQLi',
        'DBPrefix'    => '',
        'pConnect'    => false,
        'DBDebug'      => true,
        'charset'      => 'utf8mb4',
        'DBCollat'    => 'utf8mb4_general_ci',
        'swapPre'      => '',
        'encrypt'      => false,
        'compress'    => false,
        'strictOn'    => false,
        'failover'    => [],
        'port'        => 3307,
        'numberNative' => false,
        'foundRows'    => false,
        'dateFormat'  => [
            'date'    => 'Y-m-d',
            'datetime' => 'Y-m-d H:i:s',
            'time'    => 'H:i:s',
        ],
    ];
   
   
   
        /**
    * Database per revuperare i materiali dal database magazzino es.
    *
    * @var array<string, mixed>
    */
   
   
    public array $magazzinoes = [
        'DSN'          => '',
        'hostname'    => 'localhost',
        'username'    => '',
        'password'    => '',
        'database'    => '',
        'DBDriver'    => 'MySQLi',
        'DBPrefix'    => '',
        'pConnect'    => false,
        'DBDebug'      => true,
        'charset'      => 'utf8mb4',
        'DBCollat'    => 'utf8mb4_general_ci',
        'swapPre'      => '',
        'encrypt'      => false,
        'compress'    => false,
        'strictOn'    => false,
        'failover'    => [],
        'port'        => 3307,
        'numberNative' => false,
        'foundRows'    => false,
        'dateFormat'  => [
            'date'    => 'Y-m-d',
            'datetime' => 'Y-m-d H:i:s',
            'time'    => 'H:i:s',
        ],
    ];

Honeypot causing error

$
0
0
Hello,

I enabled honeypot in config and now get this error when saving a record

Code:
if (!$record->hasChanged()) {

            return redirect()->back()
                ->with('warning', lang('App.messages.no_change'))
                ->withInput();
        }

        $record->page_url = url_title($record->page_title, '-');

        if ($this->page->protect(false)
            ->save($record)
        )

Unknown column 'honeypot' in 'field list'

I had to add unset to resolve this.

Code:
$post = $this->request->getPost();
        unset($post['honeypot']);
        $slider->fill($post);
Viewing all 14343 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>