Adding origin parameter in api_get_cid_req() see BT#7688

1.9.x
Julio Montoya 12 years ago
parent 5681b27db9
commit 3ad9dee5e6
  1. 7
      main/inc/lib/display.lib.php
  2. 50
      main/inc/lib/main_api.lib.php
  3. 17
      main/work/work.php
  4. 2
      main/work/work_list.php

@ -60,7 +60,12 @@ class Display
*/
public static function display_header($tool_name ='', $help = null, $page_header = null)
{
self::$global_template = new Template($tool_name);
$origin = api_get_origin();
$showHeader = true;
if (isset($origin) && $origin == 'learnpath') {
$showHeader = false;
}
self::$global_template = new Template($tool_name, $showHeader, $showHeader);
// Fixing tools with any help it takes xxx part of main/xxx/index.php
if (empty($help)) {

@ -1327,18 +1327,22 @@ function api_get_anonymous_id() {
* @see Uri.course_params
*/
function api_get_cidreq($add_session_id = true, $add_group_id = true) {
$url = empty($GLOBALS['_cid']) ? '' : 'cidReq='.htmlspecialchars($GLOBALS['_cid']);
if ($add_session_id) {
if (!empty($url)) {
$url = empty($GLOBALS['_cid']) ? '' : 'cidReq='.htmlspecialchars($GLOBALS['_cid']);
$origin = api_get_origin();
if ($add_session_id) {
if (!empty($url)) {
$url .= api_get_session_id() == 0 ? '&id_session=0' : '&id_session='.api_get_session_id();
}
}
if ($add_group_id) {
if (!empty($url)) {
}
}
if ($add_group_id) {
if (!empty($url)) {
$url .= api_get_group_id() == 0 ? '&gidReq=0' : '&gidReq='.api_get_group_id();
}
}
return $url;
}
}
$url .= '&origin='.$origin;
return $url;
}
/**
@ -7092,17 +7096,37 @@ function api_get_protocol()
/**
* Return a string where " are replaced with 2 '
* It is usefull when you pass a PHP variable in a Javascript browser dialog
* It is useful when you pass a PHP variable in a Javascript browser dialog
* e.g. : alert("<?php get_lang('message') ?>");
* and message contains character "
* @param $in_text
*
* @param string $in_text
* @return string
*/
function convert_double_quote_to_single($in_text) {
return api_preg_replace('/"/', "''", $in_text);
}
/**
* Is unoconv installed
* @return bool
*/
function api_is_unoconv_installed()
{
return false;
}
/**
* Get origin
*
* @param string
* @return string
**/
function api_get_origin()
{
if (isset($_REQUEST['origin'])) {
return $_REQUEST['origin'] == 'learnpath' ? 'learnpath' : null;
}
return null;
}

@ -58,7 +58,6 @@ $link_target_parameter = ""; // e.g. "target=\"_blank\"";
$display_list_users_without_publication = isset($_GET['list']) && Security::remove_XSS($_GET['list']) == 'without' ? true : false;
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'list';
//Download folder
if ($action == 'downloadfolder') {
require 'downloadfolder.inc.php';
@ -113,7 +112,7 @@ if (!empty($group_id)) {
$interbreadcrumb[] = array ('url' => 'work.php','name' => get_lang('CreateAssignment'));
}
} else {
if (isset($origin) && $origin != 'learnpath') {
if ($origin != 'learnpath') {
if (isset($_GET['id']) && !empty($_GET['id']) || $display_upload_form || $action == 'settings' || $action == 'create_dir') {
$interbreadcrumb[] = array ('url' => 'work.php', 'name' => get_lang('StudentPublications'));
@ -272,13 +271,7 @@ switch ($action) {
break;
}
if (isset($origin) && $origin != 'learnpath') {
Display :: display_header(null);
} else {
// We are in the learnpath tool
Display::display_reduced_header();
}
Display :: display_header(null);
Display::display_introduction_section(TOOL_STUDENTPUBLICATION);
if ($origin == 'learnpath') {
@ -290,10 +283,6 @@ display_action_links($work_id, $curdirpath, $action);
$message = Session::read('message');
echo $message;
Session::erase('message');
echo $content;
if ($origin != 'learnpath') {
//we are not in the learning path tool
Display :: display_footer();
}
Display::display_footer();

@ -15,7 +15,7 @@ require_once 'work.lib.php';
$this_section = SECTION_COURSES;
$workId = isset($_GET['id']) ? intval($_GET['id']) : null;
$origin = isset($origin) ? Security::remove_XSS($origin) : null;
$origin = isset($_REQUEST['origin']) ? Security::remove_XSS($_REQUEST['origin']) : '';
if (empty($workId)) {
api_not_allowed(true);

Loading…
Cancel
Save