Integrating SMf2.0 RC3 and photopost classifieds

Started by 4X4UK, June 21, 2010, 10:20:06 AM

Previous topic - Next topic

4X4UK

I have recently upgraded from smf 1.19 to smf2.0 RC3  I had the old version bridged to photophost classifieds via the bridging file supplied in photopost classifieds as I expected this no longer works with SMF 2.0 RC3

anyone care to look at it and provide some advice as to what is likely to need altering to work with SMF2.0 aside from the obvious change to lowercase fieldnames for ID_member etc
many thanks

<?php
//////////////////////////// COPYRIGHT NOTICE //////////////////////////////
// This script is part of PhotoPost PHP, a software application by        //
// All Enthusiast, Inc.  Use of any kind of part or all of this           //
// script or modification of this script requires a license from All      //
// Enthusiast, Inc.  Use or modification of this script without a license //
// constitutes Software Piracy and will result in legal action from All   //
// Enthusiast, Inc.  All rights reserved.                                 //
// http://www.photopost.com      [email protected]                      //
// Contributing Developer: Michael Pierce (mpdev.com)                     //
//                                                                        //
//            PhotoPost Copyright 2006, All Enthusiast, Inc.              //
////////////////////////////////////////////////////////////////////////////

// this will return an array like:
// list( $userid, $username, $email, $password, $temppass, $groups, $offset, $sessionid ) = get_userinfo( $user, $userid );

if (!function_exists('sha1'))
{
function sha1($str)
{
// If we have mhash loaded in, use it instead!
if (function_exists('mhash') && defined('MHASH_SHA1'))
return bin2hex(mhash(MHASH_SHA1$str));

$nblk = (strlen($str) + >> 6) + 1;
$blks array_pad(array(), $nblk 160);

for ($i 0$i strlen($str); $i++)
$blks[$i >> 2] |= ord($str{$i}) << (24 - ($i 4) * 8);

$blks[$i >> 2] |= 0x80 << (24 - ($i 4) * 8);

return sha1_core($blksstrlen($str) * 8);
}

// This is the core SHA-1 calculation routine, used by sha1().
function sha1_core($x$len)
{
@$x[$len >> 5] |= 0x80 << (24 $len 32);
$x[(($len 64 >> 9) << 4) + 15] = $len;

$w = array();
$a 1732584193;
$b = -271733879;
$c = -1732584194;
$d 271733878;
$e = -1009589776;

for ($i 0$n count($x); $i $n$i += 16)
{
$olda $a;
$oldb $b;
$oldc $c;
$oldd $d;
$olde $e;

for ($j 0$j 80$j++)
{
if ($j 16)
$w[$j] = isset($x[$i $j]) ? $x[$i $j] : 0;
else
$w[$j] = sha1_rol($w[$j 3] ^ $w[$j 8] ^ $w[$j 14] ^ $w[$j 16], 1);

$t sha1_rol($a5) + sha1_ft($j$b$c$d) + $e $w[$j] + sha1_kt($j);
$e $d;
$d $c;
$c sha1_rol($b30);
$b $a;
$a $t;
}

$a += $olda;
$b += $oldb;
$c += $oldc;
$d += $oldd;
$e += $olde;
}

return sprintf('%08x%08x%08x%08x%08x'$a$b$c$d$e);
}

function sha1_ft($t$b$c$d)
{
if ($t 20)
return ($b $c) | ((~$b) & $d);
if ($t 40)
return $b $c $d;
if ($t 60)
return ($b $c) | ($b $d) | ($c $d);

return $b $c $d;
}

function sha1_kt($t)
{
return $t 20 1518500249 : ($t 40 1859775393 : ($t 60 ? -1894007588 : -899497514));
}

function sha1_rol($num$cnt)
{
// Unfortunately, PHP uses unsigned 32-bit longs only.  So we have to kludge it a bit.
if ($num 0x80000000)
$a = ($num >> 0x7fffffff) >> (31 $cnt);
else
$a $num >> (32 $cnt);

return ($num << $cnt) | $a;
}
}


