Verzeichnisstruktur phpBB-3.3.15
- Veröffentlicht
- 28.08.2024
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 |
posting.php
01 <?php
02 /**
03 *
04 * This file is part of the phpBB Forum Software package.
05 *
06 * @copyright (c) phpBB Limited <https://www.phpbb.com>
07 * @license GNU General Public License, version 2 (GPL-2.0)
08 *
09 * For full copyright and license information, please see
10 * the docs/CREDITS.txt file.
11 *
12 */
13
14 namespace phpbb\lock;
15
16 use phpbb\cache\driver\driver_interface as cache_interface;
17 use phpbb\config\config;
18
19 class posting
20 {
21 /** @var cache_interface */
22 private $cache;
23
24 /** @var config */
25 private $config;
26
27 /** @var string */
28 private $lock_name = '';
29
30 /**
31 * Constructor for posting lock
32 *
33 * @param cache_interface $cache
34 * @param config $config
35 */
36 public function __construct(cache_interface $cache, config $config)
37 {
38 $this->cache = $cache;
39 $this->config = $config;
40 }
41
42 /**
43 * Set lock name
44 *
45 * @param int $creation_time Creation time of form, must be checked already
46 * @param string $form_token Form token used for form, must be checked already
47 *
48 * @return void
49 */
50 private function set_lock_name(int $creation_time, string $form_token): void
51 {
52 $this->lock_name = sha1(((string) $creation_time) . $form_token) . '_posting_lock';
53 }
54
55 /**
56 * Acquire lock for current posting form submission
57 *
58 * @param int $creation_time Creation time of form, must be checked already
59 * @param string $form_token Form token used for form, must be checked already
60 *
61 * @return bool True if lock could be acquired, false if not
62 */
63 public function acquire(int $creation_time, string $form_token): bool
64 {
65 $this->set_lock_name($creation_time, $form_token);
66
67 // Lock is held for session, cannot acquire it unless special flag for testing is set
68 if ($this->cache->_exists($this->lock_name) && !$this->config->offsetExists('ci_tests_no_lock_posting'))
69 {
70 return false;
71 }
72
73 $this->cache->put($this->lock_name, true, $this->config['flood_interval']);
74
75 return true;
76 }
77 }
78