Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ build/*
*~
.idea
*/node_modules
includes/qi_constants.php
27 changes: 23 additions & 4 deletions includes/class_qi.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ public static function page_header($page_title = '')
'S_USER_LANG' => $user->lang['USER_LANG'],

'TRANSLATION_INFO' => $user->lang['TRANSLATION_INFO'],
'QI_VERSION' => QI_VERSION,
'QI_VERSION' => self::current_version(),

'VERSION_CHECK_TITLE' => !empty($update) ? sprintf($user->lang['VERSION_CHECK_TITLE'], $update['current'], QI_VERSION) : '',
'VERSION_CHECK_TITLE' => !empty($update) ? sprintf($user->lang['VERSION_CHECK_TITLE'], $update['current'], self::current_version()) : '',
'VERSION_CHECK_CURRENT' => !empty($update) ? $update['current'] : '',
'U_VERSION_CHECK_URL' => !empty($update) ? $update['download'] : '',
));
Expand Down Expand Up @@ -345,7 +345,7 @@ public static function msg_handler($errno, $msg_text, $errfile, $errline)
'MSG_EXPLAIN' => '',
'SETTINGS_FORM' => '',
'RETURN_LINKS' => $l_return_index,
'QI_VERSION' => QI_VERSION,
'QI_VERSION' => self::current_version(),
'L_QUICKINSTALL' => $user->lang['QUICKINSTALL'],
'L_PHPBB_QI_TEXT' => $user->lang['PHPBB_QI_TEXT'],
'L_FOR_PHPBB_VERSIONS' => $user->lang['FOR_PHPBB_VERSIONS'],
Expand Down Expand Up @@ -405,9 +405,28 @@ public static function get_update()
$version_helper = new qi_version_helper();

return $version_helper
->set_current_version(QI_VERSION)
->set_current_version(self::current_version())
->force_stability('stable')
->set_file_location('www.phpbb.com', '/customise/db/official_tool/phpbb3_quickinstall', 'version_check')
->get_update();
}

/**
* Get the current version of QuickInstall from composer.json
*
* @return string
*/
public static function current_version()
{
global $quickinstall_path;

static $composerJson = null;

if ($composerJson === null) {
$composerJson = file_get_contents("{$quickinstall_path}composer.json");
$composerJson = json_decode($composerJson, true);
}

return $composerJson["version"];
}
}
13 changes: 9 additions & 4 deletions includes/class_qi_settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
*/
class settings
{
/**
* Cookie with the latest used profile name as payload.
*/
const QI_PROFILE_COOKIE = 'qi_profile';

/**
* Array with configuration settings.
* @private
Expand Down Expand Up @@ -84,11 +89,11 @@ function __construct($profile = '', $mode = '')
$this->profile = $profile;
$this->set_profile_cookie($profile);
}
else if (!empty($_COOKIE[QI_PROFILE_COOKIE]) && is_readable("{$quickinstall_path}settings/{$_COOKIE[QI_PROFILE_COOKIE]}.cfg"))
else if (!empty($_COOKIE[self::QI_PROFILE_COOKIE]) && is_readable("{$quickinstall_path}settings/{$_COOKIE[self::QI_PROFILE_COOKIE]}.cfg"))
{
// Get the previously used profile.
$config = file("{$quickinstall_path}settings/{$_COOKIE[QI_PROFILE_COOKIE]}.cfg", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
$this->profile = $_COOKIE[QI_PROFILE_COOKIE];
$config = file("{$quickinstall_path}settings/{$_COOKIE[self::QI_PROFILE_COOKIE]}.cfg", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
$this->profile = $_COOKIE[self::QI_PROFILE_COOKIE];
}
else
{
Expand Down Expand Up @@ -827,7 +832,7 @@ function set_profile_cookie($profile = 'default')
{
// A Julian year == 365.25 days * 86,400 seconds
$expire_time = time() + 31557600;
setcookie(QI_PROFILE_COOKIE, $profile, $expire_time);
setcookie(self::QI_PROFILE_COOKIE, $profile, $expire_time);
}

/**
Expand Down
8 changes: 4 additions & 4 deletions includes/qi_constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
*
*/

define('QI_VERSION', '1.4.0');
//define('QI_DEBUG', true); // un-comment this disable template caching
// IMPORTANT NOTE:
// This file is for development and debugging purposes only. Use class constants instead of
// defining global constants here. This file is ignored by git.

// Cookies set by QI
define('QI_PROFILE_COOKIE', 'qi_profile'); // Cookie with the latest used profile name as payload.
//define('QI_DEBUG', true); // un-comment this disable template caching
2 changes: 1 addition & 1 deletion includes/qi_functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ function gen_error_msg($msg_text, $msg_title = 'General Error', $msg_explain = '
'MSG_EXPLAIN' => $msg_explain,
'SETTINGS_FORM' => $settings_form,
'RETURN_LINKS' => $l_return_index,
'QI_VERSION' => QI_VERSION,
'QI_VERSION' => qi::current_version(),
'L_QUICKINSTALL' => $l_quickinstall,
'L_PHPBB_QI_TEXT' => $l_phpbb_qi_text,
'L_FOR_PHPBB_VERSIONS' => $l_for_phpbb_versions,
Expand Down
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@
else if (!empty($settings->update_text)) // PROFILE_UPDATED
{
$update_title = sprintf($user->lang['PROFILE_UPDATED'], $settings->profile);
$update_explain = sprintf($user->lang['UPDATED_EXPLAIN'], QI_VERSION);
$update_explain = sprintf($user->lang['UPDATED_EXPLAIN'], qi::current_version());

$update_msg = '<ul>';
foreach ($settings->update_text as $update)
Expand Down
4 changes: 2 additions & 2 deletions modules/qi_create.php
Original file line number Diff line number Diff line change
Expand Up @@ -831,11 +831,11 @@ public function __construct()
$user->ip = &$user_ip;
if (defined('PHPBB_31'))
{
add_log('admin', sprintf($user->lang['LOG_INSTALL_INSTALLED_QI'], QI_VERSION));
add_log('admin', sprintf($user->lang['LOG_INSTALL_INSTALLED_QI'], qi::current_version()));
}
else
{
add_log('admin', 'LOG_INSTALL_INSTALLED_QI', QI_VERSION);
add_log('admin', 'LOG_INSTALL_INSTALLED_QI', qi::current_version());
}

// purge cache
Expand Down