CodeIgniter Forums
Problem with integration with Tiny File Manager - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Model-View-Controller (https://forum.codeigniter.com/forumdisplay.php?fid=10)
+--- Thread: Problem with integration with Tiny File Manager (/showthread.php?tid=88598)

Pages: 1 2


Problem with integration with Tiny File Manager - damek2010 - 10-03-2023

Hello,
I have a problem integrating Tiny File Manager with CodeIgniter 4.
I added the code from above like a view in MVC and everything worked (and adding it gave me a number of integration options with the remaining code). Everything worked fine with CodeIgniter 3, but the server on which the website is hosted requires the use of CodeIgniter 4 for security purposes. For me, it's not a problem, I've already done everything, but I can't integrate Tiny File Manager. Neither the old version works nor the new one. In the new one I get an error:

Code:
Tiny File Manager
Error: Cannot load configuration

It is related to the fact that there are variables in VIEW that should be global and after adding print_r() you can see its value, but immediately after using global $config it is not known why it is cleared.


RE: Problem with integration with Tiny File Manager - kenjis - 10-03-2023

What is the code from above?
What is global $config? How did you set?


RE: Problem with integration with Tiny File Manager - damek2010 - 10-03-2023

I have the current code from https://github.com/prasathmani/tinyfilemanager

The previous version worked for me in this way: I pasted everything from the tinyfilemanager.php file into the view that was called by the controller and everything worked properly.
Now after changing to CodeIgniter 4, unfortunately it doesn't work and the error I get is given above Sad
I will add that adding information from https://tinyfilemanager.github.io/docs/#Embedding to the controller unfortunately has no effect


RE: Problem with integration with Tiny File Manager - kenjis - 10-04-2023

It seems you did something wrong with CI4.
Can you show the code?


RE: Problem with integration with Tiny File Manager - damek2010 - 10-04-2023

Menadzerplikow_c.php
PHP Code:
<?php
namespace App\Controllers;
use 
CodeIgniter\Controller;
use 
App\Models\Model_m;
use 
App\Models\Menu_m;
use 
App\Models\Player_m;
use 
App\Models\Panel_m;
use 
App\Models\Notatnik_m;
use 
App\Models\Menuedit_m;
use 
App\Models\Profil_m;
use 
App\Models\Ytdownload_m;

class 
Menadzerplikow_c extends Controller {

 
/**
 * Index Page for this controller.
 *
 * Maps to the following URL
 * http://example.com/index.php/welcome
 * - or -
 * http://example.com/index.php/welcome/index
 * - or -
 * Since this controller is set as the default controller in
 * config/routes.php, it's displayed at http://example.com/
 *
 * So any other public methods not prefixed with an underscore will
 * map to /index.php/welcome/<method_name>
 * @see https://codeigniter.com/user_guide/general/urls.html
 */

 
public function index()
 {
 
$session session();
 if(
$session->get('login'))
 {
 
 
define('FM_EMBED'true);
 
define('FM_SELF_URL'$_SERVER['PHP_SELF']);
        
     $id 
$session->get('id');
 
    $imie $session->get('imie');
 
    $ranga $session->get('ranga');
 
$model = new Model_m();
 
$model $model->start();
 
$menu = new Menu_m();
 
$menu $menu->start();
 
//$tresc = $this->gettresc();
 
$player = new Player_m();
 
$player $player->start();
 
$panel = new Panel_m();
 
$panel $panel->start();
 
$notatnik = new Notatnik_m();
 
$notatnik $notatnik->start();
 
$menuedit = new Menuedit_m();
 
    $menuedit $menuedit->start();
            $ytdownload = new Ytdownload_m();
                $ytdownload $ytdownload->start();
            $profil = new Profil_m();
                $profil $profil->start();

 
 
//$this->load->model('temp_m');
 //$temp = $this->temp_m->start();

 
$data = array(
 
    'id' => $id,
 
    'imie' => $imie,
 
'model' => $model,
 
'menu' => $menu,
 
//'tresc' => $tresc,
 
'player' => $player,
 
'panel' => $panel,
 
'notatnik' => $notatnik,
 
'menuedit' => $menuedit,
                'ytdownload' => $ytdownload,
                'profil' => $profil,
                'ranga' => $ranga,
 
//'temp' => $temp,

 
);

 echo 
view('menadzerplikow_v',$data);
 
//require 'menadzerplikow_v.php';
 
}
 else
 {
 
//redirect('logowanie', 'refresh');
 
return redirect()->to(base_url().'login');
 }
 }



menadzerplikow_v.php is from here (copy & paste carefully) (I can't paste here code because it's too long)
https://github.com/prasathmani/tinyfilemanager/blob/master/tinyfilemanager.php


RE: Problem with integration with Tiny File Manager - damek2010 - 10-05-2023

Can anyone help me? Sad


RE: Problem with integration with Tiny File Manager - kenjis - 10-05-2023

In a view file, variables are not global.


RE: Problem with integration with Tiny File Manager - damek2010 - 10-06-2023

(10-05-2023, 02:32 PM)kenjis Wrote: In a view file, variables are not global.

Ok. So where should I put these variables, because when I moved the $CONFIG variable to the controller, it had no effect :/


RE: Problem with integration with Tiny File Manager - kenjis - 10-06-2023

In a controller or model class, variables are not global.
It is bad practice to use global variables, so there is no place to use global variables in CI4.

But if you want to use global variables, you could use because that is a PHP language feature.
You need to make it global explicitly.
PHP Code:
global $CONFIG



RE: Problem with integration with Tiny File Manager - damek2010 - 10-06-2023

(10-06-2023, 01:39 AM)kenjis Wrote: In a controller or model class, variables are not global.
It is bad practice to use global variables, so there is no place to use global variables in CI4.

But if you want to use global variables, you could use because that is a PHP language feature.
You need to make it global explicitly.
PHP Code:
global $CONFIG

There is a global in the above script (please see the link) and unfortunately it does not work after pasting in VIEW. So what should I do to make it work? Please see this script and give me a hint.