Bravo List
Register
Go Back   > Bravo List > Source Code > Archived Trackers > TBDev > Mods & Themes
Reply
  #1  
Old 27th July 2011, 02:38
tobbz tobbz is offline
Member
 
Join Date: Feb 2009
P2P
Posts: 9
Default User CP mod
This mod will make a my.php similar look but much cleaner and easier to use, you can also replace this one with my.php (TBDev 2009)

I've tested this and works without any problems, if you need assistance dont hesitate to ask.

Save this and upload it to root usercp.php:


PHP Code:
<?php
/*
+------------------------------------------------
|   $Date$ 010810
|   $Revision$ 2.0
|   $Author$ Bigjoos
|   $URL$
|   $usercp
|   
+------------------------------------------------
*/
require_once "include/bittorrent.php";
require_once 
"include/html_functions.php";
require_once 
"include/user_functions.php";
require_once 
"/cache/timezones.php";
dbconn(false);
loggedinorreturn();

    
$lang array_mergeload_language('global'), load_language('usercp') );

    
$HTMLOUT '';
     
    
$stylesheets ='';
    
$ss_r mysql_query("SELECT * from stylesheets") or die;
    
$ss_sa = array();
    while (
$ss_a mysql_fetch_assoc($ss_r))
    {
    
$ss_id $ss_a["id"];
    
$ss_name $ss_a["name"];
    
$ss_sa[$ss_name] = $ss_id;
    }
    
ksort($ss_sa);
    
reset($ss_sa);
    while (list(
$ss_name$ss_id) = each($ss_sa))
    {
    if (
$ss_id == $CURUSER["stylesheet"])
    { 
    
$ss " selected='selected'";
    }
    else
    {
    
$ss "";
    }
    
$stylesheets .= "<option value='$ss_id'$ss>$ss_name</option>\n";
    }

    
$countries "<option value='0'>---- {$lang['usercp_none']} ----</option>\n";
    
$ct_r mysql_query("SELECT id,name FROM countries ORDER BY name") or sqlerr(__FILE__,__LINE__);
    while (
$ct_a mysql_fetch_assoc($ct_r))
    {
    
$countries .= "<option value='{$ct_a['id']}'" . ($CURUSER["country"] == $ct_a['id'] ? " selected='selected'" "") . ">{$ct_a['name']}</option>\n";
    }

    
$offset = ($CURUSER['time_offset'] != "") ? (string)$CURUSER['time_offset'] : (string)$TBDEV['time_offset'];
    
$time_select "<select name='user_timezone'>";
       
        foreach( 
$TZ as $off => $words )
        {
        if ( 
preg_match("/^time_(-?[\d\.]+)$/"$off$match))
        {
        
$time_select .= $match[1] == $offset "<option value='{$match[1]}' selected='selected'>$words</option>\n" "<option value='{$match[1]}'>$words</option>\n";
        }
        }
        
$time_select .= "</select>";
        
        if (
$CURUSER['dst_in_use'])
        {
        
$dst_check 'checked="checked"';
        }
        else
        {
        
$dst_check '';
        }

        if (
$CURUSER['auto_correct_dst'])
        {
        
$dst_correction 'checked="checked"';
        }
        else
        {
        
$dst_correction '';
        }
    
        
$HTMLOUT .= "<script type='text/javascript'>
        /*<![CDATA[*/
        function daylight_show()
        {
        if ( document.getElementById( 'tz-checkdst' ).checked )
        {
        document.getElementById( 'tz-checkmanual' ).style.display = 'none';
        }
        else
        {
        document.getElementById( 'tz-checkmanual' ).style.display = 'block';
        }
        }
        /*]]>*/
        </script>"
;

    
$action = isset($_GET["action"]) ? htmlspecialchars(trim($_GET["action"])) : '';

    if (isset(
$_GET["edited"])) 
    {
    
$HTMLOUT .="<div class='roundedCorners' align='center' style='width:80%; background:#bcffbf; border:1px solid #49c24f; color:#333333;padding:5px;font-weight:bold;'>{$lang['usercp_updated']}!</div>";
    if (isset(
$_GET["mailsent"]))
    
$HTMLOUT .= "<h2>{$lang['usercp_mail_sent']}!</h2>\n";
    }
    elseif (isset(
$_GET["emailch"]))
    {
    
$HTMLOUT .= "<h1>{$lang['usercp_emailch']}!</h1>\n";
    }

    
