Brain Core

Glee

Junior Member
Members
3Posts:
3 Threads:
Dec 21Joined:
0 Reputation:
#1
Hello All!

I'm trying to re-design Brain, with some Minor Tweaks!
 
What I'm trying to do is to eliminate the brain-config.php to configure it via Housekeeping.

I would like to share some screenshots of my work.

Please log in or register to see this link.

So I would like someone to review some of my codes that I have attempted to edit.

for the class.html.php I have attempted to this.

PHP Code:
private static function siteSettings()
        {
            global $dbh;
            $siteSettings $dbh->prepare("SELECT site_closed FROM cms_system WHERE site_closed = 1");
            $siteSettings->bindParam(':site_closed'$site_closed);
            $siteSettings->execute();
            if ($siteSettings->RowCount() === 1)
            {
                $queryMaintenance $dbh->prepare("SELECT site_closed FROM cms_system WHERE site_closed = 1");
                $queryMaintenance->bindParam(':site_closed'$site_closed);
                $queryMaintenance->execute();
                while ($rowMaintenance $queryMaintenance->fetch())
                    {
                        return true;
                       
                    
}
                    else
                    {
                        return false;
                    }
                
            

What this code is suppose to do is to fetch the cms_system to see "site_closed" is enabled using enum.

for the class.admin.php

PHP Code:
public static function checkMaintenance()
        {
            global 
$dbh;
            if (isset(
$_POST['checkMaintenance']))
            {
                
$_SESSION['site_open'] = $_POST['site_open'];
                
$_SESSION['site_closed'] = $_POST['site_closed'];
                if (!empty(
$_POST['site_open']))
                {
                    if (!empty(
$_POST['site_closed']))
                    {
                        
$checkMaintenance $dbh->prepare("
                        INSERT INTO cms_settings(site_closed)
                        VALUES
                        (:site_closed,)"
);
                        
$checkMaintenance->bindParam(':site_closed'$_POST['site_closed']);
                        
$checkMaintenance->execute();
                        
$_SESSION['site_closed'] = '';
                        
Admin::succeed("Site is in Maintenance");
            }
        }
    }

It's suppose to insert into the database but I know I need to change the query to UPDATE cms_system using enum. 

If someone can help me out with this would be greatly appreciated.
Reply
Users browsing this thread:
1 Guest(s)