Skip to content

Commit

Permalink
v1.1.1-beta
Browse files Browse the repository at this point in the history
  • Loading branch information
3D-I committed Apr 26, 2018
1 parent 2a4c3e6 commit c4511eb
Show file tree
Hide file tree
Showing 4 changed files with 164 additions and 164 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"homepage": "https://www.phpbbstudio.com",
"version": "1.1.1-beta",
"time": "2018-04-24",
"license": "GPL-2.0",
"license": "GPL-2.0-only",
"authors": [
{
"name": "phpBB Studio",
Expand Down
212 changes: 106 additions & 106 deletions core/operator.php
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;
}
}
48 changes: 24 additions & 24 deletions language/en/ext_require.php
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',
));
66 changes: 33 additions & 33 deletions language/en/info_acp_dtst.php
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.',
));

0 comments on commit c4511eb

Please sign in to comment.