$HTMLOUT .="<h1>Welcome <a href='userdetails.php?id=$CURUSER[id]'>$CURUSER[username]</a> !</h1>\n
    <form method='post' action='takeeditcp.php'>
    <table border='1' width='600' cellspacing='0' cellpadding='3' align='center'><tr>
    <td width='600' valign='top'>"
;
    
//== Avatar
    
if ($action == "avatar") {
    
$HTMLOUT .= begin_table(true);
    
$HTMLOUT .="<tr><td align='left' class='colhead' style='height:25px;' colspan='2'><input type='hidden' name='action' value='avatar' />Avatar Options</td></tr>";
    
$HTMLOUT .= tr($lang['usercp_avatar'], "<input name='avatar' size='50' value='" htmlspecialchars($CURUSER["avatar"]) ."' /><br />\n{$lang['usercp_avatar_info']}",1);
    
$HTMLOUT .= tr($lang['usercp_view_avatars'], "<input type='checkbox' name='avatars'" . ($CURUSER["avatars"] == "yes" " checked='checked'" "") . " /> {$lang['usercp_low_bw']}",1);
    
$HTMLOUT .="<tr><td align='center' colspan='2'><input type='submit' value='Submit changes!' style='height: 25px' /></td></tr>";
    
$HTMLOUT .= end_table();
    } 
    
//== Signature
    
elseif ($action == "signature") {
    
$HTMLOUT .= begin_table(true);
    
$HTMLOUT .="<tr><td align='left' class='colhead' style='height:25px;' colspan='2'><input type='hidden' name='action' value='signature' />Signature Options</td></tr>";
    
$HTMLOUT .= tr($lang['usercp_signature'], "<input name='signature' size='50' value='" htmlspecialchars($CURUSER["signature"]) ."' /><br />\n{$lang['usercp_signature_info']}",1);
    
$HTMLOUT .= tr($lang['usercp_view_signatures'], "<input type='checkbox' name='signatures'" . ($CURUSER["signatures"] == "yes" " checked='checked'" "") . " /> {$lang['usercp_low_bw']}",1);
    
$HTMLOUT .= tr($lang['usercp_info'], "<textarea name='info' cols='50' rows='4'>" htmlentities($CURUSER["info"], ENT_QUOTES) . "</textarea><br />{$lang['usercp_tags']}"1);
    
$HTMLOUT .="<tr ><td align='center' colspan='2'><input type='submit' value='Submit changes!' style='height: 25px' /></td></tr>";
    
$HTMLOUT .= end_table();
    }
    
//== Security
    
elseif ($action == "security") {
    
$HTMLOUT .= begin_table(true);
    
$HTMLOUT .="<tr><td class='colhead' colspan='2' style='height:25px;'><input type='hidden' name='action' value='security' />Security Options</td></tr>";
    
$HTMLOUT .= tr($lang['usercp_email'], "<input type='text' name='email' size='50' value='" htmlspecialchars($CURUSER["email"]) . "' /><br />{$lang['usercp_email_pass']}<br /><input type='password' name='chmailpass' size='50' />"1);
    
$HTMLOUT .= "<tr><td colspan='2' align='left'>{$lang['usercp_note']}</td></tr>\n";
    
$HTMLOUT .= tr($lang['usercp_chpass'], "<input type='password' name='chpassword' size='50' />"1);
    
$HTMLOUT .= tr($lang['usercp_pass_again'], "<input type='password' name='passagain' size='50' />"1);
    
$HTMLOUT .="<tr ><td align='center' colspan='2'><input type='submit' value='Submit changes!' style='height: 25px' /></td></tr>";
    
$HTMLOUT .= end_table();
    } 
    
//== Torrents
    
