Cleaning files

skala
Julio Montoya 15 years ago
parent 0d38c2af1b
commit 5026842d95
  1. 23
      main/forum/download.php
  2. 44
      main/forum/editpost.php
  3. 6
      main/forum/forumconfig.inc.php

@ -1,29 +1,25 @@
<?php // $Id: download.php 12218 2007-05-01 18:27:14Z yannoo $
<?php
/* For licensing terms, see /license.txt */
/**
==============================================================================
* This file is responsible for passing requested documents to the browser.
* Html files are parsed to fix a few problems with URLs,
* but this code will hopefully be replaced soon by an Apache URL
* rewrite mechanism.
*
* @package dokeos.document
==============================================================================
* @package chamilo.document
*/
/*
==============================================================================
MAIN CODE
==============================================================================
*/
session_cache_limiter('public');
include('../inc/global.inc.php');
require_once '../inc/global.inc.php';
$this_section=SECTION_COURSES;
include(api_get_path(LIBRARY_PATH).'document.lib.php');
require_once('forumconfig.inc.php');
require_once api_get_path(LIBRARY_PATH).'document.lib.php';
require_once 'forumconfig.inc.php';
// IMPORTANT to avoid caching of documents
header('Expires: Wed, 01 Jan 1990 00:00:00 GMT');
@ -40,16 +36,14 @@ $doc_url = str_replace('///', '&', $doc_url);
$doc_url = str_replace(' ', '+', $doc_url);
$doc_url = str_replace('/..', '', $doc_url); //echo $doc_url;
if (! isset($_course))
{
if (! isset($_course)) {
api_not_allowed(true);
}
$full_file_name = api_get_path(SYS_COURSE_PATH).api_get_course_path().'/upload/forum/'.$doc_url;
//if the rewrite rule asks for a directory, we redirect to the document explorer
if (is_dir($full_file_name))
{
if (is_dir($full_file_name)) {
//remove last slash if present
//$doc_url = ($doc_url{strlen($doc_url)-1}=='/')?substr($doc_url,0,strlen($doc_url)-1):$doc_url;
//mod_rewrite can change /some/path/ to /some/path// in some cases, so clean them all off (René)
@ -75,8 +69,7 @@ $row= Database::fetch_array($result);
$forum_thread_visibility=api_get_item_visibility(api_get_course_info($course_code),TOOL_FORUM_THREAD,$row['thread_id']);
$forum_forum_visibility=api_get_item_visibility(api_get_course_info($course_code),TOOL_FORUM,$row['forum_id']);
if ($forum_thread_visibility==1 && $forum_forum_visibility==1)
{
if ($forum_thread_visibility==1 && $forum_forum_visibility==1) {
DocumentManager::file_send_for_download($full_file_name,TRUE, $row['filename']);
}
exit;

@ -34,41 +34,34 @@
*/
/*
==============================================================================
INIT SECTION
==============================================================================
*/
// name of the language file that needs to be included
$language_file = array (
'forum',
'group'
);
$language_file = array ('forum','group');
// including the global dokeos file
require ('../inc/global.inc.php');
require_once('../gradebook/lib/gradebook_functions.inc.php');
require_once('../gradebook/lib/be/gradebookitem.class.php');
require_once('../gradebook/lib/be/evaluation.class.php');
require_once('../gradebook/lib/be/abstractlink.class.php');
require_once('../gradebook/lib/gradebook_functions.inc.php');
require_once '../inc/global.inc.php';
require_once '../gradebook/lib/gradebook_functions.inc.php';
require_once '../gradebook/lib/be/gradebookitem.class.php';
require_once '../gradebook/lib/be/evaluation.class.php';
require_once '../gradebook/lib/be/abstractlink.class.php';
require_once '../gradebook/lib/gradebook_functions.inc.php';
// the section (tabs)
$this_section=SECTION_COURSES;
// notice for unauthorized people.
api_protect_course_script(true);
// including additional library scripts
require_once (api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php');
include_once (api_get_path(LIBRARY_PATH).'groupmanager.lib.php');
require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php';
require_once api_get_path(LIBRARY_PATH).'groupmanager.lib.php';
$nameTools=get_lang('ToolForum');
/*
-----------------------------------------------------------
Including necessary files
-----------------------------------------------------------
*/
include('forumconfig.inc.php');
include('forumfunction.inc.php');
include 'forumconfig.inc.php';
include 'forumfunction.inc.php';
// javascript
$htmlHeadXtra[] = '<script>
@ -86,14 +79,10 @@ $htmlHeadXtra[] = '<script>
</script>';
/*
==============================================================================
MAIN DISPLAY SECTION
==============================================================================
*/
/*
-----------------------------------------------------------
Retrieving forum and forum categorie information
-----------------------------------------------------------
*/
// we are getting all the information about the current forum and forum category.
// note pcool: I tried to use only one sql statement (and function) for this
@ -103,9 +92,7 @@ $current_forum=get_forum_information($_GET['forum']); // note: this has to be va
$current_forum_category=get_forumcategory_information($current_forum['forum_category']);
$current_post=get_post_information($_GET['post']);
/*
-----------------------------------------------------------
Header and Breadcrumbs
-----------------------------------------------------------
*/
if (isset($_SESSION['gradebook'])){
$gradebook= $_SESSION['gradebook'];
@ -136,9 +123,7 @@ if (!empty($_SESSION['toolgroup'])) {
$interbreadcrumb[]=array("url" => "javascript: void (0);","name" => get_lang('EditPost'));
}
/*
-----------------------------------------------------------
Resource Linker
-----------------------------------------------------------
*/
if (isset($_POST['add_resources']) AND $_POST['add_resources']==get_lang('Resources')) {
$_SESSION['formelements']=$_POST;
@ -148,9 +133,7 @@ if (isset($_POST['add_resources']) AND $_POST['add_resources']==get_lang('Resour
}
$table_link = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
/*
-----------------------------------------------------------
Header
-----------------------------------------------------------
*/
//are we in a lp ?
$origin = '';
@ -166,9 +149,7 @@ if ($origin=='learnpath') {
}
//echo '<link href="forumstyles.css" rel="stylesheet" type="text/css" />';
/*
-----------------------------------------------------------
Is the user allowed here?
-----------------------------------------------------------
*/
// the user is not allowed here if
// 1. the forumcategory, forum or thread is invisible (visibility==0)
@ -214,9 +195,7 @@ if ($origin!='learnpath') {
}
/*
-----------------------------------------------------------
Display Forum Category and the Forum information
-----------------------------------------------------------
*/
echo "<table class=\"data_table\" width='100%'>\n";
// the forum category
@ -249,7 +228,6 @@ if (!empty($values) and isset($_POST['SubmitPost'])) {
}
}
}
// footer
if ($origin!='learnpath') {

@ -12,9 +12,7 @@
/*
-----------------------------------------------------------
Database Variables
-----------------------------------------------------------
*/
$table_categories = Database :: get_course_table(TABLE_FORUM_CATEGORY);
$table_forums = Database :: get_course_table(TABLE_FORUM);
@ -29,9 +27,7 @@ $table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY);
$table_users = Database :: get_main_table(TABLE_MAIN_USER);
/*
-----------------------------------------------------------
Constants
-----------------------------------------------------------
*/
define('TOOL_FORUM_CATEGORY','forum_category');
//define('TOOL_FORUM','forum'); defined in main_api
@ -40,10 +36,8 @@ define('TOOL_FORUM_POST','forum_post');
define('TOOL_FORUM_ATTACH','forum_attachment');
define('TOOL_FORUM_THREAD_QUALIFY','forum_thread_qualify');
/*
-----------------------------------------------------------
Some configuration settings
(these can go to the dokeos config settings afterwards)
-----------------------------------------------------------
*/
// if this setting is true then an I-frame will be displayed when replying
$forum_setting['show_thread_iframe_on_reply']=true;

Loading…
Cancel
Save