Jump to content

PHP IntersectCMS (Open Source)


Lathelmar

Recommended Posts

  On 4/21/2021 at 6:30 PM, XFallSeane said:

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

Expand  

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.

Link to comment
Share on other sites

  On 4/21/2021 at 6:58 PM, 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) 

Expand  

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

Link to comment
Share on other sites

  On 4/21/2021 at 7:19 PM, XFallSeane said:

Can you share me preferences.php file pls ?

 

Database test_rpg exist ? 

Expand  

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;
    }

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  On 4/21/2021 at 11:09 PM, 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

Expand  

 

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.

Link to comment
Share on other sites

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...