Skip to content

Commit

Permalink
Fixed issue #5967: Update link to previous version shown
Browse files Browse the repository at this point in the history
  • Loading branch information
c-schmitz committed Mar 31, 2012
1 parent e64812a commit 763eca6
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 68 deletions.
1 change: 1 addition & 0 deletions application/config/version.php
Expand Up @@ -15,6 +15,7 @@
$config['versionnumber'] = "2.0a3";
$config['dbversionnumber'] = 156;
$config['buildnumber'] = '';
$config['updatable'] = false;

return $config;

Expand Down
4 changes: 2 additions & 2 deletions application/controllers/AdminController.php
Expand Up @@ -390,7 +390,7 @@ public function _showMessageBox($title,$message,$class="header ui-widget-header"
*/
public function _showadminmenu($surveyid = false)
{
global $homedir, $scriptname, $setfont, $imageurl, $debug, $action, $updateavailable, $updatebuild, $updateversion, $updatelastcheck, $databasetype;
global $homedir, $scriptname, $setfont, $imageurl, $debug, $action, $updatebuild, $updateversion, $updatelastcheck, $databasetype;

$clang = $this->lang;
$data['clang']= $clang;
Expand All @@ -399,7 +399,7 @@ public function _showadminmenu($surveyid = false)
Yii::app()->session['flashmessage'] = $clang->gT("Warning: You are still using the default password ('password'). Please change your password and re-login again.");
}

$data['showupdate'] = (Yii::app()->session['USER_RIGHT_SUPERADMIN'] == 1 && Yii::app()->getConfig("updatelastcheck")>0 && Yii::app()->getConfig("updateavailable")==1);
$data['showupdate'] = (Yii::app()->session['USER_RIGHT_SUPERADMIN'] == 1 && Yii::app()->getConfig("updatelastcheck")>0 && Yii::app()->getConfig("updateavailable")==1 && Yii::app()->getConfig("updatable") );
$data['updateversion'] = Yii::app()->getConfig("updateversion");
$data['updatebuild'] = Yii::app()->getConfig("updatebuild");
$data['surveyid'] = $surveyid;
Expand Down
81 changes: 41 additions & 40 deletions application/controllers/admin/globalsettings.php
@@ -1,25 +1,25 @@
<?php
/*
* LimeSurvey
* Copyright (C) 2007-2011 The LimeSurvey Project Team / Carsten Schmitz
* All rights reserved.
* License: GNU/GPL License v2 or later, see LICENSE.php
* LimeSurvey is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id$
*/
* LimeSurvey
* Copyright (C) 2007-2011 The LimeSurvey Project Team / Carsten Schmitz
* All rights reserved.
* License: GNU/GPL License v2 or later, see LICENSE.php
* LimeSurvey is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id$
*/

/**
* GlobalSettings Controller
*
*
* @package LimeSurvey
* @subpackage Backend
*/
*
*
* @package LimeSurvey
* @subpackage Backend
*/
class GlobalSettings extends Survey_Common_Action
{

Expand All @@ -33,11 +33,11 @@ function __construct($controller, $id)
}

/**
* Shows the index page
*
* @access public
* @return void
*/
* Shows the index page
*
* @access public
* @return void
*/
public function index()
{
if (!empty($_POST['action'])) {
Expand All @@ -56,11 +56,11 @@ public function showphpinfo()
private function _displaySettings()
{
Yii::app()->loadHelper('surveytranslator');

//save refurl from where global settings screen is called!
$refurl = CHttpRequest::getUrlReferrer();
$refurl = CHttpRequest::getUrlReferrer();
Yii::app()->session['refurl'] = htmlspecialchars($refurl); //just to be safe!

$data['clang'] = $this->getController()->lang;
$data['title'] = "hi";
$data['message'] = "message";
Expand All @@ -70,7 +70,8 @@ private function _displaySettings()
}
$data['thisupdatecheckperiod'] = getGlobalSetting('updatecheckperiod');
$data['updatelastcheck'] = Yii::app()->getConfig("updatelastcheck");
$data['updateavailable'] = Yii::app()->getConfig("updateavailable");
$data['updateavailable'] = (Yii::app()->getConfig("updateavailable") && Yii::app()->getConfig("updatable"));
$data['updatable'] = Yii::app()->getConfig("updatable");
$data['updateinfo'] = Yii::app()->getConfig("updateinfo");
$data['allLanguages'] = getLanguageData(false, Yii::app()->session['adminlang']);
if (trim(Yii::app()->getConfig('restrictToLanguages')) == '') {
Expand Down Expand Up @@ -109,7 +110,7 @@ private function _saveSettings()
} else {
$aRestrictToLanguages = implode(' ', $aRestrictToLanguages);
}

setGlobalSetting('restrictToLanguages', trim($aRestrictToLanguages));
setGlobalSetting('sitename', strip_tags($_POST['sitename']));
setGlobalSetting('updatecheckperiod', (int)($_POST['updatecheckperiod']));
Expand Down Expand Up @@ -167,7 +168,7 @@ private function _saveSettings()
setGlobalSetting('usercontrolSameGroupPolicy', strip_tags($_POST['usercontrolSameGroupPolicy']));

Yii::app()->session['flashmessage'] = $clang->gT("Global settings were saved.");

$url = htmlspecialchars_decode(Yii::app()->session['refurl']);
CController::redirect($url);
}
Expand Down Expand Up @@ -219,22 +220,22 @@ private function _checkSettings()
$activetokens = 0;
}
return array(
'usercount' => $usercount,
'surveycount' => $surveycount,
'activesurveycount' => $activesurveycount,
'deactivatedsurveys' => $deactivatedsurveys,
'activetokens' => $activetokens,
'deactivatedtokens' => $deactivatedtokens
'usercount' => $usercount,
'surveycount' => $surveycount,
'activesurveycount' => $activesurveycount,
'deactivatedsurveys' => $deactivatedsurveys,
'activetokens' => $activetokens,
'deactivatedtokens' => $deactivatedtokens
);
}

