bumping version to 3.0.0 for upcoming release, removing closing

brackets;
fixing go_back on info page and changing label of server selector;
changing tpl service to include files only once then store them
This commit is contained in:
Pepijn Over 2014-04-05 09:31:41 +02:00
parent 8cca8a6b29
commit 43071eed88
29 changed files with 53 additions and 56 deletions

View File

@ -23,7 +23,7 @@
* @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3
* @version Release: @package_version@
* @link http://www.phpservermonitor.org/
* @since phpservermon 2.2.0
* @since phpservermon 3.0.0
**/
/**

View File

@ -23,13 +23,13 @@
* @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3
* @version Release: @package_version@
* @link http://www.phpservermonitor.org/
* @since phpservermon 2.2.0
* @since phpservermon 3.0.0
**/
/**
* Current PSM version
*/
define('PSM_VERSION', '2.2.0-dev');
define('PSM_VERSION', '3.0.0');
/**
* URL to check for updates. Will not be checked if turned off on config page.

View File

@ -23,7 +23,7 @@
* @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3
* @version Release: @package_version@
* @link http://www.phpservermonitor.org/
* @since phpservermon 2.2
* @since phpservermon 3.0
**/
namespace psm\Module\Config;

View File

@ -182,9 +182,9 @@ class InstallController extends AbstractController {
if($this->db->status()) {
if($this->isUpgrade()) {
// upgrade
if(version_compare(PSM_VERSION, '2.2.0', '<')) {
// upgrade from before 2.2, does not have passwords yet.. create new user first
$this->addMessage('Your current version does not have an authentication system, but since v2.2 access to the monitor is restricted by user accounts. Please set up a new account to be able to login after the upgrade, and which you can use to change the passwords for your other accounts.', 'info');
if(version_compare(PSM_VERSION, '3.0.0', '<')) {
// upgrade from before 3.0, does not have passwords yet.. create new user first
$this->addMessage('Your current version does not have an authentication system, but since v3.0 access to the monitor is restricted by user accounts. Please set up a new account to be able to login after the upgrade, and which you can use to change the passwords for your other accounts.', 'info');
$this->setTemplateId('install_config_new_user', 'install/install.tpl.html');
} else {
$this->setTemplateId('install_config_upgrade', 'install/install.tpl.html');
@ -213,7 +213,7 @@ class InstallController extends AbstractController {
}
// check if user submitted username + password in previous step
// this would only be the case for new installs, and install from
// before 2.2
// before 3.0
$new_user = array(
'user_name' => psm_POST('username'),
'name' => psm_POST('username'),
@ -244,7 +244,7 @@ class InstallController extends AbstractController {
$installer->upgrade($version_from, PSM_VERSION);
}
if(version_compare($version_from, '2.2.0', '<')) {
if(version_compare($version_from, '3.0.0', '<')) {
$add_user = true;
}
}

View File

@ -23,7 +23,7 @@
* @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3
* @version Release: @package_version@
* @link http://www.phpservermonitor.org/
* @since phpservermon 2.2
* @since phpservermon 3.0
**/
namespace psm\Module\Install;

View File

@ -23,7 +23,7 @@
* @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3
* @version Release: @package_version@
* @link http://www.phpservermonitor.org/
* @since phpservermon 2.2
* @since phpservermon 3.0
**/
namespace psm\Module;

View File

@ -23,7 +23,7 @@
* @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3
* @version Release: @package_version@
* @link http://www.phpservermonitor.org/
* @since phpservermon 2.2.0
* @since phpservermon 3.0.0
**/
namespace psm\Module\Server\Controller;

View File

@ -266,11 +266,11 @@ class ServerController extends AbstractServerController {
// add all available servers to the menu
$servers = $this->getServers();
$options = array();
foreach($servers as $i => $server) {
foreach($servers as $i => $server_available) {
$options[] = array(
'class_active' => ($server['server_id'] == $this->server_id) ? 'active' : '',
'url' => psm_build_url(array('mod' => 'server', 'action' => 'view', 'id' => $server['server_id'])),
'label' => $server['label'],
'class_active' => ($server_available['server_id'] == $this->server_id) ? 'active' : '',
'url' => psm_build_url(array('mod' => 'server', 'action' => 'view', 'id' => $server_available['server_id'])),
'label' => $server_available['label'],
);
}
$sidebar = new \psm\Util\Module\Sidebar($this->tpl);
@ -278,13 +278,13 @@ class ServerController extends AbstractServerController {
$sidebar->addDropdown(
'server',
psm_get_lang('menu', 'server'),
$server['label'],
$options,
'th', 'success'
);
// check which module the user came from, and add a link accordingly
$back_to = isset($_GET['back_to']) && $_GET['back_to'] == 'status' ? $_GET['back_to'] : 'server';
$back_to = isset($_GET['back_to']) && $_GET['back_to'] == 'server_status' ? $_GET['back_to'] : 'server';
$sidebar->addButton(
'go_back',
psm_get_lang('system', 'go_back'),

View File

@ -24,7 +24,7 @@
* @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3
* @version Release: @package_version@
* @link http://www.phpservermonitor.org/
* @since phpservermon 2.2.0
* @since phpservermon 3.0.0
**/
namespace psm\Module\Server\Controller;

View File

@ -23,7 +23,7 @@
* @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3
* @version Release: @package_version@
* @link http://www.phpservermonitor.org/
* @since phpservermon 2.2
* @since phpservermon 3.0
**/
namespace psm\Module\Server;

View File

@ -23,7 +23,7 @@
* @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3
* @version Release: @package_version@
* @link http://www.phpservermonitor.org/
* @since phpservermon 2.2.0
* @since phpservermon 3.0.0
**/
namespace psm\Module\User\Controller;

View File

@ -22,7 +22,7 @@
* @copyright Copyright (c) 2008-2014 Pepijn Over <pep@neanderthal-technology.com>
* @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3
* @version Release: @package_version@
* @since phpservermon 2.2.0
* @since phpservermon 3.0.0
**/
namespace psm\Module\User\Controller;

View File

@ -23,7 +23,7 @@
* @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3
* @version Release: @package_version@
* @link http://www.phpservermonitor.org/
* @since phpservermon 2.2
* @since phpservermon 3.0
**/
namespace psm\Module\User;

View File

@ -23,7 +23,7 @@
* @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3
* @version Release: @package_version@
* @link http://www.phpservermonitor.org/
* @since phpservermon 2.2
* @since phpservermon 3.0
**/
namespace psm;

View File

@ -494,5 +494,3 @@ class Database {
trigger_error('SQL error: ' . $e->getMessage(), E_USER_WARNING);
}
}
?>

View File

@ -28,9 +28,20 @@
namespace psm\Service;
class Template {
protected $output;
/**
* Loaded templates
* @var array $templates
*/
protected $templates = array();
/**
* Cache of parsed files
* @var array $files_parsed
* @see parseFile()
*/
protected $files_parsed = array();
function __construct() {
// add the main template
$this->newTemplate('main', 'main.tpl.html');
@ -255,13 +266,18 @@ class Template {
protected function parseFile($filename) {
if (!file_exists($filename)) return false;
if(isset($this->files_parsed[$filename])) {
return $this->files_parsed[$filename];
}
ob_start();
include($filename);
$file_content = ob_get_contents();
ob_end_clean();
$this->files_parsed[$filename] = $file_content;
return $file_content;
}
}
?>

View File

@ -24,7 +24,7 @@
* @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3
* @version Release: @package_version@
* @link http://www.phpservermonitor.org/
* @since phpservermon 2.2.0
* @since phpservermon 3.0.0
**/
namespace psm\Service;

View File

@ -64,5 +64,3 @@ class Clickatell extends Core {
return psm_curl_get($url);
}
}
?>

View File

@ -62,5 +62,3 @@ abstract class Core implements TxtmsgInterface {
array_push($this->recipients, $recipient);
}
}
?>

View File

@ -143,5 +143,3 @@ class Inetworx extends Core {
} //end function auth_https_post
}
?>

View File

@ -97,5 +97,4 @@ class Mollie extends Core {
}
return $buf;
}
}
?>
}

View File

@ -54,5 +54,3 @@ class Mosms extends Core {
return $result;
}
}
?>

View File

@ -73,5 +73,3 @@ class Spryng extends Core {
return $data;
}
}
?>

View File

@ -57,5 +57,3 @@ class Textmarketer extends Core {
}
}
?>

View File

@ -35,5 +35,3 @@ interface TxtmsgInterface {
public function sendSMS($message);
}
?>

View File

@ -229,9 +229,9 @@ class Installer {
// upgrade to 2.1.0
$this->upgrade210();
}
if(version_compare($version_from, '2.2.0', '<')) {
// upgrade to 2.2.0
$this->upgrade220();
if(version_compare($version_from, '3.0.0', '<')) {
// upgrade to 3.0.0
$this->upgrade300();
}
$this->db->save(PSM_DB_PREFIX . 'config', array('value' => $version_to), array('key' => 'version'));
}
@ -257,9 +257,9 @@ class Installer {
}
/**
* Upgrade for v2.2.0 release
* Upgrade for v3.0.0 release
*/
protected function upgrade220() {
protected function upgrade300() {
$queries = array();
// language is now stored as language code (ISO 639-1) + country code (ISO 3166-1)
$queries[] = "UPDATE `" . PSM_DB_PREFIX . "config` SET `value`='bg_BG' WHERE `key`='language' AND `value`='bg';";
@ -321,7 +321,7 @@ class Installer {
) ENGINE = MYISAM ;";
$this->execSQL($queries);
// from 2.2 all user-server relations are in a separate table
// from 3.0 all user-server relations are in a separate table
$users = $this->db->select(PSM_DB_PREFIX . 'users', null, array('user_id', 'server_id'));
foreach($users as $user) {
$idc = array();

View File

@ -23,7 +23,7 @@
* @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3
* @version Release: @package_version@
* @link http://www.phpservermonitor.org/
* @since phpservermon 2.2.0
* @since phpservermon 3.0.0
**/
namespace psm\Util;
@ -53,5 +53,3 @@ class Mailer extends \PHPMailer {
}
}
?>

View File

@ -23,7 +23,7 @@
* @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3
* @version Release: @package_version@
* @link http://www.phpservermonitor.org/
* @since phpservermon 2.2.0
* @since phpservermon 3.0.0
**/
namespace psm\Util\Updater;

View File

@ -23,7 +23,7 @@
* @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3
* @version Release: @package_version@
* @link http://www.phpservermonitor.org/
* @since phpservermon 2.2.0
* @since phpservermon 3.0.0
**/
namespace psm\Util\User;