Beispiel #1
0
/**
 * create a istance of a specified class of a module
 * automaticaly include the file that contains the class of the module
 *
 * @param string	$module_name 	the name og the module to istance
 * @param string 	$class_name 	the name of the class relative to the module, if not passed is 
 *									extracted from the $module_name
 * 
 * @return mixed 	the class istance
 */
function createModule($module_name, $class_name = NULL)
{
    $module_name = preg_replace('/[^a-zA-Z0-9\\-\\_]+/', '', $module_name);
    if (file_exists(_base_ . '/customscripts/' . _folder_lms_ . '/class.module/class.' . $module_name . '.php') && Get::cfg('enable_customscripts', false) == true) {
        include_once _base_ . '/customscripts/' . _folder_lms_ . '/class.module/class.' . $module_name . '.php';
        if ($class_name === NULL) {
            $class_name = 'Module_' . ucfirst($module_name);
        }
    } else {
        if (file_exists(dirname(__FILE__) . '/../class.module/class.' . $module_name . '.php')) {
            include_once dirname(__FILE__) . '/../class.module/class.' . $module_name . '.php';
            if ($class_name === NULL) {
                $class_name = 'Module_' . ucfirst($module_name);
            }
        } else {
            include_once dirname(__FILE__) . '/../class.module/class.definition.php';
            $class_name = 'LmsModule';
        }
    }
    if (Get::cfg('enable_plugins', false)) {
        if (checkIfPlugin($module_name) == "plugin") {
            include_once Get::rel_path('plugins') . '/' . $module_name . '/class/class.' . $module_name . '.php';
            $class_name = 'Module_' . ucfirst($module_name);
        }
    }
    $module_cfg = new $class_name();
    return $module_cfg;
}
Beispiel #2
0
 function server_info()
 {
     $lang =& DoceboLanguage::createInstance('configuration', 'framework');
     $php_conf = ini_get_all();
     $intest = '<div>' . '<div class="label_effect">';
     $html = '<div class="conf_line_title">' . $lang->def('_SERVERINFO') . '</div>' . config_line($lang->def('_SERVER_ADDR'), $_SERVER['SERVER_ADDR']) . config_line($lang->def('_SERVER_PORT'), $_SERVER['SERVER_PORT']) . config_line($lang->def('_SERVER_NAME'), $_SERVER['SERVER_NAME']) . config_line($lang->def('_SERVER_ADMIN'), $_SERVER['SERVER_ADMIN']) . config_line($lang->def('_SERVER_SOFTWARE'), $_SERVER['SERVER_SOFTWARE']) . '<br />' . '<div class="conf_line_title">' . $lang->def('_SERVER_MYSQL') . '</div>' . config_line($lang->def('_MYSQL_VERS'), mysql_get_server_info()) . '<br />' . '<div class="conf_line_title">' . $lang->def('_PHPINFO') . '</div>' . config_line($lang->def('_PHPVERSION'), phpversion()) . config_line($lang->def('_SAFEMODE'), $php_conf['safe_mode']['local_value'] ? $lang->def('_ON') : $lang->def('_OFF')) . config_line($lang->def('_REGISTER_GLOBAL'), $php_conf['register_globals']['local_value'] ? $lang->def('_ON') : $lang->def('_OFF')) . config_line($lang->def('_MAGIC_QUOTES_GPC'), $php_conf['magic_quotes_gpc']['local_value'] ? $lang->def('_ON') : $lang->def('_OFF')) . config_line($lang->def('_UPLOAD_MAX_FILESIZE'), $php_conf['upload_max_filesize']['local_value']) . config_line($lang->def('_POST_MAX_SIZE'), $php_conf['post_max_size']['local_value']) . config_line($lang->def('_MAX_EXECUTION_TIME'), $php_conf['max_execution_time']['local_value'] . 's') . config_line($lang->def('_LDAP'), extension_loaded('ldap') ? $lang->def('_ON') : '<span class="font_red">' . $lang->def('_OFF') . ' ' . $lang->def('_USEFULL_ONLY_IF') . '</span>') . config_line($lang->def('_PHP_TIMEZONE'), @date_default_timezone_get());
     if (version_compare(phpversion(), "5.0.0") == -1) {
         echo config_line($lang->def('_DOMXML'), extension_loaded('domxml') ? $lang->def('_ON') : '<span class="font_red">' . $lang->def('_OFF') . ' (' . $lang->def('_NOTSCORM') . ')</span>');
     }
     if (version_compare(phpversion(), "5.2.0", ">")) {
         echo config_line($lang->def('_ALLOW_URL_INCLUDE'), $php_conf['allow_url_include']['local_value'] ? '<span class="font_red">' . $lang->def('_ON') . '</span>' : $lang->def('_OFF'));
     }
     if (Get::cfg('uploadType') == 'ftp') {
         if (function_exists("ftp_connect")) {
             require_once _base_ . '/lib/lib.upload.php';
             $re_con = sl_open_fileoperations();
             echo config_line($lang->def('_UPLOADFTP'), $re_con ? $lang->def('_FTPOK') : '<span class="font_red">' . $lang->def('_FTPERR') . '</span>');
             if ($re_con) {
                 sl_close_fileoperations();
             }
         } else {
             echo config_line($lang->def('_UPLOADFTP'), '<span class="font_red">' . $lang->def('_FTPERR') . '</span>');
         }
     }
     echo '<div class="nofloat"></div><br />';
     return $html;
 }
Beispiel #3
0
function groupCodeList()
{
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.table.php';
    $lang =& DoceboLanguage::createInstance('code');
    $code_manager = new CodeManager();
    $tot_group_code = $code_manager->getCodeGroupNumber();
    cout(getTitleArea($lang->def('_CODE')) . '<div class="std_block">');
    $result = Get::req('result', DOTY_STRING, '');
    if (isset($_GET['activation'])) {
        $query = "UPDATE " . $GLOBALS['prefix_fw'] . "_setting" . " SET param_value = 'on'" . " WHERE param_name = 'use_code_module'";
        if (sql_query($query)) {
            Util::jump_to('index.php?modname=code&amp;op=list&result=ok');
        } else {
            Util::jump_to('index.php?modname=code&amp;op=list&result=err');
        }
    }
    if (Get::cfg('use_code_module') === 'off') {
        cout(getResultUi('<a href="index.php?modname=code&amp;op=list&amp;activation=true">' . $lang->def('_MODULE_NOT_ACTIVATED') . '</a>'));
    }
    switch ($result) {
        case 'ok':
            UIFeedback::info($lang->def('_OPERATION_SUCCESSFUL'));
            break;
        case 'err':
            UIFeedback::error($lang->def('_OPERATION_FAILURE'));
            break;
    }
    if ($tot_group_code) {
        $tb = new Table('20');
        $tb->initNavBar('ini', 'link');
        $ini = $tb->getSelectedElement();
        $cont_h = array($lang->def('_TITLE'), $lang->def('_DESCRIPTION'), $lang->def('_CODE_USED_NUMBER'), Get::sprite('subs_csv', Lang::t('_CODE', 'course')), Get::sprite('subs_add', Lang::t('_GENERATE_CODE', 'course')), Get::sprite('subs_import', Lang::t('_IMPORT', 'course')), Get::sprite('subs_elem', Lang::t('_COURSES', 'course')), Get::sprite('subs_users', Lang::t('_ASSIGN_USERS', 'course')), Get::sprite('subs_mod', Lang::t('_MOD', 'course')), Get::sprite('subs_del', Lang::t('_DEL', 'course')));
        $type_h = array('', '', 'min-cell', 'image', 'image', 'image', 'image', 'image', 'image', 'image');
        $tb->setColsStyle($type_h);
        $tb->addHead($cont_h);
        $array_group_code = $code_manager->getCodeGroupsList($ini);
        foreach ($array_group_code as $group_code_info) {
            $cont = array();
            $cont[] = $group_code_info['title'];
            $cont[] = $group_code_info['description'];
            $cont[] = $group_code_info['code_used'];
            $cont[] = '<a href="index.php?modname=code&amp;op=code_list&amp;id_code_group=' . $group_code_info['id_code_group'] . '">' . Get::sprite('subs_csv', Lang::t('_CODE', 'course')) . '</a>';
            $cont[] = '<a href="index.php?modname=code&amp;op=generate_code&amp;id_code_group=' . $group_code_info['id_code_group'] . '">' . Get::sprite('subs_add', Lang::t('_GENERATE_CODE', 'course')) . '</a>';
            $cont[] = '<a href="index.php?modname=code&amp;op=import_code&amp;id_code_group=' . $group_code_info['id_code_group'] . '">' . Get::sprite('subs_import', Lang::t('_IMPORT', 'course')) . '</a>';
            $cont[] = '<a href="index.php?modname=code&amp;op=assign_course&amp;id_code_group=' . $group_code_info['id_code_group'] . '">' . Get::sprite('subs_elem' . ($group_code_info['course_associated'] ? '' : '_grey'), Lang::t('_COURSES', 'course')) . '</a>';
            $cont[] = '<a href="index.php?modname=code&amp;op=assign_tree&amp;id_code_group=' . $group_code_info['id_code_group'] . '">' . Get::sprite('subs_users' . ($group_code_info['folder_associated'] ? '' : '_grey'), Lang::t('_ASSIGN_USERS', 'course')) . '</a>';
            $cont[] = '<a href="index.php?modname=code&amp;op=mod_group_code&amp;id_code_group=' . $group_code_info['id_code_group'] . '">' . Get::sprite('subs_mod', Lang::t('_MOD', 'course')) . '</a>';
            $cont[] = '<a href="index.php?modname=code&amp;op=del_group_code&amp;id_code_group=' . $group_code_info['id_code_group'] . '">' . Get::sprite('subs_del', Lang::t('_DEL', 'course')) . '</a>';
            $tb->addBody($cont);
        }
        $tb->addActionAdd('<a href="index.php?modname=code&amp;op=add_group_code">' . '<img src="' . getPathImage() . 'standard/add.png" alt="' . $lang->def('_ADD') . '" />' . $lang->def('_ADD') . '</a>');
        cout($tb->getTable() . $tb->getNavBar($ini, $tot_group_code));
        setupHrefDialogBox('a[href*=del_group_code]');
    } else {
        cout($lang->def('_NO_CONTENT') . '<br/>' . '<a href="index.php?modname=code&amp;op=add_group_code">' . '<img src="' . getPathImage() . 'standard/add.png" alt="' . $lang->def('_ADD') . '" />' . $lang->def('_ADD') . '</a>');
    }
    cout('</div>');
}
Beispiel #4
0
 function loadBody()
 {
     if (file_exists(_base_ . '/customscripts/' . _folder_lms_ . '/admin/modules/' . $this->module_name . '/' . $this->module_name . '.php') && Get::cfg('enable_customscripts', false) == true) {
         require_once _base_ . '/customscripts/' . _folder_lms_ . '/admin/modules/' . $this->module_name . '/' . $this->module_name . '.php';
     } else {
         require_once _base_ . '/' . _folder_lms_ . '/admin/modules/' . $this->module_name . '/' . $this->module_name . '.php';
     }
     reportDispatch($GLOBALS['op']);
 }