elseif ($action == "torrents") {
    
$HTMLOUT .= begin_table(true);
    
$HTMLOUT .="<tr><td class='colhead' colspan='2'  style='height:25px;' ><input type='hidden' name='action' value='torrents' />Torrent Options</td></tr>";
    
$categories '';
    
$r mysql_query("SELECT id,name FROM categories ORDER BY name") or sqlerr();
    if (
mysql_num_rows($r) > 0)
    {
    
$categories .= "<table><tr>\n";
    
$i 0;
    while (
$a mysql_fetch_assoc($r))
    {
    
$categories .=  ($i && $i == 0) ? "</tr><tr>" "";
    
$categories .= "<td class='bottom' style='padding-right: 5px'><input name='cat{$a['id']}' type='checkbox' " . (strpos($CURUSER['notifs'], "[cat{$a['id']}]") !== false " checked='checked'" "") . " value='yes' /> " htmlspecialchars($a["name"]) . "</td>\n";
    ++
$i;
    }
    
$categories .= "</tr></table>\n";
    }
    
$HTMLOUT .= tr($lang['usercp_email_notif'], "<input type='checkbox' name='pmnotif'" . (strpos($CURUSER['notifs'], "[pm]") !== false " checked='checked'" "") . " value='yes' /> {$lang['usercp_notify_pm']}<br />\n" .
     
"<input type='checkbox' name='emailnotif'" . (strpos($CURUSER['notifs'], "[email]") !== false " checked='checked'" "") . " value='yes' /> {$lang['usercp_notify_torrent']}\n"1);
    
$HTMLOUT .= tr($lang['usercp_browse'],$categories,1);
    
$HTMLOUT .="<tr><td align='center' colspan='2'><input type='submit' value='Submit changes!' style='height: 25px' /></td></tr>";
    
$HTMLOUT .= end_table();
    }
    
//== Personal
    
