LatrinaCMS - PHP 7 - Must Use!!

Status
Not open for further replies.

LeChris

https://habbo.codes/
Sep 30, 2013
2,786
1,395
He's just Salty someone made a CMS using PHP 7 before he could finish his update of RevCMS using PHP7

But then again all users are entitled of their opinion, not all developers make things in the most perfect way, which enables you to learn from each CMS, theme, anything that you've coded or made.

Atleast @Sage has made something he can look back on later and make it alot better in the future. Good job buddy.
My Rev update was finished 2 hours in and put on Git with no official release lol, same with my custom PHP 7 Framework with a mysqli wrapper, template engine, theme support, and extendable modules ?
 

BIOS

ಠ‿ಠ
Apr 25, 2012
906
247
Chris' just Salty someone made a CMS using PHP 7 before he could finish his update of RevCMS using PHP7

But then again all users are entitled of their opinion, not all developers make things in the most perfect way, which enables you to learn from each CMS, theme, anything that you've coded or made.

Atleast @Sage has made something he can look back on later and make it alot better in the future. Good job buddy.
This isn't the first either, it's not even utilizing the new PHP7 features from what I can see l .

Don't really like this myself, a lot of the code in the snippets could be improved plus there's things you haven't considered.

7ba662a4b15240bab1a314b771f880e4.png

This function shouldn't even exist, the libraries should be available without manual loading. But if you really must do it this way then you could at least use glob() to find all ".class.php" files and then load them in, then process them accordingly. I also notice here that you're including the file straight after checking it exists, what If you didn't have the necessary read permissions for that file? As it's an include rather than require, the script will continue and your site will explode.

Etc.

Code:
$this->klein->respond('GET', '!@^/login|/register', function ($request, $response, $service, $app) {
            if (!Latrina::getLibrary('latrina.user.user')->loggedIn()) {
                if (strpos($request, 'login') !== false) {
                    $response->redirect('/login')->send();
                } else {
                    $response->redirect('/register')->send();
                }
            }
        });
Also that routing is a disaster, as Syntax previously mentioned you should avoid mixing logic with routing; they're two separate tasks and should never be done in the same place. You're also loading in more variables to the router than you actually need, you never use $service or $app so only use those where you need them.

An example of how you could do the same thing:
PHP:
$this->klein->respond('GET', '/login', function ($request, $response) {
    if(isset($_SESSION['user'])){
        return $response->redirect('/');
    }else{
        return $response->view('loginPage...');
    }
});

Even better, use controllers.
 

Seriosk

Programmer;
Oct 29, 2016
256
105
This isn't the first either, it's not even utilizing the new PHP7 features from what I can see l .

Don't really like this myself, a lot of the code in the snippets could be improved plus there's things you haven't considered.

7ba662a4b15240bab1a314b771f880e4.png

This function shouldn't even exist, the libraries should be available without manual loading. But if you really must do it this way then you could at least use glob() to find all ".class.php" files and then load them in, then process them accordingly. I also notice here that you're including the file straight after checking it exists, what If you didn't have the necessary read permissions for that file? As it's an include rather than require, the script will continue and your site will explode.

Etc.


Also that routing is a disaster, as Syntax previously mentioned you should avoid mixing logic with routing; they're two separate tasks and should never be done in the same place. You're also loading in more variables to the router than you actually need, you never use $service or $app so only use those where you need them.

An example of how you could do the same thing:
PHP:
$this->klein->respond('GET', '/login', function ($request, $response) {
    if(isset($_SESSION['user'])){
        return $response->redirect('/');
    }else{
        return $response->view('loginPage...');
    }
});

Even better, use controllers.

A lot has changed since that, I have now changed the routing library that I currently use, implemented controllers and started working on an official theme, I have also addressed many of the issues you have previously stated.

About using the PHP7 features there is a lot of code that you haven't seen yet that does use the PHP7 features, also I encourage everyone to use PHP7 if they did use this in a production environment as PHP7 carry s many improvements from the normal PHP version many people are using (5.6 or 5.7).

I'll keep you guys updated, thanks BIOS for the feedback.
 

BIOS

ಠ‿ಠ
Apr 25, 2012
906
247
Wouldn't PSR be better than using glob or manual class loading.
Firstly, it's not called PSR; that's the standard that recommends it. It's called auto-loading.

Secondly, if you read my previous post you'd have seen that I said the manual loading shouldn't even exist; implying auto-loading should be used.

"This function shouldn't even exist, the libraries should be available without manual loading. But if you really must do it this way then you could at least use glob() to find all ".class.php""

"without manual loading"
"But if you really must do it this way"

How 2 read 101:
1. Take a piece of text.
2. Look at it.
3. Use brain cells to interpret the text.

P.S: Don't follow PSR's every recommendation. Anything past PSR-4 is pretty much .

I'll keep you guys updated, thanks BIOS for the feedback.
You're welcome.
 
Last edited:

Seriosk

Programmer;
Oct 29, 2016
256
105
Updates:
- Each theme now has its own individual configuration [logo, css path, etc]
- I've improved the way I load configuration

Its small steps, but I hope to deliver some more promising news soon.
 

Seriosk

Programmer;
Oct 29, 2016
256
105
Updates:
- Added 1 official theme that will be the default theme for LatrinaCMS in the near future. (Thanks @Synt4x)
- You can now easily add Google Analystics be easily editing your config
- Added functionality for FindRetros voting (also handles if its offline etc, pretty advanced)

Of course all these features will put time on your pageload times but their all disabled to start with, up to you what features are most important to you so you can enable/disable them.

Also thinking of renaming this project, the original name really has lost its touch.
 
Status
Not open for further replies.

Users who are viewing this thread

Top