Beispiel #5
0
 public function run()
 {
     if (Get::cfg('do_debug')) {
         $this->div = !empty($this->div) ? $this->div : 'yui_log_container';
         $this->render('yuilog', array('div' => $this->div));
     } else {
         $this->render('yuilog_off');
     }
 }
 /**
  * Singleton class, the constructor is private
  */
 private function __construct()
 {
     $loader = new Twig_Loader_Filesystem();
     $this->twig = new Twig_Environment($loader, array('cache' => _files_ . '/tmp', 'debug' => Get::cfg('twig_debug', false)));
     $this->twig->addFunction('translate', new Twig_Function_Function(function ($key, $module = false, $substitution = array(), $lang_code = false, $default = false) {
         return Lang::t($key, $module, $substitution, $lang_code, $default);
     }));
     $this->twig->addFunction('pluginUrl', new Twig_Function_Function(function ($resource) {
         $plugin_files = PluginManager::find_files();
         return '/' . _folder_plugins_ . '/' . $plugin_files[$resource] . '/' . $resource;
     }));
 }
Beispiel #7
0
 /**
  * Initialize the caching mechanism
  */
 public function init()
 {
     Log::add("Initializing memcache.");
     $cfg = Get::cfg('cache');
     $this->_cache = new Memcache();
     foreach ($cfg['servers'] as $server) {
         $this->_cache->addServer($server['host'], $server['port'], $server['persistent'], $server['weight']);
     }
     if ($cfg['compressed']) {
         $this->compressed = true;
     }
 }
 public function set_timezone()
 {
     // set connection timezone according to php settings
     if (Get::cfg('set_mysql_tz', false)) {
         $dt = new DateTime();
         $offset = $dt->format("P");
         // get current timezone offeset
         $this->query("SET time_zone='" . $offset . "'");
         $this->log('mysql set connection timezone offset to : ' . $offset);
     }
     return true;
 }
 public function showTask()
 {
     if (!Get::cfg('enable_plugins', false)) {
         cout("Plugin feature disabled");
         return;
     }
     $model = new PluginAdm();
     $plugins = $model->getInstalledPlugins();
     $plugins_info = $model->getPluginsInfo($plugins);
     $active_tab = $_GET['active_tab'];
     $this->render('show', array('model' => $model, 'plugins' => $plugins, 'active_tab' => $active_tab, 'plugins_info' => $plugins_info));
 }
Beispiel #10
0
 public static function mod_rewrite()
 {
     if (Get::cfg('use_mod_rewrite', '') == "on") {
         $base = Get::sett('url');
         if (preg_match("/127.0.0.1/", $base)) {
             $base = preg_replace("/127.0.0.1[^\\d\\/][:]?([^\\/]*)/", $_SERVER["HTTP_HOST"], $base);
         }
         if (preg_match("/" . $_SERVER["HTTP_HOST"] . "/", $base)) {
             return '<base href="' . $base . '" />' . "\n";
         }
     }
 }
