本文整理汇总了PHP中api_get_access_url函数的典型用法代码示例。如果您正苦于以下问题:PHP api_get_access_url函数的具体用法?PHP api_get_access_url怎么用?PHP api_get_access_url使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了api_get_access_url函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Room constructor.
*/
public function __construct()
{
$this->table = \Database::get_main_table('plugin_openmeetings');
$this->name = 'C' . api_get_real_course_id() . '-' . api_get_session_id();
$accessUrl = api_get_access_url(api_get_current_access_url_id());
$this->externalRoomType = substr($accessUrl['url'], strpos($accessUrl['url'], '://') + 3, -1);
if (strcmp($this->externalRoomType, 'localhost') == 0) {
$this->externalRoomType = substr(api_get_path(WEB_PATH), strpos(api_get_path(WEB_PATH), '://') + 3, -1);
}
$this->externalRoomType = 'chamilolms.' . $this->externalRoomType;
}
示例2: __construct
/**
* Constructor (generates a connection to the API and the Chamilo settings
* required for the connection to the video conference server)
*/
public function __construct()
{
global $_configuration;
// initialize video server settings from global settings
$plugin = \OpenMeetingsPlugin::create();
$om_plugin = $plugin->get('tool_enable');
$om_host = $plugin->get('host');
$om_user = $plugin->get('user');
$om_pass = $plugin->get('pass');
$accessUrl = api_get_access_url($_configuration['access_url']);
$this->externalType = substr($accessUrl['url'], strpos($accessUrl['url'], '://') + 3, -1);
if (strcmp($this->externalType, 'localhost') == 0) {
$this->externalType = substr(api_get_path(WEB_PATH), strpos(api_get_path(WEB_PATH), '://') + 3, -1);
}
$this->externalType = 'chamilolms.' . $this->externalType;
$this->table = \Database::get_main_table('plugin_openmeetings');
if ($om_plugin) {
$user_info = api_get_user_info();
$this->user_complete_name = $user_info['complete_name'];
$this->user = $om_user;
$this->pass = $om_pass;
$this->url = $om_host;
// Setting OM api
define('CONFIG_OPENMEETINGS_USER', $this->user);
define('CONFIG_OPENMEETINGS_PASS', $this->pass);
define('CONFIG_OPENMEETINGS_SERVER_URL', $this->url);
$this->gateway = new \OpenMeetingsGateway($this->url, $this->user, $this->pass);
$this->plugin_enabled = $om_plugin;
// The room has a name composed of C + course ID + '-' + session ID
$this->chamiloCourseId = api_get_course_int_id();
$this->chamiloSessionId = api_get_session_id();
$this->roomName = 'C' . $this->chamiloCourseId . '-' . $this->chamiloSessionId;
$return = $this->gateway->loginUser();
if ($return == 0) {
$msg = 'Could not initiate session with server through OpenMeetingsGateway::loginUser()';
error_log(__FILE__ . '+' . __LINE__ . ': ' . $msg);
die($msg);
}
$this->sessionId = $this->gateway->sessionId;
}
}
示例3: get_settings
function get_settings($category = null)
{
$url_id = api_get_current_access_url_id();
$settings_by_access_list = array();
if ($url_id == 1) {
$settings = api_get_settings($category, 'group', $url_id);
} else {
$url_info = api_get_access_url($url_id);
if ($url_info['active'] == 1) {
// The default settings of Chamilo
$settings = api_get_settings($category, 'group', 1, 0);
// The settings that are changeable from a particular site.
$settings_by_access = api_get_settings($category, 'group', $url_id, 1);
foreach ($settings_by_access as $row) {
if (empty($row['variable'])) {
$row['variable'] = 0;
}
if (empty($row['subkey'])) {
$row['subkey'] = 0;
}
if (empty($row['category'])) {
$row['category'] = 0;
}
// One more validation if is changeable.
if ($row['access_url_changeable'] == 1) {
$settings_by_access_list[$row['variable']][$row['subkey']][$row['category']] = $row;
} else {
$settings_by_access_list[$row['variable']][$row['subkey']][$row['category']] = array();
}
}
}
}
if (isset($category) && $category == 'search_setting') {
if (!empty($_REQUEST['search_field'])) {
$settings = search_setting($_REQUEST['search_field']);
}
}
return array('settings' => $settings, 'settings_by_access_list' => $settings_by_access_list);
}
示例4: get_favicon_from_url
/**
* This function returns an icon path that represents the favicon of the website of which the url given.
* Defaults to the current Chamilo favicon
* @param string URL of website where to look for favicon.ico
* @param string Optional second URL of website where to look for favicon.ico
* @return string Path of icon to load
*/
public static function get_favicon_from_url($url1, $url2 = null)
{
$icon_link = '';
$url = $url1;
if (empty($url1)) {
$url = $url2;
if (empty($url)) {
$url = api_get_access_url(api_get_current_access_url_id());
$url = $url[0];
}
}
if (!empty($url)) {
$pieces = parse_url($url);
$icon_link = $pieces['scheme'] . '://' . $pieces['host'] . '/favicon.ico';
}
return $icon_link;
}
示例5: send_password_to_user
/**
* This function sends the actual password to the user
*
* @param int $user
* @author Olivier Cauberghe <olivier.cauberghe@UGent.be>, Ghent University
*/
public static function send_password_to_user($user, $by_username = false)
{
$email_subject = "[" . api_get_setting('platform.site_name') . "] " . get_lang('LoginRequest');
// SUBJECT
if ($by_username) {
// Show only for lost password
$user_account_list = self::get_user_account_list($user, false, $by_username);
// BODY
$email_to = $user['email'];
} else {
$user_account_list = self::get_user_account_list($user);
// BODY
$email_to = $user[0]['email'];
}
$portal_url = api_get_path(WEB_PATH);
if (api_is_multiple_url_enabled()) {
$access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1) {
$url = api_get_access_url($access_url_id);
$portal_url = $url['url'];
}
}
$email_body = get_lang('YourAccountParam') . " " . $portal_url . "\n\n{$user_account_list}";
// SEND MESSAGE
$sender_name = api_get_person_name(api_get_setting('admin.administrator_name'), api_get_setting('admin.administrator_surname'), null, PERSON_NAME_EMAIL_ADDRESS);
$email_admin = api_get_setting('admin.administrator_email');
if (api_mail_html('', $email_to, $email_subject, $email_body, $sender_name, $email_admin) == 1) {
return get_lang('YourPasswordHasBeenReset');
} else {
$admin_email = Display::encrypted_mailto_link(api_get_setting('admin.administrator_email'), api_get_person_name(api_get_setting('admin.administrator_name'), api_get_setting('admin.administrator_surname')));
return sprintf(get_lang('ThisPlatformWasUnableToSendTheEmailPleaseContactXForMoreInformation'), $admin_email);
}
}
示例6: get_lang
echo get_lang('ComingSoon');
}
Display::display_footer();
exit;
}
}
}
$tool_name = get_lang('Registration', null, !empty($_POST['language']) ? $_POST['language'] : $_user['language']);
if (api_get_setting('registration.allow_terms_conditions') == 'true' && $user_already_registered_show_terms) {
$tool_name = get_lang('TermsAndConditions');
}
$home = api_get_path(SYS_APP_PATH) . 'home/';
if (api_is_multiple_url_enabled()) {
$access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1) {
$url_info = api_get_access_url($access_url_id);
$url = api_remove_trailing_slash(preg_replace('/https?:\\/\\//i', '', $url_info['url']));
$clean_url = api_replace_dangerous_char($url);
$clean_url = str_replace('/', '-', $clean_url);
$clean_url .= '/';
$home_old = api_get_path(SYS_APP_PATH) . 'home/';
$home = api_get_path(SYS_APP_PATH) . 'home/' . $clean_url;
}
}
if (file_exists($home . 'register_top_' . $user_selected_language . '.html')) {
$home_top_temp = @(string) file_get_contents($home . 'register_top_' . $user_selected_language . '.html');
$open = str_replace('{rel_path}', api_get_path(REL_PATH), $home_top_temp);
$open = api_to_system_encoding($open, api_detect_encoding(strip_tags($open)));
if (!empty($open)) {
$content = '<div class="well_border">' . $open . '</div>';
}
示例7: set_header_parameters
/**
* Set header parameters
* @param bool $sendHeaders send headers
*/
private function set_header_parameters($sendHeaders)
{
global $httpHeadXtra, $interbreadcrumb, $language_file, $_configuration, $this_section;
$_course = api_get_course_info();
$help = $this->help;
$nameTools = $this->title;
$navigation = return_navigation_array();
$this->menu_navigation = $navigation['menu_navigation'];
$this->assign('system_charset', api_get_system_encoding());
if (isset($httpHeadXtra) && $httpHeadXtra) {
foreach ($httpHeadXtra as &$thisHttpHead) {
header($thisHttpHead);
}
}
$this->assign('online_button', Display::return_icon('statusonline.png', null, null, ICON_SIZE_ATOM));
$this->assign('offline_button', Display::return_icon('statusoffline.png', null, null, ICON_SIZE_ATOM));
// Get language iso-code for this page - ignore errors
$this->assign('document_language', api_get_language_isocode());
$course_title = isset($_course['name']) ? $_course['name'] : null;
$title_list = array();
$title_list[] = api_get_setting('platform.institution');
$title_list[] = api_get_setting('platform.site_name');
if (!empty($course_title)) {
$title_list[] = $course_title;
}
if ($nameTools != '') {
$title_list[] = $nameTools;
}
$title_string = '';
for ($i = 0; $i < count($title_list); $i++) {
$title_string .= $title_list[$i];
if (isset($title_list[$i + 1])) {
$item = trim($title_list[$i + 1]);
if (!empty($item)) {
$title_string .= ' - ';
}
}
}
$this->assign('title_string', $title_string);
//Setting the theme and CSS files
$css = $this->setCssFiles();
$this->set_js_files();
$this->setCssCustomFiles($css);
//$this->set_js_files_post();
$browser = api_browser_support('check_browser');
if ($browser[0] == 'Internet Explorer' && $browser[1] >= '11') {
$browser_head = '<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9" />';
$this->assign('browser_specific_head', $browser_head);
}
// Implementation of prefetch.
// See http://cdn.chamilo.org/main/img/online.png for details
$prefetch = '';
if (!empty($_configuration['cdn_enable'])) {
$prefetch .= '<meta http-equiv="x-dns-prefetch-control" content="on">';
foreach ($_configuration['cdn'] as $host => $exts) {
$prefetch .= '<link rel="dns-prefetch" href="' . $host . '">';
}
}
$this->assign('prefetch', $prefetch);
$this->assign('text_direction', api_get_text_direction());
$this->assign('section_name', 'section-' . $this_section);
//Defaul root chamilo favicon
$favico = '<link rel="shortcut icon" href="' . api_get_path(WEB_PATH) . 'favicon.ico" type="image/x-icon" />';
//Added to verify if in the current Chamilo Theme exist a favicon
$favicoThemeUrl = api_get_path(SYS_CSS_PATH) . 'themes/' . $this->theme . '/images/';
//If exist pick the current chamilo theme favicon
if (is_file($favicoThemeUrl . 'favicon.ico')) {
$favico = '<link rel="shortcut icon" href="' . api_get_path(WEB_CSS_PATH) . 'themes/' . $this->theme . '/images/favicon.ico" type="image/x-icon" />';
}
if (api_is_multiple_url_enabled()) {
$access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1) {
$url_info = api_get_access_url($access_url_id);
$url = api_remove_trailing_slash(preg_replace('/https?:\\/\\//i', '', $url_info['url']));
$clean_url = api_replace_dangerous_char($url);
$clean_url = str_replace('/', '-', $clean_url);
$clean_url .= '/';
$homep = api_get_path(REL_PATH) . 'home/' . $clean_url;
//homep for Home Path
$icon_real_homep = api_get_path(SYS_APP_PATH) . 'home/' . $clean_url;
//we create the new dir for the new sites
if (is_file($icon_real_homep . 'favicon.ico')) {
$favico = '<link rel="shortcut icon" href="' . $homep . 'favicon.ico" type="image/x-icon" />';
}
}
}
$this->assign('favico', $favico);
$this->setHelp();
//@todo move this in the template
$bug_notification_link = '';
if (api_get_setting('show_link_bug_notification') == 'true' && $this->user_is_logged_in) {
$bug_notification_link = '<li class="report">
<a href="http://support.chamilo.org/projects/chamilo-18/wiki/How_to_report_bugs" target="_blank">
<img src="' . api_get_path(WEB_IMG_PATH) . 'bug.large.png" style="vertical-align: middle;" alt="' . get_lang('ReportABug') . '" title="' . get_lang('ReportABug') . '"/></a>
</li>';
}
//.........这里部分代码省略.........
示例8: send_invitation_mail
/**
* Send the invitation by mail.
*
* @param invitedUser - the userId (course user) or emailaddress of additional user
* $param $invitation_code - the unique invitation code for the URL
* @return void
*/
static function send_invitation_mail($invitedUser, $invitation_code, $invitation_title, $invitation_text)
{
global $_user, $_course, $_configuration;
$portal_url = api_get_path(WEB_CODE_PATH);
if (api_is_multiple_url_enabled()) {
$access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1) {
$url = api_get_access_url($access_url_id);
$portal_url = $url['url'];
}
}
// Replacing the **link** part with a valid link for the user
$survey_link = api_get_path(WEB_CODE_PATH) . 'survey/fillsurvey.php?course=' . $_course['code'] . '&invitationcode=' . $invitation_code;
$text_link = '<a href="' . $survey_link . '">' . get_lang('ClickHereToAnswerTheSurvey') . "</a><br />\r\n<br />\r\n" . get_lang('OrCopyPasteTheFollowingUrl') . " <br />\r\n " . $survey_link;
$replace_count = 0;
$full_invitation_text = api_str_ireplace('**link**', $text_link, $invitation_text, $replace_count);
if ($replace_count < 1) {
$full_invitation_text = $full_invitation_text . "<br />\r\n<br />\r\n" . $text_link;
}
// Sending the mail
$sender_name = api_get_person_name($_user['firstName'], $_user['lastName'], null, PERSON_NAME_EMAIL_ADDRESS);
$sender_email = $_user['mail'];
$sender_user_id = api_get_user_id();
$replyto = array();
if (api_get_setting('survey_email_sender_noreply') == 'noreply') {
$noReply = api_get_setting('noreply_email_address');
if (!empty($noReply)) {
$sender_name = $noReply;
$sender_email = $noReply;
$sender_user_id = null;
}
}
// Optionally: finding the e-mail of the user
if (is_numeric($invitedUser)) {
MessageManager::send_message($invitedUser, $invitation_title, $full_invitation_text, null, null, null, null, null, null, $sender_user_id);
} else {
/** @todo check if the address is a valid email */
$recipient_email = $invitedUser;
@api_mail_html(null, $recipient_email, $invitation_title, $full_invitation_text, $sender_name, $sender_email);
}
}
示例9: set_header_parameters
/**
* Set header parameters
*/
private function set_header_parameters()
{
global $httpHeadXtra, $_course, $interbreadcrumb, $language_file, $noPHP_SELF, $_configuration, $this_section;
$help = $this->help;
$nameTools = $this->title;
$navigation = return_navigation_array();
$this->menu_navigation = $navigation['menu_navigation'];
$this->assign('system_charset', api_get_system_encoding());
if (isset($httpHeadXtra) && $httpHeadXtra) {
foreach ($httpHeadXtra as & $thisHttpHead) {
header($thisHttpHead);
}
}
$this->assign('online_button', Display::return_icon('online.png'));
$this->assign('offline_button',Display::return_icon('offline.png'));
// Get language iso-code for this page - ignore errors
$this->assign('document_language', api_get_language_isocode());
$course_title = isset($_course['name']) ? $_course['name'] : null;
$title_list = array();
$title_list[] = api_get_setting('Institution');
$title_list[] = api_get_setting('siteName');
if (!empty($course_title)) {
$title_list[] = $course_title;
}
if ($nameTools != '') {
$title_list[] = $nameTools;
}
$title_string = '';
for ($i = 0; $i < count($title_list); $i++) {
$title_string .= $title_list[$i];
if (isset($title_list[$i + 1])) {
$item = trim($title_list[$i + 1]);
if (!empty($item)) {
$title_string .= ' - ';
}
}
}
$this->assign('title_string', $title_string);
//Setting the theme and CSS files
$this->set_css_files();
$this->set_js_files();
//$this->set_js_files_post();
$browser = api_browser_support('check_browser');
if ($browser[0] == 'Internet Explorer' && $browser[1] >= '11') {
$browser_head = '<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9" />';
$this->assign('browser_specific_head', $browser_head);
}
// Implementation of prefetch.
// See http://cdn.chamilo.org/main/img/online.png for details
$prefetch = '';
if (!empty($_configuration['cdn_enable'])) {
$prefetch .= '<meta http-equiv="x-dns-prefetch-control" content="on">';
foreach ($_configuration['cdn'] as $host => $exts) {
$prefetch .= '<link rel="dns-prefetch" href="'.$host.'">';
}
}
$this->assign('prefetch', $prefetch);
$this->assign('text_direction', api_get_text_direction());
$this->assign('section_name', 'section-'.$this_section);
$favico = '<link rel="shortcut icon" href="'.api_get_path(WEB_PATH).'favicon.ico" type="image/x-icon" />';
if (isset($_configuration['multiple_access_urls']) && $_configuration['multiple_access_urls']) {
$access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1) {
$url_info = api_get_access_url($access_url_id);
$url = api_remove_trailing_slash(preg_replace('/https?:\/\//i', '', $url_info['url']));
$clean_url = replace_dangerous_char($url);
$clean_url = str_replace('/', '-', $clean_url);
$clean_url .= '/';
$homep = api_get_path(REL_PATH).'home/'.$clean_url; //homep for Home Path
$icon_real_homep = api_get_path(SYS_PATH).'home/'.$clean_url;
//we create the new dir for the new sites
if (is_file($icon_real_homep.'favicon.ico')) {
$favico = '<link rel="shortcut icon" href="'.$homep.'favicon.ico" type="image/x-icon" />';
}
}
}
$this->assign('favico', $favico);
$this->set_help();
//.........这里部分代码省略.........
示例10: api_get_home_path
/**
* Get home path
* @return string
*/
function api_get_home_path()
{
// FIX : Start the routing determination from central path definition
$home = api_get_path(SYS_HOME_PATH);
if (api_get_multiple_access_url()) {
$access_url_id = api_get_current_access_url_id();
$url_info = api_get_access_url($access_url_id);
$url = api_remove_trailing_slash(preg_replace('/https?:\\/\\//i', '', $url_info['url']));
$clean_url = api_replace_dangerous_char($url);
$clean_url = str_replace('/', '-', $clean_url);
$clean_url .= '/';
if ($clean_url != 'localhost/') {
return "{$home}{$clean_url}";
}
}
return $home;
}
示例11: generate_settings_form
function generate_settings_form($settings, $settings_by_access_list)
{
global $_configuration, $settings_to_avoid, $convert_byte_to_mega_list;
$table_settings_current = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
$form = new FormValidator('settings', 'post', 'settings.php?category=' . Security::remove_XSS($_GET['category']));
$form->addElement('hidden', 'search_field', !empty($_GET['search_field']) ? Security::remove_XSS($_GET['search_field']) : null);
$url_id = api_get_current_access_url_id();
if (!empty($_configuration['multiple_access_urls']) && api_is_global_platform_admin() && $url_id == 1) {
$group = array();
$group[] = $form->createElement('button', 'mark_all', get_lang('MarkAll'));
$group[] = $form->createElement('button', 'unmark_all', get_lang('UnmarkAll'));
$form->addGroup($group, 'buttons_in_action_right');
}
$default_values = array();
$url_info = api_get_access_url($url_id);
$i = 0;
foreach ($settings as $row) {
if (in_array($row['variable'], array_keys($settings_to_avoid))) {
continue;
}
if (!empty($_configuration['multiple_access_urls'])) {
if (api_is_global_platform_admin()) {
if ($row['access_url_locked'] == 0) {
if ($url_id == 1) {
if ($row['access_url_changeable'] == '1') {
$form->addElement('html', '<div style="float: right;"><a class="share_this_setting" data_status = "0" data_to_send = "' . $row['variable'] . '" href="javascript:void(0);">' . Display::return_icon('shared_setting.png', get_lang('ChangeSharedSetting')) . '</a></div>');
} else {
$form->addElement('html', '<div style="float: right;"><a class="share_this_setting" data_status = "1" data_to_send = "' . $row['variable'] . '" href="javascript:void(0);">' . Display::return_icon('shared_setting_na.png', get_lang('ChangeSharedSetting')) . '</a></div>');
}
} else {
if ($row['access_url_changeable'] == '1') {
$form->addElement('html', '<div style="float: right;">' . Display::return_icon('shared_setting.png', get_lang('ChangeSharedSetting')) . '</div>');
} else {
$form->addElement('html', '<div style="float: right;">' . Display::return_icon('shared_setting_na.png', get_lang('ChangeSharedSetting')) . '</div>');
}
}
}
}
}
$hideme = array();
$hide_element = false;
if ($_configuration['access_url'] != 1) {
if ($row['access_url_changeable'] == 0) {
// We hide the element in other cases (checkbox, radiobutton) we 'freeze' the element.
$hide_element = true;
$hideme = array('disabled');
} elseif ($url_info['active'] == 1) {
// We show the elements.
if (empty($row['variable'])) {
$row['variable'] = 0;
}
if (empty($row['subkey'])) {
$row['subkey'] = 0;
}
if (empty($row['category'])) {
$row['category'] = 0;
}
if (is_array($settings_by_access_list[$row['variable']][$row['subkey']][$row['category']])) {
// We are sure that the other site have a selected value.
if ($settings_by_access_list[$row['variable']][$row['subkey']][$row['category']]['selected_value'] != '') {
$row['selected_value'] = $settings_by_access_list[$row['variable']][$row['subkey']][$row['category']]['selected_value'];
}
}
// There is no else{} statement because we load the default $row['selected_value'] of the main Chamilo site.
}
}
switch ($row['type']) {
case 'textfield':
if (in_array($row['variable'], $convert_byte_to_mega_list)) {
$form->addElement('text', $row['variable'], array(get_lang($row['title']), get_lang($row['comment']), get_lang('MB')), array('maxlength' => '8'));
$form->applyFilter($row['variable'], 'html_filter');
$default_values[$row['variable']] = round($row['selected_value'] / 1024 / 1024, 1);
} elseif ($row['variable'] == 'account_valid_duration') {
$form->addElement('text', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])), array('maxlength' => '5'));
$form->applyFilter($row['variable'], 'html_filter');
$default_values[$row['variable']] = $row['selected_value'];
// For platform character set selection: Conversion of the textfield to a select box with valid values.
} elseif ($row['variable'] == 'platform_charset') {
continue;
} else {
$hideme['class'] = 'col-md-4';
$form->addElement('text', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])), $hideme);
$form->applyFilter($row['variable'], 'html_filter');
$default_values[$row['variable']] = $row['selected_value'];
}
break;
case 'textarea':
if ($row['variable'] == 'header_extra_content') {
$file = api_get_path(SYS_PATH) . api_get_home_path() . 'header_extra_content.txt';
$value = '';
if (file_exists($file)) {
$value = file_get_contents($file);
}
$form->addElement('textarea', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])), array('rows' => '10'), $hideme);
$default_values[$row['variable']] = $value;
} elseif ($row['variable'] == 'footer_extra_content') {
$file = api_get_path(SYS_PATH) . api_get_home_path() . 'footer_extra_content.txt';
$value = '';
if (file_exists($file)) {
$value = file_get_contents($file);
//.........这里部分代码省略.........
示例12: return_menu
function return_menu()
{
$navigation = return_navigation_array();
$navigation = $navigation['navigation'];
// Displaying the tabs
$lang = '';
//el for "Edit Language"
if (!empty($_SESSION['user_language_choice'])) {
$lang = $_SESSION['user_language_choice'];
} elseif (!empty($_SESSION['_user']['language'])) {
$lang = $_SESSION['_user']['language'];
} else {
$lang = get_setting('platformLanguage');
}
//Preparing home folder for multiple urls
if (api_get_multiple_access_url()) {
$access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1) {
$url_info = api_get_access_url($access_url_id);
$url = api_remove_trailing_slash(preg_replace('/https?:\\/\\//i', '', $url_info['url']));
$clean_url = replace_dangerous_char($url);
$clean_url = str_replace('/', '-', $clean_url);
$clean_url .= '/';
$homep = api_get_path(SYS_PATH) . 'home/' . $clean_url;
//homep for Home Path
//we create the new dir for the new sites
if (!is_dir($homep)) {
mkdir($homep, api_get_permissions_for_new_directories());
}
}
} else {
$homep = api_get_path(SYS_PATH) . 'home/';
}
$ext = '.html';
$menutabs = 'home_tabs';
$mtloggedin = 'home_tabs_logged_in';
$home_top = '';
if (is_file($homep . $menutabs . '_' . $lang . $ext) && is_readable($homep . $menutabs . '_' . $lang . $ext)) {
$home_top = @(string) file_get_contents($homep . $menutabs . '_' . $lang . $ext);
} elseif (is_file($homep . $menutabs . $lang . $ext) && is_readable($homep . $menutabs . $lang . $ext)) {
$home_top = @(string) file_get_contents($homep . $menutabs . $lang . $ext);
} else {
//$errorMsg = get_lang('HomePageFilesNotReadable');
}
$home_top = api_to_system_encoding($home_top, api_detect_encoding(strip_tags($home_top)));
$open = str_replace('{rel_path}', api_get_path(REL_PATH), $home_top);
$open = api_to_system_encoding($open, api_detect_encoding(strip_tags($open)));
$open_mtloggedin = '';
if (api_get_user_id() && !api_is_anonymous()) {
if (is_file($homep . $mtloggedin . '_' . $lang . $ext) && is_readable($homep . $mtloggedin . '_' . $lang . $ext)) {
$home_top = @(string) file_get_contents($homep . $mtloggedin . '_' . $lang . $ext);
$home_top = str_replace('::private', '', $home_top);
} elseif (is_file($homep . $mtloggedin . $lang . $ext) && is_readable($homep . $mtloggedin . $lang . $ext)) {
$home_top = @(string) file_get_contents($homep . $mtloggedin . $lang . $ext);
$home_top = str_replace('::private', '', $home_top);
} else {
//$errorMsg = get_lang('HomePageFilesNotReadable');
}
$home_top = api_to_system_encoding($home_top, api_detect_encoding(strip_tags($home_top)));
$open_mtloggedin = str_replace('{rel_path}', api_get_path(REL_PATH), $home_top);
$open_mtloggedin = api_to_system_encoding($open_mtloggedin, api_detect_encoding(strip_tags($open_mtloggedin)));
}
$lis = '';
if (!empty($open) or !empty($open_mtloggedin)) {
if (strpos($open . $open_mtloggedin, 'show_menu') === false) {
if (api_is_anonymous()) {
$navigation[SECTION_CAMPUS] = null;
}
} else {
//$lis .= Display::tag('li', $open);
if (api_get_user_id() && !api_is_anonymous()) {
$lis .= $open_mtloggedin;
} else {
$lis .= $open;
}
}
}
if (count($navigation) > 0 || !empty($lis)) {
$pre_lis = '';
foreach ($navigation as $section => $navigation_info) {
$key = !empty($navigation_info['key']) ? 'tab-' . $navigation_info['key'] : '';
if (isset($GLOBALS['this_section'])) {
$current = $section == $GLOBALS['this_section'] ? ' id="current" class="active ' . $key . '" ' : ' class="' . $key . '"';
} else {
$current = '';
}
if (!empty($navigation_info['title'])) {
$pre_lis .= '<li' . $current . '><a href="' . $navigation_info['url'] . '" target="_top">' . $navigation_info['title'] . '</a></li>';
}
}
$lis = $pre_lis . $lis;
}
$menu = null;
if (!empty($lis)) {
$menu .= $lis;
}
return $menu;
}
示例13: array_walk_recursive_limited
}
$charset = 'UTF-8';
// Enables the portablity layer and configures PHP for UTF-8
\Patchwork\Utf8\Bootup::initAll();
// Start session after the internationalization library has been initialized.
ChamiloSession::instance()->start($alreadyInstalled);
// Remove quotes added by PHP - get_magic_quotes_gpc() is deprecated in PHP 5 see #2970
if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) {
array_walk_recursive_limited($_GET, 'stripslashes', true);
array_walk_recursive_limited($_POST, 'stripslashes', true);
array_walk_recursive_limited($_COOKIE, 'stripslashes', true);
array_walk_recursive_limited($_REQUEST, 'stripslashes', true);
}
// access_url == 1 is the default chamilo location
if ($_configuration['access_url'] != 1) {
$url_info = api_get_access_url($_configuration['access_url']);
if ($url_info['active'] == 1) {
$settings_by_access =& api_get_settings(null, 'list', $_configuration['access_url'], 1);
foreach ($settings_by_access as &$row) {
if (empty($row['variable'])) {
$row['variable'] = 0;
}
if (empty($row['subkey'])) {
$row['subkey'] = 0;
}
if (empty($row['category'])) {
$row['category'] = 0;
}
$settings_by_access_list[$row['variable']][$row['subkey']][$row['category']] = $row;
}
}
示例14: get_link
/**
* Gets a link to the resource from the present location, depending on item ID.
* @param string $type Type of link expected
* @param integer $item_id Learnpath item ID
* @return string $provided_toc Link to the lp_item resource
*/
public function get_link($type = 'http', $item_id = null, $provided_toc = false)
{
$course_id = $this->get_course_int_id();
if ($this->debug > 0) {
error_log('New LP - In learnpath::get_link(' . $type . ',' . $item_id . ')', 0);
}
if (empty($item_id)) {
if ($this->debug > 2) {
error_log('New LP - In learnpath::get_link() - no item id given in learnpath::get_link(), using current: ' . $this->get_current_item_id(), 0);
}
$item_id = $this->get_current_item_id();
}
if (empty($item_id)) {
if ($this->debug > 2) {
error_log('New LP - In learnpath::get_link() - no current item id found in learnpath object', 0);
}
//still empty, this means there was no item_id given and we are not in an object context or
//the object property is empty, return empty link
$item_id = $this->first();
return '';
}
$file = '';
$lp_table = Database::get_course_table(TABLE_LP_MAIN);
$lp_item_table = Database::get_course_table(TABLE_LP_ITEM);
$lp_item_view_table = Database::get_course_table(TABLE_LP_ITEM_VIEW);
$item_id = intval($item_id);
$sql = "SELECT\n l.lp_type as ltype,\n l.path as lpath,\n li.item_type as litype,\n li.path as lipath,\n li.parameters as liparams\n \t\tFROM {$lp_table} l\n INNER JOIN {$lp_item_table} li\n ON (li.lp_id = l.id AND l.c_id = {$course_id} AND li.c_id = {$course_id} )\n \t\tWHERE li.id = {$item_id} ";
if ($this->debug > 2) {
error_log('New LP - In learnpath::get_link() - selecting item ' . $sql, 0);
}
$res = Database::query($sql);
if (Database::num_rows($res) > 0) {
$row = Database::fetch_array($res);
$lp_type = $row['ltype'];
$lp_path = $row['lpath'];
$lp_item_type = $row['litype'];
$lp_item_path = $row['lipath'];
$lp_item_params = $row['liparams'];
if (empty($lp_item_params) && strpos($lp_item_path, '?') !== false) {
list($lp_item_path, $lp_item_params) = explode('?', $lp_item_path);
}
$sys_course_path = api_get_path(SYS_COURSE_PATH) . api_get_course_path();
if ($type == 'http') {
$course_path = api_get_path(WEB_COURSE_PATH) . api_get_course_path();
//web path
} else {
$course_path = $sys_course_path;
//system path
}
// Fixed issue BT#1272 - If the item type is a Chamilo Item (quiz, link, etc), then change the lp type to thread it as a normal Chamilo LP not a SCO.
if (in_array($lp_item_type, array('quiz', 'document', 'link', 'forum', 'thread', 'student_publication'))) {
$lp_type = 1;
}
if ($this->debug > 2) {
error_log('New LP - In learnpath::get_link() - $lp_type ' . $lp_type, 0);
error_log('New LP - In learnpath::get_link() - $lp_item_type ' . $lp_item_type, 0);
}
// Now go through the specific cases to get the end of the path
// @todo Use constants instead of int values.
switch ($lp_type) {
case 1:
if ($lp_item_type == 'dokeos_chapter') {
$file = 'lp_content.php?type=dir';
} else {
require_once 'resourcelinker.inc.php';
$file = rl_get_resource_link_for_learnpath($course_id, $this->get_id(), $item_id, $this->get_view_id());
if ($this->debug > 0) {
error_log('rl_get_resource_link_for_learnpath - file: ' . $file, 0);
}
if ($lp_item_type == 'link') {
if (Link::is_youtube_link($file)) {
$src = Link::get_youtube_video_id($file);
$file = api_get_path(WEB_CODE_PATH) . 'newscorm/embed.php?type=youtube&source=' . $src;
} elseif (Link::isVimeoLink($file)) {
$src = Link::getVimeoLinkId($file);
$file = api_get_path(WEB_CODE_PATH) . 'newscorm/embed.php?type=vimeo&source=' . $src;
} else {
// If the current site is HTTPS and the link is
// HTTP, browsers will refuse opening the link
$urlId = api_get_current_access_url_id();
$url = api_get_access_url($urlId, false);
$protocol = substr($url['url'], 0, 5);
if ($protocol === 'https') {
$linkProtocol = substr($file, 0, 5);
if ($linkProtocol === 'http:') {
//this is the special intervention case
$file = api_get_path(WEB_CODE_PATH) . 'newscorm/embed.php?type=nonhttps&source=' . urlencode($file);
}
}
}
} else {
// Check how much attempts of a exercise exits in lp
$lp_item_id = $this->get_current_item_id();
$lp_view_id = $this->get_view_id();
//.........这里部分代码省略.........
示例15: handle_stylesheets
/**
* This function allows the platform admin to choose the default stylesheet
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
*/
function handle_stylesheets()
{
global $_configuration;
// Current style
$currentstyle = api_get_setting('stylesheets');
$is_style_changeable = false;
if ($_configuration['access_url'] != 1) {
$style_info = api_get_settings('stylesheets', '', 1, 0);
$url_info = api_get_access_url($_configuration['access_url']);
if ($style_info[0]['access_url_changeable'] == 1 && $url_info['active'] == 1) {
$is_style_changeable = true;
echo '<div class="actions" id="stylesheetuploadlink">';
Display::display_icon('theme_add.gif');
echo '<a href="" onclick="document.getElementById(\'newstylesheetform\').style.display = \'block\'; document.getElementById(\'stylesheetuploadlink\').style.display = \'none\';return false; ">' . get_lang('UploadNewStylesheet') . '</a>';
echo '</div>';
}
} else {
$is_style_changeable = true;
echo '<div class="actions" id="stylesheetuploadlink">';
Display::display_icon('theme_add.gif');
echo '<a href="" onclick="document.getElementById(\'newstylesheetform\').style.display = \'block\'; document.getElementById(\'stylesheetuploadlink\').style.display = \'none\';return false; ">' . get_lang('UploadNewStylesheet') . '</a>';
echo '</div>';
}
$form = new FormValidator('stylesheet_upload', 'post', 'settings.php?category=stylesheets&showuploadform=true');
$form->addElement('text', 'name_stylesheet', get_lang('NameStylesheet'), array('size' => '40', 'maxlength' => '40'));
$form->addRule('name_stylesheet', get_lang('ThisFieldIsRequired'), 'required');
$form->addElement('file', 'new_stylesheet', get_lang('UploadNewStylesheet'));
$allowed_file_types = array('css');
$form->addRule('new_stylesheet', get_lang('InvalidExtension') . ' (' . implode(',', $allowed_file_types) . ')', 'filetype', $allowed_file_types);
$form->addRule('new_stylesheet', get_lang('ThisFieldIsRequired'), 'required');
$form->addElement('style_submit_button', 'stylesheet_upload', get_lang('Ok'), array('class' => 'save'));
if ($form->validate() and is_writable(api_get_path(SYS_CODE_PATH) . 'css/')) {
$values = $form->exportValues();
$picture_element =& $form->getElement('new_stylesheet');
$picture = $picture_element->getValue();
upload_stylesheet($values, $picture);
Display::display_confirmation_message(get_lang('StylesheetAdded'));
} else {
if (!is_writable(api_get_path(SYS_CODE_PATH) . 'css/')) {
Display::display_error_message(api_get_path(SYS_CODE_PATH) . 'css/' . get_lang('IsNotWritable'));
} else {
if ($_GET['showuploadform'] == 'true') {
echo '<div id="newstylesheetform">';
} else {
echo '<div id="newstylesheetform" style="display: none;">';
}
// uploading a new stylesheet
if ($_configuration['access_url'] == 1) {
$form->display();
} else {
if ($is_style_changeable) {
$form->display();
}
}
echo '</div>';
}
}
// Preview of the stylesheet
echo '<div><iframe src="style_preview.php" width="100%" height="300" name="preview"></iframe></div>';
echo '<form name="stylesheets" method="post" action="' . api_get_self() . '?category=' . Security::remove_XSS($_GET['category']) . '">';
if ($handle = @opendir(api_get_path(SYS_PATH) . 'main/css/')) {
$counter = 1;
while (false !== ($style_dir = readdir($handle))) {
if (substr($style_dir, 0, 1) == '.') {
continue;
}
$dirpath = api_get_path(SYS_PATH) . 'main/css/' . $style_dir;
if (is_dir($dirpath)) {
if ($style_dir != '.' && $style_dir != '..') {
if ($currentstyle == $style_dir or $style_dir == 'dokeos_classic' and !$currentstyle) {
$selected = 'checked="checked"';
} else {
$selected = '';
}
$show_name = get_lang(str_replace(' ', '', ucwords(str_replace('_', ' ', $style_dir))));
if ($is_style_changeable) {
echo "<input type=\"radio\" name=\"style\" value=\"" . $style_dir . "\" " . $selected . " onClick=\"parent.preview.location='style_preview.php?style=" . $style_dir . "';\"/>";
echo '<a href="style_preview.php?style=' . $style_dir . '" target="preview">' . $show_name . '</a>';
} else {
echo '<a href="style_preview.php?style=' . $style_dir . '" target="preview">' . $show_name . '</a>';
}
//echo '<div id="Layer'.$counter.'" style="position:relative; width:687px; z-index:2; visibility: hidden;">';
//echo '<a href="#" onClick="MM_showHideLayers(\'Layer'.$counter.'\',\'\',\'hide\')">'.get_lang('Close').'</a>';
//echo '<iframe src="style_preview.php?style='.$file.'" width="100%" style="float:right;"></iframe></div>';
echo "<br />\n";
$counter++;
}
}
}
@closedir($handle);
}
if ($is_style_changeable) {
echo '<button class="save" type="submit" name="submit_stylesheets"> ' . get_lang('SaveSettings') . ' </button></form>';
}
}