Format code + add api_get_cidreq + use api_get_path()

1.10.x
jmontoya 10 years ago
parent 6a6ac9896e
commit a9322ed1b1
  1. 4
      main/dropbox/dropbox_class.inc.php
  2. 2
      main/dropbox/dropbox_download.php
  3. 9
      main/dropbox/dropbox_functions.inc.php
  4. 29
      main/dropbox/dropbox_init.inc.php
  5. 33
      main/dropbox/index.php

@ -689,8 +689,8 @@ class Dropbox_Person
/**
* Updates feedback for received work of this person with id=$id
*
* @param unknown_type $id
* @param unknown_type $text
* @param string $id
* @param string $text
*/
function updateFeedback($id, $text)
{

@ -57,7 +57,7 @@ if (isset($_GET['cat_id']) &&
while ($row = Database::fetch_array($result)) {
$files_to_download[] = $row['id'];
}
if (!is_array($files_to_download) OR empty($files_to_download)) {
if (!is_array($files_to_download) || empty($files_to_download)) {
header('location: index.php?view='.Security::remove_XSS($_GET['sent_received']).'&error=ErrorNoFilesInFolder');
exit;
}

@ -329,7 +329,7 @@ function get_dropbox_categories($filter = '')
$result = Database::query($sql);
while ($row = Database::fetch_array($result)) {
if (($filter == 'sent' AND $row['sent'] == 1) OR ($filter == 'received' AND $row['received'] == 1) OR $filter == '') {
if (($filter == 'sent' && $row['sent'] == 1) || ($filter == 'received' && $row['received'] == 1) || $filter == '') {
$return_array[$row['cat_id']] = $row;
}
}
@ -507,7 +507,7 @@ function display_addcategory_form($category_name = '', $id = '', $action)
$form = new FormValidator('add_new_category', 'post', api_get_self().'?view='.Security::remove_XSS($_GET['view']));
$form->addElement('header', $title);
if (isset($id) AND $id != '') {
if (isset($id) && $id != '') {
$form->addElement('hidden', 'edit_id', intval($id));
}
$form->addElement('hidden', 'action', Security::remove_XSS($action));
@ -715,7 +715,10 @@ function getUserNameFromId($id)
$result = Database::query($sql);
$res = Database::fetch_array($result);
if (!$res) return false;
if (!$res) {
return false;
}
return stripslashes($res['name']);
}

@ -278,8 +278,7 @@ if (dropbox_cnf('allowOverwrite')) {
$javascript .= "
</script>";
$htmlHeadXtra[] = $javascript;
$htmlHeadXtra[] =
"<script type=\"text/javascript\">
$htmlHeadXtra[] ="<script>
function confirmation (name)
{
if (confirm(\" ". get_lang("AreYouSureToDeleteJS") ." \"+ name + \" ?\"))
@ -302,6 +301,7 @@ if (!$view || $view == 'received') {
$part = 'sent';
} else {
header('location: index.php?view='.$view.'&error=Error');
exit;
}
if (($postAction == 'download_received' || $postAction == 'download_sent') and !$_POST['store_feedback']) {
@ -331,25 +331,40 @@ if ((!$is_allowed_in_course || !$is_course_member) && !api_is_allowed_to_edit(nu
/* BREADCRUMBS */
if ($view == 'received') {
$interbreadcrumb[] = array('url' => '../dropbox/index.php', 'name' => get_lang('Dropbox', ''));
$interbreadcrumb[] = array(
'url' => api_get_path(WEB_CODE_PATH).'dropbox/index.php?'.api_get_cidreq(),
'name' => get_lang('Dropbox', ''),
);
$nameTools = get_lang('ReceivedFiles');
if ($action == 'addreceivedcategory') {
$interbreadcrumb[] = array('url' => '../dropbox/index.php?view=received', 'name' => get_lang('ReceivedFiles'));
$interbreadcrumb[] = array(
'url' => api_get_path(WEB_CODE_PATH).'dropbox/index.php?view=received&'.api_get_cidreq(),
'name' => get_lang('ReceivedFiles'),
);
$nameTools = get_lang('AddNewCategory');
}
}
if ($view == 'sent' || empty($view)) {
$interbreadcrumb[] = array('url' => '../dropbox/index.php', 'name' => get_lang('Dropbox', ''));
$interbreadcrumb[] = array(
'url' => api_get_path(WEB_CODE_PATH).'dropbox/index.php?'.api_get_cidreq(),
'name' => get_lang('Dropbox')
);
$nameTools = get_lang('SentFiles');
if ($action == 'addsentcategory') {
$interbreadcrumb[] = array('url' => '../dropbox/index.php?view=sent', 'name' => get_lang('SentFiles'));
$interbreadcrumb[] = array(
'url' => api_get_path(WEB_CODE_PATH).'dropbox/index.php?view=sent&'.api_get_cidreq(),
'name' => get_lang('SentFiles'),
);
$nameTools = get_lang('AddNewCategory');
}
if ($action == 'add') {
$interbreadcrumb[] = array ('url' => '../dropbox/index.php?view=sent', 'name' => get_lang('SentFiles'));
$interbreadcrumb[] = array(
'url' => api_get_path(WEB_CODE_PATH).'dropbox/index.php?view=sent&'.api_get_cidreq(),
'name' => get_lang('SentFiles'),
);
$nameTools = get_lang('UploadNewFile');
}
}

@ -158,11 +158,11 @@ if (($action == 'deletereceivedcategory' || $action == 'deletesentcategory') AND
// (which also happens in dropbox_init.inc.php
if (!isset($_POST['feedback']) && (
strstr($postAction, 'move_received') OR
strstr($postAction, 'move_sent') OR
$postAction == 'delete_received' OR
$postAction == 'download_received' OR
$postAction == 'delete_sent' OR
strstr($postAction, 'move_received') ||
strstr($postAction, 'move_sent') ||
$postAction == 'delete_received' ||
$postAction == 'download_received' ||
$postAction == 'delete_sent' ||
$postAction == 'download_sent')
) {
$display_message = handle_multiple_actions();
@ -286,10 +286,13 @@ if ($action != 'add') {
?>
<ul class="nav nav-tabs">
<li <?php if (!$view || $view == 'sent') { echo 'class="active"'; } ?> >
<a href="index.php?<?php echo api_get_cidreq(); ?>&view=sent" ><?php echo get_lang('SentFiles'); ?></a>
<a href="<?php echo api_get_path(WEB_CODE_PATH).'dropbox/'; ?>index.php?<?php echo api_get_cidreq(); ?>&view=sent" >
<?php echo get_lang('SentFiles'); ?>
</a>
</li>
<li <?php if ($view == 'received') { echo 'class="active"'; } ?> >
<a href="index.php?<?php echo api_get_cidreq(); ?>&view=received" ><?php echo get_lang('ReceivedFiles'); ?></a>
<a href="<?php echo api_get_path(WEB_CODE_PATH).'dropbox/'; ?>index.php?<?php echo api_get_cidreq(); ?>&view=received" >
<?php echo get_lang('ReceivedFiles'); ?></a>
</li>
</ul>
<?php
@ -373,9 +376,9 @@ if ($action != 'add') {
$new_icon = '&nbsp;'.Display::return_icon('new_dropbox_message.png', get_lang('New'),'',ICON_SIZE_SMALL);
}
$link_open = '<a href="dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'">';
$link_open = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'">';
$dropbox_file_data[] = $link_open.DocumentManager::build_document_icon_tag('file', $dropbox_file->title).'</a>';
$dropbox_file_data[] = '<a href="dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'&action=download">'.
$dropbox_file_data[] = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'&action=download">'.
Display::return_icon('save.png', get_lang('Download'), array('style' => 'float:right;'),ICON_SIZE_SMALL).'</a>'.$link_open.$dropbox_file->title.'</a>'.$new_icon.'<br />'.$dropbox_file->description;
$file_size = $dropbox_file->filesize;
$dropbox_file_data[] = format_file_size($file_size);
@ -395,7 +398,7 @@ if ($action != 'add') {
if ($action == 'viewfeedback' AND isset($_GET['id']) and is_numeric($_GET['id']) AND $dropbox_file->id == $_GET['id']) {
$action_icons .= "</td></tr>"; // Ending the normal row of the sortable table
$action_icons .= '<tr><td colspan="2"><a href="index.php?"'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory."&view_sent_category=".$viewSentCategory."&view=".$view.'&'.$sort_params."\">".get_lang('CloseFeedback')."</a></td><td colspan=\"7\">".feedback($dropbox_file->feedback2)."</td></tr>";
$action_icons .= '<tr><td colspan="2"><a href="'.api_get_path(WEB_CODE_PATH).'dropbox/index.php?"'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory."&view_sent_category=".$viewSentCategory."&view=".$view.'&'.$sort_params."\">".get_lang('CloseFeedback')."</a></td><td colspan=\"7\">".feedback($dropbox_file->feedback2)."</td></tr>";
}
if (api_get_session_id() == 0) {
$dropbox_file_data[] = $action_icons;
@ -423,7 +426,7 @@ if ($action != 'add') {
// The icon of the category
$link_open = '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$category['cat_id'].'&view_sent_category='.$viewSentCategory.'&view='.$view.'">';
$dropbox_category_data[] = $link_open.DocumentManager::build_document_icon_tag('folder', $category['cat_name']).'</a>';
$dropbox_category_data[] = '<a href="dropbox_download.php?'.api_get_cidreq().'&cat_id='.$category['cat_id'].'&action=downloadcategory&sent_received=received">'.Display::return_icon('save_pack.png', get_lang('Save'), array('style' => 'float:right;'),ICON_SIZE_SMALL).'</a>'.$link_open.$category['cat_name'].'</a>';
$dropbox_category_data[] = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&cat_id='.$category['cat_id'].'&action=downloadcategory&sent_received=received">'.Display::return_icon('save_pack.png', get_lang('Save'), array('style' => 'float:right;'),ICON_SIZE_SMALL).'</a>'.$link_open.$category['cat_name'].'</a>';
$dropbox_category_data[] = '';
$dropbox_category_data[] = '';
$dropbox_category_data[] = '';
@ -540,9 +543,9 @@ if ($action != 'add') {
if ($view_dropbox_category_sent == $dropbox_file->category) {
$dropbox_file_data[] = $dropbox_file->id;
$link_open = '<a href="dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'">';
$link_open = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'">';
$dropbox_file_data[] = $link_open.DocumentManager::build_document_icon_tag('file', $dropbox_file->title).'</a>';
$dropbox_file_data[] = '<a href="dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'&action=download">'.
$dropbox_file_data[] = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'&action=download">'.
Display::return_icon('save.png', get_lang('Save'), array('style' => 'float:right;'),ICON_SIZE_SMALL).'</a>'.$link_open.$dropbox_file->title.'</a><br />'.$dropbox_file->description;
$file_size = $dropbox_file->filesize;
$dropbox_file_data[] = format_file_size($file_size);
@ -567,7 +570,7 @@ if ($action != 'add') {
if ($action == 'viewfeedback' && isset($_GET['id']) && is_numeric($_GET['id']) && $dropbox_file->id == $_GET['id']) {
$action_icons .= "</td></tr>\n"; // ending the normal row of the sortable table
$action_icons .= "<tr><td colspan=\"2\">";
$action_icons .= "<a href=\"index.php?".api_get_cidreq()."&view_received_category=".$viewReceivedCategory."&view_sent_category=".$viewSentCategory."&view=".$view.'&'.$sort_params."\">".get_lang('CloseFeedback')."</a>";
$action_icons .= "<a href=\"".api_get_path(WEB_CODE_PATH)."dropbox/index.php?".api_get_cidreq()."&view_received_category=".$viewReceivedCategory."&view_sent_category=".$viewSentCategory."&view=".$view.'&'.$sort_params."\">".get_lang('CloseFeedback')."</a>";
$action_icons .= "</td><td colspan=\"7\">".feedback($dropbox_file->feedback2)."</td></tr>";
}
$dropbox_file_data[] = $action_icons;
@ -591,7 +594,7 @@ if ($action != 'add') {
// This is where the checkbox icon for the files appear.
$link_open = '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$category['cat_id'].'&view='.$view.'">';
$dropbox_category_data[] = $link_open.DocumentManager::build_document_icon_tag('folder', Security::remove_XSS($category['cat_name'])).'</a>';
$dropbox_category_data[] = '<a href="dropbox_download.php?'.api_get_cidreq().'&cat_id='.$category['cat_id'].'&action=downloadcategory&sent_received=sent">'.Display::return_icon('save_pack.png', get_lang('Save'), array('style' => 'float:right;'),ICON_SIZE_SMALL).'</a>'.$link_open.Security::remove_XSS($category['cat_name']).'</a>';
$dropbox_category_data[] = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&cat_id='.$category['cat_id'].'&action=downloadcategory&sent_received=sent">'.Display::return_icon('save_pack.png', get_lang('Save'), array('style' => 'float:right;'),ICON_SIZE_SMALL).'</a>'.$link_open.Security::remove_XSS($category['cat_name']).'</a>';
//$dropbox_category_data[] = '';
$dropbox_category_data[] = '';
//$dropbox_category_data[] = '';

Loading…
Cancel
Save