Beispiel #11
0
function view_area()
{
    checkPerm('view');
    require_once _lms_ . '/lib/lib.middlearea.php';
    $lang =& DoceboLanguage::createInstance('middlearea', 'lms');
    $lc =& DoceboLanguage::createInstance('menu_course', 'lms');
    $query_menu = "SELECT mo.idModule, mo.default_name, under.my_name\r\n\tFROM %lms_module AS mo\r\n\t\tJOIN %lms_menucourse_under AS under\r\n\tWHERE mo.idModule = under.idModule\r\n\t\tAND mo.module_info IN ('all','user')\r\n\t\tAND mvc_path <> 'elearning/show'\r\n\tORDER BY under.sequence";
    $re_menu_voice = sql_query($query_menu);
    $base_url = 'index.php?modname=middlearea&amp;op=select_permission&amp;load=1&amp;obj_index=';
    $second_url = 'index.php?modname=middlearea&amp;op=switch_active&amp;obj_index=';
    $ma = new Man_MiddleArea();
    $disabled_list = $ma->getDisabledList();
    // Main men
    $main_menu = '';
    while (list($id_m, $default_name, $my_name) = sql_fetch_row($re_menu_voice)) {
        $main_menu .= '<li>' . '<span>' . Lang::t($default_name, 'menu_over', false, false, $default_name) . '</span>' . ' <a class="ico-sprite subs_users" href="' . $base_url . 'mo_' . $id_m . '"><span>' . Lang::t('_VIEW_PERMISSION', 'standard') . '</span></a>' . ' <a class="ico-sprite subs_' . (isset($disabled_list['mo_' . $id_m]) ? 'noac' : 'actv') . '" href="' . $second_url . 'mo_' . $id_m . '"><span>' . Lang::t('_ENABLE_AREA', 'middlearea') . '</span></a>' . '</li>';
    }
    $main_menu .= '<li>' . '<span>' . Lang::t('_MESSAGES', 'menu_over') . '</span>' . ' <a class="ico-sprite subs_users" href="' . $base_url . 'mo_message' . '"><span>' . Lang::t('_VIEW_PERMISSION', 'standard') . '</span></a>' . ' <a class="ico-sprite subs_' . (isset($disabled_list['mo_message']) ? 'noac' : 'actv') . '" href="' . $second_url . 'mo_message' . '"><span>' . Lang::t('_ENABLE_AREA', 'middlearea') . '</span></a>' . '</li>';
    $main_menu .= '<li>' . '<span>' . Lang::t('_CUSTOMER_HELP', 'customer_help') . '</span>' . ' <a class="ico-sprite subs_users" href="' . $base_url . 'mo_help' . '"><span>' . Lang::t('_VIEW_PERMISSION', 'standard') . '</span></a>' . ' <a class="ico-sprite subs_' . (isset($disabled_list['mo_help']) ? 'noac' : 'actv') . '" href="' . $second_url . 'mo_help' . '"><span>' . Lang::t('_ENABLE_AREA', 'middlearea') . '</span></a>' . '</li>';
    // Tab list
    $tab_list = '';
    $tab = array('tb_elearning' => Lang::t('_ELEARNING', 'middlearea'), 'tb_home' => Lang::t('_HOME', 'middlearea'), 'tb_label' => Lang::t('_LABELS', 'label'), 'tb_classroom' => Lang::t('_CLASSROOM', 'middlearea'), 'tb_catalog' => Lang::t('_CATALOGUE', 'middlearea'), 'tb_assessment' => Lang::t('_ASSESSMENT', 'middlearea'), 'tb_coursepath' => Lang::t('_COURSEPATH', 'coursepath'), 'tb_games' => Lang::t('_CONTEST', 'middlearea'), 'tb_communication' => Lang::t('_COMMUNICATIONS', 'middlearea'), 'tb_videoconference' => Lang::t('_VIDEOCONFERENCE', 'middlearea'), 'tb_kb' => Lang::t('_CONTENT_LIBRARY', 'middlearea'));
    if (Get::cfg('enable_plugins', false)) {
        require_once _adm_ . "/models/PluginAdm.php";
        $pluginAdm = new PluginAdm();
        $plugins = $pluginAdm->getInstalledPlugins();
        foreach ($plugins as $plugin_name) {
            $tab["tb_" . strtolower($plugin_name)] = ucfirst($plugin_name);
        }
    }
    $query_menu = "SELECT obj_index from %lms_middlearea where obj_index like 'tb_%' ORDER BY sequence";
    $re_tablist = sql_query($query_menu);
    while (list($obj_index) = sql_fetch_row($re_tablist)) {
        $id = $obj_index;
        $name = $tab[$id];
        $tab_list .= '<li id="' . $id . '">' . '<span>' . $name . '</span>' . ' <a class="ico-sprite subs_users" href="' . $base_url . $id . '"><span>' . Lang::t('_VIEW_PERMISSION', 'standard') . '</span></a>' . ' <a class="ico-sprite subs_' . (isset($disabled_list[$id]) ? 'noac' : 'actv') . '" href="' . $second_url . $id . '"><span>' . Lang::t('_ENABLE_AREA', 'middlearea') . '</span></a>' . '</li>';
    }
    // Block List
    $block_list = '';
    $block = array('user_details_full' => Lang::t('_PROFILE', 'profile'), 'credits' => Lang::t('_CREDITS', 'middlearea'), 'career' => Lang::t('_CAREER', 'middlearea'), 'course' => Lang::t('_SUBSCRIBE_COURSE', 'middlearea'), 'news' => Lang::t('_NEWS', 'middlearea'));
    while (list($id, $name) = each($block)) {
        $block_list .= '<div class="direct_block">' . '<span>' . $name . '</span>' . ' <a class="ico-sprite subs_users" href="' . $base_url . $id . '"><span>' . Lang::t('_VIEW_PERMISSION', 'standard') . '</span></a>' . ' <a class="ico-sprite subs_' . (isset($disabled_list[$id]) ? 'noac' : 'actv') . '" href="' . $second_url . $id . '"><span>' . Lang::t('_ENABLE_AREA', 'middlearea') . '</span></a>' . '</div><br/>';
    }
    cout(getTitleArea($lang->def('_MIDDLE_AREA'), 'middlearea') . '<div class="std_block">');
    cout('<h2>' . Lang::t('_MAN_MENU', 'menu') . '</h2>' . '<ul class="action-list">' . $main_menu . '</ul>');
    cout('<div id="lms_main_container" class="yui-t5">' . '<div class="yui-b">' . '<h2>' . Lang::t('_BLOCKS', 'middlearea') . '</h2>' . $block_list . '</div>' . '<div id="yui-main">' . '<div class="yui-b" id="tablist">' . '<h2>' . Lang::t('_TABS', 'middlearea') . '</h2>' . '<ul class="action-list">' . $tab_list . '</ul>' . '</div>' . '</div>' . '<div class="nofloat"></div>' . '</div>');
    cout('</div>');
    $js = "\r\n\t<script src=\"http://yui.yahooapis.com/3.9.1/build/yui/yui-min.js\"></script>\r\n\t<script>\r\n\tYUI().use('sortable', function (Y) {\r\n\t    var sortable;\r\n\t    sortable = new Y.Sortable({\r\n\t        container: '#tablist ul',\r\n\t        nodes    : 'li',\r\n\t        opacity  : '0.1'\r\n\t    });\r\n\r\n        sortable.delegate.after('drag:end', function (e) {\r\n\t        var node = sortable.delegate.get('currentNode');\r\n\r\n\t            // rewind\r\n\t            while(node.previous()) {\r\n\t            \tnode = node.previous();\r\n}\r\n\t            // ciclo\r\n\t            a = node.get('id');\r\n\t            while(node.next()) {\r\n\t            \tnode = node.next();\r\n\t            \ta += ','+node.get('id');\r\n\t            }\r\n\r\n\t            sUrl = 'ajax.adm_server.php?r=middlearea/order&list='+a;\r\n\r\n\t\t        var callback = {\r\n\t\t                success: function(o) {\r\n\t\t                },\r\n\t\t                failure:function(o) {\r\n\t\t                }\r\n\t\t        };\r\n\t\t        YAHOO.util.Connect.asyncRequest('GET', sUrl, callback);\r\n\r\n\r\n\t    });\r\n    });\r\n\r\n\r\n    </script>";
    cout($js);
}
Beispiel #12
0
function createLOTrackShort($idReference, $idUser, $back_url)
{
    $query = "SELECT o.idParam, o.objectType, o.idResource," . " ct.idTrack, lt.classNameTrack, lt.fileNameTrack" . " FROM %lms_organization o" . " JOIN %lms_commontrack ct" . " JOIN %lms_lo_types lt" . " WHERE (o.objectType = lt.objectType)" . "   AND (o.idOrg = ct.idReference)" . "   AND (o.idOrg = '" . (int) $idReference . "')" . "   AND (ct.idUser = '******')";
    $rs = sql_query($query);
    list($idParams, $objectType, $idResource, $idTrack, $className, $fileName) = sql_fetch_row($rs);
    if (trim($fileName) == '') {
        return false;
    }
    require_once dirname(__FILE__) . '/../class.module/learning.object.php';
    if (file_exists(_base_ . '/customscripts/' . _folder_lms_ . '/class.module/' . $fileName) && Get::cfg('enable_customscripts', false) == true) {
        require_once _base_ . '/customscripts/' . _folder_lms_ . '/class.module/' . $fileName;
    } else {
        require_once dirname(__FILE__) . '/../class.module/' . $fileName;
    }
    $lo = new $className($idTrack, $idResource, $idParams, $back_url);
    return $lo;
}
Beispiel #13
0
 /**
  * Parse a quer in search for %type and replace the term founded with the
  * data passed formatting and validating the data
  * accpted tags are (
  * 	%% = %
  * 	%NULL = NULL value
  * 	%autoinc = autoincrement generate index
  *  %i = integer
  *  %f = float
  *  %d = double
  *  %date = date in iso format yyyy-mm-dd hh:mm:ss
  *  %text = string
  *  $s = string
  * @return
  * @param $query Object
  * @param $data Array[optional]
  */
 public function parse_query($query, $data = false)
 {
     if ($data == false) {
         $data = array();
     }
     $parsed_query = false;
     $keys = preg_split("/%adm_|%cms_|%lms_|%scs_/i", $query, '-1', PREG_SPLIT_OFFSET_CAPTURE);
     // %NULL|%autoinc|%i|%double|%date|%text|%s|
     if ($keys) {
         $current = 0;
         $parsed_query = '';
         while (list($ind, $match) = each($keys)) {
             $parsed_query .= $match[0];
             //rerive the match
             $str_start = $match[1] + strlen($match[0]);
             if (isset($keys[$ind + 1])) {
                 $type = substr($query, $str_start, $keys[$ind + 1][1] - $str_start);
             } else {
                 $type = '%last';
             }
             if (!isset($data[$current])) {
                 $data[$current] = '';
             }
             switch ($type) {
                 // manage table prefix ==================================
                 case "%adm_":
                     $parsed_query .= Get::cfg('prefix_fw') . '_';
                     break;
                 case "%lms_":
                     $parsed_query .= Get::cfg('prefix_lms') . '_';
                     break;
                 case "%cms_":
                     $parsed_query .= Get::cfg('prefix_cms') . '_';
                     break;
                 case "%scs_":
                     $parsed_query .= Get::cfg('prefix_scs') . '_';
                     break;
                     // select by type =======================================
                     /*
                     case "%%" : {
                     	//not used
                     	$parsed_query .= '%';
                     };break;
                     case "%NULL" : {
                     	$parsed_query .= $this->get_null();
                     };break;
                     case "%autoinc" : {
                     	$parsed_query .= $this->get_null();
                     };break;
                     case "%i" : {
                     	$parsed_query .= (int)$data[$current];
                     };break;
                     case "%f" : {
                     	$parsed_query .= (float)$data[$current];
                     };break;
                     case "%double" : {
                     	$parsed_query .= (double)$data[$current];
                     };break;
                     case "%date" : {
                     	//is in iso format ?
                     	$check = preg_match("/[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}/", $data[$current]);
                     	if($check == false) $data[$current] = '0000-00-00 00:00:00';
                     };
                     case "%text" :
                     case "%s" : {
                     	$parsed_query .= "".$this->escape($data[$current])."";
                     };break;
                     */
             }
             ++$current;
         }
     } else {
         return $query;
     }
     return $parsed_query;
 }
