|
@@ 1468-1491 (lines=24) @@
|
| 1465 |
|
$attachment_event = Database::query($sql); |
| 1466 |
|
$attachment_event = Database::fetch_object($attachment_event); |
| 1467 |
|
|
| 1468 |
|
if (file_exists($origin_path.$attachment_event->path) && |
| 1469 |
|
!is_dir($origin_path.$attachment_event->path) |
| 1470 |
|
) { |
| 1471 |
|
$new_filename = uniqid(''); //ass seen in the add_agenda_attachment_file() function in agenda.inc.php |
| 1472 |
|
$copy_result = copy( |
| 1473 |
|
$origin_path.$attachment_event->path, |
| 1474 |
|
$destination_path.$new_filename |
| 1475 |
|
); |
| 1476 |
|
//$copy_result = true; |
| 1477 |
|
if ($copy_result) { |
| 1478 |
|
$table_attachment = Database::get_course_table(TABLE_AGENDA_ATTACHMENT); |
| 1479 |
|
|
| 1480 |
|
$params = [ |
| 1481 |
|
'c_id' => $this->destination_course_id, |
| 1482 |
|
'path' => self::DBUTF8($new_filename), |
| 1483 |
|
'comment' => self::DBUTF8($attachment_event->comment), |
| 1484 |
|
'size' => isset($attachment_event->size) ? $attachment_event->size : '', |
| 1485 |
|
'filename' => isset($attachment_event->filename) ? $attachment_event->filename : '', |
| 1486 |
|
'agenda_id' => $new_event_id, |
| 1487 |
|
]; |
| 1488 |
|
$id = Database::insert($table_attachment, $params); |
| 1489 |
|
if ($id) { |
| 1490 |
|
$sql = "UPDATE $table_attachment SET id = iid WHERE iid = $id"; |
| 1491 |
|
Database::query($sql); |
| 1492 |
|
} |
| 1493 |
|
} |
| 1494 |
|
} |
|
@@ 1495-1522 (lines=28) @@
|
| 1492 |
|
} |
| 1493 |
|
} |
| 1494 |
|
} |
| 1495 |
|
} else { |
| 1496 |
|
// get the info of the file |
| 1497 |
|
if (!empty($event->attachment_path) && |
| 1498 |
|
is_file($origin_path.$event->attachment_path) && |
| 1499 |
|
is_readable($origin_path.$event->attachment_path) |
| 1500 |
|
) { |
| 1501 |
|
$new_filename = uniqid(''); //ass seen in the add_agenda_attachment_file() function in agenda.inc.php |
| 1502 |
|
$copy_result = copy( |
| 1503 |
|
$origin_path.$event->attachment_path, |
| 1504 |
|
$destination_path.$new_filename |
| 1505 |
|
); |
| 1506 |
|
if ($copy_result) { |
| 1507 |
|
$table_attachment = Database::get_course_table(TABLE_AGENDA_ATTACHMENT); |
| 1508 |
|
|
| 1509 |
|
$params = [ |
| 1510 |
|
'c_id' => $this->destination_course_id, |
| 1511 |
|
'path' => self::DBUTF8($new_filename), |
| 1512 |
|
'comment' => self::DBUTF8($event->attachment_comment), |
| 1513 |
|
'size' => isset($event->size) ? $event->size : '', |
| 1514 |
|
'filename' => isset($event->filename) ? $event->filename : '', |
| 1515 |
|
'agenda_id' => $new_event_id, |
| 1516 |
|
]; |
| 1517 |
|
$id = Database::insert($table_attachment, $params); |
| 1518 |
|
|
| 1519 |
|
if ($id) { |
| 1520 |
|
$sql = "UPDATE $table_attachment SET id = iid WHERE iid = $id"; |
| 1521 |
|
Database::query($sql); |
| 1522 |
|
} |
| 1523 |
|
} |
| 1524 |
|
} |
| 1525 |
|
} |