Jump to content

Recommended Posts

Posted
9 minutes ago, XFallSeane said:

 

Hi,

Did you correctly fill in the information in application / App / preferences.php?

Hello xD

I believe so. I am doing everything locally first to get it working.

Posted
Just now, Nimbus said:

Hello xD

I believe so. I am doing everything locally first to get it working.

 

And in local not working ? 
The error is problem to connect your local database.

Posted
2 minutes ago, XFallSeane said:

You have to create a folder with the cms files in it, that's what you did, right?

Yes I did

165c41127e932670aadc1eddae885a83.png

Posted
11 minutes ago, XFallSeane said:

Laragon software for a web server and a local database simply and quickly (simple and efficient) 

Gotcha! I downloaded Laragon but I'm not sure entirely what needs to be done. It's setup is quite different than XAMPP and I used that because there was a english guide that I could follow easily.

Posted
17 minutes ago, XFallSeane said:

Laragon is simply create a folder in the folder www.

 

Restarting laragon. 

 

On your browser access to site from http://foldername.test

 

I now recommend version 2 of the cms (by me) 

Ok I got that figured out and received the same error as in XAMPP

Fatal error: Uncaught PDOException: Could not connect to database (test_rpg). in C:\laragon\www\BSC\vendor\gabordemooij\redbean\RedBeanPHP\Driver\RPDO.php:440 Stack trace: #0 C:\laragon\www\BSC\vendor\gabordemooij\redbean\RedBeanPHP\Driver\RPDO.php(161): RedBeanPHP\Driver\RPDO->connect() #1 C:\laragon\www\BSC\vendor\gabordemooij\redbean\RedBeanPHP\Driver\RPDO.php(464): RedBeanPHP\Driver\RPDO->runQuery('SELECT * FROM c...', Array) #2 C:\laragon\www\BSC\vendor\gabordemooij\redbean\RedBeanPHP\Adapter\DBAdapter.php(118): RedBeanPHP\Driver\RPDO->GetAll('SELECT * FROM c...', Array) #3 C:\laragon\www\BSC\vendor\gabordemooij\redbean\RedBeanPHP\Facade.php(158): RedBeanPHP\Adapter\DBAdapter->get('SELECT * FROM c...', Array) #4 C:\laragon\www\BSC\vendor\gabordemooij\redbean\RedBeanPHP\Facade.php(1226): RedBeanPHP\Facade::query('get', 'SELECT * FROM c...', Array) #5 C:\laragon\www\BSC\public\index.php(63): RedBeanPHP\Facade::getAll('SELECT * FROM c...') #6 {main} thrown in C:\laragon\www\BSC\vendor\gabordemooij\redbean\RedBeanPHP\Driver\RPDO.php on line 440


fa9834c2ba502cb503b8420bedb26290.png

Posted
9 minutes ago, XFallSeane said:

Can you share me preferences.php file pls ?

 

Database test_rpg exist ? 

preferences.php

<?php

declare(strict_types=1);

namespace App;

/**
 * This class contains the preferences for the application.
 *
 * @package App
 */
class Preferences
{
    /**
     * @var string
     */
    private $rootPath;
    private $themeName;
    private $baseURL;

    private $apiUsername;
    private $apiPassword;
    private $apiServer;
    private $apiToken;

    private $cmsSettings;

    private $dbIp = "127.0.0.1";
    private $dbUser = "root";
    private $dbPassword = "";
    private $dbPort = "5400";
    private $dbName = "BSC";

    /**
     * Preferences constructor.
     *
     * @param string $rootPath
     */
    public function __construct(string $rootPath)
    {
        $this->rootPath = $rootPath;
    }

    /**
     * @return string
     */
    public function getRootPath(): string
    {
        return $this->rootPath;
    }

    /**
     * @return string
     */
    public function getThemeName(): string
    {
        return $this->themeName;
    }

    /**
     * @return string
     */
    public function setThemeName($themeName)
    {
        $this->themeName = $themeName;
    }

    /**
     * @return string
     */
    public function getDbIp(): string
    {
        return $this->dbIp;
    }
    /**
     * @return string
     */
    public function getDbUser(): string
    {
        return $this->dbUser;
    }
    /**
     * @return string
     */
    public function getDbPassword(): string
    {
        return $this->dbPassword;
    }
    /**
     * @return string
     */
    public function getDbPort(): string
    {
        return $this->dbPort;
    }
    /**
     * @return string
     */
    public function getDbName(): string
    {
        return $this->dbName;
    }


