-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
164 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,106 +1,106 @@ | ||
<?php | ||
/** | ||
* | ||
* Date Topic Starter Template. An extension for the phpBB Forum Software package. | ||
* | ||
* @copyright (c) 2018, phpBB Studio, https://www.phpbbstudio.com | ||
* @license GNU General Public License, version 2 (GPL-2.0) | ||
* | ||
*/ | ||
|
||
namespace phpbbstudio\dtst\core; | ||
|
||
/** | ||
* Date Topic Starter Template's helper service. | ||
*/ | ||
class operator | ||
{ | ||
/** @var \phpbb\db\driver\driver_interface */ | ||
protected $db; | ||
|
||
/** | ||
* Constructor | ||
* | ||
* @param \phpbb\db\driver\driver_interface $db Database object | ||
* @access public | ||
*/ | ||
public function __construct(\phpbb\db\driver\driver_interface $db) | ||
{ | ||
$this->db = $db; | ||
} | ||
|
||
/** | ||
* Returns the SQL main SELECT statement used in various places. | ||
* | ||
* @param string $dtst_mode the SELECT data to be used on purpose | ||
* @param int $forum_id the forum ID to use on purpose | ||
* @return string $sql the DBAL SELECT statement | ||
* @access protected | ||
*/ | ||
protected function dtst_sql($dtst_mode, $forum_id) | ||
{ | ||
$sql = 'SELECT ' . $dtst_mode . ' | ||
FROM ' . FORUMS_TABLE . ' | ||
WHERE dtst_f_enable = ' . true . ' | ||
AND forum_id = ' . (int) $forum_id; | ||
|
||
return $sql; | ||
} | ||
|
||
/** | ||
* Check if Date Topic Starter Template is enabled for this forum | ||
* | ||
* @param string $dtst_mode the SELECTed data to be used on purpose | ||
* @param int $forum_id the forum ID to use | ||
* @return bool | ||
* @access public | ||
*/ | ||
public function forum_dtst_enabled($dtst_mode, $forum_id) | ||
{ | ||
$sql = $this->dtst_sql($dtst_mode, $forum_id); | ||
|
||
$result = $this->db->sql_query($sql); | ||
$forum_dtst_enabled = $this->db->sql_fetchfield($dtst_mode); | ||
$this->db->sql_freeresult($result); | ||
|
||
return (bool) $forum_dtst_enabled; | ||
} | ||
|
||
/** | ||
* Return the Forum Location if Date Topic Starter Template is enabled for this forum | ||
* | ||
* @param string $dtst_mode the SELECTed data to be used on purpose | ||
* @param int $forum_id the forum ID to use | ||
* @return string | ||
* @access public | ||
*/ | ||
public function forum_dtst_location($dtst_mode, $forum_id) | ||
{ | ||
$sql = $this->dtst_sql($dtst_mode, $forum_id); | ||
|
||
$result = $this->db->sql_query($sql); | ||
$dtst_f_location = $this->db->sql_fetchfield($dtst_mode); | ||
$this->db->sql_freeresult($result); | ||
|
||
return (string) $dtst_f_location; | ||
} | ||
|
||
/** | ||
* Check if the fields are all mandatory for this forum | ||
* | ||
* @param string $dtst_mode the SELECTed data to be used on purpose | ||
* @param int $forum_id the forum ID to use | ||
* @return bool | ||
* @access public | ||
*/ | ||
public function forum_dtst_forced_fields($dtst_mode, $forum_id) | ||
{ | ||
$sql = $this->dtst_sql($dtst_mode, $forum_id); | ||
|
||
$result = $this->db->sql_query($sql); | ||
$dtst_f_forced_fields = $this->db->sql_fetchfield($dtst_mode); | ||
$this->db->sql_freeresult($result); | ||
|
||
return (bool) $dtst_f_forced_fields; | ||
} | ||
} | ||
<?php | ||
/** | ||
* | ||
* Date Topic Starter Template. An extension for the phpBB Forum Software package. | ||
* | ||
* @copyright (c) 2018, phpBB Studio, https://www.phpbbstudio.com | ||
* @license GNU General Public License, version 2 (GPL-2.0) | ||
* | ||
*/ | ||
|
||
namespace phpbbstudio\dtst\core; | ||
|
||
/** | ||
* Date Topic Starter Template's helper service. | ||
*/ | ||
class operator | ||
{ | ||
/** @var \phpbb\db\driver\driver_interface */ | ||
protected $db; | ||
|
||
/** | ||
* Constructor | ||
* | ||
* @param \phpbb\db\driver\driver_interface $db Database object | ||
* @access public | ||
*/ | ||
public function __construct(\phpbb\db\driver\driver_interface $db) | ||
{ | ||
$this->db = $db; | ||
} | ||
|
||
/** | ||
* Returns the SQL main SELECT statement used in various places. | ||
* | ||
* @param string $dtst_mode the SELECT data to be used on purpose | ||
* @param int $forum_id the forum ID to use on purpose | ||
* @return string $sql the DBAL SELECT statement | ||
* @access protected | ||
*/ | ||
protected function dtst_sql($dtst_mode, $forum_id) | ||
{ | ||
$sql = 'SELECT ' . $dtst_mode . ' | ||
FROM ' . FORUMS_TABLE . ' | ||
WHERE dtst_f_enable = ' . true . ' | ||
AND forum_id = ' . (int) $forum_id; | ||
|
||
return $sql; | ||
} | ||
|
||
/** | ||
* Check if Date Topic Starter Template is enabled for this forum | ||
* | ||
* @param string $dtst_mode the SELECTed data to be used on purpose | ||
* @param int $forum_id the forum ID to use | ||
* @return bool | ||
* @access public | ||
*/ | ||
public function forum_dtst_enabled($dtst_mode, $forum_id) | ||
{ | ||
$sql = $this->dtst_sql($dtst_mode, $forum_id); | ||
|
||
$result = $this->db->sql_query($sql); | ||
$forum_dtst_enabled = $this->db->sql_fetchfield($dtst_mode); | ||
$this->db->sql_freeresult($result); | ||
|
||
return (bool) $forum_dtst_enabled; | ||
} | ||
|
||
/** | ||
* Return the Forum Location if Date Topic Starter Template is enabled for this forum | ||
* | ||
* @param string $dtst_mode the SELECTed data to be used on purpose | ||
* @param int $forum_id the forum ID to use | ||
* @return string | ||
* @access public | ||
*/ | ||
public function forum_dtst_location($dtst_mode, $forum_id) | ||
{ | ||
$sql = $this->dtst_sql($dtst_mode, $forum_id); | ||
|
||
$result = $this->db->sql_query($sql); | ||
$dtst_f_location = $this->db->sql_fetchfield($dtst_mode); | ||
$this->db->sql_freeresult($result); | ||
|
||
return (string) $dtst_f_location; | ||
} | ||
|
||
/** | ||
* Check if the fields are all mandatory for this forum | ||
* | ||
* @param string $dtst_mode the SELECTed data to be used on purpose | ||
* @param int $forum_id the forum ID to use | ||
* @return bool | ||
* @access public | ||
*/ | ||
public function forum_dtst_forced_fields($dtst_mode, $forum_id) | ||
{ | ||
$sql = $this->dtst_sql($dtst_mode, $forum_id); | ||
|
||
$result = $this->db->sql_query($sql); | ||
$dtst_f_forced_fields = $this->db->sql_fetchfield($dtst_mode); | ||
$this->db->sql_freeresult($result); | ||
|
||
return (bool) $dtst_f_forced_fields; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
<?php | ||
/** | ||
* | ||
* Date Topic Starter Template. An extension for the phpBB Forum Software package. | ||
* | ||
* @copyright (c) 2018, phpBB Studio, https://www.phpbbstudio.com | ||
* @license GNU General Public License, version 2 (GPL-2.0) | ||
* | ||
*/ | ||
|
||
if (!defined('IN_PHPBB')) | ||
{ | ||
exit; | ||
} | ||
|
||
if (empty($lang) || !is_array($lang)) | ||
{ | ||
$lang = array(); | ||
} | ||
|
||
$lang = array_merge($lang, array( | ||
'DTST_ERROR_322_VERSION' => 'Minimum phpBB version required is 3.2.2 but less than 3.3.0@dev', | ||
'DTST_ERROR_PHP_VERSION' => 'PHP version must be equal or greater than 5.5', | ||
)); | ||
<?php | ||
/** | ||
* | ||
* Date Topic Starter Template. An extension for the phpBB Forum Software package. | ||
* | ||
* @copyright (c) 2018, phpBB Studio, https://www.phpbbstudio.com | ||
* @license GNU General Public License, version 2 (GPL-2.0) | ||
* | ||
*/ | ||
|
||
if (!defined('IN_PHPBB')) | ||
{ | ||
exit; | ||
} | ||
|
||
if (empty($lang) || !is_array($lang)) | ||
{ | ||
$lang = array(); | ||
} | ||
|
||
$lang = array_merge($lang, array( | ||
'DTST_ERROR_322_VERSION' => 'Minimum phpBB version required is 3.2.2 but less than 3.3.0@dev', | ||
'DTST_ERROR_PHP_VERSION' => 'PHP version must be equal or greater than 5.5', | ||
)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,33 @@ | ||
<?php | ||
/** | ||
* | ||
* Date Topic Starter Template. An extension for the phpBB Forum Software package. | ||
* | ||
* @copyright (c) 2018, phpBB Studio, https://www.phpbbstudio.com | ||
* @license GNU General Public License, version 2 (GPL-2.0) | ||
* | ||
*/ | ||
|
||
if (!defined('IN_PHPBB')) | ||
{ | ||
exit; | ||
} | ||
|
||
if (empty($lang) || !is_array($lang)) | ||
{ | ||
$lang = array(); | ||
} | ||
|
||
$lang = array_merge($lang, array( | ||
// ACP Forums | ||
'ACP_DTST_FORUMS_LEGEND' => 'Extended settings', | ||
|
||
'ACP_DTST_FORUMS_ENABLE' => 'Enable Date Topic Starter Template extension', | ||
'ACP_DTST_FORUMS_ENABLE_EXPLAIN' => 'If set to <strong>Yes</strong> the functions provided will be in use here.<br>Setting back to <strong>No</strong> does preserve the existing Date Topic Starter Templates as well, so to be created/edited if you change your mind.<br><strong>Note:</strong> if set to <strong>No</strong> the two options below will not be taken into consideration.', | ||
|
||
'ACP_DTST_F_LOCATION' => 'Location default', | ||
'ACP_DTST_F_LOCATION_EXPLAIN' => 'Each forum can have a default Location preset, input here the desired Location to use as default and placeholder, can be changed later on a per topic basis.', | ||
|
||
'ACP_DTST_F_FORCED_FIELDS' => 'Force all fields as mandatory', | ||
'ACP_DTST_F_FORCED_FIELDS_EXPLAIN' => 'If set to <strong>Yes</strong> the fields must be filled prior to submitting the topic, choosing <strong>No</strong> will leave that as per the user’s choice. Settings are not retro-active.', | ||
)); | ||
<?php | ||
/** | ||
* | ||
* Date Topic Starter Template. An extension for the phpBB Forum Software package. | ||
* | ||
* @copyright (c) 2018, phpBB Studio, https://www.phpbbstudio.com | ||
* @license GNU General Public License, version 2 (GPL-2.0) | ||
* | ||
*/ | ||
|
||
if (!defined('IN_PHPBB')) | ||
{ | ||
exit; | ||
} | ||
|
||
if (empty($lang) || !is_array($lang)) | ||
{ | ||
$lang = array(); | ||
} | ||
|
||
$lang = array_merge($lang, array( | ||
// ACP Forums | ||
'ACP_DTST_FORUMS_LEGEND' => 'Extended settings', | ||
|
||
'ACP_DTST_FORUMS_ENABLE' => 'Enable Date Topic Starter Template extension', | ||
'ACP_DTST_FORUMS_ENABLE_EXPLAIN' => 'If set to <strong>Yes</strong> the functions provided will be in use here.<br>Setting back to <strong>No</strong> does preserve the existing Date Topic Starter Templates as well, so to be created/edited if you change your mind.<br><strong>Note:</strong> if set to <strong>No</strong> the two options below will not be taken into consideration.', | ||
|
||
'ACP_DTST_F_LOCATION' => 'Location default', | ||
'ACP_DTST_F_LOCATION_EXPLAIN' => 'Each forum can have a default Location preset, input here the desired Location to use as default and placeholder, can be changed later on a per topic basis.', | ||
|
||
'ACP_DTST_F_FORCED_FIELDS' => 'Force all fields as mandatory', | ||
'ACP_DTST_F_FORCED_FIELDS_EXPLAIN' => 'If set to <strong>Yes</strong> the fields must be filled prior to submitting the topic, choosing <strong>No</strong> will leave that as per the user’s choice. Settings are not retro-active.', | ||
)); |