Welcome Guest, Not a member yet? Register   Sign In
Question composer didn't update to 4.5.0
Posted by: oldbutactive - 04-09-2024, 07:08 PM - Replies (3)

Greetings - 
Composer update on my CloudLinux server  updated 4.4.5 -> 4.4.8 and NOT to 4.5.0
- I have php 8.1 with intl and mbstring.  Other prerequisites are fine too. 
- using composer 2.6.5
- It worked yesterday on the same server under a different account with the same settings.
- I had already updated index.php to use the new boot routine, but had to fall back.
Any suggestions anyone?
Thanks for maintaining CodeIgniter everyone!

Solved:  composer.json had "^4.4" in the require section for codeigniter.  Changed to "^4" and all is good.  Thanks everyone!


  dynamic rule set creation and execution with php
Posted by: mywebmanavgat - 04-09-2024, 03:40 PM - Replies (5)

I didn't know which category to put this topic under. I apologize if I'm in the wrong category.

Hello, I have a form exactly like when adding waf rules in cloudflare.

Here the user chooses what and how to evaluate and saves it.

I understood the form structure and saved it in my database. but I can't figure out how to dynamically write this rule set on the php side.
How can I develop the algorithm that checks the conditions behind this form and executes the result.

[Image: 8igdduf.jpg]


I need to check the rule set that I read from the database or share in json with php and if there is a matching situation, I need to execute the process in the rule set.

Thank you in advance for your help and ideas. I apologize for the bad translation.

I set up a database schema like this.

