Adding UTC support in dropbox see #2248

skala
Julio Montoya 15 years ago
parent b4dd23c37b
commit cc10ae592a
  1. 12
      main/dropbox/dropbox_class.inc.php
  2. 10
      main/dropbox/dropbox_functions.inc.php
  3. 5
      main/dropbox/dropbox_submit.php
  4. 6
      main/dropbox/index.php

@ -103,7 +103,7 @@ class Dropbox_Work {
$this->title = $title;
$this->description = $description;
$this->author = api_get_person_name($_user['firstName'], $_user['lastName']);
$this->last_upload_date = date('Y-m-d H:i:s', time());
$this->last_upload_date = api_get_utc_datetime();
// Check if object exists already. If it does, the old object is used
// with updated information (authors, descriptio, upload_date)
@ -286,17 +286,13 @@ class Dropbox_SentWork extends Dropbox_Work
// Insert data in dropbox_post and dropbox_person table for each recipient
foreach ($this->recipients as $rec) {
$sql = "INSERT INTO ".$dropbox_cnf['tbl_post']."
(file_id, dest_user_id, session_id)
$sql = "INSERT INTO ".$dropbox_cnf['tbl_post']." (file_id, dest_user_id, session_id)
VALUES ('".Database::escape_string($this->id)."', '".Database::escape_string($rec['id'])."', ".intval($_SESSION['id_session']).")";
$result = Database::query($sql); // If work already exists no error is generated
// Insert entries into person table
$sql = "INSERT INTO ".$dropbox_cnf['tbl_person']."
(file_id, user_id)
VALUES ('".Database::escape_string($this->id)."'
, '".Database::escape_string($rec['id'])."'
)";
$sql = "INSERT INTO ".$dropbox_cnf['tbl_person']." (file_id, user_id)
VALUES ('".Database::escape_string($this->id)."', '".Database::escape_string($rec['id'])."')";
// Do not add recipient in person table if mailing zip or just upload.
if (!$justSubmit) {

@ -958,7 +958,7 @@ function feedback($array) {
*/
function format_feedback($feedback) {
$output .= display_user_link_work($feedback['author_user_id']);
$output .= '&nbsp;&nbsp;['.$feedback['feedback_date'].']<br />';
$output .= '&nbsp;&nbsp;'.api_convert_and_format_date($feedback['feedback_date'], DATE_TIME_FORMAT_LONG).'<br />';
$output .= '<div style="padding-top:6px">'.nl2br($feedback['feedback']).'</div><hr size="1" noshade/><br />';
return $output;
}
@ -998,10 +998,8 @@ function feedback_form() {
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @version march 2006
*/
function store_feedback()
{
global $dropbox_cnf;
global $_user;
function store_feedback() {
global $dropbox_cnf;
if (!is_numeric($_GET['id'])) {
return get_lang('FeedbackError');
@ -1011,7 +1009,7 @@ function store_feedback()
return get_lang('PleaseTypeText');
} else {
$sql="INSERT INTO ".$dropbox_cnf['tbl_feedback']." (file_id, author_user_id, feedback, feedback_date) VALUES
('".Database::escape_string($_GET['id'])."','".Database::escape_string($_user['user_id'])."','".Database::escape_string($_POST['feedback'])."',NOW())";
('".Database::escape_string($_GET['id'])."','".api_get_user_id()."','".Database::escape_string($_POST['feedback'])."', '".api_get_utc_datetime()."')";
Database::query($sql);
return get_lang('DropboxFeedbackStored');
}

@ -391,11 +391,10 @@ if (isset($_GET['mailingIndex'])) { // examine or send
}
}
$sendDT = addslashes(date('Y-m-d H:i:s', time()));
$sendDT = api_get_utc_datetime();
// set filesize to zero on send, to avoid 2nd send (see index.php)
$sql = "UPDATE ".dropbox_cnf("tbl_file")."
SET filesize = '0'
, upload_date = '".$sendDT."', last_upload_date = '".$sendDT."'
SET filesize = '0' , upload_date = '".$sendDT."', last_upload_date = '".$sendDT."'
WHERE id='".addslashes($mailing_item->id)."'";
$result = Database::query($sql);
} elseif ($mailing_item->filesize != 0) {

@ -87,6 +87,8 @@ Version 1.3 (Patrick Cool)
Version 1.4 (Yannick Warnier)
-----------------------------
- removed all self-built database tables names
*/
/* INIT SECTION */
@ -429,7 +431,7 @@ if ($_GET['action'] != 'add') {
$dropbox_file_data[] = $dropbox_file->author;
//$dropbox_file_data[] = $dropbox_file->description;
$last_upload_date = api_get_local_time($dropbox_file->last_upload_date, null, date_default_timezone_get());
$last_upload_date = api_get_local_time($dropbox_file->last_upload_date);
$dropbox_file_data[] = date_to_str_ago($last_upload_date).'<br /><span class="dropbox_date">'.api_format_date($last_upload_date).'</span>';
$action_icons = check_number_feedback($dropbox_file->id, $number_feedback).' '.get_lang('Feedback').'
@ -575,7 +577,7 @@ if ($_GET['action'] != 'add') {
}
$receivers_celldata = trim(trim($receivers_celldata), ','); // Removing the trailing comma.
$dropbox_file_data[] = $receivers_celldata;
$last_upload_date = api_get_local_time($dropbox_file->last_upload_date, null, date_default_timezone_get());
$last_upload_date = api_get_local_time($dropbox_file->last_upload_date);
$dropbox_file_data[] = date_to_str_ago($last_upload_date).'<br /><span class="dropbox_date">'.api_format_date($last_upload_date).'</span>';
//$dropbox_file_data[] = $dropbox_file->author;

Loading…
Cancel
Save