Verzeichnisstruktur phpBB-3.2.0
- Veröffentlicht
- 06.01.2017
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
manager.php
001 <?php
002 /**
003 *
004 * This file is part of the phpBB Forum Software package.
005 *
006 * @copyright (c) phpBB Limited <https://www.phpbb.com>
007 * @license GNU General Public License, version 2 (GPL-2.0)
008 *
009 * For full copyright and license information, please see
010 * the docs/CREDITS.txt file.
011 *
012 */
013
014 namespace phpbb\attachment;
015
016 /**
017 * Attachment manager
018 */
019 class manager
020 {
021 /** @var delete Attachment delete class */
022 protected $delete;
023
024 /** @var resync Attachment resync class */
025 protected $resync;
026
027 /** @var upload Attachment upload class */
028 protected $upload;
029
030 /**
031 * Constructor for attachment manager
032 *
033 * @param delete $delete Attachment delete class
034 * @param resync $resync Attachment resync class
035 * @param upload $upload Attachment upload class
036 */
037 public function __construct(delete $delete, resync $resync, upload $upload)
038 {
039 $this->delete = $delete;
040 $this->resync = $resync;
041 $this->upload = $upload;
042 }
043
044 /**
045 * Wrapper method for deleting attachments
046 *
047 * @param string $mode can be: post|message|topic|attach|user
048 * @param mixed $ids can be: post_ids, message_ids, topic_ids, attach_ids, user_ids
049 * @param bool $resync set this to false if you are deleting posts or topics
050 *
051 * @return int|bool Number of deleted attachments or false if something
052 * went wrong during attachment deletion
053 */
054 public function delete($mode, $ids, $resync = true)
055 {
056 return $this->delete->delete($mode, $ids, $resync);
057 }
058
059 /**
060 * Wrapper method for deleting attachments from filesystem
061 *
062 * @param string $filename Filename of attachment
063 * @param string $mode Delete mode
064 * @param bool $entry_removed Whether entry was removed. Defaults to false
065 * @return bool True if file was removed, false if not
066 */
067 public function unlink($filename, $mode = 'file', $entry_removed = false)
068 {
069 return $this->delete->unlink_attachment($filename, $mode, $entry_removed);
070 }
071
072 /**
073 * Wrapper method for resyncing specified type
074 *
075 * @param string $type Type of resync
076 * @param array $ids IDs to resync
077 */
078 public function resync($type, $ids)
079 {
080 $this->resync->resync($type, $ids);
081 }
082
083 /**
084 * Wrapper method for uploading attachment
085 *
086 * @param string $form_name The form name of the file upload input
087 * @param int $forum_id The id of the forum
088 * @param bool $local Whether the file is local or not
089 * @param string $local_storage The path to the local file
090 * @param bool $is_message Whether it is a PM or not
091 * @param array $local_filedata An file data object created for the local file
092 *
093 * @return array File data array
094 */
095 public function upload($form_name, $forum_id, $local = false, $local_storage = '', $is_message = false, $local_filedata = [])
096 {
097 return $this->upload->upload($form_name, $forum_id, $local, $local_storage, $is_message, $local_filedata);
098 }
099 }
100