elseif ($action == "personal") {
    
$HTMLOUT .= begin_table(true);
    
$HTMLOUT .="<tr><td class='colhead' colspan='2'  style='height:25px;' ><input type='hidden' name='action' value='personal' />Personal Options</td></tr>"
    
$HTMLOUT .= tr($lang['usercp_tor_perpage'], "<input type='text' size='10' name='torrentsperpage' value='$CURUSER[torrentsperpage]' /> {$lang['usercp_default']}",1);
    
$HTMLOUT .= tr($lang['usercp_top_perpage'], "<input type='text' size='10' name='topicsperpage' value='$CURUSER[topicsperpage]' /> {$lang['usercp_default']}",1);
    
$HTMLOUT .= tr($lang['usercp_post_perpage'], "<input type='text' size='10' name='postsperpage' value='$CURUSER[postsperpage]' /> {$lang['usercp_default']}",1);
    
$HTMLOUT .= tr($lang['usercp_tz'], $time_select ,1);
    
$HTMLOUT .= tr($lang['usercp_checkdst'], "<input type='checkbox' name='checkdst' id='tz-checkdst' onclick='daylight_show()' value='1' $dst_correction /> {$lang['usercp_auto_dst']}<br />
    <div id='tz-checkmanual' style='display: none;'><input type='checkbox' name='manualdst' value='1' 
$dst_check /> {$lang['usercp_is_dst']}</div>",1);
    
$HTMLOUT .= tr($lang['usercp_language'], "English",1);
    
$HTMLOUT .= tr($lang['usercp_country'], "<select name='country'>\n$countries\n</select>",1);
    
$HTMLOUT .= tr($lang['usercp_stylesheet'], "<select name='stylesheet'>\n$stylesheets\n</select>",1);
    
$HTMLOUT .="<tr><td align='center' colspan='2'><input type='submit' value='Submit changes!' style='height: 25px' /></td></tr>";
    
$HTMLOUT .= end_table();
    } else {
    
//== Pms
    
$HTMLOUT .= begin_table(true);
    
$HTMLOUT .= "<tr><td class='colhead' colspan='2'  style='height:25px;' ><input type='hidden' name='action' value='pm' />Pm options</td></tr>";
    
$HTMLOUT .= tr($lang['usercp_accept_pm'],
    
"<input type='radio' name='acceptpms'" . ($CURUSER["acceptpms"] == "yes" " checked='checked'" "") . " value='yes' />{$lang['usercp_except_blocks']}
    <input type='radio' name='acceptpms'" 
.  ($CURUSER["acceptpms"] == "friends" " checked='checked'" "") . " value='friends' />{$lang['usercp_only_friends']}
    <input type='radio' name='acceptpms'" 
.  ($CURUSER["acceptpms"] == "no" " checked='checked'" "") . " value='no' />{$lang['usercp_only_staff']}",1);
    
$HTMLOUT .= tr($lang['usercp_delete_pms'], "<input type='checkbox' name='deletepms'" . ($CURUSER["deletepms"] == "yes" " checked='checked'" "") . " /> {$lang['usercp_default_delete']}",1);
    
$HTMLOUT .= tr($lang['usercp_save_pms'], "<input type='checkbox' name='savepms'" . ($CURUSER["savepms"] == "yes" " checked='checked'" "") . " /> {$lang['usercp_default_save']}",1);
    
$HTMLOUT .= "<tr><td align='center' colspan='2'><input type='submit' value='Submit changes!' style='height: 25px' /></td></tr>";
    
$HTMLOUT .= end_table();
    }
    
//==
    
$HTMLOUT .="</td><td width='95' valign='top' ><table border='1'>";
    
$HTMLOUT .="<tr><td class='colhead' width='95'  style='height:25px;' >".htmlentities($CURUSER["username"], ENT_QUOTES) . "'s Avatar</td></tr>";
    if(!empty(
$CURUSER['avatar']) && $CURUSER['av_w'] > && $CURUSER['av_h'] > 5)
    
$HTMLOUT .="<tr><td><img src='{$CURUSER['avatar']}' width='{$CURUSER['av_w']}' height='{$CURUSER['av_h']}' alt='' />
    <a href='mytorrents.php'>
{$lang['usercp_edit_torrents']}</a><br />
    <a href='friends.php'>
{$lang['usercp_edit_friends']}</a><br />
    <a href='users.php'>
{$lang['usercp_search']}</a>
    </td></tr>"
;
    else
    
$HTMLOUT .="<tr><td><img src='{$TBDEV['pic_base_url']}forumicons/default_avatar.gif' alt='' />
    <a href='mytorrents.php'>
{$lang['usercp_edit_torrents']}</a><br />
    <a href='friends.php'>
{$lang['usercp_edit_friends']}</a><br />
    <a href='users.php'>
{$lang['usercp_search']}</a>
    </td></tr>"
;
    
$HTMLOUT .="<tr><td class='colhead' width='95' style='height:18px;'>".htmlentities($CURUSER["username"], ENT_QUOTES) . "'s Menu</td></tr>";
    
$HTMLOUT .="<tr><td align='left'><a href='usercp.php?action=avatar'>Avatar</a></td></tr>
    <tr><td align='left'><a href='usercp.php?action=signature'>Signature</a></td></tr>
    <tr><td align='left'><a href='usercp.php'>Pm's</a></td></tr>
    <tr><td align='left'><a href='usercp.php?action=security'>Security</a></td></tr>
    <tr><td align='left'><a href='usercp.php?action=torrents'>Torrents</a></td></tr>
    <tr><td align='left'><a href='usercp.php?action=personal'>Personal</a></td></tr>
    <tr><td align='left'><a href='invite.php'>Invites</a></td></tr>
    <tr><td align='left'><a href='tenpercent.php'>Lifesaver</a></td></tr>
    <tr><td class='colhead' width='95'>"
.htmlentities($CURUSER["username"], ENT_QUOTES) . "'s Entertainment</td></tr>";
    
$HTMLOUT .="</table></td></tr></table></form>";

print 
stdhead(htmlentities($CURUSER["username"], ENT_QUOTES) . "{$lang['usercp_stdhead']}"false) . $HTMLOUT stdfoot();

?>
Now save this and upload it to root as takeeditcp.php:

PHP Code:
<?php
/*
+------------------------------------------------
|   $Date$ 010810
|   $Revision$ 2.0
|   $Author$ Bigjoos
|   $URL$
|   $takeeditcp
|   
+------------------------------------------------
*/
require_once "include/bittorrent.php";
require_once 
"include/user_functions.php";
require_once 
"include/password_functions.php";
dbconn();
loggedinorreturn();

    
$lang array_mergeload_language('global'), load_language('takeeditcp') );
    

    function 