Beispiel #14
0
 /**
  * Create a new connector of requested type
  * @param string $type the type of the required connector
  * @return DoceboConnector the requeste connector
  * @access public
  **/
 function create_connector_bytype($type)
 {
     $arr_conn = $this->get_connector_bytype($type);
     if ($arr_conn === FALSE) {
         return FALSE;
     }
     require_once $GLOBALS['where_framework'] . '/lib/connectors/lib.connector.php';
     if (file_exists(_base_ . '/customscripts' . '/' . _folder_adm_ . '/lib/connectors/' . $arr_conn[CONNMGR_CONNTYPE_FILE]) && Get::cfg('enable_customscripts', false) == true) {
         require_once _base_ . '/customscripts' . '/' . _folder_adm_ . '/lib/connectors/' . $arr_conn[CONNMGR_CONNTYPE_FILE];
     } else {
         require_once $GLOBALS['where_framework'] . '/lib/connectors/' . $arr_conn[CONNMGR_CONNTYPE_FILE];
     }
     return eval('return new ' . $arr_conn[CONNMGR_CONNTYPE_CLASS] . '(NULL);');
 }
 function loadBody()
 {
     //EFFECTS: include module language and module main file
     //include($GLOBALS['where_lms'].'/modules/'.$this->module_name.'/'.$this->module_name.'.php');
     if (file_exists(_base_ . '/customscripts/' . _folder_lms_ . '/modules/' . $this->module_name . '/' . $this->module_name . '.php') && Get::cfg('enable_customscripts', false) == true) {
         include Docebo::inc(_base_ . '/customscripts/' . _folder_lms_ . '/modules/' . $this->module_name . '/' . $this->module_name . '.php');
     } else {
         include Docebo::inc(_lms_ . '/modules/' . $this->module_name . '/' . $this->module_name . '.php');
     }
 }
Beispiel #16
0
                    }
                } else {
                    // user is already logged in, so connect the account with user
                    $social->connectAccount('linkedin', $user_data['id']);
                    Util::jump_to('index.php?r=lms/elearning/show');
                    die;
                }
            } else {
                Util::jump_to('index.php?access_fail=3');
            }
        } else {
            // !$sign_in
            Util::jump_to('index.php?access_fail=3');
        }
        die;
        break;
    case "google_login":
        if (Get::cfg('use_google_login_oauth2', true)) {
            include_once dirname(__FILE__) . '/login.google.oauth2.php';
        } else {
            include_once dirname(__FILE__) . '/login.google.openid.php';
        }
        break;
    default:
        if (Get::sett('home_course_catalogue') == 'on') {
            externalCourselist();
        } else {
            loadWebPage();
            loadNews();
        }
}
Beispiel #17
0
 /**
  * This method will render a specific view for this mvc
  * @param string $view_name the name of the view, must be equal to a php file inside the view folder for this mvc without the .php extension
  * @param array $data_for_view an array of data that will be passed to the view.
  * @param bool $return if true the rendering will be returned instead of printed as an echo
  * The view php scope will be the controller ($this) but you can pass data that will be extracted into the view scope. For example if you pass
  * array(
  *		'bar' => 'foo'
  * ) you will have a $bar var inside the view with the value setted to 'foo'
  */
 public function render($view_name, $data_for_view = false, $return = false)
 {
     if (is_array($data_for_view)) {
         extract($data_for_view, EXTR_SKIP);
     }
     $paths = array();
     $extensions = array();
     if (Get::cfg('enable_customscripts', false) == true) {
         $paths[] = $this->viewCustomscriptsPath();
     }
     $paths[] = $this->viewPath();
     $tplengine = Get::cfg('template_engine', array());
     foreach ($tplengine as $tplkey => $tpleng) {
         $extensions[$tplkey] = $tpleng['ext'];
     }
     $extensions['php'] = ".php";
     $extension = "";
     $path = "";
     $tplkey = "";
     foreach ($paths as $p) {
         foreach ($extensions as $k => $e) {
             $fullpath = $p . '/' . $this->_mvc_name . '/' . $view_name . $e;
             if (file_exists($fullpath)) {
                 $extension = $e;
                 $path = $p;
                 $tplkey = $k;
                 break;
             }
         }
         if ($extension != "") {
             break;
         }
     }
     switch ($tplkey) {
         case "php":
             include Docebo::inc($path . '/' . $this->_mvc_name . '/' . $view_name . $extension);
             break;
         case "twig":
             echo TwigManager::getInstance()->render($view_name . $extension, $data_for_view, $path . '/' . $this->_mvc_name);
             //$classname = 'TwigManager';
             //echo $classname::getInstance()->render($view_name.$extension, $data_for_view, $path. '/' . $this->_mvc_name);
             break;
         default:
             //die( 'FILENOTFOUND');
             include Docebo::inc($this->viewPath() . '/' . $this->_mvc_name . '/' . $view_name . $extension);
             break;
     }
     if ($return) {
         $content = ob_get_contents();
         @ob_clean();
         return $content;
     }
 }
Beispiel #18
0
<?php

defined("IN_FORMA") or die('Direct access is forbidden.');
/* ======================================================================== \
|   FORMA - The E-Learning Suite                                            |
|                                                                           |
|   Copyright (c) 2013 (Forma)                                              |
|   http://www.formalms.org                                                 |
|   License  http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt           |
|                                                                           |
|   from docebo 4.0.5 CE 2008-2012 (c) docebo                               |
|   License http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt            |
\ ======================================================================== */
/**
 * @author Davide Anceschi
 */
if (Get::cfg('enable_plugins', false)) {
    require_once $GLOBALS['where_scs'] . '/lib/lib.conference.1.3.plugins.php';
} else {
    require_once $GLOBALS['where_scs'] . '/lib/lib.conference.1.2.php';
}
Beispiel #19
0
 function loadActions()
 {
     $tree = '<div class="TreeViewActionContainer">';
     if ($this->canAdd()) {
         $tree .= '<img src="' . $this->_getAddImage() . '" alt="' . $this->_getAddAlt() . '" /> ' . '<input type="submit" class="TreeViewAction" value="' . $this->_getAddLabel() . '"' . ' name="' . $this->_getAddUrl() . '" />';
     }
     if ($this->canRename()) {
         $tree .= '<img src="' . $this->_getRenameImage() . '" alt="' . $this->_getRenameAlt() . '" /> ' . '<input type="submit" class="TreeViewAction" value="' . $this->_getRenameLabel() . '"' . ' name="' . $this->_getRenameUrl() . '" />';
     }
     if ($this->canMove()) {
         $tree .= '<img src="' . $this->_getMoveImage() . '" alt="' . $this->_getMoveAlt() . '" /> ' . '<input type="submit" class="TreeViewAction" value="' . $this->_getMoveLabel() . '"' . ' name="' . $this->_getMoveUrl() . '" />';
     }
     if ($this->canDelete() && !Get::cfg('demo_mode')) {
         $tree .= '<img src="' . $this->_getDeleteImage() . '" alt="' . $this->_getDeleteAlt() . '" /> ' . '<input type="submit" class="TreeViewAction" value="' . $this->_getDeleteLabel() . '"' . ' name="' . $this->_getDeleteUrl() . '" />';
     }
     $otherActions = $this->_getOtherActions();
     while (list($actId, $actLabel, $actImg) = current($otherActions)) {
         $tree .= '<img src="' . $actImg . '" alt="' . $actLabel . '" /> ' . '<input type="submit" class="TreeViewAction" value="' . $actLabel . '"' . ' name="' . $actId . '"';
         if (!is_numeric(key($otherActions))) {
             $tree .= ' id="' . key($otherActions) . '"';
         }
         $tree .= '/>';
         next($otherActions);
     }
     reset($otherActions);
     return $tree .= '</div>';
 }
