Exemplo n.º 1
0
<?php

if (isset($model->data['dir'], $model->data['routes'])) {
    // Initialize the directories object
    $dirs = new \bbn\ide\directories($model->inc->options, $model->data['routes']);
    $current = empty($model->data['path']) ? '' : $model->data['path'];
    if (!empty($current)) {
        $current .= '/';
    }
    // Get the relative directory item
    if ($dir = $dirs->dir($model->data['dir'])) {
        // Get the directory's root path
        $path = $dirs->get_root_path($model->data['dir']);
        //
        $file_check = ['viewables' => ['html', 'htm', 'php', 'php4', 'jinja2', 'php5', 'sql', 'mysql', 'js', 'py', 'txt', 'log', '', 'css', 'less', 'htaccess', 'htpasswd', 'svg', 'conf'], 'images' => ['jpg', 'jpeg', 'gif', 'png']];
        // Files' extensions excluded
        $excluded = ['svn', 'notes', 'git'];
        // Extensions for icons
        $ext_icons = ['css', 'less', 'html', 'js', 'py', 'php', 'sql', 'svg', 'json', 'txt', 'md'];
        // List of folders
        $folders = [];
        // List of files
        $files = [];
        // Check if the directory is a mvc
        if (!empty($dir['tabs'])) {
            // Get all files and all folders of each mvc's tabs (_ctrl tab excluded)
            foreach ($dir['tabs'] as $i => $t) {
                if ($i !== '_ctrl') {
                    // Set the real path
                    $real = $path . $t['path'] . (empty($model->data['path']) ? '' : $model->data['path']);
                    if (file_exists($real)) {
Exemplo n.º 2
0
    $ctrl->inc->session->set($sess, 'ide', 'list');
    if (!$current_dir && $ctrl->inc->session->has('ide', 'dir')) {
        $current_dir = $ctrl->inc->session->get('ide', 'dir');
    }
    $ide_cfg = $ctrl->inc->user->get_cfg('ide');
    echo $ctrl->set_title("IDE")->add_js('./functions', ['dirs' => $model['dirs'], 'root' => $ctrl->data['root'], 'baseURL' => $ctrl->say_path() . '/', 'theme' => empty($ide_cfg['theme']) ? '' : $ide_cfg['theme'], 'font' => empty($ide_cfg['font']) ? '' : $ide_cfg['font'], 'font_size' => empty($ide_cfg['font_size']) ? '' : $ide_cfg['font_size']])->add_js(['menu' => $model['menu'], 'config' => $list, 'dirs' => $model['dirs'], 'root' => $ctrl->data['root'], 'url' => implode('/', $ctrl->params), 'current_dir' => $current_dir ? $current_dir : $model['default_dir']])->get_view() . $ctrl->get_less();
    $ctrl->obj->url = 'ide/editor';
} else {
    $dirs = new \bbn\ide\directories($ctrl->inc->options, $ctrl->get_routes());
    //$dir = array_shift($ctrl->arguments);
    $tab = array_pop($ctrl->arguments);
    $url = implode('/', $ctrl->arguments);
    // Case where it's a new file and we need to provide the tabNav info
    if (strpos($url, $ctrl->baseURL) === false) {
        if ($dir = $dirs->dir_from_url($url)) {
            $info = $dirs->dir($dir);
            $ctrl->obj = $dirs->load($url, $dir, $tab, $ctrl->inc->pref);
        }
    } else {
        $res = $dirs->load($url, $dir, $tab, $ctrl->inc->pref);
    }
    /*
    \bbn\x::hdump(
      $res,
      $ctrl->arguments,
      $ctrl->baseURL,
      $ctrl->say_path(),
      $ctrl->say_dir(),
      $ctrl->say_local_path(),
      $ctrl->say_local_route(),
      $ctrl->say_controller(),
Exemplo n.º 3
0
<?php

/** @var \bbn\mvc\model $model */
if (isset($model->data['path'])) {
    $dirs = new \bbn\ide\directories($model->inc->options);
    return $dirs->dir($model->data['path']);
}