resize_image($in)
    {
    
$out = array(
    
'img_width'  => $in['cur_width'],
    
'img_height' => $in['cur_height']);
    if ( 
$in['cur_width'] > $in['max_width'] )
    {
    
$out['img_width']  = $in['max_width'];
    
$out['img_height'] = ceil( ( $in['cur_height'] * ( ( $in['max_width'] * 100 ) / $in['cur_width'] ) ) / 100 );
    
$in['cur_height'] = $out['img_height'];
    
$in['cur_width']  = $out['img_width'];
    }
    if ( 
$in['cur_height'] > $in['max_height'] )
    {
    
$out['img_height']  = $in['max_height'];
    
$out['img_width']   = ceil( ( $in['cur_width'] * ( ( $in['max_height'] * 100 ) / $in['cur_height'] ) ) / 100 );
    }
    return 
$out;
    }
    
    
$action = isset($_POST["action"]) ? htmlspecialchars(trim($_POST["action"])) : '';
    
$updateset = array();
    
$urladd='';
    
//== Avatars stuffs
    
if ($action == "avatar") {
    
$avatars = ($_POST["avatars"] != "" "yes" "no");
    
$avatar trimurldecode$_POST["avatar"] ) );
      
      if ( 
preg_match"/^http:\/\/$/i"$avatar 
          or 
preg_match"/[?&;]/"$avatar 
          or 
preg_match("#javascript:#is"$avatar 
          or !
preg_match("#^https?://(?:[^<>*\"]+|[a-z0-9/\._\-!]+)$#iU"$avatar 
          )
      {
        
$avatar='';
      }
      
      if( !empty(
$avatar) ) 
      {
        
$img_size = @GetImageSize$avatar );

        if(
$img_size == FALSE || !in_array($img_size['mime'], $TBDEV['allowed_ext']))
          
stderr($lang['takeprofedit_user_error'], $lang['takeprofedit_image_error']);

        if(
$img_size[0] < || $img_size[1] < 5)
          
stderr($lang['takeprofedit_user_error'], $lang['takeprofedit_small_image']);
      
        if ( ( 
$img_size[0] > $TBDEV['av_img_width'] ) OR ( $img_size[1] > $TBDEV['av_img_height'] ) )
        { 
            
$image resize_image( array(
                             
'max_width'  => $TBDEV['av_img_width'],
                             
'max_height' => $TBDEV['av_img_height'],
                             
'cur_width'  => $img_size[0],
                             
'cur_height' => $img_size[1]
                        )      );
                        
          }
          else 
          {
            
$image['img_width'] = $img_size[0];
            
$image['img_height'] = $img_size[1];
          }
          
    
$updateset[] = "av_w = " $image['img_width'];
    
$updateset[] = "av_h = " $image['img_height'];
    }
    
$updateset[] = "avatar = " sqlesc($avatar);
    
$updateset[] = "avatars = '$avatars'";
    
$action "avatar";
    } 
    
//== Signature stuffs
    
elseif ($action == "signature") {
    
$signatures = (isset($_POST['signatures']) && $_POST["signatures"] != "" "yes" "no");
    
$signature trimurldecode$_POST["signature"] ) );
    if ( 
preg_match"/^http:\/\/$/i"$signature 
    or 
preg_match"/[?&;]/"$signature 
    or 
preg_match("#javascript:#is"$signature 
    or !
preg_match("#^https?://(?:[^<>*\"]+|[a-z0-9/\._\-!]+)$#iU"$signature ))
    {
    
$signature='';
    } 
    if( !empty(
$signature) ) 
    {
    
$img_size = @GetImageSize$signature );
    if(
$img_size == FALSE || !in_array($img_size['mime'], $TBDEV['allowed_ext']))
    
stderr('USER ERROR''Not an image or unsupported image!');
    if(
$img_size[0] < || $img_size[1] < 5)
    
stderr('USER ERROR''Image is too small');
    if ( ( 
$img_size[0] > $TBDEV['sig_img_width'] ) OR ( $img_size[1] > $TBDEV['sig_img_height'] ) )
    { 
    
$image resize_image( array(
    
'max_width'  => $TBDEV['sig_img_width'],
    
'max_height' => $TBDEV['sig_img_height'],
    
'cur_width'  => $img_size[0],
    
'cur_height' => $img_size[1]));
    }
    else
    {
    
$image['img_width'] = $img_size[0];
    
$image['img_height'] = $img_size[1];
    }  
    
$updateset[] = "sig_w = " $image['img_width'];
    
$updateset[] = "sig_h = " $image['img_height']; 
    
$updateset[] = "signature = " sqlesc("[img]".$signature."[/img]\n");
    }
    
$updateset[] = "signatures = '$signatures'";
    if (isset(
$_POST["info"]) && (($info $_POST["info"]) != $CURUSER["info"])){
    
$updateset[] = "info = " sqlesc($info);
    }
    
$action "signature";
    } 
    
//== Security Stuffs
    
elseif ($action == "security") {
    if (!
mkglobal("email:chpassword:passagain:chmailpass:secretanswer"))
    
stderr("Error"$lang['takeeditcp_no_data']);
    if (
$chpassword != ""
    {
    if (
strlen($chpassword) > 40)
    
stderr("Error"$lang['takeeditcp_pass_long']);
    if (
$chpassword != $passagain)
    
stderr("Error"$lang['takeeditcp_pass_not_match']);
    
$secret mksecret();
    
$passhash make_passhash$secretmd5($chpassword) );
    
$updateset[] = "secret = " sqlesc($secret);
    
$updateset[] = "passhash = " sqlesc($passhash);
    
logincookie($CURUSER["id"], md5($passhash.$_SERVER["REMOTE_ADDR"]));
    }
    if (
$email != $CURUSER["email"]) 
    {
    if (!
validemail($email))
    
stderr("Error"$lang['takeeditcp_not_valid_email']);
    
$r = @mysql_query("SELECT id FROM users WHERE email=" sqlesc($email)) or sqlerr();
    if ( 
mysql_num_rows($r) > || ($CURUSER["passhash"] != make_passhash$CURUSER['secret'], md5($chmailpass) ) ) )
    
stderr("Error"$lang['takeeditcp_address_taken']);
    
$changedemail 1;
    }
    
$urladd "";
    
$changedemail 0;
    if (
$changedemail) {
    
$sec mksecret();
    
$hash md5($sec $email $sec);
    
$obemail urlencode($email);
    
$updateset[] = "editsecret = " sqlesc($sec);
    
//$thishost = $_SERVER["HTTP_HOST"];
    //$thisdomain = preg_replace('/^www\./is', "", $thishost);
    
$body str_replace(array('<#USERNAME#>''<#SITENAME#>''<#USEREMAIL#>''<#IP_ADDRESS#>''<#CHANGE_LINK#>'),
    array(
$CURUSER['username'], $TBDEV['site_name'], $email$_SERVER['REMOTE_ADDR'], "{$TBDEV['baseurl']}/confirmemail.php?uid={$CURUSER['id']}&key=$hash&email=$obemail"),
    
$lang['takeeditcp_email_body']);
    
mail($email"$thisdomain {$lang['takeeditcp_confirm']}"$body"From: {$TBDEV['site_email']}");
    
$urladd .= "&mailsent=1";
    }
    
$action "security";
    } 
    
//== Torrent stuffs
    
elseif ($action == "torrents") {
    
$pmnotif = isset($_POST["pmnotif"]) ? $_POST["pmnotif"] : '';
    
$emailnotif = isset($_POST["emailnotif"]) ? $_POST["emailnotif"] : '';
    
$notifs = ($pmnotif == 'yes' "[pm]" "");
    
$notifs .= ($emailnotif == 'yes' "[email]" "");
    
$r = @mysql_query("SELECT id FROM categories") or sqlerr();
    
$rows mysql_num_rows($r);
    for (
$i 0$i $rows; ++$i)
    {
    
$a mysql_fetch_assoc($r);
    if (isset(
$_POST["cat{$a['id']}"]) && $_POST["cat{$a['id']}"] == 'yes')
    
$notifs .= "[cat{$a['id']}]";
    }
    
$updateset[] = "notifs = '$notifs'";
    
$action "torrents";
    } 
    
//== Personal stuffs
    