function 
get_userinfo$authuser$userid=) {
    global 
$Globals$db_link;

    if ( !empty( 
$Globals['dprefix'] ) ) {
        
$utable "{$Globals['dprefix']}members";
        
$stable "{$Globals['dprefix']}log_online";
    }
    else {
        
$utable "smf_members";
        
$stable "smf_log_online";
    }


    if ( 
$userid != ) {
        
$query "SELECT $utable.ID_MEMBER,$utable.memberName,$utable.emailAddress,$utable.passwd,$utable.ID_GROUP,$utable.timeOffset,$utable.ID_THEME,$utable.additionalGroups,$utable.ID_POST_GROUP,$stable.session,$utable.passwordSalt
            FROM 
$utable
            LEFT JOIN 
$stable ON $stable.ID_MEMBER='$userid'
            WHERE 
$utable.ID_MEMBER='$userid'";
    }
    else {
        
$query "SELECT $utable.ID_MEMBER,$utable.memberName,$utable.emailAddress,$utable.passwd,$utable.ID_GROUP,$utable.timeOffset,$utable.ID_THEME,$utable.additionalGroups,$utable.ID_POST_GROUP,$utable.passwordSalt
            FROM 
$utable
            WHERE memberName='
$authuser'";
    }

    
$queryv ppmysql_query($query,$db_link);
    
$results mysql_fetch_row($queryv);

    
$username[0] = $results[0];     // userid
    
$username[1] = $results[1];     // username
    
$username[2] = $results[2];     // email
    
$username[3] = $results[3];     // password
    
$username[4] = "";              // temppassword
    
$username[5] = $results[4];     // groups
    
$username[6] = $results[5];     // timeoffset
    
$username[7] = $results[6];     // stylesheet
    
$username[8] = $results[7];     // additional groups
    
$username[9] = $results[8];     // Post Groups
    
$username[10] = $results[9];     // session
    
$username[11] = $results[10];     // Password Salt
    
ppmysql_free_result($queryv);

    return 
$username;
}

//
// For each BB, get the total number of users
//

function get_totalusers() {
    global 
$Globals$db_link;

    if ( !empty( 
$Globals['dprefix'] ) ) {
        
$utable "{$Globals['dprefix']}members";
    }
    else {
        
$utable "smf_members";
    }

    
$query "SELECT * FROM $utable";

    
$queryv ppmysql_query($query$db_link);
    
$totalusers mysql_num_rows($queryv);

    return( 
$totalusers );
}

//
// For each BB, get the link to the profile page for that user
//

function get_profilelink$tuserid$tusername="" ) {
    global 
$Globals$db_link$postreply$privatelink;

    
$profilelink "{$Globals['vbulletin']}/index.php?action=profile;u=$tuserid";
    
$postreply "<span class=\"{$Style['medium']}\"><b>{$Globals['pp_lang']['postreply']}</b></span>";

    return( 
$profilelink );
}

//
// Get a list of users and ids as an option list
//

function useropts() {
    global 
$Globals$db_link;

    
$useropts "";

    if ( !empty( 
$Globals['dprefix'] ) ) {
        
$utable "{$Globals['dprefix']}members";
    }
    else {
        
$utable "smf_members";
    }

    
$query "SELECT id,name FROM $utable ORDER BY memberName";

    
$queryv ppmysql_query($query,$db_link);
    while ( list( 
$userid$username ) = mysql_fetch_row($queryv) ) {
        
$useropts .= "<option value=\"$userid\">$username</option>";
    }
    
ppmysql_free_result($rows);

    return( 
$useropts );
}

//
// Increment or decrement the user post in the users database
//

function inc_user_posts$type "plus"$userid ) {
    global 
$Globals$db_link$User;

    if ( 
$userid == $usernum $User['userid'];
    else 
$usernum $userid;

    if ( 
$type == "plus" ) {
        
$do_inc "+1";
    }
    else {
        
$do_inc "-1";
    }

    if ( !empty( 
$Globals['dprefix'] ) ) {
        
$utable "{$Globals['dprefix']}members";
    }
    else {
        
$utable "smf_members";
    }

    
$query "UPDATE $utable SET posts=posts$do_inc WHERE ID_MEMBER=$usernum";
    
$resulta ppmysql_query($query,$db_link);

    return;
}


function 
get_profiledata$cuserid ) {
    global 
$Globals$db_link;
    global 
$cuser$clocation$ctitle$cposts$regdate$isonline$hpage$postline$profilelink$privatelink;

    
$regdate ""$ctitle ""$cposts ""$chomepage ""$cuser $Globals['pp_lang']['unreg']; $postline "";
    
$hpage "";

    if (
$cuserid != 0) {
        if ( !empty( 
$Globals['dprefix'] ) ) {
            
$utable "{$Globals['dprefix']}members";
        }
        else {
            
$utable "smf_members";
        }

        
$query "SELECT $utable.memberName,$utable.websiteUrl,$utable.posts,$utable.usertitle,$utable.dateRegistered,$utable.location,$utable.avatar,$utable.signature FROM $utable 
                  WHERE 
$utable.ID_MEMBER=$cuserid LIMIT 1";
        
$results ppmysql_query($query,$db_link);
        list( 
$cuser$chomepage$cposts$ctitle$regdate$clocation$uavatar$csig ) = mysql_fetch_row($results);
        
ppmysql_free_result$results );

        
$postline "<a href=\"$profilelink\" target=\"_blank\"><img src=\"{$Globals['idir']}/profile.gif\" border=\"0\" alt=\"{$Globals['pp_lang']['seeprofile']}\" /></a>";

        
$chomepage str_replace("http://"""$chomepage);
        if (
$chomepage != "" ) {
            
$hpage "<a href=\"http://$chomepage\" target=\"_blank\"><img src=\"{$Globals['idir']}/home.gif\" alt=\"{$Globals['pp_lang']['visithome']}\" border=\"0\" /></a>";
        }

        
$avcheck substr($uavatar04);

        
$userprofile[0] = $cuser;                   // Username
        
$userprofile[1] = $chomepage;               // Homepage
        
$userprofile[2] = $cposts;                  // Total Posts
        
$userprofile[3] = $ctitle;                  // Title
        
$userprofile[4] = $regdate;                 // Registered Date
        
$userprofile[5] = "$clocation";                  // Location

        
if ( !empty($avcheck) ) {
            if (
$avcheck != "http" ) {
                
$userprofile[6] = "<img src=\"{$Globals['vbulletin']}/avatars/$uavatar\" />";  // Avatar
            
}
            elseif (
$avcheck == "http" ) {
                
$userprofile[6] = "<img src=\"$uavatar\" />";  // Avatar
            
}
            else {
                
$userprofile[6] = "";  // Avatar
            
}
        }

        
$userprofile[7] = nl2br($csig); // Signature
    
}

    
$postline .= "$hpage<!--PhotoPost, copyright All, Enthusiast, Inc.--></td>";

    return( 
$userprofile );
}

function 
setlogin$password ) {
    global 
$Globals$User$db_link$_SERVER;

    
$cookpass sha1($User['password'] . $User['salt']);
    
$data serialize(empty($User['userid']) ? array(0''0) : array($User['userid'], $cookpasstime() + $cookie_length2));
    
setcookie"{$Globals['smfcookie']}"$datatime()+31536000,"{$Globals['cookie_path']}"$Globals['domain_path'],);


$session_id md5uniqid(microtime()) );
setcookie("PHPSESSID","$session_id","0","{$Globals['cookie_path']}"$Globals['domain_path'] );

    
$ipaddr findenv("REMOTE_ADDR");
    
$agent findenv("HTTP_USER_AGENT");
    
$browser addslashessubstr($agent050) ) ;
    
$sesstime time();

    if ( !empty( 
$Globals['dprefix'] ) ) {
        
$stable "{$Globals['dprefix']}log_online";
    }
    else {
        
$stable "smf_log_online";
    }

    
$query "DELETE FROM $stable WHERE ID_MEMBER='{$User['userid']}'";
    
$result ppmysql_query($query,$db_link);
    
ppmysql_free_result($result);

$query "INSERT INTO $stable (session, logTime, ID_MEMBER, ip, url)
    VALUES ('
$session_id',$sesstime,{$User['userid']},'$ipaddr','$browser')";
    
$result ppmysql_query($query,$db_link);
    
ppmysql_free_result($result);
    return;
}

function 
logout() {
    global 
$Globals;

 
setcookie"{$Globals['smfcookie']}"""time()+31536000,"{$Globals['cookie_path']}"$Globals['domain_path'],);
setcookie("PHPSESSID","","0","{$Globals['cookie_path']}"$Globals['domain_path'] );

    return;
}


function 
get_regcode() {
    global 
$Globals;

    
$regtext " &middot; <a href=\"{$Globals['vbulletin']}/index.php?action=register\">{$Globals['pp_lang']['register']}</a>";

    return(
$regtext);
}

function 
get_logincode() {
    global 
$Globals$User$db_link;

    if ( 
$Globals['forumstyle'] == "yes" 
    {
        
$stylec ppmysql_query("SELECT value FROM {$Globals['dprefix']}settings WHERE variable ='theme_default'",$db_link);
        list( 
$defaultstyle ) = mysql_fetch_row($stylec);
        
        
$styled ppmysql_query("SELECT value FROM {$Globals['dprefix']}themes WHERE variable ='theme_url' AND ID_THEME = '$defaultstyle'",$db_link);
        list( 
$finalstyle ) = mysql_fetch_row($styled);
        
        
$User['stylesheet'] = $finalstyle;
    }

    
$links[0] = "{$Globals['vbulletin']}/index.php?action=login";
    
$links[1] = "{$Globals['vbulletin']}/index.php?action=logout";

    return(
$links);
}

function 
authenticate$authuser=""$chkpassword="" ) {
    global 
$Globals$User$password$link$db_link;
    global 
$postid$phoedit$gologin$bbuserid$bbpassword;
    global 
$up_k$disk_k$cedit$usergroup;
    global 
$CatPerms$ueditpho$ueditposts$exclude_cat;
    global 
$PHPSESSID$cookiename;
    
$PHPSESSID $_COOKIE["PHPSESSID"];

    
// Init some variables
    
$User = array(); 
    
$User['uploads'] = 0;     
    
$User['userid'] = 0;
    
$User['nopost'] = 1;
    
$User['adminedit'] = 0;
    
$User['moderator'] = 0;
    
$User['uploadlimit'] = 0;

    
$gologin 1$usergroup 0$checkpass 0;
    
$ueditpho 0$ueditposts 0
    
$diskspace 0$uploadsize 0;
    
$md5cookpass="";

    
// This assumes that Id for "Guests" is 100
    
$usergroup 100;


    
// If we arent passing variables, set them to what was passed in the URL
    
if ( $authuser == "" ) {
        if (
$_COOKIE[$Globals['smfcookie']]) {
            list (
$ID_MEMBER$ID_PASSWORD) = @unserialize(stripslashes($_COOKIE[$Globals['smfcookie']]));
            list( 
$userid$username$email$dbpassword$md5temppass$usergroup$offset$numstyle$secondarygroups$postgroups$sessionid$salt ) = get_userinfo""$ID_MEMBER );
        }
    }
    else {
        
$finalpass sha1(strtolower($authuser) . $chkpassword);
        
$cookuser addslashes($authuser);

        list( 
$userid$username$email$dbpassword$md5temppass$usergroup$offset$numstyle$secondarygroups$postgroups$salt ) = get_userinfo$cookuser );
    }

    
$lastpass sha1($dbpassword $salt);

    if ( (
$PHPSESSID) && ($PHPSESSID == $sessionid) ) {
        
$checkpass 1;
    }
    elseif (
$ID_PASSWORD) {
        if (
$lastpass == $ID_PASSWORD) {
            
$checkpass 1;
        }
    }
    elseif (
$dbpassword) {
        if (
$dbpassword == $finalpass) {
            
$checkpass 1;
        }

        
// just to be sure, lets see if they have a temp pass for verification and do the same checks
        
if ( $md5temppass != "" && $checkpass != ) {
            if ( 
$md5cookpass == $md5temppass $checkpass 1;
        }
    }

    if ( !empty(
$Globals['dprefix']) ) {
        
$ctable "{$Globals['dprefix']}settings";
        
$extable "{$Globals['dprefix']}themes";
    }
    else {
        
$ctable "smf_settings";
        
$extable "smf_themes";
    }

    if ( 
$authuser == "" ) {

           
$query "SELECT value FROM $ctable
            WHERE variable ='theme_guests'"
;
            
$stylec ppmysql_query($query,$db_link);
            list( 
$gueststyle ) = mysql_fetch_row($stylec);
            
ppmysql_free_result$stylec );
    }

        
// If they don't have a stylesheet pref we use the default
        
if ( $User['userid'] != ) {
           
$query "SELECT value FROM $ctable
            WHERE variable ='theme_default'"
;
            
$stylec ppmysql_query($query,$db_link);
            list( 
$userstyle ) = mysql_fetch_row($stylec);

            if ( 
$numstyle == "" || $numstyle == ) {
                
$numstyle $userstyle;
            }
        }
        else {
            
$numstyle $gueststyle;
        }


           
$query "SELECT value FROM $extable
            WHERE variable ='theme_url' AND ID_THEME = '
$numstyle'";
            
$styled ppmysql_query($query,$db_link);
            list( 
$finalstyle ) = mysql_fetch_row($styled);
            
ppmysql_free_result$styled );

// If they don't have a stylesheet pref we use the default
if ( $User['userid'] == ) {
$User['stylesheet'] = $finalstyle;
}

    
//print "($checkpass : $ID_MEMBER : $ID_PASSWORD : $lastpass : $finalpass ) $userid - $username - $email - $dbpassword - $md5temppass - ($usergroup) - $offset - $numstyle - $secondarygroups - $sessionid";
    //exit;

    
if ( $checkpass == ) {
        
$gologin=0$User['nopost']=0;
        
$User['userid'] = $userid;
        
$User['username'] = $username;
        
$User['email'] = $email;
        
$User['offset'] = $offset;
        
$User['password'] = $dbpassword;
        
$User['salt'] = $salt;
        
$User['stylesheet'] = $finalstyle;
    }

        if (
$usergroup == 0) {
            
$usergroup 4;
        }
        elseif ( 
$usergroup == "" ) {
        
// login for guests
             
$usergroup 100;
        }
   
        if ( !empty(
$secondarygroups)) {
            
$usergroup "$usergroup,$secondarygroups";
        }

        if ( !empty(
$postgroups)) {
            
$usergroup "$usergroup,$postgroups";
        }

    
$xloop=0$unl_up=0$unl_disk=0$nouploadlimit=0$nomod=0$nopay;
    
$vbgroups explode","$usergroup);
    
