Skip to content

Commit

Permalink
Dev: Added TypeHInts, Removed old comments and added white close butt…
Browse files Browse the repository at this point in the history
…on to my profile view
  • Loading branch information
thedirtypanda committed Jul 14, 2021
1 parent dddb0e3 commit aa0e84e
Showing 1 changed file with 52 additions and 14 deletions.
66 changes: 52 additions & 14 deletions application/controllers/admin/useraction.php
Expand Up @@ -24,6 +24,11 @@
*/
class UserAction extends Survey_Common_Action
{
/**
* Constructor
* @param $controller
* @param $id
*/
public function __construct($controller, $id)
{
parent::__construct($controller, $id);
Expand All @@ -36,7 +41,7 @@ public function __construct($controller, $id)
* @param string $param
* @return string
*/
private function _getPostOrParam($param)
private function _getPostOrParam(string $param)
{
$value = Yii::app()->request->getPost($param);
if (!$value) {
Expand Down Expand Up @@ -68,6 +73,7 @@ public function index()
}
$aData['pageSize'] = Yii::app()->user->getState('pageSize', (int) Yii::app()->params['defaultPageSize']);

// Title Bar
$aData['title_bar']['title'] = gT('User administration');
$model = new User();

Expand Down Expand Up @@ -133,9 +139,6 @@ public function adduser()
Permission::model()->insertSomeRecords(array('uid' => $iNewUID, 'permission' => getGlobalSetting('defaulttheme'), 'entity' => 'template', 'read_p' => 1, 'entity_id' => 0));
// add default usersettings to the user
SettingsUser::applyBaseSettings($iNewUID);

// add new user to userlist
//$sresult = User::model()->findAllByAttributes(array('uid' => $iNewUID));

// send Mail
/* @todo : must move this to Plugin (or sendMail as boolean in plugin event) */
Expand Down Expand Up @@ -443,7 +446,9 @@ public function moduser()
$this->_renderWrappedTemplate('user', $aViewUrls, $aData);
}


/**
* Save Permissions
*/
public function savepermissions()
{
if (!Permission::model()->hasGlobalPermission('users', 'update')) {
Expand Down Expand Up @@ -486,6 +491,9 @@ public function savepermissions()
}
}

/**
* Set User permissions
*/
public function setuserpermissions()
{
$iUserID = (int) Yii::app()->request->getPost('uid');
Expand Down Expand Up @@ -531,6 +539,7 @@ public function setuserpermissions()
App()->getClientScript()->registerPackage('jquery-tablesorter');
App()->getClientScript()->registerScriptFile(App()->getConfig('adminscripts') . 'userpermissions.js');

// Fullpage Bar
$aData['fullpagebar']['savebutton']['form'] = 'savepermissions';
$aData['fullpagebar']['closebutton']['url_keep'] = true;
$aData['fullpagebar']['closebutton']['url'] = Yii::app()->request->getUrlReferrer(Yii::app()->createUrl("admin/user/sa/index"));
Expand All @@ -545,6 +554,9 @@ public function setuserpermissions()
}
}

/**
* Set User Templates
*/
public function setusertemplates()
{
App()->getClientScript()->registerPackage('jquery-tablesorter');
Expand Down Expand Up @@ -574,6 +586,9 @@ public function setusertemplates()
$this->_renderWrappedTemplate('user', 'setusertemplates', $aData);
}

/**
* User Templates
*/
public function usertemplates()
{
$postuserid = (int) Yii::app()->request->getPost('uid');
Expand Down Expand Up @@ -618,7 +633,7 @@ public function personalsettings()
{
// Save Data
if (Yii::app()->request->getPost("action")) {
$oUserModel = User::model()->findByPk(Yii::app()->session['loginID']);
$oUserModel = User::model()->findByPk(Yii::app()->session['loginID']);
$uresult = true;

if (Yii::app()->request->getPost('newpasswordshown') == "1") {
Expand All @@ -631,7 +646,7 @@ public function personalsettings()

$newPassword = Yii::app()->request->getPost('password');
$repeatPassword = Yii::app()->request->getPost('repeatpassword');
$oUserModel->email = Yii::app()->request->getPost('email');
$oUserModel->email = Yii::app()->request->getPost('email');

//if only email should be changed, then just check the current password
$currentPasswordOk = $oUserModel->checkPassword($oldPassword);
Expand Down Expand Up @@ -712,10 +727,11 @@ public function personalsettings()
$aData['sFullname'] = $oUser->full_name;
$aData['sEmailAdress'] = $oUser->email;
$aData['passwordHelpText'] = $oUser->getPasswordHelpText();

// Fullpager Bar
$aData['fullpagebar']['savebutton']['form'] = 'personalsettings';
$aData['fullpagebar']['saveandclosebutton']['form'] = 'personalsettings';
$aData['fullpagebar']['closebutton']['url_keep'] = true;
$aData['fullpagebar']['closebutton']['url'] = Yii::app()->request->getUrlReferrer(Yii::app()->createUrl("admin"));
$aData['fullpagebar']['white_closebutton']['url'] = Yii::app()->request->getUrlReferrer(Yii::app()->createUrl("admin"));

// Green Bar Page Title
$aData['pageTitle'] = gT('My Account');
Expand Down Expand Up @@ -751,6 +767,10 @@ public function personalsettings()
}
}

/**
* Toggle Setting
* @param int $surveyid
*/
public function togglesetting($surveyid = 0)
{
$setting = Yii::app()->request->getPost('setting');
Expand All @@ -767,7 +787,7 @@ public function togglesetting($surveyid = 0)
* @param int $uid
* @return string|boolean
*/
private function _getUserNameFromUid($uid)
private function _getUserNameFromUid(int $uid)
{
$uid = sanitize_int($uid);
$result = User::model()->findByPk($uid);
Expand All @@ -779,6 +799,9 @@ private function _getUserNameFromUid($uid)
}
}

/**
* Refresh templates
*/
private function _refreshtemplates()
{
$template_a = Template::getTemplateList();
Expand Down Expand Up @@ -810,9 +833,12 @@ private function _refreshtemplates()
}

/**
* Escape string
* @param string $str
* @param bool $like Default is false.
* @return string
*/
private function escape_str($str, $like = false)
private function escape_str(string $str, bool $like = false)
{
if (is_array($str)) {
foreach ($str as $key => $val) {
Expand All @@ -829,7 +855,10 @@ private function escape_str($str, $like = false)
}

/**
* Remove invisible characters.
* @param string $str
* @param bool $url_encoded Default is true.
* @return string
*/
private function remove_invisible_characters($str, $url_encoded = true)
{
Expand All @@ -853,7 +882,15 @@ private function remove_invisible_characters($str, $url_encoded = true)
}

/**
* Message Box with redirect
* @param string $title
* @param string $message
* @param string $classMsg
* @param string $extra
* @param string $urlText
* @param array $hiddenVars
* @param string $classMbTitle
* @todo to many arguments
*/
private function _messageBoxWithRedirect($title, $message, $classMsg, $extra = "", $url = "", $urlText = "", $hiddenVars = array(), $classMbTitle = "header ui-widget-header")
{
Expand All @@ -876,9 +913,10 @@ private function _messageBoxWithRedirect($title, $message, $classMsg, $extra = "
/**
* 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.
* @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.
* @param bool $sRenderFile
*/
protected function _renderWrappedTemplate($sAction = 'user', $aViewUrls = array(), $aData = array(), $sRenderFile = false)
{
Expand Down

0 comments on commit aa0e84e

Please sign in to comment.