/**
* Renders template(s) wrapped in header and footer
*
* @param string $sAction Current action, the folder to fetch views from
* @param string|array $aViewUrls View url(s)
* @param array $aData Data to be passed on. Optional.
*/
* Renders template(s) wrapped in header and footer
*
* @param string $sAction Current action, the folder to fetch views from
* @param string|array $aViewUrls View url(s)
* @param array $aData Data to be passed on. Optional.
*/
protected function _renderWrappedTemplate($sAction = '', $aViewUrls = array(), $aData = array())
{
$this->getController()->_js_admin_includes(Yii::app()->baseUrl . "/scripts/jquery/jquery.selectboxes.min.js");
Expand Down
58 changes: 32 additions & 26 deletions application/views/admin/globalSettings_view.php
Expand Up @@ -15,48 +15,48 @@
</ul>
<form class='form30' id='frmglobalsettings' name='frmglobalsettings' action='<?php echo $this->createUrl("admin/globalsettings"); ?>' method='post'>
<div id='overview'>
<div class='header ui-widget-header'><?php $clang->eT("System overview"); ?></div>
<br /><table class='statisticssummary'>
<div class='header ui-widget-header'><?php $clang->eT("System overview"); ?></div>
<br /><table class='statisticssummary'>
<tr>
<th ><?php $clang->eT("Users"); ?>:</th><td><?php echo $usercount; ?></td>
<th ><?php $clang->eT("Users"); ?>:</th><td><?php echo $usercount; ?></td>
</tr>
<tr>
<th ><?php $clang->eT("Surveys"); ?>:</th><td><?php echo $surveycount; ?></td>
<th ><?php $clang->eT("Surveys"); ?>:</th><td><?php echo $surveycount; ?></td>
</tr>
<tr>
<th ><?php $clang->eT("Active surveys"); ?>:</th><td><?php echo $activesurveycount; ?></td>
<th ><?php $clang->eT("Active surveys"); ?>:</th><td><?php echo $activesurveycount; ?></td>
</tr>
<tr>
<th ><?php $clang->eT("Deactivated result tables"); ?>:</th><td><?php echo $deactivatedsurveys; ?></td>
<th ><?php $clang->eT("Deactivated result tables"); ?>:</th><td><?php echo $deactivatedsurveys; ?></td>
</tr>
<tr>
<th ><?php $clang->eT("Active token tables"); ?>:</th><td><?php echo $activetokens; ?></td>
<th ><?php $clang->eT("Active token tables"); ?>:</th><td><?php echo $activetokens; ?></td>
</tr>
<tr>
<th ><?php $clang->eT("Deactivated token tables"); ?>:</th><td><?php echo $deactivatedtokens; ?></td>
<th ><?php $clang->eT("Deactivated token tables"); ?>:</th><td><?php echo $deactivatedtokens; ?></td>
</tr>
<?php
if (Yii::app()->getConfig('iFileUploadTotalSpaceMB')>0)
{
$fUsed=calculateTotalFileUploadUsage();
?>
<?php
if (Yii::app()->getConfig('iFileUploadTotalSpaceMB')>0)
{
$fUsed=calculateTotalFileUploadUsage();
?>
<tr>
<th ><?php $clang->eT("Used/free space for file uploads"); ?>:</th><td><?php echo sprintf('%01.2F',$fUsed); ?> MB / <?php echo sprintf('%01.2F',Yii::app()->getConfig('iFileUploadTotalSpaceMB')-$fUsed); ?> MB</td>
<th ><?php $clang->eT("Used/free space for file uploads"); ?>:</th><td><?php echo sprintf('%01.2F',$fUsed); ?> MB / <?php echo sprintf('%01.2F',Yii::app()->getConfig('iFileUploadTotalSpaceMB')-$fUsed); ?> MB</td>
</tr>
<?php
}
?>
</table>
<?php
}
?>
</table>
<?php
if (Yii::app()->session['USER_RIGHT_CONFIGURATOR'] == 1)
{
?>
<p><input type="button" onclick="window.open('<?php echo Yii::app()->getController()->createUrl("admin/globalsettings/showphpinfo"); ?>')" value="<?php $clang->eT("Show PHPInfo"); ?>" />
<?php
}
?>
?>
<p><input type="button" onclick="window.open('<?php echo Yii::app()->getController()->createUrl("admin/globalsettings/showphpinfo"); ?>')" value="<?php $clang->eT("Show PHPInfo"); ?>" />
<?php
}
?>

<br /><br/></p><div class='header ui-widget-header'><?php echo $clang->eT("Updates"); ?></div><br/><ul>
<br /><br/></p><div class='header ui-widget-header'><?php echo $clang->eT("Updates"); ?></div><br/><ul>
<li><label for='updatecheckperiod'><?php echo $clang->eT("Check for updates:"); ?></label>
<select name='updatecheckperiod' id='updatecheckperiod'>
<option value='0'
Expand Down Expand Up @@ -87,10 +87,16 @@
<textarea readonly='readonly' style='width:35%; height:60px; overflow: auto;'><?php echo strip_tags($updateinfo['errorhtml']); ?></textarea>

<?php }
else
elseif ($updatable)
{
$clang->eT('There is currently no newer LimeSurvey version available.');
} ?>
}
else
{
printf($clang->gT('This is an unstable version and cannot be updated using ComfortUpdate. Please check %sour website%s regularly for a newer version.'),"<a href='http://www.limesurvey.org'>","</a>");
}

?>
</p></div>

<div id='general'>
Expand Down

0 comments on commit 763eca6

Please sign in to comment.