$CatPerms = array();

    foreach ( 
$vbgroups as $groupvalue ) {
        if ( 
is_numeric($groupvalue) ) {
            
$query "SELECT groupid,cpaccess,modaccess,uploadsize,uploads,comments,editpho,editposts,reqmod,highlight,bold,italic,payment,uplimit FROM {$Globals['pp_db_prefix']}usergroups WHERE groupid=$groupvalue LIMIT 1";
            
$result ppmysql_query($query,$link);
            list( 
$usergroup,$cpaccess_a,$modaccess_a,$uploadsize_a,$uploads_a,$comments_a,$ueditpho_a,$ueditposts_a,$reqmod_a,$high_a,$bold_a,$ital_a,$payment_a,$uplimit_a ) = mysql_fetch_row($result);
            
ppmysql_free_result($result);

            if ( 
$cpaccess_a   || !$User['adminedit']   ) $User['adminedit']   = $cpaccess_a;
            if ( 
$modaccess_a  || !$User['moderator']   ) $User['moderator']   = $modaccess_a;
            if ( 
$uploadsize_a >  $up_k         $up_k        $uploadsize_a;
            if ( 
$uploads_a    || !$User['uploads'] ) $User['uploads'] = $uploads_a;
            if ( 
$comments_a   || !$User['comments'] ) $User['comments'] = $comments_a;
            if ( 
$ueditpho_a   || !$ueditpho    $ueditpho    $ueditpho_a;
            if ( 
$ueditposts_a || !$ueditposts  $ueditposts  $ueditposts_a;
            if ( 
$reqmod_a     || !$User['usemod'] ) $User['usemod'] = $reqmod_a;
            if ( 
$payment_a     || !$User['payment'] ) $User['payment'] = $payment_a;
            if ( 
$uplimit_a     || !$User['uploadlimit'] ) $User['uploadlimit'] = $uplimit_a;
            if ( 
$high_a     || !$User['highlight'] ) $User['highlight'] = $high_a;
            if ( 
$bold_a     || !$User['bold'] ) $User['bold'] = $bold_a;
            if ( 
$ital_a     || !$User['italic'] ) $User['italic'] = $ital_a;

            if ( 
$uploadsize_a == && $uploads_a $unl_up 1;
            if ( 
$reqmod_a     == $nomod 1;                        
            if ( 
$payment_a     == $nopay 1;                        
            if ( 
$uplimit_a     == $nouploadlimit 1;                        

            
set_group_perms$groupvalue$xloop );
            
$xloop++;
        }
    }
    unset( 
$Globals['cats'] );

    
// If any of these values were "unlimited" or "no", then they override any other group setting
    // (i.e. if one group has no upload limit, then the user has no upload limit)
    
if ( $nomod == )         $User['usemod'] = 0;
    if ( 
$nopay == )         $User['payment'] = 0;
    if ( 
$unl_up == )        $up_k 0;
    if ( 
$unl_disk == )      $disk_k 0;
    if ( 
$nouploadlimit == $User['uploadlimit'] = 0;

    
$Globals['offset'] = $offset;


    if ( 
$gologin == ) {
        
$User['username'] = $Globals['pp_lang']['unreg'];
        
$User['userid'] = 0;
        
$Globals['offset'] = $Globals['gmtoffset'];
    }

    return( 
$gologin );
}

function 
import_user_groups() {
global $Globals$db_link$link;

    if ( !empty( 
$Globals['dprefix'] ) ) $gtable "{$Globals['dprefix']}membergroups";
    else 
$gtable "smf_membergroups";

$query "SELECT groupid, groupname, cpaccess, uploads, comments, uploadsize, editpho, editposts, modaccess, reqmod, highlight, bold, italic, payment, uplimit FROM {$Globals['pp_db_prefix']}usergroups";
$resultcur ppmysql_query($query$link);
$currentGroups = array();

while ( list($groupid$groupname$cpaccess$uploads$comments$uploadsize$editpho$editposts$modaccess$reqmod$highlite$bold$italic$payment$uplimit ) = mysql_fetch_row$resultcur ) ) {
$currentGroups[$groupid]['groupid'] = $groupid;
$currentGroups[$groupid]['groupname'] = $groupname;
$currentGroups[$groupid]['cpaccess'] =  $cpaccess;
$currentGroups[$groupid]['uploads'] =  $uploads;
$currentGroups[$groupid]['comments'] =  $comments;
$currentGroups[$groupid]['uploadsize'] =  $uploadsize;
$currentGroups[$groupid]['editpho'] =  $editpho;
$currentGroups[$groupid]['editposts'] =  $editposts;
$currentGroups[$groupid]['modaccess'] =  $modaccess;
$currentGroups[$groupid]['reqmod'] =  $reqmod;
$currentGroups[$groupid]['highlite'] =  $highlite;
$currentGroups[$groupid]['bold'] =  $bold;
$currentGroups[$groupid]['italic'] =  $italic;
$currentGroups[$groupid]['payment'] =  $payment;
$currentGroups[$groupid]['uplimit'] =  $uplimit;
}

    
$query "SELECT ID_GROUP,groupName FROM $gtable";
    
$readug ppmysql_query($query,$db_link);
$newGroups = array();

while ( list($gid$title ) = mysql_fetch_row$readug ) ) {
$newGroups[$gid] = $gid;
        if ( 
$gid == ) {
        
$cancontrol 1;
       }
        else {
       
$cancontrol 0;
       }        
if ( !array_key_exists($gid,$currentGroups) ) {
$currentGroups[$gid]['groupid'] = $gid;
$currentGroups[$gid]['groupname'] = $title;
$currentGroups[$gid]['cpaccess'] =  $cancontrol;
$currentGroups[$gid]['uploads'] =  0;
$currentGroups[$gid]['comments'] = 0;
$currentGroups[$gid]['diskspace'] =  0;
$currentGroups[$gid]['uploadsize'] = 0;
$currentGroups[$gid]['editpho'] =  0;
$currentGroups[$gid]['editposts'] =  0;
$currentGroups[$gid]['modaccess'] =  0;
$currentGroups[$gid]['reqmod'] =  0;
$currentGroups[$gid]['highlite'] =  0;
$currentGroups[$gid]['bold'] =  0;
$currentGroups[$gid]['italic'] =  0;
$currentGroups[$gid]['payment'] =  0;
$currentGroups[$gid]['uplimit'] =  0;
}
}
ppmysql_free_result$readug );

foreach ($currentGroups as $currentGroup) {
$gid $currentGroup['groupid'];
if ( !array_key_exists($gid$newGroups)) {
unset($currentGroups[$gid]);
}
}

$query "DELETE FROM {$Globals['pp_db_prefix']}usergroups";
$resulta ppmysql_query($query$link);

foreach ($currentGroups as $currentGroup) {
$gid $currentGroup['groupid'];
$name addslashes($currentGroup['groupname']);
$cpaccess $currentGroup['cpaccess'];
$uploads $currentGroup['uploads'];
$comments = $currentGroup['comments'];
$uploadsize $currentGroup['uploadsize'];
$editpho $currentGroup['editpho'];
$editposts $currentGroup['editposts'];
$modaccess $currentGroup['modaccess'];
$reqmod $currentGroup['reqmod'];
$highlite $currentGroup['highlite'];
$bold $currentGroup['bold'];
$italic $currentGroup['italic'];
$payment $currentGroup['payment'];
$uplimit $currentGroup['uplimit'];

$query="INSERT INTO {$Globals['pp_db_prefix']}usergroups (groupid,groupname,modaccess,cpaccess,uploads,comments,uploadsize,editpho,editposts,reqmod,highlight,bold,italic,payment) VALUES('$gid','$name','$modaccess','$cpaccess','$uploads','$comments','$uploadsize','$editpho','$editposts','$reqmod', $highlite$bold$italic$payment)";
$setug ppmysql_query($query,$link);
}

$query="INSERT INTO {$Globals['pp_db_prefix']}usergroups (groupid,groupname,modaccess,cpaccess,uploads,comments,editpho,editposts,reqmod,highlight,bold,italic,payment) VALUES('100','Guests',0,0,0,0,0,0,0,0,0,0,0)";
$setukppmysql_query($query,$link);
}


function 
init_user_groups() {
    global 
$Globals$link;

    
$query "CREATE TABLE {$Globals['pp_db_prefix']}usergroups (groupid int(5) NOT NULL auto_increment, 
                                                        groupname varchar(50) NOT NULL default '', 
                                                        cpaccess smallint(3) NOT NULL default '0', 
                                                        modaccess smallint(3) NOT NULL default '0', 
                                                        uploads smallint(3) NOT NULL default '1', 
                                                        comments smallint(3) NOT NULL default '1', 
                                                        uploadsize int(10) default '0' NOT NULL, 
                                                        editpho int(3) NOT NULL default '0', 
                                                        editposts int(3) NOT NULL default '0', 
                                                        reqmod INT(3) DEFAULT '0' NOT NULL,
                                                        highlight INT(3) DEFAULT '0' NOT NULL,
                                                        bold INT(3) DEFAULT '0' NOT NULL,
                                                        italic INT(3) DEFAULT '0' NOT NULL,
                                                        payment INT(3) DEFAULT '0' NOT NULL,
                                                        uplimit INT(3) DEFAULT '0' NOT NULL,
                                                        PRIMARY KEY (groupid)) TYPE=MyISAM"
;
    
$setup mysql_query($query,$link);
    
    return(
$setup);

}


function 
convert_markups($markup
{
    global 
$Globals;

    return ( 
ppconvert_markups($markup) );    
}


function 
get_forum_style()
{
    global 
$Globals$User;

    if ( 
$Globals['forumstyle'] == "yes" 
    {
        return ( 
"<link rel=\"stylesheet\" href=\"{$User['stylesheet']}/style.css\" type=\"text/css\" />" );
    }

    return( 
"<link rel=\"stylesheet\" href=\"{$Globals['maindir']}/stylesheets/{$Globals['theme']}.css\" type=\"text/css\" />" );
}


//
// Style references
//

if ( $Globals['forumstyle'] == "yes" ) {
    
$Style['onbody'] = "onbody";
    
$Style['tableborders'] = "tborder";
    
$Style['tablesurround'] = "";
    
$Style['tddetails'] = "windowbg";
    
$Style['tdbackground'] = "windowbg2";
    
$Style['tdnothumbs'] = "titlebg";
    
$Style['menubar'] = "titlebg";
    
$Style['menubarnb'] = "";
    
$Style['catcolumn'] = "windowbg2";
    
$Style['photocol'] = "windowbg";
    
$Style['commentscol'] = "windowbg";
    
$Style['lastphocol'] = "windowbg";
    
$Style['lastcommcol'] = "windowbg2";
    
$Style['small'] = "smalltext";
    
$Style['medium'] = "normaltext";
    
$Style['large'] = "largetext";
    
$Style['welcome'] = "normaltext";
    
$Style['lighttable'] = "windowbg";
    
$Style['alternatetable'] = "windowbg2";
    
$Style['formboxes'] = "input";
    
$Style['blockquote'] = "quote";
}

?>

Advertisement: