Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sucs-site
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
George Henry Woolley
sucs-site
Commits
587bea14
Commit
587bea14
authored
10 years ago
by
Imran Hussain
Browse files
Options
Downloads
Patches
Plain Diff
fixed deletion of hackergotchis
parent
248fa786
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
components/options.php
+12
-71
12 additions, 71 deletions
components/options.php
with
12 additions
and
71 deletions
components/options.php
+
12
−
71
View file @
587bea14
...
...
@@ -26,7 +26,12 @@ function changePassword ($oldpass, $newpass1, $newpass2) {
trigger_error
(
"New passwords do not match"
,
E_USER_WARNING
);
return
FALSE
;
}
/*
if (!strongPassword($newpass1)) {
trigger_error("New password is too weak.", E_USER_WARNING);
return FALSE;
}
*/
$reason
=
weakPassword
(
$newpass1
);
if
(
$reason
!==
FALSE
)
{
trigger_error
(
"New password is weak:
$reason
"
,
E_USER_WARNING
);
...
...
@@ -136,7 +141,7 @@ function clearHackergotchi() {
global
$session
;
$imagefilepath
=
hackergotchiPath
(
$session
->
username
);
if
(
unlink
(
$imagefilepath
))
{
if
(
unlink
(
realpath
(
$imagefilepath
))
)
{
return
true
;
}
else
{
trigger_error
(
"Unable to remove hackergotchi file"
,
E_USER_ERROR
);
...
...
@@ -154,15 +159,8 @@ function hackergotchiPath($username) {
// Takes an entry from $_FILES and makes this the new hackergotchi
function
updateHackergotchi
(
$fileDetails
)
{
global
$session
;
if
(
((
list
(
$width
,
$height
,
$type
,
$attr
)
=
@
getimagesize
(
$fileDetails
[
'tmp_name'
]))
!==
false
))
{
if
(
$type
!=
IMAGETYPE_PNG
)
{
trigger_error
(
"Uploaded hackergotchi is not in PNG format. Please convert your image to PNG and try again."
,
E_USER_ERROR
);
return
FALSE
;
}
else
if
((
$width
>
128
)
||
(
$height
>
128
))
{
trigger_error
(
"Uploaded hackergotchi is too large. Hackergotchis must be 128x128 pixels or smaller."
,
E_USER_ERROR
);
return
FALSE
;
}
if
(
((
list
(
$width
,
$height
,
$type
,
$attr
)
=
@
getimagesize
(
$fileDetails
[
'tmp_name'
]))
!==
false
)
&&
(
$type
==
IMAGETYPE_PNG
)
&&
(
$width
<=
128
)
&&
(
$height
<=
128
))
{
$imagefilepath
=
hackergotchiPath
(
$session
->
username
);
...
...
@@ -170,40 +168,12 @@ function updateHackergotchi($fileDetails) {
if
(
move_uploaded_file
(
$fileDetails
[
'tmp_name'
],
$imagefilepath
)
&&
chmod
(
$imagefilepath
,
0644
)
)
{
return
TRUE
;
}
}
}
// We should have returned True by now
trigger_error
(
"There was an error updating your hackergotchi. Please contact admin."
,
E_USER_ERROR
);
return
FALSE
;
}
function
changeBlogFeed
(
$type
,
$feed
,
$syndicate
)
{
global
$sucsDB
,
$session
,
$smarty
;
if
(
$type
==
"sucs"
)
{
$feed
=
"http://sucs.org/blog/feed/atom/"
.
$session
->
username
;
}
if
(
$syndicate
==
"on"
)
{
$syndicate
=
"t"
;
}
else
{
$syndicate
=
"f"
;
}
// try to read up to 100KB of the provided feed uri
if
(
@
file_get_contents
(
$feed
,
FALSE
,
null
,
0
,
100000
)
==
FALSE
)
{
trigger_error
(
"Unable to read from provided blog feed URL"
,
E_USER_WARNING
);
return
FALSE
;
}
if
(
$sucsDB
->
Execute
(
"UPDATE members SET blogfeed=?,syndicateblog=? WHERE username=?"
,
array
(
$feed
,
$syndicate
,
$session
->
username
))
==
FALSE
)
{
return
FALSE
;
}
include
(
"planetconfig.php"
);
return
TRUE
;
}
function
updateRenew
()
{
global
$sucsDB
,
$session
,
$error
;
global
$paydate
;
...
...
@@ -242,9 +212,8 @@ $smarty->assign('session', $session);
if
(
$session
->
loggedin
===
TRUE
)
{
$sucsDB
=
NewADOConnection
(
'postgres8'
);
$sucsDB
->
Connect
(
'dbname='
.
$sucsdbname
.
' user=apache'
);
$sucsDB
->
Connect
(
'dbname='
.
$sucsdbname
);
$sucsDB
->
SetFetchMode
(
ADODB_FETCH_ASSOC
);
// $sucsDB->debug = true;
$newGuestNetMAC
=
getGuestNetMAC
();
...
...
@@ -279,13 +248,6 @@ if ($session->loggedin === TRUE) {
message_flash
(
'Hackergotchi Cleared'
);
}
break
;
case
'changeblogfeed'
:
if
(
changeBlogFeed
(
$_POST
[
'blogtype'
],
$_POST
[
'bloguri'
],
$_POST
[
'syndicateblog'
])){
message_flash
(
"Blog Feed Updated"
);
}
else
{
trigger_error
(
"Blog Feed has not been updated"
,
E_USER_NOTICE
);
}
break
;
case
'renew'
:
if
(
updateRenew
())
{
message_flash
(
'Account renewed'
);
...
...
@@ -303,6 +265,7 @@ if ($session->loggedin === TRUE) {
$member
=
$sucsDB
->
GetRow
(
"select * from members left join member_type on members.type=member_type.id where username='"
.
$session
->
username
.
"'"
);
$smarty
->
assign
(
'member'
,
$member
);
$smarty
->
assign
(
'paydate'
,
$paydate
);
if
((
$currentGuestNetMAC
=
$sucsDB
->
GetOne
(
'SELECT * FROM guestnet WHERE uid=?'
,
array
((
int
)
$member
[
'uid'
])))
!==
FALSE
)
{
...
...
@@ -316,28 +279,6 @@ if ($session->loggedin === TRUE) {
}
// connect to Blog DB to see if user has a SUCS blog
require_once
(
"/usr/share/php/adodb/adodb.inc.php"
);
$BlogDB
=
NewADOConnection
(
'postgres8'
);
$BlogDB
->
Connect
(
'dbname=blogs user=apache'
);
$BlogDB
->
SetFetchMode
(
ADODB_FETCH_ASSOC
);
require_once
(
'../lib/blog/validation.lib.php'
);
if
(
blogger
(
$session
->
username
))
{
$smarty
->
assign
(
"sucsblogger"
,
TRUE
);
$feed
=
"http://sucs.org/blog/feed/atom/"
.
$session
->
username
;
if
(
$member
[
'blogfeed'
]
==
$feed
)
{
$smarty
->
assign
(
"sucsblogfeed"
,
TRUE
);
}
}
// change postgresql boolean to PHP boolean
if
(
$member
[
'syndicateblog'
]
==
't'
)
{
$member
[
'syndicateblog'
]
=
true
;
}
else
{
$member
[
'syndicateblog'
]
=
false
;
}
$smarty
->
assign
(
'member'
,
$member
);
}
$smarty
->
assign
(
'url'
,
$component
[
'path'
]);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment