From c0d05d08096b4de370183c7583733a90bba84193 Mon Sep 17 00:00:00 2001 From: Sanky Date: Sat, 12 Nov 2011 13:53:23 +0100 Subject: [PATCH] Can now edit date formats in profile. Should be stable. --- editprofile.php | 9 ++++++++- edituser.php | 20 +++++++++++++------- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/editprofile.php b/editprofile.php index 98deb90..474748d 100644 --- a/editprofile.php +++ b/editprofile.php @@ -143,6 +143,10 @@ $tccellh> Options$tccellh>  $tccell1>Timezone offset:$descbr How many hours you're offset from the time on the board (".date($dateformat,ctime())."). $tccell2l>$inpt=timezone VALUE=$loguser[timezone] SIZE=5 MAXLENGTH=5> + $tccell1>Date format:$descbr How dates on the board are displayed (uses the PHP date() function). + $tccell2l>$inpt=dateformat VALUE=\"$dateformat\" SIZE=16 MAXLENGTH=32> + $tccell1>Short date format:$descbr A short date format displayed on certain pages. + $tccell2l>$inpt=dateshort VALUE=\"$dateshort\" SIZE=8 MAXLENGTH=32> $tccell1>Posts per page:$descbr The maximum number of posts you want to be shown in a page in threads. $tccell2l>$inpt=postsperpage SIZE=4 MAXLENGTH=4 VALUE=$loguser[postsperpage]> $tccell1>Threads per page:$descbr The maximum number of threads you want to be shown in a page in forums. @@ -214,7 +218,10 @@ } if(!isset($useranks)) $useranks=$loguser[useranks]; - mysql_query("UPDATE users SET `password` = '$passwordenc', `picture` = '$picture', `minipic` = '$minipic', `signature` = '$signature', `bio` = '$bio', `email` = '$email', `icq` = '$icq', `title` = '$title', `useranks` = '$useranks', `aim` = '$aim', `sex` = '$sex', `homepageurl` = '$homepage', `homepagename` = '$pagename', `timezone` = '$timezone', `postsperpage` = '$postsperpage', `realname` = '$realname', `location` = '$location', `postbg` = '$postbg', `postheader` = '$postheader', `birthday` = '$birthday', `scheme` = '$sscheme', `threadsperpage` = '$threadsperpage', `viewsig` = '$viewsig', `layout` = '$tlayout', `moodurl` = '". $_POST['moodurl'] ."', `posttool` = '$posttool', `imood` = '$imood', `signsep` = '$signsep', `pagestyle` = '$pagestyle', `pollstyle` = '$pollstyle' WHERE `id` = '$loguserid' AND `password` = '$userpass'") OR print mysql_error(); + $dateformat = str_replace("'", "", $_POST['dateformat']); + $dateshort = str_replace("'", "", $_POST['dateshort']); + + mysql_query("UPDATE users SET `password` = '$passwordenc', `picture` = '$picture', `minipic` = '$minipic', `signature` = '$signature', `bio` = '$bio', `email` = '$email', `icq` = '$icq', `title` = '$title', `useranks` = '$useranks', `aim` = '$aim', `sex` = '$sex', `homepageurl` = '$homepage', `homepagename` = '$pagename', `timezone` = '$timezone', `dateformat` = '$dateformat', `dateshort` = '$dateshort', `postsperpage` = '$postsperpage', `realname` = '$realname', `location` = '$location', `postbg` = '$postbg', `postheader` = '$postheader', `birthday` = '$birthday', `scheme` = '$sscheme', `threadsperpage` = '$threadsperpage', `viewsig` = '$viewsig', `layout` = '$tlayout', `moodurl` = '". $_POST['moodurl'] ."', `posttool` = '$posttool', `imood` = '$imood', `signsep` = '$signsep', `pagestyle` = '$pagestyle', `pollstyle` = '$pollstyle' WHERE `id` = '$loguserid' AND `password` = '$userpass'") OR print mysql_error(); print "$header
$tblstart$tccell1>Thank you, $loguser[name], for editing your profile.
".redirect("profile.php?id=$loguserid",'view your profile',0).$tblend; } diff --git a/edituser.php b/edituser.php index 07d7e49..eede8f1 100644 --- a/edituser.php +++ b/edituser.php @@ -45,8 +45,8 @@ $sexlist=" $radio=sex value=0 $check2[0]>Male    $radio=sex value=1 $check2[1]>Female    - $radio=sex value=2 $check2[2]>N/A - $radio=sex value=-378>Raw value
+ $radio=sex value=2 $check2[2]>N/A + $radio=sex value=-378>Raw value
$inpt=sexn value=$user[sex]>"; $vsig=" $radio=viewsig value=0 $checked2[0]>Disabled    @@ -139,6 +139,8 @@ $lft Homepage URL $rgt$inpt=homepage VALUE=\"$user[homepageurl]\" SIZE=60 MAXLENGTH=80> $hlft Options $hrgt $lft Timezone offset $rgt$inpt=timezone SIZE=5 MAXLENGTH=5 VALUE=$user[timezone]> + $lft Date format $rgt$inpt=dateformat VALUE=\"$dateformat\" SIZE=16 MAXLENGTH=32> + $lft Short date format $rgt$inpt=dateshort VALUE=\"$dateshort\" SIZE=8 MAXLENGTH=32> $lft Posts per page $rgt$inpt=postsperpage SIZE=5 MAXLENGTH=5 VALUE=$user[postsperpage]> $lft Threads per page $rgt$inpt=threadsperpage SIZE=4 MAXLENGTH=4 VALUE=$user[threadsperpage]> $lft Use text toolbar when posting $rgt$vtool @@ -161,11 +163,15 @@ $birthday=@mktime(0,0,0,$bmonth,$bday,$byear); if(!$bmonth && !$bday && !$byear) $birthday=0; if($password) $passedit=", `password` = '".md5($password)."'"; - //mysql_query("INSERT logs SET useraction ='Edit User ".$user[nick]."(".$user[id]."'"); - if ($sex == -378) { - $sex = $sexn; + //mysql_query("INSERT logs SET useraction ='Edit User ".$user[nick]."(".$user[id]."'"); + if ($sex == -378) { + $sex = $sexn; } - mysql_query("UPDATE `users` SET `posts` = '$numposts', `regdate` = '$regtime', `name` = '$username'$passedit, `picture` = '$picture', `signature` = '$signature', `bio` = '$bio', `powerlevel` = '$powerlevel', `title` = '$usertitle', `email` = '$email', `icq` = '$icq', `aim` = '$aim', `sex` = '$sex', `homepageurl` = '$homepage', `timezone` = '$timezone', `postsperpage` = '$postsperpage', `realname` = '$realname', `location` = '$location', `postbg` = '$postbg', `postheader` = '$postheader', `useranks` = '$useranks', `birthday` = '$birthday', `minipic` = '$minipic', `homepagename` = '$pagename', `scheme` = '$sscheme', `threadsperpage` = '$threadsperpage', `viewsig` = '$viewsig', `layout` = '$tlayout', `posttool` = '$posttool', `moodurl` = '$moodurl', `profile_locked` = '$profile_locked', `editing_locked` = '$editing_locked' WHERE `id` = '$userid'") or print mysql_error(); + + $dateformat = str_replace("'", "", $_POST['dateformat']); + $dateshort = str_replace("'", "", $_POST['dateshort']); + + mysql_query("UPDATE `users` SET `posts` = '$numposts', `regdate` = '$regtime', `name` = '$username'$passedit, `picture` = '$picture', `signature` = '$signature', `bio` = '$bio', `powerlevel` = '$powerlevel', `title` = '$usertitle', `email` = '$email', `icq` = '$icq', `aim` = '$aim', `sex` = '$sex', `homepageurl` = '$homepage', `timezone` = '$timezone', `dateformat` = '$dateformat', `dateshort` = '$dateshort', `postsperpage` = '$postsperpage', `realname` = '$realname', `location` = '$location', `postbg` = '$postbg', `postheader` = '$postheader', `useranks` = '$useranks', `birthday` = '$birthday', `minipic` = '$minipic', `homepagename` = '$pagename', `scheme` = '$sscheme', `threadsperpage` = '$threadsperpage', `viewsig` = '$viewsig', `layout` = '$tlayout', `posttool` = '$posttool', `moodurl` = '$moodurl', `profile_locked` = '$profile_locked', `editing_locked` = '$editing_locked' WHERE `id` = '$userid'") or print mysql_error(); print " $tblstart $tccell1>Thank you, $loguser[name], for editing this user.
@@ -174,4 +180,4 @@ } print $footer; printtimedif($startingtime); -?> \ No newline at end of file +?>