Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request]: move some functions from class2.php to core_functions.php #5263

Open
Jimmi08 opened this issue May 24, 2024 · 4 comments
Open
Labels
type: enhancement An improvement or new feature request

Comments

@Jimmi08
Copy link
Contributor

Jimmi08 commented May 24, 2024

Motivation

Possibility to use e107::getInstance()->initCore() directly without class2.php (see example in thumb.php)

But there are some functions that are needed in handlers and they are now in class2.php:

For now:

function check_email($email)
function check_class($var, $userclass = null, $uid = 0)
function cookie($name, $value, $expire = 0, $path = e_HTTP, $domain = '', $secure = 0)

Proposed Solution

Could be those functions moved to core_functions.php file?
Thanks

Alternatives

only workaround like separate file with those functions

Additional Context

No response

@Jimmi08 Jimmi08 added the type: enhancement An improvement or new feature request label May 24, 2024
@rica-carv
Copy link
Contributor

Just a dumb ideia: Use traits?

@Jimmi08
Copy link
Contributor Author

Jimmi08 commented May 24, 2024

Just a dumb ideia: Use traits?

No, if you use e107 object without class2 file, there are still handlers that use classes from class2.php (without control if they exist) so you need to add them manually. But there is already a file for this... I don't see the reason why they need to be in class2 file if they are really core functions.

@Vodhin
Copy link

Vodhin commented Jun 5, 2024

From what I understand class2.php is the security of your website: It performs checks on all traffic to the rest of e107 in order to prevent bad actors from causing trouble. You really should not use any php scripts without loading class2.php first, and since it is loaded the functions in that file are available for use anywhere further down the load chain.

@Jimmi08
Copy link
Contributor Author

Jimmi08 commented Jun 5, 2024

@Vodhin look at thumb.php file. You don't need class2.php to use e107 handlers. e107 class is required.

Security is done in handlers too. Class2.php is needed only for the theme and front end. class2.php just combine calling those handlers.

I don't ask for security changes. It is more semantic. If there is file core functions why those functions are in class2.php if class2.php or e107 class still loads this file? That file is a mandatory file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement An improvement or new feature request
Projects
None yet
Development

No branches or pull requests

3 participants