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
pull/48/head
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 * @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3
* @version Release: @package_version@ * @version Release: @package_version@
* @link http://www.phpservermonitor.org/ * @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 * @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3
* @version Release: @package_version@ * @version Release: @package_version@
* @link http://www.phpservermonitor.org/ * @link http://www.phpservermonitor.org/
* @since phpservermon 2.2.0 * @since phpservermon 3.0.0
**/ **/
/** /**
* Current PSM version * 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. * 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 * @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3
* @version Release: @package_version@ * @version Release: @package_version@
* @link http://www.phpservermonitor.org/ * @link http://www.phpservermonitor.org/
* @since phpservermon 2.2 * @since phpservermon 3.0
**/ **/
namespace psm\Module\Config; namespace psm\Module\Config;

View File

@ -182,9 +182,9 @@ class InstallController extends AbstractController {
if($this->db->status()) { if($this->db->status()) {
if($this->isUpgrade()) { if($this->isUpgrade()) {
// upgrade // upgrade
if(version_compare(PSM_VERSION, '2.2.0', '<')) { if(version_compare(PSM_VERSION, '3.0.0', '<')) {
// upgrade from before 2.2, does not have passwords yet.. create new user first // 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 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'); $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'); $this->setTemplateId('install_config_new_user', 'install/install.tpl.html');
} else { } else {
$this->setTemplateId('install_config_upgrade', 'install/install.tpl.html'); $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 // check if user submitted username + password in previous step
// this would only be the case for new installs, and install from // this would only be the case for new installs, and install from
// before 2.2 // before 3.0
$new_user = array( $new_user = array(
'user_name' => psm_POST('username'), 'user_name' => psm_POST('username'),
'name' => psm_POST('username'), 'name' => psm_POST('username'),
@ -244,7 +244,7 @@ class InstallController extends AbstractController {
$installer->upgrade($version_from, PSM_VERSION); $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; $add_user = true;
} }
} }

View File

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

View File

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

View File

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

View File

@ -266,11 +266,11 @@ class ServerController extends AbstractServerController {
// add all available servers to the menu // add all available servers to the menu
$servers = $this->getServers(); $servers = $this->getServers();
$options = array(); $options = array();
foreach($servers as $i => $server) { foreach($servers as $i => $server_available) {
$options[] = array( $options[] = array(
'class_active' => ($server['server_id'] == $this->server_id) ? 'active' : '', 'class_active' => ($server_available['server_id'] == $this->server_id) ? 'active' : '',
'url' => psm_build_url(array('mod' => 'server', 'action' => 'view', 'id' => $server['server_id'])), 'url' => psm_build_url(array('mod' => 'server', 'action' => 'view', 'id' => $server_available['server_id'])),
'label' => $server['label'], 'label' => $server_available['label'],
); );
} }
$sidebar = new \psm\Util\Module\Sidebar($this->tpl); $sidebar = new \psm\Util\Module\Sidebar($this->tpl);
@ -278,13 +278,13 @@ class ServerController extends AbstractServerController {
$sidebar->addDropdown( $sidebar->addDropdown(
'server', 'server',
psm_get_lang('menu', 'server'), $server['label'],
$options, $options,
'th', 'success' 'th', 'success'
); );
// check which module the user came from, and add a link accordingly // 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( $sidebar->addButton(
'go_back', 'go_back',
psm_get_lang('system', '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 * @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3
* @version Release: @package_version@ * @version Release: @package_version@
* @link http://www.phpservermonitor.org/ * @link http://www.phpservermonitor.org/
* @since phpservermon 2.2.0 * @since phpservermon 3.0.0
**/ **/
namespace psm\Module\Server\Controller; namespace psm\Module\Server\Controller;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -229,9 +229,9 @@ class Installer {
// upgrade to 2.1.0 // upgrade to 2.1.0
$this->upgrade210(); $this->upgrade210();
} }
if(version_compare($version_from, '2.2.0', '<')) { if(version_compare($version_from, '3.0.0', '<')) {
// upgrade to 2.2.0 // upgrade to 3.0.0
$this->upgrade220(); $this->upgrade300();
} }
$this->db->save(PSM_DB_PREFIX . 'config', array('value' => $version_to), array('key' => 'version')); $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(); $queries = array();
// language is now stored as language code (ISO 639-1) + country code (ISO 3166-1) // 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';"; $queries[] = "UPDATE `" . PSM_DB_PREFIX . "config` SET `value`='bg_BG' WHERE `key`='language' AND `value`='bg';";
@ -321,7 +321,7 @@ class Installer {
) ENGINE = MYISAM ;"; ) ENGINE = MYISAM ;";
$this->execSQL($queries); $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')); $users = $this->db->select(PSM_DB_PREFIX . 'users', null, array('user_id', 'server_id'));
foreach($users as $user) { foreach($users as $user) {
$idc = array(); $idc = array();

View File

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

View File

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