PHP Code:
{
    "ruleName""Login Control",
    "ruleProcess""BLOCKED",
    "ruleConditions": [
        {
            "id"1,
            "ruleType""failLogin",
            "ruleOperator"">",
            "ruleValue""5",
            "ruleResume" "or"
        },
        {
            "id"2,
            "ruleType""userId",
            "ruleOperator""==",
            "ruleValue""1561",
            "ruleResume" "or"
        },
        {
            "id"3,
            "ruleType""username",
            "ruleOperator""inList",
            "ruleValue""userNameBlackList.json",
            "ruleResume" "or"
        }
    ]


  Cannot access protected property CodeIgniter\HTTP\IncomingRequest::$uri
Posted by: ramonpuig - 04-09-2024, 06:34 AM - Replies (3)

Hello I followed the steps to upgrade from 4.4.8 to 4.5.0 ,

but i get this error

Cannot access protected property CodeIgniter\HTTP\IncomingRequest::$uri on line 75

PHP Code:
      // $this->language->setLocale($this->session->lang); 
69        // Preload any models, libraries, etc, here.    
70 
71        
// Determine whether to include the template or not
72            $excludedUrls = ['home','/','',NULL'about''login','register','users','/users/register','users/registerUser','registerUser','blog''contact'];
73 
74            
// Get the request URI segment 1
75            $requestUri $this->request->uri->getSegments();
76            $this->includeTemplate false;
77            foreach ($requestUri as $urisegment){
78 

Any ideas on the cause of the issue? thx


  Locale tolerant 'decimal' validation rule
Posted by: objecttothis - 04-09-2024, 06:14 AM - No Replies

Summary: AFAIK the 'decimal' validation rule will only accept period (.) decimal separators, but some locales use the comma (,) as a decimal separator.
Request: modify decimal to take a parameter (either the BCP-47 locale code or the decimal separator char) so that it will properly validate decimals from locales which use another separator (comma is most common,  but Arabic apparently uses U+066B)

PHP Code:
$rules = ['amount_tendered' => 'trim|required|decimal',];
$messages = ['amount_tendered' => lang('Sales.must_enter_numeric')];

if(!
$this->validate($rules$messages))
{
 echo 
"not a decimal";



With it's current implementation this code fails the decimal validation when the locale dictates users enter comma for the decimal separator.

with the proposed modification this code would become

PHP Code:
$rules = ['amount_tendered' => 'trim|required[,]|decimal',]; //or 'trim|required[az-AZ]|decimal'
$messages = ['amount_tendered' => lang('Sales.must_enter_numeric')];

if(!
$this->validate($rules$messages))
{
 echo 
"not a decimal";




I could modify the $_POST variable to convert it, but that's not good practice. Unless I'm missing something, in it's current implementation, I think I need to create a custom rule which converts the value, then runs the decimal validation rule against it. Is this accurate?


  Oauth SMTP authentication support?
Posted by: CIDave - 04-09-2024, 02:15 AM - Replies (2)

hi!
Google is removing the ability for Google Workspace users to use their SMTP service using just Username and Password. Instead, they will be requiring Oauth to sign in and authenticate using their SMTP servers.
We've been using Google's SMTP for sending emails on our site. But in September 2024, they'll be turning off the ability to use your username and password.
Is there any support for using Oauth with the current email config?
https://support.google.com/accounts/answ...0255?hl=en


  A guide to problem-solving techniques, steps, and skills
Posted by: InsiteFX - 04-08-2024, 03:37 PM - No Replies

A guide to problem-solving techniques, steps, and skills


  Codeigniter 4 extend core class process clarification
Posted by: Semsion - 04-08-2024, 12:07 PM - Replies (7)

An attempt has been made to extend the Codeigniter framework Session class and override function get, instead of replacing the whole Session class /  library. This was by following the guide at https://www.codeigniter.com/user_guide/e...re-classes



Steps taken:



- A new class has been created at `app/Libraries/Session.php`

  - Points of note in this file

    - Added a new namespace: `namespace App\Libraries;`.

    - Pulled in the Codeigniter framework Session class: `use CodeIgniter\Session\Session as BaseSession;`.

    - Extended this class in the function head `class Session extends BaseSession`.

    - Called the parent constructor (not sure if this is required):

      - ```public function __construct()  { parent::__construct($this->driver, $this->config);}```

    - Created a function with the same name `public function get` to override the framework version.

    - As suggested via https://www.codeigniter.com/user_guide/e...re-classes went to the previous section on the same page https://www.codeigniter.com/user_guide/e...re-classes and performed the steps as below:

      - Ensured the Autoload.php could find the namespace App\Libraries (confirmed via `php spark namespaces`).

      - An assumption has been made the interface will be implemented by extending the parent class, that implements the interface.

      - It’s not clear what is meant by `and modify the appropriate Service to load your class in place of the core class.`

        - As adding the below to `app/Config/Services.php` didn’t appear to do anything, another assuption was made that a new Services.php file might need to be created at `app/Libraries/Config/Services.php` (see below also) - as per https://www.codeigniter.com/user_guide/e...re-classes;  however it’s not clear if the content of the class(es) is correct.



PHP Code:
<?php

// app/Config/Services.php

namespace Config;

use 
CodeIgniter\Config\BaseService;

class 
Services extends BaseService
{
    public static function get($getShared true)
    {
        if ($getShared) {
            return static::getSharedInstance('get');
        }
        return new \App\Libraries\Session();
    }


PHP Code:
<?php

// app/Libraries/Config/Services.php

namespace Libraries\Config;

use 
CodeIgniter\Config\BaseService;

class 
Services extends BaseService
{
    public static function get($getShared true)
    {
        if ($getShared) {
            return static::getSharedInstance('get');
        }
        return new \App\Libraries\Session();
    }


- The file located at vendor/codeigniter4/framework/system/Config/Services.php has not been modified.


- `var_dump('Session_get');die;` has been added to  `app/Libraries/Session.php` but is not being hit.


Can anyone possibly assist here please?!


  MYSQLI_OPT_LOCAL_INFILE
Posted by: serialkiller - 04-08-2024, 06:21 AM - Replies (2)

Is there a way to set this parameter directly in the config/database.php settings or should it be done another way?

Thanks


  Typo in documentation?
Posted by: objecttothis - 04-08-2024, 04:26 AM - Replies (3)

https://codeigniter4.github.io/CodeIgnit...e_448.html specifies that /tests/.htaccess received changes, but I don't see a .htaccess file in that directory (/vendor/codeigniter4/framework/tests/) even though there is one in the master branch of CI. https://github.com/codeigniter4/CodeIgni...ster/tests. Maybe this is a problem with the composer package?  I have `"codeigniter4/framework": "4.4.8",` in the require section.


  Missing Documentation
Posted by: objecttothis - 04-08-2024, 02:38 AM - Replies (1)

On codeigniter.com 4.5 is the latest release but https://codeigniter.com/user_guide/insta...ading.html does not have upgrade notes to get from 4.4.5 to 4.4.6 to 4.4.7 to 4.4.8 to 4.5.0.


Looks like it's all in https://codeigniter4.github.io/CodeIgnit...index.html but hasn't been pushed to the main site?


Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Latest Threads
problem with textarea
by Nitin Arora
3 hours ago
Showing pdf on browser
by aarefi
4 hours ago
[4.5.1] Disabling the deb...
by keto
6 hours ago
directory structure
by badger
7 hours ago
Redirect with error vali...
by pippuccio76
7 hours ago
Pass custom variables to ...
by InsiteFX
9 hours ago
How to run a single seede...
by kenjis
Yesterday, 05:41 PM
Codeigniter 4 extend core...
by kenjis
Yesterday, 05:26 PM
blocked by CORS policy
by kenjis
Yesterday, 05:17 PM
[CodeIgniter 4 on IIS 10]...
by Bosborne
Yesterday, 12:33 PM

Forum Statistics
» Members: 84,310
» Latest member: margaretsmith
» Forum threads: 77,553
» Forum posts: 375,875

Full Statistics

Search Forums

(Advanced Search)


Theme © iAndrew 2016 - Forum software by © MyBB