function ChatBooking($module, $prefix = FALSE, $dbconn = NULL) { $this->prefix = $prefix !== FALSE ? $prefix : $GLOBALS["prefix_scs"]; $this->dbconn = $dbconn; $this->platform = Get::cur_plat(); $this->module = $module; }
function getCourseWikiTable($can_mod = FALSE, $wiki_list = FALSE) { $um =& UrlManager::getInstance(); // $course_id =$this->getCourseId(); $res = ""; if ($wiki_list === FALSE || !is_array($wiki_list)) { $wiki_list = $this->getCourseWikiList(); } $where = "wiki_id IN (" . implode(",", $wiki_list["list"]) . ")"; $source_platform = $this->getSourcePlatform(); $data_info = $this->wikiManager->getWikiList(FALSE, FALSE, $where, $source_platform); $data_arr = $data_info["data_arr"]; $db_tot = $data_info["data_tot"]; $tot = count($data_arr); for ($i = 0; $i < $tot; $i++) { $id = $data_arr[$i]["wiki_id"]; $rowcnt = array(); $rowcnt[] = $data_arr[$i]["title"]; $url = $um->getUrl("op=show&wiki_id=" . $id); $res .= '<div class="list_block">'; $res .= '<h2 class="heading"><a href="' . $url . '">' . $data_arr[$i]["title"] . '</a></h2>' . "\n"; $res .= '<p class="content">' . $data_arr[$i]["description"] . '</p>' . "\n"; if ($can_mod) { $res .= '<div class="actions">' . '<ul class="link_list_inline">' . "\n"; $url = $um->getUrl("op=editwiki&wiki_id=" . $id); $res .= '<li><a class="ico-wt-sprite subs_mod" href="' . $url . '">'; $res .= '<span>' . $this->lang->def("_MOD") . '</span></a></li>'; $url = $um->getUrl("op=setperm&wiki_id=" . $id); if ($data_arr[$i]["public"] == 1 && Get::cur_plat() != 'lms') { $res .= '<li><a class="ico-wt-sprite subs_users" href="' . $url . '">'; $res .= '<span>' . $this->lang->def("_ALT_SETPERM") . '</span></a></li>'; } if ($wiki_list["data"][$id]["is_owner"] == 1) { $url = $um->getUrl("op=delwiki&wiki_id=" . $id); $res .= '<li><a class="ico-wt-sprite subs_del" href="' . $url . '" title="' . $this->lang->def("_DEL") . ' : ' . strip_tags($data_arr[$i]["title"]) . '">'; $res .= '<span>' . $this->lang->def("_DEL") . '</span></a></li>'; } $res .= "</ul></div>"; } $res .= "</div>\n"; // wiki_box } if ($can_mod) { $res .= '<div class="table-container-below">'; $res .= '<ul class="link_list_inline">' . "\n"; $url = $um->getUrl("op=addwiki"); $res .= '<li><a class="ico-wt-sprite subs_add" href="' . $url . '">'; $res .= '<span>' . $this->lang->def("_ADD_WIKI") . '</span></a></li>'; $url = $um->getUrl("op=selectwiki"); $res .= '<li><a class="ico-wt-sprite subs_import" href="' . $url . '">'; $res .= '<span>' . $this->lang->def("_SELECT_WIKI") . '</span></a></li>'; $res .= "</ul>\n"; $res .= "</div>\n"; // table-container-below require_once _base_ . '/lib/lib.dialog.php'; setupHrefDialogBox('a[href*=delwiki]'); } return $res; }
function RoomPermissions($room_id, $module, $prefix = FALSE, $dbconn = NULL) { $this->prefix = $prefix !== FALSE ? $prefix : $GLOBALS["prefix_scs"]; $this->dbconn = $dbconn; $this->platform = Get::cur_plat(); $this->room_id = (int) $room_id; $this->module = $module; }
/** * This is the class constructor, set the default value for the varaible and instance * the class that it use * @param string $platform specified a different platform for localization * @param string $prefix specified a prefix * @param string $db_conn specified a db connection with the database */ function UserManager($platform = false, $prefix = false, $db_conn = false) { $this->_platform = $platform !== false ? $platform : Get::cur_plat(); $this->prefix = $prefix !== false ? $prefix : $GLOBALS['prefix_fw']; $this->db_conn = $db_conn !== false ? $db_conn : NULL; $this->_action = new UserManagerAction($prefix, $db_conn); $this->_render = new UserManagerRenderer(); $this->_option = new UserManagerOption(); $this->_time_before_reactive = 10 * 60; }
function dontReplaceBaseUrl($field_name, $req_admin = TRUE) { $res = FALSE; if (Docebo::user()->isAnonymous()) { return $res; } $level_id = Docebo::user()->getUserLevelId(); if ($req_admin && $level_id != ADMIN_GROUP_GODADMIN && $level_id != ADMIN_GROUP_ADMIN) { return $res; } $platform = Get::cur_plat(); $modname = Get::req('modname', DOTY_ALPHANUM, ""); $op = Get::req('op', DOTY_ALPHANUM, ""); $res = false; if (isset($GLOBALS['clean_url'][$platform . _sep_ . $modname . _sep_ . $op . _sep_ . $field_name])) { $res = TRUE; } return $res; }
if (Get::cfg('enable_plugins', false)) { PluginManager::initPlugins(); } // not a pagewriter but something similar $GLOBALS['operation_result'] = ''; if (!function_exists("aout")) { function aout($string) { $GLOBALS['operation_result'] .= $string; } } require_once _lms_ . '/lib/lib.permission.php'; // load the correct module $aj_file = ''; $mn = Get::req('mn', DOTY_ALPHANUM, ''); $plf = Get::req('plf', DOTY_ALPHANUM, $_SESSION['current_action_platform'] ? $_SESSION['current_action_platform'] : Get::cur_plat()); // New MVC structure if (isset($_GET['r'])) { $request = $_GET['r']; $r = explode('/', $request); $action = $r[1]; if (count($r) == 3) { // Position, class and method defined in the path requested $mvc = ucfirst(strtolower($r[1])) . ucfirst(strtolower($r[0])) . 'Controller'; $action = $r[2]; } else { // Only class and method defined in the path requested $mvc = '' . ucfirst(strtolower($r[0])) . 'AdmController'; $action = $r[1]; } ob_clean();
function addMediaPopupJS($src) { $res = ""; $sn = Get::cur_plat(); /* if ($sn != "framework") $src=$GLOBALS[$sn]["url"].$GLOBALS["where_files_relative"]."/".$src; else $src=$GLOBALS["url"].$GLOBALS["where_files_relative"]."/".$src; */ $path = (strlen(dirname($_SERVER['PHP_SELF'])) != 1 ? dirname($_SERVER['PHP_SELF']) : '') . '/'; $path .= $GLOBALS["where_files_relative"]; //."/"; //-- test : // //echo(cleanUrlPath("http://127.0.0.1:88/folder/folder/appCore//addons/./mod_media/../../../files/common/")); return 0; $site_url = "http://" . $_SERVER['HTTP_HOST'] . $path; $src = $site_url . $src; // $src=str_replace("//", "/", $src); switch ($GLOBALS["popup"]["editor"]) { case "fck": // ---------------------------------------- Fck Editor -------- $res .= addFckPopupJS($src); break; case "xinha": // -------------------------------------- Xinha ------------- $res .= addXinhaPopupJS($src); break; case "widgeditor": // --------------------------------- widgEditor -------- $res .= addWidgPopupJS($src); break; } $GLOBALS["page"]->add($res, "page_head"); }
/** * gui for user info management */ function getUserInfoModUi() { require_once _base_ . '/lib/lib.form.php'; require_once _base_ . '/lib/lib.preference.php'; $this->loadUserData($this->_user_profile->getIdUser()); $preference = new UserPreferences($this->_user_profile->getIdUser()); $html = '<div class="up_user_info">' . '<div class="up_name">' . $this->resolveUsername(false, $this->_user_profile->getIdUser()) . '</div>'; // user standard info ----------------------------------------------------------------- $html .= Form::openForm('mod_up', $this->_url_man->getUrl($this->_varname_action . '=saveinfo'), false, false, 'multipart/form-data'); if ($this->_user_profile->godMode()) { $html .= Form::getTextfield($this->_lang->def('_USERNAME'), 'up_userid', 'up_userid', '255', Get::req('up_userid', DOTY_MIXED, $this->acl_man->relativeId($this->user_info[ACL_INFO_USERID]), true)); } else { $html .= Form::getLineBox($this->_lang->def('_USERNAME'), $this->acl_man->relativeId($this->user_info[ACL_INFO_USERID])); } $html .= Form::getTextfield($this->_lang->def('_LASTNAME'), 'up_lastname', 'up_lastname', '255', Get::req('up_lastname', DOTY_MIXED, $this->user_info[ACL_INFO_LASTNAME], true)) . Form::getTextfield($this->_lang->def('_FIRSTNAME'), 'up_firstname', 'up_firstname', '255', Get::req('up_firstname', DOTY_MIXED, $this->user_info[ACL_INFO_FIRSTNAME], true)) . Form::getTextfield($this->_lang->def('_EMAIL'), 'up_email', 'up_email', '255', Get::req('up_email', DOTY_MIXED, $this->user_info[ACL_INFO_EMAIL], true)); // user extra field ------------------------------------------------------------------ $html .= $this->getPlayField(); $html .= $preference->getModifyMask('ui.'); if ($this->_user_profile->godMode()) { $acl_man =& Docebo::user()->getAclManager(); $html .= Form::getPassword(Lang::t('_NEW_PASSWORD', 'register'), 'up_new_pwd', 'up_new_pwd', '255'); $html .= Form::getPassword(Lang::t('_RETYPE_PASSWORD', 'register'), 'up_repeat_pwd', 'up_repeat_pwd', '255'); if (Docebo::user()->getUserLevelId() == ADMIN_GROUP_GODADMIN && Get::cur_plat() === 'framework') { $html .= Form::getCheckBox(Lang::t('_FORCE_PASSWORD_CHANGE', 'admin_directory'), 'force_changepwd', 'force_changepwd', 1, $this->user_info[ACL_INFO_FORCE_CHANGE]); } $lv_lang =& DoceboLanguage::createInstance('admin_directory', 'framework'); if (Docebo::user()->getUserLevelId() == ADMIN_GROUP_GODADMIN) { $level_list = array(ADMIN_GROUP_GODADMIN => $lv_lang->def('_DIRECTORY_' . ADMIN_GROUP_GODADMIN), ADMIN_GROUP_ADMIN => $lv_lang->def('_DIRECTORY_' . ADMIN_GROUP_ADMIN), ADMIN_GROUP_PUBLICADMIN => $lv_lang->def('_DIRECTORY_' . ADMIN_GROUP_PUBLICADMIN), ADMIN_GROUP_USER => $lv_lang->def('_DIRECTORY_' . ADMIN_GROUP_USER)); } else { $level_list = array(ADMIN_GROUP_USER => $lv_lang->def('_DIRECTORY_' . ADMIN_GROUP_USER)); } $html .= Form::getDropdown($this->_lang->def('_LEVEL'), 'up_level', 'up_level', $level_list, $acl_man->getUserLevelId($this->_user_profile->getIdUser())); } // Social ------------------------------------------------------------------ /* $html.=Form::getTextfield( $this->_lang->def('_FACEBOOK_ID'), 'facebook_id', 'facebook_id', '255', Get::req('facebook_id', DOTY_MIXED, $this->user_info[ACL_INFO_FACEBOOK_ID], true ) ); $html.=Form::getTextfield( $this->_lang->def('_TWITTER_ID'), 'twitter_id', 'twitter_id', '255', Get::req('twitter_id', DOTY_MIXED, $this->user_info[ACL_INFO_TWITTER_ID], true ) ); $html.=Form::getTextfield( $this->_lang->def('_LINKEDIN_ID'), 'linkedin_id', 'linkedin_id', '255', Get::req('linkedin_id', DOTY_MIXED, $this->user_info[ACL_INFO_LINKEDIN_ID], true ) ); $html.=Form::getTextfield( $this->_lang->def('_GOOGLE_ID'), 'google_id', 'google_id', '255', Get::req('google_id', DOTY_MIXED, $this->user_info[ACL_INFO_GOOGLE_ID], true ) ); */ //signature -------------------------------------------------------------------------- $html .= Form::getTextarea($this->_lang->def('_SIGNATURE'), 'up_signature', 'up_signature', Get::req('up_signature', DOTY_MIXED, $this->user_info[ACL_INFO_SIGNATURE], true)); if (isset($_GET['modname']) && $_GET['modname'] == 'reservation') { $html .= Form::openButtonSpace() . Form::getButton('save', 'save', $this->_lang->def('_SAVE')) . Form::getButton('undo_profile', 'undo_profile', $this->_lang->def('_UNDO')) . Form::closeButtonSpace(); $html .= Form::closeForm() . '</div>'; } else { $html .= Form::openButtonSpace() . Form::getButton('save', 'save', $this->_lang->def('_SAVE')) . Form::getButton('undo', 'undo', $this->_lang->def('_UNDO')) . Form::closeButtonSpace(); $html .= Form::closeForm() . '</div>'; } return $html; }
function loadGroupView() { $data = new GroupDataRetriever($GLOBALS['dbConn'], $GLOBALS['prefix_fw']); $rend = new Table(Get::sett('visuItem')); $lv = new GroupListView('', $data, $rend, 'groupdirectory'); $lv->aclManager =& $this->aclManager; $lv->selector_mode = $this->selector_mode; $lv->select_all = $this->select_all; $lv->deselect_all = $this->deselect_all; $lv->use_multi_sel = $this->use_multi_sel; $lv->sel_extend = $this->sel_extend; $lv->idModule = 'directory_selector'; if ($this->show_only_group_name === true) { $lv->showOnlyGroupName(true); } if (isset($this->group_filter['platform'])) { $data->addPlatformFilter($this->group_filter['platform']); } else { $data->addPlatformFilter(array(Get::cur_plat())); } if (isset($this->group_filter['group'])) { $data->addGroupFilter($this->group_filter['group']); } if (isset($this->group_filter['path'])) { $data->addPathFilter($this->group_filter['path']); } if ($this->selector_mode === FALSE) { $lv->setInsNew(TRUE); } $lv->parsePositionData($_POST); $lv->itemSelectedMulti = $this->selection; if ($lv->getOp() == 'newitem') { Util::jump_to('index.php?modname=directory&op=editgroup'); } elseif ($lv->getOp() == 'addtogroup') { Util::jump_to('index.php?modname=directory&op=addtogroup&groupid=' . $lv->getIdSelectedItem()); } elseif ($lv->getOp() == 'assignfield') { Util::jump_to('index.php?modname=directory&op=assignfield&groupid=' . $lv->getIdSelectedItem()); } elseif ($lv->getOp() == 'membersgroup') { Util::jump_to('index.php?modname=directory&op=membersgroup&groupid=' . $lv->getIdSelectedItem()); } elseif ($lv->getOp() == 'import_groupuser') { Util::jump_to('index.php?modname=directory&op=import_groupuser'); } elseif ($lv->getOp() == 'import_groupuser_2') { Util::jump_to('index.php?modname=directory&op=import_groupuser_2'); } elseif ($lv->getOp() == 'import_groupuser_3') { Util::jump_to('index.php?modname=directory&op=import_groupuser_3'); } elseif ($lv->getOp() == 'editgroup') { Util::jump_to('index.php?modname=directory&op=editgroup&groupid=' . $lv->getIdSelectedItem()); } elseif ($lv->getOp() == 'deletegroup') { Util::jump_to('index.php?modname=directory&op=deletegroup&groupid=' . $lv->getIdSelectedItem()); } elseif ($lv->getOp() == 'waitinggroup') { Util::jump_to('index.php?modname=directory&op=waitinggroup&groupid=' . $lv->getIdSelectedItem()); } else { if (!$this->selector_mode) { $GLOBALS['page']->add(getTitleArea($this->lang->def('_GROUPS'), 'directory_group'), 'content'); $GLOBALS['page']->add('<div class="std_block">', 'content'); $GLOBALS['page']->addEnd('</div>', 'content'); $GLOBALS['page']->add('<form id="dirctory_listgroup" action="index.php?modname=directory&op=listgroup" method="post">' . '<input type="hidden" id="authentic_request_listgroup" name="authentic_request" value="' . Util::getSignature() . '" />', 'content'); $GLOBALS['page']->addEnd('</form>', 'content'); } $GLOBALS['page']->add($lv->printOut(), 'content'); } }
/** * FeedReader constructor * @param string $pfm_prefix the prefix for the tables names * if not given global $prefix variable is used * @param resource $dbconn the connection to the database * if not given last connection will be used. */ function FeedGenerator($key1 = FALSE, $key2 = NULL, $platform = FALSE, $pfm_prefix = FALSE, $dbconn = NULL) { $this->prefix = $GLOBALS["prefix_cms"]; $this->dbConn = $dbconn; $this->lang =& DoceboLanguage::createInstance('feedmanager', "framework"); $this->feed_lang = getLanguage(); $this->key1 = $key1; $this->key2 = $key2; $this->platform = $platform !== FALSE ? $platform : Get::cur_plat(); }
/** * @return string the relative url of templates folder root */ function getRelativeBasePathTemplate($platform = false) { if ($platform === false) { if (defined("CORE") && isset($_SESSION['current_action_platform'])) { $platform = $_SESSION['current_action_platform']; } else { $platform = Get::cur_plat(); } } if ($platform == 'fw') { $platform = 'framework'; } if (!isset($GLOBALS['where_' . $platform . '_relative'])) { $platform = 'framework'; } return $GLOBALS['where_' . $platform . '_relative'] . (substr($GLOBALS['where_' . $platform . '_relative'], -1) == '/' ? '' : '/') . 'templates/'; }
function checkPermForCourse($mode, $id_course, $return_value = false, $use_mod_name = false) { if ($use_mod_name != false) { $mod_name = $use_mod_name; } else { $mod_name = $GLOBALS['modname']; } switch ($mode) { case "OP": case "view": $suff = 'view'; break; case "NEW": case "add": $suff = 'add'; break; case "MOD": case "mod": $suff = 'mod'; break; case "REM": case "del": $suff = 'del'; break; default: $suff = $mode; } $role = '/' . Get::cur_plat() . '/course/private/' . $id_course . '/' . $mod_name . '/' . $suff; if (!$return_value && isset($_SESSION['idCourse'])) { TrackUser::setActionTrack(getLogUserId(), $_SESSION['idCourse'], $mod_name, $suff); } if (Docebo::user()->matchUserRole($role)) { return true; } else { if ($return_value) { return false; } else { die("You can't access"); } } }
/** * Add a css file in the page head * @param string $name * @param string $platform * @param string $folder * @param string $add_start * @return nothing */ function addCss($name, $platform = FALSE, $folder = FALSE, $add_start = FALSE) { if (!isset($GLOBALS["page"])) { return; } if ($platform === FALSE) { $platform = Get::cur_plat(); } $clean_name = getCleanTitle($name); $clean_folder = $folder !== FALSE ? "_" . getCleanTitle($folder) : ""; $css_id = $platform . $clean_folder . "_" . $clean_name; if (!isset($GLOBALS["_css_cache"])) { $GLOBALS["_css_cache"] = array(); } if (!in_array($css_id, $GLOBALS["_css_cache"])) { $GLOBALS["_css_cache"][] = $css_id; $css = Get::tmpl_path($platform) . "style" . ($folder !== FALSE ? $folder : "") . "/" . $name . ".css"; $code = "<link href=\"" . $css . "\" rel=\"stylesheet\" type=\"text/css\" />\n"; if (isset($GLOBALS["page"])) { if (!$add_start) { $GLOBALS["page"]->add($code, "page_head"); } else { $GLOBALS["page"]->addStart($code, "page_head"); } } } }
function titleArea($text, $image = '', $alt_image = '') { $res = ""; if (Get::cur_plat() == 'cms') { $res = getCmsTitleArea($text, $image = '', $alt_image = ''); } else { $res = getTitleArea($text, $image = '', $alt_image = ''); } return $res; }
/** * Return the calculated relative path form the current zone (platform) to the requested one * @param <string> $item (base, lms, cms, ...) * @return <string> the relative path */ public static function tmpl_path($item = false) { if ($item === false) { $platform = Get::cur_plat(); } else { $platform = $item; } $path = Get::rel_path('base') . '/templates/' . getTemplate() . '/'; return str_replace('/./', '/', $path); }
/*Start database connection***********************************************/ $GLOBALS['dbConn'] = mysql_connect($GLOBALS['dbhost'], $GLOBALS['dbuname'], $GLOBALS['dbpass']); if (!$GLOBALS['dbConn']) { die("Can't connect to db. Check configurations"); } if (!mysql_select_db($dbname, $GLOBALS['dbConn'])) { die("Database not found. Check configurations"); } @sql_query("SET NAMES '" . $GLOBALS['db_conn_names'] . "'", $GLOBALS['dbConn']); @sql_query("SET CHARACTER SET '" . $GLOBALS['db_conn_char_set'] . "'", $GLOBALS['dbConn']); /*Start session***********************************************************/ //cookie lifetime ( valid until browser closed ) session_set_cookie_params(0); //session lifetime ( max inactivity time ) ini_set('session.gc_maxlifetime', $GLOBALS['ttlSession']); switch (Get::cur_plat()) { case "lms": case "cms": case "kms": $sn = "docebo_session"; $user_session = 'public_area'; break; case "framework": default: if (Get::sett('common_admin_session') == 'on') { $sn = "docebo_session"; $user_session = 'public_area'; } else { $sn = "docebo_core"; $user_session = 'admin_area'; }
function getPopupBaseUrl() { return basename($_SERVER["SCRIPT_NAME"]) . "?sn=" . Get::cur_plat(); }
/** * return an array with all modules in translations table * @param string $platform * @return array array with all modules */ function getAllModules($platform = FALSE) { if ($platform === FALSE) { $platform = Get::cur_plat(); } $query = "SELECT text_module" . " FROM " . $this->_getTableText() . " WHERE 1" . " GROUP BY text_module"; $rs = sql_query($query); $result = array(); while (list($text_module) = sql_fetch_row($rs)) { $result[] = $text_module; } return $result; }