Skip to content

Commit

Permalink
Unset temporary variables to prevent their accidental use
Browse files Browse the repository at this point in the history
  • Loading branch information
mystralkk committed Mar 8, 2017
1 parent 40449d0 commit da0d332
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 12 deletions.
22 changes: 12 additions & 10 deletions public_html/users.php
Expand Up @@ -540,12 +540,13 @@ function resend_request()
foreach ($data as $key => &$value) {
if ($key == CSRF_TOKEN) {
$value = SEC_createToken();
} else {
} else {
if ($magic) {
$value = stripslashes_gpc_recursive($value);
}
}
}
unset($value);

$returnUrl = $returnUrl . '?' . http_build_query($data);
$req = new HTTP_Request2($returnUrl, HTTP_Request2::METHOD_GET);
Expand Down Expand Up @@ -681,7 +682,7 @@ function resend_request()
}
} else {
// this request doesn't make sense - ignore it
COM_redirect($_CONF['site_url'] . '/index.php');
COM_redirect($_CONF['site_url'] . '/index.php');
}
break;

Expand All @@ -693,8 +694,8 @@ function resend_request()
$_CONF['site_url'] . '/users.php?'
. http_build_query(array(
'mode' => 'newpwd',
'uid' => (int) Geeklog\Input::fPost('uid'),
'rid' => Geeklog\Input::post('rid')
'uid' => (int) Geeklog\Input::fPost('uid'),
'rid' => Geeklog\Input::post('rid'),
))
);
} else {
Expand Down Expand Up @@ -791,7 +792,8 @@ function resend_request()
} elseif ($_CONF['user_login_method']['openid'] &&
($_CONF['usersubmission'] == 0) &&
!$_CONF['disable_new_user_registration'] &&
(Geeklog\Input::get('openid_login') == '1')) {
(Geeklog\Input::get('openid_login') == '1')
) {
// Here we go with the handling of OpenID authentication.

$query = array_merge($_GET, $_POST);
Expand Down Expand Up @@ -888,18 +890,18 @@ function resend_request()

$consumer->setRedirectURL($callback_url);
$oauth_userinfo = $consumer->authenticate_user();
if ( $oauth_userinfo === false ) {

if ($oauth_userinfo === false) {
COM_updateSpeedlimit('login');
COM_errorLog("OAuth Error: " . $consumer->error, 1);
COM_redirect($_CONF['site_url'] . '/users.php?msg=111'); // OAuth authentication error
}
if ( $consumer->doAction($oauth_userinfo) == NULL ) {

if ($consumer->doAction($oauth_userinfo) == null) {
COM_errorLog("Oauth: Error creating new user in OAuth authentication", 1);
COM_redirect($_CONF['site_url'] . '/users.php?msg=111'); // OAuth authentication error
}
}
}
} else {
$status = -2; // User just visited login page no error. -1 = error
}
Expand Down
2 changes: 1 addition & 1 deletion system/classes/language.class.php
Expand Up @@ -420,8 +420,8 @@ public static function adminMassDelete()
foreach ($ids as &$id) {
$id = intval($id, 10);
}

unset($id);

$sql = "DELETE FROM {$_TABLES['language_items']} "
. " WHERE (id IN (" . implode(',', $ids) . ")) ";
DB_query($sql);
Expand Down
2 changes: 2 additions & 0 deletions system/classes/scripts.class.php
Expand Up @@ -233,6 +233,7 @@ private function setJavaScriptLibraries()
$file['load'] = false;
}
}
unset($file);
}
} elseif ($this->jquery_ui_cdn) { // This might happen if a jQuery UI file is not found
$librarycode .= '<script type="text/javascript" src="' . $_CONF['site_url'] . '/' . $this->library_files['jquery']['file'] . '"></script>' . LB;
Expand All @@ -244,6 +245,7 @@ private function setJavaScriptLibraries()
$file['load'] = false;
}
}
unset($file);
}

// Now load in the rest of the libraries
Expand Down
1 change: 0 additions & 1 deletion system/classes/story.class.php
Expand Up @@ -1938,7 +1938,6 @@ public static function getRelatedArticlesByKeywords($articleId, $keywordList, $l
break;
}
}

unset($item);

if (!$found) {
Expand Down
2 changes: 2 additions & 0 deletions system/lib-story.php
Expand Up @@ -758,6 +758,8 @@ function STORY_whatsRelated($related, $uid, $sid)
$value = COM_checkWords($value, 'story');
}
}
unset($value);

}

$topics = array();
Expand Down

0 comments on commit da0d332

Please sign in to comment.