elseif ($action == "personal") {
    if (isset(
$_POST['stylesheet']) && (($stylesheet = (int)$_POST['stylesheet']) != $CURUSER['stylesheet']) && is_valid_id($stylesheet))
    
$updateset[] = 'stylesheet = ' sqlesc($stylesheet);
    if (isset(
$_POST["country"]) && (($country $_POST["country"]) != $CURUSER["country"]) && is_valid_id($country))
    
$updateset[] = "country = $country";
    if (isset(
$_POST["torrentsperpage"]) && (($torrentspp min(100$_POST["torrentsperpage"])) != $CURUSER["torrentsperpage"]))
    
$updateset[] = "torrentsperpage = $torrentspp";
    if (isset(
$_POST["topicsperpage"]) && (($topicspp min(100$_POST["topicsperpage"])) != $CURUSER["topicsperpage"]))
    
$updateset[] = "topicsperpage = $topicspp";
    if (isset(
$_POST["postsperpage"]) && (($postspp min(100$_POST["postsperpage"])) != $CURUSER["postsperpage"]))
    
$updateset[] = "postsperpage = $postspp";
    if(isset(
$_POST["user_timezone"]) && preg_match('#^\-?\d{1,2}(?:\.\d{1,2})?$#'$_POST['user_timezone']))
    
$updateset[] = "time_offset = " sqlesc($_POST['user_timezone']);
    
$updateset[] = "auto_correct_dst = " .(isset($_POST['checkdst']) ? 0);
    
$updateset[] = "dst_in_use = " .(isset($_POST['manualdst']) ? 0);
    
$action "personal";
    } 
    
//== Pm stuffs
    
elseif ($action == "pm") {
    
$acceptpms_choices = array('yes' => 1'friends' => 2'no' => 3);
    
$acceptpms = (isset($_POST['acceptpms']) ? $_POST['acceptpms'] : 'all');
    if (isset(
$acceptpms_choices[$acceptpms]))
    
$updateset[] = "acceptpms = " sqlesc($acceptpms);
    
$deletepms = isset($_POST["deletepms"]) ? "yes" "no";
    
$updateset[] = "deletepms = '$deletepms'";
    
$savepms = (isset($_POST['savepms']) && $_POST["savepms"] != "" "yes" "no");
    
$updateset[] = "savepms = '$savepms'";
    
$action "pm";
    }
    
//== End == then update the sets :)
    
