Ejemplo n.º 1
0
 public function resolve(ResourceLocator $locator)
 {
     if ($locator->hasResourceId()) {
         $context = Claro_Context::getCurrentContext();
         $context[CLARO_CONTEXT_COURSE] = $locator->getCourseId();
         if ($locator->inGroup()) {
             $context[CLARO_CONTEXT_GROUP] = $locator->getGroupId();
         }
         $path = get_path('coursesRepositorySys') . claro_get_course_path($locator->getCourseId());
         // in a group
         if ($locator->inGroup()) {
             $groupData = claro_get_group_data($context);
             $path .= '/group/' . $groupData['directory'];
             $groupId = $locator->getGroupId();
         } else {
             $path .= '/document';
         }
         $path .= '/' . $this->urlDecodePath(ltrim($locator->getResourceId(), '/'));
         $resourcePath = '/' . $this->urlDecodePath(ltrim($locator->getResourceId(), '/'));
         $path = secure_file_path($path);
         if (!file_exists($path)) {
             // throw new Exception("Resource not found {$path}");
             return false;
         } elseif (is_dir($path)) {
             $url = new Url(get_module_entry_url('CLDOC'));
             $url->addParam('cmd', 'exChDir');
             $url->addParam('file', base64_encode($resourcePath));
             return $url->toUrl();
         } else {
             return claro_get_file_download_url($resourcePath, Claro_Context::getUrlContext($context));
         }
     } else {
         return get_module_entry_url('CLDOC');
     }
 }
Ejemplo n.º 2
0
 /**
  * Function called to resolve an URL based on a resourceId.
  *
  * @param ResourceLocator $locator The locator of the resource.
  * @return string the URL of the item
  */
 public function resolve(ResourceLocator $locator)
 {
     if ($locator->hasResourceId()) {
         return get_module_url('CLLNP') . "/learningPath.php?path_id={$locator->getResourceId()}&cidReq={$locator->getCourseId()}";
     } else {
         return get_module_entry_url('CLLNP');
     }
 }
Ejemplo n.º 3
0
 public function resolve(ResourceLocator $locator)
 {
     if ($locator->hasResourceId()) {
         return get_module_entry_url('CLCAL') . "#item{$locator->getResourceId()}";
     } else {
         return get_module_entry_url('CLCAL');
     }
 }
Ejemplo n.º 4
0
 public function resolve(ResourceLocator $locator)
 {
     if ($locator->hasResourceId()) {
         $assignement_id = $locator->getResourceId();
         $url = new Url(get_module_url('CLWRK') . '/work_list.php');
         $url->addParam('assigId', (int) $assignement_id);
         return $url->toUrl();
     } else {
         return get_module_entry_url('CLWRK');
     }
 }
Ejemplo n.º 5
0
 public function resolve(ResourceLocator $locator)
 {
     if ($locator->hasResourceId()) {
         if ($locator->inGroup()) {
             // $resourceElements = explode( '/', ltrim( $locator->getResourceId(), '/') );
             return get_module_url('CLFRM') . "/viewtopic.php?topic=" . (int) ltrim($locator->getResourceId(), '/');
         } else {
             $resourceElements = explode('/', ltrim($locator->getResourceId(), '/'));
             if (count($resourceElements) == 1) {
                 return get_module_url('CLFRM') . "/viewforum.php?forum=" . (int) $resourceElements[0];
             } elseif (count($resourceElements) == 2) {
                 return get_module_url('CLFRM') . "/viewtopic.php?topic=" . (int) $resourceElements[1];
             } else {
                 return get_module_entry_url('CLFRM');
             }
         }
     } else {
         return get_module_entry_url('CLFRM');
     }
 }
Ejemplo n.º 6
0
 public function resolve(ResourceLocator $locator)
 {
     if ($locator->hasResourceId()) {
         $parts = explode('/', ltrim($locator->getResourceId(), '/'));
         if (count($parts) == 1) {
             $url = new Url(get_module_url('CLWIKI') . '/wiki.php');
             $url->addParam('wikiId', (int) $parts[0]);
             return $url->toUrl();
         } elseif (count($parts) == 2) {
             $url = new Url(get_module_url('CLWIKI') . '/page.php');
             $url->addParam('wikiId', (int) $parts[0]);
             $url->addParam('title', $parts[1]);
             return $url->toUrl();
         } else {
             return get_module_entry_url('CLWIKI');
         }
     } else {
         return get_module_entry_url('CLWIKI');
     }
 }
Ejemplo n.º 7
0
/**
 * Secure a backlink url by replacing it with a platform url, when the given 
 * url is not from the platform
 * @param string $url
 * @return string
 */
function secure_backlink_url($url)
{
    // cleanup url of potential html injection
    $url = strip_tags($url);
    // if url does not start with urlAppend or rootWeb, we need to "secure" it
    if (!preg_match("!^" . get_path('url') . "!", $url) && !preg_match("!^" . get_path('rootWeb') . "!", $url) && !preg_match("!^" . str_replace('http://', 'https://', get_path('rootWeb')) . "!", $url) && !preg_match("!^" . str_replace('http://', '', get_path('rootWeb')) . "!", $url)) {
        if (stristr($_SERVER['HTTP_HOST'], ':')) {
            $http_hostArr = explode(":", $_SERVER['HTTP_HOST']);
            $http_host = $http_hostArr[0];
        } else {
            $http_host = $_SERVER['HTTP_HOST'];
        }
        // if url starts with HTTP_HOST -> OK
        if (stristr($url, $http_host)) {
            return $url;
        } else {
            if (isset($GLOBALS['tlabelReq'])) {
                return Url::Contextualize(get_module_entry_url($GLOBALS['tlabelReq']));
            } elseif (claro_is_in_a_course()) {
                return get_path('clarolineRepositoryWeb') . 'course/index.php?cid=' . claro_get_current_course_id();
            } else {
                return get_path('url');
            }
        }
    } else {
        return $url;
    }
}
Ejemplo n.º 8
0
}
$nameTools = get_lang('Create/edit document');
$out = '';
$out .= claro_html_tool_title(array('mainTitle' => get_lang('Documents and Links'), 'subTitle' => get_lang('Create/edit document')));
/*========================================================================
CREATE DOCUMENT
========================================================================*/
if ($cmd == 'rqMkHtml') {
    $out .= '<form action="' . claro_htmlspecialchars(get_module_entry_url('CLDOC')) . '" method="post">' . "\n" . claro_form_relay_context() . "\n" . '<input type="hidden" name="cmd" value="exMkHtml" />' . "\n" . '<input type="hidden" name="cwd" value="' . claro_htmlspecialchars(strip_tags($cwd)) . '" />' . "\n" . '<p>' . "\n" . '<b>' . get_lang('Document name') . '&nbsp;: </b><br />' . "\n" . '<input type="text" name="fileName" size="80" />' . "\n" . '</p>' . "\n" . '<p>' . "\n" . '<b>' . get_lang('Document content') . '&nbsp;: </b>' . "\n";
    if (!empty($_REQUEST['htmlContent'])) {
        $content = $_REQUEST['htmlContent'];
    } else {
        $content = "";
    }
    $out .= claro_html_textarea_editor('htmlContent', $content);
    // the second argument _REQUEST['htmlContent'] for the case when we have to
    // get to the editor because of an error at creation
    // (eg forgot to give a file name)
    $out .= '</p>' . "\n" . '<p>' . "\n" . '<input type="submit" value="' . get_lang('Ok') . '" />&nbsp;' . claro_html_button(claro_htmlspecialchars(Url::Contextualize('./document.php?cmd=exChDir&amp;file=' . strip_tags($cwd))), get_lang('Cancel')) . '</p>' . "\n" . '</form>' . "\n";
} elseif ($cmd == "rqEditHtml" && !empty($file)) {
    if (is_parent_path($baseWorkDir, $file)) {
        $fileContent = implode("\n", file($baseWorkDir . $file));
    } else {
        claro_die('WRONG PATH');
    }
    $fileContent = get_html_body_content($fileContent);
    $out .= '<form action="' . claro_htmlspecialchars(get_module_entry_url('CLDOC')) . '" method="post">' . "\n" . claro_form_relay_context() . "\n" . '<input type="hidden" name="cmd" value="exEditHtml" />' . "\n" . '<input type="hidden" name="file" value="' . claro_htmlspecialchars(base64_encode($file)) . '" />' . "\n" . '<b>' . get_lang('Document name') . ' : </b><br />' . "\n" . $file . "\n" . '</p>' . "\n" . '<p>' . "\n" . '<b>' . get_lang('Document content') . ' : </b>' . "\n" . claro_html_textarea_editor('htmlContent', $fileContent) . "\n" . '</p>' . '<p>' . '<input type="submit" value="' . get_lang('Ok') . '" />&nbsp;' . "\n" . claro_html_button(claro_htmlspecialchars(Url::Contextualize('./document.php?cmd=rqEdit&file=' . base64_encode($file))), get_lang('Cancel')) . "\n" . '</p>' . "\n" . '</form>' . "\n";
}
$out .= '<br />' . "\n" . '<br />' . "\n";
$claroline->display->body->appendContent($out);
echo $claroline->display->render();
Ejemplo n.º 9
0
        if (current_user_is_allowed_to_send_message_to_user($userIdViewed)) {
            $out .= '<p><a href="' . claro_htmlspecialchars(Url::Contextualize(get_path('clarolineRepositoryWeb') . '/messaging/sendmessage.php?cmd=rqMessageToUser&userId=' . $userIdViewed)) . '">' . get_lang('Send a message') . '</a></p>';
        }
        $out .= '<hr noshade="noshade" size="1" />' . "\n";
    }
    if ($allowedToEditDef) {
        $out .= "\n\n" . '<div align="right">' . "\n" . '<form method="post" action="' . claro_htmlspecialchars($_SERVER['PHP_SELF'] . '?uInfo=' . $userIdViewed) . '">' . "\n" . claro_form_relay_context() . get_lang('Course administrator only') . ' : ' . '<input type="submit" name="viewDefList" value="' . get_lang('Define Headings') . '" />' . "\n" . '</form>' . "\n" . '<hr noshade="noshade" size="1" />' . "\n" . '</div>';
    }
    $catList = claro_user_info_get_course_user_info($userIdViewed);
    if ($catList) {
        foreach ($catList as $thisCat) {
            // Category title
            $out .= '<p>' . "\n" . '<b>' . $thisCat['title'] . '</b>' . "\n" . '</p>' . "\n" . '<blockquote>' . "\n";
            // Category content
            if ($thisCat['content']) {
                $out .= htmlize($thisCat['content']) . "\n";
            } else {
                $out .= '....';
            }
            // Edit command
            if ($allowedToEditContent) {
                $out .= '<br /><br />' . "\n" . '<a href="' . claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?editContent=' . $thisCat['catId'] . '&uInfo=' . $userIdViewed)) . '">' . '<img src="' . get_icon_url('edit') . '" alt="' . get_lang('Edit') . '" />' . '</a>' . "\n";
            }
            $out .= '</blockquote>' . "\n";
        }
    }
}
// Back button for each display mode (bottom)
$out .= '<p>' . "\n" . '<small>' . "\n" . '<a href="' . claro_htmlspecialchars(Url::Contextualize(get_module_entry_url('CLUSR'))) . '">' . '&lt;&lt;&nbsp;' . get_lang('Back to user list') . '</a>' . "\n" . '</small>' . "\n" . '</p>' . "\n";
$claroline->display->body->appendContent($out);
echo $claroline->display->render();
Ejemplo n.º 10
0
function disp_forum_breadcrumb($pagetype, $forum_id, $forum_name, $topic_id = 0, $topic_name = '')
{
    $bc = new BreadCrumbs();
    $bc->appendNode(new BreadCrumbsNode(get_lang('Forum index'), claro_htmlspecialchars(Url::Contextualize(get_module_entry_url('CLFRM')))));
    if (in_array($pagetype, array('viewforum', 'viewtopic', 'add', 'edit', 'reply', 'quote'))) {
        $bc->appendNode(new BreadCrumbsNode($forum_name, claro_htmlspecialchars(Url::Contextualize(get_module_url('CLFRM') . '/viewforum.php?forum=' . $forum_id))));
        switch ($pagetype) {
            case 'viewforum':
                break;
            case 'viewtopic':
                $bc->appendNode(new BreadCrumbsNode($topic_name));
                break;
            case 'add':
                $bc->appendNode(new BreadCrumbsNode(get_lang('New topic')));
                break;
            case 'edit':
                $bc->appendNode(new BreadCrumbsNode($topic_name, claro_htmlspecialchars(Url::Contextualize(get_module_url('CLFRM') . '/viewtopic.php?topic=' . $topic_id))));
                $bc->appendNode(new BreadCrumbsNode(get_lang('Edit post')));
                break;
            case 'quote':
                $bc->appendNode(new BreadCrumbsNode($topic_name, claro_htmlspecialchars(Url::Contextualize(get_module_url('CLFRM') . '/viewtopic.php?topic=' . $topic_id))));
                $bc->appendNode(new BreadCrumbsNode(get_lang('Reply')));
                break;
            case 'reply':
                $bc->appendNode(new BreadCrumbsNode($topic_name, claro_htmlspecialchars(Url::Contextualize(get_module_url('CLFRM') . '/viewtopic.php?topic=' . $topic_id))));
                $bc->appendNode(new BreadCrumbsNode(get_lang('Reply')));
                break;
        }
    } elseif ($pagetype == 'viewsearch') {
        $bc->appendNode(new BreadCrumbsNode(get_lang('Search result'), null));
    }
    // return claro_html_breadcrumbtrail($breadCrumbNameList, $breadCrumbUrlList, ' > ') . '<br />' ;
    return '<div class="breadcrumbTrails">' . $bc->render() . '</div>' . "\n";
}
Ejemplo n.º 11
0
/**
 * Create an html link to the given course or course tool
 * text and attributes
 * @param   string text
 * @param   string toolLabel
 * @param   array context (cid, gid)
 * @param   array attributes (optional)
 * @return  string
 */
