Forma LMS PHP Cross Reference Learning Management Systems

Source: /index.php - 158 lines - 4889 bytes - Summary - Text - Print

   1  <?php
   2  
   3  /* ======================================================================== \

   4  |   FORMA - The E-Learning Suite                                            |

   5  |                                                                           |

   6  |   Copyright (c) 2013 (Forma)                                              |

   7  |   http://www.formalms.org                                                 |

   8  |   License  http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt           |

   9  |                                                                           |

  10  |   from docebo 4.0.5 CE 2008-2012 (c) docebo                               |

  11  |   License http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt            |

  12  \ ======================================================================== */
  13  
  14  define("IN_FORMA", true);
  15  define("_deeppath_", '');
  16  require(dirname(__FILE__).'/base.php');
  17  
  18  // start buffer

  19  ob_start();
  20  
  21  // initialize

  22  require(_base_.'/lib/lib.bootstrap.php');
  23  Boot::init(BOOT_PAGE_WR);
  24  
  25  if(!Docebo::user()->isAnonymous() && (!isset($_GET['modname']) || $_GET['modname'] != 'login')) {
  26  
  27      require_once(_base_.'/lib/lib.platform.php');
  28      $pm = PlatformManager::createInstance();
  29      if($pm->getHomePlatform() == 'cms') Util::jump_to(_folder_cms_.'/index.php');
  30      Util::jump_to(_folder_lms_.'/index.php');
  31  }
  32  
  33  
  34  
  35  
  36  
  37  // instanciate the page-writer that we want (maybe we can rewrite it in a

  38  // different way with the introduction of the layout manager)

  39  emptyPageWriter::createInstance();
  40  $db =& DbConn::getInstance();
  41  
  42  $query = "SELECT param_value FROM core_setting
  43          WHERE param_name = 'maintenance'
  44          ORDER BY pack, sequence";
  45  
  46  $mode = $db->fetch_row($db->query($query));
  47  
  48  $query = "SELECT param_value FROM core_setting
  49          WHERE param_name = 'maintenance_pw'
  50          ORDER BY pack, sequence";
  51  $passwd = $db->fetch_row($db->query($query));
  52  
  53  // Se siamo in modalita' manutenzione

  54  if($mode[0] == "on"){
  55      // Se e' stata chiamata l'URL manualmente con la password

  56      if(isset($_GET["passwd"])){
  57          // Se la password non corrisponde lo mando alla pagina di manutenzione

  58          if($passwd[0] != $_GET["passwd"]){
  59              Util::jump_to('maintenance.html');
  60          }
  61      }else{
  62          Util::jump_to('maintenance.html');
  63      }
  64  }
  65  
  66  // redirect if the main page is the cms

  67  $query_platform = "SELECT platform
  68  FROM ".$GLOBALS['prefix_fw']."_platform
  69  WHERE main = 'true'
  70  LIMIT 0, 1";
  71  list($sel) = $db->fetch_row($db->query($query_platform));
  72  if($sel == 'cms') {
  73      Util::jump_to(_folder_cms_);
  74  }
  75  
  76  // load the requested module

  77  $module_cfg = false;
  78  $GLOBALS['modname'] = Get::req('modname', DOTY_ALPHANUM, '');
  79  $GLOBALS['op']        = Get::req('op', DOTY_ALPHANUM, '');
  80  $r                    = Get::req('r', DOTY_MIXED, '');
  81  $GLOBALS['mvc']        = $r;
  82  
  83  if(!empty($GLOBALS['modname'])) {
  84      require_once(_lms_.'/lib/lib.istance.php');
  85      $module_cfg =& createModule($GLOBALS['modname']);
  86  }
  87  if($r !== '')
  88  {
  89      $GLOBALS['page']->add(Util::get_css(Layout::path().'style/base.css', true), 'page_head');
  90      $GLOBALS['page']->add(Util::get_css(Layout::path().'style/base-old-treeview.css', true), 'page_head');
  91      $GLOBALS['page']->add(Util::get_css(Layout::path().'style/lms.css', true), 'page_head');
  92      $GLOBALS['page']->add(Util::get_css(Layout::path().'style/lms-to-review.css', true), 'page_head');
  93      $GLOBALS['page']->add(Util::get_css(Layout::path().'style/lms-menu.css', true), 'page_head');
  94      $GLOBALS['page']->add(Util::get_css(Layout::path().'style/print.css', true), 'page_head');
  95  
  96      $r = preg_replace('/[^a-zA-Z0-9\-\_\/]+/', '', $r);
  97      $r = explode('/', $r);
  98      if(count($r) == 3) {
  99          // Position, class and method defined in the path requested

 100          $mvc_class = ucfirst(strtolower($r[1])). ucfirst(strtolower($r[0])).'Controller';
 101          $mvc_name = $r[1];
 102          $task = $r[2];
 103      } else {
 104          // Only class and method defined in the path requested

 105          $mvc_class = ''.ucfirst(strtolower($r[0])).'LmsController';
 106          $mvc_name = $r[0];
 107          $task = $r[1];
 108      }
 109      ob_clean();
 110      $controller = new $mvc_class( $mvc_name );
 111      $controller->request($task);
 112  
 113      $GLOBALS['page']->add(ob_get_contents(), 'content');
 114  
 115      if($r[0] === 'homecatalogue')
 116          $layout = 'home_catalogue';
 117      else
 118          $layout = 'home';
 119  
 120      ob_clean();
 121  }
 122  else
 123  {
 124      // layout selection

 125      if($op == '') $op = 'login';
 126      switch ($op) {
 127          case 'login': {
 128              $layout = 'home_login';
 129          };break;
 130          default: {
 131              if ($module_cfg) {
 132                  $layout = 'home';
 133                  $module_cfg->loadBody();
 134              }
 135              else { die(); }
 136          };break;
 137      }
 138  }
 139  
 140  // -----------------------------------------------------------------------------

 141  
 142  #// finalize TEST_COMPATIBILITA_PHP54

 143  // Boot::finalize();

 144  
 145  // remove all the echo and put them in the debug zone

 146  $GLOBALS['page']->add(ob_get_contents(), 'debug');
 147  ob_clean();
 148  
 149  // layout

 150  Layout::render($layout);
 151  
 152  #// finalize TEST_COMPATIBILITA_PHP54

 153  Boot::finalize();
 154  
 155  // flush buffer

 156  ob_end_flush();
 157  
 158  ?>

title

Description

title

Description

title

Description

title

title

Body