     /* Config API */
     /**
     * @return string
     */
    public function getApiUser(): string
    {
        return $this->apiUsername;
    }
    public function setApiUser($username)
    {
        $this->apiUsername = $username;
    }
    /**
     * @return string
     */
    public function getApiPassword(): string
    {
        return $this->apiPassword;
    }
    public function setApiPassword($password)
    {
        $this->apiPassword = $password;
    }
    /**
     * @return string
     */
    public function getApiServer(): string
    {
        return $this->apiServer;
    }
    public function setApiServer($server)
    {
        $this->apiServer = $server;
    }

    /**
     * @return string
     */
    public function getApiToken()
    {
        return $this->apiToken;
    }
    public function setApiToken($token)
    {
        $this->apiToken = $token;
    }

    /**
     * @return array
     */
    public function getCmsSettings()
    {
        return $this->cmsSettings;
    }
    public function setCmsSettings($settings)
    {
        $this->cmsSettings = $settings;
    }

    public function getApiData()
    {
      // API login
      $postData = array(
          'grant_type' => "password",
          'username' => $this->getApiUser(),
          'password' => hash('sha256', $this->getApiPassword())
      );
      return $postData;
    }

    /**
     * @return string
     */
    public function getBaseURL(): string
    {
        return $this->baseURL;
    }
    public function setBaseURL($server)
    {
        $this->baseURL = $server;
    }


    /* Function API */
    public function APIcall_POST($server, $postData, $access_token, $calltype)
    {
        $ch = curl_init('http://' . $server . $calltype);
        curl_setopt_array($ch, array(
            CURLOPT_POST => true,
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_HTTPHEADER => array(
                'authorization:Bearer ' . $access_token, // "authorization:Bearer", et non pas "authorization: Bearer"
                'Content-Type:application/json' // "Content-Type:application/json", et non pas "Content-Type: application/json"
            ) ,
            CURLOPT_POSTFIELDS => json_encode($postData)
        ));
        $response = curl_exec($ch);
        if ($response === false)
        {
            return (curl_error($ch));
        }
        $responseData = json_decode($response, true);
        return $responseData;
    }

    // Permet de récupérer des données depuis la BDD via l'API : liste des joueurs, etc
    public function APIcall_GET($server, $access_token, $calltype)
    {
        $ch = curl_init('http://' . $server . $calltype);
        curl_setopt_array($ch, array(
            CURLOPT_HTTPGET => true,
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_HTTPHEADER => array(
                'authorization:Bearer ' . $access_token, // "authorization:Bearer", et non pas "authorization: Bearer"
                'Content-Type:application/json' // "Content-Type:application/json", et non pas "Content-Type: application/json"
            ) ,
        ));
        $response = curl_exec($ch);
        if ($response === false)
        {
            return (curl_error($ch));
        }
        $responseData = json_decode($response, true);
        return $responseData;
    }

Posted
1 hour ago, XFallSeane said:

do you have the BSC database created in phpmyadmin? Preferably use lowercase words for databases.

I had it done in XAMPP but I can't figure out how to import databases on Laragon.

44e4dec70b75dce3398624580381d8f1.png

Posted
2 minutes ago, XFallSeane said:

If u want tomorrow I send you a private message with installation directions for phpmyadmin

I think I'm getting somewhere xD

e65484a81de5e007d598b973f5e9d92d.png

Posted
1 minute ago, Nimbus said:

I think I'm getting somewhere xD

e65484a81de5e007d598b973f5e9d92d.png

 

If you have managed to put the database, in the table cms_settings changes the value of base_URL by the local URL of your site. 

 

Now with this base u can update to v1.1 and 2.0 (my new version) 

Posted

Getting this error now.

Fatal error: Uncaught Error: Class 'App\Preferences' not found in C:\laragon\www\BSC\application\App\ContainerFactory.php:23 Stack trace: #0 C:\laragon\www\BSC\public\index.php(40): App\ContainerFactory::create('C:\\laragon\\www\\...') #1 {main} thrown in C:\laragon\www\BSC\application\App\ContainerFactory.php on line 23

6e1f14cdeee200b5bd1e8f72ec7a1f7d.png

Posted
8 hours ago, Nimbus said:

Getting this error now.

Fatal error: Uncaught Error: Class 'App\Preferences' not found in C:\laragon\www\BSC\application\App\ContainerFactory.php:23 Stack trace: #0 C:\laragon\www\BSC\public\index.php(40): App\ContainerFactory::create('C:\\laragon\\www\\...') #1 {main} thrown in C:\laragon\www\BSC\application\App\ContainerFactory.php on line 23

6e1f14cdeee200b5bd1e8f72ec7a1f7d.png

 

I answered you in private in case but for the others which follow I recommend you to use the new Unleashed version (in my signature) for all new CMS installations.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...