function link_to_tool($text, $toolLabel = null, $context = null, $attributes = null)
{
    $url = get_module_entry_url($toolLabel);
    return link_to_claro($text, $url, $context, $attributes);
}
Ejemplo n.º 12
0
 protected function getManagerLinkList()
 {
     $courseManageToolLinkList = array();
     if ($this->viewMode != 'STUDENT') {
         $courseManageToolLinkList[] = '<a class="claroCmd" href="' . claro_htmlspecialchars(Url::Contextualize(get_path('clarolineRepositoryWeb') . 'course/tools.php', $this->currentCourseContext)) . '">' . '<img src="' . get_icon_url('edit') . '" alt="" /> ' . get_lang('Edit Tool list') . '</a>';
         $courseManageToolLinkList[] = '<a class="claroCmd" href="' . claro_htmlspecialchars(Url::Contextualize(get_path('clarolineRepositoryWeb') . 'course/settings.php', $this->currentCourseContext)) . '">' . '<img src="' . get_icon_url('settings') . '" alt="" /> ' . get_lang('Course settings') . '</a>';
         if (!ClaroCourse::isSessionCourse($this->courseId) && claro_is_allowed_to_create_course() && (get_conf('courseSessionAllowed', true) || claro_is_platform_admin())) {
             $courseManageToolLinkList[] = '<a class="claroCmd" href="' . claro_htmlspecialchars(Url::Contextualize(get_path('clarolineRepositoryWeb') . 'course/create.php', array('course_sourceCourseId' => $this->courseId))) . '">' . '<img src="' . get_icon_url('duplicate') . '" alt="" /> ' . get_lang("Create a session course") . '</a>';
         }
         if (get_conf('is_trackingEnabled')) {
             $courseManageToolLinkList[] = '<a class="claroCmd" href="' . claro_htmlspecialchars(Url::Contextualize(get_path('clarolineRepositoryWeb') . 'tracking/courseReport.php', $this->currentCourseContext)) . '">' . '<img src="' . get_icon_url('statistics') . '" alt="" /> ' . get_lang('Statistics') . '</a>';
         }
         $extraManageToolList = get_course_manage_module_list(true);
         if ($extraManageToolList) {
             foreach ($extraManageToolList as $extraManageTool) {
                 $courseManageToolLinkList[] = '<a class="claroCmd" href="' . claro_htmlspecialchars(Url::Contextualize(get_module_entry_url($extraManageTool['label']))) . '">' . '<img src="' . get_module_icon_url($extraManageTool['label'], $extraManageTool['icon'], 'settings') . '" alt="" /> ' . get_lang($extraManageTool['name']) . '</a>';
             }
         }
     }
     return $courseManageToolLinkList;
 }