Beispiel #20
0
/**
 * Definition of php magic __autoload() method
 * @param <string> $classname the classname that php are tring to istanciate
 * @return not used
 */
function docebo_autoload($classname)
{
    // purify the request
    $classname = preg_replace('/[^a-zA-Z0-9\\-\\_]+/', '', $classname);
    // fixed bases classes
    $fixed = array('Layout' => _lib_ . '/layout/lib.layout.php', 'CmsLayout' => _lib_ . '/layout/lib.cmslayout.php', 'LoginLayout' => _lib_ . '/layout/lib.loginlayout.php', 'Model' => _lib_ . '/mvc/lib.model.php', 'TreeModel' => _lib_ . '/mvc/lib.treemodel.php', 'Controller' => _lib_ . '/mvc/lib.controller.php', 'LmsController' => _lib_ . '/mvc/lib.lmscontroller.php', 'CmsController' => _lib_ . '/mvc/lib.cmscontroller.php', 'AdmController' => _lib_ . '/mvc/lib.admcontroller.php', 'AlmsController' => _lib_ . '/mvc/lib.almscontroller.php', 'AcmsController' => _lib_ . '/mvc/lib.acmscontroller.php', 'MobileController' => _lib_ . '/mvc/lib.mobilecontroller.php', 'LobjLmsController' => _lms_ . '/controllers/LobjLmsController.php', 'DbConn' => _base_ . '/db/lib.docebodb.php', 'Mysql_DbConn' => _base_ . '/db/drivers/docebodb.mysql.php', 'Mysqli_DbConn' => _base_ . '/db/drivers/docebodb.mysqli.php', 'Lang' => _i18n_ . '/lib.lang.php', 'DoceboLanguage' => _i18n_ . '/lib.lang.php', 'Format' => _i18n_ . '/lib.format.php', 'ICache' => _lib_ . '/cache/icache.php', 'DCache' => _lib_ . '/cache/dcache.php', 'DApcCache' => _lib_ . '/cache/dapccache.php', 'DDummyCache' => _lib_ . '/cache/ddummycache.php', 'DFileCache' => _lib_ . '/cache/dfilecache.php', 'DMemcache' => _lib_ . '/cache/dmemcache.php', 'Form' => _lib_ . '/lib.form.php', 'DForm' => _lib_ . '/forms/lib.dform.php', 'DoceboACL' => _lib_ . '/lib.acl.php', 'DoceboACLManager' => _lib_ . '/lib.aclmanager.php', 'Widget' => _base_ . '/widget/lib.widget.php', 'DoceboException' => _lib_ . '/error/doceboexception.php', 'MvcException' => _lib_ . '/error/mvcexception.php', 'Plugin' => _lib_ . '/lib.plugin.php', 'PluginManager' => _lib_ . '/lib.pluginmanager.php');
    $tplengine = Get::cfg('template_engine', array());
    foreach ($tplengine as $tplkey => $tpleng) {
        switch ($tplkey) {
            case 'twig':
                $fixed['TwigManager'] = _lib_ . '/lib.twigmanager.php';
                break;
            default:
                //$fixed[$tpleng['class']] = _lib_.'/'.$tpleng['lib'];
                break;
        }
    }
    if (Get::cfg('enable_plugins', false)) {
        $fixed['PluginController'] = _lib_ . '/mvc/lib.plugincontroller.php';
    }
    //search for a base class and include the file if found
    if (isset($fixed[$classname])) {
        if (file_exists($fixed[$classname])) {
            include_once $fixed[$classname];
        }
        return;
    }
    //possibile path for autoloading classes
    $path = array('adm' => array(_adm_ . '/models', _adm_ . '/controllers'), 'alms' => array(_lms_ . '/admin/models', _lms_ . '/admin/controllers'), 'lms' => array(_lms_ . '/models', _lms_ . '/controllers'), 'acms' => array(_cms_ . '/admin/models', _cms_ . '/admin/controllers'), 'cms' => array(_cms_ . '/models', _cms_ . '/controllers'), 'lobj' => array(_lms_ . '/models', _lms_ . '/controllers'));
    //possibile path for autoloading classes custom
    $pathCustomscripts = array('adm' => array(_base_ . '/customscripts' . '/' . _folder_adm_ . '/models', _base_ . '/customscripts' . '/' . _folder_adm_ . '/controllers'), 'alms' => array(_base_ . '/customscripts' . '/' . _folder_lms_ . '/admin/models', _base_ . '/customscripts' . '/' . _folder_lms_ . '/admin/controllers'), 'lms' => array(_base_ . '/customscripts' . '/' . _folder_lms_ . '/models', _base_ . '/customscripts' . '/' . _folder_lms_ . '/controllers'), 'acms' => array(_base_ . '/customscripts' . '/' . _folder_cms_ . '/admin/models', _base_ . '/customscripts' . '/' . _folder_cms_ . '/admin/controllers'), 'cms' => array(_base_ . '/customscripts' . '/' . _folder_cms_ . '/models', _base_ . '/customscripts' . '/' . _folder_cms_ . '/controllers'), 'lobj' => array(_base_ . '/customscripts' . '/' . _folder_lms_ . '/models', _base_ . '/customscripts' . '/' . _folder_lms_ . '/controllers'));
    //parse classname for info and path
    $location = array();
    if (preg_match('/(Mobile|Adm|Alms|Lms|Acms|Cms|Lobj)Controller$/', $classname, $location)) {
        // include controller file
        $loc = isset($location[1]) ? strtolower($location[1]) : 'adm';
        if (file_exists($pathCustomscripts[$loc][1] . '/' . $classname . '.php') && Get::cfg('enable_customscripts', false) == true) {
            $c_file = $pathCustomscripts[$loc][1] . '/' . $classname . '.php';
        } else {
            $c_file = $path[$loc][1] . '/' . $classname . '.php';
        }
        //if(file_exists($c_file))
        include_once Docebo::inc($c_file);
        return;
    } else {
        if (preg_match('/(Mobile|Adm|Alms|Lms|Acms|Cms|Lobj)$/', $classname, $location)) {
            // include model file
            $loc = isset($location[1]) ? strtolower($location[1]) : 'adm';
            if (file_exists($pathCustomscripts[$loc][0] . '/' . $classname . '.php') && Get::cfg('enable_customscripts', false) == true) {
                $c_file = $pathCustomscripts[$loc][0] . '/' . $classname . '.php';
            } else {
                $c_file = $path[$loc][0] . '/' . $classname . '.php';
            }
            //if(file_exists($c_file))
            include_once Docebo::inc($c_file);
            return;
        }
    }
    // manage widgets classnames
    if (preg_match('/(Widget)/', $classname, $location)) {
        $loc = _base_ . '/widget/' . strtolower(str_replace(array('WidgetController', 'Widget'), array('', ''), $classname));
        if (strpos($classname, 'Controller') !== false) {
            // include controller file
            $c_file = $loc . '/controller/' . $classname . '.php';
            if (file_exists($c_file)) {
                include_once Docebo::inc($c_file);
            }
            return;
        } else {
            //if(strpos($classname, 'Model') !== false) {
            // include model file
            $c_file = $loc . '/model/' . $classname . '.php';
            if (file_exists($c_file)) {
                include_once Docebo::inc($c_file);
            }
            return;
        }
    }
    // search for a standard filename in the library
    if (file_exists(_lib_ . '/lib.' . strtolower($classname) . '.php')) {
        if (!class_exists('Docebo', false)) {
            include_once _lib_ . '/lib.' . strtolower($classname) . '.php';
        } else {
            include_once Docebo::inc(_lib_ . '/lib.' . strtolower($classname) . '.php');
        }
        return;
    }
    // unable to autoload
}
Beispiel #21
0
 $nItem = $arrItemTrack['nDescendant'];
 if (!empty($GLOBALS['chapter'])) {
     $isshow_tree = 'false';
     $class_extension = '_hiddentree';
 } else {
     $isshow_tree = $nItem > 1 ? 'true' : 'false';
     $class_extension = $nItem > 1 ? '' : '_hiddentree';
 }
 $lms_base_url = 'http' . ((isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' or isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) == 'https' or isset($_SERVER['HTTP_FRONT_END_HTTPS']) && strtolower($_SERVER['HTTP_FRONT_END_HTTPS']) == 'on') ? 's' : '') . '://' . (isset($_SERVER['HTTP_X_FORWARDED_HOST']) ? $_SERVER['HTTP_X_FORWARDED_HOST'] : $_SERVER['HTTP_HOST']) . (strlen(dirname($_SERVER['SCRIPT_NAME'])) != 1 ? dirname($_SERVER['SCRIPT_NAME']) : '') . '/';
 $lms_url = $lms_base_url . $scormws;
 $xmlTreeUrl = $lms_base_url . $scormxmltree . '?idscorm_organization=' . $idscorm_organization . '&idReference=' . $idReference . '&environment=' . $environment;
 $imagesPath = getPathImage() . 'treeview/';
 // support for setting keepalive tmo
 $gc_maxlifetime = ini_get("session.gc_maxlifetime");
 // seconds
 $cfg_keepalivetmo = Get::cfg('keepalivetmo', 0);
 // minumum : 60 sec.
 if ($cfg_keepalivetmo > 0) {
     $keepalivetmo = $cfg_keepalivetmo;
 } else {
     if ($gc_maxlifetime > 15 * 60) {
         $keepalivetmo = 14 * 60;
     } else {
         if ($gc_maxlifetime >= 2 * 60) {
             $keepalivetmo = $gc_maxlifetime - 60;
         } else {
             $keepalivetmo = $gc_maxlifetime - 15;
             // second
         }
     }
 }
Beispiel #22
0
 /**
  * update a user
  * @param int $idst security token of user to update
  * @param string $userid the userid, complete or relative to actual context
  * @param string $firstname the first name
  * @param string $lastname the lastname
  * @param string $pass the password in clear text
  * @param string $email the email address
  * @param string $avatar the path of the avatar image
  * @param string $signature the signature
  * @param string $lastenter the date of the user last login
  * @return TRUE if success, FALSE otherwise
  */
 function updateUser($idst, $userid = FALSE, $firstname = FALSE, $lastname = FALSE, $pass = FALSE, $email = FALSE, $avatar = FALSE, $signature = FALSE, $lastenter = FALSE, $resume = FALSE, $force_change = '', $facebook_id = FALSE, $twitter_id = FALSE, $linkedin_id = FALSE, $google_id = FALSE)
 {
     $arrSET = array();
     if ($userid !== FALSE) {
         $arrSET['userid'] = $this->absoluteId($userid);
     }
     if ($firstname !== FALSE) {
         $arrSET['firstname'] = $firstname;
     }
     if ($lastname !== FALSE) {
         $arrSET['lastname'] = $lastname;
     }
     if ($pass !== FALSE && !Get::cfg('demo_mode')) {
         $arrSET['pass'] = $this->encrypt($pass);
         if (Get::sett('pass_max_time_valid') != 0) {
             $arrSET['pwd_expire_at'] = date("Y-m-d H:i:s", time() + Get::sett('pass_max_time_valid') * 24 * 3600);
         }
     }
     if ($email !== FALSE) {
         $arrSET['email'] = $email;
     }
     if ($avatar !== FALSE) {
         $arrSET['avatar'] = $avatar;
     }
     if ($facebook_id != FALSE && $facebook_id !== '') {
         $arrSET['facebook_id'] = $facebook_id;
     }
     if ($twitter_id != FALSE && $twitter_id !== '') {
         $arrSET['twitter_id'] = $twitter_id;
     }
     if ($linkedin_id != FALSE && $linkedin_id !== '') {
         $arrSET['linkedin_id'] = $linkedin_id;
     }
     if ($google_id != FALSE && $google_id !== '') {
         $arrSET['google_id'] = $google_id;
     }
     if ($signature !== FALSE) {
         $arrSET['signature'] = $signature;
     }
     if ($lastenter !== FALSE) {
         $arrSET['lastenter'] = $lastenter;
     }
     if ($resume) {
         $arrSET['valid'] = '1';
     }
     if ($force_change !== '') {
         $arrSET['force_change'] = (int) $force_change > 0 ? '1' : '0';
     }
     $colon = '';
     $query = "UPDATE " . $this->_getTableUser() . " SET ";
     foreach ($arrSET as $fieldName => $fieldValue) {
         $query .= $colon . $fieldName . "='" . $fieldValue . "'";
         $colon = ', ';
     }
     $query .= " WHERE idst = '" . (int) $idst . "'";
     $result = $this->_executeQuery($query);
     if ($result && $pass !== FALSE) {
         $query_h = "INSERT INTO " . $GLOBALS['prefix_fw'] . "_password_history ( idst_user, pwd_date, passw, changed_by ) " . "VALUES ( " . (int) $idst . ", '" . date("Y-m-d H:i:s") . "', '" . $this->encrypt($pass) . "'," . (int) getLogUserId() . "  )";
         $this->_executeQuery($query_h);
     }
     return $result;
 }
 function getPdf($html, $name, $img = false, $orientation = 'P', $download = true, $facs_simile = false, $for_saving = false)
 {
     require_once Docebo::inc(_base_ . '/lib/pdf/lib.pdf.php');
     $pdf = new PDF($orientation);
     $pdf->setEncrypted(Get::cfg('certificate_encryption', true));
     $pdf->setPassword(Get::cfg('certificate_password', null));
     if ($for_saving) {
         return $pdf->getPdf($html, $name, $img, $download, $facs_simile, $for_saving);
     } else {
         $pdf->getPdf($html, $name, $img, $download, $facs_simile, $for_saving);
     }
 }
Beispiel #24
0
	dynSelection: {},
	fieldList: <?php 
echo $fieldlist_js;
?>
,
	numVarFields: <?php 
echo $num_var_fields;
?>
,
	perms: {
		mod_user: <?php 
echo $permissions['mod_user'] ? 'true' : 'false';
?>
,
		del_user: <?php 
echo $permissions['del_user'] && !Get::cfg('demo_mode') ? 'true' : 'false';
?>
,
		associate_user: <?php 
echo $permissions['associate_user'] ? 'true' : 'false';
?>
	},
	langs: {
		_AREYOUSURE: "<?php 
echo Lang::t('_AREYOUSURE', 'standard');
?>
",
		_EXPORT_CSV: "<?php 
echo Lang::t('_EXPORT_CSV', 'admin_directory');
?>
",
Beispiel #25
0
 function delcatalogue()
 {
     checkPerm('mod');
     if (Get::cfg('demo_mode')) {
         die('Cannot delete catalogue during demo mode.');
     }
     $id_cat = Get::req('id', DOTY_INT, 0);
     if (Get::req('confirm', DOTY_INT, 0) == 1) {
         $re = true;
         $re = true;
         if (!sql_query("\r\n\t\tDELETE FROM " . $GLOBALS['prefix_lms'] . "_catalogue_member\r\n\t\tWHERE idCatalogue = '" . $id_cat . "'")) {
             Util::jump_to('index.php?modname=coursepath&op=pathlist&result=err');
         }
         if (!sql_query("\r\n\t\tDELETE FROM " . $GLOBALS['prefix_lms'] . "_catalogue_entry\r\n\t\tWHERE idCatalogue = '" . $id_cat . "'")) {
             Util::jump_to('index.php?modname=coursepath&op=pathlist&result=err');
         }
         if (!sql_query("\r\n\t\tDELETE FROM " . $GLOBALS['prefix_lms'] . "_catalogue\r\n\t\tWHERE idCatalogue = '" . $id_cat . "'")) {
             Util::jump_to('index.php?modname=coursepath&op=pathlist&result=err');
         }
         Util::jump_to('index.php?modname=catalogue&op=catlist&result=' . ($re ? 'ok' : 'err'));
     }
 }
Beispiel #26
0
<?php

Get::title(array('index.php?r=' . $base_link_course . '/show' => Lang::t('_COURSE', 'course'), Lang::t('_CLASSROOM', 'course') . ' : ' . $course_name));
?>
<div class="std_block">
<?php 
echo getBackUi('index.php?r=' . $base_link_course . '/show', Lang::t('_BACK', 'course'));
$_columns = array(array('key' => 'code', 'label' => Lang::t('_CODE', 'course'), 'sortable' => true), array('key' => 'name', 'label' => Lang::t('_NAME', 'course'), 'sortable' => true), array('key' => 'status', 'label' => Lang::t('_STATUS', 'course'), 'sortable' => true, 'formatter' => 'statusFormatter'), array('key' => 'date_begin', 'label' => Lang::t('_DATE_BEGIN', 'course'), 'sortable' => true), array('key' => 'date_end', 'label' => Lang::t('_DATE_END', 'course'), 'sortable' => true), array('key' => 'classroom', 'label' => Lang::t('_CLASSROOM', 'course')), array('key' => 'students', 'label' => Lang::t('_STUDENTS', 'coursereport'), 'className' => 'img-cell'));
if ($permissions['subscribe']) {
    $_columns[] = array('key' => 'subscription', 'label' => Get::sprite('subs_users', Lang::t('_SUBSCRIPTION', 'course')), 'className' => 'img-cell');
    Docebo::user()->preference->getAdminPreference('admin_rules.course_presence_admin') === 'on' && Docebo::user()->getUserLevelId() !== ADMIN_GROUP_GODADMIN || Docebo::user()->getUserLevelId() === ADMIN_GROUP_GODADMIN ? $_columns[] = array('key' => 'presence', 'label' => Lang::t('_ATTENDANCE', 'course'), 'className' => 'img-cell') : '';
}
if ($permissions['mod']) {
    $_columns[] = array('key' => 'mod', 'label' => Get::img('standard/edit.png', Lang::t('_MOD', 'course')), 'className' => 'img-cell');
}
if ($permissions['del'] && !Get::cfg('demo_mode')) {
    $_columns[] = array('key' => 'del', 'label' => Get::img('standard/delete.png', Lang::t('_DEL', 'course')), 'formatter' => 'doceboDelete', 'className' => 'img-cell');
}
$_params = array('id' => 'classroom_edition_table', 'ajaxUrl' => 'ajax.adm_server.php?r=' . $base_link_classroom . '/getclassroomedition&id_course=' . $model->getIdCourse() . '&', 'rowsPerPage' => Get::sett('visuItem', 25), 'startIndex' => 0, 'results' => Get::sett('visuItem', 25), 'sort' => 'name', 'dir' => 'asc', 'columns' => $_columns, 'fields' => array('id_date', 'code', 'name', 'status', 'date_begin', 'date_end', 'classroom', 'students', 'num_subscribe', 'subscription', 'presence', 'mod', 'del'), 'show' => 'table', 'editorSaveEvent' => '');
if ($permissions['add']) {
    $_params['rel_actions'] = '<a class="ico-wt-sprite subs_add" href="index.php?r=' . $base_link_classroom . '/addclassroom&amp;id_course=' . $model->getIdCourse() . '"><span>' . Lang::t('_ADD', 'subscribe') . '</span></a>';
}
$this->widget('table', $_params);
echo getBackUi('index.php?r=' . $base_link_course . '/show', Lang::t('_BACK', 'course'));
?>
</div>
<script type="text/javascript">
var StatusList = {
<?php 
$conds = array();
$list = $this->model->getStatusForDropdown();
 /**
  * This method execute the dispatch of the event on all the consumer related
  *	to the class of the event
  * @param DoceboEvent $event the event to be dispatched
  * @static
  * @access public
  **/
 function dispatch(&$event)
 {
     $arr_consumer = DoceboEventManager::listConsumerFromClassId($event->getClassId());
     foreach ($arr_consumer as $consumer_id => $consumer_param) {
         if (file_exists(_base_ . '/customscripts' . '/' . _folder_adm_ . $consumer_param[1]) && Get::cfg('enable_customscripts', false) == true) {
             require_once _base_ . '/customscripts' . '/' . _folder_adm_ . $consumer_param[1];
         } else {
             require_once $GLOBALS['where_framework'] . $consumer_param[1];
         }
         $consumer = eval("return new " . $consumer_param[0] . "(" . $consumer_id . ");");
         $consumer->actionEvent($event);
     }
 }
Beispiel #28
0
 /**
  * static public function for load user from login e password
  * @param string $login login of the user
  * @param string $password password of the user in clear text
  * @param string $prefix optional prefix for session publiciables
  * @return mixed DoceboUser instance of logged in user if success in login
  *				 FALSE otherwise
  **/
 public static function &createDoceboUserFromLogin($login, $password, $prefix = 'base', $new_lang = false)
 {
     if ($login == '') {
         $false_public = FALSE;
         return $false_public;
     }
     $user_manager = new DoceboACLManager();
     $user_info = $user_manager->getUser(false, $login);
     // first login
     $ret_value = false;
     if ($user_info === false) {
         return $ret_value;
     }
     if ($user_info[ACL_INFO_VALID] != '1') {
         return $ret_value;
     }
     if (Get::sett('ldap_used') == 'on') {
         if ($password == '') {
             $false_public = FALSE;
             return $false_public;
         }
         //connect to ldap server
         if (!($ldap_conn = @ldap_connect(Get::sett('ldap_server'), Get::sett('ldap_port', '389')))) {
             die("Could not connect to ldap server");
         }
         //bind on server
         $ldap_user = ereg_replace('\\$user', $login, Get::sett('ldap_user_string'));
         if (!@ldap_bind($ldap_conn, $ldap_user, $password)) {
             ldap_close($ldap_conn);
             // Edited by Claudio Redaelli
             if (Get::sett('ldap_alternate_check') == 'on') {
                 if ($user_info[ACL_INFO_PASS] != $user_manager->encrypt($password)) {
                     return $ret_value;
                 }
             } else {
                 $false_public = FALSE;
                 return $false_public;
             }
             // End edit
         }
         ldap_close($ldap_conn);
     } elseif ($user_info[ACL_INFO_PASS] != $user_manager->encrypt($password)) {
         return $ret_value;
     }
     unset($_SESSION[$prefix . "_idst"]);
     $du = new DoceboUser($login, $prefix);
     $_SESSION['last_enter'] = $user_info[ACL_INFO_LASTENTER];
     $du->setLastEnter(date("Y-m-d H:i:s"));
     $_SESSION['user_enter_mark'] = time();
     // language policy
     if (!$new_lang && isset($_SESSION['forced_lang'])) {
         $new_lang = Lang::get();
     }
     if ($new_lang != false) {
         $du->preference->setLanguage($new_lang);
     } else {
         if (!Get::cfg('demo_mode', false)) {
             Lang::set($du->preference->getLanguage());
         }
     }
     if (function_exists('session_regenerate_id')) {
         session_regenerate_id();
     }
     return $du;
 }
Beispiel #29
0
function &createLmsModule($module_name)
{
    $module_name = preg_replace('/[^a-zA-Z0-9\\-\\_]+/', '', $module_name);
    include_once _lms_ . '/class.module/class.definition.php';
    if (file_exists(_lms_ . '/class.module/class.' . $module_name . '.php')) {
        include_once _lms_ . '/class.module/class.' . $module_name . '.php';
        $class_name = 'Module_' . ucfirst($module_name);
    } else {
        $class_name = 'LmsModule';
    }
    if (Get::cfg('enable_plugins', false)) {
        if (checkIfPlugin($module_name) == "plugin") {
            include_once Get::rel_path('plugins') . '/' . $module_name . '/class/class.' . $module_name . '.php';
            $class_name = 'Module_' . ucfirst($module_name);
        }
    }
    $module_cfg = new $class_name();
    return $module_cfg;
}
Beispiel #30
0
 function SendMail($sender, &$recipients, &$subject, &$body, $attachments = false, $params = false)
 {
     if (Get::cfg('demo_mode')) {
         $this->ResetToDefault();
         return false;
     }
     //analyze params, can be a string or an associative array
     if (is_string($params)) {
         //parse string params (TO DO)
         //...
         $temp = $params;
         $params = array();
         //parse $temp ...
     } elseif (!is_array($params)) {
         $params = array();
     }
     //set properties, overwrite default props if  redefined in $params ...
     if (isset($params[MAIL_WORDWRAP])) {
         $conf_arr[MAIL_WORDWRAP] = $params[MAIL_WORDWRAP];
     }
     if (isset($params[MAIL_HTML])) {
         $conf_arr[MAIL_HTML] = $params[MAIL_HTML];
     }
     if (isset($params[MAIL_SINGLETO])) {
         $conf_arr[MAIL_SINGLETO] = $params[MAIL_SINGLETO];
     }
     $conf_arr[MAIL_SENDER_ACLNAME] = isset($params[MAIL_SENDER_ACLNAME]) ? $params[MAIL_SENDER_ACLNAME] : $this->default_conf[MAIL_SENDER_ACLNAME];
     $conf_arr[MAIL_RECIPIENT_ACLNAME] = isset($params[MAIL_RECIPIENT_ACLNAME]) ? $params[MAIL_RECIPIENT_ACLNAME] : $this->default_conf[MAIL_RECIPIENT_ACLNAME];
     $conf_arr[MAIL_REPLYTO_ACLNAME] = isset($params[MAIL_REPLYTO_ACLNAME]) ? $params[MAIL_REPLYTO_ACLNAME] : $this->default_conf[MAIL_REPLYTO_ACLNAME];
     $conf_arr[MAIL_MULTIMODE] = isset($params[MAIL_MULTIMODE]) ? $params[MAIL_MULTIMODE] : $this->default_conf[MAIL_MULTIMODE];
     if (isset($params[MAIL_CHARSET])) {
         $conf_arr[MAIL_CHARSET] = $params[MAIL_CHARSET];
     }
     if (isset($params[MAIL_REPLYTO])) {
         $conf_arr[MAIL_REPLYTO] = $params[MAIL_REPLYTO];
     }
     if (isset($params[MAIL_RECIPIENTSCC])) {
         $conf_arr[MAIL_RECIPIENTSCC] = $params[MAIL_RECIPIENTSCC];
     }
     if (isset($params[MAIL_RECIPIENTSBCC])) {
         $conf_arr[MAIL_RECIPIENTSBCC] = $params[MAIL_RECIPIENTSBCC];
     }
     $_sender = '';
     $_recipients = array();
     $_replyto = array();
     //$_attachments = array();
     //check each time because global configuration may have changed since last call
     $use_smtp = Get::cfg('use_smtp');
     if ($use_smtp == 'on') {
         $this->IsSMTP();
         $this->Hostname = Get::cfg('smtp_host');
         $this->Host = Get::cfg('smtp_host');
         if (Get::cfg('smtp_port', '') != '') {
             $this->Port = Get::cfg('smtp_port');
         }
         $smtp_user = Get::cfg('smtp_user');
         if (!empty($smtp_user)) {
             $this->Username = $smtp_user;
             $this->Password = Get::cfg('smtp_pwd');
             $this->SMTPAuth = true;
         } else {
             $this->SMTPAuth = false;
         }
         $this->SMTPSecure = Get::cfg('smtp_secure', '');
         // secure: '' , 'ssl', 'tsl'
         $this->SMTPDebug = Get::cfg('smtp_debug', 0);
         // debug level 0,1,2,3,...
     } else {
         $this->IsMail();
     }
     //configure sending address
     //----------------------------------------------------------------------------
     if (is_int($sender)) {
         // TODO: ??
         //idst
         //...
     } elseif (is_string($sender)) {
         //should check if $from is a valid email address with a regular expression
         $_sender = $sender;
     } else {
         //handle invalid recipient case
         //...
     }
     $this->From = $_sender;
     if ($conf_arr[MAIL_SENDER_ACLNAME]) {
         $temp = $this->acl_man->getUserByEmail($sender);
         $this->FromName = $temp[ACL_INFO_FIRSTNAME] . ' ' . $temp[ACL_INFO_LASTNAME];
     }
     //----------------------------------------------------------------------------
     //configure attachments
     //----------------------------------------------------------------------------
     if (is_string($attachments)) {
         //single attachment
         $this->addAttachment($attachments);
     } elseif (is_array($attachments)) {
         foreach ($attachments as $key => $value) {
             //maybe check if file exists, if necessary ...
             $this->addAttachment($value);
         }
     }
     //----------------------------------------------------------------------------
     //configure replyto(s)
     //----------------------------------------------------------------------------
     if (isset($conf_arr[MAIL_REPLYTO])) {
         //retrieve replyto(s) from params
         if (is_string($conf_arr[MAIL_REPLYTO])) {
             $_replyto[] = $conf_arr[MAIL_REPLYTO];
         } elseif (is_array($conf_arr[MAIL_REPLYTO])) {
             foreach ($conf_arr[MAIL_REPLYTO] as $key => $value) {
                 $_replyto[] = $value;
             }
         }
     }
     foreach ($_replyto as $key => $value) {
         if ($conf_arr[MAIL_REPLYTO_ACLNAME]) {
             $temp = $this->acl_man->getUserByEmail($value);
             $this->AddReplyTo($value, $temp[ACL_INFO_FIRSTNAME] . ' ' . $temp[ACL_INFO_LASTNAME]);
         } else {
             $this->AddReplyTo($value);
         }
     }
     //----------------------------------------------------------------------------
     if (isset($conf_arr[MAIL_CHARSET])) {
         $this->CharSet = $conf_arr[MAIL_CHARSET];
     }
     if (isset($conf_arr[MAIL_WORDWRAP])) {
         $this->WordWrap = $conf_arr[MAIL_WORDWRAP];
     }
     if (isset($conf_arr[MAIL_HTML])) {
         $this->IsHTML($conf_arr[MAIL_HTML]);
     }
     if (isset($conf_arr[MAIL_SINGLETO])) {
         $this->SingleTo = $conf_arr[MAIL_SINGLETO];
     }
     $this->Subject = $subject;
     $this->Body = $body;
     $this->AltBody = $this->ConvertToPlain_UTF8($body);
     //configure recipient(s) and send mail(s)
     //----------------------------------------------------------------------------
     if (is_string($recipients)) {
         $_recipients[] = $recipients;
     } elseif (is_array($recipients)) {
         //multiple sending ...
         foreach ($recipients as $key => $value) {
             $_recipients[] = $value;
         }
     } else {
         $this->ResetToDefault();
         return false;
     }
     foreach ($_recipients as $key => $value) {
         if ($conf_arr[MAIL_RECIPIENT_ACLNAME]) {
             $temp = $this->acl_man->getUserByEmail($value);
             $name = $temp[ACL_INFO_FIRSTNAME] . ' ' . $temp[ACL_INFO_LASTNAME];
         } else {
             $name = '';
         }
         switch ($conf_arr[MAIL_MULTIMODE]) {
             //case MAIL_CC     : if ($this->isValidAddress(Get::sett('send_cc_for_system_emails', ''))) $this->addCC(Get::sett('send_cc_for_system_emails')); break;//$this->AddCC($value,$name); break; //not supported yet
             case MAIL_CC:
                 $this->AddCC($value, $name);
                 break;
             case MAIL_BCC:
                 $this->AddBCC($value, $name);
                 break;
             case MAIL_SINGLE:
                 $this->AddAddress($value, $name);
                 break;
             default:
                 $this->AddAddress($value, $name);
                 break;
         }
         // MAIL_RECIPIENTSCC
         if (isset($conf_arr[MAIL_RECIPIENTSCC])) {
             $arr_mail_recipientscc = explode(' ', $conf_arr[MAIL_RECIPIENTSCC]);
             foreach ($arr_mail_recipientscc as &$user_mail_recipientscc) {
                 $this->addCC($user_mail_recipientscc);
             }
         }
         // MAIL_RECIPIENTSBCC
         if (isset($conf_arr[MAIL_RECIPIENTSBCC])) {
             $arr_mail_recipientsbcc = explode(' ', $conf_arr[MAIL_RECIPIENTSBCC]);
             foreach ($arr_mail_recipientsbcc as &$user_mail_recipientsbcc) {
                 $this->addBCC($user_mail_recipientsbcc);
             }
         }
         // if(Get::sett('send_cc_for_system_emails', '') !== '' && filter_var(Get::sett('send_cc_for_system_emails'), FILTER_VALIDATE_EMAIL) !== false){
         if (Get::sett('send_cc_for_system_emails', '') !== '') {
             $arr_cc_for_system_emails = explode(' ', Get::sett('send_cc_for_system_emails'));
             foreach ($arr_cc_for_system_emails as &$user_cc_for_system_emails) {
                 $this->addCC($user_cc_for_system_emails);
             }
         }
     }
     //----------------------------------------------------------------------------
     $output = $this->Send();
     //reset the class
     $this->ResetToDefault();
     return $output;
 }