if (sizeof($updateset)>0
    @
mysql_query("UPDATE users SET " implode(","$updateset) . " WHERE id = " $CURUSER["id"]) or sqlerr(__FILE____LINE__);
    
header("Location: {$TBDEV['baseurl']}/usercp.php?edited=1&action=$action$urladd);
    
?>
add /lang/en/lang_usercp:

PHP Code:
<?php

$lang 
= array(

#usercp gets
'usercp_updated' => 'Profile updated',
'usercp_mail_sent' => 'Confirmation email has been sent',
'usercp_emailch' => 'Email address changed',
'usercp_delete' => 'Delete',

#usercp header
'usercp_logout' => 'Logout',
'usercp_torrents' => 'usercp torrents',
'usercp_users_lists' => 'My users lists',
'usercp_edit_torrents' => 'View/Edit your Torrents',
'usercp_edit_friends' => 'View/Edit your Friends',
'usercp_search' => 'Search Members',

#usercp options
'usercp_none' => 'None selected',
'usercp_accept_pm' => 'Accept PMs',
'usercp_except_blocks' => 'All (except blocks)',
'usercp_only_friends' => 'Friends only',
'usercp_only_staff' => 'Staff only',
'usercp_delete_pms' => 'Delete PMs',
'usercp_yes' => 'Yes',
'usercp_default_delete' => '(Default value for "Delete PM on reply")',
'usercp_save_pms' => 'Save PMs',
'usercp_default_save' => '(Default value for "Save PM to Sentbox")',
'usercp_email_notif' => 'Email notification',
'usercp_notify_pm' => 'Notify me when I have received a PM',
'usercp_notify_torrent' => 'Notify me when a torrent is uploaded in one of <br />       my default browsing categories.',
'usercp_browse' => 'Browse default<br />categories',
'usercp_stylesheet' => 'Stylesheet',
'usercp_language' => 'Language',
'usercp_country' => 'Country',
'usercp_tz' => 'Timezone',
'usercp_checkdst' => 'Daylight Saving',
'usercp_auto_dst' => 'Auto correct DST?',
'usercp_is_dst' => 'Is daylight saving time in effect?',
'usercp_avatar' => 'Avatar URL',
'usercp_no_avatar_allow' => 'Sorry - Avatar changing disabled to your current user class',
'usercp_signature' => 'Signature URL',
'usercp_avatar_info' => 'Width should be 150 pixels (will be resized if necessary)<br />If you need a host for the picture, try the <a href="bitbucket.php">bitbucket</a>.',
'usercp_signature_info' => 'Width should be 500 pixels (will be resized if necessary)<br />If you need a host for the picture, try the <a href="bitbucket.php">bitbucket</a>.',
'usercp_tor_perpage' => 'Torrents per page',
'usercp_default' => '(0=use default setting)',
'usercp_top_perpage' => 'Topics per page',
'usercp_post_perpage' => 'Posts per page',
'usercp_view_avatars' => 'View avatars',
'usercp_view_signatures' => 'View signatures',
'usercp_low_bw' => '(Low bandwidth users might want to turn this off)',
'usercp_info' => 'Info',
'usercp_tags' => 'Displayed on your public page. May contain <a href="tags.php" target="_new">BB codes</a>.',
'usercp_email' => 'Email address',
'usercp_email_pass' => 'Please enter your password if changing your email address!',
'usercp_note' => '<b>Note:</b> In order to change your email address, you will receive another<br />confirmation email to your new address.',
'usercp_chpass' => 'Change password',
'usercp_pass_again' => 'Type password again',
'usercp_submit' => 'Submit changes!',
'usercp_revert' => 'Revert changes!',
#usercp stdhead
'usercp_stdhead' => '\'s private page'

);

?>
/lang/en/lang_takeeditcp.php:

PHP Code:
<?php

$lang 
= array (

#takeeditcp

'takeeditcp_no_data'    => "missing form data",
'takeeditcp_pass_long'  => "Sorry, password is too long (max is 40 chars)",
'takeeditcp_pass_not_match'     => "The passwords didn't match. Try again.",
'takeeditcp_not_valid_email'    => "That doesn't look like a valid email address.",
'takeeditcp_address_taken'      => "Could not change email, address already taken or password mismatch.",
'takeeditcp_user_error'         => "USER ERROR",
'takeeditcp_image_error'        => "Not an image or unsupported image!",
'takeeditcp_small_image'        => "Image is too small",
'takeeditcp_confirm' => "profile change confirmation",
'takeeditcp_avatar_not_allow' => "Sorry - Avatar changing disabled to your current user class"
);

$lang['takeeditcp_email_body'] = <<<EOD
You have requested that your user profile (username <#USERNAME#>)
on <#SITENAME#> should be updated with this email address (<#USEREMAIL#>) as
user contact.

If you did not do this, please ignore this email. The person who entered your
email address had the IP address <#IP_ADDRESS#>. Please do not reply.

To complete the update of your user profile, please follow this link:

<#CHANGE_LINK#>

Your new email address will appear in your profile after you do this. Otherwise
your profile will remain unchanged.
EOD;
?>
credits Mindless@https://09source.kicks-ass.net

Last edited by tobbz; 28th July 2011 at 16:14.
Reply With Quote
  #2  
Old 27th July 2011, 19:34
Bigjoos's Avatar
Bigjoos Bigjoos is offline
U-232 Dev
 
Join Date: May 2008
United Kingdom
Posts: 244
Default
The credits no due to Tbdev, nothing to do with them that mod cos it was me that done it like 90% of the posted stuff
aye Bigjoos was what is now named Tbdev09 -= screw Tbdev cos i was the stupid one that done them only to have some deluded nut job of an admin rename my account as well as other key code contributors, nice of them to do that eh lol.

/*
+------------------------------------------------
| $Date$ 010810
| $Revision$ 2.0
| $Author$ Bigjoos
| $URL$
| $usercp
|
+------------------------------------------------
*/
Reply With Quote
Reply

Tags
cp , mod , user

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT +2. The time now is 21:28. vBulletin skin by ForumMonkeys. Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.