Ejemplo n.º 13
0
        // Add CSV file of user link
        $advancedCmdList[] = array('img' => 'import_list', 'name' => get_lang('Add a user list'), 'url' => claro_htmlspecialchars(Url::Contextualize(get_module_url('CLUSR') . '/addcsvusers.php?addType=userTool')));
    }
    if ($can_export_user_list) {
        // Export CSV file of user link
        $advancedCmdList[] = array('img' => 'export', 'name' => get_lang('Export user list'), 'url' => claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?cmd=export')));
    }
    if ($can_import_user_class) {
        // Add a class link
        $advancedCmdList[] = array('img' => 'class', 'name' => get_lang('Enrol class'), 'url' => claro_htmlspecialchars(Url::Contextualize(get_module_url('CLUSR') . '/class_add.php')));
    }
    if ($can_send_message_to_course) {
        // Main group settings
        $cmdList[] = array('img' => 'mail_send', 'name' => get_lang("Send a message to the course"), 'url' => claro_htmlspecialchars(Url::Contextualize(get_path('clarolineRepositoryWeb') . 'messaging/sendmessage.php?cmd=rqMessageToCourse')));
    }
    $advancedCmdList[] = array('img' => 'group', 'name' => get_lang('Group management'), 'url' => claro_htmlspecialchars(Url::Contextualize(get_module_entry_url('CLGRP'))));
    $cmdList[] = array('img' => 'unenroll', 'name' => get_lang('Unregister all students'), 'url' => claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?cmd=unregister&user_id=allStudent')), 'params' => array('onclick' => 'return confirmationUnregisterAll();'));
    $courseObj = new Claro_Course(claro_get_current_course_id());
    $courseObj->load();
    $courseClassList = new Claro_CourseClassList($courseObj);
    $courseClassListIt = $courseClassList->getClassListIterator();
    if (count($courseClassListIt)) {
        $htmlHeadXtra[] = '<script>var mustConfirmClassDelete = true;</script>';
    } else {
        $htmlHeadXtra[] = '<script>var mustConfirmClassDelete = false;</script>';
    }
    $htmlHeadXtra[] = '<script type="text/javascript">

    function confirmationUnregisterAll ()
    {
        if (confirm(\'' . clean_str_for_javascript(get_lang("Are you sure you want to unregister all students from your course ?")) . '\'))
Ejemplo n.º 14
0
$menu['AdminClaroline'][] = '<a href="http://www.claroline.net/index.php?plugin=formidable&controller=forms&frm_action=preview&form=o4x38v">' . get_lang('Register my campus') . '</a>';
$menu['AdminClaroline'][] = '<a href="http://forum.claroline.net/">' . get_lang('Support forum') . '</a>';
$menu['AdminClaroline'][] = '<a href="clarolinenews.php">' . get_lang('Claroline.net news') . '</a>';
// Technical's administration menu
$menu['AdminTechnical'][] = '<a href="technical/phpInfo.php">' . get_lang('System Info') . '</a>';
$menu['AdminTechnical'][] = '<a href="technical/files_stats.php">' . get_lang('Files statistics') . '</a>';
$menu['AdminTechnical'][] = '<a href="../tracking/platform_report.php">' . get_lang('Platform statistics') . '</a>';
$menu['AdminTechnical'][] = '<a href="campusProblem.php">' . get_lang('Scan technical fault') . '</a>';
$menu['AdminTechnical'][] = '<a href="upgrade/index.php">' . get_lang('Upgrade') . '</a>';
// Communication's administration menu
$menu['Communication'][] = '<a href="../messaging/admin.php">' . get_lang('Internal messaging') . '</a>';
$adminModuleList = get_admin_module_list(true);
if (count($adminModuleList) > 0) {
    foreach ($adminModuleList as $module) {
        language::load_module_translation($module['label']);
        $menu['ExtraTools'][] = '<a href="' . get_module_entry_url($module['label']) . '">' . get_lang($module['name']) . '</a>';
    }
}
// Deal with interbreadcrumbs and title variable
$nameTools = get_lang('Administration');
// No sense because not allowed with claro_is_platform_admin(),
// but claro_is_platform_admin() should be later replaced by
// get_user_property ('can view admin menu')
$is_allowedToAdmin = claro_is_platform_admin();
// Is our installation system accessible ?
if (file_exists('../install/index.php') && !file_exists('../install/.htaccess')) {
    // If yes, warn the administrator
    $dialogBox->warning(get_block('blockWarningRemoveInstallDirectory'));
}
$register_globals_value = ini_get('register_globals');
// Is the php 'register_globals' param enable ?
Ejemplo n.º 15
0
function claro_html_document_breadcrumb($curDirPath)
{
    $curDirPathList = explode('/', $curDirPath);
    $urlTrail = '';
    $bc = new BreadCrumbs();
    foreach ($curDirPathList as $thisDir) {
        if (empty($thisDir)) {
            $bc->appendNode(new BreadCrumbsNode(get_lang('Root'), claro_htmlspecialchars(Url::Contextualize(get_module_entry_url('CLDOC')))));
        } else {
            $urlTrail .= '/' . $thisDir;
            $bc->appendNode(new BreadCrumbsNode(get_lang($thisDir), claro_htmlspecialchars(Url::Contextualize(get_module_entry_url('CLDOC') . '?cmd=exChDir&amp;file=' . base64_encode($urlTrail)))));
        }
    }
    if ($bc->size() < 2) {
        return '';
    } else {
        return '<div class="breadcrumbTrails">' . $bc->render() . '</div>' . "\n";
    }
}
Ejemplo n.º 16
0
 public function resolve(ResourceLocator $locator)
 {
     return get_module_entry_url($locator->getModuleLabel());
 }
Ejemplo n.º 17
0
require_once get_path('incRepositorySys') . '/lib/class.lib.php';
require_once get_path('incRepositorySys') . '/lib/course_user.lib.php';
claro_set_display_mode_available(true);
// move to kernel
$claroline = Claroline::getInstance();
// ------------- Business Logic ---------------------------
require_once 'lib/messagebox/inbox.lib.php';
if (!claro_is_user_authenticated()) {
    claro_disp_auth_form(true);
}
if (!claro_is_in_a_course() || !claro_is_course_manager() && !claro_is_platform_admin()) {
    claro_die(get_lang("Not allowed"));
}
$displayForm = FALSE;
$content = "";
$from = isset($_REQUEST['from']) ? get_module_entry_url(strtoupper($_REQUEST['from'])) : $_SERVER['PHP_SELF'];
//commande
$acceptedCmdList = array('exSendMessage');
if (isset($_REQUEST['cmd']) && in_array($_REQUEST['cmd'], $acceptedCmdList)) {
    if ($_REQUEST['cmd'] == 'exSendMessage') {
        /*
         * Explode the values of incorreo in groups and users
         */
        $userIdList = array();
        $groupIdList = array();
        $classIdList = array();
        foreach ($_REQUEST['incorreo'] as $thisIncorreo) {
            list($type, $elmtId) = explode(':', $thisIncorreo);
            switch ($type) {
                case 'CLASS':
                    $classIdList[] = $elmtId;